PageSourceSearch

https://marineco.in/wp-content/plugins/livechat-plugin/assets/AppCore-BF7kuK_D.js

js marineco.in collected 2026-10-06 15:03:48 UTC 298,303 bytes, 177 lines download raw bytes

vendor: 25,674 bytes, line 1
1var ic=Object.create,Jo=Object.defineProperty,ac=Object.getOwnPropertyDescriptor,na=Object.getOwnPropertyNames,lc=Object.getPrototypeOf,cc=Object.prototype.hasOwnProperty,Zr=(e,t)=>function(){return t||(0,e[na(e)[0]])((t={exports:{}}).exports,t),t.exports},uc=e=>{let t={};for(var r in e)Jo(t,r,{get:e[r],enumerable:!0});return t},dc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=na(t),s=0,i=o.length,a;s<i;s++)a=o[s],!cc.call(e,a)&&a!==r&&Jo(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(n=ac(t,a))||n.enumerable});return e},hc=(e,t,r)=>(r=e!=null?ic(lc(e)):{},dc(t||!e||!e.__esModule?Jo(r,"default",{value:e,enumerable:!0}):r,e)),Qr,_e,oa,fc,tr,Fs,sa,ia,so,wn,Br,aa,Yo,bo,xo,la,On={},Ln=[],pc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$r=Array.isArray;function Mt(e,t){for(var r in t)e[r]=t[r];return e}function Xo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ie(e,t,r){var n,o,s,i={};for(s in t)s=="key"?n=t[s]:s=="ref"?o=t[s]:i[s]=t[s];if(arguments.length>2&&(i.children=arguments.length>3?Qr.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)i[s]===void 0&&(i[s]=e.defaultProps[s]);return Dr(e,i,n,o,null)}function Dr(e,t,r,n,o){var s={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++oa,__i:-1,__u:0};return o==null&&_e.vnode!=null&&_e.vnode(s),s}function mc(){return{current:null}}function ct(e){return e.children}function Pt(e,t){this.props=e,this.context=t}function vr(e,t){if(t==null)return e.__?vr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?vr(e):null}function gc(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,n=[],o=[],s=Mt({},t);s.__v=t.__v+1,_e.vnode&&_e.vnode(s),Zo(e.__P,s,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,n,r??vr(t),!!(32&t.__u),o),s.__v=t.__v,s.__.__k[s.__i]=s,ha(n,s,o),t.__e=t.__=null,s.__e!=r&&ca(s)}}function ca(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ca(e)}function ko(e){(!e.__d&&(e.__d=!0)&&tr.push(e)&&!Mn.__r++||Fs!=_e.debounceRendering)&&((Fs=_e.debounceRendering)||sa)(Mn)}function Mn(){try{for(var e,t=1;tr.length;)tr.length>t&&tr.sort(ia),e=tr.shift(),t=tr.length,gc(e)}finally{tr.length=Mn.__r=0}}function ua(e,t,r,n,o,s,i,a,l,c,h){var d,f,p,_,w,v,m,g=n&&n.__k||Ln,x=t.length;for(l=_c(r,t,g,l,x),d=0;d<x;d++)(p=r.__k[d])!=null&&(f=p.__i!=-1&&g[p.__i]||On,p.__i=d,v=Zo(e,p,f,o,s,i,a,l,c,h),_=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Qo(f.ref,null,p),h.push(p.ref,p.__c||_,p)),w==null&&_!=null&&(w=_),(m=!!(4&p.__u))||f.__k===p.__k?(l=da(p,l,e,m),m&&f.__e&&(f.__e=null)):typeof p.type=="function"&&v!==void 0?l=v:_&&(l=_.nextSibling),p.__u&=-7);return r.__e=w,l}function _c(e,t,r,n,o){var s,i,a,l,c,h=r.length,d=h,f=0;for(e.__k=new Array(o),s=0;s<o;s++)(i=t[s])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[s]=Dr(null,i,null,null,null):$r(i)?i=e.__k[s]=Dr(ct,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[s]=Dr(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[s]=i,l=s+f,i.__=e,i.__b=e.__b+1,a=null,(c=i.__i=yc(i,r,l,d))!=-1&&(d--,(a=r[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(o>h?f--:o<h&&f++),typeof i.type!="function"&&(i.__u|=4)):c!=l&&(c==l-1?f--:c==l+1?f++:(c>l?f--:f++,i.__u|=4))):e.__k[s]=null;if(d)for(s=0;s<h;s++)(a=r[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=vr(a)),pa(a,a));return n}function da(e,t,r,n){var o,s;if(typeof e.type=="function"){for(o=e.__k,s=0;o&&s<o.length;s++)o[s]&&(o[s].__=e,t=da(o[s],t,r,n));return t}e.__e!=t&&(n&&(t&&e.type&&!t.parentNode&&(t=vr(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Gt(e,t){return t=t||[],e==null||typeof e=="boolean"||($r(e)?e.some(function(r){Gt(r,t)}):t.push(e)),t}function yc(e,t,r,n){var o,s,i,a=e.key,l=e.type,c=t[r],h=c!=null&&(2&c.__u)==0;if(c===null&&a==null||h&&a==c.key&&l==c.type)return r;if(n>(h?1:0)){for(o=r-1,s=r+1;o>=0||s<t.length;)if((c=t[i=o>=0?o--:s++])!=null&&(2&c.__u)==0&&a==c.key&&l==c.type)return i}return-1}function Vs(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||pc.test(t)?r:r+"px"}function dn(e,t,r,n,o){var s,i;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Vs(e.style,t,"");if(r)for(t in r)n&&r[t]==n[t]||Vs(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(aa,"$1")),i=t.toLowerCase(),t=i in e||t=="onFocusOut"||t=="onFocusIn"?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?n?r[Br]=n[Br]:(r[Br]=Yo,e.addEventListener(t,s?xo:bo,s)):e.removeEventListener(t,s?xo:bo,s);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Us(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t[wn]==null)t[wn]=Yo++;else if(t[wn]<r[Br])return;return r(_e.event?_e.event(t):t)}}}function Zo(e,t,r,n,o,s,i,a,l,c){var h,d,f,p,_,w,v,m,g,x,O,N,E,S,I,F=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),s=[a=t.__e=r.__e]),(h=_e.__b)&&h(t);e:if(typeof F=="function")try{if(m=t.props,g=F.prototype&&F.prototype.render,x=(h=F.contextType)&&n[h.__c],O=h?x?x.props.value:h.__:n,r.__c?v=(d=t.__c=r.__c).__=d.__E:(g?t.__c=d=new F(m,O):(t.__c=d=new Pt(m,O),d.constructor=F,d.render=vc),x&&x.sub(d),d.state||(d.state={}),d.__n=n,f=d.__d=!0,d.__h=[],d._sb=[]),g&&d.__s==null&&(d.__s=d.state),g&&F.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Mt({},d.__s)),Mt(d.__s,F.getDerivedStateFromProps(m,d.__s))),p=d.props,_=d.state,d.__v=t,f)g&&F.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),g&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(g&&F.getDerivedStateFromProps==null&&m!==p&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(m,O),t.__v==r.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(m,d.__s,O)===!1){t.__v!=r.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(M){M&&(M.__=t)}),Ln.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&i.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(m,d.__s,O),g&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(p,_,w)})}if(d.context=O,d.props=m,d.__P=e,d.__e=!1,N=_e.__r,E=0,g)d.state=d.__s,d.__d=!1,N&&N(t),h=d.render(d.props,d.state,d.context),Ln.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,N&&N(t),h=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++E<25);d.state=d.__s,d.getChildContext!=null&&(n=Mt(Mt({},n),d.getChildContext())),g&&!f&&d.getSnapshotBeforeUpdate!=null&&(w=d.getSnapshotBeforeUpdate(p,_)),S=h!=null&&h.type===ct&&h.key==null?fa(h.props.children):h,a=ua(e,$r(S)?S:[S],t,r,n,o,s,i,a,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&i.push(d),v&&(d.__E=d.__=null)}catch(M){if(t.__v=null,l||s!=null)if(M.then){for(t.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,t.__e=a}else{for(I=s.length;I--;)Xo(s[I]);So(t)}else t.__e=r.__e,t.__k=r.__k,M.then||So(t);_e.__e(M,t,r)}else s==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=wc(r.__e,t,r,n,o,s,i,l,c);return(h=_e.diffed)&&h(t),128&t.__u?void 0:a}function So(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(So))}function ha(e,t,r){for(var n=0;n<r.length;n++)Qo(r[n],r[++n],r[++n]);_e.__c&&_e.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(s){s.call(o)})}catch(s){_e.__e(s,o.__v)}})}function fa(e){return typeof e!="object"||e==null||e.__b>0?e:$r(e)?e.map(fa):e.constructor!==void 0?null:Mt({},e)}function wc(e,t,r,n,o,s,i,a,l){var c,h,d,f,p,_,w,v=r.props||On,m=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((p=s[c])&&"setAttribute"in p==!!g&&(g?p.localName==g:p.nodeType==3)){e=p,s[c]=null;break}}if(e==null){if(g==null)return document.createTextNode(m);e=document.createElementNS(o,g,m.is&&m),a&&(_e.__m&&_e.__m(t,s),a=!1),s=null}if(g==null)v===m||a&&e.data==m||(e.data=m);else{if(s=g=="textarea"&&m.defaultValue!=null?null:s&&Qr.call(e.childNodes),!a&&s!=null)for(v={},c=0;c<e.attributes.length;c++)v[(p=e.attributes[c]).name]=p.value;for(c in v)p=v[c],c=="dangerouslySetInnerHTML"?d=p:c=="children"||c in m||c=="value"&&"defaultValue"in m||c=="checked"&&"defaultChecked"in m||dn(e,c,null,p,o);for(c in m)p=m[c],c=="children"?f=p:c=="dangerouslySetInnerHTML"?h=p:c=="value"?_=p:c=="checked"?w=p:a&&typeof p!="function"||v[c]===p||dn(e,c,p,v[c],o);if(h)a||d&&(h.__html==d.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(d&&(e.innerHTML=""),ua(t.type=="template"?e.content:e,$r(f)?f:[f],t,r,n,g=="foreignObject"?"http://www.w3.org/1999/xhtml":o,s,i,s?s[0]:r.__k&&vr(r,0),a,l),s!=null)for(c=s.length;c--;)Xo(s[c]);a&&g!="textarea"||(c="value",g=="progress"&&_==null?e.removeAttribute("value"):_!=null&&(_!==e[c]||g=="progress"&&!_||g=="option"&&_!=v[c])&&dn(e,c,_,v[c],o),c="checked",w!=null&&w!=e[c]&&dn(e,c,w,v[c],o))}return e}function Qo(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(o){_e.__e(o,r)}}function pa(e,t,r){var n,o;if(_e.unmount&&_e.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||Qo(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){_e.__e(s,t)}n.base=n.__P=null}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&pa(n[o],t,r||typeof e.type!="function");r||Xo(e.__e),e.__c=e.__=e.__e=void 0}function vc(e,t,r){return this.constructor(e,r)}function Vr(e,t,r){var n,o,s,i;t==document&&(t=document.documentElement),_e.__&&_e.__(e,t),o=(n=typeof r=="function")?null:r&&r.__k||t.__k,s=[],i=[],Zo(t,e=(!n&&r||t).__k=Ie(ct,null,[e]),o||On,On,t.namespaceURI,!n&&r?[r]:o?null:t.firstChild?Qr.call(t.childNodes):null,s,!n&&r?r:o?o.__e:t.firstChild,n,i),ha(s,e,i)}function ma(e,t){Vr(e,t,ma)}function bc(e,t,r){var n,o,s,i,a=Mt({},e.props);for(s in e.type&&e.type.defaultProps&&(i=e.type.defaultProps),t)s=="key"?n=t[s]:s=="ref"?o=t[s]:a[s]=t[s]===void 0&&i!=null?i[s]:t[s];return arguments.length>2&&(a.children=arguments.length>3?Qr.call(arguments,2):r),Dr(e.type,a,n||e.key,o||e.ref,null)}function Un(e){function t(r){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(s){this.props.value!=s.value&&n.forEach(function(i){i.__e=!0,ko(i)})},this.sub=function(s){n.add(s);var i=s.componentWillUnmount;s.componentWillUnmount=function(){n&&n.delete(s),i&&i.call(s)}}),r.children}return t.__c="__cC"+la++,t.__=e,t.Provider=t.__l=(t.Consumer=function(r,n){return r.children(n)}).contextType=t,t}Qr=Ln.slice,_e={__e:function(e,t,r,n){for(var o,s,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((s=o.constructor)&&s.getDerivedStateFromError!=null&&(o.setState(s.getDerivedStateFromError(e)),i=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),i=o.__d),i)return o.__E=o}catch(a){e=a}throw e}},oa=0,fc=function(e){return e!=null&&e.constructor===void 0},Pt.prototype.setState=function(e,t){var r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Mt({},this.state);typeof e=="function"&&(e=e(Mt({},r),this.props)),e&&Mt(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),ko(this))},Pt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ko(this))},Pt.prototype.render=ct,tr=[],sa=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ia=function(e,t){return e.__v.__b-t.__v.__b},Mn.__r=0,so=Math.random().toString(8),wn="__d"+so,Br="__a"+so,aa=/(PointerCapture)$|Capture$/i,Yo=0,bo=Us(!1),xo=Us(!0),la=0;var or,De,io,Ws,br=0,ga=[],je=_e,js=je.__b,qs=je.__r,Gs=je.diffed,Ks=je.__c,Js=je.unmount,Ys=je.__;function xr(e,t){je.__h&&je.__h(De,e,br||t),br=0;var r=De.__H||(De.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function ee(e){return br=1,$o(va,e)}function $o(e,t,r){var n=xr(or++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):va(void 0,t),function(a){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,a);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=De,!De.__f)){var o=function(a,l,c){if(!n.__c.__H)return!0;var h=n.__c.__H.__.filter(function(f){return f.__c});if(h.every(function(f){return!f.__N}))return!s||s.call(this,a,l,c);var d=n.__c.props!==a;return h.some(function(f){if(f.__N){var p=f.__[0];f.__=f.__N,f.__N=void 0,p!==f.__[0]&&(d=!0)}}),s&&s.call(this,a,l,c)||d};De.__f=!0;var s=De.shouldComponentUpdate,i=De.componentWillUpdate;De.componentWillUpdate=function(a,l,c){if(this.__e){var h=s;s=void 0,o(a,l,c),s=h}i&&i.call(this,a,l,c)},De.shouldComponentUpdate=o}return n.__N||n.__}function xe(e,t){var r=xr(or++,3);!je.__s&&es(r.__H,t)&&(r.__=e,r.u=t,De.__H.__h.push(r))}function kr(e,t){var r=xr(or++,4);!je.__s&&es(r.__H,t)&&(r.__=e,r.u=t,De.__h.push(r))}function me(e){return br=5,St(function(){return{current:e}},[])}function _a(e,t,r){br=6,kr(function(){if(typeof e=="function"){var n=e(t());return function(){e(null),n&&typeof n=="function"&&n()}}if(e)return e.current=t(),function(){return e.current=null}},r==null?r:r.concat(e))}function St(e,t){var r=xr(or++,7);return es(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Ee(e,t){return br=8,St(function(){return e},t)}function en(e){var t=De.context[e.__c],r=xr(or++,9);return r.c=e,t?(r.__??(r.__=!0,t.sub(De)),t.props.value):e.__}function ya(e,t){je.useDebugValue&&je.useDebugValue(t?t(e):e)}function wa(){var e=xr(or++,11);if(!e.__){for(var t=De.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function xc(){for(var e;e=ga.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(vn),t.__h.some(Co),t.__h=[]}catch(r){t.__h=[],je.__e(r,e.__v)}}}je.__b=function(e){De=null,js&&js(e)},je.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ys&&Ys(e,t)},je.__r=function(e){qs&&qs(e),or=0;var t=(De=e.__c).__H;t&&(io===De?(t.__h=[],De.__h=[],t.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.some(vn),t.__h.some(Co),t.__h=[],or=0)),io=De},je.diffed=function(e){Gs&&Gs(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ga.push(t)!==1&&Ws===je.requestAnimationFrame||((Ws=je.requestAnimationFrame)||kc)(xc)),t.__H.__.some(function(r){r.u&&(r.__H=r.u),r.u=void 0})),io=De=null},je.__c=function(e,t){t.some(function(r){try{r.__h.some(vn),r.__h=r.__h.filter(function(n){return!n.__||Co(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],je.__e(n,r.__v)}}),Ks&&Ks(e,t)},je.unmount=function(e){Js&&Js(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some(function(n){try{vn(n)}catch(o){t=o}}),r.__H=void 0,t&&je.__e(t,r.__v))};var Xs=typeof requestAnimationFrame=="function";function kc(e){var t,r=function(){clearTimeout(n),Xs&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,35);Xs&&(t=requestAnimationFrame(r))}function vn(e){var t=De,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),De=t}function Co(e){var t=De;e.__c=e.__(),De=t}function es(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function va(e,t){return typeof t=="function"?t(e):t}function ba(e,t){for(var r in t)e[r]=t[r];return e}function To(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function xa(e,t){var r=t(),n=ee({t:{__:r,u:t}}),o=n[0].t,s=n[1];return kr(function(){o.__=r,o.u=t,ao(o)&&s({t:o})},[e,r,t]),xe(function(){return ao(o)&&s({t:o}),e(function(){ao(o)&&s({t:o})})},[e]),r}function ao(e){try{return!((t=e.__)===(r=e.u())&&(t!==0||1/t==1/r)||t!=t&&r!=r)}catch{return!0}var t,r}function ka(e){e()}function Sa(e){return e}function Ca(){return[!1,ka]}var Ta=kr;function Io(e,t){this.props=e,this.context=t}function Ia(e,t){function r(o){var s=this.props.ref;return s!=o.ref&&s&&(typeof s=="function"?s(null):s.current=null),t?!t(this.props,o)||s!=o.ref:To(this.props,o)}function n(o){return this.shouldComponentUpdate=r,Ie(e,o)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.__f=n.prototype.isReactComponent=!0,n.type=e,n}(Io.prototype=new Pt).isPureReactComponent=!0,Io.prototype.shouldComponentUpdate=function(e,t){return To(this.props,e)||To(this.state,t)};var Zs=_e.__b;_e.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Zs&&Zs(e)};var Sc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Cc(e){function t(r){var n=ba({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=Sc,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Qs=function(e,t){return e==null?null:Gt(Gt(e).map(t))},Tc={map:Qs,forEach:Qs,count:function(e){return e?Gt(e).length:0},only:function(e){var t=Gt(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:Gt},Ic=_e.__e;_e.__e=function(e,t,r,n){if(e.then){for(var o,s=t;s=s.__;)if((o=s.__c)&&o.__c)return t.__e??(t.__e=r.__e,t.__k=r.__k),o.__c(e,t)}Ic(e,t,r,n)};var $s=_e.unmount;function Ea(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=ba({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return Ea(n,t,r)})),e}function Aa(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return Aa(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function bn(){this.__u=0,this.o=null,this.__b=null}function Na(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Ec(e){var t,r,n,o=null;function s(i){if(t||(t=e()).then(function(a){a&&(o=a.default||a),n=!0},function(a){r=a,n=!0}),r)throw r;if(!n)throw t;return o?Ie(o,i):null}return s.displayName="Lazy",s.__f=!0,s}function Or(){this.i=null,this.l=null}_e.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),$s&&$s(e)},(bn.prototype=new Pt).__c=function(e,t){var r=t.__c,n=this;n.o??=[],n.o.push(r);var o=Na(n.__v),s=!1,i=function(){s||n.__z||(s=!0,r.__R=null,o?o(l):l())};r.__R=i;var a=r.__P;r.__P=null;var l=function(){if(!--n.__u){if(n.state.__a){var c=n.state.__a;n.__v.__k[0]=Aa(c,c.__c.__P,c.__c.__O)}var h;for(n.setState({__a:n.__b=null});h=n.o.pop();)h.__P=a,h.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(i,i)},bn.prototype.componentWillUnmount=function(){this.o=[]},bn.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=Ea(this.__b,r,n.__O=n.__P)}this.__b=null}var o=t.__a&&Ie(ct,null,e.fallback);return o&&(o.__u&=-33),[Ie(ct,null,t.__a?null:e.children),o]};var ei=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};function Ac(e){return this.getChildContext=function(){return e.context},e.children}function Nc(e){var t=this,r=e.h;if(t.componentWillUnmount=function(){Vr(null,t.v),t.v=null,t.h=null},t.h&&t.h!==r&&t.componentWillUnmount(),!t.v){for(var n=t.__v;n!==null&&!n.__m&&n.__!==null;)n=n.__;t.h=r,t.v={nodeType:1,parentNode:r,childNodes:[],__k:{__m:n.__m},contains:function(){return!0},namespaceURI:r.namespaceURI,insertBefore:function(o,s){this.childNodes.push(o),t.h.insertBefore(o,s)},removeChild:function(o){this.childNodes.splice(this.childNodes.indexOf(o)>>>1,1),t.h.removeChild(o)}}}Vr(Ie(Ac,{context:t.context},e.__v),t.v)}function Rc(e,t){var r=Ie(Nc,{__v:e,h:t});return r.containerInfo=t,r}(Or.prototype=new Pt).__a=function(e){var t=this,r=Na(t.__v),n=t.l.get(e);return n[0]++,function(o){var s=function(){t.props.revealOrder?(n.push(o),ei(t,e,n)):o()};r?r(s):s()}},Or.prototype.render=function(e){this.i=null,this.l=new Map;var t=Gt(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},Or.prototype.componentDidUpdate=Or.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){ei(e,r,t)})};var Ra=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Oc=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Lc=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Mc=/[A-Z0-9]/g,Bc=typeof document<"u",Dc=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Oa(e,t,r){return t.__k??(t.textContent=""),Vr(e,t),typeof r=="function"&&r(),e?e.__c:null}function Pc(e,t,r){return ma(e,t),typeof r=="function"&&r(),e?e.__c:null}Pt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Pt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ti=_e.event;_e.event=function(e){return ti&&(e=ti(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var ts,zc={configurable:!0,get:function(){return this.class}},ri=_e.vnode;_e.vnode=function(e){typeof e.type=="string"&&(function(t){var r=t.props,n=t.type,o={},s=n.indexOf("-")==-1;for(var i in r){var a=r[i];if(!(i==="value"&&"defaultValue"in r&&a==null||Bc&&i==="children"&&n==="noscript"||i==="class"||i==="className")){var l=i.toLowerCase();i==="defaultValue"&&"value"in r&&r.value==null?i="value":i==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?i="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||Dc(r.type)?l==="onfocus"?i="onfocusin":l==="onblur"?i="onfocusout":Lc.test(i)&&(i=l):l=i="oninput":s&&Oc.test(i)?i=i.replace(Mc,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&o[i=l]&&(i="oninputCapture"),o[i]=a}}n=="select"&&(o.multiple&&Array.isArray(o.value)&&(o.value=Gt(r.children).forEach(function(c){c.props.selected=o.value.indexOf(c.props.value)!=-1})),o.defaultValue!=null&&(o.value=Gt(r.children).forEach(function(c){c.props.selected=o.multiple?o.defaultValue.indexOf(c.props.value)!=-1:o.defaultValue==c.props.value}))),r.class&&!r.className?(o.class=r.class,Object.defineProperty(o,"className",zc)):r.className&&(o.class=o.className=r.className),t.props=o})(e),e.$$typeof=Ra,ri&&ri(e)};var ni=_e.__r;_e.__r=function(e){ni&&ni(e),ts=e.__c};var oi=_e.diffed;_e.diffed=function(e){oi&&oi(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),ts=null};var Hc={ReactCurrentDispatcher:{current:{readContext:function(e){return ts.__n[e.__c].props.value},useCallback:Ee,useContext:en,useDebugValue:ya,useDeferredValue:Sa,useEffect:xe,useId:wa,useImperativeHandle:_a,useInsertionEffect:Ta,useLayoutEffect:kr,useMemo:St,useReducer:$o,useRef:me,useState:ee,useSyncExternalStore:xa,useTransition:Ca}}};function Fc(e){return Ie.bind(null,e)}function Wn(e){return!!e&&e.$$typeof===Ra}function Vc(e){return Wn(e)&&e.type===ct}function Uc(e){return!!e&&typeof e.displayName=="string"&&e.displayName.indexOf("Memo(")==0}function Wc(e){return Wn(e)?bc.apply(null,arguments):e}function La(e){return!!e.__k&&(Vr(null,e),!0)}function jc(e){return e&&(e.base||e.nodeType===1&&e)||null}var qc=function(e,t){return e(t)},Gc=function(e,t){var r=_e.debounceRendering;_e.debounceRendering=function(o){return o()};var n=e(t);return _e.debounceRendering=r,n},Kc=Wn,B={useState:ee,useId:wa,useReducer:$o,useEffect:xe,useLayoutEffect:kr,useInsertionEffect:Ta,useTransition:Ca,useDeferredValue:Sa,useSyncExternalStore:xa,startTransition:ka,useRef:me,useImperativeHandle:_a,useMemo:St,useCallback:Ee,useContext:en,useDebugValue:ya,version:"18.3.1",Children:Tc,render:Oa,hydrate:Pc,unmountComponentAtNode:La,createPortal:Rc,createElement:Ie,createContext:Un,createFactory:Fc,cloneElement:Wc,createRef:mc,Fragment:ct,isValidElement:Wn,isElement:Kc,isFragment:Vc,isMemo:Uc,findDOMNode:jc,Component:Pt,PureComponent:Io,memo:Ia,forwardRef:Cc,flushSync:Gc,unstable_batchedUpdates:qc,StrictMode:ct,Suspense:bn,SuspenseList:Or,lazy:Ec,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Hc};function Jc(e){return{render:function(t){Oa(t,e)},unmount:function(){La(e)}}}var Ma={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},si=B.createContext&&B.createContext(Ma),Yc=["attr","size","title"];function Xc(e,t){if(e==null)return{};var r=Zc(e,t),n,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)n=s[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Zc(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Bn(){return Bn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 4,458 bytes, line 1
1for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bn.apply(this,arguments)}function ii(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Dn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ii(Object(r),!0).forEach(function(n){Qc(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ii(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qc(e,t,r){return t=$c(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $c(e){var t=eu(e,"string");return typeof t=="symbol"?t:t+""}function eu(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ba(e){return e&&e.map((t,r)=>B.createElement(t.tag,Dn({key:r},t.attr),Ba(t.child)))}function qe(e){return t=>B.createElement(tu,Bn({attr:Dn({},e.attr)},t),Ba(e.child))}function tu(e){var t=r=>{var{attr:n,size:o,title:s}=e,i=Xc(e,Yc),a=o||r.size||"1em",l;return r.className&&(l=r.className),e.className&&(l=(l?l+" ":"")+e.className),B.createElement("svg",Bn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,i,{className:l,style:Dn(Dn({color:e.color||r.color},r.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&B.createElement("title",null,s),e.children)};return si!==void 0?B.createElement(si.Consumer,null,r=>t(r)):t(Ma)}function ru(e){return qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8 15c4.418 0 8-3.134 8-7s-3.582-7-8-7-8 3.134-8 7c0 1.76.743 3.37 1.97 4.6-.097 1.016-.417 2.13-.771 2.966-.079.186.074.394.273.362 2.256-.37 3.597-.938 4.18-1.234A9 9 0 0 0 8 15"},child:[]}]})(e)}function nu(e){return qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M16 8c0 3.866-3.582 7-8 7a9 9 0 0 1-2.347-.306c-.584.296-1.925.864-4.181 1.234-.2.032-.352-.176-.273-.362.354-.836.674-1.95.77-2.966C.744 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7M7.194 6.766a1.7 1.7 0 0 0-.227-.272 1.5 1.5 0 0 0-.469-.324l-.008-.004A1.8 1.8 0 0 0 5.734 6C4.776 6 4 6.746 4 7.667c0 .92.776 1.666 1.734 1.666.343 0 .662-.095.931-.26-.137.389-.39.804-.81 1.22a.405.405 0 0 0 .011.59c.173.16.447.155.614-.01 1.334-1.329 1.37-2.758.941-3.706a2.5 2.5 0 0 0-.227-.4zM11 9.073c-.136.389-.39.804-.81 1.22a.405.405 0 0 0 .012.59c.172.16.446.155.613-.01 1.334-1.329 1.37-2.758.942-3.706a2.5 2.5 0 0 0-.228-.4 1.7 1.7 0 0 0-.227-.273 1.5 1.5 0 0 0-.469-.324l-.008-.004A1.8 1.8 0 0 0 10.07 6c-.957 0-1.734.746-1.734 1.667 0 .92.777 1.666 1.734 1.666.343 0 .662-.095.931-.26z"},child:[]}]})(e)}function ou(e){return qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"},child:[]}]})(e)}function Da(e){return qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"},child:[]},{tag:"path",attr:{d:"M4.285 9.567a.5.5 0 0 1 .683.183A3.5 3.5 0 0 0 8 11.5a3.5 3.5 0 0 0 3.032-1.75.5.5 0 1 1 .866.5A4.5 4.5 0 0 1 8 12.5a4.5 4.5 0 0 1-3.898-2.25.5.5 0 0 1 .183-.683M7 6.5C7 7.328 6.552 8 6 8s-1-.672-1-1.5S5.448 5 6 5s1 .672 1 1.5m4 0c0 .828-.448 1.5-1 1.5s-1-.672-1-1.5S9.448 5 10 5s1 .672 1 1.5"},child:[]}]})(e)}function su(e){return qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8.864 15.674c-.956.24-1.843-.484-1.908-1.42-.072-1.05-.23-2.015-.428-2.59-.125-.36-.479-1.012-1.04-1.638-.557-.624-1.282-1.179-2.131-1.41C2.685 8.432 2 7.85 2 7V3c0-.845.682-1.464 1.448-1.546 1.07-.113 1.564-.415 2.068-.723l.048-.029c.272-.166.578-.349.97-.484C6.931.08 7.395 0 8 0h3.5c.937 0 1.599.478 1.934 1.064.164.287.254.607.254.913 0 .152-.023.312-.077.464.201.262.38.577.488.9.11.33.172.762.004 1.15.069.13.12.268.159.403.077.27.113.567.113.856s-.036.586-.113.856c-.
1035.12-.08.244-.138.363.394.571.418 1.2.234 1.733-.206.592-.682 1.1-1.2 1.272-.847.283-1.803.276-2.516.211a10 10 0 0 1-.443-.05 9.36 9.36 0 0 1-.062 4.51c-.138.508-.55.848-1.012.964zM11.5 1H8c-.51 0-.863.068-1.14.163-.281.097-.506.229-.776.393l-.04.025c-.555.338-1.198.73-2.49.868-.333.035-.554.29-.554.55V7c0 .255.226.543.62.65 1.095.3 1.977.997 2.614 1.709.635.71 1.064 1.475 1.238 1.977.243.7.407 1.768.482 2.85.025.362.36.595.667.518l.262-.065c.16-.04.258-.144.288-.255a8.34 8.34 0 0 0-.145-4.726.5.5 0 0 1 .595-.643h.003l.014.004.058.013a9 9 0 0 0 1.036.157c.663.06 1.457.054 2.11-.163.175-.059.45-.301.57-.651.107-.308.087-.67-.266-1.021L12.793 7l.353-.354c.043-.042.105-.14.154-.315.048-.167.075-.37.075-.581s-.027-.414-.075-.581c-.05-.174-.111-.273-.154-.315l-.353-.354.353-.354c.047-.047.109-.176.005-.488a2.2 2.2 0 0 0-.505-.804l-.353-.354.353-.354c.006-.005.041-.05.041-.17a.9.9 0 0 0-.121-.415C12.4 1.272 12.063 1 11.5 1"},child:[]}]})(e)}function iu(e){return qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8.864.046C7.908-.193 7.02.53 6.956 1.466c-.072 1.051-.23 2.016-.428 2.59-.125.36-.479 1.013-1.04 1.639-.557.623-1.282 1.178-2.131 1.41C2.685 7.288 2 7.87 2 8.72v4.001c0 .845.682 1.464 1.448 1.545 1.07.114 1.564.415 2.068.723l.048.03c.272.165.578.348.97.484.397.136.861.217 1.466.217h3.5c.937 0 1.599-.477 1.934-1.064a1.86 1.86 0 0 0 .254-.912c0-.152-.023-.312-.077-.464.201-.263.38-.578.488-.901.11-.33.172-.762.004-1.149.069-.13.12-.269.159-.403.077-.27.113-.568.113-.857 0-.288-.036-.585-.113-.856a2 2 0 0 0-.138-.362 1.9 1.9 0 0 0 .234-1.734c-.206-.592-.682-1.1-1.2-1.272-.847-.282-1.803-.276-2.516-.211a10 10 0 0 0-.443.05 9.4 9.4 0 0 0-.062-4.509A1.38 1.38 0 0 0 9.125.111zM11.5 14.721H8c-.51 0-.863-.069-1.14-.164-.281-.097-.506-.228-.776-.393l-.04-.024c-.555-.339-1.198-.731-2.49-.868-.333-.036-.554-.29-.554-.55V8.72c0-.254.226-.543.62-.65 1.095-.3 1.977-.996 2.614-1.708.635-.71 1.064-1.475 1.238-1.978.243-.7.407-1.768.482-2.85.025-.362.36-.594.667-.518l.262.066c.16.04.258.143.288.255a8.34 8.34 0 0 1-.145 4.725.5.5 0 0 0 .595.644l.003-.001.014-.003.058-.014a9 9 0 0 1 1.036-.157c.663-.06 1.457-.054 2.11.164.175.058.45.3.57.65.107.308.087.67-.266 1.022l-.353.353.353.354c.043.043.105.141.154.315.048.167.075.37.075.581 0 .212-.027.414-.075.582-.05.174-.111.272-.154.315l-.353.353.353.354c.047.047.109.177.005.488a2.2 2.2 0 0 1-.505.805l-.353.353.353.354c.006.005.041.05.041.17a.9.9 0 0 1-.121.416c-.165.288-.503.56-1.066.56z"},child:[]}]})(e)}function au(e){return qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143q.09.083.176.171a3 3 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15"},child:[]}]})(e)}function lu(e){return qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"},child:[]}]})(e)}function cu(e){return qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504 256C504 119 393 8 256 8S8 119 8 256c0 123.78 90.69 226.38 209.25 245V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.28c-30.8 0-40.41 19.12-40.41 38.73V256h68.78l-11 71.69h-57.78V501C413.31 482.38 504 379.78 504 256z"},child:[]}]})(e)}function uu(e){return qe({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm121.8 169.9l-40.7 191.8c-3 13.6-11.1 16.9-22.4 10.5l-62-45.7-29.9 28.8c-3.3 3.3-6.1 6.1-12.5 6.1l4.4-63.1 114.9-103.8c5-4.4-1.1-6.9-7.7-2.5l-142 89.4-61.2-19.1c-13.3-4.2-13.6-13.3 2.8-19.7l239.1-92.2c11.1-4 20.8 2.7 17.2 19.5z"},child:[]}]})(e)}function du(e){return qe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448,209.91a210.06,210.06,0,0,1-122.77-39.25V349.38A162.55,162.55,0,1,1,185,188.31V278.2a74.62,74.62,0,1,0,52.23,71.18V0l88,0a121.18,121.18,0,0,0,1.86,22.17h0A122.18,122.18,0,0,0,381,102.39a121.43,121.43,0,0,0,67,20.14Z"},child:[]}]})(e)}function hu(e){return qe({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"},child:[]}]})(e)}function fu(e){return qe({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M64 240c0 49.6 21.4 95 57 130.7-12.6 50.3-54.3 95.2-54.8 95.8-2.2 2.3-2.8 5.7-1.5 8.7 1.3 2.9 4.1 4.8 7.3 4.8 66.3 0 116-31.8 140.6-51.4 32.7 12.3 69 19.4 107.4 19.4 27.4 0 53.7-3.6 78.4-10L72.9 186.4c-5.6 17.1-8.9 35-8.9 53.6zm569.8 218.1l-114.4-88.4C554.6 334.1 576 289.2 576 240c0-114.9-114.6-208-256-208-65.1 0-124.2 20.1-169.4 52.7L45.5 3.4C38.5-2 28.5-.8 23 6.2L3.4 31.4c-5.4 7-4.2 17 2.8 22.4l588.4 454.7c7 5.4 17 4.2 22.5-2.8l19.6-25.3c5.4-6.8 4.1-16.9-2.9-22.3z"},child:[]}]})(e)}function pu(e){return qe({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"},child:[]}]})(e)}function mu(e){return qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497 273L329 441c-15 15-41 4.5-41-17v-96H152c-13.3 0-24-10.7-24-24v-96c0-13.3 10.7-24 24-24h136V88c0-21.4 25.9-32 41-17l168 168c9.3 9.4 9.3 24.6 0 34zM192 436v-40c0-6.6-5.4-12-12-12H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h84c6.6 0 12-5.4 12-12V76c0-6.
16-5.4-12-12-12H96c-53 0-96 43-96 96v192c0 53 43 96 96 96h84c6.6 0 12-5.4 12-12z"},child:[]}]})(e)}var ai="https://live.chatcms.us",rs=typeof window<"u"&&window.VITE_SITE_ID?window.VITE_SITE_ID:"",gu=void 0,_u="SASDk3sc@9falksnch002@",Jt="",yu={"Content-Type":"application/json","X-API-Key":_u},Eo={},li=async(e,t={})=>{const r=ai!==void 0?ai:window.location.origin,n=r.endsWith("/")?r.slice(0,-1):r;let o=e;!e.startsWith("http://")&&!e.startsWith("https://")&&(o=`${n}${e.startsWith("/")?e:`/${e}`}`);const s={...yu,...Eo,...t.headers},i=new AbortController,a=setTimeout(()=>i.abort(),1e4);try{const l=await fetch(o,{...t,headers:s,signal:i.signal});if(clearTimeout(a),!l.ok){const c=await l.json().catch(()=>({})),h=new Error(c.message||`HTTP error! status: ${l.status}`);throw h.response={status:l.status,data:c},h}return{data:await l.json()}}catch(l){throw clearTimeout(a),l}},Yt={get:(e,t={})=>li(e,{method:"GET",...t}),post:(e,t,r={})=>li(e,{method:"POST",body:JSON.stringify(t),...r}),defaults:{headers:{common:{}}}};const wu=()=>{try{const e=window.location.pathname,t=e.split("/").filter(Boolean),r=t.indexOf("streams");if(r!==-1&&t[r+1])return t[r+1];const n=e.match(/live-(\d+)/);if(n&&n[1])return n[1];const o=(e.endsWith("/")?e.slice(0,-1):e).match(/-(\d+)$/);if(o&&o[1])return o[1]}catch(e){console.error("Error parsing URL for match ID",e)}return null},vu=async(e=null)=>{const t=e||gu;if(!t)return null;try{return(await Yt.post(`${Jt}/api/room/register`,{site_id:rs,match_id:t})).data}catch(r){throw console.error("Error registering room:",r),r}},lo=async(e,t=50,r=null)=>{try{let n=`${Jt}/api/message/history/${e}?limit=${t}`;return r&&(n+=`&before=${encodeURIComponent(r)}`),(await Yt.get(n)).data}catch(n){throw console.error("Error fetching history:",n),n}},bu=async(e,t=null)=>{try{let r=`${Jt}/api/site/${e}`;return t&&(r+=`?user_id=${t}`),(await Yt.get(r)).data}catch(r){throw console.error("Error fetching site config:",r),r}},hn=e=>{e?Eo.Authorization=`Bearer ${e}`:delete Eo.Authorization},xu=async e=>{try{return(await Yt.post(`${Jt}/api/auth/login`,{...e,site_id:rs})).data}catch(t){throw console.error("Error logging in:",t),t}},ku=async e=>{try{return(await Yt.post(`${Jt}/api/auth/register`,{...e,site_id:rs})).data}catch(t){throw console.error("Error registering:",t),t}},Su=async()=>{try{return(await Yt.post(`${Jt}/api/auth/logout`)).data}catch(e){throw console.error("Error logging out:",e),e}},Cu=async()=>{try{return(await Yt.get(`${Jt}/api/auth/me`)).data}catch(e){throw console.error("Error fetching current user:",e),e}},Tu=async e=>{try{return(await Yt.post(`${Jt}/api/client/moderation/block`,e)).data}catch(t){throw console.error("Error blocking user:",t),t}},ci=async e=>{try{return(await Yt.post(`${Jt}/api/client/moderation/messages/delete`,{message_ids:e})).data}catch(t){throw console.error("Error deleting messages:",t),t}};var Iu={data:""},Eu=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||Iu};var Au=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Nu=/\/\*[^]*?\*\/|  +/g,ui=/\n+/g,rr=(e,t)=>{let r="",n="",o="";for(let s in e){let i=e[s];s[0]=="@"?s[1]=="i"?r=s+" "+i+";":n+=s[1]=="f"?rr(i,s):s+"{"+rr(i,s[1]=="k"?"":t)+"}":typeof i=="object"?n+=rr(i,t?t.replace(/([^,])+/g,a=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,a):a?a+" "+l:l)):s):i!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=rr.p?rr.p(s,i):s+":"+i+";")}return r+(t&&o?t+"{"+o+"}":o)+n},Ut={},Pa=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+Pa(e[r]);return t}return e},Ru=(e,t,r,n,o)=>{let s=Pa(e),i=Ut[s]||(Ut[s]=(l=>{let c=0,h=11;for(;c<l.length;)h=101*h+l.charCodeAt(c++)>>>0;return"go"+h})(s));if(!Ut[i]){let l=s!==e?e:(c=>{let h,d,f=[{}];for(;h=Au.exec(c.replace(Nu,""));)h[4]?f.shift():h[3]?(d=h[3].replace(ui," ").trim(),f.unshift(f[0][d]=f[0][d]||{})):f[0][h[1]]=h[2].replace(ui," ").trim();return f[0]})(e);Ut[i]=rr(o?{["@keyframes "+i]:l}:l,r?"":"."+i)}let a=r&&Ut.g?Ut.g:null;return r&&(Ut.g=Ut[i]),((l,c,h,d)=>{d?c.data=c.data.replace(d,l):c.data.indexOf(l)===-1&&(c.data=h?l+c.data:c.data+l)})(Ut[i],t,n,a),i},Ou=(e,t,r)=>e.reduce((n,o,s)=>{let i=t[s];if(i&&i.call){let a=i(r),l=a&&a.props&&a.props.className||/^go/.test(a)&&a;i=l?"."+l:a&&typeof a=="object"?a.props?"":rr(a,""):a===!1?"":a}return n+o+(i??"")},"");function jn(e){let t=this||{},r=e.call?e(t.p):e;
1return Ru(r.unshift?r.raw?Ou(r,[].slice.call(arguments,1),t.p):r.reduce((n,o)=>Object.assign(n,o&&o.call?o(t.p):o),{}):r,Eu(t.target),t.g,t.o,t.k)}var za,Ao,No,Om=jn.bind({g:1}),Kt=jn.bind({k:1});function Lu(e,t,r,n){rr.p=t,za=e,Ao=r,No=n}function ir(e,t){let r=this||{};return function(){let n=arguments;function o(s,i){let a=Object.assign({},s),l=a.className||o.className;r.p=Object.assign({theme:Ao&&Ao()},a),r.o=/ *go\d+/.test(l),a.className=jn.apply(r,n)+(l?" "+l:""),t&&(a.ref=i);let c=e;return e[0]&&(c=a.as||e,delete a.as),No&&c[0]&&No(a),za(c,a)}return t?t(o):o}}var Mu=e=>typeof e=="function",Pn=(e,t)=>Mu(e)?e(t):e,Bu=(()=>{let e=0;return()=>(++e).toString()})(),Ha=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Du=20,ns="default",Fa=(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(i=>i.id===t.toast.id?{...i,...t.toast}:i)};case 2:let{toast:n}=t;return Fa(e,{type:e.toasts.find(i=>i.id===n.id)?1:0,toast:n});case 3:let{toastId:o}=t;return{...e,toasts:e.toasts.map(i=>i.id===o||o===void 0?{...i,dismissed:!0,visible:!1}:i)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(i=>i.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let s=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(i=>({...i,pauseDuration:i.pauseDuration+s}))}}},xn=[],Va={toasts:[],pausedAt:void 0,settings:{toastLimit:Du}},Bt={},Ua=(e,t=ns)=>{Bt[t]=Fa(Bt[t]||Va,e),xn.forEach(([r,n])=>{r===t&&n(Bt[t])})},Wa=e=>Object.keys(Bt).forEach(t=>Ua(e,t)),Pu=e=>Object.keys(Bt).find(t=>Bt[t].toasts.some(r=>r.id===e)),qn=(e=ns)=>t=>{Ua(t,e)},zu={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},ja=(e={},t=ns)=>{let[r,n]=ee(Bt[t]||Va),o=me(Bt[t]);xe(()=>(o.current!==Bt[t]&&n(Bt[t]),xn.push([t,n]),()=>{let i=xn.findIndex(([a])=>a===t);i>-1&&xn.splice(i,1)}),[t]);let s=r.toasts.map(i=>{var a,l,c;return{...e,...e[i.type],...i,removeDelay:i.removeDelay||((a=e[i.type])==null?void 0:a.removeDelay)||e?.removeDelay,duration:i.duration||((l=e[i.type])==null?void 0:l.duration)||e?.duration||zu[i.type],style:{...e.style,...(c=e[i.type])==null?void 0:c.style,...i.style}}});return{...r,toasts:s}},Hu=(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?.id||Bu()}),tn=e=>(t,r)=>{let n=Hu(t,e,r);return qn(n.toasterId||Pu(n.id))({type:2,toast:n}),n.id},st=(e,t)=>tn("blank")(e,t);st.error=tn("error");st.success=tn("success");st.loading=tn("loading");st.custom=tn("custom");st.dismiss=(e,t)=>{let r={type:3,toastId:e};t?qn(t)(r):Wa(r)};st.dismissAll=e=>st.dismiss(void 0,e);st.remove=(e,t)=>{let r={type:4,toastId:e};t?qn(t)(r):Wa(r)};st.removeAll=e=>st.remove(void 0,e);st.promise=(e,t,r)=>{let n=st.loading(t.loading,{...r,...r?.loading});return typeof e=="function"&&(e=e()),e.then(o=>{let s=t.success?Pn(t.success,o):void 0;return s?st.success(s,{id:n,...r,...r?.success}):st.dismiss(n),o}).catch(o=>{let s=t.error?Pn(t.error,o):void 0;s?st.error(s,{id:n,...r,...r?.error}):st.dismiss(n)}),e};var Fu=1e3,Vu=(e,t="default")=>{let{toasts:r,pausedAt:n}=ja(e,t),o=me(new Map).current,s=Ee((d,f=Fu)=>{if(o.has(d))return;let p=setTimeout(()=>{o.delete(d),i({type:4,toastId:d})},f);o.set(d,p)},[]);xe(()=>{if(n)return;let d=Date.now(),f=r.map(p=>{if(p.duration===1/0)return;let _=(p.duration||0)+p.pauseDuration-(d-p.createdAt);if(_<0){p.visible&&st.dismiss(p.id);return}return setTimeout(()=>st.dismiss(p.id,t),_)});return()=>{f.forEach(p=>p&&clearTimeout(p))}},[r,n,t]);let i=Ee(qn(t),[t]),a=Ee(()=>{i({type:5,time:Date.now()})},[i]),l=Ee((d,f)=>{i({type:1,toast:{id:d,height:f}})},[i]),c=Ee(()=>{n&&i({type:6,time:Date.now()})},[n,i]),h=Ee((d,f)=>{let{reverseOrder:p=!1,gutter:_=8,defaultPosition:w}=f||{},v=r.filter(x=>(x.position||w)===(d.position||w)&&x.height),m=v.findIndex(x=>x.id===d.id),g=v.filter((x,O)=>O<m&&x.visible).length;return v.filter(x=>
1x.visible).slice(...p?[g+1]:[0,g]).reduce((x,O)=>x+(O.height||0)+_,0)},[r]);return xe(()=>{r.forEach(d=>{if(d.dismissed)s(d.id,d.removeDelay);else{let f=o.get(d.id);f&&(clearTimeout(f),o.delete(d.id))}})},[r,s]),{toasts:r,handlers:{updateHeight:l,startPause:a,endPause:c,calculateOffset:h}}},Uu=Kt`
2from {
3  transform: scale(0) rotate(45deg);
4	opacity: 0;
5}
6to {
7 transform: scale(1) rotate(45deg);
8  opacity: 1;
9}`,Wu=Kt`
10from {
11  transform: scale(0);
12  opacity: 0;
13}
14to {
15  transform: scale(1);
16  opacity: 1;
17}`,ju=Kt`
18from {
19  transform: scale(0) rotate(90deg);
20	opacity: 0;
21}
22to {
23  transform: scale(1) rotate(90deg);
24	opacity: 1;
25}`,qu=ir("div")`
26  width: 20px;
27  opacity: 0;
28  height: 20px;
29  border-radius: 10px;
30  background: ${e=>e.primary||"#ff4b4b"};
31  position: relative;
32  transform: rotate(45deg);
33
34  animation: ${Uu} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
35    forwards;
36  animation-delay: 100ms;
37
38  &:after,
39  &:before {
40    content: '';
41    animation: ${Wu} 0.15s ease-out forwards;
42    animation-delay: 150ms;
43    position: absolute;
44    border-radius: 3px;
45    opacity: 0;
46    background: ${e=>e.secondary||"#fff"};
47    bottom: 9px;
48    left: 4px;
49    height: 2px;
50    width: 12px;
51  }
52
53  &:before {
54    animation: ${ju} 0.15s ease-out forwards;
55    animation-delay: 180ms;
56    transform: rotate(90deg);
57  }
58`,Gu=Kt`
59  from {
60    transform: rotate(0deg);
61  }
62  to {
63    transform: rotate(360deg);
64  }
65`,Ku=ir("div")`
66  width: 12px;
67  height: 12px;
68  box-sizing: border-box;
69  border: 2px solid;
70  border-radius: 100%;
71  border-color: ${e=>e.secondary||"#e0e0e0"};
72  border-right-color: ${e=>e.primary||"#616161"};
73  animation: ${Gu} 1s linear infinite;
74`,Ju=Kt`
75from {
76  transform: scale(0) rotate(45deg);
77	opacity: 0;
78}
79to {
80  transform: scale(1) rotate(45deg);
81	opacity: 1;
82}`,Yu=Kt`
830% {
84	height: 0;
85	width: 0;
86	opacity: 0;
87}
8840% {
89  height: 0;
90	width: 6px;
91	opacity: 1;
92}
93100% {
94  opacity: 1;
95  height: 10px;
96}`,Xu=ir("div")`
97  width: 20px;
98  opacity: 0;
99  height: 20px;
100  border-radius: 10px;
101  background: ${e=>e.primary||"#61d345"};
102  position: relative;
103  transform: rotate(45deg);
104
105  animation: ${Ju} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
106    forwards;
107  animation-delay: 100ms;
108  &:after {
109    content: '';
110    box-sizing: border-box;
111    animation: ${Yu} 0.2s ease-out forwards;
112    opacity: 0;
113    animation-delay: 200ms;
114    position: absolute;
115    border-right: 2px solid;
116    border-bottom: 2px solid;
117    border-color: ${e=>e.secondary||"#fff"};
118    bottom: 6px;
119    left: 6px;
120    height: 10px;
121    width: 6px;
122  }
123`,Zu=ir("div")`
124  position: absolute;
125`,Qu=ir("div")`
126  position: relative;
127  display: flex;
128  justify-content: center;
129  align-items: center;
130  min-width: 20px;
131  min-height: 20px;
132`,$u=Kt`
133from {
134  transform: scale(0.6);
135  opacity: 0.4;
136}
137to {
138  transform: scale(1);
139  opacity: 1;
140}`,ed=ir("div")`
141  position: relative;
142  transform: scale(0.6);
143  opacity: 0.4;
144  min-width: 20px;
145  animation: ${$u} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
146    forwards;
147`,td=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Ie(ed,null,t):t:r==="blank"?null:Ie(Qu,null,Ie(Ku,{...n}),r!=="loading"&&Ie(Zu,null,r==="error"?Ie(qu,{...n}):Ie(Xu,{...n})))},rd=e=>`
1480% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;}
149100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
150`,nd=e=>`
1510% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
152100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;}
153`,od="0%{opacity:0;} 100%{opacity:1;}",sd="0%{opacity:1;} 100%{opacity:0;}",id=ir("div")`
154  display: flex;
155  align-items: center;
156  background: #fff;
157  color: #363636;
158  line-height: 1.3;
159  will-change: transform;
160  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
161  max-width: 350px;
162  pointer-events: auto;
163  padding: 8px 10px;
164  border-radius: 8px;
165`,ad=ir("div")`
166  display: flex;
167  justify-content: center;
168  margin: 4px 10px;
169  color: inherit;
170  flex: 1 1 auto;
171  white-space: pre-line;
172`,ld=(e,t)=>{let r=e.includes("top")?1:-1,[n,o]=Ha()?[od,sd]:[rd(r),nd(r)];return{animation:t?`${Kt(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${Kt(o)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},cd=Ia(({toast:e,position:t,style:r,children:n})=>{let o=e.height?ld(e.position||t||"top-center",e.visible):{opacity:0},s=Ie(td,{toast:e}),i=Ie(ad,{...e.ariaProps},Pn(e.message,e));return Ie(id,{className:e.className,style:{...o,...r,...e.style}},typeof n=="function"?n({icon:s,message:i}):Ie(ct,null,s,i))});Lu(Ie);var ud=({id:e,className:t,style:r,onHeightUpdate:n,children:o})=>{let s=Ee(i=>{if(i){let a=()=>{let l=i.getBoundingClientRect().height;n(e,l)};a(),new MutationObserver(a).observe(i,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Ie("div",{ref:s,className:t,style:r},o)},dd=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},o=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Ha()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...o}},hd=jn`
173  z-index: 9999;
174  > * {
175    pointer-events: auto;
176  }
177`,fn=16,fd=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:o,toasterId:s,containerStyle:i,containerClassName:a})=>{let{toasts:l,handlers:c}=Vu(r,s);return Ie("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:fn,left:fn,right:fn,bottom:fn,pointerEvents:"none",...i},className:a,onMouseEnter:c.startPause,onMouseLeave:c.endPause},l.map(h=>{let d=h.position||t,f=dd(d,c.calculateOffset(h,{reverseOrder:e,gutter:n,defaultPosition:t}));return Ie(ud,{id:h.id,key:h.id,onHeightUpdate:c.updateHeight,className:h.visible?hd:"",style:f},h.type==="custom"?Pn(h.message,h):o?o(h):Ie(cd,{toast:h,position:d}))}))},Oe=st;var pd=0;function u(e,t,r,n,o,s){t||(t={});var i,a,l=t;if("ref"in l)for(a in l={},t)a=="ref"?i=t[a]:l[a]=t[a];var c={type:e,props:l,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--pd,__i:-1,__u:0,__source:o,__self:s};if(typeof e=="function"&&(i=e.defaultProps))for(a in i)l[a]===void 0&&(l[a]=i[a]);return _e.vnode&&_e.vnode(c),c}var Wt="chat_user_info",Ar="chat_auth_token",qa=Un(null);const md=({children:e})=>{const[t,r]=ee(null),[n,o]=ee(!0);xe(()=>{(async()=>{const d=localStorage.getItem(Wt),f=localStorage.getItem(Ar);if(f&&hn(f),d)try{r(JSON.parse(d))}catch{console.error("Invalid user data in localStorage"),localStorage.removeItem(Wt),localStorage.removeItem(Ar)}if(f)try{const p=await Cu();p&&p.user&&(localStorage.setItem(Wt,JSON.stringify(p.user)),r(p.user))}catch(p){console.error("Failed to verify stored token with server:",p),(p.response?.status===401||p.response?.status===403)&&(localStorage.removeItem(Wt),localStorage.removeItem(Ar),r(null),hn(null))}o(!1)})()},[]);const c={user:t,loading:n,login:async(h,d=!0)=>{try{const f=await xu(h);f.token&&(localStorage.setItem(Ar,f.token),hn(f.token));let p=f.user;if(typeof p=="string")try{p=JSON.parse(p)}catch{p={username:p,displayName:p}}return!p.displayName&&p.username&&(p.displayName=p.username),localStorage.setItem(Wt,JSON.stringify(p)),r(p),d&&Oe.success("Đăng nhập thành công!"),p}catch(f){if(f.response?.data?.error?.code==="AUTH_INVALID_CREDENTIALS")throw Oe.error("Sai tên đăng nhập hoặc mật khẩu"),f;const p=f.response?.data?.error?.message||"Đăng nhập thất bại";throw Oe.error(p),f}},register:async h=>{try{const d=t?.isAnonymous?t.uid:void 0;return await ku({...h,anonymous_id:d}),Oe.success("Đăng ký thành công!"),!0}catch(d){const f=d.response?.data?.error?.message||"Đăng ký thất bại";throw console.error(f),Oe.error(f),d}},loginAsAnonymous:h=>{if(!h.trim())return;const d={uid:"anon_"+Date.now()+Math.random().toString(36).substr(2,9),displayName:h,isAnonymous:!0,role:"level_0",photoURL:`https://ui-avatars.com/api/?name=${encodeURIComponent(h)}&background=random`};localStorage.setItem(Wt,JSON.stringify(d)),r(d)},logout:async(h=!1)=>{try{await Su()}catch(d){console.error("Logout failed",d)}localStorage.removeItem(Wt),localStorage.removeItem(Ar),hn(null),r(null),h||Oe.success("Đã đăng xuất")},updateUserBlockStatus:Ee(h=>{if(!t)return;const d={...t,isBlocked:h};localStorage.setItem(Wt,JSON.stringify(d)),r(d)},[t]),updateUserRole:Ee(h=>{r(d=>{if(!d)return null;const f={...d,role:h};return localStorage.setItem(Wt,JSON.stringify(f)),f})},[])};return u(qa.Provider,{value:c,children:e})},gd=()=>en(qa),os=()=>gd();var zt=Object.create(null);zt.open="0";zt.close="1";zt.ping="2";zt.pong="3";zt.message="4";zt.upgrade="5";zt.noop="6";var kn=Object.create(null);
vendor: 41,267 bytes, line 177
177Object.keys(zt).forEach(e=>{kn[zt[e]]=e});var Ro={type:"error",data:"parser error"},Ga=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Ka=typeof ArrayBuffer=="function",Ja=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,ss=({type:e,data:t},r,n)=>Ga&&t instanceof Blob?r?n(t):di(t,n):Ka&&(t instanceof ArrayBuffer||Ja(t))?r?n(t):di(new Blob([t]),n):n(zt[e]+(t||"")),di=(e,t)=>{const r=new FileReader;return r.onload=function(){const n=r.result.split(",")[1];t("b"+(n||""))},r.readAsDataURL(e)};function hi(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var co;function _d(e,t){if(Ga&&e.data instanceof Blob)return e.data.arrayBuffer().then(hi).then(t);if(Ka&&(e.data instanceof ArrayBuffer||Ja(e.data)))return t(hi(e.data));ss(e,!1,r=>{co||(co=new TextEncoder),t(co.encode(r))})}var yd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<64;e++)Lr[yd.charCodeAt(e)]=e;const wd=e=>{let t=e.length*.75,r=e.length,n,o=0,s,i,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),h=new Uint8Array(c);for(n=0;n<r;n+=4)s=Lr[e.charCodeAt(n)],i=Lr[e.charCodeAt(n+1)],a=Lr[e.charCodeAt(n+2)],l=Lr[e.charCodeAt(n+3)],h[o++]=s<<2|i>>4,h[o++]=(i&15)<<4|a>>2,h[o++]=(a&3)<<6|l&63;return c};var vd=typeof ArrayBuffer=="function";const is=(e,t)=>{if(typeof e!="string")return{type:"message",data:Ya(e,t)};const r=e.charAt(0);return r==="b"?{type:"message",data:bd(e.substring(1),t)}:kn[r]?e.length>1?{type:kn[r],data:e.substring(1)}:{type:kn[r]}:Ro};var bd=(e,t)=>vd?Ya(wd(e),t):{base64:!0,data:e},Ya=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Xa="�",xd=(e,t)=>{const r=e.length,n=new Array(r);let o=0;e.forEach((s,i)=>{ss(s,!1,a=>{n[i]=a,++o===r&&t(n.join(Xa))})})},kd=(e,t)=>{const r=e.split(Xa),n=[];for(let o=0;o<r.length;o++){const s=is(r[o],t);if(n.push(s),s.type==="error")break}return n};function Sd(){return new TransformStream({transform(e,t){_d(e,r=>{const n=r.length;let o;if(n<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,n);else if(n<65536){o=new Uint8Array(3);const s=new DataView(o.buffer);s.setUint8(0,126),s.setUint16(1,n)}else{o=new Uint8Array(9);const s=new DataView(o.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(n))}e.data&&typeof e.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(r)})}})}var uo;function pn(e){return e.reduce((t,r)=>t+r.length,0)}function mn(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let n=0;for(let o=0;o<t;o++)r[o]=e[0][n++],n===e[0].length&&(e.shift(),n=0);return e.length&&n<e[0].length&&(e[0]=e[0].slice(n)),r}function Cd(e,t){uo||(uo=new TextDecoder);const r=[];let n=0,o=-1,s=!1;return new TransformStream({transform(i,a){for(r.push(i);;){if(n===0){if(pn(r)<1)break;const l=mn(r,1);s=(l[0]&128)===128,o=l[0]&127,o<126?n=3:o===126?n=1:n=2}else if(n===1){if(pn(r)<2)break;const l=mn(r,2);o=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),n=3}else if(n===2){if(pn(r)<8)break;const l=mn(r,8),c=new DataView(l.buffer,l.byteOffset,l.length),h=c.getUint32(0);if(h>Math.pow(2,21)-1){a.enqueue(Ro);break}o=h*Math.pow(2,32)+c.getUint32(4),n=3}else{if(pn(r)<o)break;const l=mn(r,o);a.enqueue(is(s?l:uo.decode(l),t)),n=0}if(o===0||o>e){a.enqueue(Ro);break}}}})}function rt(e){if(e)return Td(e)}function Td(e){for(var t in rt.prototype)e[t]=rt.prototype[t];return e}rt.prototype.on=rt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};rt.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this};rt.prototype.off=rt.prototype.removeListener=rt.prototype.removeAllListeners=rt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===t||n.fn===t){r.splice(o,1);break}return r.length===0&&delete this._callbacks["$"+e],this};rt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,o=r.length;n<o;++n)r[n].apply(this,t)}return this};rt.prototype.emitReserved=rt.prototype.emit;rt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};rt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Gn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),vt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Id="arraybuffer";function Za(e,...t){return t.reduce((r,n)=>(e.hasOwnProperty(n)&&(r[n]=e[n]),r),{})}var Ed=vt.setTimeout,Ad=vt.clearTimeout;function Kn(e,t){t.useNativeTimers?(e.setTimeoutFn=Ed.bind(vt),e.clearTimeoutFn=Ad.bind(vt)):(e.setTimeoutFn=vt.setTimeout.bind(vt),e.clearTimeoutFn=vt.clearTimeout.bind(vt))}var Nd=1.33;function Rd(e){return typeof e=="string"?Od(e):Math.ceil((e.byteLength||e.size)*Nd)}function Od(e){let t=0,r=0;for(let n=0,o=e.length;n<o;n++)t=e.charCodeAt(n),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(n++,r+=4);return r}function Qa(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ld(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}function Md(e){let t={},r=e.split("&");for(let n=0,o=r.length;n<o;n++){let s=r[n].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}var Bd=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},as=class extends rt{constructor(e){super(),this.writable=!1,Kn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,r){return super.emitReserved("error",new Bd(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=is(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=Ld(e);return t.length?"?"+t:""}},Dd=class extends as{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||t()})),this.writable||(r++,this.once("drain",function(){--r||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};kd(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,xd(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Qa()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},$a=!1;try{$a=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Pd=$a;function zd(){}var Hd=class extends Dd{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let r=location.port;r||(r=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(n,o)=>{this.onError("xhr post error",n,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}},_r=class Sn extends rt{constructor(t,r,n){super(),this.createRequest=t,Kn(this,n),this._opts=n,this._method=n.method||"GET",this._uri=r,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var t;const r=Za(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(r);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&n.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var o;n.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Sn.requestsCount++,Sn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=zd,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Sn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};_r.requestsCount=0;_r.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",fi);else if(typeof addEventListener=="function"){const e="onpagehide"in vt?"pagehide":"unload";addEventListener(e,fi,!1)}}function fi(){for(let e in _r.requests)_r.requests.hasOwnProperty(e)&&_r.requests[e].abort()}var Fd=(function(){const e=el({xdomain:!1});return e&&e.responseType!==null})(),Vd=class extends Hd{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Fd&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new _r(el,this.uri(),e)}};function el(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Pd))return new XMLHttpRequest}catch{}if(!t)try{return new vt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var tl=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Ud=class extends as{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,r=tl?{}:Za(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,r)}catch(n){return this.emitReserved("error",n)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],n=t===e.length-1;ss(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}n&&Gn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Qa()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},ho=vt.WebSocket||vt.MozWebSocket,Wd=class extends Ud{createSocket(e,t,r){return tl?new ho(e,t,r):t?new ho(e,t):new ho(e)}doWrite(e,t){this.ws.send(t)}},jd=class extends as{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Cd(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),n=Sd();n.readable.pipeTo(e.writable),this._writer=n.writable.getWriter();const o=()=>{r.read().then(({done:i,value:a})=>{i||(this.onPacket(a),o())}).catch(i=>{})};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],n=t===e.length-1;this._writer.write(r).then(()=>{n&&Gn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};const qd={websocket:Wd,webtransport:jd,polling:Vd};var Gd=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Kd=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Oo(e){if(e.length>8e3)throw"URI too long";const t=e,r=e.indexOf("["),n=e.indexOf("]");r!=-1&&n!=-1&&(e=e.substring(0,r)+e.substring(r,n).replace(/:/g,";")+e.substring(n,e.length));let o=Gd.exec(e||""),s={},i=14;for(;i--;)s[Kd[i]]=o[i]||"";return r!=-1&&n!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=Jd(s,s.path),s.queryKey=Yd(s,s.query),s}function Jd(e,t){const r=t.replace(/\/{2,9}/g,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Yd(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,o,s){o&&(r[o]=s)}),r}var Lo=typeof addEventListener=="function"&&typeof removeEventListener=="function",Cn=[];Lo&&addEventListener("offline",()=>{Cn.forEach(e=>e())},!1);var Tn=class In extends rt{constructor(t,r){if(super(),this.binaryType=Id,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(r=t,t=null),t){const n=Oo(t);r.hostname=n.host,r.secure=n.protocol==="https"||n.protocol==="wss",r.port=n.port,n.query&&(r.query=n.query)}else r.host&&(r.hostname=Oo(r.host).host);Kn(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(n=>{const o=n.prototype.name;this.transports.push(o),this._transportsByName[o]=n}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Md(this.opts.query)),Lo&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Cn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const r=Object.assign({},this.opts.query);r.EIO=4,r.transport=t,this.id&&(r.sid=this.id);const n=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&In.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(t);r.open(),this.setTransport(r)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",In.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=t.data,this._onError(r);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){const n=this.writeBuffer[r].data;if(n&&(t+=Rd(n)),r>0&&t>this._maxPayload)return this.writeBuffer.slice(0,r);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Gn(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,r,n){return this._sendPacket("message",t,r,n),this}send(t,r,n){return this._sendPacket("message",t,r,n),this}_sendPacket(t,r,n,o){if(typeof r=="function"&&(o=r,r=void 0),typeof n=="function"&&(o=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const s={type:t,data:r,options:n};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),t()},n=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():t()}):this.upgrading?n():t()),this}_onError(t){if(In.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Lo&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=Cn.indexOf(this._offlineEventListener);n!==-1&&Cn.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,r),this.writeBuffer=[],this._prevBufferLen=0}}};Tn.protocol=4;var Xd=class extends Tn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),r=!1;Tn.priorWebsocketSuccess=!1;const n=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Tn.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function o(){r||(r=!0,c(),t.close(),t=null)}const s=h=>{const d=new Error("probe error: "+h);d.transport=t.name,o(),this.emitReserved("upgradeError",d)};function i(){s("transport closed")}function a(){s("socket closed")}function l(h){t&&h.name!==t.name&&o()}const c=()=>{t.removeListener("open",n),t.removeListener("error",s),t.removeListener("close",i),this.off("close",a),this.off("upgrading",l)};t.once("open",n),t.once("error",s),t.once("close",i),this.once("close",a),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}},rl=class extends Xd{constructor(e,t={}){const r=typeof e=="object"?e:t;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(n=>qd[n]).filter(n=>!!n)),super(e,r)}};const Lm=rl.protocol;function Zd(e,t="",r){let n=e;r=r||typeof location<"u"&&location,e==null&&(e=r.protocol+"//"+r.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=r.protocol+e:e=r.host+e),/^(https?|wss?):\/\//.test(e)||(typeof r<"u"?e=r.protocol+"//"+e:e="https://"+e),n=Oo(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const o=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port+t,n.href=n.protocol+"://"+o+(r&&r.port===n.port?"":":"+n.port),n}var Qd=typeof ArrayBuffer=="function",$d=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,nl=Object.prototype.toString,eh=typeof Blob=="function"||typeof Blob<"u"&&nl.call(Blob)==="[object BlobConstructor]",th=typeof File=="function"||typeof File<"u"&&nl.call(File)==="[object FileConstructor]";function ls(e){return Qd&&(e instanceof ArrayBuffer||$d(e))||eh&&e instanceof Blob||th&&e instanceof File}function En(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let r=0,n=e.length;r<n;r++)if(En(e[r]))return!0;return!1}if(ls(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return En(e.toJSON(),!0);for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&En(e[r]))return!0;return!1}function rh(e){const t=[],r=e.data,n=e;return n.data=Mo(r,t),n.attachments=t.length,{packet:n,buffers:t}}function Mo(e,t){if(!e)return e;if(ls(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}else if(Array.isArray(e)){const r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=Mo(e[n],t);return r}else if(typeof e=="object"&&!(e instanceof Date)){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=Mo(e[n],t));return r}return e}function nh(e,t){return e.data=Bo(e.data,t),delete e.attachments,e}function Bo(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=Bo(e[r],t);else if(typeof e=="object")for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=Bo(e[r],t));return e}var oh=uc({Decoder:()=>ah,Encoder:()=>ih,PacketType:()=>ke,protocol:()=>5}),sh=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ke;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(ke||(ke={}));var ih=class{constructor(e){this.replacer=e}encode(e){return(e.type===ke.EVENT||e.type===ke.ACK)&&En(e)?this.encodeAsBinary({type:e.type===ke.EVENT?ke.BINARY_EVENT:ke.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ke.BINARY_EVENT||e.type===ke.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=rh(e),r=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(r),n}};function pi(e){return Object.prototype.toString.call(e)==="[object Object]"}var ah=class ol extends rt{constructor(t){super(),this.reviver=t}add(t){let r;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);const n=r.type===ke.BINARY_EVENT;n||r.type===ke.BINARY_ACK?(r.type=n?ke.EVENT:ke.ACK,this.reconstructor=new lh(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(ls(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0;const n={type:Number(t.charAt(0))};if(ke[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===ke.BINARY_EVENT||n.type===ke.BINARY_ACK){const s=r+1;for(;t.charAt(++r)!=="-"&&r!=t.length;);const i=t.substring(s,r);if(i!=Number(i)||t.charAt(r)!=="-")throw new Error("Illegal attachments");n.attachments=Number(i)}if(t.charAt(r+1)==="/"){const s=r+1;for(;++r&&!(t.charAt(r)===","||r===t.length););n.nsp=t.substring(s,r)}else n.nsp="/";const o=t.charAt(r+1);if(o!==""&&Number(o)==o){const s=r+1;for(;++r;){const i=t.charAt(r);if(i==null||Number(i)!=i){--r;break}if(r===t.length)break}n.id=Number(t.substring(s,r+1))}if(t.charAt(++r)){const s=this.tryParse(t.substr(r));if(ol.isPayloadValid(n.type,s))n.data=s;else throw new Error("invalid payload")}return n}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,r){switch(t){case ke.CONNECT:return pi(r);case ke.DISCONNECT:return r===void 0;case ke.CONNECT_ERROR:return typeof r=="string"||pi(r);case ke.EVENT:case ke.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&sh.indexOf(r[0])===-1);case ke.ACK:case ke.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},lh=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=nh(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function kt(e,t,r){return e.on(t,r),function(){e.off(t,r)}}var ch=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),sl=class extends rt{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[kt(e,"open",this.onopen.bind(this)),kt(e,"packet",this.onpacket.bind(this)),kt(e,"error",this.onerror.bind(this)),kt(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var r,n,o;if(ch.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:ke.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const l=this.ids++,c=t.pop();this._registerAckCallback(l,c),s.id=l}const i=(n=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||n===void 0?void 0:n.writable,a=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!i||(a?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var r;const n=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let i=0;i<this.sendBuffer.length;i++)this.sendBuffer[i].id===e&&this.sendBuffer.splice(i,1);t.call(this,new Error("operation has timed out"))},n),s=(...i)=>{this.io.clearTimeoutFn(o),t.apply(this,i)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((r,n)=>{const o=(s,i)=>s?n(s):r(i);o.withError=!0,t.push(o),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((n,...o)=>(this._queue[0],n!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(n)):(this._queue.shift(),t&&t(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ke.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ke.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ke.EVENT:case ke.BINARY_EVENT:this.onevent(e);break;case ke.ACK:case ke.BINARY_ACK:this.onack(e);break;case ke.DISCONNECT:this.ondisconnect();break;case ke.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let r=!1;return function(...n){r||(r=!0,t.packet({type:ke.ACK,id:e,data:n}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ke.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const r of t)r.apply(this,e.data)}}};function Sr(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Sr.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-r:e+r}return Math.min(e,this.max)|0};Sr.prototype.reset=function(){this.attempts=0};Sr.prototype.setMin=function(e){this.ms=e};Sr.prototype.setMax=function(e){this.max=e};Sr.prototype.setJitter=function(e){this.jitter=e};var Do=class extends rt{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,Kn(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Sr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const n=t.parser||oh;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new rl(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const n=kt(t,"open",function(){r.onopen(),e&&e()}),o=i=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",i),e?e(i):this.maybeReconnectOnOpen()},s=kt(t,"error",o);if(this._timeout!==!1){const i=this._timeout,a=this.setTimeoutFn(()=>{n(),o(new Error("timeout")),t.close()},i);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(n),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(kt(e,"ping",this.onping.bind(this)),kt(e,"data",this.ondata.bind(this)),kt(e,"error",this.onerror.bind(this)),kt(e,"close",this.onclose.bind(this)),kt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Gn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new sl(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const r of t)if(this.nsps[r].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(n=>{n?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}},Nr={};function An(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const r=Zd(e,t.path||"/socket.io"),n=r.source,o=r.id,s=r.path,i=Nr[o]&&s in Nr[o].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||i;let l;return a?l=new Do(n,t):(Nr[o]||(Nr[o]=new Do(n,t)),l=Nr[o]),r.query&&!t.query&&(t.query=r.queryKey),l.socket(r.path,t)}Object.assign(An,{Manager:Do,Socket:sl,io:An,connect:An});var uh=Zr({
vendor: 3,110 bytes, line 177
177"node_modules/notepack.io/browser/encode.js":((e,t)=>{function r(i,a,l){for(var c=0,h=0,d=l.length;h<d;h++)c=l.charCodeAt(h),c<128?i.setUint8(a++,c):c<2048?(i.setUint8(a++,192|c>>6),i.setUint8(a++,128|c&63)):c<55296||c>=57344?(i.setUint8(a++,224|c>>12),i.setUint8(a++,128|c>>6&63),i.setUint8(a++,128|c&63)):(h++,c=65536+((c&1023)<<10|l.charCodeAt(h)&1023),i.setUint8(a++,240|c>>18),i.setUint8(a++,128|c>>12&63),i.setUint8(a++,128|c>>6&63),i.setUint8(a++,128|c&63))}function n(i){for(var a=0,l=0,c=0,h=i.length;c<h;c++)a=i.charCodeAt(c),a<128?l+=1:a<2048?l+=2:a<55296||a>=57344?l+=3:(c++,l+=4);return l}function o(i,a,l){var c=typeof l,h=0,d=0,f=0,p=0,_=0,w=0;if(c==="string"){if(_=n(l),_<32)i.push(_|160),w=1;else if(_<256)i.push(217,_),w=2;else if(_<65536)i.push(218,_>>8,_),w=3;else if(_<4294967296)i.push(219,_>>24,_>>16,_>>8,_),w=5;else throw new Error("String too long");return a.push({_str:l,_length:_,_offset:i.length}),w+_}if(c==="number")return Math.floor(l)!==l||!isFinite(l)?(i.push(203),a.push({_float:l,_length:8,_offset:i.length}),9):l>=0?l<128?(i.push(l),1):l<256?(i.push(204,l),2):l<65536?(i.push(205,l>>8,l),3):l<4294967296?(i.push(206,l>>24,l>>16,l>>8,l),5):(f=l/Math.pow(2,32)>>0,p=l>>>0,i.push(207,f>>24,f>>16,f>>8,f,p>>24,p>>16,p>>8,p),9):l>=-32?(i.push(l),1):l>=-128?(i.push(208,l),2):l>=-32768?(i.push(209,l>>8,l),3):l>=-2147483648?(i.push(210,l>>24,l>>16,l>>8,l),5):(f=Math.floor(l/Math.pow(2,32)),p=l>>>0,i.push(211,f>>24,f>>16,f>>8,f,p>>24,p>>16,p>>8,p),9);if(c==="object"){if(l===null)return i.push(192),1;if(Array.isArray(l)){if(_=l.length,_<16)i.push(_|144),w=1;else if(_<65536)i.push(220,_>>8,_),w=3;else if(_<4294967296)i.push(221,_>>24,_>>16,_>>8,_),w=5;else throw new Error("Array too large");for(h=0;h<_;h++)w+=o(i,a,l[h]);return w}if(l instanceof Date){var v=l.getTime();return f=Math.floor(v/Math.pow(2,32)),p=v>>>0,i.push(215,0,f>>24,f>>16,f>>8,f,p>>24,p>>16,p>>8,p),10}if(l instanceof ArrayBuffer){if(_=l.byteLength,_<256)i.push(196,_),w=2;else if(_<65536)i.push(197,_>>8,_),w=3;else if(_<4294967296)i.push(198,_>>24,_>>16,_>>8,_),w=5;else throw new Error("Buffer too large");return a.push({_bin:l,_length:_,_offset:i.length}),w+_}if(typeof l.toJSON=="function")return o(i,a,l.toJSON());var m=[],g="",x=Object.keys(l);for(h=0,d=x.length;h<d;h++)g=x[h],typeof l[g]!="function"&&m.push(g);if(_=m.length,_<16)i.push(_|128),w=1;else if(_<65536)i.push(222,_>>8,_),w=3;else if(_<4294967296)i.push(223,_>>24,_>>16,_>>8,_),w=5;else throw new Error("Object too large");for(h=0;h<_;h++)g=m[h],w+=o(i,a,g),w+=o(i,a,l[g]);return w}if(c==="boolean")return i.push(l?195:194),1;if(c==="undefined")return i.push(212,0,0),3;throw new Error("Could not encode")}function s(i){var a=[],l=[],c=o(a,l,i),h=new ArrayBuffer(c),d=new DataView(h),f=0,p=0,_=-1;l.length>0&&(_=l[0]._offset);for(var w,v=0,m=0,g=0,x=a.length;g<x;g++)if(d.setUint8(p+g,a[g]),g+1===_){if(w=l[f],v=w._length,m=p+_,w._bin)for(var O=new Uint8Array(w._bin),N=0;N<v;N++)d.setUint8(m+N,O[N]);else w._str?r(d,m,w._str):w._float!==void 0&&d.setFloat64(m,w._float);f++,p+=v,l[f]&&(_=l[f]._offset)}return h}t.exports=s})}),dh=Zr({
vendor: 4,359 bytes, line 177
177"node_modules/notepack.io/browser/decode.js":((e,t)=>{function r(s){if(this._offset=0,s instanceof ArrayBuffer)this._buffer=s,this._view=new DataView(this._buffer);else if(ArrayBuffer.isView(s))this._buffer=s.buffer,this._view=new DataView(this._buffer,s.byteOffset,s.byteLength);else throw new Error("Invalid argument")}function n(s,i,a){for(var l="",c=0,h=i,d=i+a;h<d;h++){var f=s.getUint8(h);if((f&128)===0){l+=String.fromCharCode(f);continue}if((f&224)===192){l+=String.fromCharCode((f&31)<<6|s.getUint8(++h)&63);continue}if((f&240)===224){l+=String.fromCharCode((f&15)<<12|(s.getUint8(++h)&63)<<6|(s.getUint8(++h)&63)<<0);continue}if((f&248)===240){c=(f&7)<<18|(s.getUint8(++h)&63)<<12|(s.getUint8(++h)&63)<<6|(s.getUint8(++h)&63)<<0,c>=65536?(c-=65536,l+=String.fromCharCode((c>>>10)+55296,(c&1023)+56320)):l+=String.fromCharCode(c);continue}throw new Error("Invalid byte "+f.toString(16))}return l}r.prototype._array=function(s){for(var i=new Array(s),a=0;a<s;a++)i[a]=this._parse();return i},r.prototype._map=function(s){for(var i="",a={},l=0;l<s;l++)i=this._parse(),a[i]=this._parse();return a},r.prototype._str=function(s){var i=n(this._view,this._offset,s);return this._offset+=s,i},r.prototype._bin=function(s){var i=this._buffer.slice(this._offset,this._offset+s);return this._offset+=s,i},r.prototype._parse=function(){var s=this._view.getUint8(this._offset++),i,a=0,l=0,c=0,h=0;if(s<192)return s<128?s:s<144?this._map(s&15):s<160?this._array(s&15):this._str(s&31);if(s>223)return(255-s+1)*-1;switch(s){case 192:return null;case 194:return!1;case 195:return!0;case 196:return a=this._view.getUint8(this._offset),this._offset+=1,this._bin(a);case 197:return a=this._view.getUint16(this._offset),this._offset+=2,this._bin(a);case 198:return a=this._view.getUint32(this._offset),this._offset+=4,this._bin(a);case 199:return a=this._view.getUint8(this._offset),l=this._view.getInt8(this._offset+1),this._offset+=2,[l,this._bin(a)];case 200:return a=this._view.getUint16(this._offset),l=this._view.getInt8(this._offset+2),this._offset+=3,[l,this._bin(a)];case 201:return a=this._view.getUint32(this._offset),l=this._view.getInt8(this._offset+4),this._offset+=5,[l,this._bin(a)];case 202:return i=this._view.getFloat32(this._offset),this._offset+=4,i;case 203:return i=this._view.getFloat64(this._offset),this._offset+=8,i;case 204:return i=this._view.getUint8(this._offset),this._offset+=1,i;case 205:return i=this._view.getUint16(this._offset),this._offset+=2,i;case 206:return i=this._view.getUint32(this._offset),this._offset+=4,i;case 207:return c=this._view.getUint32(this._offset)*Math.pow(2,32),h=this._view.getUint32(this._offset+4),this._offset+=8,c+h;case 208:return i=this._view.getInt8(this._offset),this._offset+=1,i;case 209:return i=this._view.getInt16(this._offset),this._offset+=2,i;case 210:return i=this._view.getInt32(this._offset),this._offset+=4,i;case 211:return c=this._view.getInt32(this._offset)*Math.pow(2,32),h=this._view.getUint32(this._offset+4),this._offset+=8,c+h;case 212:if(l=this._view.getInt8(this._offset),this._offset+=1,l===0){this._offset+=1;return}return[l,this._bin(1)];case 213:return l=this._view.getInt8(this._offset),this._offset+=1,[l,this._bin(2)];case 214:return l=this._view.getInt8(this._offset),this._offset+=1,[l,this._bin(4)];case 215:return l=this._view.getInt8(this._offset),this._offset+=1,l===0?(c=this._view.getInt32(this._offset)*Math.pow(2,32),h=this._view.getUint32(this._offset+4),this._offset+=8,new Date(c+h)):[l,this._bin(8)];case 216:return l=this._view.getInt8(this._offset),this._offset+=1,[l,this._bin(16)];case 217:return a=this._view.getUint8(this._offset),this._offset+=1,this._str(a);case 218:return a=this._view.getUint16(this._offset),this._offset+=2,this._str(a);case 219:return a=this._view.getUint32(this._offset),this._offset+=4,this._str(a);case 220:return a=this._view.getUint16(this._offset),this._offset+=2,this._array(a);case 221:return a=this._view.getUint32(this._offset),this._offset+=4,this._array(a);case 222:return a=this._view.getUint16(this._offset),this._offset+=2,this._map(a);case 223:return a=this._view.getUint32(this._offset),this._offset+=4,this._map(a)}throw new Error("Could not parse")};function o(s){var i=new r(s),a=i._parse();if(i._offset!==s.byteLength)throw new Error(s.byteLength-i._offset+" trailing bytes");return a}t.exports=o})}),hh=Zr({
vendor: 84 bytes, line 177
177"node_modules/notepack.io/lib/index.js":(e=>{e.encode=uh(),e.decode=dh()})}),fh=Zr({
vendor: 1,361 bytes, line 177
177"node_modules/component-emitter/index.js":((e,t)=>{typeof t<"u"&&(t.exports=r);function r(o){if(o)return n(o)}function n(o){for(var s in r.prototype)o[s]=r.prototype[s];return o}r.prototype.on=r.prototype.addEventListener=function(o,s){return this._callbacks=this._callbacks||{},(this._callbacks["$"+o]=this._callbacks["$"+o]||[]).push(s),this},r.prototype.once=function(o,s){function i(){this.off(o,i),s.apply(this,arguments)}return i.fn=s,this.on(o,i),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(o,s){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+o];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+o],this;for(var a,l=0;l<i.length;l++)if(a=i[l],a===s||a.fn===s){i.splice(l,1);break}return i.length===0&&delete this._callbacks["$"+o],this},r.prototype.emit=function(o){this._callbacks=this._callbacks||{};for(var s=new Array(arguments.length-1),i=this._callbacks["$"+o],a=1;a<arguments.length;a++)s[a-1]=arguments[a];if(i){i=i.slice(0);for(var a=0,l=i.length;a<l;++a)i[a].apply(this,s)}return this},r.prototype.listeners=function(o){return this._callbacks=this._callbacks||{},this._callbacks["$"+o]||[]},r.prototype.hasListeners=function(o){return!!this.listeners(o).length}})}),ph=Zr({
vendor: 1,112 bytes, line 177
177"node_modules/socket.io-msgpack-parser/index.js":(e=>{var t=hh(),r=fh();e.protocol=5;var n=e.PacketType={CONNECT:0,DISCONNECT:1,EVENT:2,ACK:3,CONNECT_ERROR:4},o=Number.isInteger||function(h){return typeof h=="number"&&isFinite(h)&&Math.floor(h)===h},s=function(h){return typeof h=="string"},i=function(h){return Object.prototype.toString.call(h)==="[object Object]"};function a(){}a.prototype.encode=function(h){return[t.encode(h)]};function l(){}r(l.prototype),l.prototype.add=function(h){var d=t.decode(h);this.checkPacket(d),this.emit("decoded",d)};function c(h){switch(h.type){case n.CONNECT:return h.data===void 0||i(h.data);case n.DISCONNECT:return h.data===void 0;case n.CONNECT_ERROR:return s(h.data)||i(h.data);default:return Array.isArray(h.data)}}l.prototype.checkPacket=function(h){if(!(o(h.type)&&h.type>=n.CONNECT&&h.type<=n.CONNECT_ERROR))throw new Error("invalid packet type");if(!s(h.nsp))throw new Error("invalid namespace");if(!c(h))throw new Error("invalid payload");if(!(h.id===void 0||o(h.id)))throw new Error("invalid packet id")},l.prototype.destroy=function(){},e.Encoder=a,e.Decoder=l})
177}),il=hc(ph(),1),mh="https://live.chatcms.us",gh="SASDk3sc@9falksnch002@",_h="",fo;const yh=(e,t,r)=>{const n=(r||"").trim();return An(e,{parser:il.default,autoConnect:!1,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,randomizationFactor:.5,timeout:1e4,transports:["websocket"],path:n?`${n.replace(/\/$/,"")}/socket.io`:"/socket.io",auth:{token:t,"x-api-key":t},query:{api_key:t}})},Po=()=>(fo||(console.log("Initializing socket with parser:",il.default),fo=yh(mh,gh,_h)),fo);var wh={SOCKET_COOLDOWN:"Vui lòng chờ trước khi gửi tin tiếp theo",SOCKET_SPAM_CONTENT:"Nội dung tin nhắn không hợp lệ",SOCKET_USERNAME_RATE_LIMIT:"Bạn đang gửi tin quá nhanh",SOCKET_RATE_LIMIT_EXCEEDED:"Bạn đã gửi quá nhiều tin nhắn",SOCKET_DUPLICATE_MESSAGE:"Tin nhắn trùng lặp",SOCKET_ANONYMOUS_FLOOD:"Phát hiện hành vi bất thường, vui lòng thử lại sau",SOCKET_LINK_NOT_ALLOWED:"Liên kết không được phép",SOCKET_ANONYMOUS_DISABLED:"Tính năng chat ẩn danh đã bị tắt. Vui lòng đăng nhập để chat."};function mi(e,t){const r=wh[e];return r?t&&(e==="SOCKET_COOLDOWN"||e==="SOCKET_RATE_LIMIT_EXCEEDED")?`${r} (còn ${t}s)`:r:null}const vh=(e,t,r,n,o,s,i=!0,a=null)=>{const[l,c]=ee([]),[h,d]=ee(!1),[f,p]=ee(null),[_,w]=ee(!1),[v,m]=ee(null),[g,x]=ee(!1),[O,N]=ee(!0),[E,S]=ee(null),[I,F]=ee(!!(e&&e.isBlocked)),M=me(null),J=me(0),H=me(new Map),j=me(new Map),P=me(0),Q=me(new Map),$=me(0),le=me(0),oe=me(!1),pe=me(0),ye=me(!1),Me=a?`${a.share_general_room}_${a.shared_group_id}`:"",Be=me(f),Re=me(e),Je=me(r),ut=me(o),Ye=me(n);xe(()=>{Be.current=f,Re.current=e,Je.current=r,ut.current=o,Ye.current=n},[f,e,r,o,n]),xe(()=>{const L=H.current,R=j.current;return()=>{for(const D of L.values())clearTimeout(D);L.clear();for(const D of R.values())clearTimeout(D);R.clear()}},[]);const Xe=Ee(()=>{const L=Be.current,R=Re.current;if(!L)return null;let D=null;if(R)if(R.isAnonymous){try{const G=localStorage.getItem("chat_user_info");G&&(D=JSON.parse(G).displayName)}catch{D=null}D||(D=R.name)}else D=R.name||R.username;const K=typeof window<"u"&&window.VITE_SITE_ID?window.VITE_SITE_ID:"";return{room_id:L,user_id:R?R.user_id||R.uid:null,anonymous_id:R&&R.isAnonymous?R.uid:null,username:R?R.username:null,name:D,role:R?R.role||R.user_role||(R.isAdmin?"admin":null):null,isAdmin:R?R.isAdmin:!1,site_id:K||null,timestamp:new Date().toISOString()}},[]);xe(()=>{const L=M.current;if(!L||!f||!_)return;const R=Xe();R&&L.emit("join_room",R)},[f,_,Xe]);const W=Ee(async L=>{try{const R=(await lo(L)).messages||[],D=R.map(K=>({id:K._id||K.id,text:K.message,sender:K.username,name:K.name,role:K.role,uid:K.user_id,anonymousId:K.anonymous_id,createdAt:K.created_at}));if(D.sort((K,G)=>new Date(K.createdAt)-new Date(G.createdAt)),c(K=>{const G=K.filter(ae=>String(ae.id).startsWith("local_")&&ae.status==="sending"),X=new Set(D.map(ae=>ae.id)),q=G.filter(ae=>!X.has(ae.id)),ie=K.filter(ae=>ae.type==="ad");return[...D,...q,...ie]}),D.length>0){const K=D.reduce((G,X)=>new Date(G.createdAt)<new Date(X.createdAt)?G:X);S(K.createdAt||K.id||null),N(R.length>=50)}else N(!1)}catch(R){console.error("Failed to load chat history:",R),m(R.message||"Failed to load chat")}},[]),ce=Ee(async L=>{if(!L)return!0;const R=Date.now();if(R-J.current<4e3)return!0;J.current=R;try{const D=(await lo(L,30)).messages||[];if(D.length===0)return!0;const K=D.map(G=>({id:G._id||G.id,text:G.message,sender:G.username,name:G.name,role:G.role,uid:G.user_id,anonymousId:G.anonymous_id,createdAt:G.created_at}));K.sort((G,X)=>{const q=new Date(G.createdAt).getTime(),ie=new Date(X.createdAt).getTime();return(isNaN(q)?0:q)-(isNaN(ie)?0:ie)}),c(G=>{let X=G;for(const ie of K)X.some(ae=>String(ae.id)===String(ie.id))||(X=X.filter(ae=>{if(!String(ae.id||"").startsWith("local_"))return!0;const Fe=ae.text===ie.text,y=ae.uid&&ie.uid&&String(ae.uid)===String(ie.uid)||ae.anonymousId&&ie.anonymousId&&String(ae.anonymousId)===String(ie.anonymousId)||ae.sender&&ie.sender&&String(ae.sender)===String(ie.sender);return!(Fe&&y)}),X=[...X,ie]);const q=[...X].sort((ie,ae)=>
177{const Fe=new Date(ie.createdAt).getTime(),y=new Date(ae.createdAt).getTime();return(isNaN(Fe)?0:Fe)-(isNaN(y)?0:y)});return q.length>200?q.slice(q.length-200):q})}catch{return!1}return!0},[]);xe(()=>{(async()=>{if(!t){p(null),c([]);return}d(!0),m(null),c([]);try{const R=await vu(t);if(!R||!R.room_id)throw new Error("No room ID returned from server");const D=R.room_id;p(D),await W(D)}catch(R){console.error("Failed to init chat:",R),m(R.message||"Failed to load chat")}finally{d(!1)}})()},[t,W,Me]),xe(()=>{const L=()=>{pe.current=Date.now()};return window.addEventListener("mousemove",L),window.addEventListener("keydown",L),window.addEventListener("click",L),window.addEventListener("scroll",L),window.addEventListener("touchstart",L),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("keydown",L),window.removeEventListener("click",L),window.removeEventListener("scroll",L),window.removeEventListener("touchstart",L)}},[]),xe(()=>{const L=Po();M.current=L;const R=()=>{console.log("✓ Connected to chat server"),w(!0),m(null),oe.current=!1,$.current=Date.now();const k=Be.current;k&&l.length>0&&ce(k).catch(C=>console.error("Sync failed on connect:",C))},D=()=>{console.log("✗ Disconnected from chat server"),w(!1),oe.current=!1,ye.current=!1},K=k=>{console.error("Connection error:",k),m("Failed to connect to chat server"),w(!1)},G=k=>{if(console.log(`Reconnected after ${k} attempts`),ye.current)return;const C=Xe();C&&(L.emit("join_room",C),C.room_id&&W(C.room_id).catch(A=>console.error("Resync failed:",A)))},X=k=>{$.current=Date.now();const C={id:k._id||k.id||Date.now(),text:k.message,sender:k.username,name:k.name,role:k.role,uid:k.user_id,anonymousId:k.anonymous_id,createdAt:k.created_at};c(A=>{if(A.some(Z=>Z.id===C.id))return A;const V=[...A.filter(Z=>{const se=String(Z.id||"").startsWith("local_"),ue=Z.text===C.text,Ze=Z.uid&&C.uid&&String(Z.uid)===String(C.uid)||Z.anonymousId&&C.anonymousId&&String(Z.anonymousId)===String(C.anonymousId);return!(se&&Z.status!=="failed"&&(Z.status==="sending"||Z.status==="sent")&&ue&&Ze)}),C];return V.length>200?V.slice(V.length-200):V})},q=k=>{const C=k?.data||k,A=C?.code||C?.error?.code,V=C?.message||C?.error?.message;if(A==="SOCKET_BLOCKED_KEYWORD")return;if(A==="SOCKET_ANONYMOUS_DISABLED"){ye.current||(ye.current=!0);return}const Z=mi(A,C?.retryAfter);if(Z){Oe.error(Z);return}V&&Oe.error(V)},ie=k=>{const C=Re.current;if(C){const A=C.user_id||C.uid;if(C.isAnonymous&&k.anonymous_id&&String(k.anonymous_id)===String(C.uid)||!C.isAnonymous&&k.user_id&&String(k.user_id)===String(A)){if(!C.isAnonymous&&Ye.current){Ye.current(!0),Oe.error("Bạn đã bị chặn.");return}F(!0),m("Bạn đã bị chặn chat."),c([]),Je.current&&Je.current(!0);return}}c(A=>A.filter(V=>!(k.user_id&&String(V.uid)===String(k.user_id)||k.anonymous_id&&String(V.anonymousId)===String(k.anonymous_id))))},ae=k=>{const C=Re.current;if(!C)return;const A=C.user_id||C.uid;(C.isAnonymous&&k.anonymous_id&&String(k.anonymous_id)===String(C.uid)||!C.isAnonymous&&k.user_id&&String(k.user_id)===String(A))&&(F(!1),m(null),Je.current&&Je.current(!1))},Fe=k=>{const C=Re.current;if(!C)return;const A=C.user_id||C.uid;!C.isAnonymous&&k.user_id&&String(k.user_id)===String(A)&&k.role&&(ut.current&&ut.current(k.role),c(V=>V.map(Z=>!Z.anonymousId&&String(Z.uid)===String(A)?{...Z,role:k.role}:Z)))},y=k=>{const C=k&&k.message_deleted?k.message_deleted:k;if(!C)return;const A=C.room_id??k?.room_id;if(A&&String(A)!==String(Be.current))return;const V=ue=>{if(ue==null)return"";if(typeof ue=="object"){if(ue.$oid)return String(ue.$oid);if(ue._id)return V(ue._id);if(ue.id)return V(ue.id)}return String(ue)},se=(ue=>{const Ze=new Set;for(const Ge of Array.isArray(ue)?ue:[]){const yt=V(Ge);yt&&Ze.add(yt)}return Ze})(C.ids||C.message_ids||C.messageIds||(C.id?[C.id]:null)||(C.message_id?[C.message_id]:null));c(ue=>ue.filter(Ze=>{const Ge=V(Ze?.id);return!(se.size>0&&se.has(Ge)||C.user_id&&String(Ze.uid)===String(C.user_id)||C.anonymous_id&&String(Ze.anonymousId)===String(C.anonymous_id))}))},b=k=>{k.room_id===Be.current&&(c([]),m("Phòng chat đã bị xóa."),w(!1))},T=k=>{if(String(k.room_id)!==String(Be.current)||!k.user_id&&!k.anonymous_id||typeof document<"u"&&document.visibilityState!=="visible")return;const C=Date.now(),A=k.timestamp?Date.parse(k.timestamp):NaN;if(!isNaN(A)&&A<P.current-1e3)return;const V=Re.current;
177if(V&&!V.isAnonymous&&String(k.user_id)===String(V.user_id||V.uid)||V&&V.isAnonymous&&String(k.anonymous_id)===String(V.uid))return;const Z=(k.user_id?`u_${String(k.user_id)}`:null)||(k.anonymous_id?`a_${String(k.anonymous_id)}`:null)||(k.username?`n_${String(k.username)}`:null)||`x_${String(k.name||"")}`,se=Q.current.get(Z);if(se&&C-se<15e3)return;Q.current.set(Z,C);let ue=k.role;k.isAdmin&&(ue="admin");const Ze={id:`join_${Date.now()}_${Math.random()}`,type:"system_join",text:`${k.name||k.username} vào phòng trò chuyện`,sender:k.name||k.username,role:ue,isAdmin:k.isAdmin,createdAt:k.timestamp||new Date().toISOString(),isSystem:!0};c(Ge=>Ge.some(yt=>yt.type==="system_join"&&yt.sender===(k.name||k.username)&&yt.createdAt===(k.timestamp||Ze.createdAt))?Ge:[...Ge,Ze])};return L.on("connect",R),L.on("disconnect",D),L.on("connect_error",K),L.on("reconnect",G),L.on("receive_message",X),L.on("error",q),L.on("exception",q),L.on("user_blocked",ie),L.on("user_unblocked",ae),L.on("messages_deleted",y),L.on("message_deleted",y),L.on("room_deleted",b),L.on("join_room",T),L.on("user_role_updated",Fe),i&&(L.connected?R():L.connect()),()=>{L.off("connect",R),L.off("disconnect",D),L.off("connect_error",K),L.off("reconnect",G),L.off("receive_message",X),L.off("error",q),L.off("exception",q),L.off("user_blocked",ie),L.off("user_unblocked",ae),L.off("messages_deleted",y),L.off("message_deleted",y),L.off("room_deleted",b),L.off("join_room",T),L.off("user_role_updated",Fe)}},[]),xe(()=>{if(ye.current=!1,!f||!M.current)return;if(!i){const R=M.current;if(R.connected){let D=null;if(e)if(e.isAnonymous){try{const G=localStorage.getItem("chat_user_info");G&&(D=JSON.parse(G).displayName)}catch{}D||(D=e.name)}else D=e.name||e.username;const K={room_id:f,user_id:e?e.user_id||e.uid:null,anonymous_id:e&&e.isAnonymous?e.uid:null,username:e?e.username:null,name:D,timestamp:new Date().toISOString()};R.emit("leave_room",K),R.disconnect()}return}if(!_)return;const L=M.current;if(L.connected){let R=null;if(e)if(e.isAnonymous){try{const K=localStorage.getItem("chat_user_info");K&&(R=JSON.parse(K).displayName)}catch{}R||(R=e.name)}else R=e.name||e.username;const D={room_id:f,user_id:e?e.user_id||e.uid:null,anonymous_id:e&&e.isAnonymous?e.uid:null,username:e?e.username:null,name:R,role:e?e.role||e.user_role||(e.isAdmin?"admin":null):null,isAdmin:e?e.isAdmin:!1,timestamp:new Date().toISOString()};L.emit("join_room",D)}return()=>{if(L.connected){let R=null;if(e)if(e.isAnonymous){try{const K=localStorage.getItem("chat_user_info");K&&(R=JSON.parse(K).displayName)}catch{}R||(R=e.name)}else R=e.name||e.username;const D={room_id:f,user_id:e?e.user_id||e.uid:null,anonymous_id:e&&e.isAnonymous?e.uid:null,username:e?e.username:null,name:R,timestamp:new Date().toISOString()};L.emit("leave_room",D)}}},[f,e,_,i]),xe(()=>{if(typeof window>"u"||typeof document>"u")return;let L=null,R=5e3;const D=5e3,K=6e4,G=1.5,X=async()=>{if(!f||I||!i)return!0;const b=M.current||Po();M.current||(M.current=b);const T=Xe(),k=()=>{if(T&&!ye.current){if(b.connected){b.emit("join_room",T);return}oe.current||(oe.current=!0,b.once("connect",()=>{oe.current=!1,b.emit("join_room",T)}))}},C=Date.now();let A=!0;if(!b.connected)w(!1),k(),b.connect(),A=!1;else if(k(),C-($.current||C)>12e4&&C-le.current>6e4){le.current=C,w(!1);try{b.disconnect()}catch{}k(),b.connect(),A=!1}return A},q=b=>{L&&clearTimeout(L),L=setTimeout(ie,b)},ie=async()=>{if(document.visibilityState==="visible"&&f&&navigator.onLine&&!I&&i){const b=await X(),T=Date.now()-pe.current>6e4?15e3:D;b?R=T:R=Math.max(Math.min(R*G,K),T);const k=R*.1*(Math.random()-.5);q(R+k)}else R=D,q(D)},ae=()=>{if(document.visibilityState==="visible"){P.current=Date.now(),L&&clearTimeout(L),R=D;const b=Be.current;b&&!I&&ce(b).catch(T=>console.error("Sync failed on visibility change:",T)),ie()}},Fe=()=>{L&&clearTimeout(L),R=D;const b=Be.current;b&&!I&&ce(b).catch(T=>console.error("Sync failed on online:",T)),ie()},y=()=>{if(document.visibilityState==="visible"){P.current=Date.now(),L&&clearTimeout(L),R=D;const b=Be.current;b&&!I&&ce(b).catch(T=>console.error("Sync failed on focus:",T)),ie()}};return document.addEventListener("visibilitychange",ae),window.addEventListener("online",Fe),window.addEventListener("focus",y),q(D),()=>{document.removeEventListener("visibilitychange",ae),window.removeEventListener("online",Fe),window.removeEventListener("focus",y),L&&clearTimeout(L)}},[f,I,ce,Xe,i]);const Ce=(()=>{try{return typeof window<"u"&&window.VITE_SITE_ID?window.VITE_SITE_ID:""}catch{return"global"}})();return{messages:l,sendMessage:Ee(L=>{if(I){m("Bạn đã bị chặn chat.");return}if((!M.current||!M.current.connected)&&(console.warn("Socket disconnected, attempting reconnect while sending..."),M.current?.connect()),!L.trim()||!e||!f)return;if(e.role.toLocaleLowerCase().includes("level_")){let G=function(ie){return ie.replace(/[[({]\s*\.\s*[\])}]/g,".").replace(/\s*\bdot\b\s*/gi,".").replace(/,(?=[a-zA-Z]{2,6}\b)/g,".").replace(/\s+/g,"")};const X=/(https?:\/\/)|(www\.)|([-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*))/i,q=G(L);if(!(L.startsWith("[sticker]")||L.startsWith("[gif]"))&&X.test(q)){typeof s=="function"&&s();return}}const R={room_id:f,user_id:e.isAnonymous?null:e.user_id||e.uid,anonymous_id:e.isAnonymous?e.uid:null,username:e.name||e.username||e.displayName,message:L.trim(),site_id:Ce||"global"},D={id:`local_${Date.now()}`,text:R.message,sender:R.username,name:e.name||e.username,role:e.isAdmin?"admin":e.role||e.user_role||"user",uid:R.user_id,anonymousId:R.anonymous_id,createdAt:new Date().toISOString(),status:"sending"};c(G=>{const X=[...G,D];return X.length>200?X.slice(X.length-200):X});const K=window.setTimeout(()=>{H.current.delete(D.id),c(G=>G.map(X=>X.id===D.id&&X.status==="sending"?{...X,status:"failed",errorCode:"SEND_TIMEOUT",errorMessage:"Hết thời gian gửi, vui lòng thử lại"}:X))},12e3);H.current.set(D.id,K),M.current.emit("send_message",R,G=>{const X=H.current.get(D.id);X&&(clearTimeout(X),H.current.delete(D.id));const q=G?.data||G;let ie=!0;if(q==null)ie=!0;else if(typeof q=="boolean")ie=q;else if(typeof q=="string")ie=!0;else if(typeof q=="object"){const A=q.ok===!0||q.success===!0||q.status==="ok"||q.status==="success",V=q?.error?.code,Z=q?.error?.message,se=q?.code,ue=q.ok===!1||q.success===!1||q.status==="error"||!!q.error||!!V||!!Z||!!se&&se!=="SOCKET_BLOCKED_KEYWORD";ie=A?!0:!ue}if(ie){c(se=>se.map(ue=>ue.id===D.id?{...ue,status:"sent"}:ue));const A=500+Math.floor(Math.random()*501),V=$.current,Z=window.setTimeout(()=>{j.current.delete(D.id);const se=Be.current,ue=$.current>V;se&&!ue&&ce(se)},A);j.current.set(D.id,Z);return}const ae=q?.code||q?.error?.code,Fe=q?.retryAfter||q?.error?.retryAfter,y=q?.message||q?.error?.message,b=q?.details?.keyword||q?.keyword,T=mi(ae,Fe),k=!!T,C=T||y||(b?`Lỗi gửi tin nhắn (${b})`:"Gửi tin nhắn thất bại");Oe.error(C),c(A=>A.map(V=>V.id===D.id?{...V,status:k?"spam_blocked":"failed",errorCode:ae||null,errorMessage:C}:V))})},[f,e,I,ce,s,Ce]),loading:h,isConnected:_,error:v,loadMoreHistory:Ee(async()=>
177{if(!(!f||g||!O||I)&&E){x(!0);try{const L=((await lo(f,50,E)).messages||[]).map(R=>({id:R._id||R.id,text:R.message,sender:R.username,name:R.name,role:R.role,uid:R.user_id,anonymousId:R.anonymous_id,createdAt:R.created_at}));if(L.sort((R,D)=>new Date(R.createdAt)-new Date(D.createdAt)),c(R=>[...L.filter(D=>!R.some(K=>K.id===D.id)),...R]),L.length>0){const R=L.reduce((D,K)=>new Date(D.createdAt)<new Date(K.createdAt)?D:K);S(R.createdAt||R.id||E)}else N(!1)}catch{N(!1)}finally{x(!1)}}},[f,g,O,E,I]),historyLoading:g,hasMoreHistory:O,isBlocked:I,addOrReplaceAd:Ee(L=>{const R={id:"__ad__"+(L._id||L.id||Date.now().toString()),type:"ad",ad:L,createdAt:Date.now()};c(D=>{if(D[D.length-1]?.type==="ad"){const K=[...D];return K[K.length-1]=R,K}return[...D,R]})},[])}};var gi=e=>e?._id||e?.id,_i=e=>!e||!Array.isArray(e)?{adsMessageAds:[]}:{adsMessageAds:[...e].sort((t,r)=>(r.priority||0)-(t.priority||0))};const bh=e=>{const t=(e?.start_time_minutes??5)*60*1e3,r=Math.max(e?.run_time_minutes??10,1)*60*1e3,[n,o]=ee([]),[s,i]=ee(0),[a,l]=ee(!1),[c,h]=ee(!1),d=me(null),f=me(!1),p=me(null),_=me(0),w=me(0),v=Ee(()=>{d.current&&(clearInterval(d.current),d.current=null),p.current&&(clearTimeout(p.current),p.current=null)},[]);xe(()=>{f.current=c},[c]),xe(()=>{_.current=s},[s]),xe(()=>{w.current=n.length},[n.length]),xe(()=>{if(a)return n.length>1&&(d.current=setInterval(()=>{f.current||w.current>1&&i(x=>(x+1)%w.current)},r)),()=>{d.current&&(clearInterval(d.current),d.current=null)}},[a,n.length,r]),xe(()=>{if(n.length!==0)return p.current&&(clearTimeout(p.current),p.current=null),l(!1),t===0?l(!0):p.current=setTimeout(()=>{l(!0),p.current=null},t),()=>{p.current&&(clearTimeout(p.current),p.current=null)}},[t,n.length]);const m=Ee(x=>{const{adsMessageAds:O}=_i(x);o(O),i(0)},[]),g=Ee(x=>{const{adsMessageAds:O}=_i(x);o(N=>{const E=gi(N[_.current]),S=E?O.findIndex(I=>gi(I)===E):0;return S>=0?i(S):i(0),O})},[]);return{adsMessageAds:n,currentAdsMessage:a&&n.length>0?n[s]:null,setAds:m,updateAds:g,cleanup:Ee(()=>{v(),o([]),i(0),l(!1)},[v]),isPaused:c,setIsPaused:h}},Ur=e=>(e||"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/đ/g,"d"),zo=(e,t)=>{const r=Ur(e),n=[];for(const o of t||[]){if(!o)continue;const s=cs(o);if(s){s.lastIndex=0,s.exec(e)&&n.push(o);continue}const i=Ur(o);i&&r.includes(i)&&n.push(o)}return n};var yi=e=>/[a-z0-9]/i.test(e||""),cs=e=>{if(typeof e!="string"||!e.startsWith("/"))return null;const t=e.lastIndexOf("/");if(t<=0)return null;const r=e.slice(1,t);let n=e.slice(t+1)||"";n.includes("g")||(n+="g");try{return new RegExp(r,n)}catch{return null}},xh=e=>{const t=[],r=[];for(const n of e||[]){if(!n)continue;const o=cs(n);if(o){r.push(o);continue}const s=`\\b${Ur(n).replace(/\s+/g,"\\s+")}\\b`;t.push(new RegExp(s,"gi"))}return{normRegs:t,rawRegs:r}};const al=(e,t,r="***")=>{if(!e||e.startsWith("[sticker]")||e.startsWith("[gif]"))return e;const{normRegs:n,rawRegs:o}=xh(t||[]);if(!n.length&&!o.length)return e;let s="";const i=[];for(let d=0;d<e.length;d++){const f=e[d],p=Ur(f);for(let _=0;_<p.length;_++)s+=p[_],i.push(d)}const a=[];for(const d of n){let f;for(;(f=d.exec(s))!==null;){const p=f.index,_=p+(f[0]?.length||0),w=s[p-1],v=s[_],m=!yi(w),g=!yi(v);if(m&&g&&_>p){const x=i[p]??0,O=(i[_-1]??e.length-1)+1;a.push([x,O])}d.lastIndex===f.index&&d.lastIndex++}}for(const d of o){let f;for(d.lastIndex=0;(f=d.exec(e))!==null;){const p=f.index,_=p+(f[0]?.length||0);_>p&&a.push([p,_]),d.lastIndex===f.index&&d.lastIndex++}}if(!a.length)return e;a.sort((d,f)=>d[0]-f[0]);const l=[];for(const d of a)!l.length||d[0]>l[l.length-1][1]?l.push(d.slice()):l[l.length-1][1]=Math.max(l[l.length-1][1],d[1]);if(!l.length&&t&&t.length){const d=[];for(const f of t){if(!f||cs(f))continue;const p=Ur(f);if(!p)continue;let _=0;for(;(_=s.indexOf(p,_))!==-1;){const w=i[_]??0,v=(i[_+p.length-1]??e.length-1)+1;d.push([w,v]),_+=p.length}}d.sort((f,p)=>f[0]-p[0]);for(const f of d)!l.length||f[0]>l[l.length-1][1]?l.push(f.slice()):l[l.length-1][1]=Math.max(l[l.length-1][1],f[1])}let c="",h=0;for(const[d,f]of l)c+=e.slice(h,d)+r,h=f;return c+=e.slice(h),c};var ll=Un();const pr=()=>en(ll),kh=({children:e})=>{const{user:t,loading:r,updateUserBlockStatus:n}=os(),o=typeof window<"u"&&window.VITE_SITE_ID?window.VITE_SITE_ID:"",[s,i]=ee(null),[a,l]=ee([]),[c,h]=ee(!0),[d,f]=ee(null),[p,_]=ee(!1),[w,v]=ee([]),m=x=>{const{ads:O,...N}=x||{};O&&l(O),i(S=>({...S,...N})),x.theme_mode&&document.documentElement.setAttribute("data-theme",x.theme_mode);const E=document.documentElement;x.primary_color&&E.style.setProperty("--chat-primary",x.primary_color),x.chat_background&&((x.theme_mode||E.getAttribute("data-theme")||"dark")==="light"?E.style.setProperty("--chat-bg",x.chat_background):E.style.removeProperty("--chat-bg"))};xe(()=>{(async()=>
177{if(!r){if(!o){f("VITE_SITE_ID is not defined"),h(!1);return}try{t?.isBlocked?_(!0):_(!1);const O=await bu(o,t?.uid);O&&(O.roles_config&&v(O.roles_config),O.site?m({...O.site,room_system:O.room_system??O.site.room_system}):i(O)),O&&typeof O.is_blocked<"u"&&(_(O.is_blocked),n&&n(O.is_blocked))}catch(O){f(O.message||"Failed to fetch site config")}finally{h(!1)}}})()},[r,t?.uid,t?.isBlocked,o]),xe(()=>{const x=Po(),O=N=>{N?.site_id&&N.site_id!==o||m(N)};return x.on("site_config_updated",O),()=>{x.off("site_config_updated",O)}},[o]);const g={siteConfig:s,ads:a,loading:c,error:d,isBlocked:p,rolesConfig:w};return u(ll.Provider,{value:g,children:e})};var Sh="";const wi=Sh.split(",").map(e=>e.trim()).filter(Boolean),Ch=e=>{const t=me([]);return{sentMessageTimestamps:t,checkSpam:n=>{if(!e?.spam_config?.enabled)return!0;const o=(n||"").trim().toLowerCase();if(!o)return!0;const s=Date.now(),{max_messages:i,interval_seconds:a}=e.spam_config,l=a*1e3;t.current=t.current.filter(_=>s-_.timestamp<l);const c=/^(https?:\/\/|www\.)/i.test(o),h=o.startsWith("[gif]")||o.startsWith("[sticker]"),d=o.replace(new RegExp("\\p{Extended_Pictographic}","gu"),"").replace(/\s+/g,"").length===0,f=c||h||d,p=t.current.filter(_=>_.text===o);if(p.length>0){if(s-Math.max(...p.map(_=>_.timestamp))<5e3)return Oe.error("Vui lòng không gửi trùng lặp quá nhanh"),!1;if(p.length>=3)return Oe.error("Vui lòng không spam cùng một nội dung"),!1}if(f){if(d&&!c&&!h&&new RegExp("(\\p{Extended_Pictographic})\\1{10,}","u").test(o))return Oe.error("Vui lòng không gửi nhiều emoji giống nhau liên tiếp"),!1}else{if(/(.)\1{4,}/u.test(o)||/([\p{L}\w]+)(?:\s+\1){3,}/iu.test(o)||/^(.{2,}?)(?:\s+\1){3,}$/.test(o)||/^(.{2,4}?)\1{2,}$/u.test(o))return Oe.error("Vui lòng không spam"),!1;const _=(o.match(/[aeiouáàảãạăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđ]/gi)||[]).length,w=(o.match(/[\p{L}]/gu)||[]).length;if(w>0&&_/w<.2)return Oe.error("Vui lòng không spam"),!1}return t.current.length>=i?(Oe.error("Bạn gửi tin nhắn quá nhanh, vui lòng chờ"),!1):(t.current.push({text:o,timestamp:s}),!0)}}};var Th=/^[a-z0-9][a-z0-9_-]{0,63}$/i;const cl={default:{id:"default",label:"Mặc định",defaultMode:"dark",variables:{}},"default-dark-emerald":{id:"default-dark-emerald",label:"Default Dark Emerald",defaultMode:"dark",modes:{dark:{"--chat-font-family":"Satoshi, Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"Satoshi, sans-serif","--chat-bg":"#09090b","--chat-header-bg":"rgba(24, 24, 27, 0.72)","--chat-input-bg":"#18181b","--chat-panel-bg":"#09090b","--chat-text-main":"#e4e4e7","--chat-text-muted":"#71717a","--chat-border":"#27272a","--chat-primary":"#10b981","--chat-accent":"#10b981","--chat-radius":"12px","--chat-shadow":"0 25px 50px -12px rgba(0, 0, 0, 0.55)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(39, 39, 42, 0.35)","--scrollbar-thumb":"rgba(113, 113, 122, 0.65)","--scrollbar-thumb-hover":"rgba(161, 161, 170, 0.85)","--chat-sticky-bg":"rgba(24, 24, 27, 0.72)","--chat-sticky-color":"#10b981","--chat-primary-gradient":"none","--chat-glow-shadow":"none","--chat-primary-text-color":"#ffffff"},light:{"--chat-font-family":"Satoshi, Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"Satoshi, sans-serif","--chat-bg":"#f9fafb","--chat-header-bg":"rgba(244, 244, 245, 0.72)","--chat-input-bg":"#f4f4f5","--chat-panel-bg":"#ffffff","--chat-text-main":"#18181b","--chat-text-muted":"#71717a","--chat-border":"#e4e4e7","--chat-primary":"#059669","--chat-accent":"#10b981","--chat-radius":"12px","--chat-shadow":"0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(228, 228, 231, 0.35)","--scrollbar-thumb":"rgba(161, 161, 170, 0.65)","--scrollbar-thumb-hover":"rgba(113, 113, 122, 0.85)","--chat-sticky-bg":"rgba(244, 244, 245, 0.72)","--chat-sticky-color":"#059669","--chat-primary-gradient":"none","--chat-glow-shadow":"none","--chat-primary-text-color":"#ffffff"}}},"cyber-esports-betting":{id:"cyber-esports-betting",label:"Cyber Esports & Live Bett
177ing",defaultMode:"dark",modes:{dark:{"--chat-font-family":"Rajdhani, Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"Orbitron, Rajdhani, sans-serif","--chat-bg":"rgba(7, 11, 25, 0.92)","--chat-header-bg":"#050814","--chat-input-bg":"#070b19","--chat-panel-bg":"rgba(7, 11, 25, 0.92)","--chat-text-main":"#e2f4ff","--chat-text-muted":"#94a3b8","--chat-border":"rgba(34, 211, 238, 0.32)","--chat-primary":"#00f0ff","--chat-accent":"#ff007f","--chat-radius":"12px","--chat-shadow":"0 0 20px rgba(0, 240, 255, 0.08), inset 0 0 10px rgba(0, 240, 255, 0.05)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(0, 240, 255, 0.04)","--scrollbar-thumb":"#00f0ff","--scrollbar-thumb-hover":"#ff007f","--chat-sticky-bg":"rgba(5, 8, 20, 0.75)","--chat-sticky-color":"#00f0ff","--chat-primary-gradient":"linear-gradient(135deg, #00f0ff 0%, #ff007f 100%)","--chat-glow-shadow":"0 0 15px rgba(0, 240, 255, 0.25)","--chat-primary-text-color":"#050814"},light:{"--chat-font-family":"Rajdhani, Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"Orbitron, Rajdhani, sans-serif","--chat-bg":"rgba(240, 249, 255, 0.95)","--chat-header-bg":"#e0f2fe","--chat-input-bg":"#f0f9ff","--chat-panel-bg":"#ffffff","--chat-text-main":"#0f172a","--chat-text-muted":"#475569","--chat-border":"rgba(14, 165, 233, 0.35)","--chat-primary":"#0284c7","--chat-accent":"#db2777","--chat-radius":"12px","--chat-shadow":"0 10px 25px rgba(14, 165, 233, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.6)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(14, 165, 233, 0.05)","--scrollbar-thumb":"#0ea5e9","--scrollbar-thumb-hover":"#ec4899","--chat-sticky-bg":"rgba(224, 242, 254, 0.85)","--chat-sticky-color":"#0284c7","--chat-primary-gradient":"linear-gradient(135deg, #0ea5e9 0%, #ec4899 100%)","--chat-glow-shadow":"0 0 12px rgba(14, 165, 233, 0.15)","--chat-primary-text-color":"#ffffff"}}},"cyber-forest-green":{id:"cyber-forest-green",label:"Cyber Forest Green",defaultMode:"dark",modes:{dark:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"#050907","--chat-header-bg":"rgba(9, 15, 12, 0.72)","--chat-input-bg":"#0b1510","--chat-panel-bg":"#050907","--chat-text-main":"#ecfdf5","--chat-text-muted":"#6b7280","--chat-border":"rgba(16, 185, 129, 0.2)","--chat-primary":"#10b981","--chat-accent":"#34d399","--chat-radius":"12px","--chat-shadow":"0 12px 32px -10px rgba(16, 185, 129, 0.15)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(16, 185, 129, 0.02)","--scrollbar-thumb":"rgba(16, 185, 129, 0.3)","--scrollbar-thumb-hover":"rgba(16, 185, 129, 0.6)","--chat-sticky-bg":"rgba(5, 9, 7, 0.75)","--chat-sticky-color":"#10b981","--chat-primary-gradient":"none","--chat-glow-shadow":"0 0 12px rgba(16, 185, 129, 0.15)","--chat-primary-text-color":"#050907"},light:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"#f0fdf4","--chat-header-bg":"rgba(220, 252, 231, 0.8)","--chat-input-bg":"#e8fbf0","--chat-panel-bg":"#ffffff","--chat-text-main":"#064e3b","--chat-text-muted":"#374151","--chat-border":"rgba(16, 185, 129, 0.3)","--chat-primary":"#059669","--chat-accent":"#10b981","--chat-radius":"12px","--chat-shadow":"0 10px 20px rgba(16, 185, 129, 0.08)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(16, 185, 129, 0.05)","--scrollbar-thumb":"rgba(16, 185, 129, 0.4)","--scrollbar-thumb-hover":"rgba(16, 185, 129, 0.8)","--chat-sticky-bg":"rgba(220, 252, 231, 0.8)","--chat-sticky-color":"#059669","--chat-primary-gradient":"none","--chat-glow-shadow":"0 0 10px rgba(16, 185, 129, 0.1)","--chat-primary-text-color":"#ffffff"}}},"cyber-yellow":{id:"cyber-yellow",label:"Cyber Industrial Yellow",defaultMode:"dark",modes:{dark:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"#0b0b0d","--chat-header-bg":"rgba(18, 18, 22, 0.75)","--chat-input-bg":"#141417","--chat-panel-bg":"#0b0b0d","--chat-text-main":"#fef9c3","--chat-text-muted":"#71717a","--chat-border":"rgba(234, 179, 8, 0.2)","--chat-primary":"#eab308","--chat-accent":"#facc15","--chat-radius":"12px","--chat-shadow":"0 12px 32px -10px rgba(234, 179, 8, 0.15)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(234, 179, 8, 0.02)","--scrollbar-thumb":"rgba(234, 179, 8, 0.3)","--scrollbar-thumb-hover":"rgba(234, 179, 8, 0.6)","--chat-sticky-bg":"rgba(11, 11, 13, 0.75)","--chat-sticky-color":"#eab308","--chat-primary-gradient":"none","--chat-glow-shadow":"0 0 12px rgba(234, 179, 8, 0.15)","--chat-primary-text-color":"#0b0b0d"},light:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"#fefce8","--chat-header-bg":"rgba(254, 240, 138, 0.8)","--chat-input-bg":"#fef9c3","--chat-panel-bg":"#ffffff","--chat-text-main":"#713f12","--chat-text-muted":"#4b5563","--chat-border":"rgba(234, 179, 8, 0.4)","--chat-primary":"#ca8a04","--chat-accent":"#eab308","--chat-radius":"12px","--chat-shadow":"0 10px 20px rgba(234, 179, 8, 0.08)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(234, 179, 8, 0.05)","--scrollbar-thumb":"rgba(234, 179, 8, 0.4)","--scrollbar-thumb-hover":"rgba(234, 179, 8, 0.8)","--chat-sticky-bg":"rgba(254, 240, 138, 0.8)","--chat-sticky-color":"#ca8a04","--chat-primary-gradient":"none","--chat-glow-shadow":"0 0 10px rgba(234, 179, 8, 0.1)","--chat-primary-text-color":"#ffffff"}}},"volcanic-orange":{id:"volcanic-orange",label:"Volcanic Orange",defaultMode:"dark",modes:{dark:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"#0e0a0a","--chat-header-bg":"rgba(24, 18, 18, 0.75)","--chat-input-bg":"#1a1212","--chat-panel-bg":"#0e0a0a","--chat-text-main":"#ffedd5","--chat-text-muted":"#8c7a7a","--chat-border":"rgba(249, 115, 22, 0.2)","--chat-primary":"#f97316","--chat-accent":"#fb923c","--chat-radius":"12px","--chat-shadow":"0 12px 32px -10px rgba(249, 115, 22, 0.15)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(249, 115, 22, 0.02)","--scrollbar-thumb":"rgba(249, 115, 22, 0.3)","--scrollbar-thumb-hover":"rgba(249, 115, 22, 0.6)","--chat-sticky-bg":"rgba(14, 10, 10, 0.75)","--chat-sticky-color":"#f97316","--chat-primary-gradient":"none","--chat-glow-shadow":"0 0 12px rgba(249, 115, 22, 0.15)","--chat-primary-text-color":"#ffffff"},light:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"#fff7ed","--chat-header-bg":"rgba(255, 237, 213, 0.8)","--chat-input-bg":"#ffedd5","--chat-panel-bg":"#ffffff","--chat-text-main":"#7c2d12","--chat-text-muted":"#57534e","--chat-border":"rgba(249, 115, 22, 0.35)","--chat-primary":"#ea580c","--chat-accent":"#f97316","--chat-radius":"12px","--chat-shadow":"0 10px 20px rgba(249, 115, 22, 0.08)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(249, 115, 22, 0.05)","--scrollbar-thumb":"rgba(249, 115, 22, 0.4)","--scrollbar-thumb-hover":"rgba(249, 115, 22, 0.8)","--chat-sticky-bg":"rgba(255, 237, 213, 0.8)","--chat-sticky-color":"#ea580c","--chat-primary-gradient":"none","--chat-glow-shadow":"0 0 10px rgba(249, 115, 22, 0.1)","--chat-primary-text-color":"#ffffff"}}},"sapphire-blue":{id:"sapphire-blue",label:"Sapphire Blue",defaultMode:"dark",modes:{dark:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"#040914","--chat-header-bg":"rgba(10, 18, 36, 0.75)","--chat-input-bg":"#0f1a30","--chat-panel-bg":"#040914","--chat-text-main":"#eff6ff","--chat-text-muted":"#64748b","--chat-border":"rgba(59, 130, 246, 0.2)","--chat-primary":"#3b82f6","--chat-accent":"#60a5fa","--chat-radius":"12px","--chat-shadow":"0 12px 32px -10px rgba(59, 130, 246, 0.15)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(59, 130, 246, 0.02)","--scrollbar-thumb":"rgba(59, 130, 246, 0.3)","--scrollbar-thumb-hover":"rgba(59, 130, 246, 0.6)","--chat-sticky-bg":"rgba(4, 9, 20, 0.75)","--chat-sticky-color":"#3b82f6","--chat-primary-gradient":"none","--chat-glow-shadow":"0 0 12px rgba(59, 130, 246, 0.15)","--chat-primary-text-color":"#ffffff"},light:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"#eff6ff","--chat-header-bg":"rgba(219, 234, 254, 0.8)","--chat-input-bg":"#dbeafe","--chat-panel-bg":"#ffffff","--chat-text-main":"#1e3a8a","--chat-text-muted":"#4b5563","--chat-border":"rgba(59, 130, 246, 0.35)","--chat-primary":"#2563eb","--chat-accent":"#3b82f6","--chat-radius":"12px","--chat-shadow":"0 10px 20px rgba(59, 130, 246, 0.08)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(59, 130, 246, 0.05)","--scrollbar-thumb":"rgba(59, 130, 246, 0.4)","--scrollbar-thumb-hover":"rgba(59, 130, 246, 0.8)","--chat-sticky-bg":"rgba(219, 234, 254, 0.8)","--chat-sticky-color":"#2563eb","--chat-primary-gradient":"none","--chat-glow-shadow":"0 0 10px rgba(59, 130, 246, 0.1)","--chat-primary-text-color":"#ffffff"}}},"premium-luxury-betting":{id:"premium-luxury-betting",label:"Premium Luxury Gold",defaultMode:"dark",modes:{dark:{"--chat-font-family":"'Montserrat', system-ui, -apple-system, sans-serif","--chat-display-font":"'Montserrat', sans-serif","--chat-bg":"rgba(12, 12, 14, 0.95)","--chat-header-bg":"#080809","--chat-input-bg":"#0c0c0e","--chat-panel-bg":"#0c0c0e","--chat-text-main":"#fdfdfd","--chat-text-muted":"#a1a1aa","--chat-border":"rgba(212, 175, 55, 0.25)","--chat-primary":"#bf953f","--chat-accent":"#fcf6ba","--chat-radius":"12px","--chat-shadow":"0 20px 50px rgba(212, 175, 55, 0.08)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(0, 0, 0, 0.4)","--scrollbar-thumb":"#bf953f","--scrollbar-thumb-hover":"#fcf6ba","--chat-sticky-bg":"rgba(8, 8, 9, 0.8)","--chat-sticky-color":"#bf953f","--chat-primary-gradient":"linear-gradient(135deg, #bf953f 0%, #fcf6ba 25%, #b38728 50%, #fbf5b7 75%, #aa771c 100%)","--chat-glow-shadow":"0 0 12px rgba(179, 135, 40, 0.3)","--chat-primary-text-color":"#000000"},light:{"--chat-font-family":"'Montserrat', system-ui, -apple-system, sans-serif","--chat-display-font":"'Montserrat', sans-serif","--chat-bg":"#faf9f6","--chat-header-bg":"rgba(245, 243, 239, 0.85)","--chat-input-bg":"#f1ede4","--chat-panel-bg":"#ffffff","--chat-text-main":"#1c1917","--chat-text-muted":"#78716c","--chat-border":"rgba(191, 149, 63, 0.35)","--chat-primary":"#855b14","--chat-accent":"#bf953f","--chat-radius":"12px","--chat-shadow":"0 15px 35px rgba(191, 149, 63, 0.08)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(191, 149, 63, 0.05)","--scrollbar-thumb":"#bf953f","--scrollbar-thumb-hover":"#855b14","--chat-sticky-bg":"rgba(245, 243, 239, 0.85)","--chat-sticky-color":"#855b14","--chat-primary-gradient":"linear-gradient(135deg, #bf953f 0%, #fcf6ba 25%, #b38728 50%, #fbf5b7 75%, #aa771c 100%)","--chat-glow-shadow":"0 0 8px rgba(191, 149, 63, 0.15)","--chat-primary-text-color":"#000000"}}},"light-glassmorphic":{id:"light-glassmorphic",label:"Light Glassmorphism",defaultMode:"light",modes:{light:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"rgba(255, 255, 255, 0.85)","--chat-header-bg":"rgba(255, 255, 255, 0.4)","--chat-input-bg":"rgba(243, 244, 246, 0.8)","--chat-panel-bg":"rgba(255, 255, 255, 0.9)","--chat-text-main":"#1f2937","--chat-text-muted":"#6b7280","--chat-border":"rgba(0, 0, 0, 0.08)","--chat-primary":"#4f46e5","--chat-accent":"#6366f1","--chat-radius":"16px","--chat-shadow":"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","--chat-backdrop-filter":"blur(16px)","--scrollbar-track":"rgba(0, 0, 0, 0.02)","--scrollbar-thumb":"rgba(79, 70, 229, 0.2)","--scrollbar-thumb-hover":"rgba(79, 70, 229, 0.4)","--chat-sticky-bg":"rgba(255, 255, 255, 0.6)","--chat-sticky-color":"#4f46e5","--chat-primary-gradient":"none","--chat-glow-shadow":"none","--chat-primary-text-color":"#ffffff"},dark:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"rgba(15, 23, 42, 0.85)","--chat-header-bg":"rgba(15, 23, 42, 0.4)","--chat-input-bg":"rgba(30, 41, 59, 
1770.8)","--chat-panel-bg":"rgba(15, 23, 42, 0.9)","--chat-text-main":"#f8fafc","--chat-text-muted":"#94a3b8","--chat-border":"rgba(255, 255, 255, 0.1)","--chat-primary":"#818cf8","--chat-accent":"#a5b4fc","--chat-radius":"16px","--chat-shadow":"0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2)","--chat-backdrop-filter":"blur(16px)","--scrollbar-track":"rgba(255, 255, 255, 0.02)","--scrollbar-thumb":"rgba(129, 140, 248, 0.3)","--scrollbar-thumb-hover":"rgba(129, 140, 248, 0.5)","--chat-sticky-bg":"rgba(15, 23, 42, 0.6)","--chat-sticky-color":"#818cf8","--chat-primary-gradient":"none","--chat-glow-shadow":"none","--chat-primary-text-color":"#ffffff"}}},"violet-indigo-glassmorphic":{id:"violet-indigo-glassmorphic",label:"Dark Indigo Glassmorphism",defaultMode:"dark",modes:{dark:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"rgba(8, 8, 16, 0.75)","--chat-header-bg":"rgba(15, 15, 30, 0.4)","--chat-input-bg":"rgba(15, 15, 30, 0.6)","--chat-panel-bg":"rgba(15, 15, 30, 0.9)","--chat-text-main":"#f3f4f6","--chat-text-muted":"#9ca3af","--chat-border":"rgba(255, 255, 255, 0.1)","--chat-primary":"#6366f1","--chat-accent":"#a855f7","--chat-radius":"16px","--chat-shadow":"0 12px 40px -10px rgba(99, 102, 241, 0.25)","--chat-backdrop-filter":"blur(20px)","--scrollbar-track":"rgba(255, 255, 255, 0.02)","--scrollbar-thumb":"rgba(99, 102, 241, 0.3)","--scrollbar-thumb-hover":"rgba(168, 85, 247, 0.6)","--chat-sticky-bg":"rgba(15, 15, 30, 0.6)","--chat-sticky-color":"#6366f1","--chat-primary-gradient":"none","--chat-glow-shadow":"0 0 12px rgba(99, 102, 241, 0.25)","--chat-primary-text-color":"#ffffff"},light:{"--chat-font-family":"'Plus Jakarta Sans', Montserrat, system-ui, -apple-system, sans-serif","--chat-display-font":"'Plus Jakarta Sans', sans-serif","--chat-bg":"rgba(243, 244, 255, 0.85)","--chat-header-bg":"rgba(243, 244, 255, 0.4)","--chat-input-bg":"rgba(224, 231, 255, 0.8)","--chat-panel-bg":"rgba(255, 255, 255, 0.9)","--chat-text-main":"#1e1b4b","--chat-text-muted":"#4f46e5","--chat-border":"rgba(99, 102, 241, 0.15)","--chat-primary":"#4f46e5","--chat-accent":"#7c3aed","--chat-radius":"16px","--chat-shadow":"0 20px 25px -5px rgba(99, 102, 241, 0.1), 0 10px 10px -5px rgba(99, 102, 241, 0.05)","--chat-backdrop-filter":"blur(20px)","--scrollbar-track":"rgba(99, 102, 241, 0.02)","--scrollbar-thumb":"rgba(99, 102, 241, 0.2)","--scrollbar-thumb-hover":"rgba(99, 102, 241, 0.4)","--chat-sticky-bg":"rgba(243, 244, 255, 0.6)","--chat-sticky-color":"#4f46e5","--chat-primary-gradient":"none","--chat-glow-shadow":"0 0 10px rgba(99, 102, 241, 0.15)","--chat-primary-text-color":"#ffffff"}}},"football-live-stream":{id:"football-live-stream",label:"Football Live Stream",defaultMode:"dark",modes:{dark:{"--chat-font-family":"'Barlow', system-ui, -apple-system, sans-serif","--chat-display-font":"'Barlow Condensed', sans-serif","--chat-bg":"#0e1524","--chat-header-bg":"#0b0f19","--chat-input-bg":"#0e1524","--chat-panel-bg":"#0b0f19","--chat-text-main":"#e2e8f0","--chat-text-muted":"#64748b","--chat-border":"#1e293b","--chat-primary":"#f97316","--chat-accent":"#10b981","--chat-radius":"12px","--chat-shadow":"0 20px 50px rgba(0, 0, 0, 0.5)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(11, 15, 25, 0.5)","--scrollbar-thumb":"rgba(249, 115, 22, 0.3)","--scrollbar-thumb-hover":"rgba(249, 115, 22, 0.6)","--chat-sticky-bg":"rgba(11, 15, 25, 0.75)","--chat-sticky-color":"#f97316","--chat-primary-gradient":"none","--chat-glow-shadow":"none","--chat-primary-text-color":"#ffffff"},light:{"--chat-font-family":"'Barlow', system-ui, -apple-system, sans-serif","--chat-display-font":"'Barlow Condensed', sans-serif","--chat-bg":"#f8fafc","--chat-header-bg":"rgba(241, 245, 249, 0.8)","--chat-input-bg":"#e2e8f0","--chat-panel-bg":"#ffffff","--chat-text-main":"#0f172a","--chat-text-muted":"#475569","--chat-border":"#cbd5e1","--chat-primary":"#ea580c","--chat-accent":"#059669","--chat-radius":"12px","--chat-shadow":"0 10px 20px rgba(0, 0, 0, 0.05)","--chat-backdrop-filter":"none","--scrollbar-track":"rgba(226, 232, 240, 0.5)","--scrollbar-thumb":"rgba(234, 88, 12, 0.3)","--scrollbar-thumb-hover":"rgba(234, 88, 12, 0.6)","--chat-sticky-bg":"rgba(241, 245, 249, 0.8)","--chat-sticky-color":"#ea580c","--chat-primary-gradient":"none","--chat-glow-shadow":"none","--chat-primary-text-color":"#ffffff"}}}},us=e=>{if(typeof e!="string")return"default";const t=e.trim();return Th.test(t)&&cl[t]?t:"default"},ul=e=>cl[us(e)],Ih=(e,t="dark")=>{const r=ul(e);return r?r.modes?r.modes[t]||r.modes.dark||r.modes.light||{}:r.variables||{}:{}};var dl=Un();const Eh=({children:e})=>{const t=me(null),{user:r,loginAsAnonymous:n,logout:o,updateUserBlockStatus:s,updateUserRole:i}=os(),{siteConfig:a,ads:l}=pr(),c=us(new URLSearchParams(typeof window<"u"?window.location.search:"").get("theme_id")||a?.theme_id),h=a?.theme_mode==="dark",d=!!a?.banner_zone_id?.["250250"],f=!!a?.banner_zone_id?.topoutside,p=!!a?.banner_zone_id?.bottomoutside,_=a?.outside_enabled!==!1,[w,v]=ee(!1),[m,g]=ee(()=>{try{return localStorage.getItem("chat_enabled")!=="false"}catch{return!0}});xe(()=>{try{localStorage.setItem("chat_enabled",String(m))}catch(ne){console.error("Failed to save chat_enabled:",ne)}},[m]);const x=a?.allow_anonymous_chat===!1&&(!r||r.isAnonymous),O=me(!1),N=me(!1),E=me(null),S=St(()=>{const ne=[],de=Array.isArray(a?.blocked_keywords)?a.blocked_keywords:[],Qe=Array.isArray(wi)?wi:[],$e=[...de,...Qe,...ne],at=new Set,wt=[];for(const er of $e){const Hs=String(er).toLowerCase();at.has(Hs)||(at.add(Hs),wt.push(er))}return wt},[a]),[I,F]=ee("general"),[M,J]=ee(!1),[H,j]=ee(null),[P,Q]=ee([]),[$,le]=ee(!1),[oe,pe]=ee({isOpen:!1,title:"",message:"",onConfirm:null,isDanger:!1}),ye=St(()=>{if(!r)return!1;const ne=r.role||r.user_role;return r.isAdmin||ne==="admin"||ne==="blv"},[r]),Me=Ee(ne=>{if(ye){const de=ne.role||"";if(de==="admin"||de==="blv"||ne.isAdmin)return;j(ne),J(!0)}},[ye]),Be=Ee(ne=>{$?Q(de=>{if(de.includes(ne.id)){const Qe=de.filter($e=>$e!==ne.id);return Qe.length===0&&le(!1),Qe}else return[...de,ne.id]}):(le(!0),Q([ne.id]))},[$]),Re=Ee(ne=>{pe({isOpen:!0,title:"Xóa tin nhắn",message:"Bạn có chắc muốn xóa tin nhắn này?",isDanger:!0,onConfirm:async()=>{try{await ci([ne.id]),Oe.success("Đã xóa tin nhắn")}catch{Oe.error("Xóa thất bại")}pe(de=>({...de,isOpen:!1}))}})},[]),Je=Ee(()=>{P.length&&pe({isOpen:!0,title:"Xóa tin nhắn",message:`Bạn có chắc muốn xóa ${P.length} tin nhắn đã chọn?`,isDanger:!0,onConfirm:async()=>
177{try{await ci(P),Oe.success(`Đã xóa ${P.length} tin nhắn`),le(!1),Q([])}catch{Oe.error("Xóa thất bại")}pe(ne=>({...ne,isOpen:!1}))}})},[P]),ut=Ee(()=>{le(!1),Q([])},[]),Ye=Ee(()=>{le(!1),Q([]),o()},[o]),Xe=St(()=>I==="match"?wu():a?.use_general_room===!0&&a?.room_code_general||a?.room_system,[I,a]),[W,ce]=ee(!1),Ce=me(null),L=Ee(()=>{ce(!0),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(()=>ce(!1),3e3)},[]),R=bh(a?.ads_config),{messages:D,sendMessage:K,loading:G,isConnected:X,error:q,loadMoreHistory:ie,historyLoading:ae,hasMoreHistory:Fe,isBlocked:y,addOrReplaceAd:b}=vh(r,Xe,s,o,i,L,m,St(()=>({share_general_room:a?.share_general_room,shared_group_id:a?.shared_group_id}),[a?.share_general_room,a?.shared_group_id]));xe(()=>{l&&R.setAds(l)},[l]);const T=me(null);xe(()=>{if(!R.currentAdsMessage)return;const ne=R.currentAdsMessage._id||R.currentAdsMessage.id;!ne||ne===T.current||(T.current=ne,b(R.currentAdsMessage))},[R.currentAdsMessage,b]);const[k,C]=ee(new Set),[A,V]=ee(1e4),Z=Ee(ne=>{C(de=>{const Qe=new Set(de);return Qe.add(ne),Qe})},[]),se=St(()=>{const ne={};return D.filter(de=>{if(k.has(de.id))return!1;if(de.type!=="system_join")return!0;const Qe=de.uid||de.sender||"unknown";let $e=0;if(de.createdAt){const wt=new Date(de.createdAt);isNaN(wt.getTime())||($e=wt.getTime())}if(!$e)return!0;const at=ne[Qe];return at&&Math.abs($e-at)<1e4?!1:(ne[Qe]=$e,!0)})},[D,k]),ue=me(se),[Ze,Ge]=ee(!0),[yt,Xt]=ee(!0),[Zt,Vt]=ee(!1),[cr,Rt]=ee(0);xe(()=>{Xt(!0),Vt(!1),Rt(0),Ge(!0),V(1e4),ue.current=se},[Xe]),B.useLayoutEffect(()=>{const ne=ue.current,de=se;if(de.length>ne.length){if(ne.length>0){const Qe=ne[0].id,$e=de.findIndex(at=>at.id===Qe);$e>0&&V(at=>at-$e)}}else de.length===0&&V(1e4);ue.current=de},[se]);const Qt=me(null),[$t,Er]=ee(""),[an,$n]=ee(""),[ln,eo]=ee(!1),[cn,un]=ee(!1),[$l,to]=ee([]),ro=me(null),Ms=me(null),Bs=me(null),no=me(!1),Ds=me(!0),Ps=me(null),{checkSpam:zs}=Ch(a);xe(()=>{x&&(O.current||(O.current=!0,v(!1)))},[x]),xe(()=>{const ne=de=>{const Qe=de.composedPath?de.composedPath():[de.target],$e=(at,wt)=>at.current?Qe.includes(at.current)?!0:Qe.some(er=>er instanceof Element&&er.matches&&er.matches(`button[${wt}="true"]`)):!1;ln&&!$e(Ms,"data-emoji-button")&&eo(!1),cn&&!$e(Bs,"data-gif-button")&&un(!1)};return(ln||cn)&&document.addEventListener("click",ne),()=>{document.removeEventListener("click",ne)}},[ln,cn]);const oo=Ee(()=>{t.current?.scrollToIndex({index:A+se.length-1,behavior:"smooth"})},[A,se.length]);xe(()=>{if(m&&D.length>0){const ne=D[D.length-1];if(ne&&ne.id!==Ps.current){Ps.current=ne.id;const de=r&&(r.isAnonymous&&String(ne.anonymousId)===String(r.uid)||!r.isAnonymous&&String(ne.uid)===String(r.user_id||r.uid));Ds.current||de?(t.current?.scrollToIndex({index:A+se.length-1,behavior:"smooth"}),Vt(!1),Rt(0)):(Vt(!0),Rt(Qe=>Qe+1))}}},[D,m,r,se,A]),xe(()=>{!G&&m&&setTimeout(()=>{oo()},100)},[G,m,I,Xe,oo]);const ec=ne=>{const de=ne.currentTarget;de.classList.add("is-scrolling"),Qt.current&&clearTimeout(Qt.current),Qt.current=setTimeout(()=>{de.classList.remove("is-scrolling")},1500)},tc=ne=>{if(ne?.preventDefault?.(),no.current||!$t.trim()||!Xe&&I==="match"||!X)return;if(x){v(!0);return}if(y)return;if(/<[a-z][\s\S]*>/i.test($t)){Oe.error("Nội dung tin nhắn không hợp lệ");return}if(!zs($t))return;no.current=!0,setTimeout(()=>{no.current=!1},300);const de=zo($t,S);de.length&&to(de),K(al($t,S)),Er(""),eo(!1),un(!1),to([]),ro.current&&(ro.current.value="")},rc=ne=>{if(ne.preventDefault(),a?.allow_anonymous_chat===!1){v(!0);return}const de=an.trim();if(de){if(zo(de,S).length>0){Oe.error("Tên không hợp lệ");return}n(de)}},nc=ne=>{Er(de=>de+ne.emoji)},oc=ne=>{zs(ne)&&(K(`[gif]${ne}`),un(!1))};xe(()=>{const ne=window.matchMedia("(min-width: 1024px)");N.current=ne.matches;const de=()=>{if(!N.current){E.current=null;return}const wt=document.getElementById("liveVideo");if(!wt){E.current=null;return}const er=wt.getBoundingClientRect();E.current=Math.max(0,Math.round(er.height))},Qe=wt=>{N.current=wt.matches,de()};de(),ne.addEventListener("change",Qe);const $e=document.getElementById("liveVideo");let at=null;return $e&&(at=new ResizeObserver(de),at.observe($e),$e.addEventListener("loadedmetadata",de)),window.addEventListener("resize",de),()=>{ne.removeEventListener("change",Qe),at&&at.disconnect(),$e&&$e.removeEventListener("loadedmetadata",de),window.removeEventListener("resize",de)}},[]);const sc={virtuosoRef:t,inputRef:ro,emojiPickerRef:Ms,gifPickerRef:Bs,user:r,siteConfig:a,themeId:c,ads:l,isDark:h,hasBanner250:d,hasBannerTop:f,hasBannerBottom:p,outsideEnabled:_,mustLoginToCh
177at:x,isAdminOrBlv:ye,isBlocked:y,isConnected:X,activeTab:I,setActiveTab:F,blockModalOpen:M,setBlockModalOpen:J,userToBlock:H,setUserToBlock:j,selectedMessages:P,setSelectedMessages:Q,isSelectMode:$,setIsSelectMode:le,confirmModal:oe,setConfirmModal:pe,inputText:$t,setInputText:Er,userNameInput:an,setUserNameInput:$n,isChatEnabled:m,setIsChatEnabled:g,showEmojiPicker:ln,setShowEmojiPicker:eo,showGifPicker:cn,setShowGifPicker:un,blockWarning:W,showAuthModal:w,setShowAuthModal:v,filteredMessages:se,firstItemIndex:A,historyLoading:ae,loading:G,error:q,hasMoreHistory:Fe,loadMoreHistory:ie,atBottom:yt,setAtBottom:Xt,isInitialLoadForRoom:Ze,setIsInitialLoadForRoom:Ge,unreadCount:cr,setUnreadCount:Rt,_showNewMessageAlert:Zt,_setShowNewMessageAlert:Vt,isNearBottomRef:Ds,handleUserClick:Me,handleSelectMessage:Be,handleDeleteSingle:Re,handleDeleteSelected:Je,handleCancelSelect:ut,handleLogout:Ye,handleScroll:ec,handleSend:tc,handleLoginAnonymous:rc,onEmojiClick:nc,onGifSelect:oc,scrollToBottom:oo,handleRemoveSystemMessage:Z,blockedKeywords:S,_blockedList:$l,_setBlockedList:to,currentMatchId:Xe};return u(dl.Provider,{value:sc,children:e})},ds=()=>{const e=en(dl);if(!e)throw new Error("useChatWidgetLogic must be used within a ChatWidgetProvider");return e};function Ah(e){return qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M426.666 330.667a250.385 250.385 0 0 1-75.729-11.729c-7.469-2.136-16-1.073-21.332 5.333l-46.939 46.928c-60.802-30.928-109.864-80-140.802-140.803l46.939-46.927c5.332-5.333 7.462-13.864 5.332-21.333-8.537-24.531-12.802-50.136-12.802-76.803C181.333 73.604 171.734 64 160 64H85.333C73.599 64 64 73.604 64 85.333 64 285.864 226.136 448 426.666 448c11.73 0 21.334-9.604 21.334-21.333V352c0-11.729-9.604-21.333-21.334-21.333z"},child:[]}]})(e)}function Nh(e){return qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M64 368v80h80l235.727-235.729-79.999-79.998L64 368zm377.602-217.602c8.531-8.531 8.531-21.334 0-29.865l-50.135-50.135c-8.531-8.531-21.334-8.531-29.865 0l-39.468 39.469 79.999 79.998 39.469-39.467z"},child:[]}]})(e)}function Rh(e){return qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M376 186h-20v-40c0-55-45-100-100-100S156 91 156 146v40h-20c-22.002 0-40 17.998-40 40v200c0 22.002 17.998 40 40 40h240c22.002 0 40-17.998 40-40V226c0-22.002-17.998-40-40-40zM256 368c-22.002 0-40-17.998-40-40s17.998-40 40-40 40 17.998 40 40-17.998 40-40 40zm62.002-182H193.998v-40c0-34.004 28.003-62.002 62.002-62.002 34.004 0 62.002 27.998 62.002 62.002v40z"},child:[]}]})(e)}function Oh(e){return qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 256c52.805 0 96-43.201 96-96s-43.195-96-96-96-96 43.201-96 96 43.195 96 96 96zm0 48c-63.598 0-192 32.402-192 96v48h384v-48c0-63.598-128.402-96-192-96z"},child:[]}]})(e)}function Lh(e){return qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M48 448l416-192L48 64v149.333L346 256 48 298.667z"},child:[]}]})(e)}function Mh(e){return qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M413.967 276.8c1.06-6.235 1.06-13.518 1.06-20.8s-1.06-13.518-1.06-20.8l44.667-34.318c4.26-3.118 5.319-8.317 2.13-13.518L418.215 115.6c-2.129-4.164-8.507-6.235-12.767-4.164l-53.186 20.801c-10.638-8.318-23.394-15.601-36.16-20.801l-7.448-55.117c-1.06-4.154-5.319-8.318-10.638-8.318h-85.098c-5.318 0-9.577 4.164-10.637 8.318l-8.508 55.117c-12.767 5.2-24.464 12.482-36.171 20.801l-53.186-20.801c-5.319-2.071-10.638 0-12.767 4.164L49.1 187.365c-2.119 4.153-1.061 10.399 2.129 13.518L96.97 235.2c0 7.282-1.06 13.518-1.06 20.8s1.06 13.518 1.06 20.8l-44.668 34.318c-4.26 3.118-5.318 8.317-2.13 13.518L92.721 396.4c2.13 4.164 8.508 6.235 12.767 4.164l53.187-20.801c10.637 8.318 23.394 15.601 36.16 20.801l8.508 55.117c1.069 5.2 5.318 8.318 10.637 8.318h85.098c5.319 0 9.578-4.164 10.638-8.318l8.518-55.117c12.757-5.2 24.464-12.482 36.16-20.801l53.187 20.801c5.318 2.071 10.637 0 12.767-4.164l42.549-71.765c2.129-4.153 1.06-10.399-2.13-13.518l-46.8-34.317zm-158.499 52c-41.489 0-74.46-32.235-74.46-72.8s32.971-72.8 74.46-72.8 74.461 32.235 74.461 72.8-32.972 72.8-74.461 72.8z"},child:[]}]})(e)}function hl(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=hl(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Bh(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=hl(e))&&(n&&(n+=" "),n+=t);return n}var Le=Bh,rn=e=>e.type==="checkbox",ur=e=>e instanceof Date,ft=e=>e==null,fl=e=>typeof e=="object",nt=e=>!ft(e)&&!Array.isArray(e)&&fl(e)&&!ur(e),Dh=e=>nt(e)&&e.target?rn(e.target)?e.target.checked:e.target.value:e,Ph=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,zh=(e,t)=>e.has(Ph(t)),Hh=e=>{const t=e.constructor&&e.constructor.prototype;return nt(t)&&t.hasOwnProperty("isPrototypeOf")},hs=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function it(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(hs&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(nt(e)&&Hh(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=it(e[o]));return n}var Jn=e=>/^\w*$/.test(e),Ke=e=>e===void 0,fs=e=>Array.isArray(e)?e.filter(Boolean):[],ps=e=>fs(e.replace(/["|']|\]/g,"").split(/\.|\[/)),te=(e,t,r)=>{if(!t||!nt(e))return r;const n=(Jn(t)?[t]:ps(t)).reduce((o,s)=>ft(o)?o:o[s],e);return Ke(n)||n===e?Ke(e[t])?r:e[t]:n},Ot=e=>typeof e=="boolean",Ct=e=>typeof e=="function",Ve=(e,t,r)=>{let n=-1;const o=Jn(t)?[t]:ps(t),s=o.length,i=s-1;for(;++n<s;){const a=o[n];let l=r;if(n!==i){const c=e[a];l=nt(c)||Array.isArray(c)?c:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=l,e=e[a]}},vi={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Tt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},jt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Fh=B.createContext(null);Fh.displayName="HookFormContext";var Vh=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==Tt.all&&(t._proxyFormState[i]=!n||Tt.all),r&&(r[i]=!0),e[i]}});return o},Uh=typeof window<"u"?B.useLayoutEffect:B.useEffect,mt=e=>typeof e=="string",Wh=(e,t,r,n,o)=>mt(e)?(n&&t.watch.add(e),te(r,e,o)):Array.isArray(e)?e.map(s=>(n&&t.watch.add(s),te(r,s))):(n&&(t.watchAll=!0),r),Ho=e=>ft(e)||!fl(e);function nr(e,t,r=new WeakSet){if(Ho(e)||Ho(t))return Object.is(e,t);if(ur(e)&&ur(t))return e.getTime()===t.getTime();const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const i=e[s];if(!o.includes(s))return!1;if(s!=="ref"){const a=t[s];
vendor: 5,397 bytes, line 177
177if(ur(i)&&ur(a)||nt(i)&&nt(a)||Array.isArray(i)&&Array.isArray(a)?!nr(i,a,r):!Object.is(i,a))return!1}}return!0}var jh=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},Pr=e=>Array.isArray(e)?e:[e],bi=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}};function pl(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const o=e[n],s=t[n];if(o&&nt(o)&&s){const i=pl(o,s);nt(i)&&(r[n]=i)}else e[n]&&(r[n]=s)}return r}var dt=e=>nt(e)&&!Object.keys(e).length,ms=e=>e.type==="file",zn=e=>{if(!hs)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ml=e=>e.type==="select-multiple",gs=e=>e.type==="radio",qh=e=>gs(e)||rn(e),po=e=>zn(e)&&e.isConnected;function Gh(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Ke(e)?n++:e[t[n++]];return e}function Kh(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ke(e[t]))return!1;return!0}function et(e,t){const r=Array.isArray(t)?t:Jn(t)?[t]:ps(t),n=r.length===1?e:Gh(e,r),o=r.length-1,s=r[o];return n&&delete n[s],o!==0&&(nt(n)&&dt(n)||Array.isArray(n)&&Kh(n))&&et(e,r.slice(0,-1)),e}var Jh=e=>{for(const t in e)if(Ct(e[t]))return!0;return!1};function gl(e){return Array.isArray(e)||nt(e)&&!Jh(e)}function Fo(e,t={}){for(const r in e){const n=e[r];gl(n)?(t[r]=Array.isArray(n)?[]:{},Fo(n,t[r])):Ke(n)||(t[r]=!0)}return t}function gr(e,t,r){r||(r=Fo(t));for(const n in e){const o=e[n];if(gl(o))Ke(t)||Ho(r[n])?r[n]=Fo(o,Array.isArray(o)?[]:{}):gr(o,ft(t)?{}:t[n],r[n]);else{const s=t[n];r[n]=!nr(o,s)}}return r}var xi={value:!1,isValid:!1},ki={value:!0,isValid:!0},_l=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ke(e[0].attributes.value)?Ke(e[0].value)||e[0].value===""?ki:{value:e[0].value,isValid:!0}:ki:xi}return xi},yl=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ke(e)?e:t?e===""?NaN:e&&+e:r&&mt(e)?new Date(e):n?n(e):e,Si={isValid:!1,value:null},wl=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Si):Si;function Ci(e){const t=e.ref;return ms(t)?t.files:gs(t)?wl(e.refs).value:ml(t)?[...t.selectedOptions].map(({value:r})=>r):rn(t)?_l(e.refs).value:yl(Ke(t.value)?e.ref.value:t.value,e)}var Yh=(e,t,r,n)=>{const o={};for(const s of e){const i=te(t,s);i&&Ve(o,s,i._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},Hn=e=>e instanceof RegExp,Rr=e=>Ke(e)?e:Hn(e)?e.source:nt(e)?Hn(e.value)?e.value.source:e.value:e,Ti=e=>({isOnSubmit:!e||e===Tt.onSubmit,isOnBlur:e===Tt.onBlur,isOnChange:e===Tt.onChange,isOnAll:e===Tt.all,isOnTouch:e===Tt.onTouched}),Ii="AsyncFunction",Xh=e=>!!e&&!!e.validate&&!!(Ct(e.validate)&&e.validate.constructor.name===Ii||nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Ii)),Zh=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ei=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length)))),zr=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const s=te(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(zr(a,t))break}else if(nt(a)&&zr(a,t))break}}};function Ai(e,t,r){const n=te(e,r);if(n||Jn(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const s=o.join("."),i=te(t,s),a=te(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(a&&a.type)return{name:s,error:a};if(a&&a.root&&a.root.type)return{name:`${s}.root`,error:a.root};o.pop()}return{name:r}}var Qh=(e,t,r,n)=>{r(e);const{name:o,...s}=e;return dt(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!n||Tt.all))},$h=(e,t,r)=>!e||!t||e===t||Pr(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),ef=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,tf=(e,t)=>!fs(te(e,t)).length&&et(e,t),rf=(e,t,r)=>{const n=Pr(te(e,r));return Ve(n,"root",t[r]),Ve(e,r,n),e};function Ni(e,t,r="validate"){if(mt(e)||Array.isArray(e)&&e.every(mt)||Ot(e)&&!e)return{type:r,message:mt(e)?e:"",ref:t}}var mr=e=>nt(e)&&!Hn(e)?e:{value:e,message:""},Ri=async(e,t,r,n,o,s)=>{const{ref:i,refs:a,required:l,maxLength:c,minLength:h,min:d,max:f,pattern:p,validate:_,name:w,valueAsNumber:v,mount:m}=e._f,g=te(r,w);if(!m||t.has(w))return{};const x=a?a[0]:i,O=H=>{o&&x.reportValidity&&(x.setCustomValidity(Ot(H)?"":H||""),x.reportValidity())},N={},E=gs(i),S=rn(i),I=E||S,F=(v||ms(i))&&Ke(i.value)&&Ke(g)||zn(i)&&i.value===""||g===""||Array.isArray(g)&&!g.length,M=jh.bind(null,w,n,N),J=(H,j,P,Q=jt.maxLength,$=jt.minLength)=>{const le=H?j:P;N[w]={type:H?Q:$,message:le,ref:i,...M(H?Q:$,le)}};if(s?!Array.isArray(g)||!g.length:l&&(!I&&(F||ft(g))||Ot(g)&&!g||S&&!_l(a).isValid||E&&!wl(a).isValid)){const{value:H,message:j}=mt(l)?{value:!!l,message:l}:mr(l);if(H&&(N[w]={type:jt.required,message:j,ref:x,...M(jt.required,j)},!n))return O(j),N}if(!F&&(!ft(d)||!ft(f))){let H,j;const P=mr(f),Q=mr(d);if(!ft(g)&&!isNaN(g)){const $=i.valueAsNumber||g&&+g;ft(P.value)||(H=$>P.value),ft(Q.value)||(j=$<Q.value)}else{const $=i.valueAsDate||new Date(g),le=ye=>
vendor: 3,118 bytes, line 177
177new Date(new Date().toDateString()+" "+ye),oe=i.type=="time",pe=i.type=="week";mt(P.value)&&g&&(H=oe?le(g)>le(P.value):pe?g>P.value:$>new Date(P.value)),mt(Q.value)&&g&&(j=oe?le(g)<le(Q.value):pe?g<Q.value:$<new Date(Q.value))}if((H||j)&&(J(!!H,P.message,Q.message,jt.max,jt.min),!n))return O(N[w].message),N}if((c||h)&&!F&&(mt(g)||s&&Array.isArray(g))){const H=mr(c),j=mr(h),P=!ft(H.value)&&g.length>+H.value,Q=!ft(j.value)&&g.length<+j.value;if((P||Q)&&(J(P,H.message,j.message),!n))return O(N[w].message),N}if(p&&!F&&mt(g)){const{value:H,message:j}=mr(p);if(Hn(H)&&!g.match(H)&&(N[w]={type:jt.pattern,message:j,ref:i,...M(jt.pattern,j)},!n))return O(j),N}if(_){if(Ct(_)){const H=Ni(await _(g,r),x);if(H&&(N[w]={...H,...M(jt.validate,H.message)},!n))return O(H.message),N}else if(nt(_)){let H={};for(const j in _){if(!dt(H)&&!n)break;const P=Ni(await _[j](g,r),x,j);P&&(H={...P,...M(j,P.message)},O(P.message),n&&(N[w]=H))}if(!dt(H)&&(N[w]={ref:x,...H},!n))return N}}return O(!0),N},nf={mode:Tt.onSubmit,reValidateMode:Tt.onChange,shouldFocusError:!0};function of(e={}){let t={...nf,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ct(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},o=nt(t.defaultValues)||nt(t.values)?it(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:it(o),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const h={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...h};let f={...d};const p={array:bi(),state:bi()},_=t.criteriaMode===Tt.all,w=y=>b=>{clearTimeout(c),c=setTimeout(y,b)},v=async y=>{if(!i.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||y)){let b;t.resolver?(b=dt((await I()).errors),m()):b=await M(n,!0),b!==r.isValid&&p.state.next({isValid:b})}},m=(y,b)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((y||Array.from(a.mount)).forEach(T=>{T&&(b?Ve(r.validatingFields,T,b):et(r.validatingFields,T))}),p.state.next({validatingFields:r.validatingFields,isValidating:!dt(r.validatingFields)}))},g=(y,b=[],T,k,C=!0,A=!0)=>{if(k&&T&&!t.disabled){if(i.action=!0,A&&Array.isArray(te(n,y))){const V=T(te(n,y),k.argA,k.argB);C&&Ve(n,y,V)}if(A&&Array.isArray(te(r.errors,y))){const V=T(te(r.errors,y),k.argA,k.argB);C&&Ve(r.errors,y,V),tf(r.errors,y)}if((d.touchedFields||f.touchedFields)&&A&&Array.isArray(te(r.touchedFields,y))){const V=T(te(r.touchedFields,y),k.argA,k.argB);C&&Ve(r.touchedFields,y,V)}(d.dirtyFields||f.dirtyFields)&&(r.dirtyFields=gr(o,s)),p.state.next({name:y,isDirty:H(y,b),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ve(s,y,b)},x=(y,b)=>{Ve(r.errors,y,b),p.state.next({errors:r.errors})},O=y=>{r.errors=y,p.state.next({errors:r.errors,isValid:!1})},N=(y,b,T,k)=>{const C=te(n,y);if(C){const A=te(s,y,Ke(T)?te(o,y):T);Ke(A)||k&&k.defaultChecked||b?Ve(s,y,b?A:Ci(C._f)):Q(y,A),i.mount&&!i.action&&v(
vendor: 8,790 bytes, line 177
177)}},E=(y,b,T,k,C)=>{let A=!1,V=!1;const Z={name:y};if(!t.disabled){if(!T||k){(d.isDirty||f.isDirty)&&(V=r.isDirty,r.isDirty=Z.isDirty=H(),A=V!==Z.isDirty);const se=nr(te(o,y),b);V=!!te(r.dirtyFields,y),se?et(r.dirtyFields,y):Ve(r.dirtyFields,y,!0),Z.dirtyFields=r.dirtyFields,A=A||(d.dirtyFields||f.dirtyFields)&&V!==!se}if(T){const se=te(r.touchedFields,y);se||(Ve(r.touchedFields,y,T),Z.touchedFields=r.touchedFields,A=A||(d.touchedFields||f.touchedFields)&&se!==T)}A&&C&&p.state.next(Z)}return A?Z:{}},S=(y,b,T,k)=>{const C=te(r.errors,y),A=(d.isValid||f.isValid)&&Ot(b)&&r.isValid!==b;if(t.delayError&&T?(l=w(()=>x(y,T)),l(t.delayError)):(clearTimeout(c),l=null,T?Ve(r.errors,y,T):et(r.errors,y)),(T?!nr(C,T):C)||!dt(k)||A){const V={...k,...A&&Ot(b)?{isValid:b}:{},errors:r.errors,name:y};r={...r,...V},p.state.next(V)}},I=async y=>(m(y,!0),await t.resolver(s,t.context,Yh(y||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),F=async y=>{const{errors:b}=await I(y);if(m(y),y)for(const T of y){const k=te(b,T);k?Ve(r.errors,T,k):et(r.errors,T)}else r.errors=b;return b},M=async(y,b,T={valid:!0})=>{for(const k in y){const C=y[k];if(C){const{_f:A,...V}=C;if(A){const Z=a.array.has(A.name),se=C._f&&Xh(C._f);se&&d.validatingFields&&m([A.name],!0);const ue=await Ri(C,a.disabled,s,_,t.shouldUseNativeValidation&&!b,Z);if(se&&d.validatingFields&&m([A.name]),ue[A.name]&&(T.valid=!1,b))break;!b&&(te(ue,A.name)?Z?rf(r.errors,ue,A.name):Ve(r.errors,A.name,ue[A.name]):et(r.errors,A.name))}!dt(V)&&await M(V,b,T)}}return T.valid},J=()=>{for(const y of a.unMount){const b=te(n,y);b&&(b._f.refs?b._f.refs.every(T=>!po(T)):!po(b._f.ref))&&W(y)}a.unMount=new Set},H=(y,b)=>!t.disabled&&(y&&b&&Ve(s,y,b),!nr(Me(),o)),j=(y,b,T)=>Wh(y,a,{...i.mount?s:Ke(b)?o:mt(y)?{[y]:b}:b},T,b),P=y=>fs(te(i.mount?s:o,y,t.shouldUnregister?te(o,y,[]):[])),Q=(y,b,T={})=>{const k=te(n,y);let C=b;if(k){const A=k._f;A&&(!A.disabled&&Ve(s,y,yl(b,A)),C=zn(A.ref)&&ft(b)?"":b,ml(A.ref)?[...A.ref.options].forEach(V=>V.selected=C.includes(V.value)):A.refs?rn(A.ref)?A.refs.forEach(V=>{(!V.defaultChecked||!V.disabled)&&(Array.isArray(C)?V.checked=!!C.find(Z=>Z===V.value):V.checked=C===V.value||!!C)}):A.refs.forEach(V=>V.checked=V.value===C):ms(A.ref)?A.ref.value="":(A.ref.value=C,A.ref.type||p.state.next({name:y,values:it(s)})))}(T.shouldDirty||T.shouldTouch)&&E(y,C,T.shouldTouch,T.shouldDirty,!0),T.shouldValidate&&ye(y)},$=(y,b,T)=>{for(const k in b){if(!b.hasOwnProperty(k))return;const C=b[k],A=y+"."+k,V=te(n,A);(a.array.has(y)||nt(C)||V&&!V._f)&&!ur(C)?$(A,C,T):Q(A,C,T)}},le=(y,b,T={})=>{const k=te(n,y),C=a.array.has(y),A=it(b);Ve(s,y,A),C?(p.array.next({name:y,values:it(s)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&T.shouldDirty&&p.state.next({name:y,dirtyFields:gr(o,s),isDirty:H(y,A)})):k&&!k._f&&!ft(A)?$(y,A,T):Q(y,A,T),Ei(y,a)&&p.state.next({...r,name:y}),p.state.next({name:i.mount?y:void 0,values:it(s)})},oe=async y=>{i.mount=!0;const b=y.target;let T=b.name,k=!0;const C=te(n,T),A=se=>{k=Number.isNaN(se)||ur(se)&&isNaN(se.getTime())||nr(se,te(s,T,se))},V=Ti(t.mode),Z=Ti(t.reValidateMode);if(C){let se,ue;const Ze=b.type?Ci(C._f):Dh(y),Ge=y.type===vi.BLUR||y.type===vi.FOCUS_OUT,yt=!Zh(C._f)&&!t.resolver&&!te(r.errors,T)&&!C._f.deps||ef(Ge,te(r.touchedFields,T),r.isSubmitted,Z,V),Xt=Ei(T,a,Ge);Ve(s,T,Ze),Ge?(!b||!b.readOnly)&&(C._f.onBlur&&C._f.onBlur(y),l&&l(0)):C._f.onChange&&C._f.onChange(y);const Zt=E(T,Ze,Ge),Vt=!dt(Zt)||Xt;if(!Ge&&p.state.next({name:T,type:y.type,values:it(s)}),yt)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?Ge&&v():Ge||v()),Vt&&p.state.next({name:T,...Xt?{}:Zt});if(!Ge&&Xt&&p.state.next({...r}),t.resolver){const{errors:cr}=await I([T]);if(m([T]),A(Ze),k){const Rt=Ai(r.errors,n,T),Qt=Ai(cr,n,Rt.name||T);se=Qt.error,T=Qt.name,ue=dt(cr)}}else m([T],!0),se=(await Ri(C,a.disabled,s,_,t.shouldUseNativeValidation))[T],m([T]),A(Ze),k&&(se?ue=!1:(d.isValid||f.isValid)&&(ue=await M(n,!0)));k&&(C._f.deps&&(!Array.isArray(C._f.deps)||C._f.deps.length>0)&&ye(C._f.deps),S(T,ue,se,Zt))}},pe=(y,b)=>{if(te(r.errors,b)&&y.focus)return y.focus(),1},ye=async(y,b={})=>{let T,k;const C=Pr(y);if(t.resolver){const A=await F(Ke(y)?y:C);T=dt(A),k=y?!C.some(V=>te(A,V)):T}else y?(k=(await Promise.all(C.map(async A=>{const V=te(n,A);return await M(V&&V._f?{[A]:V}:V)}))).every(Boolean),!(!k&&!r.isValid)&&v()):k=T=await M(n);return p.state.next({...!mt(y)||(d.isValid||f.isValid)&&T!==r.isValid?{}:{name:y},...t.resolver||!y?{isValid:T}:{},errors:r.errors}),b.shouldFocus&&!k&&zr(n,pe,y?C:a.mount),k},Me=(y,b)=>{let T={...i.mount?s:o};return b&&(T=pl(b.dirtyFields?r.dirtyFields:r.touchedFields,T)),Ke(y)?T:mt(y)?te(T,y):y.map(k=>te(T,k))},Be=(y,b)=>({invalid:!!te((b||r).errors,y),isDirty:!!te((b||r).dirtyFields,y),error:te((b||r).errors,y),isValidating:!!te(r.validatingFields,y),isTouched:!!te((b||r).touchedFields,y)}),Re=y=>{y&&Pr(y).forEach(b=>et(r.errors,b)),p.state.next({errors:y?r.errors:{}})},Je=(y,b,T)=>{const k=(te(n,y,{_f:{}})._f||{}).ref,{ref:C,message:A,type:V,...Z}=te(r.errors,y)||{};Ve(r.errors,y,{...Z,...b,ref:k}),p.state.next({name:y,errors:r.errors,isValid:!1}),T&&T.shouldFocus&&k&&k.focus&&k.focus()},ut=(y,b)=>Ct(y)?p.state.subscribe({next:T=>"values"in T&&y(j(void 0,b),T)}):j(y,b,!0),Ye=y=>p.state.subscribe({next:b=>{$h(y.name,b.name,y.exact)&&Qh(b,y.formState||d,ie,y.reRenderRoot)&&y.callback({values:{...s},...r,...b,defaultValues:o})}}).unsubscribe,Xe=y=>(i.mount=!0,f={...f,...y.formState},Ye({...y,formState:{...h,...y.formState}})),W=(y,b={})=>{for(const T of y?Pr(y):a.mount)a.mount.delete(T),a.array.delete(T),b.keepValue||(et(n,T),et(s,T)),!b.keepError&&et(r.errors,T),!b.keepDirty&&et(r.dirtyFields,T),!b.keepTouched&&et(r.touchedFields,T),!b.keepIsValidating&&et(r.validatingFields,T),!t.shouldUnregister&&!b.keepDefaultValue&&et(o,T);p.state.next({values:it(s)}),p.state.next({...r,...b.keepDirty?{isDirty:H()}:{}}),!b.keepIsValid&&v()},ce=({disabled:y,name:b})=>{(Ot(y)&&i.mount||y||a.disabled.has(b))&&(y?a.disabled.add(b):a.disabled.delete(b))},Ce=(y,b={})=>{let T=te(n,y);const k=Ot(b.disabled)||Ot(t.disabled);return Ve(n,y,{...T||{},_f:{...T&&T._f?T._f:{ref:{name:y}},name:y,mount:!0,...b}}),a.mount.add(y),T?ce({disabled:Ot(b.disabled)?b.disabled:t.disabled,name:y}):N(y,!0,b.value),{...k?{disabled:b.disabled||t.disabled}:{},...t.progressive?{required:!!b.required,min:Rr(b.min),max:Rr(b.max),minLength:Rr(b.minLength),maxLength:Rr(b.maxLength),pattern:Rr(b.pattern)}:{},name:y,onChange:oe,onBlur:oe,ref:C=>{if(C){Ce(y,b),T=te(n,y);const A=Ke(C.value)&&C.querySelectorAll&&C.querySelectorAll("input,select,textarea")[0]||C,V=qh(A),Z=T._f.refs||[];if(V?Z.find(se=>se===A):A===T._f.ref)return;Ve(n,y,{_f:{...T._f,...V?{refs:[...Z.filter(po),A,...Array.isArray(te(o,y))?[{}]:[]],ref:{type:A.type,name:y}}:{ref:A}}}),N(y,!1,void 0,A)}else T=te(n,y,{}),T._f&&(T._f.mount=!1),(t.shouldUnregister||b.shouldUnregister)&&!(zh(a.array,y)&&i.action)&&a.unMount.add(y)}}},L=()=>t.shouldFocusError&&zr(n,pe,a.mount),R=y=>{Ot(y)&&(p.state.next({disabled:y}),zr(n,(b,T)=>{const k=te(n,T);k&&(b.disabled=k._f.disabled||y,Array.isArray(k._f.refs)&&k._f.refs.forEach(C=>{C.disabled=k._f.disabled||y}))},0,!1))},D=(y,b)=>async T=>{let k;T&&(T.preventDefault&&T.preventDefault(),T.persist&&T.persist());let C=it(s);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:A,values:V}=await I();m(),r.errors=A,C=it(V)}else await M(n);if(a.disabled.size)for(const A of a.disabled)et(C,A);if(et(r.errors,"root"),dt(r.errors)){p.state.next({errors:{}});try{await y(C,T)}catch(A){k=A}}else b&&await b({...r.errors},T),L(),setTimeout(L);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:dt(r.errors)&&!k,submitCount:r.submitCount+1,errors:r.errors}),k)throw k},K=(y,b={})=>{te(n,y)&&(Ke(b.defaultValue)?le(y,it(te(o,y))):(le(y,b.defaultValue),Ve(o,y,it(b.defaultValue))),b.keepTouched||et(r.touchedFields,y),b.keepDirty||(et(r.dirtyFields,y),r.isDirty=b.defaultValue?H(y,it(te(o,y))):H()),b.keepError||(et(r.errors,y),d.isValid&&v()),p.state.next({...r}))},G=(y,b={})=>{const T=y?it(y):o,k=it(T),C=dt(y),A=C?o:k;if(b.keepDefaultValues||(o=T),!b.keepValues){if(b.keepDirtyValues){const V=new Set([...a.mount,...Object.keys(gr(o,s))]);for(const Z of Array.from(V))te(r.dirtyFields,Z)?Ve(A,Z,te(s,Z)):le(Z,te(A,Z))}else{if(hs&&Ke(y))for(const V of a.mount){const Z=te(n,V);if(Z&&Z._f){const se=Array.isArray(Z._f.refs)?Z._f.refs[0]:Z._f.ref;if(zn(se)){const ue=se.closest("form");if(ue){ue.reset();break}}}}if(b.keepFieldsRef)for(const V of a.mount)le(V,te(A,V));else n={}}s=t.shouldUnregister?b.keepDefaultValues?it(o):{}:it(A),p.array.next({values:{...A}}),p.state.next({values:{...A}})}a={mount:b.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""}
177,i.mount=!d.isValid||!!b.keepIsValid||!!b.keepDirtyValues||!t.shouldUnregister&&!dt(A),i.watch=!!t.shouldUnregister,i.keepIsValid=!!b.keepIsValid,i.action=!1,b.keepErrors||(r.errors={}),p.state.next({submitCount:b.keepSubmitCount?r.submitCount:0,isDirty:C?!1:b.keepDirty?r.isDirty:!!(b.keepDefaultValues&&!nr(y,o)),isSubmitted:b.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:C?{}:b.keepDirtyValues?b.keepDefaultValues&&s?gr(o,s):r.dirtyFields:b.keepDefaultValues&&y?gr(o,y):b.keepDirty?r.dirtyFields:{},touchedFields:b.keepTouched?r.touchedFields:{},errors:b.keepErrors?r.errors:{},isSubmitSuccessful:b.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},X=(y,b)=>G(Ct(y)?y(s):y,{...t.resetOptions,...b}),q=(y,b={})=>{const T=te(n,y),k=T&&T._f;if(k){const C=k.refs?k.refs[0]:k.ref;C.focus&&setTimeout(()=>{C.focus(),b.shouldSelect&&Ct(C.select)&&C.select()})}},ie=y=>{r={...r,...y}},Fe={control:{register:Ce,unregister:W,getFieldState:Be,handleSubmit:D,setError:Je,_subscribe:Ye,_runSchema:I,_updateIsValidating:m,_focusError:L,_getWatch:j,_getDirty:H,_setValid:v,_setFieldArray:g,_setDisabledField:ce,_setErrors:O,_getFieldArray:P,_reset:G,_resetDefaultValues:()=>Ct(t.defaultValues)&&t.defaultValues().then(y=>{X(y,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:J,_disableForm:R,_subjects:p,_proxyFormState:d,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(y){i=y},get _defaultValues(){return o},get _names(){return a},set _names(y){a=y},get _formState(){return r},get _options(){return t},set _options(y){t={...t,...y}}},subscribe:Xe,trigger:ye,register:Ce,handleSubmit:D,watch:ut,setValue:le,getValues:Me,reset:X,resetField:K,clearErrors:Re,unregister:W,setError:Je,setFocus:q,getFieldState:Be};return{...Fe,formControl:Fe}}function sf(e={}){const t=B.useRef(void 0),r=B.useRef(void 0),[n,o]=B.useState({isDirty:!1,isValidating:!1,isLoading:Ct(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Ct(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Ct(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=of(e);t.current={...a,formState:n}}const s=t.current.control;return s._options=e,Uh(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),s._formState.isReady=!0,i},[s]),B.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),B.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),B.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),B.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),B.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),B.useEffect(()=>{var i;e.values&&!nr(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((i=s._options.resetOptions)===null||i===void 0)&&i.keepIsValid||s._setValid(),r.current=e.values,o(a=>({...a}))):s._resetDefaultValues()},[s,e.values]),B.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=Vh(n,s),t.current}var af=({isOpen:e,onClose:t})=>{const{login:r,register:n}=os(),{siteConfig:o,themeId:s}=ds(),[i,a]=ee("login"),[l,c]=ee(!1),[h,d]=ee(""),{register:f,handleSubmit:p,reset:_,formState:{errors:w}}=sf({mode:"onChange"});if(xe(()=>{e&&_()},[e,i,_]),!e)return null;const v=async x=>{c(!0);try{i==="login"?(await r({username:x.username,password:x.password}),t()):(await n({username:x.username,password:x.password,phone:x.phone,name:x.displayName}),await r({username:x.username,password:x.password},!1),t(),_())}catch(O){console.error(O)}finally{c(!1)}},m=s==="default"&&o?.primary_color||"var(--chat-primary)",g=x=>{a(x),_()};return u("div",{className:"tw-fixed tw-inset-0 tw-z-[999999] tw-flex tw-justify-center tw-bg-black/50 tw-backdrop-blur-sm tw-overflow-y-auto tw-p-4 tw-py-6",onClick:t,children:u("div",{className:"chat-modal-card tw-text-chat-text-main tw-w-full tw-max-w-md tw-relative tw-flex tw-flex-col tw-min-h-0 tw-my-auto tw-max-h-[calc(100dvh-3rem)]",onClick:x=>x.stopPropagation(),children:[u("div",{className:"tw-flex tw-border-b tw-border-chat-border tw-shrink-0",children:[u("div",{className:Le("chat-tab",i==="login"?"chat-tab-active":"chat-tab-inactive"),onClick:()=>g("login"),style:i==="login"?{color:m,borderColor:m,borderWidth:"0 0 2px 0"}:{},children:"Đăng nhập"}),u("div",{className:Le("chat-tab",i==="register"?"chat-tab-active":"chat-tab-inactive"),onClick:()=>g("register"),style:i==="register"?{color:m,borderColor:m,borderWidth:"0 0 2px 0"}:{},children:"Đăng ký"})]}),u("div",{className:"tw-flex-1 tw-min-h-0 tw-overflow-y-auto no-scrollbar tw-p-4 sm:tw-p-6",children:u("form",{onSubmit:p(v),className:"tw-space-y-3 sm:tw-space-y-4",children:[u("div",{children:[u("label",{className:"chat-form-label",children:["Tên đăng nhập                                 ",u("span",{className:"chat-text-required",children:"*"})]}),u("div",{className:"chat-form-field",children:[u("div",{className:"chat-input-icon",children:u(Oh,{className:"tw-text-chat-text-muted"})}),u("input",{type:"text",...f("username",{required:"Vui lòng nhập tên đăng nhập",minLength:{value:3,message:"Tên đăng nhập phải có ít nhất 3 ký tự"},pattern:{value:/^[A-Za-z][A-Za-z0-9_]*$/,message:"Tên đăng nhập phải bắt đầu bằng chữ và không chứa khoảng trắng"}}),className:Le("chat-input-auth",w.username?"tw-border-red-500":"tw-border-chat-border"),style:{"--tw-ring-color":m},placeholder:"Nhập tên đăng nhập"})]}),w.username&&u("p",{className:"chat-text-error",children:w.username.message})]}),u("div",{children:[u("label",{className:"chat-form-label",children:["Mật khẩu                                 ",u("span",{className:"chat-text-required",children:"*"})]}),u("div",{className:"chat-form-field",children:[u("div",{className:"chat-input-icon",children:u(Rh,{className:"tw-text-chat-text-muted"})}),u("input",{type:"password",...f("password",{required:"Vui lòng nhập mật khẩu",minLength:{value:6,message:"Mật khẩu phải có ít nhất 6 ký tự"}}),className:Le("chat-input-auth",w.password?"tw-border-red-500":"tw-border-chat-border"),style:{"--tw-ring-color":m},placeholder:"Nhập mật khẩu"})]}),w.password&&u("p",{className:"chat-text-error",children:w.password.message})]}),i==="register"&&u(ct,{children:[u("div",{children:[u("label",{className:"chat-form-label",children:["Tên hiển thị                                 ",u("span",{className:"chat-text-required",children:"*"})]}),u("div",{className:"chat-form-field",children:[u("div",{className:"chat-input-icon",children:u(Nh,{className:"tw-text-chat-text-muted"})}),u("input",{type:"text",maxLength:18,...f("displayName",{required:"Vui lòng nhập tên hiển thị",minLength:{value:3,message:"Tên hiển thị phải có ít nhất 3 ký tự"},maxLength:{value:18,message:"Tên hiển thị không được quá 18 ký tự"}}),className:Le("chat-input-auth",w.displayName?"tw-border-red-500":"tw-border-chat-border"),style:{"--tw-ring-color":m},placeholder:"Nhập tên hiển thị"})]}),w.displayName&&u("p",{className:"chat-text-error",children:w.displayName.message})]}),u("div",{children:[u("label",{className:"chat-form-label",children:["Số điện thoại                                 ",u("span",{className:"chat-text-required",children:"*"})]}),u("div",{className:"chat-form-field",children:[u("div",{className:"chat-input-icon",children:u(Ah,{className:"tw-text-chat-text-muted"})}),u("input",{type:"tel",maxLength:11,...f("phone",{required:"Vui lòng nhập số điện thoại",pattern:{value:/^[0-9]{10,11}$/,message:"Số điện thoại không hợp lệ (10-11 số)"}}),className:Le("chat-input-auth",w.phone?"tw-border-red-500":"tw-border-chat-border"),style:{"--tw-ring-color":m},placeholder:"Nhập số điện thoại"})]}),w.phone&&u("p",{className:"chat-text-error",children:w.phone.message})]})]}),u("button",{type:"submit",disabled:l,className:"chat-btn-primary tw-w-full tw-mt-4 sm:tw-mt-6",style:{backgroundColor:m},children:l?"Đang xử lý...":i==="login"?"Đăng nhập":"Đăng ký"})]})})]})})},lf=af,cf=({isOpen:e,onClose:t,userToBlock:r})=>{const[n,o]=ee(0),[s,i]=ee(""),[a,l]=ee(!1);return!e||!r?null:u("div",{className:"chat-modal-overlay tw-z-50",children:u("div",{className:"chat-modal-card tw-w-full tw-max-w-sm tw-overflow-hidden",children:[u("div",{className:"chat-modal-header",children:[u("h3",{className:"tw-text-chat-text-muted tw-font-bold",children:"Chặn người dùng"}),u("button",{onClick:t,className:"tw-text-chat-text-muted hover:tw-text-white",children:"✕"})]}),u("form",{onSubmit:async h=>{h.preventDefault(),l(!0);try{await Tu({user_id:r.uid,anonymous_id:r.anonymousId,reason:s,minutes:parseInt(n)}),Oe.success(`Đã chặn ${r.name||r.sender}`),t()}catch(d){Oe.error(d.response?.data?.error?.message||"Chặn thất bại")}finally{l(!1)}},className:"chat-modal-body",children:[u("div",{className:"tw-text-sm tw-text-chat-text-main",children:["Bạn đang chặn: ",u("span",{className:"tw-font-bold tw-text-[#d4a055]",children:r.name||r.sender})]}),u("div",{children:[u("label",{className:"tw-block chat-text-muted-xs tw-mb-1",children:"Thời gian chặn (phút)"}),u("select",{value:n,onChange:h=>o(h.target.value),className:"chat-input",children:[u("option",{value:"0",children:"Vĩnh viễn"}),u("option",{value:"60",children:"1 Giờ"}),u("option",{value:"1440",children:"24 Giờ"}),u("option",{value:"10080",children:"7 Ngày"}),u("option",{value:"43200",children:"30 Ngày"})]})]}),u("div",{children:[u("label",{className:"tw-block chat-text-muted-xs tw-mb-1",children:"Lý do (tùy chọn)"}),u("textarea",{value:s,onChange:h=>i(h.target.value),placeholder:"Nhập lý do...",rows:3,className:"chat-input tw-resize-none"})]}),u("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-pt-2",children:[u("button",{type:"button",onClick:t,className:"chat-btn-ghost",children:"Hủy"}),u("button",{type:"submit",disabled:a,className:"chat-btn-danger tw-px-4 tw-py-2 tw-text-sm disabled:tw-opacity-50",children:a?"Đang chặn...":"Xác nhận chặn"})]})]})]})})},uf=cf,df=({isOpen:e,title:t,message:r,onConfirm:n,onCancel:o,confirmText:s="Xác nhận",cancelText:i="Hủy",isDanger:a=!1})=>{const{siteConfig:l}=pr();if(!e)return null;const c=l?.theme_mode==="dark";return u("div",{className:"chat-modal-overlay tw-z-[60]",children:u("div",{className:"chat-modal-card tw-w-full tw-max-w-xs tw-overflow-hidden tw-animate-fade-in",children:[u("div",{className:"tw-p-4 tw-text-center",children:[t&&u("h3",{className:(c?"tw-text-white":"tw-text-black")+" tw-font-bold tw-mb-2",children:t}),u("p",{className:"tw-text-chat-text-main tw-text-sm",children:r})]}),u("div",{className:"tw-flex tw-border-t tw-border-chat-border",children:[u("button",{onClick:o,className:"chat-modal-btn tw-text-chat-text-main tw-border-r tw-border-chat-border",children:i}),u("button",{onClick:n,className:`chat-modal-btn tw-font-bold ${a?"chat-text-required":"tw-text-chat-primary"}`,children:s})]})]})})},hf=df,ff=({className:e})=>
177u("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:e,children:u("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1.8 13.8H7.9V14.7l1.7-2.1H7.9v-.8h2.3v.7l-1.7 2.1h1.7v.7zm2.5 0h-2.5v-3.7h.8v2.9h1.7v.8zm2.8-.8c-.3.6-.9.8-1.6.8s-1.3-.2-1.6-.8a2.5 2.5 0 0 1-.4-1.5c0-.6.1-1.1.4-1.5.3-.6.9-.8 1.6-.8s1.3.2 1.6.8c.3.4.4.9.4 1.5s-.1 1.1-.4 1.5zm-1-1.8c.2-.3.2-.7.2-1.1s-.1-.8-.2-1.1c-.2-.3-.5-.4-.9-.4s-.7.1-.9.4c-.2.3-.2.7-.2 1.1s.1.8.2 1.1c.2.3.5.4.9.4s.7-.1.9-.4zm4.3 2.6H17v-3.7h.8v2.9h1.7v.8z"})}),pf=(e,t)=>{switch(e?.toLowerCase()){case"facebook":return u(cu,{className:t});case"youtube":return u(hu,{className:t});case"telegram":return u(uu,{className:t});case"tiktok":return u(du,{className:t});case"zalo":return u(ff,{className:t});case"forum":return u(pu,{className:t});default:return null}},mf=({isConnected:e,isChatEnabled:t,onToggleChat:r})=>{const{siteConfig:n,themeId:o,user:s,handleLogout:i}=ds(),[a,l]=ee(!1),c=me(null),h=n?.social_links||[];return xe(()=>{const d=f=>{const p=f.composedPath?f.composedPath():[f.target];c.current&&!p.includes(c.current)&&l(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]),u("div",{className:"chat-header chat-row-between tw-px-3 tw-border-b tw-border-chat-border tw-select-none tw-bg-transparent",children:[u("div",{className:"tw-flex tw-items-center tw-gap-1.5 tw-flex-1 tw-min-w-0",children:t&&h&&h.length>0&&u("div",{className:"tw-flex tw-items-center tw-gap-1.5 tw-w-full header-social-bar",children:h.slice(0,3).map((d,f)=>{const p=pf(d.icon,"tw-w-3.5 tw-h-3.5 tw-transition-colors tw-shrink-0");return p?u("a",{href:d.link,target:"_blank",rel:"nofollow noopener",className:`chat-social-btn chat-social-btn-${d.icon?.toLowerCase()}`,title:d.label||d.icon,children:[p,d.label&&u("span",{className:"tw-truncate tw-whitespace-nowrap",children:d.label})]},f):null})})}),t&&h&&h.length>0&&u("div",{className:"tw-h-5 tw-w-[1px] tw-mx-2 tw-shrink-0 tw-bg-chat-border"}),u("div",{className:"tw-flex tw-items-center tw-shrink-0",children:u("div",{className:"tw-relative",ref:c,children:[u("button",{onClick:()=>l(!a),className:"tw-flex tw-items-center tw-justify-center tw-rounded tw-border tw-transition-all cursor-pointer tw-shrink-0 tw-py-1.5 tw-px-2 tw-bg-chat-input-bg tw-border-chat-border tw-text-chat-text-muted hover:tw-text-chat-text-main hover:tw-border-chat-text-muted",title:"Thiết lập",children:u(Mh,{className:"tw-text-[14px] tw-transition-transform hover:tw-rotate-45"})}),a&&u("div",{className:"chat-settings-dropdown tw-absolute tw-right-0 tw-mt-1.5 tw-w-28 tw-bg-chat-bg tw-border tw-border-chat-border tw-rounded tw-shadow-xl tw-py-1 tw-z-40",children:[u("button",{onClick:()=>{r(),l(!1)},className:"tw-w-full tw-text-left tw-px-3 tw-py-1.5 tw-text-xs tw-text-chat-text-muted hover:tw-text-chat-text-main hover:tw-bg-white/5 tw-transition-colors tw-flex tw-items-center tw-gap-1.5 cursor-pointer",children:[u(ru,{className:"tw-text-[10px]"}),t?"Tắt chat":"Bật chat"]}),s&&u("button",{onClick:()=>{i(),l(!1)},className:"tw-w-full tw-text-left tw-px-3 tw-py-1.5 tw-text-xs tw-text-chat-text-muted hover:tw-text-red-500 hover:tw-bg-white/5 tw-transition-colors tw-flex tw-items-center tw-gap-1.5 cursor-pointer chat-auth-logout-btn",title:"Rời phòng",children:[u(mu,{className:"tw-text-[10px]"}),"Rời phòng"]})]})]})})]})},gf=mf,_f=({activeTab:e,onTabChange:t})=>u("div",{className:"tw-h-12 tw-bg-chat-bg chat-row-between tw-px-4 tw-border-b tw-border-chat-border tw-shrink-0 tw-hidden",children:u("div",{className:"tw-flex tw-items-center tw-w-full",children:[u("div",{onClick:r=>{r.preventDefault(),r.stopPropagation(),t("match")},className:Le("chat-tab",e==="match"?"chat-tab-active":"chat-tab-inactive"),children:"Trận này"}),u("div",{onClick:r=>{r.preventDefault(),r.stopPropagation(),t("general")},className:Le("chat-tab",e==="general"?"chat-tab-active":"chat-tab-inactive"),children:"Chung"})]})}),yf=_f,Yn=0,ar=1,Cr=2,vl=4;function Oi(e){return()=>e}function wf(e){e()}function Wr(e,t){return r=>e(t(r))}function Li(e,t){return()=>e(t)}function vf(e,t){return r=>e(t,r)}function _s(e){return e!==void 0}function bf(...e){return()=>{e.map(wf)}}function Tr(){}function Xn(e,t){return t(e),e}function xf(e,t){return t(e)}function He(...e){return e}function Ae(e,t){return e(ar,t)}function ve(e,t){e(Yn,t)}function ys(e){e(Cr)}function We(e){return e(vl)}function re(e,t){return Ae(e,vf(t,Yn))}function It(e,t){const r=e(ar,n=>{r(),t(n)});return r}function Mi(e){let t,r;return n=>o=>{t=o,r&&clearTimeout(r),r=setTimeout(()=>{n(t)},e)}}function bl(e,t){return e===t}function Pe(e=bl){let t;return r=>n=>{e(t,n)||(t=n,r(n))}}function fe(e){return t=>r=>{e(r)&&t(r)}}function Y(e){return t=>Wr(t,e)}function Lt(e){return t=>()=>{t(e)}}function z(e,...t){const r=kf(...t);return((n,o)=>{switch(n){case Cr:ys(e);return;case ar:return Ae(e,r(o))}})}function Dt(e,t){return r=>n=>{r(t=e(t,n))}}function hr(e){return t=>r=>{e>0?e--:t(r)}}function qt(e){let t=null,r;return n=>o=>{t=o,!r&&(r=setTimeout(()=>{r=void 0,n(t)},e))}}function be(...e){const t=new Array(e.length);let r=0,n=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);Ae(s,l=>{const c=r;r=r|a,t[i]=l,c!==o&&r===o&&n&&(n(),n=null)})}),s=>i=>{const a=()=>{s([i].concat(t))};r===o?a():n=a}}function kf(...e){return t=>e.reduceRight(xf,t)}function Sf(e){let t,r;const n=()=>t?.();return function(o,s){switch(o){case ar:return s?r===s?void 0:(n(),r=s,t=Ae(e,s),t):(n(),Tr);case Cr:n(),r=null;return}}}function U(e){let t=e;const r=Se();return((n,o)=>{switch(n){case Yn:t=o;break;case ar:o(t);break;case vl:return t}return r(n,o)})}function lt(e,t){return Xn(U(t),r=>re(e,r))}function Se(){const e=[];return((t,r)=>
177{switch(t){case Yn:e.slice().forEach(n=>{n(r)});return;case Cr:e.splice(0,e.length);return;case ar:return e.push(r),()=>{const n=e.indexOf(r);n>-1&&e.splice(n,1)}}})}function _t(e){return Xn(Se(),t=>re(e,t))}function Te(e,t=[],{singleton:r}={singleton:!0}){return{constructor:e,dependencies:t,id:Cf(),singleton:r}}var Cf=()=>Symbol();function Tf(e){const t=new Map,r=({constructor:n,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=n(o.map(l=>r(l)));return i&&t.set(s,a),a};return r(e)}function tt(...e){const t=Se(),r=new Array(e.length);let n=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);Ae(s,l=>{r[i]=l,n=n|a,n===o&&ve(t,r)})}),function(s,i){switch(s){case Cr:ys(t);return;case ar:return n===o&&i(r),Ae(t,i)}}}function he(e,t=bl){return z(e,Pe(t))}function Vo(...e){return function(t,r){switch(t){case Cr:return;case ar:return bf(...e.map(n=>Ae(n,r)))}}}var pt=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(pt||{}),If={0:"debug",3:"error",1:"log",2:"warn"},Ef=()=>typeof globalThis>"u"?window:globalThis,sr=Te(()=>{const e=U(3);return{log:U((t,r,n=1)=>{var o;n>=((o=Ef().VIRTUOSO_LOG_LEVEL)!=null?o:We(e))&&console[If[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,r)}),logLevel:e}},[],{singleton:!0});function Ht(e,t,r){return ws(e,t,r).callbackRef}function ws(e,t,r){const n=B.useRef(null);let o=i=>{};const s=B.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};r?a():requestAnimationFrame(a)}):null,[e,r]);return o=i=>{i&&t?(s?.observe(i),n.current=i):(n.current&&s?.unobserve(n.current),n.current=null)},{callbackRef:o,ref:n}}function xl(e,t,r,n,o,s,i,a,l){return ws(B.useCallback(c=>{const h=Af(c.children,t,a?"offsetWidth":"offsetHeight",o);let d=c.parentElement;for(;!d.dataset.virtuosoScroller;)d=d.parentElement;const f=d.lastElementChild.dataset.viewportType==="window";let p;f&&(p=d.ownerDocument.defaultView);const _=i?a?i.scrollLeft:i.scrollTop:f?a?p.scrollX||p.document.documentElement.scrollLeft:p.scrollY||p.document.documentElement.scrollTop:a?d.scrollLeft:d.scrollTop,w=i?a?i.scrollWidth:i.scrollHeight:f?a?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight:a?d.scrollWidth:d.scrollHeight,v=i?a?i.offsetWidth:i.offsetHeight:f?a?p.innerWidth:p.innerHeight:a?d.offsetWidth:d.offsetHeight;n({scrollHeight:w,scrollTop:Math.max(_,0),viewportHeight:v}),s?.(a?Bi("column-gap",getComputedStyle(c).columnGap,o):Bi("row-gap",getComputedStyle(c).rowGap,o)),h!==null&&e(h)},[e,t,o,s,i,n,a]),r,l)}function Af(e,t,r,n){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const a=e.item(i);if(a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),c=parseFloat(a.dataset.knownSize),h=t(a,r);if(h===0&&n("Zero-sized element, this should not happen",{child:a},pt.ERROR),h===c)continue;const d=s[s.length-1];s.length===0||d.size!==h||d.endIndex!==l-1?s.push({endIndex:l,size:h,startIndex:l}):s[s.length-1].endIndex++}return s}function Bi(e,t,r){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&r(`${e} was not resolved to pixel value correctly`,t,pt.WARN),t==="normal"?0:parseInt(t??"0",10)}function vs(e,t,r){const n=B.useRef(null),o=B.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),h=c.width;let d,f;if(t){const p=t.getBoundingClientRect(),_=c.top-p.top;f=p.height-Math.max(0,_),d=_+t.scrollTop}else{const p=i.current.ownerDocument.defaultView;f=p.innerHeight-Math.max(0,c.top),d=c.top+p.scrollY}n.current={offsetTop:d,visibleHeight:f,visibleWidth:h},e(n.current)},[e,t]),{callbackRef:s,ref:i}=ws(o,!0,r),a=B.useCallback(()=>{o(i.current)},[o,i]);return B.useEffect(()=>{var l;if(t){t.addEventListener("scroll",a);const c=new ResizeObserver(()=>{requestAnimationFrame(a)});return c.observe(t),()=>{t.removeEventListener("scroll",a),c.unobserve(t)}}else{const c=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return c?.addEventListener("scroll",a),c?.addEventListener("resize",a),()=>{c?.removeEventListener("scroll",a),c?.removeEventListener("resize",a)}}},[a,t,i]),s}var ht=Te(()=>{const e=Se(),t=Se(),r=U(0),n=Se(),o=U(0),s=Se(),i=Se(),a=U(0),l=U(0),c=U(0),h=U(0),d=Se(),f=Se(),p=U(!1),_=U(!1),w=U(!1);return re(z(e,Y(({scrollTop:v})=>v)),t),re(z(e,Y(({scrollHeight:v})=>v)),i),re(t,o),{deviation:r,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:h,headerHeight:a,horizontalDirection:_,scrollBy:f,scrollC
vendor: 14,324 bytes, line 177
177ontainerState:e,scrollHeight:i,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:w,smoothScrollTargetReached:n,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),jr={lvl:0};function kl(e,t){const r=e.length;if(r===0)return[];let{index:n,value:o}=t(e[0]);const s=[];for(let i=1;i<r;i++){const{index:a,value:l}=t(e[i]);s.push({end:a-1,start:n,value:o}),n=a,o=l}return s.push({end:1/0,start:n,value:o}),s}function Ne(e){return e===jr}function qr(e,t){if(!Ne(e))return t===e.k?e.v:t<e.k?qr(e.l,t):qr(e.r,t)}function At(e,t,r="k"){if(Ne(e))return[-1/0,void 0];if(Number(e[r])===t)return[e.k,e.v];if(Number(e[r])<t){const n=At(e.r,t,r);return n[0]===-1/0?[e.k,e.v]:n}return At(e.l,t,r)}function gt(e,t,r){return Ne(e)?Tl(t,r,1):t===e.k?ot(e,{k:t,v:r}):t<e.k?Di(ot(e,{l:gt(e.l,t,r)})):Di(ot(e,{r:gt(e.r,t,r)}))}function yr(){return jr}function wr(e,t,r){if(Ne(e))return[];const n=At(e,t)[0];return Nf(Wo(e,n,r))}function Uo(e,t){if(Ne(e))return jr;const{k:r,l:n,r:o}=e;if(t===r){if(Ne(n))return o;if(Ne(o))return n;{const[s,i]=Cl(n);return Nn(ot(e,{k:s,l:Sl(n),v:i}))}}else return t<r?Nn(ot(e,{l:Uo(n,t)})):Nn(ot(e,{r:Uo(o,t)}))}function dr(e){return Ne(e)?[]:[...dr(e.l),{k:e.k,v:e.v},...dr(e.r)]}function Wo(e,t,r){if(Ne(e))return[];const{k:n,l:o,r:s,v:i}=e;let a=[];return n>t&&(a=a.concat(Wo(o,t,r))),n>=t&&n<=r&&a.push({k:n,v:i}),n<=r&&(a=a.concat(Wo(s,t,r))),a}function Nn(e){const{l:t,lvl:r,r:n}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(mo(t))return Il(ot(e,{lvl:r-1}));if(!Ne(t)&&!Ne(t.r))return ot(t.r,{l:ot(t,{r:t.r.l}),lvl:r,r:ot(e,{l:t.r.r,lvl:r-1})});throw new Error("Unexpected empty nodes")}else{if(mo(e))return jo(ot(e,{lvl:r-1}));if(!Ne(n)&&!Ne(n.l)){const o=n.l,s=mo(o)?n.lvl-1:n.lvl;return ot(o,{l:ot(e,{lvl:r-1,r:o.l}),lvl:o.lvl+1,r:jo(ot(n,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function ot(e,t){return Tl(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Sl(e){return Ne(e.r)?e.l:Nn(ot(e,{r:Sl(e.r)}))}function mo(e){return Ne(e)||e.lvl>e.r.lvl}function Cl(e){return Ne(e.r)?[e.k,e.v]:Cl(e.r)}function Tl(e,t,r,n=jr,o=jr){return{k:e,l:n,lvl:r,r:o,v:t}}function Di(e){return jo(Il(e))}function Il(e){const{l:t}=e;return!Ne(t)&&t.lvl===e.lvl?ot(t,{r:ot(e,{l:t.r})}):e}function jo(e){const{lvl:t,r}=e;return!Ne(r)&&!Ne(r.r)&&r.lvl===t&&r.r.lvl===t?ot(r,{l:ot(e,{r:r.l}),lvl:t+1}):e}function Nf(e){return kl(e,({k:t,v:r})=>({index:t,value:r}))}function El(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Gr(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var bs=Te(()=>({recalcInProgress:U(!1)}),[],{singleton:!0});function Al(e,t,r){return e[Fn(e,t,r)]}function Fn(e,t,r,n=0){let o=e.length-1;for(;n<=o;){const s=Math.floor((n+o)/2),i=e[s],a=r(i,t);if(a===0)return s;if(a===-1){if(o-n<2)return s-1;o=s-1}else{if(o===n)return s;n=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Rf(e,t,r,n){const o=Fn(e,t,n),s=Fn(e,r,n,o);return e.slice(o,s+1)}function Nt(e,t){return Math.round(e.getBoundingClientRect()[t])}function Zn(e){return!Ne(e.groupOffsetTree)}function xs({index:e},t){return t===e?0:t<e?-1:1}function Of(){return{groupIndices:[],groupOffsetTree:yr(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:yr()}}function Lf(e,t){let r=Ne(e)?0:1/0;for(const n of t){const{endIndex:o,size:s,startIndex:i}=n;if(r=Math.min(r,i),Ne(e)){e=gt(e,0,s);continue}const a=wr(e,i-1,o+1);if(a.some(Ff(n)))continue;let l=!1,c=!1;for(const{end:h,start:d,value:f}of a)l?(o>=d||s===f)&&(e=Uo(e,d)):(c=f!==s,l=!0),h>o&&o>=d&&f!==s&&(e=gt(e,o+1,f));c&&(e=gt(e,i,s))}return[e,r]}function Mf(e){return typeof e.groupIndex<"u"}function Bf({offset:e},t){return t===e?0:t<e?-1:1}function Kr(e,t,r){if(t.length===0)return 0;const{index:n,offset:o,size:s}=Al(t,e,xs),i=e-n,a=s*i+(i-1)*r+o;return a>0?a+r:a}function Nl(e,t){if(!Zn(t))return e;let r=0;for(;t.groupIndices[r]<=e+r;)r++;return e+r}function Rl(e,t,r){if(Mf(e))return t.groupIndices[e.groupIndex]+1;{let n=Nl(e.index==="LAST"?r:e.index,t);return n=Math.max(0,n,Math.min(r,n)),n}}function Df(e,t,r,n=0){return n>0&&(t=Math.max(t,Al(e,n,xs).offset)),kl(Rf(e,t,r,Bf),Hf)}function Pf(e,[t,r,n,o]){t.length>0&&n("received item sizes",t,pt.DEBUG);const s=e.sizeTree;let i=s,a=0;if(r.length>0&&Ne(s)&&t.length===2){const f=t[0].size,p=t[1].size;i=r.reduce((_,w)=>gt(gt(_,w,f),w+1,p),i)}else[i,a]=Lf(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:c,lastSize:h,offsetTree:d}=qo(e.offsetTree,a,i,o);return{groupIndices:r,groupOffsetTree:r.reduce((f,p)=>gt(f,p,Kr(p,d,o)),yr()),lastIndex:l,lastOffset:c,lastSize:h,offsetTree:d,sizeTree:i}}function zf(e){return dr(e).map(({k:t,v:r},n,o)=>{const s=o[n+1];return{endIndex:s?s.k-1:1/0,size:r,startIndex:t}})}function Pi(e,t){let r=0,n=0;for(;r<e;)r+=t[n+1]-t[n]-1,n++;return n-(r===e?0:1)}function qo(e,t,r,n){let o=e,s=0,i=0,a=0,l=0;if(t!==0){l=Fn(o,t-1,xs),a=o[l].offset;const c=At(r,t-1);s=c[0],i=c[1],o.length&&o[l].size===At(r,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:c,value:h}of wr(r,t,1/0)){const d=c-s,f=d*i+a+d*n;o.push({index:c,offset:f,size:h}),s=c,a=f,i=h}return{lastIndex:s,lastOffset:a,lastSize:i,offsetTree:o}}function Hf(e){return{index:e.index,value:e}}function Ff(e){const{endIndex:t,size:r,startIndex:n}=e;return o=>o.start===n&&(o.end===t||o.end===1/0)&&o.value===r}var Vf={offsetHeight:"height",offsetWidth:"width"},Ft=Te(([{log:e},{recalcInProgress:t}])=>{const r=Se(),n=Se(),o=lt(n,0),s=Se(),i=Se(),a=U(0),l=U([]),c=U(void 0),h=U(void 0),d=U(void 0),f=U(void 0),p=U((S,I)=>Nt(S,Vf[I])),_=U(void 0),w=U(0),v=Of(),m=lt(z(r,be(l,e,w),Dt(Pf,v),Pe()),v),g=lt(z(l,Pe(),Dt((S,I)=>({current:I,prev:S.current}),{current:[],prev:[]}),Y(({prev:S})=>S)),[]);re(z(l,fe(S=>S.length>0),be(m,w),Y(([S,I,F])=>{const M=S.reduce((J,H,j)=>gt(J,H,Kr(H,I.offsetTree,F)||j),yr());return{...I,groupIndices:S,groupOffsetTree:M}})),m),re(z(n,be(m),fe(([S,{lastIndex:I}])=>S<I),Y(([S,{lastIndex:I,lastSize:F}])=>[{endIndex:I,size:F,startIndex:S}])),r),re(c,h);const x=lt(z(c,Y(S=>S===void 0)),!0);re(z(h,fe(S=>S!==void 0&&Ne(We(m).sizeTree)),Y(S=>{const I=We(d),F=We(l).length>0;return I?F?[{endIndex:0,size:I,startIndex:0},{endIndex:1,size:S,startIndex:1}]:[]:[{endIndex:0,size:S,startIndex:0}]})),r),re(z(f,fe(S=>S!==void 0&&S.length>0&&Ne(We(m).sizeTree)),Y(S=>{const I=[];let F=S[0],M=0;for(let J=1;J<S.length;J++){const H=S[J];H!==F&&(I.push({endIndex:J-1,size:F,startIndex:M}),F=H,M=J)}return I.push({endIndex:S.length-1,size:F,startIndex:M}),I})),r),re(z(l,be(d,h),fe(([,S,I])=>S!==void 0&&I!==void 0),Y(([S,I,F])=>{const M=[];for(let J=0;J<S.length;J++){const H=S[J],j=S[J+1];M.push({startIndex:H,endIndex:H,size:I}),j!==void 0&&M.push({startIndex:H+1,endIndex:j-1,size:F})}return M})),r);const O=_t(z(r,be(m),Dt(({sizes:S},[I,F])=>({changed:F!==S,sizes:F}),{changed:!1,sizes:v}),Y(S=>S.changed)));Ae(z(a,Dt((S,I)=>({diff:S.prev-I,prev:I}),{diff:0,prev:0}),Y(S=>S.diff)),S=>{const{groupIndices:I}=We(m);if(S>0)ve(t,!0),ve(s,S+Pi(S,I));else if(S<0){const F=We(g);F.length>0&&(S-=Pi(-S,F)),ve(i,S)}}),Ae(z(a,be(e)),([S,I])=>{S<0&&I("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},pt.ERROR)});const N=_t(s);re(z(s,be(m),Y(([S,I])=>{const F=I.groupIndices.length>0,M=[],J=I.lastSize;if(F){const H=qr(I.sizeTree,0);let j=0,P=0;for(;j<S;){const $=I.groupIndices[P],le=I.groupIndices.length===P+1?1/0:I.groupIndices[P+1]-$-1;M.push({endIndex:$,size:H,startIndex:$}),M.push({endIndex:$+1+le-1,size:J,startIndex:$+1}),P++,j+=le+1}const Q=dr(I.sizeTree);return j!==S&&Q.shift(),Q.reduce(($,{k:le,v:oe})=>{let pe=$.ranges;return $.prevSize!==0&&(pe=[...$.ranges,{endIndex:le+S-1,size:$.prevSize,startIndex:$.prevIndex}]),{prevIndex:le+S,prevSize:oe,ranges:pe}},{prevIndex:S,prevSize:0,ranges:M}).ranges}return dr(I.sizeTree).reduce((H,{k:j,v:P})=>({prevIndex:j+S,prevSize:P,ranges:[...H.ranges,{endIndex:j+S-1,size:H.prevSize,startIndex:H.prevIndex}]}),{prevIndex:0,prevSize:J,ranges:[]}).ranges})),r);const E=_t(z(i,be(m,w),Y(([S,{offsetTree:I},F])=>Kr(-S,I,F))));return re(z(i,be(m,w),Y(([S,I,F])=>{if(I.groupIndices.length>0){if(Ne(I.sizeTree))return I;let M=yr();const J=We(g);let H=0,j=0,P=0;for(;H<-S;){P=J[j];const Q=J[j+1]-P-1;j++,H+=Q+1}if(M=dr(I.sizeTree).reduce((Q,{k:$,v:le})=>gt(Q,Math.max(0,$+S),le),M),H!==-S){const Q=qr(I.sizeTree,P);M=gt(M,0,Q);const $=At(I.sizeTree,-S+1)[1];M=gt(M,1,$)}return{...I,sizeTree:M,...qo(I.offsetTree,0,M,F)}}else{const M=dr(I.sizeTree).reduce((J,{k:H,v:j})=>gt(J,Math.max(0,H+S),j),yr());return{...I,sizeTree:M,...qo(I.offsetTree,0,M,F)}}})),m),{beforeUnshiftWith:N,data:_,defaultItemSize:h,firstItemIndex:a,fixedItemSize:c,fixedGroupSize:d,gap:w,groupIndices:l,heightEstimates:f,itemSize:p,listRefresh:O,shiftWith:i,shiftWithOffset:E,sizeRanges:r,sizes:m,statefulTotalCount:o,totalCount:n,trackItemSizes:x,unshiftWith:s}},He(sr,bs),{singleton:!0});function Uf(e){return e.reduce((t,r)=>(t.groupIndices.push(t.totalCount),t.totalCount+=r+1,t),{groupIndices:[],totalCount:0})}var Ol=Te(([{groupIndices:e,sizes:t,totalCount:r},{headerHeight:n,scrollTop:o}])=>{const s=Se(),i=Se(),a=_t(z(s,Y(Uf)));return re(z(a,Y(l=>l.totalCount)),r),re(z(a,Y(l=>l.groupIndices)),e),re(z(tt(o,t,n),fe(([l,c])=>Zn(c)),Y(([l,c,h])=>At(c.groupOffsetTree,Math.max(l-h,0),"v")[0]),Pe(),Y(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},He(Ft,ht)),lr=Te(([{log:e}])=>{const t=U(!1),r=_t(z(t,fe(n=>n),Pe()));return Ae(t,n=>{n&&We(e)("props updated",{},pt.DEBUG)}),{didMount:r,propsReady:t}},He(sr),{singleton:!0}),Wf=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Ll(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Wf)&&(t.behavior="auto"),t.offset||(t.offset=0),t}var nn=Te(([{gap:e,listRefresh:t,sizes:r,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:a,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:h,viewportHeight:d},{log:f}])=>{const p=Se(),_=Se(),w=U(0);let v=null,m=null,g=null;function x(){v&&(v(),v=null),g&&(g(),g=null),m&&(clearTimeout(m),m=null),ve(l,!1)}return re(z(p,be(r,d,n,w,a,i,f),be(e,s,o),Y(([[O,N,E,S,I,F,M,J],H,j,P])=>{const Q=Ll(O),{align:$,behavior:le,offset:oe}=Q,pe=S-1,ye=Rl(Q,N,pe);let Me=Kr(ye,N.offsetTree,H)+F;$==="end"?(Me+=j+At(N.sizeTree,ye)[1]-E+P,ye===pe&&(Me+=M)):$==="center"?Me+=(j+At(N.sizeTree,ye)[1]-E+P)/2:Me-=I,oe&&(Me+=oe);const Be=Re=>{x(),Re?(J("retrying to scroll to",{location:O},pt.DEBUG),ve(p,O)):(ve(_,!0),J("list did not change, scroll successful",{},pt.DEBUG))};if(x(),le==="smooth"){let Re=!1;g=Ae(t,Je=>{Re=Re||Je}),v=It(h,()=>{Be(Re)})}else v=It(z(t,jf(150)),Be);return m=setTimeout(()=>{x()},1200),ve(l,!0),J("scrolling from index to",{behavior:le,index:ye,top:Me},pt.DEBUG),{behavior:le,top:Me}})),c),{scrollTargetReached:_,scrollToIndex:p,topListHeight:w}},He(Ft,ht,sr),{singleton:!0});function jf(e){return t=>{const r=setTimeout(()=>{t(!1)},e);return n=>{n&&(t(!0),clearTimeout(r))}}}function ks(e,t){e==0?t():requestAnimationFrame(()=>{ks(e-1,t)})}function Ss(e,t){const r=t-1;return typeof e=="number"?e:e.index==="LAST"?r:e.index}var on=Te(([{defaultItemSize:e,listRefresh:t,sizes:r},{scrollTop:n},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const a=U(!0),l=U(0),c=U(!0);return re(z(i,be(l),fe(([h,d])=>!!d),Lt(!1)),a),re(z(i,be(l),fe(([h,d])=>!!d),Lt(!1)),c),Ae(z(tt(t,i),be(a,r,e,c),fe(([[,h],d,{sizeTree:f},p,_])=>h&&(!Ne(f)||_s(p))&&!d&&!_),be(l)),([,h])=>{It(o,()=>{ve(c,!0)}),ks(4,()=>{It(n,()=>{ve(a,!0)}),ve(s,h)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:a}},He(Ft,ht,nn,lr),{singleton:!0});function Ml(e,t){return Math.abs(e-t)<1.01}var Jr="up",Hr="down",qf="none",Gf={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Kf=0,sn=Te(([{footerHeight:e,headerHeight:t,scrollBy:r,scrollContainerState:n,scrollTop:o,viewportHeight:s}])=>{const i=U(!1),a=U(!0),l=Se(),c=Se(),h=U(4),d=U(Kf),f=lt(z(Vo(z(he(o),hr(1),Lt(!0)),z(he(o),hr(1),Lt(!1),Mi(100))),Pe()),!1),p=lt(z(Vo(z(r,Lt(!0)),z(r,Lt(!1),Mi(200))),Pe()),!1);re(z(tt(he(o),he(d)),Y(([g,x])=>g<=x),Pe()),a),re(z(a,qt(50)),c);const _=_t(z(tt(n,he(s),he(t),he(e),he(h)),Dt((g,[{scrollHeight:x,scrollTop:O},N,E,S,I])=>{const F=O+N-x>-I,M={scrollHeight:x,scrollTop:O,viewportHeight:N};if(F){let H,j;return O>g.state.scrollTop?(H="SCROLLED_DOWN",j=g.state.scrollTop-O):(H="SIZE_DECREASED",j=g.state.scrollTop-O||g.scrollTopDelta),{atBottom:!0,atBottomBecause:H,scrollTopDelta:j,state:M}}let J;return M.scrollHeight>g.state.scrollHeight?J="SIZE_INCREASED":N<g.state.viewportHeight?J="VIEWPORT_HEIGHT_DECREASING":O<g.state.scrollTop?J="SCROLLING_UPWARDS":J="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:J,state:M}},Gf),Pe((g,x)=>g&&g.atBottom===x.atBottom))),w=lt(z(n,Dt((g,{scrollHeight:x,scrollTop:O,viewportHeight:N})=>{if(Ml(g.scrollHeight,x))return{changed:!1,jump:0,scrollHeight:x,scrollTop:O};{const E=x-(O+N)<1;return g.scrollTop!==O&&E?{changed:!0,jump:g.scrollTop-O,scrollHeight:x,scrollTop:O}:{changed:!0,jump:0,scrollHeight:x,scrollTop:O}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),fe(g=>g.changed),Y(g=>g.jump)),0);re(z(_,Y(g=>g.atBottom)),i),re(z(i,qt(50)),l);const v=U(Hr);re(z(n,Y(({scrollTop:g})=>g),Pe(),Dt((g,x)=>We(p)?{direction:g.direction,prevScrollTop:x}:{direction:x<g.prevScrollTop?Jr:Hr,prevScrollTop:x},{direction:Hr,prevScrollTop:0}),Y(g=>g.direction)),v),re(z(n,qt(50),Lt(qf)),v);const m=U(0);return re(z(f,fe(g=>!g),Lt(0)),m),re(z(o,qt(100),be(f),fe(([g,x])=>x),Dt(([g,x],[O])=>[x,O],[0,0]),Y(([g,x])=>x-g)),m),{atBottomState:_,atBottomStateChange:l,atBottomThreshold:h,atTopStateChange:c,atTopThreshold:d,isAtBottom:i,isAtTop:a,isScrolling:f,lastJumpDueToItemResize:w,scrollDirection:v,scrollVelocity:m}},He(ht)),Yr="top",Xr="bottom",zi="none";function Hi(e,t,r){return typeof e=="number"?r===Jr&&t===Yr||r===Hr&&t===Xr?e:0:r===Jr?t===Yr?e.main:e.reverse:t===Xr?e.main:e.reverse}function Fi(e,t){var r;return typeof e=="number"?e:(r=e[t])!=null?r:0}var Cs=Te(([{deviation:e,fixedHeaderHeight:t,headerHeight:r,scrollTop:n,viewportHe
177ight:o}])=>{const s=Se(),i=U(0),a=U(0),l=U(0);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:i,visibleRange:lt(z(tt(he(n),he(o),he(r),he(s,Gr),he(l),he(i),he(t),he(e),he(a)),Y(([c,h,d,[f,p],_,w,v,m,g])=>{const x=c-m,O=w+v,N=Math.max(d-x,0);let E=zi;const S=Fi(g,Yr),I=Fi(g,Xr);return f-=m,f+=d+v,p+=d+v,p-=m,f>c+O-S&&(E=Jr),p<c-N+h+I&&(E=Hr),E!==zi?[Math.max(x-d-Hi(_,Yr,E)-S,0),x-N-v+h+Hi(_,Xr,E)+I]:null}),fe(c=>c!=null),Pe(Gr)),[0,0])}},He(ht),{singleton:!0});function Jf(e,t,r){if(Zn(t)){const n=Nl(e,t);return[{index:At(t.groupOffsetTree,n)[0],offset:0,size:0},{data:r?.[0],index:n,offset:0,size:0}]}return[{data:r?.[0],index:e,offset:0,size:0}]}var go={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Rn(e,t,r,n,o,s){const{lastIndex:i,lastOffset:a,lastSize:l}=o;let c=0,h=0;if(e.length>0){c=e[0].offset;const w=e[e.length-1];h=w.offset+w.size}const d=r-i,f=a+d*l+(d-1)*n,p=c,_=f-h;return{bottom:h,firstItemIndex:s,items:Vi(e,o,s),offsetBottom:_,offsetTop:c,top:p,topItems:Vi(t,o,s),topListHeight:t.reduce((w,v)=>v.size+w,0),totalCount:r}}function Bl(e,t,r,n,o,s){let i=0;if(r.groupIndices.length>0)for(const c of r.groupIndices){if(c-i>=e)break;i++}const a=e+i,l=Ss(t,a);return Rn(Array.from({length:a}).map((c,h)=>({data:s[h+l],index:h+l,offset:0,size:0})),[],a,o,r,n)}function Vi(e,t,r){if(e.length===0)return[];if(!Zn(t))return e.map(c=>({...c,index:c.index+r,originalIndex:c.index}));const n=e[0].index,o=e[e.length-1].index,s=[],i=wr(t.groupOffsetTree,n,o);let a,l=0;for(const c of e){(!a||a.end<c.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let h;c.index===a.start?h={index:l,type:"group"}:h={groupIndex:l,index:c.index-(l+1)+r},s.push({...h,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return s}function Ui(e,t){var r;return e===void 0?0:typeof e=="number"?e:(r=e[t])!=null?r:0}var fr=Te(([{data:e,firstItemIndex:t,gap:r,sizes:n,totalCount:o},s,{listBoundary:i,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:h},{topListHeight:d},f,{didMount:p},{recalcInProgress:_}])=>{const w=U([]),v=U(0),m=Se(),g=U(0);re(s.topItemsIndexes,w);const x=lt(z(tt(p,_,he(l,Gr),he(o),he(n),he(c),h,he(w),he(t),he(r),he(g),e),fe(([E,S,,I,,,,,,,,F])=>{const M=F&&F.length!==I;return E&&!S&&!M}),Y(([,,[E,S],I,F,M,J,H,j,P,Q,$])=>{var le,oe,pe,ye;const Me=F,{offsetTree:Be,sizeTree:Re}=Me,Je=We(v);if(I===0)return{...go,totalCount:I};if(E===0&&S===0)return Je===0?{...go,totalCount:I}:Bl(Je,M,F,j,P,$||[]);if(Ne(Re))return Je>0?null:Rn(Jf(Ss(M,I),Me,$),[],I,P,Me,j);const ut=[];if(H.length>0){const R=H[0],D=H[H.length-1];let K=0;for(const G of wr(Re,R,D)){const X=G.value,q=Math.max(G.start,R),ie=Math.min(G.end,D);for(let ae=q;ae<=ie;ae++)ut.push({data:$?.[ae],index:ae,offset:K,size:X}),K+=X}}if(!J)return Rn([],ut,I,P,Me,j);const Ye=H.length>0?H[H.length-1]+1:0,Xe=Df(Be,E,S,Ye);if(Xe.length===0)return null;const W=I-1,ce=Xn([],R=>{for(const D of Xe){const K=D.value;let G=K.offset,X=D.start;const q=K.size;if(K.offset<E){X+=Math.floor((E-K.offset+P)/(q+P));const ae=X-D.start;G+=ae*q+ae*P}X<Ye&&(G+=(Ye-X)*q,X=Ye);const ie=Math.min(D.end,W);for(let ae=X;ae<=ie&&!(G>=S);ae++)R.push({data:$?.[ae],index:ae,offset:G,size:q}),G+=q+P}}),Ce=Ui(Q,Yr),L=Ui(Q,Xr);if(ce.length>0&&(Ce>0||L>0)){const R=ce[0],D=ce[ce.length-1];if(Ce>0&&R.index>Ye){const K=Math.min(Ce,R.index-Ye),G=[];let X=R.offset;for(let q=R.index-1;q>=R.index-K;q--){const ie=(oe=(le=wr(Re,q,q)[0])==null?void 0:le.value)!=null?oe:R.size;X-=ie+P,G.unshift({data:$?.[q],index:q,offset:X,size:ie})}ce.unshift(...G)}if(L>0&&D.index<W){const K=Math.min(L,W-D.index);let G=D.offset+D.size+P;for(let X=D.index+1;X<=D.index+K;X++){const q=(ye=(pe=wr(Re,X,X)[0])==null?void 0:pe.value)!=null?ye:D.size;ce.push({data:$?.[X],index:X,offset:G,size:q}),G+=q+P}}}return Rn(ce,ut,I,P,Me,j)}),fe(E=>E!==null),Pe()),go);re(z(e,fe(_s),Y(E=>E?.length)),o),re(z(x,Y(E=>E.topListHeight)),d),re(d,a),re(z(x,Y(E=>[E.top,E.bottom])),i),re(z(x,Y(E=>E.items)),m);const O=_t(z(x,fe(({items:E})=>E.length>0),be(o,e),fe(([{items:E},S])=>E[E.length-1].originalIndex===S-1),Y(([,E,S])=>[E-1,S]),Pe(Gr),Y(([E])=>E))),N=_t(z(x,qt(200),fe(({items:E,topItems:S})=>E.length>0&&E[0].originalIndex===S.length),Y(({items:E})=>E[0].index),Pe()));return{endReached:O,initialItemCount:v,itemsRendered:m,listState:x,minOverscanItemCount:g,rangeChanged:_t(z(x,fe(({items:E})=>E.length>0),Y(({items:E})=>{let S=0,I=E.length-1;for(;E[S].type==="group"&&S<I;)S++;for(;E[I].type==="group"&&I>S;)I--;return{endIndex:E[I].index,startIndex:E[S].index}}),Pe(El))),startReached:N,topItemsIndexes:w,...f}},He(Ft,Ol,Cs,on,nn,sn,lr,bs),{singleton:!0}),Dl=Te(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:r,headerHeight:n},{listState:o}])=>{const s=Se(),i=lt(z(tt(r,e,n,t,o),Y(([a,l,c,h,d])=>
vendor: 4,104 bytes, line 177
177a+l+c+h+d.offsetBottom+d.bottom)),0);return re(he(i),s),{totalListHeight:i,totalListHeightChanged:s}},He(ht,fr),{singleton:!0}),Yf=Te(([{viewportHeight:e},{totalListHeight:t}])=>{const r=U(!1);return{alignToBottom:r,paddingTopAddition:lt(z(tt(r,e,t),fe(([n])=>n),Y(([,n,o])=>Math.max(0,n-o)),qt(0),Pe()),0)}},He(ht,Dl),{singleton:!0}),Pl=Te(()=>({context:U(null)})),Xf=({itemBottom:e,itemTop:t,locationParams:{align:r,behavior:n,...o},viewportBottom:s,viewportTop:i})=>t<i?{...o,align:r??"start",behavior:n}:e>s?{...o,align:r??"end",behavior:n}:null,zl=Te(([{gap:e,sizes:t,totalCount:r},{fixedFooterHeight:n,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:a,viewportHeight:l},{scrollToIndex:c}])=>{const h=Se();return re(z(h,be(t,l,r,s,o,n,a),be(e),Y(([[d,f,p,_,w,v,m,g],x])=>{const{align:O,behavior:N,calculateViewLocation:E=Xf,done:S,...I}=d,F=Rl(d,f,_-1),M=Kr(F,f.offsetTree,x)+w+v,J=M+At(f.sizeTree,F)[1],H=g+v,j=g+p-m,P=E({itemBottom:J,itemTop:M,locationParams:{align:O,behavior:N,...I},viewportBottom:j,viewportTop:H});return P?S&&It(z(i,fe(Q=>!Q),hr(We(i)?1:2)),S):S?.(),P}),fe(d=>d!==null)),c),{scrollIntoView:h}},He(Ft,ht,nn,fr,sr),{singleton:!0});function Wi(e){return e?e==="smooth"?"smooth":"auto":!1}var Zf=(e,t)=>typeof e=="function"?Wi(e(t)):t&&Wi(e),Qf=Te(([{listRefresh:e,totalCount:t,fixedItemSize:r,data:n},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:a},{didMount:l,propsReady:c},{log:h},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{const _=U(!1),w=Se();let v=null;function m(N){ve(i,{align:"end",behavior:N,index:"LAST"})}Ae(z(tt(z(he(t),hr(1)),l),be(he(_),s,a,d),Y(([[N,E],S,I,F,M])=>{let J=E&&F,H="auto";return J&&(H=Zf(S,I||M),J=J&&!!H),{followOutputBehavior:H,shouldFollow:J,totalCount:N}}),fe(({shouldFollow:N})=>N)),({followOutputBehavior:N,totalCount:E})=>{v&&(v(),v=null),We(r)?requestAnimationFrame(()=>{We(h)("following output to ",{totalCount:E},pt.DEBUG),m(N)}):v=It(e,()=>{We(h)("following output to ",{totalCount:E},pt.DEBUG),m(N),v=null})});function g(N){const E=It(o,S=>{N&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!v&&(We(h)("scrolling to bottom due to increased size",{},pt.DEBUG),m("auto"))});setTimeout(E,100)}Ae(z(tt(he(_),t,c),fe(([N,,E])=>N&&E),Dt(({value:N},[,E])=>({refreshed:N===E,value:E}),{refreshed:!1,value:0}),fe(({refreshed:N})=>N),be(_,t)),([,N])=>{We(a)&&g(N!==!1)}),Ae(w,()=>{g(We(_)!==!1)}),Ae(tt(he(_),o),([N,E])=>{N&&!E.atBottom&&E.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&m("auto")});const x=U(null),O=Se();return re(Vo(z(he(n),Y(N=>{var E;return(E=N?.length)!=null?E:0})),z(he(t))),O),Ae(z(tt(z(O,hr(1)),l),be(he(x),a,d,f),Y(([[N,E],S,I,F,M])=>E&&I&&S?.({context:M,totalCount:N,scrollingInProgress:F})),fe(N=>!!N),qt(0)),N=>{v&&(v(),v=null),We(r)?requestAnimationFrame(()=>{We(h)("scrolling into view",{}),ve(p,N)}):v=It(e,()=>{We(h)("scrolling into view",{}),ve(p,N),v=null})}),{autoscrollToBottom:w,followOutput:_,scrollIntoViewOnChange:x}},He(Ft,sn,nn,on,lr,sr,ht,Pl,zl)),$f=Te(([{data:e,firstItemIndex:t,gap:r,sizes:n},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:a}])=>(re(z(a,be(s),fe(([,l])=>l!==0),be(o,n,t,r,e),Y(([[,l],c,h,d,f,p=[]])=>Bl(l,c,h,d,f,p))),i),{}),He(Ft,on,fr,lr),{singleton:!0}),ep=Te(([{didMount:e},{scrollTo:t},{listState:r}])=>{const n=U(0);return Ae(z(e,be(n),fe(([,o])=>o!==0),Y(([,o])=>({top:o}))),o=>{It(z(r,hr(1),fe(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{ve(t,o)})})}),{initialScrollTop:n}},He(lr,ht,fr),{singleton:!0}),Hl=Te(([{scrollVelocity:e}])=>{const t=U(!1),r=Se(),n=U(!1);return re(z(e,be(n,t,r),fe(([o,s])=>!!s),Y(([o,s,i,a])=>{const{enter:l,exit:c}=s;if(i){if(c(o,a))return!1}else if(l(o,a))return!0;return i}),Pe()),t),Ae(z(tt(t,e,r),be(n)),([[o,s,i],a])=>{o&&a&&a.change&&a.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:n,scrollSeekRangeChanged:r,scrollVelocity:e}},He(sn),{singleton:!0}),Ts=Te(([{scrollContainerState:e,scrollTo:t}])=>{const r=Se(),n=Se(),o=Se(),s=U(!1),i=U(void 0);return re(z(tt(r,n),Y(([{scrollHeight:a,scrollTop:l,viewportHeight:c},{offsetTop:h}])=>
vendor: 4,396 bytes, line 177
177({scrollHeight:a,scrollTop:Math.max(0,l-h),viewportHeight:c}))),e),re(z(t,be(n),Y(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:r,windowScrollTo:o,windowViewportRect:n}},He(ht)),tp=Te(([{sizeRanges:e,sizes:t},{headerHeight:r,scrollTop:n},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const c=Se(),h=U(void 0),d=U(null),f=U(null);return re(a,d),re(l,f),Ae(z(c,be(t,n,i,d,f,r)),([p,_,w,v,m,g,x])=>{const O=zf(_.sizeTree);v&&m!==null&&g!==null&&(w=m.scrollTop-g.offsetTop),w-=x,p({ranges:O,scrollTop:w})}),re(z(h,fe(_s),Y(rp)),o),re(z(s,be(h),fe(([,p])=>p!==void 0),Pe(),Y(([,p])=>p.ranges)),e),{getState:c,restoreStateFrom:h}},He(Ft,ht,on,lr,Ts));function rp(e){return{align:"start",index:0,offset:e.scrollTop}}var np=Te(([{topItemsIndexes:e}])=>{const t=U(0);return re(z(t,fe(r=>r>=0),Y(r=>Array.from({length:r}).map((n,o)=>o))),e),{topItemCount:t}},He(fr));function Fl(e){let t=!1,r;return(()=>(t||(t=!0,r=e()),r))}var op=Fl(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Vl=Te(([{data:e,defaultItemSize:t,firstItemIndex:r,fixedItemSize:n,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:a,itemSize:l,sizeRanges:c,sizes:h,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:_,initialTopMostItemIndex:w,scrolledToInitialItem:v},m,g,x,O,{scrollToIndex:N},E,{topItemCount:S},{groupCounts:I},F])=>{const{listState:M,minOverscanItemCount:J,topItemsIndexes:H,rangeChanged:j,...P}=O;return re(j,F.scrollSeekRangeChanged),re(z(F.windowViewportRect,Y(Q=>Q.visibleHeight)),m.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:r,fixedItemHeight:n,fixedGroupHeight:o,gap:s,groupCounts:I,heightEstimates:a,initialItemFinalLocationReached:_,initialTopMostItemIndex:w,scrolledToInitialItem:v,sizeRanges:c,topItemCount:S,topItemsIndexes:H,totalCount:f,...x,groupIndices:i,itemSize:l,listState:M,minOverscanItemCount:J,scrollToIndex:N,statefulTotalCount:d,trackItemSizes:p,rangeChanged:j,...P,...F,...m,sizes:h,...g}},He(Ft,on,ht,tp,Qf,fr,nn,Te(([{deviation:e,scrollBy:t,scrollingInProgress:r,scrollTop:n},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:a},{listState:l},{beforeUnshiftWith:c,gap:h,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:_}])=>{const w=_t(z(l,be(i),Dt(([,m,g,x],[{bottom:O,items:N,offsetBottom:E,totalCount:S},I])=>{const F=O+E;let M=0;return g===S&&m.length>0&&N.length>0&&(N[0].originalIndex===0&&m[0].originalIndex===0||(M=F-x,M!==0&&(M+=I))),[M,N,S,F]},[0,[],0,0]),fe(([m])=>m!==0),be(n,a,r,o,p,_),fe(([,m,g,x,,,O])=>!O&&!x&&m!==0&&g===Jr),Y(([[m],,,,,g])=>(g("Upward scrolling compensation",{amount:m},pt.DEBUG),m))));function v(m){m>0?(ve(t,{behavior:"auto",top:-m}),ve(e,0)):(ve(e,0),ve(t,{behavior:"auto",top:-m}))}return Ae(z(w,be(e,s)),([m,g,x])=>{x&&op()?ve(e,g-m):v(-m)}),Ae(z(tt(lt(s,!1),e,_),fe(([m,g,x])=>!m&&!x&&g!==0),Y(([m,g])=>g),qt(1)),v),re(z(d,Y(m=>({top:-m}))),t),Ae(z(c,be(f,h),Y(([m,{groupIndices:g,lastSize:x,sizeTree:O},N])=>{function E(S){return S*(x+N)}if(g.length===0)return E(m);{let S=0;const I=qr(O,0);let F=0,M=0;for(;F<m;){F++,S+=I;let J=g.length===M+1?1/0:g[M+1]-g[M]-1;F+J>m&&(S-=I,J=m-F+1),F+=J,S+=E(J),M++}return S}})),m=>{ve(e,m),requestAnimationFrame(()=>{ve(t,{top:m}),requestAnimationFrame(()=>{ve(e,0),ve(_,!1)})})}),{deviation:e}},He(ht,sn,fr,Ft,sr,bs)),np,Ol,Te(([e,t,r,n,o,s,i,a,l,c,h])=>({...e,...t,...r,...n,...o,...s,...i,...a,...l,...c,...h}),He(Cs,$f,lr,Hl,Dl,ep,Yf,Ts,zl,sr,Pl))));function sp(e,t){const r={},n={};let o=0;const s=e.length;for(;o<s;)n[e[o]]=1,o+=1;for(const i in t)Object.hasOwn(n,i)||(r[i]=t[i]);return r}var gn=typeof document<"u"?B.useLayoutEffect:B.useEffect;function Is(e,t,r){const n=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=B.createContext({});function l(w,v){w.propsReady&&ve(w.propsReady,!1);for(const m of n){const g=w[t.required[m]];ve(g,v[m])}for(const m of o)if(m in v){const g=w[t.optional[m]];ve(g,v[m])}w.propsReady&&ve(w.propsReady,!0)}function c(w){return s.reduce((v,m)=>(v[m]=g=>{const x=w[t.methods[m]];ve(x,g)},v),{})}function h(w){return i.reduce((v,m)=>(v[m]=Sf(w[t.events[m]]),v),{})}const d=B.forwardRef((w,v)=>{const{children:m,...g}=w,[x]=B.useState(()=>Xn(Tf(e),E=>
177{l(E,g)})),[O]=B.useState(Li(h,x));gn(()=>{for(const E of i)E in g&&Ae(O[E],g[E]);return()=>{Object.values(O).map(ys)}},[g,O,x]),gn(()=>{l(x,g)}),B.useImperativeHandle(v,Oi(c(x)));const N=r;return u(a.Provider,{value:x,children:r?u(N,{...sp([...n,...o,...i],g),children:m}):m})}),f=w=>{const v=B.useContext(a);return B.useCallback(m=>{ve(v[w],m)},[v,w])},p=w=>{const v=B.useContext(a)[w],m=B.useCallback(g=>Ae(v,g),[v]);return B.useSyncExternalStore(m,()=>We(v),()=>We(v))},_=w=>{const v=B.useContext(a)[w],[m,g]=B.useState(Li(We,v));return gn(()=>Ae(v,x=>{x!==m&&g(Oi(x))}),[v,m]),m};return{Component:d,useEmitter:(w,v)=>{const m=B.useContext(a)[w];gn(()=>Ae(m,v),[v,m])},useEmitterValue:B.version.startsWith("18")?p:_,usePublisher:f}}var Qn=B.createContext(void 0),Ul=B.createContext(void 0),Wl=typeof document<"u"?B.useLayoutEffect:B.useEffect;function _o(e){return"self"in e}function ip(e){return"body"in e}function jl(e,t,r,n=Tr,o,s){const i=B.useRef(null),a=B.useRef(null),l=B.useRef(null),c=B.useCallback(f=>{let p,_,w;const v=f.target;if(ip(v)||_o(v)){const g=_o(v)?v:v.defaultView;w=s?g.scrollX:g.scrollY,p=s?g.document.documentElement.scrollWidth:g.document.documentElement.scrollHeight,_=s?g.innerWidth:g.innerHeight}else w=s?v.scrollLeft:v.scrollTop,p=s?v.scrollWidth:v.scrollHeight,_=s?v.offsetWidth:v.offsetHeight;const m=()=>{e({scrollHeight:p,scrollTop:Math.max(w,0),viewportHeight:_})};f.suppressFlushSync?m():B.flushSync(m),a.current!==null&&(w===a.current||w<=0||w===p-_)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);B.useEffect(()=>{const f=o||i.current;return n(o||i.current),c({suppressFlushSync:!0,target:f}),f.addEventListener("scroll",c,{passive:!0}),()=>{n(null),f.removeEventListener("scroll",c)}},[i,c,r,n,o]);function h(f){const p=i.current;if(!p||(s?"offsetWidth"in p&&p.offsetWidth===0:"offsetHeight"in p&&p.offsetHeight===0))return;const _=f.behavior==="smooth";let w,v,m;_o(p)?(v=Math.max(Nt(p.document.documentElement,s?"width":"height"),s?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight),w=s?p.innerWidth:p.innerHeight,m=s?window.scrollX:window.scrollY):(v=p[s?"scrollWidth":"scrollHeight"],w=Nt(p,s?"width":"height"),m=p[s?"scrollLeft":"scrollTop"]);const g=v-w;if(f.top=Math.ceil(Math.max(Math.min(g,f.top),0)),Ml(w,v)||f.top===m){e({scrollHeight:v,scrollTop:m,viewportHeight:w}),_&&t(!0);return}_?(a.current=f.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,s&&(f={behavior:f.behavior,left:f.top}),p.scrollTo(f)}function d(f){s&&(f={behavior:f.behavior,left:f.top}),i.current.scrollBy(f)}return{scrollByCallback:d,scrollerRef:i,scrollToCallback:h}}var yo="-webkit-sticky",ji="sticky",Es=Fl(()=>{if(typeof document>"u")return ji;const e=document.createElement("div");return e.style.position=yo,e.style.position===yo?yo:ji});function As(e){return e}var ap=Te(([e,t])=>({...e,...t}),He(Vl,Te(()=>{const e=U(a=>`Item ${a}`),t=U(a=>`Group ${a}`),r=U({}),n=U(As),o=U("div"),s=U(Tr),i=(a,l=null)=>lt(z(r,Y(c=>c[a]),Pe()),l);return{components:r,computeItemKey:n,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:o,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}))),lp=({height:e})=>u("div",{style:{height:e}}),cp={overflowAnchor:"none",position:Es(),zIndex:1},ql={overflowAnchor:"none"},up={...ql,display:"inline-block",height:"100%"},qi=B.memo(function({showTopList:e=!1}){const t=ge("listState"),r=bt("sizeRanges"),n=ge("useWindowScroll"),o=ge("customScrollParent"),s=bt("windowScrollContainerState"),i=bt("scrollContainerState"),a=o||n?s:i,l=ge("itemContent"),c=ge("context"),h=ge("groupContent"),d=ge("trackItemSizes"),f=ge("itemSize"),p=ge("log"),_=bt("gap"),w=ge("horizontalDirection"),{callbackRef:v}=xl(r,f,d,e?Tr:a,p,_,o,w,ge("skipAnimationFrameInResizeObserver")),[m,g]=B.use
177State(0);Os("deviation",P=>{m!==P&&g(P)});const x=ge("EmptyPlaceholder"),O=ge("ScrollSeekPlaceholder")||lp,N=ge("ListComponent"),E=ge("ItemComponent"),S=ge("GroupComponent"),I=ge("computeItemKey"),F=ge("isSeeking"),M=ge("groupIndices").length>0,J=ge("alignToBottom"),H=ge("initialItemFinalLocationReached"),j=e?{}:{boxSizing:"border-box",...w?{display:"inline-block",height:"100%",marginLeft:m!==0?m:J?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:m!==0?m:J?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...H?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&x?u(x,{...ze(x,c)}):u(N,{...ze(N,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:v,style:j,children:(e?t.topItems:t.items).map(P=>{const Q=P.originalIndex,$=I(Q+t.firstItemIndex,P.data,c);return F?Ie(O,{...ze(O,c),height:P.size,index:P.index,key:$,type:P.type||"item",...P.type==="group"?{}:{groupIndex:P.groupIndex}}):P.type==="group"?Ie(S,{...ze(S,c),"data-index":Q,"data-item-index":P.index,"data-known-size":P.size,key:$,style:cp},h(P.index,c)):Ie(E,{...ze(E,c),...Gl(E,P.data),"data-index":Q,"data-item-group-index":P.groupIndex,"data-item-index":P.index,"data-known-size":P.size,key:$,style:w?up:ql},M?l(P.index,P.groupIndex,P.data,c):l(P.index,P.data,c))})})}),dp={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},hp={outline:"none",overflowX:"auto",position:"relative"},Ir=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),fp={position:Es(),top:0,width:"100%",zIndex:1};function ze(e,t){if(typeof e!="string")return{context:t}}function Gl(e,t){return{item:typeof e=="string"?void 0:t}}var pp=B.memo(function(){const e=ge("HeaderComponent"),t=bt("headerHeight"),r=ge("HeaderFooterTag"),n=Ht(B.useMemo(()=>s=>{t(Nt(s,"height"))},[t]),!0,ge("skipAnimationFrameInResizeObserver")),o=ge("context");return e?u(r,{ref:n,children:u(e,{...ze(e,o)})}):null}),mp=B.memo(function(){const e=ge("FooterComponent"),t=bt("footerHeight"),r=ge("HeaderFooterTag"),n=Ht(B.useMemo(()=>s=>{t(Nt(s,"height"))},[t]),!0,ge("skipAnimationFrameInResizeObserver")),o=ge("context");return e?u(r,{ref:n,children:u(e,{...ze(e,o)})}):null});function Ns({useEmitter:e,useEmitterValue:t,usePublisher:r}){return B.memo(function({children:n,style:o,context:s,...i}){const a=r("scrollContainerState"),l=t("ScrollerComponent"),c=r("smoothScrollTargetReached"),h=t("scrollerRef"),d=t("horizontalDirection")||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:_}=jl(a,c,l,h,void 0,d);return e("scrollTo",_),e("scrollBy",f),u(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:p,style:{...d?hp:dp,...o},tabIndex:0,...i,...ze(l,s),children:n})})}function Rs({useEmitter:e,useEmitterValue:t,usePublisher:r}){return B.memo(function({children:n,style:o,context:s,...i}){const a=r("windowScrollContainerState"),l=t("ScrollerComponent"),c=r("smoothScrollTargetReached"),h=t("totalListHeight"),d=t("deviation"),f=t("customScrollParent"),p=B.useRef(null),{scrollByCallback:_,scrollerRef:w,scrollToCallback:v}=jl(a,c,l,t("scrollerRef"),f);return Wl(()=>{var m;return w.current=f||((m=p.current)==null?void 0:m.ownerDocument.defaultView),()=>{w.current=null}},[w,f]),e("windowScrollTo",v),e("scrollBy",_),u(l,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...h!==0?{height:h+d}:{}},...i,...ze(l,s),children:n})})}var gp=({children:e})=>{const t=B.useContext(Qn),r=bt("viewportHeight"),n=bt("fixedItemHeight"),o=ge("alignToBottom"),s=ge("horizontalDirection"),i=Ht(B.useMemo(()=>Wr(r,a=>Nt(a,s?"width":"height")),[r,s]),!0,ge("skipAnimationFrameInResizeObserver"));return B.useEffect(()=>{t&&(r(t.viewportHeight),n(t.itemHeight))},[t,r,n]),u("div",{"data-viewport-type":"element",ref:i,style:Ir(o),children:e})},_p=({children:e})=>{const t=B.useContext(Qn),r=bt("windowViewportRect"),n=bt("fixedItemHeight"),o=vs(r,ge("customScrollParent"),ge("skipAnimationFrameInResizeObserver")),s=ge("alignToBottom");return B.useEffect(()=>
177{t&&(n(t.itemHeight),r({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,r,n]),u("div",{"data-viewport-type":"window",ref:o,style:Ir(s),children:e})},yp=({children:e})=>{const t=ge("TopItemListComponent")||"div",r=ge("headerHeight");return u(t,{style:{...fp,marginTop:`${r}px`},...ze(t,ge("context")),children:e})},{Component:wp,useEmitter:Os,useEmitterValue:ge,usePublisher:bt}=Is(ap,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},B.memo(function(e){const t=ge("useWindowScroll"),r=ge("topItemsIndexes").length>0,n=ge("customScrollParent"),o=ge("context");return u(n||t?bp:vp,{...e,context:o,children:[r&&u(yp,{children:u(qi,{showTopList:!0})}),u(n||t?_p:gp,{children:[u(pp,{}),u(qi,{}),u(mp,{})]})]})})),vp=Ns({useEmitter:Os,useEmitterValue:ge,usePublisher:bt}),bp=Rs({useEmitter:Os,useEmitterValue:ge,usePublisher:bt}),xp=wp;var kp=Te(([e,t])=>({...e,...t}),He(Vl,Te(()=>{const e=U(c=>u("td",{children:["Item $",c]})),t=U(null),r=U(c=>u("td",{colSpan:1e3,children:["Group ",c]})),n=U(null),o=U(null),s=U({}),i=U(As),a=U(Tr),l=(c,h=null)=>lt(z(s,Y(d=>d[c]),Pe()),h);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:n,itemContent:e,groupContent:r,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}}))),Sp=({height:e})=>u("tr",{children:u("td",{style:{height:e}})}),Cp=({height:e})=>u("tr",{children:u("td",{style:{border:0,height:e,padding:0}})}),Tp={overflowAnchor:"none"},Gi={position:Es(),zIndex:2,overflowAnchor:"none"},Ki=B.memo(function({showTopList:e=!1}){const t=we("listState"),r=we("computeItemKey"),n=we("firstItemIndex"),o=we("context"),s=we("isSeeking"),i=we("fixedHeaderHeight"),a=we("groupIndices").length>0,l=we("itemContent"),c=we("groupContent"),h=we("ScrollSeekPlaceholder")||Sp,d=we("GroupComponent"),f=we("TableRowComponent"),p=(e?t.topItems:[]).reduce((_,w,v)=>(v===0?_.push(w.size):_.push(_[v-1]+w.size),_),[]);return u(ct,{children:(e?t.topItems:t.items).map(_=>{const w=_.originalIndex,v=r(w+n,_.data,o),m=e?w===0?0:p[w-1]:0;return s?Ie(h,{...ze(h,o),height:_.size,index:_.index,key:v,type:_.type||"item"}):_.type==="group"?Ie(d,{...ze(d,o),"data-index":w,"data-item-index":_.index,"data-known-size":_.size,key:v,style:{...Gi,top:i}},c(_.index,o)):Ie(f,{...ze(f,o),...Gl(f,_.data),"data-index":w,"data-item-index":_.index,"data-known-size":_.size,"data-item-group-index":_.groupIndex,key:v,style:e?{...Gi,top:i+m}:Tp},a?l(_.index,_.groupIndex,_.data,o):l(_.index,_.data,o))})})}),Ip=B.memo(function(){const e=we("listState"),t=we("topItemsIndexes").length>0,r=Et("sizeRanges"),n=we("useWindowScroll"),o=we("customScrollParent"),s=Et("windowScrollContainerState"),i=Et("scrollContainerState"),a=o||n?s:i,l=we("trackItemSizes"),{callbackRef:c,ref:h}=xl(r,we("itemSize"),l,a,we("log"),void 0,o,!1,we("skipAnimationFrameInResizeObserver")),[d,f]=B.use
177State(0);Ls("deviation",I=>{d!==I&&(h.current.style.marginTop=`${I}px`,f(I))});const p=we("EmptyPlaceholder"),_=we("FillerRow")||Cp,w=we("TableBodyComponent"),v=we("paddingTopAddition"),m=we("statefulTotalCount"),g=we("context");if(m===0&&p)return u(p,{...ze(p,g)});const x=(t?e.topItems:[]).reduce((I,F)=>I+F.size,0),O=e.offsetTop+v+d-x,N=e.offsetBottom,E=O>0?u(_,{context:g,height:O},"padding-top"):null,S=N>0?u(_,{context:g,height:N},"padding-bottom"):null;return u(w,{"data-testid":"virtuoso-item-list",ref:c,...ze(w,g),children:[E,t&&u(Ki,{showTopList:!0}),u(Ki,{}),S]})}),Ep=({children:e})=>{const t=B.useContext(Qn),r=Et("viewportHeight"),n=Et("fixedItemHeight"),o=Ht(B.useMemo(()=>Wr(r,s=>Nt(s,"height")),[r]),!0,we("skipAnimationFrameInResizeObserver"));return B.useEffect(()=>{t&&(r(t.viewportHeight),n(t.itemHeight))},[t,r,n]),u("div",{"data-viewport-type":"element",ref:o,style:Ir(!1),children:e})},Ap=({children:e})=>{const t=B.useContext(Qn),r=Et("windowViewportRect"),n=Et("fixedItemHeight"),o=vs(r,we("customScrollParent"),we("skipAnimationFrameInResizeObserver"));return B.useEffect(()=>{t&&(n(t.itemHeight),r({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,r,n]),u("div",{"data-viewport-type":"window",ref:o,style:Ir(!1),children:e})},{Component:Mm,useEmitter:Ls,useEmitterValue:we,usePublisher:Et}=Is(kp,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},B.memo(function(e){const t=we("useWindowScroll"),r=we("customScrollParent"),n=Et("fixedHeaderHeight"),o=Et("fixedFooterHeight"),s=we("fixedHeaderContent"),i=we("fixedFooterContent"),a=we("context"),l=Ht(B.useMemo(()=>Wr(n,m=>Nt(m,"height")),[n]),!0,we("skipAnimationFrameInResizeObserver")),c=Ht(B.useMemo(()=>Wr(o,m=>Nt(m,"height")),[o]),!0,we("skipAnimationFrameInResizeObserver")),h=r||t?Rp:Np,d=r||t?Ap:Ep,f=we("TableComponent"),p=we("TableHeadComponent"),_=we("TableFooterComponent"),w=s?u(p,{ref:l,style:{position:"sticky",top:0,zIndex:2},...ze(p,a),children:s()},"TableHead"):null,v=i?u(_,{ref:c,style:{bottom:0,position:"sticky",zIndex:1},...ze(_,a),children:i()},"TableFoot"):null;return u(h,{...e,...ze(h,a),children:u(d,{children:u(f,{style:{borderSpacing:0,overflowAnchor:"none"},...ze(f,a),children:[w,u(Ip,{},"TableBody"),v]})})})})),Np=Ns({useEmitter:Ls,useEmitterValue:we,usePublisher:Et}),Rp=Rs({useEmitter:Ls,useEmitterValue:we,usePublisher:Et});var Ji={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Op={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Yi,floor:Vn,max:Fr,min:wo,round:Xi}=Math;function Zi(e,t,r){return Array.from({length:t-e+1}).map((n,o)=>({data:r===null?null:r[o+e],index:o+e}))}function Lp(e){return{...Op,items:e}}function _n(e,t){return e&&e.width===t.width&&e.height===t.height}function Mp(e,t){return e&&e.column===t.column&&e.row===t.row}var Bp=Te(([{increaseViewportBy:e,listBoundary:t,overscan:r,visibleRange:n},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:a,scrollTo:l,scrollTop:c,smoothScrollTargetReached:h,viewportHe
vendor: 4,509 bytes, line 177
177ight:d},f,p,{didMount:_,propsReady:w},{customScrollParent:v,useWindowScroll:m,windowScrollContainerState:g,windowScrollTo:x,windowViewportRect:O},N])=>{const E=U(0),S=U(0),I=U(Ji),F=U({height:0,width:0}),M=U({height:0,width:0}),J=Se(),H=Se(),j=U(0),P=U(null),Q=U({column:0,row:0}),$=Se(),le=Se(),oe=U(!1),pe=U(0),ye=U(!0),Me=U(!1),Be=U(!1);Ae(z(_,be(pe),fe(([W,ce])=>!!ce)),()=>{ve(ye,!1)}),Ae(z(tt(_,ye,M,F,pe,Me),fe(([W,ce,Ce,L,,R])=>W&&!ce&&Ce.height!==0&&L.height!==0&&!R)),([,,,,W])=>{ve(Me,!0),ks(1,()=>{ve(J,W)}),It(z(c),()=>{ve(t,[0,0]),ve(ye,!0)})}),re(z(le,fe(W=>W!=null&&W.scrollTop>0),Lt(0)),S),Ae(z(_,be(le),fe(([,W])=>W!=null)),([,W])=>{W&&(ve(F,W.viewport),ve(M,W.item),ve(Q,W.gap),W.scrollTop>0&&(ve(oe,!0),It(z(c,hr(1)),ce=>{ve(oe,!1)}),ve(l,{top:W.scrollTop})))}),re(z(F,Y(({height:W})=>W)),d),re(z(tt(he(F,_n),he(M,_n),he(Q,(W,ce)=>W&&W.column===ce.column&&W.row===ce.row),he(c)),Y(([W,ce,Ce,L])=>({gap:Ce,item:ce,scrollTop:L,viewport:W}))),$),re(z(tt(he(E),n,he(Q,Mp),he(M,_n),he(F,_n),he(P),he(S),he(oe),he(ye),he(pe)),fe(([,,,,,,,W])=>!W),Y(([W,[ce,Ce],L,R,D,K,G,,X,q])=>{const{column:ie,row:ae}=L,{height:Fe,width:y}=R,{width:b}=D;if(G===0&&(W===0||b===0))return Ji;if(y===0){const ue=Ss(q,W);return Lp(Zi(ue,ue+Math.max(G-1,0),K))}const T=Kl(b,y,ie);let k,C;X?ce===0&&Ce===0&&G>0?(k=0,C=G-1):(k=T*Vn((ce+ae)/(Fe+ae)),C=T*Yi((Ce+ae)/(Fe+ae))-1,C=wo(W-1,Fr(C,T-1)),k=wo(C,Fr(0,k))):(k=0,C=-1);const A=Zi(k,C,K),{bottom:V,top:Z}=Qi(D,L,R,A),se=Yi(W/T);return{bottom:V,itemHeight:Fe,items:A,itemWidth:y,offsetBottom:se*Fe+(se-1)*ae-V,offsetTop:Z,top:Z}})),I),re(z(P,fe(W=>W!==null),Y(W=>W.length)),E),re(z(tt(F,M,I,Q),fe(([W,ce,{items:Ce}])=>Ce.length>0&&ce.height!==0&&W.height!==0),Y(([W,ce,{items:Ce},L])=>{const{bottom:R,top:D}=Qi(W,L,ce,Ce);return[D,R]}),Pe(Gr)),t);const Re=U(!1);re(z(c,be(Re),Y(([W,ce])=>ce||W!==0)),Re);const Je=_t(z(tt(I,E),fe(([{items:W}])=>W.length>0),be(Re),fe(([[W,ce],Ce])=>{const L=W.items[W.items.length-1].index===ce-1;return(Ce||W.bottom>0&&W.itemHeight>0&&W.offsetBottom===0&&W.items.length===ce)&&L}),Y(([[,W]])=>W-1),Pe())),ut=_t(z(he(I),fe(({items:W})=>W.length>0&&W[0].index===0),Lt(0),Pe())),Ye=_t(z(he(I),be(oe),fe(([{items:W},ce])=>W.length>0&&!ce),Y(([{items:W}])=>({endIndex:W[W.length-1].index,startIndex:W[0].index})),Pe(El),qt(0)));re(Ye,p.scrollSeekRangeChanged),re(z(J,be(F,M,E,Q),Y(([W,ce,Ce,L,R])=>{const D=Ll(W),{align:K,behavior:G,offset:X}=D;let q=D.index;q==="LAST"&&(q=L-1),q=Fr(0,q,wo(L-1,q));let ie=Go(ce,R,Ce,q);return K==="end"?ie=Xi(ie-ce.height+Ce.height):K==="center"&&(ie=Xi(ie-ce.height/2+Ce.height/2)),X&&(ie+=X),{behavior:G,top:ie}})),l);const Xe=lt(z(I,Y(W=>W.offsetBottom+W.bottom)),0);return re(z(O,Y(W=>({height:W.visibleHeight,width:W.visibleWidth}))),F),{customScrollParent:v,data:P,deviation:j,footerHeight:o,gap:Q,headerHeight:s,increaseViewportBy:e,initialItemCount:S,itemDimensions:M,overscan:r,restoreStateFrom:le,scrollBy:i,scrollContainerState:a,scrollHeight:H,scrollTo:l,scrollToIndex:J,scrollTop:c,smoothScrollTargetReached:h,totalCount:E,useWindowScroll:m,viewportDimensions:F,windowScrollContainerState:g,windowScrollTo:x,windowViewportRect:O,...p,gridState:I,horizontalDirection:Be,initialTopMostItemIndex:pe,totalListHeight:Xe,...f,endReached:Je,propsReady:w,rangeChanged:Ye,startReached:ut,stateChanged:$,stateRestoreInProgress:oe,...N}},He(Cs,ht,sn,Hl,lr,Ts,sr));function Kl(e,t,r){return Fr(1,Vn((e+r)/(Vn(t)+r)))}function Qi(e,t,r,n){const{height:o}=r;if(o===void 0||n.length===0)return{bottom:0,top:0};const s=Go(e,t,r,n[0].index);return{bottom:Go(e,t,r,n[n.length-1].index)+o,top:s}}function Go(e,t,r,n){const o=Vn(n/Kl(e.width,r.width,t.column)),s=o*r.height+Fr(0,o-1)*t.row;return s>0?s+t.row:s}var Dp=Te(([e,t])=>({...e,...t}),He(Bp,Te(()=>{const e=U(d=>`Item ${d}`),t=U({}),r=U(null),n=U("virtuoso-grid-item"),o=U("virtuoso-grid-list"),s=U(As),i=U("div"),a=U(Tr),l=(d,f=null)=>lt(z(t,Y(p=>p[d]),Pe()),f),c=U(!1),h=U(!1);return re(he(h),c),{components:t,computeItemKey:s,context:r,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:i,itemClassName:n,ItemComponent:l("Item","div"),itemContent:e,listClassName:o,ListComponent:l("List","div"),readyStateChanged:c,reportReadyState:h,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}))),Pp=B.memo(function(){const e=Ue("gridState"),t=Ue("listClassName"),r=Ue("itemClassName"),n=Ue("itemContent"),o=Ue("computeItemKey"),s=Ue("isSeeking"),i=xt("scrollHeight"),a=Ue("Item
177Component"),l=Ue("ListComponent"),c=Ue("ScrollSeekPlaceholder"),h=Ue("context"),d=xt("itemDimensions"),f=xt("gap"),p=Ue("log"),_=Ue("stateRestoreInProgress"),w=xt("reportReadyState"),v=Ht(B.useMemo(()=>m=>{const g=m.parentElement.parentElement.scrollHeight;i(g);const x=m.firstChild;if(x){const{height:O,width:N}=x.getBoundingClientRect();d({height:O,width:N})}f({column:$i("column-gap",getComputedStyle(m).columnGap,p),row:$i("row-gap",getComputedStyle(m).rowGap,p)})},[i,d,f,p]),!0,!1);return Wl(()=>{e.itemHeight>0&&e.itemWidth>0&&w(!0)},[e]),_?null:u(l,{className:t,ref:v,...ze(l,h),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(m=>{const g=o(m.index,m.data,h);return s?u(c,{...ze(c,h),height:e.itemHeight,index:m.index,width:e.itemWidth},g):Ie(a,{...ze(a,h),className:r,"data-index":m.index,key:g},n(m.index,m.data,h))})})}),zp=B.memo(function(){const e=Ue("HeaderComponent"),t=xt("headerHeight"),r=Ue("headerFooterTag"),n=Ht(B.useMemo(()=>s=>{t(Nt(s,"height"))},[t]),!0,!1),o=Ue("context");return e?u(r,{ref:n,children:u(e,{...ze(e,o)})}):null}),Hp=B.memo(function(){const e=Ue("FooterComponent"),t=xt("footerHeight"),r=Ue("headerFooterTag"),n=Ht(B.useMemo(()=>s=>{t(Nt(s,"height"))},[t]),!0,!1),o=Ue("context");return e?u(r,{ref:n,children:u(e,{...ze(e,o)})}):null}),Fp=({children:e})=>{const t=B.useContext(Ul),r=xt("itemDimensions"),n=xt("viewportDimensions"),o=Ht(B.useMemo(()=>s=>{n(s.getBoundingClientRect())},[n]),!0,!1);return B.useEffect(()=>{t&&(n({height:t.viewportHeight,width:t.viewportWidth}),r({height:t.itemHeight,width:t.itemWidth}))},[t,n,r]),u("div",{ref:o,style:Ir(!1),children:e})},Vp=({children:e})=>{const t=B.useContext(Ul),r=xt("windowViewportRect"),n=xt("itemDimensions"),o=vs(r,Ue("customScrollParent"),!1);return B.useEffect(()=>{t&&(n({height:t.itemHeight,width:t.itemWidth}),r({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,r,n]),u("div",{ref:o,style:Ir(!1),children:e})},{Component:Bm,useEmitter:Jl,useEmitterValue:Ue,usePublisher:xt}=Is(Dp,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},B.memo(function({...e}){const t=Ue("useWindowScroll"),r=Ue("customScrollParent"),n=r||t?Wp:Up,o=r||t?Vp:Fp,s=Ue("context");return u(n,{...e,...ze(n,s),children:u(o,{children:[u(zp,{}),u(Pp,{}),u(Hp,{})]})})})),Up=Ns({useEmitter:Jl,useEmitterValue:Ue,usePublisher:xt}),Wp=Rs({useEmitter:Jl,useEmitterValue:Ue,usePublisher:xt});function $i(e,t,r){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&r(`${e} was not resolved to pixel value correctly`,t,pt.WARN),t==="normal"?0:parseInt(t??"0",10)}function Yl(e){return qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"},child:[]}]})(e)}const Xl=({role:e})=>{if(!e||e.startsWith("level_")||e==="user")return null;let t,r,n,o,s,i,a=e;if(e==="admin")t="#f43f5e",r="#4c0519",n="#fda4af",o="ADMIN",s=u("path",{d:"M10 4 L14 7 L18 3 L16 11 L4 11 L2 3 L6 7 Z",fill:`url(#roleTxtGrad-${a})`}),i="translate(0, 3)";else if(e==="commentator"||e==="blv")a="blv",t="#6366f1",r="#1e1b4b",n="#c7d2fe",o="B.L.V",s=u(ct,{children:[u("rect",{x:"7",y:"3",width:"6",height:"7",rx:"2",fill:`url(#roleTxtGrad-${a})`}),u("path",{d:"M4 7 A6 6 0 0 0 16 7",stroke:`url(#roleTxtGrad-${a})`,strokeWidth:"1.5",fill:"none"})]}),i="translate(0, 2.5)";else if(e==="support")t="#10b981",r="#022c22",n="#a7f3d0",o="CSKH",s=u("path",{d:"M10 3 L16 5 L14 11 L10 13 L6 11 L4 5 Z",fill:`url(#roleTxtGrad-${a})`}),i="translate(0, 2.5)";else return null;
177return u("svg",{className:"badge-svg",width:"72",height:"22",viewBox:"0 0 72 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{overflow:"visible"},children:[u("defs",{children:[u("linearGradient",{id:`roleBg-${a}`,x1:"0",y1:"0",x2:"1",y2:"0",children:[u("stop",{offset:"0%",stopColor:r}),u("stop",{offset:"100%",stopColor:t,stopOpacity:"0.4"})]}),u("linearGradient",{id:`roleTxtGrad-${a}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[u("stop",{offset:"0%",stopColor:"#ffffff"}),u("stop",{offset:"100%",stopColor:n})]}),u("linearGradient",{id:`ironSheen-${a}`,x1:"-100%",y1:"0%",x2:"0%",y2:"0%",children:[u("stop",{offset:"0%",stopColor:"white",stopOpacity:"0"}),u("stop",{offset:"30%",stopColor:"white",stopOpacity:"0"}),u("stop",{offset:"50%",stopColor:"white",stopOpacity:"0.4"}),u("stop",{offset:"70%",stopColor:"white",stopOpacity:"0"}),u("stop",{offset:"100%",stopColor:"white",stopOpacity:"0"}),u("animate",{attributeName:"x1",from:"-100%",to:"100%",dur:"2.5s",repeatCount:"indefinite"}),u("animate",{attributeName:"x2",from:"0%",to:"200%",dur:"2.5s",repeatCount:"indefinite"})]})]}),u("path",{d:"M12 2 L66 2 L70 11 L66 20 L12 20 Z",fill:`url(#roleBg-${a})`,stroke:n,strokeWidth:"1"}),u("path",{d:"M13 3 L64 3 L67 11 L64 19 L13 19 Z",fill:"black",opacity:"0.2"}),u("path",{d:"M13 3 L64 3 L66 10 L13 10 Z",fill:"white",opacity:"0.15"}),u("path",{d:"M12 2 L66 2 L70 11 L66 20 L12 20 Z",fill:`url(#ironSheen-${a})`,pointerEvents:"none"}),u("circle",{cx:"10",cy:"11",r:"9",fill:r,stroke:n,strokeWidth:"1.2"}),u("circle",{cx:"10",cy:"11",r:"7.5",fill:`url(#roleBg-${a})`}),u("circle",{cx:"10",cy:"11",r:"7.5",fill:`url(#ironSheen-${a})`,pointerEvents:"none"}),u("g",{transform:i,children:s}),u("text",{x:"43",y:"11.5",dominantBaseline:"central",textAnchor:"middle",fill:`url(#roleTxtGrad-${a})`,fontFamily:"'Rajdhani', sans-serif",fontWeight:"700",fontSize:"10.5px",letterSpacing:"0.8",children:o})]})},Zl=({role:e})=>{let t=0;if(e&&e.startsWith("level_"))t=parseInt(e.split("_")[1],10);else if(!e||e==="user")t=0;else return null;let r;t===0?r={key:"lv0",stroke:"#94a3b8",text:"#ffffff",barGrad:["#334155","#0f172a"],gemGrad:["#64748b","#334155"]}:t===1?r={key:"lv1",stroke:"#fed7aa",text:"#ffffff",barGrad:["#7c2d12","#451a03"],gemGrad:["#f97316","#c2410c"]}:t===2?r={key:"lv2",stroke:"#fde047",text:"#ffffff",barGrad:["#78350f","#451a03"],gemGrad:["#d97706","#92400e"]}:t===3?r={key:"lv3",stroke:"#cbd5e1",text:"#ffffff",barGrad:["#475569","#1e293b"],gemGrad:["#94a3b8","#475569"]}:t===4?r={key:"lv4",stroke:"#e2e8f0",text:"#ffffff",barGrad:["#334155","#0f172a"],gemGrad:["#cbd5e1","#94a3b8"]}:t===5?r={key:"lv5",stroke:"#fef08a",text:"#ffffff",barGrad:["#713f12","#422006"],gemGrad:["#eab308","#ca8a04"]}:t===6?r={key:"lv6",stroke:"#facc15",text:"#ffffff",barGrad:["#854d0e","#451a03"],gemGrad:["#eab308","#b45309"]}:t===7?r={key:"lv7",stroke:"#99f6e4",text:"#ffffff",barGrad:["#115e59","#042f2e"],gemGrad:["#0d9488","#0f766e"]}:t>=8&&t<=11?r={key:"lv_epic",stroke:"#f472b6",text:"#ffffff",barGrad:["#581c87","#831843"],gemGrad:["#a855f7","#db2777"],holo:!0}:t>=12&&t<=15?r={key:"lv_mythic",stroke:"#fbcfe8",text:"#ffffff",barGrad:["#7c2d12","#500724"],gemGrad:["#f97316","#e11d48"],holo:!0}:t>=16&&t<=19?r={key:"lv_legendary",stroke:"#67e8f9",text:"#ffffff",barGrad:["#0f172a","#1e3a8a"],gemGrad:["#06b6d4","#3b82f6"],holo:!0}:r={key:"lv_cosmic",stroke:"#a78bfa",text:"#ffffff",barGrad:["#4c1d95","#0369a1"],gemGrad:["#ec4899","#06b6d4"],holo:!0};const n=r.holo;return u("svg",{className:"badge-svg",width:"54",height:"20",viewBox:"0 0 54 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u("defs",{children:[u("linearGradient",{id:`bar-${r.key}-${t}`,x1:"0",y1:"0",x2:"1",y2:"0",children:[u("stop",{offset:"0%",stopColor:r.barGrad[0]}),u("stop",{offset:"100%",stopColor:r.barGrad[1]})]}),u("linearGradient",{id:`gem-${r.key}-${t}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[u("stop",{offset:"0%",stopColor:r.gemGrad[0]}),u("stop",{offset:"100%",stopColor:r.gemGrad[1]})]}),n&&u("linearGradient",{id:`ironSheen-${r.key}-${t}`,x1:"-100%",y1:"0%",x2:"0%",y2:"0%",children:[u("stop",{offset:"0%",stopColor:"white",stopOpacity:"0"}),u("stop",{offset:"30%",stopColor:"white",stopOpacity:"0"}),u("stop",{offset:"50%",stopColor:"white",stopOpacity:"0.4"}),u("stop",{offset:"70%",stopColor:"white",stopOpacity:"0"}),u("stop",{offset:"100%",stopColor:"white",stopOpacity:"0"}),u("animate",{attributeName:"x1",from:"-100%",to:"100%",dur:"2.5s",repeatCount:"indef
177inite"}),u("animate",{attributeName:"x2",from:"0%",to:"200%",dur:"2.5s",repeatCount:"indefinite"})]})]}),u("path",{d:"M10 2 H48 A10 10 0 0 1 48 18 H10 Z",fill:`url(#bar-${r.key}-${t})`,stroke:r.stroke,strokeWidth:"0.8"}),u("path",{d:"M12 3 H44 C47 3 47 9 44 9 H12 Z",fill:"white",opacity:"0.15"}),n&&u("path",{d:"M10 2 H48 A10 10 0 0 1 48 18 H10 Z",fill:`url(#ironSheen-${r.key}-${t})`,pointerEvents:"none"}),u("path",{d:"M10 1 L18 6 L18 14 L10 19 L2 14 L2 6 Z",fill:r.stroke}),u("path",{d:"M10 2 L16 6 L16 13 L10 17 L4 13 L4 6 Z",fill:`url(#gem-${r.key}-${t})`}),u("path",{d:"M10 2 L16 6 L10 9 Z",fill:"white",opacity:"0.35"}),u("path",{d:"M4 6 L10 2 L10 9 Z",fill:"black",opacity:"0.15"}),u("path",{d:"M10 17 L16 13 L10 9 Z",fill:"black",opacity:"0.25"}),n&&u("path",{d:"M10 2 L16 6 L16 13 L10 17 L4 13 L4 6 Z",fill:`url(#ironSheen-${r.key}-${t})`,pointerEvents:"none"}),u("text",{x:"33",y:"10.5",dominantBaseline:"central",textAnchor:"middle",fill:r.text,fontFamily:"'Rajdhani', sans-serif",fontWeight:"900",fontSize:"11px",letterSpacing:"0.2",children:["Lv",t]})]})};var jp=({msg:e,onRemove:t})=>{const[r,n]=ee(!0);return xe(()=>{const o=setTimeout(()=>{n(!1),t?.(e.id)},5e3);return()=>clearTimeout(o)},[e.id,t]),r?u("div",{className:"chat-system-msg-row",children:u("div",{className:"chat-text-body tw-text-chat-text-muted tw-flex tw-items-center tw-gap-1.5 tw-flex-wrap",children:[u("span",{className:"chat-badge-hi chat-badge-system",children:"Hi"}),u(Zl,{role:e.role}),u(Xl,{role:e.role}),u("span",{className:"tw-font-bold tw-text-chat-text-main",children:e.sender}),u("span",{children:"đã tham gia phòng trò chuyện"})]})}):null},qp=jp;const Mr=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");var Gp=e=>e.replace(/(?:https?:\/\/|www\.|[a-zA-Z0-9-]+\.[a-zA-Z]{2,}(?:\/[^\s)]*)?)(?:[^\s)]*)/gi,t=>`<a href="${t.startsWith("http")?t:`https://${t}`}" target="_blank" rel="noopener" class="chat-link">${t}</a>`),Kp=e=>e.replace(/(\+84|84|0)\d{8,11}/g,t=>t.length<9?t:t.slice(0,-3)+"***");const Jp=[{id:"flower",emoji:"🌸",label:"Bông hoa",messageText:"Tuyệt vời!"},{id:"clap",emoji:"👏",label:"Vỗ tay",messageText:"Hoan hô!"},{id:"heart",emoji:"❤️",label:"Yêu thích",messageText:"Yêu thích!"},{id:"fire",emoji:"🔥",label:"Lửa",messageText:"Quá đỉnh!"},{id:"fireworks",emoji:"🎉",label:"Pháo hoa",messageText:"Chúc mừng!"}];var ea=(e,t)=>{if(e){const r=e.trim().match(/^\[fx:([a-zA-Z0-9_-]+)\]$/);if(r){const n=r[1],o=Jp.find(s=>s.id===n);if(o)return Mr(`${o.emoji}${o.messageText}`)}}return e&&e.startsWith("[sticker]")?`<img src="${Mr(e.replace("[sticker]",""))}" alt="sticker" class="chat-sticker-img" />`:e&&e.startsWith("[gif]")?`<img src="${Mr(e.replace("[gif]",""))}" alt="gif" class="chat-gif-img" />`:Gp(Mr(al(Kp(e||""),t))).replace(/\n/g,"<br/>")},Yp=e=>e&&(e.startsWith("[sticker]")||e.startsWith("[gif]")),Xp=[{key:"level_0",label:"Cấp 0",badge:"Lv0",color:"#94a3b8"},{key:"level_1",label:"Cấp 1",badge:"Lv1",color:"#d97706"},{key:"level_2",label:"Cấp 2",badge:"Lv2",color:"#b45309"},{key:"level_3",label:"Cấp 3",badge:"Lv3",color:"#64748b"},{key:"level_4",label:"Cấp 4",badge:"Lv4",color:"#475569"},{key:"level_5",label:"Cấp 5",badge:"Lv5",color:"#eab308"},{key:"level_6",label:"Cấp 6",badge:"Lv6",color:"#ca8a04"},{key:"level_7",label:"Cấp 7",badge:"Lv7",color:"#0d9488"},{key:"level_8",label:"Cấp 8",badge:"Lv8",color:"#db2777"},{key:"level_9",label:"Cấp 9",badge:"Lv9",color:"#db2777"},{key:"level_10",label:"Cấp 10",badge:"Lv10",color:"#db2777"},{key:"level_11",label:"Cấp 11",badge:"Lv11",color:"#db2777"},{key:"level_12",label:"Cấp 12",badge:"Lv12",color:"#ea580c"},{key:"level_13",label:"Cấp 13",badge:"Lv13",color:"#ea580c"},{key:"level_14",label:"Cấp 14",badge:"Lv14",color:"#ea580c"},{key:"level_15",label:"Cấp 15",badge:"Lv15",color:"#ea580c"},{key:"level_16",label:"Cấp 16",badge:"Lv16",color:"#0284c7"},{key:"level_17",label:"Cấp 17",badge:"Lv17",color:"#0284c7"},{key:"level_18",label:"Cấp 18",badge:"Lv18",color:"#0284c7"},{key:"level_19",label:"Cấp 19",badge:"Lv19",color:"#0284c7"}
177,{key:"level_20",label:"Cấp 20",badge:"Lv20",color:"#a855f7"},{key:"support",label:"CSKH",badge:"CSKH",color:"#10b981"},{key:"commentator",label:"BLV",badge:"BLV",color:"#6366f1"},{key:"admin",label:"Admin",badge:"ADMIN",color:"#f43f5e"},{key:"bot",label:"Bot",badge:"BOT",color:"#8b5cf6"}],Zp=(e,t)=>{const r=(t&&t.length>0?t:Xp).find(n=>n.key===e);return r?r.color:"gray"},Qp=e=>e.role==="admin"?e.name||"Admin":e.role==="level_0"?e.sender:(e.role&&(e.role.startsWith("level_")||e.role==="blv"),e.name||e.sender),$p=B.memo(({msg:e,user:t,blockedKeywords:r,onUserClick:n,isAdminOrBlv:o,isSelectMode:s,isSelected:i,onSelect:a,onRemove:l})=>{const{rolesConfig:c}=pr()||{},[h,d]=ee(!1),f=me(null),p=me(null),_=St(()=>ea(e.text,r),[e.text,r]);xe(()=>{const E=S=>{const I=S.composedPath?S.composedPath():[S.target];f.current&&!I.includes(f.current)&&d(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);const w=E=>{o&&(E.preventDefault(),d(!0))},v=()=>{o&&(p.current=setTimeout(()=>{d(!0)},500))},m=()=>{p.current&&clearTimeout(p.current)},g=(e.role||"").toString().toLowerCase();if(g==="bot"||g==="bot_system"||g==="bot_systeam"||g.includes("bot")&&g.includes("system"))return u("div",{className:"chat-system-bot",children:u("div",{className:"chat-message-text chat-text-body",children:[u("span",{className:"chat-badge-system-bot",children:"Tin nhắn hệ thống"}),u("span",{dangerouslySetInnerHTML:{__html:ea(e.text,r)}})]})});if(e.type==="system_join")return u(qp,{msg:e,onRemove:l});const x=!!t&&(t.isAnonymous&&String(e.anonymousId)===String(t.uid)||!t.isAnonymous&&String(e.uid)===String(t.user_id||t.uid)),O=e.role==="admin"||e.role==="commentator"||e.isAdmin,N=!x&&n&&!O&&!s;return u("div",{className:Le("chat-message-row tw-group",i&&"chat-bg-primary-20"),onContextMenu:w,onTouchStart:v,onTouchEnd:m,onClick:()=>s&&a&&a(e),children:[s&&u("div",{className:Le("chat-flex-center tw-mr-2",x?"tw-ml-2 tw-mr-0":""),children:u("div",{className:Le("chat-checkbox-circle",i?"tw-border-chat-primary tw-bg-chat-primary":"tw-border-chat-text-muted"),children:i&&u(ou,{className:"tw-text-white tw-text-xs"})})}),u("div",{className:"tw-flex-1 tw-min-w-0",children:u("div",{className:"chat-message-body",children:[u("span",{onClick:E=>{s||N&&(E.stopPropagation(),n(e))},className:Le("chat-message-name",e.isAdmin&&"chat-message-name-admin",N&&"chat-message-name-clickable"),title:N?"Nhấn để chặn":"",style:{display:"inline-flex",alignItems:"center",gap:"5px",flexWrap:"wrap",verticalAlign:"middle",lineHeight:"1"},children:[u(Zl,{role:e.role}),u(Xl,{role:e.role}),u("span",{style:{color:Zp(e.role,c),display:"inline-flex",alignItems:"center",lineHeight:"1"},children:Qp(e)}),u("span",{className:"tw-text-chat-text-mute",style:{display:"inline-flex",alignItems:"center",lineHeight:"1"},children:":"})]}),u("span",{className:Le("chat-message-text-content",Yp(e.text)&&"tw-mt-1"),dangerouslySetInnerHTML:{__html:_}})]})}),h&&!s&&u("div",{ref:f,className:"chat-context-menu",style:{top:"50%",left:"50%",transform:"translate(0, -50%)"},children:u("button",{onClick:E=>{E.stopPropagation(),d(!1),a(e)},className:"chat-context-menu-item tw-text-chat-text-main",className:"chat-context-menu-item tw-text-red-400",children:[u(Yl,{})," Xóa tin nhắn"]})})]})}),em=$p,Ql=B.memo(({ad:e})=>e?u("div",{className:"tw-block tw-gap-2 tw-px-3 tw-py-1 ad-message-enter tw-bg-amber-50 dark:tw-bg-amber-800",children:[u("span",{className:"chat-badge-ad tw-mt-0.5 tw-mr-1",children:"Hệ thống"}),u("span",{className:"tw-text-sm tw-text-chat-text-main tw-text-slate-700 [&_a]:tw-text-blue-500! [&_a]:tw-font-bold  [&>p]:tw-inline",dangerouslySetInnerHTML:{__html:e.content||""}})]}):null);Ql.displayName="AdMessage";var tm=Ql;const rm=e=>{if(!e||typeof e!="string")return"";const t=new DOMParser().parseFromString(e,"text/html"),r=new Set(["b","i","strong","em","a","br","p","span","ul","ol","li","img","div","h1","h2","h3","h4","h5","h6","code","pre"]),n=new Set(["href","target","rel","class","id","src","alt","width","height","style"]),o=s=>{if(!s)return;const i=Array.from(s.childNodes);for(const a of i){if(a.nodeType===Node.ELEMENT_NODE){const l=a.tagName.toLowerCase();if(!r.has(l)){a.replaceWith(...Array.from(a.childNodes));continue}const c=Array.from(a.attributes);
177for(const h of c){const d=h.name.toLowerCase(),f=h.value||"";if(!n.has(d)){a.removeAttribute(h.name);continue}if((d==="href"||d==="src")&&!/^https?:\/\//i.test(f)){a.removeAttribute(h.name);continue}d==="target"&&(a.setAttribute("target","_blank"),a.setAttribute("rel","nofollow noopener"))}l==="a"&&a.getAttribute("href")&&(a.setAttribute("target","_blank"),a.setAttribute("rel","nofollow noopener"))}else if(a.nodeType===Node.COMMENT_NODE){a.remove();continue}else if(a.nodeType===Node.DOCUMENT_TYPE_NODE){a.remove();continue}o(a)}};return o(t.body),t.body.innerHTML};var nm=({virtuosoRef:e,filteredMessages:t,firstItemIndex:r,historyLoading:n,loading:o,error:s,isBlocked:i,activeTab:a,currentMatchId:l,hasMoreHistory:c,loadMoreHistory:h,handleScroll:d,atBottom:f,isInitialLoadForRoom:p,scrollToBottom:_,setAtBottom:w,setShowNewMessageAlert:v,setUnreadCount:m,setIsInitialLoadForRoom:g,isNearBottomRef:x,user:O,blockedKeywords:N,isAdminOrBlv:E,handleUserClick:S,isSelectMode:I,selectedMessages:F,handleSelectMessage:M,handleDeleteSingle:J,handleRemoveSystemMessage:H,siteConfig:j,blockWarning:P,showBanner:Q,setShowBanner:$})=>{const{toasts:le}=ja(),oe=St(()=>{const pe=le.filter(ye=>ye.type==="error"&&ye.visible);return pe.length>0?pe[pe.length-1]:null},[le]);return xe(()=>{Q&&_()},[Q,_]),u(ct,{children:[i&&u("div",{className:"chat-overlay-full tw-bg-chat-header-bg tw-z-50 tw-p-4",children:u("div",{className:"chat-error-banner tw-text-sm tw-p-3",children:"Bạn đã bị chặn chat."})}),u("div",{className:"chat-scroll-area",children:[j?.sticky_enabled&&j?.sticky_message&&u("div",{className:"sticky-message sticky-announcement",children:[u("div",{className:"sticky-header",children:[u("span",{className:"sticky-icon-inline",children:u("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round",className:"sticky-svg",children:[u("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),u("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),u("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]})}),u("span",{className:"sticky-title",children:"Thông báo"})]}),u("div",{className:"sticky-content-text",dangerouslySetInnerHTML:{__html:rm(j.sticky_message)}})]}),(P||oe)&&u("div",{className:"tw-w-full tw-bg-red-500 tw-text-white tw-text-sm tw-p-1 tw-text-center tw-shrink-0 tw-absolute tw-top-0 tw-left-0 tw-z-50",children:oe?oe.message:"Nội dung không được chứa link liên kết"}),u("div",{className:"tw-grow tw-h-full tw-min-h-0",children:u("div",{className:"tw-h-full tw-flex tw-flex-col tw-px-0 tw-pt-2 tw-space-y-1",children:[a==="match"&&!l&&u("div",{className:"tw-text-center tw-text-chat-text-muted tw-text-xs tw-py-4",children:["Không tìm thấy trận đấu này. ",u("br",{})," Vui lòng kiểm tra lại đường dẫn."]}),s&&u("div",{className:"chat-error-banner tw-text-xs tw-p-2 tw-mb-2",children:s}),u(xp,{className:"custom-scrollbar tw-grow",ref:e,style:{height:"100%"},data:t,firstItemIndex:r,initialTopMostItemIndex:{index:t.length>0?r+t.length-1:r,align:"end"},onScroll:d,components:{Header:()=>u("div",{className:"tw-flex tw-justify-center tw-w-full"+(n?"tw-py-2":""),style:{minHeight:n?"30px":"0px"},children:n&&u("span",{className:"chat-text-muted-xs",children:"Đang tải..."})}),Footer:()=>u("div",{className:"tw-h-4"})},itemContent:(pe,ye)=>u("div",{className:"tw-py-0.5",children:ye.type==="ad"?u(tm,{ad:ye.ad}):u(em,{msg:ye,user:O,blockedKeywords:N,onUserClick:E?S:void 0,isAdminOrBlv:E,isSelectMode:I,isSelected:F.includes(ye.id),onSelect:M,onDelete:J,onRemove:H},ye.id)}),followOutput:()=>p?"auto":f?"smooth":!1,atBottomStateChange:pe=>{w(pe),x.current=pe,pe&&(v(!1),m(0),g(!1))},startReached:()=>{c&&!n&&h()}}),o&&u("div",{className:"chat-overlay-full chat-flex-center tw-bg-chat-header-bg/50 tw-z-10",children:u("div",{className:"tw-flex tw-flex-col tw-items-center tw-gap-2",children:[u("div",{className:"tw-w-8 tw-h-8 tw-border-4 tw-border-chat-primary tw-border-t-transparent tw-rounded-full tw-animate-spin"}),u("span",{className:"tw-text-sm tw-text-chat-text-main tw-font-medium",children:"Đang tải tin nhắn..."})]})})]})}),!f&&u("div",{className:"tw-absolute tw-left-1/2 -tw-translate-x-1/2 tw-z-30 tw-bottom-2",children:u("button",{class:"tw-inline-flex tw-items-center tw-justify-center tw-gap-2 tw-whitespace-nowrap tw-transition-colors tw-focus-visible:outline-none tw-focus-visible:ring-1 tw-focus-visible:ring-ring tw-disabled:pointer-events-none tw-disabled:opacity-50 [&_svg]:tw-pointer-events-none [&_svg]:tw-size-4 [&_svg]:tw-shrink-0 tw-bg-primary tw-shadow tw-px-4 tw-py-2 tw-h-6 tw-rounded-full tw-bg-[linear-gradient(90deg,_#FFDE29_0%,_#FFF17A_18.5%,_#FFDE29_38%,_#FFD852_58%,_#FFF17A_75.5%,_#FFDE29_88%,_#FE7_100%)] tw-text-xs tw-font-medium tw-text-black hover:tw-bg-[#ffdf29f1]",onClick:()=>{_(),v(!1),m(0)},"aria-label":"Cuộn xuống cuối",title:"Cuộn xuống cuối",children:[u("span",{children:"Tin nhắn mới"}),u("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-chevrons-down",children:[u("path",{d:"m7 6 5 5 5-5"}),u("path",{d:"m7 13 5 5 5-5"})]})]})})]})]})},om=nm,sm=15e3;function Ko(e){try{return new URL(e,window.location.href).href}catch{return e}}function im(e){if(!e||!e.trim())return null;let t=e.trim();return t.startsWith("//")?`https:${t}`:t.startsWith("http")?t:`https://${t}`}function am(e){return e.replace(/\/c-asyncjs\.php(\?.*)?$/,"/c-asyncspc.php")}function lm(e,t,r){const n={zones:String(e),loc:window.location.href,referrer_domain:r,referrer_subdomain:new URL(t).hostname};return document.referrer&&(n.referer=document.referrer),n}function cm(e){const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t.join("&")}function um(e,t){const r=document.getElementById(t);if(r instanceof HTMLScriptElement&&r.getAttribute("src"))return r;const n=Ko(e);for(const o of document.querySelectorAll("script[src]"))if(Ko(o.getAttribute("src")||"")===n)return o;return null}function dm(e,t){if(e.innerHTML="",t.iframeFriendly){const n=document.createElement("iframe");n.scrolling="no",n.frameBorder="0",n.allow="autoplay",n.width=String(t.width>0?t.width:0),n.height=String(t.height>0?t.height:0),n.style.border="0",n.style.overflow="hidden",e.appendChild(n);const o='<!DOCTYPE html><html><head><base target="_top"><meta charset="UTF-8"></head><body border="0" margin="0" style="margin:0;padding:0;">'+t.html+"</body></html>";if("srcdoc"in n)n.srcdoc=o;else{const s=n.contentWindow.document||n.contentDocument;s.open(),s.write(o),s.close()}return}e.innerHTML=t.html;const r=e.querySelectorAll("script");for(let n=r.length-1;n>=0;n--){const o=r[n],s=document.createElement("script");for(let i=0;i<o.attributes.length;i++)s[o.attributes[i].nodeName]=o.attributes[i].value;o.innerHTML&&(s.text=o.innerHTML),o.parentNode.replaceChild(s,o)}}function hm(e,t,r,{enabled:n=!0}={}){const o=me(null),[s,i]=ee(!1),[a,l]=ee(!0),c=!e||!t||s;return xe(()=>{if(!e||!t||!n){const m=setTimeout(function(){l(!1)},0);return function(){clearTimeout(m)}}const h=im(r);
177if(!h){const m=setTimeout(function(){i(!0),l(!1)},0);return function(){clearTimeout(m)}}const d=window.location.hostname;let f=!1;const p=am(h),_=cm(lm(e,h,d)),w=new XMLHttpRequest;w.onreadystatechange=function(){if(!f&&w.readyState===4){if(w.status===200&&o.current)try{const m=JSON.parse(w.responseText),g=Object.values(m)[0];g&&g.html&&dm(o.current,g)}catch(m){console.error("Ad parse error",m)}f||l(!1)}},w.open("GET",p+"?"+_,!0),w.withCredentials=!0,w.timeout=sm,w.ontimeout=function(){f||l(!1)},w.send();const v="__revive_async_"+Ko(h).replace(/[^a-z0-9]/gi,"_");if(!um(h,v)){const m=document.createElement("script");m.id=v,m.async=!0,m.src=h;const g=function(){return document.body?(document.body.appendChild(m),!0):!1};g()||(document.readyState!=="loading"?requestAnimationFrame(g):document.addEventListener("DOMContentLoaded",g,{once:!0}))}return function(){f=!0}},[e,t,r,n]),{containerRef:o,adsScriptFailed:c,scriptLoading:a}}var fm=({zoneIdKey:e="728_90",onClose:t,className:r=""})=>{const{siteConfig:n}=pr(),o=n?.banner_zone_id?.[e.replace(/_/g,"")],s=n?.revive_instance_id,i=n?.revive_script_host,a=n?.banner_enabled!==!1,l="dv2-banner-zone-"+e.replace(/_/g,""),[c,h]=ee(!1),{containerRef:d,adsScriptFailed:f}=hm(o,s,i);return!o||!s||!a||c||f?null:u("div",{className:`tw-w-full tw-shrink-0 tw-relative tw-bg-chat-header-bg tw-border-chat-border ${l} ${r}`.trim(),children:[u("div",{ref:d,className:"tw-w-full chat-flex-center"}),t&&u("button",{onClick:()=>{h(!0),t?.()},className:"chat-banner-close","aria-label":"Đóng quảng cáo",children:"✕"})]})},yn=fm,vo=[{id:"smileys",label:"😀",title:"Mặt cười & Cảm xúc",emojis:["😀","😃","😄","😁","😆","😅","😂","🤣","😊","😇","🙂","🙃","😉","😌","😍","🥰","😘","😗","😙","😚","😋","😛","😝","😜","🤪","🤨","🧐","😎","🤩","🥳","😏","😒","😞","😔","😟","😕","🙁","☹️","😣","😖","😫","😩","🥺","😢","😭","😤","😠","😡","🤬","🤯","😳","🥵","🥶","😱","😨","😰","😥","😓","🤔","🤭","🤫","🤥","😶","😐","😑","😬","🙄","😮","😴","🤢"]},{id:"gestures",label:"👍",title:"Cử chỉ & Con người",emojis:["👍","👎","👊","✊","🤛","🤜","🤞","✌️","🤟","🤘","👌","🤌","🤏","👈","👉","👆","👇","☝️","✋","🤚","🖐️","👋","🤙","💪","🙏","👏","🙌","👐","🤝","✍️","💅","🤳","👂","👃","👀","🧠","🦷","🗣️","👤","👥"]},{id:"hearts",label:"❤️",title:"Trái tim & Ký hiệu",emojis:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","🤎","💔","❣️","💕","💞","💓","💗","💖","💘","💝","💟","✨","🌟","⭐","💫","🔥","💥","💯","💢","💬","💭","💤","🌐","💠","🌀","🔔","🔕","🎵","🎶","➕","➖","✖️"]},{id:"activities",label:"🎉",title:"Hoạt động & Khác",emojis:["🎉","🎁","🎂","🎈","🎊","🧧","🏆","🥇","🥈","🥉","🏅","🎖️","🎫","🎟️","⚽","🏀","🏈","⚾","🎾","🏐","🎮","🕹️","🎲","🎰","🍺","🍻","🥂","🍷","🥃","☕","🍵","🥤","🍽️","💡","🚀","🍀","🌸","👻","💩","👽"]}],pm=({onEmojiClick:e})=>{const{siteConfig:t}=pr(),[r,n]=ee("smileys"),o=t?.theme_mode==="dark",s=a=>{e&&e({emoji:a})},i=vo.find(a=>a.id===r)||vo[0];return u("div",{className:Le("tw-w-full tw-h-[300px] tw-flex tw-flex-col tw-rounded-lg tw-overflow-hidden tw-select-none",o?"tw-bg-[#222] tw-text-white tw-border tw-border-gray-800":"tw-bg-white tw-text-gray-800 tw-border tw-border-gray-200"),children:[u("div",{className:Le("tw-flex tw-items-center tw-px-2 tw-py-1.5 tw-gap-1 tw-border-b tw-shrink-0 tw-justify-between",o?"tw-border-gray-800 tw-bg-[#1a1a1a]":"tw-border-gray-200 tw-bg-gray-50"),children:[u("div",{className:"tw-flex tw-gap-1",children:vo.map(a=>u("button",{onClick:()=>n(a.id),className:Le("tw-text-xl tw-p-1.5 tw-rounded-md tw-transition-all tw-duration-150 active:tw-scale-95",r===a.id?o?"tw-bg-gray-800":"tw-bg-gray-200":"hover:tw-bg-gray-100 dark:hover:tw-bg-gray-800/50"),title:a.title,children:a.label},a.id))}),u("span",{className:Le("tw-text-xs tw-font-semibold tw-pr-2",o?"tw-text-gray-400":"tw-text-gray-500"),children:i.title})]}),u("div",{className:"tw-flex-1 tw-overflow-y-auto no-scrollbar tw-p-3",children:u("div",{className:"tw-grid tw-gri
177d-cols-8 tw-gap-2.5 tw-justify-items-center",children:i.emojis.map((a,l)=>u("button",{onClick:()=>s(a),className:Le("tw-text-2xl tw-w-9 tw-h-9 tw-flex tw-items-center tw-justify-center tw-rounded-md tw-transition-all tw-duration-150","hover:tw-scale-125 hover:tw-bg-gray-100 dark:hover:tw-bg-gray-800 active:tw-scale-90"),children:a},`${r}-${l}`))})})]})},mm=pm;function gm(e){return qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18 8.31c-.36-.41-.73-.82-1.12-1.21l-.29-.27.14-.12a3.15 3.15 0 0 0 .9-3.49A3.91 3.91 0 0 0 14 1v2a2 2 0 0 1 1.76 1c.17.4 0 .84-.47 1.31-.07.08-.15.13-.22.2-3-2.41-6.29-3.77-7.9-2.16a2.16 2.16 0 0 0-.41.59v.1l-.18.53-4.41 13.1A3.28 3.28 0 0 0 5.28 22a3.21 3.21 0 0 0 1-.17L20 17.28a1 1 0 0 0 .43-.31l.21-.18c1.43-1.44.51-4.21-1.41-6.9A6.63 6.63 0 0 1 23 9V7a8.44 8.44 0 0 0-5 1.31zM5.7 19.93a1.29 1.29 0 0 1-1.63-1.63l1.36-4.1a10.7 10.7 0 0 0 4.29 4.39zm7-2.33a8.87 8.87 0 0 1-6.3-6.29l1-3 .06.09c.11.22.25.45.39.68s.16.29.26.44.33.48.51.73.19.28.3.42.43.55.66.82l.29.35c.34.39.7.77 1.08 1.16s.68.64 1 1l.33.28.78.63.37.28c.28.2.55.4.83.58l.31.2c.36.22.72.43 1.07.61h.05zm6.51-2.23h-.06c-.69.38-3.56-.57-6.79-3.81-.34-.34-.66-.67-.95-1l-.29-.35-.53-.64-.29-.4c-.13-.19-.27-.37-.39-.55l-.26-.42-.29-.47c-.08-.14-.14-.27-.21-.4s-.15-.26-.21-.4a3.31 3.31 0 0 1-.14-.36c-.05-.13-.11-.26-.15-.38S8.6 6 8.57 5.88s-.05-.22-.07-.32a2.26 2.26 0 0 1 0-.26 1 1 0 0 1 0-.24l.11-.31c.36-.36 2.23 0 4.73 1.9A4.13 4.13 0 0 1 12 7v2a6.45 6.45 0 0 0 3-.94l.48.46c.42.42.81.85 1.18 1.28a5.32 5.32 0 0 0-.6 3.4l2-.39a3.57 3.57 0 0 1 0-1.12 11.3 11.3 0 0 1 .81 1.45c.56 1.32.52 2.06.34 2.23z"},child:[]}]})(e)}var _m="tIWWEzjLhPYE94y08alTq5fvK6xQGOnO",ta="https://api.giphy.com/v1/gifs",ym=[{id:"trending",icon:null,label:"Trending",searchTerm:""},{id:"love",icon:u(au,{size:18}),label:"Love",searchTerm:"love"},{id:"like",icon:u(iu,{size:18}),label:"Like",searchTerm:"thumbs up"},{id:"dislike",icon:u(su,{size:18}),label:"Dislike",searchTerm:"thumbs down"},{id:"party",icon:u(gm,{size:20}),label:"Party",searchTerm:"party"},{id:"happy",icon:u(Da,{size:18}),label:"Happy",searchTerm:"happy"}],wm=({onSelect:e})=>{const{siteConfig:t}=pr(),[r,n]=ee([]),[o,s]=ee(!1),[i,a]=ee(""),[l,c]=ee("trending"),h=me(null),d=me(null),f=t?.theme_mode==="dark",p=async(m="")=>{s(!0);try{const g=m?`${ta}/search`:`${ta}/trending`,x=new URLSearchParams({api_key:_m,limit:30,rating:"g",q:m});n((await(await fetch(`${g}?${x}`)).json()).data||[])}catch(g){console.error("Error fetching GIFs:",g)}finally{s(!1)}};xe(()=>{p()},[]),kr(()=>{const m=d.current;m&&m.style.setProperty("padding","0px","important")},[]);const _=m=>{const g=m.target.value;a(g),c(g?"search":"trending"),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{p(g)},500)},w=m=>{c(m.id),a(""),p(m.searchTerm)},v=m=>{const g=m.images?.fixed_height?.url||m.images?.original?.url;g&&e&&e(g)};return u("div",{className:Le("tw-w-full tw-h-[350px] tw-flex tw-flex-col tw-rounded-lg tw-overflow-hidden",f?"tw-bg-[#222] tw-text-white":"tw-bg-white tw-text-gray-800"),children:[u("div",{className:Le("tw-flex tw-items-center tw-px-2 tw-py-2 tw-gap-2 tw-border-b tw-shrink-0",f?"tw-border-gray-700":"tw-border-gray-200"),children:[u("div",{className:Le("chat-gif-search-bar",f?"tw-bg-gray-800":"tw-bg-gray-100"),children:[u(lu,{className:"tw-text-gray-400",size:14}),u("input",{ref:d,type:"text",placeholder:"Search",name:"search_gif",value:i,onChange:_,className:Le("!tw-bg-transparent !tw-shadow-none !tw-border-none !tw-pl-0 !tw-p-0 !tw-h-auto focus:tw-outline-none tw-outline-none tw-w-full tw-text-sm input_gif",f?"!tw-text-white !tw-placeholder-gray-500":"!tw-text-gray-800 !tw-placeholder-gray-500")})]}),u("div",{className:"tw-flex tw-items-center tw-gap-1",children:ym.filter(m=>m.icon).map(m=>u("button",{onClick:()=>w(m),className:Le("chat-gif-category-btn",l===m.id?f?"tw-bg-gray-700 tw-text-white":"tw-bg-gray-200 tw-text-gray-900":"tw-text-gray-400 hover:tw-text-gray-500"),title:m.label,children:m.icon},m.id))})]}),u("div",{className:"tw-flex-1 tw-overflow-y-auto custom-scrollbar tw-p-2",children:[o?u("div",{className:"chat-empty-state",children:"Loading..."}
177):u("div",{className:"tw-grid tw-grid-cols-2 tw-gap-2",children:r.map(m=>u("button",{onClick:()=>v(m),className:"chat-gif-card",children:u("img",{src:m.images.preview_gif?.url||m.images.fixed_height_small.url,alt:m.title,className:"tw-w-full tw-h-full tw-object-cover",loading:"lazy"})},m.id))}),!o&&r.length===0&&u("div",{className:"chat-empty-state tw-text-sm",children:"No GIFs found"})]})]})},vm=wm,bm=e=>Mr(e||"").replace(/\n/g,"<br/>"),xm=e=>{e&&(e.style.height="auto",e.style.height=e.scrollHeight+"px")},ra=e=>{if(!e)return"KH";const t=e.trim().split(" ");return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()},km=({inputText:e,setInputText:t,handleSend:r,handleLoginAnonymous:n,userNameInput:o,setUserNameInput:s,showEmojiPicker:i,setShowEmojiPicker:a,showGifPicker:l,setShowGifPicker:c,onEmojiClick:h,onGifSelect:d,inputRef:f,emojiPickerRef:p,gifPickerRef:_,mustLoginToChat:w,currentMatchId:v,activeTab:m,isConnected:g,blockedKeywords:x,isDark:O,siteConfig:N,user:E,handleLogout:S,isSelectMode:I,selectedMessages:F,handleCancelSelect:M,handleDeleteSelected:J,_blockedList:H,_setBlockedList:j,onShowAuthModal:P,isAdminOrBlv:Q,setIsSelectMode:$})=>{const le=N?.theme_id==="cyber-yellow";return xe(()=>{xm(f.current)},[e,f]),u("div",{className:"tw-bg-chat-header-bg tw-border-t tw-border-chat-border tw-shrink-0 tw-relative",children:[i&&u("div",{className:"chat-picker-wrapper",ref:p,onMouseDown:oe=>oe.stopPropagation(),children:u("div",{className:"chat-picker-container emoji-picker-wrapper",children:u(mm,{onEmojiClick:h})})}),l&&u("div",{className:"chat-picker-wrapper",ref:_,onMouseDown:oe=>oe.stopPropagation(),children:u("div",{className:"chat-picker-container",children:u(vm,{onSelect:d})})}),E&&!w?u(ct,{children:I?u("div",{className:"chat-select-bar",children:[u("span",{className:Le("tw-text-sm tw-flex-1 tw-font-bold",O?"tw-text-white":"tw-text-black"),children:["Đã chọn ",F.length," tin nhắn"]}),u("button",{onClick:M,className:"chat-btn-ghost-sm",children:"Hủy"}),u("button",{onClick:J,className:"chat-btn-danger-sm",children:[u(Yl,{})," Xóa"]})]}):u("div",{className:"chat-input-container",children:[E&&u("div",{className:"chat-auth-avatar tw-ml-1 tw-shrink-0 tw-relative",children:[u("span",{className:"chat-auth-avatar-text",children:ra(E.name||E.displayName||E.username)}),u("div",{className:Le("tw-absolute -tw-top-1 -tw-left-1 tw-flex tw-size-2 tw-min-w-2 status-dot-wrapper tw-rounded-full tw-border",O?"tw-border-chat-input-bg":"tw-border-white"),children:[u("span",{className:`tw-animate-ping tw-absolute tw-inline-flex tw-h-full tw-w-full tw-rounded-full tw-opacity-75 status-dot-ping ${g?le?"tw-bg-yellow-400":"tw-bg-green-500":"tw-bg-red-500"}`}),u("span",{className:`tw-relative tw-inline-flex tw-rounded-full tw-size-2 tw-min-w-2 status-dot-core ${g?le?"tw-bg-yellow-500":"tw-bg-green-500":"tw-bg-red-500"}`})]})]}),Q&&u("button",{type:"button",onClick:()=>$(oe=>!oe),className:Le("chat-btn-quick-block",I&&"chat-btn-quick-block-active"),title:"Cấm chat nhanh người dùng",children:u("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[u("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"}),u("line",{x1:"8",y1:"11",x2:"16",y2:"11"})]})}),u("div",{className:"chat-textarea-wrapper",children:u("div",{className:"tw-flex-1 tw-overflow-y-auto no-scrollbar",style:{maxHeight:"88px"},children:u("div",{className:"tw-relative tw-w-full",children:[u("div",{"aria-hidden":!0,className:"tw-absolute tw-inset-0 tw-pointer-events-none tw-px-3 tw-py-2 tw-text-sm",style:{lineHeight:"22px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:e?u("div",{className:"tw-text-chat-text-main",dangerouslySetInnerHTML:{__html:bm(e)}}):u("span",{className:"tw-text-chat-text-muted",children:"Nhập tin nhắn..."})}),u("textarea",{rows:1,value:e,onChange:oe=>{const pe=oe.target.value;t(pe),j(zo(pe,x))},onKeyDown:oe=>{oe.nativeEvent.isComposing||oe.key==="Enter"&&!oe.shiftKey&&(oe.preventDefault(),r(oe))},placeholder:"",disabled:w||!v&&m==="match"||!g,className:"tw-w-full tw-bg-transparent tw-text-transparent tw-px-3 tw-py-2 tw-text-sm focus:tw-outline-none disabled:tw-opacity-50 disabled:tw-cursor-not-allowed no-scrollbar tw-resize-none tw-relative tw-z-10 tw-overflow-hidden tw-block input-textarea-chat chat-textarea",style:{caretColor:"var(--chat-text-main)",lineHeight:"22px",wordBreak:"break-word"},ref:f})]})})}),u("div",{className:"chat-input-actions",children:[u("button",{type:"button",onClick:oe=>{oe.preventDefault(),oe.stopPropagation(),a(pe=>!pe),c(!1)},"data-emoji-button":"true",className:"chat-action-btn emoji-btn",disabled:w||!v&&m==="match"||!g,children:u(Da,{size:13})}),u("button",{type:"button",onClick:oe=>{oe.preventDefault(),oe.stopPropagation(),c(pe=>!pe),a(!1)},"data-gif-button":"true",className:"chat-action-btn gif-btn",disabled:w||!v&&m==="match"||!g,children:"gif"})]}),u("button",{type:"button",onClick:r,className:"chat-btn-send",disabled:w||!v&&m==="match"||!g,children:u(Lh,{size:12})})]})}):w||N?.allow_anonymous_chat===!1?u("div",{className:"chat-login-bar",children:[u("div",{className:"tw-flex-1 chat-row-gap2 tw-px-3 tw-py-2",children:[u("button",{type:"button",onClick:()=>P?.(),className:"tw-text-chat-primary tw-font-bold tw-text-xs tw-leading-none tw-relative tw-overflow-hidden group",children:[u("span",{className:"tw-relative tw-z-10",children:"Đăng nhập"}),u("span",{className:"tw-absolute tw-inset-0 tw-bg-gradient-to-r tw-from-transparent tw-via-white/50 tw-to-transparent tw-translate-x-[-100%] group-hover:tw-translate-x-[100%] tw-transition-transform tw-duration-1000"})]}),u("span",{className:"tw-text-chat-text-main tw-text-sm",children:"để cùng chat nhé ~~"})]}),u("button",{type:"button",disabled:!0,className:"chat-btn-disabled",children:"GỬI"})]}):u("form",{onSubmit:n,className:"chat-anonymous-form",children:[u("p",{className:"chat-anonymous-title",children:"Nhập tên để bắt đầu chat nhanh"}),u("div",{className:"chat-anonymous-input-container",children:[u("div",{className:"chat-anonymous-avatar tw-relative tw-shrink-0",children:[u("span",{className:"chat-anonymous-avatar-text",children:ra(o||"Khách")}),u("div",{className:Le("tw-absolute -tw-top-0.5 -tw-left-0.5 tw-flex tw-size-2 tw-min-w-2 status-dot-wrapper tw-rounded-full tw-border",O?"tw-border-chat-input-bg":"tw-border-white"),children:[u("span",{className:`tw-animate-ping tw-absolute tw-inline-flex tw-h-full tw-w-full tw-rounded-full tw-opacity-75 status-dot-ping ${g?le?"tw-bg-yellow-400":"tw-bg-green-500":"tw-bg-red-500"}`}),u("span",{className:`tw-relative tw-inline-flex tw-rounded-full tw-size-2 status-dot-core ${g?le?"tw-bg-yellow-500":"tw-bg-green-500":"tw-bg-red-500"}`})]})]}),u("input",{type:"text",value:o,onChange:oe=>s(oe.target.value),placeholder:"Tên của bạn...",maxLength:18,className:"chat-anonymous-input",required:!0}),u("button",{type:"submit",className:"chat-anonymous-submit-btn",children:"Vào Chat"})]}),u("div",{className:"chat-anonymous-footer",children:[u("span",{className:"chat-anonymous-footer-text",children:["Chat với vai trò là"," ",u("strong",{className:"chat-anonymous-footer-bold",children:"Khách"})]}),u("button",{type:"button",onClick:()=>P?.(),className:"chat-anonymous-login-btn",children:"Đăng nhập / Đăng ký"})]})]})]})},Sm=km,Cm=()=>{const{virtuosoRef:e,inputRef:t,emojiPickerRef:r,gifPickerRef:n,user:o,siteConfig:s,isDark:i,hasBanner250:a,hasBannerTop:l,hasBannerBottom:c,outsideEnabled:h,mustLoginToCh
177at:d,isAdminOrBlv:f,isBlocked:p,isConnected:_,activeTab:w,setActiveTab:v,blockModalOpen:m,setBlockModalOpen:g,userToBlock:x,setUserToBlock:O,selectedMessages:N,isSelectMode:E,setIsSelectMode:S,confirmModal:I,setConfirmModal:F,inputText:M,setInputText:J,userNameInput:H,setUserNameInput:j,isChatEnabled:P,setIsChatEnabled:Q,showEmojiPicker:$,setShowEmojiPicker:le,showGifPicker:oe,setShowGifPicker:pe,blockWarning:ye,showAuthModal:Me,setShowAuthModal:Be,filteredMessages:Re,firstItemIndex:Je,historyLoading:ut,loading:Ye,error:Xe,hasMoreHistory:W,loadMoreHistory:ce,atBottom:Ce,setAtBottom:L,isInitialLoadForRoom:R,setIsInitialLoadForRoom:D,unreadCount:K,setUnreadCount:G,_showNewMessageAlert:X,_setShowNewMessageAlert:q,isNearBottomRef:ie,handleUserClick:ae,handleSelectMessage:Fe,handleDeleteSingle:y,handleDeleteSelected:b,handleCancelSelect:T,handleLogout:k,handleScroll:C,handleSend:A,handleLoginAnonymous:V,onEmojiClick:Z,onGifSelect:se,scrollToBottom:ue,handleRemoveSystemMessage:Ze,blockedKeywords:Ge,_blockedList:yt,_setBlockedList:Xt,currentMatchId:Zt}=ds(),Vt=!!s?.banner_zone_id?.["72890"],[cr,Rt]=B.useState(!1),[Qt,$t]=B.use
177State(!1),[Er,an]=B.useState(!1);return B.useEffect(()=>{Rt(Vt)},[Vt]),B.useEffect(()=>{$t(l)},[l]),B.useEffect(()=>{an(c)},[c]),u("div",{className:"tw-w-full tw-h-full dv2-chat-wrapper tw-flex tw-flex-col",children:[s?.css_overrides&&u("style",{children:s.css_overrides}),h&&l&&Qt&&u(yn,{zoneIdKey:"top_outside"}),u("div",{className:"dv2-chat-container chat-container tw-flex-1 tw-min-h-0",children:[u(gf,{isConnected:_,isChatEnabled:P,onToggleChat:()=>Q(!P)}),u(yf,{activeTab:w,onTabChange:v}),u("div",{className:"chat-content-area",children:[u("div",{className:"chat-scroll-area"+(P?"":" tw-hidden"),children:u(om,{virtuosoRef:e,filteredMessages:Re,firstItemIndex:Je,historyLoading:ut,loading:Ye,error:Xe,isBlocked:p,activeTab:w,currentMatchId:Zt,hasMoreHistory:W,loadMoreHistory:ce,handleScroll:C,atBottom:Ce,isInitialLoadForRoom:R,unreadCount:K,scrollToBottom:ue,setAtBottom:L,setShowNewMessageAlert:q,setUnreadCount:G,setIsInitialLoadForRoom:D,isNearBottomRef:ie,user:o,blockedKeywords:Ge,isAdminOrBlv:f,handleUserClick:ae,isSelectMode:E,selectedMessages:N,handleSelectMessage:Fe,handleDeleteSingle:y,handleRemoveSystemMessage:Ze,siteConfig:s,blockWarning:ye,showBanner:cr,setShowBanner:Rt})}),P&&cr&&u("div",{className:"chat-ad-banner-container tw-bg-chat-header-bg tw-border-t tw-border-chat-border tw-flex tw-flex-col tw-justify-end tw-max-h-[60px] tw-aspect-[728x90] tw-w-full tw-shrink-0",children:u(yn,{zoneIdKey:"728_90",onClose:()=>{Rt(!1)}})}),u("div",{className:P?"":"tw-hidden",children:u(Sm,{inputText:M,setInputText:J,handleSend:A,handleLoginAnonymous:V,userNameInput:H,setUserNameInput:j,showEmojiPicker:$,setShowEmojiPicker:le,showGifPicker:oe,setShowGifPicker:pe,onEmojiClick:Z,onGifSelect:se,inputRef:t,emojiPickerRef:r,gifPickerRef:n,mustLoginToChat:d,currentMatchId:Zt,activeTab:w,isConnected:_,blockedKeywords:Ge,isDark:i,siteConfig:s,user:o,handleLogout:k,isSelectMode:E,selectedMessages:N,handleCancelSelect:T,handleDeleteSelected:b,_blockedList:yt,_setBlockedList:Xt,onShowAuthModal:()=>Be(!0),isAdminOrBlv:f,setIsSelectMode:S})}),!P&&u("div",{className:"chat-disabled-overlay",children:[a&&u(yn,{zoneIdKey:"250_250"}),u(ct,{children:!a&&u("div",{className:"tw-flex tw-flex-col tw-items-center",children:[u(fu,{className:"tw-text-chat-text-muted tw-text-5xl"}),u("span",{className:"tw-text-chat-text-muted tw-font-medium",children:"Chat hiện đang tắt"})]})}),u("button",{onClick:()=>Q(!0),className:"chat-row-gap2 tw-bg-[#d4a055] hover:tw-bg-[#c39045] tw-text-black tw-font-bold tw-py-2 tw-px-6 tw-rounded-full tw-transition-transform active:tw-scale-95",children:[u(nu,{}),"Xem Bình Luận"]})]})]}),u(lf,{isOpen:Me,onClose:()=>Be(!1)}),u(uf,{isOpen:m,onClose:()=>{g(!1),O(null)},userToBlock:x}),u(hf,{isOpen:I.isOpen,title:I.title,message:I.message,isDanger:I.isDanger,onConfirm:I.onConfirm,onCancel:()=>F($n=>({...$n,isOpen:!1})),confirmText:"Xóa",cancelText:"Hủy"})]}),h&&c&&Er&&u(yn,{zoneIdKey:"bottom_outside"})]})},Tm=()=>u(Eh,{children:u(Cm,{})}),Im=Tm,Em=e=>{B.useEffect(()=>{if(!e)return;const t={"cyber-esports-betting":"https://fonts.googleapis.com/css2?family=Orbitron:wght@700;900&family=Rajdhani:wght@500;600;700&display=swap","football-live-stream":"https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;750;900&family=Barlow:wght@400;600;700&display=swap","cyber-forest-green":"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap","cyber-yellow":"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap","volcanic-orange":"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap","sapphire-blue":"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap","violet-indigo-glassmorphic":"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap","light-glassmorphic":"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap","premium-luxury-betting":"https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;900&display=swap"}[e];if(!t||document.querySelector(`link[href="${t}"]`))return;const r=document.createElement("link");r.rel="stylesheet",r.href=t,document.head.appendChild(r)},[e])},Am=()=>{const{siteConfig:e,loading:t}=pr();if(console.log(e),t||e?.hiddenChat)return null;
177const r=new URLSearchParams(window.location.search),n=r.get("theme_id"),o=r.get("theme_mode"),s=us(n||e?.theme_id);Em(s);const i=ul(s)?.defaultMode||"dark",a=o||(n?i:e?.theme_mode||i),l={...Ih(s,a)},c=s==="default";return e?.primary_color&&c&&(l["--chat-primary"]=e.primary_color),e?.chat_background&&a==="light"&&c&&(l["--chat-bg"]=e.chat_background),B.useEffect(()=>(document.documentElement.setAttribute("data-chat-theme",s),document.documentElement.setAttribute("data-theme",a),()=>{document.documentElement.removeAttribute("data-chat-theme"),document.documentElement.removeAttribute("data-theme")}),[s,a]),B.useEffect(()=>{if(e)try{const h={themeId:s,themeMode:a,styles:l};localStorage.setItem("livechat_theme_cache",JSON.stringify(h))}catch(h){console.error("Failed to save theme cache",h)}},[s,a,e]),u("div",{className:"tw-w-full tw-h-full tw-flex tw-flex-col tw-items-center tw-justify-center","data-theme":a,"data-chat-theme":s,style:l,children:u(Im,{})})};function Nm(){return u(md,{children:u(kh,{children:[u(Am,{}),u(fd,{position:"top-center",toastOptions:{style:{zIndex:2147483647,fontFamily:`'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`,fontSize:"14px",fontWeight:"600",lineHeight:"1.5",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",borderRadius:"8px",padding:"12px 16px",color:"#333",background:"#fff"},success:{style:{background:"#f0fdf4",color:"#15803d",border:"1px solid #bbf7d0"},iconTheme:{primary:"#22c55e",secondary:"#ffffff"}},error:{style:{display:"none"}}}})]})})}var Rm=Nm;function Dm(e){const t=Jc(e);return t.render(u(Rm,{})),t}export{Dm as renderApp};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.