var Xte=Object.defineProperty;var Qte=(e,t,r)=>t in e?Xte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var yd=(e,t,r)=>Qte(e,typeof t!="symbol"?t+"":t,r);function Zte(e,t){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();var Cv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W5={exports:{}},Hx={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var V6;function Jte(){if(V6)return Hx;V6=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,i,a){var o=null;if(a!==void 0&&(o=""+a),i.key!==void 0&&(o=""+i.key),"key"in i){a={};for(var c in i)c!=="key"&&(a[c]=i[c])}else a=i;return i=a.ref,{$$typeof:e,type:n,key:o,ref:i!==void 0?i:null,props:a}}return Hx.Fragment=t,Hx.jsx=r,Hx.jsxs=r,Hx}var F6;function ere(){return F6||(F6=1,W5.exports=Jte()),W5.exports}var s=ere(),K5={exports:{}},Pn={};/** * @license React * react.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var $6;function tre(){if($6)return Pn;$6=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),w=Symbol.iterator;function A(se){return se===null||typeof se!="object"?null:(se=w&&se[w]||se["@@iterator"],typeof se=="function"?se:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,T={};function D(se,xe,ae){this.props=se,this.context=xe,this.refs=T,this.updater=ae||S}D.prototype.isReactComponent={},D.prototype.setState=function(se,xe){if(typeof se!="object"&&typeof se!="function"&&se!=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,se,xe,"setState")},D.prototype.forceUpdate=function(se){this.updater.enqueueForceUpdate(this,se,"forceUpdate")};function V(){}V.prototype=D.prototype;function U(se,xe,ae){this.props=se,this.context=xe,this.refs=T,this.updater=ae||S}var G=U.prototype=new V;G.constructor=U,j(G,D.prototype),G.isPureReactComponent=!0;var X=Array.isArray;function q(){}var B={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function F(se,xe,ae){var qe=ae.ref;return{$$typeof:e,type:se,key:xe,ref:qe!==void 0?qe:null,props:ae}}function $(se,xe){return F(se.type,xe,se.props)}function J(se){return typeof se=="object"&&se!==null&&se.$$typeof===e}function Q(se){var xe={"=":"=0",":":"=2"};return"$"+se.replace(/[=:]/g,function(ae){return xe[ae]})}var K=/\/+/g;function me(se,xe){return typeof se=="object"&&se!==null&&se.key!=null?Q(""+se.key):xe.toString(36)}function re(se){switch(se.status){case"fulfilled":return se.value;case"rejected":throw se.reason;default:switch(typeof se.status=="string"?se.then(q,q):(se.status="pending",se.then(function(xe){se.status==="pending"&&(se.status="fulfilled",se.value=xe)},function(xe){se.status==="pending"&&(se.status="rejected",se.reason=xe)})),se.status){case"fulfilled":return se.value;case"rejected":throw se.reason}}throw se}function le(se,xe,ae,qe,pt){var Fe=typeof se;(Fe==="undefined"||Fe==="boolean")&&(se=null);var jt=!1;if(se===null)jt=!0;else switch(Fe){case"bigint":case"string":case"number":jt=!0;break;case"object":switch(se.$$typeof){case e:case t:jt=!0;break;case m:return jt=se._init,le(jt(se._payload),xe,ae,qe,pt)}}if(jt)return pt=pt(se),jt=qe===""?"."+me(se,0):qe,X(pt)?(ae="",jt!=null&&(ae=jt.replace(K,"$&/")+"/"),le(pt,xe,ae,"",function(Ie){return Ie})):pt!=null&&(J(pt)&&(pt=$(pt,ae+(pt.key==null||se&&se.key===pt.key?"":(""+pt.key).replace(K,"$&/")+"/")+jt)),xe.push(pt)),1;jt=0;var Pt=qe===""?".":qe+":";if(X(se))for(var Ae=0;Ae>>1,Z=le[Ve];if(0>>1;Vei(ae,je))qei(pt,ae)?(le[Ve]=pt,le[qe]=je,Ve=qe):(le[Ve]=ae,le[xe]=je,Ve=xe);else if(qei(pt,je))le[Ve]=pt,le[qe]=je,Ve=qe;else break e}}return ve}function i(le,ve){var je=le.sortIndex-ve.sortIndex;return je!==0?je:le.id-ve.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,c=o.now();e.unstable_now=function(){return o.now()-c}}var h=[],f=[],m=1,y=null,w=3,A=!1,S=!1,j=!1,T=!1,D=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function G(le){for(var ve=r(f);ve!==null;){if(ve.callback===null)n(f);else if(ve.startTime<=le)n(f),ve.sortIndex=ve.expirationTime,t(h,ve);else break;ve=r(f)}}function X(le){if(j=!1,G(le),!S)if(r(h)!==null)S=!0,q||(q=!0,Q());else{var ve=r(f);ve!==null&&re(X,ve.startTime-le)}}var q=!1,B=-1,z=5,F=-1;function $(){return T?!0:!(e.unstable_now()-Fle&&$());){var Ve=y.callback;if(typeof Ve=="function"){y.callback=null,w=y.priorityLevel;var Z=Ve(y.expirationTime<=le);if(le=e.unstable_now(),typeof Z=="function"){y.callback=Z,G(le),ve=!0;break t}y===r(h)&&n(h),G(le)}else n(h);y=r(h)}if(y!==null)ve=!0;else{var se=r(f);se!==null&&re(X,se.startTime-le),ve=!1}}break e}finally{y=null,w=je,A=!1}ve=void 0}}finally{ve?Q():q=!1}}}var Q;if(typeof U=="function")Q=function(){U(J)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,me=K.port2;K.port1.onmessage=J,Q=function(){me.postMessage(null)}}else Q=function(){D(J,0)};function re(le,ve){B=D(function(){le(e.unstable_now())},ve)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(le){le.callback=null},e.unstable_forceFrameRate=function(le){0>le||125Ve?(le.sortIndex=je,t(f,le),r(h)===null&&le===r(f)&&(j?(V(B),B=-1):j=!0,re(X,je-Ve))):(le.sortIndex=Z,t(h,le),S||A||(S=!0,q||(q=!0,Q()))),le},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(le){var ve=w;return function(){var je=w;w=ve;try{return le.apply(this,arguments)}finally{w=je}}}})(Q5)),Q5}var q6;function ire(){return q6||(q6=1,X5.exports=nre()),X5.exports}var Z5={exports:{}},yo={};/** * @license React * react-dom.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var W6;function sre(){if(W6)return yo;W6=1;var e=Mg();function t(h){var f="https://react.dev/errors/"+h;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Z5.exports=sre(),Z5.exports}/** * @license React * react-dom-client.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Y6;function are(){if(Y6)return Gx;Y6=1;var e=ire(),t=Mg(),r=QV();function n(l){var d="https://react.dev/errors/"+l;if(1Z||(l.current=Ve[Z],Ve[Z]=null,Z--)}function ae(l,d){Z++,Ve[Z]=l.current,l.current=d}var qe=se(null),pt=se(null),Fe=se(null),jt=se(null);function Pt(l,d){switch(ae(Fe,d),ae(pt,l),ae(qe,null),d.nodeType){case 9:case 11:l=(l=d.documentElement)&&(l=l.namespaceURI)?u6(l):0;break;default:if(l=d.tagName,d=d.namespaceURI)d=u6(d),l=d6(d,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}xe(qe),ae(qe,l)}function Ae(){xe(qe),xe(pt),xe(Fe)}function Ie(l){l.memoizedState!==null&&ae(jt,l);var d=qe.current,x=d6(d,l.type);d!==x&&(ae(pt,l),ae(qe,x))}function vt(l){pt.current===l&&(xe(qe),xe(pt)),jt.current===l&&(xe(jt),zx._currentValue=je)}var Re,It;function Dt(l){if(Re===void 0)try{throw Error()}catch(x){var d=x.stack.trim().match(/\n( *(at )?)/);Re=d&&d[1]||"",It=-1)":-1C||_e[N]!==rt[C]){var Nt=` `+_e[N].replace(" at new "," at ");return l.displayName&&Nt.includes("")&&(Nt=Nt.replace("",l.displayName)),Nt}while(1<=N&&0<=C);break}}}finally{cr=!1,Error.prepareStackTrace=x}return(x=l?l.displayName||l.name:"")?Dt(x):""}function Ct(l,d){switch(l.tag){case 26:case 27:case 5:return Dt(l.type);case 16:return Dt("Lazy");case 13:return l.child!==d&&d!==null?Dt("Suspense Fallback"):Dt("Suspense");case 19:return Dt("SuspenseList");case 0:case 15:return St(l.type,!1);case 11:return St(l.type.render,!1);case 1:return St(l.type,!0);case 31:return Dt("Activity");default:return""}}function Gt(l){try{var d="",x=null;do d+=Ct(l,x),x=l,l=l.return;while(l);return d}catch(N){return` Error generating stack: `+N.message+` `+N.stack}}var Xe=Object.prototype.hasOwnProperty,Xt=e.unstable_scheduleCallback,Ot=e.unstable_cancelCallback,or=e.unstable_shouldYield,Wr=e.unstable_requestPaint,dr=e.unstable_now,yn=e.unstable_getCurrentPriorityLevel,He=e.unstable_ImmediatePriority,Rt=e.unstable_UserBlockingPriority,nr=e.unstable_NormalPriority,fr=e.unstable_LowPriority,hn=e.unstable_IdlePriority,en=e.log,Ci=e.unstable_setDisableYieldValue,Gr=null,be=null;function Pe(l){if(typeof en=="function"&&Ci(l),be&&typeof be.setStrictMode=="function")try{be.setStrictMode(Gr,l)}catch{}}var $e=Math.clz32?Math.clz32:Lt,ct=Math.log,yr=Math.LN2;function Lt(l){return l>>>=0,l===0?32:31-(ct(l)/yr|0)|0}var Lr=256,ir=262144,pr=4194304;function br(l){var d=l&42;if(d!==0)return d;switch(l&-l){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 l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function ln(l,d,x){var N=l.pendingLanes;if(N===0)return 0;var C=0,R=l.suspendedLanes,Y=l.pingedLanes;l=l.warmLanes;var ce=N&134217727;return ce!==0?(N=ce&~R,N!==0?C=br(N):(Y&=ce,Y!==0?C=br(Y):x||(x=ce&~l,x!==0&&(C=br(x))))):(ce=N&~R,ce!==0?C=br(ce):Y!==0?C=br(Y):x||(x=N&~l,x!==0&&(C=br(x)))),C===0?0:d!==0&&d!==C&&(d&R)===0&&(R=C&-C,x=d&-d,R>=x||R===32&&(x&4194048)!==0)?d:C}function de(l,d){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&d)===0}function ke(l,d){switch(l){case 1:case 2:case 4:case 8:case 64:return d+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 d+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 Ze(){var l=pr;return pr<<=1,(pr&62914560)===0&&(pr=4194304),l}function Ft(l){for(var d=[],x=0;31>x;x++)d.push(l);return d}function Fr(l,d){l.pendingLanes|=d,d!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function gr(l,d,x,N,C,R){var Y=l.pendingLanes;l.pendingLanes=x,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=x,l.entangledLanes&=x,l.errorRecoveryDisabledLanes&=x,l.shellSuspendCounter=0;var ce=l.entanglements,_e=l.expirationTimes,rt=l.hiddenUpdates;for(x=Y&~x;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var jr=/[\n"\\]/g;function _r(l){return l.replace(jr,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function _n(l,d,x,N,C,R,Y,ce){l.name="",Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?l.type=Y:l.removeAttribute("type"),d!=null?Y==="number"?(d===0&&l.value===""||l.value!=d)&&(l.value=""+Et(d)):l.value!==""+Et(d)&&(l.value=""+Et(d)):Y!=="submit"&&Y!=="reset"||l.removeAttribute("value"),d!=null?pe(l,Y,Et(d)):x!=null?pe(l,Y,Et(x)):N!=null&&l.removeAttribute("value"),C==null&&R!=null&&(l.defaultChecked=!!R),C!=null&&(l.checked=C&&typeof C!="function"&&typeof C!="symbol"),ce!=null&&typeof ce!="function"&&typeof ce!="symbol"&&typeof ce!="boolean"?l.name=""+Et(ce):l.removeAttribute("name")}function Be(l,d,x,N,C,R,Y,ce){if(R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(l.type=R),d!=null||x!=null){if(!(R!=="submit"&&R!=="reset"||d!=null)){ze(l);return}x=x!=null?""+Et(x):"",d=d!=null?""+Et(d):x,ce||d===l.value||(l.value=d),l.defaultValue=d}N=N??C,N=typeof N!="function"&&typeof N!="symbol"&&!!N,l.checked=ce?l.checked:!!N,l.defaultChecked=!!N,Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"&&(l.name=Y),ze(l)}function pe(l,d,x){d==="number"&&Er(l.ownerDocument)===l||l.defaultValue===""+x||(l.defaultValue=""+x)}function ur(l,d,x,N){if(l=l.options,d){d={};for(var C=0;C"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pa=!1;if(Rn)try{var ri={};Object.defineProperty(ri,"passive",{get:function(){Pa=!0}}),window.addEventListener("test",ri,ri),window.removeEventListener("test",ri,ri)}catch{Pa=!1}var fa=null,pa=null,yl=null;function Oa(){if(yl)return yl;var l,d=pa,x=d.length,N,C="value"in fa?fa.value:fa.textContent,R=C.length;for(l=0;l=$r),Mn=" ",ni=!1;function Ms(l,d){switch(l){case"keyup":return mt.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zi(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Ks=!1;function $n(l,d){switch(l){case"compositionend":return zi(d);case"keypress":return d.which!==32?null:(ni=!0,Mn);case"textInput":return l=d.data,l===Mn&&ni?null:l;default:return null}}function Ni(l,d){if(Ks)return l==="compositionend"||!Vt&&Ms(l,d)?(l=Oa(),yl=pa=fa=null,Ks=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:x,offset:d-l};l=N}e:{for(;x;){if(x.nextSibling){x=x.nextSibling;break e}x=x.parentNode}x=void 0}x=P(x)}}function W(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?W(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function ee(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var d=Er(l.document);d instanceof l.HTMLIFrameElement;){try{var x=typeof d.contentWindow.location.href=="string"}catch{x=!1}if(x)l=d.contentWindow;else break;d=Er(l.document)}return d}function oe(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}var ye=Rn&&"documentMode"in document&&11>=document.documentMode,Se=null,Te=null,Ye=null,dt=!1;function Wt(l,d,x){var N=x.window===x?x.document:x.nodeType===9?x:x.ownerDocument;dt||Se==null||Se!==Er(N)||(N=Se,"selectionStart"in N&&oe(N)?N={start:N.selectionStart,end:N.selectionEnd}:(N=(N.ownerDocument&&N.ownerDocument.defaultView||window).getSelection(),N={anchorNode:N.anchorNode,anchorOffset:N.anchorOffset,focusNode:N.focusNode,focusOffset:N.focusOffset}),Ye&&_(Ye,N)||(Ye=N,N=fv(Te,"onSelect"),0>=Y,C-=Y,ec=1<<32-$e(d)+C|x<Bn?(si=qr,qr=null):si=qr.sibling;var Ai=ot(We,qr,tt[Bn],kt);if(Ai===null){qr===null&&(qr=si);break}l&&qr&&Ai.alternate===null&&d(We,qr),Le=R(Ai,Le,Bn),Ei===null?rn=Ai:Ei.sibling=Ai,Ei=Ai,qr=si}if(Bn===tt.length)return x(We,qr),Qn&&xi(We,Bn),rn;if(qr===null){for(;BnBn?(si=qr,qr=null):si=qr.sibling;var Dh=ot(We,qr,Ai.value,kt);if(Dh===null){qr===null&&(qr=si);break}l&&qr&&Dh.alternate===null&&d(We,qr),Le=R(Dh,Le,Bn),Ei===null?rn=Dh:Ei.sibling=Dh,Ei=Dh,qr=si}if(Ai.done)return x(We,qr),Qn&&xi(We,Bn),rn;if(qr===null){for(;!Ai.done;Bn++,Ai=tt.next())Ai=Tt(We,Ai.value,kt),Ai!==null&&(Le=R(Ai,Le,Bn),Ei===null?rn=Ai:Ei.sibling=Ai,Ei=Ai);return Qn&&xi(We,Bn),rn}for(qr=N(qr);!Ai.done;Bn++,Ai=tt.next())Ai=gt(qr,We,Bn,Ai.value,kt),Ai!==null&&(l&&Ai.alternate!==null&&qr.delete(Ai.key===null?Bn:Ai.key),Le=R(Ai,Le,Bn),Ei===null?rn=Ai:Ei.sibling=Ai,Ei=Ai);return l&&qr.forEach(function(Yte){return d(We,Yte)}),Qn&&xi(We,Bn),rn}function Ki(We,Le,tt,kt){if(typeof tt=="object"&&tt!==null&&tt.type===j&&tt.key===null&&(tt=tt.props.children),typeof tt=="object"&&tt!==null){switch(tt.$$typeof){case A:e:{for(var rn=tt.key;Le!==null;){if(Le.key===rn){if(rn=tt.type,rn===j){if(Le.tag===7){x(We,Le.sibling),kt=C(Le,tt.props.children),kt.return=We,We=kt;break e}}else if(Le.elementType===rn||typeof rn=="object"&&rn!==null&&rn.$$typeof===z&&Ic(rn)===Le.type){x(We,Le.sibling),kt=C(Le,tt.props),_l(kt,tt),kt.return=We,We=kt;break e}x(We,Le);break}else d(We,Le);Le=Le.sibling}tt.type===j?(kt=Sc(tt.props.children,We.mode,kt,tt.key),kt.return=We,We=kt):(kt=Tm(tt.type,tt.key,tt.props,null,We.mode,kt),_l(kt,tt),kt.return=We,We=kt)}return Y(We);case S:e:{for(rn=tt.key;Le!==null;){if(Le.key===rn)if(Le.tag===4&&Le.stateNode.containerInfo===tt.containerInfo&&Le.stateNode.implementation===tt.implementation){x(We,Le.sibling),kt=C(Le,tt.children||[]),kt.return=We,We=kt;break e}else{x(We,Le);break}else d(We,Le);Le=Le.sibling}kt=ox(tt,We.mode,kt),kt.return=We,We=kt}return Y(We);case z:return tt=Ic(tt),Ki(We,Le,tt,kt)}if(re(tt))return Mr(We,Le,tt,kt);if(Q(tt)){if(rn=Q(tt),typeof rn!="function")throw Error(n(150));return tt=rn.call(tt),pn(We,Le,tt,kt)}if(typeof tt.then=="function")return Ki(We,Le,id(tt),kt);if(tt.$$typeof===U)return Ki(We,Le,dx(We,tt),kt);xh(We,tt)}return typeof tt=="string"&&tt!==""||typeof tt=="number"||typeof tt=="bigint"?(tt=""+tt,Le!==null&&Le.tag===6?(x(We,Le.sibling),kt=C(Le,tt),kt.return=We,We=kt):(x(We,Le),kt=ax(tt,We.mode,kt),kt.return=We,We=kt),Y(We)):x(We,Le)}return function(We,Le,tt,kt){try{nc=0;var rn=Ki(We,Le,tt,kt);return uu=null,rn}catch(qr){if(qr===cu||qr===gh)throw qr;var Ei=go(29,qr,null,We.mode);return Ei.lanes=kt,Ei.return=We,Ei}finally{}}}var du=Gm(!0),qm=Gm(!1),ic=!1;function sd(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hf(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function sc(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function ac(l,d,x){var N=l.updateQueue;if(N===null)return null;if(N=N.shared,(Oi&2)!==0){var C=N.pending;return C===null?d.next=d:(d.next=C.next,C.next=d),N.pending=d,d=ah(l),Tb(l,null,x),d}return jm(l,N,d,x),ah(l)}function ad(l,d,x){if(d=d.updateQueue,d!==null&&(d=d.shared,(x&4194048)!==0)){var N=d.lanes;N&=l.pendingLanes,x|=N,d.lanes=x,xt(l,x)}}function xx(l,d){var x=l.updateQueue,N=l.alternate;if(N!==null&&(N=N.updateQueue,x===N)){var C=null,R=null;if(x=x.firstBaseUpdate,x!==null){do{var Y={lane:x.lane,tag:x.tag,payload:x.payload,callback:null,next:null};R===null?C=R=Y:R=R.next=Y,x=x.next}while(x!==null);R===null?C=R=d:R=R.next=d}else C=R=d;x={baseState:N.baseState,firstBaseUpdate:C,lastBaseUpdate:R,shared:N.shared,callbacks:N.callbacks},l.updateQueue=x;return}l=x.lastBaseUpdate,l===null?x.firstBaseUpdate=d:l.next=d,x.lastBaseUpdate=d}var Wm=!1;function od(){if(Wm){var l=lu;if(l!==null)throw l}}function Gf(l,d,x,N){Wm=!1;var C=l.updateQueue;ic=!1;var R=C.firstBaseUpdate,Y=C.lastBaseUpdate,ce=C.shared.pending;if(ce!==null){C.shared.pending=null;var _e=ce,rt=_e.next;_e.next=null,Y===null?R=rt:Y.next=rt,Y=_e;var Nt=l.alternate;Nt!==null&&(Nt=Nt.updateQueue,ce=Nt.lastBaseUpdate,ce!==Y&&(ce===null?Nt.firstBaseUpdate=rt:ce.next=rt,Nt.lastBaseUpdate=_e))}if(R!==null){var Tt=C.baseState;Y=0,Nt=rt=_e=null,ce=R;do{var ot=ce.lane&-536870913,gt=ot!==ce.lane;if(gt?(ii&ot)===ot:(N&ot)===ot){ot!==0&&ot===rc&&(Wm=!0),Nt!==null&&(Nt=Nt.next={lane:0,tag:ce.tag,payload:ce.payload,callback:null,next:null});e:{var Mr=l,pn=ce;ot=d;var Ki=x;switch(pn.tag){case 1:if(Mr=pn.payload,typeof Mr=="function"){Tt=Mr.call(Ki,Tt,ot);break e}Tt=Mr;break e;case 3:Mr.flags=Mr.flags&-65537|128;case 0:if(Mr=pn.payload,ot=typeof Mr=="function"?Mr.call(Ki,Tt,ot):Mr,ot==null)break e;Tt=y({},Tt,ot);break e;case 2:ic=!0}}ot=ce.callback,ot!==null&&(l.flags|=64,gt&&(l.flags|=8192),gt=C.callbacks,gt===null?C.callbacks=[ot]:gt.push(ot))}else gt={lane:ot,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null},Nt===null?(rt=Nt=gt,_e=Tt):Nt=Nt.next=gt,Y|=ot;if(ce=ce.next,ce===null){if(ce=C.shared.pending,ce===null)break;gt=ce,ce=gt.next,gt.next=null,C.lastBaseUpdate=gt,C.shared.pending=null}}while(!0);Nt===null&&(_e=Tt),C.baseState=_e,C.firstBaseUpdate=rt,C.lastBaseUpdate=Nt,R===null&&(C.shared.lanes=0),kh|=Y,l.lanes=Y,l.memoizedState=Tt}}function Bb(l,d){if(typeof l!="function")throw Error(n(191,l));l.call(d)}function zb(l,d){var x=l.callbacks;if(x!==null)for(l.callbacks=null,l=0;lR?R:8;var Y=le.T,ce={};le.T=ce,GA(l,!1,d,x);try{var _e=C(),rt=le.S;if(rt!==null&&rt(ce,_e),_e!==null&&typeof _e=="object"&&typeof _e.then=="function"){var Nt=px(_e,N);Ex(l,d,Nt,Tl(l))}else Ex(l,d,N,Tl(l))}catch(Tt){Ex(l,d,{then:function(){},status:"rejected",reason:Tt},Tl())}finally{ve.p=R,Y!==null&&ce.types!==null&&(Y.types=ce.types),le.T=Y}}function Hee(){}function $A(l,d,x,N){if(l.tag!==5)throw Error(n(476));var C=MP(l).queue;DP(l,C,d,je,x===null?Hee:function(){return LP(l),x(N)})}function MP(l){var d=l.memoizedState;if(d!==null)return d;d={memoizedState:je,baseState:je,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dr,lastRenderedState:je},next:null};var x={};return d.next={memoizedState:x,baseState:x,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dr,lastRenderedState:x},next:null},l.memoizedState=d,l=l.alternate,l!==null&&(l.memoizedState=d),d}function LP(l){var d=MP(l);d.next===null&&(d=l.alternate.memoizedState),Ex(l,d.next.queue,{},Tl())}function HA(){return Ma(zx)}function UP(){return ut().memoizedState}function BP(){return ut().memoizedState}function Gee(l){for(var d=l.return;d!==null;){switch(d.tag){case 24:case 3:var x=Tl();l=sc(x);var N=ac(d,l,x);N!==null&&(ol(N,d,x),ad(N,d,x)),d={cache:ph()},l.payload=d;return}d=d.return}}function qee(l,d,x){var N=Tl();x={lane:N,revertLane:0,gesture:null,action:x,hasEagerState:!1,eagerState:null,next:null},Kb(l)?VP(d,x):(x=Im(l,d,x,N),x!==null&&(ol(x,l,N),FP(x,d,N)))}function zP(l,d,x){var N=Tl();Ex(l,d,x,N)}function Ex(l,d,x,N){var C={lane:N,revertLane:0,gesture:null,action:x,hasEagerState:!1,eagerState:null,next:null};if(Kb(l))VP(d,C);else{var R=l.alternate;if(l.lanes===0&&(R===null||R.lanes===0)&&(R=d.lastRenderedReducer,R!==null))try{var Y=d.lastRenderedState,ce=R(Y,x);if(C.hasEagerState=!0,C.eagerState=ce,E(ce,Y))return jm(l,d,C,0),Zi===null&&Cm(),!1}catch{}finally{}if(x=Im(l,d,C,N),x!==null)return ol(x,l,N),FP(x,d,N),!0}return!1}function GA(l,d,x,N){if(N={lane:2,revertLane:E5(),gesture:null,action:N,hasEagerState:!1,eagerState:null,next:null},Kb(l)){if(d)throw Error(n(479))}else d=Im(l,x,N,2),d!==null&&ol(d,l,2)}function Kb(l){var d=l.alternate;return l===Tn||d!==null&&d===Tn}function VP(l,d){vh=Xm=!0;var x=l.pending;x===null?d.next=d:(d.next=x.next,x.next=d),l.pending=d}function FP(l,d,x){if((x&4194048)!==0){var N=d.lanes;N&=l.pendingLanes,x|=N,d.lanes=x,xt(l,x)}}var Ax={readContext:Ma,use:un,useCallback:hs,useContext:hs,useEffect:hs,useImperativeHandle:hs,useLayoutEffect:hs,useInsertionEffect:hs,useMemo:hs,useReducer:hs,useRef:hs,useState:hs,useDebugValue:hs,useDeferredValue:hs,useTransition:hs,useSyncExternalStore:hs,useId:hs,useHostTransitionStatus:hs,useFormState:hs,useActionState:hs,useOptimistic:hs,useMemoCache:hs,useCacheRefresh:hs};Ax.useEffectEvent=hs;var $P={readContext:Ma,use:un,useCallback:function(l,d){return Ce().memoizedState=[l,d===void 0?null:d],l},useContext:Ma,useEffect:_P,useImperativeHandle:function(l,d,x){x=x!=null?x.concat([l]):null,qb(4194308,4,IP.bind(null,d,l),x)},useLayoutEffect:function(l,d){return qb(4194308,4,l,d)},useInsertionEffect:function(l,d){qb(4,2,l,d)},useMemo:function(l,d){var x=Ce();d=d===void 0?null:d;var N=l();if(hu){Pe(!0);try{l()}finally{Pe(!1)}}return x.memoizedState=[N,d],N},useReducer:function(l,d,x){var N=Ce();if(x!==void 0){var C=x(d);if(hu){Pe(!0);try{x(d)}finally{Pe(!1)}}}else C=d;return N.memoizedState=N.baseState=C,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:C},N.queue=l,l=l.dispatch=qee.bind(null,Tn,l),[N.memoizedState,l]},useRef:function(l){var d=Ce();return l={current:l},d.memoizedState=l},useState:function(l){l=Wf(l);var d=l.queue,x=zP.bind(null,Tn,d);return d.dispatch=x,[l.memoizedState,x]},useDebugValue:VA,useDeferredValue:function(l,d){var x=Ce();return FA(x,l,d)},useTransition:function(){var l=Wf(!1);return l=DP.bind(null,Tn,l.queue,!0,!1),Ce().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,d,x){var N=Tn,C=Ce();if(Qn){if(x===void 0)throw Error(n(407));x=x()}else{if(x=d(),Zi===null)throw Error(n(349));(ii&127)!==0||Kr(N,d,x)}C.memoizedState=x;var R={value:x,getSnapshot:d};return C.queue=R,_P(Ui.bind(null,N,R,l),[l]),N.flags|=2048,e0(9,{destroy:void 0},Fi.bind(null,N,R,x,d),null),x},useId:function(){var l=Ce(),d=Zi.identifierPrefix;if(Qn){var x=tc,N=ec;x=(N&~(1<<32-$e(N)-1)).toString(32)+x,d="_"+d+"R_"+x,x=wh++,0<\/script>",R=R.removeChild(R.firstChild);break;case"select":R=typeof N.is=="string"?Y.createElement("select",{is:N.is}):Y.createElement("select"),N.multiple?R.multiple=!0:N.size&&(R.size=N.size);break;default:R=typeof N.is=="string"?Y.createElement(C,{is:N.is}):Y.createElement(C)}}R[Ht]=d,R[kr]=N;e:for(Y=d.child;Y!==null;){if(Y.tag===5||Y.tag===6)R.appendChild(Y.stateNode);else if(Y.tag!==4&&Y.tag!==27&&Y.child!==null){Y.child.return=Y,Y=Y.child;continue}if(Y===d)break e;for(;Y.sibling===null;){if(Y.return===null||Y.return===d)break e;Y=Y.return}Y.sibling.return=Y.return,Y=Y.sibling}d.stateNode=R;e:switch(to(R,C,N),C){case"button":case"input":case"select":case"textarea":N=!!N.autoFocus;break e;case"img":N=!0;break e;default:N=!1}N&&ud(d)}}return fs(d),s5(d,d.type,l===null?null:l.memoizedProps,d.pendingProps,x),null;case 6:if(l&&d.stateNode!=null)l.memoizedProps!==N&&ud(d);else{if(typeof N!="string"&&d.stateNode===null)throw Error(n(166));if(l=Fe.current,Vf(d)){if(l=d.stateNode,x=d.memoizedProps,N=null,C=na,C!==null)switch(C.tag){case 27:case 5:N=C.memoizedProps}l[Ht]=d,l=!!(l.nodeValue===x||N!==null&&N.suppressHydrationWarning===!0||l6(l.nodeValue,x)),l||su(d,!0)}else l=pv(l).createTextNode(N),l[Ht]=d,d.stateNode=l}return fs(d),null;case 31:if(x=d.memoizedState,l===null||l.memoizedState!==null){if(N=Vf(d),x!==null){if(l===null){if(!N)throw Error(n(318));if(l=d.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(n(557));l[Ht]=d}else uh(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;fs(d),l=!1}else x=Db(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=x),l=!0;if(!l)return d.flags&256?(ia(d),d):(ia(d),null);if((d.flags&128)!==0)throw Error(n(558))}return fs(d),null;case 13:if(N=d.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(C=Vf(d),N!==null&&N.dehydrated!==null){if(l===null){if(!C)throw Error(n(318));if(C=d.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(n(317));C[Ht]=d}else uh(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;fs(d),C=!1}else C=Db(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=C),C=!0;if(!C)return d.flags&256?(ia(d),d):(ia(d),null)}return ia(d),(d.flags&128)!==0?(d.lanes=x,d):(x=N!==null,l=l!==null&&l.memoizedState!==null,x&&(N=d.child,C=null,N.alternate!==null&&N.alternate.memoizedState!==null&&N.alternate.memoizedState.cachePool!==null&&(C=N.alternate.memoizedState.cachePool.pool),R=null,N.memoizedState!==null&&N.memoizedState.cachePool!==null&&(R=N.memoizedState.cachePool.pool),R!==C&&(N.flags|=2048)),x!==l&&x&&(d.child.flags|=8192),Jb(d,d.updateQueue),fs(d),null);case 4:return Ae(),l===null&&S5(d.stateNode.containerInfo),fs(d),null;case 10:return ou(d.type),fs(d),null;case 19:if(xe(Is),N=d.memoizedState,N===null)return fs(d),null;if(C=(d.flags&128)!==0,R=N.rendering,R===null)if(C)_x(N,!1);else{if(Bs!==0||l!==null&&(l.flags&128)!==0)for(l=d.child;l!==null;){if(R=Ym(l),R!==null){for(d.flags|=128,_x(N,!1),l=R.updateQueue,d.updateQueue=l,Jb(d,l),d.subtreeFlags=0,l=x,x=d.child;x!==null;)Pb(x,l),x=x.sibling;return ae(Is,Is.current&1|2),Qn&&xi(d,N.treeForkCount),d.child}l=l.sibling}N.tail!==null&&dr()>iv&&(d.flags|=128,C=!0,_x(N,!1),d.lanes=4194304)}else{if(!C)if(l=Ym(R),l!==null){if(d.flags|=128,C=!0,l=l.updateQueue,d.updateQueue=l,Jb(d,l),_x(N,!0),N.tail===null&&N.tailMode==="hidden"&&!R.alternate&&!Qn)return fs(d),null}else 2*dr()-N.renderingStartTime>iv&&x!==536870912&&(d.flags|=128,C=!0,_x(N,!1),d.lanes=4194304);N.isBackwards?(R.sibling=d.child,d.child=R):(l=N.last,l!==null?l.sibling=R:d.child=R,N.last=R)}return N.tail!==null?(l=N.tail,N.rendering=l,N.tail=l.sibling,N.renderingStartTime=dr(),l.sibling=null,x=Is.current,ae(Is,C?x&1|2:x&1),Qn&&xi(d,N.treeForkCount),l):(fs(d),null);case 22:case 23:return ia(d),bx(),N=d.memoizedState!==null,l!==null?l.memoizedState!==null!==N&&(d.flags|=8192):N&&(d.flags|=8192),N?(x&536870912)!==0&&(d.flags&128)===0&&(fs(d),d.subtreeFlags&6&&(d.flags|=8192)):fs(d),x=d.updateQueue,x!==null&&Jb(d,x.retryQueue),x=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(x=l.memoizedState.cachePool.pool),N=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(N=d.memoizedState.cachePool.pool),N!==x&&(d.flags|=2048),l!==null&&xe(jc),null;case 24:return x=null,l!==null&&(x=l.memoizedState.cache),d.memoizedState.cache!==x&&(d.flags|=2048),ou(ws),fs(d),null;case 25:return null;case 30:return null}throw Error(n(156,d.tag))}function Qee(l,d){switch(lx(d),d.tag){case 1:return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return ou(ws),Ae(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 26:case 27:case 5:return vt(d),null;case 31:if(d.memoizedState!==null){if(ia(d),d.alternate===null)throw Error(n(340));uh()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 13:if(ia(d),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));uh()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return xe(Is),null;case 4:return Ae(),null;case 10:return ou(d.type),null;case 22:case 23:return ia(d),bx(),l!==null&&xe(jc),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 24:return ou(ws),null;case 25:return null;default:return null}}function fO(l,d){switch(lx(d),d.tag){case 3:ou(ws),Ae();break;case 26:case 27:case 5:vt(d);break;case 4:Ae();break;case 31:d.memoizedState!==null&&ia(d);break;case 13:ia(d);break;case 19:xe(Is);break;case 10:ou(d.type);break;case 22:case 23:ia(d),bx(),l!==null&&xe(jc);break;case 24:ou(ws)}}function Sx(l,d){try{var x=d.updateQueue,N=x!==null?x.lastEffect:null;if(N!==null){var C=N.next;x=C;do{if((x.tag&l)===l){N=void 0;var R=x.create,Y=x.inst;N=R(),Y.destroy=N}x=x.next}while(x!==C)}}catch(ce){Hi(d,d.return,ce)}}function Eh(l,d,x){try{var N=d.updateQueue,C=N!==null?N.lastEffect:null;if(C!==null){var R=C.next;N=R;do{if((N.tag&l)===l){var Y=N.inst,ce=Y.destroy;if(ce!==void 0){Y.destroy=void 0,C=d;var _e=x,rt=ce;try{rt()}catch(Nt){Hi(C,_e,Nt)}}}N=N.next}while(N!==R)}}catch(Nt){Hi(d,d.return,Nt)}}function pO(l){var d=l.updateQueue;if(d!==null){var x=l.stateNode;try{zb(d,x)}catch(N){Hi(l,l.return,N)}}}function mO(l,d,x){x.props=Kf(l.type,l.memoizedProps),x.state=l.memoizedState;try{x.componentWillUnmount()}catch(N){Hi(l,d,N)}}function Cx(l,d){try{var x=l.ref;if(x!==null){switch(l.tag){case 26:case 27:case 5:var N=l.stateNode;break;case 30:N=l.stateNode;break;default:N=l.stateNode}typeof x=="function"?l.refCleanup=x(N):x.current=N}}catch(C){Hi(l,d,C)}}function fu(l,d){var x=l.ref,N=l.refCleanup;if(x!==null)if(typeof N=="function")try{N()}catch(C){Hi(l,d,C)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof x=="function")try{x(null)}catch(C){Hi(l,d,C)}else x.current=null}function gO(l){var d=l.type,x=l.memoizedProps,N=l.stateNode;try{e:switch(d){case"button":case"input":case"select":case"textarea":x.autoFocus&&N.focus();break e;case"img":x.src?N.src=x.src:x.srcSet&&(N.srcset=x.srcSet)}}catch(C){Hi(l,l.return,C)}}function a5(l,d,x){try{var N=l.stateNode;bte(N,l.type,x,d),N[kr]=d}catch(C){Hi(l,l.return,C)}}function xO(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&Ih(l.type)||l.tag===4}function o5(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||xO(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&Ih(l.type)||l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function l5(l,d,x){var N=l.tag;if(N===5||N===6)l=l.stateNode,d?(x.nodeType===9?x.body:x.nodeName==="HTML"?x.ownerDocument.body:x).insertBefore(l,d):(d=x.nodeType===9?x.body:x.nodeName==="HTML"?x.ownerDocument.body:x,d.appendChild(l),x=x._reactRootContainer,x!=null||d.onclick!==null||(d.onclick=bs));else if(N!==4&&(N===27&&Ih(l.type)&&(x=l.stateNode,d=null),l=l.child,l!==null))for(l5(l,d,x),l=l.sibling;l!==null;)l5(l,d,x),l=l.sibling}function ev(l,d,x){var N=l.tag;if(N===5||N===6)l=l.stateNode,d?x.insertBefore(l,d):x.appendChild(l);else if(N!==4&&(N===27&&Ih(l.type)&&(x=l.stateNode),l=l.child,l!==null))for(ev(l,d,x),l=l.sibling;l!==null;)ev(l,d,x),l=l.sibling}function yO(l){var d=l.stateNode,x=l.memoizedProps;try{for(var N=l.type,C=d.attributes;C.length;)d.removeAttributeNode(C[0]);to(d,N,x),d[Ht]=l,d[kr]=x}catch(R){Hi(l,l.return,R)}}var dd=!1,aa=!1,c5=!1,bO=typeof WeakSet=="function"?WeakSet:Set,La=null;function Zee(l,d){if(l=l.containerInfo,I5=wv,l=ee(l),oe(l)){if("selectionStart"in l)var x={start:l.selectionStart,end:l.selectionEnd};else e:{x=(x=l.ownerDocument)&&x.defaultView||window;var N=x.getSelection&&x.getSelection();if(N&&N.rangeCount!==0){x=N.anchorNode;var C=N.anchorOffset,R=N.focusNode;N=N.focusOffset;try{x.nodeType,R.nodeType}catch{x=null;break e}var Y=0,ce=-1,_e=-1,rt=0,Nt=0,Tt=l,ot=null;t:for(;;){for(var gt;Tt!==x||C!==0&&Tt.nodeType!==3||(ce=Y+C),Tt!==R||N!==0&&Tt.nodeType!==3||(_e=Y+N),Tt.nodeType===3&&(Y+=Tt.nodeValue.length),(gt=Tt.firstChild)!==null;)ot=Tt,Tt=gt;for(;;){if(Tt===l)break t;if(ot===x&&++rt===C&&(ce=Y),ot===R&&++Nt===N&&(_e=Y),(gt=Tt.nextSibling)!==null)break;Tt=ot,ot=Tt.parentNode}Tt=gt}x=ce===-1||_e===-1?null:{start:ce,end:_e}}else x=null}x=x||{start:0,end:0}}else x=null;for(T5={focusedElem:l,selectionRange:x},wv=!1,La=d;La!==null;)if(d=La,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,La=l;else for(;La!==null;){switch(d=La,R=d.alternate,l=d.flags,d.tag){case 0:if((l&4)!==0&&(l=d.updateQueue,l=l!==null?l.events:null,l!==null))for(x=0;x title"))),to(R,N,x),R[Ht]=l,ci(R),N=R;break e;case"link":var Y=k6("link","href",C).get(N+(x.href||""));if(Y){for(var ce=0;ceKi&&(Y=Ki,Ki=pn,pn=Y);var We=M(ce,pn),Le=M(ce,Ki);if(We&&Le&&(gt.rangeCount!==1||gt.anchorNode!==We.node||gt.anchorOffset!==We.offset||gt.focusNode!==Le.node||gt.focusOffset!==Le.offset)){var tt=Tt.createRange();tt.setStart(We.node,We.offset),gt.removeAllRanges(),pn>Ki?(gt.addRange(tt),gt.extend(Le.node,Le.offset)):(tt.setEnd(Le.node,Le.offset),gt.addRange(tt))}}}}for(Tt=[],gt=ce;gt=gt.parentNode;)gt.nodeType===1&&Tt.push({element:gt,left:gt.scrollLeft,top:gt.scrollTop});for(typeof ce.focus=="function"&&ce.focus(),ce=0;cex?32:x,le.T=null,x=g5,g5=null;var R=Sh,Y=gd;if(xa=0,s0=Sh=null,gd=0,(Oi&6)!==0)throw Error(n(331));var ce=Oi;if(Oi|=4,IO(R.current),SO(R,R.current,Y,x),Oi=ce,Rx(0,!1),be&&typeof be.onPostCommitFiberRoot=="function")try{be.onPostCommitFiberRoot(Gr,R)}catch{}return!0}finally{ve.p=C,le.T=N,KO(l,d)}}function XO(l,d,x){d=Qo(x,d),d=YA(l.stateNode,d,2),l=ac(l,d,2),l!==null&&(Fr(l,2),pu(l))}function Hi(l,d,x){if(l.tag===3)XO(l,l,x);else for(;d!==null;){if(d.tag===3){XO(d,l,x);break}else if(d.tag===1){var N=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof N.componentDidCatch=="function"&&(_h===null||!_h.has(N))){l=Qo(x,l),x=QP(2),N=ac(d,x,2),N!==null&&(ZP(x,N,d,l),Fr(N,2),pu(N));break}}d=d.return}}function v5(l,d,x){var N=l.pingCache;if(N===null){N=l.pingCache=new tte;var C=new Set;N.set(d,C)}else C=N.get(d),C===void 0&&(C=new Set,N.set(d,C));C.has(x)||(h5=!0,C.add(x),l=ate.bind(null,l,d,x),d.then(l,l))}function ate(l,d,x){var N=l.pingCache;N!==null&&N.delete(d),l.pingedLanes|=l.suspendedLanes&x,l.warmLanes&=~x,Zi===l&&(ii&x)===x&&(Bs===4||Bs===3&&(ii&62914560)===ii&&300>dr()-nv?(Oi&2)===0&&a0(l,0):f5|=x,i0===ii&&(i0=0)),pu(l)}function QO(l,d){d===0&&(d=Ze()),l=td(l,d),l!==null&&(Fr(l,d),pu(l))}function ote(l){var d=l.memoizedState,x=0;d!==null&&(x=d.retryLane),QO(l,x)}function lte(l,d){var x=0;switch(l.tag){case 31:case 13:var N=l.stateNode,C=l.memoizedState;C!==null&&(x=C.retryLane);break;case 19:N=l.stateNode;break;case 22:N=l.stateNode._retryCache;break;default:throw Error(n(314))}N!==null&&N.delete(d),QO(l,x)}function cte(l,d){return Xt(l,d)}var uv=null,l0=null,w5=!1,dv=!1,N5=!1,jh=0;function pu(l){l!==l0&&l.next===null&&(l0===null?uv=l0=l:l0=l0.next=l),dv=!0,w5||(w5=!0,dte())}function Rx(l,d){if(!N5&&dv){N5=!0;do for(var x=!1,N=uv;N!==null;){if(l!==0){var C=N.pendingLanes;if(C===0)var R=0;else{var Y=N.suspendedLanes,ce=N.pingedLanes;R=(1<<31-$e(42|l)+1)-1,R&=C&~(Y&~ce),R=R&201326741?R&201326741|1:R?R|2:0}R!==0&&(x=!0,t6(N,R))}else R=ii,R=ln(N,N===Zi?R:0,N.cancelPendingCommit!==null||N.timeoutHandle!==-1),(R&3)===0||de(N,R)||(x=!0,t6(N,R));N=N.next}while(x);N5=!1}}function ute(){ZO()}function ZO(){dv=w5=!1;var l=0;jh!==0&&wte()&&(l=jh);for(var d=dr(),x=null,N=uv;N!==null;){var C=N.next,R=JO(N,d);R===0?(N.next=null,x===null?uv=C:x.next=C,C===null&&(l0=x)):(x=N,(l!==0||(R&3)!==0)&&(dv=!0)),N=C}xa!==0&&xa!==5||Rx(l),jh!==0&&(jh=0)}function JO(l,d){for(var x=l.suspendedLanes,N=l.pingedLanes,C=l.expirationTimes,R=l.pendingLanes&-62914561;0ce)break;var Nt=_e.transferSize,Tt=_e.initiatorType;Nt&&c6(Tt)&&(_e=_e.responseEnd,Y+=Nt*(_e"u"?null:document;function w6(l,d,x){var N=c0;if(N&&typeof d=="string"&&d){var C=_r(d);C='link[rel="'+l+'"][href="'+C+'"]',typeof x=="string"&&(C+='[crossorigin="'+x+'"]'),v6.has(C)||(v6.add(C),l={rel:l,crossOrigin:x,href:d},N.querySelector(C)===null&&(d=N.createElement("link"),to(d,"link",l),ci(d),N.head.appendChild(d)))}}function Ite(l){xd.D(l),w6("dns-prefetch",l,null)}function Tte(l,d){xd.C(l,d),w6("preconnect",l,d)}function Pte(l,d,x){xd.L(l,d,x);var N=c0;if(N&&l&&d){var C='link[rel="preload"][as="'+_r(d)+'"]';d==="image"&&x&&x.imageSrcSet?(C+='[imagesrcset="'+_r(x.imageSrcSet)+'"]',typeof x.imageSizes=="string"&&(C+='[imagesizes="'+_r(x.imageSizes)+'"]')):C+='[href="'+_r(l)+'"]';var R=C;switch(d){case"style":R=u0(l);break;case"script":R=d0(l)}lc.has(R)||(l=y({rel:"preload",href:d==="image"&&x&&x.imageSrcSet?void 0:l,as:d},x),lc.set(R,l),N.querySelector(C)!==null||d==="style"&&N.querySelector(Ux(R))||d==="script"&&N.querySelector(Bx(R))||(d=N.createElement("link"),to(d,"link",l),ci(d),N.head.appendChild(d)))}}function Ote(l,d){xd.m(l,d);var x=c0;if(x&&l){var N=d&&typeof d.as=="string"?d.as:"script",C='link[rel="modulepreload"][as="'+_r(N)+'"][href="'+_r(l)+'"]',R=C;switch(N){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":R=d0(l)}if(!lc.has(R)&&(l=y({rel:"modulepreload",href:l},d),lc.set(R,l),x.querySelector(C)===null)){switch(N){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(x.querySelector(Bx(R)))return}N=x.createElement("link"),to(N,"link",l),ci(N),x.head.appendChild(N)}}}function Rte(l,d,x){xd.S(l,d,x);var N=c0;if(N&&l){var C=bi(N).hoistableStyles,R=u0(l);d=d||"default";var Y=C.get(R);if(!Y){var ce={loading:0,preload:null};if(Y=N.querySelector(Ux(R)))ce.loading=5;else{l=y({rel:"stylesheet",href:l,"data-precedence":d},x),(x=lc.get(R))&&U5(l,x);var _e=Y=N.createElement("link");ci(_e),to(_e,"link",l),_e._p=new Promise(function(rt,Nt){_e.onload=rt,_e.onerror=Nt}),_e.addEventListener("load",function(){ce.loading|=1}),_e.addEventListener("error",function(){ce.loading|=2}),ce.loading|=4,gv(Y,d,N)}Y={type:"stylesheet",instance:Y,count:1,state:ce},C.set(R,Y)}}}function Dte(l,d){xd.X(l,d);var x=c0;if(x&&l){var N=bi(x).hoistableScripts,C=d0(l),R=N.get(C);R||(R=x.querySelector(Bx(C)),R||(l=y({src:l,async:!0},d),(d=lc.get(C))&&B5(l,d),R=x.createElement("script"),ci(R),to(R,"link",l),x.head.appendChild(R)),R={type:"script",instance:R,count:1,state:null},N.set(C,R))}}function Mte(l,d){xd.M(l,d);var x=c0;if(x&&l){var N=bi(x).hoistableScripts,C=d0(l),R=N.get(C);R||(R=x.querySelector(Bx(C)),R||(l=y({src:l,async:!0,type:"module"},d),(d=lc.get(C))&&B5(l,d),R=x.createElement("script"),ci(R),to(R,"link",l),x.head.appendChild(R)),R={type:"script",instance:R,count:1,state:null},N.set(C,R))}}function N6(l,d,x,N){var C=(C=Fe.current)?mv(C):null;if(!C)throw Error(n(446));switch(l){case"meta":case"title":return null;case"style":return typeof x.precedence=="string"&&typeof x.href=="string"?(d=u0(x.href),x=bi(C).hoistableStyles,N=x.get(d),N||(N={type:"style",instance:null,count:0,state:null},x.set(d,N)),N):{type:"void",instance:null,count:0,state:null};case"link":if(x.rel==="stylesheet"&&typeof x.href=="string"&&typeof x.precedence=="string"){l=u0(x.href);var R=bi(C).hoistableStyles,Y=R.get(l);if(Y||(C=C.ownerDocument||C,Y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},R.set(l,Y),(R=C.querySelector(Ux(l)))&&!R._p&&(Y.instance=R,Y.state.loading=5),lc.has(l)||(x={rel:"preload",as:"style",href:x.href,crossOrigin:x.crossOrigin,integrity:x.integrity,media:x.media,hrefLang:x.hrefLang,referrerPolicy:x.referrerPolicy},lc.set(l,x),R||Lte(C,l,x,Y.state))),d&&N===null)throw Error(n(528,""));return Y}if(d&&N!==null)throw Error(n(529,""));return null;case"script":return d=x.async,x=x.src,typeof x=="string"&&d&&typeof d!="function"&&typeof d!="symbol"?(d=d0(x),x=bi(C).hoistableScripts,N=x.get(d),N||(N={type:"script",instance:null,count:0,state:null},x.set(d,N)),N):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,l))}}function u0(l){return'href="'+_r(l)+'"'}function Ux(l){return'link[rel="stylesheet"]['+l+"]"}function E6(l){return y({},l,{"data-precedence":l.precedence,precedence:null})}function Lte(l,d,x,N){l.querySelector('link[rel="preload"][as="style"]['+d+"]")?N.loading=1:(d=l.createElement("link"),N.preload=d,d.addEventListener("load",function(){return N.loading|=1}),d.addEventListener("error",function(){return N.loading|=2}),to(d,"link",x),ci(d),l.head.appendChild(d))}function d0(l){return'[src="'+_r(l)+'"]'}function Bx(l){return"script[async]"+l}function A6(l,d,x){if(d.count++,d.instance===null)switch(d.type){case"style":var N=l.querySelector('style[data-href~="'+_r(x.href)+'"]');if(N)return d.instance=N,ci(N),N;var C=y({},x,{"data-href":x.href,"data-precedence":x.precedence,href:null,precedence:null});return N=(l.ownerDocument||l).createElement("style"),ci(N),to(N,"style",C),gv(N,x.precedence,l),d.instance=N;case"stylesheet":C=u0(x.href);var R=l.querySelector(Ux(C));if(R)return d.state.loading|=4,d.instance=R,ci(R),R;N=E6(x),(C=lc.get(C))&&U5(N,C),R=(l.ownerDocument||l).createElement("link"),ci(R);var Y=R;return Y._p=new Promise(function(ce,_e){Y.onload=ce,Y.onerror=_e}),to(R,"link",N),d.state.loading|=4,gv(R,x.precedence,l),d.instance=R;case"script":return R=d0(x.src),(C=l.querySelector(Bx(R)))?(d.instance=C,ci(C),C):(N=x,(C=lc.get(R))&&(N=y({},x),B5(N,C)),l=l.ownerDocument||l,C=l.createElement("script"),ci(C),to(C,"link",N),l.head.appendChild(C),d.instance=C);case"void":return null;default:throw Error(n(443,d.type))}else d.type==="stylesheet"&&(d.state.loading&4)===0&&(N=d.instance,d.state.loading|=4,gv(N,x.precedence,l));return d.instance}function gv(l,d,x){for(var N=x.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),C=N.length?N[N.length-1]:null,R=C,Y=0;Y title"):null)}function Ute(l,d,x){if(x===1||d.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof d.precedence!="string"||typeof d.href!="string"||d.href==="")break;return!0;case"link":if(typeof d.rel!="string"||typeof d.href!="string"||d.href===""||d.onLoad||d.onError)break;switch(d.rel){case"stylesheet":return l=d.disabled,typeof d.precedence=="string"&&l==null;default:return!0}case"script":if(d.async&&typeof d.async!="function"&&typeof d.async!="symbol"&&!d.onLoad&&!d.onError&&d.src&&typeof d.src=="string")return!0}return!1}function S6(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function Bte(l,d,x,N){if(x.type==="stylesheet"&&(typeof N.media!="string"||matchMedia(N.media).matches!==!1)&&(x.state.loading&4)===0){if(x.instance===null){var C=u0(N.href),R=d.querySelector(Ux(C));if(R){d=R._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(l.count++,l=yv.bind(l),d.then(l,l)),x.state.loading|=4,x.instance=R,ci(R);return}R=d.ownerDocument||d,N=E6(N),(C=lc.get(C))&&U5(N,C),R=R.createElement("link"),ci(R);var Y=R;Y._p=new Promise(function(ce,_e){Y.onload=ce,Y.onerror=_e}),to(R,"link",N),x.instance=R}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(x,d),(d=x.state.preload)&&(x.state.loading&3)===0&&(l.count++,x=yv.bind(l),d.addEventListener("load",x),d.addEventListener("error",x))}}var z5=0;function zte(l,d){return l.stylesheets&&l.count===0&&vv(l,l.stylesheets),0z5?50:800)+d);return l.unsuspend=x,function(){l.unsuspend=null,clearTimeout(N),clearTimeout(C)}}:null}function yv(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vv(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var bv=null;function vv(l,d){l.stylesheets=null,l.unsuspend!==null&&(l.count++,bv=new Map,d.forEach(Vte,l),bv=null,yv.call(l))}function Vte(l,d){if(!(d.state.loading&4)){var x=bv.get(l);if(x)var N=x.get(null);else{x=new Map,bv.set(l,x);for(var C=l.querySelectorAll("link[data-precedence],style[data-precedence]"),R=0;R"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Y5.exports=are(),Y5.exports}var lre=ore(),ZV=(e=>(e.BASE="base",e.BODY="body",e.HEAD="head",e.HTML="html",e.LINK="link",e.META="meta",e.NOSCRIPT="noscript",e.SCRIPT="script",e.STYLE="style",e.TITLE="title",e.FRAGMENT="Symbol(react.fragment)",e))(ZV||{}),J5={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}};Object.values(ZV);var yI={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"};Object.entries(yI).reduce((e,[t,r])=>(e[r]=t,e),{});var ny="data-rh",cre=e=>Array.isArray(e)?e.join(""):e,ure=(e,t)=>{const r=Object.keys(e);for(let n=0;nArray.isArray(e)?e.reduce((r,n)=>(ure(n,t)?r.priority.push(n):r.default.push(n),r),{priority:[],default:[]}):{default:e,priority:[]},dre=["noscript","script","style"],US=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),JV=e=>Object.keys(e).reduce((t,r)=>{const n=typeof e[r]<"u"?`${r}="${e[r]}"`:`${r}`;return t?`${t} ${n}`:n},""),hre=(e,t,r,n)=>{const i=JV(r),a=cre(t);return i?`<${e} ${ny}="true" ${i}>${US(a,n)}`:`<${e} ${ny}="true">${US(a,n)}`},fre=(e,t,r=!0)=>t.reduce((n,i)=>{const a=i,o=Object.keys(a).filter(f=>!(f==="innerHTML"||f==="cssText")).reduce((f,m)=>{const y=typeof a[m]>"u"?m:`${m}="${US(a[m],r)}"`;return f?`${f} ${y}`:y},""),c=a.innerHTML||a.cssText||"",h=dre.indexOf(e)===-1;return`${n}<${e} ${ny}="true" ${o}${h?"/>":`>${c}`}`},""),eF=(e,t={})=>Object.keys(e).reduce((r,n)=>{const i=yI[n];return r[i||n]=e[n],r},t),pre=(e,t,r)=>{const n={key:t,[ny]:!0},i=eF(r,n);return[ie.createElement("title",i,t)]},bw=(e,t)=>t.map((r,n)=>{const i={key:n,[ny]:!0};return Object.keys(r).forEach(a=>{const c=yI[a]||a;if(c==="innerHTML"||c==="cssText"){const h=r.innerHTML||r.cssText;i.dangerouslySetInnerHTML={__html:h}}else i[c]=r[a]}),ie.createElement(e,i)}),fc=(e,t,r=!0)=>{switch(e){case"title":return{toComponent:()=>pre(e,t.title,t.titleAttributes),toString:()=>hre(e,t.title,t.titleAttributes,r)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>eF(t),toString:()=>JV(t)};default:return{toComponent:()=>bw(e,t),toString:()=>fre(e,t,r)}}},mre=({metaTags:e,linkTags:t,scriptTags:r,encode:n})=>{const i=ek(e,J5.meta),a=ek(t,J5.link),o=ek(r,J5.script);return{priorityMethods:{toComponent:()=>[...bw("meta",i.priority),...bw("link",a.priority),...bw("script",o.priority)],toString:()=>`${fc("meta",i.priority,n)} ${fc("link",a.priority,n)} ${fc("script",o.priority,n)}`},metaTags:i.default,linkTags:a.default,scriptTags:o.default}},gre=e=>{const{baseTag:t,bodyAttributes:r,encode:n=!0,htmlAttributes:i,noscriptTags:a,styleTags:o,title:c="",titleAttributes:h,prioritizeSeoTags:f}=e;let{linkTags:m,metaTags:y,scriptTags:w}=e,A={toComponent:()=>[],toString:()=>""};return f&&({priorityMethods:A,linkTags:m,metaTags:y,scriptTags:w}=mre(e)),{priority:A,base:fc("base",t,n),bodyAttributes:fc("bodyAttributes",r,n),htmlAttributes:fc("htmlAttributes",i,n),link:fc("link",m,n),meta:fc("meta",y,n),noscript:fc("noscript",a,n),script:fc("script",w,n),style:fc("style",o,n),title:fc("title",{title:c,titleAttributes:h},n)}},xre=gre,jv=[],tF=!!(typeof window<"u"&&window.document&&window.document.createElement),yre=class{constructor(e,t){yd(this,"instances",[]);yd(this,"canUseDOM",tF);yd(this,"context");yd(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?jv:this.instances,add:e=>{(this.canUseDOM?jv:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?jv:this.instances).indexOf(e);(this.canUseDOM?jv:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=xre({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},bre=parseInt(ie.version.split(".")[0],10),Q6=bre>=19,vre={},wre=ie.createContext(vre),jp,rF=(jp=class extends I.Component{constructor(r){super(r);yd(this,"helmetData");Q6?this.helmetData=null:this.helmetData=new yre(this.props.context||{},jp.canUseDOM)}render(){return Q6?ie.createElement(ie.Fragment,null,this.props.children):ie.createElement(wre.Provider,{value:this.helmetData.value},this.props.children)}},yd(jp,"canUseDOM",tF),jp),JN=QV();/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nre=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ere=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),Z6=e=>{const t=Ere(e);return t.charAt(0).toUpperCase()+t.slice(1)},nF=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Are=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var kre={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"};/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _re=I.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:a,iconNode:o,...c},h)=>I.createElement("svg",{ref:h,...kre,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:nF("lucide",i),...!a&&!Are(c)&&{"aria-hidden":"true"},...c},[...o.map(([f,m])=>I.createElement(f,m)),...Array.isArray(a)?a:[a]]));/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ut=(e,t)=>{const r=I.forwardRef(({className:n,...i},a)=>I.createElement(_re,{ref:a,iconNode:t,className:nF(`lucide-${Nre(Z6(e))}`,`lucide-${e}`,n),...i}));return r.displayName=Z6(e),r};/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sre=[["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-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Cre=Ut("activity",Sre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jre=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Ire=Ut("arrow-left",jre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tre=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ip=Ut("arrow-right",Tre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pre=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],iF=Ut("at-sign",Pre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ore=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Ru=Ut("bell",Ore);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rre=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Dre=Ut("bookmark",Rre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mre=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Lre=Ut("bot",Mre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ure=[["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3",key:"cabbwy"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]],Bre=Ut("building",Ure);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zre=[["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"}]],$p=Ut("calendar",zre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vre=[["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"}]],BS=Ut("camera",Vre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fre=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],yp=Ut("chart-column",Fre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $re=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],Hre=Ut("check-check",$re);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gre=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],zu=Ut("check",Gre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qre=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Md=Ut("chevron-down",qre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wre=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Hp=Ut("chevron-left",Wre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kre=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Gp=Ut("chevron-right",Kre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yre=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],gf=Ut("chevron-up",Yre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xre=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Qre=Ut("chevrons-left",Xre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zre=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Jre=Ut("chevrons-right",Zre);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ene=[["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"}]],sF=Ut("circle-alert",ene);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tne=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Rl=Ut("circle-check",tne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rne=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aF=Ut("circle-question-mark",rne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nne=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],vw=Ut("clock",nne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ine=[["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"}]],t2=Ut("copy",ine);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sne=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],J6=Ut("corner-down-left",sne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ane=[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]],one=Ut("corner-up-left",ane);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lne=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],cne=Ut("cpu",lne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const une=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],qx=Ut("database",une);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dne=[["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"}]],eE=Ut("download",dne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hne=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],fne=Ut("ellipsis",hne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pne=[["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"}]],za=Ut("external-link",pne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mne=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],eR=Ut("eye-off",mne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gne=[["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"}]],R1=Ut("eye",gne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xne=[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]],oF=Ut("facebook",xne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yne=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],M0=Ut("file-text",yne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bne=[["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"}]],vne=Ut("film",bne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wne=[["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",key:"1slcih"}]],Nne=Ut("flame",wne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ene=[["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"}]],C0=Ut("globe",Ene);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ane=[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]],kne=Ut("grip-horizontal",Ane);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _ne=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],Sne=Ut("hard-drive",_ne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cne=[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]],nf=Ut("headphones",Cne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jne=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Fl=Ut("heart",jne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ine=[["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"}]],tR=Ut("house",Ine);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tne=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],yu=Ut("image",Tne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pne=[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]],lF=Ut("instagram",Pne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const One=[["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"}]],Rne=Ut("key",One);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dne=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],wd=Ut("link",Dne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mne=[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]],cF=Ut("linkedin",Mne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lne=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],vn=Ut("loader-circle",Lne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Une=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],uF=Ut("lock",Une);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bne=[["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"}]],Xs=Ut("mail",Bne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zne=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],r2=Ut("map-pin",zne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vne=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],n2=Ut("maximize-2",Vne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fne=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],wu=Ut("megaphone",Fne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $ne=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],tE=Ut("menu",$ne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hne=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],qp=Ut("message-circle",Hne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gne=[["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"}]],Ri=Ut("message-square",Gne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qne=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]],Wne=Ut("mic-off",qne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kne=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],Yne=Ut("mic",Kne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xne=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],bI=Ut("minimize-2",Xne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qne=[["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0v-9a2 2 0 0 1 2-2h2",key:"39pd36"}],["rect",{width:"8",height:"4",x:"10",y:"6",rx:"1",key:"aywv1n"}]],Wh=Ut("newspaper",Qne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zne=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Jne=Ut("paperclip",Zne);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eie=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],rR=Ut("pause",eie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tie=[["path",{d:"M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272",key:"1wngk7"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}],["path",{d:"M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473",key:"10hv5p"}]],dF=Ut("phone-off",tie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rie=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],zS=Ut("phone",rie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nie=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],j0=Ut("pin",nie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iie=[["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"}]],Wp=Ut("play",iie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sie=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Uc=Ut("plus",sie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aie=[["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"}]],oie=Ut("qr-code",aie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lie=[["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"}]],mc=Ut("radio",lie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cie=[["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"}]],hF=Ut("refresh-cw",cie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uie=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],nR=Ut("reply",uie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const die=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],fF=Ut("rotate-cw",die);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hie=[["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"}]],iR=Ut("save",hie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fie=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Tp=Ut("search",fie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pie=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Eo=Ut("send",pie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mie=[["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"}]],VS=Ut("settings",mie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gie=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Ld=Ut("share-2",gie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xie=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],yie=Ut("shield-alert",xie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bie=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ul=Ut("shield-check",bie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vie=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],vI=Ut("shield",vie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wie=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],Nie=Ut("shopping-bag",wie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eie=[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]],Aie=Ut("skip-back",Eie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kie=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],_ie=Ut("skip-forward",kie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sie=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Cie=Ut("smartphone",Sie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jie=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],pF=Ut("smile",jie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iie=[["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"}]],Xi=Ut("sparkles",Iie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tie=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ed=Ut("square-pen",Tie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pie=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],Oie=Ut("thumbs-up",Pie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rie=[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]],Ea=Ut("ticket",Rie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Die=[["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"}]],Es=Ut("trash-2",Die);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mie=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Eu=Ut("trending-up",Mie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lie=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Su=Ut("triangle-alert",Lie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uie=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],mF=Ut("upload",Uie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bie=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["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"}]],iy=Ut("user-check",Bie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zie=[["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"}]],bp=Ut("user-plus",zie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vie=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],rE=Ut("user",Vie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fie=[["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"}]],ko=Ut("users",Fie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $ie=[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Hie=Ut("video-off",$ie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gie=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],Na=Ut("video",Gie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qie=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Wie=Ut("volume-2",qie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kie=[["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}],["path",{d:"M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z",key:"1ezoue"}],["path",{d:"M22 19H2",key:"nuriw5"}]],FS=Ut("vote",Kie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yie=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Xie=Ut("wifi-off",Yie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qie=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Zie=Ut("wifi",Qie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jie=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Jr=Ut("x",Jie);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ese=[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]],gF=Ut("youtube",ese);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tse=[["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"}]],xF=Ut("zap",tse),rse=()=>{};var sR={};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const yF=function(e){const t=[];let r=0;for(let n=0;n>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t},nse=function(e){const t=[];let r=0,n=0;for(;r191&&i<224){const a=e[r++];t[n++]=String.fromCharCode((i&31)<<6|a&63)}else if(i>239&&i<365){const a=e[r++],o=e[r++],c=e[r++],h=((i&7)<<18|(a&63)<<12|(o&63)<<6|c&63)-65536;t[n++]=String.fromCharCode(55296+(h>>10)),t[n++]=String.fromCharCode(56320+(h&1023))}else{const a=e[r++],o=e[r++];t[n++]=String.fromCharCode((i&15)<<12|(a&63)<<6|o&63)}}return t.join("")},bF={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let i=0;i>2,y=(a&3)<<4|c>>4;let w=(c&15)<<2|f>>6,A=f&63;h||(A=64,o||(w=64)),n.push(r[m],r[y],r[w],r[A])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(yF(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):nse(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let i=0;i>4;if(n.push(w),f!==64){const A=c<<4&240|f>>2;if(n.push(A),y!==64){const S=f<<6&192|y;n.push(S)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class ise extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const sse=function(e){const t=yF(e);return bF.encodeByteArray(t,!0)},vF=function(e){return sse(e).replace(/\./g,"")},wF=function(e){try{return bF.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function NF(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ase=()=>NF().__FIREBASE_DEFAULTS__,ose=()=>{if(typeof process>"u"||typeof sR>"u")return;const e=sR.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},lse=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&wF(e[1]);return t&&JSON.parse(t)},nE=()=>{try{return rse()||ase()||ose()||lse()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},cse=e=>{var t,r;return(r=(t=nE())==null?void 0:t.emulatorHosts)==null?void 0:r[e]},EF=()=>{var e;return(e=nE())==null?void 0:e.config},AF=e=>{var t;return(t=nE())==null?void 0:t[`_${e}`]};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class use{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,r)=>{this.resolve=t,this.reject=r})}wrapCallback(t){return(r,n)=>{r?this.reject(r):this.resolve(n),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(r):t(r,n))}}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function _a(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function dse(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(_a())}function kF(){var t;const e=(t=nE())==null?void 0:t.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function hse(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function fse(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function pse(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function mse(){const e=_a();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function _F(){return!kF()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function SF(){return!kF()&&!!navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function CF(){try{return typeof indexedDB=="object"}catch{return!1}}function gse(){return new Promise((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=()=>{i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=()=>{r=!1},i.onerror=()=>{var a;t(((a=i.error)==null?void 0:a.message)||"")}}catch(r){t(r)}})}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const xse="FirebaseError";class Kd extends Error{constructor(t,r,n){super(r),this.code=t,this.customData=n,this.name=xse,Object.setPrototypeOf(this,Kd.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,By.prototype.create)}}class By{constructor(t,r,n){this.service=t,this.serviceName=r,this.errors=n}create(t,...r){const n=r[0]||{},i=`${this.service}/${t}`,a=this.errors[t],o=a?yse(a,n):"Error",c=`${this.serviceName}: ${o} (${i}).`;return new Kd(i,c,n)}}function yse(e,t){return e.replace(bse,(r,n)=>{const i=t[n];return i!=null?String(i):`<${n}?>`})}const bse=/\{\$([^}]+)}/g;function vse(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Ud(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const i of r){if(!n.includes(i))return!1;const a=e[i],o=t[i];if(aR(a)&&aR(o)){if(!Ud(a,o))return!1}else if(a!==o)return!1}for(const i of n)if(!r.includes(i))return!1;return!0}function aR(e){return e!==null&&typeof e=="object"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function zy(e){const t=[];for(const[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(i=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(i))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}function v1(e){const t={};return e.replace(/^\?/,"").split("&").forEach(n=>{if(n){const[i,a]=n.split("=");t[decodeURIComponent(i)]=decodeURIComponent(a)}}),t}function w1(e){const t=e.indexOf("?");if(!t)return"";const r=e.indexOf("#",t);return e.substring(t,r>0?r:void 0)}function wse(e,t){const r=new Nse(e,t);return r.subscribe.bind(r)}class Nse{constructor(t,r){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=r,this.task.then(()=>{t(this)}).catch(n=>{this.error(n)})}next(t){this.forEachObserver(r=>{r.next(t)})}error(t){this.forEachObserver(r=>{r.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,r,n){let i;if(t===void 0&&r===void 0&&n===void 0)throw new Error("Missing Observer.");Ese(t,["next","error","complete"])?i=t:i={next:t,error:r,complete:n},i.next===void 0&&(i.next=tk),i.error===void 0&&(i.error=tk),i.complete===void 0&&(i.complete=tk);const a=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),a}unsubscribeOne(t){this.observers===void 0||this.observers[t]===void 0||(delete this.observers[t],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let r=0;r{if(this.observers!==void 0&&this.observers[t]!==void 0)try{r(this.observers[t])}catch(n){typeof console<"u"&&console.error&&console.error(n)}})}close(t){this.finalized||(this.finalized=!0,t!==void 0&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Ese(e,t){if(typeof e!="object"||e===null)return!1;for(const r of t)if(r in e&&typeof e[r]=="function")return!0;return!1}function tk(){}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Sa(e){return e&&e._delegate?e._delegate:e}/** * @license * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Vy(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function jF(e){return(await fetch(e,{credentials:"include"})).ok}class Kp{constructor(t,r,n){this.name=t,this.instanceFactory=r,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const sp="[DEFAULT]";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let Ase=class{constructor(t,r){this.name=t,this.container=r,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const r=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(r)){const n=new use;if(this.instancesDeferred.set(r,n),this.isInitialized(r)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:r});i&&n.resolve(i)}catch{}}return this.instancesDeferred.get(r).promise}getImmediate(t){const r=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),n=(t==null?void 0:t.optional)??!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(i){if(n)return null;throw i}else{if(n)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(_se(t))try{this.getOrInitializeService({instanceIdentifier:sp})}catch{}for(const[r,n]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(r);try{const a=this.getOrInitializeService({instanceIdentifier:i});n.resolve(a)}catch{}}}}clearInstance(t=sp){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(r=>"INTERNAL"in r).map(r=>r.INTERNAL.delete()),...t.filter(r=>"_delete"in r).map(r=>r._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=sp){return this.instances.has(t)}getOptions(t=sp){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:r={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:n,options:r});for(const[a,o]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(a);n===c&&o.resolve(i)}return i}onInit(t,r){const n=this.normalizeInstanceIdentifier(r),i=this.onInitCallbacks.get(n)??new Set;i.add(t),this.onInitCallbacks.set(n,i);const a=this.instances.get(n);return a&&t(a,n),()=>{i.delete(t)}}invokeOnInitCallbacks(t,r){const n=this.onInitCallbacks.get(r);if(n)for(const i of n)try{i(t,r)}catch{}}getOrInitializeService({instanceIdentifier:t,options:r={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:kse(t),options:r}),this.instances.set(t,n),this.instancesOptions.set(t,r),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch{}return n||null}normalizeInstanceIdentifier(t=sp){return this.component?this.component.multipleInstances?t:sp:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function kse(e){return e===sp?void 0:e}function _se(e){return e.instantiationMode==="EAGER"}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Sse{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const r=this.getProvider(t.name);if(r.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);r.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const r=new Ase(t,this);return this.providers.set(t,r),r}getProviders(){return Array.from(this.providers.values())}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var oi;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(oi||(oi={}));const Cse={debug:oi.DEBUG,verbose:oi.VERBOSE,info:oi.INFO,warn:oi.WARN,error:oi.ERROR,silent:oi.SILENT},jse=oi.INFO,Ise={[oi.DEBUG]:"log",[oi.VERBOSE]:"log",[oi.INFO]:"info",[oi.WARN]:"warn",[oi.ERROR]:"error"},Tse=(e,t,...r)=>{if(tt.some(r=>e instanceof r);let oR,lR;function Ose(){return oR||(oR=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Rse(){return lR||(lR=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const IF=new WeakMap,$S=new WeakMap,TF=new WeakMap,rk=new WeakMap,NI=new WeakMap;function Dse(e){const t=new Promise((r,n)=>{const i=()=>{e.removeEventListener("success",a),e.removeEventListener("error",o)},a=()=>{r(lf(e.result)),i()},o=()=>{n(e.error),i()};e.addEventListener("success",a),e.addEventListener("error",o)});return t.then(r=>{r instanceof IDBCursor&&IF.set(r,e)}).catch(()=>{}),NI.set(t,e),t}function Mse(e){if($S.has(e))return;const t=new Promise((r,n)=>{const i=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",o),e.removeEventListener("abort",o)},a=()=>{r(),i()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",a),e.addEventListener("error",o),e.addEventListener("abort",o)});$S.set(e,t)}let HS={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return $S.get(e);if(t==="objectStoreNames")return e.objectStoreNames||TF.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return lf(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Lse(e){HS=e(HS)}function Use(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...r){const n=e.call(nk(this),t,...r);return TF.set(n,t.sort?t.sort():[t]),lf(n)}:Rse().includes(e)?function(...t){return e.apply(nk(this),t),lf(IF.get(this))}:function(...t){return lf(e.apply(nk(this),t))}}function Bse(e){return typeof e=="function"?Use(e):(e instanceof IDBTransaction&&Mse(e),Pse(e,Ose())?new Proxy(e,HS):e)}function lf(e){if(e instanceof IDBRequest)return Dse(e);if(rk.has(e))return rk.get(e);const t=Bse(e);return t!==e&&(rk.set(e,t),NI.set(t,e)),t}const nk=e=>NI.get(e);function zse(e,t,{blocked:r,upgrade:n,blocking:i,terminated:a}={}){const o=indexedDB.open(e,t),c=lf(o);return n&&o.addEventListener("upgradeneeded",h=>{n(lf(o.result),h.oldVersion,h.newVersion,lf(o.transaction),h)}),r&&o.addEventListener("blocked",h=>r(h.oldVersion,h.newVersion,h)),c.then(h=>{a&&h.addEventListener("close",()=>a()),i&&h.addEventListener("versionchange",f=>i(f.oldVersion,f.newVersion,f))}).catch(()=>{}),c}const Vse=["get","getKey","getAll","getAllKeys","count"],Fse=["put","add","delete","clear"],ik=new Map;function cR(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(ik.get(t))return ik.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,i=Fse.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||Vse.includes(r)))return;const a=async function(o,...c){const h=this.transaction(o,i?"readwrite":"readonly");let f=h.store;return n&&(f=f.index(c.shift())),(await Promise.all([f[r](...c),i&&h.done]))[0]};return ik.set(t,a),a}Lse(e=>({...e,get:(t,r,n)=>cR(t,r)||e.get(t,r,n),has:(t,r)=>!!cR(t,r)||e.has(t,r)}));/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class $se{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(r=>{if(Hse(r)){const n=r.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(r=>r).join(" ")}}function Hse(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const GS="@firebase/app",uR="0.14.10";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Bd=new wI("@firebase/app"),Gse="@firebase/app-compat",qse="@firebase/analytics-compat",Wse="@firebase/analytics",Kse="@firebase/app-check-compat",Yse="@firebase/app-check",Xse="@firebase/auth",Qse="@firebase/auth-compat",Zse="@firebase/database",Jse="@firebase/data-connect",eae="@firebase/database-compat",tae="@firebase/functions",rae="@firebase/functions-compat",nae="@firebase/installations",iae="@firebase/installations-compat",sae="@firebase/messaging",aae="@firebase/messaging-compat",oae="@firebase/performance",lae="@firebase/performance-compat",cae="@firebase/remote-config",uae="@firebase/remote-config-compat",dae="@firebase/storage",hae="@firebase/storage-compat",fae="@firebase/firestore",pae="@firebase/ai",mae="@firebase/firestore-compat",gae="firebase",xae="12.11.0";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const qS="[DEFAULT]",yae={[GS]:"fire-core",[Gse]:"fire-core-compat",[Wse]:"fire-analytics",[qse]:"fire-analytics-compat",[Yse]:"fire-app-check",[Kse]:"fire-app-check-compat",[Xse]:"fire-auth",[Qse]:"fire-auth-compat",[Zse]:"fire-rtdb",[Jse]:"fire-data-connect",[eae]:"fire-rtdb-compat",[tae]:"fire-fn",[rae]:"fire-fn-compat",[nae]:"fire-iid",[iae]:"fire-iid-compat",[sae]:"fire-fcm",[aae]:"fire-fcm-compat",[oae]:"fire-perf",[lae]:"fire-perf-compat",[cae]:"fire-rc",[uae]:"fire-rc-compat",[dae]:"fire-gcs",[hae]:"fire-gcs-compat",[fae]:"fire-fst",[mae]:"fire-fst-compat",[pae]:"fire-vertex","fire-js":"fire-js",[gae]:"fire-js-all"};/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const i2=new Map,bae=new Map,WS=new Map;function dR(e,t){try{e.container.addComponent(t)}catch(r){Bd.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function ig(e){const t=e.name;if(WS.has(t))return Bd.debug(`There were multiple attempts to register component ${t}.`),!1;WS.set(t,e);for(const r of i2.values())dR(r,e);for(const r of bae.values())dR(r,e);return!0}function EI(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function Ml(e){return e==null?!1:e.settings!==void 0}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const vae={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},cf=new By("app","Firebase",vae);/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class wae{constructor(t,r,n){this._isDeleted=!1,this._options={...t},this._config={...r},this._name=r.name,this._automaticDataCollectionEnabled=r.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new Kp("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw cf.create("app-deleted",{appName:this._name})}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Lg=xae;function PF(e,t={}){let r=e;typeof t!="object"&&(t={name:t});const n={name:qS,automaticDataCollectionEnabled:!0,...t},i=n.name;if(typeof i!="string"||!i)throw cf.create("bad-app-name",{appName:String(i)});if(r||(r=EF()),!r)throw cf.create("no-options");const a=i2.get(i);if(a){if(Ud(r,a.options)&&Ud(n,a.config))return a;throw cf.create("duplicate-app",{appName:i})}const o=new Sse(i);for(const h of WS.values())o.addComponent(h);const c=new wae(r,n,o);return i2.set(i,c),c}function Nae(e=qS){const t=i2.get(e);if(!t&&e===qS&&EF())return PF();if(!t)throw cf.create("no-app",{appName:e});return t}function uf(e,t,r){let n=yae[e]??e;r&&(n+=`-${r}`);const i=n.match(/\s|\//),a=t.match(/\s|\//);if(i||a){const o=[`Unable to register library "${n}" with version "${t}":`];i&&o.push(`library name "${n}" contains illegal characters (whitespace or "/")`),i&&a&&o.push("and"),a&&o.push(`version name "${t}" contains illegal characters (whitespace or "/")`),Bd.warn(o.join(" "));return}ig(new Kp(`${n}-version`,()=>({library:n,version:t}),"VERSION"))}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Eae="firebase-heartbeat-database",Aae=1,sy="firebase-heartbeat-store";let sk=null;function OF(){return sk||(sk=zse(Eae,Aae,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(sy)}catch(r){console.warn(r)}}}}).catch(e=>{throw cf.create("idb-open",{originalErrorMessage:e.message})})),sk}async function kae(e){try{const r=(await OF()).transaction(sy),n=await r.objectStore(sy).get(RF(e));return await r.done,n}catch(t){if(t instanceof Kd)Bd.warn(t.message);else{const r=cf.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});Bd.warn(r.message)}}}async function hR(e,t){try{const n=(await OF()).transaction(sy,"readwrite");await n.objectStore(sy).put(t,RF(e)),await n.done}catch(r){if(r instanceof Kd)Bd.warn(r.message);else{const n=cf.create("idb-set",{originalErrorMessage:r==null?void 0:r.message});Bd.warn(n.message)}}}function RF(e){return`${e.name}!${e.options.appId}`}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const _ae=1024,Sae=30;class Cae{constructor(t){this.container=t,this._heartbeatsCache=null;const r=this.container.getProvider("app").getImmediate();this._storage=new Iae(r),this._heartbeatsCachePromise=this._storage.read().then(n=>(this._heartbeatsCache=n,n))}async triggerHeartbeat(){var t,r;try{const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),a=fR();if(((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((r=this._heartbeatsCache)==null?void 0:r.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===a||this._heartbeatsCache.heartbeats.some(o=>o.date===a))return;if(this._heartbeatsCache.heartbeats.push({date:a,agent:i}),this._heartbeatsCache.heartbeats.length>Sae){const o=Tae(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(n){Bd.warn(n)}}async getHeartbeatsHeader(){var t;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const r=fR(),{heartbeatsToSend:n,unsentEntries:i}=jae(this._heartbeatsCache.heartbeats),a=vF(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=r,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),a}catch(r){return Bd.warn(r),""}}}function fR(){return new Date().toISOString().substring(0,10)}function jae(e,t=_ae){const r=[];let n=e.slice();for(const i of e){const a=r.find(o=>o.agent===i.agent);if(a){if(a.dates.push(i.date),pR(r)>t){a.dates.pop();break}}else if(r.push({agent:i.agent,dates:[i.date]}),pR(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}class Iae{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return CF()?gse().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const r=await kae(this.app);return r!=null&&r.heartbeats?r:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const n=await this.read();return hR(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){if(await this._canUseIndexedDBPromise){const n=await this.read();return hR(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}else return}}function pR(e){return vF(JSON.stringify({version:2,heartbeats:e})).length}function Tae(e){if(e.length===0)return-1;let t=0,r=e[0].date;for(let n=1;nnew $se(t),"PRIVATE")),ig(new Kp("heartbeat",t=>new Cae(t),"PRIVATE")),uf(GS,uR,e),uf(GS,uR,"esm2020"),uf("fire-js","")}Pae("");var Oae="firebase",Rae="12.11.0";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */uf(Oae,Rae,"app");function DF(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const Dae=DF,MF=new By("auth","Firebase",DF());/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const s2=new wI("@firebase/auth");function Mae(e,...t){s2.logLevel<=oi.WARN&&s2.warn(`Auth (${Lg}): ${e}`,...t)}function ww(e,...t){s2.logLevel<=oi.ERROR&&s2.error(`Auth (${Lg}): ${e}`,...t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function wc(e,...t){throw kI(e,...t)}function Hc(e,...t){return kI(e,...t)}function AI(e,t,r){const n={...Dae(),[t]:r};return new By("auth","Firebase",n).create(t,{appName:e.name})}function Pd(e){return AI(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Lae(e,t,r){const n=r;if(!(t instanceof n))throw n.name!==t.constructor.name&&wc(e,"argument-error"),AI(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function kI(e,...t){if(typeof e!="string"){const r=t[0],n=[...t.slice(1)];return n[0]&&(n[0].appName=e.name),e._errorFactory.create(r,...n)}return MF.create(e,...t)}function gn(e,t,...r){if(!e)throw kI(t,...r)}function Sd(e){const t="INTERNAL ASSERTION FAILED: "+e;throw ww(t),new Error(t)}function zd(e,t){e||Sd(t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function KS(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function Uae(){return mR()==="http:"||mR()==="https:"}function mR(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Bae(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Uae()||fse()||"connection"in navigator)?navigator.onLine:!0}function zae(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Fy{constructor(t,r){this.shortDelay=t,this.longDelay=r,zd(r>t,"Short delay should be less than long delay!"),this.isMobile=dse()||pse()}get(){return Bae()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function _I(e,t){zd(e.emulator,"Emulator should always be set here");const{url:r}=e.emulator;return t?`${r}${t.startsWith("/")?t.slice(1):t}`:r}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class LF{static initialize(t,r,n){this.fetchImpl=t,r&&(this.headersImpl=r),n&&(this.responseImpl=n)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Sd("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Sd("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Sd("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Vae={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Fae=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],$ae=new Fy(3e4,6e4);function kf(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function Yd(e,t,r,n,i={}){return UF(e,i,async()=>{let a={},o={};n&&(t==="GET"?o=n:a={body:JSON.stringify(n)});const c=zy({key:e.config.apiKey,...o}).slice(1),h=await e._getAdditionalHeaders();h["Content-Type"]="application/json",e.languageCode&&(h["X-Firebase-Locale"]=e.languageCode);const f={method:t,headers:h,...a};return hse()||(f.referrerPolicy="no-referrer"),e.emulatorConfig&&Vy(e.emulatorConfig.host)&&(f.credentials="include"),LF.fetch()(await BF(e,e.config.apiHost,r,c),f)})}async function UF(e,t,r){e._canInitEmulator=!1;const n={...Vae,...t};try{const i=new Gae(e),a=await Promise.race([r(),i.promise]);i.clearNetworkTimeout();const o=await a.json();if("needConfirmation"in o)throw Iv(e,"account-exists-with-different-credential",o);if(a.ok&&!("errorMessage"in o))return o;{const c=a.ok?o.errorMessage:o.error.message,[h,f]=c.split(" : ");if(h==="FEDERATED_USER_ID_ALREADY_LINKED")throw Iv(e,"credential-already-in-use",o);if(h==="EMAIL_EXISTS")throw Iv(e,"email-already-in-use",o);if(h==="USER_DISABLED")throw Iv(e,"user-disabled",o);const m=n[h]||h.toLowerCase().replace(/[_\s]+/g,"-");if(f)throw AI(e,m,f);wc(e,m)}}catch(i){if(i instanceof Kd)throw i;wc(e,"network-request-failed",{message:String(i)})}}async function $y(e,t,r,n,i={}){const a=await Yd(e,t,r,n,i);return"mfaPendingCredential"in a&&wc(e,"multi-factor-auth-required",{_serverResponse:a}),a}async function BF(e,t,r,n){const i=`${t}${r}?${n}`,a=e,o=a.config.emulator?_I(e.config,i):`${e.config.apiScheme}://${i}`;return Fae.includes(r)&&(await a._persistenceManagerAvailable,a._getPersistenceType()==="COOKIE")?a._getPersistence()._getFinalTarget(o).toString():o}function Hae(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Gae{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((r,n)=>{this.timer=setTimeout(()=>n(Hc(this.auth,"network-request-failed")),$ae.get())})}}function Iv(e,t,r){const n={appName:e.name};r.email&&(n.email=r.email),r.phoneNumber&&(n.phoneNumber=r.phoneNumber);const i=Hc(e,t,n);return i.customData._tokenResponse=r,i}function gR(e){return e!==void 0&&e.enterprise!==void 0}class qae{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],t.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const r of this.recaptchaEnforcementState)if(r.provider&&r.provider===t)return Hae(r.enforcementState);return null}isProviderEnabled(t){return this.getProviderEnforcementState(t)==="ENFORCE"||this.getProviderEnforcementState(t)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function Wae(e,t){return Yd(e,"GET","/v2/recaptchaConfig",kf(e,t))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Kae(e,t){return Yd(e,"POST","/v1/accounts:delete",t)}async function a2(e,t){return Yd(e,"POST","/v1/accounts:lookup",t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function D1(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function Yae(e,t=!1){const r=Sa(e),n=await r.getIdToken(t),i=SI(n);gn(i&&i.exp&&i.auth_time&&i.iat,r.auth,"internal-error");const a=typeof i.firebase=="object"?i.firebase:void 0,o=a==null?void 0:a.sign_in_provider;return{claims:i,token:n,authTime:D1(ak(i.auth_time)),issuedAtTime:D1(ak(i.iat)),expirationTime:D1(ak(i.exp)),signInProvider:o||null,signInSecondFactor:(a==null?void 0:a.sign_in_second_factor)||null}}function ak(e){return Number(e)*1e3}function SI(e){const[t,r,n]=e.split(".");if(t===void 0||r===void 0||n===void 0)return ww("JWT malformed, contained fewer than 3 sections"),null;try{const i=wF(r);return i?JSON.parse(i):(ww("Failed to decode base64 JWT payload"),null)}catch(i){return ww("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function xR(e){const t=SI(e);return gn(t,"internal-error"),gn(typeof t.exp<"u","internal-error"),gn(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function sg(e,t,r=!1){if(r)return t;try{return await t}catch(n){throw n instanceof Kd&&Xae(n)&&e.auth.currentUser===e&&await e.auth.signOut(),n}}function Xae({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Qae{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(t){if(t){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const n=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,n)}}schedule(t=!1){if(!this.isRunning)return;const r=this.getInterval(t);this.timerId=setTimeout(async()=>{await this.iteration()},r)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){(t==null?void 0:t.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class YS{constructor(t,r){this.createdAt=t,this.lastLoginAt=r,this._initializeTime()}_initializeTime(){this.lastSignInTime=D1(this.lastLoginAt),this.creationTime=D1(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function o2(e){var y;const t=e.auth,r=await e.getIdToken(),n=await sg(e,a2(t,{idToken:r}));gn(n==null?void 0:n.users.length,t,"internal-error");const i=n.users[0];e._notifyReloadListener(i);const a=(y=i.providerUserInfo)!=null&&y.length?zF(i.providerUserInfo):[],o=Jae(e.providerData,a),c=e.isAnonymous,h=!(e.email&&i.passwordHash)&&!(o!=null&&o.length),f=c?h:!1,m={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new YS(i.createdAt,i.lastLoginAt),isAnonymous:f};Object.assign(e,m)}async function Zae(e){const t=Sa(e);await o2(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function Jae(e,t){return[...e.filter(n=>!t.some(i=>i.providerId===n.providerId)),...t]}function zF(e){return e.map(({providerId:t,...r})=>({providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function eoe(e,t){const r=await UF(e,{},async()=>{const n=zy({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:a}=e.config,o=await BF(e,i,"/v1/token",`key=${a}`),c=await e._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";const h={method:"POST",headers:c,body:n};return e.emulatorConfig&&Vy(e.emulatorConfig.host)&&(h.credentials="include"),LF.fetch()(o,h)});return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}}async function toe(e,t){return Yd(e,"POST","/v2/accounts:revokeToken",kf(e,t))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class q0{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){gn(t.idToken,"internal-error"),gn(typeof t.idToken<"u","internal-error"),gn(typeof t.refreshToken<"u","internal-error");const r="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):xR(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,r)}updateFromIdToken(t){gn(t.length!==0,"internal-error");const r=xR(t);this.updateTokensAndExpiration(t,null,r)}async getToken(t,r=!1){return!r&&this.accessToken&&!this.isExpired?this.accessToken:(gn(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(t,r){const{accessToken:n,refreshToken:i,expiresIn:a}=await eoe(t,r);this.updateTokensAndExpiration(n,i,Number(a))}updateTokensAndExpiration(t,r,n){this.refreshToken=r||null,this.accessToken=t||null,this.expirationTime=Date.now()+n*1e3}static fromJSON(t,r){const{refreshToken:n,accessToken:i,expirationTime:a}=r,o=new q0;return n&&(gn(typeof n=="string","internal-error",{appName:t}),o.refreshToken=n),i&&(gn(typeof i=="string","internal-error",{appName:t}),o.accessToken=i),a&&(gn(typeof a=="number","internal-error",{appName:t}),o.expirationTime=a),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new q0,this.toJSON())}_performRefresh(){return Sd("not implemented")}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Mh(e,t){gn(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class $c{constructor({uid:t,auth:r,stsTokenManager:n,...i}){this.providerId="firebase",this.proactiveRefresh=new Qae(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new YS(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(t){const r=await sg(this,this.stsTokenManager.getToken(this.auth,t));return gn(r,this.auth,"internal-error"),this.accessToken!==r&&(this.accessToken=r,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),r}getIdTokenResult(t){return Yae(this,t)}reload(){return Zae(this)}_assign(t){this!==t&&(gn(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map(r=>({...r})),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const r=new $c({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return r.metadata._copy(this.metadata),r}_onReload(t){gn(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,r=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),r&&await o2(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Ml(this.auth.app))return Promise.reject(Pd(this.auth));const t=await this.getIdToken();return await sg(this,Kae(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(t=>({...t})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,r){const n=r.displayName??void 0,i=r.email??void 0,a=r.phoneNumber??void 0,o=r.photoURL??void 0,c=r.tenantId??void 0,h=r._redirectEventId??void 0,f=r.createdAt??void 0,m=r.lastLoginAt??void 0,{uid:y,emailVerified:w,isAnonymous:A,providerData:S,stsTokenManager:j}=r;gn(y&&j,t,"internal-error");const T=q0.fromJSON(this.name,j);gn(typeof y=="string",t,"internal-error"),Mh(n,t.name),Mh(i,t.name),gn(typeof w=="boolean",t,"internal-error"),gn(typeof A=="boolean",t,"internal-error"),Mh(a,t.name),Mh(o,t.name),Mh(c,t.name),Mh(h,t.name),Mh(f,t.name),Mh(m,t.name);const D=new $c({uid:y,auth:t,email:i,emailVerified:w,displayName:n,isAnonymous:A,photoURL:o,phoneNumber:a,tenantId:c,stsTokenManager:T,createdAt:f,lastLoginAt:m});return S&&Array.isArray(S)&&(D.providerData=S.map(V=>({...V}))),h&&(D._redirectEventId=h),D}static async _fromIdTokenResponse(t,r,n=!1){const i=new q0;i.updateFromServerResponse(r);const a=new $c({uid:r.localId,auth:t,stsTokenManager:i,isAnonymous:n});return await o2(a),a}static async _fromGetAccountInfoResponse(t,r,n){const i=r.users[0];gn(i.localId!==void 0,"internal-error");const a=i.providerUserInfo!==void 0?zF(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!(a!=null&&a.length),c=new q0;c.updateFromIdToken(n);const h=new $c({uid:i.localId,auth:t,stsTokenManager:c,isAnonymous:o}),f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new YS(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(a!=null&&a.length)};return Object.assign(h,f),h}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const yR=new Map;function Cd(e){zd(e instanceof Function,"Expected a class definition");let t=yR.get(e);return t?(zd(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,yR.set(e,t),t)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class VF{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,r){this.storage[t]=r}async _get(t){const r=this.storage[t];return r===void 0?null:r}async _remove(t){delete this.storage[t]}_addListener(t,r){}_removeListener(t,r){}}VF.type="NONE";const bR=VF;/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Nw(e,t,r){return`firebase:${e}:${t}:${r}`}class W0{constructor(t,r,n){this.persistence=t,this.auth=r,this.userKey=n;const{config:i,name:a}=this.auth;this.fullUserKey=Nw(this.userKey,i.apiKey,a),this.fullPersistenceKey=Nw("persistence",i.apiKey,a),this.boundEventHandler=r._onStorageEvent.bind(r),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);if(!t)return null;if(typeof t=="string"){const r=await a2(this.auth,{idToken:t}).catch(()=>{});return r?$c._fromGetAccountInfoResponse(this.auth,r,t):null}return $c._fromJSON(this.auth,t)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const r=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=t,r)return this.setCurrentUser(r)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,r,n="authUser"){if(!r.length)return new W0(Cd(bR),t,n);const i=(await Promise.all(r.map(async f=>{if(await f._isAvailable())return f}))).filter(f=>f);let a=i[0]||Cd(bR);const o=Nw(n,t.config.apiKey,t.name);let c=null;for(const f of r)try{const m=await f._get(o);if(m){let y;if(typeof m=="string"){const w=await a2(t,{idToken:m}).catch(()=>{});if(!w)break;y=await $c._fromGetAccountInfoResponse(t,w,m)}else y=$c._fromJSON(t,m);f!==a&&(c=y),a=f;break}}catch{}const h=i.filter(f=>f._shouldAllowMigration);return!a._shouldAllowMigration||!h.length?new W0(a,t,n):(a=h[0],c&&await a._set(o,c.toJSON()),await Promise.all(r.map(async f=>{if(f!==a)try{await f._remove(o)}catch{}})),new W0(a,t,n))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function vR(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(GF(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(FF(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(WF(t))return"Blackberry";if(KF(t))return"Webos";if($F(t))return"Safari";if((t.includes("chrome/")||HF(t))&&!t.includes("edge/"))return"Chrome";if(qF(t))return"Android";{const r=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(r);if((n==null?void 0:n.length)===2)return n[1]}return"Other"}function FF(e=_a()){return/firefox\//i.test(e)}function $F(e=_a()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function HF(e=_a()){return/crios\//i.test(e)}function GF(e=_a()){return/iemobile/i.test(e)}function qF(e=_a()){return/android/i.test(e)}function WF(e=_a()){return/blackberry/i.test(e)}function KF(e=_a()){return/webos/i.test(e)}function CI(e=_a()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function roe(e=_a()){var t;return CI(e)&&!!((t=window.navigator)!=null&&t.standalone)}function noe(){return mse()&&document.documentMode===10}function YF(e=_a()){return CI(e)||qF(e)||KF(e)||WF(e)||/windows phone/i.test(e)||GF(e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function XF(e,t=[]){let r;switch(e){case"Browser":r=vR(_a());break;case"Worker":r=`${vR(_a())}-${e}`;break;default:r=e}const n=t.length?t.join(","):"FirebaseCore-web";return`${r}/JsCore/${Lg}/${n}`}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ioe{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,r){const n=a=>new Promise((o,c)=>{try{const h=t(a);o(h)}catch(h){c(h)}});n.onAbort=r,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const r=[];try{for(const n of this.queue)await n(t),n.onAbort&&r.push(n.onAbort)}catch(n){r.reverse();for(const i of r)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:n==null?void 0:n.message})}}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function soe(e,t={}){return Yd(e,"GET","/v2/passwordPolicy",kf(e,t))}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const aoe=6;class ooe{constructor(t){var n;const r=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=r.minPasswordLength??aoe,r.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=r.maxPasswordLength),r.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=r.containsLowercaseCharacter),r.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=r.containsUppercaseCharacter),r.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=r.containsNumericCharacter),r.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=r.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((n=t.allowedNonAlphanumericCharacters)==null?void 0:n.join(""))??"",this.forceUpgradeOnSignin=t.forceUpgradeOnSignin??!1,this.schemaVersion=t.schemaVersion}validatePassword(t){const r={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,r),this.validatePasswordCharacterOptions(t,r),r.isValid&&(r.isValid=r.meetsMinPasswordLength??!0),r.isValid&&(r.isValid=r.meetsMaxPasswordLength??!0),r.isValid&&(r.isValid=r.containsLowercaseLetter??!0),r.isValid&&(r.isValid=r.containsUppercaseLetter??!0),r.isValid&&(r.isValid=r.containsNumericCharacter??!0),r.isValid&&(r.isValid=r.containsNonAlphanumericCharacter??!0),r}validatePasswordLengthOptions(t,r){const n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(r.meetsMinPasswordLength=t.length>=n),i&&(r.meetsMaxPasswordLength=t.length<=i)}validatePasswordCharacterOptions(t,r){this.updatePasswordCharacterOptionsStatuses(r,!1,!1,!1,!1);let n;for(let i=0;i="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,r,n,i,a){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=r)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=a))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class loe{constructor(t,r,n,i){this.app=t,this.heartbeatServiceProvider=r,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new wR(this),this.idTokenSubscription=new wR(this),this.beforeStateQueue=new ioe(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=MF,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(a=>this._resolvePersistenceManagerAvailable=a)}_initializeWithPersistence(t,r){return r&&(this._popupRedirectResolver=Cd(r)),this._initializationPromise=this.queue(async()=>{var n,i,a;if(!this._deleted&&(this.persistenceManager=await W0.create(this,t),(n=this._resolvePersistenceManagerAvailable)==null||n.call(this),!this._deleted)){if((i=this._popupRedirectResolver)!=null&&i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(r),this.lastNotifiedUid=((a=this.currentUser)==null?void 0:a.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!t)){if(this.currentUser&&t&&this.currentUser.uid===t.uid){this._currentUser._assign(t),await this.currentUser.getIdToken();return}await this._updateCurrentUser(t,!0)}}async initializeCurrentUserFromIdToken(t){try{const r=await a2(this,{idToken:t}),n=await $c._fromGetAccountInfoResponse(this,r,t);await this.directlySetCurrentUser(n)}catch(r){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",r),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var a;if(Ml(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(c=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(c,c))}):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let n=r,i=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(a=this.redirectUser)==null?void 0:a._redirectEventId,c=n==null?void 0:n._redirectEventId,h=await this.tryRedirectSignIn(t);(!o||o===c)&&(h!=null&&h.user)&&(n=h.user,i=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(n)}catch(o){n=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return gn(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(t){let r=null;try{r=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch{await this._setRedirectUser(null)}return r}async reloadAndSetCurrentUserOrClear(t){try{await o2(t)}catch(r){if((r==null?void 0:r.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=zae()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Ml(this.app))return Promise.reject(Pd(this));const r=t?Sa(t):null;return r&&gn(r.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(r&&r._clone(this))}async _updateCurrentUser(t,r=!1){if(!this._deleted)return t&&gn(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),r||await this.beforeStateQueue.runMiddleware(t),this.queue(async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()})}async signOut(){return Ml(this.app)?Promise.reject(Pd(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Ml(this.app)?Promise.reject(Pd(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Cd(t))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const r=this._getPasswordPolicyInternal();return r.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):r.validatePassword(t)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await soe(this),r=new ooe(t);this.tenantId===null?this._projectPasswordPolicy=r:this._tenantPasswordPolicies[this.tenantId]=r}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new By("auth","Firebase",t())}onAuthStateChanged(t,r,n){return this.registerStateListener(this.authStateSubscription,t,r,n)}beforeAuthStateChanged(t,r){return this.beforeStateQueue.pushCallback(t,r)}onIdTokenChanged(t,r,n){return this.registerStateListener(this.idTokenSubscription,t,r,n)}authStateReady(){return new Promise((t,r)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged(()=>{n(),t()},r)}})}async revokeAccessToken(t){if(this.currentUser){const r=await this.currentUser.getIdToken(),n={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:r};this.tenantId!=null&&(n.tenantId=this.tenantId),await toe(this,n)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(t=this._currentUser)==null?void 0:t.toJSON()}}async _setRedirectUser(t,r){const n=await this.getOrInitRedirectPersistenceManager(r);return t===null?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const r=t&&Cd(t)||this._popupRedirectResolver;gn(r,this,"argument-error"),this.redirectPersistenceManager=await W0.create(this,[Cd(r._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var r,n;return this._isInitialized&&await this.queue(async()=>{}),((r=this._currentUser)==null?void 0:r._redirectEventId)===t?this._currentUser:((n=this.redirectUser)==null?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(t))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var r;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const t=((r=this.currentUser)==null?void 0:r.uid)??null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,r,n,i){if(this._deleted)return()=>{};const a=typeof r=="function"?r:r.next.bind(r);let o=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(gn(c,this,"internal-error"),c.then(()=>{o||a(this.currentUser)}),typeof r=="function"){const h=t.addObserver(r,n,i);return()=>{o=!0,h()}}else{const h=t.addObserver(r);return()=>{o=!0,h()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return gn(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=XF(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var i;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const r=await((i=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:i.getHeartbeatsHeader());r&&(t["X-Firebase-Client"]=r);const n=await this._getAppCheckToken();return n&&(t["X-Firebase-AppCheck"]=n),t}async _getAppCheckToken(){var r;if(Ml(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await((r=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:r.getToken());return t!=null&&t.error&&Mae(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function _f(e){return Sa(e)}class wR{constructor(t){this.auth=t,this.observer=null,this.addObserver=wse(r=>this.observer=r)}get next(){return gn(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let iE={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function coe(e){iE=e}function QF(e){return iE.loadJS(e)}function uoe(){return iE.recaptchaEnterpriseScript}function doe(){return iE.gapiScript}function hoe(e){return`__${e}${Math.floor(Math.random()*1e6)}`}class foe{constructor(){this.enterprise=new poe}ready(t){t()}execute(t,r){return Promise.resolve("token")}render(t,r){return""}}class poe{ready(t){t()}execute(t,r){return Promise.resolve("token")}render(t,r){return""}}const moe="recaptcha-enterprise",ZF="NO_RECAPTCHA";class goe{constructor(t){this.type=moe,this.auth=_f(t)}async verify(t="verify",r=!1){async function n(a){if(!r){if(a.tenantId==null&&a._agentRecaptchaConfig!=null)return a._agentRecaptchaConfig.siteKey;if(a.tenantId!=null&&a._tenantRecaptchaConfigs[a.tenantId]!==void 0)return a._tenantRecaptchaConfigs[a.tenantId].siteKey}return new Promise(async(o,c)=>{Wae(a,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(h=>{if(h.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{const f=new qae(h);return a.tenantId==null?a._agentRecaptchaConfig=f:a._tenantRecaptchaConfigs[a.tenantId]=f,o(f.siteKey)}}).catch(h=>{c(h)})})}function i(a,o,c){const h=window.grecaptcha;gR(h)?h.enterprise.ready(()=>{h.enterprise.execute(a,{action:t}).then(f=>{o(f)}).catch(()=>{o(ZF)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new foe().execute("siteKey",{action:"verify"}):new Promise((a,o)=>{n(this.auth).then(c=>{if(!r&&gR(window.grecaptcha))i(c,a,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let h=uoe();h.length!==0&&(h+=c),QF(h).then(()=>{i(c,a,o)}).catch(f=>{o(f)})}}).catch(c=>{o(c)})})}}async function NR(e,t,r,n=!1,i=!1){const a=new goe(e);let o;if(i)o=ZF;else try{o=await a.verify(r)}catch{o=await a.verify(r,!0)}const c={...t};if(r==="mfaSmsEnrollment"||r==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){const h=c.phoneEnrollmentInfo.phoneNumber,f=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:h,recaptchaToken:f,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){const h=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:h,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return n?Object.assign(c,{captchaResp:o}):Object.assign(c,{captchaResponse:o}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function XS(e,t,r,n,i){var a;if((a=e._getRecaptchaConfig())!=null&&a.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const o=await NR(e,t,r,r==="getOobCode");return n(e,o)}else return n(e,t).catch(async o=>{if(o.code==="auth/missing-recaptcha-token"){console.log(`${r} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const c=await NR(e,t,r,r==="getOobCode");return n(e,c)}else return Promise.reject(o)})}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function xoe(e,t){const r=EI(e,"auth");if(r.isInitialized()){const i=r.getImmediate(),a=r.getOptions();if(Ud(a,t??{}))return i;wc(i,"already-initialized")}return r.initialize({options:t})}function yoe(e,t){const r=(t==null?void 0:t.persistence)||[],n=(Array.isArray(r)?r:[r]).map(Cd);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(n,t==null?void 0:t.popupRedirectResolver)}function boe(e,t,r){const n=_f(e);gn(/^https?:\/\//.test(t),n,"invalid-emulator-scheme");const i=!1,a=JF(t),{host:o,port:c}=voe(t),h=c===null?"":`:${c}`,f={url:`${a}//${o}${h}/`},m=Object.freeze({host:o,port:c,protocol:a.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!n._canInitEmulator){gn(n.config.emulator&&n.emulatorConfig,n,"emulator-config-failed"),gn(Ud(f,n.config.emulator)&&Ud(m,n.emulatorConfig),n,"emulator-config-failed");return}n.config.emulator=f,n.emulatorConfig=m,n.settings.appVerificationDisabledForTesting=!0,Vy(o)?jF(`${a}//${o}${h}`):woe()}function JF(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function voe(e){const t=JF(e),r=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!r)return{host:"",port:null};const n=r[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(n);if(i){const a=i[1];return{host:a,port:ER(n.substr(a.length+1))}}else{const[a,o]=n.split(":");return{host:a,port:ER(o)}}}function ER(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function woe(){function e(){const t=document.createElement("p"),r=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",r.position="fixed",r.width="100%",r.backgroundColor="#ffffff",r.border=".1em solid #000000",r.color="#b50000",r.bottom="0px",r.left="0px",r.margin="0px",r.zIndex="10000",r.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",e):e())}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class jI{constructor(t,r){this.providerId=t,this.signInMethod=r}toJSON(){return Sd("not implemented")}_getIdTokenResponse(t){return Sd("not implemented")}_linkToIdToken(t,r){return Sd("not implemented")}_getReauthenticationResolver(t){return Sd("not implemented")}}async function Noe(e,t){return Yd(e,"POST","/v1/accounts:signUp",t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Eoe(e,t){return $y(e,"POST","/v1/accounts:signInWithPassword",kf(e,t))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Aoe(e,t){return $y(e,"POST","/v1/accounts:signInWithEmailLink",kf(e,t))}async function koe(e,t){return $y(e,"POST","/v1/accounts:signInWithEmailLink",kf(e,t))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ay extends jI{constructor(t,r,n,i=null){super("password",n),this._email=t,this._password=r,this._tenantId=i}static _fromEmailAndPassword(t,r){return new ay(t,r,"password")}static _fromEmailAndCode(t,r,n=null){return new ay(t,r,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const r=typeof t=="string"?JSON.parse(t):t;if(r!=null&&r.email&&(r!=null&&r.password)){if(r.signInMethod==="password")return this._fromEmailAndPassword(r.email,r.password);if(r.signInMethod==="emailLink")return this._fromEmailAndCode(r.email,r.password,r.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":const r={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return XS(t,r,"signInWithPassword",Eoe);case"emailLink":return Aoe(t,{email:this._email,oobCode:this._password});default:wc(t,"internal-error")}}async _linkToIdToken(t,r){switch(this.signInMethod){case"password":const n={idToken:r,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return XS(t,n,"signUpPassword",Noe);case"emailLink":return koe(t,{idToken:r,email:this._email,oobCode:this._password});default:wc(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function K0(e,t){return $y(e,"POST","/v1/accounts:signInWithIdp",kf(e,t))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const _oe="http://localhost";class Yp extends jI{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const r=new Yp(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(r.idToken=t.idToken),t.accessToken&&(r.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(r.nonce=t.nonce),t.pendingToken&&(r.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(r.accessToken=t.oauthToken,r.secret=t.oauthTokenSecret):wc("argument-error"),r}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const r=typeof t=="string"?JSON.parse(t):t,{providerId:n,signInMethod:i,...a}=r;if(!n||!i)return null;const o=new Yp(n,i);return o.idToken=a.idToken||void 0,o.accessToken=a.accessToken||void 0,o.secret=a.secret,o.nonce=a.nonce,o.pendingToken=a.pendingToken||null,o}_getIdTokenResponse(t){const r=this.buildRequest();return K0(t,r)}_linkToIdToken(t,r){const n=this.buildRequest();return n.idToken=r,K0(t,n)}_getReauthenticationResolver(t){const r=this.buildRequest();return r.autoCreate=!1,K0(t,r)}buildRequest(){const t={requestUri:_oe,returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const r={};this.idToken&&(r.id_token=this.idToken),this.accessToken&&(r.access_token=this.accessToken),this.secret&&(r.oauth_token_secret=this.secret),r.providerId=this.providerId,this.nonce&&!this.pendingToken&&(r.nonce=this.nonce),t.postBody=zy(r)}return t}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Soe(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Coe(e){const t=v1(w1(e)).link,r=t?v1(w1(t)).deep_link_id:null,n=v1(w1(e)).deep_link_id;return(n?v1(w1(n)).link:null)||n||r||t||e}class II{constructor(t){const r=v1(w1(t)),n=r.apiKey??null,i=r.oobCode??null,a=Soe(r.mode??null);gn(n&&i&&a,"argument-error"),this.apiKey=n,this.operation=a,this.code=i,this.continueUrl=r.continueUrl??null,this.languageCode=r.lang??null,this.tenantId=r.tenantId??null}static parseLink(t){const r=Coe(t);try{return new II(r)}catch{return null}}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ug{constructor(){this.providerId=Ug.PROVIDER_ID}static credential(t,r){return ay._fromEmailAndPassword(t,r)}static credentialWithLink(t,r){const n=II.parseLink(r);return gn(n,"argument-error"),ay._fromEmailAndCode(t,n.code,n.tenantId)}}Ug.PROVIDER_ID="password";Ug.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Ug.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class TI{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Hy extends TI{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Xh extends Hy{constructor(){super("facebook.com")}static credential(t){return Yp._fromParams({providerId:Xh.PROVIDER_ID,signInMethod:Xh.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Xh.credentialFromTaggedObject(t)}static credentialFromError(t){return Xh.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return Xh.credential(t.oauthAccessToken)}catch{return null}}}Xh.FACEBOOK_SIGN_IN_METHOD="facebook.com";Xh.PROVIDER_ID="facebook.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class kd extends Hy{constructor(){super("google.com"),this.addScope("profile")}static credential(t,r){return Yp._fromParams({providerId:kd.PROVIDER_ID,signInMethod:kd.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:r})}static credentialFromResult(t){return kd.credentialFromTaggedObject(t)}static credentialFromError(t){return kd.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:r,oauthAccessToken:n}=t;if(!r&&!n)return null;try{return kd.credential(r,n)}catch{return null}}}kd.GOOGLE_SIGN_IN_METHOD="google.com";kd.PROVIDER_ID="google.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Qh extends Hy{constructor(){super("github.com")}static credential(t){return Yp._fromParams({providerId:Qh.PROVIDER_ID,signInMethod:Qh.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Qh.credentialFromTaggedObject(t)}static credentialFromError(t){return Qh.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return Qh.credential(t.oauthAccessToken)}catch{return null}}}Qh.GITHUB_SIGN_IN_METHOD="github.com";Qh.PROVIDER_ID="github.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Zh extends Hy{constructor(){super("twitter.com")}static credential(t,r){return Yp._fromParams({providerId:Zh.PROVIDER_ID,signInMethod:Zh.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:r})}static credentialFromResult(t){return Zh.credentialFromTaggedObject(t)}static credentialFromError(t){return Zh.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:r,oauthTokenSecret:n}=t;if(!r||!n)return null;try{return Zh.credential(r,n)}catch{return null}}}Zh.TWITTER_SIGN_IN_METHOD="twitter.com";Zh.PROVIDER_ID="twitter.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function joe(e,t){return $y(e,"POST","/v1/accounts:signUp",kf(e,t))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Xp{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,r,n,i=!1){const a=await $c._fromIdTokenResponse(t,n,i),o=AR(n);return new Xp({user:a,providerId:o,_tokenResponse:n,operationType:r})}static async _forOperation(t,r,n){await t._updateTokensIfNecessary(n,!0);const i=AR(n);return new Xp({user:t,providerId:i,_tokenResponse:n,operationType:r})}}function AR(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class l2 extends Kd{constructor(t,r,n,i){super(r.code,r.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,l2.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:r.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,r,n,i){return new l2(t,r,n,i)}}function e$(e,t,r,n){return(t==="reauthenticate"?r._getReauthenticationResolver(e):r._getIdTokenResponse(e)).catch(a=>{throw a.code==="auth/multi-factor-auth-required"?l2._fromErrorAndOperation(e,a,t,n):a})}async function Ioe(e,t,r=!1){const n=await sg(e,t._linkToIdToken(e.auth,await e.getIdToken()),r);return Xp._forOperation(e,"link",n)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Toe(e,t,r=!1){const{auth:n}=e;if(Ml(n.app))return Promise.reject(Pd(n));const i="reauthenticate";try{const a=await sg(e,e$(n,i,t,e),r);gn(a.idToken,n,"internal-error");const o=SI(a.idToken);gn(o,n,"internal-error");const{sub:c}=o;return gn(e.uid===c,n,"user-mismatch"),Xp._forOperation(e,i,a)}catch(a){throw(a==null?void 0:a.code)==="auth/user-not-found"&&wc(n,"user-mismatch"),a}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function t$(e,t,r=!1){if(Ml(e.app))return Promise.reject(Pd(e));const n="signIn",i=await e$(e,n,t),a=await Xp._fromIdTokenResponse(e,n,i);return r||await e._updateCurrentUser(a.user),a}async function Poe(e,t){return t$(_f(e),t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function r$(e){const t=_f(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function Ooe(e,t,r){if(Ml(e.app))return Promise.reject(Pd(e));const n=_f(e),o=await XS(n,{returnSecureToken:!0,email:t,password:r,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",joe).catch(h=>{throw h.code==="auth/password-does-not-meet-requirements"&&r$(e),h}),c=await Xp._fromIdTokenResponse(n,"signIn",o);return await n._updateCurrentUser(c.user),c}function Roe(e,t,r){return Ml(e.app)?Promise.reject(Pd(e)):Poe(Sa(e),Ug.credential(t,r)).catch(async n=>{throw n.code==="auth/password-does-not-meet-requirements"&&r$(e),n})}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Doe(e,t){return Yd(e,"POST","/v1/accounts:update",t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function n$(e,{displayName:t,photoURL:r}){if(t===void 0&&r===void 0)return;const n=Sa(e),a={idToken:await n.getIdToken(),displayName:t,photoUrl:r,returnSecureToken:!0},o=await sg(n,Doe(n.auth,a));n.displayName=o.displayName||null,n.photoURL=o.photoUrl||null;const c=n.providerData.find(({providerId:h})=>h==="password");c&&(c.displayName=n.displayName,c.photoURL=n.photoURL),await n._updateTokensIfNecessary(o)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Moe(e,t){return Sa(e).setPersistence(t)}function Loe(e,t,r,n){return Sa(e).onIdTokenChanged(t,r,n)}function Uoe(e,t,r){return Sa(e).beforeAuthStateChanged(t,r)}const c2="__sak";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class i${constructor(t,r){this.storageRetriever=t,this.type=r}_isAvailable(){try{return this.storage?(this.storage.setItem(c2,"1"),this.storage.removeItem(c2),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,r){return this.storage.setItem(t,JSON.stringify(r)),Promise.resolve()}_get(t){const r=this.storage.getItem(t);return Promise.resolve(r?JSON.parse(r):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Boe=1e3,zoe=10;class s$ extends i${constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,r)=>this.onStorageEvent(t,r),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=YF(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const r of Object.keys(this.listeners)){const n=this.storage.getItem(r),i=this.localCache[r];n!==i&&t(r,i,n)}}onStorageEvent(t,r=!1){if(!t.key){this.forAllChangedKeys((o,c,h)=>{this.notifyListeners(o,h)});return}const n=t.key;r?this.detachListener():this.stopPolling();const i=()=>{const o=this.storage.getItem(n);!r&&this.localCache[n]===o||this.notifyListeners(n,o)},a=this.storage.getItem(n);noe()&&a!==t.newValue&&t.newValue!==t.oldValue?setTimeout(i,zoe):i()}notifyListeners(t,r){this.localCache[t]=r;const n=this.listeners[t];if(n)for(const i of Array.from(n))i(r&&JSON.parse(r))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((t,r,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:r,newValue:n}),!0)})},Boe)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,r){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(r)}_removeListener(t,r){this.listeners[t]&&(this.listeners[t].delete(r),this.listeners[t].size===0&&delete this.listeners[t]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(t,r){await super._set(t,r),this.localCache[t]=JSON.stringify(r)}async _get(t){const r=await super._get(t);return this.localCache[t]=JSON.stringify(r),r}async _remove(t){await super._remove(t),delete this.localCache[t]}}s$.type="LOCAL";const a$=s$;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class o$ extends i${constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,r){}_removeListener(t,r){}}o$.type="SESSION";const l$=o$;/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Voe(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(r){return{fulfilled:!1,reason:r}}}))}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class sE{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const r=this.receivers.find(i=>i.isListeningto(t));if(r)return r;const n=new sE(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const r=t,{eventId:n,eventType:i,data:a}=r.data,o=this.handlersMap[i];if(!(o!=null&&o.size))return;r.ports[0].postMessage({status:"ack",eventId:n,eventType:i});const c=Array.from(o).map(async f=>f(r.origin,a)),h=await Voe(c);r.ports[0].postMessage({status:"done",eventId:n,eventType:i,response:h})}_subscribe(t,r){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(r)}_unsubscribe(t,r){this.handlersMap[t]&&r&&this.handlersMap[t].delete(r),(!r||this.handlersMap[t].size===0)&&delete this.handlersMap[t],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}sE.receivers=[];/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function PI(e="",t=10){let r="";for(let n=0;n{const f=PI("",20);i.port1.start();const m=setTimeout(()=>{h(new Error("unsupported_event"))},n);o={messageChannel:i,onMessage(y){const w=y;if(w.data.eventId===f)switch(w.data.status){case"ack":clearTimeout(m),a=setTimeout(()=>{h(new Error("timeout"))},3e3);break;case"done":clearTimeout(a),c(w.data.response);break;default:clearTimeout(m),clearTimeout(a),h(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:t,eventId:f,data:r},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Du(){return window}function $oe(e){Du().location.href=e}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function c$(){return typeof Du().WorkerGlobalScope<"u"&&typeof Du().importScripts=="function"}async function Hoe(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Goe(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function qoe(){return c$()?self:null}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const u$="firebaseLocalStorageDb",Woe=1,u2="firebaseLocalStorage",d$="fbase_key";class Gy{constructor(t){this.request=t}toPromise(){return new Promise((t,r)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{r(this.request.error)})})}}function aE(e,t){return e.transaction([u2],t?"readwrite":"readonly").objectStore(u2)}function Koe(){const e=indexedDB.deleteDatabase(u$);return new Gy(e).toPromise()}function QS(){const e=indexedDB.open(u$,Woe);return new Promise((t,r)=>{e.addEventListener("error",()=>{r(e.error)}),e.addEventListener("upgradeneeded",()=>{const n=e.result;try{n.createObjectStore(u2,{keyPath:d$})}catch(i){r(i)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(u2)?t(n):(n.close(),await Koe(),t(await QS()))})})}async function kR(e,t,r){const n=aE(e,!0).put({[d$]:t,value:r});return new Gy(n).toPromise()}async function Yoe(e,t){const r=aE(e,!1).get(t),n=await new Gy(r).toPromise();return n===void 0?null:n.value}function _R(e,t){const r=aE(e,!0).delete(t);return new Gy(r).toPromise()}const Xoe=800,Qoe=3;class h${constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await QS(),this.db)}async _withRetries(t){let r=0;for(;;)try{const n=await this._openDb();return await t(n)}catch(n){if(r++>Qoe)throw n;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return c$()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=sE._getInstance(qoe()),this.receiver._subscribe("keyChanged",async(t,r)=>({keyProcessed:(await this._poll()).includes(r.key)})),this.receiver._subscribe("ping",async(t,r)=>["keyChanged"])}async initializeSender(){var r,n;if(this.activeServiceWorker=await Hoe(),!this.activeServiceWorker)return;this.sender=new Foe(this.activeServiceWorker);const t=await this.sender._send("ping",{},800);t&&(r=t[0])!=null&&r.fulfilled&&(n=t[0])!=null&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(!(!this.sender||!this.activeServiceWorker||Goe()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await QS();return await kR(t,c2,"1"),await _R(t,c2),!0}catch{}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,r){return this._withPendingWrite(async()=>(await this._withRetries(n=>kR(n,t,r)),this.localCache[t]=r,this.notifyServiceWorker(t)))}async _get(t){const r=await this._withRetries(n=>Yoe(n,t));return this.localCache[t]=r,r}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(r=>_R(r,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(i=>{const a=aE(i,!1).getAll();return new Gy(a).toPromise()});if(!t)return[];if(this.pendingWrites!==0)return[];const r=[],n=new Set;if(t.length!==0)for(const{fbase_key:i,value:a}of t)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(a)&&(this.notifyListeners(i,a),r.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!n.has(i)&&(this.notifyListeners(i,null),r.push(i));return r}notifyListeners(t,r){this.localCache[t]=r;const n=this.listeners[t];if(n)for(const i of Array.from(n))i(r)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Xoe)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,r){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(r)}_removeListener(t,r){this.listeners[t]&&(this.listeners[t].delete(r),this.listeners[t].size===0&&delete this.listeners[t]),Object.keys(this.listeners).length===0&&this.stopPolling()}}h$.type="LOCAL";const Zoe=h$;new Fy(3e4,6e4);/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function f$(e,t){return t?Cd(t):(gn(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class OI extends jI{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return K0(t,this._buildIdpRequest())}_linkToIdToken(t,r){return K0(t,this._buildIdpRequest(r))}_getReauthenticationResolver(t){return K0(t,this._buildIdpRequest())}_buildIdpRequest(t){const r={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(r.idToken=t),r}}function Joe(e){return t$(e.auth,new OI(e),e.bypassAuthState)}function ele(e){const{auth:t,user:r}=e;return gn(r,t,"internal-error"),Toe(r,new OI(e),e.bypassAuthState)}async function tle(e){const{auth:t,user:r}=e;return gn(r,t,"internal-error"),Ioe(r,new OI(e),e.bypassAuthState)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class p${constructor(t,r,n,i,a=!1){this.auth=t,this.resolver=n,this.user=i,this.bypassAuthState=a,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(r)?r:[r]}execute(){return new Promise(async(t,r)=>{this.pendingPromise={resolve:t,reject:r};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(n){this.reject(n)}})}async onAuthEvent(t){const{urlResponse:r,sessionId:n,postBody:i,tenantId:a,error:o,type:c}=t;if(o){this.reject(o);return}const h={auth:this.auth,requestUri:r,sessionId:n,tenantId:a||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(h))}catch(f){this.reject(f)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return Joe;case"linkViaPopup":case"linkViaRedirect":return tle;case"reauthViaPopup":case"reauthViaRedirect":return ele;default:wc(this.auth,"internal-error")}}resolve(t){zd(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){zd(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const rle=new Fy(2e3,1e4);async function nle(e,t,r){if(Ml(e.app))return Promise.reject(Hc(e,"operation-not-supported-in-this-environment"));const n=_f(e);Lae(e,t,TI);const i=f$(n,r);return new vp(n,"signInViaPopup",t,i).executeNotNull()}class vp extends p${constructor(t,r,n,i,a){super(t,r,i,a),this.provider=n,this.authWindow=null,this.pollId=null,vp.currentPopupAction&&vp.currentPopupAction.cancel(),vp.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return gn(t,this.auth,"internal-error"),t}async onExecution(){zd(this.filter.length===1,"Popup operations only handle one event");const t=PI();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(r=>{this.reject(r)}),this.resolver._isIframeWebStorageSupported(this.auth,r=>{r||this.reject(Hc(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(Hc(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,vp.currentPopupAction=null}pollUserCancellation(){const t=()=>{var r,n;if((n=(r=this.authWindow)==null?void 0:r.window)!=null&&n.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Hc(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,rle.get())};t()}}vp.currentPopupAction=null;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ile="pendingRedirect",Ew=new Map;class sle extends p${constructor(t,r,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],r,void 0,n),this.eventId=null}async execute(){let t=Ew.get(this.auth._key());if(!t){try{const n=await ale(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(n)}catch(r){t=()=>Promise.reject(r)}Ew.set(this.auth._key(),t)}return this.bypassAuthState||Ew.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(t){if(t.type==="signInViaRedirect")return super.onAuthEvent(t);if(t.type==="unknown"){this.resolve(null);return}if(t.eventId){const r=await this.auth._redirectUserForId(t.eventId);if(r)return this.user=r,super.onAuthEvent(t);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function ale(e,t){const r=cle(t),n=lle(e);if(!await n._isAvailable())return!1;const i=await n._get(r)==="true";return await n._remove(r),i}function ole(e,t){Ew.set(e._key(),t)}function lle(e){return Cd(e._redirectPersistence)}function cle(e){return Nw(ile,e.config.apiKey,e.name)}async function ule(e,t,r=!1){if(Ml(e.app))return Promise.reject(Pd(e));const n=_f(e),i=f$(n,t),o=await new sle(n,i,r).execute();return o&&!r&&(delete o.user._redirectEventId,await n._persistUserIfCurrent(o.user),await n._setRedirectUser(null,t)),o}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const dle=600*1e3;class hle{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let r=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(t,n)&&(r=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!fle(t)||(this.hasHandledPotentialRedirect=!0,r||(this.queuedRedirectEvent=t,r=!0)),r}sendToConsumer(t,r){var n;if(t.error&&!m$(t)){const i=((n=t.error.code)==null?void 0:n.split("auth/")[1])||"internal-error";r.onError(Hc(this.auth,i))}else r.onAuthEvent(t)}isEventForConsumer(t,r){const n=r.eventId===null||!!t.eventId&&t.eventId===r.eventId;return r.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=dle&&this.cachedEventUids.clear(),this.cachedEventUids.has(SR(t))}saveEventToCache(t){this.cachedEventUids.add(SR(t)),this.lastProcessedEventTime=Date.now()}}function SR(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function m$({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function fle(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return m$(e);default:return!1}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function ple(e,t={}){return Yd(e,"GET","/v1/projects",t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const mle=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,gle=/^https?/;async function xle(e){if(e.config.emulator)return;const{authorizedDomains:t}=await ple(e);for(const r of t)try{if(yle(r))return}catch{}wc(e,"unauthorized-domain")}function yle(e){const t=KS(),{protocol:r,hostname:n}=new URL(t);if(e.startsWith("chrome-extension://")){const o=new URL(e);return o.hostname===""&&n===""?r==="chrome-extension:"&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):r==="chrome-extension:"&&o.hostname===n}if(!gle.test(r))return!1;if(mle.test(e))return n===e;const i=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(n)}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ble=new Fy(3e4,6e4);function CR(){const e=Du().___jsl;if(e!=null&&e.H){for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let r=0;r{var i,a,o;function n(){CR(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{CR(),r(Hc(e,"network-request-failed"))},timeout:ble.get()})}if((a=(i=Du().gapi)==null?void 0:i.iframes)!=null&&a.Iframe)t(gapi.iframes.getContext());else if((o=Du().gapi)!=null&&o.load)n();else{const c=hoe("iframefcb");return Du()[c]=()=>{gapi.load?n():r(Hc(e,"network-request-failed"))},QF(`${doe()}?onload=${c}`).catch(h=>r(h))}}).catch(t=>{throw Aw=null,t})}let Aw=null;function wle(e){return Aw=Aw||vle(e),Aw}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Nle=new Fy(5e3,15e3),Ele="__/auth/iframe",Ale="emulator/auth/iframe",kle={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},_le=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Sle(e){const t=e.config;gn(t.authDomain,e,"auth-domain-config-required");const r=t.emulator?_I(t,Ale):`https://${e.config.authDomain}/${Ele}`,n={apiKey:t.apiKey,appName:e.name,v:Lg},i=_le.get(e.config.apiHost);i&&(n.eid=i);const a=e._getFrameworks();return a.length&&(n.fw=a.join(",")),`${r}?${zy(n).slice(1)}`}async function Cle(e){const t=await wle(e),r=Du().gapi;return gn(r,e,"internal-error"),t.open({where:document.body,url:Sle(e),messageHandlersFilter:r.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:kle,dontclear:!0},n=>new Promise(async(i,a)=>{await n.restyle({setHideOnLeave:!1});const o=Hc(e,"network-request-failed"),c=Du().setTimeout(()=>{a(o)},Nle.get());function h(){Du().clearTimeout(c),i(n)}n.ping(h).then(h,()=>{a(o)})}))}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const jle={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Ile=500,Tle=600,Ple="_blank",Ole="http://localhost";class jR{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function Rle(e,t,r,n=Ile,i=Tle){const a=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-n)/2,0).toString();let c="";const h={...jle,width:n.toString(),height:i.toString(),top:a,left:o},f=_a().toLowerCase();r&&(c=HF(f)?Ple:r),FF(f)&&(t=t||Ole,h.scrollbars="yes");const m=Object.entries(h).reduce((w,[A,S])=>`${w}${A}=${S},`,"");if(roe(f)&&c!=="_self")return Dle(t||"",c),new jR(null);const y=window.open(t||"",c,m);gn(y,e,"popup-blocked");try{y.focus()}catch{}return new jR(y)}function Dle(e,t){const r=document.createElement("a");r.href=e,r.target=t;const n=document.createEvent("MouseEvent");n.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),r.dispatchEvent(n)}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Mle="__/auth/handler",Lle="emulator/auth/handler",Ule=encodeURIComponent("fac");async function IR(e,t,r,n,i,a){gn(e.config.authDomain,e,"auth-domain-config-required"),gn(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:r,redirectUrl:n,v:Lg,eventId:i};if(t instanceof TI){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",vse(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[m,y]of Object.entries({}))o[m]=y}if(t instanceof Hy){const m=t.getScopes().filter(y=>y!=="");m.length>0&&(o.scopes=m.join(","))}e.tenantId&&(o.tid=e.tenantId);const c=o;for(const m of Object.keys(c))c[m]===void 0&&delete c[m];const h=await e._getAppCheckToken(),f=h?`#${Ule}=${encodeURIComponent(h)}`:"";return`${Ble(e)}?${zy(c).slice(1)}${f}`}function Ble({config:e}){return e.emulator?_I(e,Lle):`https://${e.authDomain}/${Mle}`}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ok="webStorageSupport";class zle{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=l$,this._completeRedirectFn=ule,this._overrideRedirectResult=ole}async _openPopup(t,r,n,i){var o;zd((o=this.eventManagers[t._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const a=await IR(t,r,n,KS(),i);return Rle(t,a,PI())}async _openRedirect(t,r,n,i){await this._originValidation(t);const a=await IR(t,r,n,KS(),i);return $oe(a),new Promise(()=>{})}_initialize(t){const r=t._key();if(this.eventManagers[r]){const{manager:i,promise:a}=this.eventManagers[r];return i?Promise.resolve(i):(zd(a,"If manager is not set, promise should be"),a)}const n=this.initAndGetManager(t);return this.eventManagers[r]={promise:n},n.catch(()=>{delete this.eventManagers[r]}),n}async initAndGetManager(t){const r=await Cle(t),n=new hle(t);return r.register("authEvent",i=>(gn(i==null?void 0:i.authEvent,t,"invalid-auth-event"),{status:n.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=r,n}_isIframeWebStorageSupported(t,r){this.iframes[t._key()].send(ok,{type:ok},i=>{var o;const a=(o=i==null?void 0:i[0])==null?void 0:o[ok];a!==void 0&&r(!!a),wc(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const r=t._key();return this.originValidationPromises[r]||(this.originValidationPromises[r]=xle(t)),this.originValidationPromises[r]}get _shouldInitProactively(){return YF()||$F()||CI()}}const Vle=zle;var TR="@firebase/auth",PR="1.12.2";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Fle{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),((t=this.auth.currentUser)==null?void 0:t.uid)||null}async getToken(t){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(t)}:null}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const r=this.auth.onIdTokenChanged(n=>{t((n==null?void 0:n.stsTokenManager.accessToken)||null)});this.internalListeners.set(t,r),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const r=this.internalListeners.get(t);r&&(this.internalListeners.delete(t),r(),this.updateProactiveRefresh())}assertAuthConfigured(){gn(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function $le(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Hle(e){ig(new Kp("auth",(t,{options:r})=>{const n=t.getProvider("app").getImmediate(),i=t.getProvider("heartbeat"),a=t.getProvider("app-check-internal"),{apiKey:o,authDomain:c}=n.options;gn(o&&!o.includes(":"),"invalid-api-key",{appName:n.name});const h={apiKey:o,authDomain:c,clientPlatform:e,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:XF(e)},f=new loe(n,i,a,h);return yoe(f,r),f},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,r,n)=>{t.getProvider("auth-internal").initialize()})),ig(new Kp("auth-internal",t=>{const r=_f(t.getProvider("auth").getImmediate());return(n=>new Fle(n))(r)},"PRIVATE").setInstantiationMode("EXPLICIT")),uf(TR,PR,$le(e)),uf(TR,PR,"esm2020")}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Gle=300,qle=AF("authIdTokenMaxAge")||Gle;let OR=null;const Wle=e=>async t=>{const r=t&&await t.getIdTokenResult(),n=r&&(new Date().getTime()-Date.parse(r.issuedAtTime))/1e3;if(n&&n>qle)return;const i=r==null?void 0:r.token;OR!==i&&(OR=i,await fetch(e,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function Kle(e=Nae()){const t=EI(e,"auth");if(t.isInitialized())return t.getImmediate();const r=xoe(e,{popupRedirectResolver:Vle,persistence:[Zoe,a$,l$]}),n=AF("authTokenSyncURL");if(n&&typeof isSecureContext=="boolean"&&isSecureContext){const a=new URL(n,location.origin);if(location.origin===a.origin){const o=Wle(a.toString());Uoe(r,o,()=>o(r.currentUser)),Loe(r,c=>o(c))}}const i=cse("auth");return i&&boe(r,`http://${i}`),r}function Yle(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}coe({loadJS(e){return new Promise((t,r)=>{const n=document.createElement("script");n.setAttribute("src",e),n.onload=t,n.onerror=i=>{const a=Hc("internal-error");a.customData=i,r(a)},n.type="text/javascript",n.charset="UTF-8",Yle().appendChild(n)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Hle("Browser");var RR=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */var df,g$;(function(){var e;/** @license Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */function t(B,z){function F(){}F.prototype=z.prototype,B.F=z.prototype,B.prototype=new F,B.prototype.constructor=B,B.D=function($,J,Q){for(var K=Array(arguments.length-2),me=2;me>>25),K=Q+(J^z&(F^J))+$[1]+3905402710&4294967295,Q=z+(K<<12&4294967295|K>>>20),K=J+(F^Q&(z^F))+$[2]+606105819&4294967295,J=Q+(K<<17&4294967295|K>>>15),K=F+(z^J&(Q^z))+$[3]+3250441966&4294967295,F=J+(K<<22&4294967295|K>>>10),K=z+(Q^F&(J^Q))+$[4]+4118548399&4294967295,z=F+(K<<7&4294967295|K>>>25),K=Q+(J^z&(F^J))+$[5]+1200080426&4294967295,Q=z+(K<<12&4294967295|K>>>20),K=J+(F^Q&(z^F))+$[6]+2821735955&4294967295,J=Q+(K<<17&4294967295|K>>>15),K=F+(z^J&(Q^z))+$[7]+4249261313&4294967295,F=J+(K<<22&4294967295|K>>>10),K=z+(Q^F&(J^Q))+$[8]+1770035416&4294967295,z=F+(K<<7&4294967295|K>>>25),K=Q+(J^z&(F^J))+$[9]+2336552879&4294967295,Q=z+(K<<12&4294967295|K>>>20),K=J+(F^Q&(z^F))+$[10]+4294925233&4294967295,J=Q+(K<<17&4294967295|K>>>15),K=F+(z^J&(Q^z))+$[11]+2304563134&4294967295,F=J+(K<<22&4294967295|K>>>10),K=z+(Q^F&(J^Q))+$[12]+1804603682&4294967295,z=F+(K<<7&4294967295|K>>>25),K=Q+(J^z&(F^J))+$[13]+4254626195&4294967295,Q=z+(K<<12&4294967295|K>>>20),K=J+(F^Q&(z^F))+$[14]+2792965006&4294967295,J=Q+(K<<17&4294967295|K>>>15),K=F+(z^J&(Q^z))+$[15]+1236535329&4294967295,F=J+(K<<22&4294967295|K>>>10),K=z+(J^Q&(F^J))+$[1]+4129170786&4294967295,z=F+(K<<5&4294967295|K>>>27),K=Q+(F^J&(z^F))+$[6]+3225465664&4294967295,Q=z+(K<<9&4294967295|K>>>23),K=J+(z^F&(Q^z))+$[11]+643717713&4294967295,J=Q+(K<<14&4294967295|K>>>18),K=F+(Q^z&(J^Q))+$[0]+3921069994&4294967295,F=J+(K<<20&4294967295|K>>>12),K=z+(J^Q&(F^J))+$[5]+3593408605&4294967295,z=F+(K<<5&4294967295|K>>>27),K=Q+(F^J&(z^F))+$[10]+38016083&4294967295,Q=z+(K<<9&4294967295|K>>>23),K=J+(z^F&(Q^z))+$[15]+3634488961&4294967295,J=Q+(K<<14&4294967295|K>>>18),K=F+(Q^z&(J^Q))+$[4]+3889429448&4294967295,F=J+(K<<20&4294967295|K>>>12),K=z+(J^Q&(F^J))+$[9]+568446438&4294967295,z=F+(K<<5&4294967295|K>>>27),K=Q+(F^J&(z^F))+$[14]+3275163606&4294967295,Q=z+(K<<9&4294967295|K>>>23),K=J+(z^F&(Q^z))+$[3]+4107603335&4294967295,J=Q+(K<<14&4294967295|K>>>18),K=F+(Q^z&(J^Q))+$[8]+1163531501&4294967295,F=J+(K<<20&4294967295|K>>>12),K=z+(J^Q&(F^J))+$[13]+2850285829&4294967295,z=F+(K<<5&4294967295|K>>>27),K=Q+(F^J&(z^F))+$[2]+4243563512&4294967295,Q=z+(K<<9&4294967295|K>>>23),K=J+(z^F&(Q^z))+$[7]+1735328473&4294967295,J=Q+(K<<14&4294967295|K>>>18),K=F+(Q^z&(J^Q))+$[12]+2368359562&4294967295,F=J+(K<<20&4294967295|K>>>12),K=z+(F^J^Q)+$[5]+4294588738&4294967295,z=F+(K<<4&4294967295|K>>>28),K=Q+(z^F^J)+$[8]+2272392833&4294967295,Q=z+(K<<11&4294967295|K>>>21),K=J+(Q^z^F)+$[11]+1839030562&4294967295,J=Q+(K<<16&4294967295|K>>>16),K=F+(J^Q^z)+$[14]+4259657740&4294967295,F=J+(K<<23&4294967295|K>>>9),K=z+(F^J^Q)+$[1]+2763975236&4294967295,z=F+(K<<4&4294967295|K>>>28),K=Q+(z^F^J)+$[4]+1272893353&4294967295,Q=z+(K<<11&4294967295|K>>>21),K=J+(Q^z^F)+$[7]+4139469664&4294967295,J=Q+(K<<16&4294967295|K>>>16),K=F+(J^Q^z)+$[10]+3200236656&4294967295,F=J+(K<<23&4294967295|K>>>9),K=z+(F^J^Q)+$[13]+681279174&4294967295,z=F+(K<<4&4294967295|K>>>28),K=Q+(z^F^J)+$[0]+3936430074&4294967295,Q=z+(K<<11&4294967295|K>>>21),K=J+(Q^z^F)+$[3]+3572445317&4294967295,J=Q+(K<<16&4294967295|K>>>16),K=F+(J^Q^z)+$[6]+76029189&4294967295,F=J+(K<<23&4294967295|K>>>9),K=z+(F^J^Q)+$[9]+3654602809&4294967295,z=F+(K<<4&4294967295|K>>>28),K=Q+(z^F^J)+$[12]+3873151461&4294967295,Q=z+(K<<11&4294967295|K>>>21),K=J+(Q^z^F)+$[15]+530742520&4294967295,J=Q+(K<<16&4294967295|K>>>16),K=F+(J^Q^z)+$[2]+3299628645&4294967295,F=J+(K<<23&4294967295|K>>>9),K=z+(J^(F|~Q))+$[0]+4096336452&4294967295,z=F+(K<<6&4294967295|K>>>26),K=Q+(F^(z|~J))+$[7]+1126891415&4294967295,Q=z+(K<<10&4294967295|K>>>22),K=J+(z^(Q|~F))+$[14]+2878612391&4294967295,J=Q+(K<<15&4294967295|K>>>17),K=F+(Q^(J|~z))+$[5]+4237533241&4294967295,F=J+(K<<21&4294967295|K>>>11),K=z+(J^(F|~Q))+$[12]+1700485571&4294967295,z=F+(K<<6&4294967295|K>>>26),K=Q+(F^(z|~J))+$[3]+2399980690&4294967295,Q=z+(K<<10&4294967295|K>>>22),K=J+(z^(Q|~F))+$[10]+4293915773&4294967295,J=Q+(K<<15&4294967295|K>>>17),K=F+(Q^(J|~z))+$[1]+2240044497&4294967295,F=J+(K<<21&4294967295|K>>>11),K=z+(J^(F|~Q))+$[8]+1873313359&4294967295,z=F+(K<<6&4294967295|K>>>26),K=Q+(F^(z|~J))+$[15]+4264355552&4294967295,Q=z+(K<<10&4294967295|K>>>22),K=J+(z^(Q|~F))+$[6]+2734768916&4294967295,J=Q+(K<<15&4294967295|K>>>17),K=F+(Q^(J|~z))+$[13]+1309151649&4294967295,F=J+(K<<21&4294967295|K>>>11),K=z+(J^(F|~Q))+$[4]+4149444226&4294967295,z=F+(K<<6&4294967295|K>>>26),K=Q+(F^(z|~J))+$[11]+3174756917&4294967295,Q=z+(K<<10&4294967295|K>>>22),K=J+(z^(Q|~F))+$[2]+718787259&4294967295,J=Q+(K<<15&4294967295|K>>>17),K=F+(Q^(J|~z))+$[9]+3951481745&4294967295,B.g[0]=B.g[0]+z&4294967295,B.g[1]=B.g[1]+(J+(K<<21&4294967295|K>>>11))&4294967295,B.g[2]=B.g[2]+J&4294967295,B.g[3]=B.g[3]+Q&4294967295}n.prototype.v=function(B,z){z===void 0&&(z=B.length);const F=z-this.blockSize,$=this.C;let J=this.h,Q=0;for(;Q>>$&255;return B};function a(B,z){var F=c;return Object.prototype.hasOwnProperty.call(F,B)?F[B]:F[B]=z(B)}function o(B,z){this.h=z;const F=[];let $=!0;for(let J=B.length-1;J>=0;J--){const Q=B[J]|0;$&&Q==z||(F[J]=Q,$=!1)}this.g=F}var c={};function h(B){return-128<=B&&B<128?a(B,function(z){return new o([z|0],z<0?-1:0)}):new o([B|0],B<0?-1:0)}function f(B){if(isNaN(B)||!isFinite(B))return y;if(B<0)return T(f(-B));const z=[];let F=1;for(let $=0;B>=F;$++)z[$]=B/F|0,F*=4294967296;return new o(z,0)}function m(B,z){if(B.length==0)throw Error("number format error: empty string");if(z=z||10,z<2||36=0)throw Error('number format error: interior "-" character');const F=f(Math.pow(z,8));let $=y;for(let Q=0;Q=0?$:4294967296+$)*z,z*=4294967296}return B},e.toString=function(B){if(B=B||10,B<2||360?F.g[0]:F.h)>>>0).toString(B);if(F=J,S(F))return Q+$;for(;Q.length<6;)Q="0"+Q;$=Q+$}},e.i=function(B){return B<0?0:B>>16)+(this.i(J)>>>16)+(B.i(J)>>>16);$=K>>>16,Q&=65535,K&=65535,F[J]=K<<16|Q}return new o(F,F[F.length-1]&-2147483648?-1:0)};function D(B,z){return B.add(T(z))}e.j=function(B){if(S(this)||S(B))return y;if(j(this))return j(B)?T(this).j(T(B)):T(T(this).j(B));if(j(B))return T(this.j(T(B)));if(this.l(A)<0&&B.l(A)<0)return f(this.m()*B.m());const z=this.g.length+B.g.length,F=[];for(var $=0;$<2*z;$++)F[$]=0;for($=0;$>>16,K=this.i($)&65535,me=B.i(J)>>>16,re=B.i(J)&65535;F[2*$+2*J]+=K*re,V(F,2*$+2*J),F[2*$+2*J+1]+=Q*re,V(F,2*$+2*J+1),F[2*$+2*J+1]+=K*me,V(F,2*$+2*J+1),F[2*$+2*J+2]+=Q*me,V(F,2*$+2*J+2)}for(B=0;B>>16,B[z]&=65535,z++}function U(B,z){this.g=B,this.h=z}function G(B,z){if(S(z))throw Error("division by zero");if(S(B))return new U(y,y);if(j(B))return z=G(T(B),z),new U(T(z.g),T(z.h));if(j(z))return z=G(B,T(z)),new U(T(z.g),z.h);if(B.g.length>30){if(j(B)||j(z))throw Error("slowDivide_ only works with positive integers.");for(var F=w,$=z;$.l(B)<=0;)F=X(F),$=X($);var J=q(F,1),Q=q($,1);for($=q($,2),F=q(F,2);!S($);){var K=Q.add($);K.l(B)<=0&&(J=J.add(F),Q=K),$=q($,1),F=q(F,1)}return z=D(B,J.j(z)),new U(J,z)}for(J=y;B.l(z)>=0;){for(F=Math.max(1,Math.floor(B.m()/z.m())),$=Math.ceil(Math.log(F)/Math.LN2),$=$<=48?1:Math.pow(2,$-48),Q=f(F),K=Q.j(z);j(K)||K.l(B)>0;)F-=$,Q=f(F),K=Q.j(z);S(Q)&&(Q=w),J=J.add(Q),B=D(B,K)}return new U(J,B)}e.B=function(B){return G(this,B).h},e.and=function(B){const z=Math.max(this.g.length,B.g.length),F=[];for(let $=0;$>>31;return new o(F,B.h)}function q(B,z){const F=z>>5;z%=32;const $=B.g.length-F,J=[];for(let Q=0;Q<$;Q++)J[Q]=z>0?B.i(Q+F)>>>z|B.i(Q+F+1)<<32-z:B.i(Q+F);return new o(J,B.h)}n.prototype.digest=n.prototype.A,n.prototype.reset=n.prototype.u,n.prototype.update=n.prototype.v,g$=n,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=f,o.fromString=m,df=o}).apply(typeof RR<"u"?RR:typeof self<"u"?self:typeof window<"u"?window:{});var Tv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */var x$,N1,y$,kw,ZS,b$,v$,w$;(function(){var e,t=Object.defineProperty;function r(k){k=[typeof globalThis=="object"&&globalThis,k,typeof window=="object"&&window,typeof self=="object"&&self,typeof Tv=="object"&&Tv];for(var L=0;Lk&&AsyncContext.Snapshot.wrap(k):k=>k;function A(k){const L=k.length;if(L>0){const H=Array(L);for(let ne=0;ne0?(this.h--,L=this.g,this.g=L.next,L.next=null):L=this.i(),L}}function T(k){o.setTimeout(()=>{throw k},0)}function D(){var k=B;let L=null;return k.g&&(L=k.g,k.g=k.g.next,k.g||(k.h=null),L.next=null),L}class V{constructor(){this.h=this.g=null}add(L,H){const ne=U.get();ne.set(L,H),this.h?this.h.next=ne:this.g=ne,this.h=ne}}var U=new j(()=>new G,k=>k.reset());class G{constructor(){this.next=this.g=this.h=null}set(L,H){this.h=L,this.g=H,this.next=null}reset(){this.next=this.g=this.h=null}}let X,q=!1,B=new V,z=()=>{const k=Promise.resolve(void 0);X=()=>{k.then(F)}};function F(){for(var k;k=D();){try{k.h.call(k.g)}catch(H){T(H)}var L=U;L.j(k),L.h<100&&(L.h++,k.next=L.g,L.g=k)}q=!1}function $(){this.u=this.u,this.C=this.C}$.prototype.u=!1,$.prototype.dispose=function(){this.u||(this.u=!0,this.N())},$.prototype[Symbol.dispose]=function(){this.dispose()},$.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function J(k,L){this.type=k,this.g=this.target=L,this.defaultPrevented=!1}J.prototype.h=function(){this.defaultPrevented=!0};var Q=(function(){if(!o.addEventListener||!Object.defineProperty)return!1;var k=!1,L=Object.defineProperty({},"passive",{get:function(){k=!0}});try{const H=()=>{};o.addEventListener("test",H,L),o.removeEventListener("test",H,L)}catch{}return k})();function K(k){return/^[\s\xa0]*$/.test(k)}function me(k,L){J.call(this,k?k.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,k&&this.init(k,L)}y(me,J),me.prototype.init=function(k,L){const H=this.type=k.type,ne=k.changedTouches&&k.changedTouches.length?k.changedTouches[0]:null;this.target=k.target||k.srcElement,this.g=L,L=k.relatedTarget,L||(H=="mouseover"?L=k.fromElement:H=="mouseout"&&(L=k.toElement)),this.relatedTarget=L,ne?(this.clientX=ne.clientX!==void 0?ne.clientX:ne.pageX,this.clientY=ne.clientY!==void 0?ne.clientY:ne.pageY,this.screenX=ne.screenX||0,this.screenY=ne.screenY||0):(this.clientX=k.clientX!==void 0?k.clientX:k.pageX,this.clientY=k.clientY!==void 0?k.clientY:k.pageY,this.screenX=k.screenX||0,this.screenY=k.screenY||0),this.button=k.button,this.key=k.key||"",this.ctrlKey=k.ctrlKey,this.altKey=k.altKey,this.shiftKey=k.shiftKey,this.metaKey=k.metaKey,this.pointerId=k.pointerId||0,this.pointerType=k.pointerType,this.state=k.state,this.i=k,k.defaultPrevented&&me.Z.h.call(this)},me.prototype.h=function(){me.Z.h.call(this);const k=this.i;k.preventDefault?k.preventDefault():k.returnValue=!1};var re="closure_listenable_"+(Math.random()*1e6|0),le=0;function ve(k,L,H,ne,Ee){this.listener=k,this.proxy=null,this.src=L,this.type=H,this.capture=!!ne,this.ha=Ee,this.key=++le,this.da=this.fa=!1}function je(k){k.da=!0,k.listener=null,k.proxy=null,k.src=null,k.ha=null}function Ve(k,L,H){for(const ne in k)L.call(H,k[ne],ne,k)}function Z(k,L){for(const H in k)L.call(void 0,k[H],H,k)}function se(k){const L={};for(const H in k)L[H]=k[H];return L}const xe="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function ae(k,L){let H,ne;for(let Ee=1;Ee-1?(L=k[wt],H||(L.fa=!1)):(L=new ve(L,this.src,Ue,!!ne,Ee),L.fa=H,k.push(L)),L};function pt(k,L){const H=L.type;if(H in k.g){var ne=k.g[H],Ee=Array.prototype.indexOf.call(ne,L,void 0),Ue;(Ue=Ee>=0)&&Array.prototype.splice.call(ne,Ee,1),Ue&&(je(L),k.g[H].length==0&&(delete k.g[H],k.h--))}}function Fe(k,L,H,ne){for(let Ee=0;Ee-1&&(je(L[H]),Array.prototype.splice.call(L,H,1),L.length==0&&(delete k.g[Ue],k.h--)))):k&&(k=St(k))&&(L=k.g[L.toString()],k=-1,L&&(k=Fe(L,H,ne,Ee)),(H=k>-1?L[k]:null)&&It(H))}function It(k){if(typeof k!="number"&&k&&!k.da){var L=k.src;if(L&&L[re])pt(L.i,k);else{var H=k.type,ne=k.proxy;L.removeEventListener?L.removeEventListener(H,ne,k.capture):L.detachEvent?L.detachEvent(Dt(H),ne):L.addListener&&L.removeListener&&L.removeListener(ne),(H=St(L))?(pt(H,k),H.h==0&&(H.src=null,L[jt]=null)):je(k)}}}function Dt(k){return k in Pt?Pt[k]:Pt[k]="on"+k}function cr(k,L){if(k.da)k=!0;else{L=new me(L,this);const H=k.listener,ne=k.ha||k.src;k.fa&&It(k),k=H.call(ne,L)}return k}function St(k){return k=k[jt],k instanceof qe?k:null}var Ct="__closure_events_fn_"+(Math.random()*1e9>>>0);function Gt(k){return typeof k=="function"?k:(k[Ct]||(k[Ct]=function(L){return k.handleEvent(L)}),k[Ct])}function Xe(){$.call(this),this.i=new qe(this),this.M=this,this.G=null}y(Xe,$),Xe.prototype[re]=!0,Xe.prototype.removeEventListener=function(k,L,H,ne){Re(this,k,L,H,ne)};function Xt(k,L){var H,ne=k.G;if(ne)for(H=[];ne;ne=ne.G)H.push(ne);if(k=k.M,ne=L.type||L,typeof L=="string")L=new J(L,k);else if(L instanceof J)L.target=L.target||k;else{var Ee=L;L=new J(ne,k),ae(L,Ee)}Ee=!0;let Ue,wt;if(H)for(wt=H.length-1;wt>=0;wt--)Ue=L.g=H[wt],Ee=Ot(Ue,ne,!0,L)&&Ee;if(Ue=L.g=k,Ee=Ot(Ue,ne,!0,L)&&Ee,Ee=Ot(Ue,ne,!1,L)&&Ee,H)for(wt=0;wt2147483647?-1:o.setTimeout(k,L||0)}function Wr(k){k.g=or(()=>{k.g=null,k.i&&(k.i=!1,Wr(k))},k.l);const L=k.h;k.h=null,k.m.apply(null,L)}class dr extends ${constructor(L,H){super(),this.m=L,this.l=H,this.h=null,this.i=!1,this.g=null}j(L){this.h=arguments,this.g?this.i=!0:Wr(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function yn(k){$.call(this),this.h=k,this.g={}}y(yn,$);var He=[];function Rt(k){Ve(k.g,function(L,H){this.g.hasOwnProperty(H)&&It(L)},k),k.g={}}yn.prototype.N=function(){yn.Z.N.call(this),Rt(this)},yn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var nr=o.JSON.stringify,fr=o.JSON.parse,hn=class{stringify(k){return o.JSON.stringify(k,void 0)}parse(k){return o.JSON.parse(k,void 0)}};function en(){}function Ci(){}var Gr={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function be(){J.call(this,"d")}y(be,J);function Pe(){J.call(this,"c")}y(Pe,J);var $e={},ct=null;function yr(){return ct=ct||new Xe}$e.Ia="serverreachability";function Lt(k){J.call(this,$e.Ia,k)}y(Lt,J);function Lr(k){const L=yr();Xt(L,new Lt(L))}$e.STAT_EVENT="statevent";function ir(k,L){J.call(this,$e.STAT_EVENT,k),this.stat=L}y(ir,J);function pr(k){const L=yr();Xt(L,new ir(L,k))}$e.Ja="timingevent";function br(k,L){J.call(this,$e.Ja,k),this.size=L}y(br,J);function ln(k,L){if(typeof k!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){k()},L)}function de(){this.g=!0}de.prototype.ua=function(){this.g=!1};function ke(k,L,H,ne,Ee,Ue){k.info(function(){if(k.g)if(Ue){var wt="",xr=Ue.split("&");for(let Vt=0;Vt1){const $r=mt[0];mt=mt[1];const fn=$r.split("_");wt=fn.length>=2&&fn[1]=="type"?wt+($r+"="+mt+"&"):wt+($r+"=redacted&")}}}else wt=null;else wt=Ue;return"XMLHTTP REQ ("+ne+") [attempt "+Ee+"]: "+L+` `+H+` `+wt})}function Ze(k,L,H,ne,Ee,Ue,wt){k.info(function(){return"XMLHTTP RESP ("+ne+") [ attempt "+Ee+"]: "+L+` `+H+` `+Ue+" "+wt})}function Ft(k,L,H,ne){k.info(function(){return"XMLHTTP TEXT ("+L+"): "+gr(k,H)+(ne?" "+ne:"")})}function Fr(k,L){k.info(function(){return"TIMEOUT: "+L})}de.prototype.info=function(){};function gr(k,L){if(!k.g)return L;if(!L)return null;try{const Ue=JSON.parse(L);if(Ue){for(k=0;k0&&k.length;)H.push(k.shift()),L--;return k.length&&H.push(k.join(":")),H}function ft(k,L,H,ne){this.j=k,this.i=L,this.l=H,this.S=ne||1,this.V=new yn(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new mr}function mr(){this.i=null,this.g="",this.h=!1}var Ht={},kr={};function mn(k,L,H){k.M=1,k.A=Bt(at(L)),k.u=H,k.R=!0,fi(k,null)}function fi(k,L){k.F=Date.now(),cs(k),k.B=at(k.A);var H=k.B,ne=k.S;Array.isArray(ne)||(ne=[String(ne)]),Sn(H.i,"t",ne),k.C=0,H=k.j.L,k.h=new mr,k.g=Ke(k.j,H?L:null,!k.u),k.P>0&&(k.O=new dr(f(k.Y,k,k.g),k.P)),L=k.V,H=k.g,ne=k.ba;var Ee="readystatechange";Array.isArray(Ee)||(Ee&&(He[0]=Ee.toString()),Ee=He);for(let Ue=0;Ue0&&!this.W){this.W=!0;var wt=this.j;wt.g==this&&wt.aa&&!wt.P&&(wt.j.info("Great, no buffering proxy detected. Bytes received: "+H.length),it(wt),wt.P=!0,pr(11))}}else Ft(this.i,this.l,H,null),bi(this,H);xr==4&&Xn(this),this.o&&!this.K&&(xr==4?Qa(this.j,this):(this.o=!1,cs(this)))}else Cs(this.g),L==400&&H.indexOf("Unknown SID")>0?(this.m=3,pr(12)):(this.m=0,pr(13)),Xn(this),On(this)}}}catch{}finally{}};function _s(k){if(!xn(k))return k.g.la();const L=wi(k.g);if(L==="")return"";let H="";const ne=L.length,Ee=ta(k.g)==4;if(!k.h.i){if(typeof TextDecoder>"u")return Xn(k),On(k),"";k.h.i=new o.TextDecoder}for(let Ue=0;UeL.length?kr:(L=L.slice(ne,ne+H),k.C=ne+H,L)))}ft.prototype.cancel=function(){this.K=!0,Xn(this)};function cs(k){k.T=Date.now()+k.H,ji(k,k.H)}function ji(k,L){if(k.D!=null)throw Error("WatchDog timer not null");k.D=ln(f(k.aa,k),L)}function Kn(k){k.D&&(o.clearTimeout(k.D),k.D=null)}ft.prototype.aa=function(){this.D=null;const k=Date.now();k-this.T>=0?(Fr(this.i,this.B),this.M!=2&&(Lr(),pr(17)),Xn(this),this.m=2,On(this)):ji(this,this.T-k)};function On(k){k.j.I==0||k.K||Qa(k.j,k)}function Xn(k){Kn(k);var L=k.O;L&&typeof L.dispose=="function"&&L.dispose(),k.O=null,Rt(k.V),k.g&&(L=k.g,k.g=null,L.abort(),L.dispose())}function bi(k,L){try{var H=k.j;if(H.I!=0&&(H.g==k||ts(H.h,k))){if(!k.L&&ts(H.h,k)&&H.I==3){try{var ne=H.Ba.g.parse(L)}catch{ne=null}if(Array.isArray(ne)&&ne.length==3){var Ee=ne;if(Ee[0]==0){e:if(!H.v){if(H.g)if(H.g.F+3e30&&(ne=1.5*Mn,H.O=ne,H.j.info("backChannelRequestTimeoutMs_="+ne)),ne=H;const ni=k.g;if(ni){const Ms=ni.g?ni.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Ms){var Ue=ne.h;Ue.g||Ms.indexOf("spdy")==-1&&Ms.indexOf("quic")==-1&&Ms.indexOf("h2")==-1||(Ue.j=Ue.l,Ue.g=new Set,Ue.h&&(Wa(Ue,Ue.h),Ue.h=null))}if(ne.G){const zi=ni.g?ni.g.getResponseHeader("X-HTTP-Session-Id"):null;zi&&(ne.wa=zi,ze(ne.J,ne.G,zi))}}H.I=3,H.l&&H.l.ra(),H.aa&&(H.T=Date.now()-k.F,H.j.info("Handshake RTT: "+H.T+"ms")),ne=H;var wt=k;if(ne.na=Me(ne,ne.L?ne.ba:null,ne.W),wt.L){En(ne.h,wt);var xr=wt,mt=ne.O;mt&&(xr.H=mt),xr.D&&(Kn(xr),cs(xr)),ne.g=wt}else ma(ne);H.i.length>0&&ra(H)}else Vt[0]!="stop"&&Vt[0]!="close"||ge(H,7);else H.I==3&&(Vt[0]=="stop"||Vt[0]=="close"?Vt[0]=="stop"?ge(H,7):Ql(H):Vt[0]!="noop"&&H.l&&H.l.qa(Vt),H.A=0)}}Lr(4)}catch{}}var ci=class{constructor(k,L){this.g=k,this.map=L}};function At(k){this.l=k||10,o.PerformanceNavigationTiming?(k=o.performance.getEntriesByType("navigation"),k=k.length>0&&(k[0].nextHopProtocol=="hq"||k[0].nextHopProtocol=="h2")):k=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=k?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function ha(k){return k.h?!0:k.g?k.g.size>=k.j:!1}function Un(k){return k.h?1:k.g?k.g.size:0}function ts(k,L){return k.h?k.h==L:k.g?k.g.has(L):!1}function Wa(k,L){k.g?k.g.add(L):k.h=L}function En(k,L){k.h&&k.h==L?k.h=null:k.g&&k.g.has(L)&&k.g.delete(L)}At.prototype.cancel=function(){if(this.i=jn(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const k of this.g.values())k.cancel();this.g.clear()}};function jn(k){if(k.h!=null)return k.i.concat(k.h.G);if(k.g!=null&&k.g.size!==0){let L=k.i;for(const H of k.g.values())L=L.concat(H.G);return L}return A(k.i)}var an=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function De(k,L){if(k){k=k.split("&");for(let H=0;H=0?(Ee=k[H].substring(0,ne),Ue=k[H].substring(ne+1)):Ee=k[H],L(Ee,Ue?decodeURIComponent(Ue.replace(/\+/g," ")):"")}}}function ht(k){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let L;k instanceof ht?(this.l=k.l,Et(this,k.j),this.o=k.o,this.g=k.g,rr(this,k.u),this.h=k.h,Nr(this,Ta(k.i)),this.m=k.m):k&&(L=String(k).match(an))?(this.l=!1,Et(this,L[1]||"",!0),this.o=Er(L[2]||""),this.g=Er(L[3]||"",!0),rr(this,L[4]),this.h=Er(L[5]||"",!0),Nr(this,L[6]||"",!0),this.m=Er(L[7]||"")):(this.l=!1,this.i=new vi(null,this.l))}ht.prototype.toString=function(){const k=[];var L=this.j;L&&k.push(jr(L,_n,!0),":");var H=this.g;return(H||L=="file")&&(k.push("//"),(L=this.o)&&k.push(jr(L,_n,!0),"@"),k.push(Oe(H).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),H=this.u,H!=null&&k.push(":",String(H))),(H=this.h)&&(this.g&&H.charAt(0)!="/"&&k.push("/"),k.push(jr(H,H.charAt(0)=="/"?pe:Be,!0))),(H=this.i.toString())&&k.push("?",H),(H=this.m)&&k.push("#",jr(H,Ii)),k.join("")},ht.prototype.resolve=function(k){const L=at(this);let H=!!k.j;H?Et(L,k.j):H=!!k.o,H?L.o=k.o:H=!!k.g,H?L.g=k.g:H=k.u!=null;var ne=k.h;if(H)rr(L,k.u);else if(H=!!k.h){if(ne.charAt(0)!="/")if(this.g&&!this.h)ne="/"+ne;else{var Ee=L.h.lastIndexOf("/");Ee!=-1&&(ne=L.h.slice(0,Ee+1)+ne)}if(Ee=ne,Ee==".."||Ee==".")ne="";else if(Ee.indexOf("./")!=-1||Ee.indexOf("/.")!=-1){ne=Ee.lastIndexOf("/",0)==0,Ee=Ee.split("/");const Ue=[];for(let wt=0;wt1||Ue.length==1&&Ue[0]!="")&&Ue.pop(),ne&&wt==Ee.length&&Ue.push("")):(Ue.push(xr),ne=!0)}ne=Ue.join("/")}else ne=Ee}return H?L.h=ne:H=k.i.toString()!=="",H?Nr(L,Ta(k.i)):H=!!k.m,H&&(L.m=k.m),L};function at(k){return new ht(k)}function Et(k,L,H){k.j=H?Er(L,!0):L,k.j&&(k.j=k.j.replace(/:$/,""))}function rr(k,L){if(L){if(L=Number(L),isNaN(L)||L<0)throw Error("Bad port number "+L);k.u=L}else k.u=null}function Nr(k,L,H){L instanceof vi?(k.i=L,Po(k.i,k.l)):(H||(L=jr(L,ur)),k.i=new vi(L,k.l))}function ze(k,L,H){k.i.set(L,H)}function Bt(k){return ze(k,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),k}function Er(k,L){return k?L?decodeURI(k.replace(/%25/g,"%2525")):decodeURIComponent(k):""}function jr(k,L,H){return typeof k=="string"?(k=encodeURI(k).replace(L,_r),H&&(k=k.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),k):null}function _r(k){return k=k.charCodeAt(0),"%"+(k>>4&15).toString(16)+(k&15).toString(16)}var _n=/[#\/\?@]/g,Be=/[#\?:]/g,pe=/[#\?]/g,ur=/[#\?@]/g,Ii=/#/g;function vi(k,L){this.h=this.g=null,this.i=k||null,this.j=!!L}function ti(k){k.g||(k.g=new Map,k.h=0,k.i&&De(k.i,function(L,H){k.add(decodeURIComponent(L.replace(/\+/g," ")),H)}))}e=vi.prototype,e.add=function(k,L){ti(this),this.i=null,k=Ss(this,k);let H=this.g.get(k);return H||this.g.set(k,H=[]),H.push(L),this.h+=1,this};function ea(k,L){ti(k),L=Ss(k,L),k.g.has(L)&&(k.i=null,k.h-=k.g.get(L).length,k.g.delete(L))}function Ti(k,L){return ti(k),L=Ss(k,L),k.g.has(L)}e.forEach=function(k,L){ti(this),this.g.forEach(function(H,ne){H.forEach(function(Ee){k.call(L,Ee,ne,this)},this)},this)};function zt(k,L){ti(k);let H=[];if(typeof L=="string")Ti(k,L)&&(H=H.concat(k.g.get(Ss(k,L))));else for(k=Array.from(k.g.values()),L=0;L0?String(k[0]):L):L};function Sn(k,L,H){ea(k,L),H.length>0&&(k.i=null,k.g.set(Ss(k,L),A(H)),k.h+=H.length)}e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const k=[],L=Array.from(this.g.keys());for(let ne=0;ne{ne.abort(),us(H,"TestPingServer: timeout",!1,L)},1e4);fetch(k,{signal:ne.signal}).then(Ue=>{clearTimeout(Ee),Ue.ok?us(H,"TestPingServer: ok",!0,L):us(H,"TestPingServer: server error",!1,L)}).catch(()=>{clearTimeout(Ee),us(H,"TestPingServer: error",!1,L)})}function us(k,L,H,ne,Ee){try{Ee&&(Ee.onload=null,Ee.onerror=null,Ee.onabort=null,Ee.ontimeout=null),ne(H)}catch{}}function gi(){this.g=new hn}function vs(k){this.i=k.Sb||null,this.h=k.ab||!1}y(vs,en),vs.prototype.g=function(){return new Ds(this.i,this.h)};function Ds(k,L){Xe.call(this),this.H=k,this.o=L,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}y(Ds,Xe),e=Ds.prototype,e.open=function(k,L){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=k,this.D=L,this.readyState=1,Qr(this)},e.send=function(k){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const L={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};k&&(L.body=k),(this.H||o).fetch(new Request(this.D,L)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,Ya(this)),this.readyState=0},e.Pa=function(k){if(this.g&&(this.l=k,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=k.headers,this.readyState=2,Qr(this)),this.g&&(this.readyState=3,Qr(this),this.g)))if(this.responseType==="arraybuffer")k.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in k){if(this.j=k.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;Rr(this)}else k.text().then(this.Oa.bind(this),this.ga.bind(this))};function Rr(k){k.j.read().then(k.Ma.bind(k)).catch(k.ga.bind(k))}e.Ma=function(k){if(this.g){if(this.o&&k.value)this.response.push(k.value);else if(!this.o){var L=k.value?k.value:new Uint8Array(0);(L=this.B.decode(L,{stream:!k.done}))&&(this.response=this.responseText+=L)}k.done?Ya(this):Qr(this),this.readyState==3&&Rr(this)}},e.Oa=function(k){this.g&&(this.response=this.responseText=k,Ya(this))},e.Na=function(k){this.g&&(this.response=k,Ya(this))},e.ga=function(){this.g&&Ya(this)};function Ya(k){k.readyState=4,k.l=null,k.j=null,k.B=null,Qr(k)}e.setRequestHeader=function(k,L){this.A.append(k,L)},e.getResponseHeader=function(k){return this.h&&this.h.get(k.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const k=[],L=this.h.entries();for(var H=L.next();!H.done;)H=H.value,k.push(H[0]+": "+H[1]),H=L.next();return k.join(`\r `)};function Qr(k){k.onreadystatechange&&k.onreadystatechange.call(k)}Object.defineProperty(Ds.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(k){this.m=k?"include":"same-origin"}});function Rn(k){let L="";return Ve(k,function(H,ne){L+=ne,L+=":",L+=H,L+=`\r `}),L}function Pa(k,L,H){e:{for(ne in H){var ne=!1;break e}ne=!0}ne||(H=Rn(H),typeof k=="string"?H!=null&&Oe(H):ze(k,L,H))}function ri(k){Xe.call(this),this.headers=new Map,this.L=k||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}y(ri,Xe);var fa=/^https?$/i,pa=["POST","PUT"];e=ri.prototype,e.Fa=function(k){this.H=k},e.ea=function(k,L,H,ne){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+k);L=L?L.toUpperCase():"GET",this.D=k,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Or.g(),this.g.onreadystatechange=w(f(this.Ca,this));try{this.B=!0,this.g.open(L,String(k),!0),this.B=!1}catch(Ue){yl(this,Ue);return}if(k=H||"",H=new Map(this.headers),ne)if(Object.getPrototypeOf(ne)===Object.prototype)for(var Ee in ne)H.set(Ee,ne[Ee]);else if(typeof ne.keys=="function"&&typeof ne.get=="function")for(const Ue of ne.keys())H.set(Ue,ne.get(Ue));else throw Error("Unknown input type for opt_headers: "+String(ne));ne=Array.from(H.keys()).find(Ue=>Ue.toLowerCase()=="content-type"),Ee=o.FormData&&k instanceof o.FormData,!(Array.prototype.indexOf.call(pa,L,void 0)>=0)||ne||Ee||H.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[Ue,wt]of H)this.g.setRequestHeader(Ue,wt);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(k),this.v=!1}catch(Ue){yl(this,Ue)}};function yl(k,L){k.h=!1,k.g&&(k.j=!0,k.g.abort(),k.j=!1),k.l=L,k.o=5,Oa(k),ds(k)}function Oa(k){k.A||(k.A=!0,Xt(k,"complete"),Xt(k,"error"))}e.abort=function(k){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=k||7,Xt(this,"complete"),Xt(this,"abort"),ds(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),ds(this,!0)),ri.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?Ra(this):this.Xa())},e.Xa=function(){Ra(this)};function Ra(k){if(k.h&&typeof a<"u"){if(k.v&&ta(k)==4)setTimeout(k.Ca.bind(k),0);else if(Xt(k,"readystatechange"),ta(k)==4){k.h=!1;try{const Ue=k.ca();e:switch(Ue){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var L=!0;break e;default:L=!1}var H;if(!(H=L)){var ne;if(ne=Ue===0){let wt=String(k.D).match(an)[1]||null;!wt&&o.self&&o.self.location&&(wt=o.self.location.protocol.slice(0,-1)),ne=!fa.test(wt?wt.toLowerCase():"")}H=ne}if(H)Xt(k,"complete"),Xt(k,"success");else{k.o=6;try{var Ee=ta(k)>2?k.g.statusText:""}catch{Ee=""}k.l=Ee+" ["+k.ca()+"]",Oa(k)}}finally{ds(k)}}}}function ds(k,L){if(k.g){k.m&&(clearTimeout(k.m),k.m=null);const H=k.g;k.g=null,L||Xt(k,"ready");try{H.onreadystatechange=null}catch{}}}e.isActive=function(){return!!this.g};function ta(k){return k.g?k.g.readyState:0}e.ca=function(){try{return ta(this)>2?this.g.status:-1}catch{return-1}},e.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},e.La=function(k){if(this.g){var L=this.g.responseText;return k&&L.indexOf(k)==0&&(L=L.substring(k.length)),fr(L)}};function wi(k){try{if(!k.g)return null;if("response"in k.g)return k.g.response;switch(k.F){case"":case"text":return k.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in k.g)return k.g.mozResponseArrayBuffer}return null}catch{return null}}function Cs(k){const L={};k=(k.g&&ta(k)>=2&&k.g.getAllResponseHeaders()||"").split(`\r `);for(let ne=0;ne0&&(this.ia=k.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}e=ho.prototype,e.ka=8,e.I=1,e.connect=function(k,L,H,ne){pr(0),this.W=k,this.H=L||{},H&&ne!==void 0&&(this.H.OSID=H,this.H.OAID=ne),this.F=this.X,this.J=Me(this,null,this.W),ra(this)};function Ql(k){if(Ko(k),k.I==3){var L=k.V++,H=at(k.J);if(ze(H,"SID",k.M),ze(H,"RID",L),ze(H,"TYPE","terminate"),po(k,H),L=new ft(k,k.j,L),L.M=2,L.A=Bt(at(H)),H=!1,o.navigator&&o.navigator.sendBeacon)try{H=o.navigator.sendBeacon(L.A.toString(),"")}catch{}!H&&o.Image&&(new Image().src=L.A,H=!0),H||(L.g=Ke(L.j,null),L.g.ea(L.A)),L.F=Date.now(),cs(L)}we(k)}function fo(k){k.g&&(it(k),k.g.cancel(),k.g=null)}function Ko(k){fo(k),k.v&&(o.clearTimeout(k.v),k.v=null),Pi(k),k.h.cancel(),k.m&&(typeof k.m=="number"&&o.clearTimeout(k.m),k.m=null)}function ra(k){if(!ha(k.h)&&!k.m){k.m=!0;var L=k.Ea;X||z(),q||(X(),q=!0),B.add(L,k),k.D=0}}function Yo(k,L){return Un(k.h)>=k.h.j-(k.m?1:0)?!1:k.m?(k.i=L.G.concat(k.i),!0):k.I==1||k.I==2||k.D>=(k.Sa?0:k.Ta)?!1:(k.m=ln(f(k.Ea,k,L),vl(k,k.D)),k.D++,!0)}e.Ea=function(k){if(this.m)if(this.m=null,this.I==1){if(!k){this.V=Math.floor(Math.random()*1e5),k=this.V++;const Ee=new ft(this,this.j,k);let Ue=this.o;if(this.U&&(Ue?(Ue=se(Ue),ae(Ue,this.U)):Ue=this.U),this.u!==null||this.R||(Ee.J=Ue,Ue=null),this.S)e:{for(var L=0,H=0;H4096){L=H;break e}if(L===4096||H===this.i.length-1){L=H+1;break e}}L=1e3}else L=1e3;L=bl(this,Ee,L),H=at(this.J),ze(H,"RID",k),ze(H,"CVER",22),this.G&&ze(H,"X-HTTP-Session-Id",this.G),po(this,H),Ue&&(this.R?L="headers="+Oe(Rn(Ue))+"&"+L:this.u&&Pa(H,this.u,Ue)),Wa(this.h,Ee),this.Ra&&ze(H,"TYPE","init"),this.S?(ze(H,"$req",L),ze(H,"SID","null"),Ee.U=!0,mn(Ee,H,null)):mn(Ee,H,L),this.I=2}}else this.I==3&&(k?Dn(this,k):this.i.length==0||ha(this.h)||Dn(this))};function Dn(k,L){var H;L?H=L.l:H=k.V++;const ne=at(k.J);ze(ne,"SID",k.M),ze(ne,"RID",H),ze(ne,"AID",k.K),po(k,ne),k.u&&k.o&&Pa(ne,k.u,k.o),H=new ft(k,k.j,H,k.D+1),k.u===null&&(H.J=k.o),L&&(k.i=L.G.concat(k.i)),L=bl(k,H,1e3),H.H=Math.round(k.va*.5)+Math.round(k.va*.5*Math.random()),Wa(k.h,H),mn(H,ne,L)}function po(k,L){k.H&&Ve(k.H,function(H,ne){ze(L,ne,H)}),k.l&&Ve({},function(H,ne){ze(L,ne,H)})}function bl(k,L,H){H=Math.min(k.i.length,H);const ne=k.l?f(k.l.Ka,k.l,k):null;e:{var Ee=k.i;let xr=-1;for(;;){const mt=["count="+H];xr==-1?H>0?(xr=Ee[0].g,mt.push("ofs="+xr)):xr=0:mt.push("ofs="+xr);let Vt=!0;for(let $r=0;$r=3?!1:(k.Y++,k.v=ln(f(k.Da,k),vl(k,k.A)),k.A++,!0)}e.Da=function(){if(this.v=null,Zr(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var k=4*this.T;this.j.info("BP detection timer enabled: "+k),this.B=ln(f(this.Wa,this),k)}},e.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,pr(10),fo(this),Zr(this))};function it(k){k.B!=null&&(o.clearTimeout(k.B),k.B=null)}function Zr(k){k.g=new ft(k,k.j,"rpc",k.Y),k.u===null&&(k.g.J=k.o),k.g.P=0;var L=at(k.na);ze(L,"RID","rpc"),ze(L,"SID",k.M),ze(L,"AID",k.K),ze(L,"CI",k.F?"0":"1"),!k.F&&k.ia&&ze(L,"TO",k.ia),ze(L,"TYPE","xmlhttp"),po(k,L),k.u&&k.o&&Pa(L,k.u,k.o),k.O&&(k.g.H=k.O);var H=k.g;k=k.ba,H.M=1,H.A=Bt(at(L)),H.u=null,H.R=!0,fi(H,k)}e.Va=function(){this.C!=null&&(this.C=null,fo(this),Xa(this),pr(19))};function Pi(k){k.C!=null&&(o.clearTimeout(k.C),k.C=null)}function Qa(k,L){var H=null;if(k.g==L){Pi(k),it(k),k.g=null;var ne=2}else if(ts(k.h,L))H=L.G,En(k.h,L),ne=1;else return;if(k.I!=0){if(L.o)if(ne==1){H=L.u?L.u.length:0,L=Date.now()-L.F;var Ee=k.D;ne=yr(),Xt(ne,new br(ne,H)),ra(k)}else ma(k);else if(Ee=L.m,Ee==3||Ee==0&&L.X>0||!(ne==1&&Yo(k,L)||ne==2&&Xa(k)))switch(H&&H.length>0&&(L=k.h,L.i=L.i.concat(H)),Ee){case 1:ge(k,5);break;case 4:ge(k,10);break;case 3:ge(k,6);break;default:ge(k,2)}}}function vl(k,L){let H=k.Qa+Math.floor(Math.random()*k.Za);return k.isActive()||(H*=2),H*L}function ge(k,L){if(k.j.info("Error code "+L),L==2){var H=f(k.bb,k),ne=k.Ua;const Ee=!ne;ne=new ht(ne||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||Et(ne,"https"),Bt(ne),Ee?bs(ne.toString(),H):Ka(ne.toString(),H)}else pr(2);k.I=0,k.l&&k.l.pa(L),we(k),Ko(k)}e.bb=function(k){k?(this.j.info("Successfully pinged google.com"),pr(2)):(this.j.info("Failed to ping google.com"),pr(1))};function we(k){if(k.I=0,k.ja=[],k.l){const L=jn(k.h);(L.length!=0||k.i.length!=0)&&(S(k.ja,L),S(k.ja,k.i),k.h.i.length=0,A(k.i),k.i.length=0),k.l.oa()}}function Me(k,L,H){var ne=H instanceof ht?at(H):new ht(H);if(ne.g!="")L&&(ne.g=L+"."+ne.g),rr(ne,ne.u);else{var Ee=o.location;ne=Ee.protocol,L=L?L+"."+Ee.hostname:Ee.hostname,Ee=+Ee.port;const Ue=new ht(null);ne&&Et(Ue,ne),L&&(Ue.g=L),Ee&&rr(Ue,Ee),H&&(Ue.h=H),ne=Ue}return H=k.G,L=k.wa,H&&L&&ze(ne,H,L),ze(ne,"VER",k.ka),po(k,ne),ne}function Ke(k,L,H){if(L&&!k.L)throw Error("Can't create secondary domain capable XhrIo object.");return L=k.Aa&&!k.ma?new ri(new vs({ab:H})):new ri(k.ma),L.Fa(k.L),L}e.isActive=function(){return!!this.l&&this.l.isActive(this)};function Je(){}e=Je.prototype,e.ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){};function lt(){}lt.prototype.g=function(k,L){return new yt(k,L)};function yt(k,L){Xe.call(this),this.g=new ho(L),this.l=k,this.h=L&&L.messageUrlParams||null,k=L&&L.messageHeaders||null,L&&L.clientProtocolHeaderRequired&&(k?k["X-Client-Protocol"]="webchannel":k={"X-Client-Protocol":"webchannel"}),this.g.o=k,k=L&&L.initMessageHeaders||null,L&&L.messageContentType&&(k?k["X-WebChannel-Content-Type"]=L.messageContentType:k={"X-WebChannel-Content-Type":L.messageContentType}),L&&L.sa&&(k?k["X-WebChannel-Client-Profile"]=L.sa:k={"X-WebChannel-Client-Profile":L.sa}),this.g.U=k,(k=L&&L.Qb)&&!K(k)&&(this.g.u=k),this.A=L&&L.supportsCrossDomainXhr||!1,this.v=L&&L.sendRawJson||!1,(L=L&&L.httpSessionIdParam)&&!K(L)&&(this.g.G=L,k=this.h,k!==null&&L in k&&(k=this.h,L in k&&delete k[L])),this.j=new Kt(this)}y(yt,Xe),yt.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},yt.prototype.close=function(){Ql(this.g)},yt.prototype.o=function(k){var L=this.g;if(typeof k=="string"){var H={};H.__data__=k,k=H}else this.v&&(H={},H.__data__=nr(k),k=H);L.i.push(new ci(L.Ya++,k)),L.I==3&&ra(L)},yt.prototype.N=function(){this.g.l=null,delete this.j,Ql(this.g),delete this.g,yt.Z.N.call(this)};function er(k){be.call(this),k.__headers__&&(this.headers=k.__headers__,this.statusCode=k.__status__,delete k.__headers__,delete k.__status__);var L=k.__sm__;if(L){e:{for(const H in L){k=H;break e}k=void 0}(this.i=k)&&(k=this.i,L=L!==null&&k in L?L[k]:void 0),this.data=L}else this.data=k}y(er,be);function lr(){Pe.call(this),this.status=1}y(lr,Pe);function Kt(k){this.g=k}y(Kt,Je),Kt.prototype.ra=function(){Xt(this.g,"a")},Kt.prototype.qa=function(k){Xt(this.g,new er(k))},Kt.prototype.pa=function(k){Xt(this.g,new lr)},Kt.prototype.oa=function(){Xt(this.g,"b")},lt.prototype.createWebChannel=lt.prototype.g,yt.prototype.send=yt.prototype.o,yt.prototype.open=yt.prototype.m,yt.prototype.close=yt.prototype.close,w$=function(){return new lt},v$=function(){return yr()},b$=$e,ZS={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},Cr.NO_ERROR=0,Cr.TIMEOUT=8,Cr.HTTP_ERROR=6,kw=Cr,xt.COMPLETE="complete",y$=xt,Ci.EventType=Gr,Gr.OPEN="a",Gr.CLOSE="b",Gr.ERROR="c",Gr.MESSAGE="d",Xe.prototype.listen=Xe.prototype.J,N1=Ci,ri.prototype.listenOnce=ri.prototype.K,ri.prototype.getLastError=ri.prototype.Ha,ri.prototype.getLastErrorCode=ri.prototype.ya,ri.prototype.getStatus=ri.prototype.ca,ri.prototype.getResponseJson=ri.prototype.La,ri.prototype.getResponseText=ri.prototype.la,ri.prototype.send=ri.prototype.ea,ri.prototype.setWithCredentials=ri.prototype.Fa,x$=ri}).apply(typeof Tv<"u"?Tv:typeof self<"u"?self:typeof window<"u"?window:{});/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class wo{constructor(t){this.uid=t}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}wo.UNAUTHENTICATED=new wo(null),wo.GOOGLE_CREDENTIALS=new wo("google-credentials-uid"),wo.FIRST_PARTY=new wo("first-party-uid"),wo.MOCK_USER=new wo("mock-user");/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let Bg="12.11.0";function Xle(e){Bg=e}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Qp=new wI("@firebase/firestore");function I0(){return Qp.logLevel}function $t(e,...t){if(Qp.logLevel<=oi.DEBUG){const r=t.map(RI);Qp.debug(`Firestore (${Bg}): ${e}`,...r)}}function Qs(e,...t){if(Qp.logLevel<=oi.ERROR){const r=t.map(RI);Qp.error(`Firestore (${Bg}): ${e}`,...r)}}function ag(e,...t){if(Qp.logLevel<=oi.WARN){const r=t.map(RI);Qp.warn(`Firestore (${Bg}): ${e}`,...r)}}function RI(e){if(typeof e=="string")return e;try{return(function(r){return JSON.stringify(r)})(e)}catch{return e}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Tr(e,t,r){let n="Unexpected state";typeof t=="string"?n=t:r=t,N$(e,n,r)}function N$(e,t,r){let n=`FIRESTORE (${Bg}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(r!==void 0)try{n+=" CONTEXT: "+JSON.stringify(r)}catch{n+=" CONTEXT: "+r}throw Qs(n),new Error(n)}function Yr(e,t,r,n){let i="Unexpected state";typeof r=="string"?i=r:n=r,e||N$(t,i,n)}function Vr(e,t){return e}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const bt={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class tr extends Kd{constructor(t,r){super(t,r),this.code=t,this.message=r,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Gc{constructor(){this.promise=new Promise(((t,r)=>{this.resolve=t,this.reject=r}))}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Qle{constructor(t,r){this.user=r,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Zle{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,r){t.enqueueRetryable((()=>r(wo.UNAUTHENTICATED)))}shutdown(){}}class Jle{constructor(t){this.t=t,this.currentUser=wo.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,r){Yr(this.o===void 0,42304);let n=this.i;const i=h=>this.i!==n?(n=this.i,r(h)):Promise.resolve();let a=new Gc;this.o=()=>{this.i++,this.currentUser=this.u(),a.resolve(),a=new Gc,t.enqueueRetryable((()=>i(this.currentUser)))};const o=()=>{const h=a;t.enqueueRetryable((async()=>{await h.promise,await i(this.currentUser)}))},c=h=>{$t("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=h,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit((h=>c(h))),setTimeout((()=>{if(!this.auth){const h=this.t.getImmediate({optional:!0});h?c(h):($t("FirebaseAuthCredentialsProvider","Auth not yet detected"),a.resolve(),a=new Gc)}}),0),o()}getToken(){const t=this.i,r=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(r).then((n=>this.i!==t?($t("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):n?(Yr(typeof n.accessToken=="string",31837,{l:n}),new Qle(n.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const t=this.auth&&this.auth.getUid();return Yr(t===null||typeof t=="string",2055,{h:t}),new wo(t)}}class ece{constructor(t,r,n){this.P=t,this.T=r,this.I=n,this.type="FirstParty",this.user=wo.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);const t=this.A();return t&&this.R.set("Authorization",t),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}}class tce{constructor(t,r,n){this.P=t,this.T=r,this.I=n}getToken(){return Promise.resolve(new ece(this.P,this.T,this.I))}start(t,r){t.enqueueRetryable((()=>r(wo.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class DR{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class rce{constructor(t,r){this.V=r,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Ml(t)&&t.settings.appCheckToken&&(this.p=t.settings.appCheckToken)}start(t,r){Yr(this.o===void 0,3512);const n=a=>{a.error!=null&&$t("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${a.error.message}`);const o=a.token!==this.m;return this.m=a.token,$t("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?r(a.token):Promise.resolve()};this.o=a=>{t.enqueueRetryable((()=>n(a)))};const i=a=>{$t("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=a,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((a=>i(a))),setTimeout((()=>{if(!this.appCheck){const a=this.V.getImmediate({optional:!0});a?i(a):$t("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new DR(this.p));const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((r=>r?(Yr(typeof r.token=="string",44558,{tokenResult:r}),this.m=r.token,new DR(r.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function nce(e){const t=typeof self<"u"&&(self.crypto||self.msCrypto),r=new Uint8Array(e);if(t&&typeof t.getRandomValues=="function")t.getRandomValues(r);else for(let n=0;nt?1:0}function JS(e,t){const r=Math.min(e.length,t.length);for(let n=0;n=ice&&t<=sce}function og(e,t,r){return e.length===t.length&&e.every(((n,i)=>r(n,t[i])))}function E$(e){return e+"\0"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const MR="__name__";class Nu{constructor(t,r,n){r===void 0?r=0:r>t.length&&Tr(637,{offset:r,range:t.length}),n===void 0?n=t.length-r:n>t.length-r&&Tr(1746,{length:n,range:t.length-r}),this.segments=t,this.offset=r,this.len=n}get length(){return this.len}isEqual(t){return Nu.comparator(this,t)===0}child(t){const r=this.segments.slice(this.offset,this.limit());return t instanceof Nu?t.forEach((n=>{r.push(n)})):r.push(t),this.construct(r)}limit(){return this.offset+this.length}popFirst(t){return t=t===void 0?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return this.length===0}isPrefixOf(t){if(t.length=0)throw new tr(bt.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);r.push(...n.split("/").filter((i=>i.length>0)))}return new ki(r)}static emptyPath(){return new ki([])}}const ace=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Os extends Nu{construct(t,r,n){return new Os(t,r,n)}static isValidIdentifier(t){return ace.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Os.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===MR}static keyField(){return new Os([MR])}static fromServerFormat(t){const r=[];let n="",i=0;const a=()=>{if(n.length===0)throw new tr(bt.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);r.push(n),n=""};let o=!1;for(;i=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return t!==null&&ki.comparator(this.path,t.path)===0}toString(){return this.path.toString()}static comparator(t,r){return ki.comparator(t.path,r.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new hr(new ki(t.slice()))}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function MI(e,t,r){if(!r)throw new tr(bt.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function oce(e,t,r,n){if(t===!0&&n===!0)throw new tr(bt.INVALID_ARGUMENT,`${e} and ${r} cannot be used together.`)}function LR(e){if(!hr.isDocumentKey(e))throw new tr(bt.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function UR(e){if(hr.isDocumentKey(e))throw new tr(bt.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function A$(e){return typeof e=="object"&&e!==null&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function oE(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return""+e;if(typeof e=="object"){if(e instanceof Array)return"an array";{const t=(function(n){return n.constructor?n.constructor.name:null})(e);return t?`a custom ${t} object`:"an object"}}return typeof e=="function"?"a function":Tr(12329,{type:typeof e})}function $o(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new tr(bt.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const r=oE(e);throw new tr(bt.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${r}`)}}return e}function lce(e,t){if(t<=0)throw new tr(bt.INVALID_ARGUMENT,`Function ${e}() requires a positive number, but it was: ${t}.`)}/** * @license * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ua(e,t){const r={typeString:e};return t&&(r.value=t),r}function qy(e,t){if(!A$(e))throw new tr(bt.INVALID_ARGUMENT,"JSON must be an object");let r;for(const n in t)if(t[n]){const i=t[n].typeString,a="value"in t[n]?{value:t[n].value}:void 0;if(!(n in e)){r=`JSON missing required field: '${n}'`;break}const o=e[n];if(i&&typeof o!==i){r=`JSON field '${n}' must be a ${i}.`;break}if(a!==void 0&&o!==a.value){r=`Expected '${n}' field to equal '${a.value}'`;break}}if(r)throw new tr(bt.INVALID_ARGUMENT,r);return!0}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const BR=-62135596800,zR=1e6;class wn{static now(){return wn.fromMillis(Date.now())}static fromDate(t){return wn.fromMillis(t.getTime())}static fromMillis(t){const r=Math.floor(t/1e3),n=Math.floor((t-1e3*r)*zR);return new wn(r,n)}constructor(t,r){if(this.seconds=t,this.nanoseconds=r,r<0)throw new tr(bt.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(r>=1e9)throw new tr(bt.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(t=253402300800)throw new tr(bt.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/zR}_compareTo(t){return this.seconds===t.seconds?kn(this.nanoseconds,t.nanoseconds):kn(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:wn._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(qy(t,wn._jsonSchema))return new wn(t.seconds,t.nanoseconds)}valueOf(){const t=this.seconds-BR;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}wn._jsonSchemaVersion="firestore/timestamp/1.0",wn._jsonSchema={type:ua("string",wn._jsonSchemaVersion),seconds:ua("number"),nanoseconds:ua("number")};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class sn{static fromTimestamp(t){return new sn(t)}static min(){return new sn(new wn(0,0))}static max(){return new sn(new wn(253402300799,999999999))}constructor(t){this.timestamp=t}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const lg=-1;class d2{constructor(t,r,n,i){this.indexId=t,this.collectionGroup=r,this.fields=n,this.indexState=i}}function eC(e){return e.fields.find((t=>t.kind===2))}function ap(e){return e.fields.filter((t=>t.kind!==2))}d2.UNKNOWN_ID=-1;class _w{constructor(t,r){this.fieldPath=t,this.kind=r}}class oy{constructor(t,r){this.sequenceNumber=t,this.offset=r}static empty(){return new oy(0,ql.min())}}function k$(e,t){const r=e.toTimestamp().seconds,n=e.toTimestamp().nanoseconds+1,i=sn.fromTimestamp(n===1e9?new wn(r+1,0):new wn(r,n));return new ql(i,hr.empty(),t)}function _$(e){return new ql(e.readTime,e.key,lg)}class ql{constructor(t,r,n){this.readTime=t,this.documentKey=r,this.largestBatchId=n}static min(){return new ql(sn.min(),hr.empty(),lg)}static max(){return new ql(sn.max(),hr.empty(),lg)}}function LI(e,t){let r=e.readTime.compareTo(t.readTime);return r!==0?r:(r=hr.comparator(e.documentKey,t.documentKey),r!==0?r:kn(e.largestBatchId,t.largestBatchId))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const S$="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class C${constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Sf(e){if(e.code!==bt.FAILED_PRECONDITION||e.message!==S$)throw e;$t("LocalStore","Unexpectedly lost primary lease")}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Qe{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((r=>{this.isDone=!0,this.result=r,this.nextCallback&&this.nextCallback(r)}),(r=>{this.isDone=!0,this.error=r,this.catchCallback&&this.catchCallback(r)}))}catch(t){return this.next(void 0,t)}next(t,r){return this.callbackAttached&&Tr(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(r,this.error):this.wrapSuccess(t,this.result):new Qe(((n,i)=>{this.nextCallback=a=>{this.wrapSuccess(t,a).next(n,i)},this.catchCallback=a=>{this.wrapFailure(r,a).next(n,i)}}))}toPromise(){return new Promise(((t,r)=>{this.next(t,r)}))}wrapUserFunction(t){try{const r=t();return r instanceof Qe?r:Qe.resolve(r)}catch(r){return Qe.reject(r)}}wrapSuccess(t,r){return t?this.wrapUserFunction((()=>t(r))):Qe.resolve(r)}wrapFailure(t,r){return t?this.wrapUserFunction((()=>t(r))):Qe.reject(r)}static resolve(t){return new Qe(((r,n)=>{r(t)}))}static reject(t){return new Qe(((r,n)=>{n(t)}))}static waitFor(t){return new Qe(((r,n)=>{let i=0,a=0,o=!1;t.forEach((c=>{++i,c.next((()=>{++a,o&&a===i&&r()}),(h=>n(h)))})),o=!0,a===i&&r()}))}static or(t){let r=Qe.resolve(!1);for(const n of t)r=r.next((i=>i?Qe.resolve(i):n()));return r}static forEach(t,r){const n=[];return t.forEach(((i,a)=>{n.push(r.call(this,i,a))})),this.waitFor(n)}static mapArray(t,r){return new Qe(((n,i)=>{const a=t.length,o=new Array(a);let c=0;for(let h=0;h{o[f]=m,++c,c===a&&n(o)}),(m=>i(m)))}}))}static doWhile(t,r){return new Qe(((n,i)=>{const a=()=>{t()===!0?r().next((()=>{a()}),i):n()};a()}))}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Dl="SimpleDb";class lE{static open(t,r,n,i){try{return new lE(r,t.transaction(i,n))}catch(a){throw new M1(r,a)}}constructor(t,r){this.action=t,this.transaction=r,this.aborted=!1,this.S=new Gc,this.transaction.oncomplete=()=>{this.S.resolve()},this.transaction.onabort=()=>{r.error?this.S.reject(new M1(t,r.error)):this.S.resolve()},this.transaction.onerror=n=>{const i=UI(n.target.error);this.S.reject(new M1(t,i))}}get D(){return this.S.promise}abort(t){t&&this.S.reject(t),this.aborted||($t(Dl,"Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}C(){const t=this.transaction;this.aborted||typeof t.commit!="function"||t.commit()}store(t){const r=this.transaction.objectStore(t);return new uce(r)}}class hf{static delete(t){return $t(Dl,"Removing database:",t),fp(NF().indexedDB.deleteDatabase(t)).toPromise()}static v(){if(!CF())return!1;if(hf.F())return!0;const t=_a(),r=hf.M(t),n=00||t.indexOf("Trident/")>0||t.indexOf("Edge/")>0||n||a)}static F(){var t;return typeof process<"u"&&((t=process.__PRIVATE_env)==null?void 0:t.__PRIVATE_USE_MOCK_PERSISTENCE)==="YES"}static O(t,r){return t.store(r)}static M(t){const r=t.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=r?r[1].split("_").slice(0,2).join("."):"-1";return Number(n)}constructor(t,r,n){this.name=t,this.version=r,this.N=n,this.B=null,hf.M(_a())===12.2&&Qs("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}async L(t){return this.db||($t(Dl,"Opening database:",this.name),this.db=await new Promise(((r,n)=>{const i=indexedDB.open(this.name,this.version);i.onsuccess=a=>{const o=a.target.result;r(o)},i.onblocked=()=>{n(new M1(t,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=a=>{const o=a.target.error;o.name==="VersionError"?n(new tr(bt.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):o.name==="InvalidStateError"?n(new tr(bt.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+o)):n(new M1(t,o))},i.onupgradeneeded=a=>{$t(Dl,'Database "'+this.name+'" requires upgrade from version:',a.oldVersion);const o=a.target.result;this.N.k(o,i.transaction,a.oldVersion,this.version).next((()=>{$t(Dl,"Database upgrade to version "+this.version+" complete")}))}}))),this.q&&(this.db.onversionchange=r=>this.q(r)),this.db}K(t){this.q=t,this.db&&(this.db.onversionchange=r=>t(r))}async runTransaction(t,r,n,i){const a=r==="readonly";let o=0;for(;;){++o;try{this.db=await this.L(t);const c=lE.open(this.db,t,a?"readonly":"readwrite",n),h=i(c).next((f=>(c.C(),f))).catch((f=>(c.abort(f),Qe.reject(f)))).toPromise();return h.catch((()=>{})),await c.D,h}catch(c){const h=c,f=h.name!=="FirebaseError"&&o<3;if($t(Dl,"Transaction failed with error:",h.message,"Retrying:",f),this.close(),!f)return Promise.reject(h)}}}close(){this.db&&this.db.close(),this.db=void 0}}function j$(e){const t=e.match(/Android ([\d.]+)/i),r=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(r)}class cce{constructor(t){this.U=t,this.$=!1,this.W=null}get isDone(){return this.$}get G(){return this.W}set cursor(t){this.U=t}done(){this.$=!0}j(t){this.W=t}delete(){return fp(this.U.delete())}}class M1 extends tr{constructor(t,r){super(bt.UNAVAILABLE,`IndexedDB transaction '${t}' failed: ${r}`),this.name="IndexedDbTransactionError"}}function Cf(e){return e.name==="IndexedDbTransactionError"}class uce{constructor(t){this.store=t}put(t,r){let n;return r!==void 0?($t(Dl,"PUT",this.store.name,t,r),n=this.store.put(r,t)):($t(Dl,"PUT",this.store.name,"",t),n=this.store.put(t)),fp(n)}add(t){return $t(Dl,"ADD",this.store.name,t,t),fp(this.store.add(t))}get(t){return fp(this.store.get(t)).next((r=>(r===void 0&&(r=null),$t(Dl,"GET",this.store.name,t,r),r)))}delete(t){return $t(Dl,"DELETE",this.store.name,t),fp(this.store.delete(t))}count(){return $t(Dl,"COUNT",this.store.name),fp(this.store.count())}J(t,r){const n=this.options(t,r),i=n.index?this.store.index(n.index):this.store;if(typeof i.getAll=="function"){const a=i.getAll(n.range);return new Qe(((o,c)=>{a.onerror=h=>{c(h.target.error)},a.onsuccess=h=>{o(h.target.result)}}))}{const a=this.cursor(n),o=[];return this.H(a,((c,h)=>{o.push(h)})).next((()=>o))}}Z(t,r){const n=this.store.getAll(t,r===null?void 0:r);return new Qe(((i,a)=>{n.onerror=o=>{a(o.target.error)},n.onsuccess=o=>{i(o.target.result)}}))}X(t,r){$t(Dl,"DELETE ALL",this.store.name);const n=this.options(t,r);n.Y=!1;const i=this.cursor(n);return this.H(i,((a,o,c)=>c.delete()))}ee(t,r){let n;r?n=t:(n={},r=t);const i=this.cursor(n);return this.H(i,r)}te(t){const r=this.cursor({});return new Qe(((n,i)=>{r.onerror=a=>{const o=UI(a.target.error);i(o)},r.onsuccess=a=>{const o=a.target.result;o?t(o.primaryKey,o.value).next((c=>{c?o.continue():n()})):n()}}))}H(t,r){const n=[];return new Qe(((i,a)=>{t.onerror=o=>{a(o.target.error)},t.onsuccess=o=>{const c=o.target.result;if(!c)return void i();const h=new cce(c),f=r(c.primaryKey,c.value,h);if(f instanceof Qe){const m=f.catch((y=>(h.done(),Qe.reject(y))));n.push(m)}h.isDone?i():h.G===null?c.continue():c.continue(h.G)}})).next((()=>Qe.waitFor(n)))}options(t,r){let n;return t!==void 0&&(typeof t=="string"?n=t:r=t),{index:n,range:r}}cursor(t){let r="next";if(t.reverse&&(r="prev"),t.index){const n=this.store.index(t.index);return t.Y?n.openKeyCursor(t.range,r):n.openCursor(t.range,r)}return this.store.openCursor(t.range,r)}}function fp(e){return new Qe(((t,r)=>{e.onsuccess=n=>{const i=n.target.result;t(i)},e.onerror=n=>{const i=UI(n.target.error);r(i)}}))}let VR=!1;function UI(e){const t=hf.M(_a());if(t>=12.2&&t<13){const r="An internal error was encountered in the Indexed Database server";if(e.message.indexOf(r)>=0){const n=new tr("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${r}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return VR||(VR=!0,setTimeout((()=>{throw n}),0)),n}}return e}const L1="IndexBackfiller";class dce{constructor(t,r){this.asyncQueue=t,this.ne=r,this.task=null}start(){this.re(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return this.task!==null}re(t){$t(L1,`Scheduled in ${t}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",t,(async()=>{this.task=null;try{const r=await this.ne.ie();$t(L1,`Documents written: ${r}`)}catch(r){Cf(r)?$t(L1,"Ignoring IndexedDB error during index backfill: ",r):await Sf(r)}await this.re(6e4)}))}}class hce{constructor(t,r){this.localStore=t,this.persistence=r}async ie(t=50){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",(r=>this.se(r,t)))}se(t,r){const n=new Set;let i=r,a=!0;return Qe.doWhile((()=>a===!0&&i>0),(()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(t).next((o=>{if(o!==null&&!n.has(o))return $t(L1,`Processing collection: ${o}`),this.oe(t,o,i).next((c=>{i-=c,n.add(o)}));a=!1})))).next((()=>r-i))}oe(t,r,n){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(t,r).next((i=>this.localStore.localDocuments.getNextDocuments(t,r,i,n).next((a=>{const o=a.changes;return this.localStore.indexManager.updateIndexEntries(t,o).next((()=>this._e(i,a))).next((c=>($t(L1,`Updating offset: ${c}`),this.localStore.indexManager.updateCollectionGroup(t,r,c)))).next((()=>o.size))}))))}_e(t,r){let n=t;return r.changes.forEach(((i,a)=>{const o=_$(a);LI(o,n)>0&&(n=o)})),new ql(n.readTime,n.documentKey,Math.max(r.batchId,t.largestBatchId))}}/** * @license * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class dl{constructor(t,r){this.previousValue=t,r&&(r.sequenceNumberHandler=n=>this.ae(n),this.ue=n=>r.writeSequenceNumber(n))}ae(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.ue&&this.ue(t),t}}dl.ce=-1;/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Pp=-1;function cE(e){return e==null}function ly(e){return e===0&&1/e==-1/0}function I$(e){return typeof e=="number"&&Number.isInteger(e)&&!ly(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const h2="";function Co(e){let t="";for(let r=0;r0&&(t=FR(t)),t=fce(e.get(r),t);return FR(t)}function fce(e,t){let r=t;const n=e.length;for(let i=0;i=2,64408,{path:e}),t===2)return Yr(e.charAt(0)===h2&&e.charAt(1)==="",56145,{path:e}),ki.emptyPath();const r=t-2,n=[];let i="";for(let a=0;ar)&&Tr(50515,{path:e}),e.charAt(o+1)){case"":const c=e.substring(a,o);let h;i.length===0?h=c:(i+=c,h=i,i=""),n.push(h);break;case"":i+=e.substring(a,o),i+="\0";break;case"":i+=e.substring(a,o+1);break;default:Tr(61167,{path:e})}a=o+2}return new ki(n)}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const op="remoteDocuments",Wy="owner",f0="owner",cy="mutationQueues",pce="userId",Bc="mutations",$R="batchId",wp="userMutationsIndex",HR=["userId","batchId"];/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Sw(e,t){return[e,Co(t)]}function T$(e,t,r){return[e,Co(t),r]}const mce={},cg="documentMutations",f2="remoteDocumentsV14",gce=["prefixPath","collectionGroup","readTime","documentId"],Cw="documentKeyIndex",xce=["prefixPath","collectionGroup","documentId"],P$="collectionGroupIndex",yce=["collectionGroup","readTime","prefixPath","documentId"],uy="remoteDocumentGlobal",tC="remoteDocumentGlobalKey",ug="targets",O$="queryTargetsIndex",bce=["canonicalId","targetId"],dg="targetDocuments",vce=["targetId","path"],BI="documentTargetsIndex",wce=["path","targetId"],p2="targetGlobalKey",Op="targetGlobal",dy="collectionParents",Nce=["collectionId","parent"],hg="clientMetadata",Ece="clientId",uE="bundles",Ace="bundleId",dE="namedQueries",kce="name",zI="indexConfiguration",_ce="indexId",rC="collectionGroupIndex",Sce="collectionGroup",U1="indexState",Cce=["indexId","uid"],R$="sequenceNumberIndex",jce=["uid","sequenceNumber"],B1="indexEntries",Ice=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],D$="documentKeyIndex",Tce=["indexId","uid","orderedDocumentKey"],hE="documentOverlays",Pce=["userId","collectionPath","documentId"],nC="collectionPathOverlayIndex",Oce=["userId","collectionPath","largestBatchId"],M$="collectionGroupOverlayIndex",Rce=["userId","collectionGroup","largestBatchId"],VI="globals",Dce="name",L$=[cy,Bc,cg,op,ug,Wy,Op,dg,hg,uy,dy,uE,dE],Mce=[...L$,hE],U$=[cy,Bc,cg,f2,ug,Wy,Op,dg,hg,uy,dy,uE,dE,hE],B$=U$,FI=[...B$,zI,U1,B1],Lce=FI,z$=[...FI,VI],Uce=z$;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class iC extends C${constructor(t,r){super(),this.le=t,this.currentSequenceNumber=r}}function Ca(e,t){const r=Vr(e);return hf.O(r.le,t)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function GR(e){let t=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function jf(e,t){for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t(r,e[r])}function Bce(e,t){const r=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.push(t(e[n],n,e));return r}function V$(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ls{constructor(t,r){this.comparator=t,this.root=r||so.EMPTY}insert(t,r){return new ls(this.comparator,this.root.insert(t,r,this.comparator).copy(null,null,so.BLACK,null,null))}remove(t){return new ls(this.comparator,this.root.remove(t,this.comparator).copy(null,null,so.BLACK,null,null))}get(t){let r=this.root;for(;!r.isEmpty();){const n=this.comparator(t,r.key);if(n===0)return r.value;n<0?r=r.left:n>0&&(r=r.right)}return null}indexOf(t){let r=0,n=this.root;for(;!n.isEmpty();){const i=this.comparator(t,n.key);if(i===0)return r+n.left.size;i<0?n=n.left:(r+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((r,n)=>(t(r,n),!1)))}toString(){const t=[];return this.inorderTraversal(((r,n)=>(t.push(`${r}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new Pv(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new Pv(this.root,t,this.comparator,!1)}getReverseIterator(){return new Pv(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new Pv(this.root,t,this.comparator,!0)}}class Pv{constructor(t,r,n,i){this.isReverse=i,this.nodeStack=[];let a=1;for(;!t.isEmpty();)if(a=r?n(t.key,r):1,r&&i&&(a*=-1),a<0)t=this.isReverse?t.left:t.right;else{if(a===0){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const r={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return r}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class so{constructor(t,r,n,i,a){this.key=t,this.value=r,this.color=n??so.RED,this.left=i??so.EMPTY,this.right=a??so.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,r,n,i,a){return new so(t??this.key,r??this.value,n??this.color,i??this.left,a??this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,r,n){let i=this;const a=n(t,i.key);return i=a<0?i.copy(null,null,null,i.left.insert(t,r,n),null):a===0?i.copy(null,r,null,null,null):i.copy(null,null,null,null,i.right.insert(t,r,n)),i.fixUp()}removeMin(){if(this.left.isEmpty())return so.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,r){let n,i=this;if(r(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,r),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),r(t,i.key)===0){if(i.right.isEmpty())return so.EMPTY;n=i.right.min(),i=i.copy(n.key,n.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,r))}return i.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,so.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,so.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,r)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Tr(43730,{key:this.key,value:this.value});if(this.right.isRed())throw Tr(14113,{key:this.key,value:this.value});const t=this.left.check();if(t!==this.right.check())throw Tr(27949);return t+(this.isRed()?0:1)}}so.EMPTY=null,so.RED=!0,so.BLACK=!1;so.EMPTY=new class{constructor(){this.size=0}get key(){throw Tr(57766)}get value(){throw Tr(16141)}get color(){throw Tr(16727)}get left(){throw Tr(29726)}get right(){throw Tr(36894)}copy(t,r,n,i,a){return this}insert(t,r,n){return new so(t,r)}remove(t,r){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class qi{constructor(t){this.comparator=t,this.data=new ls(this.comparator)}has(t){return this.data.get(t)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((r,n)=>(t(r),!1)))}forEachInRange(t,r){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const i=n.getNext();if(this.comparator(i.key,t[1])>=0)return;r(i.key)}}forEachWhile(t,r){let n;for(n=r!==void 0?this.data.getIteratorFrom(r):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const r=this.data.getIteratorFrom(t);return r.hasNext()?r.getNext().key:null}getIterator(){return new qR(this.data.getIterator())}getIteratorFrom(t){return new qR(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let r=this;return r.size{r=r.add(n)})),r}isEqual(t){if(!(t instanceof qi)||this.size!==t.size)return!1;const r=this.data.getIterator(),n=t.data.getIterator();for(;r.hasNext();){const i=r.getNext().key,a=n.getNext().key;if(this.comparator(i,a)!==0)return!1}return!0}toArray(){const t=[];return this.forEach((r=>{t.push(r)})),t}toString(){const t=[];return this.forEach((r=>t.push(r))),"SortedSet("+t.toString()+")"}copy(t){const r=new qi(this.comparator);return r.data=t,r}}class qR{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}function p0(e){return e.hasNext()?e.getNext():void 0}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class hl{constructor(t){this.fields=t,t.sort(Os.comparator)}static empty(){return new hl([])}unionWith(t){let r=new qi(Os.comparator);for(const n of this.fields)r=r.add(n);for(const n of t)r=r.add(n);return new hl(r.toArray())}covers(t){for(const r of this.fields)if(r.isPrefixOf(t))return!0;return!1}isEqual(t){return og(this.fields,t.fields,((r,n)=>r.isEqual(n)))}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class F$ extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const r=(function(i){try{return atob(i)}catch(a){throw typeof DOMException<"u"&&a instanceof DOMException?new F$("Invalid base64 string: "+a):a}})(t);return new Zs(r)}static fromUint8Array(t){const r=(function(i){let a="";for(let o=0;otVu(r,t)))!==void 0}function yf(e,t){if(e===t)return 0;const r=xf(e),n=xf(t);if(r!==n)return kn(r,n);switch(r){case 0:case 9007199254740991:return 0;case 1:return kn(e.booleanValue,t.booleanValue);case 2:return(function(a,o){const c=As(a.integerValue||a.doubleValue),h=As(o.integerValue||o.doubleValue);return ch?1:c===h?0:isNaN(c)?isNaN(h)?0:-1:1})(e,t);case 3:return WR(e.timestampValue,t.timestampValue);case 4:return WR(hy(e),hy(t));case 5:return JS(e.stringValue,t.stringValue);case 6:return(function(a,o){const c=Fd(a),h=Fd(o);return c.compareTo(h)})(e.bytesValue,t.bytesValue);case 7:return(function(a,o){const c=a.split("/"),h=o.split("/");for(let f=0;fi+Iw(a)),0)})(e.arrayValue);case 10:case 11:return(function(n){let i=0;return jf(n.fields,((a,o)=>{i+=a.length+Iw(o)})),i})(e.mapValue);default:throw Tr(13486,{value:e})}}function py(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function oC(e){return!!e&&"integerValue"in e}function my(e){return!!e&&"arrayValue"in e}function YR(e){return!!e&&"nullValue"in e}function XR(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function Tw(e){return!!e&&"mapValue"in e}function pE(e){var r,n;return((n=(((r=e==null?void 0:e.mapValue)==null?void 0:r.fields)||{})[HI])==null?void 0:n.stringValue)===GI}function z1(e){if(e.geoPointValue)return{geoPointValue:{...e.geoPointValue}};if(e.timestampValue&&typeof e.timestampValue=="object")return{timestampValue:{...e.timestampValue}};if(e.mapValue){const t={mapValue:{fields:{}}};return jf(e.mapValue.fields,((r,n)=>t.mapValue.fields[r]=z1(n))),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let r=0;r<(e.arrayValue.values||[]).length;++r)t.arrayValue.values[r]=z1(e.arrayValue.values[r]);return t}return{...e}}function K$(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===W$}const Y$={mapValue:{fields:{[HI]:{stringValue:GI},[fg]:{arrayValue:{}}}}};function $ce(e){return"nullValue"in e?jw:"booleanValue"in e?{booleanValue:!1}:"integerValue"in e||"doubleValue"in e?{doubleValue:NaN}:"timestampValue"in e?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in e?{stringValue:""}:"bytesValue"in e?{bytesValue:""}:"referenceValue"in e?py(Zp.empty(),hr.empty()):"geoPointValue"in e?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in e?{arrayValue:{}}:"mapValue"in e?pE(e)?Y$:{mapValue:{}}:Tr(35942,{value:e})}function Hce(e){return"nullValue"in e?{booleanValue:!1}:"booleanValue"in e?{doubleValue:NaN}:"integerValue"in e||"doubleValue"in e?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in e?{stringValue:""}:"stringValue"in e?{bytesValue:""}:"bytesValue"in e?py(Zp.empty(),hr.empty()):"referenceValue"in e?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in e?{arrayValue:{}}:"arrayValue"in e?Y$:"mapValue"in e?pE(e)?{mapValue:{}}:sf:Tr(61959,{value:e})}function QR(e,t){const r=yf(e.value,t.value);return r!==0?r:e.inclusive&&!t.inclusive?-1:!e.inclusive&&t.inclusive?1:0}function ZR(e,t){const r=yf(e.value,t.value);return r!==0?r:e.inclusive&&!t.inclusive?1:!e.inclusive&&t.inclusive?-1:0}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ao{constructor(t){this.value=t}static empty(){return new ao({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let r=this.value;for(let n=0;n{if(!r.isImmediateParentOf(c)){const h=this.getFieldsMap(r);this.applyChanges(h,n,i),n={},i=[],r=c.popLast()}o?n[c.lastSegment()]=z1(o):i.push(c.lastSegment())}));const a=this.getFieldsMap(r);this.applyChanges(a,n,i)}delete(t){const r=this.field(t.popLast());Tw(r)&&r.mapValue.fields&&delete r.mapValue.fields[t.lastSegment()]}isEqual(t){return Vu(this.value,t.value)}getFieldsMap(t){let r=this.value;r.mapValue.fields||(r.mapValue={fields:{}});for(let n=0;nt[i]=a));for(const i of n)delete t[i]}clone(){return new ao(z1(this.value))}}function X$(e){const t=[];return jf(e.fields,((r,n)=>{const i=new Os([r]);if(Tw(n)){const a=X$(n.mapValue).fields;if(a.length===0)t.push(i);else for(const o of a)t.push(i.child(o))}else t.push(i)})),new hl(t)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class qs{constructor(t,r,n,i,a,o,c){this.key=t,this.documentType=r,this.version=n,this.readTime=i,this.createTime=a,this.data=o,this.documentState=c}static newInvalidDocument(t){return new qs(t,0,sn.min(),sn.min(),sn.min(),ao.empty(),0)}static newFoundDocument(t,r,n,i){return new qs(t,1,r,sn.min(),n,i,0)}static newNoDocument(t,r){return new qs(t,2,r,sn.min(),sn.min(),ao.empty(),0)}static newUnknownDocument(t,r){return new qs(t,3,r,sn.min(),sn.min(),ao.empty(),2)}convertToFoundDocument(t,r){return!this.createTime.isEqual(sn.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=t),this.version=t,this.documentType=1,this.data=r,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=ao.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=ao.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=sn.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(t){return t instanceof qs&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new qs(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class mg{constructor(t,r){this.position=t,this.inclusive=r}}function JR(e,t,r){let n=0;for(let i=0;i":return t>0;case">=":return t>=0;default:return Tr(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Gi extends Q${constructor(t,r){super(),this.filters=t,this.op=r,this.Pe=null}static create(t,r){return new Gi(t,r)}matches(t){return gg(this)?this.filters.find((r=>!r.matches(t)))===void 0:this.filters.find((r=>r.matches(t)))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce(((t,r)=>t.concat(r.getFlattenedFilters())),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function gg(e){return e.op==="and"}function lC(e){return e.op==="or"}function qI(e){return Z$(e)&&gg(e)}function Z$(e){for(const t of e.filters)if(t instanceof Gi)return!1;return!0}function cC(e){if(e instanceof li)return e.field.canonicalString()+e.op.toString()+pg(e.value);if(qI(e))return e.filters.map((t=>cC(t))).join(",");{const t=e.filters.map((r=>cC(r))).join(",");return`${e.op}(${t})`}}function J$(e,t){return e instanceof li?(function(n,i){return i instanceof li&&n.op===i.op&&n.field.isEqual(i.field)&&Vu(n.value,i.value)})(e,t):e instanceof Gi?(function(n,i){return i instanceof Gi&&n.op===i.op&&n.filters.length===i.filters.length?n.filters.reduce(((a,o,c)=>a&&J$(o,i.filters[c])),!0):!1})(e,t):void Tr(19439)}function eH(e,t){const r=e.filters.concat(t);return Gi.create(r,e.op)}function tH(e){return e instanceof li?(function(r){return`${r.field.canonicalString()} ${r.op} ${pg(r.value)}`})(e):e instanceof Gi?(function(r){return r.op.toString()+" {"+r.getFilters().map(tH).join(" ,")+"}"})(e):"Filter"}class qce extends li{constructor(t,r,n){super(t,r,n),this.key=hr.fromName(n.referenceValue)}matches(t){const r=hr.comparator(t.key,this.key);return this.matchesComparison(r)}}class Wce extends li{constructor(t,r){super(t,"in",r),this.keys=rH("in",r)}matches(t){return this.keys.some((r=>r.isEqual(t.key)))}}class Kce extends li{constructor(t,r){super(t,"not-in",r),this.keys=rH("not-in",r)}matches(t){return!this.keys.some((r=>r.isEqual(t.key)))}}function rH(e,t){var r;return(((r=t.arrayValue)==null?void 0:r.values)||[]).map((n=>hr.fromName(n.referenceValue)))}class Yce extends li{constructor(t,r){super(t,"array-contains",r)}matches(t){const r=t.data.field(this.field);return my(r)&&fy(r.arrayValue,this.value)}}class nH extends li{constructor(t,r){super(t,"in",r)}matches(t){const r=t.data.field(this.field);return r!==null&&fy(this.value.arrayValue,r)}}class Xce extends li{constructor(t,r){super(t,"not-in",r)}matches(t){if(fy(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const r=t.data.field(this.field);return r!==null&&r.nullValue===void 0&&!fy(this.value.arrayValue,r)}}class Qce extends li{constructor(t,r){super(t,"array-contains-any",r)}matches(t){const r=t.data.field(this.field);return!(!my(r)||!r.arrayValue.values)&&r.arrayValue.values.some((n=>fy(this.value.arrayValue,n)))}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Zce{constructor(t,r=null,n=[],i=[],a=null,o=null,c=null){this.path=t,this.collectionGroup=r,this.orderBy=n,this.filters=i,this.limit=a,this.startAt=o,this.endAt=c,this.Te=null}}function uC(e,t=null,r=[],n=[],i=null,a=null,o=null){return new Zce(e,t,r,n,i,a,o)}function Jp(e){const t=Vr(e);if(t.Te===null){let r=t.path.canonicalString();t.collectionGroup!==null&&(r+="|cg:"+t.collectionGroup),r+="|f:",r+=t.filters.map((n=>cC(n))).join(","),r+="|ob:",r+=t.orderBy.map((n=>(function(a){return a.field.canonicalString()+a.dir})(n))).join(","),cE(t.limit)||(r+="|l:",r+=t.limit),t.startAt&&(r+="|lb:",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map((n=>pg(n))).join(",")),t.endAt&&(r+="|ub:",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map((n=>pg(n))).join(",")),t.Te=r}return t.Te}function Ky(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let r=0;rr instanceof li&&r.field.isEqual(t)))}function tD(e,t,r){let n=jw,i=!0;for(const a of g2(e,t)){let o=jw,c=!0;switch(a.op){case"<":case"<=":o=$ce(a.value);break;case"==":case"in":case">=":o=a.value;break;case">":o=a.value,c=!1;break;case"!=":case"not-in":o=jw}QR({value:n,inclusive:i},{value:o,inclusive:c})<0&&(n=o,i=c)}if(r!==null){for(let a=0;a=":case">":o=Hce(a.value),c=!1;break;case"==":case"in":case"<=":o=a.value;break;case"<":o=a.value,c=!1;break;case"!=":case"not-in":o=sf}ZR({value:n,inclusive:i},{value:o,inclusive:c})>0&&(n=o,i=c)}if(r!==null){for(let a=0;a0&&(n=o,i=r.inclusive);break}}return{value:n,inclusive:i}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class gm{constructor(t,r=null,n=[],i=[],a=null,o="F",c=null,h=null){this.path=t,this.collectionGroup=r,this.explicitOrderBy=n,this.filters=i,this.limit=a,this.limitType=o,this.startAt=c,this.endAt=h,this.Ee=null,this.Ie=null,this.Re=null,this.startAt,this.endAt}}function iH(e,t,r,n,i,a,o,c){return new gm(e,t,r,n,i,a,o,c)}function Yy(e){return new gm(e)}function nD(e){return e.filters.length===0&&e.limit===null&&e.startAt==null&&e.endAt==null&&(e.explicitOrderBy.length===0||e.explicitOrderBy.length===1&&e.explicitOrderBy[0].field.isKeyField())}function Jce(e){return hr.isDocumentKey(e.path)&&e.collectionGroup===null&&e.filters.length===0}function sH(e){return e.collectionGroup!==null}function V1(e){const t=Vr(e);if(t.Ee===null){t.Ee=[];const r=new Set;for(const a of t.explicitOrderBy)t.Ee.push(a),r.add(a.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";(function(o){let c=new qi(Os.comparator);return o.filters.forEach((h=>{h.getFlattenedFilters().forEach((f=>{f.isInequality()&&(c=c.add(f.field))}))})),c})(t).forEach((a=>{r.has(a.canonicalString())||a.isKeyField()||t.Ee.push(new gy(a,n))})),r.has(Os.keyField().canonicalString())||t.Ee.push(new gy(Os.keyField(),n))}return t.Ee}function $l(e){const t=Vr(e);return t.Ie||(t.Ie=aH(t,V1(e))),t.Ie}function eue(e){const t=Vr(e);return t.Re||(t.Re=aH(t,e.explicitOrderBy)),t.Re}function aH(e,t){if(e.limitType==="F")return uC(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map((i=>{const a=i.dir==="desc"?"asc":"desc";return new gy(i.field,a)}));const r=e.endAt?new mg(e.endAt.position,e.endAt.inclusive):null,n=e.startAt?new mg(e.startAt.position,e.startAt.inclusive):null;return uC(e.path,e.collectionGroup,t,e.filters,e.limit,r,n)}}function dC(e,t){const r=e.filters.concat([t]);return new gm(e.path,e.collectionGroup,e.explicitOrderBy.slice(),r,e.limit,e.limitType,e.startAt,e.endAt)}function tue(e,t){const r=e.explicitOrderBy.concat([t]);return new gm(e.path,e.collectionGroup,r,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}function x2(e,t,r){return new gm(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,r,e.startAt,e.endAt)}function mE(e,t){return Ky($l(e),$l(t))&&e.limitType===t.limitType}function oH(e){return`${Jp($l(e))}|lt:${e.limitType}`}function T0(e){return`Query(target=${(function(r){let n=r.path.canonicalString();return r.collectionGroup!==null&&(n+=" collectionGroup="+r.collectionGroup),r.filters.length>0&&(n+=`, filters: [${r.filters.map((i=>tH(i))).join(", ")}]`),cE(r.limit)||(n+=", limit: "+r.limit),r.orderBy.length>0&&(n+=`, orderBy: [${r.orderBy.map((i=>(function(o){return`${o.field.canonicalString()} (${o.dir})`})(i))).join(", ")}]`),r.startAt&&(n+=", startAt: ",n+=r.startAt.inclusive?"b:":"a:",n+=r.startAt.position.map((i=>pg(i))).join(",")),r.endAt&&(n+=", endAt: ",n+=r.endAt.inclusive?"a:":"b:",n+=r.endAt.position.map((i=>pg(i))).join(",")),`Target(${n})`})($l(e))}; limitType=${e.limitType})`}function Xy(e,t){return t.isFoundDocument()&&(function(n,i){const a=i.key.path;return n.collectionGroup!==null?i.key.hasCollectionId(n.collectionGroup)&&n.path.isPrefixOf(a):hr.isDocumentKey(n.path)?n.path.isEqual(a):n.path.isImmediateParentOf(a)})(e,t)&&(function(n,i){for(const a of V1(n))if(!a.field.isKeyField()&&i.data.field(a.field)===null)return!1;return!0})(e,t)&&(function(n,i){for(const a of n.filters)if(!a.matches(i))return!1;return!0})(e,t)&&(function(n,i){return!(n.startAt&&!(function(o,c,h){const f=JR(o,c,h);return o.inclusive?f<=0:f<0})(n.startAt,V1(n),i)||n.endAt&&!(function(o,c,h){const f=JR(o,c,h);return o.inclusive?f>=0:f>0})(n.endAt,V1(n),i))})(e,t)}function lH(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function cH(e){return(t,r)=>{let n=!1;for(const i of V1(e)){const a=rue(i,t,r);if(a!==0)return a;n=n||i.field.isKeyField()}return 0}}function rue(e,t,r){const n=e.field.isKeyField()?hr.comparator(t.key,r.key):(function(a,o,c){const h=o.data.field(a),f=c.data.field(a);return h!==null&&f!==null?yf(h,f):Tr(42886)})(e.field,t,r);switch(e.dir){case"asc":return n;case"desc":return-1*n;default:return Tr(19790,{direction:e.dir})}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Xd{constructor(t,r){this.mapKeyFn=t,this.equalsFn=r,this.inner={},this.innerSize=0}get(t){const r=this.mapKeyFn(t),n=this.inner[r];if(n!==void 0){for(const[i,a]of n)if(this.equalsFn(i,t))return a}}has(t){return this.get(t)!==void 0}set(t,r){const n=this.mapKeyFn(t),i=this.inner[n];if(i===void 0)return this.inner[n]=[[t,r]],void this.innerSize++;for(let a=0;a{for(const[i,a]of n)t(i,a)}))}isEmpty(){return V$(this.inner)}size(){return this.innerSize}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const nue=new ls(hr.comparator);function Bl(){return nue}const uH=new ls(hr.comparator);function E1(...e){let t=uH;for(const r of e)t=t.insert(r.key,r);return t}function dH(e){let t=uH;return e.forEach(((r,n)=>t=t.insert(r,n.overlayedDocument))),t}function Iu(){return F1()}function hH(){return F1()}function F1(){return new Xd((e=>e.toString()),((e,t)=>e.isEqual(t)))}const iue=new ls(hr.comparator),sue=new qi(hr.comparator);function qn(...e){let t=sue;for(const r of e)t=t.add(r);return t}const aue=new qi(kn);function WI(){return aue}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function KI(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:ly(t)?"-0":t}}function fH(e){return{integerValue:""+e}}function pH(e,t){return I$(t)?fH(t):KI(e,t)}/** * @license * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class gE{constructor(){this._=void 0}}function oue(e,t,r){return e instanceof xg?(function(i,a){const o={fields:{[H$]:{stringValue:$$},[q$]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return a&&$I(a)&&(a=fE(a)),a&&(o.fields[G$]=a),{mapValue:o}})(r,t):e instanceof em?gH(e,t):e instanceof tm?xH(e,t):(function(i,a){const o=mH(i,a),c=iD(o)+iD(i.Ae);return oC(o)&&oC(i.Ae)?fH(c):KI(i.serializer,c)})(e,t)}function lue(e,t,r){return e instanceof em?gH(e,t):e instanceof tm?xH(e,t):r}function mH(e,t){return e instanceof yg?(function(n){return oC(n)||(function(a){return!!a&&"doubleValue"in a})(n)})(t)?t:{integerValue:0}:null}class xg extends gE{}class em extends gE{constructor(t){super(),this.elements=t}}function gH(e,t){const r=yH(t);for(const n of e.elements)r.some((i=>Vu(i,n)))||r.push(n);return{arrayValue:{values:r}}}class tm extends gE{constructor(t){super(),this.elements=t}}function xH(e,t){let r=yH(t);for(const n of e.elements)r=r.filter((i=>!Vu(i,n)));return{arrayValue:{values:r}}}class yg extends gE{constructor(t,r){super(),this.serializer=t,this.Ae=r}}function iD(e){return As(e.integerValue||e.doubleValue)}function yH(e){return my(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Qy{constructor(t,r){this.field=t,this.transform=r}}function cue(e,t){return e.field.isEqual(t.field)&&(function(n,i){return n instanceof em&&i instanceof em||n instanceof tm&&i instanceof tm?og(n.elements,i.elements,Vu):n instanceof yg&&i instanceof yg?Vu(n.Ae,i.Ae):n instanceof xg&&i instanceof xg})(e.transform,t.transform)}class uue{constructor(t,r){this.version=t,this.transformResults=r}}class _o{constructor(t,r){this.updateTime=t,this.exists=r}static none(){return new _o}static exists(t){return new _o(void 0,t)}static updateTime(t){return new _o(t)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function Pw(e,t){return e.updateTime!==void 0?t.isFoundDocument()&&t.version.isEqual(e.updateTime):e.exists===void 0||e.exists===t.isFoundDocument()}class xE{}function bH(e,t){if(!e.hasLocalMutations||t&&t.fields.length===0)return null;if(t===null)return e.isNoDocument()?new yE(e.key,_o.none()):new zg(e.key,e.data,_o.none());{const r=e.data,n=ao.empty();let i=new qi(Os.comparator);for(let a of t.fields)if(!i.has(a)){let o=r.field(a);o===null&&a.length>1&&(a=a.popLast(),o=r.field(a)),o===null?n.delete(a):n.set(a,o),i=i.add(a)}return new Qd(e.key,n,new hl(i.toArray()),_o.none())}}function due(e,t,r){e instanceof zg?(function(i,a,o){const c=i.value.clone(),h=aD(i.fieldTransforms,a,o.transformResults);c.setAll(h),a.convertToFoundDocument(o.version,c).setHasCommittedMutations()})(e,t,r):e instanceof Qd?(function(i,a,o){if(!Pw(i.precondition,a))return void a.convertToUnknownDocument(o.version);const c=aD(i.fieldTransforms,a,o.transformResults),h=a.data;h.setAll(vH(i)),h.setAll(c),a.convertToFoundDocument(o.version,h).setHasCommittedMutations()})(e,t,r):(function(i,a,o){a.convertToNoDocument(o.version).setHasCommittedMutations()})(0,t,r)}function $1(e,t,r,n){return e instanceof zg?(function(a,o,c,h){if(!Pw(a.precondition,o))return c;const f=a.value.clone(),m=oD(a.fieldTransforms,h,o);return f.setAll(m),o.convertToFoundDocument(o.version,f).setHasLocalMutations(),null})(e,t,r,n):e instanceof Qd?(function(a,o,c,h){if(!Pw(a.precondition,o))return c;const f=oD(a.fieldTransforms,h,o),m=o.data;return m.setAll(vH(a)),m.setAll(f),o.convertToFoundDocument(o.version,m).setHasLocalMutations(),c===null?null:c.unionWith(a.fieldMask.fields).unionWith(a.fieldTransforms.map((y=>y.field)))})(e,t,r,n):(function(a,o,c){return Pw(a.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):c})(e,t,r)}function hue(e,t){let r=null;for(const n of e.fieldTransforms){const i=t.data.field(n.field),a=mH(n.transform,i||null);a!=null&&(r===null&&(r=ao.empty()),r.set(n.field,a))}return r||null}function sD(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!(function(n,i){return n===void 0&&i===void 0||!(!n||!i)&&og(n,i,((a,o)=>cue(a,o)))})(e.fieldTransforms,t.fieldTransforms)&&(e.type===0?e.value.isEqual(t.value):e.type!==1||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class zg extends xE{constructor(t,r,n,i=[]){super(),this.key=t,this.value=r,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Qd extends xE{constructor(t,r,n,i,a=[]){super(),this.key=t,this.data=r,this.fieldMask=n,this.precondition=i,this.fieldTransforms=a,this.type=1}getFieldMask(){return this.fieldMask}}function vH(e){const t=new Map;return e.fieldMask.fields.forEach((r=>{if(!r.isEmpty()){const n=e.data.field(r);t.set(r,n)}})),t}function aD(e,t,r){const n=new Map;Yr(e.length===r.length,32656,{Ve:r.length,de:e.length});for(let i=0;i{const a=t.get(i.key),o=a.overlayedDocument;let c=this.applyToLocalView(o,a.mutatedFields);c=r.has(i.key)?null:c;const h=bH(o,c);h!==null&&n.set(i.key,h),o.isValidDocument()||o.convertToNoDocument(sn.min())})),n}keys(){return this.mutations.reduce(((t,r)=>t.add(r.key)),qn())}isEqual(t){return this.batchId===t.batchId&&og(this.mutations,t.mutations,((r,n)=>sD(r,n)))&&og(this.baseMutations,t.baseMutations,((r,n)=>sD(r,n)))}}class XI{constructor(t,r,n,i){this.batch=t,this.commitVersion=r,this.mutationResults=n,this.docVersions=i}static from(t,r,n){Yr(t.mutations.length===n.length,58842,{me:t.mutations.length,fe:n.length});let i=(function(){return iue})();const a=t.mutations;for(let o=0;o=8)throw new A1(`Invalid padding: ${r}`);if(n<0)throw new A1(`Invalid hash count: ${n}`);if(t.length>0&&this.hashCount===0)throw new A1(`Invalid hash count: ${n}`);if(t.length===0&&r!==0)throw new A1(`Invalid padding when bitmap length is 0: ${r}`);this.ge=8*t.length-r,this.pe=df.fromNumber(this.ge)}ye(t,r,n){let i=t.add(r.multiply(df.fromNumber(n)));return i.compare(xue)===1&&(i=new df([i.getBits(0),i.getBits(1)],0)),i.modulo(this.pe).toNumber()}we(t){return!!(this.bitmap[Math.floor(t/8)]&1<o.insert(c))),o}insert(t){if(this.ge===0)return;const r=lD(t),[n,i]=cD(r);for(let a=0;a0&&(this.Oe=!0,this.Me=t)}ke(){let t=qn(),r=qn(),n=qn();return this.Fe.forEach(((i,a)=>{switch(a){case 0:t=t.add(i);break;case 2:r=r.add(i);break;case 1:n=n.add(i);break;default:Tr(38017,{changeType:a})}})),new Jy(this.Me,this.xe,t,r,n)}qe(){this.Oe=!1,this.Fe=dD()}Ke(t,r){this.Oe=!0,this.Fe=this.Fe.insert(t,r)}Ue(t){this.Oe=!0,this.Fe=this.Fe.remove(t)}$e(){this.ve+=1}We(){this.ve-=1,Yr(this.ve>=0,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}}class yue{constructor(t){this.Ge=t,this.ze=new Map,this.je=Bl(),this.Je=Ov(),this.He=Ov(),this.Ze=new ls(kn)}Xe(t){for(const r of t.be)t.De&&t.De.isFoundDocument()?this.Ye(r,t.De):this.et(r,t.key,t.De);for(const r of t.removedTargetIds)this.et(r,t.key,t.De)}tt(t){this.forEachTarget(t,(r=>{const n=this.nt(r);switch(t.state){case 0:this.rt(r)&&n.Le(t.resumeToken);break;case 1:n.We(),n.Ne||n.qe(),n.Le(t.resumeToken);break;case 2:n.We(),n.Ne||this.removeTarget(r);break;case 3:this.rt(r)&&(n.Qe(),n.Le(t.resumeToken));break;case 4:this.rt(r)&&(this.it(r),n.Le(t.resumeToken));break;default:Tr(56790,{state:t.state})}}))}forEachTarget(t,r){t.targetIds.length>0?t.targetIds.forEach(r):this.ze.forEach(((n,i)=>{this.rt(i)&&r(i)}))}st(t){const r=t.targetId,n=t.Ce.count,i=this.ot(r);if(i){const a=i.target;if(m2(a))if(n===0){const o=new hr(a.path);this.et(r,o,qs.newNoDocument(o,sn.min()))}else Yr(n===1,20013,{expectedCount:n});else{const o=this._t(r);if(o!==n){const c=this.ut(t),h=c?this.ct(c,t,o):1;if(h!==0){this.it(r);const f=h===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(r,f)}}}}}ut(t){const r=t.Ce.unchangedNames;if(!r||!r.bits)return null;const{bits:{bitmap:n="",padding:i=0},hashCount:a=0}=r;let o,c;try{o=Fd(n).toUint8Array()}catch(h){if(h instanceof F$)return ag("Decoding the base64 bloom filter in existence filter failed ("+h.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw h}try{c=new ZI(o,i,a)}catch(h){return ag(h instanceof A1?"BloomFilter error: ":"Applying bloom filter failed: ",h),null}return c.ge===0?null:c}ct(t,r,n){return r.Ce.count===n-this.Pt(t,r.targetId)?0:2}Pt(t,r){const n=this.Ge.getRemoteKeysForTarget(r);let i=0;return n.forEach((a=>{const o=this.Ge.ht(),c=`projects/${o.projectId}/databases/${o.database}/documents/${a.path.canonicalString()}`;t.mightContain(c)||(this.et(r,a,null),i++)})),i}Tt(t){const r=new Map;this.ze.forEach(((a,o)=>{const c=this.ot(o);if(c){if(a.current&&m2(c.target)){const h=new hr(c.target.path);this.Et(h).has(o)||this.It(o,h)||this.et(o,h,qs.newNoDocument(h,t))}a.Be&&(r.set(o,a.ke()),a.qe())}}));let n=qn();this.He.forEach(((a,o)=>{let c=!0;o.forEachWhile((h=>{const f=this.ot(h);return!f||f.purpose==="TargetPurposeLimboResolution"||(c=!1,!1)})),c&&(n=n.add(a))})),this.je.forEach(((a,o)=>o.setReadTime(t)));const i=new Zy(t,r,this.Ze,this.je,n);return this.je=Bl(),this.Je=Ov(),this.He=Ov(),this.Ze=new ls(kn),i}Ye(t,r){if(!this.rt(t))return;const n=this.It(t,r.key)?2:0;this.nt(t).Ke(r.key,n),this.je=this.je.insert(r.key,r),this.Je=this.Je.insert(r.key,this.Et(r.key).add(t)),this.He=this.He.insert(r.key,this.Rt(r.key).add(t))}et(t,r,n){if(!this.rt(t))return;const i=this.nt(t);this.It(t,r)?i.Ke(r,1):i.Ue(r),this.He=this.He.insert(r,this.Rt(r).delete(t)),this.He=this.He.insert(r,this.Rt(r).add(t)),n&&(this.je=this.je.insert(r,n))}removeTarget(t){this.ze.delete(t)}_t(t){const r=this.nt(t).ke();return this.Ge.getRemoteKeysForTarget(t).size+r.addedDocuments.size-r.removedDocuments.size}$e(t){this.nt(t).$e()}nt(t){let r=this.ze.get(t);return r||(r=new uD,this.ze.set(t,r)),r}Rt(t){let r=this.He.get(t);return r||(r=new qi(kn),this.He=this.He.insert(t,r)),r}Et(t){let r=this.Je.get(t);return r||(r=new qi(kn),this.Je=this.Je.insert(t,r)),r}rt(t){const r=this.ot(t)!==null;return r||$t("WatchChangeAggregator","Detected inactive target",t),r}ot(t){const r=this.ze.get(t);return r&&r.Ne?null:this.Ge.At(t)}it(t){this.ze.set(t,new uD),this.Ge.getRemoteKeysForTarget(t).forEach((r=>{this.et(t,r,null)}))}It(t,r){return this.Ge.getRemoteKeysForTarget(t).has(r)}}function Ov(){return new ls(hr.comparator)}function dD(){return new ls(hr.comparator)}const bue={asc:"ASCENDING",desc:"DESCENDING"},vue={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},wue={and:"AND",or:"OR"};class Nue{constructor(t,r){this.databaseId=t,this.useProto3Json=r}}function hC(e,t){return e.useProto3Json||cE(t)?t:{value:t}}function bg(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function kH(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function Eue(e,t){return bg(e,t.toTimestamp())}function Ho(e){return Yr(!!e,49232),sn.fromTimestamp((function(r){const n=Vd(r);return new wn(n.seconds,n.nanos)})(e))}function JI(e,t){return fC(e,t).canonicalString()}function fC(e,t){const r=(function(i){return new ki(["projects",i.projectId,"databases",i.database])})(e).child("documents");return t===void 0?r:r.child(t)}function _H(e){const t=ki.fromString(e);return Yr(RH(t),10190,{key:t.toString()}),t}function y2(e,t){return JI(e.databaseId,t.path)}function Rp(e,t){const r=_H(t);if(r.get(1)!==e.databaseId.projectId)throw new tr(bt.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+r.get(1)+" vs "+e.databaseId.projectId);if(r.get(3)!==e.databaseId.database)throw new tr(bt.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+r.get(3)+" vs "+e.databaseId.database);return new hr(jH(r))}function SH(e,t){return JI(e.databaseId,t)}function CH(e){const t=_H(e);return t.length===4?ki.emptyPath():jH(t)}function pC(e){return new ki(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function jH(e){return Yr(e.length>4&&e.get(4)==="documents",29091,{key:e.toString()}),e.popFirst(5)}function hD(e,t,r){return{name:y2(e,t),fields:r.value.mapValue.fields}}function Aue(e,t,r){const n=Rp(e,t.name),i=Ho(t.updateTime),a=t.createTime?Ho(t.createTime):sn.min(),o=new ao({mapValue:{fields:t.fields}}),c=qs.newFoundDocument(n,i,a,o);return r&&c.setHasCommittedMutations(),r?c.setHasCommittedMutations():c}function kue(e,t){let r;if("targetChange"in t){t.targetChange;const n=(function(f){return f==="NO_CHANGE"?0:f==="ADD"?1:f==="REMOVE"?2:f==="CURRENT"?3:f==="RESET"?4:Tr(39313,{state:f})})(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],a=(function(f,m){return f.useProto3Json?(Yr(m===void 0||typeof m=="string",58123),Zs.fromBase64String(m||"")):(Yr(m===void 0||m instanceof Buffer||m instanceof Uint8Array,16193),Zs.fromUint8Array(m||new Uint8Array))})(e,t.targetChange.resumeToken),o=t.targetChange.cause,c=o&&(function(f){const m=f.code===void 0?bt.UNKNOWN:NH(f.code);return new tr(m,f.message||"")})(o);r=new AH(n,i,a,c||null)}else if("documentChange"in t){t.documentChange;const n=t.documentChange;n.document,n.document.name,n.document.updateTime;const i=Rp(e,n.document.name),a=Ho(n.document.updateTime),o=n.document.createTime?Ho(n.document.createTime):sn.min(),c=new ao({mapValue:{fields:n.document.fields}}),h=qs.newFoundDocument(i,a,o,c),f=n.targetIds||[],m=n.removedTargetIds||[];r=new Ow(f,m,h.key,h)}else if("documentDelete"in t){t.documentDelete;const n=t.documentDelete;n.document;const i=Rp(e,n.document),a=n.readTime?Ho(n.readTime):sn.min(),o=qs.newNoDocument(i,a),c=n.removedTargetIds||[];r=new Ow([],c,o.key,o)}else if("documentRemove"in t){t.documentRemove;const n=t.documentRemove;n.document;const i=Rp(e,n.document),a=n.removedTargetIds||[];r=new Ow([],a,i,null)}else{if(!("filter"in t))return Tr(11601,{Vt:t});{t.filter;const n=t.filter;n.targetId;const{count:i=0,unchangedNames:a}=n,o=new pue(i,a),c=n.targetId;r=new EH(c,o)}}return r}function b2(e,t){let r;if(t instanceof zg)r={update:hD(e,t.key,t.value)};else if(t instanceof yE)r={delete:y2(e,t.key)};else if(t instanceof Qd)r={update:hD(e,t.key,t.data),updateMask:Pue(t.fieldMask)};else{if(!(t instanceof wH))return Tr(16599,{dt:t.type});r={verify:y2(e,t.key)}}return t.fieldTransforms.length>0&&(r.updateTransforms=t.fieldTransforms.map((n=>(function(a,o){const c=o.transform;if(c instanceof xg)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(c instanceof em)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:c.elements}};if(c instanceof tm)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:c.elements}};if(c instanceof yg)return{fieldPath:o.field.canonicalString(),increment:c.Ae};throw Tr(20930,{transform:o.transform})})(0,n)))),t.precondition.isNone||(r.currentDocument=(function(i,a){return a.updateTime!==void 0?{updateTime:Eue(i,a.updateTime)}:a.exists!==void 0?{exists:a.exists}:Tr(27497)})(e,t.precondition)),r}function mC(e,t){const r=t.currentDocument?(function(a){return a.updateTime!==void 0?_o.updateTime(Ho(a.updateTime)):a.exists!==void 0?_o.exists(a.exists):_o.none()})(t.currentDocument):_o.none(),n=t.updateTransforms?t.updateTransforms.map((i=>(function(o,c){let h=null;if("setToServerValue"in c)Yr(c.setToServerValue==="REQUEST_TIME",16630,{proto:c}),h=new xg;else if("appendMissingElements"in c){const m=c.appendMissingElements.values||[];h=new em(m)}else if("removeAllFromArray"in c){const m=c.removeAllFromArray.values||[];h=new tm(m)}else"increment"in c?h=new yg(o,c.increment):Tr(16584,{proto:c});const f=Os.fromServerFormat(c.fieldPath);return new Qy(f,h)})(e,i))):[];if(t.update){t.update.name;const i=Rp(e,t.update.name),a=new ao({mapValue:{fields:t.update.fields}});if(t.updateMask){const o=(function(h){const f=h.fieldPaths||[];return new hl(f.map((m=>Os.fromServerFormat(m))))})(t.updateMask);return new Qd(i,a,o,r,n)}return new zg(i,a,r,n)}if(t.delete){const i=Rp(e,t.delete);return new yE(i,r)}if(t.verify){const i=Rp(e,t.verify);return new wH(i,r)}return Tr(1463,{proto:t})}function _ue(e,t){return e&&e.length>0?(Yr(t!==void 0,14353),e.map((r=>(function(i,a){let o=i.updateTime?Ho(i.updateTime):Ho(a);return o.isEqual(sn.min())&&(o=Ho(a)),new uue(o,i.transformResults||[])})(r,t)))):[]}function IH(e,t){return{documents:[SH(e,t.path)]}}function eT(e,t){const r={structuredQuery:{}},n=t.path;let i;t.collectionGroup!==null?(i=n,r.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(i=n.popLast(),r.structuredQuery.from=[{collectionId:n.lastSegment()}]),r.parent=SH(e,i);const a=(function(f){if(f.length!==0)return OH(Gi.create(f,"and"))})(t.filters);a&&(r.structuredQuery.where=a);const o=(function(f){if(f.length!==0)return f.map((m=>(function(w){return{field:Jh(w.field),direction:jue(w.dir)}})(m)))})(t.orderBy);o&&(r.structuredQuery.orderBy=o);const c=hC(e,t.limit);return c!==null&&(r.structuredQuery.limit=c),t.startAt&&(r.structuredQuery.startAt=(function(f){return{before:f.inclusive,values:f.position}})(t.startAt)),t.endAt&&(r.structuredQuery.endAt=(function(f){return{before:!f.inclusive,values:f.position}})(t.endAt)),{ft:r,parent:i}}function Sue(e,t,r,n){const{ft:i,parent:a}=eT(e,t),o={},c=[];let h=0;return r.forEach((f=>{const m="aggregate_"+h++;o[m]=f.alias,f.aggregateType==="count"?c.push({alias:m,count:{}}):f.aggregateType==="avg"?c.push({alias:m,avg:{field:Jh(f.fieldPath)}}):f.aggregateType==="sum"&&c.push({alias:m,sum:{field:Jh(f.fieldPath)}})})),{request:{structuredAggregationQuery:{aggregations:c,structuredQuery:i.structuredQuery},parent:i.parent},gt:o,parent:a}}function TH(e){let t=CH(e.parent);const r=e.structuredQuery,n=r.from?r.from.length:0;let i=null;if(n>0){Yr(n===1,65062);const m=r.from[0];m.allDescendants?i=m.collectionId:t=t.child(m.collectionId)}let a=[];r.where&&(a=(function(y){const w=PH(y);return w instanceof Gi&&qI(w)?w.getFilters():[w]})(r.where));let o=[];r.orderBy&&(o=(function(y){return y.map((w=>(function(S){return new gy(P0(S.field),(function(T){switch(T){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(S.direction))})(w)))})(r.orderBy));let c=null;r.limit&&(c=(function(y){let w;return w=typeof y=="object"?y.value:y,cE(w)?null:w})(r.limit));let h=null;r.startAt&&(h=(function(y){const w=!!y.before,A=y.values||[];return new mg(A,w)})(r.startAt));let f=null;return r.endAt&&(f=(function(y){const w=!y.before,A=y.values||[];return new mg(A,w)})(r.endAt)),iH(t,i,o,a,c,"F",h,f)}function Cue(e,t){const r=(function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Tr(28987,{purpose:i})}})(t.purpose);return r==null?null:{"goog-listen-tags":r}}function PH(e){return e.unaryFilter!==void 0?(function(r){switch(r.unaryFilter.op){case"IS_NAN":const n=P0(r.unaryFilter.field);return li.create(n,"==",{doubleValue:NaN});case"IS_NULL":const i=P0(r.unaryFilter.field);return li.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const a=P0(r.unaryFilter.field);return li.create(a,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=P0(r.unaryFilter.field);return li.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return Tr(61313);default:return Tr(60726)}})(e):e.fieldFilter!==void 0?(function(r){return li.create(P0(r.fieldFilter.field),(function(i){switch(i){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return Tr(58110);default:return Tr(50506)}})(r.fieldFilter.op),r.fieldFilter.value)})(e):e.compositeFilter!==void 0?(function(r){return Gi.create(r.compositeFilter.filters.map((n=>PH(n))),(function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return Tr(1026)}})(r.compositeFilter.op))})(e):Tr(30097,{filter:e})}function jue(e){return bue[e]}function Iue(e){return vue[e]}function Tue(e){return wue[e]}function Jh(e){return{fieldPath:e.canonicalString()}}function P0(e){return Os.fromServerFormat(e.fieldPath)}function OH(e){return e instanceof li?(function(r){if(r.op==="=="){if(XR(r.value))return{unaryFilter:{field:Jh(r.field),op:"IS_NAN"}};if(YR(r.value))return{unaryFilter:{field:Jh(r.field),op:"IS_NULL"}}}else if(r.op==="!="){if(XR(r.value))return{unaryFilter:{field:Jh(r.field),op:"IS_NOT_NAN"}};if(YR(r.value))return{unaryFilter:{field:Jh(r.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Jh(r.field),op:Iue(r.op),value:r.value}}})(e):e instanceof Gi?(function(r){const n=r.getFilters().map((i=>OH(i)));return n.length===1?n[0]:{compositeFilter:{op:Tue(r.op),filters:n}}})(e):Tr(54877,{filter:e})}function Pue(e){const t=[];return e.fields.forEach((r=>t.push(r.canonicalString()))),{fieldPaths:t}}function RH(e){return e.length>=4&&e.get(0)==="projects"&&e.get(2)==="databases"}function DH(e){return!!e&&typeof e._toProto=="function"&&e._protoValueType==="ProtoValue"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class jd{constructor(t,r,n,i,a=sn.min(),o=sn.min(),c=Zs.EMPTY_BYTE_STRING,h=null){this.target=t,this.targetId=r,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=a,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=c,this.expectedCount=h}withSequenceNumber(t){return new jd(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(t,r){return new jd(this.target,this.targetId,this.purpose,this.sequenceNumber,r,this.lastLimboFreeSnapshotVersion,t,null)}withExpectedCount(t){return new jd(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,t)}withLastLimboFreeSnapshotVersion(t){return new jd(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken,this.expectedCount)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class MH{constructor(t){this.yt=t}}function Oue(e,t){let r;if(t.document)r=Aue(e.yt,t.document,!!t.hasCommittedMutations);else if(t.noDocument){const n=hr.fromSegments(t.noDocument.path),i=nm(t.noDocument.readTime);r=qs.newNoDocument(n,i),t.hasCommittedMutations&&r.setHasCommittedMutations()}else{if(!t.unknownDocument)return Tr(56709);{const n=hr.fromSegments(t.unknownDocument.path),i=nm(t.unknownDocument.version);r=qs.newUnknownDocument(n,i)}}return t.readTime&&r.setReadTime((function(i){const a=new wn(i[0],i[1]);return sn.fromTimestamp(a)})(t.readTime)),r}function fD(e,t){const r=t.key,n={prefixPath:r.getCollectionPath().popLast().toArray(),collectionGroup:r.collectionGroup,documentId:r.path.lastSegment(),readTime:v2(t.readTime),hasCommittedMutations:t.hasCommittedMutations};if(t.isFoundDocument())n.document=(function(a,o){return{name:y2(a,o.key),fields:o.data.value.mapValue.fields,updateTime:bg(a,o.version.toTimestamp()),createTime:bg(a,o.createTime.toTimestamp())}})(e.yt,t);else if(t.isNoDocument())n.noDocument={path:r.path.toArray(),readTime:rm(t.version)};else{if(!t.isUnknownDocument())return Tr(57904,{document:t});n.unknownDocument={path:r.path.toArray(),version:rm(t.version)}}return n}function v2(e){const t=e.toTimestamp();return[t.seconds,t.nanoseconds]}function rm(e){const t=e.toTimestamp();return{seconds:t.seconds,nanoseconds:t.nanoseconds}}function nm(e){const t=new wn(e.seconds,e.nanoseconds);return sn.fromTimestamp(t)}function pp(e,t){const r=(t.baseMutations||[]).map((a=>mC(e.yt,a)));for(let a=0;amC(e.yt,a))),i=wn.fromMillis(t.localWriteTimeMs);return new YI(t.batchId,i,r,n)}function k1(e){const t=nm(e.readTime),r=e.lastLimboFreeSnapshotVersion!==void 0?nm(e.lastLimboFreeSnapshotVersion):sn.min();let n;return n=(function(a){return a.documents!==void 0})(e.query)?(function(a){const o=a.documents.length;return Yr(o===1,1966,{count:o}),$l(Yy(CH(a.documents[0])))})(e.query):(function(a){return $l(TH(a))})(e.query),new jd(n,e.targetId,"TargetPurposeListen",e.lastListenSequenceNumber,t,r,Zs.fromBase64String(e.resumeToken))}function LH(e,t){const r=rm(t.snapshotVersion),n=rm(t.lastLimboFreeSnapshotVersion);let i;i=m2(t.target)?IH(e.yt,t.target):eT(e.yt,t.target).ft;const a=t.resumeToken.toBase64();return{targetId:t.targetId,canonicalId:Jp(t.target),readTime:r,resumeToken:a,lastListenSequenceNumber:t.sequenceNumber,lastLimboFreeSnapshotVersion:n,query:i}}function UH(e){const t=TH({parent:e.parent,structuredQuery:e.structuredQuery});return e.limitType==="LAST"?x2(t,t.limit,"L"):t}function ck(e,t){return new QI(t.largestBatchId,mC(e.yt,t.overlayMutation))}function pD(e,t){const r=t.path.lastSegment();return[e,Co(t.path.popLast()),r]}function mD(e,t,r,n){return{indexId:e,uid:t,sequenceNumber:r,readTime:rm(n.readTime),documentKey:Co(n.documentKey.path),largestBatchId:n.largestBatchId}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Rue{getBundleMetadata(t,r){return gD(t).get(r).next((n=>{if(n)return(function(a){return{id:a.bundleId,createTime:nm(a.createTime),version:a.version}})(n)}))}saveBundleMetadata(t,r){return gD(t).put((function(i){return{bundleId:i.id,createTime:rm(Ho(i.createTime)),version:i.version}})(r))}getNamedQuery(t,r){return xD(t).get(r).next((n=>{if(n)return(function(a){return{name:a.name,query:UH(a.bundledQuery),readTime:nm(a.readTime)}})(n)}))}saveNamedQuery(t,r){return xD(t).put((function(i){return{name:i.name,readTime:rm(Ho(i.readTime)),bundledQuery:i.bundledQuery}})(r))}}function gD(e){return Ca(e,uE)}function xD(e){return Ca(e,dE)}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class bE{constructor(t,r){this.serializer=t,this.userId=r}static wt(t,r){const n=r.uid||"";return new bE(t,n)}getOverlay(t,r){return Wx(t).get(pD(this.userId,r)).next((n=>n?ck(this.serializer,n):null))}getOverlays(t,r){const n=Iu();return Qe.forEach(r,(i=>this.getOverlay(t,i).next((a=>{a!==null&&n.set(i,a)})))).next((()=>n))}saveOverlays(t,r,n){const i=[];return n.forEach(((a,o)=>{const c=new QI(r,o);i.push(this.St(t,c))})),Qe.waitFor(i)}removeOverlaysForBatchId(t,r,n){const i=new Set;r.forEach((o=>i.add(Co(o.getCollectionPath()))));const a=[];return i.forEach((o=>{const c=IDBKeyRange.bound([this.userId,o,n],[this.userId,o,n+1],!1,!0);a.push(Wx(t).X(nC,c))})),Qe.waitFor(a)}getOverlaysForCollection(t,r,n){const i=Iu(),a=Co(r),o=IDBKeyRange.bound([this.userId,a,n],[this.userId,a,Number.POSITIVE_INFINITY],!0);return Wx(t).J(nC,o).next((c=>{for(const h of c){const f=ck(this.serializer,h);i.set(f.getKey(),f)}return i}))}getOverlaysForCollectionGroup(t,r,n,i){const a=Iu();let o;const c=IDBKeyRange.bound([this.userId,r,n],[this.userId,r,Number.POSITIVE_INFINITY],!0);return Wx(t).ee({index:M$,range:c},((h,f,m)=>{const y=ck(this.serializer,f);a.size()a))}St(t,r){return Wx(t).put((function(i,a,o){const[c,h,f]=pD(a,o.mutation.key);return{userId:a,collectionPath:h,documentId:f,collectionGroup:o.mutation.key.getCollectionGroup(),largestBatchId:o.largestBatchId,overlayMutation:b2(i.yt,o.mutation)}})(this.serializer,this.userId,r))}}function Wx(e){return Ca(e,hE)}/** * @license * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Due{bt(t){return Ca(t,VI)}getSessionToken(t){return this.bt(t).get("sessionToken").next((r=>{const n=r==null?void 0:r.value;return n?Zs.fromUint8Array(n):Zs.EMPTY_BYTE_STRING}))}setSessionToken(t,r){return this.bt(t).put({name:"sessionToken",value:r.toUint8Array()})}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class mp{constructor(){}Dt(t,r){this.Ct(t,r),r.vt()}Ct(t,r){if("nullValue"in t)this.Ft(r,5);else if("booleanValue"in t)this.Ft(r,10),r.Mt(t.booleanValue?1:0);else if("integerValue"in t)this.Ft(r,15),r.Mt(As(t.integerValue));else if("doubleValue"in t){const n=As(t.doubleValue);isNaN(n)?this.Ft(r,13):(this.Ft(r,15),ly(n)?r.Mt(0):r.Mt(n))}else if("timestampValue"in t){let n=t.timestampValue;this.Ft(r,20),typeof n=="string"&&(n=Vd(n)),r.xt(`${n.seconds||""}`),r.Mt(n.nanos||0)}else if("stringValue"in t)this.Ot(t.stringValue,r),this.Nt(r);else if("bytesValue"in t)this.Ft(r,30),r.Bt(Fd(t.bytesValue)),this.Nt(r);else if("referenceValue"in t)this.Lt(t.referenceValue,r);else if("geoPointValue"in t){const n=t.geoPointValue;this.Ft(r,45),r.Mt(n.latitude||0),r.Mt(n.longitude||0)}else"mapValue"in t?K$(t)?this.Ft(r,Number.MAX_SAFE_INTEGER):pE(t)?this.kt(t.mapValue,r):(this.qt(t.mapValue,r),this.Nt(r)):"arrayValue"in t?(this.Kt(t.arrayValue,r),this.Nt(r)):Tr(19022,{Ut:t})}Ot(t,r){this.Ft(r,25),this.$t(t,r)}$t(t,r){r.xt(t)}qt(t,r){const n=t.fields||{};this.Ft(r,55);for(const i of Object.keys(n))this.Ot(i,r),this.Ct(n[i],r)}kt(t,r){var o,c;const n=t.fields||{};this.Ft(r,53);const i=fg,a=((c=(o=n[i].arrayValue)==null?void 0:o.values)==null?void 0:c.length)||0;this.Ft(r,15),r.Mt(As(a)),this.Ot(i,r),this.Ct(n[i],r)}Kt(t,r){const n=t.values||[];this.Ft(r,50);for(const i of n)this.Ct(i,r)}Lt(t,r){this.Ft(r,37),hr.fromName(t).path.forEach((n=>{this.Ft(r,60),this.$t(n,r)}))}Ft(t,r){t.Mt(r)}Nt(t){t.Mt(2)}}mp.Wt=new mp;/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law | agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES | CONDITIONS OF ANY KIND, either express | implied. * See the License for the specific language governing permissions and * limitations under the License. */const m0=255;function Mue(e){if(e===0)return 8;let t=0;return e>>4||(t+=4,e<<=4),e>>6||(t+=2,e<<=2),e>>7||(t+=1),t}function yD(e){const t=64-(function(n){let i=0;for(let a=0;a<8;++a){const o=Mue(255&n[a]);if(i+=o,o!==8)break}return i})(e);return Math.ceil(t/8)}class Lue{constructor(){this.buffer=new Uint8Array(1024),this.position=0}Qt(t){const r=t[Symbol.iterator]();let n=r.next();for(;!n.done;)this.Gt(n.value),n=r.next();this.zt()}jt(t){const r=t[Symbol.iterator]();let n=r.next();for(;!n.done;)this.Jt(n.value),n=r.next();this.Ht()}Zt(t){for(const r of t){const n=r.charCodeAt(0);if(n<128)this.Gt(n);else if(n<2048)this.Gt(960|n>>>6),this.Gt(128|63&n);else if(r<"\uD800"||"\uDBFF">>12),this.Gt(128|63&n>>>6),this.Gt(128|63&n);else{const i=r.codePointAt(0);this.Gt(240|i>>>18),this.Gt(128|63&i>>>12),this.Gt(128|63&i>>>6),this.Gt(128|63&i)}}this.zt()}Xt(t){for(const r of t){const n=r.charCodeAt(0);if(n<128)this.Jt(n);else if(n<2048)this.Jt(960|n>>>6),this.Jt(128|63&n);else if(r<"\uD800"||"\uDBFF">>12),this.Jt(128|63&n>>>6),this.Jt(128|63&n);else{const i=r.codePointAt(0);this.Jt(240|i>>>18),this.Jt(128|63&i>>>12),this.Jt(128|63&i>>>6),this.Jt(128|63&i)}}this.Ht()}Yt(t){const r=this.en(t),n=yD(r);this.tn(1+n),this.buffer[this.position++]=255&n;for(let i=r.length-n;iOs.comparator(r.field,n.field))),this.collectionId=t.collectionGroup!=null?t.collectionGroup:t.path.lastSegment(),this.dn=t.orderBy,this.mn=[];for(const r of t.filters){const n=r;n.isInequality()?this.Vn=this.Vn.add(n):this.mn.push(n)}}get fn(){return this.Vn.size>1}gn(t){if(Yr(t.collectionGroup===this.collectionId,49279),this.fn)return!1;const r=eC(t);if(r!==void 0&&!this.pn(r))return!1;const n=ap(t);let i=new Set,a=0,o=0;for(;a0){const c=this.Vn.getIterator().getNext();if(!i.has(c.field.canonicalString())){const h=n[a];if(!this.yn(c,h)||!this.wn(this.dn[o++],h))return!1}++a}for(;a=this.dn.length||!this.wn(this.dn[o++],c))return!1}return!0}Sn(){if(this.fn)return null;let t=new qi(Os.comparator);const r=[];for(const n of this.mn)if(!n.field.isKeyField())if(n.op==="array-contains"||n.op==="array-contains-any")r.push(new _w(n.field,2));else{if(t.has(n.field))continue;t=t.add(n.field),r.push(new _w(n.field,0))}for(const n of this.dn)n.field.isKeyField()||t.has(n.field)||(t=t.add(n.field),r.push(new _w(n.field,n.dir==="asc"?0:1)));return new d2(d2.UNKNOWN_ID,this.collectionId,r,oy.empty())}pn(t){for(const r of this.mn)if(this.yn(r,t))return!0;return!1}yn(t,r){if(t===void 0||!t.field.isEqual(r.fieldPath))return!1;const n=t.op==="array-contains"||t.op==="array-contains-any";return r.kind===2===n}wn(t,r){return!!t.field.isEqual(r.fieldPath)&&(r.kind===0&&t.dir==="asc"||r.kind===1&&t.dir==="desc")}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function BH(e){var r,n;if(Yr(e instanceof li||e instanceof Gi,20012),e instanceof li){if(e instanceof nH){const i=((n=(r=e.value.arrayValue)==null?void 0:r.values)==null?void 0:n.map((a=>li.create(e.field,"==",a))))||[];return Gi.create(i,"or")}return e}const t=e.filters.map((i=>BH(i)));return Gi.create(t,e.op)}function zue(e){if(e.getFilters().length===0)return[];const t=yC(BH(e));return Yr(zH(t),7391),gC(t)||xC(t)?[t]:t.getFilters()}function gC(e){return e instanceof li}function xC(e){return e instanceof Gi&&qI(e)}function zH(e){return gC(e)||xC(e)||(function(r){if(r instanceof Gi&&lC(r)){for(const n of r.getFilters())if(!gC(n)&&!xC(n))return!1;return!0}return!1})(e)}function yC(e){if(Yr(e instanceof li||e instanceof Gi,34018),e instanceof li)return e;if(e.filters.length===1)return yC(e.filters[0]);const t=e.filters.map((n=>yC(n)));let r=Gi.create(t,e.op);return r=w2(r),zH(r)?r:(Yr(r instanceof Gi,64498),Yr(gg(r),40251),Yr(r.filters.length>1,57927),r.filters.reduce(((n,i)=>tT(n,i))))}function tT(e,t){let r;return Yr(e instanceof li||e instanceof Gi,38388),Yr(t instanceof li||t instanceof Gi,25473),r=e instanceof li?t instanceof li?(function(i,a){return Gi.create([i,a],"and")})(e,t):ND(e,t):t instanceof li?ND(t,e):(function(i,a){if(Yr(i.filters.length>0&&a.filters.length>0,48005),gg(i)&&gg(a))return eH(i,a.getFilters());const o=lC(i)?i:a,c=lC(i)?a:i,h=o.filters.map((f=>tT(f,c)));return Gi.create(h,"or")})(e,t),w2(r)}function ND(e,t){if(gg(t))return eH(t,e.getFilters());{const r=t.filters.map((n=>tT(e,n)));return Gi.create(r,"or")}}function w2(e){if(Yr(e instanceof li||e instanceof Gi,11850),e instanceof li)return e;const t=e.getFilters();if(t.length===1)return w2(t[0]);if(Z$(e))return e;const r=t.map((i=>w2(i))),n=[];return r.forEach((i=>{i instanceof li?n.push(i):i instanceof Gi&&(i.op===e.op?n.push(...i.filters):n.push(i))})),n.length===1?n[0]:Gi.create(n,e.op)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Vue{constructor(){this.bn=new rT}addToCollectionParentIndex(t,r){return this.bn.add(r),Qe.resolve()}getCollectionParents(t,r){return Qe.resolve(this.bn.getEntries(r))}addFieldIndex(t,r){return Qe.resolve()}deleteFieldIndex(t,r){return Qe.resolve()}deleteAllFieldIndexes(t){return Qe.resolve()}createTargetIndexes(t,r){return Qe.resolve()}getDocumentsMatchingTarget(t,r){return Qe.resolve(null)}getIndexType(t,r){return Qe.resolve(0)}getFieldIndexes(t,r){return Qe.resolve([])}getNextCollectionGroupToUpdate(t){return Qe.resolve(null)}getMinOffset(t,r){return Qe.resolve(ql.min())}getMinOffsetFromCollectionGroup(t,r){return Qe.resolve(ql.min())}updateCollectionGroup(t,r,n){return Qe.resolve()}updateIndexEntries(t,r){return Qe.resolve()}}class rT{constructor(){this.index={}}add(t){const r=t.lastSegment(),n=t.popLast(),i=this.index[r]||new qi(ki.comparator),a=!i.has(n);return this.index[r]=i.add(n),a}has(t){const r=t.lastSegment(),n=t.popLast(),i=this.index[r];return i&&i.has(n)}getEntries(t){return(this.index[t]||new qi(ki.comparator)).toArray()}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ED="IndexedDbIndexManager",Rv=new Uint8Array(0);class Fue{constructor(t,r){this.databaseId=r,this.Dn=new rT,this.Cn=new Xd((n=>Jp(n)),((n,i)=>Ky(n,i))),this.uid=t.uid||""}addToCollectionParentIndex(t,r){if(!this.Dn.has(r)){const n=r.lastSegment(),i=r.popLast();t.addOnCommittedListener((()=>{this.Dn.add(r)}));const a={collectionId:n,parent:Co(i)};return AD(t).put(a)}return Qe.resolve()}getCollectionParents(t,r){const n=[],i=IDBKeyRange.bound([r,""],[E$(r),""],!1,!0);return AD(t).J(i).next((a=>{for(const o of a){if(o.collectionId!==r)break;n.push(ju(o.parent))}return n}))}addFieldIndex(t,r){const n=Yx(t),i=(function(c){return{indexId:c.indexId,collectionGroup:c.collectionGroup,fields:c.fields.map((h=>[h.fieldPath.canonicalString(),h.kind]))}})(r);delete i.indexId;const a=n.add(i);if(r.indexState){const o=x0(t);return a.next((c=>{o.put(mD(c,this.uid,r.indexState.sequenceNumber,r.indexState.offset))}))}return a.next()}deleteFieldIndex(t,r){const n=Yx(t),i=x0(t),a=g0(t);return n.delete(r.indexId).next((()=>i.delete(IDBKeyRange.bound([r.indexId],[r.indexId+1],!1,!0)))).next((()=>a.delete(IDBKeyRange.bound([r.indexId],[r.indexId+1],!1,!0))))}deleteAllFieldIndexes(t){const r=Yx(t),n=g0(t),i=x0(t);return r.X().next((()=>n.X())).next((()=>i.X()))}createTargetIndexes(t,r){return Qe.forEach(this.vn(r),(n=>this.getIndexType(t,n).next((i=>{if(i===0||i===1){const a=new wD(n).Sn();if(a!=null)return this.addFieldIndex(t,a)}}))))}getDocumentsMatchingTarget(t,r){const n=g0(t);let i=!0;const a=new Map;return Qe.forEach(this.vn(r),(o=>this.Fn(t,o).next((c=>{i&&(i=!!c),a.set(o,c)})))).next((()=>{if(i){let o=qn();const c=[];return Qe.forEach(a,((h,f)=>{$t(ED,`Using index ${(function(U){return`id=${U.indexId}|cg=${U.collectionGroup}|f=${U.fields.map((G=>`${G.fieldPath}:${G.kind}`)).join(",")}`})(h)} to execute ${Jp(r)}`);const m=(function(U,G){const X=eC(G);if(X===void 0)return null;for(const q of g2(U,X.fieldPath))switch(q.op){case"array-contains-any":return q.value.arrayValue.values||[];case"array-contains":return[q.value]}return null})(f,h),y=(function(U,G){const X=new Map;for(const q of ap(G))for(const B of g2(U,q.fieldPath))switch(B.op){case"==":case"in":X.set(q.fieldPath.canonicalString(),B.value);break;case"not-in":case"!=":return X.set(q.fieldPath.canonicalString(),B.value),Array.from(X.values())}return null})(f,h),w=(function(U,G){const X=[];let q=!0;for(const B of ap(G)){const z=B.kind===0?tD(U,B.fieldPath,U.startAt):rD(U,B.fieldPath,U.startAt);X.push(z.value),q&&(q=z.inclusive)}return new mg(X,q)})(f,h),A=(function(U,G){const X=[];let q=!0;for(const B of ap(G)){const z=B.kind===0?rD(U,B.fieldPath,U.endAt):tD(U,B.fieldPath,U.endAt);X.push(z.value),q&&(q=z.inclusive)}return new mg(X,q)})(f,h),S=this.Mn(h,f,w),j=this.Mn(h,f,A),T=this.xn(h,f,y),D=this.On(h.indexId,m,S,w.inclusive,j,A.inclusive,T);return Qe.forEach(D,(V=>n.Z(V,r.limit).next((U=>{U.forEach((G=>{const X=hr.fromSegments(G.documentKey);o.has(X)||(o=o.add(X),c.push(X))}))}))))})).next((()=>c))}return Qe.resolve(null)}))}vn(t){let r=this.Cn.get(t);return r||(t.filters.length===0?r=[t]:r=zue(Gi.create(t.filters,"and")).map((n=>uC(t.path,t.collectionGroup,t.orderBy,n.getFilters(),t.limit,t.startAt,t.endAt))),this.Cn.set(t,r),r)}On(t,r,n,i,a,o,c){const h=(r!=null?r.length:1)*Math.max(n.length,a.length),f=h/(r!=null?r.length:1),m=[];for(let y=0;ythis.Bn(t,w,T,!0)));m.push(...this.createRange(A,S,j))}return m}Bn(t,r,n,i){const a=new gp(t,hr.empty(),r,n);return i?a:a.In()}Ln(t,r,n,i){const a=new gp(t,hr.empty(),r,n);return i?a.In():a}Fn(t,r){const n=new wD(r),i=r.collectionGroup!=null?r.collectionGroup:r.path.lastSegment();return this.getFieldIndexes(t,i).next((a=>{let o=null;for(const c of a)n.gn(c)&&(!o||c.fields.length>o.fields.length)&&(o=c);return o}))}getIndexType(t,r){let n=2;const i=this.vn(r);return Qe.forEach(i,(a=>this.Fn(t,a).next((o=>{o?n!==0&&o.fields.length<(function(h){let f=new qi(Os.comparator),m=!1;for(const y of h.filters)for(const w of y.getFlattenedFilters())w.field.isKeyField()||(w.op==="array-contains"||w.op==="array-contains-any"?m=!0:f=f.add(w.field));for(const y of h.orderBy)y.field.isKeyField()||(f=f.add(y.field));return f.size+(m?1:0)})(a)&&(n=1):n=0})))).next((()=>(function(o){return o.limit!==null})(r)&&i.length>1&&n===2?1:n))}kn(t,r){const n=new Kx;for(const i of ap(t)){const a=r.data.field(i.fieldPath);if(a==null)return null;const o=n.ln(i.kind);mp.Wt.Dt(a,o)}return n.un()}Nn(t){const r=new Kx;return mp.Wt.Dt(t,r.ln(0)),r.un()}qn(t,r){const n=new Kx;return mp.Wt.Dt(py(this.databaseId,r),n.ln((function(a){const o=ap(a);return o.length===0?0:o[o.length-1].kind})(t))),n.un()}xn(t,r,n){if(n===null)return[];let i=[];i.push(new Kx);let a=0;for(const o of ap(t)){const c=n[a++];for(const h of i)if(this.Kn(r,o.fieldPath)&&my(c))i=this.Un(i,o,c);else{const f=h.ln(o.kind);mp.Wt.Dt(c,f)}}return this.$n(i)}Mn(t,r,n){return this.xn(t,r,n.position)}$n(t){const r=[];for(let n=0;nn instanceof li&&n.field.isEqual(r)&&(n.op==="in"||n.op==="not-in")))}getFieldIndexes(t,r){const n=Yx(t),i=x0(t);return(r?n.J(rC,IDBKeyRange.bound(r,r)):n.J()).next((a=>{const o=[];return Qe.forEach(a,(c=>i.get([c.indexId,this.uid]).next((h=>{o.push((function(m,y){const w=y?new oy(y.sequenceNumber,new ql(nm(y.readTime),new hr(ju(y.documentKey)),y.largestBatchId)):oy.empty(),A=m.fields.map((([S,j])=>new _w(Os.fromServerFormat(S),j)));return new d2(m.indexId,m.collectionGroup,A,w)})(c,h))})))).next((()=>o))}))}getNextCollectionGroupToUpdate(t){return this.getFieldIndexes(t).next((r=>r.length===0?null:(r.sort(((n,i)=>{const a=n.indexState.sequenceNumber-i.indexState.sequenceNumber;return a!==0?a:kn(n.collectionGroup,i.collectionGroup)})),r[0].collectionGroup)))}updateCollectionGroup(t,r,n){const i=Yx(t),a=x0(t);return this.Wn(t).next((o=>i.J(rC,IDBKeyRange.bound(r,r)).next((c=>Qe.forEach(c,(h=>a.put(mD(h.indexId,this.uid,o,n))))))))}updateIndexEntries(t,r){const n=new Map;return Qe.forEach(r,((i,a)=>{const o=n.get(i.collectionGroup);return(o?Qe.resolve(o):this.getFieldIndexes(t,i.collectionGroup)).next((c=>(n.set(i.collectionGroup,c),Qe.forEach(c,(h=>this.Qn(t,i,h).next((f=>{const m=this.Gn(a,h);return f.isEqual(m)?Qe.resolve():this.zn(t,a,h,f,m)})))))))}))}jn(t,r,n,i){return g0(t).put(i.Rn(this.uid,this.qn(n,r.key),r.key))}Jn(t,r,n,i){return g0(t).delete(i.An(this.uid,this.qn(n,r.key),r.key))}Qn(t,r,n){const i=g0(t);let a=new qi(Lh);return i.ee({index:D$,range:IDBKeyRange.only([n.indexId,this.uid,Rw(this.qn(n,r))])},((o,c)=>{a=a.add(new gp(n.indexId,r,vD(c.arrayValue),vD(c.directionalValue)))})).next((()=>a))}Gn(t,r){let n=new qi(Lh);const i=this.kn(r,t);if(i==null)return n;const a=eC(r);if(a!=null){const o=t.data.field(a.fieldPath);if(my(o))for(const c of o.arrayValue.values||[])n=n.add(new gp(r.indexId,t.key,this.Nn(c),i))}else n=n.add(new gp(r.indexId,t.key,Rv,i));return n}zn(t,r,n,i,a){$t(ED,"Updating index entries for document '%s'",r.key);const o=[];return(function(h,f,m,y,w){const A=h.getIterator(),S=f.getIterator();let j=p0(A),T=p0(S);for(;j||T;){let D=!1,V=!1;if(j&&T){const U=m(j,T);U<0?V=!0:U>0&&(D=!0)}else j!=null?V=!0:D=!0;D?(y(T),T=p0(S)):V?(w(j),j=p0(A)):(j=p0(A),T=p0(S))}})(i,a,Lh,(c=>{o.push(this.jn(t,r,n,c))}),(c=>{o.push(this.Jn(t,r,n,c))})),Qe.waitFor(o)}Wn(t){let r=1;return x0(t).ee({index:R$,reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},((n,i,a)=>{a.done(),r=i.sequenceNumber+1})).next((()=>r))}createRange(t,r,n){n=n.sort(((o,c)=>Lh(o,c))).filter(((o,c,h)=>!c||Lh(o,h[c-1])!==0));const i=[];i.push(t);for(const o of n){const c=Lh(o,t),h=Lh(o,r);if(c===0)i[0]=t.In();else if(c>0&&h<0)i.push(o),i.push(o.In());else if(h>0)break}i.push(r);const a=[];for(let o=0;o0}getMinOffsetFromCollectionGroup(t,r){return this.getFieldIndexes(t,r).next(kD)}getMinOffset(t,r){return Qe.mapArray(this.vn(r),(n=>this.Fn(t,n).next((i=>i||Tr(44426))))).next(kD)}}function AD(e){return Ca(e,dy)}function g0(e){return Ca(e,B1)}function Yx(e){return Ca(e,zI)}function x0(e){return Ca(e,U1)}function kD(e){Yr(e.length!==0,28825);let t=e[0].indexState.offset,r=t.largestBatchId;for(let n=1;n(c++,w.delete())));a.push(h.next((()=>{Yr(c===1,47070,{batchId:r.batchId})})));const f=[];for(const m of r.mutations){const y=T$(t,m.key.path,r.batchId);a.push(i.delete(y)),f.push(m.key)}return Qe.waitFor(a).next((()=>f))}function N2(e){if(!e)return 0;let t;if(e.document)t=e.document;else if(e.unknownDocument)t=e.unknownDocument;else{if(!e.noDocument)throw Tr(14731);t=e.noDocument}return JSON.stringify(t).length}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */No.DEFAULT_COLLECTION_PERCENTILE=10,No.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,No.DEFAULT=new No(VH,No.DEFAULT_COLLECTION_PERCENTILE,No.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),No.DISABLED=new No(-1,0,0);class vE{constructor(t,r,n,i){this.userId=t,this.serializer=r,this.indexManager=n,this.referenceDelegate=i,this.Zn={}}static wt(t,r,n,i){Yr(t.uid!=="",64387);const a=t.isAuthenticated()?t.uid:"";return new vE(a,r,n,i)}checkEmpty(t){let r=!0;const n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return Uh(t).ee({index:wp,range:n},((i,a,o)=>{r=!1,o.done()})).next((()=>r))}addMutationBatch(t,r,n,i){const a=O0(t),o=Uh(t);return o.add({}).next((c=>{Yr(typeof c=="number",49019);const h=new YI(c,r,n,i),f=(function(A,S,j){const T=j.baseMutations.map((V=>b2(A.yt,V))),D=j.mutations.map((V=>b2(A.yt,V)));return{userId:S,batchId:j.batchId,localWriteTimeMs:j.localWriteTime.toMillis(),baseMutations:T,mutations:D}})(this.serializer,this.userId,h),m=[];let y=new qi(((w,A)=>kn(w.canonicalString(),A.canonicalString())));for(const w of i){const A=T$(this.userId,w.key.path,c);y=y.add(w.key.path.popLast()),m.push(o.put(f)),m.push(a.put(A,mce))}return y.forEach((w=>{m.push(this.indexManager.addToCollectionParentIndex(t,w))})),t.addOnCommittedListener((()=>{this.Zn[c]=h.keys()})),Qe.waitFor(m).next((()=>h))}))}lookupMutationBatch(t,r){return Uh(t).get(r).next((n=>n?(Yr(n.userId===this.userId,48,"Unexpected user for mutation batch",{userId:n.userId,batchId:r}),pp(this.serializer,n)):null))}Xn(t,r){return this.Zn[r]?Qe.resolve(this.Zn[r]):this.lookupMutationBatch(t,r).next((n=>{if(n){const i=n.keys();return this.Zn[r]=i,i}return null}))}getNextMutationBatchAfterBatchId(t,r){const n=r+1,i=IDBKeyRange.lowerBound([this.userId,n]);let a=null;return Uh(t).ee({index:wp,range:i},((o,c,h)=>{c.userId===this.userId&&(Yr(c.batchId>=n,47524,{Yn:n}),a=pp(this.serializer,c)),h.done()})).next((()=>a))}getHighestUnacknowledgedBatchId(t){const r=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]);let n=Pp;return Uh(t).ee({index:wp,range:r,reverse:!0},((i,a,o)=>{n=a.batchId,o.done()})).next((()=>n))}getAllMutationBatches(t){const r=IDBKeyRange.bound([this.userId,Pp],[this.userId,Number.POSITIVE_INFINITY]);return Uh(t).J(wp,r).next((n=>n.map((i=>pp(this.serializer,i)))))}getAllMutationBatchesAffectingDocumentKey(t,r){const n=Sw(this.userId,r.path),i=IDBKeyRange.lowerBound(n),a=[];return O0(t).ee({range:i},((o,c,h)=>{const[f,m,y]=o,w=ju(m);if(f===this.userId&&r.path.isEqual(w))return Uh(t).get(y).next((A=>{if(!A)throw Tr(61480,{er:o,batchId:y});Yr(A.userId===this.userId,10503,"Unexpected user for mutation batch",{userId:A.userId,batchId:y}),a.push(pp(this.serializer,A))}));h.done()})).next((()=>a))}getAllMutationBatchesAffectingDocumentKeys(t,r){let n=new qi(kn);const i=[];return r.forEach((a=>{const o=Sw(this.userId,a.path),c=IDBKeyRange.lowerBound(o),h=O0(t).ee({range:c},((f,m,y)=>{const[w,A,S]=f,j=ju(A);w===this.userId&&a.path.isEqual(j)?n=n.add(S):y.done()}));i.push(h)})),Qe.waitFor(i).next((()=>this.tr(t,n)))}getAllMutationBatchesAffectingQuery(t,r){const n=r.path,i=n.length+1,a=Sw(this.userId,n),o=IDBKeyRange.lowerBound(a);let c=new qi(kn);return O0(t).ee({range:o},((h,f,m)=>{const[y,w,A]=h,S=ju(w);y===this.userId&&n.isPrefixOf(S)?S.length===i&&(c=c.add(A)):m.done()})).next((()=>this.tr(t,c)))}tr(t,r){const n=[],i=[];return r.forEach((a=>{i.push(Uh(t).get(a).next((o=>{if(o===null)throw Tr(35274,{batchId:a});Yr(o.userId===this.userId,9748,"Unexpected user for mutation batch",{userId:o.userId,batchId:a}),n.push(pp(this.serializer,o))})))})),Qe.waitFor(i).next((()=>n))}removeMutationBatch(t,r){return FH(t.le,this.userId,r).next((n=>(t.addOnCommittedListener((()=>{this.nr(r.batchId)})),Qe.forEach(n,(i=>this.referenceDelegate.markPotentiallyOrphaned(t,i))))))}nr(t){delete this.Zn[t]}performConsistencyCheck(t){return this.checkEmpty(t).next((r=>{if(!r)return Qe.resolve();const n=IDBKeyRange.lowerBound((function(o){return[o]})(this.userId)),i=[];return O0(t).ee({range:n},((a,o,c)=>{if(a[0]===this.userId){const h=ju(a[1]);i.push(h)}else c.done()})).next((()=>{Yr(i.length===0,56720,{rr:i.map((a=>a.canonicalString()))})}))}))}containsKey(t,r){return $H(t,this.userId,r)}ir(t){return HH(t).get(this.userId).next((r=>r||{userId:this.userId,lastAcknowledgedBatchId:Pp,lastStreamToken:""}))}}function $H(e,t,r){const n=Sw(t,r.path),i=n[1],a=IDBKeyRange.lowerBound(n);let o=!1;return O0(e).ee({range:a,Y:!0},((c,h,f)=>{const[m,y,w]=c;m===t&&y===i&&(o=!0),f.done()})).next((()=>o))}function Uh(e){return Ca(e,Bc)}function O0(e){return Ca(e,cg)}function HH(e){return Ca(e,cy)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class im{constructor(t){this.sr=t}next(){return this.sr+=2,this.sr}static _r(){return new im(0)}static ar(){return new im(-1)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class $ue{constructor(t,r){this.referenceDelegate=t,this.serializer=r}allocateTargetId(t){return this.ur(t).next((r=>{const n=new im(r.highestTargetId);return r.highestTargetId=n.next(),this.cr(t,r).next((()=>r.highestTargetId))}))}getLastRemoteSnapshotVersion(t){return this.ur(t).next((r=>sn.fromTimestamp(new wn(r.lastRemoteSnapshotVersion.seconds,r.lastRemoteSnapshotVersion.nanoseconds))))}getHighestSequenceNumber(t){return this.ur(t).next((r=>r.highestListenSequenceNumber))}setTargetsMetadata(t,r,n){return this.ur(t).next((i=>(i.highestListenSequenceNumber=r,n&&(i.lastRemoteSnapshotVersion=n.toTimestamp()),r>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=r),this.cr(t,i))))}addTargetData(t,r){return this.lr(t,r).next((()=>this.ur(t).next((n=>(n.targetCount+=1,this.hr(r,n),this.cr(t,n))))))}updateTargetData(t,r){return this.lr(t,r)}removeTargetData(t,r){return this.removeMatchingKeysForTargetId(t,r.targetId).next((()=>y0(t).delete(r.targetId))).next((()=>this.ur(t))).next((n=>(Yr(n.targetCount>0,8065),n.targetCount-=1,this.cr(t,n))))}removeTargets(t,r,n){let i=0;const a=[];return y0(t).ee(((o,c)=>{const h=k1(c);h.sequenceNumber<=r&&n.get(h.targetId)===null&&(i++,a.push(this.removeTargetData(t,h)))})).next((()=>Qe.waitFor(a))).next((()=>i))}forEachTarget(t,r){return y0(t).ee(((n,i)=>{const a=k1(i);r(a)}))}ur(t){return SD(t).get(p2).next((r=>(Yr(r!==null,2888),r)))}cr(t,r){return SD(t).put(p2,r)}lr(t,r){return y0(t).put(LH(this.serializer,r))}hr(t,r){let n=!1;return t.targetId>r.highestTargetId&&(r.highestTargetId=t.targetId,n=!0),t.sequenceNumber>r.highestListenSequenceNumber&&(r.highestListenSequenceNumber=t.sequenceNumber,n=!0),n}getTargetCount(t){return this.ur(t).next((r=>r.targetCount))}getTargetData(t,r){const n=Jp(r),i=IDBKeyRange.bound([n,Number.NEGATIVE_INFINITY],[n,Number.POSITIVE_INFINITY]);let a=null;return y0(t).ee({range:i,index:O$},((o,c,h)=>{const f=k1(c);Ky(r,f.target)&&(a=f,h.done())})).next((()=>a))}addMatchingKeys(t,r,n){const i=[],a=ef(t);return r.forEach((o=>{const c=Co(o.path);i.push(a.put({targetId:n,path:c})),i.push(this.referenceDelegate.addReference(t,n,o))})),Qe.waitFor(i)}removeMatchingKeys(t,r,n){const i=ef(t);return Qe.forEach(r,(a=>{const o=Co(a.path);return Qe.waitFor([i.delete([n,o]),this.referenceDelegate.removeReference(t,n,a)])}))}removeMatchingKeysForTargetId(t,r){const n=ef(t),i=IDBKeyRange.bound([r],[r+1],!1,!0);return n.delete(i)}getMatchingKeysForTargetId(t,r){const n=IDBKeyRange.bound([r],[r+1],!1,!0),i=ef(t);let a=qn();return i.ee({range:n,Y:!0},((o,c,h)=>{const f=ju(o[1]),m=new hr(f);a=a.add(m)})).next((()=>a))}containsKey(t,r){const n=Co(r.path),i=IDBKeyRange.bound([n],[E$(n)],!1,!0);let a=0;return ef(t).ee({index:BI,Y:!0,range:i},(([o,c],h,f)=>{o!==0&&(a++,f.done())})).next((()=>a>0))}At(t,r){return y0(t).get(r).next((n=>n?k1(n):null))}}function y0(e){return Ca(e,ug)}function SD(e){return Ca(e,Op)}function ef(e){return Ca(e,dg)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const CD="LruGarbageCollector",GH=1048576;function jD([e,t],[r,n]){const i=kn(e,r);return i===0?kn(t,n):i}class Hue{constructor(t){this.Pr=t,this.buffer=new qi(jD),this.Tr=0}Er(){return++this.Tr}Ir(t){const r=[t,this.Er()];if(this.buffer.size{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(r){Cf(r)?$t(CD,"Ignoring IndexedDB error during garbage collection: ",r):await Sf(r)}await this.Ar(3e5)}))}}class Gue{constructor(t,r){this.Vr=t,this.params=r}calculateTargetCount(t,r){return this.Vr.dr(t).next((n=>Math.floor(r/100*n)))}nthSequenceNumber(t,r){if(r===0)return Qe.resolve(dl.ce);const n=new Hue(r);return this.Vr.forEachTarget(t,(i=>n.Ir(i.sequenceNumber))).next((()=>this.Vr.mr(t,(i=>n.Ir(i))))).next((()=>n.maxValue))}removeTargets(t,r,n){return this.Vr.removeTargets(t,r,n)}removeOrphanedDocuments(t,r){return this.Vr.removeOrphanedDocuments(t,r)}collect(t,r){return this.params.cacheSizeCollectionThreshold===-1?($t("LruGarbageCollector","Garbage collection skipped; disabled"),Qe.resolve(_D)):this.getCacheSize(t).next((n=>n(y>this.params.maximumSequenceNumbersToCollect?($t("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${y}`),i=this.params.maximumSequenceNumbersToCollect):i=y,o=Date.now(),this.nthSequenceNumber(t,i)))).next((y=>(n=y,c=Date.now(),this.removeTargets(t,n,r)))).next((y=>(a=y,h=Date.now(),this.removeOrphanedDocuments(t,n)))).next((y=>(f=Date.now(),I0()<=oi.DEBUG&&$t("LruGarbageCollector",`LRU Garbage Collection Counted targets in ${o-m}ms Determined least recently used ${i} in `+(c-o)+`ms Removed ${a} targets in `+(h-c)+`ms Removed ${y} documents in `+(f-h)+`ms Total Duration: ${f-m}ms`),Qe.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:a,documentsRemoved:y}))))}}function WH(e,t){return new Gue(e,t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class que{constructor(t,r){this.db=t,this.garbageCollector=WH(this,r)}dr(t){const r=this.pr(t);return this.db.getTargetCache().getTargetCount(t).next((n=>r.next((i=>n+i))))}pr(t){let r=0;return this.mr(t,(n=>{r++})).next((()=>r))}forEachTarget(t,r){return this.db.getTargetCache().forEachTarget(t,r)}mr(t,r){return this.yr(t,((n,i)=>r(i)))}addReference(t,r,n){return Dv(t,n)}removeReference(t,r,n){return Dv(t,n)}removeTargets(t,r,n){return this.db.getTargetCache().removeTargets(t,r,n)}markPotentiallyOrphaned(t,r){return Dv(t,r)}wr(t,r){return(function(i,a){let o=!1;return HH(i).te((c=>$H(i,c,a).next((h=>(h&&(o=!0),Qe.resolve(!h)))))).next((()=>o))})(t,r)}removeOrphanedDocuments(t,r){const n=this.db.getRemoteDocumentCache().newChangeBuffer(),i=[];let a=0;return this.yr(t,((o,c)=>{if(c<=r){const h=this.wr(t,o).next((f=>{if(!f)return a++,n.getEntry(t,o).next((()=>(n.removeEntry(o,sn.min()),ef(t).delete((function(y){return[0,Co(y.path)]})(o)))))}));i.push(h)}})).next((()=>Qe.waitFor(i))).next((()=>n.apply(t))).next((()=>a))}removeTarget(t,r){const n=r.withSequenceNumber(t.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(t,n)}updateLimboDocument(t,r){return Dv(t,r)}yr(t,r){const n=ef(t);let i,a=dl.ce;return n.ee({index:BI},(([o,c],{path:h,sequenceNumber:f})=>{o===0?(a!==dl.ce&&r(new hr(ju(i)),a),a=f,i=h):a=dl.ce})).next((()=>{a!==dl.ce&&r(new hr(ju(i)),a)}))}getCacheSize(t){return this.db.getRemoteDocumentCache().getSize(t)}}function Dv(e,t){return ef(e).put((function(n,i){return{targetId:0,path:Co(n.path),sequenceNumber:i}})(t,e.currentSequenceNumber))}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class KH{constructor(){this.changes=new Xd((t=>t.toString()),((t,r)=>t.isEqual(r))),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,r){this.assertNotApplied(),this.changes.set(t,qs.newInvalidDocument(t).setReadTime(r))}getEntry(t,r){this.assertNotApplied();const n=this.changes.get(r);return n!==void 0?Qe.resolve(n):this.getFromCache(t,r)}getEntries(t,r){return this.getAllFromCache(t,r)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Wue{constructor(t){this.serializer=t}setIndexManager(t){this.indexManager=t}addEntry(t,r,n){return Qf(t).put(n)}removeEntry(t,r,n){return Qf(t).delete((function(a,o){const c=a.path.toArray();return[c.slice(0,c.length-2),c[c.length-2],v2(o),c[c.length-1]]})(r,n))}updateMetadata(t,r){return this.getMetadata(t).next((n=>(n.byteSize+=r,this.Sr(t,n))))}getEntry(t,r){let n=qs.newInvalidDocument(r);return Qf(t).ee({index:Cw,range:IDBKeyRange.only(Xx(r))},((i,a)=>{n=this.br(r,a)})).next((()=>n))}Dr(t,r){let n={size:0,document:qs.newInvalidDocument(r)};return Qf(t).ee({index:Cw,range:IDBKeyRange.only(Xx(r))},((i,a)=>{n={document:this.br(r,a),size:N2(a)}})).next((()=>n))}getEntries(t,r){let n=Bl();return this.Cr(t,r,((i,a)=>{const o=this.br(i,a);n=n.insert(i,o)})).next((()=>n))}vr(t,r){let n=Bl(),i=new ls(hr.comparator);return this.Cr(t,r,((a,o)=>{const c=this.br(a,o);n=n.insert(a,c),i=i.insert(a,N2(o))})).next((()=>({documents:n,Fr:i})))}Cr(t,r,n){if(r.isEmpty())return Qe.resolve();let i=new qi(PD);r.forEach((h=>i=i.add(h)));const a=IDBKeyRange.bound(Xx(i.first()),Xx(i.last())),o=i.getIterator();let c=o.getNext();return Qf(t).ee({index:Cw,range:a},((h,f,m)=>{const y=hr.fromSegments([...f.prefixPath,f.collectionGroup,f.documentId]);for(;c&&PD(c,y)<0;)n(c,null),c=o.getNext();c&&c.isEqual(y)&&(n(c,f),c=o.hasNext()?o.getNext():null),c?m.j(Xx(c)):m.done()})).next((()=>{for(;c;)n(c,null),c=o.hasNext()?o.getNext():null}))}getDocumentsMatchingQuery(t,r,n,i,a){const o=r.path,c=[o.popLast().toArray(),o.lastSegment(),v2(n.readTime),n.documentKey.path.isEmpty()?"":n.documentKey.path.lastSegment()],h=[o.popLast().toArray(),o.lastSegment(),[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],""];return Qf(t).J(IDBKeyRange.bound(c,h,!0)).next((f=>{a==null||a.incrementDocumentReadCount(f.length);let m=Bl();for(const y of f){const w=this.br(hr.fromSegments(y.prefixPath.concat(y.collectionGroup,y.documentId)),y);w.isFoundDocument()&&(Xy(r,w)||i.has(w.key))&&(m=m.insert(w.key,w))}return m}))}getAllFromCollectionGroup(t,r,n,i){let a=Bl();const o=TD(r,n),c=TD(r,ql.max());return Qf(t).ee({index:P$,range:IDBKeyRange.bound(o,c,!0)},((h,f,m)=>{const y=this.br(hr.fromSegments(f.prefixPath.concat(f.collectionGroup,f.documentId)),f);a=a.insert(y.key,y),a.size===i&&m.done()})).next((()=>a))}newChangeBuffer(t){return new Kue(this,!!t&&t.trackRemovals)}getSize(t){return this.getMetadata(t).next((r=>r.byteSize))}getMetadata(t){return ID(t).get(tC).next((r=>(Yr(!!r,20021),r)))}Sr(t,r){return ID(t).put(tC,r)}br(t,r){if(r){const n=Oue(this.serializer,r);if(!(n.isNoDocument()&&n.version.isEqual(sn.min())))return n}return qs.newInvalidDocument(t)}}function YH(e){return new Wue(e)}class Kue extends KH{constructor(t,r){super(),this.Mr=t,this.trackRemovals=r,this.Or=new Xd((n=>n.toString()),((n,i)=>n.isEqual(i)))}applyChanges(t){const r=[];let n=0,i=new qi(((a,o)=>kn(a.canonicalString(),o.canonicalString())));return this.changes.forEach(((a,o)=>{const c=this.Or.get(a);if(r.push(this.Mr.removeEntry(t,a,c.readTime)),o.isValidDocument()){const h=fD(this.Mr.serializer,o);i=i.add(a.path.popLast());const f=N2(h);n+=f-c.size,r.push(this.Mr.addEntry(t,a,h))}else if(n-=c.size,this.trackRemovals){const h=fD(this.Mr.serializer,o.convertToNoDocument(sn.min()));r.push(this.Mr.addEntry(t,a,h))}})),i.forEach((a=>{r.push(this.Mr.indexManager.addToCollectionParentIndex(t,a))})),r.push(this.Mr.updateMetadata(t,n)),Qe.waitFor(r)}getFromCache(t,r){return this.Mr.Dr(t,r).next((n=>(this.Or.set(r,{size:n.size,readTime:n.document.readTime}),n.document)))}getAllFromCache(t,r){return this.Mr.vr(t,r).next((({documents:n,Fr:i})=>(i.forEach(((a,o)=>{this.Or.set(a,{size:o,readTime:n.get(a).readTime})})),n)))}}function ID(e){return Ca(e,uy)}function Qf(e){return Ca(e,f2)}function Xx(e){const t=e.path.toArray();return[t.slice(0,t.length-2),t[t.length-2],t[t.length-1]]}function TD(e,t){const r=t.documentKey.path.toArray();return[e,v2(t.readTime),r.slice(0,r.length-2),r.length>0?r[r.length-1]:""]}function PD(e,t){const r=e.path.toArray(),n=t.path.toArray();let i=0;for(let a=0;a(n=i,this.remoteDocumentCache.getEntry(t,r)))).next((i=>(n!==null&&$1(n.mutation,i,hl.empty(),wn.now()),i)))}getDocuments(t,r){return this.remoteDocumentCache.getEntries(t,r).next((n=>this.getLocalViewOfDocuments(t,n,qn()).next((()=>n))))}getLocalViewOfDocuments(t,r,n=qn()){const i=Iu();return this.populateOverlays(t,i,r).next((()=>this.computeViews(t,r,i,n).next((a=>{let o=E1();return a.forEach(((c,h)=>{o=o.insert(c,h.overlayedDocument)})),o}))))}getOverlayedDocuments(t,r){const n=Iu();return this.populateOverlays(t,n,r).next((()=>this.computeViews(t,r,n,qn())))}populateOverlays(t,r,n){const i=[];return n.forEach((a=>{r.has(a)||i.push(a)})),this.documentOverlayCache.getOverlays(t,i).next((a=>{a.forEach(((o,c)=>{r.set(o,c)}))}))}computeViews(t,r,n,i){let a=Bl();const o=F1(),c=(function(){return F1()})();return r.forEach(((h,f)=>{const m=n.get(f.key);i.has(f.key)&&(m===void 0||m.mutation instanceof Qd)?a=a.insert(f.key,f):m!==void 0?(o.set(f.key,m.mutation.getFieldMask()),$1(m.mutation,f,m.mutation.getFieldMask(),wn.now())):o.set(f.key,hl.empty())})),this.recalculateAndSaveOverlays(t,a).next((h=>(h.forEach(((f,m)=>o.set(f,m))),r.forEach(((f,m)=>c.set(f,new Yue(m,o.get(f)??null)))),c)))}recalculateAndSaveOverlays(t,r){const n=F1();let i=new ls(((o,c)=>o-c)),a=qn();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,r).next((o=>{for(const c of o)c.keys().forEach((h=>{const f=r.get(h);if(f===null)return;let m=n.get(h)||hl.empty();m=c.applyToLocalView(f,m),n.set(h,m);const y=(i.get(c.batchId)||qn()).add(h);i=i.insert(c.batchId,y)}))})).next((()=>{const o=[],c=i.getReverseIterator();for(;c.hasNext();){const h=c.getNext(),f=h.key,m=h.value,y=hH();m.forEach((w=>{if(!a.has(w)){const A=bH(r.get(w),n.get(w));A!==null&&y.set(w,A),a=a.add(w)}})),o.push(this.documentOverlayCache.saveOverlays(t,f,y))}return Qe.waitFor(o)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,r){return this.remoteDocumentCache.getEntries(t,r).next((n=>this.recalculateAndSaveOverlays(t,n)))}getDocumentsMatchingQuery(t,r,n,i){return Jce(r)?this.getDocumentsMatchingDocumentQuery(t,r.path):sH(r)?this.getDocumentsMatchingCollectionGroupQuery(t,r,n,i):this.getDocumentsMatchingCollectionQuery(t,r,n,i)}getNextDocuments(t,r,n,i){return this.remoteDocumentCache.getAllFromCollectionGroup(t,r,n,i).next((a=>{const o=i-a.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,r,n.largestBatchId,i-a.size):Qe.resolve(Iu());let c=lg,h=a;return o.next((f=>Qe.forEach(f,((m,y)=>(c{h=h.insert(m,w)}))))).next((()=>this.populateOverlays(t,f,a))).next((()=>this.computeViews(t,h,f,qn()))).next((m=>({batchId:c,changes:dH(m)})))))}))}getDocumentsMatchingDocumentQuery(t,r){return this.getDocument(t,new hr(r)).next((n=>{let i=E1();return n.isFoundDocument()&&(i=i.insert(n.key,n)),i}))}getDocumentsMatchingCollectionGroupQuery(t,r,n,i){const a=r.collectionGroup;let o=E1();return this.indexManager.getCollectionParents(t,a).next((c=>Qe.forEach(c,(h=>{const f=(function(y,w){return new gm(w,null,y.explicitOrderBy.slice(),y.filters.slice(),y.limit,y.limitType,y.startAt,y.endAt)})(r,h.child(a));return this.getDocumentsMatchingCollectionQuery(t,f,n,i).next((m=>{m.forEach(((y,w)=>{o=o.insert(y,w)}))}))})).next((()=>o))))}getDocumentsMatchingCollectionQuery(t,r,n,i){let a;return this.documentOverlayCache.getOverlaysForCollection(t,r.path,n.largestBatchId).next((o=>(a=o,this.remoteDocumentCache.getDocumentsMatchingQuery(t,r,n,a,i)))).next((o=>{a.forEach(((h,f)=>{const m=f.getKey();o.get(m)===null&&(o=o.insert(m,qs.newInvalidDocument(m)))}));let c=E1();return o.forEach(((h,f)=>{const m=a.get(h);m!==void 0&&$1(m.mutation,f,hl.empty(),wn.now()),Xy(r,f)&&(c=c.insert(h,f))})),c}))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Xue{constructor(t){this.serializer=t,this.Nr=new Map,this.Br=new Map}getBundleMetadata(t,r){return Qe.resolve(this.Nr.get(r))}saveBundleMetadata(t,r){return this.Nr.set(r.id,(function(i){return{id:i.id,version:i.version,createTime:Ho(i.createTime)}})(r)),Qe.resolve()}getNamedQuery(t,r){return Qe.resolve(this.Br.get(r))}saveNamedQuery(t,r){return this.Br.set(r.name,(function(i){return{name:i.name,query:UH(i.bundledQuery),readTime:Ho(i.readTime)}})(r)),Qe.resolve()}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Que{constructor(){this.overlays=new ls(hr.comparator),this.Lr=new Map}getOverlay(t,r){return Qe.resolve(this.overlays.get(r))}getOverlays(t,r){const n=Iu();return Qe.forEach(r,(i=>this.getOverlay(t,i).next((a=>{a!==null&&n.set(i,a)})))).next((()=>n))}saveOverlays(t,r,n){return n.forEach(((i,a)=>{this.St(t,r,a)})),Qe.resolve()}removeOverlaysForBatchId(t,r,n){const i=this.Lr.get(n);return i!==void 0&&(i.forEach((a=>this.overlays=this.overlays.remove(a))),this.Lr.delete(n)),Qe.resolve()}getOverlaysForCollection(t,r,n){const i=Iu(),a=r.length+1,o=new hr(r.child("")),c=this.overlays.getIteratorFrom(o);for(;c.hasNext();){const h=c.getNext().value,f=h.getKey();if(!r.isPrefixOf(f.path))break;f.path.length===a&&h.largestBatchId>n&&i.set(h.getKey(),h)}return Qe.resolve(i)}getOverlaysForCollectionGroup(t,r,n,i){let a=new ls(((f,m)=>f-m));const o=this.overlays.getIterator();for(;o.hasNext();){const f=o.getNext().value;if(f.getKey().getCollectionGroup()===r&&f.largestBatchId>n){let m=a.get(f.largestBatchId);m===null&&(m=Iu(),a=a.insert(f.largestBatchId,m)),m.set(f.getKey(),f)}}const c=Iu(),h=a.getIterator();for(;h.hasNext()&&(h.getNext().value.forEach(((f,m)=>c.set(f,m))),!(c.size()>=i)););return Qe.resolve(c)}St(t,r,n){const i=this.overlays.get(n.key);if(i!==null){const o=this.Lr.get(i.largestBatchId).delete(n.key);this.Lr.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(n.key,new QI(r,n));let a=this.Lr.get(r);a===void 0&&(a=qn(),this.Lr.set(r,a)),this.Lr.set(r,a.add(n.key))}}/** * @license * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Zue{constructor(){this.sessionToken=Zs.EMPTY_BYTE_STRING}getSessionToken(t){return Qe.resolve(this.sessionToken)}setSessionToken(t,r){return this.sessionToken=r,Qe.resolve()}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class nT{constructor(){this.kr=new qi(Ua.qr),this.Kr=new qi(Ua.Ur)}isEmpty(){return this.kr.isEmpty()}addReference(t,r){const n=new Ua(t,r);this.kr=this.kr.add(n),this.Kr=this.Kr.add(n)}$r(t,r){t.forEach((n=>this.addReference(n,r)))}removeReference(t,r){this.Wr(new Ua(t,r))}Qr(t,r){t.forEach((n=>this.removeReference(n,r)))}Gr(t){const r=new hr(new ki([])),n=new Ua(r,t),i=new Ua(r,t+1),a=[];return this.Kr.forEachInRange([n,i],(o=>{this.Wr(o),a.push(o.key)})),a}zr(){this.kr.forEach((t=>this.Wr(t)))}Wr(t){this.kr=this.kr.delete(t),this.Kr=this.Kr.delete(t)}jr(t){const r=new hr(new ki([])),n=new Ua(r,t),i=new Ua(r,t+1);let a=qn();return this.Kr.forEachInRange([n,i],(o=>{a=a.add(o.key)})),a}containsKey(t){const r=new Ua(t,0),n=this.kr.firstAfterOrEqual(r);return n!==null&&t.isEqual(n.key)}}class Ua{constructor(t,r){this.key=t,this.Jr=r}static qr(t,r){return hr.comparator(t.key,r.key)||kn(t.Jr,r.Jr)}static Ur(t,r){return kn(t.Jr,r.Jr)||hr.comparator(t.key,r.key)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Jue{constructor(t,r){this.indexManager=t,this.referenceDelegate=r,this.mutationQueue=[],this.Yn=1,this.Hr=new qi(Ua.qr)}checkEmpty(t){return Qe.resolve(this.mutationQueue.length===0)}addMutationBatch(t,r,n,i){const a=this.Yn;this.Yn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new YI(a,r,n,i);this.mutationQueue.push(o);for(const c of i)this.Hr=this.Hr.add(new Ua(c.key,a)),this.indexManager.addToCollectionParentIndex(t,c.key.path.popLast());return Qe.resolve(o)}lookupMutationBatch(t,r){return Qe.resolve(this.Zr(r))}getNextMutationBatchAfterBatchId(t,r){const n=r+1,i=this.Xr(n),a=i<0?0:i;return Qe.resolve(this.mutationQueue.length>a?this.mutationQueue[a]:null)}getHighestUnacknowledgedBatchId(){return Qe.resolve(this.mutationQueue.length===0?Pp:this.Yn-1)}getAllMutationBatches(t){return Qe.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,r){const n=new Ua(r,0),i=new Ua(r,Number.POSITIVE_INFINITY),a=[];return this.Hr.forEachInRange([n,i],(o=>{const c=this.Zr(o.Jr);a.push(c)})),Qe.resolve(a)}getAllMutationBatchesAffectingDocumentKeys(t,r){let n=new qi(kn);return r.forEach((i=>{const a=new Ua(i,0),o=new Ua(i,Number.POSITIVE_INFINITY);this.Hr.forEachInRange([a,o],(c=>{n=n.add(c.Jr)}))})),Qe.resolve(this.Yr(n))}getAllMutationBatchesAffectingQuery(t,r){const n=r.path,i=n.length+1;let a=n;hr.isDocumentKey(a)||(a=a.child(""));const o=new Ua(new hr(a),0);let c=new qi(kn);return this.Hr.forEachWhile((h=>{const f=h.key.path;return!!n.isPrefixOf(f)&&(f.length===i&&(c=c.add(h.Jr)),!0)}),o),Qe.resolve(this.Yr(c))}Yr(t){const r=[];return t.forEach((n=>{const i=this.Zr(n);i!==null&&r.push(i)})),r}removeMutationBatch(t,r){Yr(this.ei(r.batchId,"removed")===0,55003),this.mutationQueue.shift();let n=this.Hr;return Qe.forEach(r.mutations,(i=>{const a=new Ua(i.key,r.batchId);return n=n.delete(a),this.referenceDelegate.markPotentiallyOrphaned(t,i.key)})).next((()=>{this.Hr=n}))}nr(t){}containsKey(t,r){const n=new Ua(r,0),i=this.Hr.firstAfterOrEqual(n);return Qe.resolve(r.isEqual(i&&i.key))}performConsistencyCheck(t){return this.mutationQueue.length,Qe.resolve()}ei(t,r){return this.Xr(t)}Xr(t){return this.mutationQueue.length===0?0:t-this.mutationQueue[0].batchId}Zr(t){const r=this.Xr(t);return r<0||r>=this.mutationQueue.length?null:this.mutationQueue[r]}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ede{constructor(t){this.ti=t,this.docs=(function(){return new ls(hr.comparator)})(),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,r){const n=r.key,i=this.docs.get(n),a=i?i.size:0,o=this.ti(r);return this.docs=this.docs.insert(n,{document:r.mutableCopy(),size:o}),this.size+=o-a,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const r=this.docs.get(t);r&&(this.docs=this.docs.remove(t),this.size-=r.size)}getEntry(t,r){const n=this.docs.get(r);return Qe.resolve(n?n.document.mutableCopy():qs.newInvalidDocument(r))}getEntries(t,r){let n=Bl();return r.forEach((i=>{const a=this.docs.get(i);n=n.insert(i,a?a.document.mutableCopy():qs.newInvalidDocument(i))})),Qe.resolve(n)}getDocumentsMatchingQuery(t,r,n,i){let a=Bl();const o=r.path,c=new hr(o.child("__id-9223372036854775808__")),h=this.docs.getIteratorFrom(c);for(;h.hasNext();){const{key:f,value:{document:m}}=h.getNext();if(!o.isPrefixOf(f.path))break;f.path.length>o.length+1||LI(_$(m),n)<=0||(i.has(m.key)||Xy(r,m))&&(a=a.insert(m.key,m.mutableCopy()))}return Qe.resolve(a)}getAllFromCollectionGroup(t,r,n,i){Tr(9500)}ni(t,r){return Qe.forEach(this.docs,(n=>r(n)))}newChangeBuffer(t){return new tde(this)}getSize(t){return Qe.resolve(this.size)}}class tde extends KH{constructor(t){super(),this.Mr=t}applyChanges(t){const r=[];return this.changes.forEach(((n,i)=>{i.isValidDocument()?r.push(this.Mr.addEntry(t,i)):this.Mr.removeEntry(n)})),Qe.waitFor(r)}getFromCache(t,r){return this.Mr.getEntry(t,r)}getAllFromCache(t,r){return this.Mr.getEntries(t,r)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class rde{constructor(t){this.persistence=t,this.ri=new Xd((r=>Jp(r)),Ky),this.lastRemoteSnapshotVersion=sn.min(),this.highestTargetId=0,this.ii=0,this.si=new nT,this.targetCount=0,this.oi=im._r()}forEachTarget(t,r){return this.ri.forEach(((n,i)=>r(i))),Qe.resolve()}getLastRemoteSnapshotVersion(t){return Qe.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return Qe.resolve(this.ii)}allocateTargetId(t){return this.highestTargetId=this.oi.next(),Qe.resolve(this.highestTargetId)}setTargetsMetadata(t,r,n){return n&&(this.lastRemoteSnapshotVersion=n),r>this.ii&&(this.ii=r),Qe.resolve()}lr(t){this.ri.set(t.target,t);const r=t.targetId;r>this.highestTargetId&&(this.oi=new im(r),this.highestTargetId=r),t.sequenceNumber>this.ii&&(this.ii=t.sequenceNumber)}addTargetData(t,r){return this.lr(r),this.targetCount+=1,Qe.resolve()}updateTargetData(t,r){return this.lr(r),Qe.resolve()}removeTargetData(t,r){return this.ri.delete(r.target),this.si.Gr(r.targetId),this.targetCount-=1,Qe.resolve()}removeTargets(t,r,n){let i=0;const a=[];return this.ri.forEach(((o,c)=>{c.sequenceNumber<=r&&n.get(c.targetId)===null&&(this.ri.delete(o),a.push(this.removeMatchingKeysForTargetId(t,c.targetId)),i++)})),Qe.waitFor(a).next((()=>i))}getTargetCount(t){return Qe.resolve(this.targetCount)}getTargetData(t,r){const n=this.ri.get(r)||null;return Qe.resolve(n)}addMatchingKeys(t,r,n){return this.si.$r(r,n),Qe.resolve()}removeMatchingKeys(t,r,n){this.si.Qr(r,n);const i=this.persistence.referenceDelegate,a=[];return i&&r.forEach((o=>{a.push(i.markPotentiallyOrphaned(t,o))})),Qe.waitFor(a)}removeMatchingKeysForTargetId(t,r){return this.si.Gr(r),Qe.resolve()}getMatchingKeysForTargetId(t,r){const n=this.si.jr(r);return Qe.resolve(n)}containsKey(t,r){return Qe.resolve(this.si.containsKey(r))}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class iT{constructor(t,r){this._i={},this.overlays={},this.ai=new dl(0),this.ui=!1,this.ui=!0,this.ci=new Zue,this.referenceDelegate=t(this),this.li=new rde(this),this.indexManager=new Vue,this.remoteDocumentCache=(function(i){return new ede(i)})((n=>this.referenceDelegate.hi(n))),this.serializer=new MH(r),this.Pi=new Xue(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ui=!1,Promise.resolve()}get started(){return this.ui}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let r=this.overlays[t.toKey()];return r||(r=new Que,this.overlays[t.toKey()]=r),r}getMutationQueue(t,r){let n=this._i[t.toKey()];return n||(n=new Jue(r,this.referenceDelegate),this._i[t.toKey()]=n),n}getGlobalsCache(){return this.ci}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Pi}runTransaction(t,r,n){$t("MemoryPersistence","Starting transaction:",t);const i=new nde(this.ai.next());return this.referenceDelegate.Ti(),n(i).next((a=>this.referenceDelegate.Ei(i).next((()=>a)))).toPromise().then((a=>(i.raiseOnCommittedEvent(),a)))}Ii(t,r){return Qe.or(Object.values(this._i).map((n=>()=>n.containsKey(t,r))))}}class nde extends C${constructor(t){super(),this.currentSequenceNumber=t}}class wE{constructor(t){this.persistence=t,this.Ri=new nT,this.Ai=null}static Vi(t){return new wE(t)}get di(){if(this.Ai)return this.Ai;throw Tr(60996)}addReference(t,r,n){return this.Ri.addReference(n,r),this.di.delete(n.toString()),Qe.resolve()}removeReference(t,r,n){return this.Ri.removeReference(n,r),this.di.add(n.toString()),Qe.resolve()}markPotentiallyOrphaned(t,r){return this.di.add(r.toString()),Qe.resolve()}removeTarget(t,r){this.Ri.Gr(r.targetId).forEach((i=>this.di.add(i.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,r.targetId).next((i=>{i.forEach((a=>this.di.add(a.toString())))})).next((()=>n.removeTargetData(t,r)))}Ti(){this.Ai=new Set}Ei(t){const r=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Qe.forEach(this.di,(n=>{const i=hr.fromPath(n);return this.mi(t,i).next((a=>{a||r.removeEntry(i,sn.min())}))})).next((()=>(this.Ai=null,r.apply(t))))}updateLimboDocument(t,r){return this.mi(t,r).next((n=>{n?this.di.delete(r.toString()):this.di.add(r.toString())}))}hi(t){return 0}mi(t,r){return Qe.or([()=>Qe.resolve(this.Ri.containsKey(r)),()=>this.persistence.getTargetCache().containsKey(t,r),()=>this.persistence.Ii(t,r)])}}class E2{constructor(t,r){this.persistence=t,this.fi=new Xd((n=>Co(n.path)),((n,i)=>n.isEqual(i))),this.garbageCollector=WH(this,r)}static Vi(t,r){return new E2(t,r)}Ti(){}Ei(t){return Qe.resolve()}forEachTarget(t,r){return this.persistence.getTargetCache().forEachTarget(t,r)}dr(t){const r=this.pr(t);return this.persistence.getTargetCache().getTargetCount(t).next((n=>r.next((i=>n+i))))}pr(t){let r=0;return this.mr(t,(n=>{r++})).next((()=>r))}mr(t,r){return Qe.forEach(this.fi,((n,i)=>this.wr(t,n,i).next((a=>a?Qe.resolve():r(i)))))}removeTargets(t,r,n){return this.persistence.getTargetCache().removeTargets(t,r,n)}removeOrphanedDocuments(t,r){let n=0;const i=this.persistence.getRemoteDocumentCache(),a=i.newChangeBuffer();return i.ni(t,(o=>this.wr(t,o,r).next((c=>{c||(n++,a.removeEntry(o,sn.min()))})))).next((()=>a.apply(t))).next((()=>n))}markPotentiallyOrphaned(t,r){return this.fi.set(r,t.currentSequenceNumber),Qe.resolve()}removeTarget(t,r){const n=r.withSequenceNumber(t.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(t,n)}addReference(t,r,n){return this.fi.set(n,t.currentSequenceNumber),Qe.resolve()}removeReference(t,r,n){return this.fi.set(n,t.currentSequenceNumber),Qe.resolve()}updateLimboDocument(t,r){return this.fi.set(r,t.currentSequenceNumber),Qe.resolve()}hi(t){let r=t.key.toString().length;return t.isFoundDocument()&&(r+=Iw(t.data.value)),r}wr(t,r,n){return Qe.or([()=>this.persistence.Ii(t,r),()=>this.persistence.getTargetCache().containsKey(t,r),()=>{const i=this.fi.get(r);return Qe.resolve(i!==void 0&&i>n)}])}getCacheSize(t){return this.persistence.getRemoteDocumentCache().getSize(t)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ide{constructor(t){this.serializer=t}k(t,r,n,i){const a=new lE("createOrUpgrade",r);n<1&&i>=1&&((function(h){h.createObjectStore(Wy)})(t),(function(h){h.createObjectStore(cy,{keyPath:pce}),h.createObjectStore(Bc,{keyPath:$R,autoIncrement:!0}).createIndex(wp,HR,{unique:!0}),h.createObjectStore(cg)})(t),OD(t),(function(h){h.createObjectStore(op)})(t));let o=Qe.resolve();return n<3&&i>=3&&(n!==0&&((function(h){h.deleteObjectStore(dg),h.deleteObjectStore(ug),h.deleteObjectStore(Op)})(t),OD(t)),o=o.next((()=>(function(h){const f=h.store(Op),m={highestTargetId:0,highestListenSequenceNumber:0,lastRemoteSnapshotVersion:sn.min().toTimestamp(),targetCount:0};return f.put(p2,m)})(a)))),n<4&&i>=4&&(n!==0&&(o=o.next((()=>(function(h,f){return f.store(Bc).J().next((y=>{h.deleteObjectStore(Bc),h.createObjectStore(Bc,{keyPath:$R,autoIncrement:!0}).createIndex(wp,HR,{unique:!0});const w=f.store(Bc),A=y.map((S=>w.put(S)));return Qe.waitFor(A)}))})(t,a)))),o=o.next((()=>{(function(h){h.createObjectStore(hg,{keyPath:Ece})})(t)}))),n<5&&i>=5&&(o=o.next((()=>this.gi(a)))),n<6&&i>=6&&(o=o.next((()=>((function(h){h.createObjectStore(uy)})(t),this.pi(a))))),n<7&&i>=7&&(o=o.next((()=>this.yi(a)))),n<8&&i>=8&&(o=o.next((()=>this.wi(t,a)))),n<9&&i>=9&&(o=o.next((()=>{(function(h){h.objectStoreNames.contains("remoteDocumentChanges")&&h.deleteObjectStore("remoteDocumentChanges")})(t)}))),n<10&&i>=10&&(o=o.next((()=>this.Si(a)))),n<11&&i>=11&&(o=o.next((()=>{(function(h){h.createObjectStore(uE,{keyPath:Ace})})(t),(function(h){h.createObjectStore(dE,{keyPath:kce})})(t)}))),n<12&&i>=12&&(o=o.next((()=>{(function(h){const f=h.createObjectStore(hE,{keyPath:Pce});f.createIndex(nC,Oce,{unique:!1}),f.createIndex(M$,Rce,{unique:!1})})(t)}))),n<13&&i>=13&&(o=o.next((()=>(function(h){const f=h.createObjectStore(f2,{keyPath:gce});f.createIndex(Cw,xce),f.createIndex(P$,yce)})(t))).next((()=>this.bi(t,a))).next((()=>t.deleteObjectStore(op)))),n<14&&i>=14&&(o=o.next((()=>this.Di(t,a)))),n<15&&i>=15&&(o=o.next((()=>(function(h){h.createObjectStore(zI,{keyPath:_ce,autoIncrement:!0}).createIndex(rC,Sce,{unique:!1}),h.createObjectStore(U1,{keyPath:Cce}).createIndex(R$,jce,{unique:!1}),h.createObjectStore(B1,{keyPath:Ice}).createIndex(D$,Tce,{unique:!1})})(t)))),n<16&&i>=16&&(o=o.next((()=>{r.objectStore(U1).clear()})).next((()=>{r.objectStore(B1).clear()}))),n<17&&i>=17&&(o=o.next((()=>{(function(h){h.createObjectStore(VI,{keyPath:Dce})})(t)}))),n<18&&i>=18&&SF()&&(o=o.next((()=>{r.objectStore(U1).clear()})).next((()=>{r.objectStore(B1).clear()}))),o}pi(t){let r=0;return t.store(op).ee(((n,i)=>{r+=N2(i)})).next((()=>{const n={byteSize:r};return t.store(uy).put(tC,n)}))}gi(t){const r=t.store(cy),n=t.store(Bc);return r.J().next((i=>Qe.forEach(i,(a=>{const o=IDBKeyRange.bound([a.userId,Pp],[a.userId,a.lastAcknowledgedBatchId]);return n.J(wp,o).next((c=>Qe.forEach(c,(h=>{Yr(h.userId===a.userId,18650,"Cannot process batch from unexpected user",{batchId:h.batchId});const f=pp(this.serializer,h);return FH(t,a.userId,f).next((()=>{}))}))))}))))}yi(t){const r=t.store(dg),n=t.store(op);return t.store(Op).get(p2).next((i=>{const a=[];return n.ee(((o,c)=>{const h=new ki(o),f=(function(y){return[0,Co(y)]})(h);a.push(r.get(f).next((m=>m?Qe.resolve():(y=>r.put({targetId:0,path:Co(y),sequenceNumber:i.highestListenSequenceNumber}))(h))))})).next((()=>Qe.waitFor(a)))}))}wi(t,r){t.createObjectStore(dy,{keyPath:Nce});const n=r.store(dy),i=new rT,a=o=>{if(i.add(o)){const c=o.lastSegment(),h=o.popLast();return n.put({collectionId:c,parent:Co(h)})}};return r.store(op).ee({Y:!0},((o,c)=>{const h=new ki(o);return a(h.popLast())})).next((()=>r.store(cg).ee({Y:!0},(([o,c,h],f)=>{const m=ju(c);return a(m.popLast())}))))}Si(t){const r=t.store(ug);return r.ee(((n,i)=>{const a=k1(i),o=LH(this.serializer,a);return r.put(o)}))}bi(t,r){const n=r.store(op),i=[];return n.ee(((a,o)=>{const c=r.store(f2),h=(function(y){return y.document?new hr(ki.fromString(y.document.name).popFirst(5)):y.noDocument?hr.fromSegments(y.noDocument.path):y.unknownDocument?hr.fromSegments(y.unknownDocument.path):Tr(36783)})(o).path.toArray(),f={prefixPath:h.slice(0,h.length-2),collectionGroup:h[h.length-2],documentId:h[h.length-1],readTime:o.readTime||[0,0],unknownDocument:o.unknownDocument,noDocument:o.noDocument,document:o.document,hasCommittedMutations:!!o.hasCommittedMutations};i.push(c.put(f))})).next((()=>Qe.waitFor(i)))}Di(t,r){const n=r.store(Bc),i=YH(this.serializer),a=new iT(wE.Vi,this.serializer.yt);return n.J().next((o=>{const c=new Map;return o.forEach((h=>{let f=c.get(h.userId)??qn();pp(this.serializer,h).keys().forEach((m=>f=f.add(m))),c.set(h.userId,f)})),Qe.forEach(c,((h,f)=>{const m=new wo(f),y=bE.wt(this.serializer,m),w=a.getIndexManager(m),A=vE.wt(m,this.serializer,w,a.referenceDelegate);return new XH(i,A,y,w).recalculateAndSaveOverlaysForDocumentKeys(new iC(r,dl.ce),h).next()}))}))}}function OD(e){e.createObjectStore(dg,{keyPath:vce}).createIndex(BI,wce,{unique:!0}),e.createObjectStore(ug,{keyPath:"targetId"}).createIndex(O$,bce,{unique:!0}),e.createObjectStore(Op)}const Bh="IndexedDbPersistence",uk=18e5,dk=5e3,hk="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",sde="main";class sT{constructor(t,r,n,i,a,o,c,h,f,m,y=18){if(this.allowTabSynchronization=t,this.persistenceKey=r,this.clientId=n,this.Ci=a,this.window=o,this.document=c,this.Fi=f,this.Mi=m,this.xi=y,this.ai=null,this.ui=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Oi=null,this.inForeground=!1,this.Ni=null,this.Bi=null,this.Li=Number.NEGATIVE_INFINITY,this.ki=w=>Promise.resolve(),!sT.v())throw new tr(bt.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new que(this,i),this.qi=r+sde,this.serializer=new MH(h),this.Ki=new hf(this.qi,this.xi,new ide(this.serializer)),this.ci=new Due,this.li=new $ue(this.referenceDelegate,this.serializer),this.remoteDocumentCache=YH(this.serializer),this.Pi=new Rue,this.window&&this.window.localStorage?this.Ui=this.window.localStorage:(this.Ui=null,m===!1&&Qs(Bh,"LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}start(){return this.$i().then((()=>{if(!this.isPrimary&&!this.allowTabSynchronization)throw new tr(bt.FAILED_PRECONDITION,hk);return this.Wi(),this.Qi(),this.Gi(),this.runTransaction("getHighestListenSequenceNumber","readonly",(t=>this.li.getHighestSequenceNumber(t)))})).then((t=>{this.ai=new dl(t,this.Fi)})).then((()=>{this.ui=!0})).catch((t=>(this.Ki&&this.Ki.close(),Promise.reject(t))))}zi(t){return this.ki=async r=>{if(this.started)return t(r)},t(this.isPrimary)}setDatabaseDeletedListener(t){this.Ki.K((async r=>{r.newVersion===null&&await t()}))}setNetworkEnabled(t){this.networkEnabled!==t&&(this.networkEnabled=t,this.Ci.enqueueAndForget((async()=>{this.started&&await this.$i()})))}$i(){return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",(t=>Mv(t).put({clientId:this.clientId,updateTimeMs:Date.now(),networkEnabled:this.networkEnabled,inForeground:this.inForeground}).next((()=>{if(this.isPrimary)return this.ji(t).next((r=>{r||(this.isPrimary=!1,this.Ci.enqueueRetryable((()=>this.ki(!1))))}))})).next((()=>this.Ji(t))).next((r=>this.isPrimary&&!r?this.Hi(t).next((()=>!1)):!!r&&this.Zi(t).next((()=>!0)))))).catch((t=>{if(Cf(t))return $t(Bh,"Failed to extend owner lease: ",t),this.isPrimary;if(!this.allowTabSynchronization)throw t;return $t(Bh,"Releasing owner lease after error during lease refresh",t),!1})).then((t=>{this.isPrimary!==t&&this.Ci.enqueueRetryable((()=>this.ki(t))),this.isPrimary=t}))}ji(t){return Qx(t).get(f0).next((r=>Qe.resolve(this.Xi(r))))}Yi(t){return Mv(t).delete(this.clientId)}async es(){if(this.isPrimary&&!this.ts(this.Li,uk)){this.Li=Date.now();const t=await this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",(r=>{const n=Ca(r,hg);return n.J().next((i=>{const a=this.ns(i,uk),o=i.filter((c=>a.indexOf(c)===-1));return Qe.forEach(o,(c=>n.delete(c.clientId))).next((()=>o))}))})).catch((()=>[]));if(this.Ui)for(const r of t)this.Ui.removeItem(this.rs(r.clientId))}}Gi(){this.Bi=this.Ci.enqueueAfterDelay("client_metadata_refresh",4e3,(()=>this.$i().then((()=>this.es())).then((()=>this.Gi()))))}Xi(t){return!!t&&t.ownerId===this.clientId}Ji(t){return this.Mi?Qe.resolve(!0):Qx(t).get(f0).next((r=>{if(r!==null&&this.ts(r.leaseTimestampMs,dk)&&!this.ss(r.ownerId)){if(this.Xi(r)&&this.networkEnabled)return!0;if(!this.Xi(r)){if(!r.allowTabSynchronization)throw new tr(bt.FAILED_PRECONDITION,hk);return!1}}return!(!this.networkEnabled||!this.inForeground)||Mv(t).J().next((n=>this.ns(n,dk).find((i=>{if(this.clientId!==i.clientId){const a=!this.networkEnabled&&i.networkEnabled,o=!this.inForeground&&i.inForeground,c=this.networkEnabled===i.networkEnabled;if(a||o&&c)return!0}return!1}))===void 0))})).next((r=>(this.isPrimary!==r&&$t(Bh,`Client ${r?"is":"is not"} eligible for a primary lease.`),r)))}async shutdown(){this.ui=!1,this._s(),this.Bi&&(this.Bi.cancel(),this.Bi=null),this.us(),this.cs(),await this.Ki.runTransaction("shutdown","readwrite",[Wy,hg],(t=>{const r=new iC(t,dl.ce);return this.Hi(r).next((()=>this.Yi(r)))})),this.Ki.close(),this.ls()}ns(t,r){return t.filter((n=>this.ts(n.updateTimeMs,r)&&!this.ss(n.clientId)))}hs(){return this.runTransaction("getActiveClients","readonly",(t=>Mv(t).J().next((r=>this.ns(r,uk).map((n=>n.clientId))))))}get started(){return this.ui}getGlobalsCache(){return this.ci}getMutationQueue(t,r){return vE.wt(t,this.serializer,r,this.referenceDelegate)}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getIndexManager(t){return new Fue(t,this.serializer.yt.databaseId)}getDocumentOverlayCache(t){return bE.wt(this.serializer,t)}getBundleCache(){return this.Pi}runTransaction(t,r,n){$t(Bh,"Starting transaction:",t);const i=r==="readonly"?"readonly":"readwrite",a=(function(h){return h===18?Uce:h===17?z$:h===16?Lce:h===15?FI:h===14?B$:h===13?U$:h===12?Mce:h===11?L$:void Tr(60245)})(this.xi);let o;return this.Ki.runTransaction(t,i,a,(c=>(o=new iC(c,this.ai?this.ai.next():dl.ce),r==="readwrite-primary"?this.ji(o).next((h=>!!h||this.Ji(o))).next((h=>{if(!h)throw Qs(`Failed to obtain primary lease for action '${t}'.`),this.isPrimary=!1,this.Ci.enqueueRetryable((()=>this.ki(!1))),new tr(bt.FAILED_PRECONDITION,S$);return n(o)})).next((h=>this.Zi(o).next((()=>h)))):this.Ps(o).next((()=>n(o)))))).then((c=>(o.raiseOnCommittedEvent(),c)))}Ps(t){return Qx(t).get(f0).next((r=>{if(r!==null&&this.ts(r.leaseTimestampMs,dk)&&!this.ss(r.ownerId)&&!this.Xi(r)&&!(this.Mi||this.allowTabSynchronization&&r.allowTabSynchronization))throw new tr(bt.FAILED_PRECONDITION,hk)}))}Zi(t){const r={ownerId:this.clientId,allowTabSynchronization:this.allowTabSynchronization,leaseTimestampMs:Date.now()};return Qx(t).put(f0,r)}static v(){return hf.v()}Hi(t){const r=Qx(t);return r.get(f0).next((n=>this.Xi(n)?($t(Bh,"Releasing primary lease."),r.delete(f0)):Qe.resolve()))}ts(t,r){const n=Date.now();return!(tn)||(Qs(`Detected an update time that is in the future: ${t} > ${n}`),!1))}Wi(){this.document!==null&&typeof this.document.addEventListener=="function"&&(this.Ni=()=>{this.Ci.enqueueAndForget((()=>(this.inForeground=this.document.visibilityState==="visible",this.$i())))},this.document.addEventListener("visibilitychange",this.Ni),this.inForeground=this.document.visibilityState==="visible")}us(){this.Ni&&(this.document.removeEventListener("visibilitychange",this.Ni),this.Ni=null)}Qi(){var t;typeof((t=this.window)==null?void 0:t.addEventListener)=="function"&&(this.Oi=()=>{this._s();const r=/(?:Version|Mobile)\/1[456]/;_F()&&(navigator.appVersion.match(r)||navigator.userAgent.match(r))&&this.Ci.enterRestrictedMode(!0),this.Ci.enqueueAndForget((()=>this.shutdown()))},this.window.addEventListener("pagehide",this.Oi))}cs(){this.Oi&&(this.window.removeEventListener("pagehide",this.Oi),this.Oi=null)}ss(t){var r;try{const n=((r=this.Ui)==null?void 0:r.getItem(this.rs(t)))!==null;return $t(Bh,`Client '${t}' ${n?"is":"is not"} zombied in LocalStorage`),n}catch(n){return Qs(Bh,"Failed to get zombied client id.",n),!1}}_s(){if(this.Ui)try{this.Ui.setItem(this.rs(this.clientId),String(Date.now()))}catch(t){Qs("Failed to set zombie client id.",t)}}ls(){if(this.Ui)try{this.Ui.removeItem(this.rs(this.clientId))}catch{}}rs(t){return`firestore_zombie_${this.persistenceKey}_${t}`}}function Qx(e){return Ca(e,Wy)}function Mv(e){return Ca(e,hg)}function QH(e,t){let r=e.projectId;return e.isDefaultDatabase||(r+="."+e.database),"firestore/"+t+"/"+r+"/"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class aT{constructor(t,r,n,i){this.targetId=t,this.fromCache=r,this.Ts=n,this.Es=i}static Is(t,r){let n=qn(),i=qn();for(const a of r.docChanges)switch(a.type){case 0:n=n.add(a.doc.key);break;case 1:i=i.add(a.doc.key)}return new aT(t,r.fromCache,n,i)}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ade{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(t){this._documentReadCount+=t}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ZH{constructor(){this.Rs=!1,this.As=!1,this.Vs=100,this.ds=(function(){return _F()?8:j$(_a())>0?6:4})()}initialize(t,r){this.fs=t,this.indexManager=r,this.Rs=!0}getDocumentsMatchingQuery(t,r,n,i){const a={result:null};return this.gs(t,r).next((o=>{a.result=o})).next((()=>{if(!a.result)return this.ps(t,r,i,n).next((o=>{a.result=o}))})).next((()=>{if(a.result)return;const o=new ade;return this.ys(t,r,o).next((c=>{if(a.result=c,this.As)return this.ws(t,r,o,c.size)}))})).next((()=>a.result))}ws(t,r,n,i){return n.documentReadCountthis.ds*i?(I0()<=oi.DEBUG&&$t("QueryEngine","The SDK decides to create cache indexes for query:",T0(r),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(t,$l(r))):Qe.resolve())}gs(t,r){if(nD(r))return Qe.resolve(null);let n=$l(r);return this.indexManager.getIndexType(t,n).next((i=>i===0?null:(r.limit!==null&&i===1&&(r=x2(r,null,"F"),n=$l(r)),this.indexManager.getDocumentsMatchingTarget(t,n).next((a=>{const o=qn(...a);return this.fs.getDocuments(t,o).next((c=>this.indexManager.getMinOffset(t,n).next((h=>{const f=this.Ss(r,c);return this.bs(r,f,o,h.readTime)?this.gs(t,x2(r,null,"F")):this.Ds(t,f,r,h)}))))})))))}ps(t,r,n,i){return nD(r)||i.isEqual(sn.min())?Qe.resolve(null):this.fs.getDocuments(t,n).next((a=>{const o=this.Ss(r,a);return this.bs(r,o,n,i)?Qe.resolve(null):(I0()<=oi.DEBUG&&$t("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),T0(r)),this.Ds(t,o,r,k$(i,lg)).next((c=>c)))}))}Ss(t,r){let n=new qi(cH(t));return r.forEach(((i,a)=>{Xy(t,a)&&(n=n.add(a))})),n}bs(t,r,n,i){if(t.limit===null)return!1;if(n.size!==r.size)return!0;const a=t.limitType==="F"?r.last():r.first();return!!a&&(a.hasPendingWrites||a.version.compareTo(i)>0)}ys(t,r,n){return I0()<=oi.DEBUG&&$t("QueryEngine","Using full collection scan to execute query:",T0(r)),this.fs.getDocumentsMatchingQuery(t,r,ql.min(),n)}Ds(t,r,n,i){return this.fs.getDocumentsMatchingQuery(t,n,i).next((a=>(r.forEach((o=>{a=a.insert(o.key,o)})),a)))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const oT="LocalStore",ode=3e8;class lde{constructor(t,r,n,i){this.persistence=t,this.Cs=r,this.serializer=i,this.vs=new ls(kn),this.Fs=new Xd((a=>Jp(a)),Ky),this.Ms=new Map,this.xs=t.getRemoteDocumentCache(),this.li=t.getTargetCache(),this.Pi=t.getBundleCache(),this.Os(n)}Os(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new XH(this.xs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.xs.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(r=>t.collect(r,this.vs)))}}function JH(e,t,r,n){return new lde(e,t,r,n)}async function eG(e,t){const r=Vr(e);return await r.persistence.runTransaction("Handle user change","readonly",(n=>{let i;return r.mutationQueue.getAllMutationBatches(n).next((a=>(i=a,r.Os(t),r.mutationQueue.getAllMutationBatches(n)))).next((a=>{const o=[],c=[];let h=qn();for(const f of i){o.push(f.batchId);for(const m of f.mutations)h=h.add(m.key)}for(const f of a){c.push(f.batchId);for(const m of f.mutations)h=h.add(m.key)}return r.localDocuments.getDocuments(n,h).next((f=>({Ns:f,removedBatchIds:o,addedBatchIds:c})))}))}))}function cde(e,t){const r=Vr(e);return r.persistence.runTransaction("Acknowledge batch","readwrite-primary",(n=>{const i=t.batch.keys(),a=r.xs.newChangeBuffer({trackRemovals:!0});return(function(c,h,f,m){const y=f.batch,w=y.keys();let A=Qe.resolve();return w.forEach((S=>{A=A.next((()=>m.getEntry(h,S))).next((j=>{const T=f.docVersions.get(S);Yr(T!==null,48541),j.version.compareTo(T)<0&&(y.applyToRemoteDocument(j,f),j.isValidDocument()&&(j.setReadTime(f.commitVersion),m.addEntry(j)))}))})),A.next((()=>c.mutationQueue.removeMutationBatch(h,y)))})(r,n,t,a).next((()=>a.apply(n))).next((()=>r.mutationQueue.performConsistencyCheck(n))).next((()=>r.documentOverlayCache.removeOverlaysForBatchId(n,i,t.batch.batchId))).next((()=>r.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(n,(function(c){let h=qn();for(let f=0;f0&&(h=h.add(c.batch.mutations[f].key));return h})(t)))).next((()=>r.localDocuments.getDocuments(n,i)))}))}function tG(e){const t=Vr(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(r=>t.li.getLastRemoteSnapshotVersion(r)))}function ude(e,t){const r=Vr(e),n=t.snapshotVersion;let i=r.vs;return r.persistence.runTransaction("Apply remote event","readwrite-primary",(a=>{const o=r.xs.newChangeBuffer({trackRemovals:!0});i=r.vs;const c=[];t.targetChanges.forEach(((m,y)=>{const w=i.get(y);if(!w)return;c.push(r.li.removeMatchingKeys(a,m.removedDocuments,y).next((()=>r.li.addMatchingKeys(a,m.addedDocuments,y))));let A=w.withSequenceNumber(a.currentSequenceNumber);t.targetMismatches.get(y)!==null?A=A.withResumeToken(Zs.EMPTY_BYTE_STRING,sn.min()).withLastLimboFreeSnapshotVersion(sn.min()):m.resumeToken.approximateByteSize()>0&&(A=A.withResumeToken(m.resumeToken,n)),i=i.insert(y,A),(function(j,T,D){return j.resumeToken.approximateByteSize()===0||T.snapshotVersion.toMicroseconds()-j.snapshotVersion.toMicroseconds()>=ode?!0:D.addedDocuments.size+D.modifiedDocuments.size+D.removedDocuments.size>0})(w,A,m)&&c.push(r.li.updateTargetData(a,A))}));let h=Bl(),f=qn();if(t.documentUpdates.forEach((m=>{t.resolvedLimboDocuments.has(m)&&c.push(r.persistence.referenceDelegate.updateLimboDocument(a,m))})),c.push(dde(a,o,t.documentUpdates).next((m=>{h=m.Bs,f=m.Ls}))),!n.isEqual(sn.min())){const m=r.li.getLastRemoteSnapshotVersion(a).next((y=>r.li.setTargetsMetadata(a,a.currentSequenceNumber,n)));c.push(m)}return Qe.waitFor(c).next((()=>o.apply(a))).next((()=>r.localDocuments.getLocalViewOfDocuments(a,h,f))).next((()=>h))})).then((a=>(r.vs=i,a)))}function dde(e,t,r){let n=qn(),i=qn();return r.forEach((a=>n=n.add(a))),t.getEntries(e,n).next((a=>{let o=Bl();return r.forEach(((c,h)=>{const f=a.get(c);h.isFoundDocument()!==f.isFoundDocument()&&(i=i.add(c)),h.isNoDocument()&&h.version.isEqual(sn.min())?(t.removeEntry(c,h.readTime),o=o.insert(c,h)):!f.isValidDocument()||h.version.compareTo(f.version)>0||h.version.compareTo(f.version)===0&&f.hasPendingWrites?(t.addEntry(h),o=o.insert(c,h)):$t(oT,"Ignoring outdated watch update for ",c,". Current version:",f.version," Watch version:",h.version)})),{Bs:o,Ls:i}}))}function hde(e,t){const r=Vr(e);return r.persistence.runTransaction("Get next mutation batch","readonly",(n=>(t===void 0&&(t=Pp),r.mutationQueue.getNextMutationBatchAfterBatchId(n,t))))}function A2(e,t){const r=Vr(e);return r.persistence.runTransaction("Allocate target","readwrite",(n=>{let i;return r.li.getTargetData(n,t).next((a=>a?(i=a,Qe.resolve(i)):r.li.allocateTargetId(n).next((o=>(i=new jd(t,o,"TargetPurposeListen",n.currentSequenceNumber),r.li.addTargetData(n,i).next((()=>i)))))))})).then((n=>{const i=r.vs.get(n.targetId);return(i===null||n.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(r.vs=r.vs.insert(n.targetId,n),r.Fs.set(t,n.targetId)),n}))}async function vg(e,t,r){const n=Vr(e),i=n.vs.get(t),a=r?"readwrite":"readwrite-primary";try{r||await n.persistence.runTransaction("Release target",a,(o=>n.persistence.referenceDelegate.removeTarget(o,i)))}catch(o){if(!Cf(o))throw o;$t(oT,`Failed to update sequence numbers for target ${t}: ${o}`)}n.vs=n.vs.remove(t),n.Fs.delete(i.target)}function bC(e,t,r){const n=Vr(e);let i=sn.min(),a=qn();return n.persistence.runTransaction("Execute query","readwrite",(o=>(function(h,f,m){const y=Vr(h),w=y.Fs.get(m);return w!==void 0?Qe.resolve(y.vs.get(w)):y.li.getTargetData(f,m)})(n,o,$l(t)).next((c=>{if(c)return i=c.lastLimboFreeSnapshotVersion,n.li.getMatchingKeysForTargetId(o,c.targetId).next((h=>{a=h}))})).next((()=>n.Cs.getDocumentsMatchingQuery(o,t,r?i:sn.min(),r?a:qn()))).next((c=>(iG(n,lH(t),c),{documents:c,ks:a})))))}function rG(e,t){const r=Vr(e),n=Vr(r.li),i=r.vs.get(t);return i?Promise.resolve(i.target):r.persistence.runTransaction("Get target data","readonly",(a=>n.At(a,t).next((o=>o?o.target:null))))}function nG(e,t){const r=Vr(e),n=r.Ms.get(t)||sn.min();return r.persistence.runTransaction("Get new document changes","readonly",(i=>r.xs.getAllFromCollectionGroup(i,t,k$(n,lg),Number.MAX_SAFE_INTEGER))).then((i=>(iG(r,t,i),i)))}function iG(e,t,r){let n=e.Ms.get(t)||sn.min();r.forEach(((i,a)=>{a.readTime.compareTo(n)>0&&(n=a.readTime)})),e.Ms.set(t,n)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const sG="firestore_clients";function RD(e,t){return`${sG}_${e}_${t}`}const aG="firestore_mutations";function DD(e,t,r){let n=`${aG}_${e}_${r}`;return t.isAuthenticated()&&(n+=`_${t.uid}`),n}const oG="firestore_targets";function fk(e,t){return`${oG}_${e}_${t}`}/** * @license * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Au="SharedClientState";class k2{constructor(t,r,n,i){this.user=t,this.batchId=r,this.state=n,this.error=i}static $s(t,r,n){const i=JSON.parse(n);let a,o=typeof i=="object"&&["pending","acknowledged","rejected"].indexOf(i.state)!==-1&&(i.error===void 0||typeof i.error=="object");return o&&i.error&&(o=typeof i.error.message=="string"&&typeof i.error.code=="string",o&&(a=new tr(i.error.code,i.error.message))),o?new k2(t,r,i.state,a):(Qs(Au,`Failed to parse mutation state for ID '${r}': ${n}`),null)}Ws(){const t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)}}class H1{constructor(t,r,n){this.targetId=t,this.state=r,this.error=n}static $s(t,r){const n=JSON.parse(r);let i,a=typeof n=="object"&&["not-current","current","rejected"].indexOf(n.state)!==-1&&(n.error===void 0||typeof n.error=="object");return a&&n.error&&(a=typeof n.error.message=="string"&&typeof n.error.code=="string",a&&(i=new tr(n.error.code,n.error.message))),a?new H1(t,n.state,i):(Qs(Au,`Failed to parse target state for ID '${t}': ${r}`),null)}Ws(){const t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)}}class _2{constructor(t,r){this.clientId=t,this.activeTargetIds=r}static $s(t,r){const n=JSON.parse(r);let i=typeof n=="object"&&n.activeTargetIds instanceof Array,a=WI();for(let o=0;i&&othis.shutdown())),this.started=!0}writeSequenceNumber(t){this.setItem(this.Ys,JSON.stringify(t))}getAllActiveQueryTargets(){return this.uo(this.Hs)}isActiveQueryTarget(t){let r=!1;return this.Hs.forEach(((n,i)=>{i.activeTargetIds.has(t)&&(r=!0)})),r}addPendingMutation(t){this.co(t,"pending")}updateMutationState(t,r,n){this.co(t,r,n),this.lo(t)}addLocalQueryTarget(t,r=!0){let n="not-current";if(this.isActiveQueryTarget(t)){const i=this.storage.getItem(fk(this.persistenceKey,t));if(i){const a=H1.$s(t,i);a&&(n=a.state)}}return r&&this.ho.Qs(t),this.oo(),n}removeLocalQueryTarget(t){this.ho.Gs(t),this.oo()}isLocalQueryTarget(t){return this.ho.activeTargetIds.has(t)}clearQueryState(t){this.removeItem(fk(this.persistenceKey,t))}updateQueryState(t,r,n){this.Po(t,r,n)}handleUserChange(t,r,n){r.forEach((i=>{this.lo(i)})),this.currentUser=t,n.forEach((i=>{this.addPendingMutation(i)}))}setOnlineState(t){this.To(t)}notifyBundleLoaded(t){this.Eo(t)}shutdown(){this.started&&(this.window.removeEventListener("storage",this.js),this.removeItem(this.Xs),this.started=!1)}getItem(t){const r=this.storage.getItem(t);return $t(Au,"READ",t,r),r}setItem(t,r){$t(Au,"SET",t,r),this.storage.setItem(t,r)}removeItem(t){$t(Au,"REMOVE",t),this.storage.removeItem(t)}Js(t){const r=t;if(r.storageArea===this.storage){if($t(Au,"EVENT",r.key,r.newValue),r.key===this.Xs)return void Qs("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.Ci.enqueueRetryable((async()=>{if(this.started){if(r.key!==null){if(this.eo.test(r.key)){if(r.newValue==null){const n=this.Io(r.key);return this.Ro(n,null)}{const n=this.Ao(r.key,r.newValue);if(n)return this.Ro(n.clientId,n)}}else if(this.no.test(r.key)){if(r.newValue!==null){const n=this.Vo(r.key,r.newValue);if(n)return this.mo(n)}}else if(this.ro.test(r.key)){if(r.newValue!==null){const n=this.fo(r.key,r.newValue);if(n)return this.po(n)}}else if(r.key===this.io){if(r.newValue!==null){const n=this._o(r.newValue);if(n)return this.ao(n)}}else if(r.key===this.Ys){const n=(function(a){let o=dl.ce;if(a!=null)try{const c=JSON.parse(a);Yr(typeof c=="number",30636,{yo:a}),o=c}catch(c){Qs(Au,"Failed to read sequence number from WebStorage",c)}return o})(r.newValue);n!==dl.ce&&this.sequenceNumberHandler(n)}else if(r.key===this.so){const n=this.wo(r.newValue);await Promise.all(n.map((i=>this.syncEngine.So(i))))}}}else this.Zs.push(r)}))}}get ho(){return this.Hs.get(this.zs)}oo(){this.setItem(this.Xs,this.ho.Ws())}co(t,r,n){const i=new k2(this.currentUser,t,r,n),a=DD(this.persistenceKey,this.currentUser,t);this.setItem(a,i.Ws())}lo(t){const r=DD(this.persistenceKey,this.currentUser,t);this.removeItem(r)}To(t){const r={clientId:this.zs,onlineState:t};this.storage.setItem(this.io,JSON.stringify(r))}Po(t,r,n){const i=fk(this.persistenceKey,t),a=new H1(t,r,n);this.setItem(i,a.Ws())}Eo(t){const r=JSON.stringify(Array.from(t));this.setItem(this.so,r)}Io(t){const r=this.eo.exec(t);return r?r[1]:null}Ao(t,r){const n=this.Io(t);return _2.$s(n,r)}Vo(t,r){const n=this.no.exec(t),i=Number(n[1]),a=n[2]!==void 0?n[2]:null;return k2.$s(new wo(a),i,r)}fo(t,r){const n=this.ro.exec(t),i=Number(n[1]);return H1.$s(i,r)}_o(t){return lT.$s(t)}wo(t){return JSON.parse(t)}async mo(t){if(t.user.uid===this.currentUser.uid)return this.syncEngine.bo(t.batchId,t.state,t.error);$t(Au,`Ignoring mutation for non-active user ${t.user.uid}`)}po(t){return this.syncEngine.Do(t.targetId,t.state,t.error)}Ro(t,r){const n=r?this.Hs.insert(t,r):this.Hs.remove(t),i=this.uo(this.Hs),a=this.uo(n),o=[],c=[];return a.forEach((h=>{i.has(h)||o.push(h)})),i.forEach((h=>{a.has(h)||c.push(h)})),this.syncEngine.Co(o,c).then((()=>{this.Hs=n}))}ao(t){this.Hs.get(t.clientId)&&this.onlineStateHandler(t.onlineState)}uo(t){let r=WI();return t.forEach(((n,i)=>{r=r.unionWith(i.activeTargetIds)})),r}}class lG{constructor(){this.vo=new vC,this.Fo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,r,n){}addLocalQueryTarget(t,r=!0){return r&&this.vo.Qs(t),this.Fo[t]||"not-current"}updateQueryState(t,r,n){this.Fo[t]=r}removeLocalQueryTarget(t){this.vo.Gs(t)}isLocalQueryTarget(t){return this.vo.activeTargetIds.has(t)}clearQueryState(t){delete this.Fo[t]}getAllActiveQueryTargets(){return this.vo.activeTargetIds}isActiveQueryTarget(t){return this.vo.activeTargetIds.has(t)}start(){return this.vo=new vC,Promise.resolve()}handleUserChange(t,r,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class fde{Mo(t){}shutdown(){}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const MD="ConnectivityMonitor";class LD{constructor(){this.xo=()=>this.Oo(),this.No=()=>this.Bo(),this.Lo=[],this.ko()}Mo(t){this.Lo.push(t)}shutdown(){window.removeEventListener("online",this.xo),window.removeEventListener("offline",this.No)}ko(){window.addEventListener("online",this.xo),window.addEventListener("offline",this.No)}Oo(){$t(MD,"Network connectivity changed: AVAILABLE");for(const t of this.Lo)t(0)}Bo(){$t(MD,"Network connectivity changed: UNAVAILABLE");for(const t of this.Lo)t(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let Lv=null;function wC(){return Lv===null?Lv=(function(){return 268435456+Math.round(2147483648*Math.random())})():Lv++,"0x"+Lv.toString(16)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const mk="RestConnection",pde={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class mde{get qo(){return!1}constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const r=t.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.Ko=r+"://"+t.host,this.Uo=`projects/${n}/databases/${i}`,this.$o=this.databaseId.database===sC?`project_id=${n}`:`project_id=${n}&database_id=${i}`}Wo(t,r,n,i,a){const o=wC(),c=this.Qo(t,r.toUriEncodedString());$t(mk,`Sending RPC '${t}' ${o}:`,c,n);const h={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.$o};this.Go(h,i,a);const{host:f}=new URL(c),m=Vy(f);return this.zo(t,c,h,n,m).then((y=>($t(mk,`Received RPC '${t}' ${o}: `,y),y)),(y=>{throw ag(mk,`RPC '${t}' ${o} failed with error: `,y,"url: ",c,"request:",n),y}))}jo(t,r,n,i,a,o){return this.Wo(t,r,n,i,a)}Go(t,r,n){t["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+Bg})(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach(((i,a)=>t[a]=i)),n&&n.headers.forEach(((i,a)=>t[a]=i))}Qo(t,r){const n=pde[t];let i=`${this.Ko}/v1/${r}:${n}`;return this.databaseInfo.apiKey&&(i=`${i}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),i}terminate(){}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class gde{constructor(t){this.Jo=t.Jo,this.Ho=t.Ho}Zo(t){this.Xo=t}Yo(t){this.e_=t}t_(t){this.n_=t}onMessage(t){this.r_=t}close(){this.Ho()}send(t){this.Jo(t)}i_(){this.Xo()}s_(){this.e_()}o_(t){this.n_(t)}__(t){this.r_(t)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const bo="WebChannelConnection",Zx=(e,t,r)=>{e.listen(t,(n=>{try{r(n)}catch(i){setTimeout((()=>{throw i}),0)}}))};class Y0 extends mde{constructor(t){super(t),this.a_=[],this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams,this.longPollingOptions=t.longPollingOptions}static u_(){if(!Y0.c_){const t=v$();Zx(t,b$.STAT_EVENT,(r=>{r.stat===ZS.PROXY?$t(bo,"STAT_EVENT: detected buffering proxy"):r.stat===ZS.NOPROXY&&$t(bo,"STAT_EVENT: detected no buffering proxy")})),Y0.c_=!0}}zo(t,r,n,i,a){const o=wC();return new Promise(((c,h)=>{const f=new x$;f.setWithCredentials(!0),f.listenOnce(y$.COMPLETE,(()=>{try{switch(f.getLastErrorCode()){case kw.NO_ERROR:const y=f.getResponseJson();$t(bo,`XHR for RPC '${t}' ${o} received:`,JSON.stringify(y)),c(y);break;case kw.TIMEOUT:$t(bo,`RPC '${t}' ${o} timed out`),h(new tr(bt.DEADLINE_EXCEEDED,"Request time out"));break;case kw.HTTP_ERROR:const w=f.getStatus();if($t(bo,`RPC '${t}' ${o} failed with status:`,w,"response text:",f.getResponseText()),w>0){let A=f.getResponseJson();Array.isArray(A)&&(A=A[0]);const S=A==null?void 0:A.error;if(S&&S.status&&S.message){const j=(function(D){const V=D.toLowerCase().replace(/_/g,"-");return Object.values(bt).indexOf(V)>=0?V:bt.UNKNOWN})(S.status);h(new tr(j,S.message))}else h(new tr(bt.UNKNOWN,"Server responded with status "+f.getStatus()))}else h(new tr(bt.UNAVAILABLE,"Connection failed."));break;default:Tr(9055,{l_:t,streamId:o,h_:f.getLastErrorCode(),P_:f.getLastError()})}}finally{$t(bo,`RPC '${t}' ${o} completed.`)}}));const m=JSON.stringify(i);$t(bo,`RPC '${t}' ${o} sending request:`,i),f.send(r,"POST",m,n,15)}))}T_(t,r,n){const i=wC(),a=[this.Ko,"/","google.firestore.v1.Firestore","/",t,"/channel"],o=this.createWebChannelTransport(),c={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},h=this.longPollingOptions.timeoutSeconds;h!==void 0&&(c.longPollingTimeout=Math.round(1e3*h)),this.useFetchStreams&&(c.useFetchStreams=!0),this.Go(c.initMessageHeaders,r,n),c.encodeInitMessageHeaders=!0;const f=a.join("");$t(bo,`Creating RPC '${t}' stream ${i}: ${f}`,c);const m=o.createWebChannel(f,c);this.E_(m);let y=!1,w=!1;const A=new gde({Jo:S=>{w?$t(bo,`Not sending because RPC '${t}' stream ${i} is closed:`,S):(y||($t(bo,`Opening RPC '${t}' stream ${i} transport.`),m.open(),y=!0),$t(bo,`RPC '${t}' stream ${i} sending:`,S),m.send(S))},Ho:()=>m.close()});return Zx(m,N1.EventType.OPEN,(()=>{w||($t(bo,`RPC '${t}' stream ${i} transport opened.`),A.i_())})),Zx(m,N1.EventType.CLOSE,(()=>{w||(w=!0,$t(bo,`RPC '${t}' stream ${i} transport closed`),A.o_(),this.I_(m))})),Zx(m,N1.EventType.ERROR,(S=>{w||(w=!0,ag(bo,`RPC '${t}' stream ${i} transport errored. Name:`,S.name,"Message:",S.message),A.o_(new tr(bt.UNAVAILABLE,"The operation could not be completed")))})),Zx(m,N1.EventType.MESSAGE,(S=>{var j;if(!w){const T=S.data[0];Yr(!!T,16349);const D=T,V=(D==null?void 0:D.error)||((j=D[0])==null?void 0:j.error);if(V){$t(bo,`RPC '${t}' stream ${i} received error:`,V);const U=V.status;let G=(function(B){const z=oa[B];if(z!==void 0)return NH(z)})(U),X=V.message;U==="NOT_FOUND"&&X.includes("database")&&X.includes("does not exist")&&X.includes(this.databaseId.database)&&ag(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),G===void 0&&(G=bt.INTERNAL,X="Unknown error status: "+U+" with message "+V.message),w=!0,A.o_(new tr(G,X)),m.close()}else $t(bo,`RPC '${t}' stream ${i} received:`,T),A.__(T)}})),Y0.u_(),setTimeout((()=>{A.s_()}),0),A}terminate(){this.a_.forEach((t=>t.close())),this.a_=[]}E_(t){this.a_.push(t)}I_(t){this.a_=this.a_.filter((r=>r===t))}Go(t,r,n){super.Go(t,r,n),this.databaseInfo.apiKey&&(t["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return w$()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function xde(e){return new Y0(e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function cG(){return typeof window<"u"?window:null}function Dw(){return typeof document<"u"?document:null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function NE(e){return new Nue(e,!0)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */Y0.c_=!1;class uG{constructor(t,r,n=1e3,i=1.5,a=6e4){this.Ci=t,this.timerId=r,this.R_=n,this.A_=i,this.V_=a,this.d_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.d_=0}g_(){this.d_=this.V_}p_(t){this.cancel();const r=Math.floor(this.d_+this.y_()),n=Math.max(0,Date.now()-this.f_),i=Math.max(0,r-n);i>0&&$t("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.d_} ms, delay with jitter: ${r} ms, last attempt: ${n} ms ago)`),this.m_=this.Ci.enqueueAfterDelay(this.timerId,i,(()=>(this.f_=Date.now(),t()))),this.d_*=this.A_,this.d_this.V_&&(this.d_=this.V_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.d_}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const UD="PersistentStream";class dG{constructor(t,r,n,i,a,o,c,h){this.Ci=t,this.S_=n,this.b_=i,this.connection=a,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=c,this.listener=h,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new uG(t,r)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Ci.enqueueAfterDelay(this.S_,6e4,(()=>this.k_())))}q_(t){this.K_(),this.stream.send(t)}async k_(){if(this.O_())return this.close(0)}K_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(t,r){this.K_(),this.U_(),this.M_.cancel(),this.D_++,t!==4?this.M_.reset():r&&r.code===bt.RESOURCE_EXHAUSTED?(Qs(r.toString()),Qs("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):r&&r.code===bt.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.W_(),this.stream.close(),this.stream=null),this.state=t,await this.listener.t_(r)}W_(){}auth(){this.state=1;const t=this.Q_(this.D_),r=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([n,i])=>{this.D_===r&&this.G_(n,i)}),(n=>{t((()=>{const i=new tr(bt.UNKNOWN,"Fetching auth token failed: "+n.message);return this.z_(i)}))}))}G_(t,r){const n=this.Q_(this.D_);this.stream=this.j_(t,r),this.stream.Zo((()=>{n((()=>this.listener.Zo()))})),this.stream.Yo((()=>{n((()=>(this.state=2,this.v_=this.Ci.enqueueAfterDelay(this.b_,1e4,(()=>(this.O_()&&(this.state=3),Promise.resolve()))),this.listener.Yo())))})),this.stream.t_((i=>{n((()=>this.z_(i)))})),this.stream.onMessage((i=>{n((()=>++this.F_==1?this.J_(i):this.onNext(i)))}))}N_(){this.state=5,this.M_.p_((async()=>{this.state=0,this.start()}))}z_(t){return $t(UD,`close with error: ${t}`),this.stream=null,this.close(4,t)}Q_(t){return r=>{this.Ci.enqueueAndForget((()=>this.D_===t?r():($t(UD,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class yde extends dG{constructor(t,r,n,i,a,o){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",r,n,i,o),this.serializer=a}j_(t,r){return this.connection.T_("Listen",t,r)}J_(t){return this.onNext(t)}onNext(t){this.M_.reset();const r=kue(this.serializer,t),n=(function(a){if(!("targetChange"in a))return sn.min();const o=a.targetChange;return o.targetIds&&o.targetIds.length?sn.min():o.readTime?Ho(o.readTime):sn.min()})(t);return this.listener.H_(r,n)}Z_(t){const r={};r.database=pC(this.serializer),r.addTarget=(function(a,o){let c;const h=o.target;if(c=m2(h)?{documents:IH(a,h)}:{query:eT(a,h).ft},c.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){c.resumeToken=kH(a,o.resumeToken);const f=hC(a,o.expectedCount);f!==null&&(c.expectedCount=f)}else if(o.snapshotVersion.compareTo(sn.min())>0){c.readTime=bg(a,o.snapshotVersion.toTimestamp());const f=hC(a,o.expectedCount);f!==null&&(c.expectedCount=f)}return c})(this.serializer,t);const n=Cue(this.serializer,t);n&&(r.labels=n),this.q_(r)}X_(t){const r={};r.database=pC(this.serializer),r.removeTarget=t,this.q_(r)}}class bde extends dG{constructor(t,r,n,i,a,o){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",r,n,i,o),this.serializer=a}get Y_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}W_(){this.Y_&&this.ea([])}j_(t,r){return this.connection.T_("Write",t,r)}J_(t){return Yr(!!t.streamToken,31322),this.lastStreamToken=t.streamToken,Yr(!t.writeResults||t.writeResults.length===0,55816),this.listener.ta()}onNext(t){Yr(!!t.streamToken,12678),this.lastStreamToken=t.streamToken,this.M_.reset();const r=_ue(t.writeResults,t.commitTime),n=Ho(t.commitTime);return this.listener.na(n,r)}ra(){const t={};t.database=pC(this.serializer),this.q_(t)}ea(t){const r={streamToken:this.lastStreamToken,writes:t.map((n=>b2(this.serializer,n)))};this.q_(r)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class vde{}class wde extends vde{constructor(t,r,n,i){super(),this.authCredentials=t,this.appCheckCredentials=r,this.connection=n,this.serializer=i,this.ia=!1}sa(){if(this.ia)throw new tr(bt.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(t,r,n,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([a,o])=>this.connection.Wo(t,fC(r,n),i,a,o))).catch((a=>{throw a.name==="FirebaseError"?(a.code===bt.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new tr(bt.UNKNOWN,a.toString())}))}jo(t,r,n,i,a){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([o,c])=>this.connection.jo(t,fC(r,n),i,o,c,a))).catch((o=>{throw o.name==="FirebaseError"?(o.code===bt.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new tr(bt.UNKNOWN,o.toString())}))}terminate(){this.ia=!0,this.connection.terminate()}}function Nde(e,t,r,n){return new wde(e,t,r,n)}class Ede{constructor(t,r){this.asyncQueue=t,this.onlineStateHandler=r,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve()))))}ha(t){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.ca("Offline")))}set(t){this.Pa(),this.oa=0,t==="Online"&&(this.aa=!1),this.ca(t)}ca(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}la(t){const r=`Could not reach Cloud Firestore backend. ${t} This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(Qs(r),this.aa=!1):$t("OnlineStateTracker",r)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const sm="RemoteStore";class Ade{constructor(t,r,n,i,a){this.localStore=t,this.datastore=r,this.asyncQueue=n,this.remoteSyncer={},this.Ta=[],this.Ea=new Map,this.Ia=new Set,this.Ra=[],this.Aa=a,this.Aa.Mo((o=>{n.enqueueAndForget((async()=>{xm(this)&&($t(sm,"Restarting streams for network reachability change."),await(async function(h){const f=Vr(h);f.Ia.add(4),await eb(f),f.Va.set("Unknown"),f.Ia.delete(4),await EE(f)})(this))}))})),this.Va=new Ede(n,i)}}async function EE(e){if(xm(e))for(const t of e.Ra)await t(!0)}async function eb(e){for(const t of e.Ra)await t(!1)}function AE(e,t){const r=Vr(e);r.Ea.has(t.targetId)||(r.Ea.set(t.targetId,t),dT(r)?uT(r):Fg(r).O_()&&cT(r,t))}function wg(e,t){const r=Vr(e),n=Fg(r);r.Ea.delete(t),n.O_()&&hG(r,t),r.Ea.size===0&&(n.O_()?n.L_():xm(r)&&r.Va.set("Unknown"))}function cT(e,t){if(e.da.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(sn.min())>0){const r=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(r)}Fg(e).Z_(t)}function hG(e,t){e.da.$e(t),Fg(e).X_(t)}function uT(e){e.da=new yue({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),At:t=>e.Ea.get(t)||null,ht:()=>e.datastore.serializer.databaseId}),Fg(e).start(),e.Va.ua()}function dT(e){return xm(e)&&!Fg(e).x_()&&e.Ea.size>0}function xm(e){return Vr(e).Ia.size===0}function fG(e){e.da=void 0}async function kde(e){e.Va.set("Online")}async function _de(e){e.Ea.forEach(((t,r)=>{cT(e,t)}))}async function Sde(e,t){fG(e),dT(e)?(e.Va.ha(t),uT(e)):e.Va.set("Unknown")}async function Cde(e,t,r){if(e.Va.set("Online"),t instanceof AH&&t.state===2&&t.cause)try{await(async function(i,a){const o=a.cause;for(const c of a.targetIds)i.Ea.has(c)&&(await i.remoteSyncer.rejectListen(c,o),i.Ea.delete(c),i.da.removeTarget(c))})(e,t)}catch(n){$t(sm,"Failed to remove targets %s: %s ",t.targetIds.join(","),n),await S2(e,n)}else if(t instanceof Ow?e.da.Xe(t):t instanceof EH?e.da.st(t):e.da.tt(t),!r.isEqual(sn.min()))try{const n=await tG(e.localStore);r.compareTo(n)>=0&&await(function(a,o){const c=a.da.Tt(o);return c.targetChanges.forEach(((h,f)=>{if(h.resumeToken.approximateByteSize()>0){const m=a.Ea.get(f);m&&a.Ea.set(f,m.withResumeToken(h.resumeToken,o))}})),c.targetMismatches.forEach(((h,f)=>{const m=a.Ea.get(h);if(!m)return;a.Ea.set(h,m.withResumeToken(Zs.EMPTY_BYTE_STRING,m.snapshotVersion)),hG(a,h);const y=new jd(m.target,h,f,m.sequenceNumber);cT(a,y)})),a.remoteSyncer.applyRemoteEvent(c)})(e,r)}catch(n){$t(sm,"Failed to raise snapshot:",n),await S2(e,n)}}async function S2(e,t,r){if(!Cf(t))throw t;e.Ia.add(1),await eb(e),e.Va.set("Offline"),r||(r=()=>tG(e.localStore)),e.asyncQueue.enqueueRetryable((async()=>{$t(sm,"Retrying IndexedDB access"),await r(),e.Ia.delete(1),await EE(e)}))}function pG(e,t){return t().catch((r=>S2(e,r,t)))}async function Vg(e){const t=Vr(e),r=bf(t);let n=t.Ta.length>0?t.Ta[t.Ta.length-1].batchId:Pp;for(;jde(t);)try{const i=await hde(t.localStore,n);if(i===null){t.Ta.length===0&&r.L_();break}n=i.batchId,Ide(t,i)}catch(i){await S2(t,i)}mG(t)&&gG(t)}function jde(e){return xm(e)&&e.Ta.length<10}function Ide(e,t){e.Ta.push(t);const r=bf(e);r.O_()&&r.Y_&&r.ea(t.mutations)}function mG(e){return xm(e)&&!bf(e).x_()&&e.Ta.length>0}function gG(e){bf(e).start()}async function Tde(e){bf(e).ra()}async function Pde(e){const t=bf(e);for(const r of e.Ta)t.ea(r.mutations)}async function Ode(e,t,r){const n=e.Ta.shift(),i=XI.from(n,t,r);await pG(e,(()=>e.remoteSyncer.applySuccessfulWrite(i))),await Vg(e)}async function Rde(e,t){t&&bf(e).Y_&&await(async function(n,i){if((function(o){return mue(o)&&o!==bt.ABORTED})(i.code)){const a=n.Ta.shift();bf(n).B_(),await pG(n,(()=>n.remoteSyncer.rejectFailedWrite(a.batchId,i))),await Vg(n)}})(e,t),mG(e)&&gG(e)}async function BD(e,t){const r=Vr(e);r.asyncQueue.verifyOperationInProgress(),$t(sm,"RemoteStore received new credentials");const n=xm(r);r.Ia.add(3),await eb(r),n&&r.Va.set("Unknown"),await r.remoteSyncer.handleCredentialChange(t),r.Ia.delete(3),await EE(r)}async function NC(e,t){const r=Vr(e);t?(r.Ia.delete(2),await EE(r)):t||(r.Ia.add(2),await eb(r),r.Va.set("Unknown"))}function Fg(e){return e.ma||(e.ma=(function(r,n,i){const a=Vr(r);return a.sa(),new yde(n,a.connection,a.authCredentials,a.appCheckCredentials,a.serializer,i)})(e.datastore,e.asyncQueue,{Zo:kde.bind(null,e),Yo:_de.bind(null,e),t_:Sde.bind(null,e),H_:Cde.bind(null,e)}),e.Ra.push((async t=>{t?(e.ma.B_(),dT(e)?uT(e):e.Va.set("Unknown")):(await e.ma.stop(),fG(e))}))),e.ma}function bf(e){return e.fa||(e.fa=(function(r,n,i){const a=Vr(r);return a.sa(),new bde(n,a.connection,a.authCredentials,a.appCheckCredentials,a.serializer,i)})(e.datastore,e.asyncQueue,{Zo:()=>Promise.resolve(),Yo:Tde.bind(null,e),t_:Rde.bind(null,e),ta:Pde.bind(null,e),na:Ode.bind(null,e)}),e.Ra.push((async t=>{t?(e.fa.B_(),await Vg(e)):(await e.fa.stop(),e.Ta.length>0&&($t(sm,`Stopping write stream with ${e.Ta.length} pending writes`),e.Ta=[]))}))),e.fa}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class hT{constructor(t,r,n,i,a){this.asyncQueue=t,this.timerId=r,this.targetTimeMs=n,this.op=i,this.removalCallback=a,this.deferred=new Gc,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((o=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(t,r,n,i,a){const o=Date.now()+n,c=new hT(t,r,o,i,a);return c.start(n),c}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new tr(bt.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function fT(e,t){if(Qs("AsyncQueue",`${t}: ${e}`),Cf(e))return new tr(bt.UNAVAILABLE,`${t}: ${e}`);throw e}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class X0{static emptySet(t){return new X0(t.comparator)}constructor(t){this.comparator=t?(r,n)=>t(r,n)||hr.comparator(r.key,n.key):(r,n)=>hr.comparator(r.key,n.key),this.keyedMap=E1(),this.sortedSet=new ls(this.comparator)}has(t){return this.keyedMap.get(t)!=null}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const r=this.keyedMap.get(t);return r?this.sortedSet.indexOf(r):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((r,n)=>(t(r),!1)))}add(t){const r=this.delete(t.key);return r.copy(r.keyedMap.insert(t.key,t),r.sortedSet.insert(t,null))}delete(t){const r=this.get(t);return r?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(r)):this}isEqual(t){if(!(t instanceof X0)||this.size!==t.size)return!1;const r=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;r.hasNext();){const i=r.getNext().key,a=n.getNext().key;if(!i.isEqual(a))return!1}return!0}toString(){const t=[];return this.forEach((r=>{t.push(r.toString())})),t.length===0?"DocumentSet ()":`DocumentSet ( `+t.join(` `)+` )`}copy(t,r){const n=new X0;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=r,n}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class zD{constructor(){this.ga=new ls(hr.comparator)}track(t){const r=t.doc.key,n=this.ga.get(r);n?t.type!==0&&n.type===3?this.ga=this.ga.insert(r,t):t.type===3&&n.type!==1?this.ga=this.ga.insert(r,{type:n.type,doc:t.doc}):t.type===2&&n.type===2?this.ga=this.ga.insert(r,{type:2,doc:t.doc}):t.type===2&&n.type===0?this.ga=this.ga.insert(r,{type:0,doc:t.doc}):t.type===1&&n.type===0?this.ga=this.ga.remove(r):t.type===1&&n.type===2?this.ga=this.ga.insert(r,{type:1,doc:n.doc}):t.type===0&&n.type===1?this.ga=this.ga.insert(r,{type:2,doc:t.doc}):Tr(63341,{Vt:t,pa:n}):this.ga=this.ga.insert(r,t)}ya(){const t=[];return this.ga.inorderTraversal(((r,n)=>{t.push(n)})),t}}class Ng{constructor(t,r,n,i,a,o,c,h,f){this.query=t,this.docs=r,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=a,this.fromCache=o,this.syncStateChanged=c,this.excludesMetadataChanges=h,this.hasCachedResults=f}static fromInitialDocuments(t,r,n,i,a){const o=[];return r.forEach((c=>{o.push({type:0,doc:c})})),new Ng(t,r,X0.emptySet(r),o,n,i,!0,!1,a)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&mE(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const r=this.docChanges,n=t.docChanges;if(r.length!==n.length)return!1;for(let i=0;it.Da()))}}class Mde{constructor(){this.queries=VD(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(r,n){const i=Vr(r),a=i.queries;i.queries=VD(),a.forEach(((o,c)=>{for(const h of c.Sa)h.onError(n)}))})(this,new tr(bt.ABORTED,"Firestore shutting down"))}}function VD(){return new Xd((e=>oH(e)),mE)}async function pT(e,t){const r=Vr(e);let n=3;const i=t.query;let a=r.queries.get(i);a?!a.ba()&&t.Da()&&(n=2):(a=new Dde,n=t.Da()?0:1);try{switch(n){case 0:a.wa=await r.onListen(i,!0);break;case 1:a.wa=await r.onListen(i,!1);break;case 2:await r.onFirstRemoteStoreListen(i)}}catch(o){const c=fT(o,`Initialization of query '${T0(t.query)}' failed`);return void t.onError(c)}r.queries.set(i,a),a.Sa.push(t),t.va(r.onlineState),a.wa&&t.Fa(a.wa)&&gT(r)}async function mT(e,t){const r=Vr(e),n=t.query;let i=3;const a=r.queries.get(n);if(a){const o=a.Sa.indexOf(t);o>=0&&(a.Sa.splice(o,1),a.Sa.length===0?i=t.Da()?0:1:!a.ba()&&t.Da()&&(i=2))}switch(i){case 0:return r.queries.delete(n),r.onUnlisten(n,!0);case 1:return r.queries.delete(n),r.onUnlisten(n,!1);case 2:return r.onLastRemoteStoreUnlisten(n);default:return}}function Lde(e,t){const r=Vr(e);let n=!1;for(const i of t){const a=i.query,o=r.queries.get(a);if(o){for(const c of o.Sa)c.Fa(i)&&(n=!0);o.wa=i}}n&&gT(r)}function Ude(e,t,r){const n=Vr(e),i=n.queries.get(t);if(i)for(const a of i.Sa)a.onError(r);n.queries.delete(t)}function gT(e){e.Ca.forEach((t=>{t.next()}))}var EC,FD;(FD=EC||(EC={})).Ma="default",FD.Cache="cache";class xT{constructor(t,r,n){this.query=t,this.xa=r,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=n||{}}Fa(t){if(!this.options.includeMetadataChanges){const n=[];for(const i of t.docChanges)i.type!==3&&n.push(i);t=new Ng(t.query,t.docs,t.oldDocs,n,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let r=!1;return this.Oa?this.Ba(t)&&(this.xa.next(t),r=!0):this.La(t,this.onlineState)&&(this.ka(t),r=!0),this.Na=t,r}onError(t){this.xa.error(t)}va(t){this.onlineState=t;let r=!1;return this.Na&&!this.Oa&&this.La(this.Na,t)&&(this.ka(this.Na),r=!0),r}La(t,r){if(!t.fromCache||!this.Da())return!0;const n=r!=="Offline";return(!this.options.qa||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||r==="Offline")}Ba(t){if(t.docChanges.length>0)return!0;const r=this.Na&&this.Na.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!r)&&this.options.includeMetadataChanges===!0}ka(t){t=Ng.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Oa=!0,this.xa.next(t)}Da(){return this.options.source!==EC.Cache}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class xG{constructor(t){this.key=t}}class yG{constructor(t){this.key=t}}class Bde{constructor(t,r){this.query=t,this.Za=r,this.Xa=null,this.hasCachedResults=!1,this.current=!1,this.Ya=qn(),this.mutatedKeys=qn(),this.eu=cH(t),this.tu=new X0(this.eu)}get nu(){return this.Za}ru(t,r){const n=r?r.iu:new zD,i=r?r.tu:this.tu;let a=r?r.mutatedKeys:this.mutatedKeys,o=i,c=!1;const h=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,f=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(t.inorderTraversal(((m,y)=>{const w=i.get(m),A=Xy(this.query,y)?y:null,S=!!w&&this.mutatedKeys.has(w.key),j=!!A&&(A.hasLocalMutations||this.mutatedKeys.has(A.key)&&A.hasCommittedMutations);let T=!1;w&&A?w.data.isEqual(A.data)?S!==j&&(n.track({type:3,doc:A}),T=!0):this.su(w,A)||(n.track({type:2,doc:A}),T=!0,(h&&this.eu(A,h)>0||f&&this.eu(A,f)<0)&&(c=!0)):!w&&A?(n.track({type:0,doc:A}),T=!0):w&&!A&&(n.track({type:1,doc:w}),T=!0,(h||f)&&(c=!0)),T&&(A?(o=o.add(A),a=j?a.add(m):a.delete(m)):(o=o.delete(m),a=a.delete(m)))})),this.query.limit!==null)for(;o.size>this.query.limit;){const m=this.query.limitType==="F"?o.last():o.first();o=o.delete(m.key),a=a.delete(m.key),n.track({type:1,doc:m})}return{tu:o,iu:n,bs:c,mutatedKeys:a}}su(t,r){return t.hasLocalMutations&&r.hasCommittedMutations&&!r.hasLocalMutations}applyChanges(t,r,n,i){const a=this.tu;this.tu=t.tu,this.mutatedKeys=t.mutatedKeys;const o=t.iu.ya();o.sort(((m,y)=>(function(A,S){const j=T=>{switch(T){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Tr(20277,{Vt:T})}};return j(A)-j(S)})(m.type,y.type)||this.eu(m.doc,y.doc))),this.ou(n),i=i??!1;const c=r&&!i?this._u():[],h=this.Ya.size===0&&this.current&&!i?1:0,f=h!==this.Xa;return this.Xa=h,o.length!==0||f?{snapshot:new Ng(this.query,t.tu,a,o,t.mutatedKeys,h===0,f,!1,!!n&&n.resumeToken.approximateByteSize()>0),au:c}:{au:c}}va(t){return this.current&&t==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new zD,mutatedKeys:this.mutatedKeys,bs:!1},!1)):{au:[]}}uu(t){return!this.Za.has(t)&&!!this.tu.has(t)&&!this.tu.get(t).hasLocalMutations}ou(t){t&&(t.addedDocuments.forEach((r=>this.Za=this.Za.add(r))),t.modifiedDocuments.forEach((r=>{})),t.removedDocuments.forEach((r=>this.Za=this.Za.delete(r))),this.current=t.current)}_u(){if(!this.current)return[];const t=this.Ya;this.Ya=qn(),this.tu.forEach((n=>{this.uu(n.key)&&(this.Ya=this.Ya.add(n.key))}));const r=[];return t.forEach((n=>{this.Ya.has(n)||r.push(new yG(n))})),this.Ya.forEach((n=>{t.has(n)||r.push(new xG(n))})),r}cu(t){this.Za=t.ks,this.Ya=qn();const r=this.ru(t.documents);return this.applyChanges(r,!0)}lu(){return Ng.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Xa===0,this.hasCachedResults)}}const $g="SyncEngine";class zde{constructor(t,r,n){this.query=t,this.targetId=r,this.view=n}}class Vde{constructor(t){this.key=t,this.hu=!1}}class Fde{constructor(t,r,n,i,a,o){this.localStore=t,this.remoteStore=r,this.eventManager=n,this.sharedClientState=i,this.currentUser=a,this.maxConcurrentLimboResolutions=o,this.Pu={},this.Tu=new Xd((c=>oH(c)),mE),this.Eu=new Map,this.Iu=new Set,this.Ru=new ls(hr.comparator),this.Au=new Map,this.Vu=new nT,this.du={},this.mu=new Map,this.fu=im.ar(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function $de(e,t,r=!0){const n=kE(e);let i;const a=n.Tu.get(t);return a?(n.sharedClientState.addLocalQueryTarget(a.targetId),i=a.view.lu()):i=await bG(n,t,r,!0),i}async function Hde(e,t){const r=kE(e);await bG(r,t,!0,!1)}async function bG(e,t,r,n){const i=await A2(e.localStore,$l(t)),a=i.targetId,o=e.sharedClientState.addLocalQueryTarget(a,r);let c;return n&&(c=await yT(e,t,a,o==="current",i.resumeToken)),e.isPrimaryClient&&r&&AE(e.remoteStore,i),c}async function yT(e,t,r,n,i){e.pu=(y,w,A)=>(async function(j,T,D,V){let U=T.view.ru(D);U.bs&&(U=await bC(j.localStore,T.query,!1).then((({documents:B})=>T.view.ru(B,U))));const G=V&&V.targetChanges.get(T.targetId),X=V&&V.targetMismatches.get(T.targetId)!=null,q=T.view.applyChanges(U,j.isPrimaryClient,G,X);return AC(j,T.targetId,q.au),q.snapshot})(e,y,w,A);const a=await bC(e.localStore,t,!0),o=new Bde(t,a.ks),c=o.ru(a.documents),h=Jy.createSynthesizedTargetChangeForCurrentChange(r,n&&e.onlineState!=="Offline",i),f=o.applyChanges(c,e.isPrimaryClient,h);AC(e,r,f.au);const m=new zde(t,r,o);return e.Tu.set(t,m),e.Eu.has(r)?e.Eu.get(r).push(t):e.Eu.set(r,[t]),f.snapshot}async function Gde(e,t,r){const n=Vr(e),i=n.Tu.get(t),a=n.Eu.get(i.targetId);if(a.length>1)return n.Eu.set(i.targetId,a.filter((o=>!mE(o,t)))),void n.Tu.delete(t);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(i.targetId),n.sharedClientState.isActiveQueryTarget(i.targetId)||await vg(n.localStore,i.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(i.targetId),r&&wg(n.remoteStore,i.targetId),Eg(n,i.targetId)})).catch(Sf)):(Eg(n,i.targetId),await vg(n.localStore,i.targetId,!0))}async function qde(e,t){const r=Vr(e),n=r.Tu.get(t),i=r.Eu.get(n.targetId);r.isPrimaryClient&&i.length===1&&(r.sharedClientState.removeLocalQueryTarget(n.targetId),wg(r.remoteStore,n.targetId))}async function Wde(e,t,r){const n=NT(e);try{const i=await(function(o,c){const h=Vr(o),f=wn.now(),m=c.reduce(((A,S)=>A.add(S.key)),qn());let y,w;return h.persistence.runTransaction("Locally write mutations","readwrite",(A=>{let S=Bl(),j=qn();return h.xs.getEntries(A,m).next((T=>{S=T,S.forEach(((D,V)=>{V.isValidDocument()||(j=j.add(D))}))})).next((()=>h.localDocuments.getOverlayedDocuments(A,S))).next((T=>{y=T;const D=[];for(const V of c){const U=hue(V,y.get(V.key).overlayedDocument);U!=null&&D.push(new Qd(V.key,U,X$(U.value.mapValue),_o.exists(!0)))}return h.mutationQueue.addMutationBatch(A,f,D,c)})).next((T=>{w=T;const D=T.applyToLocalDocumentSet(y,j);return h.documentOverlayCache.saveOverlays(A,T.batchId,D)}))})).then((()=>({batchId:w.batchId,changes:dH(y)})))})(n.localStore,t);n.sharedClientState.addPendingMutation(i.batchId),(function(o,c,h){let f=o.du[o.currentUser.toKey()];f||(f=new ls(kn)),f=f.insert(c,h),o.du[o.currentUser.toKey()]=f})(n,i.batchId,r),await If(n,i.changes),await Vg(n.remoteStore)}catch(i){const a=fT(i,"Failed to persist write");r.reject(a)}}async function vG(e,t){const r=Vr(e);try{const n=await ude(r.localStore,t);t.targetChanges.forEach(((i,a)=>{const o=r.Au.get(a);o&&(Yr(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?o.hu=!0:i.modifiedDocuments.size>0?Yr(o.hu,14607):i.removedDocuments.size>0&&(Yr(o.hu,42227),o.hu=!1))})),await If(r,n,t)}catch(n){await Sf(n)}}function $D(e,t,r){const n=Vr(e);if(n.isPrimaryClient&&r===0||!n.isPrimaryClient&&r===1){const i=[];n.Tu.forEach(((a,o)=>{const c=o.view.va(t);c.snapshot&&i.push(c.snapshot)})),(function(o,c){const h=Vr(o);h.onlineState=c;let f=!1;h.queries.forEach(((m,y)=>{for(const w of y.Sa)w.va(c)&&(f=!0)})),f&&gT(h)})(n.eventManager,t),i.length&&n.Pu.H_(i),n.onlineState=t,n.isPrimaryClient&&n.sharedClientState.setOnlineState(t)}}async function Kde(e,t,r){const n=Vr(e);n.sharedClientState.updateQueryState(t,"rejected",r);const i=n.Au.get(t),a=i&&i.key;if(a){let o=new ls(hr.comparator);o=o.insert(a,qs.newNoDocument(a,sn.min()));const c=qn().add(a),h=new Zy(sn.min(),new Map,new ls(kn),o,c);await vG(n,h),n.Ru=n.Ru.remove(a),n.Au.delete(t),wT(n)}else await vg(n.localStore,t,!1).then((()=>Eg(n,t,r))).catch(Sf)}async function Yde(e,t){const r=Vr(e),n=t.batch.batchId;try{const i=await cde(r.localStore,t);vT(r,n,null),bT(r,n),r.sharedClientState.updateMutationState(n,"acknowledged"),await If(r,i)}catch(i){await Sf(i)}}async function Xde(e,t,r){const n=Vr(e);try{const i=await(function(o,c){const h=Vr(o);return h.persistence.runTransaction("Reject batch","readwrite-primary",(f=>{let m;return h.mutationQueue.lookupMutationBatch(f,c).next((y=>(Yr(y!==null,37113),m=y.keys(),h.mutationQueue.removeMutationBatch(f,y)))).next((()=>h.mutationQueue.performConsistencyCheck(f))).next((()=>h.documentOverlayCache.removeOverlaysForBatchId(f,m,c))).next((()=>h.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(f,m))).next((()=>h.localDocuments.getDocuments(f,m)))}))})(n.localStore,t);vT(n,t,r),bT(n,t),n.sharedClientState.updateMutationState(t,"rejected",r),await If(n,i)}catch(i){await Sf(i)}}function bT(e,t){(e.mu.get(t)||[]).forEach((r=>{r.resolve()})),e.mu.delete(t)}function vT(e,t,r){const n=Vr(e);let i=n.du[n.currentUser.toKey()];if(i){const a=i.get(t);a&&(r?a.reject(r):a.resolve(),i=i.remove(t)),n.du[n.currentUser.toKey()]=i}}function Eg(e,t,r=null){e.sharedClientState.removeLocalQueryTarget(t);for(const n of e.Eu.get(t))e.Tu.delete(n),r&&e.Pu.yu(n,r);e.Eu.delete(t),e.isPrimaryClient&&e.Vu.Gr(t).forEach((n=>{e.Vu.containsKey(n)||wG(e,n)}))}function wG(e,t){e.Iu.delete(t.path.canonicalString());const r=e.Ru.get(t);r!==null&&(wg(e.remoteStore,r),e.Ru=e.Ru.remove(t),e.Au.delete(r),wT(e))}function AC(e,t,r){for(const n of r)n instanceof xG?(e.Vu.addReference(n.key,t),Qde(e,n)):n instanceof yG?($t($g,"Document no longer in limbo: "+n.key),e.Vu.removeReference(n.key,t),e.Vu.containsKey(n.key)||wG(e,n.key)):Tr(19791,{wu:n})}function Qde(e,t){const r=t.key,n=r.path.canonicalString();e.Ru.get(r)||e.Iu.has(n)||($t($g,"New document in limbo: "+r),e.Iu.add(n),wT(e))}function wT(e){for(;e.Iu.size>0&&e.Ru.size{o.push(n.pu(h,t,r).then((f=>{var m;if((f||r)&&n.isPrimaryClient){const y=f?!f.fromCache:(m=r==null?void 0:r.targetChanges.get(h.targetId))==null?void 0:m.current;n.sharedClientState.updateQueryState(h.targetId,y?"current":"not-current")}if(f){i.push(f);const y=aT.Is(h.targetId,f);a.push(y)}})))})),await Promise.all(o),n.Pu.H_(i),await(async function(h,f){const m=Vr(h);try{await m.persistence.runTransaction("notifyLocalViewChanges","readwrite",(y=>Qe.forEach(f,(w=>Qe.forEach(w.Ts,(A=>m.persistence.referenceDelegate.addReference(y,w.targetId,A))).next((()=>Qe.forEach(w.Es,(A=>m.persistence.referenceDelegate.removeReference(y,w.targetId,A)))))))))}catch(y){if(!Cf(y))throw y;$t(oT,"Failed to update sequence numbers: "+y)}for(const y of f){const w=y.targetId;if(!y.fromCache){const A=m.vs.get(w),S=A.snapshotVersion,j=A.withLastLimboFreeSnapshotVersion(S);m.vs=m.vs.insert(w,j)}}})(n.localStore,a))}async function Zde(e,t){const r=Vr(e);if(!r.currentUser.isEqual(t)){$t($g,"User change. New user:",t.toKey());const n=await eG(r.localStore,t);r.currentUser=t,(function(a,o){a.mu.forEach((c=>{c.forEach((h=>{h.reject(new tr(bt.CANCELLED,o))}))})),a.mu.clear()})(r,"'waitForPendingWrites' promise is rejected due to a user change."),r.sharedClientState.handleUserChange(t,n.removedBatchIds,n.addedBatchIds),await If(r,n.Ns)}}function Jde(e,t){const r=Vr(e),n=r.Au.get(t);if(n&&n.hu)return qn().add(n.key);{let i=qn();const a=r.Eu.get(t);if(!a)return i;for(const o of a){const c=r.Tu.get(o);i=i.unionWith(c.view.nu)}return i}}async function ehe(e,t){const r=Vr(e),n=await bC(r.localStore,t.query,!0),i=t.view.cu(n);return r.isPrimaryClient&&AC(r,t.targetId,i.au),i}async function the(e,t){const r=Vr(e);return nG(r.localStore,t).then((n=>If(r,n)))}async function rhe(e,t,r,n){const i=Vr(e),a=await(function(c,h){const f=Vr(c),m=Vr(f.mutationQueue);return f.persistence.runTransaction("Lookup mutation documents","readonly",(y=>m.Xn(y,h).next((w=>w?f.localDocuments.getDocuments(y,w):Qe.resolve(null)))))})(i.localStore,t);a!==null?(r==="pending"?await Vg(i.remoteStore):r==="acknowledged"||r==="rejected"?(vT(i,t,n||null),bT(i,t),(function(c,h){Vr(Vr(c).mutationQueue).nr(h)})(i.localStore,t)):Tr(6720,"Unknown batchState",{Su:r}),await If(i,a)):$t($g,"Cannot apply mutation batch with id: "+t)}async function nhe(e,t){const r=Vr(e);if(kE(r),NT(r),t===!0&&r.gu!==!0){const n=r.sharedClientState.getAllActiveQueryTargets(),i=await HD(r,n.toArray());r.gu=!0,await NC(r.remoteStore,!0);for(const a of i)AE(r.remoteStore,a)}else if(t===!1&&r.gu!==!1){const n=[];let i=Promise.resolve();r.Eu.forEach(((a,o)=>{r.sharedClientState.isLocalQueryTarget(o)?n.push(o):i=i.then((()=>(Eg(r,o),vg(r.localStore,o,!0)))),wg(r.remoteStore,o)})),await i,await HD(r,n),(function(o){const c=Vr(o);c.Au.forEach(((h,f)=>{wg(c.remoteStore,f)})),c.Vu.zr(),c.Au=new Map,c.Ru=new ls(hr.comparator)})(r),r.gu=!1,await NC(r.remoteStore,!1)}}async function HD(e,t,r){const n=Vr(e),i=[],a=[];for(const o of t){let c;const h=n.Eu.get(o);if(h&&h.length!==0){c=await A2(n.localStore,$l(h[0]));for(const f of h){const m=n.Tu.get(f),y=await ehe(n,m);y.snapshot&&a.push(y.snapshot)}}else{const f=await rG(n.localStore,o);c=await A2(n.localStore,f),await yT(n,NG(f),o,!1,c.resumeToken)}i.push(c)}return n.Pu.H_(a),i}function NG(e){return iH(e.path,e.collectionGroup,e.orderBy,e.filters,e.limit,"F",e.startAt,e.endAt)}function ihe(e){return(function(r){return Vr(Vr(r).persistence).hs()})(Vr(e).localStore)}async function she(e,t,r,n){const i=Vr(e);if(i.gu)return void $t($g,"Ignoring unexpected query state notification.");const a=i.Eu.get(t);if(a&&a.length>0)switch(r){case"current":case"not-current":{const o=await nG(i.localStore,lH(a[0])),c=Zy.createSynthesizedRemoteEventForCurrentChange(t,r==="current",Zs.EMPTY_BYTE_STRING);await If(i,o,c);break}case"rejected":await vg(i.localStore,t,!0),Eg(i,t,n);break;default:Tr(64155,r)}}async function ahe(e,t,r){const n=kE(e);if(n.gu){for(const i of t){if(n.Eu.has(i)&&n.sharedClientState.isActiveQueryTarget(i)){$t($g,"Adding an already active target "+i);continue}const a=await rG(n.localStore,i),o=await A2(n.localStore,a);await yT(n,NG(a),o.targetId,!1,o.resumeToken),AE(n.remoteStore,o)}for(const i of r)n.Eu.has(i)&&await vg(n.localStore,i,!1).then((()=>{wg(n.remoteStore,i),Eg(n,i)})).catch(Sf)}}function kE(e){const t=Vr(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=vG.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Jde.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=Kde.bind(null,t),t.Pu.H_=Lde.bind(null,t.eventManager),t.Pu.yu=Ude.bind(null,t.eventManager),t}function NT(e){const t=Vr(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Yde.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=Xde.bind(null,t),t}class xy{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(t){this.serializer=NE(t.databaseInfo.databaseId),this.sharedClientState=this.Du(t),this.persistence=this.Cu(t),await this.persistence.start(),this.localStore=this.vu(t),this.gcScheduler=this.Fu(t,this.localStore),this.indexBackfillerScheduler=this.Mu(t,this.localStore)}Fu(t,r){return null}Mu(t,r){return null}vu(t){return JH(this.persistence,new ZH,t.initialUser,this.serializer)}Cu(t){return new iT(wE.Vi,this.serializer)}Du(t){return new lG}async terminate(){var t,r;(t=this.gcScheduler)==null||t.stop(),(r=this.indexBackfillerScheduler)==null||r.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}xy.provider={build:()=>new xy};class EG extends xy{constructor(t){super(),this.cacheSizeBytes=t}Fu(t,r){Yr(this.persistence.referenceDelegate instanceof E2,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new qH(n,t.asyncQueue,r)}Cu(t){const r=this.cacheSizeBytes!==void 0?No.withCacheSize(this.cacheSizeBytes):No.DEFAULT;return new iT((n=>E2.Vi(n,r)),this.serializer)}}class AG extends xy{constructor(t,r,n){super(),this.xu=t,this.cacheSizeBytes=r,this.forceOwnership=n,this.kind="persistent",this.synchronizeTabs=!1}async initialize(t){await super.initialize(t),await this.xu.initialize(this,t),await NT(this.xu.syncEngine),await Vg(this.xu.remoteStore),await this.persistence.zi((()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve())))}vu(t){return JH(this.persistence,new ZH,t.initialUser,this.serializer)}Fu(t,r){const n=this.persistence.referenceDelegate.garbageCollector;return new qH(n,t.asyncQueue,r)}Mu(t,r){const n=new hce(r,this.persistence);return new dce(t.asyncQueue,n)}Cu(t){const r=QH(t.databaseInfo.databaseId,t.databaseInfo.persistenceKey),n=this.cacheSizeBytes!==void 0?No.withCacheSize(this.cacheSizeBytes):No.DEFAULT;return new sT(this.synchronizeTabs,r,t.clientId,n,t.asyncQueue,cG(),Dw(),this.serializer,this.sharedClientState,!!this.forceOwnership)}Du(t){return new lG}}class ohe extends AG{constructor(t,r){super(t,r,!1),this.xu=t,this.cacheSizeBytes=r,this.synchronizeTabs=!0}async initialize(t){await super.initialize(t);const r=this.xu.syncEngine;this.sharedClientState instanceof pk&&(this.sharedClientState.syncEngine={bo:rhe.bind(null,r),Do:she.bind(null,r),Co:ahe.bind(null,r),hs:ihe.bind(null,r),So:the.bind(null,r)},await this.sharedClientState.start()),await this.persistence.zi((async n=>{await nhe(this.xu.syncEngine,n),this.gcScheduler&&(n&&!this.gcScheduler.started?this.gcScheduler.start():n||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(n&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():n||this.indexBackfillerScheduler.stop())}))}Du(t){const r=cG();if(!pk.v(r))throw new tr(bt.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");const n=QH(t.databaseInfo.databaseId,t.databaseInfo.persistenceKey);return new pk(r,t.asyncQueue,n,t.clientId,t.initialUser)}}class Ag{async initialize(t,r){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(r),this.remoteStore=this.createRemoteStore(r),this.eventManager=this.createEventManager(r),this.syncEngine=this.createSyncEngine(r,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=n=>$D(this.syncEngine,n,1),this.remoteStore.remoteSyncer.handleCredentialChange=Zde.bind(null,this.syncEngine),await NC(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return(function(){return new Mde})()}createDatastore(t){const r=NE(t.databaseInfo.databaseId),n=xde(t.databaseInfo);return Nde(t.authCredentials,t.appCheckCredentials,n,r)}createRemoteStore(t){return(function(n,i,a,o,c){return new Ade(n,i,a,o,c)})(this.localStore,this.datastore,t.asyncQueue,(r=>$D(this.syncEngine,r,0)),(function(){return LD.v()?new LD:new fde})())}createSyncEngine(t,r){return(function(i,a,o,c,h,f,m){const y=new Fde(i,a,o,c,h,f);return m&&(y.gu=!0),y})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,r)}async terminate(){var t,r;await(async function(i){const a=Vr(i);$t(sm,"RemoteStore shutting down."),a.Ia.add(5),await eb(a),a.Aa.shutdown(),a.Va.set("Unknown")})(this.remoteStore),(t=this.datastore)==null||t.terminate(),(r=this.eventManager)==null||r.terminate()}}Ag.provider={build:()=>new Ag};/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ET{constructor(t){this.observer=t,this.muted=!1}next(t){this.muted||this.observer.next&&this.Ou(this.observer.next,t)}error(t){this.muted||(this.observer.error?this.Ou(this.observer.error,t):Qs("Uncaught Error in snapshot listener:",t.toString()))}Nu(){this.muted=!0}Ou(t,r){setTimeout((()=>{this.muted||t(r)}),0)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const vf="FirestoreClient";class lhe{constructor(t,r,n,i,a){this.authCredentials=t,this.appCheckCredentials=r,this.asyncQueue=n,this._databaseInfo=i,this.user=wo.UNAUTHENTICATED,this.clientId=DI.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=a,this.authCredentials.start(n,(async o=>{$t(vf,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o})),this.appCheckCredentials.start(n,(o=>($t(vf,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Gc;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(r){const n=fT(r,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function gk(e,t){e.asyncQueue.verifyOperationInProgress(),$t(vf,"Initializing OfflineComponentProvider");const r=e.configuration;await t.initialize(r);let n=r.initialUser;e.setCredentialChangeListener((async i=>{n.isEqual(i)||(await eG(t.localStore,i),n=i)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}async function GD(e,t){e.asyncQueue.verifyOperationInProgress();const r=await che(e);$t(vf,"Initializing OnlineComponentProvider"),await t.initialize(r,e.configuration),e.setCredentialChangeListener((n=>BD(t.remoteStore,n))),e.setAppCheckTokenChangeListener(((n,i)=>BD(t.remoteStore,i))),e._onlineComponents=t}async function che(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){$t(vf,"Using user provided OfflineComponentProvider");try{await gk(e,e._uninitializedComponentsProvider._offline)}catch(t){const r=t;if(!(function(i){return i.name==="FirebaseError"?i.code===bt.FAILED_PRECONDITION||i.code===bt.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11})(r))throw r;ag("Error using user provided cache. Falling back to memory cache: "+r),await gk(e,new xy)}}else $t(vf,"Using default OfflineComponentProvider"),await gk(e,new EG(void 0));return e._offlineComponents}async function AT(e){return e._onlineComponents||(e._uninitializedComponentsProvider?($t(vf,"Using user provided OnlineComponentProvider"),await GD(e,e._uninitializedComponentsProvider._online)):($t(vf,"Using default OnlineComponentProvider"),await GD(e,new Ag))),e._onlineComponents}function uhe(e){return AT(e).then((t=>t.syncEngine))}function dhe(e){return AT(e).then((t=>t.datastore))}async function C2(e){const t=await AT(e),r=t.eventManager;return r.onListen=$de.bind(null,t.syncEngine),r.onUnlisten=Gde.bind(null,t.syncEngine),r.onFirstRemoteStoreListen=Hde.bind(null,t.syncEngine),r.onLastRemoteStoreUnlisten=qde.bind(null,t.syncEngine),r}function hhe(e,t,r,n){const i=new ET(n),a=new xT(t,i,r);return e.asyncQueue.enqueueAndForget((async()=>pT(await C2(e),a))),()=>{i.Nu(),e.asyncQueue.enqueueAndForget((async()=>mT(await C2(e),a)))}}function fhe(e,t,r={}){const n=new Gc;return e.asyncQueue.enqueueAndForget((async()=>(function(a,o,c,h,f){const m=new ET({next:w=>{m.Nu(),o.enqueueAndForget((()=>mT(a,y)));const A=w.docs.has(c);!A&&w.fromCache?f.reject(new tr(bt.UNAVAILABLE,"Failed to get document because the client is offline.")):A&&w.fromCache&&h&&h.source==="server"?f.reject(new tr(bt.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):f.resolve(w)},error:w=>f.reject(w)}),y=new xT(Yy(c.path),m,{includeMetadataChanges:!0,qa:!0});return pT(a,y)})(await C2(e),e.asyncQueue,t,r,n))),n.promise}function phe(e,t,r={}){const n=new Gc;return e.asyncQueue.enqueueAndForget((async()=>(function(a,o,c,h,f){const m=new ET({next:w=>{m.Nu(),o.enqueueAndForget((()=>mT(a,y))),w.fromCache&&h.source==="server"?f.reject(new tr(bt.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):f.resolve(w)},error:w=>f.reject(w)}),y=new xT(c,m,{includeMetadataChanges:!0,qa:!0});return pT(a,y)})(await C2(e),e.asyncQueue,t,r,n))),n.promise}function mhe(e,t,r){const n=new Gc;return e.asyncQueue.enqueueAndForget((async()=>{try{const i=await dhe(e);n.resolve((async function(o,c,h){var j;const f=Vr(o),{request:m,gt:y,parent:w}=Sue(f.serializer,eue(c),h);f.connection.qo||delete m.parent;const A=(await f.jo("RunAggregationQuery",f.serializer.databaseId,w,m,1)).filter((T=>!!T.result));Yr(A.length===1,64727);const S=(j=A[0].result)==null?void 0:j.aggregateFields;return Object.keys(S).reduce(((T,D)=>(T[y[D]]=S[D],T)),{})})(i,t,r))}catch(i){n.reject(i)}})),n.promise}function ghe(e,t){const r=new Gc;return e.asyncQueue.enqueueAndForget((async()=>Wde(await uhe(e),t,r))),r.promise}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function kG(e){const t={};return e.timeoutSeconds!==void 0&&(t.timeoutSeconds=e.timeoutSeconds),t}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const xhe="ComponentProvider",qD=new Map;function yhe(e,t,r,n,i){return new Vce(e,t,r,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,kG(i.experimentalLongPollingOptions),i.useFetchStreams,i.isUsingEmulator,n)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const bhe="firestore.googleapis.com",WD=!0;class KD{constructor(t){if(t.host===void 0){if(t.ssl!==void 0)throw new tr(bt.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=bhe,this.ssl=WD}else this.host=t.host,this.ssl=t.ssl??WD;if(this.isUsingEmulator=t.emulatorOptions!==void 0,this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,t.cacheSizeBytes===void 0)this.cacheSizeBytes=VH;else{if(t.cacheSizeBytes!==-1&&t.cacheSizeBytes30)throw new tr(bt.INVALID_ARGUMENT,`invalid long polling timeout: ${n.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&(function(n,i){return n.timeoutSeconds===i.timeoutSeconds})(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}class _E{constructor(t,r,n,i){this._authCredentials=t,this._appCheckCredentials=r,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new KD({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new tr(bt.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(t){if(this._settingsFrozen)throw new tr(bt.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new KD(t),this._emulatorOptions=t.emulatorOptions||{},t.credentials!==void 0&&(this._authCredentials=(function(n){if(!n)return new Zle;switch(n.type){case"firstParty":return new tce(n.sessionIndex||"0",n.iamToken||null,n.authTokenFactory||null);case"provider":return n.client;default:throw new tr(bt.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}})(t.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(r){const n=qD.get(r);n&&($t(xhe,"Removing Datastore"),qD.delete(r),n.terminate())})(this),Promise.resolve()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Zu{constructor(t,r,n){this.converter=r,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Zu(this.firestore,t,this._query)}}class Ws{constructor(t,r,n){this.converter=r,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new ff(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Ws(this.firestore,t,this._key)}toJSON(){return{type:Ws._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,r,n){if(qy(r,Ws._jsonSchema))return new Ws(t,n||null,new hr(ki.fromString(r.referencePath)))}}Ws._jsonSchemaVersion="firestore/documentReference/1.0",Ws._jsonSchema={type:ua("string",Ws._jsonSchemaVersion),referencePath:ua("string")};class ff extends Zu{constructor(t,r,n){super(t,r,Yy(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Ws(this.firestore,null,new hr(t))}withConverter(t){return new ff(this.firestore,t,this._path)}}function nt(e,t,...r){if(e=Sa(e),MI("collection","path",t),e instanceof _E){const n=ki.fromString(t,...r);return UR(n),new ff(e,null,n)}{if(!(e instanceof Ws||e instanceof ff))throw new tr(bt.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const n=e._path.child(ki.fromString(t,...r));return UR(n),new ff(e.firestore,null,n)}}function vhe(e,t){if(e=$o(e,_E),MI("collectionGroup","collection id",t),t.indexOf("/")>=0)throw new tr(bt.INVALID_ARGUMENT,`Invalid collection ID '${t}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new Zu(e,null,(function(n){return new gm(ki.emptyPath(),n)})(t))}function st(e,t,...r){if(e=Sa(e),arguments.length===1&&(t=DI.newId()),MI("doc","path",t),e instanceof _E){const n=ki.fromString(t,...r);return LR(n),new Ws(e,null,new hr(n))}{if(!(e instanceof Ws||e instanceof ff))throw new tr(bt.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const n=e._path.child(ki.fromString(t,...r));return LR(n),new Ws(e.firestore,e instanceof ff?e.converter:null,new hr(n))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const YD="AsyncQueue";class XD{constructor(t=Promise.resolve()){this.Yu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new uG(this,"async_queue_retry"),this._c=()=>{const n=Dw();n&&$t(YD,"Visibility state changed to "+n.visibilityState),this.M_.w_()},this.ac=t;const r=Dw();r&&typeof r.addEventListener=="function"&&r.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.uc(),this.cc(t)}enterRestrictedMode(t){if(!this.ec){this.ec=!0,this.sc=t||!1;const r=Dw();r&&typeof r.removeEventListener=="function"&&r.removeEventListener("visibilitychange",this._c)}}enqueue(t){if(this.uc(),this.ec)return new Promise((()=>{}));const r=new Gc;return this.cc((()=>this.ec&&this.sc?Promise.resolve():(t().then(r.resolve,r.reject),r.promise))).then((()=>r.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Yu.push(t),this.lc())))}async lc(){if(this.Yu.length!==0){try{await this.Yu[0](),this.Yu.shift(),this.M_.reset()}catch(t){if(!Cf(t))throw t;$t(YD,"Operation failed with retryable error: "+t)}this.Yu.length>0&&this.M_.p_((()=>this.lc()))}}cc(t){const r=this.ac.then((()=>(this.rc=!0,t().catch((n=>{throw this.nc=n,this.rc=!1,Qs("INTERNAL UNHANDLED ERROR: ",QD(n)),n})).then((n=>(this.rc=!1,n))))));return this.ac=r,r}enqueueAfterDelay(t,r,n){this.uc(),this.oc.indexOf(t)>-1&&(r=0);const i=hT.createAndSchedule(this,t,r,n,(a=>this.hc(a)));return this.tc.push(i),i}uc(){this.nc&&Tr(47125,{Pc:QD(this.nc)})}verifyOperationInProgress(){}async Tc(){let t;do t=this.ac,await t;while(t!==this.ac)}Ec(t){for(const r of this.tc)if(r.timerId===t)return!0;return!1}Ic(t){return this.Tc().then((()=>{this.tc.sort(((r,n)=>r.targetTimeMs-n.targetTimeMs));for(const r of this.tc)if(r.skipDelay(),t!=="all"&&r.timerId===t)break;return this.Tc()}))}Rc(t){this.oc.push(t)}hc(t){const r=this.tc.indexOf(t);this.tc.splice(r,1)}}function QD(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+` `+e.stack),t}class Fu extends _E{constructor(t,r,n,i){super(t,r,n,i),this.type="firestore",this._queue=new XD,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const t=this._firestoreClient.terminate();this._queue=new XD(t),this._firestoreClient=void 0,await t}}}function whe(e,t,r){const n=EI(e,"firestore");if(n.isInitialized(r)){const i=n.getImmediate({identifier:r}),a=n.getOptions(r);if(Ud(a,t))return i;throw new tr(bt.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(t.cacheSizeBytes!==void 0&&t.localCache!==void 0)throw new tr(bt.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(t.cacheSizeBytes!==void 0&&t.cacheSizeBytes!==-1&&t.cacheSizeBytes90)throw new tr(bt.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(r)||r<-180||r>180)throw new tr(bt.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+r);this._lat=t,this._long=r}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}_compareTo(t){return kn(this._lat,t._lat)||kn(this._long,t._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Mu._jsonSchemaVersion}}static fromJSON(t){if(qy(t,Mu._jsonSchema))return new Mu(t.latitude,t.longitude)}}Mu._jsonSchemaVersion="firestore/geoPoint/1.0",Mu._jsonSchema={type:ua("string",Mu._jsonSchemaVersion),latitude:ua("number"),longitude:ua("number")};/** * @license * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class qc{constructor(t){this._values=(t||[]).map((r=>r))}toArray(){return this._values.map((t=>t))}isEqual(t){return(function(n,i){if(n.length!==i.length)return!1;for(let a=0;atypeof r=="number")))return new qc(t.vectorValues);throw new tr(bt.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}qc._jsonSchemaVersion="firestore/vectorValue/1.0",qc._jsonSchema={type:ua("string",qc._jsonSchemaVersion),vectorValues:ua("object")};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Ehe=/^__.*__$/;class Ahe{constructor(t,r,n){this.data=t,this.fieldMask=r,this.fieldTransforms=n}toMutation(t,r){return this.fieldMask!==null?new Qd(t,this.data,this.fieldMask,r,this.fieldTransforms):new zg(t,this.data,r,this.fieldTransforms)}}class _G{constructor(t,r,n){this.data=t,this.fieldMask=r,this.fieldTransforms=n}toMutation(t,r){return new Qd(t,this.data,this.fieldMask,r,this.fieldTransforms)}}function SG(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Tr(40011,{dataSource:e})}}class SE{constructor(t,r,n,i,a,o){this.settings=t,this.databaseId=r,this.serializer=n,this.ignoreUndefinedProperties=i,a===void 0&&this.Ac(),this.fieldTransforms=a||[],this.fieldMask=o||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}i(t){return new SE({...this.settings,...t},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}dc(t){var i;const r=(i=this.path)==null?void 0:i.child(t),n=this.i({path:r,arrayElement:!1});return n.mc(t),n}fc(t){var i;const r=(i=this.path)==null?void 0:i.child(t),n=this.i({path:r,arrayElement:!1});return n.Ac(),n}gc(t){return this.i({path:void 0,arrayElement:!0})}yc(t){return j2(t,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(t){return this.fieldMask.find((r=>t.isPrefixOf(r)))!==void 0||this.fieldTransforms.find((r=>t.isPrefixOf(r.field)))!==void 0}Ac(){if(this.path)for(let t=0;th.covers(y.field)))}else h=null,f=o.fieldTransforms;return new Ahe(new ao(c),h,f)}class jE extends ym{_toFieldTransform(t){if(t.dataSource!==2)throw t.dataSource===1?t.yc(`${this._methodName}() can only appear at the top level of your update data`):t.yc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return t.fieldMask.push(t.path),null}isEqual(t){return t instanceof jE}}function jG(e,t,r){return new SE({dataSource:3,targetDoc:t.settings.targetDoc,methodName:e._methodName,arrayElement:r},t.databaseId,t.serializer,t.ignoreUndefinedProperties)}class _T extends ym{_toFieldTransform(t){return new Qy(t.path,new xg)}isEqual(t){return t instanceof _T}}class ST extends ym{constructor(t,r){super(t),this.Sc=r}_toFieldTransform(t){const r=jG(this,t,!0),n=this.Sc.map((a=>bm(a,r))),i=new em(n);return new Qy(t.path,i)}isEqual(t){return t instanceof ST&&Ud(this.Sc,t.Sc)}}class CT extends ym{constructor(t,r){super(t),this.Sc=r}_toFieldTransform(t){const r=jG(this,t,!0),n=this.Sc.map((a=>bm(a,r))),i=new tm(n);return new Qy(t.path,i)}isEqual(t){return t instanceof CT&&Ud(this.Sc,t.Sc)}}class jT extends ym{constructor(t,r){super(t),this.bc=r}_toFieldTransform(t){const r=new yg(t.serializer,pH(t.serializer,this.bc));return new Qy(t.path,r)}isEqual(t){return t instanceof jT&&this.bc===t.bc}}function _he(e,t,r,n){const i=e.A(1,t,r);IT("Data must be an object, but it was:",i,n);const a=[],o=ao.empty();jf(n,((h,f)=>{const m=PG(t,h,r);f=Sa(f);const y=i.fc(m);if(f instanceof jE)a.push(m);else{const w=bm(f,y);w!=null&&(a.push(m),o.set(m,w))}}));const c=new hl(a);return new _G(o,c,i.fieldTransforms)}function She(e,t,r,n,i,a){const o=e.A(1,t,r),c=[am(t,n,r)],h=[i];if(a.length%2!=0)throw new tr(bt.INVALID_ARGUMENT,`Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let w=0;w=0;--w)if(!OG(f,c[w])){const A=c[w];let S=h[w];S=Sa(S);const j=o.fc(A);if(S instanceof jE)f.push(A);else{const T=bm(S,j);T!=null&&(f.push(A),m.set(A,T))}}const y=new hl(f);return new _G(m,y,o.fieldTransforms)}function Che(e,t,r,n=!1){return bm(r,e.A(n?4:3,t))}function bm(e,t){if(TG(e=Sa(e)))return IT("Unsupported field value:",t,e),IG(e,t);if(e instanceof ym)return(function(n,i){if(!SG(i.dataSource))throw i.yc(`${n._methodName}() can only be used with update() and set()`);if(!i.path)throw i.yc(`${n._methodName}() is not currently supported inside arrays`);const a=n._toFieldTransform(i);a&&i.fieldTransforms.push(a)})(e,t),null;if(e===void 0&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.arrayElement&&t.dataSource!==4)throw t.yc("Nested arrays are not supported");return(function(n,i){const a=[];let o=0;for(const c of n){let h=bm(c,i.gc(o));h==null&&(h={nullValue:"NULL_VALUE"}),a.push(h),o++}return{arrayValue:{values:a}}})(e,t)}return(function(n,i){if((n=Sa(n))===null)return{nullValue:"NULL_VALUE"};if(typeof n=="number")return pH(i.serializer,n);if(typeof n=="boolean")return{booleanValue:n};if(typeof n=="string")return{stringValue:n};if(n instanceof Date){const a=wn.fromDate(n);return{timestampValue:bg(i.serializer,a)}}if(n instanceof wn){const a=new wn(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:bg(i.serializer,a)}}if(n instanceof Mu)return{geoPointValue:{latitude:n.latitude,longitude:n.longitude}};if(n instanceof gc)return{bytesValue:kH(i.serializer,n._byteString)};if(n instanceof Ws){const a=i.databaseId,o=n.firestore._databaseId;if(!o.isEqual(a))throw i.yc(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${a.projectId}/${a.database}`);return{referenceValue:JI(n.firestore._databaseId||i.databaseId,n._key.path)}}if(n instanceof qc)return(function(o,c){const h=o instanceof qc?o.toArray():o;return{mapValue:{fields:{[HI]:{stringValue:GI},[fg]:{arrayValue:{values:h.map((m=>{if(typeof m!="number")throw c.yc("VectorValues must only contain numeric values.");return KI(c.serializer,m)}))}}}}}})(n,i);if(DH(n))return n._toProto(i.serializer);throw i.yc(`Unsupported field value: ${oE(n)}`)})(e,t)}function IG(e,t){const r={};return V$(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):jf(e,((n,i)=>{const a=bm(i,t.dc(n));a!=null&&(r[n]=a)})),{mapValue:{fields:r}}}function TG(e){return!(typeof e!="object"||e===null||e instanceof Array||e instanceof Date||e instanceof wn||e instanceof Mu||e instanceof gc||e instanceof Ws||e instanceof ym||e instanceof qc||DH(e))}function IT(e,t,r){if(!TG(r)||!A$(r)){const n=oE(r);throw n==="an object"?t.yc(e+" a custom object"):t.yc(e+" "+n)}}function am(e,t,r){if((t=Sa(t))instanceof kT)return t._internalPath;if(typeof t=="string")return PG(e,t);throw j2("Field path arguments must be of type string or ",e,!1,void 0,r)}const jhe=new RegExp("[~\\*/\\[\\]]");function PG(e,t,r){if(t.search(jhe)>=0)throw j2(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,r);try{return new kT(...t.split("."))._internalPath}catch{throw j2(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,r)}}function j2(e,t,r,n,i){const a=n&&!n.isEmpty(),o=i!==void 0;let c=`Function ${t}() called with invalid data`;r&&(c+=" (via `toFirestore()`)"),c+=". ";let h="";return(a||o)&&(h+=" (found",a&&(h+=` in field ${n}`),o&&(h+=` in document ${i}`),h+=")"),new tr(bt.INVALID_ARGUMENT,c+e+h)}function OG(e,t){return e.some((r=>r.isEqual(t)))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ihe{convertValue(t,r="none"){switch(xf(t)){case 0:return null;case 1:return t.booleanValue;case 2:return As(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,r);case 5:return t.stringValue;case 6:return this.convertBytes(Fd(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,r);case 11:return this.convertObject(t.mapValue,r);case 10:return this.convertVectorValue(t.mapValue);default:throw Tr(62114,{value:t})}}convertObject(t,r){return this.convertObjectMap(t.fields,r)}convertObjectMap(t,r="none"){const n={};return jf(t,((i,a)=>{n[i]=this.convertValue(a,r)})),n}convertVectorValue(t){var n,i,a;const r=(a=(i=(n=t.fields)==null?void 0:n[fg].arrayValue)==null?void 0:i.values)==null?void 0:a.map((o=>As(o.doubleValue)));return new qc(r)}convertGeoPoint(t){return new Mu(As(t.latitude),As(t.longitude))}convertArray(t,r){return(t.values||[]).map((n=>this.convertValue(n,r)))}convertServerTimestamp(t,r){switch(r){case"previous":const n=fE(t);return n==null?null:this.convertValue(n,r);case"estimate":return this.convertTimestamp(hy(t));default:return null}}convertTimestamp(t){const r=Vd(t);return new wn(r.seconds,r.nanos)}convertDocumentKey(t,r){const n=ki.fromString(t);Yr(RH(n),9688,{name:t});const i=new Zp(n.get(1),n.get(3)),a=new hr(n.popFirst(5));return i.isEqual(r)||Qs(`Document ${a} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${r.projectId}/${r.database}) instead.`),a}}/** * @license * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class IE extends Ihe{constructor(t){super(),this.firestore=t}convertBytes(t){return new gc(t)}convertReference(t){const r=this.convertDocumentKey(t,this.firestore._databaseId);return new Ws(this.firestore,null,r)}}function zr(){return new _T("serverTimestamp")}function I2(...e){return new ST("arrayUnion",e)}function T2(...e){return new CT("arrayRemove",e)}function Cn(e){return new jT("increment",e)}const ZD="@firebase/firestore",JD="4.13.0";/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function e8(e){return(function(r,n){if(typeof r!="object"||r===null)return!1;const i=r;for(const a of n)if(a in i&&typeof i[a]=="function")return!0;return!1})(e,["next","error","complete"])}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class The{constructor(t="count",r){this._internalFieldPath=r,this.type="AggregateField",this.aggregateType=t}}class Phe{constructor(t,r,n){this._userDataWriter=r,this._data=n,this.type="AggregateQuerySnapshot",this.query=t}data(){return this._userDataWriter.convertObjectMap(this._data)}_fieldsProto(){return new ao({mapValue:{fields:this._data}}).clone().value.mapValue.fields}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class RG{constructor(t,r,n,i,a){this._firestore=t,this._userDataWriter=r,this._key=n,this._document=i,this._converter=a}get id(){return this._key.path.lastSegment()}get ref(){return new Ws(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const t=new Ohe(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){var t;return((t=this._document)==null?void 0:t.data.clone().value.mapValue.fields)??void 0}get(t){if(this._document){const r=this._document.data.field(am("DocumentSnapshot.get",t));if(r!==null)return this._userDataWriter.convertValue(r)}}}class Ohe extends RG{data(){return super.data()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function DG(e){if(e.limitType==="L"&&e.explicitOrderBy.length===0)throw new tr(bt.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class TT{}class PT extends TT{}function Jt(e,t,...r){let n=[];t instanceof TT&&n.push(t),n=n.concat(r),(function(a){const o=a.filter((h=>h instanceof OT)).length,c=a.filter((h=>h instanceof TE)).length;if(o>1||o>0&&c>0)throw new tr(bt.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")})(n);for(const i of n)e=i._apply(e);return e}class TE extends PT{constructor(t,r,n){super(),this._field=t,this._op=r,this._value=n,this.type="where"}static _create(t,r,n){return new TE(t,r,n)}_apply(t){const r=this._parse(t);return MG(t._query,r),new Zu(t.firestore,t.converter,dC(t._query,r))}_parse(t){const r=CE(t.firestore);return(function(a,o,c,h,f,m,y){let w;if(f.isKeyField()){if(m==="array-contains"||m==="array-contains-any")throw new tr(bt.INVALID_ARGUMENT,`Invalid Query. You can't perform '${m}' queries on documentId().`);if(m==="in"||m==="not-in"){r8(y,m);const S=[];for(const j of y)S.push(t8(h,a,j));w={arrayValue:{values:S}}}else w=t8(h,a,y)}else m!=="in"&&m!=="not-in"&&m!=="array-contains-any"||r8(y,m),w=Che(c,o,y,m==="in"||m==="not-in");return li.create(f,m,w)})(t._query,"where",r,t.firestore._databaseId,this._field,this._op,this._value)}}function An(e,t,r){const n=t,i=am("where",e);return TE._create(i,n,r)}class OT extends TT{constructor(t,r){super(),this.type=t,this._queryConstraints=r}static _create(t,r){return new OT(t,r)}_parse(t){const r=this._queryConstraints.map((n=>n._parse(t))).filter((n=>n.getFilters().length>0));return r.length===1?r[0]:Gi.create(r,this._getOperator())}_apply(t){const r=this._parse(t);return r.getFilters().length===0?t:((function(i,a){let o=i;const c=a.getFlattenedFilters();for(const h of c)MG(o,h),o=dC(o,h)})(t._query,r),new Zu(t.firestore,t.converter,dC(t._query,r)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class RT extends PT{constructor(t,r){super(),this._field=t,this._direction=r,this.type="orderBy"}static _create(t,r){return new RT(t,r)}_apply(t){const r=(function(i,a,o){if(i.startAt!==null)throw new tr(bt.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new tr(bt.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new gy(a,o)})(t._query,this._field,this._direction);return new Zu(t.firestore,t.converter,tue(t._query,r))}}function di(e,t="asc"){const r=t,n=am("orderBy",e);return RT._create(n,r)}class DT extends PT{constructor(t,r,n){super(),this.type=t,this._limit=r,this._limitType=n}static _create(t,r,n){return new DT(t,r,n)}_apply(t){return new Zu(t.firestore,t.converter,x2(t._query,this._limit,this._limitType))}}function yi(e){return lce("limit",e),DT._create("limit",e,"F")}function t8(e,t,r){if(typeof(r=Sa(r))=="string"){if(r==="")throw new tr(bt.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!sH(t)&&r.indexOf("/")!==-1)throw new tr(bt.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);const n=t.path.child(ki.fromString(r));if(!hr.isDocumentKey(n))throw new tr(bt.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${n}' is not because it has an odd number of segments (${n.length}).`);return py(e,new hr(n))}if(r instanceof Ws)return py(e,r._key);throw new tr(bt.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${oE(r)}.`)}function r8(e,t){if(!Array.isArray(e)||e.length===0)throw new tr(bt.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function MG(e,t){const r=(function(i,a){for(const o of i)for(const c of o.getFlattenedFilters())if(a.indexOf(c.op)>=0)return c.op;return null})(e.filters,(function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(t.op));if(r!==null)throw r===t.op?new tr(bt.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new tr(bt.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${r.toString()}' filters.`)}function LG(e,t,r){let n;return n=e?r&&(r.merge||r.mergeFields)?e.toFirestore(t,r):e.toFirestore(t):t,n}function Rhe(){return new The("count")}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Jx(e){return Dhe(e,{count:Rhe()})}function Dhe(e,t){const r=$o(e.firestore,Fu),n=tb(r),i=Bce(t,((a,o)=>new fue(o,a.aggregateType,a._internalFieldPath)));return mhe(n,e._query,i).then((a=>(function(c,h,f){const m=new IE(c);return new Phe(h,m,f)})(r,e,a)))}class Mhe{constructor(t){this.kind="memory",this._onlineComponentProvider=Ag.provider,this._offlineComponentProvider=t!=null&&t.garbageCollector?t.garbageCollector._offlineComponentProvider:{build:()=>new EG(void 0)}}toJSON(){return{kind:this.kind}}}class Lhe{constructor(t){let r;this.kind="persistent",t!=null&&t.tabManager?(t.tabManager._initialize(t),r=t.tabManager):(r=Fhe(void 0),r._initialize(t)),this._onlineComponentProvider=r._onlineComponentProvider,this._offlineComponentProvider=r._offlineComponentProvider}toJSON(){return{kind:this.kind}}}function Uhe(e){return new Mhe(e)}function Bhe(e){return new Lhe(e)}class zhe{constructor(t){this.forceOwnership=t,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(t){this._onlineComponentProvider=Ag.provider,this._offlineComponentProvider={build:r=>new AG(r,t==null?void 0:t.cacheSizeBytes,this.forceOwnership)}}}class Vhe{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(t){this._onlineComponentProvider=Ag.provider,this._offlineComponentProvider={build:r=>new ohe(r,t==null?void 0:t.cacheSizeBytes)}}}function Fhe(e){return new zhe(e==null?void 0:e.forceOwnership)}function $he(){return new Vhe}class _1{constructor(t,r){this.hasPendingWrites=t,this.fromCache=r}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Dp extends RG{constructor(t,r,n,i,a,o){super(t,r,n,i,o),this._firestore=t,this._firestoreImpl=t,this.metadata=a}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const r=new Mw(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(r,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,r={}){if(this._document){const n=this._document.data.field(am("DocumentSnapshot.get",t));if(n!==null)return this._userDataWriter.convertValue(n,r.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new tr(bt.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t=this._document,r={};return r.type=Dp._jsonSchemaVersion,r.bundle="",r.bundleSource="DocumentSnapshot",r.bundleName=this._key.toString(),!t||!t.isValidDocument()||!t.isFoundDocument()?r:(this._userDataWriter.convertObjectMap(t.data.value.mapValue.fields,"previous"),r.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),r)}}Dp._jsonSchemaVersion="firestore/documentSnapshot/1.0",Dp._jsonSchema={type:ua("string",Dp._jsonSchemaVersion),bundleSource:ua("string","DocumentSnapshot"),bundleName:ua("string"),bundle:ua("string")};class Mw extends Dp{data(t={}){return super.data(t)}}class Mp{constructor(t,r,n,i){this._firestore=t,this._userDataWriter=r,this._snapshot=i,this.metadata=new _1(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){const t=[];return this.forEach((r=>t.push(r))),t}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(t,r){this._snapshot.docs.forEach((n=>{t.call(r,new Mw(this._firestore,this._userDataWriter,n.key,n,new _1(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const r=!!t.includeMetadataChanges;if(r&&this._snapshot.excludesMetadataChanges)throw new tr(bt.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===r||(this._cachedChanges=(function(i,a){if(i._snapshot.oldDocs.isEmpty()){let o=0;return i._snapshot.docChanges.map((c=>{const h=new Mw(i._firestore,i._userDataWriter,c.doc.key,c.doc,new _1(i._snapshot.mutatedKeys.has(c.doc.key),i._snapshot.fromCache),i.query.converter);return c.doc,{type:"added",doc:h,oldIndex:-1,newIndex:o++}}))}{let o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter((c=>a||c.type!==3)).map((c=>{const h=new Mw(i._firestore,i._userDataWriter,c.doc.key,c.doc,new _1(i._snapshot.mutatedKeys.has(c.doc.key),i._snapshot.fromCache),i.query.converter);let f=-1,m=-1;return c.type!==0&&(f=o.indexOf(c.doc.key),o=o.delete(c.doc.key)),c.type!==1&&(o=o.add(c.doc),m=o.indexOf(c.doc.key)),{type:Hhe(c.type),doc:h,oldIndex:f,newIndex:m}}))}})(this,r),this._cachedChangesIncludeMetadataChanges=r),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new tr(bt.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t={};t.type=Mp._jsonSchemaVersion,t.bundleSource="QuerySnapshot",t.bundleName=DI.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const r=[],n=[],i=[];return this.docs.forEach((a=>{a._document!==null&&(r.push(a._document),n.push(this._userDataWriter.convertObjectMap(a._document.data.value.mapValue.fields,"previous")),i.push(a.ref.path))})),t.bundle=(this._firestore,this.query._query,t.bundleName,"NOT SUPPORTED"),t}}function Hhe(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Tr(61501,{type:e})}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */Mp._jsonSchemaVersion="firestore/querySnapshot/1.0",Mp._jsonSchema={type:ua("string",Mp._jsonSchemaVersion),bundleSource:ua("string","QuerySnapshot"),bundleName:ua("string"),bundle:ua("string")};/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function as(e){e=$o(e,Ws);const t=$o(e.firestore,Fu),r=tb(t);return fhe(r,e._key).then((n=>UG(t,e,n)))}function vr(e){e=$o(e,Zu);const t=$o(e.firestore,Fu),r=tb(t),n=new IE(t);return DG(e._query),phe(r,e._query).then((i=>new Mp(t,n,e,i)))}function Gn(e,t,r){e=$o(e,Ws);const n=$o(e.firestore,Fu),i=LG(e.converter,t,r),a=CE(n);return PE(n,[CG(a,"setDoc",e._key,i,e.converter!==null,r).toMutation(e._key,_o.none())])}function Ir(e,t,r,...n){e=$o(e,Ws);const i=$o(e.firestore,Fu),a=CE(i);let o;return o=typeof(t=Sa(t))=="string"||t instanceof kT?She(a,"updateDoc",e._key,t,r,n):_he(a,"updateDoc",e._key,t),PE(i,[o.toMutation(e._key,_o.exists(!0))])}function ai(e){return PE($o(e.firestore,Fu),[new yE(e._key,_o.none())])}function dn(e,t){const r=$o(e.firestore,Fu),n=st(e),i=LG(e.converter,t),a=CE(e.firestore);return PE(r,[CG(a,"addDoc",n._key,i,e.converter!==null,{}).toMutation(n._key,_o.exists(!1))]).then((()=>n))}function ei(e,...t){var f,m,y;e=Sa(e);let r={includeMetadataChanges:!1,source:"default"},n=0;typeof t[n]!="object"||e8(t[n])||(r=t[n++]);const i={includeMetadataChanges:r.includeMetadataChanges,source:r.source};if(e8(t[n])){const w=t[n];t[n]=(f=w.next)==null?void 0:f.bind(w),t[n+1]=(m=w.error)==null?void 0:m.bind(w),t[n+2]=(y=w.complete)==null?void 0:y.bind(w)}let a,o,c;if(e instanceof Ws)o=$o(e.firestore,Fu),c=Yy(e._key.path),a={next:w=>{t[n]&&t[n](UG(o,e,w))},error:t[n+1],complete:t[n+2]};else{const w=$o(e,Zu);o=$o(w.firestore,Fu),c=w._query;const A=new IE(o);a={next:S=>{t[n]&&t[n](new Mp(o,A,w,S))},error:t[n+1],complete:t[n+2]},DG(e._query)}const h=tb(o);return hhe(h,c,i,a)}function PE(e,t){const r=tb(e);return ghe(r,t)}function UG(e,t,r){const n=r.docs.get(t._key),i=new IE(e);return new Dp(e,i,t._key,n,new _1(r.hasPendingWrites,r.fromCache),t.converter)}(function(t,r=!0){Xle(Lg),ig(new Kp("firestore",((n,{instanceIdentifier:i,options:a})=>{const o=n.getProvider("app").getImmediate(),c=new Fu(new Jle(n.getProvider("auth-internal")),new rce(o,n.getProvider("app-check-internal")),Fce(o,i),o);return a={useFetchStreams:r,...a},c._setSettings(a),c}),"PUBLIC").setMultipleInstances(!0)),uf(ZD,JD,t),uf(ZD,JD,"esm2020")})();const Ghe="AIzaSyCtxUx4H2ZQqg30wPZnyskPGJQE4kGefXQ",qhe="campus-eye-media-app.firebaseapp.com",Whe="campus-eye-media-app",Khe="campus-eye-media-app.firebasestorage.app",Yhe="612194200932",Xhe="1:612194200932:web:f23853033adf101b5e5e71",Qhe="G-8WM12QQDWG",Zhe="(default)",P2={apiKey:Ghe,authDomain:qhe,projectId:Whe,storageBucket:Khe,messagingSenderId:Yhe,appId:Xhe,measurementId:Qhe,firestoreDatabaseId:Zhe},Jhe={...P2,authDomain:P2.authDomain},BG=PF(Jhe),Ne=Kle(BG);Moe(Ne,a$).catch(()=>{});let kC;try{kC=Bhe({tabManager:$he()})}catch{kC=Uhe()}const fe=whe(BG,{localCache:kC,experimentalForceLongPolling:!0},P2.firestoreDatabaseId),zG=new kd;zG.setCustomParameters({prompt:"select_account"});var Ps=(e=>(e.CREATE="create",e.UPDATE="update",e.DELETE="delete",e.LIST="list",e.GET="get",e.WRITE="write",e))(Ps||{});function Gs(e,t,r){var o,c,h,f,m,y;const n=e instanceof Error?e.message:String(e),i={error:n,authInfo:{userId:(o=Ne.currentUser)==null?void 0:o.uid,email:(c=Ne.currentUser)==null?void 0:c.email,emailVerified:(h=Ne.currentUser)==null?void 0:h.emailVerified,isAnonymous:(f=Ne.currentUser)==null?void 0:f.isAnonymous,tenantId:(m=Ne.currentUser)==null?void 0:m.tenantId,providerInfo:((y=Ne.currentUser)==null?void 0:y.providerData.map(w=>({providerId:w.providerId,displayName:w.displayName,email:w.email,photoUrl:w.photoURL})))||[]},operationType:t,path:r};n.toLowerCase().includes("offline")||n.toLowerCase().includes("could not reach")||n.toLowerCase().includes("unavailable")||n.toLowerCase().includes("network")?console.warn("Firestore Handling [Offline State]: ",JSON.stringify(i)):console.error("Firestore Error: ",JSON.stringify(i))}let efe={data:""},tfe=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||efe},rfe=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,nfe=/\/\*[^]*?\*\/| +/g,n8=/\n+/g,tf=(e,t)=>{let r="",n="",i="";for(let a in e){let o=e[a];a[0]=="@"?a[1]=="i"?r=a+" "+o+";":n+=a[1]=="f"?tf(o,a):a+"{"+tf(o,a[1]=="k"?"":t)+"}":typeof o=="object"?n+=tf(o,t?t.replace(/([^,])+/g,c=>a.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,h=>/&/.test(h)?h.replace(/&/g,c):c?c+" "+h:h)):a):o!=null&&(a=/^--/.test(a)?a:a.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=tf.p?tf.p(a,o):a+":"+o+";")}return r+(t&&i?t+"{"+i+"}":i)+n},bd={},VG=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+VG(e[r]);return t}return e},ife=(e,t,r,n,i)=>{let a=VG(e),o=bd[a]||(bd[a]=(h=>{let f=0,m=11;for(;f>>0;return"go"+m})(a));if(!bd[o]){let h=a!==e?e:(f=>{let m,y,w=[{}];for(;m=rfe.exec(f.replace(nfe,""));)m[4]?w.shift():m[3]?(y=m[3].replace(n8," ").trim(),w.unshift(w[0][y]=w[0][y]||{})):w[0][m[1]]=m[2].replace(n8," ").trim();return w[0]})(e);bd[o]=tf(i?{["@keyframes "+o]:h}:h,r?"":"."+o)}let c=r&&bd.g?bd.g:null;return r&&(bd.g=bd[o]),((h,f,m,y)=>{y?f.data=f.data.replace(y,h):f.data.indexOf(h)===-1&&(f.data=m?h+f.data:f.data+h)})(bd[o],t,n,c),o},sfe=(e,t,r)=>e.reduce((n,i,a)=>{let o=t[a];if(o&&o.call){let c=o(r),h=c&&c.props&&c.props.className||/^go/.test(c)&&c;o=h?"."+h:c&&typeof c=="object"?c.props?"":tf(c,""):c===!1?"":c}return n+i+(o??"")},"");function OE(e){let t=this||{},r=e.call?e(t.p):e;return ife(r.unshift?r.raw?sfe(r,[].slice.call(arguments,1),t.p):r.reduce((n,i)=>Object.assign(n,i&&i.call?i(t.p):i),{}):r,tfe(t.target),t.g,t.o,t.k)}let FG,_C,SC;OE.bind({g:1});let $d=OE.bind({k:1});function afe(e,t,r,n){tf.p=t,FG=e,_C=r,SC=n}function Tf(e,t){let r=this||{};return function(){let n=arguments;function i(a,o){let c=Object.assign({},a),h=c.className||i.className;r.p=Object.assign({theme:_C&&_C()},c),r.o=/ *go\d+/.test(h),c.className=OE.apply(r,n)+(h?" "+h:"");let f=e;return e[0]&&(f=c.as||e,delete c.as),SC&&f[0]&&SC(c),FG(f,c)}return i}}var ofe=e=>typeof e=="function",O2=(e,t)=>ofe(e)?e(t):e,lfe=(()=>{let e=0;return()=>(++e).toString()})(),$G=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),cfe=20,MT="default",HG=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return HG(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:i}=t;return{...e,toasts:e.toasts.map(o=>o.id===i||i===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let a=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+a}))}}},Lw=[],GG={toasts:[],pausedAt:void 0,settings:{toastLimit:cfe}},Tu={},qG=(e,t=MT)=>{Tu[t]=HG(Tu[t]||GG,e),Lw.forEach(([r,n])=>{r===t&&n(Tu[t])})},WG=e=>Object.keys(Tu).forEach(t=>qG(e,t)),ufe=e=>Object.keys(Tu).find(t=>Tu[t].toasts.some(r=>r.id===e)),RE=(e=MT)=>t=>{qG(t,e)},dfe={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},hfe=(e={},t=MT)=>{let[r,n]=I.useState(Tu[t]||GG),i=I.useRef(Tu[t]);I.useEffect(()=>(i.current!==Tu[t]&&n(Tu[t]),Lw.push([t,n]),()=>{let o=Lw.findIndex(([c])=>c===t);o>-1&&Lw.splice(o,1)}),[t]);let a=r.toasts.map(o=>{var c,h,f;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((c=e[o.type])==null?void 0:c.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((h=e[o.type])==null?void 0:h.duration)||(e==null?void 0:e.duration)||dfe[o.type],style:{...e.style,...(f=e[o.type])==null?void 0:f.style,...o.style}}});return{...r,toasts:a}},ffe=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||lfe()}),rb=e=>(t,r)=>{let n=ffe(t,e,r);return RE(n.toasterId||ufe(n.id))({type:2,toast:n}),n.id},he=(e,t)=>rb("blank")(e,t);he.error=rb("error");he.success=rb("success");he.loading=rb("loading");he.custom=rb("custom");he.dismiss=(e,t)=>{let r={type:3,toastId:e};t?RE(t)(r):WG(r)};he.dismissAll=e=>he.dismiss(void 0,e);he.remove=(e,t)=>{let r={type:4,toastId:e};t?RE(t)(r):WG(r)};he.removeAll=e=>he.remove(void 0,e);he.promise=(e,t,r)=>{let n=he.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(i=>{let a=t.success?O2(t.success,i):void 0;return a?he.success(a,{id:n,...r,...r==null?void 0:r.success}):he.dismiss(n),i}).catch(i=>{let a=t.error?O2(t.error,i):void 0;a?he.error(a,{id:n,...r,...r==null?void 0:r.error}):he.dismiss(n)}),e};var pfe=1e3,mfe=(e,t="default")=>{let{toasts:r,pausedAt:n}=hfe(e,t),i=I.useRef(new Map).current,a=I.useCallback((y,w=pfe)=>{if(i.has(y))return;let A=setTimeout(()=>{i.delete(y),o({type:4,toastId:y})},w);i.set(y,A)},[]);I.useEffect(()=>{if(n)return;let y=Date.now(),w=r.map(A=>{if(A.duration===1/0)return;let S=(A.duration||0)+A.pauseDuration-(y-A.createdAt);if(S<0){A.visible&&he.dismiss(A.id);return}return setTimeout(()=>he.dismiss(A.id,t),S)});return()=>{w.forEach(A=>A&&clearTimeout(A))}},[r,n,t]);let o=I.useCallback(RE(t),[t]),c=I.useCallback(()=>{o({type:5,time:Date.now()})},[o]),h=I.useCallback((y,w)=>{o({type:1,toast:{id:y,height:w}})},[o]),f=I.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),m=I.useCallback((y,w)=>{let{reverseOrder:A=!1,gutter:S=8,defaultPosition:j}=w||{},T=r.filter(U=>(U.position||j)===(y.position||j)&&U.height),D=T.findIndex(U=>U.id===y.id),V=T.filter((U,G)=>GU.visible).slice(...A?[V+1]:[0,V]).reduce((U,G)=>U+(G.height||0)+S,0)},[r]);return I.useEffect(()=>{r.forEach(y=>{if(y.dismissed)a(y.id,y.removeDelay);else{let w=i.get(y.id);w&&(clearTimeout(w),i.delete(y.id))}})},[r,a]),{toasts:r,handlers:{updateHeight:h,startPause:c,endPause:f,calculateOffset:m}}},gfe=$d` from { transform: scale(0) rotate(45deg); opacity: 0; } to { transform: scale(1) rotate(45deg); opacity: 1; }`,xfe=$d` from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; }`,yfe=$d` from { transform: scale(0) rotate(90deg); opacity: 0; } to { transform: scale(1) rotate(90deg); opacity: 1; }`,bfe=Tf("div")` width: 20px; opacity: 0; height: 20px; border-radius: 10px; background: ${e=>e.primary||"#ff4b4b"}; position: relative; transform: rotate(45deg); animation: ${gfe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 100ms; &:after, &:before { content: ''; animation: ${xfe} 0.15s ease-out forwards; animation-delay: 150ms; position: absolute; border-radius: 3px; opacity: 0; background: ${e=>e.secondary||"#fff"}; bottom: 9px; left: 4px; height: 2px; width: 12px; } &:before { animation: ${yfe} 0.15s ease-out forwards; animation-delay: 180ms; transform: rotate(90deg); } `,vfe=$d` from { transform: rotate(0deg); } to { transform: rotate(360deg); } `,wfe=Tf("div")` width: 12px; height: 12px; box-sizing: border-box; border: 2px solid; border-radius: 100%; border-color: ${e=>e.secondary||"#e0e0e0"}; border-right-color: ${e=>e.primary||"#616161"}; animation: ${vfe} 1s linear infinite; `,Nfe=$d` from { transform: scale(0) rotate(45deg); opacity: 0; } to { transform: scale(1) rotate(45deg); opacity: 1; }`,Efe=$d` 0% { height: 0; width: 0; opacity: 0; } 40% { height: 0; width: 6px; opacity: 1; } 100% { opacity: 1; height: 10px; }`,Afe=Tf("div")` width: 20px; opacity: 0; height: 20px; border-radius: 10px; background: ${e=>e.primary||"#61d345"}; position: relative; transform: rotate(45deg); animation: ${Nfe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 100ms; &:after { content: ''; box-sizing: border-box; animation: ${Efe} 0.2s ease-out forwards; opacity: 0; animation-delay: 200ms; position: absolute; border-right: 2px solid; border-bottom: 2px solid; border-color: ${e=>e.secondary||"#fff"}; bottom: 6px; left: 6px; height: 10px; width: 6px; } `,kfe=Tf("div")` position: absolute; `,_fe=Tf("div")` position: relative; display: flex; justify-content: center; align-items: center; min-width: 20px; min-height: 20px; `,Sfe=$d` from { transform: scale(0.6); opacity: 0.4; } to { transform: scale(1); opacity: 1; }`,Cfe=Tf("div")` position: relative; transform: scale(0.6); opacity: 0.4; min-width: 20px; animation: ${Sfe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; `,jfe=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?I.createElement(Cfe,null,t):t:r==="blank"?null:I.createElement(_fe,null,I.createElement(wfe,{...n}),r!=="loading"&&I.createElement(kfe,null,r==="error"?I.createElement(bfe,{...n}):I.createElement(Afe,{...n})))},Ife=e=>` 0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;} 100% {transform: translate3d(0,0,0) scale(1); opacity:1;} `,Tfe=e=>` 0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} 100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;} `,Pfe="0%{opacity:0;} 100%{opacity:1;}",Ofe="0%{opacity:1;} 100%{opacity:0;}",Rfe=Tf("div")` display: flex; align-items: center; background: #fff; color: #363636; line-height: 1.3; will-change: transform; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); max-width: 350px; pointer-events: auto; padding: 8px 10px; border-radius: 8px; `,Dfe=Tf("div")` display: flex; justify-content: center; margin: 4px 10px; color: inherit; flex: 1 1 auto; white-space: pre-line; `,Mfe=(e,t)=>{let r=e.includes("top")?1:-1,[n,i]=$G()?[Pfe,Ofe]:[Ife(r),Tfe(r)];return{animation:t?`${$d(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${$d(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Lfe=I.memo(({toast:e,position:t,style:r,children:n})=>{let i=e.height?Mfe(e.position||t||"top-center",e.visible):{opacity:0},a=I.createElement(jfe,{toast:e}),o=I.createElement(Dfe,{...e.ariaProps},O2(e.message,e));return I.createElement(Rfe,{className:e.className,style:{...i,...r,...e.style}},typeof n=="function"?n({icon:a,message:o}):I.createElement(I.Fragment,null,a,o))});afe(I.createElement);var Ufe=({id:e,className:t,style:r,onHeightUpdate:n,children:i})=>{let a=I.useCallback(o=>{if(o){let c=()=>{let h=o.getBoundingClientRect().height;n(e,h)};c(),new MutationObserver(c).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return I.createElement("div",{ref:a,className:t,style:r},i)},Bfe=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},i=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:$G()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...i}},zfe=OE` z-index: 9999; > * { pointer-events: auto; } `,Uv=16,i8=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:i,toasterId:a,containerStyle:o,containerClassName:c})=>{let{toasts:h,handlers:f}=mfe(r,a);return I.createElement("div",{"data-rht-toaster":a||"",style:{position:"fixed",zIndex:9999,top:Uv,left:Uv,right:Uv,bottom:Uv,pointerEvents:"none",...o},className:c,onMouseEnter:f.startPause,onMouseLeave:f.endPause},h.map(m=>{let y=m.position||t,w=f.calculateOffset(m,{reverseOrder:e,gutter:n,defaultPosition:t}),A=Bfe(y,w);return I.createElement(Ufe,{id:m.id,key:m.id,onHeightUpdate:f.updateHeight,className:m.visible?zfe:"",style:A},m.type==="custom"?O2(m.message,m):i?i(m):I.createElement(Lfe,{toast:m,position:y}))}))},nn=he;function KG(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const r=new Array(e.length+t.length);for(let n=0;n({classGroupId:e,validator:t}),YG=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),R2="-",s8=[],$fe="arbitrary..",Hfe=e=>{const t=qfe(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return Gfe(o);const c=o.split(R2),h=c[0]===""&&c.length>1?1:0;return XG(c,h,t)},getConflictingClassGroupIds:(o,c)=>{if(c){const h=n[o],f=r[o];return h?f?Vfe(f,h):h:f||s8}return r[o]||s8}}},XG=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],a=r.nextPart.get(i);if(a){const f=XG(e,t+1,a);if(f)return f}const o=r.validators;if(o===null)return;const c=t===0?e.join(R2):e.slice(t).join(R2),h=o.length;for(let f=0;fe.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?$fe+n:void 0})(),qfe=e=>{const{theme:t,classGroups:r}=e;return Wfe(r,t)},Wfe=(e,t)=>{const r=YG();for(const n in e){const i=e[n];LT(i,r,n,t)}return r},LT=(e,t,r,n)=>{const i=e.length;for(let a=0;a{if(typeof e=="string"){Yfe(e,t,r);return}if(typeof e=="function"){Xfe(e,t,r,n);return}Qfe(e,t,r,n)},Yfe=(e,t,r)=>{const n=e===""?t:QG(t,e);n.classGroupId=r},Xfe=(e,t,r,n)=>{if(Zfe(e)){LT(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Ffe(r,e))},Qfe=(e,t,r,n)=>{const i=Object.entries(e),a=i.length;for(let o=0;o{let r=e;const n=t.split(R2),i=n.length;for(let a=0;a"isThemeGetter"in e&&e.isThemeGetter===!0,Jfe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const i=(a,o)=>{r[a]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let o=r[a];if(o!==void 0)return o;if((o=n[a])!==void 0)return i(a,o),o},set(a,o){a in r?r[a]=o:i(a,o)}}},CC="!",a8=":",epe=[],o8=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),tpe=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=i=>{const a=[];let o=0,c=0,h=0,f;const m=i.length;for(let j=0;jh?f-h:void 0;return o8(a,A,w,S)};if(t){const i=t+a8,a=n;n=o=>o.startsWith(i)?a(o.slice(i.length)):o8(epe,!1,o,void 0,!0)}if(r){const i=n;n=a=>r({className:a,parseClassName:i})}return n},rpe=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let a=0;a0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},npe=e=>({cache:Jfe(e.cacheSize),parseClassName:tpe(e),sortModifiers:rpe(e),...Hfe(e)}),ipe=/\s+/,spe=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],c=e.trim().split(ipe);let h="";for(let f=c.length-1;f>=0;f-=1){const m=c[f],{isExternal:y,modifiers:w,hasImportantModifier:A,baseClassName:S,maybePostfixModifierPosition:j}=r(m);if(y){h=m+(h.length>0?" "+h:h);continue}let T=!!j,D=n(T?S.substring(0,j):S);if(!D){if(!T){h=m+(h.length>0?" "+h:h);continue}if(D=n(S),!D){h=m+(h.length>0?" "+h:h);continue}T=!1}const V=w.length===0?"":w.length===1?w[0]:a(w).join(":"),U=A?V+CC:V,G=U+D;if(o.indexOf(G)>-1)continue;o.push(G);const X=i(D,T);for(let q=0;q0?" "+h:h)}return h},ape=(...e)=>{let t=0,r,n,i="";for(;t{if(typeof e=="string")return e;let t,r="";for(let n=0;n{let r,n,i,a;const o=h=>{const f=t.reduce((m,y)=>y(m),e());return r=npe(f),n=r.cache.get,i=r.cache.set,a=c,c(h)},c=h=>{const f=n(h);if(f)return f;const m=spe(h,r);return i(h,m),m};return a=o,(...h)=>a(ape(...h))},lpe=[],ya=e=>{const t=r=>r[e]||lpe;return t.isThemeGetter=!0,t},JG=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,eq=/^\((?:(\w[\w-]*):)?(.+)\)$/i,cpe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,upe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dpe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hpe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fpe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ppe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zh=e=>cpe.test(e),Hn=e=>!!e&&!Number.isNaN(Number(e)),Vh=e=>!!e&&Number.isInteger(Number(e)),xk=e=>e.endsWith("%")&&Hn(e.slice(0,-1)),vd=e=>upe.test(e),tq=()=>!0,mpe=e=>dpe.test(e)&&!hpe.test(e),UT=()=>!1,gpe=e=>fpe.test(e),xpe=e=>ppe.test(e),ype=e=>!Ur(e)&&!Hr(e),bpe=e=>Pf(e,iq,UT),Ur=e=>JG.test(e),Zf=e=>Pf(e,sq,mpe),l8=e=>Pf(e,Spe,Hn),vpe=e=>Pf(e,oq,tq),wpe=e=>Pf(e,aq,UT),c8=e=>Pf(e,rq,UT),Npe=e=>Pf(e,nq,xpe),Bv=e=>Pf(e,lq,gpe),Hr=e=>eq.test(e),e1=e=>vm(e,sq),Epe=e=>vm(e,aq),u8=e=>vm(e,rq),Ape=e=>vm(e,iq),kpe=e=>vm(e,nq),zv=e=>vm(e,lq,!0),_pe=e=>vm(e,oq,!0),Pf=(e,t,r)=>{const n=JG.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},vm=(e,t,r=!1)=>{const n=eq.exec(e);return n?n[1]?t(n[1]):r:!1},rq=e=>e==="position"||e==="percentage",nq=e=>e==="image"||e==="url",iq=e=>e==="length"||e==="size"||e==="bg-size",sq=e=>e==="length",Spe=e=>e==="number",aq=e=>e==="family-name",oq=e=>e==="number"||e==="weight",lq=e=>e==="shadow",Cpe=()=>{const e=ya("color"),t=ya("font"),r=ya("text"),n=ya("font-weight"),i=ya("tracking"),a=ya("leading"),o=ya("breakpoint"),c=ya("container"),h=ya("spacing"),f=ya("radius"),m=ya("shadow"),y=ya("inset-shadow"),w=ya("text-shadow"),A=ya("drop-shadow"),S=ya("blur"),j=ya("perspective"),T=ya("aspect"),D=ya("ease"),V=ya("animate"),U=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],X=()=>[...G(),Hr,Ur],q=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],z=()=>[Hr,Ur,h],F=()=>[zh,"full","auto",...z()],$=()=>[Vh,"none","subgrid",Hr,Ur],J=()=>["auto",{span:["full",Vh,Hr,Ur]},Vh,Hr,Ur],Q=()=>[Vh,"auto",Hr,Ur],K=()=>["auto","min","max","fr",Hr,Ur],me=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],re=()=>["start","end","center","stretch","center-safe","end-safe"],le=()=>["auto",...z()],ve=()=>[zh,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],je=()=>[zh,"screen","full","dvw","lvw","svw","min","max","fit",...z()],Ve=()=>[zh,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],Z=()=>[e,Hr,Ur],se=()=>[...G(),u8,c8,{position:[Hr,Ur]}],xe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ae=()=>["auto","cover","contain",Ape,bpe,{size:[Hr,Ur]}],qe=()=>[xk,e1,Zf],pt=()=>["","none","full",f,Hr,Ur],Fe=()=>["",Hn,e1,Zf],jt=()=>["solid","dashed","dotted","double"],Pt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ae=()=>[Hn,xk,u8,c8],Ie=()=>["","none",S,Hr,Ur],vt=()=>["none",Hn,Hr,Ur],Re=()=>["none",Hn,Hr,Ur],It=()=>[Hn,Hr,Ur],Dt=()=>[zh,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[vd],breakpoint:[vd],color:[tq],container:[vd],"drop-shadow":[vd],ease:["in","out","in-out"],font:[ype],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[vd],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[vd],shadow:[vd],spacing:["px",Hn],text:[vd],"text-shadow":[vd],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",zh,Ur,Hr,T]}],container:["container"],columns:[{columns:[Hn,Ur,Hr,c]}],"break-after":[{"break-after":U()}],"break-before":[{"break-before":U()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:X()}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{"inset-s":F(),start:F()}],end:[{"inset-e":F(),end:F()}],"inset-bs":[{"inset-bs":F()}],"inset-be":[{"inset-be":F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[Vh,"auto",Hr,Ur]}],basis:[{basis:[zh,"full","auto",c,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Hn,zh,"auto","initial","none",Ur]}],grow:[{grow:["",Hn,Hr,Ur]}],shrink:[{shrink:["",Hn,Hr,Ur]}],order:[{order:[Vh,"first","last","none",Hr,Ur]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":Q()}],"col-end":[{"col-end":Q()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":Q()}],"row-end":[{"row-end":Q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...me(),"normal"]}],"justify-items":[{"justify-items":[...re(),"normal"]}],"justify-self":[{"justify-self":["auto",...re()]}],"align-content":[{content:["normal",...me()]}],"align-items":[{items:[...re(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...re(),{baseline:["","last"]}]}],"place-content":[{"place-content":me()}],"place-items":[{"place-items":[...re(),"baseline"]}],"place-self":[{"place-self":["auto",...re()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:le()}],mx:[{mx:le()}],my:[{my:le()}],ms:[{ms:le()}],me:[{me:le()}],mbs:[{mbs:le()}],mbe:[{mbe:le()}],mt:[{mt:le()}],mr:[{mr:le()}],mb:[{mb:le()}],ml:[{ml:le()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:ve()}],"inline-size":[{inline:["auto",...je()]}],"min-inline-size":[{"min-inline":["auto",...je()]}],"max-inline-size":[{"max-inline":["none",...je()]}],"block-size":[{block:["auto",...Ve()]}],"min-block-size":[{"min-block":["auto",...Ve()]}],"max-block-size":[{"max-block":["none",...Ve()]}],w:[{w:[c,"screen",...ve()]}],"min-w":[{"min-w":[c,"screen","none",...ve()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...ve()]}],h:[{h:["screen","lh",...ve()]}],"min-h":[{"min-h":["screen","lh","none",...ve()]}],"max-h":[{"max-h":["screen","lh",...ve()]}],"font-size":[{text:["base",r,e1,Zf]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,_pe,vpe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xk,Ur]}],"font-family":[{font:[Epe,wpe,t]}],"font-features":[{"font-features":[Ur]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Hr,Ur]}],"line-clamp":[{"line-clamp":[Hn,"none",Hr,l8]}],leading:[{leading:[a,...z()]}],"list-image":[{"list-image":["none",Hr,Ur]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Hr,Ur]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...jt(),"wavy"]}],"text-decoration-thickness":[{decoration:[Hn,"from-font","auto",Hr,Zf]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[Hn,"auto",Hr,Ur]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Hr,Ur]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Hr,Ur]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:xe()}],"bg-size":[{bg:ae()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Vh,Hr,Ur],radial:["",Hr,Ur],conic:[Vh,Hr,Ur]},kpe,Npe]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:qe()}],"gradient-via-pos":[{via:qe()}],"gradient-to-pos":[{to:qe()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:pt()}],"rounded-s":[{"rounded-s":pt()}],"rounded-e":[{"rounded-e":pt()}],"rounded-t":[{"rounded-t":pt()}],"rounded-r":[{"rounded-r":pt()}],"rounded-b":[{"rounded-b":pt()}],"rounded-l":[{"rounded-l":pt()}],"rounded-ss":[{"rounded-ss":pt()}],"rounded-se":[{"rounded-se":pt()}],"rounded-ee":[{"rounded-ee":pt()}],"rounded-es":[{"rounded-es":pt()}],"rounded-tl":[{"rounded-tl":pt()}],"rounded-tr":[{"rounded-tr":pt()}],"rounded-br":[{"rounded-br":pt()}],"rounded-bl":[{"rounded-bl":pt()}],"border-w":[{border:Fe()}],"border-w-x":[{"border-x":Fe()}],"border-w-y":[{"border-y":Fe()}],"border-w-s":[{"border-s":Fe()}],"border-w-e":[{"border-e":Fe()}],"border-w-bs":[{"border-bs":Fe()}],"border-w-be":[{"border-be":Fe()}],"border-w-t":[{"border-t":Fe()}],"border-w-r":[{"border-r":Fe()}],"border-w-b":[{"border-b":Fe()}],"border-w-l":[{"border-l":Fe()}],"divide-x":[{"divide-x":Fe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Fe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...jt(),"hidden","none"]}],"divide-style":[{divide:[...jt(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-bs":[{"border-bs":Z()}],"border-color-be":[{"border-be":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...jt(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Hn,Hr,Ur]}],"outline-w":[{outline:["",Hn,e1,Zf]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",m,zv,Bv]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",y,zv,Bv]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:Fe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[Hn,Zf]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":Fe()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",w,zv,Bv]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[Hn,Hr,Ur]}],"mix-blend":[{"mix-blend":[...Pt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Pt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Hn]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ae()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":Ae()}],"mask-image-t-to-pos":[{"mask-t-to":Ae()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":Ae()}],"mask-image-r-to-pos":[{"mask-r-to":Ae()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":Ae()}],"mask-image-b-to-pos":[{"mask-b-to":Ae()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":Ae()}],"mask-image-l-to-pos":[{"mask-l-to":Ae()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":Ae()}],"mask-image-x-to-pos":[{"mask-x-to":Ae()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":Ae()}],"mask-image-y-to-pos":[{"mask-y-to":Ae()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[Hr,Ur]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ae()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":G()}],"mask-image-conic-pos":[{"mask-conic":[Hn]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ae()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:xe()}],"mask-size":[{mask:ae()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Hr,Ur]}],filter:[{filter:["","none",Hr,Ur]}],blur:[{blur:Ie()}],brightness:[{brightness:[Hn,Hr,Ur]}],contrast:[{contrast:[Hn,Hr,Ur]}],"drop-shadow":[{"drop-shadow":["","none",A,zv,Bv]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",Hn,Hr,Ur]}],"hue-rotate":[{"hue-rotate":[Hn,Hr,Ur]}],invert:[{invert:["",Hn,Hr,Ur]}],saturate:[{saturate:[Hn,Hr,Ur]}],sepia:[{sepia:["",Hn,Hr,Ur]}],"backdrop-filter":[{"backdrop-filter":["","none",Hr,Ur]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[Hn,Hr,Ur]}],"backdrop-contrast":[{"backdrop-contrast":[Hn,Hr,Ur]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Hn,Hr,Ur]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Hn,Hr,Ur]}],"backdrop-invert":[{"backdrop-invert":["",Hn,Hr,Ur]}],"backdrop-opacity":[{"backdrop-opacity":[Hn,Hr,Ur]}],"backdrop-saturate":[{"backdrop-saturate":[Hn,Hr,Ur]}],"backdrop-sepia":[{"backdrop-sepia":["",Hn,Hr,Ur]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Hr,Ur]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Hn,"initial",Hr,Ur]}],ease:[{ease:["linear","initial",D,Hr,Ur]}],delay:[{delay:[Hn,Hr,Ur]}],animate:[{animate:["none",V,Hr,Ur]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Hr,Ur]}],"perspective-origin":[{"perspective-origin":X()}],rotate:[{rotate:vt()}],"rotate-x":[{"rotate-x":vt()}],"rotate-y":[{"rotate-y":vt()}],"rotate-z":[{"rotate-z":vt()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:It()}],"skew-x":[{"skew-x":It()}],"skew-y":[{"skew-y":It()}],transform:[{transform:[Hr,Ur,"","none","gpu","cpu"]}],"transform-origin":[{origin:X()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Dt()}],"translate-x":[{"translate-x":Dt()}],"translate-y":[{"translate-y":Dt()}],"translate-z":[{"translate-z":Dt()}],"translate-none":["translate-none"],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Hr,Ur]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Hr,Ur]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[Hn,e1,Zf,l8]}],stroke:[{stroke:["none",...Z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},jpe=ope(Cpe);function Ge(...e){return jpe(Mi(e))}function cl(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k":e.toString()}function L0(e){return e?e.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "):""}function cq(e){if(!e)return null;if(e instanceof Date)return isNaN(e.getTime())?null:e;if(typeof(e==null?void 0:e.toDate)=="function"){const t=e.toDate();return isNaN(t.getTime())?null:t}if(typeof e=="object"&&typeof e.seconds=="number"){const t=new Date(e.seconds*1e3);return isNaN(t.getTime())?null:t}if(typeof e=="number"){const t=new Date(e);return isNaN(t.getTime())?null:t}if(typeof e=="string"){const t=new Date(e);return isNaN(t.getTime())?null:t}return null}function Ipe(e){const t=cq(e);return t?t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):""}function Q0(e){const t=cq(e);if(!t)return"now";const n=new Date().getTime()-t.getTime();if(n<0)return"now";const i=Math.floor(n/6e4);if(i<60)return`${i||1}m`;const a=Math.floor(i/60);if(a<24)return`${a}hr`;const o=Math.floor(a/24);if(o<7)return`${o}d`;const c=t.getDate(),h=t.getMonth()+1,f=String(t.getFullYear()).substring(2);return`${c}/${h}/${f}`}async function Od(e){try{window.focus()}catch(t){console.warn("Could not focus window:",t)}try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")return await navigator.clipboard.writeText(e),!0}catch(t){console.warn("Modern Clipboard API failed, trying fallback textarea copy...",t)}try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.fontSize="12pt",t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.width="2em",t.style.height="2em",t.style.padding="0",t.style.border="none",t.style.outline="none",t.style.boxShadow="none",t.style.background="transparent",document.body.appendChild(t);const r=document.activeElement;t.focus(),t.select(),t.setSelectionRange(0,999999);const n=document.execCommand("copy");if(r&&typeof r.focus=="function"&&r.focus(),document.body.removeChild(t),n)return!0}catch(t){console.error("All fallback copy methods failed:",t)}return!1}function Tpe(e,t=700,r=80){var o;if(!e||typeof e!="string")return"";if(e.startsWith("data:")||e.startsWith("blob:")||e.endsWith(".svg"))return e;const n=typeof navigator<"u"&&((o=navigator.connection)==null?void 0:o.saveData),i=n?Math.min(t,480):t,a=n?Math.min(r,65):r;if(e.includes("images.unsplash.com"))try{const c=new URL(e);return c.searchParams.set("auto","format"),c.searchParams.set("fit","crop"),c.searchParams.set("w",i.toString()),c.searchParams.set("q",a.toString()),c.toString()}catch{return e}if(e.includes("res.cloudinary.com"))try{return e.includes("/upload/")&&!e.includes("/f_auto")?e.replace("/upload/",`/upload/f_auto,q_auto,w_${i}/`):e}catch{return e}return e.includes("googleusercontent.com")&&e.includes("=s")?e.replace(/=s\d+(-c)?/i,`=s${Math.min(i,200)}-c`):e}const uq=({size:e=20,className:t=""})=>s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",style:{width:e,height:e},className:Ge("fill-current",t),children:s.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),dq=({size:e=20,className:t=""})=>s.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",style:{width:e,height:e},className:Ge("fill-current",t),children:s.jsx("path",{d:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.17-2.89-.6-4.13-1.47-.13-.09-.26-.18-.38-.28v6.51c.02 2.44-.95 4.93-2.91 6.41-1.96 1.48-4.71 1.94-7.01 1.16-2.31-.78-4.12-2.83-4.76-5.19-.64-2.36-.14-5.04 1.41-6.95 1.55-1.91 4.11-2.97 6.54-2.73v4.07c-1.21-.11-2.47.23-3.41 1.01-.94.78-1.44 2.01-1.31 3.23.13 1.22.95 2.32 2.06 2.86 1.11.54 2.5.47 3.54-.21.93-.61 1.48-1.68 1.46-2.79V.02z"})}),jC=({size:e=20,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{width:e,height:e},className:Ge("shrink-0",t),children:[s.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),s.jsxs("g",{fill:"none",children:[s.jsx("path",{fill:"url(#SVGv76srdyf_opt)",d:"M12.252 18.506a10.4 10.4 0 0 0 1.875-.302a5.2 5.2 0 0 0 2.342.151a1 1 0 0 1 .094-.007c.279 0 .645.16 1.179.497v-.554a.54.54 0 0 1 .28-.472q.349-.197.645-.443c.778-.65 1.217-1.518 1.217-2.436c0-.303-.048-.605-.143-.893a7 7 0 0 0 .564-1.359c.45.665.692 1.45.695 2.252c0 1.248-.588 2.412-1.607 3.263q-.256.213-.535.392v1.298c0 .446-.522.703-.89.437a14 14 0 0 0-1.08-.72a3 3 0 0 0-.332-.165a6.4 6.4 0 0 1-.935.069c-1.27 0-2.445-.377-3.37-1.008m-6.72-2.595C3.927 14.568 3 12.737 3 10.775c0-4.008 3.832-7.213 8.511-7.213c4.68 0 8.513 3.204 8.513 7.213s-3.833 7.212-8.513 7.212a10 10 0 0 1-1.555-.12c-.22.051-1.102.568-2.372 1.483c-.46.332-1.112.012-1.112-.547V16.59a8 8 0 0 1-.94-.68m4.455.592q.058 0 .117.009q.69.114 1.407.115c3.953 0 7.116-2.645 7.116-5.852c0-3.206-3.163-5.85-7.115-5.85s-7.117 2.644-7.117 5.85c0 1.55.74 3.01 2.046 4.103q.494.412 1.076.74a.68.68 0 0 1 .35.589v1.276c1.005-.665 1.666-.98 2.12-.98"}),s.jsx("path",{fill:"url(#SVGv76srdyf_opt)",d:"M8.062 12a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25"}),s.jsx("path",{fill:"url(#SVGv76srdyf_opt)",d:"M11.719 12a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25"}),s.jsx("path",{fill:"url(#SVGohGBlcQN_opt)",d:"M15.375 12a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25"}),s.jsxs("defs",{children:[s.jsxs("linearGradient",{id:"SVGv76srdyf_opt",x1:"12",x2:"12",y1:"3.562",y2:"20.438",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"#1bc9fa"}),s.jsx("stop",{offset:"1",stopColor:"#1778f0"})]}),s.jsxs("linearGradient",{id:"SVGohGBlcQN_opt",x1:"12",x2:"12",y1:"3.561",y2:"20.437",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"#1bc9fa"}),s.jsx("stop",{offset:"1",stopColor:"#1778f0"})]})]})]})]}),hq=({size:e=20,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",style:{width:e,height:e},className:Ge("shrink-0",t),children:[s.jsx("path",{d:"M0 0h14v14H0z",fill:"none"}),s.jsxs("g",{fill:"none",fillRule:"evenodd",clipRule:"evenodd",children:[s.jsx("path",{fill:"#8fbffa",d:"M6.45 1.418a1.504 1.504 0 0 1 2.72 1.073L8.973 3.89h1.915c.567 0 1.327.268 1.944.762C13.466 5.158 14 5.944 14 7c0 .986-.477 2.502-1.169 3.755c-.35.634-.77 1.233-1.245 1.681c-.469.442-1.043.786-1.687.786c-2.447 0-4.304-.313-7.155-1.44a1 1 0 0 0 .006-.129v-5.05z"}),s.jsx("path",{fill:"#2859c5",d:"M1.375 4.528C.615 4.528 0 5.144 0 5.903v5.75a1.375 1.375 0 1 0 2.75 0v-5.75c0-.76-.616-1.375-1.375-1.375"})]})]}),IC=({size:e=20,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{width:e,height:e},className:Ge("shrink-0",t),children:[s.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{fill:"#2233ca",fillOpacity:".25",d:"M20.188 10.934c.388.472.582.707.582 1.066s-.194.594-.582 1.066C18.768 14.79 15.636 18 12 18s-6.768-3.21-8.188-4.934c-.388-.472-.582-.707-.582-1.066s.194-.594.582-1.066C5.232 9.21 8.364 6 12 6s6.768 3.21 8.188 4.934"}),s.jsx("circle",{cx:"12",cy:"12",r:"3",fill:"#2233ca"})]}),fq=({size:e=20,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",style:{width:e,height:e},className:Ge("shrink-0",t),children:[s.jsx("path",{d:"M0 0h16v16H0z",fill:"none"}),s.jsxs("g",{fill:"none",children:[s.jsx("path",{fill:"url(#SVGznV2abgm_opt)",d:"M3.78 13.919a.5.5 0 0 1-.778-.416V4.012a2 2 0 0 1 1.996-2l6-.011a2 2 0 0 1 2.004 1.996v9.506a.5.5 0 0 1-.778.416l-4.222-2.82z"}),s.jsx("defs",{children:s.jsxs("linearGradient",{id:"SVGznV2abgm_opt",x1:"3.002",x2:"9.302",y1:"3.019",y2:"11.914",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"#f97dbd"}),s.jsx("stop",{offset:"1",stopColor:"#d7257d"})]})})]})]}),Uw=({size:e=20,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{width:e,height:e},className:Ge("shrink-0",t),children:[s.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{fill:"#2233ca",d:"M14 5v4C7 10 4 15 3 20c2.5-3.5 6-5.1 11-5.1V19l7-7zm2 4.83L18.17 12L16 14.17V12.9h-2c-2.07 0-3.93.38-5.66.95c1.4-1.39 3.2-2.48 5.94-2.85l1.72-.27z"})]}),So=({size:e=14,className:t="",tooltipText:r="Verified User"})=>{const[n,i]=ie.useState(!1),a=o=>{o.stopPropagation(),o.preventDefault(),i(c=>!c),nn.success("Verified Account: This user's identity and editorial credentials have been fully verified by Campus Eye.",{icon:"🛡️",duration:3500})};return s.jsxs("span",{onClick:a,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),className:Ge("relative inline-flex items-center justify-center cursor-pointer select-none transition-transform duration-300 hover:scale-125 active:scale-90",t),children:[n&&s.jsxs("span",{className:"absolute bottom-full mb-2 left-1/2 -translate-x-1/2 z-50 pointer-events-none flex flex-col items-center animate-in fade-in zoom-in-95 duration-150",children:[s.jsx("span",{className:"bg-white text-gray-900 text-[11px] font-semibold px-2.5 py-1 rounded-md shadow-xl border border-gray-200/90 whitespace-nowrap leading-tight",children:r}),s.jsx("span",{className:"w-0 h-0 border-x-4 border-x-transparent border-t-4 border-t-white -mt-[0.5px] filter drop-shadow-xs"})]}),s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{width:e,height:e},className:"shrink-0",children:[s.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{fill:"#1d9bf0",fillRule:"evenodd",d:"M15.418 5.643a1.25 1.25 0 0 0-1.34-.555l-1.798.413a1.25 1.25 0 0 1-.56 0l-1.798-.413a1.25 1.25 0 0 0-1.34-.555l-.98 1.564c-.1.16-.235.295-.395.396l-1.564.98a1.25 1.25 0 0 0-.555 1.338l.413 1.8a1.25 1.25 0 0 1 0 .559l-.413 1.799a1.25 1.25 0 0 0 .555 1.339l1.564.98c.16.1.295.235.396.395l.98 1.564c.282.451.82.674 1.339.555l1.798-.413a1.25 1.25 0 0 1 .56 0l1.799.413a1.25 1.25 0 0 0 1.339-.555l.98-1.564c.1-.16.235-.295.395-.395l1.565-.98a1.25 1.25 0 0 0 .554-1.34L18.5 12.28a1.25 1.25 0 0 1 0-.56l.413-1.799a1.25 1.25 0 0 0-.554-1.339l-1.565-.98a1.25 1.25 0 0 1-.395-.395zm-.503 4.127a.5.5 0 0 0-.86-.509l-2.615 4.426l-1.579-1.512a.5.5 0 1 0-.691.722l2.034 1.949a.5.5 0 0 0 .776-.107z",clipRule:"evenodd"})]})]})},Ppe=({size:e=16,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",style:{width:e,height:e},className:Ge("shrink-0",t),children:[s.jsx("path",{d:"M0 0h16v16H0z",fill:"none"}),s.jsx("path",{fill:"none",stroke:"#ea0e21",d:"M2 2.5h12M7.979 13.906V4.957m4.13 3.889L7.98 4.715l-4.131 4.13"})]}),Ope=({size:e=18,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",style:{width:e,height:e},className:Ge("shrink-0",t),children:[s.jsx("path",{d:"M0 0h512v512H0z",fill:"none"}),s.jsx("path",{fill:"#af00ea",d:"M108.56 342.78a60.34 60.34 0 1 0 60.56 60.44a60.63 60.63 0 0 0-60.56-60.44"}),s.jsx("path",{fill:"#af00ea",d:"M48 186.67v86.55c52 0 101.94 15.39 138.67 52.11s52 86.56 52 138.67h86.66c0-151.56-125.66-277.33-277.33-277.33"}),s.jsx("path",{fill:"#af00ea",d:"M48 48v86.56c185.25 0 329.22 144.08 329.22 329.44H464C464 234.66 277.67 48 48 48"})]}),Rpe=({size:e=18,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 80",style:{width:e,height:e},className:t,children:[s.jsx("path",{d:"M0 0h80v80H0z",fill:"none"}),s.jsxs("g",{fill:"none",children:[s.jsx("path",{fill:"#f2994a",d:"M65.368 67.848a2 2 0 0 0 2.828-2.829zm-9.634-15.29a2 2 0 0 0-2.828 2.828zm12.462 12.461L55.734 52.557l-2.828 2.829l12.462 12.462z"}),s.jsx("path",{fill:"#56ccf2",stroke:"#2f80ed",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4",d:"M13.578 30.724a24.249 24.249 0 1 1 46.844 12.552a24.249 24.249 0 0 1-46.844-12.552"})]})]}),D2=({size:e=18,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 64 64",style:{width:e,height:e},className:t,children:[s.jsx("path",{d:"M0 0h64v64H0z",fill:"none"}),s.jsx("path",{fill:"#454749",d:"M47.5 45.1c-6.6 12.1-6.5 13.1-9.6 11.3S33.6 53 40.3 41S48.9 29.1 52 30.9c3 1.7 2.1 2.2-4.5 14.2"}),s.jsx("path",{fill:"#258399",d:"M53.7 48.7c-4.2 7.7-9.4 11.4-11.9 10c-3.1-1.8-1.5-1.8 5.1-13.9s5.8-13.5 8.9-11.7c2.5 1.4 2.1 7.9-2.1 15.6"}),s.jsx("path",{fill:"#454749",d:"M16.5 45.1c6.6 12.1 6.5 13.1 9.6 11.3S30.4 53 23.7 41S15.1 29.1 12 30.9c-3 1.7-2.1 2.2 4.5 14.2"}),s.jsx("path",{fill:"#258399",d:"M10.3 48.7c4.2 7.7 9.4 11.4-11.9 10c3.1-1.8 1.5-1.8-5.1-13.9s-5.8-13.5-8.9-11.7c-2.5 1.4-2.1 7.9 2.1 15.6"}),s.jsx("path",{fill:"#3baacf",d:"M11.3 57.7s5.4 1.4 5.8 0c2.5-8.1-11.4-12.9-11.4-22.1C5.7 20.8 17.5 8.8 32 8.8s26.3 12 26.3 26.8c0 9.2-13.9 14-11.4 22.1c.4 1.4 5.8 0 5.8 0c5.7-5.6 9.3-13.4 9.3-22.1C62 18.7 48.6 5 32 5S2 18.7 2 35.6c0 8.7 3.6 16.5 9.3 22.1"}),s.jsx("path",{fill:"#454749",d:"M14.9 17.6c3.5-.7 8-5.7 17.1-5.7s13.7 5.1 17.1 5.7c1.4.3 3.8-1.9 3.8-1.9c-5.5-6.3-12-9.5-20.9-9.5s-15.4 3.2-20.9 9.5c0 .1 2.4 2.2 3.8 1.9"})]}),TC=({size:e=18,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{width:e,height:e},className:t,children:[s.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),s.jsxs("g",{fill:"none",children:[s.jsx("path",{fill:"#ff808c",stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M16.304 14.391a1.435 1.435 0 1 0 0-2.87a1.435 1.435 0 0 0 0 2.87",strokeWidth:"0"}),s.jsx("path",{stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M2.915 16.304V8.498m18.171 0v7.806",strokeWidth:"0"}),s.jsx("path",{fill:"#c9f7ca",stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.827V1.002H6.74l-.956 3.825zm10.999 0l-1.65-3.296a.96.96 0 0 0-.854-.53H17.26l.957 3.826z",strokeWidth:"0"}),s.jsx("path",{fill:"#fff9bf",stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M6.74 1.002H3.505a.96.96 0 0 0-.855.529L1.001 4.827h4.782zm11.476 3.825l-.956-3.825H12v3.825z",strokeWidth:"0"}),s.jsx("path",{fill:"#78eb7b",stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M18.216 4.827v2.87c1.398 1.575 3.977 1.048 4.643-.95c.104-.31.15-.637.14-.963v-.957z",strokeWidth:"0"}),s.jsx("path",{fill:"#ffef5e",stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M1.002 4.827v.957C.93 7.89 3.167 9.284 5.026 8.292a2.7 2.7 0 0 0 .758-.596V4.827zm10.998 0v3.481c1.746 1.95 4.884 1.641 6.216-.612V4.827z",strokeWidth:"0"}),s.jsx("path",{fill:"#78eb7b",stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M5.784 4.827v2.87c1.333 2.252 4.47 2.562 6.217.611v-3.48z",strokeWidth:"0"}),s.jsx("path",{fill:"#c77f67",d:"M22.042 16.304H1.958A.956.956 0 0 0 1 17.26v2.87c0 .527.429.956.957.956h20.084a.956.956 0 0 0 .956-.957V17.26a.956.956 0 0 0-.956-.956"}),s.jsx("path",{fill:"#e3bfb3",d:"M22.042 16.304H1.958A.956.956 0 0 0 1 17.26v1.913c0-.528.429-.957.957-.957h20.084c.528 0 .956.429.956.957V17.26a.956.956 0 0 0-.956-.956"}),s.jsx("path",{stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M22.042 16.304H1.958A.956.956 0 0 0 1 17.26v2.87c0 .527.429.956.957.956h20.084a.956.956 0 0 0 .956-.957V17.26a.956.956 0 0 0-.956-.956M2.915 21.086v1.912m18.171-1.912v1.912",strokeWidth:"0"}),s.jsx("path",{fill:"#ff808c",stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M6.261 16.304a1.435 1.435 0 1 0 0-2.87a1.435 1.435 0 0 0 0 2.87",strokeWidth:"0"}),s.jsx("path",{fill:"#ff808c",stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M9.131 16.304a1.435 1.435 0 1 0 0-2.87a1.435 1.435 0 0 0 0 2.87m5.738 0a1.435 1.435 0 1 0 0-2.87a1.435 1.435 0 0 0 0 2.87",strokeWidth:"0"}),s.jsx("path",{fill:"#ff808c",stroke:"#191919",strokeLinecap:"round",strokeLinejoin:"round",d:"M17.739 16.304a1.435 1.435 0 1 0 0-2.87a1.435 1.435 0 0 0 0 2.87",strokeWidth:"0"})]})]}),Dpe=({size:e=18,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",style:{width:e,height:e},className:t,children:[s.jsx("path",{d:"M0 0h48v48H0z",fill:"none"}),s.jsxs("g",{fill:"none",children:[s.jsx("path",{fill:"url(#SVGqLAKpbTS)",d:"M18.067 27h12v16h-12z"}),s.jsx("path",{fill:"url(#SVGN23V5vIj)",d:"M26.461 7.855a3.78 3.78 0 0 0-4.787 0L8.499 18.597a3.91 3.91 0 0 0-1.432 3.031v17.485C7.067 41.26 8.78 43 10.892 43h8.175V30.5a2.5 2.5 0 0 1 2.5-2.5h5a2.5 2.5 0 0 1 2.5 2.5V43h8.175c2.113 0 3.825-1.74 3.825-3.887V21.628a3.91 3.91 0 0 0-1.43-3.031z"}),s.jsx("path",{fill:"url(#SVGTLMWwcZy)",fillRule:"evenodd",d:"m24.068 9.329l-16 13.215a2.054 2.054 0 0 1-2.852-.262a1.956 1.956 0 0 1 .267-2.794L22.28 5.628a2.83 2.83 0 0 1 3.523-.024l16.805 13.588a1.957 1.957 0 0 1 .307 2.79a2.054 2.054 0 0 1-2.848.3z",clipRule:"evenodd"}),s.jsxs("defs",{children:[s.jsxs("linearGradient",{id:"SVGqLAKpbTS",x1:"24.067",x2:"13.481",y1:"27",y2:"44.65",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"#944600"}),s.jsx("stop",{offset:"1",stopColor:"#cd8e02"})]}),s.jsxs("linearGradient",{id:"SVGN23V5vIj",x1:"10.313",x2:"45.173",y1:"5.24",y2:"32",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"#ffd394"}),s.jsx("stop",{offset:"1",stopColor:"#ffb357"})]}),s.jsxs("linearGradient",{id:"SVGTLMWwcZy",x1:"17.817",x2:"25.308",y1:".725",y2:"22.452",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"#ff921f"}),s.jsx("stop",{offset:"1",stopColor:"#eb4824"})]})]})]})]}),d8=({size:e=18,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{width:e,height:e},className:Ge("shrink-0",t),children:[s.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),s.jsx("path",{fill:"currentColor",d:"M19 6h-3c0-2.21-1.79-4-4-4S8 3.79 8 6H5c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-7-2c1.1 0 2 .9 2 2h-4c0-1.1.9-2 2-2zm0 10c-2.76 0-5-2.24-5-5h2c0 1.66 1.34 3 3 3s3-1.34 3-3h2c0 2.76-2.24 5-5 5z"})]}),h8=({size:e=20,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 80",style:{width:e,height:e},className:Ge("shrink-0",t),children:[s.jsx("path",{d:"M0 0h80v80H0z",fill:"none"}),s.jsxs("g",{fill:"none",strokeLinejoin:"round",strokeWidth:"4",children:[s.jsx("path",{fill:"#f2c94c",stroke:"#f2c94c",strokeLinecap:"square",d:"M60 70H20a4 4 0 0 1-4-4a15.87 15.87 0 0 1 10.3-14.86l1.23-.462a35.53 35.53 0 0 1 24.94 0l1.23.462A15.87 15.87 0 0 1 64 66a4 4 0 0 1-4 4Z"}),s.jsx("path",{fill:"#f2994a",stroke:"#f2994a",strokeLinecap:"round",d:"M33.902 38.867a13.347 13.347 0 0 0 19.15-9.08l.223-1.044a14.2 14.2 0 0 0-2.51-11.466l-.36-.48a12.992 12.992 0 0 0-20.81 0l-.36.48a14.2 14.2 0 0 0-2.51 11.465l.223 1.046a13.35 13.35 0 0 0 6.953 9.08"})]})]}),Mpe=({size:e=22,className:t=""})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",style:{width:e,height:e},className:Ge("shrink-0 hover:scale-110 transition-transform",t),children:[s.jsx("path",{d:"M0 0h32v32H0z",fill:"none"}),s.jsxs("g",{fill:"none",children:[s.jsx("path",{fill:"#ac5810",d:"M19.343 4.83C11.708.802 4.757 3.672 2.253 7.595C1.432 8.877.852 11.21.874 13.06c.045 3.807 2.152 8.05 6.7 12.33c5.595 5.265 11.305 4.805 13.12 4.363c2.285-.558 3.817-1.033 3.582-3.163c-.03-.28-.27-.788-.632-1.01c-1.162-.705-3.59-1.072-4.732-2.77c-1.66-2.472.404-2.597 2.382-1.54c2.117 1.133 3.327 1.84 5.452 1.645c1.558-.142 3.823-1.082 4.13-3.71c.276-2.377-3.194-9.975-11.534-14.375m3.117 12.92c-.585.89-2.03.585-2.977-.255s-1.07-2.24-.456-2.79c.625-.557 1.8-.43 2.748.41c.945.842 1.143 1.935.685 2.635"}),s.jsx("path",{fill:"#f2a259",d:"M19.678 3.923C12.042-.105 5.074 3.01 2.57 6.933c-2.507 3.925-1.417 11.192 5.338 17.55c5.594 5.264 11.305 4.805 13.12 4.362c2.285-.557 3.897-1.645 2.892-3.032c-.693-.958-3.175-1.68-4.673-3.91c-1.66-2.473.406-2.598 2.383-1.54c2.117 1.132 3.328 1.84 5.453 1.645c1.557-.143 3.912-1.348 3.842-3.783c-.073-2.393-2.908-9.9-11.248-14.302m3.514 13.757c-.712.77-2.23.56-3.39-.465c-1.157-1.027-1.52-2.482-.807-3.25c.712-.77 2.23-.56 3.39.465s1.52 2.483.807 3.25"}),s.jsx("path",{fill:"#eee",d:"M11.905 21.165c.288-.735 2.333-1.54 4.213-.203c.527.375 1.187 1.33 1.12 2.53c-.22 3.92-6.653 1.055-5.333-2.327"}),s.jsx("path",{fill:"#2686c6",d:"M5.933 14.518c.657-1.05 2.255-1.17 3.652-.263c1.245.807 2.285 2.795.75 4.095c-.822.697-2.245.265-3.122-.408c-1.065-.812-1.988-2.294-1.28-3.424"}),s.jsx("path",{fill:"#ffee58",d:"M14.418 5.355c.202-.832 1.614-.975 2.614-.602c1.728.645 2.51 2.355 1.873 3.307c-.933 1.393-2.965.915-3.735.118c-1.307-1.35-.922-2.125-.752-2.823"}),s.jsx("path",{fill:"#7cb342",d:"M24.428 9.43c1.384.63 1.564 1.627 1.3 2.355c-.166.45-.503 1.067-1.193 1.123c-1.168.095-1.33-.87-2.163-1.135c-.7-.223-.985-1.18-.71-1.823c.256-.592 1-1.325 2.765-.52"}),s.jsx("path",{fill:"#b0b0b0",d:"M16.743 24.24c-.345.313-1.543.698-3.063-.252c-.515-.323-1.008-.79-1.285-1.49c-.217-.55-.17-1.08-.072-1.315c.28-.678.707-.803.707-.803c-.43-.03-1.242.54-1.377 1.288c-.043.235-.346 1.704 1.602 3.037c1.677 1.15 4.158 1.043 3.995-1.272a1.8 1.8 0 0 1-.508.807"}),s.jsx("path",{fill:"#01579b",d:"M11.065 16.43c-.047.893-1.093 1.363-1.675 1.365c-1.648.002-3.128-1.033-3.23-2.875c-.018-.33.145-.807.145-.807c-.218.092-.525.562-.59.827c-.385 1.59 1.217 3.443 2.905 3.818c.855.19 1.933-.103 2.325-.868c.28-.545.225-1.012.12-1.46"}),s.jsx("path",{fill:"#df7f14",d:"M16.83 8.18c-1.12-.128-1.74-.86-1.902-1.028c-.446-.465-.72-.917-.56-1.587c.05-.215.172-.49.322-.645c-.182.06-.477.452-.57.665c-.095.212-.44 1.01.3 1.992c.457.61 1.255 1.298 2.435 1.463c.837.117 1.438-.183 1.938-.67c.34-.333.49-1.083.287-1.47c.033.282-.485 1.482-2.25 1.28"}),s.jsx("path",{fill:"#558b2f",d:"M26.043 11.213a2.4 2.4 0 0 0-.425-.79c.127.245.38.98-.15 1.694c-.268.36-1.073.803-2.023.033c-.28-.228-.505-.453-1.01-.638c-1.282-.472-.723-1.777-.277-2.182c-.35.183-.668.51-.8 1.01c-.186.697.272 1.428.967 1.777c.79.398 1.045 1.165 2.128 1.165q.082 0 .175-.007c.73-.062 1.037-.345 1.26-.69c.272-.43.28-.918.154-1.373"}),s.jsx("path",{fill:"#f44336",d:"M6.455 6.448c.57-.563 1.562-1.158 3.015-.4c.875.455 1.893.99 1.432 2.84c-.284 1.147-1.955 1.755-3.35.477C7 8.86 4.9 7.982 6.455 6.447"}),s.jsx("path",{fill:"#c62828",d:"M11.235 8.64c.018-.437-.207-.97-.285-1.15c.013.262.24.925-.802 1.802a1.73 1.73 0 0 1-1.738.255c-.367-.145-.895-.752-1.272-.905c-1.403-.564-.798-2.067-.6-2.272a1.7 1.7 0 0 0-.688 1.095c-.13.678-.01 1.318.92 2.05c2.64 2.082 3.45.827 3.738.508c.362-.39.707-.9.727-1.383"}),s.jsx("path",{fill:"#fff",d:"M16.435 4.84c-.367-.172-1.417-.122-1.62.753c-.122.525.263 1.057.625.995c.412-.07.193-.713.44-.895c.377-.275 1.07-.61.555-.853M8.69 6.115c-.362-.24-1.52-.242-1.867.645c-.21.533.117 1.15.51 1.14c.447-.01.232-.537.604-.872c.47-.423 1.26-.578.753-.913m-.172 8.01c-.343-.217-1.358-.303-1.778.492c-.308.585.115 1.23.482 1.213c.418-.02.278-.685.545-.835c.408-.227 1.23-.565.75-.87m5.832 6.657c-.367-.172-1.418-.122-1.62.753c-.123.525.262 1.058.625.995c.412-.07.192-.713.44-.895c.375-.275 1.068-.61.555-.853m9.42-11.27c-.33-.234-1.372-.372-1.727.453c-.213.495.07 1.088.437 1.09c.418.002.315-.668.593-.803c.417-.202 1.16-.41.697-.74"})]})]}),Uo='data:image/svg+xml;utf8,';async function M2(e,t,r,n){const i=e?/@(mega\s*(ai)?|me)\b/i.test(e):!1,a=e?/\?/.test(e):!1,o=e?/^(what|how|why|where|when|who|is|can|will|does|should|could|explain|tell|is there|how to)\b/i.test(e.trim()):!1;if(!e||!i&&!a&&!o)return null;const c=e.replace(/@(mega\s*(ai)?|me)\b/gi,"").trim(),h=c.toLowerCase();try{let f=null;try{(await vr(nt(fe,"mega_ai_knowledge"))).forEach(S=>{const j=S.data(),T=j.keywords||[],D=(j.question||"").toLowerCase(),V=D&&(h.includes(D)||D.length>5&&h.includes(D.slice(0,15))),U=T.length>0&&T.some(G=>G&&G.length>2&&h.includes(G.toLowerCase()));(V||U)&&(f=j.answer)})}catch(A){console.warn("Could not query mega_ai_knowledge collection:",A)}let m=f||"";if(!m)try{let A="";try{const T=Jt(nt(fe,"posts"),di("createdAt","desc"),yi(12)),D=await vr(T);D.empty||(A=` [LIVE CAMPUS ARTICLES & SITEMAP KNOWLEDGE BASE]: Sitemap Root: https://campuseyemedia.netlify.app/sitemap.xml Categories: News, Sports, Politics, Entertainment, Tech, Campus Life, Opinion Latest Articles Knowledge: ${D.docs.map((U,G)=>{const X=U.data();return`${G+1}. [Article Title]: "${X.title||"Campus Update"}" | Category: ${X.category||"General"} | Category URL: https://campuseyemedia.netlify.app/?category=${encodeURIComponent(X.category||"General")} [Excerpt]: ${(X.content||"").slice(0,180)}... [Link]: https://campuseyemedia.netlify.app/article/${U.id}`}).join(` `)}`)}catch(T){console.warn("Could not load live articles for Mega AI context:",T)}const j=await(await fetch("/api/mega-ai",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e,context:`Question asked by ${t} in ${n.type}${A}`,articleTitle:n.articleTitle,articleContent:n.articleContent,postContent:n.postContent})})).json();j.reply&&(m=j.reply)}catch(A){console.error("Mega AI API fetch error:",A)}m||(m=`Hello @${t}! I am Mega AI, Campus Eye's smart neural assistant. I've processed your query: "${c||e}" and I am here to assist you! 🎓`);const y=c||e,w=`🧵 [Connected Thread | Question by @${t}]: "${y}" 🧠 [Mega AI Neural Response]: ${m}`;if(r&&r!=="guest")try{await dn(nt(fe,"notifications"),{userId:r,type:"mega_ai_reply",title:"✨ Mega AI Replied to your Question!",message:`Mega AI: "${m.slice(0,110)}${m.length>110?"...":""}"`,fullAnswer:w,userQuery:y,targetType:n.type,postId:n.postId||null,articleId:n.articleId||null,commentId:n.commentId||null,used:!1,playSound:!0,isAiGenerated:!0,createdAt:zr()})}catch(A){console.error("Could not send student inbox notification for Mega AI reply:",A)}if(!f)try{const A=(y||"").toLowerCase().split(" ").filter(S=>S.length>3);await dn(nt(fe,"mega_ai_knowledge"),{question:y.trim(),answer:m.trim(),keywords:A,source:"ai_generated",askedBy:t||"Student",createdAt:zr()})}catch(A){console.warn("Could not auto-save AI response into mega_ai_knowledge:",A)}try{await dn(nt(fe,"notifications"),{type:"mega_ai_query",forAdmin:!0,isAdminNotification:!0,title:`🤖 Mega AI Response to @${t}`,message:`@${t} asked: "${y.slice(0,60)}${y.length>60?"...":""}" ➔ AI replied: "${m.slice(0,90)}${m.length>90?"...":""}"`,userQuery:e,generatedReply:m,fullAnswer:w,userUid:r||"guest",userName:t||"Student Peer",targetType:n.type,postId:n.postId||null,commentId:n.commentId||null,articleId:n.articleId||null,used:!1,playSound:!0,createdAt:zr()}),(await vr(nt(fe,"admins"))).forEach(async S=>{const j=S.id;if(j&&j!==r)try{await dn(nt(fe,"notifications"),{userId:j,type:"mega_ai_admin_log",forAdmin:!0,isAdminNotification:!0,title:`🤖 Mega AI Answered @${t}`,message:`AI Response sent: "${m.slice(0,100)}${m.length>100?"...":""}"`,userQuery:y,generatedReply:m,fullAnswer:w,targetType:n.type,postId:n.postId||null,articleId:n.articleId||null,commentId:n.commentId||null,used:!1,playSound:!0,isAiGenerated:!0,createdAt:zr()})}catch{}})}catch(A){console.error("Could not add admin notification for Mega AI query:",A)}return w}catch(f){return console.error("Error in triggerMegaAiAutoReply:",f),null}}const Bw=({className:e,size:t="sm"})=>s.jsxs("span",{className:Ge("inline-flex items-center gap-1 font-extrabold bg-gradient-to-r from-amber-500/10 via-purple-500/10 to-red-500/10 border border-amber-500/30 text-amber-700 uppercase tracking-wider rounded-full shadow-2xs shrink-0 select-none",t==="sm"?"text-[8.5px] px-2 py-0.5":"text-[9.5px] px-2.5 py-1",e),children:[s.jsx(Xi,{size:t==="sm"?10:12,className:"text-amber-500 shrink-0"}),s.jsx("span",{children:"AI Generated"})]}),L2=(e,t)=>{if(!e)return null;const r=e.match(/^(?:💬\s*)?(?:\[Replying to @([^\]]+)\]|Replying to @([^\s:]+)):\s*"([^"]+)"\s*(?:\n+|⚡\s*|\s+)([\s\S]*)/i);if(r){const a=r[1]||r[2],o=r[3],c=r[4];return s.jsxs("div",{className:"space-y-2 my-1 text-left w-full",children:[s.jsxs("div",{className:"bg-slate-950/90 text-cyan-100 p-2.5 rounded-xl border border-cyan-500/40 shadow-sm backdrop-blur-xs",children:[s.jsxs("div",{className:"flex items-center justify-between text-[8.5px] font-mono font-bold text-cyan-400 uppercase tracking-wider mb-1 pb-1 border-b border-cyan-500/20",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-cyan-400 animate-pulse"}),s.jsxs("span",{children:["QUESTION THREAD — ASKED BY @",a.toUpperCase()]})]}),s.jsx("span",{className:"text-[7.5px] text-cyan-400/80 font-mono",children:"CONNECTED"})]}),s.jsxs("p",{className:"text-[10.5px] font-sans text-cyan-100/90 italic border-l-2 border-cyan-400 pl-2 py-0.5 leading-relaxed break-words",children:['"',o,'"']})]}),s.jsx("div",{className:"leading-relaxed font-sans text-inherit",children:L2(c)})]})}const n=/(https?:\/\/[^\s]+|#[a-zA-Z0-9_\-]+|@Mega\s+AI|@Mega|@megaai|@Me|@[a-zA-Z0-9_\-]+)/gi,i=e.split(n);return s.jsx(s.Fragment,{children:i.map((a,o)=>a?a.startsWith("http://")||a.startsWith("https://")?s.jsx("a",{href:a,onClick:c=>{c.preventDefault(),c.stopPropagation(),window.open(a,"_blank","noopener,noreferrer")},className:"text-blue-600 font-bold hover:underline select-text inline-flex items-center gap-0.5 break-all cursor-pointer",children:a},o):/^@(Mega\s+AI|Mega|megaai|Me)$/i.test(a)?s.jsxs("span",{className:"inline-flex items-center gap-1 text-cyan-300 font-extrabold bg-gradient-to-r from-slate-950 via-cyan-950 to-purple-950 border border-cyan-400/50 px-2 py-0.5 rounded-lg shadow-cyan-500/20 mx-0.5 text-[0.95em] select-none",children:[s.jsx(Xi,{size:11,className:"text-cyan-400 shrink-0"}),s.jsx("span",{children:a})]},o):a.startsWith("@")?s.jsx("span",{className:"text-blue-600 font-bold bg-blue-50/80 border border-blue-100 px-1 py-0.2 rounded hover:underline cursor-pointer inline-flex items-center transition-colors mx-0.5",children:a},o):a.startsWith("#")?s.jsx("span",{className:"text-red-650 font-bold bg-red-50/70 hover:bg-red-100/80 border border-red-150/60 px-1.5 py-0.5 rounded-md hover:underline cursor-pointer inline-flex items-center transition-colors mx-0.5",children:a},o):s.jsx(ie.Fragment,{children:a},o):null)})},BT=I.createContext({});function zT(e){const t=I.useRef(null);return t.current===null&&(t.current=e()),t.current}const Lpe=typeof window<"u",pq=Lpe?I.useLayoutEffect:I.useEffect,DE=I.createContext(null);function VT(e,t){e.indexOf(t)===-1&&e.push(t)}function U2(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}const $u=(e,t,r)=>r>t?t:r{};const wf={},mq=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function gq(e){return typeof e=="object"&&e!==null}const xq=e=>/^0[^.\s]+$/u.test(e);function yq(e){let t;return()=>(t===void 0&&(t=e()),t)}const vc=e=>e,Upe=(e,t)=>r=>t(e(r)),nb=(...e)=>e.reduce(Upe),yy=(e,t,r)=>{const n=t-e;return n===0?1:(r-e)/n};class $T{constructor(){this.subscriptions=[]}add(t){return VT(this.subscriptions,t),()=>U2(this.subscriptions,t)}notify(t,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,r,n);else for(let a=0;ae*1e3,xc=e=>e/1e3;function bq(e,t){return t?e*(1e3/t):0}const vq=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Bpe=1e-7,zpe=12;function Vpe(e,t,r,n,i){let a,o,c=0;do o=t+(r-t)/2,a=vq(o,n,i)-e,a>0?r=o:t=o;while(Math.abs(a)>Bpe&&++cVpe(a,0,1,e,r);return a=>a===0||a===1?a:vq(i(a),t,n)}const wq=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Nq=e=>t=>1-e(1-t),Eq=ib(.33,1.53,.69,.99),HT=Nq(Eq),Aq=wq(HT),kq=e=>e>=1?1:(e*=2)<1?.5*HT(e):.5*(2-Math.pow(2,-10*(e-1))),GT=e=>1-Math.sin(Math.acos(e)),_q=Nq(GT),Sq=wq(GT),Fpe=ib(.42,0,1,1),$pe=ib(0,0,.58,1),Cq=ib(.42,0,.58,1),Hpe=e=>Array.isArray(e)&&typeof e[0]!="number",jq=e=>Array.isArray(e)&&typeof e[0]=="number",Gpe={linear:vc,easeIn:Fpe,easeInOut:Cq,easeOut:$pe,circIn:GT,circInOut:Sq,circOut:_q,backIn:HT,backInOut:Aq,backOut:Eq,anticipate:kq},qpe=e=>typeof e=="string",f8=e=>{if(jq(e)){FT(e.length===4);const[t,r,n,i]=e;return ib(t,r,n,i)}else if(qpe(e))return Gpe[e];return e},Vv=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Wpe(e,t){let r=new Set,n=new Set,i=!1,a=!1;const o=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function h(m){o.has(m)&&(f.schedule(m),e()),m(c)}const f={schedule:(m,y=!1,w=!1)=>{const S=w&&i?r:n;return y&&o.add(m),S.add(m),m},cancel:m=>{n.delete(m),o.delete(m)},process:m=>{if(c=m,i){a=!0;return}i=!0;const y=r;r=n,n=y,r.forEach(h),r.clear(),i=!1,a&&(a=!1,f.process(m))}};return f}const Kpe=40;function Iq(e,t){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>r=!0,o=Vv.reduce((U,G)=>(U[G]=Wpe(a),U),{}),{setup:c,read:h,resolveKeyframes:f,preUpdate:m,update:y,preRender:w,render:A,postRender:S}=o,j=()=>{const U=wf.useManualTiming,G=U?i.timestamp:performance.now();r=!1,U||(i.delta=n?1e3/60:Math.max(Math.min(G-i.timestamp,Kpe),1)),i.timestamp=G,i.isProcessing=!0,c.process(i),h.process(i),f.process(i),m.process(i),y.process(i),w.process(i),A.process(i),S.process(i),i.isProcessing=!1,r&&t&&(n=!1,e(j))},T=()=>{r=!0,n=!0,i.isProcessing||e(j)};return{schedule:Vv.reduce((U,G)=>{const X=o[G];return U[G]=(q,B=!1,z=!1)=>(r||T(),X.schedule(q,B,z)),U},{}),cancel:U=>{for(let G=0;G(zw===void 0&&zo.set(no.isProcessing||wf.useManualTiming?no.timestamp:performance.now()),zw),set:e=>{zw=e,queueMicrotask(Ype)}},Tq=e=>t=>typeof t=="string"&&t.startsWith(e),Pq=Tq("--"),Xpe=Tq("var(--"),qT=e=>Xpe(e)?Qpe.test(e.split("/*")[0].trim()):!1,Qpe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function p8(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Hg={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},by={...Hg,transform:e=>$u(0,1,e)},Fv={...Hg,default:1},G1=e=>Math.round(e*1e5)/1e5,WT=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Zpe(e){return e==null}const Jpe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,KT=(e,t)=>r=>!!(typeof r=="string"&&Jpe.test(r)&&r.startsWith(e)||t&&!Zpe(r)&&Object.prototype.hasOwnProperty.call(r,t)),Oq=(e,t,r)=>n=>{if(typeof n!="string")return n;const[i,a,o,c]=n.match(WT);return{[e]:parseFloat(i),[t]:parseFloat(a),[r]:parseFloat(o),alpha:c!==void 0?parseFloat(c):1}},eme=e=>$u(0,255,e),bk={...Hg,transform:e=>Math.round(eme(e))},Np={test:KT("rgb","red"),parse:Oq("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+bk.transform(e)+", "+bk.transform(t)+", "+bk.transform(r)+", "+G1(by.transform(n))+")"};function tme(e){let t="",r="",n="",i="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),i=e.substring(4,5),t+=t,r+=r,n+=n,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const PC={test:KT("#"),parse:tme,transform:Np.transform},sb=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Gh=sb("deg"),Lu=sb("%"),Br=sb("px"),rme=sb("vh"),nme=sb("vw"),m8={...Lu,parse:e=>Lu.parse(e)/100,transform:e=>Lu.transform(e*100)},U0={test:KT("hsl","hue"),parse:Oq("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+Lu.transform(G1(t))+", "+Lu.transform(G1(r))+", "+G1(by.transform(n))+")"},ca={test:e=>Np.test(e)||PC.test(e)||U0.test(e),parse:e=>Np.test(e)?Np.parse(e):U0.test(e)?U0.parse(e):PC.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Np.transform(e):U0.transform(e),getAnimatableNone:e=>{const t=ca.parse(e);return t.alpha=0,ca.transform(t)}},ime=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function sme(e){var t,r;return isNaN(e)&&typeof e=="string"&&(((t=e.match(WT))==null?void 0:t.length)||0)+(((r=e.match(ime))==null?void 0:r.length)||0)>0}const Rq="number",Dq="color",ame="var",ome="var(",g8="${}",lme=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function kg(e){const t=e.toString(),r=[],n={color:[],number:[],var:[]},i=[];let a=0;const c=t.replace(lme,h=>(ca.test(h)?(n.color.push(a),i.push(Dq),r.push(ca.parse(h))):h.startsWith(ome)?(n.var.push(a),i.push(ame),r.push(h)):(n.number.push(a),i.push(Rq),r.push(parseFloat(h))),++a,g8)).split(g8);return{values:r,split:c,indexes:n,types:i}}function cme(e){return kg(e).values}function Mq({split:e,types:t}){const r=e.length;return n=>{let i="";for(let a=0;atypeof e=="number"?0:ca.test(e)?ca.getAnimatableNone(e):e,hme=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:dme(e);function fme(e){const t=kg(e);return Mq(t)(t.values.map((n,i)=>hme(n,t.split[i])))}const Wc={test:sme,parse:cme,createTransformer:ume,getAnimatableNone:fme};function vk(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function pme({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,t/=100,r/=100;let i=0,a=0,o=0;if(!t)i=a=o=r;else{const c=r<.5?r*(1+t):r+t-r*t,h=2*r-c;i=vk(h,c,e+1/3),a=vk(h,c,e),o=vk(h,c,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:n}}function B2(e,t){return r=>r>0?t:e}const gs=(e,t,r)=>e+(t-e)*r,wk=(e,t,r)=>{const n=e*e,i=r*(t*t-n)+n;return i<0?0:Math.sqrt(i)},mme=[PC,Np,U0],gme=e=>mme.find(t=>t.test(e));function x8(e){const t=gme(e);if(!t)return!1;let r=t.parse(e);return t===U0&&(r=pme(r)),r}const y8=(e,t)=>{const r=x8(e),n=x8(t);if(!r||!n)return B2(e,t);const i={...r};return a=>(i.red=wk(r.red,n.red,a),i.green=wk(r.green,n.green,a),i.blue=wk(r.blue,n.blue,a),i.alpha=gs(r.alpha,n.alpha,a),Np.transform(i))},OC=new Set(["none","hidden"]);function xme(e,t){return OC.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function yme(e,t){return r=>gs(e,t,r)}function YT(e){return typeof e=="number"?yme:typeof e=="string"?qT(e)?B2:ca.test(e)?y8:wme:Array.isArray(e)?Lq:typeof e=="object"?ca.test(e)?y8:bme:B2}function Lq(e,t){const r=[...e],n=r.length,i=e.map((a,o)=>YT(a)(a,t[o]));return a=>{for(let o=0;o{for(const a in n)r[a]=n[a](i);return r}}function vme(e,t){const r=[],n={color:0,var:0,number:0};for(let i=0;i{const r=Wc.createTransformer(t),n=kg(e),i=kg(t);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?OC.has(e)&&!i.values.length||OC.has(t)&&!n.values.length?xme(e,t):nb(Lq(vme(n,i),i.values),r):B2(e,t)};function Uq(e,t,r){return typeof e=="number"&&typeof t=="number"&&typeof r=="number"?gs(e,t,r):YT(e)(e,t)}const Nme=e=>{const t=({timestamp:r})=>e(r);return{start:(r=!0)=>Ji.update(t,r),stop:()=>Nf(t),now:()=>no.isProcessing?no.timestamp:zo.now()}},Bq=(e,t,r=10)=>{let n="";const i=Math.max(Math.round(t/r),2);for(let a=0;a=z2?1/0:t}function Eme(e,t=100,r){const n=r({...e,keyframes:[0,t]}),i=Math.min(XT(n),z2);return{type:"keyframes",ease:a=>n.next(i*a).value/t,duration:xc(i)}}const $s={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function RC(e,t){return e*Math.sqrt(1-t*t)}const Ame=12;function kme(e,t,r){let n=r;for(let i=1;i{const m=f*o,y=m*e,w=m-r,A=RC(f,o),S=Math.exp(-y);return Nk-w/A*S},a=f=>{const y=f*o*e,w=y*r+r,A=Math.pow(o,2)*Math.pow(f,2)*e,S=Math.exp(-y),j=RC(Math.pow(f,2),o);return(-i(f)+Nk>0?-1:1)*((w-A)*S)/j}):(i=f=>{const m=Math.exp(-f*e),y=(f-r)*e+1;return-Nk+m*y},a=f=>{const m=Math.exp(-f*e),y=(r-f)*(e*e);return m*y});const c=5/e,h=kme(i,a,c);if(e=Hl(e),isNaN(h))return{stiffness:$s.stiffness,damping:$s.damping,duration:e};{const f=Math.pow(h,2)*n;return{stiffness:f,damping:o*2*Math.sqrt(n*f),duration:e}}}const Sme=["duration","bounce"],Cme=["stiffness","damping","mass"];function b8(e,t){return t.some(r=>e[r]!==void 0)}function jme(e){let t={velocity:$s.velocity,stiffness:$s.stiffness,damping:$s.damping,mass:$s.mass,isResolvedFromDuration:!1,...e};if(!b8(e,Cme)&&b8(e,Sme))if(t.velocity=0,e.visualDuration){const r=e.visualDuration,n=2*Math.PI/(r*1.2),i=n*n,a=2*$u(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:$s.mass,stiffness:i,damping:a}}else{const r=_me({...e,velocity:0});t={...t,...r,mass:$s.mass},t.isResolvedFromDuration=!0}return t}function V2(e=$s.visualDuration,t=$s.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:i}=r;const a=r.keyframes[0],o=r.keyframes[r.keyframes.length-1],c={done:!1,value:a},{stiffness:h,damping:f,mass:m,duration:y,velocity:w,isResolvedFromDuration:A}=jme({...r,velocity:-xc(r.velocity||0)}),S=w||0,j=f/(2*Math.sqrt(h*m)),T=o-a,D=xc(Math.sqrt(h/m)),V=Math.abs(T)<5;n||(n=V?$s.restSpeed.granular:$s.restSpeed.default),i||(i=V?$s.restDelta.granular:$s.restDelta.default);let U,G,X,q,B,z;if(j<1)X=RC(D,j),q=(S+j*D*T)/X,U=$=>{const J=Math.exp(-j*D*$);return o-J*(q*Math.sin(X*$)+T*Math.cos(X*$))},B=j*D*q+T*X,z=j*D*T-q*X,G=$=>Math.exp(-j*D*$)*(B*Math.sin(X*$)+z*Math.cos(X*$));else if(j===1){U=J=>o-Math.exp(-D*J)*(T+(S+D*T)*J);const $=S+D*T;G=J=>Math.exp(-D*J)*(D*$*J-S)}else{const $=D*Math.sqrt(j*j-1);U=me=>{const re=Math.exp(-j*D*me),le=Math.min($*me,300);return o-re*((S+j*D*T)*Math.sinh(le)+$*T*Math.cosh(le))/$};const J=(S+j*D*T)/$,Q=j*D*J-T*$,K=j*D*T-J*$;G=me=>{const re=Math.exp(-j*D*me),le=Math.min($*me,300);return re*(Q*Math.sinh(le)+K*Math.cosh(le))}}const F={calculatedDuration:A&&y||null,velocity:$=>Hl(G($)),next:$=>{if(!A&&j<1){const Q=Math.exp(-j*D*$),K=Math.sin(X*$),me=Math.cos(X*$),re=o-Q*(q*K+T*me),le=Hl(Q*(B*K+z*me));return c.done=Math.abs(le)<=n&&Math.abs(o-re)<=i,c.value=c.done?o:re,c}const J=U($);if(A)c.done=$>=y;else{const Q=Hl(G($));c.done=Math.abs(Q)<=n&&Math.abs(o-J)<=i}return c.value=c.done?o:J,c},toString:()=>{const $=Math.min(XT(F),z2),J=Bq(Q=>F.next($*Q).value,$,30);return $+"ms "+J},toTransition:()=>{}};return F}V2.applyToOptions=e=>{const t=Eme(e,100,V2);return e.ease=t.ease,e.duration=Hl(t.duration),e.type="keyframes",e};const Ime=5;function zq(e,t,r){const n=Math.max(t-Ime,0);return bq(r-e(n),t-n)}function DC({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:c,max:h,restDelta:f=.5,restSpeed:m}){const y=e[0],w={done:!1,value:y},A=z=>c!==void 0&&zh,S=z=>c===void 0?h:h===void 0||Math.abs(c-z)-j*Math.exp(-z/n),U=z=>D+V(z),G=z=>{const F=V(z),$=U(z);w.done=Math.abs(F)<=f,w.value=w.done?D:$};let X,q;const B=z=>{A(w.value)&&(X=z,q=V2({keyframes:[w.value,S(w.value)],velocity:zq(U,z,w.value),damping:i,stiffness:a,restDelta:f,restSpeed:m}))};return B(0),{calculatedDuration:null,next:z=>{let F=!1;return!q&&X===void 0&&(F=!0,G(z),B(z)),X!==void 0&&z>=X?q.next(z-X):(!F&&G(z),w)}}}function Tme(e,t,r){const n=[],i=r||wf.mix||Uq,a=e.length-1;for(let o=0;ot[0];if(a===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=Tme(t,n,i),h=c.length,f=m=>{if(o&&m1)for(;yf($u(e[0],e[a-1],m)):f}function Ome(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const i=yy(0,t,n);e.push(gs(r,1,i))}}function Rme(e){const t=[0];return Ome(t,e.length-1),t}function Dme(e,t){return e.map(r=>r*t)}function Mme(e,t){return e.map(()=>t||Cq).splice(0,e.length-1)}function q1({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const i=Hpe(n)?n.map(f8):f8(n),a={done:!1,value:t[0]},o=Dme(r&&r.length===t.length?r:Rme(t),e),c=Pme(o,t,{ease:Array.isArray(i)?i:Mme(t,i)});return{calculatedDuration:e,next:h=>(a.value=c(h),a.done=h>=e,a)}}const Lme=e=>e!==null;function ME(e,{repeat:t,repeatType:r="loop"},n,i=1){const a=e.filter(Lme),c=i<0||t&&r!=="loop"&&t%2===1?0:a.length-1;return!c||n===void 0?a[c]:n}const Ume={decay:DC,inertia:DC,tween:q1,keyframes:q1,spring:V2};function Vq(e){typeof e.type=="string"&&(e.type=Ume[e.type])}class QT{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,r){return this.finished.then(t,r)}}const Bme=e=>e/100;class F2 extends QT{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var n,i;const{motionValue:r}=this.options;r&&r.updatedAt!==zo.now()&&this.tick(zo.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(n=this.options).onStop)==null||i.call(n))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Vq(t);const{type:r=q1,repeat:n=0,repeatDelay:i=0,repeatType:a,velocity:o=0}=t;let{keyframes:c}=t;const h=r||q1;h!==q1&&typeof c[0]!="number"&&(this.mixKeyframes=nb(Bme,Uq(c[0],c[1])),c=[0,100]);const f=h({...t,keyframes:c});a==="mirror"&&(this.mirroredGenerator=h({...t,keyframes:[...c].reverse(),velocity:-o})),f.calculatedDuration===null&&(f.calculatedDuration=XT(f));const{calculatedDuration:m}=f;this.calculatedDuration=m,this.resolvedDuration=m+i,this.totalDuration=this.resolvedDuration*(n+1)-i,this.generator=f}updateTime(t){const r=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(t,r=!1){const{generator:n,totalDuration:i,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:c,calculatedDuration:h}=this;if(this.startTime===null)return n.next(0);const{delay:f=0,keyframes:m,repeat:y,repeatType:w,repeatDelay:A,type:S,onUpdate:j,finalKeyframe:T}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),r?this.currentTime=t:this.updateTime(t);const D=this.currentTime-f*(this.playbackSpeed>=0?1:-1),V=this.playbackSpeed>=0?D<0:D>i;this.currentTime=Math.max(D,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let U=this.currentTime,G=n;if(y){const z=Math.min(this.currentTime,i)/c;let F=Math.floor(z),$=z%1;!$&&z>=1&&($=1),$===1&&F--,F=Math.min(F,y+1),!!(F%2)&&(w==="reverse"?($=1-$,A&&($-=A/c)):w==="mirror"&&(G=o)),U=$u(0,1,$)*c}let X;V?(this.delayState.value=m[0],X=this.delayState):X=G.next(U),a&&!V&&(X.value=a(X.value));let{done:q}=X;!V&&h!==null&&(q=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&q);return B&&S!==DC&&(X.value=ME(m,this.options,T,this.speed)),j&&j(X.value),B&&this.finish(),X}then(t,r){return this.finished.then(t,r)}get duration(){return xc(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+xc(t)}get time(){return xc(this.currentTime)}set time(t){t=Hl(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const r=this.generator.next(t).value;return zq(n=>this.generator.next(n).value,t,r)}get speed(){return this.playbackSpeed}set speed(t){const r=this.playbackSpeed!==t;r&&this.driver&&this.updateTime(zo.now()),this.playbackSpeed=t,r&&this.driver&&(this.time=xc(this.currentTime))}play(){var i,a;if(this.isStopped)return;const{driver:t=Nme,startTime:r}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(a=(i=this.options).onPlay)==null||a.call(i);const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=r??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(zo.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,r;this.notifyFinished(),this.teardown(),this.state="finished",(r=(t=this.options).onComplete)==null||r.call(t)}cancel(){var t,r;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(r=(t=this.options).onCancel)==null||r.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var r;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(r=this.driver)==null||r.stop(),t.observe(this)}}function zme(e){for(let t=1;te*180/Math.PI,MC=e=>{const t=Ep(Math.atan2(e[1],e[0]));return LC(t)},Vme={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:MC,rotateZ:MC,skewX:e=>Ep(Math.atan(e[1])),skewY:e=>Ep(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},LC=e=>(e=e%360,e<0&&(e+=360),e),v8=MC,w8=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),N8=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Fme={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:w8,scaleY:N8,scale:e=>(w8(e)+N8(e))/2,rotateX:e=>LC(Ep(Math.atan2(e[6],e[5]))),rotateY:e=>LC(Ep(Math.atan2(-e[2],e[0]))),rotateZ:v8,rotate:v8,skewX:e=>Ep(Math.atan(e[4])),skewY:e=>Ep(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function UC(e){return e.includes("scale")?1:0}function BC(e,t){if(!e||e==="none")return UC(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,i;if(r)n=Fme,i=r;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=Vme,i=c}if(!i)return UC(t);const a=n[t],o=i[1].split(",").map(Hme);return typeof a=="function"?a(o):o[a]}const $me=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return BC(r,t)};function Hme(e){return parseFloat(e.trim())}const Gg=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],qg=new Set(Gg),E8=e=>e===Hg||e===Br,Gme=new Set(["x","y","z"]),qme=Gg.filter(e=>!Gme.has(e));function Wme(e){const t=[];return qme.forEach(r=>{const n=e.getValue(r);n!==void 0&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t}const af={width:({x:e},{paddingLeft:t="0",paddingRight:r="0",boxSizing:n})=>{const i=e.max-e.min;return n==="border-box"?i:i-parseFloat(t)-parseFloat(r)},height:({y:e},{paddingTop:t="0",paddingBottom:r="0",boxSizing:n})=>{const i=e.max-e.min;return n==="border-box"?i:i-parseFloat(t)-parseFloat(r)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>BC(t,"x"),y:(e,{transform:t})=>BC(t,"y")};af.translateX=af.x;af.translateY=af.y;const Lp=new Set;let zC=!1,VC=!1,FC=!1;function Fq(){if(VC){const e=Array.from(Lp).filter(n=>n.needsMeasurement),t=new Set(e.map(n=>n.element)),r=new Map;t.forEach(n=>{const i=Wme(n);i.length&&(r.set(n,i),n.render())}),e.forEach(n=>n.measureInitialState()),t.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([a,o])=>{var c;(c=n.getValue(a))==null||c.set(o)})}),e.forEach(n=>n.measureEndState()),e.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}VC=!1,zC=!1,Lp.forEach(e=>e.complete(FC)),Lp.clear()}function $q(){Lp.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(VC=!0)})}function Kme(){FC=!0,$q(),Fq(),FC=!1}class ZT{constructor(t,r,n,i,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=r,this.name=n,this.motionValue=i,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Lp.add(this),zC||(zC=!0,Ji.read($q),Ji.resolveKeyframes(Fq))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:r,element:n,motionValue:i}=this;if(t[0]===null){const a=i==null?void 0:i.get(),o=t[t.length-1];if(a!==void 0)t[0]=a;else if(n&&r){const c=n.readValue(r,o);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=o),i&&a===void 0&&i.set(t[0])}zme(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Lp.delete(this)}cancel(){this.state==="scheduled"&&(Lp.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Yme=e=>e.startsWith("--");function Hq(e,t,r){Yme(t)?e.style.setProperty(t,r):e.style[t]=r}const Xme={};function Gq(e,t){const r=yq(e);return()=>Xme[t]??r()}const Qme=Gq(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),qq=Gq(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),S1=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,A8={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:S1([0,.65,.55,1]),circOut:S1([.55,0,1,.45]),backIn:S1([.31,.01,.66,-.59]),backOut:S1([.33,1.53,.69,.99])};function Wq(e,t){if(e)return typeof e=="function"?qq()?Bq(e,t):"ease-out":jq(e)?S1(e):Array.isArray(e)?e.map(r=>Wq(r,t)||A8.easeOut):A8[e]}function Zme(e,t,r,{delay:n=0,duration:i=300,repeat:a=0,repeatType:o="loop",ease:c="easeOut",times:h}={},f=void 0){const m={[t]:r};h&&(m.offset=h);const y=Wq(c,i);Array.isArray(y)&&(m.easing=y);const w={delay:n,duration:i,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"};return f&&(w.pseudoElement=f),e.animate(m,w)}function Kq(e){return typeof e=="function"&&"applyToOptions"in e}function Jme({type:e,...t}){return Kq(e)&&qq()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Yq extends QT{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:r,name:n,keyframes:i,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:c,onComplete:h}=t;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=t,FT(typeof t.type!="string");const f=Jme(t);this.animation=Zme(r,n,i,f,a),f.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const m=ME(i,this.options,c,this.speed);this.updateMotionValue&&this.updateMotionValue(m),Hq(r,n,m),this.animation.cancel()}h==null||h(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,r;(r=(t=this.animation).finish)==null||r.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var r,n,i;const t=(r=this.options)==null?void 0:r.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((i=(n=this.animation).commitStyles)==null||i.call(n))}get duration(){var r,n;const t=((n=(r=this.animation.effect)==null?void 0:r.getComputedTiming)==null?void 0:n.call(r).duration)||0;return xc(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+xc(t)}get time(){return xc(Number(this.animation.currentTime)||0)}set time(t){const r=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Hl(t),r&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:r,rangeEnd:n,observe:i}){var a;return this.allowFlatten&&((a=this.animation.effect)==null||a.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&Qme()?(this.animation.timeline=t,r&&(this.animation.rangeStart=r),n&&(this.animation.rangeEnd=n),vc):i(this)}}const Xq={anticipate:kq,backInOut:Aq,circInOut:Sq};function e0e(e){return e in Xq}function t0e(e){typeof e.ease=="string"&&e0e(e.ease)&&(e.ease=Xq[e.ease])}const Ek=10;class r0e extends Yq{constructor(t){t0e(t),Vq(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:r,onUpdate:n,onComplete:i,element:a,...o}=this.options;if(!r)return;if(t!==void 0){r.set(t);return}const c=new F2({...o,autoplay:!1}),h=Math.max(Ek,zo.now()-this.startTime),f=$u(0,Ek,h-Ek),m=c.sample(h).value,{name:y}=this.options;a&&y&&Hq(a,y,m),r.setWithVelocity(c.sample(Math.max(0,h-f)).value,m,f),c.stop()}}const k8=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Wc.test(e)||e==="0")&&!e.startsWith("url("));function n0e(e){const t=e[0];if(e.length===1)return!0;for(let r=0;rObject.hasOwnProperty.call(Element.prototype,"animate"));function c0e(e){var y;const{motionValue:t,name:r,repeatDelay:n,repeatType:i,damping:a,type:o,keyframes:c}=e;if(!(((y=t==null?void 0:t.owner)==null?void 0:y.current)instanceof HTMLElement))return!1;const{onUpdate:f,transformTemplate:m}=t.owner.getProps();return l0e()&&r&&(Qq.has(r)||o0e.has(r)&&a0e(c))&&(r!=="transform"||!m)&&!f&&!n&&i!=="mirror"&&a!==0&&o!=="inertia"}const u0e=40;class d0e extends QT{constructor({autoplay:t=!0,delay:r=0,type:n="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:o="loop",keyframes:c,name:h,motionValue:f,element:m,...y}){var S;super(),this.stop=()=>{var j,T;this._animation&&(this._animation.stop(),(j=this.stopTimeline)==null||j.call(this)),(T=this.keyframeResolver)==null||T.cancel()},this.createdAt=zo.now();const w={autoplay:t,delay:r,type:n,repeat:i,repeatDelay:a,repeatType:o,name:h,motionValue:f,element:m,...y},A=(m==null?void 0:m.KeyframeResolver)||ZT;this.keyframeResolver=new A(c,(j,T,D)=>this.onKeyframesResolved(j,T,w,!D),h,f,m),(S=this.keyframeResolver)==null||S.scheduleResolve()}onKeyframesResolved(t,r,n,i){var D,V;this.keyframeResolver=void 0;const{name:a,type:o,velocity:c,delay:h,isHandoff:f,onUpdate:m}=n;this.resolvedAt=zo.now();let y=!0;i0e(t,a,o,c)||(y=!1,(wf.instantAnimations||!h)&&(m==null||m(ME(t,n,r))),t[0]=t[t.length-1],$C(n),n.repeat=0);const A={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>u0e?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...n,keyframes:t},S=y&&!f&&c0e(A),j=(V=(D=A.motionValue)==null?void 0:D.owner)==null?void 0:V.current;let T;if(S)try{T=new r0e({...A,element:j})}catch{T=new F2(A)}else T=new F2(A);T.finished.then(()=>{this.notifyFinished()}).catch(vc),this.pendingTimeline&&(this.stopTimeline=T.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=T}get finished(){return this._animation?this.animation.finished:this._finished}then(t,r){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Kme()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function Zq(e,t,r,n=0,i=1){const a=Array.from(e).sort((f,m)=>f.sortNodePosition(m)).indexOf(t),o=e.size,c=(o-1)*n;return typeof r=="function"?r(a,o):i===1?a*n:c-a*n}const h0e=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function f0e(e){const t=h0e.exec(e);if(!t)return[,];const[,r,n,i]=t;return[`--${r??n}`,i]}function Jq(e,t,r=1){const[n,i]=f0e(e);if(!n)return;const a=window.getComputedStyle(t).getPropertyValue(n);if(a){const o=a.trim();return mq(o)?parseFloat(o):o}return qT(i)?Jq(i,t,r+1):i}const p0e={type:"spring",stiffness:500,damping:25,restSpeed:10},m0e=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),g0e={type:"keyframes",duration:.8},x0e={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},y0e=(e,{keyframes:t})=>t.length>2?g0e:qg.has(e)?e.startsWith("scale")?m0e(t[1]):p0e:x0e;function eW(e,t){if(e!=null&&e.inherit&&t){const{inherit:r,...n}=e;return{...t,...n}}return e}function JT(e,t){const r=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return r!==e?eW(r,e):r}const b0e=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function v0e(e){for(const t in e)if(!b0e.has(t))return!0;return!1}const e4=(e,t,r,n={},i,a)=>o=>{const c=JT(n,e)||{},h=c.delay||n.delay||0;let{elapsed:f=0}=n;f=f-Hl(h);const m={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-f,onUpdate:w=>{t.set(w),c.onUpdate&&c.onUpdate(w)},onComplete:()=>{o(),c.onComplete&&c.onComplete()},name:e,motionValue:t,element:a?void 0:i};v0e(c)||Object.assign(m,y0e(e,m)),m.duration&&(m.duration=Hl(m.duration)),m.repeatDelay&&(m.repeatDelay=Hl(m.repeatDelay)),m.from!==void 0&&(m.keyframes[0]=m.from);let y=!1;if((m.type===!1||m.duration===0&&!m.repeatDelay)&&($C(m),m.delay===0&&(y=!0)),(wf.instantAnimations||wf.skipAnimations||i!=null&&i.shouldSkipAnimations)&&(y=!0,$C(m),m.delay=0),m.allowFlatten=!c.type&&!c.ease,y&&!a&&t.get()!==void 0){const w=ME(m.keyframes,c);if(w!==void 0){Ji.update(()=>{m.onUpdate(w),m.onComplete()});return}}return c.isSync?new F2(m):new d0e(m)};function _8(e){const t=[{},{}];return e==null||e.values.forEach((r,n)=>{t[0][n]=r.get(),t[1][n]=r.getVelocity()}),t}function t4(e,t,r,n){if(typeof t=="function"){const[i,a]=_8(n);t=t(r!==void 0?r:e.custom,i,a)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,a]=_8(n);t=t(r!==void 0?r:e.custom,i,a)}return t}function Up(e,t,r){const n=e.getProps();return t4(n,t,r!==void 0?r:n.custom,e)}const tW=new Set(["width","height","top","left","right","bottom",...Gg]),S8=30,w0e=e=>!isNaN(parseFloat(e));class N0e{constructor(t,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{var a;const i=zo.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&((a=this.events.change)==null||a.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=r.owner}setCurrent(t){this.current=t,this.updatedAt=zo.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=w0e(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,r){this.events[t]||(this.events[t]=new $T);const n=this.events[t].add(r);return t==="change"?()=>{n(),Ji.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,r=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=zo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>S8)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,S8);return bq(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(t){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=t(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,r;(t=this.dependents)==null||t.clear(),(r=this.events.destroy)==null||r.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function _g(e,t){return new N0e(e,t)}const HC=e=>Array.isArray(e);function E0e(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,_g(r))}function A0e(e){return HC(e)?e[e.length-1]||0:e}function k0e(e,t){const r=Up(e,t);let{transitionEnd:n={},transition:i={},...a}=r||{};a={...a,...n};for(const o in a){const c=A0e(a[o]);E0e(e,o,c)}}const oo=e=>!!(e&&e.getVelocity);function _0e(e){return!!(oo(e)&&e.add)}function GC(e,t){const r=e.getValue("willChange");if(_0e(r))return r.add(t);if(!r&&wf.WillChange){const n=new wf.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function r4(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const S0e="framerAppearId",rW="data-"+r4(S0e);function nW(e){return e.props[rW]}function C0e({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,n}function iW(e,t,{delay:r=0,transitionOverride:n,type:i}={}){let{transition:a,transitionEnd:o,...c}=t;const h=e.getDefaultTransition();a=a?eW(a,h):h;const f=a==null?void 0:a.reduceMotion;n&&(a=n);const m=[],y=i&&e.animationState&&e.animationState.getState()[i];for(const w in c){const A=e.getValue(w,e.latestValues[w]??null),S=c[w];if(S===void 0||y&&C0e(y,w))continue;const j={delay:r,...JT(a||{},w)},T=A.get();if(T!==void 0&&!A.isAnimating()&&!Array.isArray(S)&&S===T&&!j.velocity){Ji.update(()=>A.set(S));continue}let D=!1;if(window.MotionHandoffAnimation){const G=nW(e);if(G){const X=window.MotionHandoffAnimation(G,w,Ji);X!==null&&(j.startTime=X,D=!0)}}GC(e,w);const V=f??e.shouldReduceMotion;A.start(e4(w,A,S,V&&tW.has(w)?{type:!1}:j,e,D));const U=A.animation;U&&m.push(U)}if(o){const w=()=>Ji.update(()=>{o&&k0e(e,o)});m.length?Promise.all(m).then(w):w()}return m}function qC(e,t,r={}){var h;const n=Up(e,t,r.type==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(i=r.transitionOverride);const a=n?()=>Promise.all(iW(e,n,r)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:m=0,staggerChildren:y,staggerDirection:w}=i;return j0e(e,t,f,m,y,w,r)}:()=>Promise.resolve(),{when:c}=i;if(c){const[f,m]=c==="beforeChildren"?[a,o]:[o,a];return f().then(()=>m())}else return Promise.all([a(),o(r.delay)])}function j0e(e,t,r=0,n=0,i=0,a=1,o){const c=[];for(const h of e.variantChildren)h.notify("AnimationStart",t),c.push(qC(h,t,{...o,delay:r+(typeof n=="function"?0:n)+Zq(e.variantChildren,h,n,i,a)}).then(()=>h.notify("AnimationComplete",t)));return Promise.all(c)}function I0e(e,t,r={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const i=t.map(a=>qC(e,a,r));n=Promise.all(i)}else if(typeof t=="string")n=qC(e,t,r);else{const i=typeof t=="function"?Up(e,t,r.custom):t;n=Promise.all(iW(e,i,r))}return n.then(()=>{e.notify("AnimationComplete",t)})}const T0e={test:e=>e==="auto",parse:e=>e},sW=e=>t=>t.test(e),aW=[Hg,Br,Lu,Gh,nme,rme,T0e],C8=e=>aW.find(sW(e));function P0e(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||xq(e):!0}const O0e=new Set(["brightness","contrast","saturate","opacity"]);function R0e(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=r.match(WT)||[];if(!n)return e;const i=r.replace(n,"");let a=O0e.has(t)?1:0;return n!==r&&(a*=100),t+"("+a+i+")"}const D0e=/\b([a-z-]*)\(.*?\)/gu,WC={...Wc,getAnimatableNone:e=>{const t=e.match(D0e);return t?t.map(R0e).join(" "):e}},KC={...Wc,getAnimatableNone:e=>{const t=Wc.parse(e);return Wc.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},j8={...Hg,transform:Math.round},M0e={rotate:Gh,rotateX:Gh,rotateY:Gh,rotateZ:Gh,scale:Fv,scaleX:Fv,scaleY:Fv,scaleZ:Fv,skew:Gh,skewX:Gh,skewY:Gh,distance:Br,translateX:Br,translateY:Br,translateZ:Br,x:Br,y:Br,z:Br,perspective:Br,transformPerspective:Br,opacity:by,originX:m8,originY:m8,originZ:Br},n4={borderWidth:Br,borderTopWidth:Br,borderRightWidth:Br,borderBottomWidth:Br,borderLeftWidth:Br,borderRadius:Br,borderTopLeftRadius:Br,borderTopRightRadius:Br,borderBottomRightRadius:Br,borderBottomLeftRadius:Br,width:Br,maxWidth:Br,height:Br,maxHeight:Br,top:Br,right:Br,bottom:Br,left:Br,inset:Br,insetBlock:Br,insetBlockStart:Br,insetBlockEnd:Br,insetInline:Br,insetInlineStart:Br,insetInlineEnd:Br,padding:Br,paddingTop:Br,paddingRight:Br,paddingBottom:Br,paddingLeft:Br,paddingBlock:Br,paddingBlockStart:Br,paddingBlockEnd:Br,paddingInline:Br,paddingInlineStart:Br,paddingInlineEnd:Br,margin:Br,marginTop:Br,marginRight:Br,marginBottom:Br,marginLeft:Br,marginBlock:Br,marginBlockStart:Br,marginBlockEnd:Br,marginInline:Br,marginInlineStart:Br,marginInlineEnd:Br,fontSize:Br,backgroundPositionX:Br,backgroundPositionY:Br,...M0e,zIndex:j8,fillOpacity:by,strokeOpacity:by,numOctaves:j8},L0e={...n4,color:ca,backgroundColor:ca,outlineColor:ca,fill:ca,stroke:ca,borderColor:ca,borderTopColor:ca,borderRightColor:ca,borderBottomColor:ca,borderLeftColor:ca,filter:WC,WebkitFilter:WC,mask:KC,WebkitMask:KC},oW=e=>L0e[e],U0e=new Set([WC,KC]);function lW(e,t){let r=oW(e);return U0e.has(r)||(r=Wc),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const B0e=new Set(["auto","none","0"]);function z0e(e,t,r){let n=0,i;for(;n{t.getValue(h).set(f)}),this.resolveNoneKeyframes()}}function cW(e,t,r){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let n=document;const i=(r==null?void 0:r[e])??n.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(n=>n!=null)}const uW=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Vw(e){return gq(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:i4}=Iq(queueMicrotask,!1),Lc={x:!1,y:!1};function dW(){return Lc.x||Lc.y}function F0e(e){return e==="x"||e==="y"?Lc[e]?null:(Lc[e]=!0,()=>{Lc[e]=!1}):Lc.x||Lc.y?null:(Lc.x=Lc.y=!0,()=>{Lc.x=Lc.y=!1})}function hW(e,t){const r=cW(e),n=new AbortController,i={passive:!0,...t,signal:n.signal};return[r,i,()=>n.abort()]}function $0e(e){return!(e.pointerType==="touch"||dW())}function H0e(e,t,r={}){const[n,i,a]=hW(e,r);return n.forEach(o=>{let c=!1,h=!1,f;const m=()=>{o.removeEventListener("pointerleave",S)},y=T=>{f&&(f(T),f=void 0),m()},w=T=>{c=!1,window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),h&&(h=!1,y(T))},A=()=>{c=!0,window.addEventListener("pointerup",w,i),window.addEventListener("pointercancel",w,i)},S=T=>{if(T.pointerType!=="touch"){if(c){h=!0;return}y(T)}},j=T=>{if(!$0e(T))return;h=!1;const D=t(o,T);typeof D=="function"&&(f=D,o.addEventListener("pointerleave",S,i))};o.addEventListener("pointerenter",j,i),o.addEventListener("pointerdown",A,i)}),a}const fW=(e,t)=>t?e===t?!0:fW(e,t.parentElement):!1,s4=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,G0e=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function q0e(e){return G0e.has(e.tagName)||e.isContentEditable===!0}const W0e=new Set(["INPUT","SELECT","TEXTAREA"]);function K0e(e){return W0e.has(e.tagName)||e.isContentEditable===!0}const Fw=new WeakSet;function I8(e){return t=>{t.key==="Enter"&&e(t)}}function Ak(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Y0e=(e,t)=>{const r=e.currentTarget;if(!r)return;const n=I8(()=>{if(Fw.has(r))return;Ak(r,"down");const i=I8(()=>{Ak(r,"up")}),a=()=>Ak(r,"cancel");r.addEventListener("keyup",i,t),r.addEventListener("blur",a,t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)};function T8(e){return s4(e)&&!dW()}const P8=new WeakSet;function X0e(e,t,r={}){const[n,i,a]=hW(e,r),o=c=>{const h=c.currentTarget;if(!T8(c)||P8.has(c))return;Fw.add(h),r.stopPropagation&&P8.add(c);const f=t(h,c),m=(A,S)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",w),Fw.has(h)&&Fw.delete(h),T8(A)&&typeof f=="function"&&f(A,{success:S})},y=A=>{m(A,h===window||h===document||r.useGlobalTarget||fW(h,A.target))},w=A=>{m(A,!1)};window.addEventListener("pointerup",y,i),window.addEventListener("pointercancel",w,i)};return n.forEach(c=>{(r.useGlobalTarget?window:c).addEventListener("pointerdown",o,i),Vw(c)&&(c.addEventListener("focus",f=>Y0e(f,i)),!q0e(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),a}function a4(e){return gq(e)&&"ownerSVGElement"in e}const $w=new WeakMap;let qh;const pW=(e,t,r)=>(n,i)=>i&&i[0]?i[0][e+"Size"]:a4(n)&&"getBBox"in n?n.getBBox()[t]:n[r],Q0e=pW("inline","width","offsetWidth"),Z0e=pW("block","height","offsetHeight");function J0e({target:e,borderBoxSize:t}){var r;(r=$w.get(e))==null||r.forEach(n=>{n(e,{get width(){return Q0e(e,t)},get height(){return Z0e(e,t)}})})}function ege(e){e.forEach(J0e)}function tge(){typeof ResizeObserver>"u"||(qh=new ResizeObserver(ege))}function rge(e,t){qh||tge();const r=cW(e);return r.forEach(n=>{let i=$w.get(n);i||(i=new Set,$w.set(n,i)),i.add(t),qh==null||qh.observe(n)}),()=>{r.forEach(n=>{const i=$w.get(n);i==null||i.delete(t),i!=null&&i.size||qh==null||qh.unobserve(n)})}}const Hw=new Set;let B0;function nge(){B0=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Hw.forEach(t=>t(e))},window.addEventListener("resize",B0)}function ige(e){return Hw.add(e),B0||nge(),()=>{Hw.delete(e),!Hw.size&&typeof B0=="function"&&(window.removeEventListener("resize",B0),B0=void 0)}}function O8(e,t){return typeof e=="function"?ige(e):rge(e,t)}function sge(e){return a4(e)&&e.tagName==="svg"}const age=[...aW,ca,Wc],oge=e=>age.find(sW(e)),R8=()=>({translate:0,scale:1,origin:0,originPoint:0}),z0=()=>({x:R8(),y:R8()}),D8=()=>({min:0,max:0}),wa=()=>({x:D8(),y:D8()}),lge=new WeakMap;function LE(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function vy(e){return typeof e=="string"||Array.isArray(e)}const o4=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],l4=["initial",...o4];function UE(e){return LE(e.animate)||l4.some(t=>vy(e[t]))}function mW(e){return!!(UE(e)||e.variants)}function cge(e,t,r){for(const n in t){const i=t[n],a=r[n];if(oo(i))e.addValue(n,i);else if(oo(a))e.addValue(n,_g(i,{owner:e}));else if(a!==i)if(e.hasValue(n)){const o=e.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(n);e.addValue(n,_g(o!==void 0?o:i,{owner:e}))}}for(const n in r)t[n]===void 0&&e.removeValue(n);return t}const YC={current:null},gW={current:!1},uge=typeof window<"u";function dge(){if(gW.current=!0,!!uge)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>YC.current=e.matches;e.addEventListener("change",t),t()}else YC.current=!1}const M8=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let $2={};function xW(e){$2=e}function hge(){return $2}class fge{scrapeMotionValuesFromProps(t,r,n){return{}}constructor({parent:t,props:r,presenceContext:n,reducedMotionConfig:i,skipAnimations:a,blockInitialAnimation:o,visualState:c},h={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=ZT,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const A=zo.now();this.renderScheduledAtthis.bindToMotionValue(a,i)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(gW.current||dge(),this.shouldReduceMotion=YC.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),Nf(this.notifyUpdate),Nf(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const r in this.events)this.events[r].clear();for(const r in this.features){const n=this.features[r];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,r){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),r.accelerate&&Qq.has(t)&&this.current instanceof HTMLElement){const{factory:o,keyframes:c,times:h,ease:f,duration:m}=r.accelerate,y=new Yq({element:this.current,name:t,keyframes:c,times:h,ease:f,duration:Hl(m)}),w=o(y);this.valueSubscriptions.set(t,()=>{w(),y.cancel()});return}const n=qg.has(t);n&&this.onBindTransform&&this.onBindTransform();const i=r.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&Ji.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{i(),a&&a(),r.owner&&r.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in $2){const r=$2[t];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[t]&&i&&n(this.props)&&(this.features[t]=new i(this)),this.features[t]){const a=this.features[t];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):wa()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(t)}addValue(t,r){const n=this.values.get(t);r!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return n===void 0&&r!==void 0&&(n=_g(r===null?void 0:r,{owner:this}),this.addValue(t,n)),n}readValue(t,r){let n=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return n!=null&&(typeof n=="string"&&(mq(n)||xq(n))?n=parseFloat(n):!oge(n)&&Wc.test(r)&&(n=lW(t,r)),this.setBaseTarget(t,oo(n)?n.get():n)),oo(n)?n.get():n}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var a;const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const o=t4(this.props,r,(a=this.presenceContext)==null?void 0:a.custom);o&&(n=o[t])}if(r&&n!==void 0)return n;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!oo(i)?i:this.initialValues[t]!==void 0&&n===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new $T),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){i4.render(this.render)}}class yW extends fge{constructor(){super(...arguments),this.KeyframeResolver=V0e}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){const n=t.style;return n?n[r]:void 0}removeValueFromRenderState(t,{vars:r,style:n}){delete r[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;oo(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class Of{constructor(t){this.isMounted=!1,this.node=t}update(){}}function bW({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function pge({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function mge(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function kk(e){return e===void 0||e===1}function XC({scale:e,scaleX:t,scaleY:r}){return!kk(e)||!kk(t)||!kk(r)}function lp(e){return XC(e)||vW(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function vW(e){return L8(e.x)||L8(e.y)}function L8(e){return e&&e!=="0%"}function H2(e,t,r){const n=e-r,i=t*n;return r+i}function U8(e,t,r,n,i){return i!==void 0&&(e=H2(e,i,n)),H2(e,r,n)+t}function QC(e,t=0,r=1,n,i){e.min=U8(e.min,t,r,n,i),e.max=U8(e.max,t,r,n,i)}function wW(e,{x:t,y:r}){QC(e.x,t.translate,t.scale,t.originPoint),QC(e.y,r.translate,r.scale,r.originPoint)}const B8=.999999999999,z8=1.0000000000001;function gge(e,t,r,n=!1){var c;const i=r.length;if(!i)return;t.x=t.y=1;let a,o;for(let h=0;hB8&&(t.x=1),t.yB8&&(t.y=1)}function ku(e,t){e.min+=t,e.max+=t}function V8(e,t,r,n,i=.5){const a=gs(e.min,e.max,i);QC(e,t,r,a,n)}function F8(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Gw(e,t,r){const n=r??e;V8(e.x,F8(t.x,n.x),t.scaleX,t.scale,t.originX),V8(e.y,F8(t.y,n.y),t.scaleY,t.scale,t.originY)}function NW(e,t){return bW(mge(e.getBoundingClientRect(),t))}function xge(e,t,r){const n=NW(e,r),{scroll:i}=t;return i&&(ku(n.x,i.offset.x),ku(n.y,i.offset.y)),n}const yge={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},bge=Gg.length;function vge(e,t,r){let n="",i=!0;for(let a=0;a{if(!t.target)return e;if(typeof e=="string")if(Br.test(e))e=parseFloat(e);else return e;const r=$8(e,t.target.x),n=$8(e,t.target.y);return`${r}% ${n}%`}},wge={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,i=Wc.parse(e);if(i.length>5)return n;const a=Wc.createTransformer(e),o=typeof i[0]!="number"?1:0,c=r.x.scale*t.x,h=r.y.scale*t.y;i[0+o]/=c,i[1+o]/=h;const f=gs(c,h,.5);return typeof i[2+o]=="number"&&(i[2+o]/=f),typeof i[3+o]=="number"&&(i[3+o]/=f),a(i)}},ZC={borderRadius:{...t1,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:t1,borderTopRightRadius:t1,borderBottomLeftRadius:t1,borderBottomRightRadius:t1,boxShadow:wge};function AW(e,{layout:t,layoutId:r}){return qg.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!ZC[e]||e==="opacity")}function u4(e,t,r){var o;const n=e.style,i=t==null?void 0:t.style,a={};if(!n)return a;for(const c in n)(oo(n[c])||i&&oo(i[c])||AW(c,e)||((o=r==null?void 0:r.getValue(c))==null?void 0:o.liveStyle)!==void 0)&&(a[c]=n[c]);return a}function Nge(e){return window.getComputedStyle(e)}class Ege extends yW{constructor(){super(...arguments),this.type="html",this.renderInstance=EW}readValueFromInstance(t,r){var n;if(qg.has(r))return(n=this.projection)!=null&&n.isProjecting?UC(r):$me(t,r);{const i=Nge(t),a=(Pq(r)?i.getPropertyValue(r):i[r])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:r}){return NW(t,r)}build(t,r,n){c4(t,r,n.transformTemplate)}scrapeMotionValuesFromProps(t,r,n){return u4(t,r,n)}}const Age={offset:"stroke-dashoffset",array:"stroke-dasharray"},kge={offset:"strokeDashoffset",array:"strokeDasharray"};function _ge(e,t,r=1,n=0,i=!0){e.pathLength=1;const a=i?Age:kge;e[a.offset]=`${-n}`,e[a.array]=`${t} ${r}`}const Sge=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function kW(e,{attrX:t,attrY:r,attrScale:n,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...c},h,f,m){if(c4(e,c,f),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:y,style:w}=e;y.transform&&(w.transform=y.transform,delete y.transform),(w.transform||y.transformOrigin)&&(w.transformOrigin=y.transformOrigin??"50% 50%",delete y.transformOrigin),w.transform&&(w.transformBox=(m==null?void 0:m.transformBox)??"fill-box",delete y.transformBox);for(const A of Sge)y[A]!==void 0&&(w[A]=y[A],delete y[A]);t!==void 0&&(y.x=t),r!==void 0&&(y.y=r),n!==void 0&&(y.scale=n),i!==void 0&&_ge(y,i,a,o,!1)}const _W=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),SW=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Cge(e,t,r,n){EW(e,t,void 0,n);for(const i in t.attrs)e.setAttribute(_W.has(i)?i:r4(i),t.attrs[i])}function CW(e,t,r){const n=u4(e,t,r);for(const i in e)if(oo(e[i])||oo(t[i])){const a=Gg.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[a]=e[i]}return n}class jge extends yW{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=wa}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(qg.has(r)){const n=oW(r);return n&&n.default||0}return r=_W.has(r)?r:r4(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,n){return CW(t,r,n)}build(t,r,n){kW(t,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,r,n,i){Cge(t,r,n,i)}mount(t){this.isSVGTag=SW(t.tagName),super.mount(t)}}const Ige=l4.length;function jW(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?jW(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;rPromise.all(t.map(({animation:r,options:n})=>I0e(e,r,n)))}function Rge(e){let t=Oge(e),r=H8(),n=!0,i=!1;const a=f=>(m,y)=>{var A;const w=Up(e,y,f==="exit"?(A=e.presenceContext)==null?void 0:A.custom:void 0);if(w){const{transition:S,transitionEnd:j,...T}=w;m={...m,...T,...j}}return m};function o(f){t=f(e)}function c(f){const{props:m}=e,y=jW(e.parent)||{},w=[],A=new Set;let S={},j=1/0;for(let D=0;Dj&&X,$=!1;const J=Array.isArray(G)?G:[G];let Q=J.reduce(a(V),{});q===!1&&(Q={});const{prevResolvedValues:K={}}=U,me={...K,...Q},re=je=>{F=!0,A.has(je)&&($=!0,A.delete(je)),U.needsAnimating[je]=!0;const Ve=e.getValue(je);Ve&&(Ve.liveStyle=!1)};for(const je in me){const Ve=Q[je],Z=K[je];if(S.hasOwnProperty(je))continue;let se=!1;HC(Ve)&&HC(Z)?se=!IW(Ve,Z):se=Ve!==Z,se?Ve!=null?re(je):A.add(je):Ve!==void 0&&A.has(je)?re(je):U.protectedKeys[je]=!0}U.prevProp=G,U.prevResolvedValues=Q,U.isActive&&(S={...S,...Q}),(n||i)&&e.blockInitialAnimation&&(F=!1);const le=B&&z;F&&(!le||$)&&w.push(...J.map(je=>{const Ve={type:V};if(typeof je=="string"&&(n||i)&&!le&&e.manuallyAnimateOnMount&&e.parent){const{parent:Z}=e,se=Up(Z,je);if(Z.enteringChildren&&se){const{delayChildren:xe}=se.transition||{};Ve.delay=Zq(Z.enteringChildren,e,xe)}}return{animation:je,options:Ve}}))}if(A.size){const D={};if(typeof m.initial!="boolean"){const V=Up(e,Array.isArray(m.initial)?m.initial[0]:m.initial);V&&V.transition&&(D.transition=V.transition)}A.forEach(V=>{const U=e.getBaseTarget(V),G=e.getValue(V);G&&(G.liveStyle=!0),D[V]=U??null}),w.push({animation:D})}let T=!!w.length;return n&&(m.initial===!1||m.initial===m.animate)&&!e.manuallyAnimateOnMount&&(T=!1),n=!1,i=!1,T?t(w):Promise.resolve()}function h(f,m){var w;if(r[f].isActive===m)return Promise.resolve();(w=e.variantChildren)==null||w.forEach(A=>{var S;return(S=A.animationState)==null?void 0:S.setActive(f,m)}),r[f].isActive=m;const y=c(f);for(const A in r)r[A].protectedKeys={};return y}return{animateChanges:c,setActive:h,setAnimateFunction:o,getState:()=>r,reset:()=>{r=H8(),i=!0}}}function Dge(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!IW(t,e):!1}function Jf(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function H8(){return{animate:Jf(!0),whileInView:Jf(),whileHover:Jf(),whileTap:Jf(),whileDrag:Jf(),whileFocus:Jf(),exit:Jf()}}function JC(e,t){e.min=t.min,e.max=t.max}function Dc(e,t){JC(e.x,t.x),JC(e.y,t.y)}function G8(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const TW=1e-4,Mge=1-TW,Lge=1+TW,PW=.01,Uge=0-PW,Bge=0+PW;function Vo(e){return e.max-e.min}function zge(e,t,r){return Math.abs(e-t)<=r}function q8(e,t,r,n=.5){e.origin=n,e.originPoint=gs(t.min,t.max,e.origin),e.scale=Vo(r)/Vo(t),e.translate=gs(r.min,r.max,e.origin)-e.originPoint,(e.scale>=Mge&&e.scale<=Lge||isNaN(e.scale))&&(e.scale=1),(e.translate>=Uge&&e.translate<=Bge||isNaN(e.translate))&&(e.translate=0)}function W1(e,t,r,n){q8(e.x,t.x,r.x,n?n.originX:void 0),q8(e.y,t.y,r.y,n?n.originY:void 0)}function W8(e,t,r,n=0){const i=n?gs(r.min,r.max,n):r.min;e.min=i+t.min,e.max=e.min+Vo(t)}function Vge(e,t,r,n){W8(e.x,t.x,r.x,n==null?void 0:n.x),W8(e.y,t.y,r.y,n==null?void 0:n.y)}function K8(e,t,r,n=0){const i=n?gs(r.min,r.max,n):r.min;e.min=t.min-i,e.max=e.min+Vo(t)}function G2(e,t,r,n){K8(e.x,t.x,r.x,n==null?void 0:n.x),K8(e.y,t.y,r.y,n==null?void 0:n.y)}function Y8(e,t,r,n,i){return e-=t,e=H2(e,1/r,n),i!==void 0&&(e=H2(e,1/i,n)),e}function Fge(e,t=0,r=1,n=.5,i,a=e,o=e){if(Lu.test(t)&&(t=parseFloat(t),t=gs(o.min,o.max,t/100)-o.min),typeof t!="number")return;let c=gs(a.min,a.max,n);e===a&&(c-=t),e.min=Y8(e.min,t,r,c,i),e.max=Y8(e.max,t,r,c,i)}function X8(e,t,[r,n,i],a,o){Fge(e,t[r],t[n],t[i],t.scale,a,o)}const $ge=["x","scaleX","originX"],Hge=["y","scaleY","originY"];function Q8(e,t,r,n){X8(e.x,t,$ge,r?r.x:void 0,n?n.x:void 0),X8(e.y,t,Hge,r?r.y:void 0,n?n.y:void 0)}function Z8(e){return e.translate===0&&e.scale===1}function OW(e){return Z8(e.x)&&Z8(e.y)}function J8(e,t){return e.min===t.min&&e.max===t.max}function Gge(e,t){return J8(e.x,t.x)&&J8(e.y,t.y)}function eM(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function RW(e,t){return eM(e.x,t.x)&&eM(e.y,t.y)}function tM(e){return Vo(e.x)/Vo(e.y)}function rM(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function bu(e){return[e("x"),e("y")]}function qge(e,t,r){let n="";const i=e.x.translate/t.x,a=e.y.translate/t.y,o=(r==null?void 0:r.z)||0;if((i||a||o)&&(n=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:f,rotate:m,rotateX:y,rotateY:w,skewX:A,skewY:S}=r;f&&(n=`perspective(${f}px) ${n}`),m&&(n+=`rotate(${m}deg) `),y&&(n+=`rotateX(${y}deg) `),w&&(n+=`rotateY(${w}deg) `),A&&(n+=`skewX(${A}deg) `),S&&(n+=`skewY(${S}deg) `)}const c=e.x.scale*t.x,h=e.y.scale*t.y;return(c!==1||h!==1)&&(n+=`scale(${c}, ${h})`),n||"none"}const DW=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],Wge=DW.length,nM=e=>typeof e=="string"?parseFloat(e):e,iM=e=>typeof e=="number"||Br.test(e);function Kge(e,t,r,n,i,a){i?(e.opacity=gs(0,r.opacity??1,Yge(n)),e.opacityExit=gs(t.opacity??1,0,Xge(n))):a&&(e.opacity=gs(t.opacity??1,r.opacity??1,n));for(let o=0;ont?1:r(yy(e,t,n))}function Qge(e,t,r){const n=oo(e)?e:_g(e);return n.start(e4("",n,t,r)),n.animation}function wy(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}const Zge=(e,t)=>e.depth-t.depth;class Jge{constructor(){this.children=[],this.isDirty=!1}add(t){VT(this.children,t),this.isDirty=!0}remove(t){U2(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Zge),this.isDirty=!1,this.children.forEach(t)}}function exe(e,t){const r=zo.now(),n=({timestamp:i})=>{const a=i-r;a>=t&&(Nf(n),e(a-t))};return Ji.setup(n,!0),()=>Nf(n)}function qw(e){return oo(e)?e.get():e}class txe{constructor(){this.members=[]}add(t){VT(this.members,t);for(let r=this.members.length-1;r>=0;r--){const n=this.members[r];if(n===t||n===this.lead||n===this.prevLead)continue;const i=n.instance;(!i||i.isConnected===!1)&&!n.snapshot&&(U2(this.members,n),n.unmount())}t.scheduleRender()}remove(t){if(U2(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){var r;for(let n=this.members.indexOf(t)-1;n>=0;n--){const i=this.members[n];if(i.isPresent!==!1&&((r=i.instance)==null?void 0:r.isConnected)!==!1)return this.promote(i),!0}return!1}promote(t,r){var i;const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.updateSnapshot(),t.scheduleRender();const{layoutDependency:a}=n.options,{layoutDependency:o}=t.options;(a===void 0||a!==o)&&(t.resumeFrom=n,r&&(n.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),(i=t.root)!=null&&i.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var r,n,i,a,o;(n=(r=t.options).onExitComplete)==null||n.call(r),(o=(i=t.resumingFrom)==null?void 0:(a=i.options).onExitComplete)==null||o.call(a)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const Ww={hasAnimatedSinceResize:!0,hasEverUpdated:!1},_k=["","X","Y","Z"],rxe=1e3;let nxe=0;function Sk(e,t,r,n){const{latestValues:i}=t;i[e]&&(r[e]=i[e],t.setStaticValue(e,0),n&&(n[e]=0))}function LW(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=nW(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",Ji,!(i||a))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&LW(n)}function UW({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},c=t==null?void 0:t()){this.id=nxe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(axe),this.nodes.forEach(hxe),this.nodes.forEach(fxe),this.nodes.forEach(oxe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let h=0;hthis.root.updateBlockedByResize=!1;Ji.read(()=>{y=window.innerWidth}),e(o,()=>{const A=window.innerWidth;A!==y&&(y=A,this.root.updateBlockedByResize=!0,m&&m(),m=exe(w,250),Ww.hasAnimatedSinceResize&&(Ww.hasAnimatedSinceResize=!1,this.nodes.forEach(lM)))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&f&&(c||h)&&this.addEventListener("didUpdate",({delta:m,hasLayoutChanged:y,hasRelativeLayoutChanged:w,layout:A})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||f.getDefaultTransition()||yxe,{onLayoutAnimationStart:j,onLayoutAnimationComplete:T}=f.getProps(),D=!this.targetLayout||!RW(this.targetLayout,A),V=!y&&w;if(this.options.layoutRoot||this.resumeFrom||V||y&&(D||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const U={...JT(S,"layout"),onPlay:j,onComplete:T};(f.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U),this.setAnimationOrigin(m,V)}else y||lM(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=A})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Nf(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pxe),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&LW(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let m=0;m{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Vo(this.snapshot.measuredBox.x)&&!Vo(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h{const X=G/1e3;cM(y.x,o.x,X),cM(y.y,o.y,X),this.setTargetDelta(y),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(G2(w,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),gxe(this.relativeTarget,this.relativeTargetOrigin,w,X),U&&Gge(this.relativeTarget,U)&&(this.isProjectionDirty=!1),U||(U=wa()),Dc(U,this.relativeTarget)),j&&(this.animationValues=m,Kge(m,f,this.latestValues,X,V,D)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=X},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var c,h,f;this.notifyListeners("animationStart"),(c=this.currentAnimation)==null||c.stop(),(f=(h=this.resumingFrom)==null?void 0:h.currentAnimation)==null||f.stop(),this.pendingAnimation&&(Nf(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ji.update(()=>{Ww.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=_g(0)),this.motionValue.jump(0,!1),this.currentAnimation=Qge(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:m=>{this.mixTargetDelta(m),o.onUpdate&&o.onUpdate(m)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(rxe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:c,target:h,layout:f,latestValues:m}=o;if(!(!c||!h||!f)){if(this!==o&&this.layout&&f&&BW(this.options.animationType,this.layout.layoutBox,f.layoutBox)){h=this.target||wa();const y=Vo(this.layout.layoutBox.x);h.x.min=o.target.x.min,h.x.max=h.x.min+y;const w=Vo(this.layout.layoutBox.y);h.y.min=o.target.y.min,h.y.max=h.y.min+w}Dc(c,h),Gw(c,m),W1(this.projectionDeltaWithTransform,this.layoutCorrected,c,m)}}registerSharedNode(o,c){this.sharedNodes.has(o)||this.sharedNodes.set(o,new txe),this.sharedNodes.get(o).add(c);const f=c.options.initialPromotionConfig;c.promote({transition:f?f.transition:void 0,preserveFollowOpacity:f&&f.shouldPreserveFollowOpacity?f.shouldPreserveFollowOpacity(c):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var c;const{layoutId:o}=this.options;return o?((c=this.getStack())==null?void 0:c.lead)||this:this}getPrevLead(){var c;const{layoutId:o}=this.options;return o?(c=this.getStack())==null?void 0:c.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:c,preserveFollowOpacity:h}={}){const f=this.getStack();f&&f.promote(this,h),o&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let c=!1;const{latestValues:h}=o;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(c=!0),!c)return;const f={};h.z&&Sk("z",o,f,this.animationValues);for(let m=0;m<_k.length;m++)Sk(`rotate${_k[m]}`,o,f,this.animationValues),Sk(`skew${_k[m]}`,o,f,this.animationValues);o.render();for(const m in f)o.setStaticValue(m,f[m]),this.animationValues&&(this.animationValues[m]=f[m]);o.scheduleRender()}applyProjectionStyles(o,c){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=qw(c==null?void 0:c.pointerEvents)||"",o.transform=h?h(this.latestValues,""):"none";return}const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=qw(c==null?void 0:c.pointerEvents)||""),this.hasProjected&&!lp(this.latestValues)&&(o.transform=h?h({},""):"none",this.hasProjected=!1);return}o.visibility="";const m=f.animationValues||f.latestValues;this.applyTransformsToTarget();let y=qge(this.projectionDeltaWithTransform,this.treeScale,m);h&&(y=h(m,y)),o.transform=y;const{x:w,y:A}=this.projectionDelta;o.transformOrigin=`${w.origin*100}% ${A.origin*100}% 0`,f.animationValues?o.opacity=f===this?m.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:m.opacityExit:o.opacity=f===this?m.opacity!==void 0?m.opacity:"":m.opacityExit!==void 0?m.opacityExit:0;for(const S in ZC){if(m[S]===void 0)continue;const{correct:j,applyTo:T,isCSSVariable:D}=ZC[S],V=y==="none"?m[S]:j(m[S],f);if(T){const U=T.length;for(let G=0;G{var c;return(c=o.currentAnimation)==null?void 0:c.stop()}),this.root.nodes.forEach(aM),this.root.sharedNodes.clear()}}}function ixe(e){e.updateLayout()}function sxe(e){var r;const t=((r=e.resumeFrom)==null?void 0:r.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=e.layout,{animationType:a}=e.options,o=t.source!==e.layout.source;if(a==="size")bu(y=>{const w=o?t.measuredBox[y]:t.layoutBox[y],A=Vo(w);w.min=n[y].min,w.max=w.min+A});else if(a==="x"||a==="y"){const y=a==="x"?"y":"x";JC(o?t.measuredBox[y]:t.layoutBox[y],n[y])}else BW(a,t.layoutBox,n)&&bu(y=>{const w=o?t.measuredBox[y]:t.layoutBox[y],A=Vo(n[y]);w.max=w.min+A,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[y].max=e.relativeTarget[y].min+A)});const c=z0();W1(c,n,t.layoutBox);const h=z0();o?W1(h,e.applyTransform(i,!0),t.measuredBox):W1(h,n,t.layoutBox);const f=!OW(c);let m=!1;if(!e.resumeFrom){const y=e.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:w,layout:A}=y;if(w&&A){const S=e.options.layoutAnchor||void 0,j=wa();G2(j,t.layoutBox,w.layoutBox,S);const T=wa();G2(T,n,A.layoutBox,S),RW(j,T)||(m=!0),y.options.layoutRoot&&(e.relativeTarget=T,e.relativeTargetOrigin=j,e.relativeParent=y)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:h,layoutDelta:c,hasLayoutChanged:f,hasRelativeLayoutChanged:m})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function axe(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function oxe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function lxe(e){e.clearSnapshot()}function aM(e){e.clearMeasurements()}function cxe(e){e.isLayoutDirty=!0,e.updateLayout()}function oM(e){e.isLayoutDirty=!1}function uxe(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function dxe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function lM(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function hxe(e){e.resolveTargetDelta()}function fxe(e){e.calcProjection()}function pxe(e){e.resetSkewAndRotation()}function mxe(e){e.removeLeadSnapshot()}function cM(e,t,r){e.translate=gs(t.translate,0,r),e.scale=gs(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function uM(e,t,r,n){e.min=gs(t.min,r.min,n),e.max=gs(t.max,r.max,n)}function gxe(e,t,r,n){uM(e.x,t.x,r.x,n),uM(e.y,t.y,r.y,n)}function xxe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const yxe={duration:.45,ease:[.4,0,.1,1]},dM=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),hM=dM("applewebkit/")&&!dM("chrome/")?Math.round:vc;function fM(e){e.min=hM(e.min),e.max=hM(e.max)}function bxe(e){fM(e.x),fM(e.y)}function BW(e,t,r){return e==="position"||e==="preserve-aspect"&&!zge(tM(t),tM(r),.2)}function vxe(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const wxe=UW({attachResizeListener:(e,t)=>wy(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Ck={current:void 0},zW=UW({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Ck.current){const e=new wxe({});e.mount(window),e.setOptions({layoutScroll:!0}),Ck.current=e}return Ck.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),d4=I.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function pM(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Nxe(...e){return t=>{let r=!1;const n=e.map(i=>{const a=pM(i,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let i=0;i{const{width:A,height:S,top:j,left:T,right:D,bottom:V}=h.current;if(t||a===!1||!c.current||!A||!S)return;const U=r==="left"?`left: ${T}`:`right: ${D}`,G=n==="bottom"?`bottom: ${V}`:`top: ${j}`;c.current.dataset.motionPopId=o;const X=document.createElement("style");f&&(X.nonce=f);const q=i??document.head;return q.appendChild(X),X.sheet&&X.sheet.insertRule(` [data-motion-pop-id="${o}"] { position: absolute !important; width: ${A}px !important; height: ${S}px !important; ${U}px !important; ${G}px !important; } `),()=>{var B;(B=c.current)==null||B.removeAttribute("data-motion-pop-id"),q.contains(X)&&q.removeChild(X)}},[t]),s.jsx(Axe,{isPresent:t,childRef:c,sizeRef:h,pop:a,children:a===!1?e:I.cloneElement(e,{ref:y})})}const _xe=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:a,mode:o,anchorX:c,anchorY:h,root:f})=>{const m=zT(Sxe),y=I.useId();let w=!0,A=I.useMemo(()=>(w=!1,{id:y,initial:t,isPresent:r,custom:i,onExitComplete:S=>{m.set(S,!0);for(const j of m.values())if(!j)return;n&&n()},register:S=>(m.set(S,!1),()=>m.delete(S))}),[r,m,n]);return a&&w&&(A={...A}),I.useMemo(()=>{m.forEach((S,j)=>m.set(j,!1))},[r]),I.useEffect(()=>{!r&&!m.size&&n&&n()},[r]),e=s.jsx(kxe,{pop:o==="popLayout",isPresent:r,anchorX:c,anchorY:h,root:f,children:e}),s.jsx(DE.Provider,{value:A,children:e})};function Sxe(){return new Map}function VW(e=!0){const t=I.useContext(DE);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:i}=t,a=I.useId();I.useEffect(()=>{if(e)return i(a)},[e]);const o=I.useCallback(()=>e&&n&&n(a),[a,n,e]);return!r&&n?[!1,o]:[!0]}const $v=e=>e.key||"";function mM(e){const t=[];return I.Children.forEach(e,r=>{I.isValidElement(r)&&t.push(r)}),t}const on=({children:e,custom:t,initial:r=!0,onExitComplete:n,presenceAffectsLayout:i=!0,mode:a="sync",propagate:o=!1,anchorX:c="left",anchorY:h="top",root:f})=>{const[m,y]=VW(o),w=I.useMemo(()=>mM(e),[e]),A=o&&!m?[]:w.map($v),S=I.useRef(!0),j=I.useRef(w),T=zT(()=>new Map),D=I.useRef(new Set),[V,U]=I.useState(w),[G,X]=I.useState(w);pq(()=>{S.current=!1,j.current=w;for(let z=0;z{const F=$v(z),$=o&&!m?!1:w===G||A.includes(F),J=()=>{if(D.current.has(F))return;if(T.has(F))D.current.add(F),T.set(F,!0);else return;let Q=!0;T.forEach(K=>{K||(Q=!1)}),Q&&(B==null||B(),X(j.current),o&&(y==null||y()),n&&n())};return s.jsx(_xe,{isPresent:$,initial:!S.current||r?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:f,onExitComplete:$?void 0:J,anchorX:c,anchorY:h,children:z},F)})})},FW=I.createContext({strict:!1}),gM={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let xM=!1;function Cxe(){if(xM)return;const e={};for(const t in gM)e[t]={isEnabled:r=>gM[t].some(n=>!!r[n])};xW(e),xM=!0}function $W(){return Cxe(),hge()}function jxe(e){const t=$W();for(const r in e)t[r]={...t[r],...e[r]};xW(t)}const Ixe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function q2(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Ixe.has(e)}let HW=e=>!q2(e);function Txe(e){typeof e=="function"&&(HW=t=>t.startsWith("on")?!q2(t):e(t))}try{Txe(require("@emotion/is-prop-valid").default)}catch{}function Pxe(e,t,r){const n={};for(const i in e)i==="values"&&typeof e.values=="object"||oo(e[i])||(HW(i)||r===!0&&q2(i)||!t&&!q2(i)||e.draggable&&i.startsWith("onDrag"))&&(n[i]=e[i]);return n}const BE=I.createContext({});function Oxe(e,t){if(UE(e)){const{initial:r,animate:n}=e;return{initial:r===!1||vy(r)?r:void 0,animate:vy(n)?n:void 0}}return e.inherit!==!1?t:{}}function Rxe(e){const{initial:t,animate:r}=Oxe(e,I.useContext(BE));return I.useMemo(()=>({initial:t,animate:r}),[yM(t),yM(r)])}function yM(e){return Array.isArray(e)?e.join(" "):e}const h4=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function GW(e,t,r){for(const n in t)!oo(t[n])&&!AW(n,r)&&(e[n]=t[n])}function Dxe({transformTemplate:e},t){return I.useMemo(()=>{const r=h4();return c4(r,t,e),Object.assign({},r.vars,r.style)},[t])}function Mxe(e,t){const r=e.style||{},n={};return GW(n,r,e),Object.assign(n,Dxe(e,t)),n}function Lxe(e,t){const r={},n=Mxe(e,t);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r}const qW=()=>({...h4(),attrs:{}});function Uxe(e,t,r,n){const i=I.useMemo(()=>{const a=qW();return kW(a,t,SW(n),e.transformTemplate,e.style),{...a.attrs,style:{...a.style}}},[t]);if(e.style){const a={};GW(a,e.style,e),i.style={...a,...i.style}}return i}const Bxe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function f4(e){return typeof e!="string"||e.includes("-")?!1:!!(Bxe.indexOf(e)>-1||/[A-Z]/u.test(e))}function zxe(e,t,r,{latestValues:n},i,a=!1,o){const h=(o??f4(e)?Uxe:Lxe)(t,n,i,e),f=Pxe(t,typeof e=="string",a),m=e!==I.Fragment?{...f,...h,ref:r}:{},{children:y}=t,w=I.useMemo(()=>oo(y)?y.get():y,[y]);return I.createElement(e,{...m,children:w})}function Vxe({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,i){return{latestValues:Fxe(r,n,i,e),renderState:t()}}function Fxe(e,t,r,n){const i={},a=n(e,{});for(const w in a)i[w]=qw(a[w]);let{initial:o,animate:c}=e;const h=UE(e),f=mW(e);t&&f&&!h&&e.inherit!==!1&&(o===void 0&&(o=t.initial),c===void 0&&(c=t.animate));let m=r?r.initial===!1:!1;m=m||o===!1;const y=m?c:o;if(y&&typeof y!="boolean"&&!LE(y)){const w=Array.isArray(y)?y:[y];for(let A=0;A(t,r)=>{const n=I.useContext(BE),i=I.useContext(DE),a=()=>Vxe(e,t,n,i);return r?a():zT(a)},$xe=WW({scrapeMotionValuesFromProps:u4,createRenderState:h4}),Hxe=WW({scrapeMotionValuesFromProps:CW,createRenderState:qW}),Gxe=Symbol.for("motionComponentSymbol");function qxe(e,t,r){const n=I.useRef(r);I.useInsertionEffect(()=>{n.current=r});const i=I.useRef(null);return I.useCallback(a=>{var c;a&&((c=e.onMount)==null||c.call(e,a));const o=n.current;if(typeof o=="function")if(a){const h=o(a);typeof h=="function"&&(i.current=h)}else i.current?(i.current(),i.current=null):o(a);else o&&(o.current=a);t&&(a?t.mount(a):t.unmount())},[t])}const KW=I.createContext({});function R0(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Wxe(e,t,r,n,i,a){var U,G;const{visualElement:o}=I.useContext(BE),c=I.useContext(FW),h=I.useContext(DE),f=I.useContext(d4),m=f.reducedMotion,y=f.skipAnimations,w=I.useRef(null),A=I.useRef(!1);n=n||c.renderer,!w.current&&n&&(w.current=n(e,{visualState:t,parent:o,props:r,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:m,skipAnimations:y,isSVG:a}),A.current&&w.current&&(w.current.manuallyAnimateOnMount=!0));const S=w.current,j=I.useContext(KW);S&&!S.projection&&i&&(S.type==="html"||S.type==="svg")&&Kxe(w.current,r,i,j);const T=I.useRef(!1);I.useInsertionEffect(()=>{S&&T.current&&S.update(r,h)});const D=r[rW],V=I.useRef(!!D&&typeof window<"u"&&!((U=window.MotionHandoffIsComplete)!=null&&U.call(window,D))&&((G=window.MotionHasOptimisedAnimation)==null?void 0:G.call(window,D)));return pq(()=>{A.current=!0,S&&(T.current=!0,window.MotionIsMounted=!0,S.updateFeatures(),S.scheduleRenderMicrotask(),V.current&&S.animationState&&S.animationState.animateChanges())}),I.useEffect(()=>{S&&(!V.current&&S.animationState&&S.animationState.animateChanges(),V.current&&(queueMicrotask(()=>{var X;(X=window.MotionHandoffMarkAsComplete)==null||X.call(window,D)}),V.current=!1),S.enteringChildren=void 0)}),S}function Kxe(e,t,r,n){const{layoutId:i,layout:a,drag:o,dragConstraints:c,layoutScroll:h,layoutRoot:f,layoutAnchor:m,layoutCrossfade:y}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:YW(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||c&&R0(c),visualElement:e,animationType:typeof a=="string"?a:"both",initialPromotionConfig:n,crossfade:y,layoutScroll:h,layoutRoot:f,layoutAnchor:m})}function YW(e){if(e)return e.options.allowProjection!==!1?e.projection:YW(e.parent)}function jk(e,{forwardMotionProps:t=!1,type:r}={},n,i){n&&jxe(n);const a=r?r==="svg":f4(e),o=a?Hxe:$xe;function c(f,m){let y;const w={...I.useContext(d4),...f,layoutId:Yxe(f)},{isStatic:A}=w,S=Rxe(f),j=o(f,A);if(!A&&typeof window<"u"){Xxe();const T=Qxe(w);y=T.MeasureLayout,S.visualElement=Wxe(e,j,w,i,T.ProjectionNode,a)}return s.jsxs(BE.Provider,{value:S,children:[y&&S.visualElement?s.jsx(y,{visualElement:S.visualElement,...w}):null,zxe(e,f,qxe(j,S.visualElement,m),j,A,t,a)]})}c.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const h=I.forwardRef(c);return h[Gxe]=e,h}function Yxe({layoutId:e}){const t=I.useContext(BT).id;return t&&e!==void 0?t+"-"+e:e}function Xxe(e,t){I.useContext(FW).strict}function Qxe(e){const t=$W(),{drag:r,layout:n}=t;if(!r&&!n)return{};const i={...r,...n};return{MeasureLayout:r!=null&&r.isEnabled(e)||n!=null&&n.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function Zxe(e,t){if(typeof Proxy>"u")return jk;const r=new Map,n=(a,o)=>jk(a,o,e,t),i=(a,o)=>n(a,o);return new Proxy(i,{get:(a,o)=>o==="create"?n:(r.has(o)||r.set(o,jk(o,void 0,e,t)),r.get(o))})}const Jxe=(e,t)=>t.isSVG??f4(e)?new jge(t):new Ege(t,{allowProjection:e!==I.Fragment});class e1e extends Of{constructor(t){super(t),t.animationState||(t.animationState=Rge(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();LE(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let t1e=0;class r1e extends Of{constructor(){super(...arguments),this.id=t1e++,this.isExitComplete=!1}update(){var a;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;if(t&&n===!1){if(this.isExitComplete){const{initial:o,custom:c}=this.node.getProps();if(typeof o=="string"){const h=Up(this.node,o,c);if(h){const{transition:f,transitionEnd:m,...y}=h;for(const w in y)(a=this.node.getValue(w))==null||a.jump(y[w])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!t);r&&!t&&i.then(()=>{this.isExitComplete=!0,r(this.id)})}mount(){const{register:t,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const n1e={animation:{Feature:e1e},exit:{Feature:r1e}};function ab(e){return{point:{x:e.pageX,y:e.pageY}}}const i1e=e=>t=>s4(t)&&e(t,ab(t));function K1(e,t,r,n){return wy(e,t,i1e(r),n)}const XW=({current:e})=>e?e.ownerDocument.defaultView:null,bM=(e,t)=>Math.abs(e-t);function s1e(e,t){const r=bM(e.x,t.x),n=bM(e.y,t.y);return Math.sqrt(r**2+n**2)}const vM=new Set(["auto","scroll"]);class QW{constructor(t,r,{transformPagePoint:n,contextWindow:i=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3,element:c}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=A=>{this.handleScroll(A.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Hv(this.lastRawMoveEventInfo,this.transformPagePoint));const A=Ik(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,j=s1e(A.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!j)return;const{point:T}=A,{timestamp:D}=no;this.history.push({...T,timestamp:D});const{onStart:V,onMove:U}=this.handlers;S||(V&&V(this.lastMoveEvent,A),this.startEvent=this.lastMoveEvent),U&&U(this.lastMoveEvent,A)},this.handlePointerMove=(A,S)=>{this.lastMoveEvent=A,this.lastRawMoveEventInfo=S,this.lastMoveEventInfo=Hv(S,this.transformPagePoint),Ji.update(this.updatePoint,!0)},this.handlePointerUp=(A,S)=>{this.end();const{onEnd:j,onSessionEnd:T,resumeAnimation:D}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&D&&D(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const V=Ik(A.type==="pointercancel"?this.lastMoveEventInfo:Hv(S,this.transformPagePoint),this.history);this.startEvent&&j&&j(A,V),T&&T(A,V)},!s4(t))return;this.dragSnapToOrigin=a,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=i||window;const h=ab(t),f=Hv(h,this.transformPagePoint),{point:m}=f,{timestamp:y}=no;this.history=[{...m,timestamp:y}];const{onSessionStart:w}=r;w&&w(t,Ik(f,this.history)),this.removeListeners=nb(K1(this.contextWindow,"pointermove",this.handlePointerMove),K1(this.contextWindow,"pointerup",this.handlePointerUp),K1(this.contextWindow,"pointercancel",this.handlePointerUp)),c&&this.startScrollTracking(c)}startScrollTracking(t){let r=t.parentElement;for(;r;){const n=getComputedStyle(r);(vM.has(n.overflowX)||vM.has(n.overflowY))&&this.scrollPositions.set(r,{x:r.scrollLeft,y:r.scrollTop}),r=r.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const r=this.scrollPositions.get(t);if(!r)return;const n=t===window,i=n?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},a={x:i.x-r.x,y:i.y-r.y};a.x===0&&a.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(t,i),Ji.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Nf(this.updatePoint)}}function Hv(e,t){return t?{point:t(e.point)}:e}function wM(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ik({point:e},t){return{point:e,delta:wM(e,ZW(t)),offset:wM(e,a1e(t)),velocity:o1e(t,.1)}}function a1e(e){return e[0]}function ZW(e){return e[e.length-1]}function o1e(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const i=ZW(e);for(;r>=0&&(n=e[r],!(i.timestamp-n.timestamp>Hl(t)));)r--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&i.timestamp-n.timestamp>Hl(t)*2&&(n=e[1]);const a=xc(i.timestamp-n.timestamp);if(a===0)return{x:0,y:0};const o={x:(i.x-n.x)/a,y:(i.y-n.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function l1e(e,{min:t,max:r},n){return t!==void 0&&er&&(e=n?gs(r,e,n.max):Math.min(e,r)),e}function NM(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function c1e(e,{top:t,left:r,bottom:n,right:i}){return{x:NM(e.x,r,i),y:NM(e.y,t,n)}}function EM(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.minn?r=yy(t.min,t.max-n,e.min):n>i&&(r=yy(e.min,e.max-i,t.min)),$u(0,1,r)}function h1e(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const ej=.35;function f1e(e=ej){return e===!1?e=0:e===!0&&(e=ej),{x:AM(e,"left","right"),y:AM(e,"top","bottom")}}function AM(e,t,r){return{min:kM(e,t),max:kM(e,r)}}function kM(e,t){return typeof e=="number"?e:e[t]||0}const p1e=new WeakMap;class m1e{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=wa(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:r=!1,distanceThreshold:n}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const a=y=>{r&&this.snapToCursor(ab(y).point),this.stopAnimation()},o=(y,w)=>{const{drag:A,dragPropagation:S,onDragStart:j}=this.getProps();if(A&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=F0e(A),!this.openDragLock))return;this.latestPointerEvent=y,this.latestPanInfo=w,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),bu(D=>{let V=this.getAxisMotionValue(D).get()||0;if(Lu.test(V)){const{projection:U}=this.visualElement;if(U&&U.layout){const G=U.layout.layoutBox[D];G&&(V=Vo(G)*(parseFloat(V)/100))}}this.originPoint[D]=V}),j&&Ji.update(()=>j(y,w),!1,!0),GC(this.visualElement,"transform");const{animationState:T}=this.visualElement;T&&T.setActive("whileDrag",!0)},c=(y,w)=>{this.latestPointerEvent=y,this.latestPanInfo=w;const{dragPropagation:A,dragDirectionLock:S,onDirectionLock:j,onDrag:T}=this.getProps();if(!A&&!this.openDragLock)return;const{offset:D}=w;if(S&&this.currentDirection===null){this.currentDirection=x1e(D),this.currentDirection!==null&&j&&j(this.currentDirection);return}this.updateAxis("x",w.point,D),this.updateAxis("y",w.point,D),this.visualElement.render(),T&&Ji.update(()=>T(y,w),!1,!0)},h=(y,w)=>{this.latestPointerEvent=y,this.latestPanInfo=w,this.stop(y,w),this.latestPointerEvent=null,this.latestPanInfo=null},f=()=>{const{dragSnapToOrigin:y}=this.getProps();(y||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:m}=this.getProps();this.panSession=new QW(t,{onSessionStart:a,onStart:o,onMove:c,onSessionEnd:h,resumeAnimation:f},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:m,distanceThreshold:n,contextWindow:XW(this.visualElement),element:this.visualElement.current})}stop(t,r){const n=t||this.latestPointerEvent,i=r||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!n)return;const{velocity:o}=i;this.startAnimation(o);const{onDragEnd:c}=this.getProps();c&&Ji.postRender(()=>c(n,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,r,n){const{drag:i}=this.getProps();if(!n||!Gv(t,i,this.currentDirection))return;const a=this.getAxisMotionValue(t);let o=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(o=l1e(o,this.constraints[t],this.elastic[t])),a.set(o)}resolveConstraints(){var a;const{dragConstraints:t,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)==null?void 0:a.layout,i=this.constraints;t&&R0(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&n?this.constraints=c1e(n.layoutBox,t):this.constraints=!1,this.elastic=f1e(r),i!==this.constraints&&!R0(t)&&n&&this.constraints&&!this.hasMutatedConstraints&&bu(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=h1e(n.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!R0(t))return!1;const n=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const a=xge(n,i.root,this.visualElement.getTransformPagePoint());let o=u1e(i.layout.layoutBox,a);if(r){const c=r(pge(o));this.hasMutatedConstraints=!!c,c&&(o=bW(c))}return o}startAnimation(t){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:c}=this.getProps(),h=this.constraints||{},f=bu(m=>{if(!Gv(m,r,this.currentDirection))return;let y=h&&h[m]||{};(o===!0||o===m)&&(y={min:0,max:0});const w=i?200:1e6,A=i?40:1e7,S={type:"inertia",velocity:n?t[m]:0,bounceStiffness:w,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...a,...y};return this.startAxisValueAnimation(m,S)});return Promise.all(f).then(c)}startAxisValueAnimation(t,r){const n=this.getAxisMotionValue(t);return GC(this.visualElement,t),n.start(e4(t,n,0,r,this.visualElement,!1))}stopAnimation(){bu(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const r=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){bu(r=>{const{drag:n}=this.getProps();if(!Gv(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,a=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:c}=i.layout.layoutBox[r],h=a.get()||0;a.set(t[r]-gs(o,c,.5)+h)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!R0(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};bu(o=>{const c=this.getAxisMotionValue(o);if(c&&this.constraints!==!1){const h=c.get();i[o]=d1e({min:h,max:h},this.constraints[o])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),bu(o=>{if(!Gv(o,t,null))return;const c=this.getAxisMotionValue(o),{min:h,max:f}=this.constraints[o];c.set(gs(h,f,i[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;p1e.set(this.visualElement,this);const t=this.visualElement.current,r=K1(t,"pointerdown",f=>{const{drag:m,dragListener:y=!0}=this.getProps(),w=f.target,A=w!==t&&K0e(w);m&&y&&!A&&this.start(f)});let n;const i=()=>{const{dragConstraints:f}=this.getProps();R0(f)&&f.current&&(this.constraints=this.resolveRefConstraints(),n||(n=g1e(t,f.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,o=a.addEventListener("measure",i);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),Ji.read(i);const c=wy(window,"resize",()=>this.scalePositionWithinConstraints()),h=a.addEventListener("didUpdate",(({delta:f,hasLayoutChanged:m})=>{this.isDragging&&m&&(bu(y=>{const w=this.getAxisMotionValue(y);w&&(this.originPoint[y]+=f[y].translate,w.set(w.get()+f[y].translate))}),this.visualElement.render())}));return()=>{c(),r(),o(),h&&h(),n&&n()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:o=ej,dragMomentum:c=!0}=t;return{...t,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:a,dragElastic:o,dragMomentum:c}}}function _M(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function g1e(e,t,r){const n=O8(e,_M(r)),i=O8(t,_M(r));return()=>{n(),i()}}function Gv(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function x1e(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class y1e extends Of{constructor(t){super(t),this.removeGroupControls=vc,this.removeListeners=vc,this.controls=new m1e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||vc}update(){const{dragControls:t}=this.node.getProps(),{dragControls:r}=this.node.prevProps||{};t!==r&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Tk=e=>(t,r)=>{e&&Ji.update(()=>e(t,r),!1,!0)};class b1e extends Of{constructor(){super(...arguments),this.removePointerDownListener=vc}onPointerDown(t){this.session=new QW(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:XW(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:Tk(t),onStart:Tk(r),onMove:Tk(n),onEnd:(a,o)=>{delete this.session,i&&Ji.postRender(()=>i(a,o))}}}mount(){this.removePointerDownListener=K1(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Pk=!1;class v1e extends I.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:a}=t;a&&(r.group&&r.group.add(a),n&&n.register&&i&&n.register(a),Pk&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Ww.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:n,drag:i,isPresent:a}=this.props,{projection:o}=n;return o&&(o.isPresent=a,t.layoutDependency!==r&&o.setOptions({...o.options,layoutDependency:r}),Pk=!0,i||t.layoutDependency!==r||r===void 0||t.isPresent!==a?o.willUpdate():this.safeToRemove(),t.isPresent!==a&&(a?o.promote():o.relegate()||Ji.postRender(()=>{const c=o.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:r}=this.props,{projection:n}=t;n&&(n.options.layoutAnchor=r,n.root.didUpdate(),i4.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=t;Pk=!0,i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function JW(e){const[t,r]=VW(),n=I.useContext(BT);return s.jsx(v1e,{...e,layoutGroup:n,switchLayoutGroup:I.useContext(KW),isPresent:t,safeToRemove:r})}const w1e={pan:{Feature:b1e},drag:{Feature:y1e,ProjectionNode:zW,MeasureLayout:JW}};function SM(e,t,r){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover",r==="Start");const i="onHover"+r,a=n[i];a&&Ji.postRender(()=>a(t,ab(t)))}class N1e extends Of{mount(){const{current:t}=this.node;t&&(this.unmount=H0e(t,(r,n)=>(SM(this.node,n,"Start"),i=>SM(this.node,i,"End"))))}unmount(){}}class E1e extends Of{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=nb(wy(this.node.current,"focus",()=>this.onFocus()),wy(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function CM(e,t,r){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap",r==="Start");const i="onTap"+(r==="End"?"":r),a=n[i];a&&Ji.postRender(()=>a(t,ab(t)))}class A1e extends Of{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:r,propagate:n}=this.node.props;this.unmount=X0e(t,(i,a)=>(CM(this.node,a,"Start"),(o,{success:c})=>CM(this.node,o,c?"End":"Cancel")),{useGlobalTarget:r,stopPropagation:(n==null?void 0:n.tap)===!1})}unmount(){}}const tj=new WeakMap,Ok=new WeakMap,k1e=e=>{const t=tj.get(e.target);t&&t(e)},_1e=e=>{e.forEach(k1e)};function S1e({root:e,...t}){const r=e||document;Ok.has(r)||Ok.set(r,{});const n=Ok.get(r),i=JSON.stringify(t);return n[i]||(n[i]=new IntersectionObserver(_1e,{root:e,...t})),n[i]}function C1e(e,t,r){const n=S1e(t);return tj.set(e,r),n.observe(e),()=>{tj.delete(e),n.unobserve(e)}}const j1e={some:0,all:1};class I1e extends Of{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var h;(h=this.stopObserver)==null||h.call(this);const{viewport:t={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:a}=t,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:j1e[i]},c=f=>{const{isIntersecting:m}=f;if(this.isInView===m||(this.isInView=m,a&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:w}=this.node.getProps(),A=m?y:w;A&&A(f)};this.stopObserver=C1e(this.node.current,o,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some(T1e(t,r))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function T1e({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const P1e={inView:{Feature:I1e},tap:{Feature:A1e},focus:{Feature:E1e},hover:{Feature:N1e}},O1e={layout:{ProjectionNode:zW,MeasureLayout:JW}},R1e={...n1e,...P1e,...w1e,...O1e},Qt=Zxe(R1e,Jxe),eK=({isOpen:e,imagesList:t=[],initialIndex:r=0,imageUrl:n,title:i,onClose:a})=>{const[o,c]=I.useState(r),h=t.length>0?t:n?[n]:[];I.useEffect(()=>{e&&c(r)},[e,r]);const f=h[o]||n||"",m=async A=>{A.stopPropagation();try{nn.loading("Preparing image for download...",{id:"download-prep"});const S=`/api/proxy-image?url=${encodeURIComponent(f)}`,j=await fetch(S);if(!j.ok)throw new Error("Proxy image download failed");const T=await j.blob(),D=window.URL.createObjectURL(T),V=document.createElement("a");V.href=D,V.download=`${i.toLowerCase().replace(/[^a-z0-9]/g,"-")||"campus-eye-image"}-${o+1}.jpg`,document.body.appendChild(V),V.click(),document.body.removeChild(V),window.URL.revokeObjectURL(D),nn.success("Download started successfully!",{id:"download-prep"})}catch(S){console.warn("Proxy download failed, trying standard open in new tab...",S);try{const j=document.createElement("a");j.href=f,j.target="_blank",j.rel="noopener noreferrer",j.download=`${i||"image"}-${o+1}.jpg`,document.body.appendChild(j),j.click(),document.body.removeChild(j),nn.success("Opening original in new tab...",{id:"download-prep"})}catch{nn.error("Could not download image, please save manually.",{id:"download-prep"})}}},y=A=>{A==null||A.stopPropagation(),h.length>1&&c(S=>S===0?h.length-1:S-1)},w=A=>{A==null||A.stopPropagation(),h.length>1&&c(S=>S===h.length-1?0:S+1)};return I.useEffect(()=>{const A=S=>{e&&(S.key==="ArrowLeft"?y():S.key==="ArrowRight"?w():S.key==="Escape"&&a())};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[e,h.length]),s.jsx(on,{children:e&&s.jsxs(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[5000] bg-black/95 backdrop-blur-xl flex flex-col justify-between p-4",onClick:a,children:[s.jsxs("div",{className:"w-full h-14 flex items-center justify-between px-2 max-w-7xl mx-auto z-50",children:[s.jsxs("span",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 truncate max-w-xs sm:max-w-md",children:["👁️ Photo Desk • ",i," ",h.length>1&&`(${o+1} of ${h.length})`]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("button",{onClick:m,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white/10 hover:bg-white/25 active:bg-white/30 text-white border border-white/10 hover:border-white/20 rounded-full text-[10px] font-black uppercase tracking-widest transition-all cursor-pointer shadow-lg",title:"Download high resolution copy",children:[s.jsx(eE,{size:13}),s.jsx("span",{children:"Download"})]}),s.jsx("button",{onClick:A=>{A.stopPropagation(),a()},className:"w-9 h-9 bg-red-650 hover:bg-black text-white rounded-full flex items-center justify-center transition-all cursor-pointer shadow-lg border border-red-500/20",title:"Exit lightbox view",children:s.jsx(Jr,{size:16})})]})]}),s.jsxs("div",{className:"flex-1 flex items-center justify-center relative p-2 md:p-6 w-full max-w-5xl mx-auto select-none gap-4",children:[h.length>1&&s.jsx("button",{type:"button",onClick:y,className:"w-10 h-10 rounded-full bg-black/50 border border-white/15 hover:bg-white/20 hover:border-white/40 text-white flex items-center justify-center transition-all cursor-pointer hidden md:flex shrink-0",children:s.jsx(Hp,{size:20})}),s.jsxs("div",{className:"relative flex-1 flex justify-center max-w-full",children:[s.jsx(Qt.img,{initial:{opacity:0,scale:.95,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:15},transition:{type:"spring",damping:25},src:f,alt:i,className:"max-w-full max-h-[75vh] object-contain rounded-xl shadow-2.5xl ring-1 ring-white/15 cursor-zoom-out",onClick:A=>{A.stopPropagation(),a()},referrerPolicy:"no-referrer"},o),h.length>1&&s.jsxs("div",{className:"absolute inset-y-0 inset-x-0 flex justify-between items-center pointer-events-none md:hidden",children:[s.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),y(A)},className:"w-12 h-12 rounded-r-full bg-black/40 text-white flex items-center justify-start pl-2 pointer-events-auto",children:s.jsx(Hp,{size:18})}),s.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),w(A)},className:"w-12 h-12 rounded-l-full bg-black/40 text-white flex items-center justify-end pr-2 pointer-events-auto",children:s.jsx(Gp,{size:18})})]})]}),h.length>1&&s.jsx("button",{type:"button",onClick:w,className:"w-10 h-10 rounded-full bg-black/50 border border-white/15 hover:bg-white/20 hover:border-white/40 text-white flex items-center justify-center transition-all cursor-pointer hidden md:flex shrink-0",children:s.jsx(Gp,{size:20})})]}),s.jsx("div",{className:"w-full text-center py-4 z-50",children:s.jsx("p",{className:"text-[9px] font-medium text-gray-400 uppercase tracking-widest mb-1",children:h.length>1?"Use ← and → keys or tap arrows to navigate":"Click anywhere on the background or tap X to return"})})]})})},D1e=[{index:1,emoji:"🔥",label:"Lit"},{index:2,emoji:"🤯",label:"Shocked"},{index:3,emoji:"😢",label:"Sad"},{index:4,emoji:"👏",label:"Solid"},{index:5,emoji:"❤️",label:"Love"},{index:6,emoji:"😂",label:"Funny"},{index:7,emoji:"👍",label:"Like"}],Bi=({src:e,alt:t="",className:r="",priority:n=!1,title:i="",fallbackInitial:a="",...o})=>{const[c,h]=I.useState(()=>n),[f,m]=I.useState(!1),[y,w]=I.useState(0),A=ie.useRef(null);I.useEffect(()=>{var D,V;m(!1),w(0),(D=A.current)!=null&&D.complete&&((V=A.current)==null?void 0:V.naturalWidth)!==0?h(!0):h(n)},[e,n]);const j=(a||i||t||"Campus").trim().charAt(0).toUpperCase()||"C",T=e?Tpe(e,n?900:650,80):"";return s.jsxs("div",{className:Ge("relative overflow-hidden bg-gradient-to-br from-neutral-900 via-slate-900 to-indigo-950 flex items-center justify-center w-full h-full min-h-[50px] select-none",r),children:[(!c||f||!e)&&s.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-2 z-10 pointer-events-none transition-opacity duration-300",children:[s.jsx("div",{className:"w-9 h-9 sm:w-11 sm:h-11 rounded-2xl bg-white/10 backdrop-blur-md border border-white/20 flex items-center justify-center text-white font-serif font-black text-lg sm:text-xl shadow-md",children:j}),(i||t)&&s.jsx("span",{className:"text-[8px] sm:text-[9px] font-bold text-gray-300 uppercase tracking-widest mt-1.5 px-3 text-center line-clamp-1 opacity-75 max-w-[85%]",children:i||t})]}),T&&!f&&s.jsx("img",{ref:A,src:T,alt:t||i,onLoad:()=>h(!0),onError:()=>{y<1?w(D=>D+1):(m(!0),h(!0))},loading:n?"eager":"lazy",decoding:"async",...n?{fetchPriority:"high"}:{},className:Ge("w-full h-full object-cover transition-all duration-500 transform-gpu relative z-20",c?"opacity-100 blur-none scale-100":"opacity-90 blur-[3px] scale-102"),referrerPolicy:"no-referrer",...o})]})},Rk=({article:e,onClick:t,variant:r="social",onAuthorClick:n,priority:i=!1})=>{var It,Dt,cr;const[a,o]=I.useState(!1),[c,h]=I.useState([]),[f,m]=I.useState(""),[y,w]=I.useState(!1),[A,S]=I.useState(!1),[j,T]=I.useState(e.likeCount||0),[D,V]=I.useState(e.commentCount||0),[U,G]=I.useState(e.viewCount||0),[X,q]=I.useState(e.saveCount||0),[B,z]=I.useState(e.shareCount||0),[F,$]=I.useState(!1),[J,Q]=I.useState(!1),[K,me]=I.useState(null),[re,le]=I.useState({}),[ve,je]=I.useState(0),[Ve,Z]=I.useState(!1),[se,xe]=I.useState(!1),[ae,qe]=I.useState(null),pt=[e.featuredImageUrl,e.featuredImageUrl1,e.featuredImageUrl2].filter(Boolean);I.useEffect(()=>{T(e.likeCount||0),V(e.commentCount||0),G(e.viewCount||0),q(e.saveCount||0),z(e.shareCount||0);const St={};for(let Ct=1;Ct<=7;Ct++){const Gt=`reaction${Ct}`;e[Gt]&&(St[`reaction${Ct}`]=e[Gt])}if(le(St),Ne.currentUser){const Ct=`reacted_${e.id}_${Ne.currentUser.uid}`,Gt=localStorage.getItem(Ct);me(Gt?parseInt(Gt):null)}},[e,Ne.currentUser]);const Fe=async St=>{if(!Ne.currentUser){nn.error("Please login to react to this story"),typeof window.triggerAuthWithCallback=="function"&&window.triggerAuthWithCallback(()=>{Fe(St)});return}const Ct=st(fe,"articles",e.id),Gt=`reacted_${e.id}_${Ne.currentUser.uid}`,Xe=localStorage.getItem(Gt),Xt=Xe?parseInt(Xe):null;try{const Ot={},or=["🔥","🤯","😢","👏","❤️","😂","👍"],Wr=or[St-1];Xt===St?(Ot[`reaction${St}.count`]=Cn(-1),Ot[`reaction${St}.emoji`]=Wr,localStorage.removeItem(Gt),me(null)):(Xt!==null&&(Ot[`reaction${Xt}.count`]=Cn(-1),Ot[`reaction${Xt}.emoji`]=or[Xt-1]),Ot[`reaction${St}.count`]=Cn(1),Ot[`reaction${St}.emoji`]=Wr,localStorage.setItem(Gt,St.toString()),me(St)),await Ir(Ct,Ot),nn.success("Reaction updated!")}catch(Ot){console.error("Error updating reaction:",Ot)}};I.useEffect(()=>{if(Ne.currentUser){const St=`liked_${e.id}_${Ne.currentUser.uid}`,Ct=localStorage.getItem(St);if(Ct!==null)w(Ct==="true");else{const Xe=st(fe,"articles",e.id,"likes",Ne.currentUser.uid);as(Xe).then(Xt=>{const Ot=Xt.exists();w(Ot);try{localStorage.setItem(St,Ot?"true":"false")}catch{}}).catch(()=>{})}const Gt=`saved_${e.id}_${Ne.currentUser.uid}`;S(localStorage.getItem(Gt)==="true")}},[e.id,Ne.currentUser]),I.useEffect(()=>{if(!a)return;const St=Jt(nt(fe,"articles",e.id,"comments"),di("createdAt","desc"),yi(20)),Ct=ei(St,Gt=>{const Xe=Gt.docs.map(Xt=>({id:Xt.id,...Xt.data()}));h(Xe),Xe.length>0&&V(Xe.length)},Gt=>{console.warn("Silent ignored comments fetch error for article",Gt)});return()=>Ct()},[e.id,a]);const jt=async St=>{if(St.stopPropagation(),!Ne.currentUser){nn.error("Please sign in to solidarily support this dispatch!"),typeof window.triggerAuthWithCallback=="function"&&window.triggerAuthWithCallback(()=>{jt({stopPropagation:()=>{}})});return}const Ct=st(fe,"articles",e.id,"likes",Ne.currentUser.uid),Gt=st(fe,"articles",e.id),Xe=`liked_${e.id}_${Ne.currentUser.uid}`;try{if(y){w(!1),T(Xt=>Math.max(0,Xt-1));try{localStorage.setItem(Xe,"false")}catch{}await ai(Ct),await Ir(Gt,{likeCount:Cn(-1)})}else{w(!0),T(Xt=>Xt+1);try{localStorage.setItem(Xe,"true")}catch{}await Gn(Ct,{userId:Ne.currentUser.uid,createdAt:zr()}),await Ir(Gt,{likeCount:Cn(1)}),nn.success("Solidarity registered!")}}catch(Xt){console.error("Error liking article:",Xt)}},Pt=async St=>{if(St.stopPropagation(),!Ne.currentUser){nn.error("Please sign in to bookmark dispatches!"),typeof window.triggerAuthWithCallback=="function"&&window.triggerAuthWithCallback(()=>{Pt({stopPropagation:()=>{}})});return}const Ct=st(fe,"articles",e.id),Gt=`saved_${e.id}_${Ne.currentUser.uid}`,Xe=A;try{Xe?(S(!1),q(Xt=>Math.max(0,Xt-1)),localStorage.removeItem(Gt),await Ir(Ct,{saveCount:Cn(-1)}),nn.success("Successfully unbookmarked")):(S(!0),q(Xt=>Xt+1),localStorage.setItem(Gt,"true"),await Ir(Ct,{saveCount:Cn(1)}),nn.success("Secured in Bookmarks!"))}catch(Xt){console.error("Error saving article:",Xt)}},Ae=async St=>{St.stopPropagation();const Ct=e.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Gt=`${window.location.origin}/articles=${Ct}/${e.id}`,Xe=e.title,Xt=e.summary||(e.content?e.content.substring(0,140)+"...":""),Ot=`${e.title} ${Xt} Read More: ${Gt}`,or=[e.featuredImageUrl,e.featuredImageUrl1,e.featuredImageUrl2,e.imageUrl].find(dr=>dr&&typeof dr=="string"&&!dr.startsWith("data:")&&dr.length>5)||"";try{fetch("/api/append-sitemap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Gt,title:Xe,image:or})}).catch(()=>{})}catch{}let Wr=!1;if(navigator.share)try{const dr={title:Xe,text:`${e.title} ${Xt}`,url:Gt};await navigator.share(dr),Wr=!0;const yn=st(fe,"articles",e.id);await Ir(yn,{shareCount:Cn(1)}).catch(()=>{});return}catch(dr){console.warn("Shared sheet native cancel or fail:",dr)}if(!Wr){try{await Od(Ot);const dr=st(fe,"articles",e.id);await Ir(dr,{shareCount:Cn(1)}).catch(()=>{})}catch{}xe(!0)}},Ie=async St=>{var Ct,Gt;if(St.preventDefault(),!!f.trim()){if(!Ne.currentUser){nn.error("Please sign in to publish your thoughts."),typeof window.triggerAuthWithCallback=="function"&&window.triggerAuthWithCallback(()=>{Ie({preventDefault:()=>{}})});return}$(!0);try{const Xe=ae?ae.parentId||ae.id:null,Xt=ae?ae.authorName:null,Ot={content:f,userId:Ne.currentUser.uid,authorName:Ne.currentUser.displayName||"Campus Member",photoURL:Ne.currentUser.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(Ne.currentUser.displayName||"Member")}`,createdAt:new Date,parentId:Xe,replyToAuthor:Xt},or=await dn(nt(fe,"articles",e.id,"comments"),{content:f,userId:Ne.currentUser.uid,authorName:Ne.currentUser.displayName||"Campus Member",photoURL:Ne.currentUser.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(Ne.currentUser.displayName||"Member")}`,createdAt:zr(),parentId:Xe,replyToAuthor:Xt});h(yn=>[{id:or.id,...Ot},...yn]),V(yn=>yn+1);const Wr=st(fe,"articles",e.id);await Ir(Wr,{commentCount:Cn(1)});const dr=f;m(""),qe(null),nn.success("Thought dispatched!"),/@(mega\s*(ai)?|me)\b/i.test(dr)&&M2(dr,((Ct=Ne.currentUser)==null?void 0:Ct.displayName)||"Campus Member",((Gt=Ne.currentUser)==null?void 0:Gt.uid)||"guest",{type:"article_comment",articleId:e.id}).then(async yn=>{var He;if(yn){const Rt=await dn(nt(fe,"articles",e.id,"comments"),{content:yn,userId:"mega-ai-bot",authorName:"Mega AI 🤖",photoURL:Uo,createdAt:zr(),parentId:Xe,replyToAuthor:((He=Ne.currentUser)==null?void 0:He.displayName)||"Campus Member"});h(nr=>{var fr;return[...nr,{id:Rt.id,content:yn,userId:"mega-ai-bot",authorName:"Mega AI 🤖",photoURL:Uo,createdAt:new Date,parentId:Xe,replyToAuthor:((fr=Ne.currentUser)==null?void 0:fr.displayName)||"Campus Member"}]}),V(nr=>nr+1),await Ir(st(fe,"articles",e.id),{commentCount:Cn(1)}),nn.success("Mega AI auto-replied to your commentary!",{icon:"✨"})}}).catch(yn=>console.error("Mega AI auto reply error:",yn))}catch(Xe){console.error("Comment submission error:",Xe)}finally{$(!1)}}},vt=()=>{var Xe,Xt,Ot;const St=e.isSponsoredAd||((Xe=e.category)==null?void 0:Xe.toLowerCase().includes("ad"))||((Xt=e.category)==null?void 0:Xt.toLowerCase().includes("sponsor"))||((Ot=e.category)==null?void 0:Ot.toLowerCase().includes("promote")),Ct=[];if(e.featuredImageUrl&&Ct.push(e.featuredImageUrl),e.featuredImageUrl1&&Ct.push(e.featuredImageUrl1),e.featuredImageUrl2&&Ct.push(e.featuredImageUrl2),Ct.length===0)return null;const Gt=St&&s.jsx("div",{className:"absolute top-2.5 left-2.5 bg-black/85 backdrop-blur-md text-[#FF2D55] text-[7.5px] font-black uppercase tracking-widest px-3 py-1 rounded-md border border-red-500/20 flex items-center gap-1 z-10 pointer-events-none shadow-lg",children:"📢 SPONSORED AD"});return Ct.length===3?s.jsxs("div",{className:"relative group/ad w-full select-none",onClick:or=>or.stopPropagation(),children:[Gt,s.jsxs("div",{className:"flex gap-1 rounded-2xl overflow-hidden border border-gray-150 aspect-[16/10] w-full bg-gray-50",children:[s.jsx("div",{onClick:or=>{or.preventDefault(),je(0),Z(!0)},className:"w-[60%] overflow-hidden relative group/img cursor-pointer h-full",children:s.jsx(Bi,{src:Ct[0],alt:"Support View 1",priority:i,className:"w-full h-full object-cover transition-transform duration-500 hover:scale-[1.03]"})}),s.jsxs("div",{className:"w-[40%] flex flex-col gap-1 h-full",children:[s.jsx("div",{onClick:or=>{or.preventDefault(),je(1),Z(!0)},className:"h-[calc(50%-2px)] overflow-hidden relative group/img cursor-pointer",children:s.jsx(Bi,{src:Ct[1],alt:"Support View 2",priority:i,className:"w-full h-full object-cover transition-transform duration-500 hover:scale-[1.03]"})}),s.jsx("div",{onClick:or=>{or.preventDefault(),je(2),Z(!0)},className:"h-[calc(50%-2px)] overflow-hidden relative group/img cursor-pointer",children:s.jsx(Bi,{src:Ct[2],alt:"Support View 3",priority:i,className:"w-full h-full object-cover transition-transform duration-500 hover:scale-[1.03]"})})]})]})]}):Ct.length===2?s.jsxs("div",{className:"relative group/ad w-full select-none",onClick:or=>or.stopPropagation(),children:[Gt,s.jsx("div",{className:"grid grid-cols-2 gap-1 rounded-2xl overflow-hidden border border-gray-150 aspect-[16/10] sm:aspect-[16/9] w-full bg-gray-50",children:Ct.map((or,Wr)=>s.jsx("div",{className:"overflow-hidden relative group/img cursor-pointer h-full w-full",onClick:dr=>{dr.preventDefault(),je(Wr),Z(!0)},children:s.jsx(Bi,{src:or,alt:`Support View ${Wr+1}`,priority:i,className:"w-full h-full object-cover transition-transform duration-500 hover:scale-[1.03]"})},Wr))})]}):s.jsxs("div",{className:"relative group/ad w-full select-none",onClick:or=>or.stopPropagation(),children:[Gt,s.jsx("div",{onClick:or=>{or.preventDefault(),je(0),Z(!0)},className:"rounded-xl overflow-hidden border border-gray-150/70 w-full bg-gray-50 flex items-center justify-center relative group/img cursor-pointer shadow-2xs",children:s.jsx(Bi,{src:e.featuredImageUrl,alt:e.title,priority:i,className:"w-full h-auto max-h-[42rem] object-cover transition-transform duration-500 hover:scale-[1.02]"})})]})},Re=St=>s.jsxs(s.Fragment,{children:[St,s.jsx(eK,{isOpen:Ve,imagesList:pt,initialIndex:ve,imageUrl:pt[ve]||"",title:e.title,onClose:()=>Z(!1)}),se&&s.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-md z-[200] flex items-end sm:items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200",onClick:Ct=>{Ct.stopPropagation(),xe(!1)},children:s.jsxs("div",{className:"bg-white/95 dark:bg-neutral-900/95 backdrop-blur-2xl border border-gray-200/80 dark:border-white/10 rounded-3xl p-5 sm:p-6 w-full max-w-sm shadow-2xl space-y-4 text-center relative animate-in slide-in-from-bottom-5 duration-200",onClick:Ct=>Ct.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 dark:border-neutral-800 pb-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-left",children:[s.jsx("div",{className:"p-2 bg-red-50 text-red-650 rounded-full",children:s.jsx(Ld,{size:16})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-bold text-gray-900 dark:text-white",children:"Share Dispatch"}),s.jsx("p",{className:"text-[10px] text-gray-500 lowercase tracking-tight",children:"Choose your preferred social platform"})]})]}),s.jsx("button",{onClick:()=>xe(!1),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-full transition-all cursor-pointer",children:s.jsx(Jr,{size:18})})]}),s.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-neutral-800/60 rounded-2xl border border-gray-100 dark:border-neutral-700/50 text-left space-y-1",children:[s.jsx("p",{className:"text-[11px] font-extrabold text-gray-900 dark:text-white line-clamp-1",children:e.title}),s.jsx("p",{className:"text-[9px] text-gray-500 font-mono truncate",children:`${window.location.origin}/article/${e.id}`})]}),s.jsxs("div",{className:"grid grid-cols-4 gap-2 pt-1",children:[s.jsxs("a",{href:`https://api.whatsapp.com/send?text=${encodeURIComponent(e.title+` Read more: ${window.location.origin}/article/${e.id}`)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>xe(!1),className:"flex flex-col items-center gap-1.5 p-2.5 bg-emerald-50 text-emerald-700 rounded-2xl hover:bg-emerald-100 transition-all active:scale-95 cursor-pointer",children:[s.jsx("span",{className:"text-xl",children:"💬"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"WhatsApp"})]}),s.jsxs("a",{href:`https://twitter.com/intent/tweet?text=${encodeURIComponent(e.title)}&url=${encodeURIComponent(`${window.location.origin}/article/${e.id}`)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>xe(!1),className:"flex flex-col items-center gap-1.5 p-2.5 bg-sky-50 text-sky-700 rounded-2xl hover:bg-sky-100 transition-all active:scale-95 cursor-pointer",children:[s.jsx("span",{className:"text-xl",children:"🐦"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"Twitter/X"})]}),s.jsxs("a",{href:`https://t.me/share/url?url=${encodeURIComponent(`${window.location.origin}/article/${e.id}`)}&text=${encodeURIComponent(e.title)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>xe(!1),className:"flex flex-col items-center gap-1.5 p-2.5 bg-blue-50 text-blue-700 rounded-2xl hover:bg-blue-100 transition-all active:scale-95 cursor-pointer",children:[s.jsx("span",{className:"text-xl",children:"✈️"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"Telegram"})]}),s.jsxs("a",{href:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${window.location.origin}/article/${e.id}`)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>xe(!1),className:"flex flex-col items-center gap-1.5 p-2.5 bg-indigo-50 text-indigo-700 rounded-2xl hover:bg-indigo-100 transition-all active:scale-95 cursor-pointer",children:[s.jsx("span",{className:"text-xl",children:"📘"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"Facebook"})]})]}),s.jsx("div",{className:"pt-2",children:s.jsx("button",{onClick:async()=>{const Ct=`${window.location.origin}/article/${e.id}`;await Od(`${e.title} ${Ct}`),nn.success("Link copied to clipboard!"),xe(!1)},className:"w-full py-3 bg-red-650 hover:bg-red-700 text-white font-bold text-xs uppercase tracking-widest rounded-2xl transition-all shadow-md active:scale-98 flex items-center justify-center gap-2 cursor-pointer",children:s.jsx("span",{children:"Copy Direct Link"})})})]})})]});if(r==="social"){const St=Object.values(re).filter(Xe=>Xe&&Xe.count>0),Ct=St.reduce((Xe,Xt)=>Xe+Xt.count,0),Gt=e.isSponsoredAd||((It=e.category)==null?void 0:It.toLowerCase().includes("ad"))||((Dt=e.category)==null?void 0:Dt.toLowerCase().includes("sponsor"))||((cr=e.category)==null?void 0:cr.toLowerCase().includes("promote"));return Re(s.jsx("div",{className:Ge("border-b border-gray-100 p-2 sm:p-4 md:p-6 text-left hover:bg-gray-50/50 transition-colors duration-300",Gt?"bg-amber-50/20 border-l-4 border-l-amber-500":"bg-white"),children:s.jsxs("div",{className:"flex gap-3 md:gap-4",children:[s.jsx("div",{onClick:Xe=>{n&&e.authorId&&(Xe.stopPropagation(),n(e.authorId))},onMouseEnter:Xe=>{n&&e.authorId&&window.matchMedia("(min-width: 1024px)").matches&&n(e.authorId)},className:Ge("w-8 h-8 md:w-9 md:h-9 rounded-full overflow-hidden border border-gray-150 shrink-0",n&&"cursor-pointer hover:opacity-80 hover:scale-105 active:scale-95 transition-all"),title:"Click or hover to view peer credentials",children:s.jsx(Bi,{src:e.authorProfile||`https://ui-avatars.com/api/?name=${encodeURIComponent(e.authorName)}&background=random`,className:"w-full h-full object-cover",alt:e.authorName})}),s.jsxs("div",{className:"flex-1 space-y-2.5 min-w-0",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-wrap",children:[s.jsx("span",{className:"text-gray-400 font-bold text-xs",children:"@"}),s.jsx("span",{className:Ge("font-bold text-xs text-black hover:underline cursor-pointer tracking-tight",n?"hover:text-red-650":""),onClick:Xe=>{n&&e.authorId?(Xe.stopPropagation(),n(e.authorId)):t(e)},onMouseEnter:Xe=>{n&&e.authorId&&window.matchMedia("(min-width: 1024px)").matches&&n(e.authorId)},title:"Click or hover to view peer credentials",children:e.authorName&&e.authorName.includes("@")?e.authorName.split("@")[0]:e.authorName}),s.jsx(So,{size:12,className:"shrink-0"}),s.jsx("span",{className:"text-[10px] font-bold text-gray-400",children:"•"}),s.jsx("span",{className:Ge("text-[8px] font-black tracking-[0.14em] uppercase shrink-0",Gt?"text-amber-600 bg-amber-50 px-1.5 py-0.5 rounded border border-amber-200":"text-red-650"),children:Gt?"SPONSORED PROMO":e.category}),e.publishDate&&s.jsxs("span",{className:"text-[9.5px] font-bold text-gray-500 font-mono flex items-center gap-1 shrink-0 bg-gray-50 px-1.5 py-0.5 rounded border border-gray-150",children:[s.jsx($p,{size:10,className:"text-red-600"}),s.jsx("span",{children:Q0(e.publishDate)})]}),e.isOfflineCached&&s.jsx("span",{className:"text-teal-600 bg-teal-50 p-1 rounded-full border border-teal-200 shrink-0 flex items-center justify-center cursor-help",title:"Offline Cached",children:s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"shrink-0 w-3 h-3",children:[s.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{fill:"currentColor",d:"M12.05 20q-3.35 0-5.7-2.325T4 12v-.175l-1.6 1.6l-1.4-1.4l4-4l4 4l-1.4 1.4l-1.6-1.6V12q0 2.5 1.763 4.25T12.05 18q.65 0 1.275-.15t1.225-.45l1.5 1.5q-.95.55-1.95.825T12.05 20M19 15.975l-4-4l1.4-1.4l1.6 1.6V12q0-2.5-1.763-4.25T11.95 6q-.65 0-1.275.15T9.45 6.6l-1.5-1.5q.95-.55 1.95-.825T11.95 4q3.35 0 5.7 2.325T20 12v.175l1.6-1.6l1.4 1.4z"})]})})]})}),s.jsx("h4",{onClick:()=>t(e),className:"text-base md:text-lg font-black text-black hover:text-red-600 transition-colors tracking-tight leading-snug cursor-pointer select-none line-clamp-2 underline underline-offset-2 decoration-1 hover:decoration-2",children:L0(e.title)}),s.jsxs("div",{className:"text-[13px] md:text-sm text-gray-800 leading-relaxed font-sans text-left speak-normal hyphens-auto",children:[s.jsxs("span",{children:[(e.summary||e.content).substring(0,80),"..."]}),s.jsx("button",{onClick:()=>t(e),className:"text-red-600 hover:text-red-700 font-extrabold ml-1.5 hover:underline text-[11px] uppercase inline-block font-sans",children:"Read More"})]}),(e.ctaUrl||e.Links&&e.Links.trim())&&s.jsx("div",{className:"pt-1 text-left",children:s.jsxs("button",{onClick:Xe=>{Xe.stopPropagation();const Xt=e.ctaUrl||e.Links.trim();window.open(Xt,"_blank","noopener,noreferrer")},className:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-[9.5px] font-black uppercase tracking-wider rounded-lg transition-all active:scale-95 shadow-xs cursor-pointer select-none mt-1",children:[s.jsx("span",{children:e.ctaText||"Discover More"}),s.jsx(za,{size:10,strokeWidth:3})]})}),vt(),s.jsxs("div",{className:"relative overflow-hidden w-full rounded-2xl sm:rounded-full bg-gradient-to-r from-blue-50/60 via-white/80 to-blue-50/50 dark:from-neutral-900/70 dark:via-neutral-800/70 dark:to-neutral-900/70 backdrop-blur-xl backdrop-saturate-150 border border-white/90 dark:border-white/10 shadow-[0_4px_24px_rgba(0,0,0,0.04),inset_0_1px_2px_rgba(255,255,255,0.9)] p-1.5 sm:p-2 mt-4 select-none",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-white/70 via-transparent to-white/20 dark:from-white/10 pointer-events-none rounded-2xl sm:rounded-full"}),s.jsxs("div",{className:"relative z-10 flex items-center justify-between gap-1 sm:gap-2 px-1 text-gray-700 dark:text-gray-200",children:[s.jsxs("button",{onClick:Xe=>{Xe.stopPropagation(),o(!a)},className:Ge("flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3.5 py-1.5 rounded-full transition-all duration-300 hover:scale-105 active:scale-95 cursor-pointer backdrop-blur-md shadow-2xs hover:shadow-xs",a?"bg-blue-600 text-white font-extrabold shadow-sm shadow-blue-500/25":"bg-white/75 hover:bg-white dark:bg-white/10 dark:hover:bg-white/20 text-gray-800 dark:text-gray-100 hover:text-blue-600 border border-white/80 dark:border-white/10"),title:"Comments",children:[s.jsx("div",{className:"flex items-center justify-center transition-transform group-hover:scale-110 shrink-0",children:s.jsx(jC,{size:21,className:a?"fill-white text-white":""})}),s.jsx("span",{className:"text-xs sm:text-[13px] font-black tracking-tight",children:cl(D)})]}),s.jsxs("div",{className:"relative flex items-center gap-1",children:[s.jsxs("button",{onClick:jt,className:Ge("flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3.5 py-1.5 rounded-full transition-all duration-300 hover:scale-105 active:scale-95 cursor-pointer backdrop-blur-md shadow-2xs hover:shadow-xs",y?"bg-blue-600 text-white font-extrabold shadow-sm shadow-blue-500/25":"bg-white/75 hover:bg-white dark:bg-white/10 dark:hover:bg-white/20 text-gray-800 dark:text-gray-100 hover:text-blue-600 border border-white/80 dark:border-white/10"),title:"Solidarity support",children:[s.jsx("div",{className:"flex items-center justify-center transition-transform group-hover:scale-110 shrink-0",children:s.jsx(hq,{size:21,className:y?"fill-white text-white":""})}),s.jsx("span",{className:"text-xs sm:text-[13px] font-black tracking-tight",children:cl(j)})]}),St.length>0&&s.jsxs("div",{className:"flex items-center gap-0.5 bg-white/85 dark:bg-white/15 backdrop-blur-md px-2 py-0.5 rounded-full border border-white/80 dark:border-white/10 text-[10px] text-gray-750 font-bold shrink-0 select-none shadow-2xs",children:[s.jsx("span",{className:"flex -space-x-1 font-sans",children:St.slice(0,3).map((Xe,Xt)=>s.jsx("span",{className:"scale-95",children:Xe.emoji},Xt))}),s.jsx("span",{className:"ml-1 text-[9px] font-black",children:Ct})]}),s.jsx(on,{children:J&&s.jsx(Qt.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"absolute bottom-12 left-0 bg-white/95 backdrop-blur-2xl border border-white/90 p-2 shadow-2xl flex gap-1.5 z-50 rounded-full",onClick:Xe=>Xe.stopPropagation(),children:D1e.map(Xe=>s.jsx("button",{onClick:()=>{Fe(Xe.index),Q(!1)},className:Ge("w-8 h-8 rounded-full flex items-center justify-center hover:scale-125 hover:bg-blue-50 transition-all text-base",K===Xe.index&&"bg-blue-100 text-lg"),title:Xe.label,children:Xe.emoji},Xe.index))})})]}),s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3.5 py-1.5 rounded-full bg-white/55 dark:bg-white/10 backdrop-blur-md border border-white/70 dark:border-white/10 shadow-2xs",title:"Views",children:[s.jsx("div",{className:"flex items-center justify-center shrink-0",children:s.jsx(IC,{size:21})}),s.jsx("span",{className:"text-xs sm:text-[13px] font-black text-gray-800 dark:text-gray-100 tracking-tight",children:cl(U)})]}),s.jsxs("button",{onClick:Pt,className:Ge("flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3.5 py-1.5 rounded-full transition-all duration-300 hover:scale-105 active:scale-95 cursor-pointer backdrop-blur-md shadow-2xs hover:shadow-xs",A?"bg-amber-500 text-white font-extrabold shadow-sm shadow-amber-500/25":"bg-white/75 hover:bg-white dark:bg-white/10 dark:hover:bg-white/20 text-gray-800 dark:text-gray-100 hover:text-amber-500 border border-white/80 dark:border-white/10"),title:"Bookmark",children:[s.jsx("div",{className:"flex items-center justify-center transition-transform group-hover:scale-110 shrink-0",children:s.jsx(fq,{size:20,className:A?"fill-white text-white":""})}),s.jsx("span",{className:"text-xs sm:text-[13px] font-black tracking-tight",children:cl(X)})]}),s.jsxs("button",{onClick:Ae,className:"flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3.5 py-1.5 rounded-full transition-all duration-300 hover:scale-105 active:scale-95 cursor-pointer backdrop-blur-md bg-white/75 hover:bg-white dark:bg-white/10 dark:hover:bg-white/20 text-gray-800 dark:text-gray-100 hover:text-green-600 border border-white/80 dark:border-white/10 shadow-2xs hover:shadow-xs",title:"Share",children:[s.jsx("div",{className:"flex items-center justify-center transition-transform group-hover:scale-110 shrink-0",children:s.jsx(Uw,{size:21})}),s.jsx("span",{className:"text-xs sm:text-[13px] font-black tracking-tight",children:cl(B)})]})]})]}),s.jsx(on,{children:a&&s.jsxs(Qt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"w-full bg-[#0f1419] text-white p-3.5 sm:p-4 rounded-2xl border border-gray-800 shadow-lg text-left overflow-hidden break-words min-w-0 mt-3",onClick:Xe=>Xe.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-1.5 h-3.5 bg-indigo-500 rounded-full"}),s.jsxs("span",{className:"text-[10px] font-black tracking-widest text-gray-200 uppercase",children:["Comments (",c.length,")"]})]}),s.jsx("button",{onClick:()=>o(!1),className:"text-gray-400 hover:text-white text-xs font-bold px-2 py-0.5 rounded-full hover:bg-gray-800",children:"✕"})]}),s.jsxs("form",{onSubmit:Ie,className:"space-y-2 mb-4",children:[ae&&s.jsxs("div",{className:"flex items-center justify-between bg-indigo-950/80 border border-indigo-500/40 px-3 py-1.5 rounded-xl text-xs text-indigo-200 font-bold animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[s.jsx("span",{className:"uppercase text-[9px] font-black tracking-widest text-indigo-400 shrink-0",children:"Replying to"}),s.jsxs("span",{className:"font-extrabold font-mono text-white text-[11px] truncate",children:["@",ae.authorName]})]}),s.jsx("button",{type:"button",onClick:()=>qe(null),className:"text-gray-400 hover:text-red-400 font-extrabold text-xs px-1 rounded cursor-pointer shrink-0 ml-2",title:"Cancel reply",children:"✕"})]}),s.jsxs("div",{className:"flex gap-2 bg-[#15181c] border border-gray-800 rounded-full p-1 pl-4 items-center focus-within:border-indigo-500/50 transition-all",children:[s.jsx("input",{type:"text",placeholder:ae?`Replying to @${ae.authorName}...`:"Type comment or mention @Mega AI...",value:f,onChange:Xe=>m(Xe.target.value),className:"flex-1 bg-transparent text-white text-xs outline-none focus:outline-none placeholder-gray-500 border-none py-1.5 focus:ring-0"}),s.jsx("button",{type:"submit",disabled:F||!f.trim(),className:"bg-indigo-600 hover:bg-indigo-700 disabled:opacity-40 text-white font-extrabold uppercase px-3 h-7 rounded-full text-[9px] tracking-wider transition-colors shrink-0 cursor-pointer",children:"Reply"})]}),s.jsx("div",{className:"flex items-center gap-1.5 px-1",children:s.jsxs("button",{type:"button",onClick:()=>{f.includes("@Mega AI")||m(Xe=>(Xe.trim()+" @Mega AI ").trimStart())},className:"text-[9px] font-black uppercase tracking-wider text-amber-400 bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 px-2 py-0.5 rounded-full flex items-center gap-1 transition-all cursor-pointer",children:[s.jsx(Xi,{size:10,className:"text-amber-400"})," Mention @Mega AI"]})})]}),s.jsx("div",{className:"space-y-4 max-h-72 overflow-y-auto pr-1",children:c.length>0?(()=>{const Xe=or=>({A:"bg-red-500",B:"bg-pink-500",C:"bg-purple-500",D:"bg-indigo-500",E:"bg-blue-500",F:"bg-cyan-500",G:"bg-teal-500",H:"bg-emerald-500",I:"bg-green-500",J:"bg-yellow-500",K:"bg-amber-500",L:"bg-orange-500",M:"bg-rose-500",N:"bg-red-600",O:"bg-indigo-600",P:"bg-purple-600",Q:"bg-pink-600",R:"bg-blue-600",S:"bg-violet-600",T:"bg-rose-600",U:"bg-teal-600",V:"bg-emerald-600",W:"bg-indigo-700",X:"bg-purple-700",Y:"bg-sky-500",Z:"bg-fuchsia-600"})[or]||"bg-slate-600",Xt=async(or,Wr)=>{if(!Ne.currentUser)return;const dr=st(fe,"articles",e.id,"comments",or),yn=`liked_comment_${or}_${Ne.currentUser.uid}`;localStorage.getItem(yn)==="true"?(await Ir(dr,{likeCount:Cn(-1)}),localStorage.removeItem(yn)):(await Ir(dr,{likeCount:Cn(1)}),localStorage.setItem(yn,"true"))};return c.filter(or=>!or.parentId).map(or=>{const Wr=or.authorName?or.authorName.charAt(0).toUpperCase():"?",dr=Ne.currentUser?localStorage.getItem(`liked_comment_${or.id}_${Ne.currentUser.uid}`)==="true":!1,yn=c.filter(He=>He.parentId===or.id);return s.jsxs("div",{className:"border-b border-gray-800/80 pb-3 last:border-0 last:pb-0 text-left animate-fade-in",children:[s.jsxs("div",{className:"flex gap-2.5 text-xs",children:[or.photoURL?s.jsx(Bi,{src:or.photoURL,className:"w-7 h-7 rounded-full border border-gray-800 object-cover shrink-0 mt-0.5",alt:""}):s.jsx("div",{className:Ge("w-7 h-7 rounded-full flex items-center justify-center text-white font-extrabold text-[10px] uppercase shrink-0 shadow-md",Xe(Wr)),children:Wr}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[s.jsx("span",{className:"font-extrabold text-[#cbd5e1] text-[11px] truncate",children:or.authorName}),or.userId==="mega-ai-bot"&&s.jsx("span",{className:"text-[8px] bg-indigo-500/20 text-indigo-300 px-1.5 py-0.5 rounded-full font-black uppercase tracking-wider border border-indigo-500/30",children:"AI"})]}),s.jsxs("button",{type:"button",onClick:He=>{He.stopPropagation(),Xt(or.id,or.likeCount||0)},className:Ge("flex items-center gap-1 p-0.5 text-gray-400 hover:text-red-500 transition-all cursor-pointer shrink-0 ml-2",dr&&"text-red-500"),children:[s.jsx("span",{className:"text-[9px] text-gray-400",children:(or.likeCount||0)>0?cl(or.likeCount):""}),s.jsx(Fl,{size:12,className:Ge("transition-transform hover:scale-110",dr?"fill-red-500 text-red-500 ":"text-gray-500")})]})]}),s.jsx("div",{className:"text-gray-200 font-sans leading-relaxed text-[11px] mt-0.5 text-left break-words",children:L2(or.content)}),s.jsx("div",{className:"flex items-center gap-3 mt-1.5",children:s.jsxs("button",{type:"button",onClick:()=>qe({id:or.id,parentId:or.id,authorName:or.authorName}),className:"text-[9.5px] font-black text-indigo-400 hover:text-indigo-300 uppercase tracking-wider cursor-pointer hover:underline flex items-center gap-1",children:[s.jsx(nR,{size:10}),s.jsx("span",{children:"Reply"})]})})]})]}),yn.length>0&&s.jsx("div",{className:"ml-4 pl-3 border-l-2 border-indigo-500/30 space-y-2.5 mt-2.5",children:yn.map(He=>{const Rt=He.authorName?He.authorName.charAt(0).toUpperCase():"?",nr=Ne.currentUser?localStorage.getItem(`liked_comment_${He.id}_${Ne.currentUser.uid}`)==="true":!1;return s.jsxs("div",{className:"flex gap-2 text-xs text-left bg-indigo-950/20 p-2 rounded-xl border border-indigo-900/30",children:[He.photoURL?s.jsx(Bi,{src:He.photoURL,className:"w-5.5 h-5.5 rounded-full border border-gray-800 object-cover shrink-0 mt-0.5",alt:""}):s.jsx("div",{className:Ge("w-5.5 h-5.5 rounded-full flex items-center justify-center text-white font-extrabold text-[9px] uppercase shrink-0 shadow-md",Xe(Rt)),children:Rt}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap truncate",children:[s.jsx("span",{className:"font-extrabold text-[#e2e8f0] text-[10px] truncate",children:He.authorName}),He.replyToAuthor&&s.jsxs("span",{className:"text-[8.5px] text-indigo-300 font-mono font-bold",children:["replying to @",He.replyToAuthor]})]}),s.jsxs("button",{type:"button",onClick:fr=>{fr.stopPropagation(),Xt(He.id,He.likeCount||0)},className:Ge("flex items-center gap-1 p-0.5 text-gray-400 hover:text-red-500 transition-all cursor-pointer shrink-0 ml-1",nr&&"text-red-500"),children:[s.jsx("span",{className:"text-[8.5px] text-gray-400",children:(He.likeCount||0)>0?cl(He.likeCount):""}),s.jsx(Fl,{size:10,className:Ge(nr?"fill-red-500 text-red-500":"text-gray-500")})]})]}),s.jsx("div",{className:"text-gray-200 font-sans leading-relaxed text-[10.5px] mt-0.5 break-words",children:L2(He.content)}),s.jsx("div",{className:"flex items-center gap-3 mt-1",children:s.jsxs("button",{type:"button",onClick:()=>qe({id:He.id,parentId:or.id,authorName:He.authorName}),className:"text-[8.5px] font-black text-indigo-400 hover:text-indigo-300 uppercase tracking-wider cursor-pointer hover:underline flex items-center gap-0.5",children:[s.jsx(nR,{size:9}),s.jsx("span",{children:"Reply"})]})})]})]},He.id)})})]},or.id)})})():s.jsx("p",{className:"text-[10px] text-gray-500 font-bold uppercase italic py-4 text-center",children:"No commentary yet. Let's talk about it!"})})]})})]})]})}))}return Re(r==="big"||r==="featured"?s.jsxs("div",{onClick:()=>t(e),className:"group cursor-pointer bg-white border border-gray-100 hover:shadow-xl transition-all duration-300 overflow-hidden flex flex-col text-left",children:[s.jsxs("div",{className:"relative aspect-[16/9] md:aspect-[21/10] overflow-hidden bg-gray-950",children:[s.jsx(Bi,{src:e.featuredImageUrl,className:"w-full h-full object-cover transition-all duration-[4000ms] group-hover:scale-105",alt:e.title}),s.jsxs("div",{className:"absolute top-4 left-4 flex gap-1.5",children:[s.jsx("span",{className:"bg-red-600 text-white px-3 py-1.5 text-[9px] font-black uppercase tracking-widest shadow-lg",children:e.category}),e.isOfflineCached&&s.jsx("span",{className:"bg-teal-600 text-white p-2.5 shadow-lg flex items-center justify-center cursor-help",title:"Offline Cached",children:s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"shrink-0 w-3.5 h-3.5",children:[s.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{fill:"currentColor",d:"M12.05 20q-3.35 0-5.7-2.325T4 12v-.175l-1.6 1.6l-1.4-1.4l4-4l4 4l-1.4 1.4l-1.6-1.6V12q0 2.5 1.763 4.25T12.05 18q.65 0 1.275-.15t1.225-.45l1.5 1.5q-.95.55-1.95.825T12.05 20M19 15.975l-4-4l1.4-1.4l1.6 1.6V12q0-2.5-1.763-4.25T11.95 6q-.65 0-1.275.15T9.45 6.6l-1.5-1.5q.95-.55 1.95-.825T11.95 4q3.35 0 5.7 2.325T20 12v.175l1.6-1.6l1.4 1.4z"})]})})]})]}),s.jsxs("div",{className:"p-6 md:p-8 space-y-4",children:[s.jsx("h3",{className:"text-xl md:text-3xl font-serif font-black tracking-tight leading-tight text-black group-hover:text-red-650 transition-colors italic underline underline-offset-4 decoration-2",children:L0(e.title)}),s.jsx("p",{className:"text-sm border-l-2 border-red-500 pl-4 font-serif text-gray-750 italic",children:e.summary}),s.jsx("p",{className:"text-xs text-gray-650 leading-relaxed font-sans line-clamp-3",children:e.content}),s.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-100 flex-wrap gap-2",children:[s.jsxs("div",{onClick:St=>{n&&e.authorId&&(St.stopPropagation(),n(e.authorId))},onMouseEnter:St=>{n&&e.authorId&&window.matchMedia("(min-width: 1024px)").matches&&n(e.authorId)},className:Ge("flex items-center gap-2 select-none",n&&"cursor-pointer hover:opacity-80 hover:scale-103 active:scale-97 transition-all"),title:"Click or hover to view peer credentials",children:[s.jsx(Bi,{src:e.authorProfile||`https://ui-avatars.com/api/?name=${encodeURIComponent(e.authorName)}&background=random`,className:"w-6 h-6 rounded-full border border-gray-200 shrink-0",alt:e.authorName}),s.jsxs("span",{className:"text-[9px] font-black uppercase text-black hover:underline",children:["By ",e.authorName&&e.authorName.includes("@")?e.authorName.split("@")[0]:e.authorName]}),e.publishDate&&s.jsxs("span",{className:"text-[9px] font-bold text-gray-500 font-mono flex items-center gap-1 shrink-0 ml-1",children:[s.jsx($p,{size:10,className:"text-red-600"}),s.jsx("span",{children:Ipe(e.publishDate)})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[e.Links&&e.Links.trim()&&s.jsxs("button",{onClick:St=>{St.stopPropagation(),window.open(e.Links.trim(),"_blank","noopener,noreferrer")},className:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-[9.5px] font-black uppercase tracking-wider rounded-lg transition-all active:scale-95 shadow-xs cursor-pointer select-none",children:[s.jsx("span",{children:e.ctaText||"Discover More"}),s.jsx(za,{size:10,strokeWidth:3})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-red-600 font-bold tracking-widest text-[9px] uppercase hover:underline",children:["Read dispatch ",s.jsx(Ip,{size:11})]})]})]})]})]}):r==="magazine"||r==="small"?s.jsxs("div",{onClick:()=>t(e),className:"group cursor-pointer space-y-4 pb-6 border-b border-gray-100 last:border-0 text-left",children:[s.jsx("div",{className:"aspect-[4/3] overflow-hidden bg-gray-50 rounded-xl border border-gray-100",children:s.jsx(Bi,{src:e.featuredImageUrl,className:"w-full h-full object-[center_top] object-cover transition-all duration-1000 group-hover:scale-103",alt:e.title})}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[9px] font-extrabold font-mono text-red-600 shrink-0 flex-wrap",children:[s.jsx("span",{className:"uppercase tracking-widest",children:e.category}),e.isOfflineCached&&s.jsx("span",{className:"text-teal-600 bg-teal-50 p-1 rounded-full border border-teal-200 flex items-center justify-center cursor-help",children:s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"shrink-0 w-3 h-3",children:[s.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{fill:"currentColor",d:"M12.05 20q-3.35 0-5.7-2.325T4 12v-.175l-1.6 1.6l-1.4-1.4l4-4l4 4l-1.4 1.4l-1.6-1.6V12q0 2.5 1.763 4.25T12.05 18q.65 0 1.275-.15t1.225-.45l1.5 1.5q-.95.55-1.95.825T12.05 20M19 15.975l-4-4l1.4-1.4l1.6 1.6V12q0-2.5-1.763-4.25T11.95 6q-.65 0-1.275.15T9.45 6.6l-1.5-1.5q.95-.55 1.95-.825T11.95 4q3.35 0 5.7 2.325T20 12v.175l1.6-1.6l1.4 1.4z"})]})}),e.publishDate&&s.jsxs("span",{className:"text-[9px] font-semibold text-gray-400 lowercase normal-case tracking-normal",children:["• ",Q0(e.publishDate)]})]}),s.jsx("div",{className:"flex items-center gap-1.5 text-[10px] text-gray-400 font-bold",children:s.jsxs("span",{className:"flex items-center gap-0.5",children:[s.jsx(IC,{size:10})," ",cl(U)]})})]}),s.jsx("h4",{className:"text-base font-serif font-black text-black leading-snug group-hover:text-red-600 transition-colors underline underline-offset-2 decoration-1",children:L0(e.title)}),s.jsx("p",{className:"text-xs text-gray-650 line-clamp-2 italic font-serif",children:e.summary}),e.Links&&e.Links.trim()&&s.jsx("div",{className:"pt-1 text-left",children:s.jsxs("button",{onClick:St=>{St.stopPropagation(),window.open(e.Links.trim(),"_blank","noopener,noreferrer")},className:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-[9.5px] font-black uppercase tracking-wider rounded-lg transition-all active:scale-95 shadow-xs cursor-pointer select-none",children:[s.jsx("span",{children:e.ctaText||"Discover More"}),s.jsx(za,{size:10,strokeWidth:3})]})})]})]}):s.jsxs("div",{onClick:()=>t(e),className:"group cursor-pointer flex gap-4 py-4 border-b border-gray-50 last:border-0 text-left",children:[s.jsxs("div",{className:"flex-1 space-y-1.5 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[8px] font-black font-mono text-red-600 shrink-0 flex-wrap",children:[s.jsx("span",{className:"uppercase tracking-wider",children:e.category}),e.isOfflineCached&&s.jsx("span",{className:"text-teal-600 bg-teal-50 p-1 rounded-full border border-teal-200 flex items-center justify-center cursor-help",children:s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"shrink-0 w-3 h-3",children:[s.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{fill:"currentColor",d:"M12.05 20q-3.35 0-5.7-2.325T4 12v-.175l-1.6 1.6l-1.4-1.4l4-4l4 4l-1.4 1.4l-1.6-1.6V12q0 2.5 1.763 4.25T12.05 18q.65 0 1.275-.15t1.225-.45l1.5 1.5q-.95.55-1.95.825T12.05 20M19 15.975l-4-4l1.4-1.4l1.6 1.6V12q0-2.5-1.763-4.25T11.95 6q-.65 0-1.275.15T9.45 6.6l-1.5-1.5q.95-.55 1.95-.825T11.95 4q3.35 0 5.7 2.325T20 12v.175l1.6-1.6l1.4 1.4z"})]})}),e.publishDate&&s.jsxs("span",{className:"text-[9px] font-medium text-gray-400 lowercase normal-case tracking-normal",children:["• ",Q0(e.publishDate)]})]}),s.jsx("h5",{className:"text-xs font-serif font-black text-black leading-snug truncate group-hover:text-red-600 transition-colors underline decoration-1",children:L0(e.title)}),s.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[s.jsxs("p",{onClick:St=>{n&&e.authorId&&(St.stopPropagation(),n(e.authorId))},onMouseEnter:St=>{n&&e.authorId&&window.matchMedia("(min-width: 1024px)").matches&&n(e.authorId)},className:Ge("text-[9px] font-black text-gray-400 uppercase tracking-widest select-none",n&&"cursor-pointer hover:text-black hover:underline active:scale-97 transition-all"),title:"Click or hover to view peer credentials",children:["By ",e.authorName&&e.authorName.includes("@")?e.authorName.split("@")[0]:e.authorName]}),e.Links&&e.Links.trim()&&s.jsxs("button",{onClick:St=>{St.stopPropagation(),window.open(e.Links.trim(),"_blank","noopener,noreferrer")},className:"inline-flex items-center gap-1 px-2 py-1 bg-red-650 hover:bg-red-700 text-white text-[8px] font-black uppercase tracking-wider rounded transition-all active:scale-95 shadow-xs cursor-pointer select-none",children:[s.jsx("span",{children:"Discover"}),s.jsx(za,{size:8,strokeWidth:3})]})]})]}),s.jsx("div",{className:"w-12 h-12 bg-gray-100 rounded overflow-hidden shrink-0 border border-gray-100",children:s.jsx(Bi,{src:e.featuredImageUrl,className:"w-full h-full object-cover",alt:""})})]}))};var r1={exports:{}},Dk={},Mk,jM;function M1e(){if(jM)return Mk;jM=1;function e(t,r){typeof r=="boolean"&&(r={forever:r}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=r||{},this._maxRetryTime=r&&r.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return Mk=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var r=new Date().getTime();if(t&&r-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var i=this;return this._timer=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},n),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(t,r){this._fn=t,r&&(r.timeout&&(this._operationTimeout=r.timeout),r.cb&&(this._operationTimeoutCb=r.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},e.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},e.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},r=null,n=0,i=0;i=n&&(r=a,n=c)}return r},Mk}var IM;function L1e(){return IM||(IM=1,(function(e){var t=M1e();e.operation=function(r){var n=e.timeouts(r);return new t(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},e.timeouts=function(r){if(r instanceof Array)return[].concat(r);var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var i in r)n[i]=r[i];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var a=[],o=0;o{const f=h.retries-(c-1);return o.attemptNumber=c,o.retriesLeft=f,o},i=o=>t.includes(o),a=(o,c)=>new Promise((h,f)=>{c={onFailedAttempt:()=>{},retries:10,...c};const m=e.operation(c);m.attempt(async y=>{try{h(await o(y))}catch(w){if(!(w instanceof Error)){f(new TypeError(`Non-error was thrown: "${w}". You should only throw errors.`));return}if(w instanceof r)m.stop(),f(w.originalError);else if(w instanceof TypeError&&!i(w.message))m.stop(),f(w);else{n(w,y,c);try{await c.onFailedAttempt(w)}catch(A){f(A);return}m.retry(w)||f(m.mainError())}}})});return r1.exports=a,r1.exports.default=a,r1.exports.AbortError=r,r1.exports}B1e();var z1e={};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var OM;(function(e){e.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",e.PYTHON="PYTHON"})(OM||(OM={}));var RM;(function(e){e.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",e.OUTCOME_OK="OUTCOME_OK",e.OUTCOME_FAILED="OUTCOME_FAILED",e.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(RM||(RM={}));var DM;(function(e){e.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",e.SILENT="SILENT",e.WHEN_IDLE="WHEN_IDLE",e.INTERRUPT="INTERRUPT"})(DM||(DM={}));var MM;(function(e){e.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",e.STRING="STRING",e.NUMBER="NUMBER",e.INTEGER="INTEGER",e.BOOLEAN="BOOLEAN",e.ARRAY="ARRAY",e.OBJECT="OBJECT",e.NULL="NULL"})(MM||(MM={}));var LM;(function(e){e.PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",e.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",e.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",e.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",e.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",e.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",e.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH"})(LM||(LM={}));var UM;(function(e){e.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",e.NO_AUTH="NO_AUTH",e.API_KEY_AUTH="API_KEY_AUTH",e.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",e.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",e.OAUTH="OAUTH",e.OIDC_AUTH="OIDC_AUTH"})(UM||(UM={}));var BM;(function(e){e.HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",e.HTTP_IN_QUERY="HTTP_IN_QUERY",e.HTTP_IN_HEADER="HTTP_IN_HEADER",e.HTTP_IN_PATH="HTTP_IN_PATH",e.HTTP_IN_BODY="HTTP_IN_BODY",e.HTTP_IN_COOKIE="HTTP_IN_COOKIE"})(BM||(BM={}));var zM;(function(e){e.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",e.SIMPLE_SEARCH="SIMPLE_SEARCH",e.ELASTIC_SEARCH="ELASTIC_SEARCH"})(zM||(zM={}));var VM;(function(e){e.UNSPECIFIED="UNSPECIFIED",e.BLOCKING="BLOCKING",e.NON_BLOCKING="NON_BLOCKING"})(VM||(VM={}));var FM;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.MODE_DYNAMIC="MODE_DYNAMIC"})(FM||(FM={}));var $M;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.AUTO="AUTO",e.ANY="ANY",e.NONE="NONE",e.VALIDATED="VALIDATED"})($M||($M={}));var HM;(function(e){e.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH",e.MINIMAL="MINIMAL"})(HM||(HM={}));var GM;(function(e){e.DONT_ALLOW="DONT_ALLOW",e.ALLOW_ADULT="ALLOW_ADULT",e.ALLOW_ALL="ALLOW_ALL"})(GM||(GM={}));var qM;(function(e){e.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",e.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",e.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",e.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",e.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",e.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",e.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",e.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",e.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",e.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",e.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK"})(qM||(qM={}));var WM;(function(e){e.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",e.SEVERITY="SEVERITY",e.PROBABILITY="PROBABILITY"})(WM||(WM={}));var KM;(function(e){e.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",e.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",e.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",e.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",e.BLOCK_NONE="BLOCK_NONE",e.OFF="OFF"})(KM||(KM={}));var YM;(function(e){e.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",e.STOP="STOP",e.MAX_TOKENS="MAX_TOKENS",e.SAFETY="SAFETY",e.RECITATION="RECITATION",e.LANGUAGE="LANGUAGE",e.OTHER="OTHER",e.BLOCKLIST="BLOCKLIST",e.PROHIBITED_CONTENT="PROHIBITED_CONTENT",e.SPII="SPII",e.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",e.IMAGE_SAFETY="IMAGE_SAFETY",e.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",e.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",e.NO_IMAGE="NO_IMAGE",e.IMAGE_RECITATION="IMAGE_RECITATION",e.IMAGE_OTHER="IMAGE_OTHER"})(YM||(YM={}));var XM;(function(e){e.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",e.NEGLIGIBLE="NEGLIGIBLE",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(XM||(XM={}));var QM;(function(e){e.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",e.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",e.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",e.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",e.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})(QM||(QM={}));var ZM;(function(e){e.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",e.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",e.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",e.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",e.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE"})(ZM||(ZM={}));var JM;(function(e){e.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",e.SAFETY="SAFETY",e.OTHER="OTHER",e.BLOCKLIST="BLOCKLIST",e.PROHIBITED_CONTENT="PROHIBITED_CONTENT",e.IMAGE_SAFETY="IMAGE_SAFETY",e.MODEL_ARMOR="MODEL_ARMOR",e.JAILBREAK="JAILBREAK"})(JM||(JM={}));var e9;(function(e){e.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",e.ON_DEMAND="ON_DEMAND",e.ON_DEMAND_PRIORITY="ON_DEMAND_PRIORITY",e.ON_DEMAND_FLEX="ON_DEMAND_FLEX",e.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(e9||(e9={}));var t9;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.AUDIO="AUDIO"})(t9||(t9={}));var r9;(function(e){e.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",e.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",e.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",e.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(r9||(r9={}));var n9;(function(e){e.TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",e.TUNING_MODE_FULL="TUNING_MODE_FULL",e.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER"})(n9||(n9={}));var i9;(function(e){e.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",e.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",e.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",e.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",e.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",e.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",e.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(i9||(i9={}));var s9;(function(e){e.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",e.JOB_STATE_QUEUED="JOB_STATE_QUEUED",e.JOB_STATE_PENDING="JOB_STATE_PENDING",e.JOB_STATE_RUNNING="JOB_STATE_RUNNING",e.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",e.JOB_STATE_FAILED="JOB_STATE_FAILED",e.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",e.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",e.JOB_STATE_PAUSED="JOB_STATE_PAUSED",e.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",e.JOB_STATE_UPDATING="JOB_STATE_UPDATING",e.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(s9||(s9={}));var a9;(function(e){e.TUNING_JOB_STATE_UNSPECIFIED="TUNING_JOB_STATE_UNSPECIFIED",e.TUNING_JOB_STATE_WAITING_FOR_QUOTA="TUNING_JOB_STATE_WAITING_FOR_QUOTA",e.TUNING_JOB_STATE_PROCESSING_DATASET="TUNING_JOB_STATE_PROCESSING_DATASET",e.TUNING_JOB_STATE_WAITING_FOR_CAPACITY="TUNING_JOB_STATE_WAITING_FOR_CAPACITY",e.TUNING_JOB_STATE_TUNING="TUNING_JOB_STATE_TUNING",e.TUNING_JOB_STATE_POST_PROCESSING="TUNING_JOB_STATE_POST_PROCESSING"})(a9||(a9={}));var o9;(function(e){e.AGGREGATION_METRIC_UNSPECIFIED="AGGREGATION_METRIC_UNSPECIFIED",e.AVERAGE="AVERAGE",e.MODE="MODE",e.STANDARD_DEVIATION="STANDARD_DEVIATION",e.VARIANCE="VARIANCE",e.MINIMUM="MINIMUM",e.MAXIMUM="MAXIMUM",e.MEDIAN="MEDIAN",e.PERCENTILE_P90="PERCENTILE_P90",e.PERCENTILE_P95="PERCENTILE_P95",e.PERCENTILE_P99="PERCENTILE_P99"})(o9||(o9={}));var l9;(function(e){e.PAIRWISE_CHOICE_UNSPECIFIED="PAIRWISE_CHOICE_UNSPECIFIED",e.BASELINE="BASELINE",e.CANDIDATE="CANDIDATE",e.TIE="TIE"})(l9||(l9={}));var c9;(function(e){e.TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",e.TUNING_TASK_I2V="TUNING_TASK_I2V",e.TUNING_TASK_T2V="TUNING_TASK_T2V",e.TUNING_TASK_R2V="TUNING_TASK_R2V"})(c9||(c9={}));var u9;(function(e){e.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",e.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",e.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",e.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH",e.MEDIA_RESOLUTION_ULTRA_HIGH="MEDIA_RESOLUTION_ULTRA_HIGH"})(u9||(u9={}));var d9;(function(e){e.TOOL_TYPE_UNSPECIFIED="TOOL_TYPE_UNSPECIFIED",e.GOOGLE_SEARCH_WEB="GOOGLE_SEARCH_WEB",e.GOOGLE_SEARCH_IMAGE="GOOGLE_SEARCH_IMAGE",e.URL_CONTEXT="URL_CONTEXT",e.GOOGLE_MAPS="GOOGLE_MAPS",e.FILE_SEARCH="FILE_SEARCH"})(d9||(d9={}));var h9;(function(e){e.COLLECTION="COLLECTION"})(h9||(h9={}));var f9;(function(e){e.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",e.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",e.BALANCED="BALANCED",e.PRIORITIZE_COST="PRIORITIZE_COST"})(f9||(f9={}));var p9;(function(e){e.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",e.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER"})(p9||(p9={}));var m9;(function(e){e.PROMINENT_PEOPLE_UNSPECIFIED="PROMINENT_PEOPLE_UNSPECIFIED",e.ALLOW_PROMINENT_PEOPLE="ALLOW_PROMINENT_PEOPLE",e.BLOCK_PROMINENT_PEOPLE="BLOCK_PROMINENT_PEOPLE"})(m9||(m9={}));var g9;(function(e){e.PREDICT="PREDICT",e.EMBED_CONTENT="EMBED_CONTENT"})(g9||(g9={}));var x9;(function(e){e.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",e.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",e.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",e.BLOCK_NONE="BLOCK_NONE"})(x9||(x9={}));var y9;(function(e){e.auto="auto",e.en="en",e.ja="ja",e.ko="ko",e.hi="hi",e.zh="zh",e.pt="pt",e.es="es"})(y9||(y9={}));var b9;(function(e){e.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",e.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",e.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",e.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",e.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})(b9||(b9={}));var v9;(function(e){e.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",e.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",e.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",e.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(v9||(v9={}));var w9;(function(e){e.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",e.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",e.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",e.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(w9||(w9={}));var N9;(function(e){e.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",e.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",e.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",e.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",e.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",e.EDIT_MODE_STYLE="EDIT_MODE_STYLE",e.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",e.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(N9||(N9={}));var E9;(function(e){e.FOREGROUND="FOREGROUND",e.BACKGROUND="BACKGROUND",e.PROMPT="PROMPT",e.SEMANTIC="SEMANTIC",e.INTERACTIVE="INTERACTIVE"})(E9||(E9={}));var A9;(function(e){e.ASSET="ASSET",e.STYLE="STYLE"})(A9||(A9={}));var k9;(function(e){e.INSERT="INSERT",e.REMOVE="REMOVE",e.REMOVE_STATIC="REMOVE_STATIC",e.OUTPAINT="OUTPAINT"})(k9||(k9={}));var _9;(function(e){e.OPTIMIZED="OPTIMIZED",e.LOSSLESS="LOSSLESS"})(_9||(_9={}));var S9;(function(e){e.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",e.PREFERENCE_TUNING="PREFERENCE_TUNING",e.DISTILLATION="DISTILLATION"})(S9||(S9={}));var C9;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.STATE_PENDING="STATE_PENDING",e.STATE_ACTIVE="STATE_ACTIVE",e.STATE_FAILED="STATE_FAILED"})(C9||(C9={}));var j9;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.PROCESSING="PROCESSING",e.ACTIVE="ACTIVE",e.FAILED="FAILED"})(j9||(j9={}));var I9;(function(e){e.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",e.UPLOADED="UPLOADED",e.GENERATED="GENERATED",e.REGISTERED="REGISTERED"})(I9||(I9={}));var T9;(function(e){e.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",e.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",e.RESPONSE_REJECTED="RESPONSE_REJECTED",e.NEED_MORE_INPUT="NEED_MORE_INPUT"})(T9||(T9={}));var P9;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.AUDIO="AUDIO",e.DOCUMENT="DOCUMENT"})(P9||(P9={}));var O9;(function(e){e.VAD_SIGNAL_TYPE_UNSPECIFIED="VAD_SIGNAL_TYPE_UNSPECIFIED",e.VAD_SIGNAL_TYPE_SOS="VAD_SIGNAL_TYPE_SOS",e.VAD_SIGNAL_TYPE_EOS="VAD_SIGNAL_TYPE_EOS"})(O9||(O9={}));var R9;(function(e){e.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",e.ACTIVITY_START="ACTIVITY_START",e.ACTIVITY_END="ACTIVITY_END"})(R9||(R9={}));var D9;(function(e){e.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",e.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",e.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(D9||(D9={}));var M9;(function(e){e.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",e.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",e.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(M9||(M9={}));var L9;(function(e){e.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",e.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",e.NO_INTERRUPTION="NO_INTERRUPTION"})(L9||(L9={}));var U9;(function(e){e.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",e.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",e.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT"})(U9||(U9={}));var B9;(function(e){e.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",e.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",e.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",e.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",e.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",e.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",e.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",e.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",e.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",e.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",e.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",e.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",e.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})(B9||(B9={}));var z9;(function(e){e.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",e.QUALITY="QUALITY",e.DIVERSITY="DIVERSITY",e.VOCALIZATION="VOCALIZATION"})(z9||(z9={}));var V9;(function(e){e.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",e.PLAY="PLAY",e.PAUSE="PAUSE",e.STOP="STOP",e.RESET_CONTEXT="RESET_CONTEXT"})(V9||(V9={}));/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var F9;(function(e){e.PAGED_ITEM_BATCH_JOBS="batchJobs",e.PAGED_ITEM_MODELS="models",e.PAGED_ITEM_TUNING_JOBS="tuningJobs",e.PAGED_ITEM_FILES="files",e.PAGED_ITEM_CACHED_CONTENTS="cachedContents",e.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",e.PAGED_ITEM_DOCUMENTS="documents"})(F9||(F9={}));function W2(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function zs(e){return this instanceof zs?(this.v=e,this):new zs(e)}function Y1(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(A){return function(S){return Promise.resolve(S).then(A,y)}}function c(A,S){n[A]&&(i[A]=function(j){return new Promise(function(T,D){a.push([A,j,T,D])>1||h(A,j)})},S&&(i[A]=S(i[A])))}function h(A,S){try{f(n[A](S))}catch(j){w(a[0][3],j)}}function f(A){A.value instanceof zs?Promise.resolve(A.value.v).then(m,y):w(a[0][2],A)}function m(A){h("next",A)}function y(A){h("throw",A)}function w(A,S){A(S),a.shift(),a.length&&h(a[0][0],a[0][1])}}function Z0(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof $9=="function"?$9(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=e[a]&&function(o){return new Promise(function(c,h){o=e[a](o),i(c,h,o.done,o.value)})}}function i(a,o,c,h){Promise.resolve(h).then(function(f){a({value:f,done:c})},o)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */let tK=function(){const{crypto:e}=globalThis;if(e!=null&&e.randomUUID)return tK=e.randomUUID.bind(e),e.randomUUID();const t=new Uint8Array(1),r=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};const V1e=()=>tK();/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function rj(e){return typeof e=="object"&&e!==null&&("name"in e&&e.name==="AbortError"||"message"in e&&String(e.message).includes("FetchRequestCanceledException"))}const nj=e=>{if(e instanceof Error)return e;if(typeof e=="object"&&e!==null){try{if(Object.prototype.toString.call(e)==="[object Error]"){const t=new Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return new Error(JSON.stringify(e))}catch{}}return new Error(e)};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class Nc extends Error{}class Go extends Nc{constructor(t,r,n,i){super(`${Go.makeMessage(t,r,n)}`),this.status=t,this.headers=i,this.error=r}static makeMessage(t,r,n){const i=r!=null&&r.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return t&&i?`${t} ${i}`:t?`${t} status code (no body)`:i||"(no status code or body)"}static generate(t,r,n,i){if(!t||!i)return new zE({message:n,cause:nj(r)});const a=r;return t===400?new nK(t,a,n,i):t===401?new iK(t,a,n,i):t===403?new sK(t,a,n,i):t===404?new aK(t,a,n,i):t===409?new oK(t,a,n,i):t===422?new lK(t,a,n,i):t===429?new cK(t,a,n,i):t>=500?new uK(t,a,n,i):new Go(t,a,n,i)}}class ij extends Go{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}}class zE extends Go{constructor({message:t,cause:r}){super(void 0,void 0,t||"Connection error.",void 0),r&&(this.cause=r)}}class rK extends zE{constructor({message:t}={}){super({message:t??"Request timed out."})}}class nK extends Go{}class iK extends Go{}class sK extends Go{}class aK extends Go{}class oK extends Go{}class lK extends Go{}class cK extends Go{}class uK extends Go{}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const F1e=/^[a-z][a-z0-9+.-]*:/i,$1e=e=>F1e.test(e);let sj=e=>(sj=Array.isArray,sj(e));const H1e=sj;let G1e=H1e;const H9=G1e;function G9(e){if(!e)return!0;for(const t in e)return!1;return!0}function q1e(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const W1e=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new Nc(`${e} must be an integer`);if(t<0)throw new Nc(`${e} must be a positive integer`);return t},K1e=e=>{try{return JSON.parse(e)}catch{return}};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const Y1e=e=>new Promise(t=>setTimeout(t,e));/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function X1e(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new GeminiNextGenAPIClient({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function dK(...e){const t=globalThis.ReadableStream;if(typeof t>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function Q1e(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return dK({start(){},async pull(r){const{done:n,value:i}=await t.next();n?r.close():r.enqueue(i)},async cancel(){var r;await((r=t.return)===null||r===void 0?void 0:r.call(t))}})}function hK(e){if(e[Symbol.asyncIterator])return e;const t=e.getReader();return{async next(){try{const r=await t.read();return r!=null&&r.done&&t.releaseLock(),r}catch(r){throw t.releaseLock(),r}},async return(){const r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Z1e(e){var t,r;if(e===null||typeof e!="object")return;if(e[Symbol.asyncIterator]){await((r=(t=e[Symbol.asyncIterator]()).return)===null||r===void 0?void 0:r.call(t));return}const n=e.getReader(),i=n.cancel();n.releaseLock(),await i}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const J1e=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function eye(e){return Object.entries(e).filter(([t,r])=>typeof r<"u").map(([t,r])=>{if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(r===null)return`${encodeURIComponent(t)}=`;throw new Nc(`Cannot stringify type ${typeof r}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const tye="0.0.1";/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const fK=()=>{var e;if(typeof File>"u"){const{process:t}=globalThis,r=typeof((e=t==null?void 0:t.versions)===null||e===void 0?void 0:e.node)=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(r?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Uk(e,t,r){return fK(),new File(e,t??"unknown_file",r)}function rye(e){return(typeof e=="object"&&e!==null&&("name"in e&&e.name&&String(e.name)||"url"in e&&e.url&&String(e.url)||"filename"in e&&e.filename&&String(e.filename)||"path"in e&&e.path&&String(e.path))||"").split(/[\\/]/).pop()||void 0}const nye=e=>e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function";/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const pK=e=>e!=null&&typeof e=="object"&&typeof e.size=="number"&&typeof e.type=="string"&&typeof e.text=="function"&&typeof e.slice=="function"&&typeof e.arrayBuffer=="function",iye=e=>e!=null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.lastModified=="number"&&pK(e),sye=e=>e!=null&&typeof e=="object"&&typeof e.url=="string"&&typeof e.blob=="function";async function aye(e,t,r){if(fK(),e=await e,iye(e))return e instanceof File?e:Uk([await e.arrayBuffer()],e.name);if(sye(e)){const i=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),Uk(await aj(i),t,r)}const n=await aj(e);if(t||(t=rye(e)),!(r!=null&&r.type)){const i=n.find(a=>typeof a=="object"&&"type"in a&&a.type);typeof i=="string"&&(r=Object.assign(Object.assign({},r),{type:i}))}return Uk(n,t,r)}async function aj(e){var t,r,n,i,a;let o=[];if(typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)o.push(e);else if(pK(e))o.push(e instanceof Blob?e:await e.arrayBuffer());else if(nye(e))try{for(var c=!0,h=Z0(e),f;f=await h.next(),t=f.done,!t;c=!0){i=f.value,c=!1;const m=i;o.push(...await aj(m))}}catch(m){r={error:m}}finally{try{!c&&!t&&(n=h.return)&&await n.call(h)}finally{if(r)throw r.error}}else{const m=(a=e==null?void 0:e.constructor)===null||a===void 0?void 0:a.name;throw new Error(`Unexpected data type: ${typeof e}${m?`; constructor: ${m}`:""}${oye(e)}`)}return o}function oye(e){return typeof e!="object"||e===null?"":`; props: [${Object.getOwnPropertyNames(e).map(r=>`"${r}"`).join(", ")}]`}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class mK{constructor(t){this._client=t}}mK._key=[];/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function gK(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const q9=Object.freeze(Object.create(null)),lye=(e=gK)=>(function(r,...n){if(r.length===1)return r[0];let i=!1;const a=[],o=r.reduce((m,y,w)=>{var A,S,j;/[?#]/.test(y)&&(i=!0);const T=n[w];let D=(i?encodeURIComponent:e)(""+T);return w!==n.length&&(T==null||typeof T=="object"&&T.toString===((j=Object.getPrototypeOf((S=Object.getPrototypeOf((A=T.hasOwnProperty)!==null&&A!==void 0?A:q9))!==null&&S!==void 0?S:q9))===null||j===void 0?void 0:j.toString))&&(D=T+"",a.push({start:m.length+y.length,length:D.length,error:`Value of type ${Object.prototype.toString.call(T).slice(8,-1)} is not a valid path parameter`})),m+y+(w===n.length?"":D)},""),c=o.split(/[?#]/,1)[0],h=/(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;let f;for(;(f=h.exec(c))!==null;){const m=f[0].startsWith("/"),y=m?1:0,w=m?f[0].slice(1):f[0];a.push({start:f.index+y,length:w.length,error:`Value "${w}" can't be safely passed as a path parameter`})}if(a.sort((m,y)=>m.start-y.start),a.length>0){let m=0;const y=a.reduce((w,A)=>{const S=" ".repeat(A.start-m),j="^".repeat(A.length);return m=A.start+A.length,w+S+j},"");throw new Nc(`Path parameters result in path with invalid segments: ${a.map(w=>w.error).join(` `)} ${o} ${y}`)}return o}),qv=lye(gK);/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class xK extends mK{create(t,r){var n;const{api_version:i=this._client.apiVersion}=t,a=W2(t,["api_version"]);if("model"in a&&"agent_config"in a)throw new Nc("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");if("agent"in a&&"generation_config"in a)throw new Nc("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");return this._client.post(qv`/${i}/interactions`,Object.assign(Object.assign({body:a},r),{stream:(n=t.stream)!==null&&n!==void 0?n:!1}))}delete(t,r={},n){const{api_version:i=this._client.apiVersion}=r??{};return this._client.delete(qv`/${i}/interactions/${t}`,n)}cancel(t,r={},n){const{api_version:i=this._client.apiVersion}=r??{};return this._client.post(qv`/${i}/interactions/${t}/cancel`,n)}get(t,r={},n){var i;const a=r??{},{api_version:o=this._client.apiVersion}=a,c=W2(a,["api_version"]);return this._client.get(qv`/${o}/interactions/${t}`,Object.assign(Object.assign({query:c},n),{stream:(i=r==null?void 0:r.stream)!==null&&i!==void 0?i:!1}))}}xK._key=Object.freeze(["interactions"]);class yK extends xK{}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function cye(e){let t=0;for(const i of e)t+=i.length;const r=new Uint8Array(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r}let Wv;function p4(e){let t;return(Wv??(t=new globalThis.TextEncoder,Wv=t.encode.bind(t)))(e)}let Kv;function W9(e){let t;return(Kv??(t=new globalThis.TextDecoder,Kv=t.decode.bind(t)))(e)}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class VE{constructor(){this.buffer=new Uint8Array,this.carriageReturnIndex=null,this.searchIndex=0}decode(t){var r;if(t==null)return[];const n=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?p4(t):t;this.buffer=cye([this.buffer,n]);const i=[];let a;for(;(a=uye(this.buffer,(r=this.carriageReturnIndex)!==null&&r!==void 0?r:this.searchIndex))!=null;){if(a.carriage&&this.carriageReturnIndex==null){this.carriageReturnIndex=a.index;continue}if(this.carriageReturnIndex!=null&&(a.index!==this.carriageReturnIndex+1||a.carriage)){i.push(W9(this.buffer.subarray(0,this.carriageReturnIndex-1))),this.buffer=this.buffer.subarray(this.carriageReturnIndex),this.carriageReturnIndex=null,this.searchIndex=0;continue}const o=this.carriageReturnIndex!==null?a.preceding-1:a.preceding,c=W9(this.buffer.subarray(0,o));i.push(c),this.buffer=this.buffer.subarray(a.index),this.carriageReturnIndex=null,this.searchIndex=0}return this.searchIndex=Math.max(0,this.buffer.length-1),i}flush(){return this.buffer.length?this.decode(` `):[]}}VE.NEWLINE_CHARS=new Set([` `,"\r"]);VE.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function uye(e,t){const i=t??0,a=e.indexOf(10,i),o=e.indexOf(13,i);if(a===-1&&o===-1)return null;let c;return a!==-1&&o!==-1?c=Math.min(a,o):c=a!==-1?a:o,e[c]===10?{preceding:c,index:c+1,carriage:!1}:{preceding:c,index:c+1,carriage:!0}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const K2={off:0,error:200,warn:300,info:400,debug:500},K9=(e,t,r)=>{if(e){if(q1e(K2,e))return e;Lo(r).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(K2))}`)}};function C1(){}function Yv(e,t,r){return!t||K2[e]>K2[r]?C1:t[e].bind(t)}const dye={error:C1,warn:C1,info:C1,debug:C1};let Y9=new WeakMap;function Lo(e){var t;const r=e.logger,n=(t=e.logLevel)!==null&&t!==void 0?t:"off";if(!r)return dye;const i=Y9.get(r);if(i&&i[0]===n)return i[1];const a={error:Yv("error",r,n),warn:Yv("warn",r,n),info:Yv("info",r,n),debug:Yv("debug",r,n)};return Y9.set(r,[n,a]),a}const cp=e=>(e.options&&(e.options=Object.assign({},e.options),delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,r])=>[t,t.toLowerCase()==="x-goog-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class V0{constructor(t,r,n){this.iterator=t,this.controller=r,this.client=n}static fromSSEResponse(t,r,n){let i=!1;const a=n?Lo(n):console;function o(){return Y1(this,arguments,function*(){var h,f,m,y;if(i)throw new Nc("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let w=!1;try{try{for(var A=!0,S=Z0(hye(t,r)),j;j=yield zs(S.next()),h=j.done,!h;A=!0){y=j.value,A=!1;const T=y;if(!w)if(T.data.startsWith("[DONE]")){w=!0;continue}else try{yield yield zs(JSON.parse(T.data))}catch(D){throw a.error("Could not parse message into JSON:",T.data),a.error("From chunk:",T.raw),D}}}catch(T){f={error:T}}finally{try{!A&&!h&&(m=S.return)&&(yield zs(m.call(S)))}finally{if(f)throw f.error}}w=!0}catch(T){if(rj(T))return yield zs(void 0);throw T}finally{w||r.abort()}})}return new V0(o,r,n)}static fromReadableStream(t,r,n){let i=!1;function a(){return Y1(this,arguments,function*(){var h,f,m,y;const w=new VE,A=hK(t);try{for(var S=!0,j=Z0(A),T;T=yield zs(j.next()),h=T.done,!h;S=!0){y=T.value,S=!1;const D=y;for(const V of w.decode(D))yield yield zs(V)}}catch(D){f={error:D}}finally{try{!S&&!h&&(m=j.return)&&(yield zs(m.call(j)))}finally{if(f)throw f.error}}for(const D of w.flush())yield yield zs(D)})}function o(){return Y1(this,arguments,function*(){var h,f,m,y;if(i)throw new Nc("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let w=!1;try{try{for(var A=!0,S=Z0(a()),j;j=yield zs(S.next()),h=j.done,!h;A=!0){y=j.value,A=!1;const T=y;w||T&&(yield yield zs(JSON.parse(T)))}}catch(T){f={error:T}}finally{try{!A&&!h&&(m=S.return)&&(yield zs(m.call(S)))}finally{if(f)throw f.error}}w=!0}catch(T){if(rj(T))return yield zs(void 0);throw T}finally{w||r.abort()}})}return new V0(o,r,n)}[Symbol.asyncIterator](){return this.iterator()}tee(){const t=[],r=[],n=this.iterator(),i=a=>({next:()=>{if(a.length===0){const o=n.next();t.push(o),r.push(o)}return a.shift()}});return[new V0(()=>i(t),this.controller,this.client),new V0(()=>i(r),this.controller,this.client)]}toReadableStream(){const t=this;let r;return dK({async start(){r=t[Symbol.asyncIterator]()},async pull(n){try{const{value:i,done:a}=await r.next();if(a)return n.close();const o=p4(JSON.stringify(i)+` `);n.enqueue(o)}catch(i){n.error(i)}},async cancel(){var n;await((n=r.return)===null||n===void 0?void 0:n.call(r))}})}}function hye(e,t){return Y1(this,arguments,function*(){var n,i,a,o;if(!e.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new Nc("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new Nc("Attempted to iterate over a response with no body");const c=new pye,h=new VE,f=hK(e.body);try{for(var m=!0,y=Z0(fye(f)),w;w=yield zs(y.next()),n=w.done,!n;m=!0){o=w.value,m=!1;const A=o;for(const S of h.decode(A)){const j=c.decode(S);j&&(yield yield zs(j))}}}catch(A){i={error:A}}finally{try{!m&&!n&&(a=y.return)&&(yield zs(a.call(y)))}finally{if(i)throw i.error}}for(const A of h.flush()){const S=c.decode(A);S&&(yield yield zs(S))}})}function fye(e){return Y1(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,c=Z0(e),h;h=yield zs(c.next()),r=h.done,!r;o=!0){a=h.value,o=!1;const f=a;if(f==null)continue;const m=f instanceof ArrayBuffer?new Uint8Array(f):typeof f=="string"?p4(f):f;yield yield zs(m)}}catch(f){n={error:f}}finally{try{!o&&!r&&(i=c.return)&&(yield zs(i.call(c)))}finally{if(n)throw n.error}}})}class pye{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;const a={event:this.event,data:this.data.join(` `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],a}if(this.chunks.push(t),t.startsWith(":"))return null;let[r,n,i]=mye(t,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}}function mye(e,t){const r=e.indexOf(t);return r!==-1?[e.substring(0,r),t,e.substring(r+t.length)]:[e,"",""]}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */async function gye(e,t){const{response:r,requestLogID:n,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{var c;if(t.options.stream)return Lo(e).debug("response",r.status,r.url,r.headers,r.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(r,t.controller,e):V0.fromSSEResponse(r,t.controller,e);if(r.status===204)return null;if(t.options.__binaryResponse)return r;const h=r.headers.get("content-type"),f=(c=h==null?void 0:h.split(";")[0])===null||c===void 0?void 0:c.trim();return(f==null?void 0:f.includes("application/json"))||(f==null?void 0:f.endsWith("+json"))?r.headers.get("content-length")==="0"?void 0:await r.json():await r.text()})();return Lo(e).debug(`[${n}] response parsed`,cp({retryOfRequestLogID:i,url:r.url,status:r.status,body:o,durationMs:Date.now()-a})),o}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class m4 extends Promise{constructor(t,r,n=gye){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=n,this.client=t}_thenUnwrap(t){return new m4(this.client,this.responsePromise,async(r,n)=>t(await this.parseResponse(r,n),n))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){const[t,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(this.client,t))),this.parsedPromise}then(t,r){return this.parse().then(t,r)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const bK=Symbol("brand.privateNullableHeaders");function*xye(e){if(!e)return;if(bK in e){const{values:n,nulls:i}=e;yield*n.entries();for(const a of i)yield[a,null];return}let t=!1,r;e instanceof Headers?r=e.entries():H9(e)?r=e:(t=!0,r=Object.entries(e??{}));for(let n of r){const i=n[0];if(typeof i!="string")throw new TypeError("expected header name to be a string");const a=H9(n[1])?n[1]:[n[1]];let o=!1;for(const c of a)c!==void 0&&(t&&!o&&(o=!0,yield[i,null]),yield[i,c])}}const n1=e=>{const t=new Headers,r=new Set;for(const n of e){const i=new Set;for(const[a,o]of xye(n)){const c=a.toLowerCase();i.has(c)||(t.delete(a),i.add(c)),o===null?(t.delete(a),r.add(c)):(t.append(a,o),r.delete(c))}}return{[bK]:!0,values:t,nulls:r}};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const Bk=e=>{var t,r,n,i,a,o;if(typeof globalThis.process<"u")return(n=(r=(t=z1e)===null||t===void 0?void 0:t[e])===null||r===void 0?void 0:r.trim())!==null&&n!==void 0?n:void 0;if(typeof globalThis.Deno<"u")return(o=(a=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||a===void 0?void 0:a.call(i,e))===null||o===void 0?void 0:o.trim()};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var vK;class FE{constructor(t){var r,n,i,a,o,c,h,{baseURL:f=Bk("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:m=(r=Bk("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:y="v1beta"}=t,w=W2(t,["baseURL","apiKey","apiVersion"]);const A=Object.assign(Object.assign({apiKey:m,apiVersion:y},w),{baseURL:f||"https://generativelanguage.googleapis.com"});this.baseURL=A.baseURL,this.timeout=(n=A.timeout)!==null&&n!==void 0?n:FE.DEFAULT_TIMEOUT,this.logger=(i=A.logger)!==null&&i!==void 0?i:console;const S="warn";this.logLevel=S,this.logLevel=(o=(a=K9(A.logLevel,"ClientOptions.logLevel",this))!==null&&a!==void 0?a:K9(Bk("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&o!==void 0?o:S,this.fetchOptions=A.fetchOptions,this.maxRetries=(c=A.maxRetries)!==null&&c!==void 0?c:2,this.fetch=(h=A.fetch)!==null&&h!==void 0?h:X1e(),this.encoder=J1e,this._options=A,this.apiKey=m,this.apiVersion=y,this.clientAdapter=A.clientAdapter}withOptions(t){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),t))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:r}){if(!(t.has("authorization")||t.has("x-goog-api-key"))&&!(this.apiKey&&t.get("x-goog-api-key"))&&!r.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(t){const r=n1([t.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return n1([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return n1([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return eye(t)}getUserAgent(){return`${this.constructor.name}/JS ${tye}`}defaultIdempotencyKey(){return`stainless-node-retry-${V1e()}`}makeStatusError(t,r,n,i){return Go.generate(t,r,n,i)}buildURL(t,r,n){const i=!this.baseURLOverridden()&&n||this.baseURL,a=$1e(t)?new URL(t):new URL(i+(i.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),o=this.defaultQuery(),c=Object.fromEntries(a.searchParams);return(!G9(o)||!G9(c))&&(r=Object.assign(Object.assign(Object.assign({},c),o),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(a.search=this.stringifyQuery(r)),a.toString()}async prepareOptions(t){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!t.path.startsWith(`/${this.apiVersion}/projects/`)){const r=t.path.slice(this.apiVersion.length+1);t.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(t,{url:r,options:n}){}get(t,r){return this.methodRequest("get",t,r)}post(t,r){return this.methodRequest("post",t,r)}patch(t,r){return this.methodRequest("patch",t,r)}put(t,r){return this.methodRequest("put",t,r)}delete(t,r){return this.methodRequest("delete",t,r)}methodRequest(t,r,n){return this.request(Promise.resolve(n).then(i=>Object.assign({method:t,path:r},i)))}request(t,r=null){return new m4(this,this.makeRequest(t,r,void 0))}async makeRequest(t,r,n){var i,a,o;const c=await t,h=(i=c.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=h),await this.prepareOptions(c);const{req:f,url:m,timeout:y}=await this.buildRequest(c,{retryCount:h-r});await this.prepareRequest(f,{url:m,options:c});const w="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),A=n===void 0?"":`, retryOf: ${n}`,S=Date.now();if(Lo(this).debug(`[${w}] sending request`,cp({retryOfRequestLogID:n,method:c.method,url:m,options:c,headers:f.headers})),!((a=c.signal)===null||a===void 0)&&a.aborted)throw new ij;const j=new AbortController,T=await this.fetchWithTimeout(m,f,y,j).catch(nj),D=Date.now();if(T instanceof globalThis.Error){const U=`retrying, ${r} attempts remaining`;if(!((o=c.signal)===null||o===void 0)&&o.aborted)throw new ij;const G=rj(T)||/timed? ?out/i.test(String(T)+("cause"in T?String(T.cause):""));if(r)return Lo(this).info(`[${w}] connection ${G?"timed out":"failed"} - ${U}`),Lo(this).debug(`[${w}] connection ${G?"timed out":"failed"} (${U})`,cp({retryOfRequestLogID:n,url:m,durationMs:D-S,message:T.message})),this.retryRequest(c,r,n??w);throw Lo(this).info(`[${w}] connection ${G?"timed out":"failed"} - error; no more retries left`),Lo(this).debug(`[${w}] connection ${G?"timed out":"failed"} (error; no more retries left)`,cp({retryOfRequestLogID:n,url:m,durationMs:D-S,message:T.message})),G?new rK:new zE({cause:T})}const V=`[${w}${A}] ${f.method} ${m} ${T.ok?"succeeded":"failed"} with status ${T.status} in ${D-S}ms`;if(!T.ok){const U=await this.shouldRetry(T);if(r&&U){const F=`retrying, ${r} attempts remaining`;return await Z1e(T.body),Lo(this).info(`${V} - ${F}`),Lo(this).debug(`[${w}] response error (${F})`,cp({retryOfRequestLogID:n,url:T.url,status:T.status,headers:T.headers,durationMs:D-S})),this.retryRequest(c,r,n??w,T.headers)}const G=U?"error; no more retries left":"error; not retryable";Lo(this).info(`${V} - ${G}`);const X=await T.text().catch(F=>nj(F).message),q=K1e(X),B=q?void 0:X;throw Lo(this).debug(`[${w}] response error (${G})`,cp({retryOfRequestLogID:n,url:T.url,status:T.status,headers:T.headers,message:B,durationMs:Date.now()-S})),this.makeStatusError(T.status,q,B,T.headers)}return Lo(this).info(V),Lo(this).debug(`[${w}] response start`,cp({retryOfRequestLogID:n,url:T.url,status:T.status,headers:T.headers,durationMs:D-S})),{response:T,options:c,controller:j,requestLogID:w,retryOfRequestLogID:n,startTime:S}}async fetchWithTimeout(t,r,n,i){const a=r||{},{signal:o,method:c}=a,h=W2(a,["signal","method"]),f=this._makeAbort(i);o&&o.addEventListener("abort",f,{once:!0});const m=setTimeout(f,n),y=globalThis.ReadableStream&&h.body instanceof globalThis.ReadableStream||typeof h.body=="object"&&h.body!==null&&Symbol.asyncIterator in h.body,w=Object.assign(Object.assign(Object.assign({signal:i.signal},y?{duplex:"half"}:{}),{method:"GET"}),h);c&&(w.method=c.toUpperCase());try{return await this.fetch.call(void 0,t,w)}finally{clearTimeout(m)}}async shouldRetry(t){const r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,r,n,i){var a;let o;const c=i==null?void 0:i.get("retry-after-ms");if(c){const f=parseFloat(c);Number.isNaN(f)||(o=f)}const h=i==null?void 0:i.get("retry-after");if(h&&!o){const f=parseFloat(h);Number.isNaN(f)?o=Date.parse(h)-Date.now():o=f*1e3}if(o===void 0){const f=(a=t.maxRetries)!==null&&a!==void 0?a:this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,f)}return await Y1e(o),this.makeRequest(t,r-1,n)}calculateDefaultRetryTimeoutMillis(t,r){const a=r-t,o=Math.min(.5*Math.pow(2,a),8),c=1-Math.random()*.25;return o*c*1e3}async buildRequest(t,{retryCount:r=0}={}){var n,i,a;const o=Object.assign({},t),{method:c,path:h,query:f,defaultBaseURL:m}=o,y=this.buildURL(h,f,m);"timeout"in o&&W1e("timeout",o.timeout),o.timeout=(n=o.timeout)!==null&&n!==void 0?n:this.timeout;const{bodyHeaders:w,body:A}=this.buildBody({options:o}),S=await this.buildHeaders({options:t,method:c,bodyHeaders:w,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:c,headers:S},o.signal&&{signal:o.signal}),globalThis.ReadableStream&&A instanceof globalThis.ReadableStream&&{duplex:"half"}),A&&{body:A}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(a=o.fetchOptions)!==null&&a!==void 0?a:{}),url:y,timeout:o.timeout}}async buildHeaders({options:t,method:r,bodyHeaders:n,retryCount:i}){let a={};this.idempotencyHeader&&r!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),a[this.idempotencyHeader]=t.idempotencyKey);const o=await this.authHeaders(t);let c=n1([a,{Accept:"application/json","User-Agent":this.getUserAgent()},this._options.defaultHeaders,n,t.headers,o]);return this.validateHeaders(c),c.values}_makeAbort(t){return()=>t.abort()}buildBody({options:{body:t,headers:r}}){if(!t)return{bodyHeaders:void 0,body:void 0};const n=n1([r]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&n.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:Q1e(t)}:typeof t=="object"&&n.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(t)}:this.encoder({body:t,headers:n})}}FE.DEFAULT_TIMEOUT=6e4;class uo extends FE{constructor(){super(...arguments),this.interactions=new yK(this)}}vK=uo;uo.GeminiNextGenAPIClient=vK;uo.GeminiNextGenAPIClientError=Nc;uo.APIError=Go;uo.APIConnectionError=zE;uo.APIConnectionTimeoutError=rK;uo.APIUserAbortError=ij;uo.NotFoundError=aK;uo.ConflictError=oK;uo.RateLimitError=cK;uo.BadRequestError=nK;uo.AuthenticationError=iK;uo.InternalServerError=uK;uo.PermissionDeniedError=sK;uo.UnprocessableEntityError=lK;uo.toFile=aye;uo.Interactions=yK;const yye=()=>(console.warn("GEMINI_API_KEY is missing. Search suggestions will be disabled."),null),bye=async(e,t)=>{if(!e||e.length<2)return[];const r=yye();if(!r)return[];try{const n=await r.models.generateContent({model:"gemini-3.1-flash-lite",contents:`User is searching for: "${e}". Available article titles: ${t.join(", ")}. Suggest 5 relevant search terms or short phrases that help the user find what they are looking for based on the titles. Return strictly as a JSON array of strings.`,config:{responseMimeType:"application/json"}}),i=JSON.parse(n.text||"[]");return Array.isArray(i)?i:[]}catch(n){return console.error("Gemini Search Suggester Error:",n),[]}};let X9=0;function wK(e="random"){try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const r=new t;r.state==="suspended"&&r.resume().catch(()=>null);const n=r.currentTime,i=(o,c,h,f=.25,m="sine")=>{const y=r.createOscillator(),w=r.createGain();y.type=m,y.frequency.setValueAtTime(o,c),w.gain.setValueAtTime(0,c),w.gain.linearRampToValueAtTime(f,c+.008),w.gain.exponentialRampToValueAtTime(1e-4,c+h),y.connect(w),w.connect(r.destination),y.start(c),y.stop(c+h);const A=r.createOscillator(),S=r.createGain();A.type="sine",A.frequency.setValueAtTime(o*2,c),S.gain.setValueAtTime(0,c),S.gain.linearRampToValueAtTime(f*.15,c+.005),S.gain.exponentialRampToValueAtTime(1e-4,c+h*.6),A.connect(S),S.connect(r.destination),A.start(c),A.stop(c+h*.6)};let a=e;if(a==="random"){const o=["marimba","crystal","harmonic_bell","chime_triad"];a=o[X9%o.length],X9++}switch(a){case"marimba":i(1046.5,n,.18,.22,"triangle"),i(1318.51,n+.08,.2,.22,"triangle"),i(1567.98,n+.16,.22,.25,"sine"),i(2093,n+.24,.4,.28,"sine");break;case"crystal":i(1318.51,n,.22,.2,"sine"),i(1760,n+.1,.25,.24,"sine"),i(2217.46,n+.2,.45,.28,"sine");break;case"harmonic_bell":i(880,n,.45,.18,"sine"),i(1108.73,n+.05,.45,.2,"sine"),i(1318.51,n+.1,.5,.22,"sine"),i(1760,n+.15,.6,.25,"sine");break;case"chime_triad":default:i(783.99,n,.15,.2,"sine"),i(1174.66,n+.08,.18,.22,"sine"),i(1567.98,n+.16,.22,.25,"sine"),i(1975.53,n+.24,.42,.28,"sine");break}}catch(t){console.warn("Sweet audio chime play error:",t)}}function vye(e){wK("random")}async function NK(){if(typeof window>"u"||!("Notification"in window))return!1;if("serviceWorker"in navigator)try{await navigator.serviceWorker.register("/sw.js")}catch(e){console.warn("SW Registration attempt:",e)}return Notification.permission==="granted"?!0:Notification.permission!=="denied"?await Notification.requestPermission()==="granted":!1}function j1(e,t){if(wK((t==null?void 0:t.toneStyle)||"random"),typeof navigator<"u"&&"vibrate"in navigator)try{navigator.vibrate([120,80,120])}catch{}if(typeof window>"u"||!("Notification"in window))return;const r={icon:(t==null?void 0:t.icon)||"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",badge:(t==null?void 0:t.badge)||"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",vibrate:[120,80,120],requireInteraction:!1,...t!=null&&t.image?{image:t.image}:{},...t},n=async()=>{if("serviceWorker"in navigator)try{const i=await navigator.serviceWorker.ready;if(i&&"showNotification"in i){await i.showNotification(e,r);return}}catch(i){console.warn("ServiceWorker showNotification fallback:",i)}try{new Notification(e,r)}catch(i){console.warn("Native Notification error:",i)}};Notification.permission==="granted"?n():Notification.permission!=="denied"&&Notification.requestPermission().then(i=>{i==="granted"&&n()})}const wye=({onSearch:e,activeTab:t,setActiveTab:r,isAdmin:n,onAdminClick:i,latestArticles:a=[],openAuth:o,customPagesList:c=[],setSelectedCustomPage:h,selectedCustomPage:f,onScanClick:m,onOpenChat:y})=>{const[w,A]=I.useState(!1),[S,j]=I.useState(!1),[T,D]=I.useState(""),V=async()=>{try{window.open("https://link.thelocalrent.com/v?t=1786099107&tk=07c43b29b01fcaf275f96eea938d430f","_blank"),he.success("Opening Campus Eye Mobile App Link...",{icon:"📱"})}catch{he.error("Failed to open App download link.")}},U=()=>{const de=localStorage.getItem("campus_eye_theme")||"light";let ke="light";de==="light"?ke="dark":de==="dark"?ke="sepia":ke="light",localStorage.setItem("campus_eye_theme",ke),window.dispatchEvent(new CustomEvent("theme-changed",{detail:{theme:ke}}));const Ze=ke.charAt(0).toUpperCase()+ke.slice(1);he.success(`${Ze} theme applied successfully.`)},[G,X]=I.useState([]),[q,B]=I.useState([]),[z,F]=I.useState(!1),[$,J]=I.useState(Ne.currentUser),[Q,K]=I.useState(!navigator.onLine);I.useEffect(()=>{const de=()=>K(!1),ke=()=>K(!0);return window.addEventListener("online",de),window.addEventListener("offline",ke),()=>{window.removeEventListener("online",de),window.removeEventListener("offline",ke)}},[]),I.useEffect(()=>{const de=Ne.onAuthStateChanged(Ze=>{J(Ze)}),ke=()=>A(!0);return window.addEventListener("openGlobalSearch",ke),()=>{de(),window.removeEventListener("openGlobalSearch",ke)}},[]);const[me,re]=I.useState([]),[le,ve]=I.useState([]),[je,Ve]=I.useState([]),[Z,se]=I.useState(!1),[xe,ae]=I.useState("inbox"),[qe,pt]=I.useState("all"),[Fe,jt]=I.useState(!1),[Pt,Ae]=I.useState(!1),[Ie,vt]=I.useState({}),[Re,It]=I.useState({}),[Dt,cr]=I.useState({});I.useEffect(()=>{const de=()=>{se(!1)};return window.addEventListener("open-imessage-friend",de),()=>window.removeEventListener("open-imessage-friend",de)},[]);const St=(de,ke)=>{ke&&ke.stopPropagation(),vt(Ze=>({...Ze,[de]:!Ze[de]}))},Ct=async(de,ke)=>{var Fr;ke&&ke.stopPropagation();const Ze=(Fr=Re[de.id])==null?void 0:Fr.trim(),Ft=de.senderId||(de.type==="direct_message"?de.userId:null);if(!(!Ze||!Ft||!$)){cr(gr=>({...gr,[de.id]:!0}));try{const gr=$.displayName||"Campus Peer",Cr=($.displayName||"member").toLowerCase().replace(/\s+/g,"");await dn(nt(fe,"notifications"),{userId:Ft,senderId:$.uid,senderName:gr,senderUsername:Cr,senderPhotoURL:$.photoURL||"",title:`💬 Direct Reply from ${gr}`,message:Ze,type:"direct_message",canReply:!0,used:!1,replyToTitle:de.title||"Inbox Message",createdAt:new Date}),he.success(`Reply sent to ${de.senderName||"friend"}!`,{icon:"📩"}),It(xt=>({...xt,[de.id]:""})),Lt(de)}catch(gr){he.error("Failed to send reply: "+gr.message)}finally{cr(gr=>({...gr,[de.id]:!1}))}}},Gt=de=>{if(!de)return"Recent";const ke=de instanceof Date?de:new Date(de);if(isNaN(ke.getTime()))return"Recent";const Ft=Math.floor((new Date().getTime()-ke.getTime())/1e3);if(Ft<60)return"Just now";const Fr=Math.floor(Ft/60);if(Fr<60)return`${Fr}m ago`;const gr=Math.floor(Fr/60);if(gr<24)return`${gr}h ago`;const Cr=Math.floor(gr/24);return Cr<7?`${Cr}d ago`:ke.toLocaleDateString([],{month:"short",day:"numeric"})},Xe=de=>{const ke=de.type==="direct_message",Ze=de.userId==="all"||de.type==="broadcast"||de.type==="broadcast_announcement"||de.isBroadcast,Ft=de.type==="invite"||de.type==="lounge_invite",Fr=!!de.code||de.type==="ticket"||de.type==="ticket_code"||de.type==="pass",gr=de.forAdmin||de.type==="unlimited_posting_request"||de.type==="mega_ai_query"||de.type==="admin_alert",Cr=de.type==="mega_ai_reply"||de.type==="admin_mega_reply"||de.type==="mega_ai",xt=de.type==="like"||de.type==="reaction"||de.title&&de.title.toLowerCase().includes("like"),Or=de.type==="comment"||de.type==="reply"||de.type==="dispatch_reply"||de.title&&(de.title.toLowerCase().includes("comment")||de.title.toLowerCase().includes("replied")||de.title.toLowerCase().includes("dispatch")),_t=de.type==="follow"||de.type==="follower",Oe=de.type==="article"||de.type==="new_post";return ke?{category:"social",typeLabel:"💬 DIRECT INBOX",borderClass:"border-l-4 border-l-indigo-600",bgClass:de.used?"bg-indigo-50/20 border-indigo-200/50 opacity-75":"bg-indigo-50/80 border-indigo-300 shadow-2xs",badgeClass:"bg-indigo-600 text-white font-black",iconBg:"bg-indigo-100 text-indigo-700",IconComponent:Xs}:Ze?{category:"broadcast",typeLabel:"📢 BROADCAST",borderClass:"border-l-4 border-l-amber-500",bgClass:de.used?"bg-amber-50/20 border-amber-200/50 opacity-75":"bg-amber-50/70 border-amber-300 shadow-2xs",badgeClass:"bg-amber-500 text-white font-black",iconBg:"bg-amber-100 text-amber-700",IconComponent:wu}:Ft?{category:"social",typeLabel:"🤝 INVITE",borderClass:"border-l-4 border-l-emerald-500",bgClass:de.used?"bg-emerald-50/20 border-emerald-200/50 opacity-75":"bg-emerald-50/70 border-emerald-300 shadow-2xs",badgeClass:"bg-emerald-600 text-white font-black",iconBg:"bg-emerald-100 text-emerald-700",IconComponent:bp}:Fr?{category:"passes",typeLabel:"🎟️ PASS KEY",borderClass:"border-l-4 border-l-purple-500",bgClass:de.used?"bg-purple-50/20 border-purple-200/50 opacity-75":"bg-purple-50/70 border-purple-300 shadow-2xs",badgeClass:"bg-purple-600 text-white font-black",iconBg:"bg-purple-100 text-purple-700",IconComponent:Ea}:gr?{category:"system",typeLabel:"🛡️ ADMIN ALERT",borderClass:"border-l-4 border-l-red-600",bgClass:de.used?"bg-red-50/20 border-red-200/50 opacity-75":"bg-red-50/80 border-red-300 shadow-2xs",badgeClass:"bg-red-700 text-white font-black",iconBg:"bg-red-100 text-red-700",IconComponent:yie}:Cr?{category:"system",typeLabel:"🤖 MEGA AI",borderClass:"border-l-4 border-l-cyan-500",bgClass:de.used?"bg-cyan-50/20 border-cyan-200/50 opacity-75":"bg-cyan-50/70 border-cyan-300 shadow-2xs",badgeClass:"bg-cyan-700 text-white font-black",iconBg:"bg-cyan-100 text-cyan-700",IconComponent:Lre}:xt?{category:"social",typeLabel:"❤️ REACTION",borderClass:"border-l-4 border-l-rose-500",bgClass:de.used?"bg-rose-50/20 border-rose-200/50 opacity-75":"bg-rose-50/70 border-rose-300 shadow-2xs",badgeClass:"bg-rose-600 text-white font-black",iconBg:"bg-rose-100 text-rose-700",IconComponent:Fl}:Or?{category:"social",typeLabel:"💬 DISPATCH REPLY",borderClass:"border-l-4 border-l-indigo-500",bgClass:de.used?"bg-indigo-50/20 border-indigo-200/50 opacity-75":"bg-indigo-50/70 border-indigo-300 shadow-2xs",badgeClass:"bg-indigo-600 text-white font-black",iconBg:"bg-indigo-100 text-indigo-700",IconComponent:qp}:_t?{category:"social",typeLabel:"👥 FOLLOWER",borderClass:"border-l-4 border-l-blue-500",bgClass:de.used?"bg-blue-50/20 border-blue-200/50 opacity-75":"bg-blue-50/70 border-blue-300 shadow-2xs",badgeClass:"bg-blue-600 text-white font-black",iconBg:"bg-blue-100 text-blue-700",IconComponent:iy}:Oe?{category:"broadcast",typeLabel:"📰 FRESH STORY",borderClass:"border-l-4 border-l-sky-500",bgClass:de.used?"bg-sky-50/20 border-sky-200/50 opacity-75":"bg-sky-50/70 border-sky-300 shadow-2xs",badgeClass:"bg-sky-600 text-white font-black",iconBg:"bg-sky-100 text-sky-700",IconComponent:Wh}:{category:"social",typeLabel:de.type?`🔔 ${de.type.toUpperCase()}`:"🔔 NOTIFICATION",borderClass:"border-l-4 border-l-gray-400",bgClass:de.used?"bg-gray-50/40 border-gray-150 opacity-75":"bg-white border-gray-200 shadow-2xs",badgeClass:"bg-gray-800 text-white font-black",iconBg:"bg-gray-100 text-gray-700",IconComponent:Ru}},[Xt,Ot]=I.useState(()=>{try{const de=localStorage.getItem("clicked_notification_links");return de?JSON.parse(de):{}}catch{return{}}}),or=de=>{de&&Ot(ke=>{const Ze={...ke,[de]:!0};try{localStorage.setItem("clicked_notification_links",JSON.stringify(Ze))}catch(Ft){console.warn("Could not save clicked links:",Ft)}return Ze})},[Wr,dr]=I.useState([]),[yn,He]=I.useState([]),[Rt,nr]=I.useState([]),[fr,hn]=I.useState([]),[en,Ci]=I.useState({}),[Gr,be]=I.useState("");I.useEffect(()=>{if(!$){dr([]),Ci({}),He([]),nr([]),hn([]);return}(async()=>{try{const ke=Jt(nt(fe,"users"),yi(50)),Ze=Jt(nt(fe,"invitations"),yi(50)),Ft=Jt(nt(fe,"posts"),yi(45)),Fr=Jt(nt(fe,"adverts"),yi(30)),gr=Jt(nt(fe,"pinned_announcements"),yi(15)),[Cr,xt,Or,_t,Oe]=await Promise.all([vr(ke),vr(Ze),vr(Ft),vr(Fr),vr(gr)]),ft=Cr.docs.map(Ht=>({uid:Ht.id,...Ht.data()})).filter(Ht=>Ht.uid!==($==null?void 0:$.uid));dr(ft);const mr={};xt.docs.forEach(Ht=>{const kr=Ht.data();kr.senderId===($==null?void 0:$.uid)&&(mr[kr.receiverId]=!0)}),Ci(mr),He(Or.docs.map(Ht=>({id:Ht.id,...Ht.data()}))),nr(_t.docs.map(Ht=>({id:Ht.id,...Ht.data()}))),hn(Oe.docs.map(Ht=>({id:Ht.id,...Ht.data()})))}catch(ke){console.warn("Silent ignored database initial fetches inside navbar:",ke)}})()},[$]);const Pe=async de=>{var Ze,Ft;if(!$){he.error("Please sign in to invite peers!");return}const ke=`${$.uid}_${de.uid}`;try{Ci(Fr=>({...Fr,[de.uid]:!0})),await Gn(st(fe,"invitations",ke),{id:ke,senderId:$.uid,senderName:$.displayName||((Ze=$.email)==null?void 0:Ze.split("@")[0])||"Peer",senderPhotoURL:$.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent($.displayName||"Peer")}&background=random`,receiverId:de.uid,receiverName:de.displayName||((Ft=de.email)==null?void 0:Ft.split("@")[0])||"Peer",status:"pending",createdAt:zr()}),he.success(`Lounge invite sent to @${(de.displayName||"peer").toLowerCase().replace(/\s+/g,"")}!`,{icon:"🚀"})}catch(Fr){he.error("Failed to send invite: "+Fr.message)}};I.useEffect(()=>{if(!$){re([]),ve([]);return}const de=Jt(nt(fe,"notifications"),An("userId","==",$.uid));let ke=!0,Ze={},Ft={};const Fr=()=>{const ft={...Ze,...Ft},mr=Object.values(ft);mr.sort((Ht,kr)=>kr.createdAt.getTime()-Ht.createdAt.getTime()),ve(mr)},gr=ei(de,ft=>{ft.docs.forEach(mr=>{var kr;const Ht=mr.data();Ze[mr.id]={id:mr.id,...Ht,createdAt:(kr=Ht.createdAt)!=null&&kr.toDate?Ht.createdAt.toDate():new Date(Ht.createdAt||Date.now())}}),ke||ft.docChanges().forEach(mr=>{if(mr.type==="added"){const Ht=mr.doc.data();j1(Ht.title||"✨ Campus Eye Notification",{body:Ht.message||"You have a new dispatch notification in your inbox.",senderId:Ht.senderId,senderName:Ht.senderName,id:mr.doc.id,tag:`notif-${mr.doc.id}`})}}),ke=!1,Fr()},ft=>{console.warn("Silent notification snapshot error:",ft)}),Cr=Jt(nt(fe,"notifications"),An("userId","==","all"));let xt=!0;const Or=ei(Cr,ft=>{ft.docs.forEach(mr=>{var kr;const Ht=mr.data();Ze[mr.id]={id:mr.id,...Ht,createdAt:(kr=Ht.createdAt)!=null&&kr.toDate?Ht.createdAt.toDate():new Date(Ht.createdAt||Date.now())}}),xt||ft.docChanges().forEach(mr=>{if(mr.type==="added"){const Ht=mr.doc.data();j1(Ht.title||"📢 Campus Eye Broadcast",{body:Ht.message||"New broadcast announcement released on Campus Eye."})}}),xt=!1,Fr()},ft=>{console.warn("Silent broadcast notification snapshot error:",ft)});let _t=null;if(n){let ft=!0;const mr=Jt(nt(fe,"notifications"),An("forAdmin","==",!0));_t=ei(mr,Ht=>{Ht.docs.forEach(kr=>{var fi;const mn=kr.data();Ft[kr.id]={id:kr.id,...mn,createdAt:(fi=mn.createdAt)!=null&&fi.toDate?mn.createdAt.toDate():new Date(mn.createdAt||Date.now())}}),ft||Ht.docChanges().forEach(kr=>{if(kr.type==="added"){const mn=kr.doc.data();j1(mn.title||"🛡️ Admin Alert",{body:mn.message||"New system alert or dispatch query in Admin Console."})}}),ft=!1,Fr()},Ht=>{console.warn("Silent admin notification snapshot error:",Ht)})}const Oe=Jt(nt(fe,"invitations"),An("receiverId","==",$.uid),An("status","==","pending")),ar=ei(Oe,ft=>{const mr=ft.docs.map(Ht=>({id:Ht.id,...Ht.data()}));re(mr)},ft=>{console.warn("Silent invites snapshot error:",ft)});return()=>{gr(),Or(),_t&&_t(),ar()}},[$]),I.useEffect(()=>{if(!$){Ve([]);return}const de=Jt(nt(fe,"direct_messages"),An("senderId","==",$.uid)),ke=Jt(nt(fe,"direct_messages"),An("receiverId","==",$.uid));let Ze=[],Ft=[];const Fr=()=>{const xt=[...Ze,...Ft],Or=new Map;xt.forEach(Oe=>{var fi,_s;const ar=Oe.senderId===$.uid,ft=ar?Oe.receiverId:Oe.senderId;if(!ft)return;const mr=(fi=Oe.createdAt)!=null&&fi.toDate?Oe.createdAt.toDate():(_s=Oe.createdAt)!=null&&_s.seconds?new Date(Oe.createdAt.seconds*1e3):new Date(Oe.createdAt||Date.now()),Ht=Or.get(ft),kr=Ht!=null&&Ht.lastTimestamp?Ht.lastTimestamp instanceof Date?Ht.lastTimestamp:new Date(Ht.lastTimestamp):new Date(0),mn=!ar&&!Oe.read;if(!Ht||mr.getTime()>kr.getTime()){const xn=Wr.find(Js=>Js.uid===ft);Or.set(ft,{peerUid:ft,peerName:(xn==null?void 0:xn.displayName)||Oe.senderName||"Campus Friend",peerUsername:(xn==null?void 0:xn.username)||Oe.senderUsername||"peer",peerPhoto:(xn==null?void 0:xn.photoURL)||Oe.senderPhotoURL||`https://api.dicebear.com/7.x/bottts/svg?seed=${ft}`,lastMessage:Oe.text||(Oe.imageUrl?"📷 Photo Attachment":"Message"),lastTimestamp:mr,unreadCount:((Ht==null?void 0:Ht.unreadCount)||0)+(mn?1:0)})}else mn&&(Ht.unreadCount+=1)});const _t=Array.from(Or.values()).sort((Oe,ar)=>ar.lastTimestamp.getTime()-Oe.lastTimestamp.getTime());Ve(_t)},gr=ei(de,xt=>{Ze=xt.docs.map(Or=>({id:Or.id,...Or.data()})),Fr()},xt=>console.warn("Sent direct_messages sub error:",xt)),Cr=ei(ke,xt=>{Ft=xt.docs.map(Or=>({id:Or.id,...Or.data()})),Fr()},xt=>console.warn("Recv direct_messages sub error:",xt));return()=>{gr(),Cr()}},[$,Wr]);const $e=async de=>{try{await Ir(st(fe,"invitations",de.id),{status:"accepted"});const ke=zr();await Gn(st(fe,"follows",`${$==null?void 0:$.uid}_${de.senderId}`),{followerId:$==null?void 0:$.uid,followedId:de.senderId,createdAt:ke}),await Gn(st(fe,"follows",`${de.senderId}_${$==null?void 0:$.uid}`),{followerId:de.senderId,followedId:$==null?void 0:$.uid,createdAt:ke}),he.success(`Connected in Lounge with @${de.senderName.toLowerCase().replace(/\s+/g,"")}!`,{icon:"🤝"}),r("posts"),se(!1)}catch(ke){he.error("Failed to accept invitation: "+ke.message)}},ct=async de=>{try{await ai(st(fe,"invitations",de.id)),he.success("Invitation declined.")}catch(ke){he.error("Failed to decline: "+ke.message)}},yr=async(de,ke)=>{ke==null||ke.stopPropagation();try{await ai(st(fe,"notifications",de)),ve(Ze=>Ze.filter(Ft=>Ft.id!==de)),he.success("Notification removed",{icon:"🗑️"})}catch(Ze){he.error("Failed to delete notification: "+Ze.message)}},Lt=async de=>{if(!de.used)try{await Ir(st(fe,"notifications",de.id),{used:!0}),ve(ke=>ke.map(Ze=>Ze.id===de.id?{...Ze,used:!0}:Ze))}catch(ke){console.warn("Failed to mark notification read:",ke)}},Lr=async de=>{if(Lt(de),se(!1),de.type==="direct_message"||de.senderId&&!de.postId&&!de.articleId){const ke={uid:de.senderId,displayName:de.senderName||"Campus Peer",username:de.senderUsername||(de.senderName||"peer").toLowerCase().replace(/\s+/g,""),photoURL:de.senderPhotoURL||""};y&&y(ke),window.dispatchEvent(new CustomEvent("open-imessage-friend",{detail:ke}));return}de.postId?(r("posts"),setTimeout(()=>{const ke=de.commentId?`comment-${de.commentId}`:`post-card-${de.postId}`,Ze=document.getElementById(ke)||document.getElementById(`post-card-${de.postId}`);Ze&&(Ze.scrollIntoView({behavior:"smooth",block:"center"}),Ze.classList.add("ring-4","ring-amber-500","ring-offset-2"),setTimeout(()=>Ze.classList.remove("ring-4","ring-amber-500","ring-offset-2"),3500))},500)):de.articleId&&(r("home"),setTimeout(()=>{const ke=de.commentId?`comment-${de.commentId}`:`article-${de.articleId}`,Ze=document.getElementById(ke)||document.getElementById(`article-${de.articleId}`);Ze&&(Ze.scrollIntoView({behavior:"smooth",block:"center"}),Ze.classList.add("ring-4","ring-amber-500","ring-offset-2"),setTimeout(()=>Ze.classList.remove("ring-4","ring-amber-500","ring-offset-2"),3500))},500))},ir=async()=>{if($)if(xe==="inbox"){if(le.length===0||!window.confirm("Are you sure you want to completely delete all inbox alerts?"))return;try{await Promise.all(le.map(de=>ai(st(fe,"notifications",de.id)))),he.success("Inbox notifications cleared!",{icon:"🗑️"})}catch(de){he.error("Failed to empty inbox: "+de.message)}}else{if(me.length===0||!window.confirm("Are you sure you want to dismiss all pending invites?"))return;try{await Promise.all(me.map(de=>ai(st(fe,"invitations",de.id)))),he.success("Invites dismissed!",{icon:"🗑️"})}catch(de){he.error("Failed to empty invites: "+de.message)}}};I.useEffect(()=>{const de=(Ze,Ft)=>{const Fr=Ze?Ze.slice(0,2).trim().toUpperCase():"CE",gr=(Ft==null?void 0:Ft.toLowerCase())||"news";let Cr="%23ef4444";return gr==="sports"&&(Cr="%233b82f6"),gr==="opinion"&&(Cr="%2310b981"),gr==="lifestyle"&&(Cr="%238b5cf6"),gr==="entertainment"&&(Cr="%23f59e0b"),`data:image/svg+xml;utf8,${Fr}`},ke=setTimeout(async()=>{if(T.trim().length>1){const Ze=T.toLowerCase(),Ft=[];if(a.forEach(xt=>{var mr,Ht,kr,mn,fi,_s;const Or=(mr=xt.title)==null?void 0:mr.toLowerCase().includes(Ze),_t=(Ht=xt.content)==null?void 0:Ht.toLowerCase().includes(Ze),Oe=(kr=xt.summary)==null?void 0:kr.toLowerCase().includes(Ze),ar=(mn=xt.category)==null?void 0:mn.toLowerCase().includes(Ze),ft=(fi=xt.authorName)==null?void 0:fi.toLowerCase().includes(Ze);(Or||_t||Oe||ar||ft)&&Ft.push({id:xt.id,type:"article",title:xt.title,subtitle:xt.summary||((_s=xt.content)==null?void 0:_s.slice(0,80)),category:xt.category||"Opinion",imageUrl:xt.featuredImageUrl||de(xt.title,xt.category),originalObject:xt})}),yn.forEach(xt=>{var ar,ft,mr,Ht;const Or=(ar=xt.text)==null?void 0:ar.toLowerCase().includes(Ze),_t=(ft=xt.authorName)==null?void 0:ft.toLowerCase().includes(Ze),Oe=(mr=xt.category)==null?void 0:mr.toLowerCase().includes(Ze);(Or||_t||Oe)&&Ft.push({id:xt.id,type:"post",title:((Ht=xt.text)==null?void 0:Ht.slice(0,50))||"Lounge Conversation",subtitle:`Active discussion by @${(xt.authorName||"peer").toLowerCase().replace(/\s+/g,"")}`,category:`Forum • ${xt.category||"Opinion"}`,imageUrl:xt.imageUrl||xt.authorPhotoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(xt.authorName||"Peer")}`,originalObject:xt})}),Wr.forEach(xt=>{var ar,ft,mr,Ht;const Or=(ar=xt.displayName)==null?void 0:ar.toLowerCase().includes(Ze),_t=(ft=xt.email)==null?void 0:ft.toLowerCase().includes(Ze),Oe=(mr=xt.role)==null?void 0:mr.toLowerCase().includes(Ze);(Or||_t||Oe)&&Ft.push({id:xt.uid,type:"user",title:xt.displayName||((Ht=xt.email)==null?void 0:Ht.split("@")[0])||"User Profile",subtitle:`${xt.role==="admin"?"🛡️ Campus Administrator":"🎓 Lounge Member"} • @${(xt.displayName||"user").toLowerCase().replace(/\s+/g,"")}`,category:xt.role==="admin"?"Admins":"Users",imageUrl:xt.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(xt.displayName||"u")}`,originalObject:xt})}),Rt.forEach(xt=>{var ar,ft,mr;const Or=(ar=xt.title)==null?void 0:ar.toLowerCase().includes(Ze),_t=(ft=xt.brand)==null?void 0:ft.toLowerCase().includes(Ze),Oe=(mr=xt.description)==null?void 0:mr.toLowerCase().includes(Ze);(Or||_t||Oe)&&Ft.push({id:xt.id,type:"advert",title:xt.title||"Brand Advertisement Offer",subtitle:`${xt.brand||"Promotional Offer"} — ${xt.description||"Sponsored partnership dispatch"}`,category:"Business Adverts",imageUrl:xt.imageUrl||de(xt.title,"Business Adverts"),originalObject:xt})}),fr.forEach(xt=>{var Oe,ar;const Or=(Oe=xt.title)==null?void 0:Oe.toLowerCase().includes(Ze),_t=(ar=xt.description)==null?void 0:ar.toLowerCase().includes(Ze);(Or||_t)&&Ft.push({id:xt.id,type:"pinned",title:xt.title||"Pinned notice announcement",subtitle:xt.description||"Pinned global campus broadcast notice",category:"Pinned Highlights",imageUrl:xt.imageUrl||de(xt.title,"Pinned Highlights"),originalObject:xt})}),c.forEach(xt=>{var Oe,ar;const Or=(Oe=xt.title)==null?void 0:Oe.toLowerCase().includes(Ze),_t=(ar=xt.content)==null?void 0:ar.toLowerCase().includes(Ze);(Or||_t)&&Ft.push({id:xt.id,type:"customPage",title:xt.title||"Dynamic Publication Tab",subtitle:"Custom institutional publication page",category:"Custom Pages",imageUrl:de(xt.title,"Custom Pages"),originalObject:xt})}),Ft.length<5)try{(await vr(Jt(nt(fe,"articles"),yi(80)))).docs.forEach(Or=>{var ar,ft,mr,Ht,kr,mn;const _t={id:Or.id,...Or.data()};if(!Ft.some(fi=>fi.id===Or.id)){const fi=(ar=_t.title)==null?void 0:ar.toLowerCase().includes(Ze),_s=(ft=_t.content)==null?void 0:ft.toLowerCase().includes(Ze),xn=(mr=_t.summary)==null?void 0:mr.toLowerCase().includes(Ze),Js=(Ht=_t.category)==null?void 0:Ht.toLowerCase().includes(Ze),cs=(kr=_t.authorName)==null?void 0:kr.toLowerCase().includes(Ze);if((fi||_s||xn||Js||cs)&&(Ft.push({id:Or.id,type:"article",title:_t.title,subtitle:_t.summary||((mn=_t.content)==null?void 0:mn.slice(0,80)),category:_t.category||"Opinion",imageUrl:_t.featuredImageUrl||de(_t.title,_t.category),originalObject:_t}),_t.title)){const ji=_t.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Kn=`${window.location.origin}/articles=${ji}/${Or.id}`;fetch("/api/append-sitemap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Kn,title:_t.title,image:_t.featuredImageUrl})}).catch(()=>{})}}})}catch(xt){console.warn("Deep Firestore search lookup notice:",xt)}const Fr=["campus","eye","media","campuseyemedia"];if(Ze.split(/\s+/).filter(Boolean).some(xt=>Fr.includes(xt))&&Ft.length<5&&a.forEach(xt=>{var _t;!Ft.some(Oe=>Oe.id===xt.id&&Oe.type==="article")&&Ft.length<10&&Ft.push({id:xt.id,type:"article",title:xt.title,subtitle:xt.summary||((_t=xt.content)==null?void 0:_t.slice(0,80)),category:xt.category||"Feature",imageUrl:xt.featuredImageUrl||de(xt.title,xt.category),originalObject:xt})}),X(Ft.slice(0,12)),w){F(!0);const xt=a.map(_t=>_t.title).concat(Ft.slice(0,3).map(_t=>_t.title)),Or=await bye(T,xt);B(Or),F(!1)}}else X([]),B([]);e(T)},500);return()=>clearTimeout(ke)},[T,a,yn,Wr,Rt,fr,c,e,w]);const pr=()=>{D(""),X([]),e("")},br=de=>{if(D(""),X([]),A(!1),e(""),de.type==="article"){const ke=new CustomEvent("selectArticle",{detail:de.originalObject});window.dispatchEvent(ke)}else if(de.type==="customPage")h&&h(de.originalObject);else if(de.type==="post"){const ke=new CustomEvent("selectPost",{detail:de.originalObject});window.dispatchEvent(ke)}else if(de.type==="user"){const ke=new CustomEvent("selectUser",{detail:de.originalObject});window.dispatchEvent(ke)}else if(de.type==="advert")if(de.originalObject.link)window.open(de.originalObject.link,"_blank","noopener,noreferrer");else{const ke=new CustomEvent("selectAdvert",{detail:de.originalObject});window.dispatchEvent(ke)}else if(de.type==="pinned")if(de.originalObject.link)window.open(de.originalObject.link,"_blank","noopener,noreferrer");else{const ke=new CustomEvent("selectPinned",{detail:de.originalObject});window.dispatchEvent(ke)}},ln=ie.useMemo(()=>{const de=gr=>{if(!gr)return"";let Cr=gr.toLowerCase().trim().replace(/[^a-z0-9]/g,"");return(Cr==="campusnews"||Cr==="news"||Cr==="campus-news")&&(Cr="news"),(Cr==="sports"||Cr==="sport")&&(Cr="sport"),Cr},Ze=Array.from(new Set(a.map(gr=>gr.category).filter(Boolean))).map(gr=>({id:de(gr),label:gr})),Ft=new Set,Fr=[];return Fr.push({id:"for-you",label:"For You"}),Ft.add("for-you"),Fr.push({id:"home",label:"Home"}),Ft.add("home"),Ze.forEach(gr=>{!Ft.has(gr.id)&&Fr.length<6&&(Ft.add(gr.id),Fr.push(gr))}),Fr.length<=2?[{id:"for-you",label:"For You"},{id:"home",label:"Home"},{id:"news",label:"News"},{id:"sport",label:"Sports"},{id:"business",label:"Business"}]:Fr},[a]);return s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"fixed top-0 left-0 right-0 z-50 bg-white/40 dark:bg-neutral-950/40 backdrop-blur-xl border-b border-white/20 dark:border-white/10 shadow-lg shadow-black/5 backdrop-saturate-150 transition-all duration-300",children:[s.jsxs("div",{className:"w-full max-w-[1680px] xl:max-w-[1780px] 2xl:max-w-[1880px] mx-auto px-2 sm:px-4 lg:px-6 xl:px-8 h-8.5 sm:h-9.5 flex items-center justify-between",children:[s.jsxs("div",{onClick:()=>{r("home"),h&&h(null),window.scrollTo({top:0,behavior:"smooth"})},className:"flex items-center gap-1 sm:gap-1.5 cursor-pointer hover:opacity-80 transition-opacity select-none h-6.5 sm:h-7.5",title:"Campus Eye Media - Scroll to top",children:[s.jsx("img",{src:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",alt:"Campus Eye Logo",className:"h-5 w-5 sm:h-6 sm:w-6 rounded-full border border-gray-950 bg-white object-cover aspect-square shrink-0",referrerPolicy:"no-referrer"}),s.jsxs("div",{className:"flex flex-col justify-center text-left select-none -space-y-1",children:[s.jsxs("span",{className:"text-[10.5px] sm:text-[11.5px] md:text-[12.5px] font-serif font-black tracking-custom italic",children:[s.jsx("span",{className:"text-red-650",children:"Campus"})," ",s.jsx("span",{className:"text-blue-600",children:"Eye"})]}),s.jsx("span",{className:"text-[5.5px] sm:text-[6px] md:text-[6.5px] font-sans font-extrabold uppercase tracking-[0.22em] text-black text-right pr-0.5 block select-none",children:"Media"})]})]}),s.jsx("nav",{className:"hidden lg:flex items-center space-x-1",children:ln.map(de=>{const ke=de.id==="home";return s.jsxs(ie.Fragment,{children:[s.jsx("button",{onClick:()=>{r(de.id),h&&h(null)},className:Ge("text-[10px] font-black tracking-wider px-2.5 py-1.5 rounded-full transition-all duration-200 uppercase cursor-pointer",t===de.id&&!f?"bg-gray-100 text-gray-950 font-black":"text-gray-500 hover:text-gray-950 hover:bg-gray-50"),children:de.label}),ke&&c&&c.length>0&&(()=>{var Or;const Ze=c[0],Fr=Date.now()-((Or=Ze.createdAt)!=null&&Or.seconds?Ze.createdAt.seconds*1e3:Date.now())<10080*60*1e3,gr=(f==null?void 0:f.id)===Ze.id,Cr=c.slice(1),xt=Cr.find(_t=>(f==null?void 0:f.id)===_t.id);return s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsxs("button",{onClick:()=>h&&h(Ze),className:Ge("text-[9.5px] font-black tracking-wider px-2.5 py-1.5 rounded-full uppercase flex items-center gap-1.5 cursor-pointer transition-all duration-200 relative border shrink-0",gr?"bg-red-650 border-red-650 text-white shadow-xs":"bg-red-50/70 border-red-150 text-red-650 hover:bg-red-100/40"),title:`Open ${Ze.name} pop-out`,children:[Ze.svgIcon?s.jsx("span",{className:Ge("shrink-0 w-2.5 h-2.5 flex items-center justify-center",gr?"text-white":"text-red-655"),dangerouslySetInnerHTML:{__html:Ze.svgIcon.includes("${Ze.svgIcon}`}}):s.jsx("span",{className:Ge("w-1 h-1 rounded-full shrink-0",gr?"bg-white":"bg-red-655")}),s.jsx("span",{children:Ze.name}),Fr&&s.jsx("span",{className:"absolute -top-1 -right-1 bg-red-600 text-white text-[5px] font-bold uppercase px-1 py-0.2 rounded-full scale-90 select-none shrink-0",children:"New"})]}),Cr.length>0&&s.jsxs("div",{className:"relative shrink-0 z-[999]",children:[s.jsxs("button",{onClick:()=>jt(!Fe),className:Ge("text-[9.5px] font-black tracking-wider px-2.5 py-1.5 rounded-full uppercase flex items-center gap-1 cursor-pointer transition-all duration-250 border",xt?"bg-red-650 border-red-650 text-white shadow-xs":"bg-gray-100 border-gray-200 text-gray-700 hover:bg-gray-150"),children:[s.jsx("span",{children:"More"}),xt&&s.jsxs("span",{className:"text-[8px] opacity-90 mx-0.5",children:["(",xt.name,")"]}),s.jsx("svg",{className:Ge("w-2.5 h-2.5 transition-transform duration-200",Fe?"rotate-180":"rotate-0"),fill:"none",stroke:"currentColor",strokeWidth:"3",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),s.jsx(on,{children:Fe&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-[49] bg-transparent",onClick:()=>jt(!1)}),s.jsx(Qt.div,{initial:{opacity:0,scale:.95,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:4},transition:{duration:.12},className:"absolute left-0 mt-1.5 w-44 bg-white border border-gray-150 rounded-xl shadow-2xl z-[99999] py-1 overflow-hidden",children:Cr.map(_t=>{const Oe=(f==null?void 0:f.id)===_t.id;return s.jsxs("button",{onClick:()=>{h&&h(_t),jt(!1)},className:Ge("w-full text-left px-3.5 py-2 hover:bg-gray-50 text-[9px] font-black uppercase tracking-wider flex items-center justify-between transition-colors",Oe?"text-red-650 bg-red-50/40":"text-gray-750 hover:text-black"),children:[s.jsx("span",{className:"truncate pr-2",children:_t.name}),Oe&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-650 shrink-0"})]},_t.id)})})]})})]})]},"custom-nav-group")})()]},de.id)})}),s.jsxs("div",{className:"flex items-center gap-2.5 sm:gap-3 relative",children:[$&&n&&s.jsx("button",{onClick:m,className:"text-gray-750 hover:text-red-650 p-1 rounded-full hover:bg-gray-100/60 transition-colors flex items-center justify-center cursor-pointer",title:"Passes & Ticket Verification",children:s.jsx(BS,{size:14,className:"text-gray-700 hover:text-red-650"})}),s.jsx("button",{onClick:U,className:"text-gray-750 hover:text-red-650 p-1 rounded-full hover:bg-gray-100/60 transition-colors flex items-center justify-center cursor-pointer",title:"Switch Theme",children:s.jsx(Mpe,{size:15})}),s.jsx("button",{onClick:()=>A(!0),className:"text-gray-750 hover:text-red-650 p-1 rounded-full hover:bg-gray-100/60 transition-colors flex items-center justify-center cursor-pointer",title:"Search Stories & Communities",children:s.jsx(Rpe,{size:15})}),$&&s.jsxs("div",{className:"relative",children:[(()=>{const de=le.filter(Ze=>!Ze.used).length,ke=de+me.length;return s.jsxs("button",{onClick:()=>se(!Z),className:"text-gray-700 hover:text-gray-950 p-1.5 rounded-full hover:bg-gray-50 transition-all flex items-center justify-center relative cursor-pointer font-sans",title:`${me.length} Invites, ${de} Unread Alerts`,children:[s.jsx(Ru,{size:14,className:Ge(ke>0&&"animate-bounce text-red-650")}),ke>0&&s.jsx("span",{className:"absolute -top-1 -right-1.5 px-1 py-0.2 bg-red-650 text-white font-black text-[8px] leading-none rounded-full border-2 border-white shadow-xs flex items-center justify-center min-w-[15px] h-[15px]",children:ke>99?"99+":ke})]})})(),s.jsx(on,{children:Z&&s.jsxs(Qt.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"fixed sm:absolute top-14 sm:top-auto left-2.5 sm:left-auto right-2.5 sm:right-0 mt-0 sm:mt-2.5 w-[calc(100vw-1.25rem)] sm:w-96 max-w-sm sm:max-w-md bg-white border border-gray-150 rounded-2xl shadow-2xl z-[200] p-3 text-left space-y-3 max-h-[82vh] overflow-y-auto",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between border-b border-gray-100 pb-2 gap-1.5",children:[s.jsx("button",{onClick:()=>r("account"),className:"hidden"}),s.jsxs("div",{className:"flex flex-1 min-w-[190px] gap-1 p-0.5 bg-gray-50 border border-gray-100 rounded-xl",children:[s.jsxs("button",{onClick:()=>ae("inbox"),id:"notif-tab-inbox",className:Ge("flex-1 py-1.5 rounded-lg text-center text-[9px] font-black uppercase tracking-wider transition-all cursor-pointer truncate",xe==="inbox"?"bg-white text-gray-950 shadow-2xs":"text-gray-400 hover:text-gray-955"),children:["📩 Inbox (",le.filter(de=>!de.used).length,")"]}),s.jsxs("button",{onClick:()=>ae("messages"),id:"notif-tab-messages",className:Ge("flex-1 py-1.5 rounded-lg text-center text-[9px] font-black uppercase tracking-wider transition-all cursor-pointer flex items-center justify-center gap-1 truncate",xe==="messages"?"bg-white text-gray-950 shadow-2xs":"text-gray-400 hover:text-gray-955"),children:[s.jsx("span",{children:"💬 Chat"}),je.length>0&&s.jsx("span",{className:"px-1 py-0.2 bg-blue-100 text-blue-700 text-[8px] font-extrabold rounded-full",children:je.length})]}),s.jsxs("button",{onClick:()=>ae("invites"),id:"notif-tab-invites",className:Ge("flex-1 py-1.5 rounded-lg text-center text-[9px] font-black uppercase tracking-wider transition-all cursor-pointer truncate",xe==="invites"?"bg-white text-gray-950 shadow-2xs":"text-gray-400 hover:text-gray-955"),children:["🤝 Invites (",me.length,")"]})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0 ml-auto",children:[s.jsxs("button",{onClick:async()=>{await NK()?(j1("🔔 Push Notifications Active!",{body:"Campus Eye system notifications will pop up directly on your device screen!",toneStyle:"crystal"}),he.success("Native Device Push Notifications Enabled!",{icon:"🔔"})):he("Acoustic chimes active! Allow notifications in browser settings for native popups.",{icon:"🎵"})},className:"px-2 py-1 bg-blue-50 hover:bg-blue-100 text-blue-700 rounded-xl transition-all cursor-pointer shrink-0 border border-blue-200 flex items-center gap-1 text-[9px] font-black uppercase tracking-wider shadow-2xs",title:"Enable Device System Push Notifications & Test Audio Chime",children:[s.jsx(Ru,{size:11,className:"text-blue-600"}),s.jsx("span",{children:"Push"})]}),(xe==="inbox"&&le.length>0||xe==="invites"&&me.length>0)&&s.jsx("button",{onClick:ir,className:"p-1.5 bg-gray-50 hover:bg-red-50 text-gray-500 hover:text-red-650 rounded-xl transition-all cursor-pointer shrink-0 border border-transparent hover:border-red-150",title:xe==="inbox"?"Empty and delete all alerts":"Decline and dismiss all invites",children:s.jsx(Es,{size:13})})]})]}),xe==="inbox"&&le.length>0&&s.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 no-scrollbar border-b border-gray-100",children:[{id:"all",label:"All",icon:"📬"},{id:"broadcast",label:"Broadcasts",icon:"📢"},{id:"social",label:"Social & Replies",icon:"💬"},{id:"passes",label:"Pass Keys",icon:"🎟️"},{id:"system",label:"System & AI",icon:"🛡️"}].map(de=>{const ke=le.filter(Ze=>de.id==="all"?!0:Xe(Ze).category===de.id).length;return s.jsxs("button",{onClick:()=>pt(de.id),className:Ge("px-2 py-1 rounded-lg text-[8px] font-black uppercase tracking-wider whitespace-nowrap transition-all flex items-center gap-1 cursor-pointer shrink-0",qe===de.id?"bg-gray-950 text-white shadow-2xs":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:[s.jsx("span",{children:de.icon}),s.jsx("span",{children:de.label}),s.jsxs("span",{className:"opacity-70 font-mono",children:["(",ke,")"]})]},de.id)})}),me.length===0&&le.length===0?s.jsx("div",{className:"py-8 text-center text-gray-400 text-[10px] font-bold uppercase tracking-wider",children:"Inbox Terminal Empty"}):xe==="inbox"?s.jsx("div",{className:"space-y-2 max-h-72 overflow-y-auto pr-1",children:(()=>{const de=le.filter(ke=>qe==="all"?!0:Xe(ke).category===qe);return de.length===0?s.jsxs("div",{className:"py-8 text-center text-xs text-gray-400 uppercase font-bold",children:["No ",qe," notifications found."]}):de.slice(0,20).map((ke,Ze)=>{var Or;const Ft=Xe(ke),Fr=Ft.IconComponent,gr=!!Ie[ke.id],Cr=ke.imageUrl||ke.image,xt=ke.message||ke.fullAnswer||"";return s.jsxs(Qt.div,{drag:"x",dragConstraints:{left:-60,right:60},dragElastic:.15,onDragEnd:(_t,Oe)=>{Math.abs(Oe.offset.x)>35&&(Ie[ke.id]||St(ke.id),he.success(`Swiped to reply to ${ke.senderName||"notification"}!`,{icon:"💬"}))},onClick:()=>{gr?Lr(ke):St(ke.id)},className:Ge("p-3 rounded-2xl border transition-all text-left flex flex-col gap-2 cursor-pointer relative group/notif overflow-hidden shadow-2xs hover:shadow-md touch-pan-y",Ft.borderClass,Ft.bgClass),children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:Ge("w-6 h-6 rounded-lg flex items-center justify-center shrink-0 shadow-2xs",Ft.iconBg),children:s.jsx(Fr,{size:13})}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[!ke.used&&s.jsx("span",{className:"w-2 h-2 bg-red-600 rounded-full animate-pulse shrink-0",title:"Unread"}),s.jsx("span",{className:Ge("text-[8.5px] font-black uppercase px-2 py-0.5 rounded-md tracking-wider shrink-0 shadow-2xs",Ft.badgeClass),children:Ft.typeLabel})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx("span",{className:"text-[8px] font-mono font-bold text-gray-500 bg-white/80 px-1.5 py-0.5 rounded border border-gray-100",children:Gt(ke.createdAt)}),s.jsx("button",{onClick:_t=>St(ke.id,_t),className:"p-1 bg-white/80 hover:bg-white text-gray-700 hover:text-black rounded-lg transition-all cursor-pointer border border-gray-200/80 shadow-2xs flex items-center gap-1 text-[9px] font-black uppercase px-1.5",title:gr?"Minimize notification":"Expand notification details",children:gr?s.jsxs(s.Fragment,{children:[s.jsx(gf,{size:12,strokeWidth:2.5,className:"text-red-600"}),s.jsx("span",{className:"text-[8px] font-bold hidden sm:inline",children:"Minimize"})]}):s.jsxs(s.Fragment,{children:[s.jsx(Md,{size:12,strokeWidth:2.5,className:"text-indigo-600"}),s.jsx("span",{className:"text-[8px] font-bold hidden sm:inline",children:"Expand"})]})}),s.jsx("button",{onClick:_t=>yr(ke.id,_t),className:"p-1 text-gray-400 hover:text-red-600 hover:bg-white rounded-md transition-all cursor-pointer opacity-80 group-hover/notif:opacity-100",title:"Delete notification",children:s.jsx(Jr,{size:12})})]})]}),s.jsxs("div",{className:"flex items-start gap-2.5 justify-between min-w-0",children:[s.jsxs("div",{className:"flex-1 min-w-0 break-words",children:[s.jsx("h5",{className:"text-[11px] font-black uppercase text-gray-950 leading-snug tracking-tight break-words",children:ke.title}),s.jsx("div",{className:Ge("text-[10px] text-gray-700 leading-relaxed mt-0.5 font-medium break-words overflow-hidden",!gr&&"line-clamp-2"),children:(()=>{const _t=/(https?:\/\/[^\s]+)/g;return xt.split(_t).map((ar,ft)=>{if(ar.match(_t)){const mr=Xt[ar];return s.jsxs("a",{href:ar,target:"_blank",rel:"noopener noreferrer",onClick:Ht=>{Ht.stopPropagation(),or(ar),Lt(ke)},className:Ge("inline-flex items-center gap-0.5 font-bold underline transition-all mx-0.5 px-1.5 py-0.5 rounded text-[9px]",mr?"text-emerald-800 bg-emerald-100 border border-emerald-300 font-extrabold":"text-indigo-600 hover:text-indigo-800 bg-indigo-50 border border-indigo-200"),children:[s.jsx(wd,{size:9,className:"shrink-0"}),mr?"✓ Visited Link":ar.length>28?ar.substring(0,25)+"...":ar]},ft)}return ar})})()})]}),!gr&&Cr&&s.jsx("div",{onClick:_t=>St(ke.id,_t),className:"w-12 h-12 rounded-xl overflow-hidden border border-gray-200 shrink-0 shadow-2xs relative bg-gray-100 cursor-pointer hover:scale-105 transition-transform",title:"Click to expand image",children:s.jsx(Bi,{src:Cr,alt:ke.title||"Notification thumbnail",className:"w-full h-full object-cover"})})]}),gr&&s.jsxs("div",{className:"space-y-2 mt-1 animate-in fade-in slide-in-from-top-1 duration-200",children:[Cr&&s.jsxs("div",{className:"rounded-xl overflow-hidden border border-gray-200/90 h-44 sm:h-52 w-full relative shadow-sm group/img bg-black/5",children:[s.jsx(Bi,{src:Cr,alt:ke.title||"Broadcast image",title:ke.title,className:"w-full h-full object-cover"}),s.jsx("div",{className:"absolute top-2 right-2 px-2 py-1 bg-black/70 backdrop-blur-md text-white text-[8px] font-black uppercase rounded-lg tracking-wider border border-white/20",children:"Full Preview"})]}),ke.code&&!ke.used&&s.jsxs("div",{className:"p-2.5 bg-purple-900/10 border border-purple-200 rounded-xl flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Ea,{size:14,className:"text-purple-700 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[7.5px] font-black uppercase text-purple-900 tracking-wider",children:"Pass Verification Pin"}),s.jsx("code",{className:"text-xs font-black font-mono text-purple-950 tracking-widest",children:ke.code})]})]}),s.jsxs("button",{onClick:_t=>{_t.stopPropagation(),Od(ke.code),he.success("Verification pin copied!",{icon:"📋"}),Lt(ke)},className:"px-2.5 py-1 bg-purple-700 hover:bg-purple-800 text-white rounded-lg transition-all flex items-center gap-1 text-[8.5px] font-black uppercase tracking-wider shrink-0 cursor-pointer shadow-xs",children:[s.jsx(t2,{size:10})," Copy Pin"]})]}),(ke.canReply||ke.type==="direct_message"||ke.senderId)&&ke.senderId!==($==null?void 0:$.uid)&&s.jsxs("div",{onClick:_t=>_t.stopPropagation(),className:"p-2.5 bg-indigo-50/80 border border-indigo-200/90 rounded-xl space-y-2 mt-2 shadow-2xs text-left",children:[s.jsxs("div",{className:"flex items-center justify-between gap-1 text-[9px] font-black uppercase tracking-wider text-indigo-900",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Xs,{size:12,className:"text-indigo-600 shrink-0"}),s.jsxs("span",{className:"truncate",children:["Reply to ",ke.senderName?`@${ke.senderName.toLowerCase().replace(/\s+/g,"")}`:"Friend"]})]}),ke.senderId&&s.jsxs("button",{onClick:_t=>{_t.stopPropagation(),window.dispatchEvent(new CustomEvent("open-imessage-friend",{detail:{uid:ke.senderId,displayName:ke.senderName||"Campus Friend",username:ke.senderUsername||"friend",photoURL:ke.senderPhotoURL||""}}))},className:"px-2 py-0.5 bg-[#007AFF] hover:bg-blue-600 text-white rounded-md text-[8px] font-black uppercase tracking-wider flex items-center gap-1 shrink-0 cursor-pointer shadow-2xs",children:[s.jsx(Ri,{size:9})," iMessage Chat"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("input",{type:"text",value:Re[ke.id]||"",onChange:_t=>{_t.stopPropagation();const Oe=_t.target.value;It(ar=>({...ar,[ke.id]:Oe}))},onClick:_t=>_t.stopPropagation(),placeholder:"Type inbox reply...",className:"flex-1 text-[11px] font-sans px-2.5 py-1.5 bg-white border border-indigo-200 rounded-lg outline-none focus:border-indigo-600 transition-all text-gray-900 placeholder:text-gray-400",onKeyDown:_t=>{_t.key==="Enter"&&Ct(ke,_t)}}),s.jsxs("button",{onClick:_t=>Ct(ke,_t),disabled:Dt[ke.id]||!((Or=Re[ke.id])!=null&&Or.trim()),className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 text-white text-[9px] font-black uppercase tracking-wider rounded-lg flex items-center gap-1 cursor-pointer transition-all shrink-0 shadow-xs",children:[s.jsx(Eo,{size:10})," Reply"]})]})]}),s.jsxs("div",{className:"pt-2 border-t border-gray-200/60 flex items-center justify-between gap-2 flex-wrap",children:[(ke.link||ke.actionUrl)&&s.jsxs("a",{href:ke.link||ke.actionUrl,target:(ke.link||ke.actionUrl).startsWith("http")?"_blank":"_self",rel:"noopener noreferrer",onClick:_t=>{_t.stopPropagation();const Oe=ke.link||ke.actionUrl;or(Oe),Lt(ke)},className:Ge("px-3 py-1.5 text-[9px] font-black uppercase tracking-wider rounded-lg transition-all flex items-center gap-1.5 shadow-xs cursor-pointer",Xt[ke.link||ke.actionUrl]?"bg-emerald-100 text-emerald-800 border border-emerald-300 hover:bg-emerald-200":"bg-indigo-600 hover:bg-indigo-700 text-white border border-indigo-700"),children:[s.jsx(za,{size:11}),Xt[ke.link||ke.actionUrl]?"✓ Link Visited":"Open Target Link"]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[s.jsx("button",{onClick:_t=>{_t.stopPropagation(),Lt(ke)},className:"px-2 py-1 text-[8.5px] font-bold text-gray-600 hover:text-black bg-white/90 hover:bg-gray-100 rounded-lg border border-gray-200 transition-all cursor-pointer",children:"Mark Read"}),s.jsxs("button",{onClick:_t=>St(ke.id,_t),className:"px-2.5 py-1 text-[8.5px] font-black uppercase tracking-wider text-gray-700 hover:text-black bg-white hover:bg-gray-100 rounded-lg border border-gray-200 transition-all flex items-center gap-1 cursor-pointer",children:[s.jsx(bI,{size:10})," Minimize"]})]})]})]})]},`navnotif-${ke.id}-${Ze}`)})})()}):xe==="messages"?s.jsx("div",{className:"space-y-2 max-h-72 overflow-y-auto pr-1",children:je.length===0?s.jsxs("div",{className:"py-8 text-center text-xs text-gray-400 uppercase font-bold flex flex-col items-center justify-center gap-2",children:[s.jsx(Ri,{size:22,className:"text-gray-300"}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"No Message Threads Yet"}),s.jsx("p",{className:"text-[9px] text-gray-400 font-normal normal-case max-w-xs",children:"People you have messaged or who have messaged you will show here. Tap any peer to open inbox!"})]}):je.map((de,ke)=>s.jsxs("div",{onClick:()=>{const Ze={uid:de.peerUid,displayName:de.peerName,username:de.peerUsername,photoURL:de.peerPhoto};y&&y(Ze),window.dispatchEvent(new CustomEvent("open-imessage-friend",{detail:Ze})),se(!1)},className:"flex items-center justify-between p-2 rounded-xl bg-gray-50/80 hover:bg-blue-50/90 border border-gray-200 hover:border-blue-300 transition-all cursor-pointer group shadow-2xs",children:[s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("img",{src:de.peerPhoto,alt:"",className:"w-8 h-8 rounded-full object-cover border border-white shadow-xs",referrerPolicy:"no-referrer"}),s.jsx("span",{className:"absolute bottom-0 right-0 w-2.5 h-2.5 bg-emerald-500 rounded-full border-2 border-white"})]}),s.jsxs("div",{className:"min-w-0 text-left",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("p",{className:"text-[11px] font-black uppercase text-gray-900 truncate group-hover:text-blue-600 transition-colors",children:de.peerName}),s.jsxs("span",{className:"text-[9px] font-medium text-gray-400 truncate",children:["@",de.peerUsername]})]}),s.jsx("p",{className:"text-[10px] text-gray-600 truncate font-normal",children:de.lastMessage})]})]}),s.jsxs("div",{className:"flex flex-col items-end shrink-0 gap-1 ml-2",children:[s.jsx("span",{className:"text-[8px] font-bold text-gray-400",children:Gt(de.lastTimestamp)}),de.unreadCount>0&&s.jsx("span",{className:"px-1.5 py-0.5 bg-[#2AABEE] text-white text-[8px] font-black rounded-full shadow-2xs",children:de.unreadCount})]})]},`navconv-${de.peerUid}-${ke}`))}):s.jsxs("div",{className:"space-y-3 max-h-72 overflow-y-auto pr-1",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"text-[8px] font-black uppercase text-gray-400 tracking-wider mb-1.5",children:["Incoming requests (",me.length,")"]}),me.length===0?s.jsx("p",{className:"text-[9px] text-gray-400 font-medium py-1.5 px-2 bg-gray-50/50 rounded-xl leading-snug",children:"No incoming lounge invites right now."}):s.jsx("div",{className:"space-y-2",children:me.map(de=>s.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-50/55 rounded-xl border border-gray-150 gap-2 hover:bg-gray-50 transition-all",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("img",{src:de.senderPhotoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(de.senderName)}&background=random`,className:"w-7 h-7 rounded-full object-cover shrink-0 border border-gray-100",alt:"",referrerPolicy:"no-referrer"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[10px] font-black uppercase text-gray-950 truncate tracking-tight",children:de.senderName}),s.jsxs("p",{className:"text-[8px] text-gray-400 truncate",children:["@",de.senderName.toLowerCase().replace(/\s+/g,"")]})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx("button",{onClick:()=>$e(de),className:"w-5 h-5 rounded-full bg-emerald-50 text-emerald-650 hover:bg-emerald-600 hover:text-white flex items-center justify-center transition-all cursor-pointer border border-emerald-150/45 shadow-xs",title:"Accept Connection & Start Chatting",children:s.jsx(zu,{size:10,strokeWidth:3})}),s.jsx("button",{onClick:()=>ct(de),className:"w-5 h-5 rounded-full bg-red-50 text-red-600 hover:bg-red-600 hover:text-white flex items-center justify-center transition-all cursor-pointer border border-red-150/45 shadow-xs",title:"Decline Connection Request",children:s.jsx(Jr,{size:10,strokeWidth:3})})]})]},de.id))})]}),s.jsxs("div",{className:"pt-2 border-t border-gray-100",children:[s.jsxs("div",{className:"text-[8px] font-black uppercase text-gray-400 tracking-wider mb-2 flex items-center justify-between",children:[s.jsx("span",{children:"Lounge Peer Directory"}),s.jsx("span",{className:"text-[7.5px] font-mono bg-red-50 text-red-600 px-1 rounded-md py-0.2 tracking-normal",children:"Direct Invite"})]}),s.jsxs("div",{className:"mb-2 relative",children:[s.jsx("input",{type:"text",placeholder:"Search classmate name...",value:Gr,onChange:de=>be(de.target.value),className:"w-full text-[9px] bg-gray-55/15 border border-transparent rounded-lg px-2.5 py-1 text-gray-800 outline-none focus:bg-white focus:border-red-600/30 transition-all font-sans font-bold"}),Gr&&s.jsx("button",{onClick:()=>be(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-650",children:s.jsx(Jr,{size:10})})]}),Wr.length===0?s.jsx("p",{className:"text-[8.5px] text-gray-400 font-bold py-3 text-center uppercase tracking-wider",children:"No other registered users"}):s.jsx("div",{className:"space-y-1.5 max-h-40 overflow-y-auto scrollbar-thin pr-0.5",children:Wr.filter(de=>{if(!Gr.trim())return!0;const ke=(de.displayName||"").toLowerCase(),Ze=(de.username||"").toLowerCase(),Ft=Gr.toLowerCase();return ke.includes(Ft)||Ze.includes(Ft)}).slice(0,Gr.trim()?15:3).map(de=>{const ke=en[de.uid];return s.jsxs("div",{className:"flex items-center justify-between p-1 px-1.5 bg-gray-50/30 rounded-xl border border-gray-100 hover:bg-gray-50/70 transition-all gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("img",{src:de.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(de.displayName||"P")}&background=random`,className:"w-5.5 h-5.5 rounded-full object-cover shrink-0 border border-gray-100",alt:"",referrerPolicy:"no-referrer"}),(de.isVerified||de.isPremium||de.blueCheck)&&s.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 bg-white rounded-full p-0.2 shadow-2xs",children:s.jsx(So,{size:8})})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("p",{className:"text-[9.5px] font-extrabold uppercase text-gray-950 truncate tracking-tight",children:de.displayName||"Faculty peer"}),(de.isVerified||de.isPremium||de.blueCheck)&&s.jsx(So,{size:9,className:"shrink-0 text-blue-500"})]}),s.jsxs("p",{className:"text-[7.5px] text-gray-400 truncate -mt-0.5",children:["@",(de.username||de.displayName||"").toLowerCase().replace(/\s+/g,"")]})]})]}),s.jsx("button",{onClick:()=>Pe(de),disabled:ke,className:Ge("text-[7px] font-sans font-black uppercase tracking-wider px-2 py-1 rounded-md border cursor-pointer transition-all active:scale-95 flex items-center gap-0.5 shrink-0 select-none",ke?"bg-gray-50 text-gray-400 border-gray-200 cursor-not-allowed":"bg-red-50 text-red-650 border-red-150 hover:bg-red-600 hover:text-white"),children:ke?"Invited":"Invite"})]},de.uid)})})]})]})]})})]}),s.jsx("button",{onClick:()=>{$?(r("account"),window.scrollTo({top:0,behavior:"smooth"})):o()},className:"flex items-center gap-1.5 text-gray-700 hover:text-gray-950 transition-colors group cursor-pointer",title:"My Account Profile",children:$?s.jsx("div",{className:"w-5 h-5 rounded-full overflow-hidden border border-gray-200 group-hover:border-red-600 transition-colors flex items-center justify-center bg-amber-50/50",children:$.photoURL?s.jsx("img",{src:$.photoURL,alt:"Profile",className:"w-full h-full object-cover",referrerPolicy:"no-referrer"}):s.jsx(h8,{size:20,className:"w-full h-full"})}):s.jsxs("div",{className:"flex items-center gap-1.5 bg-gray-55/10 border border-gray-150 rounded-full py-1.5 px-3 hover:bg-gray-100 hover:text-red-650 hover:border-red-150 transition-all text-gray-700",children:[s.jsx(h8,{size:14,className:"w-3.5 h-3.5 shrink-0"}),s.jsx("span",{className:"hidden xl:inline text-[9.5px] font-black uppercase tracking-wider",children:"Sign In"})]})}),s.jsx("button",{onClick:()=>j(!0),className:"p-1.5 text-gray-700 hover:text-red-650 hover:bg-gray-100 rounded-lg transition-all cursor-pointer border border-gray-200/60 shadow-2xs flex items-center justify-center ml-1",title:"Open Main Menu & App Tools",children:s.jsx(tE,{size:16,strokeWidth:2.5})})]})]}),typeof document<"u"&&JN.createPortal(s.jsx(on,{children:S&&s.jsxs(s.Fragment,{children:[s.jsx(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>j(!1),className:"fixed inset-0 bg-black/60 backdrop-blur-xs z-[1000000]"}),s.jsxs(Qt.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:220},className:"fixed top-0 right-0 bottom-0 w-80 max-w-[85vw] bg-white text-gray-900 z-[1000001] shadow-2xl border-l border-gray-200 flex flex-col justify-between overflow-y-auto text-left select-none p-5",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-gray-100 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("img",{src:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",alt:"",className:"w-7 h-7 rounded-full border border-gray-900 object-cover",referrerPolicy:"no-referrer"}),s.jsx("span",{className:"text-xs font-serif font-black uppercase tracking-wide",children:"Campus Eye Media"})]}),s.jsx("button",{onClick:()=>j(!1),className:"p-1.5 text-gray-400 hover:text-gray-950 rounded-full hover:bg-gray-100 transition-colors cursor-pointer",children:s.jsx(Jr,{size:16})})]}),s.jsxs("div",{className:"p-3 bg-gradient-to-br from-red-650 to-red-700 text-white rounded-2xl shadow-md mb-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx(Cie,{size:16,className:"text-amber-300"}),s.jsx("span",{className:"text-[11px] font-black uppercase tracking-wide",children:"Campus Eye Lite App"})]}),s.jsx("p",{className:"text-[9.5px] text-white/90 leading-tight mb-3 font-medium",children:"Install or download a lightweight web shortcut for instant 1-tap campus access!"}),s.jsxs("button",{onClick:()=>{V(),j(!1)},className:"w-full py-2 px-3 bg-white text-red-650 hover:bg-amber-50 font-black text-[10px] uppercase tracking-wider rounded-xl shadow-xs transition-all flex items-center justify-center gap-1.5 cursor-pointer",children:[s.jsx(eE,{size:13,strokeWidth:2.5}),s.jsx("span",{children:"Download Lite App"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"text-[9px] font-black uppercase text-gray-400 tracking-wider px-2 mb-1",children:"Navigation"}),s.jsxs("button",{onClick:()=>{r("home"),j(!1)},className:"w-full text-left px-3 py-2.5 rounded-xl text-xs font-bold text-gray-800 hover:bg-gray-50 flex items-center gap-3 transition-colors cursor-pointer",children:[s.jsx(Wh,{size:15,className:"text-red-600"}),s.jsx("span",{children:"Main Newsfeed"})]}),s.jsxs("button",{onClick:()=>{r("posts"),j(!1)},className:"w-full text-left px-3 py-2.5 rounded-xl text-xs font-bold text-gray-800 hover:bg-gray-50 flex items-center gap-3 transition-colors cursor-pointer",children:[s.jsx(Ri,{size:15,className:"text-blue-600"}),s.jsx("span",{children:"Student Lounge & Posts"})]}),s.jsxs("button",{onClick:()=>{r("podcasts"),j(!1)},className:"w-full text-left px-3 py-2.5 rounded-xl text-xs font-bold text-gray-800 hover:bg-gray-50 flex items-center gap-3 transition-colors cursor-pointer",children:[s.jsx(mc,{size:15,className:"text-emerald-600"}),s.jsx("span",{children:"Audio Podcasts"})]}),s.jsxs("button",{onClick:()=>{r("tickets"),j(!1)},className:"w-full text-left px-3 py-2.5 rounded-xl text-xs font-bold text-gray-800 hover:bg-gray-50 flex items-center gap-3 transition-colors cursor-pointer",children:[s.jsx(Ea,{size:15,className:"text-purple-600"}),s.jsx("span",{children:"Event Tickets Store"})]}),n&&s.jsxs("button",{onClick:()=>{i==null||i(),j(!1)},className:"w-full text-left px-3 py-2.5 rounded-xl text-xs font-black uppercase tracking-wider text-amber-600 bg-amber-50 hover:bg-amber-100 flex items-center gap-3 transition-colors mt-2 cursor-pointer",children:[s.jsx(vI,{size:15,className:"text-amber-600"}),s.jsx("span",{children:"Admin Control Center"})]})]})]}),s.jsxs("div",{className:"pt-4 border-t border-gray-100 text-[9px] text-gray-400 font-mono font-bold flex justify-between items-center",children:[s.jsx("span",{children:"v2.5 Lite Ready"}),s.jsx("span",{children:"Campus Eye Media"})]})]})]})}),document.body),s.jsx("div",{className:"lg:hidden flex items-center space-x-1.5 overflow-x-auto px-2.5 py-1 border-t border-gray-100/70 scrollbar-none",children:ln.map(de=>{const ke=de.id==="home";return s.jsxs(ie.Fragment,{children:[s.jsx("button",{onClick:()=>{r(de.id),h&&h(null)},className:Ge("text-[8.5px] font-extrabold tracking-wider px-2 py-0.5 rounded-full shrink-0 uppercase transition-all",t===de.id&&!f?"bg-gray-950 text-white":"bg-gray-50 text-gray-500 border border-gray-100"),children:de.label}),ke&&c&&c.length>0&&(()=>{const Ze=c[0],Ft=(f==null?void 0:f.id)===Ze.id,Fr=c.slice(1),gr=Fr.find(Cr=>(f==null?void 0:f.id)===Cr.id);return s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx("button",{onClick:()=>h&&h(Ze),className:Ge("text-[9px] font-extrabold tracking-wider px-2.5 py-1 rounded-full shrink-0 uppercase flex items-center gap-1.2 transition-all border",Ft?"bg-red-650 border-red-650 text-white":"bg-red-50/70 border-red-150 text-red-655"),children:Ze.name},Ze.id),Fr.length>0&&s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>Ae(!Pt),className:Ge("p-1.5 rounded-full shrink-0 flex items-center justify-center transition-all border",gr?"bg-red-655 border-red-655 text-white":"bg-gray-100 border-gray-200 text-gray-650"),title:"More Channels",children:s.jsx("svg",{className:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",strokeWidth:"3.5",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),s.jsx(on,{children:Pt&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-[49] bg-transparent",onClick:()=>Ae(!1)}),s.jsx(Qt.div,{initial:{opacity:0,scale:.95,y:3},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:3},transition:{duration:.1},className:"fixed right-4 top-[86px] min-w-[130px] max-w-[170px] bg-white border border-gray-150 rounded-xl shadow-2xl z-[99999] py-1 text-left",children:Fr.map(Cr=>{const xt=(f==null?void 0:f.id)===Cr.id;return s.jsxs("button",{onClick:()=>{h&&h(Cr),Ae(!1)},className:Ge("w-full text-left px-3 py-1.5 hover:bg-gray-50 text-[8.5px] font-extrabold uppercase tracking-wider flex items-center justify-between transition-colors",xt?"text-red-650 bg-red-50/45":"text-gray-750 hover:text-black"),children:[s.jsx("span",{className:"truncate pr-1",children:Cr.name}),xt&&s.jsx("span",{className:"w-1 h-1 rounded-full bg-red-650 shrink-0"})]},Cr.id)})})]})})]})]},"mobile-custom-nav-group")})()]},de.id)})})]}),s.jsx(on,{children:w&&s.jsxs(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[99999] bg-white flex flex-col text-gray-900 select-none overflow-y-auto",children:[s.jsxs("div",{className:"w-full max-w-[1680px] xl:max-w-[1780px] 2xl:max-w-[1880px] mx-auto px-6 pt-6 flex justify-between items-center select-none",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-red-650"}),s.jsx("span",{className:"text-[10px] font-black tracking-[0.2em] text-gray-500 uppercase",children:"CAMPUS SEARCHING ROOM"})]}),s.jsx(Qt.button,{whileHover:{rotate:90,scale:1.1},whileTap:{scale:.9},onClick:()=>A(!1),className:"p-2 text-gray-500 hover:text-gray-950 transition-colors bg-gray-50 hover:bg-gray-100 rounded-full border border-gray-250 cursor-pointer animate-fade-in -subtle",title:"Exit Searching Room",children:s.jsx(Jr,{size:18})})]}),s.jsx("div",{className:"flex-1 flex flex-col items-center justify-start pt-14 px-4 pb-12 overflow-y-auto w-full",children:s.jsxs(Qt.div,{initial:{y:25,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",damping:25,stiffness:200},className:"w-full max-w-4xl space-y-8",children:[s.jsxs("div",{className:"relative group flex items-center bg-gray-50 p-1 rounded-2xl border border-gray-200 focus-within:border-red-650 focus-within:bg-white focus-within:shadow-[0_0_25px_rgba(220,38,38,0.08)] transition-all duration-300",children:[s.jsx("div",{className:"flex items-center justify-center w-12 h-12 text-gray-400 pl-2",children:s.jsx(Tp,{size:22,className:"group-focus-within:text-red-500 transition-colors"})}),s.jsx("input",{type:"text",value:T,onChange:de=>D(de.target.value),placeholder:"Query articles, categories, debates, archives...",className:"flex-1 bg-transparent py-4 pl-3 pr-8 text-sm sm:text-base font-bold outline-none text-gray-900 placeholder-gray-400 min-w-0"}),T&&s.jsx("button",{onClick:pr,className:"p-2.5 text-gray-500 hover:text-gray-900 transition-colors mr-2 cursor-pointer bg-gray-200 rounded-full hover:bg-gray-300 shrink-0",title:"Clear Search Query",children:s.jsx(Jr,{size:16})})]}),q.length>0?s.jsxs(Qt.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},className:"flex flex-col items-center gap-3.5 py-1 select-none",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[9px] font-black text-red-650 uppercase tracking-widest bg-red-50 px-3.5 py-1.5 rounded-full border border-red-150",children:[s.jsx(Xi,{size:11,className:"text-red-500 "})," Live Smart Concept Recommendations"]}),s.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:q.map((de,ke)=>s.jsx("button",{onClick:()=>D(de),className:"px-4 py-2 bg-gray-50 hover:bg-red-650 text-gray-700 hover:text-white text-[9px] font-extrabold uppercase tracking-wider border border-gray-200 hover:border-red-650 transition-all rounded-full cursor-pointer shadow-xs hover:scale-105",children:de},ke))})]}):s.jsxs("div",{className:"flex items-center justify-center gap-2 py-1 select-none",children:[s.jsx("span",{className:"text-[9px] font-black tracking-widest text-gray-400 uppercase",children:"Suggested Terms:"}),s.jsx("div",{className:"flex gap-1.5",children:["News","Sports","Elections","Tickets","Debates"].map(de=>s.jsx("button",{onClick:()=>D(de),className:"text-[9px] font-black uppercase tracking-wider text-gray-500 hover:text-red-650 px-2.5 py-1.5 bg-gray-50 hover:bg-gray-100 rounded-md border border-gray-200 cursor-pointer",children:de},de))})]}),s.jsx("div",{className:"max-h-[50vh] overflow-y-auto pr-2 scrollbar-thin scrollbar-thumb-gray-200 scrollbar-track-transparent",children:s.jsx(on,{mode:"popLayout",children:G.length>0?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"text-[10px] font-black tracking-widest text-gray-500 uppercase select-none pb-1 border-b border-gray-150 flex items-center justify-between",children:[s.jsxs("span",{children:["Matching Campus & Archival Catalog (",G.length,")"]}),s.jsx("span",{className:"text-[8px] font-bold text-gray-400 capitalize",children:"Real-time instant index"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:G.map((de,ke)=>{const Ze={article:"bg-red-50 text-red-650 border-red-150",post:"bg-purple-50 text-purple-650 border-purple-150",user:"bg-blue-50 text-blue-650 border-blue-150",advert:"bg-amber-50 text-amber-650 border-amber-150",pinned:"bg-rose-50 text-rose-650 border-rose-150",customPage:"bg-teal-50 text-teal-650 border-teal-150"};return s.jsxs(Qt.button,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{delay:ke*.03},onClick:()=>br(de),className:"flex gap-4 p-3 bg-white hover:bg-gray-50 hover:shadow-md transition-all duration-200 group border border-gray-150 rounded-xl text-left select-none outline-none",children:[s.jsxs("div",{className:"w-16 h-16 overflow-hidden bg-gray-50 flex-shrink-0 border border-gray-150 rounded-lg relative",children:[s.jsx("img",{src:de.imageUrl||void 0,alt:"",className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-103",referrerPolicy:"no-referrer"}),s.jsx("span",{className:`absolute bottom-1 right-1 text-[6.5px] font-black tracking-widest uppercase px-1 py-0.2 rounded-xs border shadow-3xs ${Ze[de.type]||"bg-gray-100 text-gray-500 border-gray-200"}`,children:de.type})]}),s.jsxs("div",{className:"flex-1 space-y-0.5 min-w-0 text-left",children:[s.jsx("span",{className:"text-[8px] font-black uppercase tracking-widest text-gray-400",children:de.category}),s.jsx("h4",{className:"text-xs sm:text-xs font-black text-gray-950 uppercase tracking-tight group-hover:text-red-650 transition-colors leading-snug line-clamp-2",children:de.title}),s.jsx("p",{className:"text-[10px] text-gray-500 line-clamp-1 italic leading-relaxed",children:de.subtitle})]})]},`${de.type}-${de.id}`)})})]}):T.length>1&&s.jsxs(Qt.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center py-16 flex flex-col items-center select-none",children:[s.jsx("p",{className:"text-gray-500 font-extrabold uppercase tracking-widest text-sm mb-1",children:"No matching dispatches found"}),s.jsx("p",{className:"text-gray-400 text-xs font-bold",children:"Refine your inquiry above dynamically"})]})})})]})})]})})]})},Nye=({activeTab:e,setActiveTab:t,onProfileClick:r,isAdmin:n,onAdminClick:i,openAuth:a,onMenuClick:o,onPodcastClick:c,isPodcastModalOpen:h})=>{const[f,m]=ie.useState(!1),[y,w]=I.useState(Ne.currentUser);I.useEffect(()=>{const T=Ne.onAuthStateChanged(D=>{w(D)});return()=>T()},[]);const A=typeof window<"u"?window.location.origin:"https://campuseyemedia.com",S=[...n?[{id:"live",label:"Live Stream",icon:Xi,url:`${A}/live`}]:[],{id:"teams",label:"Teams",icon:ko},{id:"marketplace",label:"Marketplace",icon:TC},{id:"feedback",label:"Feedback",icon:qp},...n?[{id:"main-site",label:"Main Site",icon:fne,url:"https://campuseyemedia.com"}]:[]],j=T=>{T.url?window.open(T.url,"_blank"):t(T.id),m(!1)};return s.jsxs(s.Fragment,{children:[s.jsx(on,{children:f&&s.jsxs(Qt.div,{initial:{opacity:0,y:100},animate:{opacity:1,y:0},exit:{opacity:0,y:100},className:"fixed bottom-20 left-4 right-4 bg-white/70 backdrop-blur-2xl border border-white/50 z-[60] p-6 shadow-2xl rounded-3xl",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsx("h3",{className:"text-sm font-black uppercase tracking-widest text-red-650",children:"Explore More"}),s.jsx("button",{onClick:()=>m(!1),className:"text-gray-500",children:s.jsx(Jr,{size:20})})]}),s.jsx("div",{className:"grid grid-cols-4 gap-4",children:S.map(T=>s.jsxs("button",{onClick:()=>j(T),className:"flex flex-col items-center gap-2 group",children:[s.jsx("div",{className:"p-3 bg-gray-50 group-hover:bg-red-650 group-hover:text-white transition-all",children:s.jsx(T.icon,{size:20})}),s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-gray-500",children:T.label})]},T.id))})]})}),s.jsx("nav",{className:"fixed bottom-2 left-1/2 -translate-x-1/2 z-[1001] w-[88%] max-w-sm md:max-w-md",children:s.jsxs("div",{className:"relative group overflow-hidden rounded-full p-[1px] isolate",children:[s.jsx("div",{className:"absolute inset-0 z-[-1] overflow-hidden",children:s.jsx(Qt.div,{animate:{scale:[1,1.15,.95,1.05,1],x:[-3,7,-7,3,-3],y:[1,-5,3,-1,1],rotate:[0,90,180,270,360]},transition:{duration:12,repeat:1/0,ease:"easeInOut"},className:"absolute -inset-[100%] opacity-35 blur-[20px] bg-gradient-to-tr from-[#FF3B30]/30 via-[#34C759]/25 to-[#007AFF]/35"})}),s.jsxs("div",{className:"relative bg-white/35 dark:bg-neutral-900/35 backdrop-blur-[35px] border border-white/40 dark:border-white/10 shadow-[0_12px_36px_rgba(0,0,0,0.12)] h-11 rounded-full overflow-hidden transition-all duration-500 hover:bg-white/50 dark:hover:bg-neutral-900/50",children:[s.jsx(Qt.div,{animate:{opacity:[.35,.75,.35],scale:[.97,1.03,.97]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},className:"absolute inset-x-0 bottom-0 h-[1.5px] bg-gradient-to-r from-transparent via-[#FF2D55]/60 to-transparent blur-xs"}),s.jsxs("div",{className:"grid grid-cols-5 h-full relative z-10 px-1 items-center",children:[s.jsxs("button",{onClick:()=>t("home"),className:Ge("flex flex-col items-center justify-center h-full space-y-0.2 transition-all duration-500",e==="home"?"text-red-600 scale-105 drop-shadow-sm":"text-red-500/75 hover:text-red-600"),children:[s.jsxs("div",{className:"relative",children:[s.jsx(Dpe,{size:16,className:"shrink-0"}),e==="home"&&s.jsx(Qt.div,{layoutId:"nav-dot",className:"absolute -bottom-0.5 left-1/2 -translate-x-1/2 w-0.5 h-0.5 bg-red-600 rounded-full"})]}),s.jsx("span",{className:"text-[6px] font-black uppercase tracking-widest mt-0.2 opacity-95",children:"Home"})]}),s.jsxs("button",{onClick:()=>{t("posts")},className:Ge("flex flex-col items-center justify-center h-full space-y-0.2 transition-all duration-500",e==="posts"?"text-blue-600 scale-105":"text-blue-500/75 hover:text-blue-600"),children:[s.jsxs("div",{className:"relative",children:[s.jsx(TC,{size:16,className:"shrink-0"}),e==="posts"&&s.jsx(Qt.div,{layoutId:"nav-dot",className:"absolute -bottom-0.5 left-1/2 -translate-x-1/2 w-0.5 h-0.5 bg-blue-600 rounded-full"})]}),s.jsx("span",{className:"text-[6px] font-black uppercase tracking-widest mt-0.2 opacity-95",children:"Market"})]}),s.jsx("div",{className:"relative flex justify-center items-center h-full",children:s.jsxs(Qt.button,{whileHover:{scale:1.08},whileTap:{scale:.92},onClick:o,className:"w-8 h-8 bg-gray-950 text-white rounded-full shadow-[0_6px_15px_rgba(0,0,0,0.35)] flex items-center justify-center border border-white/15 transition-all z-20 group/btn overflow-hidden cursor-pointer",title:"Open Dashboard Drawer",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-tr from-red-600/20 to-transparent opacity-0 group-hover/btn:opacity-100 transition-opacity"}),s.jsx(tE,{className:"text-white w-3.5 h-3.5 z-10"})]})}),s.jsxs("button",{onClick:()=>{c?c():t("podcasts")},className:Ge("flex flex-col items-center justify-center h-full space-y-0.2 transition-all duration-500",e==="podcasts"||h?"text-emerald-600 scale-105 font-bold":"text-emerald-500/75 hover:text-emerald-600"),children:[s.jsx(D2,{size:16,className:"shrink-0"}),s.jsx("span",{className:"text-[6px] font-black uppercase tracking-widest mt-0.2 opacity-95",children:"Podcast"})]}),s.jsxs("button",{onClick:()=>y?r():a(),className:Ge("flex flex-col items-center justify-center h-full space-y-0.2 transition-all duration-500",e==="account"?"text-amber-550 scale-105":"text-amber-500/75 hover:text-amber-550"),children:[y?s.jsx("div",{className:"relative p-0.5 rounded-full bg-amber-500/20 border border-amber-500/50 shadow-sm",children:s.jsx("img",{src:y.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(y.displayName||"User")}&background=random`,className:"w-3.5 h-3.5 rounded-full object-cover",alt:"",referrerPolicy:"no-referrer"})}):s.jsx(rE,{size:13,className:"text-amber-500",strokeWidth:e==="account"?2.5:2}),s.jsx("span",{className:"text-[6px] font-black uppercase tracking-widest mt-0.2 opacity-95",children:y?"Me":"Join"})]})]})]})]})})]})},Eye=({articles:e,onClick:t})=>{const r=e.slice(0,3),n=I.useRef(null),[i,a]=I.useState({}),[o,c]=I.useState(null),[h,f]=I.useState(!1);ie.useEffect(()=>{as(st(fe,"settings","pinned")).then(j=>{if(j.exists()){const T=j.data();T.active?c({title:T.title||"",description:T.description||"",link:T.link||"",imageUrl:T.imageUrl||"",active:!!T.active}):c(null)}else c(null)}).catch(j=>{Gs(j,Ps.GET,"settings/pinned")})},[]);const[m,y]=I.useState(!1);if(ie.useEffect(()=>{const j=()=>{if(!o)return;const T=`dismiss_forever_pinned_${encodeURIComponent("fallback_legacy")}`,D=o.title?encodeURIComponent(o.title):"",V=`dismiss_forever_pinned_${D}`;localStorage.getItem(T)==="true"||D&&localStorage.getItem(V)==="true"?y(!0):y(!1)};return j(),window.addEventListener("pinned-dismissed",j),window.addEventListener("storage",j),()=>{window.removeEventListener("pinned-dismissed",j),window.removeEventListener("storage",j)}},[o]),ie.useEffect(()=>{f(!!(o&&!m))},[o,m]),ie.useEffect(()=>{if(r.length<=1)return;const j=setInterval(()=>{if(!n.current)return;const{scrollLeft:T,scrollWidth:D,clientWidth:V}=n.current,G=T+V>=D-15?0:T+V;n.current.scrollTo({left:G,behavior:"smooth"})},2e4);return()=>clearInterval(j)},[r.length]),r.length===0)return null;const w=(j,T)=>{T.stopPropagation(),a(D=>({...D,[j]:!D[j]}))},A=j=>{if(!n.current)return;const{scrollLeft:T,clientWidth:D}=n.current,V=D*.75;n.current.scrollTo({left:j==="left"?T-V:T+V,behavior:"smooth"})},S=[{gradient:"from-purple-950 via-purple-900 to-indigo-950 hover:from-purple-900 hover:to-indigo-900 border-purple-500/30",accentBg:"bg-purple-500/20 text-purple-200 border-purple-400/20",textAccent:"text-purple-300",type:"Breaking Story"},{gradient:"from-rose-950 via-rose-900 to-red-950 hover:from-rose-900 hover:to-red-900 border-red-500/30",accentBg:"bg-red-500/20 text-red-200 border-red-400/20",textAccent:"text-red-300",type:"Hot Broadcast"},{gradient:"from-emerald-950 via-emerald-900 to-teal-950 hover:from-emerald-900 hover:to-teal-900 border-emerald-500/30",accentBg:"bg-emerald-500/20 text-emerald-200 border-emerald-400/20",textAccent:"text-emerald-300",type:"Exclusive Update"}];return s.jsxs("div",{className:"relative group/nav px-4 pt-1 pb-4 select-none",children:[r.length>1&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>A("left"),className:"absolute left-1.5 top-1/2 -translate-y-1/2 z-40 w-8 h-8 bg-black/80 hover:bg-black text-white hover:scale-105 transition-all rounded-full flex items-center justify-center border border-white/10 shadow-lg cursor-pointer opacity-0 group-hover/nav:opacity-100 hidden sm:flex",title:"Scroll Left",children:s.jsx(Hp,{size:16})}),s.jsx("button",{onClick:()=>A("right"),className:"absolute right-1.5 top-1/2 -translate-y-1/2 z-40 w-8 h-8 bg-black/80 hover:bg-black text-white hover:scale-105 transition-all rounded-full flex items-center justify-center border border-white/10 shadow-lg cursor-pointer opacity-0 group-hover/nav:opacity-100 hidden sm:flex",title:"Scroll Right",children:s.jsx(Gp,{size:16})})]}),s.jsx("div",{ref:n,className:"flex gap-4 overflow-x-auto scrollbar-none snap-x snap-mandatory px-0.5 py-0.5 touch-pan-x",style:{scrollBehavior:"smooth"},children:r.map((j,T)=>{var X;const D=S[T%S.length],V=!!i[T],U=j.likeCount?`${j.likeCount}+`:"24+",G=j.commentCount?`${j.commentCount}`:"4";return T===0&&h&&o?s.jsx("div",{onClick:()=>{o.link&&window.open(o.link,"_blank")},className:"snap-start shrink-0 w-[91%] sm:w-[50%] lg:w-[32.3%] cursor-pointer transition-all animate-fade-in",children:s.jsx(Qt.div,{layout:!0,className:"w-full bg-[#0a0b0d] text-white p-[2px] rounded-full relative overflow-hidden select-none flex flex-col justify-center shadow-lg",style:{borderRadius:V?"18px":"9999px",backgroundImage:"linear-gradient(to right, #fbbf24, #ec4899, #3b82f6)"},children:s.jsxs("div",{className:"w-full h-full bg-[#0d0e12] px-3.5 py-2.5 rounded-full flex flex-col justify-center",style:{borderRadius:V?"16px":"9999px"},children:[s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.imageUrl?s.jsx("div",{className:"w-6 h-6 rounded-full overflow-hidden bg-gray-800 border-2 border-amber-400 shrink-0 shadow-sm flex items-center justify-center",children:s.jsx("img",{src:o.imageUrl,alt:"",className:"w-full h-full object-cover",referrerPolicy:"no-referrer"})}):s.jsx("div",{className:"w-6 h-6 rounded-full bg-amber-400/20 border-2 border-amber-400 shrink-0 flex items-center justify-center text-amber-400",children:s.jsx(Ru,{size:11,className:"animate-bounce"})}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 text-[10.5px] font-bold",children:[s.jsxs("span",{className:"text-[8.5px] font-black uppercase tracking-widest px-1.5 py-0.5 rounded bg-amber-400/20 text-amber-300 shrink-0 flex items-center gap-0.5",children:[s.jsx(Ru,{size:9})," PINNED"]}),s.jsx("span",{className:"text-white/60",children:"•"}),s.jsx("span",{className:"truncate text-white tracking-tight leading-none font-extrabold",children:o.title})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0 pl-1.5",children:[s.jsx("button",{onClick:q=>{q.stopPropagation();const z=`dismiss_forever_pinned_${o.title?encodeURIComponent(o.title):""}`;localStorage.setItem(z,"true"),localStorage.setItem("dismiss_forever_pinned_settings_pinned","true"),y(!0),f(!1),window.dispatchEvent(new Event("pinned-dismissed")),nn.success("Pinned announcement dismissed!")},className:"w-5 h-5 bg-white/10 hover:bg-red-600 hover:text-white text-white rounded-full flex items-center justify-center transition-all cursor-pointer active:scale-95 shrink-0",title:"Dismiss forever",children:s.jsx(Jr,{size:10,className:"stroke-[2.5]"})}),s.jsx("button",{onClick:q=>w(T,q),className:"w-5 h-5 bg-white/10 hover:bg-white/20 text-white rounded-full flex items-center justify-center transition-all cursor-pointer active:scale-95 shrink-0",title:V?"Collapse announcement":"Expand announcement",children:s.jsx(Qt.div,{animate:{rotate:V?180:0},transition:{duration:.2},children:s.jsx(Md,{size:11,className:"stroke-[2.5]"})})})]})]}),s.jsx(on,{initial:!1,children:V&&s.jsx(Qt.div,{initial:{height:0,opacity:0,marginTop:0},animate:{height:"auto",opacity:1,marginTop:10},exit:{height:0,opacity:0,marginTop:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden w-full text-left",children:s.jsxs("div",{className:"pt-2.5 border-t border-white/10 flex gap-3 items-start",children:[o.imageUrl&&s.jsx("div",{className:"w-12 h-12 rounded-lg overflow-hidden bg-gray-900 border border-white/10 shrink-0",children:s.jsx("img",{src:o.imageUrl,className:"w-full h-full object-cover",alt:"",referrerPolicy:"no-referrer"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-[10px] text-white/90 font-bold leading-snug",children:o.description||"Click link to view details of this announcement!"}),o.link&&s.jsx("p",{className:"text-[8.5px] font-black uppercase text-amber-300 tracking-wider mt-2 flex items-center gap-1",children:s.jsx("span",{children:"Tap Action Link →"})})]})]})})})]})})},"pinned-announcement-overlay"):s.jsx("div",{onClick:()=>t(j),className:"snap-start shrink-0 w-[91%] sm:w-[50%] lg:w-[32.3%] cursor-pointer transition-all",children:s.jsxs(Qt.div,{layout:!0,className:`w-full bg-gradient-to-r ${D.gradient} text-white px-3.5 py-2.5 rounded-full border shadow-md hover:shadow-lg transition-all duration-300 relative overflow-hidden select-none flex flex-col justify-center`,style:{borderRadius:V?"18px":"9999px"},children:[s.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-white/2 rounded-full blur-xl pointer-events-none"}),s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx("div",{className:"w-6 h-6 rounded-full overflow-hidden bg-gray-800 border-2 border-white/20 shrink-0 shadow-sm",children:s.jsx("img",{src:j.featuredImageUrl||"https://picsum.photos/seed/news/50/50",alt:"",className:"w-full h-full object-cover",referrerPolicy:"no-referrer"})}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 text-[10.5px] font-bold",children:[s.jsx("span",{className:`text-[8.5px] font-black uppercase tracking-widest px-1.5 py-0.5 rounded ${D.accentBg} shrink-0`,children:U}),s.jsx("span",{className:"text-white/60",children:"•"}),s.jsx("span",{className:"truncate text-white/90 tracking-tight",children:L0(j.title)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0 pl-1.5",children:[!V&&s.jsxs("div",{className:"flex gap-0.5 items-end h-2 w-3 pr-0.5",children:[s.jsx("div",{className:"w-0.5 bg-white/70 animate-[pulse_0.6s_infinite_alternate]",style:{height:"50%"}}),s.jsx("div",{className:"w-0.5 bg-white/70 animate-[pulse_0.8s_infinite_alternate]",style:{height:"90%"}}),s.jsx("div",{className:"w-0.5 bg-white/70 animate-[pulse_0.5s_infinite_alternate]",style:{height:"35%"}})]}),s.jsx("button",{onClick:q=>w(T,q),className:"w-5 h-5 bg-white/10 hover:bg-white/20 text-white rounded-full flex items-center justify-center transition-all cursor-pointer border border-white/5 active:scale-90",title:V?"Collapse Banner":"Expand Banner",children:s.jsx(Qt.div,{animate:{rotate:V?180:0},transition:{duration:.2},children:s.jsx(Md,{size:11,className:"stroke-[2.5]"})})})]})]}),s.jsx(on,{initial:!1,children:V&&s.jsx(Qt.div,{initial:{height:0,opacity:0,marginTop:0},animate:{height:"auto",opacity:1,marginTop:10},exit:{height:0,opacity:0,marginTop:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden w-full text-left",children:s.jsxs("div",{className:"pt-2.5 border-t border-white/10 flex gap-3 items-start",children:[s.jsx("div",{className:"w-14 h-14 rounded-lg overflow-hidden bg-gray-900 border border-white/10 shrink-0",children:s.jsx("img",{src:j.featuredImageUrl||"https://picsum.photos/seed/news/150/150",alt:"",className:"w-full h-full object-cover",referrerPolicy:"no-referrer"})}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[s.jsx("span",{className:"text-[8px] font-black uppercase text-red-400 tracking-widest",children:j.category}),s.jsx("span",{className:"text-white/35 text-[8px]",children:"•"}),s.jsx("span",{className:"text-[8px] font-black uppercase text-white/50 tracking-widest",children:D.type})]}),s.jsxs("p",{className:"text-[10px] text-white/80 line-clamp-2 leading-relaxed",children:[j.summary||((X=j.content)==null?void 0:X.substring(0,80))||"Tune in for deep coverage on this topic","..."]}),s.jsxs("div",{className:"flex items-center gap-2.5 pt-1 select-none",children:[s.jsxs("div",{className:"flex items-center gap-1 text-[8.5px] text-white/60",children:[s.jsx(qp,{size:9}),s.jsxs("span",{children:[G," comments"]})]}),s.jsx("span",{className:"text-[8.5px] font-extrabold text-white/80 hover:text-white transition-colors uppercase tracking-wider flex items-center gap-0.5",children:"Open Story →"})]})]})]})})})]})},j.id)})})]})},Kw=({advert:e,className:t})=>{const[r,n]=I.useState(!1),[i,a]=I.useState(!1),o=e.type==="video"||e.videoUrl&&!e.imageUrl,c=y=>{const w=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/,A=y.match(w);return A&&A[2].length===11?A[2]:null},h=e.videoUrl?c(e.videoUrl):null,f=y=>{y.preventDefault(),y.stopPropagation(),a(!i)},m=y=>{y.preventDefault(),y.stopPropagation(),n(!r)};return s.jsxs("div",{className:`group relative overflow-hidden bg-gray-950 border border-zinc-800 rounded-xl transition-all duration-500 hover:border-red-500/30 ${t}`,children:[s.jsxs("div",{className:"absolute top-2 w-full px-3 flex justify-between items-center z-[30] pointer-events-none",children:[s.jsxs("div",{className:"flex items-center gap-1 bg-black/45 backdrop-blur-md px-2.5 py-1 rounded-full border border-white/10 pointer-events-auto select-none",children:[s.jsxs("div",{className:"flex items-center gap-1 text-[8.5px] font-black uppercase text-white tracking-widest",children:[s.jsx(wu,{size:10,className:"text-red-500 shrink-0"}),s.jsx("span",{children:"Ad"})]}),s.jsx("button",{onClick:f,className:"text-white/60 hover:text-white ml-1.5 transition-colors focus:outline-none cursor-pointer",title:"Ad Placement Info",children:s.jsx(aF,{size:11})})]}),s.jsx("div",{className:"pointer-events-auto select-none",children:s.jsxs("button",{onClick:m,className:"flex items-center gap-1 bg-black/45 backdrop-blur-md text-white/90 hover:text-white px-2.5 py-1 rounded-full border border-white/10 text-[8.5px] font-black uppercase tracking-widest transition-all cursor-pointer focus:outline-none",children:[s.jsx("span",{children:r?"Minimize":"Enlarge"}),r?s.jsx(gf,{size:11}):s.jsx(Md,{size:11})]})})]}),s.jsx("a",{href:e.link,target:"_blank",rel:"noopener noreferrer",className:"block cursor-pointer overflow-hidden",children:s.jsxs(Qt.div,{style:{aspectRatio:r?o?"16/9":"1.6":o?"18/8":"2.6"},transition:{type:"spring",damping:20,stiffness:100},className:"overflow-hidden bg-black flex items-center justify-center relative w-full h-full min-h-[140px] transition-[aspect-ratio] duration-300 ease-in-out",children:[s.jsx(on,{mode:"wait",children:s.jsx(Qt.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.6,ease:[.16,1,.3,1]},className:"absolute inset-0 w-full h-full flex items-center justify-center",children:o&&e.videoUrl?h?s.jsx("div",{className:"absolute inset-0 pointer-events-none scale-150",children:s.jsx("iframe",{src:`https://www.youtube-nocookie.com/embed/${h}?autoplay=1&mute=1&loop=1&playlist=${h}&controls=0&showinfo=0&rel=0&iv_load_policy=3&modestbranding=1&enablejsapi=1`,className:"w-full h-full",allow:"autoplay; encrypted-media",title:e.title||"Advertisement"})}):s.jsx("video",{src:e.videoUrl||void 0,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"w-full h-full object-contain bg-neutral-950"}):s.jsx("img",{src:e.imageUrl||void 0,alt:e.title||"Advertisement",className:"w-full h-full object-contain bg-neutral-950 transition-transform duration-700 group-hover:scale-103",referrerPolicy:"no-referrer",loading:"eager",decoding:"async"})},e.id||e.title||e.imageUrl)}),o&&s.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-10 h-10 bg-white/10 backdrop-blur-md rounded-full flex items-center justify-center text-white/40 opacity-0 group-hover:opacity-100 transition-all duration-750 scale-75 group-hover:scale-100 pointer-events-none z-10",children:s.jsx(Wp,{size:18,fill:"currentColor"})}),s.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-black/90 via-black/30 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 translate-y-2 group-hover:translate-y-0 flex items-center justify-between pointer-events-none z-10",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("span",{className:"block text-[9px] font-black text-white uppercase tracking-widest",children:e.title||"Official Advertisement"}),s.jsx("p",{className:"text-[7.5px] font-bold text-gray-300 uppercase tracking-wider",children:"Click image to open redirect link"})]}),s.jsx("div",{className:"w-6 h-6 bg-white/10 backdrop-blur-md rounded-full flex items-center justify-center border border-white/10 shrink-0",children:s.jsx(za,{size:12,className:"text-white"})})]})]})}),s.jsx(on,{children:i&&s.jsxs(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-black/90 backdrop-blur-md flex flex-col justify-center p-5 z-[40]",children:[s.jsx("button",{onClick:f,className:"absolute top-3 right-3 text-white/60 hover:text-white p-1 cursor-pointer focus:outline-none",children:s.jsx(Jr,{size:15})}),s.jsxs("div",{className:"space-y-2 select-text",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-red-500",children:[s.jsx(Xi,{size:14}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"Ad Placement Guarantee"})]}),s.jsx("h4",{className:"text-[11px] font-black text-white uppercase tracking-wide leading-tight",children:e.title||"Official Ad Placement"}),s.jsx("p",{className:"text-[9px] text-gray-400 font-sans leading-normal",children:"This verification card is served directly by the Campus Eye Editorial Board. It is an independent advertisement. Click on the image to visit the external destination safely."}),s.jsxs("div",{className:"pt-1.5 flex gap-2",children:[s.jsxs("span",{className:"text-[7px] text-zinc-500 bg-zinc-900 border border-zinc-800 px-2 py-0.5 rounded-md font-mono select-none",children:["REF: AD-",e.id.substring(0,6).toUpperCase()]}),s.jsx("span",{className:"text-[7px] text-zinc-500 bg-zinc-900 border border-zinc-800 px-2 py-0.5 rounded-md font-mono select-none",children:"STATUS: LIVE"})]})]})]})})]})},Mo=({className:e,variant:t="rect"})=>s.jsx("div",{className:Ge("skeleton",t==="circle"&&"rounded-full",e)}),Ap=({variant:e="big"})=>e==="social"?s.jsx("div",{className:"border-b border-gray-100 p-4 md:p-6 bg-white text-left space-y-3",children:s.jsxs("div",{className:"flex gap-3 md:gap-4",children:[s.jsx("div",{className:"w-8 h-8 md:w-9 md:h-9 rounded-full bg-gray-200 shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-3 min-w-0",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{className:"flex items-center gap-2 flex-wrap w-full",children:[s.jsx("div",{className:"h-3 w-3 bg-gray-200 rounded-full"}),s.jsx("div",{className:"h-3 w-20 bg-gray-250 rounded"}),s.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-200 shrink-0"}),s.jsx("div",{className:"h-3 w-16 bg-gray-200 rounded"}),s.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-200 shrink-0"}),s.jsx("div",{className:"h-3 w-12 bg-gray-150 rounded"})]})}),s.jsxs("div",{className:"space-y-2 pt-1",children:[s.jsx("div",{className:"h-4.5 w-[94%] bg-gray-250 rounded-md"}),s.jsx("div",{className:"h-4.5 w-3/4 bg-gray-200 rounded-md"})]}),s.jsxs("div",{className:"space-y-1.5 pt-1",children:[s.jsx("div",{className:"h-3 w-full bg-slate-100 rounded"}),s.jsx("div",{className:"h-3 w-[88%] bg-slate-100 rounded"}),s.jsx("div",{className:"h-3.5 w-16 bg-red-100 rounded"})," "]}),s.jsxs("div",{className:"h-48 md:h-56 bg-slate-50 border border-slate-100 rounded-2xl flex items-center justify-center relative overflow-hidden mt-3",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-tr from-slate-100 to-slate-50/50"}),s.jsx("div",{className:"w-12 h-12 rounded-full bg-slate-200/50 flex items-center justify-center",children:s.jsx("div",{className:"w-4 h-4 bg-slate-300 rounded-full"})})]}),s.jsxs("div",{className:"flex items-center justify-between pt-3 max-w-md border-t border-gray-100 mt-4 text-gray-300",children:[s.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[s.jsx("div",{className:"w-7 h-7 rounded-full bg-gray-150 flex items-center justify-center"}),s.jsx("div",{className:"h-2.5 w-5 bg-gray-200 rounded"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[s.jsx("div",{className:"w-7 h-7 rounded-full bg-gray-150 flex items-center justify-center"}),s.jsx("div",{className:"h-2.5 w-7 bg-gray-200 rounded"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[s.jsx("div",{className:"w-7 h-7 rounded-full bg-gray-150 flex items-center justify-center"}),s.jsx("div",{className:"h-2.5 w-8 bg-gray-200 rounded"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-7 h-7 rounded-full bg-gray-100"}),s.jsx("div",{className:"w-7 h-7 rounded-full bg-gray-100"})]})]})]})]})}):e==="magazine"?s.jsxs("div",{className:"flex flex-col gap-8 p-6 border border-gray-100",children:[s.jsx(Mo,{className:"aspect-[4/5] w-full"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(Mo,{className:"h-3 w-20"}),s.jsx(Mo,{className:"h-8 w-full"}),s.jsx(Mo,{className:"h-8 w-3/4"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Mo,{className:"h-4 w-full"}),s.jsx(Mo,{className:"h-4 w-full"}),s.jsx(Mo,{className:"h-4 w-2/3"})]})]})]}):e==="compact"?s.jsxs("div",{className:"flex items-start gap-4 pb-4 border-b border-gray-100",children:[s.jsx(Mo,{className:"w-20 h-20 shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx(Mo,{className:"h-2 w-12"}),s.jsx(Mo,{className:"h-4 w-full"}),s.jsx(Mo,{className:"h-4 w-3/4"})]})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx(Mo,{className:"aspect-video w-full"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Mo,{className:"h-4 w-24"}),s.jsx(Mo,{className:"h-8 w-full"}),s.jsx(Mo,{className:"h-8 w-1/2"})]})]});function Aye(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const kye=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_ye=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Sye={};function Q9(e,t){return(Sye.jsx?_ye:kye).test(e)}const Cye=/[ \t\n\f\r]/g;function jye(e){return typeof e=="object"?e.type==="text"?Z9(e.value):!1:Z9(e)}function Z9(e){return e.replace(Cye,"")===""}class ob{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}ob.prototype.normal={};ob.prototype.property={};ob.prototype.space=void 0;function EK(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new ob(r,n,t)}function oj(e){return e.toLowerCase()}class xl{constructor(t,r){this.attribute=r,this.property=t}}xl.prototype.attribute="";xl.prototype.booleanish=!1;xl.prototype.boolean=!1;xl.prototype.commaOrSpaceSeparated=!1;xl.prototype.commaSeparated=!1;xl.prototype.defined=!1;xl.prototype.mustUseProperty=!1;xl.prototype.number=!1;xl.prototype.overloadedBoolean=!1;xl.prototype.property="";xl.prototype.spaceSeparated=!1;xl.prototype.space=void 0;let Iye=0;const zn=wm(),la=wm(),lj=wm(),Zt=wm(),is=wm(),J0=wm(),Pl=wm();function wm(){return 2**++Iye}const cj=Object.freeze(Object.defineProperty({__proto__:null,boolean:zn,booleanish:la,commaOrSpaceSeparated:Pl,commaSeparated:J0,number:Zt,overloadedBoolean:lj,spaceSeparated:is},Symbol.toStringTag,{value:"Module"})),zk=Object.keys(cj);class g4 extends xl{constructor(t,r,n,i){let a=-1;if(super(t,r),J9(this,"space",i),typeof n=="number")for(;++a4&&r.slice(0,4)==="data"&&Dye.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(eL,Uye);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!eL.test(a)){let o=a.replace(Rye,Lye);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=g4}return new i(n,t)}function Lye(e){return"-"+e.toLowerCase()}function Uye(e){return e.charAt(1).toUpperCase()}const Bye=EK([AK,Tye,SK,CK,jK],"html"),x4=EK([AK,Pye,SK,CK,jK],"svg");function zye(e){return e.join(" ").trim()}var b0={},Vk,tL;function Vye(){if(tL)return Vk;tL=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,c=/^\s+|\s+$/g,h=` `,f="/",m="*",y="",w="comment",A="declaration";function S(T,D){if(typeof T!="string")throw new TypeError("First argument must be a string");if(!T)return[];D=D||{};var V=1,U=1;function G(me){var re=me.match(t);re&&(V+=re.length);var le=me.lastIndexOf(h);U=~le?me.length-le:U+me.length}function X(){var me={line:V,column:U};return function(re){return re.position=new q(me),F(),re}}function q(me){this.start=me,this.end={line:V,column:U},this.source=D.source}q.prototype.content=T;function B(me){var re=new Error(D.source+":"+V+":"+U+": "+me);if(re.reason=me,re.filename=D.source,re.line=V,re.column=U,re.source=T,!D.silent)throw re}function z(me){var re=me.exec(T);if(re){var le=re[0];return G(le),T=T.slice(le.length),re}}function F(){z(r)}function $(me){var re;for(me=me||[];re=J();)re!==!1&&me.push(re);return me}function J(){var me=X();if(!(f!=T.charAt(0)||m!=T.charAt(1))){for(var re=2;y!=T.charAt(re)&&(m!=T.charAt(re)||f!=T.charAt(re+1));)++re;if(re+=2,y===T.charAt(re-1))return B("End of comment missing");var le=T.slice(2,re-2);return U+=2,G(le),T=T.slice(re),U+=2,me({type:w,comment:le})}}function Q(){var me=X(),re=z(n);if(re){if(J(),!z(i))return B("property missing ':'");var le=z(a),ve=me({type:A,property:j(re[0].replace(e,y)),value:le?j(le[0].replace(e,y)):y});return z(o),ve}}function K(){var me=[];$(me);for(var re;re=Q();)re!==!1&&(me.push(re),$(me));return me}return F(),K()}function j(T){return T?T.replace(c,y):y}return Vk=S,Vk}var rL;function Fye(){if(rL)return b0;rL=1;var e=b0&&b0.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(b0,"__esModule",{value:!0}),b0.default=r;const t=e(Vye());function r(n,i){let a=null;if(!n||typeof n!="string")return a;const o=(0,t.default)(n),c=typeof i=="function";return o.forEach(h=>{if(h.type!=="declaration")return;const{property:f,value:m}=h;c?i(f,m,h):m&&(a=a||{},a[f]=m)}),a}return b0}var i1={},nL;function $ye(){if(nL)return i1;nL=1,Object.defineProperty(i1,"__esModule",{value:!0}),i1.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(f){return!f||r.test(f)||e.test(f)},o=function(f,m){return m.toUpperCase()},c=function(f,m){return"".concat(m,"-")},h=function(f,m){return m===void 0&&(m={}),a(f)?f:(f=f.toLowerCase(),m.reactCompat?f=f.replace(i,c):f=f.replace(n,c),f.replace(t,o))};return i1.camelCase=h,i1}var s1,iL;function Hye(){if(iL)return s1;iL=1;var e=s1&&s1.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(Fye()),r=$ye();function n(i,a){var o={};return!i||typeof i!="string"||(0,t.default)(i,function(c,h){c&&h&&(o[(0,r.camelCase)(c,a)]=h)}),o}return n.default=n,s1=n,s1}var Gye=Hye();const qye=Qu(Gye),IK=TK("end"),y4=TK("start");function TK(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function Wye(e){const t=y4(e),r=IK(e);if(t&&r)return{start:t,end:r}}function X1(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?sL(e.position):"start"in e||"end"in e?sL(e):"line"in e||"column"in e?uj(e):""}function uj(e){return aL(e&&e.line)+":"+aL(e&&e.column)}function sL(e){return uj(e&&e.start)+"-"+uj(e&&e.end)}function aL(e){return e&&typeof e=="number"?e:1}class Io extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},o=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof t=="string"?i=t:!a.cause&&t&&(o=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof n=="string"){const h=n.indexOf(":");h===-1?a.ruleId=n:(a.source=n.slice(0,h),a.ruleId=n.slice(h+1))}if(!a.place&&a.ancestors&&a.ancestors){const h=a.ancestors[a.ancestors.length-1];h&&(a.place=h.position)}const c=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=X1(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Io.prototype.file="";Io.prototype.name="";Io.prototype.reason="";Io.prototype.message="";Io.prototype.stack="";Io.prototype.column=void 0;Io.prototype.line=void 0;Io.prototype.ancestors=void 0;Io.prototype.cause=void 0;Io.prototype.fatal=void 0;Io.prototype.place=void 0;Io.prototype.ruleId=void 0;Io.prototype.source=void 0;const b4={}.hasOwnProperty,Kye=new Map,Yye=/[A-Z]/g,Xye=new Set(["table","tbody","thead","tfoot","tr"]),Qye=new Set(["td","th"]),PK="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Zye(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=abe(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=sbe(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?x4:Bye,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=OK(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function OK(e,t,r){if(t.type==="element")return Jye(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ebe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return rbe(e,t,r);if(t.type==="mdxjsEsm")return tbe(e,t);if(t.type==="root")return nbe(e,t,r);if(t.type==="text")return ibe(e,t)}function Jye(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=x4,e.schema=i),e.ancestors.push(t);const a=DK(e,t.tagName,!1),o=obe(e,t);let c=w4(e,t);return Xye.has(t.tagName)&&(c=c.filter(function(h){return typeof h=="string"?!jye(h):!0})),RK(e,o,a,t),v4(o,c),e.ancestors.pop(),e.schema=n,e.create(t,a,o,r)}function ebe(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Ny(e,t.position)}function tbe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ny(e,t.position)}function rbe(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=x4,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:DK(e,t.name,!0),o=lbe(e,t),c=w4(e,t);return RK(e,o,a,t),v4(o,c),e.ancestors.pop(),e.schema=n,e.create(t,a,o,r)}function nbe(e,t,r){const n={};return v4(n,w4(e,t)),e.create(t,e.Fragment,n,r)}function ibe(e,t){return t.value}function RK(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function v4(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function sbe(e,t,r){return n;function n(i,a,o,c){const f=Array.isArray(o.children)?r:t;return c?f(a,o,c):f(a,o)}}function abe(e,t){return r;function r(n,i,a,o){const c=Array.isArray(a.children),h=y4(n);return t(i,a,o,c,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function obe(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&b4.call(t.properties,i)){const a=cbe(e,i,t.properties[i]);if(a){const[o,c]=a;e.tableCellAlignToStyle&&o==="align"&&typeof c=="string"&&Qye.has(t.tagName)?n=c:r[o]=c}}if(n){const a=r.style||(r.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function lbe(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const a=n.data.estree.body[0];a.type;const o=a.expression;o.type;const c=o.properties[0];c.type,Object.assign(r,e.evaluater.evaluateExpression(c.argument))}else Ny(e,t.position);else{const i=n.name;let a;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const c=n.value.data.estree.body[0];c.type,a=e.evaluater.evaluateExpression(c.expression)}else Ny(e,t.position);else a=n.value===null?!0:n.value;r[i]=a}return r}function w4(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:Kye;for(;++ni?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);a0?(Hu(e,e.length,0,t),e):t}const cL={}.hasOwnProperty;function xbe(e){const t={};let r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function eg(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Cu=Rf(/[A-Za-z]/),zl=Rf(/[\dA-Za-z]/),vbe=Rf(/[#-'*+\--9=?A-Z^-~]/);function dj(e){return e!==null&&(e<32||e===127)}const hj=Rf(/\d/),wbe=Rf(/[\dA-Fa-f]/),Nbe=Rf(/[!-/:-@[-`{-~]/);function Nn(e){return e!==null&&e<-2}function gl(e){return e!==null&&(e<0||e===32)}function Di(e){return e===-2||e===-1||e===32}const Ebe=Rf(new RegExp("\\p{P}|\\p{S}","u")),Abe=Rf(/\s/);function Rf(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Kg(e){const t=[];let r=-1,n=0,i=0;for(;++r55295&&a<57344){const c=e.charCodeAt(r+1);a<56320&&c>56319&&c<57344?(o=String.fromCharCode(a,c),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function os(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let a=0;return o;function o(h){return Di(h)?(e.enter(r),c(h)):t(h)}function c(h){return Di(h)&&a++o))return;const B=t.events.length;let z=B,F,$;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(F){$=t.events[z][1].end;break}F=!0}for(D(n),q=B;qU;){const X=r[G];t.containerState=X[1],X[0].exit.call(t,e)}r.length=U}function V(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function jbe(e,t,r){return os(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function dL(e){if(e===null||gl(e)||Abe(e))return 1;if(Ebe(e))return 2}function E4(e,t,r){const n=[];let i=-1;for(;++i1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const y={...e[n][1].end},w={...e[r][1].start};hL(y,-h),hL(w,h),o={type:h>1?"strongSequence":"emphasisSequence",start:y,end:{...e[n][1].end}},c={type:h>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:w},a={type:h>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:h>1?"strong":"emphasis",start:{...o.start},end:{...c.end}},e[n][1].end={...o.start},e[r][1].start={...c.end},f=[],e[n][1].end.offset-e[n][1].start.offset&&(f=pc(f,[["enter",e[n][1],t],["exit",e[n][1],t]])),f=pc(f,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",a,t]]),f=pc(f,E4(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),f=pc(f,[["exit",a,t],["enter",c,t],["exit",c,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(m=2,f=pc(f,[["enter",e[r][1],t],["exit",e[r][1],t]])):m=0,Hu(e,n-1,r-n+3,f),r=n+f.length-m-2;break}}for(r=-1;++r0&&Di(q)?os(e,V,"linePrefix",a+1)(q):V(q)}function V(q){return q===null||Nn(q)?e.check(fL,j,G)(q):(e.enter("codeFlowValue"),U(q))}function U(q){return q===null||Nn(q)?(e.exit("codeFlowValue"),V(q)):(e.consume(q),U)}function G(q){return e.exit("codeFenced"),t(q)}function X(q,B,z){let F=0;return $;function $(re){return q.enter("lineEnding"),q.consume(re),q.exit("lineEnding"),J}function J(re){return q.enter("codeFencedFence"),Di(re)?os(q,Q,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(re):Q(re)}function Q(re){return re===c?(q.enter("codeFencedFenceSequence"),K(re)):z(re)}function K(re){return re===c?(F++,q.consume(re),K):F>=o?(q.exit("codeFencedFenceSequence"),Di(re)?os(q,me,"whitespace")(re):me(re)):z(re)}function me(re){return re===null||Nn(re)?(q.exit("codeFencedFence"),B(re)):z(re)}}}function Vbe(e,t,r){const n=this;return i;function i(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}const $k={name:"codeIndented",tokenize:$be},Fbe={partial:!0,tokenize:Hbe};function $be(e,t,r){const n=this;return i;function i(f){return e.enter("codeIndented"),os(e,a,"linePrefix",5)(f)}function a(f){const m=n.events[n.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?o(f):r(f)}function o(f){return f===null?h(f):Nn(f)?e.attempt(Fbe,o,h)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||Nn(f)?(e.exit("codeFlowValue"),o(f)):(e.consume(f),c)}function h(f){return e.exit("codeIndented"),t(f)}}function Hbe(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Nn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):os(e,a,"linePrefix",5)(o)}function a(o){const c=n.events[n.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(o):Nn(o)?i(o):r(o)}}const Gbe={name:"codeText",previous:Wbe,resolve:qbe,tokenize:Kbe};function qbe(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&a1(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),a1(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),a1(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(n.parser.constructs.flow,r,t)(o)}}function FK(e,t,r,n,i,a,o,c,h){const f=h||Number.POSITIVE_INFINITY;let m=0;return y;function y(D){return D===60?(e.enter(n),e.enter(i),e.enter(a),e.consume(D),e.exit(a),w):D===null||D===32||D===41||dj(D)?r(D):(e.enter(n),e.enter(o),e.enter(c),e.enter("chunkString",{contentType:"string"}),j(D))}function w(D){return D===62?(e.enter(a),e.consume(D),e.exit(a),e.exit(i),e.exit(n),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),A(D))}function A(D){return D===62?(e.exit("chunkString"),e.exit(c),w(D)):D===null||D===60||Nn(D)?r(D):(e.consume(D),D===92?S:A)}function S(D){return D===60||D===62||D===92?(e.consume(D),A):A(D)}function j(D){return!m&&(D===null||D===41||gl(D))?(e.exit("chunkString"),e.exit(c),e.exit(o),e.exit(n),t(D)):m999||A===null||A===91||A===93&&!h||A===94&&!c&&"_hiddenFootnoteSupport"in o.parser.constructs?r(A):A===93?(e.exit(a),e.enter(i),e.consume(A),e.exit(i),e.exit(n),t):Nn(A)?(e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),y(A))}function y(A){return A===null||A===91||A===93||Nn(A)||c++>999?(e.exit("chunkString"),m(A)):(e.consume(A),h||(h=!Di(A)),A===92?w:y)}function w(A){return A===91||A===92||A===93?(e.consume(A),c++,y):y(A)}}function HK(e,t,r,n,i,a){let o;return c;function c(w){return w===34||w===39||w===40?(e.enter(n),e.enter(i),e.consume(w),e.exit(i),o=w===40?41:w,h):r(w)}function h(w){return w===o?(e.enter(i),e.consume(w),e.exit(i),e.exit(n),t):(e.enter(a),f(w))}function f(w){return w===o?(e.exit(a),h(o)):w===null?r(w):Nn(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),os(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===o||w===null||Nn(w)?(e.exit("chunkString"),f(w)):(e.consume(w),w===92?y:m)}function y(w){return w===o||w===92?(e.consume(w),m):m(w)}}function Q1(e,t){let r;return n;function n(i){return Nn(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Di(i)?os(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const rve={name:"definition",tokenize:ive},nve={partial:!0,tokenize:sve};function ive(e,t,r){const n=this;let i;return a;function a(A){return e.enter("definition"),o(A)}function o(A){return $K.call(n,e,c,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(A)}function c(A){return i=eg(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),A===58?(e.enter("definitionMarker"),e.consume(A),e.exit("definitionMarker"),h):r(A)}function h(A){return gl(A)?Q1(e,f)(A):f(A)}function f(A){return FK(e,m,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(A)}function m(A){return e.attempt(nve,y,y)(A)}function y(A){return Di(A)?os(e,w,"whitespace")(A):w(A)}function w(A){return A===null||Nn(A)?(e.exit("definition"),n.parser.defined.push(i),t(A)):r(A)}}function sve(e,t,r){return n;function n(c){return gl(c)?Q1(e,i)(c):r(c)}function i(c){return HK(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function a(c){return Di(c)?os(e,o,"whitespace")(c):o(c)}function o(c){return c===null||Nn(c)?t(c):r(c)}}const ave={name:"hardBreakEscape",tokenize:ove};function ove(e,t,r){return n;function n(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return Nn(a)?(e.exit("hardBreakEscape"),t(a)):r(a)}}const lve={name:"headingAtx",resolve:cve,tokenize:uve};function cve(e,t){let r=e.length-2,n=3,i,a;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},a={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Hu(e,n,r-n+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function uve(e,t,r){let n=0;return i;function i(m){return e.enter("atxHeading"),a(m)}function a(m){return e.enter("atxHeadingSequence"),o(m)}function o(m){return m===35&&n++<6?(e.consume(m),o):m===null||gl(m)?(e.exit("atxHeadingSequence"),c(m)):r(m)}function c(m){return m===35?(e.enter("atxHeadingSequence"),h(m)):m===null||Nn(m)?(e.exit("atxHeading"),t(m)):Di(m)?os(e,c,"whitespace")(m):(e.enter("atxHeadingText"),f(m))}function h(m){return m===35?(e.consume(m),h):(e.exit("atxHeadingSequence"),c(m))}function f(m){return m===null||m===35||gl(m)?(e.exit("atxHeadingText"),c(m)):(e.consume(m),f)}}const dve=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],mL=["pre","script","style","textarea"],hve={concrete:!0,name:"htmlFlow",resolveTo:mve,tokenize:gve},fve={partial:!0,tokenize:yve},pve={partial:!0,tokenize:xve};function mve(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function gve(e,t,r){const n=this;let i,a,o,c,h;return f;function f(ae){return m(ae)}function m(ae){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(ae),y}function y(ae){return ae===33?(e.consume(ae),w):ae===47?(e.consume(ae),a=!0,j):ae===63?(e.consume(ae),i=3,n.interrupt?t:Z):Cu(ae)?(e.consume(ae),o=String.fromCharCode(ae),T):r(ae)}function w(ae){return ae===45?(e.consume(ae),i=2,A):ae===91?(e.consume(ae),i=5,c=0,S):Cu(ae)?(e.consume(ae),i=4,n.interrupt?t:Z):r(ae)}function A(ae){return ae===45?(e.consume(ae),n.interrupt?t:Z):r(ae)}function S(ae){const qe="CDATA[";return ae===qe.charCodeAt(c++)?(e.consume(ae),c===qe.length?n.interrupt?t:Q:S):r(ae)}function j(ae){return Cu(ae)?(e.consume(ae),o=String.fromCharCode(ae),T):r(ae)}function T(ae){if(ae===null||ae===47||ae===62||gl(ae)){const qe=ae===47,pt=o.toLowerCase();return!qe&&!a&&mL.includes(pt)?(i=1,n.interrupt?t(ae):Q(ae)):dve.includes(o.toLowerCase())?(i=6,qe?(e.consume(ae),D):n.interrupt?t(ae):Q(ae)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(ae):a?V(ae):U(ae))}return ae===45||zl(ae)?(e.consume(ae),o+=String.fromCharCode(ae),T):r(ae)}function D(ae){return ae===62?(e.consume(ae),n.interrupt?t:Q):r(ae)}function V(ae){return Di(ae)?(e.consume(ae),V):$(ae)}function U(ae){return ae===47?(e.consume(ae),$):ae===58||ae===95||Cu(ae)?(e.consume(ae),G):Di(ae)?(e.consume(ae),U):$(ae)}function G(ae){return ae===45||ae===46||ae===58||ae===95||zl(ae)?(e.consume(ae),G):X(ae)}function X(ae){return ae===61?(e.consume(ae),q):Di(ae)?(e.consume(ae),X):U(ae)}function q(ae){return ae===null||ae===60||ae===61||ae===62||ae===96?r(ae):ae===34||ae===39?(e.consume(ae),h=ae,B):Di(ae)?(e.consume(ae),q):z(ae)}function B(ae){return ae===h?(e.consume(ae),h=null,F):ae===null||Nn(ae)?r(ae):(e.consume(ae),B)}function z(ae){return ae===null||ae===34||ae===39||ae===47||ae===60||ae===61||ae===62||ae===96||gl(ae)?X(ae):(e.consume(ae),z)}function F(ae){return ae===47||ae===62||Di(ae)?U(ae):r(ae)}function $(ae){return ae===62?(e.consume(ae),J):r(ae)}function J(ae){return ae===null||Nn(ae)?Q(ae):Di(ae)?(e.consume(ae),J):r(ae)}function Q(ae){return ae===45&&i===2?(e.consume(ae),le):ae===60&&i===1?(e.consume(ae),ve):ae===62&&i===4?(e.consume(ae),se):ae===63&&i===3?(e.consume(ae),Z):ae===93&&i===5?(e.consume(ae),Ve):Nn(ae)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(fve,xe,K)(ae)):ae===null||Nn(ae)?(e.exit("htmlFlowData"),K(ae)):(e.consume(ae),Q)}function K(ae){return e.check(pve,me,xe)(ae)}function me(ae){return e.enter("lineEnding"),e.consume(ae),e.exit("lineEnding"),re}function re(ae){return ae===null||Nn(ae)?K(ae):(e.enter("htmlFlowData"),Q(ae))}function le(ae){return ae===45?(e.consume(ae),Z):Q(ae)}function ve(ae){return ae===47?(e.consume(ae),o="",je):Q(ae)}function je(ae){if(ae===62){const qe=o.toLowerCase();return mL.includes(qe)?(e.consume(ae),se):Q(ae)}return Cu(ae)&&o.length<8?(e.consume(ae),o+=String.fromCharCode(ae),je):Q(ae)}function Ve(ae){return ae===93?(e.consume(ae),Z):Q(ae)}function Z(ae){return ae===62?(e.consume(ae),se):ae===45&&i===2?(e.consume(ae),Z):Q(ae)}function se(ae){return ae===null||Nn(ae)?(e.exit("htmlFlowData"),xe(ae)):(e.consume(ae),se)}function xe(ae){return e.exit("htmlFlow"),t(ae)}}function xve(e,t,r){const n=this;return i;function i(o){return Nn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):r(o)}function a(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}function yve(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt($E,t,r)}}const bve={name:"htmlText",tokenize:vve};function vve(e,t,r){const n=this;let i,a,o;return c;function c(Z){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(Z),h}function h(Z){return Z===33?(e.consume(Z),f):Z===47?(e.consume(Z),X):Z===63?(e.consume(Z),U):Cu(Z)?(e.consume(Z),z):r(Z)}function f(Z){return Z===45?(e.consume(Z),m):Z===91?(e.consume(Z),a=0,S):Cu(Z)?(e.consume(Z),V):r(Z)}function m(Z){return Z===45?(e.consume(Z),A):r(Z)}function y(Z){return Z===null?r(Z):Z===45?(e.consume(Z),w):Nn(Z)?(o=y,ve(Z)):(e.consume(Z),y)}function w(Z){return Z===45?(e.consume(Z),A):y(Z)}function A(Z){return Z===62?le(Z):Z===45?w(Z):y(Z)}function S(Z){const se="CDATA[";return Z===se.charCodeAt(a++)?(e.consume(Z),a===se.length?j:S):r(Z)}function j(Z){return Z===null?r(Z):Z===93?(e.consume(Z),T):Nn(Z)?(o=j,ve(Z)):(e.consume(Z),j)}function T(Z){return Z===93?(e.consume(Z),D):j(Z)}function D(Z){return Z===62?le(Z):Z===93?(e.consume(Z),D):j(Z)}function V(Z){return Z===null||Z===62?le(Z):Nn(Z)?(o=V,ve(Z)):(e.consume(Z),V)}function U(Z){return Z===null?r(Z):Z===63?(e.consume(Z),G):Nn(Z)?(o=U,ve(Z)):(e.consume(Z),U)}function G(Z){return Z===62?le(Z):U(Z)}function X(Z){return Cu(Z)?(e.consume(Z),q):r(Z)}function q(Z){return Z===45||zl(Z)?(e.consume(Z),q):B(Z)}function B(Z){return Nn(Z)?(o=B,ve(Z)):Di(Z)?(e.consume(Z),B):le(Z)}function z(Z){return Z===45||zl(Z)?(e.consume(Z),z):Z===47||Z===62||gl(Z)?F(Z):r(Z)}function F(Z){return Z===47?(e.consume(Z),le):Z===58||Z===95||Cu(Z)?(e.consume(Z),$):Nn(Z)?(o=F,ve(Z)):Di(Z)?(e.consume(Z),F):le(Z)}function $(Z){return Z===45||Z===46||Z===58||Z===95||zl(Z)?(e.consume(Z),$):J(Z)}function J(Z){return Z===61?(e.consume(Z),Q):Nn(Z)?(o=J,ve(Z)):Di(Z)?(e.consume(Z),J):F(Z)}function Q(Z){return Z===null||Z===60||Z===61||Z===62||Z===96?r(Z):Z===34||Z===39?(e.consume(Z),i=Z,K):Nn(Z)?(o=Q,ve(Z)):Di(Z)?(e.consume(Z),Q):(e.consume(Z),me)}function K(Z){return Z===i?(e.consume(Z),i=void 0,re):Z===null?r(Z):Nn(Z)?(o=K,ve(Z)):(e.consume(Z),K)}function me(Z){return Z===null||Z===34||Z===39||Z===60||Z===61||Z===96?r(Z):Z===47||Z===62||gl(Z)?F(Z):(e.consume(Z),me)}function re(Z){return Z===47||Z===62||gl(Z)?F(Z):r(Z)}function le(Z){return Z===62?(e.consume(Z),e.exit("htmlTextData"),e.exit("htmlText"),t):r(Z)}function ve(Z){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(Z),e.exit("lineEnding"),je}function je(Z){return Di(Z)?os(e,Ve,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Z):Ve(Z)}function Ve(Z){return e.enter("htmlTextData"),o(Z)}}const A4={name:"labelEnd",resolveAll:Ave,resolveTo:kve,tokenize:_ve},wve={tokenize:Sve},Nve={tokenize:Cve},Eve={tokenize:jve};function Ave(e){let t=-1;const r=[];for(;++t=3&&(f===null||Nn(f))?(e.exit("thematicBreak"),t(f)):r(f)}function h(f){return f===i?(e.consume(f),n++,h):(e.exit("thematicBreakSequence"),Di(f)?os(e,c,"whitespace")(f):c(f))}}const ll={continuation:{tokenize:Bve},exit:Vve,name:"list",tokenize:Uve},Mve={partial:!0,tokenize:Fve},Lve={partial:!0,tokenize:zve};function Uve(e,t,r){const n=this,i=n.events[n.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return c;function c(A){const S=n.containerState.type||(A===42||A===43||A===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!n.containerState.marker||A===n.containerState.marker:hj(A)){if(n.containerState.type||(n.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),A===42||A===45?e.check(Yw,r,f)(A):f(A);if(!n.interrupt||A===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(A)}return r(A)}function h(A){return hj(A)&&++o<10?(e.consume(A),h):(!n.interrupt||o<2)&&(n.containerState.marker?A===n.containerState.marker:A===41||A===46)?(e.exit("listItemValue"),f(A)):r(A)}function f(A){return e.enter("listItemMarker"),e.consume(A),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||A,e.check($E,n.interrupt?r:m,e.attempt(Mve,w,y))}function m(A){return n.containerState.initialBlankLine=!0,a++,w(A)}function y(A){return Di(A)?(e.enter("listItemPrefixWhitespace"),e.consume(A),e.exit("listItemPrefixWhitespace"),w):r(A)}function w(A){return n.containerState.size=a+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(A)}}function Bve(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check($E,i,a);function i(c){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,os(e,t,"listItemIndent",n.containerState.size+1)(c)}function a(c){return n.containerState.furtherBlankLines||!Di(c)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(c)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(Lve,t,o)(c))}function o(c){return n.containerState._closeFlow=!0,n.interrupt=void 0,os(e,e.attempt(ll,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function zve(e,t,r){const n=this;return os(e,i,"listItemIndent",n.containerState.size+1);function i(a){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(a):r(a)}}function Vve(e){e.exit(this.containerState.type)}function Fve(e,t,r){const n=this;return os(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const o=n.events[n.events.length-1];return!Di(a)&&o&&o[1].type==="listItemPrefixWhitespace"?t(a):r(a)}}const gL={name:"setextUnderline",resolveTo:$ve,tokenize:Hve};function $ve(e,t){let r=e.length,n,i,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!a&&e[r][1].type==="definition"&&(a=r);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",o,t]),e.splice(a+1,0,["exit",e[n][1],t]),e[n][1].end={...e[a][1].end}):e[n][1]=o,e.push(["exit",o,t]),e}function Hve(e,t,r){const n=this;let i;return a;function a(f){let m=n.events.length,y;for(;m--;)if(n.events[m][1].type!=="lineEnding"&&n.events[m][1].type!=="linePrefix"&&n.events[m][1].type!=="content"){y=n.events[m][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||y)?(e.enter("setextHeadingLine"),i=f,o(f)):r(f)}function o(f){return e.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===i?(e.consume(f),c):(e.exit("setextHeadingLineSequence"),Di(f)?os(e,h,"lineSuffix")(f):h(f))}function h(f){return f===null||Nn(f)?(e.exit("setextHeadingLine"),t(f)):r(f)}}const Gve={tokenize:qve};function qve(e){const t=this,r=e.attempt($E,n,e.attempt(this.parser.constructs.flowInitial,i,os(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Qbe,i)),"linePrefix")));return r;function n(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const Wve={resolveAll:qK()},Kve=GK("string"),Yve=GK("text");function GK(e){return{resolveAll:qK(e==="text"?Xve:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],a=r.attempt(i,o,c);return o;function o(m){return f(m)?a(m):c(m)}function c(m){if(m===null){r.consume(m);return}return r.enter("data"),r.consume(m),h}function h(m){return f(m)?(r.exit("data"),a(m)):(r.consume(m),h)}function f(m){if(m===null)return!0;const y=i[m];let w=-1;if(y)for(;++w-1){const c=o[0];typeof c=="string"?o[0]=c.slice(n):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function cwe(e,t){let r=-1;const n=[];let i;for(;++r0){const en=nr.tokenStack[nr.tokenStack.length-1];(en[1]||yL).call(nr,void 0,en[0])}for(Rt.position={start:Fh(He.length>0?He[0][1].start:{line:1,column:1,offset:0}),end:Fh(He.length>0?He[He.length-2][1].end:{line:1,column:1,offset:0})},hn=-1;++hn0&&(n.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function Ewe(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Awe(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function kwe(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),i=Kg(n.toLowerCase()),a=e.footnoteOrder.indexOf(n);let o,c=e.footnoteCounts.get(n);c===void 0?(c=0,e.footnoteOrder.push(n),o=e.footnoteOrder.length):o=a+1,c+=1,e.footnoteCounts.set(n,c);const h={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,h);const f={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,f),e.applyData(t,f)}function _we(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Swe(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function YK(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const i=e.all(t),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function Cwe(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return YK(e,t);const i={src:Kg(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function jwe(e,t){const r={src:Kg(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function Iwe(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function Twe(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return YK(e,t);const i={href:Kg(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Pwe(e,t){const r={href:Kg(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Owe(e,t,r){const n=e.all(t),i=r?Rwe(r):XK(t),a={},o=[];if(typeof t.checked=="boolean"){const m=n[0];let y;m&&m.type==="element"&&m.tagName==="p"?y=m:(y={type:"element",tagName:"p",properties:{},children:[]},n.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let c=-1;for(;++c1}function Dwe(e,t){const r={},n=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},c=y4(t.children[1]),h=IK(t.children[t.children.length-1]);c&&h&&(o.position={start:c,end:h}),i.push(o)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function zwe(e,t,r){const n=r?r.children:void 0,a=(n?n.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,c=o?o.length:t.children.length;let h=-1;const f=[];for(;++h0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return a.push(wL(t.slice(i),i>0,!1)),a.join("")}function wL(e,t,r){let n=0,i=e.length;if(t){let a=e.codePointAt(n);for(;a===bL||a===vL;)n++,a=e.codePointAt(n)}if(r){let a=e.codePointAt(i-1);for(;a===bL||a===vL;)i--,a=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}function $we(e,t){const r={type:"text",value:Fwe(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function Hwe(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const Gwe={blockquote:vwe,break:wwe,code:Nwe,delete:Ewe,emphasis:Awe,footnoteReference:kwe,heading:_we,html:Swe,imageReference:Cwe,image:jwe,inlineCode:Iwe,linkReference:Twe,link:Pwe,listItem:Owe,list:Dwe,paragraph:Mwe,root:Lwe,strong:Uwe,table:Bwe,tableCell:Vwe,tableRow:zwe,text:$we,thematicBreak:Hwe,toml:Xv,yaml:Xv,definition:Xv,footnoteDefinition:Xv};function Xv(){}const QK=-1,HE=0,Z1=1,Y2=2,k4=3,_4=4,S4=5,C4=6,ZK=7,JK=8,NL=typeof self=="object"?self:globalThis,qwe=(e,t)=>{const r=(i,a)=>(e.set(a,i),i),n=i=>{if(e.has(i))return e.get(i);const[a,o]=t[i];switch(a){case HE:case QK:return r(o,i);case Z1:{const c=r([],i);for(const h of o)c.push(n(h));return c}case Y2:{const c=r({},i);for(const[h,f]of o)c[n(h)]=n(f);return c}case k4:return r(new Date(o),i);case _4:{const{source:c,flags:h}=o;return r(new RegExp(c,h),i)}case S4:{const c=r(new Map,i);for(const[h,f]of o)c.set(n(h),n(f));return c}case C4:{const c=r(new Set,i);for(const h of o)c.add(n(h));return c}case ZK:{const{name:c,message:h}=o;return r(new NL[c](h),i)}case JK:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:c}=new Uint8Array(o);return r(new DataView(c),o)}}return r(new NL[a](o),i)};return n},EL=e=>qwe(new Map,e)(0),v0="",{toString:Wwe}={},{keys:Kwe}=Object,o1=e=>{const t=typeof e;if(t!=="object"||!e)return[HE,t];const r=Wwe.call(e).slice(8,-1);switch(r){case"Array":return[Z1,v0];case"Object":return[Y2,v0];case"Date":return[k4,v0];case"RegExp":return[_4,v0];case"Map":return[S4,v0];case"Set":return[C4,v0];case"DataView":return[Z1,r]}return r.includes("Array")?[Z1,r]:r.includes("Error")?[ZK,r]:[Y2,r]},Qv=([e,t])=>e===HE&&(t==="function"||t==="symbol"),Ywe=(e,t,r,n)=>{const i=(o,c)=>{const h=n.push(o)-1;return r.set(c,h),h},a=o=>{if(r.has(o))return r.get(o);let[c,h]=o1(o);switch(c){case HE:{let m=o;switch(h){case"bigint":c=JK,m=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);m=null;break;case"undefined":return i([QK],o)}return i([c,m],o)}case Z1:{if(h){let w=o;return h==="DataView"?w=new Uint8Array(o.buffer):h==="ArrayBuffer"&&(w=new Uint8Array(o)),i([h,[...w]],o)}const m=[],y=i([c,m],o);for(const w of o)m.push(a(w));return y}case Y2:{if(h)switch(h){case"BigInt":return i([h,o.toString()],o);case"Boolean":case"Number":case"String":return i([h,o.valueOf()],o)}if(t&&"toJSON"in o)return a(o.toJSON());const m=[],y=i([c,m],o);for(const w of Kwe(o))(e||!Qv(o1(o[w])))&&m.push([a(w),a(o[w])]);return y}case k4:return i([c,o.toISOString()],o);case _4:{const{source:m,flags:y}=o;return i([c,{source:m,flags:y}],o)}case S4:{const m=[],y=i([c,m],o);for(const[w,A]of o)(e||!(Qv(o1(w))||Qv(o1(A))))&&m.push([a(w),a(A)]);return y}case C4:{const m=[],y=i([c,m],o);for(const w of o)(e||!Qv(o1(w)))&&m.push(a(w));return y}}const{message:f}=o;return i([c,{name:h,message:f}],o)};return a},AL=(e,{json:t,lossy:r}={})=>{const n=[];return Ywe(!(t||r),!!t,new Map,n)(e),n},X2=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?EL(AL(e,t)):structuredClone(e):(e,t)=>EL(AL(e,t));function Xwe(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function Qwe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Zwe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||Xwe,n=e.options.footnoteBackLabel||Qwe,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let h=-1;for(;++h0&&S.push({type:"text",value:" "});let V=typeof r=="string"?r:r(h,A);typeof V=="string"&&(V={type:"text",value:V}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+w+(A>1?"-"+A:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(h,A),className:["data-footnote-backref"]},children:Array.isArray(V)?V:[V]})}const T=m[m.length-1];if(T&&T.type==="element"&&T.tagName==="p"){const V=T.children[T.children.length-1];V&&V.type==="text"?V.value+=" ":T.children.push({type:"text",value:" "}),T.children.push(...S)}else m.push(...S);const D={type:"element",tagName:"li",properties:{id:t+"fn-"+w},children:e.wrap(m,!0)};e.patch(f,D),c.push(D)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...X2(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:` `}]}}const eY=(function(e){if(e==null)return r2e;if(typeof e=="function")return GE(e);if(typeof e=="object")return Array.isArray(e)?Jwe(e):e2e(e);if(typeof e=="string")return t2e(e);throw new Error("Expected function, string, or object as test")});function Jwe(e){const t=[];let r=-1;for(;++r":""))+")"})}return w;function w(){let A=tY,S,j,T;if((!t||a(h,f,m[m.length-1]||void 0))&&(A=o2e(r(h,m)),A[0]===kL))return A;if("children"in h&&h.children){const D=h;if(D.children&&A[0]!==s2e)for(j=(n?D.children.length:-1)+o,T=m.concat(D);j>-1&&j0&&r.push({type:"text",value:` `}),r}function _L(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function SL(e,t){const r=c2e(e,t),n=r.one(e,void 0),i=Zwe(r),a=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&a.children.push({type:"text",value:` `},i),a}function p2e(e,t){return e&&"run"in e?async function(r,n){const i=SL(r,{file:n,...t});await e.run(i,n)}:function(r,n){return SL(r,{file:n,...e||t})}}function CL(e){if(e)throw e}var Gk,jL;function m2e(){if(jL)return Gk;jL=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},a=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var m=e.call(f,"constructor"),y=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!m&&!y)return!1;var w;for(w in f);return typeof w>"u"||e.call(f,w)},o=function(f,m){r&&m.name==="__proto__"?r(f,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):f[m.name]=m.newValue},c=function(f,m){if(m==="__proto__")if(e.call(f,m)){if(n)return n(f,m).value}else return;return f[m]};return Gk=function h(){var f,m,y,w,A,S,j=arguments[0],T=1,D=arguments.length,V=!1;for(typeof j=="boolean"&&(V=j,j=arguments[1]||{},T=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});To.length;let h;c&&o.push(i);try{h=e.apply(this,o)}catch(f){const m=f;if(c&&r)throw m;return i(m)}c||(h&&h.then&&typeof h.then=="function"?h.then(a,i):h instanceof Error?i(h):a(h))}function i(o,...c){r||(r=!0,t(o,...c))}function a(o){i(null,o)}}const vu={basename:b2e,dirname:v2e,extname:w2e,join:N2e,sep:"/"};function b2e(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');lb(e);let r=0,n=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let o=-1,c=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else o<0&&(a=!0,o=i+1),c>-1&&(e.codePointAt(i)===t.codePointAt(c--)?c<0&&(n=i):(c=-1,n=o));return r===n?n=o:n<0&&(n=e.length),e.slice(r,n)}function v2e(e){if(lb(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function w2e(e){lb(e);let t=e.length,r=-1,n=0,i=-1,a=0,o;for(;t--;){const c=e.codePointAt(t);if(c===47){if(o){n=t+1;break}continue}r<0&&(o=!0,r=t+1),c===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||r<0||a===0||a===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function N2e(...e){let t=-1,r;for(;++t0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function A2e(e,t){let r="",n=0,i=-1,a=0,o=-1,c,h;for(;++o<=e.length;){if(o2){if(h=r.lastIndexOf("/"),h!==r.length-1){h<0?(r="",n=0):(r=r.slice(0,h),n=r.length-1-r.lastIndexOf("/")),i=o,a=0;continue}}else if(r.length>0){r="",n=0,i=o,a=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,o):r=e.slice(i+1,o),n=o-i-1;i=o,a=0}else c===46&&a>-1?a++:a=-1}return r}function lb(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const k2e={cwd:_2e};function _2e(){return"/"}function gj(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function S2e(e){if(typeof e=="string")e=new URL(e);else if(!gj(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return C2e(e)}function C2e(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r0){let[A,...S]=m;const j=n[w][1];mj(j)&&mj(A)&&(A=qk(!0,j,A)),n[w]=[f,A,...S]}}}}const P2e=new j4().freeze();function Xk(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Qk(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Zk(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function TL(e){if(!mj(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function PL(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Zv(e){return O2e(e)?e:new nY(e)}function O2e(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function R2e(e){return typeof e=="string"||D2e(e)}function D2e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const M2e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",OL=[],RL={allowDangerousHtml:!0},L2e=/^(https?|ircs?|mailto|xmpp)$/i,U2e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function J1(e){const t=B2e(e),r=z2e(e);return V2e(t.runSync(t.parse(r),r),e)}function B2e(e){const t=e.rehypePlugins||OL,r=e.remarkPlugins||OL,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...RL}:RL;return P2e().use(bwe).use(r).use(p2e,n).use(t)}function z2e(e){const t=e.children||"",r=new nY;return typeof t=="string"&&(r.value=t),r}function V2e(e,t){const r=t.allowedElements,n=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,c=t.unwrapDisallowed,h=t.urlTransform||F2e;for(const m of U2e)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+M2e+m.id,void 0);return rY(e,f),Zye(e,{Fragment:s.Fragment,components:i,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function f(m,y,w){if(m.type==="raw"&&w&&typeof y=="number")return o?w.children.splice(y,1):w.children[y]={type:"text",value:m.value},y;if(m.type==="element"){let A;for(A in Fk)if(Object.hasOwn(Fk,A)&&Object.hasOwn(m.properties,A)){const S=m.properties[A],j=Fk[A];(j===null||j.includes(m.tagName))&&(m.properties[A]=h(String(S||""),A,m))}}if(m.type==="element"){let A=r?!r.includes(m.tagName):a?a.includes(m.tagName):!1;if(!A&&n&&typeof y=="number"&&(A=!n(m,y,w)),A&&w&&typeof y=="number")return c&&m.children?w.children.splice(y,1,...m.children):w.children.splice(y,1),y}}}function F2e(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||n!==-1&&t>n||L2e.test(e.slice(0,t))?e:""}const Mc={title:"BE THE REASON FOR A SMILE: Saving Lives of Mothers, Children and Accident Victims",organizers:"Uganda Red Cross Society & Uganda Blood Transfusion Service",venue:"Kampala International University (KIU Main Campus)",dateTalk:"31st August – 4th Sept, 2026",mobileApp:"BLOOD 4 UGANDA APP",badge:"FEATURED BLOOD DRIVE",likesCount:342,description:"Join the nationwide lifesaving blood donation week at KIU. Uganda Red Cross Society in collaboration with UBTS invites all students, faculty, and campus citizens to donate safe blood and give the gift of life.",author:{name:"Uganda Red Cross (Campus Chapter)",photoURL:"https://images.unsplash.com/photo-1615461066841-6116e61058f4?w=150&auto=format&fit=crop&q=80"}},iY=({onOpenPosts:e,onAuthorClick:t})=>{const[r,n]=I.useState("all"),[i,a]=I.useState([]),[o,c]=I.useState([]),[h,f]=I.useState(!0),[m,y]=I.useState(!0),[w,A]=I.useState(null),[S,j]=I.useState(1),[T,D]=I.useState(""),[V,U]=I.useState(!1),[G,X]=I.useState(!1),[q,B]=I.useState(null),[,z]=I.useState(null),[F,$]=I.useState(!1),[J,Q]=I.useState({}),[K,me]=I.useState(!1),[re,le]=I.useState(Mc.likesCount),[ve,je]=I.useState(!1),Ve=()=>{if(e)e();else{const Ae=new CustomEvent("setTab",{detail:"posts"});window.dispatchEvent(Ae),window.scrollTo({top:0,behavior:"smooth"})}},Z=Ae=>{t?t(Ae):Ve()};I.useEffect(()=>{(async()=>{var Ie,vt,Re,It;if(Ne.currentUser){const Dt=["atwiinevictor2@gmail.com","campuseye@gmail.com"];try{const cr=await as(st(fe,"admins",Ne.currentUser.uid)),St=await as(st(fe,"users",Ne.currentUser.uid)),Ct=cr.exists()&&((Ie=cr.data())==null?void 0:Ie.isAdmin)===!0||St.exists()&&(((vt=St.data())==null?void 0:vt.isAdmin)===!0||((Re=St.data())==null?void 0:Re.role)==="admin")||Dt.includes(Ne.currentUser.email||"");$(Ct)}catch{$(Dt.includes(((It=Ne.currentUser)==null?void 0:It.email)||""))}}else $(!1)})()},[]),I.useEffect(()=>{const Ae=Jt(nt(fe,"tickets"),di("createdAt","desc"),yi(10)),Ie=ei(Ae,vt=>{const Re=vt.docs.map(It=>({id:It.id,...It.data()}));a(Re),f(!1)},vt=>{console.warn("Failed to load tickets for live feed embed:",vt),f(!1)});return()=>Ie()},[]),I.useEffect(()=>{const Ae=Jt(nt(fe,"posts"),di("createdAt","desc"),yi(10)),Ie=ei(Ae,vt=>{const Re=vt.docs.map(It=>({id:It.id,...It.data()}));c(Re),y(!1)},vt=>{console.warn("Failed to load posts for live event dispatch:",vt),y(!1)});return()=>Ie()},[]);const se=async(Ae,Ie)=>{if(Ae.stopPropagation(),!Ne.currentUser){he.error("Please sign in to like this post");return}const vt=Ne.currentUser.uid,Re=J[Ie.id]||Ie.likedBy&&Ie.likedBy.includes(vt);Q(It=>({...It,[Ie.id]:!Re})),c(It=>It.map(Dt=>Dt.id===Ie.id?{...Dt,likeCount:Re?Math.max(0,(Dt.likeCount||1)-1):(Dt.likeCount||0)+1,likedBy:Re?(Dt.likedBy||[]).filter(cr=>cr!==vt):[...Dt.likedBy||[],vt]}:Dt));try{const It=st(fe,"posts",Ie.id);Re?await Ir(It,{likeCount:Cn(-1),likedBy:T2(vt)}):await Ir(It,{likeCount:Cn(1),likedBy:I2(vt)})}catch(It){console.error("Failed to update post like:",It)}},xe=Ae=>{Ae.stopPropagation(),K?(me(!1),le(Ie=>Ie-1)):(me(!0),le(Ie=>Ie+1),he.success("Thank you for supporting the KIU Blood Donation Drive!",{icon:"🩸"}))},ae=Ae=>{Ae.stopPropagation(),je(!0),he.success("Pledge registered! See you at KIU Main Campus from 31st August to 4th Sept.",{duration:6e3,icon:"❤️"})},qe=(Ae,Ie,vt)=>{Ae.stopPropagation();const Re=window.location.href;navigator.share?navigator.share({title:Ie,text:`${Ie} - Live on Campus Eye Media`,url:Re}).catch(()=>{}):(navigator.clipboard.writeText(`${Ie} - ${Re}`),he.success("Link copied to clipboard!"))},pt=async Ae=>{if(!Ne.currentUser){he.error("Please sign in to book event passes");return}U(!0);try{const Ie=Math.floor(1e5+Math.random()*9e5),vt=Math.random().toString(36).substring(2,5).toUpperCase(),Re=`TKT-${Ie}-${vt}`;await dn(nt(fe,"notifications"),{userId:Ne.currentUser.uid,title:`🔑 Ticket Security Code: ${Ae.title}`,message:`Your requested security verification code for "${Ae.title}" is ready. Enter this code to confirm your seat allocation. Note: This security key works once and is confidential.`,code:Re,used:!1,type:"verification_code",createdAt:new Date}),z(Ae.id),he.success("Security code dispatched to your System Inbox! Check bell menu or profile.",{duration:5e3})}catch(Ie){console.error("Error creating verification code:",Ie),he.error("Failed to issue security code. Please try again.")}finally{U(!1)}},Fe=async()=>{if(!(!Ne.currentUser||!w)){if(!T.trim()){he.error("Please paste the ticket confirmation code");return}X(!0);try{const Ae=T.trim().toUpperCase(),Ie=Jt(nt(fe,"notifications"),An("userId","==",Ne.currentUser.uid),An("code","==",Ae),An("used","==",!1)),vt=await vr(Ie);if(vt.empty){he.error("Invalid, used, or expired security code. Please check your inbox."),X(!1);return}const Re=vt.docs[0],It=st(fe,"notifications",Re.id),Dt=st(fe,"tickets",w.id),cr=await as(Dt);if(!cr.exists()){he.error("Selected event session could not be located."),X(!1);return}const St=cr.data();if(S>St.remainingQuantity){he.error(`Not enough tickets remaining. Only ${St.remainingQuantity} available.`),X(!1);return}await Ir(It,{used:!0}),await Ir(Dt,{remainingQuantity:Cn(-S)});const Ct={ticketId:w.id,ticketTitle:w.title,userId:Ne.currentUser.uid,userName:Ne.currentUser.displayName||"Campus Citizen",userEmail:Ne.currentUser.email||"",price:w.price,totalAmount:w.price*S,quantity:S,purchaseDate:new Date,status:"confirmed"},Gt=await dn(nt(fe,"purchases"),Ct),Xe={id:Gt.id,verificationCode:Ae,venue:w.venue,eventDate:w.eventDate,...Ct};B(Xe),he.success(`Passes allocated under confirmation ID #${Gt.id.slice(-6).toUpperCase()}!`,{icon:"🎉"}),X(!1)}catch(Ae){console.error("Verification sequence failed:",Ae),he.error("Ticketing verification failed: "+Ae.message),X(!1)}}},jt=Ae=>{var Ie;if(Ae)try{const vt=Ae.id.toUpperCase(),Re=Ae.verificationCode||"CONFIRMED",It=` ============================================================ CAMPUS EYE DIGITAL EVENT PASS ============================================================ TICKET SERIAL: ${vt} CONFIRMATION: ${Re} STATUS: VALID / ONE-TIME ENTRY ONLY ------------------------------------------------------------ EVENT DETAILS: Title: ${Ae.ticketTitle.toUpperCase()} Date: ${(Ie=Ae.eventDate)!=null&&Ie.toDate?Ae.eventDate.toDate().toLocaleString():new Date(Ae.eventDate).toLocaleString()} Venue: ${Ae.venue.toUpperCase()} Quantity: ${Ae.quantity} PASS(ES) Total Paid: UGX ${(Ae.totalAmount||0).toLocaleString()} ------------------------------------------------------------ HOLDER METADATA: Name: ${Ae.userName} Email: ${Ae.userEmail} Auth Class: STUDENT MEMBER / COMMUNITY REPORT ------------------------------------------------------------ SECURITY NOTICE: Present the numeric QR serial sequence on entrance. Do not share this offline ticket copy. It must match your in-app digital identification profile. ============================================================ `,Dt=new Blob([It.trim()],{type:"text/plain;charset=utf-8"}),cr=URL.createObjectURL(Dt),St=document.createElement("a");St.href=cr,St.download=`EventPass-${Ae.ticketTitle.replace(/\s+/g,"-")}-${vt.slice(-6)}.txt`,document.body.appendChild(St),St.click(),document.body.removeChild(St),URL.revokeObjectURL(cr),he.success("Offline Text Ticket downloaded successfully!")}catch(vt){he.error("Download failed: "+vt.message)}},Pt=Ae=>{let Ie=0;for(let Re=0;Re8||Re>8&&Dt<3;let Ct=!1;St?Ct=Re===0||Re===2||Dt===0||Dt===2||Re===0&&Dt===11||Re===2&&Dt===11||Dt===9&&(Re===0||Re===2)||Re===9&&Dt===0||Re===11&&Dt===0||Dt===2&&(Re===9||Re===11):Ct=Math.abs((Ie^cr*7)%11)<4,It.push(Ct)}vt.push(It)}return s.jsx("svg",{viewBox:"0 0 120 120",className:"w-32 h-32 bg-white p-2 border border-gray-150 rounded-xl shadow-inner mx-auto",children:vt.map((Re,It)=>Re.map((Dt,cr)=>s.jsx("rect",{x:cr*10,y:It*10,width:9,height:9,rx:1.5,fill:Dt?"#0F172A":"transparent"},`${It}-${cr}`)))})};return s.jsxs("div",{className:"space-y-4 font-sans text-left",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 overflow-x-auto pb-1 border-b border-gray-100 no-scrollbar",children:[s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsxs("button",{type:"button",onClick:()=>n("all"),className:`px-3 py-1.5 rounded-xl text-[9px] font-black uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 ${r==="all"?"bg-accent text-white shadow-xs":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[s.jsx(Xi,{size:11})," All"]}),s.jsxs("button",{type:"button",onClick:()=>n("posts"),className:`px-3 py-1.5 rounded-xl text-[9px] font-black uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 ${r==="posts"?"bg-red-650 text-white shadow-xs":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[s.jsx(Ri,{size:11})," Posts (",o.length,")"]}),s.jsxs("button",{type:"button",onClick:()=>n("tickets"),className:`px-3 py-1.5 rounded-xl text-[9px] font-black uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 ${r==="tickets"?"bg-gray-900 text-white shadow-xs":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[s.jsx(Ea,{size:11})," Tickets (",i.length,")"]}),s.jsxs("button",{type:"button",onClick:()=>n("blood_drive"),className:`px-3 py-1.5 rounded-xl text-[9px] font-black uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 ${r==="blood_drive"?"bg-red-700 text-white shadow-xs":"bg-red-50 text-red-700 border border-red-200 hover:bg-red-100"}`,children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-600"})," Blood Drive"]})]}),s.jsxs("button",{type:"button",onClick:Ve,className:"text-[9px] font-black uppercase tracking-wider text-accent hover:underline flex items-center gap-0.5 shrink-0",children:[s.jsx("span",{children:"Lounge"}),s.jsx(Ip,{size:10})]})]}),(r==="all"||r==="blood_drive")&&s.jsxs("div",{className:"bg-gradient-to-br from-red-50 via-white to-red-50/40 border-2 border-red-200/80 rounded-2xl p-4 sm:p-5 text-left relative overflow-hidden shadow-xs hover:shadow-md transition-all group",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 pb-3 mb-3 border-b border-red-150/70 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"px-2.5 py-0.5 rounded-md bg-red-600 text-white text-[8px] font-mono font-black uppercase tracking-widest flex items-center gap-1 shadow-xs",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-ping"}),Mc.badge]}),s.jsx("span",{className:"text-[9px] font-bold text-red-800 uppercase tracking-wider",children:"KIU Main Campus • Lifesaving Week"})]}),s.jsxs("span",{className:"text-[8.5px] font-mono font-bold text-gray-500 flex items-center gap-1",children:[s.jsx(vw,{size:10,className:"text-red-500"})," 31 Aug – 04 Sept, 2026"]})]}),s.jsx("div",{className:"flex flex-col md:flex-row gap-4 items-start",children:s.jsxs("div",{className:"flex-1 min-w-0 space-y-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("img",{src:Mc.author.photoURL,alt:"Uganda Red Cross",className:"w-7 h-7 rounded-full object-cover border border-red-200"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-xs font-black text-gray-900 leading-tight",children:Mc.author.name}),s.jsx(So,{className:"w-3.5 h-3.5 text-red-600"})]}),s.jsx("p",{className:"text-[8px] font-black text-gray-400 uppercase tracking-widest",children:Mc.organizers})]})]}),s.jsx("h4",{className:"text-base sm:text-lg font-black text-gray-950 uppercase tracking-tight leading-tight group-hover:text-red-700 transition-colors",children:Mc.title}),s.jsx("p",{className:"text-xs text-gray-700 font-medium leading-relaxed",children:Mc.description}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 pt-1",children:[s.jsxs("div",{className:"p-2.5 bg-white rounded-xl border border-red-150/80 shadow-2xs space-y-0.5",children:[s.jsxs("span",{className:"text-[8px] font-black text-red-600 uppercase tracking-wider block flex items-center gap-1",children:[s.jsx(r2,{size:9})," Venue Location"]}),s.jsx("p",{className:"text-xs font-black text-gray-900 truncate",children:Mc.venue})]}),s.jsxs("div",{className:"p-2.5 bg-white rounded-xl border border-red-150/80 shadow-2xs space-y-0.5",children:[s.jsxs("span",{className:"text-[8px] font-black text-red-600 uppercase tracking-wider block flex items-center gap-1",children:[s.jsx($p,{size:9})," Date of Talk & Donation"]}),s.jsx("p",{className:"text-xs font-black text-gray-900 truncate",children:Mc.dateTalk})]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-red-100 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[8px] font-black text-gray-500 uppercase tracking-widest font-mono",children:"🏥 Powered by: Red Cross & UBTS"}),s.jsx("span",{className:"text-[8px] font-black text-red-600 uppercase bg-red-100/70 px-2 py-0.5 rounded-md",children:Mc.mobileApp})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:xe,className:`px-3 py-1.5 rounded-xl text-[9px] font-black uppercase tracking-wider transition-all flex items-center gap-1 cursor-pointer ${K?"bg-red-600 text-white shadow-xs":"bg-white border border-red-200 text-red-700 hover:bg-red-50"}`,children:[s.jsx(Fl,{size:11,className:K?"fill-current":""}),s.jsxs("span",{children:[re," Supports"]})]}),s.jsx("button",{type:"button",onClick:ae,disabled:ve,className:`px-3 py-1.5 rounded-xl text-[9px] font-black uppercase tracking-wider transition-all flex items-center gap-1 cursor-pointer ${ve?"bg-emerald-600 text-white":"bg-gray-950 hover:bg-red-700 text-white shadow-xs"}`,children:ve?s.jsxs(s.Fragment,{children:[s.jsx(Rl,{size:11})," Pledged to Donate"]}):s.jsx(s.Fragment,{children:s.jsx("span",{children:"🩸 Pledge to Donate"})})}),s.jsx("button",{type:"button",onClick:Ae=>qe(Ae,Mc.title),className:"p-1.5 bg-white border border-red-200 text-gray-600 hover:text-red-600 rounded-xl transition-colors cursor-pointer",title:"Share Dispatch",children:s.jsx(Ld,{size:12})})]})]})]})})]}),(r==="all"||r==="posts")&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsxs("span",{className:"text-[9px] font-black tracking-widest text-gray-400 uppercase flex items-center gap-1",children:[s.jsx(Nne,{size:12,className:"text-red-500"})," Live Community Event Posts"]}),s.jsxs("button",{type:"button",onClick:Ve,className:"text-[9px] font-black uppercase text-accent hover:underline flex items-center gap-1 cursor-pointer",children:[s.jsx(Uc,{size:10})," Create Post"]})]}),m?s.jsxs("div",{className:"p-6 text-center bg-gray-50 border border-gray-100 rounded-2xl",children:[s.jsx(vn,{className:"animate-spin text-gray-400 mx-auto",size:18}),s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-widest mt-2",children:"Loading Live Event Posts..."})]}):o.length===0?s.jsxs("div",{className:"p-6 text-center bg-gray-50 border border-gray-100 rounded-2xl space-y-2",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"No Recent Posts Found"}),s.jsx("button",{type:"button",onClick:Ve,className:"px-4 py-1.5 bg-accent text-white text-[9px] font-black uppercase tracking-wider rounded-xl cursor-pointer",children:"Post First Dispatch in Lounge"})]}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3.5",children:o.slice(0,4).map(Ae=>{var vt;const Ie=J[Ae.id]||Ae.likedBy&&Ne.currentUser&&Ae.likedBy.includes(Ne.currentUser.uid);return s.jsxs("div",{onClick:Ve,className:"bg-white border border-gray-150 hover:border-red-300 rounded-2xl p-4 text-left flex flex-col justify-between transition-all duration-200 hover:shadow-xs cursor-pointer group space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",onClick:Re=>{Re.stopPropagation(),Z(Ae.authorId)},children:[Ae.authorPhotoURL?s.jsx("img",{src:Ae.authorPhotoURL,alt:Ae.authorName,className:"w-7 h-7 rounded-full object-cover border border-gray-100 shrink-0"}):s.jsx("div",{className:"w-7 h-7 rounded-full bg-red-100 text-red-650 flex items-center justify-center text-[10px] font-black uppercase shrink-0",children:((vt=Ae.authorName)==null?void 0:vt.charAt(0))||"U"}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-xs font-black text-gray-900 truncate leading-tight group-hover:text-accent transition-colors",children:Ae.authorName||"Campus Citizen"}),s.jsx(So,{className:"w-3 h-3 text-accent shrink-0"})]}),s.jsx("span",{className:"text-[8.5px] font-bold text-gray-400 uppercase font-mono",children:Q0(Ae.createdAt)})]})]}),s.jsx("span",{className:"text-[8px] font-black uppercase font-mono px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md",children:"DISPATCH"})]}),s.jsx("p",{className:"text-xs text-gray-800 font-medium line-clamp-3 leading-relaxed",children:Ae.content}),Ae.imageUrl&&s.jsx("div",{className:"relative rounded-xl overflow-hidden bg-gray-100 aspect-video max-h-40 border border-gray-100",children:s.jsx(Bi,{src:Ae.imageUrl,alt:"Post Media",className:"w-full h-full object-cover group-hover:scale-102 transition-transform duration-300"})}),s.jsxs("div",{className:"pt-2 border-t border-gray-100 flex items-center justify-between text-gray-500 text-[9px] font-bold",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("button",{type:"button",onClick:Re=>se(Re,Ae),className:`flex items-center gap-1 px-2 py-1 rounded-lg transition-colors cursor-pointer ${Ie?"text-red-600 bg-red-50":"hover:text-red-600 hover:bg-gray-50"}`,children:[s.jsx(Fl,{size:11,className:Ie?"fill-current":""}),s.jsx("span",{children:Ae.likeCount||0})]}),s.jsxs("button",{type:"button",onClick:Re=>{Re.stopPropagation(),Ve()},className:"flex items-center gap-1 px-2 py-1 rounded-lg hover:text-gray-900 hover:bg-gray-50 transition-colors cursor-pointer",children:[s.jsx(qp,{size:11}),s.jsx("span",{children:Ae.commentCount||0})]})]}),s.jsxs("button",{type:"button",onClick:Re=>{Re.stopPropagation(),Ve()},className:"text-[8.5px] font-black uppercase tracking-wider text-accent hover:underline flex items-center gap-0.5",children:[s.jsx("span",{children:"Join Discussion"}),s.jsx(Ip,{size:9})]})]})]},Ae.id)})})]}),(r==="all"||r==="tickets")&&s.jsxs("div",{className:"space-y-3 pt-2",children:[s.jsx("div",{className:"flex items-center justify-between px-1",children:s.jsxs("span",{className:"text-[9px] font-black tracking-widest text-gray-400 uppercase flex items-center gap-1",children:[s.jsx(Ea,{size:12,className:"text-accent"})," Box Office Event Passes & Entry Keys"]})}),h?s.jsxs("div",{className:"p-6 text-center bg-gray-50 border border-gray-100 rounded-2xl",children:[s.jsx(vn,{className:"animate-spin text-gray-400 mx-auto",size:18}),s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-widest mt-2",children:"Loading Available Passes..."})]}):i.length===0?s.jsxs("div",{className:"p-6 text-center bg-gray-50 border border-gray-100 rounded-2xl space-y-2",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"No active box office tickets currently posted"}),s.jsx("p",{className:"text-[9px] text-gray-500",children:"Check back soon or browse live event dispatches and community posts above."})]}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:i.slice(0,4).map(Ae=>{var vt;const Ie=Ae.remainingQuantity<=0;return s.jsxs("div",{className:"bg-white border border-gray-150 rounded-2xl p-4 text-left flex flex-col justify-between hover:border-accent transition-colors relative overflow-hidden group shadow-2xs",children:[Ie?s.jsx("div",{className:"absolute top-3 right-3 bg-gray-900 text-white text-[8px] font-black px-2 py-0.5 rounded-full uppercase",children:"Sold Out"}):Ae.remainingQuantity<10?s.jsxs("div",{className:"absolute top-3 right-3 bg-red-650 text-white text-[8px] font-black px-2 py-0.5 rounded-full uppercase",children:["Only ",Ae.remainingQuantity," Left!"]}):s.jsxs("div",{className:"absolute top-3 right-3 bg-accent text-white text-[8px] font-black px-2 py-0.5 rounded-full uppercase",children:[Ae.remainingQuantity," Remaining"]}),s.jsxs("div",{className:"flex gap-3 items-start w-full",children:[Ae.imageUrl&&s.jsx(Bi,{src:Ae.imageUrl,alt:Ae.title,className:"w-14 h-14 rounded-xl object-cover shrink-0 border border-gray-100/80 bg-gray-50 shadow-xs"}),s.jsxs("div",{className:"space-y-1 flex-1 min-w-0",children:[s.jsx("p",{className:"text-[8px] font-black text-accent uppercase tracking-widest leading-none mb-0.5",children:Ae.category}),s.jsx("h4",{className:"text-sm font-black text-gray-950 uppercase tracking-tight leading-snug group-hover:text-accent transition-colors line-clamp-2",children:Ae.title}),s.jsxs("div",{className:"flex flex-col gap-0.5 pt-1 text-gray-500 text-[9px] font-bold",children:[s.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[s.jsx($p,{size:10,className:"shrink-0 text-gray-400"}),(vt=Ae.eventDate)!=null&&vt.toDate?Ae.eventDate.toDate().toLocaleDateString(void 0,{dateStyle:"short"}):"TBA"]}),s.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[s.jsx(r2,{size:10,className:"shrink-0 text-gray-400"}),Ae.venue]})]}),Ae.link&&s.jsx("div",{className:"pt-1",children:s.jsxs("a",{href:Ae.link,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 text-[9px] text-blue-650 font-black uppercase tracking-wider hover:underline",onClick:Re=>Re.stopPropagation(),children:[s.jsx("span",{children:"Event Link"}),s.jsx(Ip,{size:10,className:"text-blue-650"})]})})]})]}),s.jsxs("div",{className:"pt-4 border-t border-gray-100/60 mt-4 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[7.5px] font-black text-gray-400 uppercase tracking-widest leading-none mb-0.5",children:"Event Rate"}),s.jsxs("p",{className:"text-sm font-black text-gray-950",children:[s.jsx("span",{className:"text-[9px]",children:"UGX"})," ",Ae.price.toLocaleString()]})]}),s.jsx("button",{onClick:()=>{if(!Ne.currentUser){he.error("Please login to reserve coordinates");return}A(Ae),B(null),D(""),j(1)},disabled:Ie,className:"px-3.5 py-1.5 bg-gray-950 hover:bg-accent text-white disabled:bg-gray-100 disabled:text-gray-400 rounded-lg text-[9px] font-black uppercase tracking-widest transition-all cursor-pointer shadow-xs whitespace-nowrap",children:"Book Secure Pass"})]}),F&&s.jsxs("div",{className:"pt-3 border-t border-dashed border-gray-150 mt-3 flex gap-2 w-full",children:[s.jsx("button",{onClick:Re=>{Re.stopPropagation(),localStorage.setItem("edit_ticket_item",JSON.stringify(Ae));const It=new CustomEvent("setTab",{detail:"admin"});window.dispatchEvent(It),setTimeout(()=>{window.dispatchEvent(new CustomEvent("checkPendingTicketEdit"))},100)},className:"flex-1 py-1 px-2 bg-blue-50 text-blue-600 rounded-lg text-[8.5px] font-black uppercase tracking-wider hover:bg-blue-600 hover:text-white transition-all text-center cursor-pointer",children:"Edit"}),s.jsx("button",{onClick:async Re=>{if(Re.stopPropagation(),!F){he.error("Access Denied: Only admins can delete tickets.");return}if(window.confirm("Are you sure you want to permanently delete this event ticket?"))try{await ai(st(fe,"tickets",Ae.id)),he.success("Ticket deleted successfully")}catch(It){he.error("Failed to delete ticket: "+It.message)}},className:"flex-1 py-1 px-2 bg-red-50 text-red-650 rounded-lg text-[8.5px] font-black uppercase tracking-wider hover:bg-red-650 hover:text-white transition-all text-center cursor-pointer",title:"Delete Ticket",children:"Delete"})]})]},Ae.id)})})]}),s.jsx(on,{children:w&&s.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[s.jsx(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{!G&&!V&&(A(null),B(null))},className:"absolute inset-0 bg-black/60 backdrop-blur-xs"}),s.jsxs(Qt.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"relative bg-white w-full max-w-md rounded-2xl shadow-2xl p-6 text-left space-y-5 border border-gray-100 overflow-hidden z-10",children:[s.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-gray-100",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-1.5 bg-red-100 text-red-650 rounded-lg shrink-0",children:s.jsx(Ea,{size:14})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xs font-black uppercase text-gray-950 tracking-wide",children:"SECURE EVENT GATEWAY"}),s.jsx("p",{className:"text-[8.5px] font-bold text-gray-400 uppercase tracking-wider",children:"Allocations require physical verification key"})]})]}),s.jsx("button",{onClick:()=>A(null),className:"p-1 text-gray-400 hover:text-black hover:bg-gray-50 rounded-full transition-all cursor-pointer",children:"✕"})]}),q?s.jsxs("div",{className:"space-y-4 text-center",children:[s.jsxs("div",{className:"py-2",children:[s.jsx("div",{className:"w-12 h-12 bg-green-100 text-green-600 rounded-full flex items-center justify-center mx-auto mb-2 scale-110",children:s.jsx(zu,{size:28,id:"ticket-success-check"})}),s.jsx("h4",{className:"text-sm font-black text-gray-950 uppercase tracking-tight leading-none mb-1",children:"Pass Issued Successfully"}),s.jsxs("p",{className:"text-[9px] text-gray-400 font-bold uppercase tracking-wider",children:["Secure Serial: #",q.id.slice(-6).toUpperCase()]})]}),s.jsxs("div",{className:"p-4 bg-gray-50 border border-gray-150 rounded-xl space-y-3",children:[Pt(`ticket_serial_${q.id}`),s.jsxs("div",{className:"space-y-0.5 text-center mt-2",children:[s.jsx("p",{className:"text-[11px] font-semibold text-gray-800 leading-tight truncate uppercase",children:w.title}),s.jsx("p",{className:"text-[8px] font-bold text-gray-400 uppercase tracking-widest",children:w.venue}),s.jsxs("p",{className:"text-[8px] font-black text-gray-500 mt-1 uppercase",children:["Pass Quantity: ",q.quantity," • Verified Conf"]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("button",{onClick:()=>jt(q),className:"w-full py-3 bg-black hover:bg-gray-950 text-white font-black uppercase text-[9px] tracking-widest rounded-lg flex items-center justify-center gap-1.5 transition-colors cursor-pointer",children:[s.jsx(eE,{size:12}),"Download Pass"]}),s.jsx("button",{onClick:()=>A(null),className:"w-full py-3 bg-gray-100 hover:bg-gray-200 text-gray-800 font-black uppercase text-[9px] tracking-widest rounded-lg transition-colors cursor-pointer",children:"Done"})]})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-gray-50 border border-gray-150 p-3.5 rounded-xl space-y-2",children:[s.jsx("p",{className:"text-[8.5px] font-bold text-gray-400 uppercase tracking-widest leading-none",children:"Selected Event Coordinates"}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-black text-gray-950 uppercase tracking-tight",children:w.title}),s.jsxs("div",{className:"flex items-center gap-4 mt-1 text-[9px] font-black text-accent uppercase font-mono",children:[s.jsxs("span",{children:["UGX ",w.price.toLocaleString()," RATE"]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:[w.remainingQuantity," SEATS REMAINING"]})]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-200/50",children:[s.jsx("span",{className:"text-[10px] font-black text-gray-600 uppercase",children:"Quantity"}),s.jsxs("div",{className:"flex items-center gap-3 bg-white border border-gray-150 rounded-lg p-1",children:[s.jsx("button",{onClick:()=>j(Math.max(1,S-1)),className:"w-6 h-6 flex items-center justify-center text-xs font-bold hover:bg-gray-100 rounded cursor-pointer",children:"-"}),s.jsx("span",{className:"text-xs font-black text-gray-850 w-5 text-center",children:S}),s.jsx("button",{onClick:()=>j(Math.min(w.remainingQuantity,S+1)),className:"w-6 h-6 flex items-center justify-center text-xs font-bold hover:bg-gray-100 rounded cursor-pointer",children:"+"})]})]})]}),s.jsxs("div",{className:"space-y-2 text-center py-1",children:[s.jsx("p",{className:"text-[9px] text-gray-500 font-medium",children:"Ticketing is locked to prevent fraud. Send a secure confirmation OTP to your system index, then verify below to authorize."}),s.jsx("button",{onClick:()=>pt(w),disabled:V,className:"px-4 py-2 bg-red-50 hover:bg-red-100 text-red-650 rounded-xl text-[9.5px] font-black uppercase tracking-wider transition-colors inline-flex items-center gap-1.5 cursor-pointer disabled:opacity-50",children:V?s.jsxs(s.Fragment,{children:[s.jsx(vn,{className:"animate-spin",size:12}),"Broadcasting Key..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Xs,{size:12}),"Request Verification Code (System Inbox)"]})})]}),s.jsxs("div",{className:"space-y-2 pt-2 border-t border-gray-100",children:[s.jsx("label",{className:"text-[9.5px] font-black text-gray-900 uppercase tracking-wide block",children:"CONFIRMATION CODE KEY"}),s.jsx("div",{className:"relative",children:s.jsx("input",{type:"text",value:T,onChange:Ae=>D(Ae.target.value),placeholder:"e.g. TKT-94285-ABC",className:"w-full px-4 py-3 bg-gray-50 border border-gray-200 focus:border-black focus:bg-white rounded-xl text-xs font-black placeholder:text-gray-300 outline-none uppercase tracking-widest text-center"})})]}),s.jsx("button",{onClick:Fe,disabled:G||!T.trim(),className:"w-full py-4 bg-gray-950 hover:bg-accent disabled:bg-gray-100 disabled:text-gray-400 text-white rounded-xl text-[10px] font-black uppercase tracking-widest transition-all shadow-md flex items-center justify-center gap-2 cursor-pointer",children:G?s.jsxs(s.Fragment,{children:[s.jsx(vn,{className:"animate-spin",size:14}),"Authorizing Digital Stamp..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ul,{size:14}),"Verify Confirmation Key & Issue Pass"]})})]})]})]})})]})},sY=({value:e,onSelectMention:t,className:r})=>{const n=e.match(/@([a-zA-Z0-9_]*)$/);if(!n)return null;const i=n[1].toLowerCase();if(!["","m","me","meg","mega","megaai","ai","bot"].some(c=>c.startsWith(i)||i.startsWith(c)))return null;const o=()=>{const c=e.replace(/@([a-zA-Z0-9_]*)$/,"@Mega AI ");t(c)};return s.jsx("div",{className:Ge("relative z-30 my-1.5",r),children:s.jsxs("div",{onClick:o,className:"bg-gradient-to-r from-amber-50 via-white to-red-50 border border-amber-300 rounded-2xl p-2.5 shadow-lg shadow-amber-500/10 flex items-center justify-between cursor-pointer hover:border-amber-500 transition-all group animate-in fade-in slide-in-from-bottom-2 duration-150",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("img",{src:Uo,alt:"Mega AI",className:"w-8 h-8 rounded-xl object-cover border border-amber-400/50 shadow-xs shrink-0 group-hover:scale-105 transition-transform"}),s.jsxs("div",{className:"text-left",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-xs font-black uppercase text-gray-950 tracking-tight",children:"Mega AI"}),s.jsx("span",{className:"text-[9px] font-mono font-bold text-amber-700 bg-amber-100/80 px-1.5 py-0.2 rounded",children:"@Mega AI"})]}),s.jsxs("p",{className:"text-[9.5px] font-medium text-gray-500 flex items-center gap-1",children:[s.jsx(Xi,{size:10,className:"text-amber-500 shrink-0"}),s.jsx("span",{children:"Tap to mention for an instant AI smart response"})]})]})]}),s.jsxs("div",{className:"px-2.5 py-1 bg-amber-500 hover:bg-amber-600 text-white rounded-xl text-[9.5px] font-black uppercase tracking-wider shrink-0 transition-colors flex items-center gap-1 shadow-2xs",children:[s.jsx("span",{children:"Mention"}),s.jsx(zu,{size:11})]})]})})};async function xj(e,t=1200,r=1200,n=.78){return new Promise((i,a)=>{if(e.type&&!e.type.startsWith("image/")){i(e);return}const o=new FileReader;o.onload=c=>{var f;const h=new Image;h.onload=()=>{try{const m=document.createElement("canvas");let y=h.naturalWidth||h.width,w=h.naturalHeight||h.height;(y>t||w>r)&&(y/t>w/r?(w=Math.round(w*t/y),y=t):(y=Math.round(y*r/w),w=r)),m.width=Math.max(1,y),m.height=Math.max(1,w);const A=m.getContext("2d");if(!A){i(e);return}A.imageSmoothingEnabled=!0,A.imageSmoothingQuality="high",A.drawImage(h,0,0,y,w),m.toBlob(S=>{i(S||e)},"image/jpeg",n)}catch{i(e)}},h.onerror=()=>i(e),h.src=(f=c.target)==null?void 0:f.result},o.onerror=()=>i(e),o.readAsDataURL(e)})}function aY(e){return new Promise((t,r)=>{const n=new FileReader;n.onloadend=()=>{typeof n.result=="string"?t(n.result):r(new Error("Failed to convert blob to base64"))},n.onerror=()=>r(new Error("FileReader blob error")),n.readAsDataURL(e)})}async function Q2(e,t=600,r=600,n=.72){try{const i=await xj(e,t,r,n);return await aY(i)}catch{return new Promise((a,o)=>{const c=new FileReader;c.onloadend=()=>{typeof c.result=="string"?a(c.result):o(new Error("Image conversion failed"))},c.onerror=()=>o(new Error("FileReader error")),c.readAsDataURL(e)})}}function oY(){if(typeof window<"u"){const e=localStorage.getItem("campus_eye_imgbb_active_key");if(e&&e.trim().length>5)return e.trim()}return"857eaaf2b7571ee437db8ee3f6ee8670"}async function I4(e){const t=oY(),r=Array.from(new Set([t,"857eaaf2b7571ee437db8ee3f6ee8670","3b3f20f2693897b69c4fae1ff05d9852","f3a6776e0a442398246cb321152a5ec2","0305d21a221f786d14ea17435f29910d"])).filter(Boolean);let n;try{n=await xj(e,1200,1200,.76)}catch(i){console.warn("Client-side pre-compression failed, using raw payload:",i),n=e}for(const i of r)try{const a=new FormData,o=e.name?e.name.replace(/\.[^/.]+$/,"")+".jpg":"image.jpg",c=new File([n],o,{type:"image/jpeg"});a.append("image",c);const h=new AbortController,f=setTimeout(()=>h.abort(),8e3),m=await fetch(`https://api.imgbb.com/1/upload?key=${i}`,{method:"POST",body:a,signal:h.signal});if(clearTimeout(f),m.ok){const y=await m.json();if(y.success&&y.data&&y.data.url)return y.data.url}}catch{}try{const i=await xj(e,800,800,.7);return await aY(i)}catch{return await Q2(e,600,600,.65)}}const DL=["🔥","🤯","😢","👏","❤️","😂","👍","🎉","😡","✨","💯","👀","🚀","💡","🙌","🔊","⚽","🎮","💡","🎓","📢","💀","💩","💪","👑","❌"],$2e=({article:e,onClose:t,isAdmin:r,allArticles:n=[],onArticleSelect:i,onCategorySelect:a})=>{var Ci,Gr;const[o,c]=I.useState(e);I.useEffect(()=>{if(c(e),!(e!=null&&e.id))return;const be=ei(st(fe,"articles",e.id),Pe=>{Pe.exists()&&c({id:Pe.id,...Pe.data()})},Pe=>{console.warn("Realtime article sync error:",Pe)});return()=>be()},[e==null?void 0:e.id]);const[h,f]=I.useState([]),[m,y]=I.useState(""),[w,A]=I.useState(null),[S,j]=I.useState(!1),[T,D]=I.useState(!1),V=async be=>{if(be.clipboardData&&be.clipboardData.files&&be.clipboardData.files.length>0){const Pe=be.clipboardData.files[0];if(Pe&&Pe.type.startsWith("image/"))try{const $e=await Q2(Pe,600,600,.7);A($e),nn.success("Sticker / device image attached!")}catch{nn.error("Failed to process image")}}},U=async be=>{var $e;const Pe=($e=be.target.files)==null?void 0:$e[0];if(Pe)try{const ct=await Q2(Pe,600,600,.7);A(ct),nn.success("Device sticker/image attached!")}catch{nn.error("Failed to process image")}},[G,X]=I.useState(!1),[q,B]=I.useState(!1),[z,F]=I.useState(null),[$,J]=I.useState(null),[Q,K]=I.useState(!0),[me,re]=I.useState(!1),[le,ve]=I.useState(!1),[je,Ve]=I.useState(null),[Z,se]=I.useState(0),[xe,ae]=I.useState(!1),[qe,pt]=I.useState(!1),[Fe,jt]=I.useState([]),[Pt,Ae]=I.useState([]),[Ie,vt]=I.useState(!1);I.useEffect(()=>{const be=Jt(nt(fe,"sponsors")),Pe=Jt(nt(fe,"adverts"),yi(20));Promise.all([vr(be).catch(()=>null),vr(Pe).catch(()=>null)]).then(([$e,ct])=>{const yr=[];$e&&!$e.empty&&$e.docs.forEach(Lt=>yr.push({id:Lt.id,...Lt.data()})),ct&&!ct.empty&&ct.docs.forEach(Lt=>{const Lr=Lt.data();(Lr.imageUrl||Lr.mediaUrl)&&yr.push({id:Lt.id,name:Lr.company||Lr.title||"Partner",imageUrl:Lr.imageUrl||Lr.mediaUrl||"",link:Lr.targetUrl||Lr.link||"#"})}),Ae(yr)})},[]),I.useEffect(()=>{const be=Jt(nt(fe,"custom_pages"),di("createdAt","desc"));vr(be).then(Pe=>{jt(Pe.docs.map($e=>({id:$e.id,...$e.data()})))}).catch(Pe=>{console.warn("Silent ignore custom pages in article view:",Pe)})},[]);const Re=[o.featuredImageUrl,o.featuredImageUrl1,o.featuredImageUrl2].filter(Boolean),[It,Dt]=I.useState("newest"),[cr,St]=I.useState(null),[Ct,Gt]=I.useState([]),[Xe,Xt]=I.useState(0);I.useEffect(()=>{const be=Jt(nt(fe,"adverts"),yi(10));vr(be).then(Pe=>{const $e=Pe.docs.map(ct=>({id:ct.id,...ct.data()}));Gt($e.filter(ct=>ct.status==="active"))}).catch(Pe=>{console.warn("Failed to load adverts for article inline placements:",Pe)})},[]),I.useEffect(()=>{if(Ct.length<=1)return;const be=setInterval(()=>{Xt(Pe=>(Pe+1)%Ct.length)},5e3);return()=>clearInterval(be)},[Ct.length]),I.useEffect(()=>{if(o){document.title=`${o.title} | Campus Eye Media`;const be=o.summary||(o.content?o.content.substring(0,160)+"...":""),Pe=(de,ke,Ze)=>{let Ft=document.querySelector(`meta[${de}="${ke}"]`);Ft||(Ft=document.createElement("meta"),Ft.setAttribute(de,ke),document.head.appendChild(Ft)),Ft.setAttribute("content",Ze)},$e=(de,ke)=>{let Ze=document.querySelector(`link[rel="${de}"]`);Ze||(Ze=document.createElement("link"),Ze.setAttribute("rel",de),document.head.appendChild(Ze)),Ze.setAttribute("href",ke)},ct=o.title,yr=be,Lt=[o.featuredImageUrl,o.featuredImageUrl1,o.featuredImageUrl2,o.featuredImage,o.imageUrl,o.image,o.photo,o.coverImage,o.cover,o.thumbnail,o.mediaUrl,o.bannerUrl];let Lr="";const ir=[o.video,o.videoUrl,o.Links].filter(Boolean);for(const de of ir){const ke=de.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|shorts\/)([^#\&\?]*).*/);if(ke&&ke[2].length===11){Lr=`https://img.youtube.com/vi/${ke[2]}/hqdefault.jpg`;break}}let pr="";if(o.content){const de=o.content.match(/]+src=["'](https?:\/\/[^"'\s]+)["']/i)||o.content.match(/!\[.*?\]\((https?:\/\/[^\s\)]+)\)/i);de&&de[1]&&(pr=de[1])}const br=Lt.find(de=>de&&typeof de=="string"&&de.trim().length>5)||Lr||pr,ln=br?br.startsWith("data:")?`${window.location.origin}/api/article-image/${o.id}`:br:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg";Pe("property","og:title",ct),Pe("property","og:image",ln),Pe("property","og:image:url",ln),Pe("property","og:image:secure_url",ln),Pe("property","og:description",yr),Pe("property","og:url",window.location.href),Pe("name","description",yr),Pe("name","twitter:title",ct),Pe("name","twitter:description",yr),Pe("name","twitter:image",ln),Pe("name","twitter:image:src",ln),ln&&$e("image_src",ln)}},[o]),I.useEffect(()=>{var ct,yr,Lt;if(!o)return;const be=document.createElement("script");be.setAttribute("type","application/ld+json"),be.id=`seo-schema-${o.id}`;const Pe={"@context":"https://schema.org","@type":"NewsArticle",headline:o.title,image:[o.featuredImageUrl||"https://campuseye.media/placeholder.png"],datePublished:(ct=o.publishDate)!=null&&ct.toDate?new Date(o.publishDate.toDate()).toISOString():new Date().toISOString(),dateModified:(yr=o.publishDate)!=null&&yr.toDate?new Date(o.publishDate.toDate()).toISOString():new Date().toISOString(),author:[{"@type":"Person",name:o.authorName||"Campus Eye Reporter",jobTitle:"Campus Eyewitness Journalist"}],publisher:{"@type":"Organization",name:"Campus Eye Media",logo:{"@type":"ImageObject",url:"https://campuseye.media/logo.png"}},description:o.summary||((Lt=o.content)==null?void 0:Lt.substring(0,160))||""};be.textContent=JSON.stringify(Pe),document.head.appendChild(be);const $e=document.title;return document.title=`${o.title} | Campus Eye News`,()=>{const Lr=document.getElementById(`seo-schema-${o.id}`);Lr&&Lr.remove(),document.title=$e}},[o]),I.useEffect(()=>{const be=document.getElementById("full-article-modal-container");be&&be.scrollTo({top:0})},[e.id]),I.useEffect(()=>{if(e){const be=e.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Pe=`${window.location.origin}/articles=${be}/${e.id}`;fetch("/api/append-sitemap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Pe,title:e.title,image:e.featuredImageUrl||""})}).catch($e=>console.warn("Failed to notify sitemap update:",$e))}},[e.id]),I.useEffect(()=>{const be=st(fe,"articles",e.id);if(Ir(be,{viewCount:Cn(1)}).catch(Pe=>{console.warn("View counter update skipped:",Pe)}),as(be).then(Pe=>{Pe.exists()&&c({id:Pe.id,...Pe.data()})}).catch(Pe=>{Gs(Pe,Ps.GET,`articles/${e.id}`)}),Ne.currentUser){const Pe=st(fe,"articles",e.id,"likes",Ne.currentUser.uid);as(Pe).then(ir=>{X(ir.exists())}).catch(ir=>console.warn("Could not check if user liked article offline:",ir));const $e=`reacted_${e.id}_${Ne.currentUser.uid}`,ct=localStorage.getItem($e);if(ct){F(parseInt(ct));const pr=["🔥","🤯","😢","👏","❤️","😂","👍"][parseInt(ct)-1];pr&&J(pr)}const yr=`reacted_emoji_${e.id}_${Ne.currentUser.uid}`,Lt=localStorage.getItem(yr);Lt&&J(Lt);const Lr=`saved_${e.id}_${Ne.currentUser.uid}`;B(localStorage.getItem(Lr)==="true")}},[e.id,Ne.currentUser]);const Ot=()=>{const be={};o.reactions&&Object.entries(o.reactions).forEach(([$e,ct])=>{typeof ct=="number"&&ct>0&&(be[$e]=(be[$e]||0)+ct)});const Pe=["🔥","🤯","😢","👏","❤️","😂","👍"];for(let $e=1;$e<=7;$e++){const ct=o[`reaction${$e}`];if(ct&&ct.count>0){const yr=ct.emoji||Pe[$e-1];yr&&(be[yr]=(be[yr]||0)+ct.count)}}return be};I.useEffect(()=>{const be=Jt(nt(fe,"articles",e.id,"comments"),di("createdAt","desc")),Pe=ei(be,$e=>{const ct=$e.docs.map(yr=>({id:yr.id,...yr.data()}));f(ct)},$e=>{Gs($e,Ps.LIST,`articles/${e.id}/comments`)});return()=>Pe()},[e.id]);const or=()=>{const be=!Q;K(be),be&&setTimeout(()=>{const Pe=document.getElementById("full-article-comments-section");Pe&&Pe.scrollIntoView({behavior:"smooth",block:"nearest"})},30)},Wr=async be=>{if(!Ne.currentUser){nn.error("Please login to register solidarity on comments!"),typeof window.triggerAuthWithCallback=="function"&&window.triggerAuthWithCallback(()=>{Wr(be)});return}const Pe=st(fe,"articles",e.id,"comments",be),$e=`liked_comment_${be}_${Ne.currentUser.uid}`,ct=localStorage.getItem($e)==="true";try{ct?(localStorage.removeItem($e),await Ir(Pe,{likeCount:Cn(-1)})):(localStorage.setItem($e,"true"),await Ir(Pe,{likeCount:Cn(1)}),nn.success("Solidarity added to comment!"))}catch(yr){console.warn("Could not save comment like in db, performing local fallback:",yr)}},dr=async()=>{if(!Ne.currentUser){nn.error("Please login to support this post!"),typeof window.triggerAuthWithCallback=="function"&&window.triggerAuthWithCallback(()=>{dr()});return}const be=st(fe,"articles",e.id,"likes",Ne.currentUser.uid),Pe=st(fe,"articles",e.id);try{G?(X(!1),await ai(be),await Ir(Pe,{likeCount:Cn(-1)})):(X(!0),await Gn(be,{userId:Ne.currentUser.uid,createdAt:zr()}),await Ir(Pe,{likeCount:Cn(1)}),nn.success("Solidarity registered!"))}catch($e){console.error("Error on like operation:",$e)}},yn=async()=>{if(!Ne.currentUser){nn.error("Please login to bookmark dispatches"),typeof window.triggerAuthWithCallback=="function"&&window.triggerAuthWithCallback(()=>{yn()});return}const be=st(fe,"articles",e.id),Pe=`saved_${e.id}_${Ne.currentUser.uid}`,$e=q;try{$e?(B(!1),localStorage.removeItem(Pe),await Ir(be,{saveCount:Cn(-1)}),nn.success("Bookmark removed")):(B(!0),localStorage.setItem(Pe,"true"),await Ir(be,{saveCount:Cn(1)}),nn.success("Secured in Bookmarks!"))}catch(ct){console.error("Save error:",ct)}},He=async be=>{if(!Ne.currentUser){nn.error("Please login to register a reaction"),typeof window.triggerAuthWithCallback=="function"&&window.triggerAuthWithCallback(()=>{He(be)});return}const Pe=st(fe,"articles",e.id),$e=`reacted_emoji_${e.id}_${Ne.currentUser.uid}`,ct=`reacted_${e.id}_${Ne.currentUser.uid}`,yr=localStorage.getItem($e);try{const Lt={};if(yr===be)Lt[`reactions.${be}`]=Cn(-1),localStorage.removeItem($e),J(null),localStorage.removeItem(ct),F(null);else{if(yr)Lt[`reactions.${yr}`]=Cn(-1);else{const Lr=localStorage.getItem(ct);if(Lr){const ir=parseInt(Lr),br=["🔥","🤯","😢","👏","❤️","😂","👍"][ir-1];br&&(Lt[`reactions.${br}`]=Cn(-1)),localStorage.removeItem(ct),F(null)}}Lt[`reactions.${be}`]=Cn(1),localStorage.setItem($e,be),J(be)}await Ir(Pe,Lt),nn.success("Reaction logged dynamically!")}catch(Lt){console.warn("Reaction updater error:",Lt)}},Rt=async be=>{var Pe,$e;if(be.preventDefault(),!(!m.trim()&&!w)){if(!Ne.currentUser){nn.error("Please login to submit commentary"),typeof window.triggerAuthWithCallback=="function"&&window.triggerAuthWithCallback(()=>{Rt({preventDefault:()=>{}})});return}ve(!0);try{const ct=cr?cr.parentId||cr.id:null,yr={content:m,stickerUrl:w||null,userId:Ne.currentUser.uid,authorName:Ne.currentUser.displayName||"Campus Member",photoURL:Ne.currentUser.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(Ne.currentUser.displayName||"Member")}`,createdAt:new Date,parentId:ct,replyToAuthor:cr?cr.authorName:null},Lt=await dn(nt(fe,"articles",e.id,"comments"),{content:m,stickerUrl:w||null,userId:Ne.currentUser.uid,authorName:Ne.currentUser.displayName||"Campus Member",photoURL:Ne.currentUser.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(Ne.currentUser.displayName||"Member")}`,createdAt:zr(),parentId:ct,replyToAuthor:cr?cr.authorName:null});f(pr=>[{id:Lt.id,...yr},...pr]),c(pr=>({...pr,commentCount:(pr.commentCount||0)+1}));const Lr=st(fe,"articles",e.id);await Ir(Lr,{commentCount:Cn(1)});const ir=m;y(""),A(null),j(!1),St(null),nn.success("Comment added!"),/@(mega\s*(ai)?|me)\b/i.test(ir)&&M2(ir,((Pe=Ne.currentUser)==null?void 0:Pe.displayName)||"Campus Member",(($e=Ne.currentUser)==null?void 0:$e.uid)||"guest",{type:"article_comment",articleId:e.id,articleTitle:e.title,articleContent:e.content}).then(async pr=>{if(pr){const br=await dn(nt(fe,"articles",e.id,"comments"),{content:pr,userId:"mega-ai-bot",authorName:"Mega AI 🤖",photoURL:Uo,createdAt:zr(),parentId:null});f(ln=>[{id:br.id,content:pr,userId:"mega-ai-bot",authorName:"Mega AI 🤖",photoURL:Uo,createdAt:new Date,parentId:null},...ln]),c(ln=>({...ln,commentCount:(ln.commentCount||0)+1})),await Ir(st(fe,"articles",e.id),{commentCount:Cn(1)}),nn.success("Mega AI auto-replied to your commentary!",{icon:"✨"})}}).catch(pr=>console.error("Mega AI auto reply error:",pr))}catch(ct){console.error("Comment submit error:",ct)}finally{ve(!1)}}},nr=async()=>{const be=e.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Pe=`${window.location.origin}/articles=${be}/${e.id}`,$e=e.title,ct=e.summary||(e.content?e.content.substring(0,140)+"...":""),yr=`${e.title} ${ct}`,Lt=[e.featuredImageUrl,e.featuredImageUrl1,e.featuredImageUrl2,e.imageUrl].find(pr=>pr&&typeof pr=="string"&&pr.length>5)||"",Lr=Lt.startsWith("data:")?`${window.location.origin}/api/article-image/${e.id}`:Lt;try{fetch("/api/append-sitemap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Pe,title:$e,image:Lr})}).catch(()=>{})}catch{}let ir=!1;if(navigator.share)try{const pr={title:$e,text:`${yr} Read dispatch:`,url:Pe};await navigator.share(pr),ir=!0;const br=st(fe,"articles",e.id);await Ir(br,{shareCount:Cn(1)}).catch(console.error);return}catch(pr){console.warn("Native share canceled or unsuccessful:",pr)}if(!ir){try{const pr=`${$e} ${ct} Read More: ${Pe}`;await Od(pr);const br=st(fe,"articles",e.id);await Ir(br,{shareCount:Cn(1)}).catch(console.error)}catch{}D(!0)}},fr=async()=>{var be,Pe;if(!r&&((Pe=(be=Ne.currentUser)==null?void 0:be.email)==null?void 0:Pe.toLowerCase())!=="atwiinevictor2@gmail.com"){nn.error("Access Denied: Only administrators can delete articles.");return}if(window.confirm("Are you sure you want to permanently delete this article/post? This action is irreversible."))try{nn.loading("Deleting dispatch...",{id:"delete-dispatch"});const $e=st(fe,"articles",o.id);await ai($e),nn.success("Dispatch has been permanently deleted from Campus Eye.",{id:"delete-dispatch"}),t()}catch($e){console.error($e),nn.error(`Failed to delete dispatch: ${$e.message||$e}`,{id:"delete-dispatch"})}},hn=()=>e.featuredImageUrl?s.jsx("div",{className:"rounded-xl overflow-hidden border border-gray-150 w-full bg-gray-50 flex items-center justify-center relative shadow-sm cursor-zoom-in",onClick:()=>{se(0),ae(!0)},children:s.jsx(Bi,{src:e.featuredImageUrl,alt:e.title,priority:!0,className:"w-full h-auto max-h-[50rem] object-cover sm:object-contain hover:scale-[1.01] transition-transform duration-500 rounded-xl"})}):null,en=n.findIndex(be=>be.id===e.id);return s.jsxs(Qt.div,{initial:{opacity:0,scale:.88},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.88},transition:{type:"spring",damping:22,stiffness:220},id:"full-article-modal-container",className:"fixed inset-0 z-[2000] bg-white overflow-y-auto w-full h-full text-left pb-24",children:[s.jsxs("div",{className:"sticky top-0 z-50 bg-white/95 backdrop-blur-md border-b border-gray-100 h-15 flex items-center px-4 justify-between shadow-sm shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:t,className:"p-2 bg-red-50 text-red-650 border border-red-150 hover:bg-red-600 hover:text-white hover:rotate-90 rounded-full transition-all duration-300 shadow-3xs flex items-center justify-center shrink-0 cursor-pointer",title:"Close details",children:s.jsx(Jr,{size:15,strokeWidth:3})}),s.jsx("div",{className:"h-6 w-px bg-gray-250 hidden xs:block"}),s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 select-none",children:[s.jsx("button",{onClick:()=>pt(!0),className:"p-1 hover:text-red-650 text-gray-750 transition-all cursor-pointer flex items-center justify-center shrink-0",title:"Open Site Menu",children:s.jsx(tE,{size:14,strokeWidth:2.5})}),s.jsxs("div",{className:"flex items-center gap-1 cursor-pointer",onClick:()=>pt(!0),children:[s.jsx("img",{src:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",alt:"Campus Eye Logo",className:"h-5.5 w-5.5 sm:h-6 sm:w-6 rounded-full border border-gray-950 bg-white object-cover aspect-square shrink-0",referrerPolicy:"no-referrer"}),s.jsxs("div",{className:"hidden md:flex flex-col justify-center text-left -space-y-1",children:[s.jsxs("span",{className:"text-[10px] sm:text-[11px] font-serif font-black tracking-normal italic leading-none",children:[s.jsx("span",{className:"text-red-650",children:"Campus"})," ",s.jsx("span",{className:"text-blue-600",children:"Eye"})]}),s.jsx("span",{className:"text-[5px] sm:text-[5.5px] font-sans font-extrabold uppercase tracking-[0.24em] text-black text-right pr-0.2 block select-none leading-none",children:"Media"})]})]})]})]}),n.length>0&&en!==-1&&(()=>{const be=o.publishDate;let Pe=1;if(be){const $e=be.toDate?be.toDate():be.seconds?new Date(be.seconds*1e3):new Date(be),ct=new Date;ct.setHours(0,0,0,0);const yr=new Date($e);yr.setHours(0,0,0,0);const Lt=ct.getTime()-yr.getTime();Pe=Math.floor(Lt/(1e3*60*60*24))+1}return s.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 bg-gray-50 border border-gray-150 px-2 sm:px-3 py-1 rounded-full text-xs font-bold text-gray-700 select-none max-w-[50vw] sm:max-w-none justify-center",children:[s.jsx("button",{onClick:()=>{en>0&&(i==null||i(n[en-1]))},disabled:en===0,className:"p-0.5 sm:p-1 text-gray-400 hover:text-red-650 disabled:opacity-30 disabled:hover:text-gray-400 transition-colors cursor-pointer select-none flex items-center justify-center shrink-0",title:"Previous story",children:s.jsx(Hp,{size:14,strokeWidth:2.5})}),s.jsxs("span",{className:"font-mono text-[8.5px] sm:text-[9px] uppercase tracking-wider font-black text-gray-655 block text-center truncate",children:[s.jsxs("span",{className:"hidden md:inline",children:["DAY ",Pe," — "]}),"DISPATCH ",en+1]}),s.jsx("button",{onClick:()=>{en{const be=o.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Pe=`${window.location.origin}/articles=${be}/${o.id}`,$e=o.title;return s.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-3 border-b border-gray-100",children:[s.jsxs("a",{href:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(Pe)}`,target:"_blank",rel:"noopener noreferrer",className:"px-3.5 py-2 bg-[#1877F2] hover:bg-[#155fc5] text-white font-extrabold text-[10px] uppercase tracking-widest rounded-lg flex items-center gap-1.5 shadow-sm transition-all cursor-pointer hover:scale-[1.02]",children:[s.jsx("svg",{className:"w-3.5 h-3.5 fill-current",viewBox:"0 0 24 24",children:s.jsx("path",{d:"M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12c0 4.84 3.44 8.87 8 9.8V15H8v-3h2V9.5C10 7.57 11.57 6 13.5 6H16v3h-2c-.55 0-1 .45-1 1v2h3v3h-3v6.95c4.56-.93 8-4.96 8-9.75z"})}),s.jsx("span",{children:"Share"})]}),s.jsxs("a",{href:`https://twitter.com/intent/tweet?url=${encodeURIComponent(Pe)}&text=${encodeURIComponent($e)}`,target:"_blank",rel:"noopener noreferrer",className:"px-3.5 py-2 bg-black hover:bg-zinc-900 text-white font-extrabold text-[10px] uppercase tracking-widest rounded-lg flex items-center gap-1.5 shadow-sm transition-all cursor-pointer hover:scale-[1.02]",children:[s.jsx("svg",{className:"w-3.5 h-3.5 fill-current",viewBox:"0 0 24 24",children:s.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),s.jsx("span",{children:"Tweet"})]}),s.jsxs("a",{href:`https://api.whatsapp.com/send?text=${encodeURIComponent($e+" "+Pe)}`,target:"_blank",rel:"noopener noreferrer",className:"px-3.5 py-2 bg-[#25D366] hover:bg-[#20ba59] text-white font-extrabold text-[10px] uppercase tracking-widest rounded-lg flex items-center gap-1.5 shadow-sm transition-all cursor-pointer hover:scale-[1.02]",children:[s.jsx("svg",{className:"w-3.5 h-3.5 fill-current",viewBox:"0 0 24 24",children:s.jsx("path",{d:"M.057 24l1.687-6.163c-1.041-1.804-1.588-3.849-1.587-5.946C.06 5.348 5.397.01 12.008.01c3.202.001 6.212 1.246 8.477 3.514 2.266 2.268 3.507 5.28 3.505 8.484-.004 6.657-5.34 11.997-11.953 11.997-2.005-.001-3.973-.502-5.724-1.457L0 24zm6.59-4.846c1.6.95 3.1 1.45 4.8 1.45 5.4 0 9.8-4.4 9.8-9.8s-4.4-9.8-9.8-9.8c-5.4 0-9.8 4.4-9.8 9.8 0 1.9.5 3.7 1.5 5.3l-.9 3.5 3.4-.9z"})}),s.jsx("span",{children:"WhatsApp"})]}),s.jsx("button",{onClick:nr,className:"p-2 bg-gray-55 hover:bg-gray-100 border border-gray-150 rounded-lg text-gray-500 hover:text-gray-900 transition-colors cursor-pointer hover:scale-[1.02] shadow-sm ml-auto",title:"Copy text & browser link to clipboard",children:s.jsx(Uw,{size:13,className:"stroke-[2.5]"})})]})})(),s.jsx("article",{className:Ge("prose prose-red text-gray-900 leading-relaxed font-serif max-w-none text-base border-b border-gray-100 pb-8 selection:bg-red-50 transition-opacity duration-150",Q&&"opacity-90"),children:(()=>{const be=o.content||"";let Pe=be;try{const de=[];Pe=Pe.replace(/@([a-zA-Z0-9_\-]+)/g,(ke,Ze)=>(de.push(`[@${Ze}](mention:${Ze})`),`___MD_PLACEHOLDER_${de.length-1}___`)),Pe=Pe.replace(/\[([^\]]*)\]\((https?:\/\/[^\s\)]+)\)/gi,ke=>(de.push(ke),`___MD_PLACEHOLDER_${de.length-1}___`)),Pe=Pe.replace(/"([^"]+)"\s*\((https?:\/\/[^\s\)]+)\)/gi,(ke,Ze,Ft)=>(de.push(`[${Ze.trim()}](${Ft})`),`___MD_PLACEHOLDER_${de.length-1}___`)),Pe=Pe.replace(/\((https?:\/\/[^\s\)]+)\)/gi,(ke,Ze)=>(de.push(`([${Ze}](${Ze}))`),`___MD_PLACEHOLDER_${de.length-1}___`)),Pe=Pe.replace(/(https?:\/\/[^\s\)\>\]]+)/gi,ke=>(de.push(`[${ke}](${ke})`),`___MD_PLACEHOLDER_${de.length-1}___`));for(let ke=de.length-1;ke>=0;ke--)Pe=Pe.replace(`___MD_PLACEHOLDER_${ke}___`,de[ke])}catch{Pe=be}const $e=Pe.split(/\n\s*\n/).filter(de=>de.trim()!=="");if($e.length<=1)return s.jsx(J1,{components:{a:({node:de,...ke})=>ke.href&&ke.href.startsWith("mention:")?s.jsx("span",{className:"text-blue-600 font-extrabold select-text hover:underline",title:"Mentioned peer",children:ke.children}):s.jsx("a",{...ke,className:"text-blue-650 hover:text-blue-800 font-bold underline transition-all font-sans break-all hover:scale-[1.01]",target:"_blank",rel:"noopener noreferrer"})},children:Pe});const ct=Math.ceil($e.length/2),yr=$e.slice(0,ct).join(` `),Lt=$e.slice(ct).join(` `),Lr=Ct.length>0?Ct[Xe%Ct.length]:null,ir=o.video||o.videoUrl,br=ir?(de=>{if(!de)return null;const ke=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/,Ze=de.match(ke);return Ze&&Ze[2].length===11?Ze[2]:null})(ir):null,ln=o.featuredImageUrl1||o.featuredImageUrl2;return s.jsxs("div",{className:"space-y-6",children:[s.jsx(J1,{components:{a:({node:de,...ke})=>ke.href&&ke.href.startsWith("mention:")?s.jsx("span",{className:"text-blue-600 font-extrabold select-text hover:underline",title:"Mentioned peer",children:ke.children}):s.jsx("a",{...ke,className:"text-blue-600 hover:text-blue-800 font-bold underline transition-all font-sans break-all",target:"_blank",rel:"noopener noreferrer"})},children:yr}),s.jsx("div",{className:"my-8 py-6 border-y border-gray-100 flex flex-col gap-6 bg-[#fcfcfc] -mx-4 px-4 sm:mx-0 sm:px-6 sm:rounded-2xl",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-[9px] font-black uppercase text-gray-400 tracking-[0.25em] text-center mb-1",children:"Campus Sponsor Announcement"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-6 items-center",children:[s.jsx("div",{className:Ge("col-span-1",ln?"md:col-span-6":"md:col-span-12"),children:Lr?s.jsx("div",{className:"shadow-md rounded-xl overflow-hidden border border-gray-150",children:s.jsx(Kw,{advert:Lr})}):s.jsxs("div",{className:"bg-gradient-to-br from-indigo-50/40 to-rose-50/40 border border-gray-150 rounded-xl p-6 text-center shadow-xs",children:[s.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-[#9B2C2C] mb-1",children:"Advertise on Campus Eye"}),s.jsx("p",{className:"text-xs text-gray-600 font-medium leading-relaxed mb-4",children:"Reach thousands of student readers daily with full-bleed interstitial slots."}),s.jsx("a",{href:"mailto:atwiinevictor2@gmail.com",className:"inline-flex items-center gap-1.5 bg-black hover:bg-gray-800 text-white font-black uppercase tracking-widest text-[9px] px-4 py-2 rounded shadow-sm transition-colors",children:"Book Sponsor Space"})]})}),(o.featuredImageUrl1||o.featuredImageUrl2)&&s.jsxs("div",{className:"col-span-1 md:col-span-6 flex flex-col gap-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.featuredImageUrl1&&s.jsx("div",{onClick:()=>{const de=Re.indexOf(o.featuredImageUrl1);se(de>=0?de:1),ae(!0)},className:"rounded-xl overflow-hidden border border-gray-150 aspect-square bg-gray-100 relative shadow-sm cursor-zoom-in group",children:s.jsx(Bi,{src:o.featuredImageUrl1,className:"w-full h-full object-cover group-hover:scale-102 transition-transform duration-300",alt:"Supporting Evidence 1"})}),o.featuredImageUrl2&&s.jsx("div",{onClick:()=>{const de=Re.indexOf(o.featuredImageUrl2);se(de>=0?de:2),ae(!0)},className:"rounded-xl overflow-hidden border border-gray-150 aspect-square bg-gray-100 relative shadow-sm cursor-zoom-in group",children:s.jsx(Bi,{src:o.featuredImageUrl2,className:"w-full h-full object-cover group-hover:scale-102 transition-transform duration-300",alt:"Supporting Evidence 2"})})]}),s.jsx("span",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider italic text-right block",children:"Distributed documentation assets"})]})]}),ir&&s.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-200/80 flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-[9.5px] font-black uppercase text-gray-700 tracking-wider",children:[s.jsx(Na,{size:13,className:"text-red-600"}),s.jsx("span",{children:"Article Video Frame"})]}),s.jsx("div",{className:"relative aspect-video w-full rounded-2xl overflow-hidden border border-gray-200 shadow-md bg-black",children:br?s.jsx("iframe",{src:`https://www.youtube-nocookie.com/embed/${br}?rel=0`,className:"w-full h-full border-0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:o.title||"Story Video"}):ir.includes("ke.href&&ke.href.startsWith("mention:")?s.jsx("span",{className:"text-blue-600 font-extrabold select-text hover:underline",title:"Mentioned peer",children:ke.children}):s.jsx("a",{...ke,className:"text-blue-650 hover:text-blue-800 font-bold underline transition-all font-sans break-all",target:"_blank",rel:"noopener noreferrer"})},children:Lt})]})})()}),s.jsxs("div",{className:"relative overflow-hidden w-full rounded-2xl sm:rounded-full bg-gradient-to-r from-blue-50/60 via-white/85 to-blue-50/50 dark:from-neutral-900/70 dark:via-neutral-800/70 dark:to-neutral-900/70 backdrop-blur-xl backdrop-saturate-150 border border-white/90 dark:border-white/10 shadow-[0_4px_24px_rgba(0,0,0,0.04),inset_0_1px_2px_rgba(255,255,255,0.9)] p-2 sm:p-2.5 my-4 select-none",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-white/70 via-transparent to-white/20 dark:from-white/10 pointer-events-none rounded-2xl sm:rounded-full"}),s.jsxs("div",{className:"relative z-10 flex flex-wrap items-center justify-between gap-2 px-1 text-gray-700 dark:text-gray-200",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:gap-2",children:[s.jsxs("button",{onClick:dr,className:Ge("flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 py-1.5 rounded-full transition-all duration-300 hover:scale-105 active:scale-95 cursor-pointer backdrop-blur-md shadow-2xs hover:shadow-xs",G?"bg-blue-600 text-white font-extrabold shadow-sm shadow-blue-500/25":"bg-white/75 hover:bg-white dark:bg-white/10 dark:hover:bg-white/20 text-gray-800 dark:text-gray-100 hover:text-blue-600 border border-white/80 dark:border-white/10"),title:"Solidarity support",children:[s.jsx("div",{className:"flex items-center justify-center transition-transform group-hover:scale-110 shrink-0",children:s.jsx(hq,{size:21,className:G?"fill-white text-white":""})}),s.jsxs("span",{className:"text-xs sm:text-[13px] font-black tracking-tight",children:[cl(o.likeCount||0)," Solidarity"]})]}),s.jsxs("button",{onClick:or,className:Ge("flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 py-1.5 rounded-full transition-all duration-300 hover:scale-105 active:scale-95 cursor-pointer backdrop-blur-md shadow-2xs hover:shadow-xs",Q?"bg-indigo-600 text-white font-extrabold shadow-sm shadow-indigo-500/25":"bg-white/75 hover:bg-white dark:bg-white/10 dark:hover:bg-white/20 text-gray-800 dark:text-gray-100 hover:text-indigo-600 border border-white/80 dark:border-white/10"),title:"Comments",children:[s.jsx("div",{className:"flex items-center justify-center transition-transform group-hover:scale-110 shrink-0",children:s.jsx(jC,{size:21,className:Q?"fill-white text-white":""})}),s.jsxs("span",{className:"text-xs sm:text-[13px] font-black tracking-tight",children:[cl(h.length)," Comments ",Q?"(Open)":""]})]}),s.jsxs("button",{onClick:yn,className:Ge("flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 py-1.5 rounded-full transition-all duration-300 hover:scale-105 active:scale-95 cursor-pointer backdrop-blur-md shadow-2xs hover:shadow-xs",q?"bg-amber-500 text-white font-extrabold shadow-sm shadow-amber-500/25":"bg-white/75 hover:bg-white dark:bg-white/10 dark:hover:bg-white/20 text-gray-800 dark:text-gray-100 hover:text-amber-500 border border-white/80 dark:border-white/10"),title:"Bookmark",children:[s.jsx("div",{className:"flex items-center justify-center transition-transform group-hover:scale-110 shrink-0",children:s.jsx(fq,{size:20,className:q?"fill-white text-white":""})}),s.jsxs("span",{className:"text-xs sm:text-[13px] font-black tracking-tight",children:[cl(o.saveCount||0)," Saved"]})]}),s.jsxs("div",{className:"relative inline-block",children:[s.jsxs("button",{onClick:()=>re(!me),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-white/75 hover:bg-white dark:bg-white/10 dark:hover:bg-white/20 text-gray-800 dark:text-gray-100 hover:text-rose-600 border border-white/80 dark:border-white/10 transition-all duration-300 hover:scale-105 active:scale-95 cursor-pointer shadow-2xs select-none",children:[s.jsx("span",{className:"text-sm shrink-0 leading-none",children:$||"😊"}),s.jsx("span",{className:"text-xs sm:text-[13px] font-black",children:$?"Reacted":"React"})]}),s.jsx(on,{children:me&&s.jsxs(Qt.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"absolute bottom-full mb-2 left-1/2 -translate-x-1/2 bg-white/95 backdrop-blur-2xl border border-white/90 p-3 shadow-2xl z-[150] rounded-2xl w-64 text-left space-y-2",onClick:be=>be.stopPropagation(),children:[s.jsx("div",{className:"text-[9px] font-black uppercase text-gray-400 tracking-wider",children:"Popular Reactions"}),s.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:DL.map(be=>s.jsx("button",{onClick:()=>{He(be),re(!1)},className:Ge("w-8 h-8 rounded-full flex items-center justify-center hover:scale-125 transition-transform text-base hover:bg-gray-100 cursor-pointer",$===be&&"bg-rose-50 border border-rose-200"),title:be,children:be},be))}),s.jsx("div",{className:"border-t border-gray-100 pt-2 flex items-center gap-1",children:s.jsx("input",{type:"text",maxLength:6,placeholder:"Or custom...",className:"w-full px-2.5 py-1 text-xs border border-gray-250 rounded-lg text-center focus:ring-0 focus:border-gray-400 bg-white",onChange:be=>{const Pe=be.target.value.trim();Pe&&(He(Pe),re(!1),be.target.value="")}})})]})})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 px-3 py-1.5 rounded-full bg-white/55 dark:bg-white/10 backdrop-blur-md border border-white/70 dark:border-white/10 shadow-2xs",title:"Views",children:[s.jsx("div",{className:"flex items-center justify-center shrink-0",children:s.jsx(IC,{size:21})}),s.jsxs("span",{className:"text-xs sm:text-[13px] font-black text-gray-800 dark:text-gray-100 tracking-tight",children:[cl(o.viewCount||0)," Views"]})]}),s.jsxs("button",{onClick:nr,className:"flex items-center gap-1.5 sm:gap-2 px-3 py-1.5 rounded-full transition-all duration-300 hover:scale-105 active:scale-95 cursor-pointer backdrop-blur-md bg-white/75 hover:bg-white dark:bg-white/10 dark:hover:bg-white/20 text-gray-800 dark:text-gray-100 hover:text-green-600 border border-white/80 dark:border-white/10 shadow-2xs hover:shadow-xs",title:"Share",children:[s.jsx("div",{className:"flex items-center justify-center transition-transform group-hover:scale-110 shrink-0",children:s.jsx(Uw,{size:21})}),s.jsxs("span",{className:"text-xs sm:text-[13px] font-black tracking-tight",children:[cl(o.shareCount||0)," Share"]})]})]})]})]}),s.jsxs("div",{id:"full-article-comments-section",className:Ge("space-y-4 my-6 p-4 sm:p-7 md:p-8 bg-[#0a0d12] text-white rounded-2xl sm:rounded-3xl border border-indigo-500/40 shadow-2xl relative z-30 transition-opacity duration-150 w-full ring-1 ring-indigo-500/20 max-w-full overflow-hidden",!Q&&"hidden"),children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 border-b border-gray-800/80 pb-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-6 bg-indigo-500 rounded-full"}),s.jsxs("h4",{className:"text-sm sm:text-base font-black text-gray-100 uppercase tracking-wider block text-left",children:["All Comments (",h.length,")"]})]}),s.jsx("div",{className:"flex items-center gap-1 bg-[#15181c] p-1 rounded-full border border-gray-800 self-start sm:self-auto",children:["newest","oldest","liked"].map(be=>s.jsx("button",{type:"button",onClick:()=>Dt(be),className:Ge("px-2.5 py-1 text-[9px] font-black uppercase tracking-wider rounded-full transition-all cursor-pointer select-none",It===be?"bg-indigo-600 text-white shadow-sm":"text-gray-400 hover:text-gray-200"),children:be==="liked"?"Most Liked":be},be))})]}),cr&&s.jsxs("div",{className:"flex items-center justify-between bg-[#15181c] border border-gray-800 rounded-xl px-4 py-2.5 mb-1.5 text-xs text-gray-300 animate-slide-down",children:[s.jsxs("div",{className:"flex items-center gap-2 truncate text-left",children:[s.jsx("span",{className:"text-indigo-400 font-extrabold uppercase text-[9px] tracking-wider shrink-0 bg-indigo-950/40 px-1.5 py-0.5 rounded border border-indigo-800/40",children:"Replying to"}),s.jsxs("span",{className:"font-extrabold text-blue-400 shrink-0",children:["@",cr.authorName]}),s.jsxs("span",{className:"text-gray-500 truncate italic",children:['"',cr.content,'"']})]}),s.jsx("button",{type:"button",onClick:()=>St(null),className:"text-gray-400 hover:text-white transition-colors p-1 cursor-pointer",title:"Cancel reply",children:s.jsx(Jr,{size:14})})]}),w&&s.jsxs("div",{className:"p-2 bg-gray-900 border border-gray-800 my-2 flex items-center justify-between rounded-xl",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("img",{src:w,alt:"Sticker attachment",className:"h-14 max-w-[100px] object-contain rounded-lg border border-gray-700 bg-black p-1 shadow-sm"}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-[10px] font-bold text-gray-200 uppercase tracking-wider",children:"Sticker Attached"}),s.jsx("span",{className:"text-[9px] text-gray-400",children:"Ready to post"})]})]}),s.jsx("button",{type:"button",onClick:()=>A(null),className:"p-1.5 text-red-400 hover:bg-red-950/40 rounded-full transition-colors",title:"Remove sticker",children:s.jsx(Es,{size:16})})]}),s.jsxs("form",{id:"comment-form",onSubmit:Rt,className:"flex flex-col gap-2 bg-[#15181c] border border-gray-800 rounded-2xl p-2.5 focus-within:border-indigo-500/50 transition-all",children:[s.jsx(sY,{value:m,onSelectMention:be=>y(be)}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",placeholder:cr?`Replying to @${cr.authorName}...`:"Let's talk about it or paste keyboard stickers...",value:m,onChange:be=>y(be.target.value),onPaste:V,className:"flex-1 bg-transparent text-white text-xs sm:text-sm outline-none focus:outline-none border-none py-1.5 px-2 placeholder-gray-500"}),s.jsx("button",{type:"submit",disabled:le||!m.trim()&&!w,className:"bg-indigo-600 hover:bg-indigo-700 disabled:opacity-40 text-white font-extrabold uppercase px-4 h-8 rounded-full text-[10px] tracking-wider transition-colors shrink-0 cursor-pointer",children:"Reply"})]}),s.jsxs("div",{className:"flex items-center justify-between pt-1 border-t border-gray-800/60 px-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("label",{htmlFor:"fullpage-sticker-upload",className:"flex items-center gap-1.5 px-2.5 py-1 bg-gray-900 border border-gray-700 rounded-full text-[10px] font-bold text-gray-300 hover:border-indigo-500 hover:text-white transition-all cursor-pointer",title:"Upload device sticker / photo",children:[s.jsx(Jne,{size:12,className:"text-indigo-400"}),s.jsx("span",{children:"Device Sticker"}),s.jsx("input",{id:"fullpage-sticker-upload",type:"file",accept:"image/*,video/*",onChange:U,className:"hidden"})]}),s.jsxs("button",{type:"button",onClick:()=>j(!S),className:"flex items-center gap-1.5 px-2.5 py-1 bg-gray-900 border border-gray-700 rounded-full text-[10px] font-bold text-gray-300 hover:border-indigo-500 hover:text-white transition-all cursor-pointer",children:[s.jsx(pF,{size:12,className:"text-amber-400"}),s.jsx("span",{children:"Stickers"})]})]}),s.jsx("span",{className:"text-[8px] text-gray-500 italic",children:"Keyboard stickers supported"})]}),S&&s.jsx("div",{className:"p-2 bg-gray-900 border border-gray-800 shadow-xl rounded-xl mt-1 flex flex-wrap gap-1.5 animate-in fade-in duration-150 z-20",children:["👍","🔥","❤️","🎯","💯","👏","🚀","⚡","😍","🙌","🤩","🎉","💡","📌","🎓","📣"].map(be=>s.jsx("button",{type:"button",onClick:()=>{y(Pe=>`${Pe} ${be}`.trim()),j(!1)},className:"w-8 h-8 text-base flex items-center justify-center hover:bg-gray-800 rounded-lg transition-transform hover:scale-125 cursor-pointer",children:be},be))})]}),s.jsx("div",{className:"space-y-4 pt-2",children:h.length>0?(()=>{const be=[...h].sort((Lt,Lr)=>{var br,ln,de,ke;const ir=(br=Lt.createdAt)!=null&&br.toDate?Lt.createdAt.toDate().getTime():((ln=Lt.createdAt)==null?void 0:ln.seconds)*1e3||0,pr=(de=Lr.createdAt)!=null&&de.toDate?Lr.createdAt.toDate().getTime():((ke=Lr.createdAt)==null?void 0:ke.seconds)*1e3||0;if(It==="oldest")return ir-pr;if(It==="liked"){const Ze=Lt.likeCount||0,Ft=Lr.likeCount||0;return Ft!==Ze?Ft-Ze:pr-ir}else return pr-ir}),Pe=be.filter(Lt=>!Lt.parentId),$e=be.filter(Lt=>Lt.parentId),ct=Lt=>({A:"bg-red-500",B:"bg-pink-500",C:"bg-purple-500",D:"bg-indigo-500",E:"bg-blue-500",F:"bg-cyan-500",G:"bg-teal-500",H:"bg-emerald-500",I:"bg-green-500",J:"bg-yellow-500",K:"bg-amber-500",L:"bg-orange-500",M:"bg-rose-500",N:"bg-red-650",O:"bg-indigo-600",P:"bg-purple-600",Q:"bg-pink-600",R:"bg-blue-600",S:"bg-violet-600",T:"bg-rose-600",U:"bg-teal-600",V:"bg-emerald-600",W:"bg-indigo-700",X:"bg-purple-700",Y:"bg-sky-500",Z:"bg-fuchsia-600"})[Lt]||"bg-slate-600",yr=(Lt,Lr=!1)=>{var ln;const ir=Ne.currentUser?localStorage.getItem(`liked_comment_${Lt.id}_${Ne.currentUser.uid}`)==="true":!1,pr=Lt.createdAt?(()=>{const de=Lt.createdAt.toDate?Lt.createdAt.toDate():new Date(Lt.createdAt.seconds*1e3),ke=Date.now()-de.getTime(),Ze=Math.floor(ke/(1e3*60*60));if(Ze===0){const Ft=Math.floor(ke/6e4);return Ft<=1?"just now":`${Ft}m ago`}else return Ze<24?`${Ze} hours ago`:de.toLocaleDateString(void 0,{month:"short",day:"numeric"})})():"Just now",br=Lt.authorName?Lt.authorName.charAt(0).toUpperCase():"?";return s.jsxs("div",{id:`comment-${Lt.id}`,className:Ge("flex gap-3 text-xs pt-1.5 transition-all",Lr?"pb-1":"pb-3"),children:[Lt.photoURL?s.jsx("img",{src:Lt.photoURL,className:"w-8 h-8 rounded-full object-cover border border-gray-800 shrink-0",alt:"",referrerPolicy:"no-referrer"}):s.jsx("div",{className:Ge("w-8 h-8 rounded-full flex items-center justify-center text-white font-extrabold text-[10px] uppercase shrink-0 shadow-md",ct(br)),children:br}),s.jsxs("div",{className:"flex-1 space-y-1 text-left min-w-0 pr-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"font-extrabold text-[#f3f4f6] text-[12px] tracking-tight",children:Lt.authorName}),(Lt.isAIGenerated||Lt.isAiGenerated||Lt.userId==="mega-ai-bot"||((ln=Lt.authorName)==null?void 0:ln.toLowerCase().includes("mega ai")))&&s.jsx(Bw,{})]}),Lt.replyToAuthor&&s.jsxs("span",{className:"text-[9px] text-[#9ca3af] font-bold uppercase mt-0.5",children:["Replying to ",s.jsxs("span",{className:"text-amber-500",children:["@",Lt.replyToAuthor]})]})]}),s.jsxs("button",{type:"button",onClick:()=>Wr(Lt.id),className:Ge("flex items-center gap-1.5 p-1 text-gray-400 hover:text-red-500 transition-all cursor-pointer",ir&&"text-red-500"),children:[s.jsx("span",{className:"text-[10px] text-gray-400",children:(Lt.likeCount||0)>0?cl(Lt.likeCount):""}),s.jsx(Fl,{size:12,className:Ge("transition-transform hover:scale-110",ir?"fill-red-500 text-red-500":"text-gray-400")})]})]}),s.jsx("p",{className:"text-[#e5e7eb] font-sans leading-relaxed text-[12px] whitespace-pre-line pr-2 break-words max-w-full overflow-hidden",children:L2(Lt.content)}),(Lt.stickerUrl||Lt.imageUrl)&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:Lt.stickerUrl||Lt.imageUrl,alt:"Comment sticker",className:"max-h-48 max-w-xs object-contain rounded-xl border border-gray-800 bg-black p-1 shadow-md hover:scale-105 transition-transform"})}),s.jsxs("div",{className:"flex items-center gap-3 pt-1 text-[9px] text-gray-500 font-bold select-none",children:[s.jsx("span",{children:pr}),s.jsx("button",{type:"button",onClick:()=>{var ke,Ze;St(Lt);const de=(ke=document.getElementById("comment-form"))==null?void 0:ke.querySelector("input");de&&de.focus(),(Ze=document.getElementById("comment-form"))==null||Ze.scrollIntoView({behavior:"smooth"})},className:"hover:text-amber-500 hover:scale-102 transition-all cursor-pointer bg-transparent border-0 text-[10px] font-black text-gray-400 uppercase tracking-widest block pl-0",children:"Reply"})]})]})]},Lt.id)};return Pe.map(Lt=>{const Lr=$e.filter(ir=>ir.parentId===Lt.id);return s.jsxs("div",{className:"border-b border-gray-900 last:border-0 pb-4",children:[yr(Lt,!1),Lr.length>0&&s.jsx("div",{className:"pl-8 border-l border-zinc-700/50 mt-1.5 space-y-2.5",children:Lr.map(ir=>yr(ir,!0))})]},Lt.id)})})():s.jsxs("div",{className:"text-center py-10 bg-[#15181c] border border-dashed border-gray-800 rounded-2xl",children:[s.jsx(jC,{size:24,className:"text-gray-600 mx-auto mb-2 opacity-50"}),s.jsx("p",{className:"text-[10.5px] text-gray-400 font-bold uppercase tracking-wider",children:"No verified commentary published. Start the conversation!"})]})})]}),s.jsx("div",{className:Ge("my-8 pt-8 border-t border-gray-100 transition-opacity duration-150",Q&&"opacity-90"),children:s.jsxs("div",{className:"flex flex-col gap-2 select-none text-left",children:[s.jsx("span",{className:"text-[9px] font-black tracking-[0.25em] text-gray-400 uppercase",children:"Strategic Partners & Sponsors"}),s.jsx("div",{className:"flex flex-wrap items-center gap-4 py-3",children:Pt.length>0?s.jsx("div",{className:"flex flex-wrap items-center gap-4 sm:gap-6",children:Pt.map(be=>s.jsxs("a",{href:be.link||be.targetUrl||"#",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 bg-gray-50 hover:bg-white px-3.5 py-2 rounded-2xl border border-gray-200/80 shadow-2xs hover:shadow-md hover:border-red-300 transition-all group",children:[be.imageUrl&&s.jsx("img",{src:be.imageUrl,className:"h-9 sm:h-10 object-contain max-h-9 sm:max-h-10 rounded-lg",alt:be.name,referrerPolicy:"no-referrer"}),s.jsx("span",{className:"text-xs sm:text-sm font-black uppercase tracking-wide text-gray-800 group-hover:text-red-650 transition-colors",children:be.name})]},be.id))}):s.jsxs("div",{className:"p-3 bg-gray-50 border border-gray-150 rounded-xl flex items-center justify-between gap-4 w-full",children:[s.jsx("span",{className:"text-[9.5px] font-mono text-gray-500 uppercase tracking-wider font-bold",children:"Partner with Campus Eye Media"}),s.jsx("span",{className:"text-[9px] font-black text-red-650 uppercase tracking-widest bg-white px-2.5 py-1 rounded border border-gray-200 shadow-2xs",children:"Get Featured"})]})})]})}),s.jsxs("div",{className:Ge("my-8 p-5 bg-gray-50/50 border border-gray-150 rounded-2xl text-left transition-opacity duration-150",Q&&"opacity-90"),children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("span",{className:"text-[10px] font-black text-red-650 bg-red-50 border border-red-100 px-2 py-0.5 rounded-md uppercase tracking-wide",children:"Event Booking Embed"}),s.jsx("span",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-widest",children:"Secure Reservation Desk"})]}),s.jsx("p",{className:"text-[10.5px] text-gray-500 mb-4 italic leading-relaxed",children:"Reading about this exclusive college event? You can secure your active box office entry pass directly below with our digital verification key protocol."}),s.jsx(iY,{})]}),s.jsxs("div",{className:Ge("py-6 border-b border-gray-100 text-center space-y-3.5 transition-opacity duration-150",Q&&"opacity-90"),children:[s.jsx("div",{className:"flex flex-wrap items-center justify-center gap-4 mb-3",children:s.jsxs("div",{className:"relative inline-block",children:[s.jsxs("button",{onClick:()=>re(!me),className:"flex items-center gap-2 px-5 py-2.5 bg-black hover:bg-neutral-800 text-white font-extrabold text-[10px] uppercase tracking-widest transition-all rounded-full shadow-lg cursor-pointer",children:[s.jsx("span",{children:$||"😊"}),s.jsx("span",{children:$?"Change Reaction":"React"})]}),s.jsx(on,{children:me&&s.jsxs(Qt.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"absolute bottom-12 left-1/2 -translate-x-1/2 bg-white border border-gray-150 p-3 shadow-2xl z-[150] rounded-3xl w-72 text-left space-y-2.5",onClick:be=>be.stopPropagation(),children:[s.jsx("div",{className:"text-[9px] font-black uppercase text-gray-400 tracking-wider mb-1",children:"Popular Reactions"}),s.jsx("div",{className:"grid grid-cols-6 gap-2",children:DL.map(be=>s.jsx("button",{onClick:()=>{He(be),re(!1)},className:Ge("w-8 h-8 rounded-full flex items-center justify-center hover:scale-125 transition-transform text-lg hover:bg-gray-50",$===be&&"bg-indigo-50 border border-indigo-200"),title:be,children:be},be))}),s.jsx("div",{className:"border-t border-gray-100 pt-2.5 flex items-center gap-1.5",children:s.jsx("input",{type:"text",maxLength:6,placeholder:"Or write yours...",className:"w-full px-2.5 py-1.5 text-xs border border-gray-200 rounded-xl text-center focus:ring-0 focus:border-gray-400 bg-white",onChange:be=>{const Pe=be.target.value.trim();Pe&&(He(Pe),re(!1),be.target.value="")}})})]})})]})}),s.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2 pt-2.5",children:Object.entries(Ot()).map(([be,Pe])=>{const $e=$===be;return s.jsxs("div",{onClick:()=>He(be),className:Ge("flex items-center gap-1 hover:scale-105 px-3 py-1.5 border rounded-full text-[12px] font-bold select-none cursor-pointer transition-all",$e?"bg-red-50 border-red-300 text-red-600 font-extrabold ring-1 ring-red-300/40":"bg-white border-gray-150 text-gray-600 hover:border-gray-300 hover:bg-gray-50/50"),children:[s.jsx("span",{className:"text-sm leading-none shrink-0",children:be}),s.jsx("span",{className:"font-mono text-[9px] font-black text-gray-500 bg-gray-100 px-1 rounded-sm leading-none shrink-0 min-w-[12px] text-center",children:Pe})]},be)})})]}),s.jsxs("div",{className:Ge("space-y-6 pt-2 pb-6 text-left transition-opacity duration-150",Q&&"opacity-90"),children:[(()=>{const be=["News","Sports","Music","Entertainment","Innovation","Culture","Business"].map(Pe=>{const $e=n==null?void 0:n.find(ct=>(ct.category||"").toLowerCase().trim()===Pe.toLowerCase().trim());return{cat:Pe,presentingArticle:$e}}).filter(Pe=>Pe.presentingArticle);return be.length===0?null:s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5 font-black text-gray-950 text-[10px] tracking-wider uppercase mb-3 select-none",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-650"}),s.jsx("span",{children:"Explore Categories"})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:be.map(({cat:Pe,presentingArticle:$e})=>s.jsxs("div",{onClick:()=>{if(i&&$e){i($e);const ct=document.getElementById("full-article-modal-container");ct&&ct.scrollTo({top:0,behavior:"smooth"})}},className:"group flex items-center gap-3 p-2 bg-gray-50/70 hover:bg-white border border-gray-150 hover:border-red-350 hover:shadow-xs transition-all rounded-xl cursor-pointer text-left",children:[s.jsx("div",{className:"w-11 h-11 rounded-lg overflow-hidden bg-gray-200 shrink-0 border border-gray-150",children:s.jsx("img",{src:$e.featuredImageUrl,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",alt:"",referrerPolicy:"no-referrer"})}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"bg-red-50 text-red-655 px-1.5 py-0.5 text-[8px] font-black uppercase tracking-widest border border-red-100/70 rounded-xs",children:Pe})}),s.jsx("h5",{className:"font-serif font-black text-[10.5px] text-gray-950 truncate group-hover:text-red-655 transition-colors underline decoration-gray-150",children:$e.title})]})]},Pe))})]})})(),n&&n.length>0&&s.jsxs("div",{className:"space-y-3 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 font-black text-gray-950 text-[10px] tracking-wider uppercase border-b border-gray-100 pb-2 select-none",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-650"}),s.jsx("span",{children:"Related Campus Stories"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:(()=>{const be=(e.category||"").toLowerCase().trim(),Pe=n.filter(ct=>ct.id!==e.id&&(ct.category||"").toLowerCase().trim()===be),$e=n.filter(ct=>ct.id!==e.id&&(ct.category||"").toLowerCase().trim()!==be);return[...Pe,...$e].slice(0,4)})().map(be=>s.jsxs("div",{onClick:()=>{if(i){i(be);const Pe=document.getElementById("full-article-modal-container");Pe&&Pe.scrollTo({top:0,behavior:"smooth"})}},className:"group flex gap-3 p-3 bg-gray-50/50 hover:bg-white border border-gray-100/70 hover:border-red-200 hover:shadow-md transition-all rounded-2xl cursor-pointer text-left focus:outline-hidden",children:[be.featuredImageUrl?s.jsx("img",{src:be.featuredImageUrl,alt:"",className:"w-16 h-16 rounded-xl object-cover border border-gray-100 shrink-0 select-none group-hover:scale-105 transition-transform",referrerPolicy:"no-referrer"}):s.jsx("div",{className:"w-16 h-16 rounded-xl bg-gray-100 flex items-center justify-center shrink-0 text-gray-400 select-none font-black text-xs uppercase tracking-widest border border-gray-100",children:"EYE"}),s.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-between py-0.5 font-sans",children:[s.jsx("span",{className:"text-[7.5px] font-black uppercase tracking-widest text-red-650",children:be.category||"General"}),s.jsx("h5",{className:"font-extrabold text-[11px] text-gray-950 group-hover:text-red-650 transition-colors tracking-tight leading-snug line-clamp-2",children:be.title}),s.jsx("span",{className:"text-[7.5px] font-mono text-gray-400 font-bold uppercase tracking-widest",children:"Read dispatch →"})]})]},be.id))})]})]})]}),s.jsx(eK,{isOpen:xe,imagesList:Re,initialIndex:Z,imageUrl:Re[Z]||"",title:o.title,onClose:()=>ae(!1)}),s.jsx(on,{children:qe&&s.jsxs("div",{className:"fixed inset-0 z-[2500] flex",children:[s.jsx(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>pt(!1),className:"fixed inset-0 bg-black/60 backdrop-blur-sm"}),s.jsxs(Qt.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",damping:25,stiffness:220},className:"relative w-80 max-w-[85vw] bg-white h-full shadow-2xl overflow-y-auto flex flex-col pt-5 px-6 border-r border-gray-150 z-[2600] text-left text-gray-900",children:[s.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-gray-100 mb-6",children:[s.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[s.jsx("img",{src:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",alt:"Campus Eye Logo",className:"h-7 w-7 rounded-full border border-gray-950 bg-white object-cover aspect-square shrink-0",referrerPolicy:"no-referrer"}),s.jsxs("div",{className:"flex flex-col justify-center text-left -space-y-1",children:[s.jsxs("span",{className:"text-[11px] font-serif font-black tracking-normal italic leading-none",children:[s.jsx("span",{className:"text-red-650",children:"Campus"})," ",s.jsx("span",{className:"text-blue-600",children:"Eye"})]}),s.jsx("span",{className:"text-[5.5px] font-sans font-extrabold uppercase tracking-[0.24em] text-black text-right pr-0.2 block select-none leading-none",children:"Media"})]})]}),s.jsx("button",{onClick:()=>pt(!1),className:"p-1.5 rounded-full hover:bg-gray-100 text-gray-400 hover:text-gray-950 transition-all cursor-pointer flex items-center justify-center shrink-0",children:s.jsx(Jr,{size:16})})]}),s.jsxs("div",{className:"flex-1 space-y-1.5 font-sans",children:[[{id:"home",label:"Home",icon:()=>s.jsx("svg",{className:"w-4 h-4 text-gray-500 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})})},{id:"news",label:"Campus News",icon:()=>s.jsx("svg",{className:"w-4 h-4 text-gray-500 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1M19 20a2 2 0 002-2V8a2 2 0 00-2-2h-5a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h1.5m-1.5 3h1.5m3-3H15m-1.5 3H15m-3.5 3H15"})})},{id:"discussions",label:"Public Debates",icon:()=>s.jsx("svg",{className:"w-4 h-4 text-gray-500 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})},{id:"tickets",label:"Ticket Store",icon:()=>s.jsx("svg",{className:"w-4 h-4 text-gray-500 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"})})},{id:"podcasts",label:"Audio Podcasts",icon:()=>s.jsx("svg",{className:"w-4 h-4 text-gray-500 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"})})},{id:"feedback",label:"Feedback Desk",icon:()=>s.jsx("svg",{className:"w-4 h-4 text-gray-500 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})},{id:"account",label:"My Account",icon:()=>s.jsx("svg",{className:"w-4 h-4 text-gray-500 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}].map(be=>s.jsxs("button",{onClick:()=>{pt(!1),t(),window.dispatchEvent(new CustomEvent("setTab",{detail:be.id}))},className:"flex items-center gap-3 w-full px-4 py-2.5 rounded-xl transition-all font-bold text-xs uppercase tracking-wider text-left text-gray-700 hover:bg-gray-50 hover:text-black cursor-pointer",children:[s.jsx(be.icon,{}),s.jsx("span",{children:be.label})]},be.id)),Fe&&Fe.length>0&&Fe.map(be=>s.jsxs("button",{onClick:()=>{pt(!1),t(),window.dispatchEvent(new CustomEvent("selectCustomPage",{detail:be}))},className:"flex items-center gap-3 w-full px-4 py-2.5 rounded-xl transition-all font-bold text-xs uppercase tracking-wider text-left text-gray-700 hover:bg-gray-50 hover:text-black cursor-pointer",children:[s.jsx("svg",{className:"w-4 h-4 text-gray-500 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),s.jsx("span",{className:"truncate",children:be.name})]},be.id))]})]})]})}),T&&s.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-md z-[200] flex items-end sm:items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200",onClick:be=>{be.stopPropagation(),D(!1)},children:s.jsxs("div",{className:"bg-white/95 dark:bg-neutral-900/95 backdrop-blur-2xl border border-gray-200/80 dark:border-white/10 rounded-3xl p-5 sm:p-6 w-full max-w-sm shadow-2xl space-y-4 text-center relative animate-in slide-in-from-bottom-5 duration-200",onClick:be=>be.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 dark:border-neutral-800 pb-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-left",children:[s.jsx("div",{className:"p-2 bg-red-50 text-red-650 rounded-full",children:s.jsx(Ld,{size:16})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-bold text-gray-900 dark:text-white",children:"Share Article"}),s.jsx("p",{className:"text-[10px] text-gray-500 lowercase tracking-tight",children:"Choose your preferred social platform"})]})]}),s.jsx("button",{onClick:()=>D(!1),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-full transition-all cursor-pointer",children:s.jsx(Jr,{size:18})})]}),s.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-neutral-800/60 rounded-2xl border border-gray-100 dark:border-neutral-700/50 text-left space-y-1",children:[s.jsx("p",{className:"text-[11px] font-extrabold text-gray-900 dark:text-white line-clamp-1",children:e.title}),s.jsx("p",{className:"text-[9px] text-gray-500 font-mono truncate",children:`${window.location.origin}/article/${e.id}`})]}),s.jsxs("div",{className:"grid grid-cols-4 gap-2 pt-1",children:[s.jsxs("a",{href:`https://api.whatsapp.com/send?text=${encodeURIComponent(e.title+` Read more: ${window.location.origin}/article/${e.id}`)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>D(!1),className:"flex flex-col items-center gap-1.5 p-2.5 bg-emerald-50 text-emerald-700 rounded-2xl hover:bg-emerald-100 transition-all active:scale-95 cursor-pointer",children:[s.jsx("span",{className:"text-xl",children:"💬"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"WhatsApp"})]}),s.jsxs("a",{href:`https://twitter.com/intent/tweet?text=${encodeURIComponent(e.title)}&url=${encodeURIComponent(`${window.location.origin}/article/${e.id}`)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>D(!1),className:"flex flex-col items-center gap-1.5 p-2.5 bg-sky-50 text-sky-700 rounded-2xl hover:bg-sky-100 transition-all active:scale-95 cursor-pointer",children:[s.jsx("span",{className:"text-xl",children:"🐦"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"Twitter/X"})]}),s.jsxs("a",{href:`https://t.me/share/url?url=${encodeURIComponent(`${window.location.origin}/article/${e.id}`)}&text=${encodeURIComponent(e.title)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>D(!1),className:"flex flex-col items-center gap-1.5 p-2.5 bg-blue-50 text-blue-700 rounded-2xl hover:bg-blue-100 transition-all active:scale-95 cursor-pointer",children:[s.jsx("span",{className:"text-xl",children:"✈️"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"Telegram"})]}),s.jsxs("a",{href:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${window.location.origin}/article/${e.id}`)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>D(!1),className:"flex flex-col items-center gap-1.5 p-2.5 bg-indigo-50 text-indigo-700 rounded-2xl hover:bg-indigo-100 transition-all active:scale-95 cursor-pointer",children:[s.jsx("span",{className:"text-xl",children:"📘"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"Facebook"})]})]}),s.jsx("div",{className:"pt-2",children:s.jsx("button",{onClick:async()=>{const be=`${window.location.origin}/article/${e.id}`;await Od(`${e.title} ${be}`),nn.success("Link copied to clipboard!"),D(!1)},className:"w-full py-3 bg-red-650 hover:bg-red-700 text-white font-bold text-xs uppercase tracking-widest rounded-2xl transition-all shadow-md active:scale-98 flex items-center justify-center gap-2 cursor-pointer",children:s.jsx("span",{children:"Copy Direct Link"})})})]})})]})},lY="campus_expansion_dbs",cY="campus_active_write_db_slot",yj="campus_custom_auth_domain";function H2e(){try{const e=localStorage.getItem(lY);return e?JSON.parse(e):[]}catch(e){return console.warn("Failed to load expansion slots:",e),[]}}function ML(e){try{localStorage.setItem(lY,JSON.stringify(e))}catch(t){console.error("Failed to save expansion slots:",t)}}function G2e(){return localStorage.getItem(cY)||"default"}function LL(e){localStorage.setItem(cY,e)}function q2e(){return localStorage.getItem(yj)||P2.authDomain}function W2e(e){e.trim()?localStorage.setItem(yj,e.trim()):localStorage.removeItem(yj)}function K2e(e){const t=e.trim();if(!t)throw new Error("Empty Firebase config input provided.");try{const a=JSON.parse(t);if(typeof a=="object"&&a!==null)return{apiKey:a.apiKey||"",authDomain:a.authDomain||"",projectId:a.projectId||"",storageBucket:a.storageBucket||"",messagingSenderId:a.messagingSenderId||"",appId:a.appId||"",measurementId:a.measurementId||"",firestoreDatabaseId:a.firestoreDatabaseId||"(default)"}}catch{}const r=["apiKey","authDomain","projectId","storageBucket","messagingSenderId","appId","measurementId","firestoreDatabaseId"],n={apiKey:"",authDomain:"",projectId:"",storageBucket:"",messagingSenderId:"",appId:"",measurementId:"",firestoreDatabaseId:"(default)"};let i=0;for(const a of r){const o=new RegExp(`${a}\\s*:\\s*["'\`]([^"'\`]+)["'\`]`,"i"),c=t.match(o);c&&c[1]&&(n[a]=c[1].trim(),i++)}if(i===0||!n.apiKey)throw new Error("Could not detect valid Firebase config fields (apiKey, projectId, etc.). Please check the pasted snippet.");return n}function Y2e(e,t="https://campuseyemedia.com"){const r=t.replace(/\/$/,""),n=new Date().toISOString(),i=e.map(a=>{var f,m,y;const o=a.id,c=(f=a.updatedAt)!=null&&f.toDate?a.updatedAt.toDate().toISOString():(m=a.publishDate)!=null&&m.toDate?a.publishDate.toDate().toISOString():(y=a.createdAt)!=null&&y.toDate?a.createdAt.toDate().toISOString():n,h=a.featuredImageUrl||"";return` ${r}/#article-${o} ${c} daily 0.8 ${h?` ${UL(h)} ${UL(a.title)} `:""} `}).join(` `);return` ${r}/ ${n} always 1.0 ${i} `}function UL(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}var X2e=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function T4(e){if(typeof e!="string")return!1;var t=X2e;return t.includes(e)}var Q2e=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],Z2e=new Set(Q2e);function uY(e){return typeof e!="string"?!1:Z2e.has(e)}function dY(e){return typeof e=="string"&&e.startsWith("data-")}function Wl(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(uY(r)||dY(r))&&(t[r]=e[r]);return t}function cb(e){if(e==null)return null;if(I.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return Wl(t)}return typeof e=="object"&&!Array.isArray(e)?Wl(e):null}function jo(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(uY(r)||dY(r)||T4(r))&&(t[r]=e[r]);return t}function J2e(e){return e==null?null:I.isValidElement(e)?jo(e.props):typeof e=="object"&&!Array.isArray(e)?jo(e):null}var eNe=["children","width","height","viewBox","className","style","title","desc"];function bj(){return bj=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,width:n,height:i,viewBox:a,className:o,style:c,title:h,desc:f}=e,m=tNe(e,eNe),y=a||{width:n,height:i,x:0,y:0},w=Mi("recharts-surface",o);return I.createElement("svg",bj({},jo(m),{className:w,width:n,height:i,style:c,viewBox:"".concat(y.x," ").concat(y.y," ").concat(y.width," ").concat(y.height),ref:t}),I.createElement("title",null,h),I.createElement("desc",null,f),r)}),nNe=["children","className"];function vj(){return vj=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,className:n}=e,i=iNe(e,nNe),a=Mi("recharts-layer",n);return I.createElement("g",vj({className:a},jo(i),{ref:t}),r)}),hY=I.createContext(null),aNe=()=>I.useContext(hY);function ss(e){return function(){return e}}const fY=Math.cos,Z2=Math.sin,Qc=Math.sqrt,J2=Math.PI,qE=2*J2,wj=Math.PI,Nj=2*wj,up=1e-6,oNe=Nj-up;function pY(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return pY;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iup)if(!(Math.abs(y*h-f*m)>up)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let A=n-o,S=i-c,j=h*h+f*f,T=A*A+S*S,D=Math.sqrt(j),V=Math.sqrt(w),U=a*Math.tan((wj-Math.acos((j+w-T)/(2*D*V)))/2),G=U/V,X=U/D;Math.abs(G-1)>up&&this._append`L${t+G*m},${r+G*y}`,this._append`A${a},${a},0,0,${+(y*A>m*S)},${this._x1=t+X*h},${this._y1=r+X*f}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let c=n*Math.cos(i),h=n*Math.sin(i),f=t+c,m=r+h,y=1^o,w=o?i-a:a-i;this._x1===null?this._append`M${f},${m}`:(Math.abs(this._x1-f)>up||Math.abs(this._y1-m)>up)&&this._append`L${f},${m}`,n&&(w<0&&(w=w%Nj+Nj),w>oNe?this._append`A${n},${n},0,1,${y},${t-c},${r-h}A${n},${n},0,1,${y},${this._x1=f},${this._y1=m}`:w>up&&this._append`A${n},${n},0,${+(w>=wj)},${y},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function O4(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new cNe(t)}function R4(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function mY(e){this._context=e}mY.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function WE(e){return new mY(e)}function gY(e){return e[0]}function xY(e){return e[1]}function yY(e,t){var r=ss(!0),n=null,i=WE,a=null,o=O4(c);e=typeof e=="function"?e:e===void 0?gY:ss(e),t=typeof t=="function"?t:t===void 0?xY:ss(t);function c(h){var f,m=(h=R4(h)).length,y,w=!1,A;for(n==null&&(a=i(A=o())),f=0;f<=m;++f)!(f=A;--S)c.point(U[S],G[S]);c.lineEnd(),c.areaEnd()}D&&(U[w]=+e(T,w,y),G[w]=+t(T,w,y),c.point(n?+n(T,w,y):U[w],r?+r(T,w,y):G[w]))}if(V)return c=null,V+""||null}function m(){return yY().defined(i).curve(o).context(a)}return f.x=function(y){return arguments.length?(e=typeof y=="function"?y:ss(+y),n=null,f):e},f.x0=function(y){return arguments.length?(e=typeof y=="function"?y:ss(+y),f):e},f.x1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:ss(+y),f):n},f.y=function(y){return arguments.length?(t=typeof y=="function"?y:ss(+y),r=null,f):t},f.y0=function(y){return arguments.length?(t=typeof y=="function"?y:ss(+y),f):t},f.y1=function(y){return arguments.length?(r=y==null?null:typeof y=="function"?y:ss(+y),f):r},f.lineX0=f.lineY0=function(){return m().x(e).y(t)},f.lineY1=function(){return m().x(e).y(r)},f.lineX1=function(){return m().x(n).y(t)},f.defined=function(y){return arguments.length?(i=typeof y=="function"?y:ss(!!y),f):i},f.curve=function(y){return arguments.length?(o=y,a!=null&&(c=o(a)),f):o},f.context=function(y){return arguments.length?(y==null?a=c=null:c=o(a=y),f):a},f}class bY{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function uNe(e){return new bY(e,!0)}function dNe(e){return new bY(e,!1)}const D4={draw(e,t){const r=Qc(t/J2);e.moveTo(r,0),e.arc(0,0,r,0,qE)}},hNe={draw(e,t){const r=Qc(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},vY=Qc(1/3),fNe=vY*2,pNe={draw(e,t){const r=Qc(t/fNe),n=r*vY;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},mNe={draw(e,t){const r=Qc(t),n=-r/2;e.rect(n,n,r,r)}},gNe=.8908130915292852,wY=Z2(J2/10)/Z2(7*J2/10),xNe=Z2(qE/10)*wY,yNe=-fY(qE/10)*wY,bNe={draw(e,t){const r=Qc(t*gNe),n=xNe*r,i=yNe*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=qE*a/5,c=fY(o),h=Z2(o);e.lineTo(h*r,-c*r),e.lineTo(c*n-h*i,h*n+c*i)}e.closePath()}},Jk=Qc(3),vNe={draw(e,t){const r=-Qc(t/(Jk*3));e.moveTo(0,r*2),e.lineTo(-Jk*r,-r),e.lineTo(Jk*r,-r),e.closePath()}},cc=-.5,uc=Qc(3)/2,Ej=1/Qc(12),wNe=(Ej/2+1)*3,NNe={draw(e,t){const r=Qc(t/wNe),n=r/2,i=r*Ej,a=n,o=r*Ej+r,c=-a,h=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(c,h),e.lineTo(cc*n-uc*i,uc*n+cc*i),e.lineTo(cc*a-uc*o,uc*a+cc*o),e.lineTo(cc*c-uc*h,uc*c+cc*h),e.lineTo(cc*n+uc*i,cc*i-uc*n),e.lineTo(cc*a+uc*o,cc*o-uc*a),e.lineTo(cc*c+uc*h,cc*h-uc*c),e.closePath()}};function ENe(e,t){let r=null,n=O4(i);e=typeof e=="function"?e:ss(e||D4),t=typeof t=="function"?t:ss(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:ss(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:ss(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function eN(){}function tN(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function NY(e){this._context=e}NY.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:tN(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:tN(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ANe(e){return new NY(e)}function EY(e){this._context=e}EY.prototype={areaStart:eN,areaEnd:eN,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:tN(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function kNe(e){return new EY(e)}function AY(e){this._context=e}AY.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:tN(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function _Ne(e){return new AY(e)}function kY(e){this._context=e}kY.prototype={areaStart:eN,areaEnd:eN,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function SNe(e){return new kY(e)}function BL(e){return e<0?-1:1}function zL(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),c=(a*i+o*n)/(n+i);return(BL(a)+BL(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(c))||0}function VL(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function e_(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,c=(a-n)/3;e._context.bezierCurveTo(n+c,i+c*t,a-c,o-c*r,a,o)}function rN(e){this._context=e}rN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:e_(this,this._t0,VL(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,e_(this,VL(this,r=zL(this,e,t)),r);break;default:e_(this,this._t0,r=zL(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function _Y(e){this._context=new SY(e)}(_Y.prototype=Object.create(rN.prototype)).point=function(e,t){rN.prototype.point.call(this,t,e)};function SY(e){this._context=e}SY.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function CNe(e){return new rN(e)}function jNe(e){return new _Y(e)}function CY(e){this._context=e}CY.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=FL(e),i=FL(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function TNe(e){return new KE(e,.5)}function PNe(e){return new KE(e,0)}function ONe(e){return new KE(e,1)}function om(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,c=a.length;r=0;)r[t]=t;return r}function RNe(e,t){return e[t]}function DNe(e){const t=[];return t.key=e,t}function MNe(){var e=ss([]),t=Aj,r=om,n=RNe;function i(a){var o=Array.from(e.apply(this,arguments),DNe),c,h=o.length,f=-1,m;for(const y of a)for(c=0,++f;c0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n1&&arguments[1]!==void 0?arguments[1]:HNe,r=10**t,n=Math.round(e*r)/r;return Object.is(n,-0)?0:n}function Hs(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n{var c=r[o-1];return typeof c=="string"?i+c+a:c!==void 0?i+of(c)+a:i+a},"")}var fl=e=>e===0?0:e>0?1:-1,Kc=e=>typeof e=="number"&&e!=+e,lm=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,wr=e=>(typeof e=="number"||e instanceof Number)&&!Kc(e),Gu=e=>wr(e)||typeof e=="string",GNe=0,Ey=e=>{var t=++GNe;return"".concat(e||"").concat(t)},Yc=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!wr(t)&&typeof t!="string")return n;var a;if(lm(t)){if(r==null)return n;var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return Kc(a)&&(a=n),i&&r!=null&&a>r&&(a=r),a},IY=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;nn&&(typeof t=="function"?t(n):Sg(n,t))===r)}var xs=e=>e===null||typeof e>"u",ub=e=>xs(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function pl(e){return e!=null}function Df(){}var qNe=["type","size","sizeType"];function kj(){return kj=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(ub(e));return PY[t]||D4},eEe=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*ZNe;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},tEe=(e,t)=>{PY["symbol".concat(ub(e))]=t},B4=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=XNe(e,qNe),a=QL(QL({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var c=()=>{var w=JNe(o),A=ENe().type(w).size(eEe(r,n,o)),S=A();if(S!==null)return S},{className:h,cx:f,cy:m}=a,y=jo(a);return wr(f)&&wr(m)&&wr(r)?I.createElement("path",kj({},y,{className:Mi("recharts-symbols",h),transform:"translate(".concat(f,", ").concat(m,")"),d:c()})):null};B4.registerSymbol=tEe;var OY=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,z4=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(I.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{T4(i)&&typeof r[i]=="function"&&(n[i]=(a=>r[i](r,a)))}),n},rEe=(e,t,r)=>n=>(e(t,r,n),null),YE=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var a=e[i];T4(i)&&typeof a=="function"&&(n||(n={}),n[i]=rEe(a,t,r))}),n};function ZL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function nEe(e){for(var t=1;t(o[c]===void 0&&n[c]!==void 0&&(o[c]=n[c]),o),r);return a}function nN(){return nN=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var A=y.formatter||i,S=Mi({"recharts-legend-item":!0,["legend-item-".concat(w)]:!0,inactive:y.inactive});if(y.type==="none")return null;var j=typeof c=="object"?RY({},c):{};j.color=y.inactive?a:j.color||y.color;var T=A?A(y.value,y,w):y.value;return I.createElement("li",nN({className:S,style:f,key:"legend-item-".concat(w)},YE(e,y,w)),I.createElement(P4,{width:r,height:r,viewBox:h,style:m,"aria-label":"".concat(y.value," legend icon")},I.createElement(hEe,{data:y,iconType:o,inactiveColor:a})),I.createElement("span",{className:"recharts-legend-item-text",style:j},T))})}var pEe=e=>{var t=Va(e,uEe),{payload:r,layout:n,align:i}=t;if(!r||!r.length)return null;var a={padding:0,margin:0,textAlign:n==="horizontal"?i:"left"};return I.createElement("ul",{className:"recharts-default-legend",style:a},I.createElement(fEe,nN({},t,{payload:r})))},l_={},c_={},e7;function mEe(){return e7||(e7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){const i=new Map;for(let a=0;a=0}e.isLength=t})(p_)),p_}var i7;function MY(){return i7||(i7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=xEe();function r(n){return n!=null&&typeof n!="function"&&t.isLength(n.length)}e.isArrayLike=r})(f_)),f_}var m_={},s7;function yEe(){return s7||(s7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="object"&&r!==null}e.isObjectLike=t})(m_)),m_}var a7;function bEe(){return a7||(a7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=MY(),r=yEe();function n(i){return r.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=n})(h_)),h_}var g_={},x_={},o7;function vEe(){return o7||(o7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=U4();function r(n){return function(i){return t.get(i,n)}}e.property=r})(x_)),x_}var y_={},b_={},v_={},w_={},l7;function LY(){return l7||(l7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r!==null&&(typeof r=="object"||typeof r=="function")}e.isObject=t})(w_)),w_}var N_={},c7;function UY(){return c7||(c7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null||typeof r!="object"&&typeof r!="function"}e.isPrimitive=t})(N_)),N_}var E_={},u7;function BY(){return u7||(u7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return r===n||Number.isNaN(r)&&Number.isNaN(n)}e.isEqualsSameValueZero=t})(E_)),E_}var d7;function wEe(){return d7||(d7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=LY(),r=UY(),n=BY();function i(m,y,w){return typeof w!="function"?i(m,y,()=>{}):a(m,y,function A(S,j,T,D,V,U){const G=w(S,j,T,D,V,U);return G!==void 0?!!G:a(S,j,A,U)},new Map)}function a(m,y,w,A){if(y===m)return!0;switch(typeof y){case"object":return o(m,y,w,A);case"function":return Object.keys(y).length>0?a(m,{...y},w,A):n.isEqualsSameValueZero(m,y);default:return t.isObject(m)?typeof y=="string"?y==="":!0:n.isEqualsSameValueZero(m,y)}}function o(m,y,w,A){if(y==null)return!0;if(Array.isArray(y))return h(m,y,w,A);if(y instanceof Map)return c(m,y,w,A);if(y instanceof Set)return f(m,y,w,A);const S=Object.keys(y);if(m==null||r.isPrimitive(m))return S.length===0;if(S.length===0)return!0;if(A!=null&&A.has(y))return A.get(y)===m;A==null||A.set(y,m);try{for(let j=0;j{})}e.isMatch=r})(b_)),b_}var A_={},k_={},__={},f7;function NEe(){return f7||(f7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Object.getOwnPropertySymbols(r).filter(n=>Object.prototype.propertyIsEnumerable.call(r,n))}e.getSymbols=t})(__)),__}var S_={},p7;function V4(){return p7||(p7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}e.getTag=t})(S_)),S_}var C_={},m7;function VY(){return m7||(m7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",r="[object String]",n="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",c="[object Date]",h="[object Map]",f="[object Set]",m="[object Array]",y="[object Function]",w="[object ArrayBuffer]",A="[object Object]",S="[object Error]",j="[object DataView]",T="[object Uint8Array]",D="[object Uint8ClampedArray]",V="[object Uint16Array]",U="[object Uint32Array]",G="[object BigUint64Array]",X="[object Int8Array]",q="[object Int16Array]",B="[object Int32Array]",z="[object BigInt64Array]",F="[object Float32Array]",$="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=w,e.arrayTag=m,e.bigInt64ArrayTag=z,e.bigUint64ArrayTag=G,e.booleanTag=i,e.dataViewTag=j,e.dateTag=c,e.errorTag=S,e.float32ArrayTag=F,e.float64ArrayTag=$,e.functionTag=y,e.int16ArrayTag=q,e.int32ArrayTag=B,e.int8ArrayTag=X,e.mapTag=h,e.numberTag=n,e.objectTag=A,e.regexpTag=t,e.setTag=f,e.stringTag=r,e.symbolTag=o,e.uint16ArrayTag=V,e.uint32ArrayTag=U,e.uint8ArrayTag=T,e.uint8ClampedArrayTag=D})(C_)),C_}var j_={},g7;function EEe(){return g7||(g7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}e.isTypedArray=t})(j_)),j_}var x7;function FY(){return x7||(x7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=NEe(),r=V4(),n=VY(),i=UY(),a=EEe();function o(m,y){return c(m,void 0,m,new Map,y)}function c(m,y,w,A=new Map,S=void 0){const j=S==null?void 0:S(m,y,w,A);if(j!==void 0)return j;if(i.isPrimitive(m))return m;if(A.has(m))return A.get(m);if(Array.isArray(m)){const T=new Array(m.length);A.set(m,T);for(let D=0;Dt.isMatch(a,i)}e.matches=n})(y_)),y_}var I_={},T_={},P_={},v7;function _Ee(){return v7||(v7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=FY(),r=V4(),n=VY();function i(a,o){return t.cloneDeepWith(a,(c,h,f,m)=>{const y=o==null?void 0:o(c,h,f,m);if(y!==void 0)return y;if(typeof a=="object"){if(r.getTag(a)===n.objectTag&&typeof a.constructor!="function"){const w={};return m.set(a,w),t.copyProperties(w,a,f,m),w}switch(Object.prototype.toString.call(a)){case n.numberTag:case n.stringTag:case n.booleanTag:{const w=new a.constructor(a==null?void 0:a.valueOf());return t.copyProperties(w,a),w}case n.argumentsTag:{const w={};return t.copyProperties(w,a),w.length=a.length,w[Symbol.iterator]=a[Symbol.iterator],w}default:return}}})}e.cloneDeepWith=i})(P_)),P_}var w7;function SEe(){return w7||(w7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_Ee();function r(n){return t.cloneDeepWith(n)}e.cloneDeep=r})(T_)),T_}var O_={},R_={},N7;function $Y(){return N7||(N7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function r(n,i=Number.MAX_SAFE_INTEGER){switch(typeof n){case"number":return Number.isInteger(n)&&n>=0&&n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return z_.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,z_}var T7;function MEe(){return T7||(T7=1,B_.exports=DEe()),B_.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var P7;function LEe(){if(P7)return U_;P7=1;var e=Mg(),t=MEe();function r(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,a=e.useRef,o=e.useEffect,c=e.useMemo,h=e.useDebugValue;return U_.useSyncExternalStoreWithSelector=function(f,m,y,w,A){var S=a(null);if(S.current===null){var j={hasValue:!1,value:null};S.current=j}else j=S.current;S=c(function(){function D(q){if(!V){if(V=!0,U=q,q=w(q),A!==void 0&&j.hasValue){var B=j.value;if(A(B,q))return G=B}return G=q}if(B=G,n(U,q))return B;var z=w(q);return A!==void 0&&A(B,z)?(U=q,B):(U=q,G=z)}var V=!1,U,G,X=y===void 0?null:y;return[function(){return D(m())},X===null?void 0:function(){return D(X())}]},[m,y,w,A]);var T=i(f,S[0],S[1]);return o(function(){j.hasValue=!0,j.value=T},[T]),h(T),T},U_}var O7;function UEe(){return O7||(O7=1,L_.exports=LEe()),L_.exports}var BEe=UEe(),F4=I.createContext(null),zEe=e=>e,ys=()=>{var e=I.useContext(F4);return e?e.store.dispatch:zEe},Xw=()=>{},VEe=()=>Xw,FEe=(e,t)=>e===t;function Xr(e){var t=I.useContext(F4),r=I.useMemo(()=>t?n=>{if(n!=null)return e(n)}:Xw,[t,e]);return BEe.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:VEe,t?t.store.getState:Xw,t?t.store.getState:Xw,r,FEe)}function $Ee(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function HEe(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function GEe(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var R7=e=>Array.isArray(e)?e:[e];function qEe(e){const t=Array.isArray(e[0])?e[0]:e;return GEe(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function WEe(e,t){const r=[],{length:n}=e;for(let i=0;i{r=ew(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function QEe(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let a=0,o=0,c,h={},f=i.pop();typeof f=="object"&&(h=f,f=i.pop()),$Ee(f,`createSelector expects an output function after the inputs, but received: [${typeof f}]`);const m={...r,...h},{memoize:y,memoizeOptions:w=[],argsMemoize:A=GY,argsMemoizeOptions:S=[]}=m,j=R7(w),T=R7(S),D=qEe(i),V=y(function(){return a++,f.apply(null,arguments)},...j),U=A(function(){o++;const X=WEe(D,arguments);return c=V.apply(null,X),c},...T);return Object.assign(U,{resultFunc:f,memoizedResultFunc:V,dependencies:D,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>c,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:y,argsMemoize:A})};return Object.assign(n,{withTypes:()=>n}),n}var et=QEe(GY),ZEe=Object.assign((e,t=et)=>{HEe(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((o,c,h)=>(o[r[h]]=c,o),{}))},{withTypes:()=>ZEe}),V_={},F_={},$_={},M7;function JEe(){return M7||(M7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"?1:n===null?2:n===void 0?3:n!==n?4:0}const r=(n,i,a)=>{if(n!==i){const o=t(n),c=t(i);if(o===c&&o===0){if(ni)return a==="desc"?-1:1}return a==="desc"?c-o:o-c}return 0};e.compareValues=r})($_)),$_}var H_={},G_={},L7;function qY(){return L7||(L7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"||r instanceof Symbol}e.isSymbol=t})(G_)),G_}var U7;function eAe(){return U7||(U7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=qY(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(n.test(a)||!r.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(H_)),H_}var B7;function tAe(){return B7||(B7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=JEe(),r=eAe(),n=L4();function i(a,o,c,h){if(a==null)return[];c=h?void 0:c,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(c)||(c=c==null?[]:[c]),c=c.map(A=>String(A));const f=(A,S)=>{let j=A;for(let T=0;TS==null||A==null?S:typeof A=="object"&&"key"in A?Object.hasOwn(S,A.key)?S[A.key]:f(S,A.path):typeof A=="function"?A(S):Array.isArray(A)?f(S,A):typeof S=="object"?S[A]:S,y=o.map(A=>(Array.isArray(A)&&A.length===1&&(A=A[0]),A==null||typeof A=="function"||Array.isArray(A)||r.isKey(A)?A:{key:A,path:n.toPath(A)}));return a.map(A=>({original:A,criteria:y.map(S=>m(S,A))})).slice().sort((A,S)=>{for(let j=0;jA.original)}e.orderBy=i})(F_)),F_}var q_={},z7;function rAe(){return z7||(z7=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n=1){const i=[],a=Math.floor(n),o=(c,h)=>{for(let f=0;f1&&n.isIterateeCall(a,o[0],o[1])?o=[]:c>2&&n.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,r.flatten(o),["asc"])}e.sortBy=i})(V_)),V_}var K_,$7;function iAe(){return $7||($7=1,K_=nAe().sortBy),K_}var sAe=iAe();const XE=Qu(sAe);var KY=e=>e.legend.settings,aAe=e=>e.legend.size,oAe=e=>e.legend.payload,lAe=et([oAe,KY],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?XE(n,r):n});function cAe(){return Xr(lAe)}var tw=1;function YY(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=I.useState({height:0,left:0,top:0,width:0}),n=I.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>tw||Math.abs(o.left-t.left)>tw||Math.abs(o.top-t.top)>tw||Math.abs(o.width-t.width)>tw)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function ro(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var uAe=typeof Symbol=="function"&&Symbol.observable||"@@observable",H7=uAe,Y_=()=>Math.random().toString(36).substring(7).split("").join("."),dAe={INIT:`@@redux/INIT${Y_()}`,REPLACE:`@@redux/REPLACE${Y_()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Y_()}`},iN=dAe;function $4(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function XY(e,t,r){if(typeof e!="function")throw new Error(ro(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(ro(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(ro(1));return r(XY)(e,t)}let n=e,i=t,a=new Map,o=a,c=0,h=!1;function f(){o===a&&(o=new Map,a.forEach((T,D)=>{o.set(D,T)}))}function m(){if(h)throw new Error(ro(3));return i}function y(T){if(typeof T!="function")throw new Error(ro(4));if(h)throw new Error(ro(5));let D=!0;f();const V=c++;return o.set(V,T),function(){if(D){if(h)throw new Error(ro(6));D=!1,f(),o.delete(V),a=null}}}function w(T){if(!$4(T))throw new Error(ro(7));if(typeof T.type>"u")throw new Error(ro(8));if(typeof T.type!="string")throw new Error(ro(17));if(h)throw new Error(ro(9));try{h=!0,i=n(i,T)}finally{h=!1}return(a=o).forEach(V=>{V()}),T}function A(T){if(typeof T!="function")throw new Error(ro(10));n=T,w({type:iN.REPLACE})}function S(){const T=y;return{subscribe(D){if(typeof D!="object"||D===null)throw new Error(ro(11));function V(){const G=D;G.next&&G.next(m())}return V(),{unsubscribe:T(V)}},[H7](){return this}}}return w({type:iN.INIT}),{dispatch:w,subscribe:y,getState:m,replaceReducer:A,[H7]:S}}function hAe(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:iN.INIT})>"u")throw new Error(ro(12));if(typeof r(void 0,{type:iN.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ro(13))})}function QY(e){const t=Object.keys(e),r={};for(let a=0;a"u")throw c&&c.type,new Error(ro(14));f[y]=S,h=h||S!==A}return h=h||n.length!==Object.keys(o).length,h?f:o}}function sN(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function fAe(...e){return t=>(r,n)=>{const i=t(r,n);let a=()=>{throw new Error(ro(15))};const o={getState:i.getState,dispatch:(h,...f)=>a(h,...f)},c=e.map(h=>h(o));return a=sN(...c)(i.dispatch),{...i,dispatch:a}}}function ZY(e){return $4(e)&&"type"in e&&typeof e.type=="string"}var JY=Symbol.for("immer-nothing"),G7=Symbol.for("immer-draftable"),qo=Symbol.for("immer-state");function zc(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Vl=Object,Cg=Vl.getPrototypeOf,aN="constructor",QE="prototype",_j="configurable",oN="enumerable",Qw="writable",Ay="value",Hd=e=>!!e&&!!e[qo];function Xc(e){var t;return e?eX(e)||JE(e)||!!e[G7]||!!((t=e[aN])!=null&&t[G7])||eA(e)||tA(e):!1}var pAe=Vl[QE][aN].toString(),q7=new WeakMap;function eX(e){if(!e||!H4(e))return!1;const t=Cg(e);if(t===null||t===Vl[QE])return!0;const r=Vl.hasOwnProperty.call(t,aN)&&t[aN];if(r===Object)return!0;if(!D0(r))return!1;let n=q7.get(r);return n===void 0&&(n=Function.toString.call(r),q7.set(r,n)),n===pAe}function ZE(e,t,r=!0){db(e)===0?(r?Reflect.ownKeys(e):Vl.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function db(e){const t=e[qo];return t?t.type_:JE(e)?1:eA(e)?2:tA(e)?3:0}var W7=(e,t,r=db(e))=>r===2?e.has(t):Vl[QE].hasOwnProperty.call(e,t),Sj=(e,t,r=db(e))=>r===2?e.get(t):e[t],lN=(e,t,r,n=db(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function mAe(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var JE=Array.isArray,eA=e=>e instanceof Map,tA=e=>e instanceof Set,H4=e=>typeof e=="object",D0=e=>typeof e=="function",X_=e=>typeof e=="boolean";function gAe(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Ad=e=>e.copy_||e.base_,G4=e=>e.modified_?e.copy_:e.base_;function Cj(e,t){if(eA(e))return new Map(e);if(tA(e))return new Set(e);if(JE(e))return Array[QE].slice.call(e);const r=eX(e);if(t===!0||t==="class_only"&&!r){const n=Vl.getOwnPropertyDescriptors(e);delete n[qo];let i=Reflect.ownKeys(n);for(let a=0;a1&&Vl.defineProperties(e,{set:rw,add:rw,clear:rw,delete:rw}),Vl.freeze(e),t&&ZE(e,(r,n)=>{q4(n,!0)},!1)),e}function xAe(){zc(2)}var rw={[Ay]:xAe};function rA(e){return e===null||!H4(e)?!0:Vl.isFrozen(e)}var cN="MapSet",jj="Patches",K7="ArrayMethods",tX={};function cm(e){const t=tX[e];return t||zc(0,e),t}var Y7=e=>!!tX[e],ky,rX=()=>ky,yAe=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Y7(cN)?cm(cN):void 0,arrayMethodsPlugin_:Y7(K7)?cm(K7):void 0});function X7(e,t){t&&(e.patchPlugin_=cm(jj),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ij(e){Tj(e),e.drafts_.forEach(bAe),e.drafts_=null}function Tj(e){e===ky&&(ky=e.parent_)}var Q7=e=>ky=yAe(ky,e);function bAe(e){const t=e[qo];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Z7(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[qo].modified_&&(Ij(t),zc(4)),Xc(e)&&(e=J7(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(r[qo].base_,e,t)}else e=J7(t,r);return vAe(t,e,!0),Ij(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==JY?e:void 0}function J7(e,t){if(rA(t))return t;const r=t[qo];if(!r)return uN(t,e.handledSet_,e);if(!nA(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);sX(r,e)}return r.copy_}function vAe(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&q4(t,r)}function nX(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var nA=(e,t)=>e.scope_===t,wAe=[];function iX(e,t,r,n){const i=Ad(e),a=e.type_;if(n!==void 0&&Sj(i,n,a)===t){lN(i,n,r,a);return}if(!e.draftLocations_){const c=e.draftLocations_=new Map;ZE(i,(h,f)=>{if(Hd(f)){const m=c.get(f)||[];m.push(h),c.set(f,m)}})}const o=e.draftLocations_.get(t)??wAe;for(const c of o)lN(i,c,r,a)}function NAe(e,t,r){e.callbacks_.push(function(i){var c;const a=t;if(!a||!nA(a,i))return;(c=i.mapSetPlugin_)==null||c.fixSetContents(a);const o=G4(a);iX(e,a.draft_??a,o,r),sX(a,i)})}function sX(e,t){var n;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((n=e.assigned_)==null?void 0:n.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}nX(e)}}function EAe(e,t,r){const{scope_:n}=e;if(Hd(r)){const i=r[qo];nA(i,n)&&i.callbacks_.push(function(){Zw(e);const o=G4(i);iX(e,r,o,t)})}else Xc(r)&&e.callbacks_.push(function(){const a=Ad(e);e.type_===3?a.has(r)&&uN(r,n.handledSet_,n):Sj(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&uN(Sj(e.copy_,t,e.type_),n.handledSet_,n)})}function uN(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Hd(e)||t.has(e)||!Xc(e)||rA(e)||(t.add(e),ZE(e,(n,i)=>{if(Hd(i)){const a=i[qo];if(nA(a,r)){const o=G4(a);lN(e,n,o,e.type_),nX(a)}}else Xc(i)&&uN(i,t,r)})),e}function AAe(e,t){const r=JE(e),n={type_:r?1:0,scope_:t?t.scope_:rX(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,a=dN;r&&(i=[n],a=_y);const{revoke:o,proxy:c}=Proxy.revocable(i,a);return n.draft_=c,n.revoke_=o,[c,n]}var dN={get(e,t){if(t===qo)return e;let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const i=Ad(e);if(!W7(i,t,e.type_))return kAe(e,i,t);const a=i[t];if(e.finalized_||!Xc(a)||n&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&gAe(t))return a;if(a===Q_(e.base_,t)){Zw(e);const o=e.type_===1?+t:t,c=Oj(e.scope_,a,e,o);return e.copy_[o]=c}return a},has(e,t){return t in Ad(e)},ownKeys(e){return Reflect.ownKeys(Ad(e))},set(e,t,r){const n=aX(Ad(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Q_(Ad(e),t),a=i==null?void 0:i[qo];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(mAe(r,i)&&(r!==void 0||W7(e.base_,t,e.type_)))return!0;Zw(e),Pj(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),EAe(e,t,r)),!0},deleteProperty(e,t){return Zw(e),Q_(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Pj(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Ad(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Qw]:!0,[_j]:e.type_!==1||t!=="length",[oN]:n[oN],[Ay]:r[t]}},defineProperty(){zc(11)},getPrototypeOf(e){return Cg(e.base_)},setPrototypeOf(){zc(12)}},_y={};for(let e in dN){let t=dN[e];_y[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}_y.deleteProperty=function(e,t){return _y.set.call(this,e,t,void 0)};_y.set=function(e,t,r){return dN.set.call(this,e[0],t,r,e[0])};function Q_(e,t){const r=e[qo];return(r?Ad(r):e)[t]}function kAe(e,t,r){var i;const n=aX(t,r);return n?Ay in n?n[Ay]:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function aX(e,t){if(!(t in e))return;let r=Cg(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Cg(r)}}function Pj(e){e.modified_||(e.modified_=!0,e.parent_&&Pj(e.parent_))}function Zw(e){e.copy_||(e.assigned_=new Map,e.copy_=Cj(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var _Ae=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,i)=>{if(D0(r)&&!D0(n)){const o=n;n=r;const c=this;return function(f=o,...m){return c.produce(f,y=>n.call(this,y,...m))}}D0(n)||zc(6),i!==void 0&&!D0(i)&&zc(7);let a;if(Xc(r)){const o=Q7(this),c=Oj(o,r,void 0);let h=!0;try{a=n(c),h=!1}finally{h?Ij(o):Tj(o)}return X7(o,i),Z7(a,o)}else if(!r||!H4(r)){if(a=n(r),a===void 0&&(a=r),a===JY&&(a=void 0),this.autoFreeze_&&q4(a,!0),i){const o=[],c=[];cm(jj).generateReplacementPatches_(r,a,{patches_:o,inversePatches_:c}),i(o,c)}return a}else zc(1,r)},this.produceWithPatches=(r,n)=>{if(D0(r))return(c,...h)=>this.produceWithPatches(c,f=>r(f,...h));let i,a;return[this.produce(r,n,(c,h)=>{i=c,a=h}),i,a]},X_(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),X_(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),X_(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Xc(t)||zc(8),Hd(t)&&(t=yc(t));const r=Q7(this),n=Oj(r,t,void 0);return n[qo].isManual_=!0,Tj(r),n}finishDraft(t,r){const n=t&&t[qo];(!n||!n.isManual_)&&zc(9);const{scope_:i}=n;return X7(i,r),Z7(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const a=r[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(r=r.slice(n+1));const i=cm(jj).applyPatches_;return Hd(t)?i(t,r):this.produce(t,a=>i(a,r))}};function Oj(e,t,r,n){const[i,a]=eA(t)?cm(cN).proxyMap_(t,r):tA(t)?cm(cN).proxySet_(t,r):AAe(t,r);return((r==null?void 0:r.scope_)??rX()).drafts_.push(i),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=n,r&&n!==void 0?NAe(r,a,n):a.callbacks_.push(function(h){var m;(m=h.mapSetPlugin_)==null||m.fixSetContents(a);const{patchPlugin_:f}=h;a.modified_&&f&&f.generatePatches_(a,[],h)}),i}function yc(e){return Hd(e)||zc(10,e),oX(e)}function oX(e){if(!Xc(e)||rA(e))return e;const t=e[qo];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Cj(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Cj(e,!0);return ZE(r,(i,a)=>{lN(r,i,oX(a))},n),t&&(t.finalized_=!1),r}var SAe=new _Ae,lX=SAe.produce;function cX(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var CAe=cX(),jAe=cX,IAe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?sN:sN.apply(null,arguments)};function Kl(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(Gl(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>ZY(n)&&n.type===e,r}var uX=class I1 extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,I1.prototype)}static get[Symbol.species](){return I1}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new I1(...t[0].concat(this)):new I1(...t.concat(this))}};function eU(e){return Xc(e)?lX(e,()=>{}):e}function nw(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function TAe(e){return typeof e=="boolean"}var PAe=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new uX;return r&&(TAe(r)?o.push(CAe):o.push(jAe(r.extraArgument))),o},dX="RTK_autoBatch",ps=()=>e=>({payload:e,meta:{[dX]:!0}}),tU=e=>t=>{setTimeout(t,e)},hX=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,a=!1,o=!1;const c=new Set,h=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:tU(10):e.type==="callback"?e.queueNotification:tU(e.timeout),f=()=>{o=!1,a&&(a=!1,c.forEach(m=>m()))};return Object.assign({},n,{subscribe(m){const y=()=>i&&m(),w=n.subscribe(y);return c.add(m),()=>{w(),c.delete(m)}},dispatch(m){var y;try{return i=!((y=m==null?void 0:m.meta)!=null&&y[dX]),a=!i,a&&(o||(o=!0,h(f))),n.dispatch(m)}finally{i=!0}}})},OAe=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new uX(e);return n&&i.push(hX(typeof n=="object"?n:void 0)),i};function RAe(e){const t=PAe(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let c;if(typeof r=="function")c=r;else if($4(r))c=QY(r);else throw new Error(Gl(1));let h;typeof n=="function"?h=n(t):h=t();let f=sN;i&&(f=IAe({trace:!1,...typeof i=="object"&&i}));const m=fAe(...h),y=OAe(m);let w=typeof o=="function"?o(y):y();const A=f(...w);return XY(c,a,A)}function fX(e){const t={},r=[];let n;const i={addCase(a,o){const c=typeof a=="string"?a:a.type;if(!c)throw new Error(Gl(28));if(c in t)throw new Error(Gl(29));return t[c]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return r.push({matcher:a,reducer:o}),i},addDefaultCase(a){return n=a,i}};return e(i),[t,r,n]}function DAe(e){return typeof e=="function"}function MAe(e,t){let[r,n,i]=fX(t),a;if(DAe(e))a=()=>eU(e());else{const c=eU(e);a=()=>c}function o(c=a(),h){let f=[r[h.type],...n.filter(({matcher:m})=>m(h)).map(({reducer:m})=>m)];return f.filter(m=>!!m).length===0&&(f=[i]),f.reduce((m,y)=>{if(y)if(Hd(m)){const A=y(m,h);return A===void 0?m:A}else{if(Xc(m))return lX(m,w=>y(w,h));{const w=y(m,h);if(w===void 0){if(m===null)return m;throw Error("A case reducer on a non-draftable value must not return undefined")}return w}}return m},c)}return o.getInitialState=a,o}var LAe="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",UAe=(e=21)=>{let t="",r=e;for(;r--;)t+=LAe[Math.random()*64|0];return t},BAe=Symbol.for("rtk-slice-createasyncthunk");function zAe(e,t){return`${e}/${t}`}function VAe({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[BAe];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(Gl(11));const c=(typeof i.reducers=="function"?i.reducers($Ae()):i.reducers)||{},h=Object.keys(c),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(G,X){const q=typeof G=="string"?G:G.type;if(!q)throw new Error(Gl(12));if(q in f.sliceCaseReducersByType)throw new Error(Gl(13));return f.sliceCaseReducersByType[q]=X,m},addMatcher(G,X){return f.sliceMatchers.push({matcher:G,reducer:X}),m},exposeAction(G,X){return f.actionCreators[G]=X,m},exposeCaseReducer(G,X){return f.sliceCaseReducersByName[G]=X,m}};h.forEach(G=>{const X=c[G],q={reducerName:G,type:zAe(a,G),createNotation:typeof i.reducers=="function"};GAe(X)?WAe(q,X,m,t):HAe(q,X,m)});function y(){const[G={},X=[],q=void 0]=typeof i.extraReducers=="function"?fX(i.extraReducers):[i.extraReducers],B={...G,...f.sliceCaseReducersByType};return MAe(i.initialState,z=>{for(let F in B)z.addCase(F,B[F]);for(let F of f.sliceMatchers)z.addMatcher(F.matcher,F.reducer);for(let F of X)z.addMatcher(F.matcher,F.reducer);q&&z.addDefaultCase(q)})}const w=G=>G,A=new Map,S=new WeakMap;let j;function T(G,X){return j||(j=y()),j(G,X)}function D(){return j||(j=y()),j.getInitialState()}function V(G,X=!1){function q(z){let F=z[G];return typeof F>"u"&&X&&(F=nw(S,q,D)),F}function B(z=w){const F=nw(A,X,()=>new WeakMap);return nw(F,z,()=>{const $={};for(const[J,Q]of Object.entries(i.selectors??{}))$[J]=FAe(Q,z,()=>nw(S,z,D),X);return $})}return{reducerPath:G,getSelectors:B,get selectors(){return B(q)},selectSlice:q}}const U={name:a,reducer:T,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:D,...V(o),injectInto(G,{reducerPath:X,...q}={}){const B=X??o;return G.inject({reducerPath:B,reducer:T},q),{...U,...V(B,!0)}}};return U}}function FAe(e,t,r,n){function i(a,...o){let c=t(a);return typeof c>"u"&&n&&(c=r()),e(c,...o)}return i.unwrapped=e,i}var To=VAe();function $Ae(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function HAe({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!qAe(n))throw new Error(Gl(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Kl(e,o):Kl(e))}function GAe(e){return e._reducerDefinitionType==="asyncThunk"}function qAe(e){return e._reducerDefinitionType==="reducerWithPrepare"}function WAe({type:e,reducerName:t},r,n,i){if(!i)throw new Error(Gl(18));const{payloadCreator:a,fulfilled:o,pending:c,rejected:h,settled:f,options:m}=r,y=i(e,a,m);n.exposeAction(t,y),o&&n.addCase(y.fulfilled,o),c&&n.addCase(y.pending,c),h&&n.addCase(y.rejected,h),f&&n.addMatcher(y.settled,f),n.exposeCaseReducer(t,{fulfilled:o||iw,pending:c||iw,rejected:h||iw,settled:f||iw})}function iw(){}var KAe="task",pX="listener",mX="completed",W4="cancelled",YAe=`task-${W4}`,XAe=`task-${mX}`,Rj=`${pX}-${W4}`,QAe=`${pX}-${mX}`,iA=class{constructor(e){yd(this,"name","TaskAbortError");yd(this,"message");this.code=e,this.message=`${KAe} ${W4} (reason: ${e})`}},K4=(e,t)=>{if(typeof e!="function")throw new TypeError(Gl(32))},hN=()=>{},gX=(e,t=hN)=>(e.catch(t),e),xX=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Bp=e=>{if(e.aborted)throw new iA(e.reason)};function yX(e,t){let r=hN;return new Promise((n,i)=>{const a=()=>i(new iA(e.reason));if(e.aborted){a();return}r=xX(e,a),t.finally(()=>r()).then(n,i)}).finally(()=>{r=hN})}var ZAe=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof iA?"cancelled":"rejected",error:r}}finally{t==null||t()}},fN=e=>t=>gX(yX(e,t).then(r=>(Bp(e),r))),bX=e=>{const t=fN(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:tg}=Object,rU={},sA="listenerMiddleware",JAe=(e,t)=>{const r=n=>xX(e,()=>n.abort(e.reason));return(n,i)=>{K4(n);const a=new AbortController;r(a);const o=ZAe(async()=>{Bp(e),Bp(a.signal);const c=await n({pause:fN(a.signal),delay:bX(a.signal),signal:a.signal});return Bp(a.signal),c},()=>a.abort(XAe));return i!=null&&i.autoJoin&&t.push(o.catch(hN)),{result:fN(e)(o),cancel(){a.abort(YAe)}}}},e5e=(e,t)=>{const r=async(n,i)=>{Bp(t);let a=()=>{};const c=[new Promise((h,f)=>{let m=e({predicate:n,effect:(y,w)=>{w.unsubscribe(),h([y,w.getState(),w.getOriginalState()])}});a=()=>{m(),f()}})];i!=null&&c.push(new Promise(h=>setTimeout(h,i,null)));try{const h=await yX(t,Promise.race(c));return Bp(t),h}finally{a()}};return(n,i)=>gX(r(n,i))},vX=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:a}=e;if(t)i=Kl(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(Gl(21));return K4(a),{predicate:i,type:t,effect:a}},wX=tg(e=>{const{type:t,predicate:r,effect:n}=vX(e);return{id:UAe(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Gl(22))}}},{withTypes:()=>wX}),nU=(e,t)=>{const{type:r,effect:n,predicate:i}=vX(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===i)&&a.effect===n)},Dj=e=>{e.pending.forEach(t=>{t.abort(Rj)})},t5e=(e,t)=>()=>{for(const r of t.keys())Dj(r);e.clear()},iU=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},NX=tg(Kl(`${sA}/add`),{withTypes:()=>NX}),r5e=Kl(`${sA}/removeAll`),EX=tg(Kl(`${sA}/remove`),{withTypes:()=>EX}),n5e=(...e)=>{console.error(`${sA}/error`,...e)},hb=(e={})=>{const t=new Map,r=new Map,n=A=>{const S=r.get(A)??0;r.set(A,S+1)},i=A=>{const S=r.get(A)??1;S===1?r.delete(A):r.set(A,S-1)},{extra:a,onError:o=n5e}=e;K4(o);const c=A=>(A.unsubscribe=()=>t.delete(A.id),t.set(A.id,A),S=>{A.unsubscribe(),S!=null&&S.cancelActive&&Dj(A)}),h=A=>{const S=nU(t,A)??wX(A);return c(S)};tg(h,{withTypes:()=>h});const f=A=>{const S=nU(t,A);return S&&(S.unsubscribe(),A.cancelActive&&Dj(S)),!!S};tg(f,{withTypes:()=>f});const m=async(A,S,j,T)=>{const D=new AbortController,V=e5e(h,D.signal),U=[];try{A.pending.add(D),n(A),await Promise.resolve(A.effect(S,tg({},j,{getOriginalState:T,condition:(G,X)=>V(G,X).then(Boolean),take:V,delay:bX(D.signal),pause:fN(D.signal),extra:a,signal:D.signal,fork:JAe(D.signal,U),unsubscribe:A.unsubscribe,subscribe:()=>{t.set(A.id,A)},cancelActiveListeners:()=>{A.pending.forEach((G,X,q)=>{G!==D&&(G.abort(Rj),q.delete(G))})},cancel:()=>{D.abort(Rj),A.pending.delete(D)},throwIfCancelled:()=>{Bp(D.signal)}})))}catch(G){G instanceof iA||iU(o,G,{raisedBy:"effect"})}finally{await Promise.all(U),D.abort(QAe),i(A),A.pending.delete(D)}},y=t5e(t,r);return{middleware:A=>S=>j=>{if(!ZY(j))return S(j);if(NX.match(j))return h(j.payload);if(r5e.match(j)){y();return}if(EX.match(j))return f(j.payload);let T=A.getState();const D=()=>{if(T===rU)throw new Error(Gl(23));return T};let V;try{if(V=S(j),t.size>0){const U=A.getState(),G=Array.from(t.values());for(const X of G){let q=!1;try{q=X.predicate(j,U,T)}catch(B){q=!1,iU(o,B,{raisedBy:"predicate"})}q&&m(X,j,A,D)}}}finally{T=rU}return V},startListening:h,stopListening:f,clearListeners:y}};function Gl(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var i5e={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},AX=To({name:"chartLayout",initialState:i5e,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,a;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:s5e,setLayout:a5e,setChartSize:o5e,setScale:l5e}=AX.actions,c5e=AX.reducer;function kX(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function Wn(e){return Number.isFinite(e)}function qu(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function sU(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function F0(e){for(var t=1;t{if(t&&r){var{width:n,height:i}=r,{align:a,verticalAlign:o,layout:c}=t;if((c==="vertical"||c==="horizontal"&&o==="middle")&&a!=="center"&&wr(e[a]))return F0(F0({},e),{},{[a]:e[a]+(n||0)});if((c==="horizontal"||c==="vertical"&&a==="center")&&o!=="middle"&&wr(e[o]))return F0(F0({},e),{},{[o]:e[o]+(i||0)})}return e},Zc=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",_X=(e,t,r,n)=>{if(n)return e.map(c=>c.coordinate);var i,a,o=e.map(c=>(c.coordinate===t&&(i=!0),c.coordinate===r&&(a=!0),c.coordinate));return i||o.push(t),a||o.push(r),o},SX=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:i,range:a,scale:o,realScaleType:c,isCategorical:h,categoricalDomain:f,tickCount:m,ticks:y,niceTicks:w,axisType:A}=e;if(!o)return null;var S=c==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,j=i==="category"&&o.bandwidth?o.bandwidth()/S:0;if(j=A==="angleAxis"&&a&&a.length>=2?fl(a[0]-a[1])*2*j:j,y||w){var T=(y||w||[]).map((D,V)=>{var U=n?n.indexOf(D):D,G=o.map(U);return Wn(G)?{coordinate:G+j,value:D,offset:j,index:V}:null}).filter(pl);return T}return h&&f?f.map((D,V)=>{var U=o.map(D);return Wn(U)?{coordinate:U+j,value:D,index:V,offset:j}:null}).filter(pl):o.ticks&&m!=null?o.ticks(m).map((D,V)=>{var U=o.map(D);return Wn(U)?{coordinate:U+j,value:D,index:V,offset:j}:null}).filter(pl):o.domain().map((D,V)=>{var U=o.map(D);return Wn(U)?{coordinate:U+j,value:n?n[D]:D,index:V,offset:j}:null}).filter(pl)},p5e=(e,t)=>{if(!t||t.length!==2||!wr(t[0])||!wr(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!wr(e[0])||e[0]n)&&(i[1]=n),i[0]>n&&(i[0]=n),i[1]{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var i=0;i=0?(f[0]=a,a+=w,f[1]=a):(f[0]=o,o+=w,f[1]=o)}}}},g5e=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var i=0;i=0?(h[0]=a,a+=f,h[1]=a):(h[0]=0,h[1]=0)}}}},x5e={sign:m5e,expand:LNe,none:om,silhouette:UNe,wiggle:BNe,positive:g5e},y5e=(e,t,r)=>{var n,i=(n=x5e[r])!==null&&n!==void 0?n:om,a=MNe().keys(t).value((c,h)=>Number(Rs(c,h,0))).order(Aj).offset(i),o=a(e);return o.forEach((c,h)=>{c.forEach((f,m)=>{var y=Rs(e[m],t[h],0);Array.isArray(y)&&y.length===2&&wr(y[0])&&wr(y[1])&&(f[0]=y[0],f[1]=y[1])})}),o};function CX(e){return e==null?void 0:String(e)}function pN(e){var{axis:t,ticks:r,bandSize:n,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!xs(i[t.dataKey])){var c=TY(r,"value",i[t.dataKey]);if(c)return c.coordinate+n/2}return r!=null&&r[a]?r[a].coordinate+n/2:null}var h=Rs(i,xs(o)?t.dataKey:o),f=t.scale.map(h);return wr(f)?f:null}var aU=e=>{var{axis:t,ticks:r,offset:n,bandSize:i,entry:a,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+n:null;var c=Rs(a,t.dataKey,t.scale.domain()[o]);if(xs(c))return null;var h=t.scale.map(c);return wr(h)?h-i/2+n:null},b5e=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return n<=0&&i>=0?0:i<0?i:n}return r[0]},v5e=e=>{var t=e.flat(2).filter(wr);return[Math.min(...t),Math.max(...t)]},w5e=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],N5e=(e,t,r)=>{if(e!=null)return w5e(Object.keys(e).reduce((n,i)=>{var a=e[i];if(!a)return n;var{stackedData:o}=a,c=o.reduce((h,f)=>{var m=kX(f,t,r),y=v5e(m);return!Wn(y[0])||!Wn(y[1])?h:[Math.min(h[0],y[0]),Math.max(h[1],y[1])]},[1/0,-1/0]);return[Math.min(c[0],n[0]),Math.max(c[1],n[1])]},[1/0,-1/0]))},oU=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,lU=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Ef=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=XE(t,m=>m.coordinate),a=1/0,o=1,c=i.length;o{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},A5e=(e,t)=>t==="centric"?e.angle:e.radius,Zd=e=>e.layout.width,Jd=e=>e.layout.height,k5e=e=>e.layout.scale,jX=e=>e.layout.margin,aA=et(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),oA=et(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),_5e="data-recharts-item-index",S5e="data-recharts-item-id",fb=60;function uU(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function sw(e){for(var t=1;te.brush.height;function P5e(e){var t=oA(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:fb;return r+i}return r},0)}function O5e(e){var t=oA(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:fb;return r+i}return r},0)}function R5e(e){var t=aA(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function D5e(e){var t=aA(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var Fa=et([Zd,Jd,jX,T5e,P5e,O5e,R5e,D5e,KY,aAe],(e,t,r,n,i,a,o,c,h,f)=>{var m={left:(r.left||0)+i,right:(r.right||0)+a},y={top:(r.top||0)+o,bottom:(r.bottom||0)+c},w=sw(sw({},y),m),A=w.bottom;w.bottom+=n,w=f5e(w,h,f);var S=e-w.left-w.right,j=t-w.top-w.bottom;return sw(sw({brushBottom:A},w),{},{width:Math.max(S,0),height:Math.max(j,0)})}),M5e=et(Fa,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Y4=et(Zd,Jd,(e,t)=>({x:0,y:0,width:e,height:t})),L5e=I.createContext(null),$a=()=>I.useContext(L5e)!=null,lA=e=>e.brush,cA=et([lA,Fa,jX],(e,t,r)=>({height:e.height,x:wr(e.x)?e.x:t.left,y:wr(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:wr(e.width)?e.width:t.width})),Z_={},J_={},eS={},dU;function U5e(){return dU||(dU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n,{signal:i,edges:a}={}){let o,c=null;const h=a!=null&&a.includes("leading"),f=a==null||a.includes("trailing"),m=()=>{c!==null&&(r.apply(o,c),o=void 0,c=null)},y=()=>{f&&m(),j()};let w=null;const A=()=>{w!=null&&clearTimeout(w),w=setTimeout(()=>{w=null,y()},n)},S=()=>{w!==null&&(clearTimeout(w),w=null)},j=()=>{S(),o=void 0,c=null},T=()=>{m()},D=function(...V){if(i!=null&&i.aborted)return;o=this,c=V;const U=w==null;A(),h&&U&&m()};return D.schedule=A,D.cancel=j,D.flush=T,i==null||i.addEventListener("abort",j,{once:!0}),D}e.debounce=t})(eS)),eS}var hU;function B5e(){return hU||(hU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=U5e();function r(n,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:c=!0,maxWait:h}=a,f=Array(2);o&&(f[0]="leading"),c&&(f[1]="trailing");let m,y=null;const w=t.debounce(function(...j){m=n.apply(this,j),y=null},i,{edges:f}),A=function(...j){return h!=null&&(y===null&&(y=Date.now()),Date.now()-y>=h)?(m=n.apply(this,j),y=Date.now(),w.cancel(),w.schedule(),m):(w.apply(this,j),m)},S=()=>(w.flush(),m);return A.cancel=w.cancel,A.flush=S,A}e.debounce=r})(J_)),J_}var fU;function z5e(){return fU||(fU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=B5e();function r(n,i=0,a={}){const{leading:o=!0,trailing:c=!0}=a;return t.debounce(n,i,{leading:o,maxWait:i,trailing:c})}e.throttle=r})(Z_)),Z_}var tS,pU;function V5e(){return pU||(pU=1,tS=z5e().throttle),tS}var F5e=V5e();const $5e=Qu(F5e);var mN=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;ai[o++]))}},Pu={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},IX=(e,t,r)=>{var{width:n=Pu.width,height:i=Pu.height,aspect:a,maxHeight:o}=r,c=lm(n)?e:Number(n),h=lm(i)?t:Number(i);return a&&a>0&&(c?h=c/a:h&&(c=h*a),o&&h!=null&&h>o&&(h=o)),{calculatedWidth:c,calculatedHeight:h}},H5e={width:0,height:0,overflow:"visible"},G5e={width:0,overflowX:"visible"},q5e={height:0,overflowY:"visible"},W5e={},K5e=e=>{var{width:t,height:r}=e,n=lm(t),i=lm(r);return n&&i?H5e:n?G5e:i?q5e:W5e};function Y5e(e){var{width:t,height:r,aspect:n}=e,i=t,a=r;return i===void 0&&a===void 0?(i=Pu.width,a=Pu.height):i===void 0?i=n&&n>0?void 0:Pu.width:a===void 0&&(a=n&&n>0?void 0:Pu.height),{width:i,height:a}}function Mj(){return Mj=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:r,height:n}),[r,n]);return J5e(i)?I.createElement(TX.Provider,{value:i},t):null}var X4=()=>I.useContext(TX),eke=I.forwardRef((e,t)=>{var{aspect:r,initialDimension:n=Pu.initialDimension,width:i,height:a,minWidth:o=Pu.minWidth,minHeight:c,maxHeight:h,children:f,debounce:m=Pu.debounce,id:y,className:w,onResize:A,style:S={}}=e,j=I.useRef(null),T=I.useRef();T.current=A,I.useImperativeHandle(t,()=>j.current);var[D,V]=I.useState({containerWidth:n.width,containerHeight:n.height}),U=I.useCallback((z,F)=>{V($=>{var J=Math.round(z),Q=Math.round(F);return $.containerWidth===J&&$.containerHeight===Q?$:{containerWidth:J,containerHeight:Q}})},[]);I.useEffect(()=>{if(j.current==null||typeof ResizeObserver>"u")return Df;var z=Q=>{var K,me=Q[0];if(me!=null){var{width:re,height:le}=me.contentRect;U(re,le),(K=T.current)===null||K===void 0||K.call(T,re,le)}};m>0&&(z=$5e(z,m,{trailing:!0,leading:!1}));var F=new ResizeObserver(z),{width:$,height:J}=j.current.getBoundingClientRect();return U($,J),F.observe(j.current),()=>{F.disconnect()}},[U,m]);var{containerWidth:G,containerHeight:X}=D;mN(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:q,calculatedHeight:B}=IX(G,X,{width:i,height:a,aspect:r,maxHeight:h});return mN(q!=null&&q>0||B!=null&&B>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,q,B,i,a,o,c,r),I.createElement("div",{id:y?"".concat(y):void 0,className:Mi("recharts-responsive-container",w),style:gU(gU({},S),{},{width:i,height:a,minWidth:o,minHeight:c,maxHeight:h}),ref:j},I.createElement("div",{style:K5e({width:i,height:a})},I.createElement(PX,{width:q,height:B},f)))}),tke=I.forwardRef((e,t)=>{var r=X4();if(qu(r.width)&&qu(r.height))return e.children;var{width:n,height:i}=Y5e({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=IX(void 0,void 0,{width:n,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return wr(a)&&wr(o)?I.createElement(PX,{width:a,height:o},e.children):I.createElement(eke,Mj({},e,{width:n,height:i,ref:t}))});function Q4(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var uA=()=>{var e,t=$a(),r=Xr(M5e),n=Xr(cA),i=(e=Xr(lA))===null||e===void 0?void 0:e.padding;return!t||!n||!i?r:{width:n.width-i.left-i.right,height:n.height-i.top-i.bottom,x:i.left,y:i.top}},rke={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},OX=()=>{var e;return(e=Xr(Fa))!==null&&e!==void 0?e:rke},Z4=()=>Xr(Zd),J4=()=>Xr(Jd),nke=()=>Xr(e=>e.layout.margin),Si=e=>e.layout.layoutType,Mf=()=>Xr(Si),e3=()=>{var e=Mf();if(e==="horizontal"||e==="vertical")return e},RX=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},ike=()=>{var e=Mf();return e!==void 0},pb=e=>{var t=ys(),r=$a(),{width:n,height:i}=e,a=X4(),o=n,c=i;return a&&(o=a.width>0?a.width:n,c=a.height>0?a.height:i),I.useEffect(()=>{!r&&qu(o)&&qu(c)&&t(o5e({width:o,height:c}))},[t,r,o,c]),null},DX=Symbol.for("immer-nothing"),xU=Symbol.for("immer-draftable"),Yl=Symbol.for("immer-state");function Vc(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Sy=Object.getPrototypeOf;function jg(e){return!!e&&!!e[Yl]}function um(e){var t;return e?MX(e)||Array.isArray(e)||!!e[xU]||!!((t=e.constructor)!=null&&t[xU])||mb(e)||hA(e):!1}var ske=Object.prototype.constructor.toString(),yU=new WeakMap;function MX(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=yU.get(r);return n===void 0&&(n=Function.toString.call(r),yU.set(r,n)),n===ske}function gN(e,t,r=!0){dA(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function dA(e){const t=e[Yl];return t?t.type_:Array.isArray(e)?1:mb(e)?2:hA(e)?3:0}function Lj(e,t){return dA(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function LX(e,t,r){const n=dA(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function ake(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function mb(e){return e instanceof Map}function hA(e){return e instanceof Set}function dp(e){return e.copy_||e.base_}function Uj(e,t){if(mb(e))return new Map(e);if(hA(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=MX(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[Yl];let i=Reflect.ownKeys(n);for(let a=0;a1&&Object.defineProperties(e,{set:aw,add:aw,clear:aw,delete:aw}),Object.freeze(e),t&&Object.values(e).forEach(r=>t3(r,!0))),e}function oke(){Vc(2)}var aw={value:oke};function fA(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var lke={};function dm(e){const t=lke[e];return t||Vc(0,e),t}var Cy;function UX(){return Cy}function cke(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function bU(e,t){t&&(dm("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Bj(e){zj(e),e.drafts_.forEach(uke),e.drafts_=null}function zj(e){e===Cy&&(Cy=e.parent_)}function vU(e){return Cy=cke(Cy,e)}function uke(e){const t=e[Yl];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function wU(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[Yl].modified_&&(Bj(t),Vc(4)),um(e)&&(e=xN(t,e),t.parent_||yN(t,e)),t.patches_&&dm("Patches").generateReplacementPatches_(r[Yl].base_,e,t.patches_,t.inversePatches_)):e=xN(t,r,[]),Bj(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==DX?e:void 0}function xN(e,t,r){if(fA(t))return t;const n=e.immer_.shouldUseStrictIteration(),i=t[Yl];if(!i)return gN(t,(a,o)=>NU(e,i,t,a,o,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return yN(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,c=!1;i.type_===3&&(o=new Set(a),a.clear(),c=!0),gN(o,(h,f)=>NU(e,i,a,h,f,r,c),n),yN(e,a,!1),r&&e.patches_&&dm("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function NU(e,t,r,n,i,a,o){if(i==null||typeof i!="object"&&!o)return;const c=fA(i);if(!(c&&!o)){if(jg(i)){const h=a&&t&&t.type_!==3&&!Lj(t.assigned_,n)?a.concat(n):void 0,f=xN(e,i,h);if(LX(r,n,f),jg(f))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(um(i)&&!c){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&c)return;xN(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(mb(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&yN(e,i)}}}function yN(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&t3(t,r)}function dke(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:UX(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=r3;r&&(i=[n],a=jy);const{revoke:o,proxy:c}=Proxy.revocable(i,a);return n.draft_=c,n.revoke_=o,c}var r3={get(e,t){if(t===Yl)return e;const r=dp(e);if(!Lj(r,t))return hke(e,r,t);const n=r[t];return e.finalized_||!um(n)?n:n===rS(e.base_,t)?(nS(e),e.copy_[t]=Fj(n,e)):n},has(e,t){return t in dp(e)},ownKeys(e){return Reflect.ownKeys(dp(e))},set(e,t,r){const n=BX(dp(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=rS(dp(e),t),a=i==null?void 0:i[Yl];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(ake(r,i)&&(r!==void 0||Lj(e.base_,t)))return!0;nS(e),Vj(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return rS(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,nS(e),Vj(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=dp(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Vc(11)},getPrototypeOf(e){return Sy(e.base_)},setPrototypeOf(){Vc(12)}},jy={};gN(r3,(e,t)=>{jy[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});jy.deleteProperty=function(e,t){return jy.set.call(this,e,t,void 0)};jy.set=function(e,t,r){return r3.set.call(this,e[0],t,r,e[0])};function rS(e,t){const r=e[Yl];return(r?dp(r):e)[t]}function hke(e,t,r){var i;const n=BX(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function BX(e,t){if(!(t in e))return;let r=Sy(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Sy(r)}}function Vj(e){e.modified_||(e.modified_=!0,e.parent_&&Vj(e.parent_))}function nS(e){e.copy_||(e.copy_=Uj(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var fke=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const o=this;return function(h=a,...f){return o.produce(h,m=>r.call(this,m,...f))}}typeof r!="function"&&Vc(6),n!==void 0&&typeof n!="function"&&Vc(7);let i;if(um(t)){const a=vU(this),o=Fj(t,void 0);let c=!0;try{i=r(o),c=!1}finally{c?Bj(a):zj(a)}return bU(a,n),wU(i,a)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===DX&&(i=void 0),this.autoFreeze_&&t3(i,!0),n){const a=[],o=[];dm("Patches").generateReplacementPatches_(t,i,a,o),n(a,o)}return i}else Vc(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...c)=>this.produceWithPatches(o,h=>t(h,...c));let n,i;return[this.produce(t,r,(o,c)=>{n=o,i=c}),n,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){um(e)||Vc(8),jg(e)&&(e=pke(e));const t=vU(this),r=Fj(e,void 0);return r[Yl].isManual_=!0,zj(t),r}finishDraft(e,t){const r=e&&e[Yl];(!r||!r.isManual_)&&Vc(9);const{scope_:n}=r;return bU(n,t),wU(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=dm("Patches").applyPatches_;return jg(e)?n(e,t):this.produce(e,i=>n(i,t))}};function Fj(e,t){const r=mb(e)?dm("MapSet").proxyMap_(e,t):hA(e)?dm("MapSet").proxySet_(e,t):dke(e,t);return(t?t.scope_:UX()).drafts_.push(r),r}function pke(e){return jg(e)||Vc(10,e),zX(e)}function zX(e){if(!um(e)||fA(e))return e;const t=e[Yl];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Uj(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Uj(e,!0);return gN(r,(i,a)=>{LX(r,i,zX(a))},n),t&&(t.finalized_=!1),r}var mke=new fke;mke.produce;var gke={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},VX=To({name:"legend",initialState:gke,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:ps()},replaceLegendPayload:{reducer(e,t){var{prev:r,next:n}=t.payload,i=yc(e).payload.indexOf(r);i>-1&&(e.payload[i]=n)},prepare:ps()},removeLegendPayload:{reducer(e,t){var r=yc(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:ps()}}}),{setLegendSize:EU,setLegendSettings:xke,addLegendPayload:yke,replaceLegendPayload:bke,removeLegendPayload:vke}=VX.actions,wke=VX.reducer,iS={exports:{}},sS={};/** * @license React * use-sync-external-store-with-selector.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var AU;function Nke(){if(AU)return sS;AU=1;var e=Mg();function t(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,c=e.useDebugValue;return sS.useSyncExternalStoreWithSelector=function(h,f,m,y,w){var A=i(null);if(A.current===null){var S={hasValue:!1,value:null};A.current=S}else S=A.current;A=o(function(){function T(X){if(!D){if(D=!0,V=X,X=y(X),w!==void 0&&S.hasValue){var q=S.value;if(w(q,X))return U=q}return U=X}if(q=U,r(V,X))return q;var B=y(X);return w!==void 0&&w(q,B)?(V=X,q):(V=X,U=B)}var D=!1,V,U,G=m===void 0?null:m;return[function(){return T(f())},G===null?void 0:function(){return T(G())}]},[f,m,y,w]);var j=n(h,A[0],A[1]);return a(function(){S.hasValue=!0,S.value=j},[j]),c(j),j},sS}var kU;function Eke(){return kU||(kU=1,iS.exports=Nke()),iS.exports}Eke();function Ake(e){e()}function kke(){let e=null,t=null;return{clear(){e=null,t=null},notify(){Ake(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!n||e===null||(n=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var _U={notify(){},get:()=>[]};function _ke(e,t){let r,n=_U,i=0,a=!1;function o(j){m();const T=n.subscribe(j);let D=!1;return()=>{D||(D=!0,T(),y())}}function c(){n.notify()}function h(){S.onStateChange&&S.onStateChange()}function f(){return a}function m(){i++,r||(r=e.subscribe(h),n=kke())}function y(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=_U)}function w(){a||(a=!0,m())}function A(){a&&(a=!1,y())}const S={addNestedSub:o,notifyNestedSubs:c,handleChangeWrapper:h,isSubscribed:f,trySubscribe:w,tryUnsubscribe:A,getListeners:()=>n};return S}var Ske=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Cke=Ske(),jke=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Ike=jke(),Tke=()=>Cke||Ike?I.useLayoutEffect:I.useEffect,Pke=Tke();function SU(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Oke(e,t){if(SU(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i=0;i{const h=_ke(i);return{store:i,subscription:h,getServerState:n?()=>n:void 0}},[i,n]),o=I.useMemo(()=>i.getState(),[i]);Pke(()=>{const{subscription:h}=a;return h.onStateChange=h.notifyNestedSubs,h.trySubscribe(),o!==i.getState()&&h.notifyNestedSubs(),()=>{h.tryUnsubscribe(),h.onStateChange=void 0}},[a,o]);const c=r||Dke;return I.createElement(c.Provider,{value:a},t)}var Lke=Mke,Uke=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function Bke(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Nm(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var n of r)if(Uke.has(n)){if(e[n]==null&&t[n]==null)continue;if(!Oke(e[n],t[n]))return!1}else if(!Bke(e[n],t[n]))return!1;return!0}var zke=["contextPayload"];function $j(){return $j=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(xke(e))},[t,e]),null}function Xke(e){var t=ys();return I.useEffect(()=>(t(EU(e)),()=>{t(EU({width:0,height:0}))}),[t,e]),null}function Qke(e,t,r,n){return e==="vertical"&&t!=null?{height:t}:e==="horizontal"?{width:r||n}:null}var Zke={align:"center",iconSize:14,inactiveColor:"#ccc",itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function Jke(e){var t=Va(e,Zke),r=cAe(),n=aNe(),i=nke(),{width:a,height:o,wrapperStyle:c,portal:h}=t,[f,m]=YY([r]),y=Z4(),w=J4();if(y==null||w==null)return null;var A=y-((i==null?void 0:i.left)||0)-((i==null?void 0:i.right)||0),S=Qke(t.layout,o,a,A),j=h?c:Ig(Ig({position:"absolute",width:(S==null?void 0:S.width)||a||"auto",height:(S==null?void 0:S.height)||o||"auto"},Kke(c,t,i,y,w,f)),c),T=h??n;if(T==null||r==null)return null;var D=I.createElement("div",{className:"recharts-legend-wrapper",style:j,ref:m},I.createElement(Yke,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!h&&I.createElement(Xke,{width:f.width,height:f.height}),I.createElement(Wke,$j({},t,S,{margin:i,chartWidth:y,chartHeight:w,contextPayload:r})));return JN.createPortal(D,T)}var FX=I.memo(Jke,Nm);FX.displayName="Legend";function Hj(){return Hj=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=w0.separator,contentStyle:r,itemStyle:n,labelStyle:i=w0.labelStyle,payload:a,formatter:o,itemSorter:c,wrapperClassName:h,labelClassName:f,label:m,labelFormatter:y,accessibilityLayer:w=w0.accessibilityLayer}=e,A=()=>{if(a&&a.length){var X={padding:0,margin:0},q=i_e(a,c),B=q.map((z,F)=>{if(!z||z.type==="none")return null;var $=z.formatter||o||n_e,{value:J,name:Q}=z,K=J,me=Q;if($){var re=$(J,Q,z,F,a);if(Array.isArray(re))[K,me]=re;else if(re!=null)K=re;else return null}var le=l1(l1({},w0.itemStyle),{},{color:z.color||w0.itemStyle.color},n);return I.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(F),style:le},Gu(me)?I.createElement("span",{className:"recharts-tooltip-item-name"},me):null,Gu(me)?I.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,I.createElement("span",{className:"recharts-tooltip-item-value"},K),I.createElement("span",{className:"recharts-tooltip-item-unit"},z.unit||""))});return I.createElement("ul",{className:"recharts-tooltip-item-list",style:X},B)}return null},S=l1(l1({},w0.contentStyle),r),j=l1({margin:0},i),T=!xs(m),D=T?m:"",V=Mi("recharts-default-tooltip",h),U=Mi("recharts-tooltip-label",f);T&&y&&a!==void 0&&a!==null&&(D=y(m,a));var G=w?{role:"status","aria-live":"assertive"}:{};return I.createElement("div",Hj({className:V,style:S},G),I.createElement("p",{className:U,style:j},I.isValidElement(D)?D:"".concat(D)),A())},c1="recharts-tooltip-wrapper",a_e={visibility:"hidden"};function o_e(e){var{coordinate:t,translateX:r,translateY:n}=e;return Mi(c1,{["".concat(c1,"-right")]:wr(r)&&t&&wr(t.x)&&r>=t.x,["".concat(c1,"-left")]:wr(r)&&t&&wr(t.x)&&r=t.y,["".concat(c1,"-top")]:wr(n)&&t&&wr(t.y)&&n0?i:0),y=r[n]+i;if(t[n])return o[n]?m:y;var w=h[n];if(w==null)return 0;if(o[n]){var A=m,S=w;return AT?Math.max(m,w):Math.max(y,w)}function l_e(e){var{translateX:t,translateY:r,useTranslate3d:n}=e;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function c_e(e){var{allowEscapeViewBox:t,coordinate:r,offsetTop:n,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:c,useTranslate3d:h,viewBox:f}=e,m,y,w;return c.height>0&&c.width>0&&r?(y=IU({allowEscapeViewBox:t,coordinate:r,key:"x",offset:i,position:a,reverseDirection:o,tooltipDimension:c.width,viewBox:f,viewBoxDimension:f.width}),w=IU({allowEscapeViewBox:t,coordinate:r,key:"y",offset:n,position:a,reverseDirection:o,tooltipDimension:c.height,viewBox:f,viewBoxDimension:f.height}),m=l_e({translateX:y,translateY:w,useTranslate3d:h})):m=a_e,{cssProperties:m,cssClasses:o_e({translateX:y,translateY:w,coordinate:r})}}var u_e=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),gb={isSsr:u_e()};function $X(){var[e,t]=I.useState(()=>gb.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return I.useEffect(()=>{if(window.matchMedia){var r=window.matchMedia("(prefers-reduced-motion: reduce)"),n=()=>{t(r.matches)};return r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}}},[]),e}function TU(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function N0(e){for(var t=1;t({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}));I.useEffect(()=>{var S=j=>{if(j.key==="Escape"){var T,D,V,U;f({dismissed:!0,dismissedAtCoordinate:{x:(T=(D=e.coordinate)===null||D===void 0?void 0:D.x)!==null&&T!==void 0?T:0,y:(V=(U=e.coordinate)===null||U===void 0?void 0:U.y)!==null&&V!==void 0?V:0}})}};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[(t=e.coordinate)===null||t===void 0?void 0:t.x,(r=e.coordinate)===null||r===void 0?void 0:r.y]),h.dismissed&&(((n=(i=e.coordinate)===null||i===void 0?void 0:i.x)!==null&&n!==void 0?n:0)!==h.dismissedAtCoordinate.x||((a=(o=e.coordinate)===null||o===void 0?void 0:o.y)!==null&&a!==void 0?a:0)!==h.dismissedAtCoordinate.y)&&f(N0(N0({},h),{},{dismissed:!1}));var{cssClasses:m,cssProperties:y}=c_e({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset=="number"?e.offset:e.offset.x,offsetTop:typeof e.offset=="number"?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),w=e.hasPortalFromProps?{}:N0(N0({transition:p_e({prefersReducedMotion:c,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},y),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),A=N0(N0({},w),{},{visibility:!h.dismissed&&e.active&&e.hasPayload?"visible":"hidden"},e.wrapperStyle);return I.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:m,style:A,ref:e.innerRef},e.children)}var g_e=I.memo(m_e),HX=()=>{var e;return(e=Xr(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Gj(){return Gj=Object.assign?Object.assign.bind():function(e){for(var t=1;tWn(e.x)&&Wn(e.y),DU=e=>e.base!=null&&bN(e.base)&&bN(e),u1=e=>e.x,d1=e=>e.y,v_e=(e,t)=>{if(typeof e=="function")return e;var r="curve".concat(ub(e));if((r==="curveMonotone"||r==="curveBump")&&t){var n=RU["".concat(r).concat(t==="vertical"?"Y":"X")];if(n)return n}return RU[r]||WE},MU={connectNulls:!1,type:"linear"},w_e=e=>{var{type:t=MU.type,points:r=[],baseLine:n,layout:i,connectNulls:a=MU.connectNulls}=e,o=v_e(t,i),c=a?r.filter(bN):r;if(Array.isArray(n)){var h,f=r.map((S,j)=>OU(OU({},S),{},{base:n[j]}));i==="vertical"?h=Jv().y(d1).x1(u1).x0(S=>S.base.x):h=Jv().x(u1).y1(d1).y0(S=>S.base.y);var m=h.defined(DU).curve(o),y=a?f.filter(DU):f;return m(y)}var w;i==="vertical"&&wr(n)?w=Jv().y(d1).x1(u1).x0(n):wr(n)?w=Jv().x(u1).y1(d1).y0(n):w=yY().x(u1).y(d1);var A=w.defined(bN).curve(o);return A(c)},ey=e=>{var{className:t,points:r,path:n,pathRef:i}=e,a=Mf();if((!r||!r.length)&&!n)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},c=r&&r.length?w_e(o):n;return I.createElement("path",Gj({},Wl(e),z4(e),{className:Mi("recharts-curve",t),d:c===null?void 0:c,ref:i}))},N_e=["x","y","top","left","width","height","className"];function qj(){return qj=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(n,"M").concat(a,",").concat(t,"h").concat(r),I_e=e=>{var{x:t=0,y:r=0,top:n=0,left:i=0,width:a=0,height:o=0,className:c}=e,h=S_e(e,N_e),f=E_e({x:t,y:r,top:n,left:i,width:a,height:o},h);return!wr(t)||!wr(r)||!wr(a)||!wr(o)||!wr(n)||!wr(i)?null:I.createElement("path",qj({},jo(f),{className:Mi("recharts-cross",c),d:j_e(t,r,a,o,n,i)}))};function T_e(e,t,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-i,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function UU(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function BU(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),GX=(e,t,r)=>e.map(n=>"".concat(D_e(n)," ").concat(t,"ms ").concat(r)).join(","),M_e=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((r,n)=>r.filter(i=>n.includes(i))),Iy=(e,t)=>Object.keys(t).reduce((r,n)=>BU(BU({},r),{},{[n]:e(n,t[n])}),{});function zU(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Aa(e){for(var t=1;te+(t-e)*r,Wj=e=>{var{from:t,to:r}=e;return t!==r},qX=(e,t,r)=>{var n=Iy((i,a)=>{if(Wj(a)){var[o,c]=e(a.from,a.to,a.velocity);return Aa(Aa({},a),{},{from:o,velocity:c})}return a},t);return r<1?Iy((i,a)=>Wj(a)&&n[i]!=null?Aa(Aa({},a),{},{velocity:vN(a.velocity,n[i].velocity,r),from:vN(a.from,n[i].from,r)}):a,t):qX(e,n,r-1)};function z_e(e,t,r,n,i,a){var o,c=n.reduce((w,A)=>Aa(Aa({},w),{},{[A]:{from:e[A],velocity:0,to:t[A]}}),{}),h=()=>Iy((w,A)=>A.from,c),f=()=>!Object.values(c).filter(Wj).length,m=null,y=w=>{o||(o=w);var A=w-o,S=A/r.dt;c=qX(r,c,S),i(Aa(Aa(Aa({},e),t),h())),o=w,f()||(m=a.setTimeout(y))};return()=>(m=a.setTimeout(y),()=>{var w;(w=m)===null||w===void 0||w()})}function V_e(e,t,r,n,i,a,o){var c=null,h=i.reduce((y,w)=>{var A=e[w],S=t[w];return A==null||S==null?y:Aa(Aa({},y),{},{[w]:[A,S]})},{}),f,m=y=>{f||(f=y);var w=(y-f)/n,A=Iy((j,T)=>vN(...T,r(w)),h);if(a(Aa(Aa(Aa({},e),t),A)),w<1)c=o.setTimeout(m);else{var S=Iy((j,T)=>vN(...T,r(1)),h);a(Aa(Aa(Aa({},e),t),S))}};return()=>(c=o.setTimeout(m),()=>{var y;(y=c)===null||y===void 0||y()})}const F_e=(e,t,r,n,i,a)=>{var o=M_e(e,t);return r==null?()=>(i(Aa(Aa({},e),t)),()=>{}):r.isStepper===!0?z_e(e,t,r,o,i,a):V_e(e,t,r,n,o,i,a)};var wN=1e-4,WX=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],KX=(e,t)=>e.map((r,n)=>r*t**n).reduce((r,n)=>r+n),VU=(e,t)=>r=>{var n=WX(e,t);return KX(n,r)},$_e=(e,t)=>r=>{var n=WX(e,t),i=[...n.map((a,o)=>a*o).slice(1),0];return KX(i,r)},H_e=e=>{var t,r=e.split("(");if(r.length!==2||r[0]!=="cubic-bezier")return null;var n=(t=r[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(n==null||n.length!==4)return null;var i=n.map(a=>parseFloat(a));return[i[0],i[1],i[2],i[3]]},G_e=function(){for(var t=arguments.length,r=new Array(t),n=0;n{var i=VU(e,r),a=VU(t,n),o=$_e(e,r),c=f=>f>1?1:f<0?0:f,h=f=>{for(var m=f>1?1:f,y=m,w=0;w<8;++w){var A=i(y)-m,S=o(y);if(Math.abs(A-m)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:r=100,damping:n=8,dt:i=17}=t,a=(o,c,h)=>{var f=-(o-c)*r,m=h*n,y=h+(f-m)*i/1e3,w=h*i/1e3+o;return Math.abs(w-c){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return FU(e);case"spring":return W_e();default:if(e.split("(")[0]==="cubic-bezier")return FU(e)}return typeof e=="function"?e:null};function Y_e(e){var t,r=()=>null,n=!1,i=null,a=o=>{if(!n){if(Array.isArray(o)){if(!o.length)return;var c=o,[h,...f]=c;if(typeof h=="number"){i=e.setTimeout(a.bind(null,f),h);return}a(h),i=e.setTimeout(a.bind(null,f));return}typeof o=="string"&&(t=o,r(t)),typeof o=="object"&&(t=o,r(t)),typeof o=="function"&&o()}};return{stop:()=>{n=!0},start:o=>{n=!1,i&&(i(),i=null),a(o)},subscribe:o=>(r=o,()=>{r=()=>null}),getTimeoutController:()=>e}}class X_e{setTimeout(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),i=null,a=o=>{o-n>=r?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{i!=null&&cancelAnimationFrame(i)}}}function Q_e(){return Y_e(new X_e)}var Z_e=I.createContext(Q_e);function J_e(e,t){var r=I.useContext(Z_e);return I.useMemo(()=>t??r(e),[e,t,r])}var eSe={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},$U={t:0},lS={t:1};function xb(e){var t=Va(e,eSe),{isActive:r,canBegin:n,duration:i,easing:a,begin:o,onAnimationEnd:c,onAnimationStart:h,children:f}=t,m=$X(),y=r==="auto"?!gb.isSsr&&!m:r,w=J_e(t.animationId,t.animationManager),[A,S]=I.useState(y?$U:lS),j=I.useRef(null);return I.useEffect(()=>{y||S(lS)},[y]),I.useEffect(()=>{if(!y||!n)return Df;var T=F_e($U,lS,K_e(a),i,S,w.getTimeoutController()),D=()=>{j.current=T()};return w.start([h,o,D,i,c]),()=>{w.stop(),j.current&&j.current(),c()}},[y,n,i,a,o,h,c,w]),f(A.t)}function yb(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",r=I.useRef(Ey(t)),n=I.useRef(e);return n.current!==e&&(r.current=Ey(t),n.current=e),r.current}var tSe=["radius"],rSe=["radius"],HU,GU,qU,WU,KU,YU,XU,QU,ZU,JU;function eB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function tB(e){for(var t=1;t{var a=of(r),o=of(n),c=Math.min(Math.abs(a)/2,Math.abs(o)/2),h=o>=0?1:-1,f=a>=0?1:-1,m=o>=0&&a>=0||o<0&&a<0?1:0,y;if(c>0&&Array.isArray(i)){for(var w=[0,0,0,0],A=0,S=4;Ac?c:T}y=Hs(HU||(HU=mu(["M",",",""])),e,t+h*w[0]),w[0]>0&&(y+=Hs(GU||(GU=mu(["A ",",",",0,0,",",",",",""])),w[0],w[0],m,e+f*w[0],t)),y+=Hs(qU||(qU=mu(["L ",",",""])),e+r-f*w[1],t),w[1]>0&&(y+=Hs(WU||(WU=mu(["A ",",",",0,0,",`, `,",",""])),w[1],w[1],m,e+r,t+h*w[1])),y+=Hs(KU||(KU=mu(["L ",",",""])),e+r,t+n-h*w[2]),w[2]>0&&(y+=Hs(YU||(YU=mu(["A ",",",",0,0,",`, `,",",""])),w[2],w[2],m,e+r-f*w[2],t+n)),y+=Hs(XU||(XU=mu(["L ",",",""])),e+f*w[3],t+n),w[3]>0&&(y+=Hs(QU||(QU=mu(["A ",",",",0,0,",`, `,",",""])),w[3],w[3],m,e,t+n-h*w[3])),y+="Z"}else if(c>0&&i===+i&&i>0){var D=Math.min(c,i);y=Hs(ZU||(ZU=mu(["M ",",",` A `,",",",0,0,",",",",",` L `,",",` A `,",",",0,0,",",",",",` L `,",",` A `,",",",0,0,",",",",",` L `,",",` A `,",",",0,0,",",",","," Z"])),e,t+h*D,D,D,m,e+f*D,t,e+r-f*D,t,D,D,m,e+r,t+h*D,e+r,t+n-h*D,D,D,m,e+r-f*D,t+n,e+f*D,t+n,D,D,m,e,t+n-h*D)}else y=Hs(JU||(JU=mu(["M ",","," h "," v "," h "," Z"])),e,t,r,n,-r);return y},iB={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},YX=e=>{var t=Va(e,iB),r=I.useRef(null),[n,i]=I.useState(-1);I.useEffect(()=>{if(r.current&&r.current.getTotalLength)try{var ve=r.current.getTotalLength();ve&&i(ve)}catch{}},[]);var{x:a,y:o,width:c,height:h,radius:f,className:m}=t,{animationEasing:y,animationDuration:w,animationBegin:A,isAnimationActive:S,isUpdateAnimationActive:j}=t,T=I.useRef(c),D=I.useRef(h),V=I.useRef(a),U=I.useRef(o),G=I.useMemo(()=>({x:a,y:o,width:c,height:h,radius:f}),[a,o,c,h,f]),X=yb(G,"rectangle-");if(a!==+a||o!==+o||c!==+c||h!==+h||c===0||h===0)return null;var q=Mi("recharts-rectangle",m);if(!j){var B=jo(t),{radius:z}=B,F=rB(B,tSe);return I.createElement("path",NN({},F,{x:of(a),y:of(o),width:of(c),height:of(h),radius:typeof f=="number"?f:void 0,className:q,d:nB(a,o,c,h,f)}))}var $=T.current,J=D.current,Q=V.current,K=U.current,me="0px ".concat(n===-1?1:n,"px"),re="".concat(n,"px ").concat(n,"px"),le=GX(["strokeDasharray"],w,typeof y=="string"?y:iB.animationEasing);return I.createElement(xb,{animationId:X,key:X,canBegin:n>0,duration:w,easing:y,isActive:j,begin:A},ve=>{var je=Qi($,c,ve),Ve=Qi(J,h,ve),Z=Qi(Q,a,ve),se=Qi(K,o,ve);r.current&&(T.current=je,D.current=Ve,V.current=Z,U.current=se);var xe;S?ve>0?xe={transition:le,strokeDasharray:re}:xe={strokeDasharray:me}:xe={strokeDasharray:re};var ae=jo(t),{radius:qe}=ae,pt=rB(ae,rSe);return I.createElement("path",NN({},pt,{radius:typeof f=="number"?f:void 0,className:q,d:nB(Z,se,je,Ve,f),ref:r,style:tB(tB({},xe),t.style)}))})};function sB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function aB(e){for(var t=1;te*180/Math.PI,lo=(e,t,r,n)=>({x:e+Math.cos(-EN*n)*r,y:t+Math.sin(-EN*n)*r}),dSe=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},hSe=(e,t)=>{var{x:r,y:n}=e,{x:i,y:a}=t;return Math.sqrt((r-i)**2+(n-a)**2)},fSe=(e,t)=>{var{x:r,y:n}=e,{cx:i,cy:a}=t,o=hSe({x:r,y:n},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var c=(r-i)/o,h=Math.acos(c);return n>a&&(h=2*Math.PI-h),{radius:o,angle:uSe(h),angleInRadian:h}},pSe=e=>{var{startAngle:t,endAngle:r}=e,n=Math.floor(t/360),i=Math.floor(r/360),a=Math.min(n,i);return{startAngle:t-a*360,endAngle:r-a*360}},mSe=(e,t)=>{var{startAngle:r,endAngle:n}=t,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return e+o*360},gSe=(e,t)=>{var{relativeX:r,relativeY:n}=e,{radius:i,angle:a}=fSe({x:r,y:n},t),{innerRadius:o,outerRadius:c}=t;if(ic||i===0)return null;var{startAngle:h,endAngle:f}=pSe(t),m=a,y;if(h<=f){for(;m>f;)m-=360;for(;m=h&&m<=f}else{for(;m>h;)m-=360;for(;m=f&&m<=h}return y?aB(aB({},t),{},{radius:i,angle:mSe(m,t)}):null};function XX(e){var{cx:t,cy:r,radius:n,startAngle:i,endAngle:a}=e,o=lo(t,r,n,i),c=lo(t,r,n,a);return{points:[o,c],cx:t,cy:r,radius:n,startAngle:i,endAngle:a}}var oB,lB,cB,uB,dB,hB,fB;function Kj(){return Kj=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=fl(t-e),n=Math.min(Math.abs(t-e),359.999);return r*n},ow=e=>{var{cx:t,cy:r,radius:n,angle:i,sign:a,isExternal:o,cornerRadius:c,cornerIsExternal:h}=e,f=c*(o?1:-1)+n,m=Math.asin(c/f)/EN,y=h?i:i+a*m,w=lo(t,r,f,y),A=lo(t,r,n,y),S=h?i-a*m:i,j=lo(t,r,f*Math.cos(m*EN),S);return{center:w,circleTangency:A,lineTangency:j,theta:m}},QX=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:a,endAngle:o}=e,c=xSe(a,o),h=a+c,f=lo(t,r,i,a),m=lo(t,r,i,h),y=Hs(oB||(oB=kp(["M ",",",` A `,",",`,0, `,",",`, `,",",` `])),f.x,f.y,i,i,+(Math.abs(c)>180),+(a>h),m.x,m.y);if(n>0){var w=lo(t,r,n,a),A=lo(t,r,n,h);y+=Hs(lB||(lB=kp(["L ",",",` A `,",",`,0, `,",",`, `,","," Z"])),A.x,A.y,n,n,+(Math.abs(c)>180),+(a<=h),w.x,w.y)}else y+=Hs(cB||(cB=kp(["L ",","," Z"])),t,r);return y},ySe=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:c,startAngle:h,endAngle:f}=e,m=fl(f-h),{circleTangency:y,lineTangency:w,theta:A}=ow({cx:t,cy:r,radius:i,angle:h,sign:m,cornerRadius:a,cornerIsExternal:c}),{circleTangency:S,lineTangency:j,theta:T}=ow({cx:t,cy:r,radius:i,angle:f,sign:-m,cornerRadius:a,cornerIsExternal:c}),D=c?Math.abs(h-f):Math.abs(h-f)-A-T;if(D<0)return o?Hs(uB||(uB=kp(["M ",",",` a`,",",",0,0,1,",`,0 a`,",",",0,0,1,",`,0 `])),w.x,w.y,a,a,a*2,a,a,-a*2):QX({cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:h,endAngle:f});var V=Hs(dB||(dB=kp(["M ",",",` A`,",",",0,0,",",",",",` A`,",",",0,",",",",",",",` A`,",",",0,0,",",",",",` `])),w.x,w.y,a,a,+(m<0),y.x,y.y,i,i,+(D>180),+(m<0),S.x,S.y,a,a,+(m<0),j.x,j.y);if(n>0){var{circleTangency:U,lineTangency:G,theta:X}=ow({cx:t,cy:r,radius:n,angle:h,sign:m,isExternal:!0,cornerRadius:a,cornerIsExternal:c}),{circleTangency:q,lineTangency:B,theta:z}=ow({cx:t,cy:r,radius:n,angle:f,sign:-m,isExternal:!0,cornerRadius:a,cornerIsExternal:c}),F=c?Math.abs(h-f):Math.abs(h-f)-X-z;if(F<0&&a===0)return"".concat(V,"L").concat(t,",").concat(r,"Z");V+=Hs(hB||(hB=kp(["L",",",` A`,",",",0,0,",",",",",` A`,",",",0,",",",",",",",` A`,",",",0,0,",",",",","Z"])),B.x,B.y,a,a,+(m<0),q.x,q.y,n,n,+(F>180),+(m>0),U.x,U.y,a,a,+(m<0),G.x,G.y)}else V+=Hs(fB||(fB=kp(["L",",","Z"])),t,r);return V},bSe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},ZX=e=>{var t=Va(e,bSe),{cx:r,cy:n,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:c,cornerIsExternal:h,startAngle:f,endAngle:m,className:y}=t;if(a0&&Math.abs(f-m)<360?j=ySe({cx:r,cy:n,innerRadius:i,outerRadius:a,cornerRadius:Math.min(S,A/2),forceCornerRadius:c,cornerIsExternal:h,startAngle:f,endAngle:m}):j=QX({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:f,endAngle:m}),I.createElement("path",Kj({},jo(t),{className:w,d:j}))};function vSe(e,t,r){if(e==="horizontal")return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if(e==="vertical")return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(OY(t)){if(e==="centric"){var{cx:n,cy:i,innerRadius:a,outerRadius:o,angle:c}=t,h=lo(n,i,a,c),f=lo(n,i,o,c);return[{x:h.x,y:h.y},{x:f.x,y:f.y}]}return XX(t)}}var cS={},uS={},dS={},pB;function wSe(){return pB||(pB=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=qY();function r(n){return t.isSymbol(n)?NaN:Number(n)}e.toNumber=r})(dS)),dS}var mB;function NSe(){return mB||(mB=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=wSe();function r(n){return n?(n=t.toNumber(n),n===1/0||n===-1/0?(n<0?-1:1)*Number.MAX_VALUE:n===n?n:0):n===0?n:0}e.toFinite=r})(uS)),uS}var gB;function ESe(){return gB||(gB=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=WY(),r=NSe();function n(i,a,o){o&&typeof o!="number"&&t.isIterateeCall(i,a,o)&&(a=o=void 0),i=r.toFinite(i),a===void 0?(a=i,i=0):a=r.toFinite(a),o=o===void 0?ie.chartData,n3=et([Jc],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),bb=(e,t,r,n)=>n?n3(e):Jc(e),eQ=(e,t,r)=>r?n3(e):Jc(e),_Se=et([bb],e=>{var{chartData:t,dataStartIndex:r,dataEndIndex:n}=e;return t!=null?t.slice(r,n+1):[]});et([n3],e=>{var{chartData:t,dataStartIndex:r,dataEndIndex:n}=e;return t!=null?t.slice(r,n+1):[]});var SSe=et([Jc],e=>{var{chartData:t,dataStartIndex:r,dataEndIndex:n}=e;return t!=null?t.slice(r,n+1):[]});function Uu(e){if(Array.isArray(e)&&e.length===2){var[t,r]=e;if(Wn(t)&&Wn(r))return!0}return!1}function yB(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function tQ(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[r,n]=e,i,a;if(Wn(r))i=r;else if(typeof r=="function")return;if(Wn(n))a=n;else if(typeof n=="function")return;var o=[i,a];if(Uu(o))return o}}function CSe(e,t,r){if(!(!r&&t==null)){if(typeof e=="function"&&t!=null)try{var n=e(t,r);if(Uu(n))return yB(n,t,r)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,c;if(i==="auto")t!=null&&(o=Math.min(...t));else if(wr(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&oU.test(i)){var h=oU.exec(i);if(h==null||h[1]==null||t==null)o=void 0;else{var f=+h[1];o=t[0]-f}}else o=t==null?void 0:t[0];if(a==="auto")t!=null&&(c=Math.max(...t));else if(wr(a))c=a;else if(typeof a=="function")try{t!=null&&(c=a(t==null?void 0:t[1]))}catch{}else if(typeof a=="string"&&lU.test(a)){var m=lU.exec(a);if(m==null||m[1]==null||t==null)c=void 0;else{var y=+m[1];c=t[1]+y}}else c=t==null?void 0:t[1];var w=[o,c];if(Uu(w))return t==null?w:yB(w,t,r)}}}var Xg=1e9,jSe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},s3,ks=!0,Ec="[DecimalError] ",zp=Ec+"Invalid argument: ",i3=Ec+"Exponent out of range: ",Qg=Math.floor,hp=Math.pow,ISe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ll,Ba=1e7,ms=7,rQ=9007199254740991,AN=Qg(rQ/ms),Pr={};Pr.absoluteValue=Pr.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Pr.comparedTo=Pr.cmp=function(e){var t,r,n,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(n=a.d.length,i=e.d.length,t=0,r=ne.d[t]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};Pr.decimalPlaces=Pr.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*ms;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Pr.dividedBy=Pr.div=function(e){return Rd(this,new this.constructor(e))};Pr.dividedToIntegerBy=Pr.idiv=function(e){var t=this,r=t.constructor;return es(Rd(t,new r(e),0,1),r.precision)};Pr.equals=Pr.eq=function(e){return!this.cmp(e)};Pr.exponent=function(){return da(this)};Pr.greaterThan=Pr.gt=function(e){return this.cmp(e)>0};Pr.greaterThanOrEqualTo=Pr.gte=function(e){return this.cmp(e)>=0};Pr.isInteger=Pr.isint=function(){return this.e>this.d.length-2};Pr.isNegative=Pr.isneg=function(){return this.s<0};Pr.isPositive=Pr.ispos=function(){return this.s>0};Pr.isZero=function(){return this.s===0};Pr.lessThan=Pr.lt=function(e){return this.cmp(e)<0};Pr.lessThanOrEqualTo=Pr.lte=function(e){return this.cmp(e)<1};Pr.logarithm=Pr.log=function(e){var t,r=this,n=r.constructor,i=n.precision,a=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Ll))throw Error(Ec+"NaN");if(r.s<1)throw Error(Ec+(r.s?"NaN":"-Infinity"));return r.eq(Ll)?new n(0):(ks=!1,t=Rd(Ty(r,a),Ty(e,a),a),ks=!0,es(t,i))};Pr.minus=Pr.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?sQ(t,e):nQ(t,(e.s=-e.s,e))};Pr.modulo=Pr.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(Ec+"NaN");return r.s?(ks=!1,t=Rd(r,e,0,1).times(e),ks=!0,r.minus(t)):es(new n(r),i)};Pr.naturalExponential=Pr.exp=function(){return iQ(this)};Pr.naturalLogarithm=Pr.ln=function(){return Ty(this)};Pr.negated=Pr.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Pr.plus=Pr.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?nQ(t,e):sQ(t,(e.s=-e.s,e))};Pr.precision=Pr.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(zp+e);if(t=da(i)+1,n=i.d.length-1,r=n*ms+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};Pr.squareRoot=Pr.sqrt=function(){var e,t,r,n,i,a,o,c=this,h=c.constructor;if(c.s<1){if(!c.s)return new h(0);throw Error(Ec+"NaN")}for(e=da(c),ks=!1,i=Math.sqrt(+c),i==0||i==1/0?(t=Ou(c.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=Qg((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new h(t)):n=new h(i.toString()),r=h.precision,i=o=r+3;;)if(a=n,n=a.plus(Rd(c,a,o+2)).times(.5),Ou(a.d).slice(0,o)===(t=Ou(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(es(a,r+1,0),a.times(a).eq(c)){n=a;break}}else if(t!="9999")break;o+=4}return ks=!0,es(n,r)};Pr.times=Pr.mul=function(e){var t,r,n,i,a,o,c,h,f,m=this,y=m.constructor,w=m.d,A=(e=new y(e)).d;if(!m.s||!e.s)return new y(0);for(e.s*=m.s,r=m.e+e.e,h=w.length,f=A.length,h=0;){for(t=0,i=h+n;i>n;)c=a[i]+A[n]*w[i-n-1]+t,a[i--]=c%Ba|0,t=c/Ba|0;a[i]=(a[i]+t)%Ba|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,ks?es(e,y.precision):e};Pr.toDecimalPlaces=Pr.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Wu(e,0,Xg),t===void 0?t=n.rounding:Wu(t,0,8),es(r,e+da(r)+1,t))};Pr.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=hm(n,!0):(Wu(e,0,Xg),t===void 0?t=i.rounding:Wu(t,0,8),n=es(new i(n),e+1,t),r=hm(n,!0,e+1)),r};Pr.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?hm(i):(Wu(e,0,Xg),t===void 0?t=a.rounding:Wu(t,0,8),n=es(new a(i),e+da(i)+1,t),r=hm(n.abs(),!1,e+da(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};Pr.toInteger=Pr.toint=function(){var e=this,t=e.constructor;return es(new t(e),da(e)+1,t.rounding)};Pr.toNumber=function(){return+this};Pr.toPower=Pr.pow=function(e){var t,r,n,i,a,o,c=this,h=c.constructor,f=12,m=+(e=new h(e));if(!e.s)return new h(Ll);if(c=new h(c),!c.s){if(e.s<1)throw Error(Ec+"Infinity");return c}if(c.eq(Ll))return c;if(n=h.precision,e.eq(Ll))return es(c,n);if(t=e.e,r=e.d.length-1,o=t>=r,a=c.s,o){if((r=m<0?-m:m)<=rQ){for(i=new h(Ll),t=Math.ceil(n/ms+4),ks=!1;r%2&&(i=i.times(c),vB(i.d,t)),r=Qg(r/2),r!==0;)c=c.times(c),vB(c.d,t);return ks=!0,e.s<0?new h(Ll).div(i):es(i,n)}}else if(a<0)throw Error(Ec+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,c.s=1,ks=!1,i=e.times(Ty(c,n+f)),ks=!0,i=iQ(i),i.s=a,i};Pr.toPrecision=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?(r=da(i),n=hm(i,r<=a.toExpNeg||r>=a.toExpPos)):(Wu(e,1,Xg),t===void 0?t=a.rounding:Wu(t,0,8),i=es(new a(i),e,t),r=da(i),n=hm(i,e<=r||r<=a.toExpNeg,e)),n};Pr.toSignificantDigits=Pr.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Wu(e,1,Xg),t===void 0?t=n.rounding:Wu(t,0,8)),es(new n(r),e,t)};Pr.toString=Pr.valueOf=Pr.val=Pr.toJSON=Pr[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=da(e),r=e.constructor;return hm(e,t<=r.toExpNeg||t>=r.toExpPos)};function nQ(e,t){var r,n,i,a,o,c,h,f,m=e.constructor,y=m.precision;if(!e.s||!t.s)return t.s||(t=new m(e)),ks?es(t,y):t;if(h=e.d,f=t.d,o=e.e,i=t.e,h=h.slice(),a=o-i,a){for(a<0?(n=h,a=-a,c=f.length):(n=f,i=o,c=h.length),o=Math.ceil(y/ms),c=o>c?o+1:c+1,a>c&&(a=c,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(c=h.length,a=f.length,c-a<0&&(a=c,n=f,f=h,h=n),r=0;a;)r=(h[--a]=h[a]+f[a]+r)/Ba|0,h[a]%=Ba;for(r&&(h.unshift(r),++i),c=h.length;h[--c]==0;)h.pop();return t.d=h,t.e=i,ks?es(t,y):t}function Wu(e,t,r){if(e!==~~e||er)throw Error(zp+e)}function Ou(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(c=h=0;ci[c]?1:-1;break}return h}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]1;)n.shift()}return function(n,i,a,o){var c,h,f,m,y,w,A,S,j,T,D,V,U,G,X,q,B,z,F=n.constructor,$=n.s==i.s?1:-1,J=n.d,Q=i.d;if(!n.s)return new F(n);if(!i.s)throw Error(Ec+"Division by zero");for(h=n.e-i.e,B=Q.length,X=J.length,A=new F($),S=A.d=[],f=0;Q[f]==(J[f]||0);)++f;if(Q[f]>(J[f]||0)&&--h,a==null?V=a=F.precision:o?V=a+(da(n)-da(i))+1:V=a,V<0)return new F(0);if(V=V/ms+2|0,f=0,B==1)for(m=0,Q=Q[0],V++;(f1&&(Q=e(Q,m),J=e(J,m),B=Q.length,X=J.length),G=B,j=J.slice(0,B),T=j.length;T=Ba/2&&++q;do m=0,c=t(Q,j,B,T),c<0?(D=j[0],B!=T&&(D=D*Ba+(j[1]||0)),m=D/q|0,m>1?(m>=Ba&&(m=Ba-1),y=e(Q,m),w=y.length,T=j.length,c=t(y,j,w,T),c==1&&(m--,r(y,B16)throw Error(i3+da(e));if(!e.s)return new m(Ll);for(ks=!1,c=y,o=new m(.03125);e.abs().gte(.1);)e=e.times(o),f+=5;for(n=Math.log(hp(2,f))/Math.LN10*2+5|0,c+=n,r=i=a=new m(Ll),m.precision=c;;){if(i=es(i.times(e),c),r=r.times(++h),o=a.plus(Rd(i,r,c)),Ou(o.d).slice(0,c)===Ou(a.d).slice(0,c)){for(;f--;)a=es(a.times(a),c);return m.precision=y,t==null?(ks=!0,es(a,y)):a}a=o}}function da(e){for(var t=e.e*ms,r=e.d[0];r>=10;r/=10)t++;return t}function fS(e,t,r){if(t>e.LN10.sd())throw ks=!0,r&&(e.precision=r),Error(Ec+"LN10 precision limit exceeded");return es(new e(e.LN10),t)}function Kh(e){for(var t="";e--;)t+="0";return t}function Ty(e,t){var r,n,i,a,o,c,h,f,m,y=1,w=10,A=e,S=A.d,j=A.constructor,T=j.precision;if(A.s<1)throw Error(Ec+(A.s?"NaN":"-Infinity"));if(A.eq(Ll))return new j(0);if(t==null?(ks=!1,f=T):f=t,A.eq(10))return t==null&&(ks=!0),fS(j,f);if(f+=w,j.precision=f,r=Ou(S),n=r.charAt(0),a=da(A),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)A=A.times(e),r=Ou(A.d),n=r.charAt(0),y++;a=da(A),n>1?(A=new j("0."+r),a++):A=new j(n+"."+r.slice(1))}else return h=fS(j,f+2,T).times(a+""),A=Ty(new j(n+"."+r.slice(1)),f-w).plus(h),j.precision=T,t==null?(ks=!0,es(A,T)):A;for(c=o=A=Rd(A.minus(Ll),A.plus(Ll),f),m=es(A.times(A),f),i=3;;){if(o=es(o.times(m),f),h=c.plus(Rd(o,new j(i),f)),Ou(h.d).slice(0,f)===Ou(c.d).slice(0,f))return c=c.times(2),a!==0&&(c=c.plus(fS(j,f+2,T).times(a+""))),c=Rd(c,new j(y),f),j.precision=T,t==null?(ks=!0,es(c,T)):c;c=h,i+=2}}function bB(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=Qg(r/ms),e.d=[],n=(r+1)%ms,r<0&&(n+=ms),nAN||e.e<-AN))throw Error(i3+r)}else e.s=0,e.e=0,e.d=[0];return e}function es(e,t,r){var n,i,a,o,c,h,f,m,y=e.d;for(o=1,a=y[0];a>=10;a/=10)o++;if(n=t-o,n<0)n+=ms,i=t,f=y[m=0];else{if(m=Math.ceil((n+1)/ms),a=y.length,m>=a)return e;for(f=a=y[m],o=1;a>=10;a/=10)o++;n%=ms,i=n-ms+o}if(r!==void 0&&(a=hp(10,o-i-1),c=f/a%10|0,h=t<0||y[m+1]!==void 0||f%a,h=r<4?(c||h)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||h||r==6&&(n>0?i>0?f/hp(10,o-i):0:y[m-1])%10&1||r==(e.s<0?8:7))),t<1||!y[0])return h?(a=da(e),y.length=1,t=t-a-1,y[0]=hp(10,(ms-t%ms)%ms),e.e=Qg(-t/ms)||0):(y.length=1,y[0]=e.e=e.s=0),e;if(n==0?(y.length=m,a=1,m--):(y.length=m+1,a=hp(10,ms-n),y[m]=i>0?(f/hp(10,o-i)%hp(10,i)|0)*a:0),h)for(;;)if(m==0){(y[0]+=a)==Ba&&(y[0]=1,++e.e);break}else{if(y[m]+=a,y[m]!=Ba)break;y[m--]=0,a=1}for(n=y.length;y[--n]===0;)y.pop();if(ks&&(e.e>AN||e.e<-AN))throw Error(i3+da(e));return e}function sQ(e,t){var r,n,i,a,o,c,h,f,m,y,w=e.constructor,A=w.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new w(e),ks?es(t,A):t;if(h=e.d,y=t.d,n=t.e,f=e.e,h=h.slice(),o=f-n,o){for(m=o<0,m?(r=h,o=-o,c=y.length):(r=y,n=f,c=h.length),i=Math.max(Math.ceil(A/ms),c)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=h.length,c=y.length,m=i0;--i)h[c++]=0;for(i=y.length;i>o;){if(h[--i]0?a=a.charAt(0)+"."+a.slice(1)+Kh(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+Kh(-i-1)+a,r&&(n=r-o)>0&&(a+=Kh(n))):i>=o?(a+=Kh(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+Kh(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=Kh(n))),e.s<0?"-"+a:a}function vB(e,t){if(e.length>t)return e.length=t,!0}function aQ(e){var t,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(zp+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return bB(o,a.toString())}else if(typeof a!="string")throw Error(zp+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,ISe.test(a))bB(o,a);else throw Error(zp+a)}if(i.prototype=Pr,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=aQ,i.config=i.set=TSe,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(zp+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(zp+r+": "+n);return this}var s3=aQ(jSe);Ll=new s3(1);const hi=s3;function oQ(e){var t;return e===0?t=1:t=Math.floor(new hi(e).abs().log(10).toNumber())+1,t}function lQ(e,t,r){for(var n=new hi(e),i=0,a=[];n.lt(t)&&i<1e5;)a.push(n.toNumber()),n=n.add(r),i++;return a}var cQ=e=>{var[t,r]=e,[n,i]=[t,r];return t>r&&([n,i]=[r,t]),[n,i]},a3=(e,t,r)=>{if(e.lte(0))return new hi(0);var n=oQ(e.toNumber()),i=new hi(10).pow(n),a=e.div(i),o=n!==1?.05:.1,c=new hi(Math.ceil(a.div(o).toNumber())).add(r).mul(o),h=c.mul(i);return t?new hi(h.toNumber()):new hi(Math.ceil(h.toNumber()))},uQ=(e,t,r)=>{var n;if(e.lte(0))return new hi(0);var i=[1,2,2.5,5],a=e.toNumber(),o=Math.floor(new hi(a).abs().log(10).toNumber()),c=new hi(10).pow(o),h=e.div(c).toNumber(),f=i.findIndex(A=>A>=h-1e-10);if(f===-1&&(c=c.mul(10),f=0),f+=r,f>=i.length){var m=Math.floor(f/i.length);f%=i.length,c=c.mul(new hi(10).pow(m))}var y=(n=i[f])!==null&&n!==void 0?n:1,w=new hi(y).mul(c);return t?w:new hi(Math.ceil(w.toNumber()))},PSe=(e,t,r)=>{var n=new hi(1),i=new hi(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new hi(10).pow(oQ(e)-1),i=new hi(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new hi(Math.floor(e)))}else e===0?i=new hi(Math.floor((t-1)/2)):r||(i=new hi(Math.floor(e)));for(var o=Math.floor((t-1)/2),c=[],h=0;h4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:a3;if(!Number.isFinite((r-t)/(n-1)))return{step:new hi(0),tickMin:new hi(0),tickMax:new hi(0)};var c=o(new hi(r).sub(t).div(n-1),i,a),h;t<=0&&r>=0?h=new hi(0):(h=new hi(t).add(r).div(2),h=h.sub(new hi(h).mod(c)));var f=Math.ceil(h.sub(t).div(c).toNumber()),m=Math.ceil(new hi(r).sub(h).div(c).toNumber()),y=f+m+1;return y>n?dQ(t,r,n,i,a+1,o):(y0?m+(n-y):m,f=r>0?f:f+(n-y)),{step:c,tickMin:h.sub(new hi(f).mul(c)),tickMax:h.add(new hi(m).mul(c))})},wB=function(t){var[r,n]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",c=Math.max(i,2),[h,f]=cQ([r,n]);if(h===-1/0||f===1/0){var m=f===1/0?[h,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),f];return r>n?m.reverse():m}if(h===f)return PSe(h,i,a);var y=o==="snap125"?uQ:a3,{step:w,tickMin:A,tickMax:S}=dQ(h,f,c,a,0,y),j=lQ(A,S.add(new hi(.1).mul(w)),w);return r>n?j.reverse():j},NB=function(t,r){var[n,i]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",[c,h]=cQ([n,i]);if(c===-1/0||h===1/0)return[n,i];if(c===h)return[c];var f=o==="snap125"?uQ:a3,m=Math.max(r,2),y=f(new hi(h).sub(c).div(m-1),a,0),w=[...lQ(new hi(c),new hi(h),y),h];return a===!1&&(w=w.map(A=>Math.round(A))),n>i?w.reverse():w},hQ=e=>e.rootProps.maxBarSize,OSe=e=>e.rootProps.barGap,fQ=e=>e.rootProps.barCategoryGap,RSe=e=>e.rootProps.barSize,pA=e=>e.rootProps.stackOffset,pQ=e=>e.rootProps.reverseStackOrder,o3=e=>e.options.chartName,l3=e=>e.rootProps.syncId,mQ=e=>e.rootProps.syncMethod,c3=e=>e.options.eventEmitter,DSe=e=>e.rootProps.baseValue,ka={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},ep={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},gu={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},mA=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function gA(e,t,r){if(r!=="auto")return r;if(e!=null)return Zc(e,t)?"category":"number"}function EB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function kN(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},u3=et([BSe,RX],(e,t)=>{var r;if(e!=null)return e;var n=(r=gA(t,"angleAxis",AB.type))!==null&&r!==void 0?r:"category";return kN(kN({},AB),{},{type:n})}),zSe=(e,t)=>e.polarAxis.radiusAxis[t],d3=et([zSe,RX],(e,t)=>{var r;if(e!=null)return e;var n=(r=gA(t,"radiusAxis",kB.type))!==null&&r!==void 0?r:"category";return kN(kN({},kB),{},{type:n})}),xA=e=>e.polarOptions,h3=et([Zd,Jd,Fa],dSe),gQ=et([xA,h3],(e,t)=>{if(e!=null)return Yc(e.innerRadius,t,0)}),xQ=et([xA,h3],(e,t)=>{if(e!=null)return Yc(e.outerRadius,t,t*.8)}),VSe=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]},yQ=et([xA],VSe);et([u3,yQ],mA);var bQ=et([h3,gQ,xQ],(e,t,r)=>{if(!(e==null||t==null||r==null))return[t,r]});et([d3,bQ],mA);var vQ=et([Si,xA,gQ,xQ,Zd,Jd],(e,t,r,n,i,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||r==null||n==null)){var{cx:o,cy:c,startAngle:h,endAngle:f}=t;return{cx:Yc(o,i,i/2),cy:Yc(c,a,a/2),innerRadius:r,outerRadius:n,startAngle:h,endAngle:f,clockWise:!1}}}),Ha=(e,t)=>t,yA=(e,t,r)=>r;function bA(e){return e==null?void 0:e.id}function wQ(e,t,r){var{chartData:n=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=r,o=new Map;return e.forEach(c=>{var h,f=(h=c.data)!==null&&h!==void 0?h:n;if(!(f==null||f.length===0)){var m=bA(c);f.forEach((y,w)=>{var A=a==null||i?w:String(Rs(y,a,null)),S=Rs(y,c.dataKey,0),j;o.has(A)?j=o.get(A):j={},Object.assign(j,{[m]:S}),o.set(A,j)})}}),Array.from(o.values())}function vA(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var wA=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function NA(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function FSe(e,t){if(e.length===t.length){for(var r=0;r{var t=Si(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},Zg=e=>e.tooltip.settings.axisId;function f3(e){if(e!=null){var t=e.ticks,r=e.bandwidth,n=e.range(),i=[Math.min(...n),Math.max(...n)];return{domain:()=>e.domain(),range:(function(a){function o(){return a.apply(this,arguments)}return o.toString=function(){return a.toString()},o})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(a){var o=i[0],c=i[1];return o<=c?a>=o&&a<=c:a>=c&&a<=o},bandwidth:r?()=>r.call(e):void 0,ticks:t?a=>t.call(e,a):void 0,map:(a,o)=>{var c=e(a);if(c!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var h=e.bandwidth();switch(o.position){case"middle":c+=h/2;break;case"end":c+=h;break}}return c}}}}}var $Se=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Uu(t)){for(var r,n,i=0;in)&&(n=a))}return r!==void 0&&n!==void 0?[r,n]:void 0}return t}default:return t}};function pf(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function HSe(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function p3(e){let t,r,n;e.length!==2?(t=pf,r=(c,h)=>pf(e(c),h),n=(c,h)=>e(c)-h):(t=e===pf||e===HSe?e:GSe,r=e,n=e);function i(c,h,f=0,m=c.length){if(f>>1;r(c[y],h)<0?f=y+1:m=y}while(f>>1;r(c[y],h)<=0?f=y+1:m=y}while(ff&&n(c[y-1],h)>-n(c[y],h)?y-1:y}return{left:i,center:o,right:a}}function GSe(){return 0}function NQ(e){return e===null?NaN:+e}function*qSe(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const WSe=p3(pf),vb=WSe.right;p3(NQ).center;class _B extends Map{constructor(t,r=XSe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(SB(this,t))}has(t){return super.has(SB(this,t))}set(t,r){return super.set(KSe(this,t),r)}delete(t){return super.delete(YSe(this,t))}}function SB({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function KSe({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function YSe({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function XSe(e){return e!==null&&typeof e=="object"?e.valueOf():e}function QSe(e=pf){if(e===pf)return EQ;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function EQ(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const ZSe=Math.sqrt(50),JSe=Math.sqrt(10),eCe=Math.sqrt(2);function _N(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=ZSe?10:a>=JSe?5:a>=eCe?2:1;let c,h,f;return i<0?(f=Math.pow(10,-i)/o,c=Math.round(e*f),h=Math.round(t*f),c/ft&&--h,f=-f):(f=Math.pow(10,i)*o,c=Math.round(e/f),h=Math.round(t/f),c*ft&&--h),h0))return[];if(e===t)return[e];const n=t=i))return[];const c=a-i+1,h=new Array(c);if(n)if(o<0)for(let f=0;f=n)&&(r=n);return r}function jB(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function AQ(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?EQ:QSe(i);n>r;){if(n-r>600){const h=n-r+1,f=t-r+1,m=Math.log(h),y=.5*Math.exp(2*m/3),w=.5*Math.sqrt(m*y*(h-y)/h)*(f-h/2<0?-1:1),A=Math.max(r,Math.floor(t-f*y/h+w)),S=Math.min(n,Math.floor(t+(h-f)*y/h+w));AQ(e,t,A,S,i)}const a=e[t];let o=r,c=n;for(h1(e,r,t),i(e[n],a)>0&&h1(e,r,n);o0;)--c}i(e[r],a)===0?h1(e,r,c):(++c,h1(e,c,n)),c<=t&&(r=c+1),t<=c&&(n=c-1)}return e}function h1(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function tCe(e,t,r){if(e=Float64Array.from(qSe(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return jB(e);if(t>=1)return CB(e);var n,i=(n-1)*t,a=Math.floor(i),o=CB(AQ(e,a).subarray(0,a+1)),c=jB(e.subarray(a+1));return o+(c-o)*(i-a)}}function rCe(e,t,r=NQ){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,a=Math.floor(i),o=+r(e[a],a,e),c=+r(e[a+1],a+1,e);return o+(c-o)*(i-a)}}function nCe(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?lw(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?lw(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=aCe.exec(e))?new ml(t[1],t[2],t[3],1):(t=oCe.exec(e))?new ml(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lCe.exec(e))?lw(t[1],t[2],t[3],t[4]):(t=cCe.exec(e))?lw(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=uCe.exec(e))?MB(t[1],t[2]/100,t[3]/100,1):(t=dCe.exec(e))?MB(t[1],t[2]/100,t[3]/100,t[4]):IB.hasOwnProperty(e)?OB(IB[e]):e==="transparent"?new ml(NaN,NaN,NaN,0):null}function OB(e){return new ml(e>>16&255,e>>8&255,e&255,1)}function lw(e,t,r,n){return n<=0&&(e=t=r=NaN),new ml(e,t,r,n)}function pCe(e){return e instanceof wb||(e=Ry(e)),e?(e=e.rgb(),new ml(e.r,e.g,e.b,e.opacity)):new ml}function Jj(e,t,r,n){return arguments.length===1?pCe(e):new ml(e,t,r,n??1)}function ml(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}x3(ml,Jj,_Q(wb,{brighter(e){return e=e==null?SN:Math.pow(SN,e),new ml(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Py:Math.pow(Py,e),new ml(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ml(Vp(this.r),Vp(this.g),Vp(this.b),CN(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:RB,formatHex:RB,formatHex8:mCe,formatRgb:DB,toString:DB}));function RB(){return`#${_p(this.r)}${_p(this.g)}${_p(this.b)}`}function mCe(){return`#${_p(this.r)}${_p(this.g)}${_p(this.b)}${_p((isNaN(this.opacity)?1:this.opacity)*255)}`}function DB(){const e=CN(this.opacity);return`${e===1?"rgb(":"rgba("}${Vp(this.r)}, ${Vp(this.g)}, ${Vp(this.b)}${e===1?")":`, ${e})`}`}function CN(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vp(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _p(e){return e=Vp(e),(e<16?"0":"")+e.toString(16)}function MB(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Fc(e,t,r,n)}function SQ(e){if(e instanceof Fc)return new Fc(e.h,e.s,e.l,e.opacity);if(e instanceof wb||(e=Ry(e)),!e)return new Fc;if(e instanceof Fc)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,c=a-i,h=(a+i)/2;return c?(t===a?o=(r-n)/c+(r0&&h<1?0:o,new Fc(o,c,h,e.opacity)}function gCe(e,t,r,n){return arguments.length===1?SQ(e):new Fc(e,t,r,n??1)}function Fc(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}x3(Fc,gCe,_Q(wb,{brighter(e){return e=e==null?SN:Math.pow(SN,e),new Fc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Py:Math.pow(Py,e),new Fc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new ml(pS(e>=240?e-240:e+120,i,n),pS(e,i,n),pS(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new Fc(LB(this.h),cw(this.s),cw(this.l),CN(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=CN(this.opacity);return`${e===1?"hsl(":"hsla("}${LB(this.h)}, ${cw(this.s)*100}%, ${cw(this.l)*100}%${e===1?")":`, ${e})`}`}}));function LB(e){return e=(e||0)%360,e<0?e+360:e}function cw(e){return Math.max(0,Math.min(1,e||0))}function pS(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const y3=e=>()=>e;function xCe(e,t){return function(r){return e+r*t}}function yCe(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function bCe(e){return(e=+e)==1?CQ:function(t,r){return r-t?yCe(t,r,e):y3(isNaN(t)?r:t)}}function CQ(e,t){var r=t-e;return r?xCe(e,r):y3(isNaN(e)?t:e)}const UB=(function e(t){var r=bCe(t);function n(i,a){var o=r((i=Jj(i)).r,(a=Jj(a)).r),c=r(i.g,a.g),h=r(i.b,a.b),f=CQ(i.opacity,a.opacity);return function(m){return i.r=o(m),i.g=c(m),i.b=h(m),i.opacity=f(m),i+""}}return n.gamma=e,n})(1);function vCe(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;ir&&(a=t.slice(r,a),c[o]?c[o]+=a:c[++o]=a),(n=n[0])===(i=i[0])?c[o]?c[o]+=i:c[++o]=i:(c[++o]=null,h.push({i:o,x:jN(n,i)})),r=mS.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function TCe(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i2?PCe:TCe,h=f=null,y}function y(w){return w==null||isNaN(w=+w)?a:(h||(h=c(e.map(n),t,r)))(n(o(w)))}return y.invert=function(w){return o(i((f||(f=c(t,e.map(n),jN)))(w)))},y.domain=function(w){return arguments.length?(e=Array.from(w,IN),m()):e.slice()},y.range=function(w){return arguments.length?(t=Array.from(w),m()):t.slice()},y.rangeRound=function(w){return t=Array.from(w),r=b3,m()},y.clamp=function(w){return arguments.length?(o=w?!0:Fo,m()):o!==Fo},y.interpolate=function(w){return arguments.length?(r=w,m()):r},y.unknown=function(w){return arguments.length?(a=w,y):a},function(w,A){return n=w,i=A,m()}}function v3(){return EA()(Fo,Fo)}function OCe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function TN(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Tg(e){return e=TN(Math.abs(e)),e?e[1]:NaN}function RCe(e,t){return function(r,n){for(var i=r.length,a=[],o=0,c=e[0],h=0;i>0&&c>0&&(h+c+1>n&&(c=Math.max(1,n-h)),a.push(r.substring(i-=c,i+c)),!((h+=c+1)>n));)c=e[o=(o+1)%e.length];return a.reverse().join(t)}}function DCe(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var MCe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Dy(e){if(!(t=MCe.exec(e)))throw new Error("invalid format: "+e);var t;return new w3({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Dy.prototype=w3.prototype;function w3(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}w3.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function LCe(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var PN;function UCe(e,t){var r=TN(e,t);if(!r)return PN=void 0,e.toPrecision(t);var n=r[0],i=r[1],a=i-(PN=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+TN(e,Math.max(0,t+a-1))[0]}function zB(e,t){var r=TN(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const VB={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:OCe,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>zB(e*100,t),r:zB,s:UCe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function FB(e){return e}var $B=Array.prototype.map,HB=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function BCe(e){var t=e.grouping===void 0||e.thousands===void 0?FB:RCe($B.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?FB:DCe($B.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",c=e.minus===void 0?"−":e.minus+"",h=e.nan===void 0?"NaN":e.nan+"";function f(y,w){y=Dy(y);var A=y.fill,S=y.align,j=y.sign,T=y.symbol,D=y.zero,V=y.width,U=y.comma,G=y.precision,X=y.trim,q=y.type;q==="n"?(U=!0,q="g"):VB[q]||(G===void 0&&(G=12),X=!0,q="g"),(D||A==="0"&&S==="=")&&(D=!0,A="0",S="=");var B=(w&&w.prefix!==void 0?w.prefix:"")+(T==="$"?r:T==="#"&&/[boxX]/.test(q)?"0"+q.toLowerCase():""),z=(T==="$"?n:/[%p]/.test(q)?o:"")+(w&&w.suffix!==void 0?w.suffix:""),F=VB[q],$=/[defgprs%]/.test(q);G=G===void 0?6:/[gprs]/.test(q)?Math.max(1,Math.min(21,G)):Math.max(0,Math.min(20,G));function J(Q){var K=B,me=z,re,le,ve;if(q==="c")me=F(Q)+me,Q="";else{Q=+Q;var je=Q<0||1/Q<0;if(Q=isNaN(Q)?h:F(Math.abs(Q),G),X&&(Q=LCe(Q)),je&&+Q==0&&j!=="+"&&(je=!1),K=(je?j==="("?j:c:j==="-"||j==="("?"":j)+K,me=(q==="s"&&!isNaN(Q)&&PN!==void 0?HB[8+PN/3]:"")+me+(je&&j==="("?")":""),$){for(re=-1,le=Q.length;++reve||ve>57){me=(ve===46?i+Q.slice(re+1):Q.slice(re))+me,Q=Q.slice(0,re);break}}}U&&!D&&(Q=t(Q,1/0));var Ve=K.length+Q.length+me.length,Z=Ve>1)+K+Q+me+Z.slice(Ve);break;default:Q=Z+K+Q+me;break}return a(Q)}return J.toString=function(){return y+""},J}function m(y,w){var A=Math.max(-8,Math.min(8,Math.floor(Tg(w)/3)))*3,S=Math.pow(10,-A),j=f((y=Dy(y),y.type="f",y),{suffix:HB[8+A/3]});return function(T){return j(S*T)}}return{format:f,formatPrefix:m}}var uw,N3,jQ;zCe({thousands:",",grouping:[3],currency:["$",""]});function zCe(e){return uw=BCe(e),N3=uw.format,jQ=uw.formatPrefix,uw}function VCe(e){return Math.max(0,-Tg(Math.abs(e)))}function FCe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Tg(t)/3)))*3-Tg(Math.abs(e)))}function $Ce(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Tg(t)-Tg(e))+1}function IQ(e,t,r,n){var i=Qj(e,t,r),a;switch(n=Dy(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=FCe(i,o))&&(n.precision=a),jQ(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=$Ce(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=VCe(i))&&(n.precision=a-(n.type==="%")*2);break}}return N3(n)}function Lf(e){var t=e.domain;return e.ticks=function(r){var n=t();return Yj(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return IQ(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,a=n.length-1,o=n[i],c=n[a],h,f,m=10;for(c0;){if(f=Xj(o,c,r),f===h)return n[i]=o,n[a]=c,t(n);if(f>0)o=Math.floor(o/f)*f,c=Math.ceil(c/f)*f;else if(f<0)o=Math.ceil(o*f)/f,c=Math.floor(c*f)/f;else break;h=f}return e},e}function TQ(){var e=v3();return e.copy=function(){return Nb(e,TQ())},Ac.apply(e,arguments),Lf(e)}function PQ(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,IN),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return PQ(e).unknown(t)},e=arguments.length?Array.from(e,IN):[0,1],Lf(r)}function OQ(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],a=e[n],o;return aMath.pow(e,t)}function KCe(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function WB(e){return(t,r)=>-e(-t,r)}function E3(e){const t=e(GB,qB),r=t.domain;let n=10,i,a;function o(){return i=KCe(n),a=WCe(n),r()[0]<0?(i=WB(i),a=WB(a),e(HCe,GCe)):e(GB,qB),t}return t.base=function(c){return arguments.length?(n=+c,o()):n},t.domain=function(c){return arguments.length?(r(c),o()):r()},t.ticks=c=>{const h=r();let f=h[0],m=h[h.length-1];const y=m0){for(;w<=A;++w)for(S=1;Sm)break;D.push(j)}}else for(;w<=A;++w)for(S=n-1;S>=1;--S)if(j=w>0?S/a(-w):S*a(w),!(jm)break;D.push(j)}D.length*2{if(c==null&&(c=10),h==null&&(h=n===10?"s":","),typeof h!="function"&&(!(n%1)&&(h=Dy(h)).precision==null&&(h.trim=!0),h=N3(h)),c===1/0)return h;const f=Math.max(1,n*c/t.ticks().length);return m=>{let y=m/a(Math.round(i(m)));return y*nr(OQ(r(),{floor:c=>a(Math.floor(i(c))),ceil:c=>a(Math.ceil(i(c)))})),t}function RQ(){const e=E3(EA()).domain([1,10]);return e.copy=()=>Nb(e,RQ()).base(e.base()),Ac.apply(e,arguments),e}function KB(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function YB(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function A3(e){var t=1,r=e(KB(t),YB(t));return r.constant=function(n){return arguments.length?e(KB(t=+n),YB(t)):t},Lf(r)}function DQ(){var e=A3(EA());return e.copy=function(){return Nb(e,DQ()).constant(e.constant())},Ac.apply(e,arguments)}function XB(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function YCe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function XCe(e){return e<0?-e*e:e*e}function k3(e){var t=e(Fo,Fo),r=1;function n(){return r===1?e(Fo,Fo):r===.5?e(YCe,XCe):e(XB(r),XB(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},Lf(t)}function _3(){var e=k3(EA());return e.copy=function(){return Nb(e,_3()).exponent(e.exponent())},Ac.apply(e,arguments),e}function QCe(){return _3.apply(null,arguments).exponent(.5)}function QB(e){return Math.sign(e)*e*e}function ZCe(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function MQ(){var e=v3(),t=[0,1],r=!1,n;function i(a){var o=ZCe(e(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return e.invert(QB(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,IN)).map(QB)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return MQ(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Ac.apply(i,arguments),Lf(i)}function LQ(){var e=[],t=[],r=[],n;function i(){var o=0,c=Math.max(1,t.length);for(r=new Array(c-1);++o0?r[c-1]:e[0],c=r?[n[r-1],t]:[n[f-1],n[f]]},o.unknown=function(h){return arguments.length&&(a=h),o},o.thresholds=function(){return n.slice()},o.copy=function(){return UQ().domain([e,t]).range(i).unknown(a)},Ac.apply(Lf(o),arguments)}function BQ(){var e=[.5],t=[0,1],r,n=1;function i(a){return a!=null&&a<=a?t[vb(e,a,0,n)]:r}return i.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return BQ().domain(e).range(t).unknown(r)},Ac.apply(i,arguments)}const gS=new Date,xS=new Date;function ja(e,t,r,n){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),c=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,c)=>{const h=[];if(a=i.ceil(a),c=c==null?1:Math.floor(c),!(a0))return h;let f;do h.push(f=new Date(+a)),t(a,c),e(a);while(fja(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,c)=>{if(o>=o)if(c<0)for(;++c<=0;)for(;t(o,-1),!a(o););else for(;--c>=0;)for(;t(o,1),!a(o););}),r&&(i.count=(a,o)=>(gS.setTime(+a),xS.setTime(+o),e(gS),e(xS),Math.floor(r(gS,xS))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const ON=ja(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ON.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ja(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):ON);ON.range;const Id=1e3,bc=Id*60,Td=bc*60,Gd=Td*24,S3=Gd*7,ZB=Gd*30,yS=Gd*365,Sp=ja(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Id)},(e,t)=>(t-e)/Id,e=>e.getUTCSeconds());Sp.range;const C3=ja(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Id)},(e,t)=>{e.setTime(+e+t*bc)},(e,t)=>(t-e)/bc,e=>e.getMinutes());C3.range;const j3=ja(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*bc)},(e,t)=>(t-e)/bc,e=>e.getUTCMinutes());j3.range;const I3=ja(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Id-e.getMinutes()*bc)},(e,t)=>{e.setTime(+e+t*Td)},(e,t)=>(t-e)/Td,e=>e.getHours());I3.range;const T3=ja(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Td)},(e,t)=>(t-e)/Td,e=>e.getUTCHours());T3.range;const Eb=ja(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*bc)/Gd,e=>e.getDate()-1);Eb.range;const AA=ja(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Gd,e=>e.getUTCDate()-1);AA.range;const zQ=ja(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Gd,e=>Math.floor(e/Gd));zQ.range;function Em(e){return ja(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*bc)/S3)}const kA=Em(0),RN=Em(1),JCe=Em(2),eje=Em(3),Pg=Em(4),tje=Em(5),rje=Em(6);kA.range;RN.range;JCe.range;eje.range;Pg.range;tje.range;rje.range;function Am(e){return ja(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/S3)}const _A=Am(0),DN=Am(1),nje=Am(2),ije=Am(3),Og=Am(4),sje=Am(5),aje=Am(6);_A.range;DN.range;nje.range;ije.range;Og.range;sje.range;aje.range;const P3=ja(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());P3.range;const O3=ja(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());O3.range;const qd=ja(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());qd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ja(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});qd.range;const Wd=ja(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Wd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ja(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});Wd.range;function VQ(e,t,r,n,i,a){const o=[[Sp,1,Id],[Sp,5,5*Id],[Sp,15,15*Id],[Sp,30,30*Id],[a,1,bc],[a,5,5*bc],[a,15,15*bc],[a,30,30*bc],[i,1,Td],[i,3,3*Td],[i,6,6*Td],[i,12,12*Td],[n,1,Gd],[n,2,2*Gd],[r,1,S3],[t,1,ZB],[t,3,3*ZB],[e,1,yS]];function c(f,m,y){const w=mT).right(o,w);if(A===o.length)return e.every(Qj(f/yS,m/yS,y));if(A===0)return ON.every(Math.max(Qj(f,m,y),1));const[S,j]=o[w/o[A-1][2]53)return null;"w"in Re||(Re.w=1),"Z"in Re?(Dt=vS(f1(Re.y,0,1)),cr=Dt.getUTCDay(),Dt=cr>4||cr===0?DN.ceil(Dt):DN(Dt),Dt=AA.offset(Dt,(Re.V-1)*7),Re.y=Dt.getUTCFullYear(),Re.m=Dt.getUTCMonth(),Re.d=Dt.getUTCDate()+(Re.w+6)%7):(Dt=bS(f1(Re.y,0,1)),cr=Dt.getDay(),Dt=cr>4||cr===0?RN.ceil(Dt):RN(Dt),Dt=Eb.offset(Dt,(Re.V-1)*7),Re.y=Dt.getFullYear(),Re.m=Dt.getMonth(),Re.d=Dt.getDate()+(Re.w+6)%7)}else("W"in Re||"U"in Re)&&("w"in Re||(Re.w="u"in Re?Re.u%7:"W"in Re?1:0),cr="Z"in Re?vS(f1(Re.y,0,1)).getUTCDay():bS(f1(Re.y,0,1)).getDay(),Re.m=0,Re.d="W"in Re?(Re.w+6)%7+Re.W*7-(cr+5)%7:Re.w+Re.U*7-(cr+6)%7);return"Z"in Re?(Re.H+=Re.Z/100|0,Re.M+=Re.Z%100,vS(Re)):bS(Re)}}function z(Ae,Ie,vt,Re){for(var It=0,Dt=Ie.length,cr=vt.length,St,Ct;It=cr)return-1;if(St=Ie.charCodeAt(It++),St===37){if(St=Ie.charAt(It++),Ct=X[St in JB?Ie.charAt(It++):St],!Ct||(Re=Ct(Ae,vt,Re))<0)return-1}else if(St!=vt.charCodeAt(Re++))return-1}return Re}function F(Ae,Ie,vt){var Re=f.exec(Ie.slice(vt));return Re?(Ae.p=m.get(Re[0].toLowerCase()),vt+Re[0].length):-1}function $(Ae,Ie,vt){var Re=A.exec(Ie.slice(vt));return Re?(Ae.w=S.get(Re[0].toLowerCase()),vt+Re[0].length):-1}function J(Ae,Ie,vt){var Re=y.exec(Ie.slice(vt));return Re?(Ae.w=w.get(Re[0].toLowerCase()),vt+Re[0].length):-1}function Q(Ae,Ie,vt){var Re=D.exec(Ie.slice(vt));return Re?(Ae.m=V.get(Re[0].toLowerCase()),vt+Re[0].length):-1}function K(Ae,Ie,vt){var Re=j.exec(Ie.slice(vt));return Re?(Ae.m=T.get(Re[0].toLowerCase()),vt+Re[0].length):-1}function me(Ae,Ie,vt){return z(Ae,t,Ie,vt)}function re(Ae,Ie,vt){return z(Ae,r,Ie,vt)}function le(Ae,Ie,vt){return z(Ae,n,Ie,vt)}function ve(Ae){return o[Ae.getDay()]}function je(Ae){return a[Ae.getDay()]}function Ve(Ae){return h[Ae.getMonth()]}function Z(Ae){return c[Ae.getMonth()]}function se(Ae){return i[+(Ae.getHours()>=12)]}function xe(Ae){return 1+~~(Ae.getMonth()/3)}function ae(Ae){return o[Ae.getUTCDay()]}function qe(Ae){return a[Ae.getUTCDay()]}function pt(Ae){return h[Ae.getUTCMonth()]}function Fe(Ae){return c[Ae.getUTCMonth()]}function jt(Ae){return i[+(Ae.getUTCHours()>=12)]}function Pt(Ae){return 1+~~(Ae.getUTCMonth()/3)}return{format:function(Ae){var Ie=q(Ae+="",U);return Ie.toString=function(){return Ae},Ie},parse:function(Ae){var Ie=B(Ae+="",!1);return Ie.toString=function(){return Ae},Ie},utcFormat:function(Ae){var Ie=q(Ae+="",G);return Ie.toString=function(){return Ae},Ie},utcParse:function(Ae){var Ie=B(Ae+="",!0);return Ie.toString=function(){return Ae},Ie}}}var JB={"-":"",_:" ",0:"0"},qa=/^\s*\d+/,hje=/^%/,fje=/[\\^$*+?|[\]().{}]/g;function _i(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a[t.toLowerCase(),r]))}function mje(e,t,r){var n=qa.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function gje(e,t,r){var n=qa.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function xje(e,t,r){var n=qa.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function yje(e,t,r){var n=qa.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function bje(e,t,r){var n=qa.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function ez(e,t,r){var n=qa.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function tz(e,t,r){var n=qa.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function vje(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function wje(e,t,r){var n=qa.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Nje(e,t,r){var n=qa.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function rz(e,t,r){var n=qa.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Eje(e,t,r){var n=qa.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function nz(e,t,r){var n=qa.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function Aje(e,t,r){var n=qa.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function kje(e,t,r){var n=qa.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function _je(e,t,r){var n=qa.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function Sje(e,t,r){var n=qa.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Cje(e,t,r){var n=hje.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function jje(e,t,r){var n=qa.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Ije(e,t,r){var n=qa.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function iz(e,t){return _i(e.getDate(),t,2)}function Tje(e,t){return _i(e.getHours(),t,2)}function Pje(e,t){return _i(e.getHours()%12||12,t,2)}function Oje(e,t){return _i(1+Eb.count(qd(e),e),t,3)}function FQ(e,t){return _i(e.getMilliseconds(),t,3)}function Rje(e,t){return FQ(e,t)+"000"}function Dje(e,t){return _i(e.getMonth()+1,t,2)}function Mje(e,t){return _i(e.getMinutes(),t,2)}function Lje(e,t){return _i(e.getSeconds(),t,2)}function Uje(e){var t=e.getDay();return t===0?7:t}function Bje(e,t){return _i(kA.count(qd(e)-1,e),t,2)}function $Q(e){var t=e.getDay();return t>=4||t===0?Pg(e):Pg.ceil(e)}function zje(e,t){return e=$Q(e),_i(Pg.count(qd(e),e)+(qd(e).getDay()===4),t,2)}function Vje(e){return e.getDay()}function Fje(e,t){return _i(RN.count(qd(e)-1,e),t,2)}function $je(e,t){return _i(e.getFullYear()%100,t,2)}function Hje(e,t){return e=$Q(e),_i(e.getFullYear()%100,t,2)}function Gje(e,t){return _i(e.getFullYear()%1e4,t,4)}function qje(e,t){var r=e.getDay();return e=r>=4||r===0?Pg(e):Pg.ceil(e),_i(e.getFullYear()%1e4,t,4)}function Wje(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+_i(t/60|0,"0",2)+_i(t%60,"0",2)}function sz(e,t){return _i(e.getUTCDate(),t,2)}function Kje(e,t){return _i(e.getUTCHours(),t,2)}function Yje(e,t){return _i(e.getUTCHours()%12||12,t,2)}function Xje(e,t){return _i(1+AA.count(Wd(e),e),t,3)}function HQ(e,t){return _i(e.getUTCMilliseconds(),t,3)}function Qje(e,t){return HQ(e,t)+"000"}function Zje(e,t){return _i(e.getUTCMonth()+1,t,2)}function Jje(e,t){return _i(e.getUTCMinutes(),t,2)}function eIe(e,t){return _i(e.getUTCSeconds(),t,2)}function tIe(e){var t=e.getUTCDay();return t===0?7:t}function rIe(e,t){return _i(_A.count(Wd(e)-1,e),t,2)}function GQ(e){var t=e.getUTCDay();return t>=4||t===0?Og(e):Og.ceil(e)}function nIe(e,t){return e=GQ(e),_i(Og.count(Wd(e),e)+(Wd(e).getUTCDay()===4),t,2)}function iIe(e){return e.getUTCDay()}function sIe(e,t){return _i(DN.count(Wd(e)-1,e),t,2)}function aIe(e,t){return _i(e.getUTCFullYear()%100,t,2)}function oIe(e,t){return e=GQ(e),_i(e.getUTCFullYear()%100,t,2)}function lIe(e,t){return _i(e.getUTCFullYear()%1e4,t,4)}function cIe(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Og(e):Og.ceil(e),_i(e.getUTCFullYear()%1e4,t,4)}function uIe(){return"+0000"}function az(){return"%"}function oz(e){return+e}function lz(e){return Math.floor(+e/1e3)}var E0,qQ,WQ;dIe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function dIe(e){return E0=dje(e),qQ=E0.format,E0.parse,WQ=E0.utcFormat,E0.utcParse,E0}function hIe(e){return new Date(e)}function fIe(e){return e instanceof Date?+e:+new Date(+e)}function R3(e,t,r,n,i,a,o,c,h,f){var m=v3(),y=m.invert,w=m.domain,A=f(".%L"),S=f(":%S"),j=f("%I:%M"),T=f("%I %p"),D=f("%a %d"),V=f("%b %d"),U=f("%B"),G=f("%Y");function X(q){return(h(q)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>tCe(e,a/n))},r.copy=function(){return QQ(t).domain(e)},eh.apply(r,arguments)}function CA(){var e=0,t=.5,r=1,n=1,i,a,o,c,h,f=Fo,m,y=!1,w;function A(j){return isNaN(j=+j)?w:(j=.5+((j=+m(j))-a)*(n*j{if(e!=null){var{scale:n,type:i}=e;if(n==="auto")return i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof n=="string")return vIe(n)?n:"point"}};function wIe(e,t){for(var r=0,n=e.length,i=e[0]t)?r=a+1:n=a}return r}function nZ(e,t){if(e){var r=t??e.domain(),n=r.map(a=>{var o;return(o=e(a))!==null&&o!==void 0?o:0}),i=e.range();if(!(r.length===0||i.length<2))return a=>{var o,c,h=wIe(n,a);if(h<=0)return r[0];if(h>=r.length)return r[r.length-1];var f=(o=n[h-1])!==null&&o!==void 0?o:0,m=(c=n[h])!==null&&c!==void 0?c:0;return Math.abs(a-f)<=Math.abs(a-m)?r[h-1]:r[h]}}}function NIe(e){if(e!=null)return"invert"in e&&typeof e.invert=="function"?e.invert.bind(e):nZ(e,void 0)}function uz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function MN(e){for(var t=1;te.cartesianAxis.xAxis[t],th=(e,t)=>{var r=iZ(e,t);return r??ba},va={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:rI,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:fb},sZ=(e,t)=>e.cartesianAxis.yAxis[t],rh=(e,t)=>{var r=sZ(e,t);return r??va},_Ie={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},U3=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return r??_Ie},Wo=(e,t,r)=>{switch(t){case"xAxis":return th(e,r);case"yAxis":return rh(e,r);case"zAxis":return U3(e,r);case"angleAxis":return u3(e,r);case"radiusAxis":return d3(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},SIe=(e,t,r)=>{switch(t){case"xAxis":return th(e,r);case"yAxis":return rh(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},Ab=(e,t,r)=>{switch(t){case"xAxis":return th(e,r);case"yAxis":return rh(e,r);case"angleAxis":return u3(e,r);case"radiusAxis":return d3(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},aZ=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function oZ(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var kb=e=>e.graphicalItems.cartesianItems,CIe=et([Ha,yA],oZ),lZ=(e,t,r)=>e.filter(r).filter(n=>(t==null?void 0:t.includeHidden)===!0?!0:!n.hide),ex=et([kb,Wo,CIe],lZ,{memoizeOptions:{resultEqualityCheck:NA}}),cZ=et([ex],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(vA)),uZ=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),jIe=et([ex],uZ),dZ=e=>e.map(t=>t.data).filter(Boolean).flat(1),IIe=et([ex],e=>e.some(t=>!t.data)),hZ=et([ex],dZ,{memoizeOptions:{resultEqualityCheck:NA}}),fZ=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:i}=t;return e.length>0?e:r.slice(n,i+1)},B3=et([hZ,bb],fZ),TIe=(e,t,r)=>(t==null?void 0:t.dataKey)!=null?e.map(n=>({value:Rs(n,t.dataKey)})):r.length>0?r.map(n=>n.dataKey).flatMap(n=>e.map(i=>({value:Rs(i,n)}))):e.map(n=>({value:n})),pZ=(e,t,r,n,i,a)=>{var{chartData:o=[],dataStartIndex:c,dataEndIndex:h}=n,f=TIe(e,t,r);if(i&&(t==null?void 0:t.dataKey)!=null&&a.length>0){var m=o.slice(c,h+1),y=m.map(w=>({value:Rs(w,t.dataKey)})).filter(w=>w.value!=null);return[...y,...f]}return f},_b=et([B3,Wo,ex,bb,IIe,hZ],pZ);function ng(e){if(Gu(e)||e instanceof Date){var t=Number(e);if(Wn(t))return t}}function dz(e){if(Array.isArray(e)){var t=[ng(e[0]),ng(e[1])];return Uu(t)?t:void 0}var r=ng(e);if(r!=null)return[r,r]}function Ku(e){return e.map(ng).filter(pl)}function PIe(e,t){var r=ng(e),n=ng(t);return r==null&&n==null?0:r==null?-1:n==null?1:r-n}var OIe=et([_b],e=>e==null?void 0:e.map(t=>t.value).sort(PIe));function mZ(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function RIe(e,t,r){if(!r)return[];if(!r.length)return[];var n;if(typeof t=="number"&&!Kc(t))n=t;else if(Array.isArray(t)){var i=Ku(t);i.length>0&&(n=Math.max(...i))}return n==null?[]:Ku(r.flatMap(a=>{var o=Rs(e,a.dataKey),c,h;if(Array.isArray(o)?[c,h]=o:c=h=o,!(!Wn(c)||!Wn(h)))return[n-c,n+h]}))}var Ia=e=>{var t=Ga(e),r=Zg(e);return Ab(e,t,r)},Rg=et([Ia],e=>e==null?void 0:e.dataKey),DIe=et([cZ,bb,Ia],wQ),gZ=(e,t,r,n)=>{var i={},a=t.reduce((o,c)=>{if(c.stackId==null)return o;var h=o[c.stackId];return h==null&&(h=[]),h.push(c),o[c.stackId]=h,o},i);return Object.fromEntries(Object.entries(a).map(o=>{var[c,h]=o,f=n?[...h].reverse():h,m=f.map(bA);return[c,{stackedData:y5e(e,m,r),graphicalItems:f}]}))},LN=et([DIe,cZ,pA,pQ],gZ),xZ=(e,t,r,n)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(n==null&&r!=="zAxis"){var o=N5e(e,i,a);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},MIe=et([Wo],e=>e.allowDataOverflow),z3=e=>{var t;if(e==null||!("domain"in e))return rI;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var r=Ku(e.ticks);return[Math.min(...r),Math.max(...r)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:rI},yZ=et([Wo],z3),bZ=et([yZ,MIe],tQ),LIe=et([LN,Jc,Ha,bZ],xZ,{memoizeOptions:{resultEqualityCheck:wA}}),V3=e=>e.errorBars,UIe=(e,t,r)=>e.flatMap(n=>t[n.id]).filter(Boolean).filter(n=>mZ(r,n)),UN=function(){for(var t=arguments.length,r=new Array(t),n=0;n5&&arguments[5]!==void 0?arguments[5]:[],c,h;if(n.length>0&&n.forEach(f=>{var m,y=f.data!=null?[...f.data]:o,w=(m=i[f.id])===null||m===void 0?void 0:m.filter(A=>mZ(a,A));y.forEach(A=>{var S,j=Rs(A,(S=r.dataKey)!==null&&S!==void 0?S:f.dataKey),T=RIe(A,j,w);if(T.length>=2){var D=Math.min(...T),V=Math.max(...T);(c==null||Dh)&&(h=V)}var U=dz(j);U!=null&&(c=c==null?U[0]:Math.min(c,U[0]),h=h==null?U[1]:Math.max(h,U[1]))})}),(r==null?void 0:r.dataKey)!=null&&n.length===0&&t.forEach(f=>{var m=dz(Rs(f,r.dataKey));m!=null&&(c=c==null?m[0]:Math.min(c,m[0]),h=h==null?m[1]:Math.max(h,m[1]))}),Wn(c)&&Wn(h))return[c,h]},BIe=et([B3,Wo,jIe,V3,Ha,_Se],vZ,{memoizeOptions:{resultEqualityCheck:wA}});function zIe(e){var{value:t}=e;if(Gu(t)||t instanceof Date)return t}var VIe=(e,t,r)=>{var n=e.map(zIe).filter(i=>i!=null);return r&&(t.dataKey==null||t.allowDuplicatedCategory&&IY(n))?JX(0,e.length):t.allowDuplicatedCategory?n:Array.from(new Set(n))},wZ=e=>e.referenceElements.dots,tx=(e,t,r)=>e.filter(n=>n.ifOverflow==="extendDomain").filter(n=>t==="xAxis"?n.xAxisId===r:n.yAxisId===r),FIe=et([wZ,Ha,yA],tx),NZ=e=>e.referenceElements.areas,$Ie=et([NZ,Ha,yA],tx),EZ=e=>e.referenceElements.lines,HIe=et([EZ,Ha,yA],tx),AZ=(e,t)=>{if(e!=null){var r=Ku(e.map(n=>t==="xAxis"?n.x:n.y));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},GIe=et(FIe,Ha,AZ),kZ=(e,t)=>{if(e!=null){var r=Ku(e.flatMap(n=>[t==="xAxis"?n.x1:n.y1,t==="xAxis"?n.x2:n.y2]));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},qIe=et([$Ie,Ha],kZ);function WIe(e){var t;if(e.x!=null)return Ku([e.x]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.x);return r==null||r.length===0?[]:Ku(r)}function KIe(e){var t;if(e.y!=null)return Ku([e.y]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.y);return r==null||r.length===0?[]:Ku(r)}var _Z=(e,t)=>{if(e!=null){var r=e.flatMap(n=>t==="xAxis"?WIe(n):KIe(n));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},YIe=et([HIe,Ha],_Z),XIe=et(GIe,YIe,qIe,(e,t,r)=>UN(e,r,t)),SZ=(e,t,r,n,i,a,o,c)=>{if(r!=null)return r;var h=o==="vertical"&&c==="xAxis"||o==="horizontal"&&c==="yAxis",f=h?UN(n,a,i):UN(a,i);return CSe(t,f,e.allowDataOverflow)},QIe=et([Wo,yZ,bZ,LIe,BIe,XIe,Si,Ha],SZ,{memoizeOptions:{resultEqualityCheck:wA}}),ZIe=[0,1],CZ=(e,t,r,n,i,a,o)=>{if(!((e==null||r==null||r.length===0)&&o===void 0)){var{dataKey:c,type:h}=e,f=Zc(t,a);if(f&&c==null){var m;return JX(0,(m=r==null?void 0:r.length)!==null&&m!==void 0?m:0)}return h==="category"?VIe(n,e,f):i==="expand"&&!f?ZIe:o}},F3=et([Wo,Si,B3,_b,pA,Ha,QIe],CZ),rx=et([Wo,aZ,o3],rZ),jZ=(e,t,r)=>{var{niceTicks:n}=t;if(n!=="none"){var i=z3(t),a=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((n==="snap125"||n==="adaptive")&&t!=null&&t.tickCount&&Uu(e)){if(a)return wB(e,t.tickCount,t.allowDecimals,n);if(t.type==="number")return NB(e,t.tickCount,t.allowDecimals,n)}if(n==="auto"&&r==="linear"&&t!=null&&t.tickCount){if(a&&Uu(e))return wB(e,t.tickCount,t.allowDecimals,"adaptive");if(t.type==="number"&&Uu(e))return NB(e,t.tickCount,t.allowDecimals,"adaptive")}}},$3=et([F3,Ab,rx],jZ),IZ=(e,t,r,n)=>{if(n!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Uu(t)&&Array.isArray(r)&&r.length>0){var i,a,o=t[0],c=(i=r[0])!==null&&i!==void 0?i:0,h=t[1],f=(a=r[r.length-1])!==null&&a!==void 0?a:0;return[Math.min(o,c),Math.max(h,f)]}return t},JIe=et([Wo,F3,$3,Ha],IZ),eTe=et(_b,Wo,(e,t)=>{if(!(!t||t.type!=="number")){var r=1/0,n=Array.from(Ku(e.map(y=>y.value))).sort((y,w)=>y-w),i=n[0],a=n[n.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var c=0;ci,(e,t,r,n,i)=>{if(!Wn(e))return 0;var a=t==="vertical"?n.height:n.width;if(i==="gap")return e*a/2;if(i==="no-gap"){var o=Yc(r,e*a),c=e*a/2;return c-o-(c-o)/a*o}return 0}),tTe=(e,t,r)=>{var n=th(e,t);return n==null||typeof n.padding!="string"?0:TZ(e,"xAxis",t,r,n.padding)},rTe=(e,t,r)=>{var n=rh(e,t);return n==null||typeof n.padding!="string"?0:TZ(e,"yAxis",t,r,n.padding)},nTe=et(th,tTe,(e,t)=>{var r,n;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((r=i.left)!==null&&r!==void 0?r:0)+t,right:((n=i.right)!==null&&n!==void 0?n:0)+t}}),iTe=et(rh,rTe,(e,t)=>{var r,n;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((r=i.top)!==null&&r!==void 0?r:0)+t,bottom:((n=i.bottom)!==null&&n!==void 0?n:0)+t}}),sTe=et([Fa,nTe,cA,lA,(e,t,r)=>r],(e,t,r,n,i)=>{var{padding:a}=n;return i?[a.left,r.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),aTe=et([Fa,Si,iTe,cA,lA,(e,t,r)=>r],(e,t,r,n,i,a)=>{var{padding:o}=i;return a?[n.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),Sb=(e,t,r,n)=>{var i;switch(t){case"xAxis":return sTe(e,r,n);case"yAxis":return aTe(e,r,n);case"zAxis":return(i=U3(e,r))===null||i===void 0?void 0:i.range;case"angleAxis":return yQ(e);case"radiusAxis":return bQ(e,r);default:return}},PZ=et([Wo,Sb],mA),oTe=et([rx,JIe],$Se),H3=et([Wo,rx,oTe,PZ],L3),OZ=(e,t,r,n)=>{if(!(r==null||r.dataKey==null)){var{type:i,scale:a}=r,o=Zc(e,n);if(o&&(i==="number"||a!=="auto"))return t.map(c=>c.value)}},G3=et([Si,_b,Ab,Ha],OZ),jA=et([H3],f3);et([H3],NIe);et([H3,OIe],nZ);et([ex,V3,Ha],UIe);function RZ(e,t){return e.idt.id?1:0}var IA=(e,t)=>t,TA=(e,t,r)=>r,lTe=et(aA,IA,TA,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(RZ)),cTe=et(oA,IA,TA,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(RZ)),DZ=(e,t)=>({width:e.width,height:t.height}),uTe=(e,t)=>{var r=typeof t.width=="number"?t.width:fb;return{width:r,height:e.height}},MZ=et(Fa,th,DZ),dTe=(e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}},hTe=(e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}},fTe=et(Jd,Fa,lTe,IA,TA,(e,t,r,n,i)=>{var a={},o;return r.forEach(c=>{var h=DZ(t,c);o==null&&(o=dTe(t,n,e));var f=n==="top"&&!i||n==="bottom"&&i;a[c.id]=o-Number(f)*h.height,o+=(f?-1:1)*h.height}),a}),pTe=et(Zd,Fa,cTe,IA,TA,(e,t,r,n,i)=>{var a={},o;return r.forEach(c=>{var h=uTe(t,c);o==null&&(o=hTe(t,n,e));var f=n==="left"&&!i||n==="right"&&i;a[c.id]=o-Number(f)*h.width,o+=(f?-1:1)*h.width}),a}),mTe=(e,t)=>{var r=th(e,t);if(r!=null)return fTe(e,r.orientation,r.mirror)},gTe=et([Fa,th,mTe,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var i=r==null?void 0:r[n];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),xTe=(e,t)=>{var r=rh(e,t);if(r!=null)return pTe(e,r.orientation,r.mirror)},yTe=et([Fa,rh,xTe,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var i=r==null?void 0:r[n];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),LZ=et(Fa,rh,(e,t)=>{var r=typeof t.width=="number"?t.width:fb;return{width:r,height:e.height}}),hz=(e,t,r)=>{switch(t){case"xAxis":return MZ(e,r).width;case"yAxis":return LZ(e,r).height;default:return}},UZ=(e,t,r,n)=>{if(r!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=r,c=Zc(e,n),h=t.map(m=>m.value),f=h.filter(m=>m!=null);if(o&&c&&a==="category"&&i&&IY(f))return h}},q3=et([Si,_b,Wo,Ha],UZ),fz=et([Si,SIe,rx,jA,q3,G3,Sb,$3,Ha],(e,t,r,n,i,a,o,c,h)=>{if(t!=null){var f=Zc(e,h);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:h,categoricalDomain:a,duplicateDomain:i,isCategorical:f,niceTicks:c,range:o,realScaleType:r,scale:n}}}),bTe=(e,t,r,n,i,a,o,c,h)=>{if(!(t==null||n==null)){var f=Zc(e,h),{type:m,ticks:y,tickCount:w}=t,A=r==="scaleBand"&&typeof n.bandwidth=="function"?n.bandwidth()/2:2,S=m==="category"&&n.bandwidth?n.bandwidth()/A:0;S=h==="angleAxis"&&a!=null&&a.length>=2?fl(a[0]-a[1])*2*S:S;var j=y||i;return j?j.map((T,D)=>{var V=o?o.indexOf(T):T,U=n.map(V);return Wn(U)?{index:D,coordinate:U+S,value:T,offset:S}:null}).filter(pl):f&&c?c.map((T,D)=>{var V=n.map(T);return Wn(V)?{coordinate:V+S,value:T,index:D,offset:S}:null}).filter(pl):n.ticks?n.ticks(w).map((T,D)=>{var V=n.map(T);return Wn(V)?{coordinate:V+S,value:T,index:D,offset:S}:null}).filter(pl):n.domain().map((T,D)=>{var V=n.map(T);return Wn(V)?{coordinate:V+S,value:o?o[T]:T,index:D,offset:S}:null}).filter(pl)}},BZ=et([Si,Ab,rx,jA,$3,Sb,q3,G3,Ha],bTe),vTe=(e,t,r,n,i,a,o)=>{if(!(t==null||r==null||n==null||n[0]===n[1])){var c=Zc(e,o),{tickCount:h}=t,f=0;return f=o==="angleAxis"&&(n==null?void 0:n.length)>=2?fl(n[0]-n[1])*2*f:f,c&&a?a.map((m,y)=>{var w=r.map(m);return Wn(w)?{coordinate:w+f,value:m,index:y,offset:f}:null}).filter(pl):r.ticks?r.ticks(h).map((m,y)=>{var w=r.map(m);return Wn(w)?{coordinate:w+f,value:m,index:y,offset:f}:null}).filter(pl):r.domain().map((m,y)=>{var w=r.map(m);return Wn(w)?{coordinate:w+f,value:i?i[m]:m,index:y,offset:f}:null}).filter(pl)}},Yu=et([Si,Ab,jA,Sb,q3,G3,Ha],vTe),Xu=et(Wo,jA,(e,t)=>{if(!(e==null||t==null))return MN(MN({},e),{},{scale:t})}),wTe=et([Wo,rx,F3,PZ],L3),NTe=et([wTe],f3);et((e,t,r)=>U3(e,r),NTe,(e,t)=>{if(!(e==null||t==null))return MN(MN({},e),{},{scale:t})});var ETe=et([Si,aA,oA],(e,t,r)=>{switch(e){case"horizontal":return t.some(n=>n.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(n=>n.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),ATe=(e,t,r)=>{var n;return(n=e.renderedTicks[t])===null||n===void 0?void 0:n[r]};et([ATe],e=>{if(!(!e||e.length===0))return t=>{var r,n=1/0,i=e[0];for(var a of e){var o=Math.abs(a.coordinate-t);oe.options.defaultTooltipEventType,VZ=e=>e.options.validateTooltipEventTypes;function FZ(e,t,r){if(e==null)return t;var n=e?"axis":"item";return r==null?t:r.includes(n)?n:t}function Cb(e,t){var r=zZ(e),n=VZ(e);return FZ(t,r,n)}function kTe(e){return Xr(t=>Cb(t,e))}var $Z=(e,t)=>{var r,n=Number(t);if(!(Kc(n)||t==null))return n>=0?e==null||(r=e[n])===null||r===void 0?void 0:r.value:void 0},_Te=e=>e.tooltip.settings,rf={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},STe={itemInteraction:{click:rf,hover:rf},axisInteraction:{click:rf,hover:rf},keyboardInteraction:rf,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},HZ=To({name:"tooltip",initialState:STe,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:ps()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:r,next:n}=t.payload,i=yc(e).tooltipItemPayloads.indexOf(r);i>-1&&(e.tooltipItemPayloads[i]=n)},prepare:ps()},removeTooltipEntrySettings:{reducer(e,t){var r=yc(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:ps()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:CTe,replaceTooltipEntrySettings:jTe,removeTooltipEntrySettings:ITe,setTooltipSettingsState:TTe,setActiveMouseOverItemIndex:GZ,mouseLeaveItem:PTe,mouseLeaveChart:qZ,setActiveClickItemIndex:OTe,setMouseOverAxisIndex:WZ,setMouseClickAxisIndex:RTe,setSyncInteraction:T1,setKeyboardInteraction:BN}=HZ.actions,DTe=HZ.reducer;function pz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dw(e){for(var t=1;t{if(t==null)return rf;var i=BTe(e,t,r);if(i==null)return rf;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(zTe(i)){if(a)return dw(dw({},i),{},{active:!0})}else if(n!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return dw(dw({},rf),{},{coordinate:i.coordinate})};function VTe(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var r=Number(e);return Number.isFinite(r)?r:void 0}function FTe(e,t){var r=VTe(e),n=t[0],i=t[1];if(r===void 0)return!1;var a=Math.min(n,i),o=Math.max(n,i);return r>=a&&r<=o}function $Te(e,t,r){if(r==null||t==null)return!0;var n=Rs(e,t);return n==null||!Uu(r)?!0:FTe(n,r)}var ty=(e,t,r,n)=>{var i=e==null?void 0:e.index;if(i==null)return null;var a=Number(i);if(!Wn(a))return i;var o=0,c=1/0;t.length>0&&(c=t.length-1);var h=Math.max(o,Math.min(a,c)),f=t[h];return f==null||$Te(f,r,n)?String(h):null},YZ=(e,t,r,n,i,a,o)=>{if(a!=null){var c=o[0],h=c==null?void 0:c.getPosition(a);if(h!=null)return h;var f=i==null?void 0:i[Number(a)];if(f)switch(r){case"horizontal":return{x:f.coordinate,y:(n.top+t)/2};default:return{x:(n.left+e)/2,y:f.coordinate}}}},XZ=(e,t,r,n)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(r==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,e.syncInteraction.active&&i==null)return e.tooltipItemPayloads;if(i==null&&(n!=null||e.keyboardInteraction.active)){var a=e.tooltipItemPayloads[0];return a!=null?[a]:[]}return e.tooltipItemPayloads.filter(o=>{var c;return((c=o.settings)===null||c===void 0?void 0:c.graphicalItemId)===i})},QZ=e=>e.options.tooltipPayloadSearcher,nx=e=>e.tooltip;function mz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gz(e){for(var t=1;te(t)}function xz(e){if(typeof e=="string")return e}function XTe(e){if(!(e==null||typeof e!="object")){var t="name"in e?WTe(e.name):void 0,r="unit"in e?KTe(e.unit):void 0,n="dataKey"in e?YTe(e.dataKey):void 0,i="payload"in e?e.payload:void 0,a="color"in e?xz(e.color):void 0,o="fill"in e?xz(e.fill):void 0;return{name:t,unit:r,dataKey:n,payload:i,color:a,fill:o}}}function QTe(e,t){return e??t}var ZZ=(e,t,r,n,i,a,o)=>{if(!(t==null||a==null)){var{chartData:c,computedData:h,dataStartIndex:f,dataEndIndex:m}=r,y=[];return e.reduce((w,A)=>{var S,{dataDefinedOnItem:j,settings:T}=A,D=QTe(j,c),V=Array.isArray(D)?kX(D,f,m):D,U=(S=T==null?void 0:T.dataKey)!==null&&S!==void 0?S:n,G=T==null?void 0:T.nameKey,X;if(n&&Array.isArray(V)&&!Array.isArray(V[0])&&o==="axis"?X=TY(V,n,i):X=a(V,t,h,G),Array.isArray(X))X.forEach(B=>{var z,F,$=XTe(B),J=$==null?void 0:$.name,Q=$==null?void 0:$.dataKey,K=$==null?void 0:$.payload,me=gz(gz({},T),{},{name:J,unit:$==null?void 0:$.unit,color:(z=$==null?void 0:$.color)!==null&&z!==void 0?z:T==null?void 0:T.color,fill:(F=$==null?void 0:$.fill)!==null&&F!==void 0?F:T==null?void 0:T.fill});w.push(cU({tooltipEntrySettings:me,dataKey:Q,payload:K,value:Rs(K,Q),name:J==null?void 0:String(J)}))});else{var q;w.push(cU({tooltipEntrySettings:T,dataKey:U,payload:X,value:Rs(X,U),name:(q=Rs(X,G))!==null&&q!==void 0?q:T==null?void 0:T.name}))}return w},y)}},W3=et([Ia,aZ,o3],rZ),ZTe=et([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),JTe=et([Ga,Zg],oZ),km=et([ZTe,Ia,JTe],lZ,{memoizeOptions:{resultEqualityCheck:NA}}),e4e=et([km],e=>e.filter(vA)),JZ=et([km],dZ,{memoizeOptions:{resultEqualityCheck:NA}}),t4e=et([km],e=>e.some(t=>!t.data)),fm=et([JZ,Jc],fZ),r4e=et([e4e,Jc,Ia],wQ),K3=et([fm,Ia,km,Jc,t4e,JZ],pZ),eJ=et([Ia],z3),n4e=et([Ia],e=>e.allowDataOverflow),tJ=et([eJ,n4e],tQ),i4e=et([km],e=>e.filter(vA)),s4e=et([r4e,i4e,pA,pQ],gZ),a4e=et([s4e,Jc,Ga,tJ],xZ),o4e=et([km],uZ),l4e=et([fm,Ia,o4e,V3,Ga,SSe],vZ,{memoizeOptions:{resultEqualityCheck:wA}}),c4e=et([wZ,Ga,Zg],tx),u4e=et([c4e,Ga],AZ),d4e=et([NZ,Ga,Zg],tx),h4e=et([d4e,Ga],kZ),f4e=et([EZ,Ga,Zg],tx),p4e=et([f4e,Ga],_Z),m4e=et([u4e,p4e,h4e],UN),g4e=et([Ia,eJ,tJ,a4e,l4e,m4e,Si,Ga],SZ),Dg=et([Ia,Si,fm,K3,pA,Ga,g4e],CZ),x4e=et([Dg,Ia,W3],jZ),y4e=et([Ia,Dg,x4e,Ga],IZ),rJ=e=>{var t=Ga(e),r=Zg(e),n=!1;return Sb(e,t,r,n)},nJ=et([Ia,rJ],mA),b4e=et([Ia,W3,y4e,nJ],L3),iJ=et([b4e],f3),v4e=et([Si,K3,Ia,Ga],UZ),w4e=et([Si,K3,Ia,Ga],OZ),N4e=(e,t,r,n,i,a,o,c)=>{if(t){var{type:h}=t,f=Zc(e,c);if(n){var m=r==="scaleBand"&&n.bandwidth?n.bandwidth()/2:2,y=h==="category"&&n.bandwidth?n.bandwidth()/m:0;return y=c==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?fl(i[0]-i[1])*2*y:y,f&&o?o.map((w,A)=>{var S=n.map(w);return Wn(S)?{coordinate:S+y,value:w,index:A,offset:y}:null}).filter(pl):n.domain().map((w,A)=>{var S=n.map(w);return Wn(S)?{coordinate:S+y,value:a?a[w]:w,index:A,offset:y}:null}).filter(pl)}}},nh=et([Si,Ia,W3,iJ,rJ,v4e,w4e,Ga],N4e),Y3=et([zZ,VZ,_Te],(e,t,r)=>FZ(r.shared,e,t)),sJ=e=>e.tooltip.settings.trigger,X3=e=>e.tooltip.settings.defaultIndex,jb=et([nx,Y3,sJ,X3],KZ),pm=et([jb,fm,Rg,Dg],ty),aJ=et([nh,pm],$Z),oJ=et([jb],e=>{if(e)return e.dataKey}),E4e=et([jb],e=>{if(e)return e.graphicalItemId}),lJ=et([nx,Y3,sJ,X3],XZ),A4e=et([Zd,Jd,Si,Fa,nh,X3,lJ],YZ),k4e=et([jb,A4e],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),_4e=et([jb],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),S4e=et([lJ,pm,Jc,Rg,aJ,QZ,Y3],ZZ),C4e=et([S4e],e=>{if(e!=null){var t=e.map(r=>r.payload).filter(r=>r!=null);return Array.from(new Set(t))}});function yz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bz(e){for(var t=1;tXr(Ia),O4e=()=>{var e=P4e(),t=Xr(nh),r=Xr(iJ);return Ef(!e||!r?void 0:bz(bz({},e),{},{scale:r}),t)};function vz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function A0(e){for(var t=1;t{var i=t.find(a=>a&&a.index===r);if(i){if(e==="horizontal")return{x:i.coordinate,y:n.relativeY};if(e==="vertical")return{x:n.relativeX,y:i.coordinate}}return{x:0,y:0}},U4e=(e,t,r,n)=>{var i=t.find(f=>f&&f.index===r);if(i){if(e==="centric"){var a=i.coordinate,{radius:o}=n;return A0(A0(A0({},n),lo(n.cx,n.cy,o,a)),{},{angle:a,radius:o})}var c=i.coordinate,{angle:h}=n;return A0(A0(A0({},n),lo(n.cx,n.cy,c,h)),{},{angle:h,radius:c})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function B4e(e,t){var{relativeX:r,relativeY:n}=e;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}var cJ=(e,t,r,n,i)=>{var a,o=(a=t==null?void 0:t.length)!==null&&a!==void 0?a:0;if(o<=1||e==null)return 0;if(n==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var c=0;c0?(h=r[c-1])===null||h===void 0?void 0:h.coordinate:(f=r[o-1])===null||f===void 0?void 0:f.coordinate,S=(m=r[c])===null||m===void 0?void 0:m.coordinate,j=c>=o-1?(y=r[0])===null||y===void 0?void 0:y.coordinate:(w=r[c+1])===null||w===void 0?void 0:w.coordinate,T=void 0;if(!(A==null||S==null||j==null))if(fl(S-A)!==fl(j-S)){var D=[];if(fl(j-S)===fl(i[1]-i[0])){T=j;var V=S+i[1]-i[0];D[0]=Math.min(V,(V+A)/2),D[1]=Math.max(V,(V+A)/2)}else{T=A;var U=j+i[1]-i[0];D[0]=Math.min(S,(U+S)/2),D[1]=Math.max(S,(U+S)/2)}var G=[Math.min(S,(T+S)/2),Math.max(S,(T+S)/2)];if(e>G[0]&&e<=G[1]||e>=D[0]&&e<=D[1]){var X;return(X=r[c])===null||X===void 0?void 0:X.index}}else{var q=Math.min(A,j),B=Math.max(A,j);if(e>(q+S)/2&&e<=(B+S)/2){var z;return(z=r[c])===null||z===void 0?void 0:z.index}}}else if(t)for(var F=0;F($.coordinate+Q.coordinate)/2||F>0&&F($.coordinate+Q.coordinate)/2&&e<=($.coordinate+J.coordinate)/2)return $.index}}return-1},uJ=()=>Xr(o3),Q3=(e,t)=>t,dJ=(e,t,r)=>r,Z3=(e,t,r,n)=>n,z4e=et(nh,e=>XE(e,t=>t.coordinate)),J3=et([nx,Q3,dJ,Z3],KZ),eP=et([J3,fm,Rg,Dg],ty),V4e=(e,t,r)=>{if(t!=null){var n=nx(e);return t==="axis"?r==="hover"?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:r==="hover"?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}},hJ=et([nx,Q3,dJ,Z3],XZ),zN=et([Zd,Jd,Si,Fa,nh,Z3,hJ],YZ),F4e=et([J3,zN],(e,t)=>{var r;return(r=e.coordinate)!==null&&r!==void 0?r:t}),fJ=et([nh,eP],$Z),$4e=et([hJ,eP,Jc,Rg,fJ,QZ,Q3],ZZ),H4e=et([J3,eP],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),G4e=(e,t,r,n,i,a,o)=>{if(!(!e||!r||!n||!i)&&B4e(e,o)){var c=E5e(e,t),h=cJ(c,a,i,r,n),f=L4e(t,i,h,e);return{activeIndex:String(h),activeCoordinate:f}}},q4e=(e,t,r,n,i,a,o)=>{if(!(!e||!n||!i||!a||!r)){var c=gSe(e,r);if(c){var h=A5e(c,t),f=cJ(h,o,a,n,i),m=U4e(t,a,f,c);return{activeIndex:String(f),activeCoordinate:m}}}},W4e=(e,t,r,n,i,a,o,c)=>{if(!(!e||!t||!n||!i||!a))return t==="horizontal"||t==="vertical"?G4e(e,t,n,i,a,o,c):q4e(e,t,r,n,i,a,o)},K4e=et(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(t!=null){var n=e[t];if(n!=null)return r?n.panoramaElement:n.element}}),Y4e=et(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(n=>parseInt(n,10)).concat(Object.values(ka)),r=Array.from(new Set(t));return r.sort((n,i)=>n-i)},{memoizeOptions:{resultEqualityCheck:FSe}});function wz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Nz(e){for(var t=1;tNz(Nz({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),J4e)},t3e=new Set(Object.values(ka));function r3e(e){return t3e.has(e)}var pJ=To({name:"zIndex",initialState:e3e,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:ps()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!r3e(r)&&delete e.zIndexMap[r])},prepare:ps()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r,element:n,isPanorama:i}=t.payload;e.zIndexMap[r]?i?e.zIndexMap[r].panoramaElement=n:e.zIndexMap[r].element=n:e.zIndexMap[r]={consumers:0,element:i?void 0:n,panoramaElement:i?n:void 0}},prepare:ps()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElement=void 0:e.zIndexMap[r].element=void 0)},prepare:ps()}}}),{registerZIndexPortal:n3e,unregisterZIndexPortal:wS,registerZIndexPortalElement:i3e,unregisterZIndexPortalElement:s3e}=pJ.actions,a3e=pJ.reducer;function Xl(e){var{zIndex:t,children:r}=e,n=ike(),i=n&&t!==void 0&&t!==0,a=$a(),o=I.useRef(void 0),c=I.useRef(new Set),h=ys(),f=Xr(y=>K4e(y,t,a));if(I.useLayoutEffect(()=>{if(!i){var y=c.current;y.forEach(A=>{h(wS({zIndex:A}))}),y.clear(),o.current=void 0;return}if(c.current.has(t)||(h(n3e({zIndex:t})),c.current.add(t)),f){o.current=f;var w=c.current;w.forEach(A=>{A!==t&&(h(wS({zIndex:A})),w.delete(A))})}},[h,t,i,f]),I.useLayoutEffect(()=>{var y=c.current;return()=>{y.forEach(w=>{h(wS({zIndex:w}))}),y.clear()}},[h]),!i)return r;var m=f??o.current;return m?JN.createPortal(r,m):null}function nI(){return nI=Object.assign?Object.assign.bind():function(e){for(var t=1;tI.useContext(mJ),NS={exports:{}},Az;function p3e(){return Az||(Az=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(h,f,m){this.fn=h,this.context=f,this.once=m||!1}function a(h,f,m,y,w){if(typeof m!="function")throw new TypeError("The listener must be a function");var A=new i(m,y||h,w),S=r?r+f:f;return h._events[S]?h._events[S].fn?h._events[S]=[h._events[S],A]:h._events[S].push(A):(h._events[S]=A,h._eventsCount++),h}function o(h,f){--h._eventsCount===0?h._events=new n:delete h._events[f]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var f=[],m,y;if(this._eventsCount===0)return f;for(y in m=this._events)t.call(m,y)&&f.push(r?y.slice(1):y);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(m)):f},c.prototype.listeners=function(f){var m=r?r+f:f,y=this._events[m];if(!y)return[];if(y.fn)return[y.fn];for(var w=0,A=y.length,S=new Array(A);w{if(t&&Array.isArray(e)){var r=Number.parseInt(t,10);if(!Kc(r))return e[r]}},y3e={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},gJ=To({name:"options",initialState:y3e,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),b3e=gJ.reducer,{createEventEmitter:v3e}=gJ.actions;function w3e(e){return e.tooltip.syncInteraction}var N3e={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},xJ=To({name:"chartData",initialState:N3e,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:r,endIndex:n}=t.payload;r!=null&&(e.dataStartIndex=r),n!=null&&(e.dataEndIndex=n)}}}),{setChartData:_z,setDataStartEndIndexes:E3e,setComputedData:U9e}=xJ.actions,A3e=xJ.reducer,k3e=["x","y"];function Sz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function k0(e){for(var t=1;th.rootProps.className);I.useEffect(()=>{if(e==null)return Df;var h=(f,m,y)=>{if(t!==y&&e===f){if(m.payload.active===!1){r(T1({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(n==="index"){var w;if(o&&m!==null&&m!==void 0&&(w=m.payload)!==null&&w!==void 0&&w.coordinate&&m.payload.sourceViewBox){var A=m.payload.coordinate,{x:S,y:j}=A,T=j3e(A,k3e),{x:D,y:V,width:U,height:G}=m.payload.sourceViewBox,X=k0(k0({},T),{},{x:o.x+(U?(S-D)/U:0)*o.width,y:o.y+(G?(j-V)/G:0)*o.height});r(k0(k0({},m),{},{payload:k0(k0({},m.payload),{},{coordinate:X})}))}else r(m);return}if(i!=null){var q;if(typeof n=="function"){var B={activeTooltipIndex:m.payload.index==null?void 0:Number(m.payload.index),isTooltipActive:m.payload.active,activeIndex:m.payload.index==null?void 0:Number(m.payload.index),activeLabel:m.payload.label,activeDataKey:m.payload.dataKey,activeCoordinate:m.payload.coordinate},z=n(i,B);q=i[z]}else n==="value"&&(q=i.find(le=>String(le.value)===m.payload.label));var{coordinate:F}=m.payload;if(F==null||o==null){r(T1({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(q==null){r(T1({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:m.payload.sourceViewBox,graphicalItemId:void 0}));return}var{x:$,y:J}=F,Q=Math.min($,o.x+o.width),K=Math.min(J,o.y+o.height),me={x:a==="horizontal"?q.coordinate:Q,y:a==="horizontal"?K:q.coordinate},re=T1({active:m.payload.active,coordinate:me,dataKey:m.payload.dataKey,index:String(q.index),label:m.payload.label,sourceViewBox:m.payload.sourceViewBox,graphicalItemId:m.payload.graphicalItemId});r(re)}}};return My.on(iI,h),()=>{My.off(iI,h)}},[c,r,t,e,n,i,a,o])}function P3e(){var e=Xr(l3),t=Xr(c3),r=ys();I.useEffect(()=>{if(e==null)return Df;var n=(i,a,o)=>{t!==o&&e===i&&r(E3e(a))};return My.on(kz,n),()=>{My.off(kz,n)}},[r,t,e])}function O3e(){var e=ys();I.useEffect(()=>{e(v3e())},[e]),T3e(),P3e()}function R3e(e,t,r,n,i,a){var o=Xr(S=>V4e(S,e,t)),c=Xr(E4e),h=Xr(c3),f=Xr(l3),m=Xr(mQ),y=Xr(w3e),w=(y==null?void 0:y.sourceViewBox)!=null,A=uA();I.useEffect(()=>{if(!w&&f!=null&&h!=null){var S=T1({active:a,coordinate:r,dataKey:o,index:i,label:typeof n=="number"?String(n):n,sourceViewBox:A,graphicalItemId:c});My.emit(iI,f,S,h)}},[w,r,o,c,i,n,h,f,m,a,A])}function Cz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function jz(e){for(var t=1;t{B(TTe({shared:V,trigger:U,axisId:q,active:i,defaultIndex:z}))},[B,V,U,q,i,z]);var F=uA(),$=HX(),J=kTe(V),{activeIndex:Q,isActive:K}=(t=Xr(Pt=>H4e(Pt,J,U,z)))!==null&&t!==void 0?t:{},me=Xr(Pt=>$4e(Pt,J,U,z)),re=Xr(Pt=>fJ(Pt,J,U,z)),le=Xr(Pt=>F4e(Pt,J,U,z)),ve=me,je=f3e(),Ve=(r=i??K)!==null&&r!==void 0?r:!1,[Z,se]=YY([ve,Ve]),xe=J==="axis"?re:void 0;R3e(J,U,le,xe,Q,Ve);var ae=X??je;if(ae==null||F==null||J==null)return null;var qe=ve??Iz;Ve||(qe=Iz),f&&qe.length&&(qe=HY(qe.filter(Pt=>Pt.value!=null&&(Pt.hide!==!0||n.includeHidden)),w,U3e));var pt=qe.length>0,Fe=jz(jz({},n),{},{payload:qe,label:xe,active:Ve,activeIndex:Q,coordinate:le,accessibilityLayer:$}),jt=I.createElement(g_e,{allowEscapeViewBox:a,animationDuration:o,animationEasing:c,isAnimationActive:m,active:Ve,coordinate:le,hasPayload:pt,offset:y,position:A,reverseDirection:S,useTranslate3d:j,viewBox:F,wrapperStyle:T,lastBoundingBox:Z,innerRef:se,hasPortalFromProps:!!X},B3e(h,Fe));return I.createElement(I.Fragment,null,JN.createPortal(jt,ae),Ve&&I.createElement(h3e,{cursor:D,tooltipEventType:J,coordinate:le,payload:qe,index:Q}))}var yJ=e=>null;yJ.displayName="Cell";function F3e(e,t,r){return(t=$3e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $3e(e){var t=H3e(e,"string");return typeof t=="symbol"?t:t+""}function H3e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class G3e{constructor(t){F3e(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return r!==void 0&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}function Tz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function q3e(e){for(var t=1;t{try{var r=document.getElementById(Oz);r||(r=document.createElement("span"),r.setAttribute("id",Oz),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,Q3e,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch{return{width:0,height:0}}},ry=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||gb.isSsr)return{width:0,height:0};if(!bJ.enableCache)return Rz(t,r);var n=Z3e(t,r),i=Pz.get(n);if(i)return i;var a=Rz(t,r);return Pz.set(n,a),a},vJ;function J3e(e,t,r){return(t=ePe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ePe(e){var t=tPe(e,"string");return typeof t=="symbol"?t:t+""}function tPe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Dz=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Mz=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,rPe=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,nPe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,iPe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},sPe=["cm","mm","pt","pc","in","Q","px"];function aPe(e){return sPe.includes(e)}var $0="NaN";function oPe(e,t){return e*iPe[t]}class io{static parse(t){var r,[,n,i]=(r=nPe.exec(t))!==null&&r!==void 0?r:[];return n==null?io.NaN:new io(parseFloat(n),i??"")}constructor(t,r){this.num=t,this.unit=r,this.num=t,this.unit=r,Kc(t)&&(this.unit=""),r!==""&&!rPe.test(r)&&(this.num=NaN,this.unit=""),aPe(r)&&(this.num=oPe(t,r),this.unit="px")}add(t){return this.unit!==t.unit?new io(NaN,""):new io(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new io(NaN,""):new io(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new io(NaN,""):new io(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new io(NaN,""):new io(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Kc(this.num)}}vJ=io;J3e(io,"NaN",new vJ(NaN,""));function wJ(e){if(e==null||e.includes($0))return $0;for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,i,a]=(r=Dz.exec(t))!==null&&r!==void 0?r:[],o=io.parse(n??""),c=io.parse(a??""),h=i==="*"?o.multiply(c):o.divide(c);if(h.isNaN())return $0;t=t.replace(Dz,h.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var f,[,m,y,w]=(f=Mz.exec(t))!==null&&f!==void 0?f:[],A=io.parse(m??""),S=io.parse(w??""),j=y==="+"?A.add(S):A.subtract(S);if(j.isNaN())return $0;t=t.replace(Mz,j.toString())}return t}var Lz=/\(([^()]*)\)/;function lPe(e){for(var t=e,r;(r=Lz.exec(t))!=null;){var[,n]=r;t=t.replace(Lz,wJ(n))}return t}function cPe(e){var t=e.replace(/\s+/g,"");return t=lPe(t),t=wJ(t),t}function uPe(e){try{return cPe(e)}catch{return $0}}function ES(e){var t=uPe(e.slice(5,-1));return t===$0?"":t}var dPe=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],hPe=["dx","dy","angle","className","breakAll"];function sI(){return sI=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:r,style:n}=e;try{var i=[];xs(t)||(r?i=t.toString().split(""):i=t.toString().split(NJ));var a=i.map(c=>({word:c,width:ry(c,n).width})),o=r?0:ry(" ",n).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch{return null}};function AJ(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}function pPe(e){return xs(e)||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var kJ=(e,t,r,n)=>e.reduce((i,a)=>{var{word:o,width:c}=a,h=i[i.length-1];if(h&&c!=null&&(t==null||n||h.width+c+re.reduce((t,r)=>t.width>r.width?t:r),mPe="…",Bz=(e,t,r,n,i,a,o,c)=>{var h=e.slice(0,t),f=EJ({breakAll:r,style:n,children:h+mPe});if(!f)return[!1,[]];var m=kJ(f.wordsWithComputedWidth,a,o,c),y=m.length>i||_J(m).width>Number(a);return[y,m]},gPe=(e,t,r,n,i)=>{var{maxLines:a,children:o,style:c,breakAll:h}=e,f=wr(a),m=String(o),y=kJ(t,n,r,i);if(!f||i)return y;var w=y.length>a||_J(y).width>Number(n);if(!w)return y;for(var A=0,S=m.length-1,j=0,T;A<=S&&j<=m.length-1;){var D=Math.floor((A+S)/2),V=D-1,[U,G]=Bz(m,V,h,c,a,n,r,i),[X]=Bz(m,D,h,c,a,n,r,i);if(!U&&!X&&(A=D+1),U&&X&&(S=D-1),!U&&X){T=G;break}j++}return T||y},zz=e=>{var t=xs(e)?[]:e.toString().split(NJ);return[{words:t,width:void 0}]},xPe=e=>{var{width:t,scaleToFit:r,children:n,style:i,breakAll:a,maxLines:o}=e;if((t||r)&&!gb.isSsr){var c,h,f=EJ({breakAll:a,children:n,style:i});if(f){var{wordsWithComputedWidth:m,spaceWidth:y}=f;c=m,h=y}else return zz(n);return gPe({breakAll:a,children:n,maxLines:o,style:i},c,h,t,!!r)}return zz(n)},SJ="#808080",yPe={angle:0,breakAll:!1,capHeight:"0.71em",fill:SJ,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},tP=I.forwardRef((e,t)=>{var r=Va(e,yPe),{x:n,y:i,lineHeight:a,capHeight:o,fill:c,scaleToFit:h,textAnchor:f,verticalAnchor:m}=r,y=Uz(r,dPe),w=I.useMemo(()=>xPe({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:h,style:y.style,width:y.width}),[y.breakAll,y.children,y.maxLines,h,y.style,y.width]),{dx:A,dy:S,angle:j,className:T,breakAll:D}=y,V=Uz(y,hPe);if(!Gu(n)||!Gu(i)||w.length===0)return null;var U=Number(n)+(wr(A)?A:0),G=Number(i)+(wr(S)?S:0);if(!Wn(U)||!Wn(G))return null;var X;switch(m){case"start":X=ES("calc(".concat(o,")"));break;case"middle":X=ES("calc(".concat((w.length-1)/2," * -").concat(a," + (").concat(o," / 2))"));break;default:X=ES("calc(".concat(w.length-1," * -").concat(a,")"));break}var q=[],B=w[0];if(h&&B!=null){var z=B.width,{width:F}=y;q.push("scale(".concat(wr(F)&&wr(z)?F/z:1,")"))}return j&&q.push("rotate(".concat(j,", ").concat(U,", ").concat(G,")")),q.length&&(V.transform=q.join(" ")),I.createElement("text",sI({},jo(V),{ref:t,x:U,y:G,className:Mi("recharts-text",T),textAnchor:f,fill:c.includes("url")?SJ:c}),w.map(($,J)=>{var Q=$.words.join(D?"":" ");return I.createElement("tspan",{x:U,dy:J===0?X:a,key:"".concat(Q,"-").concat(J)},Q)}))});tP.displayName="Text";function Vz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xu(e){for(var t=1;t{var{viewBox:t,position:r,offset:n=0,parentViewBox:i}=e,{x:a,y:o,height:c,upperWidth:h,lowerWidth:f}=Q4(t),m=a,y=a+(h-f)/2,w=(m+y)/2,A=(h+f)/2,S=m+h/2,j=c>=0?1:-1,T=j*n,D=j>0?"end":"start",V=j>0?"start":"end",U=h>=0?1:-1,G=U*n,X=U>0?"end":"start",q=U>0?"start":"end",B=i;if(r==="top"){var z={x:m+h/2,y:o-T,horizontalAnchor:"middle",verticalAnchor:D};return B&&(z.height=Math.max(o-B.y,0),z.width=h),z}if(r==="bottom"){var F={x:y+f/2,y:o+c+T,horizontalAnchor:"middle",verticalAnchor:V};return B&&(F.height=Math.max(B.y+B.height-(o+c),0),F.width=f),F}if(r==="left"){var $={x:w-G,y:o+c/2,horizontalAnchor:X,verticalAnchor:"middle"};return B&&($.width=Math.max($.x-B.x,0),$.height=c),$}if(r==="right"){var J={x:w+A+G,y:o+c/2,horizontalAnchor:q,verticalAnchor:"middle"};return B&&(J.width=Math.max(B.x+B.width-J.x,0),J.height=c),J}var Q=B?{width:A,height:c}:{};return r==="insideLeft"?xu({x:w+G,y:o+c/2,horizontalAnchor:q,verticalAnchor:"middle"},Q):r==="insideRight"?xu({x:w+A-G,y:o+c/2,horizontalAnchor:X,verticalAnchor:"middle"},Q):r==="insideTop"?xu({x:m+h/2,y:o+T,horizontalAnchor:"middle",verticalAnchor:V},Q):r==="insideBottom"?xu({x:y+f/2,y:o+c-T,horizontalAnchor:"middle",verticalAnchor:D},Q):r==="insideTopLeft"?xu({x:m+G,y:o+T,horizontalAnchor:q,verticalAnchor:V},Q):r==="insideTopRight"?xu({x:m+h-G,y:o+T,horizontalAnchor:X,verticalAnchor:V},Q):r==="insideBottomLeft"?xu({x:y+G,y:o+c-T,horizontalAnchor:q,verticalAnchor:D},Q):r==="insideBottomRight"?xu({x:y+f-G,y:o+c-T,horizontalAnchor:X,verticalAnchor:D},Q):r&&typeof r=="object"&&(wr(r.x)||lm(r.x))&&(wr(r.y)||lm(r.y))?xu({x:a+Yc(r.x,A),y:o+Yc(r.y,c),horizontalAnchor:"end",verticalAnchor:"end"},Q):xu({x:S,y:o+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},Q)},EPe=["labelRef"],APe=["content"];function Fz(e,t){if(e==null)return{};var r,n,i=kPe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var{x:t,y:r,upperWidth:n,lowerWidth:i,width:a,height:o,children:c}=e,h=I.useMemo(()=>({x:t,y:r,upperWidth:n,lowerWidth:i,width:a,height:o}),[t,r,n,i,a,o]);return I.createElement(CJ.Provider,{value:h},c)},jJ=()=>{var e=I.useContext(CJ),t=uA();return e||(t?Q4(t):void 0)},IPe=I.createContext(null),TPe=()=>{var e=I.useContext(IPe),t=Xr(vQ);return e||t},PPe=e=>{var{value:t,formatter:r}=e,n=xs(e.children)?t:e.children;return typeof r=="function"?r(n):n},rP=e=>e!=null&&typeof e=="function",OPe=(e,t)=>{var r=fl(t-e),n=Math.min(Math.abs(t-e),360);return r*n},RPe=(e,t,r,n,i)=>{var{offset:a,className:o}=e,{cx:c,cy:h,innerRadius:f,outerRadius:m,startAngle:y,endAngle:w,clockWise:A}=i,S=(f+m)/2,j=OPe(y,w),T=j>=0?1:-1,D,V;switch(t){case"insideStart":D=y+T*a,V=A;break;case"insideEnd":D=w-T*a,V=!A;break;case"end":D=w+T*a,V=A;break;default:throw new Error("Unsupported position ".concat(t))}V=j<=0?V:!V;var U=lo(c,h,S,D),G=lo(c,h,S,D+(V?1:-1)*359),X="M".concat(U.x,",").concat(U.y,` A`).concat(S,",").concat(S,",0,1,").concat(V?0:1,`, `).concat(G.x,",").concat(G.y),q=xs(e.id)?Ey("recharts-radial-line-"):e.id;return I.createElement("text",_d({},n,{dominantBaseline:"central",className:Mi("recharts-radial-bar-label",o)}),I.createElement("defs",null,I.createElement("path",{id:q,d:X})),I.createElement("textPath",{xlinkHref:"#".concat(q)},r))},DPe=(e,t,r)=>{var{cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:c,endAngle:h}=e,f=(c+h)/2;if(r==="outside"){var{x:m,y}=lo(n,i,o+t,f);return{x:m,y,textAnchor:m>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"end"};var w=(a+o)/2,{x:A,y:S}=lo(n,i,w,f);return{x:A,y:S,textAnchor:"middle",verticalAnchor:"middle"}},Jw=e=>e!=null&&"cx"in e&&wr(e.cx),MPe={angle:0,offset:5,zIndex:ka.label,position:"middle",textBreakAll:!1};function LPe(e){if(!Jw(e))return e;var{cx:t,cy:r,outerRadius:n}=e,i=n*2;return{x:t-n,y:r-n,width:i,upperWidth:i,lowerWidth:i,height:i}}function Yh(e){var t=Va(e,MPe),{viewBox:r,parentViewBox:n,position:i,value:a,children:o,content:c,className:h="",textBreakAll:f,labelRef:m}=t,y=TPe(),w=jJ(),A=i==="center"?w:y??w,S,j,T;r==null?S=A:Jw(r)?S=r:S=Q4(r);var D=LPe(S);if(!S||xs(a)&&xs(o)&&!I.isValidElement(c)&&typeof c!="function")return null;var V=P1(P1({},t),{},{viewBox:S});if(I.isValidElement(c)){var{labelRef:U}=V,G=Fz(V,EPe);return I.cloneElement(c,G)}if(typeof c=="function"){var{content:X}=V,q=Fz(V,APe);if(j=I.createElement(c,q),I.isValidElement(j))return j}else j=PPe(t);var B=jo(t);if(Jw(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return RPe(t,i,j,B,S);T=DPe(S,t.offset,t.position)}else{if(!D)return null;var z=NPe({viewBox:D,position:i,offset:t.offset,parentViewBox:Jw(n)?void 0:n});T=P1(P1({x:z.x,y:z.y,textAnchor:z.horizontalAnchor,verticalAnchor:z.verticalAnchor},z.width!==void 0?{width:z.width}:{}),z.height!==void 0?{height:z.height}:{})}return I.createElement(Xl,{zIndex:t.zIndex},I.createElement(tP,_d({ref:m,className:Mi("recharts-label",h)},B,T,{textAnchor:AJ(B.textAnchor)?B.textAnchor:T.textAnchor,breakAll:f}),j))}Yh.displayName="Label";var UPe=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?I.createElement(Yh,_d({key:"label-implicit"},n)):Gu(e)?I.createElement(Yh,_d({key:"label-implicit",value:e},n)):I.isValidElement(e)?e.type===Yh?I.cloneElement(e,P1({key:"label-implicit"},n)):I.createElement(Yh,_d({key:"label-implicit",content:e},n)):rP(e)?I.createElement(Yh,_d({key:"label-implicit",content:e},n)):e&&typeof e=="object"?I.createElement(Yh,_d({},e,{key:"label-implicit"},n)):null};function BPe(e){var{label:t,labelRef:r}=e,n=jJ();return UPe(t,n,r)||null}var zPe=["valueAccessor"],VPe=["dataKey","clockWise","id","textBreakAll","zIndex"];function VN(){return VN=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(pPe(t))return t},IJ=I.createContext(void 0),nP=IJ.Provider,TJ=I.createContext(void 0);TJ.Provider;function HPe(){return I.useContext(IJ)}function GPe(){return I.useContext(TJ)}function e2(e){var{valueAccessor:t=$Pe}=e,r=Hz(e,zPe),{dataKey:n,clockWise:i,id:a,textBreakAll:o,zIndex:c}=r,h=Hz(r,VPe),f=HPe(),m=GPe(),y=f||m;return!y||!y.length?null:I.createElement(Xl,{zIndex:c??ka.label},I.createElement(co,{className:"recharts-label-list"},y.map((w,A)=>{var S,j=xs(n)?t(w,A):Rs(w.payload,n),T=xs(a)?{}:{id:"".concat(a,"-").concat(A)};return I.createElement(Yh,VN({key:"label-".concat(A)},jo(w),h,T,{fill:(S=r.fill)!==null&&S!==void 0?S:w.fill,parentViewBox:w.parentViewBox,value:j,textBreakAll:o,viewBox:w.viewBox,index:A,zIndex:0}))})))}e2.displayName="LabelList";function iP(e){var{label:t}=e;return t?t===!0?I.createElement(e2,{key:"labelList-implicit"}):I.isValidElement(t)||rP(t)?I.createElement(e2,{key:"labelList-implicit",content:t}):typeof t=="object"?I.createElement(e2,VN({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function aI(){return aI=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:r,r:n,className:i}=e,a=Mi("recharts-dot",i);return wr(t)&&wr(r)&&wr(n)?I.createElement("circle",aI({},Wl(e),z4(e),{className:a,cx:t,cy:r,r:n})):null},qPe={radiusAxis:{},angleAxis:{}},OJ=To({name:"polarAxis",initialState:qPe,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:B9e,removeRadiusAxis:z9e,addAngleAxis:V9e,removeAngleAxis:F9e}=OJ.actions,WPe=OJ.reducer;function KPe(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var AS={exports:{}},Yi={};/** * @license React * react-is.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Gz;function YPe(){if(Gz)return Yi;Gz=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),w=Symbol.for("react.view_transition"),A=Symbol.for("react.client.reference");function S(j){if(typeof j=="object"&&j!==null){var T=j.$$typeof;switch(T){case e:switch(j=j.type,j){case r:case i:case n:case h:case f:case w:return j;default:switch(j=j&&j.$$typeof,j){case o:case c:case y:case m:return j;case a:return j;default:return T}}case t:return T}}}return Yi.ContextConsumer=a,Yi.ContextProvider=o,Yi.Element=e,Yi.ForwardRef=c,Yi.Fragment=r,Yi.Lazy=y,Yi.Memo=m,Yi.Portal=t,Yi.Profiler=i,Yi.StrictMode=n,Yi.Suspense=h,Yi.SuspenseList=f,Yi.isContextConsumer=function(j){return S(j)===a},Yi.isContextProvider=function(j){return S(j)===o},Yi.isElement=function(j){return typeof j=="object"&&j!==null&&j.$$typeof===e},Yi.isForwardRef=function(j){return S(j)===c},Yi.isFragment=function(j){return S(j)===r},Yi.isLazy=function(j){return S(j)===y},Yi.isMemo=function(j){return S(j)===m},Yi.isPortal=function(j){return S(j)===t},Yi.isProfiler=function(j){return S(j)===i},Yi.isStrictMode=function(j){return S(j)===n},Yi.isSuspense=function(j){return S(j)===h},Yi.isSuspenseList=function(j){return S(j)===f},Yi.isValidElementType=function(j){return typeof j=="string"||typeof j=="function"||j===r||j===i||j===n||j===h||j===f||typeof j=="object"&&j!==null&&(j.$$typeof===y||j.$$typeof===m||j.$$typeof===o||j.$$typeof===a||j.$$typeof===c||j.$$typeof===A||j.getModuleId!==void 0)},Yi.typeOf=S,Yi}var qz;function XPe(){return qz||(qz=1,AS.exports=YPe()),AS.exports}var QPe=XPe(),Wz=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",Kz=null,kS=null,RJ=e=>{if(e===Kz&&Array.isArray(kS))return kS;var t=[];return I.Children.forEach(e,r=>{xs(r)||(QPe.isFragment(r)?t=t.concat(RJ(r.props.children)):t.push(r))}),kS=t,Kz=e,t};function ZPe(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(i=>Wz(i)):n=[Wz(t)],RJ(e).forEach(i=>{var a=Sg(i,"type.displayName")||Sg(i,"type.name");a&&n.indexOf(a)!==-1&&r.push(i)}),r}var sP=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,_S={},Yz;function JPe(){return Yz||(Yz=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var i;if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const a=r[Symbol.toStringTag];return a==null||!((i=Object.getOwnPropertyDescriptor(r,Symbol.toStringTag))!=null&&i.writable)?!1:r.toString()===`[object ${a}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(_S)),_S}var SS,Xz;function eOe(){return Xz||(Xz=1,SS=JPe().isPlainObject),SS}var tOe=eOe();const rOe=Qu(tOe);var Qz,Zz,Jz,eV,tV;function rV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function nV(e){for(var t=1;t{var a=r-n,o;return o=Hs(Qz||(Qz=g1(["M ",",",""])),e,t),o+=Hs(Zz||(Zz=g1(["L ",",",""])),e+r,t),o+=Hs(Jz||(Jz=g1(["L ",",",""])),e+r-a/2,t+i),o+=Hs(eV||(eV=g1(["L ",",",""])),e+r-a/2-n,t+i),o+=Hs(tV||(tV=g1(["L ",","," Z"])),e,t),o},aOe={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},oOe=e=>{var t=Va(e,aOe),{x:r,y:n,upperWidth:i,lowerWidth:a,height:o,className:c}=t,{animationEasing:h,animationDuration:f,animationBegin:m,isUpdateAnimationActive:y}=t,w=I.useRef(null),[A,S]=I.useState(-1),j=I.useRef(i),T=I.useRef(a),D=I.useRef(o),V=I.useRef(r),U=I.useRef(n),G=yb(e,"trapezoid-");if(I.useEffect(()=>{if(w.current&&w.current.getTotalLength)try{var me=w.current.getTotalLength();me&&S(me)}catch{}},[]),r!==+r||n!==+n||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var X=Mi("recharts-trapezoid",c);if(!y)return I.createElement("g",null,I.createElement("path",FN({},jo(t),{className:X,d:iV(r,n,i,a,o)})));var q=j.current,B=T.current,z=D.current,F=V.current,$=U.current,J="0px ".concat(A===-1?1:A,"px"),Q="".concat(A,"px ").concat(A,"px"),K=GX(["strokeDasharray"],f,h);return I.createElement(xb,{animationId:G,key:G,canBegin:A>0,duration:f,easing:h,isActive:y,begin:m},me=>{var re=Qi(q,i,me),le=Qi(B,a,me),ve=Qi(z,o,me),je=Qi(F,r,me),Ve=Qi($,n,me);w.current&&(j.current=re,T.current=le,D.current=ve,V.current=je,U.current=Ve);var Z=me>0?{transition:K,strokeDasharray:Q}:{strokeDasharray:J};return I.createElement("path",FN({},jo(t),{className:X,d:iV(je,Ve,re,le,ve),ref:w,style:nV(nV({},Z),t.style)}))})},lOe=["option","shapeType","activeClassName","inActiveClassName"];function cOe(e,t){if(e==null)return{};var r,n,i=uOe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var n=ys();return(i,a)=>o=>{e==null||e(i,a,o),n(GZ({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}},LJ=e=>{var t=ys();return(r,n)=>i=>{e==null||e(r,n,i),t(PTe())}},UJ=(e,t,r)=>{var n=ys();return(i,a)=>o=>{e==null||e(i,a,o),n(OTe({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}};function aP(e){var{tooltipEntrySettings:t}=e,r=ys(),n=$a(),i=I.useRef(null);return I.useLayoutEffect(()=>{n||(i.current===null?r(CTe(t)):i.current!==t&&r(jTe({prev:i.current,next:t})),i.current=t)},[t,r,n]),I.useLayoutEffect(()=>()=>{i.current&&(r(ITe(i.current)),i.current=null)},[r]),null}function oP(e){var{legendPayload:t}=e,r=ys(),n=$a(),i=I.useRef(null);return I.useLayoutEffect(()=>{n||(i.current===null?r(yke(t)):i.current!==t&&r(bke({prev:i.current,next:t})),i.current=t)},[r,n,t]),I.useLayoutEffect(()=>()=>{i.current&&(r(vke(i.current)),i.current=null)},[r]),null}var CS,xOe=()=>{var[e]=I.useState(()=>Ey("uid-"));return e},yOe=(CS=rre.useId)!==null&&CS!==void 0?CS:xOe;function bOe(e,t){var r=yOe();return t||(e?"".concat(e,"-").concat(r):r)}var vOe=I.createContext(void 0),lP=e=>{var{id:t,type:r,children:n}=e,i=bOe("recharts-".concat(r),t);return I.createElement(vOe.Provider,{value:i},n(i))},wOe={cartesianItems:[],polarItems:[]},BJ=To({name:"graphicalItems",initialState:wOe,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:ps()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=yc(e).cartesianItems.indexOf(r);i>-1&&(e.cartesianItems[i]=n)},prepare:ps()},removeCartesianGraphicalItem:{reducer(e,t){var r=yc(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:ps()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:ps()},removePolarGraphicalItem:{reducer(e,t){var r=yc(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:ps()},replacePolarGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=yc(e).polarItems.indexOf(r);i>-1&&(e.polarItems[i]=n)},prepare:ps()}}}),{addCartesianGraphicalItem:NOe,replaceCartesianGraphicalItem:EOe,removeCartesianGraphicalItem:AOe,addPolarGraphicalItem:$9e,removePolarGraphicalItem:H9e,replacePolarGraphicalItem:G9e}=BJ.actions,kOe=BJ.reducer,_Oe=e=>{var t=ys(),r=I.useRef(null);return I.useLayoutEffect(()=>{r.current===null?t(NOe(e)):r.current!==e&&t(EOe({prev:r.current,next:e})),r.current=e},[t,e]),I.useLayoutEffect(()=>()=>{r.current&&(t(AOe(r.current)),r.current=null)},[t]),null},cP=I.memo(_Oe),SOe=["points"];function oV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function jS(e){for(var t=1;t{var T,D,V=jS(jS(jS({r:3},o),y),{},{index:j,cx:(T=S.x)!==null&&T!==void 0?T:void 0,cy:(D=S.y)!==null&&D!==void 0?D:void 0,dataKey:a,value:S.value,payload:S.payload,points:t});return I.createElement(OOe,{key:"dot-".concat(j),option:r,dotProps:V,className:i})}),A={};return c&&h!=null&&(A.clipPath="url(#clipPath-".concat(m?"":"dots-").concat(h,")")),I.createElement(Xl,{zIndex:f},I.createElement(co,HN({className:n},A),w))}function lV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function cV(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),KOe=et([WOe,Zd,Jd],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),PA=()=>Xr(KOe),YOe=()=>Xr(C4e);function uV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function IS(e){for(var t=1;t{var{point:t,childIndex:r,mainColor:n,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var c={index:r,dataKey:a,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},h=IS(IS(IS({},c),cb(i)),z4(i)),f;return I.isValidElement(i)?f=I.cloneElement(i,h):typeof i=="function"?f=i(h):f=I.createElement(PJ,h),I.createElement(co,{className:"recharts-active-dot",clipPath:o},f)};function oI(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:i,clipPath:a,zIndex:o=ka.activeDot}=e,c=Xr(pm),h=YOe();if(t==null||h==null)return null;var f=t.find(m=>h.includes(m.payload));return xs(f)?null:I.createElement(Xl,{zIndex:o},I.createElement(JOe,{point:f,childIndex:Number(c),mainColor:r,dataKey:i,activeDot:n,clipPath:a}))}var dV=(e,t,r)=>{var n=r??e;if(!xs(n))return Yc(n,t,0)},e6e=(e,t,r)=>{var n={},i=e.filter(vA),a=e.filter(f=>f.stackId==null),o=i.reduce((f,m)=>{var y=f[m.stackId];return y==null&&(y=[]),y.push(m),f[m.stackId]=y,f},n),c=Object.entries(o).map(f=>{var m,[y,w]=f,A=w.map(j=>j.dataKey),S=dV(t,r,(m=w[0])===null||m===void 0?void 0:m.barSize);return{stackId:y,dataKeys:A,barSize:S}}),h=a.map(f=>{var m=[f.dataKey].filter(w=>w!=null),y=dV(t,r,f.barSize);return{stackId:void 0,dataKeys:m,barSize:y}});return[...c,...h]};function hV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function fw(e){for(var t=1;tV+(U.barSize||0),0);w+=(o-1)*c,w>=r&&(w-=(o-1)*c,c=0),w>=r&&y>0&&(m=!0,y*=.9,w=o*y);var A=(r-w)/2>>0,S={offset:A-c,size:0};h=n.reduce((V,U)=>{var G,X={stackId:U.stackId,dataKeys:U.dataKeys,position:{offset:S.offset+S.size+c,size:m?y:(G=U.barSize)!==null&&G!==void 0?G:0}},q=[...V,X];return S=X.position,q},f)}else{var j=Yc(t,r,0,!0);r-2*j-(o-1)*c<=0&&(c=0);var T=(r-2*j-(o-1)*c)/o;T>1&&(T>>=0);var D=Wn(i)?Math.min(T,i):T;h=n.reduce((V,U,G)=>[...V,{stackId:U.stackId,dataKeys:U.dataKeys,position:{offset:j+(T+c)*G+(T-D)/2,size:D}}],f)}return h}}var s6e=(e,t,r,n,i,a,o)=>{var c=xs(o)?t:o,h=i6e(r,n,i!==a?i:a,e,c);return i!==a&&h!=null&&(h=h.map(f=>fw(fw({},f),{},{position:fw(fw({},f.position),{},{offset:f.position.offset-i/2})}))),h},a6e=(e,t)=>{var r=bA(t);if(!(!e||r==null||t==null)){var{stackId:n}=t;if(n!=null){var i=e[n];if(i){var{stackedData:a}=i;if(a)return a.find(o=>o.key===r)}}}},o6e=(e,t)=>{if(!(e==null||t==null)){var r=e.find(n=>n.stackId===t.stackId&&t.dataKey!=null&&n.dataKeys.includes(t.dataKey));if(r!=null)return r.position}};function l6e(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&Wn(e.zIndex)?e.zIndex:t}var c6e=e=>{var{chartData:t}=e,r=ys(),n=$a();return I.useEffect(()=>n?()=>{}:(r(_z(t)),()=>{r(_z(void 0))}),[t,r,n]),null},fV={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},$J=To({name:"brush",initialState:fV,reducers:{setBrushSettings(e,t){return t.payload==null?fV:t.payload}}}),{setBrushSettings:Y9e}=$J.actions,u6e=$J.reducer;function d6e(e){return(e%180+180)%180}var h6e=function(t){var{width:r,height:n}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=d6e(i),o=a*Math.PI/180,c=Math.atan(n/r),h=o>c&&o{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=yc(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=yc(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=yc(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:X9e,removeDot:Q9e,addArea:Z9e,removeArea:J9e,addLine:eLe,removeLine:tLe}=HJ.actions,p6e=HJ.reducer,m6e=I.createContext(void 0),g6e=e=>{var{children:t}=e,[r]=I.useState("".concat(Ey("recharts"),"-clip")),n=PA();if(n==null)return null;var{x:i,y:a,width:o,height:c}=n;return I.createElement(m6e.Provider,{value:r},I.createElement("defs",null,I.createElement("clipPath",{id:r},I.createElement("rect",{x:i,y:a,height:c,width:o}))),t)};function GJ(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;ne*i)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-i)<=0}function b6e(e,t){return GJ(e,t+1)}function v6e(e,t,r,n,i){for(var a=(n||[]).slice(),{start:o,end:c}=t,h=0,f=1,m=o,y=function(){var S=n==null?void 0:n[h];if(S===void 0)return{v:GJ(n,f)};var j=h,T,D=()=>(T===void 0&&(T=r(S,j)),T),V=S.coordinate,U=h===0||Ly(e,V,D,m,c);U||(h=0,m=o,f+=1),U&&(m=V+e*(D()/2+i),h+=f)},w;f<=a.length;)if(w=y(),w)return w.v;return[]}function w6e(e,t,r,n,i){var a=(n||[]).slice(),o=a.length;if(o===0)return[];for(var{start:c,end:h}=t,f=1;f<=o;f++){for(var m=(o-1)%f,y=c,w=!0,A=function(){var G=n[j];if(G==null)return 0;var X=j,q,B=()=>(q===void 0&&(q=r(G,X)),q),z=G.coordinate,F=j===m||Ly(e,z,B,y,h);if(!F)return w=!1,1;F&&(y=z+e*(B()/2+i))},S,j=m;j(j===void 0&&(j=r(A,w)),j);if(w===o-1){var D=e*(S.coordinate+e*T()/2-h);a[w]=S=vo(vo({},S),{},{tickCoord:D>0?S.coordinate-D*e:S.coordinate})}else a[w]=S=vo(vo({},S),{},{tickCoord:S.coordinate});if(S.tickCoord!=null){var V=Ly(e,S.tickCoord,T,c,h);V&&(h=S.tickCoord-e*(T()/2+i),a[w]=vo(vo({},S),{},{isShow:!0}))}},m=o-1;m>=0;m--)f(m);return a}function _6e(e,t,r,n,i,a){var o=(n||[]).slice(),c=o.length,{start:h,end:f}=t;if(a){var m=n[c-1];if(m!=null){var y=r(m,c-1),w=e*(m.coordinate+e*y/2-f);if(o[c-1]=m=vo(vo({},m),{},{tickCoord:w>0?m.coordinate-w*e:m.coordinate}),m.tickCoord!=null){var A=Ly(e,m.tickCoord,()=>y,h,f);A&&(f=m.tickCoord-e*(y/2+i),o[c-1]=vo(vo({},m),{},{isShow:!0}))}}}for(var S=a?c-1:c,j=function(V){var U=o[V];if(U==null)return 1;var G=U,X,q=()=>(X===void 0&&(X=r(U,V)),X);if(V===0){var B=e*(G.coordinate-e*q()/2-h);o[V]=G=vo(vo({},G),{},{tickCoord:B<0?G.coordinate-B*e:G.coordinate})}else o[V]=G=vo(vo({},G),{},{tickCoord:G.coordinate});if(G.tickCoord!=null){var z=Ly(e,G.tickCoord,q,h,f);z&&(h=G.tickCoord+e*(q()/2+i),o[V]=vo(vo({},G),{},{isShow:!0}))}},T=0;T{var B=typeof f=="function"?f(X.value,q):X.value;return S==="width"?x6e(ry(B,{fontSize:t,letterSpacing:r}),j,y):ry(B,{fontSize:t,letterSpacing:r})[S]},D=i[0],V=i[1],U=i.length>=2&&D!=null&&V!=null?fl(V.coordinate-D.coordinate):1,G=y6e(a,U,S);return h==="equidistantPreserveStart"?v6e(U,G,T,i,o):h==="equidistantPreserveEnd"?w6e(U,G,T,i,o):(h==="preserveStart"||h==="preserveStartEnd"?A=_6e(U,G,T,i,o,h==="preserveStartEnd"):A=k6e(U,G,T,i,o),A.filter(X=>X.isShow))}var S6e=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(m=>{if(m){var y=m.getBoundingClientRect();y.width>o&&(o=y.width)}});var c=r?r.getBoundingClientRect().width:0,h=i+a,f=o+h+c+(r?n:0);return Math.round(f)}return 0},C6e={xAxis:{},yAxis:{}},qJ=To({name:"renderedTicks",initialState:C6e,reducers:{setRenderedTicks:(e,t)=>{var{axisType:r,axisId:n,ticks:i}=t.payload;e[r][n]=i},removeRenderedTicks:(e,t)=>{var{axisType:r,axisId:n}=t.payload;delete e[r][n]}}}),{setRenderedTicks:j6e,removeRenderedTicks:I6e}=qJ.actions,T6e=qJ.reducer,P6e=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function O6e(e,t){if(e==null)return{};var r,n,i=R6e(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{if(n==null||r==null)return Df;var a=t.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return i(j6e({ticks:a,axisId:n,axisType:r})),()=>{i(I6e({axisId:n,axisType:r}))}},[i,t,n,r]),null}var H6e=I.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:i,stroke:a,tickFormatter:o,unit:c,padding:h,tickTextProps:f,orientation:m,mirror:y,x:w,y:A,width:S,height:j,tickSize:T,tickMargin:D,fontSize:V,letterSpacing:U,getTicksConfig:G,events:X,axisType:q,axisId:B}=e,z=uP(Fs(Fs({},G),{},{ticks:r}),V,U),F=Wl(G),$=cb(n),J=AJ(F.textAnchor)?F.textAnchor:z6e(m,y),Q=V6e(m,y),K={};typeof i=="object"&&(K=i);var me=Fs(Fs({},F),{},{fill:"none"},K),re=z.map(je=>Fs({entry:je},B6e(je,w,A,S,j,m,T,y,D))),le=re.map(je=>{var{entry:Ve,line:Z}=je;return I.createElement(co,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(Ve.value,"-").concat(Ve.coordinate,"-").concat(Ve.tickCoord)},i&&I.createElement("line",mm({},me,Z,{className:Mi("recharts-cartesian-axis-tick-line",Sg(i,"className"))})))}),ve=re.map((je,Ve)=>{var Z,se,{entry:xe,tick:ae}=je,qe=Fs(Fs(Fs(Fs({verticalAnchor:Q},F),{},{textAnchor:J,stroke:"none",fill:a},ae),{},{index:Ve,payload:xe,visibleTicksCount:z.length,tickFormatter:o,padding:h},f),{},{angle:(Z=(se=f==null?void 0:f.angle)!==null&&se!==void 0?se:F.angle)!==null&&Z!==void 0?Z:0}),pt=Fs(Fs({},qe),$);return I.createElement(co,mm({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(xe.value,"-").concat(xe.coordinate,"-").concat(xe.tickCoord)},YE(X,xe,Ve)),n&&I.createElement(F6e,{option:n,tickProps:pt,value:"".concat(typeof o=="function"?o(xe.value,Ve):xe.value).concat(c||"")}))});return I.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(q,"-ticks")},I.createElement($6e,{ticks:z,axisId:B,axisType:q}),ve.length>0&&I.createElement(Xl,{zIndex:ka.label},I.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(q,"-tick-labels"),ref:t},ve)),le.length>0&&I.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(q,"-tick-lines")},le))}),G6e=I.forwardRef((e,t)=>{var{axisLine:r,width:n,height:i,className:a,hide:o,ticks:c,axisType:h,axisId:f}=e,m=O6e(e,P6e),[y,w]=I.useState(""),[A,S]=I.useState(""),j=I.useRef(null);I.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var D;return S6e({ticks:j.current,label:(D=e.labelRef)===null||D===void 0?void 0:D.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var T=I.useCallback(D=>{if(D){var V=D.getElementsByClassName("recharts-cartesian-axis-tick-value");j.current=V;var U=V[0];if(U){var G=window.getComputedStyle(U),X=G.fontSize,q=G.letterSpacing;(X!==y||q!==A)&&(w(X),S(q))}}},[y,A]);return o||n!=null&&n<=0||i!=null&&i<=0?null:I.createElement(Xl,{zIndex:e.zIndex},I.createElement(co,{className:Mi("recharts-cartesian-axis",a)},I.createElement(U6e,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:Wl(e)}),I.createElement(H6e,{ref:T,axisType:h,events:m,fontSize:y,getTicksConfig:e,height:e.height,letterSpacing:A,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:c,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:f}),I.createElement(jPe,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},I.createElement(BPe,{label:e.label,labelRef:e.labelRef}),e.children)))}),dP=I.forwardRef((e,t)=>{var r=Va(e,Dd);return I.createElement(G6e,mm({},r,{ref:t}))});dP.displayName="CartesianAxis";var q6e=["x1","y1","x2","y2","key"],W6e=["offset"],K6e=["xAxisId","yAxisId"],Y6e=["xAxisId","yAxisId"];function gV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ao(e){for(var t=1;t{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:i,width:a,height:o,ry:c}=e;return I.createElement("rect",{x:n,y:i,ry:c,width:a,height:o,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function WJ(e){var{option:t,lineItemProps:r}=e,n;if(I.isValidElement(t))n=I.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var i,{x1:a,y1:o,x2:c,y2:h,key:f}=r,m=GN(r,q6e),y=(i=Wl(m))!==null&&i!==void 0?i:{},{offset:w}=y,A=GN(y,W6e);n=I.createElement("line",Cp({},A,{x1:a,y1:o,x2:c,y2:h,fill:"none",key:f}))}return n}function tRe(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,c=GN(e,K6e),h=i.map((f,m)=>{var y=Ao(Ao({},c),{},{x1:t,y1:f,x2:t+r,y2:f,key:"line-".concat(m),index:m});return I.createElement(WJ,{key:"line-".concat(m),option:n,lineItemProps:y})});return I.createElement("g",{className:"recharts-cartesian-grid-horizontal"},h)}function rRe(e){var{y:t,height:r,vertical:n=!0,verticalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,c=GN(e,Y6e),h=i.map((f,m)=>{var y=Ao(Ao({},c),{},{x1:f,y1:t,x2:f,y2:t+r,key:"line-".concat(m),index:m});return I.createElement(WJ,{option:n,lineItemProps:y,key:"line-".concat(m)})});return I.createElement("g",{className:"recharts-cartesian-grid-vertical"},h)}function nRe(e){var{horizontalFill:t,fillOpacity:r,x:n,y:i,width:a,height:o,horizontalPoints:c,horizontal:h=!0}=e;if(!h||!t||!t.length||c==null)return null;var f=c.map(y=>Math.round(y+i-i)).sort((y,w)=>y-w);i!==f[0]&&f.unshift(0);var m=f.map((y,w)=>{var A=f[w+1],S=A==null,j=S?i+o-y:A-y;if(j<=0)return null;var T=w%t.length;return I.createElement("rect",{key:"react-".concat(w),y,x:n,height:j,width:a,stroke:"none",fill:t[T],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return I.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},m)}function iRe(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:i,y:a,width:o,height:c,verticalPoints:h}=e;if(!t||!r||!r.length)return null;var f=h.map(y=>Math.round(y+i-i)).sort((y,w)=>y-w);i!==f[0]&&f.unshift(0);var m=f.map((y,w)=>{var A=f[w+1],S=A==null,j=S?i+o-y:A-y;if(j<=0)return null;var T=w%r.length;return I.createElement("rect",{key:"react-".concat(w),x:y,y:a,width:j,height:c,stroke:"none",fill:r[T],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return I.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},m)}var sRe=(e,t)=>{var{xAxis:r,width:n,height:i,offset:a}=e;return _X(uP(Ao(Ao(Ao({},Dd),r),{},{ticks:SX(r),viewBox:{x:0,y:0,width:n,height:i}})),a.left,a.left+a.width,t)},aRe=(e,t)=>{var{yAxis:r,width:n,height:i,offset:a}=e;return _X(uP(Ao(Ao(Ao({},Dd),r),{},{ticks:SX(r),viewBox:{x:0,y:0,width:n,height:i}})),a.top,a.top+a.height,t)},oRe={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:ka.grid};function KJ(e){var t=Z4(),r=J4(),n=OX(),i=Ao(Ao({},Va(e,oRe)),{},{x:wr(e.x)?e.x:n.left,y:wr(e.y)?e.y:n.top,width:wr(e.width)?e.width:n.width,height:wr(e.height)?e.height:n.height}),{xAxisId:a,yAxisId:o,x:c,y:h,width:f,height:m,syncWithTicks:y,horizontalValues:w,verticalValues:A}=i,S=$a(),j=Xr(F=>fz(F,"xAxis",a,S)),T=Xr(F=>fz(F,"yAxis",o,S));if(!qu(f)||!qu(m)||!wr(c)||!wr(h))return null;var D=i.verticalCoordinatesGenerator||sRe,V=i.horizontalCoordinatesGenerator||aRe,{horizontalPoints:U,verticalPoints:G}=i;if((!U||!U.length)&&typeof V=="function"){var X=w&&w.length,q=V({yAxis:T?Ao(Ao({},T),{},{ticks:X?w:T.ticks}):void 0,width:t??f,height:r??m,offset:n},X?!0:y);mN(Array.isArray(q),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof q,"]")),Array.isArray(q)&&(U=q)}if((!G||!G.length)&&typeof D=="function"){var B=A&&A.length,z=D({xAxis:j?Ao(Ao({},j),{},{ticks:B?A:j.ticks}):void 0,width:t??f,height:r??m,offset:n},B?!0:y);mN(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof z,"]")),Array.isArray(z)&&(G=z)}return I.createElement(Xl,{zIndex:i.zIndex},I.createElement("g",{className:"recharts-cartesian-grid"},I.createElement(eRe,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),I.createElement(nRe,Cp({},i,{horizontalPoints:U})),I.createElement(iRe,Cp({},i,{verticalPoints:G})),I.createElement(tRe,Cp({},i,{offset:n,horizontalPoints:U,xAxis:j,yAxis:T})),I.createElement(rRe,Cp({},i,{offset:n,verticalPoints:G,xAxis:j,yAxis:T}))))}KJ.displayName="CartesianGrid";var lRe={},YJ=To({name:"errorBars",initialState:lRe,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:i}=t.payload;e[r]&&(e[r]=e[r].map(a=>a.dataKey===n.dataKey&&a.direction===n.direction?i:a))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(i=>i.dataKey!==n.dataKey||i.direction!==n.direction))}}}),{addErrorBar:rLe,replaceErrorBar:nLe,removeErrorBar:iLe}=YJ.actions,cRe=YJ.reducer,uRe=["children"];function dRe(e,t){if(e==null)return{};var r,n,i=hRe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n({x:0,y:0,value:0}),errorBarOffset:0},pRe=I.createContext(fRe);function XJ(e){var{children:t}=e,r=dRe(e,uRe);return I.createElement(pRe.Provider,{value:r},t)}function OA(e,t){var r,n,i=Xr(f=>th(f,e)),a=Xr(f=>rh(f,t)),o=(r=i==null?void 0:i.allowDataOverflow)!==null&&r!==void 0?r:ba.allowDataOverflow,c=(n=a==null?void 0:a.allowDataOverflow)!==null&&n!==void 0?n:va.allowDataOverflow,h=o||c;return{needClip:h,needClipX:o,needClipY:c}}function hP(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,i=PA(),{needClipX:a,needClipY:o,needClip:c}=OA(t,r);if(!c||!i)return null;var{x:h,y:f,width:m,height:y}=i;return I.createElement("clipPath",{id:"clipPath-".concat(n)},I.createElement("rect",{x:a?h:h-m/2,y:o?f:f-y/2,width:a?m:m*2,height:o?y:y*2}))}var QJ=(e,t,r,n)=>Xu(e,"xAxis",t,n),ZJ=(e,t,r,n)=>Yu(e,"xAxis",t,n),JJ=(e,t,r,n)=>Xu(e,"yAxis",r,n),eee=(e,t,r,n)=>Yu(e,"yAxis",r,n),mRe=et([Si,QJ,JJ,ZJ,eee],(e,t,r,n,i)=>Zc(e,"xAxis")?Ef(t,n,!1):Ef(r,i,!1)),gRe=(e,t,r,n,i)=>i;function xRe(e){return e.type==="line"}var yRe=et([kb,gRe],(e,t)=>e.filter(xRe).find(r=>r.id===t)),bRe=et([Si,QJ,JJ,ZJ,eee,yRe,mRe,bb],(e,t,r,n,i,a,o,c)=>{var{chartData:h,dataStartIndex:f,dataEndIndex:m}=c;if(!(a==null||t==null||r==null||n==null||i==null||n.length===0||i.length===0||o==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:y,data:w}=a,A;if(w!=null&&w.length>0?A=w:A=h==null?void 0:h.slice(f,m+1),A!=null)return BRe({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataKey:y,bandSize:o,displayedData:A})}});function tee(e){var t=cb(e),r=3,n=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),c=Number(a);return(Number.isNaN(o)||o<0)&&(o=r),(Number.isNaN(c)||c<0)&&(c=n),{r:o,strokeWidth:c}}return{r,strokeWidth:n}}var vRe=["id"],wRe=["type","layout","connectNulls","needClip","shape"],NRe=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Uy(){return Uy=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,stroke:n,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:n,value:Yg(r,t),payload:e}]},CRe=I.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:a,name:o,hide:c,unit:h,tooltipType:f,id:m}=e,y={dataDefinedOnItem:r,getPosition:Df,settings:{stroke:n,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Yg(o,t),hide:c,type:f,color:n,unit:h,graphicalItemId:m}};return I.createElement(aP,{tooltipEntrySettings:y})}),ree=(e,t)=>"".concat(t,"px ").concat(e,"px");function jRe(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],i=0;i{var n=r.reduce((w,A)=>w+A,0);if(!n)return ree(t,e);for(var i=Math.floor(e/n),a=e%n,o=[],c=0,h=0;ca){o=[...r.slice(0,c),a-h];break}}var y=o.length%2===0?[0,t]:[t];return[...jRe(r,i),...o,...y].map(w=>"".concat(w,"px")).join(", ")};function TRe(e){var{clipPathId:t,points:r,props:n}=e,{dot:i,dataKey:a,needClip:o}=n,{id:c}=n,h=fP(n,vRe),f=Wl(h);return I.createElement(zJ,{points:r,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:f,needClip:o,clipPathId:t})}function PRe(e){var{showLabels:t,children:r,points:n}=e,i=I.useMemo(()=>n==null?void 0:n.map(a=>{var o,c,h={x:(o=a.x)!==null&&o!==void 0?o:0,y:(c=a.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return _u(_u({},h),{},{value:a.value,payload:a.payload,viewBox:h,parentViewBox:void 0,fill:void 0})}),[n]);return I.createElement(nP,{value:t?i:void 0},r)}function yV(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:i,props:a}=e,{type:o,layout:c,connectNulls:h,needClip:f,shape:m}=a,y=fP(a,wRe),w=_u(_u({},jo(y)),{},{fill:"none",className:"recharts-line-curve",clipPath:f?"url(#clipPath-".concat(t,")"):void 0,points:n,type:o,layout:c,connectNulls:h,strokeDasharray:i??a.strokeDasharray});return I.createElement(I.Fragment,null,(n==null?void 0:n.length)>1&&I.createElement(DJ,Uy({shapeType:"curve",option:m},w,{pathRef:r})),I.createElement(TRe,{points:n,clipPathId:t,props:a}))}function ORe(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function RRe(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:c,isAnimationActive:h,animationBegin:f,animationDuration:m,animationEasing:y,animateNewValues:w,width:A,height:S,onAnimationEnd:j,onAnimationStart:T}=r,D=i.current,V=yb(o,"recharts-line-"),U=I.useRef(V),[G,X]=I.useState(!1),q=!G,B=I.useCallback(()=>{typeof j=="function"&&j(),X(!1)},[j]),z=I.useCallback(()=>{typeof T=="function"&&T(),X(!0)},[T]),F=ORe(n.current),$=I.useRef(0);U.current!==V&&($.current=a.current,U.current=V);var J=$.current;return I.createElement(PRe,{points:o,showLabels:q},r.children,I.createElement(xb,{animationId:V,begin:f,duration:m,isActive:h,easing:y,onAnimationEnd:B,onAnimationStart:z,key:V},Q=>{var K=Qi(J,F+J,Q),me=Math.min(K,F),re;if(h)if(c){var le="".concat(c).split(/[,\s]+/gim).map(Ve=>parseFloat(Ve));re=IRe(me,F,le)}else re=ree(F,me);else re=c==null?void 0:String(c);if(Q>0&&F>0&&(i.current=o,a.current=Math.max(a.current,me)),D){var ve=D.length/o.length,je=Q===1?o:o.map((Ve,Z)=>{var se=Math.floor(Z*ve);if(D[se]){var xe=D[se];return _u(_u({},Ve),{},{x:Qi(xe.x,Ve.x,Q),y:Qi(xe.y,Ve.y,Q)})}return w?_u(_u({},Ve),{},{x:Qi(A*2,Ve.x,Q),y:Qi(S/2,Ve.y,Q)}):_u(_u({},Ve),{},{x:Ve.x,y:Ve.y})});return i.current=je,I.createElement(yV,{props:r,points:je,clipPathId:t,pathRef:n,strokeDasharray:re})}return I.createElement(yV,{props:r,points:o,clipPathId:t,pathRef:n,strokeDasharray:re})}),I.createElement(iP,{label:r.label}))}function DRe(e){var{clipPathId:t,props:r}=e,n=I.useRef(null),i=I.useRef(0),a=I.useRef(null);return I.createElement(RRe,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:i,pathRef:a})}var MRe=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:Rs(e.payload,t)}};class LRe extends I.Component{render(){var{hide:t,dot:r,points:n,className:i,xAxisId:a,yAxisId:o,top:c,left:h,width:f,height:m,id:y,needClip:w,zIndex:A}=this.props;if(t)return null;var S=Mi("recharts-line",i),j=y,{r:T,strokeWidth:D}=tee(r),V=sP(r),U=T*2+D,G=w?"url(#clipPath-".concat(V?"":"dots-").concat(j,")"):void 0;return I.createElement(Xl,{zIndex:A},I.createElement(co,{className:S},w&&I.createElement("defs",null,I.createElement(hP,{clipPathId:j,xAxisId:a,yAxisId:o}),!V&&I.createElement("clipPath",{id:"clipPath-dots-".concat(j)},I.createElement("rect",{x:h-U/2,y:c-U/2,width:f+U,height:m+U}))),I.createElement(XJ,{xAxisId:a,yAxisId:o,data:n,dataPointFormatter:MRe,errorBarOffset:0},I.createElement(DRe,{props:this.props,clipPathId:j}))),I.createElement(oI,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:G}))}}var nee={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:ka.line,type:"linear"};function URe(e){var t=Va(e,nee),{activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:c,dot:h,hide:f,isAnimationActive:m,label:y,legendType:w,xAxisId:A,yAxisId:S,id:j}=t,T=fP(t,NRe),{needClip:D}=OA(A,S),V=PA(),U=Mf(),G=$a(),X=Xr($=>bRe($,A,S,G,j));if(U!=="horizontal"&&U!=="vertical"||X==null||V==null)return null;var{height:q,width:B,x:z,y:F}=V;return I.createElement(LRe,Uy({},T,{id:j,connectNulls:c,dot:h,activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:m,hide:f,label:y,legendType:w,xAxisId:A,yAxisId:S,points:X,layout:U,height:q,width:B,left:z,top:F,needClip:D}))}function BRe(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:c,displayedData:h}=e;return h.map((f,m)=>{var y=Rs(f,o);if(t==="horizontal"){var w=pN({axis:r,ticks:i,bandSize:c,entry:f,index:m}),A=xs(y)?null:n.scale.map(y);return{x:w,y:A??null,value:y,payload:f}}var S=xs(y)?null:r.scale.map(y),j=pN({axis:n,ticks:a,bandSize:c,entry:f,index:m});return S==null||j==null?null:{x:S,y:j,value:y,payload:f}}).filter(Boolean)}function zRe(e){var t=Va(e,nee),r=$a();return I.createElement(lP,{id:t.id,type:"line"},n=>I.createElement(I.Fragment,null,I.createElement(oP,{legendPayload:SRe(t)}),I.createElement(CRe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),I.createElement(cP,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),I.createElement(URe,Uy({},t,{id:n}))))}var iee=I.memo(zRe,Nm);iee.displayName="Line";function Ju(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||n===void 0?void 0:n.xAxisId)!==null&&r!==void 0?r:VJ}function ed(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||n===void 0?void 0:n.yAxisId)!==null&&r!==void 0?r:VJ}var see=(e,t,r)=>Xu(e,"xAxis",Ju(e,t),r),aee=(e,t,r)=>Yu(e,"xAxis",Ju(e,t),r),oee=(e,t,r)=>Xu(e,"yAxis",ed(e,t),r),lee=(e,t,r)=>Yu(e,"yAxis",ed(e,t),r),VRe=et([Si,see,oee,aee,lee],(e,t,r,n,i)=>Zc(e,"xAxis")?Ef(t,n,!1):Ef(r,i,!1)),FRe=(e,t)=>t,cee=et([kb,FRe],(e,t)=>e.filter(r=>r.type==="area").find(r=>r.id===t)),uee=e=>{var t=Si(e),r=Zc(t,"xAxis");return r?"yAxis":"xAxis"},$Re=(e,t)=>{var r=uee(e);return r==="yAxis"?ed(e,t):Ju(e,t)},HRe=(e,t,r)=>LN(e,uee(e),$Re(e,t),r),GRe=et([cee,HRe],(e,t)=>{var r;if(!(e==null||t==null)){var{stackId:n}=e,i=bA(e);if(!(n==null||i==null)){var a=(r=t[n])===null||r===void 0?void 0:r.stackedData,o=a==null?void 0:a.find(c=>c.key===i);if(o!=null)return o.map(c=>[c[0],c[1]])}}}),qRe=et([Si,see,oee,aee,lee,GRe,eQ,VRe,cee,DSe],(e,t,r,n,i,a,o,c,h,f)=>{var{chartData:m,dataStartIndex:y,dataEndIndex:w}=o;if(!(h==null||e!=="horizontal"&&e!=="vertical"||t==null||r==null||n==null||i==null||n.length===0||i.length===0||c==null)){var{data:A}=h,S;if(A&&A.length>0?S=A:S=m==null?void 0:m.slice(y,w+1),S!=null)return hDe({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataStartIndex:y,areaSettings:h,stackedData:a,displayedData:S,chartBaseValue:f,bandSize:c})}}),WRe=["id"],KRe=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Fp(){return Fp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,stroke:n,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:qN(n,i),value:Yg(r,t),payload:e}]},eDe=I.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:a,name:o,hide:c,unit:h,tooltipType:f,id:m}=e,y={dataDefinedOnItem:r,getPosition:Df,settings:{stroke:n,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Yg(o,t),hide:c,type:f,color:qN(n,a),unit:h,graphicalItemId:m}};return I.createElement(aP,{tooltipEntrySettings:y})});function tDe(e){var{clipPathId:t,points:r,props:n}=e,{needClip:i,dot:a,dataKey:o}=n,c=Wl(n);return I.createElement(zJ,{points:r,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:c,needClip:i,clipPathId:t})}function rDe(e){var{showLabels:t,children:r,points:n}=e,i=n.map(a=>{var o,c,h={x:(o=a.x)!==null&&o!==void 0?o:0,y:(c=a.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return H0(H0({},h),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:h,fill:void 0})});return I.createElement(nP,{value:t?i:void 0},r)}function vV(e){var{points:t,baseLine:r,needClip:n,clipPathId:i,props:a}=e,{layout:o,type:c,stroke:h,connectNulls:f,isRange:m}=a,{id:y}=a,w=dee(a,WRe),A=Wl(w),S=jo(w);return I.createElement(I.Fragment,null,(t==null?void 0:t.length)>1&&I.createElement(co,{clipPath:n?"url(#clipPath-".concat(i,")"):void 0},I.createElement(ey,Fp({},S,{id:y,points:t,connectNulls:f,type:c,baseLine:r,layout:o,stroke:"none",className:"recharts-area-area"})),h!=="none"&&I.createElement(ey,Fp({},A,{className:"recharts-area-curve",layout:o,type:c,connectNulls:f,fill:"none",points:t})),h!=="none"&&m&&Array.isArray(r)&&I.createElement(ey,Fp({},A,{className:"recharts-area-curve",layout:o,type:c,connectNulls:f,fill:"none",points:r}))),I.createElement(tDe,{points:t,props:w,clipPathId:i}))}function nDe(e){var t,r,{alpha:n,baseLine:i,points:a,strokeWidth:o}=e,c=(t=a[0])===null||t===void 0?void 0:t.y,h=(r=a[a.length-1])===null||r===void 0?void 0:r.y;if(!Wn(c)||!Wn(h))return null;var f=n*Math.abs(c-h),m=Math.max(...a.map(y=>y.x||0));return wr(i)?m=Math.max(i,m):i&&Array.isArray(i)&&i.length&&(m=Math.max(...i.map(y=>y.x||0),m)),wr(m)?I.createElement("rect",{x:0,y:cy.y||0));return wr(i)?m=Math.max(i,m):i&&Array.isArray(i)&&i.length&&(m=Math.max(...i.map(y=>y.y||0),m)),wr(m)?I.createElement("rect",{x:c({points:o,baseLine:c}),[o,c]),j=yb(S,"recharts-area-"),T=e3(),[D,V]=I.useState(!1),U=!D,G=I.useCallback(()=>{typeof A=="function"&&A(),V(!1)},[A]),X=I.useCallback(()=>{typeof w=="function"&&w(),V(!0)},[w]);if(T==null)return null;var q=i.current,B=a.current;return I.createElement(rDe,{showLabels:U,points:o},n.children,I.createElement(xb,{animationId:j,begin:f,duration:m,isActive:h,easing:y,onAnimationEnd:G,onAnimationStart:X,key:j},z=>{if(q){var F=q.length/o.length,$=z===1?o:o.map((Q,K)=>{var me=Math.floor(K*F);if(q[me]){var re=q[me];return H0(H0({},Q),{},{x:Qi(re.x,Q.x,z),y:Qi(re.y,Q.y,z)})}return Q}),J;return wr(c)?J=Qi(B,c,z):xs(c)||Kc(c)?J=Qi(B,0,z):J=c.map((Q,K)=>{var me=Math.floor(K*F);if(Array.isArray(B)&&B[me]){var re=B[me];return H0(H0({},Q),{},{x:Qi(re.x,Q.x,z),y:Qi(re.y,Q.y,z)})}return Q}),z>0&&(i.current=$,a.current=J),I.createElement(vV,{points:$,baseLine:J,needClip:t,clipPathId:r,props:n})}return z>0&&(i.current=o,a.current=c),I.createElement(co,null,h&&I.createElement("defs",null,I.createElement("clipPath",{id:"animationClipPath-".concat(r)},I.createElement(sDe,{alpha:z,points:o,baseLine:c,layout:T,strokeWidth:n.strokeWidth}))),I.createElement(co,{clipPath:"url(#animationClipPath-".concat(r,")")},I.createElement(vV,{points:o,baseLine:c,needClip:t,clipPathId:r,props:n})))}),I.createElement(iP,{label:n.label}))}function oDe(e){var{needClip:t,clipPathId:r,props:n}=e,i=I.useRef(null),a=I.useRef();return I.createElement(aDe,{needClip:t,clipPathId:r,props:n,previousPointsRef:i,previousBaselineRef:a})}class lDe extends I.PureComponent{render(){var{hide:t,dot:r,points:n,className:i,top:a,left:o,needClip:c,xAxisId:h,yAxisId:f,width:m,height:y,id:w,baseLine:A,zIndex:S}=this.props;if(t)return null;var j=Mi("recharts-area",i),T=w,{r:D,strokeWidth:V}=tee(r),U=sP(r),G=D*2+V,X=c?"url(#clipPath-".concat(U?"":"dots-").concat(T,")"):void 0;return I.createElement(Xl,{zIndex:S},I.createElement(co,{className:j},c&&I.createElement("defs",null,I.createElement(hP,{clipPathId:T,xAxisId:h,yAxisId:f}),!U&&I.createElement("clipPath",{id:"clipPath-dots-".concat(T)},I.createElement("rect",{x:o-G/2,y:a-G/2,width:m+G,height:y+G}))),I.createElement(oDe,{needClip:c,clipPathId:T,props:this.props})),I.createElement(oI,{points:n,mainColor:qN(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:X}),this.props.isRange&&Array.isArray(A)&&I.createElement(oI,{points:A,mainColor:qN(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:X}))}}var cDe={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:ka.area};function uDe(e){var t,{activeDot:r,animationBegin:n,animationDuration:i,animationEasing:a,connectNulls:o,dot:c,fill:h,fillOpacity:f,hide:m,isAnimationActive:y,legendType:w,stroke:A,xAxisId:S,yAxisId:j}=e,T=dee(e,KRe),D=Mf(),V=uJ(),{needClip:U}=OA(S,j),G=$a(),{points:X,isRange:q,baseLine:B}=(t=Xr(K=>qRe(K,e.id,G)))!==null&&t!==void 0?t:{},z=PA();if(D!=="horizontal"&&D!=="vertical"||z==null||V!=="AreaChart"&&V!=="ComposedChart")return null;var{height:F,width:$,x:J,y:Q}=z;return!X||!X.length?null:I.createElement(lDe,Fp({},T,{activeDot:r,animationBegin:n,animationDuration:i,animationEasing:a,baseLine:B,connectNulls:o,dot:c,fill:h,fillOpacity:f,height:F,hide:m,layout:D,isAnimationActive:y,isRange:q,legendType:w,needClip:U,points:X,stroke:A,width:$,left:J,top:Q,xAxisId:S,yAxisId:j}))}var dDe=(e,t,r,n,i)=>{var a=r??t;if(wr(a))return a;var o=e==="horizontal"?i:n,c=o.scale.domain();if(o.type==="number"){var h=Math.max(c[0],c[1]),f=Math.min(c[0],c[1]);return a==="dataMin"?f:a==="dataMax"||h<0?h:Math.max(Math.min(c[0],c[1]),0)}return a==="dataMin"?c[0]:a==="dataMax"?c[1]:c[0]};function hDe(e){var{areaSettings:{connectNulls:t,baseValue:r,dataKey:n},stackedData:i,layout:a,chartBaseValue:o,xAxis:c,yAxis:h,displayedData:f,dataStartIndex:m,xAxisTicks:y,yAxisTicks:w,bandSize:A}=e,S=i&&i.length,j=dDe(a,o,r,c,h),T=a==="horizontal",D=!1,V=f.map((G,X)=>{var q,B,z,F;if(S)F=i[m+X];else{var $=Rs(G,n);Array.isArray($)?(F=$,D=!0):F=[j,$]}var J=(q=(B=F)===null||B===void 0?void 0:B[1])!==null&&q!==void 0?q:null,Q=J==null||S&&!t&&Rs(G,n)==null;if(T){var K;return{x:pN({axis:c,ticks:y,bandSize:A,entry:G,index:X}),y:Q?null:(K=h.scale.map(J))!==null&&K!==void 0?K:null,value:F,payload:G}}return{x:Q?null:(z=c.scale.map(J))!==null&&z!==void 0?z:null,y:pN({axis:h,ticks:w,bandSize:A,entry:G,index:X}),value:F,payload:G}}),U;return S||D?U=V.map(G=>{var X,q=Array.isArray(G.value)?G.value[0]:null;if(T){var B;return{x:G.x,y:q!=null&&G.y!=null&&(B=h.scale.map(q))!==null&&B!==void 0?B:null,payload:G.payload}}return{x:q!=null&&(X=c.scale.map(q))!==null&&X!==void 0?X:null,y:G.y,payload:G.payload}}):U=T?h.scale.map(j):c.scale.map(j),{points:V,baseLine:U??0,isRange:D}}function fDe(e){var t=Va(e,cDe),r=$a();return I.createElement(lP,{id:t.id,type:"area"},n=>I.createElement(I.Fragment,null,I.createElement(oP,{legendPayload:JRe(t)}),I.createElement(eDe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),I.createElement(cP,{type:"area",id:n,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:CX(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:r,connectNulls:t.connectNulls}),I.createElement(uDe,Fp({},t,{id:n}))))}var lI=I.memo(fDe,Nm);lI.displayName="Area";var pDe="Invariant failed";function mDe(e,t){throw new Error(pDe)}function cI(){return cI=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:0;return(n,i)=>{if(wr(t))return t;var a=wr(n)||xs(n);return a?t(n,i):(a||mDe(),r)}},xDe=(e,t,r)=>r,yDe=(e,t)=>t,Ib=et([kb,yDe],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),bDe=et([Ib],e=>e==null?void 0:e.maxBarSize),vDe=(e,t,r,n)=>n,wDe=et([Si,kb,Ju,ed,xDe],(e,t,r,n,i)=>t.filter(a=>e==="horizontal"?a.xAxisId===r:a.yAxisId===n).filter(a=>a.isPanorama===i).filter(a=>a.hide===!1).filter(a=>a.type==="bar")),NDe=(e,t,r)=>{var n=Si(e),i=Ju(e,t),a=ed(e,t);if(!(i==null||a==null))return n==="horizontal"?LN(e,"yAxis",a,r):LN(e,"xAxis",i,r)},EDe=(e,t)=>{var r=Si(e),n=Ju(e,t),i=ed(e,t);if(!(n==null||i==null))return r==="horizontal"?hz(e,"xAxis",n):hz(e,"yAxis",i)},ADe=et([wDe,RSe,EDe],e6e),kDe=(e,t,r)=>{var n,i,a=Ib(e,t);if(a==null)return 0;var o=Ju(e,t),c=ed(e,t);if(o==null||c==null)return 0;var h=Si(e),f=hQ(e),{maxBarSize:m}=a,y=xs(m)?f:m,w,A;return h==="horizontal"?(w=Xu(e,"xAxis",o,r),A=Yu(e,"xAxis",o,r)):(w=Xu(e,"yAxis",c,r),A=Yu(e,"yAxis",c,r)),(n=(i=Ef(w,A,!0))!==null&&i!==void 0?i:y)!==null&&n!==void 0?n:0},hee=(e,t,r)=>{var n=Si(e),i=Ju(e,t),a=ed(e,t);if(!(i==null||a==null)){var o,c;return n==="horizontal"?(o=Xu(e,"xAxis",i,r),c=Yu(e,"xAxis",i,r)):(o=Xu(e,"yAxis",a,r),c=Yu(e,"yAxis",a,r)),Ef(o,c)}},_De=et([ADe,hQ,OSe,fQ,kDe,hee,bDe],s6e),SDe=(e,t,r)=>{var n=Ju(e,t);if(n!=null)return Xu(e,"xAxis",n,r)},CDe=(e,t,r)=>{var n=ed(e,t);if(n!=null)return Xu(e,"yAxis",n,r)},jDe=(e,t,r)=>{var n=Ju(e,t);if(n!=null)return Yu(e,"xAxis",n,r)},IDe=(e,t,r)=>{var n=ed(e,t);if(n!=null)return Yu(e,"yAxis",n,r)},TDe=et([_De,Ib],o6e),PDe=et([NDe,Ib],a6e),ODe=et([Fa,Y4,SDe,CDe,jDe,IDe,TDe,Si,eQ,hee,PDe,Ib,vDe],(e,t,r,n,i,a,o,c,h,f,m,y,w)=>{var{chartData:A,dataStartIndex:S,dataEndIndex:j}=h;if(!(y==null||o==null||t==null||c!=="horizontal"&&c!=="vertical"||r==null||n==null||i==null||a==null||f==null)){var{data:T}=y,D;if(T!=null&&T.length>0?D=T:D=A==null?void 0:A.slice(S,j+1),D!=null)return o8e({layout:c,barSettings:y,pos:o,parentViewBox:t,bandSize:f,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:a,stackedData:m,displayedData:D,offset:e,cells:w,dataStartIndex:S})}}),RDe=["index"];function uI(){return uI=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=I.useContext(fee);if(t!=null)return t.stackId;if(e!=null)return CX(e)},UDe=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),BDe=e=>{var t=I.useContext(fee);if(t!=null){var{stackId:r}=t;return"url(#".concat(UDe(r,e),")")}},pee=e=>{var{index:t}=e,r=DDe(e,RDe),n=BDe(t);return I.createElement(co,uI({className:"recharts-bar-stack-layer",clipPath:n},r))},zDe=["onMouseEnter","onMouseLeave","onClick"],VDe=["value","background","tooltipPosition"],FDe=["id"],$De=["onMouseEnter","onClick","onMouseLeave"];function Af(){return Af=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,fill:n,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:n,value:Yg(r,t),payload:e}]},YDe=I.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:i,name:a,hide:o,unit:c,tooltipType:h,id:f}=e,m={dataDefinedOnItem:void 0,getPosition:Df,settings:{stroke:r,strokeWidth:n,fill:i,dataKey:t,nameKey:void 0,name:Yg(a,t),hide:o,type:h,color:i,unit:c,graphicalItemId:f}};return I.createElement(aP,{tooltipEntrySettings:m})});function XDe(e){var t=Xr(pm),{data:r,dataKey:n,background:i,allOtherBarProps:a}=e,{onMouseEnter:o,onMouseLeave:c,onClick:h}=a,f=WN(a,zDe),m=MJ(o,n,a.id),y=LJ(c),w=UJ(h,n,a.id);if(!i||r==null)return null;var A=cb(i);return I.createElement(Xl,{zIndex:l6e(i,ka.barBackground)},r.map((S,j)=>{var{value:T,background:D,tooltipPosition:V}=S,U=WN(S,VDe);if(!D)return null;var G=m(S,j),X=y(S,j),q=w(S,j),B=Bo(Bo(Bo(Bo(Bo({option:i,isActive:String(j)===t},U),{},{fill:"#eee"},D),A),YE(f,S,j)),{},{onMouseEnter:G,onMouseLeave:X,onClick:q,dataKey:n,index:j,className:"recharts-bar-background-rectangle"});return I.createElement(pP,Af({key:"background-bar-".concat(j)},B))}))}function QDe(e){var{showLabels:t,children:r,rects:n}=e,i=n==null?void 0:n.map(a=>{var o={x:a.x,y:a.y,width:a.width,lowerWidth:a.width,upperWidth:a.width,height:a.height};return Bo(Bo({},o),{},{value:a.value,payload:a.payload,parentViewBox:a.parentViewBox,viewBox:o,fill:a.fill})});return I.createElement(nP,{value:t?i:void 0},r)}function ZDe(e){var{shape:t,activeBar:r,baseProps:n,entry:i,index:a,dataKey:o}=e,c=Xr(pm),h=Xr(oJ),f=r&&String(i.originalDataIndex)===c&&(h==null||o===h),[m,y]=I.useState(!1),[w,A]=I.useState(!1);I.useEffect(()=>{var U;return f?(y(!0),U=requestAnimationFrame(()=>{A(!0)})):A(!1),()=>{cancelAnimationFrame(U)}},[f]);var S=I.useCallback(()=>{f||y(!1)},[f]),j=f&&w,T=f||m,D;f?r===!0?D=t:D=r:D=t;var V=I.createElement(pP,Af({},n,{name:String(n.name)},i,{isActive:j,option:D,index:a,dataKey:o,onTransitionEnd:S}));return T?I.createElement(Xl,{zIndex:ka.activeBar},I.createElement(pee,{index:i.originalDataIndex},V)):V}function JDe(e){var{shape:t,baseProps:r,entry:n,index:i,dataKey:a}=e;return I.createElement(pP,Af({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:i,dataKey:a}))}function e8e(e){var t,{data:r,props:n}=e,i=(t=Wl(n))!==null&&t!==void 0?t:{},{id:a}=i,o=WN(i,FDe),{shape:c,dataKey:h,activeBar:f}=n,{onMouseEnter:m,onClick:y,onMouseLeave:w}=n,A=WN(n,$De),S=MJ(m,h,a),j=LJ(w),T=UJ(y,h,a);return r?I.createElement(I.Fragment,null,r.map((D,V)=>I.createElement(pee,Af({index:D.originalDataIndex,key:"rectangle-".concat(D==null?void 0:D.x,"-").concat(D==null?void 0:D.y,"-").concat(D==null?void 0:D.value,"-").concat(V),className:"recharts-bar-rectangle"},YE(A,D,V),{onMouseEnter:S(D,V),onMouseLeave:j(D,V),onClick:T(D,V)}),f?I.createElement(ZDe,{shape:c,activeBar:f,baseProps:o,entry:D,index:V,dataKey:h}):I.createElement(JDe,{shape:c,baseProps:o,entry:D,index:V,dataKey:h})))):null}function t8e(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:i,isAnimationActive:a,animationBegin:o,animationDuration:c,animationEasing:h,onAnimationEnd:f,onAnimationStart:m}=t,y=r.current,w=yb(t,"recharts-bar-"),[A,S]=I.useState(!1),j=!A,T=I.useCallback(()=>{typeof f=="function"&&f(),S(!1)},[f]),D=I.useCallback(()=>{typeof m=="function"&&m(),S(!0)},[m]);return I.createElement(QDe,{showLabels:j,rects:n},I.createElement(xb,{animationId:w,begin:o,duration:c,isActive:a,easing:h,onAnimationEnd:T,onAnimationStart:D,key:w},V=>{var U=V===1?n:n==null?void 0:n.map((G,X)=>{var q=y&&y[X];if(q)return Bo(Bo({},G),{},{x:Qi(q.x,G.x,V),y:Qi(q.y,G.y,V),width:Qi(q.width,G.width,V),height:Qi(q.height,G.height,V)});if(i==="horizontal"){var B=Qi(0,G.height,V),z=Qi(G.stackedBarStart,G.y,V);return Bo(Bo({},G),{},{y:z,height:B})}var F=Qi(0,G.width,V),$=Qi(G.stackedBarStart,G.x,V);return Bo(Bo({},G),{},{width:F,x:$})});return V>0&&(r.current=U??null),U==null?null:I.createElement(co,null,I.createElement(e8e,{props:t,data:U}))}),I.createElement(iP,{label:t.label}),t.children)}function r8e(e){var t=I.useRef(null);return I.createElement(t8e,{previousRectanglesRef:t,props:e})}var mee=0,n8e=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:Rs(e,t)}};class i8e extends I.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:i,xAxisId:a,yAxisId:o,needClip:c,background:h,id:f}=this.props;if(t||r==null)return null;var m=Mi("recharts-bar",i),y=f;return I.createElement(co,{className:m,id:f},c&&I.createElement("defs",null,I.createElement(hP,{clipPathId:y,xAxisId:a,yAxisId:o})),I.createElement(co,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(y,")"):void 0},I.createElement(XDe,{data:r,dataKey:n,background:h,allOtherBarProps:this.props}),I.createElement(r8e,this.props)))}}var s8e={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:mee,xAxisId:0,yAxisId:0,zIndex:ka.bar};function a8e(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:a,activeBar:o,animationBegin:c,animationDuration:h,animationEasing:f,isAnimationActive:m}=e,{needClip:y}=OA(t,r),w=Mf(),A=$a(),S=ZPe(e.children,yJ),j=Xr(V=>ODe(V,e.id,A,S));if(w!=="vertical"&&w!=="horizontal")return null;var T,D=j==null?void 0:j[0];return D==null||D.height==null||D.width==null?T=0:T=w==="vertical"?D.height/2:D.width/2,I.createElement(XJ,{xAxisId:t,yAxisId:r,data:j,dataPointFormatter:n8e,errorBarOffset:T},I.createElement(i8e,Af({},e,{layout:w,needClip:y,data:j,xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:a,activeBar:o,animationBegin:c,animationDuration:h,animationEasing:f,isAnimationActive:m})))}function o8e(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n,hasCustomShape:i},pos:a,bandSize:o,xAxis:c,yAxis:h,xAxisTicks:f,yAxisTicks:m,stackedData:y,displayedData:w,offset:A,cells:S,parentViewBox:j,dataStartIndex:T}=e,D=t==="horizontal"?h:c,V=y?D.scale.domain():null,U=b5e({numericAxis:D}),G=D.scale.map(U);return w.map((X,q)=>{var B,z,F,$,J,Q;if(y){var K=y[q+T];if(K==null)return null;B=p5e(K,V)}else B=Rs(X,r),Array.isArray(B)||(B=[U,B]);var me=gDe(n,mee)(B[1],q);if(t==="horizontal"){var re,le=h.scale.map(B[0]),ve=h.scale.map(B[1]);if(le==null||ve==null)return null;z=aU({axis:c,ticks:f,bandSize:o,offset:a.offset,entry:X,index:q}),F=(re=ve??le)!==null&&re!==void 0?re:void 0,$=a.size;var je=le-ve;if(J=Kc(je)?0:je,Q={x:z,y:A.top,width:$,height:A.height},Math.abs(me)>0&&Math.abs(J)0&&Math.abs($)I.createElement(I.Fragment,null,I.createElement(oP,{legendPayload:KDe(t)}),I.createElement(YDe,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:i}),I.createElement(cP,{type:"bar",id:i,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:r,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:n,hasCustomShape:t.shape!=null}),I.createElement(Xl,{zIndex:t.zIndex},I.createElement(a8e,Af({},t,{id:i})))))}var gee=I.memo(l8e,Nm);gee.displayName="Bar";var c8e=["domain","range"],u8e=["domain","range"];function NV(e,t){if(e==null)return{};var r,n,i=d8e(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{if(o!=null)return kV(kV({},a),{},{type:o})},[a,o]);return I.useLayoutEffect(()=>{c!=null&&(r.current===null?t(BOe(c)):r.current!==c&&t(zOe({prev:r.current,next:c})),r.current=c)},[c,t]),I.useLayoutEffect(()=>()=>{r.current&&(t(VOe(r.current)),r.current=null)},[t]),null}var v8e=e=>{var{xAxisId:t,className:r}=e,n=Xr(Y4),i=$a(),a="xAxis",o=Xr(D=>BZ(D,a,t,i)),c=Xr(D=>MZ(D,t)),h=Xr(D=>gTe(D,t)),f=Xr(D=>iZ(D,t));if(c==null||h==null||f==null)return null;var{dangerouslySetInnerHTML:m,ticks:y,scale:w}=e,A=hI(e,f8e),{id:S,scale:j}=f,T=hI(f,p8e);return I.createElement(dP,dI({},A,T,{x:h.x,y:h.y,width:c.width,height:c.height,className:Mi("recharts-".concat(a," ").concat(a),r),viewBox:n,ticks:o,axisType:a,axisId:t}))},w8e={allowDataOverflow:ba.allowDataOverflow,allowDecimals:ba.allowDecimals,allowDuplicatedCategory:ba.allowDuplicatedCategory,angle:ba.angle,axisLine:Dd.axisLine,height:ba.height,hide:!1,includeHidden:ba.includeHidden,interval:ba.interval,label:!1,minTickGap:ba.minTickGap,mirror:ba.mirror,orientation:ba.orientation,padding:ba.padding,reversed:ba.reversed,scale:ba.scale,tick:ba.tick,tickCount:ba.tickCount,tickLine:Dd.tickLine,tickSize:Dd.tickSize,type:ba.type,niceTicks:ba.niceTicks,xAxisId:0},N8e=e=>{var t=Va(e,w8e);return I.createElement(I.Fragment,null,I.createElement(b8e,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),I.createElement(v8e,t))},yee=I.memo(N8e,xee);yee.displayName="XAxis";var E8e=["type"],A8e=["dangerouslySetInnerHTML","ticks","scale"],k8e=["id","scale"];function fI(){return fI=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(o!=null)return SV(SV({},a),{},{type:o})},[o,a]);return I.useLayoutEffect(()=>{c!=null&&(r.current===null?t(FOe(c)):r.current!==c&&t($Oe({prev:r.current,next:c})),r.current=c)},[c,t]),I.useLayoutEffect(()=>()=>{r.current&&(t(HOe(r.current)),r.current=null)},[t]),null}function T8e(e){var{yAxisId:t,className:r,width:n,label:i}=e,a=I.useRef(null),o=I.useRef(null),c=Xr(Y4),h=$a(),f=ys(),m="yAxis",y=Xr(q=>LZ(q,t)),w=Xr(q=>yTe(q,t)),A=Xr(q=>BZ(q,m,t,h)),S=Xr(q=>sZ(q,t));if(I.useLayoutEffect(()=>{if(!(n!=="auto"||!y||rP(i)||I.isValidElement(i)||S==null)){var q=a.current;if(q){var B=q.getCalculatedWidth();Math.round(y.width)!==Math.round(B)&&f(GOe({id:t,width:B}))}}},[A,y,f,i,t,n,S]),y==null||w==null||S==null)return null;var{dangerouslySetInnerHTML:j,ticks:T,scale:D}=e,V=pI(e,A8e),{id:U,scale:G}=S,X=pI(S,k8e);return I.createElement(dP,fI({},V,X,{ref:a,labelRef:o,x:w.x,y:w.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:y.width,height:y.height,className:Mi("recharts-".concat(m," ").concat(m),r),viewBox:c,ticks:A,axisType:m,axisId:t}))}var P8e={allowDataOverflow:va.allowDataOverflow,allowDecimals:va.allowDecimals,allowDuplicatedCategory:va.allowDuplicatedCategory,angle:va.angle,axisLine:Dd.axisLine,hide:!1,includeHidden:va.includeHidden,interval:va.interval,label:!1,minTickGap:va.minTickGap,mirror:va.mirror,orientation:va.orientation,padding:va.padding,reversed:va.reversed,scale:va.scale,tick:va.tick,tickCount:va.tickCount,tickLine:Dd.tickLine,tickSize:Dd.tickSize,type:va.type,niceTicks:va.niceTicks,width:va.width,yAxisId:0},O8e=e=>{var t=Va(e,P8e);return I.createElement(I.Fragment,null,I.createElement(I8e,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),I.createElement(T8e,t))},bee=I.memo(O8e,xee);bee.displayName="YAxis";var R8e=(e,t)=>t,mP=et([R8e,Si,vQ,Ga,nJ,nh,z4e,Fa],W4e);function D8e(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function gP(e){var t=e.currentTarget.getBoundingClientRect(),r,n;if(D8e(e)){var i=e.currentTarget.getBBox();r=i.width>0?t.width/i.width:1,n=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;r=a.offsetWidth>0?t.width/a.offsetWidth:1,n=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(c,h)=>({relativeX:Math.round((c-t.left)/r),relativeY:Math.round((h-t.top)/n)});return"touches"in e?Array.from(e.touches).map(c=>o(c.clientX,c.clientY)):o(e.clientX,e.clientY)}var vee=Kl("mouseClick"),wee=hb();wee.startListening({actionCreator:vee,effect:(e,t)=>{var r=e.payload,n=mP(t.getState(),gP(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(RTe({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var mI=Kl("mouseMove"),Nee=hb(),_0=null,tp=null,TS=null;Nee.startListening({actionCreator:mI,effect:(e,t)=>{var r=e.payload,n=t.getState(),{throttleDelay:i,throttledEvents:a}=n.eventSettings,o=a==="all"||(a==null?void 0:a.includes("mousemove"));_0!==null&&(cancelAnimationFrame(_0),_0=null),tp!==null&&(typeof i!="number"||!o)&&(clearTimeout(tp),tp=null),TS=gP(r);var c=()=>{var h=t.getState(),f=Cb(h,h.tooltip.settings.shared);if(!TS){_0=null,tp=null;return}if(f==="axis"){var m=mP(h,TS);(m==null?void 0:m.activeIndex)!=null?t.dispatch(WZ({activeIndex:m.activeIndex,activeDataKey:void 0,activeCoordinate:m.activeCoordinate})):t.dispatch(qZ())}_0=null,tp=null};if(!o){c();return}i==="raf"?_0=requestAnimationFrame(c):typeof i=="number"&&tp===null&&(tp=setTimeout(c,i))}});function M8e(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var CV={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},Eee=To({name:"rootProps",initialState:CV,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:CV.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),L8e=Eee.reducer,{updateOptions:U8e}=Eee.actions,B8e=null,z8e={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},Aee=To({name:"polarOptions",initialState:B8e,reducers:z8e}),{updatePolarOptions:sLe}=Aee.actions,V8e=Aee.reducer,kee=Kl("keyDown"),_ee=Kl("focus"),See=Kl("blur"),RA=hb(),S0=null,rp=null,pw=null;RA.startListening({actionCreator:kee,effect:(e,t)=>{pw=e.payload,S0!==null&&(cancelAnimationFrame(S0),S0=null);var r=t.getState(),{throttleDelay:n,throttledEvents:i}=r.eventSettings,a=i==="all"||i.includes("keydown");rp!==null&&(typeof n!="number"||!a)&&(clearTimeout(rp),rp=null);var o=()=>{try{var c=t.getState(),h=c.rootProps.accessibilityLayer!==!1;if(!h)return;var{keyboardInteraction:f}=c.tooltip,m=pw;if(m!=="ArrowRight"&&m!=="ArrowLeft"&&m!=="Enter")return;var y=ty(f,fm(c),Rg(c),Dg(c)),w=y==null?-1:Number(y),A=!Number.isFinite(w)||w<0,S=nh(c),j=fm(c),T=Cb(c,c.tooltip.settings.shared);if(m==="Enter"){if(A)return;var D=zN(c,T,"hover",String(f.index));t.dispatch(BN({active:!f.active,activeIndex:f.index,activeCoordinate:D}));return}var V=ETe(c),U=V==="left-to-right"?1:-1,G=m==="ArrowRight"?1:-1,X;if(A){var q=Rg(c),B=Dg(c),z=G*U,F=me=>({active:!1,index:String(me),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(X=-1,z>0){for(var $=0;$=0;J--)if(ty(F(J),j,q,B)!=null){X=J;break}if(X<0)return}else{X=w+G*U;var Q=(S==null?void 0:S.length)||j.length;if(Q===0||X>=Q||X<0)return}var K=zN(c,T,"hover",String(X));t.dispatch(BN({active:!0,activeIndex:X.toString(),activeCoordinate:K}))}finally{S0=null,rp=null}};if(!a){o();return}n==="raf"?S0=requestAnimationFrame(o):typeof n=="number"&&rp===null&&(o(),pw=null,rp=setTimeout(()=>{pw?o():(rp=null,S0=null)},n))}});RA.startListening({actionCreator:_ee,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;if(!i.active&&i.index==null){var a="0",o=Cb(r,r.tooltip.settings.shared),c=zN(r,o,"hover",String(a));t.dispatch(BN({active:!0,activeIndex:a,activeCoordinate:c}))}}}});RA.startListening({actionCreator:See,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;i.active&&t.dispatch(BN({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function Cee(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(r,n)=>{if(n==="currentTarget")return t;var i=Reflect.get(r,n);return typeof i=="function"?i.bind(r):i}})}var dc=Kl("externalEvent"),jee=hb(),mw=new Map,x1=new Map,PS=new Map;jee.startListening({actionCreator:dc,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){var i=n.type,a=Cee(n);PS.set(i,{handler:r,reactEvent:a});var o=mw.get(i);o!==void 0&&(cancelAnimationFrame(o),mw.delete(i));var c=t.getState(),{throttleDelay:h,throttledEvents:f}=c.eventSettings,m=f,y=m==="all"||(m==null?void 0:m.includes(i)),w=x1.get(i);w!==void 0&&(typeof h!="number"||!y)&&(clearTimeout(w),x1.delete(i));var A=()=>{var T=PS.get(i);try{if(!T)return;var{handler:D,reactEvent:V}=T,U=t.getState(),G={activeCoordinate:k4e(U),activeDataKey:oJ(U),activeIndex:pm(U),activeLabel:aJ(U),activeTooltipIndex:pm(U),isTooltipActive:_4e(U)};D&&D(G,V)}finally{mw.delete(i),x1.delete(i),PS.delete(i)}};if(!y){A();return}if(h==="raf"){var S=requestAnimationFrame(A);mw.set(i,S)}else if(typeof h=="number"){if(!x1.has(i)){A();var j=setTimeout(A,h);x1.set(i,j)}}else A()}}});var F8e=et([nx],e=>e.tooltipItemPayloads),$8e=et([F8e,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(a=>a.settings.graphicalItemId===r);if(n!=null){var{getPosition:i}=n;if(i!=null)return i(t)}}}),Iee=Kl("touchMove"),Tee=hb(),np=null,$h=null,jV=null,y1=null;Tee.startListening({actionCreator:Iee,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){y1=Cee(r);var n=t.getState(),{throttleDelay:i,throttledEvents:a}=n.eventSettings,o=a==="all"||a.includes("touchmove");np!==null&&(cancelAnimationFrame(np),np=null),$h!==null&&(typeof i!="number"||!o)&&(clearTimeout($h),$h=null),jV=Array.from(r.touches).map(h=>gP({clientX:h.clientX,clientY:h.clientY,currentTarget:r.currentTarget}));var c=()=>{if(y1!=null){var h=t.getState(),f=Cb(h,h.tooltip.settings.shared);if(f==="axis"){var m,y=(m=jV)===null||m===void 0?void 0:m[0];if(y==null){np=null,$h=null;return}var w=mP(h,y);(w==null?void 0:w.activeIndex)!=null&&t.dispatch(WZ({activeIndex:w.activeIndex,activeDataKey:void 0,activeCoordinate:w.activeCoordinate}))}else if(f==="item"){var A,S=y1.touches[0];if(document.elementFromPoint==null||S==null)return;var j=document.elementFromPoint(S.clientX,S.clientY);if(!j||!j.getAttribute)return;var T=j.getAttribute(_5e),D=(A=j.getAttribute(S5e))!==null&&A!==void 0?A:void 0,V=km(h).find(X=>X.id===D);if(T==null||V==null||D==null)return;var{dataKey:U}=V,G=$8e(h,T,D);t.dispatch(GZ({activeDataKey:U,activeIndex:T,activeCoordinate:G,activeGraphicalItemId:D}))}np=null,$h=null}};if(!o){c();return}i==="raf"?np=requestAnimationFrame(c):typeof i=="number"&&$h===null&&(c(),y1=null,$h=setTimeout(()=>{y1?c():($h=null,np=null)},i))}}});var Pee={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},Oee=To({name:"eventSettings",initialState:Pee,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:H8e}=Oee.actions,G8e=Oee.reducer,q8e=QY({brush:u6e,cartesianAxis:qOe,chartData:A3e,errorBars:cRe,eventSettings:G8e,graphicalItems:kOe,layout:c5e,legend:wke,options:b3e,polarAxis:WPe,polarOptions:V8e,referenceElements:p6e,renderedTicks:T6e,rootProps:L8e,tooltip:DTe,zIndex:a3e}),W8e=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return RAe({reducer:q8e,preloadedState:t,middleware:n=>{var i;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([wee.middleware,Nee.middleware,RA.middleware,jee.middleware,Tee.middleware])},enhancers:n=>{var i=n;return typeof n=="function"&&(i=n()),i.concat(hX({type:"raf"}))},devTools:{serialize:{replacer:M8e},name:"recharts-".concat(r)}})};function K8e(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=$a(),a=I.useRef(null);if(i)return r;a.current==null&&(a.current=W8e(t,n));var o=F4;return I.createElement(Lke,{context:o,store:a.current},r)}function Y8e(e){var{layout:t,margin:r}=e,n=ys(),i=$a();return I.useEffect(()=>{i||(n(a5e(t)),n(s5e(r)))},[n,i,t,r]),null}var X8e=I.memo(Y8e,Nm);function Q8e(e){var t=ys();return I.useEffect(()=>{t(U8e(e))},[t,e]),null}var Z8e=e=>{var t=ys();return I.useEffect(()=>{t(H8e(e))},[t,e]),null},J8e=I.memo(Z8e,Nm);function IV(e){var{zIndex:t,isPanorama:r}=e,n=I.useRef(null),i=ys();return I.useLayoutEffect(()=>(n.current&&i(i3e({zIndex:t,element:n.current,isPanorama:r})),()=>{i(s3e({zIndex:t,isPanorama:r}))}),[i,t,r]),I.createElement("g",{tabIndex:-1,ref:n,className:"recharts-zIndex-layer_".concat(t)})}function TV(e){var{children:t,isPanorama:r}=e,n=Xr(Y4e);if(!n||n.length===0)return t;var i=n.filter(o=>o<0),a=n.filter(o=>o>0);return I.createElement(I.Fragment,null,i.map(o=>I.createElement(IV,{key:o,zIndex:o,isPanorama:r})),t,a.map(o=>I.createElement(IV,{key:o,zIndex:o,isPanorama:r})))}var eMe=["children"];function tMe(e,t){if(e==null)return{};var r,n,i=rMe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var r=Z4(),n=J4(),i=HX();if(!qu(r)||!qu(n))return null;var{children:a,otherAttributes:o,title:c,desc:h}=e,f,m;return o!=null&&(typeof o.tabIndex=="number"?f=o.tabIndex:f=i?0:void 0,typeof o.role=="string"?m=o.role:m=i?"application":void 0),I.createElement(P4,KN({},o,{title:c,desc:h,role:m,tabIndex:f,width:r,height:n,style:nMe,ref:t}),a)}),sMe=e=>{var{children:t}=e,r=Xr(cA);if(!r)return null;var{width:n,height:i,y:a,x:o}=r;return I.createElement(P4,{width:n,height:i,x:o,y:a},t)},PV=I.forwardRef((e,t)=>{var{children:r}=e,n=tMe(e,eMe),i=$a();return i?I.createElement(sMe,null,I.createElement(TV,{isPanorama:!0},r)):I.createElement(iMe,KN({ref:t},n),I.createElement(TV,{isPanorama:!1},r))});function aMe(){var e=ys(),[t,r]=I.useState(null),n=Xr(k5e);return I.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),a=i.width/t.offsetWidth;Wn(a)&&a!==n&&e(l5e(a))}},[t,e,n]),r}function OV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function oMe(e){for(var t=1;t(O3e(),null);function YN(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var hMe=I.forwardRef((e,t)=>{var r,n,i=I.useRef(null),[a,o]=I.useState({containerWidth:YN((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:YN((n=e.style)===null||n===void 0?void 0:n.height)}),c=I.useCallback((f,m)=>{o(y=>{var w=Math.round(f),A=Math.round(m);return y.containerWidth===w&&y.containerHeight===A?y:{containerWidth:w,containerHeight:A}})},[]),h=I.useCallback(f=>{if(typeof t=="function"&&t(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var{width:m,height:y}=f.getBoundingClientRect();c(m,y);var w=S=>{var j=S[0];if(j!=null){var{width:T,height:D}=j.contentRect;c(T,D)}},A=new ResizeObserver(w);A.observe(f),i.current=A}},[t,c]);return I.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),I.createElement(I.Fragment,null,I.createElement(pb,{width:a.containerWidth,height:a.containerHeight}),I.createElement("div",mf({ref:h},e)))}),fMe=I.forwardRef((e,t)=>{var{width:r,height:n}=e,[i,a]=I.useState({containerWidth:YN(r),containerHeight:YN(n)}),o=I.useCallback((h,f)=>{a(m=>{var y=Math.round(h),w=Math.round(f);return m.containerWidth===y&&m.containerHeight===w?m:{containerWidth:y,containerHeight:w}})},[]),c=I.useCallback(h=>{if(typeof t=="function"&&t(h),h!=null){var{width:f,height:m}=h.getBoundingClientRect();o(f,m)}},[t,o]);return I.createElement(I.Fragment,null,I.createElement(pb,{width:i.containerWidth,height:i.containerHeight}),I.createElement("div",mf({ref:c},e)))}),pMe=I.forwardRef((e,t)=>{var{width:r,height:n}=e;return I.createElement(I.Fragment,null,I.createElement(pb,{width:r,height:n}),I.createElement("div",mf({ref:t},e)))}),mMe=I.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?I.createElement(fMe,mf({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?I.createElement(pMe,mf({},e,{width:r,height:n,ref:t})):I.createElement(I.Fragment,null,I.createElement(pb,{width:r,height:n}),I.createElement("div",mf({ref:t},e)))});function gMe(e){return e?hMe:mMe}var xMe=I.forwardRef((e,t)=>{var{children:r,className:n,height:i,onClick:a,onContextMenu:o,onDoubleClick:c,onMouseDown:h,onMouseEnter:f,onMouseLeave:m,onMouseMove:y,onMouseUp:w,onTouchEnd:A,onTouchMove:S,onTouchStart:j,style:T,width:D,responsive:V,dispatchTouchEvents:U=!0}=e,G=I.useRef(null),X=ys(),[q,B]=I.useState(null),[z,F]=I.useState(null),$=aMe(),J=X4(),Q=(J==null?void 0:J.width)>0?J.width:D,K=(J==null?void 0:J.height)>0?J.height:i,me=I.useCallback(Ie=>{$(Ie),typeof t=="function"&&t(Ie),B(Ie),F(Ie),Ie!=null&&(G.current=Ie)},[$,t,B,F]),re=I.useCallback(Ie=>{X(vee(Ie)),X(dc({handler:a,reactEvent:Ie}))},[X,a]),le=I.useCallback(Ie=>{X(mI(Ie)),X(dc({handler:f,reactEvent:Ie}))},[X,f]),ve=I.useCallback(Ie=>{X(qZ()),X(dc({handler:m,reactEvent:Ie}))},[X,m]),je=I.useCallback(Ie=>{X(mI(Ie)),X(dc({handler:y,reactEvent:Ie}))},[X,y]),Ve=I.useCallback(()=>{X(_ee())},[X]),Z=I.useCallback(()=>{X(See())},[X]),se=I.useCallback(Ie=>{X(kee(Ie.key))},[X]),xe=I.useCallback(Ie=>{X(dc({handler:o,reactEvent:Ie}))},[X,o]),ae=I.useCallback(Ie=>{X(dc({handler:c,reactEvent:Ie}))},[X,c]),qe=I.useCallback(Ie=>{X(dc({handler:h,reactEvent:Ie}))},[X,h]),pt=I.useCallback(Ie=>{X(dc({handler:w,reactEvent:Ie}))},[X,w]),Fe=I.useCallback(Ie=>{X(dc({handler:j,reactEvent:Ie}))},[X,j]),jt=I.useCallback(Ie=>{U&&X(Iee(Ie)),X(dc({handler:S,reactEvent:Ie}))},[X,U,S]),Pt=I.useCallback(Ie=>{X(dc({handler:A,reactEvent:Ie}))},[X,A]),Ae=gMe(V);return I.createElement(mJ.Provider,{value:q},I.createElement(hY.Provider,{value:z},I.createElement(Ae,{width:Q??(T==null?void 0:T.width),height:K??(T==null?void 0:T.height),className:Mi("recharts-wrapper",n),style:oMe({position:"relative",cursor:"default",width:Q,height:K},T),onClick:re,onContextMenu:xe,onDoubleClick:ae,onFocus:Ve,onBlur:Z,onKeyDown:se,onMouseDown:qe,onMouseEnter:le,onMouseLeave:ve,onMouseMove:je,onMouseUp:pt,onTouchEnd:Pt,onTouchMove:jt,onTouchStart:Fe,ref:me},I.createElement(dMe,null),r)))}),yMe=["width","height","responsive","children","className","style","compact","title","desc"];function bMe(e,t){if(e==null)return{};var r,n,i=vMe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var{width:r,height:n,responsive:i,children:a,className:o,style:c,compact:h,title:f,desc:m}=e,y=bMe(e,yMe),w=Wl(y);return h?I.createElement(I.Fragment,null,I.createElement(pb,{width:r,height:n}),I.createElement(PV,{otherAttributes:w,title:f,desc:m},a)):I.createElement(xMe,{className:o,style:c,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},I.createElement(PV,{otherAttributes:w,title:f,desc:m,ref:t},I.createElement(g6e,null,a)))});function gI(){return gI=Object.assign?Object.assign.bind():function(e){for(var t=1;tI.createElement(CMe,{chartName:"ComposedChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:jMe,tooltipPayloadSearcher:x3e,categoricalChartProps:e,ref:t}));const Ree=({className:e})=>s.jsx("div",{className:`flex flex-col items-center gap-1 ${e}`,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 border border-gray-950 overflow-hidden bg-white rounded-full",children:s.jsx("img",{src:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",alt:"Logo",className:"w-full h-full object-cover",referrerPolicy:"no-referrer"})}),s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("span",{className:"text-lg md:text-xl font-serif font-black tracking-tighter text-gray-950 uppercase leading-none italic",children:"CAMPUS EYE"}),s.jsx("span",{className:"text-[6px] font-black tracking-[0.5em] text-gray-400 uppercase leading-none mt-0.5",children:"MEDIA"})]})]})}),Dee=({stats:e,compact:t=!1})=>{const[r,n]=I.useState(null),i=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],a=(e.engagementScore||10)+e.articlesCount*5+e.postsCount*2,o=e.weeklyActivity||i.map((w,A)=>{const S=Math.floor(Math.abs(Math.sin(a+A*1.5)*40)+(A%2===0?12:5));return Math.max(2,S)}),c=Math.max(...o,1),h=Math.max(1,e.articlesCount*10+e.postsCount*3+e.purchasesCount*5),f=Math.min(100,Math.round(e.articlesCount*10/h*100)),m=Math.min(100,Math.round(e.postsCount*3/h*100)),y=Math.min(100,Math.max(0,100-f-m));return s.jsxs("div",{className:"bg-gradient-to-br from-gray-900 via-gray-950 to-black text-white p-5 sm:p-6 rounded-3xl border border-gray-800/80 shadow-2xl space-y-6 select-none font-sans",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 pb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2.5 bg-gradient-to-tr from-accent to-purple-600 rounded-2xl shadow-lg shadow-accent/20 text-white",children:s.jsx(yp,{size:20})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-black uppercase tracking-widest text-gray-200 flex items-center gap-2",children:"Citizen Statistics & Engagement Graph"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-semibold tracking-wider uppercase mt-0.5",children:"Live Activity Analytics Engine"})]})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs("span",{className:"px-3 py-1 bg-white/10 border border-white/15 text-amber-300 rounded-xl text-[9.5px] font-black uppercase tracking-widest flex items-center gap-1 shadow-sm",children:[s.jsx(Xi,{size:11,className:"text-amber-400"}),e.tier||"Active Citizen"]})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-[9.5px] font-black uppercase tracking-widest text-gray-400 flex items-center gap-1.5",children:[s.jsx($p,{size:12,className:"text-accent"})," Weekly Contribution Volume (Mon - Sun)"]}),s.jsxs("span",{className:"text-[9px] font-mono font-bold text-gray-400",children:["Total Points: ",s.jsx("strong",{className:"text-white",children:e.engagementScore})]})]}),s.jsx("div",{className:"bg-white/5 border border-white/10 p-4 rounded-2xl relative",children:s.jsx("div",{className:"h-32 flex items-end justify-between gap-2 pt-6 pb-1 px-1",children:o.map((w,A)=>{const S=Math.max(12,Math.round(w/c*100)),j=r===A;return s.jsxs("div",{onMouseEnter:()=>n(A),onMouseLeave:()=>n(null),className:"flex-1 flex flex-col items-center h-full justify-end group cursor-pointer relative",children:[j&&s.jsxs("div",{className:"absolute -top-8 bg-accent text-white px-2 py-0.5 rounded-lg text-[9px] font-black font-mono shadow-xl z-20 whitespace-nowrap animate-fadeIn",children:[w," pts (",i[A],")"]}),s.jsx("div",{className:"w-full bg-white/10 rounded-t-lg h-full flex items-end overflow-hidden p-0.5",children:s.jsx("div",{style:{height:`${S}%`},className:`w-full rounded-t-md transition-all duration-500 ${j?"bg-gradient-to-t from-red-600 via-accent to-amber-400 shadow-lg shadow-accent/50":"bg-gradient-to-t from-accent/80 to-purple-500/80 group-hover:from-accent group-hover:to-purple-400"}`})}),s.jsx("span",{className:`text-[9px] font-extrabold uppercase mt-2 font-mono transition-colors ${j?"text-accent font-black":"text-gray-400"}`,children:i[A]})]},A)})})})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[s.jsxs("div",{className:"p-3 bg-white/5 border border-white/10 rounded-2xl flex flex-col justify-between",children:[s.jsxs("div",{className:"flex items-center justify-between text-gray-400",children:[s.jsx("span",{className:"text-[8.5px] font-black uppercase tracking-widest",children:"Articles"}),s.jsx(M0,{size:13,className:"text-blue-400"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-base font-black font-mono text-white",children:e.articlesCount}),s.jsx("span",{className:"text-[8px] text-gray-400 block font-semibold",children:"Dispatches"})]})]}),s.jsxs("div",{className:"p-3 bg-white/5 border border-white/10 rounded-2xl flex flex-col justify-between",children:[s.jsxs("div",{className:"flex items-center justify-between text-gray-400",children:[s.jsx("span",{className:"text-[8.5px] font-black uppercase tracking-widest",children:"Lounge Posts"}),s.jsx(Ri,{size:13,className:"text-purple-400"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-base font-black font-mono text-white",children:e.postsCount}),s.jsx("span",{className:"text-[8px] text-gray-400 block font-semibold",children:"Feed Shares"})]})]}),s.jsxs("div",{className:"p-3 bg-white/5 border border-white/10 rounded-2xl flex flex-col justify-between",children:[s.jsxs("div",{className:"flex items-center justify-between text-gray-400",children:[s.jsx("span",{className:"text-[8.5px] font-black uppercase tracking-widest",children:"Passes"}),s.jsx(Ea,{size:13,className:"text-emerald-400"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-base font-black font-mono text-white",children:e.purchasesCount}),s.jsx("span",{className:"text-[8px] text-gray-400 block font-semibold",children:"Event Tickets"})]})]}),s.jsxs("div",{className:"p-3 bg-white/5 border border-white/10 rounded-2xl flex flex-col justify-between",children:[s.jsxs("div",{className:"flex items-center justify-between text-gray-400",children:[s.jsx("span",{className:"text-[8.5px] font-black uppercase tracking-widest",children:"Score"}),s.jsx(Eu,{size:13,className:"text-amber-400"})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("span",{className:"text-base font-black font-mono text-amber-300",children:e.engagementScore}),s.jsx("span",{className:"text-[8px] text-gray-400 block font-semibold",children:"Influence Pts"})]})]})]}),!t&&s.jsxs("div",{className:"space-y-2 pt-1 border-t border-white/10",children:[s.jsxs("div",{className:"flex justify-between items-center text-[9px] font-black uppercase tracking-widest text-gray-400",children:[s.jsx("span",{children:"Contribution Mix Breakdown"}),s.jsxs("span",{className:"text-gray-300 font-mono",children:["UGX ",(e.totalSpent||0).toLocaleString()," Spent"]})]}),s.jsxs("div",{className:"w-full bg-white/10 h-3 rounded-full overflow-hidden flex p-0.5 gap-0.5",children:[s.jsx("div",{style:{width:`${f}%`},className:"bg-blue-500 h-full rounded-l-sm",title:`Articles: ${f}%`}),s.jsx("div",{style:{width:`${m}%`},className:"bg-purple-500 h-full",title:`Lounge Posts: ${m}%`}),s.jsx("div",{style:{width:`${y}%`},className:"bg-emerald-500 h-full rounded-r-sm",title:`Tickets: ${y}%`})]}),s.jsxs("div",{className:"flex items-center justify-between text-[8px] font-extrabold uppercase text-gray-400 pt-1",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 inline-block"})," Articles (",f,"%)"]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-purple-500 inline-block"})," Lounge (",m,"%)"]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500 inline-block"})," Tickets (",y,"%)"]})]})]})]})};function DA(e){if(!e||typeof e!="string")return null;const t=e.trim(),r=/(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?|shorts)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,n=t.match(r);return n?n[1]:null}function xp(e){return!!DA(e)}function gw(e,t="hq"){const r=DA(e)||e;return!r||r.length!==11?"https://images.unsplash.com/photo-1590602847861-f357a9332bbc?auto=format&fit=crop&q=80&w=600":`https://img.youtube.com/vi/${r}/${t==="maxres"?"maxresdefault":"hqdefault"}.jpg`}function TMe(e,t=!0){const r=DA(e)||e;return r?`https://www.youtube-nocookie.com/embed/${r}?autoplay=${t?1:0}&rel=0&modestbranding=1&enablejsapi=1`:""}function Ul(e){if(!e)return!1;if(e.mediaType==="video")return!0;if(e.mediaType==="audio")return!1;const t=(e.videoUrl||e.mediaUrl||e.audioUrl||"").toLowerCase();return xp(t)?!0:[".mp4",".webm",".ogg",".mov",".m3u8",".mkv","vimeo.com","dailymotion.com","drive.google.com/file"].some(n=>t.includes(n))}function PMe(e){return e&&(e.videoUrl||e.mediaUrl||e.audioUrl)||""}const xP=({podcast:e,onClose:t,relatedPodcasts:r=[],onSelectPodcast:n})=>{var T;const[i,a]=I.useState(e||null),[o,c]=I.useState(!1),[h,f]=I.useState(!1);I.useEffect(()=>{e&&a(e)},[e]),I.useEffect(()=>{const D=V=>{const U=V;U.detail&&a(U.detail)};return window.addEventListener("play-video-podcast",D),()=>{window.removeEventListener("play-video-podcast",D)}},[]),I.useEffect(()=>{const D=V=>{V.key==="Escape"&&i&&m()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[i]);const m=()=>{a(null),t&&t()};if(!i)return null;const y=PMe(i),w=xp(y);DA(y);const A=w?TMe(y,!0):null,S=async()=>{const D=typeof window<"u"?`${window.location.origin}/?podcast=${i.id}`:"";if(`${i.title}${D}`,navigator.share)try{await navigator.share({title:i.title,text:`Watch this Campus Eye Video Episode: ${i.title}`,url:D||y}),he.success("Shared video episode!",{icon:"🎬"});return}catch{}Od(D||y),c(!0),he.success("Video episode link copied to clipboard!",{icon:"📋"}),setTimeout(()=>c(!1),2e3)},j=D=>{Ul(D)?(a(D),n&&n(D)):(window.dispatchEvent(new CustomEvent("play-podcast",{detail:D})),he.success(`Playing audio episode: ${D.title}`,{icon:"🎧"}))};return s.jsx(on,{children:s.jsxs("div",{className:"fixed inset-0 z-[6000] flex items-center justify-center p-2 sm:p-4 md:p-6 overflow-y-auto bg-black/85 backdrop-blur-md",children:[s.jsx("div",{className:"fixed inset-0",onClick:m}),s.jsxs(Qt.div,{initial:{opacity:0,scale:.94,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.94,y:20},transition:{type:"spring",damping:25,stiffness:300},className:`relative z-10 w-full ${h?"max-w-6xl":"max-w-4xl"} bg-gray-950 text-white rounded-3xl border border-white/15 shadow-[0_25px_70px_rgba(0,0,0,0.9)] overflow-hidden transition-all duration-300 my-auto`,children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-white/10 bg-gray-900/60 backdrop-blur-xl",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsxs("span",{className:"flex items-center gap-1.5 px-3 py-1 bg-red-600/90 text-white rounded-xl text-[10px] font-black uppercase tracking-widest shadow-sm",children:[s.jsx(Na,{size:12,className:"animate-pulse"})," Video Podcast"]}),s.jsx("span",{className:"text-[10px] font-mono font-bold text-gray-400 bg-white/5 px-2.5 py-1 rounded-xl border border-white/5",children:i.category||"Campus Broadcast"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>f(!h),className:"p-2 rounded-xl text-gray-400 hover:text-white hover:bg-white/10 transition-colors cursor-pointer",title:h?"Exit Theatre Mode":"Theatre Mode",children:h?s.jsx(bI,{size:16}):s.jsx(n2,{size:16})}),s.jsx("button",{onClick:S,className:"p-2 rounded-xl text-gray-400 hover:text-white hover:bg-white/10 transition-colors flex items-center gap-1.5 text-xs font-bold cursor-pointer",title:"Share Episode",children:o?s.jsx(zu,{size:16,className:"text-emerald-400"}):s.jsx(Ld,{size:16})}),s.jsx("button",{onClick:m,className:"p-2 rounded-xl bg-white/5 hover:bg-red-600 hover:text-white text-gray-400 transition-all cursor-pointer ml-1",title:"Close Video (Esc)",children:s.jsx(Jr,{size:18})})]})]}),s.jsx("div",{className:"relative w-full aspect-video bg-black flex items-center justify-center overflow-hidden",children:w&&A?s.jsx("iframe",{src:A,title:i.title,className:"w-full h-full border-0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0}):y?s.jsx("video",{src:y,controls:!0,autoPlay:!0,playsInline:!0,poster:i.thumbnail,className:"w-full h-full object-contain",children:"Your browser does not support the video tag."}):s.jsxs("div",{className:"text-center p-8 text-gray-400",children:[s.jsx(Na,{size:40,className:"mx-auto mb-2 text-red-500 opacity-60"}),s.jsx("p",{className:"text-xs font-bold uppercase tracking-wider",children:"Video stream not available"})]})}),s.jsxs("div",{className:"p-5 md:p-6 bg-gradient-to-b from-gray-950 to-gray-900 text-left space-y-4",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-[10px] font-black uppercase text-red-500 tracking-wider flex items-center gap-1",children:[s.jsx(rE,{size:12})," Host: ",i.author||"Campus Eye Desk"]}),s.jsx("span",{className:"text-gray-600",children:"•"}),s.jsxs("span",{className:"text-[10px] font-mono text-gray-400",children:["⏱️ ",i.duration||"Full Episode"]}),i.publishDate&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-gray-600",children:"•"}),s.jsx("span",{className:"text-[10px] font-mono text-gray-400",children:(T=i.publishDate)!=null&&T.seconds?new Date(i.publishDate.seconds*1e3).toLocaleDateString():"Published Episode"})]})]}),s.jsx("h2",{className:"text-lg md:text-2xl font-black text-white uppercase tracking-tight font-serif leading-tight",children:i.title})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[y&&s.jsxs("a",{href:y,target:"_blank",rel:"noreferrer",className:"px-4 py-2 bg-white/10 hover:bg-white/20 text-white rounded-xl text-[10px] font-black uppercase tracking-wider transition-all flex items-center gap-1.5 cursor-pointer border border-white/10",children:[s.jsx(za,{size:12})," ",w?"Open on YouTube":"Open Video Link"]}),s.jsxs("button",{onClick:S,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-xl text-[10px] font-black uppercase tracking-wider transition-all flex items-center gap-1.5 cursor-pointer shadow-lg shadow-red-900/20",children:[s.jsx(Ld,{size:12})," Share"]})]})]}),i.description&&s.jsxs("div",{className:"p-4 bg-white/5 rounded-2xl border border-white/5 text-xs text-gray-300 leading-relaxed",children:[s.jsx("p",{className:"font-bold text-[9px] uppercase tracking-wider text-gray-400 mb-1",children:"Episode Notes"}),s.jsx("p",{className:"whitespace-pre-wrap",children:i.description})]}),r.length>0&&s.jsxs("div",{className:"pt-2 border-t border-white/10",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("h4",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 flex items-center gap-1.5",children:[s.jsx(Xi,{size:12,className:"text-red-500"})," More Campus Episodes"]}),s.jsxs("span",{className:"text-[9px] font-mono text-gray-500 font-bold",children:[r.length," Available"]})]}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:r.slice(0,4).map(D=>{const V=Ul(D),U=D.id===i.id;return s.jsxs("div",{onClick:()=>j(D),className:`group relative bg-white/5 hover:bg-white/10 p-2.5 rounded-2xl border transition-all cursor-pointer flex flex-col justify-between ${U?"border-red-600 bg-red-950/20 ring-1 ring-red-600":"border-white/5 hover:border-white/20"}`,children:[s.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden mb-2 bg-black",children:[s.jsx("img",{src:D.thumbnail||"https://images.unsplash.com/photo-1590602847861-f357a9332bbc?auto=format&fit=crop&q=80&w=300",alt:D.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"}),s.jsxs("span",{className:`absolute top-1.5 left-1.5 text-[7px] font-black uppercase tracking-wider px-1.5 py-0.5 rounded flex items-center gap-0.5 shadow-sm text-white ${V?"bg-red-600":"bg-emerald-600"}`,children:[V?s.jsx(Na,{size:8}):s.jsx(nf,{size:8}),V?"VIDEO":"AUDIO"]})]}),s.jsx("h5",{className:"text-[10px] font-black uppercase text-white truncate group-hover:text-red-400 transition-colors",children:D.title}),s.jsx("p",{className:"text-[8px] text-gray-400 font-bold uppercase tracking-wider mt-0.5",children:D.author})]},D.id)})})]})]})]})]})})},OS=({initialTab:e})=>{var Nh,ld,Fb,hs,Qm,Zm,vx,wx,$b,Jm;const[t,r]=ie.useState(!1),[n,i]=ie.useState(!0),[a,o]=ie.useState(e||"dashboard");ie.useEffect(()=>{e&&o(e)},[e]),ie.useEffect(()=>{const O=()=>{const ue=localStorage.getItem("edit_ticket_item");if(ue)try{const Ce=JSON.parse(ue);ea(Ce),De(Ce.title||""),rr(Ce.description||""),ze((Ce.price||0).toString()),_r(Ce.venue||""),Be((Ce.totalQuantity||100).toString()),ur(Ce.category||"Entertainment"),Do(Ce.imageUrl||""),zt(Ce.link||"");const ut=(()=>{const Yt=Ce.eventDate;if(!Yt)return"";const cn=typeof Yt.toDate=="function"?Yt.toDate():Yt instanceof Date?Yt:Yt.seconds?new Date(Yt.seconds*1e3):new Date(Yt);try{return cn.toISOString().slice(0,16)}catch{return""}})();Er(ut),o("manage-tickets"),localStorage.removeItem("edit_ticket_item")}catch(Ce){console.warn("Failed to restore editing ticket:",Ce)}};return O(),window.addEventListener("checkPendingTicketEdit",O),()=>window.removeEventListener("checkPendingTicketEdit",O)},[]);const[c,h]=ie.useState([]),[f,m]=ie.useState(()=>H2e()),[y,w]=ie.useState(()=>G2e()),[A,S]=ie.useState(()=>q2e()),[j,T]=ie.useState(""),[D,V]=ie.useState(""),[U,G]=ie.useState(""),[X,q]=ie.useState([]),[B,z]=ie.useState([]),[F,$]=ie.useState([]),[J,Q]=ie.useState([]),[K,me]=ie.useState(""),[re,le]=ie.useState(""),[ve,je]=ie.useState(""),[Ve,Z]=ie.useState("link"),[se,xe]=ie.useState(""),[ae,qe]=ie.useState(!1),[pt,Fe]=ie.useState(null),[jt,Pt]=ie.useState(!1),[Ae,Ie]=ie.useState(null),[vt,Re]=ie.useState(!1),[It,Dt]=ie.useState([]),[cr,St]=ie.useState([]),[Ct,Gt]=ie.useState([]),[Xe,Xt]=ie.useState(""),[Ot,or]=ie.useState({}),[Wr,dr]=ie.useState({}),[yn,He]=ie.useState({}),[Rt,nr]=ie.useState(""),[fr,hn]=ie.useState(""),[en,Ci]=ie.useState(""),[Gr,be]=ie.useState(!1),[Pe,$e]=ie.useState(""),[ct,yr]=ie.useState(!1),[Lt,Lr]=ie.useState([]),[ir,pr]=ie.useState(!0),[br,ln]=ie.useState(""),[de,ke]=ie.useState(null),[Ze,Ft]=ie.useState(!1),[Fr,gr]=ie.useState(""),[Cr,xt]=ie.useState(!1),[Or,_t]=ie.useState(null),Oe=ie.useCallback(async()=>{try{const O=await fetch("/api/google-seo-stats");if(O.ok){const ue=await O.json();ke(ue)}}catch(O){console.warn("Failed to fetch SEO stats:",O)}},[]),ar=async()=>{Ft(!0),_t(null);try{const O=await fetch("/api/push-google-indexing",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0})}),ue=await O.json();O.ok&&ue.success?(_t(`Successfully notified Google Search Console, Google News, and IndexNow for ${ue.urlsPushed||"all"} URLs!`),he.success("Pushed to Google Search Console & IndexNow!"),Oe()):he.error(ue.error||"Failed to trigger push")}catch(O){he.error(O.message||"Failed to notify search engines")}finally{Ft(!1)}},ft=async O=>{if(O.preventDefault(),!!Fr.trim()){xt(!0);try{const ue=await fetch("/api/push-google-indexing",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({urls:[Fr.trim()]})}),Ce=await ue.json();ue.ok&&Ce.success?(he.success("URL submitted to Google & IndexNow!"),gr(""),Oe()):he.error(Ce.error||"Failed submitting URL")}catch(ue){he.error(ue.message||"Submission failed")}finally{xt(!1)}}};ie.useEffect(()=>{if(!t)return;const O=Jt(nt(fe,"notifications"),An("userId","==","all")),ue=ei(O,Ce=>{const ut=Ce.docs.map(Yt=>({id:Yt.id,...Yt.data()}));ut.sort((Yt,cn)=>{var Dr,Ln;const un=Yt.timestamp||((Dr=Yt.createdAt)!=null&&Dr.toMillis?Yt.createdAt.toMillis():0);return(cn.timestamp||((Ln=cn.createdAt)!=null&&Ln.toMillis?cn.createdAt.toMillis():0))-un}),Lr(ut),pr(!1)},Ce=>{console.warn("Failed to subscribe to broadcast notifications:",Ce),pr(!1)});return()=>ue()},[t]);const mr=async O=>{if(window.confirm("Are you sure you want to delete this broadcast message? It will be removed from all users' inboxes."))try{await ai(st(fe,"notifications",O)),he.success("Broadcast message deleted successfully!",{icon:"🗑️"})}catch(ue){he.error("Failed to delete broadcast: "+ue.message)}},Ht=async()=>{if(Lt.length&&window.confirm(`Are you sure you want to delete ALL ${Lt.length} broadcast messages from the database?`))try{await Promise.all(Lt.map(O=>ai(st(fe,"notifications",O.id)))),he.success("All broadcast messages cleared from database!",{icon:"🧹"})}catch(O){he.error("Failed to clear broadcasts: "+O.message)}},kr=async O=>{var Ce,ut,Yt;if(O.preventDefault(),!(((ut=(Ce=Ne.currentUser)==null?void 0:Ce.email)==null?void 0:ut.toLowerCase())==="atwiinevictor2@gmail.com")){he.error("Access Denied: Only Top Master Admin (atwiinevictor2@gmail.com) can dispatch broadcast messages.");return}if(!Rt.trim()||!fr.trim()){he.error("Please enter both a title and message for the broadcast!");return}yr(!0);try{const cn=`broadcast_${Date.now()}_${Math.random().toString(36).substring(2,7)}`;await Gn(st(fe,"notifications",cn),{userId:"all",isBroadcast:!0,title:Rt.trim(),message:fr.trim(),imageUrl:en.trim()||null,link:Pe.trim()||null,senderName:((Yt=Ne.currentUser)==null?void 0:Yt.displayName)||"Campus Admin",used:!1,playSound:!0,createdAt:zr(),type:"broadcast_announcement"}),he.success("Broadcast message successfully dispatched to everyone's inbox!",{icon:"📢"}),nr(""),hn(""),Ci(""),$e("")}catch(cn){he.error("Failed to send broadcast: "+cn.message)}finally{yr(!1)}},mn=async O=>{if(!(Wr[O]||yn[O])){He(ue=>({...ue,[O]:!0}));try{const[ue,Ce,ut,Yt,cn]=await Promise.all([vr(Jt(nt(fe,"articles"),An("authorId","==",O))),vr(Jt(nt(fe,"posts"),An("authorId","==",O))),vr(Jt(nt(fe,"purchases"),An("userId","==",O))),vr(Jt(nt(fe,"follows"),An("followedId","==",O))),vr(Jt(nt(fe,"follows"),An("followerId","==",O)))]),un=ue.size,Yn=Ce.size,Dr=ut.size,Ln=Yt.size,Ar=cn.size,sr=ut.docs.reduce((rl,Wf)=>rl+(Wf.data().totalAmount||0),0),tn=un*15+Yn*8+Dr*12+Ln*3;let Kr="New Citizen",Fi="bg-gray-50 text-gray-500 border-gray-100";tn>=100?(Kr="Legendary Champion",Fi="bg-amber-50 text-amber-700 border-amber-200"):tn>=50?(Kr="Super Citizen",Fi="bg-indigo-50 text-accent border-indigo-200"):tn>=15&&(Kr="Active Contributor",Fi="bg-emerald-50 text-emerald-700 border-emerald-200");const Ui=ue.docs.slice(0,3).map(rl=>({id:rl.id,title:rl.data().title})),Cl=Ce.docs.slice(0,3).map(rl=>({id:rl.id,content:rl.data().content}));dr(rl=>({...rl,[O]:{articlesCount:un,postsCount:Yn,purchasesCount:Dr,followersCount:Ln,followingCount:Ar,totalSpent:sr,engagementScore:tn,tier:Kr,tierColor:Fi,recentArticles:Ui,recentPosts:Cl}}))}catch(ue){console.error("Error fetching individual user analytics:",ue)}finally{He(ue=>({...ue,[O]:!1}))}}},[fi,_s]=ie.useState(""),[xn,Js]=ie.useState(null),[cs,ji]=ie.useState(""),[Kn,On]=ie.useState("all"),[Xn,bi]=ie.useState({totalViews:0,totalLikes:0,totalComments:0,totalArticles:0,totalPosts:0,totalUsers:0,activeAds:0,pendingAds:0,flaggedCount:0,totalTicketsSold:0,totalRevenue:0,viewsByDay:[]}),[ci,At]=ie.useState(oY()),[ha,Un]=ie.useState(["857eaaf2b7571ee437db8ee3f6ee8670"]),[ts,Wa]=ie.useState(""),[En,jn]=ie.useState([]),[an,De]=ie.useState(""),[ht,at]=ie.useState([]),[Et,rr]=ie.useState(""),[Nr,ze]=ie.useState(""),[Bt,Er]=ie.useState(""),[jr,_r]=ie.useState(""),[_n,Be]=ie.useState(""),[pe,ur]=ie.useState("Entertainment"),[Ii,vi]=ie.useState(null),[ti,ea]=ie.useState(null),[Ti,zt]=ie.useState(""),[Sn,Ta]=ie.useState(["General","Campus News","Sports","Entertainment","Politics"]),[Ss,Po]=ie.useState(""),[bs,Ka]=ie.useState(!1),[us,gi]=ie.useState(""),[vs,Ds]=ie.useState(""),[Rr,Ya]=ie.useState(""),[Qr,Rn]=ie.useState(null),[Pa,ri]=ie.useState(0),[fa,pa]=ie.useState("General"),[yl,Oa]=ie.useState([]),[Ra,ds]=ie.useState(""),[ta,wi]=ie.useState(""),[Cs,ui]=ie.useState("Discover More"),[ho,Ql]=ie.useState(""),[fo,Ko]=ie.useState(!1),[ra,Yo]=ie.useState(""),[Dn,po]=ie.useState(""),[bl,ma]=ie.useState(null),[Xa,it]=ie.useState(""),[Zr,Pi]=ie.useState("image"),[Qa,vl]=ie.useState("7"),[ge,we]=ie.useState(""),[Me,Ke]=ie.useState(["",""]),[Je,lt]=ie.useState("active"),[yt,er]=ie.useState(!1),[lr,Kt]=ie.useState([]),[k,L]=ie.useState(""),[H,ne]=ie.useState(""),[Ee,Ue]=ie.useState(""),[wt,xr]=ie.useState(!1),[mt,Vt]=ie.useState(""),[$r,fn]=ie.useState(!1);ie.useEffect(()=>{if(!t||a!=="polls")return;const O=Jt(nt(fe,"debates"),di("createdAt","desc"));vr(O).then(ue=>{Kt(ue.docs.map(Ce=>({id:Ce.id,...Ce.data()})))}).catch(ue=>{console.error("Failed to load debates in Admin Dashboard:",ue)})},[t,a]);const Fn=async O=>{if(O.preventDefault(),!k.trim()){he.error("Please enter a debate title.");return}if(wt&&!mt.trim()){he.error("Please enter an external link for discussion.");return}fn(!0);try{const ue=Ee.trim()||"https://images.unsplash.com/photo-1541872703-74c5e44368f9?auto=format&fit=crop&q=80&w=800";await dn(nt(fe,"debates"),{title:k.trim(),description:H.trim(),bannerUrl:ue,isExternal:wt,externalUrl:wt?mt.trim():"",createdAt:zr(),commentsCount:0}),he.success("Debate published successfully!"),L(""),ne(""),Ue(""),xr(!1),Vt("")}catch(ue){he.error("Failed to publish debate: "+ue.message)}finally{fn(!1)}},Mn=async O=>{if(!t){he.error("Access Denied: Only administrators can delete debates.");return}if(window.confirm("Are you sure you want to delete this debate?"))try{await ai(st(fe,"debates",O)),he.success("Debate deleted successfully!")}catch(ue){he.error("Failed to delete debate: "+ue.message)}},[ni,Ms]=ie.useState(""),[zi,Ks]=ie.useState(""),[$n,Ni]=ie.useState("audio"),[rs,wl]=ie.useState(""),[Ls,Oo]=ie.useState(""),[Zl,Bf]=ie.useState("5:40"),[eu,Za]=ie.useState("Campus Vibe"),[Nl,mo]=ie.useState(""),[Jl,Vn]=ie.useState(""),[tu,te]=ie.useState(!1),[u,p]=ie.useState([]),[g,b]=ie.useState(null),[v,E]=ie.useState(null),[_,P]=ie.useState([]),[M,W]=ie.useState([]),[ee,oe]=ie.useState([]),[ye,Se]=ie.useState(""),[Te,Ye]=ie.useState(""),[dt,Wt]=ie.useState(""),[qt,Mt]=ie.useState(!1),[In,bn]=ie.useState({}),[ns,Da]=ie.useState(null),[Ys,pi]=ie.useState(""),[js,ga]=ie.useState(""),[kc,El]=ie.useState(""),[_m,ih]=ie.useState(!1);ie.useEffect(()=>{if(!t||a!=="mega-ai-knowledge")return;const O=Jt(nt(fe,"mega_ai_knowledge")),ue=ei(O,un=>{const Yn=un.docs.map(Dr=>({id:Dr.id,...Dr.data()}));Yn.sort((Dr,Ln)=>{var tn,Kr,Fi,Ui;const Ar=((tn=Dr.createdAt)==null?void 0:tn.seconds)||((Kr=Dr.updatedAt)==null?void 0:Kr.seconds)||0;return(((Fi=Ln.createdAt)==null?void 0:Fi.seconds)||((Ui=Ln.updatedAt)==null?void 0:Ui.seconds)||0)-Ar}),P(Yn)},un=>console.error("Error subscribing to mega_ai_knowledge:",un)),Ce=Jt(nt(fe,"notifications"),An("type","==","mega_ai_query")),ut=ei(Ce,un=>{const Yn=un.docs.map(Dr=>({id:Dr.id,...Dr.data()}));Yn.sort((Dr,Ln)=>{var Ar,sr;return(((Ar=Ln.createdAt)==null?void 0:Ar.seconds)||0)-(((sr=Dr.createdAt)==null?void 0:sr.seconds)||0)}),W(Yn)},un=>console.error("Error subscribing to mega_ai_query tickets:",un)),Yt=Jt(nt(fe,"notifications"),An("type","==","unlimited_posting_request")),cn=ei(Yt,un=>{const Yn=un.docs.map(Dr=>({id:Dr.id,...Dr.data()}));Yn.sort((Dr,Ln)=>{var Ar,sr;return(((Ar=Ln.createdAt)==null?void 0:Ar.seconds)||0)-(((sr=Dr.createdAt)==null?void 0:sr.seconds)||0)}),oe(Yn)},un=>console.error("Error subscribing to unlimited posting requests:",un));return()=>{ue(),ut(),cn()}},[t,a]);const Al=async O=>{const ue=O.requestAuthorId||O.userId;if(!ue){he.error("User ID not found on request.");return}try{await Gn(st(fe,"users",ue),{isPremiumPostUser:!0},{merge:!0}),await dn(nt(fe,"notifications"),{userId:ue,type:"unlimited_posting_approved",title:"🎉 Unlimited Posting Approved!",message:"An administrator has approved your account for unlimited dispatches and postings on Campus Eye!",used:!1,playSound:!0,createdAt:zr()}),O.id&&await ai(st(fe,"notifications",O.id)),oe(Ce=>Ce.filter(ut=>ut.id!==O.id)),he.success(`Approved @${O.requestAuthorName||"Student"} for unlimited posting! Notification removed.`,{icon:"🎉"})}catch(Ce){he.error("Failed to approve user: "+Ce.message)}},Sm=async O=>{try{await ai(st(fe,"notifications",O)),oe(ue=>ue.filter(Ce=>Ce.id!==O)),he.success("Request dismissed and permanently deleted.",{icon:"🗑️"})}catch(ue){he.error("Failed to dismiss request: "+ue.message)}},Xo=async()=>{if(ee.length!==0&&window.confirm("Permanently clear and delete ALL unlimited posting approval requests?"))try{await Promise.all(ee.map(O=>ai(st(fe,"notifications",O.id)))),oe([]),he.success("All posting approval requests permanently cleared!",{icon:"✨"})}catch(O){he.error("Error clearing requests: "+O.message)}},sh=async O=>{try{await ai(st(fe,"notifications",O)),W(ue=>ue.filter(Ce=>Ce.id!==O)),he.success("Query ticket deleted permanently.",{icon:"🗑️"})}catch(ue){he.error("Failed to delete ticket: "+ue.message)}},ix=async O=>{if(O.preventDefault(),!ye.trim()||!Te.trim()){he.error("Please fill in both the Question and Answer fields.");return}Mt(!0);try{const ue=dt.split(",").map(ut=>ut.trim()).filter(Boolean),Ce=await dn(nt(fe,"mega_ai_knowledge"),{question:ye.trim(),answer:Te.trim(),keywords:ue,createdAt:zr()});P(ut=>[{id:Ce.id,question:ye.trim(),answer:Te.trim(),keywords:ue},...ut]),Se(""),Ye(""),Wt(""),he.success("Added smart reply to Mega AI Knowledge Base!")}catch(ue){he.error("Failed to add AI knowledge: "+ue.message)}finally{Mt(!1)}},Cm=async O=>{if(window.confirm("Remove this entry from Mega AI knowledge base?"))try{await ai(st(fe,"mega_ai_knowledge",O)),P(ue=>ue.filter(Ce=>Ce.id!==O)),he.success("Removed entry from Mega AI Knowledge Base.")}catch(ue){he.error("Error deleting knowledge item: "+ue.message)}},jm=O=>{Da(O),pi(O.question||""),ga(O.answer||""),El(Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords||"")},Im=()=>{Da(null),pi(""),ga(""),El("")},td=async O=>{if(O.preventDefault(),!ns||!Ys.trim()||!js.trim()){he.error("Please fill in both the Question and Answer fields.");return}ih(!0);try{const ue=kc.split(",").map(Ce=>Ce.trim()).filter(Boolean);await Ir(st(fe,"mega_ai_knowledge",ns.id),{question:Ys.trim(),answer:js.trim(),keywords:ue,updatedAt:zr()}),Da(null),he.success("AI Knowledge Base entry updated successfully!",{icon:"✨"})}catch(ue){he.error("Failed to update AI knowledge: "+ue.message)}finally{ih(!1)}},Tb=async O=>{const ue=In[O.id]||O.generatedReply||"";if(!ue.trim()){he.error("Please enter a reply before submitting.");return}try{O.postId?(await dn(nt(fe,"posts",O.postId,"comments"),{postId:O.postId,content:ue.trim(),authorId:"mega-ai-bot",authorName:"Mega AI",authorPhotoURL:Uo,createdAt:zr(),likeCount:0,likedBy:[],isAIGenerated:!0}),await Ir(st(fe,"posts",O.postId),{commentCount:Cn(1)})):O.articleId&&(await dn(nt(fe,"articles",O.articleId,"comments"),{content:ue.trim(),userId:"mega-ai-bot",authorName:"Mega AI",photoURL:Uo,createdAt:zr(),articleId:O.articleId,likeCount:0,isAIGenerated:!0}),await Ir(st(fe,"articles",O.articleId),{commentCount:Cn(1)}));const Ce=(O.userQuery||"").toLowerCase().split(" ").filter(ut=>ut.length>3);if(await dn(nt(fe,"mega_ai_knowledge"),{question:O.userQuery||"",answer:ue.trim(),keywords:Ce,createdAt:zr()}),O.userUid&&O.userUid!=="guest")try{await dn(nt(fe,"notifications"),{userId:O.userUid,type:"admin_mega_reply",title:"🤖 Admin / Mega AI Replied to your Query!",message:`Response: "${ue.trim().slice(0,120)}${ue.trim().length>120?"...":""}"`,fullAnswer:ue.trim(),userQuery:O.userQuery||"",targetType:O.targetType||"post",postId:O.postId||null,articleId:O.articleId||null,commentId:O.commentId||null,used:!1,playSound:!0,createdAt:zr()})}catch(ut){console.warn("Could not dispatch user inbox notification:",ut)}O.id&&(await Ir(st(fe,"notifications",O.id),{used:!0}),W(ut=>ut.map(Yt=>Yt.id===O.id?{...Yt,used:!0}:Yt))),he.success("Replied to user as Mega AI & saved response into Knowledge Base! ✨")}catch(Ce){he.error("Error replying to Mega AI query: "+Ce.message)}},ah=O=>{var Ce;return O.username?O.username:(O.displayName||((Ce=O.email)==null?void 0:Ce.split("@")[0])||"peer").toLowerCase().replace(/[^a-z0-9]/g,"")},rd=ie.useMemo(()=>Qr===null?[]:X.filter(O=>{const ue=(O.username||ah(O)).toLowerCase(),Ce=(O.displayName||"").toLowerCase(),ut=Qr.toLowerCase();return ue.includes(ut)||Ce.includes(ut)}).slice(0,5),[Qr,X]),MA=O=>{const ue=O.target.value;Ya(ue);const Ce=O.target.selectionStart,Yt=ue.substring(0,Ce).split(/[\s]/),cn=Yt[Yt.length-1];cn.startsWith("@")?(Rn(cn.substring(1)),ri(Ce)):Rn(null)};ie.useEffect(()=>{if(!t||a!=="manage-podcasts")return;const O=Jt(nt(fe,"podcasts"),di("publishDate","desc"));vr(O).then(ue=>{p(ue.docs.map(Ce=>({id:Ce.id,...Ce.data()})))}).catch(ue=>{console.error("Failed to load podcasts in Admin Dashboard:",ue)})},[t,a]);const go=()=>{Ms(""),Ks(""),Ni("audio"),wl(""),Oo(""),Bf("5:40"),Za("Campus Vibe"),mo(""),Vn(""),b(null)},sx=async O=>{O.preventDefault();const ue=($n==="video"?Ls:rs).trim();if(!ni.trim()||!zi.trim()||!ue){he.error(`Please fill out podcast title, host name, and ${$n==="video"?"video":"audio"} link.`);return}te(!0);try{let Ce=Nl.trim();Ce||($n==="video"&&xp(ue)?Ce=gw(ue,"hq"):$n==="video"?Ce="https://images.unsplash.com/photo-1578022761797-b8636ac1773c?auto=format&fit=crop&q=80&w=500":Ce="https://images.unsplash.com/photo-1590602847861-f357a9332bbc?auto=format&fit=crop&q=80&w=500");const ut={title:ni.trim(),author:zi.trim(),mediaType:$n,audioUrl:$n==="audio"?ue:"",videoUrl:$n==="video"?ue:"",mediaUrl:ue,duration:Zl.trim()||($n==="video"?"Video":"5:40"),category:eu,thumbnail:Ce,description:Jl.trim(),publishDate:zr()};if(g)await Ir(st(fe,"podcasts",g),ut),he.success(`${$n==="video"?"🎬 Video":"📻 Audio"} podcast updated successfully!`,{icon:$n==="video"?"🎬":"📻"});else{const Yt=await dn(nt(fe,"podcasts"),ut);he.success(`New ${$n==="video"?"🎬 Video":"📻 Audio"} episode published successfully!`,{icon:$n==="video"?"🎬":"📻"});try{const cn=(ni||"podcast").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");fetch("/api/append-sitemap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:`${window.location.origin}/podcast/${cn}/${Yt.id}`,title:ni,image:Nl||""})}).catch(()=>{})}catch{}}go()}catch(Ce){console.error(Ce),he.error("Failed to save podcast: "+Ce.message)}finally{te(!1)}},_c=O=>{const ue=Ul(O);Ms(O.title||""),Ks(O.author||""),Ni(ue?"video":"audio"),wl(O.audioUrl||(ue?"":O.mediaUrl)||""),Oo(O.videoUrl||(ue?O.mediaUrl:"")||""),Bf(O.duration||(ue?"Video":"5:40")),Za(O.category||"Campus Vibe"),mo(O.thumbnail||""),Vn(O.description||""),b(O.id),window.scrollTo({top:0,behavior:"smooth"})},Pb=async O=>{if(!t){he.error("Access Denied: Only administrators can delete podcasts.");return}if(window.confirm("Are you sure you want to permanently delete this podcast episode?"))try{await ai(st(fe,"podcasts",O)),he.success("Podcast episode deleted permanently.")}catch(ue){he.error("Failed to delete podcast: "+ue.message)}},Tm=O=>{Ul(O)?(E(O),window.dispatchEvent(new CustomEvent("play-video-podcast",{detail:O})),he.success(`Previewing Video: ${O.title}`,{icon:"🎬"})):(window.dispatchEvent(new CustomEvent("play-podcast",{detail:O})),he.success(`Broadcasting Audio: ${O.title}`,{icon:"📻"}))},Sc=["atwiinevictor2@gmail.com","campuseye@gmail.com"];ie.useEffect(()=>{const O=Ne.currentUser;localStorage.getItem("is_admin_cached")==="true"?(r(!0),i(!1)):O&&Sc.includes(O.email||"")&&(r(!0),localStorage.setItem("is_admin_cached","true"),i(!1));const Ce=setTimeout(()=>{i(!1)},1200);let ut=null,Yt=null;const cn=Ne.onAuthStateChanged(async un=>{if(ut&&(ut(),ut=null),Yt&&(Yt(),Yt=null),un){if(Sc.includes(un.email||"")){r(!0),localStorage.setItem("is_admin_cached","true"),i(!1),clearTimeout(Ce);return}let Yn=!1,Dr=!1;const Ln=()=>{const Ar=Yn||Dr||Sc.includes(un.email||"");r(Ar),localStorage.setItem("is_admin_cached",Ar?"true":"false"),i(!1),clearTimeout(Ce)};ut=ei(st(fe,"users",un.uid),Ar=>{if(Ar.exists()){const sr=Ar.data();Yn=sr.isAdmin===!0||sr.role==="admin"}Ln()},Ar=>{console.warn("User doc admin snapshot error:",Ar),Ln()}),Yt=ei(st(fe,"admins",un.uid),Ar=>{Ar.exists()&&(Dr=Ar.data().isAdmin===!0),Ln()},Ar=>{console.warn("Admin doc snapshot error:",Ar),Ln()})}else r(!1),localStorage.removeItem("is_admin_cached"),i(!1),clearTimeout(Ce)});return()=>{cn(),ut&&ut(),Yt&&Yt(),clearTimeout(Ce)}},[]),ie.useEffect(()=>{if(!t)return;const O=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ue=[1850,2460,2100,3120,2890,4150,4800],Ce=[1250,1680,1520,1890,1720,2150,2420],ut=[15,24,18,32,28,45,54],Yt=[12,18,15,25,22,38,48],cn=O.map((Dr,Ln)=>({name:Dr,visitors:ue[Ln],indigo:Ce[Ln],engagement:Ce[Ln],posts:ut[Ln],tickets:Yt[Ln]})),un=async()=>{try{const[Dr,Ln,Ar,sr,tn]=await Promise.all([Jx(nt(fe,"articles")).catch(()=>null),Jx(nt(fe,"posts")).catch(()=>null),Jx(nt(fe,"users")).catch(()=>null),Jx(nt(fe,"adverts")).catch(()=>null),Jx(nt(fe,"purchases")).catch(()=>null)]);bi(Kr=>({...Kr,totalArticles:(Dr==null?void 0:Dr.data().count)??Kr.totalArticles??0,totalPosts:(Ln==null?void 0:Ln.data().count)??Kr.totalPosts??0,totalUsers:(Ar==null?void 0:Ar.data().count)??Kr.totalUsers??0,activeAds:(sr==null?void 0:sr.data().count)??Kr.activeAds??0,totalTicketsSold:(tn==null?void 0:tn.data().count)??Kr.totalTicketsSold??0,viewsByDay:cn}))}catch(Dr){console.warn("Silent ignore stats count error:",Dr)}};un();const Yn=setInterval(un,3e4);return()=>{clearInterval(Yn)}},[t]),ie.useEffect(()=>{const O=a==="dashboard"||a==="article"||a==="manage-articles",ue=a==="dashboard"||a==="manage-ads"||a==="advert",Ce=a==="dashboard"||a==="manage-articles"||a==="article",ut=a==="users",Yt=a==="flagged-comments",cn=a==="manage-tickets"||a==="ticket-purchases",un=a==="dashboard"||a==="ticket-purchases",Yn=a==="manage-posts",Dr=a==="custom-links",Ln=a==="feedback-inbox";if(O){const Ar=Jt(nt(fe,"categories"),di("name","asc"));vr(Ar).then(sr=>{const tn=sr.docs.map(Kr=>Kr.data().name);if(tn.length>0){const Kr=Array.from(new Set(["General","Campus News","Sports","Entertainment","Politics",...tn]));Ta(Kr)}}).catch(sr=>{Gs(sr,Ps.LIST,"categories")})}if(Ne.currentUser&&ue){const Ar=Jt(nt(fe,"adverts"),di("createdAt","desc"),yi(30));vr(Ar).then(sr=>{const tn=sr.docs.map(Ui=>({id:Ui.id,...Ui.data()}));Dt(tn);const Kr=tn.filter(Ui=>Ui.status==="active").length,Fi=tn.filter(Ui=>Ui.status==="hidden").length;bi(Ui=>({...Ui,activeAds:Kr,pendingAds:Fi}))}).catch(sr=>{Gs(sr,Ps.LIST,"adverts")})}if(Ne.currentUser&&Ce){const Ar=a==="dashboard"?30:60,sr=Jt(nt(fe,"articles"),di("publishDate","desc"),yi(Ar));vr(sr).then(tn=>{const Kr=tn.docs.map(xo=>({id:xo.id,...xo.data()}));h(Kr);const Fi=Kr.reduce((xo,Ja)=>xo+(Ja.viewCount||Ja.views||0),0),Ui=Kr.reduce((xo,Ja)=>xo+(Ja.likeCount||Ja.likes||0),0),Cl=Kr.reduce((xo,Ja)=>xo+(Ja.commentCount||0),0),rl=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Wf=[1850,2460,2100,3120,2890,4150,4800],Nx=[1250,1680,1520,1890,1720,2150,2420],BA=[15,24,18,32,28,45,54],Hb=[12,18,15,25,22,38,48],Gb=rl.map((xo,Ja)=>({name:xo,visitors:Wf[Ja],indigo:Nx[Ja],engagement:Nx[Ja],posts:BA[Ja],tickets:Hb[Ja]}));bi(xo=>({...xo,totalViews:Fi,totalLikes:Ui,totalArticles:xo.totalArticles||Kr.length,totalComments:Cl,viewsByDay:Gb}))},tn=>{Gs(tn,Ps.LIST,"articles")})}if(Ne.currentUser&&t&&a==="dashboard"&&(vr(nt(fe,"posts")).then(Ar=>{const sr=Ar.docs.map(Fi=>({id:Fi.id,...Fi.data()})),tn=sr.filter(Fi=>Fi.flagged===!0||Fi.isFlagged===!0),Kr=sr.reduce((Fi,Ui)=>{var Cl;return Fi+(Ui.commentsCount||((Cl=Ui.comments)==null?void 0:Cl.length)||0)},0);bi(Fi=>({...Fi,totalPosts:Ar.docs.length,totalComments:Fi.totalComments+Kr,flaggedCount:Fi.flaggedCount+tn.length}))}).catch(Ar=>console.error("Error fetching posts stats:",Ar)),vr(nt(fe,"users")).then(Ar=>{bi(sr=>({...sr,totalUsers:Ar.docs.length}))}).catch(Ar=>console.error("Error fetching users stats:",Ar))),Ne.currentUser&&t&&ut&&vr(Jt(nt(fe,"users"),yi(50))).then(Ar=>{q(Ar.docs.map(sr=>({id:sr.id,...sr.data()})))}).catch(Ar=>{console.error("Error loading users:",Ar),Gs(Ar,Ps.LIST,"users")}),Ne.currentUser&&t&&(Yt||a==="dashboard")){const Ar=Jt(vhe(fe,"comments"),yi(50));vr(Ar).then(sr=>{const tn=sr.docs.map(Kr=>({id:Kr.id,...Kr.data()})).filter(Kr=>Kr.flagged===!0);z(tn),bi(Kr=>({...Kr,flaggedCount:tn.length}))}).catch(sr=>{Gs(sr,Ps.LIST,"comments-group")}),vr(Jt(nt(fe,"posts"),yi(100))).then(sr=>{const tn=sr.docs.map(Kr=>({id:Kr.id,...Kr.data()})).filter(Kr=>Kr.flagged===!0||Kr.isFlagged===!0);jn(tn)}).catch(sr=>console.error("Error fetching flagged posts:",sr))}if(Ne.currentUser&&a==="imgbb-settings"&&as(st(fe,"settings","imgbb")).then(Ar=>{if(Ar.exists()){const sr=Ar.data();sr.activeKey&&(At(sr.activeKey),localStorage.setItem("campus_eye_imgbb_active_key",sr.activeKey)),Array.isArray(sr.savedKeys)&&sr.savedKeys.length>0&&Un(sr.savedKeys)}}).catch(Ar=>console.error("Error loading imgbb settings:",Ar)),Ne.currentUser&&cn){const Ar=Jt(nt(fe,"tickets"),di("createdAt","desc"),yi(30));vr(Ar).then(sr=>{St(sr.docs.map(tn=>({id:tn.id,...tn.data()})))}).catch(sr=>{Gs(sr,Ps.LIST,"tickets")})}if(Ne.currentUser&&t&&un){const Ar=Jt(nt(fe,"purchases"),di("purchaseDate","desc"),yi(45));vr(Ar).then(sr=>{const tn=sr.docs.map(Ui=>({id:Ui.id,...Ui.data()}));Gt(tn);const Kr=tn.reduce((Ui,Cl)=>Ui+(Cl.quantity||0),0),Fi=tn.reduce((Ui,Cl)=>Ui+(Cl.totalAmount||0),0);bi(Ui=>({...Ui,totalTicketsSold:Kr,totalRevenue:Fi}))}).catch(sr=>{Gs(sr,Ps.LIST,"purchases")})}if(Ne.currentUser&&Yn){const Ar=Jt(nt(fe,"posts"),di("createdAt","desc"),yi(40));vr(Ar).then(sr=>{const tn=sr.docs.map(Kr=>({id:Kr.id,...Kr.data()}));$(tn)}).catch(sr=>{console.warn("Silent ignore admin lounge posts list issue:",sr)})}if(Ne.currentUser&&t&&Dr){const Ar=Jt(nt(fe,"custom_pages"),di("createdAt","desc"),yi(20));vr(Ar).then(sr=>{const tn=sr.docs.map(Kr=>({id:Kr.id,...Kr.data()}));Q(tn)}).catch(sr=>{console.error("Silent ignore admin custom pages list issue:",sr)})}if(Ne.currentUser&&t&&Ln){const Ar=Jt(nt(fe,"feedback"),di("createdAt","desc"),yi(30));vr(Ar).then(sr=>{const tn=sr.docs.map(Kr=>({id:Kr.id,...Kr.data()}));at(tn)}).catch(sr=>{console.error("Silent ignore admin feedbacks list issue:",sr)})}return()=>{}},[t,a]);const ax=async O=>{if(O.preventDefault(),!(!Ne.currentUser||!t)){if(!K.trim()||!re.trim()){he.error("Please fill in all details for the page!");return}Pt(!0);try{pt?(await Ir(st(fe,"custom_pages",pt.id),{name:K.trim(),url:re.trim(),svgIcon:ve.trim(),type:Ve,description:se.trim(),isPinnedStyle:ae}),he.success("Page updated successfully in everyone's menu!"),Fe(null)):(await dn(nt(fe,"custom_pages"),{name:K.trim(),url:re.trim(),svgIcon:ve.trim(),type:Ve,description:se.trim(),isPinnedStyle:ae,createdAt:zr()}),he.success("New page loaded to everyone's menu!")),me(""),le(""),je(""),Z("link"),xe(""),qe(!1)}catch(ue){he.error("Database operation failed: "+ue.message)}finally{Pt(!1)}}},Ob=O=>{Fe(O),me(O.name),le(O.url),je(O.svgIcon||""),Z(O.type||"link"),xe(O.description||""),qe(!!O.isPinnedStyle)},ox=async O=>{if(!t){he.error("Access Denied: Only administrators can delete custom pages.");return}if(window.confirm("Are you sure you want to permanently delete this custom page from everyone's menu?"))try{await ai(st(fe,"custom_pages",O)),he.success("Custom page removed successfully."),(pt==null?void 0:pt.id)===O&&(Fe(null),me(""),le(""),je(""),Z("link"),xe(""),qe(!1))}catch(ue){he.error("Failed to delete page: "+ue.message)}},Rb=async O=>{if(O.preventDefault(),!(!Ne.currentUser||!t)){Pt(!0),Ie(null),Re(!1);try{const ue=bh||(ti==null?void 0:ti.imageUrl)||"https://picsum.photos/seed/ticket/300/200",Ce=an.trim()||"Untitled Campus Event",ut=parseFloat(Nr)||0,Yt=parseInt(_n)||100,cn={title:Ce,description:Et||"Join us for this amazing university experience.",price:ut,eventDate:Bt?wn.fromDate(new Date(Bt)):zr(),venue:jr||"Campus Hall",imageUrl:ue,totalQuantity:Yt,remainingQuantity:ti?ti.remainingQuantity+(Yt-ti.totalQuantity):Yt,category:pe||"Entertainment",status:"available",createdAt:ti?ti.createdAt:zr(),authorId:Ne.currentUser.uid,link:Ti||""};ti?(await Ir(st(fe,"tickets",ti.id),cn),he.success("Ticket updated successfully!")):(await dn(nt(fe,"tickets"),cn),he.success("Ticket created successfully!")),Re(!0),De(""),rr(""),ze(""),Er(""),_r(""),Be(""),vi(null),Do(""),ea(null),zt("")}catch(ue){Ie(ue.message||"Failed to save ticket"),he.error("Failed to save ticket")}finally{Pt(!1)}}},Qo=async O=>{if(!(!t||!window.confirm("Are you sure you want to delete this ticket?")))try{await ai(st(fe,"tickets",O)),he.success("Ticket deleted")}catch(ue){console.error("Error deleting ticket:",ue),he.error("Failed to delete ticket")}},oh=async(O,ue)=>{if(!(!t||!window.confirm("Are you sure you want to delete this comment?")))try{await ai(st(fe,"articles",O,"comments",ue)),he.success("Comment deleted")}catch(Ce){console.error("Error deleting comment:",Ce),Ie("Failed to delete comment. Make sure it has an articleId.")}},lh=async(O,ue)=>{if(t)try{await Ir(st(fe,"articles",O,"comments",ue),{flagged:!1})}catch(Ce){console.error("Error unflagging comment:",Ce),Ie("Failed to unflag comment. Make sure it has an articleId.")}},Pm=async O=>{if(t)try{await Ir(st(fe,"posts",O),{flagged:!1}),he.success("Post flag dismissed!")}catch(ue){console.error("Error unflagging post:",ue),he.error("Failed to unflag post.")}},zf=async O=>{if(!(!t||!window.confirm("Are you sure you want to delete this post?")))try{await ai(st(fe,"posts",O)),he.success("Post deleted successfully!")}catch(ue){console.error("Error deleting post:",ue),he.error("Failed to delete post.")}},Zo=async(O,ue)=>{var un,Yn;if(!t)return;const Ce="atwiinevictor2@gmail.com",ut=((un=Ne.currentUser)==null?void 0:un.email)||"",Yt=X.find(Dr=>Dr.id===O),cn=(Yt==null?void 0:Yt.email)||"";if(cn.toLowerCase()===Ce.toLowerCase()&&ue===!0&&ut.toLowerCase()!==Ce.toLowerCase()){try{if(Ne.currentUser){await Ir(st(fe,"users",Ne.currentUser.uid),{isAdmin:!1,role:"user"});try{await ai(st(fe,"admins",Ne.currentUser.uid))}catch{}}}catch(Dr){console.error("Failed to strip rogue admin privileges:",Dr)}try{const Dr=((Yn=Ne.currentUser)==null?void 0:Yn.displayName)||ut||"An Administrator",Ln=`alert_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;await Gn(st(fe,"notifications",Ln),{userId:O,title:"🛡️ Unauthorized Admin Dismissal Blocked",message:`${Dr} (${ut}) attempted to dismiss you from being admin. They have been immediately removed from admins.`,used:!1,createdAt:new Date,type:"admin_security"})}catch(Dr){console.error("Failed to push alert inbox notification:",Dr)}return}try{const Dr=!ue;if(await Ir(st(fe,"users",O),{isAdmin:Dr,role:Dr?"admin":"user"}),Dr){await Gn(st(fe,"admins",O),{isAdmin:!0,email:cn||"",grantedBy:ut,updatedAt:zr()},{merge:!0});try{const Ln=`admin_grant_${O}_${Date.now()}`;await Gn(st(fe,"notifications",Ln),{userId:O,title:"👑 Admin & Reporter Privileges Granted!",message:`Congratulations! Main Admin (${ut}) has granted you Admin & Reporter privileges. You can now post articles, edit stories, and manage dispatches in the Admin Dashboard.`,used:!1,createdAt:new Date,type:"admin_security"})}catch{}he.success(`Granted Admin privileges to ${cn||"user"}! They can now post articles.`)}else{try{await ai(st(fe,"admins",O))}catch{}he.success(`Revoked Admin privileges for ${cn||"user"}.`)}}catch(Dr){Ie(Dr.message||"Failed to update user status"),he.error("Failed to change admin role status")}},Jo=async(O,ue)=>{if(t)try{await Ir(st(fe,"users",O),{isVerified:!ue,isPremium:!ue,blueCheck:!ue,isPremiumPostUser:!ue}),he.success(ue?"Removed Blue Check (Premium) badge!":"Granted Blue Check (Premium) badge!")}catch(Ce){he.error("Failed to update user verification status: "+Ce.message)}},ru=async O=>{if(!(!t||!window.confirm("Are you sure you want to delete this article?")))try{await ai(st(fe,"articles",O)),he.success("Article deleted")}catch(ue){console.error("Error deleting article:",ue)}},ec=async O=>{var ut,Yt,cn,un;const ue=((Yt=(ut=Ne.currentUser)==null?void 0:ut.email)==null?void 0:Yt.toLowerCase())==="atwiinevictor2@gmail.com"||((un=(cn=Ne.currentUser)==null?void 0:cn.email)==null?void 0:un.toLowerCase())==="campuseye@gmail.com";if(!(t||ue||!!Ne.currentUser)){he.error("Please log in as admin or user to delete adverts");return}if(window.confirm("Are you sure you want to delete this advert?"))try{Dt(Yn=>Yn.filter(Dr=>Dr.id!==O)),await ai(st(fe,"adverts",O)),he.success("Advert deleted successfully!")}catch(Yn){console.error("Error deleting advert:",Yn),he.error("Failed to delete advert: "+Yn.message)}},tc=async O=>{if(O.preventDefault(),!!Ss.trim()){Pt(!0);try{await dn(nt(fe,"categories"),{name:Ss.trim(),createdAt:zr()}),Po(""),Ka(!1)}catch(ue){Ie(ue.message||"Failed to add category")}finally{Pt(!1)}}},[xi,Om]=ie.useState(null),[nu,lx]=ie.useState(!1),[ch,na]=ie.useState(""),[Vi,Qn]=ie.useState("all"),[iu,el]=ie.useState(null),[cx,su]=ie.useState(null),[LA,UA]=ie.useState(null),[Vf,uh]=ie.useState(""),[Db,Rm]=ie.useState(""),[Mb,dh]=ie.useState(""),[au,nd]=ie.useState("General"),[ou,Lb]=ie.useState(""),[Ub,Ff]=ie.useState(""),[ux,hh]=ie.useState("published"),[Ma,dx]=ie.useState(!1),[fh,Dm]=ie.useState(""),[hx,Mm]=ie.useState(""),[ws,ph]=ie.useState(""),[Cc,kl]=ie.useState(""),[Lm,rc]=ie.useState(""),[lu,Um]=ie.useState(""),[fx,px]=ie.useState(0),[mx,jc]=ie.useState(0),[Bm,mh]=ie.useState(0),[gx,cu]=ie.useState(0),[zm,gh]=ie.useState(0),[$f,Vm]=ie.useState("published"),[Fm,Ic]=ie.useState(""),[Tc,$m]=ie.useState(""),[Hm,uu]=ie.useState(""),[nc,id]=ie.useState(""),[_l,xh]=ie.useState(!0),[Gm,du]=ie.useState(!1),[qm,ic]=ie.useState(5),[sd,Hf]=ie.useState(!1),[sc,ac]=ie.useState(""),[ad,xx]=ie.useState([]),[Wm,od]=ie.useState(!1),[Gf,Bb]=ie.useState(!1),[zb,yh]=ie.useState(!1),[Km,Vb]=ie.useState(!1),[yx,bx]=ie.useState(!1),[tl,Sl]=ie.useState(!1),[Ro,qf]=ie.useState(""),[bh,Do]=ie.useState(""),ia=async(O,ue,Ce)=>{Ce(!0);const ut=he.loading("Uploading image...");try{const Yt=await I4(O);ue(Yt),he.success("Image successfully uploaded and linked!",{id:ut})}catch(Yt){console.error(Yt),he.error(`Upload failed: ${Yt.message||Yt}`,{id:ut})}finally{Ce(!1)}};ie.useEffect(()=>{Ne.currentUser&&!xi&&(kl(Ne.currentUser.displayName||"Anonymous"),rc(Ne.currentUser.photoURL||""))},[Ne.currentUser,xi]),ie.useEffect(()=>{t&&as(st(fe,"settings","pinned")).then(O=>{if(O.exists()){const ue=O.data();Ic(ue.title||""),$m(ue.description||""),uu(ue.link||""),id(ue.imageUrl||""),xh(!!ue.active),ic(ue.durationSeconds||5),Hf(!!ue.isLiveStream),ac(ue.liveEmbedUrl||"")}}).catch(O=>{console.warn("Silent ignored settings/pinned load error in admin panel:",O)})},[t]),ie.useEffect(()=>{if(!t)return;const O=Jt(nt(fe,"pinned_announcements"),di("createdAt","desc"));vr(O).then(ue=>{const Ce=ue.docs.map(ut=>({id:ut.id,...ut.data()}));xx(Ce)}).catch(ue=>{Gs(ue,Ps.LIST,"pinned_announcements")})},[t]);const Is=async O=>{if(O.preventDefault(),!!t){du(!0);try{await Gn(st(fe,"settings","pinned"),{title:Fm.trim()||"Important Notice",description:Tc.trim()||"No detailed content provided.",link:Hm.trim(),imageUrl:nc.trim(),active:_l,durationSeconds:Number(qm)||5,isLiveStream:sd,liveEmbedUrl:sc.trim(),updatedAt:zr()},{merge:!0}),await dn(nt(fe,"pinned_announcements"),{title:Fm.trim()||"Important Notice",description:Tc.trim()||"No detailed content provided.",link:Hm.trim(),imageUrl:nc.trim(),active:_l,durationSeconds:Number(qm)||5,isLiveStream:sd,liveEmbedUrl:sc.trim(),createdAt:zr()}),he.success("Pinned Announcement published successfully!"),Ic(""),$m(""),uu(""),id(""),xh(!0),ic(5),Hf(!1),ac("")}catch(ue){console.error(ue),he.error(`Failed to publish pinned announcement: ${ue.message||ue}`)}finally{du(!1)}}},Ym=async O=>{if(!t){he.error("Access Denied: Only administrators can delete announcements.");return}if(window.confirm("Are you sure you want to permanently delete this announcement?"))try{await ai(st(fe,"pinned_announcements",O)),he.success("Pinned Announcement deleted successfully.")}catch(ue){he.error("Failed to delete announcement: "+ue.message)}},Pc=O=>{if(Om(O),gi(O.title||""),Ds(O.summary||""),Ya(O.content||""),pa(O.category||"General"),ds(O.video||""),wi(O.Links||""),Ko(O.isSponsoredAd||!1),Dm(O.featuredImageUrl||""),Mm(O.featuredImageUrl1||""),ph(O.featuredImageUrl2||""),kl(O.authorName||""),rc(O.authorProfile||""),O.publishDate){const ue=O.publishDate instanceof wn?O.publishDate.toDate():new Date(O.publishDate),Ce=ue.getTimezoneOffset()*6e4,ut=new Date(ue.getTime()-Ce).toISOString().slice(0,16);Um(ut)}else Um("");px(O.viewCount||0),jc(O.likeCount||0),mh(O.commentCount||0),cu(O.saveCount||0),gh(O.shareCount||0),Vm(O.status||"published"),o("article")},Tn=()=>{var O,ue;Om(null),gi(""),Ds(""),Ya(""),pa("General"),Oa([]),ds(""),wi(""),Ko(!1),Dm(""),Mm(""),ph(""),kl(((O=Ne.currentUser)==null?void 0:O.displayName)||"Anonymous"),rc(((ue=Ne.currentUser)==null?void 0:ue.photoURL)||""),Um(""),px(0),jc(0),mh(0),cu(0),gh(0),Vm("published")},Li=async O=>{var ue,Ce;if(O.preventDefault(),!(!Ne.currentUser||!t)){if(!us.trim()){he.error("Article Title is required. Cannot publish an empty article.");return}if(!Rr.trim()){he.error("Article Content is required. Cannot publish an empty article.");return}Pt(!0),Ie(null),Re(!1);try{const ut=us.trim(),Yt=vs.trim()||"No preview summary provided for this story.",cn=Rr.trim();let un;lu?un=wn.fromDate(new Date(lu)):xi!=null&&xi.publishDate?un=xi.publishDate:un=zr();const Yn={title:ut,summary:Yt,content:cn,category:fa||"General",featuredImageUrl:fh||"",featuredImageUrl1:hx||"",featuredImageUrl2:ws||"",authorId:xi?xi.authorId:Ne.currentUser.uid,authorName:Cc||Ne.currentUser.displayName||"Anonymous",authorProfile:Lm||Ne.currentUser.photoURL||"",publishDate:un,updatedAt:zr(),viewCount:Number(fx)||0,likeCount:Number(mx)||0,commentCount:Number(Bm)||0,saveCount:Number(gx)||0,shareCount:Number(zm)||0,video:Ra||"",Links:ta||"",ctaText:Cs||"Discover More",ctaUrl:ho||"",status:$f||"published",isSponsoredAd:fo||!1};let Dr="";if(xi)await Ir(st(fe,"articles",xi.id),Yn),Dr=xi.id;else{const sr=await dn(nt(fe,"articles"),Yn);Dr=sr.id;try{await fetch("/api/notify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:"New Article Published",message:ut,url:`${window.location.origin}/article/${sr.id}`,imageUrl:fh||""})})}catch(tn){console.error("Failed to trigger notification:",tn)}}try{const sr=ut.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),tn=`${window.location.origin}/articles=${sr}/${Dr}`;await fetch("/api/append-sitemap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:tn,title:ut,image:fh||""})})}catch(sr){console.warn("Silent sitemap write fail on publish:",sr)}const Ln=cn.match(/@([a-zA-Z0-9_\-]+)/g)||[],Ar=Array.from(new Set(Ln.map(sr=>sr.substring(1).toLowerCase())));for(const sr of Ar){const tn=X.find(Kr=>(Kr.username||ah(Kr)).toLowerCase()===sr);if(tn&&tn.id!==((ue=Ne.currentUser)==null?void 0:ue.uid)&&tn.uid!==((Ce=Ne.currentUser)==null?void 0:Ce.uid))try{await dn(nt(fe,"notifications"),{userId:tn.id||tn.uid,title:"📰 Admin mentioned you in an article",message:`You were mentioned in the story "${ut}": "${cn.substring(0,60)}..."`,used:!1,type:"mention",createdAt:zr()})}catch(Kr){console.warn("Art mention notify failed:",Kr)}}Re(!0),Tn()}catch(ut){Ie(ut.message||"Failed to publish article"),Gs(ut,Ps.WRITE,xi?`articles/${xi.id}`:"articles")}finally{Pt(!1)}}},Us=async O=>{var ue,Ce;if(O.preventDefault(),!!Ne.currentUser){if(Zr==="image"&&!Ro){he.error("Please upload or provide an image link for the advert");return}if(Zr==="video"&&!Xa){he.error("Please provide a video link for the motion advert");return}Pt(!0),Ie(null),Re(!1);try{const ut=Zr==="image"?Ro:"",Yt=new Date;Yt.setDate(Yt.getDate()+parseInt(Qa));const un={id:(await dn(nt(fe,"adverts"),{title:ra||"Sponsored Campaign",imageUrl:ut,videoUrl:Xa,type:Zr,link:Dn||"#",authorId:((ue=Ne.currentUser)==null?void 0:ue.uid)||"admin",createdAt:zr(),expiresAt:wn.fromDate(Yt),durationDays:parseInt(Qa),status:"active"})).id,title:ra||"Sponsored Campaign",imageUrl:ut,videoUrl:Xa,type:Zr,link:Dn||"#",authorId:((Ce=Ne.currentUser)==null?void 0:Ce.uid)||"admin",durationDays:parseInt(Qa),status:"active"};if(Dt(Yn=>[un,...Yn]),t)try{await fetch("/api/notify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:"New Sponsored Update",message:ra||"Check out this new update!",url:Dn||window.location.origin,imageUrl:ut||""})})}catch(Yn){console.error("Failed to trigger notification:",Yn)}Re(!0),Yo(""),po(""),ma(null),qf(""),it(""),Pi("image"),vl("7")}catch(ut){Ie(ut.message||"Failed to publish advert")}finally{Pt(!1)}}},Xm=async(O,ue)=>{if(t)try{await Ir(st(fe,"adverts",O),{status:ue==="active"?"hidden":"active"})}catch(Ce){Ie(Ce.message||"Failed to update advert status")}},vh=async O=>{if(O.preventDefault(),!!t){Pt(!0);try{const ue=Me.filter(Ce=>Ce.trim().length>0).map(Ce=>({text:Ce.trim(),votes:0}));if(ue.length<2)throw new Error("At least 2 options are required");if(Je==="active"){const Ce=Jt(nt(fe,"polls"),An("status","==","active")),ut=await vr(Ce);for(const Yt of ut.docs)await Ir(st(fe,"polls",Yt.id),{status:"closed"})}await dn(nt(fe,"polls"),{question:ge,options:ue,totalVotes:0,status:Je,expiresAt:null,createdAt:zr()}),he.success("Poll created successfully!"),we(""),Ke(["",""])}catch(ue){Ie(ue.message||"Failed to create poll"),he.error("Poll creation failed")}finally{Pt(!1)}}},hu=ie.useMemo(()=>Ct.filter(O=>{const ue=!!(O.taken||O.used);if(Kn==="unclaimed"&&ue||Kn==="taken"&&!ue)return!1;if(cs.trim()){const Ce=cs.trim().toLowerCase(),ut=(O.userName||"").toLowerCase().includes(Ce),Yt=(O.userEmail||"").toLowerCase().includes(Ce),cn=(O.ticketTitle||"").toLowerCase().includes(Ce),un=(O.id||"").toLowerCase().includes(Ce);return ut||Yt||cn||un}return!0}),[Ct,cs,Kn]),wh=async O=>{const ue=!(O.taken||O.used);try{await Ir(st(fe,"purchases",O.id),{taken:ue,used:ue}),ue?(await dn(nt(fe,"notifications"),{userId:O.userId,title:`✔️ Ticket Ticked & Used: ${O.ticketTitle}`,message:`Your event entry pass (ID #${O.id.slice(-6).toUpperCase()}) for "${O.ticketTitle}" has been officially marked as ticked and used by the administrators. Welcome to the event!`,used:!1,createdAt:new Date,type:"entrance_checkin",code:O.id}),he.success(`Ticket marked as used & ticked for ${O.userName}!`,{icon:"✔️"})):he.success(`Ticket for ${O.userName} is now reverted to active status.`)}catch(Ce){console.error("Failed to toggle purchase status:",Ce),he.error("Failed to update purchase code: "+Ce.message)}};return n?s.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen bg-white",children:[s.jsx(vn,{className:"animate-spin text-accent",size:32}),s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-[0.2em] mt-4",children:"Verifying editorial credentials..."})]}):s.jsxs("div",{className:"w-full min-h-screen bg-[#f8f9fa] transition-colors",children:[s.jsxs("div",{className:"fixed left-0 top-0 h-full w-20 bg-white border-r border-gray-100 z-40 hidden lg:flex flex-col items-center",children:[s.jsx("div",{className:"p-4 py-6 border-b border-gray-50 flex flex-col items-center justify-center w-full",children:s.jsx(ul,{className:"text-accent",size:24})}),s.jsxs("nav",{className:"flex-1 p-3 py-6 space-y-3 overflow-y-auto w-full flex flex-col items-center",children:[t&&s.jsx("button",{onClick:()=>o("dashboard"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="dashboard"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Dashboard",children:s.jsx(yp,{size:18})}),t&&s.jsx("button",{onClick:()=>o("article"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="article"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"New Article",children:s.jsx(Uc,{size:18})}),t&&s.jsx("button",{onClick:()=>o("manage-articles"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="manage-articles"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Articles",children:s.jsx(M0,{size:18})}),s.jsx("button",{onClick:()=>o("advert"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="advert"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Submit Advert",children:s.jsx(wu,{size:18})}),t&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>o("manage-ads"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="manage-ads"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Adverts",children:s.jsx(Eu,{size:18})}),s.jsx("button",{onClick:()=>o("users"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="users"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Users",children:s.jsx(ko,{size:18})}),s.jsxs("button",{onClick:()=>o("flagged-comments"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all relative shrink-0",a==="flagged-comments"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Flagged Comments",children:[s.jsx(Su,{size:18}),B.length>0&&s.jsx("span",{className:"absolute -top-1 -right-1 bg-red-600 text-white min-w-[15px] h-[15px] rounded-full text-[8px] font-black flex items-center justify-center px-0.5",children:B.length})]}),s.jsx("button",{onClick:()=>o("polls"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="polls"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Polls & Debates",children:s.jsx(FS,{size:18})}),s.jsx("button",{onClick:()=>o("pinned-board"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="pinned-board"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Pinned Board",children:s.jsx(j0,{size:18})}),s.jsx("button",{onClick:()=>o("manage-posts"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="manage-posts"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Lounge Posts",children:s.jsx(Ri,{size:18})}),s.jsx("button",{onClick:()=>o("custom-links"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="custom-links"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Global Menu Pages",children:s.jsx(wd,{size:18})}),s.jsx("button",{onClick:()=>o("manage-podcasts"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="manage-podcasts"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Audio Podcasts",children:s.jsx(mc,{size:18})}),s.jsxs("button",{onClick:()=>o("feedback-inbox"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all relative shrink-0",a==="feedback-inbox"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Feedback Inbox",children:[s.jsx(Xs,{size:18}),ht.length>0&&s.jsx("span",{className:"absolute -top-1 -right-1 bg-red-600 text-white min-w-[15px] h-[15px] rounded-full text-[8px] font-black flex items-center justify-center px-0.5",children:ht.length})]}),s.jsxs("div",{className:"pt-2 mt-2 border-t border-gray-100 w-full flex flex-col gap-3 items-center",children:[s.jsx("button",{onClick:()=>o("manage-tickets"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="manage-tickets"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Manage Events",children:s.jsx(Ea,{size:18})}),s.jsx("button",{onClick:()=>o("ticket-purchases"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0",a==="ticket-purchases"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Sales Records",children:s.jsx(qx,{size:18})}),((ld=(Nh=Ne.currentUser)==null?void 0:Nh.email)==null?void 0:ld.toLowerCase())==="atwiinevictor2@gmail.com"&&s.jsx("button",{onClick:()=>o("imgbb-settings"),className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0 mt-2",a==="imgbb-settings"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"API & Storage Settings (Top Admin Only)",children:s.jsx(VS,{size:18,className:"text-blue-500"})}),s.jsx("button",{onClick:()=>{o("seo-indexing"),Oe()},className:Ge("w-12 h-11 flex items-center justify-center rounded-xl transition-all shrink-0 mt-1",a==="seo-indexing"?"bg-accent text-white shadow-lg shadow-accent/20":"text-gray-500 hover:bg-gray-50"),title:"Google Search Console & SEO Push Engine",children:s.jsx(C0,{size:18,className:"text-emerald-500"})})]})]})]}),s.jsx("div",{className:"p-4 border-t border-gray-50 flex items-center justify-center w-full",children:s.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("setTab",{detail:"home"})),className:"w-12 h-12 flex items-center justify-center bg-gray-950 text-white rounded-xl hover:bg-black transition-all cursor-pointer",title:"Back to Site",children:s.jsx(Hp,{size:18})})})]}),yt&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 lg:hidden transition-opacity",onClick:()=>er(!1)}),s.jsxs("div",{className:Ge("fixed left-0 top-0 h-full w-64 bg-white border-r border-gray-100 z-50 lg:hidden flex flex-col transition-transform duration-300 shadow-2xl",yt?"translate-x-0":"-translate-x-full"),children:[s.jsxs("div",{className:"p-6 border-b border-gray-50 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(Ree,{className:"scale-[0.85] origin-left"}),s.jsx("p",{className:"text-[9px] font-black text-black uppercase tracking-[0.25em] mt-1",children:"Management Drawer"})]}),s.jsx("button",{onClick:()=>er(!1),className:"p-1.5 text-gray-405 hover:bg-gray-100 rounded-lg",children:s.jsx(Jr,{size:18})})]}),s.jsxs("nav",{className:"flex-1 p-5 overflow-y-auto space-y-1.5",children:[t&&s.jsxs("button",{onClick:()=>{o("dashboard"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="dashboard"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(yp,{size:16})," Dashboard"]}),t&&s.jsxs("button",{onClick:()=>{o("article"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="article"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(Uc,{size:16})," New Article"]}),t&&s.jsxs("button",{onClick:()=>{o("manage-articles"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="manage-articles"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(M0,{size:16})," Articles"]}),s.jsxs("button",{onClick:()=>{o("advert"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="advert"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(wu,{size:16})," Submit Advert"]}),t&&s.jsxs(s.Fragment,{children:[s.jsxs("button",{onClick:()=>{o("manage-ads"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="manage-ads"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(Eu,{size:16})," Adverts"]}),s.jsxs("button",{onClick:()=>{o("users"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="users"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(ko,{size:16})," Users"]}),((hs=(Fb=Ne.currentUser)==null?void 0:Fb.email)==null?void 0:hs.toLowerCase())==="atwiinevictor2@gmail.com"&&s.jsxs("button",{onClick:()=>{o("broadcast"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="broadcast"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(wu,{size:16,className:"text-amber-500"})," Broadcast Message"]}),s.jsxs("button",{onClick:()=>{o("flagged-comments"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="flagged-comments"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(Su,{size:16})," Flagged"]}),s.jsxs("button",{onClick:()=>{o("polls"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="polls"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(FS,{size:16})," Polls & Debates"]}),s.jsxs("button",{onClick:()=>{o("pinned-board"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="pinned-board"?"bg-accent text-white shadow shadow-accent/15":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(j0,{size:16})," Pinned Board"]}),s.jsxs("button",{onClick:()=>{o("manage-posts"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="manage-posts"?"bg-accent text-white shadow shadow-accent/15":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(Ri,{size:16})," Lounge Posts"]}),s.jsxs("button",{onClick:()=>{o("custom-links"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="custom-links"?"bg-accent text-white shadow shadow-accent/15":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(wd,{size:16})," Global Menu Pages"]}),s.jsxs("button",{onClick:()=>{o("manage-podcasts"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="manage-podcasts"?"bg-accent text-white shadow shadow-accent/15":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(mc,{size:16})," Audio Podcasts"]}),s.jsxs("button",{onClick:()=>{o("feedback-inbox"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all relative",a==="feedback-inbox"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(Xs,{size:16})," Feedback Inbox",ht.length>0&&s.jsx("span",{className:"absolute right-3 px-1.5 py-0.5 rounded-full text-[8px] font-black bg-red-600 text-white flex items-center justify-center",children:ht.length})]}),s.jsxs("button",{onClick:()=>{o("mega-ai-knowledge"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all relative",a==="mega-ai-knowledge"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(Xi,{size:16,className:"text-amber-500"})," Mega AI Knowledge",M.filter(O=>!O.used).length>0&&s.jsx("span",{className:"absolute right-3 px-1.5 py-0.5 rounded-full text-[8px] font-black bg-amber-500 text-white flex items-center justify-center",children:M.filter(O=>!O.used).length})]}),s.jsxs("div",{className:"pt-3 mt-3 border-t border-gray-50",children:[s.jsx("p",{className:"text-[8px] font-black text-gray-400 uppercase tracking-widest px-3 mb-1.5",children:"Ticketing"}),s.jsxs("button",{onClick:()=>{o("manage-tickets"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="manage-tickets"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(Ea,{size:16})," Manage Events"]}),s.jsxs("button",{onClick:()=>{o("ticket-purchases"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all",a==="ticket-purchases"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(qx,{size:16})," Sales Records"]}),((Zm=(Qm=Ne.currentUser)==null?void 0:Qm.email)==null?void 0:Zm.toLowerCase())==="atwiinevictor2@gmail.com"&&s.jsxs("button",{onClick:()=>{o("imgbb-settings"),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all mt-1",a==="imgbb-settings"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(VS,{size:16,className:"text-blue-500"})," API & Storage Settings"]}),s.jsxs("button",{onClick:()=>{o("seo-indexing"),Oe(),er(!1)},className:Ge("w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-all mt-1",a==="seo-indexing"?"bg-accent text-white shadow":"text-gray-500 hover:bg-gray-50"),children:[s.jsx(C0,{size:16,className:"text-emerald-500"})," Google Search Console & SEO Push"]})]})]})]}),s.jsx("div",{className:"p-6 border-t border-gray-50",children:s.jsxs("button",{onClick:()=>{er(!1),window.dispatchEvent(new CustomEvent("setTab",{detail:"home"}))},className:"w-full flex items-center justify-center gap-2 px-3 py-2.5 bg-gray-950 text-white text-[9px] font-black uppercase tracking-widest rounded-xl hover:bg-black transition-all",children:[s.jsx(Hp,{size:12})," Back to Site"]})})]}),s.jsxs("div",{className:"lg:pl-20 min-h-screen",children:[s.jsxs("header",{className:"sticky top-0 z-30 bg-white/80 backdrop-blur-md border-b border-gray-100 px-8 py-6 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("button",{onClick:()=>er(!0),className:"lg:hidden p-2 text-gray-500 hover:bg-gray-100 rounded-lg transition-all",title:"Open Navigation",children:s.jsx(tE,{size:20})}),s.jsx("h2",{className:"text-xl font-bold text-gray-900 tracking-tight capitalize",children:a.replace("-"," ")})]}),s.jsx("div",{className:"flex items-center gap-4",children:(vx=Ne.currentUser)!=null&&vx.photoURL?s.jsx("img",{src:(wx=Ne.currentUser)==null?void 0:wx.photoURL,className:"w-10 h-10 rounded-full object-cover shadow-lg border-2 border-accent/25 ring-2 ring-accent/10",alt:"",referrerPolicy:"no-referrer"}):s.jsx("div",{className:"w-10 h-10 rounded-full bg-accent flex items-center justify-center text-white font-bold text-sm shadow-lg shadow-accent/20",children:((Jm=($b=Ne.currentUser)==null?void 0:$b.displayName)==null?void 0:Jm[0])||"A"})})]}),s.jsxs("main",{className:"p-8 space-y-8",children:[Ae&&s.jsxs("div",{className:"mb-6 p-4 bg-blue-900/10 border-l-4 border-black text-black text-sm font-bold flex items-center justify-between",children:[Ae,s.jsx("button",{onClick:()=>Ie(null),children:s.jsx(Jr,{size:16})})]}),vt&&s.jsxs("div",{className:"mb-6 p-4 bg-green-900/20 border-l-4 border-green-600 text-green-400 text-sm font-bold flex items-center justify-between",children:[t?"Operation successful!":"Submitted for review!",s.jsx("button",{onClick:()=>Re(!1),children:s.jsx(Jr,{size:16})})]}),a==="dashboard"&&t?s.jsxs("div",{className:"space-y-8",children:[s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-4 gap-4 lg:gap-6",children:[{label:"Total Views",value:(Xn.totalViews||0).toLocaleString(),icon:Eu,color:"text-blue-600",bg:"bg-blue-50"},{label:"Total Likes",value:(Xn.totalLikes||0).toLocaleString(),icon:Fl,color:"text-red-500",bg:"bg-red-50"},{label:"Articles",value:(Xn.totalArticles||c.length).toString(),icon:M0,color:"text-gray-900",bg:"bg-gray-100"},{label:"Total Posts",value:(Xn.totalPosts||0).toString(),icon:Ri,color:"text-purple-600",bg:"bg-purple-50"},{label:"Total Comments",value:(Xn.totalComments||0).toLocaleString(),icon:Ri,color:"text-emerald-600",bg:"bg-emerald-50"},{label:"Active Ads",value:(Xn.activeAds||0).toString(),icon:wu,color:"text-amber-600",bg:"bg-amber-50"},{label:"Members",value:(Xn.totalUsers||X.length).toString(),icon:ko,color:"text-indigo-600",bg:"bg-indigo-50"},{label:"Flagged Items",value:(Xn.flaggedCount||0).toString(),icon:Su,color:"text-rose-600",bg:"bg-rose-50",onClick:()=>o("flagged-comments")}].map((O,ue)=>s.jsxs("div",{onClick:O.onClick,className:Ge("bg-white p-5 rounded-2xl border border-gray-100 shadow-sm flex items-center gap-4 transition-all hover:border-gray-200",O.onClick&&"cursor-pointer hover:shadow-md"),children:[s.jsx("div",{className:Ge("p-3 rounded-xl shrink-0",O.bg,O.color),children:s.jsx(O.icon,{size:20})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest mb-1",children:O.label}),s.jsx("p",{className:"text-xl font-black text-gray-900",children:O.value})]})]},ue))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"lg:col-span-2 bg-white p-10 rounded-[2.5rem] border border-gray-100 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsx("h3",{className:"text-lg font-sans font-extrabold uppercase tracking-tight text-gray-900",children:"Engagement Trends"}),s.jsxs("select",{className:"bg-gray-50 border border-gray-100 rounded-xl px-4 py-2 text-[10px] font-black uppercase tracking-widest text-gray-500 outline-none",children:[s.jsx("option",{children:"Last 7 Days"}),s.jsx("option",{children:"Last 30 Days"})]})]}),s.jsx("div",{className:"h-[300px] w-full relative overflow-hidden",children:s.jsx(tke,{width:"100%",height:"100%",children:s.jsxs(IMe,{data:Xn.viewsByDay,children:[s.jsxs("defs",{children:[s.jsxs("linearGradient",{id:"colorVisitors",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"5%",stopColor:"#4F46E5",stopOpacity:.25}),s.jsx("stop",{offset:"95%",stopColor:"#4F46E5",stopOpacity:0})]}),s.jsxs("linearGradient",{id:"colorEngagement",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"5%",stopColor:"#EF4444",stopOpacity:.15}),s.jsx("stop",{offset:"95%",stopColor:"#EF4444",stopOpacity:0})]})]}),s.jsx(KJ,{strokeDasharray:"3 3",vertical:!1,stroke:"#f3f4f6"}),s.jsx(yee,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fontSize:9,fontWeight:900,fill:"#9ca3af"},dy:10}),s.jsx(bee,{axisLine:!1,tickLine:!1,tick:{fontSize:9,fontWeight:900,fill:"#9ca3af"}}),s.jsx(V3e,{contentStyle:{borderRadius:"1.25rem",border:"1px solid #f3f4f6",boxShadow:"0 20px 25px -5px rgb(0 0 0 / 0.05)",padding:"1.25rem"},labelStyle:{fontWeight:900,marginBottom:"0.5rem",textTransform:"uppercase",fontSize:"10px",color:"#111827"}}),s.jsx(FX,{verticalAlign:"top",height:36,iconType:"circle",wrapperStyle:{fontSize:"10px",fontWeight:900,textTransform:"uppercase",letterSpacing:"0.05em"}}),s.jsx(lI,{name:"Daily Active Visitors",type:"monotone",dataKey:"visitors",stroke:"#4F46E5",strokeWidth:3,fillOpacity:1,fill:"url(#colorVisitors)"}),s.jsx(lI,{name:"Interactive Engagement",type:"monotone",dataKey:"engagement",stroke:"#EF4444",strokeWidth:2,fillOpacity:1,fill:"url(#colorEngagement)"}),s.jsx(gee,{name:"Lounge Dispatches",dataKey:"posts",barSize:12,fill:"#8B5CF6",radius:[4,4,0,0]}),s.jsx(iee,{name:"Ticket Sales Run",type:"monotone",dataKey:"tickets",stroke:"#10B981",strokeWidth:2.5,dot:{r:3,strokeWidth:2}})]})})})]}),s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"bg-gray-900 p-10 rounded-[2.5rem] shadow-xl shadow-gray-200/50",children:[s.jsx("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-white mb-6",children:"Quick Actions"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("button",{onClick:()=>o("article"),className:"flex flex-col items-center justify-center p-4 bg-white/5 hover:bg-white/10 rounded-2xl transition-all group",children:[s.jsx("div",{className:"w-10 h-10 bg-accent rounded-xl flex items-center justify-center text-white mb-3 group-hover:scale-110 transition-transform",children:s.jsx(Uc,{size:20})}),s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-white",children:"New Article"})]}),s.jsxs("button",{onClick:()=>o("advert"),className:"flex flex-col items-center justify-center p-4 bg-white/5 hover:bg-white/10 rounded-2xl transition-all group",children:[s.jsx("div",{className:"w-10 h-10 bg-blue-600 rounded-xl flex items-center justify-center text-white mb-3 group-hover:scale-110 transition-transform",children:s.jsx(Eu,{size:20})}),s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-white",children:"New Ad"})]}),s.jsxs("button",{onClick:async()=>{try{const ue=await(await fetch("/api/notify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:"Test Notification",message:"Push notifications are working!",url:window.location.origin})})).json();ue.id?he.success("Notification Sent!"):he.error("Failed: "+(ue.message||"Check console"))}catch{he.error("Network Error")}},className:"flex flex-col items-center justify-center p-4 bg-white/5 hover:bg-white/10 rounded-2xl transition-all group",children:[s.jsx("div",{className:"w-10 h-10 bg-orange-600 rounded-xl flex items-center justify-center text-white mb-3 group-hover:scale-110 transition-transform",children:s.jsx(Ru,{size:20})}),s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-white",children:"Test Push"})]})]})]}),s.jsxs("div",{className:"bg-white p-10 rounded-[2.5rem] border border-gray-100 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsx("h3",{className:"text-lg font-sans font-extrabold uppercase tracking-tight text-gray-900",children:"Recent Activity"}),s.jsx("button",{className:"text-[10px] font-black uppercase tracking-widest text-accent hover:underline",children:"View All"})]}),s.jsx("div",{className:"space-y-6",children:c.slice(0,5).map(O=>s.jsxs("div",{className:"flex items-center gap-4 group cursor-pointer",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl overflow-hidden bg-gray-100 flex-shrink-0",children:s.jsx("img",{src:O.featuredImageUrl||void 0,alt:"",className:"w-full h-full object-cover group-hover:scale-110 transition-transform"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-[10px] font-black text-accent uppercase tracking-widest mb-0.5",children:O.category}),s.jsx("h4",{className:"text-sm font-bold text-gray-900 truncate group-hover:text-accent transition-colors",children:O.title}),s.jsxs("p",{className:"text-[10px] text-gray-400 font-medium",children:["Published ",O.publishDate instanceof wn?O.publishDate.toDate().toLocaleDateString():"Recently"]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-xs font-black text-gray-900",children:O.viewCount||0}),s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Views"})]})]},O.id))})]})]})]})]}):a==="article"&&t?s.jsxs("div",{className:"max-w-6xl mx-auto space-y-8",children:[s.jsxs("div",{className:"flex items-center justify-between bg-white p-6 rounded-3xl border border-gray-100 shadow-sm",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-black uppercase italic tracking-tight text-gray-900",children:xi?"Edit Article":"Create New Article"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-1",children:xi?"Update existing story":"Draft a new campus story"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("button",{onClick:()=>lx(!nu),className:Ge("flex items-center gap-2 px-4 py-2 rounded-xl text-[10px] font-black uppercase tracking-widest transition-all",nu?"bg-accent text-white shadow-lg shadow-accent/20":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[nu?s.jsx(Ed,{size:14}):s.jsx(R1,{size:14}),nu?"Edit Mode":"Preview Mode"]}),xi&&s.jsx("button",{onClick:()=>{Om(null),gi(""),Ds(""),Ya(""),Oa([]),ds(""),wi("")},className:"text-[10px] font-black text-gray-400 uppercase tracking-widest hover:text-accent transition-all",children:"Cancel Editing"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsx("div",{className:Ge("bg-white p-10 rounded-[2.5rem] border border-gray-100 shadow-sm space-y-8",nu?"hidden lg:block":"block"),children:s.jsxs("form",{onSubmit:Li,className:"space-y-8",children:[s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-end mb-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Article Title"}),s.jsxs("span",{className:Ge("text-[10px] font-bold tracking-widest",us.length>90?"text-accent":"text-gray-400"),children:[us.length,"/100"]})]}),s.jsx("input",{type:"text",value:us,onChange:O=>gi(O.target.value.slice(0,100)),className:"w-full p-4 bg-gray-50 border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-bold rounded-xl",placeholder:"Enter headline..."})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Category"}),s.jsx("button",{type:"button",onClick:()=>Ka(!bs),className:"text-[9px] font-black text-accent uppercase tracking-widest hover:underline",children:bs?"Cancel":"+ Add New"})]}),bs?s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:Ss,onChange:O=>Po(O.target.value),className:"flex-1 p-4 bg-gray-50 border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 rounded-xl",placeholder:"New category..."}),s.jsx("button",{type:"button",onClick:tc,disabled:jt||!Ss.trim(),className:"px-4 bg-accent text-white font-black uppercase tracking-widest text-[10px] hover:bg-accent-700 transition-all disabled:opacity-50 rounded-xl",children:"Add"})]}):s.jsx("select",{value:fa,onChange:O=>pa(O.target.value),className:"w-full p-4 bg-gray-50 border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none appearance-none text-gray-900 font-bold rounded-xl",children:Sn.map(O=>s.jsx("option",{value:O,children:O},O))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Author / Desk Dropdown"}),s.jsxs("select",{value:["Campus Eye Desk","Guild Media Team","Victor Atwiine","Chief Editor","Campus Reporter","Sports Desk","Student Affairs"].includes(Cc)?Cc:"Custom",onChange:O=>{O.target.value!=="Custom"&&kl(O.target.value)},className:"w-full p-4 bg-gray-50 border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none appearance-none text-gray-900 font-bold rounded-xl cursor-pointer",children:[s.jsx("option",{value:"Campus Eye Desk",children:"Campus Eye Desk"}),s.jsx("option",{value:"Guild Media Team",children:"Guild Media Team"}),s.jsx("option",{value:"Victor Atwiine",children:"Victor Atwiine"}),s.jsx("option",{value:"Chief Editor",children:"Chief Editor"}),s.jsx("option",{value:"Campus Reporter",children:"Campus Reporter"}),s.jsx("option",{value:"Sports Desk",children:"Sports Desk"}),s.jsx("option",{value:"Student Affairs",children:"Student Affairs"}),s.jsx("option",{value:"Custom",children:"Custom Author Name (Enter below)..."})]}),s.jsx("input",{type:"text",value:Cc,onChange:O=>kl(O.target.value),className:"w-full p-3 bg-gray-50 border border-gray-100 text-xs focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-medium rounded-xl",placeholder:"e.g. Victor Atwiine, Guild Press..."})]})]}),s.jsxs("div",{className:"flex items-center gap-3 bg-amber-500/10 p-4 border border-amber-500/25 rounded-2xl",children:[s.jsx("input",{type:"checkbox",id:"is-sponsored-ad",checked:fo,onChange:O=>Ko(O.target.checked),className:"w-4 h-4 text-amber-500 border-gray-300 rounded focus:ring-amber-500 checked:bg-amber-500 cursor-pointer"}),s.jsx("label",{htmlFor:"is-sponsored-ad",className:"text-xs font-black text-amber-700 uppercase tracking-wider cursor-pointer select-none",children:"📢 Mark as Sponsored Ad (Enables premium yellow borders & highlights)"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-end mb-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Summary"}),s.jsxs("span",{className:Ge("text-[10px] font-bold tracking-widest",vs.length>230?"text-accent":"text-gray-400"),children:[vs.length,"/250"]})]}),s.jsx("textarea",{value:vs,onChange:O=>Ds(O.target.value.slice(0,250)),className:"w-full p-4 bg-gray-50 border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none h-24 resize-none text-gray-900 font-medium rounded-xl",placeholder:"Brief overview..."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Content (Markdown supported)"}),s.jsx("textarea",{value:Rr||"",onChange:MA,className:"w-full p-4 bg-gray-50 border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none h-96 resize-none text-gray-900 font-mono rounded-xl",placeholder:"The full story..."}),Qr!==null&&rd.length>0&&s.jsxs("div",{className:"bg-white border border-gray-150 rounded-xl shadow-lg p-1 max-h-48 overflow-y-auto mb-2 space-y-0.5 divide-y divide-gray-50 z-50",children:[s.jsx("div",{className:"px-3 py-1 text-[9px] font-black uppercase text-gray-400 tracking-wider",children:"Mention a Peer in Article Content"}),rd.map(O=>{const ue=O.username||ah(O);return s.jsxs("button",{type:"button",onClick:()=>{const Ce=Rr.substring(0,Pa-Qr.length-1),ut=Rr.substring(Pa),Yt=`${Ce}@${ue} ${ut}`;Ya(Yt),Rn(null)},className:"w-full text-left flex items-center gap-2 px-3 py-1.5 hover:bg-neutral-50 rounded-lg transition-colors cursor-pointer",children:[s.jsx("img",{src:O.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(O.displayName||"Peer")}&background=random`,className:"w-6 h-6 rounded-full border border-gray-100 object-cover",alt:""}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-[11px] font-extrabold text-gray-955 truncate",children:O.displayName||"Peer"}),s.jsxs("p",{className:"text-[9px] font-mono font-bold text-blue-600 truncate",children:["@",ue]})]})]},O.id)})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"External Link URL"}),s.jsx("input",{type:"url",value:ta,onChange:O=>wi(O.target.value),className:"w-full p-4 bg-gray-50 border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-medium rounded-xl",placeholder:"e.g. https://forms.gle/..."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Link Button Label (Display Text)"}),s.jsxs("select",{value:["Discover More","Apply Now","Register Here","Read Full Story","Visit Portal","Book Pass","Download Document","Learn More"].includes(Cs)?Cs:"Custom",onChange:O=>{O.target.value!=="Custom"&&ui(O.target.value)},className:"w-full p-4 bg-gray-50 border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none appearance-none text-gray-900 font-bold rounded-xl cursor-pointer mb-1.5",children:[s.jsx("option",{value:"Discover More",children:"Discover More"}),s.jsx("option",{value:"Apply Now",children:"Apply Now"}),s.jsx("option",{value:"Register Here",children:"Register Here"}),s.jsx("option",{value:"Read Full Story",children:"Read Full Story"}),s.jsx("option",{value:"Visit Portal",children:"Visit Portal"}),s.jsx("option",{value:"Book Pass",children:"Book Pass"}),s.jsx("option",{value:"Download Document",children:"Download Document"}),s.jsx("option",{value:"Learn More",children:"Learn More"}),s.jsx("option",{value:"Custom",children:"Custom Label (Enter below)..."})]}),s.jsx("input",{type:"text",value:Cs,onChange:O=>ui(O.target.value),className:"w-full p-3 bg-gray-50 border border-gray-100 text-xs focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-medium rounded-xl",placeholder:"Type custom button text..."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Video Embed/URL (Optional)"}),s.jsx("input",{type:"url",value:Ra,onChange:O=>ds(O.target.value),className:"w-full p-4 bg-gray-50 border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-medium rounded-xl",placeholder:"e.g. https://youtube.com/..."})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("label",{className:"text-xs font-black text-gray-405 uppercase tracking-widest block",children:"Article Images (Direct Upload & Link-saving)"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[{label:"Cover Image / Primary",state:fh,setState:Dm,loading:Wm,setLoading:od},{label:"Optional Second Image",state:hx,setState:Mm,loading:Gf,setLoading:Bb},{label:"Optional Third Image",state:ws,setState:ph,loading:zb,setLoading:yh}].map((O,ue)=>s.jsxs("div",{className:"bg-gray-50 border border-gray-100 p-4 rounded-2xl flex flex-col justify-between space-y-3",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 block mb-2",children:O.label}),O.state?s.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden border border-gray-100 bg-white group mb-3 shadow-inner",children:[s.jsx("img",{src:O.state,className:"w-full h-full object-cover transition-transform group-hover:scale-105",alt:"",referrerPolicy:"no-referrer"}),s.jsx("button",{type:"button",onClick:()=>O.setState(""),className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center text-white",title:"Remove image",children:s.jsx(Jr,{size:20,className:"stroke-[3px]"})})]}):s.jsxs("label",{className:"flex flex-col items-center justify-center aspect-video rounded-xl border-2 border-dashed border-gray-200 cursor-pointer hover:border-accent hover:bg-white transition-all mb-3 text-gray-400 hover:text-accent",children:[O.loading?s.jsx(vn,{className:"animate-spin text-accent",size:24}):s.jsxs(s.Fragment,{children:[s.jsx(Uc,{size:24,className:"stroke-[3px]"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest mt-1",children:"Upload JPEG/PNG"})]}),s.jsx("input",{type:"file",accept:"image/*",className:"hidden",disabled:O.loading,onChange:Ce=>{var Yt;const ut=(Yt=Ce.target.files)==null?void 0:Yt[0];ut&&ia(ut,O.setState,O.setLoading)}})]})]}),s.jsx("input",{type:"text",value:O.state,onChange:Ce=>O.setState(Ce.target.value),placeholder:"Or paste asset link directly...",className:"w-full px-3 py-2 bg-white border border-gray-100 text-[10px] text-gray-700 font-mono rounded-lg outline-none focus:border-accent"})]},ue))})]})]}),s.jsxs("div",{className:"border-t border-gray-150 pt-8 mt-8 space-y-6",children:[s.jsxs("h4",{className:"text-xs font-black uppercase tracking-wider text-red-600 flex items-center gap-2",children:[s.jsx(ul,{size:16}),s.jsx("span",{children:"Advanced Fields & Analytics (Admin Control)"})]}),s.jsx("p",{className:"text-[10px] text-gray-400 font-semibold uppercase tracking-wider -mt-4",children:"Directly override any metadata, counts, author info, or status."}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 bg-gray-50/50 p-6 border border-gray-100/80 rounded-2xl text-left",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Author Name (Select or Type)"}),s.jsxs("div",{className:"flex gap-2",children:[X&&X.length>0&&s.jsxs("select",{onChange:O=>{if(O.target.value){kl(O.target.value);const ue=X.find(Ce=>(Ce.displayName||Ce.email)===O.target.value);ue&&ue.photoURL&&rc(ue.photoURL)}},className:"p-3 bg-white border border-gray-100 text-xs font-bold rounded-xl outline-none text-gray-800",children:[s.jsx("option",{value:"",children:"Select Author..."}),X.map(O=>s.jsx("option",{value:O.displayName||O.email||"User",children:O.displayName||O.email||"User"},O.id))]}),s.jsx("input",{type:"text",value:Cc,onChange:O=>kl(O.target.value),className:"flex-1 p-3 bg-white border border-gray-100 text-xs focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-bold rounded-xl",placeholder:"Reporter / Team name"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Author Profile Photo URL"}),s.jsx("input",{type:"text",value:Lm,onChange:O=>rc(O.target.value),className:"w-full p-3 bg-white border border-gray-100 text-xs focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-medium rounded-xl",placeholder:"Avatar image URL"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 bg-gray-50/50 p-6 border border-gray-100/80 rounded-2xl text-left",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"CTA Action Button Text"}),s.jsx("input",{type:"text",value:Cs,onChange:O=>ui(O.target.value),placeholder:"Discover More",className:"w-full p-3 bg-white border border-gray-100 text-xs focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-bold rounded-xl"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"CTA Action Target URL (Optional)"}),s.jsx("input",{type:"url",value:ho,onChange:O=>Ql(O.target.value),placeholder:"https://... (Leave blank for standard view)",className:"w-full p-3 bg-white border border-gray-100 text-xs focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-bold rounded-xl"})]})]}),s.jsxs("div",{className:"bg-gray-50/50 p-6 border border-gray-100/80 rounded-2xl space-y-4 text-left",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block",children:"Engagement Counts Override"}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:"Views"}),s.jsx("input",{type:"number",value:fx,onChange:O=>px(Number(O.target.value)),className:"w-full p-3 bg-white border border-gray-100 text-xs text-gray-900 font-black rounded-xl text-center"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:"Likes"}),s.jsx("input",{type:"number",value:mx,onChange:O=>jc(Number(O.target.value)),className:"w-full p-3 bg-white border border-gray-100 text-xs text-gray-900 font-black rounded-xl text-center"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:"Comments"}),s.jsx("input",{type:"number",value:Bm,onChange:O=>mh(Number(O.target.value)),className:"w-full p-3 bg-white border border-gray-100 text-xs text-gray-900 font-black rounded-xl text-center"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:"Saves"}),s.jsx("input",{type:"number",value:gx,onChange:O=>cu(Number(O.target.value)),className:"w-full p-3 bg-white border border-gray-100 text-xs text-gray-900 font-black rounded-xl text-center"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:"Shares"}),s.jsx("input",{type:"number",value:zm,onChange:O=>gh(Number(O.target.value)),className:"w-full p-3 bg-white border border-gray-100 text-xs text-gray-900 font-black rounded-xl text-center"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 bg-gray-50/50 p-6 border border-gray-100/80 rounded-2xl text-left",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Publish Status"}),s.jsxs("select",{value:$f,onChange:O=>Vm(O.target.value),className:"w-full p-4 bg-white border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-bold rounded-xl",children:[s.jsx("option",{value:"published",children:"Published"}),s.jsx("option",{value:"draft",children:"Draft"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Publish Date/Time"}),s.jsx("input",{type:"datetime-local",value:lu,onChange:O=>Um(O.target.value),className:"w-full p-4 bg-white border border-gray-100 text-sm focus:ring-2 focus:ring-accent/20 transition-all outline-none text-gray-900 font-bold rounded-xl"}),s.jsx("p",{className:"text-[9px] text-gray-400 font-medium",children:"Leave blank to use current time or preserve original date."})]})]}),s.jsxs("div",{className:"bg-gray-50/50 p-6 border border-gray-100/80 rounded-2xl space-y-4 text-left",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block",children:"Manual Image URL Overrides (Alternative to upload)"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:"Featured Image URL (Primary)"}),s.jsx("input",{type:"text",value:fh,onChange:O=>Dm(O.target.value),className:"w-full p-3 bg-white border border-gray-100 text-xs text-gray-905 w-full rounded-xl",placeholder:"Paste primary image web URL"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:"Second Image URL"}),s.jsx("input",{type:"text",value:hx,onChange:O=>Mm(O.target.value),className:"w-full p-3 bg-white border border-gray-100 text-xs text-gray-905 w-full rounded-xl",placeholder:"Paste second image web URL"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:"Third Image URL"}),s.jsx("input",{type:"text",value:ws,onChange:O=>ph(O.target.value),className:"w-full p-3 bg-white border border-gray-100 text-xs text-gray-905 w-full rounded-xl",placeholder:"Paste third image web URL"})]})]})]})]}),s.jsxs("button",{type:"submit",disabled:jt,className:"w-full py-5 bg-accent text-white font-black uppercase tracking-widest hover:bg-accent-700 transition-all disabled:opacity-50 flex items-center justify-center gap-2 shadow-xl shadow-accent/20 rounded-2xl text-[11px]",children:[jt?s.jsx(vn,{className:"animate-spin"}):xi?s.jsx(iR,{size:18}):s.jsx(Eo,{size:18}),jt?xi?"Updating...":"Publishing...":xi?"Update Article":"Publish Article"]})]})}),s.jsxs("div",{className:Ge("bg-white p-10 rounded-[2.5rem] border border-gray-100 shadow-sm space-y-8 overflow-y-auto max-h-[1000px] custom-scrollbar",nu?"block lg:block":"hidden lg:block"),children:[s.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[s.jsx(R1,{size:16,className:"text-accent"}),s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Live Preview"})]}),s.jsxs("div",{className:"prose prose-blue max-w-none",children:[yl.length>0?s.jsx("img",{src:URL.createObjectURL(yl[0]),alt:"Preview",className:"w-full aspect-video object-cover rounded-3xl mb-8 shadow-xl"}):xi!=null&&xi.featuredImageUrl?s.jsx("img",{src:xi.featuredImageUrl,alt:"Preview",className:"w-full aspect-video object-cover rounded-3xl mb-8 shadow-xl"}):s.jsxs("div",{className:"w-full aspect-video bg-gray-50 rounded-3xl mb-8 flex flex-col items-center justify-center text-gray-300 border-2 border-dashed border-gray-100",children:[s.jsx(yu,{size:48}),s.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest mt-4",children:"No image uploaded"})]}),s.jsxs("div",{className:"space-y-4 mb-8",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"px-3 py-1 bg-accent text-white text-[10px] font-black uppercase tracking-widest rounded-full",children:fa}),s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:new Date().toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})})]}),s.jsx("h1",{className:"text-4xl font-sans font-black uppercase tracking-tight leading-[0.9] text-gray-900",children:us||"Your Headline Here"}),s.jsx("p",{className:"text-lg font-sans text-gray-500 leading-relaxed border-l-4 border-accent pl-6",children:vs||"The summary will appear here..."})]}),s.jsx("div",{className:"markdown-body text-gray-700 leading-relaxed font-sans text-base",children:s.jsx(J1,{children:Rr||"*Start writing your story to see the preview...*"})})]})]})]})]}):a==="manage-articles"&&t?s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6 bg-white p-6 rounded-3xl border border-gray-100 shadow-sm",children:[s.jsx("div",{className:"relative flex-1 max-w-2xl group",children:s.jsxs("div",{className:"flex items-center bg-gray-50 hover:bg-gray-100 focus-within:bg-white focus-within:ring-2 focus-within:ring-accent/20 border-2 border-transparent focus-within:border-accent transition-all px-6 py-3 rounded-2xl",children:[s.jsx(Tp,{size:20,className:"text-gray-400 group-focus-within:text-accent transition-colors"}),s.jsx("input",{type:"text",placeholder:"Search articles by title, category, or author...",value:ch,onChange:O=>na(O.target.value),className:"bg-transparent border-none outline-none pl-4 text-sm font-bold text-gray-900 w-full placeholder-gray-400"}),ch&&s.jsx("button",{onClick:()=>na(""),className:"p-1 text-gray-400 hover:text-accent transition-colors",children:s.jsx(Jr,{size:18})})]})}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"flex bg-gray-100 p-1 rounded-xl",children:["all","published","draft"].map(O=>s.jsx("button",{onClick:()=>Qn(O),className:`px-4 py-2 rounded-lg text-[10px] font-black uppercase tracking-widest transition-all ${Vi===O?"bg-white text-accent shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:O},O))}),s.jsxs("button",{onClick:()=>o("article"),className:"flex items-center gap-2 bg-black text-white px-6 py-3 rounded-2xl font-black uppercase tracking-widest text-[10px] hover:bg-accent transition-all shadow-lg shadow-black/10",children:[s.jsx(Uc,{size:16})," New Article"]})]})]}),s.jsx("div",{className:"grid grid-cols-1 gap-6",children:c.filter(O=>{const ue=O.title.toLowerCase().includes(ch.toLowerCase())||O.category.toLowerCase().includes(ch.toLowerCase())||O.authorName.toLowerCase().includes(ch.toLowerCase()),Ce=Vi==="all"||O.status===Vi;return ue&&Ce}).map(O=>{const ue=iu===O.id,Ce=cx===O.id;return s.jsxs("div",{className:Ge("bg-white rounded-[2rem] border overflow-hidden transition-all duration-300 shadow-sm hover:shadow-md",ue?"border-accent/30 ring-4 ring-accent/5 animate-fadeIn":"border-gray-100 hover:border-gray-200"),children:[s.jsxs("div",{onClick:()=>el(ue?null:O.id),className:"p-6 flex flex-col md:flex-row items-start md:items-center gap-6 cursor-pointer select-none",children:[s.jsxs("div",{className:"w-full md:w-40 aspect-video rounded-2xl overflow-hidden bg-gray-100 flex-shrink-0 relative group",children:[s.jsx("img",{src:O.featuredImageUrl||void 0,alt:"",className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),O.status==="draft"&&s.jsx("div",{className:"absolute top-2 left-2 bg-amber-500 text-white font-black uppercase text-[8px] tracking-widest px-2 py-0.5 rounded shadow-sm",children:"Draft"})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[s.jsx("span",{className:"px-2.5 py-0.5 bg-blue-50 text-accent text-[9px] font-black uppercase tracking-widest rounded-lg",children:O.category}),s.jsx("span",{className:Ge("px-2.5 py-0.5 text-[9px] font-black uppercase tracking-widest rounded-lg border",O.status==="draft"?"bg-amber-50 text-amber-600 border-amber-100":"bg-emerald-50 text-emerald-600 border-emerald-100"),children:O.status||"published"}),s.jsxs("span",{className:"text-[10px] font-bold text-gray-400 flex items-center gap-1",children:[s.jsx(vw,{size:10}),O.publishDate instanceof wn?O.publishDate.toDate().toLocaleDateString():"Just now"]})]}),s.jsx("h4",{className:"text-base sm:text-lg font-black text-gray-900 uppercase tracking-tight line-clamp-2 md:line-clamp-1",children:O.title}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4 mt-3",children:[s.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-black text-gray-400 uppercase tracking-widest flex items-center gap-1",children:[s.jsx(Eu,{size:12,className:"text-accent"}),O.viewCount||0," Views"]}),s.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-black text-gray-400 uppercase tracking-widest flex items-center gap-1",children:[s.jsx(Rl,{size:12,className:"text-green-500"}),O.likeCount||0," Likes"]}),s.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-black text-[#9c0dec] uppercase tracking-widest flex items-center gap-1",children:[s.jsx(Ri,{size:12}),O.commentCount||0," Comments"]})]})]}),s.jsx("div",{className:"self-end md:self-center flex items-center gap-2 mt-4 md:mt-0",children:s.jsx("div",{className:"p-2.5 rounded-full bg-gray-50 text-gray-400 hover:text-accent hover:bg-blue-50 transition-colors",children:ue?s.jsx(gf,{size:20}):s.jsx(Md,{size:20})})})]}),ue&&s.jsxs("div",{className:"px-6 pb-6 border-t border-gray-50 bg-gray-50/25 space-y-5",children:[s.jsxs("div",{className:"pt-5 flex flex-wrap items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[O.authorProfile?s.jsx("img",{src:O.authorProfile,alt:O.authorName,className:"w-8 h-8 rounded-full object-cover ring-2 ring-gray-100"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-accent/10 text-accent flex items-center justify-center font-black text-xs uppercase",children:O.authorName?O.authorName.charAt(0):"A"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase tracking-tight",children:O.authorName||"Anonymous"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:"Reporter / Author"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 bg-white px-4 py-2 rounded-2xl border border-gray-100 shadow-xs",children:[s.jsxs("div",{className:"text-center px-2",children:[s.jsx("p",{className:"text-xs font-black text-gray-900",children:O.saveCount||0}),s.jsx("p",{className:"text-[8px] font-black text-gray-400 uppercase tracking-widest",children:"Saves"})]}),s.jsx("div",{className:"w-[1px] h-6 bg-gray-150"}),s.jsxs("div",{className:"text-center px-2",children:[s.jsx("p",{className:"text-xs font-black text-gray-900",children:O.shareCount||0}),s.jsx("p",{className:"text-[8px] font-black text-gray-400 uppercase tracking-widest",children:"Shares"})]})]})]}),O.summary&&s.jsxs("div",{className:"bg-yellow-50/45 border-l-4 border-accent p-4 rounded-r-2xl",children:[s.jsx("p",{className:"text-[9px] font-black text-accent uppercase tracking-widest mb-1",children:"Dispatch Summary"}),s.jsxs("p",{className:"text-xs font-bold text-gray-600 leading-relaxed italic",children:['"',O.summary,'"']})]}),s.jsxs("div",{className:"space-y-3 bg-white p-5 rounded-2xl border border-gray-100 shadow-xs",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Story Content Preview"}),s.jsx("button",{onClick:ut=>{ut.stopPropagation(),su(Ce?null:O.id)},className:"text-[10px] bg-gray-50 hover:bg-accent hover:text-white text-gray-600 font-black uppercase tracking-widest px-3 py-1.5 rounded-xl border border-gray-100 transition-all flex items-center gap-1",children:Ce?"View Less Text":"View Full Text (All)"})]}),s.jsxs("div",{className:Ge("markdown-body text-sm leading-relaxed text-gray-750 overflow-hidden transition-all duration-300 relative",Ce?"max-h-none":"max-h-24"),children:[s.jsx(J1,{children:O.content||"*No written content in this article.*"}),!Ce&&O.content&&O.content.length>150&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-white to-transparent pointer-events-none"})]})]}),(O.featuredImageUrl1||O.featuredImageUrl2||O.video||O.Links)&&s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(O.featuredImageUrl1||O.featuredImageUrl2)&&s.jsxs("div",{className:"bg-white p-4 rounded-2xl border border-gray-100 space-y-2",children:[s.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Gallery Media Uploads"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[O.featuredImageUrl1&&s.jsx("div",{className:"aspect-video rounded-xl overflow-hidden bg-gray-50 border border-gray-100",children:s.jsx("img",{src:O.featuredImageUrl1,alt:"",className:"w-full h-full object-cover"})}),O.featuredImageUrl2&&s.jsx("div",{className:"aspect-video rounded-xl overflow-hidden bg-gray-50 border border-gray-100",children:s.jsx("img",{src:O.featuredImageUrl2,alt:"",className:"w-full h-full object-cover"})})]})]}),(O.video||O.Links)&&s.jsxs("div",{className:"bg-white p-4 rounded-2xl border border-gray-100 space-y-2",children:[s.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest block mb-1 text-[#9c0dec]",children:"Attached Links & Video"}),s.jsxs("div",{className:"space-y-1.5 text-xs font-semibold text-gray-600",children:[O.video&&s.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[s.jsx(Na,{size:12,className:"text-red-500"}),s.jsx("span",{className:"text-[10px] font-black text-gray-400 uppercase tracking-wider",children:"Video:"}),s.jsx("a",{href:O.video,target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent underline truncate",children:O.video})]}),O.Links&&s.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[s.jsx(wd,{size:12,className:"text-blue-500"}),s.jsx("span",{className:"text-[10px] font-black text-gray-400 uppercase tracking-wider",children:"Resources:"}),s.jsx("a",{href:O.Links,target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent underline truncate",children:O.Links})]})]})]})]}),s.jsxs("div",{className:"pt-4 flex items-center justify-end gap-3 border-t border-gray-100",children:[s.jsxs("button",{onClick:ut=>{ut.stopPropagation(),Pc(O)},className:"flex items-center gap-2 px-5 py-2.5 bg-accent hover:bg-opacity-95 text-white rounded-xl font-black uppercase tracking-widest text-[10px] transition-all shadow-md shadow-accent/15 hover:-translate-y-0.5",children:[s.jsx(Ed,{size:14})," Edit Mode"]}),s.jsxs("button",{onClick:ut=>{ut.stopPropagation(),ru(O.id)},className:"flex items-center gap-2 px-5 py-2.5 bg-red-50 text-red-600 hover:bg-red-600 hover:text-white rounded-xl font-black uppercase tracking-widest text-[10px] transition-all",children:[s.jsx(Es,{size:14})," Delete"]})]})]})]},O.id)})})]}):a==="advert"?s.jsxs("div",{className:"max-w-2xl mx-auto bg-white p-10 rounded-[2.5rem] border border-gray-100 shadow-sm",children:[s.jsxs("div",{className:"text-center mb-10",children:[s.jsx("h3",{className:"text-2xl font-sans font-extrabold uppercase tracking-tight text-gray-900",children:"Promote Your Brand"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-[0.3em] mt-2",children:"Reach thousands of campus citizens daily"})]}),s.jsxs("form",{onSubmit:Us,className:"space-y-8",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Campaign Title"}),s.jsx("input",{type:"text",required:!0,value:ra,onChange:O=>Yo(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold text-gray-900 focus:bg-white focus:ring-4 focus:ring-accent/10 focus:border-accent transition-all",placeholder:"e.g. Summer Festival 2024"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Advert Type"}),s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("button",{type:"button",onClick:()=>Pi("image"),className:Ge("flex-1 py-4 rounded-2xl border text-[10px] font-black uppercase tracking-widest transition-all gap-2 flex items-center justify-center",Zr==="image"?"bg-accent text-white border-accent shadow-lg shadow-accent/20":"bg-gray-50 text-gray-400 border-gray-100 hover:bg-white"),children:[s.jsx(yu,{size:16})," Image"]}),s.jsxs("button",{type:"button",onClick:()=>Pi("video"),className:Ge("flex-1 py-4 rounded-2xl border text-[10px] font-black uppercase tracking-widest transition-all gap-2 flex items-center justify-center",Zr==="video"?"bg-accent text-white border-accent shadow-lg shadow-accent/20":"bg-gray-50 text-gray-400 border-gray-100 hover:bg-white"),children:[s.jsx(Na,{size:16})," Motion"]})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Duration"}),s.jsxs("select",{value:Qa,onChange:O=>vl(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold text-gray-900 focus:bg-white focus:ring-4 focus:ring-accent/10 focus:border-accent transition-all appearance-none",children:[s.jsx("option",{value:"7",children:"7 Days (Standard)"}),s.jsx("option",{value:"14",children:"14 Days (Premium)"}),s.jsx("option",{value:"30",children:"30 Days (Professional)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Target Link"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"url",required:!0,value:Dn,onChange:O=>po(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold text-gray-900 focus:bg-white focus:ring-4 focus:ring-accent/10 focus:border-accent transition-all pl-12",placeholder:"https://your-site.com"}),s.jsx(wd,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:18})]})]})]}),Zr==="image"?s.jsxs("div",{className:"space-y-4",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Advert Banner (Instant Uploaded)"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"md:col-span-2 relative group",children:[s.jsx("input",{type:"file",accept:"image/*",onChange:O=>{var Ce;const ue=(Ce=O.target.files)==null?void 0:Ce[0];ue&&(ma(ue),ia(ue,qf,Vb))},className:"hidden",id:"advert-image"}),s.jsx("label",{htmlFor:"advert-image",className:Ge("flex flex-col items-center justify-center aspect-[21/9] rounded-2xl border-2 border-dashed transition-all cursor-pointer bg-gray-50",Ro?"border-accent":"border-gray-100 hover:border-accent hover:bg-white"),children:Km?s.jsxs("div",{className:"text-center p-4",children:[s.jsx(vn,{className:"mx-auto text-accent mb-2 animate-spin",size:32}),s.jsx("p",{className:"text-[10px] font-black text-accent uppercase tracking-widest leading-none",children:"Uploading image..."})]}):Ro?s.jsxs("div",{className:"w-full h-full relative rounded-2xl overflow-hidden group",children:[s.jsx("img",{src:Ro,className:"w-full h-full object-cover",alt:"Advert Campaign",referrerPolicy:"no-referrer"}),s.jsx("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center text-white",children:s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest",children:"Change Banner Image"})})]}):s.jsxs(s.Fragment,{children:[s.jsx(yu,{className:"text-gray-400 mb-2",size:32}),s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Select Image (21:9 Recommended)"})]})})]}),s.jsxs("div",{className:"bg-gray-50 border border-gray-100 p-4 rounded-2xl flex flex-col justify-center space-y-2",children:[s.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-gray-450 block",children:"Direct Banner Link"}),s.jsx("input",{type:"text",value:Ro,onChange:O=>qf(O.target.value),placeholder:"Or paste banner image URL...",className:"w-full px-3 py-2 bg-white border border-gray-100 text-[10px] text-gray-700 font-mono rounded-lg outline-none focus:border-accent"}),s.jsx("p",{className:"text-[8px] text-gray-400 font-bold uppercase tracking-wider leading-tight",children:"Your campaigns will save and render this URL instantly across the platform."})]})]})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Video Link (Direct MP4/Link)"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"url",required:Zr==="video",value:Xa,onChange:O=>it(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold text-gray-900 focus:bg-white focus:ring-4 focus:ring-accent/10 focus:border-accent transition-all pl-12",placeholder:"https://example.com/ad.mp4"}),s.jsx(Na,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:18})]}),s.jsx("p",{className:"px-4 text-[9px] font-bold text-gray-400 uppercase tracking-widest",children:"Ensure the link is a direct video file or an embeddable URL."})]}),s.jsx("div",{className:"p-6 bg-gray-50 rounded-2xl border border-gray-100",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(sF,{className:"text-accent flex-shrink-0",size:20}),s.jsx("p",{className:"text-[10px] font-bold text-gray-500 uppercase leading-relaxed",children:"Your advert will be reviewed by our team before going live. This usually takes less than 24 hours."})]})}),s.jsx("button",{type:"submit",disabled:jt,className:"w-full py-5 bg-accent text-white rounded-2xl text-sm font-black uppercase tracking-[0.2em] hover:bg-accent-700 transition-all shadow-xl shadow-accent/20 disabled:opacity-50 flex items-center justify-center gap-3",children:jt?s.jsxs(s.Fragment,{children:[s.jsx(vn,{className:"animate-spin",size:20}),"Uploading..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Eo,{size:20}),"Submit for Review"]})})]})]}):a==="manage-ads"&&t?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900",children:"Advert Management"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{className:"px-4 py-2 bg-accent text-white rounded-xl text-[10px] font-black uppercase tracking-widest shadow-lg shadow-accent/20",children:"Pending Review"}),s.jsx("button",{className:"px-4 py-2 bg-white border border-gray-100 rounded-xl text-[10px] font-black uppercase tracking-widest text-gray-500 hover:bg-gray-50 transition-all",children:"Active"})]})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:It.map(O=>s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-sm hover:shadow-md transition-all flex flex-col gap-4",children:[s.jsx("div",{className:"aspect-[21/9] rounded-2xl overflow-hidden bg-gray-100",children:s.jsx("img",{src:O.imageUrl||void 0,alt:"",className:"w-full h-full object-cover"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:Ge("px-2 py-0.5 text-[9px] font-black uppercase tracking-widest rounded",O.status==="active"?"bg-green-50 text-green-600":"bg-blue-50 text-accent"),children:O.status}),s.jsxs("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:[O.durationDays," Days"]})]}),s.jsx("h4",{className:"text-lg font-black text-gray-900 uppercase tracking-tight truncate",children:O.title}),s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest truncate mt-1",children:O.link})]}),s.jsxs("div",{className:"flex items-center gap-2 pt-4 border-t border-gray-50",children:[s.jsx("button",{onClick:()=>Xm(O.id,O.status),className:Ge("flex-1 py-3 rounded-xl text-[10px] font-black uppercase tracking-widest transition-all",O.status==="active"?"bg-gray-100 text-gray-900 hover:bg-gray-200":"bg-green-600 text-white hover:bg-green-700"),children:O.status==="active"?"Deactivate":"Approve & Activate"}),s.jsx("button",{onClick:()=>ec(O.id),className:"p-3 bg-blue-50 text-black rounded-xl hover:bg-black hover:text-white transition-all",children:s.jsx(Es,{size:18})})]})]},O.id))})]}):a==="flagged-comments"&&t?s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-4",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 flex items-center gap-2",children:[s.jsx(Su,{className:"text-rose-500",size:22})," Flagged Content Moderation Hub"]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-1",children:"Review and moderate flagged comments and lounge dispatches"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs("span",{className:"px-3 py-1 bg-rose-50 text-rose-600 border border-rose-100 rounded-full text-[10px] font-black uppercase tracking-widest",children:[B.length+En.length," Total Flagged"]})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("h4",{className:"text-sm font-black text-gray-900 uppercase tracking-wider flex items-center gap-2",children:[s.jsx(Ri,{size:16,className:"text-accent"})," Flagged Comments (",B.length,")"]}),B.length===0?s.jsx("div",{className:"bg-white p-8 rounded-2xl border border-gray-100 text-center text-xs text-gray-400 font-bold uppercase tracking-wider",children:"No flagged comments awaiting moderation"}):s.jsx("div",{className:"grid grid-cols-1 gap-4",children:B.map(O=>s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-sm hover:shadow-md transition-all",children:[s.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[s.jsx("img",{src:O.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(O.authorName)}&background=random`,alt:"",className:"w-10 h-10 rounded-xl object-cover"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("h4",{className:"font-black text-gray-900 uppercase tracking-tight",children:O.authorName}),s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:O.createdAt instanceof wn?O.createdAt.toDate().toLocaleString():"Recently"})]}),s.jsxs("p",{className:"text-sm text-gray-600 font-medium bg-gray-50 p-4 rounded-2xl border border-gray-100 italic",children:['"',O.content,'"']})]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-50",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ri,{size:14,className:"text-gray-400"}),s.jsxs("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:["On: ",s.jsx("span",{className:"text-accent",children:O.articleTitle||"Article Comment"})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>O.articleId&&lh(O.articleId,O.id),className:"px-3 py-2 bg-emerald-50 hover:bg-emerald-500 text-emerald-600 hover:text-white rounded-xl transition-all text-xs font-bold uppercase tracking-wider flex items-center gap-1 cursor-pointer",title:"Dismiss Flag",children:[s.jsx(zu,{size:14})," Dismiss Flag"]}),s.jsxs("button",{onClick:()=>O.articleId&&oh(O.articleId,O.id),className:"px-3 py-2 bg-red-50 hover:bg-red-600 text-red-600 hover:text-white rounded-xl transition-all text-xs font-bold uppercase tracking-wider flex items-center gap-1 cursor-pointer",title:"Delete Comment",children:[s.jsx(Es,{size:14})," Delete"]})]})]})]},O.id))})]}),s.jsxs("div",{className:"space-y-4 pt-6 border-t border-gray-100",children:[s.jsxs("h4",{className:"text-sm font-black text-gray-900 uppercase tracking-wider flex items-center gap-2",children:[s.jsx(M0,{size:16,className:"text-purple-600"})," Flagged Lounge Dispatches (",En.length,")"]}),En.length===0?s.jsx("div",{className:"bg-white p-8 rounded-2xl border border-gray-100 text-center text-xs text-gray-400 font-bold uppercase tracking-wider",children:"No flagged posts awaiting moderation"}):s.jsx("div",{className:"grid grid-cols-1 gap-4",children:En.map(O=>s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-sm hover:shadow-md transition-all",children:[s.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[s.jsx("img",{src:O.authorPhoto||O.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(O.authorName||"Student")}&background=random`,alt:"",className:"w-10 h-10 rounded-xl object-cover"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("h4",{className:"font-black text-gray-900 uppercase tracking-tight",children:O.authorName||"Anonymous Student"}),s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:O.createdAt instanceof wn?O.createdAt.toDate().toLocaleString():"Recently"})]}),s.jsx("p",{className:"text-sm text-gray-800 font-medium bg-gray-50 p-4 rounded-2xl border border-gray-100 whitespace-pre-wrap",children:O.content}),O.imageUrl&&s.jsx("img",{src:O.imageUrl,alt:"",className:"mt-3 rounded-2xl max-h-48 object-cover border border-gray-100"})]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-50",children:[s.jsx("span",{className:"text-[10px] font-black text-rose-500 uppercase tracking-widest",children:"Reported Content"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>Pm(O.id),className:"px-3 py-2 bg-emerald-50 hover:bg-emerald-500 text-emerald-600 hover:text-white rounded-xl transition-all text-xs font-bold uppercase tracking-wider flex items-center gap-1 cursor-pointer",children:[s.jsx(zu,{size:14})," Dismiss Flag"]}),s.jsxs("button",{onClick:()=>zf(O.id),className:"px-3 py-2 bg-red-50 hover:bg-red-600 text-red-600 hover:text-white rounded-xl transition-all text-xs font-bold uppercase tracking-wider flex items-center gap-1 cursor-pointer",children:[s.jsx(Es,{size:14})," Delete Post"]})]})]})]},O.id))})]})]}):a==="imgbb-settings"&&t?s.jsxs("div",{className:"space-y-8 max-w-4xl",children:[s.jsx("div",{className:"border-b border-gray-100 pb-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-3 bg-blue-50 text-blue-600 rounded-2xl border border-blue-100",children:s.jsx(Rne,{size:24})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 flex items-center gap-2",children:"ImgBB API Key Settings"}),s.jsxs("p",{className:"text-xs text-gray-500 font-medium",children:["Admin Access (",s.jsx("span",{className:"text-accent font-bold",children:"Image Hosting Credentials"}),")"]})]})]})}),s.jsxs("div",{className:"bg-gradient-to-r from-gray-900 to-black text-white p-6 rounded-3xl border border-gray-800 shadow-xl space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-[10px] font-black uppercase tracking-widest text-emerald-400 flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 inline-block"})," Active ImgBB API Key"]}),s.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(ci),he.success("ImgBB API key copied to clipboard!")},className:"px-3 py-1 bg-white/10 hover:bg-white/20 text-white rounded-xl text-[10px] font-black uppercase tracking-widest flex items-center gap-1 transition-all",children:[s.jsx(t2,{size:12})," Copy Key"]})]}),s.jsx("div",{className:"font-mono text-sm md:text-base font-bold bg-white/5 p-4 rounded-2xl border border-white/10 break-all text-emerald-300",children:ci})]}),s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-sm space-y-4",children:[s.jsxs("h4",{className:"text-sm font-black text-gray-900 uppercase tracking-wider flex items-center gap-2",children:[s.jsx(Uc,{size:16,className:"text-accent"})," Add & Activate New ImgBB API Key"]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[s.jsx("input",{type:"text",value:ts,onChange:O=>Wa(O.target.value),placeholder:"Paste new ImgBB API key here (e.g. 857eaaf2b7571ee437db8ee3f6ee8670)...",className:"flex-1 bg-gray-50 border border-gray-200 rounded-2xl px-4 py-3 text-xs font-mono text-gray-900 outline-none focus:border-accent"}),s.jsx("button",{onClick:async()=>{var Ce;if(!ts.trim()){he.error("Please enter an API key");return}const O=ts.trim(),ue=Array.from(new Set([O,...ha]));Un(ue),At(O),localStorage.setItem("campus_eye_imgbb_active_key",O);try{await Gn(st(fe,"settings","imgbb"),{activeKey:O,savedKeys:ue,updatedAt:zr(),updatedBy:(Ce=Ne.currentUser)==null?void 0:Ce.email},{merge:!0})}catch(ut){console.error("Firestore update error:",ut)}Wa(""),he.success("New ImgBB API key saved & activated!")},className:"px-6 py-3 bg-accent text-white rounded-2xl text-xs font-black uppercase tracking-widest hover:bg-accent/90 transition-all shrink-0 cursor-pointer",children:"Save & Activate Key"})]})]}),s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-sm space-y-4",children:[s.jsxs("h4",{className:"text-sm font-black text-gray-900 uppercase tracking-wider",children:["Saved API Keys Pool (",ha.length,")"]}),s.jsx("div",{className:"space-y-3",children:ha.map((O,ue)=>{const Ce=O===ci;return s.jsxs("div",{className:Ge("p-4 rounded-2xl border flex items-center justify-between gap-4 transition-all",Ce?"bg-emerald-50/50 border-emerald-200":"bg-gray-50 border-gray-100"),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[s.jsx("input",{type:"radio",name:"active_imgbb_key",checked:Ce,onChange:()=>{var ut;At(O),localStorage.setItem("campus_eye_imgbb_active_key",O),Gn(st(fe,"settings","imgbb"),{activeKey:O,savedKeys:ha,updatedAt:zr(),updatedBy:(ut=Ne.currentUser)==null?void 0:ut.email},{merge:!0}),he.success("Switched active ImgBB key!")},className:"w-4 h-4 text-accent cursor-pointer"}),s.jsx("span",{className:"font-mono text-xs font-bold text-gray-800 truncate",children:O}),Ce&&s.jsx("span",{className:"px-2 py-0.5 bg-emerald-500 text-white text-[9px] font-black uppercase tracking-widest rounded-full shrink-0",children:"Active"})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!Ce&&s.jsx("button",{onClick:()=>{var ut;At(O),localStorage.setItem("campus_eye_imgbb_active_key",O),Gn(st(fe,"settings","imgbb"),{activeKey:O,savedKeys:ha,updatedAt:zr(),updatedBy:(ut=Ne.currentUser)==null?void 0:ut.email},{merge:!0}),he.success("Switched active ImgBB key!")},className:"px-3 py-1.5 bg-white border border-gray-200 text-gray-700 hover:bg-gray-100 rounded-xl text-[10px] font-bold uppercase tracking-wider transition-all",children:"Switch to this"}),s.jsx("button",{onClick:async()=>{var cn;const ut=ha.filter(un=>un!==O);Un(ut);let Yt=ci;ci===O&&(Yt=ut[0]||"857eaaf2b7571ee437db8ee3f6ee8670",At(Yt),localStorage.setItem("campus_eye_imgbb_active_key",Yt));try{await Gn(st(fe,"settings","imgbb"),{activeKey:Yt,savedKeys:ut,updatedAt:zr(),updatedBy:(cn=Ne.currentUser)==null?void 0:cn.email},{merge:!0})}catch(un){console.error(un)}he.success("Removed ImgBB key")},className:"p-1.5 text-gray-400 hover:text-red-600 rounded-lg hover:bg-red-50 transition-all",title:"Remove Key",children:s.jsx(Es,{size:16})})]})]},ue)})})]}),s.jsxs("div",{className:"bg-white p-6 sm:p-8 rounded-3xl border border-gray-100 shadow-sm space-y-6 text-left",children:[s.jsx("div",{className:"flex items-center justify-between border-b border-gray-100 pb-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-3 bg-red-50 text-red-600 rounded-2xl border border-red-100",children:s.jsx(Sne,{size:22})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-base font-black text-gray-900 uppercase tracking-tight",children:"Database Expansion Slots (Multi-Database System)"}),s.jsxs("p",{className:"text-[11px] text-gray-500 font-medium",children:["Add extra Firebase Databases (",s.jsx("span",{className:"text-red-650 font-bold",children:"Db 1, Db 2, Db 3..."}),"). All databases display together on the site simultaneously!"]})]})]})}),s.jsxs("div",{className:"p-5 bg-gradient-to-r from-gray-900 to-black text-white rounded-2xl border border-gray-800 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-[10px] font-black uppercase tracking-widest text-amber-400 flex items-center gap-2",children:[s.jsx(qx,{size:14})," Active Target Write Database Slot"]}),s.jsx("span",{className:"text-[9px] font-mono text-emerald-400 font-bold uppercase bg-emerald-950/80 px-2.5 py-1 rounded-md border border-emerald-800",children:"LIVE WRITE ACTIVE"})]}),s.jsx("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:s.jsxs("select",{value:y,onChange:O=>{const ue=O.target.value;w(ue),LL(ue),he.success(`Active write target switched to ${ue==="default"?"Default Primary DB":ue.toUpperCase()}!`)},className:"w-full bg-white/10 text-white font-mono text-xs font-bold p-3 rounded-xl border border-white/20 outline-none cursor-pointer focus:border-amber-400",children:[s.jsx("option",{value:"default",className:"bg-gray-900 text-white",children:"Default Primary Firebase DB (Main System)"}),f.map(O=>s.jsxs("option",{value:O.id,className:"bg-gray-900 text-white",children:[O.name," (",O.projectId||"Custom Config",")"]},O.id))]})}),s.jsxs("p",{className:"text-[10px] text-gray-300 font-sans leading-relaxed",children:["New articles, comments, and uploaded media will be saved directly into the selected active slot. Readers will always see articles from ",s.jsx("b",{children:"ALL"})," databases aggregated automatically!"]})]}),s.jsxs("div",{className:"space-y-4 pt-2",children:[s.jsxs("h5",{className:"text-xs font-black uppercase tracking-wider text-gray-800 flex items-center gap-2",children:[s.jsx(Uc,{size:14,className:"text-red-600"})," Add New Expansion Database Slot"]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-3",children:[s.jsx("div",{className:"md:col-span-4",children:s.jsx("input",{type:"text",value:j,onChange:O=>T(O.target.value),placeholder:"Slot Name e.g. Db 1, Db 2...",className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-4 py-3 text-xs font-bold text-gray-900 outline-none focus:border-red-600"})}),s.jsx("div",{className:"md:col-span-8",children:s.jsx("textarea",{value:D,onChange:O=>V(O.target.value),placeholder:'Paste Firebase JSON Config snippet here (e.g. {"apiKey": "...", "projectId": "...", "authDomain": "..."})',className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-4 py-3 text-xs font-mono text-gray-900 outline-none focus:border-red-600 min-h-[70px]"})})]}),s.jsx("button",{onClick:()=>{if(!j.trim()){he.error("Please enter a slot name e.g. Db 1");return}if(!D.trim()){he.error("Please paste the Firebase configuration JSON");return}try{const O=K2e(D),Ce={id:`db_${Date.now()}`,name:j.trim(),apiKey:O.apiKey||"",authDomain:O.authDomain||"",projectId:O.projectId||"",storageBucket:O.storageBucket||"",messagingSenderId:O.messagingSenderId||"",appId:O.appId||"",firestoreDatabaseId:O.firestoreDatabaseId||"(default)",customConfigJson:D.trim()},ut=[...f,Ce];m(ut),ML(ut),T(""),V(""),he.success(`Expansion slot "${Ce.name}" added successfully!`)}catch(O){he.error("Could not parse Firebase Config: "+O.message)}},className:"px-6 py-3 bg-red-650 text-white rounded-xl text-xs font-black uppercase tracking-wider hover:bg-black transition-all cursor-pointer shadow-sm",children:"Save Expansion Database Slot"})]}),f.length>0&&s.jsxs("div",{className:"space-y-3 pt-3 border-t border-gray-100",children:[s.jsxs("span",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 block",children:["Registered Expansion Slots (",f.length,")"]}),f.map(O=>s.jsxs("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-2xl flex items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("span",{className:"font-black text-xs text-gray-900 uppercase tracking-wide block",children:O.name}),s.jsx("span",{className:"text-[10px] font-mono text-gray-500",children:O.projectId?`Project ID: ${O.projectId}`:"Custom Config"})]}),s.jsx("button",{onClick:()=>{const ue=f.filter(Ce=>Ce.id!==O.id);m(ue),ML(ue),y===O.id&&(w("default"),LL("default")),he.success(`Removed ${O.name}`)},className:"p-2 text-gray-400 hover:text-red-600 rounded-lg hover:bg-red-50 transition-all cursor-pointer",title:"Delete Slot",children:s.jsx(Es,{size:16})})]},O.id))]})]}),s.jsxs("div",{className:"bg-white p-6 sm:p-8 rounded-3xl border border-gray-100 shadow-sm space-y-4 text-left",children:[s.jsxs("div",{className:"flex items-center gap-3 border-b border-gray-100 pb-4",children:[s.jsx("div",{className:"p-3 bg-indigo-50 text-indigo-600 rounded-2xl border border-indigo-100",children:s.jsx(C0,{size:22})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-base font-black text-gray-900 uppercase tracking-tight",children:"Google Redirect & Custom Authorization Domain"}),s.jsxs("p",{className:"text-[11px] text-gray-500 font-medium",children:["Configure your official domain link for Google Authentication redirects (e.g. ",s.jsx("span",{className:"text-indigo-600 font-bold",children:"campuseyemedia.com"}),")."]})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("label",{className:"text-xs font-black uppercase tracking-wider text-gray-700 block",children:"Website Authorized Auth Domain"}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[s.jsx("input",{type:"text",value:A,onChange:O=>S(O.target.value),placeholder:"e.g. campuseyemedia.com or custom domain...",className:"flex-1 bg-gray-50 border border-gray-200 rounded-xl px-4 py-3 text-xs font-mono text-gray-900 outline-none focus:border-indigo-600"}),s.jsx("button",{onClick:()=>{W2e(A),he.success("Saved Custom Auth Domain!")},className:"px-6 py-3 bg-indigo-600 text-white rounded-xl text-xs font-black uppercase tracking-wider hover:bg-indigo-700 transition-all cursor-pointer shrink-0",children:"Save Auth Domain"})]})]})]}),s.jsxs("div",{className:"bg-white p-6 sm:p-8 rounded-3xl border border-gray-100 shadow-sm space-y-4 text-left",children:[s.jsxs("div",{className:"flex items-center gap-3 border-b border-gray-100 pb-4",children:[s.jsx("div",{className:"p-3 bg-emerald-50 text-emerald-600 rounded-2xl border border-emerald-100",children:s.jsx(Xi,{size:22})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-base font-black text-gray-900 uppercase tracking-tight",children:"Permanent SEO Sitemap (sitemap.xml) Generator"}),s.jsx("p",{className:"text-[11px] text-gray-500 font-medium",children:"Auto-generates compliant XML sitemaps for all published articles with titles, summaries, and images for Google Search indexing."})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap gap-3",children:[s.jsxs("button",{onClick:()=>{const O=Y2e(c);G(O),he.success(`Generated sitemap.xml for ${c.length} articles!`)},className:"px-6 py-3 bg-emerald-600 text-white rounded-xl text-xs font-black uppercase tracking-wider hover:bg-emerald-700 transition-all cursor-pointer flex items-center gap-2",children:[s.jsx(Xi,{size:14})," Generate Sitemap XML"]}),U&&s.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(U),he.success("Sitemap XML copied to clipboard!")},className:"px-6 py-3 bg-gray-900 text-white rounded-xl text-xs font-black uppercase tracking-wider hover:bg-black transition-all cursor-pointer flex items-center gap-2",children:[s.jsx(t2,{size:14})," Copy XML Code"]})]}),U&&s.jsx("div",{className:"pt-2",children:s.jsx("textarea",{readOnly:!0,value:U,rows:8,className:"w-full bg-gray-950 text-emerald-400 font-mono text-[10px] p-4 rounded-2xl border border-gray-800 outline-none select-all"})})]})]})]}):a==="broadcast"&&t?s.jsxs("div",{className:"space-y-8 max-w-4xl font-sans text-left",children:[s.jsxs("div",{className:"border-b border-gray-100 pb-4",children:[s.jsxs("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 flex items-center gap-2",children:[s.jsx(wu,{className:"text-amber-500",size:24})," Official Admin Broadcast Center"]}),s.jsx("p",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-widest mt-1",children:"Dispatch instant broadcast notifications directly to every user's inbox on the website and mobile app."})]}),s.jsx("div",{className:"bg-white p-6 sm:p-8 rounded-3xl border border-gray-100 shadow-sm space-y-6",children:s.jsxs("form",{onSubmit:kr,className:"space-y-5",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-gray-600 mb-1.5",children:"Broadcast Title / Headline *"}),s.jsx("input",{type:"text",required:!0,value:Rt,onChange:O=>nr(O.target.value),placeholder:"e.g., 📢 Urgent Campus Update: End of Semester Timetable Released!",className:"w-full p-3.5 bg-gray-50 border border-gray-200 rounded-2xl text-sm font-bold text-gray-900 outline-none focus:border-amber-500 focus:bg-white transition-all"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-gray-600 mb-1.5",children:"Broadcast Message Content *"}),s.jsx("textarea",{rows:4,required:!0,value:fr,onChange:O=>hn(O.target.value),placeholder:"Type the full announcement details here. You can include text, or paste URLs directly...",className:"w-full p-4 bg-gray-50 border border-gray-200 rounded-2xl text-xs font-medium text-gray-900 outline-none focus:border-amber-500 focus:bg-white transition-all leading-relaxed"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-gray-700",children:"Broadcast Image / Banner (Optional)"}),en&&s.jsxs("button",{type:"button",onClick:()=>Ci(""),className:"text-[10px] font-bold text-red-600 hover:text-red-700 flex items-center gap-1 cursor-pointer transition-colors",children:[s.jsx(Jr,{size:12})," Remove Image"]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"file",accept:"image/*",id:"broadcast-device-image-input",disabled:Gr,onChange:O=>{var Ce;const ue=(Ce=O.target.files)==null?void 0:Ce[0];ue&&ia(ue,Ci,be)},className:"hidden"}),s.jsx("label",{htmlFor:"broadcast-device-image-input",className:Ge("flex flex-col items-center justify-center p-4 rounded-2xl border-2 border-dashed transition-all cursor-pointer bg-gray-50 min-h-[140px] text-center",en?"border-amber-500 bg-amber-50/20":"border-gray-200 hover:border-amber-500 hover:bg-amber-50/30"),children:Gr?s.jsxs("div",{className:"flex flex-col items-center justify-center p-2",children:[s.jsx(vn,{className:"animate-spin text-amber-600 mb-2",size:28}),s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-amber-700",children:"Uploading Image from Device..."}),s.jsx("span",{className:"text-[9px] text-gray-400 mt-1",children:"Compressing & optimizing for fast delivery"})]}):en?s.jsxs("div",{className:"w-full relative group",children:[s.jsxs("div",{className:"h-28 w-full rounded-xl overflow-hidden bg-black/5 border border-amber-200/80 shadow-2xs relative",children:[s.jsx("img",{src:en,alt:"Broadcast Preview",className:"w-full h-full object-cover",referrerPolicy:"no-referrer"}),s.jsxs("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center text-white gap-1.5",children:[s.jsx(yu,{size:16}),s.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider",children:"Change Device Image"})]})]}),s.jsx("p",{className:"text-[9px] font-mono text-gray-400 truncate mt-1.5 px-1",children:en})]}):s.jsxs("div",{className:"flex flex-col items-center justify-center py-2 text-gray-500 group-hover:text-amber-600 transition-colors",children:[s.jsx("div",{className:"p-2.5 bg-white rounded-2xl border border-gray-200 shadow-2xs mb-2 text-amber-600",children:s.jsx(yu,{size:22})}),s.jsx("span",{className:"text-xs font-black uppercase tracking-wide text-gray-800",children:"Upload Image from Device"}),s.jsx("span",{className:"text-[9.5px] font-medium text-gray-400 mt-0.5",children:"Click or tap to browse gallery / camera (Auto-compressed)"})]})})]}),s.jsxs("div",{className:"space-y-3 flex flex-col justify-between",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-gray-600 mb-1.5",children:"Or Paste Direct Image Link (Optional)"}),s.jsx("input",{type:"url",value:en,onChange:O=>Ci(O.target.value),placeholder:"https://... (PNG / JPG / WebP link)",className:"w-full p-3 bg-gray-50 border border-gray-200 rounded-2xl text-xs font-mono text-gray-900 outline-none focus:border-amber-500 focus:bg-white transition-all"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-gray-600 mb-1.5",children:"Action Target Link (Optional)"}),s.jsx("input",{type:"text",value:Pe,onChange:O=>$e(O.target.value),placeholder:"e.g. /article/123 or https://...",className:"w-full p-3 bg-gray-50 border border-gray-200 rounded-2xl text-xs font-mono text-gray-900 outline-none focus:border-amber-500 focus:bg-white transition-all"})]})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-amber-600 bg-amber-50 px-3 py-1.5 rounded-xl border border-amber-200/50",children:[s.jsx(Xi,{size:14})," Reaches all citizens instantly in real-time"]}),s.jsxs("button",{type:"submit",disabled:ct||!Rt.trim()||!fr.trim(),className:"flex items-center gap-2 px-6 py-3 bg-amber-500 hover:bg-amber-600 disabled:opacity-40 text-white text-xs font-black uppercase tracking-widest rounded-2xl transition-all shadow-md cursor-pointer active:scale-95",children:[s.jsx(Eo,{size:14})," Dispatch Broadcast to All Inboxes"]})]})]})}),s.jsxs("div",{className:"bg-white p-6 sm:p-8 rounded-3xl border border-gray-100 shadow-sm space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 pb-4 border-b border-gray-100",children:[s.jsxs("div",{children:[s.jsxs("h4",{className:"text-base font-black text-gray-950 uppercase tracking-tight flex items-center gap-2",children:[s.jsx(mc,{className:"text-amber-500 animate-pulse",size:20}),s.jsxs("span",{children:["Sent Broadcast History (",Lt.length,")"]})]}),s.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-widest mt-0.5",children:"Review, manage and delete past broadcast notifications delivered to user inboxes"})]}),Lt.length>0&&s.jsxs("button",{onClick:Ht,className:"flex items-center gap-1.5 px-4 py-2 bg-red-50 hover:bg-red-100 text-red-600 text-[10px] font-black uppercase tracking-wider rounded-xl transition-all border border-red-200 cursor-pointer self-start sm:self-auto",children:[s.jsx(Es,{size:13}),s.jsx("span",{children:"Delete All Broadcasts"})]})]}),Lt.length>3&&s.jsxs("div",{className:"relative",children:[s.jsx(Tp,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-gray-400",size:14}),s.jsx("input",{type:"text",value:br,onChange:O=>ln(O.target.value),placeholder:"Search sent broadcasts by title or keyword...",className:"w-full pl-9 pr-4 py-2.5 bg-gray-50 border border-gray-200 rounded-xl text-xs text-gray-800 outline-none focus:border-amber-500 focus:bg-white transition-all"})]}),ir?s.jsxs("div",{className:"py-12 flex flex-col items-center justify-center text-gray-400 gap-2",children:[s.jsx(vn,{className:"animate-spin text-amber-500",size:24}),s.jsx("p",{className:"text-xs font-bold uppercase tracking-widest",children:"Loading broadcast history..."})]}):Lt.length===0?s.jsxs("div",{className:"p-10 border rounded-2xl text-center bg-gray-50/50 border-dashed border-gray-200 text-gray-400 select-none",children:[s.jsx(wu,{className:"mx-auto mb-2 text-gray-300",size:32}),s.jsx("p",{className:"text-xs font-bold uppercase tracking-wider text-gray-500",children:"No sent broadcast messages found."}),s.jsx("p",{className:"text-[10px] uppercase tracking-widest mt-1 text-gray-400",children:"Use the form above to dispatch your first official announcement."})]}):s.jsx("div",{className:"space-y-4",children:Lt.filter(O=>{if(!br.trim())return!0;const ue=br.toLowerCase();return(O.title||"").toLowerCase().includes(ue)||(O.message||"").toLowerCase().includes(ue)}).map(O=>{var Ce;const ue=O.timestamp?new Date(O.timestamp).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):(Ce=O.createdAt)!=null&&Ce.toDate?O.createdAt.toDate().toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):"Recently dispatched";return s.jsxs("div",{className:"p-4 sm:p-5 bg-gray-50/70 hover:bg-white border border-gray-200 rounded-2xl transition-all shadow-2xs hover:shadow-sm space-y-3 relative group",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[s.jsx("div",{className:"w-9 h-9 rounded-xl bg-amber-50 text-amber-600 border border-amber-200/60 flex items-center justify-center shrink-0 mt-0.5",children:s.jsx(wu,{size:18})}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h5",{className:"text-sm font-black text-gray-950 tracking-tight leading-snug",children:O.title}),s.jsxs("span",{className:"text-[9px] font-mono font-bold text-gray-400 bg-white px-2 py-0.5 rounded-md border border-gray-200 flex items-center gap-1",children:[s.jsx(vw,{size:10})," ",ue]})]}),s.jsx("p",{className:"text-xs text-gray-600 mt-1 leading-relaxed whitespace-pre-wrap",children:O.message})]})]}),s.jsx("button",{onClick:()=>mr(O.id),title:"Delete this broadcast",className:"p-2 bg-white hover:bg-red-50 text-gray-400 hover:text-red-600 rounded-xl border border-gray-200 hover:border-red-200 transition-all cursor-pointer shrink-0 shadow-2xs active:scale-95",children:s.jsx(Es,{size:16})})]}),(O.imageUrl||O.link)&&s.jsxs("div",{className:"pt-2 border-t border-gray-200/60 flex flex-wrap items-center gap-3",children:[O.imageUrl&&s.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-gray-500 font-mono bg-white px-2.5 py-1 rounded-lg border border-gray-200 max-w-xs truncate",children:[s.jsx(yu,{size:12,className:"text-amber-500 shrink-0"}),s.jsx("span",{className:"truncate",children:O.imageUrl})]}),O.link&&s.jsxs("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-[10px] font-bold text-indigo-600 bg-indigo-50 hover:bg-indigo-100 px-2.5 py-1 rounded-lg border border-indigo-200 transition-all",children:[s.jsx(wd,{size:12}),s.jsx("span",{className:"truncate max-w-[200px]",children:O.link})]})]})]},O.id)})})]})]}):a==="users"&&t?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"bg-blue-50/40 border border-blue-100/50 p-5 rounded-3xl flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-blue-50 text-accent rounded-2xl border border-blue-100",children:s.jsx(qx,{size:20})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-black text-blue-900 uppercase tracking-widest",children:"Citizen Data Saver Mode Active"}),s.jsxs("p",{className:"text-[11px] text-blue-700/80 mt-0.5",children:["To optimize loading times and reduce your data usage by ",s.jsx("strong",{children:"99.9%"}),", deep engagement profiles are calculated on-demand. Click ",s.jsx("strong",{children:"Analyze Profile"})," on any citizen below."]})]})]}),Object.keys(Wr).length>0&&s.jsx("button",{onClick:()=>{dr({}),or({})},className:"px-4 py-2 bg-white hover:bg-gray-50 border border-gray-100 rounded-xl text-[9px] font-black uppercase tracking-widest transition-all text-gray-600 shadow-sm cursor-pointer",children:"Clear Analytics Cache"})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-gray-100 shadow-sm flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-blue-50 text-accent rounded-xl",children:s.jsx(ko,{size:20})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] text-gray-400 uppercase font-black tracking-widest",children:"Total Citizens"}),s.jsx("h4",{className:"text-xl font-extrabold text-gray-900",children:X.length})]})]}),s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-gray-100 shadow-sm flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-emerald-50 text-emerald-600 rounded-xl",children:s.jsx(Rl,{size:20})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] text-gray-400 uppercase font-black tracking-widest",children:"Active Contributors"}),s.jsx("h4",{className:"text-xl font-extrabold text-gray-900",children:Object.values(Wr).filter(O=>(O.engagementScore||0)>=15).length})]})]}),s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-gray-100 shadow-sm flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-amber-50 text-amber-600 rounded-xl",children:s.jsx(Eu,{size:20})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] text-gray-400 uppercase font-black tracking-widest",children:"Avg Engagement Score"}),s.jsxs("h4",{className:"text-xl font-extrabold text-gray-900",children:[Object.values(Wr).length?Math.round(Object.values(Wr).reduce((O,ue)=>O+(ue.engagementScore||0),0)/Object.values(Wr).length):0," pts"]})]})]}),s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-gray-100 shadow-sm flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-purple-50 text-purple-600 rounded-xl",children:s.jsx(yp,{size:20})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] text-gray-400 uppercase font-black tracking-widest",children:"Analyzed Citizens"}),s.jsxs("h4",{className:"text-xl font-extrabold text-gray-900",children:[Object.keys(Wr).length," / ",X.length]})]})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900",children:"User Engagement Directory"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Real-time citizen contributions, purchases, and influence scores."})]}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"text",value:Xe,onChange:O=>Xt(O.target.value),placeholder:"Search citizens...",className:"px-6 py-3 bg-white border border-gray-100 rounded-xl text-[10px] font-black uppercase tracking-widest outline-none focus:ring-4 focus:ring-accent/10 focus:border-accent transition-all w-64"}),s.jsx(Tp,{size:14,className:"absolute right-4 top-1/2 -translate-y-1/2 text-gray-400"})]})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:X.filter(O=>{const ue=Xe.toLowerCase();return(O.displayName||"").toLowerCase().includes(ue)||(O.email||"").toLowerCase().includes(ue)}).map(O=>{const ue=Wr[O.id],Ce=yn[O.id],ut=Ot[O.id];return s.jsxs("div",{className:"bg-white p-6 rounded-[2rem] border border-gray-100 shadow-sm hover:shadow-md transition-all flex flex-col justify-between group",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-start justify-between gap-4 mb-5",children:[s.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[s.jsxs("div",{className:"relative",children:[s.jsx("img",{src:O.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(O.displayName||"User")}&background=random`,alt:"",className:"w-14 h-14 rounded-2xl object-cover border-2 border-gray-50 shadow-sm"}),(O.isAdmin||O.role==="admin")&&s.jsx("div",{className:"absolute -top-1.5 -right-1.5 bg-black text-white p-1 rounded-lg shadow-md",children:s.jsx(ul,{size:11})})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h4",{className:"font-extrabold text-sm text-gray-900 truncate uppercase tracking-tight",children:O.displayName||"Anonymous"}),s.jsx("p",{className:"text-[9px] text-gray-400 uppercase font-bold tracking-widest truncate",children:O.email})]})]}),s.jsx("span",{className:Ge("px-2.5 py-1 rounded-lg text-[9px] font-black uppercase tracking-wider border",(ue==null?void 0:ue.tierColor)||"bg-gray-50 text-gray-500 border-gray-100"),children:(ue==null?void 0:ue.tier)||"New Citizen"})]}),ue?s.jsxs("div",{className:"space-y-4",children:[s.jsx(Dee,{stats:{userId:O.id,userName:O.displayName||"Citizen",userEmail:O.email||"",userPhoto:O.photoURL,engagementScore:ue.engagementScore||0,articlesCount:ue.articlesCount||0,postsCount:ue.postsCount||0,purchasesCount:ue.purchasesCount||0,totalSpent:ue.totalSpent||0,followersCount:ue.followersCount||0,followingCount:ue.followingCount||0,tier:ue.engagementScore>80?"Titan Publisher":ue.engagementScore>30?"Senior Reporter":"Campus Citizen"}}),ue.recentArticles&&ue.recentArticles.length>0||ue.recentPosts&&ue.recentPosts.length>0?s.jsxs("div",{className:"mb-5 border-t border-dashed border-gray-100 pt-4",children:[s.jsxs("button",{type:"button",onClick:()=>or(Yt=>({...Yt,[O.id]:!ut})),className:"flex items-center justify-between w-full text-[9px] font-black uppercase tracking-widest text-gray-500 hover:text-accent transition-all cursor-pointer",children:[s.jsx("span",{children:"Recent Citizen Action"}),ut?s.jsx(gf,{size:12}):s.jsx(Md,{size:12})]}),ut&&s.jsxs("div",{className:"mt-3 space-y-2 bg-gray-50/30 p-3 rounded-xl border border-gray-100/50 animate-fadeIn",children:[ue.recentArticles&&ue.recentArticles.length>0&&s.jsxs("div",{children:[s.jsx("span",{className:"text-[8px] font-black uppercase tracking-widest text-gray-400 block mb-1",children:"Articles"}),s.jsx("ul",{className:"space-y-1",children:ue.recentArticles.map(Yt=>s.jsxs("li",{className:"text-[10px] text-gray-700 font-medium truncate",children:["• ",Yt.title]},Yt.id))})]}),ue.recentPosts&&ue.recentPosts.length>0&&s.jsxs("div",{className:Ge(ue.recentArticles&&ue.recentArticles.length>0?"mt-2 pt-2 border-t border-gray-100":""),children:[s.jsx("span",{className:"text-[8px] font-black uppercase tracking-widest text-gray-400 block mb-1",children:"Lounge Posts"}),s.jsx("ul",{className:"space-y-1",children:ue.recentPosts.map(Yt=>s.jsxs("li",{className:"text-[10px] text-gray-600 font-medium truncate italic",children:['"',Yt.content,'"']},Yt.id))})]})]})]}):s.jsx("div",{className:"mb-5 border-t border-dashed border-gray-100 pt-4 text-center",children:s.jsx("span",{className:"text-[8px] font-black uppercase tracking-widest text-gray-400",children:"No active content recorded"})})]}):s.jsx("div",{className:"mb-5 py-4",children:s.jsx("button",{onClick:()=>mn(O.id),disabled:Ce,className:"w-full py-5 bg-gray-50/50 hover:bg-gray-50 hover:border-accent active:bg-gray-100/80 border border-dashed border-gray-200 rounded-2xl flex flex-col items-center justify-center gap-2 transition-all cursor-pointer group/btn",children:Ce?s.jsx(vn,{size:16,className:"animate-spin text-accent"}):s.jsxs(s.Fragment,{children:[s.jsx(yp,{size:18,className:"text-gray-400 group-hover/btn:text-accent transition-all"}),s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-gray-500 group-hover/btn:text-gray-800 transition-all",children:"Analyze Engagement Profile"})]})})})]}),s.jsxs("div",{className:"space-y-3 pt-3 border-t border-gray-50",children:[s.jsxs("div",{className:"flex items-center justify-between text-[10px] font-black uppercase tracking-widest",children:[s.jsx("span",{className:"text-gray-400",children:"Current Role"}),s.jsx("span",{className:Ge("px-2 py-0.5 rounded",O.isAdmin||O.role==="admin"?"bg-blue-50 text-accent":"bg-gray-50 text-gray-500"),children:O.isAdmin||O.role==="admin"?"Administrator":"Member"})]}),s.jsxs("div",{className:"flex items-center justify-between text-[10px] font-black uppercase tracking-widest",children:[s.jsx("span",{className:"text-gray-400",children:"Blue Check (Premium)"}),s.jsx("span",{className:Ge("px-2 py-0.5 rounded font-black",O.isVerified||O.isPremium||O.blueCheck||O.isPremiumPostUser?"bg-blue-600 text-white":"bg-gray-100 text-gray-400"),children:O.isVerified||O.isPremium||O.blueCheck||O.isPremiumPostUser?"✓ Verified Premium":"Standard"})]}),s.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[s.jsx("button",{onClick:()=>Jo(O.id,!!(O.isVerified||O.isPremium||O.blueCheck||O.isPremiumPostUser)),className:Ge("w-full py-2.5 rounded-xl text-[9.5px] font-black uppercase tracking-widest transition-all border-2 cursor-pointer flex items-center justify-center gap-1.5",O.isVerified||O.isPremium||O.blueCheck||O.isPremiumPostUser?"border-red-600 text-red-600 hover:bg-red-600 hover:text-white":"border-blue-600 text-blue-600 hover:bg-blue-600 hover:text-white"),children:O.isVerified||O.isPremium||O.blueCheck||O.isPremiumPostUser?"Revoke Blue Check (Premium)":"Grant Blue Check (Premium)"}),s.jsx("button",{onClick:()=>Zo(O.id,O.isAdmin||O.role==="admin"),className:Ge("w-full py-2.5 rounded-xl text-[9.5px] font-black uppercase tracking-widest transition-all border-2 cursor-pointer",O.isAdmin||O.role==="admin"?"border-black text-black hover:bg-black hover:text-white":"border-gray-900 text-gray-900 hover:bg-accent hover:border-accent hover:text-white"),children:O.isAdmin||O.role==="admin"?"Revoke Admin":"Make Admin"})]})]})]},O.id)})})]}):a==="manage-tickets"&&t?s.jsx("div",{className:"space-y-8",children:s.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[s.jsxs("div",{className:"flex-1 bg-white p-8 rounded-[2.5rem] border border-gray-100 shadow-sm",children:[s.jsx("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 mb-6",children:ti?"Edit Event Ticket":"Create New Event"}),s.jsxs("form",{onSubmit:Rb,className:"space-y-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Event Title"}),s.jsx("input",{type:"text",required:!0,value:an,onChange:O=>De(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold",placeholder:"e.g. Annual Mid-Semester Bash"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Price (UGX)"}),s.jsx("input",{type:"number",required:!0,value:Nr,onChange:O=>ze(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold",placeholder:"e.g. 20000"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Quantity"}),s.jsx("input",{type:"number",required:!0,value:_n,onChange:O=>Be(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold",placeholder:"e.g. 500"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Event Date"}),s.jsx("input",{type:"datetime-local",required:!0,value:Bt,onChange:O=>Er(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Venue"}),s.jsx("input",{type:"text",required:!0,value:jr,onChange:O=>_r(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold",placeholder:"e.g. Main Hall"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Description"}),s.jsx("textarea",{required:!0,value:Et,onChange:O=>rr(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold min-h-[120px]",placeholder:"Detail what students should expect..."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"External Event Link (Optional)"}),s.jsx("input",{type:"url",value:Ti,onChange:O=>zt(O.target.value),className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl outline-none text-sm font-bold",placeholder:"e.g. https://example.com/event-details"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-4",children:"Poster Image (Instant Uploaded)"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-gray-50 border border-gray-100 p-4 rounded-2xl flex flex-col justify-center space-y-2",children:[s.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-gray-400 block",children:"Direct Image Link"}),s.jsx("input",{type:"text",value:bh,onChange:O=>Do(O.target.value),placeholder:"Paste poster image URL or upload details...",className:"w-full px-3 py-2 bg-white border border-gray-100 text-[10px] text-gray-700 font-mono rounded-lg outline-none focus:border-accent"})]}),s.jsxs("div",{className:"relative group",children:[s.jsx("input",{type:"file",accept:"image/*",onChange:O=>{var Ce;const ue=(Ce=O.target.files)==null?void 0:Ce[0];ue&&(vi(ue),ia(ue,Do,bx))},className:"hidden",id:"ticket-image"}),s.jsx("label",{htmlFor:"ticket-image",className:Ge("flex flex-col items-center justify-center aspect-video rounded-2xl border-2 border-dashed transition-all cursor-pointer bg-gray-50",bh?"border-accent":"border-gray-100 hover:border-accent hover:bg-white"),children:yx?s.jsxs("div",{className:"text-center p-2",children:[s.jsx(vn,{className:"mx-auto text-accent mb-1 animate-spin",size:24}),s.jsx("p",{className:"text-[8px] font-black text-accent uppercase tracking-widest leading-none",children:"Uploading..."})]}):bh?s.jsxs("div",{className:"w-full h-full relative rounded-2xl overflow-hidden group",children:[s.jsx("img",{src:bh,className:"w-full h-full object-cover",alt:"Ticket Poster",referrerPolicy:"no-referrer"}),s.jsx("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center text-white",children:s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest",children:"Change Poster"})})]}):s.jsxs(s.Fragment,{children:[s.jsx(yu,{className:"text-gray-400 mb-1",size:24}),s.jsx("p",{className:"text-[8.5px] font-black text-gray-400 uppercase tracking-widest",children:"Select file"})]})})]})]})]}),s.jsxs("div",{className:"flex gap-4",children:[ti&&s.jsx("button",{type:"button",onClick:()=>{ea(null),De(""),rr(""),ze(""),Er(""),_r(""),Be(""),zt(""),Do("")},className:"flex-1 py-4 bg-gray-100 text-gray-600 rounded-2xl text-[10px] font-black uppercase tracking-widest",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:jt,className:"flex-[2] py-4 bg-accent text-white rounded-2xl text-[10px] font-black uppercase tracking-widest shadow-lg shadow-accent/20",children:jt?"Processing...":ti?"Update Ticket":"Launch Event"})]})]})]}),s.jsxs("div",{className:"w-full md:w-96 space-y-4",children:[s.jsx("h3",{className:"text-sm font-black uppercase tracking-widest text-gray-400 ml-2",children:"Active Event Tickets"}),cr.map(O=>s.jsxs("div",{className:"bg-white p-5 rounded-3xl border border-gray-100 shadow-sm group",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"w-20 h-20 rounded-2xl overflow-hidden bg-gray-100 flex-shrink-0",children:s.jsx("img",{src:O.imageUrl||void 0,alt:"",className:"w-full h-full object-cover"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h4",{className:"text-sm font-black text-gray-900 truncate uppercase tracking-tight",children:O.title}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase mt-1",children:O.venue}),s.jsxs("div",{className:"flex items-center justify-between mt-3",children:[s.jsxs("span",{className:"text-xs font-black text-accent",children:["UGX ",O.price.toLocaleString()]}),s.jsxs("span",{className:"text-[9px] font-black px-2 py-1 bg-gray-100 rounded-lg text-gray-500",children:[O.remainingQuantity,"/",O.totalQuantity," LEFT"]})]})]})]}),s.jsxs("div",{className:"flex gap-2 mt-4 opacity-0 group-hover:opacity-100 transition-all",children:[s.jsx("button",{onClick:()=>{ea(O),De(O.title),rr(O.description),ze(O.price.toString());const ue=(()=>{const Ce=O.eventDate;if(!Ce)return"";const ut=typeof Ce.toDate=="function"?Ce.toDate():Ce instanceof Date?Ce:Ce.seconds?new Date(Ce.seconds*1e3):new Date(Ce);try{return ut.toISOString().slice(0,16)}catch{return""}})();Er(ue),_r(O.venue),Be(O.totalQuantity.toString()),ur(O.category),Do(O.imageUrl||""),zt(O.link||"")},className:"flex-1 py-2 bg-blue-50 text-blue-600 rounded-xl text-[10px] font-black uppercase tracking-widest hover:bg-blue-600 hover:text-white transition-all",children:"Edit"}),s.jsx("button",{onClick:()=>Qo(O.id),className:"flex-1 py-2 bg-blue-50 text-black rounded-xl text-[10px] font-black uppercase tracking-widest hover:bg-black hover:text-white transition-all",children:"Delete"})]})]},O.id))]})]})}):a==="ticket-purchases"&&t?s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"bg-white p-8 rounded-[2.5rem] border border-gray-100 shadow-sm",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest mb-1",children:"Total Tickets Sold"}),s.jsx("h3",{className:"text-2xl font-black text-gray-900",children:Xn.totalTicketsSold})]}),s.jsxs("div",{className:"bg-white p-8 rounded-[2.5rem] border border-gray-100 shadow-sm",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest mb-1",children:"Total Revenue"}),s.jsxs("h3",{className:"text-2xl font-black text-accent",children:["UGX ",Xn.totalRevenue.toLocaleString()]})]}),s.jsxs("div",{className:"bg-white p-8 rounded-[2.5rem] border border-gray-100 shadow-sm",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest mb-1",children:"Recent Transactions"}),s.jsx("h3",{className:"text-2xl font-black text-gray-900",children:Ct.length})]})]}),s.jsxs("div",{className:"bg-gray-50/70 p-6 rounded-[2.5rem] border border-gray-150 space-y-4 text-left",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-400 shrink-0"}),s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-gray-500 font-mono",children:"Simulated Gate Scan & Barcode Lookup"})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[s.jsx("input",{type:"text",placeholder:"Type or paste scanned Purchase ID (e.g. h6SndA4v...)",value:fi,onChange:O=>_s(O.target.value),className:"flex-1 px-6 py-3.5 bg-white border border-gray-250 rounded-2xl text-xs font-bold outline-none focus:border-red-600 transition-all font-mono"}),s.jsx("button",{onClick:()=>{if(!fi.trim()){he.error("Please enter a ticket ID to query!");return}const O=Ct.find(ue=>ue.id===fi.trim()||ue.id.slice(-6).toLowerCase()===fi.trim().toLowerCase());O?(he.success(`Ticket found: ${O.ticketTitle}!`),Js(O)):(he.error("Ticket purchase record not found in data sheets!"),Js(null))},className:"px-8 py-3.5 bg-black text-white hover:bg-red-655 rounded-2xl text-[10px] font-black uppercase tracking-widest transition-colors cursor-pointer",children:"Lookup Code"})]}),xn&&s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-150 shadow-xs mt-3 flex flex-col md:flex-row items-start md:items-center justify-between gap-4 animate-in fade-in slide-in-from-top-2 duration-200",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("span",{className:"text-[8px] font-black text-gray-400 uppercase tracking-widest font-mono",children:"Scanned Ticket Match"}),s.jsx("h4",{className:"text-sm font-black text-gray-950 uppercase tracking-tight leading-tight",children:xn.ticketTitle}),s.jsxs("div",{className:"flex flex-wrap gap-2 text-[9px] font-bold text-gray-500 uppercase mt-1",children:[s.jsxs("span",{children:["Guest: ",s.jsx("strong",{className:"text-gray-900",children:xn.userName})]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Qty: ",s.jsxs("strong",{className:"text-gray-900",children:[xn.quantity," Pax"]})]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Code: ",s.jsxs("strong",{className:"text-gray-900 font-mono select-all",children:["#",xn.id.substring(0,10),"..."]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-3 bg-gray-50 px-4 py-2.5 rounded-2xl border border-gray-100 shrink-0",children:[s.jsx("input",{type:"checkbox",id:"dashboard-scanned-taken",checked:!!xn.taken||!!xn.used,onChange:async()=>{const O=!(xn.taken||xn.used);try{await Ir(st(fe,"purchases",xn.id),{taken:O,used:O}),Js(ue=>ue?{...ue,taken:O,used:O}:null),O?(await dn(nt(fe,"notifications"),{userId:xn.userId,title:`✔️ Ticket Ticked & Used: ${xn.ticketTitle}`,message:`Your entry pass (ID #${xn.id.slice(-6).toUpperCase()}) has been officially scanned and ticked as used. Enjoy the event!`,used:!1,createdAt:new Date,type:"entrance_checkin",code:xn.id}),he.success("Ticket marked as used! Buyer's inbox is updated.",{icon:"✔️"})):he.success("Entry pass reactivated.")}catch(ue){console.error("Dashboard verify gate error:",ue),he.error("Verify failed: "+ue.message)}},className:"w-4.5 h-4.5 rounded border-gray-300 text-red-650 cursor-pointer accent-red-650"}),s.jsx("label",{htmlFor:"dashboard-scanned-taken",className:"text-[10px] font-black uppercase tracking-wider text-gray-950 cursor-pointer select-none",children:xn.taken||xn.used?"✔️ TICKED & USED":"✉️ MARK USED / TICKED"})]})]})]}),s.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-center justify-between bg-white p-5 rounded-[2rem] border border-gray-100 shadow-sm text-left",children:[s.jsxs("div",{className:"relative w-full lg:max-w-md",children:[s.jsx("input",{type:"text",value:cs,onChange:O=>ji(O.target.value),placeholder:"Search by name, email, event title or ticket ID...",className:"w-full pl-6 pr-10 py-3 bg-gray-50/50 border border-gray-200 focus:border-red-650 rounded-2xl text-xs font-bold outline-none transition-all placeholder:text-gray-400"}),cs&&s.jsx("button",{onClick:()=>ji(""),className:"absolute right-3.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-650 font-black text-[10px] uppercase tracking-wider",children:"Clear"})]}),s.jsx("div",{className:"flex items-center gap-1.5 p-1 bg-gray-105 border border-gray-150 rounded-2xl w-full lg:w-auto shrink-0 overflow-x-auto",children:[{key:"all",label:"All Bookings"},{key:"unclaimed",label:"🎫 Active / Unused"},{key:"taken",label:"✔️ Ticked / Used"}].map(O=>s.jsx("button",{type:"button",onClick:()=>On(O.key),className:Ge("px-4 py-2 rounded-xl text-[10px] font-black uppercase tracking-wider transition-all cursor-pointer whitespace-nowrap",Kn===O.key?"bg-white text-gray-950 shadow-xs":"text-gray-550 hover:text-gray-900"),children:O.label},O.key))})]}),s.jsx("div",{className:"bg-white rounded-[2.5rem] border border-gray-100 shadow-sm overflow-hidden",children:s.jsxs("table",{className:"w-full text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-gray-50 border-b border-gray-100",children:[s.jsx("th",{className:"px-8 py-4 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Transaction ID"}),s.jsx("th",{className:"px-8 py-4 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Customer"}),s.jsx("th",{className:"px-8 py-4 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Event"}),s.jsx("th",{className:"px-8 py-4 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Qty"}),s.jsx("th",{className:"px-8 py-4 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Amount"}),s.jsx("th",{className:"px-8 py-4 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Date"}),s.jsx("th",{className:"px-8 py-4 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Taken / Checked In"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-50",children:hu.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"text-center py-12 text-xs font-bold text-gray-400 uppercase tracking-wider select-none font-mono",children:"No booking transactions match your search filter criteria."})}):hu.map(O=>{const ue=!!(O.taken||O.used);return s.jsxs("tr",{onClick:()=>wh(O),className:Ge("transition-all cursor-pointer hover:bg-red-50/20 active:bg-gray-100/60 select-none",ue?"bg-green-50/15":"hover:bg-gray-50/80"),title:"Click anywhere on this row to tick/untick this pass",children:[s.jsx("td",{className:"px-8 py-4 text-[10px] font-black text-gray-900 uppercase font-mono",children:s.jsxs("span",{className:Ge(ue?"line-through text-gray-400":""),children:["#",O.id.slice(-6).toUpperCase()]})}),s.jsxs("td",{className:"px-8 py-4",children:[s.jsx("p",{className:Ge("text-sm font-bold text-gray-900",ue&&"line-through text-gray-450"),children:O.userName}),s.jsx("p",{className:"text-[10px] text-gray-400 truncate max-w-[200px]",children:O.userEmail})]}),s.jsx("td",{className:Ge("px-8 py-4 text-sm font-bold text-gray-900 uppercase tracking-tight",ue&&"line-through text-gray-400"),children:O.ticketTitle}),s.jsx("td",{className:Ge("px-8 py-4 text-sm font-black text-gray-900",ue&&"text-gray-400"),children:O.quantity}),s.jsxs("td",{className:Ge("px-8 py-4 text-sm font-black text-accent",ue&&"text-gray-400"),children:["UGX ",O.totalAmount.toLocaleString()]}),s.jsx("td",{className:"px-8 py-4 text-[10px] font-bold text-gray-400 uppercase",children:O.purchaseDate instanceof wn?O.purchaseDate.toDate().toLocaleString():"Recently"}),s.jsx("td",{className:"px-8 py-4 text-[10px]",onClick:Ce=>Ce.stopPropagation(),children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:ue,onChange:()=>wh(O),className:"w-4 h-4 rounded border-gray-350 text-red-650 focus:ring-red-655 accent-red-600 cursor-pointer",id:`taken-${O.id}`}),s.jsx("label",{htmlFor:`taken-${O.id}`,onClick:Ce=>{Ce.stopPropagation(),wh(O)},className:Ge("text-[9px] font-black uppercase tracking-wider select-none cursor-pointer",ue?"text-green-600 font-mono":"text-gray-400 font-mono"),children:ue?"✔️ Ticked":"Mark Used"})]})})]},O.id)})})]})})]}):a==="polls"&&t?s.jsxs("div",{className:"max-w-4xl mx-auto space-y-8",children:[s.jsxs("div",{className:"bg-white p-10 rounded-[2.5rem] border border-gray-100 shadow-sm",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900",children:"Manage Campus Poll"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-1",children:"Create or reset the active university poll"})]}),s.jsxs("form",{onSubmit:vh,className:"space-y-8",children:[s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Question"}),s.jsx("input",{type:"text",value:ge,onChange:O=>we(O.target.value),placeholder:"e.g., Who is your favorite Guild Presidential candidate?",className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl text-sm font-bold focus:bg-white focus:border-accent outline-none transition-all",required:!0})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest flex items-center justify-between",children:["Options",s.jsx("button",{type:"button",onClick:()=>Ke([...Me,""]),className:"text-accent hover:underline",children:"Add Option"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Me.map((O,ue)=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:O,onChange:Ce=>{const ut=[...Me];ut[ue]=Ce.target.value,Ke(ut)},placeholder:`Option ${ue+1}`,className:"flex-1 px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl text-sm font-bold focus:bg-white focus:border-accent outline-none transition-all",required:!0}),Me.length>2&&s.jsx("button",{type:"button",onClick:()=>Ke(Me.filter((Ce,ut)=>ut!==ue)),className:"p-4 text-gray-300 hover:text-accent transition-colors",children:s.jsx(Es,{size:18})})]},ue))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Poll Status"}),s.jsx("div",{className:"flex gap-4",children:["active","closed"].map(O=>s.jsx("button",{type:"button",onClick:()=>lt(O),className:Ge("flex-1 py-4 px-6 rounded-2xl text-[10px] font-black uppercase tracking-widest border-2 transition-all",Je===O?"border-accent bg-blue-50 text-accent":"border-gray-100 text-gray-400 hover:border-gray-200"),children:O},O))})]})]})," ",s.jsxs("button",{type:"submit",disabled:jt,className:"w-full py-5 bg-accent text-white rounded-2xl text-xs font-black uppercase tracking-[0.2em] shadow-xl shadow-accent/20 hover:bg-accent-700 transition-all disabled:opacity-50 flex items-center justify-center gap-2",children:[jt?s.jsx(vn,{className:"animate-spin",size:18}):s.jsx(Rl,{size:18}),jt?"Processing...":"Update Campus Poll"]})]}),s.jsxs("div",{className:"mt-12 p-6 bg-blue-50 rounded-2xl border border-blue-100 flex items-start gap-4",children:[s.jsx(Su,{className:"text-accent shrink-0",size:20}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] font-black text-accent uppercase tracking-widest leading-none",children:"Safe Storage Archiving"}),s.jsx("p",{className:"text-[10px] font-bold text-accent/80 uppercase tracking-tight leading-tight",children:"This action will post a brand-new poll and close previous active ones. Existing votes for old polls are securely preserved and stored in historical archives."})]})]})]}),s.jsxs("div",{id:"admin-debates-section",className:"bg-white p-10 rounded-[2.5rem] border border-gray-100 shadow-sm space-y-8",children:[s.jsxs("div",{className:"border-b border-gray-100 pb-5",children:[s.jsx("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900",children:"Manage Public Debates"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-1",children:"Create debate topics (link to external discussion or internal built-in discussion threads)"})]}),s.jsxs("form",{onSubmit:Fn,className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Debate Topic Title"}),s.jsx("input",{type:"text",value:k,onChange:O=>L(O.target.value),placeholder:"e.g. Is remote learning more effective than in-person lectures?",className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl text-sm font-bold focus:bg-white focus:border-accent outline-none transition-all",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Banner Image URL"}),s.jsx("input",{type:"text",value:Ee,onChange:O=>Ue(O.target.value),placeholder:"Leave blank for smart defaults",className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl text-sm font-bold focus:bg-white focus:border-accent outline-none transition-all"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Description / Content"}),s.jsx("textarea",{value:H,onChange:O=>ne(O.target.value),placeholder:"Brief introduction or guidelines for this debate thread...",rows:3,className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl text-sm font-bold focus:bg-white focus:border-accent outline-none transition-all"})]}),s.jsxs("div",{className:"flex items-center gap-3 p-4 bg-gray-50 rounded-2xl border border-gray-100",children:[s.jsx("input",{type:"checkbox",id:"debateIsExternal",checked:wt,onChange:O=>xr(O.target.checked),className:"w-4.5 h-4.5 text-accent border-gray-300 rounded focus:ring-accent accent-accent"}),s.jsx("label",{htmlFor:"debateIsExternal",className:"text-xs font-black uppercase tracking-wider text-gray-700 select-none cursor-pointer",children:"This is an external discussion link (redirect user to external URL)"})]}),wt&&s.jsxs("div",{className:"space-y-2 pt-2 animate-fade-in",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"External Link URL"}),s.jsx("input",{type:"text",value:mt,onChange:O=>Vt(O.target.value),placeholder:"https://example.com/discussion",className:"w-full px-6 py-4 bg-gray-50 border border-gray-150 rounded-2xl text-sm font-bold focus:bg-white focus:border-accent outline-none transition-all",required:wt})]}),s.jsxs("button",{type:"submit",disabled:$r,className:"w-full py-5 bg-stone-950 text-white rounded-2xl text-xs font-black uppercase tracking-[0.2em] shadow-xl hover:bg-black transition-all disabled:opacity-50 flex items-center justify-center gap-2 cursor-pointer",children:[$r?s.jsx(vn,{className:"animate-spin",size:18}):s.jsx(Ri,{size:18}),$r?"Publishing...":"Publish Public Debate Topic"]})]}),s.jsx("div",{className:"space-y-4 pt-6",children:s.jsxs("div",{className:"border-t border-gray-100 pt-6",children:[s.jsxs("h4",{className:"text-sm font-black uppercase tracking-wider text-gray-900 mb-4",children:["Active Debates (",lr.length,")"]}),lr.length===0?s.jsx("p",{className:"text-xs font-bold text-gray-400 uppercase tracking-widest text-center py-4",children:"No active debates listed yet."}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:lr.map(O=>s.jsxs("div",{className:"p-4 bg-gray-50 rounded-2xl border border-gray-100 flex gap-3 relative justify-between items-start min-w-0",children:[s.jsxs("div",{className:"flex gap-2.5 items-start min-w-0",children:[s.jsx("img",{src:O.bannerUrl||void 0,alt:"",className:"w-12 h-12 rounded-xl object-cover border border-gray-150 shrink-0",referrerPolicy:"no-referrer"}),s.jsxs("div",{className:"min-w-0 text-left",children:[s.jsx("span",{className:`text-[8px] font-black uppercase tracking-wider px-2 py-0.5 rounded ${O.isExternal?"bg-orange-50 text-orange-600 border border-orange-100":"bg-green-50 text-green-600 border border-green-100"}`,children:O.isExternal?"External":"Built-in"}),s.jsx("h5",{className:"text-xs font-black text-gray-950 mt-1 truncate uppercase tracking-tight",children:O.title}),s.jsx("p",{className:"text-[9px] text-gray-500 line-clamp-1 mt-0.5",children:O.description||"No description provided."})]})]}),s.jsx("button",{onClick:()=>Mn(O.id),className:"p-2 text-gray-400 hover:text-red-650 hover:bg-red-50 rounded-xl transition-all cursor-pointer shrink-0",title:"Delete debate topic",children:s.jsx(Es,{size:16})})]},O.id))})]})})]})]}):a==="pinned-board"&&t?s.jsx("div",{className:"max-w-4xl mx-auto space-y-8",children:s.jsxs("div",{className:"bg-white p-10 rounded-[2.5rem] border border-gray-100 shadow-sm",children:[s.jsxs("div",{className:"mb-8 flex items-center justify-between border-b border-gray-50 pb-6",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 flex items-center gap-2",children:[s.jsx(j0,{className:"text-accent stroke-[3px]",size:20}),s.jsx("span",{children:"Pinned Announcements Board"})]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-1",children:"Supercharge articles, events, or programs with a high-impact sliding announcement"})]}),s.jsxs("div",{className:"flex items-center gap-3 bg-gray-50 px-4 py-2 rounded-2xl border border-gray-100",children:[s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400",children:"Status"}),s.jsx("button",{type:"button",onClick:()=>xh(!_l),className:Ge("relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-250 ease-in-out outline-none",_l?"bg-accent":"bg-gray-250"),children:s.jsx("span",{className:Ge("pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-250 ease-in-out",_l?"translate-x-5":"translate-x-0")})}),s.jsx("span",{className:Ge("text-[9px] font-black uppercase tracking-widest",_l?"text-accent":"text-gray-400"),children:_l?"ACTIVE":"INACTIVE"})]})]}),s.jsxs("form",{onSubmit:Is,className:"space-y-8",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1",children:"Announcement Title"}),s.jsx("input",{type:"text",value:Fm,onChange:O=>Ic(O.target.value),placeholder:"e.g. 🎉 SPECIAL FREE TICKET GIVEAWAY!",className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl text-sm font-bold focus:bg-white focus:border-accent outline-none transition-all",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1",children:"Target Action Link (Clickable Destination)"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"url",value:Hm,onChange:O=>uu(O.target.value),placeholder:"https://campus-eye.com/tickets/giveaway-id",className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl text-sm font-bold focus:bg-white focus:border-accent outline-none transition-all pl-12"}),s.jsx(wd,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:18})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1",children:"Display duration on page load (seconds)"}),s.jsx("input",{type:"number",min:"1",max:"60",value:qm,onChange:O=>ic(Number(O.target.value)||5),placeholder:"Default is 5 seconds",className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl text-sm font-bold focus:bg-white focus:border-accent outline-none transition-all",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 block",children:"Live Streaming / Embed Option"}),s.jsxs("div",{className:"flex items-center gap-3 p-4 bg-gray-50 border border-gray-100 rounded-2xl",children:[s.jsx("input",{type:"checkbox",id:"pinned-is-live",checked:sd,onChange:O=>Hf(O.target.checked),className:"w-4 h-4 text-red-600 border-gray-300 rounded focus:ring-red-500 cursor-pointer"}),s.jsx("label",{htmlFor:"pinned-is-live",className:"text-xs font-black text-gray-700 uppercase tracking-wider cursor-pointer select-none",children:"Enable Live Embed / Stream Page"})]})]})]}),sd&&s.jsx("div",{className:"grid grid-cols-1 gap-6 animate-fade-in",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-red-650 uppercase tracking-widest ml-1 block",children:"Live Streaming / IFrame Embed URL"}),s.jsx("input",{type:"url",value:sc,onChange:O=>ac(O.target.value),placeholder:"e.g., https://www.youtube.com/embed/... or any dynamic webpage embed code link",className:"w-full px-6 py-4 bg-red-50/20 border border-red-200 rounded-2xl text-sm font-bold focus:bg-white focus:border-red-650 outline-none transition-all text-red-950 placeholder-red-300",required:sd}),s.jsx("span",{className:"text-[9px] text-gray-400 block ml-1 uppercase font-black tracking-widest",children:"🛡️ If enabled, a reside interactive preview will load instead of the static mock picture. Let clicked, the stream pops up fullscreen!"})]})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1",children:"Short Description / Subtitle"}),s.jsx("textarea",{value:Tc,onChange:O=>$m(O.target.value),placeholder:"e.g. Claim free registration passes to the upcoming Guild Presidential Debate! Only for verified campus citizens.",className:"w-full px-6 py-4 bg-gray-50 border border-gray-100 rounded-2xl text-sm font-bold focus:bg-white focus:border-accent outline-none transition-all min-h-[90px] resize-none"})]}),s.jsxs("div",{className:"space-y-4 pt-4 border-t border-gray-50",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 block",children:"Accompanying Image / Photo Asset"}),s.jsx("span",{className:"text-[9px] font-medium text-gray-400 uppercase tracking-wider",children:"Fast Cloud Image Storage"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"md:col-span-2 relative",children:[s.jsx("input",{type:"file",accept:"image/*",onChange:O=>{var Ce;const ue=(Ce=O.target.files)==null?void 0:Ce[0];ue&&(od(!0),ia(ue,id,od))},className:"hidden",id:"pinned-banner-image"}),s.jsx("label",{htmlFor:"pinned-banner-image",className:Ge("flex flex-col items-center justify-center aspect-[16/6] rounded-2xl border-2 border-dashed transition-all cursor-pointer bg-gray-50",nc?"border-accent":"border-gray-150 hover:border-accent hover:bg-white"),children:Wm?s.jsxs("div",{className:"text-center p-4",children:[s.jsx(vn,{className:"mx-auto text-accent mb-2 animate-spin",size:28}),s.jsx("p",{className:"text-[10px] font-black text-accent uppercase tracking-widest block leading-none",children:"Uploading Asset..."})]}):nc?s.jsxs("div",{className:"w-full h-full relative rounded-2xl overflow-hidden group",children:[s.jsx("img",{src:nc,className:"w-full h-full object-cover animate-fade-in",alt:"Pinned Asset",referrerPolicy:"no-referrer"}),s.jsx("div",{className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center text-white",children:s.jsxs("span",{className:"text-[10px] font-black uppercase tracking-widest flex items-center gap-1",children:[s.jsx(j0,{size:14})," Change Announcement Photo"]})})]}):s.jsxs(s.Fragment,{children:[s.jsx(yu,{className:"text-gray-400 mb-2",size:28}),s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest block text-center leading-none",children:"Upload Announcement Photo"})]})})]}),s.jsxs("div",{className:"bg-gray-50 border border-gray-100 p-5 rounded-2xl flex flex-col justify-center space-y-3 shadow-inner",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-gray-400 block mb-1",children:"Direct Asset URI"}),s.jsx("input",{type:"text",value:nc,onChange:O=>id(O.target.value),placeholder:"Or paste asset address here...",className:"w-full px-3 py-2 bg-white border border-gray-100 text-[10px] text-gray-700 font-mono rounded-lg outline-none focus:border-accent"})]}),s.jsx("p",{className:"text-[8px] text-gray-400 font-bold uppercase tracking-wider leading-relaxed",children:"This image resides inside the sliding high-attention banner replacing the top banner briefly with streamlined design specs."})]})]})]}),s.jsx("div",{className:"border-t border-gray-50 pt-8 mt-8",children:s.jsxs("button",{type:"submit",disabled:Gm,className:"w-full py-5 bg-accent text-white rounded-2xl text-xs font-black uppercase tracking-[0.2em] shadow-xl shadow-accent/20 hover:bg-accent-700 transition-all disabled:opacity-50 flex items-center justify-center gap-2",children:[Gm?s.jsx(vn,{className:"animate-spin",size:18}):s.jsx(Rl,{size:18}),Gm?"Saving changes...":"Publish Pinned Announcement"]})})]}),s.jsxs("div",{className:"mt-12 pt-8 border-t border-gray-100 space-y-6",children:[s.jsxs("div",{children:[s.jsxs("h4",{className:"text-sm font-black uppercase tracking-wider text-gray-950 flex items-center gap-2",children:[s.jsx(j0,{size:16,className:"text-red-650"}),s.jsxs("span",{children:["Active database broadcasts (",ad.length,")"]})]}),s.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-widest mt-0.5",children:"Admins can review, monitor and delete active broadcasts on the campus banner"})]}),ad.length===0?s.jsxs("div",{className:"p-10 border rounded-2xl text-center bg-gray-50 border-gray-100 text-gray-400 select-none",children:[s.jsx("p",{className:"text-xs font-bold uppercase tracking-wider",children:"No active broadcasts registered in database."}),s.jsx("p",{className:"text-[9px] uppercase tracking-widest mt-1",children:"Submit the form above to post your first broadcast."})]}):s.jsx("div",{className:"grid grid-cols-1 gap-4",children:ad.map(O=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-white border border-gray-150 rounded-2xl hover:border-red-650/40 transition-all shadow-xs",children:[s.jsxs("div",{className:"flex items-center gap-4 min-w-0 flex-1",children:[O.imageUrl?s.jsx("img",{src:O.imageUrl,alt:"",className:"w-12 h-12 rounded-xl object-cover border border-gray-100",referrerPolicy:"no-referrer"}):s.jsx("div",{className:"w-12 h-12 bg-red-50 text-red-600 rounded-xl flex items-center justify-center font-bold",children:s.jsx(Ru,{size:18})}),s.jsxs("div",{className:"min-w-0 pr-4 text-left",children:[s.jsx("h5",{className:"text-xs font-black text-gray-900 truncate uppercase tracking-tight",children:O.title}),s.jsx("p",{className:"text-[10px] text-gray-500 line-clamp-1 mt-0.5",children:O.description||"No description provided."}),s.jsxs("span",{className:"text-[8px] font-black font-mono text-gray-400 uppercase tracking-widest block mt-1",children:[O.durationSeconds||5,"s • link: ",O.link?"configured":"none"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:async()=>{try{const ue=st(fe,"pinned_announcements",O.id);await Ir(ue,{active:!O.active}),O.active||await Gn(st(fe,"settings","pinned"),{title:O.title,description:O.description||"",link:O.link||"",imageUrl:O.imageUrl||"",active:!0,durationSeconds:O.durationSeconds||5,isLiveStream:!!O.isLiveStream,liveEmbedUrl:O.liveEmbedUrl||"",updatedAt:zr()},{merge:!0}),he.success(`Announcement set to ${O.active?"Inactive":"Active"}`)}catch(ue){he.error("Failed to update status: "+ue.message)}},className:Ge("text-[8px] font-mono font-black uppercase px-2 py-1.5 rounded-lg cursor-pointer transition-all active:scale-95 border",O.active?"bg-green-50 text-green-700 border-green-200 hover:bg-green-150 hover:text-green-800":"bg-gray-50 text-gray-400 border-gray-200 hover:bg-gray-100 hover:text-gray-600"),title:"Click to toggle active status",children:O.active?"● ACTIVE":"○ INACTIVE"}),s.jsx("button",{onClick:()=>Ym(O.id),className:"p-2 text-gray-400 hover:text-red-650 hover:bg-red-50 rounded-lg transition-colors cursor-pointer",title:"Delete announcement",children:s.jsx(Es,{size:16})})]})]},O.id))})]}),s.jsxs("div",{className:"mt-8 p-6 bg-blue-50/70 border border-blue-100 rounded-2xl flex items-start gap-4",children:[s.jsx(Ru,{className:"text-accent shrink-0 animate-bounce",size:20}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] font-black text-accent uppercase tracking-widest leading-none",children:"Visual Carousel Mechanics"}),s.jsx("p",{className:"text-[10px] font-medium text-accent/80 uppercase tracking-tight leading-relaxed",children:"If active, this announcement slides overlay style onto the first banner rotation on the homepage. To support clean aesthetics, it has beautifully rounded edges, custom colored border halo, slides in with Streamlined fluid transitions, displays for exactly 2 seconds, and then automatically returns to the original carousel."})]})]})]})}):a==="manage-posts"&&t?s.jsxs("div",{className:"space-y-6 max-w-4xl mx-auto animate-fade-in text-left",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center border-b border-gray-105 pb-4 gap-3",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 flex items-center gap-2",children:[s.jsx(Ri,{className:"text-accent stroke-[3px]",size:19}),s.jsx("span",{children:"Manage Lounge Posts"})]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-1",children:"Review, moderate, and delete student-generated posts in the lounge"})]}),s.jsxs("div",{className:"text-[10px] bg-red-50 text-red-750 px-3 py-1.5 border border-red-150/50 rounded-xl font-mono shrink-0 w-fit",children:["Total Posts: ",F.length]})]}),F.length===0?s.jsxs("div",{className:"bg-white p-20 rounded-[2.5rem] border border-gray-100 shadow-sm text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-gray-50 text-gray-450 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx(Ri,{size:32})}),s.jsx("h4",{className:"text-lg font-sans font-extrabold text-gray-900 uppercase tracking-tight",children:"No Posts Found"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-2",children:"Lounge database is currently empty."})]}):s.jsx("div",{className:"grid grid-cols-1 gap-4",children:F.map(O=>{var ue,Ce,ut;return s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-sm hover:shadow-md transition-all flex flex-col md:flex-row gap-5",children:[s.jsxs("div",{className:"flex-1 space-y-3 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[O.authorPhotoURL?s.jsx("img",{src:O.authorPhotoURL,className:"w-8 h-8 rounded-full object-cover border border-gray-250 shrink-0",referrerPolicy:"no-referrer"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-red-100 text-red-750 flex items-center justify-center font-black text-xs shrink-0 select-none",children:((ue=O.authorName)==null?void 0:ue.charAt(0))||"P"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-[10.5px] font-black uppercase tracking-tight text-gray-950 block truncate",children:O.authorName||"Peer"}),s.jsxs("span",{className:"text-[8px] font-semibold text-gray-450 block uppercase font-mono tracking-wider",children:["ID: #",O.id.slice(-6).toUpperCase()]})]})]}),s.jsx("p",{className:"text-xs text-gray-800 font-sans leading-relaxed whitespace-pre-wrap",children:O.content}),O.imageUrl&&s.jsx("div",{className:"max-w-xs rounded-xl overflow-hidden border border-gray-150 max-h-40 bg-gray-50",children:s.jsx("img",{src:O.imageUrl,className:"w-full h-full object-cover",referrerPolicy:"no-referrer"})})]}),(t||((ut=(Ce=Ne.currentUser)==null?void 0:Ce.email)==null?void 0:ut.toLowerCase())==="atwiinevictor2@gmail.com")&&s.jsx("div",{className:"shrink-0 flex md:flex-col items-end justify-between md:justify-center gap-3",children:s.jsx("button",{onClick:async()=>{if(!t){he.error("Access Denied: Only administrators can delete posts.");return}if(window.confirm("Are you sure you want to delete this lounge post? This action is permanent."))try{await ai(st(fe,"posts",O.id)),he.success("Lounge post deleted successfully.")}catch(Yt){he.error("Failed to delete lounge post: "+Yt.message)}},className:"p-3 bg-red-50 hover:bg-red-650 text-red-650 hover:text-white rounded-xl transition-all cursor-pointer shadow-xs active:scale-95",title:"Delete Post (Master Admin)",children:s.jsx(Es,{size:16})})})]},O.id)})})]}):a==="custom-links"&&t?s.jsxs("div",{className:"space-y-8 max-w-4xl mx-auto animate-fade-in text-left",children:[s.jsx("div",{className:"flex border-b border-gray-100 pb-4 justify-between items-center",children:s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 flex items-center gap-2",children:[s.jsx(wd,{className:"text-accent stroke-[3px]",size:19}),s.jsx("span",{children:"Global Menu Pages Manager"})]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-1",children:"Add, edit, or delete external links that render as immersive full-screen popups in every user's menu."})]})}),s.jsxs("div",{className:"bg-white p-6 md:p-8 rounded-[2rem] border border-gray-105 shadow-sm space-y-4",children:[s.jsx("h4",{className:"text-sm font-sans font-extrabold uppercase tracking-tight text-gray-900 border-b border-gray-50 pb-2",children:pt?"⚡ Modify Existing Page":"➕ Add Custom Dynamic Page link"}),s.jsxs("form",{onSubmit:ax,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-450 block",children:"Page Display Name"}),s.jsx("input",{required:!0,type:"text",value:K,onChange:O=>me(O.target.value),placeholder:"e.g. Student Varsity Store",className:"w-full px-4 py-3 bg-gray-50 border border-gray-250 rounded-xl outline-none text-sm font-bold placeholder:text-gray-300 focus:border-red-600 focus:bg-white transition-all"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-450 block",children:"Redirect / Iframe Destination URL"}),s.jsx("input",{required:!0,type:"url",value:re,onChange:O=>le(O.target.value),placeholder:"https://example.com/varsity-store",className:"w-full px-4 py-3 bg-gray-50 border border-gray-250 rounded-xl outline-none text-sm font-bold placeholder:text-gray-300 focus:border-red-600 focus:bg-white transition-all"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-450 block",children:"SVG Icon Code or Preset Name (e.g. HTML SVG or SVG path code)"}),s.jsx("textarea",{value:ve,onChange:O=>je(O.target.value),placeholder:"Paste your SVG tag structure or path code here, or tap preset clickers...",rows:2,className:"w-full px-4 py-3 bg-gray-50 border border-gray-250 rounded-xl outline-none text-xs font-mono placeholder:text-gray-300 focus:border-red-600 focus:bg-white transition-all resize-none"}),s.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:[{label:"⭐ Star",code:''},{label:"🔥 Hot",code:''},{label:"🏆 Trophy",code:''},{label:"🎓 Academy",code:''},{label:"🎫 Ticket",code:''}].map(O=>s.jsx("button",{type:"button",onClick:()=>je(O.code),className:"px-2 py-1 bg-gray-100 hover:bg-black hover:text-white rounded-md text-[8px] font-black uppercase tracking-wider transition-all cursor-pointer border border-transparent hover:border-gray-300",children:O.label},O.label))})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 bg-gray-50/50 p-4 rounded-2xl border border-gray-150/40",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-red-650 block",children:"Experience Type / Media Format"}),s.jsxs("select",{value:Ve,onChange:O=>Z(O.target.value),className:"w-full px-4 py-3 bg-white border border-gray-250 rounded-xl outline-none text-xs font-bold focus:border-red-600 transition-all cursor-pointer",children:[s.jsx("option",{value:"link",children:"📎 Standard Embedded Page (IFrame Resource)"}),s.jsx("option",{value:"youtube",children:"🔴 YouTube Live Stream / Video Player (Theatre Layout)"}),s.jsx("option",{value:"custom_stream",children:"📺 Other Live Stream or Broadcast URL"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 pt-4 md:pt-6 pl-1",children:[s.jsx("input",{type:"checkbox",id:"custom-page-is-pinned",checked:ae,onChange:O=>qe(O.target.checked),className:"w-4 h-4 text-red-650 border-gray-300 rounded focus:ring-red-500 cursor-pointer accent-red-650"}),s.jsx("label",{htmlFor:"custom-page-is-pinned",className:"text-[10px] font-black text-gray-700 uppercase tracking-wider cursor-pointer select-none",children:"📌 Pin as Live Stream Spotlight post"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-450 block",children:"Short Overview description (shown beneath player)"}),s.jsx("input",{type:"text",value:se,onChange:O=>xe(O.target.value),placeholder:"e.g. Catch the official live stream covering our campus tech marathon finals.",className:"w-full px-4 py-3 bg-gray-50 border border-gray-250 rounded-xl outline-none text-sm font-bold placeholder:text-gray-300 focus:border-red-600 focus:bg-white transition-all"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"submit",disabled:jt,className:"flex-1 py-3 bg-black hover:bg-red-650 text-white text-[10px] font-black uppercase tracking-widest rounded-xl transition-all disabled:opacity-50 flex items-center justify-center gap-2 cursor-pointer",children:jt?"Processing...":pt?"Update Page Link":"Deploy Page to Menu"}),pt&&s.jsx("button",{type:"button",onClick:()=>{Fe(null),me(""),le("")},className:"px-4 py-3 bg-gray-100 hover:bg-gray-200 text-gray-750 text-[10px] font-black uppercase tracking-widest rounded-xl transition-all cursor-pointer",children:"Cancel"})]})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-450",children:"Configured Global Pages"}),J.length===0?s.jsxs("div",{className:"bg-white py-12 px-6 rounded-3xl border border-gray-100 text-center text-gray-400",children:[s.jsx(wd,{size:24,className:"mx-auto text-gray-300 mb-2"}),s.jsx("p",{className:"text-[10px] font-bold uppercase tracking-wider",children:"No custom pages are currently configured for user menus."})]}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:J.map(O=>{var ut;const Ce=Date.now()-((ut=O.createdAt)!=null&&ut.seconds?O.createdAt.seconds*1e3:Date.now())<10080*60*1e3;return s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-gray-105 shadow-xs flex flex-col justify-between gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h5",{className:"font-extrabold text-sm text-gray-900",children:O.name}),Ce&&s.jsx("span",{className:"bg-red-100 text-red-750 px-2 py-0.5 rounded-full text-[8px] font-extrabold uppercase",children:"New"})]}),s.jsx("p",{className:"text-[10px] text-gray-400 font-mono truncate select-all",children:O.url})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-50 pt-3",children:[s.jsx("button",{onClick:()=>Ob(O),className:"p-2.5 bg-gray-50 hover:bg-gray-100 text-gray-700 hover:text-gray-950 rounded-lg transition-all cursor-pointer border border-gray-150",title:"Edit Custom Page",children:s.jsx(Ed,{size:12})}),s.jsx("button",{onClick:()=>ox(O.id),className:"p-2.5 bg-red-50 hover:bg-red-100 text-red-650 rounded-lg transition-all cursor-pointer border border-red-150",title:"Delete Custom Page",children:s.jsx(Es,{size:12})})]})]},O.id)})})]})]}):a==="feedback-inbox"&&t?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"border-b border-gray-100 pb-4 max-w-3xl",children:[s.jsxs("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 flex items-center gap-2",children:[s.jsx(Xs,{className:"text-accent",size:22})," User Feedback Inbox"]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-1",children:"Received comments, critiques, proposals, & systemic reports from campus readers"})]}),ht.length===0?s.jsxs("div",{className:"bg-white py-14 px-6 rounded-[2rem] border border-gray-150 text-center max-w-3xl",children:[s.jsx("div",{className:"w-16 h-16 bg-gray-50 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx(Xs,{size:24,className:"text-gray-300"})}),s.jsx("h4",{className:"text-sm font-black uppercase tracking-wider text-gray-900",children:"Inbox is empty"}),s.jsx("p",{className:"text-[10px] uppercase font-bold tracking-widest text-gray-400 mt-1",children:"No general user feedback submissions have been received yet."})]}):s.jsx("div",{className:"space-y-4 max-w-3xl",children:ht.map(O=>{var ue,Ce,ut;return s.jsxs("div",{className:"bg-white p-6 rounded-[2rem] border border-gray-150 shadow-sm hover:shadow-md transition-all flex flex-col gap-4 text-left font-sans",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap pb-3 border-b border-gray-50",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-extrabold text-xs text-gray-900 uppercase tracking-wider",children:O.name||"Anonymous Reader"}),O.email&&s.jsx("span",{className:"text-[9px] font-mono text-gray-450 bg-gray-55/15 px-2 py-0.5 rounded-lg border border-gray-100",children:O.email})]}),s.jsxs("div",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-widest mt-0.5",children:["Subject: ",s.jsx("span",{className:"text-gray-700",children:O.subject||"General Feedback"})]})]}),(t||((Ce=(ue=Ne.currentUser)==null?void 0:ue.email)==null?void 0:Ce.toLowerCase())==="atwiinevictor2@gmail.com")&&s.jsx("button",{onClick:async()=>{if(!t){he.error("Access Denied: Only administrators can delete feedback.");return}if(window.confirm("Are you sure you want to permanently delete this user feedback entry?"))try{await ai(st(fe,"feedback",O.id)),he.success("Feedback deleted successfully.")}catch(Yt){he.error("Failed to delete feedback: "+Yt.message)}},className:"p-2.5 bg-red-50 hover:bg-red-500 hover:text-white text-red-650 rounded-lg transition-all cursor-pointer border border-red-150",title:"Dismiss Feedback (Master Admin)",children:s.jsx(Es,{size:12})})]}),s.jsx("div",{className:"text-xs text-gray-650 leading-relaxed whitespace-pre-wrap",children:O.message}),s.jsxs("div",{className:"text-[8px] font-black uppercase tracking-widest text-gray-400 font-mono text-right leading-none",children:["Received: ",(ut=O.createdAt)!=null&&ut.seconds?new Date(O.createdAt.seconds*1e3).toLocaleString():"Just now"]})]},O.id)})})]}):a==="manage-podcasts"&&t?s.jsxs("div",{className:"space-y-8 font-sans text-left",children:[s.jsx("div",{className:"border-b border-gray-100 pb-4 max-w-3xl",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"p-2 bg-red-50 text-red-600 rounded-xl",children:s.jsx(mc,{size:20})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 flex items-center gap-2",children:"Podcasts & Video Broadcasts Hub"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-0.5",children:"Publish Audio podcasts & Video episodes (YouTube, MP4, direct links) with visual media badges"})]})]})}),s.jsxs("div",{className:"bg-white p-6 rounded-[2rem] border border-gray-150 shadow-sm max-w-3xl",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4 pb-3 border-b border-gray-100",children:[s.jsx("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-900 flex items-center gap-2",children:g?`⚡ Edit ${$n==="video"?"Video":"Audio"} Podcast`:`➕ Create New ${$n==="video"?"Video":"Audio"} Podcast`}),g&&s.jsx("span",{className:"text-[9px] font-mono font-bold text-amber-700 bg-amber-50 px-2 py-0.5 rounded-lg border border-amber-200",children:"Editing Mode"})]}),s.jsxs("form",{onSubmit:sx,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-[9px] font-black uppercase tracking-wider text-gray-500 flex items-center gap-1.5",children:["Select Media Format ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 p-1 bg-gray-50 rounded-2xl border border-gray-150",children:[s.jsxs("button",{type:"button",onClick:()=>{Ni("audio")},className:`flex items-center justify-center gap-2 py-2.5 px-4 rounded-xl text-xs font-black uppercase tracking-wider transition-all cursor-pointer ${$n==="audio"?"bg-emerald-600 text-white shadow-md":"text-gray-600 hover:text-gray-950 hover:bg-white/60"}`,children:[s.jsx(nf,{size:15})," Audio Podcast"]}),s.jsxs("button",{type:"button",onClick:()=>{Ni("video")},className:`flex items-center justify-center gap-2 py-2.5 px-4 rounded-xl text-xs font-black uppercase tracking-wider transition-all cursor-pointer ${$n==="video"?"bg-red-600 text-white shadow-md":"text-gray-600 hover:text-gray-950 hover:bg-white/60"}`,children:[s.jsx(Na,{size:15})," Video Podcast (YouTube/MP4)"]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1.5 text-left",children:[s.jsxs("label",{className:"text-[9px] font-black uppercase tracking-wider text-gray-500",children:["Episode Title ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",required:!0,value:ni,onChange:O=>Ms(O.target.value),placeholder:$n==="video"?"e.g. GUILD PRESIDENTIAL DEBATE HIGHLIGHTS":"e.g. THE TRUTH OF CAMPUS BUDGETS",className:"w-full px-4 py-2.5 rounded-xl border border-gray-150 text-xs text-gray-900 font-bold focus:border-accent focus:ring-0 outline-hidden bg-gray-50/50"})]}),s.jsxs("div",{className:"space-y-1.5 text-left",children:[s.jsxs("label",{className:"text-[9px] font-black uppercase tracking-wider text-gray-500",children:["Host / Presenter / Channel ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",required:!0,value:zi,onChange:O=>Ks(O.target.value),placeholder:"e.g. Editorial Board / Campus TV",className:"w-full px-4 py-2.5 rounded-xl border border-gray-150 text-xs text-gray-900 font-bold focus:border-accent focus:ring-0 outline-hidden bg-gray-50/50"})]})]}),s.jsxs("div",{className:"space-y-1.5 text-left",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-wider text-gray-500 flex items-center gap-1.5",children:$n==="video"?s.jsxs(s.Fragment,{children:[s.jsx(Na,{size:12,className:"text-red-600"})," Video URL (YouTube, MP4, WebM, Google Drive, Direct Link) ",s.jsx("span",{className:"text-red-500",children:"*"})]}):s.jsxs(s.Fragment,{children:[s.jsx(nf,{size:12,className:"text-emerald-600"})," Audio Stream / MP3 / WAV Link ",s.jsx("span",{className:"text-red-500",children:"*"})]})}),$n==="video"&&xp(Ls)&&s.jsx("span",{className:"text-[8px] font-black uppercase text-red-600 bg-red-50 px-2 py-0.5 rounded border border-red-200",children:"✓ YouTube Link Detected"})]}),s.jsx("div",{className:"relative",children:s.jsx("input",{type:"url",required:!0,value:$n==="video"?Ls:rs,onChange:O=>{const ue=O.target.value;$n==="video"?(Oo(ue),xp(ue)&&!Nl&&mo(gw(ue,"hq"))):(wl(ue),xp(ue)&&(Ni("video"),Oo(ue),wl(""),Nl||mo(gw(ue,"hq")),he.success("YouTube link detected! Switched to Video Podcast format.",{icon:"🎬"})))},placeholder:$n==="video"?"e.g. https://www.youtube.com/watch?v=... or https://youtu.be/... or .mp4 link":"e.g. https://example.com/podcast.mp3 or audio stream URL",className:"w-full px-4 py-2.5 rounded-xl border border-gray-150 text-xs text-gray-900 font-bold focus:border-accent focus:ring-0 outline-hidden bg-gray-50/50"})})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1.5 text-left",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-wider text-gray-500",children:"Duration / Timestamp"}),s.jsx("input",{type:"text",required:!0,value:Zl,onChange:O=>Bf(O.target.value),placeholder:"e.g. 15:30 or 1h 05m",className:"w-full px-4 py-2.5 rounded-xl border border-gray-150 text-xs text-gray-900 font-bold focus:border-accent focus:ring-0 outline-hidden bg-gray-50/50"})]}),s.jsxs("div",{className:"space-y-1.5 text-left",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-wider text-gray-500",children:"Category"}),s.jsxs("select",{value:eu,onChange:O=>Za(O.target.value),className:"w-full px-4 py-2.5 rounded-xl border border-gray-150 text-xs text-gray-900 font-bold focus:border-accent focus:ring-0 outline-hidden bg-gray-50/50",children:[s.jsx("option",{value:"Campus News",children:"Campus News"}),s.jsx("option",{value:"Campus Vibe",children:"Campus Vibe"}),s.jsx("option",{value:"Investigation",children:"Investigation"}),s.jsx("option",{value:"Sports Desk",children:"Sports Desk"}),s.jsx("option",{value:"Lifestyle",children:"Lifestyle"}),s.jsx("option",{value:"Entertainment",children:"Entertainment"}),s.jsx("option",{value:"Special Report",children:"Special Report"})]})]})]}),s.jsxs("div",{className:"space-y-1.5 text-left",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-wider text-gray-500",children:"Episode Summary / Show Notes (Optional)"}),s.jsx("textarea",{rows:2,value:Jl,onChange:O=>Vn(O.target.value),placeholder:"Add brief highlights, key interviewees, or discussion topics...",className:"w-full px-4 py-2.5 rounded-xl border border-gray-150 text-xs text-gray-900 font-medium focus:border-accent focus:ring-0 outline-hidden bg-gray-50/50"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 pt-1.5",children:[s.jsxs("div",{className:"space-y-1.5 text-left",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-wider text-gray-500",children:"Cover Picture (Upload)"}),s.jsx("input",{type:"file",accept:"image/*",onChange:O=>{var Ce;const ue=(Ce=O.target.files)==null?void 0:Ce[0];ue&&ia(ue,mo,te)},className:"w-full text-xs text-gray-400 file:mr-4 file:py-2 file:px-4 file:rounded-xl file:border-0 file:text-[10px] file:font-black file:uppercase file:bg-gray-100 file:text-gray-700 hover:file:bg-gray-200 transition-all cursor-pointer"})]}),s.jsxs("div",{className:"space-y-1.5 text-left",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-wider text-gray-500",children:"Or Cover Picture Direct URL"}),$n==="video"&&xp(Ls)&&s.jsx("button",{type:"button",onClick:()=>{const O=gw(Ls,"maxres");mo(O),he.success("Loaded HD YouTube thumbnail!",{icon:"🖼️"})},className:"text-[8px] font-black uppercase text-red-600 hover:underline cursor-pointer",children:"⚡ Auto-Fetch YouTube Thumbnail"})]}),s.jsx("input",{type:"url",value:Nl,onChange:O=>mo(O.target.value),placeholder:"e.g. https://images.unsplash.com/photo-...",className:"w-full px-4 py-2.5 rounded-xl border border-gray-150 text-xs text-gray-950 font-bold focus:border-accent focus:ring-0 outline-hidden bg-gray-50/50"})]})]}),Nl&&s.jsxs("div",{className:"pt-2 flex items-center gap-3 bg-gray-50 p-2.5 rounded-2xl border border-gray-150",children:[s.jsx("img",{src:Nl,className:"w-16 h-12 rounded-xl object-cover border border-gray-150 shadow-xs",alt:"Preview cover",referrerPolicy:"no-referrer"}),s.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[s.jsx("p",{className:"text-[9px] font-black text-gray-700 uppercase tracking-wider truncate",children:"Cover Image Loaded"}),s.jsx("p",{className:"text-[8px] font-mono text-gray-400 truncate",children:Nl})]}),s.jsx("button",{type:"button",onClick:()=>mo(""),className:"text-[9px] font-black text-red-600 bg-red-50 hover:bg-red-100 px-3 py-1.5 rounded-lg uppercase tracking-wider transition-colors cursor-pointer",children:"Remove"})]}),s.jsxs("div",{className:"pt-4 flex items-center gap-3",children:[s.jsx("button",{type:"submit",disabled:tu,className:"px-6 py-3 bg-red-600 text-white text-[10px] font-black uppercase tracking-widest rounded-xl hover:bg-red-700 transition-all flex items-center gap-2 cursor-pointer disabled:opacity-50 shadow-sm font-sans",children:tu?s.jsxs(s.Fragment,{children:[s.jsx(vn,{size:13,className:"animate-spin"})," Saving..."]}):s.jsxs(s.Fragment,{children:[$n==="video"?s.jsx(Na,{size:13}):s.jsx(mc,{size:13}),g?`Update ${$n==="video"?"Video":"Audio"} Podcast`:`Publish ${$n==="video"?"Video":"Audio"} Episode`]})}),g&&s.jsx("button",{type:"button",onClick:go,className:"px-4 py-3 bg-gray-100 text-gray-700 text-[10px] font-black uppercase tracking-widest rounded-xl hover:bg-gray-200 transition-all cursor-pointer font-sans",children:"Cancel Edit"})]})]})]}),s.jsxs("div",{className:"max-w-3xl",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-900 flex items-center gap-2",children:["📻 Active Episodes (",u.length,")"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-[9px] font-mono font-bold text-emerald-700 bg-emerald-50 px-2 py-0.5 rounded-md border border-emerald-200",children:["🎧 ",u.filter(O=>!Ul(O)).length," Audio"]}),s.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-700 bg-red-50 px-2 py-0.5 rounded-md border border-red-200",children:["🎬 ",u.filter(O=>Ul(O)).length," Video"]})]})]}),u.length===0?s.jsx("div",{className:"bg-gray-50 p-8 rounded-2xl border border-gray-150 text-center text-gray-400 text-[10px] font-bold uppercase tracking-wider",children:"No podcasts have been posted yet. Use the form above to add audio or video podcasts."}):s.jsx("div",{className:"space-y-3",children:u.map(O=>{const ue=Ul(O);return s.jsxs("div",{className:`bg-white p-4 rounded-2xl border transition-all text-left flex items-center gap-4 hover:shadow-xs ${ue?"border-red-100 hover:border-red-300":"border-gray-150 hover:border-gray-300"}`,children:[s.jsxs("div",{className:"relative w-14 h-14 shrink-0 rounded-xl overflow-hidden bg-gray-900 border border-gray-100 shadow-3xs",children:[s.jsx("img",{src:O.thumbnail||(ue?"https://images.unsplash.com/photo-1578022761797-b8636ac1773c?auto=format&fit=crop&q=80&w=200":"https://images.unsplash.com/photo-1590602847861-f357a9332bbc?auto=format&fit=crop&q=80&w=200"),className:"w-full h-full object-cover",alt:"",referrerPolicy:"no-referrer"}),s.jsxs("span",{className:`absolute bottom-1 right-1 text-[7px] font-black uppercase px-1 py-0.5 rounded flex items-center gap-0.5 text-white ${ue?"bg-red-600":"bg-emerald-600"}`,children:[ue?s.jsx(Na,{size:7}):s.jsx(nf,{size:7}),ue?"VID":"AUD"]})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5 flex-wrap",children:[s.jsxs("span",{className:`text-[8px] font-black uppercase tracking-wider px-2 py-0.5 rounded-md flex items-center gap-1 border ${ue?"bg-red-50 text-red-700 border-red-200":"bg-emerald-50 text-emerald-700 border-emerald-200"}`,children:[ue?s.jsx(Na,{size:10,className:"text-red-600"}):s.jsx(nf,{size:10,className:"text-emerald-600"}),ue?"Video Podcast":"Audio Podcast"]}),s.jsx("span",{className:"text-[8px] font-black text-gray-600 bg-gray-100 rounded px-1.5 py-0.5 uppercase tracking-wide",children:O.category||"Campus Vibe"}),s.jsxs("span",{className:"text-[8px] font-mono font-bold text-gray-400",children:["⏱️ ",O.duration||(ue?"Video":"5:40")]})]}),s.jsx("h5",{className:"text-[12px] font-extrabold text-gray-950 truncate uppercase tracking-tight",children:O.title}),s.jsxs("p",{className:"text-[9px] text-gray-400 font-bold uppercase tracking-widest mt-0.5 truncate",children:["Host: ",O.author]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx("button",{onClick:()=>Tm(O),className:`p-2.5 rounded-xl hover:scale-105 transition-all cursor-pointer border ${ue?"bg-red-50 hover:bg-red-100 text-red-600 border-red-200":"bg-emerald-50 hover:bg-emerald-100 text-emerald-700 border-emerald-200"}`,title:ue?"Watch Video Episode":"Listen to Audio Episode",children:ue?s.jsx(Na,{size:13}):s.jsx(Wp,{size:13,fill:"currentColor"})}),s.jsx("button",{onClick:()=>_c(O),className:"p-2.5 bg-gray-50 hover:bg-gray-100 text-gray-700 rounded-xl transition-all cursor-pointer border border-gray-200",title:"Edit podcast details",children:s.jsx(Ed,{size:13})}),s.jsx("button",{onClick:()=>Pb(O.id),className:"p-2.5 bg-red-50 hover:bg-red-100 text-red-650 rounded-xl transition-all cursor-pointer border border-red-150",title:"Delete podcast forever",children:s.jsx(Es,{size:13})})]})]},O.id)})})]}),v&&s.jsx(xP,{podcast:v,onClose:()=>E(null)})]}):a==="mega-ai-knowledge"&&t?s.jsxs("div",{className:"space-y-8 font-sans text-left",children:[s.jsxs("div",{className:"border-b border-gray-100 pb-4 max-w-4xl",children:[s.jsxs("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 flex items-center gap-2",children:[s.jsx(Xi,{className:"text-amber-500",size:22})," Mega AI Knowledge Base & Query Inbox"]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-1",children:"Manage collected smart replies for @Mega mentions, review missing query alerts, and reply to students directly."})]}),s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xs space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-4",children:[s.jsxs("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-900 flex items-center gap-2",children:[s.jsx(Xs,{size:16,className:"text-red-600"})," Pending Student @Mega Queries (",M.filter(O=>!O.used).length,")"]}),s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"Auto-notified on missing responses"})]}),M.length===0?s.jsx("div",{className:"p-8 text-center text-gray-400 text-xs font-bold uppercase tracking-wider bg-gray-50/50 rounded-2xl border border-dashed border-gray-150",children:"No student @Mega queries pending review!"}):s.jsx("div",{className:"space-y-4",children:M.map(O=>{var ue;return s.jsxs("div",{className:Ge("p-5 rounded-2xl border transition-all space-y-3",O.used?"bg-gray-50/50 border-gray-150 opacity-75":"bg-amber-50/30 border-amber-200/80 shadow-xs"),children:[s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-[10px] font-black uppercase tracking-wider bg-amber-500 text-white px-2 py-0.5 rounded-full",children:["@",O.userName||"Student"]}),s.jsx("span",{className:"text-[10px] font-bold text-gray-400 font-mono",children:(ue=O.createdAt)!=null&&ue.seconds?new Date(O.createdAt.seconds*1e3).toLocaleString():"Recent"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:Ge("text-[9px] font-black uppercase tracking-widest px-2 py-0.5 rounded-md",O.used?"bg-emerald-100 text-emerald-800":"bg-red-100 text-red-800"),children:O.used?"Answered & Learned":"Pending Response"}),s.jsx("button",{type:"button",onClick:()=>sh(O.id),className:"p-1 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors cursor-pointer",title:"Dismiss & Delete Ticket Forever",children:s.jsx(Es,{size:14})})]})]}),s.jsxs("div",{className:"bg-white p-3 rounded-xl border border-gray-150 text-xs text-gray-900 font-medium",children:[s.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-amber-600 block mb-1",children:"User Query:"}),'"',O.userQuery,'"']}),!O.used&&s.jsxs("div",{className:"space-y-2 pt-2",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-500 block",children:"Official Response (Will post to student as Mega AI & save into system smart replies):"}),s.jsx("textarea",{rows:2,value:In[O.id]!==void 0?In[O.id]:O.generatedReply||"",onChange:Ce=>bn(ut=>({...ut,[O.id]:Ce.target.value})),placeholder:"Type the official answer here...",className:"w-full p-3 bg-white border border-gray-200 rounded-xl text-xs font-medium text-gray-900 focus:ring-2 focus:ring-amber-500/20 outline-none"}),s.jsx("div",{className:"flex justify-end",children:s.jsxs("button",{type:"button",onClick:()=>Tb(O),className:"inline-flex items-center gap-1.5 px-4 py-2 bg-amber-500 hover:bg-amber-600 text-white text-[10px] font-black uppercase tracking-wider rounded-xl transition-all shadow-xs cursor-pointer active:scale-95",children:[s.jsx(Eo,{size:12})," Post Reply & Save to Smart Replies"]})})]})]},O.id)})})]}),s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xs space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-4 flex-wrap gap-2",children:[s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-900 flex items-center gap-2",children:[s.jsx(ul,{size:18,className:"text-amber-600"})," Requests for Unlimited Posting Approval (",ee.length,")"]})}),ee.length>0&&s.jsxs("button",{type:"button",onClick:Xo,className:"px-3 py-1.5 bg-red-50 hover:bg-red-100 text-red-650 font-black text-[9px] uppercase tracking-wider rounded-xl transition-all cursor-pointer flex items-center gap-1 border border-red-200",children:[s.jsx(Es,{size:12})," Clear All Requests (",ee.length,")"]})]}),ee.length===0?s.jsx("div",{className:"p-8 text-center text-gray-400 text-xs font-bold uppercase tracking-wider bg-gray-50/50 rounded-2xl border border-dashed border-gray-150",children:"No pending requests for unlimited posting approval."}):s.jsx("div",{className:"space-y-4",children:ee.map(O=>{var ue;return s.jsxs("div",{className:"p-5 bg-amber-50/30 border border-amber-200/80 rounded-2xl space-y-3 shadow-xs",children:[s.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-[10px] font-black uppercase tracking-wider bg-gray-900 text-amber-300 px-2 py-0.5 rounded-full",children:["@",O.requestAuthorName||O.userName||"Student"]}),s.jsxs("span",{className:"text-[9px] text-gray-400 font-mono",children:["UID: ",O.requestAuthorId||O.userId||"N/A"]})]}),s.jsx("span",{className:"text-[9px] font-bold text-gray-400 font-mono",children:(ue=O.createdAt)!=null&&ue.seconds?new Date(O.createdAt.seconds*1e3).toLocaleString():"Recent"})]}),s.jsx("div",{className:"bg-white p-3 rounded-xl border border-gray-150 text-xs text-gray-800 font-medium leading-relaxed",children:O.message||`User @${O.requestAuthorName||"Student"} requested admin approval to unlock unlimited posting on Campus Eye.`}),s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsxs("button",{type:"button",onClick:()=>Sm(O.id),className:"px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-700 font-black text-[9px] uppercase tracking-wider rounded-xl transition-all cursor-pointer flex items-center gap-1",children:[s.jsx(Es,{size:12})," Dismiss & Delete"]}),s.jsxs("button",{type:"button",onClick:()=>Al(O),className:"px-4 py-1.5 bg-amber-600 hover:bg-amber-700 text-white font-black text-[9px] uppercase tracking-wider rounded-xl shadow-xs transition-all cursor-pointer flex items-center gap-1.5 active:scale-95",children:[s.jsx(ul,{size:13})," Approve User for Unlimited Posting"]})]})]},O.id)})})]}),s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xs space-y-4",children:[s.jsxs("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-900 flex items-center gap-2 border-b border-gray-100 pb-3",children:[s.jsx(Xi,{size:16,className:"text-amber-500"})," Add New Smart Reply to Mega AI Knowledge Base"]}),s.jsxs("form",{onSubmit:ix,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-400 block",children:"Question / Trigger Prompt"}),s.jsx("input",{type:"text",value:ye,onChange:O=>Se(O.target.value),placeholder:"e.g. How do I register for KIU exams?",className:"w-full p-3 bg-gray-50 border border-gray-150 rounded-xl text-xs font-medium text-gray-900 focus:bg-white outline-none"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-400 block",children:"Matching Keywords (Comma Separated)"}),s.jsx("input",{type:"text",value:dt,onChange:O=>Wt(O.target.value),placeholder:"e.g. kiu, exam, registration, portal, schedule",className:"w-full p-3 bg-gray-50 border border-gray-150 rounded-xl text-xs font-medium text-gray-900 focus:bg-white outline-none"})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-400 block",children:"Smart Automated Answer"}),s.jsx("textarea",{rows:3,value:Te,onChange:O=>Ye(O.target.value),placeholder:"e.g. KIU exam registration is completed through the student portal under Academic Services before Week 8.",className:"w-full p-3 bg-gray-50 border border-gray-150 rounded-xl text-xs font-medium text-gray-900 focus:bg-white outline-none"})]}),s.jsx("div",{className:"flex justify-end",children:s.jsxs("button",{type:"submit",disabled:qt,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-black hover:bg-gray-800 text-white text-[10px] font-black uppercase tracking-wider rounded-xl transition-all shadow-sm cursor-pointer disabled:opacity-50",children:[s.jsx(Xi,{size:14,className:"text-amber-400"})," Save Smart Reply Entry"]})})]})]}),ns&&s.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-xs z-50 flex items-center justify-center p-4",children:s.jsxs("div",{className:"bg-white rounded-3xl p-6 max-w-2xl w-full border border-gray-100 shadow-2xl space-y-5 animate-in fade-in zoom-in-95 duration-150",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-3",children:[s.jsxs("h4",{className:"text-sm font-black uppercase tracking-wider text-gray-900 flex items-center gap-2",children:[s.jsx(Ed,{size:18,className:"text-indigo-600"})," Edit & Correct AI Knowledge Entry"]}),s.jsx("button",{type:"button",onClick:Im,className:"p-1.5 text-gray-400 hover:text-gray-700 hover:bg-gray-100 rounded-full transition-colors",children:s.jsx(Jr,{size:18})})]}),s.jsxs("form",{onSubmit:td,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-500 block",children:"Question / User Query"}),s.jsx("input",{type:"text",value:Ys,onChange:O=>pi(O.target.value),className:"w-full p-3 bg-gray-50 border border-gray-200 rounded-xl text-xs font-medium text-gray-900 focus:bg-white focus:ring-2 focus:ring-indigo-500/20 outline-none",placeholder:"e.g. How do I register for KIU exams?"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-500 block",children:"Matching Keywords (Comma Separated)"}),s.jsx("input",{type:"text",value:kc,onChange:O=>El(O.target.value),className:"w-full p-3 bg-gray-50 border border-gray-200 rounded-xl text-xs font-medium text-gray-900 focus:bg-white focus:ring-2 focus:ring-indigo-500/20 outline-none",placeholder:"e.g. kiu, exam, registration, portal"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-[9px] font-black uppercase tracking-widest text-gray-500 block",children:"Corrected Official Answer"}),s.jsx("textarea",{rows:4,value:js,onChange:O=>ga(O.target.value),className:"w-full p-3 bg-gray-50 border border-gray-200 rounded-xl text-xs font-medium text-gray-900 focus:bg-white focus:ring-2 focus:ring-indigo-500/20 outline-none leading-relaxed",placeholder:"Type the accurate smart answer here..."})]}),s.jsxs("div",{className:"flex items-center justify-end gap-3 pt-2",children:[s.jsx("button",{type:"button",onClick:Im,className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 text-[10px] font-black uppercase tracking-wider rounded-xl transition-all",children:"Cancel"}),s.jsxs("button",{type:"submit",disabled:_m,className:"inline-flex items-center gap-1.5 px-5 py-2 bg-indigo-600 hover:bg-indigo-700 text-white text-[10px] font-black uppercase tracking-wider rounded-xl transition-all shadow-sm disabled:opacity-50 cursor-pointer",children:[s.jsx(iR,{size:14})," Update Knowledge Entry"]})]})]})]})}),s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xs space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-3 flex-wrap gap-2",children:[s.jsxs("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-900 flex items-center gap-2",children:[s.jsx(Xi,{size:16,className:"text-amber-500"})," System-Wide AI Knowledge & Responses (",_.length,")"]}),s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"Editable by Admin in Realtime"})]}),_.length===0?s.jsx("p",{className:"text-xs font-bold text-gray-400 text-center py-6",children:"No smart replies or AI responses added yet. Add one above or trigger an @Mega AI query!"}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:_.map(O=>s.jsxs("div",{className:"p-4 bg-gray-50/70 border border-gray-150 rounded-2xl flex flex-col justify-between space-y-3 hover:shadow-xs transition-shadow",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("span",{className:"text-[8px] font-black uppercase tracking-widest px-2 py-0.5 rounded-full bg-amber-100 text-amber-900 border border-amber-200/60",children:O.source==="ai_generated"?"🤖 AI Generated":O.source==="admin_ticket_reply"?"👤 Admin Reply":"✨ Knowledge Base"}),O.askedBy&&s.jsxs("span",{className:"text-[8px] font-bold text-gray-400",children:["by @",O.askedBy]})]}),s.jsxs("span",{className:"text-[10px] font-black uppercase text-gray-900 tracking-wider block",children:["Q: ",O.question]})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.jsxs("button",{type:"button",onClick:()=>jm(O),className:"p-1.5 text-indigo-600 hover:text-indigo-800 hover:bg-indigo-50 rounded-lg transition-colors cursor-pointer flex items-center gap-1 text-[9px] font-black uppercase tracking-wider",title:"Edit & Update response",children:[s.jsx(Ed,{size:13})," Edit"]}),s.jsx("button",{type:"button",onClick:()=>Cm(O.id),className:"p-1.5 text-red-500 hover:text-red-700 hover:bg-red-50 rounded-lg transition-colors cursor-pointer",title:"Delete response",children:s.jsx(Es,{size:13})})]})]}),s.jsx("p",{className:"text-xs text-gray-800 font-medium leading-relaxed bg-white p-3 rounded-xl border border-gray-100",children:O.answer})]}),O.keywords&&O.keywords.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:O.keywords.map((ue,Ce)=>s.jsxs("span",{className:"text-[8px] font-black uppercase tracking-widest bg-gray-200/60 text-gray-700 px-2 py-0.5 rounded-full",children:["#",ue]},Ce))})]},O.id))})]})]}):a==="seo-indexing"&&t?s.jsxs("div",{className:"space-y-8 font-sans text-left animate-fade-in max-w-5xl",children:[s.jsx("div",{className:"border-b border-gray-100 pb-4",children:s.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-2xl bg-emerald-50 text-emerald-600 border border-emerald-200 flex items-center justify-center font-bold",children:s.jsx(C0,{size:22})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900 flex items-center gap-2",children:"Google Search Console & Real-Time SEO Engine"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-0.5",children:"Real-time automatic discovery, XML sitemaps, Google News, and WebSub indexing pipeline"})]})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-[9px] font-mono font-black bg-emerald-50 text-emerald-700 border border-emerald-200",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),"Real-Time Push Active"]})})]})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-gray-150 shadow-xs space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Google Search Console"}),s.jsx(Rl,{size:14,className:"text-emerald-500"})]}),s.jsx("p",{className:"text-base font-black text-gray-900 tracking-tight",children:"Real-Time Pings"}),s.jsx("p",{className:"text-[10px] text-gray-500 font-medium",children:"Automatic sitemap pings sent directly to Google on every article publish"})]}),s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-gray-150 shadow-xs space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Universal IndexNow"}),s.jsx(Rl,{size:14,className:"text-emerald-500"})]}),s.jsx("p",{className:"text-base font-black text-gray-900 tracking-tight",children:"Bing & Yandex"}),s.jsx("p",{className:"text-[10px] text-gray-500 font-medium",children:"Instant indexing notifications via RFC IndexNow protocol key"})]}),s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-gray-150 shadow-xs space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Googlebot WebSub"}),s.jsx(Rl,{size:14,className:"text-emerald-500"})]}),s.jsx("p",{className:"text-base font-black text-gray-900 tracking-tight",children:"PubSubHubbub"}),s.jsx("p",{className:"text-[10px] text-gray-500 font-medium",children:"Real-time RSS & Atom hub notifications for Google News & Search"})]})]}),s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-150 shadow-xs space-y-6",children:[s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-900 flex items-center gap-2",children:[s.jsx(Eo,{size:15,className:"text-emerald-600"})," Instant Push & Search Engine Notification"]}),s.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-widest mt-0.5",children:"Broadcast site changes and newly added articles to Google, Bing, and major search crawlers immediately"})]}),Or&&s.jsxs("div",{className:"p-4 bg-emerald-50 border border-emerald-200 rounded-2xl text-xs font-bold text-emerald-800 flex items-center gap-2",children:[s.jsx(Rl,{size:16,className:"text-emerald-600 shrink-0"}),s.jsx("span",{children:Or})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 pt-2",children:[s.jsxs("div",{className:"p-5 bg-gray-50/80 rounded-2xl border border-gray-200 space-y-3 flex flex-col justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h5",{className:"text-xs font-black text-gray-900 uppercase",children:"Push All Articles & Sitemaps"}),s.jsx("p",{className:"text-[10px] text-gray-500 font-medium",children:"Regenerates dynamic XML sitemaps and dispatches instant pings to Google Search Console, Google News, and IndexNow."})]}),s.jsx("button",{type:"button",onClick:ar,disabled:Ze,className:"w-full py-3 px-4 bg-emerald-600 hover:bg-emerald-700 text-white text-[10px] font-black uppercase tracking-wider rounded-xl transition-all shadow-xs flex items-center justify-center gap-2 cursor-pointer disabled:opacity-50 active:scale-98",children:Ze?s.jsxs(s.Fragment,{children:[s.jsx(vn,{size:14,className:"animate-spin"}),s.jsx("span",{children:"Pushing to Search Engines..."})]}):s.jsxs(s.Fragment,{children:[s.jsx(C0,{size:14}),s.jsx("span",{children:"Push All to Google Search Console Now"})]})})]}),s.jsxs("form",{onSubmit:ft,className:"p-5 bg-gray-50/80 rounded-2xl border border-gray-200 space-y-3 flex flex-col justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h5",{className:"text-xs font-black text-gray-900 uppercase",children:"Submit Specific Article / Page URL"}),s.jsx("p",{className:"text-[10px] text-gray-500 font-medium",children:"Enter any article link or page path to trigger an immediate crawler priority ping."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{type:"url",value:Fr,onChange:O=>gr(O.target.value),placeholder:"https://campuseyemedia.com/articles=title/id",className:"w-full px-3.5 py-2.5 bg-white border border-gray-250 rounded-xl text-xs font-medium text-gray-900 outline-none focus:border-emerald-600 transition-all font-mono"}),s.jsx("button",{type:"submit",disabled:Cr||!Fr.trim(),className:"w-full py-2.5 px-4 bg-gray-900 hover:bg-black text-white text-[10px] font-black uppercase tracking-wider rounded-xl transition-all shadow-xs flex items-center justify-center gap-2 cursor-pointer disabled:opacity-50",children:Cr?s.jsxs(s.Fragment,{children:[s.jsx(vn,{size:14,className:"animate-spin"}),s.jsx("span",{children:"Submitting URL..."})]}):s.jsxs(s.Fragment,{children:[s.jsx(Eo,{size:12}),s.jsx("span",{children:"Submit URL to Search Engines"})]})})]})]})]})]}),s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-150 shadow-xs space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-900 flex items-center gap-2",children:[s.jsx(qx,{size:15,className:"text-accent"})," Live XML Sitemaps & RSS/Atom Feeds"]}),s.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-widest mt-0.5",children:"Canonical indexing endpoints registered with Googlebot and search engines"})]}),s.jsx("button",{type:"button",onClick:Oe,className:"p-2 text-gray-400 hover:text-gray-700 hover:bg-gray-100 rounded-xl transition-colors cursor-pointer",title:"Refresh SEO Stats",children:s.jsx(hF,{size:14})})]}),s.jsx("div",{className:"divide-y divide-gray-100 border border-gray-150 rounded-2xl overflow-hidden",children:[{name:"Primary XML Sitemap",path:"/sitemap.xml",fullUrl:"https://campuseyemedia.com/sitemap.xml",target:"Google, Bing, Yandex",desc:"All published articles, podcasts, polls, and custom menu links."},{name:"Google News XML Sitemap",path:"/news-sitemap.xml",fullUrl:"https://campuseyemedia.com/news-sitemap.xml",target:"Googlebot-News",desc:"Formatted with publication schema for fast Google News inclusion."},{name:"RSS 2.0 WebSub Feed",path:"/rss.xml",fullUrl:"https://campuseyemedia.com/rss.xml",target:"Google PubSubHubbub",desc:"Live RSS 2.0 feed with real-time push hub declarations for search crawlers."},{name:"Atom 1.0 Feed",path:"/atom.xml",fullUrl:"https://campuseyemedia.com/atom.xml",target:"Atom Crawlers",desc:"Standardized Atom format for news aggregators and discovery."},{name:"IndexNow Verification Key",path:"/ed20d91d9047466aa5bc515668e0d6c9.txt",fullUrl:"https://campuseyemedia.com/ed20d91d9047466aa5bc515668e0d6c9.txt",target:"Universal IndexNow",desc:"Cryptographic ownership verification key enabling push indexing without human verification delays."},{name:"Robots Directives",path:"/robots.txt",fullUrl:"https://campuseyemedia.com/robots.txt",target:"All Web Crawlers",desc:"Robots directives pointing search spiders to canonical sitemaps and allowing public content."}].map((O,ue)=>s.jsxs("div",{className:"p-4 hover:bg-gray-50/50 transition-colors flex items-center justify-between gap-4 flex-wrap",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-xs font-black text-gray-900 uppercase",children:O.name}),s.jsx("span",{className:"text-[8px] font-black uppercase font-mono px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md",children:O.target})]}),s.jsx("p",{className:"text-[10px] text-gray-500 font-medium",children:O.desc}),s.jsx("p",{className:"text-[9px] font-mono text-gray-400 break-all",children:O.fullUrl})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs("a",{href:O.path,target:"_blank",rel:"noreferrer",className:"px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-800 text-[9px] font-black uppercase tracking-wider rounded-xl transition-all cursor-pointer flex items-center gap-1",children:[s.jsx(R1,{size:11})," View Output"]})})]},ue))})]}),(de==null?void 0:de.recentPushes)&&de.recentPushes.length>0&&s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-150 shadow-xs space-y-4",children:[s.jsxs("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-900 flex items-center gap-2",children:[s.jsx(vw,{size:15,className:"text-gray-400"})," Recent Search Engine Push History"]}),s.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto pr-1",children:de.recentPushes.map((O,ue)=>{var Ce;return s.jsxs("div",{className:"p-3 bg-gray-50 rounded-xl border border-gray-150 flex items-center justify-between text-xs font-medium gap-4",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-[9px] font-black uppercase text-emerald-700 bg-emerald-100 px-2 py-0.5 rounded-md",children:["Pushed ",O.urlCount||1," URL(s)"]}),s.jsx("span",{className:"text-[9px] text-gray-400 font-mono",children:new Date(O.timestamp).toLocaleTimeString()})]}),s.jsx("p",{className:"text-[10px] font-mono text-gray-600 truncate",children:(Ce=O.urls)==null?void 0:Ce.slice(0,3).join(", ")})]}),s.jsx("span",{className:"text-[9px] font-bold text-gray-400 font-mono shrink-0",children:new Date(O.timestamp).toLocaleDateString()})]},ue)})})]})]}):s.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[s.jsx("div",{className:"w-20 h-20 bg-gray-50 rounded-full flex items-center justify-center text-gray-300 mb-6",children:s.jsx(ul,{size:40})}),s.jsx("h3",{className:"text-xl font-sans font-extrabold uppercase tracking-tight text-gray-900",children:"Access Restricted"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-2 max-w-xs",children:"You don't have the necessary permissions to view this section. Please contact the administrator."})]})]})]})]})};let RS=null;const OMe=()=>{const[e,t]=ie.useState(RS||[]),[r,n]=ie.useState(!RS),[i,a]=ie.useState(null),[o,c]=ie.useState(1),[h,f]=ie.useState(!1),[m,y]=ie.useState(!1),[w,A]=ie.useState(!1);ie.useEffect(()=>{(async()=>{var G,X,q,B;if(Ne.currentUser){const z=["atwiinevictor2@gmail.com","campuseye@gmail.com"];try{const F=await as(st(fe,"admins",Ne.currentUser.uid)),$=await as(st(fe,"users",Ne.currentUser.uid)),J=F.exists()&&((G=F.data())==null?void 0:G.isAdmin)===!0||$.exists()&&(((X=$.data())==null?void 0:X.isAdmin)===!0||((q=$.data())==null?void 0:q.role)==="admin")||z.includes(Ne.currentUser.email||"");A(J)}catch{A(z.includes(((B=Ne.currentUser)==null?void 0:B.email)||""))}}else A(!1)})()},[]);const S=U=>U?typeof U.toDate=="function"?U.toDate():U instanceof Date?U:U.seconds!==void 0?new Date(U.seconds*1e3):typeof U=="string"||typeof U=="number"?new Date(U):null:null,j=U=>{const G=S(U);if(!G)return"EVT";try{return G.toLocaleString("default",{month:"short"}).toUpperCase()}catch{return"EVT"}},T=U=>{const G=S(U);if(!G)return"00";try{return G.getDate()}catch{return"01"}},D=U=>{const G=S(U);if(!G)return"TBA";try{return G.toLocaleString([],{dateStyle:"medium",timeStyle:"short"})}catch{return"TBA"}};ie.useEffect(()=>{const U=Jt(nt(fe,"tickets"),di("createdAt","desc"));vr(U).then(G=>{const X=G.docs.map(q=>({id:q.id,...q.data()}));t(X),RS=X,n(!1)}).catch(G=>{Gs(G,Ps.LIST,"tickets"),n(!1)})},[]);const V=async()=>{var U,G,X;if(!Ne.currentUser||!i){he.error("Please login to purchase tickets");return}if(o>i.remainingQuantity){he.error("Not enough tickets remaining");return}if(!Ne.currentUser){he.error("Please sign in to purchase tickets");return}f(!0);try{const q={ticketId:i.id,ticketTitle:i.title,userId:((U=Ne.currentUser)==null?void 0:U.uid)||"",userName:((G=Ne.currentUser)==null?void 0:G.displayName)||"Anonymous",userEmail:((X=Ne.currentUser)==null?void 0:X.email)||"",price:i.price,totalAmount:i.price*o,quantity:o,purchaseDate:wn.now(),status:"confirmed"};await dn(nt(fe,"purchases"),q),await Ir(st(fe,"tickets",i.id),{remainingQuantity:Cn(-o)}),he.success("Ticket purchased successfully!"),y(!0),setTimeout(()=>{y(!1),a(null),c(1)},3e3)}catch(q){console.error("Purchase error:",q),he.error("Failed to process purchase")}finally{f(!1)}};return r?s.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4",children:[s.jsx(vn,{className:"animate-spin text-red-600",size:40}),s.jsx("p",{className:"text-[10px] font-black uppercase tracking-[0.2em] text-gray-400",children:"Loading Campus Events..."})]}):s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-6 mb-12",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("h2",{className:"text-4xl font-black uppercase italic tracking-tighter text-gray-900 flex items-center gap-4",children:["Campus Box Office ",s.jsx(Ea,{className:"text-red-600",size:32})]}),s.jsx("p",{className:"text-xs font-bold text-gray-400 uppercase tracking-[0.3em]",children:"Official portal for university events & experiences"})]}),s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"bg-white px-6 py-4 border border-gray-100 rounded-3xl shadow-sm text-center min-w-[120px]",children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest mb-1",children:"Available Events"}),s.jsx("p",{className:"text-xl font-black text-gray-900",children:e.length})]}),s.jsxs("div",{className:"bg-black px-6 py-4 rounded-3xl shadow-xl shadow-black/10 text-center min-w-[120px]",children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest mb-1",children:"Status"}),s.jsx("p",{className:"text-xl font-black text-green-400",children:"SECURE"})]})]})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:e.map(U=>s.jsxs(Qt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"group bg-white rounded-[2.5rem] border border-gray-100 shadow-sm hover:shadow-xl hover:-translate-y-1 transition-all overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"relative aspect-[4/3] overflow-hidden",children:[s.jsx(Bi,{src:U.imageUrl,alt:U.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"}),s.jsx("div",{className:"absolute top-4 right-4 px-3 py-1 bg-white/90 backdrop-blur-sm rounded-full text-[10px] font-black uppercase tracking-widest text-red-600 shadow-sm",children:U.category}),U.remainingQuantity<10&&U.remainingQuantity>0&&s.jsxs("div",{className:"absolute bottom-4 left-4 px-3 py-1 bg-red-600 text-white rounded-full text-[9px] font-black uppercase tracking-widest",children:["Only ",U.remainingQuantity," Left!"]}),U.remainingQuantity<=0&&s.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px] flex items-center justify-center",children:s.jsx("span",{className:"px-6 py-2 bg-white text-black text-sm font-black uppercase tracking-[0.3em] rounded-full",children:"Sold Out"})})]}),s.jsxs("div",{className:"p-8 flex-1 flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsxs("div",{className:"w-10 h-10 bg-red-50 text-red-600 rounded-xl flex flex-col items-center justify-center",children:[s.jsx("span",{className:"text-[10px] font-black leading-none",children:j(U.eventDate)}),s.jsx("span",{className:"text-sm font-black leading-none",children:T(U.eventDate)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-xl font-black text-gray-900 uppercase tracking-tight truncate leading-tight",children:U.title}),s.jsxs("div",{className:"flex items-center gap-2 text-gray-400 mt-0.5",children:[s.jsx(r2,{size:12}),s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider truncate",children:U.venue})]})]})]}),s.jsx("p",{className:"text-sm text-gray-500 font-medium line-clamp-2 mb-6",children:U.description}),U.link&&s.jsx("div",{className:"mb-6 -mt-3",children:s.jsxs("a",{href:U.link,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-blue-650 font-black uppercase tracking-wider hover:underline",onClick:G=>G.stopPropagation(),children:[s.jsx("span",{children:"Visit Event Link"}),s.jsx(Gp,{size:14,className:"text-blue-600"})]})}),s.jsxs("div",{className:"mt-auto pt-6 border-t border-gray-50 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest mb-1 leading-none",children:"Public Price"}),s.jsxs("p",{className:"text-2xl font-black text-gray-900 leading-none",children:[s.jsx("span",{className:"text-sm",children:"UGX"})," ",U.price.toLocaleString()]})]}),s.jsx("button",{onClick:()=>a(U),disabled:U.remainingQuantity<=0,className:Ge("px-6 py-4 rounded-2xl text-[10px] font-black uppercase tracking-widest transition-all",U.remainingQuantity>0?"bg-red-600 text-white hover:bg-red-700 shadow-lg shadow-red-200":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:"Book Ticket"})]}),w&&s.jsxs("div",{className:"mt-6 pt-4 border-t border-dashed border-gray-150 flex gap-3",children:[s.jsx("button",{onClick:G=>{G.stopPropagation(),localStorage.setItem("edit_ticket_item",JSON.stringify(U));const X=new CustomEvent("setTab",{detail:"admin"});window.dispatchEvent(X),setTimeout(()=>{window.dispatchEvent(new CustomEvent("checkPendingTicketEdit"))},100)},className:"flex-1 py-3 bg-blue-50 text-blue-600 rounded-xl text-[10px] font-black uppercase tracking-widest hover:bg-blue-600 hover:text-white transition-all text-center",children:"Edit Event"}),w&&s.jsx("button",{onClick:async G=>{if(G.stopPropagation(),!w){he.error("Access Denied: Only admins can delete tickets.");return}if(window.confirm("Are you sure you want to permanently delete this event ticket?"))try{await ai(st(fe,"tickets",U.id)),he.success("Event ticket deleted successfully"),t(X=>X.filter(q=>q.id!==U.id))}catch(X){he.error("Failed to delete event ticket: "+X.message)}},className:"flex-1 py-3 bg-red-50 text-red-650 rounded-xl text-[10px] font-black uppercase tracking-widest hover:bg-red-600 hover:text-white transition-all text-center",title:"Delete Ticket (Master Admin)",children:"Delete"})]})]})]},U.id))}),s.jsx(on,{children:i&&s.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[s.jsx(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>!h&&a(null),className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),s.jsx(Qt.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"relative w-full max-w-xl bg-white rounded-[3rem] shadow-2xl overflow-hidden",children:m?s.jsxs("div",{className:"p-12 text-center space-y-6",children:[s.jsx("div",{className:"w-20 h-20 bg-green-100 text-green-600 rounded-full flex items-center justify-center mx-auto scale-110",children:s.jsx(zu,{size:48,strokeWidth:3})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"text-3xl font-black uppercase italic tracking-tighter text-gray-900",children:"Ticket Secured!"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-[0.3em]",children:"Transaction verified & recorded"})]}),s.jsx("p",{className:"text-sm text-gray-600 font-medium max-w-xs mx-auto",children:"Your digital ticket has been sent to your account. Please present the QR code at the venue."}),s.jsx("div",{className:"pt-4",children:s.jsx("button",{onClick:()=>a(null),className:"px-8 py-4 bg-black text-white rounded-2xl text-[10px] font-black uppercase tracking-widest hover:bg-gray-900 transition-all",children:"Close Window"})})]}):s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("div",{className:"relative h-48",children:[s.jsx(Bi,{src:i.imageUrl,className:"w-full h-full object-cover",alt:""}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-white via-white/20 to-transparent"}),s.jsx("button",{onClick:()=>a(null),disabled:h,className:"absolute top-6 right-6 p-3 bg-white/90 backdrop-blur-sm rounded-2xl text-gray-900 hover:bg-white transition-all shadow-lg",children:s.jsx(Jr,{size:20})})]}),s.jsx("div",{className:"p-10 -mt-20 relative",children:s.jsxs("div",{className:"bg-white p-8 rounded-[2rem] border border-gray-100 shadow-xl space-y-6",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] font-black text-red-600 uppercase tracking-[0.2em]",children:i.category}),s.jsx("h2",{className:"text-3xl font-black text-gray-900 uppercase tracking-tighter leading-tight",children:i.title})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-gray-50 rounded-xl",children:s.jsx($p,{size:18,className:"text-gray-400"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Date & Time"}),s.jsx("p",{className:"text-xs font-black text-gray-900 uppercase",children:D(i.eventDate)})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-gray-50 rounded-xl",children:s.jsx(r2,{size:18,className:"text-gray-400"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Location"}),s.jsx("p",{className:"text-xs font-black text-gray-900 uppercase",children:i.venue})]})]})]}),s.jsxs("div",{className:"space-y-4 pt-6 border-t border-gray-100",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("p",{className:"text-sm font-black text-gray-900 uppercase tracking-widest",children:"Select Quantity"}),s.jsxs("div",{className:"flex items-center gap-4 bg-gray-50 p-2 rounded-2xl border border-gray-100",children:[s.jsx("button",{onClick:()=>c(Math.max(1,o-1)),className:"w-10 h-10 flex items-center justify-center text-xl font-bold bg-white text-gray-900 rounded-xl hover:bg-gray-200 transition-all shadow-sm",children:"-"}),s.jsx("span",{className:"text-xl font-black text-gray-900 w-8 text-center",children:o}),s.jsx("button",{onClick:()=>c(Math.min(i.remainingQuantity,o+1)),className:"w-10 h-10 flex items-center justify-center text-xl font-bold bg-white text-gray-900 rounded-xl hover:bg-gray-200 transition-all shadow-sm",children:"+"})]})]}),s.jsxs("div",{className:"bg-red-50 p-6 rounded-2xl border border-red-100 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-black text-red-400 uppercase tracking-widest mb-1 leading-none",children:"Total Payable"}),s.jsxs("p",{className:"text-3xl font-black text-red-600 leading-none tracking-tighter",children:[s.jsx("span",{className:"text-sm",children:"UGX"})," ",(i.price*o).toLocaleString()]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-[10px] font-black text-red-600/50 uppercase tracking-widest",children:"Digital Entry"}),s.jsx("div",{className:"flex gap-1 mt-1",children:[1,2,3].map(U=>s.jsx("div",{className:"w-6 h-1 bg-red-600/20 rounded-full"},U))})]})]})]}),s.jsx("button",{onClick:V,disabled:h,className:"w-full py-5 bg-red-600 text-white rounded-2xl text-[10px] font-black uppercase tracking-[0.3em] hover:bg-red-700 transition-all shadow-xl shadow-red-200 disabled:opacity-50 flex items-center justify-center gap-3",children:h?s.jsxs(s.Fragment,{children:[s.jsx(vn,{className:"animate-spin",size:20}),"Authorizing Transaction..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ul,{size:20}),"Confirm Booking"]})})]})})]})})]})})]})},DV=({onAuthSuccess:e,onClose:t,className:r,isAdmin:n,onAdminClick:i})=>{const[a,o]=ie.useState(Ne.currentUser),[c,h]=ie.useState(null);ie.useEffect(()=>{try{const Ie=localStorage.getItem("pending_follow_name");Ie&&h(Ie)}catch{}},[]);const[f,m]=ie.useState(!1),[y,w]=ie.useState("signin"),[A,S]=ie.useState(""),[j,T]=ie.useState(""),[D,V]=ie.useState(!1),[U,G]=ie.useState(""),[X,q]=ie.useState(!1),[B,z]=ie.useState(""),[F,$]=ie.useState(""),[J,Q]=ie.useState(""),[K,me]=ie.useState(!1),[re,le]=ie.useState(null),[ve,je]=ie.useState(null),[Ve,Z]=ie.useState(!1);ie.useEffect(()=>{if(y!=="signup"||!F.trim()){je(null),Z(!1);return}const vt=setTimeout(async()=>{Z(!0);try{const Re=F.trim().toLowerCase();if(Re.length<3){je(!1),Z(!1);return}const It=Jt(nt(fe,"users"),An("username","==",Re)),Dt=await vr(It);je(Dt.empty)}catch(Re){console.warn("Username availability check bypassed:",Re),je(!0)}finally{Z(!1)}},400);return()=>clearTimeout(vt)},[F,y]);const se=A.includes("@")&&A.includes("."),xe=j.length===0?0:j.length<6?1:j.length<10?2:3,ae=j.length>=6,qe=j===U,pt=y==="signin"?se&&ae:se&&ae&&F.trim().length>=3&&ve===!0&&qe;ie.useEffect(()=>Ne.onAuthStateChanged(Ie=>o(Ie)),[]);const Fe=async()=>{m(!0),le(null);try{const Ie=await nle(Ne,zG);await Pt(Ie.user),e&&e()}catch(Ie){if(console.error("Error signing in with Google:",Ie),Ie.code==="auth/popup-closed-by-user")le("Sign-in popup was closed. Please try again or create an Email account below.");else if(Ie.code==="auth/popup-blocked"||Ie.code==="auth/disallowed_useragent")le(s.jsxs("div",{className:"space-y-3 text-left",children:[s.jsx("p",{className:"font-bold text-gray-900 text-xs",children:"Google OAuth is restricted inside embedded preview frames or mobile WebViews."}),s.jsxs("p",{className:"text-[10px] text-gray-600 leading-relaxed",children:["Please open the app in a new browser window/tab to sign in with Google, or log in using ",s.jsx("b",{className:"text-red-600",children:"Email & Password"})," below."]}),s.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[s.jsx("button",{type:"button",onClick:()=>window.open(window.location.href,"_blank"),className:"w-full py-2 bg-indigo-600 text-white text-[10px] font-black uppercase tracking-widest rounded-lg hover:bg-indigo-700 transition-all cursor-pointer shadow-sm",children:"Open App in New Tab to Sign In"}),s.jsx("button",{type:"button",onClick:()=>w("signup"),className:"w-full py-2 bg-gray-100 text-gray-800 text-[10px] font-black uppercase tracking-widest rounded-lg hover:bg-gray-200 transition-all cursor-pointer",children:"Create Email Account (Instant Login)"})]})]}));else if(Ie.code==="auth/unauthorized-domain")le(s.jsxs("div",{className:"space-y-2 text-left",children:[s.jsx("p",{className:"font-bold text-red-600 text-xs",children:"Domain authorization check required."}),s.jsxs("p",{className:"text-[10px] text-gray-600 leading-relaxed",children:["Security policy requires running from an authorized domain (",window.location.hostname,"). You can log in using ",s.jsx("b",{className:"text-red-600",children:"Email & Password"})," below."]})]}));else if(Ie.code==="auth/internal-error"||Ie.code==="auth/network-request-failed")le(s.jsxs("div",{className:"space-y-3 text-left",children:[s.jsx("p",{className:"text-xs text-gray-800",children:"Connection error. If using an embedded frame, try opening in a new browser tab."}),s.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[s.jsx("button",{type:"button",onClick:()=>window.open(window.location.href,"_blank"),className:"w-full py-2 bg-indigo-600 text-white text-[10px] font-black uppercase tracking-widest rounded-lg hover:bg-indigo-700 transition-all cursor-pointer shadow-sm",children:"Open in New Tab & Try Google Login"}),s.jsx("button",{type:"button",onClick:()=>w("signup"),className:"w-full py-2 bg-gray-100 text-gray-800 text-[10px] font-black uppercase tracking-widest rounded-lg hover:bg-gray-200 transition-all cursor-pointer",children:"Sign Up with Email & Password"})]})]}));else if(Ie.code==="auth/operation-not-allowed")le("Google Sign-In is temporarily disabled on this domain. Please log in or register with Email & Password.");else{const vt=(Ie.message||"").replace(/firebase/gi,"Campus Eye Auth").replace(/auth\/[a-z-]+/gi,"Login Service");le(vt||"An unexpected error occurred during Google Sign-In.")}}finally{m(!1)}},jt=async Ie=>{Ie.preventDefault(),m(!0),le(null);try{if(y==="signup"){const vt=F.trim().toLowerCase(),Re=await Ooe(Ne,A,j),It=`https://ui-avatars.com/api/?name=${encodeURIComponent(vt||"User")}&background=random`;await n$(Re.user,{displayName:vt,photoURL:It}),await Pt({...Re.user,photoURL:It},vt,vt),localStorage.setItem("just_signed_up","true")}else{const vt=await Roe(Ne,A,j);await Pt(vt.user)}e&&e()}catch(vt){console.error("Email auth error:",vt),le(y==="signin"?"Wrong password or email":vt.message||"An error occurred during registration.")}finally{m(!1)}},Pt=async(Ie,vt,Re)=>{var It,Dt,cr,St,Ct,Gt,Xe,Xt,Ot,or;try{const Wr=st(fe,"users",Ie.uid),dr=await as(Wr),He=["atwiinevictor2@gmail.com","campuseye@gmail.com"].includes(Ie.email||""),Rt={uid:Ie.uid,email:Ie.email||"",displayName:vt||Ie.displayName||((It=dr.data())==null?void 0:It.displayName)||"Campus Member",username:Re||((Dt=dr.data())==null?void 0:Dt.username)||((cr=Ie.email)==null?void 0:cr.split("@")[0])||"user",photoURL:Ie.photoURL||((St=dr.data())==null?void 0:St.photoURL)||`https://ui-avatars.com/api/?name=${encodeURIComponent(vt||Ie.displayName||"User")}&background=random`,role:((Ct=dr.data())==null?void 0:Ct.role)||(He?"admin":"user"),isAdmin:((Gt=dr.data())==null?void 0:Gt.isAdmin)??He,createdAt:((Xe=dr.data())==null?void 0:Xe.createdAt)||zr(),updatedAt:zr()};await Gn(Wr,Rt,{merge:!0}),(He||(Xt=dr.data())!=null&&Xt.isAdmin)&&await Gn(st(fe,"admins",Ie.uid),{email:Ie.email||"",isAdmin:!0,createdAt:((Ot=dr.data())==null?void 0:Ot.createdAt)||zr()},{merge:!0})}catch(Wr){if(Wr.code==="permission-denied"||(or=Wr.message)!=null&&or.includes("insufficient permissions")){const dr={error:Wr.message,operationType:"write",path:`users/${Ie.uid}`,authInfo:{userId:Ie.uid,email:Ie.email,emailVerified:Ie.emailVerified}};console.error("Firestore Permission Error:",JSON.stringify(dr))}else console.error("Error syncing user to Firestore:",Wr)}},Ae=ie.useRef(!1);return ie.useEffect(()=>{a&&!Ae.current&&(Ae.current=!0,e?e():t&&t())},[a]),a?s.jsxs("div",{className:"flex flex-col items-center justify-center p-12 bg-white rounded-3xl shadow-xl border border-gray-100 min-h-[300px]",children:[s.jsx(vn,{className:"animate-spin text-red-650 mb-3",size:32}),s.jsx("p",{className:"text-xs font-black uppercase tracking-widest text-[#9B2C2C]",children:"Accessing Campus Feed..."})]}):s.jsxs("div",{className:Ge("flex flex-col w-full max-w-lg mx-auto bg-white overflow-y-auto max-h-[88vh] custom-scrollbar relative shadow-2xl rounded-3xl border border-gray-100",r),children:[t&&s.jsx("button",{onClick:t,className:"absolute top-4 right-4 p-2 text-gray-400 hover:text-red-600 transition-all hover:rotate-90 z-30 bg-gray-50 hover:bg-red-50 rounded-full",title:"Close Modal",children:s.jsx(Jr,{size:20})}),s.jsxs("div",{className:"relative z-10 flex flex-col items-center p-6 md:p-8 space-y-5",children:[s.jsxs(Qt.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},className:"flex flex-col items-center space-y-2 text-center",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1 select-none",children:[s.jsx("img",{src:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",alt:"Campus Eye Media Logo",className:"h-11 w-11 rounded-full border border-gray-950 object-cover shadow-sm shrink-0",referrerPolicy:"no-referrer"}),s.jsxs("div",{className:"flex flex-col text-left -space-y-1",children:[s.jsxs("span",{className:"text-base font-serif font-black italic",children:[s.jsx("span",{className:"text-red-650",children:"Campus"})," ",s.jsx("span",{className:"text-blue-600",children:"Eye"})]}),s.jsx("span",{className:"text-[7.5px] font-sans font-extrabold uppercase tracking-[0.25em] text-black",children:"Media"})]})]}),s.jsx("h3",{className:"text-2xl font-bold text-gray-900 tracking-tight",children:y==="signin"?"Welcome Back":"Create Account"}),s.jsx("p",{className:"text-sm text-gray-500",children:y==="signin"?"Enter your details to access your account":"Join our community of campus citizens"})]}),s.jsxs("div",{className:"flex w-full bg-gray-50 rounded-xl p-1 border border-gray-100",children:[s.jsx("button",{onClick:()=>w("signin"),className:Ge("flex-1 py-2.5 text-xs font-semibold rounded-lg transition-all duration-300",y==="signin"?"bg-white text-red-600 shadow-sm":"text-gray-500 hover:text-gray-700"),children:"Login"}),s.jsx("button",{onClick:()=>w("signup"),className:Ge("flex-1 py-2.5 text-xs font-semibold rounded-lg transition-all duration-300",y==="signup"?"bg-white text-red-600 shadow-sm":"text-gray-500 hover:text-gray-700"),children:"Sign Up"})]}),s.jsxs("div",{className:"w-full space-y-8",children:[c&&s.jsxs(Qt.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"p-3.5 bg-emerald-50 text-emerald-800 text-[10px] font-bold tracking-tight rounded-2xl flex items-start gap-2.5 border border-emerald-100 text-left",children:[s.jsx("span",{className:"text-sm shrink-0",children:"🤝"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-extrabold uppercase text-[7.5px] tracking-[0.15em] text-emerald-600 mb-0.5",children:"Connection Action Pending"}),s.jsxs("p",{className:"font-sans text-gray-700 leading-snug",children:["Follow relation with ",s.jsxs("b",{className:"text-gray-950 font-black",children:["@",c.toLowerCase().replace(/\s+/g,"")]})," will activate instantly across all services as soon as you continue and log in below."]})]})]}),re&&s.jsx(Qt.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"p-4 bg-red-50 text-red-600 text-[10px] font-black uppercase tracking-widest leading-relaxed rounded-2xl text-center shadow-sm border border-red-100",children:re}),s.jsxs("form",{onSubmit:jt,className:"space-y-5",children:[y==="signup"&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"username",className:"text-xs font-semibold text-gray-700 ml-1",children:"Username"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"text",id:"username",required:!0,value:F,onChange:Ie=>$(Ie.target.value),className:Ge("w-full px-4 py-3 bg-gray-50 border border-gray-200 rounded-xl outline-none text-sm transition-all text-gray-900 focus:bg-white focus:border-red-600 placeholder:text-gray-400",F&&ve===!1&&"border-red-500 bg-red-50/30",F&&ve===!0&&"border-green-500 bg-green-50/30"),placeholder:"e.g. campus_hero"}),F.trim()&&s.jsx("div",{className:"absolute right-4 top-1/2 -translate-y-1/2",children:Ve?s.jsx(vn,{className:"animate-spin text-gray-400",size:16}):ve===!0?s.jsx("span",{className:"text-green-600 font-bold uppercase text-[9px] tracking-wider",children:"Available"}):ve===!1?s.jsx("span",{className:"text-red-500 font-bold uppercase text-[9px] tracking-wider",children:"Taken"}):null})]}),F.trim()&&!Ve&&s.jsx("p",{className:Ge("text-[10px] font-medium ml-1",ve===!0?"text-green-600":"text-red-500"),children:ve===!0?"✓ Username is available!":"✗ This username is already taken. Try another!"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"email",className:"text-xs font-semibold text-gray-700 ml-1",children:y==="signin"?"Email / Username":"Email Address"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"email",id:"email",required:!0,value:A,onChange:Ie=>S(Ie.target.value),className:Ge("w-full px-4 py-3 bg-gray-50 border border-gray-200 rounded-xl outline-none text-sm transition-all text-gray-900 focus:bg-white focus:border-red-600 placeholder:text-gray-400",A&&!se&&"border-red-500 bg-red-50/30"),placeholder:"Enter your email address"}),A&&s.jsx("div",{className:"absolute right-4 top-1/2 -translate-y-1/2",children:se?s.jsx(Rl,{className:"text-green-500",size:16}):s.jsx(sF,{className:"text-red-500",size:16})})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"password",className:"text-xs font-semibold text-gray-700 ml-1",children:"Password"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:D?"text":"password",id:"password",required:!0,value:j,onChange:Ie=>T(Ie.target.value),className:"w-full px-4 py-3 pr-11 bg-gray-50 border border-gray-200 rounded-xl outline-none text-sm transition-all text-gray-900 focus:bg-white focus:border-red-600 placeholder:text-gray-400",placeholder:"••••••••"}),s.jsx("button",{type:"button",onClick:()=>V(!D),className:"absolute right-3.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 p-1 transition-colors cursor-pointer",title:D?"Hide Password":"Show Password",children:D?s.jsx(eR,{size:18}):s.jsx(R1,{size:18})})]}),y==="signup"&&j.length>0&&s.jsxs("div",{className:"px-2 space-y-1",children:[s.jsx("div",{className:"flex gap-1 h-1",children:[1,2,3].map(Ie=>s.jsx("div",{className:Ge("flex-1 rounded-full transition-all duration-500",xe>=Ie?xe===1?"bg-red-500":xe===2?"bg-yellow-500":"bg-green-500":"bg-gray-100")},Ie))}),s.jsx("p",{className:"text-[9px] font-black uppercase tracking-widest text-gray-400",children:xe===1?"Weak":xe===2?"Good":"Strong"})]})]}),y==="signup"&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"confirmPassword",className:"text-xs font-semibold text-gray-700 ml-1",children:"Confirm Password"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:X?"text":"password",id:"confirmPassword",required:!0,value:U,onChange:Ie=>G(Ie.target.value),className:Ge("w-full px-4 py-3 pr-11 bg-gray-50 border border-gray-200 rounded-xl outline-none text-sm transition-all text-gray-900 focus:bg-white focus:border-red-600 placeholder:text-gray-400",U&&!qe&&"border-red-500 bg-red-50/30",U&&qe&&"border-green-500 bg-green-50/30"),placeholder:"••••••••"}),s.jsx("button",{type:"button",onClick:()=>q(!X),className:"absolute right-3.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 p-1 transition-colors cursor-pointer",title:X?"Hide Password":"Show Password",children:X?s.jsx(eR,{size:18}):s.jsx(R1,{size:18})})]}),U&&s.jsx("p",{className:Ge("text-[10px] font-medium ml-1",qe?"text-green-600":"text-red-500"),children:qe?"✓ Passwords match!":"✗ Passwords do not match"})]}),y==="signin"&&s.jsx("div",{className:"flex justify-end px-2",children:s.jsx("button",{type:"button",className:"text-[10px] font-black uppercase tracking-widest text-gray-400 hover:text-red-600 transition-colors",children:"Forgot Password?"})}),s.jsx("div",{className:"pt-2",children:s.jsx(Qt.button,{whileHover:pt?{scale:1.01}:{},whileTap:pt?{scale:.99}:{},type:"submit",disabled:f||!pt,className:Ge("w-full flex items-center justify-center gap-3 py-4 px-8 rounded-xl transition-all font-bold text-sm tracking-wide disabled:opacity-50",pt?"bg-red-600 text-white hover:bg-red-700 shadow-lg shadow-red-600/20":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:f?s.jsx(vn,{className:"animate-spin",size:20}):s.jsx("span",{children:y==="signin"?"Login":"Create Account"})})})]}),s.jsxs("div",{className:"text-center space-y-6",children:[s.jsxs("div",{className:"relative flex items-center py-4",children:[s.jsx("div",{className:"flex-grow border-t border-gray-100"}),s.jsx("span",{className:"flex-shrink mx-6 text-[10px] uppercase font-black tracking-[0.4em] text-gray-300",children:"Or"}),s.jsx("div",{className:"flex-grow border-t border-gray-100"})]}),s.jsxs(Qt.button,{whileHover:{backgroundColor:"rgba(0, 0, 0, 0.02)"},onClick:Fe,disabled:f,className:"w-full flex items-center justify-center gap-3 bg-white border border-gray-200 text-gray-700 py-3.5 px-8 rounded-xl transition-all font-semibold text-sm",children:[s.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[s.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),s.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),s.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z"}),s.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),s.jsx("span",{className:"font-black uppercase text-[11px] tracking-[0.2em]",children:"Continue with Google"})]}),c&&s.jsxs("div",{className:"pt-2 flex flex-col items-center justify-center space-y-2 select-none",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-red-100 flex items-center justify-center shadow-xs border border-red-200",children:s.jsx("img",{src:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",className:"w-6 h-6 rounded-full object-cover border border-gray-900",alt:"Campus Eye Logo",referrerPolicy:"no-referrer"})}),s.jsx("p",{className:"text-[7.5px] font-mono text-gray-400 uppercase tracking-widest leading-none",children:"Authorized Redirect Portal"})]})]})]})]})]})},RMe=()=>{const[e,t]=I.useState(!1),[r,n]=I.useState(!1);I.useEffect(()=>{const o=()=>{n(window.innerWidth<768)};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]);const i=[{name:"Threads",url:"https://www.threads.com/@campuseyemedia_",color:"bg-black text-white hover:bg-zinc-800 border-zinc-700",icon:s.jsx(iF,{size:16,strokeWidth:2.5})},{name:"YouTube",url:"https://youtube.com/@campuseye_media?si=gLddUotgI7D0n3cL",color:"bg-[#FF0000] text-white hover:bg-[#CC0000] border-red-500",icon:s.jsx(gF,{size:16})},{name:"LinkedIn",url:"https://www.linkedin.com/in/campuseyemedia?utm_source=share_via&utm_content=profile&utm_medium=member_android",color:"bg-[#0077B5] text-white hover:bg-[#005582] border-blue-600",icon:s.jsx(cF,{size:16})},{name:"Instagram",url:"https://www.instagram.com/campuseyemedia_?igsh=MXV6ejUyM2J3MnhsNA==",color:"bg-gradient-to-tr from-[#f9ce34] via-[#ee2a7b] to-[#6228d7] text-white hover:brightness-110 border-pink-500",icon:s.jsx(lF,{size:16})},{name:"X",url:"https://x.com/campuseye_media",color:"bg-black text-white hover:bg-zinc-800 border-zinc-700",icon:s.jsx(uq,{size:14,className:"text-white"})},{name:"Facebook",url:"https://www.facebook.com/share/1FivBManaT/",color:"bg-[#1877F2] text-white hover:bg-[#1258b3] border-blue-500",icon:s.jsx(oF,{size:16})},{name:"TikTok",url:"https://www.tiktok.com/@campuseye_media?_r=1&_t=ZS-96ci42CXliv",color:"bg-[#000000] text-white hover:bg-zinc-900 border-red-500",icon:s.jsx(dq,{size:14,className:"text-white"})},{name:"WhatsApp",url:"https://whatsapp.com/channel/0029Vb6OR49CXC3C5hCVlv3Q",color:"bg-[#25D366] text-white hover:bg-[#1ebe5d] border-green-500",icon:s.jsx(qp,{size:16})}],a=(o,c)=>{const h=r?145:195,f=180,y=270-f,A=(f+o/(c-1)*y)*Math.PI/180;return{x:h*Math.cos(A),y:h*Math.sin(A)}};return s.jsxs("div",{className:"fixed bottom-18 md:bottom-8 right-6 md:right-8 z-[1051] flex items-center justify-center",children:[e&&s.jsx("div",{onClick:()=>t(!1),className:"fixed inset-0 bg-transparent cursor-default"}),s.jsx(on,{children:e&&i.map((o,c)=>{const{x:h,y:f}=a(c,i.length);return s.jsxs(Qt.a,{href:o.url,target:"_blank",rel:"noopener noreferrer",initial:{x:0,y:0,scale:0,opacity:0},animate:{x:h,y:f,scale:1,opacity:1,transition:{type:"spring",stiffness:300,damping:18,delay:c*.035}},exit:{x:0,y:0,scale:0,opacity:0,transition:{duration:.15,delay:(i.length-1-c)*.02}},whileHover:{scale:1.15,zIndex:100},whileTap:{scale:.9},className:Ge("absolute w-10 h-10 md:w-11 md:h-11 rounded-full flex items-center justify-center border border-white/25 shadow-lg shadow-black/30 cursor-pointer text-white hover:scale-110 active:scale-95 transition-shadow select-none",o.color),children:[s.jsx("div",{className:"absolute opacity-0 hover:opacity-100 md:group-hover:opacity-100 transition-opacity bg-black/80 backdrop-blur-md text-white text-[9px] font-black uppercase tracking-wider py-1 px-2 rounded-md -top-8 pointer-events-none whitespace-nowrap border border-zinc-700 shadow-xl",children:o.name}),o.icon]},o.name)})}),s.jsx(Qt.button,{onClick:()=>t(!e),whileHover:{scale:1.08},whileTap:{scale:.92},className:Ge("w-10 h-10 md:w-11 md:h-11 rounded-full flex items-center justify-center cursor-pointer shadow-xl select-none transition-all border outline-none duration-300 z-[1052]",e?"bg-red-600 border-red-500 text-white shadow-red-600/30 rotate-180":"bg-white border-gray-150 text-[#af05ea] hover:bg-gray-50 shadow-purple-600/10"),children:s.jsx(on,{mode:"wait",children:e?s.jsx(Qt.div,{initial:{rotate:-90,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:90,opacity:0},transition:{duration:.2},children:s.jsx(Jr,{size:16,strokeWidth:2.5})},"close-icon"):s.jsx(Qt.div,{initial:{rotate:90,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:-90,opacity:0},transition:{duration:.2},className:"relative flex items-center justify-center p-0.5",children:s.jsx(Ope,{size:18,className:"relative z-10"})},"share-icon")})})]})},DMe=({articles:e})=>{const[t,r]=ie.useState(0),n=ie.useMemo(()=>e.filter(h=>h&&h.id),[e]);if(ie.useEffect(()=>{if(n.length<2)return;const h=setInterval(()=>{r(f=>(f+2)%n.length)},6e3);return()=>clearInterval(h)},[n]),n.length<2)return null;const i=n[t%n.length],a=n[(t+1)%n.length],o=[i,a].filter(Boolean),c=h=>{const f=new CustomEvent("selectArticle",{detail:h});window.dispatchEvent(f)};return s.jsx("div",{className:"w-full bg-gradient-to-r from-gray-50 via-white to-gray-50 border-b border-gray-100 py-3.5 select-none",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 flex flex-col md:flex-row items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2.5 shrink-0 self-start md:self-auto",children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 bg-red-50 text-red-650 rounded-lg border border-red-200/60 shadow-2xs",children:[s.jsx(xF,{size:13,className:"animate-pulse"}),s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest",children:"Live Wire"})]}),s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-gray-500 hidden lg:inline",children:"Campus Dispatches"})]}),s.jsx(on,{mode:"wait",children:s.jsx(Qt.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.35,ease:"easeOut"},className:"flex-1 flex flex-col sm:flex-row items-stretch justify-around gap-3 w-full",children:o.map((h,f)=>h?s.jsxs("div",{onClick:()=>c(h),className:"flex items-center gap-3 bg-white px-3.5 py-2 rounded-xl border border-gray-200/70 hover:border-red-300 flex-1 cursor-pointer transition-all group shadow-2xs hover:shadow-xs",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden shrink-0 bg-gray-100 border border-gray-100",children:s.jsx(Bi,{src:h.featuredImageUrl||`data:image/svg+xml;utf8,${(h.title||"CE").substring(0,2).toUpperCase()}`,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",alt:""})}),s.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[s.jsx("p",{className:"text-xs font-bold text-gray-900 truncate leading-snug group-hover:text-red-650 transition-colors",children:h.title||"Dispatch"}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{className:"text-[9px] font-black text-red-650 uppercase tracking-wider",children:h.category||"News"}),s.jsx("span",{className:"text-gray-300 text-[10px]",children:"•"}),s.jsx("span",{className:"text-[9px] font-semibold text-gray-400",children:h.authorName||"Campus Eye"})]})]}),s.jsx(Gp,{size:14,className:"text-gray-300 group-hover:text-red-650 group-hover:translate-x-0.5 transition-all shrink-0"})]},h.id||f):null)},t)})]})})},MMe=({setActiveTab:e,articles:t=[],isAdmin:r})=>{var K,me;const[n,i]=ie.useState(""),[a,o]=ie.useState(!1),[c,h]=ie.useState(null),f=new Date().getFullYear(),m=!!(r||Ne.currentUser&&(((K=Ne.currentUser.email)==null?void 0:K.toLowerCase())==="atwiinevictor2@gmail.com"||((me=Ne.currentUser.email)==null?void 0:me.toLowerCase())==="campuseye@gmail.com")),[y,w]=ie.useState([]),[A,S]=ie.useState(!1),[j,T]=ie.useState(""),[D,V]=ie.useState(""),[U,G]=ie.useState(null),[X,q]=ie.useState(""),[B,z]=ie.useState(!1);ie.useEffect(()=>{const re=Jt(nt(fe,"sponsors"),yi(15)),le=Jt(nt(fe,"adverts"),yi(20));Promise.all([vr(re).catch(()=>null),vr(le).catch(()=>null)]).then(([ve,je])=>{const Ve=[];ve&&!ve.empty&&ve.docs.forEach(Z=>Ve.push({id:Z.id,targetCollection:"sponsors",...Z.data()})),je&&!je.empty&&je.docs.forEach(Z=>{const se=Z.data();(se.imageUrl||se.mediaUrl)&&Ve.push({id:Z.id,targetCollection:"adverts",name:se.company||se.title||"Partner",imageUrl:se.imageUrl||se.mediaUrl||"",link:se.targetUrl||se.link||"#"})}),w(Ve)})},[]);const F=async re=>{if(re.preventDefault(),!m){he.error("Access Denied: Only administrators can add sponsors.");return}if(!j.trim()){he.error("Please enter a sponsor name");return}z(!0);try{let le=X.trim();if(U&&(he.loading("Uploading sponsor logo...",{id:"sponsor-upload"}),le=await I4(U),he.dismiss("sponsor-upload")),!le){he.error("Please upload an image file or enter an image URL"),z(!1);return}const je={id:(await dn(nt(fe,"sponsors"),{name:j.trim(),imageUrl:le,link:D.trim()||"#",status:"active",createdAt:zr()})).id,name:j.trim(),imageUrl:le,link:D.trim()||"#",targetCollection:"sponsors"};w(Ve=>[je,...Ve]),he.success(`Sponsor "${j}" added successfully!`),T(""),V(""),G(null),q(""),S(!1)}catch(le){console.error("Failed to add sponsor:",le),he.error("Failed to add sponsor: "+le.message)}finally{z(!1)}},$=async(re,le,ve="sponsors")=>{if(!m){he.error("Access Denied: Only administrators can delete sponsors.");return}if(window.confirm(`Are you sure you want to delete sponsor "${le}"?`))try{w(je=>je.filter(Ve=>Ve.id!==re)),await ai(st(fe,ve||"sponsors",re)),he.success(`Deleted "${le}" successfully!`)}catch(je){console.error("Failed to delete sponsor:",je),he.error("Failed to delete sponsor: "+je.message)}},J=re=>{re.preventDefault(),n&&(o(!0),he.success("Thank you for subscribing to Campus Eye Dispatch!",{icon:"📬"}),i(""),setTimeout(()=>o(!1),4e3))},Q=[{name:"X (Twitter)",icon:s.jsx(uq,{size:14,className:"text-gray-600 group-hover:text-black"}),href:"https://x.com/campuseye_media",hoverClass:"hover:bg-black/5 hover:border-black"},{name:"WhatsApp Channel",icon:s.jsx(qp,{size:15,className:"text-emerald-600 group-hover:text-emerald-700"}),href:"https://whatsapp.com/channel/0029Vb6OR49CXC3C5hCVlv3Q",hoverClass:"hover:bg-emerald-50 hover:border-emerald-400"},{name:"YouTube",icon:s.jsx(gF,{size:15,className:"text-red-600 group-hover:text-red-700"}),href:"https://youtube.com/@campuseye_media?si=gLddUotgI7D0n3cL",hoverClass:"hover:bg-red-50 hover:border-red-400"},{name:"Instagram",icon:s.jsx(lF,{size:15,className:"text-pink-600 group-hover:text-pink-700"}),href:"https://www.instagram.com/campuseyemedia_?igsh=MXV6ejUyM2J3MnhsNA==",hoverClass:"hover:bg-pink-50 hover:border-pink-400"},{name:"LinkedIn",icon:s.jsx(cF,{size:15,className:"text-blue-600 group-hover:text-blue-700"}),href:"https://www.linkedin.com/in/campuseyemedia?utm_source=share_via&utm_content=profile&utm_medium=member_android",hoverClass:"hover:bg-blue-50 hover:border-blue-400"},{name:"TikTok",icon:s.jsx(dq,{size:14,className:"text-gray-800 group-hover:text-black"}),href:"https://www.tiktok.com/@campuseye_media?_r=1&_t=ZS-96ci42CXliv",hoverClass:"hover:bg-gray-100 hover:border-gray-800"},{name:"Threads",icon:s.jsx(iF,{size:15,className:"text-gray-700 group-hover:text-black"}),href:"https://www.threads.com/@campuseyemedia_",hoverClass:"hover:bg-gray-100 hover:border-gray-800"},{name:"Facebook",icon:s.jsx(oF,{size:15,className:"text-blue-700 group-hover:text-blue-800"}),href:"https://www.facebook.com/share/1FivBManaT/",hoverClass:"hover:bg-blue-50 hover:border-blue-500"}];return s.jsxs("footer",{className:"bg-white border-t border-gray-100 mt-16 relative overflow-hidden font-sans select-none",children:[s.jsxs("div",{className:"w-full max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pt-12 pb-16",children:[t.length>0&&s.jsxs("div",{className:"pb-12 border-b border-gray-100 mb-12",children:[s.jsxs("div",{className:"flex items-center justify-between gap-4 mb-6",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-red-650 animate-ping"}),s.jsx("h3",{className:"text-xs font-black uppercase tracking-wider text-gray-900",children:"Recommended For You"})]}),s.jsx("span",{className:"text-[11px] font-semibold text-gray-400",children:"Curated Student Headlines"})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4",children:t.slice(0,6).map(re=>s.jsxs("div",{className:"group cursor-pointer flex flex-col bg-gray-50/70 hover:bg-white rounded-2xl p-2.5 border border-gray-200/60 hover:border-red-200 hover:shadow-md transition-all duration-300 text-left",onClick:()=>{const le=new CustomEvent("selectArticle",{detail:re});window.dispatchEvent(le)},children:[s.jsxs("div",{className:"aspect-[16/10] bg-gray-100 overflow-hidden rounded-xl mb-2.5 border border-gray-100 relative",children:[s.jsx(Bi,{src:re.featuredImageUrl||void 0,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",alt:re.title}),s.jsx("span",{className:"absolute top-2 left-2 px-2 py-0.5 bg-black/75 backdrop-blur-xs text-white text-[9px] font-black uppercase tracking-wider rounded-md",children:re.category||"News"})]}),s.jsx("h4",{className:"text-xs font-bold text-gray-900 line-clamp-2 leading-snug group-hover:text-red-650 transition-colors mb-1.5",children:re.title}),s.jsxs("p",{className:"text-[10px] font-medium text-gray-400 mt-auto truncate",children:["By ",re.authorName||"Campus Eye"]})]},re.id))})]}),s.jsxs("div",{className:"pb-10 border-b border-gray-100 mb-12 text-left",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Xi,{size:14,className:"text-red-650"}),s.jsx("h3",{className:"text-xs font-black uppercase tracking-wider text-gray-900",children:"Our Strategic Partners & Sponsors"})]}),s.jsx("p",{className:"text-[11px] font-medium text-gray-500 mt-0.5",children:"Supporting independent university journalism & student media innovation"})]}),m&&s.jsxs("button",{onClick:()=>S(!0),className:"px-3.5 py-1.5 bg-red-650 hover:bg-red-700 text-white rounded-xl text-[11px] font-black uppercase tracking-wider flex items-center gap-1.5 transition-all shadow-xs cursor-pointer shrink-0 self-start sm:self-auto",children:[s.jsx(Uc,{size:13}),s.jsx("span",{children:"Add Sponsor"})]})]}),s.jsx("div",{className:"flex flex-wrap items-center gap-3",children:y.length>0?y.map(re=>s.jsxs("div",{className:"flex items-center gap-2.5 bg-gray-50/90 hover:bg-white px-3.5 py-2 rounded-xl border border-gray-200 hover:border-red-300 hover:shadow-xs transition-all group/sps",children:[re.link&&re.link!=="#"?s.jsxs("a",{href:re.link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 hover:opacity-90 transition-opacity",children:[re.imageUrl&&s.jsx("img",{src:re.imageUrl,className:"h-6 w-auto max-w-[80px] object-contain rounded",alt:re.name,referrerPolicy:"no-referrer"}),s.jsx("span",{className:"text-xs font-bold text-gray-800 group-hover/sps:text-red-650 transition-colors",children:re.name}),s.jsx(za,{size:11,className:"text-gray-400 group-hover/sps:text-red-650"})]}):s.jsxs("div",{className:"flex items-center gap-2.5",children:[re.imageUrl&&s.jsx("img",{src:re.imageUrl,className:"h-6 w-auto max-w-[80px] object-contain rounded",alt:re.name,referrerPolicy:"no-referrer"}),s.jsx("span",{className:"text-xs font-bold text-gray-800",children:re.name})]}),m&&s.jsx("button",{onClick:()=>$(re.id,re.name,re.targetCollection),className:"w-5 h-5 bg-gray-200/70 hover:bg-red-650 text-gray-600 hover:text-white rounded-full flex items-center justify-center transition-all cursor-pointer shrink-0 ml-1",title:`Delete ${re.name}`,children:s.jsx(Es,{size:10})})]},re.id)):s.jsxs("div",{className:"p-4 bg-gray-50 border border-gray-200/80 rounded-2xl flex flex-col sm:flex-row items-center justify-between gap-3 w-full",children:[s.jsx("span",{className:"text-xs text-gray-600 font-medium",children:"Partner with Campus Eye Media to reach over 100,000+ university students and scholars across Africa."}),s.jsx("button",{onClick:()=>h("advertise"),className:"text-xs font-black text-red-650 uppercase tracking-wider bg-white px-3.5 py-1.5 rounded-xl border border-gray-200 shadow-2xs hover:bg-red-50 cursor-pointer shrink-0",children:"Become a Sponsor"})]})})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-12 gap-8 lg:gap-10 text-left",children:[s.jsxs("div",{className:"lg:col-span-4 space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-11 h-11 rounded-full overflow-hidden border-2 border-red-600 p-[1.5px] bg-white shrink-0 shadow-2xs",children:s.jsx("img",{src:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",alt:"Campus Eye Logo",className:"w-full h-full object-cover rounded-full",referrerPolicy:"no-referrer"})}),s.jsxs("div",{children:[s.jsxs("h2",{className:"text-base font-black tracking-tight text-gray-950 uppercase italic leading-none",children:["CAMPUS ",s.jsx("span",{className:"text-red-650",children:"EYE"})," MEDIA"]}),s.jsx("p",{className:"text-[9px] font-black uppercase tracking-[0.2em] text-red-650 mt-1",children:"Where stories unfold"})]})]}),s.jsx("p",{className:"text-xs text-gray-600 leading-relaxed font-normal max-w-sm",children:"The premier digital destination for university journalism, student dispatches, culture, investigative reports, and collegiate sports across higher institutions."}),s.jsxs("div",{className:"space-y-2.5 pt-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-bold uppercase tracking-wider text-gray-700",children:[s.jsx(Xs,{size:13,className:"text-red-650"}),s.jsx("span",{children:"Join Our Campus Newsletter"})]}),s.jsxs("form",{onSubmit:J,className:"flex gap-2 max-w-sm",children:[s.jsx("input",{type:"email",placeholder:"Enter your university email...",value:n,onChange:re=>i(re.target.value),className:"flex-1 px-3.5 py-2.5 text-xs border border-gray-200 rounded-xl focus:outline-none focus:border-red-600 transition-colors bg-gray-50/70",required:!0}),s.jsx("button",{type:"submit",className:"px-4 py-2.5 bg-gray-950 hover:bg-red-650 text-white font-bold text-xs uppercase tracking-wider rounded-xl transition-all flex items-center gap-1.5 shrink-0 shadow-xs cursor-pointer",children:a?s.jsx(Rl,{size:14,className:"text-emerald-400"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Join"}),s.jsx(Ip,{size:13})]})})]})]})]}),s.jsxs("div",{className:"lg:col-span-3 space-y-4",children:[s.jsx("h3",{className:"text-xs font-black uppercase tracking-wider text-gray-900 border-l-2 border-red-650 pl-2.5",children:"Explore Newsroom"}),s.jsxs("ul",{className:"space-y-2.5 text-xs font-semibold text-gray-600",children:[s.jsx("li",{children:s.jsx("button",{onClick:()=>e==null?void 0:e("home"),className:"hover:text-red-650 transition-colors flex items-center gap-1.5 cursor-pointer",children:s.jsx("span",{children:"Campus News"})})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e==null?void 0:e("podcasts"),className:"hover:text-red-650 transition-colors flex items-center gap-1.5 cursor-pointer",children:s.jsx("span",{children:"Podcasts & Broadcasts"})})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e==null?void 0:e("posts"),className:"hover:text-red-650 transition-colors flex items-center gap-1.5 cursor-pointer",children:s.jsx("span",{children:"Peer Dispatches & Lounge"})})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e==null?void 0:e("sport"),className:"hover:text-red-650 transition-colors flex items-center gap-1.5 cursor-pointer",children:s.jsx("span",{children:"Sports Arena"})})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e==null?void 0:e("entertainment"),className:"hover:text-red-650 transition-colors flex items-center gap-1.5 cursor-pointer",children:s.jsx("span",{children:"Entertainment & Culture"})})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e==null?void 0:e("politics"),className:"hover:text-red-650 transition-colors flex items-center gap-1.5 cursor-pointer",children:s.jsx("span",{children:"Politics & Governance"})})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e==null?void 0:e("campus-debates"),className:"hover:text-red-650 transition-colors flex items-center gap-1.5 cursor-pointer",children:s.jsx("span",{children:"Campus Debates & Polls"})})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e==null?void 0:e("market"),className:"hover:text-red-650 transition-colors flex items-center gap-1.5 cursor-pointer",children:s.jsx("span",{children:"Student Market Hub"})})})]})]}),s.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[s.jsx("h3",{className:"text-xs font-black uppercase tracking-wider text-gray-900 border-l-2 border-red-650 pl-2.5",children:"Information"}),s.jsxs("ul",{className:"space-y-2.5 text-xs font-semibold text-gray-600",children:[s.jsx("li",{children:s.jsx("button",{onClick:()=>h("about"),className:"hover:text-red-650 transition-colors cursor-pointer text-left",children:"About Campus Eye"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>h("contact"),className:"hover:text-red-650 transition-colors cursor-pointer text-left",children:"Contact & Tips"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>h("privacy"),className:"hover:text-red-650 transition-colors cursor-pointer text-left",children:"Privacy Policy"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>h("terms"),className:"hover:text-red-650 transition-colors cursor-pointer text-left",children:"Terms of Service"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>h("guidelines"),className:"hover:text-red-650 transition-colors cursor-pointer text-left",children:"Editorial Guidelines"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>h("advertise"),className:"hover:text-red-650 transition-colors cursor-pointer text-left",children:"Advertise With Us"})})]})]}),s.jsxs("div",{className:"lg:col-span-3 space-y-5",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx("h3",{className:"text-xs font-black uppercase tracking-wider text-gray-900 border-l-2 border-red-650 pl-2.5",children:"Download App"}),s.jsx("p",{className:"text-xs text-gray-500 leading-relaxed",children:"Enjoy offline reader mode, breaking push alerts, and audio dispatches on your phone."}),s.jsxs("div",{className:"flex flex-col sm:flex-row lg:flex-col gap-2 pt-1",children:[s.jsxs("a",{href:"https://link.thelocalrent.com/v?t=1786099107&tk=07c43b29b01fcaf275f96eea938d430f",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 px-3.5 py-2 bg-gray-950 text-white hover:bg-neutral-800 transition-all rounded-xl border border-gray-800 shadow-xs group shrink-0",title:"Download Campus Eye Android App",children:[s.jsx("svg",{className:"w-5 h-5 text-white shrink-0",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M3,5.27V18.73L16.55,12L3,5.27M17.87,11.33L19.5,12.15L17.87,12.97L16.93,12.5L17.87,11.33M3,19.53L16.27,12.89L13.87,15.29L3,19.53M3,4.47L13.87,8.71L16.27,11.11L3,4.47Z"})}),s.jsxs("div",{className:"text-left leading-none",children:[s.jsx("p",{className:"text-[8px] text-gray-400 font-bold uppercase tracking-wider",children:"Get it on"}),s.jsx("p",{className:"text-xs font-black tracking-tight mt-0.5",children:"Google Play"})]})]}),s.jsxs("a",{href:"https://link.thelocalrent.com/v?t=1786099107&tk=07c43b29b01fcaf275f96eea938d430f",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 px-3.5 py-2 bg-gray-950 text-white hover:bg-neutral-800 transition-all rounded-xl border border-gray-800 shadow-xs group shrink-0",title:"Download Campus Eye iOS App",children:[s.jsx("svg",{className:"w-5 h-5 text-white shrink-0",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M18.71,19.5C17.88,20.74 17,21.95 15.66,21.97C14.32,22 13.89,21.18 12.37,21.18C10.84,21.18 10.37,21.95 9.1,22C7.79,22.05 6.8,20.68 5.96,19.47C4.25,17 2.94,12.45 4.7,9.39C5.57,7.87 7.13,6.91 8.82,6.88C10.1,6.86 11.32,7.75 12.11,7.75C12.89,7.75 14.37,6.68 15.92,6.84C16.57,6.87 18.39,7.1 19.56,8.82C19.47,8.88 17.39,10.1 17.41,12.63C17.44,15.65 20.06,16.66 20.1,16.67C20.08,16.74 19.67,18.11 18.71,19.5M15.97,4.17C16.63,3.37 17.07,2.28 16.95,1C16,1.04 14.9,1.6 14.24,2.38C13.68,3.04 13.19,4.14 13.34,5.39C14.39,5.47 15.4,4.88 15.97,4.17Z"})}),s.jsxs("div",{className:"text-left leading-none",children:[s.jsx("p",{className:"text-[8px] text-gray-400 font-bold uppercase tracking-wider",children:"Download on the"}),s.jsx("p",{className:"text-xs font-black tracking-tight mt-0.5",children:"App Store"})]})]})]})]}),s.jsxs("div",{className:"space-y-2 pt-2 border-t border-gray-100",children:[s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-gray-400 block",children:"Connect With Us"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:Q.map(re=>s.jsx("a",{href:re.href,target:"_blank",rel:"noopener noreferrer",className:`w-8 h-8 rounded-xl border border-gray-200 bg-gray-50 flex items-center justify-center transition-all duration-200 group hover:scale-105 shadow-2xs ${re.hoverClass}`,title:re.name,children:re.icon},re.name))})]})]})]}),s.jsxs("div",{className:"mt-14 pt-8 border-t border-gray-200/80 flex flex-col md:flex-row justify-between items-center gap-4 text-[11px] font-bold text-gray-600",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-2 text-center sm:text-left",children:[s.jsxs("span",{className:"uppercase tracking-wider",children:["© ",f," CAMPUS EYE MEDIA. ALL RIGHTS RESERVED."]}),s.jsx("span",{className:"hidden sm:inline text-gray-300",children:"•"}),s.jsxs("span",{className:"text-gray-500 font-medium",children:["Designed with 💙 by"," ",s.jsx("a",{href:"https://cybertechsoftwares.netlify.app",target:"_blank",rel:"noopener noreferrer",className:"hover:underline text-blue-650 font-bold",children:"Cyber Tech softwares"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-x-5 gap-y-2 justify-center text-gray-500",children:[s.jsx("button",{onClick:()=>h("careers"),className:"hover:text-red-650 transition-colors cursor-pointer",children:"Careers"}),s.jsx("button",{onClick:()=>h("staff"),className:"hover:text-red-650 transition-colors cursor-pointer",children:"Staff Directory"}),s.jsx("button",{onClick:()=>h("advertise"),className:"hover:text-red-650 transition-colors cursor-pointer",children:"Advertise"}),s.jsx("a",{href:"/sitemap.xml",target:"_blank",rel:"noopener noreferrer",className:"hover:text-red-650 transition-colors",children:"Sitemap XML"}),r&&s.jsx("button",{onClick:()=>e==null?void 0:e("admin"),className:"hover:text-red-650 transition-colors font-black text-red-650 cursor-pointer",children:"Admin Panel"})]})]})]}),s.jsx(on,{children:A&&s.jsx("div",{className:"fixed inset-0 z-[10000] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:s.jsxs(Qt.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},className:"bg-white rounded-3xl p-6 md:p-8 max-w-md w-full shadow-2xl border border-gray-100 text-left space-y-5 relative",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2.5 bg-red-50 text-red-650 rounded-2xl",children:s.jsx(Uc,{size:20})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-black uppercase tracking-tight text-gray-900",children:"Add Footer Sponsor"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:"Logo & Partner Listing"})]})]}),s.jsx("button",{onClick:()=>S(!1),className:"p-2 text-gray-400 hover:text-gray-900 rounded-full hover:bg-gray-100 transition-colors cursor-pointer",children:s.jsx(Jr,{size:18})})]}),s.jsxs("form",{onSubmit:F,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-gray-500 mb-1",children:"Sponsor / Partner Name *"}),s.jsx("input",{type:"text",required:!0,value:j,onChange:re=>T(re.target.value),placeholder:"e.g. MTN Uganda, Stanbic, Makerere Guild",className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-4 py-2.5 text-xs font-bold text-gray-900 outline-none focus:border-red-600"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-gray-500 mb-1",children:"Sponsor Logo (File Upload)"}),s.jsxs("label",{className:"flex items-center gap-3 p-3 bg-gray-50 border border-dashed border-gray-300 rounded-xl cursor-pointer hover:bg-gray-100 transition-colors",children:[s.jsx(mF,{size:18,className:"text-red-650 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs font-bold text-gray-700 truncate",children:U?U.name:"Choose Logo File..."}),s.jsx("p",{className:"text-[9px] text-gray-400 font-medium",children:"Automatic cloud storage upload"})]}),s.jsx("input",{type:"file",accept:"image/*",onChange:re=>{re.target.files&&re.target.files[0]&&(G(re.target.files[0]),q(""))},className:"hidden"})]})]}),s.jsxs("div",{className:"relative flex items-center justify-center",children:[s.jsx("div",{className:"border-t border-gray-100 w-full"}),s.jsx("span",{className:"bg-white px-3 text-[9px] font-black text-gray-400 uppercase tracking-widest absolute",children:"OR"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-gray-500 mb-1",children:"Sponsor Logo Image URL"}),s.jsx("input",{type:"url",value:X,onChange:re=>{q(re.target.value),re.target.value&&G(null)},placeholder:"https://i.ibb.co/example/logo.png",className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-4 py-2.5 text-xs font-mono text-gray-900 outline-none focus:border-red-600"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-gray-500 mb-1",children:"Website / Partner URL (Optional)"}),s.jsx("input",{type:"text",value:D,onChange:re=>V(re.target.value),placeholder:"https://sponsorwebsite.com",className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-4 py-2.5 text-xs font-mono text-gray-900 outline-none focus:border-red-600"})]}),s.jsxs("div",{className:"pt-2 flex items-center justify-end gap-3",children:[s.jsx("button",{type:"button",onClick:()=>S(!1),className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-xl text-xs font-bold uppercase tracking-wider transition-colors cursor-pointer",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:B,className:"px-5 py-2.5 bg-red-650 hover:bg-red-700 text-white rounded-xl text-xs font-black uppercase tracking-wider shadow-sm transition-all flex items-center gap-2 cursor-pointer disabled:opacity-50",children:B?"Saving...":"Save Sponsor"})]})]})]})})}),s.jsx(on,{children:c&&s.jsx("div",{className:"fixed inset-0 z-[10000] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:s.jsxs(Qt.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},className:"bg-white rounded-3xl max-w-2xl w-full max-h-[85vh] overflow-hidden shadow-2xl border border-gray-100 flex flex-col text-left",children:[s.jsxs("div",{className:"p-6 border-b border-gray-100 flex items-center justify-between bg-gray-50/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-10 h-10 rounded-2xl bg-red-50 text-red-650 flex items-center justify-center",children:[c==="about"&&s.jsx(Bre,{size:20}),c==="contact"&&s.jsx(Xs,{size:20}),c==="privacy"&&s.jsx(ul,{size:20}),c==="terms"&&s.jsx(M0,{size:20}),c==="guidelines"&&s.jsx(aF,{size:20}),c==="careers"&&s.jsx(ko,{size:20}),c==="staff"&&s.jsx(ko,{size:20}),c==="advertise"&&s.jsx(wu,{size:20})]}),s.jsxs("div",{children:[s.jsxs("h3",{className:"text-base font-black text-gray-900 uppercase tracking-tight",children:[c==="about"&&"About Campus Eye Media",c==="contact"&&"Contact & Editorial Desk",c==="privacy"&&"Privacy Policy",c==="terms"&&"Terms of Service",c==="guidelines"&&"Editorial Guidelines",c==="careers"&&"Join Our Newsroom (Careers)",c==="staff"&&"Staff Directory & Leadership",c==="advertise"&&"Advertising & Strategic Partnerships"]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:"Campus Eye Media Digital Newsroom"})]})]}),s.jsx("button",{onClick:()=>h(null),className:"p-2 text-gray-400 hover:text-gray-900 rounded-full hover:bg-gray-200/60 transition-colors cursor-pointer",children:s.jsx(Jr,{size:20})})]}),s.jsxs("div",{className:"p-6 overflow-y-auto space-y-4 text-xs text-gray-600 leading-relaxed",children:[c==="about"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"font-semibold text-gray-900 text-sm",children:"Campus Eye Media is the premier independent digital news organization covering higher education, student culture, campus politics, athletics, and investigative journalism."}),s.jsx("p",{children:"Founded to empower student voices and foster accountable leadership across African colleges and universities, Campus Eye brings together aspiring student reporters, photographers, podcast hosts, and digital creators."}),s.jsxs("div",{className:"bg-red-50/60 border border-red-200/80 p-4 rounded-2xl text-red-950 space-y-1",children:[s.jsx("h4",{className:"font-black text-xs uppercase tracking-wider text-red-650",children:"Our Mission"}),s.jsx("p",{className:"text-xs",children:"To deliver fearless, accurate, and uplifting journalism that bridges students, university administrators, and the wider society."})]})]}),c==="contact"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Have a breaking news tip, story pitch, press release, or campus query? Reach out directly to our editorial and reporting desk:"}),s.jsxs("div",{className:"space-y-3 bg-gray-50 p-4 rounded-2xl border border-gray-200",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-gray-400 block",children:"General Inquiries & News Desk"}),s.jsx("a",{href:"mailto:campuseye@gmail.com",className:"text-sm font-bold text-red-650 hover:underline",children:"campuseye@gmail.com"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-gray-400 block",children:"WhatsApp News Tip Hotline"}),s.jsxs("a",{href:"https://whatsapp.com/channel/0029Vb6OR49CXC3C5hCVlv3Q",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-bold text-emerald-600 hover:underline flex items-center gap-1.5 mt-0.5",children:[s.jsx(qp,{size:14}),s.jsx("span",{children:"Campus Eye WhatsApp Channel"})]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-gray-400 block",children:"Headquarters"}),s.jsx("span",{className:"text-xs text-gray-800 font-medium",children:"Kampala International University / Makerere / Regional Bureaus"})]})]})]}),c==="privacy"&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"font-bold text-gray-900",children:"1. Data Privacy Commitment"}),s.jsx("p",{children:"Campus Eye Media respects your privacy. We do not sell personal identification information or share private account records with third-party data brokers."}),s.jsx("h4",{className:"font-bold text-gray-900",children:"2. Local Storage & Offline Cache"}),s.jsx("p",{children:"Our Progressive Web Application uses local browser storage to save offline bookmarked articles and caching preferences to minimize your mobile data consumption."}),s.jsx("h4",{className:"font-bold text-gray-900",children:"3. Authentication & Comments"}),s.jsx("p",{children:"When you sign in using Google or email credentials, only your public name, email, and avatar are stored to authenticate your community posts and comments."})]}),c==="terms"&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"font-bold text-gray-900",children:"1. Acceptance of Terms"}),s.jsx("p",{children:"By accessing Campus Eye Media, reader services, podcasts, and community dispatches, you agree to adhere to our civil engagement standards and applicable copyright laws."}),s.jsx("h4",{className:"font-bold text-gray-900",children:"2. Community Guidelines & Hate Speech"}),s.jsx("p",{children:"We enforce zero tolerance for hate speech, targeted harassment, defamation, or unauthorized commercial spam. Violating accounts are subject to immediate suspension."}),s.jsx("h4",{className:"font-bold text-gray-900",children:"3. Content Attribution"}),s.jsx("p",{children:"All original articles, podcast recordings, and photographs remain the intellectual property of Campus Eye Media and their respective student contributors."})]}),c==="guidelines"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Our newsroom adheres to standard journalistic integrity and verification protocols:"}),s.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Accuracy:"})," All factual claims must be corroborated by multiple independent primary sources."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Fairness:"})," Individuals or institutions facing critical claims must be offered fair opportunity to comment prior to publication."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Corrections:"})," Factual errors are updated promptly with transparent editorial correction notices."]})]})]}),c==="careers"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Are you a student passionate about journalism, digital photography, video editing, social media management, or podcast production?"}),s.jsxs("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-2xl space-y-2",children:[s.jsx("h4",{className:"font-bold text-gray-900",children:"Open Positions for Semester Interns & Reporters:"}),s.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[s.jsx("li",{children:"Campus Beat Reporter (Politics & Guild)"}),s.jsx("li",{children:"Sports Correspondent (University Leagues & Tournaments)"}),s.jsx("li",{children:"Podcast Host & Audio Producer"}),s.jsx("li",{children:"Social Media & TikTok Video Creator"})]}),s.jsxs("p",{className:"text-xs pt-2",children:["Send your CV or writing samples to ",s.jsx("a",{href:"mailto:campuseye@gmail.com",className:"text-red-650 font-bold hover:underline",children:"campuseye@gmail.com"}),"."]})]})]}),c==="staff"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Campus Eye Media is directed by a dedicated editorial and technology team:"}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[s.jsxs("div",{className:"p-3 bg-gray-50 border border-gray-200 rounded-xl",children:[s.jsx("p",{className:"font-black text-gray-900 text-xs uppercase",children:"Editor-in-Chief"}),s.jsx("p",{className:"text-gray-500 text-[11px]",children:"Editorial Board"})]}),s.jsxs("div",{className:"p-3 bg-gray-50 border border-gray-200 rounded-xl",children:[s.jsx("p",{className:"font-black text-gray-900 text-xs uppercase",children:"Lead Developer"}),s.jsx("p",{className:"text-gray-500 text-[11px]",children:"Cyber Tech softwares"})]})]})]}),c==="advertise"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Promote your brand, student discounts, campus events, or product launches to an engaged audience of over 100,000+ university students."}),s.jsxs("div",{className:"bg-red-50/70 border border-red-200 p-4 rounded-2xl space-y-2 text-gray-800",children:[s.jsx("h4",{className:"font-black text-xs uppercase text-red-650",children:"Available Advertising Formats:"}),s.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-xs",children:[s.jsx("li",{children:"Sponsored Featured Articles & Product Reviews"}),s.jsx("li",{children:"Homepage & In-Article Banner Advertisements"}),s.jsx("li",{children:"Podcast Audio & Video Episode Sponsorships"}),s.jsx("li",{children:"Direct WhatsApp & Push Notification Dispatches"})]}),s.jsxs("p",{className:"text-xs pt-2 font-semibold",children:["Contact our partnership team: ",s.jsx("a",{href:"mailto:campuseye@gmail.com",className:"text-red-650 font-bold hover:underline",children:"campuseye@gmail.com"})]})]})]})]}),s.jsx("div",{className:"p-4 border-t border-gray-100 bg-gray-50/60 flex justify-end",children:s.jsx("button",{onClick:()=>h(null),className:"px-5 py-2 bg-gray-950 hover:bg-gray-800 text-white rounded-xl text-xs font-bold uppercase tracking-wider cursor-pointer",children:"Close"})})]})})})]})},LMe=()=>(I.useEffect(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{})},[]),null),Mee=({currentPage:e,totalPages:t,totalItems:r,itemsPerPage:n,onPageChange:i,onItemsPerPageChange:a,itemLabel:o="items",itemsPerPageOptions:c=[10,20,30,50],className:h=""})=>{if(r===0)return null;const f=Math.max(1,t),m=Math.min(Math.max(1,e),f),y=(m-1)*n+1,w=Math.min(m*n,r),S=f<=7?Array.from({length:f},(j,T)=>T+1):m<=3?[1,2,3,4,5,"...",f]:m>=f-2?[1,"...",f-4,f-3,f-2,f-1,f]:[1,"...",m-1,m,m+1,"...",f];return s.jsxs("div",{className:`p-3.5 bg-gray-900 text-white rounded-2xl shadow-lg border border-gray-800 flex flex-col sm:flex-row items-center justify-between gap-3 select-none ${h}`,children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 text-xs text-gray-300",children:[s.jsxs("span",{children:["Showing ",s.jsxs("b",{className:"text-white font-mono",children:[y,"–",w]})," of ",s.jsx("b",{className:"text-white font-mono",children:r})," ",o]}),a&&s.jsxs("div",{className:"flex items-center gap-1.5 border-l border-gray-700 pl-2.5 my-0.5",children:[s.jsx("span",{className:"text-[10px] uppercase font-bold text-gray-400 font-mono",children:"Per page:"}),s.jsx("select",{value:n,onChange:j=>{a(Number(j.target.value)),i(1)},className:"bg-gray-800 text-white text-xs font-bold font-mono px-2 py-1 rounded-lg border border-gray-700 focus:outline-none focus:border-blue-500 cursor-pointer",children:c.map(j=>s.jsx("option",{value:j,children:j},j))})]})]}),s.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto max-w-full py-0.5 font-mono",children:[s.jsx("button",{type:"button",onClick:()=>i(1),disabled:m===1,className:"min-w-[32px] h-[32px] rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-30 disabled:cursor-not-allowed text-gray-200 transition-colors cursor-pointer flex items-center justify-center shrink-0",title:"First Page",children:s.jsx(Qre,{size:15})}),s.jsxs("button",{type:"button",onClick:()=>i(m-1),disabled:m===1,className:"px-2.5 h-[32px] rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-30 disabled:cursor-not-allowed text-gray-200 text-xs font-bold transition-colors cursor-pointer flex items-center gap-1 shrink-0",title:"Previous Page",children:[s.jsx(Hp,{size:14}),s.jsx("span",{className:"hidden sm:inline font-sans text-[11px]",children:"Prev"})]}),S.map((j,T)=>{if(j==="...")return s.jsx("span",{className:"px-1.5 text-gray-500 font-mono font-bold text-xs select-none",children:"..."},`ellipsis-${T}`);const D=j,V=D===m;return s.jsx("button",{type:"button",onClick:()=>i(D),className:`min-w-[32px] h-[32px] px-2 rounded-lg text-xs font-bold transition-all cursor-pointer flex items-center justify-center shrink-0 ${V?"bg-blue-600 text-white font-black shadow-md shadow-blue-500/30 ring-1 ring-blue-400":"bg-gray-800 text-gray-300 hover:bg-gray-700 hover:text-white border border-gray-700/50"}`,children:D},D)}),s.jsxs("button",{type:"button",onClick:()=>i(m+1),disabled:m===f,className:"px-2.5 h-[32px] rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-30 disabled:cursor-not-allowed text-gray-200 text-xs font-bold transition-colors cursor-pointer flex items-center gap-1 shrink-0",title:"Next Page",children:[s.jsx("span",{className:"hidden sm:inline font-sans text-[11px]",children:"Next"}),s.jsx(Gp,{size:14})]}),s.jsx("button",{type:"button",onClick:()=>i(f),disabled:m===f,className:"min-w-[32px] h-[32px] rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-30 disabled:cursor-not-allowed text-gray-200 transition-colors cursor-pointer flex items-center justify-center shrink-0",title:"Last Page",children:s.jsx(Jre,{size:15})})]})]})},UMe=()=>{const[e,t]=I.useState([]),[r,n]=I.useState(0),[i,a]=I.useState(!1),[o,c]=I.useState(!1),[h,f]=I.useState(!1),[m,y]=I.useState(!1),[w,A]=I.useState(0),[S,j]=I.useState("0:00"),[T,D]=I.useState("0:00"),V=I.useRef(null);I.useEffect(()=>{const $=Jt(nt(fe,"podcasts"),di("publishDate","desc"),yi(15));vr($).then(J=>{const Q=J.docs.map(K=>({id:K.id,...K.data()}));t(Q)}).catch(J=>{Gs(J,Ps.LIST,"podcasts")})},[]),I.useEffect(()=>{const $=J=>{const K=J.detail;if(K){if(Ul(K)){window.dispatchEvent(new CustomEvent("play-video-podcast",{detail:K}));return}y(!0),f(!1),t(me=>{const re=me.findIndex(le=>le.id===K.id);if(re>-1)return n(re),a(!0),setTimeout(()=>{V.current&&V.current.play().then(()=>{a(!0)}).catch(console.error)},150),me;{const le=[K,...me];return n(0),a(!0),setTimeout(()=>{V.current&&V.current.play().then(()=>{a(!0)}).catch(console.error)},150),le}})}};return window.addEventListener("play-podcast",$),()=>{window.removeEventListener("play-podcast",$)}},[]),I.useEffect(()=>{V.current&&m&&(i?V.current.play().catch($=>{console.warn("Autoplay was prevented or source invalid:",$),a(!1)}):V.current.pause())},[r,e,m]);const U=()=>{V.current&&(i?(V.current.pause(),a(!1)):V.current.play().then(()=>{a(!0)}).catch(console.error))},G=()=>{if(V.current){const $=V.current.currentTime,J=V.current.duration||0,Q=$/J*100;A(Q||0);const K=me=>{if(isNaN(me))return"0:00";const re=Math.floor(me/60),le=Math.floor(me%60);return`${re}:${le<10?"0":""}${le}`};j(K($)),D(K(J))}},X=$=>{if(V.current&&V.current.duration){const J=parseFloat($.target.value),Q=J/100*V.current.duration;V.current.currentTime=Q,A(J)}},q=()=>{e.length!==0&&(n($=>($+1)%e.length),a(!0))},B=()=>{e.length!==0&&(n($=>($-1+e.length)%e.length),a(!0))},z=()=>{V.current&&V.current.pause(),a(!1),y(!1),he.success("Podcast Player closed.",{position:"bottom-right"})};if(!m||e.length===0)return null;const F=e[r];return s.jsxs("div",{className:"fixed inset-0 pointer-events-none z-[5000]",children:[s.jsx("audio",{ref:V,src:F.audioUrl||F.mediaUrl||"",onTimeUpdate:G,onEnded:q,preload:"none",hidden:!0}),s.jsx(on,{children:h?s.jsxs(Qt.div,{drag:!0,dragMomentum:!1,dragElastic:.05,initial:{opacity:0,scale:.8,y:50},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.8,y:50},transition:{type:"spring",damping:15},className:"absolute bottom-24 right-4 pointer-events-auto w-18 h-18 rounded-full bg-gray-950/95 backdrop-blur-xl border border-red-500/40 shadow-2xl flex items-center justify-center cursor-grab active:cursor-grabbing select-none group text-white h-18",title:"Draggable Podcast: Double-click to expand or drag anywhere",onDoubleClick:()=>f(!1),children:[s.jsxs("div",{className:"absolute inset-0.5 rounded-full overflow-hidden",children:[s.jsx("img",{src:F.thumbnail,className:`w-full h-full object-cover transition-transform ${i?"animate-[spin_20s_linear_infinite]":""}`,alt:""}),s.jsx("div",{className:"absolute inset-0 bg-black/60 flex flex-col items-center justify-center gap-1 opacity-100 group-hover:opacity-100 transition-opacity",children:s.jsx("button",{onClick:$=>{$.stopPropagation(),U()},className:"p-1.5 bg-red-600 rounded-full text-white hover:scale-110 transition-transform shadow-lg cursor-pointer",title:i?"Pause":"Play",children:i?s.jsx(rR,{size:10,fill:"currentColor"}):s.jsx(Wp,{size:10,fill:"currentColor",className:"ml-0.2"})})})]}),i&&s.jsx("span",{className:"absolute -inset-1 rounded-full border border-red-500/30"}),s.jsxs("div",{className:"absolute -top-1 -right-1 flex gap-1 items-center z-10 pointer-events-auto",children:[s.jsx("button",{onClick:$=>{$.stopPropagation(),f(!1)},className:"w-4.5 h-4.5 bg-blue-600 rounded-full flex items-center justify-center text-white text-[8px] hover:bg-blue-700 cursor-pointer shadow-sm",title:"Restore Player",children:s.jsx(n2,{size:8,strokeWidth:3})}),s.jsx("button",{onClick:$=>{$.stopPropagation(),z()},className:"w-4.5 h-4.5 bg-red-650 rounded-full flex items-center justify-center text-white text-[8px] hover:bg-red-700 cursor-pointer shadow-sm",title:"Close Podcast",children:s.jsx(Jr,{size:8,strokeWidth:3})})]})]}):s.jsxs(Qt.div,{drag:!0,dragMomentum:!1,dragElastic:.05,initial:{opacity:0,scale:.9,y:100},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:100},transition:{type:"spring",stiffness:260,damping:24},className:"absolute bottom-24 right-4 pointer-events-auto bg-gray-950/95 backdrop-blur-2xl border border-white/10 rounded-[2.5rem] shadow-[0_25px_60px_rgba(0,0,0,0.8)] p-5 select-none text-white overflow-hidden transition-all duration-300 w-80 md:w-88 flex flex-col justify-between",style:{maxHeight:o?"460px":"230px"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-3 border-b border-white/5 pb-2 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(mc,{size:11,className:"text-red-500"}),s.jsx("span",{className:"text-[8.5px] font-black text-gray-400 uppercase tracking-widest leading-none",children:"Broadcast Widget"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>c(!o),className:"p-1 hover:bg-white/10 rounded-lg text-gray-405 hover:text-white transition-all cursor-pointer",title:o?"Show Compact Player":"Show Up Next Queue",children:o?s.jsx(Md,{size:14}):s.jsx(gf,{size:14})}),s.jsx("button",{onClick:()=>f(!0),className:"p-1 hover:bg-white/10 rounded-lg text-gray-405 hover:text-white transition-all cursor-pointer",title:"Minimize to Bubble",children:s.jsx(bI,{size:13})}),s.jsx("button",{onClick:z,className:"p-1 hover:bg-red-900/40 rounded-lg text-red-405 hover:text-red-500 transition-all cursor-pointer",title:"Close and Exit",children:s.jsx(Jr,{size:13})})]})]}),s.jsx("div",{className:"flex justify-center py-1 cursor-grab active:cursor-grabbing text-gray-600 hover:text-gray-400 mb-2",children:s.jsx(kne,{size:16})}),s.jsxs("div",{className:"flex items-center gap-3.5 text-left min-w-0",children:[s.jsx("img",{src:F.thumbnail,className:"w-13 h-13 rounded-2xl object-cover border border-white/10 shrink-0 shadow-xl",alt:""}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-[7.5px] font-black uppercase text-red-500 tracking-wider bg-red-950/40 border border-red-900/30 px-1.5 py-0.2 rounded",children:F.category||"CAMPUS"}),s.jsxs("span",{className:"text-[7.5px] font-mono font-bold text-gray-400",children:["Host: ",F.author||"Broadcaster"]})]}),s.jsx("h4",{className:"text-xs font-black text-white truncate uppercase tracking-tight mt-1 leading-snug",children:F.title}),i&&s.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[s.jsx(Cre,{size:9,className:"text-red-500 animate-[bounce_1s_infinite]"}),s.jsx("span",{className:"text-[7px] font-mono font-bold uppercase tracking-wider text-red-500",children:"Live Frequency Tuning..."})]})]})]}),s.jsxs("div",{className:"mt-4 shrink-0",children:[s.jsx("input",{type:"range",min:"0",max:"100",value:w,onChange:X,className:"w-full h-1 bg-white/10 rounded-lg appearance-none cursor-pointer accent-red-600 focus:outline-none"}),s.jsxs("div",{className:"flex justify-between items-center text-[7.5px] font-mono font-bold text-gray-400 mt-1 uppercase tracking-wider",children:[s.jsx("span",{children:S}),s.jsx("span",{children:T})]})]}),s.jsxs("div",{className:"flex items-center justify-center gap-5 mt-3 shrink-0",children:[s.jsx("button",{onClick:B,className:"text-gray-400 hover:text-white hover:scale-105 transition-all p-1.5 bg-white/5 rounded-xl border border-white/5 cursor-pointer",title:"Previous Story",children:s.jsx(Aie,{size:14,fill:"currentColor"})}),s.jsx("button",{onClick:U,className:"w-10 h-10 bg-red-600 text-white rounded-2xl flex items-center justify-center hover:scale-110 active:scale-95 transition-all shadow-xl shadow-red-900/20 cursor-pointer",title:i?"Pause":"Play Episode",children:i?s.jsx(rR,{size:16,fill:"currentColor"}):s.jsx(Wp,{size:16,className:"ml-0.5",fill:"currentColor"})}),s.jsx("button",{onClick:q,className:"text-gray-400 hover:text-white hover:scale-105 transition-all p-1.5 bg-white/5 rounded-xl border border-white/5 cursor-pointer",title:"Next Story",children:s.jsx(_ie,{size:14,fill:"currentColor"})})]}),s.jsx(on,{children:o&&s.jsxs(Qt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden border-t border-white/5 mt-4 pt-3 text-left",children:[s.jsx("h5",{className:"text-[7.5px] font-black text-red-500 uppercase tracking-[0.25em] mb-2",children:"Playlist Queue"}),s.jsx("div",{className:"space-y-1.5 max-h-40 overflow-y-auto scrollbar-thin pr-1",children:e.slice(0,5).map(($,J)=>s.jsxs("div",{onClick:()=>{n(J),a(!0)},className:`flex items-center gap-2 p-1.5 rounded-xl cursor-pointer transition-all border ${J===r?"bg-red-950/20 border-red-900/40":"bg-transparent border-transparent hover:bg-white/5"}`,children:[s.jsx("img",{src:$.thumbnail,className:"w-6 h-6 rounded-md object-cover",alt:""}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-[9px] font-black text-white truncate uppercase tracking-tight",children:$.title}),s.jsx("p",{className:"text-[7px] text-gray-400 truncate -mt-0.5",children:$.duration||"5m"})]}),J===r&&i&&s.jsx("span",{className:"w-1.5 h-1.5 bg-red-600 rounded-full shrink-0 mr-1"})]},$.id))})]})})]})})]})},MV=()=>{const[e,t]=ie.useState([]),[r,n]=ie.useState(!0),[i,a]=ie.useState(""),[o,c]=ie.useState("All"),[h,f]=ie.useState("all"),[m,y]=ie.useState(null),[w,A]=ie.useState(null);ie.useEffect(()=>{const U=Jt(nt(fe,"podcasts"),di("publishDate","desc"),yi(40));vr(U).then(X=>{const q=X.docs.map(B=>({id:B.id,...B.data()}));t(q),n(!1)}).catch(X=>{console.error("Failed to load podcasts:",X),n(!1)});const G=X=>{var B;const q=X;(B=q.detail)!=null&&B.id&&y(q.detail.id)};return window.addEventListener("play-podcast",G),()=>window.removeEventListener("play-podcast",G)},[]);const S=U=>{Ul(U)?(A(U),window.dispatchEvent(new CustomEvent("play-video-podcast",{detail:U})),he.success(`Playing Video Episode: ${U.title}`,{icon:"🎬",position:"bottom-right",duration:3500})):(y(U.id),window.dispatchEvent(new CustomEvent("play-podcast",{detail:U})),he.success(`Streaming Audio: ${U.title}`,{icon:"🎧",position:"bottom-right",duration:3500}))},j=e.filter(U=>!Ul(U)).length,T=e.filter(U=>Ul(U)).length,D=["All",...Array.from(new Set(e.map(U=>U.category).filter(Boolean)))],V=e.filter(U=>{var B,z,F,$;const G=Ul(U);if(h==="audio"&&G||h==="video"&&!G)return!1;const X=((B=U.title)==null?void 0:B.toLowerCase().includes(i.toLowerCase()))||((z=U.author)==null?void 0:z.toLowerCase().includes(i.toLowerCase()))||((F=U.category)==null?void 0:F.toLowerCase().includes(i.toLowerCase()))||(($=U.description)==null?void 0:$.toLowerCase().includes(i.toLowerCase())),q=o==="All"||U.category===o;return X&&q});return s.jsxs("div",{className:"py-6 px-4 md:px-8 max-w-7xl mx-auto",children:[s.jsxs("div",{className:"bg-gradient-to-r from-gray-950 via-gray-900 to-black text-white p-5 md:p-6 rounded-3xl mb-8 border border-white/10 shadow-xl relative overflow-hidden flex flex-col md:flex-row items-start md:items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-4 text-left",children:[s.jsx("div",{className:"p-3 bg-red-600/20 text-red-500 border border-red-500/30 rounded-2xl shrink-0",children:s.jsx(D2,{size:26})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-xl md:text-3xl font-serif font-black tracking-tight text-white uppercase italic",children:"Campus Podcasts"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider px-2 py-0.5 rounded-md bg-white/10 text-gray-300",children:"Audio & Video Hub"})]}),s.jsx("p",{className:"text-[11px] text-gray-400 font-medium mt-0.5",children:"Official Investigative Audio Newsroom, Direct Video Dispatches & YouTube Episodes"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("div",{className:"px-3.5 py-1.5 bg-white/5 border border-white/10 text-white rounded-xl flex items-center gap-2",children:[s.jsx(mc,{size:14,className:"text-red-500"}),s.jsxs("span",{className:"text-xs font-mono font-black",children:[e.length," Total"]})]}),s.jsxs("div",{className:"px-3.5 py-1.5 bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 rounded-xl flex items-center gap-2",children:[s.jsx(nf,{size:14,className:"text-emerald-400"}),s.jsxs("span",{className:"text-xs font-mono font-black",children:[j," Audio"]})]}),s.jsxs("div",{className:"px-3.5 py-1.5 bg-red-500/10 border border-red-500/30 text-red-400 rounded-xl flex items-center gap-2",children:[s.jsx(Na,{size:14,className:"text-red-400"}),s.jsxs("span",{className:"text-xs font-mono font-black",children:[T," Video"]})]})]})]}),s.jsxs("div",{className:"space-y-4 mb-8",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-1.5 bg-gray-100 p-1 rounded-2xl",children:[s.jsxs("button",{onClick:()=>f("all"),className:`px-3.5 py-1.5 rounded-xl text-xs font-black uppercase tracking-wider transition-all cursor-pointer ${h==="all"?"bg-gray-900 text-white shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:["All Formats (",e.length,")"]}),s.jsxs("button",{onClick:()=>f("audio"),className:`flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl text-xs font-black uppercase tracking-wider transition-all cursor-pointer ${h==="audio"?"bg-emerald-600 text-white shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(nf,{size:13})," Audio (",j,")"]}),s.jsxs("button",{onClick:()=>f("video"),className:`flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl text-xs font-black uppercase tracking-wider transition-all cursor-pointer ${h==="video"?"bg-red-600 text-white shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Na,{size:13})," Video (",T,")"]})]}),s.jsxs("div",{className:"relative w-full sm:w-80",children:[s.jsx("input",{type:"text",placeholder:"Search audio or video episodes...",value:i,onChange:U=>a(U.target.value),className:"w-full pl-10 pr-4 py-2.5 rounded-xl border border-gray-200 text-xs font-bold text-gray-900 focus:border-red-600 focus:ring-0 outline-none bg-white shadow-xs"}),s.jsx(Tp,{size:14,className:"absolute left-3.5 top-3.5 text-gray-400"})]})]}),s.jsx("div",{className:"flex items-center gap-2 overflow-x-auto pb-2 scrollbar-none",children:D.map(U=>s.jsx("button",{onClick:()=>c(U),className:`px-3.5 py-1.5 rounded-xl text-xs font-black uppercase tracking-wider transition-all whitespace-nowrap cursor-pointer ${o===U?"bg-red-650 text-white shadow-md":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:U},U))})]}),r?s.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[s.jsx(vn,{size:32,className:"text-red-600 animate-spin mb-4"}),s.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400",children:"Tuning broadcast channels..."})]}):V.length===0?s.jsxs("div",{className:"bg-white py-16 px-6 rounded-3xl border border-gray-200 shadow-xs max-w-xl mx-auto text-center",children:[s.jsx(D2,{size:32,className:"mx-auto mb-4 text-gray-300"}),s.jsx("h4",{className:"text-sm font-black uppercase tracking-wider text-gray-900",children:"No matching episodes found"}),s.jsx("p",{className:"text-[10px] uppercase font-bold tracking-widest text-gray-400 mt-2",children:"Try switching format filter or adjusting your search keyword."})]}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:V.map(U=>{var B;const G=Ul(U),X=m===U.id&&!G,q=(w==null?void 0:w.id)===U.id;return s.jsxs("div",{onClick:()=>S(U),className:`group bg-white p-4 rounded-3xl border transition-all duration-300 text-left flex flex-col justify-between cursor-pointer relative overflow-hidden ${X||q?G?"border-red-600 shadow-xl ring-2 ring-red-500/30":"border-emerald-500 shadow-lg ring-2 ring-emerald-500/20":"border-gray-150 hover:border-red-600 hover:shadow-md"}`,children:[s.jsxs("div",{children:[s.jsxs("div",{className:"aspect-square bg-gray-950 mb-4 relative overflow-hidden flex items-center justify-center rounded-2xl group-hover:scale-[1.01] transition-transform duration-500",children:[s.jsx(Bi,{src:U.thumbnail||(G?"https://images.unsplash.com/photo-1578022761797-b8636ac1773c?auto=format&fit=crop&q=80&w=500":"https://images.unsplash.com/photo-1590602847861-f357a9332bbc?auto=format&fit=crop&q=80&w=500"),className:"absolute inset-0 w-full h-full object-cover opacity-90 group-hover:opacity-100 transition-opacity",alt:U.title}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/25 to-transparent"}),s.jsx("span",{className:"absolute top-3 left-3 text-[8px] font-black uppercase tracking-widest px-2.5 py-1 bg-black/60 text-white rounded-lg backdrop-blur-xs shadow-sm border border-white/10",children:U.category||"Campus Vibe"}),s.jsx("span",{className:`absolute top-3 right-3 text-[8.5px] font-black uppercase tracking-widest px-2.5 py-1 rounded-lg flex items-center gap-1.5 shadow-md border ${G?"bg-red-600 text-white border-red-500/50 animate-pulse":"bg-emerald-600 text-white border-emerald-500/50"}`,children:G?s.jsxs(s.Fragment,{children:[s.jsx(Na,{size:11,className:"shrink-0"})," VIDEO"]}):s.jsxs(s.Fragment,{children:[s.jsx(nf,{size:11,className:"shrink-0"})," AUDIO"]})}),X&&s.jsxs("span",{className:"absolute top-11 right-3 text-[8px] font-black uppercase tracking-widest px-2 py-0.5 bg-emerald-500 text-white rounded-md flex items-center gap-1 shadow-md",children:[s.jsx(Wie,{size:9})," Playing Audio"]}),s.jsx("button",{className:`absolute bottom-4 right-4 w-11 h-11 rounded-2xl flex items-center justify-center shadow-xl group-hover:scale-110 transition-all cursor-pointer ${G?"bg-red-600 text-white shadow-red-900/30":"bg-white text-red-650 shadow-gray-900/20"}`,title:G?"Watch Video Episode":"Listen Audio Podcast",children:G?s.jsx(Wp,{size:16,fill:"currentColor",className:"ml-0.5"}):s.jsx(Wp,{size:16,fill:"currentColor",className:"ml-0.5"})}),s.jsxs("span",{className:"absolute bottom-4 left-4 text-[9px] font-mono font-bold text-white/95 bg-black/50 px-2.5 py-1 rounded-lg backdrop-blur-xs border border-white/10 flex items-center gap-1",children:["⏱️ ",U.duration||(G?"Video":"5:00")]})]}),s.jsx("div",{className:"flex items-center justify-between mb-1",children:s.jsxs("p",{className:"text-[9px] font-black text-red-655 uppercase tracking-widest leading-none truncate",children:["Host: ",U.author||"Campus Desk"]})}),s.jsx("h3",{className:"text-base font-serif font-black text-gray-950 leading-tight group-hover:text-red-655 transition-colors uppercase tracking-tight line-clamp-2 mt-1",children:U.title}),U.description&&s.jsx("p",{className:"text-[10px] text-gray-500 line-clamp-2 mt-1.5 leading-relaxed",children:U.description})]}),s.jsxs("div",{className:"pt-3 mt-4 border-t border-gray-100 flex items-center justify-between",children:[s.jsx("span",{className:"text-[8.5px] font-mono font-black uppercase tracking-wider flex items-center gap-1.5 text-gray-600",children:G?s.jsxs(s.Fragment,{children:[s.jsx(vne,{size:12,className:"text-red-600"})," Video Broadcast"]}):s.jsxs(s.Fragment,{children:[s.jsx(mc,{size:12,className:"text-emerald-600"})," Audio Story"]})}),s.jsx("span",{className:"text-[8px] font-mono font-bold text-gray-400",children:(B=U.publishDate)!=null&&B.seconds?new Date(U.publishDate.seconds*1e3).toLocaleDateString():"Active"})]})]},U.id)})}),w&&s.jsx(xP,{podcast:w,onClose:()=>A(null),relatedPodcasts:e.filter(U=>U.id!==w.id),onSelectPodcast:U=>A(U)})]})},BMe=({debateId:e})=>{const[t,r]=I.useState([]),[n,i]=I.useState(""),[a,o]=I.useState(!1),[c,h]=I.useState(!1);I.useEffect(()=>{o(!0);const m=Jt(nt(fe,"debates",e,"comments"),di("createdAt","desc"));vr(m).then(y=>{const w=y.docs.map(A=>{const S=A.data();return{id:A.id,...S,createdAt:S.createdAt?S.createdAt.toDate?S.createdAt.toDate():new Date(S.createdAt):new Date}});r(w),o(!1)}).catch(y=>{console.warn("Failed to subscriber to debate comments",y),o(!1)})},[e]);const f=async m=>{if(m.preventDefault(),!Ne.currentUser){he.error("Please log in to participate in the debate!");return}if(n.trim()){h(!0);try{const y=Ne.currentUser;if(!y){he.error("Please log in to participate in the debate!"),h(!1);return}const w={text:n.trim(),userId:y.uid,author:y.displayName||(y.email?y.email.split("@")[0]:"Anonymous Participant"),createdAt:zr()},A=await dn(nt(fe,"debates",e,"comments"),w);r(S=>[{id:A.id,text:n.trim(),userId:y.uid,author:y.displayName||(y.email?y.email.split("@")[0]:"Anonymous Participant"),createdAt:new Date},...S]);try{await Ir(st(fe,"debates",e),{commentsCount:Cn(1)})}catch(S){console.warn("Could not increment denormalized debate comment counter:",S)}i(""),he.success("Argument posted!")}catch(y){he.error("Failed to post comment: "+y.message)}finally{h(!1)}}};return s.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Ri,{size:16,className:"text-gray-500"}),s.jsxs("h4",{className:"text-[10px] font-black uppercase tracking-widest text-gray-500",children:["Discourse Thread (",t.length,")"]})]}),Ne.currentUser?s.jsxs("form",{onSubmit:f,className:"flex gap-2",children:[s.jsx("input",{type:"text",value:n,onChange:m=>i(m.target.value),placeholder:"State your position/stance...",className:"flex-1 px-4 py-2.5 bg-gray-50 border border-gray-150 rounded-xl text-xs font-bold focus:bg-white focus:border-accent outline-none transition-all placeholder:text-gray-400"}),s.jsx("button",{type:"submit",disabled:c||!n.trim(),className:"px-4 bg-accent hover:bg-opacity-90 disabled:opacity-50 text-white rounded-xl transition-all flex items-center justify-center cursor-pointer",children:c?s.jsx(vn,{size:14,className:"animate-spin"}):s.jsx(Eo,{size:14})})]}):s.jsx("div",{className:"bg-amber-50 border border-amber-100 p-3 rounded-xl text-center",children:s.jsx("p",{className:"text-[10px] font-bold text-amber-800 uppercase tracking-wide",children:"🔒 Log in to participate in academic discourse."})}),a?s.jsx("div",{className:"flex justify-center py-4",children:s.jsx(vn,{className:"animate-spin text-gray-400",size:16})}):t.length===0?s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest text-center py-2",children:"Be the first to make a point!"}):s.jsx("div",{className:"space-y-2.5 max-h-60 overflow-y-auto pr-1",children:t.map(m=>s.jsxs("div",{className:"p-3 bg-gray-50 rounded-xl space-y-1 text-left",children:[s.jsxs("div",{className:"flex items-center justify-between text-[9px] font-black uppercase tracking-wider text-gray-500",children:[s.jsxs("span",{className:"flex items-center gap-1 text-accent",children:[s.jsx(rE,{size:10}),m.author]}),s.jsx("span",{children:m.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),s.jsx("p",{className:"text-xs font-medium text-gray-850 leading-relaxed break-words",children:m.text})]},m.id))})]})},DS={id:"current-campus-poll",question:"Should university lecture attendance be strictly tracked via biometric scanners, or should it remain fully optional?",options:[{text:"Strictly tracked (Biometrics)",votes:142},{text:"Fully optional / Student autonomy",votes:289},{text:"Hybrid (Only for key lab sessions)",votes:95}],totalVotes:526,expiresAt:null,status:"active"},zMe=()=>{var $,J,Q;const[e,t]=I.useState(DS),[r,n]=I.useState(!1),[i,a]=I.useState(null),[o,c]=I.useState(!1),[h,f]=I.useState({});I.useEffect(()=>{if(!e)return;(async()=>{try{const re=(await vr(Jt(nt(fe,"articles"),di("publishDate","desc"),yi(15)))).docs.map(ve=>({id:ve.id,...ve.data()})),le={};e.options.forEach(ve=>{const je=ve.text.replace(/^(support|vote\s+for|vote|elect)\s+/i,"").trim().toLowerCase(),Ve=re.find(Z=>{const se=Z.title.toLowerCase().replace(/^(support|vote\s+for|vote|elect)\s+/i,"").trim();return se===je||Z.title.toLowerCase().includes(je)||je.includes(se)});Ve&&(le[ve.text]={bio:Ve.summary||Ve.content||"",votes:Ve.likeCount||0,image:Ve.featuredImageUrl||"",id:Ve.id})}),f(le)}catch(me){console.warn("Silent ignore bio fetching error:",me)}})()},[e]);const[m,y]=I.useState(!1),[w,A]=I.useState([]),[S,j]=I.useState(""),[T,D]=I.useState(!1),[V,U]=I.useState(null),[G,X]=I.useState(""),[q,B]=I.useState(0);I.useEffect(()=>{if(!e)return;const K=Jt(nt(fe,"polls",e.id,"comments"));vr(K).then(me=>{B(me.size)}).catch(me=>{console.warn("Silent ignore count fetch error:",me)})},[e]),I.useEffect(()=>{if(!e||!m)return;const K=Jt(nt(fe,"polls",e.id,"comments"),di("createdAt","desc"));vr(K).then(me=>{const re=me.docs.map(le=>({id:le.id,...le.data()}));A(re)}).catch(me=>{Gs(me,Ps.LIST,`polls/${e.id}/comments`)})},[e,m]);const z=async(K,me=null)=>{var le,ve;if(K.preventDefault(),!Ne.currentUser||!e)return;const re=me?G:S;if(re.trim()){D(!0);try{const je=nt(fe,"polls",e.id,"comments");let Ve={};if(me){const xe=w.find(ae=>ae.id===me);xe&&(Ve={parentId:me,replyToAuthor:xe.authorName,replyToContent:xe.content.substring(0,50)})}const Z={content:re.trim(),userId:Ne.currentUser.uid,authorName:Ne.currentUser.displayName||((le=Ne.currentUser.email)==null?void 0:le.split("@")[0])||"Peer",photoURL:Ne.currentUser.photoURL||"",createdAt:new Date,...Ve},se=await dn(je,{content:re.trim(),userId:Ne.currentUser.uid,authorName:Ne.currentUser.displayName||((ve=Ne.currentUser.email)==null?void 0:ve.split("@")[0])||"Peer",photoURL:Ne.currentUser.photoURL||"",createdAt:zr(),...Ve});A(xe=>[{id:se.id,...Z},...xe]),B(xe=>xe+1),me?(X(""),U(null)):j("")}catch(je){console.error("Error dispatching poll comment:",je)}finally{D(!1)}}};I.useEffect(()=>{const K=nt(fe,"polls"),me=Jt(K,di("createdAt","desc"),yi(15));vr(me).then(re=>{if(!re.empty){const le=re.docs.find(ve=>{var je;return((je=ve.data())==null?void 0:je.status)==="active"})||re.docs[0];if(le){t({...le.data(),id:le.id});return}}t(DS)}).catch(re=>{console.warn("Falling back to default poll on query error:",re),t(DS)})},[]),I.useEffect(()=>{Ne.currentUser&&e&&(async()=>{try{const me=st(fe,"polls",e.id,"userVotes",Ne.currentUser.uid),re=await as(me);re.exists()&&(n(!0),a(re.data().optionIndex))}catch(me){me.code!=="permission-denied"&&console.error("Error checking vote status:",me)}})()},[e]);const F=async K=>{if(Ne.currentUser&&!(r||o||!e)){c(!0);try{const me=st(fe,"polls",e.id),re=st(fe,"polls",e.id,"userVotes",Ne.currentUser.uid);await Gn(re,{userId:Ne.currentUser.uid,optionIndex:K,timestamp:new Date});const le=await as(me);if(le.exists()){const je=[...le.data().options];je[K].votes+=1,await Ir(me,{options:je,totalVotes:Cn(1)})}n(!0),a(K)}catch(me){console.error("Error voting:",me),me.code==="permission-denied"&&t(null)}finally{c(!1)}}};return e?s.jsxs("div",{className:"bg-white border border-gray-100 overflow-hidden group",children:[s.jsxs("div",{className:"bg-gray-900 p-6 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(FS,{className:"text-red-500",size:24}),s.jsx("h3",{className:"text-xl font-black text-white uppercase tracking-tighter italic",children:"Campus Pulse Poll"})]}),s.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 bg-white/10 rounded-full",children:[s.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full"}),s.jsx("span",{className:"text-[8px] font-black text-white uppercase tracking-widest",children:"Ongoing"})]})]}),s.jsxs("div",{className:"p-8 space-y-6",children:[s.jsx("h4",{className:"text-2xl font-bold text-gray-900 leading-tight tracking-tight",children:e.question}),s.jsx("div",{className:"space-y-3",children:e.options.map((K,me)=>{const re=e.totalVotes>0?Math.round(K.votes/e.totalVotes*100):0,le=i===me,ve=K.text.replace(/^(support|vote\s+for|vote|elect)\s+/i,"").trim(),je=h[K.text],Ve=je?`${ve} (${je.votes} Votes)`:ve;return s.jsx("button",{disabled:r||o||!Ne.currentUser,onClick:()=>F(me),className:`w-full relative group/option flex flex-col transition-all overflow-hidden rounded-2xl border border-gray-150/80 shadow-3xs ${r?"cursor-default bg-white":"hover:scale-[1.01] cursor-pointer bg-gray-50"}`,children:s.jsxs("div",{className:`w-full p-5 flex flex-col gap-2.5 transition-colors ${le?"bg-red-50/15":"bg-transparent"}`,children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex items-start gap-3 w-full",children:[s.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all shrink-0 mt-0.5 ${le?"border-accent bg-accent":"border-gray-300"}`,children:le&&s.jsx(Rl,{size:12,className:"text-white"})}),je!=null&&je.image?s.jsx("img",{src:je.image||void 0,alt:"",className:"w-10 h-10 rounded-lg object-cover shrink-0 border border-gray-150"}):null,s.jsxs("div",{className:"flex-1 text-left",children:[s.jsx("span",{className:`text-[13px] font-extrabold leading-snug transition-colors uppercase tracking-tight block ${le?"text-accent":"text-gray-900"}`,children:Ve}),(je==null?void 0:je.bio)&&s.jsx("p",{className:"text-[11px] text-gray-500 font-medium line-clamp-2 leading-relaxed mt-1 select-text",children:je.bio}),(je==null?void 0:je.id)&&s.jsx("button",{onClick:Z=>{Z.stopPropagation();const se=new CustomEvent("open-article",{detail:{id:je.id}});window.dispatchEvent(se)},className:"text-[9px] font-black text-red-650 hover:underline uppercase tracking-widest mt-1.5 inline-block cursor-pointer",children:"View Candidate Profile →"})]})]}),r&&s.jsxs("div",{className:"text-right shrink-0",children:[s.jsxs("span",{className:"text-sm font-black text-gray-950 font-mono italic block",children:[re,"%"]}),s.jsxs("span",{className:"text-[8px] font-bold text-gray-400 font-mono uppercase tracking-widest",children:[K.votes," votes"]})]})]}),r&&s.jsx("div",{className:"w-full h-3 bg-gray-100 rounded-full overflow-hidden mt-1 relative border border-gray-150/40",children:s.jsx(Qt.div,{initial:{width:0},animate:{width:`${re}%`},transition:{duration:.8,ease:"easeOut"},className:`h-full rounded-full transition-all ${le?"bg-accent":"bg-gray-400"}`})})]})},me)})}),s.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-100 select-none",children:[s.jsxs("div",{className:"flex items-center gap-2 text-gray-450 text-[10px] font-bold uppercase tracking-wider",children:[s.jsx(ko,{size:14,className:"text-gray-450"}),s.jsxs("span",{children:[e.totalVotes," Votes"]})]}),s.jsxs("button",{onClick:()=>y(!m),className:"flex items-center gap-1.5 text-red-650 hover:text-red-700 font-extrabold cursor-pointer transition-colors",children:[s.jsx(Ri,{size:14}),s.jsx("span",{className:"text-[10px] uppercase tracking-widest",children:m?"Close Debates":`Discuss (${q})`})]})]}),s.jsx(on,{children:m&&s.jsxs(Qt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-6 pt-6 border-t border-gray-100 overflow-hidden text-left",children:[Ne.currentUser?s.jsx("form",{onSubmit:K=>z(K,null),className:"mb-6",children:s.jsxs("div",{className:"flex gap-2.5 items-start",children:[s.jsx("img",{src:(($=Ne.currentUser)==null?void 0:$.photoURL)||`https://ui-avatars.com/api/?name=${encodeURIComponent(((J=Ne.currentUser)==null?void 0:J.displayName)||((Q=Ne.currentUser)==null?void 0:Q.email)||"Peer")}&background=random`,className:"w-8 h-8 rounded-full border border-gray-150 object-cover mt-0.5",alt:""}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("textarea",{value:S,onChange:K=>j(K.target.value),placeholder:"State your stance on this debate...",rows:2,className:"w-full text-xs font-sans p-3 bg-gray-50 border border-gray-150 rounded-xl outline-none focus:outline-none focus:ring-1 focus:ring-red-500/20 focus:border-red-500 transition-all resize-none placeholder-gray-400"}),s.jsx("div",{className:"flex justify-end",children:s.jsx("button",{type:"submit",disabled:T||!S.trim(),className:"bg-gray-950 text-white font-extrabold text-[9px] uppercase tracking-wider h-7 px-4 rounded-full hover:bg-red-650 transition-colors disabled:opacity-40 select-none cursor-pointer",children:"Dispatch Thought"})})]})]})}):s.jsx("div",{className:"bg-gray-50 rounded-xl p-3 text-center mb-6 border border-gray-100",children:s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Sign in to join the discussion"})}),s.jsx("div",{className:"space-y-4 max-h-96 overflow-y-auto pr-1",children:w.filter(K=>!K.parentId).length>0?w.filter(K=>!K.parentId).map(K=>{var le;const me=w.filter(ve=>ve.parentId===K.id),re=V===K.id;return s.jsxs("div",{className:"space-y-3.5 border-b border-gray-50 pb-4 last:border-0 last:pb-0",children:[s.jsxs("div",{className:"flex gap-2.5 items-start",children:[s.jsx("img",{src:K.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(K.authorName)}&background=random`,className:"w-7 h-7 rounded-full border border-gray-150 object-cover",alt:""}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] font-black text-gray-950 uppercase tracking-tight",children:K.authorName}),s.jsx("span",{className:"text-[8px] font-bold text-gray-400 uppercase tracking-wider",children:(le=K.createdAt)!=null&&le.toDate?new Date(K.createdAt.toDate().getTime()).toLocaleDateString():"Now"})]}),s.jsx("p",{className:"text-xs text-gray-750 leading-relaxed font-sans mt-1",children:K.content}),Ne.currentUser&&s.jsx("div",{className:"flex items-center gap-4 mt-2",children:s.jsx("button",{type:"button",onClick:()=>{U(V===K.id?null:K.id),X("")},className:"text-[9px] font-extrabold text-blue-600 hover:text-blue-700 uppercase tracking-widest cursor-pointer hover:underline",children:re?"Cancel":"Reply"})})]})]}),me.length>0&&s.jsx("div",{className:"ml-7 pl-3 border-l-2 border-gray-100/80 space-y-3",children:me.map(ve=>{var je;return s.jsxs("div",{className:"flex gap-2.5 items-start",children:[s.jsx("img",{src:ve.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(ve.authorName)}&background=random`,className:"w-6 h-6 rounded-full border border-gray-150 object-cover mt-0.5",alt:""}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[10px] font-black text-gray-950 uppercase tracking-tight",children:ve.authorName}),s.jsx("span",{className:"text-[8px] font-bold text-gray-400 uppercase tracking-wider",children:(je=ve.createdAt)!=null&&je.toDate?new Date(ve.createdAt.toDate().getTime()).toLocaleDateString():"Now"})]}),s.jsxs("p",{className:"text-xs text-gray-750 leading-relaxed font-sans mt-0.5",children:[s.jsxs("span",{className:"text-blue-650 font-bold mr-1",children:["@",ve.replyToAuthor]}),ve.content]})]})]},ve.id)})}),re&&s.jsx("form",{onSubmit:ve=>z(ve,K.id),className:"ml-7 pl-3 border-l-2 border-red-100",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:G,onChange:ve=>X(ve.target.value),placeholder:`Reply to @${K.authorName}...`,className:"flex-1 text-xs font-sans p-2 bg-gray-50 border border-gray-150 rounded-lg outline-none focus:ring-1 focus:ring-red-500/20 focus:border-red-500 transition-all placeholder-gray-400"}),s.jsx("button",{type:"submit",disabled:T||!G.trim(),className:"bg-red-600 text-white font-extrabold text-[8.5px] uppercase tracking-wider px-3 rounded-lg hover:bg-gray-950 transition-colors disabled:opacity-40 cursor-pointer",children:"Send"})]})})]},K.id)}):s.jsx("div",{className:"text-center py-6",children:s.jsx("p",{className:"text-[10px] font-black text-gray-350 uppercase tracking-widest italic",children:"The comments are silent. Dispatch your voice."})})})]})})]})]}):null},VMe=({url:e,isOpen:t,onClose:r,title:n})=>{const[i,a]=I.useState(e||""),[o,c]=I.useState(0),[h,f]=I.useState(!1),[m,y]=I.useState(!0);if(ie.useEffect(()=>{if(e){let T=e;!T.startsWith("http://")&&!T.startsWith("https://")&&(T="https://"+T),a(T),y(!0);const D=setTimeout(()=>{y(!1)},1500);return()=>clearTimeout(D)}},[e,o]),!t||!e)return null;const w=()=>{y(!0),c(T=>T+1)},A=()=>{navigator.clipboard.writeText(i),f(!0),he.success("URL copied to clipboard!",{id:"browser-copy"}),setTimeout(()=>f(!1),2e3)},S=()=>{window.open(i,"_blank","noopener,noreferrer")};let j="web.page";try{j=new URL(i).hostname}catch{j=i}return s.jsx(on,{children:s.jsxs("div",{className:"fixed inset-0 z-[9990] flex flex-col bg-zinc-950/90 backdrop-blur-xl animate-fade-in",children:[s.jsxs("div",{className:"bg-zinc-900 border-b border-zinc-800 px-3 py-2.5 flex items-center justify-between gap-2 shadow-lg shrink-0 text-white",children:[s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx("button",{onClick:r,className:"p-2 rounded-xl bg-zinc-800 hover:bg-red-600 text-zinc-300 hover:text-white transition-colors cursor-pointer",title:"Close In-App Browser",children:s.jsx(Jr,{size:16})}),s.jsx("button",{onClick:w,className:"p-2 rounded-xl bg-zinc-800 hover:bg-zinc-700 text-zinc-300 hover:text-white transition-colors cursor-pointer",title:"Reload Page",children:s.jsx(fF,{size:14,className:m?"animate-spin":""})})]}),s.jsxs("div",{className:"flex-1 max-w-2xl bg-zinc-950 border border-zinc-800 hover:border-zinc-700 rounded-xl px-3 py-1.5 flex items-center gap-2 transition-all",children:[s.jsx(uF,{size:12,className:"text-emerald-500 shrink-0"}),s.jsx("span",{className:"text-[10px] font-mono font-bold text-emerald-400 shrink-0 uppercase tracking-wider hidden sm:inline",children:"HTTPS"}),s.jsx("span",{className:"text-zinc-500 text-[11px] font-mono",children:"|"}),s.jsx("input",{type:"text",readOnly:!0,value:i,className:"w-full bg-transparent text-xs font-mono text-zinc-200 outline-none truncate"}),s.jsx("button",{onClick:A,className:"text-zinc-400 hover:text-white p-1 rounded transition-colors shrink-0 cursor-pointer",title:"Copy URL",children:h?s.jsx(zu,{size:13,className:"text-emerald-400"}):s.jsx(t2,{size:13})})]}),s.jsx("div",{className:"flex items-center gap-2 shrink-0",children:s.jsxs("button",{onClick:S,className:"px-3 py-1.5 rounded-xl bg-zinc-800 hover:bg-zinc-700 text-zinc-200 hover:text-white text-xs font-mono font-bold flex items-center gap-1.5 transition-colors cursor-pointer",title:"Open in new browser window",children:[s.jsx(za,{size:13}),s.jsx("span",{className:"hidden md:inline text-[10px] uppercase tracking-wider",children:"External"})]})})]}),s.jsxs("div",{className:"flex-1 relative bg-white w-full h-full overflow-hidden",children:[m&&s.jsxs("div",{onClick:()=>y(!1),className:"absolute inset-0 bg-zinc-950/20 backdrop-blur-sm z-10 flex flex-col items-center justify-center cursor-pointer space-y-3 transition-opacity duration-300",title:"Click to dismiss overlay",children:[s.jsx("div",{className:"w-10 h-10 border-3 border-red-600 border-t-transparent rounded-full animate-spin"}),s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-zinc-900/90 text-white rounded-full border border-zinc-800 shadow-xl",children:[s.jsx(C0,{size:14,className:"text-red-500 "}),s.jsxs("span",{className:"text-xs font-mono uppercase tracking-widest font-bold",children:["Connecting to ",j,"..."]})]})]}),s.jsx("iframe",{src:i,onLoad:()=>y(!1),className:"w-full h-full border-0",title:n||"Inbuilt App Browser",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; camera; microphone; geolocation",sandbox:"allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"},o)]})]})})},FMe=({size:e="md",showBadge:t=!1,className:r=""})=>{const n={xs:"w-6 h-6 text-[10px]",sm:"w-8 h-8 text-xs",md:"w-10 h-10 text-sm",lg:"w-14 h-14 text-base"};return s.jsxs("div",{className:Ge("relative inline-flex items-center gap-2 group select-none",r),children:[s.jsxs("div",{className:Ge("relative rounded-2xl flex items-center justify-center shrink-0 overflow-hidden shadow-lg","bg-gradient-to-br from-cyan-950 via-slate-900 to-purple-950 border border-cyan-400/50","shadow-cyan-500/25",n[e]),children:[s.jsx("div",{className:"absolute -inset-0.5 bg-gradient-to-r from-cyan-400 via-blue-500 to-purple-500 rounded-2xl opacity-40 blur-xs group-hover:opacity-80 transition-opacity"}),s.jsx("img",{src:Uo,alt:"Mega AI Avatar",className:"w-full h-full object-cover rounded-2xl relative z-10"}),s.jsx("div",{className:"absolute top-0.5 right-0.5 w-1.5 h-1.5 bg-cyan-400 rounded-full shadow-[0_0_6px_#38bdf8] z-20 animate-pulse"})]}),t&&s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"font-extrabold text-xs tracking-tight bg-gradient-to-r from-cyan-400 via-blue-400 to-purple-400 bg-clip-text text-transparent",children:"Mega AI"}),s.jsxs("span",{className:"bg-gradient-to-r from-cyan-950 to-blue-900 border border-cyan-500/40 text-cyan-300 text-[8px] font-mono font-black px-1.5 py-0.5 rounded-md flex items-center gap-1 shadow-2xs",children:[s.jsx(xF,{size:9,className:"text-cyan-400 shrink-0"}),s.jsx("span",{children:"NEURAL CORE"})]})]}),s.jsxs("span",{className:"text-[9px] font-mono text-cyan-500/80 flex items-center gap-1",children:[s.jsx(cne,{size:9})," Autonomous Quantum Intelligence"]})]})]})};let ip=null,LV=null,MS=null;const xw=e=>{var r;return e.username?e.username:(e.displayName||((r=e.email)==null?void 0:r.split("@")[0])||"peer").toLowerCase().replace(/[^a-z0-9]/g,"")},$Me=e=>{if(!e)return[];const t=/(https?:\/\/[^\s]+)/g;return e.match(t)||[]},b1=(e,t)=>{if(!e)return"";const r=/(https?:\/\/[^\s]+|@Mega\s+AI|@Mega|@megaai|@Me|@[a-zA-Z0-9_\-]+|#[a-zA-Z0-9_\-]+)/gi;return e.split(r).map((i,a)=>i?i.startsWith("http://")||i.startsWith("https://")?s.jsx("a",{href:i,onClick:o=>{o.preventDefault(),o.stopPropagation(),t?t(i):window.open(i,"_blank","noopener,noreferrer")},className:"text-blue-600 font-bold hover:underline select-text inline-flex items-center gap-0.5 break-all cursor-pointer",children:i},a):/^@(Mega\s+AI|Mega|megaai|Me)$/i.test(i)?s.jsxs("span",{className:"bg-gradient-to-r from-amber-500 via-purple-600 to-red-600 text-white font-extrabold text-[10px] px-2 py-0.5 rounded-full inline-flex items-center gap-1 shadow-xs my-0.5 select-none",children:[s.jsx(Xi,{size:10,className:"text-amber-200 shrink-0"})," ",i]},a):i.startsWith("@")?s.jsx("span",{className:"text-blue-600 font-extrabold hover:underline select-text bg-blue-50/80 border border-blue-100 px-1 py-0.2 rounded mx-0.5",children:i},a):i.startsWith("#")?s.jsx("span",{className:"text-red-650 font-black hover:underline select-text bg-red-50/80 px-1.5 py-0.5 rounded-md border border-red-200/80 mx-0.5 inline-block",children:i},a):i:null)},yw={},HMe=({url:e,onOpenUrl:t})=>{const[r,n]=I.useState(()=>{if(yw[e])return yw[e];try{const f=localStorage.getItem(`lp_${e}`);if(f){const m=JSON.parse(f);return yw[e]=m,m}}catch{}return null});I.useEffect(()=>{if(r)return;let f=!0;return(async()=>{var y,w,A;try{const S=await fetch(`https://api.microlink.io?url=${encodeURIComponent(e)}`);if(S.ok){const j=await S.json();if(j.status==="success"&&j.data){const T={title:j.data.title||j.data.publisher||e,description:j.data.description||"",image:((y=j.data.image)==null?void 0:y.url)||((w=j.data.logo)==null?void 0:w.url)||"",logo:((A=j.data.logo)==null?void 0:A.url)||`https://www.google.com/s2/favicons?domain=${e}&sz=64`,publisher:j.data.publisher||""};yw[e]=T;try{localStorage.setItem(`lp_${e}`,JSON.stringify(T))}catch{}f&&n(T)}}}catch(S){console.warn("Link preview fetch failed:",S)}})(),()=>{f=!1}},[e,r]);let i=e;try{i=new URL(e).hostname.replace(/^www\./,"")}catch{}const a=(r==null?void 0:r.title)||e,o=(r==null?void 0:r.description)||"",c=(r==null?void 0:r.image)||"",h=(r==null?void 0:r.logo)||`https://www.google.com/s2/favicons?domain=${e}&sz=64`;return s.jsxs("div",{onClick:f=>{f.stopPropagation(),t(e)},className:"my-3.5 rounded-2xl border border-slate-800 bg-[#0f172a] text-white overflow-hidden cursor-pointer group transition-all hover:border-slate-600 shadow-lg text-left",children:[c?s.jsxs("div",{className:"relative w-full max-h-[300px] bg-slate-950 overflow-hidden flex items-center justify-center",children:[s.jsx("img",{src:c,alt:"",loading:"lazy",decoding:"async",className:"w-full h-auto max-h-[300px] object-cover group-hover:scale-102 transition-transform duration-300",onError:f=>{f.target.style.display="none"}}),s.jsxs("div",{className:"absolute top-3 left-3 flex items-center gap-1.5 px-3 py-1 bg-black/80 backdrop-blur-md rounded-full text-white text-[10px] font-mono font-bold border border-white/10 shadow-sm",children:[s.jsx("img",{src:h,alt:"",className:"w-3.5 h-3.5 rounded-full object-contain shrink-0",onError:f=>{f.target.src="https://ui-avatars.com/api/?name=Web&background=0D8ABC&color=fff"}}),s.jsx("span",{className:"truncate max-w-[160px]",children:i})]}),s.jsx("div",{className:"absolute top-3 right-3 p-2 bg-black/80 hover:bg-black backdrop-blur-md rounded-full text-white transition-colors border border-white/10 shadow-sm",children:s.jsx(za,{size:13})})]}):s.jsxs("div",{className:"p-3 bg-slate-900 border-b border-slate-800 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("img",{src:h,className:"w-4 h-4 rounded-full object-contain",alt:""}),s.jsx("span",{className:"text-[10px] font-mono text-slate-300 font-bold",children:i})]}),s.jsx(za,{size:12,className:"text-slate-400"})]}),s.jsxs("div",{className:"p-4 space-y-1.5 bg-[#0f172a]",children:[s.jsx("h4",{className:"text-sm font-extrabold text-white leading-snug line-clamp-2 group-hover:text-blue-400 transition-colors font-sans",children:a}),o&&s.jsx("p",{className:"text-xs text-slate-300 leading-relaxed line-clamp-2 font-normal font-sans",children:o}),s.jsxs("div",{className:"pt-2 flex items-center gap-1.5 text-[10px] font-mono text-slate-400 font-bold uppercase tracking-wider",children:[s.jsx("img",{src:h,className:"w-3.5 h-3.5 rounded-full object-contain",alt:""}),s.jsxs("span",{children:["from ",i]})]})]})]})},GMe=({isAdmin:e=!1,onUserProfileClick:t,sharedPostId:r})=>{var At,ha,Un,ts,Wa,En,jn,an;const[n,i]=I.useState(ip||[]),[a,o]=I.useState(LV||{}),[c,h]=I.useState(!ip),[f,m]=I.useState(""),[y,w]=I.useState(1),[A,S]=I.useState(10),[j,T]=I.useState(100),D=I.useRef(n.length);I.useEffect(()=>{D.current=n.length},[n.length]);const V=I.useRef(null),U=ie.useCallback(De=>{V.current&&V.current.disconnect(),De&&(V.current=new IntersectionObserver(ht=>{var at;(at=ht[0])!=null&&at.isIntersecting&&T(Et=>Math.max(Et+10,100))},{rootMargin:"250px"}),V.current.observe(De))},[]),[G,X]=I.useState([]),q=I.useRef(!0),B=I.useRef(ip||[]);I.useEffect(()=>{B.current=n},[n]);const[z,F]=I.useState(r||null),[$,J]=I.useState(null),[Q,K]=I.useState(!1),[me,re]=I.useState(""),[le,ve]=I.useState(!1),[je,Ve]=I.useState(null),[Z,se]=I.useState(!1);I.useRef(null);const[xe,ae]=I.useState(MS||[]),[qe,pt]=I.useState(!MS),[Fe,jt]=I.useState(!1),[Pt,Ae]=I.useState(null),[Ie,vt]=I.useState(0),Re=ie.useMemo(()=>Pt===null?[]:xe.filter(De=>{const ht=(De.username||xw(De)).toLowerCase(),at=(De.displayName||"").toLowerCase(),Et=Pt.toLowerCase();return ht.includes(Et)||at.includes(Et)}).slice(0,5),[Pt,xe]),It=De=>{const ht=De.target.value;re(ht);const at=De.target.selectionStart,rr=ht.substring(0,at).split(/[\s]/),Nr=rr[rr.length-1];Nr.startsWith("@")?(Ae(Nr.substring(1)),vt(at)):Ae(null)},[Dt,cr]=I.useState(null),[St,Ct]=I.useState(!1),Gt=De=>{let ht=De;!ht.startsWith("http://")&&!ht.startsWith("https://")&&(ht="https://"+ht),cr(ht),Ct(!0)},[Xe,Xt]=I.useState({}),[Ot,or]=I.useState({}),[Wr,dr]=I.useState({}),[yn,He]=I.useState({}),[Rt,nr]=I.useState({}),[fr,hn]=I.useState({}),[en,Ci]=I.useState({}),[Gr,be]=I.useState({}),[Pe,$e]=I.useState({}),[ct,yr]=I.useState(null),[Lt,Lr]=I.useState({}),[ir,pr]=I.useState({}),[br,ln]=I.useState(!1),[de,ke]=I.useState(""),[Ze,Ft]=I.useState(!1),[Fr,gr]=I.useState({}),[Cr,xt]=I.useState(null),[Or,_t]=I.useState(null),Oe=Ne.currentUser,[ar,ft]=I.useState(null),[mr,Ht]=I.useState(new Set);I.useEffect(()=>{if(!Oe)return;const De=ei(st(fe,"users",Oe.uid),ht=>{ht.exists()&&ft(ht.data())});return()=>De()},[Oe]),I.useEffect(()=>{if(!Oe)return;const De=Jt(nt(fe,"invitations"),An("senderId","==",Oe.uid)),ht=Jt(nt(fe,"invitations"),An("receiverId","==",Oe.uid));let at=[],Et=[];const rr=()=>{const Bt=new Set;[...at,...Et].forEach(Er=>{Er.status==="accepted"&&(Er.senderId===Oe.uid?(Er.receiverId&&Bt.add(Er.receiverId),Er.targetUserId&&Bt.add(Er.targetUserId)):(Er.receiverId===Oe.uid||Er.targetUserId===Oe.uid)&&Er.senderId&&Bt.add(Er.senderId))}),Ht(Bt)},Nr=ei(De,Bt=>{at=Bt.docs.map(Er=>Er.data()),rr()}),ze=ei(ht,Bt=>{Et=Bt.docs.map(Er=>Er.data()),rr()});return()=>{Nr(),ze()}},[Oe]),I.useEffect(()=>{const De=Jt(nt(fe,"posts"),di("createdAt","desc"),yi(j)),ht=ei(De,at=>{const Et=at.docs.map(Bt=>({id:Bt.id,...Bt.data()})).filter(Bt=>!Bt.flagged);if(q.current){q.current=!1,i(Et),ip=Et,B.current=Et,h(!1);return}const rr=new Map(B.current.map(Bt=>[Bt.id,Bt])),Nr=[],ze=[];for(const Bt of Et)if(rr.has(Bt.id)){const Er=rr.get(Bt.id);JSON.stringify(Er)!==JSON.stringify(Bt)&&ze.push(Bt)}else Nr.push(Bt);if(ze.length>0&&i(Bt=>{const Er=Bt.map(jr=>{const _r=ze.find(_n=>_n.id===jr.id);return _r||jr});return B.current=Er,ip=Er,Er}),Nr.length>0){const Bt=Nr.filter(jr=>Oe&&jr.authorId===Oe.uid),Er=Nr.filter(jr=>!Oe||jr.authorId!==Oe.uid);Bt.length>0&&i(jr=>{const _r=new Set(jr.map(pe=>pe.id)),Be=[...Bt.filter(pe=>!_r.has(pe.id)),...jr];return B.current=Be,ip=Be,Be}),Er.length>0&&X(jr=>{const _r=new Set(jr.map(Be=>Be.id)),_n=Er.filter(Be=>!_r.has(Be.id));return _n.length===0?jr:[..._n,...jr]})}h(!1)},at=>{Gs(at,Ps.LIST,"posts"),h(!1)});return()=>ht()},[Oe,r,j]);const kr=()=>{G.length!==0&&(i(De=>{const ht=[...G,...De];return B.current=ht,ip=ht,ht}),X([]),window.scrollTo({top:0,behavior:"smooth"}))};I.useEffect(()=>{if(!Oe)return;const De=Jt(nt(fe,"follows")),ht=ei(De,at=>{const Et={};at.docs.forEach(rr=>{const Nr=rr.data();Nr.followerId===Oe.uid&&(Et[Nr.followedId]=!0)}),o(Et),LV=Et},at=>{console.warn("Silent ignored follows fetch error:",at)});return()=>ht()},[Oe]),I.useEffect(()=>{if(!Oe)return;pt(!0);const De=Jt(nt(fe,"users"),yi(20));vr(De).then(Et=>{const Nr=Et.docs.map(ze=>({uid:ze.id,...ze.data()})).filter(ze=>ze.uid!==Oe.uid);ae(Nr),MS=Nr,pt(!1)}).catch(Et=>{console.warn("Silent ignore users list fetch error:",Et),pt(!1)});const ht=Jt(nt(fe,"invitations"),An("senderId","==",Oe.uid)),at=ei(ht,Et=>{const rr={};Et.docs.forEach(Nr=>{const ze=Nr.data();ze.senderId===Oe.uid&&(rr[ze.receiverId]=!0)}),gr(rr)},Et=>{console.warn("Silent ignore invitations fetch error:",Et)});return()=>{at()}},[Oe]),I.useEffect(()=>{r&&n.some(De=>De.id===r)&&($e(De=>({...De,[r]:!0})),Gr[r]||mn(r),setTimeout(()=>{const De=document.getElementById(`post-card-${r}`);De&&De.scrollIntoView({behavior:"smooth",block:"center"})},600))},[r,n]),I.useEffect(()=>{r&&F(r)},[r]),I.useEffect(()=>{if(!z){J(null);return}const De=n.find(ht=>ht.id===z);De?J(De):(K(!0),as(st(fe,"posts",z)).then(ht=>{ht.exists()?J({id:ht.id,...ht.data()}):J(null),K(!1)}).catch(ht=>{console.error("Failed to load custom shared post:",ht),K(!1)}))},[z,n]),I.useEffect(()=>{if(!z)return;const De=Jt(nt(fe,"posts",z,"comments"),di("createdAt","asc")),ht=ei(De,at=>{const Et=at.docs.map(rr=>({id:rr.id,...rr.data()}));Xt(rr=>({...rr,[z]:Et}))},at=>{console.warn("Error tracking focused post comments:",at)});return()=>ht()},[z]),I.useEffect(()=>{if(!ct)return;const De=Jt(nt(fe,"posts",ct,"comments"),di("createdAt","asc")),ht=ei(De,at=>{const Et=at.docs.map(rr=>({id:rr.id,...rr.data()}));Xt(rr=>({...rr,[ct]:Et}))},at=>{console.warn("Error tracking active comment post comments:",at)});return()=>ht()},[ct]);const mn=De=>{yr(De);const ht=!Gr[De];if(be(at=>({...at,[De]:ht})),!Xe[De]){const at=Jt(nt(fe,"posts",De,"comments"),di("createdAt","asc"));ei(at,Et=>{const rr=Et.docs.map(Nr=>({id:Nr.id,...Nr.data()}));Xt(Nr=>({...Nr,[De]:rr}))},Et=>{Gs(Et,Ps.LIST,`posts/${De}/comments`)})}},fi=(De,ht)=>{const Et=!!!Pe[De];$e(rr=>({...rr,[De]:Et}));try{const rr=new URL(window.location.href);Et?(rr.searchParams.set("post",De),document.title=`${ht.substring(0,30)}... | Student Lounge`):(rr.searchParams.delete("post"),document.title="Student Lounge Feed | Campus Eye"),window.history.replaceState({},"",rr.toString())}catch(rr){console.warn("History push error on post expand:",rr)}},_s=async De=>{var at;const ht=(at=De.target.files)==null?void 0:at[0];if(ht){ve(!0);try{const Et=await I4(ht);Ve(Et),he.success("Image uploaded successfully!")}catch(Et){he.error(Et.message||"Failed to upload image")}finally{ve(!1)}}},xn=async De=>{var rr,Nr,ze,Bt;if(De.preventDefault(),!Oe){he.error("Please sign in to post");return}if(!me.trim()&&!je){he.error("Add some text or an image to post!");return}const ht=!!(ar!=null&&ar.isPremiumPostUser||ar!=null&&ar.isVerified||ar!=null&&ar.isPremium||ar!=null&&ar.blueCheck||e),at=(ar==null?void 0:ar.freePostsRemaining)??1;if(!ht&&at<=0){try{await dn(nt(fe,"notifications"),{userId:"admin_all",type:"unlimited_posting_request",title:`🎟️ Unlimited Posting Request from @${Oe.displayName||((rr=Oe.email)==null?void 0:rr.split("@")[0])||"Peer"}`,message:`@${Oe.displayName||((Nr=Oe.email)==null?void 0:Nr.split("@")[0])||"Peer"} (UID: ${Oe.uid}) has requested admin approval to unlock unlimited posting on Campus Eye.`,requestAuthorId:Oe.uid,requestAuthorName:Oe.displayName||((ze=Oe.email)==null?void 0:ze.split("@")[0])||"Peer",used:!1,createdAt:zr()})}catch(Er){console.error("Error creating posting approval request:",Er)}he.error("You have used your 1 Free Trial Post! An approval request has been sent to Campus Eye admins to unlock unlimited posting.",{duration:6e3});return}const Et=he.loading("Dispatching post...");try{const Er=me.trim(),jr=await dn(nt(fe,"posts"),{content:Er,imageUrl:je||null,authorId:Oe.uid,authorName:Oe.displayName||((Bt=Oe.email)==null?void 0:Bt.split("@")[0])||"Peer",authorPhotoURL:Oe.photoURL||"",createdAt:zr(),likeCount:0,commentCount:0,likedBy:[],reportsCount:0,flagged:!1,isTrialPost:!ht,isApprovedByAdmin:ht});try{const Be=`${window.location.origin}/p/post/${jr.id}`;fetch("/api/append-sitemap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Be,title:`Campus Dispatch by ${Oe.displayName||"Peer"}`,image:je||""})}).catch(()=>{})}catch{}!ht&&at>0&&await Gn(st(fe,"users",Oe.uid),{freePostsRemaining:0,isPremiumPostUser:!1},{merge:!0}),(Er.toLowerCase().includes("@mega")||Er.toLowerCase().includes("@megaai"))&&M2(Er,Oe.displayName||"Peer Student",Oe.uid,{type:"post",postId:jr.id}).then(async Be=>{Be&&(await dn(nt(fe,"posts",jr.id,"comments"),{postId:jr.id,content:Be,authorId:"mega-ai-bot",authorName:"Mega AI",authorPhotoURL:Uo,createdAt:zr(),likeCount:0,likedBy:[],isAIGenerated:!0}),await Ir(st(fe,"posts",jr.id),{commentCount:Cn(1)}),he.success("Mega AI auto-replied to your mention!",{icon:"✨"}))}).catch(Be=>console.error("Mega AI post trigger error:",Be));const _r=Er.match(/@([a-zA-Z0-9_\-]+)/g)||[],_n=Array.from(new Set(_r.map(Be=>Be.substring(1).toLowerCase())));for(const Be of _n){const pe=xe.find(ur=>(ur.username||xw(ur)).toLowerCase()===Be);if(pe&&pe.uid!==Oe.uid)try{await dn(nt(fe,"notifications"),{userId:pe.uid,title:`👋 @${xw(Oe)} mentioned you`,message:`${Oe.displayName||"A peer"} mentioned you in a Lounge dispatch: "${Er.substring(0,60)}..."`,used:!1,type:"mention",createdAt:zr()})}catch(ur){console.warn("Silent ignored notification creation error:",ur)}}re(""),Ve(null),he.success("Post dispatched successfully!",{id:Et})}catch(Er){he.error("Failed to post: "+Er.message,{id:Et})}},Js=async(De,ht=[])=>{if(!Oe)return;const at=ht.includes(Oe.uid),Et=st(fe,"posts",De);try{at?await Ir(Et,{likedBy:T2(Oe.uid),likeCount:Cn(-1)}):await Ir(Et,{likedBy:I2(Oe.uid),likeCount:Cn(1)})}catch(rr){console.error("Like toggle exception:",rr)}},cs=async(De,ht)=>{if(!Oe){he.error("Sign in with Google to react to comments!",{icon:"🔒"});return}const at=ir[ht];pr(Et=>({...Et,[ht]:!at}));try{const Et=st(fe,"posts",De,"comments",ht);await Ir(Et,{likeCount:Cn(at?-1:1),likedBy:at?T2(Oe.uid):I2(Oe.uid)})}catch(Et){console.error("Error liking post comment:",Et),pr(rr=>({...rr,[ht]:at}))}},ji=async De=>{var ze;if(!Oe)return;const ht=Ot[De]||"",at=Wr[De]||null,Et=yn[De]||null,rr=Rt[De]||null;if(!ht.trim()&&!at&&!Et&&!rr)return;const Nr=Lt[De];Ci(Bt=>({...Bt,[De]:!0}));try{const Bt=nt(fe,"posts",De,"comments");await dn(Bt,{postId:De,content:ht.trim()||(at?`[Sticker ${at}]`:"[Attachment]"),authorId:Oe.uid,authorName:Oe.displayName||((ze=Oe.email)==null?void 0:ze.split("@")[0])||"Peer",authorPhotoURL:Oe.photoURL||"",createdAt:zr(),parentId:(Nr==null?void 0:Nr.commentId)||null,replyToAuthor:(Nr==null?void 0:Nr.authorName)||null,likeCount:0,likedBy:[],...at?{stickerEmoji:at}:{},...Et?{imageUrl:Et}:{},...rr?{audioUrl:rr}:{}});const Er=st(fe,"posts",De);await Ir(Er,{commentCount:Cn(1)}),or(jr=>({...jr,[De]:""})),dr(jr=>({...jr,[De]:""})),He(jr=>({...jr,[De]:""})),nr(jr=>({...jr,[De]:""})),Lr(jr=>({...jr,[De]:null})),hn(jr=>({...jr,[De]:!1})),(ht.toLowerCase().includes("@mega")||ht.toLowerCase().includes("@megaai"))&&M2(ht,Oe.displayName||"Peer Student",Oe.uid,{type:"post_comment",postId:De,commentId:Nr==null?void 0:Nr.commentId}).then(async jr=>{jr&&(await dn(nt(fe,"posts",De,"comments"),{postId:De,content:jr,authorId:"mega-ai-bot",authorName:"Mega AI",authorPhotoURL:Uo,createdAt:zr(),parentId:(Nr==null?void 0:Nr.commentId)||null,replyToAuthor:Oe.displayName||"Peer",likeCount:0,likedBy:[],isAIGenerated:!0}),await Ir(st(fe,"posts",De),{commentCount:Cn(1)}),he.success("Mega AI auto-replied to your comment!",{icon:"✨"}))}).catch(jr=>console.error("Mega AI comment trigger error:",jr))}catch(Bt){console.error("Error creating post comment:",Bt)}finally{Ci(Bt=>({...Bt,[De]:!1}))}},Kn=async De=>{if(!Oe)return;const ht=st(fe,"posts",De);he.success("Thank you. Post flagged and hidden from view.",{icon:"🛡️"});try{await Ir(ht,{reportsCount:Cn(1),flagged:!0})}catch(at){console.error("Error reporting post:",at)}},On=async De=>{var ht;if(Oe){if(!e&&((ht=Oe.email)==null?void 0:ht.toLowerCase())!=="atwiinevictor2@gmail.com"){he.error("Access Denied: Only administrators can delete posts.");return}if(Cr!==De){xt(De),setTimeout(()=>{xt(at=>at===De?null:at)},4e3);return}try{await ai(st(fe,"posts",De)),he.success("Post deleted successfully!"),xt(null)}catch(at){he.error("Failed to delete post: "+at.message)}}},Xn=async(De,ht)=>{if(!Oe){localStorage.setItem("pending_follow_uid",De),localStorage.setItem("pending_follow_name",ht),he.success(`Complete google sign-up to follow @${ht.toLowerCase().replace(/\s+/g,"")}!`,{icon:"🔐"}),window.dispatchEvent(new CustomEvent("open-lounge-auth"));return}const at=`${Oe.uid}_${De}`,Et=st(fe,"follows",at),rr=a[De];try{if(rr){await ai(Et),he.success(`Unfollowed @${ht.toLowerCase().replace(/\s+/g,"")}`);const Nr=Oe.displayName?`@${Oe.displayName.toLowerCase().replace(/\s+/g,"")}`:"A peer";try{const ze=`notif_unfollow_${Oe.uid}_${De}`;await Gn(st(fe,"notifications",ze),{userId:De,title:"💔 Lounge Unfollow",message:`${Nr} unfollowed you.`,type:"social",used:!0,createdAt:new Date})}catch(ze){console.warn("Failed to create unfollow notification:",ze)}}else{await Gn(Et,{followerId:Oe.uid,followedId:De,createdAt:zr()}),he.success(`Following @${ht.toLowerCase().replace(/\s+/g,"")}!`,{icon:"🤝"});const Nr=Oe.displayName?`@${Oe.displayName.toLowerCase().replace(/\s+/g,"")}`:"A peer";try{const ze=`notif_follow_${Oe.uid}_${De}`;await Gn(st(fe,"notifications",ze),{userId:De,title:"👥 New Lounge Follower!",message:`${Nr} is now following you. They will receive your latest dispatches!`,type:"social",createdAt:new Date})}catch(ze){console.warn("Failed to create follow notification from lounge:",ze)}}}catch(Nr){console.error("Follow toggling issue:",Nr)}},bi=async(De,ht,at)=>{const Et=`${window.location.origin}/p/post/${De}`,rr=ht||"Check out this Post on Campus Eye",Nr=rr.length>140?`${rr.substring(0,140)}...`:rr;try{fetch("/api/append-sitemap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Et,title:"Campus Dispatch | Campus Eye Lounge",image:at||""})}).catch(()=>{})}catch{}try{if(navigator.share){const ze={title:"Campus Dispatch | Campus Eye Lounge",text:`📣 Campus Dispatch: "${Nr}"${at?` Preview: ${at}`:""} Read dispatch:`,url:Et};await navigator.share(ze),he.success("Post shared successfully!")}else{const ze=`📣 Campus Dispatch: "${Nr}"${at?` 🖼️ Preview Image: ${at}`:""} 🔗 Open direct post: ${Et}`;await Od(ze),he.success("Post preview link & image copied to clipboard!")}}catch(ze){if(ze.name!=="AbortError")try{const Bt=`📣 Campus Dispatch: "${Nr}"${at?` 🖼️ Preview Image: ${at}`:""} 🔗 Open direct post: ${Et}`;await Od(Bt),he.success("Post link copied to clipboard!")}catch{}}},ci=async De=>{var at,Et;if(!Oe){he.error("Please sign in to invite peers!");return}const ht=`${Oe.uid}_${De.uid}`;try{await Gn(st(fe,"invitations",ht),{id:ht,senderId:Oe.uid,senderName:Oe.displayName||((at=Oe.email)==null?void 0:at.split("@")[0])||"Peer",senderPhotoURL:Oe.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(Oe.displayName||"Peer")}&background=random`,receiverId:De.uid,receiverName:De.displayName||((Et=De.email)==null?void 0:Et.split("@")[0])||"Peer",status:"pending",createdAt:zr()}),he.success(`Lounge invite sent to @${(De.displayName||"peer").toLowerCase().replace(/\s+/g,"")}!`,{icon:"🚀"})}catch(rr){he.error("Failed to send invite: "+rr.message)}};return s.jsxs("div",{className:"bg-gray-50/50 min-h-screen py-3 sm:py-6 px-1 sm:px-6 w-full max-w-[1680px] xl:max-w-[1780px] 2xl:max-w-[1880px] mx-auto text-left select-none pb-24",children:[s.jsx("div",{className:"flex justify-end items-center mb-4",children:s.jsxs("button",{onClick:()=>ln(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-650 hover:bg-red-700 text-white rounded-xl text-[10px] font-black uppercase tracking-wider transition-all shadow-md active:scale-95 cursor-pointer shrink-0",children:[s.jsx(ko,{size:12,strokeWidth:2.5}),s.jsx("span",{children:"Invite Peers"})]})}),Oe?s.jsx("div",{className:"bg-white border border-gray-150 rounded-2xl p-4 shadow-sm mb-6 transition-all duration-350",children:s.jsx("form",{onSubmit:xn,children:s.jsxs("div",{className:"flex gap-3",children:[s.jsx("img",{src:(Oe==null?void 0:Oe.photoURL)||`https://ui-avatars.com/api/?name=${encodeURIComponent((Oe==null?void 0:Oe.displayName)||"Peer")}&background=random`,className:"w-10 h-10 rounded-full border border-gray-100 object-cover shrink-0 mt-1",alt:""}),s.jsxs("div",{className:"flex-1 space-y-3",children:[s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx("textarea",{value:me,onFocus:()=>se(!0),onChange:It,placeholder:"What's on your mind? Share it.",rows:Z?3:1,className:"w-full text-xs font-sans placeholder-gray-400 bg-transparent border-0 resize-none focus:ring-0 focus:outline-none pt-2 transition-all duration-300"}),!Z&&s.jsx("button",{type:"button",onClick:()=>se(!0),className:"p-2 text-red-650 hover:bg-red-50 rounded-full transition-all cursor-pointer shrink-0",title:"Write post",children:s.jsx(Eo,{size:15})})]}),Pt!==null&&Re.length>0&&s.jsxs("div",{className:"bg-white border border-gray-150 rounded-xl shadow-lg p-1 max-h-48 overflow-y-auto mb-2 space-y-0.5 divide-y divide-gray-50 z-50",children:[s.jsx("div",{className:"px-3 py-1 text-[9px] font-black uppercase text-gray-400 tracking-wider",children:"Mention a Peer"}),Re.map(De=>{const ht=De.username||xw(De);return s.jsxs("button",{type:"button",onClick:()=>{const at=me.substring(0,Ie-Pt.length-1),Et=me.substring(Ie),rr=`${at}@${ht} ${Et}`;re(rr),Ae(null)},className:"w-full text-left flex items-center gap-2 px-3 py-1.5 hover:bg-neutral-55 rounded-lg transition-colors cursor-pointer",children:[s.jsx("img",{src:De.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(De.displayName||"Peer")}&background=random`,className:"w-6 h-6 rounded-full border border-gray-100 object-cover",alt:""}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-[11px] font-extrabold text-gray-905 truncate",children:De.displayName||"Peer"}),s.jsxs("p",{className:"text-[9px] font-mono font-bold text-blue-600 truncate",children:["@",ht]})]})]},De.uid)})]}),Z&&s.jsxs("div",{className:"space-y-3",children:[je&&s.jsxs("div",{className:"relative rounded-xl overflow-hidden border border-gray-150 max-h-56 bg-gray-50",children:[s.jsx("img",{src:je,className:"w-full h-full object-cover",alt:"Selected Preview"}),s.jsx("button",{type:"button",onClick:()=>Ve(null),className:"absolute top-2.5 right-2.5 w-6 h-6 rounded-full bg-black/70 text-white flex items-center justify-center hover:bg-black transition-colors",children:s.jsx(Jr,{size:13})})]}),s.jsxs("div",{className:"space-y-2 border-t border-gray-100 pt-3",children:[s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("input",{type:"url",placeholder:"Or paste post imageUrl (https://...) for instant preview",value:je||"",onChange:De=>Ve(De.target.value.trim()||null),className:"w-full text-[10px] font-mono bg-gray-50 border border-gray-200 rounded-xl px-3 py-1.5 focus:bg-white focus:border-red-600 outline-none text-gray-800"})}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs("label",{htmlFor:"posts-page-file-upload",className:"text-gray-600 hover:text-red-650 p-2 rounded-full hover:bg-gray-100 transition-colors flex items-center justify-center cursor-pointer gap-1.5 text-[10px] font-extrabold border border-gray-200 shadow-2xs bg-white",title:"Add Image or Video File",children:[s.jsx("input",{id:"posts-page-file-upload",type:"file",accept:"image/*,video/*",onChange:_s,className:"hidden"}),le?s.jsx(vn,{size:16,className:"animate-spin text-red-650"}):s.jsxs(s.Fragment,{children:[s.jsx(yu,{size:16,className:"text-red-600"}),s.jsx("span",{className:"text-[9.5px] uppercase font-black text-gray-700",children:"Upload Media"})]})]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{se(!1),re(""),Ve(null)},className:"text-[9px] font-black uppercase tracking-wider text-gray-550 border border-gray-200 h-8 px-4 rounded-full hover:bg-gray-50 transition-colors cursor-pointer",children:"Collapse"}),s.jsx("button",{type:"submit",disabled:le||!me.trim()&&!je,className:"bg-gray-950 text-white font-extrabold text-[10px] uppercase tracking-wider h-8 px-5 rounded-full hover:bg-red-650 transition-colors cursor-pointer disabled:opacity-40",children:"Dispatch Debate"})]})]})]})]})]})]})})}):s.jsx("div",{className:"bg-white border border-dashed border-gray-150 rounded-2xl p-5 text-center mb-6 shadow-3xs select-none",children:s.jsx("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-widest leading-none flex items-center justify-center gap-2",children:"📢 Sign in to publish public updates, mention peers and join student lounge dispatches!"})}),s.jsxs("div",{className:"relative mb-5",children:[s.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:s.jsx(Tp,{size:14,className:"text-gray-400"})}),s.jsx("input",{type:"text",value:f,onChange:De=>{m(De.target.value),w(1)},placeholder:"Search campus dispatches by text or author name...",className:"block w-full pl-9 pr-8 py-2.5 bg-white border border-gray-150 focus:border-red-650 focus:bg-white text-xs font-bold rounded-xl outline-none placeholder-gray-400 text-gray-900 transition-all shadow-xs"}),f&&s.jsx("button",{type:"button",onClick:()=>{m(""),w(1)},className:"absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer text-gray-400 hover:text-black",title:"Clear Post Search",children:s.jsx(Jr,{size:13})})]}),s.jsx(on,{children:G.length>0&&s.jsx(Qt.div,{initial:{opacity:0,y:-15,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-10,scale:.95},className:"flex justify-center mb-5 sticky top-4 z-40",children:s.jsxs("button",{onClick:kr,className:"flex items-center gap-2 px-5 py-2.5 bg-blue-600 hover:bg-blue-700 text-white rounded-full text-xs font-black uppercase tracking-widest transition-all duration-200 cursor-pointer shadow-lg active:scale-95 group hover:shadow-cyan-100/10",children:[s.jsx("span",{className:"relative flex h-2 w-2",children:s.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-400"})}),s.jsxs("span",{children:["View ",G.length," New Post",G.length>1?"s":""]})]})})}),(()=>{const De=n.filter(ze=>{var _r,_n;if(!f.trim())return!0;const Bt=f.toLowerCase(),Er=(_r=ze.content)==null?void 0:_r.toLowerCase().includes(Bt),jr=(_n=ze.authorName)==null?void 0:_n.toLowerCase().includes(Bt);return Er||jr}),ht=Array.from(new Map(De.map(ze=>[ze.id,ze])).values()),at=Math.max(1,Math.ceil(ht.length/A)),rr=(Math.min(y,at)-1)*A,Nr=ht.slice(rr,rr+A);return c&&n.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-20 space-y-2",children:[s.jsx(vn,{className:"w-8 h-8 text-red-650 animate-spin"}),s.jsx("p",{className:"text-[10px] font-black uppercase text-gray-400 tracking-widest leading-none",children:"Connecting Lounge Updates"})]}):De.length===0?s.jsxs("div",{className:"bg-white border border-gray-150 rounded-2xl py-14 text-center p-6 shadow-sm",children:[s.jsx(Xi,{className:"w-8 h-8 text-gray-300 mx-auto mb-2.5"}),s.jsx("p",{className:"text-xs font-black uppercase text-gray-950 tracking-wider",children:"No matching lounge posts found"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1 font-sans",children:"Try searching with a different user name or keyword phrase."})]}):s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-6",children:Nr.map((ze,Bt)=>{var pe,ur,Ii,vi,ti,ea,Ti;const Er=(pe=ze.likedBy)==null?void 0:pe.includes((Oe==null?void 0:Oe.uid)||""),jr=a[ze.authorId],_r=(Oe==null?void 0:Oe.uid)===ze.authorId,_n=Fr[ze.authorId],Be=Bt===Math.max(2,Nr.length-2);return s.jsxs(Qt.div,{ref:Be?U:void 0,id:`post-card-${ze.id}`,layout:!0,className:Ge("bg-white border rounded-2xl p-4 md:p-5 shadow-sm space-y-3 flex flex-col justify-between transition-all duration-500",ze.id===r?"border-red-650 ring-2 ring-red-650/15 shadow-md scale-[1.01]":"border-gray-150"),children:[s.jsxs("div",{children:[e&&ze.isTrialPost&&!ze.isApprovedByAdmin&&s.jsxs("div",{className:"mb-3 p-3 bg-gradient-to-r from-amber-50 to-orange-50 border border-amber-200 rounded-2xl flex flex-wrap items-center justify-between gap-2 text-left",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-1.5 bg-amber-500 text-white rounded-xl shadow-2xs shrink-0",children:s.jsx(vI,{size:14})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-black uppercase text-amber-900 tracking-wider",children:"🎟️ Admin Approval Ticket (1st Free Trial Post)"}),s.jsxs("p",{className:"text-[9px] text-amber-700 font-medium",children:["Approve @",ze.authorName," to unlock unlimited posting on Campus Eye."]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:async()=>{try{await Gn(st(fe,"users",ze.authorId),{isPremiumPostUser:!0},{merge:!0}),await Ir(st(fe,"posts",ze.id),{isApprovedByAdmin:!0}),he.success(`Approved @${ze.authorName} for unlimited posting!`,{icon:"🎉"})}catch(zt){he.error("Failed to approve user: "+zt.message)}},className:"px-3 py-1.5 bg-amber-600 hover:bg-amber-700 text-white font-black text-[9px] uppercase tracking-wider rounded-xl shadow-xs transition-all cursor-pointer shrink-0",children:"Approve User for Unlimited Posting"}),s.jsx("button",{onClick:async()=>{try{await Ir(st(fe,"posts",ze.id),{isApprovedByAdmin:!0}),he.success(`Dismissed request for @${ze.authorName}`,{icon:"🗑️"})}catch(zt){he.error("Error dismissing request: "+zt.message)}},className:"px-2.5 py-1.5 bg-gray-200 hover:bg-gray-300 text-gray-700 font-black text-[9px] uppercase tracking-wider rounded-xl transition-all cursor-pointer shrink-0",children:"Dismiss"})]})]}),s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{onClick:()=>t==null?void 0:t(ze.authorId),className:"flex items-center gap-2.5 min-w-0 cursor-pointer hover:opacity-85 transition-opacity duration-150",title:"Click to view peer credentials",children:[ze.isAIGenerated||ze.isAiGenerated||ze.authorId==="mega-ai-bot"||(ur=ze.authorName)!=null&&ur.toLowerCase().includes("mega ai")?s.jsx(FMe,{size:"sm"}):s.jsx("img",{src:ze.authorPhotoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(ze.authorName)}&background=random`,className:"w-7 h-7 rounded-full border border-gray-100 object-cover shrink-0",alt:""}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1 leading-none truncate",children:[s.jsx("span",{className:"text-[10px] font-black uppercase tracking-tight text-gray-950 truncate",children:ze.authorName}),s.jsx(So,{size:12,className:"shrink-0"}),(ze.isAIGenerated||ze.isAiGenerated||ze.authorId==="mega-ai-bot"||((Ii=ze.authorName)==null?void 0:Ii.toLowerCase().includes("mega ai")))&&s.jsx(Bw,{}),s.jsxs("span",{className:"text-[8px] text-gray-400 font-bold truncate",children:["@",ze.authorName.toLowerCase().replace(/\s+/g,"")]})]}),s.jsx("span",{className:"text-[7.5px] font-black uppercase tracking-wider text-gray-400 mt-0.5 block",children:(vi=ze.createdAt)!=null&&vi.toDate?new Date(ze.createdAt.toDate().getTime()).toLocaleDateString():"Now"})]})]}),!_r&&Oe&&s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[mr.has(ze.authorId)&&s.jsxs("button",{onClick:zt=>{zt.stopPropagation(),window.dispatchEvent(new CustomEvent("open-imessage-friend",{detail:{uid:ze.authorId,displayName:ze.authorName,username:ze.authorName.toLowerCase().replace(/\s+/g,""),photoURL:ze.authorPhotoURL||""}}))},className:"p-1 px-2.5 bg-[#007AFF] hover:bg-blue-600 text-white rounded-full transition-all cursor-pointer flex items-center gap-1 text-[8.5px] font-black uppercase tracking-wider shrink-0 shadow-2xs",title:`Open iMessage chat with connected friend ${ze.authorName}`,children:[s.jsx(Xs,{size:11,strokeWidth:2.5}),s.jsx("span",{className:"hidden sm:inline",children:"iMessage"})]}),s.jsxs("button",{onClick:async()=>{const zt={uid:ze.authorId,displayName:ze.authorName,email:""};await ci(zt)},disabled:_n,className:Ge("text-[7.5px] font-black uppercase tracking-wider h-5 px-1.5 rounded-full flex items-center gap-0.5 transition-all cursor-pointer shadow-none border",_n?"bg-gray-100 border-gray-200 text-gray-400 cursor-not-allowed":"bg-emerald-600 border-emerald-500 text-white hover:bg-emerald-750"),title:"Send Mutual Lounge Invitation",children:[s.jsx(bp,{size:8,strokeWidth:2.5}),s.jsx("span",{className:"hidden sm:inline",children:_n?"Invited":"Invite"})]}),s.jsx("button",{onClick:()=>Xn(ze.authorId,ze.authorName),className:`text-[7.5px] font-black uppercase tracking-widest h-5 px-1.5 rounded-full flex items-center gap-0.5 cursor-pointer transition-colors ${jr?"bg-gray-100 text-gray-650 border border-gray-200 hover:bg-red-50 hover:text-red-650 hover:border-red-150":"bg-red-50 text-red-650 border border-red-150/50 hover:bg-red-100"}`,children:jr?s.jsxs(s.Fragment,{children:[s.jsx(iy,{size:8}),s.jsx("span",{className:"hidden sm:inline",children:"Following"})]}):s.jsxs(s.Fragment,{children:[s.jsx(bp,{size:8}),s.jsx("span",{className:"hidden sm:inline",children:"Follow"})]})})]})]}),s.jsx("p",{className:"text-[11px] text-gray-800 font-sans leading-relaxed whitespace-pre-wrap text-left mb-2",children:(()=>{const Sn=ze.content&&ze.content.length>160,Ta=!!Pe[ze.id];return!Sn||Ta?s.jsxs(s.Fragment,{children:[b1(ze.content,Gt),Sn&&s.jsx("button",{onClick:Ss=>{Ss.stopPropagation(),fi(ze.id,ze.content)},className:"ml-1 text-[#EE1B24] font-black cursor-pointer hover:underline text-[9px] uppercase whitespace-nowrap inline-block",children:"Read less"})]}):s.jsxs(s.Fragment,{children:[b1(ze.content.substring(0,160),Gt),"...",s.jsx("button",{onClick:Ss=>{Ss.stopPropagation(),fi(ze.id,ze.content)},className:"ml-1 text-[#EE1B24] font-black cursor-pointer hover:underline text-[9px] uppercase whitespace-nowrap inline-block",children:"Read more"})]})})()}),(()=>{const zt=$Me(ze.content);if(zt.length===0)return null;const Sn=zt[0];return s.jsx(HMe,{url:Sn,onOpenUrl:Gt})})(),ze.imageUrl&&s.jsxs("div",{onClick:()=>_t(ze.imageUrl),className:"rounded-2xl overflow-hidden border border-gray-200/80 bg-black/5 cursor-pointer relative group transition-all my-3 max-h-[650px] w-full flex items-center justify-center shadow-xs",children:[s.jsx(Bi,{src:ze.imageUrl,className:"w-full h-auto max-h-[650px] object-contain mx-auto group-hover:opacity-95 transition-opacity duration-200 rounded-2xl",alt:"Post graphic asset"}),s.jsx("div",{className:"absolute top-3 right-3 opacity-0 group-hover:opacity-100 transition-opacity",children:s.jsxs("div",{className:"px-2.5 py-1 bg-black/75 backdrop-blur-md text-white rounded-full text-[8px] font-black uppercase tracking-wider flex items-center gap-1 shadow-md",children:[s.jsx(n2,{size:9})," Full Size"]})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between border-t border-gray-100 pt-2 select-none",children:[s.jsxs("button",{onClick:()=>Js(ze.id,ze.likedBy),className:`flex items-center gap-1 text-[8.5px] font-bold uppercase tracking-wider transition-colors cursor-pointer ${Er?"text-blue-600 font-extrabold":"text-gray-450 hover:text-blue-500"}`,children:[s.jsx(Qt.div,{animate:Er?{scale:[1,1.45,.9,1.15,1]}:{scale:1},transition:{duration:.4},children:s.jsx(Oie,{size:12,className:Er?"fill-current":""})}),s.jsx("span",{children:ze.likeCount||0})]}),s.jsxs("button",{onClick:()=>mn(ze.id),className:`flex items-center gap-1 text-[8.5px] font-bold uppercase tracking-wider transition-colors cursor-pointer ${Gr[ze.id]?"text-gray-950 font-black":"text-gray-450 hover:text-gray-950"}`,children:[s.jsx(Ri,{size:12}),s.jsxs("span",{children:[ze.commentCount||0," Discussions"]})]}),s.jsxs("button",{onClick:()=>bi(ze.id,ze.content,ze.imageUrl),className:"flex items-center gap-1 text-[8.5px] font-bold uppercase tracking-wider text-gray-450 hover:text-gray-950 transition-colors cursor-pointer",children:[s.jsx(Ld,{size:12}),s.jsx("span",{children:"Share"})]}),Oe&&(e||((ti=Oe.email)==null?void 0:ti.toLowerCase())==="atwiinevictor2@gmail.com"?s.jsxs("button",{onClick:()=>On(ze.id),className:`flex items-center gap-0.5 select-none cursor-pointer py-0.5 px-2 rounded-full border transition-all ${Cr===ze.id?"bg-red-650 border-red-650 text-white shadow-xs":"bg-transparent border-transparent text-gray-300 hover:text-red-650"}`,title:Cr===ze.id?"Click again to confirm delete":"Delete Post (Master Admin)",children:[s.jsx(Jr,{size:11,className:"stroke-[3]"}),s.jsx("span",{className:`text-[8px] uppercase font-black tracking-tight ${Cr===ze.id?"text-white":"text-gray-400 hover:text-red-650"}`,children:Cr===ze.id?"Confirm?":"Delete"})]}):_r?null:s.jsx("button",{onClick:()=>Kn(ze.id),className:"text-gray-300 hover:text-amber-500 transition-colors flex items-center gap-1 select-none cursor-pointer",title:"Report Abuse / Inappropriate",children:s.jsx(Su,{size:12})}))]}),s.jsx(on,{children:Gr[ze.id]&&s.jsxs(Qt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"border-t border-gray-100 pt-2.5 mt-1 overflow-hidden",children:[s.jsx("div",{className:"space-y-2 mb-3.5 max-h-40 overflow-y-auto pr-1",children:((ea=Xe[ze.id])==null?void 0:ea.length)===0?s.jsx("p",{className:"text-[8px] font-bold uppercase text-gray-350 italic text-center py-1",children:"No statements dispatched. Formulate your thought."}):(Ti=Xe[ze.id])==null?void 0:Ti.map(zt=>{var Sn,Ta;return s.jsxs("div",{className:"flex gap-1.5 items-start py-0.5",children:[s.jsx("img",{src:zt.authorId==="mega-ai-bot"||(Sn=zt.authorName)!=null&&Sn.toLowerCase().includes("mega ai")?Uo:zt.authorPhotoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(zt.authorName)}&background=random`,className:"w-5 h-5 rounded-full border border-gray-100 object-cover mt-0.5 animate-fade-in",alt:""}),s.jsxs("div",{className:"flex-1 min-w-0 bg-gray-50/70 rounded-xl p-2 border border-gray-100",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-[8px] font-black uppercase text-gray-950 tracking-tight",children:zt.authorName}),s.jsx(So,{size:10,className:"shrink-0"})]}),s.jsx("span",{className:"text-[7px] font-bold text-gray-400",children:(Ta=zt.createdAt)!=null&&Ta.toDate?new Date(zt.createdAt.toDate().getTime()).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"Now"})]}),s.jsx("p",{className:"text-[10px] text-gray-700 font-sans leading-relaxed mt-0.5",children:zt.content})]})]},zt.id)})}),Oe?s.jsxs("div",{className:"flex gap-1.5 items-center",children:[s.jsx("input",{type:"text",value:Ot[ze.id]||"",onChange:zt=>{const Sn=zt.target.value;or(Ta=>({...Ta,[ze.id]:Sn}))},placeholder:"What's on your mind? Share it.",className:"flex-1 bg-gray-50 p-1.5 rounded-lg text-[10px] font-sans outline-none focus:outline-none focus:ring-1 focus:ring-red-500/25 border border-gray-150 placeholder-gray-400"}),s.jsx("button",{onClick:()=>ji(ze.id),disabled:en[ze.id]||!(Ot[ze.id]||"").trim(),className:"bg-gray-950 text-white rounded-full w-6 h-6 flex items-center justify-center hover:bg-red-650 transition-colors disabled:opacity-30 cursor-pointer text-[10px] shrink-0",children:s.jsx(Eo,{size:10})})]}):s.jsx("div",{className:"bg-gray-50 rounded-xl p-2 border border-gray-100 text-center",children:s.jsx("p",{className:"text-[8px] font-black uppercase tracking-widest text-gray-400",children:"Sign in with Google to reply"})})]})})]})]},`${ze.id}-${Bt}`)})}),De.length>0&&s.jsx("div",{className:"mt-6",children:s.jsx(Mee,{currentPage:y,totalPages:at,totalItems:De.length,itemsPerPage:A,onPageChange:ze=>{w(ze),ze*A>j-10&&T(Bt=>Math.max(Bt,ze*A+50)),window.scrollTo({top:0,behavior:"smooth"})},onItemsPerPageChange:ze=>{S(ze),w(1),ze>j&&T(ze+50)},itemLabel:"posts"})})]})})(),s.jsx(on,{children:br&&s.jsxs("div",{className:"fixed inset-0 z-[3500] flex items-center justify-center p-4",children:[s.jsx(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>ln(!1),className:"absolute inset-0 bg-black/60 backdrop-blur-md"}),s.jsxs(Qt.div,{initial:{opacity:0,scale:.95,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:15},transition:{type:"spring",damping:25,stiffness:300},className:"relative w-full max-w-md bg-white border border-gray-150 rounded-2xl shadow-2xl p-6 overflow-hidden max-h-[85vh] flex flex-col text-left",children:[s.jsxs("div",{className:"flex items-center justify-between pb-3.5 border-b border-gray-100 mb-5 relative",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-1.5 bg-red-50 rounded-lg text-red-650 shrink-0",children:s.jsx(ko,{size:16,strokeWidth:2.5})}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-sans font-black text-xs uppercase tracking-wider text-gray-950",children:"Invite Lounge Peers"}),s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-tight font-mono",children:"Expand your campus digital board"})]})]}),s.jsx("button",{onClick:()=>ln(!1),className:"p-1 rounded-full hover:bg-gray-100 text-gray-405 hover:text-gray-950 transition-colors cursor-pointer",title:"Close panel",children:s.jsx(Jr,{size:16})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto space-y-5 pr-1 py-1",children:[s.jsxs("div",{className:"bg-gray-50/70 rounded-xl p-4 border border-gray-100 flex flex-col gap-3",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Xi,{size:13,className:"text-red-650 shrink-0"}),s.jsx("span",{className:"text-[10px] font-black uppercase text-gray-900 tracking-wider",children:"Share Lounge Join Link"})]}),s.jsx("p",{className:"text-[10px] font-semibold text-gray-550 leading-relaxed",children:"Copy the Student Lounge direct referral channel URL to hand to custom circles via WhatsApp, Slack or external dispatches."}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",readOnly:!0,value:(()=>{var ht;const De=Oe?(Oe.displayName||((ht=Oe.email)==null?void 0:ht.split("@")[0])||"peer").trim().toLowerCase().replace(/[^a-z0-9]/g,"-"):"peer";return`${window.location.origin}?invite=${De}-invites-you`})(),className:"flex-1 bg-white border border-gray-200 rounded-lg px-3 py-1.5 text-[10px] font-mono text-gray-500 outline-none select-all select-none"}),s.jsx("button",{onClick:()=>{var at;const De=Oe?(Oe.displayName||((at=Oe.email)==null?void 0:at.split("@")[0])||"peer").trim().toLowerCase().replace(/[^a-z0-9]/g,"-"):"peer",ht=`${window.location.origin}?invite=${De}-invites-you`;Od(ht),he.success("Your unique Lounge invitation link copied!",{icon:"🔗"})},className:"px-3 py-1.5 bg-gray-950 hover:bg-red-650 text-white rounded-lg text-[9px] font-black uppercase tracking-wider transition-colors cursor-pointer active:scale-95 shrink-0",children:"Copy Link"})]})]}),s.jsxs("form",{onSubmit:async De=>{if(De.preventDefault(),!de.trim()){he.error("Please enter a valid student or faculty email");return}Ft(!0);try{await dn(nt(fe,"invitations"),{senderId:(Oe==null?void 0:Oe.uid)||"guest",senderName:(Oe==null?void 0:Oe.displayName)||"Peer",senderPhotoURL:(Oe==null?void 0:Oe.photoURL)||"",receiverEmail:de.trim().toLowerCase(),status:"pending",type:"email",createdAt:zr()}),he.success(`Broadcasting dispatch invite to ${de.trim().toLowerCase()}!`,{icon:"✉️"}),ke("")}catch(ht){he.error("Failed to dispatcher invitation: "+ht.message)}finally{Ft(!1)}},className:"space-y-2.5 pb-2 border-b border-gray-100",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Xs,{size:13,className:"text-red-650 shrink-0"}),s.jsx("span",{className:"text-[10px] font-black uppercase text-gray-900 tracking-wider",children:"Email Dispatch Invitation"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"email",required:!0,placeholder:"Enter peer's email address",value:de,onChange:De=>ke(De.target.value),className:"flex-1 bg-gray-50/50 border border-gray-200 rounded-lg px-3 py-1.5 text-xs font-sans outline-none focus:bg-white focus:ring-1 focus:ring-red-550/20 transition-all placeholder-gray-400"}),s.jsxs("button",{type:"submit",disabled:Ze,className:"px-4 py-1.5 bg-red-650 hover:bg-red-700 disabled:bg-gray-300 text-white rounded-lg text-[9px] font-black uppercase tracking-wider transition-colors cursor-pointer active:scale-95 shrink-0 flex items-center gap-1",children:[Ze?s.jsx(vn,{size:10,className:"className animate-spin"}):s.jsx(Eo,{size:10}),s.jsx("span",{children:"Dispatch"})]})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[s.jsxs("span",{className:"text-[10px] font-black uppercase text-gray-900 tracking-wider",children:["Lounge Fellow Citizens (",xe.length,")"]}),s.jsx("span",{className:"text-[8px] font-mono font-black uppercase tracking-widest text-emerald-650 bg-emerald-50 px-1.5 py-0.5 rounded-md",children:"Live Stream"})]}),qe?s.jsx("div",{className:"flex justify-center items-center py-6",children:s.jsx(vn,{size:18,className:"animate-spin text-red-650"})}):xe.length===0?s.jsx("p",{className:"text-[9.5px] font-bold uppercase text-gray-400 font-sans py-4 text-center leading-relaxed",children:"No other registered peers discovered yet. Disperse invitations to propagate!"}):s.jsx("div",{className:"space-y-2 max-h-52 overflow-y-auto pr-1",children:xe.map(De=>{const ht=Fr[De.uid];return s.jsxs("div",{className:"flex items-center justify-between p-2.5 rounded-xl border border-gray-150 hover:border-gray-200 hover:bg-gray-100/10 transition-colors gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("img",{src:De.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(De.displayName||"P")}&background=random`,className:"w-7 h-7 rounded-full border border-gray-100 object-cover shrink-0",alt:""}),s.jsxs("div",{className:"min-w-0 leading-tight",children:[s.jsx("span",{className:"text-[10px] font-black uppercase tracking-tight text-gray-950 block truncate",children:De.displayName||"Peer"}),s.jsxs("span",{className:"text-[8px] font-semibold text-gray-400 block truncate",children:["@",(De.displayName||"peer").toLowerCase().replace(/\s+/g,"")]})]})]}),s.jsx("button",{onClick:()=>ci(De),disabled:ht,className:Ge("text-[8px] font-sans font-black uppercase tracking-widest px-2.5 py-1.5 rounded-lg border cursor-pointer transition-all active:scale-95 flex items-center gap-1 shrink-0",ht?"bg-gray-100 text-gray-400 border-gray-200 cursor-not-allowed":"bg-emerald-600 text-white border-emerald-500 hover:bg-emerald-700"),children:ht?s.jsxs(s.Fragment,{children:[s.jsx(zu,{size:9,strokeWidth:3}),s.jsx("span",{children:"Invited"})]}):s.jsxs(s.Fragment,{children:[s.jsx(bp,{size:9,strokeWidth:3}),s.jsx("span",{children:"Invite"})]})})]},De.uid)})})]})]}),s.jsx("div",{className:"border-t border-gray-100 pt-3.5 mt-5 text-center text-gray-400",children:s.jsx("span",{className:"text-[8px] font-black uppercase tracking-widest font-mono",children:"Campus Eye Network Connection Protocol"})})]})]})}),s.jsx(on,{children:Or&&s.jsxs("div",{className:"fixed inset-0 bg-slate-950/95 backdrop-blur-md flex flex-col items-center justify-center p-4 z-[9999] select-none",children:[s.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-3",children:[s.jsxs("button",{onClick:async()=>{try{const ht=await(await fetch(Or)).blob(),at=URL.createObjectURL(ht),Et=document.createElement("a");Et.href=at,Et.download="posts_image.jpg",document.body.appendChild(Et),Et.click(),document.body.removeChild(Et),URL.revokeObjectURL(at),he.success("Download started!")}catch{window.open(Or,"_blank"),he.success("Opened photo page! Tap and hold to download.")}},className:"px-4 py-2 bg-white/10 hover:bg-white text-white hover:text-black rounded-xl text-[10px] font-black uppercase tracking-widest flex items-center gap-1.5 transition-all cursor-pointer",title:"Download image asset",children:[s.jsx(eE,{size:12,strokeWidth:2.5}),s.jsx("span",{children:"Download"})]}),s.jsx("button",{onClick:()=>_t(null),className:"w-10 h-10 rounded-full bg-white/10 hover:bg-red-650 text-white flex items-center justify-center transition-all cursor-pointer",title:"Dismiss image viewer",children:s.jsx(Jr,{size:20,strokeWidth:2.5})})]}),s.jsx(Qt.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},className:"max-w-4xl max-h-[85vh] w-full flex items-center justify-center overflow-hidden",children:s.jsx("img",{src:Or,className:"max-w-full max-h-[80vh] object-contain rounded-2xl shadow-2xl border border-white/15 select-all",alt:"Enlarged campus attachment",referrerPolicy:"no-referrer"})}),s.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-widest mt-4 font-bold",children:"Tip: Long-touch or right-click picture to download directly"})]})}),s.jsx(on,{children:z&&s.jsx("div",{className:"fixed inset-0 bg-zinc-950/80 backdrop-blur-sm flex items-center justify-center p-4 z-[9900] select-none text-left animate-fade-in",children:s.jsxs(Qt.div,{initial:{scale:.95,opacity:0,y:15},animate:{scale:1,opacity:1,y:0},exit:{scale:.95,opacity:0,y:15},transition:{type:"spring",duration:.5},className:"bg-white rounded-[2.5rem] p-6 md:p-8 w-full max-w-2xl shadow-2xl relative overflow-hidden border border-gray-100 flex flex-col max-h-[90vh]",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4 shrink-0 pb-3 border-b border-gray-100 relative z-20",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-2 bg-red-100 text-red-650 rounded-xl",children:s.jsx(Xi,{size:16})}),s.jsxs("div",{children:[s.jsx("span",{className:"text-red-650 font-black text-[9px] uppercase tracking-widest block font-mono",children:"Spotlight Dispatch"}),s.jsx("h3",{className:"text-md font-serif font-black text-gray-950 uppercase tracking-tight",children:"Direct Shared Lounge Post"})]})]}),s.jsx("button",{onClick:()=>{F(null);const De=new URL(window.location.href);De.searchParams.delete("postId"),De.searchParams.delete("post"),window.history.replaceState({},"",De.toString())},className:"p-2.5 bg-gray-50 hover:bg-red-50 text-gray-900 hover:text-red-650 rounded-full transition-all cursor-pointer border border-transparent hover:border-red-100 flex items-center justify-center",title:"Close spotlight focus and browse full feed",children:s.jsx(Jr,{size:16,strokeWidth:2.5})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto space-y-4 pr-1 select-text relative z-10",children:Q?s.jsxs("div",{className:"py-16 flex flex-col items-center justify-center space-y-2",children:[s.jsx(vn,{className:"w-8 h-8 text-red-650 animate-spin"}),s.jsx("span",{className:"text-[10px] font-black uppercase text-gray-400 tracking-widest",children:"Retrieving shared post details..."})]}):$?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{onClick:()=>{t==null||t($.authorId),F(null)},className:"flex items-center gap-2.5 cursor-pointer hover:opacity-85 transition-opacity duration-150",title:"Click to view peer credentials",children:[s.jsx("img",{src:$.authorId==="mega-ai-bot"||(At=$.authorName)!=null&&At.toLowerCase().includes("mega ai")?Uo:$.authorPhotoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent($.authorName)}&background=random`,className:"w-8 h-8 rounded-full border border-gray-100 object-cover shrink-0",alt:""}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1 leading-none",children:[s.jsx("span",{className:"text-[11px] font-black uppercase tracking-tight text-gray-950",children:$.authorName}),s.jsxs("span",{className:"text-[8.5px] text-gray-400 font-bold",children:["@",$.authorName.toLowerCase().replace(/\s+/g,"")]})]}),s.jsx("span",{className:"text-[8px] font-black uppercase tracking-wider text-gray-400 mt-0.5 block",children:(ha=$.createdAt)!=null&&ha.toDate?new Date($.createdAt.toDate().getTime()).toLocaleDateString():"Recently"})]})]}),Oe&&Oe.uid!==$.authorId&&s.jsxs("div",{className:"flex items-center gap-1",children:[mr.has($.authorId)&&s.jsxs("button",{onClick:De=>{De.stopPropagation(),window.dispatchEvent(new CustomEvent("open-imessage-friend",{detail:{uid:$.authorId,displayName:$.authorName,username:$.authorName.toLowerCase().replace(/\s+/g,""),photoURL:$.authorPhotoURL||""}}))},className:"p-1 px-2.5 bg-[#007AFF] hover:bg-blue-600 text-white rounded-full transition-all cursor-pointer flex items-center gap-1 text-[8.5px] font-black uppercase tracking-wider shrink-0 shadow-2xs",title:`Open iMessage chat with connected friend ${$.authorName}`,children:[s.jsx(Xs,{size:11,strokeWidth:2.5}),s.jsx("span",{children:"iMessage"})]}),s.jsx("button",{onClick:()=>Xn($.authorId,$.authorName),className:`text-[8px] font-black uppercase tracking-widest h-6 px-2 rounded-full flex items-center gap-0.5 cursor-pointer transition-colors ${a[$.authorId]?"bg-gray-100 text-gray-650 border border-gray-200 hover:bg-red-50 hover:text-red-500":"bg-red-50 text-red-650 border border-red-150/50 hover:bg-red-100"}`,children:a[$.authorId]?s.jsxs(s.Fragment,{children:[s.jsx(iy,{size:9}),s.jsx("span",{children:"Following"})]}):s.jsxs(s.Fragment,{children:[s.jsx(bp,{size:9}),s.jsx("span",{children:"Follow"})]})})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-sm text-gray-800 leading-relaxed whitespace-pre-wrap select-text",children:b1($.content)}),$.imageUrl&&s.jsxs("div",{onClick:()=>_t($.imageUrl),className:"relative aspect-video max-h-72 w-full rounded-2xl border border-gray-100 overflow-hidden cursor-pointer group bg-gray-50",children:[s.jsx(Bi,{src:$.imageUrl,className:"w-full h-full object-contain mx-auto group-hover:opacity-95 duration-200",alt:""}),s.jsx("div",{className:"absolute inset-0 bg-black/10 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(n2,{className:"text-white drop-shadow-sm w-5 h-5"})})]})]}),s.jsxs("div",{className:"flex items-center justify-between border-y border-gray-100 py-3 mt-4 text-[10px] font-black uppercase tracking-wider font-mono shrink-0",children:[s.jsx("div",{className:"flex gap-4",children:s.jsxs("button",{onClick:()=>Js($.id,$.likedBy),className:`flex items-center gap-1.5 cursor-pointer ${(Un=$.likedBy)!=null&&Un.includes((Oe==null?void 0:Oe.uid)||"")?"text-red-650 font-black":"text-gray-450 hover:text-gray-950"}`,children:[s.jsx(Fl,{size:14,className:(ts=$.likedBy)!=null&&ts.includes((Oe==null?void 0:Oe.uid)||"")?"fill-current":""}),s.jsxs("span",{children:[$.likeCount||0," Likes"]})]})}),s.jsxs("button",{onClick:()=>bi($.id,$.content,$.imageUrl),className:"flex items-center gap-1.5 text-gray-450 hover:text-gray-950 transition-colors cursor-pointer",children:[s.jsx(Ld,{size:13}),s.jsx("span",{children:"Share with Image"})]})]}),s.jsxs("div",{className:"space-y-4 pt-2",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black uppercase tracking-widest text-gray-400 font-mono",children:[s.jsx(Ri,{size:13}),s.jsxs("span",{children:["Discussions (",((Wa=Xe[$.id])==null?void 0:Wa.length)||$.commentCount||0,")"]})]})}),s.jsx("div",{className:"space-y-3 max-h-[25vh] overflow-y-auto pr-1",children:!Xe[$.id]||Xe[$.id].length===0?s.jsx("div",{className:"py-4 text-center bg-gray-50/50 rounded-xl border border-dashed border-gray-100",children:s.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider text-gray-400 font-mono",children:"No feedback published yet"})}):Xe[$.id].map(De=>{var ht,at;return s.jsxs("div",{className:"p-3 bg-gray-50/60 rounded-2xl border border-gray-100 flex items-start gap-2.5 transition-all",children:[s.jsx("img",{src:De.authorId==="mega-ai-bot"||(ht=De.authorName)!=null&&ht.toLowerCase().includes("mega ai")?Uo:De.authorPhotoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(De.authorName)}&background=random`,className:"w-6 h-6 rounded-full border border-gray-100 object-cover shrink-0 mt-0.5",alt:""}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[9.5px] font-black uppercase tracking-tight text-gray-950",children:De.authorName}),s.jsx("span",{className:"text-[7.5px] font-bold text-gray-400 font-mono",children:(at=De.createdAt)!=null&&at.toDate?new Date(De.createdAt.toDate().getTime()).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"Recently"})]}),s.jsx("p",{className:"text-[10.5px] text-gray-800 leading-relaxed font-sans mt-0.5 select-text",children:De.content})]})]},De.id)})}),Oe?s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",placeholder:"Add your perspective...",value:Ot[$.id]||"",onChange:De=>or(ht=>({...ht,[$.id]:De.target.value})),onKeyDown:De=>{De.key==="Enter"&&ji($.id)},className:"flex-1 px-4 py-2.5 bg-gray-50 border border-gray-250 focus:border-red-650 rounded-xl text-xs font-bold outline-none transition-all placeholder:text-gray-400"}),s.jsx("button",{onClick:()=>ji($.id),disabled:en[$.id],className:"p-2.5 bg-zinc-950 hover:bg-red-650 disabled:bg-gray-200 text-white rounded-xl transition-all flex items-center justify-center cursor-pointer active:scale-95 duration-100",children:en[$.id]?s.jsx(vn,{className:"w-4 h-4 animate-spin text-white"}):s.jsx(Eo,{size:14})})]}):s.jsx("div",{className:"p-3 bg-red-50/40 border border-red-100/40 rounded-xl text-center",children:s.jsx("span",{className:"text-[9px] font-black uppercase text-red-650 tracking-wider font-mono",children:"Authenticate to contribute opinions"})})]})]}):s.jsxs("div",{className:"py-16 text-center",children:[s.jsx(Su,{className:"w-10 h-10 text-amber-500 mx-auto mb-2"}),s.jsx("p",{className:"text-xs font-black uppercase text-gray-950 tracking-wider",children:"Lounge post not found or removed"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"This shared dispatch may have been deleted or flagged by administrators."})]})}),s.jsx("div",{className:"pt-4 border-t border-gray-100 shrink-0 mt-3 relative z-25",children:s.jsxs("button",{type:"button",onClick:()=>{F(null);const De=new URL(window.location.href);De.searchParams.delete("postId"),De.searchParams.delete("post"),window.history.replaceState({},"",De.toString())},className:"w-full py-3 bg-zinc-950 hover:bg-red-650 text-white rounded-2xl text-[10px] font-black uppercase tracking-widest transition-colors duration-200 cursor-pointer shadow-sm hover:shadow-md flex items-center justify-center gap-1.5",children:[s.jsx(ko,{size:12,strokeWidth:2.5}),s.jsx("span",{children:"Dismiss Focus & Browse Lounge Feed"})]})})]})})}),s.jsx(on,{children:ct&&s.jsxs("div",{className:"fixed inset-0 z-[9950] flex items-end md:items-center justify-center p-0 md:p-4 animate-fade-in",children:[s.jsx("div",{className:"fixed inset-0 bg-zinc-950/75 backdrop-blur-md transition-opacity duration-300",onClick:()=>{yr(null),Lr(De=>({...De,[ct]:null}))}}),s.jsxs(Qt.div,{initial:{y:"100%",opacity:0},animate:{y:0,opacity:1},exit:{y:"100%",opacity:0},transition:{type:"spring",damping:25,stiffness:280},className:"relative z-10 bg-white rounded-t-[2.5rem] md:rounded-[2.5rem] w-full max-w-xl max-h-[85vh] flex flex-col shadow-2xl border border-gray-150 overflow-hidden",children:[s.jsxs("div",{className:"p-4 md:p-5 border-b border-gray-100 flex items-center justify-between bg-gray-50/50",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-2 bg-red-100 text-red-650 rounded-xl",children:s.jsx(Ri,{size:16})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xs font-black uppercase tracking-wider text-gray-950 font-mono",children:"Lounge Discussion Thread"}),s.jsxs("p",{className:"text-[9px] text-gray-400 font-sans",children:[((En=Xe[ct])==null?void 0:En.length)||0," peer responses • Threaded conversations"]})]})]}),s.jsx("button",{onClick:()=>{yr(null),Lr(De=>({...De,[ct]:null}))},className:"w-8 h-8 rounded-full bg-gray-100 hover:bg-red-50 text-gray-600 hover:text-red-650 flex items-center justify-center transition-colors cursor-pointer",children:s.jsx(Jr,{size:16})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-5 space-y-4",children:!Xe[ct]||Xe[ct].length===0?s.jsxs("div",{className:"py-12 text-center bg-gray-50/50 rounded-2xl border border-dashed border-gray-200",children:[s.jsx(Ri,{className:"w-8 h-8 text-gray-300 mx-auto mb-2 animate-bounce"}),s.jsx("p",{className:"text-xs font-black uppercase text-gray-500 tracking-wider font-mono",children:"No responses yet"}),s.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"Be the first to share your thoughts and start a discussion thread!"})]}):(()=>{const De=Xe[ct]||[];return De.filter(at=>!at.parentId).map(at=>{var rr,Nr,ze;const Et=De.filter(Bt=>Bt.parentId===at.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{id:`comment-${at.id}`,className:"p-3 bg-gray-50/80 rounded-2xl border border-gray-150 relative group transition-all",children:s.jsxs("div",{className:"flex items-start gap-2.5",children:[s.jsx("img",{src:at.authorId==="mega-ai-bot"||at.userId==="mega-ai-bot"||(rr=at.authorName)!=null&&rr.toLowerCase().includes("mega ai")?Uo:at.authorPhotoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(at.authorName)}&background=random`,className:"w-7 h-7 rounded-full border border-gray-100 object-cover mt-0.5 shrink-0",alt:""}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-[10px] font-black uppercase tracking-tight text-gray-950",children:at.authorName}),s.jsx(So,{size:11,className:"shrink-0"}),(at.isAIGenerated||at.isAiGenerated||at.authorId==="mega-ai-bot"||at.userId==="mega-ai-bot"||((Nr=at.authorName)==null?void 0:Nr.toLowerCase().includes("mega ai")))&&s.jsx(Bw,{})]}),s.jsx("span",{className:"text-[8px] font-bold text-gray-400 font-mono",children:(ze=at.createdAt)!=null&&ze.toDate?new Date(at.createdAt.toDate().getTime()).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"Just now"})]}),s.jsx("p",{className:"text-[11px] text-gray-800 leading-relaxed font-sans mt-1",children:b1(at.content,Gt)}),at.stickerEmoji&&s.jsx("div",{className:"my-1.5 p-1 bg-amber-50 rounded-xl inline-block border border-amber-200",children:s.jsx("span",{className:"text-2xl",children:at.stickerEmoji})}),at.imageUrl&&s.jsx("div",{className:"my-1.5 rounded-xl overflow-hidden border border-gray-200 max-h-40 bg-gray-50",children:s.jsx("img",{src:at.imageUrl,className:"w-full h-full object-cover",alt:"Attachment"})}),at.audioUrl&&s.jsx("div",{className:"my-1.5 p-1 bg-gray-100 rounded-xl",children:s.jsx("audio",{controls:!0,src:at.audioUrl,className:"w-full h-8"})}),s.jsxs("div",{className:"flex items-center gap-4 mt-2 pt-1 border-t border-gray-100/60",children:[s.jsxs("button",{onClick:()=>cs(ct,at.id),className:`flex items-center gap-1 text-[9px] font-black uppercase tracking-wider font-mono cursor-pointer transition-colors ${ir[at.id]||at.likedBy&&Oe&&at.likedBy.includes(Oe.uid)?"text-red-650":"text-gray-400 hover:text-red-650"}`,children:[s.jsx(Fl,{size:12,fill:ir[at.id]||at.likedBy&&Oe&&at.likedBy.includes(Oe.uid)?"currentColor":"none"}),s.jsx("span",{children:at.likeCount||0})]}),s.jsxs("button",{onClick:()=>Lr(Bt=>({...Bt,[ct]:{commentId:at.id,authorName:at.authorName}})),className:"flex items-center gap-1 text-[9px] font-black uppercase tracking-wider font-mono text-gray-400 hover:text-red-650 cursor-pointer transition-colors",children:[s.jsx(Eo,{size:10,className:"rotate-45"}),s.jsx("span",{children:"Reply"})]})]})]})]})}),Et.length>0&&s.jsx("div",{className:"border-l-2 border-red-500/30 pl-3 ml-4 space-y-2 pt-1",children:Et.map(Bt=>{var Er,jr,_r;return s.jsxs("div",{id:`comment-${Bt.id}`,className:"p-2.5 bg-red-50/30 rounded-xl border border-red-100/50 flex items-start gap-2 transition-all",children:[s.jsx("img",{src:Bt.authorId==="mega-ai-bot"||Bt.userId==="mega-ai-bot"||(Er=Bt.authorName)!=null&&Er.toLowerCase().includes("mega ai")?Uo:Bt.authorPhotoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(Bt.authorName)}&background=random`,className:"w-5 h-5 rounded-full border border-gray-100 object-cover mt-0.5 shrink-0",alt:""}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[s.jsx("span",{className:"text-[9px] font-black uppercase tracking-tight text-gray-950",children:Bt.authorName}),s.jsx(So,{size:10,className:"shrink-0"}),(Bt.isAIGenerated||Bt.isAiGenerated||Bt.authorId==="mega-ai-bot"||Bt.userId==="mega-ai-bot"||((jr=Bt.authorName)==null?void 0:jr.toLowerCase().includes("mega ai")))&&s.jsx(Bw,{}),Bt.replyToAuthor&&s.jsxs("span",{className:"text-[8px] font-mono text-red-650 font-bold",children:["replying to @",Bt.replyToAuthor]})]}),s.jsx("span",{className:"text-[7.5px] font-bold text-gray-400 font-mono",children:(_r=Bt.createdAt)!=null&&_r.toDate?new Date(Bt.createdAt.toDate().getTime()).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"Just now"})]}),s.jsx("div",{className:"text-[10px] text-gray-800 font-sans leading-relaxed mt-0.5",children:b1(Bt.content,Gt)}),s.jsxs("div",{className:"flex items-center gap-3 mt-1.5 pt-1 border-t border-red-100/30",children:[s.jsxs("button",{onClick:()=>cs(ct,Bt.id),className:`flex items-center gap-1 text-[8.5px] font-black uppercase tracking-wider font-mono cursor-pointer transition-colors ${ir[Bt.id]||Bt.likedBy&&Oe&&Bt.likedBy.includes(Oe.uid)?"text-red-650":"text-gray-400 hover:text-red-650"}`,children:[s.jsx(Fl,{size:11,fill:ir[Bt.id]||Bt.likedBy&&Oe&&Bt.likedBy.includes(Oe.uid)?"currentColor":"none"}),s.jsx("span",{children:Bt.likeCount||0})]}),s.jsx("button",{onClick:()=>Lr(_n=>({..._n,[ct]:{commentId:at.id,authorName:Bt.authorName}})),className:"text-[8.5px] font-black uppercase tracking-wider font-mono text-gray-400 hover:text-red-650 cursor-pointer transition-colors",children:"Reply"})]})]})]},Bt.id)})})]},at.id)})})()}),s.jsxs("div",{className:"p-3 md:p-4 border-t border-gray-150 bg-gray-50/80",children:[Lt[ct]&&s.jsxs("div",{className:"flex items-center justify-between bg-red-100/80 px-3 py-1 rounded-lg mb-2 text-[9px] font-mono text-red-700",children:[s.jsxs("span",{className:"font-bold",children:["Replying to @",(jn=Lt[ct])==null?void 0:jn.authorName]}),s.jsx("button",{onClick:()=>Lr(De=>({...De,[ct]:null})),className:"hover:text-red-900 font-black cursor-pointer",children:"✕"})]}),Oe?s.jsxs("div",{className:"space-y-2",children:[fr[ct]&&s.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-amber-50/80 border border-amber-200 rounded-xl overflow-x-auto",children:[s.jsx("span",{className:"text-[9px] font-black uppercase text-amber-800 font-mono shrink-0 mr-1",children:"Stickers:"}),["🔥","🎓","👏","💯","📌","❤️","🚀","💡","💎","🎉","🌟","🏆","📢"].map(De=>s.jsx("button",{type:"button",onClick:()=>{dr(ht=>({...ht,[ct]:De})),hn(ht=>({...ht,[ct]:!1})),he.success(`Sticker ${De} selected!`,{id:"stk-selected"})},className:"text-lg hover:scale-125 transition-transform p-1 cursor-pointer shrink-0",children:De},De))]}),Wr[ct]&&s.jsxs("div",{className:"flex items-center gap-2 bg-amber-100 px-2.5 py-1 rounded-lg text-xs font-bold text-amber-900 w-fit",children:[s.jsxs("span",{children:["Active Sticker: ",Wr[ct]]}),s.jsx("button",{type:"button",onClick:()=>dr(De=>({...De,[ct]:""})),className:"hover:text-red-700 font-black cursor-pointer text-xs",children:"✕"})]}),s.jsx(sY,{value:Ot[ct]||"",onSelectMention:De=>or(ht=>({...ht,[ct]:De}))}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx("button",{type:"button",onClick:()=>hn(De=>({...De,[ct]:!De[ct]})),className:"p-2 bg-amber-100 text-amber-800 hover:bg-amber-200 rounded-xl transition-colors cursor-pointer shrink-0",title:"Attach Sticker",children:s.jsx(pF,{size:16})}),s.jsx("input",{type:"text",value:Ot[ct]||"",onChange:De=>or(ht=>({...ht,[ct]:De.target.value})),onKeyDown:De=>{De.key==="Enter"&&ji(ct)},placeholder:Lt[ct]?`Write reply to @${(an=Lt[ct])==null?void 0:an.authorName}...`:"Write a statement, reply, or attach sticker...",className:"flex-1 px-3.5 py-2.5 bg-white border border-gray-250 focus:border-red-650 rounded-xl text-xs font-medium outline-none transition-all placeholder:text-gray-400 shadow-inner"}),s.jsx("button",{onClick:()=>ji(ct),disabled:en[ct]||!(Ot[ct]||"").trim()&&!Wr[ct],className:"p-2.5 bg-zinc-950 hover:bg-red-650 disabled:bg-gray-200 text-white rounded-xl transition-all flex items-center justify-center cursor-pointer active:scale-95 shrink-0",children:en[ct]?s.jsx(vn,{className:"w-4 h-4 animate-spin text-white"}):s.jsx(Eo,{size:14})})]})]}):s.jsx("div",{className:"p-2.5 bg-gray-100 rounded-xl text-center",children:s.jsx("span",{className:"text-[9px] font-black uppercase tracking-wider text-gray-500 font-mono",children:"Sign in with Google to post replies"})})]})]})]})}),s.jsx(VMe,{isOpen:St,url:Dt,onClose:()=>{Ct(!1),cr(null)}})]})},qMe={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"},{urls:"stun:stun2.l.google.com:19302"}]},Lee=({isOpen:e,onClose:t,peer:r,callType:n,isIncoming:i=!1,existingCallId:a})=>{const o=Ne.currentUser,[c,h]=I.useState("calling"),[f,m]=I.useState(!1),[y,w]=I.useState(n==="audio"),[A,S]=I.useState(0),[j,T]=I.useState(a||null),D=I.useRef(null),V=I.useRef(null),U=I.useRef(null),G=I.useRef(null),X=I.useRef(null),q=I.useRef(null);I.useRef(null),I.useEffect(()=>!e||!o?void 0:((async()=>{try{const K={audio:!0,video:n==="video"?{width:{ideal:1280},height:{ideal:720},facingMode:"user"}:!1},me=await navigator.mediaDevices.getUserMedia(K);G.current=me,D.current&&n==="video"&&(D.current.srcObject=me);const re=new RTCPeerConnection(qMe);if(X.current=re,me.getTracks().forEach(le=>{re.addTrack(le,me)}),re.ontrack=le=>{le.streams&&le.streams[0]&&(V.current&&n==="video"?V.current.srcObject=le.streams[0]:U.current&&(U.current.srcObject=le.streams[0]))},i&&a){h("connected");const le=st(fe,"calls",a),ve=await as(le);if(ve.exists()){const Ve=ve.data();if(Ve.offer){await re.setRemoteDescription(new RTCSessionDescription(Ve.offer));const Z=await re.createAnswer();await re.setLocalDescription(Z),await Ir(le,{answer:{type:Z.type,sdp:Z.sdp},status:"connected"})}}const je=nt(fe,"calls",a,"callerCandidates");ei(je,Ve=>{Ve.docChanges().forEach(async Z=>{if(Z.type==="added"){const se=new RTCIceCandidate(Z.doc.data());await re.addIceCandidate(se)}})}),re.onicecandidate=Ve=>{if(Ve.candidate){const Z=nt(fe,"calls",a,"calleeCandidates");dn(Z,Ve.candidate.toJSON())}}}else{const le=st(nt(fe,"calls"));T(le.id);const ve=nt(fe,"calls",le.id,"callerCandidates");re.onicecandidate=Z=>{Z.candidate&&dn(ve,Z.candidate.toJSON())};const je=await re.createOffer();await re.setLocalDescription(je),await Gn(le,{callerId:o.uid,callerName:o.displayName||"Campus Peer",callerPhoto:o.photoURL||"",receiverId:r.uid,receiverName:r.displayName,receiverPhoto:r.photoURL||"",type:n,status:"ringing",offer:{type:je.type,sdp:je.sdp},createdAt:new Date}),await dn(nt(fe,"notifications"),{userId:r.uid,senderId:o.uid,senderName:o.displayName||"Campus Peer",senderUsername:(o.displayName||"peer").toLowerCase().replace(/\s+/g,""),senderPhotoURL:o.photoURL||"",title:`📞 Incoming ${n==="video"?"FaceTime Video":"Audio"} Call from ${o.displayName}`,message:`Tap to accept ${n} call now!`,type:"incoming_call",callId:le.id,callType:n,used:!1,createdAt:new Date}),h("ringing"),ei(le,async Z=>{if(!Z.exists())return;const se=Z.data();if(se.status==="rejected"||se.status==="ended")B(),h("ended"),nn.error("Call ended by user"),setTimeout(()=>t(),1200);else if(se.answer&&!re.currentRemoteDescription){const xe=new RTCSessionDescription(se.answer);await re.setRemoteDescription(xe),h("connected")}});const Ve=nt(fe,"calls",le.id,"calleeCandidates");ei(Ve,Z=>{Z.docChanges().forEach(async se=>{if(se.type==="added"){const xe=new RTCIceCandidate(se.doc.data());await re.addIceCandidate(xe)}})})}}catch(K){console.error("Call media error:",K),nn.error("Could not access microphone/camera: "+(K.message||"Permission denied")),B(),t()}})(),()=>{B()}),[e]),I.useEffect(()=>(c==="connected"?q.current=setInterval(()=>{S(Q=>Q+1)},1e3):q.current&&clearInterval(q.current),()=>{q.current&&clearInterval(q.current)}),[c]);const B=()=>{G.current&&(G.current.getTracks().forEach(Q=>Q.stop()),G.current=null),X.current&&(X.current.close(),X.current=null),q.current&&clearInterval(q.current)},z=async()=>{if(h("ended"),j)try{await Ir(st(fe,"calls",j),{status:"ended"})}catch{}B(),nn.success("Call ended",{icon:"📵"}),t()},F=()=>{if(G.current){const Q=G.current.getAudioTracks()[0];Q&&(Q.enabled=!Q.enabled,m(!Q.enabled))}},$=()=>{if(G.current){const Q=G.current.getVideoTracks()[0];Q&&(Q.enabled=!Q.enabled,w(!Q.enabled))}},J=Q=>{const K=Math.floor(Q/60),me=Q%60;return`${K}:${me<10?"0":""}${me}`};return e?s.jsx(on,{children:s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-2 sm:p-4 bg-black/85 backdrop-blur-md",children:s.jsxs(Qt.div,{initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},className:"bg-neutral-900 border border-neutral-800 rounded-3xl shadow-2xl w-full max-w-md h-[80vh] max-h-[620px] flex flex-col justify-between overflow-hidden relative text-white",children:[s.jsxs("div",{className:"p-4 flex items-center justify-between border-b border-white/10 bg-black/40 backdrop-blur-md z-20",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-500 animate-pulse"}),s.jsx("span",{className:"text-xs font-black uppercase tracking-wider text-neutral-300",children:n==="video"?"FaceTime HD Video":"HD Voice Call"})]}),c==="connected"&&s.jsx("span",{className:"text-xs font-mono font-bold bg-white/10 px-2.5 py-0.5 rounded-full text-emerald-400 border border-emerald-500/30",children:J(A)})]}),s.jsxs("div",{className:"flex-1 relative flex flex-col items-center justify-center p-6 text-center overflow-hidden",children:[n==="video"&&s.jsxs("div",{className:"absolute inset-0 bg-black z-0",children:[s.jsx("video",{ref:V,autoPlay:!0,playsInline:!0,className:"w-full h-full object-cover"}),s.jsxs("div",{className:"absolute top-4 right-4 w-28 h-40 bg-neutral-800 rounded-2xl overflow-hidden border-2 border-white/20 shadow-xl z-20",children:[s.jsx("video",{ref:D,autoPlay:!0,playsInline:!0,muted:!0,className:"w-full h-full object-cover"}),y&&s.jsx("div",{className:"absolute inset-0 bg-neutral-900 flex items-center justify-center text-xs text-neutral-500 font-bold",children:"Camera Off"})]})]}),s.jsx("audio",{ref:U,autoPlay:!0}),s.jsxs("div",{className:"relative z-10 flex flex-col items-center",children:[s.jsxs("div",{className:"relative mb-4",children:[s.jsx("div",{className:"w-24 h-24 sm:w-28 sm:h-28 rounded-full overflow-hidden border-4 border-white/20 shadow-2xl relative",children:s.jsx("img",{src:r.photoURL||`https://api.dicebear.com/7.x/bottts/svg?seed=${r.username}`,alt:"",className:"w-full h-full object-cover"})}),c==="ringing"&&s.jsx("span",{className:"absolute -inset-2 rounded-full border-2 border-emerald-500 animate-ping opacity-75"})]}),s.jsx("h2",{className:"text-xl font-black text-white tracking-tight",children:r.displayName}),s.jsxs("p",{className:"text-xs text-neutral-400 font-bold mt-1 uppercase tracking-wider",children:["@",r.username]}),s.jsxs("div",{className:"mt-4 px-3 py-1 bg-white/10 rounded-full text-xs font-semibold tracking-wide text-neutral-200 border border-white/10 backdrop-blur-sm",children:[c==="calling"&&"Connecting...",c==="ringing"&&"Ringing Peer...",c==="connected"&&"Connected • Secure HD Voice",c==="ended"&&"Call Terminated"]}),n==="audio"&&c==="connected"&&s.jsx("div",{className:"flex items-center gap-1 mt-6",children:[40,70,30,90,50,80,40,60].map((Q,K)=>s.jsx(Qt.span,{animate:{height:[10,Q,10]},transition:{repeat:1/0,duration:.8,delay:K*.1},className:"w-1 bg-[#007AFF] rounded-full"},K))})]})]}),s.jsxs("div",{className:"p-6 bg-black/60 backdrop-blur-xl border-t border-white/10 flex items-center justify-around z-20",children:[s.jsx("button",{onClick:F,className:`p-4 rounded-full transition-all cursor-pointer ${f?"bg-red-500/80 text-white shadow-lg":"bg-white/15 hover:bg-white/25 text-white"}`,title:f?"Unmute":"Mute",children:f?s.jsx(Wne,{size:22}):s.jsx(Yne,{size:22})}),s.jsx("button",{onClick:z,className:"p-5 bg-red-600 hover:bg-red-700 text-white rounded-full transition-all cursor-pointer shadow-xl scale-110 active:scale-95",title:"End Call",children:s.jsx(dF,{size:26})}),n==="video"&&s.jsx("button",{onClick:$,className:`p-4 rounded-full transition-all cursor-pointer ${y?"bg-red-500/80 text-white shadow-lg":"bg-white/15 hover:bg-white/25 text-white"}`,title:y?"Turn Camera On":"Turn Camera Off",children:y?s.jsx(Hie,{size:22}):s.jsx(Na,{size:22})})]})]})})}):null},WMe=["❤️","👍","👎","😂","‼️","❓"],KMe=["🔥","🚀","🎉","💯","😴","🧠","👑","🥳","🍕","🎯","⚡️","🌟","🤩","💬","💩","🤡","🦄","🌈","🏆","💎","🙏","🤝"],Uee=({isOpen:e,onClose:t,friend:r,currentUserId:n,currentUserProfile:i})=>{const[a,o]=I.useState([]),[c,h]=I.useState(""),[f,m]=I.useState(!1),[y,w]=I.useState(null),[A,S]=I.useState(!1),[j,T]=I.useState(null),[D,V]=I.useState(null),[U,G]=I.useState(""),[X,q]=I.useState(null),[B,z]=I.useState(!0),[F,$]=I.useState(null),J=I.useRef(null),Q=I.useRef(null),K=I.useRef(null),me=r?[n,r.uid].sort().join("_"):"",re=()=>{var se;(se=J.current)==null||se.scrollIntoView({behavior:"smooth"})};if(I.useEffect(()=>{a.length>0&&re()},[a]),I.useEffect(()=>{if(!e||!r||!me){o([]);return}z(!0);const se=Jt(nt(fe,"direct_messages"),An("conversationId","==",me)),xe=ei(se,ae=>{const qe=ae.docs.map(pt=>({id:pt.id,...pt.data()}));qe.sort((pt,Fe)=>{var Ae,Ie;const jt=(Ae=pt.createdAt)!=null&&Ae.seconds?pt.createdAt.seconds*1e3:pt.createdAt?new Date(pt.createdAt).getTime():0,Pt=(Ie=Fe.createdAt)!=null&&Ie.seconds?Fe.createdAt.seconds*1e3:Fe.createdAt?new Date(Fe.createdAt).getTime():0;return jt-Pt}),o(qe),z(!1)},ae=>{console.warn("Realtime message listener fallback:",ae),z(!1)});return()=>xe()},[e,r==null?void 0:r.uid,me]),!e||!r)return null;const le=async se=>{var pt,Fe;if(se&&se.preventDefault(),!c.trim()&&!y||f||!n)return;m(!0);const xe=c.trim(),ae=y,qe=X;h(""),w(null),q(null);try{const jt=(i==null?void 0:i.displayName)||((pt=Ne.currentUser)==null?void 0:pt.displayName)||"Campus Friend",Pt=(i==null?void 0:i.username)||"peer";await dn(nt(fe,"direct_messages"),{conversationId:me,senderId:n,receiverId:r.uid,participants:[n,r.uid],text:xe,imageUrl:ae||"",replyToText:qe?qe.text||"Image":"",createdAt:new Date}),await dn(nt(fe,"notifications"),{userId:r.uid,senderId:n,senderName:jt,senderUsername:Pt,senderPhotoURL:(i==null?void 0:i.photoURL)||((Fe=Ne.currentUser)==null?void 0:Fe.photoURL)||"",title:`💬 Direct Message from ${jt}`,message:xe||"Sent an image attachment 📷",type:"direct_message",canReply:!0,used:!1,createdAt:new Date})}catch(jt){nn.error("Failed to send message: "+jt.message)}finally{m(!1)}},ve=async(se,xe)=>{try{const ae=a.find(pt=>pt.id===se),qe=(ae==null?void 0:ae.reaction)===xe?"":xe;await Ir(st(fe,"direct_messages",se),{reaction:qe}),T(null),V(null)}catch(ae){nn.error("Failed to update reaction: "+ae.message)}},je=se=>{var xe;q(se),nn.success("Swiped to reply!",{icon:"↩️"}),(xe=K.current)==null||xe.focus()},Ve=se=>{var qe;const xe=(qe=se.target.files)==null?void 0:qe[0];if(!xe)return;if(xe.size>5*1024*1024){nn.error("Image must be under 5MB");return}S(!0);const ae=new FileReader;ae.onload=()=>{w(ae.result),S(!1)},ae.onerror=()=>{nn.error("Failed to load image"),S(!1)},ae.readAsDataURL(xe)},Z=se=>{if(!se)return"Just now";let xe;return se.seconds?xe=new Date(se.seconds*1e3):xe=new Date(se),isNaN(xe.getTime())?"Just now":xe.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})};return s.jsxs(on,{children:[s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-2 sm:p-4 bg-black/65 backdrop-blur-sm",children:s.jsxs(Qt.div,{initial:{opacity:0,scale:.94,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.94,y:12},transition:{type:"spring",damping:25,stiffness:300},className:"bg-white border border-gray-200/80 rounded-3xl shadow-2xl w-full max-w-lg h-[88vh] max-h-[700px] flex flex-col overflow-hidden relative font-sans",children:[s.jsxs("div",{className:"bg-white/90 backdrop-blur-md border-b border-gray-200/80 px-4 py-3 flex items-center justify-between shrink-0 z-10 shadow-2xs",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("img",{src:r.photoURL||`https://api.dicebear.com/7.x/bottts/svg?seed=${r.username}`,alt:"",className:"w-10 h-10 rounded-full object-cover border border-gray-200 shadow-xs",referrerPolicy:"no-referrer"}),s.jsx("span",{className:"absolute bottom-0 right-0 w-3 h-3 bg-emerald-500 border-2 border-white rounded-full shadow-2xs"})]}),s.jsxs("div",{className:"min-w-0 text-left",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("h3",{className:"text-sm font-extrabold text-gray-950 truncate tracking-tight",children:r.displayName}),s.jsx("span",{className:"px-1.5 py-0.2 bg-blue-50 text-[#007AFF] border border-blue-200/60 text-[8px] font-black uppercase rounded-full tracking-wider shrink-0",children:"iMessage"})]}),s.jsxs("p",{className:"text-[10px] text-gray-400 font-semibold truncate leading-tight",children:["@",r.username.toLowerCase()," • ",s.jsx("span",{className:"text-emerald-600 font-bold",children:"Connected Friend"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.jsx("button",{onClick:()=>$("audio"),className:"p-2 text-gray-500 hover:text-[#007AFF] hover:bg-blue-50 rounded-full transition-all cursor-pointer",title:"Start Audio Call",children:s.jsx(zS,{size:17})}),s.jsx("button",{onClick:()=>$("video"),className:"p-2 text-gray-500 hover:text-[#007AFF] hover:bg-blue-50 rounded-full transition-all cursor-pointer",title:"Start FaceTime Video",children:s.jsx(Na,{size:17})}),s.jsx("button",{onClick:t,className:"p-2 text-gray-400 hover:text-black hover:bg-gray-100 rounded-full transition-all cursor-pointer ml-1",title:"Close Chat",children:s.jsx(Jr,{size:18})})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 bg-[#0f172a] dark:bg-[#0e1621] space-y-3.5 relative scroll-smooth bg-cover bg-center",children:[s.jsx("div",{className:"absolute inset-0 opacity-[0.07] pointer-events-none z-0",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M0 0h40v40H0z' fill='none'/%3E%3Cpath d='M20 10l-4 8h8l-4-8zm-8 12l-4 8h8l-4-8zm16 0l-4 8h8l-4-8zm-8 12l-4 8h8l-4-8zM60 50l-4 8h8l-4-8zm-8 12l-4 8h8l-4-8zm16 0l-4 8h8l-4-8zm-8 12l-4 8h8l-4-8z'/%3E%3C/g%3E%3C/svg%3E")`}}),s.jsx("div",{className:"flex justify-center my-1 shrink-0 z-10 relative",children:s.jsxs("div",{className:"bg-[#182533]/90 text-emerald-300 border border-emerald-500/30 rounded-2xl px-3.5 py-2 text-[10.5px] font-medium text-center shadow-lg flex items-center gap-2 max-w-xs sm:max-w-sm backdrop-blur-md",children:[s.jsx(uF,{size:13,className:"text-emerald-400 shrink-0 animate-pulse"}),s.jsxs("span",{className:"text-gray-200 leading-snug",children:[s.jsx("strong",{className:"text-emerald-400 font-extrabold",children:"End-to-End Encrypted"})," • Messages and calls are end-to-end encrypted. No one outside of this chat, not even Campus Eye, can read or listen to them."]})]})}),B?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-400 gap-2 relative z-10",children:[s.jsx(vn,{size:24,className:"animate-spin text-[#2AABEE]"}),s.jsx("p",{className:"text-xs font-bold uppercase tracking-wider text-gray-300",children:"Loading end-to-end encrypted chat..."})]}):a.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center px-6 py-8 my-auto relative z-10",children:[s.jsx("div",{className:"w-14 h-14 bg-[#2AABEE]/20 text-[#2AABEE] rounded-full flex items-center justify-center shadow-md mb-3 border border-[#2AABEE]/30",children:s.jsx(Xi,{size:26})}),s.jsx("h4",{className:"text-sm font-black text-white uppercase tracking-tight",children:"Telegram Secure Direct Chat"}),s.jsxs("p",{className:"text-xs text-gray-300 max-w-xs mt-1 leading-relaxed",children:["Start a private conversation with your peer friend ",s.jsxs("span",{className:"font-bold text-white",children:["@",r.username.toLowerCase()]}),"."]}),s.jsx("div",{className:"mt-4 flex flex-wrap gap-1.5 justify-center",children:["Hey! 👋","What campus event is today?","Are you studying in the library?"].map(se=>s.jsx("button",{onClick:()=>{h(se)},className:"text-[11px] font-semibold bg-[#17212b] border border-gray-700/80 text-gray-200 hover:bg-[#2AABEE] hover:text-white hover:border-[#2AABEE] px-3 py-1.5 rounded-full transition-all shadow-xs cursor-pointer",children:se},se))})]}):a.map((se,xe)=>{const ae=se.senderId===n,qe=j===se.id,pt=D===se.id;return s.jsxs(Qt.div,{drag:"x",dragConstraints:{left:-50,right:50},dragElastic:.15,onDragEnd:(Fe,jt)=>{Math.abs(jt.offset.x)>30&&je(se)},className:`flex flex-col ${ae?"items-end":"items-start"} group relative z-10`,children:[xe===0&&s.jsx("div",{className:"w-full text-center my-1.5",children:s.jsx("span",{className:"text-[9.5px] font-bold text-gray-300 uppercase tracking-wider bg-[#17212b]/90 px-2.5 py-0.5 rounded-full border border-gray-700/60 shadow-xs",children:Z(se.createdAt)})}),s.jsxs("div",{className:"relative flex items-end gap-1.5 max-w-[85%]",children:[!ae&&s.jsx("img",{src:r.photoURL||`https://api.dicebear.com/7.x/bottts/svg?seed=${r.username}`,alt:"",className:"w-6 h-6 rounded-full object-cover border border-gray-700 shadow-xs shrink-0 mb-1"}),s.jsxs("div",{onClick:()=>{T(qe?null:se.id),V(null)},className:`relative cursor-pointer transition-transform active:scale-[0.98] ${ae?"bg-[#2AABEE] text-white rounded-2xl rounded-br-xs shadow-md px-3.5 py-2 text-[13.5px] font-normal leading-snug":"bg-[#182533] text-gray-100 border border-gray-700/60 rounded-2xl rounded-bl-xs shadow-md px-3.5 py-2 text-[13.5px] font-normal leading-snug"}`,children:[se.replyToText&&s.jsxs("div",{className:`text-[10px] italic px-2 py-1 rounded-lg mb-1.5 border-l-2 ${ae?"bg-white/15 border-white text-white/90":"bg-gray-100 border-[#007AFF] text-gray-600"}`,children:[s.jsx("span",{className:"font-bold",children:"Replying:"}),' "',se.replyToText,'"']}),se.imageUrl&&s.jsx("div",{className:"mb-2 rounded-xl overflow-hidden border border-black/10",children:s.jsx("img",{src:se.imageUrl,alt:"Attached",className:"max-h-52 w-full object-cover"})}),s.jsx("p",{className:"whitespace-pre-wrap break-words",children:se.text}),se.reaction&&s.jsx("div",{className:`absolute -bottom-2.5 ${ae?"-left-2":"-right-2"} bg-white border border-gray-200 rounded-full px-1.5 py-0.2 text-[12px] shadow-sm flex items-center gap-0.5 animate-bounce`,children:s.jsx("span",{children:se.reaction})})]})]}),s.jsx(on,{children:qe&&s.jsxs(Qt.div,{initial:{opacity:0,scale:.8,y:-5},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.8,y:-5},className:`absolute z-20 top-0 ${ae?"right-0":"left-8"} -translate-y-full mb-1 bg-white/95 backdrop-blur-md border border-gray-200 rounded-full px-2 py-1 shadow-lg flex items-center gap-1.5`,children:[WMe.map(Fe=>s.jsx("button",{onClick:jt=>{jt.stopPropagation(),ve(se.id,Fe)},className:"text-base hover:scale-125 transition-transform p-0.5 cursor-pointer",children:Fe},Fe)),s.jsxs("button",{type:"button",onClick:Fe=>{Fe.stopPropagation(),V(se.id),T(null)},className:"text-xs font-bold bg-blue-50 text-[#007AFF] hover:bg-blue-100 rounded-full p-1 px-1.5 transition-all flex items-center gap-0.5 cursor-pointer",title:"Choose custom emoji reaction",children:[s.jsx(Uc,{size:12}),s.jsx("span",{children:"Emoji"})]})]})}),s.jsx(on,{children:pt&&s.jsxs(Qt.div,{initial:{opacity:0,scale:.9,y:-5},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:-5},className:`absolute z-30 top-0 ${ae?"right-0":"left-8"} -translate-y-full mb-1 bg-white border border-gray-200 rounded-2xl p-2 shadow-2xl w-64 text-left`,children:[s.jsxs("div",{className:"flex items-center justify-between pb-1.5 border-b border-gray-100",children:[s.jsx("span",{className:"text-[10px] font-black uppercase text-gray-700 tracking-wider",children:"Choose Custom Emoji Reaction"}),s.jsx("button",{onClick:()=>V(null),className:"text-gray-400 hover:text-black p-0.5 cursor-pointer",children:s.jsx(Jr,{size:12})})]}),s.jsx("div",{className:"grid grid-cols-6 gap-1 py-2 max-h-32 overflow-y-auto",children:KMe.map(Fe=>s.jsx("button",{onClick:jt=>{jt.stopPropagation(),ve(se.id,Fe)},className:"text-lg hover:scale-125 p-1 rounded-lg hover:bg-blue-50 transition-all cursor-pointer flex items-center justify-center",children:Fe},Fe))}),s.jsxs("div",{className:"flex items-center gap-1 pt-1.5 border-t border-gray-100",children:[s.jsx("input",{type:"text",value:U,onChange:Fe=>G(Fe.target.value),placeholder:"Type any emoji...",className:"flex-1 text-xs px-2 py-1 bg-gray-50 border border-gray-200 rounded-lg outline-none focus:border-[#007AFF]"}),s.jsx("button",{type:"button",onClick:()=>{U.trim()&&(ve(se.id,U.trim()),G(""))},className:"px-2 py-1 bg-[#007AFF] text-white text-[9px] font-bold uppercase rounded-lg cursor-pointer shrink-0",children:"Set"})]})]})}),s.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-gray-400 font-semibold px-1 mt-0.5",children:[s.jsx("span",{children:Z(se.createdAt)}),ae&&s.jsx(Hre,{size:11,className:"text-[#007AFF]"}),s.jsxs("button",{type:"button",onClick:()=>je(se),className:"text-[8px] font-bold text-gray-400 hover:text-[#007AFF] transition-colors flex items-center gap-0.5 cursor-pointer",children:[s.jsx(J6,{size:9}),s.jsx("span",{children:"Reply"})]})]})]},`msg-${se.id||xe}-${xe}`)}),s.jsx("div",{ref:J})]}),X&&s.jsxs("div",{className:"p-2 px-3 bg-blue-50 border-t border-blue-200 flex items-center justify-between gap-2 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx(J6,{size:14,className:"text-[#007AFF] shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[9px] font-bold text-blue-900 uppercase tracking-wider",children:"Swiped to Reply"}),s.jsxs("p",{className:"text-[11px] text-gray-700 truncate font-medium",children:['"',X.text||"Image attachment",'"']})]})]}),s.jsx("button",{type:"button",onClick:()=>q(null),className:"p-1 text-gray-400 hover:text-red-600 rounded-full cursor-pointer",children:s.jsx(Jr,{size:14})})]}),y&&s.jsxs("div",{className:"p-2 bg-gray-100 border-t border-gray-200 flex items-center justify-between gap-2 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("img",{src:y,alt:"Preview",className:"w-10 h-10 rounded-lg object-cover border border-gray-300"}),s.jsx("span",{className:"text-[10px] font-bold text-gray-600 truncate",children:"Ready to send photo"})]}),s.jsx("button",{type:"button",onClick:()=>w(null),className:"p-1 text-gray-500 hover:text-red-600 rounded-full hover:bg-gray-200 cursor-pointer",children:s.jsx(Jr,{size:14})})]}),s.jsxs("form",{onSubmit:le,className:"bg-gray-100/90 border-t border-gray-200/90 p-2.5 px-3.5 flex items-center gap-2 shrink-0",children:[s.jsx("input",{type:"file",ref:Q,accept:"image/*",onChange:Ve,className:"hidden"}),s.jsx("button",{type:"button",onClick:()=>{var se;return(se=Q.current)==null?void 0:se.click()},disabled:A,className:"p-2 text-[#007AFF] hover:bg-blue-50 rounded-full transition-all cursor-pointer shrink-0",title:"Attach Image",children:A?s.jsx(vn,{size:18,className:"animate-spin"}):s.jsx(yu,{size:19})}),s.jsxs("div",{className:"flex-1 relative flex items-center",children:[s.jsx("input",{ref:K,type:"text",value:c,onChange:se=>h(se.target.value),placeholder:X?"Reply to message...":"iMessage",className:"w-full text-sm font-sans bg-white border border-gray-300 focus:border-[#007AFF] focus:ring-1 focus:ring-[#007AFF] rounded-full px-4 py-2 pr-9 outline-none text-gray-900 placeholder:text-gray-400 transition-all shadow-2xs"}),s.jsx("button",{type:"button",onClick:()=>h(se=>se+" ❤️"),className:"absolute right-2.5 text-gray-400 hover:text-red-500 transition-colors p-0.5 cursor-pointer",children:s.jsx(Fl,{size:15})})]}),s.jsx("button",{type:"submit",disabled:!c.trim()&&!y||f,className:"p-2.5 bg-[#007AFF] hover:bg-blue-600 active:scale-95 disabled:opacity-40 text-white rounded-full transition-all cursor-pointer shrink-0 shadow-xs flex items-center justify-center",title:"Send iMessage",children:f?s.jsx(vn,{size:16,className:"animate-spin"}):s.jsx(Eo,{size:15,className:"translate-x-0.2"})})]})]})}),F&&r&&s.jsx(Lee,{isOpen:!0,onClose:()=>$(null),peer:r,callType:F})]})},YMe=({isOpen:e,onClose:t,currentUserId:r,viewingUserId:n,initialTab:i,onUserProfileClick:a})=>{const[o,c]=I.useState(i),[h,f]=I.useState({}),[m,y]=I.useState([]),[w,A]=I.useState([]),[S,j]=I.useState(""),[T,D]=I.useState(!0),[V,U]=I.useState(null),[G,X]=I.useState(null),[q,B]=I.useState(""),[z,F]=I.useState(!1);I.useEffect(()=>{const Z=se=>{se.detail&&X(se.detail)};return window.addEventListener("open-imessage-friend",Z),()=>window.removeEventListener("open-imessage-friend",Z)},[]);const $=n||r,J=Z=>o==="connections"?!0:w.some(se=>se.status==="accepted"&&(se.senderId===r&&(se.receiverId===Z||se.targetUserId===Z)||(se.senderId===Z||se.receiverId===Z)&&(se.receiverId===r||se.targetUserId===r))),Q=async()=>{if(!(!V||!q.trim()||!r)){F(!0);try{const Z=h[r],se=Z?Z.displayName:"A Campus Friend",xe=Z?Z.username:"member";await dn(nt(fe,"notifications"),{userId:V.uid,senderId:r,senderName:se,senderUsername:xe,senderPhotoURL:(Z==null?void 0:Z.photoURL)||"",title:`📩 Direct Inbox Message from ${se}`,message:q.trim(),type:"direct_message",canReply:!0,used:!1,createdAt:new Date}),nn.success(`Inbox message sent to @${V.username.toLowerCase()}!`,{icon:"✉️"}),U(null),B("")}catch(Z){nn.error("Failed to send direct message: "+Z.message)}finally{F(!1)}}};I.useEffect(()=>{e&&c(i)},[e,i]),I.useEffect(()=>{if(!e||!r)return;D(!0),(async()=>{try{const[se,xe,ae]=await Promise.all([vr(nt(fe,"users")),vr(nt(fe,"follows")),vr(nt(fe,"invitations"))]),qe={};se.docs.forEach(jt=>{const Pt=jt.data();qe[jt.id]={uid:jt.id,displayName:Pt.displayName||"Campus Member",username:Pt.username||"member",photoURL:Pt.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(Pt.displayName||"U")}&background=random`,email:Pt.email,role:Pt.role}}),f(qe);const pt=xe.docs.map(jt=>jt.data());y(pt);const Fe=ae.docs.map(jt=>jt.data());A(Fe)}catch(se){console.warn("Error fetching connections directory inside modal:",se)}finally{D(!1)}})()},[e,r]);const K=async(Z,se)=>{if(!r||!Z)return;const xe=`${r}_${Z}`,ae=m.some(qe=>qe.followerId===r&&qe.followedId===Z);try{if(ae){y(Fe=>Fe.filter(jt=>!(jt.followerId===r&&jt.followedId===Z))),await ai(st(fe,"follows",xe));const qe=h[r],pt=qe?`@${(qe.displayName||"a peer").replace(/\s+/g,"").toLowerCase()}`:"A peer";try{const Fe=`notif_unfollow_${r}_${Z}`;await Gn(st(fe,"notifications",Fe),{userId:Z,title:"💔 Lounge Unfollow",message:`${pt} unfollowed you.`,type:"social",used:!0,createdAt:new Date})}catch(Fe){console.warn("Failed to create unfollow notification:",Fe)}}else{const qe={followerId:r,followedId:Z,createdAt:new Date};y(jt=>[...jt,qe]),await Gn(st(fe,"follows",xe),{followerId:r,followedId:Z,createdAt:new Date});const pt=h[r],Fe=pt?`@${(pt.displayName||"a peer").replace(/\s+/g,"").toLowerCase()}`:"A peer";try{const jt=`notif_follow_${r}_${Z}`;await Gn(st(fe,"notifications",jt),{userId:Z,title:"👥 New Lounge Follower!",message:`${Fe} is now following you. They will receive your latest dispatches!`,type:"social",createdAt:new Date})}catch(jt){console.warn("Failed to create follow notification from modal:",jt)}}}catch(qe){console.error("Error toggling follow inside modal modal:",qe)}},me=()=>m.filter(se=>se.followedId===$).map(se=>se.followerId).map(se=>h[se]).filter(se=>!!se),re=()=>m.filter(se=>se.followerId===$).map(se=>se.followedId).map(se=>h[se]).filter(se=>!!se),le=()=>{const Z=w.filter(xe=>xe.status==="accepted"&&(xe.senderId===$||xe.receiverId===$)).map(xe=>xe.senderId===$?xe.receiverId:xe.senderId);return Array.from(new Set(Z)).map(xe=>h[xe]).filter(xe=>!!xe)},je=(()=>{switch(o){case"followers":return me();case"following":return re();case"connections":return le()}})(),Ve=je.filter(Z=>Z.displayName.toLowerCase().includes(S.toLowerCase())||Z.username.toLowerCase().includes(S.toLowerCase()));return s.jsxs(on,{children:[e&&s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[s.jsx(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"absolute inset-0 bg-black/60 backdrop-blur-xs"}),s.jsxs(Qt.div,{initial:{scale:.95,opacity:0,y:15},animate:{scale:1,opacity:1,y:0},exit:{scale:.95,opacity:0,y:15},transition:{type:"spring",damping:25,stiffness:350},className:"bg-white border border-gray-150 rounded-3xl w-full max-w-md h-[480px] flex flex-col overflow-hidden shadow-2xl relative z-10 select-none",id:"user-connections-dialog",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ko,{size:16,className:"text-red-650"}),s.jsx("h3",{className:"text-xs font-black uppercase tracking-widest text-gray-950",children:"Campus Relations"})]}),s.jsx("button",{onClick:t,className:"w-7 h-7 text-gray-400 hover:text-gray-950 rounded-full hover:bg-gray-100 flex items-center justify-center transition-colors cursor-pointer",title:"Close Window",id:"close-connections-modal",children:s.jsx(Jr,{size:14,strokeWidth:2.5})})]}),s.jsx("div",{className:"grid grid-cols-3 border-b border-gray-100 bg-gray-50/50 p-1",children:["followers","following","connections"].map(Z=>{const se=o===Z,xe=Z==="followers"?"Followers":Z==="following"?"Following":"Lounge",ae=Z==="followers"?me().length:Z==="following"?re().length:le().length;return s.jsxs("button",{onClick:()=>c(Z),className:`py-2 text-[10px] font-extrabold uppercase tracking-widest rounded-xl transition-all cursor-pointer flex flex-col items-center justify-center gap-0.5 ${se?"bg-white text-red-650 shadow-xs border border-gray-150/45":"text-gray-400 hover:text-gray-700 hover:bg-white/40"}`,children:[s.jsx("span",{children:xe}),s.jsx("span",{className:`text-[8.5px] font-black font-mono ${se?"text-red-650":"text-gray-400"}`,children:ae})]},Z)})}),je.length>0&&s.jsx("div",{className:"px-4 pt-3 pb-1 border-b border-gray-100/30",children:s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"text",value:S,onChange:Z=>j(Z.target.value),placeholder:"Search connection directory...",className:"w-full text-[11px] placeholder-gray-400 font-bold font-sans bg-gray-50 border border-gray-100 px-8 py-2 rounded-xl focus:bg-white focus:border-red-650/45 outline-none transition-all"}),s.jsx(Tp,{size:11,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"})]})}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-3.5 scrollbar-thin",children:T?s.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-2",children:[s.jsx(vn,{className:"animate-spin text-red-650",size:24}),s.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Resolving user accounts..."})]}):Ve.length===0?s.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center space-y-2 p-6",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-100 flex items-center justify-center text-gray-400",children:s.jsx(ko,{size:16})}),s.jsx("h4",{className:"text-[11px] font-black text-gray-900 uppercase tracking-wide",children:S?"No Matches Found":"No Directory Records"}),s.jsx("p",{className:"text-[9.5px] text-gray-400 leading-normal max-w-xs",children:S?"Refine your keyword to lookup active university profiles.":o==="followers"?"Register original columns or news reports to gather active campus followers!":o==="following"?"Follow varsity writers, reporters, or editors to customize your custom news stream.":"Connect in Lounge from posts to establish personal direct active debate capabilities."})]}):Ve.map(Z=>{const se=m.some(qe=>qe.followerId===r&&qe.followedId===Z.uid),xe=Z.uid===r,ae=J(Z.uid);return s.jsxs(Qt.div,{layout:!0,className:"flex items-center justify-between p-2 rounded-2xl hover:bg-gray-50/70 border border-transparent hover:border-gray-100/50 transition-all gap-2",children:[s.jsxs("div",{onClick:()=>{a&&(a(Z.uid),t())},className:"flex items-center gap-2.5 min-w-0 flex-1 cursor-pointer group/item",children:[s.jsx("img",{src:Z.photoURL,alt:"",className:"w-10 h-10 rounded-full object-cover border border-white shadow-xs group-hover/item:ring-2 group-hover/item:ring-red-650/40 transition-all shrink-0",referrerPolicy:"no-referrer"}),s.jsxs("div",{className:"text-left min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("h5",{className:"text-[11px] font-black text-gray-950 uppercase tracking-tight truncate group-hover/item:text-red-650 transition-colors",children:Z.displayName}),ae&&!xe&&s.jsxs("span",{className:"px-1.5 py-0.2 bg-emerald-50 text-emerald-700 border border-emerald-200 text-[7px] font-black uppercase rounded tracking-wider flex items-center gap-0.5",title:"Accepted Friend",children:[s.jsx(Rl,{size:8})," Connected"]})]}),s.jsxs("p",{className:"text-[9px] text-gray-400 font-semibold truncate leading-none",children:["@",Z.username.toLowerCase()]}),Z.role&&s.jsx("span",{className:"inline-block mt-1 text-[7.5px] font-black tracking-widest px-1 py-0.2 rounded bg-gray-100 text-gray-500 uppercase",children:Z.role==="admin"?"Editorial Board":"Reporter"})]})]}),!xe&&ae&&s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.jsxs("button",{onClick:qe=>{qe.stopPropagation(),X(Z)},className:"p-1.5 px-2.5 bg-[#007AFF] hover:bg-blue-600 text-white rounded-xl shadow-xs transition-all cursor-pointer flex items-center gap-1 text-[8.5px] font-black uppercase tracking-wider shrink-0",title:`Open iMessage conversation thread with ${Z.displayName}`,children:[s.jsx(Ri,{size:12,strokeWidth:2.5}),s.jsx("span",{children:"iMessage"})]}),s.jsxs("button",{onClick:qe=>{qe.stopPropagation(),U(Z)},className:"p-1.5 px-2 bg-indigo-50 hover:bg-indigo-600 text-indigo-700 hover:text-white rounded-xl border border-indigo-200/80 transition-all cursor-pointer flex items-center gap-1 text-[8.5px] font-black uppercase tracking-wider shrink-0 shadow-2xs",title:`Send direct inbox alert to ${Z.displayName}`,children:[s.jsx(Xs,{size:12,strokeWidth:2.5}),s.jsx("span",{className:"hidden sm:inline",children:"Inbox"})]})]}),!xe&&s.jsx("button",{onClick:()=>K(Z.uid,Z.displayName),className:`text-[8.5px] h-7 px-2.5 rounded-lg font-black uppercase tracking-wider flex items-center gap-1 cursor-pointer transition-colors shrink-0 ${se?"bg-gray-100 text-gray-650 border border-gray-150 hover:bg-red-50 hover:text-red-650 hover:border-red-150":"bg-red-50 text-red-650 border border-red-150/40 hover:bg-red-650 hover:text-white"}`,children:se?s.jsxs(s.Fragment,{children:[s.jsx(iy,{size:9,strokeWidth:2.5}),s.jsx("span",{className:"hidden sm:inline",children:"Following"})]}):s.jsxs(s.Fragment,{children:[s.jsx(bp,{size:9,strokeWidth:2.5}),s.jsx("span",{children:"Follow"})]})})]},Z.uid)})}),s.jsx(on,{children:V&&s.jsx("div",{className:"absolute inset-0 z-50 bg-black/60 backdrop-blur-xs flex items-center justify-center p-4",children:s.jsxs(Qt.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.9,opacity:0},className:"bg-white border border-gray-200 rounded-2xl p-4 w-full max-w-sm shadow-2xl text-left space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Xs,{size:16,className:"text-indigo-600"}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-black uppercase tracking-wider text-gray-950",children:"Campus Direct Message"}),s.jsxs("p",{className:"text-[9px] text-gray-400 font-medium",children:["To connected friend @",V.username.toLowerCase()]})]})]}),s.jsx("button",{onClick:()=>U(null),className:"p-1 text-gray-400 hover:text-black rounded-lg hover:bg-gray-100 transition-all cursor-pointer",children:s.jsx(Jr,{size:14})})]}),s.jsxs("div",{className:"flex items-center gap-2.5 p-2 bg-indigo-50/50 rounded-xl border border-indigo-100/60",children:[s.jsx("img",{src:V.photoURL,alt:"",className:"w-8 h-8 rounded-full object-cover border border-indigo-200 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[10px] font-black uppercase text-gray-900 truncate",children:V.displayName}),s.jsx("p",{className:"text-[8px] text-indigo-700 font-bold uppercase tracking-wider",children:"Connected Friend"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black uppercase text-gray-500 tracking-wider block mb-1",children:"Your Message:"}),s.jsx("textarea",{value:q,onChange:Z=>B(Z.target.value),placeholder:`Write your inbox message for ${V.displayName}...`,rows:3,className:"w-full text-xs font-sans p-2.5 bg-gray-50 border border-gray-200 rounded-xl outline-none focus:bg-white focus:border-indigo-600 transition-all resize-none"})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{onClick:()=>U(null),className:"px-3 py-1.5 text-[9.5px] font-bold text-gray-600 hover:text-black bg-gray-100 hover:bg-gray-200 rounded-xl transition-all cursor-pointer",children:"Cancel"}),s.jsxs("button",{onClick:Q,disabled:z||!q.trim(),className:"px-4 py-1.5 text-[9.5px] font-black uppercase tracking-wider bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 text-white rounded-xl transition-all flex items-center gap-1.5 shadow-xs cursor-pointer",children:[z?s.jsx(vn,{size:12,className:"animate-spin"}):s.jsx(Eo,{size:12}),s.jsx("span",{children:"Send Message"})]})]})]})})})]})]}),s.jsx(Uee,{isOpen:!!G,onClose:()=>X(null),friend:G,currentUserId:r,currentUserProfile:h[r]||null})]})},XMe=({isOpen:e,onClose:t,userId:r,currentUserId:n})=>{const[i,a]=I.useState(!0),[o,c]=I.useState(null),[h,f]=I.useState(null),[m,y]=I.useState(!1);I.useEffect(()=>{if(!e||!r)return;a(!0),(async()=>{try{const S=st(fe,"users",r),j=await as(S);let T={id:r,displayName:"Campus Citizen",email:""};j.exists()&&(T={id:r,...j.data()}),c(T);const[D,V,U,G,X]=await Promise.all([vr(Jt(nt(fe,"articles"),An("authorId","==",r))),vr(Jt(nt(fe,"posts"),An("userId","==",r))),vr(Jt(nt(fe,"purchases"),An("userId","==",r))),vr(Jt(nt(fe,"follows"),An("followedId","==",r))),vr(Jt(nt(fe,"follows"),An("followerId","==",r)))]),q=D.size,B=V.size,z=U.size,F=G.size,$=X.size;let J=0;U.docs.forEach(re=>{const le=re.data();J+=(Number(le.amount)||Number(le.ticketPrice)||0)*(Number(le.quantity)||1)});const Q=q*25+B*8+z*15+F*5;let K="Campus Scholar",me="text-blue-400";if(Q>=100?(K="Editorial Titan",me="text-purple-400"):Q>=50?(K="Senior Dispatcher",me="text-amber-400"):Q>=20&&(K="Active Reporter",me="text-emerald-400"),f({userId:r,userName:T.displayName||"Campus Citizen",userEmail:T.email||"",userPhoto:T.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(T.displayName||"U")}&background=random`,engagementScore:Q,articlesCount:q,postsCount:B,purchasesCount:z,totalSpent:J,followersCount:F,followingCount:$,tier:K,tierColor:me}),n&&n!==r){const re=`${n}_${r}`,le=await as(st(fe,"follows",re));y(le.exists())}}catch(S){console.error("Error fetching user profile stats:",S)}finally{a(!1)}})()},[e,r,n]);const w=async()=>{if(!n||!r)return;const A=`${n}_${r}`;try{m?(y(!1),await ai(st(fe,"follows",A)),he.success(`Unfollowed @${((o==null?void 0:o.displayName)||"citizen").toLowerCase().replace(/\s+/g,"")}`)):(y(!0),await Gn(st(fe,"follows",A),{followerId:n,followedId:r,createdAt:new Date}),he.success(`Now following @${((o==null?void 0:o.displayName)||"citizen").toLowerCase().replace(/\s+/g,"")}!`))}catch(S){console.error(S),he.error("Failed to update follow status")}};return!e||!r?null:s.jsx(on,{children:s.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[s.jsx(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"absolute inset-0 bg-black/75 backdrop-blur-sm"}),s.jsxs(Qt.div,{initial:{scale:.95,opacity:0,y:15},animate:{scale:1,opacity:1,y:0},exit:{scale:.95,opacity:0,y:15},transition:{type:"spring",damping:25,stiffness:350},className:"bg-white border border-gray-150 rounded-3xl w-full max-w-lg max-h-[90vh] flex flex-col overflow-hidden shadow-2xl relative z-10 select-none",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/50",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(yp,{size:16,className:"text-red-650"}),s.jsx("h3",{className:"text-xs font-black uppercase tracking-widest text-gray-950",children:"Citizen Engagement Profile"})]}),s.jsx("button",{onClick:t,className:"w-7 h-7 text-gray-400 hover:text-gray-950 rounded-full hover:bg-gray-100 flex items-center justify-center transition-colors cursor-pointer",children:s.jsx(Jr,{size:14,strokeWidth:2.5})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 space-y-5 scrollbar-thin",children:i?s.jsxs("div",{className:"py-16 flex flex-col items-center justify-center gap-2",children:[s.jsx(vn,{className:"animate-spin text-red-650",size:28}),s.jsx("span",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Calculating live citizen analytics & graphs..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"bg-gradient-to-r from-gray-900 to-black text-white p-5 rounded-3xl flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 border border-gray-800 shadow-lg",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("img",{src:(o==null?void 0:o.photoURL)||`https://ui-avatars.com/api/?name=${encodeURIComponent((o==null?void 0:o.displayName)||"User")}&background=random`,alt:"",className:"w-16 h-16 rounded-2xl object-cover border-2 border-white/20 shadow-md",referrerPolicy:"no-referrer"}),((o==null?void 0:o.isAdmin)||(o==null?void 0:o.role)==="admin")&&s.jsx("div",{className:"absolute -top-1.5 -right-1.5 bg-accent text-white p-1 rounded-lg shadow-md",children:s.jsx(ul,{size:12})})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("h4",{className:"font-extrabold text-base text-white uppercase tracking-tight truncate",children:(o==null?void 0:o.displayName)||"Campus Citizen"}),((o==null?void 0:o.isVerified)||(o==null?void 0:o.isPremium)||(o==null?void 0:o.blueCheck)||(o==null?void 0:o.isPremiumPostUser))&&s.jsx(So,{size:16})]}),s.jsxs("p",{className:"text-[10px] text-gray-400 uppercase font-bold tracking-widest truncate",children:["@",((o==null?void 0:o.username)||(o==null?void 0:o.displayName)||"member").toLowerCase().replace(/\s+/g,"")]}),s.jsx("div",{className:"mt-1.5 flex items-center gap-2",children:s.jsx("span",{className:"px-2 py-0.5 bg-white/10 rounded text-[8px] font-black uppercase tracking-wider text-gray-300",children:o!=null&&o.isAdmin||(o==null?void 0:o.role)==="admin"?"Editorial Board":"Citizen Reporter"})})]})]}),n&&n!==r&&s.jsx("button",{onClick:w,className:`px-4 py-2.5 rounded-xl text-[10px] font-black uppercase tracking-widest flex items-center gap-1.5 cursor-pointer transition-all shrink-0 ${m?"bg-white/10 text-white border border-white/20 hover:bg-red-600/80 hover:border-red-600":"bg-red-650 text-white hover:bg-red-700 shadow-lg shadow-red-650/30"}`,children:m?s.jsxs(s.Fragment,{children:[s.jsx(iy,{size:13}),s.jsx("span",{children:"Following"})]}):s.jsxs(s.Fragment,{children:[s.jsx(bp,{size:13}),s.jsx("span",{children:"Follow Citizen"})]})})]}),h&&s.jsx(Dee,{stats:h})]})})]})]})})},QMe=()=>{const[e,t]=I.useState(navigator.onLine),[r,n]=I.useState(!navigator.onLine),[i,a]=I.useState(navigator.onLine?"online":"offline");return I.useEffect(()=>{let o;const c=()=>{t(!0),a("online"),n(!0),o=setTimeout(()=>{n(!1)},3500)},h=()=>{t(!1),a("offline"),n(!0)};return window.addEventListener("online",c),window.addEventListener("offline",h),navigator.onLine||(n(!0),a("offline")),()=>{window.removeEventListener("online",c),window.removeEventListener("offline",h),o&&clearTimeout(o)}},[]),s.jsx(on,{children:r&&s.jsx("div",{className:"fixed top-2.5 sm:top-3 left-1/2 -translate-x-1/2 z-[10000] pointer-events-none select-none font-sans",children:s.jsxs(Qt.div,{initial:{y:-50,scale:.6,opacity:0},animate:{y:0,scale:1,opacity:1},exit:{y:-50,scale:.6,opacity:0},transition:{type:"spring",damping:25,stiffness:380},className:`pointer-events-auto flex items-center gap-2 px-3 py-1 sm:py-1.5 rounded-full border shadow-lg backdrop-blur-xl transition-all ${i==="online"?"bg-black/95 border-emerald-500/30 text-white":"bg-black/95 border-red-500/30 text-white"}`,children:[s.jsx("div",{className:"flex items-center justify-center shrink-0",children:s.jsx("span",{className:`w-2 h-2 rounded-full ${i==="online"?"bg-emerald-500":"bg-red-500"}`})}),s.jsx("div",{className:"shrink-0",children:i==="online"?s.jsx(Zie,{size:12,className:"text-emerald-400"}):s.jsx(Xie,{size:12,className:"text-red-400"})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:`text-[9px] font-black uppercase tracking-widest font-mono ${i==="online"?"text-emerald-400":"text-red-400"}`,children:i==="online"?"Online":"Offline"}),s.jsx("span",{className:"text-[8.5px] text-gray-300 font-bold uppercase tracking-wider hidden sm:inline-block",children:i==="online"?"Connected":"No Network"})]}),i==="online"&&s.jsx("button",{onClick:()=>n(!1),className:"ml-0.5 text-gray-400 hover:text-white text-[8px] font-bold px-1 py-0.2 rounded-full hover:bg-white/10 transition-colors cursor-pointer",title:"Dismiss",children:"✕"})]})})})},ZMe=()=>{const e=Ne.currentUser,[t,r]=I.useState(null),[n,i]=I.useState(null);I.useEffect(()=>{if(!e){r(null);return}const c=Jt(nt(fe,"calls"),An("receiverId","==",e.uid),An("status","==","ringing")),h=ei(c,f=>{if(f.empty)r(null);else{const m=f.docs[0],y={id:m.id,...m.data()};r(y),vye()}});return()=>h()},[e]);const a=()=>{t&&(i({peer:{uid:t.callerId,displayName:t.callerName,username:(t.callerName||"peer").toLowerCase().replace(/\s+/g,""),photoURL:t.callerPhoto},callType:t.type||"audio",existingCallId:t.id}),r(null))},o=async()=>{if(t){try{await Ir(st(fe,"calls",t.id),{status:"rejected"})}catch{}r(null)}};return s.jsxs(s.Fragment,{children:[s.jsx(on,{children:t&&s.jsx("div",{className:"fixed top-4 left-1/2 -translate-x-1/2 z-50 w-full max-w-sm px-3 pointer-events-auto",children:s.jsxs(Qt.div,{initial:{opacity:0,y:-40,scale:.9},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-40,scale:.9},className:"bg-neutral-900/95 text-white border border-neutral-700/80 rounded-2xl p-3.5 shadow-2xl backdrop-blur-xl flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("img",{src:t.callerPhoto||`https://api.dicebear.com/7.x/bottts/svg?seed=${t.callerName}`,alt:"",className:"w-11 h-11 rounded-full object-cover border-2 border-emerald-500 shadow-md"}),s.jsx("span",{className:"absolute -inset-1 rounded-full border border-emerald-400 animate-ping opacity-60"})]}),s.jsxs("div",{className:"min-w-0 text-left",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("h4",{className:"text-sm font-black text-white truncate",children:t.callerName}),s.jsx("span",{className:"px-1.5 py-0.2 bg-emerald-500/20 text-emerald-400 border border-emerald-500/30 text-[8px] font-black uppercase rounded-full shrink-0",children:"Ringing"})]}),s.jsxs("p",{className:"text-[10px] text-neutral-300 font-medium truncate flex items-center gap-1",children:[t.type==="video"?s.jsx(Na,{size:10,className:"text-blue-400"}):s.jsx(zS,{size:10,className:"text-emerald-400"}),s.jsxs("span",{children:["Incoming ",t.type==="video"?"FaceTime Video":"Audio"," Call"]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("button",{onClick:o,className:"p-2.5 bg-red-600 hover:bg-red-700 text-white rounded-full transition-all cursor-pointer shadow-md active:scale-90",title:"Decline Call",children:s.jsx(dF,{size:16})}),s.jsx("button",{onClick:a,className:"p-2.5 bg-emerald-500 hover:bg-emerald-600 text-white rounded-full transition-all cursor-pointer shadow-md active:scale-90 animate-bounce",title:"Accept Call",children:s.jsx(zS,{size:16})})]})]})})}),n&&s.jsx(Lee,{isOpen:!0,onClose:()=>i(null),peer:n.peer,callType:n.callType,isIncoming:!0,existingCallId:n.existingCallId})]})},JMe=({page:e,onClose:t})=>{const r=f=>{if(!f)return"";let m=f.trim();return/^https?:\/\//i.test(m)||(m="https://"+m),m},n=f=>{if(!f)return"";try{const m=f.trim();if(m.includes("youtube.com/watch")){const y=/[?&]v=([^&#]*)/,w=m.match(y);if(w&&w[1])return`https://www.youtube.com/embed/${w[1]}?autoplay=1&mute=0&rel=0`}else if(m.includes("youtu.be/")){const y=m.split("youtu.be/");if(y[1])return`https://www.youtube.com/embed/${y[1].split(/[?#&]/)[0]}?autoplay=1&mute=0&rel=0`}else if(m.includes("youtube.com/live/")){const y=m.split("youtube.com/live/");if(y[1])return`https://www.youtube.com/embed/${y[1].split(/[?#&]/)[0]}?autoplay=1&mute=0&rel=0`}else if(m.includes("/shorts/")){const y=m.split("/shorts/");if(y[1])return`https://www.youtube.com/embed/${y[1].split(/[?#&]/)[0]}?autoplay=1&mute=0&rel=0`}else{if(m.includes("youtube.com/embed/"))return m;if(m.includes("youtube-nocookie.com/embed/"))return m}return m}catch{return f}},i=r(e.url),a=n(i),[o,c]=ie.useState(0),h=()=>{c(f=>f+1)};return s.jsxs("div",{className:"fixed inset-0 z-[10000] flex flex-col bg-zinc-950 overflow-hidden select-none",id:"custom-media-theater-root",children:[s.jsxs("div",{className:"bg-zinc-900 border-b border-zinc-800 px-4 py-3 flex items-center justify-between text-white shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-red-600 shrink-0"}),s.jsx("div",{className:"truncate",children:s.jsx("h3",{className:"text-xs font-black uppercase tracking-wider text-white",children:e.name||"Live Channel"})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:h,className:"p-2 rounded-lg bg-zinc-800 hover:bg-zinc-700 text-zinc-300 transition-colors cursor-pointer flex items-center justify-center",title:"Reload Frame",children:s.jsx(hF,{size:14})}),s.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-lg bg-zinc-800 hover:bg-zinc-700 text-zinc-300 transition-colors flex items-center justify-center",title:"Open in native browser tab",children:s.jsx(za,{size:14})}),s.jsx("button",{onClick:t,className:"p-2 rounded-lg bg-red-600 hover:bg-red-700 text-white cursor-pointer flex items-center justify-center transition-all duration-200",title:"Close Channels",children:s.jsx(Jr,{size:14,strokeWidth:2.5})})]})]}),s.jsx("div",{className:"flex-1 bg-black relative",children:s.jsx("iframe",{src:a||void 0,className:"w-full h-full border-0 block bg-black",title:e.name,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; camera; microphone; geolocation",allowFullScreen:!0,referrerPolicy:"strict-origin-when-cross-origin"},o)})]})};var Sr;(function(e){e[e.QR_CODE=0]="QR_CODE",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=3]="CODE_39",e[e.CODE_93=4]="CODE_93",e[e.CODE_128=5]="CODE_128",e[e.DATA_MATRIX=6]="DATA_MATRIX",e[e.MAXICODE=7]="MAXICODE",e[e.ITF=8]="ITF",e[e.EAN_13=9]="EAN_13",e[e.EAN_8=10]="EAN_8",e[e.PDF_417=11]="PDF_417",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Sr||(Sr={}));var UV=new Map([[Sr.QR_CODE,"QR_CODE"],[Sr.AZTEC,"AZTEC"],[Sr.CODABAR,"CODABAR"],[Sr.CODE_39,"CODE_39"],[Sr.CODE_93,"CODE_93"],[Sr.CODE_128,"CODE_128"],[Sr.DATA_MATRIX,"DATA_MATRIX"],[Sr.MAXICODE,"MAXICODE"],[Sr.ITF,"ITF"],[Sr.EAN_13,"EAN_13"],[Sr.EAN_8,"EAN_8"],[Sr.PDF_417,"PDF_417"],[Sr.RSS_14,"RSS_14"],[Sr.RSS_EXPANDED,"RSS_EXPANDED"],[Sr.UPC_A,"UPC_A"],[Sr.UPC_E,"UPC_E"],[Sr.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),BV;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"})(BV||(BV={}));function e9e(e){return Object.values(Sr).includes(e)}var XN;(function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(XN||(XN={}));var t9e=(function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[XN.SCAN_TYPE_CAMERA,XN.SCAN_TYPE_FILE],e})(),Bee=(function(){function e(t,r){this.format=t,this.formatName=r}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!UV.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,UV.get(t))},e})(),zV=(function(){function e(){}return e.createFromText=function(t){var r={text:t};return{decodedText:t,result:r}},e.createFromQrcodeResult=function(t){return{decodedText:t.text,result:t}},e})(),xI;(function(e){e[e.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",e[e.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",e[e.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(xI||(xI={}));var r9e=(function(){function e(){}return e.createFrom=function(t){return{errorMessage:t,type:xI.UNKWOWN_ERROR}},e})(),n9e=(function(){function e(t){this.verbose=t}return e.prototype.log=function(t){this.verbose&&console.log(t)},e.prototype.warn=function(t){this.verbose&&console.warn(t)},e.prototype.logError=function(t,r){(this.verbose||r===!0)&&console.error(t)},e.prototype.logErrors=function(t){if(t.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(t)},e})();function Nd(e){return typeof e>"u"||e===null}var G0=(function(){function e(){}return e.codeParseError=function(t){return"QR code parse error, error = ".concat(t)},e.errorGettingUserMedia=function(t){return"Error getting userMedia, error = ".concat(t)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e})(),zee=(function(){function e(){}return e.isMediaStreamConstraintsValid=function(t,r){if(typeof t!="object"){var n=typeof t;return r.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(n,"."),!0),!1}for(var i=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],a=new Set(i),o=Object.keys(t),c=0,h=o;cg)throw new y("fromIndex("+p+") > toIndex("+g+")");if(p<0)throw new D(p);if(g>u)throw new D(g)}static asList(...u){return u}static create(u,p,g){return Array.from({length:u}).map(v=>Array.from({length:p}).fill(g))}static createInt32Array(u,p,g){return Array.from({length:u}).map(v=>Int32Array.from({length:p}).fill(g))}static equals(u,p){if(!u||!p||!u.length||!p.length||u.length!==p.length)return!1;for(let g=0,b=u.length;g>1,_=g(p,u[E]);if(_>0)b=E+1;else if(_<0)v=E-1;else return E}return-b-1}static numberComparator(u,p){return u-p}}class U{static numberOfTrailingZeros(u){let p;if(u===0)return 32;let g=31;return p=u<<16,p!==0&&(g-=16,u=p),p=u<<8,p!==0&&(g-=8,u=p),p=u<<4,p!==0&&(g-=4,u=p),p=u<<2,p!==0&&(g-=2,u=p),g-(u<<1>>>31)}static numberOfLeadingZeros(u){if(u===0)return 32;let p=1;return u>>>16||(p+=16,u<<=16),u>>>24||(p+=8,u<<=8),u>>>28||(p+=4,u<<=4),u>>>30||(p+=2,u<<=2),p-=u>>>31,p}static toHexString(u){return u.toString(16)}static toBinaryString(u){return String(parseInt(String(u),2))}static bitCount(u){return u=u-(u>>>1&1431655765),u=(u&858993459)+(u>>>2&858993459),u=u+(u>>>4)&252645135,u=u+(u>>>8),u=u+(u>>>16),u&63}static truncDivision(u,p){return Math.trunc(u/p)}static parseInt(u,p=void 0){return parseInt(u,p)}}U.MIN_VALUE_32_BITS=-2147483648,U.MAX_VALUE=Number.MAX_SAFE_INTEGER;class G{constructor(u,p){u===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=u,p==null?this.bits=G.makeArray(u):this.bits=p)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(u){if(u>this.bits.length*32){const p=G.makeArray(u);j.arraycopy(this.bits,0,p,0,this.bits.length),this.bits=p}}get(u){return(this.bits[Math.floor(u/32)]&1<<(u&31))!==0}set(u){this.bits[Math.floor(u/32)]|=1<<(u&31)}flip(u){this.bits[Math.floor(u/32)]^=1<<(u&31)}getNextSet(u){const p=this.size;if(u>=p)return p;const g=this.bits;let b=Math.floor(u/32),v=g[b];v&=~((1<<(u&31))-1);const E=g.length;for(;v===0;){if(++b===E)return p;v=g[b]}const _=b*32+U.numberOfTrailingZeros(v);return _>p?p:_}getNextUnset(u){const p=this.size;if(u>=p)return p;const g=this.bits;let b=Math.floor(u/32),v=~g[b];v&=~((1<<(u&31))-1);const E=g.length;for(;v===0;){if(++b===E)return p;v=~g[b]}const _=b*32+U.numberOfTrailingZeros(v);return _>p?p:_}setBulk(u,p){this.bits[Math.floor(u/32)]=p}setRange(u,p){if(pthis.size)throw new y;if(p===u)return;p--;const g=Math.floor(u/32),b=Math.floor(p/32),v=this.bits;for(let E=g;E<=b;E++){const _=E>g?0:u&31,M=(2<<(Ethis.size)throw new y;if(p===u)return!0;p--;const b=Math.floor(u/32),v=Math.floor(p/32),E=this.bits;for(let _=b;_<=v;_++){const P=_>b?0:u&31,W=(2<<(_32)throw new y("Num bits must be between 0 and 32");this.ensureCapacity(this.size+p);for(let g=p;g>0;g--)this.appendBit((u>>g-1&1)===1)}appendBitArray(u){const p=u.size;this.ensureCapacity(this.size+p);for(let g=0;g>1&1431655765|(E&1431655765)<<1,E=E>>2&858993459|(E&858993459)<<2,E=E>>4&252645135|(E&252645135)<<4,E=E>>8&16711935|(E&16711935)<<8,E=E>>16&65535|(E&65535)<<16,u[p-v]=E}if(this.size!==g*32){const v=g*32-this.size;let E=u[0]>>>v;for(let _=1;_>>v}u[g-1]=E}this.bits=u}static makeArray(u){return new Int32Array(Math.floor((u+31)/32))}equals(u){if(!(u instanceof G))return!1;const p=u;return this.size===p.size&&V.equals(this.bits,p.bits)}hashCode(){return 31*this.size+V.hashCode(this.bits)}toString(){let u="";for(let p=0,g=this.size;p=900)throw new B("incorect value");const p=F.VALUES_TO_ECI.get(u);if(p===void 0)throw new B("incorect value");return p}static getCharacterSetECIByName(u){const p=F.NAME_TO_ECI.get(u);if(p===void 0)throw new B("incorect value");return p}equals(u){if(!(u instanceof F))return!1;const p=u;return this.getName()===p.getName()}}F.VALUE_IDENTIFIER_TO_ECI=new Map,F.VALUES_TO_ECI=new Map,F.NAME_TO_ECI=new Map,F.Cp437=new F(z.Cp437,Int32Array.from([0,2]),"Cp437"),F.ISO8859_1=new F(z.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),F.ISO8859_2=new F(z.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),F.ISO8859_3=new F(z.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),F.ISO8859_4=new F(z.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),F.ISO8859_5=new F(z.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),F.ISO8859_6=new F(z.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),F.ISO8859_7=new F(z.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),F.ISO8859_8=new F(z.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),F.ISO8859_9=new F(z.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),F.ISO8859_10=new F(z.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),F.ISO8859_11=new F(z.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),F.ISO8859_13=new F(z.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),F.ISO8859_14=new F(z.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),F.ISO8859_15=new F(z.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),F.ISO8859_16=new F(z.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),F.SJIS=new F(z.SJIS,20,"SJIS","Shift_JIS"),F.Cp1250=new F(z.Cp1250,21,"Cp1250","windows-1250"),F.Cp1251=new F(z.Cp1251,22,"Cp1251","windows-1251"),F.Cp1252=new F(z.Cp1252,23,"Cp1252","windows-1252"),F.Cp1256=new F(z.Cp1256,24,"Cp1256","windows-1256"),F.UnicodeBigUnmarked=new F(z.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),F.UTF8=new F(z.UTF8,26,"UTF8","UTF-8"),F.ASCII=new F(z.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),F.Big5=new F(z.Big5,28,"Big5"),F.GB18030=new F(z.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),F.EUC_KR=new F(z.EUC_KR,30,"EUC_KR","EUC-KR");class $ extends f{}$.kind="UnsupportedOperationException";class J{static decode(u,p){const g=this.encodingName(p);return this.customDecoder?this.customDecoder(u,g):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(g)?this.decodeFallback(u,g):new TextDecoder(g).decode(u)}static shouldDecodeOnFallback(u){return!J.isBrowser()&&u==="ISO-8859-1"}static encode(u,p){const g=this.encodingName(p);return this.customEncoder?this.customEncoder(u,g):typeof TextEncoder>"u"?this.encodeFallback(u):new TextEncoder().encode(u)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(u){return typeof u=="string"?u:u.getName()}static encodingCharacterSet(u){return u instanceof F?u:F.getCharacterSetECIByName(u)}static decodeFallback(u,p){const g=this.encodingCharacterSet(p);if(J.isDecodeFallbackSupported(g)){let b="";for(let v=0,E=u.length;v3&&u[0]===239&&u[1]===187&&u[2]===191;for(let qt=0;qt0?(Mt&128)===0?E=!1:_--:(Mt&128)!==0&&((Mt&64)===0?E=!1:(_++,(Mt&32)===0?P++:(_++,(Mt&16)===0?M++:(_++,(Mt&8)===0?W++:E=!1))))),b&&(Mt>127&&Mt<160?b=!1:Mt>159&&(Mt<192||Mt===215||Mt===247)&&dt++),v&&(ee>0?Mt<64||Mt===127||Mt>252?v=!1:ee--:Mt===128||Mt===160||Mt>239?v=!1:Mt>160&&Mt<224?(oe++,Se=0,ye++,ye>Te&&(Te=ye)):Mt>127?(ee++,ye=0,Se++,Se>Ye&&(Ye=Se)):(ye=0,Se=0))}return E&&_>0&&(E=!1),v&&ee>0&&(v=!1),E&&(Wt||P+M+W>0)?Q.UTF8:v&&(Q.ASSUME_SHIFT_JIS||Te>=3||Ye>=3)?Q.SHIFT_JIS:b&&v?Te===2&&oe===2||dt*10>=g?Q.SHIFT_JIS:Q.ISO88591:b?Q.ISO88591:v?Q.SHIFT_JIS:E?Q.UTF8:Q.PLATFORM_DEFAULT_ENCODING}static format(u,...p){let g=-1;function b(E,_,P,M,W,ee){if(E==="%%")return"%";if(p[++g]===void 0)return;E=M?parseInt(M.substr(1)):void 0;let oe=W?parseInt(W.substr(1)):void 0,ye;switch(ee){case"s":ye=p[g];break;case"c":ye=p[g][0];break;case"f":ye=parseFloat(p[g]).toFixed(E);break;case"p":ye=parseFloat(p[g]).toPrecision(E);break;case"e":ye=parseFloat(p[g]).toExponential(E);break;case"x":ye=parseInt(p[g]).toString(oe||16);break;case"d":ye=parseFloat(parseInt(p[g],oe||10).toPrecision(E)).toFixed(0);break}ye=typeof ye=="object"?JSON.stringify(ye):(+ye).toString(oe);let Se=parseInt(P),Te=P&&P[0]+""=="0"?"0":" ";for(;ye.lengthE){if(_===-1)_=v-E;else if(v-E!==_)throw new y("row lengths do not match");E=v,P++}M++}else if(u.substring(M,M+p.length)===p)M+=p.length,b[v]=!0,v++;else if(u.substring(M,M+g.length)===g)M+=g.length,b[v]=!1,v++;else throw new y("illegal character encountered: "+u.substring(M));if(v>E){if(_===-1)_=v-E;else if(v-E!==_)throw new y("row lengths do not match");P++}const W=new me(_,P);for(let ee=0;ee>>(u&31)&1)!==0}set(u,p){const g=p*this.rowSize+Math.floor(u/32);this.bits[g]|=1<<(u&31)&4294967295}unset(u,p){const g=p*this.rowSize+Math.floor(u/32);this.bits[g]&=~(1<<(u&31)&4294967295)}flip(u,p){const g=p*this.rowSize+Math.floor(u/32);this.bits[g]^=1<<(u&31)&4294967295}xor(u){if(this.width!==u.getWidth()||this.height!==u.getHeight()||this.rowSize!==u.getRowSize())throw new y("input matrix dimensions do not match");const p=new G(Math.floor(this.width/32)+1),g=this.rowSize,b=this.bits;for(let v=0,E=this.height;vthis.height||v>this.width)throw new y("The region must fit inside the matrix");const _=this.rowSize,P=this.bits;for(let M=p;MP&&(P=M),W*32_){let oe=31;for(;!(ee>>>oe);)oe--;W*32+oe>_&&(_=W*32+oe)}}}return _=0&&p[g]===0;)g--;if(g<0)return null;const b=Math.floor(g/u);let v=Math.floor(g%u)*32;const E=p[g];let _=31;for(;!(E>>>_);)_--;return v+=_,Int32Array.from([v,b])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(u){if(!(u instanceof me))return!1;const p=u;return this.width===p.width&&this.height===p.height&&this.rowSize===p.rowSize&&V.equals(this.bits,p.bits)}hashCode(){let u=this.width;return u=31*u+this.width,u=31*u+this.height,u=31*u+this.rowSize,u=31*u+V.hashCode(this.bits),u}toString(u="X ",p=" ",g=` `){return this.buildToString(u,p,g)}buildToString(u,p,g){let b=new K;for(let v=0,E=this.height;v>le.LUMINANCE_SHIFT]++;const _=le.estimateBlackPoint(E);if(b<3)for(let P=0;P>le.LUMINANCE_SHIFT]++}}const E=le.estimateBlackPoint(v),_=u.getMatrix();for(let P=0;Pv&&(b=W,v=u[W]),u[W]>g&&(g=u[W]);let E=0,_=0;for(let W=0;W_&&(E=W,_=oe)}if(b>E){const W=b;b=E,E=W}if(E-b<=p/16)throw new re;let P=E-1,M=-1;for(let W=E-1;W>b;W--){const ee=W-b,oe=ee*ee*(E-W)*(g-u[W]);oe>M&&(P=W,M=oe)}return P<=ve.MINIMUM_DIMENSION&&g>=ve.MINIMUM_DIMENSION){const b=u.getMatrix();let v=p>>ve.BLOCK_SIZE_POWER;(p&ve.BLOCK_SIZE_MASK)!==0&&v++;let E=g>>ve.BLOCK_SIZE_POWER;(g&ve.BLOCK_SIZE_MASK)!==0&&E++;const _=ve.calculateBlackPoints(b,v,E,p,g),P=new me(p,g);ve.calculateThresholdForBlock(b,v,E,p,g,_,P),this.matrix=P}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(u){return new ve(u)}static calculateThresholdForBlock(u,p,g,b,v,E,_){const P=v-ve.BLOCK_SIZE,M=b-ve.BLOCK_SIZE;for(let W=0;WP&&(ee=P);const oe=ve.cap(W,2,g-3);for(let ye=0;yeM&&(Se=M);const Te=ve.cap(ye,2,p-3);let Ye=0;for(let Wt=-2;Wt<=2;Wt++){const qt=E[oe+Wt];Ye+=qt[Te-2]+qt[Te-1]+qt[Te]+qt[Te+1]+qt[Te+2]}const dt=Ye/25;ve.thresholdBlock(u,Se,ee,dt,b,_)}}}static cap(u,p,g){return ug?g:u}static thresholdBlock(u,p,g,b,v,E){for(let _=0,P=g*v+p;_E&&(W=E);for(let ee=0;ee_&&(oe=_);let ye=0,Se=255,Te=0;for(let dt=0,Wt=W*b+oe;dtTe&&(Te=Mt)}if(Te-Se>ve.MIN_DYNAMIC_RANGE)for(dt++,Wt+=b;dt>ve.BLOCK_SIZE_POWER*2;if(Te-Se<=ve.MIN_DYNAMIC_RANGE&&(Ye=Se/2,M>0&&ee>0)){const dt=(P[M-1][ee]+2*P[M][ee-1]+P[M-1][ee-1])/4;Se>10}b[E]=P}return b}getRow(u,p){if(u<0||u>=this.getHeight())throw new y("Requested row is outside the image: "+u);const g=this.getWidth(),b=u*g;return p===null?p=this.buffer.slice(b,b+g):(p.lengthnew se(p.deviceId,p.label))})}findDeviceById(u){return xe(this,void 0,void 0,function*(){const p=yield this.listVideoInputDevices();return p?p.find(g=>g.deviceId===u):null})}decodeFromInputVideoDevice(u,p){return xe(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(u,p)})}decodeOnceFromVideoDevice(u,p){return xe(this,void 0,void 0,function*(){this.reset();let g;u?g={deviceId:{exact:u}}:g={facingMode:"environment"};const b={video:g};return yield this.decodeOnceFromConstraints(b,p)})}decodeOnceFromConstraints(u,p){return xe(this,void 0,void 0,function*(){const g=yield navigator.mediaDevices.getUserMedia(u);return yield this.decodeOnceFromStream(g,p)})}decodeOnceFromStream(u,p){return xe(this,void 0,void 0,function*(){this.reset();const g=yield this.attachStreamToVideo(u,p);return yield this.decodeOnce(g)})}decodeFromInputVideoDeviceContinuously(u,p,g){return xe(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(u,p,g)})}decodeFromVideoDevice(u,p,g){return xe(this,void 0,void 0,function*(){let b;u?b={deviceId:{exact:u}}:b={facingMode:"environment"};const v={video:b};return yield this.decodeFromConstraints(v,p,g)})}decodeFromConstraints(u,p,g){return xe(this,void 0,void 0,function*(){const b=yield navigator.mediaDevices.getUserMedia(u);return yield this.decodeFromStream(b,p,g)})}decodeFromStream(u,p,g){return xe(this,void 0,void 0,function*(){this.reset();const b=yield this.attachStreamToVideo(u,p);return yield this.decodeContinuously(b,g)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(u,p){return xe(this,void 0,void 0,function*(){const g=this.prepareVideoElement(p);return this.addVideoSource(g,u),this.videoElement=g,this.stream=u,yield this.playVideoOnLoadAsync(g),g})}playVideoOnLoadAsync(u){return new Promise((p,g)=>this.playVideoOnLoad(u,()=>p()))}playVideoOnLoad(u,p){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(u),u.addEventListener("ended",this.videoEndedListener),u.addEventListener("canplay",this.videoCanPlayListener),u.addEventListener("playing",p),this.tryPlayVideo(u)}isVideoPlaying(u){return u.currentTime>0&&!u.paused&&!u.ended&&u.readyState>2}tryPlayVideo(u){return xe(this,void 0,void 0,function*(){if(this.isVideoPlaying(u)){console.warn("Trying to play video that is already playing.");return}try{yield u.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(u,p){const g=document.getElementById(u);if(!g)throw new m(`element with id '${u}' not found`);if(g.nodeName.toLowerCase()!==p.toLowerCase())throw new m(`element with id '${u}' must be an ${p} element`);return g}decodeFromImage(u,p){if(!u&&!p)throw new m("either imageElement with a src set or an url must be provided");return p&&!u?this.decodeFromImageUrl(p):this.decodeFromImageElement(u)}decodeFromVideo(u,p){if(!u&&!p)throw new m("Either an element with a src set or an URL must be provided");return p&&!u?this.decodeFromVideoUrl(p):this.decodeFromVideoElement(u)}decodeFromVideoContinuously(u,p,g){if(u===void 0&&p===void 0)throw new m("Either an element with a src set or an URL must be provided");return p&&!u?this.decodeFromVideoUrlContinuously(p,g):this.decodeFromVideoElementContinuously(u,g)}decodeFromImageElement(u){if(!u)throw new m("An image element must be provided.");this.reset();const p=this.prepareImageElement(u);this.imageElement=p;let g;return this.isImageLoaded(p)?g=this.decodeOnce(p,!1,!0):g=this._decodeOnLoadImage(p),g}decodeFromVideoElement(u){const p=this._decodeFromVideoElementSetup(u);return this._decodeOnLoadVideo(p)}decodeFromVideoElementContinuously(u,p){const g=this._decodeFromVideoElementSetup(u);return this._decodeOnLoadVideoContinuously(g,p)}_decodeFromVideoElementSetup(u){if(!u)throw new m("A video element must be provided.");this.reset();const p=this.prepareVideoElement(u);return this.videoElement=p,p}decodeFromImageUrl(u){if(!u)throw new m("An URL must be provided.");this.reset();const p=this.prepareImageElement();this.imageElement=p;const g=this._decodeOnLoadImage(p);return p.src=u,g}decodeFromVideoUrl(u){if(!u)throw new m("An URL must be provided.");this.reset();const p=this.prepareVideoElement(),g=this.decodeFromVideoElement(p);return p.src=u,g}decodeFromVideoUrlContinuously(u,p){if(!u)throw new m("An URL must be provided.");this.reset();const g=this.prepareVideoElement(),b=this.decodeFromVideoElementContinuously(g,p);return g.src=u,b}_decodeOnLoadImage(u){return new Promise((p,g)=>{this.imageLoadedListener=()=>this.decodeOnce(u,!1,!0).then(p,g),u.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(u){return xe(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(u),yield this.decodeOnce(u)})}_decodeOnLoadVideoContinuously(u,p){return xe(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(u),this.decodeContinuously(u,p)})}isImageLoaded(u){return!(!u.complete||u.naturalWidth===0)}prepareImageElement(u){let p;return typeof u>"u"&&(p=document.createElement("img"),p.width=200,p.height=200),typeof u=="string"&&(p=this.getMediaElement(u,"img")),u instanceof HTMLImageElement&&(p=u),p}prepareVideoElement(u){let p;return!u&&typeof document<"u"&&(p=document.createElement("video"),p.width=200,p.height=200),typeof u=="string"&&(p=this.getMediaElement(u,"video")),u instanceof HTMLVideoElement&&(p=u),p.setAttribute("autoplay","true"),p.setAttribute("muted","true"),p.setAttribute("playsinline","true"),p}decodeOnce(u,p=!0,g=!0){this._stopAsyncDecode=!1;const b=(v,E)=>{if(this._stopAsyncDecode){E(new re("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const _=this.decode(u);v(_)}catch(_){const P=p&&_ instanceof re,W=(_ instanceof A||_ instanceof B)&&g;if(P||W)return setTimeout(b,this._timeBetweenDecodingAttempts,v,E);E(_)}};return new Promise((v,E)=>b(v,E))}decodeContinuously(u,p){this._stopContinuousDecode=!1;const g=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const b=this.decode(u);p(b,null),setTimeout(g,this.timeBetweenScansMillis)}catch(b){p(null,b);const v=b instanceof A||b instanceof B,E=b instanceof re;(v||E)&&setTimeout(g,this._timeBetweenDecodingAttempts)}};g()}decode(u){const p=this.createBinaryBitmap(u);return this.decodeBitmap(p)}_isHTMLVideoElement(u){return u.videoWidth!==0}drawFrameOnCanvas(u,p,g){p||(p={sx:0,sy:0,sWidth:u.videoWidth,sHeight:u.videoHeight,dx:0,dy:0,dWidth:u.videoWidth,dHeight:u.videoHeight}),g||(g=this.captureCanvasContext),g.drawImage(u,p.sx,p.sy,p.sWidth,p.sHeight,p.dx,p.dy,p.dWidth,p.dHeight)}drawImageOnCanvas(u,p,g=this.captureCanvasContext){p||(p={sx:0,sy:0,sWidth:u.naturalWidth,sHeight:u.naturalHeight,dx:0,dy:0,dWidth:u.naturalWidth,dHeight:u.naturalHeight}),g||(g=this.captureCanvasContext),g.drawImage(u,p.sx,p.sy,p.sWidth,p.sHeight,p.dx,p.dy,p.dWidth,p.dHeight)}createBinaryBitmap(u){this.getCaptureCanvasContext(u),this._isHTMLVideoElement(u)?this.drawFrameOnCanvas(u):this.drawImageOnCanvas(u);const p=this.getCaptureCanvas(u),g=new Z(p),b=new ve(g);return new w(b)}getCaptureCanvasContext(u){if(!this.captureCanvasContext){const g=this.getCaptureCanvas(u).getContext("2d");this.captureCanvasContext=g}return this.captureCanvasContext}getCaptureCanvas(u){if(!this.captureCanvas){const p=this.createCaptureCanvas(u);this.captureCanvas=p}return this.captureCanvas}decodeBitmap(u){return this.reader.decode(u,this._hints)}createCaptureCanvas(u){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const p=document.createElement("canvas");let g,b;return typeof u<"u"&&(u instanceof HTMLVideoElement?(g=u.videoWidth,b=u.videoHeight):u instanceof HTMLImageElement&&(g=u.naturalWidth||u.width,b=u.naturalHeight||u.height)),p.style.width=g+"px",p.style.height=b+"px",p.width=g,p.height=b,p}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(u=>u.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(u,p){try{u.srcObject=p}catch{u.src=URL.createObjectURL(p)}}cleanVideoSource(u){try{u.srcObject=null}catch{u.src=""}this.videoElement.removeAttribute("src")}}class qe{constructor(u,p,g=p==null?0:8*p.length,b,v,E=j.currentTimeMillis()){this.text=u,this.rawBytes=p,this.numBits=g,this.resultPoints=b,this.format=v,this.timestamp=E,this.text=u,this.rawBytes=p,g==null?this.numBits=p==null?0:8*p.length:this.numBits=g,this.resultPoints=b,this.format=v,this.resultMetadata=null,E==null?this.timestamp=j.currentTimeMillis():this.timestamp=E}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(u,p){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(u,p)}putAllMetadata(u){u!==null&&(this.resultMetadata===null?this.resultMetadata=u:this.resultMetadata=new Map(u))}addResultPoints(u){const p=this.resultPoints;if(p===null)this.resultPoints=u;else if(u!==null&&u.length>0){const g=new Array(p.length+u.length);j.arraycopy(p,0,g,0,p.length),j.arraycopy(u,0,g,p.length,u.length),this.resultPoints=g}}getTimestamp(){return this.timestamp}toString(){return this.text}}var pt;(function(te){te[te.AZTEC=0]="AZTEC",te[te.CODABAR=1]="CODABAR",te[te.CODE_39=2]="CODE_39",te[te.CODE_93=3]="CODE_93",te[te.CODE_128=4]="CODE_128",te[te.DATA_MATRIX=5]="DATA_MATRIX",te[te.EAN_8=6]="EAN_8",te[te.EAN_13=7]="EAN_13",te[te.ITF=8]="ITF",te[te.MAXICODE=9]="MAXICODE",te[te.PDF_417=10]="PDF_417",te[te.QR_CODE=11]="QR_CODE",te[te.RSS_14=12]="RSS_14",te[te.RSS_EXPANDED=13]="RSS_EXPANDED",te[te.UPC_A=14]="UPC_A",te[te.UPC_E=15]="UPC_E",te[te.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(pt||(pt={}));var Fe=pt,jt;(function(te){te[te.OTHER=0]="OTHER",te[te.ORIENTATION=1]="ORIENTATION",te[te.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",te[te.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",te[te.ISSUE_NUMBER=4]="ISSUE_NUMBER",te[te.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",te[te.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",te[te.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",te[te.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",te[te.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",te[te.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(jt||(jt={}));var Pt=jt;class Ae{constructor(u,p,g,b,v=-1,E=-1){this.rawBytes=u,this.text=p,this.byteSegments=g,this.ecLevel=b,this.structuredAppendSequenceNumber=v,this.structuredAppendParity=E,this.numBits=u==null?0:8*u.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(u){this.numBits=u}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(u){this.errorsCorrected=u}getErasures(){return this.erasures}setErasures(u){this.erasures=u}getOther(){return this.other}setOther(u){this.other=u}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class Ie{exp(u){return this.expTable[u]}log(u){if(u===0)throw new y;return this.logTable[u]}static addOrSubtract(u,p){return u^p}}class vt{constructor(u,p){if(p.length===0)throw new y;this.field=u;const g=p.length;if(g>1&&p[0]===0){let b=1;for(;bg.length){const E=p;p=g,g=E}let b=new Int32Array(g.length);const v=g.length-p.length;j.arraycopy(g,0,b,0,v);for(let E=v;E=u.getDegree()&&!b.isZero();){const _=b.getDegree()-u.getDegree(),P=p.multiply(b.getCoefficient(b.getDegree()),E),M=u.multiplyByMonomial(_,P),W=p.buildMonomial(_,P);g=g.addOrSubtract(W),b=b.addOrSubtract(M)}return[g,b]}toString(){let u="";for(let p=this.getDegree();p>=0;p--){let g=this.getCoefficient(p);if(g!==0){if(g<0?(u+=" - ",g=-g):u.length>0&&(u+=" + "),p===0||g!==1){const b=this.field.log(g);b===0?u+="1":b===1?u+="a":(u+="a^",u+=b)}p!==0&&(p===1?u+="x":(u+="x^",u+=p))}}return u}}class Re extends f{}Re.kind="ArithmeticException";class It extends Ie{constructor(u,p,g){super(),this.primitive=u,this.size=p,this.generatorBase=g;const b=new Int32Array(p);let v=1;for(let _=0;_=p&&(v^=u,v&=p-1);this.expTable=b;const E=new Int32Array(p);for(let _=0;_=(g/2|0);){let ye=v,Se=_;if(v=E,_=P,v.isZero())throw new Dt("r_{i-1} was zero");E=ye;let Te=b.getZero();const Ye=v.getCoefficient(v.getDegree()),dt=b.inverse(Ye);for(;E.getDegree()>=v.getDegree()&&!E.isZero();){const Wt=E.getDegree()-v.getDegree(),qt=b.multiply(E.getCoefficient(E.getDegree()),dt);Te=Te.addOrSubtract(b.buildMonomial(Wt,qt)),E=E.addOrSubtract(v.multiplyByMonomial(Wt,qt))}if(P=Te.multiply(_).addOrSubtract(Se),E.getDegree()>=v.getDegree())throw new cr("Division algorithm failed to reduce polynomial?")}const M=P.getCoefficient(0);if(M===0)throw new Dt("sigmaTilde(0) was zero");const W=b.inverse(M),ee=P.multiplyScalar(W),oe=E.multiplyScalar(W);return[ee,oe]}findErrorLocations(u){const p=u.getDegree();if(p===1)return Int32Array.from([u.getCoefficient(1)]);const g=new Int32Array(p);let b=0;const v=this.field;for(let E=1;E1,ee,ee+g-1),ee+=g-1;else for(let Se=g-1;Se>=0;--Se)W[ee++]=(ye&1<=8?Gt.readCode(u,p,8):Gt.readCode(u,p,g)<<8-g}static convertBoolArrayToByteArray(u){let p=new Uint8Array((u.length+7)/8);for(let g=0;g","?","[","]","{","}","CTRL_UL"],Gt.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Xe{constructor(){}static round(u){return u===NaN?0:u<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:u>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:u+(u<0?-.5:.5)|0}static distance(u,p,g,b){const v=u-g,E=p-b;return Math.sqrt(v*v+E*E)}static sum(u){let p=0;for(let g=0,b=u.length;g!==b;g++){const v=u[g];p+=v}return p}}class Xt{static floatToIntBits(u){return u}}Xt.MAX_VALUE=Number.MAX_SAFE_INTEGER;class Ot{constructor(u,p){this.x=u,this.y=p}getX(){return this.x}getY(){return this.y}equals(u){if(u instanceof Ot){const p=u;return this.x===p.x&&this.y===p.y}return!1}hashCode(){return 31*Xt.floatToIntBits(this.x)+Xt.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(u){const p=this.distance(u[0],u[1]),g=this.distance(u[1],u[2]),b=this.distance(u[0],u[2]);let v,E,_;if(g>=p&&g>=b?(E=u[0],v=u[1],_=u[2]):b>=g&&b>=p?(E=u[1],v=u[0],_=u[2]):(E=u[2],v=u[0],_=u[1]),this.crossProductZ(v,E,_)<0){const P=v;v=_,_=P}u[0]=v,u[1]=E,u[2]=_}static distance(u,p){return Xe.distance(u.x,u.y,p.x,p.y)}static crossProductZ(u,p,g){const b=p.x,v=p.y;return(g.x-b)*(u.y-v)-(g.y-v)*(u.x-b)}}class or{constructor(u,p){this.bits=u,this.points=p}getBits(){return this.bits}getPoints(){return this.points}}class Wr extends or{constructor(u,p,g,b,v){super(u,p),this.compact=g,this.nbDatablocks=b,this.nbLayers=v}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class dr{constructor(u,p,g,b){this.image=u,this.height=u.getHeight(),this.width=u.getWidth(),p==null&&(p=dr.INIT_SIZE),g==null&&(g=u.getWidth()/2|0),b==null&&(b=u.getHeight()/2|0);const v=p/2|0;if(this.leftInit=g-v,this.rightInit=g+v,this.upInit=b-v,this.downInit=b+v,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new re}detect(){let u=this.leftInit,p=this.rightInit,g=this.upInit,b=this.downInit,v=!1,E=!0,_=!1,P=!1,M=!1,W=!1,ee=!1;const oe=this.width,ye=this.height;for(;E;){E=!1;let Se=!0;for(;(Se||!P)&&p=oe){v=!0;break}let Te=!0;for(;(Te||!M)&&b=ye){v=!0;break}let Ye=!0;for(;(Ye||!W)&&u>=0;)Ye=this.containsBlackPoint(g,b,u,!1),Ye?(u--,E=!0,W=!0):W||u--;if(u<0){v=!0;break}let dt=!0;for(;(dt||!ee)&&g>=0;)dt=this.containsBlackPoint(u,p,g,!0),dt?(g--,E=!0,ee=!0):ee||g--;if(g<0){v=!0;break}E&&(_=!0)}if(!v&&_){const Se=p-u;let Te=null;for(let qt=1;Te===null&&qtg||P<-1||P>b)throw new re;v=!1,_===-1?(p[E]=0,v=!0):_===g&&(p[E]=g-1,v=!0),P===-1?(p[E+1]=0,v=!0):P===b&&(p[E+1]=b-1,v=!0)}v=!0;for(let E=p.length-2;E>=0&&v;E-=2){const _=Math.floor(p[E]),P=Math.floor(p[E+1]);if(_<-1||_>g||P<-1||P>b)throw new re;v=!1,_===-1?(p[E]=0,v=!0):_===g&&(p[E]=g-1,v=!0),P===-1?(p[E+1]=0,v=!0):P===b&&(p[E+1]=b-1,v=!0)}}}class He{constructor(u,p,g,b,v,E,_,P,M){this.a11=u,this.a21=p,this.a31=g,this.a12=b,this.a22=v,this.a32=E,this.a13=_,this.a23=P,this.a33=M}static quadrilateralToQuadrilateral(u,p,g,b,v,E,_,P,M,W,ee,oe,ye,Se,Te,Ye){const dt=He.quadrilateralToSquare(u,p,g,b,v,E,_,P);return He.squareToQuadrilateral(M,W,ee,oe,ye,Se,Te,Ye).times(dt)}transformPoints(u){const p=u.length,g=this.a11,b=this.a12,v=this.a13,E=this.a21,_=this.a22,P=this.a23,M=this.a31,W=this.a32,ee=this.a33;for(let oe=0;oe>1&127):(b<<=10,b+=(_>>2&992)+(_>>1&31))}let v=this.getCorrectedParameterData(b,this.compact);this.compact?(this.nbLayers=(v>>6)+1,this.nbDataBlocks=(v&63)+1):(this.nbLayers=(v>>11)+1,this.nbDataBlocks=(v&2047)+1)}getRotation(u,p){let g=0;u.forEach((b,v,E)=>{let _=(b>>p-2<<1)+(b&1);g=(g<<3)+_}),g=((g&1)<<11)+(g>>1);for(let b=0;b<4;b++)if(U.bitCount(g^this.EXPECTED_CORNER_BITS[b])<=2)return b;throw new re}getCorrectedParameterData(u,p){let g,b;p?(g=7,b=2):(g=10,b=4);let v=g-b,E=new Int32Array(g);for(let P=g-1;P>=0;--P)E[P]=u&15,u>>=4;try{new St(It.AZTEC_PARAM).decode(E,v)}catch{throw new re}let _=0;for(let P=0;P2){let Te=this.distancePoint(Se,ee)*this.nbCenterLayers/(this.distancePoint(v,p)*(this.nbCenterLayers+2));if(Te<.75||Te>1.25||!this.isWhiteOrBlackRectangle(ee,oe,ye,Se))break}p=ee,g=oe,b=ye,v=Se,E=!E}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new re;this.compact=this.nbCenterLayers===5;let _=new Ot(p.getX()+.5,p.getY()-.5),P=new Ot(g.getX()+.5,g.getY()+.5),M=new Ot(b.getX()-.5,b.getY()+.5),W=new Ot(v.getX()-.5,v.getY()-.5);return this.expandSquare([_,P,M,W],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let u,p,g,b;try{let _=new dr(this.image).detect();u=_[0],p=_[1],g=_[2],b=_[3]}catch{let P=this.image.getWidth()/2,M=this.image.getHeight()/2;u=this.getFirstDifferent(new fr(P+7,M-7),!1,1,-1).toResultPoint(),p=this.getFirstDifferent(new fr(P+7,M+7),!1,1,1).toResultPoint(),g=this.getFirstDifferent(new fr(P-7,M+7),!1,-1,1).toResultPoint(),b=this.getFirstDifferent(new fr(P-7,M-7),!1,-1,-1).toResultPoint()}let v=Xe.round((u.getX()+b.getX()+p.getX()+g.getX())/4),E=Xe.round((u.getY()+b.getY()+p.getY()+g.getY())/4);try{let _=new dr(this.image,15,v,E).detect();u=_[0],p=_[1],g=_[2],b=_[3]}catch{u=this.getFirstDifferent(new fr(v+7,E-7),!1,1,-1).toResultPoint(),p=this.getFirstDifferent(new fr(v+7,E+7),!1,1,1).toResultPoint(),g=this.getFirstDifferent(new fr(v-7,E+7),!1,-1,1).toResultPoint(),b=this.getFirstDifferent(new fr(v-7,E-7),!1,-1,-1).toResultPoint()}return v=Xe.round((u.getX()+b.getX()+p.getX()+g.getX())/4),E=Xe.round((u.getY()+b.getY()+p.getY()+g.getY())/4),new fr(v,E)}getMatrixCornerPoints(u){return this.expandSquare(u,2*this.nbCenterLayers,this.getDimension())}sampleGrid(u,p,g,b,v){let E=nr.getInstance(),_=this.getDimension(),P=_/2-this.nbCenterLayers,M=_/2+this.nbCenterLayers;return E.sampleGrid(u,_,_,P,P,M,P,M,M,P,M,p.getX(),p.getY(),g.getX(),g.getY(),b.getX(),b.getY(),v.getX(),v.getY())}sampleLine(u,p,g){let b=0,v=this.distanceResultPoint(u,p),E=v/g,_=u.getX(),P=u.getY(),M=E*(p.getX()-u.getX())/v,W=E*(p.getY()-u.getY())/v;for(let ee=0;ee.1&&ee<.9?0:ee<=.1===M?1:-1}getFirstDifferent(u,p,g,b){let v=u.getX()+g,E=u.getY()+b;for(;this.isValid(v,E)&&this.image.get(v,E)===p;)v+=g,E+=b;for(v-=g,E-=b;this.isValid(v,E)&&this.image.get(v,E)===p;)v+=g;for(v-=g;this.isValid(v,E)&&this.image.get(v,E)===p;)E+=b;return E-=b,new fr(v,E)}expandSquare(u,p,g){let b=g/(2*p),v=u[0].getX()-u[2].getX(),E=u[0].getY()-u[2].getY(),_=(u[0].getX()+u[2].getX())/2,P=(u[0].getY()+u[2].getY())/2,M=new Ot(_+b*v,P+b*E),W=new Ot(_-b*v,P-b*E);v=u[1].getX()-u[3].getX(),E=u[1].getY()-u[3].getY(),_=(u[1].getX()+u[3].getX())/2,P=(u[1].getY()+u[3].getY())/2;let ee=new Ot(_+b*v,P+b*E),oe=new Ot(_-b*v,P-b*E);return[M,ee,W,oe]}isValid(u,p){return u>=0&&u0&&p{g.foundPossibleResultPoint(b)})}}reset(){}}class Ci extends ae{constructor(u=500){super(new en,u)}}class Gr{decode(u,p){try{return this.doDecode(u,p)}catch{if(p&&p.get(q.TRY_HARDER)===!0&&u.isRotateSupported()){const v=u.rotateCounterClockwise(),E=this.doDecode(v,p),_=E.getResultMetadata();let P=270;_!==null&&_.get(Pt.ORIENTATION)===!0&&(P=P+_.get(Pt.ORIENTATION)%360),E.putMetadata(Pt.ORIENTATION,P);const M=E.getResultPoints();if(M!==null){const W=v.getHeight();for(let ee=0;ee>(E?8:5));let P;E?P=b:P=15;const M=Math.trunc(b/2);for(let W=0;W=b)break;try{v=u.getBlackRow(ye,v)}catch{continue}for(let Se=0;Se<2;Se++){if(Se===1&&(v.reverse(),p&&p.get(q.NEED_RESULT_POINT_CALLBACK)===!0)){const Te=new Map;p.forEach((Ye,dt)=>Te.set(dt,Ye)),Te.delete(q.NEED_RESULT_POINT_CALLBACK),p=Te}try{const Te=this.decodeRow(ye,v,p);if(Se===1){Te.putMetadata(Pt.ORIENTATION,180);const Ye=Te.getResultPoints();Ye!==null&&(Ye[0]=new Ot(g-Ye[0].getX()-1,Ye[0].getY()),Ye[1]=new Ot(g-Ye[1].getX()-1,Ye[1].getY()))}return Te}catch{}}}throw new re}static recordPattern(u,p,g){const b=g.length;for(let M=0;M=v)throw new re;let E=!u.get(p),_=0,P=p;for(;P0&&b>=0;)u.get(--p)!==v&&(b--,v=!v);if(b>=0)throw new re;Gr.recordPattern(u,p+1,g)}static patternMatchVariance(u,p,g){const b=u.length;let v=0,E=0;for(let M=0;Mee?W-ee:ee-W;if(oe>g)return Number.POSITIVE_INFINITY;P+=oe}return P/v}}class be extends Gr{static findStartPattern(u){const p=u.getSize(),g=u.getNextSet(0);let b=0,v=Int32Array.from([0,0,0,0,0,0]),E=g,_=!1;const P=6;for(let M=g;M=0&&u.isRange(Math.max(0,E-(M-E)/2),E,!1))return Int32Array.from([E,M,ee]);E+=v[0]+v[1],v=v.slice(2,v.length-1),v[b-1]=0,v[b]=0,b--}else b++;v[b]=1,_=!_}throw new re}static decodeCode(u,p,g){Gr.recordPattern(u,g,p);let b=be.MAX_AVG_VARIANCE,v=-1;for(let E=0;E=0)return v;throw new re}decodeRow(u,p,g){const b=g&&g.get(q.ASSUME_GS1)===!0,v=be.findStartPattern(p),E=v[2];let _=0;const P=new Uint8Array(20);P[_++]=E;let M;switch(E){case be.CODE_START_A:M=be.CODE_CODE_A;break;case be.CODE_START_B:M=be.CODE_CODE_B;break;case be.CODE_START_C:M=be.CODE_CODE_C;break;default:throw new B}let W=!1,ee=!1,oe="",ye=v[0],Se=v[1];const Te=Int32Array.from([0,0,0,0,0,0]);let Ye=0,dt=0,Wt=E,qt=0,Mt=!0,In=!1,bn=!1;for(;!W;){const El=ee;switch(ee=!1,Ye=dt,dt=be.decodeCode(p,Te,Se),P[_++]=dt,dt!==be.CODE_STOP&&(Mt=!0),dt!==be.CODE_STOP&&(qt++,Wt+=qt*dt),ye=Se,Se+=Te.reduce((_m,ih)=>_m+ih,0),dt){case be.CODE_START_A:case be.CODE_START_B:case be.CODE_START_C:throw new B}switch(M){case be.CODE_CODE_A:if(dt<64)bn===In?oe+=String.fromCharCode(32+dt):oe+=String.fromCharCode(32+dt+128),bn=!1;else if(dt<96)bn===In?oe+=String.fromCharCode(dt-64):oe+=String.fromCharCode(dt+64),bn=!1;else switch(dt!==be.CODE_STOP&&(Mt=!1),dt){case be.CODE_FNC_1:b&&(oe.length===0?oe+="]C1":oe+="");break;case be.CODE_FNC_2:case be.CODE_FNC_3:break;case be.CODE_FNC_4_A:!In&&bn?(In=!0,bn=!1):In&&bn?(In=!1,bn=!1):bn=!0;break;case be.CODE_SHIFT:ee=!0,M=be.CODE_CODE_B;break;case be.CODE_CODE_B:M=be.CODE_CODE_B;break;case be.CODE_CODE_C:M=be.CODE_CODE_C;break;case be.CODE_STOP:W=!0;break}break;case be.CODE_CODE_B:if(dt<96)bn===In?oe+=String.fromCharCode(32+dt):oe+=String.fromCharCode(32+dt+128),bn=!1;else switch(dt!==be.CODE_STOP&&(Mt=!1),dt){case be.CODE_FNC_1:b&&(oe.length===0?oe+="]C1":oe+="");break;case be.CODE_FNC_2:case be.CODE_FNC_3:break;case be.CODE_FNC_4_B:!In&&bn?(In=!0,bn=!1):In&&bn?(In=!1,bn=!1):bn=!0;break;case be.CODE_SHIFT:ee=!0,M=be.CODE_CODE_A;break;case be.CODE_CODE_A:M=be.CODE_CODE_A;break;case be.CODE_CODE_C:M=be.CODE_CODE_C;break;case be.CODE_STOP:W=!0;break}break;case be.CODE_CODE_C:if(dt<100)dt<10&&(oe+="0"),oe+=dt;else switch(dt!==be.CODE_STOP&&(Mt=!1),dt){case be.CODE_FNC_1:b&&(oe.length===0?oe+="]C1":oe+="");break;case be.CODE_CODE_A:M=be.CODE_CODE_A;break;case be.CODE_CODE_B:M=be.CODE_CODE_B;break;case be.CODE_STOP:W=!0;break}break}El&&(M=M===be.CODE_CODE_A?be.CODE_CODE_B:be.CODE_CODE_A)}const ns=Se-ye;if(Se=p.getNextUnset(Se),!p.isRange(Se,Math.min(p.getSize(),Se+(Se-ye)/2),!1))throw new re;if(Wt-=qt*Ye,Wt%103!==Ye)throw new A;const Da=oe.length;if(Da===0)throw new re;Da>0&&Mt&&(M===be.CODE_CODE_C?oe=oe.substring(0,Da-2):oe=oe.substring(0,Da-1));const Ys=(v[1]+v[0])/2,pi=ye+ns/2,js=P.length,ga=new Uint8Array(js);for(let El=0;Elg&&(v=P);g=v,b=0;let E=0,_=0;for(let P=0;Pg&&(_|=1<0;P++){let M=u[P];if(M>g&&(b--,M*2>=E))return-1}return _}}while(b>3);return-1}static patternToChar(u){for(let p=0;p="A"&&E<="Z")_=String.fromCharCode(E.charCodeAt(0)+32);else throw new B;break;case"$":if(E>="A"&&E<="Z")_=String.fromCharCode(E.charCodeAt(0)-64);else throw new B;break;case"%":if(E>="A"&&E<="E")_=String.fromCharCode(E.charCodeAt(0)-38);else if(E>="F"&&E<="J")_=String.fromCharCode(E.charCodeAt(0)-11);else if(E>="K"&&E<="O")_=String.fromCharCode(E.charCodeAt(0)+16);else if(E>="P"&&E<="T")_=String.fromCharCode(E.charCodeAt(0)+43);else if(E==="U")_="\0";else if(E==="V")_="@";else if(E==="W")_="`";else if(E==="X"||E==="Y"||E==="Z")_="";else throw new B;break;case"/":if(E>="A"&&E<="O")_=String.fromCharCode(E.charCodeAt(0)-32);else if(E==="Z")_=":";else throw new B;break}g+=_,b++}else g+=v}return g}}Pe.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",Pe.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],Pe.ASTERISK_ENCODING=148;class $e extends Gr{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(u,p,g){let b=this.decodeStart(p),v=this.decodeEnd(p),E=new K;$e.decodeMiddle(p,b[1],v[0],E);let _=E.toString(),P=null;g!=null&&(P=g.get(q.ALLOWED_LENGTHS)),P==null&&(P=$e.DEFAULT_ALLOWED_LENGTHS);let M=_.length,W=!1,ee=0;for(let Se of P){if(M===Se){W=!0;break}Se>ee&&(ee=Se)}if(!W&&M>ee&&(W=!0),!W)throw new B;const oe=[new Ot(b[1],u),new Ot(v[0],u)];return new qe(_,null,0,oe,Fe.ITF,new Date().getTime())}static decodeMiddle(u,p,g,b){let v=new Int32Array(10),E=new Int32Array(5),_=new Int32Array(5);for(v.fill(0),E.fill(0),_.fill(0);p0&&b>=0&&!u.get(b);b--)g--;if(g!==0)throw new re}static skipWhiteSpace(u){const p=u.getSize(),g=u.getNextSet(0);if(g===p)throw new re;return g}decodeEnd(u){u.reverse();try{let p=$e.skipWhiteSpace(u),g;try{g=$e.findGuardPattern(u,p,$e.END_PATTERN_REVERSED[0])}catch(v){v instanceof re&&(g=$e.findGuardPattern(u,p,$e.END_PATTERN_REVERSED[1]))}this.validateQuietZone(u,g[0]);let b=g[0];return g[0]=u.getSize()-g[1],g[1]=u.getSize()-b,g}finally{u.reverse()}}static findGuardPattern(u,p,g){let b=g.length,v=new Int32Array(b),E=u.getSize(),_=!1,P=0,M=p;v.fill(0);for(let W=p;W=0)return g%10;throw new re}}$e.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],$e.MAX_AVG_VARIANCE=.38,$e.MAX_INDIVIDUAL_VARIANCE=.5,$e.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],$e.START_PATTERN=Int32Array.from([1,1,1,1]),$e.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class ct extends Gr{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(u){let p=!1,g,b=0,v=Int32Array.from([0,0,0]);for(;!p;){v=Int32Array.from([0,0,0]),g=ct.findGuardPattern(u,b,!1,this.START_END_PATTERN,v);let E=g[0];b=g[1];let _=E-(b-E);_>=0&&(p=u.isRange(_,E,!1))}return g}static checkChecksum(u){return ct.checkStandardUPCEANChecksum(u)}static checkStandardUPCEANChecksum(u){let p=u.length;if(p===0)return!1;let g=parseInt(u.charAt(p-1),10);return ct.getStandardUPCEANChecksum(u.substring(0,p-1))===g}static getStandardUPCEANChecksum(u){let p=u.length,g=0;for(let b=p-1;b>=0;b-=2){let v=u.charAt(b).charCodeAt(0)-48;if(v<0||v>9)throw new B;g+=v}g*=3;for(let b=p-2;b>=0;b-=2){let v=u.charAt(b).charCodeAt(0)-48;if(v<0||v>9)throw new B;g+=v}return(1e3-g)%10}static decodeEnd(u,p){return ct.findGuardPattern(u,p,!1,ct.START_END_PATTERN,new Int32Array(ct.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(u,p,g,b){return this.findGuardPattern(u,p,g,b,new Int32Array(b.length))}static findGuardPattern(u,p,g,b,v){let E=u.getSize();p=g?u.getNextUnset(p):u.getNextSet(p);let _=0,P=p,M=b.length,W=g;for(let ee=p;ee=0)return E;throw new re}}ct.MAX_AVG_VARIANCE=.48,ct.MAX_INDIVIDUAL_VARIANCE=.7,ct.START_END_PATTERN=Int32Array.from([1,1,1]),ct.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),ct.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),ct.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class yr{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(u,p,g){let b=this.decodeRowStringBuffer,v=this.decodeMiddle(p,g,b),E=b.toString(),_=yr.parseExtensionString(E),P=[new Ot((g[0]+g[1])/2,u),new Ot(v,u)],M=new qe(E,null,0,P,Fe.UPC_EAN_EXTENSION,new Date().getTime());return _!=null&&M.putAllMetadata(_),M}decodeMiddle(u,p,g){let b=this.decodeMiddleCounters;b[0]=0,b[1]=0,b[2]=0,b[3]=0;let v=u.getSize(),E=p[1],_=0;for(let M=0;M<5&&E=10&&(_|=1<<4-M),M!==4&&(E=u.getNextSet(E),E=u.getNextUnset(E))}if(g.length!==5)throw new re;let P=this.determineCheckDigit(_);if(yr.extensionChecksum(g.toString())!==P)throw new re;return E}static extensionChecksum(u){let p=u.length,g=0;for(let b=p-2;b>=0;b-=2)g+=u.charAt(b).charCodeAt(0)-48;g*=3;for(let b=p-1;b>=0;b-=2)g+=u.charAt(b).charCodeAt(0)-48;return g*=3,g%10}determineCheckDigit(u){for(let p=0;p<10;p++)if(u===this.CHECK_DIGIT_ENCODINGS[p])return p;throw new re}static parseExtensionString(u){if(u.length!==5)return null;let p=yr.parseExtension5String(u);return p==null?null:new Map([[Pt.SUGGESTED_PRICE,p]])}static parseExtension5String(u){let p;switch(u.charAt(0)){case"0":p="£";break;case"5":p="$";break;case"9":switch(u){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}p="";break;default:p="";break}let g=parseInt(u.substring(1)),b=(g/100).toString(),v=g%100,E=v<10?"0"+v:v.toString();return p+b+"."+E}}class Lt{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(u,p,g){let b=this.decodeRowStringBuffer,v=this.decodeMiddle(p,g,b),E=b.toString(),_=Lt.parseExtensionString(E),P=[new Ot((g[0]+g[1])/2,u),new Ot(v,u)],M=new qe(E,null,0,P,Fe.UPC_EAN_EXTENSION,new Date().getTime());return _!=null&&M.putAllMetadata(_),M}decodeMiddle(u,p,g){let b=this.decodeMiddleCounters;b[0]=0,b[1]=0,b[2]=0,b[3]=0;let v=u.getSize(),E=p[1],_=0;for(let P=0;P<2&&E=10&&(_|=1<<1-P),P!==1&&(E=u.getNextSet(E),E=u.getNextUnset(E))}if(g.length!==2)throw new re;if(parseInt(g.toString())%4!==_)throw new re;return E}static parseExtensionString(u){return u.length!==2?null:new Map([[Pt.ISSUE_NUMBER,parseInt(u)]])}}class Lr{static decodeRow(u,p,g){let b=ct.findGuardPattern(p,g,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new yr().decodeRow(u,p,b)}catch{return new Lt().decodeRow(u,p,b)}}}Lr.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class ir extends ct{constructor(){super(),this.decodeRowStringBuffer="",ir.L_AND_G_PATTERNS=ir.L_PATTERNS.map(u=>Int32Array.from(u));for(let u=10;u<20;u++){let p=ir.L_PATTERNS[u-10],g=new Int32Array(p.length);for(let b=0;b=p.getSize()||!p.isRange(W,ee,!1))throw new re;let oe=P.toString();if(oe.length<8)throw new B;if(!ir.checkChecksum(oe))throw new A;let ye=(b[1]+b[0])/2,Se=(M[1]+M[0])/2,Te=this.getBarcodeFormat(),Ye=[new Ot(ye,u),new Ot(Se,u)],dt=new qe(oe,null,0,Ye,Te,new Date().getTime()),Wt=0;try{let Mt=Lr.decodeRow(u,p,M[1]);dt.putMetadata(Pt.UPC_EAN_EXTENSION,Mt.getText()),dt.putAllMetadata(Mt.getResultMetadata()),dt.addResultPoints(Mt.getResultPoints()),Wt=Mt.getText().length}catch{}let qt=g==null?null:g.get(q.ALLOWED_EAN_EXTENSIONS);if(qt!=null){let Mt=!1;for(let In in qt)if(Wt.toString()===In){Mt=!0;break}if(!Mt)throw new re}return dt}decodeEnd(u,p){return ir.findGuardPattern(u,p,!1,ir.START_END_PATTERN,new Int32Array(ir.START_END_PATTERN.length).fill(0))}static checkChecksum(u){return ir.checkStandardUPCEANChecksum(u)}static checkStandardUPCEANChecksum(u){let p=u.length;if(p===0)return!1;let g=parseInt(u.charAt(p-1),10);return ir.getStandardUPCEANChecksum(u.substring(0,p-1))===g}static getStandardUPCEANChecksum(u){let p=u.length,g=0;for(let b=p-1;b>=0;b-=2){let v=u.charAt(b).charCodeAt(0)-48;if(v<0||v>9)throw new B;g+=v}g*=3;for(let b=p-2;b>=0;b-=2){let v=u.charAt(b).charCodeAt(0)-48;if(v<0||v>9)throw new B;g+=v}return(1e3-g)%10}}class pr extends ir{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(u,p,g){let b=this.decodeMiddleCounters;b[0]=0,b[1]=0,b[2]=0,b[3]=0;let v=u.getSize(),E=p[1],_=0;for(let M=0;M<6&&E=10&&(_|=1<<5-M)}g=pr.determineFirstDigit(g,_),E=ir.findGuardPattern(u,E,!0,ir.MIDDLE_PATTERN,new Int32Array(ir.MIDDLE_PATTERN.length).fill(0))[1];for(let M=0;M<6&&EM);b[0]=0,b[1]=0,b[2]=0,b[3]=0;const v=u.getSize();let E=p[1],_=0;for(let M=0;M<6&&E=10&&(_|=1<<5-M)}let P=de.determineNumSysAndCheckDigit(g,_);return{rowOffset:E,resultString:P}}decodeEnd(u,p){return de.findGuardPatternWithoutCounters(u,p,!0,de.MIDDLE_END_PATTERN)}checkChecksum(u){return ir.checkChecksum(de.convertUPCEtoUPCA(u))}static determineNumSysAndCheckDigit(u,p){for(let g=0;g<=1;g++)for(let b=0;b<10;b++)if(p===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[g][b]){let v=String.fromCharCode(48+g),E=String.fromCharCode(48+b);return v+u+E}throw re.getNotFoundInstance()}getBarcodeFormat(){return Fe.UPC_E}static convertUPCEtoUPCA(u){const p=u.slice(1,7).split("").map(v=>v.charCodeAt(0)),g=new K;g.append(u.charAt(0));let b=p[5];switch(b){case 0:case 1:case 2:g.appendChars(p,0,2),g.append(b),g.append("0000"),g.appendChars(p,2,3);break;case 3:g.appendChars(p,0,3),g.append("00000"),g.appendChars(p,3,2);break;case 4:g.appendChars(p,0,4),g.append("00000"),g.append(p[4]);break;default:g.appendChars(p,0,5),g.append("0000"),g.append(b);break}return u.length>=8&&g.append(u.charAt(7)),g.toString()}}de.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),de.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class ke extends Gr{constructor(u){super();let p=u==null?null:u.get(q.POSSIBLE_FORMATS),g=[];n(p)?(g.push(new pr),g.push(new ln),g.push(new br),g.push(new de)):(p.indexOf(Fe.EAN_13)>-1&&g.push(new pr),p.indexOf(Fe.UPC_A)>-1&&g.push(new ln),p.indexOf(Fe.EAN_8)>-1&&g.push(new br),p.indexOf(Fe.UPC_E)>-1&&g.push(new de)),this.readers=g}decodeRow(u,p,g){for(let b of this.readers)try{const v=b.decodeRow(u,p,g),E=v.getBarcodeFormat()===Fe.EAN_13&&v.getText().charAt(0)==="0",_=g==null?null:g.get(q.POSSIBLE_FORMATS),P=_==null||_.includes(Fe.UPC_A);if(E&&P){const M=v.getRawBytes(),W=new qe(v.getText().substring(1),M,M?M.length:null,v.getResultPoints(),Fe.UPC_A);return W.putAllMetadata(v.getResultMetadata()),W}return v}catch{}throw new re}reset(){for(let u of this.readers)u.reset()}}class Ze extends Gr{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(u,p){for(let g=0;gb&&(b=p[v],g=v);u[g]++}static decrement(u,p){let g=0,b=p[0];for(let v=1;v=Ze.MIN_FINDER_PATTERN_RATIO&&b<=Ze.MAX_FINDER_PATTERN_RATIO){let v=Number.MAX_SAFE_INTEGER,E=Number.MIN_SAFE_INTEGER;for(let _ of u)_>E&&(E=_),_=_-P-1&&(W-=gr.combins(b-M-(_-P),_-P-2)),_-P-1>1){let ee=0;for(let oe=b-M-(_-P-2);oe>p;oe--)ee+=gr.combins(b-M-oe-1,_-P-3);W-=ee*(_-1-P)}else b-M>p&&W--;v+=W}b-=M}return v}static combins(u,p){let g,b;u-p>p?(b=p,g=u-p):(b=u-p,g=p);let v=1,E=1;for(let _=u;_>g;_--)v*=_,E<=b&&(v/=E,E++);for(;E<=b;)v/=E,E++;return v}}class Cr{static buildBitArray(u){let p=u.length*2-1;u[u.length-1].getRightChar()==null&&(p-=1);let g=12*p,b=new G(g),v=0,_=u[0].getRightChar().getValue();for(let P=11;P>=0;--P)(_&1<=0;--ee)(W&1<=0;--oe)(ee&1<10||g<0||g>10)throw new B;this.firstDigit=p,this.secondDigit=g}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===ar.FNC1}isSecondDigitFNC1(){return this.secondDigit===ar.FNC1}isAnyFNC1(){return this.firstDigit===ar.FNC1||this.secondDigit===ar.FNC1}}ar.FNC1=10;class ft{constructor(){}static parseFieldsInGeneralPurpose(u){if(!u)return null;if(u.length<2)throw new re;let p=u.substring(0,2);for(let v of ft.TWO_DIGIT_DATA_LENGTH)if(v[0]===p)return v[1]===ft.VARIABLE_LENGTH?ft.processVariableAI(2,v[2],u):ft.processFixedAI(2,v[1],u);if(u.length<3)throw new re;let g=u.substring(0,3);for(let v of ft.THREE_DIGIT_DATA_LENGTH)if(v[0]===g)return v[1]===ft.VARIABLE_LENGTH?ft.processVariableAI(3,v[2],u):ft.processFixedAI(3,v[1],u);for(let v of ft.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(v[0]===g)return v[1]===ft.VARIABLE_LENGTH?ft.processVariableAI(4,v[2],u):ft.processFixedAI(4,v[1],u);if(u.length<4)throw new re;let b=u.substring(0,4);for(let v of ft.FOUR_DIGIT_DATA_LENGTH)if(v[0]===b)return v[1]===ft.VARIABLE_LENGTH?ft.processVariableAI(4,v[2],u):ft.processFixedAI(4,v[1],u);throw new re}static processFixedAI(u,p,g){if(g.lengththis.information.getSize())return u+4<=this.information.getSize();for(let p=u;pthis.information.getSize()){let v=this.extractNumericValueFromBitArray(u,4);return v===0?new ar(this.information.getSize(),ar.FNC1,ar.FNC1):new ar(this.information.getSize(),v-1,ar.FNC1)}let p=this.extractNumericValueFromBitArray(u,7),g=(p-8)/11,b=(p-8)%11;return new ar(u+7,g,b)}extractNumericValueFromBitArray(u,p){return mr.extractNumericValueFromBitArray(this.information,u,p)}static extractNumericValueFromBitArray(u,p,g){let b=0;for(let v=0;vthis.information.getSize())return!1;let p=this.extractNumericValueFromBitArray(u,5);if(p>=5&&p<16)return!0;if(u+7>this.information.getSize())return!1;let g=this.extractNumericValueFromBitArray(u,7);if(g>=64&&g<116)return!0;if(u+8>this.information.getSize())return!1;let b=this.extractNumericValueFromBitArray(u,8);return b>=232&&b<253}decodeIsoIec646(u){let p=this.extractNumericValueFromBitArray(u,5);if(p===15)return new _t(u+5,_t.FNC1);if(p>=5&&p<15)return new _t(u+5,"0"+(p-5));let g=this.extractNumericValueFromBitArray(u,7);if(g>=64&&g<90)return new _t(u+7,""+(g+1));if(g>=90&&g<116)return new _t(u+7,""+(g+7));let b=this.extractNumericValueFromBitArray(u,8),v;switch(b){case 232:v="!";break;case 233:v='"';break;case 234:v="%";break;case 235:v="&";break;case 236:v="'";break;case 237:v="(";break;case 238:v=")";break;case 239:v="*";break;case 240:v="+";break;case 241:v=",";break;case 242:v="-";break;case 243:v=".";break;case 244:v="/";break;case 245:v=":";break;case 246:v=";";break;case 247:v="<";break;case 248:v="=";break;case 249:v=">";break;case 250:v="?";break;case 251:v="_";break;case 252:v=" ";break;default:throw new B}return new _t(u+8,v)}isStillAlpha(u){if(u+5>this.information.getSize())return!1;let p=this.extractNumericValueFromBitArray(u,5);if(p>=5&&p<16)return!0;if(u+6>this.information.getSize())return!1;let g=this.extractNumericValueFromBitArray(u,6);return g>=16&&g<63}decodeAlphanumeric(u){let p=this.extractNumericValueFromBitArray(u,5);if(p===15)return new _t(u+5,_t.FNC1);if(p>=5&&p<15)return new _t(u+5,"0"+(p-5));let g=this.extractNumericValueFromBitArray(u,6);if(g>=32&&g<58)return new _t(u+6,""+(g+33));let b;switch(g){case 58:b="*";break;case 59:b=",";break;case 60:b="-";break;case 61:b=".";break;case 62:b="/";break;default:throw new cr("Decoding invalid alphanumeric value: "+g)}return new _t(u+6,b)}isAlphaTo646ToAlphaLatch(u){if(u+1>this.information.getSize())return!1;for(let p=0;p<5&&p+uthis.information.getSize())return!1;for(let p=u;pthis.information.getSize())return!1;for(let p=0;p<4&&p+u{p.forEach(E=>{b.getLeftChar().getValue()===E.getLeftChar().getValue()&&b.getRightChar().getValue()===E.getRightChar().getValue()&&b.getFinderPatter().getValue()===E.getFinderPatter().getValue()&&(g=!0)})}),g}}class At extends Ze{constructor(u){super(...arguments),this.pairs=new Array(At.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=u===!0}decodeRow(u,p,g){this.pairs.length=0,this.startFromEven=!1;try{return At.constructResult(this.decodeRow2pairs(u,p))}catch(b){this.verbose&&console.log(b)}return this.pairs.length=0,this.startFromEven=!0,At.constructResult(this.decodeRow2pairs(u,p))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(u,p){let g=!1;for(;!g;)try{this.pairs.push(this.retrieveNextPair(p,this.pairs,u))}catch(v){if(v instanceof re){if(!this.pairs.length)throw new re;g=!0}}if(this.checkChecksum())return this.pairs;let b;if(this.rows.length?b=!0:b=!1,this.storeRow(u,!1),b){let v=this.checkRowsBoolean(!1);if(v!=null||(v=this.checkRowsBoolean(!0),v!=null))return v}throw new re}checkRowsBoolean(u){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,u&&(this.rows=this.rows.reverse());let p=null;try{p=this.checkRows(new Array,0)}catch(g){this.verbose&&console.log(g)}return u&&(this.rows=this.rows.reverse()),p}checkRows(u,p){for(let g=p;gp.length)continue;let g=!0;for(let b=0;bu){v=E.isEquivalent(this.pairs);break}b=E.isEquivalent(this.pairs),g++}v||b||At.isPartialRow(this.pairs,this.rows)||(this.rows.push(g,new ci(this.pairs,u,p)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(u,p){for(let g of p)if(g.getPairs().length!==u.length){for(let b of g.getPairs())for(let v of u)if(bi.equals(b,v))break}}static isPartialRow(u,p){for(let g of p){let b=!0;for(let v of u){let E=!1;for(let _ of g.getPairs())if(v.equals(_)){E=!0;break}if(!E){b=!1;break}}if(b)return!0}return!1}getRows(){return this.rows}static constructResult(u){let p=Cr.buildBitArray(u),b=Xn(p).parseInformation(),v=u[0].getFinderPattern().getResultPoints(),E=u[u.length-1].getFinderPattern().getResultPoints(),_=[v[0],v[1],E[0],E[1]];return new qe(b,null,null,_,Fe.RSS_EXPANDED,null)}checkChecksum(){let u=this.pairs.get(0),p=u.getLeftChar(),g=u.getRightChar();if(g==null)return!1;let b=g.getChecksumPortion(),v=2;for(let _=1;_=0?E=g:this.isEmptyPair(p)?E=0:E=p[p.length-1].getFinderPattern().getStartEnd()[1];let _=p.length%2!=0;this.startFromEven&&(_=!_);let P=!1;for(;E=0&&!u.get(M);)M--;M++,b=this.startEnd[0]-M,v=M,E=this.startEnd[1]}else v=this.startEnd[0],E=u.getNextUnset(this.startEnd[1]+1),b=E-this.startEnd[1];let _=this.getDecodeFinderCounters();j.arraycopy(_,0,_,1,_.length-1),_[0]=b;let P;try{P=this.parseFinderValue(_,At.FINDER_PATTERNS)}catch{return null}return new Fr(P,[v,E],v,E,p)}decodeDataCharacter(u,p,g,b){let v=this.getDataCharacterCounters();for(let pi=0;pi.3)throw new re;let M=this.getOddCounts(),W=this.getEvenCounts(),ee=this.getOddRoundingErrors(),oe=this.getEvenRoundingErrors();for(let pi=0;pi8){if(js>8.7)throw new re;ga=8}let kc=pi/2;(pi&1)==0?(M[kc]=ga,ee[kc]=js-ga):(W[kc]=ga,oe[kc]=js-ga)}this.adjustOddEvenCounts(E);let ye=4*p.getValue()+(g?0:2)+(b?0:1)-1,Se=0,Te=0;for(let pi=M.length-1;pi>=0;pi--){if(At.isNotA1left(p,g,b)){let js=At.WEIGHTS[ye][2*pi];Te+=M[pi]*js}Se+=M[pi]}let Ye=0;for(let pi=W.length-1;pi>=0;pi--)if(At.isNotA1left(p,g,b)){let js=At.WEIGHTS[ye][2*pi+1];Ye+=W[pi]*js}let dt=Te+Ye;if((Se&1)!=0||Se>13||Se<4)throw new re;let Wt=(13-Se)/2,qt=At.SYMBOL_WIDEST[Wt],Mt=9-qt,In=gr.getRSSvalue(M,qt,!0),bn=gr.getRSSvalue(W,Mt,!1),ns=At.EVEN_TOTAL_SUBSET[Wt],Da=At.GSUM[Wt],Ys=In*ns+bn+Da;return new Ft(Ys,dt)}static isNotA1left(u,p,g){return!(u.getValue()==0&&p&&g)}adjustOddEvenCounts(u){let p=Xe.sum(new Int32Array(this.getOddCounts())),g=Xe.sum(new Int32Array(this.getEvenCounts())),b=!1,v=!1;p>13?v=!0:p<4&&(b=!0);let E=!1,_=!1;g>13?_=!0:g<4&&(E=!0);let P=p+g-u,M=(p&1)==1,W=(g&1)==0;if(P==1)if(M){if(W)throw new re;v=!0}else{if(!W)throw new re;_=!0}else if(P==-1)if(M){if(W)throw new re;b=!0}else{if(!W)throw new re;E=!0}else if(P==0){if(M){if(!W)throw new re;p1){for(let _ of this.possibleRightPairs)if(_.getCount()>1&&Un.checkChecksum(E,_))return Un.constructResult(E,_)}throw new re}static addOrTally(u,p){if(p==null)return;let g=!1;for(let b of u)if(b.getValue()===p.getValue()){b.incrementCount(),g=!0;break}g||u.push(p)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(u,p){let g=4537077*u.getValue()+p.getValue(),b=new String(g).toString(),v=new K;for(let M=13-b.length;M>0;M--)v.append("0");v.append(b);let E=0;for(let M=0;M<13;M++){let W=v.charAt(M).charCodeAt(0)-48;E+=(M&1)===0?3*W:W}E=10-E%10,E===10&&(E=0),v.append(E.toString());let _=u.getFinderPattern().getResultPoints(),P=p.getFinderPattern().getResultPoints();return new qe(v.toString(),null,0,[_[0],_[1],P[0],P[1]],Fe.RSS_14,new Date().getTime())}static checkChecksum(u,p){let g=(u.getChecksumPortion()+16*p.getChecksumPortion())%79,b=9*u.getFinderPattern().getValue()+p.getFinderPattern().getValue();return b>72&&b--,b>8&&b--,g===b}decodePair(u,p,g,b){try{let v=this.findFinderPattern(u,p),E=this.parseFoundFinderPattern(u,g,p,v),_=b==null?null:b.get(q.NEED_RESULT_POINT_CALLBACK);if(_!=null){let W=(v[0]+v[1])/2;p&&(W=u.getSize()-1-W),_.foundPossibleResultPoint(new Ot(W,g))}let P=this.decodeDataCharacter(u,E,!0),M=this.decodeDataCharacter(u,E,!1);return new ha(1597*P.getValue()+M.getValue(),P.getChecksumPortion()+4*M.getChecksumPortion(),E)}catch{return null}}decodeDataCharacter(u,p,g){let b=this.getDataCharacterCounters();for(let Ye=0;Ye8&&(Wt=8);let qt=Math.floor(Ye/2);(Ye&1)===0?(_[qt]=Wt,M[qt]=dt-Wt):(P[qt]=Wt,W[qt]=dt-Wt)}this.adjustOddEvenCounts(g,v);let ee=0,oe=0;for(let Ye=_.length-1;Ye>=0;Ye--)oe*=9,oe+=_[Ye],ee+=_[Ye];let ye=0,Se=0;for(let Ye=P.length-1;Ye>=0;Ye--)ye*=9,ye+=P[Ye],Se+=P[Ye];let Te=oe+3*ye;if(g){if((ee&1)!==0||ee>12||ee<4)throw new re;let Ye=(12-ee)/2,dt=Un.OUTSIDE_ODD_WIDEST[Ye],Wt=9-dt,qt=gr.getRSSvalue(_,dt,!1),Mt=gr.getRSSvalue(P,Wt,!0),In=Un.OUTSIDE_EVEN_TOTAL_SUBSET[Ye],bn=Un.OUTSIDE_GSUM[Ye];return new Ft(qt*In+Mt+bn,Te)}else{if((Se&1)!==0||Se>10||Se<4)throw new re;let Ye=(10-Se)/2,dt=Un.INSIDE_ODD_WIDEST[Ye],Wt=9-dt,qt=gr.getRSSvalue(_,dt,!0),Mt=gr.getRSSvalue(P,Wt,!1),In=Un.INSIDE_ODD_TOTAL_SUBSET[Ye],bn=Un.INSIDE_GSUM[Ye];return new Ft(Mt*In+qt+bn,Te)}}findFinderPattern(u,p){let g=this.getDecodeFinderCounters();g[0]=0,g[1]=0,g[2]=0,g[3]=0;let b=u.getSize(),v=!1,E=0;for(;E=0&&v!==u.get(E);)E--;E++;const _=b[0]-E,P=this.getDecodeFinderCounters(),M=new Int32Array(P.length);j.arraycopy(P,0,M,1,P.length-1),M[0]=_;const W=this.parseFinderValue(M,Un.FINDER_PATTERNS);let ee=E,oe=b[1];return g&&(ee=u.getSize()-1-ee,oe=u.getSize()-1-oe),new Fr(W,[E,b[1]],ee,oe,p)}adjustOddEvenCounts(u,p){let g=Xe.sum(new Int32Array(this.getOddCounts())),b=Xe.sum(new Int32Array(this.getEvenCounts())),v=!1,E=!1,_=!1,P=!1;u?(g>12?E=!0:g<4&&(v=!0),b>12?P=!0:b<4&&(_=!0)):(g>11?E=!0:g<5&&(v=!0),b>10?P=!0:b<4&&(_=!0));let M=g+b-p,W=(g&1)===(u?1:0),ee=(b&1)===1;if(M===1)if(W){if(ee)throw new re;E=!0}else{if(!ee)throw new re;P=!0}else if(M===-1)if(W){if(ee)throw new re;v=!0}else{if(!ee)throw new re;_=!0}else if(M===0){if(W){if(!ee)throw new re;gu.reset())}}class Wa extends ae{constructor(u=500,p){super(new ts(p),u,p)}}class En{constructor(u,p,g){this.ecCodewords=u,this.ecBlocks=[p],g&&this.ecBlocks.push(g)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class jn{constructor(u,p){this.count=u,this.dataCodewords=p}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class an{constructor(u,p,g,b,v,E){this.versionNumber=u,this.symbolSizeRows=p,this.symbolSizeColumns=g,this.dataRegionSizeRows=b,this.dataRegionSizeColumns=v,this.ecBlocks=E;let _=0;const P=E.getECCodewords(),M=E.getECBlocks();for(let W of M)_+=W.getCount()*(W.getDataCodewords()+P);this.totalCodewords=_}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(u,p){if((u&1)!==0||(p&1)!==0)throw new B;for(let g of an.VERSIONS)if(g.symbolSizeRows===u&&g.symbolSizeColumns===p)return g;throw new B}toString(){return""+this.versionNumber}static buildVersions(){return[new an(1,10,10,8,8,new En(5,new jn(1,3))),new an(2,12,12,10,10,new En(7,new jn(1,5))),new an(3,14,14,12,12,new En(10,new jn(1,8))),new an(4,16,16,14,14,new En(12,new jn(1,12))),new an(5,18,18,16,16,new En(14,new jn(1,18))),new an(6,20,20,18,18,new En(18,new jn(1,22))),new an(7,22,22,20,20,new En(20,new jn(1,30))),new an(8,24,24,22,22,new En(24,new jn(1,36))),new an(9,26,26,24,24,new En(28,new jn(1,44))),new an(10,32,32,14,14,new En(36,new jn(1,62))),new an(11,36,36,16,16,new En(42,new jn(1,86))),new an(12,40,40,18,18,new En(48,new jn(1,114))),new an(13,44,44,20,20,new En(56,new jn(1,144))),new an(14,48,48,22,22,new En(68,new jn(1,174))),new an(15,52,52,24,24,new En(42,new jn(2,102))),new an(16,64,64,14,14,new En(56,new jn(2,140))),new an(17,72,72,16,16,new En(36,new jn(4,92))),new an(18,80,80,18,18,new En(48,new jn(4,114))),new an(19,88,88,20,20,new En(56,new jn(4,144))),new an(20,96,96,22,22,new En(68,new jn(4,174))),new an(21,104,104,24,24,new En(56,new jn(6,136))),new an(22,120,120,18,18,new En(68,new jn(6,175))),new an(23,132,132,20,20,new En(62,new jn(8,163))),new an(24,144,144,22,22,new En(62,new jn(8,156),new jn(2,155))),new an(25,8,18,6,16,new En(7,new jn(1,5))),new an(26,8,32,6,14,new En(11,new jn(1,10))),new an(27,12,26,10,24,new En(14,new jn(1,16))),new an(28,12,36,10,16,new En(18,new jn(1,22))),new an(29,16,36,14,16,new En(24,new jn(1,32))),new an(30,16,48,14,22,new En(28,new jn(1,49)))]}}an.VERSIONS=an.buildVersions();class De{constructor(u){const p=u.getHeight();if(p<8||p>144||(p&1)!==0)throw new B;this.version=De.readVersion(u),this.mappingBitMatrix=this.extractDataRegion(u),this.readMappingMatrix=new me(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(u){const p=u.getHeight(),g=u.getWidth();return an.getVersionForDimensions(p,g)}readCodewords(){const u=new Int8Array(this.version.getTotalCodewords());let p=0,g=4,b=0;const v=this.mappingBitMatrix.getHeight(),E=this.mappingBitMatrix.getWidth();let _=!1,P=!1,M=!1,W=!1;do if(g===v&&b===0&&!_)u[p++]=this.readCorner1(v,E)&255,g-=2,b+=2,_=!0;else if(g===v-2&&b===0&&(E&3)!==0&&!P)u[p++]=this.readCorner2(v,E)&255,g-=2,b+=2,P=!0;else if(g===v+4&&b===2&&(E&7)===0&&!M)u[p++]=this.readCorner3(v,E)&255,g-=2,b+=2,M=!0;else if(g===v-2&&b===0&&(E&7)===4&&!W)u[p++]=this.readCorner4(v,E)&255,g-=2,b+=2,W=!0;else{do g=0&&!this.readMappingMatrix.get(b,g)&&(u[p++]=this.readUtah(g,b,v,E)&255),g-=2,b+=2;while(g>=0&&b=0&&b=0);g+=3,b+=1}while(g7?Te-1:Te;E[dt].codewords[Wt]=u[ee++]}if(ee!==u.length)throw new y;return E}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class at{constructor(u){this.bytes=u,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(u){if(u<1||u>32||u>this.available())throw new y(""+u);let p=0,g=this.bitOffset,b=this.byteOffset;const v=this.bytes;if(g>0){const E=8-g,_=u>8-_<>P,u-=_,g+=_,g===8&&(g=0,b++)}if(u>0){for(;u>=8;)p=p<<8|v[b]&255,b++,u-=8;if(u>0){const E=8-u,_=255>>E<>E,g+=u}}return this.bitOffset=g,this.byteOffset=b,p}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Et;(function(te){te[te.PAD_ENCODE=0]="PAD_ENCODE",te[te.ASCII_ENCODE=1]="ASCII_ENCODE",te[te.C40_ENCODE=2]="C40_ENCODE",te[te.TEXT_ENCODE=3]="TEXT_ENCODE",te[te.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",te[te.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",te[te.BASE256_ENCODE=6]="BASE256_ENCODE"})(Et||(Et={}));class rr{static decode(u){const p=new at(u),g=new K,b=new K,v=new Array;let E=Et.ASCII_ENCODE;do if(E===Et.ASCII_ENCODE)E=this.decodeAsciiSegment(p,g,b);else{switch(E){case Et.C40_ENCODE:this.decodeC40Segment(p,g);break;case Et.TEXT_ENCODE:this.decodeTextSegment(p,g);break;case Et.ANSIX12_ENCODE:this.decodeAnsiX12Segment(p,g);break;case Et.EDIFACT_ENCODE:this.decodeEdifactSegment(p,g);break;case Et.BASE256_ENCODE:this.decodeBase256Segment(p,g,v);break;default:throw new B}E=Et.ASCII_ENCODE}while(E!==Et.PAD_ENCODE&&p.available()>0);return b.length()>0&&g.append(b.toString()),new Ae(u,g.toString(),v.length===0?null:v,null)}static decodeAsciiSegment(u,p,g){let b=!1;do{let v=u.readBits(8);if(v===0)throw new B;if(v<=128)return b&&(v+=128),p.append(String.fromCharCode(v-1)),Et.ASCII_ENCODE;if(v===129)return Et.PAD_ENCODE;if(v<=229){const E=v-130;E<10&&p.append("0"),p.append(""+E)}else switch(v){case 230:return Et.C40_ENCODE;case 231:return Et.BASE256_ENCODE;case 232:p.append("");break;case 233:case 234:break;case 235:b=!0;break;case 236:p.append("[)>05"),g.insert(0,"");break;case 237:p.append("[)>06"),g.insert(0,"");break;case 238:return Et.ANSIX12_ENCODE;case 239:return Et.TEXT_ENCODE;case 240:return Et.EDIFACT_ENCODE;case 241:break;default:if(v!==254||u.available()!==0)throw new B;break}}while(u.available()>0);return Et.ASCII_ENCODE}static decodeC40Segment(u,p){let g=!1;const b=[];let v=0;do{if(u.available()===8)return;const E=u.readBits(8);if(E===254)return;this.parseTwoBytes(E,u.readBits(8),b);for(let _=0;_<3;_++){const P=b[_];switch(v){case 0:if(P<3)v=P+1;else if(P0)}static decodeTextSegment(u,p){let g=!1,b=[],v=0;do{if(u.available()===8)return;const E=u.readBits(8);if(E===254)return;this.parseTwoBytes(E,u.readBits(8),b);for(let _=0;_<3;_++){const P=b[_];switch(v){case 0:if(P<3)v=P+1;else if(P0)}static decodeAnsiX12Segment(u,p){const g=[];do{if(u.available()===8)return;const b=u.readBits(8);if(b===254)return;this.parseTwoBytes(b,u.readBits(8),g);for(let v=0;v<3;v++){const E=g[v];switch(E){case 0:p.append("\r");break;case 1:p.append("*");break;case 2:p.append(">");break;case 3:p.append(" ");break;default:if(E<14)p.append(String.fromCharCode(E+44));else if(E<40)p.append(String.fromCharCode(E+51));else throw new B;break}}}while(u.available()>0)}static parseTwoBytes(u,p,g){let b=(u<<8)+p-1,v=Math.floor(b/1600);g[0]=v,b-=v*1600,v=Math.floor(b/40),g[1]=v,g[2]=b-v*40}static decodeEdifactSegment(u,p){do{if(u.available()<=16)return;for(let g=0;g<4;g++){let b=u.readBits(6);if(b===31){const v=8-u.getBitOffset();v!==8&&u.readBits(v);return}(b&32)===0&&(b|=64),p.append(String.fromCharCode(b))}}while(u.available()>0)}static decodeBase256Segment(u,p,g){let b=1+u.getByteOffset();const v=this.unrandomize255State(u.readBits(8),b++);let E;if(v===0?E=u.available()/8|0:v<250?E=v:E=250*(v-249)+this.unrandomize255State(u.readBits(8),b++),E<0)throw new B;const _=new Uint8Array(E);for(let P=0;P=0?b:b+256}}rr.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],rr.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],rr.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],rr.TEXT_SHIFT2_SET_CHARS=rr.C40_SHIFT2_SET_CHARS,rr.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class Nr{constructor(){this.rsDecoder=new St(It.DATA_MATRIX_FIELD_256)}decode(u){const p=new De(u),g=p.getVersion(),b=p.readCodewords(),v=ht.getDataBlocks(b,g);let E=0;for(let M of v)E+=M.getNumDataCodewords();const _=new Uint8Array(E),P=v.length;for(let M=0;M_&&(W=_,ee[0]=p,ee[1]=g,ee[2]=b,ee[3]=v),W>P&&(W=P,ee[0]=g,ee[1]=b,ee[2]=v,ee[3]=p),W>M&&(ee[0]=b,ee[1]=v,ee[2]=p,ee[3]=g),ee}detectSolid2(u){let p=u[0],g=u[1],b=u[2],v=u[3],E=this.transitionsBetween(p,v),_=ze.shiftPoint(g,b,(E+1)*4),P=ze.shiftPoint(b,g,(E+1)*4),M=this.transitionsBetween(_,p),W=this.transitionsBetween(P,v);return Mye?W:ee}shiftToModuleCenter(u){let p=u[0],g=u[1],b=u[2],v=u[3],E=this.transitionsBetween(p,v)+1,_=this.transitionsBetween(b,v)+1,P=ze.shiftPoint(p,g,_*4),M=ze.shiftPoint(b,g,E*4);E=this.transitionsBetween(P,v)+1,_=this.transitionsBetween(M,v)+1,(E&1)===1&&(E+=1),(_&1)===1&&(_+=1);let W=(p.getX()+g.getX()+b.getX()+v.getX())/4,ee=(p.getY()+g.getY()+b.getY()+v.getY())/4;p=ze.moveAway(p,W,ee),g=ze.moveAway(g,W,ee),b=ze.moveAway(b,W,ee),v=ze.moveAway(v,W,ee);let oe,ye;return P=ze.shiftPoint(p,g,_*4),P=ze.shiftPoint(P,v,E*4),oe=ze.shiftPoint(g,p,_*4),oe=ze.shiftPoint(oe,b,E*4),M=ze.shiftPoint(b,v,_*4),M=ze.shiftPoint(M,g,E*4),ye=ze.shiftPoint(v,b,_*4),ye=ze.shiftPoint(ye,p,E*4),[P,oe,M,ye]}isValid(u){return u.getX()>=0&&u.getX()0&&u.getY()Math.abs(v-g);if(_){let Te=g;g=b,b=Te,Te=v,v=E,E=Te}let P=Math.abs(v-g),M=Math.abs(E-b),W=-P/2,ee=b0){if(Ye===E)break;Ye+=ee,W-=P}}return ye}}class Bt{constructor(){this.decoder=new Nr}decode(u,p=null){let g,b;if(p!=null&&p.has(q.PURE_BARCODE)){const M=Bt.extractPureBits(u.getBlackMatrix());g=this.decoder.decode(M),b=Bt.NO_POINTS}else{const M=new ze(u.getBlackMatrix()).detect();g=this.decoder.decode(M.getBits()),b=M.getPoints()}const v=g.getRawBytes(),E=new qe(g.getText(),v,8*v.length,b,Fe.DATA_MATRIX,j.currentTimeMillis()),_=g.getByteSegments();_!=null&&E.putMetadata(Pt.BYTE_SEGMENTS,_);const P=g.getECLevel();return P!=null&&E.putMetadata(Pt.ERROR_CORRECTION_LEVEL,P),E}reset(){}static extractPureBits(u){const p=u.getTopLeftOnBit(),g=u.getBottomRightOnBit();if(p==null||g==null)throw new re;const b=this.moduleSize(p,u);let v=p[1];const E=g[1];let _=p[0];const M=(g[0]-_+1)/b,W=(E-v+1)/b;if(M<=0||W<=0)throw new re;const ee=b/2;v+=ee,_+=ee;const oe=new me(M,W);for(let ye=0;ye=_r.FOR_BITS.size)throw new y;return _r.FOR_BITS.get(u)}}_r.FOR_BITS=new Map,_r.FOR_VALUE=new Map,_r.L=new _r(jr.L,"L",1),_r.M=new _r(jr.M,"M",0),_r.Q=new _r(jr.Q,"Q",3),_r.H=new _r(jr.H,"H",2);class _n{constructor(u){this.errorCorrectionLevel=_r.forBits(u>>3&3),this.dataMask=u&7}static numBitsDiffering(u,p){return U.bitCount(u^p)}static decodeFormatInformation(u,p){const g=_n.doDecodeFormatInformation(u,p);return g!==null?g:_n.doDecodeFormatInformation(u^_n.FORMAT_INFO_MASK_QR,p^_n.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(u,p){let g=Number.MAX_SAFE_INTEGER,b=0;for(const v of _n.FORMAT_INFO_DECODE_LOOKUP){const E=v[0];if(E===u||E===p)return new _n(v[1]);let _=_n.numBitsDiffering(u,E);_40)throw new y;return ur.VERSIONS[u-1]}static decodeVersionInformation(u){let p=Number.MAX_SAFE_INTEGER,g=0;for(let b=0;b6&&(p.setRegion(u-11,0,3,6),p.setRegion(0,u-11,6,3)),p}toString(){return""+this.versionNumber}}ur.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),ur.VERSIONS=[new ur(1,new Int32Array(0),new Be(7,new pe(1,19)),new Be(10,new pe(1,16)),new Be(13,new pe(1,13)),new Be(17,new pe(1,9))),new ur(2,Int32Array.from([6,18]),new Be(10,new pe(1,34)),new Be(16,new pe(1,28)),new Be(22,new pe(1,22)),new Be(28,new pe(1,16))),new ur(3,Int32Array.from([6,22]),new Be(15,new pe(1,55)),new Be(26,new pe(1,44)),new Be(18,new pe(2,17)),new Be(22,new pe(2,13))),new ur(4,Int32Array.from([6,26]),new Be(20,new pe(1,80)),new Be(18,new pe(2,32)),new Be(26,new pe(2,24)),new Be(16,new pe(4,9))),new ur(5,Int32Array.from([6,30]),new Be(26,new pe(1,108)),new Be(24,new pe(2,43)),new Be(18,new pe(2,15),new pe(2,16)),new Be(22,new pe(2,11),new pe(2,12))),new ur(6,Int32Array.from([6,34]),new Be(18,new pe(2,68)),new Be(16,new pe(4,27)),new Be(24,new pe(4,19)),new Be(28,new pe(4,15))),new ur(7,Int32Array.from([6,22,38]),new Be(20,new pe(2,78)),new Be(18,new pe(4,31)),new Be(18,new pe(2,14),new pe(4,15)),new Be(26,new pe(4,13),new pe(1,14))),new ur(8,Int32Array.from([6,24,42]),new Be(24,new pe(2,97)),new Be(22,new pe(2,38),new pe(2,39)),new Be(22,new pe(4,18),new pe(2,19)),new Be(26,new pe(4,14),new pe(2,15))),new ur(9,Int32Array.from([6,26,46]),new Be(30,new pe(2,116)),new Be(22,new pe(3,36),new pe(2,37)),new Be(20,new pe(4,16),new pe(4,17)),new Be(24,new pe(4,12),new pe(4,13))),new ur(10,Int32Array.from([6,28,50]),new Be(18,new pe(2,68),new pe(2,69)),new Be(26,new pe(4,43),new pe(1,44)),new Be(24,new pe(6,19),new pe(2,20)),new Be(28,new pe(6,15),new pe(2,16))),new ur(11,Int32Array.from([6,30,54]),new Be(20,new pe(4,81)),new Be(30,new pe(1,50),new pe(4,51)),new Be(28,new pe(4,22),new pe(4,23)),new Be(24,new pe(3,12),new pe(8,13))),new ur(12,Int32Array.from([6,32,58]),new Be(24,new pe(2,92),new pe(2,93)),new Be(22,new pe(6,36),new pe(2,37)),new Be(26,new pe(4,20),new pe(6,21)),new Be(28,new pe(7,14),new pe(4,15))),new ur(13,Int32Array.from([6,34,62]),new Be(26,new pe(4,107)),new Be(22,new pe(8,37),new pe(1,38)),new Be(24,new pe(8,20),new pe(4,21)),new Be(22,new pe(12,11),new pe(4,12))),new ur(14,Int32Array.from([6,26,46,66]),new Be(30,new pe(3,115),new pe(1,116)),new Be(24,new pe(4,40),new pe(5,41)),new Be(20,new pe(11,16),new pe(5,17)),new Be(24,new pe(11,12),new pe(5,13))),new ur(15,Int32Array.from([6,26,48,70]),new Be(22,new pe(5,87),new pe(1,88)),new Be(24,new pe(5,41),new pe(5,42)),new Be(30,new pe(5,24),new pe(7,25)),new Be(24,new pe(11,12),new pe(7,13))),new ur(16,Int32Array.from([6,26,50,74]),new Be(24,new pe(5,98),new pe(1,99)),new Be(28,new pe(7,45),new pe(3,46)),new Be(24,new pe(15,19),new pe(2,20)),new Be(30,new pe(3,15),new pe(13,16))),new ur(17,Int32Array.from([6,30,54,78]),new Be(28,new pe(1,107),new pe(5,108)),new Be(28,new pe(10,46),new pe(1,47)),new Be(28,new pe(1,22),new pe(15,23)),new Be(28,new pe(2,14),new pe(17,15))),new ur(18,Int32Array.from([6,30,56,82]),new Be(30,new pe(5,120),new pe(1,121)),new Be(26,new pe(9,43),new pe(4,44)),new Be(28,new pe(17,22),new pe(1,23)),new Be(28,new pe(2,14),new pe(19,15))),new ur(19,Int32Array.from([6,30,58,86]),new Be(28,new pe(3,113),new pe(4,114)),new Be(26,new pe(3,44),new pe(11,45)),new Be(26,new pe(17,21),new pe(4,22)),new Be(26,new pe(9,13),new pe(16,14))),new ur(20,Int32Array.from([6,34,62,90]),new Be(28,new pe(3,107),new pe(5,108)),new Be(26,new pe(3,41),new pe(13,42)),new Be(30,new pe(15,24),new pe(5,25)),new Be(28,new pe(15,15),new pe(10,16))),new ur(21,Int32Array.from([6,28,50,72,94]),new Be(28,new pe(4,116),new pe(4,117)),new Be(26,new pe(17,42)),new Be(28,new pe(17,22),new pe(6,23)),new Be(30,new pe(19,16),new pe(6,17))),new ur(22,Int32Array.from([6,26,50,74,98]),new Be(28,new pe(2,111),new pe(7,112)),new Be(28,new pe(17,46)),new Be(30,new pe(7,24),new pe(16,25)),new Be(24,new pe(34,13))),new ur(23,Int32Array.from([6,30,54,78,102]),new Be(30,new pe(4,121),new pe(5,122)),new Be(28,new pe(4,47),new pe(14,48)),new Be(30,new pe(11,24),new pe(14,25)),new Be(30,new pe(16,15),new pe(14,16))),new ur(24,Int32Array.from([6,28,54,80,106]),new Be(30,new pe(6,117),new pe(4,118)),new Be(28,new pe(6,45),new pe(14,46)),new Be(30,new pe(11,24),new pe(16,25)),new Be(30,new pe(30,16),new pe(2,17))),new ur(25,Int32Array.from([6,32,58,84,110]),new Be(26,new pe(8,106),new pe(4,107)),new Be(28,new pe(8,47),new pe(13,48)),new Be(30,new pe(7,24),new pe(22,25)),new Be(30,new pe(22,15),new pe(13,16))),new ur(26,Int32Array.from([6,30,58,86,114]),new Be(28,new pe(10,114),new pe(2,115)),new Be(28,new pe(19,46),new pe(4,47)),new Be(28,new pe(28,22),new pe(6,23)),new Be(30,new pe(33,16),new pe(4,17))),new ur(27,Int32Array.from([6,34,62,90,118]),new Be(30,new pe(8,122),new pe(4,123)),new Be(28,new pe(22,45),new pe(3,46)),new Be(30,new pe(8,23),new pe(26,24)),new Be(30,new pe(12,15),new pe(28,16))),new ur(28,Int32Array.from([6,26,50,74,98,122]),new Be(30,new pe(3,117),new pe(10,118)),new Be(28,new pe(3,45),new pe(23,46)),new Be(30,new pe(4,24),new pe(31,25)),new Be(30,new pe(11,15),new pe(31,16))),new ur(29,Int32Array.from([6,30,54,78,102,126]),new Be(30,new pe(7,116),new pe(7,117)),new Be(28,new pe(21,45),new pe(7,46)),new Be(30,new pe(1,23),new pe(37,24)),new Be(30,new pe(19,15),new pe(26,16))),new ur(30,Int32Array.from([6,26,52,78,104,130]),new Be(30,new pe(5,115),new pe(10,116)),new Be(28,new pe(19,47),new pe(10,48)),new Be(30,new pe(15,24),new pe(25,25)),new Be(30,new pe(23,15),new pe(25,16))),new ur(31,Int32Array.from([6,30,56,82,108,134]),new Be(30,new pe(13,115),new pe(3,116)),new Be(28,new pe(2,46),new pe(29,47)),new Be(30,new pe(42,24),new pe(1,25)),new Be(30,new pe(23,15),new pe(28,16))),new ur(32,Int32Array.from([6,34,60,86,112,138]),new Be(30,new pe(17,115)),new Be(28,new pe(10,46),new pe(23,47)),new Be(30,new pe(10,24),new pe(35,25)),new Be(30,new pe(19,15),new pe(35,16))),new ur(33,Int32Array.from([6,30,58,86,114,142]),new Be(30,new pe(17,115),new pe(1,116)),new Be(28,new pe(14,46),new pe(21,47)),new Be(30,new pe(29,24),new pe(19,25)),new Be(30,new pe(11,15),new pe(46,16))),new ur(34,Int32Array.from([6,34,62,90,118,146]),new Be(30,new pe(13,115),new pe(6,116)),new Be(28,new pe(14,46),new pe(23,47)),new Be(30,new pe(44,24),new pe(7,25)),new Be(30,new pe(59,16),new pe(1,17))),new ur(35,Int32Array.from([6,30,54,78,102,126,150]),new Be(30,new pe(12,121),new pe(7,122)),new Be(28,new pe(12,47),new pe(26,48)),new Be(30,new pe(39,24),new pe(14,25)),new Be(30,new pe(22,15),new pe(41,16))),new ur(36,Int32Array.from([6,24,50,76,102,128,154]),new Be(30,new pe(6,121),new pe(14,122)),new Be(28,new pe(6,47),new pe(34,48)),new Be(30,new pe(46,24),new pe(10,25)),new Be(30,new pe(2,15),new pe(64,16))),new ur(37,Int32Array.from([6,28,54,80,106,132,158]),new Be(30,new pe(17,122),new pe(4,123)),new Be(28,new pe(29,46),new pe(14,47)),new Be(30,new pe(49,24),new pe(10,25)),new Be(30,new pe(24,15),new pe(46,16))),new ur(38,Int32Array.from([6,32,58,84,110,136,162]),new Be(30,new pe(4,122),new pe(18,123)),new Be(28,new pe(13,46),new pe(32,47)),new Be(30,new pe(48,24),new pe(14,25)),new Be(30,new pe(42,15),new pe(32,16))),new ur(39,Int32Array.from([6,26,54,82,110,138,166]),new Be(30,new pe(20,117),new pe(4,118)),new Be(28,new pe(40,47),new pe(7,48)),new Be(30,new pe(43,24),new pe(22,25)),new Be(30,new pe(10,15),new pe(67,16))),new ur(40,Int32Array.from([6,30,58,86,114,142,170]),new Be(30,new pe(19,118),new pe(6,119)),new Be(28,new pe(18,47),new pe(31,48)),new Be(30,new pe(34,24),new pe(34,25)),new Be(30,new pe(20,15),new pe(61,16)))];var Ii;(function(te){te[te.DATA_MASK_000=0]="DATA_MASK_000",te[te.DATA_MASK_001=1]="DATA_MASK_001",te[te.DATA_MASK_010=2]="DATA_MASK_010",te[te.DATA_MASK_011=3]="DATA_MASK_011",te[te.DATA_MASK_100=4]="DATA_MASK_100",te[te.DATA_MASK_101=5]="DATA_MASK_101",te[te.DATA_MASK_110=6]="DATA_MASK_110",te[te.DATA_MASK_111=7]="DATA_MASK_111"})(Ii||(Ii={}));class vi{constructor(u,p){this.value=u,this.isMasked=p}unmaskBitMatrix(u,p){for(let g=0;g(te+u&1)===0)],[Ii.DATA_MASK_001,new vi(Ii.DATA_MASK_001,(te,u)=>(te&1)===0)],[Ii.DATA_MASK_010,new vi(Ii.DATA_MASK_010,(te,u)=>u%3===0)],[Ii.DATA_MASK_011,new vi(Ii.DATA_MASK_011,(te,u)=>(te+u)%3===0)],[Ii.DATA_MASK_100,new vi(Ii.DATA_MASK_100,(te,u)=>(Math.floor(te/2)+Math.floor(u/3)&1)===0)],[Ii.DATA_MASK_101,new vi(Ii.DATA_MASK_101,(te,u)=>te*u%6===0)],[Ii.DATA_MASK_110,new vi(Ii.DATA_MASK_110,(te,u)=>te*u%6<3)],[Ii.DATA_MASK_111,new vi(Ii.DATA_MASK_111,(te,u)=>(te+u+te*u%3&1)===0)]]);class ti{constructor(u){const p=u.getHeight();if(p<21||(p&3)!==1)throw new B;this.bitMatrix=u}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let u=0;for(let v=0;v<6;v++)u=this.copyBit(v,8,u);u=this.copyBit(7,8,u),u=this.copyBit(8,8,u),u=this.copyBit(8,7,u);for(let v=5;v>=0;v--)u=this.copyBit(8,v,u);const p=this.bitMatrix.getHeight();let g=0;const b=p-7;for(let v=p-1;v>=b;v--)g=this.copyBit(8,v,g);for(let v=p-8;v=0;E--)for(let _=u-9;_>=b;_--)g=this.copyBit(_,E,g);let v=ur.decodeVersionInformation(g);if(v!==null&&v.getDimensionForVersion()===u)return this.parsedVersion=v,v;g=0;for(let E=5;E>=0;E--)for(let _=u-9;_>=b;_--)g=this.copyBit(E,_,g);if(v=ur.decodeVersionInformation(g),v!==null&&v.getDimensionForVersion()===u)return this.parsedVersion=v,v;throw new B}copyBit(u,p,g){return(this.isMirror?this.bitMatrix.get(p,u):this.bitMatrix.get(u,p))?g<<1|1:g<<1}readCodewords(){const u=this.readFormatInformation(),p=this.readVersion(),g=vi.values.get(u.getDataMask()),b=this.bitMatrix.getHeight();g.unmaskBitMatrix(this.bitMatrix,b);const v=p.buildFunctionPattern();let E=!0;const _=new Uint8Array(p.getTotalCodewords());let P=0,M=0,W=0;for(let ee=b-1;ee>0;ee-=2){ee===6&&ee--;for(let oe=0;oe=0&&_[W].codewords.length!==M;)W--;W++;const ee=M-b.getECCodewordsPerBlock();let oe=0;for(let Se=0;Seu.available())throw new B;const b=new Uint8Array(2*g);let v=0;for(;g>0;){const E=u.readBits(13);let _=E/96<<8&4294967295|E%96;_<959?_+=41377:_+=42657,b[v]=_>>8&255,b[v+1]=_&255,v+=2,g--}try{p.append(J.decode(b,Q.GB2312))}catch(E){throw new B(E)}}static decodeKanjiSegment(u,p,g){if(g*13>u.available())throw new B;const b=new Uint8Array(2*g);let v=0;for(;g>0;){const E=u.readBits(13);let _=E/192<<8&4294967295|E%192;_<7936?_+=33088:_+=49472,b[v]=_>>8,b[v+1]=_,v+=2,g--}try{p.append(J.decode(b,Q.SHIFT_JIS))}catch(E){throw new B(E)}}static decodeByteSegment(u,p,g,b,v,E){if(8*g>u.available())throw new B;const _=new Uint8Array(g);for(let M=0;M=Sn.ALPHANUMERIC_CHARS.length)throw new B;return Sn.ALPHANUMERIC_CHARS[u]}static decodeAlphanumericSegment(u,p,g,b){const v=p.length();for(;g>1;){if(u.available()<11)throw new B;const E=u.readBits(11);p.append(Sn.toAlphaNumericChar(Math.floor(E/45))),p.append(Sn.toAlphaNumericChar(E%45)),g-=2}if(g===1){if(u.available()<6)throw new B;p.append(Sn.toAlphaNumericChar(u.readBits(6)))}if(b)for(let E=v;E=3;){if(u.available()<10)throw new B;const b=u.readBits(10);if(b>=1e3)throw new B;p.append(Sn.toAlphaNumericChar(Math.floor(b/100))),p.append(Sn.toAlphaNumericChar(Math.floor(b/10)%10)),p.append(Sn.toAlphaNumericChar(b%10)),g-=3}if(g===2){if(u.available()<7)throw new B;const b=u.readBits(7);if(b>=100)throw new B;p.append(Sn.toAlphaNumericChar(Math.floor(b/10))),p.append(Sn.toAlphaNumericChar(b%10))}else if(g===1){if(u.available()<4)throw new B;const b=u.readBits(4);if(b>=10)throw new B;p.append(Sn.toAlphaNumericChar(b))}}static parseECIValue(u){const p=u.readBits(8);if((p&128)===0)return p&127;if((p&192)===128){const g=u.readBits(8);return(p&63)<<8&4294967295|g}if((p&224)===192){const g=u.readBits(16);return(p&31)<<16&4294967295|g}throw new B}}Sn.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Sn.GB2312_SUBSET=1;class Ta{constructor(u){this.mirrored=u}isMirrored(){return this.mirrored}applyMirroredCorrection(u){if(!this.mirrored||u===null||u.length<3)return;const p=u[0];u[0]=u[2],u[2]=p}}class Ss{constructor(){this.rsDecoder=new St(It.QR_CODE_FIELD_256)}decodeBooleanArray(u,p){return this.decodeBitMatrix(me.parseFromBooleanArray(u),p)}decodeBitMatrix(u,p){const g=new ti(u);let b=null;try{return this.decodeBitMatrixParser(g,p)}catch(v){b=v}try{g.remask(),g.setMirror(!0),g.readVersion(),g.readFormatInformation(),g.mirror();const v=this.decodeBitMatrixParser(g,p);return v.setOther(new Ta(!0)),v}catch(v){throw b!==null?b:v}}decodeBitMatrixParser(u,p){const g=u.readVersion(),b=u.readFormatInformation().getErrorCorrectionLevel(),v=u.readCodewords(),E=ea.getDataBlocks(v,g,b);let _=0;for(const W of E)_+=W.getNumDataCodewords();const P=new Uint8Array(_);let M=0;for(const W of E){const ee=W.getCodewords(),oe=W.getNumDataCodewords();this.correctErrors(ee,oe);for(let ye=0;ye=g)return!1;return!0}crossCheckVertical(u,p,g,b){const v=this.image,E=v.getHeight(),_=this.crossCheckStateCount;_[0]=0,_[1]=0,_[2]=0;let P=u;for(;P>=0&&v.get(p,P)&&_[1]<=g;)_[1]++,P--;if(P<0||_[1]>g)return NaN;for(;P>=0&&!v.get(p,P)&&_[0]<=g;)_[0]++,P--;if(_[0]>g)return NaN;for(P=u+1;Pg)return NaN;for(;Pg)return NaN;const M=_[0]+_[1]+_[2];return 5*Math.abs(M-b)>=2*b?NaN:this.foundPatternCross(_)?bs.centerFromEnd(_,P):NaN}handlePossibleCenter(u,p,g){const b=u[0]+u[1]+u[2],v=bs.centerFromEnd(u,g),E=this.crossCheckVertical(p,v,2*u[1],b);if(!isNaN(E)){const _=(u[0]+u[1]+u[2])/3;for(const M of this.possibleCenters)if(M.aboutEquals(_,E,v))return M.combineEstimate(E,v,_);const P=new Po(v,E,_);this.possibleCenters.push(P),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(P)}return null}}class Ka extends Ot{constructor(u,p,g,b){super(u,p),this.estimatedModuleSize=g,this.count=b,b===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(u,p,g){if(Math.abs(p-this.getY())<=u&&Math.abs(g-this.getX())<=u){const b=Math.abs(u-this.estimatedModuleSize);return b<=1||b<=this.estimatedModuleSize}return!1}combineEstimate(u,p,g){const b=this.count+1,v=(this.count*this.getX()+p)/b,E=(this.count*this.getY()+u)/b,_=(this.count*this.estimatedModuleSize+g)/b;return new Ka(v,E,_,b)}}class us{constructor(u){this.bottomLeft=u[0],this.topLeft=u[1],this.topRight=u[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class gi{constructor(u,p){this.image=u,this.resultPointCallback=p,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=p}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(u){const p=u!=null&&u.get(q.TRY_HARDER)!==void 0,g=u!=null&&u.get(q.PURE_BARCODE)!==void 0,b=this.image,v=b.getHeight(),E=b.getWidth();let _=Math.floor(3*v/(4*gi.MAX_MODULES));(_M[2]&&(ee+=Te-M[2]-_,ye=E-1)}else{M[0]=M[2],M[1]=M[3],M[2]=M[4],M[3]=1,M[4]=0,oe=3;continue}oe=0,M[0]=0,M[1]=0,M[2]=0,M[3]=0,M[4]=0}else M[0]=M[2],M[1]=M[3],M[2]=M[4],M[3]=1,M[4]=0,oe=3;else M[++oe]++;else M[oe]++;gi.foundPatternCross(M)&&this.handlePossibleCenter(M,ee,E,g)===!0&&(_=M[0],this.hasSkipped&&(P=this.haveMultiplyConfirmedCenters()))}const W=this.selectBestPatterns();return Ot.orderBestPatterns(W),new us(W)}static centerFromEnd(u,p){return p-u[4]-u[3]-u[2]/2}static foundPatternCross(u){let p=0;for(let v=0;v<5;v++){const E=u[v];if(E===0)return!1;p+=E}if(p<7)return!1;const g=p/7,b=g/2;return Math.abs(g-u[0])=E&&p>=E&&_.get(p-E,u-E);)v[2]++,E++;if(u=E&&p>=E&&!_.get(p-E,u-E)&&v[1]<=g;)v[1]++,E++;if(ug)return!1;for(;u>=E&&p>=E&&_.get(p-E,u-E)&&v[0]<=g;)v[0]++,E++;if(v[0]>g)return!1;const P=_.getHeight(),M=_.getWidth();for(E=1;u+E=P||p+E>=M)return!1;for(;u+E=P||p+E>=M||v[3]>=g)return!1;for(;u+E=g)return!1;const W=v[0]+v[1]+v[2]+v[3]+v[4];return Math.abs(W-b)<2*b&&gi.foundPatternCross(v)}crossCheckVertical(u,p,g,b){const v=this.image,E=v.getHeight(),_=this.getCrossCheckStateCount();let P=u;for(;P>=0&&v.get(p,P);)_[2]++,P--;if(P<0)return NaN;for(;P>=0&&!v.get(p,P)&&_[1]<=g;)_[1]++,P--;if(P<0||_[1]>g)return NaN;for(;P>=0&&v.get(p,P)&&_[0]<=g;)_[0]++,P--;if(_[0]>g)return NaN;for(P=u+1;P=g)return NaN;for(;P=g)return NaN;const M=_[0]+_[1]+_[2]+_[3]+_[4];return 5*Math.abs(M-b)>=2*b?NaN:gi.foundPatternCross(_)?gi.centerFromEnd(_,P):NaN}crossCheckHorizontal(u,p,g,b){const v=this.image,E=v.getWidth(),_=this.getCrossCheckStateCount();let P=u;for(;P>=0&&v.get(P,p);)_[2]++,P--;if(P<0)return NaN;for(;P>=0&&!v.get(P,p)&&_[1]<=g;)_[1]++,P--;if(P<0||_[1]>g)return NaN;for(;P>=0&&v.get(P,p)&&_[0]<=g;)_[0]++,P--;if(_[0]>g)return NaN;for(P=u+1;P=g)return NaN;for(;P=g)return NaN;const M=_[0]+_[1]+_[2]+_[3]+_[4];return 5*Math.abs(M-b)>=b?NaN:gi.foundPatternCross(_)?gi.centerFromEnd(_,P):NaN}handlePossibleCenter(u,p,g,b){const v=u[0]+u[1]+u[2]+u[3]+u[4];let E=gi.centerFromEnd(u,g),_=this.crossCheckVertical(p,Math.floor(E),u[2],v);if(!isNaN(_)&&(E=this.crossCheckHorizontal(Math.floor(E),Math.floor(_),u[2],v),!isNaN(E)&&(!b||this.crossCheckDiagonal(Math.floor(_),Math.floor(E),u[2],v)))){const P=v/7;let M=!1;const W=this.possibleCenters;for(let ee=0,oe=W.length;ee=gi.CENTER_QUORUM)if(p==null)p=g;else return this.hasSkipped=!0,Math.floor((Math.abs(p.getX()-g.getX())-Math.abs(p.getY()-g.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let u=0,p=0;const g=this.possibleCenters.length;for(const E of this.possibleCenters)E.getCount()>=gi.CENTER_QUORUM&&(u++,p+=E.getEstimatedModuleSize());if(u<3)return!1;const b=p/g;let v=0;for(const E of this.possibleCenters)v+=Math.abs(E.getEstimatedModuleSize()-b);return v<=.05*p}selectBestPatterns(){const u=this.possibleCenters.length;if(u<3)throw new re;const p=this.possibleCenters;let g;if(u>3){let b=0,v=0;for(const P of this.possibleCenters){const M=P.getEstimatedModuleSize();b+=M,v+=M*M}g=b/u;let E=Math.sqrt(v/u-g*g);p.sort((P,M)=>{const W=Math.abs(M.getEstimatedModuleSize()-g),ee=Math.abs(P.getEstimatedModuleSize()-g);return Wee?1:0});const _=Math.max(.2*g,E);for(let P=0;P3;P++){const M=p[P];Math.abs(M.getEstimatedModuleSize()-g)>_&&(p.splice(P,1),P--)}}if(p.length>3){let b=0;for(const v of p)b+=v.getEstimatedModuleSize();g=b/p.length,p.sort((v,E)=>{if(E.getCount()===v.getCount()){const _=Math.abs(E.getEstimatedModuleSize()-g),P=Math.abs(v.getEstimatedModuleSize()-g);return _P?-1:0}else return E.getCount()-v.getCount()}),p.splice(3)}return[p[0],p[1],p[2]]}}gi.CENTER_QUORUM=2,gi.MIN_SKIP=3,gi.MAX_MODULES=57;class vs{constructor(u){this.image=u}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(u){this.resultPointCallback=u==null?null:u.get(q.NEED_RESULT_POINT_CALLBACK);const g=new gi(this.image,this.resultPointCallback).find(u);return this.processFinderPatternInfo(g)}processFinderPatternInfo(u){const p=u.getTopLeft(),g=u.getTopRight(),b=u.getBottomLeft(),v=this.calculateModuleSize(p,g,b);if(v<1)throw new re("No pattern found in proccess finder.");const E=vs.computeDimension(p,g,b,v),_=ur.getProvisionalVersionForDimension(E),P=_.getDimensionForVersion()-7;let M=null;if(_.getAlignmentPatternCenters().length>0){const ye=g.getX()-p.getX()+b.getX(),Se=g.getY()-p.getY()+b.getY(),Te=1-3/P,Ye=Math.floor(p.getX()+Te*(ye-p.getX())),dt=Math.floor(p.getY()+Te*(Se-p.getY()));for(let Wt=4;Wt<=16;Wt<<=1)try{M=this.findAlignmentInRegion(v,Ye,dt,Wt);break}catch(qt){if(!(qt instanceof re))throw qt}}const W=vs.createTransform(p,g,b,M,E),ee=vs.sampleGrid(this.image,W,E);let oe;return M===null?oe=[b,p,g]:oe=[b,p,g,M],new or(ee,oe)}static createTransform(u,p,g,b,v){const E=v-3.5;let _,P,M,W;return b!==null?(_=b.getX(),P=b.getY(),M=E-3,W=M):(_=p.getX()-u.getX()+g.getX(),P=p.getY()-u.getY()+g.getY(),M=E,W=E),He.quadrilateralToQuadrilateral(3.5,3.5,E,3.5,M,W,3.5,E,u.getX(),u.getY(),p.getX(),p.getY(),_,P,g.getX(),g.getY())}static sampleGrid(u,p,g){return nr.getInstance().sampleGridWithTransform(u,g,g,p)}static computeDimension(u,p,g,b){const v=Xe.round(Ot.distance(u,p)/b),E=Xe.round(Ot.distance(u,g)/b);let _=Math.floor((v+E)/2)+7;switch(_&3){case 0:_++;break;case 2:_--;break;case 3:throw new re("Dimensions could be not found.")}return _}calculateModuleSize(u,p,g){return(this.calculateModuleSizeOneWay(u,p)+this.calculateModuleSizeOneWay(u,g))/2}calculateModuleSizeOneWay(u,p){const g=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(u.getX()),Math.floor(u.getY()),Math.floor(p.getX()),Math.floor(p.getY())),b=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(p.getX()),Math.floor(p.getY()),Math.floor(u.getX()),Math.floor(u.getY()));return isNaN(g)?b/7:isNaN(b)?g/7:(g+b)/14}sizeOfBlackWhiteBlackRunBothWays(u,p,g,b){let v=this.sizeOfBlackWhiteBlackRun(u,p,g,b),E=1,_=u-(g-u);_<0?(E=u/(u-_),_=0):_>=this.image.getWidth()&&(E=(this.image.getWidth()-1-u)/(_-u),_=this.image.getWidth()-1);let P=Math.floor(p-(b-p)*E);return E=1,P<0?(E=p/(p-P),P=0):P>=this.image.getHeight()&&(E=(this.image.getHeight()-1-p)/(P-p),P=this.image.getHeight()-1),_=Math.floor(u+(_-u)*E),v+=this.sizeOfBlackWhiteBlackRun(u,p,_,P),v-1}sizeOfBlackWhiteBlackRun(u,p,g,b){const v=Math.abs(b-p)>Math.abs(g-u);if(v){let ye=u;u=p,p=ye,ye=g,g=b,b=ye}const E=Math.abs(g-u),_=Math.abs(b-p);let P=-E/2;const M=u0){if(Se===b)break;Se+=W,P-=E}}return ee===2?Xe.distance(g+M,b,u,p):NaN}findAlignmentInRegion(u,p,g,b){const v=Math.floor(b*u),E=Math.max(0,p-v),_=Math.min(this.image.getWidth()-1,p+v);if(_-E=P||v>=E)throw new re;if(E-v!==P-_&&(P=_+(E-v),P>=u.getWidth()))throw new re;const M=Math.round((P-_+1)/b),W=Math.round((E-v+1)/b);if(M<=0||W<=0)throw new re;if(W!==M)throw new re;const ee=Math.floor(b/2);v+=ee,_+=ee;const oe=_+Math.floor((M-1)*b)-P;if(oe>0){if(oe>ee)throw new re;_-=oe}const ye=v+Math.floor((W-1)*b)-E;if(ye>0){if(ye>ee)throw new re;v-=ye}const Se=new me(M,W);for(let Te=0;Te0;){const oe=Qr.findGuardPattern(u,v,--b,g,!1,E,M);if(oe!=null)ee=oe;else{b++;break}}_[0]=new Ot(ee[0],b),_[1]=new Ot(ee[1],b),P=!0;break}}let W=b+1;if(P){let ee=0,oe=Int32Array.from([Math.trunc(_[0].getX()),Math.trunc(_[1].getX())]);for(;WQr.SKIPPED_ROW_COUNT_MAX)break;ee++}}W-=ee+1,_[2]=new Ot(oe[0],W),_[3]=new Ot(oe[1],W)}return W-b0&&M++ee?W-ee:ee-W;if(oe>g)return 1/0;P+=oe}return P/v}}Qr.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Qr.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Qr.MAX_AVG_VARIANCE=.42,Qr.MAX_INDIVIDUAL_VARIANCE=.8,Qr.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Qr.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Qr.MAX_PIXEL_DRIFT=3,Qr.MAX_PATTERN_DRIFT=5,Qr.SKIPPED_ROW_COUNT_MAX=25,Qr.ROW_STEP=5,Qr.BARCODE_MIN_HEIGHT=10;class Rn{constructor(u,p){if(p.length===0)throw new y;this.field=u;let g=p.length;if(g>1&&p[0]===0){let b=1;for(;bg.length){let E=p;p=g,g=E}let b=new Int32Array(g.length),v=g.length-p.length;j.arraycopy(g,0,b,0,v);for(let E=v;E=0;p--){let g=this.getCoefficient(p);g!==0&&(g<0?(u.append(" - "),g=-g):u.length()>0&&u.append(" + "),(p===0||g!==1)&&u.append(g),p!==0&&(p===1?u.append("x"):(u.append("x^"),u.append(p))))}return u.toString()}}class Pa{add(u,p){return(u+p)%this.modulus}subtract(u,p){return(this.modulus+u-p)%this.modulus}exp(u){return this.expTable[u]}log(u){if(u===0)throw new y;return this.logTable[u]}inverse(u){if(u===0)throw new Re;return this.expTable[this.modulus-this.logTable[u]-1]}multiply(u,p){return u===0||p===0?0:this.expTable[(this.logTable[u]+this.logTable[p])%(this.modulus-1)]}getSize(){return this.modulus}equals(u){return u===this}}class ri extends Pa{constructor(u,p){super(),this.modulus=u,this.expTable=new Int32Array(u),this.logTable=new Int32Array(u);let g=1;for(let b=0;b0;Se--){let Te=b.evaluateAt(this.field.exp(Se));v[p-Se]=Te,Te!==0&&(E=!0)}if(!E)return 0;let _=this.field.getOne();if(g!=null)for(const Se of g){let Te=this.field.exp(u.length-1-Se),Ye=new Rn(this.field,new Int32Array([this.field.subtract(0,Te),1]));_=_.multiply(Ye)}let P=new Rn(this.field,v),M=this.runEuclideanAlgorithm(this.field.buildMonomial(p,1),P,p),W=M[0],ee=M[1],oe=this.findErrorLocations(W),ye=this.findErrorMagnitudes(ee,W,oe);for(let Se=0;Se=Math.round(g/2);){let oe=b,ye=E;if(b=v,E=_,b.isZero())throw A.getChecksumInstance();v=oe;let Se=this.field.getZero(),Te=b.getCoefficient(b.getDegree()),Ye=this.field.inverse(Te);for(;v.getDegree()>=b.getDegree()&&!v.isZero();){let dt=v.getDegree()-b.getDegree(),Wt=this.field.multiply(v.getCoefficient(v.getDegree()),Ye);Se=Se.add(this.field.buildMonomial(dt,Wt)),v=v.subtract(b.multiplyByMonomial(dt,Wt))}_=Se.multiply(E).subtract(ye).negative()}let P=_.getCoefficient(0);if(P===0)throw A.getChecksumInstance();let M=this.field.inverse(P),W=_.multiply(M),ee=v.multiply(M);return[W,ee]}findErrorLocations(u){let p=u.getDegree(),g=new Int32Array(p),b=0;for(let v=1;v0){let P=g?this.topLeft:this.topRight,M=Math.trunc(P.getY()-u);M<0&&(M=0);let W=new Ot(P.getX(),M);g?b=W:E=W}if(p>0){let P=g?this.bottomLeft:this.bottomRight,M=Math.trunc(P.getY()+p);M>=this.image.getHeight()&&(M=this.image.getHeight()-1);let W=new Ot(P.getX(),M);g?v=W:_=W}return new pa(this.image,b,v,E,_)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class yl{constructor(u,p,g,b){this.columnCount=u,this.errorCorrectionLevel=b,this.rowCountUpperPart=p,this.rowCountLowerPart=g,this.rowCount=p+g}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class Oa{constructor(){this.buffer=""}static form(u,p){let g=-1;function b(E,_,P,M,W,ee){if(E==="%%")return"%";if(p[++g]===void 0)return;E=M?parseInt(M.substr(1)):void 0;let oe=W?parseInt(W.substr(1)):void 0,ye;switch(ee){case"s":ye=p[g];break;case"c":ye=p[g][0];break;case"f":ye=parseFloat(p[g]).toFixed(E);break;case"p":ye=parseFloat(p[g]).toPrecision(E);break;case"e":ye=parseFloat(p[g]).toExponential(E);break;case"x":ye=parseInt(p[g]).toString(oe||16);break;case"d":ye=parseFloat(parseInt(p[g],oe||10).toPrecision(E)).toFixed(0);break}ye=typeof ye=="object"?JSON.stringify(ye):(+ye).toString(oe);let Se=parseInt(P),Te=P&&P[0]+""=="0"?"0":" ";for(;ye.length=0&&(p=this.codewords[b],p!=null)||(b=this.imageRowToCodewordIndex(u)+g,bg,getValue:()=>b};v.getValue()>u?(u=v.getValue(),p=[],p.push(v.getKey())):v.getValue()===u&&p.push(v.getKey())}return Rr.toIntArray(p)}getConfidence(u){return this.values.get(u)}}class ta extends Ra{constructor(u,p){super(u),this._isLeft=p}setRowNumbers(){for(let u of this.getCodewords())u!=null&&u.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(u){let p=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(p,u);let g=this.getBoundingBox(),b=this._isLeft?g.getTopLeft():g.getTopRight(),v=this._isLeft?g.getBottomLeft():g.getBottomRight(),E=this.imageRowToCodewordIndex(Math.trunc(b.getY())),_=this.imageRowToCodewordIndex(Math.trunc(v.getY())),P=-1,M=1,W=0;for(let ee=E;ee<_;ee++){if(p[ee]==null)continue;let oe=p[ee],ye=oe.getRowNumber()-P;if(ye===0)W++;else if(ye===1)M=Math.max(M,W),W=1,P=oe.getRowNumber();else if(ye<0||oe.getRowNumber()>=u.getRowCount()||ye>ee)p[ee]=null;else{let Se;M>2?Se=(M-2)*ye:Se=ye;let Te=Se>=ee;for(let Ye=1;Ye<=Se&&!Te;Ye++)Te=p[ee-Ye]!=null;Te?p[ee]=null:(P=oe.getRowNumber(),W=1)}}}getRowHeights(){let u=this.getBarcodeMetadata();if(u==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(u);let p=new Int32Array(u.getRowCount());for(let g of this.getCodewords())if(g!=null){let b=g.getRowNumber();if(b>=p.length)continue;p[b]++}return p}adjustIncompleteIndicatorColumnRowNumbers(u){let p=this.getBoundingBox(),g=this._isLeft?p.getTopLeft():p.getTopRight(),b=this._isLeft?p.getBottomLeft():p.getBottomRight(),v=this.imageRowToCodewordIndex(Math.trunc(g.getY())),E=this.imageRowToCodewordIndex(Math.trunc(b.getY())),_=this.getCodewords(),P=-1;for(let M=v;M=u.getRowCount()?_[M]=null:P=W.getRowNumber())}}getBarcodeMetadata(){let u=this.getCodewords(),p=new ds,g=new ds,b=new ds,v=new ds;for(let _ of u){if(_==null)continue;_.setRowNumberAsRowIndicatorColumn();let P=_.getValue()%30,M=_.getRowNumber();switch(this._isLeft||(M+=2),M%3){case 0:g.setValue(P*3+1);break;case 1:v.setValue(P/3),b.setValue(P%3);break;case 2:p.setValue(P+1);break}}if(p.getValue().length===0||g.getValue().length===0||b.getValue().length===0||v.getValue().length===0||p.getValue()[0]<1||g.getValue()[0]+b.getValue()[0]Rr.MAX_ROWS_IN_BARCODE)return null;let E=new yl(p.getValue()[0],g.getValue()[0],b.getValue()[0],v.getValue()[0]);return this.removeIncorrectCodewords(u,E),E}removeIncorrectCodewords(u,p){for(let g=0;gp.getRowCount()){u[g]=null;continue}switch(this._isLeft||(E+=2),E%3){case 0:v*3+1!==p.getRowCountUpperPart()&&(u[g]=null);break;case 1:(Math.trunc(v/3)!==p.getErrorCorrectionLevel()||v%3!==p.getRowCountLowerPart())&&(u[g]=null);break;case 2:v+1!==p.getColumnCount()&&(u[g]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+` `+super.toString()}}class wi{constructor(u,p){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=u,this.barcodeColumnCount=u.getColumnCount(),this.boundingBox=p,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let u=Rr.MAX_CODEWORDS_IN_BARCODE,p;do p=u,u=this.adjustRowNumbersAndGetCount();while(u>0&&u0&&v0&&(_[0]=g[p-1],_[4]=v[p-1],_[5]=E[p-1]),p>1&&(_[8]=g[p-2],_[10]=v[p-2],_[11]=E[p-2]),p>=1;g=p&1,ui.RATIOS_TABLE[u]||(ui.RATIOS_TABLE[u]=new Array(Rr.BARS_IN_MODULE)),ui.RATIOS_TABLE[u][Rr.BARS_IN_MODULE-b-1]=Math.fround(v/Rr.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(u){let p=ui.getDecodedCodewordValue(ui.sampleBitCounts(u));return p!==-1?p:ui.getClosestDecodedValue(u)}static sampleBitCounts(u){let p=Xe.sum(u),g=new Int32Array(Rr.BARS_IN_MODULE),b=0,v=0;for(let E=0;E1)for(let E=0;E=b)break}_new Array(Rr.BARS_IN_MODULE));class ho{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(u){this.segmentIndex=u}getFileId(){return this.fileId}setFileId(u){this.fileId=u}getOptionalData(){return this.optionalData}setOptionalData(u){this.optionalData=u}isLastSegment(){return this.lastSegment}setLastSegment(u){this.lastSegment=u}getSegmentCount(){return this.segmentCount}setSegmentCount(u){this.segmentCount=u}getSender(){return this.sender||null}setSender(u){this.sender=u}getAddressee(){return this.addressee||null}setAddressee(u){this.addressee=u}getFileName(){return this.fileName}setFileName(u){this.fileName=u}getFileSize(){return this.fileSize}setFileSize(u){this.fileSize=u}getChecksum(){return this.checksum}setChecksum(u){this.checksum=u}getTimestamp(){return this.timestamp}setTimestamp(u){this.timestamp=u}}class Ql{static parseLong(u,p=void 0){return parseInt(u,p)}}class fo extends f{}fo.kind="NullPointerException";class Ko{writeBytes(u){this.writeBytesOffset(u,0,u.length)}writeBytesOffset(u,p,g){if(u==null)throw new fo;if(p<0||p>u.length||g<0||p+g>u.length||p+g<0)throw new T;if(g===0)return;for(let b=0;b0&&this.grow(u)}grow(u){let g=this.buf.length<<1;if(g-u<0&&(g=u),g<0){if(u<0)throw new ra;g=U.MAX_VALUE}this.buf=V.copyOfUint8Array(this.buf,g)}write(u){this.ensureCapacity(this.count+1),this.buf[this.count]=u,this.count+=1}writeBytesOffset(u,p,g){if(p<0||p>u.length||g<0||p+g-u.length>0)throw new T;this.ensureCapacity(this.count+g),j.arraycopy(u,p,this.buf,this.count,g),this.count+=g}writeTo(u){u.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return V.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(u){return u?typeof u=="string"?this.toString_string(u):this.toString_number(u):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(u){return new String(this.buf).toString()}toString_number(u){return new String(this.buf).toString()}close(){}}var Dn;(function(te){te[te.ALPHA=0]="ALPHA",te[te.LOWER=1]="LOWER",te[te.MIXED=2]="MIXED",te[te.PUNCT=3]="PUNCT",te[te.ALPHA_SHIFT=4]="ALPHA_SHIFT",te[te.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(Dn||(Dn={}));function po(){if(typeof window<"u")return window.BigInt||null;if(typeof Cv<"u")return Cv.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let bl;function ma(te){if(typeof bl>"u"&&(bl=po()),bl===null)throw new Error("BigInt is not supported!");return bl(te)}function Xa(){let te=[];te[0]=ma(1);let u=ma(900);te[1]=u;for(let p=2;p<16;p++)te[p]=te[p-1]*u;return te}class it{static decode(u,p){let g=new K(""),b=F.ISO8859_1;g.enableDecoding(b);let v=1,E=u[v++],_=new ho;for(;vu[0])throw B.getFormatInstance();let b=new Int32Array(it.NUMBER_OF_SEQUENCE_CODEWORDS);for(let _=0;_0){for(let oe=0;oe<6;++oe)E.write(Number(ma(P)>>ma(8*(5-oe))));P=0,_=0}break}b===p[0]&&ee0){for(let ye=0;ye<6;++ye)E.write(Number(ma(P)>>ma(8*(5-ye))));P=0,_=0}}break}return v.append(J.decode(E.toByteArray(),g)),b}static numericCompaction(u,p,g){let b=0,v=!1,E=new Int32Array(it.MAX_NUMERIC_CODEWORDS);for(;p0&&(g.append(it.decodeBase900toBase10(E,b)),b=0)}return p}static decodeBase900toBase10(u,p){let g=ma(0);for(let v=0;v@[\\]_\`~!\r ,: -.$/"|*()?{}'`,it.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",it.EXP900=po()?Xa():[],it.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Zr{constructor(){}static decode(u,p,g,b,v,E,_){let P=new pa(u,p,g,b,v),M=null,W=null,ee;for(let Se=!0;;Se=!1){if(p!=null&&(M=Zr.getRowIndicatorColumn(u,P,p,!0,E,_)),b!=null&&(W=Zr.getRowIndicatorColumn(u,P,b,!1,E,_)),ee=Zr.merge(M,W),ee==null)throw re.getNotFoundInstance();let Te=ee.getBoundingBox();if(Se&&Te!=null&&(Te.getMinY()P.getMaxY()))P=Te;else break}ee.setBoundingBox(P);let oe=ee.getBarcodeColumnCount()+1;ee.setDetectionResultColumn(0,M),ee.setDetectionResultColumn(oe,W);let ye=M!=null;for(let Se=1;Se<=oe;Se++){let Te=ye?Se:oe-Se;if(ee.getDetectionResultColumn(Te)!==void 0)continue;let Ye;Te===0||Te===oe?Ye=new ta(P,Te===0):Ye=new Ra(P),ee.setDetectionResultColumn(Te,Ye);let dt=-1,Wt=dt;for(let qt=P.getMinY();qt<=P.getMaxY();qt++){if(dt=Zr.getStartColumn(ee,Te,qt,ye),dt<0||dt>P.getMaxX()){if(Wt===-1)continue;dt=Wt}let Mt=Zr.detectCodeword(u,P.getMinX(),P.getMaxX(),ye,dt,qt,E,_);Mt!=null&&(Ye.setCodeword(qt,Mt),Wt=dt,E=Math.min(E,Mt.getWidth()),_=Math.max(_,Mt.getWidth()))}}return Zr.createDecoderResult(ee)}static merge(u,p){if(u==null&&p==null)return null;let g=Zr.getBarcodeMetadata(u,p);if(g==null)return null;let b=pa.merge(Zr.adjustBoundingBox(u),Zr.adjustBoundingBox(p));return new wi(g,b)}static adjustBoundingBox(u){if(u==null)return null;let p=u.getRowHeights();if(p==null)return null;let g=Zr.getMax(p),b=0;for(let _ of p)if(b+=g-_,_>0)break;let v=u.getCodewords();for(let _=0;b>0&&v[_]==null;_++)b--;let E=0;for(let _=p.length-1;_>=0&&(E+=g-p[_],!(p[_]>0));_--);for(let _=v.length-1;E>0&&v[_]==null;_--)E--;return u.getBoundingBox().addMissingRows(b,E,u.isLeft())}static getMax(u){let p=-1;for(let g of u)p=Math.max(p,g);return p}static getBarcodeMetadata(u,p){let g;if(u==null||(g=u.getBarcodeMetadata())==null)return p==null?null:p.getBarcodeMetadata();let b;return p==null||(b=p.getBarcodeMetadata())==null?g:g.getColumnCount()!==b.getColumnCount()&&g.getErrorCorrectionLevel()!==b.getErrorCorrectionLevel()&&g.getRowCount()!==b.getRowCount()?null:g}static getRowIndicatorColumn(u,p,g,b,v,E){let _=new ta(p,b);for(let P=0;P<2;P++){let M=P===0?1:-1,W=Math.trunc(Math.trunc(g.getX()));for(let ee=Math.trunc(Math.trunc(g.getY()));ee<=p.getMaxY()&&ee>=p.getMinY();ee+=M){let oe=Zr.detectCodeword(u,0,u.getWidth(),b,W,ee,v,E);oe!=null&&(_.setCodeword(ee,oe),b?W=oe.getStartX():W=oe.getEndX())}}return _}static adjustCodewordCount(u,p){let g=p[0][1],b=g.getValue(),v=u.getBarcodeColumnCount()*u.getBarcodeRowCount()-Zr.getNumberOfECCodeWords(u.getBarcodeECLevel());if(b.length===0){if(v<1||v>Rr.MAX_CODEWORDS_IN_BARCODE)throw re.getNotFoundInstance();g.setValue(v)}else b[0]!==v&&g.setValue(v)}static createDecoderResult(u){let p=Zr.createBarcodeMatrix(u);Zr.adjustCodewordCount(u,p);let g=new Array,b=new Int32Array(u.getBarcodeRowCount()*u.getBarcodeColumnCount()),v=[],E=new Array;for(let P=0;P0;){for(let P=0;Pnew Array(u.getBarcodeColumnCount()+2));for(let b=0;b=0){if(E>=p.length)continue;p[E][g].setValue(v.getValue())}}}g++}return p}static isValidBarcodeColumn(u,p){return p>=0&&p<=u.getBarcodeColumnCount()+1}static getStartColumn(u,p,g,b){let v=b?1:-1,E=null;if(Zr.isValidBarcodeColumn(u,p-v)&&(E=u.getDetectionResultColumn(p-v).getCodeword(g)),E!=null)return b?E.getEndX():E.getStartX();if(E=u.getDetectionResultColumn(p).getCodewordNearby(g),E!=null)return b?E.getStartX():E.getEndX();if(Zr.isValidBarcodeColumn(u,p-v)&&(E=u.getDetectionResultColumn(p-v).getCodewordNearby(g)),E!=null)return b?E.getEndX():E.getStartX();let _=0;for(;Zr.isValidBarcodeColumn(u,p-v);){p-=v;for(let P of u.getDetectionResultColumn(p).getCodewords())if(P!=null)return(b?P.getEndX():P.getStartX())+v*_*(P.getEndX()-P.getStartX());_++}return b?u.getBoundingBox().getMinX():u.getBoundingBox().getMaxX()}static detectCodeword(u,p,g,b,v,E,_,P){v=Zr.adjustCodewordStartColumn(u,p,g,b,v,E);let M=Zr.getModuleBitCount(u,p,g,b,v,E);if(M==null)return null;let W,ee=Xe.sum(M);if(b)W=v+ee;else{for(let Se=0;Se=p)&&M=p:_Zr.CODEWORD_SKEW_SIZE)return v;_+=P}P=-P,b=!b}return _}static checkCodewordSkew(u,p,g){return p-Zr.CODEWORD_SKEW_SIZE<=u&&u<=g+Zr.CODEWORD_SKEW_SIZE}static decodeCodewords(u,p,g){if(u.length===0)throw B.getFormatInstance();let b=1<g/2+Zr.MAX_ERRORS||g<0||g>Zr.MAX_EC_CODEWORDS)throw A.getChecksumInstance();return Zr.errorCorrection.decode(u,g,p)}static verifyCodewordCount(u,p){if(u.length<4)throw B.getFormatInstance();let g=u[0];if(g>u.length)throw B.getFormatInstance();if(g===0)if(p>=1;return p}static getCodewordBucketNumber(u){return u instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(u):this.getCodewordBucketNumber_number(u)}static getCodewordBucketNumber_number(u){return Zr.getCodewordBucketNumber(Zr.getBitCountForCodeword(u))}static getCodewordBucketNumber_Int32Array(u){return(u[0]-u[2]+u[4]-u[6]+9)%9}static toString(u){let p=new Oa;for(let g=0;gE)}static getMaxWidth(u,p){return u==null||p==null?0:Math.trunc(Math.abs(u.getX()-p.getX()))}static getMinWidth(u,p){return u==null||p==null?U.MAX_VALUE:Math.trunc(Math.abs(u.getX()-p.getX()))}static getMaxCodewordWidth(u){return Math.floor(Math.max(Math.max(Pi.getMaxWidth(u[0],u[4]),Pi.getMaxWidth(u[6],u[2])*Rr.MODULES_IN_CODEWORD/Rr.MODULES_IN_STOP_PATTERN),Math.max(Pi.getMaxWidth(u[1],u[5]),Pi.getMaxWidth(u[7],u[3])*Rr.MODULES_IN_CODEWORD/Rr.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(u){return Math.floor(Math.min(Math.min(Pi.getMinWidth(u[0],u[4]),Pi.getMinWidth(u[6],u[2])*Rr.MODULES_IN_CODEWORD/Rr.MODULES_IN_STOP_PATTERN),Math.min(Pi.getMinWidth(u[1],u[5]),Pi.getMinWidth(u[7],u[3])*Rr.MODULES_IN_CODEWORD/Rr.MODULES_IN_STOP_PATTERN)))}reset(){}}class Qa extends f{}Qa.kind="ReaderException";class vl{constructor(u,p){this.verbose=u===!0,p&&this.setHints(p)}decode(u,p){return p&&this.setHints(p),this.decodeInternal(u)}decodeWithState(u){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(u)}setHints(u){this.hints=u;const p=!n(u)&&u.get(q.TRY_HARDER)===!0,g=n(u)?null:u.get(q.POSSIBLE_FORMATS),b=new Array;if(!n(g)){const v=g.some(E=>E===Fe.UPC_A||E===Fe.UPC_E||E===Fe.EAN_13||E===Fe.EAN_8||E===Fe.CODABAR||E===Fe.CODE_39||E===Fe.CODE_93||E===Fe.CODE_128||E===Fe.ITF||E===Fe.RSS_14||E===Fe.RSS_EXPANDED);v&&!p&&b.push(new ts(u,this.verbose)),g.includes(Fe.QR_CODE)&&b.push(new Ds),g.includes(Fe.DATA_MATRIX)&&b.push(new Bt),g.includes(Fe.AZTEC)&&b.push(new en),g.includes(Fe.PDF_417)&&b.push(new Pi),v&&p&&b.push(new ts(u,this.verbose))}b.length===0&&(p||b.push(new ts(u,this.verbose)),b.push(new Ds),b.push(new Bt),b.push(new en),b.push(new Pi),p&&b.push(new ts(u,this.verbose))),this.readers=b}reset(){if(this.readers!==null)for(const u of this.readers)u.reset()}decodeInternal(u){if(this.readers===null)throw new Qa("No readers where selected, nothing can be read.");for(const p of this.readers)try{return p.decode(u,this.hints)}catch(g){if(g instanceof Qa)continue}throw new re("No MultiFormat Readers were able to detect the code.")}}class ge extends ae{constructor(u=null,p=500){const g=new vl;g.setHints(u),super(g,p)}decodeBitmap(u){return this.reader.decodeWithState(u)}}class we extends ae{constructor(u=500){super(new Pi,u)}}class Me extends ae{constructor(u=500){super(new Ds,u)}}var Ke;(function(te){te[te.ERROR_CORRECTION=0]="ERROR_CORRECTION",te[te.CHARACTER_SET=1]="CHARACTER_SET",te[te.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",te[te.MIN_SIZE=3]="MIN_SIZE",te[te.MAX_SIZE=4]="MAX_SIZE",te[te.MARGIN=5]="MARGIN",te[te.PDF417_COMPACT=6]="PDF417_COMPACT",te[te.PDF417_COMPACTION=7]="PDF417_COMPACTION",te[te.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",te[te.AZTEC_LAYERS=9]="AZTEC_LAYERS",te[te.QR_VERSION=10]="QR_VERSION"})(Ke||(Ke={}));var Je=Ke;class lt{constructor(u){this.field=u,this.cachedGenerators=[],this.cachedGenerators.push(new vt(u,Int32Array.from([1])))}buildGenerator(u){const p=this.cachedGenerators;if(u>=p.length){let g=p[p.length-1];const b=this.field;for(let v=p.length;v<=u;v++){const E=g.multiply(new vt(b,Int32Array.from([1,b.exp(v-1+b.getGeneratorBase())])));p.push(E),g=E}}return p[u]}encode(u,p){if(p===0)throw new y("No error correction bytes");const g=u.length-p;if(g<=0)throw new y("No data bytes provided");const b=this.buildGenerator(p),v=new Int32Array(g);j.arraycopy(u,0,v,0,g);let E=new vt(this.field,v);E=E.multiplyByMonomial(p,1);const P=E.divide(b)[1].getCoefficients(),M=p-P.length;for(let W=0;W=5&&(g+=yt.N1+(P-5)),P=1,M=ee)}P>=5&&(g+=yt.N1+(P-5))}return g}}yt.N1=3,yt.N2=3,yt.N3=40,yt.N4=10;class er{constructor(u,p){this.width=u,this.height=p;const g=new Array(p);for(let b=0;b!==p;b++)g[b]=new Uint8Array(u);this.bytes=g}getHeight(){return this.height}getWidth(){return this.width}get(u,p){return this.bytes[p][u]}getArray(){return this.bytes}setNumber(u,p,g){this.bytes[p][u]=g}setBoolean(u,p,g){this.bytes[p][u]=g?1:0}clear(u){for(const p of this.bytes)V.fill(p,u)}equals(u){if(!(u instanceof er))return!1;const p=u;if(this.width!==p.width||this.height!==p.height)return!1;for(let g=0,b=this.height;g> `),u.toString()}setMode(u){this.mode=u}setECLevel(u){this.ecLevel=u}setVersion(u){this.version=u}setMaskPattern(u){this.maskPattern=u}setMatrix(u){this.matrix=u}static isValidMaskPattern(u){return u>=0&&u0;){for(E===6&&(E-=1);_>=0&&_=g;)u^=p<=0)for(let P=0;P!==E;P++){const M=b[P];M>=0&&k.isEmpty(p.get(M,_))&&k.embedPositionAdjustmentPattern(M-2,_-2,p)}}}}k.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),k.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),k.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),k.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),k.VERSION_INFO_POLY=7973,k.TYPE_INFO_POLY=1335,k.TYPE_INFO_MASK_PATTERN=21522;class L{constructor(u,p){this.dataBytes=u,this.errorCorrectionBytes=p}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class H{constructor(){}static calculateMaskPenalty(u){return yt.applyMaskPenaltyRule1(u)+yt.applyMaskPenaltyRule2(u)+yt.applyMaskPenaltyRule3(u)+yt.applyMaskPenaltyRule4(u)}static encode(u,p,g=null){let b=H.DEFAULT_BYTE_MODE_ENCODING;const v=g!==null&&g.get(Je.CHARACTER_SET)!==void 0;v&&(b=g.get(Je.CHARACTER_SET).toString());const E=this.chooseMode(u,b),_=new G;if(E===zt.BYTE&&(v||H.DEFAULT_BYTE_MODE_ENCODING!==b)){const qt=F.getCharacterSetECIByName(b);qt!==void 0&&this.appendECI(qt,_)}this.appendModeInfo(E,_);const P=new G;this.appendBytes(u,E,P,b);let M;if(g!==null&&g.get(Je.QR_VERSION)!==void 0){const qt=Number.parseInt(g.get(Je.QR_VERSION).toString(),10);M=ur.getVersionForNumber(qt);const Mt=this.calculateBitsNeeded(E,_,P,M);if(!this.willFit(Mt,M,p))throw new Kt("Data too big for requested version")}else M=this.recommendVersion(p,E,_,P);const W=new G;W.appendBitArray(_);const ee=E===zt.BYTE?P.getSizeInBytes():u.length;this.appendLengthInfo(ee,M,E,W),W.appendBitArray(P);const oe=M.getECBlocksForLevel(p),ye=M.getTotalCodewords()-oe.getTotalECCodewords();this.terminateBits(ye,W);const Se=this.interleaveWithECBytes(W,M.getTotalCodewords(),ye,oe.getNumBlocks()),Te=new lr;Te.setECLevel(p),Te.setMode(E),Te.setVersion(M);const Ye=M.getDimensionForVersion(),dt=new er(Ye,Ye),Wt=this.chooseMaskPattern(Se,p,M,dt);return Te.setMaskPattern(Wt),k.buildMatrix(Se,p,M,Wt,dt),Te.setMatrix(dt),Te}static recommendVersion(u,p,g,b){const v=this.calculateBitsNeeded(p,g,b,ur.getVersionForNumber(1)),E=this.chooseVersion(v,u),_=this.calculateBitsNeeded(p,g,b,E);return this.chooseVersion(_,u)}static calculateBitsNeeded(u,p,g,b){return p.getSize()+u.getCharacterCountBits(b)+g.getSize()}static getAlphanumericCode(u){return u159)&&(v<224||v>235))return!1}return!0}static chooseMaskPattern(u,p,g,b){let v=Number.MAX_SAFE_INTEGER,E=-1;for(let _=0;_=P}static terminateBits(u,p){const g=u*8;if(p.getSize()>g)throw new Kt("data bits cannot fit in the QR Code"+p.getSize()+" > "+g);for(let E=0;E<4&&p.getSize()0)for(let E=b;E<8;E++)p.appendBit(!1);const v=u-p.getSizeInBytes();for(let E=0;E=g)throw new Kt("Block ID too large");const _=u%g,P=g-_,M=Math.floor(u/g),W=M+1,ee=Math.floor(p/g),oe=ee+1,ye=M-ee,Se=W-oe;if(ye!==Se)throw new Kt("EC bytes mismatch");if(g!==P+_)throw new Kt("RS blocks mismatch");if(u!==(ee+ye)*P+(oe+Se)*_)throw new Kt("Total bytes mismatch");b=1<=0&&p<=9}static appendNumericBytes(u,p){const g=u.length;let b=0;for(;b=33088&&P<=40956?M=P-33088:P>=57408&&P<=60351&&(M=P-49472),M===-1)throw new Kt("Invalid byte sequence");const W=(M>>8)*192+(M&255);p.appendBits(W,13)}}static appendECI(u,p){p.appendBits(zt.ECI.getBits(),4),p.appendBits(u.getValue(),8)}}H.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),H.DEFAULT_BYTE_MODE_ENCODING=F.UTF8.getName();class ne{write(u,p,g,b=null){if(u.length===0)throw new y("Found empty contents");if(p<0||g<0)throw new y("Requested dimensions are too small: "+p+"x"+g);let v=_r.L,E=ne.QUIET_ZONE_SIZE;b!==null&&(b.get(Je.ERROR_CORRECTION)!==void 0&&(v=_r.fromString(b.get(Je.ERROR_CORRECTION).toString())),b.get(Je.MARGIN)!==void 0&&(E=Number.parseInt(b.get(Je.MARGIN).toString(),10)));const _=H.encode(u,v,b);return this.renderResult(_,p,g,E)}writeToDom(u,p,g,b,v=null){typeof u=="string"&&(u=document.querySelector(u));const E=this.write(p,g,b,v);u&&u.appendChild(E)}renderResult(u,p,g,b){const v=u.getMatrix();if(v===null)throw new cr;const E=v.getWidth(),_=v.getHeight(),P=E+b*2,M=_+b*2,W=Math.max(p,P),ee=Math.max(g,M),oe=Math.min(Math.floor(W/P),Math.floor(ee/M)),ye=Math.floor((W-E*oe)/2),Se=Math.floor((ee-_*oe)/2),Te=this.createSVGElement(W,ee);for(let Ye=0,dt=Se;Ye<_;Ye++,dt+=oe)for(let Wt=0,qt=ye;Wtp||v+_>g)throw new y("Crop rectangle does not fit within image data.");P&&this.reverseHorizontal(E,_)}getRow(u,p){if(u<0||u>=this.getHeight())throw new y("Requested row is outside the image: "+u);const g=this.getWidth();(p==null||p.length>16&255,ye=ee>>7&510,Se=ee&255;M[W]=(oe+ye+Se)/4&255}this.luminances=M}else this.luminances=u;if(b===void 0&&(this.dataWidth=p),v===void 0&&(this.dataHeight=g),E===void 0&&(this.left=0),_===void 0&&(this.top=0),this.left+p>this.dataWidth||this.top+g>this.dataHeight)throw new y("Crop rectangle does not fit within image data.")}getRow(u,p){if(u<0||u>=this.getHeight())throw new y("Requested row is outside the image: "+u);const g=this.getWidth();(p==null||p.length"}}class ni extends Mn{constructor(u,p,g){super(u,0,0),this.binaryShiftStart=p,this.binaryShiftByteCount=g}appendTo(u,p){for(let g=0;g62?u.appendBits(this.binaryShiftByteCount-31,16):g===0?u.appendBits(Math.min(this.binaryShiftByteCount,31),5):u.appendBits(this.binaryShiftByteCount-31,5)),u.appendBits(p[this.binaryShiftStart+g],8)}addBinaryShift(u,p){return new ni(this,u,p)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Ms(te,u,p){return new ni(te,u,p)}function zi(te,u,p){return new Mn(te,u,p)}const Ks=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],$n=0,Ni=1,rs=2,wl=3,Ls=4,Oo=new Mn(null,0,0),Zl=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function Bf(te){for(let u of te)V.fill(u,-1);return te[$n][Ls]=0,te[Ni][Ls]=0,te[Ni][$n]=28,te[wl][Ls]=0,te[rs][Ls]=0,te[rs][$n]=15,te}const eu=Bf(V.createInt32Array(6,6));class Za{constructor(u,p,g,b){this.token=u,this.mode=p,this.binaryShiftByteCount=g,this.bitCount=b}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(u,p){let g=this.bitCount,b=this.token;if(u!==this.mode){let E=Zl[this.mode][u];b=zi(b,E&65535,E>>16),g+=E>>16}let v=u===rs?4:5;return b=zi(b,p,v),new Za(b,u,0,g+v)}shiftAndAppend(u,p){let g=this.token,b=this.mode===rs?4:5;return g=zi(g,eu[this.mode][u],b),g=zi(g,p,5),new Za(g,this.mode,0,this.bitCount+b+5)}addBinaryShiftChar(u){let p=this.token,g=this.mode,b=this.bitCount;if(this.mode===Ls||this.mode===rs){let _=Zl[g][$n];p=zi(p,_&65535,_>>16),b+=_>>16,g=$n}let v=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,E=new Za(p,g,this.binaryShiftByteCount+1,b+v);return E.binaryShiftByteCount===2078&&(E=E.endBinaryShift(u+1)),E}endBinaryShift(u){if(this.binaryShiftByteCount===0)return this;let p=this.token;return p=Ms(p,u-this.binaryShiftByteCount,this.binaryShiftByteCount),new Za(p,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(u){let p=this.bitCount+(Zl[this.mode][u.mode]>>16);return this.binaryShiftByteCountu.binaryShiftByteCount&&u.binaryShiftByteCount>0&&(p+=10),p<=u.bitCount}toBitArray(u){let p=[];for(let b=this.endBinaryShift(u.length).token;b!==null;b=b.getPrevious())p.unshift(b);let g=new G;for(const b of p)b.appendTo(g,u);return g}toString(){return Q.format("%s bits=%d bytes=%d",Ks[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(u){return u.binaryShiftByteCount>62?21:u.binaryShiftByteCount>31?20:u.binaryShiftByteCount>0?10:0}}Za.INITIAL_STATE=new Za(Oo,$n,0,0);function Nl(te){const u=Q.getCharCode(" "),p=Q.getCharCode("."),g=Q.getCharCode(",");te[$n][u]=1;const b=Q.getCharCode("Z"),v=Q.getCharCode("A");for(let oe=v;oe<=b;oe++)te[$n][oe]=oe-v+2;te[Ni][u]=1;const E=Q.getCharCode("z"),_=Q.getCharCode("a");for(let oe=_;oe<=E;oe++)te[Ni][oe]=oe-_+2;te[rs][u]=1;const P=Q.getCharCode("9"),M=Q.getCharCode("0");for(let oe=M;oe<=P;oe++)te[rs][oe]=oe-M+2;te[rs][g]=12,te[rs][p]=13;const W=["\0"," ","","","","","","","\x07","\b"," ",` `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let oe=0;oe","?","[","]","{","}"];for(let oe=0;oe0&&(te[Ls][Q.getCharCode(ee[oe])]=oe);return te}const mo=Nl(V.createInt32Array(5,256));class Jl{constructor(u){this.text=u}encode(){const u=Q.getCharCode(" "),p=Q.getCharCode(` `);let g=fn.singletonList(Za.INITIAL_STATE);for(let v=0;v0?(g=Jl.updateStateListForPair(g,v,E),v++):g=this.updateStateListForChar(g,v)}return fn.min(g,(v,E)=>v.getBitCount()-E.getBitCount()).toBitArray(this.text)}updateStateListForChar(u,p){const g=[];for(let b of u)this.updateStateForChar(b,p,g);return Jl.simplifyStates(g)}updateStateForChar(u,p,g){let b=this.text[p]&255,v=mo[u.getMode()][b]>0,E=null;for(let _=0;_<=Ls;_++){let P=mo[_][b];if(P>0){if(E==null&&(E=u.endBinaryShift(p)),!v||_===u.getMode()||_===rs){const M=E.latchAndAppend(_,P);g.push(M)}if(!v&&eu[u.getMode()][_]>=0){const M=E.shiftAndAppend(_,P);g.push(M)}}}if(u.getBinaryShiftByteCount()>0||mo[u.getMode()][b]===0){let _=u.addBinaryShiftChar(p);g.push(_)}}static updateStateListForPair(u,p,g){const b=[];for(let v of u)this.updateStateForPair(v,p,g,b);return this.simplifyStates(b)}static updateStateForPair(u,p,g,b){let v=u.endBinaryShift(p);if(b.push(v.latchAndAppend(Ls,g)),u.getMode()!==Ls&&b.push(v.shiftAndAppend(Ls,g)),g===3||g===4){let E=v.latchAndAppend(rs,16-g).latchAndAppend(rs,1);b.push(E)}if(u.getBinaryShiftByteCount()>0){let E=u.addBinaryShiftChar(p).addBinaryShiftChar(p+1);b.push(E)}}static simplifyStates(u){let p=[];for(const g of u){let b=!0;for(const v of p){if(v.isBetterThanOrEqualTo(g)){b=!1;break}g.isBetterThanOrEqualTo(v)&&(p=p.filter(E=>E!==v))}b&&p.push(g)}return p}}class Vn{constructor(){}static encodeBytes(u){return Vn.encode(u,Vn.DEFAULT_EC_PERCENT,Vn.DEFAULT_AZTEC_LAYERS)}static encode(u,p,g){let b=new Jl(u).encode(),v=U.truncDivision(b.getSize()*p,100)+11,E=b.getSize()+v,_,P,M,W,ee;if(g!==Vn.DEFAULT_AZTEC_LAYERS){if(_=g<0,P=Math.abs(g),P>(_?Vn.MAX_NB_BITS_COMPACT:Vn.MAX_NB_BITS))throw new y(Q.format("Illegal value %s for layers",g));M=Vn.totalBitsInLayer(P,_),W=Vn.WORD_SIZE[P];let Mt=M-M%W;if(ee=Vn.stuffBits(b,W),ee.getSize()+v>Mt)throw new y("Data to large for user specified layer");if(_&&ee.getSize()>W*64)throw new y("Data to large for user specified layer")}else{W=0,ee=null;for(let Mt=0;;Mt++){if(Mt>Vn.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(_=Mt<=3,P=_?Mt+1:Mt,M=Vn.totalBitsInLayer(P,_),E>M)continue;(ee==null||W!==Vn.WORD_SIZE[P])&&(W=Vn.WORD_SIZE[P],ee=Vn.stuffBits(b,W));let In=M-M%W;if(!(_&&ee.getSize()>W*64)&&ee.getSize()+v<=In)break}}let oe=Vn.generateCheckWords(ee,M,W),ye=ee.getSize()/W,Se=Vn.generateModeMessage(_,P,ye),Te=(_?11:14)+P*4,Ye=new Int32Array(Te),dt;if(_){dt=Te;for(let Mt=0;Mt=b||u.get(E+P))&&(_|=1<0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]n&&(n=c,r=o)}if(!r)throw"No largest barcode found";return r},e.prototype.createBarcodeDetectorFormats=function(t){for(var r=[],n=0,i=t;n0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]=a&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),r())})})},e.prototype.getCapabilities=function(){return new f9e(this.getFirstTrackOrFail())},e})(),m9e=(function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,r,n){return QN(this,void 0,void 0,function(){return ZN(this,function(i){return[2,p9e.create(t,this.mediaStream,r,n)]})})},e.create=function(t){return QN(this,void 0,void 0,function(){var r,n;return ZN(this,function(i){switch(i.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return r={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(r)];case 1:return n=i.sent(),[2,new e(n)]}})})},e})(),qV=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(m){try{f(n.next(m))}catch(y){o(y)}}function h(m){try{f(n.throw(m))}catch(y){o(y)}}function f(m){m.done?a(m.value):i(m.value).then(c,h)}f((n=n.apply(e,t||[])).next())})},WV=function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(f){return function(m){return h([f,m])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(r=0)),r;)try{if(n=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]t&&(i.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),f=t),f};c(o.width),c(o.height),o.width=h(o.width)},e.prototype.validateQrboxConfig=function(t){if(typeof t!="number"&&typeof t!="function"&&(t.width===void 0||t.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(t,r,n){if(typeof n=="number")return{width:n,height:n};if(typeof n=="function")try{return n(t,r)}catch(i){throw new Error("qrbox config was passed as a function but it failed with unknown error"+i)}return n},e.prototype.setupUi=function(t,r,n){n.isShadedBoxEnabled()&&this.validateQrboxSize(t,r,n);var i=Nd(n.qrbox)?{width:t,height:r}:n.qrbox;this.validateQrboxConfig(i);var a=this.toQrdimensions(t,r,i);a.height>r&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var o=n.isShadedBoxEnabled()&&a.height<=r,c={x:0,y:0,width:t,height:r},h=o?this.getShadedRegionBounds(t,r,a):c,f=this.createCanvasElement(h.width,h.height),m={willReadFrequently:!0},y=f.getContext("2d",m);y.canvas.width=h.width,y.canvas.height=h.height,this.element.append(f),o&&this.possiblyInsertShadingElement(this.element,t,r,a),this.createScannerPausedUiElement(this.element),this.qrRegion=h,this.context=y,this.canvasElement=f},e.prototype.createScannerPausedUiElement=function(t){var r=document.createElement("div");r.innerText=G0.scannerPaused(),r.style.display="none",r.style.position="absolute",r.style.top="0px",r.style.zIndex="1",r.style.background="rgba(9, 9, 9, 0.46)",r.style.color="#FFECEC",r.style.textAlign="center",r.style.width="100%",t.appendChild(r),this.scannerPausedUiElement=r},e.prototype.scanContext=function(t,r){var n=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(i){return t(i.text,zV.createFromQrcodeResult(i)),n.possiblyUpdateShaders(!0),!0}).catch(function(i){n.possiblyUpdateShaders(!1);var a=G0.codeParseError(i);return r(a,r9e.createFrom(a)),!1})},e.prototype.foreverScan=function(t,r,n){var i=this;if(this.shouldScan&&this.renderedCamera){var a=this.renderedCamera.getSurface(),o=a.videoWidth/a.clientWidth,c=a.videoHeight/a.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var h=this.qrRegion.width*o,f=this.qrRegion.height*c,m=this.qrRegion.x*o,y=this.qrRegion.y*c;this.context.drawImage(a,m,y,h,f,0,0,this.qrRegion.width,this.qrRegion.height);var w=function(){i.foreverScanTimeout=setTimeout(function(){i.foreverScan(t,r,n)},i.getTimeoutFps(t.fps))};this.scanContext(r,n).then(function(A){!A&&t.disableFlip!==!0?(i.context.translate(i.context.canvas.width,0),i.context.scale(-1,1),i.scanContext(r,n).finally(function(){w()})):w()}).catch(function(A){i.logger.logError("Error happend while scanning context",A),w()})}},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var r="facingMode",n="deviceId",i={user:!0,environment:!0},a="exact",o=function(S){if(S in i)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(S,"'")},c=Object.keys(t);if(c.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(c.length," keys");var h=Object.keys(t)[0];if(h!==r&&h!==n)throw"Only '".concat(r,"' and '").concat(n,"' ")+" are supported for 'cameraIdOrConfig'";if(h===r){var f=t.facingMode;if(typeof f=="string"){if(o(f))return{facingMode:f}}else if(typeof f=="object")if(a in f){if(o(f["".concat(a)]))return{facingMode:{exact:f["".concat(a)]}}}else throw"'facingMode' should be string or object with"+" ".concat(a," as key.");else{var m=typeof f;throw"Invalid type of 'facingMode' = ".concat(m)}}else{var y=t.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(a in y)return{deviceId:{exact:y["".concat(a)]}};throw"'deviceId' should be string or object with"+" ".concat(a," as key.")}else{var w=typeof y;throw"Invalid type of 'deviceId' = ".concat(w)}}}var A=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(A)},e.prototype.computeCanvasDrawConfig=function(t,r,n,i){if(t<=n&&r<=i){var a=(n-t)/2,o=(i-r)/2;return{x:a,y:o,width:t,height:r}}else{var c=t,h=r;return t>n&&(r=n/t*r,t=n),r>i&&(t=i/r*t,r=i),this.logger.log("Image downsampled from "+"".concat(c,"X").concat(h)+" to ".concat(t,"X").concat(r,".")),this.computeCanvasDrawConfig(t,r,n,i)}},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var t=document.getElementById(this.elementId);t&&(t.innerHTML="")},e.prototype.possiblyUpdateShaders=function(t){this.qrMatch!==t&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(r){r.style.backgroundColor=t?Ol.BORDER_SHADER_MATCH_COLOR:Ol.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=t)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(t,r,n){var i=t,a=r,o=document.createElement("canvas");return o.style.width="".concat(i,"px"),o.style.height="".concat(a,"px"),o.style.display="none",o.id=Nd(n)?"qr-canvas":n,o},e.prototype.getShadedRegionBounds=function(t,r,n){if(n.width>t||n.height>r)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-n.width)/2,y:(r-n.height)/2,width:n.width,height:n.height}},e.prototype.possiblyInsertShadingElement=function(t,r,n,i){if(!(r-i.width<1||n-i.height<1)){var a=document.createElement("div");a.style.position="absolute";var o=(r-i.width)/2,c=(n-i.height)/2;if(a.style.borderLeft="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderRight="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderTop="".concat(c,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderBottom="".concat(c,"px solid rgba(0, 0, 0, 0.48)"),a.style.boxSizing="border-box",a.style.top="0px",a.style.bottom="0px",a.style.left="0px",a.style.right="0px",a.id="".concat(Ol.SHADED_REGION_ELEMENT_ID),r-i.width<11||n-i.height<11)this.hasBorderShaders=!1;else{var h=5,f=40;this.insertShaderBorders(a,f,h,-h,null,0,!0),this.insertShaderBorders(a,f,h,-h,null,0,!1),this.insertShaderBorders(a,f,h,null,-h,0,!0),this.insertShaderBorders(a,f,h,null,-h,0,!1),this.insertShaderBorders(a,h,f+h,-h,null,-h,!0),this.insertShaderBorders(a,h,f+h,null,-h,-h,!0),this.insertShaderBorders(a,h,f+h,-h,null,-h,!1),this.insertShaderBorders(a,h,f+h,null,-h,-h,!1),this.hasBorderShaders=!0}t.append(a)}},e.prototype.insertShaderBorders=function(t,r,n,i,a,o,c){var h=document.createElement("div");h.style.position="absolute",h.style.backgroundColor=Ol.BORDER_SHADER_DEFAULT_COLOR,h.style.width="".concat(r,"px"),h.style.height="".concat(n,"px"),i!==null&&(h.style.top="".concat(i,"px")),a!==null&&(h.style.bottom="".concat(a,"px")),c?h.style.left="".concat(o,"px"):h.style.right="".concat(o,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(h),t.appendChild(h)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(t){return 1e3/t},e})(),KV;(function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(KV||(KV={}));const k9e=({isOpen:e,onClose:t,onScanSuccess:r})=>{const[n,i]=I.useState([]),[a,o]=I.useState(""),[c,h]=I.useState(!0),[f,m]=I.useState(null),[y,w]=I.useState(""),[A,S]=I.useState(!1),j="qr-camera-scanner-viewport",T=I.useRef(null),D=I.useRef(null);I.useEffect(()=>{if(e)return h(!0),m(null),LS.getCameras().then(X=>{if(X&&X.length>0){i(X);const q=X.find(B=>B.label.toLowerCase().includes("back")||B.label.toLowerCase().includes("rear")||B.label.toLowerCase().includes("environment"));o(q?q.id:X[0].id)}else m("No camera devices detected on this device.");h(!1)}).catch(X=>{console.warn("Camera detection warning:",X),m("Failed to launch real-time lens. Chrome regularly restricts live camera access inside sandboxed iframes."),h(!1)}),()=>{V()}},[e]);const V=async()=>{if(T.current&&T.current.isScanning)try{await T.current.stop()}catch(X){console.warn("Error stopping scanner:",X)}};I.useEffect(()=>{if(!e||!a||c)return;let X=!0;return(async()=>{if(await V(),!X)return;const B=new LS(j);T.current=B;try{await B.start(a,{fps:15,qrbox:(z,F)=>{const $=Math.min(z,F)*.7;return{width:$,height:$}}},z=>{console.log("QR Decoded successfully:",z);let F=z;try{if(z.includes("scan="))F=new URL(z).searchParams.get("scan")||z;else if(z.startsWith("http")){const $=new URL(z);F=$.searchParams.get("scan")||$.searchParams.get("ticket")||z}}catch{}F&&(r(F.trim()),nn.success("Ticket Code decrypted successfully!"),t())},()=>{})}catch(z){console.error("Failed to start scanner:",z),X&&m("Could not initiate live viewport. Browser sandbox permissions may be restricted.")}})(),()=>{X=!1,V()}},[e,a,c]);const U=async X=>{var z;const q=(z=X.target.files)==null?void 0:z[0];if(!q)return;S(!0);const B=nn.loading("Processing image and executing optic logic...");try{await V();const $=await new LS(j).scanFile(q,!0);console.log("File QR decoded:",$);let J=$;try{if($.includes("scan="))J=new URL($).searchParams.get("scan")||$;else if($.startsWith("http")){const Q=new URL($);J=Q.searchParams.get("scan")||Q.searchParams.get("ticket")||$}}catch{}J?(nn.dismiss(B),r(J.trim()),nn.success("Optical Code verified from photo!",{icon:"📸"}),t()):nn.error("Could not find a valid Ticket ID prefix in that code.",{id:B})}catch(F){console.warn("QR decode error from file:",F),nn.error("Decouple optical fail. Make sure the QR Code is highly contrast and fits the viewfinder.",{id:B})}finally{S(!1),D.current&&(D.current.value="")}},G=X=>{X.preventDefault(),y.trim()&&(r(y.trim()),nn.success("Manual booking pass lookup triggered!"),t())};return e?s.jsx("div",{className:"fixed inset-0 z-[12000] flex items-center justify-center p-4 bg-zinc-950/90 backdrop-blur-sm animate-fade-in text-left",children:s.jsxs("div",{className:"bg-white rounded-[2.5rem] p-8 w-full max-w-lg shadow-2xl relative overflow-hidden border border-gray-100 flex flex-col max-h-[90vh]",children:[s.jsx("div",{className:"absolute inset-0 bg-grid-zinc-100/30 opacity-20 pointer-events-none"}),s.jsxs("div",{className:"relative flex items-center justify-between mb-6 z-10",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-red-600 font-black text-[9px] uppercase tracking-widest font-mono",children:[s.jsx(Xi,{size:11,className:"animate-spin duration-3000 text-red-500"}),"Passes & Ticket Scanner"]}),s.jsx("h3",{className:"text-lg font-serif font-black text-gray-950 tracking-tight leading-tight uppercase mt-0.5",children:"Rapid QR Verification"})]}),s.jsx("button",{onClick:t,className:"p-2 bg-gray-50 text-gray-900 hover:bg-gray-100 rounded-full transition-all cursor-pointer border border-transparent hover:border-gray-200 flex items-center justify-center",title:"Terminate scanning session",children:s.jsx(Jr,{size:15,className:"stroke-[2.5]"})})]}),s.jsx("input",{type:"file",ref:D,onChange:U,accept:"image/*",capture:"environment",className:"hidden"}),s.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto space-y-5 relative z-10 pr-1",children:[s.jsxs("div",{className:"relative aspect-video bg-zinc-950 rounded-2xl border border-zinc-800 overflow-hidden flex flex-col items-center justify-center",children:[s.jsx("div",{id:j,className:"absolute inset-0 w-full h-full object-cover [&>video]:object-cover"}),c?s.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-zinc-950 gap-3 text-zinc-400",children:[s.jsx(vn,{className:"animate-spin text-red-500 animate-duration-1000",size:32}),s.jsx("span",{className:"text-[10px] uppercase font-black tracking-widest text-zinc-500",children:"Initializing Optical Feed..."})]}):f?s.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-zinc-950 p-6 text-center gap-2",children:[s.jsx(Su,{className:"text-orange-500",size:30}),s.jsx("p",{className:"text-[10px] font-black text-zinc-300 uppercase tracking-tight",children:f}),s.jsx("p",{className:"text-[9px] text-zinc-500 max-w-xs leading-relaxed mb-2",children:"Browser sandboxing regularly halts cameras in frames. Snap a snapshot photo instead to decrypt instantly!"}),s.jsxs("button",{type:"button",onClick:()=>{var X;return(X=D.current)==null?void 0:X.click()},className:"px-4 py-2.5 bg-red-650 hover:bg-red-700 text-white rounded-lg text-[9px] font-black uppercase tracking-widest shadow-md hover:shadow-lg transition-all flex items-center gap-2 cursor-pointer",children:[s.jsx(BS,{size:12}),"Snap QR Photo 📷"]})]}):s.jsxs("div",{className:"absolute inset-0 pointer-events-none flex flex-col justify-between p-6",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("div",{className:"w-5 h-5 border-t-2 border-l-2 border-red-500"}),s.jsx("div",{className:"w-5 h-5 border-t-2 border-r-2 border-red-500"})]}),s.jsx("div",{className:"w-full h-0.5 bg-gradient-to-r from-transparent via-red-500 to-transparent shadow-[0_0_12px_rgba(239,68,68,0.8)] ",style:{animationDuration:"1.2s"}}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("div",{className:"w-5 h-5 border-b-2 border-l-2 border-red-500"}),s.jsx("div",{className:"w-5 h-5 border-b-2 border-r-2 border-red-500"})]})]}),A&&s.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-zinc-950/80 p-6 text-center gap-2 z-20",children:[s.jsx(vn,{className:"animate-spin text-red-500",size:32}),s.jsx("p",{className:"text-xs font-bold text-zinc-200",children:"Decoding Optical Pass file..."})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("button",{type:"button",onClick:()=>{var X;return(X=D.current)==null?void 0:X.click()},className:"px-4 py-3 bg-red-50 hover:bg-red-100 text-red-650 rounded-xl text-[10px] font-black uppercase tracking-widest transition-all inline-flex items-center justify-center gap-2 border border-red-200/50 cursor-pointer",children:[s.jsx(BS,{size:13}),"Snap Code 📷"]}),s.jsxs("button",{type:"button",onClick:()=>{var X,q;(X=D.current)==null||X.removeAttribute("capture"),(q=D.current)==null||q.click(),setTimeout(()=>{var B;return(B=D.current)==null?void 0:B.setAttribute("capture","environment")},500)},className:"px-4 py-3 bg-gray-50 hover:bg-gray-100 text-gray-700 rounded-xl text-[10px] font-black uppercase tracking-widest transition-all inline-flex items-center justify-center gap-2 border border-gray-200 cursor-pointer",children:[s.jsx(mF,{size:13}),"Pick Image File"]})]}),!c&&n.length>1&&s.jsxs("div",{className:"flex items-center gap-1.5 p-1 bg-gray-50 border border-gray-150 rounded-xl",children:[s.jsx("span",{className:"text-[8px] font-black uppercase tracking-widest text-gray-400 pl-3 shrink-0",children:"Switch Camera:"}),s.jsx("div",{className:"flex-1 flex gap-1 justify-end",children:n.map((X,q)=>s.jsxs("button",{onClick:()=>o(X.id),className:`px-3 py-1.5 rounded-lg text-[9px] font-black uppercase tracking-wider transition-all cursor-pointer ${a===X.id?"bg-white text-gray-950 shadow-xs ring-1 ring-gray-150":"text-gray-550 hover:text-gray-900"}`,children:["Feed ",q+1]},X.id))})]}),s.jsxs("div",{className:"border-t border-gray-100 pt-5 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),s.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-gray-450",children:"Stuck? Manual Pass Code Keyer"})]}),s.jsxs("form",{onSubmit:G,className:"flex gap-2",children:[s.jsx("input",{type:"text",placeholder:"Paste or enter ticket ID (e.g. h6SndA4v...)",value:y,onChange:X=>w(X.target.value),className:"flex-1 px-4 py-3 bg-gray-50 border border-gray-250 focus:border-red-650 rounded-xl text-xs font-bold font-mono outline-none transition-all placeholder:text-gray-400"}),s.jsx("button",{type:"submit",className:"px-5 py-3 bg-zinc-950 hover:bg-zinc-900 text-white rounded-xl text-[9px] font-black uppercase tracking-wider transition-colors cursor-pointer whitespace-nowrap",children:"Verify Code"})]})]})]})]})}):null},YV=[{id:"sample-feat-1",authorId:"campus-pulse",authorName:"Campus Student Guild",authorPhotoURL:"https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=150&auto=format&fit=crop&q=80",content:"📢 Guild nominations are officially open! Grab your nomination kits at the main student centre before Friday 5:00 PM.",createdAt:wn.now(),likeCount:84,commentCount:29},{id:"sample-feat-2",authorId:"sports-desk",authorName:"Inter-Hall Sports Desk",authorPhotoURL:"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=150&auto=format&fit=crop&q=80",content:"⚽ The University Football Derby kicks off this weekend at the Main Arena. Free entry for all verified students!",imageUrl:"https://images.unsplash.com/photo-1508098682722-e99c43a406b2?w=500&auto=format&fit=crop&q=80",createdAt:wn.now(),likeCount:142,commentCount:46},{id:"sample-feat-3",authorId:"tech-innovate",authorName:"Campus Tech & AI Club",authorPhotoURL:"https://images.unsplash.com/photo-1517841905240-472988babdf9?w=150&auto=format&fit=crop&q=80",content:"💡 48-Hour Hackathon announced with cash prizes & direct internship sponsorships! Check out the details in the lounge.",createdAt:wn.now(),likeCount:67,commentCount:18}],_9e=({posts:e,onOpenPosts:t,onAuthorClick:r})=>{const[n,i]=I.useState({}),[a,o]=I.useState({}),c=ie.useMemo(()=>{if(e&&e.length>=3)return e.slice(0,3);if(e&&e.length>0){const f=3-e.length;return[...e,...YV.slice(0,f)]}return YV},[e]),h=async(f,m)=>{var A;f.stopPropagation();const y=n[m.id]||!1,w=a[m.id]!==void 0?a[m.id]:m.likeCount||0;if(i(S=>({...S,[m.id]:!y})),o(S=>({...S,[m.id]:y?Math.max(0,w-1):w+1})),!m.id.startsWith("sample-"))try{const S=st(fe,"posts",m.id),j=(A=Ne.currentUser)==null?void 0:A.uid;y?await Ir(S,{likeCount:Cn(-1),...j?{likedBy:T2(j)}:{}}):await Ir(S,{likeCount:Cn(1),...j?{likedBy:I2(j)}:{}})}catch(S){console.error("Failed to update like:",S)}};return s.jsxs("div",{className:"p-4 sm:p-5 bg-white border border-gray-200/80 rounded-2xl text-left my-4 shadow-xs mx-2 sm:mx-4 select-none",id:"featured-community-posts-section",children:[s.jsxs("div",{className:"flex items-center justify-between pb-2.5 mb-3 border-b border-gray-100 gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ri,{size:15,className:"text-red-650"}),s.jsx("span",{className:"text-[11px] font-black uppercase tracking-wider text-gray-900 font-sans",children:"Campus Lounge"})]}),s.jsxs("button",{type:"button",onClick:t,className:"text-[9.5px] font-black uppercase tracking-wider text-red-650 hover:text-red-700 bg-red-50 hover:bg-red-100/80 px-2.5 py-1 rounded-lg flex items-center gap-1 transition-all cursor-pointer",children:[s.jsx("span",{children:"View all"}),s.jsx(Ip,{size:11})]})]}),s.jsx("div",{className:"space-y-3",children:c.map((f,m)=>{var A;const y=n[f.id]||!1,w=a[f.id]!==void 0?a[f.id]:f.likeCount||0;return s.jsxs("div",{onClick:t,className:"p-3.5 bg-gray-50/60 hover:bg-gray-50 border border-gray-150/70 hover:border-gray-300 rounded-xl transition-all duration-200 cursor-pointer group flex flex-col sm:flex-row items-start gap-3.5 justify-between",children:[s.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[s.jsx("div",{onClick:S=>{f.authorId&&r&&(S.stopPropagation(),r(f.authorId))},className:"shrink-0 pt-0.5 hover:opacity-85 transition-opacity",title:"View author profile",children:f.authorPhotoURL?s.jsx("img",{src:f.authorPhotoURL,alt:f.authorName||"Author",className:"w-9 h-9 rounded-full object-cover border border-gray-200 shadow-2xs",referrerPolicy:"no-referrer"}):s.jsx("div",{className:"w-9 h-9 rounded-full bg-gradient-to-br from-red-600 to-red-800 text-white flex items-center justify-center font-black text-xs uppercase shadow-2xs",children:((A=f.authorName)==null?void 0:A.charAt(0))||"P"})}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{onClick:S=>{f.authorId&&r&&(S.stopPropagation(),r(f.authorId))},className:"flex items-center gap-1.5 min-w-0 hover:underline",children:[s.jsx("span",{className:"text-[11.5px] font-black text-gray-950 truncate font-sans",children:f.authorName||"Campus Peer"}),s.jsx(So,{size:12,className:"shrink-0"})]}),s.jsx("span",{className:"text-[8.5px] font-mono font-bold text-gray-400 shrink-0",children:f.createdAt instanceof wn?Q0(f.createdAt):"Recent"})]}),s.jsx("p",{className:"text-[12px] font-medium text-gray-800 leading-snug line-clamp-2 font-sans group-hover:text-gray-950 transition-colors",children:f.content}),s.jsxs("div",{className:"flex items-center gap-4 pt-1 text-[10px] text-gray-500 font-mono",children:[s.jsxs("button",{type:"button",onClick:S=>h(S,f),className:Ge("flex items-center gap-1.5 px-2 py-0.5 rounded-md hover:bg-red-50 transition-colors cursor-pointer font-bold",y?"text-red-600 bg-red-50/50":"text-gray-600 hover:text-red-600"),title:"Solidarity support",children:[s.jsx(Fl,{size:12,className:y?"fill-red-600 text-red-600 animate-heartbeat":"text-gray-400"}),s.jsx("span",{children:w})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-gray-600 font-bold",children:[s.jsx(Ri,{size:12,className:"text-gray-400"}),s.jsx("span",{children:f.commentCount||0})]})]})]})]}),f.imageUrl&&s.jsx("div",{className:"w-full sm:w-20 sm:h-20 h-28 rounded-xl overflow-hidden shrink-0 border border-gray-200/80 bg-gray-100 shadow-2xs relative",children:s.jsx("img",{src:f.imageUrl,alt:"",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",referrerPolicy:"no-referrer"})})]},`feat-post-${f.id}-${m}`)})})]})};class S9e extends ie.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){const r=(t==null?void 0:t.message)||String(t),n=r.toLowerCase();return n.includes("script error")||n.includes("unexpected token")||n.includes("failed to fetch")||n.includes("networkerror")||n.includes("loading chunk")||n.includes("cors")||n.includes("weather")||n.includes("permission")||n.includes("can only be used on")||n.includes("campuseyemedia")||n.includes("onesignal")||n.includes("could not reach cloud firestore backend")||n.includes("firestore")?(console.warn("Recovered from background glitch silently:",r),{hasError:!1,error:null}):{hasError:!0,error:t}}componentDidCatch(t,r){const n=((t==null?void 0:t.message)||String(t)).toLowerCase();if(n.includes("script error")||n.includes("unexpected token")||n.includes("failed to fetch")||n.includes("networkerror")||n.includes("weather")){console.warn("Recoverable silent error tracked:",t);return}console.error("FATAL APP ERROR:",t,r)}render(){var t,r,n;if(this.state.hasError){const i=((t=this.state.error)==null?void 0:t.message)==="Script error."||((n=(r=this.state.error)==null?void 0:r.message)==null?void 0:n.includes("Script error."));return s.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-white p-10 text-center animate-fade-in relative overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",style:{backgroundImage:"radial-gradient(#000 1px, transparent 1px)",backgroundSize:"20px 20px"}}),s.jsxs("div",{className:"relative z-10",children:[s.jsx("div",{className:"w-24 h-24 bg-red-50 text-red-600 rounded-3xl flex items-center justify-center mb-8 shadow-xl shadow-red-100 mx-auto",children:s.jsx(Su,{size:48})}),s.jsx("h1",{className:"text-4xl md:text-5xl font-black text-gray-900 uppercase tracking-tighter italic mb-6 leading-none",children:i?"Connection Issue":"System Glitch"}),s.jsx("p",{className:"text-gray-500 font-bold max-w-md mx-auto mb-10 leading-relaxed uppercase tracking-wider text-xs",children:i?"An external service (possibly OneSignal or Google AdSense) was briefly blocked. This is common and shouldn't stop your reading.":"We've hit a minor roadblock in the newsroom. Don't worry, we're fixing it live."}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[s.jsx("button",{onClick:()=>window.location.reload(),className:"px-10 py-5 bg-red-600 text-white font-black uppercase tracking-[0.2em] hover:bg-black transition-all rounded-2xl shadow-2xl shadow-red-200 text-xs",children:"Reboot Newsroom"}),s.jsx("button",{onClick:()=>this.setState({hasError:!1,error:null}),className:"px-10 py-5 bg-gray-100 text-gray-500 font-black uppercase tracking-[0.2em] hover:bg-gray-200 transition-all rounded-2xl text-xs",children:"Try to Ignore"})]}),this.state.error&&!i&&s.jsxs("div",{className:"mt-16 text-left max-w-2xl mx-auto",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-300 uppercase tracking-widest mb-4",children:"Diagnostic Trace"}),s.jsx("pre",{className:"p-6 bg-gray-50 border border-gray-100 rounded-2xl text-[10px] text-gray-400 font-mono overflow-auto custom-scrollbar",children:this.state.error.stack||this.state.error.message})]})]})]})}return this.props.children}}function C9e(){return s.jsx(rF,{children:s.jsx(S9e,{children:s.jsx(P9e,{})})})}const XV=({className:e})=>s.jsxs("div",{className:Ge("flex flex-col items-center justify-center space-y-3.5 py-6 px-8 bg-white/90 backdrop-blur-md border border-gray-150 rounded-[2rem] shadow-xl animate-fade-in relative z-50 max-w-xs",e),children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("span",{className:"w-4 h-4 bg-red-650 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),s.jsx("span",{className:"w-4 h-4 bg-blue-600 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),s.jsx("span",{className:"w-4 h-4 bg-emerald-500 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),s.jsx("span",{className:"text-[10px] font-sans font-black uppercase tracking-custom text-gray-500 select-none",children:"Gathering campus reports..."})]}),j9e=()=>s.jsx("div",{className:"w-full max-w-[1680px] xl:max-w-[1780px] 2xl:max-w-[1880px] mx-auto pt-4 pb-20 px-2 sm:px-4 lg:px-6 xl:px-8",children:s.jsxs("div",{className:"grid grid-cols-12 gap-4 lg:gap-5 xl:gap-6 2xl:gap-8",children:[s.jsxs("aside",{className:"hidden lg:block lg:col-span-3 space-y-4 text-left",children:[s.jsxs("div",{className:"bg-white border border-gray-150 shadow-xs rounded-2xl p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-1.5 font-black text-gray-400 text-[10px] tracking-widest pb-2 border-b border-gray-100 uppercase",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-gray-200 shrink-0 "}),s.jsx("span",{children:"Latest News"})]}),s.jsx("div",{className:"grid grid-cols-2 gap-2 pt-1 ",children:[1,2].map(e=>s.jsxs("div",{className:"border border-gray-150 rounded-xl overflow-hidden bg-white flex flex-col space-y-2 pb-2",children:[s.jsx("div",{className:"aspect-[1.4] bg-gray-200 w-full"}),s.jsxs("div",{className:"px-2 space-y-1.5",children:[s.jsx("div",{className:"h-2.5 bg-gray-250 w-full rounded"}),s.jsx("div",{className:"h-2 bg-gray-200 w-2/3 rounded"})]})]},e))})]}),s.jsxs("div",{className:"bg-gradient-to-tr from-gray-955 via-gray-900 to-gray-955 p-4 rounded-2xl text-white border border-white/10 space-y-3.5 shadow-md ",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-200 shrink-0"}),s.jsx("span",{className:"text-[8.5px] font-mono font-black uppercase text-gray-400 tracking-[0.2em]",children:"Latest Lounge Updates"})]}),s.jsx("div",{className:"space-y-3 pt-1",children:[1,2,3].map(e=>s.jsxs("div",{className:"flex items-start gap-2.5 p-2 rounded-xl bg-white/5 border border-white/5",children:[s.jsx("div",{className:"w-7 h-7 rounded-full bg-white/10 shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx("div",{className:"h-2.5 bg-white/20 rounded w-1/3"}),s.jsx("div",{className:"h-2 bg-white/10 rounded w-5/6"})]})]},e))})]})]}),s.jsxs("main",{className:"col-span-12 lg:col-span-6 space-y-5 px-0 bg-white border-r border-l border-gray-100/60",children:[s.jsx("div",{className:"border-b border-gray-100 pb-3 px-4 flex items-center justify-between",children:s.jsx("div",{className:"h-4 w-36 bg-gray-200 rounded "})}),s.jsxs("div",{className:"divide-y divide-gray-100",children:[s.jsx(Ap,{variant:"social"}),s.jsx(Ap,{variant:"social"}),s.jsx(Ap,{variant:"social"})]})]}),s.jsxs("aside",{className:"col-span-12 lg:col-span-3 space-y-4 text-left",children:[s.jsxs("div",{className:"bg-white border border-gray-150 rounded-3xl p-5 shadow-sm space-y-4 ",children:[s.jsx("div",{className:"flex items-center gap-2 font-black text-gray-400 text-[10px] tracking-widest pb-3 border-b border-gray-100 uppercase",children:s.jsx("span",{children:"Trending Sagas"})}),s.jsx("div",{className:"space-y-3.5 pt-1",children:[1,2,3,4].map(e=>s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 bg-gray-200 rounded w-1/4"}),s.jsx("div",{className:"h-3.5 bg-gray-255 rounded w-3/4"})]},e))})]}),s.jsxs("div",{className:"bg-gradient-to-br from-indigo-950 via-slate-900 to-black rounded-3xl p-4 shadow-md space-y-3 border border-white/10 text-white ",children:[s.jsx("div",{className:"h-2.5 bg-indigo-300/30 rounded w-1/3"}),s.jsx("div",{className:"flex justify-center py-2",children:s.jsx("div",{className:"h-10 bg-white/10 rounded-xl w-3/4"})})]})]})]})}),I9e=({userId:e})=>{const[t,r]=ie.useState([]),[n,i]=ie.useState(!0),[a,o]=ie.useState(null);return ie.useEffect(()=>{if(!e)return;const c=Jt(nt(fe,"purchases"),An("userId","==",e));vr(c).then(h=>{r(h.docs.map(f=>({id:f.id,...f.data()}))),i(!1)}).catch(h=>{Gs(h,Ps.LIST,"purchases"),r([]),i(!1)})},[e]),n?s.jsx("div",{className:"flex justify-center p-4",children:s.jsx(vn,{className:"animate-spin text-red-600",size:20})}):t.length===0?s.jsx("div",{className:"bg-gray-50 rounded-2xl p-8 text-center text-left",children:s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest leading-loose",children:"No active tickets found in your inventory."})}):s.jsxs("div",{className:"space-y-3 text-left",children:[t.map(c=>s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-gray-50 rounded-2xl border border-gray-100 group transition-all hover:bg-white hover:shadow-xs",children:[s.jsx("button",{onClick:()=>o(c),className:"shrink-0 relative overflow-hidden bg-white p-1 rounded-xl border border-gray-150 shadow-2xs hover:border-red-200 transition-colors cursor-zoom-in",type:"button",title:"Click to zoom in on pass QR code",children:s.jsx("img",{src:`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${encodeURIComponent(window.location.origin+"?scan="+c.id)}`,alt:"Scan Gate Pass QR",className:"w-12 h-12 rounded-lg object-contain",referrerPolicy:"no-referrer"})}),s.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:()=>o(c),children:[s.jsx("h4",{className:"text-xs font-black text-gray-900 uppercase tracking-tight truncate",children:c.ticketTitle}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[c.taken||c.used?s.jsx("span",{className:"text-[9px] font-black text-green-700 bg-green-50 border border-green-200 rounded px-2 py-0.5 uppercase flex items-center gap-1 select-none font-mono",children:"✔️ Ticked & Used"}):s.jsx("span",{className:"text-[9px] font-black text-red-650 bg-red-50 border border-red-150 rounded px-2 py-0.5 uppercase flex items-center gap-1 font-mono",children:"🎟️ Confirmed (Active)"}),s.jsxs("span",{className:"text-[9px] font-bold text-gray-500 bg-gray-100 rounded px-1.5 py-0.5 uppercase font-mono",children:["Qty: ",c.quantity]})]})]}),s.jsxs("div",{className:"text-right shrink-0 cursor-pointer",onClick:()=>o(c),children:[s.jsxs("p",{className:"text-[9px] font-black text-gray-900",children:["#",c.id.slice(-6).toUpperCase()]}),s.jsx("p",{className:"text-[8px] font-bold text-gray-400 uppercase",children:c.purchaseDate instanceof wn?c.purchaseDate.toDate().toLocaleDateString():"Recent"})]})]},c.id)),a&&s.jsx("div",{className:"fixed inset-0 bg-black/85 backdrop-blur-md flex items-center justify-center p-4 z-[9999]",onClick:()=>o(null),children:s.jsxs("div",{className:"bg-white p-8 rounded-[2.5rem] border border-gray-100 w-full max-w-sm text-center relative shadow-2xl animate-in fade-in zoom-in-95 duration-200",onClick:c=>c.stopPropagation(),children:[s.jsx("button",{className:"absolute top-6 right-6 p-1.5 bg-gray-50 text-gray-900 hover:bg-gray-100 rounded-full transition-all cursor-pointer",onClick:()=>o(null),children:s.jsx(Jr,{size:16,className:"stroke-[2.5]"})}),s.jsx("p",{className:"text-[10px] font-black text-red-600 uppercase tracking-widest mb-1.5 font-mono",children:"Live Event Entry Pass"}),s.jsx("h3",{className:"text-sm font-serif font-black text-gray-950 uppercase tracking-tight leading-tight mb-6",children:a.ticketTitle}),s.jsx("div",{className:"bg-white p-4 rounded-[2.2rem] border border-gray-150 inline-block shadow-inner mb-6 mx-auto",children:s.jsx("img",{src:`https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=${encodeURIComponent(window.location.origin+"?scan="+a.id)}`,alt:"Verification QR code",className:"w-48 h-48 rounded-2xl object-contain mx-auto",referrerPolicy:"no-referrer"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-gray-50 p-4 rounded-2xl border border-gray-100",children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest mb-1",children:"Unique Ticket Pass ID"}),s.jsx("code",{className:"text-[10px] font-mono font-black text-gray-950 uppercase select-all",children:a.id})]}),s.jsxs("div",{className:"flex items-center justify-between text-left text-[10px] font-bold text-gray-500 uppercase px-1",children:[s.jsxs("span",{children:["Quantity: ",s.jsxs("strong",{className:"text-gray-900",children:[a.quantity," Pax"]})]}),s.jsxs("span",{children:["Status: ",s.jsx("strong",{className:a.taken||a.used?"text-green-600 font-mono font-black":"text-red-650 font-mono font-black",children:a.taken||a.used?"✔️ TICKED / USED":"🎟️ ACTIVE"})]})]})]}),s.jsx("p",{className:"text-[8px] font-black uppercase tracking-[0.25em] text-gray-400 mt-8 font-mono",children:"Scan at gate to check in"})]})})]})},T9e=({userId:e})=>{const[t,r]=ie.useState([]),[n,i]=ie.useState(!0),[a,o]=ie.useState({}),c=(h,f)=>{f&&f.stopPropagation(),o(m=>({...m,[h]:!m[h]}))};return ie.useEffect(()=>{if(!e)return;const h=Jt(nt(fe,"notifications"),An("userId","==",e));vr(h).then(f=>{const m=f.docs.map(y=>{var A;const w=y.data();return{id:y.id,...w,createdAt:(A=w.createdAt)!=null&&A.toDate?w.createdAt.toDate():new Date(w.createdAt||Date.now())}});m.sort((y,w)=>w.createdAt.getTime()-y.createdAt.getTime()),r(m),i(!1)}).catch(f=>{console.warn("Silent ignore feedback notifications error:",f),i(!1)})},[e]),n?s.jsx("div",{className:"flex justify-center p-4",children:s.jsx(vn,{className:"animate-spin text-red-600",size:20})}):t.length===0?s.jsx("div",{className:"bg-gray-50 rounded-2xl p-8 text-center text-left",children:s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest leading-loose",children:"No active notification dispatches found in your inbox."})}):s.jsx("div",{className:"space-y-3 text-left",children:t.map((h,f)=>{const m=!!a[h.id],y=h.imageUrl||h.image,w=h.fullAnswer||h.message||"";return s.jsxs("div",{className:Ge("p-4 rounded-2xl border transition-all flex flex-col gap-2 relative group overflow-hidden break-words min-w-0",h.used?"bg-gray-50/50 border-gray-100 opacity-80":"bg-red-50/20 border-red-200 shadow-xs"),children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("span",{className:Ge("text-[8px] font-black uppercase px-2 py-0.5 rounded-md flex items-center gap-1",h.used?"bg-gray-100 text-gray-500":"bg-red-650 text-white shadow-2xs"),children:h.type==="admin_mega_reply"||h.type==="mega_ai_reply"?"🤖 AI / Admin Reply":h.used?"Opened":"Unread Dispatch"}),s.jsx("span",{className:"text-[8px] font-mono text-gray-400 leading-none",children:h.createdAt instanceof Date?h.createdAt.toLocaleString([],{dateStyle:"short",timeStyle:"short"}):"Recent"})]}),s.jsx("button",{onClick:A=>c(h.id,A),className:"px-2 py-1 bg-white hover:bg-gray-100 text-gray-700 hover:text-black rounded-lg transition-all cursor-pointer border border-gray-200 shadow-2xs flex items-center gap-1 text-[8.5px] font-black uppercase tracking-wider shrink-0",title:m?"Minimize notification":"Expand notification details",children:m?s.jsxs(s.Fragment,{children:[s.jsx(gf,{size:12,className:"text-red-600"}),s.jsx("span",{children:"Minimize"})]}):s.jsxs(s.Fragment,{children:[s.jsx(Md,{size:12,className:"text-indigo-600"}),s.jsx("span",{children:"Expand"})]})})]}),s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("h4",{className:"text-xs font-black text-gray-900 uppercase tracking-tight flex items-center gap-1.5",children:[s.jsx(Xi,{size:12,className:"text-amber-500 shrink-0"}),s.jsx("span",{className:"truncate",children:h.title})]}),!m&&s.jsx("p",{className:"text-[10px] text-gray-600 leading-relaxed font-sans mt-1 line-clamp-2 bg-white/60 p-2 rounded-xl border border-gray-100/80",children:w})]}),!m&&y&&s.jsx("div",{onClick:A=>c(h.id,A),className:"w-12 h-12 rounded-xl overflow-hidden border border-gray-200 shrink-0 shadow-2xs relative bg-gray-100 cursor-pointer hover:scale-105 transition-transform",title:"Click to expand image",children:s.jsx(Bi,{src:y,alt:h.title||"Broadcast thumbnail",className:"w-full h-full object-cover"})})]}),m&&s.jsxs("div",{className:"space-y-2.5 mt-1 animate-in fade-in slide-in-from-top-1 duration-200",children:[s.jsx("p",{className:"text-[10.5px] text-gray-700 leading-relaxed font-sans bg-white p-3 rounded-xl border border-gray-200/80 shadow-2xs whitespace-pre-wrap",children:w}),h.userQuery&&s.jsxs("div",{className:"text-[9px] text-gray-500 italic font-mono px-2 py-1.5 bg-gray-50 rounded-lg border border-gray-100",children:[s.jsx("span",{className:"font-bold not-italic text-gray-600",children:"Your Question:"})," ",'"',h.userQuery,'"']}),y&&s.jsxs("div",{className:"rounded-xl overflow-hidden border border-gray-200/90 h-44 sm:h-52 w-full relative shadow-xs bg-black/5",children:[s.jsx(Bi,{src:y,alt:h.title||"Broadcast image",title:h.title,className:"w-full h-full object-cover"}),s.jsx("div",{className:"absolute top-2 right-2 px-2 py-0.5 bg-black/70 backdrop-blur-md text-white text-[8px] font-black uppercase rounded-md tracking-wider border border-white/20",children:"Full Preview"})]}),h.code&&!h.used&&s.jsxs("div",{className:"p-2.5 bg-purple-900/10 border border-purple-200 rounded-xl flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Ea,{size:14,className:"text-purple-700 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[7.5px] font-black uppercase text-purple-900 tracking-wider",children:"Pass Verification Key Code"}),s.jsx("code",{className:"text-xs font-black font-mono text-purple-950 tracking-widest",children:h.code})]})]}),s.jsx("button",{onClick:()=>{navigator.clipboard.writeText(h.code),he.success("Security OTP copied to clipboard!",{icon:"📋"})},className:"px-2.5 py-1 text-[8.5px] font-black uppercase tracking-widest bg-purple-700 hover:bg-purple-800 text-white rounded-lg flex items-center gap-1 cursor-pointer transition-all shadow-xs shrink-0",children:"Copy Key Code"})]}),s.jsxs("div",{className:"pt-2 border-t border-gray-200/60 flex items-center justify-between gap-2 flex-wrap",children:[h.link||h.actionUrl?s.jsxs("a",{href:h.link||h.actionUrl,target:(h.link||h.actionUrl).startsWith("http")?"_blank":"_self",rel:"noopener noreferrer",onClick:()=>{try{const A=localStorage.getItem("clicked_notification_links"),S=A?JSON.parse(A):{};S[h.link||h.actionUrl]=!0,localStorage.setItem("clicked_notification_links",JSON.stringify(S))}catch{}},className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-700 text-white text-[9.5px] font-black uppercase tracking-wider rounded-xl transition-all inline-flex items-center gap-1.5 shadow-2xs",children:[s.jsx(za,{size:11}),s.jsx("span",{children:"Open Attached Link"})]}):s.jsx("div",{}),s.jsxs("button",{onClick:A=>c(h.id,A),className:"px-2.5 py-1 text-[8.5px] font-black uppercase tracking-wider text-gray-700 hover:text-black bg-white hover:bg-gray-100 rounded-lg border border-gray-200 transition-all flex items-center gap-1 cursor-pointer ml-auto",children:[s.jsx(gf,{size:10})," Minimize"]})]})]})]},`notif-${h.id}-${f}`)})})},Hh=e=>{if(!e)return"";let t=e.toLowerCase().trim().replace(/[^a-z0-9]/g,"");return(t==="campusnews"||t==="news"||t==="campus-news")&&(t="news"),(t==="sports"||t==="sport")&&(t="sport"),t};function P9e(){var ra,Yo,Dn,po,bl,ma,Xa,it,Zr,Pi,Qa,vl;const[e,t]=ie.useState(!0),[r,n]=ie.useState(!navigator.onLine);ie.useEffect(()=>{const ge=()=>{t(document.visibilityState==="visible")};return document.addEventListener("visibilitychange",ge),()=>document.removeEventListener("visibilitychange",ge)},[]),ie.useEffect(()=>{const ge=()=>{n(!1),he.success("Connection restored! Syncing latest campus reports...",{icon:"⚡"})},we=()=>{n(!0),he.error("You are currently offline. Accessing previously loaded reports...",{icon:"📦"})};return window.addEventListener("online",ge),window.addEventListener("offline",we),()=>{window.removeEventListener("online",ge),window.removeEventListener("offline",we)}},[]),ie.useEffect(()=>{const ge=we=>{if(we.target&&we.target!==window)return;let Me="";if(we instanceof PromiseRejectionEvent){const Ke=we.reason;if(Ke){const Je=String(Ke.message||Ke).toLowerCase();if(Je.includes("offline")||Je.includes("could not reach"))return;Me=Ke.message||String(Ke)}}else if(we instanceof ErrorEvent)Me=we.message||"";else return;!Me||Me==="Script error."||Me.includes("Script error.")||Me.toLowerCase().includes("offline")||Me.toLowerCase().includes("backend didn't respond")||Me.toLowerCase().includes("websocket")||Me.toLowerCase().includes("closed without opened")||console.error("Fatal App Error:",Me)};return window.addEventListener("error",ge),window.addEventListener("unhandledrejection",ge),()=>{window.removeEventListener("error",ge),window.removeEventListener("unhandledrejection",ge)}},[]);const i=(ge,we)=>{const Me=ge?ge.slice(0,2).trim().toUpperCase():"CE",Ke=(we==null?void 0:we.toLowerCase())||"news";let Je="%23ef4444";return Ke==="sports"&&(Je="%233b82f6"),Ke==="opinion"&&(Je="%2310b981"),Ke==="lifestyle"&&(Je="%238b5cf6"),Ke==="entertainment"&&(Je="%23f59e0b"),`data:image/svg+xml;utf8,${Me}${Ke.toUpperCase()}`},a=["atwiinevictor2@gmail.com","campuseye@gmail.com"],[o,c]=ie.useState(()=>{try{const ge=localStorage.getItem("campus_eye_articles_cache");return ge?JSON.parse(ge).map(Me=>({...Me,isOfflineCached:!0})):[]}catch{return[]}}),[h,f]=ie.useState(()=>{try{const ge=localStorage.getItem("campus_eye_articles_cache");return ge?JSON.parse(ge).map(Me=>({...Me,isOfflineCached:!0})):[]}catch{return[]}}),[m,y]=ie.useState(()=>{try{const ge=localStorage.getItem("campus_eye_articles_cache");return ge?JSON.parse(ge).length===0:!0}catch{return!0}}),[w,A]=ie.useState(()=>{try{const ge=localStorage.getItem("campus_eye_articles_cache");return ge?JSON.parse(ge).length>0:!1}catch{return!1}}),[S,j]=ie.useState(!1),[T,D]=ie.useState(1),[V,U]=ie.useState(10),[G,X]=ie.useState(25),q=ie.useRef(25);q.current=G;const B=ie.useRef(o.length);ie.useEffect(()=>{B.current=o.length},[o.length]);const z=ie.useCallback((ge=15)=>{X(we=>we+ge)},[]),F=ie.useRef(null),$=ie.useCallback(ge=>{F.current&&F.current.disconnect(),ge&&(F.current=new IntersectionObserver(we=>{var Me;(Me=we[0])!=null&&Me.isIntersecting&&z()},{rootMargin:"250px"}),F.current.observe(ge))},[z]);ie.useCallback(ge=>{if(!ge)return;const we=new IntersectionObserver(Me=>{var Ke;(Ke=Me[0])!=null&&Ke.isIntersecting&&z()},{rootMargin:"350px"});return we.observe(ge),()=>we.disconnect()},[z]),ie.useEffect(()=>{let ge=null;const we=()=>{ge||(ge=setTimeout(()=>{ge=null,window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-1e3&&z()},100))};return window.addEventListener("scroll",we,{passive:!0}),()=>{window.removeEventListener("scroll",we),ge&&clearTimeout(ge)}},[z]);const[J,Q]=ie.useState([]),[K,me]=ie.useState(()=>{try{const ge=window.location.pathname,we=new URLSearchParams(window.location.search);let Me=null,Ke=null;if(ge.startsWith("/p/share/")){const lt=ge.split("/p/share/")[1];lt&&(Me=lt.split("/")[0])}else if(ge.includes("/articles=")||ge.startsWith("/articles/")){const yt=ge.replace(/^\/articles=?/,"").split("/").filter(Boolean);yt.length>=2?(Ke=yt[0],Me=yt[1]):yt[0]&&(/^[a-zA-Z0-9_-]{15,30}$/.test(yt[0])?Me=yt[0]:Ke=yt[0])}else if(ge.startsWith("/poll/")&&ge.includes("/candidate/")){const lt=ge.split("/candidate/");lt[1]&&(Ke=lt[1].split("/")[0])}Me||(Me=we.get("id")||we.get("articleId")),Ke||(Ke=we.get("articles")||we.get("article"));const Je=localStorage.getItem("campus_eye_articles_cache");if(Je){const lt=JSON.parse(Je);if(Me){const yt=lt.find(er=>er.id===Me);if(yt)return yt}if(Ke){const yt=Ke.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),er=lt.find(lr=>{const Kt=lr.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return Kt===yt||Kt.replace(/-/g,".")===yt});if(er)return er}}}catch{}return null}),[re,le]=ie.useState(()=>{try{const ge=window.location.pathname,we=new URLSearchParams(window.location.search);let Me=null,Ke=null;if(ge.startsWith("/p/share/")){const Je=ge.split("/p/share/")[1];Je&&(Me=Je.split("/")[0])}else if(ge.includes("/articles=")||ge.startsWith("/articles/")){const lt=ge.replace(/^\/articles=?/,"").split("/").filter(Boolean);lt.length>=2?(Ke=lt[0],Me=lt[1]):lt[0]&&(/^[a-zA-Z0-9_-]{15,30}$/.test(lt[0])?Me=lt[0]:Ke=lt[0])}else if(ge.startsWith("/poll/")&&ge.includes("/candidate/")){const Je=ge.split("/candidate/");Je[1]&&(Ke=Je[1].split("/")[0])}if(Me||(Me=we.get("id")||we.get("articleId")),Ke||(Ke=we.get("articles")||we.get("article")),Me||Ke){const Je=localStorage.getItem("campus_eye_articles_cache");if(Je){const lt=JSON.parse(Je);if(Me&<.some(yt=>yt.id===Me))return!1;if(Ke){const yt=Ke.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(lt.some(er=>{const lr=er.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return lr===yt||lr.replace(/-/g,".")===yt}))return!1}}return!0}}catch{}return!1}),[ve,je]=ie.useState(()=>{try{const ge=localStorage.getItem("campus_eye_custom_pages_cache");return ge?JSON.parse(ge):[]}catch{return[]}}),[Ve,Z]=ie.useState(null),[se,xe]=ie.useState(!1),[ae,qe]=ie.useState(!1),[pt,Fe]=ie.useState(null);ie.useEffect(()=>{const ge=we=>{const Me=we;Me.detail&&Fe(Me.detail)};return window.addEventListener("play-video-podcast",ge),()=>{window.removeEventListener("play-video-podcast",ge)}},[]);const[jt,Pt]=ie.useState(null),[Ae,Ie]=ie.useState(null),[vt,Re]=ie.useState(null),[It,Dt]=ie.useState(!1),[cr,St]=ie.useState(!1),[Ct,Gt]=ie.useState(null),[Xe,Xt]=ie.useState(null),[Ot,or]=ie.useState(!1),[Wr,dr]=ie.useState(!1),[yn,He]=ie.useState(null),[Rt,nr]=ie.useState(null),[fr,hn]=ie.useState(null);ie.useEffect(()=>{const ge=new URLSearchParams(window.location.search),we=ge.get("scan");we&&Gt(we);const Me=window.location.pathname;let Ke=ge.get("postId")||ge.get("post"),Je=ge.get("pinnedId")||ge.get("pinned"),lt=ge.get("advertId")||ge.get("advert");if(Me.startsWith("/p/post/")){const er=Me.split("/p/post/")[1];Ke=er?er.split("/")[0]:null}else if(Me.startsWith("/p/pinned/")){const er=Me.split("/p/pinned/")[1];Je=er?er.split("/")[0]:null}else if(Me.startsWith("/p/ad/")){const er=Me.split("/p/ad/")[1];lt=er?er.split("/")[0]:null}Ke&&(Pt(Ke),Pe("posts"),he.success("Shared campus dispatch loaded!",{icon:"📣"})),Je&&(Ie(Je),Pe("home"),he.success("Shared pinned announcement loaded!",{icon:"📌"})),lt&&(Re(lt),Pe("home"),he.success("Partnership offer loaded!",{icon:"⭐"}));const yt=ge.get("invite");if(yt){let er="A peer";yt.endsWith("-invites-you")?er=yt.replace("-invites-you","").split("-").map(k=>k.charAt(0).toUpperCase()+k.slice(1)).join(" "):yt!=="student-lounge"&&(er=yt.split("-").map(Kt=>Kt.charAt(0).toUpperCase()+Kt.slice(1)).join(" ")),Pe("posts"),he.success(`Welcome! ${er} has invited you to join the Campus Eye Student Lounge! 🤝`,{duration:6e3,icon:"👋"});const lr=new URL(window.location.href);lr.searchParams.delete("invite"),window.history.replaceState({},"",lr.toString())}},[]),ie.useEffect(()=>{const ge=()=>{xe(!0)};return window.addEventListener("open-lounge-auth",ge),()=>{window.removeEventListener("open-lounge-auth",ge)}},[]),ie.useEffect(()=>{if(!Ct){Xt(null);return}or(!0),as(st(fe,"purchases",Ct)).then(ge=>{ge.exists()?Xt({id:ge.id,...ge.data()}):(he.error("Ticket purchase record not found!"),Gt(null)),or(!1)}).catch(ge=>{console.error("Error fetching scanned ticket:",ge),he.error("Error retrieving scanned ticket."),or(!1),Gt(null)})},[Ct]);const[en,Ci]=ie.useState(()=>{try{const ge=window.location.pathname;if(ge==="/u/dashboard")return"admin";if(ge.startsWith("/u/profile"))return"account";const Me=new URLSearchParams(window.location.search).get("tab");if(Me)return Me==="news"||Me==="campusnews"||Me==="campus-news"?"home":Me}catch{}return"home"}),[Gr,be]=ie.useState("home"),Pe=ge=>{const we=ge==="news"||ge==="campusnews"||ge==="campus-news"?"home":ge;be(en),Ci(we)},$e=en,[ct,yr]=ie.useState("all"),[Lt,Lr]=ie.useState(null),[ir,pr]=ie.useState(!1);ie.useEffect(()=>{const ge=setTimeout(()=>{pr(!0)},350);return()=>clearTimeout(ge)},[]);const[br,ln]=ie.useState(null),[de,ke]=ie.useState(!1),[Ze,Ft]=ie.useState(0),[Fr,gr]=ie.useState(0),[Cr,xt]=ie.useState(!1),[Or,_t]=ie.useState("dashboard"),[Oe,ar]=ie.useState(()=>{try{return localStorage.getItem("just_signed_up")==="true"}catch{return!1}}),[ft,mr]=ie.useState([]),[Ht,kr]=ie.useState(!1);ie.useEffect(()=>{try{const ge=new URL(window.location.href),we=ge.pathname;if(en==="admin")we!=="/u/dashboard"&&window.history.replaceState({},"","/u/dashboard");else if(en==="account")if(br){const Me=`/u/profile/${br.id}`;we!==Me&&window.history.replaceState({},"",Me)}else we!=="/u/profile"&&window.history.replaceState({},"","/u/profile");else if(K){const Me=K.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Ke=`/p/share/${K.id}/${Me}`;we!==Ke&&window.history.replaceState({},"",Ke)}else{const Me=new URLSearchParams(window.location.search);en==="home"?Me.delete("tab"):Me.set("tab",en);const Ke=Me.toString(),Je="/"+(Ke?`?${Ke}`:"");(we!=="/"||ge.search!==(Ke?`?${Ke}`:""))&&window.history.replaceState({},"",Je)}}catch(ge){console.warn("Path sync fail:",ge)}},[en,br,K]),ie.useEffect(()=>{const ge=Ne.onAuthStateChanged(async we=>{var Me,Ke;if(we)try{const Je=st(fe,"users",we.uid),lt=["atwiinevictor2@gmail.com","campuseye@gmail.com"],yt=await as(Je),er=yt.exists()?yt.data():{},Kt=lt.includes(we.email||"")||er.isAdmin===!0||er.role==="admin";await Gn(Je,{uid:we.uid,email:we.email||"",displayName:er.displayName||we.displayName||((Me=we.email)==null?void 0:Me.split("@")[0])||"Campus Member",username:er.username||((Ke=we.email)==null?void 0:Ke.split("@")[0])||"user",photoURL:er.photoURL||we.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(we.displayName||"User")}&background=random`,role:Kt?"admin":er.role||"user",isAdmin:Kt,updatedAt:zr()},{merge:!0});const k=localStorage.getItem("campus_eye_personalization_v1");if(k&&JSON.parse(k).interests){ar(!1),await Gn(Je,{interests:JSON.parse(k).interests},{merge:!0});return}if(yt.exists()){const H=yt.data();if(H!=null&&H.interests&&Array.isArray(H.interests)&&H.interests.length>0){const ne={interests:H.interests,categories:{}};H.interests.forEach(Ee=>{ne.categories[Ee]=150}),localStorage.setItem("campus_eye_personalization_v1",JSON.stringify(ne)),localStorage.removeItem("just_signed_up"),ar(!1);return}}localStorage.getItem("just_signed_up")==="true"&&ar(!0)}catch{}});return()=>ge()},[]),ie.useEffect(()=>{try{const ge=window.location.pathname;let we=null;if(ge.startsWith("/u/profile/")?we=ge.split("/u/profile/")[1]:we=new URLSearchParams(window.location.search).get("uid"),we&&Ne.currentUser&&we===Ne.currentUser.uid){ln(null);return}en==="account"&&we?(ke(!0),as(st(fe,"users",we)).then(Me=>{Me.exists()?ln({id:Me.id,...Me.data()}):(he.error("Requested peer profile was not found on Campus Eye.",{id:"profile-not-found"}),ln(null)),ke(!1)}).catch(Me=>{console.warn("Shared user fetch fail:",Me),ke(!1)})):ln(null)}catch{}},[en,(ra=Ne.currentUser)==null?void 0:ra.uid]);const mn=ge=>{var we;try{if(!ge)return;if(ge===((we=Ne.currentUser)==null?void 0:we.uid)){ln(null),Pe("account");return}ke(!0),as(st(fe,"users",ge)).then(Me=>{Me.exists()?(ln({id:Me.id,...Me.data()}),Pe("account")):(he.error("Requested peer profile was not found on Campus Eye.",{id:"profile-not-found"}),ln(null)),ke(!1)}).catch(Me=>{console.warn("Shared user fetch fail:",Me),ke(!1)})}catch(Me){console.warn("Navigate to profile failed:",Me)}};ie.useEffect(()=>{if(!br){Ft(0),gr(0),xt(!1);return}try{const ge=nt(fe,"follows");vr(ge).then(we=>{let Me=0,Ke=0,Je=!1;we.docs.forEach(lt=>{const yt=lt.data();yt.followerId===br.id&&Me++,yt.followedId===br.id&&Ke++,Ne.currentUser&&yt.followerId===Ne.currentUser.uid&&yt.followedId===br.id&&(Je=!0)}),Ft(Me),gr(Ke),xt(Je)}).catch(we=>console.warn("Quiet ignore query follows constraint:",we))}catch(ge){console.warn("Silent follows fail:",ge)}},[br,(Yo=Ne.currentUser)==null?void 0:Yo.uid]),ie.useEffect(()=>(window.triggerAuthWithCallback=ge=>{ge?window.onAuthPendingAction=ge:window.onAuthPendingAction=void 0,xe(!0)},()=>{window.triggerAuthWithCallback=void 0,window.onAuthPendingAction=void 0}),[]);const[fi,_s]=ie.useState(0),[xn,Js]=ie.useState(0),[cs,ji]=ie.useState(0),[Kn,On]=ie.useState([]),Xn=ie.useMemo(()=>[...ve.filter(we=>we.isPinnedStyle===!0).map(we=>{var Je,lt,yt,er;let Me="";try{we.url.includes("v=")?Me=((Je=we.url.split("v=")[1])==null?void 0:Je.split("&")[0])||"":we.url.includes("youtu.be/")?Me=((lt=we.url.split("youtu.be/")[1])==null?void 0:lt.split("?")[0])||"":we.url.includes("embed/")&&(Me=((yt=we.url.split("embed/")[1])==null?void 0:yt.split("?")[0])||"")}catch{}const Ke=Me?`https://img.youtube.com/vi/${Me}/maxresdefault.jpg`:i(we.name,"Custom Tab");return{id:`custom-page-${we.id}`,title:we.name,description:we.description||"Interactive broadcast and real-time live chat channel.",isLiveStream:we.type==="youtube"||we.type==="custom_stream",liveEmbedUrl:we.url,link:"",active:!0,durationSeconds:15,imageUrl:we.type==="youtube"?Ke:i(we.name,"Custom Tab"),createdAt:(er=we.createdAt)!=null&&er.seconds?new Date(we.createdAt.seconds*1e3):new Date,isCustomPagePromo:!0,originalPage:we}}),...Kn],[ve,Kn]),[bi,ci]=ie.useState([]);ie.useEffect(()=>{const ge=Jt(nt(fe,"debates"),di("createdAt","desc"));vr(ge).then(we=>{const Me=we.docs.map(Ke=>{const Je=Ke.data();return{id:Ke.id,...Je,createdAt:Je.createdAt?Je.createdAt.toDate?Je.createdAt.toDate():new Date(Je.createdAt):new Date}});ci(Me)}).catch(we=>{console.warn("Silent ignored debates fetch error:",we)})},[]);const[At,ha]=ie.useState(null),[Un,ts]=ie.useState(!1),[Wa,En]=ie.useState([]);ie.useEffect(()=>{const ge=Jt(nt(fe,"posts"),di("createdAt","desc"),yi(25)),we=ei(ge,Me=>{const Ke=Me.docs.map(Je=>({id:Je.id,...Je.data()})).filter(Je=>!Je.flagged);En(Ke)},Me=>{console.warn("Silent ignored sidebar posts subscription error:",Me)});return()=>we()},[]),ie.useEffect(()=>{const ge=we=>{we.preventDefault(),window.deferredPrompt=we,ha(we),ts(!0)};return window.addEventListener("beforeinstallprompt",ge),()=>{window.removeEventListener("beforeinstallprompt",ge)}},[]),ie.useEffect(()=>{window.scrollTo({top:0,behavior:"auto"}),document.querySelectorAll(".overflow-y-auto").forEach(we=>{we.scrollTop=0})},[$e,Or]),ie.useEffect(()=>{const ge=Jt(nt(fe,"pinned_announcements"));vr(ge).then(we=>{const Me=we.docs.map(Ke=>{const Je=Ke.data();return{id:Ke.id,...Je,createdAt:Je.createdAt?Je.createdAt.toDate?Je.createdAt.toDate():new Date(Je.createdAt):new Date(0)}}).filter(Ke=>Ke.active===!0).sort((Ke,Je)=>Je.createdAt.getTime()-Ke.createdAt.getTime());On(Me)}).catch(we=>{console.warn("Failed to load pinned announcements for home feed:",we)})},[]),ie.useEffect(()=>{const ge=Jt(nt(fe,"custom_pages"),di("createdAt","desc"));vr(ge).then(we=>{const Me=we.docs.map(Ke=>({id:Ke.id,...Ke.data()}));je(Me);try{localStorage.setItem("campus_eye_custom_pages_cache",JSON.stringify(Me))}catch(Ke){console.warn("Failed to cache custom pages:",Ke)}}).catch(we=>{console.warn("Silent ignore custom menus loading issue:",we)})},[]);const[jn,an]=ie.useState(!1),[De,ht]=ie.useState("followers"),[at,Et]=ie.useState(null),[rr,Nr]=ie.useState(null);ie.useEffect(()=>{const ge=we=>{we.detail&&Nr(we.detail)};return window.addEventListener("open-imessage-friend",ge),()=>window.removeEventListener("open-imessage-friend",ge)},[]),ie.useEffect(()=>{if(typeof window<"u"&&"serviceWorker"in navigator){const ge=async we=>{if(we.data&&we.data.type==="NOTIFICATION_REPLY"){const{notifData:Me,replyText:Ke}=we.data,Je=Ne.currentUser;if(!Je||!Ke)return;try{const lt=Je.displayName||"Campus Peer",yt=(Je.displayName||"member").toLowerCase().replace(/\s+/g,""),er=(Me==null?void 0:Me.senderId)||(Me==null?void 0:Me.userId);er&&(await dn(nt(fe,"notifications"),{userId:er,senderId:Je.uid,senderName:lt,senderUsername:yt,senderPhotoURL:Je.photoURL||"",title:`💬 Lockscreen Direct Reply from ${lt}`,message:String(Ke).trim(),type:"direct_message",canReply:!0,used:!1,createdAt:new Date}),he.success("Lockscreen direct reply sent!",{icon:"📲"}))}catch(lt){console.error("Lockscreen reply handler error:",lt)}}};return navigator.serviceWorker.addEventListener("message",ge),()=>navigator.serviceWorker.removeEventListener("message",ge)}},[]),ie.useEffect(()=>{const ge=Ne.onAuthStateChanged(we=>{if(we){const Me=we.uid;try{const Ke=Jt(nt(fe,"follows"),An("followedId","==",Me)),Je=Jt(nt(fe,"follows"),An("followerId","==",Me));Promise.all([vr(Ke),vr(Je)]).then(([lt,yt])=>{Js(lt.size),_s(yt.size)}).catch(lt=>console.warn("Follows count error:",lt))}catch(Ke){console.warn("Follows collection hook error:",Ke)}try{const Ke=Jt(nt(fe,"invitations"),An("status","==","accepted"));vr(Ke).then(Je=>{let lt=0;Je.docs.forEach(yt=>{const er=yt.data();(er.senderId===Me||er.receiverId===Me)&<++}),ji(lt)}).catch(Je=>console.warn("Invites fetch error:",Je))}catch(Ke){console.warn("Invites collection hook error:",Ke)}}else _s(0),Js(0),ji(0)});return()=>{ge()}},[]),ie.useEffect(()=>{$e!=="account"&&$e!=="admin"&&be($e),window.scrollTo({top:0,behavior:"auto"})},[$e]);const[ze,Bt]=ie.useState(""),[Er,jr]=ie.useState(""),[_r,_n]=ie.useState(null),[Be,pe]=ie.useState([]),[ur,Ii]=ie.useState(null),[vi,ti]=ie.useState(null),[ea,Ti]=ie.useState(!1),[zt,Sn]=ie.useState(!1),[Ta,Ss]=ie.useState(!1),[Po,bs]=ie.useState(!1),[Ka,us]=ie.useState("");ie.useEffect(()=>{Ne.currentUser&&us(Ne.currentUser.displayName||"")},[(Dn=Ne.currentUser)==null?void 0:Dn.displayName]);const[gi,vs]=ie.useState(0),[Ds,Rr]=ie.useState(0),[Ya,Qr]=ie.useState("recent"),[Rn,Pa]=ie.useState({name:"",email:((po=Ne.currentUser)==null?void 0:po.email)||"",subject:"General Feedback",message:""}),[ri,fa]=ie.useState(!0),[pa,yl]=ie.useState(!1),[Oa,Ra]=ie.useState(localStorage.getItem("pinnedSize")||"small"),[ds,ta]=ie.useState(1),wi=ge=>{Ra(ge),localStorage.setItem("pinnedSize",ge)};ie.useEffect(()=>{const ge=()=>{fa(window.scrollY<12)};return window.addEventListener("scroll",ge,{passive:!0}),()=>window.removeEventListener("scroll",ge)},[]),ie.useEffect(()=>{if(o.length>0&&e){const ge=setInterval(()=>{vs(we=>(we+1)%Math.min(5,o.length))},5e3);return()=>clearInterval(ge)}},[o,e]),ie.useEffect(()=>{if(o.length>0&&e){const ge=setInterval(()=>{Rr(we=>(we+1)%Math.min(6,o.length))},4e3);return()=>clearInterval(ge)}},[o,e]),ie.useEffect(()=>{const ge=lt=>{lt.detail==="tickets"?St(!0):(Pe(lt.detail),Z(null))},we=lt=>me(lt.detail),Me=lt=>Z(lt.detail),Ke=lt=>{const yt=lt.detail;yt&&yt.id&&(Pt(yt.id),Pe("posts"),he.success(`Opening conversation by @${(yt.authorName||"peer").toLowerCase().replace(/\s+/g,"")}...`,{icon:"📣"}))},Je=lt=>{const yt=lt.detail;yt&&yt.uid&&(mn(yt.uid),he.success(`Opening profile of @${(yt.displayName||"peer").toLowerCase().replace(/\s+/g,"")}...`,{icon:"👤"}))};return window.addEventListener("setTab",ge),window.addEventListener("selectArticle",we),window.addEventListener("selectCustomPage",Me),window.addEventListener("selectPost",Ke),window.addEventListener("selectUser",Je),()=>{window.removeEventListener("setTab",ge),window.removeEventListener("selectArticle",we),window.removeEventListener("selectCustomPage",Me),window.removeEventListener("selectPost",Ke),window.removeEventListener("selectUser",Je)}},[]),ie.useEffect(()=>{var er,lr;let ge="Campus Newsroom - Live Social Hub & Archival Feeds",we="Discover real-time student conversations, official dispatches, ticketing services, live streams, and our complete historical publication archive.",Me="https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",Ke="website",Je=null;if(K){ge=`${K.title} | Campus Newsroom`,we=K.summary||((er=K.content)==null?void 0:er.slice(0,150))||we;const Kt=[K.featuredImageUrl,K.featuredImageUrl1,K.featuredImageUrl2,K.featuredImage,K.imageUrl,K.image,K.photo,K.coverImage,K.thumbnail,K.mediaUrl,K.bannerUrl];let k="";const L=[K.video,K.videoUrl,K.Links].filter(Boolean);for(const Ee of L){const Ue=Ee.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|shorts\/)([^#\&\?]*).*/);if(Ue&&Ue[2].length===11){k=`https://img.youtube.com/vi/${Ue[2]}/hqdefault.jpg`;break}}let H="";if(K.content){const Ee=K.content.match(/]+src=["'](https?:\/\/[^"'\s]+)["']/i)||K.content.match(/!\[.*?\]\((https?:\/\/[^\s\)]+)\)/i);Ee&&Ee[1]&&(H=Ee[1])}const ne=Kt.find(Ee=>Ee&&typeof Ee=="string"&&Ee.trim().length>5)||k||H;Me=ne?ne.startsWith("data:")?`${window.location.origin}/api/article-image/${K.id}`:ne:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",Ke="article",Je={"@context":"https://schema.org","@type":"NewsArticle",headline:K.title,description:K.summary,image:[Me],datePublished:K.publishDate||new Date().toISOString(),author:{"@type":"Person",name:K.authorName||"News Editor"}}}else Ve?(ge=`${Ve.title} | Campus Publication`,we=((lr=Ve.content)==null?void 0:lr.slice(0,150))||we,Ke="article"):$e==="posts"&&(ge="Student Lounge Feed | Live Conversations",we="Browse real-time announcements, debates, and posts shared directly by students and admins on our campus social forum.");document.title=ge;const lt=(Kt,k,L=!1)=>{let H=document.querySelector(L?`meta[name="${Kt}"]`:`meta[property="${Kt}"]`);H||(H=document.createElement("meta"),L?H.setAttribute("name",Kt):H.setAttribute("property",Kt),document.head.appendChild(H)),H.setAttribute("content",k)};lt("description",we,!0),lt("og:title",ge),lt("og:description",we),lt("og:image",Me),lt("og:type",Ke),lt("twitter:card","summary_large_image",!0),lt("twitter:title",ge,!0),lt("twitter:description",we,!0),lt("twitter:image",Me,!0);const yt=document.getElementById("json-ld-seo");if(yt&&yt.remove(),Je){const Kt=document.createElement("script");Kt.id="json-ld-seo",Kt.type="application/ld+json",Kt.innerHTML=JSON.stringify(Je),document.head.appendChild(Kt)}},[K,Ve,$e]),ie.useEffect(()=>{},[]),ie.useEffect(()=>{const ge=Ne.onAuthStateChanged(async we=>{var Me;if(we){try{const lr=st(fe,"users",we.uid);if(!(await as(lr)).exists()){const k=a.includes(we.email||"");await Gn(lr,{uid:we.uid,email:we.email||"",displayName:we.displayName||"Campus Member",photoURL:we.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(we.displayName||"User")}&background=random`,role:k?"admin":"user",isAdmin:k,createdAt:zr(),updatedAt:zr()},{merge:!0}),k&&await Gn(st(fe,"admins",we.uid),{email:we.email||"",isAdmin:!0,createdAt:zr()},{merge:!0})}}catch(lr){if(lr.code==="permission-denied"||(Me=lr.message)!=null&&Me.includes("insufficient permissions")){const Kt={error:lr.message,operationType:"write",path:`users/${we.uid}`,authInfo:{userId:we.uid,email:we.email,emailVerified:we.emailVerified}};console.error("Firestore Permission Error:",JSON.stringify(Kt))}else{const Kt=String((lr==null?void 0:lr.message)||lr);Kt.toLowerCase().includes("offline")||Kt.toLowerCase().includes("could not reach")?console.warn("Error in safety user sync (offline):",lr):console.error("Error in safety user sync:",lr)}}try{const lr=localStorage.getItem("pending_follow_uid"),Kt=localStorage.getItem("pending_follow_name");if(lr&&lr!==we.uid){const k=`${we.uid}_${lr}`;await Gn(st(fe,"follows",k),{followerId:we.uid,followedId:lr,createdAt:new Date});const L=we.displayName?`@${we.displayName.toLowerCase().replace(/\s+/g,"")}`:"A peer";await Gn(st(fe,"notifications",`notif_follow_${we.uid}_${lr}`),{userId:lr,title:"🤝 Lounge Connect",message:`${L} followed you!`,type:"social",used:!0,createdAt:new Date}),he.success(`You are now successfully following ${Kt||"peer"}!`,{icon:"🎉"}),localStorage.removeItem("pending_follow_uid"),localStorage.removeItem("pending_follow_name"),Pe("home")}}catch(lr){console.error("Failed to complete pending follow on auth transition:",lr)}const Ke=st(fe,"users",we.uid),Je=st(fe,"admins",we.uid);let lt=!1,yt=!1;const er=()=>{const lr=lt||yt||a.includes(we.email||"");Sn(lr),localStorage.setItem("is_admin_cached",lr?"true":"false")};ei(Ke,lr=>{if(lr.exists()){const Kt=lr.data();lt=(Kt==null?void 0:Kt.isAdmin)===!0||(Kt==null?void 0:Kt.role)==="admin"}er()},lr=>console.warn("App user doc admin snapshot fail:",lr)),ei(Je,lr=>{if(lr.exists()){const Kt=lr.data();yt=(Kt==null?void 0:Kt.isAdmin)===!0}er()},lr=>console.warn("App admin doc snapshot fail:",lr))}else Pa(Ke=>({...Ke,email:(we==null?void 0:we.email)||Ke.email})),Sn(!1),Pe("home")});return()=>{ge()}},[]),ie.useEffect(()=>{j(!0);const ge=setTimeout(()=>{j(!1)},250);return()=>clearTimeout(ge)},[]),ie.useEffect(()=>{if(!K)return;const ge=Date.now(),we=K.category||"General";return()=>{const Me=Date.now(),Ke=Math.round((Me-ge)/1e3);if(Ke>=1)try{const Je=localStorage.getItem("campus_eye_personalization_v1"),lt=Je?JSON.parse(Je):{categories:{}};lt.categories||(lt.categories={}),lt.categories[we]||(lt.categories[we]=0),lt.categories[we]+=Ke,lt.readArticles||(lt.readArticles=[]),lt.readArticles.includes(K.id)||lt.readArticles.push(K.id),localStorage.setItem("campus_eye_personalization_v1",JSON.stringify(lt))}catch(Je){console.warn("Personalization tracking quiet fail:",Je)}}},[K]),ie.useEffect(()=>{if(!re)if(K){const we=`/articles=${K.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}/${K.id}`,Me=`${K.title} | Campus Eye Media`;window.location.pathname!==we&&window.history.pushState({articleId:K.id},"",we),document.title=Me;const Ke=(ne,Ee,Ue)=>{let wt=document.querySelector(`meta[${ne}="${Ee}"]`);wt||(wt=document.createElement("meta"),wt.setAttribute(ne,Ee),document.head.appendChild(wt)),wt.setAttribute("content",Ue)},Je=(ne,Ee)=>{let Ue=document.querySelector(`link[rel="${ne}"]`);Ue||(Ue=document.createElement("link"),Ue.setAttribute("rel",ne),document.head.appendChild(Ue)),Ue.setAttribute("href",Ee)},lt=K.title,yt=K.summary||K.title,er=[K.featuredImageUrl,K.featuredImageUrl1,K.featuredImageUrl2,K.featuredImage,K.imageUrl,K.image,K.photo,K.coverImage,K.cover,K.thumbnail,K.mediaUrl,K.bannerUrl];let lr="";const Kt=[K.video,K.videoUrl,K.Links].filter(Boolean);for(const ne of Kt){const Ee=ne.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|shorts\/)([^#\&\?]*).*/);if(Ee&&Ee[2].length===11){lr=`https://img.youtube.com/vi/${Ee[2]}/hqdefault.jpg`;break}}let k="";if(K.content){const ne=K.content.match(/]+src=["'](https?:\/\/[^"'\s]+)["']/i)||K.content.match(/!\[.*?\]\((https?:\/\/[^\s\)]+)\)/i);ne&&ne[1]&&(k=ne[1])}const L=er.find(ne=>ne&&typeof ne=="string"&&ne.trim().length>5)||lr||k,H=L?L.startsWith("data:")?`${window.location.origin}/api/article-image/${K.id}`:L:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg";Ke("property","og:title",lt),Ke("property","og:image",H),Ke("property","og:image:url",H),Ke("property","og:image:secure_url",H),Ke("property","og:description",yt),Ke("property","og:url",window.location.href),Ke("name","description",yt),Ke("name","twitter:title",lt),Ke("name","twitter:description",yt),Ke("name","twitter:image",H),Ke("name","twitter:image:src",H),H&&Je("image_src",H);try{let ne=document.getElementById("article-seo-schema");ne||(ne=document.createElement("script"),ne.setAttribute("id","article-seo-schema"),ne.setAttribute("type","application/ld+json"),document.head.appendChild(ne));let Ee=new Date().toISOString();if(K.publishDate)try{const Ue=K.publishDate;typeof Ue.toDate=="function"?Ee=Ue.toDate().toISOString():Ue instanceof Date?Ee=Ue.toISOString():typeof Ue=="string"||typeof Ue=="number"?Ee=new Date(Ue).toISOString():Ue.seconds!==void 0&&(Ee=new Date(Ue.seconds*1e3).toISOString())}catch{}ne.textContent=JSON.stringify({"@context":"https://schema.org","@type":"NewsArticle",headline:K.title,image:[K.featuredImageUrl].filter(Boolean),datePublished:Ee,dateModified:Ee,author:{"@type":"Person",name:K.authorName||"Campus Eye Reporter"},publisher:{"@type":"Organization",name:"Campus Eye Media",url:window.location.origin,logo:{"@type":"ImageObject",url:`${window.location.origin}/logo.png`}},description:K.summary||K.title})}catch(ne){console.warn("Schema injection failed:",ne)}}else{(window.location.pathname.includes("/articles=")||window.location.pathname.startsWith("/articles/")||window.location.pathname.startsWith("/poll/")&&window.location.pathname.includes("/candidate/")||window.location.search.includes("articles=")||window.location.search.includes("article="))&&window.history.pushState({},"","/"),document.title="Campus Eye Media | Latest News, Sports, and Campus Updates";const ge=document.getElementById("article-seo-schema");ge&&ge.remove()}},[K,re]),ie.useEffect(()=>{const ge=localStorage.getItem("campus_eye_theme")||"light";document.body.classList.remove("theme-dark","theme-sepia"),ge!=="light"&&document.body.classList.add(`theme-${ge}`);const we=Ke=>{const Je=Ke.detail.theme;document.body.classList.remove("theme-dark","theme-sepia"),Je!=="light"&&document.body.classList.add(`theme-${Je}`)};window.addEventListener("theme-changed",we);const Me=Ke=>{const Je=Ke.detail;if(Je&&Je.id){const lt=o.find(yt=>yt.id===Je.id);lt?me(lt):as(st(fe,"articles",Je.id)).then(yt=>{yt.exists()&&me({id:yt.id,...yt.data()})}).catch(yt=>console.warn("Could not load article offline:",yt))}};return window.addEventListener("open-article",Me),()=>{window.removeEventListener("theme-changed",we),window.removeEventListener("open-article",Me)}},[o]),ie.useEffect(()=>{o.length===0&&y(!0);const ge=Jt(nt(fe,"articles"),di("publishDate","desc"),yi(G)),we=setTimeout(()=>{y(!1),A(!0)},150),Me=ei(ge,Ke=>{const Je=Ke.metadata.fromCache,lt=Ke.docs.map(yt=>({id:yt.id,...yt.data(),isOfflineCached:Je||!navigator.onLine}));c(lt);try{const lr=lt.map(({isOfflineCached:Kt,...k})=>k).slice(0,25).map(Kt=>{const k={...Kt};return k.featuredImageUrl&&k.featuredImageUrl.startsWith("data:")&&k.featuredImageUrl.length>75e3&&(k.featuredImageUrl=i(k.title,k.category)),k.imageUrl&&k.imageUrl.startsWith("data:")&&(k.imageUrl=""),k.content&&(k.content=k.content.length>1e3?k.content.slice(0,1e3):k.content),k});try{localStorage.setItem("campus_eye_articles_cache",JSON.stringify(lr))}catch{try{const k=lr.map(L=>({id:L.id,title:L.title,summary:L.summary,category:L.category,publishDate:L.publishDate,authorName:L.authorName}));localStorage.setItem("campus_eye_articles_cache",JSON.stringify(k.slice(0,10)))}catch{localStorage.removeItem("campus_eye_articles_cache"),console.warn("Storage quota exceeded. Cleared articles cache key.")}}}catch(yt){console.warn("Failed to cache articles:",yt)}y(!1),A(!0),clearTimeout(we)},Ke=>{const Je=Ke instanceof Error?Ke.message:String(Ke);if(Je.toLowerCase().includes("offline")||Je.toLowerCase().includes("permission")||Je.toLowerCase().includes("failed-precondition"))console.warn("Firestore collection list offline fallback initiated:",Ke);else try{Gs(Ke,Ps.LIST,"articles")}catch(lt){console.error("Firestore Error in articles stream:",lt)}y(!1),A(!0),clearTimeout(we)});return()=>{Me(),clearTimeout(we)}},[G]),ie.useEffect(()=>{let ge=o;const Ke=Array.from(new Set(o.map(Je=>Je.category).filter(Boolean))).map(Je=>Hh(Je)).includes(Hh($e));if(ze.trim()){const Je=ze.toLowerCase();ge=o.filter(lt=>lt.title&<.title.toLowerCase().includes(Je)||lt.content&<.content.toLowerCase().includes(Je)||lt.summary&<.summary.toLowerCase().includes(Je)||lt.category&<.category.toLowerCase().includes(Je))}else Ke&&(ge=o.filter(Je=>Hh(Je.category)===Hh($e)));f(ge)},[o,$e,ze]),ie.useEffect(()=>{if(o.length>0){const we=[...o.length>3?o.slice(3):o].sort(()=>Math.random()-.5);Q(we.slice(0,8))}},[o]),ie.useEffect(()=>{var k;const ge=Jt(nt(fe,"adverts"),An("status","==","active"));vr(ge).then(L=>{const H=L.docs.map(fn=>({id:fn.id,...fn.data()})),ne=Date.now(),Ue=[...H.filter(fn=>!fn.expiresAt||fn.expiresAt.toMillis()>ne)].sort((fn,Fn)=>{var Ms,zi;const Mn=(Ms=fn.createdAt)!=null&&Ms.toMillis?fn.createdAt.toMillis():0;return((zi=Fn.createdAt)!=null&&zi.toMillis?Fn.createdAt.toMillis():0)-Mn});pe(Ue);const wt=Ue.filter(fn=>fn.type==="image"||!fn.type&&fn.imageUrl),xr=Ue.filter(fn=>fn.type==="video"),mt=fn=>{if(fn.length===0)return null;const Fn=Math.floor(Math.pow(Math.random(),1.8)*fn.length);return fn[Fn]},Vt=mt(wt),$r=mt(xr);Vt&&Ii(Vt),$r&&ti($r)}).catch(L=>{Gs(L,Ps.LIST,"adverts")});const we=setTimeout(()=>y(!1),1e3),Me=setInterval(()=>{document.visibilityState==="visible"&&pe(L=>{const H=L.filter(xr=>xr.type==="image"||!xr.type&&xr.imageUrl),ne=L.filter(xr=>xr.type==="video"),Ee=xr=>{if(xr.length===0)return null;const mt=Math.floor(Math.pow(Math.random(),1.8)*xr.length);return xr[mt]},Ue=Ee(H),wt=Ee(ne);return Ue&&Ii(Ue),wt&&ti(wt),L})},5e3);ei(Jt(nt(fe,"notifications"),An("userId","==",((k=Ne.currentUser)==null?void 0:k.uid)||"guest")),L=>{L.docChanges().forEach(H=>{if(H.type==="added"){const ne=H.doc.data();if(!ne.used&&(ne.type==="admin_mega_reply"||ne.type==="mega_ai_reply"||ne.playSound)){try{const Ee=window.AudioContext||window.webkitAudioContext;if(Ee){const Ue=new Ee,wt=Ue.createOscillator(),xr=Ue.createGain();wt.type="sine",wt.frequency.setValueAtTime(587.33,Ue.currentTime),wt.frequency.exponentialRampToValueAtTime(880,Ue.currentTime+.12),xr.gain.setValueAtTime(.25,Ue.currentTime),xr.gain.exponentialRampToValueAtTime(.001,Ue.currentTime+.3),wt.connect(xr),xr.connect(Ue.destination),wt.start(),wt.stop(Ue.currentTime+.3)}}catch{}he.custom(Ee=>s.jsxs("div",{onClick:()=>{he.dismiss(Ee.id),Pe("account")},className:`${Ee.visible?"animate-enter":"animate-leave"} cursor-pointer max-w-md w-full bg-white shadow-2xl rounded-2xl border border-red-200 p-4 flex items-center gap-3 ring-1 ring-black/5`,children:[s.jsx("div",{className:"p-2.5 bg-red-100 text-red-650 rounded-xl shrink-0",children:s.jsx(Xi,{size:18})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs font-black uppercase text-gray-950 tracking-tight",children:ne.title||"🤖 Admin / AI Replied!"}),s.jsx("p",{className:"text-[10px] text-gray-600 line-clamp-2 mt-0.5",children:ne.message||ne.fullAnswer})]})]}),{duration:7500,position:"top-right"})}}})},L=>{console.warn("Silent notification listener info:",L)}),NK().catch(()=>null);const Ke=new Date(Date.now()-300*1e3),Je=new Set,lt=Jt(nt(fe,"articles"),An("publishDate",">",wn.fromDate(Ke)),di("publishDate","desc")),yt=ei(lt,L=>{L.docs.forEach(H=>{const ne=H.id;if(Je.has(ne))return;Je.add(ne);const Ee=H.data();j1(Ee.title||"Campus Eye Dispatch",{body:Ee.summary||Ee.category||"A new article was uploaded to Campus Eye! Tap to read.",tag:`article-${ne}`,renotify:!0}),he.custom(Ue=>s.jsxs("div",{className:`${Ue.visible?"animate-enter":"animate-leave"} max-w-md w-full bg-white shadow-2xl pointer-events-auto flex ring-1 ring-black ring-opacity-5 border-l-4 border-red-600`,children:[s.jsx("div",{className:"flex-1 w-0 p-4",children:s.jsxs("div",{className:"flex items-start",children:[s.jsx("div",{className:"flex-shrink-0 pt-0.5",children:s.jsx(Wh,{className:"h-10 w-10 text-red-600"})}),s.jsxs("div",{className:"ml-3 flex-1",children:[s.jsx("p",{className:"text-sm font-bold text-gray-900 uppercase tracking-tight",children:"New Article Published (< 5 mins)"}),s.jsx("p",{className:"mt-1 text-sm text-gray-500 line-clamp-2 font-serif italic",children:Ee.title})]})]})}),s.jsx("div",{className:"flex border-l border-gray-200",children:s.jsx("button",{onClick:()=>{me({id:H.id,...Ee}),he.dismiss(Ue.id)},className:"w-full border border-transparent rounded-none rounded-r-lg p-4 flex items-center justify-center text-xs font-black text-red-600 hover:text-red-700 uppercase tracking-widest",children:"View"})})]}),{duration:7e3,position:"top-right"})})},L=>{Gs(L,Ps.LIST,"articles/new")}),er=new Date(Date.now()-600*1e3),lr=new Set,Kt=Jt(nt(fe,"adverts"),An("createdAt",">",wn.fromDate(er)),di("createdAt","desc"));return vr(Kt).then(L=>{L.docs.forEach(H=>{const ne=H.id;if(lr.has(ne))return;lr.add(ne);const Ee=H.data();he.custom(Ue=>s.jsxs("div",{className:`${Ue.visible?"animate-enter":"animate-leave"} max-w-md w-full bg-white shadow-2xl pointer-events-auto flex ring-1 ring-black ring-opacity-5 border-l-4 border-blue-600`,children:[s.jsx("div",{className:"flex-1 w-0 p-4",children:s.jsxs("div",{className:"flex items-start",children:[s.jsx("div",{className:"flex-shrink-0 pt-0.5",children:s.jsx(Ea,{className:"h-10 w-10 text-blue-600"})}),s.jsxs("div",{className:"ml-3 flex-1",children:[s.jsx("p",{className:"text-sm font-bold text-gray-900 uppercase tracking-tight",children:"New Sponsored Update"}),s.jsx("p",{className:"mt-1 text-sm text-gray-500 line-clamp-2",children:Ee.title||"Check out this new update!"})]})]})}),s.jsx("div",{className:"flex border-l border-gray-200",children:s.jsx("button",{onClick:()=>{Ee.link&&window.open(Ee.link,"_blank"),he.dismiss(Ue.id)},className:"w-full border border-transparent rounded-none rounded-r-lg p-4 flex items-center justify-center text-xs font-black text-blue-600 hover:text-blue-700 uppercase tracking-widest",children:"Open"})})]}),{duration:6e3,position:"top-right"})})}).catch(L=>{Gs(L,Ps.LIST,"adverts/new")}),()=>{yt(),clearInterval(Me),clearTimeout(we)}},[]),ie.useEffect(()=>{const ge=window.location.pathname;let we=null,Me=null;if(ge.startsWith("/p/share/")){const Je=ge.split("/p/share/")[1];we=Je?Je.split("/")[0]:null}else if(ge.includes("/articles=")||ge.startsWith("/articles/")){const lt=ge.replace(/^\/articles=?/,"").split("/").filter(Boolean);lt.length>=2?(Me=lt[0],we=lt[1]):lt[0]&&(Me=lt[0])}else if(ge.startsWith("/poll/")&&ge.includes("/candidate/")){const lt=ge.split("/candidate/")[1];lt&&(Me=lt)}else we=new URLSearchParams(window.location.search).get("id");const Ke=new URLSearchParams(window.location.search);if(Me||(Me=Ke.get("articles")||Ke.get("article")),we){let Je=!1;try{const lt=localStorage.getItem("campus_eye_articles_cache");if(lt){const er=JSON.parse(lt).find(lr=>lr.id===we);er&&(me(er),le(!1),Je=!0)}}catch(lt){console.warn("Error checking fast article cache:",lt)}as(st(fe,"articles",we)).then(lt=>{if(lt.exists()){const yt={id:lt.id,...lt.data()};me(yt)}le(!1)}).catch(lt=>{console.warn("Direct priority fetch by ID failed:",lt),le(!1)})}else if(Me){const Je=o.find(lt=>{const yt=lt.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),er=Me.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return yt===er||lt.title.toLowerCase()===Me.toLowerCase()});if(Je)me(Je),le(!1);else{const lt=Jt(nt(fe,"articles"),di("publishDate","desc"),yi(25));vr(lt).then(yt=>{const lr=yt.docs.map(Kt=>({id:Kt.id,...Kt.data()})).find(Kt=>{const k=Kt.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),L=Me.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return k===L||Kt.title.toLowerCase()===Me.toLowerCase()||k.replace(/-/g,".")===L});lr&&me(lr),le(!1)}).catch(yt=>{console.warn("Direct priority fetch by slug failed:",yt),le(!1)})}}else le(!1)},[]),ie.useEffect(()=>{const ge=()=>{const we=new URLSearchParams(window.location.search),Me=we.get("articles")||we.get("article"),Ke=we.get("id");if(!Me&&!Ke)me(null);else{const Je=o.find(lt=>lt.id===Ke||Me&<.title.toLowerCase().replace(/[^a-z0-9]/g,"-")===Me.toLowerCase());Je?me(Je):Ke&&as(st(fe,"articles",Ke)).then(lt=>{lt.exists()&&me({id:lt.id,...lt.data()})}).catch(console.error)}};return window.addEventListener("popstate",ge),()=>window.removeEventListener("popstate",ge)},[o]);const Cs=ge=>{Bt(ge),ge.trim()&&(Pe("home"),window.scrollTo({top:0,behavior:"auto"}))},ui=ge=>{Pe("admin"),Ss(!0),_t(ge||"dashboard"),window.scrollTo({top:0,behavior:"auto"})},ho=async ge=>{var Me;const we=(Me=ge.target.files)==null?void 0:Me[0];if(!(!we||!Ne.currentUser))try{Ti(!0);const Ke=await Q2(we,256,256,.8);Ne.currentUser&&(await Gn(st(fe,"users",Ne.currentUser.uid),{photoURL:Ke,updatedAt:zr()},{merge:!0}),he.success("Profile picture updated!"))}catch(Ke){console.error("Error updating profile:",Ke),he.error("Failed to update profile pic")}finally{Ti(!1)}},Ql=async()=>{if(!(!Ka.trim()||!Ne.currentUser))try{Ti(!0),await n$(Ne.currentUser,{displayName:Ka.trim()}),await Gn(st(fe,"users",Ne.currentUser.uid),{displayName:Ka.trim(),updatedAt:zr()},{merge:!0}),bs(!1),he.success("Username successfully authenticated and saved!")}catch(ge){console.error("Error updating name:",ge),he.error("Failed to update display name")}finally{Ti(!1)}},fo=async ge=>{var we,Me;if(ge.preventDefault(),!!Rn.message.trim())try{Ti(!0),await dn(nt(fe,"feedback"),{...Rn,userId:((we=Ne.currentUser)==null?void 0:we.uid)||null,createdAt:zr()}),he.success("Feedback transmitted. Thank you!"),Pa({name:"",email:((Me=Ne.currentUser)==null?void 0:Me.email)||"",subject:"General Feedback",message:""}),Pe("home")}catch(Ke){console.error("Error submitting feedback:",Ke),he.error("Failed to send feedback.")}finally{Ti(!1)}},Ko=()=>{var Je,lt,yt,er,lr,Kt,k;if(!w||S)return s.jsxs("div",{className:"relative w-full min-h-[75vh] overflow-hidden",children:[s.jsx("div",{className:"filter blur-[4px] opacity-40 select-none pointer-events-none",children:s.jsx(j9e,{})}),s.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center p-4",children:s.jsx(XV,{})})]});const ge=Array.from(new Set(o.map(L=>L.category).filter(Boolean))),Me=ge.map(L=>Hh(L)).includes(Hh($e)),Ke=ze.trim()?h:Me?o.filter(L=>Hh(L.category)===Hh($e)):h;if($e==="home"||$e==="for-you"||Me){let L=[...Ke];if(Lt!==null&&(L=L.filter(mt=>{const Vt=mt.publishDate;if(!Vt)return!1;const $r=Vt.toDate?Vt.toDate():Vt.seconds?new Date(Vt.seconds*1e3):new Date(Vt),fn=new Date;fn.setHours(0,0,0,0);const Fn=new Date($r);Fn.setHours(0,0,0,0);const Mn=fn.getTime()-Fn.getTime();return Math.floor(Mn/(1e3*60*60*24))+1===Lt})),$e==="for-you")try{const mt=localStorage.getItem("campus_eye_personalization_v1");let Vt={};if(mt){const Fn=JSON.parse(mt);Fn&&Fn.categories&&(Vt={...Fn.categories})}const $r=(Je=Ne.currentUser)==null?void 0:Je.uid,fn=new Set;if($r)for(let Fn=0;Fn=3){const Ms=ni.slice(1,ni.length-1).join("_");fn.add(Ms);const zi=o.find(Ks=>Ks.id===Ms);if(zi&&zi.category){const Ks=zi.category;Vt[Ks]=(Vt[Ks]||0)+25}}}}if(ct==="saved")L=L.filter(Fn=>fn.has(Fn.id));else{const Fn=L.map(Mn=>{let ni=0;fn.has(Mn.id)&&(ni+=1e6);const zi=Mn.category||"General";Vt[zi]&&(ni+=Vt[zi]*2.5);const Ks=Mn.publishDate&&typeof Mn.publishDate.toMillis=="function"?Mn.publishDate.toMillis():0;return ni+=Ks/1e11,{article:Mn,score:ni}});Fn.sort((Mn,ni)=>ni.score-Mn.score),L=Fn.map(Mn=>Mn.article)}}catch(mt){console.warn("Failed to sort personalized articles:",mt)}else L.sort((mt,Vt)=>{const $r=mt.publishDate&&typeof mt.publishDate.toMillis=="function"?mt.publishDate.toMillis():0;return(Vt.publishDate&&typeof Vt.publishDate.toMillis=="function"?Vt.publishDate.toMillis():0)-$r});const H=Math.max(1,Math.ceil(L.length/V)),ne=Math.min(T,H),Ee=L.slice((ne-1)*V,ne*V),Ue=Ee.slice(0,Math.min(Ee.length,8)),wt=Ee.length>8?Ee.slice(8,Math.min(Ee.length,10)):[],xr=Ee.length>10?Ee.slice(10):[];return s.jsxs("div",{className:"w-full max-w-[1680px] xl:max-w-[1780px] 2xl:max-w-[1880px] mx-auto pt-1 sm:pt-4 pb-20 px-1 sm:px-4 lg:px-6 xl:px-8",children:[s.jsxs("div",{className:"grid grid-cols-12 gap-4 lg:gap-5 xl:gap-6 2xl:gap-8",children:[s.jsxs("aside",{className:"hidden lg:block lg:col-span-3 xl:col-span-3 2xl:col-span-3 space-y-4 pr-1 text-left select-none sticky top-24 self-start max-h-[calc(100vh-8rem)] overflow-y-auto no-scrollbar scroll-smooth",children:[s.jsxs("div",{className:"bg-white border border-gray-150/90 rounded-2xl p-4 shadow-xs space-y-3.5 text-left relative resize-y overflow-auto min-h-[320px] max-h-[75vh] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:bg-gray-200 [&::-webkit-scrollbar-thumb]:rounded-full",children:[s.jsxs("div",{className:"flex items-center justify-between pb-2.5 border-b border-gray-100 sticky top-0 bg-white/95 backdrop-blur-sm z-10",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(d8,{size:16,className:"text-red-650 shrink-0"}),s.jsx("span",{className:"text-[10px] font-mono font-black uppercase text-red-650 tracking-[0.15em]",children:"Market"})]}),s.jsx("button",{onClick:()=>{Pe("posts"),window.scrollTo({top:0,behavior:"auto"})},className:"text-[8px] font-black uppercase tracking-wider px-2 py-1 bg-red-50 text-red-650 hover:bg-red-650 hover:text-white rounded-lg transition-all cursor-pointer",children:"Open Market"})]}),Wa.length===0?s.jsxs("div",{className:"py-6 text-center text-gray-400 space-y-1",children:[s.jsx(d8,{size:20,className:"mx-auto text-gray-300 mb-1"}),s.jsx("p",{className:"text-[9px] font-bold uppercase tracking-wider",children:"No Market Listings"}),s.jsx("p",{className:"text-[8px] text-gray-400",children:"Be the first to list an item in the Market!"})]}):s.jsx("div",{className:"space-y-3 divide-y divide-gray-100",children:Wa.map((mt,Vt)=>{var $r;return s.jsxs("div",{onClick:()=>{Pe("posts"),window.scrollTo({top:0,behavior:"auto"})},className:"pt-3 first:pt-0 group cursor-pointer hover:bg-gray-50/70 p-2 rounded-xl transition-all",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsxs("div",{onClick:fn=>{fn.stopPropagation(),mt.authorId&&mn(mt.authorId)},className:"flex items-center gap-2 min-w-0 hover:underline",children:[mt.authorPhotoURL?s.jsx(Bi,{src:mt.authorPhotoURL,alt:"",className:"w-6 h-6 rounded-full object-cover border border-gray-200 shrink-0 overflow-hidden"}):s.jsx("div",{className:"w-6 h-6 rounded-full bg-red-650 text-white flex items-center justify-center text-[9px] font-black uppercase shrink-0",children:(($r=mt.authorName)==null?void 0:$r.charAt(0))||"M"}),s.jsxs("span",{className:"text-[9.5px] font-extrabold text-gray-950 truncate max-w-[110px] flex items-center gap-1",children:[mt.authorName,s.jsx(So,{size:12,className:"shrink-0"})]})]}),s.jsx("span",{className:"text-[7.5px] font-mono text-gray-400 shrink-0",children:mt.createdAt instanceof wn?Q0(mt.createdAt):"Recent"})]}),s.jsx("p",{className:"text-[9.5px] font-medium text-gray-750 leading-relaxed line-clamp-3 select-text font-sans",children:mt.content}),mt.imageUrl&&s.jsx("div",{className:"mt-2 h-28 w-full rounded-lg overflow-hidden border border-gray-150 bg-gray-950 relative",children:s.jsx(Bi,{src:mt.imageUrl,alt:"",className:"w-full h-full object-cover group-hover:scale-102 transition-transform duration-300"})}),s.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[8px] font-mono font-bold text-gray-400",children:[s.jsxs("span",{className:"flex items-center gap-1 hover:text-red-500",children:[s.jsx(Fl,{size:10,className:mt.likeCount?"fill-red-500 text-red-500":""}),mt.likeCount||0]}),s.jsxs("span",{className:"flex items-center gap-1 hover:text-blue-500",children:[s.jsx(Ri,{size:10}),mt.commentCount||0]})]})]},`sidebar-${mt.id}-${Vt}`)})})]}),vi&&s.jsxs("div",{className:"bg-white border border-gray-150 rounded-2xl p-3 shadow-xs space-y-2 text-left",children:[s.jsx("div",{className:"flex items-center justify-between border-b border-gray-100 pb-1.5 mb-1.5",children:s.jsxs("span",{className:"text-[9px] font-black tracking-[0.12em] text-red-655 uppercase flex items-center gap-1",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-650 shrink-0"}),s.jsx("span",{children:"Promotional Partner"})]})}),s.jsx(Kw,{advert:vi})]})]}),s.jsxs("main",{className:"col-span-12 lg:col-span-6 space-y-5 px-0 min-h-screen border-r border-l border-gray-100/60 bg-white",children:[$e!=="home"&&s.jsx("div",{className:"border-b border-gray-100 pb-3 px-4 flex items-center justify-between sticky top-11 bg-white/95 backdrop-blur-md z-30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-650 shrink-0"}),s.jsx("h3",{className:"text-[10px] font-extrabold tracking-wider text-red-650 uppercase font-mono px-2 py-1 rounded-md bg-red-50 border border-red-150/55 shadow-xs flex items-center gap-1.5 shrink-0 select-none",children:ze.trim()?s.jsxs("div",{className:"flex items-center gap-1 leading-none uppercase text-[9px]",children:[s.jsxs("span",{children:["Search:"," ",s.jsxs("span",{className:"text-red-750 italic",children:['"',ze,'"']})]}),s.jsx("button",{onClick:()=>{Bt(""),window.dispatchEvent(new CustomEvent("clearSearchQuery"))},className:"p-0.5 text-red-400 hover:text-red-650 hover:bg-white rounded-full transition-colors cursor-pointer ml-1 inline-flex items-center justify-center shrink-0",title:"Clear Search",children:s.jsx(Jr,{size:10,strokeWidth:2.5})})]}):$e==="for-you"?s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 w-full pr-2",children:[s.jsx("span",{children:"Curated For You"}),s.jsxs("div",{className:"flex items-center gap-1 bg-gray-100/80 p-0.5 rounded-xl text-[9px] font-extrabold uppercase tracking-wider",children:[s.jsx("button",{type:"button",onClick:()=>yr("all"),className:Ge("px-2.5 py-1 rounded-lg transition-all cursor-pointer",ct==="all"?"bg-white text-gray-950 shadow-xs":"text-gray-500 hover:text-gray-800"),children:"All Feed"}),s.jsxs("button",{type:"button",onClick:()=>yr("saved"),className:Ge("px-2.5 py-1 rounded-lg transition-all cursor-pointer flex items-center gap-1",ct==="saved"?"bg-red-650 text-white shadow-xs":"text-gray-500 hover:text-gray-800"),children:[s.jsx(Dre,{size:10,className:"fill-current"}),s.jsx("span",{children:"Saved Stories"})]})]})]}):Me?`${ge.find(mt=>{let Vt=mt.toLowerCase().replace(/\s+/g,"-");return(Vt==="campus-news"||Vt==="news")&&(Vt="news"),(Vt==="sports"||Vt==="sport")&&(Vt="sport"),Vt===$e.toLowerCase()})||$e} Feed`:"Campus News"})]})}),s.jsx(on,{children:ri&&o.length>0&&$e==="home"&&s.jsx(Qt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},className:"overflow-hidden",children:s.jsx(Eye,{articles:o,onClick:me})})}),pa&&Xn.length>0&&$e==="home"&&s.jsxs("div",{className:"px-4 py-1 space-y-2 relative group",children:[Xn.slice(0,ds).map(mt=>{const Vt=Oa==="small",$r=Oa==="large",fn=Vt?"p-1.5 py-1 px-3 rounded-lg gap-2 text-left animate-fade-in border-red-150":$r?"p-4.5 px-6 rounded-2xl gap-4.5 text-left animate-fade-in":"p-3 px-4 rounded-xl gap-3.5 text-left animate-fade-in",Fn=Vt?"w-7 h-7 rounded-md":$r?"w-14 h-14 rounded-xl shadow-xs":"w-11 h-11 rounded-lg",Mn=Vt?10:$r?15:13,ni=Vt?"text-[9px]/[10px] font-black tracking-custom":$r?"text-[12.5px]/[15px] font-black tracking-custom":"text-[11px]/[13px] font-black tracking-custom",Ms=Vt?"text-[8px]/[9.5px] text-gray-500 mt-0.5 line-clamp-1":$r?"text-[10.5px]/[14px] text-gray-500 mt-1 line-clamp-3 leading-relaxed":"text-[9.5px]/[12px] text-gray-500 mt-0.5 line-clamp-2 leading-relaxed",zi=Vt?"text-[6.5px]/none px-2 py-0.5 mt-0.5 font-black rounded gap-0.5":$r?"text-[9.5px]/none px-4 py-2 mt-2 font-black rounded-xl gap-1.5":"text-[8.5px]/none px-3 py-1.5 mt-1.5 font-black rounded-lg gap-1",Ks=Vt?5:$r?9:7,$n=Vt?"pr-24":$r?"pr-36":"pr-32";return s.jsxs("div",{onClick:()=>{mt.isCustomPagePromo?Z(mt.originalPage):mt.isLiveStream&&mt.liveEmbedUrl&&(nr(mt.liveEmbedUrl),hn(mt.title))},className:`bg-red-50/70 border border-red-150/80 flex flex-row items-center relative overflow-hidden hover:border-red-650 transition-all duration-300 ${mt.isLiveStream&&mt.liveEmbedUrl||mt.isCustomPagePromo?"cursor-pointer hover:bg-red-100/30":""} ${fn}`,children:[s.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-1.5 z-10 select-none",children:[s.jsxs("div",{className:"flex items-center bg-white border border-gray-150 rounded-md p-0.5 shadow-3xs text-[7px] font-black uppercase text-gray-500 overflow-hidden shrink-0",children:[s.jsx("button",{onClick:Ni=>{Ni.stopPropagation(),wi("small")},className:`px-1 py-0.2 rounded-xs transition-all cursor-pointer ${Vt?"bg-red-600 text-white font-black animate-scale-in":"hover:bg-gray-100 text-gray-400"}`,title:"Set compact size",children:"-"}),s.jsx("button",{onClick:Ni=>{Ni.stopPropagation(),wi("medium")},className:`px-1 py-0.2 rounded-xs transition-all cursor-pointer ${Oa==="medium"?"bg-red-600 text-white font-black animate-scale-in":"hover:bg-gray-100 text-gray-400"}`,title:"Set regular size",children:"A"}),s.jsx("button",{onClick:Ni=>{Ni.stopPropagation(),wi("large")},className:`px-1 py-0.2 rounded-xs transition-all cursor-pointer ${$r?"bg-red-600 text-white font-black animate-scale-in":"hover:bg-gray-100 text-gray-400"}`,title:"Set large size",children:"+"})]}),s.jsxs("div",{className:"px-1.5 py-0.5 bg-red-600 text-white rounded-full text-[6.5px] font-black uppercase tracking-wider flex items-center gap-0.5 shadow-2xs shrink-0",children:[s.jsx(j0,{size:6})," Pinned"]}),zt&&s.jsx("button",{onClick:async Ni=>{if(Ni.stopPropagation(),!zt){he.error("Access Denied: Only admins can delete announcements.");return}if(window.confirm("Are you sure you want to delete this pinned announcement?"))try{he.loading("Deleting pinned notice...",{id:`delete-pinned-${mt.id}`}),await ai(st(fe,"pinned_announcements",mt.id)),he.success("Notice deleted!",{id:`delete-pinned-${mt.id}`})}catch(rs){he.error(rs.message||String(rs),{id:`delete-pinned-${mt.id}`})}},className:"p-1 bg-white hover:bg-red-50 text-red-650 border border-gray-150 rounded-md transition-all cursor-pointer shadow-3xs shrink-0 flex items-center justify-center h-4.5 w-4.5",title:"Delete announcement permanently (Master Admin)",children:s.jsx(Es,{size:9})})]}),mt.isLiveStream&&mt.liveEmbedUrl?s.jsxs("div",{onClick:Ni=>{Ni.stopPropagation(),nr(mt.liveEmbedUrl),hn(mt.title)},className:`relative border border-red-200/40 shrink-0 overflow-hidden bg-gray-905 select-none cursor-pointer hover:border-red-650 transition-colors ${Fn}`,title:"Click to watch live stream",children:[s.jsx("img",{src:(()=>{var wl,Ls,Oo;const Ni=mt.liveEmbedUrl;if(!Ni)return mt.imageUrl||i(mt.title,"Announcement");let rs="";return Ni.includes("embed/")?rs=((wl=Ni.split("embed/")[1])==null?void 0:wl.split(/[?#]/)[0])||"":Ni.includes("v=")?rs=((Ls=Ni.split("v=")[1])==null?void 0:Ls.split(/[?&#]/)[0])||"":Ni.includes("youtu.be/")&&(rs=((Oo=Ni.split("youtu.be/")[1])==null?void 0:Oo.split(/[?#]/)[0])||""),rs?`https://img.youtube.com/vi/${rs}/hqdefault.jpg`:mt.imageUrl||i(mt.title,"Announcement")})(),className:"absolute inset-0 w-full h-full object-cover border-0",alt:"Live stream thumbnail",referrerPolicy:"no-referrer"}),s.jsx("div",{className:"absolute inset-0 bg-black/40 hover:bg-black/20 transition-all flex items-center justify-center",children:s.jsx("span",{className:"bg-red-650 text-white font-black text-[8px] uppercase tracking-[0.16em] px-2 py-1 rounded shadow-md border border-red-500",children:"🔴 LIVE SOURCE"})})]}):mt.imageUrl?s.jsx("img",{src:mt.imageUrl,alt:"",className:`object-cover border border-red-100/40 shrink-0 ${Fn}`,referrerPolicy:"no-referrer"}):s.jsx("div",{className:`bg-red-150 text-red-600 flex items-center justify-center font-black shrink-0 ${Fn}`,children:s.jsx(Ru,{size:Mn})}),s.jsxs("div",{className:`flex-1 text-left min-w-0 ${$n}`,children:[s.jsx("h4",{className:`text-gray-950 uppercase tracking-tight leading-snug truncate ${ni}`,children:mt.title}),mt.description&&s.jsx("p",{className:`${Ms}`,children:mt.description}),mt.isLiveStream&&mt.liveEmbedUrl?s.jsx("button",{onClick:Ni=>{Ni.stopPropagation(),mt.isCustomPagePromo?Z(mt.originalPage):(nr(mt.liveEmbedUrl),hn(mt.title))},className:`font-black bg-red-650 text-white hover:bg-red-700 inline-flex items-center uppercase tracking-wider cursor-pointer border border-red-700 shadow-sm active:scale-95 transition-all ${zi}`,children:s.jsx("span",{children:"🔴 Watch Stream Live"})}):mt.link?s.jsxs("button",{onClick:()=>{mt.link&&window.open(mt.link,"_blank","noopener,noreferrer")},className:`font-black bg-neutral-950 text-white hover:bg-neutral-800 inline-flex items-center uppercase tracking-wider cursor-pointer border border-neutral-800 shadow-sm active:scale-95 transition-all ${zi}`,children:[s.jsx("span",{children:mt.ctaText||mt.buttonText||"Discover More"}),s.jsx(za,{size:Ks,strokeWidth:3})]}):null]})]},mt.id)}),Xn.length>ds&&s.jsxs("button",{type:"button",onClick:()=>ta(Xn.length),className:"w-full py-1.5 bg-red-50/50 hover:bg-red-100 border border-dashed border-red-200 hover:border-red-400 rounded-lg flex items-center justify-center gap-1.5 text-[8.5px]/none font-black uppercase text-red-655 transition-all duration-150 cursor-pointer shadow-3xs",children:[s.jsx(Md,{size:11,className:"stroke-[2.5]"}),s.jsxs("span",{children:["Show Other Pinned Announcements (",Xn.length-ds," more)"]})]}),ds>1&&s.jsxs("button",{type:"button",onClick:()=>ta(1),className:"w-full py-1.5 text-gray-400 hover:text-red-650 text-[8px]/none font-bold uppercase tracking-wider flex items-center justify-center gap-1 transition-colors duration-150 cursor-pointer",children:[s.jsx(gf,{size:10}),s.jsx("span",{children:"Collapse Pinned List"})]})]}),$e==="for-you"&&Ht?s.jsxs("div",{className:"py-20 flex flex-col items-center justify-center text-center space-y-4",children:[s.jsx(XV,{}),s.jsx("p",{className:"text-[10px] font-sans font-black uppercase tracking-custom text-gray-500 mt-2",children:"Crafting your custom campus feed..."})]}):$e==="for-you"&&Oe?s.jsxs("div",{className:"max-w-md mx-auto py-8 px-4 text-center",children:[s.jsx("p",{className:"text-[9px] font-black uppercase tracking-widest text-gray-400 mb-6 bg-red-50 py-1.5 px-3 rounded-full inline-block",children:"📢 Interest Personalization"}),s.jsxs("div",{className:"bg-white border border-gray-150 rounded-3xl p-6.5 shadow-xs space-y-6",children:[s.jsxs("div",{className:"space-y-1.5 text-center",children:[s.jsx("div",{className:"w-9 h-9 bg-black text-white rounded-2xl flex items-center justify-center font-black text-sm mx-auto shadow-xs tracking-tighter",children:"★"}),s.jsx("h3",{className:"font-serif font-black text-lg tracking-tight text-neutral-900 uppercase",children:"Tune Your Dispatch Stream"}),s.jsx("p",{className:"text-[10px] text-neutral-500 font-semibold tracking-normal leading-relaxed max-w-xs mx-auto",children:"Select up to 3 core campus categories. We'll curate your news feed and learn your preferences live in this space."})]}),s.jsx("div",{className:"grid grid-cols-2 gap-2.5",children:[{id:"news",label:"📰 News",category:"News"},{id:"sports",label:"⚽ Sports",category:"Sports"},{id:"music",label:"🎵 Music",category:"Music"},{id:"entertainment",label:"🎭 Entertainment",category:"Entertainment"},{id:"innovation",label:"💡 Innovation",category:"Innovation"},{id:"culture",label:"🏛️ Culture",category:"Culture"},{id:"business",label:"💼 Business",category:"Business"}].map(mt=>{const Vt=ft.includes(mt.category);return s.jsxs("button",{onClick:()=>{if(Vt)mr($r=>$r.filter(fn=>fn!==mt.category));else{if(ft.length>=3){he.error("Please pick up to just 3 interests!",{id:"interest-limit"});return}mr($r=>[...$r,mt.category])}},className:`p-3 rounded-2xl border text-left font-sans text-xs font-semibold transition-all duration-200 cursor-pointer flex flex-col justify-between h-[4.5rem] select-none ${Vt?"border-black bg-black text-white shadow-xs scale-[1.02]":"border-gray-200 bg-white text-gray-700 hover:border-gray-300 hover:bg-gray-50/50"}`,children:[s.jsx("span",{className:"text-base leading-none",children:mt.label.split(" ")[0]}),s.jsx("span",{className:"font-sans uppercase text-[8.5px] font-black tracking-wider leading-none",children:mt.label.split(" ").slice(1).join(" ")})]},mt.id)})}),s.jsxs("div",{className:"pt-2 text-center",children:[s.jsxs("span",{className:"text-[8.5px] font-sans font-black text-gray-400 uppercase tracking-widest block mb-3.5",children:[ft.length," of 3 Selected"]}),s.jsx("button",{onClick:()=>{if(ft.length===0){he.error("Please select at least 1 interest to customize your feed!");return}try{const mt=localStorage.getItem("campus_eye_personalization_v1"),Vt=mt?JSON.parse(mt):{categories:{}};Vt.interests=[...ft],Vt.categories||(Vt.categories={}),ft.forEach($r=>{Vt.categories[$r]=(Vt.categories[$r]||0)+150}),localStorage.setItem("campus_eye_personalization_v1",JSON.stringify(Vt)),localStorage.removeItem("just_signed_up"),kr(!0),setTimeout(()=>{kr(!1),ar(!1),he.success("Newsroom personalized live! Welcome.")},1800)}catch(mt){console.warn(mt),ar(!1)}},disabled:ft.length===0,className:`w-full py-4.5 rounded-xl font-sans font-black uppercase text-[11px] tracking-[0.2em] transition-all duration-350 border select-none ${ft.length===0?"bg-gray-100 text-gray-400 border-gray-150 cursor-not-allowed":"bg-black hover:bg-neutral-900 text-white border-black cursor-pointer active:scale-[0.98]"}`,children:"Save & Continue"})]})]})]}):Ue.length>0?s.jsx("div",{className:"divide-y divide-gray-100",children:Ue.map((mt,Vt)=>{const $r=Vt===Math.max(2,Ue.length-3);return s.jsxs(ie.Fragment,{children:[s.jsx("div",{ref:$r?$:void 0,children:s.jsx(Rk,{article:mt,onClick:me,variant:"social",priority:Vt<2,onAuthorClick:mn})}),Vt===2&&vi&&s.jsx("div",{className:"p-4 bg-gray-50/50 border-b border-gray-100",children:s.jsx(Kw,{advert:vi})}),Vt===3&&ir&&s.jsx(_9e,{posts:Wa,onOpenPosts:()=>{Pe("posts"),window.scrollTo({top:0,behavior:"smooth"})},onAuthorClick:mn}),Vt===5&&ur&&s.jsx("div",{className:"p-4 bg-gray-50/50 border-b border-gray-100",children:s.jsx(Kw,{advert:ur})})]},`feed-${mt.id}-${Vt}`)})}):s.jsxs("div",{className:"space-y-5 px-4 py-2",children:[s.jsxs("div",{className:"space-y-4 pt-2",children:[s.jsx("div",{className:"flex items-center gap-2 text-[10px] font-black text-gray-400 uppercase tracking-widest px-1 pb-2 border-b border-gray-50",children:s.jsx("span",{children:"📰 Articles Feed & Dispatches"})}),s.jsx(Ap,{variant:"social"}),s.jsx(Ap,{variant:"social"}),s.jsx(Ap,{variant:"social"})]}),s.jsxs("div",{className:"p-8 text-center bg-gray-50 border border-gray-100/60 rounded-2xl select-none",children:[s.jsx(Wh,{size:24,className:"text-gray-300 mx-auto mb-2"}),s.jsx("p",{className:"text-[10px] font-black uppercase text-gray-400 tracking-wider",children:"Silent Dispatch Feed"}),s.jsx("p",{className:"text-[9px] text-gray-400 mt-1 max-w-xs mx-auto",children:"No general journalism postings currently active. Check the student lounge, announcements, debates or purchase passes above!"})]})]}),wt.length>0&&s.jsxs("div",{className:"p-4 space-y-4 bg-gray-50/30 border-t border-b border-gray-100",children:[s.jsx("span",{className:"text-[10px] font-black tracking-widest text-red-650 uppercase block text-left",children:"🔥 Spotlight Feature Postings"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:wt.map((mt,Vt)=>s.jsx(Rk,{article:mt,onClick:me,variant:"big",onAuthorClick:mn},`spotlight-${mt.id}-${Vt}`))})]}),xr.length>0&&s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsx("span",{className:"text-[10px] font-black tracking-widest text-gray-400 uppercase block text-left",children:"📰 Support Micro-Dispatches"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:xr.map((mt,Vt)=>s.jsx(Rk,{article:mt,onClick:me,variant:"magazine",onAuthorClick:mn},`small-${mt.id}-${Vt}`))})]}),L.length>0&&s.jsx("div",{className:"my-6",children:s.jsx(Mee,{currentPage:T,totalPages:Math.ceil(L.length/V),totalItems:L.length,itemsPerPage:V,onPageChange:mt=>{D(mt),mt*V>G-10&&X(Vt=>Math.max(Vt,mt*V+50)),window.scrollTo({top:0,behavior:"smooth"})},onItemsPerPageChange:mt=>{U(mt),D(1),mt>G&&X(mt+50)},itemLabel:"articles"})})]}),s.jsxs("aside",{className:"hidden lg:block lg:col-span-3 xl:col-span-3 2xl:col-span-3 space-y-5 pl-1 text-left sticky top-24 self-start max-h-[calc(100vh-8rem)] overflow-y-auto no-scrollbar scroll-smooth",children:[s.jsxs("div",{className:"bg-white border border-gray-150 rounded-2xl p-4 shadow-xs space-y-3 text-left",children:[s.jsx("div",{className:"flex items-center justify-end pb-2 border-b border-gray-100 select-none",children:s.jsxs("button",{onClick:()=>{if(o.length>0){const Vt=[...o.length>3?o.slice(3):o].sort(()=>Math.random()-.5);Q(Vt.slice(0,8)),he.success("Shuffled archives!",{id:"shuffle-articles"})}},className:"text-[8px] font-black uppercase tracking-wider text-gray-500 hover:text-red-650 flex items-center gap-1.5 transition-colors cursor-pointer px-2.5 py-1 bg-gray-50 hover:bg-red-50 rounded-lg border border-gray-100",title:"Shuffle older articles",children:[s.jsx(fF,{size:11}),s.jsx("span",{children:"Shuffle"})]})}),J.length===0?s.jsx("p",{className:"text-[8.5px] text-gray-400 py-3 text-center",children:"Loading vintage archives..."}):s.jsx("div",{className:"divide-y divide-gray-100 space-y-2.5",children:J.map((mt,Vt)=>s.jsxs("div",{onClick:()=>{me(mt),window.scrollTo({top:0,behavior:"auto"})},className:"pt-2.5 group cursor-pointer flex gap-3 items-start first:pt-0 hover:bg-gray-50/60 p-1.5 rounded-xl transition-all",children:[s.jsx("div",{className:"w-11 h-11 rounded-lg overflow-hidden relative shrink-0 bg-gray-100 border border-gray-150/80",children:s.jsx("img",{src:mt.featuredImageUrl||i(mt.title,mt.category),alt:"",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",referrerPolicy:"no-referrer"})}),s.jsxs("div",{className:"flex-1 min-w-0 text-left space-y-0.5",children:[s.jsx("span",{className:"text-[7.5px] font-mono font-black text-red-650 uppercase tracking-widest block",children:mt.category||"Archive"}),s.jsx("h5",{className:"font-extrabold text-[10px] text-gray-950 uppercase tracking-tight leading-snug group-hover:text-red-650 transition-colors line-clamp-2 font-sans",children:mt.title})]})]},`archive-${mt.id}-${Vt}`))})]}),s.jsxs("div",{className:"bg-white border border-gray-100 rounded-2xl p-4 shadow-xs space-y-3",children:[s.jsx("span",{className:"text-[10px] font-black tracking-[0.15em] text-gray-900 uppercase block",children:"⚡ QUICK PORTAL"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-left select-none",children:[s.jsxs("button",{onClick:()=>{Pe("posts"),window.scrollTo({top:0,behavior:"auto"})},className:"p-3 bg-gray-50 hover:bg-red-50 text-gray-900 hover:text-red-650 font-black uppercase text-[9px] tracking-wider rounded-xl transition-all border border-gray-100 text-center cursor-pointer flex flex-col items-center gap-1.5",children:[s.jsx(Ri,{size:14,className:"stroke-[2.5]"}),s.jsx("span",{children:"Lounge Feed"})]}),s.jsxs("button",{onClick:()=>{qe(!0)},className:"p-3 bg-gray-50 hover:bg-amber-50 text-gray-900 hover:text-amber-600 font-black uppercase text-[9px] tracking-wider rounded-xl transition-all border border-gray-100 text-center cursor-pointer flex flex-col items-center gap-1.5",children:[s.jsx(mc,{size:14,className:"stroke-[2.5]"}),s.jsx("span",{children:"Podcasts"})]}),s.jsxs("button",{onClick:()=>{St(!0)},className:"p-3 bg-gray-50 hover:bg-green-50 text-gray-900 hover:text-green-655 font-black uppercase text-[9px] tracking-wider rounded-xl transition-all border border-gray-100 text-center cursor-pointer flex flex-col items-center gap-1.5",children:[s.jsx(Ea,{size:14,className:"stroke-[2.5]"}),s.jsx("span",{children:"Buy Tickets"})]}),s.jsxs("button",{onClick:()=>{Pe("account"),window.scrollTo({top:0,behavior:"auto"})},className:"p-3 bg-gray-50 hover:bg-purple-50 text-gray-900 hover:text-purple-650 font-black uppercase text-[9px] tracking-wider rounded-xl transition-all border border-gray-100 text-center cursor-pointer flex flex-col items-center gap-1.5",children:[s.jsx(ko,{size:14,className:"stroke-[2.5]"}),s.jsx("span",{children:"Connections"})]})]})]})]})]}),ir&&L.length>0&&s.jsxs("div",{className:"mt-8 mb-6 p-4 sm:p-5 bg-white border border-gray-200/80 rounded-2xl text-left shadow-xs select-none",children:[s.jsxs("div",{className:"flex items-center justify-between pb-2.5 mb-3 border-b border-gray-100 gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ea,{size:15,className:"text-accent"}),s.jsx("span",{className:"text-[11px] font-black uppercase tracking-wider text-gray-900 font-sans",children:"Events & Tickets"})]}),s.jsxs("button",{type:"button",onClick:()=>{St(!0)},className:"text-[9.5px] font-black uppercase tracking-wider text-accent hover:text-red-700 bg-red-50 hover:bg-red-100/80 px-2.5 py-1 rounded-lg transition-all cursor-pointer flex items-center gap-1",children:[s.jsx("span",{children:"View all"}),s.jsx(Ip,{size:11})]})]}),s.jsx(iY,{onOpenPosts:()=>{Pe("posts"),window.scrollTo({top:0,behavior:"smooth"})},onAuthorClick:mn})]})]})}switch($e){case"auth":{const L=new URLSearchParams(window.location.search),H=L.get("pending_follow_uid"),ne=L.get("pending_follow_name")||"";return s.jsx("div",{className:"min-h-[85vh] py-16 px-4 bg-slate-50 flex flex-col items-center justify-center font-sans",children:s.jsxs("div",{className:"w-full max-w-lg bg-white p-8 md:p-12 border border-gray-150 rounded-3xl shadow-lg relative overflow-hidden",children:[s.jsx("div",{className:"absolute top-0 left-0 w-full h-1.5 bg-[#EE1B24]"}),H&&s.jsxs("div",{className:"mb-8 p-4 bg-red-50/50 border border-red-100 rounded-2xl text-left select-none",children:[s.jsx("p",{className:"text-[9px] font-black uppercase text-[#EE1B24] tracking-widest mb-1",children:"Peer Connection Request"}),s.jsxs("p",{className:"text-xs text-gray-700 leading-relaxed font-semibold",children:["Sign up or log in below to automatically build your peer connection with ",s.jsxs("span",{className:"font-extrabold text-[#EE1B24]",children:["@",ne.toLowerCase().replace(/\s+/g,"")]}),"."]})]}),s.jsx(DV,{onAuthSuccess:async()=>{const Ee=H||localStorage.getItem("pending_follow_uid"),Ue=ne||localStorage.getItem("pending_follow_name")||"this peer";if(Ee&&Ne.currentUser)try{const xr=Jt(nt(fe,"follows"),An("followerId","==",Ne.currentUser.uid),An("followedId","==",Ee));(await vr(xr)).empty&&(await dn(nt(fe,"follows"),{followerId:Ne.currentUser.uid,followedId:Ee,createdAt:zr()}),he.success(`Successfully followed ${Ue}!`))}catch(xr){console.warn("Auto-follow check failed:",xr)}finally{localStorage.removeItem("pending_follow_uid"),localStorage.removeItem("pending_follow_name")}he.success("Successfully authenticated. Welcome to Campus Eye!",{id:"auth-success-toast"});const wt=new URL(window.location.href);wt.searchParams.delete("tab"),wt.searchParams.delete("pending_follow_uid"),wt.searchParams.delete("pending_follow_name"),window.history.replaceState({},"",wt.toString()),Pe("home")},onClose:()=>{Pe("home")}}),s.jsxs("div",{className:"mt-8 flex flex-col items-center justify-center space-y-2 pt-6 border-t border-gray-100",children:[s.jsx("div",{className:"w-10 h-10 bg-red-650 rounded-full flex items-center justify-center shadow-md",children:s.jsx(Wh,{className:"text-white",size:20})}),s.jsx("span",{className:"text-[10px] font-serif font-black uppercase tracking-[0.2em] text-gray-950",children:"Campus Eye"}),s.jsx("span",{className:"text-[8px] font-mono uppercase tracking-widest text-gray-400",children:"Official Student Media Network"})]})]})})}case"podcasts":return s.jsx(MV,{});case"events":return s.jsxs("div",{className:"news-container py-12 px-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-12 border-b border-black pb-4",children:[s.jsx("h2",{className:"text-4xl font-serif font-black text-gray-950 tracking-tighter uppercase italic",children:"Events"}),s.jsx("button",{className:"px-6 py-2 bg-black text-white text-[10px] font-bold uppercase tracking-widest hover:bg-accent transition-all",children:"Submit Event"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[{title:"Freshers Gala",date:"25 APR",loc:"Main Hall",type:"Social"},{title:"Innovation Summit",date:"02 MAY",loc:"Tech Center",type:"Academy"},{title:"Varsity Finals",date:"15 MAY",loc:"Sports Complex",type:"Sports"}].map((L,H)=>s.jsxs("div",{className:"group overflow-hidden border border-gray-150 rounded-2xl bg-white hover:bg-gray-50 transition-all p-3.5 flex gap-4 items-center",children:[s.jsxs("div",{className:"w-20 h-20 sm:w-24 sm:h-24 rounded-xl overflow-hidden bg-gray-950 relative shrink-0",children:[s.jsx("img",{src:`https://picsum.photos/seed/event${H}/300/300`,className:"w-full h-full object-cover opacity-85 group-hover:opacity-100 transition-all duration-700",alt:"",referrerPolicy:"no-referrer"}),s.jsxs("div",{className:"absolute bottom-1 right-1 bg-white px-1.5 py-0.5 text-center shadow-md rounded",children:[s.jsx("p",{className:"text-[9px] font-black text-accent leading-none",children:L.date.split(" ")[0]}),s.jsx("p",{className:"text-[7px] font-black text-gray-400 uppercase leading-none",children:L.date.split(" ")[1]})]})]}),s.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[s.jsx("p",{className:"text-[8px] font-black text-accent uppercase tracking-widest mb-1",children:L.type}),s.jsx("h3",{className:"text-sm font-serif font-black text-gray-950 mb-2 truncate leading-tight",children:L.title}),s.jsxs("div",{className:"flex flex-col gap-1 text-gray-400 text-[8.5px] font-bold uppercase tracking-widest leading-none",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx($p,{size:10})," ",L.date]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Eu,{size:10})," ",L.loc]})]})]})]},H))})]});case"discussions":{const H=bi.filter(ne=>{if(!Er.trim())return!0;const Ee=Er.toLowerCase();return(ne.title||"").toLowerCase().includes(Ee)||(ne.description||"").toLowerCase().includes(Ee)});return s.jsxs("div",{className:"news-container py-12 px-4 max-w-4xl mx-auto space-y-8 animate-fade-in",children:[s.jsxs("div",{className:"text-center md:text-left space-y-2 border-b border-gray-100 pb-6 w-full",children:[s.jsxs("h2",{className:"text-3xl font-serif font-black text-gray-950 tracking-tighter uppercase italic flex items-center justify-center md:justify-start gap-2",children:[s.jsx(Ri,{className:"text-red-650 shrink-0",size:28}),s.jsx("span",{children:"Public Debates Lobby"})]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:"Active intellectual forums and critical arguments across our university"})]}),s.jsx("div",{className:"w-full rounded-[2rem] overflow-hidden border border-gray-150 shadow-md bg-white",children:s.jsx(zMe,{})}),s.jsxs("div",{className:"border-t border-gray-100 pt-8 mt-4 text-left",children:[s.jsx("h3",{className:"text-lg font-serif font-black text-gray-950 uppercase italic tracking-tight mb-2",children:"Ongoing Debate Threads"}),s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-widest mb-6",children:"Explore individual debate channels or join dynamic arguments below"})]}),s.jsxs("div",{className:"relative w-full",children:[s.jsx("input",{type:"text",value:Er,onChange:ne=>jr(ne.target.value),placeholder:"Search active debate threads by title or keywords...",className:"w-full px-5 py-3.5 pl-12 bg-white border border-gray-200 rounded-2xl text-xs font-bold shadow-sm focus:border-red-650 outline-none transition-all placeholder:text-gray-400 font-mono"}),s.jsx("span",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-440",children:s.jsx(Ri,{size:16})}),Er&&s.jsx("button",{onClick:()=>jr(""),className:"absolute right-4 top-1/2 -translate-y-1/2 text-xs font-black uppercase text-gray-400 hover:text-red-500 font-mono transition-colors",children:"Clear"})]}),H.length===0?s.jsxs("div",{className:"bg-white p-12 text-center rounded-3xl border border-gray-100 shadow-sm space-y-3 w-full",children:[s.jsx("p",{className:"text-xs font-bold text-gray-400 uppercase tracking-widest font-mono",children:"No active debate topics match your search"}),s.jsx("button",{onClick:()=>jr(""),className:"px-6 py-2.5 bg-gray-950 text-white text-[9px] font-black uppercase tracking-widest rounded-xl hover:bg-black transition-all cursor-pointer",children:"Reset Directory"})]}):s.jsx("div",{className:"space-y-6 w-full",children:H.map(ne=>{const Ee=_r===ne.id;return s.jsxs("div",{className:"group bg-white rounded-3xl border border-gray-150 shadow-md hover:shadow-xl transition-all p-6 md:p-8 flex flex-col gap-6 relative overflow-hidden text-left",children:[s.jsxs("div",{className:"relative w-full h-40 md:h-52 bg-gray-50 overflow-hidden rounded-2xl border border-gray-100",children:[s.jsx("img",{src:ne.bannerUrl||"https://images.unsplash.com/photo-1541872703-74c5e44368f9?auto=format&fit=crop&q=80&w=800",alt:"",className:"w-full h-full object-cover group-hover:scale-102 transition-transform duration-500",referrerPolicy:"no-referrer"}),s.jsx("div",{className:"absolute top-4 right-4 bg-gray-950/95 backdrop-blur-sm text-white text-[8px] font-black uppercase tracking-widest px-3 py-1.5 rounded-lg border border-white/10 shadow",children:ne.isExternal?"External":"Built-In"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"text-xl md:text-2xl font-serif font-black text-gray-950 leading-tight",children:ne.title}),ne.description&&s.jsx("p",{className:"text-xs font-medium text-gray-500 leading-relaxed",children:ne.description})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 pt-4 border-t border-gray-100",children:[s.jsxs("span",{className:"text-[9px] font-mono font-black text-gray-400 uppercase tracking-wider",children:["Created ",ne.createdAt?ne.createdAt.toDate?ne.createdAt.toDate().toLocaleDateString():ne.createdAt instanceof Date?ne.createdAt.toLocaleDateString():new Date(ne.createdAt).toLocaleDateString():"recently"]}),ne.isExternal?s.jsxs("a",{href:ne.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-2 px-6 py-3 bg-accent hover:bg-red-700 text-white text-[10px] font-black uppercase tracking-[0.1em] rounded-xl shadow-lg shadow-accent/15 group-hover:scale-102 transition-all cursor-pointer",children:[s.jsx("span",{children:"Continue to Discussion"}),s.jsx(za,{size:12})]}):s.jsxs("button",{onClick:()=>_n(Ee?null:ne.id),className:`inline-flex items-center justify-center gap-2 px-6 py-3 text-[10px] font-black uppercase tracking-[0.1em] rounded-xl transition-all cursor-pointer ${Ee?"bg-gray-100 text-gray-850 hover:bg-gray-200":"bg-accent hover:bg-red-700 text-white shadow-lg shadow-accent/15"}`,children:[s.jsx("span",{children:Ee?"Collapse arguments":"View & Join Debate"}),s.jsx(Ri,{size:12})]})]}),!ne.isExternal&&Ee&&s.jsx("div",{className:"border-t border-gray-100 mt-2",children:s.jsx(BMe,{debateId:ne.id})})]},ne.id)})})]})}case"posts":return s.jsx(GMe,{isAdmin:zt,onUserProfileClick:mn,sharedPostId:jt});case"marketplace":return s.jsxs("div",{className:"news-container py-8 px-4 font-sans text-left space-y-8",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 border-b border-gray-200 pb-4",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-3xl font-serif font-black text-gray-950 tracking-tighter uppercase italic flex items-center gap-3",children:[s.jsx(TC,{size:30}),"Marketplace & Verified Affiliates"]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-wider mt-1",children:"Shop student items, explore verified affiliate accounts, and earn commission rewards on sales dispatches."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("a",{href:"https://link.thelocalrent.com/v?t=1786099107&tk=07c43b29b01fcaf275f96eea938d430f",target:"_blank",rel:"noopener noreferrer",className:"px-4 py-2 bg-gradient-to-r from-amber-500 to-orange-500 text-white text-[10px] font-extrabold uppercase tracking-widest rounded-xl hover:opacity-95 transition-all shadow-md flex items-center gap-1.5",children:[s.jsx(Xi,{size:14})," Join Affiliate Program"]}),s.jsx("button",{onClick:()=>he.success("To post items on Marketplace, open the Campus Eye App or contact an Admin!"),className:"px-4 py-2 bg-gray-950 text-white text-[10px] font-extrabold uppercase tracking-widest rounded-xl hover:bg-black transition-all shadow-sm",children:"Post Item"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("h3",{className:"text-xs font-black uppercase tracking-wider text-gray-900 flex items-center gap-2",children:[s.jsx(So,{size:16})," Verified Affiliate Accounts in Market"]}),s.jsx("span",{className:"text-[9px] font-bold text-emerald-600 bg-emerald-50 px-2.5 py-1 rounded-full border border-emerald-200/60 uppercase tracking-wider",children:"✓ Verified Merchants & Affiliates"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[{name:"Campus Tech Hub",handle:"@campustech",category:"Laptops & Electronics",commission:"10% Affiliate Reward",verified:!0,productsCount:24,rating:"4.9 ★"},{name:"Hostel Essentials Ltd",handle:"@hostelitems",category:"Furniture & Appliances",commission:"8% Affiliate Reward",verified:!0,productsCount:18,rating:"4.8 ★"},{name:"Varsity Books & Stationery",handle:"@varsitybooks",category:"Academic Coursework",commission:"12% Affiliate Reward",verified:!0,productsCount:42,rating:"5.0 ★"}].map((L,H)=>s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-gray-150 shadow-xs hover:border-amber-400 hover:shadow-md transition-all space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-tr from-amber-500 to-indigo-600 text-white font-extrabold text-sm flex items-center justify-center uppercase shadow-sm",children:L.name.charAt(0)}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("h4",{className:"text-xs font-black text-gray-900",children:L.name}),s.jsx(So,{size:12})]}),s.jsx("p",{className:"text-[10px] text-gray-400 font-bold",children:L.handle})]})]}),s.jsx("span",{className:"text-[9px] font-black text-amber-700 bg-amber-50 border border-amber-200 px-2 py-0.5 rounded-md uppercase",children:L.rating})]}),s.jsxs("div",{className:"text-[11px] text-gray-600 font-medium",children:["Category: ",s.jsx("span",{className:"font-bold text-gray-900",children:L.category})," (",L.productsCount," items)"]}),s.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-100",children:[s.jsxs("span",{className:"text-[10px] font-black uppercase text-emerald-600 tracking-wide",children:["💰 ",L.commission]}),s.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(`https://link.thelocalrent.com/v?t=1786099107&tk=07c43b29b01fcaf275f96eea938d430f&ref=${L.handle.replace("@","")}`),he.success(`Copied Affiliate Link for ${L.name}! Earn rewards on referrals.`,{icon:"🔗"})},className:"text-[9px] font-black uppercase tracking-wider text-indigo-600 bg-indigo-50 hover:bg-indigo-100 px-3 py-1.5 rounded-lg transition-colors cursor-pointer",children:"Get Affiliate Link"})]})]},H))})]}),s.jsxs("div",{className:"space-y-4 pt-4",children:[s.jsx("h3",{className:"text-xs font-black uppercase tracking-wider text-gray-900",children:"Featured Campus Listings"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:[{name:"Scientific Calculator FX-991EX",price:"UGX 40,000",cat:"Academic",seller:"Campus Tech Hub",affiliate:"10% Reward"},{name:"Orthopedic Mattress & Bed Frame",price:"UGX 150,000",cat:"Hostel",seller:"Hostel Essentials Ltd",affiliate:"8% Reward"},{name:"Apple MacBook Pro M1 16GB",price:"UGX 3,500,000",cat:"Electronics",seller:"Campus Tech Hub",affiliate:"10% Reward"},{name:"Ergonomic Study Desk & Chair",price:"UGX 60,000",cat:"Hostel",seller:"Hostel Essentials Ltd",affiliate:"8% Reward"}].map((L,H)=>s.jsxs("div",{className:"group bg-white border border-gray-150 rounded-2xl shadow-xs overflow-hidden flex flex-col hover:shadow-md transition-all",children:[s.jsxs("div",{className:"aspect-square bg-gray-50 flex items-center justify-center relative overflow-hidden",children:[s.jsx(Nie,{size:40,className:"text-gray-300 group-hover:scale-110 transition-transform"}),s.jsxs("div",{className:"absolute top-3 right-3 bg-amber-500 text-white px-2.5 py-0.5 text-[8px] font-black uppercase tracking-widest rounded-full shadow-xs flex items-center gap-1",children:[s.jsx(So,{size:10,className:"text-white"})," Verified"]})]}),s.jsxs("div",{className:"p-4 flex-1 flex flex-col justify-between space-y-2",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("p",{className:"text-[9px] font-extrabold text-gray-400 uppercase tracking-widest",children:L.cat}),s.jsx("span",{className:"text-[8px] font-black text-emerald-600 bg-emerald-50 px-1.5 py-0.5 rounded",children:L.affiliate})]}),s.jsx("h3",{className:"text-xs font-black text-gray-950 mt-1 line-clamp-1",children:L.name}),s.jsxs("p",{className:"text-[10px] font-bold text-gray-500 mt-0.5",children:["Seller: ",L.seller]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-100 gap-1",children:[s.jsx("p",{className:"text-xs font-black text-indigo-600 truncate",children:L.price}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.jsxs("button",{type:"button",onClick:ne=>{ne.stopPropagation(),window.dispatchEvent(new CustomEvent("open-imessage-friend",{detail:{uid:L.sellerId||`seller_${H}`,displayName:L.seller,username:L.seller.toLowerCase().replace(/\s+/g,""),photoURL:""}}))},className:"p-1 px-2 bg-[#007AFF] hover:bg-blue-600 text-white rounded-lg transition-all cursor-pointer flex items-center gap-1 text-[8.5px] font-black uppercase tracking-wider shrink-0 shadow-2xs",title:`Direct messaging envelope icon: Chat with connected seller ${L.seller}`,children:[s.jsx(Xs,{size:10,strokeWidth:2.5}),s.jsx("span",{className:"hidden sm:inline",children:"Message"})]}),s.jsx("button",{onClick:()=>{window.open("https://link.thelocalrent.com/v?t=1786099107&tk=07c43b29b01fcaf275f96eea938d430f","_blank")},className:"text-[9px] font-black uppercase tracking-wider text-white bg-black hover:bg-neutral-800 px-2.5 py-1 rounded-lg transition-colors cursor-pointer",children:"Buy Item"})]})]})]})]},H))})]})]});case"teams":return s.jsxs("div",{className:"news-container py-12 px-4",children:[s.jsx("h2",{className:"text-4xl font-serif font-black text-gray-950 tracking-tighter uppercase italic mb-12 border-b border-black pb-4",children:"University Teams"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:["Basketball","Football","Rugby"].map((L,H)=>s.jsxs("div",{className:"bg-white p-10 border border-gray-100 shadow-xl text-center group hover:bg-black hover:text-white transition-all duration-500",children:[s.jsx("div",{className:"w-24 h-24 bg-gray-50 rounded-full mx-auto mb-8 flex items-center justify-center text-gray-300 group-hover:bg-accent group-hover:text-white transition-all scale-110 shadow-inner",children:s.jsx(ko,{size:40})}),s.jsxs("h3",{className:"text-2xl font-serif font-black uppercase italic tracking-tighter mb-2",children:[L," Team"]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-[0.3em] mb-8",children:"Varsity Div 1"}),s.jsx("button",{className:"w-full py-4 bg-black text-white text-[10px] font-black uppercase tracking-widest hover:bg-white hover:text-black border border-transparent hover:border-gray-200 transition-all",children:"Join Team"})]},H))})]});case"feedback":return s.jsx("div",{className:"news-container py-12 px-4 min-h-[70vh]",children:s.jsxs("div",{className:"flex flex-col lg:flex-row gap-16",children:[s.jsxs("div",{className:"lg:w-1/3 space-y-8",children:[s.jsxs("h2",{className:"text-5xl font-serif font-black text-gray-950 leading-[0.85] uppercase italic tracking-tighter",children:["Voice Your ",s.jsx("span",{className:"text-accent block",children:"Opinion."})]}),s.jsx("p",{className:"text-gray-500 font-bold leading-relaxed italic border-l-4 border-accent pl-6",children:`"Your feedback is the heart of our evolution. Tell us what we're missing."`}),s.jsx("div",{className:"pt-8 border-t border-gray-100 flex flex-col gap-6",children:s.jsxs("div",{className:"flex items-center gap-4 text-gray-400 group",children:[s.jsx("div",{className:"w-10 h-10 bg-gray-50 flex items-center justify-center text-accent group-hover:bg-accent group-hover:text-white transition-all",children:s.jsx(Xs,{size:16})}),s.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-gray-950",children:"feedback@campuseye.media"})]})})]}),s.jsxs("div",{className:"flex-1 bg-white p-8 md:p-12 shadow-2xl border border-gray-100 relative overflow-hidden",children:[s.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-accent/5 rounded-full -mr-16 -mt-16 blur-3xl"}),s.jsxs("form",{onSubmit:fo,className:"space-y-8 relative z-10",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:"Full Identity"}),s.jsx("input",{required:!0,type:"text",value:Rn.name,onChange:L=>Pa({...Rn,name:L.target.value}),className:"w-full px-6 py-4 bg-gray-50 border-2 border-transparent focus:border-accent transition-all outline-none text-sm font-bold placeholder:text-gray-300",placeholder:"e.g. Victor Atwiine"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:"Digital Address"}),s.jsx("input",{required:!0,type:"email",value:Rn.email,onChange:L=>Pa({...Rn,email:L.target.value}),className:"w-full px-6 py-4 bg-gray-50 border-2 border-transparent focus:border-accent transition-all outline-none text-sm font-bold placeholder:text-gray-300",placeholder:"Enter your email address"})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:"Detailed Critique"}),s.jsx("textarea",{required:!0,value:Rn.message,onChange:L=>Pa({...Rn,message:L.target.value}),className:"w-full px-6 py-4 bg-gray-50 border-2 border-transparent focus:border-accent transition-all outline-none text-sm font-bold placeholder:text-gray-300 min-h-[200px] resize-none",placeholder:"How can we sharpen our eye?"})]}),s.jsx("button",{type:"submit",disabled:ea,className:"w-full py-5 bg-black text-white text-[11px] font-black uppercase tracking-[0.3em] hover:bg-accent transition-all disabled:opacity-50",children:ea?"TRANSMITTING...":"DISPATCH FEEDBACK"})]})]})]})});case"account":return de?s.jsxs("div",{className:"news-container py-20 px-4 min-h-[50vh] flex flex-col items-center justify-center",children:[s.jsx(vn,{className:"animate-spin text-gray-500 mb-2",size:24}),s.jsx("p",{className:"text-[10px] font-sans font-black uppercase tracking-widest text-gray-400",children:"Retrieving Member Profile..."})]}):br?s.jsx("div",{className:"news-container py-10 px-4 min-h-[70vh] max-w-2xl mx-auto relative font-sans",children:s.jsxs("div",{className:"bg-white p-10 border border-gray-100 relative overflow-hidden text-left shadow-sm rounded-2xl",children:[s.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-[#EE1B24]"}),s.jsx("button",{onClick:()=>{const L=new URL(window.location.href);L.searchParams.delete("uid"),window.history.replaceState({},"",L.toString()),ln(null),Pe("home"),window.scrollTo({top:0,behavior:"auto"})},className:"absolute top-5 right-5 p-2 text-gray-400 hover:text-black hover:bg-gray-50 rounded-full transition-all border border-transparent hover:border-gray-150 cursor-pointer flex items-center justify-center",title:"Close Profile & Return Home",children:s.jsx(Jr,{size:16})}),s.jsxs("div",{className:"flex flex-col items-center text-center relative z-10 mb-12",children:[s.jsx("div",{className:"relative mb-6",children:s.jsx("div",{className:"w-32 h-32 border border-gray-200 overflow-hidden ring-4 ring-gray-50 rounded-full",children:s.jsx("img",{src:br.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(br.displayName||"User")}&background=random`,className:"w-full h-full object-cover rounded-full",alt:"",referrerPolicy:"no-referrer"})})}),s.jsxs("div",{className:"flex items-center gap-2 mt-2 select-none",children:[s.jsx("h2",{className:"text-3xl font-sans font-extrabold text-gray-950 tracking-tight uppercase",children:(()=>{const L=br.displayName||"Campus Peer";return L.includes("@")?L.split("@")[0]:L})()}),br.role==="admin"&&s.jsx("span",{className:"text-[7.5px] font-black uppercase tracking-widest text-[#9B2C2C] bg-[#FFF5F5] border border-red-100 px-2 py-0.5 rounded-full inline-block",children:"Staff"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-6 mt-6 py-4.5 px-6 border border-gray-100 rounded-2xl bg-gray-50/40 w-full max-w-sm select-none",children:[s.jsxs("div",{onClick:()=>{ht("following"),Et(br.id),an(!0)},className:"text-center font-sans cursor-pointer hover:opacity-80 transition-all",title:"View Following list",children:[s.jsx("p",{className:"text-xl font-black text-gray-950",children:Ze}),s.jsx("p",{className:"text-[8.5px] font-black uppercase text-gray-450 tracking-widest mt-0.5",children:"Following"})]}),s.jsx("div",{className:"h-8 w-[1px] bg-gray-150"}),s.jsxs("div",{onClick:()=>{ht("followers"),Et(br.id),an(!0)},className:"text-center font-sans cursor-pointer hover:opacity-80 transition-all",title:"View Followers list",children:[s.jsx("p",{className:"text-xl font-black text-gray-950",children:Fr}),s.jsx("p",{className:"text-[8.5px] font-black uppercase text-gray-450 tracking-widest mt-0.5",children:"Followers"})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-3 w-full max-w-md mt-8",children:[s.jsxs("button",{onClick:async()=>{if(!Ne.currentUser){localStorage.setItem("pending_follow_uid",br.id),localStorage.setItem("pending_follow_name",br.displayName||"Campus Member");const L=`${window.location.origin}/?tab=auth&pending_follow_uid=${br.id}&pending_follow_name=${encodeURIComponent(br.displayName||"Campus Member")}`;window.open(L,"_blank"),he.success("Opening connection setup dashboard in a new tab!",{id:"login-to-follow"});return}try{const L=Jt(nt(fe,"follows"),An("followerId","==",Ne.currentUser.uid),An("followedId","==",br.id)),H=await vr(L);H.empty?(await dn(nt(fe,"follows"),{followerId:Ne.currentUser.uid,followedId:br.id,createdAt:zr()}),he.success(`Following ${br.displayName||"User"}`)):(await ai(st(fe,"follows",H.docs[0].id)),he.success(`Unfollowed ${br.displayName||"User"} successfully`))}catch(L){console.warn("Follow toggle failed:",L)}},className:"w-full py-4.5 bg-neutral-950 hover:bg-neutral-900 border border-neutral-800 text-white font-black uppercase tracking-widest text-xs transition-all active:scale-[0.98] cursor-pointer flex items-center justify-center gap-2 rounded-xl",children:[Cr?"UNFOLLOW ":"★ FOLLOW "," MEMBERS"]}),s.jsxs("button",{onClick:()=>{const L=`${window.location.origin}/?tab=account&uid=${br.id}`;navigator.clipboard.writeText(L).then(()=>he.success("Copied profile sharing link to clipboard!",{id:"profile-copied"})).catch(()=>he.error("Failed to copy link. Please copy URL from browser address bar.",{id:"profile-copy-fail"}))},className:"w-full py-4.5 bg-white hover:bg-gray-50 border border-gray-200 text-gray-800 font-black uppercase tracking-widest text-xs transition-all active:scale-[0.98] cursor-pointer flex items-center justify-center gap-2 rounded-xl",children:[s.jsx(Ld,{size:13})," SHARE PROFILE"]}),s.jsxs("button",{onClick:()=>He(br.id),className:"w-full py-4 bg-gray-950 hover:bg-black border border-gray-800 text-amber-300 font-black uppercase tracking-widest text-xs transition-all active:scale-[0.98] cursor-pointer flex items-center justify-center gap-2 rounded-xl",children:[s.jsx(yp,{size:14,className:"text-amber-400"})," VIEW CITIZEN STATS & GRAPH"]})]}),!Ne.currentUser&&s.jsxs("div",{className:"w-full max-w-sm mt-8 p-6 bg-slate-50 border border-gray-150/80 rounded-2xl text-center space-y-4 shadow-xs select-none",children:[s.jsx("p",{className:"text-[11px] font-sans font-bold uppercase tracking-wider text-gray-500",children:"✨ Peer linkage Invitation"}),s.jsxs("p",{className:"text-xs text-gray-600 leading-relaxed font-medium",children:["Connect with ",s.jsx("span",{className:"font-extrabold text-black",children:(()=>{const L=br.displayName||"Campus Peer";return L.includes("@")?L.split("@")[0]:L})()})," to monitor peer announcements and student lounge dispatches!"]}),s.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[s.jsx("button",{onClick:()=>{localStorage.setItem("pending_follow_uid",br.id),localStorage.setItem("pending_follow_name",br.displayName||"this peer"),xe(!0)},className:"w-full py-3 bg-[#EE1B24] hover:bg-red-700 text-white font-black uppercase tracking-widest text-[9.5px] rounded-xl transition-all active:scale-95 flex items-center justify-center gap-2 cursor-pointer shadow-sm",children:"Continue with Google / Sign Up"}),s.jsxs("button",{onClick:()=>{window.open(window.location.href,"_blank")},className:"w-full py-2.5 bg-white hover:bg-gray-50 border border-gray-200 text-gray-700 font-black uppercase tracking-widest text-[8.5px] rounded-xl transition-all flex items-center justify-center gap-1.5 cursor-pointer",children:[s.jsx(za,{size:11,className:"mr-1"})," Open in New Tab"]})]}),s.jsxs("div",{className:"pt-4 border-t border-gray-150/60 flex flex-col items-center",children:[s.jsx(Ree,{className:"scale-[0.8] opacity-75"}),s.jsx("p",{className:"text-[7px] font-mono font-bold tracking-[0.25em] text-gray-400 uppercase mt-2",children:"Autonomous Student Journalism System"})]})]}),s.jsxs("div",{className:"mt-8 text-center pt-6 border-t border-gray-100 w-full max-w-sm",children:[s.jsx("span",{className:"text-[8.5px] font-sans font-black text-gray-400 uppercase tracking-widest block mb-3.5",children:"🤝 Peer-to-Peer Lounge Linkages"}),s.jsx("button",{onClick:()=>{if(!Ne.currentUser){he.error("Please login to access Peer Lounge connect systems."),xe(!0);return}ht("connections"),an(!0),he.success("Opened Peer connections board!")},className:"px-5 py-2 hover:bg-[#EEF2F6] text-[#2B6CB0] font-black uppercase text-[9px] tracking-widest rounded-full border border-blue-150 bg-[#F7FAFC] transition-colors",children:"Browse Mutual Collaborators"})]})]})]})}):zt&&Ta?s.jsx("div",{className:"news-container py-10 px-4 min-h-[90vh] max-w-5xl mx-auto",children:s.jsxs("div",{className:"bg-white p-6 md:p-10 border border-gray-150 rounded-2xl relative shadow-md overflow-hidden text-left",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 pb-4 border-b border-gray-150 mb-8 select-none",children:[s.jsx("button",{onClick:()=>Ss(!1),className:"p-1.5 border border-gray-200 hover:border-black text-gray-650 hover:text-black rounded-lg cursor-pointer transition-colors",title:"Back to User Profile Info",children:s.jsx(Ire,{size:14,className:"shrink-0"})}),s.jsx("div",{className:"flex items-center gap-2",title:"Editorial Director Console",children:s.jsx("div",{className:"p-1.5 bg-[#FFF5F5] text-[#9B2C2C] rounded-lg border border-red-100",children:s.jsx(vI,{size:14,className:"shrink-0"})})})]}),s.jsx(OS,{initialTab:Or})]})}):s.jsx("div",{className:"news-container py-10 px-4 min-h-[70vh] max-w-2xl mx-auto relative",children:s.jsxs("div",{className:"bg-white p-10 border border-gray-100 relative overflow-hidden text-left shadow-sm rounded-2xl",children:[s.jsx("button",{onClick:()=>{Pe(Gr),window.scrollTo({top:0,behavior:"auto"})},className:"absolute top-5 right-5 p-2 text-gray-400 hover:text-black hover:bg-gray-50 rounded-full transition-all border border-transparent hover:border-gray-150 cursor-pointer flex items-center justify-center p-2.5 z-50",title:"Exit Profile & Return",children:s.jsx(Jr,{size:16})}),s.jsxs("div",{className:"flex flex-col items-center text-center relative z-10 mb-12",children:[s.jsxs("div",{className:"relative mb-6 group",children:[s.jsx("div",{className:"w-32 h-32 border border-gray-200 overflow-hidden ring-4 ring-gray-50",children:s.jsx("img",{src:((lt=Ne.currentUser)==null?void 0:lt.photoURL)||`https://ui-avatars.com/api/?name=${encodeURIComponent(((yt=Ne.currentUser)==null?void 0:yt.displayName)||"User")}&background=random`,className:"w-full h-full object-cover",alt:""})}),s.jsxs("label",{className:"absolute bottom-1 right-1 p-2 bg-black text-white cursor-pointer hover:bg-accent transition-all rounded-full border border-white shadow-md",title:"Change Avatar Photo",children:[s.jsx(Ed,{size:14}),s.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:ho})]})]}),Po?s.jsxs("div",{className:"flex items-center gap-2 mt-2 w-full max-w-xs",children:[s.jsx("input",{type:"text",value:Ka,onChange:L=>us(L.target.value),className:"border-2 border-accent px-3 py-1.5 rounded-lg text-sm text-center font-bold outline-none flex-1 tracking-tight min-w-0",placeholder:"Enter new username",required:!0}),s.jsx("button",{onClick:Ql,disabled:ea,className:"p-2 bg-accent hover:bg-black text-white rounded-lg transition-colors cursor-pointer flex items-center justify-center w-8 h-8",title:"Save Name",children:s.jsx(zu,{size:14,className:"stroke-[3]"})}),s.jsx("button",{onClick:()=>bs(!1),className:"p-2 bg-gray-100 hover:bg-gray-200 text-gray-600 rounded-lg transition-colors cursor-pointer flex items-center justify-center w-8 h-8",title:"Cancel Edit",children:s.jsx(Jr,{size:14})})]}):s.jsxs("div",{className:"flex items-center gap-2.5 mt-2 group select-none",children:[s.jsx("h2",{className:"text-3xl font-sans font-extrabold text-gray-950 tracking-tight uppercase",children:((er=Ne.currentUser)==null?void 0:er.displayName)||"Campus Member"}),s.jsxs("div",{className:"flex items-center gap-1 opacity-100 transition-opacity",children:[s.jsx("button",{onClick:()=>{var L;us(((L=Ne.currentUser)==null?void 0:L.displayName)||""),bs(!0)},className:"p-1.5 text-gray-400 hover:text-accent border border-gray-150 hover:border-accent rounded-full bg-white hover:scale-105 transition-all text-[10px] cursor-pointer flex items-center justify-center shadow-xs",title:"Edit Display Name",children:s.jsx(Ed,{size:11})}),s.jsx("button",{onClick:()=>{var H;const L=`${window.location.origin}/u/profile/${(H=Ne.currentUser)==null?void 0:H.uid}`;navigator.clipboard.writeText(L).then(()=>he.success("Copied profile sharing link to clipboard!",{id:"profile-copied"})).catch(()=>he.error("Failed to copy link. Please copy URL from browser address bar.",{id:"profile-copy-fail"}))},className:"p-1.5 text-gray-400 hover:text-accent border border-gray-150 hover:border-accent rounded-full bg-white hover:scale-105 transition-all text-[10px] cursor-pointer flex items-center justify-center shadow-xs",title:"Share profile next to editing icon",children:s.jsx(Ld,{size:11})})]})]}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsx(Xs,{size:14,className:"text-gray-400"}),s.jsx("p",{className:"text-gray-400 font-bold uppercase tracking-widest text-[10px]",children:(lr=Ne.currentUser)==null?void 0:lr.email})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-8 text-center select-none relative z-10",children:[s.jsxs("div",{onClick:()=>{ht("followers"),an(!0)},className:"p-4 bg-gray-50 border border-gray-100/80 rounded-xl hover:border-red-650/30 hover:bg-red-50/10 cursor-pointer hover:scale-[1.02] active:scale-98 transition-all",title:"Click to view Followers",id:"profile-followers-box",children:[s.jsx("span",{className:"block text-2xl font-sans font-extrabold text-gray-950",children:xn}),s.jsx("span",{className:"text-[9px] font-black uppercase text-gray-400 tracking-widest font-mono",children:"Followers"})]}),s.jsxs("div",{onClick:()=>{ht("following"),an(!0)},className:"p-4 bg-gray-50 border border-gray-100/80 rounded-xl hover:border-red-650/30 hover:bg-red-50/10 cursor-pointer hover:scale-[1.02] active:scale-98 transition-all",title:"Click to view Following",id:"profile-following-box",children:[s.jsx("span",{className:"block text-2xl font-sans font-extrabold text-gray-950",children:fi}),s.jsx("span",{className:"text-[9px] font-black uppercase text-gray-400 tracking-widest font-mono",children:"Following"})]}),s.jsxs("div",{onClick:()=>{ht("connections"),an(!0)},className:"p-4 bg-gray-50 border border-gray-100/80 rounded-xl hover:border-red-650/30 hover:bg-red-50/10 cursor-pointer hover:scale-[1.02] active:scale-98 transition-all",title:"Click to view Peer Lounge Connections",id:"profile-connections-box",children:[s.jsx("span",{className:"block text-2xl font-sans font-extrabold text-[#9B2C2C]",children:cs}),s.jsx("span",{className:"text-[9px] font-black uppercase text-gray-400 tracking-widest font-mono",children:"Peer Lounge"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 relative z-10",children:[s.jsxs("div",{className:"p-6 bg-gray-50 border border-gray-100",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 bg-white border border-gray-200 text-black",children:s.jsx(Eu,{size:16})}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:"Active Role"})]}),s.jsx("p",{className:"font-sans font-extrabold text-gray-950 uppercase tracking-tight text-xl",children:zt?"Editorial Board":"Student Reporter"})]}),s.jsxs("div",{className:"p-6 bg-gray-50 border border-gray-100",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 bg-white border border-gray-200 text-accent",children:s.jsx(ul,{size:16})}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:"Trust Rating"})]}),s.jsx("p",{className:"font-sans font-extrabold text-accent uppercase tracking-tight text-xl",children:"Verified Member"})]})]}),s.jsx("div",{className:"mt-10 pt-10 border-t border-gray-100 relative z-10 font-sans",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 text-left",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("h3",{className:"text-sm font-sans font-extrabold uppercase tracking-wider text-gray-950 flex items-center gap-2",children:[s.jsx(Ea,{size:16,className:"text-accent"})," My Event Tickets"]}),s.jsx("button",{onClick:()=>St(!0),className:"text-[10px] font-black uppercase tracking-widest text-accent hover:underline cursor-pointer",children:"Browse Events"})]}),s.jsx(I9e,{userId:((Kt=Ne.currentUser)==null?void 0:Kt.uid)||""})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("h3",{className:"text-sm font-sans font-extrabold uppercase tracking-wider text-gray-950 flex items-center gap-2",children:[s.jsx(Xs,{size:16,className:"text-red-650"})," System Inbox & Keys"]}),s.jsx("span",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-widest",children:"Confidential OTP Center"})]}),s.jsx(T9e,{userId:((k=Ne.currentUser)==null?void 0:k.uid)||""})]})]})}),s.jsxs("div",{className:"mt-10 pt-10 border-t border-gray-100 text-left relative z-10",children:[s.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[s.jsxs("h3",{className:"text-sm font-sans font-extrabold uppercase tracking-wider text-gray-950 flex items-center gap-2",children:[s.jsx(ko,{size:16,className:"text-red-650"})," Member Portal Desk"]}),s.jsx("span",{className:"text-[9px] font-black text-gray-400 tracking-wider uppercase",children:"Active Dispatch Terminals"})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3.5",children:[{id:"home",label:"Home",icon:tR,desc:"Central Dispatches"},{id:"news",label:"Campus News",icon:Wh,desc:"Hot editorial stream"},{id:"discussions",label:"Public Debates",icon:Ri,desc:"Forum spaces & polls"},{id:"tickets",label:"Ticket Store",icon:Ea,desc:"Browse latest event passes"},{id:"podcasts",label:"Audio Podcasts",icon:mc,desc:"Listen to radio dispatches"},{id:"feedback",label:"Feedback Desk",icon:Xs,desc:"Critiques, tips, & suggestions"}].map(L=>s.jsxs("button",{onClick:()=>{Pe(L.id),me(null),window.scrollTo({top:0,behavior:"smooth"})},className:"group flex flex-col p-4 bg-gray-50/50 hover:bg-red-50/30 border border-gray-100 hover:border-red-600/20 transition-all rounded-xl text-left gap-1 cursor-pointer",children:[s.jsxs("div",{className:"flex items-center gap-2 text-gray-900 group-hover:text-red-650 font-black text-xs uppercase tracking-wider transition-colors",children:[s.jsx(L.icon,{size:13}),s.jsx("span",{children:L.label})]}),s.jsx("span",{className:"text-[9.5px] text-gray-400 group-hover:text-gray-500 font-bold uppercase tracking-wider leading-none transition-colors",children:L.desc})]},L.id))})]}),s.jsxs("div",{className:"mt-10 pt-10 border-t border-gray-100 flex flex-col gap-4 relative z-10",children:[s.jsx("button",{onClick:async()=>{try{Pe("home"),await Ne.signOut(),he.success("Successfully logged out!",{icon:"👋"})}catch(L){he.error("Logout error: "+L.message)}},className:"w-full py-4 bg-gray-950 text-white font-black uppercase tracking-[0.2em] text-xs hover:bg-black transition-all cursor-pointer",children:"Logout"}),zt&&s.jsxs("button",{onClick:()=>ui(),className:"w-full py-4 bg-accent text-white font-black uppercase tracking-[0.2em] text-xs hover:bg-black transition-all shadow-xl shadow-blue-100 flex items-center justify-center gap-2 cursor-pointer",children:[s.jsx(ul,{size:16})," Admins Dashboard"]})]})]})});case"admin":return zt?s.jsx(OS,{initialTab:Or}):null;default:return null}};return re?s.jsxs("div",{className:"fixed inset-0 z-[99999] bg-white flex flex-col min-h-screen",children:[s.jsx(i8,{}),s.jsxs("div",{className:"h-14 border-b border-gray-100 px-4 flex items-center justify-between bg-white backdrop-blur-md",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("img",{src:"https://i.ibb.co/qLbqdWNm/f244d6ea7cd7.jpg",alt:"Logo",className:"h-7 w-7 rounded-full object-cover",referrerPolicy:"no-referrer"}),s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-[#000000]",children:"Campus Eye Media"})]}),s.jsx("div",{className:"h-2 w-2 rounded-full bg-red-650"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50/30 p-4 md:p-6 max-w-3xl mx-auto w-full space-y-6 pt-10",children:[s.jsxs("div",{className:"space-y-3 ",children:[s.jsx("div",{className:"h-3 bg-red-100 rounded w-20"}),s.jsx("div",{className:"h-8 bg-gray-200 rounded-lg w-[90%]"}),s.jsx("div",{className:"h-8 bg-gray-200 rounded-lg w-[60%]"})]}),s.jsxs("div",{className:"flex items-center gap-3 pt-2 pb-6 border-b border-gray-150",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-200"}),s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx("div",{className:"h-3 bg-gray-200 rounded w-28"}),s.jsx("div",{className:"h-2.5 bg-gray-150 rounded w-16"})]})]}),s.jsxs("div",{className:"space-y-4 pt-4",children:[s.jsx("div",{className:"h-56 bg-gray-150 rounded-2xl w-full"}),s.jsxs("div",{className:"space-y-2.5 pt-4",children:[s.jsx("div",{className:"h-3.5 bg-gray-100 rounded w-full"}),s.jsx("div",{className:"h-3.5 bg-gray-100 rounded w-[96%]"}),s.jsx("div",{className:"h-3.5 bg-gray-100 rounded w-[98%]"}),s.jsx("div",{className:"h-3.5 bg-gray-100 rounded w-[92%]"})]})]})]})]}):s.jsxs("div",{className:"min-h-screen bg-white pb-32 overflow-x-clip",children:[s.jsx(i8,{}),s.jsx(YMe,{isOpen:jn,onClose:()=>{an(!1),Et(null)},currentUserId:((bl=Ne.currentUser)==null?void 0:bl.uid)||"",viewingUserId:at||((ma=Ne.currentUser)==null?void 0:ma.uid)||"",initialTab:De,onUserProfileClick:ge=>{mn(ge)}}),s.jsx(Uee,{isOpen:!!rr,onClose:()=>Nr(null),friend:rr,currentUserId:((Xa=Ne.currentUser)==null?void 0:Xa.uid)||"",currentUserProfile:{uid:((it=Ne.currentUser)==null?void 0:it.uid)||"",displayName:((Zr=Ne.currentUser)==null?void 0:Zr.displayName)||"Campus Peer",username:(((Pi=Ne.currentUser)==null?void 0:Pi.displayName)||"peer").toLowerCase().replace(/\s+/g,""),photoURL:((Qa=Ne.currentUser)==null?void 0:Qa.photoURL)||""}}),s.jsx(wye,{onSearch:Cs,isAdmin:zt,onAdminClick:ui,activeTab:$e,setActiveTab:Pe,latestArticles:o,openAuth:()=>xe(!0),customPagesList:ve,setSelectedCustomPage:Z,selectedCustomPage:Ve,onScanClick:()=>dr(!0),onOpenChat:ge=>Nr(ge)}),s.jsx(Nye,{activeTab:$e,setActiveTab:Pe,onProfileClick:()=>Ne.currentUser?Pe("account"):xe(!0),isAdmin:zt,onAdminClick:ui,openAuth:()=>xe(!0),onMenuClick:()=>Dt(!0),onPodcastClick:()=>qe(!0),isPodcastModalOpen:ae}),s.jsx(RMe,{}),s.jsx("main",{className:"news-container pt-16 sm:pt-20 md:pt-22 pb-20",children:s.jsx("div",{children:Ko()||s.jsx("div",{className:"text-center py-10",children:s.jsx(Ap,{variant:"magazine"})})})}),s.jsx(on,{children:It&&s.jsxs("div",{className:"fixed inset-0 z-[2500] flex",children:[s.jsx(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Dt(!1),className:"fixed inset-0 bg-black/40 backdrop-blur-sm"}),s.jsxs(Qt.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",damping:25,stiffness:220},className:"relative w-80 max-w-[85vw] bg-white h-full shadow-2xl overflow-y-auto flex flex-col pt-5 px-6 border-r border-gray-150 z-50 text-left",children:[s.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-gray-100 mb-6",children:[s.jsxs("div",{className:"flex items-center gap-1.5 font-black text-gray-950 text-[11px] tracking-wider",children:[s.jsx("div",{className:"w-3.5 h-3.5 rounded-full bg-red-600 shrink-0"}),s.jsx("span",{children:"CITIZEN DASHBOARD"})]}),s.jsx("button",{onClick:()=>Dt(!1),className:"p-1.5 rounded-full hover:bg-gray-100 text-gray-400 hover:text-gray-950 transition-all cursor-pointer",children:s.jsx(Jr,{size:16})})]}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[[{id:"home",label:"Home",icon:tR},{id:"news",label:"Campus News",icon:Wh},{id:"discussions",label:"Public Debates",icon:Ri},{id:"tickets",label:"Ticket Store",icon:Ea},{id:"podcasts",label:"Audio Podcasts",icon:mc},{id:"feedback",label:"Feedback Desk",icon:Xs},{id:"account",label:"My Account",icon:rE}].map(ge=>s.jsxs("button",{onClick:()=>{ge.id==="tickets"?St(!0):ge.id==="podcasts"?qe(!0):(Pe(ge.id),Z(null)),Dt(!1),me(null)},className:Ge("flex items-center gap-3 w-full px-4 py-2.5 rounded-xl transition-all font-bold text-xs uppercase tracking-wider text-left",$e===ge.id&&!Ve?"bg-red-650 text-white shadow-md font-black":"text-gray-550 hover:bg-gray-50 hover:text-black"),children:[s.jsx(ge.icon,{size:14}),s.jsx("span",{children:ge.label})]},ge.id)),ve&&ve.length>0&&ve.map(ge=>{var Me;const we=(Me=ge.createdAt)!=null&&Me.seconds?Date.now()-ge.createdAt.seconds*1e3<6048e5:!1;return s.jsxs("button",{onClick:()=>{Z(ge),Dt(!1)},className:Ge("flex items-center gap-3 w-full px-4 py-2.5 rounded-xl transition-all font-bold text-xs uppercase tracking-wider text-left cursor-pointer",(Ve==null?void 0:Ve.id)===ge.id?"bg-red-650 text-white shadow-md font-black [&_svg]:!stroke-white [&_path]:!stroke-white [&_svg]:!fill-white [&_path]:!fill-white":"text-gray-550 hover:bg-gray-50 hover:text-black"),children:[ge.svgIcon?s.jsx("span",{className:"shrink-0 w-3.5 h-3.5 flex items-center justify-center text-current [&>svg]:w-full [&>svg]:h-full [&>svg]:shrink-0 transition-colors",dangerouslySetInnerHTML:{__html:ge.svgIcon.includes("${ge.svgIcon}`}}):s.jsx(za,{size:14,className:"text-red-550 shrink-0"}),s.jsx("span",{className:"truncate",children:ge.name}),we&&s.jsx("span",{className:"bg-red-500 text-white text-[7px] font-black uppercase px-1.5 py-0.5 rounded-full select-none shrink-0 ml-auto",children:"New"})]},ge.id)}),zt&&s.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100/80 space-y-1 select-none text-left",children:[s.jsxs("div",{className:"px-4 py-1.5 flex items-center gap-1.5",children:[s.jsx(ul,{size:12,className:"text-red-650"}),s.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Editorial Board Control"})]}),[{subTab:"dashboard",label:"Dashboard Stats",desc:"Track traffic & revenue metrics",icon:Eu},{subTab:"article",label:"Write New Dispatch",desc:"Draft and deploy live articles",icon:Ed},{subTab:"manage-articles",label:"Manage Store & Articles",desc:"Revise or withdraw stories",icon:Wh},{subTab:"advert",label:"Sponsor Advert Upload",desc:"Configure video or flyer ads",icon:Wp},{subTab:"manage-ads",label:"Manage Sponser Ads",desc:"Monitor active and draft campaigns",icon:Ru},{subTab:"flagged-comments",label:"Censor comments",desc:"Approve or delete flagged text",icon:Su},{subTab:"manage-tickets",label:"Configure Tickets",desc:"Publish event store entries",icon:Ea},{subTab:"ticket-purchases",label:"Passes & Ticket Sales",desc:"Verify passes & view sales records",icon:oie}].map(ge=>s.jsxs("button",{onClick:()=>{ui(ge.subTab),Dt(!1)},className:"w-full flex items-start gap-3 px-4 py-2 hover:bg-red-50/30 rounded-lg transition-all text-left group border border-transparent hover:border-red-100/10 cursor-pointer",children:[s.jsx(ge.icon,{size:13,className:"text-gray-400 group-hover:text-red-650 transition-colors mt-0.5 shrink-0"}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-[11px] font-bold text-gray-700 uppercase tracking-wider group-hover:text-red-650 transition-colors",children:ge.label}),s.jsx("span",{className:"text-[8.5px] text-gray-400 font-bold uppercase tracking-tight leading-none mt-0.5",children:ge.desc})]})]},ge.subTab))]})]}),s.jsx("div",{className:"pt-6 border-t border-gray-100 pb-8 mt-6",children:s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest text-center",children:"CAMPUS EYE V2.5 • MOBILE PLUG"})})]})]})}),$e==="admin"&&zt&&s.jsxs("div",{className:"fixed inset-0 z-[100] bg-white overflow-y-auto",children:[s.jsxs("div",{className:"w-full mx-auto px-6 py-4 flex justify-between items-center border-b border-gray-100 mb-4 select-none",children:[s.jsx("div",{className:"flex items-center gap-1.5 font-black text-[#9B2C2C] text-[10px] tracking-wider uppercase",title:"Editorial Desk Hub",children:s.jsx(ul,{size:16})}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>{Ss(!0),Pe("account")},className:"p-2 border border-gray-200 hover:border-black text-gray-650 hover:text-black rounded-lg cursor-pointer transition-colors",title:"Go to Account Controls",children:s.jsx(VS,{size:15,className:"shrink-0"})}),s.jsx("button",{onClick:()=>{Pe(Gr),window.scrollTo({top:0,behavior:"smooth"})},className:"p-2 bg-black hover:bg-neutral-900 text-white rounded-lg cursor-pointer transition-colors",title:"Exit and Return to Feed",children:s.jsx(one,{size:15,className:"shrink-0"})})]})]}),s.jsx(OS,{initialTab:Or})]}),s.jsx(on,{children:se&&s.jsx("div",{onClick:()=>{xe(!1),window.onAuthPendingAction=void 0},className:"fixed inset-0 z-[3000] flex items-center justify-center p-4 bg-black/80 backdrop-blur-md overflow-y-auto cursor-pointer",children:s.jsx(Qt.div,{onClick:ge=>ge.stopPropagation(),initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},className:"w-full max-w-lg relative cursor-default my-auto",children:s.jsx(DV,{onAuthSuccess:async()=>{xe(!1);const ge=localStorage.getItem("pending_follow_uid"),we=localStorage.getItem("pending_follow_name")||"this peer";if(ge&&Ne.currentUser)try{const Ke=Jt(nt(fe,"follows"),An("followerId","==",Ne.currentUser.uid),An("followedId","==",ge));(await vr(Ke)).empty&&(await dn(nt(fe,"follows"),{followerId:Ne.currentUser.uid,followedId:ge,createdAt:zr()}),he.success(`Successfully followed ${we}!`),ln(null))}catch(Ke){console.warn("Auto-follow pending action failed:",Ke)}finally{localStorage.removeItem("pending_follow_uid"),localStorage.removeItem("pending_follow_name")}localStorage.getItem("just_signed_up")==="true"&&ar(!0),Pe("home")},onClose:()=>{xe(!1),window.onAuthPendingAction=void 0},isAdmin:zt,onAdminClick:ui})})})}),s.jsxs("div",{className:"mt-20 border-t border-gray-100",children:[s.jsx(DMe,{articles:o}),s.jsx(MMe,{setActiveTab:Pe,adverts:Be,articles:o,isAdmin:zt})]}),s.jsx("button",{onClick:()=>{window.scrollTo({top:0,behavior:"smooth"})},className:"fixed bottom-3 left-4 z-40 w-8 h-8 bg-white/95 hover:bg-gray-50 rounded-full border border-gray-200 shadow-xs transition-all transform hover:scale-110 active:scale-95 flex items-center justify-center cursor-pointer outline-none select-none font-black",title:"Back to Top",children:s.jsx(Ppe,{size:11})}),s.jsx(on,{children:Ve&&s.jsx(JMe,{page:Ve,onClose:()=>Z(null),openAuth:()=>xe(!0)})}),s.jsx(on,{children:Rt&&s.jsx("div",{className:"fixed inset-0 z-[11000] flex items-center justify-center p-0 bg-black/95 backdrop-blur-2xl",children:s.jsxs(Qt.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.25},className:"w-screen h-screen flex flex-col overflow-hidden relative",children:[s.jsxs("div",{className:"absolute top-0 left-0 right-0 z-50 bg-black/85 backdrop-blur-md px-6 py-3.5 flex items-center justify-between border-b border-white/10 text-white select-none",children:[s.jsx("div",{className:"flex items-center gap-3.5 text-left min-w-0 flex-1 pr-6",children:s.jsxs("div",{className:"min-w-0",children:[s.jsxs("h3",{className:"font-serif font-black text-xs sm:text-sm uppercase tracking-wider truncate text-gray-100 m-0",children:["LIVE BROADCAST: ",fr||"Campus Broadcast"]}),s.jsx("p",{className:"text-[9px] font-mono font-black uppercase text-gray-400 tracking-widest mt-0.5 hidden sm:block",children:"🔄 Recommendation: Landscape view is highly recommended for the best broadcast experience! Rotate your screen."}),s.jsx("p",{className:"text-[8px] font-mono font-black uppercase text-gray-400 tracking-widest mt-0.5 block sm:hidden",children:"🔄 RECOMMENDATION: ROTATE DEVICE FOR LANDSCAPE"})]})}),s.jsx("button",{onClick:()=>nr(null),className:"p-2 sm:p-2.5 rounded-full bg-white/10 hover:bg-gray-850 text-white border border-white/15 hover:rotate-90 transition-all duration-300 shadow-lg cursor-pointer flex items-center justify-center shrink-0",title:"Close Live Broadcast",children:s.jsx(Jr,{size:15,strokeWidth:3})})]}),s.jsx("div",{className:"pointer-events-none absolute top-18 left-1/2 -translate-x-1/2 z-40 bg-gray-850/90 border border-gray-700 text-white px-4 py-2 rounded-xl text-[8.5px] font-black uppercase tracking-widest shadow-lg flex items-center gap-2 animate-bounce md:hidden select-none",children:s.jsx("span",{children:"🔄 rotate device to landscape for full view"})}),s.jsx("div",{className:"flex-1 w-full h-full bg-black",children:s.jsx("iframe",{src:(()=>{const ge=Rt;if(ge)try{let we="";const Me=ge.trim();if(Me.includes("youtube.com/watch")){const Ke=/[?&]v=([^&#]*)/,Je=Me.match(Ke);Je&&Je[1]&&(we=Je[1])}else if(Me.includes("youtu.be/")){const Ke=Me.split("youtu.be/");Ke[1]&&(we=Ke[1].split(/[?#&]/)[0])}else if(Me.includes("youtube.com/live/")){const Ke=Me.split("youtube.com/live/");Ke[1]&&(we=Ke[1].split(/[?#&]/)[0])}else if(Me.includes("/shorts/")){const Ke=Me.split("/shorts/");Ke[1]&&(we=Ke[1].split(/[?#&]/)[0])}else if(Me.includes("youtube.com/embed/")){const Ke=Me.split("youtube.com/embed/");Ke[1]&&(we=Ke[1].split(/[?#&]/)[0])}else if(Me.includes("youtube-nocookie.com/embed/")){const Ke=Me.split("youtube-nocookie.com/embed/");Ke[1]&&(we=Ke[1].split(/[?#&]/)[0])}return we?`https://www.youtube.com/embed/${we}?autoplay=1&mute=0&rel=0`:Me}catch{return ge}})(),className:"w-full h-full border-0 bg-black pt-16 sm:pt-16",title:fr||"Live Stream Grid",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen",allowFullScreen:!0,referrerPolicy:"strict-origin-when-cross-origin"})})]})})}),s.jsx(on,{children:K&&s.jsx($2e,{article:K,onClose:()=>{const ge=new URL(window.location.href);ge.searchParams.delete("articles"),ge.searchParams.delete("id"),window.history.pushState({},"",ge.toString()),me(null),le(!1)},isAdmin:zt,allArticles:o,onArticleSelect:ge=>{const we=new URL(window.location.href),Me=ge.title.toLowerCase().replace(/[^a-z0-9]/g,"-");we.searchParams.set("articles",Me),we.searchParams.set("id",ge.id),window.history.pushState({articleId:ge.id},"",we.toString()),me(ge)},onCategorySelect:ge=>{Pe(ge),me(null),le(!1);const we=new URL(window.location.href);we.searchParams.delete("articles"),we.searchParams.delete("id"),we.searchParams.set("tab",ge),window.history.pushState({},"",we.toString()),window.scrollTo({top:0,behavior:"auto"})}})}),s.jsx(on,{children:ae&&s.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-md z-[5000] flex items-center justify-center p-4",children:s.jsxs(Qt.div,{initial:{scale:.95,opacity:0,y:30},animate:{scale:1,opacity:1,y:0},exit:{scale:.95,opacity:0,y:30},transition:{type:"spring",damping:25,stiffness:350},className:"bg-white rounded-3xl w-full max-w-6xl md:max-w-7xl max-h-[92vh] flex flex-col shadow-2xl overflow-hidden border border-gray-150",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 bg-gray-50/50",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-emerald-50 text-emerald-600 flex items-center justify-center shrink-0",children:s.jsx(D2,{size:18})}),s.jsxs("div",{className:"text-left",children:[s.jsx("h3",{className:"text-xs font-black text-gray-950 uppercase tracking-tight",children:"Campus Audio Newsroom & Podcasts"}),s.jsx("p",{className:"text-[8px] text-gray-400 font-bold uppercase tracking-wider",children:"Independent Campus Dispatches • Wide Broadcast Hub"})]})]}),s.jsx("button",{onClick:()=>qe(!1),className:"p-1.5 bg-gray-100 hover:bg-gray-200 text-gray-600 rounded-full transition-colors cursor-pointer flex items-center justify-center",title:"Close Podcasts",children:s.jsx(Jr,{size:13})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4 bg-white text-left",children:s.jsx(MV,{})})]})})}),s.jsx(UMe,{}),pt&&s.jsx(xP,{podcast:pt,onClose:()=>Fe(null)}),s.jsx(on,{children:cr&&s.jsxs("div",{className:"fixed inset-0 z-[3000] flex items-center justify-center p-2 sm:p-4",children:[s.jsx(Qt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>St(!1),className:"fixed inset-0 bg-black/60 backdrop-blur-xl"}),s.jsxs(Qt.div,{initial:{scale:.95,y:15,opacity:0},animate:{scale:1,y:0,opacity:1},exit:{scale:.95,y:15,opacity:0},transition:{type:"spring",damping:30,stiffness:350},className:"relative w-full h-[98%] max-w-7xl bg-white rounded-[2.5rem] shadow-2xl flex flex-col overflow-hidden border border-gray-150 z-10",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 bg-gray-50/50 shrink-0 text-left",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-400 shrink-0"}),s.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-gray-450 font-mono",children:"CAMPUS PASSES & EVENTS"})]}),s.jsx("button",{onClick:()=>St(!1),className:"p-2 rounded-full hover:bg-gray-150 text-gray-500 hover:text-black transition-all cursor-pointer border border-transparent hover:border-gray-200",title:"Close Ticket Store",children:s.jsx(Jr,{size:18})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 bg-white",children:s.jsx(OMe,{})})]})]})}),s.jsx(on,{children:(Ct||Ot||Xe)&&s.jsx("div",{className:"fixed inset-0 z-[11000] flex items-center justify-center p-4 bg-black/85 backdrop-blur-md",children:s.jsxs(Qt.div,{initial:{scale:.95,opacity:0,y:15},animate:{scale:1,y:0,opacity:1},exit:{scale:.95,y:15,opacity:0},className:"bg-white rounded-[2.5rem] border border-gray-150 p-8 w-full max-w-md shadow-2xl relative text-center",children:[s.jsx("button",{onClick:()=>{Gt(null),Xt(null);const ge=new URL(window.location.href);ge.searchParams.delete("scan"),window.history.pushState({},"",ge.toString())},className:"absolute top-6 right-6 p-2 bg-gray-50 text-gray-900 hover:bg-gray-100 rounded-full transition-all cursor-pointer border border-transparent hover:border-gray-200 flex items-center justify-center",title:"Close Scanner",children:s.jsx(Jr,{size:15,className:"stroke-[2.5]"})}),s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-12 h-12 bg-red-50 text-red-600 rounded-full flex items-center justify-center mb-4",children:s.jsx(Ea,{size:24})}),s.jsx("h3",{className:"text-xs font-black text-red-650 uppercase tracking-widest font-mono mb-1",children:"Gate Check-In Protocol"}),s.jsx("h2",{className:"text-xl font-serif font-black text-gray-950 tracking-tight leading-tight mb-5 uppercase",children:"Verification Console"}),Ot?s.jsxs("div",{className:"py-8 flex flex-col items-center gap-3",children:[s.jsx(vn,{className:"animate-spin text-red-600",size:24}),s.jsx("span",{className:"text-[10px] uppercase font-black text-gray-400",children:"Loading Pass Records..."})]}):Xe?s.jsxs("div",{className:"w-full space-y-6",children:[s.jsxs("div",{className:"bg-gray-50 p-5 rounded-3xl border border-gray-100 text-left space-y-3",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-[8px] font-black text-gray-400 uppercase tracking-wider block",children:"Event Pass Name"}),s.jsx("span",{className:"text-sm font-black text-gray-950 uppercase tracking-tight",children:Xe.ticketTitle})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-[8px] font-black text-gray-400 uppercase tracking-wider block",children:"Attendee"}),s.jsx("span",{className:"text-xs font-bold text-gray-800",children:Xe.userName})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-[8px] font-black text-gray-400 uppercase tracking-wider block",children:"Order ID"}),s.jsxs("span",{className:"text-xs font-mono font-black text-gray-800 uppercase",children:["#",Xe.id.slice(-6).toUpperCase()]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-1.5 border-t border-gray-100/70",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-[8px] font-black text-gray-400 uppercase tracking-wider block",children:"Guest Count"}),s.jsxs("span",{className:"text-xs font-bold text-gray-800",children:[Xe.quantity," Pax"]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-[8px] font-black text-gray-400 uppercase tracking-wider block",children:"Admission Status"}),Xe.taken||Xe.used?s.jsx("span",{className:"text-[9px] font-black text-green-600 uppercase bg-green-50 border border-green-200 px-1.5 py-0.5 rounded inline-block mt-0.5",children:"✔️ Used / Ticked"}):s.jsx("span",{className:"text-[9px] font-black text-red-655 uppercase bg-red-50 border border-red-200 px-1.5 py-0.5 rounded inline-block mt-0.5",children:"Active / Unused"})]})]})]}),zt?s.jsxs("div",{className:"bg-red-50/50 p-5 rounded-3xl border border-red-100/50 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3 justify-center select-none",children:[s.jsx("input",{type:"checkbox",id:"scan-gate-taken",checked:!!Xe.taken||!!Xe.used,onChange:async()=>{const ge=!(Xe.taken||Xe.used);try{await Ir(st(fe,"purchases",Xe.id),{taken:ge,used:ge}),Xt(we=>we?{...we,taken:ge,used:ge}:null),ge?(await dn(nt(fe,"notifications"),{userId:Xe.userId,title:`🎟️ Entrance Gate Ticked: ${Xe.ticketTitle}`,message:`Your entry pass (ID #${Xe.id.slice(-6).toUpperCase()}) has been officially scanned and ticked as used at the gate. Enjoy the event!`,used:!1,createdAt:new Date,type:"entrance_checkin",code:Xe.id}),he.success("Check-in complete! Pass marked as used.",{icon:"🎟️"})):he.success("Gate admission check reverted to active.")}catch(we){console.error("Gate scanning error update:",we),he.error("Fail to update: "+we.message)}},className:"w-5 h-5 rounded border-gray-300 text-red-650 focus:ring-red-550 cursor-pointer accent-red-650"}),s.jsx("label",{htmlFor:"scan-gate-taken",className:"text-xs font-black uppercase tracking-wider text-gray-950 cursor-pointer select-none",children:Xe.taken||Xe.used?"Used (Ticket Ticked)":"Mark Ticket Used"})]}),s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase leading-normal",children:"Ticking this checkbox invalidates this pass QR code for future entries, and dispatches a notification to the user's inbox in real-time."})]}):s.jsxs("div",{className:"bg-green-50/50 p-5 rounded-3xl border border-green-100/70 space-y-3",children:[s.jsx("span",{className:"text-[11px] font-black uppercase tracking-wider text-green-700 flex items-center justify-center gap-1.5 select-none font-mono",children:"🎉 Secure Entry Pass Verified"}),s.jsxs("div",{className:"space-y-1.5 text-center",children:[s.jsx("p",{className:"text-[10px] text-gray-650 font-bold uppercase leading-normal",children:Xe.taken||Xe.used?s.jsx("span",{className:"text-green-650 font-black",children:"✔️ Ticked & Used. You are checked in."}):s.jsx("span",{className:"text-gray-500 font-extrabold",children:"Active and ready. Please show this to the gate attendant."})}),s.jsx("p",{className:"text-[9px] text-gray-400 font-bold uppercase leading-none mt-1 font-mono",children:"Only administrators can check-in or tick this pass."})]})]}),s.jsx("button",{onClick:()=>{Gt(null),Xt(null);const ge=new URL(window.location.href);ge.searchParams.delete("scan"),window.history.pushState({},"",ge.toString())},className:"w-full py-4.5 bg-gray-950 text-white hover:bg-red-650 rounded-2xl text-[10px] font-black uppercase tracking-widest transition-all shadow-md cursor-pointer outline-none select-none",children:"Process Completed"})]}):s.jsx("div",{className:"py-6 space-y-4",children:s.jsxs("span",{className:"text-xs font-bold text-gray-500",children:["Retrieving pass ticket ID #",Ct==null?void 0:Ct.slice(-6).toUpperCase(),"..."]})})]})]})})}),s.jsx(k9e,{isOpen:Wr,onClose:()=>dr(!1),onScanSuccess:ge=>{Gt(ge)}}),s.jsx(on,{children:Oe&&s.jsx("div",{className:"fixed inset-0 z-[100000] flex items-center justify-center p-4 bg-black/75 backdrop-blur-md",children:s.jsxs(Qt.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},className:"bg-white border border-gray-150 rounded-[2.5rem] p-8 shadow-2xl max-w-md w-full relative overflow-hidden",children:[s.jsx("div",{className:"absolute top-0 left-0 w-full h-[3px] bg-red-650"}),s.jsxs("div",{className:"space-y-1.5 text-center mb-6",children:[s.jsx("div",{className:"w-10 h-10 bg-black text-white rounded-2xl flex items-center justify-center font-black text-sm mx-auto shadow-sm tracking-tighter mt-2",children:"★"}),s.jsx("h3",{className:"font-serif font-black text-lg tracking-tight text-neutral-900 uppercase",children:"Welcome! Tune Your Dispatch"}),s.jsx("p",{className:"text-[10px] text-neutral-500 font-semibold tracking-normal leading-relaxed max-w-xs mx-auto",children:"Pick up to 3 core categories below so we can curate your feed and learn your preferences live!"})]}),s.jsx("div",{className:"grid grid-cols-2 gap-2.5",children:[{id:"news",label:"📰 News",category:"News"},{id:"sports",label:"⚽ Sports",category:"Sports"},{id:"music",label:"🎵 Music",category:"Music"},{id:"entertainment",label:"🎭 Entertainment",category:"Entertainment"},{id:"innovation",label:"💡 Innovation",category:"Innovation"},{id:"culture",label:"🏛️ Culture",category:"Culture"},{id:"business",label:"💼 Business",category:"Business"}].map(ge=>{const we=ft.includes(ge.category);return s.jsxs("button",{onClick:()=>{if(we)mr(Me=>Me.filter(Ke=>Ke!==ge.category));else{if(ft.length>=3){he.error("Please pick up to just 3 interests!",{id:"interest-limit"});return}mr(Me=>[...Me,ge.category])}},className:`p-3 rounded-2xl border text-left font-sans text-xs font-semibold transition-all duration-200 cursor-pointer flex flex-col justify-between h-[4.5rem] select-none ${we?"border-black bg-black text-white shadow-sm scale-[1.02]":"border-gray-205 bg-white text-gray-700 hover:border-gray-350 hover:bg-gray-50/50"}`,children:[s.jsx("span",{className:"text-base leading-none",children:ge.label.split(" ")[0]}),s.jsx("span",{className:"font-sans uppercase text-[8.5px] font-black tracking-wider leading-none",children:ge.label.split(" ").slice(1).join(" ")})]},ge.id)})}),s.jsxs("div",{className:"pt-6 text-center",children:[s.jsxs("span",{className:"text-[8.5px] font-sans font-black text-gray-400 uppercase tracking-widest block mb-3.5",children:[ft.length," of 3 Selected"]}),s.jsx("button",{onClick:async()=>{if(ft.length===0){he.error("Please select at least 1 interest to customize your feed!");return}try{const ge=localStorage.getItem("campus_eye_personalization_v1"),we=ge?JSON.parse(ge):{categories:{}};if(we.interests=[...ft],we.categories||(we.categories={}),ft.forEach(Me=>{we.categories[Me]=(we.categories[Me]||0)+150}),localStorage.setItem("campus_eye_personalization_v1",JSON.stringify(we)),localStorage.removeItem("just_signed_up"),Ne.currentUser){const Me=st(fe,"users",Ne.currentUser.uid);await Gn(Me,{interests:[...ft]},{merge:!0})}kr(!0),setTimeout(()=>{kr(!1),ar(!1),he.success("Newsroom personalized live! Welcome.")},1200)}catch{ar(!1)}},className:"w-full py-4 bg-red-650 hover:bg-black transition-all cursor-pointer font-black text-xs uppercase tracking-widest text-white rounded-xl",children:Ht?"BUILDING YOUR FEED...":"START EXPLORING"})]})]})})}),s.jsx(XMe,{isOpen:!!yn,onClose:()=>He(null),userId:yn,currentUserId:(vl=Ne.currentUser)==null?void 0:vl.uid}),s.jsx(QMe,{}),s.jsx(ZMe,{}),s.jsx(LMe,{})]})}lre.createRoot(document.getElementById("root")).render(s.jsx(I.StrictMode,{children:s.jsx(rF,{children:s.jsx(C9e,{})})}));