@edusight/notification-widget 1.0.16 → 1.0.18

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.cjs.js CHANGED
@@ -11,7 +11,7 @@ Check the top-level render call using <`+A+">.")}return v}}function Er(s,v){{if(
11
11
  <%s {...props} />
12
12
  React keys must be passed directly to JSX without using spread:
13
13
  let props = %s;
14
- <%s key={someKey} {...props} />`,Ft,Be,to,Be),xr[Be+Ft]=!0}}return s===n?Jn(me):Hn(me),me}}function Xn(s,v,A){return Tr(s,v,A,!0)}function Qn(s,v,A){return Tr(s,v,A,!1)}var Zn=Qn,eo=Xn;rt.Fragment=n,rt.jsx=Zn,rt.jsxs=eo})()),rt}var _r;function co(){return _r||(_r=1,process.env.NODE_ENV==="production"?pt.exports=ao():pt.exports=so()),pt.exports}var T=co();function ln(e){const{service:t,tenantId:r,subscriberId:n,filters:o,pollInterval:i,autoFetch:c=!0}=e,[u,f]=J.useState([]),[d,m]=J.useState(c),[h,p]=J.useState(null),y=J.useCallback(async()=>{try{m(!0),p(null);const w={tenantId:r,subscriberId:n,limit:e?.maxNotifications,...o},C=await t.list(w);f(C)}catch(w){p(w instanceof Error?w:new Error("Failed to fetch notifications"))}finally{m(!1)}},[t,r,n,o,e?.maxNotifications]);J.useEffect(()=>{c&&y()},[c]),J.useEffect(()=>{if(i&&i>0){const w=setInterval(()=>{y()},i);return()=>clearInterval(w)}},[i,y]);const b=u.filter(w=>w.read!==!0).length,l=J.useCallback(async w=>{try{await t.markAsRead(w,n),f(C=>C.map(x=>x.notificationId===w?{...x,read:!0}:x))}catch(C){console.error("Failed to mark notification as read",C)}},[t,n]),O=J.useCallback(async w=>{try{await t.delete(w,n),f(C=>C.filter(x=>x.notificationId!==w))}catch(C){console.error("Failed to delete notification",C)}},[t,n]);return{notifications:u,loading:d,error:h,unreadCount:b,refresh:y,markAsRead:l,deleteNotification:O}}const lo="edusight:notification-widget:context";function uo(e){try{if(typeof window>"u"||!window.localStorage)return;window.localStorage.setItem(lo,JSON.stringify(e))}catch{}}class fo{constructor(t){this.listeners=new Map;const r={wsUrl:t.client.getWebSocketUrl(),tenantId:t.tenantId,subscriberId:t.subscriberId,environmentId:t.environmentId,path:t.path,namespace:t.namespace,autoAck:t.autoAck,transports:t.transports,reconnectionDelay:t.reconnectionDelay,reconnectionDelayMax:t.reconnectionDelayMax};this.config=t,this.context={tenantId:t.tenantId,subscriberId:t.subscriberId,environmentId:t.environmentId},this.socketClient=new Fe.NotificationSocketClient(r),this.socketClient.on("connect",()=>{uo({environmentId:t.environmentId,subscriberId:t.subscriberId,tenantId:t.tenantId}),this.emit("connect")}),this.socketClient.on("disconnect",n=>{this.emit("disconnect",n)}),this.socketClient.on("notification",n=>{this.emit("notification",this.normalizeNotification(n)),this.config.autoAck===!1&&this.ackNotification(n.notificationId)}),this.socketClient.on("ack",n=>{this.emit("ack",n)}),this.socketClient.on("error",n=>{this.emit("error",n)})}connect(){this.socketClient.connect()}disconnect(){this.socketClient.disconnect()}ackNotification(t){try{this.socketClient.ack(t)}catch(r){this.emit("error",r instanceof Error?r:new Error(String(r)))}}isConnected(){return this.socketClient.isConnected()}on(t,r){this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r)}off(t,r){this.listeners.get(t)?.delete(r)}emit(t,...r){const n=this.listeners.get(t);n&&n.forEach(o=>{try{o(...r)}catch(i){console.warn(`Error in ${t} handler:`,i)}})}normalizeNotification(t){const r=new Date().toISOString(),n=t.channel||Fe.Channel.IN_APP,o=t.renderedContent||{inApp:{title:t.title,message:t.message,action:t.action,icon:t.icon}},i=t.category??Fe.NotificationCategory.REAL_TIME;return{notificationId:t.notificationId,tenantId:this.context.tenantId,subscriberId:this.context.subscriberId,templateId:t.templateId??"",type:t.type||Fe.NotificationType.CUSTOM,category:i,channels:[n],payload:t.data||{},renderedContent:o,status:Fe.NotificationStatus.PENDING,priority:Fe.Priority.MEDIUM,scheduledFor:void 0,sentAt:void 0,retryCount:void 0,batchId:t.batchId,metadata:t.data,createdAt:t.createdAt??r,updatedAt:r,feedId:t.feedId}}}function un(e){const{client:t,tenantId:r,subscriberId:n,environmentId:o,enabled:i=!0,autoAck:c=!1,path:u}=e,[f,d]=J.useState(!1),[m,h]=J.useState(null),p=J.useRef(null);J.useEffect(()=>{if(!i)return;const C={client:t,tenantId:r,subscriberId:n,environmentId:o,autoAck:c,path:u},x=new fo(C);return x.on("connect",()=>{d(!0),h(null)}),x.on("disconnect",()=>{d(!1)}),x.on("error",R=>{h(R)}),p.current=x,x.connect(),()=>{x.disconnect(),p.current=null,d(!1)}},[t,r,n,o,i,c,u]);const y=J.useCallback(()=>{p.current?.connect()},[]),b=J.useCallback(()=>{p.current?.disconnect()},[]),l=J.useCallback(C=>{p.current?.ackNotification(C)},[]),O=J.useCallback(C=>p.current?(p.current.on("notification",C),()=>{p.current?.off("notification",C)}):()=>{},[]),w=J.useCallback(C=>p.current?(p.current.on("ack",C),()=>{p.current?.off("ack",C)}):()=>{},[]);return{connected:f,connect:y,disconnect:b,onNotification:O,onAck:w,ackNotification:l,error:m}}class po{constructor(t){this.client=t}async list(t){return(await this.client.notifications.list(t)).items||[]}async markAsRead(t,r){await this.client.notifications.markAsRead(t,r)}async delete(t,r){await this.client.notifications.delete(t,r)}}function fn(e){const{client:t,tenantId:r,subscriberId:n,environmentId:o,pollInterval:i,autoFetch:c,autoAck:u=!1,path:f}=e,m={service:J.useMemo(()=>new po(t),[t]),tenantId:r,subscriberId:n,pollInterval:i,autoFetch:c},h={client:t,tenantId:r,subscriberId:n,environmentId:o,enabled:!0,autoAck:u,path:f},p=ln(m),y=un(h),[b,l]=J.useState(p.notifications);return J.useEffect(()=>{l(p.notifications)},[p.notifications]),J.useEffect(()=>{const O=y.onNotification(C=>{l(x=>x.some(R=>R.notificationId===C.notificationId)?x:[C,...x]),y.ackNotification(C.notificationId)}),w=y.onAck(C=>{l(x=>x.map(R=>R.notificationId===C.notificationId?{...R,status:Fe.NotificationStatus.DELIVERED}:R))});return()=>{O(),w()}},[y]),{notifications:b,loading:p.loading,error:p.error,unreadCount:p.unreadCount,connected:y.connected,refresh:p.refresh,markAsRead:p.markAsRead,deleteNotification:p.deleteNotification}}var mt={exports:{}},ee={};var Rr;function mo(){if(Rr)return ee;Rr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.view_transition"),y=Symbol.for("react.client.reference");function b(l){if(typeof l=="object"&&l!==null){var O=l.$$typeof;switch(O){case e:switch(l=l.type,l){case r:case o:case n:case f:case d:case p:return l;default:switch(l=l&&l.$$typeof,l){case c:case u:case h:case m:return l;case i:return l;default:return O}}case t:return O}}}return ee.ContextConsumer=i,ee.ContextProvider=c,ee.Element=e,ee.ForwardRef=u,ee.Fragment=r,ee.Lazy=h,ee.Memo=m,ee.Portal=t,ee.Profiler=o,ee.StrictMode=n,ee.Suspense=f,ee.SuspenseList=d,ee.isContextConsumer=function(l){return b(l)===i},ee.isContextProvider=function(l){return b(l)===c},ee.isElement=function(l){return typeof l=="object"&&l!==null&&l.$$typeof===e},ee.isForwardRef=function(l){return b(l)===u},ee.isFragment=function(l){return b(l)===r},ee.isLazy=function(l){return b(l)===h},ee.isMemo=function(l){return b(l)===m},ee.isPortal=function(l){return b(l)===t},ee.isProfiler=function(l){return b(l)===o},ee.isStrictMode=function(l){return b(l)===n},ee.isSuspense=function(l){return b(l)===f},ee.isSuspenseList=function(l){return b(l)===d},ee.isValidElementType=function(l){return typeof l=="string"||typeof l=="function"||l===r||l===o||l===n||l===f||l===d||typeof l=="object"&&l!==null&&(l.$$typeof===h||l.$$typeof===m||l.$$typeof===c||l.$$typeof===i||l.$$typeof===u||l.$$typeof===y||l.getModuleId!==void 0)},ee.typeOf=b,ee}var te={};var Ar;function ho(){return Ar||(Ar=1,process.env.NODE_ENV!=="production"&&(function(){function e(l){if(typeof l=="object"&&l!==null){var O=l.$$typeof;switch(O){case t:switch(l=l.type,l){case n:case i:case o:case d:case m:case y:return l;default:switch(l=l&&l.$$typeof,l){case u:case f:case p:case h:return l;case c:return l;default:return O}}case r:return O}}}var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),y=Symbol.for("react.view_transition"),b=Symbol.for("react.client.reference");te.ContextConsumer=c,te.ContextProvider=u,te.Element=t,te.ForwardRef=f,te.Fragment=n,te.Lazy=p,te.Memo=h,te.Portal=r,te.Profiler=i,te.StrictMode=o,te.Suspense=d,te.SuspenseList=m,te.isContextConsumer=function(l){return e(l)===c},te.isContextProvider=function(l){return e(l)===u},te.isElement=function(l){return typeof l=="object"&&l!==null&&l.$$typeof===t},te.isForwardRef=function(l){return e(l)===f},te.isFragment=function(l){return e(l)===n},te.isLazy=function(l){return e(l)===p},te.isMemo=function(l){return e(l)===h},te.isPortal=function(l){return e(l)===r},te.isProfiler=function(l){return e(l)===i},te.isStrictMode=function(l){return e(l)===o},te.isSuspense=function(l){return e(l)===d},te.isSuspenseList=function(l){return e(l)===m},te.isValidElementType=function(l){return typeof l=="string"||typeof l=="function"||l===n||l===i||l===o||l===d||l===m||typeof l=="object"&&l!==null&&(l.$$typeof===p||l.$$typeof===h||l.$$typeof===u||l.$$typeof===c||l.$$typeof===f||l.$$typeof===b||l.getModuleId!==void 0)},te.typeOf=e})()),te}var kr;function go(){return kr||(kr=1,process.env.NODE_ENV==="production"?mt.exports=mo():mt.exports=ho()),mt.exports}var St=go();function Ae(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function dn(e){if(Pe.isValidElement(e)||St.isValidElementType(e)||!Ae(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=dn(e[r])}),t}function Ee(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return Ae(e)&&Ae(t)&&Object.keys(t).forEach(o=>{Pe.isValidElement(t[o])||St.isValidElementType(t[o])?n[o]=t[o]:Ae(t[o])&&Object.prototype.hasOwnProperty.call(e,o)&&Ae(e[o])?n[o]=Ee(e[o],t[o],r):r.clone?n[o]=Ae(t[o])?dn(t[o]):t[o]:n[o]=t[o]}),n}var ht={exports:{}},gt={exports:{}},Q={};var $r;function yo(){if($r)return Q;$r=1;var e=typeof Symbol=="function"&&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,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,y=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,l=e?Symbol.for("react.block"):60121,O=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function x(S){if(typeof S=="object"&&S!==null){var K=S.$$typeof;switch(K){case t:switch(S=S.type,S){case f:case d:case n:case i:case o:case h:return S;default:switch(S=S&&S.$$typeof,S){case u:case m:case b:case y:case c:return S;default:return K}}case r:return K}}}function R(S){return x(S)===d}return Q.AsyncMode=f,Q.ConcurrentMode=d,Q.ContextConsumer=u,Q.ContextProvider=c,Q.Element=t,Q.ForwardRef=m,Q.Fragment=n,Q.Lazy=b,Q.Memo=y,Q.Portal=r,Q.Profiler=i,Q.StrictMode=o,Q.Suspense=h,Q.isAsyncMode=function(S){return R(S)||x(S)===f},Q.isConcurrentMode=R,Q.isContextConsumer=function(S){return x(S)===u},Q.isContextProvider=function(S){return x(S)===c},Q.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===t},Q.isForwardRef=function(S){return x(S)===m},Q.isFragment=function(S){return x(S)===n},Q.isLazy=function(S){return x(S)===b},Q.isMemo=function(S){return x(S)===y},Q.isPortal=function(S){return x(S)===r},Q.isProfiler=function(S){return x(S)===i},Q.isStrictMode=function(S){return x(S)===o},Q.isSuspense=function(S){return x(S)===h},Q.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===n||S===d||S===i||S===o||S===h||S===p||typeof S=="object"&&S!==null&&(S.$$typeof===b||S.$$typeof===y||S.$$typeof===c||S.$$typeof===u||S.$$typeof===m||S.$$typeof===O||S.$$typeof===w||S.$$typeof===C||S.$$typeof===l)},Q.typeOf=x,Q}var Z={};var Pr;function bo(){return Pr||(Pr=1,process.env.NODE_ENV!=="production"&&(function(){var e=typeof Symbol=="function"&&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,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,y=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,l=e?Symbol.for("react.block"):60121,O=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function x(_){return typeof _=="string"||typeof _=="function"||_===n||_===d||_===i||_===o||_===h||_===p||typeof _=="object"&&_!==null&&(_.$$typeof===b||_.$$typeof===y||_.$$typeof===c||_.$$typeof===u||_.$$typeof===m||_.$$typeof===O||_.$$typeof===w||_.$$typeof===C||_.$$typeof===l)}function R(_){if(typeof _=="object"&&_!==null){var Ce=_.$$typeof;switch(Ce){case t:var Ye=_.type;switch(Ye){case f:case d:case n:case i:case o:case h:return Ye;default:var Me=Ye&&Ye.$$typeof;switch(Me){case u:case m:case b:case y:case c:return Me;default:return Ce}}case r:return Ce}}}var S=f,K=d,ae=u,re=c,Y=t,a=m,$=n,I=b,M=y,fe=r,ce=i,he=o,ve=h,De=!1;function ze(_){return De||(De=!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.")),E(_)||R(_)===f}function E(_){return R(_)===d}function k(_){return R(_)===u}function L(_){return R(_)===c}function F(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function j(_){return R(_)===m}function U(_){return R(_)===n}function D(_){return R(_)===b}function B(_){return R(_)===y}function V(_){return R(_)===r}function q(_){return R(_)===i}function W(_){return R(_)===o}function ge(_){return R(_)===h}Z.AsyncMode=S,Z.ConcurrentMode=K,Z.ContextConsumer=ae,Z.ContextProvider=re,Z.Element=Y,Z.ForwardRef=a,Z.Fragment=$,Z.Lazy=I,Z.Memo=M,Z.Portal=fe,Z.Profiler=ce,Z.StrictMode=he,Z.Suspense=ve,Z.isAsyncMode=ze,Z.isConcurrentMode=E,Z.isContextConsumer=k,Z.isContextProvider=L,Z.isElement=F,Z.isForwardRef=j,Z.isFragment=U,Z.isLazy=D,Z.isMemo=B,Z.isPortal=V,Z.isProfiler=q,Z.isStrictMode=W,Z.isSuspense=ge,Z.isValidElementType=x,Z.typeOf=R})()),Z}var Ir;function pn(){return Ir||(Ir=1,process.env.NODE_ENV==="production"?gt.exports=yo():gt.exports=bo()),gt.exports}var Lt,Nr;function vo(){if(Nr)return Lt;Nr=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var c={},u=0;u<10;u++)c["_"+String.fromCharCode(u)]=u;var f=Object.getOwnPropertyNames(c).map(function(m){return c[m]});if(f.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(m){d[m]=m}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Lt=o()?Object.assign:function(i,c){for(var u,f=n(i),d,m=1;m<arguments.length;m++){u=Object(arguments[m]);for(var h in u)t.call(u,h)&&(f[h]=u[h]);if(e){d=e(u);for(var p=0;p<d.length;p++)r.call(u,d[p])&&(f[d[p]]=u[d[p]])}}return f},Lt}var Vt,jr;function tr(){if(jr)return Vt;jr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Vt=e,Vt}var Wt,Dr;function mn(){return Dr||(Dr=1,Wt=Function.call.bind(Object.prototype.hasOwnProperty)),Wt}var zt,Mr;function So(){if(Mr)return zt;Mr=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=tr(),r={},n=mn();e=function(i){var c="Warning: "+i;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}}}function o(i,c,u,f,d){if(process.env.NODE_ENV!=="production"){for(var m in i)if(n(i,m)){var h;try{if(typeof i[m]!="function"){var p=Error((f||"React class")+": "+u+" type `"+m+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[m]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}h=i[m](c,m,f,u,null,t)}catch(b){h=b}if(h&&!(h instanceof Error)&&e((f||"React class")+": type specification of "+u+" `"+m+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in r)){r[h.message]=!0;var y=d?d():"";e("Failed "+u+" type: "+h.message+(y??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},zt=o,zt}var Yt,Br;function Eo(){if(Br)return Yt;Br=1;var e=pn(),t=vo(),r=tr(),n=mn(),o=So(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(u){var f="Warning: "+u;typeof console<"u"&&console.error(f);try{throw new Error(f)}catch{}});function c(){return null}return Yt=function(u,f){var d=typeof Symbol=="function"&&Symbol.iterator,m="@@iterator";function h(E){var k=E&&(d&&E[d]||E[m]);if(typeof k=="function")return k}var p="<<anonymous>>",y={array:w("array"),bigint:w("bigint"),bool:w("boolean"),func:w("function"),number:w("number"),object:w("object"),string:w("string"),symbol:w("symbol"),any:C(),arrayOf:x,element:R(),elementType:S(),instanceOf:K,node:a(),objectOf:re,oneOf:ae,oneOfType:Y,shape:I,exact:M};function b(E,k){return E===k?E!==0||1/E===1/k:E!==E&&k!==k}function l(E,k){this.message=E,this.data=k&&typeof k=="object"?k:{},this.stack=""}l.prototype=Error.prototype;function O(E){if(process.env.NODE_ENV!=="production")var k={},L=0;function F(U,D,B,V,q,W,ge){if(V=V||p,W=W||B,ge!==r){if(f){var _=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 _.name="Invariant Violation",_}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var Ce=V+":"+B;!k[Ce]&&L<3&&(i("You are manually calling a React.PropTypes validation function for the `"+W+"` prop on `"+V+"`. 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."),k[Ce]=!0,L++)}}return D[B]==null?U?D[B]===null?new l("The "+q+" `"+W+"` is marked as required "+("in `"+V+"`, but its value is `null`.")):new l("The "+q+" `"+W+"` is marked as required in "+("`"+V+"`, but its value is `undefined`.")):null:E(D,B,V,q,W)}var j=F.bind(null,!1);return j.isRequired=F.bind(null,!0),j}function w(E){function k(L,F,j,U,D,B){var V=L[F],q=he(V);if(q!==E){var W=ve(V);return new l("Invalid "+U+" `"+D+"` of type "+("`"+W+"` supplied to `"+j+"`, expected ")+("`"+E+"`."),{expectedType:E})}return null}return O(k)}function C(){return O(c)}function x(E){function k(L,F,j,U,D){if(typeof E!="function")return new l("Property `"+D+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var B=L[F];if(!Array.isArray(B)){var V=he(B);return new l("Invalid "+U+" `"+D+"` of type "+("`"+V+"` supplied to `"+j+"`, expected an array."))}for(var q=0;q<B.length;q++){var W=E(B,q,j,U,D+"["+q+"]",r);if(W instanceof Error)return W}return null}return O(k)}function R(){function E(k,L,F,j,U){var D=k[L];if(!u(D)){var B=he(D);return new l("Invalid "+j+" `"+U+"` of type "+("`"+B+"` supplied to `"+F+"`, expected a single ReactElement."))}return null}return O(E)}function S(){function E(k,L,F,j,U){var D=k[L];if(!e.isValidElementType(D)){var B=he(D);return new l("Invalid "+j+" `"+U+"` of type "+("`"+B+"` supplied to `"+F+"`, expected a single ReactElement type."))}return null}return O(E)}function K(E){function k(L,F,j,U,D){if(!(L[F]instanceof E)){var B=E.name||p,V=ze(L[F]);return new l("Invalid "+U+" `"+D+"` of type "+("`"+V+"` supplied to `"+j+"`, expected ")+("instance of `"+B+"`."))}return null}return O(k)}function ae(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("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])."):i("Invalid argument supplied to oneOf, expected an array.")),c;function k(L,F,j,U,D){for(var B=L[F],V=0;V<E.length;V++)if(b(B,E[V]))return null;var q=JSON.stringify(E,function(ge,_){var Ce=ve(_);return Ce==="symbol"?String(_):_});return new l("Invalid "+U+" `"+D+"` of value `"+String(B)+"` "+("supplied to `"+j+"`, expected one of "+q+"."))}return O(k)}function re(E){function k(L,F,j,U,D){if(typeof E!="function")return new l("Property `"+D+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var B=L[F],V=he(B);if(V!=="object")return new l("Invalid "+U+" `"+D+"` of type "+("`"+V+"` supplied to `"+j+"`, expected an object."));for(var q in B)if(n(B,q)){var W=E(B,q,j,U,D+"."+q,r);if(W instanceof Error)return W}return null}return O(k)}function Y(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),c;for(var k=0;k<E.length;k++){var L=E[k];if(typeof L!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+De(L)+" at index "+k+"."),c}function F(j,U,D,B,V){for(var q=[],W=0;W<E.length;W++){var ge=E[W],_=ge(j,U,D,B,V,r);if(_==null)return null;_.data&&n(_.data,"expectedType")&&q.push(_.data.expectedType)}var Ce=q.length>0?", expected one of type ["+q.join(", ")+"]":"";return new l("Invalid "+B+" `"+V+"` supplied to "+("`"+D+"`"+Ce+"."))}return O(F)}function a(){function E(k,L,F,j,U){return fe(k[L])?null:new l("Invalid "+j+" `"+U+"` supplied to "+("`"+F+"`, expected a ReactNode."))}return O(E)}function $(E,k,L,F,j){return new l((E||"React class")+": "+k+" type `"+L+"."+F+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function I(E){function k(L,F,j,U,D){var B=L[F],V=he(B);if(V!=="object")return new l("Invalid "+U+" `"+D+"` of type `"+V+"` "+("supplied to `"+j+"`, expected `object`."));for(var q in E){var W=E[q];if(typeof W!="function")return $(j,U,D,q,ve(W));var ge=W(B,q,j,U,D+"."+q,r);if(ge)return ge}return null}return O(k)}function M(E){function k(L,F,j,U,D){var B=L[F],V=he(B);if(V!=="object")return new l("Invalid "+U+" `"+D+"` of type `"+V+"` "+("supplied to `"+j+"`, expected `object`."));var q=t({},L[F],E);for(var W in q){var ge=E[W];if(n(E,W)&&typeof ge!="function")return $(j,U,D,W,ve(ge));if(!ge)return new l("Invalid "+U+" `"+D+"` key `"+W+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(L[F],null," ")+`
14
+ <%s key={someKey} {...props} />`,Ft,Be,to,Be),xr[Be+Ft]=!0}}return s===n?Jn(me):Hn(me),me}}function Xn(s,v,A){return Tr(s,v,A,!0)}function Qn(s,v,A){return Tr(s,v,A,!1)}var Zn=Qn,eo=Xn;rt.Fragment=n,rt.jsx=Zn,rt.jsxs=eo})()),rt}var _r;function co(){return _r||(_r=1,process.env.NODE_ENV==="production"?pt.exports=ao():pt.exports=so()),pt.exports}var T=co();function ln(e){const{service:t,tenantId:r,subscriberId:n,filters:o,pollInterval:i,autoFetch:c=!0}=e,[u,f]=J.useState([]),[d,m]=J.useState(c),[h,p]=J.useState(null),y=J.useCallback(async()=>{try{m(!0),p(null);const w={tenantId:r,subscriberId:n,limit:e?.maxNotifications,...o},C=await t.list(w);f(C)}catch(w){p(w instanceof Error?w:new Error("Failed to fetch notifications"))}finally{m(!1)}},[t,r,n,o,e?.maxNotifications]);J.useEffect(()=>{c&&y()},[c]),J.useEffect(()=>{if(i&&i>0){const w=setInterval(()=>{y()},i);return()=>clearInterval(w)}},[i,y]);const b=u.filter(w=>w.read!==!0).length,l=J.useCallback(async w=>{try{await t.markAsRead(w,n),f(C=>C.map(x=>x.notificationId===w?{...x,read:!0}:x))}catch(C){console.error("Failed to mark notification as read",C)}},[t,n]),O=J.useCallback(async w=>{try{await t.delete(w,n),f(C=>C.filter(x=>x.notificationId!==w))}catch(C){console.error("Failed to delete notification",C)}},[t,n]);return{notifications:u,loading:d,error:h,unreadCount:b,refresh:y,markAsRead:l,deleteNotification:O}}const lo="edusight:notification-widget:context";function uo(e){try{if(typeof window>"u"||!window.localStorage)return;window.localStorage.setItem(lo,JSON.stringify(e))}catch{console.log("[WebSocketService] Error persisting context")}}class fo{constructor(t){this.listeners=new Map;const r={apiHost:t.client.getApiHost(),apiVersion:t.client.getApiVersion(),tenantId:t.tenantId,subscriberId:t.subscriberId,environmentId:t.environmentId,path:t.path,namespace:t.namespace,autoAck:t.autoAck,transports:t.transports,reconnectionDelay:t.reconnectionDelay,reconnectionDelayMax:t.reconnectionDelayMax};this.config=t,this.context={tenantId:t.tenantId,subscriberId:t.subscriberId,environmentId:t.environmentId},this.socketClient=new Fe.NotificationSocketClient(r),this.socketClient.on("connect",()=>{uo({environmentId:t.environmentId,subscriberId:t.subscriberId,tenantId:t.tenantId}),this.emit("connect")}),this.socketClient.on("disconnect",n=>{this.emit("disconnect",n)}),this.socketClient.on("notification",n=>{this.emit("notification",this.normalizeNotification(n)),this.config.autoAck===!1&&this.ackNotification(n.notificationId)}),this.socketClient.on("ack",n=>{this.emit("ack",n)}),this.socketClient.on("error",n=>{this.emit("error",n)})}connect(){this.socketClient.connect()}disconnect(){this.socketClient.disconnect()}ackNotification(t){try{this.socketClient.ack(t)}catch(r){this.emit("error",r instanceof Error?r:new Error(String(r)))}}isConnected(){return this.socketClient.isConnected()}on(t,r){this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r)}off(t,r){this.listeners.get(t)?.delete(r)}emit(t,...r){const n=this.listeners.get(t);n&&n.forEach(o=>{try{o(...r)}catch(i){console.warn(`Error in ${t} handler:`,i)}})}normalizeNotification(t){const r=new Date().toISOString(),n=t.channel||Fe.Channel.IN_APP,o=t.renderedContent||{inApp:{title:t.title,message:t.message,action:t.action,icon:t.icon}},i=t.category??Fe.NotificationCategory.REAL_TIME;return{notificationId:t.notificationId,tenantId:this.context.tenantId,subscriberId:this.context.subscriberId,templateId:t.templateId??"",type:t.type||Fe.NotificationType.CUSTOM,category:i,channels:[n],payload:t.data||{},renderedContent:o,status:Fe.NotificationStatus.PENDING,priority:Fe.Priority.MEDIUM,scheduledFor:void 0,sentAt:void 0,retryCount:void 0,batchId:t.batchId,metadata:t.data,createdAt:t.createdAt??r,updatedAt:r,feedId:t.feedId}}}function un(e){const{client:t,tenantId:r,subscriberId:n,environmentId:o,enabled:i=!0,autoAck:c=!1,path:u}=e,[f,d]=J.useState(!1),[m,h]=J.useState(null),p=J.useRef(null);J.useEffect(()=>{if(!i)return;const C={client:t,tenantId:r,subscriberId:n,environmentId:o,autoAck:c,path:u},x=new fo(C);return x.on("connect",()=>{d(!0),h(null)}),x.on("disconnect",()=>{d(!1)}),x.on("error",R=>{h(R)}),p.current=x,x.connect(),()=>{x.disconnect(),p.current=null,d(!1)}},[t,r,n,o,i,c,u]);const y=J.useCallback(()=>{p.current?.connect()},[]),b=J.useCallback(()=>{p.current?.disconnect()},[]),l=J.useCallback(C=>{p.current?.ackNotification(C)},[]),O=J.useCallback(C=>p.current?(p.current.on("notification",C),()=>{p.current?.off("notification",C)}):()=>{},[]),w=J.useCallback(C=>p.current?(p.current.on("ack",C),()=>{p.current?.off("ack",C)}):()=>{},[]);return{connected:f,connect:y,disconnect:b,onNotification:O,onAck:w,ackNotification:l,error:m}}class po{constructor(t){this.client=t}async list(t){return(await this.client.notifications.list(t)).items||[]}async markAsRead(t,r){await this.client.notifications.markAsRead(t,r)}async delete(t,r){await this.client.notifications.delete(t,r)}}function fn(e){const{client:t,tenantId:r,subscriberId:n,environmentId:o,pollInterval:i,autoFetch:c,autoAck:u=!1,path:f}=e,m={service:J.useMemo(()=>new po(t),[t]),tenantId:r,subscriberId:n,pollInterval:i,autoFetch:c},h={client:t,tenantId:r,subscriberId:n,environmentId:o,enabled:!0,autoAck:u,path:f},p=ln(m),y=un(h),[b,l]=J.useState(p.notifications);return J.useEffect(()=>{l(p.notifications)},[p.notifications]),J.useEffect(()=>{const O=y.onNotification(C=>{l(x=>x.some(R=>R.notificationId===C.notificationId)?x:[C,...x]),y.ackNotification(C.notificationId)}),w=y.onAck(C=>{l(x=>x.map(R=>R.notificationId===C.notificationId?{...R,status:Fe.NotificationStatus.DELIVERED}:R))});return()=>{O(),w()}},[y]),{notifications:b,loading:p.loading,error:p.error,unreadCount:p.unreadCount,connected:y.connected,refresh:p.refresh,markAsRead:p.markAsRead,deleteNotification:p.deleteNotification}}var mt={exports:{}},ee={};var Rr;function mo(){if(Rr)return ee;Rr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.view_transition"),y=Symbol.for("react.client.reference");function b(l){if(typeof l=="object"&&l!==null){var O=l.$$typeof;switch(O){case e:switch(l=l.type,l){case r:case o:case n:case f:case d:case p:return l;default:switch(l=l&&l.$$typeof,l){case c:case u:case h:case m:return l;case i:return l;default:return O}}case t:return O}}}return ee.ContextConsumer=i,ee.ContextProvider=c,ee.Element=e,ee.ForwardRef=u,ee.Fragment=r,ee.Lazy=h,ee.Memo=m,ee.Portal=t,ee.Profiler=o,ee.StrictMode=n,ee.Suspense=f,ee.SuspenseList=d,ee.isContextConsumer=function(l){return b(l)===i},ee.isContextProvider=function(l){return b(l)===c},ee.isElement=function(l){return typeof l=="object"&&l!==null&&l.$$typeof===e},ee.isForwardRef=function(l){return b(l)===u},ee.isFragment=function(l){return b(l)===r},ee.isLazy=function(l){return b(l)===h},ee.isMemo=function(l){return b(l)===m},ee.isPortal=function(l){return b(l)===t},ee.isProfiler=function(l){return b(l)===o},ee.isStrictMode=function(l){return b(l)===n},ee.isSuspense=function(l){return b(l)===f},ee.isSuspenseList=function(l){return b(l)===d},ee.isValidElementType=function(l){return typeof l=="string"||typeof l=="function"||l===r||l===o||l===n||l===f||l===d||typeof l=="object"&&l!==null&&(l.$$typeof===h||l.$$typeof===m||l.$$typeof===c||l.$$typeof===i||l.$$typeof===u||l.$$typeof===y||l.getModuleId!==void 0)},ee.typeOf=b,ee}var te={};var Ar;function ho(){return Ar||(Ar=1,process.env.NODE_ENV!=="production"&&(function(){function e(l){if(typeof l=="object"&&l!==null){var O=l.$$typeof;switch(O){case t:switch(l=l.type,l){case n:case i:case o:case d:case m:case y:return l;default:switch(l=l&&l.$$typeof,l){case u:case f:case p:case h:return l;case c:return l;default:return O}}case r:return O}}}var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),y=Symbol.for("react.view_transition"),b=Symbol.for("react.client.reference");te.ContextConsumer=c,te.ContextProvider=u,te.Element=t,te.ForwardRef=f,te.Fragment=n,te.Lazy=p,te.Memo=h,te.Portal=r,te.Profiler=i,te.StrictMode=o,te.Suspense=d,te.SuspenseList=m,te.isContextConsumer=function(l){return e(l)===c},te.isContextProvider=function(l){return e(l)===u},te.isElement=function(l){return typeof l=="object"&&l!==null&&l.$$typeof===t},te.isForwardRef=function(l){return e(l)===f},te.isFragment=function(l){return e(l)===n},te.isLazy=function(l){return e(l)===p},te.isMemo=function(l){return e(l)===h},te.isPortal=function(l){return e(l)===r},te.isProfiler=function(l){return e(l)===i},te.isStrictMode=function(l){return e(l)===o},te.isSuspense=function(l){return e(l)===d},te.isSuspenseList=function(l){return e(l)===m},te.isValidElementType=function(l){return typeof l=="string"||typeof l=="function"||l===n||l===i||l===o||l===d||l===m||typeof l=="object"&&l!==null&&(l.$$typeof===p||l.$$typeof===h||l.$$typeof===u||l.$$typeof===c||l.$$typeof===f||l.$$typeof===b||l.getModuleId!==void 0)},te.typeOf=e})()),te}var kr;function go(){return kr||(kr=1,process.env.NODE_ENV==="production"?mt.exports=mo():mt.exports=ho()),mt.exports}var St=go();function Ae(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function dn(e){if(Pe.isValidElement(e)||St.isValidElementType(e)||!Ae(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=dn(e[r])}),t}function Ee(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return Ae(e)&&Ae(t)&&Object.keys(t).forEach(o=>{Pe.isValidElement(t[o])||St.isValidElementType(t[o])?n[o]=t[o]:Ae(t[o])&&Object.prototype.hasOwnProperty.call(e,o)&&Ae(e[o])?n[o]=Ee(e[o],t[o],r):r.clone?n[o]=Ae(t[o])?dn(t[o]):t[o]:n[o]=t[o]}),n}var ht={exports:{}},gt={exports:{}},Q={};var $r;function yo(){if($r)return Q;$r=1;var e=typeof Symbol=="function"&&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,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,y=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,l=e?Symbol.for("react.block"):60121,O=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function x(S){if(typeof S=="object"&&S!==null){var K=S.$$typeof;switch(K){case t:switch(S=S.type,S){case f:case d:case n:case i:case o:case h:return S;default:switch(S=S&&S.$$typeof,S){case u:case m:case b:case y:case c:return S;default:return K}}case r:return K}}}function R(S){return x(S)===d}return Q.AsyncMode=f,Q.ConcurrentMode=d,Q.ContextConsumer=u,Q.ContextProvider=c,Q.Element=t,Q.ForwardRef=m,Q.Fragment=n,Q.Lazy=b,Q.Memo=y,Q.Portal=r,Q.Profiler=i,Q.StrictMode=o,Q.Suspense=h,Q.isAsyncMode=function(S){return R(S)||x(S)===f},Q.isConcurrentMode=R,Q.isContextConsumer=function(S){return x(S)===u},Q.isContextProvider=function(S){return x(S)===c},Q.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===t},Q.isForwardRef=function(S){return x(S)===m},Q.isFragment=function(S){return x(S)===n},Q.isLazy=function(S){return x(S)===b},Q.isMemo=function(S){return x(S)===y},Q.isPortal=function(S){return x(S)===r},Q.isProfiler=function(S){return x(S)===i},Q.isStrictMode=function(S){return x(S)===o},Q.isSuspense=function(S){return x(S)===h},Q.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===n||S===d||S===i||S===o||S===h||S===p||typeof S=="object"&&S!==null&&(S.$$typeof===b||S.$$typeof===y||S.$$typeof===c||S.$$typeof===u||S.$$typeof===m||S.$$typeof===O||S.$$typeof===w||S.$$typeof===C||S.$$typeof===l)},Q.typeOf=x,Q}var Z={};var Pr;function bo(){return Pr||(Pr=1,process.env.NODE_ENV!=="production"&&(function(){var e=typeof Symbol=="function"&&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,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,y=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,l=e?Symbol.for("react.block"):60121,O=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function x(_){return typeof _=="string"||typeof _=="function"||_===n||_===d||_===i||_===o||_===h||_===p||typeof _=="object"&&_!==null&&(_.$$typeof===b||_.$$typeof===y||_.$$typeof===c||_.$$typeof===u||_.$$typeof===m||_.$$typeof===O||_.$$typeof===w||_.$$typeof===C||_.$$typeof===l)}function R(_){if(typeof _=="object"&&_!==null){var Ce=_.$$typeof;switch(Ce){case t:var Ye=_.type;switch(Ye){case f:case d:case n:case i:case o:case h:return Ye;default:var Me=Ye&&Ye.$$typeof;switch(Me){case u:case m:case b:case y:case c:return Me;default:return Ce}}case r:return Ce}}}var S=f,K=d,ae=u,re=c,Y=t,a=m,$=n,I=b,M=y,fe=r,ce=i,he=o,ve=h,De=!1;function ze(_){return De||(De=!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.")),E(_)||R(_)===f}function E(_){return R(_)===d}function k(_){return R(_)===u}function L(_){return R(_)===c}function F(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function j(_){return R(_)===m}function U(_){return R(_)===n}function D(_){return R(_)===b}function B(_){return R(_)===y}function V(_){return R(_)===r}function q(_){return R(_)===i}function W(_){return R(_)===o}function ge(_){return R(_)===h}Z.AsyncMode=S,Z.ConcurrentMode=K,Z.ContextConsumer=ae,Z.ContextProvider=re,Z.Element=Y,Z.ForwardRef=a,Z.Fragment=$,Z.Lazy=I,Z.Memo=M,Z.Portal=fe,Z.Profiler=ce,Z.StrictMode=he,Z.Suspense=ve,Z.isAsyncMode=ze,Z.isConcurrentMode=E,Z.isContextConsumer=k,Z.isContextProvider=L,Z.isElement=F,Z.isForwardRef=j,Z.isFragment=U,Z.isLazy=D,Z.isMemo=B,Z.isPortal=V,Z.isProfiler=q,Z.isStrictMode=W,Z.isSuspense=ge,Z.isValidElementType=x,Z.typeOf=R})()),Z}var Ir;function pn(){return Ir||(Ir=1,process.env.NODE_ENV==="production"?gt.exports=yo():gt.exports=bo()),gt.exports}var Lt,Nr;function vo(){if(Nr)return Lt;Nr=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var c={},u=0;u<10;u++)c["_"+String.fromCharCode(u)]=u;var f=Object.getOwnPropertyNames(c).map(function(m){return c[m]});if(f.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(m){d[m]=m}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Lt=o()?Object.assign:function(i,c){for(var u,f=n(i),d,m=1;m<arguments.length;m++){u=Object(arguments[m]);for(var h in u)t.call(u,h)&&(f[h]=u[h]);if(e){d=e(u);for(var p=0;p<d.length;p++)r.call(u,d[p])&&(f[d[p]]=u[d[p]])}}return f},Lt}var Vt,jr;function tr(){if(jr)return Vt;jr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Vt=e,Vt}var Wt,Dr;function mn(){return Dr||(Dr=1,Wt=Function.call.bind(Object.prototype.hasOwnProperty)),Wt}var zt,Mr;function So(){if(Mr)return zt;Mr=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=tr(),r={},n=mn();e=function(i){var c="Warning: "+i;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}}}function o(i,c,u,f,d){if(process.env.NODE_ENV!=="production"){for(var m in i)if(n(i,m)){var h;try{if(typeof i[m]!="function"){var p=Error((f||"React class")+": "+u+" type `"+m+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[m]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}h=i[m](c,m,f,u,null,t)}catch(b){h=b}if(h&&!(h instanceof Error)&&e((f||"React class")+": type specification of "+u+" `"+m+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in r)){r[h.message]=!0;var y=d?d():"";e("Failed "+u+" type: "+h.message+(y??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},zt=o,zt}var Yt,Br;function Eo(){if(Br)return Yt;Br=1;var e=pn(),t=vo(),r=tr(),n=mn(),o=So(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(u){var f="Warning: "+u;typeof console<"u"&&console.error(f);try{throw new Error(f)}catch{}});function c(){return null}return Yt=function(u,f){var d=typeof Symbol=="function"&&Symbol.iterator,m="@@iterator";function h(E){var k=E&&(d&&E[d]||E[m]);if(typeof k=="function")return k}var p="<<anonymous>>",y={array:w("array"),bigint:w("bigint"),bool:w("boolean"),func:w("function"),number:w("number"),object:w("object"),string:w("string"),symbol:w("symbol"),any:C(),arrayOf:x,element:R(),elementType:S(),instanceOf:K,node:a(),objectOf:re,oneOf:ae,oneOfType:Y,shape:I,exact:M};function b(E,k){return E===k?E!==0||1/E===1/k:E!==E&&k!==k}function l(E,k){this.message=E,this.data=k&&typeof k=="object"?k:{},this.stack=""}l.prototype=Error.prototype;function O(E){if(process.env.NODE_ENV!=="production")var k={},L=0;function F(U,D,B,V,q,W,ge){if(V=V||p,W=W||B,ge!==r){if(f){var _=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 _.name="Invariant Violation",_}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var Ce=V+":"+B;!k[Ce]&&L<3&&(i("You are manually calling a React.PropTypes validation function for the `"+W+"` prop on `"+V+"`. 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."),k[Ce]=!0,L++)}}return D[B]==null?U?D[B]===null?new l("The "+q+" `"+W+"` is marked as required "+("in `"+V+"`, but its value is `null`.")):new l("The "+q+" `"+W+"` is marked as required in "+("`"+V+"`, but its value is `undefined`.")):null:E(D,B,V,q,W)}var j=F.bind(null,!1);return j.isRequired=F.bind(null,!0),j}function w(E){function k(L,F,j,U,D,B){var V=L[F],q=he(V);if(q!==E){var W=ve(V);return new l("Invalid "+U+" `"+D+"` of type "+("`"+W+"` supplied to `"+j+"`, expected ")+("`"+E+"`."),{expectedType:E})}return null}return O(k)}function C(){return O(c)}function x(E){function k(L,F,j,U,D){if(typeof E!="function")return new l("Property `"+D+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var B=L[F];if(!Array.isArray(B)){var V=he(B);return new l("Invalid "+U+" `"+D+"` of type "+("`"+V+"` supplied to `"+j+"`, expected an array."))}for(var q=0;q<B.length;q++){var W=E(B,q,j,U,D+"["+q+"]",r);if(W instanceof Error)return W}return null}return O(k)}function R(){function E(k,L,F,j,U){var D=k[L];if(!u(D)){var B=he(D);return new l("Invalid "+j+" `"+U+"` of type "+("`"+B+"` supplied to `"+F+"`, expected a single ReactElement."))}return null}return O(E)}function S(){function E(k,L,F,j,U){var D=k[L];if(!e.isValidElementType(D)){var B=he(D);return new l("Invalid "+j+" `"+U+"` of type "+("`"+B+"` supplied to `"+F+"`, expected a single ReactElement type."))}return null}return O(E)}function K(E){function k(L,F,j,U,D){if(!(L[F]instanceof E)){var B=E.name||p,V=ze(L[F]);return new l("Invalid "+U+" `"+D+"` of type "+("`"+V+"` supplied to `"+j+"`, expected ")+("instance of `"+B+"`."))}return null}return O(k)}function ae(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("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])."):i("Invalid argument supplied to oneOf, expected an array.")),c;function k(L,F,j,U,D){for(var B=L[F],V=0;V<E.length;V++)if(b(B,E[V]))return null;var q=JSON.stringify(E,function(ge,_){var Ce=ve(_);return Ce==="symbol"?String(_):_});return new l("Invalid "+U+" `"+D+"` of value `"+String(B)+"` "+("supplied to `"+j+"`, expected one of "+q+"."))}return O(k)}function re(E){function k(L,F,j,U,D){if(typeof E!="function")return new l("Property `"+D+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var B=L[F],V=he(B);if(V!=="object")return new l("Invalid "+U+" `"+D+"` of type "+("`"+V+"` supplied to `"+j+"`, expected an object."));for(var q in B)if(n(B,q)){var W=E(B,q,j,U,D+"."+q,r);if(W instanceof Error)return W}return null}return O(k)}function Y(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),c;for(var k=0;k<E.length;k++){var L=E[k];if(typeof L!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+De(L)+" at index "+k+"."),c}function F(j,U,D,B,V){for(var q=[],W=0;W<E.length;W++){var ge=E[W],_=ge(j,U,D,B,V,r);if(_==null)return null;_.data&&n(_.data,"expectedType")&&q.push(_.data.expectedType)}var Ce=q.length>0?", expected one of type ["+q.join(", ")+"]":"";return new l("Invalid "+B+" `"+V+"` supplied to "+("`"+D+"`"+Ce+"."))}return O(F)}function a(){function E(k,L,F,j,U){return fe(k[L])?null:new l("Invalid "+j+" `"+U+"` supplied to "+("`"+F+"`, expected a ReactNode."))}return O(E)}function $(E,k,L,F,j){return new l((E||"React class")+": "+k+" type `"+L+"."+F+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function I(E){function k(L,F,j,U,D){var B=L[F],V=he(B);if(V!=="object")return new l("Invalid "+U+" `"+D+"` of type `"+V+"` "+("supplied to `"+j+"`, expected `object`."));for(var q in E){var W=E[q];if(typeof W!="function")return $(j,U,D,q,ve(W));var ge=W(B,q,j,U,D+"."+q,r);if(ge)return ge}return null}return O(k)}function M(E){function k(L,F,j,U,D){var B=L[F],V=he(B);if(V!=="object")return new l("Invalid "+U+" `"+D+"` of type `"+V+"` "+("supplied to `"+j+"`, expected `object`."));var q=t({},L[F],E);for(var W in q){var ge=E[W];if(n(E,W)&&typeof ge!="function")return $(j,U,D,W,ve(ge));if(!ge)return new l("Invalid "+U+" `"+D+"` key `"+W+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(L[F],null," ")+`
15
15
  Valid keys: `+JSON.stringify(Object.keys(E),null," "));var _=ge(B,W,j,U,D+"."+W,r);if(_)return _}return null}return O(k)}function fe(E){switch(typeof E){case"number":case"string":case"undefined":return!0;case"boolean":return!E;case"object":if(Array.isArray(E))return E.every(fe);if(E===null||u(E))return!0;var k=h(E);if(k){var L=k.call(E),F;if(k!==E.entries){for(;!(F=L.next()).done;)if(!fe(F.value))return!1}else for(;!(F=L.next()).done;){var j=F.value;if(j&&!fe(j[1]))return!1}}else return!1;return!0;default:return!1}}function ce(E,k){return E==="symbol"?!0:k?k["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&k instanceof Symbol:!1}function he(E){var k=typeof E;return Array.isArray(E)?"array":E instanceof RegExp?"object":ce(k,E)?"symbol":k}function ve(E){if(typeof E>"u"||E===null)return""+E;var k=he(E);if(k==="object"){if(E instanceof Date)return"date";if(E instanceof RegExp)return"regexp"}return k}function De(E){var k=ve(E);switch(k){case"array":case"object":return"an "+k;case"boolean":case"date":case"regexp":return"a "+k;default:return k}}function ze(E){return!E.constructor||!E.constructor.name?p:E.constructor.name}return y.checkPropTypes=o,y.resetWarningCache=o.resetWarningCache,y.PropTypes=y,y},Yt}var Ut,Fr;function Co(){if(Fr)return Ut;Fr=1;var e=tr();function t(){}function r(){}return r.resetWarningCache=t,Ut=function(){function n(c,u,f,d,m,h){if(h!==e){var p=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 p.name="Invariant Violation",p}}n.isRequired=n;function o(){return n}var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return i.PropTypes=i,i},Ut}var Lr;function xo(){if(Lr)return ht.exports;if(Lr=1,process.env.NODE_ENV!=="production"){var e=pn(),t=!0;ht.exports=Eo()(e.isElement,t)}else ht.exports=Co()();return ht.exports}var To=xo();const H=io(To);function Ie(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}function hn(e,t=""){return e.displayName||e.name||t}function Vr(e,t,r){const n=hn(t);return e.displayName||(n!==""?`${r}(${n})`:r)}function wo(e){if(e!=null){if(typeof e=="string")return e;if(typeof e=="function")return hn(e,"Component");if(typeof e=="object")switch(e.$$typeof){case St.ForwardRef:return Vr(e,e.render,"ForwardRef");case St.Memo:return Vr(e,e.type,"memo");default:return}}}function We(e){if(typeof e!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":Ie(7));return e.charAt(0).toUpperCase()+e.slice(1)}function Jt(e,t){const r={...t};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const o=n;if(o==="components"||o==="slots")r[o]={...e[o],...r[o]};else if(o==="componentsProps"||o==="slotProps"){const i=e[o],c=t[o];if(!c)r[o]=i||{};else if(!i)r[o]=c;else{r[o]={...c};for(const u in i)if(Object.prototype.hasOwnProperty.call(i,u)){const f=u;r[o][f]=Jt(i[f],c[f])}}}else r[o]===void 0&&(r[o]=e[o])}return r}function Oo(e,t,r=void 0){const n={};for(const o in e){const i=e[o];let c="",u=!0;for(let f=0;f<i.length;f+=1){const d=i[f];d&&(c+=(u===!0?"":" ")+t(d),u=!1,r&&r[d]&&(c+=" "+r[d]))}n[o]=c}return n}const Wr=e=>e,_o=()=>{let e=Wr;return{configure(t){e=t},generate(t){return e(t)},reset(){e=Wr}}},Ro=_o(),Ao={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function rr(e,t,r="Mui"){const n=Ao[t];return n?`${r}-${n}`:`${Ro.generate(e)}-${t}`}function ko(e,t,r="Mui"){const n={};return t.forEach(o=>{n[o]=rr(e,o,r)}),n}function $o(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}function gn(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=gn(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Po(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=gn(e))&&(n&&(n+=" "),n+=t);return n}function at(e,t){return t?Ee(e,t,{clone:!1}):e}const je=process.env.NODE_ENV!=="production"?H.oneOfType([H.number,H.string,H.object,H.array]):{};function zr(e,t){if(!e.containerQueries)return t;const r=Object.keys(t).filter(n=>n.startsWith("@container")).sort((n,o)=>{const i=/min-width:\s*([0-9.]+)/;return+(n.match(i)?.[1]||0)-+(o.match(i)?.[1]||0)});return r.length?r.reduce((n,o)=>{const i=t[o];return delete n[o],n[o]=i,n},{...t}):t}function Io(e,t){return t==="@"||t.startsWith("@")&&(e.some(r=>t.startsWith(`@${r}`))||!!t.match(/^@\d/))}function No(e,t){const r=t.match(/^@([^/]+)?\/?(.+)?$/);if(!r){if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The provided shorthand ${`(${t})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
16
16
  For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:Ie(18,`(${t})`));return null}const[,n,o]=r,i=Number.isNaN(+n)?n||0:+n;return e.containerQueries(o).up(i)}function jo(e){const t=(i,c)=>i.replace("@media",c?`@container ${c}`:"@container");function r(i,c){i.up=(...u)=>t(e.breakpoints.up(...u),c),i.down=(...u)=>t(e.breakpoints.down(...u),c),i.between=(...u)=>t(e.breakpoints.between(...u),c),i.only=(...u)=>t(e.breakpoints.only(...u),c),i.not=(...u)=>{const f=t(e.breakpoints.not(...u),c);return f.includes("not all and")?f.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):f}}const n={},o=i=>(r(n,i),n);return r(o),{...e,containerQueries:o}}const Tt={xs:0,sm:600,md:900,lg:1200,xl:1536},Yr={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${Tt[e]}px)`},Do={containerQueries:e=>({up:t=>{let r=typeof t=="number"?t:Tt[t]||t;return typeof r=="number"&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function ke(e,t,r){const n=e.theme||{};if(Array.isArray(t)){const i=n.breakpoints||Yr;return t.reduce((c,u,f)=>(c[i.up(i.keys[f])]=r(t[f]),c),{})}if(typeof t=="object"){const i=n.breakpoints||Yr;return Object.keys(t).reduce((c,u)=>{if(Io(i.keys,u)){const f=No(n.containerQueries?n:Do,u);f&&(c[f]=r(t[u],u))}else if(Object.keys(i.values||Tt).includes(u)){const f=i.up(u);c[f]=r(t[u],u)}else{const f=u;c[f]=t[f]}return c},{})}return r(t)}function Mo(e={}){return e.keys?.reduce((r,n)=>{const o=e.up(n);return r[o]={},r},{})||{}}function Ur(e,t){return e.reduce((r,n)=>{const o=r[n];return(!o||Object.keys(o).length===0)&&delete r[n],r},t)}function wt(e,t,r=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&r){const n=`vars.${t}`.split(".").reduce((o,i)=>o&&o[i]?o[i]:null,e);if(n!=null)return n}return t.split(".").reduce((n,o)=>n&&n[o]!=null?n[o]:null,e)}function Et(e,t,r,n=r){let o;return typeof e=="function"?o=e(r):Array.isArray(e)?o=e[r]||n:o=wt(e,r)||n,t&&(o=t(o,n,e)),o}function pe(e){const{prop:t,cssProperty:r=e.prop,themeKey:n,transform:o}=e,i=c=>{if(c[t]==null)return null;const u=c[t],f=c.theme,d=wt(f,n)||{};return ke(c,u,h=>{let p=Et(d,o,h);return h===p&&typeof h=="string"&&(p=Et(d,o,`${t}${h==="default"?"":We(h)}`,h)),r===!1?p:{[r]:p}})};return i.propTypes=process.env.NODE_ENV!=="production"?{[t]:je}:{},i.filterProps=[t],i}function Bo(e){const t={};return r=>(t[r]===void 0&&(t[r]=e(r)),t[r])}const Fo={m:"margin",p:"padding"},Lo={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},Gr={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},Vo=Bo(e=>{if(e.length>2)if(Gr[e])e=Gr[e];else return[e];const[t,r]=e.split(""),n=Fo[t],o=Lo[r]||"";return Array.isArray(o)?o.map(i=>n+i):[n+o]}),Ot=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],_t=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],Wo=[...Ot,..._t];function lt(e,t,r,n){const o=wt(e,t,!0)??r;return typeof o=="number"||typeof o=="string"?i=>typeof i=="string"?i:(process.env.NODE_ENV!=="production"&&typeof i!="number"&&console.error(`MUI: Expected ${n} argument to be a number or a string, got ${i}.`),typeof o=="string"?`calc(${i} * ${o})`:o*i):Array.isArray(o)?i=>{if(typeof i=="string")return i;const c=Math.abs(i);process.env.NODE_ENV!=="production"&&(Number.isInteger(c)?c>o.length-1&&console.error([`MUI: The value provided (${c}) overflows.`,`The supported values are: ${JSON.stringify(o)}.`,`${c} > ${o.length-1}, you need to add the missing values.`].join(`
17
17
  `)):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(`