@college-africa/chat-ui 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/index.mjs +702 -671
- package/dist/{summaries-BKYNtoGV.js → summaries-DV6lamVA.js} +1811 -1805
- package/dist/summaries-fqwuKIPW.cjs +11 -0
- package/dist/utils/sdk.d.ts +4 -5
- package/package.json +2 -2
- package/dist/summaries-BQNGfAwW.cjs +0 -11
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./summaries-BQNGfAwW.cjs`);let t=require(`react`),n=e._(t,1);t=e._(t);let r=require(`@mui/material`),i=require(`react/jsx-runtime`),a=require(`@emotion/styled`);a=e._(a),require(`@emotion/react`);var o=(e,t)=>e instanceof Error?e:Error(t),s=()=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,children:(0,i.jsx)(r.CircularProgress,{})}),c=({error:e,retry:t})=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,action:(0,i.jsx)(r.Button,{onClick:t,children:` Retry`}),children:[(0,i.jsx)(r.AlertTitle,{children:`Failed to initialize chat`}),e.message]})}),l=({config:t,children:r,LoadingComponent:a=s,ErrorComponent:l=c})=>{let[u,d]=(0,n.useState)(!1),[f,p]=(0,n.useState)(null),m=(0,n.useCallback)(async()=>{d(!1),p(null);try{if(e.s())return;await e.o(t),d(!0)}catch(e){p(o(e,`Unknown error initializing SDK`))}},[t]);return(0,n.useEffect)(()=>(m(),()=>{e.i()}),[m]),!u&&!f?(0,i.jsx)(a,{}):f?(0,i.jsx)(l,{error:f,retry:m}):(0,i.jsx)(i.Fragment,{children:r})},u=e=>e,d=(()=>{let e=u;return{configure(t){e=t},generate(t){return e(t)},reset(){e=u}}})();function f(e,...t){let n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Minified MUI error #${e}; visit ${n} for the full message.`}function p(e){if(typeof e!=`string`)throw Error(process.env.NODE_ENV===`production`?f(7):"MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}var m=p,h=e.g((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),g=e.g((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,ee=n,te=d,ne=i,E=h,D=m,O=r,k=o,A=a,j=f,M=!1;function N(e){return M||(M=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),P(e)||x(e)===l}function P(e){return x(e)===u}function re(e){return x(e)===c}function ie(e){return x(e)===s}function ae(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function F(e){return x(e)===d}function oe(e){return x(e)===i}function se(e){return x(e)===h}function I(e){return x(e)===m}function ce(e){return x(e)===r}function le(e){return x(e)===o}function ue(e){return x(e)===a}function de(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=ee,e.ForwardRef=te,e.Fragment=ne,e.Lazy=E,e.Memo=D,e.Portal=O,e.Profiler=k,e.StrictMode=A,e.Suspense=j,e.isAsyncMode=N,e.isConcurrentMode=P,e.isContextConsumer=re,e.isContextProvider=ie,e.isElement=ae,e.isForwardRef=F,e.isFragment=oe,e.isLazy=se,e.isMemo=I,e.isPortal=ce,e.isProfiler=le,e.isStrictMode=ue,e.isSuspense=de,e.isValidElementType=b,e.typeOf=x})()})),_=e.g(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=h():t.exports=g()})),v=e.g(((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String(`abc`);if(e[5]=`de`,Object.getOwnPropertyNames(e)[0]===`5`)return!1;for(var t={},n=0;n<10;n++)t[`_`+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(``)!==`0123456789`)return!1;var r={};return`abcdefghijklmnopqrst`.split(``).forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join(``)===`abcdefghijklmnopqrst`}catch{return!1}}t.exports=o()?Object.assign:function(e,t){for(var o,s=a(e),c,l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]),o)r.call(o,u)&&(s[u]=o[u]);if(n){c=n(o);for(var d=0;d<c.length;d++)i.call(o,c[d])&&(s[c[d]]=o[c[d]])}}return s}})),y=e.g(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),b=e.g(((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)})),x=e.g(((e,t)=>{var n=function(){};if(process.env.NODE_ENV!==`production`){var r=y(),i={},a=b();n=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}}}function o(e,t,o,s,c){if(process.env.NODE_ENV!==`production`){for(var l in e)if(a(e,l)){var u;try{if(typeof e[l]!=`function`){var d=Error((s||`React class`)+`: `+o+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name=`Invariant Violation`,d}u=e[l](t,l,s,o,null,r)}catch(e){u=e}if(u&&!(u instanceof Error)&&n((s||`React class`)+`: type specification of `+o+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+`. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).`),u instanceof Error&&!(u.message in i)){i[u.message]=!0;var f=c?c():``;n(`Failed `+o+` type: `+u.message+(f??``))}}}}o.resetWarningCache=function(){process.env.NODE_ENV!==`production`&&(i={})},t.exports=o})),S=e.g(((e,t)=>{var n=_(),r=v(),i=y(),a=b(),o=x(),s=function(){};process.env.NODE_ENV!==`production`&&(s=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}});function c(){return null}t.exports=function(e,t){var l=typeof Symbol==`function`&&Symbol.iterator,u=`@@iterator`;function d(e){var t=e&&(l&&e[l]||e[u]);if(typeof t==`function`)return t}var f=`<<anonymous>>`,p={array:_(`array`),bigint:_(`bigint`),bool:_(`boolean`),func:_(`function`),number:_(`number`),object:_(`object`),string:_(`string`),symbol:_(`symbol`),any:v(),arrayOf:y,element:b(),elementType:x(),instanceOf:S,node:ee(),objectOf:w,oneOf:C,oneOfType:T,shape:ne,exact:E};function m(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function h(e,t){this.message=e,this.data=t&&typeof t==`object`?t:{},this.stack=``}h.prototype=Error.prototype;function g(e){if(process.env.NODE_ENV!==`production`)var n={},r=0;function a(a,o,c,l,u,d,p){if(l||=f,d||=c,p!==i){if(t){var m=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name=`Invariant Violation`,m}else if(process.env.NODE_ENV!==`production`&&typeof console<`u`){var g=l+`:`+c;!n[g]&&r<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+l+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[g]=!0,r++)}}return o[c]==null?a?o[c]===null?new h(`The `+u+" `"+d+"` is marked as required "+("in `"+l+"`, but its value is `null`.")):new h(`The `+u+" `"+d+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(o,c,l,u,d)}var o=a.bind(null,!1);return o.isRequired=a.bind(null,!0),o}function _(e){function t(t,n,r,i,a,o){var s=t[n];if(k(s)!==e){var c=A(s);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return g(t)}function v(){return g(c)}function y(e){function t(t,n,r,a,o){if(typeof e!=`function`)return new h("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var c=k(s);return new h(`Invalid `+a+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var u=e(s,l,r,a,o+`[`+l+`]`,i);if(u instanceof Error)return u}return null}return g(t)}function b(){function t(t,n,r,i,a){var o=t[n];if(!e(o)){var s=k(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return g(t)}function x(){function e(e,t,r,i,a){var o=e[t];if(!n.isValidElementType(o)){var s=k(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement type."))}return null}return g(e)}function S(e){function t(t,n,r,i,a){if(!(t[n]instanceof e)){var o=e.name||f,s=M(t[n]);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+o+"`."))}return null}return g(t)}function C(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&(arguments.length>1?s(`Invalid arguments supplied to oneOf, expected an array, got `+arguments.length+` arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).`):s(`Invalid argument supplied to oneOf, expected an array.`)),c;function t(t,n,r,i,a){for(var o=t[n],s=0;s<e.length;s++)if(m(o,e[s]))return null;var c=JSON.stringify(e,function(e,t){return A(t)===`symbol`?String(t):t});return new h(`Invalid `+i+" `"+a+"` of value `"+String(o)+"` "+("supplied to `"+r+"`, expected one of "+c+`.`))}return g(t)}function w(e){function t(t,n,r,o,s){if(typeof e!=`function`)return new h("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var c=t[n],l=k(c);if(l!==`object`)return new h(`Invalid `+o+" `"+s+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var u in c)if(a(c,u)){var d=e(c,u,r,o,s+`.`+u,i);if(d instanceof Error)return d}return null}return g(t)}function T(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&s(`Invalid argument supplied to oneOfType, expected an instance of array.`),c;for(var t=0;t<e.length;t++){var n=e[t];if(typeof n!=`function`)return s(`Invalid argument supplied to oneOfType. Expected an array of check functions, but received `+j(n)+` at index `+t+`.`),c}function r(t,n,r,o,s){for(var c=[],l=0;l<e.length;l++){var u=e[l],d=u(t,n,r,o,s,i);if(d==null)return null;d.data&&a(d.data,`expectedType`)&&c.push(d.data.expectedType)}var f=c.length>0?`, expected one of type [`+c.join(`, `)+`]`:``;return new h(`Invalid `+o+" `"+s+"` supplied to "+("`"+r+"`"+f+`.`))}return g(r)}function ee(){function e(e,t,n,r,i){return D(e[t])?null:new h(`Invalid `+r+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return g(e)}function te(e,t,n,r,i){return new h((e||`React class`)+`: `+t+" type `"+n+`.`+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function ne(e){function t(t,n,r,a,o){var s=t[n],c=k(s);if(c!==`object`)return new h(`Invalid `+a+" `"+o+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var u=e[l];if(typeof u!=`function`)return te(r,a,o,l,A(u));var d=u(s,l,r,a,o+`.`+l,i);if(d)return d}return null}return g(t)}function E(e){function t(t,n,o,s,c){var l=t[n],u=k(l);if(u!==`object`)return new h(`Invalid `+s+" `"+c+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var d in r({},t[n],e)){var f=e[d];if(a(e,d)&&typeof f!=`function`)return te(o,s,c,d,A(f));if(!f)return new h(`Invalid `+s+" `"+c+"` key `"+d+"` supplied to `"+o+`\`.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./summaries-fqwuKIPW.cjs`);let t=require(`react`),n=e._(t,1);t=e._(t);let r=require(`@mui/material`),i=require(`react/jsx-runtime`),a=require(`@emotion/styled`);a=e._(a),require(`@emotion/react`);var o=(e,t)=>e instanceof Error?e:Error(t),s=()=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,children:(0,i.jsx)(r.CircularProgress,{})}),c=({error:e,retry:t})=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100vh`,p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,action:(0,i.jsx)(r.Button,{onClick:t,children:` Retry`}),children:[(0,i.jsx)(r.AlertTitle,{children:`Failed to initialize chat`}),e.message]})}),l=({config:t,children:r,LoadingComponent:a=s,ErrorComponent:l=c})=>{let[u,d]=(0,n.useState)(!1),[f,p]=(0,n.useState)(null),m=(0,n.useCallback)(async()=>{d(!1),p(null);try{if(e.s())return;await e.o(t),d(!0)}catch(e){p(o(e,`Unknown error initializing SDK`))}},[t]);return(0,n.useEffect)(()=>(m(),()=>{e.i()}),[m]),!u&&!f?(0,i.jsx)(a,{}):f?(0,i.jsx)(l,{error:f,retry:m}):(0,i.jsx)(i.Fragment,{children:r})},u=e=>e,d=(()=>{let e=u;return{configure(t){e=t},generate(t){return e(t)},reset(){e=u}}})();function f(e,...t){let n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Minified MUI error #${e}; visit ${n} for the full message.`}function p(e){if(typeof e!=`string`)throw Error(process.env.NODE_ENV===`production`?f(7):"MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}var m=p,h=e.g((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),g=e.g((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,ee=n,te=d,ne=i,E=h,D=m,O=r,k=o,A=a,j=f,M=!1;function N(e){return M||(M=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),P(e)||x(e)===l}function P(e){return x(e)===u}function re(e){return x(e)===c}function ie(e){return x(e)===s}function ae(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function F(e){return x(e)===d}function oe(e){return x(e)===i}function se(e){return x(e)===h}function I(e){return x(e)===m}function ce(e){return x(e)===r}function le(e){return x(e)===o}function ue(e){return x(e)===a}function de(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=ee,e.ForwardRef=te,e.Fragment=ne,e.Lazy=E,e.Memo=D,e.Portal=O,e.Profiler=k,e.StrictMode=A,e.Suspense=j,e.isAsyncMode=N,e.isConcurrentMode=P,e.isContextConsumer=re,e.isContextProvider=ie,e.isElement=ae,e.isForwardRef=F,e.isFragment=oe,e.isLazy=se,e.isMemo=I,e.isPortal=ce,e.isProfiler=le,e.isStrictMode=ue,e.isSuspense=de,e.isValidElementType=b,e.typeOf=x})()})),_=e.g(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=h():t.exports=g()})),v=e.g(((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String(`abc`);if(e[5]=`de`,Object.getOwnPropertyNames(e)[0]===`5`)return!1;for(var t={},n=0;n<10;n++)t[`_`+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(``)!==`0123456789`)return!1;var r={};return`abcdefghijklmnopqrst`.split(``).forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join(``)===`abcdefghijklmnopqrst`}catch{return!1}}t.exports=o()?Object.assign:function(e,t){for(var o,s=a(e),c,l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]),o)r.call(o,u)&&(s[u]=o[u]);if(n){c=n(o);for(var d=0;d<c.length;d++)i.call(o,c[d])&&(s[c[d]]=o[c[d]])}}return s}})),y=e.g(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),b=e.g(((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)})),x=e.g(((e,t)=>{var n=function(){};if(process.env.NODE_ENV!==`production`){var r=y(),i={},a=b();n=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}}}function o(e,t,o,s,c){if(process.env.NODE_ENV!==`production`){for(var l in e)if(a(e,l)){var u;try{if(typeof e[l]!=`function`){var d=Error((s||`React class`)+`: `+o+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name=`Invariant Violation`,d}u=e[l](t,l,s,o,null,r)}catch(e){u=e}if(u&&!(u instanceof Error)&&n((s||`React class`)+`: type specification of `+o+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+`. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).`),u instanceof Error&&!(u.message in i)){i[u.message]=!0;var f=c?c():``;n(`Failed `+o+` type: `+u.message+(f??``))}}}}o.resetWarningCache=function(){process.env.NODE_ENV!==`production`&&(i={})},t.exports=o})),S=e.g(((e,t)=>{var n=_(),r=v(),i=y(),a=b(),o=x(),s=function(){};process.env.NODE_ENV!==`production`&&(s=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}});function c(){return null}t.exports=function(e,t){var l=typeof Symbol==`function`&&Symbol.iterator,u=`@@iterator`;function d(e){var t=e&&(l&&e[l]||e[u]);if(typeof t==`function`)return t}var f=`<<anonymous>>`,p={array:_(`array`),bigint:_(`bigint`),bool:_(`boolean`),func:_(`function`),number:_(`number`),object:_(`object`),string:_(`string`),symbol:_(`symbol`),any:v(),arrayOf:y,element:b(),elementType:x(),instanceOf:S,node:ee(),objectOf:w,oneOf:C,oneOfType:T,shape:ne,exact:E};function m(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function h(e,t){this.message=e,this.data=t&&typeof t==`object`?t:{},this.stack=``}h.prototype=Error.prototype;function g(e){if(process.env.NODE_ENV!==`production`)var n={},r=0;function a(a,o,c,l,u,d,p){if(l||=f,d||=c,p!==i){if(t){var m=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name=`Invariant Violation`,m}else if(process.env.NODE_ENV!==`production`&&typeof console<`u`){var g=l+`:`+c;!n[g]&&r<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+l+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[g]=!0,r++)}}return o[c]==null?a?o[c]===null?new h(`The `+u+" `"+d+"` is marked as required "+("in `"+l+"`, but its value is `null`.")):new h(`The `+u+" `"+d+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(o,c,l,u,d)}var o=a.bind(null,!1);return o.isRequired=a.bind(null,!0),o}function _(e){function t(t,n,r,i,a,o){var s=t[n];if(k(s)!==e){var c=A(s);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return g(t)}function v(){return g(c)}function y(e){function t(t,n,r,a,o){if(typeof e!=`function`)return new h("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var c=k(s);return new h(`Invalid `+a+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var u=e(s,l,r,a,o+`[`+l+`]`,i);if(u instanceof Error)return u}return null}return g(t)}function b(){function t(t,n,r,i,a){var o=t[n];if(!e(o)){var s=k(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return g(t)}function x(){function e(e,t,r,i,a){var o=e[t];if(!n.isValidElementType(o)){var s=k(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement type."))}return null}return g(e)}function S(e){function t(t,n,r,i,a){if(!(t[n]instanceof e)){var o=e.name||f,s=M(t[n]);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+o+"`."))}return null}return g(t)}function C(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&(arguments.length>1?s(`Invalid arguments supplied to oneOf, expected an array, got `+arguments.length+` arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).`):s(`Invalid argument supplied to oneOf, expected an array.`)),c;function t(t,n,r,i,a){for(var o=t[n],s=0;s<e.length;s++)if(m(o,e[s]))return null;var c=JSON.stringify(e,function(e,t){return A(t)===`symbol`?String(t):t});return new h(`Invalid `+i+" `"+a+"` of value `"+String(o)+"` "+("supplied to `"+r+"`, expected one of "+c+`.`))}return g(t)}function w(e){function t(t,n,r,o,s){if(typeof e!=`function`)return new h("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var c=t[n],l=k(c);if(l!==`object`)return new h(`Invalid `+o+" `"+s+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var u in c)if(a(c,u)){var d=e(c,u,r,o,s+`.`+u,i);if(d instanceof Error)return d}return null}return g(t)}function T(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&s(`Invalid argument supplied to oneOfType, expected an instance of array.`),c;for(var t=0;t<e.length;t++){var n=e[t];if(typeof n!=`function`)return s(`Invalid argument supplied to oneOfType. Expected an array of check functions, but received `+j(n)+` at index `+t+`.`),c}function r(t,n,r,o,s){for(var c=[],l=0;l<e.length;l++){var u=e[l],d=u(t,n,r,o,s,i);if(d==null)return null;d.data&&a(d.data,`expectedType`)&&c.push(d.data.expectedType)}var f=c.length>0?`, expected one of type [`+c.join(`, `)+`]`:``;return new h(`Invalid `+o+" `"+s+"` supplied to "+("`"+r+"`"+f+`.`))}return g(r)}function ee(){function e(e,t,n,r,i){return D(e[t])?null:new h(`Invalid `+r+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return g(e)}function te(e,t,n,r,i){return new h((e||`React class`)+`: `+t+" type `"+n+`.`+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function ne(e){function t(t,n,r,a,o){var s=t[n],c=k(s);if(c!==`object`)return new h(`Invalid `+a+" `"+o+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var u=e[l];if(typeof u!=`function`)return te(r,a,o,l,A(u));var d=u(s,l,r,a,o+`.`+l,i);if(d)return d}return null}return g(t)}function E(e){function t(t,n,o,s,c){var l=t[n],u=k(l);if(u!==`object`)return new h(`Invalid `+s+" `"+c+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var d in r({},t[n],e)){var f=e[d];if(a(e,d)&&typeof f!=`function`)return te(o,s,c,d,A(f));if(!f)return new h(`Invalid `+s+" `"+c+"` key `"+d+"` supplied to `"+o+`\`.
|
|
2
2
|
Bad object: `+JSON.stringify(t[n],null,` `)+`
|
|
3
3
|
Valid keys: `+JSON.stringify(Object.keys(e),null,` `));var p=f(l,d,o,s,c+`.`+d,i);if(p)return p}return null}return g(t)}function D(t){switch(typeof t){case`number`:case`string`:case`undefined`:return!0;case`boolean`:return!t;case`object`:if(Array.isArray(t))return t.every(D);if(t===null||e(t))return!0;var n=d(t);if(n){var r=n.call(t),i;if(n!==t.entries){for(;!(i=r.next()).done;)if(!D(i.value))return!1}else for(;!(i=r.next()).done;){var a=i.value;if(a&&!D(a[1]))return!1}}else return!1;return!0;default:return!1}}function O(e,t){return e===`symbol`?!0:t?t[`@@toStringTag`]===`Symbol`||typeof Symbol==`function`&&t instanceof Symbol:!1}function k(e){var t=typeof e;return Array.isArray(e)?`array`:e instanceof RegExp?`object`:O(t,e)?`symbol`:t}function A(e){if(e==null)return``+e;var t=k(e);if(t===`object`){if(e instanceof Date)return`date`;if(e instanceof RegExp)return`regexp`}return t}function j(e){var t=A(e);switch(t){case`array`:case`object`:return`an `+t;case`boolean`:case`date`:case`regexp`:return`a `+t;default:return t}}function M(e){return!e.constructor||!e.constructor.name?f:e.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p}})),C=e.g(((e,t)=>{var n=y();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),w=e.g(((e,t)=>{if(process.env.NODE_ENV!==`production`){var n=_();t.exports=S()(n.isElement,!0)}else t.exports=C()()}));function T(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=T(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ee(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=T(e))&&(r&&(r+=` `),r+=t);return r}function te(e,t,n=void 0){let r={};for(let i in e){let a=e[i],o=``,s=!0;for(let e=0;e<a.length;e+=1){let r=a[e];r&&(o+=(s===!0?``:` `)+t(r),s=!1,n&&n[r]&&(o+=` `+n[r]))}r[i]=o}return r}var ne=e.g((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.suspense_list`),d=Symbol.for(`react.memo`),f=Symbol.for(`react.lazy`),p=Symbol.for(`react.view_transition`),m=Symbol.for(`react.client.reference`);function h(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case l:case u:case p:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:return e;case o:return e;default:return m}}case n:return m}}}e.ContextConsumer=o,e.ContextProvider=s,e.Element=t,e.ForwardRef=c,e.Fragment=r,e.Lazy=f,e.Memo=d,e.Portal=n,e.Profiler=a,e.StrictMode=i,e.Suspense=l,e.SuspenseList=u,e.isContextConsumer=function(e){return h(e)===o},e.isContextProvider=function(e){return h(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===t},e.isForwardRef=function(e){return h(e)===c},e.isFragment=function(e){return h(e)===r},e.isLazy=function(e){return h(e)===f},e.isMemo=function(e){return h(e)===d},e.isPortal=function(e){return h(e)===n},e.isProfiler=function(e){return h(e)===a},e.isStrictMode=function(e){return h(e)===i},e.isSuspense=function(e){return h(e)===l},e.isSuspenseList=function(e){return h(e)===u},e.isValidElementType=function(e){return!!(typeof e==`string`||typeof e==`function`||e===r||e===a||e===i||e===l||e===u||typeof e==`object`&&e&&(e.$$typeof===f||e.$$typeof===d||e.$$typeof===s||e.$$typeof===o||e.$$typeof===c||e.$$typeof===m||e.getModuleId!==void 0))},e.typeOf=h})),E=e.g((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case i:case o:case a:case u:case d:case m:return e;default:switch(e&&=e.$$typeof,e){case c:case l:case p:case f:return e;case s:return e;default:return t}}case r:return t}}}var n=Symbol.for(`react.transitional.element`),r=Symbol.for(`react.portal`),i=Symbol.for(`react.fragment`),a=Symbol.for(`react.strict_mode`),o=Symbol.for(`react.profiler`),s=Symbol.for(`react.consumer`),c=Symbol.for(`react.context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`),m=Symbol.for(`react.view_transition`),h=Symbol.for(`react.client.reference`);e.ContextConsumer=s,e.ContextProvider=c,e.Element=n,e.ForwardRef=l,e.Fragment=i,e.Lazy=p,e.Memo=f,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=u,e.SuspenseList=d,e.isContextConsumer=function(e){return t(e)===s},e.isContextProvider=function(e){return t(e)===c},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return t(e)===l},e.isFragment=function(e){return t(e)===i},e.isLazy=function(e){return t(e)===p},e.isMemo=function(e){return t(e)===f},e.isPortal=function(e){return t(e)===r},e.isProfiler=function(e){return t(e)===o},e.isStrictMode=function(e){return t(e)===a},e.isSuspense=function(e){return t(e)===u},e.isSuspenseList=function(e){return t(e)===d},e.isValidElementType=function(e){return!!(typeof e==`string`||typeof e==`function`||e===i||e===o||e===a||e===u||e===d||typeof e==`object`&&e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===c||e.$$typeof===s||e.$$typeof===l||e.$$typeof===h||e.getModuleId!==void 0))},e.typeOf=t})()})),D=e.g(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=ne():t.exports=E()}))();function O(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function k(e){if(t.isValidElement(e)||(0,D.isValidElementType)(e)||!O(e))return e;let n={};return Object.keys(e).forEach(t=>{n[t]=k(e[t])}),n}function A(e,n,r={clone:!0}){let i=r.clone?{...e}:e;return O(e)&&O(n)&&Object.keys(n).forEach(a=>{t.isValidElement(n[a])||(0,D.isValidElementType)(n[a])?i[a]=n[a]:O(n[a])&&Object.prototype.hasOwnProperty.call(e,a)&&O(e[a])?i[a]=A(e[a],n[a],r):r.clone?i[a]=O(n[a])?k(n[a]):n[a]:i[a]=n[a]}),i}function j(e,t){return t?A(e,t,{clone:!1}):e}var M=e._(w()),N=process.env.NODE_ENV===`production`?{}:M.default.oneOfType([M.default.number,M.default.string,M.default.object,M.default.array]);function P(e,t){if(!e.containerQueries)return t;let n=Object.keys(t).filter(e=>e.startsWith(`@container`)).sort((e,t)=>{let n=/min-width:\s*([0-9.]+)/;return(e.match(n)?.[1]||0)-+(t.match(n)?.[1]||0)});return n.length?n.reduce((e,n)=>{let r=t[n];return delete e[n],e[n]=r,e},{...t}):t}function re(e,t){return t===`@`||t.startsWith(`@`)&&(e.some(e=>t.startsWith(`@${e}`))||!!t.match(/^@\d/))}function ie(e,t){let n=t.match(/^@([^/]+)?\/?(.+)?$/);if(!n){if(process.env.NODE_ENV!==`production`)throw Error(`MUI: The provided shorthand ${`(${t})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\nFor example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`);return null}let[,r,i]=n,a=Number.isNaN(+r)?r||0:+r;return e.containerQueries(i).up(a)}function ae(e){let t=(e,t)=>e.replace(`@media`,t?`@container ${t}`:`@container`);function n(n,r){n.up=(...n)=>t(e.breakpoints.up(...n),r),n.down=(...n)=>t(e.breakpoints.down(...n),r),n.between=(...n)=>t(e.breakpoints.between(...n),r),n.only=(...n)=>t(e.breakpoints.only(...n),r),n.not=(...n)=>{let i=t(e.breakpoints.not(...n),r);return i.includes(`not all and`)?i.replace(`not all and `,``).replace(`min-width:`,`width<`).replace(`max-width:`,`width>`).replace(`and`,`or`):i}}let r={},i=e=>(n(r,e),r);return n(i),{...e,containerQueries:i}}var F={xs:0,sm:600,md:900,lg:1200,xl:1536},oe={keys:[`xs`,`sm`,`md`,`lg`,`xl`],up:e=>`@media (min-width:${F[e]}px)`},se={containerQueries:e=>({up:t=>{let n=typeof t==`number`?t:F[t]||t;return typeof n==`number`&&(n=`${n}px`),e?`@container ${e} (min-width:${n})`:`@container (min-width:${n})`}})};function I(e,t,n){let r=e.theme||{};if(Array.isArray(t)){let e=r.breakpoints||oe;return t.reduce((r,i,a)=>(r[e.up(e.keys[a])]=n(t[a]),r),{})}if(typeof t==`object`){let e=r.breakpoints||oe;return Object.keys(t).reduce((i,a)=>{if(re(e.keys,a)){let e=ie(r.containerQueries?r:se,a);e&&(i[e]=n(t[a],a))}else if(Object.keys(e.values||F).includes(a)){let r=e.up(a);i[r]=n(t[a],a)}else{let e=a;i[e]=t[e]}return i},{})}return n(t)}function ce(e={}){return e.keys?.reduce((t,n)=>{let r=e.up(n);return t[r]={},t},{})||{}}function le(e,t){return e.reduce((e,t)=>{let n=e[t];return(!n||Object.keys(n).length===0)&&delete e[t],e},t)}function ue(e,t,n=!0){if(!t||typeof t!=`string`)return null;if(e&&e.vars&&n){let n=`vars.${t}`.split(`.`).reduce((e,t)=>e&&e[t]?e[t]:null,e);if(n!=null)return n}return t.split(`.`).reduce((e,t)=>e&&e[t]!=null?e[t]:null,e)}function de(e,t,n,r=n){let i;return i=typeof e==`function`?e(n):Array.isArray(e)?e[n]||r:ue(e,n)||r,t&&(i=t(i,r,e)),i}function L(e){let{prop:t,cssProperty:n=e.prop,themeKey:r,transform:i}=e,a=e=>{if(e[t]==null)return null;let a=e[t],o=e.theme,s=ue(o,r)||{};return I(e,a,e=>{let r=de(s,i,e);return e===r&&typeof e==`string`&&(r=de(s,i,`${t}${e===`default`?``:p(e)}`,e)),n===!1?r:{[n]:r}})};return a.propTypes=process.env.NODE_ENV===`production`?{}:{[t]:N},a.filterProps=[t],a}function fe(e){let t={};return n=>(t[n]===void 0&&(t[n]=e(n)),t[n])}var pe={m:`margin`,p:`padding`},me={t:`Top`,r:`Right`,b:`Bottom`,l:`Left`,x:[`Left`,`Right`],y:[`Top`,`Bottom`]},he={marginX:`mx`,marginY:`my`,paddingX:`px`,paddingY:`py`},ge=fe(e=>{if(e.length>2)if(he[e])e=he[e];else return[e];let[t,n]=e.split(``),r=pe[t],i=me[n]||``;return Array.isArray(i)?i.map(e=>r+e):[r+i]}),_e=[`m`,`mt`,`mr`,`mb`,`ml`,`mx`,`my`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`,`marginX`,`marginY`,`marginInline`,`marginInlineStart`,`marginInlineEnd`,`marginBlock`,`marginBlockStart`,`marginBlockEnd`],ve=[`p`,`pt`,`pr`,`pb`,`pl`,`px`,`py`,`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`paddingX`,`paddingY`,`paddingInline`,`paddingInlineStart`,`paddingInlineEnd`,`paddingBlock`,`paddingBlockStart`,`paddingBlockEnd`],ye=[..._e,...ve];function be(e,t,n,r){let i=ue(e,t,!0)??n;return typeof i==`number`||typeof i==`string`?e=>typeof e==`string`?e:(process.env.NODE_ENV!==`production`&&typeof e!=`number`&&console.error(`MUI: Expected ${r} argument to be a number or a string, got ${e}.`),typeof i==`string`?i.startsWith(`var(`)&&e===0?0:i.startsWith(`var(`)&&e===1?i:`calc(${e} * ${i})`:i*e):Array.isArray(i)?e=>{if(typeof e==`string`)return e;let n=Math.abs(e);process.env.NODE_ENV!==`production`&&(Number.isInteger(n)?n>i.length-1&&console.error([`MUI: The value provided (${n}) overflows.`,`The supported values are: ${JSON.stringify(i)}.`,`${n} > ${i.length-1}, you need to add the missing values.`].join(`
|
|
4
4
|
`)):console.error([`MUI: The \`theme.${t}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${t}\` as a number.`].join(`
|
|
@@ -28,4 +28,4 @@ export default theme;`}function dr(e){return typeof e==`number`?`${(e*100).toFix
|
|
|
28
28
|
`))}t[r]={}}}};Object.keys(m.components).forEach(e=>{let n=m.components[e].styleOverrides;n&&e.startsWith(`Mui`)&&t(n,e)})}return m.unstable_sxConfig={...Ze,...u?.unstable_sxConfig},m.unstable_sx=function(e){return tt({sx:e,theme:this})},m.toRuntimeSource=ur,pr(m),m}function hr(e){let t;return t=e<1?5.11916*e**2:4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}var gr=[...Array(25)].map((e,t)=>{if(t===0)return`none`;let n=hr(t);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function _r(e){return{inputPlaceholder:e===`dark`?.5:.42,inputUnderline:e===`dark`?.7:.42,switchTrackDisabled:e===`dark`?.2:.12,switchTrack:e===`dark`?.3:.38}}function vr(e){return e===`dark`?gr:[]}function yr(e){let{palette:t={mode:`light`},opacity:n,overlays:r,colorSpace:i,...a}=e,o=Kn({...t,colorSpace:i});return{palette:o,opacity:{..._r(o.mode),...n},overlays:r||vr(o.mode),...a}}function br(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]===`palette`&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}var xr=e=>[...[...Array(25)].map((t,n)=>`--${e?`${e}-`:``}overlays-${n}`),`--${e?`${e}-`:``}palette-AppBar-darkBg`,`--${e?`${e}-`:``}palette-AppBar-darkColor`],Sr=e=>(t,n)=>{let r=e.rootSelector||`:root`,i=e.colorSchemeSelector,a=i;if(i===`class`&&(a=`.%s`),i===`data`&&(a=`[data-%s]`),i?.startsWith(`data-`)&&!i.includes(`%s`)&&(a=`[${i}="%s"]`),e.defaultColorScheme===t){if(t===`dark`){let i={};return xr(e.cssVarPrefix).forEach(e=>{i[e]=n[e],delete n[e]}),a===`media`?{[r]:n,"@media (prefers-color-scheme: dark)":{[r]:i}}:a?{[a.replace(`%s`,t)]:i,[`${r}, ${a.replace(`%s`,t)}`]:n}:{[r]:{...n,...i}}}if(a&&a!==`media`)return`${r}, ${a.replace(`%s`,String(t))}`}else if(t){if(a===`media`)return{[`@media (prefers-color-scheme: ${String(t)})`]:{[r]:n}};if(a)return a.replace(`%s`,String(t))}return r};function Cr(e,t){t.forEach(t=>{e[t]||(e[t]={})})}function K(e,t,n){!e[t]&&n&&(e[t]=n)}function wr(e){return typeof e!=`string`||!e.startsWith(`hsl`)?e:nn(e)}function Tr(e,t){`${t}Channel`in e||(e[`${t}Channel`]=en(wr(e[t]),`MUI: Can't create \`palette.${t}Channel\` because \`palette.${t}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
|
|
29
29
|
To suppress this warning, you need to explicitly provide the \`palette.${t}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function Er(e){return typeof e==`number`?`${e}px`:typeof e==`string`||typeof e==`function`||Array.isArray(e)?e:`8px`}var Dr=e=>{try{return e()}catch{}},Or=(e=`mui`)=>vn(e);function kr(e,t,n,r,i){if(!n)return;n=n===!0?{}:n;let a=i===`dark`?`dark`:`light`;if(!r){t[i]=yr({...n,palette:{mode:a,...n?.palette},colorSpace:e});return}let{palette:o,...s}=mr({...r,palette:{mode:a,...n?.palette},colorSpace:e});return t[i]={...n,palette:o,opacity:{..._r(a),...n?.opacity},overlays:n?.overlays||vr(a)},s}function Ar(e={},...t){let{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:i=!1,cssVarPrefix:a=`mui`,nativeColor:o=!1,shouldSkipGeneratingVar:s=br,colorSchemeSelector:c=n.light&&n.dark?`media`:void 0,rootSelector:l=`:root`,...u}=e,d=Object.keys(n)[0],p=r||(n.light&&d!==`light`?`light`:d),m=Or(a),{[p]:h,light:g,dark:_,...v}=n,y={...v},b=h;if((p===`dark`&&!(`dark`in n)||p===`light`&&!(`light`in n))&&(b=!0),!b)throw Error(process.env.NODE_ENV===`production`?f(21,p):`MUI: The \`colorSchemes.${p}\` option is either missing or invalid.`);let x;o&&(x=`oklch`);let S=kr(x,y,b,u,p);g&&!y.light&&kr(x,y,g,void 0,`light`),_&&!y.dark&&kr(x,y,_,void 0,`dark`);let C={defaultColorScheme:p,...S,cssVarPrefix:a,colorSchemeSelector:c,rootSelector:l,getCssVar:m,colorSchemes:y,font:{...qn(S.typography),...S.font},spacing:Er(u.spacing)};Object.keys(C.colorSchemes).forEach(e=>{let t=C.colorSchemes[e].palette,n=e=>{let n=e.split(`-`),r=n[1],i=n[2];return m(e,t[r][i])};t.mode===`light`&&(K(t.common,`background`,`#fff`),K(t.common,`onBackground`,`#000`)),t.mode===`dark`&&(K(t.common,`background`,`#000`),K(t.common,`onBackground`,`#fff`));function r(e,t,n){if(x){let r;return e===sn&&(r=`transparent ${((1-n)*100).toFixed(0)}%`),e===U&&(r=`#000 ${(n*100).toFixed(0)}%`),e===W&&(r=`#fff ${(n*100).toFixed(0)}%`),`color-mix(in ${x}, ${t}, ${r})`}return e(t,n)}if(Cr(t,[`Alert`,`AppBar`,`Avatar`,`Button`,`Chip`,`FilledInput`,`LinearProgress`,`Skeleton`,`Slider`,`SnackbarContent`,`SpeedDialAction`,`StepConnector`,`StepContent`,`Switch`,`TableCell`,`Tooltip`]),t.mode===`light`){K(t.Alert,`errorColor`,r(U,o?m(`palette-error-light`):t.error.light,.6)),K(t.Alert,`infoColor`,r(U,o?m(`palette-info-light`):t.info.light,.6)),K(t.Alert,`successColor`,r(U,o?m(`palette-success-light`):t.success.light,.6)),K(t.Alert,`warningColor`,r(U,o?m(`palette-warning-light`):t.warning.light,.6)),K(t.Alert,`errorFilledBg`,n(`palette-error-main`)),K(t.Alert,`infoFilledBg`,n(`palette-info-main`)),K(t.Alert,`successFilledBg`,n(`palette-success-main`)),K(t.Alert,`warningFilledBg`,n(`palette-warning-main`)),K(t.Alert,`errorFilledColor`,Dr(()=>t.getContrastText(t.error.main))),K(t.Alert,`infoFilledColor`,Dr(()=>t.getContrastText(t.info.main))),K(t.Alert,`successFilledColor`,Dr(()=>t.getContrastText(t.success.main))),K(t.Alert,`warningFilledColor`,Dr(()=>t.getContrastText(t.warning.main))),K(t.Alert,`errorStandardBg`,r(W,o?m(`palette-error-light`):t.error.light,.9)),K(t.Alert,`infoStandardBg`,r(W,o?m(`palette-info-light`):t.info.light,.9)),K(t.Alert,`successStandardBg`,r(W,o?m(`palette-success-light`):t.success.light,.9)),K(t.Alert,`warningStandardBg`,r(W,o?m(`palette-warning-light`):t.warning.light,.9)),K(t.Alert,`errorIconColor`,n(`palette-error-main`)),K(t.Alert,`infoIconColor`,n(`palette-info-main`)),K(t.Alert,`successIconColor`,n(`palette-success-main`)),K(t.Alert,`warningIconColor`,n(`palette-warning-main`)),K(t.AppBar,`defaultBg`,n(`palette-grey-100`)),K(t.Avatar,`defaultBg`,n(`palette-grey-400`)),K(t.Button,`inheritContainedBg`,n(`palette-grey-300`)),K(t.Button,`inheritContainedHoverBg`,n(`palette-grey-A100`)),K(t.Chip,`defaultBorder`,n(`palette-grey-400`)),K(t.Chip,`defaultAvatarColor`,n(`palette-grey-700`)),K(t.Chip,`defaultIconColor`,n(`palette-grey-700`)),K(t.FilledInput,`bg`,`rgba(0, 0, 0, 0.06)`),K(t.FilledInput,`hoverBg`,`rgba(0, 0, 0, 0.09)`),K(t.FilledInput,`disabledBg`,`rgba(0, 0, 0, 0.12)`),K(t.LinearProgress,`primaryBg`,r(W,o?m(`palette-primary-main`):t.primary.main,.62)),K(t.LinearProgress,`secondaryBg`,r(W,o?m(`palette-secondary-main`):t.secondary.main,.62)),K(t.LinearProgress,`errorBg`,r(W,o?m(`palette-error-main`):t.error.main,.62)),K(t.LinearProgress,`infoBg`,r(W,o?m(`palette-info-main`):t.info.main,.62)),K(t.LinearProgress,`successBg`,r(W,o?m(`palette-success-main`):t.success.main,.62)),K(t.LinearProgress,`warningBg`,r(W,o?m(`palette-warning-light`):t.warning.main,.62)),K(t.Skeleton,`bg`,x?r(sn,o?m(`palette-text-primary`):t.text.primary,.11):`rgba(${n(`palette-text-primaryChannel`)} / 0.11)`),K(t.Slider,`primaryTrack`,r(W,o?m(`palette-primary-main`):t.primary.main,.62)),K(t.Slider,`secondaryTrack`,r(W,o?m(`palette-secondary-main`):t.secondary.main,.62)),K(t.Slider,`errorTrack`,r(W,o?m(`palette-error-main`):t.error.main,.62)),K(t.Slider,`infoTrack`,r(W,o?m(`palette-info-main`):t.info.main,.62)),K(t.Slider,`successTrack`,r(W,o?m(`palette-success-main`):t.success.main,.62)),K(t.Slider,`warningTrack`,r(W,o?m(`palette-warning-main`):t.warning.main,.62));let e=x?r(U,o?m(`palette-background-default`):t.background.default,.6825):dn(t.background.default,.8);K(t.SnackbarContent,`bg`,e),K(t.SnackbarContent,`color`,Dr(()=>x?In.text.primary:t.getContrastText(e))),K(t.SpeedDialAction,`fabHoverBg`,dn(t.background.paper,.15)),K(t.StepConnector,`border`,n(`palette-grey-400`)),K(t.StepContent,`border`,n(`palette-grey-400`)),K(t.Switch,`defaultColor`,n(`palette-common-white`)),K(t.Switch,`defaultDisabledColor`,n(`palette-grey-100`)),K(t.Switch,`primaryDisabledColor`,r(W,o?m(`palette-primary-main`):t.primary.main,.62)),K(t.Switch,`secondaryDisabledColor`,r(W,o?m(`palette-secondary-main`):t.secondary.main,.62)),K(t.Switch,`errorDisabledColor`,r(W,o?m(`palette-error-main`):t.error.main,.62)),K(t.Switch,`infoDisabledColor`,r(W,o?m(`palette-info-main`):t.info.main,.62)),K(t.Switch,`successDisabledColor`,r(W,o?m(`palette-success-main`):t.success.main,.62)),K(t.Switch,`warningDisabledColor`,r(W,o?m(`palette-warning-main`):t.warning.main,.62)),K(t.TableCell,`border`,r(W,sn(o?m(`palette-divider`):t.divider,1),.88)),K(t.Tooltip,`bg`,r(sn,o?m(`palette-grey-700`):t.grey[700],.92))}if(t.mode===`dark`){K(t.Alert,`errorColor`,r(W,o?m(`palette-error-light`):t.error.light,.6)),K(t.Alert,`infoColor`,r(W,o?m(`palette-info-light`):t.info.light,.6)),K(t.Alert,`successColor`,r(W,o?m(`palette-success-light`):t.success.light,.6)),K(t.Alert,`warningColor`,r(W,o?m(`palette-warning-light`):t.warning.light,.6)),K(t.Alert,`errorFilledBg`,n(`palette-error-dark`)),K(t.Alert,`infoFilledBg`,n(`palette-info-dark`)),K(t.Alert,`successFilledBg`,n(`palette-success-dark`)),K(t.Alert,`warningFilledBg`,n(`palette-warning-dark`)),K(t.Alert,`errorFilledColor`,Dr(()=>t.getContrastText(t.error.dark))),K(t.Alert,`infoFilledColor`,Dr(()=>t.getContrastText(t.info.dark))),K(t.Alert,`successFilledColor`,Dr(()=>t.getContrastText(t.success.dark))),K(t.Alert,`warningFilledColor`,Dr(()=>t.getContrastText(t.warning.dark))),K(t.Alert,`errorStandardBg`,r(U,o?m(`palette-error-light`):t.error.light,.9)),K(t.Alert,`infoStandardBg`,r(U,o?m(`palette-info-light`):t.info.light,.9)),K(t.Alert,`successStandardBg`,r(U,o?m(`palette-success-light`):t.success.light,.9)),K(t.Alert,`warningStandardBg`,r(U,o?m(`palette-warning-light`):t.warning.light,.9)),K(t.Alert,`errorIconColor`,n(`palette-error-main`)),K(t.Alert,`infoIconColor`,n(`palette-info-main`)),K(t.Alert,`successIconColor`,n(`palette-success-main`)),K(t.Alert,`warningIconColor`,n(`palette-warning-main`)),K(t.AppBar,`defaultBg`,n(`palette-grey-900`)),K(t.AppBar,`darkBg`,n(`palette-background-paper`)),K(t.AppBar,`darkColor`,n(`palette-text-primary`)),K(t.Avatar,`defaultBg`,n(`palette-grey-600`)),K(t.Button,`inheritContainedBg`,n(`palette-grey-800`)),K(t.Button,`inheritContainedHoverBg`,n(`palette-grey-700`)),K(t.Chip,`defaultBorder`,n(`palette-grey-700`)),K(t.Chip,`defaultAvatarColor`,n(`palette-grey-300`)),K(t.Chip,`defaultIconColor`,n(`palette-grey-300`)),K(t.FilledInput,`bg`,`rgba(255, 255, 255, 0.09)`),K(t.FilledInput,`hoverBg`,`rgba(255, 255, 255, 0.13)`),K(t.FilledInput,`disabledBg`,`rgba(255, 255, 255, 0.12)`),K(t.LinearProgress,`primaryBg`,r(U,o?m(`palette-primary-main`):t.primary.main,.5)),K(t.LinearProgress,`secondaryBg`,r(U,o?m(`palette-secondary-main`):t.secondary.main,.5)),K(t.LinearProgress,`errorBg`,r(U,o?m(`palette-error-main`):t.error.main,.5)),K(t.LinearProgress,`infoBg`,r(U,o?m(`palette-info-main`):t.info.main,.5)),K(t.LinearProgress,`successBg`,r(U,o?m(`palette-success-main`):t.success.main,.5)),K(t.LinearProgress,`warningBg`,r(U,o?m(`palette-warning-main`):t.warning.main,.5)),K(t.Skeleton,`bg`,x?r(sn,o?m(`palette-text-primary`):t.text.primary,.13):`rgba(${n(`palette-text-primaryChannel`)} / 0.13)`),K(t.Slider,`primaryTrack`,r(U,o?m(`palette-primary-main`):t.primary.main,.5)),K(t.Slider,`secondaryTrack`,r(U,o?m(`palette-secondary-main`):t.secondary.main,.5)),K(t.Slider,`errorTrack`,r(U,o?m(`palette-error-main`):t.error.main,.5)),K(t.Slider,`infoTrack`,r(U,o?m(`palette-info-main`):t.info.main,.5)),K(t.Slider,`successTrack`,r(U,o?m(`palette-success-main`):t.success.main,.5)),K(t.Slider,`warningTrack`,r(U,o?m(`palette-warning-light`):t.warning.main,.5));let e=x?r(W,o?m(`palette-background-default`):t.background.default,.985):dn(t.background.default,.98);K(t.SnackbarContent,`bg`,e),K(t.SnackbarContent,`color`,Dr(()=>x?Pn.text.primary:t.getContrastText(e))),K(t.SpeedDialAction,`fabHoverBg`,dn(t.background.paper,.15)),K(t.StepConnector,`border`,n(`palette-grey-600`)),K(t.StepContent,`border`,n(`palette-grey-600`)),K(t.Switch,`defaultColor`,n(`palette-grey-300`)),K(t.Switch,`defaultDisabledColor`,n(`palette-grey-600`)),K(t.Switch,`primaryDisabledColor`,r(U,o?m(`palette-primary-main`):t.primary.main,.55)),K(t.Switch,`secondaryDisabledColor`,r(U,o?m(`palette-secondary-main`):t.secondary.main,.55)),K(t.Switch,`errorDisabledColor`,r(U,o?m(`palette-error-main`):t.error.main,.55)),K(t.Switch,`infoDisabledColor`,r(U,o?m(`palette-info-main`):t.info.main,.55)),K(t.Switch,`successDisabledColor`,r(U,o?m(`palette-success-main`):t.success.main,.55)),K(t.Switch,`warningDisabledColor`,r(U,o?m(`palette-warning-light`):t.warning.main,.55)),K(t.TableCell,`border`,r(U,sn(o?m(`palette-divider`):t.divider,1),.68)),K(t.Tooltip,`bg`,r(sn,o?m(`palette-grey-700`):t.grey[700],.92))}o||(Tr(t.background,`default`),Tr(t.background,`paper`),Tr(t.common,`background`),Tr(t.common,`onBackground`),Tr(t,`divider`)),Object.keys(t).forEach(e=>{let n=t[e];e!==`tonalOffset`&&!o&&n&&typeof n==`object`&&(n.main&&K(t[e],`mainChannel`,en(wr(n.main))),n.light&&K(t[e],`lightChannel`,en(wr(n.light))),n.dark&&K(t[e],`darkChannel`,en(wr(n.dark))),n.contrastText&&K(t[e],`contrastTextChannel`,en(wr(n.contrastText))),e===`text`&&(Tr(t[e],`primary`),Tr(t[e],`secondary`)),e===`action`&&(n.active&&Tr(t[e],`active`),n.selected&&Tr(t[e],`selected`)))})}),C=t.reduce((e,t)=>A(e,t),C);let w={prefix:a,disableCssColorScheme:i,shouldSkipGeneratingVar:s,getSelector:Sr(C),enableContrastVars:o},{vars:T,generateThemeVars:ee,generateStyleSheets:te}=Cn(C,w);return C.vars=T,Object.entries(C.colorSchemes[C.defaultColorScheme]).forEach(([e,t])=>{C[e]=t}),C.generateThemeVars=ee,C.generateStyleSheets=te,C.generateSpacing=function(){return Tt(u.spacing,xe(this))},C.getColorSchemeSelector=wn(c),C.spacing=C.generateSpacing(),C.shouldSkipGeneratingVar=s,C.unstable_sxConfig={...Ze,...u?.unstable_sxConfig},C.unstable_sx=function(e){return tt({sx:e,theme:this})},C.toRuntimeSource=ur,C}function jr(e,t,n){e.colorSchemes&&n&&(e.colorSchemes[t]={...n!==!0&&n,palette:Kn({...n===!0?{}:n.palette,mode:t})})}function Mr(e={},...t){let{palette:n,cssVariables:r=!1,colorSchemes:i=n?void 0:{light:!0},defaultColorScheme:a=n?.mode,...o}=e,s=a||`light`,c=i?.[s],l={...i,...n?{[s]:{...typeof c!=`boolean`&&c,palette:n}}:void 0};if(r===!1){if(!(`colorSchemes`in e))return mr(e,...t);let r=n;`palette`in e||l[s]&&(l[s]===!0?s===`dark`&&(r={mode:`dark`}):r=l[s].palette);let i=mr({...e,palette:r},...t);return i.defaultColorScheme=s,i.colorSchemes=l,i.palette.mode===`light`&&(i.colorSchemes.light={...l.light!==!0&&l.light,palette:i.palette},jr(i,`dark`,l.dark)),i.palette.mode===`dark`&&(i.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:i.palette},jr(i,`light`,l.light)),i}return!n&&!(`light`in l)&&s===`light`&&(l.light=!0),Ar({...o,colorSchemes:l,defaultColorScheme:s,...typeof r!=`boolean`&&r},...t)}var Nr=Mr(),Pr=`$$material`;function Fr(e){return e!==`ownerState`&&e!==`theme`&&e!==`sx`&&e!==`as`}var Ir=Ht({themeId:Pr,defaultTheme:Nr,rootShouldForwardProp:e=>Fr(e)&&e!==`classes`}),Lr=_n;function Rr(e){return(0,i.jsx)(pn,{...e})}process.env.NODE_ENV!==`production`&&(Rr.propTypes={children:M.default.node,value:M.default.object.isRequired});function zr(e){return hn(e)}function Br(e){return kt(`MuiSvgIcon`,e)}At(`MuiSvgIcon`,[`root`,`colorPrimary`,`colorSecondary`,`colorAction`,`colorError`,`colorDisabled`,`fontSizeInherit`,`fontSizeSmall`,`fontSizeMedium`,`fontSizeLarge`]);var Vr=e=>{let{color:t,fontSize:n,classes:r}=e;return te({root:[`root`,t!==`inherit`&&`color${m(t)}`,`fontSize${m(n)}`]},Br,r)},Hr=Ir(`svg`,{name:`MuiSvgIcon`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.color!==`inherit`&&t[`color${m(n.color)}`],t[`fontSize${m(n.fontSize)}`]]}})(Lr(({theme:e})=>({userSelect:`none`,width:`1em`,height:`1em`,display:`inline-block`,flexShrink:0,transition:e.transitions?.create?.(`fill`,{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:e=>!e.hasSvgAsChild,style:{fill:`currentColor`}},{props:{fontSize:`inherit`},style:{fontSize:`inherit`}},{props:{fontSize:`small`},style:{fontSize:e.typography?.pxToRem?.(20)||`1.25rem`}},{props:{fontSize:`medium`},style:{fontSize:e.typography?.pxToRem?.(24)||`1.5rem`}},{props:{fontSize:`large`},style:{fontSize:e.typography?.pxToRem?.(35)||`2.1875rem`}},...Object.entries((e.vars??e).palette).filter(([,e])=>e&&e.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:`action`},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:`disabled`},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:`inherit`},style:{color:void 0}}]}))),Ur=t.forwardRef(function(e,n){let r=zr({props:e,name:`MuiSvgIcon`}),{children:a,className:o,color:s=`inherit`,component:c=`svg`,fontSize:l=`medium`,htmlColor:u,inheritViewBox:d=!1,titleAccess:f,viewBox:p=`0 0 24 24`,...m}=r,h=t.isValidElement(a)&&a.type===`svg`,g={...r,color:s,component:c,fontSize:l,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:p,hasSvgAsChild:h},_={};return d||(_.viewBox=p),(0,i.jsxs)(Hr,{as:c,className:ee(Vr(g).root,o),focusable:`false`,color:u,"aria-hidden":f?void 0:!0,role:f?`img`:void 0,ref:n,..._,...m,...h&&a.props,ownerState:g,children:[h?a.props.children:a,f?(0,i.jsx)(`title`,{children:f}):null]})});process.env.NODE_ENV!==`production`&&(Ur.propTypes={children:M.default.node,classes:M.default.object,className:M.default.string,color:M.default.oneOfType([M.default.oneOf([`inherit`,`action`,`disabled`,`primary`,`secondary`,`error`,`info`,`success`,`warning`]),M.default.string]),component:M.default.elementType,fontSize:M.default.oneOfType([M.default.oneOf([`inherit`,`large`,`medium`,`small`]),M.default.string]),htmlColor:M.default.string,inheritViewBox:M.default.bool,shapeRendering:M.default.string,sx:M.default.oneOfType([M.default.arrayOf(M.default.oneOfType([M.default.func,M.default.object,M.default.bool])),M.default.func,M.default.object]),titleAccess:M.default.string,viewBox:M.default.string}),Ur.muiName=`SvgIcon`;function q(e,n){function r(t,r){return(0,i.jsx)(Ur,{"data-testid":process.env.NODE_ENV===`production`?void 0:`${n}Icon`,ref:r,...t,children:e})}return process.env.NODE_ENV!==`production`&&(r.displayName=`${n}Icon`),r.muiName=Ur.muiName,t.memo(t.forwardRef(r))}var Wr=q((0,i.jsx)(`path`,{d:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z`}),`Add`),Gr=q((0,i.jsx)(`path`,{d:`M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z`}),`ArrowBack`),Kr=q((0,i.jsx)(`path`,{d:`m7 10 5 5 5-5z`}),`ArrowDropDown`),qr=q((0,i.jsx)(`path`,{d:`M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z`}),`AutoFixHigh`),Jr=q((0,i.jsx)(`path`,{d:`M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`}),`Close`),Yr=q((0,i.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z`}),`Delete`),Xr=q((0,i.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z`}),`DeleteOutline`),Zr=q((0,i.jsx)(`path`,{d:`M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z`}),`Done`),Qr=q((0,i.jsx)(`path`,{d:`M18.41 5.8 17.2 4.59c-.78-.78-2.05-.78-2.83 0l-2.68 2.68L3 15.96V20h4.04l8.74-8.74 2.63-2.63c.79-.78.79-2.05 0-2.83M6.21 18H5v-1.21l8.66-8.66 1.21 1.21zM11 20l4-4h6v4z`}),`DriveFileRenameOutline`),$r=q((0,i.jsx)(`path`,{d:`M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8`}),`ErrorOutline`),ei=q((0,i.jsx)(`path`,{d:`M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5`}),`Group`),ti=q((0,i.jsx)(`path`,{d:`M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2`}),`MoreVert`),ni=q([(0,i.jsx)(`path`,{fillRule:`evenodd`,d:`M16.67 13.13C18.04 14.06 19 15.32 19 17v3h4v-3c0-2.18-3.57-3.47-6.33-3.87`},`0`),(0,i.jsx)(`circle`,{cx:`9`,cy:`8`,r:`4`,fillRule:`evenodd`},`1`),(0,i.jsx)(`path`,{fillRule:`evenodd`,d:`M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4c-.47 0-.91.1-1.33.24C14.5 5.27 15 6.58 15 8s-.5 2.73-1.33 3.76c.42.14.86.24 1.33.24m-6 1c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4`},`2`)],`PeopleAlt`),ri=q((0,i.jsx)(`path`,{d:`M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4`}),`Person`),ii=q((0,i.jsx)(`path`,{d:`M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m-9-2V7H4v3H1v2h3v3h2v-3h3v-2zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4`}),`PersonAdd`),ai=q((0,i.jsx)(`path`,{d:`M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z`}),`Refresh`),oi=q([(0,i.jsx)(`path`,{d:`M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8`},`0`),(0,i.jsx)(`path`,{d:`M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z`},`1`)],`Schedule`),si=q((0,i.jsx)(`path`,{d:`M2.01 21 23 12 2.01 3 2 10l15 2-15 2z`}),`Send`),ci=q((0,i.jsx)(`path`,{d:`M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3`}),`Visibility`),li=q((0,i.jsx)(`path`,{d:`M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z`}),`VisibilityOff`),ui=q((0,i.jsx)(`path`,{d:`M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7zm-4 4c-1.29-1.29-2.84-2.13-4.49-2.56l3.53 3.53zM2 3.05 5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24C7.81 10.89 6.27 11.73 5 13v.01L6.99 15c1.36-1.36 3.14-2.04 4.92-2.06L18.98 20l1.27-1.26L3.29 1.79zM9 17l3 3 3-3c-1.65-1.66-4.34-1.66-6 0`}),`WifiOff`);function di(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(n/36e5),a=Math.floor(n/864e5);return r<1?`now`:r<60?`${r}m`:i<24?`${i}h`:a<7?`${a}d`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}var fi=n.default.memo(({conversation:e,displayName:t,selected:n,onClick:a,currentUser:o})=>{let s=!!e.group,c=e.unread_count,l=o?.role===`admin`;return(0,i.jsx)(r.ListItem,{disablePadding:!0,children:(0,i.jsxs)(r.ListItemButton,{selected:n,onClick:a,sx:{"&.Mui-selected":{backgroundColor:`action.selected`,"&:hover":{backgroundColor:`action.selected`}}},children:[(0,i.jsx)(r.ListItemAvatar,{children:(0,i.jsx)(r.Badge,{badgeContent:c,color:`primary`,overlap:`circular`,invisible:c===0,children:(0,i.jsx)(r.Avatar,{sx:{bgcolor:s?`primary.main`:`secondary.main`},children:s?(0,i.jsx)(ei,{}):(0,i.jsx)(ri,{})})})}),(0,i.jsx)(r.ListItemText,{primary:(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,children:[(0,i.jsx)(r.Typography,{variant:`subtitle2`,noWrap:!0,sx:{fontWeight:c>0?600:400,flex:1},children:t}),(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,sx:{ml:1,flexShrink:0},children:di(e.last_message_at)})]}),secondary:(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,noWrap:!0,sx:{fontWeight:c>0?500:400},children:e.message_count===0?l&&s?`View group`:`No messages yet`:`${e.message_count} message${e.message_count===1?``:`s`}`})})]})})}),pi=()=>(0,i.jsxs)(r.ListItem,{children:[(0,i.jsx)(r.ListItemAvatar,{children:(0,i.jsx)(r.Skeleton,{variant:`circular`,width:40,height:40})}),(0,i.jsx)(r.ListItemText,{primary:(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:`space-between`,children:[(0,i.jsx)(r.Skeleton,{variant:`text`,width:`60%`}),(0,i.jsx)(r.Skeleton,{variant:`text`,width:`15%`})]}),secondary:(0,i.jsx)(r.Skeleton,{variant:`text`,width:`80%`})})]}),mi=function(e){return hi(e)&&!gi(e)};function hi(e){return!!e&&typeof e==`object`}function gi(e){var t=Object.prototype.toString.call(e);return t===`[object RegExp]`||t===`[object Date]`||vi(e)}var _i=typeof Symbol==`function`&&Symbol.for?Symbol.for(`react.element`):60103;function vi(e){return e.$$typeof===_i}function yi(e){return Array.isArray(e)?[]:{}}function bi(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Ci(yi(e),e,t):e}function xi(e,t,n){return e.concat(t).map(function(e){return bi(e,n)})}function Si(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach(function(t){r[t]=bi(e[t],n)}),Object.keys(t).forEach(function(i){!n.isMergeableObject(t[i])||!e[i]?r[i]=bi(t[i],n):r[i]=Ci(e[i],t[i],n)}),r}function Ci(e,t,n){n||={},n.arrayMerge=n.arrayMerge||xi,n.isMergeableObject=n.isMergeableObject||mi;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):Si(e,t,n):bi(t,n)}Ci.all=function(e,t){if(!Array.isArray(e))throw Error(`first argument should be an array`);return e.reduce(function(e,n){return Ci(e,n,t)},{})};var wi=Ci,Ti=typeof global==`object`&&global&&global.Object===Object&&global,Ei=typeof self==`object`&&self&&self.Object===Object&&self,Di=Ti||Ei||Function(`return this`)(),Oi=Di.Symbol,ki=Object.prototype,Ai=ki.hasOwnProperty,ji=ki.toString,Mi=Oi?Oi.toStringTag:void 0;function Ni(e){var t=Ai.call(e,Mi),n=e[Mi];try{e[Mi]=void 0;var r=!0}catch{}var i=ji.call(e);return r&&(t?e[Mi]=n:delete e[Mi]),i}var Pi=Object.prototype.toString;function Fi(e){return Pi.call(e)}var Ii=`[object Null]`,Li=`[object Undefined]`,Ri=Oi?Oi.toStringTag:void 0;function zi(e){return e==null?e===void 0?Li:Ii:Ri&&Ri in Object(e)?Ni(e):Fi(e)}function Bi(e,t){return function(n){return e(t(n))}}var Vi=Bi(Object.getPrototypeOf,Object);function Hi(e){return typeof e==`object`&&!!e}var Ui=`[object Object]`,Wi=Function.prototype,Gi=Object.prototype,Ki=Wi.toString,qi=Gi.hasOwnProperty,Ji=Ki.call(Object);function Yi(e){if(!Hi(e)||zi(e)!=Ui)return!1;var t=Vi(e);if(t===null)return!0;var n=qi.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Ki.call(n)==Ji}function Xi(){this.__data__=[],this.size=0}function Zi(e,t){return e===t||e!==e&&t!==t}function Qi(e,t){for(var n=e.length;n--;)if(Zi(e[n][0],t))return n;return-1}var $i=Array.prototype.splice;function ea(e){var t=this.__data__,n=Qi(t,e);return n<0?!1:(n==t.length-1?t.pop():$i.call(t,n,1),--this.size,!0)}function ta(e){var t=this.__data__,n=Qi(t,e);return n<0?void 0:t[n][1]}function na(e){return Qi(this.__data__,e)>-1}function ra(e,t){var n=this.__data__,r=Qi(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ia(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ia.prototype.clear=Xi,ia.prototype.delete=ea,ia.prototype.get=ta,ia.prototype.has=na,ia.prototype.set=ra;function aa(){this.__data__=new ia,this.size=0}function oa(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function sa(e){return this.__data__.get(e)}function ca(e){return this.__data__.has(e)}function la(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var ua=`[object AsyncFunction]`,da=`[object Function]`,fa=`[object GeneratorFunction]`,pa=`[object Proxy]`;function ma(e){if(!la(e))return!1;var t=zi(e);return t==da||t==fa||t==ua||t==pa}var ha=Di[`__core-js_shared__`],ga=function(){var e=/[^.]+$/.exec(ha&&ha.keys&&ha.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function _a(e){return!!ga&&ga in e}var va=Function.prototype.toString;function ya(e){if(e!=null){try{return va.call(e)}catch{}try{return e+``}catch{}}return``}var ba=/[\\^$.*+?()[\]{}|]/g,xa=/^\[object .+?Constructor\]$/,Sa=Function.prototype,Ca=Object.prototype,wa=Sa.toString,Ta=Ca.hasOwnProperty,Ea=RegExp(`^`+wa.call(Ta).replace(ba,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function Da(e){return!la(e)||_a(e)?!1:(ma(e)?Ea:xa).test(ya(e))}function Oa(e,t){return e?.[t]}function ka(e,t){var n=Oa(e,t);return Da(n)?n:void 0}var Aa=ka(Di,`Map`),ja=ka(Object,`create`);function Ma(){this.__data__=ja?ja(null):{},this.size=0}function Na(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var Pa=`__lodash_hash_undefined__`,Fa=Object.prototype.hasOwnProperty;function Ia(e){var t=this.__data__;if(ja){var n=t[e];return n===Pa?void 0:n}return Fa.call(t,e)?t[e]:void 0}var La=Object.prototype.hasOwnProperty;function Ra(e){var t=this.__data__;return ja?t[e]!==void 0:La.call(t,e)}var za=`__lodash_hash_undefined__`;function Ba(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=ja&&t===void 0?za:t,this}function Va(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Va.prototype.clear=Ma,Va.prototype.delete=Na,Va.prototype.get=Ia,Va.prototype.has=Ra,Va.prototype.set=Ba;function Ha(){this.size=0,this.__data__={hash:new Va,map:new(Aa||ia),string:new Va}}function Ua(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Wa(e,t){var n=e.__data__;return Ua(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Ga(e){var t=Wa(this,e).delete(e);return this.size-=+!!t,t}function Ka(e){return Wa(this,e).get(e)}function qa(e){return Wa(this,e).has(e)}function Ja(e,t){var n=Wa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Ya(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ya.prototype.clear=Ha,Ya.prototype.delete=Ga,Ya.prototype.get=Ka,Ya.prototype.has=qa,Ya.prototype.set=Ja;var Xa=200;function Za(e,t){var n=this.__data__;if(n instanceof ia){var r=n.__data__;if(!Aa||r.length<Xa-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ya(r)}return n.set(e,t),this.size=n.size,this}function Qa(e){this.size=(this.__data__=new ia(e)).size}Qa.prototype.clear=aa,Qa.prototype.delete=oa,Qa.prototype.get=sa,Qa.prototype.has=ca,Qa.prototype.set=Za;function $a(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var eo=function(){try{var e=ka(Object,`defineProperty`);return e({},``,{}),e}catch{}}();function to(e,t,n){t==`__proto__`&&eo?eo(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var no=Object.prototype.hasOwnProperty;function ro(e,t,n){var r=e[t];(!(no.call(e,t)&&Zi(r,n))||n===void 0&&!(t in e))&&to(e,t,n)}function io(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?to(n,s,c):ro(n,s,c)}return n}function ao(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var oo=`[object Arguments]`;function so(e){return Hi(e)&&zi(e)==oo}var co=Object.prototype,lo=co.hasOwnProperty,uo=co.propertyIsEnumerable,fo=so(function(){return arguments}())?so:function(e){return Hi(e)&&lo.call(e,`callee`)&&!uo.call(e,`callee`)},po=Array.isArray;function mo(){return!1}var ho=typeof exports==`object`&&exports&&!exports.nodeType&&exports,go=ho&&typeof module==`object`&&module&&!module.nodeType&&module,_o=go&&go.exports===ho?Di.Buffer:void 0,vo=(_o?_o.isBuffer:void 0)||mo,yo=9007199254740991,bo=/^(?:0|[1-9]\d*)$/;function xo(e,t){var n=typeof e;return t??=yo,!!t&&(n==`number`||n!=`symbol`&&bo.test(e))&&e>-1&&e%1==0&&e<t}var So=9007199254740991;function Co(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=So}var wo=`[object Arguments]`,To=`[object Array]`,Eo=`[object Boolean]`,Do=`[object Date]`,Oo=`[object Error]`,ko=`[object Function]`,Ao=`[object Map]`,jo=`[object Number]`,Mo=`[object Object]`,No=`[object RegExp]`,Po=`[object Set]`,Fo=`[object String]`,Io=`[object WeakMap]`,Lo=`[object ArrayBuffer]`,Ro=`[object DataView]`,zo=`[object Float32Array]`,Bo=`[object Float64Array]`,Vo=`[object Int8Array]`,Ho=`[object Int16Array]`,Uo=`[object Int32Array]`,Wo=`[object Uint8Array]`,Go=`[object Uint8ClampedArray]`,Ko=`[object Uint16Array]`,qo=`[object Uint32Array]`,J={};J[zo]=J[Bo]=J[Vo]=J[Ho]=J[Uo]=J[Wo]=J[Go]=J[Ko]=J[qo]=!0,J[wo]=J[To]=J[Lo]=J[Eo]=J[Ro]=J[Do]=J[Oo]=J[ko]=J[Ao]=J[jo]=J[Mo]=J[No]=J[Po]=J[Fo]=J[Io]=!1;function Jo(e){return Hi(e)&&Co(e.length)&&!!J[zi(e)]}function Yo(e){return function(t){return e(t)}}var Xo=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Zo=Xo&&typeof module==`object`&&module&&!module.nodeType&&module,Qo=Zo&&Zo.exports===Xo&&Ti.process,$o=function(){try{return Zo&&Zo.require&&Zo.require(`util`).types||Qo&&Qo.binding&&Qo.binding(`util`)}catch{}}(),es=$o&&$o.isTypedArray,ts=es?Yo(es):Jo,ns=Object.prototype.hasOwnProperty;function rs(e,t){var n=po(e),r=!n&&fo(e),i=!n&&!r&&vo(e),a=!n&&!r&&!i&&ts(e),o=n||r||i||a,s=o?ao(e.length,String):[],c=s.length;for(var l in e)(t||ns.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||xo(l,c)))&&s.push(l);return s}var is=Object.prototype;function as(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||is)}var os=Bi(Object.keys,Object),ss=Object.prototype.hasOwnProperty;function cs(e){if(!as(e))return os(e);var t=[];for(var n in Object(e))ss.call(e,n)&&n!=`constructor`&&t.push(n);return t}function ls(e){return e!=null&&Co(e.length)&&!ma(e)}function us(e){return ls(e)?rs(e):cs(e)}function ds(e,t){return e&&io(t,us(t),e)}function fs(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var ps=Object.prototype.hasOwnProperty;function ms(e){if(!la(e))return fs(e);var t=as(e),n=[];for(var r in e)r==`constructor`&&(t||!ps.call(e,r))||n.push(r);return n}function hs(e){return ls(e)?rs(e,!0):ms(e)}function gs(e,t){return e&&io(t,hs(t),e)}var _s=typeof exports==`object`&&exports&&!exports.nodeType&&exports,vs=_s&&typeof module==`object`&&module&&!module.nodeType&&module,ys=vs&&vs.exports===_s?Di.Buffer:void 0,bs=ys?ys.allocUnsafe:void 0;function xs(e,t){if(t)return e.slice();var n=e.length,r=bs?bs(n):new e.constructor(n);return e.copy(r),r}function Ss(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function Cs(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function ws(){return[]}var Ts=Object.prototype.propertyIsEnumerable,Es=Object.getOwnPropertySymbols,Ds=Es?function(e){return e==null?[]:(e=Object(e),Cs(Es(e),function(t){return Ts.call(e,t)}))}:ws;function Os(e,t){return io(e,Ds(e),t)}function ks(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var As=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ks(t,Ds(e)),e=Vi(e);return t}:ws;function js(e,t){return io(e,As(e),t)}function Ms(e,t,n){var r=t(e);return po(e)?r:ks(r,n(e))}function Ns(e){return Ms(e,us,Ds)}function Ps(e){return Ms(e,hs,As)}var Fs=ka(Di,`DataView`),Is=ka(Di,`Promise`),Ls=ka(Di,`Set`),Rs=ka(Di,`WeakMap`),zs=`[object Map]`,Bs=`[object Object]`,Vs=`[object Promise]`,Hs=`[object Set]`,Us=`[object WeakMap]`,Ws=`[object DataView]`,Gs=ya(Fs),Ks=ya(Aa),qs=ya(Is),Js=ya(Ls),Ys=ya(Rs),Xs=zi;(Fs&&Xs(new Fs(new ArrayBuffer(1)))!=Ws||Aa&&Xs(new Aa)!=zs||Is&&Xs(Is.resolve())!=Vs||Ls&&Xs(new Ls)!=Hs||Rs&&Xs(new Rs)!=Us)&&(Xs=function(e){var t=zi(e),n=t==Bs?e.constructor:void 0,r=n?ya(n):``;if(r)switch(r){case Gs:return Ws;case Ks:return zs;case qs:return Vs;case Js:return Hs;case Ys:return Us}return t});var Zs=Xs,Qs=Object.prototype.hasOwnProperty;function $s(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&Qs.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var ec=Di.Uint8Array;function tc(e){var t=new e.constructor(e.byteLength);return new ec(t).set(new ec(e)),t}function nc(e,t){var n=t?tc(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var rc=/\w*$/;function ic(e){var t=new e.constructor(e.source,rc.exec(e));return t.lastIndex=e.lastIndex,t}var ac=Oi?Oi.prototype:void 0,oc=ac?ac.valueOf:void 0;function sc(e){return oc?Object(oc.call(e)):{}}function cc(e,t){var n=t?tc(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var lc=`[object Boolean]`,uc=`[object Date]`,dc=`[object Map]`,fc=`[object Number]`,pc=`[object RegExp]`,mc=`[object Set]`,hc=`[object String]`,gc=`[object Symbol]`,_c=`[object ArrayBuffer]`,vc=`[object DataView]`,yc=`[object Float32Array]`,bc=`[object Float64Array]`,xc=`[object Int8Array]`,Sc=`[object Int16Array]`,Cc=`[object Int32Array]`,wc=`[object Uint8Array]`,Tc=`[object Uint8ClampedArray]`,Ec=`[object Uint16Array]`,Dc=`[object Uint32Array]`;function Oc(e,t,n){var r=e.constructor;switch(t){case _c:return tc(e);case lc:case uc:return new r(+e);case vc:return nc(e,n);case yc:case bc:case xc:case Sc:case Cc:case wc:case Tc:case Ec:case Dc:return cc(e,n);case dc:return new r;case fc:case hc:return new r(e);case pc:return ic(e);case mc:return new r;case gc:return sc(e)}}var kc=Object.create,Ac=function(){function e(){}return function(t){if(!la(t))return{};if(kc)return kc(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function jc(e){return typeof e.constructor==`function`&&!as(e)?Ac(Vi(e)):{}}var Mc=`[object Map]`;function Nc(e){return Hi(e)&&Zs(e)==Mc}var Pc=$o&&$o.isMap,Fc=Pc?Yo(Pc):Nc,Ic=`[object Set]`;function Lc(e){return Hi(e)&&Zs(e)==Ic}var Rc=$o&&$o.isSet,zc=Rc?Yo(Rc):Lc,Bc=1,Vc=2,Hc=4,Uc=`[object Arguments]`,Wc=`[object Array]`,Gc=`[object Boolean]`,Kc=`[object Date]`,qc=`[object Error]`,Jc=`[object Function]`,Yc=`[object GeneratorFunction]`,Xc=`[object Map]`,Zc=`[object Number]`,Qc=`[object Object]`,$c=`[object RegExp]`,el=`[object Set]`,tl=`[object String]`,nl=`[object Symbol]`,rl=`[object WeakMap]`,il=`[object ArrayBuffer]`,al=`[object DataView]`,ol=`[object Float32Array]`,sl=`[object Float64Array]`,cl=`[object Int8Array]`,ll=`[object Int16Array]`,ul=`[object Int32Array]`,dl=`[object Uint8Array]`,fl=`[object Uint8ClampedArray]`,pl=`[object Uint16Array]`,ml=`[object Uint32Array]`,Y={};Y[Uc]=Y[Wc]=Y[il]=Y[al]=Y[Gc]=Y[Kc]=Y[ol]=Y[sl]=Y[cl]=Y[ll]=Y[ul]=Y[Xc]=Y[Zc]=Y[Qc]=Y[$c]=Y[el]=Y[tl]=Y[nl]=Y[dl]=Y[fl]=Y[pl]=Y[ml]=!0,Y[qc]=Y[Jc]=Y[rl]=!1;function hl(e,t,n,r,i,a){var o,s=t&Bc,c=t&Vc,l=t&Hc;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!la(e))return e;var u=po(e);if(u){if(o=$s(e),!s)return Ss(e,o)}else{var d=Zs(e),f=d==Jc||d==Yc;if(vo(e))return xs(e,s);if(d==Qc||d==Uc||f&&!i){if(o=c||f?{}:jc(e),!s)return c?js(e,gs(o,e)):Os(e,ds(o,e))}else{if(!Y[d])return i?e:{};o=Oc(e,d,s)}}a||=new Qa;var p=a.get(e);if(p)return p;a.set(e,o),zc(e)?e.forEach(function(r){o.add(hl(r,t,n,r,e,a))}):Fc(e)&&e.forEach(function(r,i){o.set(i,hl(r,t,n,i,e,a))});var m=u?void 0:(l?c?Ps:Ns:c?hs:us)(e);return $a(m||e,function(r,i){m&&(i=r,r=e[i]),ro(o,i,hl(r,t,n,i,e,a))}),o}var gl=1,_l=4;function vl(e){return hl(e,gl|_l)}var yl=e.g(((e,t)=>{var n=Array.isArray,r=Object.keys,i=Object.prototype.hasOwnProperty,a=typeof Element<`u`;function o(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){var s=n(e),c=n(t),l,u,d;if(s&&c){if(u=e.length,u!=t.length)return!1;for(l=u;l--!==0;)if(!o(e[l],t[l]))return!1;return!0}if(s!=c)return!1;var f=e instanceof Date,p=t instanceof Date;if(f!=p)return!1;if(f&&p)return e.getTime()==t.getTime();var m=e instanceof RegExp,h=t instanceof RegExp;if(m!=h)return!1;if(m&&h)return e.toString()==t.toString();var g=r(e);if(u=g.length,u!==r(t).length)return!1;for(l=u;l--!==0;)if(!i.call(t,g[l]))return!1;if(a&&e instanceof Element&&t instanceof Element)return e===t;for(l=u;l--!==0;)if(d=g[l],!(d===`_owner`&&e.$$typeof)&&!o(e[d],t[d]))return!1;return!0}return e!==e&&t!==t}t.exports=function(e,t){try{return o(e,t)}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||e.number===-2146828260)return console.warn(`Warning: react-fast-compare does not handle circular references.`,e.name,e.message),!1;throw e}}})),bl=e._(yl()),xl=process.env.NODE_ENV===`production`;function Sl(e,t){if(!xl){if(e)return;var n=`Warning: `+t;typeof console<`u`&&console.warn(n);try{throw Error(n)}catch{}}}var Cl=4;function wl(e){return hl(e,Cl)}function Tl(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var El=`[object Symbol]`;function Dl(e){return typeof e==`symbol`||Hi(e)&&zi(e)==El}var Ol=`Expected a function`;function kl(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(Ol);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(kl.Cache||Ya),n}kl.Cache=Ya;var Al=500;function jl(e){var t=kl(e,function(e){return n.size===Al&&n.clear(),e}),n=t.cache;return t}var Ml=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Nl=/\\(\\)?/g,Pl=jl(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(Ml,function(e,n,r,i){t.push(r?i.replace(Nl,`$1`):n||e)}),t}),Fl=1/0;function Il(e){if(typeof e==`string`||Dl(e))return e;var t=e+``;return t==`0`&&1/e==-Fl?`-0`:t}var Ll=1/0,Rl=Oi?Oi.prototype:void 0,zl=Rl?Rl.toString:void 0;function Bl(e){if(typeof e==`string`)return e;if(po(e))return Tl(e,Bl)+``;if(Dl(e))return zl?zl.call(e):``;var t=e+``;return t==`0`&&1/e==-Ll?`-0`:t}function Vl(e){return e==null?``:Bl(e)}function Hl(e){return po(e)?Tl(e,Il):Dl(e)?[e]:Ss(Pl(Vl(e)))}var Ul=e.g((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),Wl=e.g((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,ee=n,te=d,ne=i,E=h,D=m,O=r,k=o,A=a,j=f,M=!1;function N(e){return M||(M=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),P(e)||x(e)===l}function P(e){return x(e)===u}function re(e){return x(e)===c}function ie(e){return x(e)===s}function ae(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function F(e){return x(e)===d}function oe(e){return x(e)===i}function se(e){return x(e)===h}function I(e){return x(e)===m}function ce(e){return x(e)===r}function le(e){return x(e)===o}function ue(e){return x(e)===a}function de(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=ee,e.ForwardRef=te,e.Fragment=ne,e.Lazy=E,e.Memo=D,e.Portal=O,e.Profiler=k,e.StrictMode=A,e.Suspense=j,e.isAsyncMode=N,e.isConcurrentMode=P,e.isContextConsumer=re,e.isContextProvider=ie,e.isElement=ae,e.isForwardRef=F,e.isFragment=oe,e.isLazy=se,e.isMemo=I,e.isPortal=ce,e.isProfiler=le,e.isStrictMode=ue,e.isSuspense=de,e.isValidElementType=b,e.typeOf=x})()})),Gl=e.g(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Ul():t.exports=Wl()}));e.g(((e,t)=>{var n=Gl(),r={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},o={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};s[n.ForwardRef]=a,s[n.Memo]=o;function c(e){return n.isMemo(e)?o:s[e.$$typeof]||r}var l=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,m=Object.prototype;function h(e,t,n){if(typeof t!=`string`){if(m){var r=p(t);r&&r!==m&&h(e,r,n)}var a=u(t);d&&(a=a.concat(d(t)));for(var o=c(e),s=c(t),g=0;g<a.length;++g){var _=a[g];if(!i[_]&&!(n&&n[_])&&!(s&&s[_])&&!(o&&o[_])){var v=f(t,_);try{l(e,_,v)}catch{}}}}return e}t.exports=h}))();function X(){return X=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X.apply(this,arguments)}function Kl(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function ql(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Jl(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}var Yl=(0,t.createContext)(void 0);Yl.displayName=`FormikContext`,Yl.Provider,Yl.Consumer;function Xl(){var e=(0,t.useContext)(Yl);return!e&&(process.env.NODE_ENV===`production`?Sl(!1):Sl(!1,`Formik context is undefined, please verify you are calling useFormikContext() as child of a <Formik> component.`)),e}var Zl=function(e){return Array.isArray(e)&&e.length===0},Z=function(e){return typeof e==`function`},Ql=function(e){return typeof e==`object`&&!!e},$l=function(e){return String(Math.floor(Number(e)))===e},eu=function(e){return Object.prototype.toString.call(e)===`[object String]`},tu=function(e){return t.Children.count(e)===0},nu=function(e){return Ql(e)&&Z(e.then)};function ru(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Q(e,t,n,r){r===void 0&&(r=0);for(var i=Hl(t);e&&r<i.length;)e=e[i[r++]];return r!==i.length&&!e||e===void 0?n:e}function iu(e,t,n){for(var r=wl(e),i=r,a=0,o=Hl(t);a<o.length-1;a++){var s=o[a],c=Q(e,o.slice(0,a+1));if(c&&(Ql(c)||Array.isArray(c)))i=i[s]=wl(c);else{var l=o[a+1];i=i[s]=$l(l)&&Number(l)>=0?[]:{}}}return(a===0?e:i)[o[a]]===n?e:(n===void 0?delete i[o[a]]:i[o[a]]=n,a===0&&n===void 0&&delete r[o[a]],r)}function au(e,t,n,r){n===void 0&&(n=new WeakMap),r===void 0&&(r={});for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],s=e[o];Ql(s)?n.get(s)||(n.set(s,!0),r[o]=Array.isArray(s)?[]:{},au(s,t,n,r[o])):r[o]=t}return r}function ou(e,t){switch(t.type){case`SET_VALUES`:return X({},e,{values:t.payload});case`SET_TOUCHED`:return X({},e,{touched:t.payload});case`SET_ERRORS`:return(0,bl.default)(e.errors,t.payload)?e:X({},e,{errors:t.payload});case`SET_STATUS`:return X({},e,{status:t.payload});case`SET_ISSUBMITTING`:return X({},e,{isSubmitting:t.payload});case`SET_ISVALIDATING`:return X({},e,{isValidating:t.payload});case`SET_FIELD_VALUE`:return X({},e,{values:iu(e.values,t.payload.field,t.payload.value)});case`SET_FIELD_TOUCHED`:return X({},e,{touched:iu(e.touched,t.payload.field,t.payload.value)});case`SET_FIELD_ERROR`:return X({},e,{errors:iu(e.errors,t.payload.field,t.payload.value)});case`RESET_FORM`:return X({},e,t.payload);case`SET_FORMIK_STATE`:return t.payload(e);case`SUBMIT_ATTEMPT`:return X({},e,{touched:au(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case`SUBMIT_FAILURE`:return X({},e,{isSubmitting:!1});case`SUBMIT_SUCCESS`:return X({},e,{isSubmitting:!1});default:return e}}var su={},cu={};function lu(e){var n=e.validateOnChange,r=n===void 0?!0:n,i=e.validateOnBlur,a=i===void 0?!0:i,o=e.validateOnMount,s=o===void 0?!1:o,c=e.isInitialValid,l=e.enableReinitialize,u=l===void 0?!1:l,d=e.onSubmit,f=ql(e,[`validateOnChange`,`validateOnBlur`,`validateOnMount`,`isInitialValid`,`enableReinitialize`,`onSubmit`]),p=X({validateOnChange:r,validateOnBlur:a,validateOnMount:s,onSubmit:d},f),m=(0,t.useRef)(p.initialValues),h=(0,t.useRef)(p.initialErrors||su),g=(0,t.useRef)(p.initialTouched||cu),_=(0,t.useRef)(p.initialStatus),v=(0,t.useRef)(!1),y=(0,t.useRef)({});process.env.NODE_ENV!==`production`&&(0,t.useEffect)(function(){c!==void 0&&(process.env.NODE_ENV===`production`?Sl(!1):Sl(!1,`isInitialValid has been deprecated and will be removed in future versions of Formik. Please use initialErrors or validateOnMount instead.`))},[]),(0,t.useEffect)(function(){return v.current=!0,function(){v.current=!1}},[]);var b=(0,t.useState)(0)[1],x=(0,t.useRef)({values:vl(p.initialValues),errors:vl(p.initialErrors)||su,touched:vl(p.initialTouched)||cu,status:vl(p.initialStatus),isSubmitting:!1,isValidating:!1,submitCount:0}),S=x.current,C=(0,t.useCallback)(function(e){var t=x.current;x.current=ou(t,e),t!==x.current&&b(function(e){return e+1})},[]),w=(0,t.useCallback)(function(e,t){return new Promise(function(n,r){var i=p.validate(e,t);i==null?n(su):nu(i)?i.then(function(e){n(e||su)},function(e){process.env.NODE_ENV!==`production`&&console.warn(`Warning: An unhandled error was caught during validation in <Formik validate />`,e),r(e)}):n(i)})},[p.validate]),T=(0,t.useCallback)(function(e,t){var n=p.validationSchema,r=Z(n)?n(t):n,i=t&&r.validateAt?r.validateAt(t,e):fu(e,r);return new Promise(function(e,t){i.then(function(){e(su)},function(n){n.name===`ValidationError`?e(du(n)):(process.env.NODE_ENV!==`production`&&console.warn(`Warning: An unhandled error was caught during validation in <Formik validationSchema />`,n),t(n))})})},[p.validationSchema]),ee=(0,t.useCallback)(function(e,t){return new Promise(function(n){return n(y.current[e].validate(t))})},[]),te=(0,t.useCallback)(function(e){var t=Object.keys(y.current).filter(function(e){return Z(y.current[e].validate)}),n=t.length>0?t.map(function(t){return ee(t,Q(e,t))}):[Promise.resolve(`DO_NOT_DELETE_YOU_WILL_BE_FIRED`)];return Promise.all(n).then(function(e){return e.reduce(function(e,n,r){return n===`DO_NOT_DELETE_YOU_WILL_BE_FIRED`||n&&(e=iu(e,t[r],n)),e},{})})},[ee]),ne=(0,t.useCallback)(function(e){return Promise.all([te(e),p.validationSchema?T(e):{},p.validate?w(e):{}]).then(function(e){var t=e[0],n=e[1],r=e[2];return wi.all([t,n,r],{arrayMerge:mu})})},[p.validate,p.validationSchema,te,w,T]),E=$(function(e){return e===void 0&&(e=S.values),C({type:`SET_ISVALIDATING`,payload:!0}),ne(e).then(function(e){return v.current&&(C({type:`SET_ISVALIDATING`,payload:!1}),C({type:`SET_ERRORS`,payload:e})),e})});(0,t.useEffect)(function(){s&&v.current===!0&&(0,bl.default)(m.current,p.initialValues)&&E(m.current)},[s,E]);var D=(0,t.useCallback)(function(e){var t=e&&e.values?e.values:m.current,n=e&&e.errors?e.errors:h.current?h.current:p.initialErrors||{},r=e&&e.touched?e.touched:g.current?g.current:p.initialTouched||{},i=e&&e.status?e.status:_.current?_.current:p.initialStatus;m.current=t,h.current=n,g.current=r,_.current=i;var a=function(){C({type:`RESET_FORM`,payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:n,touched:r,status:i,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&typeof e.submitCount==`number`?e.submitCount:0}})};if(p.onReset){var o=p.onReset(S.values,L);nu(o)?o.then(a):a()}else a()},[p.initialErrors,p.initialStatus,p.initialTouched,p.onReset]);(0,t.useEffect)(function(){v.current===!0&&!(0,bl.default)(m.current,p.initialValues)&&u&&(m.current=p.initialValues,D(),s&&E(m.current))},[u,p.initialValues,D,s,E]),(0,t.useEffect)(function(){u&&v.current===!0&&!(0,bl.default)(h.current,p.initialErrors)&&(h.current=p.initialErrors||su,C({type:`SET_ERRORS`,payload:p.initialErrors||su}))},[u,p.initialErrors]),(0,t.useEffect)(function(){u&&v.current===!0&&!(0,bl.default)(g.current,p.initialTouched)&&(g.current=p.initialTouched||cu,C({type:`SET_TOUCHED`,payload:p.initialTouched||cu}))},[u,p.initialTouched]),(0,t.useEffect)(function(){u&&v.current===!0&&!(0,bl.default)(_.current,p.initialStatus)&&(_.current=p.initialStatus,C({type:`SET_STATUS`,payload:p.initialStatus}))},[u,p.initialStatus,p.initialTouched]);var O=$(function(e){if(y.current[e]&&Z(y.current[e].validate)){var t=Q(S.values,e),n=y.current[e].validate(t);return nu(n)?(C({type:`SET_ISVALIDATING`,payload:!0}),n.then(function(e){return e}).then(function(t){C({type:`SET_FIELD_ERROR`,payload:{field:e,value:t}}),C({type:`SET_ISVALIDATING`,payload:!1})})):(C({type:`SET_FIELD_ERROR`,payload:{field:e,value:n}}),Promise.resolve(n))}else if(p.validationSchema)return C({type:`SET_ISVALIDATING`,payload:!0}),T(S.values,e).then(function(e){return e}).then(function(t){C({type:`SET_FIELD_ERROR`,payload:{field:e,value:Q(t,e)}}),C({type:`SET_ISVALIDATING`,payload:!1})});return Promise.resolve()}),k=(0,t.useCallback)(function(e,t){var n=t.validate;y.current[e]={validate:n}},[]),A=(0,t.useCallback)(function(e){delete y.current[e]},[]),j=$(function(e,t){return C({type:`SET_TOUCHED`,payload:e}),(t===void 0?a:t)?E(S.values):Promise.resolve()}),M=(0,t.useCallback)(function(e){C({type:`SET_ERRORS`,payload:e})},[]),N=$(function(e,t){var n=Z(e)?e(S.values):e;return C({type:`SET_VALUES`,payload:n}),(t===void 0?r:t)?E(n):Promise.resolve()}),P=(0,t.useCallback)(function(e,t){C({type:`SET_FIELD_ERROR`,payload:{field:e,value:t}})},[]),re=$(function(e,t,n){var i=Z(t)?t(Q(S.values,e)):t;return C({type:`SET_FIELD_VALUE`,payload:{field:e,value:i}}),(n===void 0?r:n)?E(iu(S.values,e,i)):Promise.resolve()}),ie=(0,t.useCallback)(function(e,t){var n=t,r=e,i;if(!eu(e)){e.persist&&e.persist();var a=e.target?e.target:e.currentTarget,o=a.type,s=a.name,c=a.id,l=a.value,u=a.checked,d=a.outerHTML,f=a.options,p=a.multiple;n=t||s||c,!n&&process.env.NODE_ENV!==`production`&&uu({htmlContent:d,documentationAnchorLink:`handlechange-e-reactchangeeventany--void`,handlerName:`handleChange`}),r=/number|range/.test(o)?(i=parseFloat(l),isNaN(i)?``:i):/checkbox/.test(o)?gu(Q(S.values,n),u,l):f&&p?hu(f):l}n&&re(n,r)},[re,S.values]),ae=$(function(e){if(eu(e))return function(t){return ie(t,e)};ie(e)}),F=$(function(e,t,n){return t===void 0&&(t=!0),C({type:`SET_FIELD_TOUCHED`,payload:{field:e,value:t}}),(n===void 0?a:n)?E(S.values):Promise.resolve()}),oe=(0,t.useCallback)(function(e,t){e.persist&&e.persist();var n=e.target,r=n.name,i=n.id,a=n.outerHTML,o=t||r||i;!o&&process.env.NODE_ENV!==`production`&&uu({htmlContent:a,documentationAnchorLink:`handleblur-e-any--void`,handlerName:`handleBlur`}),F(o,!0)},[F]),se=$(function(e){if(eu(e))return function(t){return oe(t,e)};oe(e)}),I=(0,t.useCallback)(function(e){Z(e)?C({type:`SET_FORMIK_STATE`,payload:e}):C({type:`SET_FORMIK_STATE`,payload:function(){return e}})},[]),ce=(0,t.useCallback)(function(e){C({type:`SET_STATUS`,payload:e})},[]),le=(0,t.useCallback)(function(e){C({type:`SET_ISSUBMITTING`,payload:e})},[]),ue=$(function(){return C({type:`SUBMIT_ATTEMPT`}),E().then(function(e){var t=e instanceof Error;if(!t&&Object.keys(e).length===0){var n;try{if(n=fe(),n===void 0)return}catch(e){throw e}return Promise.resolve(n).then(function(e){return v.current&&C({type:`SUBMIT_SUCCESS`}),e}).catch(function(e){if(v.current)throw C({type:`SUBMIT_FAILURE`}),e})}else if(v.current&&(C({type:`SUBMIT_FAILURE`}),t))throw e})}),de=$(function(e){if(e&&e.preventDefault&&Z(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&Z(e.stopPropagation)&&e.stopPropagation(),process.env.NODE_ENV!==`production`&&typeof document<`u`){var t=ru();t!==null&&t instanceof HTMLButtonElement&&!(t.attributes&&t.attributes.getNamedItem(`type`))&&(process.env.NODE_ENV===`production`?Sl(!1):Sl(!1,'You submitted a Formik form using a button with an unspecified `type` attribute. Most browsers default button elements to `type="submit"`. If this is not a submit button, please add `type="button"`.'))}ue().catch(function(e){console.warn(`Warning: An unhandled error was caught from submitForm()`,e)})}),L={resetForm:D,validateForm:E,validateField:O,setErrors:M,setFieldError:P,setFieldTouched:F,setFieldValue:re,setStatus:ce,setSubmitting:le,setTouched:j,setValues:N,setFormikState:I,submitForm:ue},fe=$(function(){return d(S.values,L)}),pe=$(function(e){e&&e.preventDefault&&Z(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&Z(e.stopPropagation)&&e.stopPropagation(),D()}),me=(0,t.useCallback)(function(e){return{value:Q(S.values,e),error:Q(S.errors,e),touched:!!Q(S.touched,e),initialValue:Q(m.current,e),initialTouched:!!Q(g.current,e),initialError:Q(h.current,e)}},[S.errors,S.touched,S.values]),he=(0,t.useCallback)(function(e){return{setValue:function(t,n){return re(e,t,n)},setTouched:function(t,n){return F(e,t,n)},setError:function(t){return P(e,t)}}},[re,F,P]),ge=(0,t.useCallback)(function(e){var t=Ql(e),n=t?e.name:e,r=Q(S.values,n),i={name:n,value:r,onChange:ae,onBlur:se};if(t){var a=e.type,o=e.value,s=e.as,c=e.multiple;a===`checkbox`?o===void 0?i.checked=!!r:(i.checked=!!(Array.isArray(r)&&~r.indexOf(o)),i.value=o):a===`radio`?(i.checked=r===o,i.value=o):s===`select`&&c&&(i.value=i.value||[],i.multiple=!0)}return i},[se,ae,S.values]),_e=(0,t.useMemo)(function(){return!(0,bl.default)(m.current,S.values)},[m.current,S.values]),ve=(0,t.useMemo)(function(){return c===void 0||_e?S.errors&&Object.keys(S.errors).length===0:c!==!1&&Z(c)?c(p):c},[c,_e,S.errors,p]);return X({},S,{initialValues:m.current,initialErrors:h.current,initialTouched:g.current,initialStatus:_.current,handleBlur:se,handleChange:ae,handleReset:pe,handleSubmit:de,resetForm:D,setErrors:M,setFormikState:I,setFieldTouched:F,setFieldValue:re,setFieldError:P,setStatus:ce,setSubmitting:le,setTouched:j,setValues:N,submitForm:ue,validateForm:E,validateField:O,isValid:ve,dirty:_e,unregisterField:A,registerField:k,getFieldProps:ge,getFieldMeta:me,getFieldHelpers:he,validateOnBlur:a,validateOnChange:r,validateOnMount:s})}function uu(e){var t=e.htmlContent,n=e.documentationAnchorLink,r=e.handlerName;console.warn("Warning: Formik called `"+r+"`, but you forgot to pass an `id` or `name` attribute to your input:\n "+t+`
|
|
30
30
|
Formik cannot determine which value to update. For more info see https://formik.org/docs/api/formik#`+n+`
|
|
31
|
-
`)}function du(e){var t={};if(e.inner){if(e.inner.length===0)return iu(t,e.path,e.message);for(var n=e.inner,r=Array.isArray(n),i=0,n=r?n:n[Symbol.iterator]();;){var a;if(r){if(i>=n.length)break;a=n[i++]}else{if(i=n.next(),i.done)break;a=i.value}var o=a;Q(t,o.path)||(t=iu(t,o.path,o.message))}}return t}function fu(e,t,n,r){n===void 0&&(n=!1);var i=pu(e);return t[n?`validateSync`:`validate`](i,{abortEarly:!1,context:r||i})}function pu(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);Array.isArray(e[r])===!0?t[r]=e[r].map(function(e){return Array.isArray(e)===!0||Yi(e)?pu(e):e===``?void 0:e}):Yi(e[r])?t[r]=pu(e[r]):t[r]=e[r]===``?void 0:e[r]}return t}function mu(e,t,n){var r=e.slice();return t.forEach(function(t,i){r[i]===void 0?r[i]=n.clone!==!1&&n.isMergeableObject(t)?wi(Array.isArray(t)?[]:{},t,n):t:n.isMergeableObject(t)?r[i]=wi(e[i],t,n):e.indexOf(t)===-1&&r.push(t)}),r}function hu(e){return Array.from(e).filter(function(e){return e.selected}).map(function(e){return e.value})}function gu(e,t,n){if(typeof e==`boolean`)return!!t;var r=[],i=!1,a=-1;if(Array.isArray(e))r=e,a=e.indexOf(n),i=a>=0;else if(!n||n==`true`||n==`false`)return!!t;return t&&n&&!i?r.concat(n):i?r.slice(0,a).concat(r.slice(a+1)):r}var _u=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?t.useLayoutEffect:t.useEffect;function $(e){var n=(0,t.useRef)(e);return _u(function(){n.current=e}),(0,t.useCallback)(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current.apply(void 0,t)},[])}var vu=(0,t.forwardRef)(function(e,n){var r=e.action,i=ql(e,[`action`]),a=r??`#`,o=Xl(),s=o.handleReset,c=o.handleSubmit;return(0,t.createElement)(`form`,X({onSubmit:c,ref:n,onReset:s,action:a},i))});vu.displayName=`Form`;var yu=function(e,t,n){var r=Cu(e),i=r[t];return r.splice(t,1),r.splice(n,0,i),r},bu=function(e,t,n){var r=Cu(e),i=r[t];return r[t]=r[n],r[n]=i,r},xu=function(e,t,n){var r=Cu(e);return r.splice(t,0,n),r},Su=function(e,t,n){var r=Cu(e);return r[t]=n,r},Cu=function(e){if(!e)return[];if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,t){return t>e?t:e},0);return Array.from(X({},e,{length:t+1}))},wu=function(e,t){var n=typeof e==`function`?e:t;return function(e){return Array.isArray(e)||Ql(e)?n(Cu(e)):e}},Tu=function(e){Kl(n,e);function n(t){var n=e.call(this,t)||this;return n.updateArrayField=function(e,t,r){var i=n.props,a=i.name,o=i.formik.setFormikState;o(function(n){var i=wu(r,e),o=wu(t,e),s=iu(n.values,a,e(Q(n.values,a))),c=r?i(Q(n.errors,a)):void 0,l=t?o(Q(n.touched,a)):void 0;return Zl(c)&&(c=void 0),Zl(l)&&(l=void 0),X({},n,{values:s,errors:r?iu(n.errors,a,c):n.errors,touched:t?iu(n.touched,a,l):n.touched})})},n.push=function(e){return n.updateArrayField(function(t){return[].concat(Cu(t),[vl(e)])},!1,!1)},n.handlePush=function(e){return function(){return n.push(e)}},n.swap=function(e,t){return n.updateArrayField(function(n){return bu(n,e,t)},!0,!0)},n.handleSwap=function(e,t){return function(){return n.swap(e,t)}},n.move=function(e,t){return n.updateArrayField(function(n){return yu(n,e,t)},!0,!0)},n.handleMove=function(e,t){return function(){return n.move(e,t)}},n.insert=function(e,t){return n.updateArrayField(function(n){return xu(n,e,t)},function(t){return xu(t,e,null)},function(t){return xu(t,e,null)})},n.handleInsert=function(e,t){return function(){return n.insert(e,t)}},n.replace=function(e,t){return n.updateArrayField(function(n){return Su(n,e,t)},!1,!1)},n.handleReplace=function(e,t){return function(){return n.replace(e,t)}},n.unshift=function(e){var t=-1;return n.updateArrayField(function(n){var r=n?[e].concat(n):[e];return t=r.length,r},function(e){return e?[null].concat(e):[null]},function(e){return e?[null].concat(e):[null]}),t},n.handleUnshift=function(e){return function(){return n.unshift(e)}},n.handleRemove=function(e){return function(){return n.remove(e)}},n.handlePop=function(){return function(){return n.pop()}},n.remove=n.remove.bind(Jl(n)),n.pop=n.pop.bind(Jl(n)),n}var r=n.prototype;return r.componentDidUpdate=function(e){this.props.validateOnChange&&this.props.formik.validateOnChange&&!(0,bl.default)(Q(e.formik.values,e.name),Q(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},r.remove=function(e){var t;return this.updateArrayField(function(n){var r=n?Cu(n):[];return t||=r[e],Z(r.splice)&&r.splice(e,1),Z(r.every)&&r.every(function(e){return e===void 0})?[]:r},!0,!0),t},r.pop=function(){var e;return this.updateArrayField(function(t){var n=t.slice();return e||=n&&n.pop&&n.pop(),n},!0,!0),e},r.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},n=this.props,r=n.component,i=n.render,a=n.children,o=n.name,s=n.formik,c=ql(s,[`validate`,`validationSchema`]),l=X({},e,{form:c,name:o});return r?(0,t.createElement)(r,l):i?i(l):a?typeof a==`function`?a(l):tu(a)?null:t.Children.only(a):null},n}(t.Component);Tu.defaultProps={validateOnChange:!0};var Eu=e.g(((e,t)=>{t.exports=Array.isArray})),Du=e.g(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),Ou=e.g(((e,t)=>{var n=Du(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),ku=e.g(((e,t)=>{t.exports=Ou().Symbol})),Au=e.g(((e,t)=>{var n=ku(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),ju=e.g(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),Mu=e.g(((e,t)=>{var n=ku(),r=Au(),i=ju(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),Nu=e.g(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),Pu=e.g(((e,t)=>{var n=Mu(),r=Nu(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),Fu=e.g(((e,t)=>{var n=Eu(),r=Pu(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),Iu=e.g(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),Lu=e.g(((e,t)=>{var n=Mu(),r=Iu(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),Ru=e.g(((e,t)=>{t.exports=Ou()[`__core-js_shared__`]})),zu=e.g(((e,t)=>{var n=Ru(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),Bu=e.g(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),Vu=e.g(((e,t)=>{var n=Lu(),r=zu(),i=Iu(),a=Bu(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Hu=e.g(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),Uu=e.g(((e,t)=>{var n=Vu(),r=Hu();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),Wu=e.g(((e,t)=>{t.exports=Uu()(Object,`create`)})),Gu=e.g(((e,t)=>{var n=Wu();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Ku=e.g(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),qu=e.g(((e,t)=>{var n=Wu(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),Ju=e.g(((e,t)=>{var n=Wu(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),Yu=e.g(((e,t)=>{var n=Wu(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),Xu=e.g(((e,t)=>{var n=Gu(),r=Ku(),i=qu(),a=Ju(),o=Yu();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),Zu=e.g(((e,t)=>{function n(){this.__data__=[],this.size=0}t.exports=n})),Qu=e.g(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),$u=e.g(((e,t)=>{var n=Qu();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),ed=e.g(((e,t)=>{var n=$u(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),td=e.g(((e,t)=>{var n=$u();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),nd=e.g(((e,t)=>{var n=$u();function r(e){return n(this.__data__,e)>-1}t.exports=r})),rd=e.g(((e,t)=>{var n=$u();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),id=e.g(((e,t)=>{var n=Zu(),r=ed(),i=td(),a=nd(),o=rd();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),ad=e.g(((e,t)=>{t.exports=Uu()(Ou(),`Map`)})),od=e.g(((e,t)=>{var n=Xu(),r=id(),i=ad();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),sd=e.g(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),cd=e.g(((e,t)=>{var n=sd();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),ld=e.g(((e,t)=>{var n=cd();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),ud=e.g(((e,t)=>{var n=cd();function r(e){return n(this,e).get(e)}t.exports=r})),dd=e.g(((e,t)=>{var n=cd();function r(e){return n(this,e).has(e)}t.exports=r})),fd=e.g(((e,t)=>{var n=cd();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),pd=e.g(((e,t)=>{var n=od(),r=ld(),i=ud(),a=dd(),o=fd();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),md=e.g(((e,t)=>{var n=pd(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),hd=e.g(((e,t)=>{var n=md(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),gd=e.g(((e,t)=>{var n=hd(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),_d=e.g(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}t.exports=n})),vd=e.g(((e,t)=>{var n=ku(),r=_d(),i=Eu(),a=Pu(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),yd=e.g(((e,t)=>{var n=vd();function r(e){return e==null?``:n(e)}t.exports=r})),bd=e.g(((e,t)=>{var n=Eu(),r=Fu(),i=gd(),a=yd();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),xd=e.g(((e,t)=>{var n=Pu(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),Sd=e.g(((e,t)=>{var n=bd(),r=xd();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i<a;)e=e[r(t[i++])];return i&&i==a?e:void 0}t.exports=i})),Cd=e.g(((e,t)=>{var n=Sd();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),wd=e._(Cd(),1),Td=(e=16)=>{let t={upper:`ABCDEFGHIJKLMNOPQRSTUVWXYZ`,lower:`abcdefghijklmnopqrstuvwxyz`,numbers:`0123456789`,symbols:`!@%^&*()_+[]{}|;:,.<>?`},n=t.upper+t.lower+t.numbers+t.symbols,r=e=>e[crypto.getRandomValues(new Uint32Array(1))[0]%e.length],i=[r(t.upper),r(t.lower),r(t.numbers),r(t.symbols)];for(let t=4;t<e;t++)i.push(r(n));for(let e=i.length-1;e>0;e--){let t=crypto.getRandomValues(new Uint32Array(1))[0]%(e+1),n=i[e];i[e]=i[t],i[t]=n}return i.join(``)},Ed=({showPassword:e,onToggleVisibility:t,onGenerate:n})=>(0,i.jsxs)(r.InputAdornment,{position:`end`,children:[n&&(0,i.jsx)(r.Tooltip,{title:`Generate Password`,children:(0,i.jsx)(r.IconButton,{onClick:n,edge:`end`,size:`small`,sx:{opacity:.7},"aria-label":`generate password`,children:(0,i.jsx)(qr,{})})}),(0,i.jsx)(r.Tooltip,{title:e?`Hide password`:`Show password`,children:(0,i.jsx)(r.IconButton,{onClick:t,edge:`end`,size:`small`,sx:{opacity:.7},"aria-label":e?`hide password`:`show password`,children:e?(0,i.jsx)(li,{}):(0,i.jsx)(ci,{})})})]}),Dd=({type:e,autoGenerate:t=!1,formik:r,name:i})=>{let[a,o]=(0,n.useState)(!1),s={},c=a?`text`:`password`;return e===`password`?(s.endAdornment=Ed({showPassword:a,onToggleVisibility:()=>{o(!a)},onGenerate:t?()=>{if(!r||!i)return;let e=Td();r.setFieldValue(i,e),a||o(!0)}:void 0}),{inputType:c,inputProps:s}):{inputType:e,inputProps:s}},Od=({helperText:e,errorText:t,formik:a,name:o,defaultValue:s,onChange:c,type:l,fullWidth:u=!0,autoGenerate:d=!1,...f})=>{let p=Dd({type:l,autoGenerate:d,formik:a,name:o}),m={},h=f.value??s;if((0,n.useEffect)(()=>{!a||!o||h===void 0||a.setFieldValue(o,h)},[h]),o&&a){a.touched[o]&&(t??=a.errors[o]);let e=(0,wd.default)(a.values,o,``);l===`date`&&(e=kd(e)),m={value:e??``,onBlur:()=>a.setFieldTouched(o),onChange:e=>{let t=e.target.value;l===`date`&&t&&(t=new Date(t)),a.setFieldValue(o,t||null),c?.(e)},slotProps:{...f.slotProps,input:{...f.InputProps,...f.slotProps?.input,...p.inputProps},inputLabel:l===`date`?{shrink:!0}:void 0}}}return(0,i.jsx)(r.TextField,{variant:`standard`,onChange:c,...f,...m,name:o,type:p.inputType,fullWidth:u,helperText:t||e,error:!!t})},kd=e=>{if(!e)return``;let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`},Ad=({multiple:t=!1,formik:a,name:o,label:s=`Search users`,disabled:c=!1,error:l,helperText:u,value:d,onChange:f})=>{let[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)([]),[_,v]=(0,n.useState)(!1),[y,b]=(0,n.useState)(``),x=(0,n.useCallback)(async t=>{if(t.length<2){g([]);return}v(!0);try{g(await e.a().searchUsers({name:t}))}catch(e){console.error(`Failed to search users:`,e),g([])}finally{v(!1)}},[]),S=(0,n.useCallback)((e,t)=>{b(t),x(t)},[x]),C=()=>d===void 0?a&&o?a.values[o]:t?[]:null:d,w=(e,t)=>{f?f(t):a&&o&&a.setFieldValue(o,t)},T=()=>{a&&o&&a.setFieldTouched(o)},ee=()=>{if(l)return` `;if(a&&o&&a.touched[o]&&a.errors[o])return a.errors[o]};return(0,i.jsx)(r.Autocomplete,{open:p,onOpen:()=>m(!0),onClose:()=>m(!1),multiple:t,options:h,value:C(),onChange:w,onBlur:T,onInputChange:S,getOptionLabel:e=>e.name,isOptionEqualToValue:(e,t)=>e.id===t.id,loading:_,noOptionsText:y.length<3?`Type at least 3 characters to search`:`No users found`,renderOption:(e,t)=>(0,n.createElement)(r.Box,{component:`li`,...e,key:t.id},(0,i.jsxs)(r.Box,{children:[(0,i.jsx)(r.Typography,{variant:`body1`,children:t.name}),(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:t.email})]})),renderInput:e=>(0,i.jsx)(r.TextField,{...e,label:s,disabled:c,variant:`standard`,error:!!ee(),helperText:ee()||u,InputProps:{...e.InputProps,endAdornment:(0,i.jsxs)(i.Fragment,{children:[_?(0,i.jsx)(r.CircularProgress,{size:20}):null,e.InputProps.endAdornment]})}})})},jd=e.m({name:e.h().trim().required(`Group name is required`).min(2,`Group name must be at least 2 characters`).max(100,`Group name must be at most 100 characters`)}),Md=({open:t,onClose:a,onSuccess:s,orgId:c})=>{let[l,u]=(0,n.useState)(null),d=lu({initialValues:{name:``,read_only:!1,members:[]},validationSchema:jd,onSubmit:async(t,{setSubmitting:n,resetForm:r})=>{u(null);try{let n=e.a(),i=await n.createGroup(c,{name:t.name.trim(),read_only:t.read_only});t.members&&t.members.length>0&&await n.addGroupMembers(c,i.id,t.members.map(e=>({user:e.userId,role:e.role}))),r(),s?.(),a()}catch(e){u(o(e,`Failed to create group`))}n(!1)}}),f=e=>{let t=Array.isArray(e)?e:[];d.setFieldValue(`members`,t.map(e=>({userId:e.id,role:`member`,user:e})))},p=(e,t)=>{let n=d.values.members.map(n=>n.userId===e?{...n,role:t}:n);d.setFieldValue(`members`,n)},m=e=>{let t=d.values.members.filter(t=>t.userId!==e);d.setFieldValue(`members`,t)},h=()=>{d.resetForm(),a()};return(0,i.jsxs)(r.Dialog,{open:t,onClose:h,maxWidth:`sm`,fullWidth:!0,PaperProps:{component:`form`,onSubmit:d.handleSubmit},children:[(0,i.jsx)(r.DialogTitle,{children:`Create New Group`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,gap:2,pt:1},children:[l&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>u(null),children:l.message}),(0,i.jsx)(Od,{label:`Group Name`,name:`name`,formik:d,required:!0,disabled:d.isSubmitting,placeholder:`e.g., Computer Science 101`}),(0,i.jsx)(r.FormControlLabel,{control:(0,i.jsx)(r.Switch,{name:`read_only`,checked:d.values.read_only,onChange:d.handleChange,disabled:d.isSubmitting}),label:`Read-only group (only moderators can post)`}),(0,i.jsx)(r.Divider,{sx:{my:2}}),(0,i.jsxs)(r.Box,{children:[(0,i.jsx)(r.Typography,{variant:`subtitle2`,gutterBottom:!0,children:`Add Members`}),(0,i.jsx)(Ad,{multiple:!0,label:`Search users to add`,value:d.values.members.map(e=>e.user),onChange:f,disabled:d.isSubmitting})]}),d.values.members.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Typography,{variant:`subtitle2`,gutterBottom:!0,children:`Selected Members`}),d.values.members.map(e=>(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,borderRadius:1},children:[(0,i.jsx)(r.Box,{sx:{flex:1},children:e.user.name}),(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>p(e.userId,t.target.value),size:`small`,disabled:d.isSubmitting,sx:{mr:2},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,onClick:()=>m(e.userId),disabled:d.isSubmitting,color:`error`,children:(0,i.jsx)(Jr,{})})]},e.userId))]})]})}),(0,i.jsxs)(r.DialogActions,{sx:{p:3},children:[(0,i.jsx)(r.Button,{onClick:h,disabled:d.isSubmitting,children:`Cancel`}),(0,i.jsx)(r.Button,{type:`submit`,variant:`contained`,disabled:d.isSubmitting||!d.isValid,startIcon:d.isSubmitting&&(0,i.jsx)(r.CircularProgress,{size:16}),children:`Create Group`})]})]})},Nd=async t=>{let n=await e.a().getGroups(t);return await e.d.groups.clear(),await e.d.groups.bulkPut(n),n},Pd=async(t,n,r)=>{let i=await e.a().updateGroup(t,n,{name:r});return await e.d.groups.update(n,{name:i.name}),i},Fd=async(t,n)=>{await e.a().deleteGroup(t,n),await e.d.groups.delete(n),await e.d.summaries.filter(e=>e.group===n).delete()};function Id(e,t,r){let i,a;typeof e==`function`?(i=t||[],a=r):(i=[],a=t);let o=n.default.useRef({hasResult:!1,result:a,error:null}),[s,c]=n.default.useReducer(e=>e+1,0),l=n.default.useMemo(()=>{let t=typeof e==`function`?e():e;if(!t||typeof t.subscribe!=`function`)throw TypeError(e===t?`Given argument to useObservable() was neither a valid observable nor a function.`:`Observable factory given to useObservable() did not return a valid observable.`);if(!o.current.hasResult&&typeof window<`u`&&(typeof t.hasValue!=`function`||t.hasValue()))if(typeof t.getValue==`function`)o.current.result=t.getValue(),o.current.hasResult=!0;else{let e=t.subscribe(e=>{o.current.result=e,o.current.hasResult=!0});typeof e==`function`?e():e.unsubscribe()}return t},i);if(n.default.useDebugValue(o.current.result),n.default.useEffect(()=>{let e=l.subscribe(e=>{let{current:t}=o;(t.error!==null||t.result!==e)&&(t.error=null,t.result=e,t.hasResult=!0,c())},e=>{let{current:t}=o;t.error!==e&&(t.error=e,c())});return typeof e==`function`?e:e.unsubscribe.bind(e)},i),o.current.error)throw o.current.error;return o.current.result}function Ld(t,n,r){return Id(()=>e.f.liveQuery(t),n||[],r)}typeof FinalizationRegistry<`u`&&new FinalizationRegistry(t=>{let n=e.f.DexieYProvider;n&&n.release(t)}),Reflect.get(n,`use`);var Rd=({selectedConversation:t,currentUser:a,onConversationSelect:o})=>{let[s,c]=(0,n.useState)(!0),[l,u]=(0,n.useState)(),[d,f]=(0,n.useState)(!1),p=Ld(()=>e.d.summaries.toArray(),[t])||[],m=Ld(()=>e.d.groups.toArray(),[])||[],h=a?.role===`admin`||a?.role===`system`,g=(0,n.useCallback)(async()=>{c(!0),a?.org&&(await Promise.all([e.t({}),Nd(a?.org)]).catch(e=>{u(e instanceof Error?e:Error(String(e)))}),c(!1))},[a?.org]);(0,n.useEffect)(()=>{g();let e=setInterval(g,3*6e4);return()=>clearInterval(e)},[g]);let[_,v]=(0,n.useState)({});(0,n.useEffect)(()=>{p.length>0&&a?.org&&(async()=>{if(!a?.org)return;let t=e.a(),n={};for(let e of p)try{if(e.user!==void 0&&!_[e.user]){let r=await t.getUser(e.user);n[e.user]=r.name}}catch(e){console.error(`Failed to load conversation name:`,e)}Object.keys(n).length>0&&v(e=>({...e,...n}))})()},[p,a?.org]);let y=e=>e.user===void 0?e.group===void 0?`Unknown`:m.find(t=>t.id===e.group)?.name||`Group ${e.group}`:_[e.user]||`User ${e.user}`,b=e=>t?e.group===void 0?e.user===void 0?!1:t.type===`dm`&&t.id===e.user:t.type===`group`&&t.id===e.group:!1,x=e=>{e.group===void 0?e.user!==void 0&&o({type:`dm`,id:e.user,name:y(e)}):o({type:`group`,id:e.group,name:y(e)})};return(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,height:`100%`,children:[(0,i.jsx)(r.AppBar,{position:`static`,elevation:0,sx:{backgroundColor:`background.default`,color:`text.primary`},children:(0,i.jsxs)(r.Toolbar,{children:[(0,i.jsx)(r.Typography,{variant:`h6`,component:`div`,sx:{flexGrow:1},children:`Messages`}),h&&(0,i.jsx)(r.Tooltip,{title:`Create Group`,children:(0,i.jsx)(r.IconButton,{color:`primary`,onClick:()=>f(!0),size:`small`,sx:{mr:-2},children:(0,i.jsx)(Wr,{})})})]})}),h&&a?.org&&(0,i.jsx)(Md,{open:d,onClose:()=>f(!1),onSuccess:async()=>{await g()},orgId:a.org}),(0,i.jsx)(r.Box,{flex:1,overflow:`auto`,children:s&&!p.length?(0,i.jsx)(r.List,{disablePadding:!0,children:[1,2,3,4,5].map(e=>(0,i.jsx)(pi,{},e))}):l?(0,i.jsx)(r.Box,{p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,children:[`Failed to load conversations: `,l.message]})}):p.length===0&&m.length===0?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,p:2,children:(0,i.jsx)(r.Typography,{color:`text.secondary`,align:`center`,children:`No conversations yet`})}):(0,i.jsx)(r.List,{disablePadding:!0,children:(()=>{let e=new Set(p.filter(e=>e.group!==void 0).map(e=>e.group)),t=m.filter(t=>!e.has(t.id)).map(e=>({group:e.id,last_message_at:e.created_at,message_count:0,unread_count:0}));return[...[...p].sort((e,t)=>new Date(t.last_message_at).getTime()-new Date(e.last_message_at).getTime()),...t].map(e=>(0,i.jsx)(fi,{conversation:e,displayName:y(e),selected:b(e),onClick:()=>x(e),currentUser:a},e.group===void 0?`user-${e.user}`:`group-${e.group}`))})()})})]})},zd=({displayName:e,type:t,subtitle:a,isConnected:o=!0,onBack:s,showJoinButton:c=!1,onJoin:l,joining:u=!1,showMembersButton:d=!1,onManageMembers:f,canManageGroup:p=!1,onRenameGroup:m,onDeleteGroup:h,deletingGroup:g=!1})=>{let _=t===`group`,[v,y]=(0,n.useState)(null),[b,x]=(0,n.useState)(null),S=e=>{y(e.currentTarget)},C=()=>{y(null)},w=e=>{l(e),C()};return(0,i.jsx)(r.AppBar,{position:`static`,elevation:0,sx:{backgroundColor:`background.default`,color:`text.primary`},children:(0,i.jsxs)(r.Toolbar,{children:[s&&(0,i.jsx)(r.IconButton,{edge:`start`,color:`inherit`,onClick:s,sx:{mr:2,display:{xs:`flex`,sm:`flex`,md:`none`}},children:(0,i.jsx)(Gr,{})}),(0,i.jsx)(r.Avatar,{sx:{bgcolor:_?`primary.main`:`secondary.main`,mr:2},children:_?(0,i.jsx)(ei,{}):(0,i.jsx)(ri,{})}),(0,i.jsxs)(r.Box,{flex:1,children:[(0,i.jsx)(r.Typography,{variant:`h6`,component:`div`,noWrap:!0,children:e}),a&&(0,i.jsx)(r.Typography,{variant:`caption`,color:`inherit`,sx:{opacity:.7},children:a})]}),d&&_&&(0,i.jsx)(r.IconButton,{color:`inherit`,onClick:f,title:`Members`,sx:{mr:.5},children:(0,i.jsx)(ni,{})}),p&&_&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.IconButton,{color:`inherit`,onClick:e=>x(e.currentTarget),disabled:g,title:`Manage group`,children:(0,i.jsx)(ti,{})}),(0,i.jsxs)(r.Menu,{anchorEl:b,open:!!b,onClose:()=>x(null),children:[(0,i.jsxs)(r.MenuItem,{onClick:()=>{x(null),m?.()},children:[(0,i.jsx)(Qr,{fontSize:`small`,sx:{mr:1}}),`Rename Group`]}),(0,i.jsxs)(r.MenuItem,{onClick:()=>{x(null),h?.()},sx:{color:`error.main`},children:[(0,i.jsx)(Xr,{fontSize:`small`,sx:{mr:1}}),`Delete Group`]})]})]}),c&&_&&(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,mr:1},children:[(0,i.jsx)(r.Button,{variant:`contained`,color:`primary`,startIcon:(0,i.jsx)(ii,{}),endIcon:(0,i.jsx)(Kr,{}),onClick:S,disabled:u,children:u?`Joining...`:`Join`}),(0,i.jsxs)(r.Menu,{anchorEl:v,open:!!v,onClose:C,children:[(0,i.jsx)(r.MenuItem,{onClick:()=>w(`member`),children:`Member`}),(0,i.jsx)(r.MenuItem,{onClick:()=>w(`moderator`),children:`Moderator`})]})]}),!o&&(0,i.jsx)(r.Chip,{icon:(0,i.jsx)(ui,{}),label:`Disconnected`,size:`small`,color:`warning`,sx:{ml:1}})]})})},Bd=({member:e,currentUserId:t,canManage:n,removing:a,updating:o,onRemove:s,onRoleChange:c})=>(0,i.jsxs)(r.ListItem,{secondaryAction:n?(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>c(e.id,t.target.value),size:`small`,disabled:o||a,variant:`standard`,disableUnderline:!0,sx:{fontSize:12},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,color:`error`,onClick:()=>s(e.id),disabled:a||o,children:a?(0,i.jsx)(r.CircularProgress,{size:16}):(0,i.jsx)(Yr,{fontSize:`small`})})]}):void 0,children:[(0,i.jsx)(r.Avatar,{sx:{mr:1.5,width:32,height:32,bgcolor:`primary.main`},children:(0,i.jsx)(ri,{fontSize:`small`})}),(0,i.jsx)(r.ListItemText,{primary:(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,i.jsx)(r.Typography,{variant:`body1`,noWrap:!0,children:e.name}),e.id===t&&(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,children:`(you)`})]})})]}),Vd=({open:t,onClose:a,orgId:s,groupId:c,existingMemberIds:l,onSuccess:u})=>{let[d,f]=(0,n.useState)([]),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(null),_=()=>{f([]),g(null),a()},v=e=>{f((Array.isArray(e)?e:[]).filter(e=>!l.has(e.id)).map(e=>({id:e.id,role:`member`,user:e})))},y=(e,t)=>{f(n=>n.map(n=>n.id===e?{...n,role:t}:n))},b=e=>{f(t=>t.filter(t=>t.id!==e))};return(0,i.jsxs)(r.Dialog,{open:t,onClose:_,maxWidth:`xs`,fullWidth:!0,children:[(0,i.jsx)(r.DialogTitle,{children:`Add Members`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,gap:2,pt:1},children:[h&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>g(null),children:h.message}),(0,i.jsx)(Ad,{multiple:!0,label:`Search users to add`,value:d.map(e=>e.user),onChange:v,disabled:p}),d.map(e=>(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,i.jsx)(r.Typography,{variant:`body2`,noWrap:!0,sx:{flex:1,mr:1},children:e.user.name}),(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>y(e.id,t.target.value),size:`small`,disabled:p,sx:{mr:1},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,color:`error`,onClick:()=>b(e.id),disabled:p,children:(0,i.jsx)(Jr,{fontSize:`small`})})]},e.id))]})}),(0,i.jsxs)(r.DialogActions,{sx:{p:2},children:[(0,i.jsx)(r.Button,{onClick:_,disabled:p,children:`Cancel`}),(0,i.jsx)(r.Button,{variant:`contained`,onClick:async()=>{if(d.length!==0){m(!0),g(null);try{await e.a().addGroupMembers(s,c,d.map(e=>({user:e.id,role:e.role}))),_(),u()}catch(e){g(o(e,`Failed to add members`))}finally{m(!1)}}},disabled:p||d.length===0,startIcon:p&&(0,i.jsx)(r.CircularProgress,{size:16}),children:p?`Adding...`:`Add${d.length>0?` ${d.length}`:``}`})]})]})},Hd=({open:t,onClose:a,orgId:s,groupId:c,currentUserId:l,canManage:u})=>{let[d,f]=(0,n.useState)([]),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(null),[_,v]=(0,n.useState)(null),[y,b]=(0,n.useState)(null),[x,S]=(0,n.useState)(!1),C=(0,n.useCallback)(async()=>{m(!0),g(null);try{f(await e.a().getGroupMembers(s,c))}catch(e){g(o(e,`Failed to load members`))}finally{m(!1)}},[s,c]);(0,n.useEffect)(()=>{t&&C()},[t,C]);let w=async t=>{v(t);try{await e.a().removeGroupMember(s,c,t),f(e=>e.filter(e=>e.id!==t))}catch(e){g(o(e,`Failed to remove member`))}finally{v(null)}},T=async(t,n)=>{b(t);try{await e.a().addGroupMembers(s,c,[{user:t,role:n}]),f(e=>e.map(e=>e.id===t?{...e,role:n}:e))}catch(e){g(o(e,`Failed to update role`))}finally{b(null)}};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.Drawer,{anchor:`right`,open:t,onClose:a,slotProps:{paper:{sx:{width:360,maxWidth:`100vw`}}},children:[(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,px:2,py:1.5},children:[(0,i.jsx)(r.Typography,{variant:`h6`,children:`Members`}),(0,i.jsx)(r.IconButton,{size:`small`,onClick:a,children:(0,i.jsx)(Jr,{})})]}),(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,overflow:`hidden`,flex:1},children:[h&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>g(null),sx:{m:2},children:h.message}),(0,i.jsx)(r.Box,{sx:{overflow:`auto`,flex:1},children:p?(0,i.jsx)(r.Box,{sx:{display:`flex`,justifyContent:`center`,mt:4},children:(0,i.jsx)(r.CircularProgress,{size:32})}):(0,i.jsxs)(r.List,{disablePadding:!0,children:[d.map(e=>(0,i.jsx)(Bd,{member:e,currentUserId:l,canManage:u,removing:_===e.id,updating:y===e.id,onRemove:w,onRoleChange:T},e.id)),d.length===0&&(0,i.jsx)(r.Box,{sx:{p:3,textAlign:`center`},children:(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:`No members yet`})})]})}),u&&(0,i.jsx)(r.Box,{sx:{p:2,borderTop:1,borderColor:`divider`},children:(0,i.jsx)(r.Button,{variant:`outlined`,color:`secondary`,fullWidth:!0,onClick:()=>S(!0),children:`Add Members`})})]})]}),(0,i.jsx)(Vd,{open:x,onClose:()=>S(!1),orgId:s,groupId:c,existingMemberIds:new Set(d.map(e=>e.id)),onSuccess:C})]})};function Ud(e){return(typeof e==`string`?new Date(e):e).toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`,hour12:!0})}var Wd=n.default.memo(({message:t,isOwnMessage:n,senderName:a,showSenderName:o=!0,isFirstInGroup:s=!0,isLastInGroup:c=!0,status:l=`sent`})=>{let u=t.id.startsWith(`temp-`),d=()=>{if(!n||!c)return null;let e={fontSize:14,ml:.5,opacity:.7,verticalAlign:`middle`};return l===`failed`?(0,i.jsx)($r,{sx:{...e,color:`error.main`}}):l===`sending`||u?(0,i.jsx)(oi,{sx:e}):(0,i.jsx)(Zr,{sx:e})},f=(0,i.jsx)(r.Avatar,{sx:{width:32,height:32,fontSize:`0.875rem`,color:n?`primary.contrastText`:`secondary.contrastText`,bgcolor:n?`primary.main`:`secondary.main`,visibility:c?`visible`:`hidden`},children:e.l(a)});return(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:n?`flex-end`:`flex-start`,alignItems:`flex-end`,mb:c?1:.25,gap:1,children:[!n&&f,(0,i.jsxs)(r.Paper,{elevation:1,sx:{maxWidth:`80%`,p:1.5,backgroundColor:n?`primary.main`:`background.paper`,color:n?`primary.contrastText`:`text.primary`,borderTopLeftRadius:n||!s?void 0:4,borderTopRightRadius:!n||!s?void 0:4,borderBottomLeftRadius:n||!c?void 0:4,borderBottomRightRadius:!n||!c?void 0:4},children:[!n&&o&&s&&(0,i.jsx)(r.Typography,{variant:`caption`,fontWeight:`bold`,display:`block`,mb:.5,children:a||`User ${t.sender}`}),(0,i.jsx)(r.Typography,{variant:`body1`,sx:{whiteSpace:`pre-wrap`},children:t.content}),c&&(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:`flex-end`,alignItems:`center`,mt:.5,children:[(0,i.jsx)(r.Typography,{variant:`caption`,color:n?`inherit`:`text.secondary`,sx:{opacity:.7},children:Ud(new Date(t.created_at))}),(0,i.jsx)(d,{})]})]}),n&&f]})}),Gd=({isOwnMessage:e=!1})=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:e?`flex-end`:`flex-start`,mb:1,children:(0,i.jsxs)(r.Box,{maxWidth:`70%`,children:[!e&&(0,i.jsx)(r.Skeleton,{variant:`text`,width:80,sx:{mb:.5}}),(0,i.jsx)(r.Skeleton,{variant:`rounded`,width:Math.random()*200+150,height:60,sx:{borderRadius:2,bgcolor:e?`primary.light`:`background.main`}})]})}),Kd=({hasMore:e,loading:t,onLoadMore:a,threshold:o=1,rootMargin:s=`100px`})=>{let c=(0,n.useRef)(null),l=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!e||t)return;let n=c.current;if(n)return l.current=new IntersectionObserver(n=>{let[r]=n;r&&r.isIntersecting&&e&&!t&&a()},{threshold:o,rootMargin:s}),l.current.observe(n),()=>{l.current&&n&&(l.current.unobserve(n),l.current.disconnect())}},[e,t,a,o,s]),e?(0,i.jsx)(r.Box,{ref:c,display:`flex`,justifyContent:`center`,alignItems:`center`,py:2,children:t?(0,i.jsx)(r.CircularProgress,{size:24}):(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,children:`Scroll to load more`})}):null},qd=(e,t,r)=>{(0,n.useEffect)(()=>((async()=>{await e()})(),r),t)};function Jd(e){let t=e.map(e=>Number(e.sender));return new Set(t)}function Yd(t){let r=e.a(),[i,a]=(0,n.useState)(()=>new Map),o=(0,n.useCallback)(async()=>{if(!t.length)return i;try{let n=Jd(t),a=Array.from(n);if(console.log(`[names] size:`,n.size),!n.size)return i;let o=(await e.d.users.bulkGet(a)).filter(e=>!!e),s=new Map;if(o.forEach(e=>{s.set(e.id,e.name)}),n.size===o.length)return s;let c=a.filter(e=>!s.has(e)),l=await r.getUsers(c,{fields:[`id`,`name`]});await e.d.users.bulkPut(l);let u=s;return l.forEach(e=>u.set(e.id,e.name)),u}catch(e){console.error(`[useSenderNames] Failed to fetch users:`,e)}return i},[t,i]);return qd(async()=>{a(await o())},[t]),i}var Xd=({messages:t,currentUserId:a,loading:o=!1,error:s=null,autoScroll:c=!0,hasMore:l=!1,loadingMore:u=!1,onLoadMore:d})=>{let f=(0,n.useRef)(null),p=(0,n.useRef)(null),m=(0,n.useRef)(0),h=(0,n.useRef)(!0),[g,_]=(0,n.useState)(c),v=Yd(t),y=()=>{if(!p.current)return!1;let{scrollTop:e,scrollHeight:t,clientHeight:n}=p.current;return t-e-n<100};return(0,n.useEffect)(()=>{t.length>0&&f.current&&(f.current.scrollIntoView({behavior:`auto`}),h.current=!0)},[]),(0,n.useEffect)(()=>{!u||!t.length||(p.current&&(m.current=p.current.scrollHeight),_(!1))},[u]),(0,n.useLayoutEffect)(()=>{if(t.length){if(g&&f.current&&h.current)f.current.scrollIntoView({behavior:`smooth`});else if(!g&&p.current&&m.current>0){let e=p.current.scrollHeight-m.current;p.current.scrollTop=p.current.scrollTop+e,m.current=0,_(!0)}}},[t.length,c]),o&&!t.length?(0,i.jsx)(r.Box,{flex:1,overflow:`auto`,p:2,children:[1,2,3,4,5].map(e=>(0,i.jsx)(Gd,{isOwnMessage:e%3==0},e))}):s&&!t.length?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,flex:1,p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,children:[(0,i.jsx)(`strong`,{children:`Failed to load messages`}),(0,i.jsx)(`br`,{}),s.message]})}):t.length===0?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,flex:1,children:(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:`No messages yet. Start the conversation!`})}):(0,i.jsxs)(r.Box,{ref:p,flex:1,overflow:`auto`,p:2,display:`flex`,flexDirection:`column`,onScroll:()=>{h.current=y()},children:[l&&d&&(0,i.jsx)(Kd,{hasMore:l,loading:u,onLoadMore:d}),t.map((n,r)=>{let o=n.sender,s=n.sender===a,c=v.get(o),l=r>0?t[r-1]:null,u=r<t.length-1?t[r+1]:null,d=!l||!e.u(l,n);return(0,i.jsx)(Wd,{message:n,isOwnMessage:s,senderName:c,showSenderName:d,isFirstInGroup:d,isLastInGroup:!u||!e.u(n,u)},n.id)}),(0,i.jsx)(`div`,{ref:f})]})},Zd=({onSend:e,sending:t=!1,placeholder:a=`Type a message...`,disabled:o=!1,disableReason:s})=>{let[c,l]=(0,n.useState)(``),u=(0,n.useRef)(null),d=()=>{let n=c.trim();n&&!t&&!o&&(e(n),l(``),setTimeout(()=>{u.current?.querySelector(`textarea`)?.focus()},300))};return(0,i.jsxs)(r.Box,{display:`flex`,gap:1,p:2,borderTop:1,borderColor:`divider`,children:[(0,i.jsx)(r.TextField,{ref:u,fullWidth:!0,multiline:!0,maxRows:4,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),d())},placeholder:o&&s?s:a,disabled:o||t,variant:`outlined`,size:`small`}),(0,i.jsx)(r.IconButton,{color:`primary`,onClick:d,disabled:!c.trim()||t||o,size:`large`,children:t?(0,i.jsx)(r.CircularProgress,{size:24}):(0,i.jsx)(si,{})})]})};function Qd({conversation:t,limit:r=50}){let i=e.p(t),[a,o]=(0,n.useState)(!1),[s,c]=(0,n.useState)(!1),[l,u]=(0,n.useState)(),d=Ld(()=>e.d.messages.where(`conversationId`).equals(i).sortBy(`created_at`),[i])||[],f=Ld(()=>e.d.msgCursor.where(`id`).equals(i).first(),[i]);return qd(async()=>{let n={limit:r};d.length&&(n.cursorType=`after`,n.cursorDatetime=d[d.length-1]?.created_at),o(!0),await e.c(t,n).catch(u),o(!1),await e.d.summaries.update(i,{unread_count:0})},[t,r]),console.log(`mw`,d.length),{messages:d,cursor:f,loading:a,error:l,loadMore:(0,n.useCallback)(async()=>{if(!(!f||s||a)){c(!0);try{let n={limit:r};if(!f?.datetime)return;n.cursorType=`before`,n.cursorDatetime=f.datetime,await e.c(t,n)}catch(e){console.error(`[useMessages] Failed to load more:`,e)}c(!1)}},[f,r,t,s,a]),loadingMore:s}}var $d=({conversation:t,user:a,isConnected:s,onBack:c})=>{let l=e.a(),{messages:u,cursor:d,loading:f,error:p,loadMore:m,loadingMore:h}=Qd({conversation:t}),g=Ld(async()=>t.type===`group`?await e.d.groups.get(t.id):null,[t.id,t.type]),_=a?.role===`admin`,v=a?.role===`moderator`,y=g?.is_member??!0,b=g?.system??!1,x=_&&t.type===`group`&&!y,S=t.type===`group`&&!y,C=t.type===`group`&&(_||y),w=t.type===`group`&&!b&&(_||v&&y),T=_&&t.type===`group`&&!b,[ee,te]=(0,n.useState)(!1),[ne,E]=(0,n.useState)(!1),[D,O]=(0,n.useState)(``),[k,A]=(0,n.useState)(!1),[j,M]=(0,n.useState)(null),N=()=>{O(t.name||``),M(null),E(!0)},P=async()=>{if(D.trim()){A(!0),M(null);try{await Pd(a.org,t.id,D.trim()),E(!1)}catch(e){M(o(e,`Failed to rename group`))}finally{A(!1)}}},[re,ie]=(0,n.useState)(!1),[ae,F]=(0,n.useState)(!1),[oe,se]=(0,n.useState)(null),I=async()=>{ie(!1),F(!0),se(null);try{await Fd(a.org,t.id)}catch(e){se(o(e,`Failed to delete group`)),F(!1)}},[ce,le]=(0,n.useState)(!1),[ue,de]=(0,n.useState)(!1),L=async n=>{if(t.type===`group`){le(!0);try{await l.joinGroup(a.org,t.id,n),de(!0),await Nd(a.org),await e.t({}),setTimeout(()=>de(!1),3e3)}catch(e){he(o(e,`Failed to join group`))}le(!1)}},[fe,pe]=(0,n.useState)(!1),[me,he]=(0,n.useState)(null),[ge,_e]=(0,n.useState)(!1);return(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,height:`100%`,children:[(0,i.jsx)(zd,{displayName:t.name||`Chat`,type:t.type,isConnected:s,onBack:c,showJoinButton:x,onJoin:L,joining:ce,showMembersButton:C,onManageMembers:()=>te(!0),canManageGroup:T,onRenameGroup:N,onDeleteGroup:()=>ie(!0),deletingGroup:ae}),C&&(0,i.jsx)(Hd,{open:ee,onClose:()=>te(!1),orgId:a.org,groupId:t.id,currentUserId:a.id,canManage:w}),(0,i.jsxs)(r.Dialog,{open:ne,onClose:()=>E(!1),fullWidth:!0,maxWidth:`xs`,children:[(0,i.jsx)(r.DialogTitle,{children:`Rename Group`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsx)(r.TextField,{autoFocus:!0,fullWidth:!0,label:`Group name`,value:D,onChange:e=>O(e.target.value),onKeyDown:e=>e.key===`Enter`&&P(),error:!!j,helperText:j?.message,sx:{mt:1}})}),(0,i.jsxs)(r.DialogActions,{children:[(0,i.jsx)(r.Button,{onClick:()=>E(!1),children:`Cancel`}),(0,i.jsx)(r.Button,{onClick:P,disabled:k||!D.trim(),variant:`contained`,children:k?`Renaming...`:`Rename`})]})]}),(0,i.jsxs)(r.Dialog,{open:re,onClose:()=>ie(!1),maxWidth:`xs`,fullWidth:!0,children:[(0,i.jsx)(r.DialogTitle,{children:`Delete Group`}),(0,i.jsx)(r.DialogContent,{children:`Are you sure you want to delete this group? This action cannot be undone.`}),(0,i.jsxs)(r.DialogActions,{children:[(0,i.jsx)(r.Button,{onClick:()=>ie(!1),children:`Cancel`}),(0,i.jsx)(r.Button,{onClick:I,disabled:ae,color:`error`,variant:`contained`,children:ae?`Deleting...`:`Delete`})]})]}),oe&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>se(null),children:oe.message}),(0,i.jsx)(r.Snackbar,{open:ue,autoHideDuration:3e3,onClose:()=>de(!1),message:`Successfully joined group`}),me&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>he(null),children:me.message}),(0,i.jsx)(Xd,{messages:u,currentUserId:a?.id||0,loading:f,error:p,autoScroll:!0,hasMore:!!d?.datetime,loadingMore:h,onLoadMore:m,forceScrollToBottom:ge}),S?(0,i.jsx)(r.Alert,{severity:`warning`,sx:{m:2},children:`You must be a group member to send messages`}):(0,i.jsx)(Zd,{onSend:async n=>{if(!n.trim())return;pe(!0),he(null),_e(!0);let r=`temp-${Date.now()}-${Math.random()}`,i={id:r,sender:a?.id,receiver:t.type===`dm`?t.id:null,group:t.type===`group`?t.id:null,content:n,created_at:new Date().toISOString(),conversationId:e.p(t)};try{await e.d.messages.put(i),await(t.type===`group`?l.sendGroupMessage:l.sendDM).bind(l)(t.id,n),await e.d.messages.delete(r)}catch(e){he(o(e,`Failed to send message`))}pe(!1),setTimeout(()=>_e(!1),100)},sending:fe,disabled:!s,disableReason:s?void 0:`You're offline. You need to be online to send messages`})]})},ef=class extends n.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught an error:`,e,t),this.props.onError?.(e,t)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:`100%`,p:3,children:[(0,i.jsxs)(r.Alert,{severity:`error`,sx:{mb:2,maxWidth:500},children:[(0,i.jsx)(r.Typography,{variant:`h6`,gutterBottom:!0,children:`Something went wrong`}),(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:this.state.error?.message||`An unexpected error occurred`})]}),(0,i.jsx)(r.Button,{variant:`contained`,startIcon:(0,i.jsx)(ai,{}),onClick:this.handleReset,children:`Try Again`})]}):this.props.children}};function tf({onMessage:t,onConnect:r,onDisconnect:i,onError:a}={}){let[o,s]=(0,n.useState)(!1),c=(0,n.useCallback)(e=>{t?.(e)},[t]),l=(0,n.useCallback)(()=>{s(!0),r?.()},[r]),u=(0,n.useCallback)(()=>{s(!1),i?.()},[i]),d=(0,n.useCallback)(e=>{a?.(e)},[a]);return(0,n.useEffect)(()=>{if(e.s())try{let t=e.a();return s(t.isConnected()),t.on(`message`,c),t.on(`open`,l),t.on(`close`,u),t.on(`error`,d),()=>{t.off(`message`,c),t.off(`open`,l),t.off(`close`,u),t.off(`error`,d)}}catch(e){console.error(`Failed to setup WebSocket listeners:`,e)}},[c,l,u,d]),{isConnected:o}}var nf=({initialConversation:t})=>{let[a,o]=(0,n.useState)(t??null),[s,c]=(0,n.useState)(),[l,u]=(0,n.useState)(!0),d=(0,n.useCallback)(e=>()=>u(e),[]),f=e.a();return qd(async()=>{let t=await f.getMe();c(t),e.d.users.put(t)},[]),tf({onError:d(!1),onConnect:d(!0),onDisconnect:d(!1)}),(0,i.jsxs)(r.Box,{display:`flex`,height:`100%`,overflow:`hidden`,children:[(0,i.jsx)(r.Box,{sx:{width:{xs:`100%`,sm:`100%`,md:`320px`},flexShrink:0,border:`0px solid`,borderRightWidth:{xs:0,md:1},borderColor:`divider`,overflow:`hidden`,display:{xs:a?`none`:`flex`,sm:a?`none`:`flex`,md:`flex`},flexDirection:`column`},children:(0,i.jsx)(ef,{children:(0,i.jsx)(Rd,{currentUser:s,selectedConversation:a,onConversationSelect:t=>{o(t),e.n(e.p(t))}})})}),(0,i.jsx)(r.Box,{sx:{flex:1,overflow:`hidden`,display:{xs:a?`flex`:`none`,sm:a?`flex`:`none`,md:`flex`},flexDirection:`column`},children:a?(0,i.jsx)(ef,{children:(0,i.jsx)($d,{conversation:a,user:s,isConnected:l,onBack:()=>{o(null),e.n(null)}})}):(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,color:`text.secondary`,children:`Select a conversation to start chatting`})})]})},rf=({count:e,children:t,max:n=99})=>(0,i.jsx)(r.Badge,{badgeContent:e,color:`error`,max:n,overlap:`rectangular`,sx:{"& .MuiBadge-badge":{right:8,top:`50%`,transform:`translateY(-50%)`}},children:t});function af(){return Ld(()=>e.d.summaries.toArray().then(e=>e.reduce((e,t)=>e+t.unread_count,0)),[],void 0)}var of={SUMMARIES:300*1e3,USER:3600*1e3,MESSAGES:1/0},sf=()=>typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches,cf={mode:`dark`,background:{paper:`#3d3d43`,default:`#333338`},text:{primary:`#eee`,secondary:`#aaa`}},lf={mode:`light`,background:{default:`#f5f5f5`,paper:`#ffff`}},uf=e=>{let t=sf(),n=(e||(t?`dark`:`light`))===`dark`;return Mr({palette:{...n?cf:lf,primary:{main:`#E91E63`,light:`#F48FB1`,dark:`#AD1457`,contrastText:`#fff`},secondary:{main:`#e4e6eb`,light:`#f0f2f5`,dark:`#b0b3b8`,contrastText:`rgba(0, 0, 0, 0.87)`},error:{main:`#d32f2f`,light:`#ef5350`,dark:`#c62828`,contrastText:`#fff`},warning:{main:`#ed6c02`,light:`#ff9800`,dark:`#e65100`,contrastText:`#fff`},info:{main:`#0288d1`,light:`#03a9f4`,dark:`#01579b`,contrastText:`#fff`},success:{main:`#2e7d32`,light:`#4caf50`,dark:`#1b5e20`,contrastText:`#fff`}},typography:{fontFamily:[`-apple-system`,`BlinkMacSystemFont`,`"Segoe UI"`,`Roboto`,`"Helvetica Neue"`,`Arial`,`sans-serif`,`"Apple Color Emoji"`,`"Segoe UI Emoji"`,`"Segoe UI Symbol"`].join(`,`),fontSize:14,h1:{fontSize:`2.5rem`,fontWeight:500},h2:{fontSize:`2rem`,fontWeight:500},h3:{fontSize:`1.75rem`,fontWeight:500},h4:{fontSize:`1.5rem`,fontWeight:500},h5:{fontSize:`1.25rem`,fontWeight:500},h6:{fontSize:`1rem`,fontWeight:500},body1:{fontSize:`0.9375rem`,lineHeight:1.4},body2:{fontSize:`0.8125rem`,lineHeight:1.4}},shape:{borderRadius:12},components:{MuiButton:{styleOverrides:{root:{textTransform:`none`,fontWeight:500,borderRadius:20}}},MuiIconButton:{styleOverrides:{root:{borderRadius:`50%`}}},MuiPaper:{styleOverrides:{root:{backgroundImage:`none`},rounded:{borderRadius:12}}},MuiBadge:{styleOverrides:{badge:{fontSize:`0.6875rem`,height:18,minWidth:18,borderRadius:9,fontWeight:600}}},MuiCssBaseline:{styleOverrides:{body:{"*::-webkit-scrollbar":{width:`8px`,height:`8px`},"*::-webkit-scrollbar-track":{background:`undo`,borderRadius:`4px`},"*::-webkit-scrollbar-thumb":{background:`undo`,borderRadius:`4px`,"&:hover":{background:`undo`}},scrollbarWidth:`thin`,scrollbarColor:n?`#6a6a6e #333338`:`#c1c1c1 #f5f5f5`}}}}})},df=uf();exports.CACHE_TTL=of,exports.ChatApp=l,exports.ChatContainer=nf,exports.ChatHeader=zd,exports.ChatWindow=$d,exports.ConversationItem=fi,exports.ConversationItemSkeleton=pi,exports.ConversationList=Rd,exports.CreateGroupDialog=Md,exports.ErrorBoundary=ef,exports.LoadMoreTrigger=Kd,exports.MessageBubble=Wd,exports.MessageInput=Zd,exports.MessageList=Xd,exports.MessageSkeleton=Gd,exports.UnreadBadge=rf,exports.db=e.d,exports.disconnectSDK=e.i,exports.fetchSummaries=e.t,exports.getSDK=e.a,exports.getTheme=uf,exports.initSDK=e.o,exports.isSDKInitialized=e.s,exports.theme=df,exports.useMessages=Qd,exports.useSenderNames=Yd,exports.useUnreadCount=af,exports.useWebSocket=tf;
|
|
31
|
+
`)}function du(e){var t={};if(e.inner){if(e.inner.length===0)return iu(t,e.path,e.message);for(var n=e.inner,r=Array.isArray(n),i=0,n=r?n:n[Symbol.iterator]();;){var a;if(r){if(i>=n.length)break;a=n[i++]}else{if(i=n.next(),i.done)break;a=i.value}var o=a;Q(t,o.path)||(t=iu(t,o.path,o.message))}}return t}function fu(e,t,n,r){n===void 0&&(n=!1);var i=pu(e);return t[n?`validateSync`:`validate`](i,{abortEarly:!1,context:r||i})}function pu(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);Array.isArray(e[r])===!0?t[r]=e[r].map(function(e){return Array.isArray(e)===!0||Yi(e)?pu(e):e===``?void 0:e}):Yi(e[r])?t[r]=pu(e[r]):t[r]=e[r]===``?void 0:e[r]}return t}function mu(e,t,n){var r=e.slice();return t.forEach(function(t,i){r[i]===void 0?r[i]=n.clone!==!1&&n.isMergeableObject(t)?wi(Array.isArray(t)?[]:{},t,n):t:n.isMergeableObject(t)?r[i]=wi(e[i],t,n):e.indexOf(t)===-1&&r.push(t)}),r}function hu(e){return Array.from(e).filter(function(e){return e.selected}).map(function(e){return e.value})}function gu(e,t,n){if(typeof e==`boolean`)return!!t;var r=[],i=!1,a=-1;if(Array.isArray(e))r=e,a=e.indexOf(n),i=a>=0;else if(!n||n==`true`||n==`false`)return!!t;return t&&n&&!i?r.concat(n):i?r.slice(0,a).concat(r.slice(a+1)):r}var _u=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?t.useLayoutEffect:t.useEffect;function $(e){var n=(0,t.useRef)(e);return _u(function(){n.current=e}),(0,t.useCallback)(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current.apply(void 0,t)},[])}var vu=(0,t.forwardRef)(function(e,n){var r=e.action,i=ql(e,[`action`]),a=r??`#`,o=Xl(),s=o.handleReset,c=o.handleSubmit;return(0,t.createElement)(`form`,X({onSubmit:c,ref:n,onReset:s,action:a},i))});vu.displayName=`Form`;var yu=function(e,t,n){var r=Cu(e),i=r[t];return r.splice(t,1),r.splice(n,0,i),r},bu=function(e,t,n){var r=Cu(e),i=r[t];return r[t]=r[n],r[n]=i,r},xu=function(e,t,n){var r=Cu(e);return r.splice(t,0,n),r},Su=function(e,t,n){var r=Cu(e);return r[t]=n,r},Cu=function(e){if(!e)return[];if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,t){return t>e?t:e},0);return Array.from(X({},e,{length:t+1}))},wu=function(e,t){var n=typeof e==`function`?e:t;return function(e){return Array.isArray(e)||Ql(e)?n(Cu(e)):e}},Tu=function(e){Kl(n,e);function n(t){var n=e.call(this,t)||this;return n.updateArrayField=function(e,t,r){var i=n.props,a=i.name,o=i.formik.setFormikState;o(function(n){var i=wu(r,e),o=wu(t,e),s=iu(n.values,a,e(Q(n.values,a))),c=r?i(Q(n.errors,a)):void 0,l=t?o(Q(n.touched,a)):void 0;return Zl(c)&&(c=void 0),Zl(l)&&(l=void 0),X({},n,{values:s,errors:r?iu(n.errors,a,c):n.errors,touched:t?iu(n.touched,a,l):n.touched})})},n.push=function(e){return n.updateArrayField(function(t){return[].concat(Cu(t),[vl(e)])},!1,!1)},n.handlePush=function(e){return function(){return n.push(e)}},n.swap=function(e,t){return n.updateArrayField(function(n){return bu(n,e,t)},!0,!0)},n.handleSwap=function(e,t){return function(){return n.swap(e,t)}},n.move=function(e,t){return n.updateArrayField(function(n){return yu(n,e,t)},!0,!0)},n.handleMove=function(e,t){return function(){return n.move(e,t)}},n.insert=function(e,t){return n.updateArrayField(function(n){return xu(n,e,t)},function(t){return xu(t,e,null)},function(t){return xu(t,e,null)})},n.handleInsert=function(e,t){return function(){return n.insert(e,t)}},n.replace=function(e,t){return n.updateArrayField(function(n){return Su(n,e,t)},!1,!1)},n.handleReplace=function(e,t){return function(){return n.replace(e,t)}},n.unshift=function(e){var t=-1;return n.updateArrayField(function(n){var r=n?[e].concat(n):[e];return t=r.length,r},function(e){return e?[null].concat(e):[null]},function(e){return e?[null].concat(e):[null]}),t},n.handleUnshift=function(e){return function(){return n.unshift(e)}},n.handleRemove=function(e){return function(){return n.remove(e)}},n.handlePop=function(){return function(){return n.pop()}},n.remove=n.remove.bind(Jl(n)),n.pop=n.pop.bind(Jl(n)),n}var r=n.prototype;return r.componentDidUpdate=function(e){this.props.validateOnChange&&this.props.formik.validateOnChange&&!(0,bl.default)(Q(e.formik.values,e.name),Q(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},r.remove=function(e){var t;return this.updateArrayField(function(n){var r=n?Cu(n):[];return t||=r[e],Z(r.splice)&&r.splice(e,1),Z(r.every)&&r.every(function(e){return e===void 0})?[]:r},!0,!0),t},r.pop=function(){var e;return this.updateArrayField(function(t){var n=t.slice();return e||=n&&n.pop&&n.pop(),n},!0,!0),e},r.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},n=this.props,r=n.component,i=n.render,a=n.children,o=n.name,s=n.formik,c=ql(s,[`validate`,`validationSchema`]),l=X({},e,{form:c,name:o});return r?(0,t.createElement)(r,l):i?i(l):a?typeof a==`function`?a(l):tu(a)?null:t.Children.only(a):null},n}(t.Component);Tu.defaultProps={validateOnChange:!0};var Eu=e.g(((e,t)=>{t.exports=Array.isArray})),Du=e.g(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),Ou=e.g(((e,t)=>{var n=Du(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),ku=e.g(((e,t)=>{t.exports=Ou().Symbol})),Au=e.g(((e,t)=>{var n=ku(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),ju=e.g(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),Mu=e.g(((e,t)=>{var n=ku(),r=Au(),i=ju(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),Nu=e.g(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),Pu=e.g(((e,t)=>{var n=Mu(),r=Nu(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),Fu=e.g(((e,t)=>{var n=Eu(),r=Pu(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),Iu=e.g(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),Lu=e.g(((e,t)=>{var n=Mu(),r=Iu(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),Ru=e.g(((e,t)=>{t.exports=Ou()[`__core-js_shared__`]})),zu=e.g(((e,t)=>{var n=Ru(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),Bu=e.g(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),Vu=e.g(((e,t)=>{var n=Lu(),r=zu(),i=Iu(),a=Bu(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Hu=e.g(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),Uu=e.g(((e,t)=>{var n=Vu(),r=Hu();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),Wu=e.g(((e,t)=>{t.exports=Uu()(Object,`create`)})),Gu=e.g(((e,t)=>{var n=Wu();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Ku=e.g(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),qu=e.g(((e,t)=>{var n=Wu(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),Ju=e.g(((e,t)=>{var n=Wu(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),Yu=e.g(((e,t)=>{var n=Wu(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),Xu=e.g(((e,t)=>{var n=Gu(),r=Ku(),i=qu(),a=Ju(),o=Yu();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),Zu=e.g(((e,t)=>{function n(){this.__data__=[],this.size=0}t.exports=n})),Qu=e.g(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),$u=e.g(((e,t)=>{var n=Qu();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),ed=e.g(((e,t)=>{var n=$u(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),td=e.g(((e,t)=>{var n=$u();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),nd=e.g(((e,t)=>{var n=$u();function r(e){return n(this.__data__,e)>-1}t.exports=r})),rd=e.g(((e,t)=>{var n=$u();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),id=e.g(((e,t)=>{var n=Zu(),r=ed(),i=td(),a=nd(),o=rd();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),ad=e.g(((e,t)=>{t.exports=Uu()(Ou(),`Map`)})),od=e.g(((e,t)=>{var n=Xu(),r=id(),i=ad();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),sd=e.g(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),cd=e.g(((e,t)=>{var n=sd();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),ld=e.g(((e,t)=>{var n=cd();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),ud=e.g(((e,t)=>{var n=cd();function r(e){return n(this,e).get(e)}t.exports=r})),dd=e.g(((e,t)=>{var n=cd();function r(e){return n(this,e).has(e)}t.exports=r})),fd=e.g(((e,t)=>{var n=cd();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),pd=e.g(((e,t)=>{var n=od(),r=ld(),i=ud(),a=dd(),o=fd();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),md=e.g(((e,t)=>{var n=pd(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),hd=e.g(((e,t)=>{var n=md(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),gd=e.g(((e,t)=>{var n=hd(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),_d=e.g(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}t.exports=n})),vd=e.g(((e,t)=>{var n=ku(),r=_d(),i=Eu(),a=Pu(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),yd=e.g(((e,t)=>{var n=vd();function r(e){return e==null?``:n(e)}t.exports=r})),bd=e.g(((e,t)=>{var n=Eu(),r=Fu(),i=gd(),a=yd();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),xd=e.g(((e,t)=>{var n=Pu(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),Sd=e.g(((e,t)=>{var n=bd(),r=xd();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i<a;)e=e[r(t[i++])];return i&&i==a?e:void 0}t.exports=i})),Cd=e.g(((e,t)=>{var n=Sd();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),wd=e._(Cd(),1),Td=(e=16)=>{let t={upper:`ABCDEFGHIJKLMNOPQRSTUVWXYZ`,lower:`abcdefghijklmnopqrstuvwxyz`,numbers:`0123456789`,symbols:`!@%^&*()_+[]{}|;:,.<>?`},n=t.upper+t.lower+t.numbers+t.symbols,r=e=>e[crypto.getRandomValues(new Uint32Array(1))[0]%e.length],i=[r(t.upper),r(t.lower),r(t.numbers),r(t.symbols)];for(let t=4;t<e;t++)i.push(r(n));for(let e=i.length-1;e>0;e--){let t=crypto.getRandomValues(new Uint32Array(1))[0]%(e+1),n=i[e];i[e]=i[t],i[t]=n}return i.join(``)},Ed=({showPassword:e,onToggleVisibility:t,onGenerate:n})=>(0,i.jsxs)(r.InputAdornment,{position:`end`,children:[n&&(0,i.jsx)(r.Tooltip,{title:`Generate Password`,children:(0,i.jsx)(r.IconButton,{onClick:n,edge:`end`,size:`small`,sx:{opacity:.7},"aria-label":`generate password`,children:(0,i.jsx)(qr,{})})}),(0,i.jsx)(r.Tooltip,{title:e?`Hide password`:`Show password`,children:(0,i.jsx)(r.IconButton,{onClick:t,edge:`end`,size:`small`,sx:{opacity:.7},"aria-label":e?`hide password`:`show password`,children:e?(0,i.jsx)(li,{}):(0,i.jsx)(ci,{})})})]}),Dd=({type:e,autoGenerate:t=!1,formik:r,name:i})=>{let[a,o]=(0,n.useState)(!1),s={},c=a?`text`:`password`;return e===`password`?(s.endAdornment=Ed({showPassword:a,onToggleVisibility:()=>{o(!a)},onGenerate:t?()=>{if(!r||!i)return;let e=Td();r.setFieldValue(i,e),a||o(!0)}:void 0}),{inputType:c,inputProps:s}):{inputType:e,inputProps:s}},Od=({helperText:e,errorText:t,formik:a,name:o,defaultValue:s,onChange:c,type:l,fullWidth:u=!0,autoGenerate:d=!1,...f})=>{let p=Dd({type:l,autoGenerate:d,formik:a,name:o}),m={},h=f.value??s;if((0,n.useEffect)(()=>{!a||!o||h===void 0||a.setFieldValue(o,h)},[h]),o&&a){a.touched[o]&&(t??=a.errors[o]);let e=(0,wd.default)(a.values,o,``);l===`date`&&(e=kd(e)),m={value:e??``,onBlur:()=>a.setFieldTouched(o),onChange:e=>{let t=e.target.value;l===`date`&&t&&(t=new Date(t)),a.setFieldValue(o,t||null),c?.(e)},slotProps:{...f.slotProps,input:{...f.InputProps,...f.slotProps?.input,...p.inputProps},inputLabel:l===`date`?{shrink:!0}:void 0}}}return(0,i.jsx)(r.TextField,{variant:`standard`,onChange:c,...f,...m,name:o,type:p.inputType,fullWidth:u,helperText:t||e,error:!!t})},kd=e=>{if(!e)return``;let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`},Ad=({multiple:t=!1,formik:a,name:o,label:s=`Search users`,disabled:c=!1,error:l,helperText:u,value:d,onChange:f})=>{let[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)([]),[_,v]=(0,n.useState)(!1),[y,b]=(0,n.useState)(``),x=(0,n.useCallback)(async t=>{if(t.length<2){g([]);return}v(!0);try{let n=e.a();if(!n)return;g(await n.searchUsers({name:t}))}catch(e){console.error(`Failed to search users:`,e),g([])}finally{v(!1)}},[]),S=(0,n.useCallback)((e,t)=>{b(t),x(t)},[x]),C=()=>d===void 0?a&&o?a.values[o]:t?[]:null:d,w=(e,t)=>{f?f(t):a&&o&&a.setFieldValue(o,t)},T=()=>{a&&o&&a.setFieldTouched(o)},ee=()=>{if(l)return` `;if(a&&o&&a.touched[o]&&a.errors[o])return a.errors[o]};return(0,i.jsx)(r.Autocomplete,{open:p,onOpen:()=>m(!0),onClose:()=>m(!1),multiple:t,options:h,value:C(),onChange:w,onBlur:T,onInputChange:S,getOptionLabel:e=>e.name,isOptionEqualToValue:(e,t)=>e.id===t.id,loading:_,noOptionsText:y.length<3?`Type at least 3 characters to search`:`No users found`,renderOption:(e,t)=>(0,n.createElement)(r.Box,{component:`li`,...e,key:t.id},(0,i.jsxs)(r.Box,{children:[(0,i.jsx)(r.Typography,{variant:`body1`,children:t.name}),(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:t.email})]})),renderInput:e=>(0,i.jsx)(r.TextField,{...e,label:s,disabled:c,variant:`standard`,error:!!ee(),helperText:ee()||u,InputProps:{...e.InputProps,endAdornment:(0,i.jsxs)(i.Fragment,{children:[_?(0,i.jsx)(r.CircularProgress,{size:20}):null,e.InputProps.endAdornment]})}})})},jd=e.m({name:e.h().trim().required(`Group name is required`).min(2,`Group name must be at least 2 characters`).max(100,`Group name must be at most 100 characters`)}),Md=({open:t,onClose:a,onSuccess:s,orgId:c})=>{let[l,u]=(0,n.useState)(null),d=lu({initialValues:{name:``,read_only:!1,members:[]},validationSchema:jd,onSubmit:async(t,{setSubmitting:n,resetForm:r})=>{u(null);try{let n=e.a();if(!n)return;let i=await n.createGroup(c,{name:t.name.trim(),read_only:t.read_only});t.members&&t.members.length>0&&await n.addGroupMembers(c,i.id,t.members.map(e=>({user:e.userId,role:e.role}))),r(),s?.(),a()}catch(e){u(o(e,`Failed to create group`))}n(!1)}}),f=e=>{let t=Array.isArray(e)?e:[];d.setFieldValue(`members`,t.map(e=>({userId:e.id,role:`member`,user:e})))},p=(e,t)=>{let n=d.values.members.map(n=>n.userId===e?{...n,role:t}:n);d.setFieldValue(`members`,n)},m=e=>{let t=d.values.members.filter(t=>t.userId!==e);d.setFieldValue(`members`,t)},h=()=>{d.resetForm(),a()};return(0,i.jsxs)(r.Dialog,{open:t,onClose:h,maxWidth:`sm`,fullWidth:!0,PaperProps:{component:`form`,onSubmit:d.handleSubmit},children:[(0,i.jsx)(r.DialogTitle,{children:`Create New Group`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,gap:2,pt:1},children:[l&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>u(null),children:l.message}),(0,i.jsx)(Od,{label:`Group Name`,name:`name`,formik:d,required:!0,disabled:d.isSubmitting,placeholder:`e.g., Computer Science 101`}),(0,i.jsx)(r.FormControlLabel,{control:(0,i.jsx)(r.Switch,{name:`read_only`,checked:d.values.read_only,onChange:d.handleChange,disabled:d.isSubmitting}),label:`Read-only group (only moderators can post)`}),(0,i.jsx)(r.Divider,{sx:{my:2}}),(0,i.jsxs)(r.Box,{children:[(0,i.jsx)(r.Typography,{variant:`subtitle2`,gutterBottom:!0,children:`Add Members`}),(0,i.jsx)(Ad,{multiple:!0,label:`Search users to add`,value:d.values.members.map(e=>e.user),onChange:f,disabled:d.isSubmitting})]}),d.values.members.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Typography,{variant:`subtitle2`,gutterBottom:!0,children:`Selected Members`}),d.values.members.map(e=>(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,borderRadius:1},children:[(0,i.jsx)(r.Box,{sx:{flex:1},children:e.user.name}),(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>p(e.userId,t.target.value),size:`small`,disabled:d.isSubmitting,sx:{mr:2},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,onClick:()=>m(e.userId),disabled:d.isSubmitting,color:`error`,children:(0,i.jsx)(Jr,{})})]},e.userId))]})]})}),(0,i.jsxs)(r.DialogActions,{sx:{p:3},children:[(0,i.jsx)(r.Button,{onClick:h,disabled:d.isSubmitting,children:`Cancel`}),(0,i.jsx)(r.Button,{type:`submit`,variant:`contained`,disabled:d.isSubmitting||!d.isValid,startIcon:d.isSubmitting&&(0,i.jsx)(r.CircularProgress,{size:16}),children:`Create Group`})]})]})},Nd=async t=>{let n=e.a();if(!n)throw Error(`SDK not initialized`);let r=await n.getGroups(t);return await e.d.groups.clear(),await e.d.groups.bulkPut(r),r},Pd=async(t,n,r)=>{let i=e.a();if(!i)throw Error(`SDK not initialized`);let a=await i.updateGroup(t,n,{name:r});return await e.d.groups.update(n,{name:a.name}),a},Fd=async(t,n)=>{let r=e.a();if(!r)throw Error(`SDK not initialized`);await r.deleteGroup(t,n),await e.d.groups.delete(n),await e.d.summaries.filter(e=>e.group===n).delete()};function Id(e,t,r){let i,a;typeof e==`function`?(i=t||[],a=r):(i=[],a=t);let o=n.default.useRef({hasResult:!1,result:a,error:null}),[s,c]=n.default.useReducer(e=>e+1,0),l=n.default.useMemo(()=>{let t=typeof e==`function`?e():e;if(!t||typeof t.subscribe!=`function`)throw TypeError(e===t?`Given argument to useObservable() was neither a valid observable nor a function.`:`Observable factory given to useObservable() did not return a valid observable.`);if(!o.current.hasResult&&typeof window<`u`&&(typeof t.hasValue!=`function`||t.hasValue()))if(typeof t.getValue==`function`)o.current.result=t.getValue(),o.current.hasResult=!0;else{let e=t.subscribe(e=>{o.current.result=e,o.current.hasResult=!0});typeof e==`function`?e():e.unsubscribe()}return t},i);if(n.default.useDebugValue(o.current.result),n.default.useEffect(()=>{let e=l.subscribe(e=>{let{current:t}=o;(t.error!==null||t.result!==e)&&(t.error=null,t.result=e,t.hasResult=!0,c())},e=>{let{current:t}=o;t.error!==e&&(t.error=e,c())});return typeof e==`function`?e:e.unsubscribe.bind(e)},i),o.current.error)throw o.current.error;return o.current.result}function Ld(t,n,r){return Id(()=>e.f.liveQuery(t),n||[],r)}typeof FinalizationRegistry<`u`&&new FinalizationRegistry(t=>{let n=e.f.DexieYProvider;n&&n.release(t)}),Reflect.get(n,`use`);var Rd=({selectedConversation:t,currentUser:a,onConversationSelect:o})=>{let[s,c]=(0,n.useState)(!0),[l,u]=(0,n.useState)(),[d,f]=(0,n.useState)(!1),p=Ld(()=>e.d.summaries.toArray(),[t])||[],m=Ld(()=>e.d.groups.toArray(),[])||[],h=a?.role===`admin`||a?.role===`system`,g=(0,n.useCallback)(async()=>{c(!0),a?.org&&(await Promise.all([e.t({}),Nd(a?.org)]).catch(e=>{u(e instanceof Error?e:Error(String(e)))}),c(!1))},[a?.org]);(0,n.useEffect)(()=>{g();let e=setInterval(g,3*6e4);return()=>clearInterval(e)},[g]);let[_,v]=(0,n.useState)({});(0,n.useEffect)(()=>{p.length>0&&a?.org&&(async()=>{if(!a?.org)return;let t=e.a();if(!t)return;let n={};for(let e of p)try{if(e.user!==void 0&&!_[e.user]){let r=await t.getUser(e.user);n[e.user]=r.name}}catch(e){console.error(`Failed to load conversation name:`,e)}Object.keys(n).length>0&&v(e=>({...e,...n}))})()},[p,a?.org]);let y=e=>e.user===void 0?e.group===void 0?`Unknown`:m.find(t=>t.id===e.group)?.name||`Group ${e.group}`:_[e.user]||`User ${e.user}`,b=e=>t?e.group===void 0?e.user===void 0?!1:t.type===`dm`&&t.id===e.user:t.type===`group`&&t.id===e.group:!1,x=e=>{e.group===void 0?e.user!==void 0&&o({type:`dm`,id:e.user,name:y(e)}):o({type:`group`,id:e.group,name:y(e)})};return(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,height:`100%`,children:[(0,i.jsx)(r.AppBar,{position:`static`,elevation:0,sx:{backgroundColor:`background.default`,color:`text.primary`},children:(0,i.jsxs)(r.Toolbar,{children:[(0,i.jsx)(r.Typography,{variant:`h6`,component:`div`,sx:{flexGrow:1},children:`Messages`}),h&&(0,i.jsx)(r.Tooltip,{title:`Create Group`,children:(0,i.jsx)(r.IconButton,{color:`primary`,onClick:()=>f(!0),size:`small`,sx:{mr:-2},children:(0,i.jsx)(Wr,{})})})]})}),h&&a?.org&&(0,i.jsx)(Md,{open:d,onClose:()=>f(!1),onSuccess:async()=>{await g()},orgId:a.org}),(0,i.jsx)(r.Box,{flex:1,overflow:`auto`,children:s&&!p.length?(0,i.jsx)(r.List,{disablePadding:!0,children:[1,2,3,4,5].map(e=>(0,i.jsx)(pi,{},e))}):l?(0,i.jsx)(r.Box,{p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,children:[`Failed to load conversations: `,l.message]})}):p.length===0&&m.length===0?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,p:2,children:(0,i.jsx)(r.Typography,{color:`text.secondary`,align:`center`,children:`No conversations yet`})}):(0,i.jsx)(r.List,{disablePadding:!0,children:(()=>{let e=new Set(p.filter(e=>e.group!==void 0).map(e=>e.group)),t=m.filter(t=>!e.has(t.id)).map(e=>({group:e.id,last_message_at:e.created_at,message_count:0,unread_count:0}));return[...[...p].sort((e,t)=>new Date(t.last_message_at).getTime()-new Date(e.last_message_at).getTime()),...t].map(e=>(0,i.jsx)(fi,{conversation:e,displayName:y(e),selected:b(e),onClick:()=>x(e),currentUser:a},e.group===void 0?`user-${e.user}`:`group-${e.group}`))})()})})]})},zd=({displayName:e,type:t,subtitle:a,isConnected:o=!0,onBack:s,showJoinButton:c=!1,onJoin:l,joining:u=!1,showMembersButton:d=!1,onManageMembers:f,canManageGroup:p=!1,onRenameGroup:m,onDeleteGroup:h,deletingGroup:g=!1})=>{let _=t===`group`,[v,y]=(0,n.useState)(null),[b,x]=(0,n.useState)(null),S=e=>{y(e.currentTarget)},C=()=>{y(null)},w=e=>{l(e),C()};return(0,i.jsx)(r.AppBar,{position:`static`,elevation:0,sx:{backgroundColor:`background.default`,color:`text.primary`},children:(0,i.jsxs)(r.Toolbar,{children:[s&&(0,i.jsx)(r.IconButton,{edge:`start`,color:`inherit`,onClick:s,sx:{mr:2,display:{xs:`flex`,sm:`flex`,md:`none`}},children:(0,i.jsx)(Gr,{})}),(0,i.jsx)(r.Avatar,{sx:{bgcolor:_?`primary.main`:`secondary.main`,mr:2},children:_?(0,i.jsx)(ei,{}):(0,i.jsx)(ri,{})}),(0,i.jsxs)(r.Box,{flex:1,children:[(0,i.jsx)(r.Typography,{variant:`h6`,component:`div`,noWrap:!0,children:e}),a&&(0,i.jsx)(r.Typography,{variant:`caption`,color:`inherit`,sx:{opacity:.7},children:a})]}),d&&_&&(0,i.jsx)(r.IconButton,{color:`inherit`,onClick:f,title:`Members`,sx:{mr:.5},children:(0,i.jsx)(ni,{})}),p&&_&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.IconButton,{color:`inherit`,onClick:e=>x(e.currentTarget),disabled:g,title:`Manage group`,children:(0,i.jsx)(ti,{})}),(0,i.jsxs)(r.Menu,{anchorEl:b,open:!!b,onClose:()=>x(null),children:[(0,i.jsxs)(r.MenuItem,{onClick:()=>{x(null),m?.()},children:[(0,i.jsx)(Qr,{fontSize:`small`,sx:{mr:1}}),`Rename Group`]}),(0,i.jsxs)(r.MenuItem,{onClick:()=>{x(null),h?.()},sx:{color:`error.main`},children:[(0,i.jsx)(Xr,{fontSize:`small`,sx:{mr:1}}),`Delete Group`]})]})]}),c&&_&&(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,mr:1},children:[(0,i.jsx)(r.Button,{variant:`contained`,color:`primary`,startIcon:(0,i.jsx)(ii,{}),endIcon:(0,i.jsx)(Kr,{}),onClick:S,disabled:u,children:u?`Joining...`:`Join`}),(0,i.jsxs)(r.Menu,{anchorEl:v,open:!!v,onClose:C,children:[(0,i.jsx)(r.MenuItem,{onClick:()=>w(`member`),children:`Member`}),(0,i.jsx)(r.MenuItem,{onClick:()=>w(`moderator`),children:`Moderator`})]})]}),!o&&(0,i.jsx)(r.Chip,{icon:(0,i.jsx)(ui,{}),label:`Disconnected`,size:`small`,color:`warning`,sx:{ml:1}})]})})},Bd=({member:e,currentUserId:t,canManage:n,removing:a,updating:o,onRemove:s,onRoleChange:c})=>(0,i.jsxs)(r.ListItem,{secondaryAction:n?(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>c(e.id,t.target.value),size:`small`,disabled:o||a,variant:`standard`,disableUnderline:!0,sx:{fontSize:12},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,color:`error`,onClick:()=>s(e.id),disabled:a||o,children:a?(0,i.jsx)(r.CircularProgress,{size:16}):(0,i.jsx)(Yr,{fontSize:`small`})})]}):void 0,children:[(0,i.jsx)(r.Avatar,{sx:{mr:1.5,width:32,height:32,bgcolor:`primary.main`},children:(0,i.jsx)(ri,{fontSize:`small`})}),(0,i.jsx)(r.ListItemText,{primary:(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,i.jsx)(r.Typography,{variant:`body1`,noWrap:!0,children:e.name}),e.id===t&&(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,children:`(you)`})]})})]}),Vd=({open:t,onClose:a,orgId:s,groupId:c,existingMemberIds:l,onSuccess:u})=>{let[d,f]=(0,n.useState)([]),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(null),_=()=>{f([]),g(null),a()},v=e=>{f((Array.isArray(e)?e:[]).filter(e=>!l.has(e.id)).map(e=>({id:e.id,role:`member`,user:e})))},y=(e,t)=>{f(n=>n.map(n=>n.id===e?{...n,role:t}:n))},b=e=>{f(t=>t.filter(t=>t.id!==e))};return(0,i.jsxs)(r.Dialog,{open:t,onClose:_,maxWidth:`xs`,fullWidth:!0,children:[(0,i.jsx)(r.DialogTitle,{children:`Add Members`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,gap:2,pt:1},children:[h&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>g(null),children:h.message}),(0,i.jsx)(Ad,{multiple:!0,label:`Search users to add`,value:d.map(e=>e.user),onChange:v,disabled:p}),d.map(e=>(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,i.jsx)(r.Typography,{variant:`body2`,noWrap:!0,sx:{flex:1,mr:1},children:e.user.name}),(0,i.jsxs)(r.Select,{value:e.role,onChange:t=>y(e.id,t.target.value),size:`small`,disabled:p,sx:{mr:1},children:[(0,i.jsx)(r.MenuItem,{value:`member`,children:`Member`}),(0,i.jsx)(r.MenuItem,{value:`moderator`,children:`Moderator`})]}),(0,i.jsx)(r.IconButton,{size:`small`,color:`error`,onClick:()=>b(e.id),disabled:p,children:(0,i.jsx)(Jr,{fontSize:`small`})})]},e.id))]})}),(0,i.jsxs)(r.DialogActions,{sx:{p:2},children:[(0,i.jsx)(r.Button,{onClick:_,disabled:p,children:`Cancel`}),(0,i.jsx)(r.Button,{variant:`contained`,onClick:async()=>{if(d.length!==0){m(!0),g(null);try{await e.a()?.addGroupMembers(s,c,d.map(e=>({user:e.id,role:e.role}))),_(),u()}catch(e){g(o(e,`Failed to add members`))}finally{m(!1)}}},disabled:p||d.length===0,startIcon:p&&(0,i.jsx)(r.CircularProgress,{size:16}),children:p?`Adding...`:`Add${d.length>0?` ${d.length}`:``}`})]})]})},Hd=({open:t,onClose:a,orgId:s,groupId:c,currentUserId:l,canManage:u})=>{let[d,f]=(0,n.useState)([]),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(null),[_,v]=(0,n.useState)(null),[y,b]=(0,n.useState)(null),[x,S]=(0,n.useState)(!1),C=(0,n.useCallback)(async()=>{m(!0),g(null);try{let t=e.a();if(!t)return;f(await t.getGroupMembers(s,c))}catch(e){g(o(e,`Failed to load members`))}finally{m(!1)}},[s,c]);(0,n.useEffect)(()=>{t&&C()},[t,C]);let w=async t=>{v(t);try{let n=e.a();if(!n)return;await n.removeGroupMember(s,c,t),f(e=>e.filter(e=>e.id!==t))}catch(e){g(o(e,`Failed to remove member`))}finally{v(null)}},T=async(t,n)=>{b(t);try{let r=e.a();if(!r)return;await r.addGroupMembers(s,c,[{user:t,role:n}]),f(e=>e.map(e=>e.id===t?{...e,role:n}:e))}catch(e){g(o(e,`Failed to update role`))}finally{b(null)}};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.Drawer,{anchor:`right`,open:t,onClose:a,slotProps:{paper:{sx:{width:360,maxWidth:`100vw`}}},children:[(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,px:2,py:1.5},children:[(0,i.jsx)(r.Typography,{variant:`h6`,children:`Members`}),(0,i.jsx)(r.IconButton,{size:`small`,onClick:a,children:(0,i.jsx)(Jr,{})})]}),(0,i.jsxs)(r.Box,{sx:{display:`flex`,flexDirection:`column`,overflow:`hidden`,flex:1},children:[h&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>g(null),sx:{m:2},children:h.message}),(0,i.jsx)(r.Box,{sx:{overflow:`auto`,flex:1},children:p?(0,i.jsx)(r.Box,{sx:{display:`flex`,justifyContent:`center`,mt:4},children:(0,i.jsx)(r.CircularProgress,{size:32})}):(0,i.jsxs)(r.List,{disablePadding:!0,children:[d.map(e=>(0,i.jsx)(Bd,{member:e,currentUserId:l,canManage:u,removing:_===e.id,updating:y===e.id,onRemove:w,onRoleChange:T},e.id)),d.length===0&&(0,i.jsx)(r.Box,{sx:{p:3,textAlign:`center`},children:(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:`No members yet`})})]})}),u&&(0,i.jsx)(r.Box,{sx:{p:2,borderTop:1,borderColor:`divider`},children:(0,i.jsx)(r.Button,{variant:`outlined`,color:`secondary`,fullWidth:!0,onClick:()=>S(!0),children:`Add Members`})})]})]}),(0,i.jsx)(Vd,{open:x,onClose:()=>S(!1),orgId:s,groupId:c,existingMemberIds:new Set(d.map(e=>e.id)),onSuccess:C})]})};function Ud(e){return(typeof e==`string`?new Date(e):e).toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`,hour12:!0})}var Wd=n.default.memo(({message:t,isOwnMessage:n,senderName:a,showSenderName:o=!0,isFirstInGroup:s=!0,isLastInGroup:c=!0,status:l=`sent`})=>{let u=t.id.startsWith(`temp-`),d=()=>{if(!n||!c)return null;let e={fontSize:14,ml:.5,opacity:.7,verticalAlign:`middle`};return l===`failed`?(0,i.jsx)($r,{sx:{...e,color:`error.main`}}):l===`sending`||u?(0,i.jsx)(oi,{sx:e}):(0,i.jsx)(Zr,{sx:e})},f=(0,i.jsx)(r.Avatar,{sx:{width:32,height:32,fontSize:`0.875rem`,color:n?`primary.contrastText`:`secondary.contrastText`,bgcolor:n?`primary.main`:`secondary.main`,visibility:c?`visible`:`hidden`},children:e.l(a)});return(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:n?`flex-end`:`flex-start`,alignItems:`flex-end`,mb:c?1:.25,gap:1,children:[!n&&f,(0,i.jsxs)(r.Paper,{elevation:1,sx:{maxWidth:`80%`,p:1.5,backgroundColor:n?`primary.main`:`background.paper`,color:n?`primary.contrastText`:`text.primary`,borderTopLeftRadius:n||!s?void 0:4,borderTopRightRadius:!n||!s?void 0:4,borderBottomLeftRadius:n||!c?void 0:4,borderBottomRightRadius:!n||!c?void 0:4},children:[!n&&o&&s&&(0,i.jsx)(r.Typography,{variant:`caption`,fontWeight:`bold`,display:`block`,mb:.5,children:a||`User ${t.sender}`}),(0,i.jsx)(r.Typography,{variant:`body1`,sx:{whiteSpace:`pre-wrap`},children:t.content}),c&&(0,i.jsxs)(r.Box,{display:`flex`,justifyContent:`flex-end`,alignItems:`center`,mt:.5,children:[(0,i.jsx)(r.Typography,{variant:`caption`,color:n?`inherit`:`text.secondary`,sx:{opacity:.7},children:Ud(new Date(t.created_at))}),(0,i.jsx)(d,{})]})]}),n&&f]})}),Gd=({isOwnMessage:e=!1})=>(0,i.jsx)(r.Box,{display:`flex`,justifyContent:e?`flex-end`:`flex-start`,mb:1,children:(0,i.jsxs)(r.Box,{maxWidth:`70%`,children:[!e&&(0,i.jsx)(r.Skeleton,{variant:`text`,width:80,sx:{mb:.5}}),(0,i.jsx)(r.Skeleton,{variant:`rounded`,width:Math.random()*200+150,height:60,sx:{borderRadius:2,bgcolor:e?`primary.light`:`background.main`}})]})}),Kd=({hasMore:e,loading:t,onLoadMore:a,threshold:o=1,rootMargin:s=`100px`})=>{let c=(0,n.useRef)(null),l=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!e||t)return;let n=c.current;if(n)return l.current=new IntersectionObserver(n=>{let[r]=n;r&&r.isIntersecting&&e&&!t&&a()},{threshold:o,rootMargin:s}),l.current.observe(n),()=>{l.current&&n&&(l.current.unobserve(n),l.current.disconnect())}},[e,t,a,o,s]),e?(0,i.jsx)(r.Box,{ref:c,display:`flex`,justifyContent:`center`,alignItems:`center`,py:2,children:t?(0,i.jsx)(r.CircularProgress,{size:24}):(0,i.jsx)(r.Typography,{variant:`caption`,color:`text.secondary`,children:`Scroll to load more`})}):null},qd=(e,t,r)=>{(0,n.useEffect)(()=>((async()=>{await e()})(),r),t)};function Jd(e){let t=e.map(e=>Number(e.sender));return new Set(t)}function Yd(t){let[r,i]=(0,n.useState)(()=>new Map),a=(0,n.useCallback)(async()=>{if(!t.length)return r;try{let n=Jd(t),i=Array.from(n);if(console.log(`[names] size:`,n.size),!n.size)return r;let a=(await e.d.users.bulkGet(i)).filter(e=>!!e),o=new Map;if(a.forEach(e=>{o.set(e.id,e.name)}),n.size===a.length)return o;let s=i.filter(e=>!o.has(e)),c=e.a();if(!c)return r;let l=await c.getUsers(s,{fields:[`id`,`name`]});await e.d.users.bulkPut(l);let u=o;return l.forEach(e=>u.set(e.id,e.name)),u}catch(e){console.error(`[useSenderNames] Failed to fetch users:`,e)}return r},[t,r]);return qd(async()=>{i(await a())},[t]),r}var Xd=({messages:t,currentUserId:a,loading:o=!1,error:s=null,autoScroll:c=!0,hasMore:l=!1,loadingMore:u=!1,onLoadMore:d})=>{let f=(0,n.useRef)(null),p=(0,n.useRef)(null),m=(0,n.useRef)(0),h=(0,n.useRef)(!0),[g,_]=(0,n.useState)(c),v=Yd(t),y=()=>{if(!p.current)return!1;let{scrollTop:e,scrollHeight:t,clientHeight:n}=p.current;return t-e-n<100};return(0,n.useEffect)(()=>{t.length>0&&f.current&&(f.current.scrollIntoView({behavior:`auto`}),h.current=!0)},[]),(0,n.useEffect)(()=>{!u||!t.length||(p.current&&(m.current=p.current.scrollHeight),_(!1))},[u]),(0,n.useLayoutEffect)(()=>{if(t.length){if(g&&f.current&&h.current)f.current.scrollIntoView({behavior:`smooth`});else if(!g&&p.current&&m.current>0){let e=p.current.scrollHeight-m.current;p.current.scrollTop=p.current.scrollTop+e,m.current=0,_(!0)}}},[t.length,c]),o&&!t.length?(0,i.jsx)(r.Box,{flex:1,overflow:`auto`,p:2,children:[1,2,3,4,5].map(e=>(0,i.jsx)(Gd,{isOwnMessage:e%3==0},e))}):s&&!t.length?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,flex:1,p:2,children:(0,i.jsxs)(r.Alert,{severity:`error`,children:[(0,i.jsx)(`strong`,{children:`Failed to load messages`}),(0,i.jsx)(`br`,{}),s.message]})}):t.length===0?(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,flex:1,children:(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:`No messages yet. Start the conversation!`})}):(0,i.jsxs)(r.Box,{ref:p,flex:1,overflow:`auto`,p:2,display:`flex`,flexDirection:`column`,onScroll:()=>{h.current=y()},children:[l&&d&&(0,i.jsx)(Kd,{hasMore:l,loading:u,onLoadMore:d}),t.map((n,r)=>{let o=n.sender,s=n.sender===a,c=v.get(o),l=r>0?t[r-1]:null,u=r<t.length-1?t[r+1]:null,d=!l||!e.u(l,n);return(0,i.jsx)(Wd,{message:n,isOwnMessage:s,senderName:c,showSenderName:d,isFirstInGroup:d,isLastInGroup:!u||!e.u(n,u)},n.id)}),(0,i.jsx)(`div`,{ref:f})]})},Zd=({onSend:e,sending:t=!1,placeholder:a=`Type a message...`,disabled:o=!1,disableReason:s})=>{let[c,l]=(0,n.useState)(``),u=(0,n.useRef)(null),d=()=>{let n=c.trim();n&&!t&&!o&&(e(n),l(``),setTimeout(()=>{u.current?.querySelector(`textarea`)?.focus()},300))};return(0,i.jsxs)(r.Box,{display:`flex`,gap:1,p:2,borderTop:1,borderColor:`divider`,children:[(0,i.jsx)(r.TextField,{ref:u,fullWidth:!0,multiline:!0,maxRows:4,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),d())},placeholder:o&&s?s:a,disabled:o||t,variant:`outlined`,size:`small`}),(0,i.jsx)(r.IconButton,{color:`primary`,onClick:d,disabled:!c.trim()||t||o,size:`large`,children:t?(0,i.jsx)(r.CircularProgress,{size:24}):(0,i.jsx)(si,{})})]})};function Qd({conversation:t,limit:r=50}){let i=e.p(t),[a,o]=(0,n.useState)(!1),[s,c]=(0,n.useState)(!1),[l,u]=(0,n.useState)(),d=Ld(()=>e.d.messages.where(`conversationId`).equals(i).sortBy(`created_at`),[i])||[],f=Ld(()=>e.d.msgCursor.where(`id`).equals(i).first(),[i]);return qd(async()=>{let n={limit:r};d.length&&(n.cursorType=`after`,n.cursorDatetime=d[d.length-1]?.created_at),o(!0),await e.c(t,n).catch(u),o(!1),await e.d.summaries.update(i,{unread_count:0})},[t,r]),console.log(`mw`,d.length),{messages:d,cursor:f,loading:a,error:l,loadMore:(0,n.useCallback)(async()=>{if(!(!f||s||a)){c(!0);try{let n={limit:r};if(!f?.datetime)return;n.cursorType=`before`,n.cursorDatetime=f.datetime,await e.c(t,n)}catch(e){console.error(`[useMessages] Failed to load more:`,e)}c(!1)}},[f,r,t,s,a]),loadingMore:s}}var $d=({conversation:t,user:a,isConnected:s,onBack:c})=>{let l=e.a();if(!l)return null;let{messages:u,cursor:d,loading:f,error:p,loadMore:m,loadingMore:h}=Qd({conversation:t}),g=Ld(async()=>t.type===`group`?await e.d.groups.get(t.id):null,[t.id,t.type]),_=a?.role===`admin`,v=a?.role===`moderator`,y=g?.is_member??!0,b=g?.system??!1,x=_&&t.type===`group`&&!y,S=t.type===`group`&&!y,C=t.type===`group`&&(_||y),w=t.type===`group`&&!b&&(_||v&&y),T=_&&t.type===`group`&&!b,[ee,te]=(0,n.useState)(!1),[ne,E]=(0,n.useState)(!1),[D,O]=(0,n.useState)(``),[k,A]=(0,n.useState)(!1),[j,M]=(0,n.useState)(null),N=()=>{O(t.name||``),M(null),E(!0)},P=async()=>{if(D.trim()){A(!0),M(null);try{await Pd(a.org,t.id,D.trim()),E(!1)}catch(e){M(o(e,`Failed to rename group`))}finally{A(!1)}}},[re,ie]=(0,n.useState)(!1),[ae,F]=(0,n.useState)(!1),[oe,se]=(0,n.useState)(null),I=async()=>{ie(!1),F(!0),se(null);try{await Fd(a.org,t.id)}catch(e){se(o(e,`Failed to delete group`)),F(!1)}},[ce,le]=(0,n.useState)(!1),[ue,de]=(0,n.useState)(!1),L=async n=>{if(t.type===`group`){le(!0);try{await l.joinGroup(a.org,t.id,n),de(!0),await Nd(a.org),await e.t({}),setTimeout(()=>de(!1),3e3)}catch(e){he(o(e,`Failed to join group`))}le(!1)}},[fe,pe]=(0,n.useState)(!1),[me,he]=(0,n.useState)(null),[ge,_e]=(0,n.useState)(!1);return(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,height:`100%`,children:[(0,i.jsx)(zd,{displayName:t.name||`Chat`,type:t.type,isConnected:s,onBack:c,showJoinButton:x,onJoin:L,joining:ce,showMembersButton:C,onManageMembers:()=>te(!0),canManageGroup:T,onRenameGroup:N,onDeleteGroup:()=>ie(!0),deletingGroup:ae}),C&&(0,i.jsx)(Hd,{open:ee,onClose:()=>te(!1),orgId:a.org,groupId:t.id,currentUserId:a.id,canManage:w}),(0,i.jsxs)(r.Dialog,{open:ne,onClose:()=>E(!1),fullWidth:!0,maxWidth:`xs`,children:[(0,i.jsx)(r.DialogTitle,{children:`Rename Group`}),(0,i.jsx)(r.DialogContent,{children:(0,i.jsx)(r.TextField,{autoFocus:!0,fullWidth:!0,label:`Group name`,value:D,onChange:e=>O(e.target.value),onKeyDown:e=>e.key===`Enter`&&P(),error:!!j,helperText:j?.message,sx:{mt:1}})}),(0,i.jsxs)(r.DialogActions,{children:[(0,i.jsx)(r.Button,{onClick:()=>E(!1),children:`Cancel`}),(0,i.jsx)(r.Button,{onClick:P,disabled:k||!D.trim(),variant:`contained`,children:k?`Renaming...`:`Rename`})]})]}),(0,i.jsxs)(r.Dialog,{open:re,onClose:()=>ie(!1),maxWidth:`xs`,fullWidth:!0,children:[(0,i.jsx)(r.DialogTitle,{children:`Delete Group`}),(0,i.jsx)(r.DialogContent,{children:`Are you sure you want to delete this group? This action cannot be undone.`}),(0,i.jsxs)(r.DialogActions,{children:[(0,i.jsx)(r.Button,{onClick:()=>ie(!1),children:`Cancel`}),(0,i.jsx)(r.Button,{onClick:I,disabled:ae,color:`error`,variant:`contained`,children:ae?`Deleting...`:`Delete`})]})]}),oe&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>se(null),children:oe.message}),(0,i.jsx)(r.Snackbar,{open:ue,autoHideDuration:3e3,onClose:()=>de(!1),message:`Successfully joined group`}),me&&(0,i.jsx)(r.Alert,{severity:`error`,onClose:()=>he(null),children:me.message}),(0,i.jsx)(Xd,{messages:u,currentUserId:a?.id||0,loading:f,error:p,autoScroll:!0,hasMore:!!d?.datetime,loadingMore:h,onLoadMore:m,forceScrollToBottom:ge}),S?(0,i.jsx)(r.Alert,{severity:`warning`,sx:{m:2},children:`You must be a group member to send messages`}):(0,i.jsx)(Zd,{onSend:async n=>{if(!n.trim())return;pe(!0),he(null),_e(!0);let r=`temp-${Date.now()}-${Math.random()}`,i={id:r,sender:a?.id,receiver:t.type===`dm`?t.id:null,group:t.type===`group`?t.id:null,content:n,created_at:new Date().toISOString(),conversationId:e.p(t)};try{await e.d.messages.put(i),await(t.type===`group`?l.sendGroupMessage:l.sendDM).bind(l)(t.id,n),await e.d.messages.delete(r)}catch(e){he(o(e,`Failed to send message`))}pe(!1),setTimeout(()=>_e(!1),100)},sending:fe,disabled:!s,disableReason:s?void 0:`You're offline. You need to be online to send messages`})]})},ef=class extends n.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught an error:`,e,t),this.props.onError?.(e,t)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,i.jsxs)(r.Box,{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:`100%`,p:3,children:[(0,i.jsxs)(r.Alert,{severity:`error`,sx:{mb:2,maxWidth:500},children:[(0,i.jsx)(r.Typography,{variant:`h6`,gutterBottom:!0,children:`Something went wrong`}),(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,children:this.state.error?.message||`An unexpected error occurred`})]}),(0,i.jsx)(r.Button,{variant:`contained`,startIcon:(0,i.jsx)(ai,{}),onClick:this.handleReset,children:`Try Again`})]}):this.props.children}};function tf({onMessage:t,onConnect:r,onDisconnect:i,onError:a}={}){let[o,s]=(0,n.useState)(!1),c=(0,n.useCallback)(e=>{t?.(e)},[t]),l=(0,n.useCallback)(()=>{s(!0),r?.()},[r]),u=(0,n.useCallback)(()=>{s(!1),i?.()},[i]),d=(0,n.useCallback)(e=>{a?.(e)},[a]);return(0,n.useEffect)(()=>{if(e.s())try{let t=e.a();return t?(s(t.isConnected()),t.on(`message`,c),t.on(`open`,l),t.on(`close`,u),t.on(`error`,d),()=>{t.off(`message`,c),t.off(`open`,l),t.off(`close`,u),t.off(`error`,d)}):void 0}catch(e){console.error(`Failed to setup WebSocket listeners:`,e)}},[c,l,u,d]),{isConnected:o}}var nf=({initialConversation:t})=>{let[a,o]=(0,n.useState)(t??null),[s,c]=(0,n.useState)(),[l,u]=(0,n.useState)(!0),[d,f]=(0,n.useState)(()=>e.a()),p=(0,n.useCallback)(e=>()=>u(e),[]);return(0,n.useEffect)(()=>{d||e.a(f)},[d]),qd(async()=>{if(!d)return;let t=await d.getMe();c(t),e.d.users.put(t)},[d]),tf({onError:p(!1),onConnect:p(!0),onDisconnect:p(!1)}),d?(0,i.jsxs)(r.Box,{display:`flex`,height:`100%`,overflow:`hidden`,children:[(0,i.jsx)(r.Box,{sx:{width:{xs:`100%`,sm:`100%`,md:`320px`},flexShrink:0,border:`0px solid`,borderRightWidth:{xs:0,md:1},borderColor:`divider`,overflow:`hidden`,display:{xs:a?`none`:`flex`,sm:a?`none`:`flex`,md:`flex`},flexDirection:`column`},children:(0,i.jsx)(ef,{children:(0,i.jsx)(Rd,{currentUser:s,selectedConversation:a,onConversationSelect:t=>{o(t),e.n(e.p(t))}})})}),(0,i.jsx)(r.Box,{sx:{flex:1,overflow:`hidden`,display:{xs:a?`flex`:`none`,sm:a?`flex`:`none`,md:`flex`},flexDirection:`column`},children:a?(0,i.jsx)(ef,{children:(0,i.jsx)($d,{conversation:a,user:s,isConnected:l,onBack:()=>{o(null),e.n(null)}})}):(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,color:`text.secondary`,children:`Select a conversation to start chatting`})})]}):(0,i.jsx)(r.Box,{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,children:(0,i.jsx)(r.CircularProgress,{})})},rf=({count:e,children:t,max:n=99})=>(0,i.jsx)(r.Badge,{badgeContent:e,color:`error`,max:n,overlap:`rectangular`,sx:{"& .MuiBadge-badge":{right:8,top:`50%`,transform:`translateY(-50%)`}},children:t});function af(){return Ld(()=>e.d.summaries.toArray().then(e=>e.reduce((e,t)=>e+t.unread_count,0)),[],void 0)}var of={SUMMARIES:300*1e3,USER:3600*1e3,MESSAGES:1/0},sf=()=>typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches,cf={mode:`dark`,background:{paper:`#3d3d43`,default:`#333338`},text:{primary:`#eee`,secondary:`#aaa`}},lf={mode:`light`,background:{default:`#f5f5f5`,paper:`#ffff`}},uf=e=>{let t=sf(),n=(e||(t?`dark`:`light`))===`dark`;return Mr({palette:{...n?cf:lf,primary:{main:`#E91E63`,light:`#F48FB1`,dark:`#AD1457`,contrastText:`#fff`},secondary:{main:`#e4e6eb`,light:`#f0f2f5`,dark:`#b0b3b8`,contrastText:`rgba(0, 0, 0, 0.87)`},error:{main:`#d32f2f`,light:`#ef5350`,dark:`#c62828`,contrastText:`#fff`},warning:{main:`#ed6c02`,light:`#ff9800`,dark:`#e65100`,contrastText:`#fff`},info:{main:`#0288d1`,light:`#03a9f4`,dark:`#01579b`,contrastText:`#fff`},success:{main:`#2e7d32`,light:`#4caf50`,dark:`#1b5e20`,contrastText:`#fff`}},typography:{fontFamily:[`-apple-system`,`BlinkMacSystemFont`,`"Segoe UI"`,`Roboto`,`"Helvetica Neue"`,`Arial`,`sans-serif`,`"Apple Color Emoji"`,`"Segoe UI Emoji"`,`"Segoe UI Symbol"`].join(`,`),fontSize:14,h1:{fontSize:`2.5rem`,fontWeight:500},h2:{fontSize:`2rem`,fontWeight:500},h3:{fontSize:`1.75rem`,fontWeight:500},h4:{fontSize:`1.5rem`,fontWeight:500},h5:{fontSize:`1.25rem`,fontWeight:500},h6:{fontSize:`1rem`,fontWeight:500},body1:{fontSize:`0.9375rem`,lineHeight:1.4},body2:{fontSize:`0.8125rem`,lineHeight:1.4}},shape:{borderRadius:12},components:{MuiButton:{styleOverrides:{root:{textTransform:`none`,fontWeight:500,borderRadius:20}}},MuiIconButton:{styleOverrides:{root:{borderRadius:`50%`}}},MuiPaper:{styleOverrides:{root:{backgroundImage:`none`},rounded:{borderRadius:12}}},MuiBadge:{styleOverrides:{badge:{fontSize:`0.6875rem`,height:18,minWidth:18,borderRadius:9,fontWeight:600}}},MuiCssBaseline:{styleOverrides:{body:{"*::-webkit-scrollbar":{width:`8px`,height:`8px`},"*::-webkit-scrollbar-track":{background:`undo`,borderRadius:`4px`},"*::-webkit-scrollbar-thumb":{background:`undo`,borderRadius:`4px`,"&:hover":{background:`undo`}},scrollbarWidth:`thin`,scrollbarColor:n?`#6a6a6e #333338`:`#c1c1c1 #f5f5f5`}}}}})},df=uf();exports.CACHE_TTL=of,exports.ChatApp=l,exports.ChatContainer=nf,exports.ChatHeader=zd,exports.ChatWindow=$d,exports.ConversationItem=fi,exports.ConversationItemSkeleton=pi,exports.ConversationList=Rd,exports.CreateGroupDialog=Md,exports.ErrorBoundary=ef,exports.LoadMoreTrigger=Kd,exports.MessageBubble=Wd,exports.MessageInput=Zd,exports.MessageList=Xd,exports.MessageSkeleton=Gd,exports.UnreadBadge=rf,exports.db=e.d,exports.disconnectSDK=e.i,exports.fetchSummaries=e.t,exports.getSDK=e.a,exports.getTheme=uf,exports.initSDK=e.o,exports.isSDKInitialized=e.s,exports.theme=df,exports.useMessages=Qd,exports.useSenderNames=Yd,exports.useUnreadCount=af,exports.useWebSocket=tf;
|