@qonsoll/chat-core
Version:
Library with core logic for chat
15 lines (14 loc) • 21 kB
JavaScript
import{createContext as e,useContext as t,useReducer as r,useEffect as n,useMemo as o,useState as a}from"react";import{_ as i,P as s,a as c,b as u,c as f}from"./Proxy.js";import{jsx as l}from"react/jsx-runtime";import p from"firebase";import d from"lodash";import y from"moment";import{e as v,c as m,d as h,C as b}from"./constants.js";var g=e(),S=e((function(){}));function E(){var e=t(g);if(void 0===e)throw new Error("useChatContext must be used within a ChatsContext.Provider");return e}function w(){var e=t(S);if(void 0===e)throw new Error("useChatDispatch must be used within a ChatDispatchContext.Provider");return e}function O(){return[E(),w()]}var T={exports:{}},_={exports:{}},C={},x="function"==typeof Symbol&&Symbol.for,P=x?Symbol.for("react.element"):60103,D=x?Symbol.for("react.portal"):60106,I=x?Symbol.for("react.fragment"):60107,j=x?Symbol.for("react.strict_mode"):60108,M=x?Symbol.for("react.profiler"):60114,$=x?Symbol.for("react.provider"):60109,A=x?Symbol.for("react.context"):60110,N=x?Symbol.for("react.async_mode"):60111,R=x?Symbol.for("react.concurrent_mode"):60111,k=x?Symbol.for("react.forward_ref"):60112,L=x?Symbol.for("react.suspense"):60113,U=x?Symbol.for("react.suspense_list"):60120,V=x?Symbol.for("react.memo"):60115,F=x?Symbol.for("react.lazy"):60116,q=x?Symbol.for("react.block"):60121,W=x?Symbol.for("react.fundamental"):60117,z=x?Symbol.for("react.responder"):60118,B=x?Symbol.for("react.scope"):60119;function G(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case P:switch(e=e.type){case N:case R:case I:case M:case j:case L:return e;default:switch(e=e&&e.$$typeof){case A:case k:case F:case V:case $:return e;default:return t}}case D:return t}}}function H(e){return G(e)===R}C.AsyncMode=N,C.ConcurrentMode=R,C.ContextConsumer=A,C.ContextProvider=$,C.Element=P,C.ForwardRef=k,C.Fragment=I,C.Lazy=F,C.Memo=V,C.Portal=D,C.Profiler=M,C.StrictMode=j,C.Suspense=L,C.isAsyncMode=function(e){return H(e)||G(e)===N},C.isConcurrentMode=H,C.isContextConsumer=function(e){return G(e)===A},C.isContextProvider=function(e){return G(e)===$},C.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===P},C.isForwardRef=function(e){return G(e)===k},C.isFragment=function(e){return G(e)===I},C.isLazy=function(e){return G(e)===F},C.isMemo=function(e){return G(e)===V},C.isPortal=function(e){return G(e)===D},C.isProfiler=function(e){return G(e)===M},C.isStrictMode=function(e){return G(e)===j},C.isSuspense=function(e){return G(e)===L},C.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===I||e===R||e===M||e===j||e===L||e===U||"object"==typeof e&&null!==e&&(e.$$typeof===F||e.$$typeof===V||e.$$typeof===$||e.$$typeof===A||e.$$typeof===k||e.$$typeof===W||e.$$typeof===z||e.$$typeof===B||e.$$typeof===q)},C.typeOf=G;var Y={};
/** @license React v16.13.1
* react-is.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,d=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,h=e?Symbol.for("react.responder"):60118,b=e?Symbol.for("react.scope"):60119;function g(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:var v=e.type;switch(v){case c:case u:case n:case a:case o:case l:return v;default:var m=v&&v.$$typeof;switch(m){case s:case f:case y:case d:case i:return m;default:return p}}case r:return p}}}var S=c,E=u,w=s,O=i,T=t,_=f,C=n,x=y,P=d,D=r,I=a,j=o,M=l,$=!1;function A(e){return g(e)===u}Y.AsyncMode=S,Y.ConcurrentMode=E,Y.ContextConsumer=w,Y.ContextProvider=O,Y.Element=T,Y.ForwardRef=_,Y.Fragment=C,Y.Lazy=x,Y.Memo=P,Y.Portal=D,Y.Profiler=I,Y.StrictMode=j,Y.Suspense=M,Y.isAsyncMode=function(e){return $||($=!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.")),A(e)||g(e)===c},Y.isConcurrentMode=A,Y.isContextConsumer=function(e){return g(e)===s},Y.isContextProvider=function(e){return g(e)===i},Y.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Y.isForwardRef=function(e){return g(e)===f},Y.isFragment=function(e){return g(e)===n},Y.isLazy=function(e){return g(e)===y},Y.isMemo=function(e){return g(e)===d},Y.isPortal=function(e){return g(e)===r},Y.isProfiler=function(e){return g(e)===a},Y.isStrictMode=function(e){return g(e)===o},Y.isSuspense=function(e){return g(e)===l},Y.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===u||e===a||e===o||e===l||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===i||e.$$typeof===s||e.$$typeof===f||e.$$typeof===m||e.$$typeof===h||e.$$typeof===b||e.$$typeof===v)},Y.typeOf=g}(),"production"===process.env.NODE_ENV?_.exports=C:_.exports=Y
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/;var J=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;function X(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var Z=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(e){o[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,n,o=X(e),a=1;a<arguments.length;a++){for(var i in r=Object(arguments[a]))K.call(r,i)&&(o[i]=r[i]);if(J){n=J(r);for(var s=0;s<n.length;s++)Q.call(r,n[s])&&(o[n[s]]=r[n[s]])}}return o},ee="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",te=Function.call.bind(Object.prototype.hasOwnProperty),re=function(){};if("production"!==process.env.NODE_ENV){var ne=ee,oe={},ae=te;re=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function ie(e,t,r,n,o){if("production"!==process.env.NODE_ENV)for(var a in e)if(ae(e,a)){var i;try{if("function"!=typeof e[a]){var s=Error((n||"React class")+": "+r+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw s.name="Invariant Violation",s}i=e[a](t,a,n,r,null,ne)}catch(e){i=e}if(!i||i instanceof Error||re((n||"React class")+": type specification of "+r+" `"+a+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof i+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),i instanceof Error&&!(i.message in oe)){oe[i.message]=!0;var c=o?o():"";re("Failed "+r+" type: "+i.message+(null!=c?c:""))}}}ie.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(oe={})};var se=ie,ce=_.exports,ue=Z,fe=ee,le=te,pe=se,de=function(){};function ye(){return null}"production"!==process.env.NODE_ENV&&(de=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}});function ve(){}function me(){}me.resetWarningCache=ve;if("production"!==process.env.NODE_ENV){var he=_.exports;T.exports=function(e,t){var r="function"==typeof Symbol&&Symbol.iterator,n="<<anonymous>>",o={array:c("array"),bigint:c("bigint"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:s(ye),arrayOf:function(e){return s((function(t,r,n,o,a){if("function"!=typeof e)return new i("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var s=t[r];if(!Array.isArray(s))return new i("Invalid "+o+" `"+a+"` of type `"+l(s)+"` supplied to `"+n+"`, expected an array.");for(var c=0;c<s.length;c++){var u=e(s,c,n,o,a+"["+c+"]",fe);if(u instanceof Error)return u}return null}))},element:s((function(t,r,n,o,a){var s=t[r];return e(s)?null:new i("Invalid "+o+" `"+a+"` of type `"+l(s)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:s((function(e,t,r,n,o){var a=e[t];return ce.isValidElementType(a)?null:new i("Invalid "+n+" `"+o+"` of type `"+l(a)+"` supplied to `"+r+"`, expected a single ReactElement type.")})),instanceOf:function(e){return s((function(t,r,o,a,s){if(!(t[r]instanceof e)){var c=e.name||n;return new i("Invalid "+a+" `"+s+"` of type `"+((u=t[r]).constructor&&u.constructor.name?u.constructor.name:n)+"` supplied to `"+o+"`, expected instance of `"+c+"`.")}var u;return null}))},node:s((function(e,t,r,n,o){return f(e[t])?null:new i("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return s((function(t,r,n,o,a){if("function"!=typeof e)return new i("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var s=t[r],c=l(s);if("object"!==c)return new i("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected an object.");for(var u in s)if(le(s,u)){var f=e(s,u,n,o,a+"."+u,fe);if(f instanceof Error)return f}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&de(arguments.length>1?"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]).":"Invalid argument supplied to oneOf, expected an array."),ye;function t(t,r,n,o,s){for(var c=t[r],u=0;u<e.length;u++)if(a(c,e[u]))return null;var f=JSON.stringify(e,(function(e,t){return"symbol"===p(t)?String(t):t}));return new i("Invalid "+o+" `"+s+"` of value `"+String(c)+"` supplied to `"+n+"`, expected one of "+f+".")}return s(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&de("Invalid argument supplied to oneOfType, expected an instance of array."),ye;for(var t=0;t<e.length;t++){var r=e[t];if("function"!=typeof r)return de("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+d(r)+" at index "+t+"."),ye}return s((function(t,r,n,o,a){for(var s=[],c=0;c<e.length;c++){var u=(0,e[c])(t,r,n,o,a,fe);if(null==u)return null;u.data&&le(u.data,"expectedType")&&s.push(u.data.expectedType)}return new i("Invalid "+o+" `"+a+"` supplied to `"+n+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return s((function(t,r,n,o,a){var s=t[r],c=l(s);if("object"!==c)return new i("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");for(var f in e){var d=e[f];if("function"!=typeof d)return u(n,o,a,f,p(d));var y=d(s,f,n,o,a+"."+f,fe);if(y)return y}return null}))},exact:function(e){return s((function(t,r,n,o,a){var s=t[r],c=l(s);if("object"!==c)return new i("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");var f=ue({},t[r],e);for(var d in f){var y=e[d];if(le(e,d)&&"function"!=typeof y)return u(n,o,a,d,p(y));if(!y)return new i("Invalid "+o+" `"+a+"` key `"+d+"` supplied to `"+n+"`.\nBad object: "+JSON.stringify(t[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var v=y(s,d,n,o,a+"."+d,fe);if(v)return v}return null}))}};function a(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function i(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function s(e){if("production"!==process.env.NODE_ENV)var r={},o=0;function a(a,s,c,u,f,l,p){if(u=u||n,l=l||c,p!==fe){if(t){var d=new 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 d.name="Invariant Violation",d}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var y=u+":"+c;!r[y]&&o<3&&(de("You are manually calling a React.PropTypes validation function for the `"+l+"` prop on `"+u+"`. 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."),r[y]=!0,o++)}}return null==s[c]?a?null===s[c]?new i("The "+f+" `"+l+"` is marked as required in `"+u+"`, but its value is `null`."):new i("The "+f+" `"+l+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(s,c,u,f,l)}var s=a.bind(null,!1);return s.isRequired=a.bind(null,!0),s}function c(e){return s((function(t,r,n,o,a,s){var c=t[r];return l(c)!==e?new i("Invalid "+o+" `"+a+"` of type `"+p(c)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null}))}function u(e,t,r,n,o){return new i((e||"React class")+": "+t+" type `"+r+"."+n+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function f(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(f);if(null===t||e(t))return!0;var n=function(e){var t=e&&(r&&e[r]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!n)return!1;var o,a=n.call(t);if(n!==t.entries){for(;!(o=a.next()).done;)if(!f(o.value))return!1}else for(;!(o=a.next()).done;){var i=o.value;if(i&&!f(i[1]))return!1}return!0;default:return!1}}function l(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function p(e){if(null==e)return""+e;var t=l(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function d(e){var t=p(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return i.prototype=Error.prototype,o.checkPropTypes=pe,o.resetWarningCache=pe.resetWarningCache,o.PropTypes=o,o}(he.isElement,!0)}else T.exports=function(){function e(e,t,r,n,o,a){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==a){var i=new 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 i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var r={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:me,resetWarningCache:ve};return r.PropTypes=r,r}();var be=T.exports,ge={isMassageDeleting:!1},Se=e(ge),Ee=e((function(){})),we=function(e,t){return t.type===v.MESSAGE_DELETED?i(i({},e),{isMassageDeleting:t.payload}):ge},Oe=function(e){var t=e.children,n=r(we,ge),o=n[0],a=n[1];return l(Ee.Provider,i({value:a},{children:l(Se.Provider,i({value:o},{children:t}))}))};Oe.propTypes={children:be.oneOfType([be.arrayOf(be.element),be.element])};var Te=function(e,t){var r,n=i({},e);switch(t.type){case m.DELETE_CHAT:var o=t.payload.chatId;return n.currentChatData={},d.remove(n.chats,(function(e){var t=e.currentChatId;return o===t})),i({},n);case m.UPDATE_CHAT_DATA:var a=t.payload,s=a.chatId,c=a.chatData,u=n.chats.findIndex((function(e){var t=e.chatId;return s===t}));return-1!==u?(n.chats[u]=i(i({},n.chats[u]),c),n.currentChatId===s&&(n.currentChatData=i(i({},n.currentChatData),c))):(n.chats.push(c),n.currentChatId===s&&(n.currentChatData=c)),n.chats=n.chats.sort((function(e,t){var r,n;return y(null===(r=null==t?void 0:t.lastMessageDateAndTime)||void 0===r?void 0:r.toDate()).diff(y(null===(n=null==e?void 0:e.lastMessageDateAndTime)||void 0===n?void 0:n.toDate()))})),i({},n);case m.SET_CURRENT_CHAT_ID:var f=t.payload.chatId;return i(i({},e),{currentChatId:f,currentChatData:(null===(r=e.chats)||void 0===r?void 0:r.find((function(e){return e.chatId===f})))||{}});case m.CLEAR_CHATS:var l=i({},e);return d.remove(l.chats,(function(e){return e.oppositeUserId!==t.payload.oppositeUserId})),l.currentChatData={},i({},l);default:return{}}},_e=function(e){var t=e.children,o=e.oppositeUser,a=e.userData,c=e.onSendNotification,u=e.onUpdateMessageStatus,f=r(Te,{currentChatId:null,currentChatData:{},chats:[]}),p=f[0],d=f[1];return n((function(){s.setUserData(a),s.setCreateNotification(c),s.setUpdateMessageStatus(u)}),[a]),l(Oe,{children:l(S.Provider,i({value:d},{children:l(g.Provider,i({value:i({oppositeUserData:null==o?void 0:o.data,oppositeUserDataLoading:null==o?void 0:o.loading},p)},{children:t}))}))})};_e.propTypes={children:be.oneOfType([be.arrayOf(be.element),be.element]),oppositeUser:be.shape({data:be.object,loading:be.bool}).isRequired,userData:be.object.isRequired,onSendNotification:be.func,onUpdateMessageStatus:be.func};var Ce={messages:[],isEndOfList:!1,isInitLoading:!0},xe=e(Ce),Pe=e((function(){return{}}));function De(){var e=t(xe);if(void 0===e)throw new Error("useMessagesContext must be used within a MessagesContext.Provider");return e}function Ie(){var e=t(Pe);if(void 0===e)throw new Error("useMessagesDispatch must be used within a MessagesContext.Provider");return e}function je(){return[De(),Ie()]}var Me=function(e,t){switch(t.type){case h.SET_END_OF_LIST:return i(i({},e),{isEndOfList:t.payload});case h.SET_MESSAGES:var r=t.payload,n=r.newFetchedMessages,o=r.deletedMessageId,a=i({},e),s=d.uniqBy(c(c([],n,!0),e.messages,!0),"_id");return o&&(s=s.filter((function(e){return(null==e?void 0:e._id)!==o}))),a.isInitLoading&&(a.isInitLoading=!1),i(i({},a),{messages:s.sort((function(e,t){var r,n;return y(null===(r=null==e?void 0:e._createdAt)||void 0===r?void 0:r.toDate()).diff(y(null===(n=null==t?void 0:t._createdAt)||void 0===n?void 0:n.toDate()))}))});case h.SET_INIT_LOADING:return i(i({},e),{isInitLoading:t.payload});case h.CLEAR_MESSAGES:default:return Ce}},$e=function(){var e=E().currentChatData;return o((function(){return e}),[e])},Ae=b.MESSAGES,Ne=function(e){var t=e.children,n=$e(),o=n.chatId,a=n.collectionName,s=r(Me,Ce),y=s[0],v=s[1];return l(Pe.Provider,i({value:v},{children:l(xe.Provider,i({value:i(i({},y),{onUploadMessages:function(){return u(void 0,void 0,void 0,(function(){var e,t,r,n,i,s,u;return f(this,(function(f){switch(f.label){case 0:e=y.messages?c([],y.messages,!0):[],f.label=1;case 1:return f.trys.push([1,3,,4]),t=p.firestore().collection("".concat(a,"/").concat(o,"/").concat(Ae)),[4,t.orderBy("_createdAt","desc").startAfter(null===(s=e[0])||void 0===s?void 0:s._createdAt).limit(35).get()];case 2:return r=f.sent(),(n=null===(u=null==r?void 0:r.docs)||void 0===u?void 0:u.map((function(e){return e.data()}))).length?(i=d.uniqBy(c(c([],d.reverse(n),!0),e,!0),"_id"),v({type:h.SET_MESSAGES,payload:{newFetchedMessages:i}}),[2,{data:i,fetchedData:d.reverse(n)}]):(v({type:h.SET_END_OF_LIST,payload:!0}),[2,{fetchedData:[]}]);case 3:return f.sent(),console.error("error onUploadMessages"),[3,4];case 4:return[2]}}))}))}})},{children:t}))}))};function Re(){var e=t(Se);if(void 0===e)throw new Error("useMessageActionContext must be used within a MessageAction.Provider");return e}function ke(){var e=t(Ee);if(void 0===e)throw new Error("useMessageActionDispatch must be used within a MessageAction.Provider");return e}function Le(){return[Re(),ke()]}Ne.propTypes={children:be.oneOfType([be.arrayOf(be.element),be.element])};var Ue=e({selectedMessage:{}}),Ve=e((function(){}));function Fe(){var e=t(Ue);if(void 0===e)throw new Error("useSelectedMessageContext must be used within a SelectedMessageContext.Provider");return e}function qe(){var e=t(Ve);if(void 0===e)throw new Error("useSelectedMessageDispatch must be used within a SelectedMessageDispatchContext.Provider");return e}function We(){return[Fe(),qe()]}var ze=function(e){var t=e.children,r=a({selectedMessage:{}}),n=r[0],o=r[1];return l(Ve.Provider,i({value:o},{children:l(Ue.Provider,i({value:n},{children:t}))}))};ze.propTypes={children:be.oneOfType([be.arrayOf(be.element),be.element])};export{_e as C,Ce as D,Ne as M,ze as S,w as a,O as b,g as c,S as d,De as e,Ie as f,je as g,xe as h,Pe as i,Oe as j,Re as k,ke as l,Le as m,ge as n,Se as o,Ee as p,qe as q,Fe as r,We as s,Ue as t,E as u,Ve as v,$e as w};