1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9619],{1095:function(e,t,i){let n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==i.g&&i.g,r=function(){try{new n.Event("")}catch(e){return!0}return!1}(),s=function(){try{new n.EventTarget}catch(e){return!0}return!1}();r&&(n.Event=function(e,t){this.bubbles=!!t&&!!t.bubbles,this.cancelable=!!t&&!!t.cancelable,this.composed=!!t&&!!t.composed,this.type=e}),s&&(n.EventTarget=function(){function e(){this.__listeners=new Map}return e.prototype=Object.create(Object.prototype),e.prototype.addEventListener=function(e,t,i){if(arguments.length<2)throw TypeError("TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only "+arguments.length+" present.");let n=this.__listeners,r=e.toString();n.has(r)||n.set(r,new Map);let s=n.get(r);s.has(t)||s.set(t,i)},e.prototype.removeEventListener=function(e,t,i){if(arguments.length<2)throw TypeError("TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only "+arguments.length+" present.");let n=this.__listeners,r=e.toString();if(n.has(r)){let e=n.get(r);e.has(t)&&e.delete(t)}},e.prototype.dispatchEvent=function(e){if(!(e instanceof Event))throw TypeError("Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.");let t=e.type,i=this.__listeners.get(t);if(i)for(var n of i.entries()){let t=n[0],r=n[1];try{"function"==typeof t?t.call(this,e):t&&"function"==typeof t.handleEvent&&t.handleEvent(e)}catch(e){setTimeout(()=>{throw e})}r&&r.once&&i.delete(t)}return!0},e}())},2537:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return n}});let n=i(381)._(i(9585)).default.createContext(null)},8185:function(e){e.exports={style:{fontFamily:"'__GeistSans_8adcd2', '__GeistSans_Fallback_8adcd2'"},className:"__className_8adcd2",variable:"__variable_8adcd2"}},7389:function(e,t,i){"use strict";i.d(t,{A1:function(){return p},Av:function(){return O},Fg:function(){return M},HB:function(){return A},HS:function(){return E},Ly:function(){return _},NM:function(){return C},P_:function(){return K},SA:function(){return S},Vf:function(){return T},dG:function(){return R},e2:function(){return N},hi:function(){return f},iL:function(){return j},ij:function(){return k},nV:function(){return W},no:function(){return P},nw:function(){return x},rG:function(){return L},sc:function(){return D},xF:function(){return d}});var n,r,s,o,a,c,l,u,h=i(9287);function d(e){if(!e)return"";let t=[];for(let[i,n]of Object.entries(e))if(n){let e="string"==typeof n?n:n.id;t.push(`${i}:${e}`)}return t.sort().join(",")}function p({subscriberId:e,subscriber:t}){return t?"string"==typeof t?{subscriberId:t}:t:e?{subscriberId:e}:{subscriberId:""}}function f({topicKey:e,subscriberId:t,contextKey:i}){let n=`tk_${e}:si_${t}`;return i&&i.length>0?`${n}:ctx_${i}`:n}var v=((n=v||{}).READ="read",n.SEEN="seen",n.SNOOZED="snoozed",n.UNREAD="unread",n.UNSEEN="unseen",n.UNSNOOZED="unsnoozed",n),g=((r=g||{}).GLOBAL="global",r.TEMPLATE="template",r),y=((s=y||{}).IN_APP="in_app",s.EMAIL="email",s.SMS="sms",s.CHAT="chat",s.PUSH="push",s),m=((o=m||{}).RECEIVED="notification_received",o.UNREAD="unread_count_changed",o.UNSEEN="unseen_count_changed",o),b=((a=b||{}).HIGH="high",a.MEDIUM="medium",a.LOW="low",a.NONE="none",a),w=((c=w||{}).CRITICAL="critical",c.NON_CRITICAL="nonCritical",c.ALL="all",c),_=class extends Error{constructor(e,t){super(e),this.originalError=t}},k=e=>(0,h.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){let{notificationId:n,optimisticValue:r}=I(i,{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0},{emitter:e,apiService:t});try{e.emit("notification.read.pending",{args:i,data:r});let s=yield t.read(n),o=new K(s,e,t);return e.emit("notification.read.resolved",{args:i,data:o}),{data:o}}catch(t){return e.emit("notification.read.resolved",{args:i,error:t}),{error:new _("Failed to read notification",t)}}}),C=e=>(0,h.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){let{notificationId:n,optimisticValue:r}=I(i,{isRead:!1,readAt:null,isArchived:!1,archivedAt:void 0},{emitter:e,apiService:t});try{e.emit("notification.unread.pending",{args:i,data:r});let s=yield t.unread(n),o=new K(s,e,t);return e.emit("notification.unread.resolved",{args:i,data:o}),{data:o}}catch(t){return e.emit("notification.unread.resolved",{args:i,error:t}),{error:new _("Failed to unread notification",t)}}}),S=e=>(0,h.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){let{notificationId:n,optimisticValue:r}=I(i,{isSeen:!0},{emitter:e,apiService:t});try{if(e.emit("notification.seen.pending",{args:i,data:r}),yield t.seen(n),!r)throw Error("Failed to create optimistic value for notification");let s=new K(r,e,t);return e.emit("notification.seen.resolved",{args:i,data:s}),{data:s}}catch(t){return e.emit("notification.seen.resolved",{args:i,error:t}),{error:new _("Failed to mark notification as seen",t)}}}),x=e=>(0,h.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){let{notificationId:n,optimisticValue:r}=I(i,{isArchived:!0,archivedAt:new Date().toISOString(),isRead:!0,readAt:new Date().toISOString()},{emitter:e,apiService:t});try{e.emit("notification.archive.pending",{args:i,data:r});let s=yield t.archive(n),o=new K(s,e,t);return e.emit("notification.archive.resolved",{args:i,data:o}),{data:o}}catch(t){return e.emit("notification.archive.resolved",{args:i,error:t}),{error:new _("Failed to archive notification",t)}}}),E=e=>(0,h.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){let{notificationId:n,optimisticValue:r}=I(i,{isArchived:!1,archivedAt:null,isRead:!0,readAt:new Date().toISOString()},{emitter:e,apiService:t});try{e.emit("notification.unarchive.pending",{args:i,data:r});let s=yield t.unarchive(n),o=new K(s,e,t);return e.emit("notification.unarchive.resolved",{args:i,data:o}),{data:o}}catch(t){return e.emit("notification.unarchive.resolved",{args:i,error:t}),{error:new _("Failed to unarchive notification",t)}}}),A=e=>(0,h.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){let{notificationId:n,optimisticValue:r}=I(i,{isSnoozed:!0,snoozedUntil:i.snoozeUntil},{emitter:e,apiService:t});try{e.emit("notification.snooze.pending",{args:i,data:r});let s=yield t.snooze(n,i.snoozeUntil),o=new K(s,e,t);return e.emit("notification.snooze.resolved",{args:i,data:o}),{data:o}}catch(t){return e.emit("notification.snooze.resolved",{args:i,error:t}),{error:new _("Failed to snooze notification",t)}}}),M=e=>(0,h.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){let{notificationId:n,optimisticValue:r}=I(i,{isSnoozed:!1,snoozedUntil:null},{emitter:e,apiService:t});try{e.emit("notification.unsnooze.pending",{args:i,data:r});let s=yield t.unsnooze(n),o=new K(s,e,t);return e.emit("notification.unsnooze.resolved",{args:i,data:o}),{data:o}}catch(t){return e.emit("notification.unsnooze.resolved",{args:i,error:t}),{error:new _("Failed to unsnooze notification",t)}}}),O=e=>(0,h.Cr)(null,[e],function*({emitter:e,apiService:t,args:i,actionType:n}){let r="primary"===n?{primaryAction:(0,h.EZ)((0,h.ih)({},"notification"in i?i.notification.primaryAction:{}),{isCompleted:!0})}:{secondaryAction:(0,h.EZ)((0,h.ih)({},"notification"in i?i.notification.secondaryAction:{}),{isCompleted:!0})},{notificationId:s,optimisticValue:o}=I(i,r,{emitter:e,apiService:t});try{e.emit("notification.complete_action.pending",{args:i,data:o});let r=yield t.completeAction({actionType:n,notificationId:s}),a=new K(r,e,t);return e.emit("notification.complete_action.resolved",{args:i,data:a}),{data:a}}catch(t){return e.emit("notification.complete_action.resolved",{args:i,error:t}),{error:new _(`Failed to complete ${n} action on the notification`,t)}}}),T=e=>(0,h.Cr)(null,[e],function*({emitter:e,apiService:t,args:i,actionType:n}){let r="primary"===n?{primaryAction:(0,h.EZ)((0,h.ih)({},"notification"in i?i.notification.primaryAction:{}),{isCompleted:!1})}:{secondaryAction:(0,h.EZ)((0,h.ih)({},"notification"in i?i.notification.secondaryAction:{}),{isCompleted:!1})},{notificationId:s,optimisticValue:o}=I(i,r,{emitter:e,apiService:t});try{e.emit("notification.revert_action.pending",{args:i,data:o});let r=yield t.revertAction({actionType:n,notificationId:s}),a=new K(r,e,t);return e.emit("notification.revert_action.resolved",{args:i,data:a}),{data:a}}catch(t){return e.emit("notification.revert_action.resolved",{args:i,error:t}),{error:new _("Failed to fetch notifications",t)}}}),I=(e,t,i)=>"notification"in e?{notificationId:e.notification.id,optimisticValue:new K((0,h.ih)((0,h.ih)({},e.notification),t),i.emitter,i.apiService)}:{notificationId:e.notificationId},R=e=>(0,h.Cr)(null,[e],function*({emitter:e,inboxService:t,notificationsCache:i,tags:n,data:r}){try{let s=i.getUniqueNotifications({tags:n,data:r}).map(i=>new K((0,h.EZ)((0,h.ih)({},i),{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0}),e,t));return e.emit("notifications.read_all.pending",{args:{tags:n,data:r},data:s}),yield t.readAll({tags:n,data:r}),e.emit("notifications.read_all.resolved",{args:{tags:n,data:r},data:s}),{}}catch(t){return e.emit("notifications.read_all.resolved",{args:{tags:n,data:r},error:t}),{error:new _("Failed to read all notifications",t)}}}),N=e=>(0,h.Cr)(null,[e],function*({emitter:e,inboxService:t,notificationsCache:i,notificationIds:n,tags:r,data:s}){try{let o=i.getUniqueNotifications({tags:r,data:s}),a=(n&&n.length>0?o.filter(e=>n.includes(e.id)):o).map(i=>new K((0,h.EZ)((0,h.ih)({},i),{isSeen:!0,firstSeenAt:i.firstSeenAt||new Date().toISOString()}),e,t));return e.emit("notifications.seen_all.pending",{args:{notificationIds:n,tags:r,data:s},data:a}),yield t.markAsSeen({notificationIds:n,tags:r,data:s}),e.emit("notifications.seen_all.resolved",{args:{notificationIds:n,tags:r,data:s},data:a}),{}}catch(t){return e.emit("notifications.seen_all.resolved",{args:{notificationIds:n,tags:r,data:s},error:t}),{error:new _("Failed to mark all notifications as seen",t)}}}),L=e=>(0,h.Cr)(null,[e],function*({emitter:e,inboxService:t,notificationsCache:i,tags:n,data:r}){try{let s=i.getUniqueNotifications({tags:n,data:r}).map(i=>new K((0,h.EZ)((0,h.ih)({},i),{isRead:!0,readAt:new Date().toISOString(),isArchived:!0,archivedAt:new Date().toISOString()}),e,t));return e.emit("notifications.archive_all.pending",{args:{tags:n,data:r},data:s}),yield t.archiveAll({tags:n,data:r}),e.emit("notifications.archive_all.resolved",{args:{tags:n,data:r},data:s}),{}}catch(t){return e.emit("notifications.archive_all.resolved",{args:{tags:n,data:r},error:t}),{error:new _("Failed to archive all notifications",t)}}}),j=e=>(0,h.Cr)(null,[e],function*({emitter:e,inboxService:t,notificationsCache:i,tags:n,data:r}){try{let s=i.getUniqueNotifications({tags:n,data:r,read:!0}).map(i=>new K((0,h.EZ)((0,h.ih)({},i),{isArchived:!0,archivedAt:new Date().toISOString()}),e,t));return e.emit("notifications.archive_all_read.pending",{args:{tags:n,data:r},data:s}),yield t.archiveAllRead({tags:n,data:r}),e.emit("notifications.archive_all_read.resolved",{args:{tags:n,data:r},data:s}),{}}catch(t){return e.emit("notifications.archive_all_read.resolved",{args:{tags:n,data:r},error:t}),{error:new _("Failed to archive all read notifications",t)}}}),P=e=>(0,h.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){let{notificationId:n}=I(i,{},{emitter:e,apiService:t});try{return e.emit("notification.delete.pending",{args:i}),yield t.delete(n),e.emit("notification.delete.resolved",{args:i}),{}}catch(t){return e.emit("notification.delete.resolved",{args:i,error:t}),{error:new _("Failed to delete notification",t)}}}),W=e=>(0,h.Cr)(null,[e],function*({emitter:e,inboxService:t,notificationsCache:i,tags:n,data:r}){try{let s=i.getUniqueNotifications({tags:n,data:r});return e.emit("notifications.delete_all.pending",{args:{tags:n,data:r},data:s}),yield t.deleteAll({tags:n,data:r}),e.emit("notifications.delete_all.resolved",{args:{tags:n,data:r}}),{}}catch(t){return e.emit("notifications.delete_all.resolved",{args:{tags:n,data:r},error:t}),{error:new _("Failed to delete all notifications",t)}}}),K=class{constructor(e,t,i){(0,h.Ko)(this,l),(0,h.Ko)(this,u),(0,h.qx)(this,l,t),(0,h.qx)(this,u,i),this.id=e.id,this.transactionId=e.transactionId,this.subject=e.subject,this.body=e.body,this.to=e.to,this.isRead=e.isRead,this.isSeen=e.isSeen,this.isArchived=e.isArchived,this.isSnoozed=e.isSnoozed,this.snoozedUntil=e.snoozedUntil,this.deliveredAt=e.deliveredAt,this.createdAt=e.createdAt,this.readAt=e.readAt,this.firstSeenAt=e.firstSeenAt,this.archivedAt=e.archivedAt,this.avatar=e.avatar,this.primaryAction=e.primaryAction,this.secondaryAction=e.secondaryAction,this.channelType=e.channelType,this.tags=e.tags,this.redirect=e.redirect,this.data=e.data,this.workflow=e.workflow,this.severity=e.severity}read(){return k({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this}})}unread(){return C({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this}})}seen(){return S({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this}})}archive(){return x({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this}})}unarchive(){return E({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this}})}delete(){return P({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this}})}snooze(e){return A({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this,snoozeUntil:e}}
1)}unsnooze(){return M({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this}})}completePrimary(){if(!this.primaryAction)throw Error("Primary action is not available");return O({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this},actionType:"primary"})}completeSecondary(){if(!this.primaryAction)throw Error("Secondary action is not available");return O({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this},actionType:"secondary"})}revertPrimary(){if(!this.primaryAction)throw Error("Primary action is not available");return T({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this},actionType:"primary"})}revertSecondary(){if(!this.primaryAction)throw Error("Secondary action is not available");return T({emitter:(0,h.ac)(this,l),apiService:(0,h.ac)(this,u),args:{notification:this},actionType:"secondary"})}on(e,t){let i=(0,h.ac)(this,l).on(e,t);return()=>{i()}}off(e,t){(0,h.ac)(this,l).off(e,t)}};function D({emitter:e,inboxService:t,notification:i}){return new K(i,e,t)}l=new WeakMap,u=new WeakMap},9287:function(e,t,i){"use strict";i.d(t,{Cr:function(){return b},EZ:function(){return d},Ko:function(){return g},S0:function(){return p},U9:function(){return m},ac:function(){return v},ih:function(){return h},qx:function(){return y}});var n=Object.defineProperty,r=Object.defineProperties,s=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable,l=e=>{throw TypeError(e)},u=(e,t,i)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,h=(e,t)=>{for(var i in t||(t={}))a.call(t,i)&&u(e,i,t[i]);if(o)for(var i of o(t))c.call(t,i)&&u(e,i,t[i]);return e},d=(e,t)=>r(e,s(t)),p=(e,t)=>{var i={};for(var n in e)a.call(e,n)&&0>t.indexOf(n)&&(i[n]=e[n]);if(null!=e&&o)for(var n of o(e))0>t.indexOf(n)&&c.call(e,n)&&(i[n]=e[n]);return i},f=(e,t,i)=>t.has(e)||l("Cannot "+i),v=(e,t,i)=>(f(e,t,"read from private field"),i?i.call(e):t.get(e)),g=(e,t,i)=>t.has(e)?l("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),y=(e,t,i,n)=>(f(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),m=(e,t,i)=>(f(e,t,"access private method"),i),b=(e,t,i)=>new Promise((n,r)=>{var s=e=>{try{a(i.next(e))}catch(e){r(e)}},o=e=>{try{a(i.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(s,o);a((i=i.apply(e,t)).next())})},3941:function(e,t,i){"use strict";let n,r;i.d(t,{Ur:function(){return nm},jz:function(){return t9},J:function(){return ie},zg:function(){return t6}});var s,o,a,c,l,u,h,d,p,f,v,g,y,m,b,w,_,k,C,S,x,E,A,M,O,T,I,R,N,L,j,P,W,K,D,U,q,F,B,$,z,V,H,Z,G,J,Y,X,Q,ee,et,ei,en,er,es,eo,ea,ec,el,eu,eh,ed,ep,ef,ev,eg,ey,em,eb,ew,e_,ek,eC,eS,ex,eE,eA,eM,eO={};i.r(eO),i.d(eO,{Decoder:function(){return tq},Encoder:function(){return tU},PacketType:function(){return o},isPacketValid:function(){return tz},protocol:function(){return tD}});var eT=i(7389),eI=i(9287);i(1095);var eR=i(5504);globalThis.EventTarget&&globalThis.Event||console.error(` 2 PartySocket requires a global 'EventTarget' class to be available! 3 You can polyfill this global by adding this to your code before any partysocket imports: 4 5 \`\`\` 6 import 'partysocket/event-target-polyfill'; 7 \`\`\` 8 Please file an issue at https://github.com/partykit/partykit if you're still having trouble. 9`);var eN=class extends Event{message;error;constructor(e,t){super("error",t),this.message=e.message,this.error=e}},eL=class extends Event{code;reason;wasClean=!0;constructor(e=1e3,t="",i){super("close",i),this.code=e,this.reason=t}};let ej={ErrorEvent:eN,CloseEvent:eL},eP=void 0!==eR&&void 0!==eR.versions?.node,eW="undefined"!=typeof navigator&&"ReactNative"===navigator.product,eK=eP||eW?function(e){return"data"in e?new MessageEvent(e.type,e):"code"in e||"reason"in e?new eL(e.code||1999,e.reason||"unknown reason",e):"error"in e?new eN(e.error,e):new Event(e.type,e)}:function(e){return new e.constructor(e.type,e)},eD={maxReconnectionDelay:1e4,minReconnectionDelay:3e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:Number.POSITIVE_INFINITY,maxEnqueuedMessages:Number.POSITIVE_INFINITY,startClosed:!1,debug:!1},eU=!1;function eq(){}
9var eF=class e extends EventTarget{_ws;_retryCount=-1;_uptimeTimeout;_connectTimeout;_shouldReconnect=!0;_connectLock=!1;_binaryType="blob";_closeCalled=!1;_didWarnAboutClosedSend=!1;_messageQueue=[];_debugLogger=console.log.bind(console);_url;_protocols;_options;constructor(e,t,i={}){super(),this._url=e,this._protocols=t,this._options=i,this._options.startClosed&&(this._shouldReconnect=!1),this._options.debugLogger&&(this._debugLogger=this._options.debugLogger),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return e.CONNECTING}get OPEN(){return e.OPEN}get CLOSING(){return e.CLOSING}get CLOSED(){return e.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((e,t)=>("string"==typeof t?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e),0)+(this._ws?this._ws.bufferedAmount:0)}get extensions(){return this._ws?this._ws.extensions:""}get protocol(){return this._ws?this._ws.protocol:""}get readyState(){return this._closeCalled?e.CLOSED:this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING}get url(){return this._ws?this._ws.url:""}get shouldReconnect(){return this._shouldReconnect}onclose=null;onerror=null;onmessage=null;onopen=null;close(e=1e3,t){if(this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED||this._ws.readyState===this.CLOSING){this._debug("close: already closing or closed");return}this._disconnect(e,t)}reconnect(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._didWarnAboutClosedSend=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED&&this._ws.readyState!==this.CLOSING&&this._disconnect(e,t),this._connect()}send(e){if(this._ws&&this._ws.readyState===this.OPEN)return this._debug("send",e),this._ws.send(e),!0;this._closeCalled&&!this._didWarnAboutClosedSend&&(this._didWarnAboutClosedSend=!0,console.warn("ReconnectingWebSocket: send() was called after close(). The message has been buffered, but it will only be delivered if reconnect() is called on this socket. If this socket has been discarded, the message is lost â this usually means a stale socket reference is being used."));let{maxEnqueuedMessages:t=eD.maxEnqueuedMessages}=this._options;return this._messageQueue.length<t&&(this._debug("enqueue",e),this._messageQueue.push(e)),!1}drainQueuedMessages(){let e=this._messageQueue;return this._messageQueue=[],e}_debug(...e){this._options.debug&&this._debugLogger("RWS>",...e)}_getNextDelay(){let{reconnectionDelayGrowFactor:e=eD.reconnectionDelayGrowFactor,minReconnectionDelay:t=eD.minReconnectionDelay,maxReconnectionDelay:i=eD.maxReconnectionDelay}=this._options,n=0;return this._retryCount>0&&(n=t*e**(this._retryCount-1))>i&&(n=i),this._debug("next delay",n),n}_wait(){return new Promise(e=>{setTimeout(e,this._getNextDelay())})}_getNextProtocols(e){if(!e)return Promise.resolve(null);if("string"==typeof e||Array.isArray(e))return Promise.resolve(e);if("function"==typeof e){let t=e();if(!t)return Promise.resolve(null);if("string"==typeof t||Array.isArray(t))return Promise.resolve(t);if(t.then)return t}throw Error("Invalid protocols")}_getNextUrl(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){let t=e();if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;
9let{maxRetries:e=eD.maxRetries,connectionTimeout:t=eD.connectionTimeout}=this._options;if(this._retryCount>=e){this._debug("max retries reached",this._retryCount,">=",e),this._connectLock=!1;return}this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),this._wait().then(()=>Promise.all([this._getNextUrl(this._url),this._getNextProtocols(this._protocols||null)])).then(([e,i])=>{if(this._closeCalled){this._connectLock=!1;return}this._options.WebSocket||"undefined"!=typeof WebSocket||eU||(console.error(`â¼ï¸ No WebSocket implementation available. You should define options.WebSocket. 10 11For example, if you're using node.js, run \`npm install ws\`, and then in your code: 12 13import PartySocket from 'partysocket'; 14import WS from 'ws'; 15 16const partysocket = new PartySocket({ 17 host: "127.0.0.1:1999", 18 room: "test-room", 19 WebSocket: WS 20}); 21 22`),eU=!0);let n=this._options.WebSocket||WebSocket;this._debug("connect",{url:e,protocols:i}),this._ws=i?new n(e,i):new n(e),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),t)}).catch(e=>{this._connectLock=!1,this._handleError(new ej.ErrorEvent(Error(e.message),this))})}_handleTimeout(){this._debug("timeout event"),this._handleError(new ej.ErrorEvent(Error("TIMEOUT"),this))}_disconnect(e=1e3,t){if(this._clearTimeouts(),this._ws){this._removeListeners();try{(this._ws.readyState===this.OPEN||this._ws.readyState===this.CONNECTING)&&this._ws.close(e,t),this._handleClose(new ej.CloseEvent(e,t,this))}catch(e){}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_handleOpen=e=>{this._debug("open event");let{minUptime:t=eD.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),t),function(e,t){if(!e)throw Error(t)}(this._ws,"WebSocket is not defined"),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(e=>{this._ws?.send(e)}),this._messageQueue=[],this.onopen&&this.onopen(e),this.dispatchEvent(eK(e))};_handleMessage=e=>{this._debug("message event"),this.onmessage&&this.onmessage(e),this.dispatchEvent(eK(e))};_handleError=e=>{this._debug("error event",e.message),this._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),this.onerror&&this.onerror(e),this._debug("exec error listeners"),this.dispatchEvent(eK(e)),this._connect()};_handleClose=e=>{this._debug("close event"),this._clearTimeouts(),this._options.shouldReconnectOnClose&&!this._options.shouldReconnectOnClose(e)&&(this._shouldReconnect=!1),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(e),this.dispatchEvent(eK(e))};_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError),this._ws.addEventListener("error",eq))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}};let eB=Object.create(null);eB.open="0",eB.close="1",eB.ping="2",eB.pong="3",eB.message="4",eB.upgrade="5",eB.noop="6";let e$=Object.create(null);
22Object.keys(eB).forEach(e=>{e$[eB[e]]=e});let ez={type:"error",data:"parser error"},eV="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),eH="function"==typeof ArrayBuffer,eZ=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,eG=({type:e,data:t},i,n)=>eV&&t instanceof Blob?i?n(t):eJ(t,n):eH&&(t instanceof ArrayBuffer||eZ(t))?i?n(t):eJ(new Blob([t]),n):n(eB[e]+(t||"")),eJ=(e,t)=>{let i=new FileReader;return i.onload=function(){t("b"+(i.result.split(",")[1]||""))},i.readAsDataURL(e)};function eY(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let eX="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eQ="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<eX.length;e++)eQ[eX.charCodeAt(e)]=e;let e0=e=>{let t=.75*e.length,i=e.length,n,r=0,s,o,a,c;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(n=0;n<i;n+=4)s=eQ[e.charCodeAt(n)],o=eQ[e.charCodeAt(n+1)],a=eQ[e.charCodeAt(n+2)],c=eQ[e.charCodeAt(n+3)],u[r++]=s<<2|o>>4,u[r++]=(15&o)<<4|a>>2,u[r++]=(3&a)<<6|63&c;return l},e1="function"==typeof ArrayBuffer,e2=(e,t)=>{if("string"!=typeof e)return{type:"message",data:e9(e,t)};let i=e.charAt(0);return"b"===i?{type:"message",data:e4(e.substring(1),t)}:e$[i]?e.length>1?{type:e$[i],data:e.substring(1)}:{type:e$[i]}:ez},e4=(e,t)=>e1?e9(e0(e),t):{base64:!0,data:e},e9=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,e3=(e,t)=>{let i=e.length,n=Array(i),r=0;e.forEach((e,s)=>{eG(e,!1,e=>{n[s]=e,++r===i&&t(n.join("\x1e"))})})},e5=(e,t)=>{let i=e.split("\x1e"),n=[];for(let e=0;e<i.length;e++){let r=e2(i[e],t);if(n.push(r),"error"===r.type)break}return n};function e6(e){return e.reduce((e,t)=>e+t.length,0)}function e7(e,t){if(e[0].length===t)return e.shift();let i=new Uint8Array(t),n=0;for(let r=0;r<t;r++)i[r]=e[0][n++],n===e[0].length&&(e.shift(),n=0);return e.length&&n<e[0].length&&(e[0]=e[0].slice(n)),i}function e8(e){if(e)return function(e){for(var t in e8.prototype)e[t]=e8.prototype[t];return e}(e)}e8.prototype.on=e8.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},e8.prototype.once=function(e,t){function i(){this.off(e,i),t.apply(this,arguments)}return i.fn=t,this.on(e,i),this},e8.prototype.off=e8.prototype.removeListener=e8.prototype.removeAllListeners=e8.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r=0;r<n.length;r++)if((i=n[r])===t||i.fn===t){n.splice(r,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},e8.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),i=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(i){i=i.slice(0);for(var n=0,r=i.length;n<r;++n)i[n].apply(this,t)}return this},e8.prototype.emitReserved=e8.prototype.emit,e8.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},e8.prototype.hasListeners=function(e){return!!this.listeners(e).length};let te="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function tt(e,...t){return t.reduce((t,i)=>(e.hasOwnProperty(i)&&(t[i]=e[i]),t),{})}let ti=te.setTimeout,tn=te.clearTimeout;function tr(e,t){t.useNativeTimers?(e.setTimeoutFn=ti.bind(te),e.clearTimeoutFn=tn.bind(te)):(e.setTimeoutFn=te.setTimeout.bind(te),e.clearTimeoutFn=te.clearTimeout.bind(te))}class ts extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class to extends e8{constructor(e){super(),this.writable=!1,tr(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,i){return super.emitReserved("error",new ts(e,t,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}
22onData(e){let t=e2(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return -1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){let t=function(e){let t="";for(let i in e)e.hasOwnProperty(i)&&(t.length&&(t+="&"),t+=encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t}(e);return t.length?"?"+t:""}}let ta="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),tc={},tl=0,tu=0,th;function td(e){let t="";do t=ta[e%64]+t,e=Math.floor(e/64);while(e>0);return t}function tp(){let e=td(+new Date);return e!==th?(tl=0,th=e):e+"."+td(tl++)}for(;tu<64;tu++)tc[ta[tu]]=tu;let tf=!1;try{tf="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}let tv=tf;function tg(e){let t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||tv))return new XMLHttpRequest}catch(e){}if(!t)try{return new te[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(e){}}function ty(){}let tm=null!=new tg({xdomain:!1}).responseType;class tb extends to{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){let t="https:"===location.protocol,i=location.port;i||(i=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||i!==e.port}let t=e&&e.forceBase64;this.supportsBinary=tm&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){e5(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){let e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,e3(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=tp()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new tw(this.uri(),e)}doWrite(e,t){let i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}class tw extends e8{constructor(e,t){super(),tr(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var e;let t=tt(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let i=this.xhr=new tg(t);try{i.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders)for(let e in i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&i.setRequestHeader(e,this.opts.extraHeaders[e])}catch(e){}if("POST"===this.method)try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{i.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this.opts.cookieJar)||void 0===e||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(i.timeout=this.opts.requestTimeout),i.onreadystatechange=()=>{var e;3===i.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(i)),4===i.readyState&&(200===i.status||1223===i.status?this.onLoad():this.setTimeoutFn(()=>{this.onError("number"==typeof i.status?i.status:0)},0))},i.send(this.data)}catch(e){this.setTimeoutFn(()=>{this.onError(e)},0);return}"undefined"!=typeof document&&(this.index=tw.requestsCount++,tw.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=ty,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete tw.requests[this.index],this.xhr=null}}onLoad(){let e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(tw.requestsCount=0,tw.requests={},"undefined"!=typeof document){if("function"==typeof attachEvent)attachEvent("onunload",t_);else if("function"==typeof addEventListener){let e="onpagehide"in te?"pagehide":"unload";addEventListener(e,t_,!1)}}function t_(){for(let e in tw.requests)tw.requests.hasOwnProperty(e)&&tw.requests[e].abort()}let tk="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),tC=te.WebSocket||te.MozWebSocket;i(5783).lW;
22let tS="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class tx extends to{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,i=tS?{}:tt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=tS?new tC(e,t,i):t?new tC(e,t):new tC(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let i=e[t],n=t===e.length-1;eG(i,this.supportsBinary,e=>{try{this.ws.send(e)}catch(e){}n&&tk(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=tp()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!tC}}class tE extends to{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{let t=function(e,t){r||(r=new TextDecoder);let i=[],n=0,s=-1,o=!1;return new TransformStream({transform(a,c){for(i.push(a);;){if(0===n){if(1>e6(i))break;let e=e7(i,1);o=(128&e[0])==128,n=(s=127&e[0])<126?3:126===s?1:2}else if(1===n){if(2>e6(i))break;let e=e7(i,2);s=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),n=3}else if(2===n){if(8>e6(i))break;let e=e7(i,8),t=new DataView(e.buffer,e.byteOffset,e.length),r=t.getUint32(0);if(r>2097151){c.enqueue(ez);break}s=4294967296*r+t.getUint32(4),n=3}else{if(e6(i)<s)break;let e=e7(i,s);c.enqueue(e2(o?e:r.decode(e),t)),n=0}if(0===s||s>e){c.enqueue(ez);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),s=new TransformStream({transform(e,t){var i;i=i=>{let n;let r=i.length;if(r<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,r);else if(r<65536){n=new Uint8Array(3);let e=new DataView(n.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{n=new Uint8Array(9);let e=new DataView(n.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(n[0]|=128),t.enqueue(n),t.enqueue(i)},eV&&e.data instanceof Blob?e.data.arrayBuffer().then(eY).then(i):eH&&(e.data instanceof ArrayBuffer||eZ(e.data))?i(eY(e.data)):eG(e,!1,e=>{n||(n=new TextEncoder),i(n.encode(e))})}});s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();let o=()=>{i.read().then(({done:e,value:t})=>{e||(this.onPacket(t),o())}).catch(e=>{})};o();let a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let i=e[t],n=t===e.length-1;this.writer.write(i).then(()=>{n&&tk(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}}let tA={websocket:tx,webtransport:tE,polling:tb},tM=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function tT(e){if(e.length>2e3)throw"URI too long";let t=e,i=e.indexOf("["),n=e.indexOf("]");-1!=i&&-1!=n&&(e=e.substring(0,i)+e.substring(i,n).replace(/:/g,";")+e.substring(n,e.length));let r=tM.exec(e||""),s={},o=14;for(;o--;)s[tO[o]]=r[o]||"";return -1!=i&&-1!=n&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(e,t){let i=t.replace(/\/{2,9}/g,"/").split("/");return("/"==t.slice(0,1)||0===t.length)&&i.splice(0,1),"/"==t.slice(-1)&&i.splice(i.length-1,1),i}(0,s.path),s.queryKey=function(e,t){let i={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,n){t&&(i[t]=n)}),i}(0,s.query),s}class tI extends e8{constructor(e,t={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=tT(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=tT(t.host).host),tr(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},i=e.split("&");for(let e=0,n=i.length;e<n;e++){let n=i[e].split("=");
22t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let i=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new tA[e](i)}open(){let e;if(this.opts.rememberUpgrade&&tI.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else if(0===this.transports.length){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(e){this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",e=>this.onClose("transport close",e))}probe(e){let t=this.createTransport(e),i=!1;tI.priorWebsocketSuccess=!1;let n=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!i){if("pong"===e.type&&"probe"===e.data)this.upgrading=!0,this.emitReserved("upgrading",t),t&&(tI.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{i||"closed"===this.readyState||(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}));else{let e=Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}}))};function r(){i||(i=!0,l(),t.close(),t=null)}let s=e=>{let i=Error("probe error: "+e);i.transport=t.name,r(),this.emitReserved("upgradeError",i)};function o(){s("transport closed")}function a(){s("socket closed")}function c(e){t&&e.name!==t.name&&r()}let l=()=>{t.removeListener("open",n),t.removeListener("error",s),t.removeListener("close",o),this.off("close",a),this.off("upgrading",c)};t.once("open",n),t.once("error",s),t.once("close",o),this.once("close",a),this.once("upgrading",c),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{i||t.open()},200):t.open()}onOpen(){if(this.readyState="open",tI.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0,t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":let t=Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let i=this.writeBuffer[t].data;if(i&&(e+="string"==typeof i?function(e){let t=0,i=0;for(let n=0,r=e.length;n<r;n++)(t=e.charCodeAt(n))<128?i+=1:t<2048?i+=2:t<55296||t>=57344?i+=3:(n++,i+=4);return i}(i):Math.ceil(1.33*(i.byteLength||i.size))),t>0&&e>this.maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}write(e,t,i){return this.sendPacket("message",e,t,i),this}send(e,t,i){return this.sendPacket("message",e,t,i),this}sendPacket(e,t,i,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof i&&(n=i,i=null),"closing"===this.readyState||"closed"===this.readyState)return;(i=i||{}).compress=!1!==i.compress;let r={type:e,data:t,options:i};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}onError(e){tI.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],i=0,n=e.length;for(;i<n;
22i++)~this.transports.indexOf(e[i])&&t.push(e[i]);return t}}tI.protocol=4,tI.protocol;let tR="function"==typeof ArrayBuffer,tN=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,tL=Object.prototype.toString,tj="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===tL.call(Blob),tP="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===tL.call(File);function tW(e){return tR&&(e instanceof ArrayBuffer||tN(e))||tj&&e instanceof Blob||tP&&e instanceof File}let tK=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],tD=5;(s=o||(o={}))[s.CONNECT=0]="CONNECT",s[s.DISCONNECT=1]="DISCONNECT",s[s.EVENT=2]="EVENT",s[s.ACK=3]="ACK",s[s.CONNECT_ERROR=4]="CONNECT_ERROR",s[s.BINARY_EVENT=5]="BINARY_EVENT",s[s.BINARY_ACK=6]="BINARY_ACK";class tU{constructor(e){this.replacer=e}encode(e){return(e.type===o.EVENT||e.type===o.ACK)&&function e(t,i){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let i=0,n=t.length;i<n;i++)if(e(t[i]))return!0;return!1}if(tW(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1==arguments.length)return e(t.toJSON(),!0);for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&e(t[i]))return!0;return!1}(e)?this.encodeAsBinary({type:e.type===o.EVENT?o.BINARY_EVENT:o.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===o.BINARY_EVENT||e.type===o.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=function(e){let t=[],i=e.data;return e.data=function e(t,i){if(!t)return t;if(tW(t)){let e={_placeholder:!0,num:i.length};return i.push(t),e}if(Array.isArray(t)){let n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e(t[r],i);return n}if("object"==typeof t&&!(t instanceof Date)){let n={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e(t[r],i));return n}return t}(i,t),e.attachments=t.length,{packet:e,buffers:t}}(e),i=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(i),n}}class tq extends e8{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof e?{reviver:e}:e)}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let i=(t=this.decodeString(e)).type===o.BINARY_EVENT;i||t.type===o.BINARY_ACK?(t.type=i?o.EVENT:o.ACK,this.reconstructor=new tF(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(tW(e)||e.base64){if(this.reconstructor)(t=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw Error("got binary data when not reconstructing a packet")}else throw Error("Unknown type: "+e)}decodeString(e){let t=0,i={type:Number(e.charAt(0))};if(void 0===o[i.type])throw Error("unknown packet type "+i.type);if(i.type===o.BINARY_EVENT||i.type===o.BINARY_ACK){let n=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);let r=e.substring(n,t);if(r!=Number(r)||"-"!==e.charAt(t))throw Error("Illegal attachments");let s=Number(r);if(!tB(s)||s<0)throw Error("Illegal attachments");if(s>this.opts.maxAttachments)throw Error("too many attachments");i.attachments=s}if("/"===e.charAt(t+1)){let n=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);i.nsp=e.substring(n,t)}else i.nsp="/";let n=e.charAt(t+1);if(""!==n&&Number(n)==n){let n=t+1;for(;++t;){let i=e.charAt(t);if(null==i||Number(i)!=i){--t;break}if(t===e.length)break}i.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(tq.isPayloadValid(i.type,n))i.data=n;else throw Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case o.CONNECT:return t$(t);case o.DISCONNECT:return void 0===t;case o.CONNECT_ERROR:return"string"==typeof t||t$(t);case o.EVENT:case o.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===tK.indexOf(t[0]));case o.ACK:case o.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class tF{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t,i;let e=(t=this.reconPack,i=this.buffers,t.data=function e(t,i){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<i.length)return i[t.num];throw Error("illegal attachments")}if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=e(t[n],i);else if("object"==typeof t)for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=e(t[n],i));return t}(t.data,i),delete t.attachments,t);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let tB=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function t$(e){return"[object Object]"===Object.prototype.toString.call(e)}function tz(e){var t;return"string"==typeof e.nsp&&(void 0===(t=e.id)||tB(t))&&function(e,t){switch(e){case o.CONNECT:return void 0===t||t$(t);case o.DISCONNECT:return void 0===t;case o.EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===tK.indexOf(t[0]));case o.ACK:return Array.isArray(t);case o.CONNECT_ERROR:return"string"==typeof t||t$(t);default:return!1}}(e.type,e.data)}function tV(e,t,i){return e.on(t,i),function(){e.off(t,i)}}let tH=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class tZ extends e8{constructor(e,t,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[tV(e,"open",this.onopen.bind(this)),tV(e,"packet",this.onpacket.b
22ind(this)),tV(e,"error",this.onerror.bind(this)),tV(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(tH.hasOwnProperty(e))throw Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let i={type:o.EVENT,data:t};if(i.options={},i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){let e=this.ids++,n=t.pop();this._registerAckCallback(e,n),i.id=e}let n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return(!this.flags.volatile||n&&this.connected)&&(this.connected?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){var i;let n=null!==(i=this.flags.timeout)&&void 0!==i?i:this._opts.ackTimeout;if(void 0===n){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error("operation has timed out"))},n);this.acks[e]=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,[null,...e])}}emitWithAck(e,...t){let i=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise((n,r)=>{t.push((e,t)=>i?e?r(e):n(t):n(e)),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...n)=>{if(i===this._queue[0])return null!==e?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...n)),i.pending=!1,this._drainQueue()}),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;let t=this._queue[0];(!t.pending||e)&&(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:o.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(!(e.nsp!==this.nsp))switch(e.type){case o.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case o.EVENT:case o.BINARY_EVENT:this.onevent(e);break;case o.ACK:case o.BINARY_ACK:this.onack(e);break;case o.DISCONNECT:this.ondisconnect();break;case o.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){let t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length)for(let t of this._anyListeners.slice())t.apply(this,e);super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,i=!1;return function(...n){i||(i=!0,t.packet({type:o.ACK,id:e,data:n}))}}onack(e){let t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}
22destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:o.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let i=0;i<t.length;i++)if(e===t[i]){t.splice(i,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let i=0;i<t.length;i++)if(e===t[i]){t.splice(i,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let t of this._anyOutgoingListeners.slice())t.apply(this,e.data)}}function tG(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}tG.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),i=Math.floor(t*this.jitter*e);e=(1&Math.floor(10*t))==0?e-i:e+i}return 0|Math.min(e,this.max)},tG.prototype.reset=function(){this.attempts=0},tG.prototype.setMin=function(e){this.ms=e},tG.prototype.setMax=function(e){this.max=e},tG.prototype.setJitter=function(e){this.jitter=e};class tJ extends e8{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,tr(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(i=t.randomizationFactor)&&void 0!==i?i:.5),this.backoff=new tG({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;let n=t.parser||eO;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new tI(this.uri,this.opts);let t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let n=tV(t,"open",function(){i.onopen(),e&&e()}),r=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},s=tV(t,"error",r);if(!1!==this._timeout){let e=this._timeout,i=this.setTimeoutFn(()=>{n(),r(Error("timeout")),t.close()},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}return this.subs.push(n),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(tV(e,"ping",this.onping.bind(this)),tV(e,"data",this.ondata.bind(this)),tV(e,"error",this.onerror.bind(this)),tV(e,"close",this.onclose.bind(this)),tV(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){tk(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new tZ(this,e,t),this.nsps[e]=i),i}_destroy(e){for(let e of Object.keys(this.nsps))if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let i=0;i<t.length;
22i++)this.engine.write(t[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let i=this.setTimeoutFn(()=>{!e.skipReconnect&&(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}let tY={};function tX(e,t){let i;"object"==typeof e&&(t=e,e=void 0);let n=function(e,t="",i){let n=e;i=i||"undefined"!=typeof location&&location,null==e&&(e=i.protocol+"//"+i.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?i.protocol+e:i.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==i?i.protocol+"//"+e:"https://"+e),n=tT(e)),!n.port&&(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";let r=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port+t,n.href=n.protocol+"://"+r+(i&&i.port===n.port?"":":"+n.port),n}(e,(t=t||{}).path||"/socket.io"),r=n.source,s=n.id,o=n.path,a=tY[s]&&o in tY[s].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?i=new tJ(r,t):(tY[s]||(tY[s]=new tJ(r,t)),i=tY[s]),n.query&&!t.query&&(t.query=n.queryKey),i.socket(n.path,t)}Object.assign(tX,{Manager:tJ,Socket:tZ,io:tX,connect:tX});var tQ=(e,t)=>e===t||!!e&&!!t&&e.length===t.length&&e.every((e,i)=>e===t[i]),t0=class extends Error{constructor(e){super(e),this.name="TagsFilterValidationError"}};function t1(e,t){if(e.length>t)throw new t0(`At most ${t} tags are allowed in a single OR-group`);for(let t of e)if("string"!=typeof t)throw new t0("Tags must be strings");return e}function t2(e){if(void 0===e)return[];if(null===e)throw new t0("Tags must be an array or object");if("object"==typeof e&&!Array.isArray(e))return function(e){let t=Object.keys(e),i=Object.prototype.hasOwnProperty.call(e,"or"),n=Object.prototype.hasOwnProperty.call(e,"and");if(i&&n)throw new t0('Tags filter cannot have both "or" and "and"');if(i){if(1!==t.length)throw new t0("Invalid tags filter object");let i=e.or;if(!Array.isArray(i))throw new t0('"or" must be an array of strings');return 0===i.length?[]:[t1(i,100)]}if(n){if(1!==t.length)throw new t0("Invalid tags filter object");let i=e.and;if(!Array.isArray(i))throw new t0('"and" must be an array');if(0===i.length)return[];if(i.length>30)throw new t0("At most 30 tag groups are allowed");let n=[],r=0;for(let e of i){if("object"!=typeof e||null===e||Array.isArray(e))throw new t0('Each "and" entry must be an object { or: string[] }');if(1!==Object.keys(e).length||!Object.prototype.hasOwnProperty.call(e,"or"))throw new t0('Each "and" entry must be { or: string[] }');let t=e.or;if(!Array.isArray(t))throw new t0('"or" must be an array of strings');if(0===t.length)throw new t0("Each tag group must be a non-empty array of strings");let i=t1(t,100);r+=i.length,n.push(i)}if(r>200)throw new t0("At most 200 total tag values are allowed");return n}throw new t0('Tags filter object must have "or" or "and"')}(e);if(!Array.isArray(e))throw new t0("Tags must be an array or object");if(0===e.length)return[];if(Array.isArray(e[0]))throw new t0("Nested tag arrays are not supported; use { and: [{ or: string[] }, ...] } for multiple OR-groups");if(e.length>100)throw new t0("At most 100 tags are allowed in a single OR-group");for(let t of e)if("string"!=typeof t)throw new t0("Tags must be strings");return[e]}function t4(e){if(void 0===e)return"";let t=t2(e);return 0===t.length?"":JSON.stringify(Array.from(new Map(t.map(e=>{let t=Array.from(new Set(e)).sort((e,t)=>
22e.localeCompare(t));return[JSON.stringify(t),t]})).values()).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t))))}var t9=(e,t)=>{try{return t4(e)===t4(t)}catch(e){return!1}},t3=(e,t)=>tQ(Array.isArray(e)?e:e?[e]:[],Array.isArray(t)?t:t?[t]:[]),t5=(e,t)=>{if(!e&&!t)return!0;if(!e||!t)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(e){return!1}},t6=(e,t)=>t5(e.data,t.data)&&t9(e.tags,t.tags)&&e.read===t.read&&e.archived===t.archived&&e.snoozed===t.snoozed&&e.seen===t.seen&&t3(e.severity,t.severity)&&e.createdGte===t.createdGte&&e.createdLte===t.createdLte;function t7(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function t8(e){return null===e||"boolean"==typeof e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)}function ie(e,t){var i,n;return(void 0===t.read||e.isRead===t.read)&&(void 0===t.seen||e.isSeen===t.seen)&&(void 0===t.archived||e.isArchived===t.archived)&&(void 0===t.snoozed||e.isSnoozed===t.snoozed)&&function(e,t){let i;try{i=t2(t)}catch(e){return!1}return 0===i.length||!!e&&0!==e.length&&i.every(t=>t.some(t=>e.includes(t)))}(e.tags,t.tags)&&(i=e.data,!(n=t.data)||0===Object.keys(n).length||!!i&&function e(t,i,n,r){if(r>2)return!1;for(let[s,o]of Object.entries(i)){if(s.startsWith("$")||s.startsWith(".")||"__proto__"===s||"constructor"===s||"prototype"===s)return!1;let i=[...n,s];if(t7(o)&&!(Object.prototype.hasOwnProperty.call(o,"or")||Object.prototype.hasOwnProperty.call(o,"and"))){if(!e(t,o,i,r+1))return!1;continue}let a=function(e){if(void 0===e)return[];if(Array.isArray(e))return 0===e.length?[]:e.every(t8)?[e]:null;if(t7(e)){let t=Object.prototype.hasOwnProperty.call(e,"or"),i=Object.prototype.hasOwnProperty.call(e,"and");if(t&&i)return null;let n=Object.keys(e);if(t){if(1!==n.length)return null;let t=e.or;return Array.isArray(t)?0===t.length?[]:t.every(t8)?[t]:null:null}if(i){if(1!==n.length)return null;let t=e.and;if(!Array.isArray(t))return null;let i=[];for(let e of t){if(!t7(e)||1!==Object.keys(e).length||!("or"in e))return null;let t=e.or;if(!Array.isArray(t)||0===t.length||!t.every(t8))return null;i.push(t)}return i}return null}return t8(e)?[[e]]:null}(o);if(null===a)return!1;if(0===a.length)continue;let c=t?function(e,t){let i=e;for(let e of t){if(null==i||"object"!=typeof i||Array.isArray(i))return;i=i[e]}return i}(t,i):void 0;if(void 0===c||!a.every(e=>(function(e,t){return Array.isArray(t)?t.some(t=>e.some(e=>e===t)):e.some(e=>e===t)})(e,c)))return!1}return!0}(i,n,[],1))&&function(e,t,i){if(!t&&!i)return!0;let n=new Date(e).getTime();return(!t||!(n<t))&&(!i||!(n>i))}(e.createdAt,t.createdGte,t.createdLte)}var it=class{constructor(e,t,i,n,r){var s;(0,eI.Ko)(this,a),(0,eI.Ko)(this,c),(0,eI.Ko)(this,l),(0,eI.Ko)(this,u),(0,eI.Ko)(this,h,!1),(0,eI.qx)(this,a,t),(0,eI.qx)(this,c,i),(0,eI.qx)(this,l,n),(0,eI.qx)(this,u,r),this.id=e.id,this.identifier=e.identifier,this.topicKey=e.topicKey,this.preferences=null==(s=e.preferences)?void 0:s.map(e=>new iu((0,eI.ih)({},e),(0,eI.ac)(this,a),(0,eI.ac)(this,c),(0,eI.ac)(this,l),(0,eI.ac)(this,u)))}update(e){return(0,eI.Cr)(this,null,function*(){return io({emitter:(0,eI.ac)(this,a),apiService:(0,eI.ac)(this,c),cache:(0,eI.ac)(this,l),useCache:(0,eI.ac)(this,u),args:(0,eI.EZ)((0,eI.ih)({},e),{subscription:this})})})}updatePreference(e){return(0,eI.Cr)(this,null,function*(){return(0,eI.ac)(this,h)?{error:new eT.Ly("Cannot update a deleted subscription",Error("Subscription is stale"))}:ia({emitter:(0,eI.ac)(this,a),apiService:(0,eI.ac)(this,c),cache:(0,eI.ac)(this,l),useCache:(0,eI.ac)(this,u),args:(0,eI.EZ)((0,eI.ih)({},e),{subscriptionId:this.identifier})})})}bulkUpdatePreferences(e){return(0,eI.Cr)(this,null,function*(){return(0,eI.ac)(this,h)?{error:new eT.Ly("Cannot bulk update a deleted subscription",Error("Subscription is stale"))}:ic({emitter:(0,eI.ac)(this,a),apiService:(0,eI.ac)(this,c),cache:(0,eI.ac)(this,l),useCache:(0,eI.ac)(this,u),args:e.map(e=>(0,eI.EZ)((0,eI.ih)({},e),{subscriptionId:this.identifier}))})})}delete(){return(0,eI.Cr)(this,null,function*(){return(0,eI.ac)(this,h)?{error:new eT.Ly("Cannot delete an already deleted subscription",Error("Subscription is stale"))}:il({emitter:(0,eI.ac)(this,a),apiService:(0,eI.ac)(this,c),args:{subscription:this}})})}};a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,h=new WeakMap;var ii=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,cache:i,options:n,args:r}){try{let{useCache:s,refetch:o}=n,a=s&&!o?i.getAll(r):void 0;return e.emit("subscriptions.list.pending",{args:r,data:a}
22),(!a||o)&&(a=(yield t.fetchSubscriptions(r.topicKey)).map(n=>new it((0,eI.EZ)((0,eI.ih)({},n),{topicKey:r.topicKey}),e,t,i,s)),s&&(i.set(r,a),a=i.getAll(r))),e.emit("subscriptions.list.resolved",{args:r,data:a}),{data:a}}catch(t){return e.emit("subscriptions.list.resolved",{args:r,error:t}),{error:new eT.Ly("Failed to fetch subscriptions",t)}}}),ir=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,cache:i,options:n,args:r}){try{let{useCache:s,refetch:o}=n,a=s&&!o?i.get(r):void 0;if(e.emit("subscription.get.pending",{args:r,data:a}),!a||o){let n=yield t.getSubscription(r.topicKey,r.identifier,r.workflowIds,r.tags);if(!n)return e.emit("subscription.get.resolved",{args:r,data:null}),{data:null};a=new it((0,eI.EZ)((0,eI.ih)({},n),{topicKey:r.topicKey}),e,t,i,s),s&&(i.setOne(r,a),a=i.get(r))}return e.emit("subscription.get.resolved",{args:r,data:a}),{data:a}}catch(t){return e.emit("subscription.get.resolved",{args:r,error:t}),{error:new eT.Ly("Failed to fetch subscription",t)}}}),is=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,cache:i,useCache:n,args:r}){var s;try{e.emit("subscription.create.pending",{args:r});let o=yield t.createSubscription({identifier:null!=(s=r.identifier)?s:"",name:r.name,topicKey:r.topicKey,topicName:r.topicName,preferences:r.preferences}),a=new it((0,eI.EZ)((0,eI.ih)({},o),{topicKey:r.topicKey}),e,t,i,n);return e.emit("subscription.create.resolved",{args:r,data:a}),{data:a}}catch(t){return e.emit("subscription.create.resolved",{args:r,error:t}),{error:new eT.Ly("Failed to create subscription",t)}}}),io=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,cache:i,useCache:n,args:r}){let s="identifier"in r?r.identifier:r.subscription.identifier,o="topicKey"in r?r.topicKey:r.subscription.topicKey;try{e.emit("subscription.update.pending",{args:r});let a=yield t.updateSubscription({topicKey:o,identifier:s,name:r.name,preferences:r.preferences}),c=new it((0,eI.EZ)((0,eI.ih)({},a),{topicKey:o}),e,t,i,n);return e.emit("subscription.update.resolved",{args:r,data:c}),{data:c}}catch(t){return e.emit("subscription.update.resolved",{args:r,error:t}),{error:new eT.Ly("Failed to update subscription",t)}}}),ia=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,cache:i,useCache:n,args:r}){var s,o;let a="workflowId"in r?r.workflowId:null==(o=null==(s=r.preference)?void 0:s.workflow)?void 0:o.id;try{e.emit("subscription.preference.update.pending",{args:r,data:"preference"in r?new iu((0,eI.ih)((0,eI.ih)({},r.preference),"boolean"==typeof r.value?{enabled:r.value}:{condition:r.value}),e,t,i,n):void 0});let s=yield t.updateSubscriptionPreference((0,eI.ih)({subscriptionIdentifier:r.subscriptionId,workflowId:a},"boolean"==typeof r.value?{enabled:r.value,email:r.value,sms:r.value,in_app:r.value,chat:r.value,push:r.value}:{condition:r.value})),o=new iu((0,eI.ih)({},s),e,t,i,n);return e.emit("subscription.preference.update.resolved",{args:r,data:o}),{data:o}}catch(t){return e.emit("subscription.preference.update.resolved",{args:r,error:t}),{error:new eT.Ly("Failed to update subscription",t)}}}),ic=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,cache:i,useCache:n,args:r}){try{let s=r.map(r=>"preference"in r?new iu((0,eI.ih)((0,eI.ih)({},r.preference),"boolean"==typeof r.value?{enabled:r.value}:{condition:r.value}),e,t,i,n):void 0).filter(e=>void 0!==e);e.emit("subscription.preferences.bulk_update.pending",{args:r,data:s});let o=r.map(e=>{var t,i,n,r,s,o;return(0,eI.ih)({subscriptionIdentifier:e.subscriptionId,workflowId:"workflowId"in e?e.workflowId:null!=(o=null!=(s=null==(i=null==(t=e.preference)?void 0:t.workflow)?void 0:i.id)?s:null==(r=null==(n=e.preference)?void 0:n.workflow)?void 0:r.identifier)?o:""},"boolean"==typeof e.value?{enabled:e.value,email:e.value,sms:e.value,in_app:e.value,chat:e.value,push:e.value}:{condition:e.value})}),a=(yield t.bulkUpdateSubscriptionPreferences(o)).map(r=>new iu(r,e,t,i,n));return e.emit("subscription.preferences.bulk_update.resolved",{args:r,data:a}),{data:a}}catch(t){return e.emit("subscription.preferences.bulk_update.resolved",{args:r,error:t}),{error:new eT.Ly("Failed to bulk update subscription preferences",t)}}}),il=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){let n="identifier"in i?i.identifier:i.subscription.identifier,r="topicKey"in i?i.topicKey:i.subscription.topicKey;try{return e.emit("subscription.delete.pending",{args:i}),yield t.deleteSubscription({topicKey:r,identifier:n}),e.emit("subscription.delete.resolved",{args:i}),{data:void 0}}catch(t){return e.emit("subscription.delete.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to delete subscription",t)}}}),iu=class{constructor(e,t,i,n,r){var s;(0,eI.Ko)(this,d),(0,eI.Ko)(this,p),(0,eI.Ko)(this,f),(0,eI.Ko)(this,v),(0,eI.qx)(this,d,t),(0,eI.qx)(this,p,i),(0,eI.qx)(this,f,n),(0,eI.qx)(this,v,r),this.enabled=e.enabled,this.condition=null!=(s=e.condition)?s:void 0,this.workflow=e.workflow,this.subscriptionId=e.subscriptionId}update(e){return(0,eI.Cr)(this,null,function*(){var t;return ia({emitter:(0,eI.ac)(this,d),apiService:(0,eI.ac)(this,p),cache:(0,eI.ac)(this,f),useCache:(0,eI.ac)(this,v),args:{subscriptionId:this.subscriptionId,workflowId:null==(t=this.workflow)?void 0:t.id,value:e.value,preference:this}})})}};d=new WeakMap,p=new WeakMap,f=new WeakMap,v=new WeakMap;var ih=class{constructor({inboxServiceInstance:e,eventEmitterInstance:t}){(0,eI.Ko)(this,g,[]),(0,eI.Ko)(this,y),this._emitter=t,this._inboxService=e,this._emitter.on("session.initialize.resolved",({error:e,data:t})=>
22{t?(this.onSessionSuccess(t),(0,eI.ac)(this,g).forEach(e=>(0,eI.Cr)(this,[e],function*({fn:e,resolve:t}){t((yield e()))})),(0,eI.qx)(this,g,[])):e&&(this.onSessionError(e),(0,eI.qx)(this,y,e),(0,eI.ac)(this,g).forEach(({resolve:t})=>{t({error:new eT.Ly("Failed to initialize session, please contact the support",e)})}),(0,eI.qx)(this,g,[]))})}onSessionSuccess(e){}onSessionError(e){}callWithSession(e){return(0,eI.Cr)(this,null,function*(){return this._inboxService.isSessionInitialized?e():(0,eI.ac)(this,y)?Promise.resolve({error:new eT.Ly("Failed to initialize session, please contact the support",(0,eI.ac)(this,y))}):new Promise((t,i)=>{(0,eI.ac)(this,g).push({fn:e,resolve:t,reject:i})})})}};g=new WeakMap,y=new WeakMap;var id=class{constructor(){(0,eI.Ko)(this,m),(0,eI.qx)(this,m,new Map)}get(e){return(0,eI.ac)(this,m).get(e)}getValues(){return Array.from((0,eI.ac)(this,m).values())}entries(){return Array.from((0,eI.ac)(this,m).entries())}keys(){return Array.from((0,eI.ac)(this,m).keys())}set(e,t){(0,eI.ac)(this,m).set(e,t)}remove(e){(0,eI.ac)(this,m).delete(e)}clear(){(0,eI.ac)(this,m).clear()}};m=new WeakMap;var ip=e=>`list:${e.topicKey}`,iv=e=>e.split(":")[1],ig=e=>`item:${e.topicKey}:${e.identifier}`,iy=class{constructor({emitterInstance:e,inboxServiceInstance:t,useCache:i}){(0,eI.Ko)(this,b),(0,eI.Ko)(this,w),(0,eI.Ko)(this,_),(0,eI.Ko)(this,k),(0,eI.Ko)(this,C),this.handleCreate=e=>{let t=ip({topicKey:e.topicKey}),i=(0,eI.ac)(this,w).get(t);if(i){let n=[...i,e];(0,eI.ac)(this,w).set(t,n),(0,eI.ac)(this,b).emit("subscriptions.list.updated",{data:{topicKey:e.topicKey,subscriptions:n}})}(0,eI.ac)(this,k).set(ig({topicKey:e.topicKey,identifier:e.identifier}),e)},this.handleUpdate=e=>{let t=ip({topicKey:e.topicKey}),i=(0,eI.ac)(this,w).get(t);if(i){let n=i.map(t=>t.id===e.id?e:t);(0,eI.ac)(this,w).set(t,n),(0,eI.ac)(this,b).emit("subscriptions.list.updated",{data:{topicKey:e.topicKey,subscriptions:n}})}(0,eI.ac)(this,k).set(ig({topicKey:e.topicKey,identifier:e.identifier}),e)},this.handlePreferenceUpdate=e=>{this.updateSubscriptionPreferences([e])},this.handleBulkPreferenceUpdate=e=>{this.updateSubscriptionPreferences(e)},this.updateSubscriptionPreferences=e=>{var t;let i=new Map;for(let n of e){let e=null!=(t=i.get(n.subscriptionId))?t:[];e.push(n),i.set(n.subscriptionId,e)}for(let e of(0,eI.ac)(this,w).keys()){let t=(0,eI.ac)(this,w).get(e);if(!t)continue;let n=!1,r=t.map(e=>{let t=i.get(e.identifier);return t?(n=!0,this.createUpdatedSubscription(e,t)):e});n&&((0,eI.ac)(this,w).set(e,r),(0,eI.ac)(this,b).emit("subscriptions.list.updated",{data:{topicKey:iv(e),subscriptions:r}}))}for(let e of(0,eI.ac)(this,k).keys()){let t=(0,eI.ac)(this,k).get(e);if(!t)continue;let n=i.get(t.identifier);if(n){let i=this.createUpdatedSubscription(t,n);(0,eI.ac)(this,k).set(e,i),(0,eI.ac)(this,b).emit("subscription.update.resolved",{args:{subscription:t},data:i})}}},this.createUpdatedSubscription=(e,t)=>{var i;let n=null==(i=e.preferences)?void 0:i.map(e=>t.find(t=>t.workflow.id===e.workflow.id)||e);return new it({id:e.id,identifier:e.identifier,topicKey:e.topicKey,preferences:n},(0,eI.ac)(this,b),(0,eI.ac)(this,C),this,(0,eI.ac)(this,_))},this.handleDelete=e=>{let t=ip({topicKey:e.topicKey}),i=(0,eI.ac)(this,w).get(t);if(i){let n=i.filter(t=>t.id!==e.id);(0,eI.ac)(this,w).set(t,n),(0,eI.ac)(this,b).emit("subscriptions.list.updated",{data:{topicKey:e.topicKey,subscriptions:n}})}(0,eI.ac)(this,k).remove(ig({topicKey:e.topicKey,identifier:e.identifier}))},this.handleDeleteByIdentifier=e=>{for(let t of(0,eI.ac)(this,w).keys()){let i=(0,eI.ac)(this,w).get(t);if(i){let n=i.find(t=>t.identifier===e);if(n){let r=i.filter(t=>t.identifier!==e);(0,eI.ac)(this,w).set(t,r),(0,eI.ac)(this,b).emit("subscriptions.list.updated",{data:{topicKey:iv(t),subscriptions:r}}),(0,eI.ac)(this,k).remove(ig({topicKey:n.topicKey,identifier:n.identifier}));return}}}for(let t of(0,eI.ac)(this,k).keys()){let i=(0,eI.ac)(this,k).get(t);if(i&&i.identifier===e){(0,eI.ac)(this,k).remove(t);return}}},(0,eI.qx)(this,b,e),(0,eI.qx)(this,w,new id),(0,eI.qx)(this,k,new id),(0,eI.qx)(this,C,t),(0,eI.qx)(this,_,i),(0,eI.ac)(this,b).on("subscription.create.resolved",({data:e})=>{e&&this.handleCreate(e)}),(0,eI.ac)(this,b).on("subscription.update.resolved",({data:e})=>{e&&this.handleUpdate(e)}),(0,eI.ac)(this,b).on("subscription.delete.resolved",({args:e})=>{"subscription"in e?this.handleDelete(e.subscription):"identifier"in e&&this.handleDeleteByIdentifier(e.identifier)}),(0,eI.ac)(this,b).on("subscription.preference.update.pending",({data:e})=>{e&&this.handlePreferenceUpdate(e)}),(0,eI.ac)(this,b).on("subscription.preference.update.resolved",({data:e})=>{e&&this.handlePreferenceUpdate(e)}),(0,eI.ac)(this,b).on("subscription.preferences.bulk_update.resolved",({data:e})=>{e&&e.length>0&&this.handleBulkPreferenceUpdate(e)})}has(e){return void 0!==(0,eI.ac)(this,w).get(ip(e))}set(e,t){for(let i of((0,eI.ac)(this,w).set(ip(e),t),t))(0,eI.ac)(this,k).set(ig({topicKey:e.topicKey,identifier:i.identifier}),i)}setOne(e,t){(0,eI.ac)(this,k).set(ig(e),t)}getAll(e){return(0,eI.ac)(this,w).get(ip(e))}get(e){return(0,eI.ac)(this,k).get(ig(e))}invalidate(e){let t=ip({topicKey:e.topicKey}),i=(0,eI.ac)(this,w).get(t);if(i)for(let t of i)(0,eI.ac)(this,k).remove(ig({topicKey:e.topicKey,identifier:t.identifier}));for(let i of((0,eI.ac)(this,w).remove(t),(0,eI.ac)(this,k).keys()))i.startsWith(`item:${e.topicKey}:`)&&(0,eI.ac)(this,k).remove(i)}clearAll(){(0,eI.ac)(this,w).clear(),(0,eI.ac)(this,k).clear()}};b=new WeakMap,w=new WeakMap,_=new WeakMap,k=new WeakMap,C=new WeakMap;var im=class extends ih{constructor({useCache:e,inboxServiceInstance:t,eventEmitterInstance:i,subscriber:n,contextKey:r}){super({eventEmitterInstance:i,inboxServiceInstance:t}),(0,eI.Ko)(this,S),(0,eI.Ko)(this,x),(0,eI.Ko)(this,E),this.cache=new iy({emitterInstance:this._emitter,inboxServiceInstance:this._inboxService,useCache:e}),(0,eI.qx)(this,S,e),(0,eI.qx)(this,x,n),(0,eI.qx)(this,E,r)}list(e,t){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>{var i;return ii({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,options:(0,eI.EZ)((0,eI.ih)({},t),{useCache:null!=(i=null==t?void 0:t.useCache)?i:(0,eI.ac)(this,S)}),args:e})})})}get(e,t){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>{var i,n;return ir({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,options:(0,eI.EZ)((0,eI.ih)({},t),{useCache:null!=(i=null==t?void 0:t.useCache)?i:(0,eI.ac)(this,S)}),args:(0,eI.EZ)((0,eI.ih)({},e),{identifier:null!=(n=e.identifier)?n:(0,eT.hi)({topicKey:e.topicKey,subscriberId:(0,eI.ac)(this,x).subscriberId,contextKey:(0,eI.ac)(this,E)})})})})})}create(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>is({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,useCache:(0,eI.ac)(this,S),args:e}))})}update(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>io({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,useCache:(0,eI.ac)(this,S),args:e}))})}delete(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>il({emitter:this._emitter,apiService:this._inboxService,args:e}))})}};S=new WeakMap,x=new WeakMap,E=new WeakMap;var ib=class{constructor(e={}){this.DEFAULT_BACKEND_URL="undefined"!=typeof window&&window.NOVU_LOCAL_BACKEND_URL||"https://api.novu.co";let{apiVersion:t="v1",apiUrl:i=this.DEFAULT_BACKEND_URL,headers:n={}}=e||{};this.apiVersion=t,this.apiUrl=`${i}/${t}`,this.headers=(0,eI.ih)({"Novu-API-Version":"2024-06-26","Novu-Client-Version":"@novu/[email protected]","Content-Type":"application/json"},n)}setAuthorizationToken(e){this.headers.Authorization=`Bearer ${e}`}setKeylessHeader(e){var t;let i=e||"undefined"!=typeof window&&(null==(t=window.localStorage)?void 0:t.getItem("novu_keyless_application_identifier"));i&&i.startsWith("pk_keyless_")&&(this.headers["Novu-Application-Identifier"]=i)}setHeaders(e){this.headers=(0,eI.ih)((0,eI.ih)({},this.headers),e)}get(e,t,i=!0){return(0,eI.Cr)(this,null,function*(){return this.doFetch({path:e,searchParams:t,options:{method:"GET"},unwrapEnvelope:i})})}post(e,t,i){return(0,eI.Cr)(this,null,function*(){return this.doFetch({path:e,options:{method:"POST",body:t,headers:null==i?void 0:i.headers}})})}patch(e,t){return(0,eI.Cr)(this,null,function*(){return this.doFetch({path:e,options:{method:"PATCH",body:t}})})}delete(e,t){return(0,eI.Cr)(this,null,function*(){return this.doFetch({path:e,options:{method:"DELETE",body:t}})})}doFetch(e){return(0,eI.Cr)(this,arguments,function*({path:e,searchParams:t,options:i,unwrapEnvelope:n=!0}){let r=function(...e){return e.reduce((e,t)=>
22(t&&e.push(t.replace(RegExp("(?<!https?:)\\/+","g"),"/").replace(/^\/+|\/+$/g,"")),e),[]).join("/").replace(/\/\?/,"?")}(this.apiUrl,e,t?`?${t.toString()}`:""),s={method:(null==i?void 0:i.method)||"GET",headers:(0,eI.ih)((0,eI.ih)({},this.headers),(null==i?void 0:i.headers)||{}),body:(null==i?void 0:i.body)?JSON.stringify(i.body):void 0},o=yield fetch(r,s);if(!o.ok){let e=yield o.json();throw Error(`${this.headers["Novu-Client-Version"]} error. Status: ${o.status}, Message: ${e.message}`)}if(204===o.status)return;let a=yield o.json();return n?a.data:a})}},iw="/inbox",i_=`${iw}/notifications`,ik=`${iw}/chat/oauth`,iC=`${iw}/channel-connections`,iS=`${iC}/oauth`,ix=`${iw}/channel-endpoints`,iE=`${ix}/oauth`;function iA(e){let t=new URLSearchParams;if(e.subscriberId&&t.append("subscriberId",e.subscriberId),e.integrationIdentifier&&t.append("integrationIdentifier",e.integrationIdentifier),e.connectionIdentifier&&t.append("connectionIdentifier",e.connectionIdentifier),e.channel&&t.append("channel",e.channel),e.providerId&&t.append("providerId",e.providerId),void 0!==e.contextKeys){if(0===e.contextKeys.length)t.append("contextKeys","");else for(let i of e.contextKeys)t.append("contextKeys",i)}return e.limit&&t.append("limit",String(e.limit)),e.after&&t.append("after",e.after),e.before&&t.append("before",e.before),t.size?`?${t.toString()}`:""}var iM=class{constructor(e={}){this.isSessionInitialized=!1,(0,eI.Ko)(this,A),(0,eI.qx)(this,A,new ib(e))}initializeSession(e){return(0,eI.Cr)(this,arguments,function*({applicationIdentifier:e,subscriberHash:t,contextHash:i,subscriber:n,defaultSchedule:r,context:s}){let o=yield(0,eI.ac)(this,A).post(`${iw}/session`,{applicationIdentifier:e,subscriberHash:t,contextHash:i,subscriber:n,defaultSchedule:r,context:s});return(0,eI.ac)(this,A).setAuthorizationToken(o.token),(0,eI.ac)(this,A).setKeylessHeader(o.applicationIdentifier),this.isSessionInitialized=!0,o})}fetchNotifications({after:e,archived:t,limit:i=10,offset:n,read:r,tags:s,snoozed:o,seen:a,data:c,severity:l,createdGte:u,createdLte:h}){let d=new URLSearchParams(`limit=${i}`);if(e&&d.append("after",e),n&&d.append("offset",`${n}`),!function(e,t){if(void 0!==t){if(Array.isArray(t)){if(0===t.length)return;for(let i of t)e.append("tags[]",i);return}if("or"in t){if(0===t.or.length)return;for(let i of t.or)e.append("tags[]",i);return}if("and"in t){if(0===t.and.length)return;t.and.forEach((t,i)=>{for(let n of t.or)e.append(`tags[${i}][]`,n)})}}}(d,s),void 0!==r&&d.append("read",`${r}`),void 0!==t&&d.append("archived",`${t}`),void 0!==o&&d.append("snoozed",`${o}`),void 0!==a&&d.append("seen",`${a}`),void 0!==c&&d.append("data",JSON.stringify(c)),l&&Array.isArray(l))for(let e of l)d.append("severity[]",e);else l&&d.append("severity",l);return u&&d.append("createdGte",`${u}`),h&&d.append("createdLte",`${h}`),(0,eI.ac)(this,A).get(i_,d,!1)}count({filters:e}){return(0,eI.ac)(this,A).get(`${i_}/count`,new URLSearchParams({filters:JSON.stringify(e)}),!1)}read(e){return(0,eI.ac)(this,A).patch(`${i_}/${e}/read`)}unread(e){return(0,eI.ac)(this,A).patch(`${i_}/${e}/unread`)}archive(e){return(0,eI.ac)(this,A).patch(`${i_}/${e}/archive`)}unarchive(e){return(0,eI.ac)(this,A).patch(`${i_}/${e}/unarchive`)}snooze(e,t){return(0,eI.ac)(this,A).patch(`${i_}/${e}/snooze`,{snoozeUntil:t})}unsnooze(e){return(0,eI.ac)(this,A).patch(`${i_}/${e}/unsnooze`)}readAll({tags:e,data:t}){return(0,eI.ac)(this,A).post(`${i_}/read`,{tags:e,data:t?JSON.stringify(t):void 0})}archiveAll({tags:e,data:t}){return(0,eI.ac)(this,A).post(`${i_}/archive`,{tags:e,data:t?JSON.stringify(t):void 0})}archiveAllRead({tags:e,data:t}){return(0,eI.ac)(this,A).post(`${i_}/read-archive`,{tags:e,data:t?JSON.stringify(t):void 0})}delete(e){return(0,eI.ac)(this,A).delete(`${i_}/${e}/delete`)}deleteAll({tags:e,data:t}){return(0,eI.ac)(this,A).post(`${i_}/delete`,{tags:e,data:t?JSON.stringify(t):void 0})}markAsSeen({notificationIds:e,tags:t,data:i}){return(0,eI.ac)(this,A).post(`${i_}/seen`,{notificationIds:e,tags:t,data:i?JSON.stringify(i):void 0})}seen(e){return this.markAsSeen({notificationIds:[e]})}completeAction({actionType:e,notificationId:t}){return(0,eI.ac)(this,A).patch(`${i_}/${t}/complete`,{actionType:e})}revertAction({actionType:e,notificationId:t}){return(0,eI.ac)(this,A).patch(`${i_}/${t}/revert`,{actionType:e})}fetchPreferences({tags:e,severity:t,criticality:i}){let n=new URLSearchParams;if(e)for(let t of e)n.append("tags[]",t);if(t&&Array.isArray(t))for(let e of t)n.append("severity[]",e);else t&&n.append("severity",t);i&&n.append("criticality",i);let r=n.size?`?${n.toString()}`:"";return(0,eI.ac)(this,A).get(`${iw}/preferences${r}`)}bulkUpdatePreferences(e){return(0,eI.ac)(this,A).patch(`${iw}/preferences/bulk`,{preferences:e})}updateGlobalPreferences(e){return(0,eI.ac)(this,A).patch(`${iw}/preferences`,e)}updateWorkflowPreferences({workflowId:e,channels:t}){return(0,eI.ac)(this,A).patch(`${iw}/preferences/${e}`,t)}fetchGlobalPreferences(){return(0,eI.ac)(this,A).get(`${iw}/preferences/global`)}triggerHelloWorldEvent(){return(0,eI.ac)(this,A).post("/inbox/events",{name:"hello-world",to:{subscriberId:"keyless-subscriber-id"},payload:{subject:"Novu Keyless Environment",body:"You're using a keyless demo environment. For full access to Novu features and cloud integration, obtain your API key.",primaryActionText:"Obtain API Key",primaryActionUrl:"https://go.novu.co/keyless",secondaryActionText:"Explore Documentation",secondaryActionUrl:"https://go.novu.co/keyless-docs"}})}fetchSubscriptions(e){return(0,eI.ac)(this,A).get(`${iw}/topics/${e}/subscriptions`)}getSubscription(e,t,i,n){let r=new URLSearchParams;if(null==i?void 0:i.length)for(let e of i)r.append("workflowIds",e);if(null==n?void 0:n.length)for(let e of n)r.append("tags",e);let s=r.size?`?${r.toString()}`:"";return(0,eI.ac)(this,A).get(`${iw}/topics/${e}/subscriptions/${t}${s}`)}createSubscription({identifier:e,name:t,topicKey:i,topicName:n,preferences:r}){return(0,eI.ac)(this,A).post(`${iw}/topics/${i}/subscriptions`,(0,eI.ih)((0,eI.ih)({identifier:e,name:t},n&&{topic:{name:n}}),void 0!==r&&{preferences:r}))}updateSubscription({topicKey:e,identifier:t,name:i,preferences:n}){return(0,eI.ac)(this,A).patch(`${iw}/topics/${e}/subscriptions/${t}`,(0,eI.ih)({name:i},void 0!==n&&{preferences:n}))}updateSubscriptionPreference({subscriptionIdentifier:e,workflowId:t,enabled:i,condition:n,email:r,sms:s,in_app:o,chat:a,push:c}){return(0,eI.ac)(this,A).patch(`${iw}/subscriptions/${e}/preferences/${t}`,{enabled:i,condition:n,email:r,sms:s,in_app:o,chat:a,push:c})}bulkUpdateSubscriptionPreferences(e){return(0,eI.ac)(this,A).patch(`${iw}/preferences/bulk`,{preferences:e})}deleteSubscription({topicKey:e,identifier:t}){return(0,eI.ac)(this,A).delete(`${iw}/topics/${e}/subscriptions/${t}`)}generateChatOAuthUrl({integrationIdentifier:e,connectionIdentifier:t,subscriberId:i,context:n,scope:r,userScope:s,mode:o,connectionMode:a,autoLinkUser:c}){return(0,eI.ac)(this,A).post(ik,{integrationIdentifier:e,connectionIdentifier:t,subscriberId:i,context:n,scope:r,userScope:s,mode:o,connectionMode:a,autoLinkUser:c})}generateConnectOAuthUrl({integrationIdentifier:e,connectionIdentifier:t,subscriberId:i,context:n,scope:r,connectionMode:s,autoLinkUser:o}){return(0,eI.ac)(this,A).post(iS,{integrationIdentifier:e,connectionIdentifier:t,subscriberId:i,context:n,scope:r,connectionMode:s,autoLinkUser:o})}generateLinkUserOAuthUrl({integrationIdentifier:e,connectionIdentifier:t,subscriberId:i,context:n,userScope:r}){return(0,eI.ac)(this,A).post(iE,{integrationIdentifier:e,connectionIdentifier:t,subscriberId:i,context:n,userScope:r})}listChannelConnections(e={}){let t=iA(e);return(0,eI.ac)(this,A).get(`${iC}${t}`,void 0,!1)}getChannelConnection(e){return(0,eI.ac)(this,A).get(`${iC}/${e}`)}createChannelConnection({identifier:e,integrationIdentifier:t,subscriberId:i,context:n,workspace:r,auth:s}){return(0,eI.ac)(this,A).post(iC,{identifier:e,integrationIdentifier:t,subscriberId:i,context:n,workspace:r,auth:s})}deleteChannelConnection(e){return(0,eI.ac)(this,A).delete(`${iC}/${e}`)}listChannelEndpoints(e={}){let t=iA(e);return(0,eI.ac)(this,A).get(`${ix}${t}`,void 0,!1)}getChannelEndpoint(e){return(0,eI.ac)(this,A).get(`${ix}/${e}`)}createChannelEndpoint({identifier:e,integrationIdentifier:t,connectionIdentifier:i,subscriberId:n,context:r,type:s,endpoint:o}){return(0,eI.ac)(this,A).post(ix,{identifier:e,integrationIdentifier:t,connectionIdentifier:i,subscriberId:n,context:r,type:s,endpoint:o})}deleteChannelEndpoint(e){return(0,eI.ac)(this,A).delete(`${ix}/${e}`)}};A=new WeakMap;var iO=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){try{e.emit("channel-connection.oauth-url.pending",{args:i});let n=yield t.generateChatOAuthUrl(i);return e.emit("channel-connection.oauth-url.resolved",{args:i,data:n}),{data:n}}catch(t){return e.emit("channel-connection.oauth-url.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to generate chat OAuth URL",t)}}}),iT=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){try{e.emit("channel-connection.oauth-url.pending",{args:i});let n=yield t.generateConnectOAuthUrl(i);return e.emit("channel-connection.oauth-url.resolved",{args:i,data:n}),{data:n}}catch(t){return e.emit("channel-connection.oauth-url.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to generate connect OAuth URL",t)}}}),iI=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){try{e.emit("channel-connections.list.pending",{args:i});let n=(yield t.listChannelConnections(i)).data;return e.emit("channel-connections.list.resolved",{args:i,data:n}),{data:n}}catch(t){return e.emit("channel-connections.list.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to list channel connections",t)}}}),iR=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){try{e.emit("channel-connection.get.pending",{args:i});let n=yield t.getChannelConnection(i.identifier);return e.emit("channel-connection.get.resolved",{args:i,data:n}),{data:n}}catch(t){return e.emit("channel-connection.get.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to get channel connection",t)}}}),iN=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){try{return e.emit("channel-connection.delete.pending",{args:i}),yield t.deleteChannelConnection(i.identifier),e.emit("channel-connection.delete.resolved",{args:i}),{data:void 0}}catch(t){return e.emit("channel-connection.delete.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to delete channel connection",t)}}}),iL=class extends ih{constructor({inboxServiceInstance:e,eventEmitterInstance:t}){super({inboxServiceInstance:e,eventEmitterInstance:t})}generateOAuthUrl(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>iO({emitter:this._emitter,apiService:this._inboxService,args:e}))})}generateConnectOAuthUrl(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>iT({emitter:this._emitter,apiService:this._inboxService,args:e}))})}list(){return(0,eI.Cr)(this,arguments,function*(e={}){return this.callWithSession(()=>iI({emitter:this._emitter,apiService:this._inboxService,args:e}))})}get(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>iR({emitter:this._emitter,apiService:this._inboxService,args:e}))})}delete(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>iN({emitter:this._emitter,apiService:this._inboxService,args:e}))})}},ij=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){try{e.emit("channel-endpoint.oauth-url.pending",{args:i});let n=yield t.generateLinkUserOAuthUrl(i);return e.emit("channel-endpoint.oauth-url.resolved",{args:i,data:n}),{data:n}}catch(t){return e.emit("channel-endpoint.oauth-url.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to generate link user OAuth URL",t)}}}),iP=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){try{e.emit("channel-endpoints.list.pending",{args:i});let n=(yield t.listChannelEndpoints(i)).data;return e.emit("channel-endpoints.list.resolved",{args:i,data:n}),{data:n}}catch(t){return e.emit("channel-endpoints.list.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to list channel endpoints",t)}}}),iW=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){try{e.emit("channel-endpoint.get.pending",{args:i});let n=yield t.getChannelEndpoint(i.identifier);return e.emit("channel-endpoint.get.resolved",{args:i,data:n}),{data:n}}catch(t){return e.emit("channel-endpoint.get.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to get channel endpoint",t)}}}),iK=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){try{e.emit("channel-endpoint.create.pending",{args:i});let n=yield t.createChannelEndpoint(i);return e.emit("channel-endpoint.create.resolved",{args:i,data:n}),{data:n}}catch(t){return e.emit("channel-endpoint.create.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to create channel endpoint",t)}}}),iD=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,args:i}){try{return e.emit("channel-endpoint.delete.pending",{args:i}),yield t.deleteChannelEndpoint(i.identifier),e.emit("channel-endpoint.delete.resolved",{args:i}),{data:void 0}}catch(t){return e.emit("channel-endpoint.delete.resolved",{args:i,error:t}),{error:new eT.Ly("Failed to delete channel endpoint",t)}}}),iU=class extends ih{constructor({inboxServiceInstance:e,eventEmitterInstance:t}){super({inboxServiceInstance:e,eventEmitterInstance:t})}generateLinkUserOAuthUrl(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>ij({emitter:this._emitter,apiService:this._inboxService,args:e}))})}list(){return(0,eI.Cr)(this,arguments,function*(e={}){return this.callWithSession(()=>iP({emitter:this._emitter,apiService:this._inboxService,args:e}))})}get(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>iW({emitter:this._emitter,apiService:this._inboxService,args:e}))})}create(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>iK({emitter:this._emitter,apiService:this._inboxService,args:e}))})}delete(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>iD({emitter:this._emitter,apiService:this._inboxService,args:e}))})}},iq=class{constructor(){var e;(0,eI.Ko)(this,M),(0,eI.qx)(this,M,{all:e=e||new Map,on:function(t,i){var n=e.get(t);n?n.push(i):e.set(t,[i])},off:function(t,i){var n=e.get(t);n&&(i?n.splice(n.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var n=e.get(t);n&&n.slice().map(function(e){e(i)}),(n=e.get("*"))&&n.slice().map(function(e){e(t,i)})}})}on(e,t){return(0,eI.ac)(this,M).on(e,t),()=>{this.off(e,t)}}off(e,t){(0,eI.ac)(this,M).off(e,t)}emit(e,t){(0,eI.ac)(this,M).emit(e,t)}};M=new WeakMap;var iF=({tags:e,data:t,read:i,archived:n,snoozed:r,seen:s,severity:o,limit:a,offset:c,after:l,createdGte:u,createdLte:h})=>Object.entries({tags:e,data:t,read:i,archived:n,snoozed:r,seen:s,severity:o,limit:a,offset:c,after:l,createdGte:u,createdLte:h}).filter(([e,t])=>null!=t&&!(Array.isArray(t)&&0===t.length)).reduce((e,[t,i])=>(e[t]=i,e),{}),iB=({tags:e,data:t,read:i,archived:n,snoozed:r,seen:s,severity:o,limit:a,offset:c,after:l,createdGte:u,createdLte:h})=>JSON.stringify(iF({tags:e,data:t,read:i,archived:n,snoozed:r,seen:s,severity:o,limit:a,offset:c,after:l,createdGte:u,createdLte:h})),i$=({tags:e,data:t,read:i,archived:n,snoozed:r,seen:s,severity:o,createdGte:a,createdLte:c})=>JSON.stringify(iF({tags:e,data:t,read:i,archived:n,snoozed:r,seen:s,severity:o,createdGte:a,createdLte:c})),iz=e=>JSON.parse(e),iV=["notification.read.pending","notification.read.resolved","notification.unread.pending","notification.unread.resolved","notification.complete_action.pending","notification.complete_action.resolved","notification.revert_action.pending","notification.revert_action.resolved","notifications.read_all.pending","notifications.read_all.resolved"],iH=["notification.archive.pending","notification.unarchive.pending","notification.snooze.pending","notification.unsnooze.pending","notification.delete.pending","notifications.archive_all.pending","notifications.archive_all_read.pending","notifications.delete_all.pending"],iZ=class{constructor({emitter:e,inboxService:t}){(0,eI.Ko)(this,O),(0,eI.Ko)(this,T),(0,eI.Ko)(this,I),this.updateNotification=(e,t)=>{let i=(0,eI.ac)(this,I).get(e);if(!i)return!1;let n=i.notifications.findIndex(e=>e.id===t.id);if(-1===n)re
22turn!1;let r=[...i.notifications];return r[n]=t,(0,eI.ac)(this,I).set(e,(0,eI.EZ)((0,eI.ih)({},i),{notifications:r})),!0},this.removeNotification=(e,t)=>{let i=(0,eI.ac)(this,I).get(e);if(!i)return!1;let n=i.notifications.findIndex(e=>e.id===t.id);if(-1===n)return!1;let r=[...i.notifications];return r.splice(n,1),(0,eI.ac)(this,I).set(e,(0,eI.EZ)((0,eI.ih)({},i),{notifications:r})),!0},this.handleNotificationEvent=({remove:e}={remove:!1})=>t=>{let{data:i,args:n}=t,r=[];if(null!=i)Array.isArray(i)&&i.every(e=>"object"==typeof e&&"id"in e)?r=i:"object"==typeof i&&"id"in i&&(r=[i]);else if(e&&n){if("notification"in n&&n.notification)r=[n.notification];else if("notificationId"in n&&n.notificationId){let e=[];(0,eI.ac)(this,I).keys().forEach(t=>{let i=(0,eI.ac)(this,I).get(t);if(i){let t=i.notifications.find(e=>e.id===n.notificationId);t&&e.push(t)}}),r=e}}if(0===r.length)return;let s=new Set;(0,eI.ac)(this,I).keys().forEach(t=>{r.forEach(i=>{(e?this.removeNotification(t,i):this.updateNotification(t,i))&&s.add(i$(iz(t)))})}),s.forEach(e=>{let t=this.getAggregated(iz(e));(0,eI.ac)(this,O).emit("notifications.list.updated",{data:t})})},(0,eI.qx)(this,O,e),(0,eI.qx)(this,T,t),iV.forEach(e=>{(0,eI.ac)(this,O).on(e,this.handleNotificationEvent())}),iH.forEach(e=>{(0,eI.ac)(this,O).on(e,this.handleNotificationEvent({remove:!0}))}),(0,eI.qx)(this,I,new id)}getAggregated(e){return(0,eI.ac)(this,I).keys().filter(t=>t6(iz(t),e)).map(e=>(0,eI.ac)(this,I).get(e)).reduce((e,t)=>t?{hasMore:t.hasMore,filter:t.filter,notifications:[...e.notifications,...t.notifications]}:e,{hasMore:!1,filter:{},notifications:[]})}get(e){return(0,eI.ac)(this,I).get(iB(e))}has(e){return void 0!==(0,eI.ac)(this,I).get(iB(e))}set(e,t){(0,eI.ac)(this,I).set(iB(e),t)}unshift(e,t){let i=iB(e),n=(0,eI.ac)(this,I).get(i)||{hasMore:!1,filter:iz(i),notifications:[]},r=(0,eT.sc)({notification:(0,eI.ih)({},t),emitter:(0,eI.ac)(this,O),inboxService:(0,eI.ac)(this,T)});this.update(e,(0,eI.EZ)((0,eI.ih)({},n),{notifications:[r,...n.notifications]}))}update(e,t){this.set(e,t);let i=this.getAggregated(iz(iB(e)));(0,eI.ac)(this,O).emit("notifications.list.updated",{data:i})}getAll(e){if(this.has(e))return this.getAggregated({tags:e.tags,data:e.data,read:e.read,snoozed:e.snoozed,archived:e.archived,seen:e.seen,severity:e.severity,createdGte:e.createdGte,createdLte:e.createdLte})}getUniqueNotifications({tags:e,read:t,data:i}){let n=(0,eI.ac)(this,I).keys(),r=new Map;return n.forEach(n=>{let s=iz(n);if(t9(e,s.tags)&&t5(i,s.data)){let e=(0,eI.ac)(this,I).get(n);if(!e)return;e.notifications.filter(e=>void 0===t||t===e.isRead).forEach(e=>{r.set(e.id,e)})}}),Array.from(r.values())}clear(e){(0,eI.ac)(this,I).keys().forEach(t=>{t6(iz(t),e)&&(0,eI.ac)(this,I).remove(t)})}clearAll(){(0,eI.ac)(this,I).clear()}};O=new WeakMap,T=new WeakMap,I=new WeakMap;var iG=class extends ih{constructor({useCache:e,inboxServiceInstance:t,eventEmitterInstance:i}){super({eventEmitterInstance:i,inboxServiceInstance:t}),(0,eI.Ko)(this,R),this.cache=new iZ({emitter:i,inboxService:t}),(0,eI.qx)(this,R,e)}list(){return(0,eI.Cr)(this,arguments,function*(e={}){var{limit:t=10}=e,i=(0,eI.S0)(e,["limit"]);return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){let e=(0,eI.ih)({limit:t},i);try{let n="useCache"in e?e.useCache:(0,eI.ac)(this,R),r=n?this.cache.getAll(e):void 0;if(this._emitter.emit("notifications.list.pending",{args:e,data:r}),!r){let s=yield this._inboxService.fetchNotifications((0,eI.ih)({limit:t},i));r={hasMore:s.hasMore,filter:s.filter,notifications:s.data.map(e=>new eT.P_(e,this._emitter,this._inboxService))},n&&(this.cache.set(e,r),r=this.cache.getAll(e))}return this._emitter.emit("notifications.list.resolved",{args:e,data:r}),{data:r}}catch(t){return this._emitter.emit("notifications.list.resolved",{args:e,error:t}),{error:new eT.Ly("Failed to fetch notifications",t)}}}))})}count(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){let t=e&&"filters"in e?e.filters:[(0,eI.ih)({},e)];try{this._emitter.emit("notifications.count.pending",{args:e});let i=yield this._inboxService.count({filters:t}),n=e&&"filters"in e?{counts:i.data}:i.data[0];return this._emitter.emit("notifications.count.resolved",{args:e,data:n}),{data:n}}catch(t){return this._emitter.emit("notifications.count.resolved",{args:e,error:t}),{error:new eT.Ly("Failed to count notifications",t)}}}))})}read(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.ij)({emitter:this._emitter,apiService:this._inboxService,args:e})}))})}unread(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.NM)({emitter:this._emitter,apiService:this._inboxService,args:e})}))})}seen(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.SA)({emitter:this._emitter,apiService:this._inboxService,args:e})}))})}archive(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.nw)({emitter:this._emitter,apiService:this._inboxService,args:e})}))})}unarchive(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.HS)({emitter:this._emitter,apiService:this._inboxService,args:e})}))})}delete(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.no)({emitter:this._emitter,apiService:this._inboxService,args:e})}))})}snooze(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.HB)({emitter:this._emitter,apiService:this._inboxService,args:e})}))})}unsnooze(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.Fg)({emitter:this._emitter,apiService:this._inboxService,args:e})}))})}completePrimary(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.Av)({emitter:this._emitter,apiService:this._inboxService,args:e,actionType:"primary"})}))})}completeSecondary(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.Av)({emitter:this._emitter,apiService:this._inboxService,args:e,actionType:"secondary"})}))})}revertPrimary(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.Vf)({emitter:this._emitter,apiService:this._inboxService,args:e,actionType:"primary"})}))})}revertSecondary(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.Vf)({emitter:this._emitter,apiService:this._inboxService,args:e,actionType:"secondary"})}))})}readAll(){return(0,eI.Cr)(this,arguments,function*({tags:e,data:t}={}){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.dG)({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:e,data:t})}))})}
22seenAll(){return(0,eI.Cr)(this,arguments,function*(e={}){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return"notificationIds"in e?(0,eT.e2)({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,notificationIds:e.notificationIds}):(0,eT.e2)({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:"tags"in e?e.tags:void 0,data:"data"in e?e.data:void 0})}))})}archiveAll(){return(0,eI.Cr)(this,arguments,function*({tags:e,data:t}={}){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.rG)({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:e,data:t})}))})}archiveAllRead(){return(0,eI.Cr)(this,arguments,function*({tags:e,data:t}={}){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.iL)({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:e,data:t})}))})}deleteAll(){return(0,eI.Cr)(this,arguments,function*({tags:e,data:t}={}){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){return(0,eT.nV)({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:e,data:t})}))})}clearCache({filter:e}={}){if(e){this.cache.clear(null!=e?e:{});return}this.cache.clearAll()}triggerHelloWorldEvent(){return(0,eI.Cr)(this,null,function*(){return this._inboxService.triggerHelloWorldEvent()})}};R=new WeakMap;var iJ=class{constructor(e,{emitterInstance:t,inboxServiceInstance:i,cache:n,useCache:r}){(0,eI.Ko)(this,N),(0,eI.Ko)(this,L),(0,eI.Ko)(this,j),(0,eI.Ko)(this,P),(0,eI.qx)(this,N,t),(0,eI.qx)(this,L,i),(0,eI.qx)(this,j,n),(0,eI.qx)(this,P,r),this.isEnabled=e.isEnabled,this.weeklySchedule=e.weeklySchedule}update(e){return(0,eI.Cr)(this,null,function*(){var t;let i=!!e.weeklySchedule||!!this.weeklySchedule;return i1({emitter:(0,eI.ac)(this,N),apiService:(0,eI.ac)(this,L),cache:(0,eI.ac)(this,j),useCache:(0,eI.ac)(this,P),args:(0,eI.ih)({isEnabled:null!=(t=e.isEnabled)?t:this.isEnabled},i&&{weeklySchedule:(0,eI.ih)((0,eI.ih)({},this.weeklySchedule),e.weeklySchedule)})})})}};N=new WeakMap,L=new WeakMap,j=new WeakMap,P=new WeakMap;var iY=class{constructor(e,{emitterInstance:t,inboxServiceInstance:i,cache:n,scheduleCache:r,useCache:s}){(0,eI.Ko)(this,W),(0,eI.Ko)(this,K),(0,eI.Ko)(this,D),(0,eI.Ko)(this,U),(0,eI.Ko)(this,q),(0,eI.qx)(this,W,t),(0,eI.qx)(this,K,i),(0,eI.qx)(this,D,n),(0,eI.qx)(this,U,r),(0,eI.qx)(this,q,s),this.level=e.level,this.enabled=e.enabled,this.channels=e.channels,this.workflow=e.workflow,this.schedule=new iJ((0,eI.ih)({},e.schedule),{emitterInstance:t,inboxServiceInstance:i,cache:r,useCache:s})}update({channels:e,channelPreferences:t}){var i;return iX({emitter:(0,eI.ac)(this,W),apiService:(0,eI.ac)(this,K),cache:(0,eI.ac)(this,D),scheduleCache:(0,eI.ac)(this,U),useCache:(0,eI.ac)(this,q),args:{workflowId:null==(i=this.workflow)?void 0:i.id,channels:e||t,preference:this}})}};W=new WeakMap,K=new WeakMap,D=new WeakMap,U=new WeakMap,q=new WeakMap;var iX=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,cache:i,scheduleCache:n,useCache:r,args:s}){var o;let{channels:a}=s,c="workflowId"in s?s.workflowId:null==(o=s.preference.workflow)?void 0:o.id;try{let o;e.emit("preference.update.pending",{args:s,data:"preference"in s?new iY((0,eI.EZ)((0,eI.ih)({},s.preference),{channels:(0,eI.ih)((0,eI.ih)({},s.preference.channels),a)}),{emitterInstance:e,inboxServiceInstance:t,cache:i,scheduleCache:n,useCache:r}):void 0}),c?o=yield t.updateWorkflowPreferences({workflowId:c,channels:a}):(i0({emitter:e,apiService:t,cache:i,scheduleCache:n,useCache:r,args:s}),o=yield t.updateGlobalPreferences(a));let l=new iY(o,{emitterInstance:e,inboxServiceInstance:t,cache:i,scheduleCache:n,useCache:r});return e.emit("preference.update.resolved",{args:s,data:l}),{data:l}}catch(t){return e.emit("preference.update.resolved",{args:s,error:t}),{error:new eT.Ly("Failed to update preference",t)}}}),iQ=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,cache:i,scheduleCache:n,useCache:r,args:s}){if(s.find(e=>"preference"in e&&"global"===e.preference.level))return{error:new eT.Ly("Global preference is not supported in bulk update","")};try{let o=s.map(s=>"preference"in s?new iY((0,eI.EZ)((0,eI.ih)({},s.preference),{channels:(0,eI.ih)((0,eI.ih)({},s.preference.channels),s.channels)}),{emitterInstance:e,inboxServiceInstance:t,cache:i,scheduleCache:n,useCache:r}):void 0).filter(e=>void 0!==e);e.emit("preferences.bulk_update.pending",{args:s,data:o});let a=s.map(e=>{var t,i,n,r;return(0,eI.ih)({workflowId:"workflowId"in e?e.workflowId:null!=(r=null!=(n=null==(t=e.preference.workflow)?void 0:t.id)?n:null==(i=e.preference.workflow)?void 0:i.identifier)?r:""},e.channels)}),c=(yield t.bulkUpdatePreferences(a)).map(s=>new iY(s,{emitterInstance:e,inboxServiceInstance:t,cache:i,scheduleCache:n,useCache:r}));return e.emit("preferences.bulk_update.resolved",{args:s,data:c}),{data:c}}catch(t){return e.emit("preferences.bulk_update.resolved",{args:s,error:t}),{error:new eT.Ly("Failed to bulk update preferences",t)}}}),i0=({emitter:e,apiService:t,cache:i,scheduleCache:n,useCache:r,args:s})=>{let o=r?null==i?void 0:i.getAll({}):void 0;null==o||o.forEach(o=>{var a,c;if("template"===o.level){let l=(0,eI.EZ)((0,eI.ih)({},o),{channels:Object.entries(o.channels).reduce((e,[t,i])=>{var n;return e[t]=null!=(n=s.channels[t])?n:i,e},{})}),u="preference"in s?new iY(l,{emitterInstance:e,inboxServiceInstance:t,cache:i,scheduleCache:n,useCache:r}):void 0;u&&e.emit("preference.update.pending",{args:{workflowId:null!=(c=null==(a=o.workflow)?void 0:a.id)?c:"",channels:u.channels},data:u})}})},i1=e=>(0,eI.Cr)(null,[e],function*({emitter:e,apiService:t,cache:i,useCache:n,args:r}){var s,o;try{let{isEnabled:a,weeklySchedule:c}
22=r,l=new iJ({isEnabled:a,weeklySchedule:c},{emitterInstance:e,inboxServiceInstance:t,cache:i,useCache:n});e.emit("preference.schedule.update.pending",{args:r,data:l});let u=yield t.updateGlobalPreferences({schedule:{isEnabled:a,weeklySchedule:c}}),h=new iJ({isEnabled:null==(s=u.schedule)?void 0:s.isEnabled,weeklySchedule:null==(o=u.schedule)?void 0:o.weeklySchedule},{emitterInstance:e,inboxServiceInstance:t,cache:i,useCache:n});return e.emit("preference.schedule.update.resolved",{args:r,data:h}),{data:h}}catch(t){return e.emit("preference.schedule.update.resolved",{args:r,error:t}),{error:new eT.Ly("Failed to update preference",t)}}}),i2=class extends ih{constructor({cache:e,useCache:t,inboxServiceInstance:i,eventEmitterInstance:n}){super({eventEmitterInstance:n,inboxServiceInstance:i}),(0,eI.Ko)(this,F),this.cache=e,(0,eI.qx)(this,F,t)}get(){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){var e,t;try{let i=(0,eI.ac)(this,F)?this.cache.getAll():void 0;if(this._emitter.emit("preference.schedule.get.pending",{args:void 0,data:i}),!i){let n=yield this._inboxService.fetchGlobalPreferences();i=new iJ({isEnabled:null==(e=null==n?void 0:n.schedule)?void 0:e.isEnabled,weeklySchedule:null==(t=null==n?void 0:n.schedule)?void 0:t.weeklySchedule},{emitterInstance:this._emitter,inboxServiceInstance:this._inboxService,cache:this.cache,useCache:(0,eI.ac)(this,F)}),(0,eI.ac)(this,F)&&(this.cache.set(i),i=this.cache.getAll())}return this._emitter.emit("preference.schedule.get.resolved",{args:void 0,data:i}),{data:i}}catch(e){throw this._emitter.emit("preference.schedule.get.resolved",{args:void 0,error:e}),e}}))})}update(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>i1({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,useCache:(0,eI.ac)(this,F),args:e}))})}};F=new WeakMap;var i4=["preference.update.pending","preference.update.resolved","preferences.bulk_update.pending","preferences.bulk_update.resolved"],i9=["preference.schedule.update.pending","preference.schedule.update.resolved"],i3=({tags:e,severity:t})=>Object.entries({tags:e,severity:t}).reduce((e,[t,i])=>(null==i||Array.isArray(i)&&0===i.length||(e[t]=i),e),{}),i5=({tags:e,severity:t})=>JSON.stringify(i3({tags:e,severity:t})),i6=class{constructor({emitterInstance:e}){for(let t of((0,eI.Ko)(this,B),(0,eI.Ko)(this,$),this.updatePreference=(e,t)=>{let i=(0,eI.ac)(this,$).get(e);if(!i)return!1;let n=i.findIndex(e=>{var i,n;return(null==(i=e.workflow)?void 0:i.id)===(null==(n=t.workflow)?void 0:n.id)||e.level===t.level&&"global"===t.level});if(-1===n)return!1;let r=[...i];return r[n]=t,(0,eI.ac)(this,$).set(e,r),!0},this.updatePreferenceSchedule=(e,t)=>{let i=(0,eI.ac)(this,$).get(e);if(!i)return!1;let n=i.findIndex(e=>"global"===e.level);if(-1===n)return!1;let r=[...i];return r[n].schedule=t,(0,eI.ac)(this,$).set(e,r),!0},this.handleScheduleEvent=({data:e})=>{var t;if(!e)return;let i=(0,eI.ac)(this,$).keys(),n=new Set;for(let t of i){let i=this.updatePreferenceSchedule(t,e),r=(0,eI.ac)(this,$).get(t);i&&r&&n.add(t)}for(let e of n)(0,eI.ac)(this,B).emit("preferences.list.updated",{data:null!=(t=(0,eI.ac)(this,$).get(e))?t:[]})},this.handlePreferenceEvent=({data:e})=>{if(!e)return;let t=Array.isArray(e)?e:[e],i=new Set;(0,eI.ac)(this,$).keys().forEach(e=>{t.forEach(t=>{let n=this.updatePreference(e,t),r=(0,eI.ac)(this,$).get(e);n&&r&&i.add(e)})}
22),i.forEach(e=>{var t;(0,eI.ac)(this,B).emit("preferences.list.updated",{data:null!=(t=(0,eI.ac)(this,$).get(e))?t:[]})})},(0,eI.qx)(this,B,e),i4))(0,eI.ac)(this,B).on(t,this.handlePreferenceEvent);for(let e of i9)(0,eI.ac)(this,B).on(e,this.handleScheduleEvent);(0,eI.qx)(this,$,new id)}has(e){return void 0!==(0,eI.ac)(this,$).get(i5(e))}set(e,t){(0,eI.ac)(this,$).set(i5(e),t)}getAll(e){if(this.has(e))return(0,eI.ac)(this,$).get(i5(e))}clearAll(){(0,eI.ac)(this,$).clear()}};B=new WeakMap,$=new WeakMap;var i7=["preference.schedule.update.pending","preference.schedule.update.resolved"],i8=()=>"schedule",ne=class{constructor({emitterInstance:e}){for(let t of((0,eI.Ko)(this,z),(0,eI.Ko)(this,V),this.updateScheduleInCache=(e,t)=>!!(0,eI.ac)(this,V).get(e)&&((0,eI.ac)(this,V).set(e,t),!0),this.handleScheduleEvent=({data:e})=>{if(!e)return;let t=new Set;for(let i of(0,eI.ac)(this,V).keys()){let n=this.updateScheduleInCache(i,e),r=(0,eI.ac)(this,V).get(i);n&&r&&t.add(i)}for(let e of t)(0,eI.ac)(this,z).emit("preference.schedule.get.updated",{data:(0,eI.ac)(this,V).get(e)})},(0,eI.qx)(this,z,e),i7))(0,eI.ac)(this,z).on(t,this.handleScheduleEvent);(0,eI.qx)(this,V,new id)}has(){return void 0!==(0,eI.ac)(this,V).get(i8())}set(e){(0,eI.ac)(this,V).set(i8(),e)}getAll(){if(this.has())return(0,eI.ac)(this,V).get(i8())}clearAll(){(0,eI.ac)(this,V).clear()}};z=new WeakMap,V=new WeakMap;var nt=class extends ih{constructor({useCache:e,inboxServiceInstance:t,eventEmitterInstance:i}){super({eventEmitterInstance:i,inboxServiceInstance:t}),(0,eI.Ko)(this,H),this.cache=new i6({emitterInstance:this._emitter}),this.scheduleCache=new ne({emitterInstance:this._emitter}),(0,eI.qx)(this,H,e),this.schedule=new i2({cache:this.scheduleCache,useCache:e,inboxServiceInstance:t,eventEmitterInstance:i})}list(){return(0,eI.Cr)(this,arguments,function*(e={}){return this.callWithSession(()=>(0,eI.Cr)(this,null,function*(){var t;try{let i=(0,eI.ac)(this,H)?this.cache.getAll(e):void 0;return this._emitter.emit("preferences.list.pending",{args:e,data:i}),!i&&(i=(yield this._inboxService.fetchPreferences({tags:e.tags,severity:e.severity,criticality:null!=(t=e.criticality)?t:"nonCritical"})).map(e=>new iY(e,{emitterInstance:this._emitter,inboxServiceInstance:this._inboxService,cache:this.cache,scheduleCache:this.scheduleCache,useCache:(0,eI.ac)(this,H)})),(0,eI.ac)(this,H)&&(this.cache.set(e,i),i=this.cache.getAll(e))),this._emitter.emit("preferences.list.resolved",{args:e,data:i}),{data:i}}catch(t){throw this._emitter.emit("preferences.list.resolved",{args:e,error:t}),t}}))})}update(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>iX({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,scheduleCache:this.scheduleCache,useCache:(0,eI.ac)(this,H),args:e}))})}bulkUpdate(e){return(0,eI.Cr)(this,null,function*(){return this.callWithSession(()=>iQ({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,scheduleCache:this.scheduleCache,useCache:(0,eI.ac)(this,H),args:e}))})}};H=new WeakMap;var ni=class{constructor(e,t,i){(0,eI.Ko)(this,Z),(0,eI.Ko)(this,G),(0,eI.Ko)(this,J),(0,eI.qx)(this,Z,i),(0,eI.qx)(this,G,t),(0,eI.qx)(this,J,e)}get applicationIdentifier(){return(0,eI.ac)(this,J).applicationIdentifier}get subscriberId(){var e;return null==(e=(0,eI.ac)(this,J).subscriber)?void 0:e.subscriberId}get context(){return(0,eI.ac)(this,J).context}get subscriberHash(){return(0,eI.ac)(this,J).subscriberHash}get contextHash(){return(0,eI.ac)(this,J).contextHash}get subscriber(){return(0,eI.ac)(this,J).subscriber}handleApplicationIdentifier(e,t){if("undefined"==typeof window||!window.localStorage)return null;let i="novu_keyless_application_identifier";switch(e){case"get":return window.localStorage.getItem(i);case"store":return t&&window.localStorage.setItem(i,t),null;case"delete":return window.localStorage.removeItem(i),null;default:return null}}initialize(e){return(0,eI.Cr)(this,null,function*(){var t,i,n,r,s,o;let a=(null==(t=(0,eI.ac)(this,J).subscriber)?void 0:t.subscriberId)===(null==(i=null==e?void 0:e.subscriber)?void 0:i.subscriberId),c=JSON.stringify((0,eI.ac)(this,J).context)===JSON.stringify(null==e?void 0:e.context);if(!a||!c)try{let t;e&&(0,eI.qx)(this,J,e);let{subscriber:i,subscriberHash:a,contextHash:c,applicationIdentifier:l,defaultSchedule:u,context:h}=(0,eI.ac)(this,J);"undefined"!=typeof window&&(t=Intl.DateTimeFormat().resolvedOptions().timeZone);let d=l;if(d)this.handleApplicationIdentifier("delete");else{let e=this.handleApplicationIdentifier("get");e&&(d=e)}(0,eI.ac)(this,Z).emit("session.initialize.pending",{args:(0,eI.ac)(this,J)});let p=yield(0,eI.ac)(this,G).initializeSession({applicationIdentifier:d,subscriberHash:a,contextHash:c,subscriber:(0,eI.EZ)((0,eI.ih)({},i),{subscriberId:null!=(n=null==i?void 0:i.subscriberId)?n:"",timezone:null!=(r=null==i?void 0:i.timezone)?r:t}),defaultSchedule:u,context:h});(null==(s=null==p?void 0:p.applicationIdentifier)?void 0:s.startsWith("pk_keyless_"))&&this.handleApplicationIdentifier("store",p.applicationIdentifier),(null==(o=null==p?void 0:p.applicationIdentifier)?void 0:o.startsWith("pk_keyless_"))||this.handleApplicationIdentifier("delete"),(0,eI.ac)(this,Z).emit("session.initialize.resolved",{args:(0,eI.ac)(this,J),data:p})}catch(e){(0,eI.ac)(this,Z).emit("session.initialize.resolved",{args:(0,eI.ac)(this,J),error:e})}})}};Z=new WeakMap,G=new WeakMap,J=new WeakMap;var nn="wss://socket.novu.co",nr="ping",ns="notifications.notification_received",no="notifications.unseen_count_changed",na="notifications.unread_count_changed",nc=({_id:e,transactionId:t,content:i,read:n,seen:r,archived:s,snoozedUntil:o,deliveredAt:a,createdAt:c,lastReadDate:l,firstSeenDate:u,archivedAt:h,channel:d,subscriber:p,subject:f,avatar:v,cta:g,tags:y,data:m,workflow:b,severity:w})=>{var _,k,C,S,x,E,A,M;let O={id:null==p?void 0:p._id,subscriberId:null==p?void 0:p.subscriberId,firstName:null==p?void 0:p.firstName,lastName:null==p?void 0:p.lastName,avatar:null==p?void 0:p.avatar,locale:null==p?void 0:p.locale,data:null==p?void 0:p.data,timezone:null==p?void 0:p.timezone,email:null==p?void 0:p.email,phone:null==p?void 0:p.phone},T=null==(k=null==(_=g.action)?void 0:_.buttons)?void 0:k.find(e=>"primary"===e.type),I=null==(S=null==(C=g.action)?void 0:C.buttons)?void 0:S.find(e=>"secondary"===e.type),R=null==(E=null==(x=g.action)?void 0:x.result)?void 0:E.type,N=null==(A=g.action)?void 0:A.status;return(0,eI.EZ)((0,eI.ih)((0,eI.ih)({id:e,transactionId:t,subject:f,body:i,to:O,isRead:n,isSeen:r,isArchived:s,isSnoozed:!!o},a&&{deliveredAt:a}),o&&{snoozedUntil:o}),{createdAt:c,readAt:l,firstSeenAt:u,archivedAt:h,avatar:v,primaryAction:T&&{label:T.content,isCompleted:"primary"===R&&"done"===N,redirect:T.url?{target:T.target,url:T.url}:void 0},secondaryAction:I&&{label:I.content,isCompleted:"secondary"===R&&"done"===N,redirect:I.url?{target:I.target,url:I.url}:void 0},channelType:d,tags:y,redirect:(null==(M=g.data)?void 0:M.url)?{url:g.data.url,target:g.data.target}:void 0,data:m,workflow:b,severity:w})},nl=class extends ih{constructor({socketUrl:e,socketOptions:t,inboxServiceInstance:i,eventEmitterInstance:n}){super({eventEmitterInstance:n,inboxServiceInstance:i}),(0,eI.Ko)(this,ea),(0,eI.Ko)(this,Y),(0,eI.Ko)(this,X),(0,eI.Ko)(this,Q),(0,eI.Ko)(this,ee),(0,eI.Ko)(this,et),(0,eI.Ko)(this,ei),(0,eI.Ko)(this,en,e=>{try{let t=JSON.parse(e.data);"notification_received"===t.event&&(0,eI.ac)(this,X).emit(ns,{result:new eT.P_(nc(t.data.message),(0,eI.ac)(this,X),this._inboxService)})}catch(e){console.log("error",e)}}),(0,eI.Ko)(this,er,e=>{try{let t=JSON.parse(e.data);"unseen_count_changed"===t.event&&(0,eI.ac)(this,X).emit(no,{result:t.data.unseenCount})}catch(e){}}),(0,eI.Ko)(this,es,e=>{try{let t=JSON.parse(e.data);"unread_count_changed"===t.event&&(0,eI.ac)(this,X).emit(na,{result:t.data.counts})}catch(e){}}),(0,eI.Ko)(this,eo,e=>{if(e.data!==nr&&"pong"!==e.data)try{switch(JSON.parse(e.data).event){case"notification_received":(0,eI.ac)(this,en).call(this,e);break;case"unseen_count_changed":(0,eI.ac)(this,er).call(this,e);break;case"unread_count_changed":(0,eI.ac)(this,es).call(this,e)}}catch(e){}}),(0,eI.qx)(this,X,n),(0,eI.qx)(this,ee,null!=e?e:nn),(0,eI.qx)(this,et,t)}onSessionSuccess({token:e}){(0,eI.qx)(this,Y,e)}isSocketEvent(e){return e===ns||e===no||e===na}connect(){return(0,eI.Cr)(this,null,function*(){return(0,eI.ac)(this,Y)?(0,eI.U9)(this,ea,eh).call(this):this.callWithSession((0,eI.U9)(this,ea,eh).bind(this))})}disconnect(){return(0,eI.Cr)(this,null,function*(){return(0,eI.ac)(this,Q)?(0,eI.U9)(this,ea,ed).call(this):this.callWithSession((0,eI.U9)(this,ea,ed).bind(this))})}};Y=new WeakMap,X=new WeakMap,Q=new WeakMap,ee=new WeakMap,et=new WeakMap,ei=new WeakMap,en=new WeakMap,er=new WeakMap,es=new WeakMap,eo=new WeakMap,ea=new WeakSet,ec=function(){void 0!==(0,eI.ac)(this,ei)&&(clearInterval((0,eI.ac)(this,ei)),(0,eI.qx)(this,ei,void 0))},el=function(){(0,eI.U9)(this,ea,ec).call(this),(0,eI.qx)(this,ei,setInterval(()=>{let e=(0,eI.ac)(this,Q);if(e&&e.readyState===eF.OPEN)try{e.send(nr)}catch(e){}},25e3))},eu=function(){return(0,eI.Cr)(this,null,function*(){if((0,eI.ac)(this,Q))return;let e={socketUrl:(0,eI.ac)(this,ee)};(0,eI.ac)(this,X).emit("socket.connect.pending",{args:e});let t=new URL((0,eI.ac)(this,ee));t.searchParams.set("token",(0,eI.ac)(this,Y)),(0,eI.qx)(this,Q,new eF(t.toString(),void 0,(0,eI.ac)(this,et)));let i=(0,eI.ac)(this,Q);i.addEventListener("open",()=>{(0,eI.U9)(this,ea,el).call(this),(0,eI.ac)(this,X).emit("socket.connect.resolved",{args:e})}),i.addEventListener("error",t=>{(0,eI.ac)(this,X).emit("socket.connect.resolved",{args:e,error:t})}),i.addEventListener("close",()=>{i===(0,eI.ac)(this,Q)&&((0,eI.U9)(this,ea,ec).call(this),(0,eI.qx)(this,Q,void 0))}),i.addEventListener("message",(0,eI.ac)(this,eo))})},eh=function(){return(0,eI.Cr)(this,null,function*(){try{return yield(0,eI.U9)(this,ea,eu).call(this),{}}catch(e){return{error:new eT.Ly("Failed to initialize the PartySocket",e)}}})},ed=function(){return(0,eI.Cr)(this,null,function*(){var e;try{return(0,eI.U9)(this,ea,ec).call(this),null==(e=(0,eI.ac)(this,Q))||e.close(),(0,eI.qx)(this,Q,void 0),{}}catch(e){return{error:new eT.Ly("Failed to disconnect from the PartySocket",e)}}})};var nu="notifications.notification_received",nh="notifications.unseen_count_changed",nd="notifications.unread_count_changed",np=({_id:e,transactionId:t,content:i,read:n,seen:r,archived:s,snoozedUntil:o,deliveredAt:a,createdAt:c,lastReadDate:l,firstSeenDate:u,archivedAt:h,channel:d,subscriber:p,subject:f,avatar:v,cta:g,tags:y,data:m,workflow:b,severity:w})=>{var _,k,C,S,x,E,A,M;let O={id:null==p?void 0:p._id,subscriberId:null==p?void 0:p.subscriberId,firstName:null==p?void 0:p.firstName,lastName:null==p?void 0:p.lastName,avatar:null==p?void 0:p.avatar,locale:null==p?void 0:p.locale,data:null==p?void 0:p.data,timezone:null==p?void 0:p.timezone,email:null==p?void 0:p.email,phone:null==p?void 0:p.phone},T=null==(k=null==(_=g.action)?void 0:_.buttons)?void 0:k.find(e=>"primary"===e.type),I=null==(S=null==(C=g.action)?void 0:C.buttons)?void 0:S.find(e=>"secondary"===e.type),R=null==(E=null==(x=g.action)?void 0:x.result)?void 0:E.type,N=null==(A=g.action)?void 0:A.status;return(0,eI.EZ)((0,eI.ih)((0,eI.ih)({id:e,transactionId:t,subject:f,body:i,to:O,isRead:n,isSeen:r,isArchived:s,isSnoozed:!!o},a&&{deliveredAt:a}),o&&{snoozedUntil:o}),{createdAt:c,readAt:l,firstSeenAt:u,archivedAt:h,avatar:v,primaryAction:T&&{label:T.content,isCompleted:"primary"===R&&"done"===N,redirect:T.url?{target:T.target,url:T.url}:void 0},secondaryAction:I&&{label:I.content,isCompleted:"secondary"===R&&"done"===N,redirect:I.url?{target:I.target,url:I.url}:void 0},channelType:d,tags:y,redirect:(null==(M=g.data)?void 0:M.url)?{url:g.data.url,target:g.data.target}:void 0,data:m,workflow:b,severity:w})},nf=class extends ih{constructor({socketUrl:e,socketOptions:t,inboxServiceInstance:i,eventEmitterInstance:n}){super({eventEmitterInstance:n,inboxServiceInstance:i}),(0,eI.Ko)(this,e_),(0,eI.Ko)(this,ep),(0,eI.Ko)(this,ef),(0,eI.Ko)(this,ev),(0,eI.Ko)(this,eg),(0,eI.Ko)(this,ey),(0,eI.Ko)(this,em,({message:e})=>{(0,eI.ac)(this,ef).emit(nu,{result:new eT.P_(np(e),(0,eI.ac)(this,ef),this._inboxService)})}),(0,eI.Ko)(this,eb,({unseenCount:e})=>{(0,eI.ac)(this,ef).emit(nh,{result:e})}),(0,eI.Ko)(this,ew,({counts:e})=>{(0,eI.ac)(this,ef).emit(nd,{result:e})}),(0,eI.qx)(this,ef,n),(0,eI.qx)(this,eg,null!=e?e:"https://ws.novu.co"),(0,eI.qx)(this,ey,t)}onSessionSuccess({token:e}){(0,eI.qx)(this,ep,e)}isSocketEvent(e){return e===nu||e===nh||e===nd}connect(){return(0,eI.Cr)(this,null,function*(){return(0,eI.ac)(this,ep)?(0,eI.U9)(this,e_,eC).call(this):this.callWithSession((0,eI.U9)(this,e_,eC).bind(this))})}disconnect(){return(0,eI.Cr)(this,null,function*(){return(0,eI.ac)(this,ev)?(0,eI.U9)(this,e_,eS).call(this):this.callWithSession((0,eI.U9)(this,e_,eS).bind(this))})}};ep=new WeakMap,ef=new WeakMap,ev=new WeakMap,eg=new WeakMap,ey=new WeakMap,em=new WeakMap,eb=new WeakMap,ew=new WeakMap,e_=new WeakSet,ek=function(){return(0,eI.Cr)(this,null,function*(){var e,t,i,n;if((0,eI.ac)(this,ev))return;let r={socketUrl:(0,eI.ac)(this,eg)};(0,eI.ac)(this,ef).emit("socket.connect.pending",{args:r}),(0,eI.qx)(this,ev,tX((0,eI.ac)(this,eg),(0,eI.ih)({reconnectionDelayMax:1e4,transports:["websocket"],query:{token:`${(0,eI.ac)(this,ep)}`}},null!=(e=(0,eI.ac)(this,ey))?e:{}))),(0,eI.ac)(this,ev).on("connect",()=>{(0,eI.ac)(this,ef).emit("socket.connect.resolved",{args:r})}),(0,eI.ac)(this,ev).on("connect_error",e=>{(0,eI.ac)(this,ef).emit("socket.connect.resolved",{args:r,error:e})}),null==(t=(0,eI.ac)(this,ev))||t.on("notification_received",(0,eI.ac)(this,em)),null==(i=(0,eI.ac)(this,ev))||i.on("unseen_count_changed",(0,eI.ac)(this,eb)),null==(n=(0,eI.ac)(this,ev))||n.on("unread_count_changed",(0,eI.ac)(this,ew))})},eC=function(){return(0,eI.Cr)(this,null,function*(){try{return yield(0,eI.U9)(this,e_,ek).call(this),{}}catch(e){return{error:new eT.Ly("Failed to initialize the socket",e)}}})},eS=function(){return(0,eI.Cr)(this,null,function*(){var e;try{return null==(e=(0,eI.ac)(this,ev))||e.disconnect(),(0,eI.qx)(this,ev,void 0),{}}catch(e){return{error:new eT.Ly("Failed to disconnect from the socket",e)}}})};var nv=["wss://eu.socket.novu.co",nn,"wss://socket.novu-staging.co","wss://socket-worker-local.cli-shortener.w
22orkers.dev"],ng={"https://eu.ws.novu.co":"wss://eu.socket.novu.co","https://ws.novu.co":nn,"https://dev.ws.novu.co":"wss://socket.novu-staging.co"},ny={cloud:"partysocket","self-hosted":"socket.io"},nm=class{constructor(e){var t,i,n;(0,eI.Ko)(this,ex),(0,eI.Ko)(this,eE),(0,eI.Ko)(this,eA),(0,eI.Ko)(this,eM),(0,eI.qx)(this,eM,e),(0,eI.qx)(this,eA,new iM({apiUrl:e.apiUrl||e.backendUrl})),(0,eI.qx)(this,ex,new iq);let r=(0,eT.A1)({subscriberId:e.subscriberId,subscriber:e.subscriber}),s=(0,eT.xF)(e.context);(0,eI.qx)(this,eE,new ni({applicationIdentifier:e.applicationIdentifier||"",subscriberHash:e.subscriberHash,subscriber:r,defaultSchedule:e.defaultSchedule,context:e.context,contextHash:e.contextHash},(0,eI.ac)(this,eA),(0,eI.ac)(this,ex))),(0,eI.ac)(this,eE).initialize(),this.notifications=new iG({useCache:null==(t=e.useCache)||t,inboxServiceInstance:(0,eI.ac)(this,eA),eventEmitterInstance:(0,eI.ac)(this,ex)}),this.preferences=new nt({useCache:null==(i=e.useCache)||i,inboxServiceInstance:(0,eI.ac)(this,eA),eventEmitterInstance:(0,eI.ac)(this,ex)}),this.subscriptions=new im({subscriber:r,contextKey:s,useCache:null==(n=e.useCache)||n,inboxServiceInstance:(0,eI.ac)(this,eA),eventEmitterInstance:(0,eI.ac)(this,ex)}),this.channelConnections=new iL({inboxServiceInstance:(0,eI.ac)(this,eA),eventEmitterInstance:(0,eI.ac)(this,ex)}),this.channelEndpoints=new iU({inboxServiceInstance:(0,eI.ac)(this,eA),eventEmitterInstance:(0,eI.ac)(this,ex)}),this.socket=function({socketUrl:e,socketOptions:t,inboxServiceInstance:i,eventEmitterInstance:n}){var r,s;let o=e?ng[e]||e:nn,a=t||{},{socketType:c}=a,l=(0,eI.S0)(a,["socketType"]);return"partysocket"===(r=o,(s=c)?ny[s]:!r||nv.includes(r)?"partysocket":"socket.io")?new nl({socketUrl:o,socketOptions:l,inboxServiceInstance:i,eventEmitterInstance:n}):new nf({socketUrl:o,socketOptions:l,inboxServiceInstance:i,eventEmitterInstance:n})}({socketUrl:e.socketUrl,socketOptions:e.socketOptions,eventEmitterInstance:(0,eI.ac)(this,ex),inboxServiceInstance:(0,eI.ac)(this,eA)}),this.on=(e,t)=>{this.socket.isSocketEvent(e)&&this.socket.connect();let i=(0,eI.ac)(this,ex).on(e,t);return()=>{i()}},this.off=(e,t)=>{(0,eI.ac)(this,ex).off(e,t)}}get applicationIdentifier(){return(0,eI.ac)(this,eE).applicationIdentifier}get subscriberId(){return(0,eI.ac)(this,eE).subscriberId}get context(){return(0,eI.ac)(this,eE).context}get options(){return(0,eI.ac)(this,eM)}get contextKey(){return(0,eT.xF)((0,eI.ac)(this,eE).context)}clearCache(){this.notifications.cache.clearAll(),this.preferences.cache.clearAll(),this.preferences.scheduleCache.clearAll(),this.subscriptions.cache.clearAll()}changeSubscriber(e){return(0,eI.Cr)(this,null,function*(){yield(0,eI.ac)(this,eE).initialize({applicationIdentifier:(0,eI.ac)(this,eE).applicationIdentifier||"",subscriberHash:e.subscriberHash,subscriber:e.subscriber,context:(0,eI.ac)(this,eE).context,contextHash:(0,eI.ac)(this,eE).contextHash}),this.clearCache(),(yield this.socket.disconnect()).error||(yield this.socket.connect())})}changeContext(e){return(0,eI.Cr)(this,null,function*(){let t=(0,eI.ac)(this,eE).subscriber;if(!t)throw Error("Cannot change context without an active subscriber");yield(0,eI.ac)(this,eE).initialize({applicationIdentifier:(0,eI.ac)(this,eE).applicationIdentifier||"",subscriberHash:(0,eI.ac)(this,eE).subscriberHash,subscriber:t,context:e.context,contextHash:e.contextHash}),this.clearCache(),(yield this.socket.disconnect()).error||(yield this.socket.connect())})}};ex=new WeakMap,eE=new WeakMap,eA=new WeakMap,eM=new WeakMap},5790:function(e,t,i){"use strict";i.d(t,{wp:function(){return c},wi:function(){return u},rM:function(){return h}});var n=i(3941),r=i(7389);i(9287);var s=i(9585),o=i(7573),a=(0,s.createContext)({novu:void 0,realtime:!0}),c=e=>{let{subscriberId:t,realtime:i=!0,...n}=e,a=(0,s.useMemo)(()=>(0,r.A1)({subscriberId:t,subscriber:e.subscriber}),[t,e.subscriber]),c=n.applicationIdentifier?n.applicationIdentifier:"",u={...n,applicationIdentifier:c,subscriber:a,realtime:i};return(0,o.jsx)(l,{...u,applicationIdentifier:c,children:e.children})},l=e=>{let t=e.applicationIdentifier||"",i=(0,s.useMemo)(()=>(0,r.A1)({subscriberId:e.subscriberId,subscriber:e.subscriber}),[e.subscriberId,e.subscriber]),{children:c,subscriberHash:l,contextHash:u,backendUrl:h,apiUrl:d,socketUrl:p,socketOptions:f,useCache:v,defaultSchedule:g,context:y,realtime:m=!0}=e,b=(0,s.useMemo)(()=>
22({novu:new n.Ur({applicationIdentifier:t,subscriberHash:l,contextHash:u,backendUrl:h,apiUrl:d,socketUrl:p,socketOptions:f,useCache:v,subscriber:i,defaultSchedule:g,context:y}),realtime:m}),[t,l,i,y,u,h,d,p,f,v,m]);return(0,o.jsx)(a.Provider,{value:b,children:c})},u=()=>{let e=(0,s.useContext)(a);if(!e.novu)throw Error("useNovu must be used within a <NovuProvider />");return e.novu},h=()=>(0,s.useContext)(a).realtime},9099:function(e,t,i){"use strict";i.d(t,{H:function(){return r}});var n=i(9585),r=e=>{let t=(0,n.useRef)(e);return t.current=e,t}},1008:function(e,t,i){"use strict";i.d(t,{u:function(){return o}});var n=i(9585),r=i(5790),s=({channelName:e,onMessage:t,enabled:i=!0})=>{let[r]=(0,n.useState)("undefined"!=typeof BroadcastChannel?new BroadcastChannel(e):void 0);return(0,n.useEffect)(()=>{if(!i)return;let e=e=>{t(e.data)};return r?.addEventListener("message",e),()=>{r?.removeEventListener("message",e)}},[i]),{postMessage:e=>{i&&r?.postMessage(e)}}},o=({event:e,eventHandler:t,enabled:i=!0})=>{let o=(0,r.wi)(),a=`nv_ws_connection:a=${o.applicationIdentifier}:s=${o.subscriberId}:c=${o.contextKey}:e=${e}`,{postMessage:c}=s({channelName:a,onMessage:t,enabled:i}),l=e=>{t(e),c(e)};(0,n.useEffect)(()=>{let t;if(!i)return;let n=function(e,t){let i;if(!("locks"in navigator))return t(e),()=>{};let n=!1,r=new Promise(e=>{i=e});return navigator.locks.request(e,()=>(n||t(e),r)),()=>{n=!0,i()}}(a,()=>{t=o.on(e,l)});return()=>{t&&t(),n()}},[i])}},4699:function(e,t,i){"use strict";i.d(t,{u:function(){return c}});var n=i(3941),r=i(9585),s=i(9099),o=i(1008),a=i(5790),c=e=>{let{filters:t,realtime:i,onSuccess:c,onError:l}=e,{notifications:u}=(0,a.wi)(),h=(0,a.rM)(),d=i??h,p=(0,s.H)(t),[f,v]=(0,r.useState)(),[g,y]=(0,r.useState)(),[m,b]=(0,r.useState)(!0),[w,_]=(0,r.useState)(!1),k=async(e,t)=>{let i=t||p.current,r=i.map(e=>({count:0,filter:e})),s=[];if(e)for(let t=0;t<r.length;t++){let r=i[t],o=!r.severity||Array.isArray(r.severity)&&0===r.severity.length||Array.isArray(r.severity)&&r.severity.includes(e.severity)||!Array.isArray(r.severity)&&r.severity===e.severity;(0,n.jz)(r.tags,e.tags)&&o&&s.push(r)}else s=i;if(0===s.length)return;_(!0);let o=await u.count({filters:s});if(_(!1),b(!1),o.error){v(o.error),l?.(o.error);return}let a=o.data;c?.(a.counts),y(e=>{let t=[],i=a.counts;for(let s=0;s<r.length;s++){let o=r[s].filter,a=i.find(e=>(0,n.zg)(e.filter,o))||e?.[s];a&&t.push(a)}return t})};return(0,o.u)({event:"notifications.notification_received",enabled:d,eventHandler:e=>{k(e.result)}}),(0,o.u)({event:"notifications.unread_count_changed",enabled:d,eventHandler:()=>{k()}}),(0,r.useEffect)(()=>{v(void 0),b(!0),_(!1),k(void 0,t)},[JSON.stringify(t)]),{counts:g,error:f,refetch:async()=>{await k()},isLoading:m,isFetching:w}}},1826:function(e,t,i){"use strict";i.d(t,{z:function(){return c}});var n=i(3941),r=i(9585),s=i(9099),o=i(1008),a=i(5790),c=e=>{let{tags:t,data:i,read:c,archived:l=!1,snoozed:u=!1,seen:h,severity:d,createdGte:p,createdLte:f,limit:v=10,realtime:g,onSuccess:y,onError:m}=e||{},b=(0,s.H)(v),w=(0,s.H)({tags:t,data:i,read:c,archived:l,snoozed:u,seen:h,severity:d,createdGte:p,createdLte:f}),_=(0,a.wi)(),k=(0,a.rM)(),[C,S]=(0,r.useState)(),[x,E]=(0,r.useState)(),[A,M]=(0,r.useState)(!0),[O,T]=(0,r.useState)(!1),[I,R]=(0,r.useState)(!1),N=C?.length,L=N?C[N-1].id:void 0,j=(0,s.H)(L);(0,r.useEffect)(()=>{let e=_.on("notifications.list.updated",({data:e})=>{e&&(0,n.zg)(w.current,e.filter)&&(S(e.notifications),R(e.hasMore))});return()=>{e()}},[w,_]),(0,o.u)({event:"notifications.notification_received",enabled:g??k,eventHandler:({result:e})=>{let t=w.current;if((0,n.J)(e,t)){let i={...t,limit:b.current};_.notifications.cache.unshift(i,e)}}});let P=(0,r.useCallback)(async e=>{e?.refetch&&(E(void 0),M(!0),T(!1)),T(!0);let t=await _.notifications.list({...w.current,limit:v,after:e?.refetch?void 0:j.current});if(t.error)E(t.error),m?.(t.error),M(!1),T(!1);else if(t.data){let e=t.data;y?.(e.notifications),S(e.notifications),R(e.hasMore),M(!1),T(!1)}},[_,w,j,v,m,y]);(0,r.useEffect)(()=>{_.notifications.clearCache({filter:w.current}),P({refetch:!0})},[w,_,JSON.stringify(w.current),P]);let W=(0,r.useCallback)(()=>(_.notifications.clearCache({filter:w.current}),P({refetch:!0})),[w,_,P]),K=(0,r.useCallback)(async()=>
22{if(I&&!O)return P()},[I,O,P]),D=(0,r.useCallback)(async()=>await _.notifications.readAll({tags:w.current.tags,data:w.current.data}),[w,_]);return{readAll:D,seenAll:(0,r.useCallback)(async()=>await _.notifications.seenAll({tags:w.current.tags,data:w.current.data}),[w,_]),archiveAll:(0,r.useCallback)(async()=>await _.notifications.archiveAll({tags:w.current.tags,data:w.current.data}),[w,_]),archiveAllRead:(0,r.useCallback)(async()=>await _.notifications.archiveAllRead({tags:w.current.tags,data:w.current.data}),[w,_]),notifications:C,error:x,isLoading:A,isFetching:O,refetch:W,fetchMore:K,hasMore:I}}},5304:function(e,t,i){"use strict";i.d(t,{Ee:function(){return y},NY:function(){return b},fC:function(){return v}});var n=i(9585),r=i(8257),s=i(7921),o=i(9832),a=i(5102),c=i(7573),l="Avatar",[u,h]=(0,r.b)(l),d=[0,()=>void 0],[p,f]=u(l),v=n.forwardRef((e,t)=>{let{__scopeAvatar:i,...r}=e,[s,o]=n.useState("idle"),[l,u]=function(){let e=d;{let[t]=e=n.useState(0),i=n.useRef(!1);n.useEffect(()=>{t>1&&!i.current&&(i.current=!0,console.warn("Avatar: Only one `Avatar.Image` component should be rendered per `Avatar.Root`, but multiple were detected. This will lead to unexpected behavior."))},[t])}return e}();return(0,c.jsx)(p,{scope:i,imageLoadingStatus:s,setImageLoadingStatus:o,imageCount:l,setImageCount:u,children:(0,c.jsx)(a.WV.span,{...r,ref:t})})});v.displayName=l;var g="AvatarImage",y=n.forwardRef((e,t)=>{var i;let{__scopeAvatar:r,src:l,onLoadingStatusChange:u,...h}=e,d=f(g,r);i=d.setImageCount,n.useEffect(()=>(i(e=>e+1),()=>{i(e=>e-1)}),[i]);let p=function(e,t){let{loadingStatus:i,setLoadingStatus:n,referrerPolicy:r,crossOrigin:s}=t;return(0,o.b)(()=>{if(!e){n("error");return}let t=new window.Image,i=e=>{n(w(e.currentTarget))},o=()=>n("error");return t.addEventListener("load",i),t.addEventListener("error",o),r&&(t.referrerPolicy=r),t.crossOrigin=null!=s?s:null,t.src=e,n(w(t)),()=>{t.removeEventListener("load",i),t.removeEventListener("error",o),n("idle")}},[e,s,r,n]),i}(l,{referrerPolicy:h.referrerPolicy,crossOrigin:h.crossOrigin,loadingStatus:d.imageLoadingStatus,setLoadingStatus:d.setImageLoadingStatus}),v=(0,s.W)(e=>{null==u||u(e)}),y=n.useRef(p);return(0,o.b)(()=>{let e=y.current;y.current=p,p!==e&&v(p)},[p,v]),"loaded"===p?(0,c.jsx)(a.WV.img,{...h,ref:t,src:l}):null});y.displayName=g;var m="AvatarFallback",b=n.forwardRef((e,t)=>{let{__scopeAvatar:i,delayMs:r,...s}=e,o=f(m,i),[l,u]=n.useState(void 0===r);return n.useEffect(()=>{if(void 0!==r){let e=window.setTimeout(()=>u(!0),r);return()=>window.clearTimeout(e)}},[r]),l&&"loaded"!==o.imageLoadingStatus?(0,c.jsx)(a.WV.span,{...s,ref:t}):null});function w(e){return e.complete?e.naturalWidth>0?"loaded":"error":"loading"}b.displayName=m},763:function(e,t,i){"use strict";i.d(t,{oC:function(){return e6},VY:function(){return e4},ZA:function(){return e9},ck:function(){return e5},wU:function(){return te},__:function(){return e3},Uv:function(){return e2},Ee:function(){return e7},Rk:function(){return e8},fC:function(){return e0},Z0:function(){return tt},Tr:function(){return ti},tu:function(){return tr},fF:function(){return tn},xz:function(){return e1}});var n=i(9585),r=i(1308),s=i(7767),o=i(8257),a=i(6495),c=i(5102),l=i(4150),u=i(9610),h=i(6558),d=i(7094),p=i(18),f=i(1218),v=i(4823),g=i(4920),y=i(2405),m=i(5371),b=i(5511),w=i(7921),_=i(3790),k=i(3718),C=i(7573),S=["Enter"," "],x=["ArrowUp","PageDown","End"],E=["ArrowDown","PageUp","Home",...x],A={ltr:[...S,"ArrowRight"],rtl:[...S,"ArrowLeft"]},M={ltr:["ArrowLeft"],rtl:["ArrowRight"]},O="Menu",[T,I,R]=(0,l.B)(O),[N,L]=(0,o.b)(O,[R,v.D7,m.Pc]),j=(0,v.D7)(),P=(0,m.Pc)(),[W,K]=N(O),[D,U]=N(O),q=e=>{let{__scopeMenu:t,open:i=!1,children:r,dir:s,onOpenChange:o,modal:a=!0}=e,c=j(t),[l,h]=n.useState(null),d=n.useRef(!1),p=(0,w.W)(o),f=(0,u.gm)(s);return n.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),n.useEffect(()=>{if(!i)return;let e=()=>p(!1);return window.addEventListener("blur",e),()=>window.removeEventListener("blur",e)},[i,p]),(0,C.jsx)(v.fC,{...c,children:(0,C.jsx)(W,{scope:t,open:i,onOpenChange:p,content:l,onContentChange:h,children:(0,C.jsx)(D,{scope:t,onClose:n.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:d,dir:f,modal:a,children:r})})})};q.displayName=O;var F=n.forwardRef((e,t)=>
22{let{__scopeMenu:i,...n}=e,r=j(i);return(0,C.jsx)(v.ee,{...r,...n,ref:t})});F.displayName="MenuAnchor";var B="MenuPortal",[$,z]=N(B,{forceMount:void 0}),V=e=>{let{__scopeMenu:t,forceMount:i,children:n,container:r}=e,s=K(B,t);return(0,C.jsx)($,{scope:t,forceMount:i,children:(0,C.jsx)(y.z,{present:i||s.open,children:(0,C.jsx)(g.h,{asChild:!0,container:r,children:n})})})};V.displayName=B;var H="MenuContent",[Z,G]=N(H),J=n.forwardRef((e,t)=>{let i=z(H,e.__scopeMenu),{forceMount:n=i.forceMount,...r}=e,s=K(H,e.__scopeMenu),o=U(H,e.__scopeMenu);return(0,C.jsx)(T.Provider,{scope:e.__scopeMenu,children:(0,C.jsx)(y.z,{present:n||s.open,children:(0,C.jsx)(T.Slot,{scope:e.__scopeMenu,children:o.modal?(0,C.jsx)(Y,{...r,ref:t}):(0,C.jsx)(X,{...r,ref:t})})})})}),Y=n.forwardRef((e,t)=>{let i=K(H,e.__scopeMenu),o=n.useRef(null),a=(0,s.e)(t,o);return n.useEffect(()=>{let e=o.current;if(e)return(0,_.Ry)(e)},[]),(0,C.jsx)(ee,{...e,ref:a,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:(0,r.Mj)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})}),X=n.forwardRef((e,t)=>{let i=K(H,e.__scopeMenu);return(0,C.jsx)(ee,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})}),Q=(0,b.Z8)("MenuContent.ScrollLock"),ee=n.forwardRef((e,t)=>{let{__scopeMenu:i,loop:o=!1,trapFocus:a,onOpenAutoFocus:c,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEntryFocus:f,onEscapeKeyDown:g,onPointerDownOutside:y,onFocusOutside:b,onInteractOutside:w,onDismiss:_,disableOutsideScroll:S,...A}=e,M=K(H,i),O=U(H,i),T=j(i),R=P(i),N=I(i),[L,W]=n.useState(null),D=n.useRef(null),q=(0,s.e)(t,D,M.onContentChange),F=n.useRef(0),B=n.useRef(""),$=n.useRef(0),z=n.useRef(null),V=n.useRef("right"),G=n.useRef(0),J=S?k.Z:n.Fragment,Y=e=>{var t,i;let n=B.current+e,r=N().filter(e=>!e.disabled),s=document.activeElement,o=null===(t=r.find(e=>e.ref.current===s))||void 0===t?void 0:t.textValue,a=function(e,t,i){var n;let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,s=(n=Math.max(i?e.indexOf(i):-1,0),e.map((t,i)=>e[(n+i)%e.length]));1===r.length&&(s=s.filter(e=>e!==i));let o=s.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o!==i?o:void 0}(r.map(e=>e.textValue),n,o),c=null===(i=r.find(e=>e.textValue===a))||void 0===i?void 0:i.ref.current;!function e(t){B.current=t,window.clearTimeout(F.current),""!==t&&(F.current=window.setTimeout(()=>e(""),1e3))}(n),c&&setTimeout(()=>c.focus())};n.useEffect(()=>()=>window.clearTimeout(F.current),[]),(0,d.EW)();let X=n.useCallback(e=>{var t,i,n;return V.current===(null===(t=z.current)||void 0===t?void 0:t.side)&&!!(n=null===(i=z.current)||void 0===i?void 0:i.area)&&function(e,t){let{x:i,y:n}=e,r=!1;for(let e=0,s=t.length-1;e<t.length;s=e++){let o=t[e],a=t[s],c=o.x,l=o.y,u=a.x,h=a.y;l>n!=h>n&&i<(u-c)*(n-l)/(h-l)+c&&(r=!r)}return r}({x:e.clientX,y:e.clientY},n)},[]);return(0,C.jsx)(Z,{scope:i,searchRef:B,onItemEnter:n.useCallback(e=>{X(e)&&e.preventDefault()},[X]),onItemLeave:n.useCallback(e=>{var t;X(e)||(null===(t=D.current)||void 0===t||t.focus(),W(null))},[X]),onTriggerLeave:n.useCallback(e=>{X(e)&&e.preventDefault()},[X]),pointerGraceTimerRef:$,onPointerGraceIntentChange:n.useCallback(e=>{z.current=e},[]),children:(0,C.jsx)(J,{...S?{as:Q,allowPinchZoom:!0}:void 0,children:(0,C.jsx)(p.M,{asChild:!0,trapped:a,onMountAutoFocus:(0,r.Mj)(c,e=>{var t;e.preventDefault(),null===(t=D.current)||void 0===t||t.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:(0,C.jsx)(h.XB,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:g,onPointerDownOutside:y,onFocusOutside:b,onInteractOutside:w,onDismiss:_,children:(0,C.jsx)(m.fC,{asChild:!0,...R,dir:O.dir,orientation:"vertical",loop:o,currentTabStopId:L,onCurrentTabStopIdChange:W,onEntryFocus:(0,r.Mj)(f,e=>{O.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,C.jsx)(v.VY,{role:"menu","aria-orientation":"vertical","data-state":eM(M.open),"data-radix-menu-content":"",dir:O.dir,...T,...A,ref:q,style:{outline:"none",...A.style},onKeyDown:(0,r.Mj)(A.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,i=e.ctrlKey||e.altKey||e.metaKey,n=1===e.ke
22y.length;t&&("Tab"===e.key&&e.preventDefault(),!i&&n&&Y(e.key));let r=D.current;if(e.target!==r||!E.includes(e.key))return;e.preventDefault();let s=N().filter(e=>!e.disabled).map(e=>e.ref.current);x.includes(e.key)&&s.reverse(),function(e){let t=document.activeElement;for(let i of e)if(i===t||(i.focus(),document.activeElement!==t))return}(s)}),onBlur:(0,r.Mj)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(F.current),B.current="")}),onPointerMove:(0,r.Mj)(e.onPointerMove,eI(e=>{let t=e.target,i=G.current!==e.clientX;if(e.currentTarget.contains(t)&&i){let t=e.clientX>G.current?"right":"left";V.current=t,G.current=e.clientX}}))})})})})})})});J.displayName=H;var et=n.forwardRef((e,t)=>{let{__scopeMenu:i,...n}=e;return(0,C.jsx)(c.WV.div,{role:"group",...n,ref:t})});et.displayName="MenuGroup";var ei=n.forwardRef((e,t)=>{let{__scopeMenu:i,...n}=e;return(0,C.jsx)(c.WV.div,{...n,ref:t})});ei.displayName="MenuLabel";var en="MenuItem",er="menu.itemSelect",es=n.forwardRef((e,t)=>{let{disabled:i=!1,onSelect:o,...a}=e,l=n.useRef(null),u=U(en,e.__scopeMenu),h=G(en,e.__scopeMenu),d=(0,s.e)(t,l),p=n.useRef(!1);return(0,C.jsx)(eo,{...a,ref:d,disabled:i,onClick:(0,r.Mj)(e.onClick,()=>{let e=l.current;if(!i&&e){let t=new CustomEvent(er,{bubbles:!0,cancelable:!0});e.addEventListener(er,e=>null==o?void 0:o(e),{once:!0}),(0,c.jH)(e,t),t.defaultPrevented?p.current=!1:u.onClose()}}),onPointerDown:t=>{var i;null===(i=e.onPointerDown)||void 0===i||i.call(e,t),p.current=!0},onPointerUp:(0,r.Mj)(e.onPointerUp,e=>{var t;p.current||null===(t=e.currentTarget)||void 0===t||t.click()}),onKeyDown:(0,r.Mj)(e.onKeyDown,e=>{let t=""!==h.searchRef.current;!i&&(!t||" "!==e.key)&&S.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});es.displayName=en;var eo=n.forwardRef((e,t)=>{let{__scopeMenu:i,disabled:o=!1,textValue:a,...l}=e,u=G(en,i),h=P(i),d=n.useRef(null),p=(0,s.e)(t,d),[f,v]=n.useState(!1),[g,y]=n.useState("");return n.useEffect(()=>{let e=d.current;if(e){var t;y((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}},[l.children]),(0,C.jsx)(T.ItemSlot,{scope:i,disabled:o,textValue:null!=a?a:g,children:(0,C.jsx)(m.ck,{asChild:!0,...h,focusable:!o,children:(0,C.jsx)(c.WV.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...l,ref:p,onPointerMove:(0,r.Mj)(e.onPointerMove,eI(e=>{o?u.onItemLeave(e):(u.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,r.Mj)(e.onPointerLeave,eI(e=>u.onItemLeave(e))),onFocus:(0,r.Mj)(e.onFocus,()=>v(!0)),onBlur:(0,r.Mj)(e.onBlur,()=>v(!1))})})})}),ea=n.forwardRef((e,t)=>{let{checked:i=!1,onCheckedChange:n,...s}=e;return(0,C.jsx)(ev,{scope:e.__scopeMenu,checked:i,children:(0,C.jsx)(es,{role:"menuitemcheckbox","aria-checked":eO(i)?"mixed":i,...s,ref:t,"data-state":eT(i),onSelect:(0,r.Mj)(s.onSelect,()=>null==n?void 0:n(!!eO(i)||!i),{checkForDefaultPrevented:!1})})})});ea.displayName="MenuCheckboxItem";var ec="MenuRadioGroup",[el,eu]=N(ec,{value:void 0,onValueChange:()=>{}}),eh=n.forwardRef((e,t)=>{let{value:i,onValueChange:n,...r}=e,s=(0,w.W)(n);return(0,C.jsx)(el,{scope:e.__scopeMenu,value:i,onValueChange:s,children:(0,C.jsx)(et,{...r,ref:t})})});eh.displayName=ec;var ed="MenuRadioItem",ep=n.forwardRef((e,t)=>{let{value:i,...n}=e,s=eu(ed,e.__scopeMenu),o=i===s.value;return(0,C.jsx)(ev,{scope:e.__scopeMenu,checked:o,children:(0,C.jsx)(es,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":eT(o),onSelect:(0,r.Mj)(n.onSelect,()=>{var e;return null===(e=s.onValueChange)||void 0===e?void 0:e.call(s,i)},{checkForDefaultPrevented:!1})})})});ep.displayName=ed;var ef="MenuItemIndicator",[ev,eg]=N(ef,{checked:!1}),ey=n.forwardRef((e,t)=>{let{__scopeMenu:i,forceMount:n,...r}=e,s=eg(ef,i);return(0,C.jsx)(y.z,{present:n||eO(s.checked)||!0===s.checked,children:(0,C.jsx)(c.WV.span,{...r,ref:t,"data-state":eT(s.checked)})})});ey.displayName=ef;var em=n.forwardRef((e,t)=>{let{__scopeMenu:i,...n}=e;return(0,C.jsx)(c.WV.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});em.displayName="MenuSeparator";var eb=n.forwardRef((e,t)=>
22{let{__scopeMenu:i,...n}=e,r=j(i);return(0,C.jsx)(v.Eh,{...r,...n,ref:t})});eb.displayName="MenuArrow";var ew="MenuSub",[e_,ek]=N(ew),eC=e=>{let{__scopeMenu:t,children:i,open:r=!1,onOpenChange:s}=e,o=K(ew,t),a=j(t),[c,l]=n.useState(null),[u,h]=n.useState(null),d=(0,w.W)(s);return n.useEffect(()=>(!1===o.open&&d(!1),()=>d(!1)),[o.open,d]),(0,C.jsx)(v.fC,{...a,children:(0,C.jsx)(W,{scope:t,open:r,onOpenChange:d,content:u,onContentChange:h,children:(0,C.jsx)(e_,{scope:t,contentId:(0,f.M)(),triggerId:(0,f.M)(),trigger:c,onTriggerChange:l,children:i})})})};eC.displayName=ew;var eS="MenuSubTrigger",ex=n.forwardRef((e,t)=>{let i=K(eS,e.__scopeMenu),o=U(eS,e.__scopeMenu),a=ek(eS,e.__scopeMenu),c=G(eS,e.__scopeMenu),l=n.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:h}=c,d={__scopeMenu:e.__scopeMenu},p=n.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return n.useEffect(()=>p,[p]),n.useEffect(()=>{let e=u.current;return()=>{window.clearTimeout(e),h(null)}},[u,h]),(0,C.jsx)(F,{asChild:!0,...d,children:(0,C.jsx)(eo,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?a.contentId:void 0,"data-state":eM(i.open),...e,ref:(0,s.F)(t,a.onTriggerChange),onClick:t=>{var n;null===(n=e.onClick)||void 0===n||n.call(e,t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),i.open||i.onOpenChange(!0))},onPointerMove:(0,r.Mj)(e.onPointerMove,eI(t=>{c.onItemEnter(t),t.defaultPrevented||e.disabled||i.open||l.current||(c.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{i.onOpenChange(!0),p()},100))})),onPointerLeave:(0,r.Mj)(e.onPointerLeave,eI(e=>{var t,n;p();let r=null===(t=i.content)||void 0===t?void 0:t.getBoundingClientRect();if(r){let t=null===(n=i.content)||void 0===n?void 0:n.dataset.side,s="right"===t,o=r[s?"left":"right"],a=r[s?"right":"left"];c.onPointerGraceIntentChange({area:[{x:e.clientX+(s?-5:5),y:e.clientY},{x:o,y:r.top},{x:a,y:r.top},{x:a,y:r.bottom},{x:o,y:r.bottom}],side:t}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(e),e.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:(0,r.Mj)(e.onKeyDown,t=>{let n=""!==c.searchRef.current;if(!e.disabled&&(!n||" "!==t.key)&&A[o.dir].includes(t.key)){var r;i.onOpenChange(!0),null===(r=i.content)||void 0===r||r.focus(),t.preventDefault()}})})})});ex.displayName=eS;var eE="MenuSubContent",eA=n.forwardRef((e,t)=>{let i=z(H,e.__scopeMenu),{forceMount:o=i.forceMount,align:a="start",...c}=e,l=K(H,e.__scopeMenu),u=U(H,e.__scopeMenu),h=ek(eE,e.__scopeMenu),d=n.useRef(null),p=(0,s.e)(t,d);return(0,C.jsx)(T.Provider,{scope:e.__scopeMenu,children:(0,C.jsx)(y.z,{present:o||l.open,children:(0,C.jsx)(T.Slot,{scope:e.__scopeMenu,children:(0,C.jsx)(ee,{id:h.contentId,"aria-labelledby":h.triggerId,...c,ref:p,align:a,side:"rtl"===u.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;u.isUsingKeyboardRef.current&&(null===(t=d.current)||void 0===t||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,r.Mj)(e.onFocusOutside,e=>{e.target!==h.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:(0,r.Mj)(e.onEscapeKeyDown,e=>{u.onClose(),e.preventDefault()}),onKeyDown:(0,r.Mj)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),i=M[u.dir].includes(e.key);if(t&&i){var n;l.onOpenChange(!1),null===(n=h.trigger)||void 0===n||n.focus(),e.preventDefault()}})})})})})});function eM(e){return e?"open":"closed"}function eO(e){return"indeterminate"===e}function eT(e){return eO(e)?"indeterminate":e?"checked":"unchecked"}function eI(e){return t=>"mouse"===t.pointerType?e(t):void 0}eA.displayName=eE;var eR="DropdownMenu",[eN,eL]=(0,o.b)(eR,[L]),ej=L(),[eP,eW]=eN(eR),eK=e=>{let{__scopeDropdownMenu:t,children:i,dir:r,open:s,defaultOpen:o,onOpenChange:c,modal:l=!0}=e,u=ej(t),h=n.useRef(null),[d,p]=(0,a.T)({prop:s,defaultProp:null!=o&&o,onChange:c,caller:eR});return(0,C.jsx)(eP,{scope:t,triggerId:(0,f.M)(),triggerRef:h,contentId:(0,f.M)(),open:d,onOpenChange:p,onOpenToggle:n.useCallback(()=>p(e=>
22!e),[p]),modal:l,children:(0,C.jsx)(q,{...u,open:d,onOpenChange:p,dir:r,modal:l,children:i})})};eK.displayName=eR;var eD="DropdownMenuTrigger",eU=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,disabled:n=!1,...o}=e,a=eW(eD,i),l=ej(i);return(0,C.jsx)(F,{asChild:!0,...l,children:(0,C.jsx)(c.WV.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...o,ref:(0,s.F)(t,a.triggerRef),onPointerDown:(0,r.Mj)(e.onPointerDown,e=>{n||0!==e.button||!1!==e.ctrlKey||(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:(0,r.Mj)(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});eU.displayName=eD;var eq=e=>{let{__scopeDropdownMenu:t,...i}=e,n=ej(t);return(0,C.jsx)(V,{...n,...i})};eq.displayName="DropdownMenuPortal";var eF="DropdownMenuContent",eB=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...s}=e,o=eW(eF,i),a=ej(i),c=n.useRef(!1);return(0,C.jsx)(J,{id:o.contentId,"aria-labelledby":o.triggerId,...a,...s,ref:t,onCloseAutoFocus:(0,r.Mj)(e.onCloseAutoFocus,e=>{var t;c.current||null===(t=o.triggerRef.current)||void 0===t||t.focus(),c.current=!1,e.preventDefault()}),onInteractOutside:(0,r.Mj)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,i=0===t.button&&!0===t.ctrlKey,n=2===t.button||i;(!o.modal||n)&&(c.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eB.displayName=eF;var e$=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(et,{...r,...n,ref:t})});e$.displayName="DropdownMenuGroup";var ez=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(ei,{...r,...n,ref:t})});ez.displayName="DropdownMenuLabel";var eV=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(es,{...r,...n,ref:t})});eV.displayName="DropdownMenuItem";var eH=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(ea,{...r,...n,ref:t})});eH.displayName="DropdownMenuCheckboxItem";var eZ=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(eh,{...r,...n,ref:t})});eZ.displayName="DropdownMenuRadioGroup";var eG=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(ep,{...r,...n,ref:t})});eG.displayName="DropdownMenuRadioItem";var eJ=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(ey,{...r,...n,ref:t})});eJ.displayName="DropdownMenuItemIndicator";var eY=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(em,{...r,...n,ref:t})});eY.displayName="DropdownMenuSeparator",n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(eb,{...r,...n,ref:t})}).displayName="DropdownMenuArrow";var eX=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(ex,{...r,...n,ref:t})});eX.displayName="DropdownMenuSubTrigger";var eQ=n.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,...n}=e,r=ej(i);return(0,C.jsx)(eA,{...r,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eQ.displayName="DropdownMenuSubContent";var e0=eK,e1=eU,e2=eq,e4=eB,e9=e$,e3=ez,e5=eV,e6=eH,e7=eZ,e8=eG,te=eJ,tt=eY,ti=e=>{let{__scopeDropdownMenu:t,children:i,open:n,onOpenChange:r,defaultOpen:s}=e,o=ej(t),[c,l]=(0,a.T)({prop:n,defaultProp:null!=s&&s,onChange:r,caller:"DropdownMenuSub"});return(0,C.jsx)(eC,{...o,open:c,onOpenChange:l,children:i})},tn=eX,tr=eQ},6711:function(e,t,i){"use strict";i.d(t,{VY:function(){return B},fC:function(){return q},xz:function(){return F},zt:function(){return U}});var n=i(9585),r=i(1308),s=i(7767),o=i(8257),a=i(6558),c=i(1218),l=i(4823),u=(i(4920),i(2405)),h=i(5102),d=i(5511),p=i(6495),f=i(8232),v=i(7573),[g,y]=(0,o.b)("Tooltip",[l.D7]),m=(0,l.D7)(),b="TooltipProvider",w="tooltip.open",[_,k]=g(b),C=e=>
22{let{__scopeTooltip:t,delayDuration:i=700,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,a=n.useRef(!0),c=n.useRef(!1),l=n.useRef(0);return n.useEffect(()=>{let e=l.current;return()=>window.clearTimeout(e)},[]),(0,v.jsx)(_,{scope:t,isOpenDelayedRef:a,delayDuration:i,onOpen:n.useCallback(()=>{r<=0||(window.clearTimeout(l.current),a.current=!1)},[r]),onClose:n.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,r))},[r]),isPointerInTransitRef:c,onPointerInTransitChange:n.useCallback(e=>{c.current=e},[]),disableHoverableContent:s,children:o})};C.displayName=b;var S="Tooltip",[x,E]=g(S),A=e=>{let{__scopeTooltip:t,children:i,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:a,delayDuration:u}=e,h=k(S,e.__scopeTooltip),d=m(t),[f,g]=n.useState(null),y=(0,c.M)(),b=n.useRef(0),_=null!=a?a:h.disableHoverableContent,C=null!=u?u:h.delayDuration,E=n.useRef(!1),[A,M]=(0,p.T)({prop:r,defaultProp:null!=s&&s,onChange:e=>{e?(h.onOpen(),document.dispatchEvent(new CustomEvent(w))):h.onClose(),null==o||o(e)},caller:S}),O=n.useMemo(()=>A?E.current?"delayed-open":"instant-open":"closed",[A]),T=n.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E.current=!1,M(!0)},[M]),I=n.useCallback(()=>{window.clearTimeout(b.current),b.current=0,M(!1)},[M]),R=n.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{E.current=!0,M(!0),b.current=0},C)},[C,M]);return n.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),(0,v.jsx)(l.fC,{...d,children:(0,v.jsx)(x,{scope:t,contentId:y,open:A,stateAttribute:O,trigger:f,onTriggerChange:g,onTriggerEnter:n.useCallback(()=>{h.isOpenDelayedRef.current?R():T()},[h.isOpenDelayedRef,R,T]),onTriggerLeave:n.useCallback(()=>{_?I():(window.clearTimeout(b.current),b.current=0)},[I,_]),onOpen:T,onClose:I,disableHoverableContent:_,children:i})})};A.displayName=S;var M="TooltipTrigger",O=n.forwardRef((e,t)=>{let{__scopeTooltip:i,...o}=e,a=E(M,i),c=k(M,i),u=m(i),d=n.useRef(null),p=(0,s.e)(t,d,a.onTriggerChange),f=n.useRef(!1),g=n.useRef(!1),y=n.useCallback(()=>f.current=!1,[]);return n.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),(0,v.jsx)(l.ee,{asChild:!0,...u,children:(0,v.jsx)(h.WV.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...o,ref:p,onPointerMove:(0,r.Mj)(e.onPointerMove,e=>{"touch"===e.pointerType||g.current||c.isPointerInTransitRef.current||(a.onTriggerEnter(),g.current=!0)}),onPointerLeave:(0,r.Mj)(e.onPointerLeave,()=>{a.onTriggerLeave(),g.current=!1}),onPointerDown:(0,r.Mj)(e.onPointerDown,()=>{a.open&&a.onClose(),f.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:(0,r.Mj)(e.onFocus,()=>{f.current||a.onOpen()}),onBlur:(0,r.Mj)(e.onBlur,a.onClose),onClick:(0,r.Mj)(e.onClick,a.onClose)})})});O.displayName=M;var[T,I]=g("TooltipPortal",{forceMount:void 0}),R="TooltipContent",N=n.forwardRef((e,t)=>{let i=I(R,e.__scopeTooltip),{forceMount:n=i.forceMount,side:r="top",...s}=e,o=E(R,e.__scopeTooltip);return(0,v.jsx)(u.z,{present:n||o.open,children:o.disableHoverableContent?(0,v.jsx)(K,{side:r,...s,ref:t}):(0,v.jsx)(L,{side:r,...s,ref:t})})}),L=n.forwardRef((e,t)=>{let i=E(R,e.__scopeTooltip),r=k(R,e.__scopeTooltip),o=n.useRef(null),a=(0,s.e)(t,o),[c,l]=n.useState(null),{trigger:u,onClose:h}=i,d=o.current,{onPointerInTransitChange:p}=r,f=n.useCallback(()=>{l(null),p(!1)},[p]),g=n.useCallback((e,t)=>{let i=e.currentTarget,n={x:e.clientX,y:e.clientY},r=function(e,t){let i=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(i,n,r,s)){case s:return"left";case r:return"right";case i:return"top";case n:return"bottom";default:throw Error("unreachable")}}(n,i.getBoundingClientRect());l(function(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),function(e){if(e.length<=1)return e.slice();let t=[];for(let i=0;i<e.length;i++){let n=e[i];for(;t.length>=2;){let e=t[t.length-1],i=t[t.length-2];if((e.x-i.x)*(n.y-i.y)>=(e.y-i.y)*(n.x-i.x))t.pop();else break}t.push(n)}t.pop();let i=[];for(let t=e.length-1;t>=0;t--){let n=e[t];for(;i.length>=2;){let e=i[i.length-1],t=i[i.length-2];if((e.x-t.x)*(n.y-t.y)>=(e.y-t.y)*(n.x-t.x))i.pop();else break}i.push(n)}return(i.pop(),1===t.length&&1===i.length&&t[0].x===i[0].x&&t[0].y===i[0].y)?t:t.concat(i)}(t)}([...function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,n=[];switch(t){case"top":n.push({x:e.x-i,y:e.y+i},{x:e.x+i,y:e.y+i});break;case"bottom":n.push({x:e.x-i,y:e.y-i},{x:e.x+i,y:e.y-i});break;case"left":n.push({x:e.x+i,y:e.y-i},{x:e.x+i,y:e.y+i});break;case"right":n.push({x:e.x-i,y:e.y-i},{x:e.x-i,y:e.y+i})}return n}(n,r),...function(e){let{top:t,right:i,bottom:n,left:r}=e;return[{x:r,y:t},{x:i,y:t},{x:i,y:n},{x:r,y:n}]}(t.getBoundingClientRect())])),p(!0)},[p]);return n.useEffect(()=>()=>f(),[f]),n.useEffect(()=>{if(u&&d){let e=e=>g(e,d),t=e=>g(e,u);return u.addEventListener("pointerleave",e),d.addEventListener("pointerleave",t),()=>{u.removeEventListener("pointerleave",e),d.removeEventListener("pointerleave",t)}}},[u,d,g,f]),n.useEffect(()=>{if(c){let e=e=>{let t=e.target,i={x:e.clientX,y:e.clientY},n=(null==u?void 0:u.contains(t))||(null==d?void 0:d.contains(t)),r=!function(e,t){let{x:i,y:n}=e,r=!1;for(let e=0,s=t.length-1;e<t.length;s=e++){let o=t[e],a=t[s],c=o.x,l=o.y,u=a.x,h=a.y;l>n!=h>n&&i<(u-c)*(n-l)/(h-l)+c&&(r=!r)}return r}(i,c);n?f():r&&(f(),h())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[u,d,c,h,f]),(0,v.jsx)(K,{...e,ref:a})}),[j,P]=g(S,{isInside:!1}),W=(0,d.sA)("TooltipContent"),K=n.forwardRef((e,t)=>
22{let{__scopeTooltip:i,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:c,...u}=e,h=E(R,i),d=m(i),{onClose:p}=h;return n.useEffect(()=>(document.addEventListener(w,p),()=>document.removeEventListener(w,p)),[p]),n.useEffect(()=>{if(h.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(h.trigger)&&p()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[h.trigger,p]),(0,v.jsx)(a.XB,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:p,children:(0,v.jsxs)(l.VY,{"data-state":h.stateAttribute,...d,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,v.jsx)(W,{children:r}),(0,v.jsx)(j,{scope:i,isInside:!0,children:(0,v.jsx)(f.fC,{id:h.contentId,role:"tooltip",children:s||r})})]})})});N.displayName=R;var D="TooltipArrow";n.forwardRef((e,t)=>{let{__scopeTooltip:i,...n}=e,r=m(i);return P(D,i).isInside?null:(0,v.jsx)(l.Eh,{...r,...n,ref:t})}).displayName=D;var U=C,q=A,F=O,B=N},8232:function(e,t,i){"use strict";i.d(t,{TX:function(){return a},fC:function(){return c}});var n=i(9585),r=i(5102),s=i(7573),o=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),a=n.forwardRef((e,t)=>(0,s.jsx)(r.WV.span,{...e,ref:t,style:{...o,...e.style}}));a.displayName="VisuallyHidden";var c=a},2614:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","apps","Apps",[["path",{d:"M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-0"}],["path",{d:"M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-1"}],["path",{d:"M14 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-2"}],["path",{d:"M14 7l6 0",key:"svg-3"}],["path",{d:"M17 4l0 6",key:"svg-4"}]])},4907:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","arrow-right","ArrowRight",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M13 18l6 -6",key:"svg-1"}],["path",{d:"M13 6l6 6",key:"svg-2"}]])},693:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","bell","Bell",[["path",{d:"M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6",key:"svg-0"}],["path",{d:"M9 17v1a3 3 0 0 0 6 0v-1",key:"svg-1"}]])},9510:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","building","Building",[["path",{d:"M3 21l18 0",key:"svg-0"}],["path",{d:"M9 8l1 0",key:"svg-1"}],["path",{d:"M9 12l1 0",key:"svg-2"}],["path",{d:"M9 16l1 0",key:"svg-3"}],["path",{d:"M14 8l1 0",key:"svg-4"}],["path",{d:"M14 12l1 0",key:"svg-5"}],["path",{d:"M14 16l1 0",key:"svg-6"}],["path",{d:"M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16",key:"svg-7"}]])},8059:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","circle-dashed","CircleDashed",[["path",{d:"M8.56 3.69a9 9 0 0 0 -2.92 1.95",key:"svg-0"}],["path",{d:"M3.69 8.56a9 9 0 0 0 -.69 3.44",key:"svg-1"}],["path",{d:"M3.69 15.44a9 9 0 0 0 1.95 2.92",key:"svg-2"}],["path",{d:"M8.56 20.31a9 9 0 0 0 3.44 .69",key:"svg-3"}],["path",{d:"M15.44 20.31a9 9 0 0 0 2.92 -1.95",key:"svg-4"}],["path",{d:"M20.31 15.44a9 9 0 0 0 .69 -3.44",key:"svg-5"}],["path",{d:"M20.31 8.56a9 9 0 0 0 -1.95 -2.92",key:"svg-6"}],["path",{d:"M15.44 3.69a9 9 0 0 0 -3.44 -.69",key:"svg-7"}]])},448:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","circle-dashed-check","CircleDashedCheck",[["path",{d:"M8.56 3.69a9 9 0 0 0 -2.92 1.95",key:"svg-0"}],["path",{d:"M3.69 8.56a9 9 0 0 0 -.69 3.44",key:"svg-1"}],["path",{d:"M3.69 15.44a9 9 0 0 0 1.95 2.92",key:"svg-2"}],["path",{d:"M8.56 20.31a9 9 0 0 0 3.44 .69",key:"svg-3"}],["path",{d:"M15.44 20.31a9 9 0 0 0 2.92 -1.95",key:"svg-4"}],["path",{d:"M20.31 15.44a9 9 0 0 0 .69 -3.44",key:"svg-5"}],["path",{d:"M20.31 8.56a9 9 0 0 0 -1.95 -2.92",key:"svg-6"}],["path",{d:"M15.44 3.69a9 9 0 0 0 -3.44 -.69",key:"svg-7"}],["path",{d:"M9 12l2 2l4 -4",key:"svg-8"}]])},1601:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","language-hiragana","LanguageHiragana",[["path",{d:"M4 5h7",key:"svg-0"}
22],["path",{d:"M7 4c0 4.846 0 7 .5 8",key:"svg-1"}],["path",{d:"M10 8.5c0 2.286 -2 4.5 -3.5 4.5s-2.5 -1.135 -2.5 -2c0 -2 1 -3 3 -3s5 .57 5 2.857c0 1.524 -.667 2.571 -2 3.143",key:"svg-2"}],["path",{d:"M12 20l4 -9l4 9",key:"svg-3"}],["path",{d:"M19.1 18h-6.2",key:"svg-4"}]])},3566:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","logout","Logout",[["path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M9 12h12l-3 -3",key:"svg-1"}],["path",{d:"M18 15l3 -3",key:"svg-2"}]])},4120:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","settings","Settings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]])},7562:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","user","User",[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}]])},5324:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","x","X",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]])},4791:function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});let n=(0,i(4276).Z)("outline","zoom","Zoom",[["path",{d:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]])},265:function(e,t,i){"use strict";i.d(t,{x0:function(){return n}});let n=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>((t&=63)<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"")}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.