@ssgc/alert-console 2.6.11 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),f=require("react"),d=require("antd"),dt=require("@ant-design/icons"),be=require("react-toastify"),mt=require("@tanstack/react-query"),da="#FF3B30",ma="#FF9500",fa="#FFCC00",ha="#34C759",Lt={critical:da,high:ma,medium:fa,low:ha},sn={Critical:Lt.critical,High:Lt.high,Medium:Lt.medium,Low:Lt.low};function ya(t){return sn[t]||sn.Low}function nn(t){if(!t||typeof t!="string")return 0;const e=t.trim().split(":");if(e.length!==3)return 0;const[s,n,r]=e,a=Number.parseInt(s,10),o=Number.parseInt(n,10),c=Number.parseFloat(r||"0"),l=Number.isFinite(a)?a:0,u=Number.isFinite(o)?o:0,m=Number.isFinite(c)?c:0;return l*3600+u*60+m}function rn(t){const e=t.thirdPartyIds??t.ThirdPartyIds??t.thirdPartyId??t.ThirdPartyId??"",s=Array.isArray(e)?e.join(","):String(e??"");if(!s||!s.trim())return[];const n=s.split(",").map(o=>parseInt(String(o).trim(),10)).filter(o=>Number.isFinite(o)),r=new Set,a=[];return n.forEach(o=>{r.has(o)||(r.add(o),a.push(o))}),a}const Hn="",ga=Hn,pa="",Sa="",xa="",wa="",an={snl:{alerts:Hn,rules:ga},schools:{alerts:pa,rules:Sa},transit:{alerts:xa,rules:wa}};function Pe(t,e){const s=(t||"").replace(/\/+$/,""),n=e.startsWith("/")?e:`/${e}`;return`${s}${n}`}function va(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}function Ft(t,e){if(!e)return t;const s=new URL(t);return Object.entries(e).forEach(([n,r])=>{r!=null&&String(r).length>0&&s.searchParams.set(n,String(r))}),s.toString()}async function We(t,e){const s={...e.headers,...va()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.errorMessage||a?.message||`HTTP ${n.status}`;throw new Error(o)}return a}function Aa(t){const e={"Content-Type":"application/json",...t.headers||{}};return{async listAlerts(){const s=Pe(t.baseUrl,"/api/Alert"),n=await We(s,{method:"GET",headers:e});return Array.isArray(n)?n:[]},async getAlertStatusList(){const s=Pe(t.baseUrl,"/api/Alert/AlertStatusList"),n=await We(s,{method:"GET",headers:e});return Array.isArray(n)?n:n&&typeof n=="object"&&Array.isArray(n.data)?n.data:[]},async getAlertsReport(s){const n=Pe(t.baseUrl,"/Alerts/GetAlertsReport"),r=Ft(n,s),a=await We(r,{method:"GET",headers:e});return Array.isArray(a)?a:[]},async updateAlertStatus(s){const n=Pe(t.baseUrl,"/api/Alert/status");return We(n,{method:"PUT",headers:e,body:JSON.stringify(s??{})})},async getAdminSettings(){const s=Pe(t.baseUrl,"/api/Alert/GetAdminSettings"),n=await We(s,{method:"GET",headers:e});if(n&&typeof n=="object"){if("data"in n)return n.data;if("userId"in n)return n}return null},async setAdminSettings(s){const n=Pe(t.baseUrl,"/api/Alert/SetAdminSettings"),r={userId:0,isAdminSetting:!0,sortBy:s?.sortBy??"",groupBy:s?.groupBy??null};return We(n,{method:"POST",headers:e,body:JSON.stringify(r)})},async getPreferenceSettings(){const s=Pe(t.baseUrl,"/api/Alert/GetPreferenceSettings"),n=await We(s,{method:"GET",headers:e});if(n&&typeof n=="object"){if("data"in n)return n.data;if("anomalyIds"in n)return n}return null},async setPreferenceSettings(s){const n=Pe(t.baseUrl,"/api/Alert/SetPreferenceSettings"),r=await We(n,{method:"POST",headers:e,body:JSON.stringify(s??{})}),a=r?.responseStatus??!0,o=r?.data??r?.message??"Preferences updated successfully.";return{responseStatus:a,errorMessage:a?"":r?.errorMessage??r?.message??"",statusCode:200,data:o}},async getAlertNotifications(s){const n=Pe(t.baseUrl,"/api/Alert/GetNotifications"),r=Ft(n,{alertId:s}),a=await We(r,{method:"GET",headers:e});return Array.isArray(a)?a:a&&typeof a=="object"&&Array.isArray(a.data)?a.data:[]},async notifyFamilyMembers(s){const n=Pe(t.baseUrl,"/api/Alert/NotificationToFamilyMembers"),r=Ft(n,{alertId:s});return We(r,{method:"POST",headers:e})},async sendSMSorEmailNotifications(s,n,r){const a=Pe(t.baseUrl,"/api/Alert/SendSMSorEmailNotifications"),o=Ft(a,{alertId:s,isEmail:n,isSMS:r});return We(o,{method:"POST",headers:e})},async getTimeZoneMasters(){const s=Pe(t.baseUrl,"/api/UserPreference/GetTimeZoneMasters"),n=await We(s,{method:"GET",headers:e});return Array.isArray(n)?n:n&&typeof n=="object"&&Array.isArray(n.data)?n.data:[]},async getMyAppPreferences(){const s=Pe(t.baseUrl,"/api/UserPreference/GetMyAppPreferences"),n=await We(s,{method:"GET",headers:e});if(n&&typeof n=="object"){const r=n.data??n;if(r?.timeZoneUniqueId)return{timeZoneUniqueId:r.timeZoneUniqueId}}return null}}}function on(t,e){const s=(t||"").replace(/\/+$/,""),n=e.startsWith("/")?e:`/${e}`;return`${s}${n}`}function Ta(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}async function $t(t,e){const s={...e.headers,...Ta()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.errorMessage||a?.message||`HTTP ${n.status}`;throw new Error(o)}return a}function Na(t){const e={"Content-Type":"application/json",...t.headers||{}},s=on(t.baseUrl,"/api/Rules"),n=on(t.baseUrl,"/api/Rules/lookups");return{async getRules(){const r=await $t(s,{method:"GET",headers:e});return Array.isArray(r)?r:[]},async setEscalationSettings(r){return $t(s,{method:"POST",headers:e,body:JSON.stringify(r??{})})},async getLookups(){return $t(n,{method:"GET",headers:e})},async updateRule(r,a){const o=`${s}/${r}`;return $t(o,{method:"PUT",headers:e,body:JSON.stringify(a??{})})}}}function ba(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yt={exports:{}},ka=Yt.exports,ln;function Ia(){return ln||(ln=1,(function(t,e){(function(s,n){t.exports=n()})(ka,(function(){var s=1e3,n=6e4,r=36e5,a="millisecond",o="second",c="minute",l="hour",u="day",m="week",h="month",p="quarter",y="year",w="date",I="Invalid Date",j=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,z=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,_={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(C){var S=["th","st","nd","rd"],x=C%100;return"["+C+(S[(x-20)%10]||S[x]||S[0])+"]"}},H=function(C,S,x){var b=String(C);return!b||b.length>=S?C:""+Array(S+1-b.length).join(x)+C},N={s:H,z:function(C){var S=-C.utcOffset(),x=Math.abs(S),b=Math.floor(x/60),A=x%60;return(S<=0?"+":"-")+H(b,2,"0")+":"+H(A,2,"0")},m:function C(S,x){if(S.date()<x.date())return-C(x,S);var b=12*(x.year()-S.year())+(x.month()-S.month()),A=S.clone().add(b,h),D=x-A<0,R=S.clone().add(b+(D?-1:1),h);return+(-(b+(x-A)/(D?A-R:R-A))||0)},a:function(C){return C<0?Math.ceil(C)||0:Math.floor(C)},p:function(C){return{M:h,y,w:m,d:u,D:w,h:l,m:c,s:o,ms:a,Q:p}[C]||String(C||"").toLowerCase().replace(/s$/,"")},u:function(C){return C===void 0}},E="en",P={};P[E]=_;var O="$isDayjsObject",W=function(C){return C instanceof he||!(!C||!C[O])},g=function C(S,x,b){var A;if(!S)return E;if(typeof S=="string"){var D=S.toLowerCase();P[D]&&(A=D),x&&(P[D]=x,A=D);var R=S.split("-");if(!A&&R.length>1)return C(R[0])}else{var q=S.name;P[q]=S,A=q}return!b&&A&&(E=A),A||!b&&E},v=function(C,S){if(W(C))return C.clone();var x=typeof S=="object"?S:{};return x.date=C,x.args=arguments,new he(x)},M=N;M.l=g,M.i=W,M.w=function(C,S){return v(C,{locale:S.$L,utc:S.$u,x:S.$x,$offset:S.$offset})};var he=(function(){function C(x){this.$L=g(x.locale,null,!0),this.parse(x),this.$x=this.$x||x.x||{},this[O]=!0}var S=C.prototype;return S.parse=function(x){this.$d=(function(b){var A=b.date,D=b.utc;if(A===null)return new Date(NaN);if(M.u(A))return new Date;if(A instanceof Date)return new Date(A);if(typeof A=="string"&&!/Z$/i.test(A)){var R=A.match(j);if(R){var q=R[2]-1||0,J=(R[7]||"0").substring(0,3);return D?new Date(Date.UTC(R[1],q,R[3]||1,R[4]||0,R[5]||0,R[6]||0,J)):new Date(R[1],q,R[3]||1,R[4]||0,R[5]||0,R[6]||0,J)}}return new Date(A)})(x),this.init()},S.init=function(){var x=this.$d;this.$y=x.getFullYear(),this.$M=x.getMonth(),this.$D=x.getDate(),this.$W=x.getDay(),this.$H=x.getHours(),this.$m=x.getMinutes(),this.$s=x.getSeconds(),this.$ms=x.getMilliseconds()},S.$utils=function(){return M},S.isValid=function(){return this.$d.toString()!==I},S.isSame=function(x,b){var A=v(x);return this.startOf(b)<=A&&A<=this.endOf(b)},S.isAfter=function(x,b){return v(x)<this.startOf(b)},S.isBefore=function(x,b){return this.endOf(b)<v(x)},S.$g=function(x,b,A){return M.u(x)?this[b]:this.set(A,x)},S.unix=function(){return Math.floor(this.valueOf()/1e3)},S.valueOf=function(){return this.$d.getTime()},S.startOf=function(x,b){var A=this,D=!!M.u(b)||b,R=M.p(x),q=function(Ae,ue){var de=M.w(A.$u?Date.UTC(A.$y,ue,Ae):new Date(A.$y,ue,Ae),A);return D?de:de.endOf(u)},J=function(Ae,ue){return M.w(A.toDate()[Ae].apply(A.toDate("s"),(D?[0,0,0,0]:[23,59,59,999]).slice(ue)),A)},te=this.$W,X=this.$M,le=this.$D,we="set"+(this.$u?"UTC":"");switch(R){case y:return D?q(1,0):q(31,11);case h:return D?q(1,X):q(0,X+1);case m:var ie=this.$locale().weekStart||0,ye=(te<ie?te+7:te)-ie;return q(D?le-ye:le+(6-ye),X);case u:case w:return J(we+"Hours",0);case l:return J(we+"Minutes",1);case c:return J(we+"Seconds",2);case o:return J(we+"Milliseconds",3);default:return this.clone()}},S.endOf=function(x){return this.startOf(x,!1)},S.$set=function(x,b){var A,D=M.p(x),R="set"+(this.$u?"UTC":""),q=(A={},A[u]=R+"Date",A[w]=R+"Date",A[h]=R+"Month",A[y]=R+"FullYear",A[l]=R+"Hours",A[c]=R+"Minutes",A[o]=R+"Seconds",A[a]=R+"Milliseconds",A)[D],J=D===u?this.$D+(b-this.$W):b;if(D===h||D===y){var te=this.clone().set(w,1);te.$d[q](J),te.init(),this.$d=te.set(w,Math.min(this.$D,te.daysInMonth())).$d}else q&&this.$d[q](J);return this.init(),this},S.set=function(x,b){return this.clone().$set(x,b)},S.get=function(x){return this[M.p(x)]()},S.add=function(x,b){var A,D=this;x=Number(x);var R=M.p(b),q=function(X){var le=v(D);return M.w(le.date(le.date()+Math.round(X*x)),D)};if(R===h)return this.set(h,this.$M+x);if(R===y)return this.set(y,this.$y+x);if(R===u)return q(1);if(R===m)return q(7);var J=(A={},A[c]=n,A[l]=r,A[o]=s,A)[R]||1,te=this.$d.getTime()+x*J;return M.w(te,this)},S.subtract=function(x,b){return this.add(-1*x,b)},S.format=function(x){var b=this,A=this.$locale();if(!this.isValid())return A.invalidDate||I;var D=x||"YYYY-MM-DDTHH:mm:ssZ",R=M.z(this),q=this.$H,J=this.$m,te=this.$M,X=A.weekdays,le=A.months,we=A.meridiem,ie=function(ue,de,Re,G){return ue&&(ue[de]||ue(b,D))||Re[de].slice(0,G)},ye=function(ue){return M.s(q%12||12,ue,"0")},Ae=we||function(ue,de,Re){var G=ue<12?"AM":"PM";return Re?G.toLowerCase():G};return D.replace(z,(function(ue,de){return de||(function(Re){switch(Re){case"YY":return String(b.$y).slice(-2);case"YYYY":return M.s(b.$y,4,"0");case"M":return te+1;case"MM":return M.s(te+1,2,"0");case"MMM":return ie(A.monthsShort,te,le,3);case"MMMM":return ie(le,te);case"D":return b.$D;case"DD":return M.s(b.$D,2,"0");case"d":return String(b.$W);case"dd":return ie(A.weekdaysMin,b.$W,X,2);case"ddd":return ie(A.weekdaysShort,b.$W,X,3);case"dddd":return X[b.$W];case"H":return String(q);case"HH":return M.s(q,2,"0");case"h":return ye(1);case"hh":return ye(2);case"a":return Ae(q,J,!0);case"A":return Ae(q,J,!1);case"m":return String(J);case"mm":return M.s(J,2,"0");case"s":return String(b.$s);case"ss":return M.s(b.$s,2,"0");case"SSS":return M.s(b.$ms,3,"0");case"Z":return R}return null})(ue)||R.replace(":","")}))},S.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},S.diff=function(x,b,A){var D,R=this,q=M.p(b),J=v(x),te=(J.utcOffset()-this.utcOffset())*n,X=this-J,le=function(){return M.m(R,J)};switch(q){case y:D=le()/12;break;case h:D=le();break;case p:D=le()/3;break;case m:D=(X-te)/6048e5;break;case u:D=(X-te)/864e5;break;case l:D=X/r;break;case c:D=X/n;break;case o:D=X/s;break;default:D=X}return A?D:M.a(D)},S.daysInMonth=function(){return this.endOf(h).$D},S.$locale=function(){return P[this.$L]},S.locale=function(x,b){if(!x)return this.$L;var A=this.clone(),D=g(x,b,!0);return D&&(A.$L=D),A},S.clone=function(){return M.w(this.$d,this)},S.toDate=function(){return new Date(this.valueOf())},S.toJSON=function(){return this.isValid()?this.toISOString():null},S.toISOString=function(){return this.$d.toISOString()},S.toString=function(){return this.$d.toUTCString()},C})(),ne=he.prototype;return v.prototype=ne,[["$ms",a],["$s",o],["$m",c],["$H",l],["$W",u],["$M",h],["$y",y],["$D",w]].forEach((function(C){ne[C[1]]=function(S){return this.$g(S,C[0],C[1])}})),v.extend=function(C,S){return C.$i||(C(S,he,v),C.$i=!0),v},v.locale=g,v.isDayjs=W,v.unix=function(C){return v(1e3*C)},v.en=P[E],v.Ls=P,v.p={},v}))})(Yt)),Yt.exports}var Ma=Ia();const Ea=ba(Ma);function qn(t){if(!t)return"By Severity";const e=t.trim().toLowerCase();return e.includes("created")?"By Created Date":e.includes("updated")||e.includes("modified")?"By Updated Date":"By Severity"}function Gn(t){if(!t||typeof t!="string")return{hours:0,minutes:0,seconds:0};const e=t.split(":").map(a=>parseInt(a,10)),s=Number.isFinite(e[0])?e[0]:0,n=Number.isFinite(e[1])?e[1]:0,r=Number.isFinite(e[2])?e[2]:0;return{hours:s,minutes:n,seconds:r}}function cn(t){const{hours:e,minutes:s,seconds:n}=Gn(t);return Ea().hour(e).minute(s).second(n).millisecond(0)}function Ue(t,e){const s=(t||"").replace(/\/+$/,""),n=e.startsWith("/")?e:`/${e}`;return`${s}${n}`}function Oa(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}function Pt(t,e){if(!e)return t;const s=new URL(t);return Object.entries(e).forEach(([n,r])=>{r!=null&&String(r).length>0&&s.searchParams.set(n,String(r))}),s.toString()}async function Le(t,e){const s={...e.headers,...Oa()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.Message||`HTTP ${n.status}`;throw new Error(o)}return a}const ce=(...t)=>t.find(e=>e!=null);function kt(t,e,s={}){const n={};for(const r of e){const a=s[r]??r.charAt(0).toUpperCase()+r.slice(1);n[r]=t?.[a]??t?.[r]}return n}function ja(t){return Array.isArray(t)?t.map(e=>kt(e,["alertLogId","alertId","status","description","actionNotes","createdDate","createdBy","modifiedDate","modifiedBy"])):t}function Ca(t){return{id:String(ce(t?.AlertId,t?.alertId)??""),alertNumber:ce(t?.AlertNumber,t?.alertNumber),priority:ce(t?.Priority,t?.priority,"Low"),timestamp:ce(t?.UpdatedUtc,t?.timestamp,""),statusType:ce(t?.Status,t?.statusType,""),description:ce(t?.Description,t?.description,""),eventName:ce(t?.EventName,t?.eventName),ruleName:ce(t?.RuleName,t?.ruleName),spaceId:ce(t?.SpaceId,t?.spaceId),spaceName:ce(t?.SpaceName,t?.spaceName),anomalyId:ce(t?.AnomalyId,t?.anomalyId),severityId:ce(t?.SeverityId,t?.severityId),assignTeam:ce(t?.AssignTeam,t?.assignTeam),cameraName:ce(t?.CameraName,t?.cameraName),type:ce(t?.Type,t?.type),mediaDetails:ce(t?.MediaDetails,t?.mediaDetails,t?.MediaUrls,t?.mediaUrls),additionalMedia:ce(t?.AdditionalMedia,t?.additionalMedia),timeElapsed:ce(t?.TimeElapsed,t?.timeElapsed),timeRemaining:ce(t?.TimeRemaining,t?.timeRemaining),anomalyName:ce(t?.AnomalyName,t?.anomalyName),alertDetails:ce(t?.AlertDetails,t?.alertDetails),statusHistory:ja(ce(t?.StatusHistory,t?.statusHistory)),isEmailSent:ce(t?.IsEmailSent,t?.isEmailSent),isSMSSent:ce(t?.IsSMSSent,t?.isSMSSent),timeZoneUniqueId:ce(t?.TimeZoneUniqueId,t?.timeZoneUniqueId)}}function Da(t){const e={"Content-Type":"application/json",...t.headers||{}};return{async listAlerts(s){const n=Ue(t.baseUrl,"/api/detectionpolicy/alerts"),r=Pt(n,{customerId:"99e5c8b5-b9d4-4d35-8885-7f121c532664",pageSize:s?.pageSize??10,page:s?.pageNumber??1,...s?.anomalyId!==void 0&&{anomalyId:s.anomalyId},...s?.spaceId!==void 0&&{spaceId:s.spaceId},...s?.severityId!==void 0&&{severityId:s.severityId},...s?.thirdPartyIds?.length&&{ThirdPartyIds:s.thirdPartyIds.join(",")}}),a=await Le(r,{method:"GET",headers:e});return{items:Array.isArray(a?.Items)?a.Items.map(Ca):[],total:a?.Total}},async getAlertStatusList(){const s=Ue(t.baseUrl,"/api/detectionpolicy/alerts/StatusList"),n=await Le(s,{method:"GET",headers:e});return(Array.isArray(n)?n:[]).map(a=>kt(a,["alertStatusId","value","statusName"]))},async getAlertsReport(s){const n=Ue(t.baseUrl,"/api/detectionpolicy/alerts/GetAlertsReport"),r=Pt(n,s),a=await Le(r,{method:"GET",headers:e});return Array.isArray(a)?a:[]},async updateAlertStatus(s){const n=Ue(t.baseUrl,"/api/detectionpolicy/alerts/Log"),r={AlertId:s.alertId??s.alertUniqueId??s.AlertId,Status:s.status??s.Status??"",Notes:s.notes??s.Notes??""};return Le(n,{method:"POST",headers:e,body:JSON.stringify(r)})},async getAdminSettings(){const s=Ue(t.baseUrl,"/api/detectionpolicy/alerts/GetAdminSettings"),n=await Le(s,{method:"GET",headers:e});if(n&&typeof n=="object"){const r=n.data??n.Data??n;if(r&&typeof r=="object")return kt(r,["userId","isAdminSetting","sortBy"],{sortBy:"SortOption"})}return null},async setAdminSettings(s){const n=Ue(t.baseUrl,"/api/detectionpolicy/alerts/SetAdminSettings"),r={Settings:{UserId:0,IsAdminSetting:!0,SortOption:s?.sortBy??"",GroupBy:s?.groupBy??null}};return Le(n,{method:"POST",headers:e,body:JSON.stringify(r)})},async getPreferenceSettings(){const s=Ue(t.baseUrl,"/api/detectionpolicy/alerts/GetPreferenceSettings"),n=await Le(s,{method:"GET",headers:e});if(n&&typeof n=="object"){if("data"in n)return n.data;if("anomalyIds"in n)return n}return null},async setPreferenceSettings(s){const n=Ue(t.baseUrl,"/api/detectionpolicy/alerts/SetPreferenceSettings"),r=u=>{const{hours:m,minutes:h,seconds:p}=Gn(u);return(m*3600+h*60+p)*1e7},a={Settings:{UserId:0,AnomalyIds:Array.isArray(s?.anomalyIds)?s.anomalyIds.map(u=>String(u)):[],DoNotDisturbStart:{Ticks:r(s?.doNotDisturbStart)},DoNotDisturbEnd:{Ticks:r(s?.doNotDisturbEnd)},InApp:!!s?.inApp,SMS:!!s?.sms,Email:!!s?.email,SortBy:s?.sortBy??""}},o=await Le(n,{method:"POST",headers:e,body:JSON.stringify(a)}),c=o?.responseStatus??!0,l=o?.data??o?.message??"Preferences updated successfully.";return{responseStatus:c,errorMessage:c?"":o?.errorMessage??o?.Message??o?.message??"",statusCode:200,data:l}},async sendSMSorEmailNotifications(s,n,r){const a=Ue(t.baseUrl,"/api/detectionpolicy/alerts/SendSMSorEmailNotifications"),o=Pt(a,{alertId:s,isEmail:n,isSMS:r});return Le(o,{method:"POST",headers:e})},async getAlertNotifications(s){const n=Ue(t.baseUrl,"/api/detectionpolicy/alerts/GetNotifications"),r=Pt(n,{alertId:s}),a=await Le(r,{method:"GET",headers:e});let o=[];return Array.isArray(a)?o=a:Array.isArray(a?.data)&&(o=a.data),o.map(c=>kt(c,["alertNotificationSentId","alertId","notificationType","receipientName","receipentPhoneNumber","messageSID","messageStatus","receipientEmail","notificationReceipientType","sentAt"]))},async getTimeZoneMasters(){const s=Ue(t.baseUrl,"/api/TimeZoneMaster"),n=await Le(s,{method:"GET",headers:e});return(Array.isArray(n?.Data)?n.Data:[]).map(a=>kt(a,["timeZoneUniqueId","ianaTimeZoneId","timeZoneName","offset"]))},async getAllSpaces(){const s=t.spacesBaseUrl||t.baseUrl,n=Ue(s,"/api/AllSpaces"),r=await Le(n,{method:"GET",headers:e});return(Array.isArray(r?.Data)?r.Data:[]).map(o=>({spaceId:o?.SpaceId??o?.spaceId,spaceName:o?.SpaceName??o?.spaceName??""}))},async getMyAppPreferences(){const s=Ue(t.baseUrl,"/MyProfile"),n=await Le(s,{method:"GET",headers:e}),r=n?.data?.userGuid??n?.Data?.userGuid??n?.userGuid;if(!r)return null;const a=Ue(t.baseUrl,`/api/GetMyAppPreferences/${r}`),o=await Le(a,{method:"GET",headers:e});if(o&&typeof o=="object"){const c=o.data??o.Data??o,l=c?.timeZoneUniqueId??c?.TimeZoneUniqueId;if(l)return{timeZoneUniqueId:l}}return null}}}function Ra(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}async function Xe(t,e){const s={...e.headers,...Ra()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.errorMessage||a?.message||`HTTP ${n.status}`;throw new Error(o)}return a}function Ua(t){const e={"Content-Type":"application/json",...t.headers||{}},s=new URL("/api/detectionpolicy/rules",t.baseUrl).toString();return{async getRules(){const n=await Xe(s,{method:"GET",headers:e});return(Array.isArray(n?.Data)?n?.Data:[]).map(a=>({...a,ruleId:a.ruleId??a.RuleId,ruleName:a.ruleName??a.RuleName??a.Name,escalationSettings:a.escalationSettings??a.EscalationSettings}))},async setEscalationSettings(n){return Xe(s,{method:"POST",headers:e,body:JSON.stringify(n??{})})},async getLookups(){const n=g=>new URL(g,t.baseUrl).toString(),r=t.userManagementBaseUrl||t.baseUrl,a=[Xe(n("/api/detectionpolicy/lookups/actiontypes"),{method:"GET",headers:e}),Xe(n("/api/detectionpolicy/lookups/anomalies"),{method:"GET",headers:e}),Xe(n("/api/detectionpolicy/lookups/thirdparty"),{method:"GET",headers:e}),Xe(n("/api/detectionpolicy/lookups/severity"),{method:"GET",headers:e}),Xe(n("/api/detectionpolicy/lookups/scheduletypes"),{method:"GET",headers:e}),Xe(new URL("/user/user-roles",r).toString(),{method:"GET",headers:e})],[o,c,l,u,m,h]=await Promise.allSettled(a),p=g=>{if(g.status!=="fulfilled")return[];const v=g.value;return Array.isArray(v)?v:Array.isArray(v?.Data)?v.Data:Array.isArray(v?.data)?v.data:[]},y=p(o),w=p(c),I=p(l),j=p(u),z=p(m),_=h.status==="fulfilled"?h.value:null;let H=[];Array.isArray(_)?H=_:Array.isArray(_?.Data)?H=_.Data:Array.isArray(_?.data)&&(H=_.data);const N=y.map(g=>({actionTypeId:Number(g?.ActionTypeId),name:g?.DisplayName??g?.Name??""})),E=w.map(g=>({recordId:g?.AnomalyId,anomalyName:g?.DisplayName??g?.Name??""})),P=I.map(g=>({thirdPartyId:Number(g?.ThirdPartyId),thirdPartyName:g?.ThirdPartyName??g?.Name??""})),O=H.map(g=>({userRoleId:g.UserRoleId??g.userRoleId??g.Id??g.id??0,userRoleName:g.UserRoleName??g.userRoleName??g.Name??g.name??""})),W={actionTypes:N,anomalies:E,thirdParties:P};return j.length&&(W.severities=j.map(g=>({severityId:g?.SeverityId??g?.severityId,severityName:g?.DisplayName??g?.SeverityName??g?.Name??g?.name??""}))),z.length&&(W.scheduleTypes=z),O.length&&(W.userRoles=O),W},async updateRule(n,r){const a=`${s}/${n}`,{escalationSettings:o,Anomaly:c,Severity:l,...u}=r??{};return Xe(a,{method:"PUT",headers:e,body:JSON.stringify({...u,CustomerId:"99e5c8b5-b9d4-4d35-8885-7f121c532664",Version:{DeDupWindowSeconds:0,IncludeSubjectInHash:!0},AnomalyId:c?.AnomalyId,SeverityId:l?.SeverityId,EscalationSettings:o?{...o,ThirdPartyIds:o.thirdPartyId??[]}:{}})})}}}function La(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}async function nt(t,e){const s={...e.headers,...La()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.errorMessage||a?.message||`HTTP ${n.status}`;throw new Error(o)}return a}function Fa(t){const e={"Content-Type":"application/json",...t.headers||{}},s=new URL("/list-rule",t.baseUrl).toString();return{async getRules(){const n=await nt(s,{method:"POST",headers:e,body:JSON.stringify({command:"get-all"})});return(Array.isArray(n?.data)?n.data:[]).map(a=>({...a,ruleId:a.RuleId??a.ruleId,ruleName:a.RuleName??a.ruleName,ruleDesc:a.RuleDesc??a.ruleDesc??null}))},async setEscalationSettings(n){return nt(s,{method:"POST",headers:e,body:JSON.stringify(n??{})})},async getLookups(){const n=O=>new URL(O,t.baseUrl).toString(),r=t.userManagementBaseUrl||t.baseUrl,a=[nt(n("/api/ActionTypeMaster/GetAll"),{method:"GET",headers:e}),nt(n("/api/anomaly/anomaly-list"),{method:"POST",headers:e,body:JSON.stringify({RuleLevel:1})}),nt(n("/api/Lookup/ThirdParties"),{method:"GET",headers:e}),nt(n("/api/anomaly/severity-list"),{method:"GET",headers:e}),nt(new URL("/user/user-roles",r).toString(),{method:"GET",headers:e})],[o,c,l,u,m]=await Promise.allSettled(a),h=O=>{if(O.status!=="fulfilled")return[];const W=O.value;return Array.isArray(W)?W:Array.isArray(W?.data)?W.data:[]},p=h(o),y=h(c),w=h(l),I=h(u),j=m.status==="fulfilled"?m.value:null,z=p.map(O=>({actionTypeId:O?.ActionTypeUniqueId,name:O?.Name??""})),_=y.map(O=>({recordId:O?.AnomalyId,anomalyName:O?.DisplayName??O?.Name??""})),H=w.map(O=>({thirdPartyId:Number(O?.ThirdPartyId),thirdPartyName:O?.ThirdPartyName??O?.Name??""}));let N=[];Array.isArray(j)?N=j:Array.isArray(j?.Data)?N=j.Data:Array.isArray(j?.data)&&(N=j.data);const E=N.map(O=>({userRoleId:O.userRoleId??0,userRoleName:O.userRoleName??""})),P={actionTypes:z,anomalies:_,thirdParties:H};return I.length&&(P.severities=I.map(O=>({SeverityId:O.SeverityId,DisplayName:O.SeverityName??O.DisplayName??""}))),E.length&&(P.userRoles=E),P},async updateRule(n,r){const a=new URL("/update-rule",t.baseUrl).toString(),{escalationSettings:o,ruleId:c,ruleName:l,ruleDesc:u,...m}=r??{},h=o??{},p=(h.escalationSettingsActionTypeIds??[]).filter(w=>w!=null&&!Number.isNaN(w)),y={Level1UserRoleId:h.level1UserRoleId??0,Level1PostAssistTime:h.level1PostAssistTime??0,Level2UserRoleId:h.level2UserRoleId??0,Level2PostAssistTime:h.level2PostAssistTime??0,Level3UserRoleId:h.level3UserRoleId??0,Level3PostAssistTime:h.level3PostAssistTime??0,EscalationSettingsActionTypeIds:p,ThirdPartyIds:h.thirdPartyId??[],HumanLoop:h.humanLoop??!1};return nt(a,{method:"POST",headers:e,body:JSON.stringify({...m,RuleId:c??m.RuleId??n,RuleName:l??m.RuleName,RuleDesc:u??m.RuleDesc??null,ActionTypeUniqueIdList:p,EscalationSettings:y})})}}}function ze(t,e){const s=(t||"").replace(/\/+$/,""),n=e.startsWith("/")?e:`/${e}`;return`${s}${n}`}function $a(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}function Wt(t,e){if(!e)return t;const s=new URL(t);return Object.entries(e).forEach(([n,r])=>{r!=null&&String(r).length>0&&s.searchParams.set(n,String(r))}),s.toString()}async function He(t,e){const s={...e.headers,...$a()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.errorMessage||a?.message||`HTTP ${n.status}`;throw new Error(o)}return a}function Pa(t){const e={"Content-Type":"application/json",...t.headers||{}};return{async listAlerts(s){const n=ze(t.baseUrl,"/api/Alerts"),r=Wt(n,{pageSize:s?.pageSize??10,pageNumber:s?.pageNumber??1}),a=await He(r,{method:"GET",headers:e});return Array.isArray(a)?a:[]},async getAlertStatusList(){const s=ze(t.baseUrl,"/api/Alerts/GetAlertStatus"),n=await He(s,{method:"GET",headers:e});return Array.isArray(n)?n:n&&typeof n=="object"&&Array.isArray(n.data)?n.data:[]},async getAlertsReport(s){const n=ze(t.baseUrl,"/Alerts/GetAlertsReport"),r=Wt(n,s),a=await He(r,{method:"GET",headers:e});return Array.isArray(a)?a:[]},async updateAlertStatus(s){const n=ze(t.baseUrl,"/api/Alerts/UpdateAlertLog"),r={alertId:s.alertId,action:s.status,notes:s.notes};return He(n,{method:"PUT",headers:e,body:JSON.stringify(r??{})})},async getAdminSettings(){const s=ze(t.baseUrl,"/api/Alerts/GetAdminSettings"),n=await He(s,{method:"GET",headers:e});if(n&&typeof n=="object"){if("data"in n)return n.data;if("userId"in n)return n}return null},async setAdminSettings(s){const n=ze(t.baseUrl,"/api/Alerts/SetAdminSettings"),r={userId:0,isAdminSetting:!0,sortBy:s?.sortBy??"",groupBy:s?.groupBy??null};return He(n,{method:"POST",headers:e,body:JSON.stringify(r)})},async getPreferenceSettings(){const s=ze(t.baseUrl,"/api/Alerts/GetPreferenceSettings"),n=await He(s,{method:"GET",headers:e});if(n&&typeof n=="object"){if("data"in n)return n.data;if("anomalyIds"in n)return n}return null},async setPreferenceSettings(s){const n=ze(t.baseUrl,"/api/Alerts/SetPreferenceSettings"),r=await He(n,{method:"POST",headers:e,body:JSON.stringify(s??{})}),a=r?.responseStatus??!0,o=r?.data??r?.message??"Preferences updated successfully.";return{responseStatus:a,errorMessage:a?"":r?.errorMessage??r?.message??"",statusCode:200,data:o}},async getAlertNotifications(s){const n=ze(t.baseUrl,"/api/Alerts/GetNotifications"),r=Wt(n,{alertId:s}),a=await He(r,{method:"GET",headers:e});return Array.isArray(a)?a:a&&typeof a=="object"&&Array.isArray(a.data)?a.data:[]},async sendSMSorEmailNotifications(s,n,r){const a=ze(t.baseUrl,"/api/Alerts/SendSMSorEmailNotifications"),o=Wt(a,{alertId:s,isEmail:n,isSMS:r});return He(o,{method:"POST",headers:e})},async getTimeZoneMasters(){const s=ze(t.baseUrl,"/api/UserPreference/GetTimeZoneMasters"),n=await He(s,{method:"GET",headers:e});return Array.isArray(n)?n:n&&typeof n=="object"&&Array.isArray(n.data)?n.data:[]},async getMyAppPreferences(){const s=ze(t.baseUrl,"/api/UserPreference/GetMyAppPreferences"),n=await He(s,{method:"GET",headers:e});if(n&&typeof n=="object"){const r=n.data??n;if(r?.timeZoneUniqueId)return{timeZoneUniqueId:r.timeZoneUniqueId}}return null}}}const Yn=f.createContext(null);function _n({tenant:t="snl",override:e,timeZone:s,userManagementDomain:n,spacesBaseUrl:r,children:a}){const o=f.useMemo(()=>{const l=e?.alertsBaseUrl?.trim()||an[t]?.alerts||"";let u=e?.rulesBaseUrl?.trim()||an[t]?.rules||"";t==="snl"&&(u=l);const m=e?.headers;return{tenant:t,alertsBaseUrl:l,rulesBaseUrl:u,headers:m,timeZone:s,userManagementDomain:n,spacesBaseUrl:r}},[t,e?.alertsBaseUrl,e?.rulesBaseUrl,JSON.stringify(e?.headers||{}),s,n,r]),c=f.useMemo(()=>{const l={baseUrl:o.alertsBaseUrl,headers:o.headers},u={baseUrl:o.rulesBaseUrl,headers:o.headers},m={schools:()=>Da({...l,spacesBaseUrl:o.spacesBaseUrl}),transit:()=>Pa(l),snl:()=>Aa(l)},h={schools:()=>Ua({...u,userManagementBaseUrl:o.userManagementDomain}),transit:()=>Fa({...u,userManagementBaseUrl:o.userManagementDomain}),snl:()=>Na({baseUrl:o.alertsBaseUrl,headers:o.headers})};return{config:o,alerts:m[o.tenant](),rules:h[o.tenant]()}},[o]);return i.jsx(Yn.Provider,{value:c,children:a})}function Fe(){const t=f.useContext(Yn);if(!t)throw new Error("useApi must be used inside ApiProvider");return t}const Wa={Critical:"#FFE2E2",High:"#FF95004D",Medium:"#FEF9C2",Low:"#E0EDFF"},Va={Critical:"#FF3B30",High:"#FFB86A",Medium:"#FFCC00",Low:"#007AFF"},Ps=6,Ws=7;function un(t,e,s){const n=t===Ps,r=t===Ws,a=e.isEmailSent??!1,o=e.isSMSSent??!1,c=n&&a||r&&o,l=n?"Send Email":r?"Send SMS":s,u=n&&a?"Email sent":r&&o?"SMS sent":l,m=n&&a?"Email sent":r&&o?"SMS sent":`Click to ${l}`;return{isDisabled:c,buttonText:u,tooltipTitle:m}}function Ba(t){const e=new Set;(t||[]).forEach(n=>{const r=n.anomalyName;typeof r=="string"&&r.trim().length>0&&e.add(r.trim())});const s=Array.from(e).map(n=>({label:n,value:n}));return[{label:"All Types",value:"All"},...s]}function Za(t){const e=new Set;(t||[]).forEach(n=>{const r=n.spaceName;typeof r=="string"&&r.trim().length>0&&e.add(r.trim())});const s=Array.from(e).map(n=>({label:n,value:n}));return[{label:"All",value:"All"},...s]}function ys(t,e){return`${t}-${e?"email":"sms"}`}function Vt(t){return t===Ps||t===Ws}function ns({value:t,onChange:e,options:s,className:n,dropdownWidth:r}){return i.jsx(d.Select,{className:n,options:s,value:t,onChange:e,dropdownMatchSelectWidth:r??260})}const za=[{label:"All levels",value:"All"},{label:"Critical",value:"Critical"},{label:"High",value:"High"},{label:"Medium",value:"Medium"},{label:"Low",value:"Low"}];function Ha({value:t,onChange:e,options:s}){return i.jsx(ns,{className:"w-[140px]",value:t,onChange:e,options:s||za})}const qa=[{label:"All Types",value:"All"},{label:"Weapon Detection",value:"Weapon"},{label:"Unauthorized Access",value:"Unauthorized"},{label:"Aggressive Behavior",value:"Aggressive"}];function Ga({value:t,onChange:e,options:s}){return i.jsx(ns,{className:"w-[220px]",dropdownWidth:280,value:t,onChange:e,options:s||qa})}function Ya({value:t,onChange:e,options:s}){return i.jsx(ns,{className:"w-[100px]",value:t,onChange:e,options:s||[]})}const _a=[{label:"All",value:"All"},{label:"SOS",value:"SOS"},{label:"911",value:"911"},{label:"Aegix",value:"Aegix"},{label:"Eli",value:"Eli"},{label:"Skydio",value:"Skydio"}];function Ja({value:t,onChange:e,options:s}){return i.jsx(ns,{className:"w-[130px]",value:t,onChange:e,options:s||_a})}function Jn({columns:t,data:e,loading:s=!1,pageSize:n=10,total:r,currentPage:a,rowKey:o="id",toolbar:c,tableProps:l,onPageChange:u}){const m=r!==void 0;return i.jsxs("div",{children:[c,i.jsx(d.Table,{rowKey:o,dataSource:e,columns:t,loading:s,pagination:{pageSize:n,...m?{total:r,current:a}:{},showSizeChanger:!1,showTotal:h=>`Total: ${h}`,onChange:u},bordered:!0,...l})]})}function Vs({data:t,loading:e=!1,pageSize:s=10,total:n,currentPage:r,columns:a,severityOptions:o,anomalyOptions:c,spaceOptions:l,renderActions:u,onAlertIdClick:m,onRefetch:h,onPageChange:p,onFilterChange:y,excludeCompleted:w=!0}){const[I,j]=f.useState("All"),[z,_]=f.useState("All"),[H,N]=f.useState("All"),[E,P]=f.useState("All"),[O,W]=f.useState(""),[g,v]=f.useState([{label:"All",value:"All"}]),[M,he]=f.useState([]),[ne,C]=f.useState([]),[S,x]=f.useState([]),[b,A]=f.useState(new Set),{rules:D,alerts:R}=Fe(),q={6:{title:"Email",kind:"icon",icon:i.jsx(dt.MailOutlined,{})},7:{title:"SMS",kind:"icon",icon:i.jsx(dt.MessageOutlined,{})}},J=f.useMemo(()=>Ba(t),[t]),te=f.useMemo(()=>Za(t),[t]);f.useEffect(()=>{if(!R.getAllSpaces)return;let G=!0;return(async()=>{try{const L=await R.getAllSpaces();if(G){const Te=L.map(ge=>({label:ge.spaceName,value:String(ge.spaceId)}));he([{label:"All",value:"All"},...Te])}}catch(L){console.error("Error loading space options",L)}})(),()=>{G=!1}},[R]),f.useEffect(()=>{let G=!0;return(async()=>{try{const L=await D.getLookups(),ge=(Array.isArray(L.thirdParties)?L.thirdParties:[]).map(Ne=>({label:Ne.thirdPartyName,value:String(Ne.thirdPartyId)})),je=(Array.isArray(L.anomalies)?L.anomalies:[]).map(Ne=>({label:Ne.anomalyName,value:String(Ne.recordId)})),Ie=(Array.isArray(L.severities)?L.severities:[]).map(Ne=>({label:Ne.severityName,value:String(Ne.severityId)}));G&&(v([{label:"All",value:"All"},...ge]),je.length&&C([{label:"All Types",value:"All"},...je]),Ie.length&&x([{label:"All levels",value:"All"},...Ie]))}catch(L){console.error("Error loading filter options",L)}})(),()=>{G=!1}},[D]);const X=f.useMemo(()=>(t||[]).some(G=>rn(G).length>0),[t]);f.useEffect(()=>{if(!y)return;const G={};ne.length>1&&z!=="All"&&(G.anomalyId=z),M.length>1&&H!=="All"&&(G.spaceId=Number(H)),S.length>1&&I!=="All"&&(G.severityId=Number(I)),E!=="All"&&(G.thirdPartyIds=[Number(E)]),y(G),p?.(1)},[z,H,I,E,ne.length,M.length,S.length]);const le=f.useMemo(()=>{const G=!!y;return(t||[]).filter(L=>{const Te=G||I==="All"||(S.length>1?String(L.severityId)===String(I):L.priority===I),ge=`${L.id} ${L.description} ${L.statusType}`.toLowerCase(),Oe=!O||ge.includes(O.toLowerCase()),je=G||z==="All"||(ne.length>1?String(L.anomalyId)===String(z):(L.anomalyName||"").toLowerCase()===z.toLowerCase()),Be=G||H==="All"||(M.length>1?String(L.spaceId)===String(H):(L.spaceName||"").toLowerCase()===H.toLowerCase()),Ie=G||!X||E==="All"||rn(L).includes(Number(E)),Ne=!w||!["completed","false positive"].includes(String(L.statusType||"").toLowerCase());return Te&&Oe&&je&&Be&&Ie&&Ne})},[t,I,O,z,H,E,X,w,M,ne,S,y]),we=c?.length?c:J,ie=ne.length>1?ne:we,ye=l?.length?l:te,Ae=M.length>1?M:ye,ue=S.length>1?S:o,de=[{title:"Severity",dataIndex:"priority",key:"priority",width:120,render:G=>i.jsx(d.Tag,{className:"px-[10px] py-[2px]",style:{border:`2px solid ${Va[G]}`,backgroundColor:Wa[G]},children:G})},{title:"Tracker",key:"tracker",width:140,render:(G,L)=>i.jsx("a",{onClick:Te=>{Te.preventDefault(),m?.(L,{tab:"track",sourceTab:"active"})},className:"text-blue-600 hover:underline",children:"Tracker"})},{title:"Call to action/Human in the loop",key:"actions",width:320,render:(G,L)=>{if(u)return i.jsx(i.Fragment,{children:u(L)});const Te=async(ke,oe)=>{const $e=ys(L.id,ke);A(fe=>new Set(fe).add($e));try{const fe=await R.sendSMSorEmailNotifications?.(L.id,ke,oe);fe?.responseStatus||fe?.Success||fe?.success?(be.toast.success(fe?.message||fe.data||(ke?"Email sent successfully":"SMS sent successfully")),h?.()):be.toast.error(fe?.message||fe?.data||fe?.errorMessage||"Failed to send notification")}catch(fe){be.toast.error(fe?.message||"Failed to send notification")}finally{A(fe=>{const Ze=new Set(fe);return Ze.delete($e),Ze})}},ge=Ps,Oe=Ws,je=q[ge],Be=q[Oe],Ie=un(ge,L,je?.title),Ne=un(Oe,L,Be?.title),k=ys(L.id,!0),B=ys(L.id,!1),Y=Vt(ge)&&b.has(k),pe=Vt(Oe)&&b.has(B);return i.jsxs(d.Space,{size:"middle",children:[i.jsx(d.Tooltip,{title:Ie.tooltipTitle,children:i.jsx(d.Button,{size:"small",disabled:Ie.isDisabled,loading:Y,onClick:Vt(ge)?()=>Te(!0,!1):void 0,icon:!Y&&je?.icon,className:"flex flex-col items-center justify-center gap-1",style:{height:"fit-content"},children:Ie.buttonText})},String(ge)),i.jsx(d.Tooltip,{title:Ne.tooltipTitle,children:i.jsx(d.Button,{size:"small",disabled:Ne.isDisabled,loading:pe,onClick:Vt(Oe)?()=>Te(!1,!0):void 0,icon:!pe&&Be?.icon,className:"flex flex-col items-center justify-center gap-1",style:{height:"fit-content"},children:Ne.buttonText})},String(Oe))]})}},{title:"Alert Timestamp",dataIndex:"timestamp",key:"timestamp",width:220,render:(G,L)=>{const Te=L?.timeElapsed,ge=L?.timeRemaining,Oe=Te?nn(Te):0,je=ge?nn(ge):0,Be=Math.round(Oe/(Oe+je)*100);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-[70px]",children:"Elapsed:"}),i.jsx("span",{className:"font-medium",children:Te??"-"})]}),i.jsx(d.Progress,{percent:Be,showInfo:!1,size:"small",strokeColor:ya(L.priority)}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-[70px]",children:"Remaining"}),i.jsx("span",{className:"font-medium",children:ge??"-"})]})]})}},{title:"Status",dataIndex:"statusType",key:"statusType",width:140},{title:"Description",dataIndex:"description",key:"description",render:(G,L)=>i.jsxs("div",{children:[i.jsx("a",{onClick:Te=>{Te.preventDefault(),m?.(L,{sourceTab:"active"})},className:"inline-block mb-1 text-blue-600",children:L.alertNumber}),i.jsx("div",{className:"text-black/65",children:G})]})}],Re=a&&a.length?a:de;return i.jsx("div",{children:i.jsx(Jn,{rowKey:"id",data:le,columns:Re,loading:e,pageSize:s,total:n,currentPage:r,onPageChange:p,toolbar:i.jsxs(d.Row,{gutter:[12,12],className:"mb-3",align:"middle",children:[i.jsx(d.Col,{flex:"none",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:"Severity"}),i.jsx(Ha,{value:I,onChange:j,options:ue})]})}),i.jsx(d.Col,{flex:"none",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:"Anomaly type"}),i.jsx(Ga,{value:z,onChange:_,options:ie})]})}),i.jsx(d.Col,{flex:"none",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:"Space"}),i.jsx(Ya,{value:H,onChange:N,options:Ae})]})}),i.jsx(d.Col,{flex:"none",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:"Action Taken"}),i.jsx(Ja,{value:E,onChange:P,options:g})]})}),i.jsx(d.Col,{flex:"auto"}),i.jsx(d.Col,{flex:"none",children:i.jsx(d.Input.Search,{allowClear:!0,placeholder:"Search",onSearch:W,onChange:G=>W(G.target.value),className:"w-[260px] ",enterButton:!0})})]})})})}function Bs(){const{alerts:t}=Fe(),e=mt.useQueryClient();return mt.useMutation({mutationFn:s=>t.updateAlertStatus(s),onSuccess:()=>{e.invalidateQueries({queryKey:["alerts","list"]}),e.invalidateQueries({queryKey:["alerts","report"]})}})}class ft extends Error{}class Qa extends ft{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Ka extends ft{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Xa extends ft{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class pt extends ft{}class Qn extends ft{constructor(e){super(`Invalid unit ${e}`)}}class Me extends ft{}class rt extends ft{constructor(){super("Zone is an abstract class")}}const T="numeric",Ke="short",Ve="long",Kt={year:T,month:T,day:T},Kn={year:T,month:Ke,day:T},ei={year:T,month:Ke,day:T,weekday:Ke},Xn={year:T,month:Ve,day:T},er={year:T,month:Ve,day:T,weekday:Ve},tr={hour:T,minute:T},sr={hour:T,minute:T,second:T},nr={hour:T,minute:T,second:T,timeZoneName:Ke},rr={hour:T,minute:T,second:T,timeZoneName:Ve},ar={hour:T,minute:T,hourCycle:"h23"},ir={hour:T,minute:T,second:T,hourCycle:"h23"},or={hour:T,minute:T,second:T,hourCycle:"h23",timeZoneName:Ke},lr={hour:T,minute:T,second:T,hourCycle:"h23",timeZoneName:Ve},cr={year:T,month:T,day:T,hour:T,minute:T},ur={year:T,month:T,day:T,hour:T,minute:T,second:T},dr={year:T,month:Ke,day:T,hour:T,minute:T},mr={year:T,month:Ke,day:T,hour:T,minute:T,second:T},ti={year:T,month:Ke,day:T,weekday:Ke,hour:T,minute:T},fr={year:T,month:Ve,day:T,hour:T,minute:T,timeZoneName:Ke},hr={year:T,month:Ve,day:T,hour:T,minute:T,second:T,timeZoneName:Ke},yr={year:T,month:Ve,day:T,weekday:Ve,hour:T,minute:T,timeZoneName:Ve},gr={year:T,month:Ve,day:T,weekday:Ve,hour:T,minute:T,second:T,timeZoneName:Ve};class Ct{get type(){throw new rt}get name(){throw new rt}get ianaName(){return this.name}get isUniversal(){throw new rt}offsetName(e,s){throw new rt}formatOffset(e,s){throw new rt}offset(e){throw new rt}equals(e){throw new rt}get isValid(){throw new rt}}let gs=null;class rs extends Ct{static get instance(){return gs===null&&(gs=new rs),gs}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:s,locale:n}){return Ir(e,s,n)}formatOffset(e,s){return Ot(this.offset(e),s)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const Is=new Map;function si(t){let e=Is.get(t);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Is.set(t,e)),e}const ni={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function ri(t,e){const s=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(s),[,r,a,o,c,l,u,m]=n;return[o,r,a,c,l,u,m]}function ai(t,e){const s=t.formatToParts(e),n=[];for(let r=0;r<s.length;r++){const{type:a,value:o}=s[r],c=ni[a];a==="era"?n[c]=o:$(c)||(n[c]=parseInt(o,10))}return n}const ps=new Map;class st extends Ct{static create(e){let s=ps.get(e);return s===void 0&&ps.set(e,s=new st(e)),s}static resetCache(){ps.clear(),Is.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=st.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:s,locale:n}){return Ir(e,s,n,this.name)}formatOffset(e,s){return Ot(this.offset(e),s)}offset(e){if(!this.valid)return NaN;const s=new Date(e);if(isNaN(s))return NaN;const n=si(this.name);let[r,a,o,c,l,u,m]=n.formatToParts?ai(n,s):ri(n,s);c==="BC"&&(r=-Math.abs(r)+1);const p=is({year:r,month:a,day:o,hour:l===24?0:l,minute:u,second:m,millisecond:0});let y=+s;const w=y%1e3;return y-=w>=0?w:1e3+w,(p-y)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let dn={};function ii(t,e={}){const s=JSON.stringify([t,e]);let n=dn[s];return n||(n=new Intl.ListFormat(t,e),dn[s]=n),n}const Ms=new Map;function Es(t,e={}){const s=JSON.stringify([t,e]);let n=Ms.get(s);return n===void 0&&(n=new Intl.DateTimeFormat(t,e),Ms.set(s,n)),n}const Os=new Map;function oi(t,e={}){const s=JSON.stringify([t,e]);let n=Os.get(s);return n===void 0&&(n=new Intl.NumberFormat(t,e),Os.set(s,n)),n}const js=new Map;function li(t,e={}){const{base:s,...n}=e,r=JSON.stringify([t,n]);let a=js.get(r);return a===void 0&&(a=new Intl.RelativeTimeFormat(t,e),js.set(r,a)),a}let It=null;function ci(){return It||(It=new Intl.DateTimeFormat().resolvedOptions().locale,It)}const Cs=new Map;function pr(t){let e=Cs.get(t);return e===void 0&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),Cs.set(t,e)),e}const Ds=new Map;function ui(t){let e=Ds.get(t);if(!e){const s=new Intl.Locale(t);e="getWeekInfo"in s?s.getWeekInfo():s.weekInfo,"minimalDays"in e||(e={...Sr,...e}),Ds.set(t,e)}return e}function di(t){const e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));const s=t.indexOf("-u-");if(s===-1)return[t];{let n,r;try{n=Es(t).resolvedOptions(),r=t}catch{const l=t.substring(0,s);n=Es(l).resolvedOptions(),r=l}const{numberingSystem:a,calendar:o}=n;return[r,a,o]}}function mi(t,e,s){return(s||e)&&(t.includes("-u-")||(t+="-u"),s&&(t+=`-ca-${s}`),e&&(t+=`-nu-${e}`)),t}function fi(t){const e=[];for(let s=1;s<=12;s++){const n=F.utc(2009,s,1);e.push(t(n))}return e}function hi(t){const e=[];for(let s=1;s<=7;s++){const n=F.utc(2016,11,13+s);e.push(t(n))}return e}function Bt(t,e,s,n){const r=t.listingMode();return r==="error"?null:r==="en"?s(e):n(e)}function yi(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||pr(t.locale).numberingSystem==="latn"}class gi{constructor(e,s,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:a,...o}=n;if(!s||Object.keys(o).length>0){const c={useGrouping:!1,...n};n.padTo>0&&(c.minimumIntegerDigits=n.padTo),this.inf=oi(e,c)}}format(e){if(this.inf){const s=this.floor?Math.floor(e):e;return this.inf.format(s)}else{const s=this.floor?Math.floor(e):Gs(e,3);return ve(s,this.padTo)}}}class pi{constructor(e,s,n){this.opts=n,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),c=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&st.create(c).valid?(r=c,this.dt=e):(r="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const a={...this.opts};a.timeZone=a.timeZone||r,this.dtf=Es(s,a)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(s=>{if(s.type==="timeZoneName"){const n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...s,value:n}}else return s}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Si{constructor(e,s,n){this.opts={style:"long",...n},!s&&br()&&(this.rtf=li(e,n))}format(e,s){return this.rtf?this.rtf.format(e,s):Wi(s,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,s){return this.rtf?this.rtf.formatToParts(e,s):[]}}const Sr={firstDay:1,minimalDays:4,weekend:[6,7]};class se{static fromOpts(e){return se.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,s,n,r,a=!1){const o=e||xe.defaultLocale,c=o||(a?"en-US":ci()),l=s||xe.defaultNumberingSystem,u=n||xe.defaultOutputCalendar,m=Us(r)||xe.defaultWeekSettings;return new se(c,l,u,m,o)}static resetCache(){It=null,Ms.clear(),Os.clear(),js.clear(),Cs.clear(),Ds.clear()}static fromObject({locale:e,numberingSystem:s,outputCalendar:n,weekSettings:r}={}){return se.create(e,s,n,r)}constructor(e,s,n,r,a){const[o,c,l]=di(e);this.locale=o,this.numberingSystem=s||c||null,this.outputCalendar=n||l||null,this.weekSettings=r,this.intl=mi(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=a,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=yi(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),s=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&s?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:se.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Us(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,s=!1){return Bt(this,e,Or,()=>{const n=this.intl==="ja"||this.intl.startsWith("ja-");s&=!n;const r=s?{month:e,day:"numeric"}:{month:e},a=s?"format":"standalone";if(!this.monthsCache[a][e]){const o=n?c=>this.dtFormatter(c,r).format():c=>this.extract(c,r,"month");this.monthsCache[a][e]=fi(o)}return this.monthsCache[a][e]})}weekdays(e,s=!1){return Bt(this,e,Dr,()=>{const n=s?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=s?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=hi(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return Bt(this,void 0,()=>Rr,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[F.utc(2016,11,13,9),F.utc(2016,11,13,19)].map(s=>this.extract(s,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Bt(this,e,Ur,()=>{const s={era:e};return this.eraCache[e]||(this.eraCache[e]=[F.utc(-40,1,1),F.utc(2017,1,1)].map(n=>this.extract(n,s,"era"))),this.eraCache[e]})}extract(e,s,n){const r=this.dtFormatter(e,s),a=r.formatToParts(),o=a.find(c=>c.type.toLowerCase()===n);return o?o.value:null}numberFormatter(e={}){return new gi(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,s={}){return new pi(e,this.intl,s)}relFormatter(e={}){return new Si(this.intl,this.isEnglish(),e)}listFormatter(e={}){return ii(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||pr(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:kr()?ui(this.locale):Sr}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Ss=null;class De extends Ct{static get utcInstance(){return Ss===null&&(Ss=new De(0)),Ss}static instance(e){return e===0?De.utcInstance:new De(e)}static parseSpecifier(e){if(e){const s=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(s)return new De(os(s[1],s[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Ot(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Ot(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,s){return Ot(this.fixed,s)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class xi extends Ct{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function it(t,e){if($(t)||t===null)return e;if(t instanceof Ct)return t;if(bi(t)){const s=t.toLowerCase();return s==="default"?e:s==="local"||s==="system"?rs.instance:s==="utc"||s==="gmt"?De.utcInstance:De.parseSpecifier(s)||st.create(t)}else return ot(t)?De.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new xi(t)}const Zs={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},mn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},wi=Zs.hanidec.replace(/[\[|\]]/g,"").split("");function vi(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let s=0;s<t.length;s++){const n=t.charCodeAt(s);if(t[s].search(Zs.hanidec)!==-1)e+=wi.indexOf(t[s]);else for(const r in mn){const[a,o]=mn[r];n>=a&&n<=o&&(e+=n-a)}}return parseInt(e,10)}else return e}const Rs=new Map;function Ai(){Rs.clear()}function _e({numberingSystem:t},e=""){const s=t||"latn";let n=Rs.get(s);n===void 0&&(n=new Map,Rs.set(s,n));let r=n.get(e);return r===void 0&&(r=new RegExp(`${Zs[s]}${e}`),n.set(e,r)),r}let fn=()=>Date.now(),hn="system",yn=null,gn=null,pn=null,Sn=60,xn,wn=null;class xe{static get now(){return fn}static set now(e){fn=e}static set defaultZone(e){hn=e}static get defaultZone(){return it(hn,rs.instance)}static get defaultLocale(){return yn}static set defaultLocale(e){yn=e}static get defaultNumberingSystem(){return gn}static set defaultNumberingSystem(e){gn=e}static get defaultOutputCalendar(){return pn}static set defaultOutputCalendar(e){pn=e}static get defaultWeekSettings(){return wn}static set defaultWeekSettings(e){wn=Us(e)}static get twoDigitCutoffYear(){return Sn}static set twoDigitCutoffYear(e){Sn=e%100}static get throwOnInvalid(){return xn}static set throwOnInvalid(e){xn=e}static resetCaches(){se.resetCache(),st.resetCache(),F.resetCache(),Ai()}}class Qe{constructor(e,s){this.reason=e,this.explanation=s}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const xr=[0,31,59,90,120,151,181,212,243,273,304,334],wr=[0,31,60,91,121,152,182,213,244,274,305,335];function Ge(t,e){return new Qe("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function zs(t,e,s){const n=new Date(Date.UTC(t,e-1,s));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const r=n.getUTCDay();return r===0?7:r}function vr(t,e,s){return s+(Dt(t)?wr:xr)[e-1]}function Ar(t,e){const s=Dt(t)?wr:xr,n=s.findIndex(a=>a<e),r=e-s[n];return{month:n+1,day:r}}function Hs(t,e){return(t-e+7)%7+1}function Xt(t,e=4,s=1){const{year:n,month:r,day:a}=t,o=vr(n,r,a),c=Hs(zs(n,r,a),s);let l=Math.floor((o-c+14-e)/7),u;return l<1?(u=n-1,l=jt(u,e,s)):l>jt(n,e,s)?(u=n+1,l=1):u=n,{weekYear:u,weekNumber:l,weekday:c,...ls(t)}}function vn(t,e=4,s=1){const{weekYear:n,weekNumber:r,weekday:a}=t,o=Hs(zs(n,1,e),s),c=St(n);let l=r*7+a-o-7+e,u;l<1?(u=n-1,l+=St(u)):l>c?(u=n+1,l-=St(n)):u=n;const{month:m,day:h}=Ar(u,l);return{year:u,month:m,day:h,...ls(t)}}function xs(t){const{year:e,month:s,day:n}=t,r=vr(e,s,n);return{year:e,ordinal:r,...ls(t)}}function An(t){const{year:e,ordinal:s}=t,{month:n,day:r}=Ar(e,s);return{year:e,month:n,day:r,...ls(t)}}function Tn(t,e){if(!$(t.localWeekday)||!$(t.localWeekNumber)||!$(t.localWeekYear)){if(!$(t.weekday)||!$(t.weekNumber)||!$(t.weekYear))throw new pt("Cannot mix locale-based week fields with ISO-based week fields");return $(t.localWeekday)||(t.weekday=t.localWeekday),$(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),$(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Ti(t,e=4,s=1){const n=as(t.weekYear),r=Ye(t.weekNumber,1,jt(t.weekYear,e,s)),a=Ye(t.weekday,1,7);return n?r?a?!1:Ge("weekday",t.weekday):Ge("week",t.weekNumber):Ge("weekYear",t.weekYear)}function Ni(t){const e=as(t.year),s=Ye(t.ordinal,1,St(t.year));return e?s?!1:Ge("ordinal",t.ordinal):Ge("year",t.year)}function Tr(t){const e=as(t.year),s=Ye(t.month,1,12),n=Ye(t.day,1,es(t.year,t.month));return e?s?n?!1:Ge("day",t.day):Ge("month",t.month):Ge("year",t.year)}function Nr(t){const{hour:e,minute:s,second:n,millisecond:r}=t,a=Ye(e,0,23)||e===24&&s===0&&n===0&&r===0,o=Ye(s,0,59),c=Ye(n,0,59),l=Ye(r,0,999);return a?o?c?l?!1:Ge("millisecond",r):Ge("second",n):Ge("minute",s):Ge("hour",e)}function $(t){return typeof t>"u"}function ot(t){return typeof t=="number"}function as(t){return typeof t=="number"&&t%1===0}function bi(t){return typeof t=="string"}function ki(t){return Object.prototype.toString.call(t)==="[object Date]"}function br(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function kr(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Ii(t){return Array.isArray(t)?t:[t]}function Nn(t,e,s){if(t.length!==0)return t.reduce((n,r)=>{const a=[e(r),r];return n&&s(n[0],a[0])===n[0]?n:a},null)[1]}function Mi(t,e){return e.reduce((s,n)=>(s[n]=t[n],s),{})}function wt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Us(t){if(t==null)return null;if(typeof t!="object")throw new Me("Week settings must be an object");if(!Ye(t.firstDay,1,7)||!Ye(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Ye(e,1,7)))throw new Me("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Ye(t,e,s){return as(t)&&t>=e&&t<=s}function Ei(t,e){return t-e*Math.floor(t/e)}function ve(t,e=2){const s=t<0;let n;return s?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function at(t){if(!($(t)||t===null||t===""))return parseInt(t,10)}function lt(t){if(!($(t)||t===null||t===""))return parseFloat(t)}function qs(t){if(!($(t)||t===null||t==="")){const e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function Gs(t,e,s="round"){const n=10**e;switch(s){case"expand":return t>0?Math.ceil(t*n)/n:Math.floor(t*n)/n;case"trunc":return Math.trunc(t*n)/n;case"round":return Math.round(t*n)/n;case"floor":return Math.floor(t*n)/n;case"ceil":return Math.ceil(t*n)/n;default:throw new RangeError(`Value rounding ${s} is out of range`)}}function Dt(t){return t%4===0&&(t%100!==0||t%400===0)}function St(t){return Dt(t)?366:365}function es(t,e){const s=Ei(e-1,12)+1,n=t+(e-s)/12;return s===2?Dt(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][s-1]}function is(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function bn(t,e,s){return-Hs(zs(t,1,e),s)+e-1}function jt(t,e=4,s=1){const n=bn(t,e,s),r=bn(t+1,e,s);return(St(t)-n+r)/7}function Ls(t){return t>99?t:t>xe.twoDigitCutoffYear?1900+t:2e3+t}function Ir(t,e,s,n=null){const r=new Date(t),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);const o={timeZoneName:e,...a},c=new Intl.DateTimeFormat(s,o).formatToParts(r).find(l=>l.type.toLowerCase()==="timezonename");return c?c.value:null}function os(t,e){let s=parseInt(t,10);Number.isNaN(s)&&(s=0);const n=parseInt(e,10)||0,r=s<0||Object.is(s,-0)?-n:n;return s*60+r}function Mr(t){const e=Number(t);if(typeof t=="boolean"||t===""||!Number.isFinite(e))throw new Me(`Invalid unit value ${t}`);return e}function ts(t,e){const s={};for(const n in t)if(wt(t,n)){const r=t[n];if(r==null)continue;s[e(n)]=Mr(r)}return s}function Ot(t,e){const s=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),r=t>=0?"+":"-";switch(e){case"short":return`${r}${ve(s,2)}:${ve(n,2)}`;case"narrow":return`${r}${s}${n>0?`:${n}`:""}`;case"techie":return`${r}${ve(s,2)}${ve(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function ls(t){return Mi(t,["hour","minute","second","millisecond"])}const Oi=["January","February","March","April","May","June","July","August","September","October","November","December"],Er=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ji=["J","F","M","A","M","J","J","A","S","O","N","D"];function Or(t){switch(t){case"narrow":return[...ji];case"short":return[...Er];case"long":return[...Oi];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const jr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Cr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ci=["M","T","W","T","F","S","S"];function Dr(t){switch(t){case"narrow":return[...Ci];case"short":return[...Cr];case"long":return[...jr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Rr=["AM","PM"],Di=["Before Christ","Anno Domini"],Ri=["BC","AD"],Ui=["B","A"];function Ur(t){switch(t){case"narrow":return[...Ui];case"short":return[...Ri];case"long":return[...Di];default:return null}}function Li(t){return Rr[t.hour<12?0:1]}function Fi(t,e){return Dr(e)[t.weekday-1]}function $i(t,e){return Or(e)[t.month-1]}function Pi(t,e){return Ur(e)[t.year<0?0:1]}function Wi(t,e,s="always",n=!1){const r={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(t)===-1;if(s==="auto"&&a){const h=t==="days";switch(e){case 1:return h?"tomorrow":`next ${r[t][0]}`;case-1:return h?"yesterday":`last ${r[t][0]}`;case 0:return h?"today":`this ${r[t][0]}`}}const o=Object.is(e,-0)||e<0,c=Math.abs(e),l=c===1,u=r[t],m=n?l?u[1]:u[2]||u[1]:l?r[t][0]:t;return o?`${c} ${m} ago`:`in ${c} ${m}`}function kn(t,e){let s="";for(const n of t)n.literal?s+=n.val:s+=e(n.val);return s}const Vi={D:Kt,DD:Kn,DDD:Xn,DDDD:er,t:tr,tt:sr,ttt:nr,tttt:rr,T:ar,TT:ir,TTT:or,TTTT:lr,f:cr,ff:dr,fff:fr,ffff:yr,F:ur,FF:mr,FFF:hr,FFFF:gr};class Ee{static create(e,s={}){return new Ee(e,s)}static parseFormat(e){let s=null,n="",r=!1;const a=[];for(let o=0;o<e.length;o++){const c=e.charAt(o);c==="'"?((n.length>0||r)&&a.push({literal:r||/^\s+$/.test(n),val:n===""?"'":n}),s=null,n="",r=!r):r||c===s?n+=c:(n.length>0&&a.push({literal:/^\s+$/.test(n),val:n}),n=c,s=c)}return n.length>0&&a.push({literal:r||/^\s+$/.test(n),val:n}),a}static macroTokenToFormatOpts(e){return Vi[e]}constructor(e,s){this.opts=s,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,s){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...s}).format()}dtFormatter(e,s={}){return this.loc.dtFormatter(e,{...this.opts,...s})}formatDateTime(e,s){return this.dtFormatter(e,s).format()}formatDateTimeParts(e,s){return this.dtFormatter(e,s).formatToParts()}formatInterval(e,s){return this.dtFormatter(e.start,s).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,s){return this.dtFormatter(e,s).resolvedOptions()}num(e,s=0,n=void 0){if(this.opts.forceSimple)return ve(e,s);const r={...this.opts};return s>0&&(r.padTo=s),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,s){const n=this.loc.listingMode()==="en",r=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(y,w)=>this.loc.extract(e,y,w),o=y=>e.isOffsetFixed&&e.offset===0&&y.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,y.format):"",c=()=>n?Li(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(y,w)=>n?$i(e,y):a(w?{month:y}:{month:y,day:"numeric"},"month"),u=(y,w)=>n?Fi(e,y):a(w?{weekday:y}:{weekday:y,month:"long",day:"numeric"},"weekday"),m=y=>{const w=Ee.macroTokenToFormatOpts(y);return w?this.formatWithSystemDefault(e,w):y},h=y=>n?Pi(e,y):a({era:y},"era"),p=y=>{switch(y){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return c();case"d":return r?a({day:"numeric"},"day"):this.num(e.day);case"dd":return r?a({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return r?a({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return r?a({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return r?a({month:"numeric"},"month"):this.num(e.month);case"MM":return r?a({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return r?a({year:"numeric"},"year"):this.num(e.year);case"yy":return r?a({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?a({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?a({year:"numeric"},"year"):this.num(e.year,6);case"G":return h("short");case"GG":return h("long");case"GGGGG":return h("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return m(y)}};return kn(Ee.parseFormat(s),p)}formatDurationFromString(e,s){const n=this.opts.signMode==="negativeLargestOnly"?-1:1,r=m=>{switch(m[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},a=(m,h)=>p=>{const y=r(p);if(y){const w=h.isNegativeDuration&&y!==h.largestUnit?n:1;let I;return this.opts.signMode==="negativeLargestOnly"&&y!==h.largestUnit?I="never":this.opts.signMode==="all"?I="always":I="auto",this.num(m.get(y)*w,p.length,I)}else return p},o=Ee.parseFormat(s),c=o.reduce((m,{literal:h,val:p})=>h?m:m.concat(p),[]),l=e.shiftTo(...c.map(r).filter(m=>m)),u={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return kn(o,a(l,u))}}const Lr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function vt(...t){const e=t.reduce((s,n)=>s+n.source,"");return RegExp(`^${e}$`)}function At(...t){return e=>t.reduce(([s,n,r],a)=>{const[o,c,l]=a(e,r);return[{...s,...o},c||n,l]},[{},null,1]).slice(0,2)}function Tt(t,...e){if(t==null)return[null,null];for(const[s,n]of e){const r=s.exec(t);if(r)return n(r)}return[null,null]}function Fr(...t){return(e,s)=>{const n={};let r;for(r=0;r<t.length;r++)n[t[r]]=at(e[s+r]);return[n,null,s+r]}}const $r=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Bi=`(?:${$r.source}?(?:\\[(${Lr.source})\\])?)?`,Ys=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Pr=RegExp(`${Ys.source}${Bi}`),_s=RegExp(`(?:[Tt]${Pr.source})?`),Zi=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,zi=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Hi=/(\d{4})-?(\d{3})/,qi=Fr("weekYear","weekNumber","weekDay"),Gi=Fr("year","ordinal"),Yi=/(\d{4})-(\d\d)-(\d\d)/,Wr=RegExp(`${Ys.source} ?(?:${$r.source}|(${Lr.source}))?`),_i=RegExp(`(?: ${Wr.source})?`);function xt(t,e,s){const n=t[e];return $(n)?s:at(n)}function Ji(t,e){return[{year:xt(t,e),month:xt(t,e+1,1),day:xt(t,e+2,1)},null,e+3]}function Nt(t,e){return[{hours:xt(t,e,0),minutes:xt(t,e+1,0),seconds:xt(t,e+2,0),milliseconds:qs(t[e+3])},null,e+4]}function Rt(t,e){const s=!t[e]&&!t[e+1],n=os(t[e+1],t[e+2]),r=s?null:De.instance(n);return[{},r,e+3]}function Ut(t,e){const s=t[e]?st.create(t[e]):null;return[{},s,e+1]}const Qi=RegExp(`^T?${Ys.source}$`),Ki=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Xi(t){const[e,s,n,r,a,o,c,l,u]=t,m=e[0]==="-",h=l&&l[0]==="-",p=(y,w=!1)=>y!==void 0&&(w||y&&m)?-y:y;return[{years:p(lt(s)),months:p(lt(n)),weeks:p(lt(r)),days:p(lt(a)),hours:p(lt(o)),minutes:p(lt(c)),seconds:p(lt(l),l==="-0"),milliseconds:p(qs(u),h)}]}const eo={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Js(t,e,s,n,r,a,o){const c={year:e.length===2?Ls(at(e)):at(e),month:Er.indexOf(s)+1,day:at(n),hour:at(r),minute:at(a)};return o&&(c.second=at(o)),t&&(c.weekday=t.length>3?jr.indexOf(t)+1:Cr.indexOf(t)+1),c}const to=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function so(t){const[,e,s,n,r,a,o,c,l,u,m,h]=t,p=Js(e,r,n,s,a,o,c);let y;return l?y=eo[l]:u?y=0:y=os(m,h),[p,new De(y)]}function no(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const ro=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,ao=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,io=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function In(t){const[,e,s,n,r,a,o,c]=t;return[Js(e,r,n,s,a,o,c),De.utcInstance]}function oo(t){const[,e,s,n,r,a,o,c]=t;return[Js(e,c,s,n,r,a,o),De.utcInstance]}const lo=vt(Zi,_s),co=vt(zi,_s),uo=vt(Hi,_s),mo=vt(Pr),Vr=At(Ji,Nt,Rt,Ut),fo=At(qi,Nt,Rt,Ut),ho=At(Gi,Nt,Rt,Ut),yo=At(Nt,Rt,Ut);function go(t){return Tt(t,[lo,Vr],[co,fo],[uo,ho],[mo,yo])}function po(t){return Tt(no(t),[to,so])}function So(t){return Tt(t,[ro,In],[ao,In],[io,oo])}function xo(t){return Tt(t,[Ki,Xi])}const wo=At(Nt);function vo(t){return Tt(t,[Qi,wo])}const Ao=vt(Yi,_i),To=vt(Wr),No=At(Nt,Rt,Ut);function bo(t){return Tt(t,[Ao,Vr],[To,No])}const Mn="Invalid Duration",Br={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},ko={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...Br},qe=146097/400,ht=146097/4800,Io={years:{quarters:4,months:12,weeks:qe/7,days:qe,hours:qe*24,minutes:qe*24*60,seconds:qe*24*60*60,milliseconds:qe*24*60*60*1e3},quarters:{months:3,weeks:qe/28,days:qe/4,hours:qe*24/4,minutes:qe*24*60/4,seconds:qe*24*60*60/4,milliseconds:qe*24*60*60*1e3/4},months:{weeks:ht/7,days:ht,hours:ht*24,minutes:ht*24*60,seconds:ht*24*60*60,milliseconds:ht*24*60*60*1e3},...Br},ut=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Mo=ut.slice(0).reverse();function et(t,e,s=!1){const n={values:s?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new K(n)}function Zr(t,e){let s=e.milliseconds??0;for(const n of Mo.slice(1))e[n]&&(s+=e[n]*t[n].milliseconds);return s}function En(t,e){const s=Zr(t,e)<0?-1:1;ut.reduceRight((n,r)=>{if($(e[r]))return n;if(n){const a=e[n]*s,o=t[r][n],c=Math.floor(a/o);e[r]+=c*s,e[n]-=c*o*s}return r},null),ut.reduce((n,r)=>{if($(e[r]))return n;if(n){const a=e[n]%1;e[n]-=a,e[r]+=a*t[n][r]}return r},null)}function On(t){const e={};for(const[s,n]of Object.entries(t))n!==0&&(e[s]=n);return e}class K{constructor(e){const s=e.conversionAccuracy==="longterm"||!1;let n=s?Io:ko;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||se.create(),this.conversionAccuracy=s?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,s){return K.fromObject({milliseconds:e},s)}static fromObject(e,s={}){if(e==null||typeof e!="object")throw new Me(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new K({values:ts(e,K.normalizeUnit),loc:se.fromObject(s),conversionAccuracy:s.conversionAccuracy,matrix:s.matrix})}static fromDurationLike(e){if(ot(e))return K.fromMillis(e);if(K.isDuration(e))return e;if(typeof e=="object")return K.fromObject(e);throw new Me(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,s){const[n]=xo(e);return n?K.fromObject(n,s):K.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,s){const[n]=vo(e);return n?K.fromObject(n,s):K.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,s=null){if(!e)throw new Me("need to specify a reason the Duration is invalid");const n=e instanceof Qe?e:new Qe(e,s);if(xe.throwOnInvalid)throw new Xa(n);return new K({invalid:n})}static normalizeUnit(e){const s={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!s)throw new Qn(e);return s}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,s={}){const n={...s,floor:s.round!==!1&&s.floor!==!1};return this.isValid?Ee.create(this.loc,n).formatDurationFromString(this,e):Mn}toHuman(e={}){if(!this.isValid)return Mn;const s=e.showZeros!==!1,n=ut.map(r=>{const a=this.values[r];return $(a)||a===0&&!s?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(a)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Gs(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const s=this.toMillis();return s<0||s>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},F.fromMillis(s,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Zr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const s=K.fromDurationLike(e),n={};for(const r of ut)(wt(s.values,r)||wt(this.values,r))&&(n[r]=s.get(r)+this.get(r));return et(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const s=K.fromDurationLike(e);return this.plus(s.negate())}mapUnits(e){if(!this.isValid)return this;const s={};for(const n of Object.keys(this.values))s[n]=Mr(e(this.values[n],n));return et(this,{values:s},!0)}get(e){return this[K.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const s={...this.values,...ts(e,K.normalizeUnit)};return et(this,{values:s})}reconfigure({locale:e,numberingSystem:s,conversionAccuracy:n,matrix:r}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:s}),matrix:r,conversionAccuracy:n};return et(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return En(this.matrix,e),et(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=On(this.normalize().shiftToAll().toObject());return et(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>K.normalizeUnit(o));const s={},n={},r=this.toObject();let a;for(const o of ut)if(e.indexOf(o)>=0){a=o;let c=0;for(const u in n)c+=this.matrix[u][o]*n[u],n[u]=0;ot(r[o])&&(c+=r[o]);const l=Math.trunc(c);s[o]=l,n[o]=(c*1e3-l*1e3)/1e3}else ot(r[o])&&(n[o]=r[o]);for(const o in n)n[o]!==0&&(s[a]+=o===a?n[o]:n[o]/this.matrix[a][o]);return En(this.matrix,s),et(this,{values:s},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const s of Object.keys(this.values))e[s]=this.values[s]===0?0:-this.values[s];return et(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=On(this.values);return et(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function s(n,r){return n===void 0||n===0?r===void 0||r===0:n===r}for(const n of ut)if(!s(this.values[n],e.values[n]))return!1;return!0}}const yt="Invalid Interval";function Eo(t,e){return!t||!t.isValid?Se.invalid("missing or invalid start"):!e||!e.isValid?Se.invalid("missing or invalid end"):e<t?Se.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}class Se{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,s=null){if(!e)throw new Me("need to specify a reason the Interval is invalid");const n=e instanceof Qe?e:new Qe(e,s);if(xe.throwOnInvalid)throw new Ka(n);return new Se({invalid:n})}static fromDateTimes(e,s){const n=bt(e),r=bt(s),a=Eo(n,r);return a??new Se({start:n,end:r})}static after(e,s){const n=K.fromDurationLike(s),r=bt(e);return Se.fromDateTimes(r,r.plus(n))}static before(e,s){const n=K.fromDurationLike(s),r=bt(e);return Se.fromDateTimes(r.minus(n),r)}static fromISO(e,s){const[n,r]=(e||"").split("/",2);if(n&&r){let a,o;try{a=F.fromISO(n,s),o=a.isValid}catch{o=!1}let c,l;try{c=F.fromISO(r,s),l=c.isValid}catch{l=!1}if(o&&l)return Se.fromDateTimes(a,c);if(o){const u=K.fromISO(r,s);if(u.isValid)return Se.after(a,u)}else if(l){const u=K.fromISO(n,s);if(u.isValid)return Se.before(c,u)}}return Se.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",s){if(!this.isValid)return NaN;const n=this.start.startOf(e,s);let r;return s?.useLocaleWeeks?r=this.end.reconfigure({locale:n.locale}):r=this.end,r=r.startOf(e,s),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:s}={}){return this.isValid?Se.fromDateTimes(e||this.s,s||this.e):this}splitAt(...e){if(!this.isValid)return[];const s=e.map(bt).filter(o=>this.contains(o)).sort((o,c)=>o.toMillis()-c.toMillis()),n=[];let{s:r}=this,a=0;for(;r<this.e;){const o=s[a]||this.e,c=+o>+this.e?this.e:o;n.push(Se.fromDateTimes(r,c)),r=c,a+=1}return n}splitBy(e){const s=K.fromDurationLike(e);if(!this.isValid||!s.isValid||s.as("milliseconds")===0)return[];let{s:n}=this,r=1,a;const o=[];for(;n<this.e;){const c=this.start.plus(s.mapUnits(l=>l*r));a=+c>+this.e?this.e:c,o.push(Se.fromDateTimes(n,a)),n=a,r+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const s=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return s>=n?null:Se.fromDateTimes(s,n)}union(e){if(!this.isValid)return this;const s=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return Se.fromDateTimes(s,n)}static merge(e){const[s,n]=e.sort((r,a)=>r.s-a.s).reduce(([r,a],o)=>a?a.overlaps(o)||a.abutsStart(o)?[r,a.union(o)]:[r.concat([a]),o]:[r,o],[[],null]);return n&&s.push(n),s}static xor(e){let s=null,n=0;const r=[],a=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),o=Array.prototype.concat(...a),c=o.sort((l,u)=>l.time-u.time);for(const l of c)n+=l.type==="s"?1:-1,n===1?s=l.time:(s&&+s!=+l.time&&r.push(Se.fromDateTimes(s,l.time)),s=null);return Se.merge(r)}difference(...e){return Se.xor([this].concat(e)).map(s=>this.intersection(s)).filter(s=>s&&!s.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:yt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Kt,s={}){return this.isValid?Ee.create(this.s.loc.clone(s),e).formatInterval(this):yt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:yt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:yt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:yt}toFormat(e,{separator:s=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${s}${this.e.toFormat(e)}`:yt}toDuration(e,s){return this.isValid?this.e.diff(this.s,e,s):K.invalid(this.invalidReason)}mapEndpoints(e){return Se.fromDateTimes(e(this.s),e(this.e))}}class Zt{static hasDST(e=xe.defaultZone){const s=F.now().setZone(e).set({month:12});return!e.isUniversal&&s.offset!==s.set({month:6}).offset}static isValidIANAZone(e){return st.isValidZone(e)}static normalizeZone(e){return it(e,xe.defaultZone)}static getStartOfWeek({locale:e=null,locObj:s=null}={}){return(s||se.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:s=null}={}){return(s||se.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:s=null}={}){return(s||se.create(e)).getWeekendDays().slice()}static months(e="long",{locale:s=null,numberingSystem:n=null,locObj:r=null,outputCalendar:a="gregory"}={}){return(r||se.create(s,n,a)).months(e)}static monthsFormat(e="long",{locale:s=null,numberingSystem:n=null,locObj:r=null,outputCalendar:a="gregory"}={}){return(r||se.create(s,n,a)).months(e,!0)}static weekdays(e="long",{locale:s=null,numberingSystem:n=null,locObj:r=null}={}){return(r||se.create(s,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:s=null,numberingSystem:n=null,locObj:r=null}={}){return(r||se.create(s,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return se.create(e).meridiems()}static eras(e="short",{locale:s=null}={}){return se.create(s,null,"gregory").eras(e)}static features(){return{relative:br(),localeWeek:kr()}}}function jn(t,e){const s=r=>r.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=s(e)-s(t);return Math.floor(K.fromMillis(n).as("days"))}function Oo(t,e,s){const n=[["years",(l,u)=>u.year-l.year],["quarters",(l,u)=>u.quarter-l.quarter+(u.year-l.year)*4],["months",(l,u)=>u.month-l.month+(u.year-l.year)*12],["weeks",(l,u)=>{const m=jn(l,u);return(m-m%7)/7}],["days",jn]],r={},a=t;let o,c;for(const[l,u]of n)s.indexOf(l)>=0&&(o=l,r[l]=u(t,e),c=a.plus(r),c>e?(r[l]--,t=a.plus(r),t>e&&(c=t,r[l]--,t=a.plus(r))):t=c);return[t,r,c,o]}function jo(t,e,s,n){let[r,a,o,c]=Oo(t,e,s);const l=e-r,u=s.filter(h=>["hours","minutes","seconds","milliseconds"].indexOf(h)>=0);u.length===0&&(o<e&&(o=r.plus({[c]:1})),o!==r&&(a[c]=(a[c]||0)+l/(o-r)));const m=K.fromObject(a,n);return u.length>0?K.fromMillis(l,n).shiftTo(...u).plus(m):m}const Co="missing Intl.DateTimeFormat.formatToParts support";function ee(t,e=s=>s){return{regex:t,deser:([s])=>e(vi(s))}}const Do=" ",zr=`[ ${Do}]`,Hr=new RegExp(zr,"g");function Ro(t){return t.replace(/\./g,"\\.?").replace(Hr,zr)}function Cn(t){return t.replace(/\./g,"").replace(Hr," ").toLowerCase()}function Je(t,e){return t===null?null:{regex:RegExp(t.map(Ro).join("|")),deser:([s])=>t.findIndex(n=>Cn(s)===Cn(n))+e}}function Dn(t,e){return{regex:t,deser:([,s,n])=>os(s,n),groups:e}}function zt(t){return{regex:t,deser:([e])=>e}}function Uo(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Lo(t,e){const s=_e(e),n=_e(e,"{2}"),r=_e(e,"{3}"),a=_e(e,"{4}"),o=_e(e,"{6}"),c=_e(e,"{1,2}"),l=_e(e,"{1,3}"),u=_e(e,"{1,6}"),m=_e(e,"{1,9}"),h=_e(e,"{2,4}"),p=_e(e,"{4,6}"),y=j=>({regex:RegExp(Uo(j.val)),deser:([z])=>z,literal:!0}),I=(j=>{if(t.literal)return y(j);switch(j.val){case"G":return Je(e.eras("short"),0);case"GG":return Je(e.eras("long"),0);case"y":return ee(u);case"yy":return ee(h,Ls);case"yyyy":return ee(a);case"yyyyy":return ee(p);case"yyyyyy":return ee(o);case"M":return ee(c);case"MM":return ee(n);case"MMM":return Je(e.months("short",!0),1);case"MMMM":return Je(e.months("long",!0),1);case"L":return ee(c);case"LL":return ee(n);case"LLL":return Je(e.months("short",!1),1);case"LLLL":return Je(e.months("long",!1),1);case"d":return ee(c);case"dd":return ee(n);case"o":return ee(l);case"ooo":return ee(r);case"HH":return ee(n);case"H":return ee(c);case"hh":return ee(n);case"h":return ee(c);case"mm":return ee(n);case"m":return ee(c);case"q":return ee(c);case"qq":return ee(n);case"s":return ee(c);case"ss":return ee(n);case"S":return ee(l);case"SSS":return ee(r);case"u":return zt(m);case"uu":return zt(c);case"uuu":return ee(s);case"a":return Je(e.meridiems(),0);case"kkkk":return ee(a);case"kk":return ee(h,Ls);case"W":return ee(c);case"WW":return ee(n);case"E":case"c":return ee(s);case"EEE":return Je(e.weekdays("short",!1),1);case"EEEE":return Je(e.weekdays("long",!1),1);case"ccc":return Je(e.weekdays("short",!0),1);case"cccc":return Je(e.weekdays("long",!0),1);case"Z":case"ZZ":return Dn(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return Dn(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return zt(/[a-z_+-/]{1,256}?/i);case" ":return zt(/[^\S\n\r]/);default:return y(j)}})(t)||{invalidReason:Co};return I.token=t,I}const Fo={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function $o(t,e,s){const{type:n,value:r}=t;if(n==="literal"){const l=/^\s+$/.test(r);return{literal:!l,val:l?" ":r}}const a=e[n];let o=n;n==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=s.hour12?"hour12":"hour24");let c=Fo[o];if(typeof c=="object"&&(c=c[a]),c)return{literal:!1,val:c}}function Po(t){return[`^${t.map(s=>s.regex).reduce((s,n)=>`${s}(${n.source})`,"")}$`,t]}function Wo(t,e,s){const n=t.match(e);if(n){const r={};let a=1;for(const o in s)if(wt(s,o)){const c=s[o],l=c.groups?c.groups+1:1;!c.literal&&c.token&&(r[c.token.val[0]]=c.deser(n.slice(a,a+l))),a+=l}return[n,r]}else return[n,{}]}function Vo(t){const e=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let s=null,n;return $(t.z)||(s=st.create(t.z)),$(t.Z)||(s||(s=new De(t.Z)),n=t.Z),$(t.q)||(t.M=(t.q-1)*3+1),$(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),$(t.u)||(t.S=qs(t.u)),[Object.keys(t).reduce((a,o)=>{const c=e(o);return c&&(a[c]=t[o]),a},{}),s,n]}let ws=null;function Bo(){return ws||(ws=F.fromMillis(1555555555555)),ws}function Zo(t,e){if(t.literal)return t;const s=Ee.macroTokenToFormatOpts(t.val),n=_r(s,e);return n==null||n.includes(void 0)?t:n}function qr(t,e){return Array.prototype.concat(...t.map(s=>Zo(s,e)))}class Gr{constructor(e,s){if(this.locale=e,this.format=s,this.tokens=qr(Ee.parseFormat(s),e),this.units=this.tokens.map(n=>Lo(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,r]=Po(this.units);this.regex=RegExp(n,"i"),this.handlers=r}}explainFromTokens(e){if(this.isValid){const[s,n]=Wo(e,this.regex,this.handlers),[r,a,o]=n?Vo(n):[null,null,void 0];if(wt(n,"a")&&wt(n,"H"))throw new pt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:s,matches:n,result:r,zone:a,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function Yr(t,e,s){return new Gr(t,s).explainFromTokens(e)}function zo(t,e,s){const{result:n,zone:r,specificOffset:a,invalidReason:o}=Yr(t,e,s);return[n,r,a,o]}function _r(t,e){if(!t)return null;const n=Ee.create(e,t).dtFormatter(Bo()),r=n.formatToParts(),a=n.resolvedOptions();return r.map(o=>$o(o,t,a))}const vs="Invalid DateTime",Rn=864e13;function Mt(t){return new Qe("unsupported zone",`the zone "${t.name}" is not supported`)}function As(t){return t.weekData===null&&(t.weekData=Xt(t.c)),t.weekData}function Ts(t){return t.localWeekData===null&&(t.localWeekData=Xt(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function ct(t,e){const s={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new F({...s,...e,old:s})}function Jr(t,e,s){let n=t-e*60*1e3;const r=s.offset(n);if(e===r)return[n,e];n-=(r-e)*60*1e3;const a=s.offset(n);return r===a?[n,r]:[t-Math.min(r,a)*60*1e3,Math.max(r,a)]}function Ht(t,e){t+=e*60*1e3;const s=new Date(t);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),hour:s.getUTCHours(),minute:s.getUTCMinutes(),second:s.getUTCSeconds(),millisecond:s.getUTCMilliseconds()}}function _t(t,e,s){return Jr(is(t),e,s)}function Un(t,e){const s=t.o,n=t.c.year+Math.trunc(e.years),r=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,a={...t.c,year:n,month:r,day:Math.min(t.c.day,es(n,r))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=K.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),c=is(a);let[l,u]=Jr(c,s,t.zone);return o!==0&&(l+=o,u=t.zone.offset(l)),{ts:l,o:u}}function gt(t,e,s,n,r,a){const{setZone:o,zone:c}=s;if(t&&Object.keys(t).length!==0||e){const l=e||c,u=F.fromObject(t,{...s,zone:l,specificOffset:a});return o?u:u.setZone(c)}else return F.invalid(new Qe("unparsable",`the input "${r}" can't be parsed as ${n}`))}function qt(t,e,s=!0){return t.isValid?Ee.create(se.create("en-US"),{allowZ:s,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Ns(t,e,s){const n=t.c.year>9999||t.c.year<0;let r="";if(n&&t.c.year>=0&&(r+="+"),r+=ve(t.c.year,n?6:4),s==="year")return r;if(e){if(r+="-",r+=ve(t.c.month),s==="month")return r;r+="-"}else if(r+=ve(t.c.month),s==="month")return r;return r+=ve(t.c.day),r}function Ln(t,e,s,n,r,a,o){let c=!s||t.c.millisecond!==0||t.c.second!==0,l="";switch(o){case"day":case"month":case"year":break;default:if(l+=ve(t.c.hour),o==="hour")break;if(e){if(l+=":",l+=ve(t.c.minute),o==="minute")break;c&&(l+=":",l+=ve(t.c.second))}else{if(l+=ve(t.c.minute),o==="minute")break;c&&(l+=ve(t.c.second))}if(o==="second")break;c&&(!n||t.c.millisecond!==0)&&(l+=".",l+=ve(t.c.millisecond,3))}return r&&(t.isOffsetFixed&&t.offset===0&&!a?l+="Z":t.o<0?(l+="-",l+=ve(Math.trunc(-t.o/60)),l+=":",l+=ve(Math.trunc(-t.o%60))):(l+="+",l+=ve(Math.trunc(t.o/60)),l+=":",l+=ve(Math.trunc(t.o%60)))),a&&(l+="["+t.zone.ianaName+"]"),l}const Qr={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Ho={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},qo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Jt=["year","month","day","hour","minute","second","millisecond"],Go=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Yo=["year","ordinal","hour","minute","second","millisecond"];function Qt(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new Qn(t);return e}function Fn(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Qt(t)}}function _o(t){if(Et===void 0&&(Et=xe.now()),t.type!=="iana")return t.offset(Et);const e=t.name;let s=Fs.get(e);return s===void 0&&(s=t.offset(Et),Fs.set(e,s)),s}function $n(t,e){const s=it(e.zone,xe.defaultZone);if(!s.isValid)return F.invalid(Mt(s));const n=se.fromObject(e);let r,a;if($(t.year))r=xe.now();else{for(const l of Jt)$(t[l])&&(t[l]=Qr[l]);const o=Tr(t)||Nr(t);if(o)return F.invalid(o);const c=_o(s);[r,a]=_t(t,c,s)}return new F({ts:r,zone:s,loc:n,o:a})}function Pn(t,e,s){const n=$(s.round)?!0:s.round,r=$(s.rounding)?"trunc":s.rounding,a=(c,l)=>(c=Gs(c,n||s.calendary?0:2,s.calendary?"round":r),e.loc.clone(s).relFormatter(s).format(c,l)),o=c=>s.calendary?e.hasSame(t,c)?0:e.startOf(c).diff(t.startOf(c),c).get(c):e.diff(t,c).get(c);if(s.unit)return a(o(s.unit),s.unit);for(const c of s.units){const l=o(c);if(Math.abs(l)>=1)return a(l,c)}return a(t>e?-0:0,s.units[s.units.length-1])}function Wn(t){let e={},s;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],s=Array.from(t).slice(0,t.length-1)):s=Array.from(t),[e,s]}let Et;const Fs=new Map;class F{constructor(e){const s=e.zone||xe.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Qe("invalid input"):null)||(s.isValid?null:Mt(s));this.ts=$(e.ts)?xe.now():e.ts;let r=null,a=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(s))[r,a]=[e.old.c,e.old.o];else{const c=ot(e.o)&&!e.old?e.o:s.offset(this.ts);r=Ht(this.ts,c),n=Number.isNaN(r.year)?new Qe("invalid input"):null,r=n?null:r,a=n?null:c}this._zone=s,this.loc=e.loc||se.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=a,this.isLuxonDateTime=!0}static now(){return new F({})}static local(){const[e,s]=Wn(arguments),[n,r,a,o,c,l,u]=s;return $n({year:n,month:r,day:a,hour:o,minute:c,second:l,millisecond:u},e)}static utc(){const[e,s]=Wn(arguments),[n,r,a,o,c,l,u]=s;return e.zone=De.utcInstance,$n({year:n,month:r,day:a,hour:o,minute:c,second:l,millisecond:u},e)}static fromJSDate(e,s={}){const n=ki(e)?e.valueOf():NaN;if(Number.isNaN(n))return F.invalid("invalid input");const r=it(s.zone,xe.defaultZone);return r.isValid?new F({ts:n,zone:r,loc:se.fromObject(s)}):F.invalid(Mt(r))}static fromMillis(e,s={}){if(ot(e))return e<-Rn||e>Rn?F.invalid("Timestamp out of range"):new F({ts:e,zone:it(s.zone,xe.defaultZone),loc:se.fromObject(s)});throw new Me(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,s={}){if(ot(e))return new F({ts:e*1e3,zone:it(s.zone,xe.defaultZone),loc:se.fromObject(s)});throw new Me("fromSeconds requires a numerical input")}static fromObject(e,s={}){e=e||{};const n=it(s.zone,xe.defaultZone);if(!n.isValid)return F.invalid(Mt(n));const r=se.fromObject(s),a=ts(e,Fn),{minDaysInFirstWeek:o,startOfWeek:c}=Tn(a,r),l=xe.now(),u=$(s.specificOffset)?n.offset(l):s.specificOffset,m=!$(a.ordinal),h=!$(a.year),p=!$(a.month)||!$(a.day),y=h||p,w=a.weekYear||a.weekNumber;if((y||m)&&w)throw new pt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(p&&m)throw new pt("Can't mix ordinal dates with month/day");const I=w||a.weekday&&!y;let j,z,_=Ht(l,u);I?(j=Go,z=Ho,_=Xt(_,o,c)):m?(j=Yo,z=qo,_=xs(_)):(j=Jt,z=Qr);let H=!1;for(const v of j){const M=a[v];$(M)?H?a[v]=z[v]:a[v]=_[v]:H=!0}const N=I?Ti(a,o,c):m?Ni(a):Tr(a),E=N||Nr(a);if(E)return F.invalid(E);const P=I?vn(a,o,c):m?An(a):a,[O,W]=_t(P,u,n),g=new F({ts:O,zone:n,o:W,loc:r});return a.weekday&&y&&e.weekday!==g.weekday?F.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${g.toISO()}`):g.isValid?g:F.invalid(g.invalid)}static fromISO(e,s={}){const[n,r]=go(e);return gt(n,r,s,"ISO 8601",e)}static fromRFC2822(e,s={}){const[n,r]=po(e);return gt(n,r,s,"RFC 2822",e)}static fromHTTP(e,s={}){const[n,r]=So(e);return gt(n,r,s,"HTTP",s)}static fromFormat(e,s,n={}){if($(e)||$(s))throw new Me("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:a=null}=n,o=se.fromOpts({locale:r,numberingSystem:a,defaultToEN:!0}),[c,l,u,m]=zo(o,e,s);return m?F.invalid(m):gt(c,l,n,`format ${s}`,e,u)}static fromString(e,s,n={}){return F.fromFormat(e,s,n)}static fromSQL(e,s={}){const[n,r]=bo(e);return gt(n,r,s,"SQL",e)}static invalid(e,s=null){if(!e)throw new Me("need to specify a reason the DateTime is invalid");const n=e instanceof Qe?e:new Qe(e,s);if(xe.throwOnInvalid)throw new Qa(n);return new F({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,s={}){const n=_r(e,se.fromObject(s));return n?n.map(r=>r?r.val:null).join(""):null}static expandFormat(e,s={}){return qr(Ee.parseFormat(e),se.fromObject(s)).map(r=>r.val).join("")}static resetCache(){Et=void 0,Fs.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?As(this).weekYear:NaN}get weekNumber(){return this.isValid?As(this).weekNumber:NaN}get weekday(){return this.isValid?As(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Ts(this).weekday:NaN}get localWeekNumber(){return this.isValid?Ts(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Ts(this).weekYear:NaN}get ordinal(){return this.isValid?xs(this.c).ordinal:NaN}get monthShort(){return this.isValid?Zt.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Zt.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Zt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Zt.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,s=6e4,n=is(this.c),r=this.zone.offset(n-e),a=this.zone.offset(n+e),o=this.zone.offset(n-r*s),c=this.zone.offset(n-a*s);if(o===c)return[this];const l=n-o*s,u=n-c*s,m=Ht(l,o),h=Ht(u,c);return m.hour===h.hour&&m.minute===h.minute&&m.second===h.second&&m.millisecond===h.millisecond?[ct(this,{ts:l}),ct(this,{ts:u})]:[this]}get isInLeapYear(){return Dt(this.year)}get daysInMonth(){return es(this.year,this.month)}get daysInYear(){return this.isValid?St(this.year):NaN}get weeksInWeekYear(){return this.isValid?jt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?jt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:s,numberingSystem:n,calendar:r}=Ee.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:s,numberingSystem:n,outputCalendar:r}}toUTC(e=0,s={}){return this.setZone(De.instance(e),s)}toLocal(){return this.setZone(xe.defaultZone)}setZone(e,{keepLocalTime:s=!1,keepCalendarTime:n=!1}={}){if(e=it(e,xe.defaultZone),e.equals(this.zone))return this;if(e.isValid){let r=this.ts;if(s||n){const a=e.offset(this.ts),o=this.toObject();[r]=_t(o,a,e)}return ct(this,{ts:r,zone:e})}else return F.invalid(Mt(e))}reconfigure({locale:e,numberingSystem:s,outputCalendar:n}={}){const r=this.loc.clone({locale:e,numberingSystem:s,outputCalendar:n});return ct(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const s=ts(e,Fn),{minDaysInFirstWeek:n,startOfWeek:r}=Tn(s,this.loc),a=!$(s.weekYear)||!$(s.weekNumber)||!$(s.weekday),o=!$(s.ordinal),c=!$(s.year),l=!$(s.month)||!$(s.day),u=c||l,m=s.weekYear||s.weekNumber;if((u||o)&&m)throw new pt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&o)throw new pt("Can't mix ordinal dates with month/day");let h;a?h=vn({...Xt(this.c,n,r),...s},n,r):$(s.ordinal)?(h={...this.toObject(),...s},$(s.day)&&(h.day=Math.min(es(h.year,h.month),h.day))):h=An({...xs(this.c),...s});const[p,y]=_t(h,this.o,this.zone);return ct(this,{ts:p,o:y})}plus(e){if(!this.isValid)return this;const s=K.fromDurationLike(e);return ct(this,Un(this,s))}minus(e){if(!this.isValid)return this;const s=K.fromDurationLike(e).negate();return ct(this,Un(this,s))}startOf(e,{useLocaleWeeks:s=!1}={}){if(!this.isValid)return this;const n={},r=K.normalizeUnit(e);switch(r){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(r==="weeks")if(s){const a=this.loc.getStartOfWeek(),{weekday:o}=this;o<a&&(n.weekNumber=this.weekNumber-1),n.weekday=a}else n.weekday=1;if(r==="quarters"){const a=Math.ceil(this.month/3);n.month=(a-1)*3+1}return this.set(n)}endOf(e,s){return this.isValid?this.plus({[e]:1}).startOf(e,s).minus(1):this}toFormat(e,s={}){return this.isValid?Ee.create(this.loc.redefaultToEN(s)).formatDateTimeFromString(this,e):vs}toLocaleString(e=Kt,s={}){return this.isValid?Ee.create(this.loc.clone(s),e).formatDateTime(this):vs}toLocaleParts(e={}){return this.isValid?Ee.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:s=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:a=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=Qt(o);const c=e==="extended";let l=Ns(this,c,o);return Jt.indexOf(o)>=3&&(l+="T"),l+=Ln(this,c,s,n,r,a,o),l}toISODate({format:e="extended",precision:s="day"}={}){return this.isValid?Ns(this,e==="extended",Qt(s)):null}toISOWeekDate(){return qt(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:s=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:a=!1,format:o="extended",precision:c="milliseconds"}={}){return this.isValid?(c=Qt(c),(r&&Jt.indexOf(c)>=3?"T":"")+Ln(this,o==="extended",s,e,n,a,c)):null}toRFC2822(){return qt(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return qt(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Ns(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:s=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(s||e)&&(n&&(r+=" "),s?r+="z":e&&(r+="ZZ")),qt(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():vs}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const s={...this.c};return e.includeConfig&&(s.outputCalendar=this.outputCalendar,s.numberingSystem=this.loc.numberingSystem,s.locale=this.loc.locale),s}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,s="milliseconds",n={}){if(!this.isValid||!e.isValid)return K.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=Ii(s).map(K.normalizeUnit),o=e.valueOf()>this.valueOf(),c=o?this:e,l=o?e:this,u=jo(c,l,a,r);return o?u.negate():u}diffNow(e="milliseconds",s={}){return this.diff(F.now(),e,s)}until(e){return this.isValid?Se.fromDateTimes(this,e):this}hasSame(e,s,n){if(!this.isValid)return!1;const r=e.valueOf(),a=this.setZone(e.zone,{keepLocalTime:!0});return a.startOf(s,n)<=r&&r<=a.endOf(s,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const s=e.base||F.fromObject({},{zone:this.zone}),n=e.padding?this<s?-e.padding:e.padding:0;let r=["years","months","days","hours","minutes","seconds"],a=e.unit;return Array.isArray(e.unit)&&(r=e.unit,a=void 0),Pn(s,this.plus(n),{...e,numeric:"always",units:r,unit:a})}toRelativeCalendar(e={}){return this.isValid?Pn(e.base||F.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(F.isDateTime))throw new Me("min requires all arguments be DateTimes");return Nn(e,s=>s.valueOf(),Math.min)}static max(...e){if(!e.every(F.isDateTime))throw new Me("max requires all arguments be DateTimes");return Nn(e,s=>s.valueOf(),Math.max)}static fromFormatExplain(e,s,n={}){const{locale:r=null,numberingSystem:a=null}=n,o=se.fromOpts({locale:r,numberingSystem:a,defaultToEN:!0});return Yr(o,e,s)}static fromStringExplain(e,s,n={}){return F.fromFormatExplain(e,s,n)}static buildFormatParser(e,s={}){const{locale:n=null,numberingSystem:r=null}=s,a=se.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new Gr(a,e)}static fromFormatParser(e,s,n={}){if($(e)||$(s))throw new Me("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:a=null}=n,o=se.fromOpts({locale:r,numberingSystem:a,defaultToEN:!0});if(!o.equals(s.locale))throw new Me(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${s.locale}`);const{result:c,zone:l,specificOffset:u,invalidReason:m}=s.explainFromTokens(e);return m?F.invalid(m):gt(c,l,n,`format ${s.format}`,e,u)}static get DATE_SHORT(){return Kt}static get DATE_MED(){return Kn}static get DATE_MED_WITH_WEEKDAY(){return ei}static get DATE_FULL(){return Xn}static get DATE_HUGE(){return er}static get TIME_SIMPLE(){return tr}static get TIME_WITH_SECONDS(){return sr}static get TIME_WITH_SHORT_OFFSET(){return nr}static get TIME_WITH_LONG_OFFSET(){return rr}static get TIME_24_SIMPLE(){return ar}static get TIME_24_WITH_SECONDS(){return ir}static get TIME_24_WITH_SHORT_OFFSET(){return or}static get TIME_24_WITH_LONG_OFFSET(){return lr}static get DATETIME_SHORT(){return cr}static get DATETIME_SHORT_WITH_SECONDS(){return ur}static get DATETIME_MED(){return dr}static get DATETIME_MED_WITH_SECONDS(){return mr}static get DATETIME_MED_WITH_WEEKDAY(){return ti}static get DATETIME_FULL(){return fr}static get DATETIME_FULL_WITH_SECONDS(){return hr}static get DATETIME_HUGE(){return yr}static get DATETIME_HUGE_WITH_SECONDS(){return gr}}function bt(t){if(F.isDateTime(t))return t;if(t&&t.valueOf&&ot(t.valueOf()))return F.fromJSDate(t);if(t&&typeof t=="object")return F.fromObject(t);throw new Me(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function Jo(t,e){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0,timeZone:e})}function Qo(t,e){try{const s=F.fromJSDate(t,{zone:"utc"}).setZone(e),n=s.toJSDate().toLocaleString("en-US",{timeZone:e,timeZoneName:"short"}).split(" ").pop()||void 0,r=s.toFormat("ZZ")||void 0;return{abbr:n,offset:r}}catch{return{}}}function Ko(t){if(!t)return"-";try{const e=new Date(t),s=u=>String(u).padStart(2,"0"),n=s(e.getMonth()+1),r=s(e.getDate()),a=e.getFullYear(),o=s(e.getHours()),c=s(e.getMinutes()),l=s(e.getSeconds());return`${n}/${r}/${a} ${o}:${c}:${l}`}catch{return"-"}}function ss(t,e="UTC"){if(!t)return"-";const s=F.fromISO(t,{zone:"utc"}).setZone(e);if(!s.isValid)return"-";const n=s.offsetNameShort,r=s.toFormat("ZZZZ"),a=n.startsWith("GMT")||n===r?r:`${n}/${r}`;return`${s.toFormat("MM/dd/yyyy, hh:mm:ss a")} (${a})`}const Xo={Critical:"#FF3B30",High:"#FFB86A",Medium:"#FFCC00",Low:"#007AFF"},el={Critical:"#FFE2E2",High:"#FF95004D",Medium:"#FEF9C2",Low:"#E0EDFF"};function Kr({alerts:t,loading:e=!1,pageSize:s=10,severityOptions:n,anomalyOptions:r,spaceOptions:a,onAlertIdClick:o}){const c=Bs(),l=["completed","false positive"],u=async p=>{try{const y=await c.mutateAsync({alertUniqueId:p.alertId??p.id,alertId:p.id,status:"Reopen",notes:"Reopened",modifiedBy:0});if(y?.responseStatus||y?.Success){const w=y?.Message||y?.data||"Alert reopened successfully.";be.toast.success(w)}else{const w=y?.errorMessage||y?.Message||"Failed to reopen alert";be.toast.error(w)}}catch{be.toast.error("Failed to reopen alert. Please try again.")}},m=[{title:"Severity",dataIndex:"priority",key:"priority",width:120,render:p=>i.jsx(d.Tag,{className:"px-[10px] py-[2px]",style:{border:`2px solid ${Xo[p]}`,backgroundColor:el[String(p)]},children:p})},{title:"Timestamp",dataIndex:"timestamp",key:"timestamp",width:200,render:p=>Ko(p)},{title:"Status",dataIndex:"statusType",key:"statusType",width:140},{title:"Description",dataIndex:"description",key:"description",render:(p,y)=>i.jsxs("div",{children:[i.jsx("a",{onClick:w=>{w.preventDefault(),o?.(y,{sourceTab:"archived"})},className:"inline-block mb-1 text-blue-600",children:y.alertNumber}),i.jsx("div",{className:"text-black/65",children:p})]})},{title:"",key:"menu",width:60,align:"right",render:(p,y)=>i.jsx(d.Dropdown,{trigger:["click"],menu:{items:[{key:"reopen",label:"Reopen"}],onClick:({key:w})=>{w==="reopen"&&u(y)}},children:i.jsx(d.Button,{type:"text",icon:i.jsx(dt.MoreOutlined,{})})})}],h=(t||[]).filter(p=>l.includes((p.statusType||"").toLowerCase()));return i.jsx(Vs,{data:h,loading:e,pageSize:s,columns:m,severityOptions:n,anomalyOptions:r,spaceOptions:a,renderActions:void 0,onAlertIdClick:o,excludeCompleted:!1})}function tl({size:t=120,time:e,timeZone:s="America/New_York"}){const{hours:n,minutes:r,seconds:a}=f.useMemo(()=>{const h=new Intl.DateTimeFormat("en-US",{timeZone:s,hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}).formatToParts(e);return{hours:parseInt(h.find(p=>p.type==="hour")?.value||"0",10),minutes:parseInt(h.find(p=>p.type==="minute")?.value||"0",10),seconds:parseInt(h.find(p=>p.type==="second")?.value||"0",10)}},[e,s]),o=a*6,c=r*6+a*.1,l=n%12*30+r*.5,u=t/2;return i.jsxs("div",{className:"relative rounded-full border border-gray-300 bg-white",style:{width:t,height:t},role:"img","aria-label":"Analog Clock",children:[[...Array(12)].map((m,h)=>{const p=h*30,y=6,w=u-4,I=w-y,j=(p-90)*(Math.PI/180),z=u+I*Math.cos(j),_=u+I*Math.sin(j),H=u+w*Math.cos(j),N=u+w*Math.sin(j);return i.jsx("svg",{className:"absolute inset-0",width:t,height:t,children:i.jsx("line",{x1:z,y1:_,x2:H,y2:N,stroke:"#9CA3AF",strokeWidth:h%3===0?2:1,strokeLinecap:"round"})},h)}),i.jsx("svg",{className:"absolute inset-0",width:t,height:t,style:{transform:`rotate(${l}deg)`},children:i.jsx("line",{x1:u,y1:u,x2:u,y2:u-t*.25,stroke:"#1F2937",strokeWidth:4,strokeLinecap:"round"})}),i.jsx("svg",{className:"absolute inset-0",width:t,height:t,style:{transform:`rotate(${c}deg)`},children:i.jsx("line",{x1:u,y1:u,x2:u,y2:u-t*.35,stroke:"#374151",strokeWidth:3,strokeLinecap:"round"})}),i.jsx("svg",{className:"absolute inset-0",width:t,height:t,style:{transform:`rotate(${o}deg)`},children:i.jsx("line",{x1:u,y1:u+t*.08,x2:u,y2:u-t*.38,stroke:"#EF4444",strokeWidth:1.5,strokeLinecap:"round"})}),i.jsx("div",{className:"absolute bg-gray-900 rounded-full",style:{width:8,height:8,left:u-4,top:u-4}})]})}function Xr({label:t="USA",timeZone:e="America/New_York",updateIntervalMs:s=1e3,className:n}){const[r,a]=f.useState(new Date);f.useEffect(()=>{const u=setInterval(()=>a(new Date),s);return()=>clearInterval(u)},[s]);const o=f.useMemo(()=>Jo(r,e),[r,e]),{abbr:c,offset:l}=f.useMemo(()=>Qo(r,e),[r,e]);return i.jsxs("div",{className:`flex items-center gap-3 ${n||""}`,children:[i.jsx(tl,{time:r,timeZone:e,size:80}),i.jsxs("div",{className:"flex flex-col items-baseline gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[i.jsx("span",{className:"uppercase",children:t}),c&&i.jsxs("span",{className:"p-2 rounded-md border text-[10px] leading-none text-gray-600 bg-gray-50",children:[c," ",l]})]}),i.jsx("div",{className:"text-2xl font-semibold text-gray-700 tracking-wide",children:o})]})]})}const{Text:sl}=d.Typography;function nl({sortBy:t,onChange:e,showActions:s,onSave:n,onClear:r,saving:a}){return i.jsxs(d.Row,{gutter:[16,16],align:"middle",children:[i.jsx(d.Col,{xs:24,md:8,lg:5,children:i.jsxs(d.Space,{className:"w-full items-center",direction:"horizontal",size:12,children:[i.jsx(sl,{className:"text-gray-600 whitespace-nowrap",children:"Sort By:"}),i.jsx(d.Select,{placeholder:"By Severity",value:t,onChange:o=>e({sortBy:o}),options:[{label:"By Severity",value:"By Severity"},{label:"By Created Date",value:"By Created Date"}],className:"w-full",style:{minWidth:"200px"}})]})}),i.jsx(d.Col,{xs:24,md:8,style:{alignSelf:"end"},children:s?i.jsxs(d.Space,{className:"w-full",direction:"horizontal",size:8,children:[i.jsx(d.Button,{onClick:r,disabled:a,children:"Clear"}),i.jsx(d.Button,{type:"primary",onClick:n,loading:a,children:"Save"})]}):null})]})}const $s=t=>i.jsxs(d.Tag,{children:[i.jsx(dt.PlusOutlined,{})," ",t.length," more"]}),{Text:tt}=d.Typography;function rl(t){const{selectedRule:e,setSelectedRule:s,ruleOptions:n,minsOptions:r,roleOptions:a,l1mins:o,setL1mins:c,l1role:l,setL1role:u,l2mins:m,setL2mins:h,l2role:p,setL2role:y,l3mins:w,setL3mins:I,l3role:j,setL3role:z,actions:_,setActions:H,thirdPartyIds:N,setThirdPartyIds:E,humanLoop:P,setHumanLoop:O,isAutoExpire:W,setAutoExpire:g,onClear:v,onSave:M,saving:he,onActionTypesLoaded:ne}=t,{rules:C,config:S}=Fe(),x=S.tenant==="schools",[b,A]=f.useState([]),[D,R]=f.useState([]),[q,J]=f.useState(!1);f.useEffect(()=>{let ie=!1;return(async()=>{try{J(!0);const ye=await C.getLookups();if(ie||!ye||!Array.isArray(ye.actionTypes))return;const Ae=ye.actionTypes.map(de=>({label:de.name,value:String(de.actionTypeId)}));A(Ae),ne&&ne(ye.actionTypes);const ue=Array.isArray(ye.thirdParties)?ye.thirdParties.map(de=>({label:de.thirdPartyName,value:de.thirdPartyIds??de.thirdPartyId})):[];R(ue)}catch(ye){console.error("Error loading lookups",ye)}finally{ie||J(!1)}})(),()=>{ie=!0}},[]);const te=typeof o=="number"||typeof l=="number",X=typeof m=="number"||typeof p=="number",le=typeof o=="number"||typeof l=="number"||typeof m=="number"||typeof p=="number"||typeof w=="number"||typeof j=="number"||Array.isArray(_)&&_.length>0||Array.isArray(N)&&N.length>0||!!P||!!W,we=!!e&&le&&!he;return i.jsxs(d.Spin,{spinning:!!he||q,children:[i.jsxs(d.Row,{gutter:[16,16],align:"bottom",children:[i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsx(tt,{className:"text-gray-700 font-medium block mb-1",children:"Rules"}),i.jsx(d.Select,{placeholder:"Rules",value:e,onChange:s,options:n,className:"w-full"})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(tt,{className:"text-gray-700 font-medium block mb-1",children:"Level 1 (mins)"})}),i.jsx(d.Col,{span:14,children:i.jsx(tt,{className:"text-gray-700 font-medium block mb-1",children:"Escalate to"})})]}),i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(d.Select,{className:"w-full",placeholder:"Mins",value:o,onChange:c,options:r})}),i.jsx(d.Col,{span:14,children:i.jsx(d.Select,{placeholder:"Escalate to",className:"w-full",value:l,onChange:u,options:a})})]})]})}),te&&i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(tt,{className:"text-gray-700 font-medium block mb-1",children:"Level 2 (mins)"})}),i.jsx(d.Col,{span:14,children:i.jsx(tt,{className:"text-gray-700 font-medium block mb-1",children:"Escalate to"})})]}),i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(d.Select,{className:"w-full",placeholder:"Mins",value:m,onChange:h,options:r})}),i.jsx(d.Col,{span:14,children:i.jsx(d.Select,{placeholder:"Escalate to",className:"w-full",value:p,onChange:y,options:a})})]})]})}),X&&i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(tt,{className:"text-gray-700 font-medium block mb-1",children:"Level 3 (mins)"})}),i.jsx(d.Col,{span:14,children:i.jsx(tt,{className:"text-gray-700 font-medium block mb-1",children:"Escalate to"})})]}),i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(d.Select,{className:"w-full",placeholder:"Mins",value:w,onChange:I,options:r})}),i.jsx(d.Col,{span:14,children:i.jsx(d.Select,{placeholder:"Escalate to",className:"w-full",value:j,onChange:z,options:a})})]})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsx(tt,{className:"text-gray-700 font-medium block mb-1",children:"Pick Actions"}),i.jsx(d.Select,{mode:"multiple",placeholder:"Select response actions",className:"w-full",value:_,onChange:H,options:b,maxTagCount:1,maxTagPlaceholder:$s})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsx(tt,{className:"text-gray-700 font-medium block mb-1",children:"Notify"}),i.jsx(d.Select,{mode:"multiple",placeholder:"Notify",className:"w-full",value:N,onChange:E,options:D,maxCount:2,maxTagPlaceholder:$s})]})})]}),i.jsxs(d.Row,{gutter:[16,16],align:"bottom",className:"mt-4 items-center",children:[i.jsx(d.Col,{xs:24,sm:12,md:8,lg:7,children:i.jsxs("div",{className:"flex items-center h-full gap-8",children:[!x&&i.jsx(d.Checkbox,{checked:P,onChange:ie=>O(ie.target.checked),className:"w-full",children:"Human-In-The-Loop"}),i.jsx(d.Checkbox,{checked:W,onChange:ie=>g(ie.target.checked),className:"w-full",children:"Auto-expire in 5 minutes"})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(d.Button,{onClick:v,children:"Clear"}),i.jsx(d.Button,{type:"primary",onClick:M,loading:!!he,disabled:!we,children:"Save"})]})})]})]})}function al({entries:t,userRoles:e,onEdit:s,loading:n}){const{config:r}=Fe(),a=r.tenant==="schools",o=new Map(e.map(l=>[l.userRoleId,l.userRoleName])),c=l=>l.map(u=>o.get(u)||String(u)).join(", ");return i.jsx(d.Table,{rowKey:"id",dataSource:t,pagination:{pageSize:10,showSizeChanger:!0,showTotal:(l,u)=>`${u[0]}-${u[1]} of ${l} items`},loading:n,columns:[{title:"Rule",dataIndex:"ruleOrSeverityLabel",key:"rule"},{title:"Level 1",key:"l1",render:(l,u)=>i.jsxs("span",{children:[u.l1.minutes?`Action taken in (${u.l1.minutes} Mins)`:"No Action taken in 0 Min",u.l1.roles?.length?`, Escalate to (${c(u.l1.roles)})`:""]})},{title:"Level 2",key:"l2",render:(l,u)=>i.jsxs("span",{children:[u.l2.minutes?`Action taken in (${u.l2.minutes} Mins)`:"No Action taken in 0 Min",u.l2.roles?.length?`, Escalate to (${c(u.l2.roles)})`:""]})},{title:"Level 3",key:"l3",render:(l,u)=>i.jsxs("span",{children:[u.l3.minutes?`Action taken in (${u.l3.minutes} Mins)`:"No Action taken in 0 Min",u.l3.roles?.length?`, Escalate to (${c(u.l3.roles)})`:""]})},{title:"Pick Actions",key:"actionsCol",render:(l,u)=>u.actions?.length?u.actions.join(", "):"-"},{title:"Notify",key:"notify",render:(l,u)=>u.notify?.length?u.notify.join(", "):"-"},...a?[]:[{title:"Human-In-The-Loop",key:"humanLoop",render:(l,u)=>u.humanLoop?"Yes":"No"}],{title:"Auto Expire",key:"isAutoExpire",render:(l,u)=>u.isAutoExpire?"Yes":"No"},{title:"Actions",key:"ops",render:(l,u)=>i.jsx(d.Button,{type:"text",onClick:()=>s(u.id),children:i.jsx(dt.EditOutlined,{})})}]})}const{Title:il,Text:bs}=d.Typography;function ea({userRoles:t,rules:e,rawRules:s}){const{rules:n}=Fe(),[r,a]=f.useState(!1),[o,c]=f.useState(!1),[l,u]=f.useState(s),[m,h]=f.useState(),[p,y]=f.useState([]),w=f.useMemo(()=>t.map(N=>({label:N.userRoleName,value:N.userRoleId})),[t]),I=f.useMemo(()=>(e||[]).map(N=>({label:N.Name||"-",value:N.RuleId||N.Name||""})),[e]),j=f.useMemo(()=>(e||[]).map((N,E)=>({key:N.RuleId||N.Name||String(E),ruleName:N.Name||"-",ruleDesc:N.Description||""})),[e]);f.useEffect(()=>{let N=!1;return(async()=>{try{a(!0);const E=await n.getRules();N||u(Array.isArray(E)?E:[])}catch{!N&&Array.isArray(s)&&u(s)}finally{N||a(!1)}})(),()=>{N=!0}},[]),f.useEffect(()=>{!l&&Array.isArray(s)&&u(s)},[s]),f.useEffect(()=>{if(!m||!Array.isArray(l)){y([]);return}const N=l.find(P=>P?.ruleId===m||P?.RuleId===m||P?.ruleName===m),E=N?.userRoleIds??N?.UserRoleIds;y(Array.isArray(E)?E:[])},[m,l]);const z=f.useMemo(()=>{if(!Array.isArray(l)||!l.length)return{};const N={};for(const E of j){const P=l.find(g=>g?.ruleId===E.key||g?.ruleName===E.key||g?.RuleId===E.key||g?.ruleName===E.ruleName||g?.Name===E.ruleName),O=P?.userRoleIds??P?.UserRoleIds,W=Array.isArray(O)?O:[];W.length&&(N[E.key]=W)}return N},[l,j]),_=()=>{h(void 0),y([])},H=async()=>{if(!m){be.toast.info("Please select a rule");return}try{c(!0);const N=Array.isArray(l)?l.find(g=>g?.ruleId===m||g?.RuleId===m||g?.ruleName===m):void 0,E=typeof N?.recordId=="number"?N.recordId:N?.ruleId||N?.RuleId||void 0;if(!N||!E)throw new Error(`Unable to find rule identifier for rule ${m}`);const P=p.map(g=>{const v=t.find(M=>M.userRoleId===g);return{id:g,name:v?.userRoleName??String(g)}}),O={...N,ruleId:m,userRoleIds:p,userRoles:P},W=await n.updateRule(E,O);if(!W?.responseStatus&&!W?.Success&&!W?.success)be.toast.error(W?.errorMessage||W?.Message||"Error saving Alert Assignment");else{be.toast.success("Alert assignment saved"),h(void 0),y([]);try{const g=await n.getRules();u(Array.isArray(g)?g:[])}catch(g){console.error("Failed to refresh rules after save",g)}}}catch(N){console.error("Failed to save alert assignment",N),be.toast.error(N instanceof Error?N.message:"Error saving Alert Assignment")}finally{c(!1)}};return i.jsxs("div",{className:"w-full",children:[i.jsx(il,{level:4,className:"!mb-4",children:"Alert Assignment"}),i.jsx(d.Spin,{spinning:o||r,children:i.jsxs(d.Row,{gutter:[16,16],align:"bottom",className:"mb-6",children:[i.jsx(d.Col,{xs:24,sm:12,md:8,lg:6,children:i.jsxs("div",{children:[i.jsx(bs,{className:"text-gray-700 font-medium block mb-1",children:"Rules"}),i.jsx(d.Select,{placeholder:"Rules",value:m,onChange:h,options:I,className:"w-full"})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,lg:8,children:i.jsxs("div",{children:[i.jsx(bs,{className:"text-gray-700 font-medium block mb-1",children:"Alert Notification To"}),i.jsx(d.Select,{mode:"multiple",placeholder:"Select roles",className:"w-full",value:p,onChange:y,options:w,maxTagCount:1,maxTagPlaceholder:$s})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(d.Button,{onClick:_,disabled:o,children:"Cancel"}),i.jsx(d.Button,{type:"primary",onClick:H,loading:o,disabled:o||!m,children:"Save"})]})})]})}),i.jsx(d.Table,{rowKey:"key",dataSource:j,loading:r,pagination:{pageSize:10,showSizeChanger:!0,showTotal:(N,E)=>`${E[0]}-${E[1]} of ${N} items`},columns:[{title:"Rule Name",dataIndex:"ruleName",key:"ruleName"},{title:"Description",dataIndex:"ruleDesc",key:"ruleDesc"},{title:"Alert Notification To",key:"assign",render:(N,E)=>{const P=z[E.key]??[];return P.length?i.jsx("div",{className:"flex flex-wrap gap-1",children:P.map(O=>{const W=t.find(g=>g.userRoleId===O);return i.jsx(d.Tag,{children:W?.userRoleName??String(O)},O)})}):i.jsx(bs,{type:"secondary",children:"—"})}}]})]})}const{Title:Vn}=d.Typography;function ks(t){return!t||typeof t!="object"?{}:{level1UserRoleId:t.level1UserRoleId??t.Level1UserRoleId,level1PostAssistTime:t.level1PostAssistTime??t.Level1PostAssistTime,level2UserRoleId:t.level2UserRoleId??t.Level2UserRoleId,level2PostAssistTime:t.level2PostAssistTime??t.Level2PostAssistTime,level3UserRoleId:t.level3UserRoleId??t.Level3UserRoleId,level3PostAssistTime:t.level3PostAssistTime??t.Level3PostAssistTime,escalationSettingsActionTypeIds:t.escalationSettingsActionTypeIds??t.EscalationSettingsActionTypeIds,thirdPartyId:t.thirdPartyId??t.ThirdPartyId??t.ThirdPartyIds,humanLoop:t.humanLoop??t.HumanLoop,isAutoExpire:t.isAutoExpire??t.IsAutoExpire}}function ta({severities:t,rules:e,userRoles:s,rawRules:n,loadingRules:r,onSave:a}){const{rules:o,alerts:c}=Fe(),[l,u]=f.useState("By Severity"),[m,h]=f.useState("By severity"),[p,y]=f.useState("By Severity"),[w,I]=f.useState(!1),[j,z]=f.useState(!1),[_,H]=f.useState(!1),[N,E]=f.useState(null),[P,O]=f.useState("rules"),[W,g]=f.useState(),[v,M]=f.useState(),[he,ne]=f.useState(),[C,S]=f.useState(),[x,b]=f.useState(),[A,D]=f.useState(),[R,q]=f.useState(),[J,te]=f.useState(),[X,le]=f.useState([]),[we,ie]=f.useState([]),[ye,Ae]=f.useState(!1),[ue,de]=f.useState(!1),[Re,G]=f.useState({}),[L,Te]=f.useState({}),[ge,Oe]=f.useState(s||[]),[je,Be]=f.useState([]),[Ie,Ne]=f.useState(!1),[k,B]=f.useState(!1),[Y,pe]=f.useState(n||[]);f.useEffect(()=>{n&&n.length&&pe(n)},[n]),f.useEffect(()=>{if(!Y||!Y.length)return;const U=Object.keys(Re).length>0||Object.keys(L).length>0;if(je.length&&!U)return;const re=Y.map((Q,V)=>{const me=e.find(Ce=>Ce.RuleId===(Q.ruleId||Q.ruleName))?.Name||Q.ruleName||Q.Name||"-",Z=ks(Q.escalationSettings),ae=typeof Z.level1UserRoleId=="number"&&Z.level1UserRoleId>0?[Z.level1UserRoleId]:[],ds=typeof Z.level2UserRoleId=="number"&&Z.level2UserRoleId>0?[Z.level2UserRoleId]:[],ms=typeof Z.level3UserRoleId=="number"&&Z.level3UserRoleId>0?[Z.level3UserRoleId]:[],Xs=(Array.isArray(Z.escalationSettingsActionTypeIds)?Z.escalationSettingsActionTypeIds:[]).map(Ce=>Re[Ce]||String(Ce)),tn=(Array.isArray(Z.thirdPartyId)?Z.thirdPartyId:[]).map(Ce=>L[Ce]||String(Ce)),fs=typeof Z.humanLoop=="boolean"?Z.humanLoop:null,hs=typeof Z.isAutoExpire=="boolean"?Z.isAutoExpire:null;return{id:String(Q.ruleId||Q.ruleName||V),ruleOrSeverityLabel:me,l1:{minutes:Z.level1PostAssistTime??void 0,roles:ae},l2:{minutes:Z.level2PostAssistTime??void 0,roles:ds},l3:{minutes:Z.level3PostAssistTime??void 0,roles:ms},actions:Xs,notify:tn,humanLoop:fs,isAutoExpire:hs}});Be(re)},[Y,e,Re,L]);const ke=f.useMemo(()=>t.map(U=>({label:U.DisplayName,value:U.SeverityId})),[t]),oe=f.useMemo(()=>e.map(U=>({label:U.Name,value:U.RuleId})),[e]),$e=f.useMemo(()=>ge.map(U=>({label:U.userRoleName,value:U.userRoleId})),[ge]),fe=f.useMemo(()=>[1,3,5,10,15,20,30,45,60].map(U=>({label:`${U}`,value:U})),[]);f.useEffect(()=>{let U=!1;async function re(){try{H(!0),E(null);const Q=await c.getAdminSettings();if(!U&&Q){const V=qn(Q.sortBy);u(V),y(V),I(!1)}}catch(Q){if(!U){const V=Q instanceof Error?Q.message:"Failed to load admin settings";E(V)}}finally{U||H(!1)}}return re(),()=>{U=!0}},[]),f.useEffect(()=>{if(!v)return;const U=me=>{const Z=Number(me);return!isNaN(Z)&&Z>0?Z:void 0},re=me=>{const Z=Number(me);return!isNaN(Z)&&Z>0?Z:void 0},Q=(Y||[]).find(me=>me?.ruleId===v||me?.ruleName===v||me?.RuleId===v),V=ks(Q?.escalationSettings);if(V&&typeof V=="object"){ne(re(V.level1PostAssistTime)),S(U(V.level1UserRoleId)),b(re(V.level2PostAssistTime)),D(U(V.level2UserRoleId)),q(re(V.level3PostAssistTime)),te(U(V.level3UserRoleId));const me=Array.isArray(V.escalationSettingsActionTypeIds)?V.escalationSettingsActionTypeIds:[];le(me.map(Z=>String(Z))),ie(Array.isArray(V.thirdPartyId)?V.thirdPartyId:[]),Ae(!!V.humanLoop),de(!!V.isAutoExpire)}},[P,v,Y]);const Ze=async()=>{try{B(!0);const U=await o.getRules(),re=Array.isArray(U)?U:Array.isArray(U?.data)?U.data:[];pe(re);const Q=re.map((V,me)=>{const Z=e.find(Ce=>Ce.RuleId===(V.ruleId||V.ruleName))?.Name||V.ruleName||V.Name||"-",ae=ks(V.escalationSettings??V.EscalationSettings),ds=typeof ae.level1UserRoleId=="number"&&ae.level1UserRoleId>0?[ae.level1UserRoleId]:[],ms=typeof ae.level2UserRoleId=="number"&&ae.level2UserRoleId>0?[ae.level2UserRoleId]:[],Ks=typeof ae.level3UserRoleId=="number"&&ae.level3UserRoleId>0?[ae.level3UserRoleId]:[],en=(Array.isArray(ae.escalationSettingsActionTypeIds)?ae.escalationSettingsActionTypeIds:[]).map(Ce=>Re[Ce]||String(Ce)),fs=(Array.isArray(ae.thirdPartyId)?ae.thirdPartyId:[]).map(Ce=>L[Ce]||String(Ce)),hs=typeof ae.humanLoop=="boolean"?ae.humanLoop:null;return{id:String(V.ruleId||V.ruleName||me),ruleOrSeverityLabel:Z,l1:{minutes:ae.level1PostAssistTime??void 0,roles:ds},l2:{minutes:ae.level2PostAssistTime??void 0,roles:ms},l3:{minutes:ae.level3PostAssistTime??void 0,roles:Ks},actions:en,notify:fs,humanLoop:hs}});Be(Q)}catch(U){console.error("Failed to refetch entries",U)}finally{B(!1)}};f.useEffect(()=>{let U=!1;return(async()=>{try{const re=await o.getLookups();if(U||!re)return;const Q={};if(Array.isArray(re.thirdParties))for(const me of re.thirdParties){const Z=me.thirdPartyIds??me.thirdPartyId;typeof Z=="number"&&(Q[Z]=me.thirdPartyName)}Te(Q);const V=Array.isArray(re.userRoles)?re.userRoles.map(me=>({userRoleId:me.userRoleId??me.id,userRoleName:me.userRoleName??me.name})):[];U||Oe(V.length?V:s||[])}catch(re){console.error("Error loading lookups",re)}})(),()=>{U=!0}},[]);const oa=async()=>{z(!0);try{const U=await c.setAdminSettings({sortBy:l,groupBy:"string"});U?.responseStatus&&U?.data&&be.toast.success(U.data),y(l),I(!1)}catch(U){console.error("Error saving admin settings",U)}finally{z(!1)}},la=()=>{u(p),I(!1)},ca=async()=>{Ne(!0),a?.({ruleId:v,levels:[{minutes:he,role:C},{minutes:x,role:A},{minutes:R,role:J}],actions:X,thirdPartyIds:we,humanLoop:ye,isAutoExpire:ue});try{if(v){const re=Array.isArray(X)?X.map(ae=>Number.isNaN(Number(ae))?ae:Number(ae)):[],Q=(Y||[]).find(ae=>ae?.ruleId===v||ae?.ruleName===v||ae?.RuleId===v),V=typeof Q?.recordId=="number"?Q.recordId:Q?.ruleId||Q?.RuleId||void 0;if(!Q||!V){be.toast.error("Unable to find rule identifier for update");return}const me={...Q,escalationSettings:{level1UserRoleId:C??0,level1PostAssistTime:he??0,level2UserRoleId:A??0,level2PostAssistTime:x??0,level3UserRoleId:J??0,level3PostAssistTime:R??0,escalationSettingsActionTypeIds:re,thirdPartyId:Array.isArray(we)?we:[],humanLoop:ye,isAutoExpire:ue}},Z=await o.updateRule(V,me);Z?.responseStatus||Z?.Success||Z?.success?(be.toast.success("Escalation settings saved"),await Ze(),M(void 0),ne(void 0),S(void 0),b(void 0),D(void 0),q(void 0),te(void 0),le([]),ie([]),Ae(!1),de(!1)):be.toast.error(Z?.errorMessage||Z?.Message||"Error saving Escalation Settings")}}catch(re){console.error("Error saving escalation settings",re)}finally{Ne(!1)}},ua=()=>{u("By Severity"),h("By severity"),O("rules"),g(void 0),M(void 0),ne(void 0),S(void 0),b(void 0),D(void 0),q(void 0),te(void 0),le([]),ie([]),Ae(!1),de(!1)};return i.jsxs("div",{className:"w-full",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx(Vn,{level:4,className:"!mb-2",children:"Admin Settings"}),i.jsxs(d.Spin,{spinning:_,children:[N?i.jsxs("div",{className:"text-sm text-red-600 mb-2",children:["Failed to load settings: ",N]}):null,i.jsx(nl,{sortBy:l,groupBy:m,onChange:U=>{U.sortBy&&(u(U.sortBy),I(!0)),U.groupBy&&(h(U.groupBy),I(!0))},showActions:w,onSave:oa,onClear:la,saving:j})]})]}),i.jsx(d.Divider,{className:"my-6"}),i.jsxs("div",{children:[i.jsx(Vn,{level:4,className:"!mb-4",children:"Escalation Settings"}),i.jsx(rl,{escBasis:P,setEscBasis:O,selectedSeverity:W,setSelectedSeverity:g,selectedRule:v,setSelectedRule:M,severityOptions:ke,ruleOptions:oe,minsOptions:fe,roleOptions:$e,l1mins:he,setL1mins:ne,l1role:C,setL1role:S,l2mins:x,setL2mins:b,l2role:A,setL2role:D,l3mins:R,setL3mins:q,l3role:J,setL3role:te,actions:X,setActions:le,thirdPartyIds:we,setThirdPartyIds:ie,humanLoop:ye,setHumanLoop:Ae,onClear:ua,onSave:ca,saving:Ie,onActionTypesLoaded:U=>{const re={};for(const Q of U)typeof Q.actionTypeId=="number"&&(re[Q.actionTypeId]=Q.name);G(re)},isAutoExpire:ue,setAutoExpire:de})]}),i.jsx(d.Divider,{className:"my-6"}),i.jsx(al,{entries:je,userRoles:ge,loading:k||r,onEdit:U=>{O("rules");const re=je.find(V=>V.id===U),Q=e.find(V=>V.RuleId===U)||(re?e.find(V=>V.Name===re.ruleOrSeverityLabel):void 0);M(Q?Q.RuleId:U)}}),i.jsx(d.Divider,{className:"my-6"}),i.jsx(ea,{userRoles:ge,rules:e,rawRules:n}),i.jsx(d.Divider,{})]})}const{Title:Bn,Text:Gt}=d.Typography;function ol({severities:t,rules:e,onSave:s,onCancel:n}){const{rules:r,alerts:a}=Fe(),o=[{label:"By Severity",value:"By Severity"},{label:"By Created Date",value:"By Created Date"}],[c,l]=f.useState("By Severity"),[u,m]=f.useState(new Set),[h,p]=f.useState(null),[y,w]=f.useState(null),[I,j]=f.useState({inApp:!1,sms:!1,email:!1}),[z,_]=f.useState([]),[H,N]=f.useState(!0),[E,P]=f.useState(!1);f.useEffect(()=>{let g=!1;return(async()=>{try{const v=await a.getPreferenceSettings();if(g||!v)return;j({inApp:!!v.inApp,sms:!!v.sms,email:!!v.email});const M=qn(v.sortBy);l(M==="By Created Date"?"By Created Date":"By Severity"),p(cn(v.doNotDisturbStart)),w(cn(v.doNotDisturbEnd)),Array.isArray(v.anomalyIds)&&m(new Set(v.anomalyIds.map(he=>String(he))))}catch(v){console.error("Error in loading my preferences: ",v)}})(),()=>{g=!0}},[]),f.useEffect(()=>{let g=!1;return(async()=>{try{N(!0);const v=await r.getLookups();if(g||!v)return;const M=Array.isArray(v.anomalies)?v.anomalies:[];_(M)}catch(v){console.error("Failed to load anomalies lookups",v)}finally{g||N(!1)}})(),()=>{g=!0}},[]);const O=g=>{m(v=>{const M=new Set(v);return M.has(g)?M.delete(g):M.add(g),M})},W=async()=>{s?.({sortBy:c,subscribedRuleIds:Array.from(u),dnd:{from:h,to:y},channels:I});try{P(!0);const g=h?h.format?.("HH:mm:ss")??"00:00:00":"00:00:00",v=y?y.format?.("HH:mm:ss")??"00:00:00":"00:00:00",M=Array.from(u).map(ne=>Number(ne)).filter(ne=>Number.isFinite(ne)),he=await a.setPreferenceSettings({anomalyIds:M,doNotDisturbStart:g,doNotDisturbEnd:v,inApp:!!I.inApp,sms:!!I.sms,email:!!I.email,sortBy:c});he?.responseStatus&&be.toast.success(he?.data||"Preferences updated successfully.")}catch(g){console.error("Error in saving my preferences: ",g)}finally{P(!1)}};return i.jsxs("div",{className:"w-full",children:[i.jsx(d.Row,{gutter:[16,16],align:"middle",className:"mb-4",children:i.jsx(d.Col,{xs:24,md:8,children:i.jsxs(d.Space,{direction:"horizontal",size:12,className:"w-full items-center",children:[i.jsx(Gt,{className:"text-gray-600",children:"Sort By:"}),i.jsx(d.Select,{className:"w-[240px]",value:c,options:o,onChange:l})]})})}),i.jsxs("div",{className:"mb-4",children:[i.jsx(Bn,{level:5,className:"!mb-2",children:"Anomalies"}),H?i.jsx("div",{className:"py-4",children:i.jsx(d.Spin,{})}):i.jsx(d.Space,{direction:"vertical",size:10,className:"w-full",children:(Array.isArray(z)?z:[]).map(g=>{const v=String(g.recordId),M=g.anomalyName;return i.jsx(d.Checkbox,{checked:u.has(v),onChange:()=>O(v),children:M},v)})})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx(Bn,{level:5,className:"!mb-2",children:"Notification Timing & Channels"}),i.jsx(d.Row,{gutter:[16,16],align:"middle",className:"mb-3",children:i.jsx(d.Col,{xs:24,md:12,children:i.jsxs(d.Space,{direction:"horizontal",size:12,className:"w-full items-center",children:[i.jsx(Gt,{children:"Do Not Disturb mode:"}),i.jsxs(d.Space,{size:12,className:"w-full",children:[i.jsxs(d.Space,{direction:"horizontal",size:8,className:"items-center",children:[i.jsx(Gt,{children:"From"}),i.jsx(d.TimePicker,{value:h,onChange:g=>p(g),format:"HH:mm"})]}),i.jsxs(d.Space,{direction:"horizontal",size:8,className:"items-center",children:[i.jsx(Gt,{children:"To"}),i.jsx(d.TimePicker,{value:y,onChange:g=>w(g),format:"HH:mm"})]})]})]})})}),i.jsxs(d.Row,{gutter:[24,12],children:[i.jsx(d.Col,{children:i.jsx(d.Checkbox,{checked:I.inApp,onChange:g=>j({...I,inApp:g.target.checked}),children:"In-app"})}),i.jsx(d.Col,{children:i.jsx(d.Checkbox,{checked:I.sms,onChange:g=>j({...I,sms:g.target.checked}),children:"SMS"})}),i.jsx(d.Col,{children:i.jsx(d.Checkbox,{checked:I.email,onChange:g=>j({...I,email:g.target.checked}),children:"Email"})})]})]}),i.jsx(d.Divider,{}),i.jsxs(d.Space,{className:"gap-3",children:[i.jsx(d.Button,{onClick:n,disabled:E,children:"Cancel"}),i.jsx(d.Button,{type:"primary",onClick:W,loading:E,children:"Save"})]})]})}function sa({severities:t,rules:e,userRoles:s,rawRules:n,loadingRules:r}){return i.jsx("div",{className:"w-full",children:i.jsx(ta,{severities:t,rules:e,userRoles:s,rawRules:n,loadingRules:r})})}const ll="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIZSURBVHgBnZW/b9NAFMe/z3H6i1ZNJUBFQsL/QQkLCFBtRhhKF1ibhBmpXbtgFlYqsTG0gRGWwgAjMb8EYmjYGN0pCCrVVaX+SBxf37PiqHWcOu5Xsux79+6j77vz3RH66IbdsDTQPCFngmBwqMCPBwVXoe204Fd/2ZfrSWMpHrDshtGCvsY9FlKkFNYD+Es/7EtuX+itp1sLnLrScTWoPMYsfnty/lUPtAOs4syiUgQOoWHJpG9kdBiX11Z+UaZCk1YT+vOzACuzYxgf7hZbyBGvhTi9af+7SkQbyKi7M8N4ZJ5D+eU2dg9UN07KvyNOS8io6UkNFXMMj1/vnACKAuTmNXZpIqME+LF+iIbX7ukjkClODWTQw+ujuGYMYfXzXnICbxSBDrxAUvYDhkrZp6ggUC8+sDI7mpj9YmESb3/uJ5Z9TJ5A3eORvzsBpgs6lufGT2TKPNY3fbxh6Knis0FTSjnx+LP3u5DJicDi/t7MCFadPaRJQTl02/5vKcKnpITluYkwrWjksebs48Pvg3SoUkXtq32hxt+1pITI8Zc/zcGACN59ty/WdWnklV5ukZ+49wU8MUJIF3mBGlqUr3Dv1+wpl20v9UuP75pElyrgc3XK7UJFbLvK4DJiv9ggDmWcjO9G4imWvW00yV/hjvtpOFnpQOVLkcO+0EhyevGrROG1ol1hREFc8ZGxyddIje+v9c4i9+gI5z7MozLxclgAAAAASUVORK5CYII=",cl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKeSURBVHgBjVVdbtpAEJ5ZmygPfTBSaVWpUt0bwFuURgJOUG5QeoLACbw+QeAEwA3SGxgJokh9CDeI+xSpTRU/Imw8nbFZx6QQGAl5d2fm229+dkDYI2f6oaUAOwhWExBcPnL4FwFBSLCexpCMf+qPi12++PKgpR/cGOwRa1pwQIjgOoWkf6s/hOVzVd588R+/xWjf5YAY8Y0+ErQrZFfnXg3lK3uGm7A+RISOxfbit5NprqBxxgBoeEIVHehqtI9lSz+5McaaITaA2J17bycFaBayMOS8IaT+zHuv4Ui58P9oAvB4Ga0paUgqbFGswL5idIcIx3P9DCiXrQB7iJawcTiCkMMIUlj7Jo8zr6Yv/EfRXXIqRnzUxnP9u46Id8Q5Sslq3+pqWErHAPKqvxROC/ZMuJwKJ8bkPouUkrYUqgt5IgMDKAxfAYT8nAZnmR2A5J47YSjrFKyOYpZN2SiIJ8YjRqVfASyAFVg9s2F2gXwRsClMXdnYcFpq5PyiQ8KEilaywc79+aEow2i7fdCF46SIpuTvCGi2kWSXjCM4QqS4Zl3yjwQ0UySwrBfGRJNjQKW4ZrmEpL45CxUDTGWdgmoZgxOoDA6zxYgr7ZudhWk3x6Sp4kl0nZmgujQhcH5Cvqy/Hxi5hdL+dgsWxR2rma4FkLeDw+PMM243+t2YB0jDDI9nMBquyWqI3tjmLYguQfqDzxebty/DIcnePr9jfePVfDhSzv2/Hs8LAY3kMmFfTCl+rl3uu1GWF6Jx+X3vkpa+58jeeNyXvY3Pd8N+a0hvgK9ge3hMTmG5CPTnSICWcFpXaDfZUcAck99yOnZM/id3hcmAFV/hgEilU6p0TcH2gpZYS98xc/kXUJ8YImPFzfeLh0cgXbMp8n/yD3ySPZSK0MWKAAAAAElFTkSuQmCC";function cs(){const{config:t}=Fe();return{timeZoneDetails:f.useMemo(()=>{const s=t.timeZone||Intl.DateTimeFormat().resolvedOptions().timeZone;return{timeZoneUniqueId:"",ianaTimeZoneId:s,timeZoneName:s,offset:""}},[t.timeZone]),loading:!1}}function ul(t){const e=(t.status||"").toLowerCase()==="completed"?i.jsx("img",{src:ll,alt:"completed",style:{width:20,height:20}}):i.jsx("img",{src:cl,alt:"pending",style:{width:20,height:20}});return{title:i.jsxs("div",{className:"flex flex-col gap-0 min-w-0",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"block text-sm break-words mb-1 overflow-visible whitespace-normal",children:i.jsx("b",{children:t.title})}),t.description?i.jsx("span",{className:"text-gray-500 text-xs",children:t.description}):null]}),t.timestamp?i.jsx("span",{className:"text-gray-500 text-xs",children:t.timestamp}):null]}),icon:e,description:null}}function dl({data:t}){const{timeZoneDetails:e}=cs();return console.log("summary",t),i.jsx("div",{className:"w-full",children:i.jsx(d.Tabs,{type:"card",items:[{key:"action",label:"Action Taken",children:i.jsxs("div",{className:"w-full",style:{maxHeight:"50vh",overflowY:"auto"},children:[i.jsx(d.Card,{className:"mb-4 rounded-md p-4",bordered:!0,children:i.jsxs("div",{className:"grid grid-cols-4 gap-6 text-xs",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-gray-500",children:"Alert ID"}),i.jsx("span",{className:"text-black",children:t.summary.alertNumber})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-gray-500",children:"Severity"}),i.jsx("span",{className:"text-black",children:t.summary.severity})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-gray-500",children:"Location"}),i.jsx("span",{className:"text-black",children:t.summary.location})]})]})}),i.jsxs(d.Card,{className:"rounded-md p-4",bordered:!0,children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("h4",{className:"text-sm text-black font-medium",children:"Response Timeline/ Audit trail/log"})}),i.jsx("div",{className:"mt-2",children:i.jsx(d.Steps,{direction:"vertical",size:"small",current:1,items:(t.timeline||[]).map(ul)})})]})]})},{key:"notification",label:"Notification Sent",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",style:{maxHeight:"50vh",overflowY:"auto"},children:[(t.notifications||[]).map((s,n)=>i.jsxs(d.Card,{className:"rounded-md p-4",bordered:!0,children:[i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("h4",{className:"text-sm text-black font-medium",children:s.channelLabel}),i.jsx("span",{className:"text-xs text-gray-500 mt-1",children:ss(s.sentAt,e?.ianaTimeZoneId)})]}),i.jsxs("span",{className:"text-[11px] px-2 py-1 rounded-full bg-green-50 text-green-700 border border-green-200",children:[s.delivered,"/",s.total," Delivered"]})]}),i.jsxs("div",{className:"mt-4 text-xs",children:[i.jsxs("div",{className:"text-black",children:[" ",s.messageTitle]}),s.messageBody?i.jsx("div",{className:"text-gray-600",children:s.messageBody}):null]}),i.jsxs("div",{className:"mt-4",children:[i.jsxs("div",{className:"text-xs text-black font-medium",children:["Recipients (",s.total,")"]}),i.jsx("div",{className:"mt-2 flex flex-col gap-3 text-xs",children:(s.recipients||[]).map((r,a)=>{const o=String(r?.notificationReceipientType||"").toLowerCase()==="EscalationNotification".toLowerCase();return i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("span",{className:"text-black",children:[r.name," - ",i.jsx("span",{style:{color:o?"#FF3B30":"#FFB86A"},children:o?"Escalation Notification":"Alert Notification"})]}),i.jsxs("span",{className:"text-gray-500",children:[r.role," . ",r.phone]})]}),i.jsx("span",{className:`text-[11px] px-3 py-[2px] rounded ${r.status==="Delivered"?"bg-green-50 text-green-700 border border-green-200":"bg-red-50 text-red-700 border border-red-200"}`,children:r.status})]},a)})})]})]},n)),t?.notifications?.length?null:i.jsx("span",{className:"text-gray-500 text-xs",children:"No notifications."})]})}]})})}const ml=({alertId:t,id:e,priority:s,spaceName:n,alertNumber:r,statusHistory:a,notifGroups:o})=>{const c={alertId:t??String(e??""),incidentId:"-",severity:s||"",location:n||"",alertNumber:r??""},{timeZoneDetails:l}=cs(),u=a?.length?a.map(h=>{const p=(h?.status||h?.eventStatus||"").toLowerCase()==="completed"?"Completed":"Inprogress",y=h?.createdDate?ss(h.createdDate,l?.ianaTimeZoneId):h?.timestamp?ss(h.timestamp,l?.ianaTimeZoneId):"";return{status:p,title:h?.status||h?.eventStatus||"Status Update",description:h?.description||h?.actionNotes||"",timestamp:y}}):[],m={summary:c,timeline:u,notifications:o??[]};return i.jsx(dl,{data:m})};const fl=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hl=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,s,n)=>n?n.toUpperCase():s.toLowerCase()),Zn=t=>{const e=hl(t);return e.charAt(0).toUpperCase()+e.slice(1)},na=(...t)=>t.filter((e,s,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===s).join(" ").trim(),yl=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var gl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const pl=f.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:s=2,absoluteStrokeWidth:n,className:r="",children:a,iconNode:o,...c},l)=>f.createElement("svg",{ref:l,...gl,width:e,height:e,stroke:t,strokeWidth:n?Number(s)*24/Number(e):s,className:na("lucide",r),...!a&&!yl(c)&&{"aria-hidden":"true"},...c},[...o.map(([u,m])=>f.createElement(u,m)),...Array.isArray(a)?a:[a]]));const us=(t,e)=>{const s=f.forwardRef(({className:n,...r},a)=>f.createElement(pl,{ref:a,iconNode:e,className:na(`lucide-${fl(Zn(t))}`,`lucide-${t}`,n),...r}));return s.displayName=Zn(t),s};const Sl=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],xl=us("image-off",Sl);const wl=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],vl=us("loader-circle",wl);const Al=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],ra=us("maximize-2",Al);const Tl=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Nl=us("minimize-2",Tl),bl=({isOpen:t,onClose:e,src:s,type:n="image"})=>{const[r,a]=f.useState(!1),[o,c]=f.useState(!1);return f.useEffect(()=>{t&&c(!1)},[t,s]),f.useEffect(()=>{t&&(!s||o)&&e()},[t,s,o,e]),t?i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-70",role:"button",tabIndex:0,"aria-label":"Close media preview",onClick:e,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),e())},onTouchStart:e,children:i.jsxs("div",{className:`relative ${r?"w-full h-full":"max-w-5xl max-h-[90vh] w-full"} flex items-center justify-center`,onClick:l=>l.stopPropagation(),children:[n==="image"?i.jsx("img",{src:s,alt:"preview",className:`object-contain rounded-lg shadow-lg ${r?"w-full h-full":"max-w-full max-h-[90vh]"}`,onError:()=>c(!0)}):i.jsx("video",{src:s,controls:!0,className:`object-contain rounded-lg shadow-lg ${r?"w-full h-full":"max-w-full max-h-[90vh]"}`,onError:()=>c(!0)}),i.jsx("button",{onClick:e,className:"absolute top-3 right-3 text-white bg-black/50 rounded-full p-2 hover:bg-black/70",children:"✕"}),i.jsx("button",{onClick:()=>a(!r),className:"absolute bottom-3 right-3 text-white bg-black/50 rounded-full p-2 hover:bg-black/70",children:r?i.jsx(Nl,{size:20}):i.jsx(ra,{size:20})})]})}):null};function kl(t){if(!t||typeof t!="string")return!1;const e=t.split("?")[0].toLowerCase();return e.endsWith(".mp4")||e.endsWith(".webm")||e.endsWith(".ogg")||e.endsWith(".m3u8")}function zn(t){const e=(t?.mediaType||t?.type||"").toString().toLowerCase();return e==="video"||e==="mp4"?!0:kl(t?.mediaUrl||t)}function Il(t){const e=t?.mediaUrl;let s=null;if(Array.isArray(e))s=e;else if(typeof e=="string")try{const n=JSON.parse(e);Array.isArray(n)&&(s=n)}catch{}return s&&s.length>0?s.map(n=>({...t,mediaUrl:n})):[t]}function Ml(t){const e=t;return e?(Array.isArray(e)?e:[e]).flatMap(Il):[]}const El={Critical:"#FF3B30",High:"#FFB86A",Medium:"#FFCC00",Low:"#007AFF"},Ol={Critical:"#FFE2E2",High:"#FF95004D",Medium:"#FEF9C2",Low:"#E0EDFF"},jl=({isModalOpen:t,handleModalClose:e,selectedRow:s,fetchAlertLogs:n,alertStatusList:r=[],alertStatusLoading:a=!1,initialTab:o="details",sourceTab:c})=>{const[l,u]=f.useState(),[m,h]=f.useState(""),[p,y]=f.useState(!1),w=f.useRef(null),[I,j]=f.useState("details"),[z,_]=f.useState(void 0),H=Bs(),{alerts:N}=Fe(),{timeZoneDetails:E}=cs(),[P,O]=f.useState(!1),[W,g]=f.useState(void 0),[v,M]=f.useState(void 0),[he,ne]=f.useState({}),[C,S]=f.useState({}),x=(k,B,Y)=>{const pe=C[k];return he[k]===!1&&!pe?i.jsxs("div",{className:"w-full flex flex-col items-center justify-center min-h-[200px] bg-gray-100 rounded-lg gap-2 text-gray-400",children:[i.jsx(xl,{size:40}),i.jsx("span",{className:"text-sm",children:"Media not available"})]}):i.jsxs("div",{className:"relative w-full flex justify-center items-center min-h-[200px]",children:[pe&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-100 rounded-lg z-10",children:i.jsx(vl,{size:32,className:"animate-spin text-gray-400"})}),i.jsx("img",{src:k,alt:B.caption||`media-${Y}`,className:`max-w-full max-h-[90vh] object-contain rounded-lg shadow-lg transition-opacity duration-200 ${pe?"opacity-0":"opacity-100"}`,onLoad:()=>S(ke=>({...ke,[k]:!1})),onError:()=>S(ke=>({...ke,[k]:!1}))},k)]})},b=s?.originalData||{},{eventName:A,alertId:D,timestamp:R,description:q,spaceName:J,assignTeam:te,priority:X,statusType:le,id:we,alertDetails:ie,statusHistory:ye,mediaDetails:Ae,alertNumber:ue}=b,de=k=>{const B=String(k||"").toLowerCase();return B==="delivered"||B==="sent"?"Delivered":B==="failed"?"Failed":"Queued"},Re=k=>({name:k?.receipientName||k?.recipientName||"-",role:k?.receipientRoleName||"",phone:k?.receipentPhoneNumber||k?.recipientPhoneNumber||k?.receipientEmail||k?.recipientEmail||"",status:de(k?.messageStatus),notificationReceipientType:k?.notificationReceipientType||""}),G=(k,B)=>{const Y=B.map(Re),pe=Y.filter(fe=>fe.status==="Delivered").length,ke=B.map(fe=>fe?.sentAt).filter(Boolean).sort((fe,Ze)=>new Date(Ze).getTime()-new Date(fe).getTime())[0],oe=B[0]||{},$e=[oe?.severityName,oe?.anomalyName].filter(Boolean).join(" - ")||`${k} Notification`;return{channelLabel:`${k} Notification`,sentAt:ke||"",messageTitle:$e,messageBody:"",total:Y.length,delivered:pe,recipients:Y}},L=k=>{const B=new Map;return(k||[]).forEach(Y=>{const pe=String(Y?.notificationType||"Unknown"),ke=B.get(pe)||[];ke.push(Y),B.set(pe,ke)}),Array.from(B.entries()).map(([Y,pe])=>G(Y,pe))},Te=async k=>{try{const B=await N.getAlertNotifications(k),Y=L(B);_(Y)}catch{_(void 0)}};f.useEffect(()=>{if(I!=="track"||!we)return;let k=!1;return Te(we).then(()=>{k&&_(void 0)}),()=>{k=!0}},[I,we]),f.useEffect(()=>{t&&j(o)},[t,o]);const Oe=c==="archived"||["completed","false positive"].includes(String(le||"").toLowerCase()),je=k=>{const B=String(k?.value||"").toLowerCase(),Y=String(k?.statusName||"").toLowerCase();return B.includes("reopen")||Y.includes("reopen")},Be=(r||[]).filter(k=>{const B=je(k);return typeof c<"u"?c==="archived"?B:!B:Oe?B:!B}).map(k=>({value:k.value,label:k.statusName})),Ie=f.useMemo(()=>Ml(Ae),[Ae]);f.useEffect(()=>{let k=!1;const B=new AbortController,Y=async oe=>{if(oe){k||ne($e=>({...$e,[oe]:!1}));try{const $e=await fetch(oe,{method:"HEAD",signal:B.signal});if($e.ok){k||ne(Ze=>({...Ze,[oe]:!0}));return}if($e.status===404){k||ne(Ze=>({...Ze,[oe]:!1}));return}if(!(await fetch(oe,{method:"GET",signal:B.signal})).ok)throw new Error("Media not available");k||ne(Ze=>({...Ze,[oe]:!0}))}catch{k||ne($e=>({...$e,[oe]:!1}))}}};ne({});const pe=Ie.filter(oe=>!zn(oe)).map(oe=>oe?.mediaUrl||oe).filter(oe=>typeof oe=="string"&&oe.length>0),ke={};return pe.forEach(oe=>{ke[oe]=!0}),S(ke),pe.forEach(oe=>Y(oe)),()=>{k=!0,B.abort()}},[Ie]);const Ne=async()=>{try{y(!0);const k={alertUniqueId:D,alertId:we,status:l?String(l):void 0,notes:m.trim(),modifiedBy:0},B=await H.mutateAsync(k);if(B?.responseStatus||B?.Success){const Y=B?.Message||B?.data||"Alert updated successfully.";be.toast.success(Y,{autoClose:1500,onClose:()=>{n(),e()}}),u(void 0),h("")}else{const Y=B?.errorMessage||B?.Message||"Failed to update alert status";be.toast.error(Y)}}catch(k){console.error("Error updating alert status:",k),be.toast.error("Failed to update alert status. Please try again.")}finally{y(!1)}};return i.jsx(d.Modal,{open:t,onCancel:e,width:1e3,footer:I==="details"?i.jsxs("div",{className:"flex flex-row gap-2 justify-start",children:[i.jsx(d.Button,{onClick:e,className:"bg-[#6C757D] text-white",children:"Cancel"}),i.jsx(d.Button,{type:"primary",onClick:Ne,loading:p,children:p?"Saving...":"Save Changes"})]}):null,children:s&&i.jsx(d.Tabs,{activeKey:I,onChange:k=>j(k),items:[{key:"details",label:"Alert Detail",children:i.jsxs("div",{className:"grid grid-cols-2 gap-2",style:{maxHeight:"50vh",overflowY:"auto"},children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("div",{className:"text-sm font-bold",children:A||"Alert Event"}),ie?.firstName?i.jsxs("div",{className:"text-sm text-gray-500",children:["Resident ID/Name: ",ie?.firstName," ",ie?.lastName||"","   ",ie?.residentId||""]}):null,i.jsxs("div",{className:"text-sm text-gray-500",children:["Timestamp: ",ss(R,E?.ianaTimeZoneId)]}),i.jsxs("div",{className:"font-sm text-gray-500",children:[i.jsx("b",{className:"text-black text-sm/6",children:"Description:"})," ",q||"No description available"]}),J&&i.jsxs("div",{className:"font-sm text-gray-500",children:["Space: ",J]}),te&&i.jsxs("div",{className:"font-sm text-gray-500",children:["Assigned to: ",te]}),i.jsxs("div",{className:"flex gap-2 justify-start mt-3",children:[i.jsxs(d.Tag,{className:"font-sm text-gray-500 rounded-[8px] py-2 px-3",style:{border:`2px solid ${El[String(X)]||"#DFE4EA"}`,backgroundColor:Ol[String(X)]},children:["Severity: ",X||"N/A"]}),i.jsxs(d.Tag,{className:"font-sm text-gray-500 rounded-[8px] py-2 px-3",style:String(le||"").toLowerCase()==="completed"?{background:"#E7F6EC",border:"0.68px solid var(--Green, #34C759)"}:{background:"#E0EDFF",border:"1px solid var(--Grays-Gray-4, #D1D1D6)"},children:["Status: ",le||"N/A"]})]}),i.jsx("div",{className:"w-full flex flex-col justify-start items-start mt-2 font-bold",children:i.jsxs("div",{className:"w-full mt-4",children:[i.jsx("div",{className:"flex flex-col gap-2",children:i.jsx(d.Select,{placeholder:"Change Status",className:"w-full text-gray-500",onChange:k=>u(k),value:l,options:Be,loading:a})}),i.jsxs("div",{className:"flex flex-col gap-2 mt-3",children:[i.jsx("label",{htmlFor:"action-details-input",className:"text-xs text-gray-500 font-medium",children:"Action Taken (Comments)"}),i.jsx("textarea",{id:"action-details-input",placeholder:"Enter details...",className:"w-full text-gray-500 h-20 border border-grey-500 rounded-md p-2",value:m,onChange:k=>h(k.target.value)})]})]})})]}),i.jsx("div",{className:"flex flex-col gap-4",children:i.jsxs("div",{className:"w-full mt-1",children:[i.jsxs("div",{className:"w-full flex items-center justify-between",children:[i.jsx("h3",{className:"text-black font-bold text-sm",children:"Camera Footage"}),Ie.length>1?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>w.current?.prev?.(),className:"w-6 h-6 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 text-gray-600","aria-label":"Previous media",children:i.jsx(dt.LeftOutlined,{style:{fontSize:12}})}),i.jsx("button",{type:"button",onClick:()=>w.current?.next?.(),className:"w-6 h-6 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 text-gray-600","aria-label":"Next media",children:i.jsx(dt.RightOutlined,{style:{fontSize:12}})})]}):null]}),Ie.length?i.jsx("div",{className:"w-full",children:i.jsx(d.Carousel,{ref:w,dots:!0,className:"w-full",children:Ie.map((k,B)=>{const Y=k.mediaUrl||k,pe=zn(k);return i.jsxs("div",{className:"flex justify-center items-center relative",children:[pe?i.jsxs("video",{width:"240",height:"200",controls:!0,className:"max-w-full max-h-[90vh] object-contain rounded-lg shadow-lg",children:[i.jsx("source",{src:Y}),"Your browser does not support the video tag."]}):x(String(Y),k,B),k.caption&&i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:k.caption}),!pe&&he[String(Y)]?i.jsx("button",{onClick:()=>{O(!0),g(Y),M(k.type||"image")},className:"absolute bottom-3 right-3 text-white bg-black/50 rounded-full p-2 hover:bg-black/70",children:i.jsx(ra,{size:20})}):null]},String(Y)||B)})})}):null]})}),i.jsx(bl,{isOpen:P,onClose:()=>O(!1),src:W||"",type:v||"image"})]})},{key:"track",label:"Track Incident",children:i.jsx(ml,{alertId:D,id:we,priority:X,spaceName:J,alertNumber:ue,statusHistory:ye,notifGroups:z})}]})})};function aa(){const{alerts:t}=Fe(),e=mt.useQuery({queryKey:["alerts","statusList"],queryFn:()=>t.getAlertStatusList(),staleTime:5*6e4});return{list:e.data??[],loading:e.isLoading,error:e.error,refetch:e.refetch}}function Qs({alerts:t,loading:e=!1,columns:s,total:n,currentPage:r,onRefetch:a,onPageChange:o,onFilterChange:c}){const[l,u]=f.useState(!1),[m,h]=f.useState(null),[p,y]=f.useState("details"),{list:w,loading:I}=aa(),{timeZoneDetails:j}=cs(),z=j?.timeZoneName??"UTC",_=j?.ianaTimeZoneId??"UTC";function H(W,g){h(W),y(g?.tab??"details"),P(g?.sourceTab??"active"),u(!0)}function N(){u(!1)}const[E,P]=f.useState("active"),O=m?{originalData:{...m,alertId:m.alertId??m.id,mediaDetails:m.mediaDetails}}:null;return i.jsxs("div",{className:"p-6 flex flex-col items-start justify-start min-h-screen w-full overflow-auto",children:[i.jsxs("div",{className:"w-full grid grid-cols-3 sm:grid-cols-1 items-center mb-4",children:[i.jsx("h1",{className:"text-xl font-bold text-black",children:"Alert Console"}),i.jsx("div",{className:"flex items-center justify-start sm:justify-center",children:i.jsx(Xr,{label:z,timeZone:_})})]}),i.jsx(d.Tabs,{defaultActiveKey:"active",className:"w-full",tabBarStyle:{fontSize:"medium"},onChange:W=>{W==="active"&&a?.()},items:[{key:"active",label:"Active",children:i.jsx(Vs,{data:t,loading:e,pageSize:10,total:n,currentPage:r,columns:s||[],onAlertIdClick:H,onRefetch:a,onPageChange:o,onFilterChange:c})},{key:"archived",label:"Archived",children:i.jsx(Kr,{alerts:t,loading:e,columns:s||[],onAlertIdClick:H})},{key:"settings",label:"Settings",children:i.jsx(Cl,{})}]}),i.jsx(jl,{isModalOpen:l,handleModalClose:N,selectedRow:O,fetchAlertLogs:()=>{},alertStatusList:w,alertStatusLoading:I,initialTab:p,sourceTab:E})]})}function Cl(){const[t,e]=f.useState([]),[s,n]=f.useState([]),[r,a]=f.useState([]),[o,c]=f.useState([]),[l,u]=f.useState(!0),{rules:m}=Fe();return f.useEffect(()=>{let h=!0;return(async()=>{try{const p=await m.getRules();if(!h)return;c(Array.isArray(p)?p:[]);const y=(p||[]).map((w,I)=>({RuleId:w.ruleId||w.ruleName||String(I),Name:w.ruleName||w.Name||"-",Description:w.ruleDesc||w.Description||"",SeverityId:0}));e(y);try{const w=await m.getLookups(),I=Array.isArray(w?.userRoles)?w.userRoles.map(j=>({userRoleId:j.userRoleId??j.id,userRoleName:j.userRoleName??j.name})):[];n(I),a(Array.isArray(w?.severities)?w.severities:[])}catch{}}catch{}finally{h&&u(!1)}})(),()=>{h=!1}},[]),i.jsx(sa,{severities:r,rules:t,userRoles:s,rawRules:o,loadingRules:l})}function Dl(t){return Array.isArray(t)?{items:t}:t}function ia(t=1,e){const{alerts:s}=Fe(),n=mt.useQuery({queryKey:["alerts","list",t,e],queryFn:()=>s.listAlerts({pageNumber:t,pageSize:10,...e}).then(Dl),staleTime:3e4});return{alerts:n.data?.items??[],total:n.data?.total,loading:n.isLoading,error:n.error,refetch:n.refetch}}function Rl(t){const[e,s]=f.useState(1),[n,r]=f.useState({}),{alerts:a,total:o,loading:c,refetch:l}=ia(e,n);return i.jsx(Qs,{alerts:a,loading:c,columns:t.columns,total:o,currentPage:e,onRefetch:l,onPageChange:s,onFilterChange:r})}function Ul({tenant:t,apiDomain:e,rulesDomain:s,headers:n,timeZone:r,userManagementDomain:a,spacesBaseUrl:o,alerts:c,loading:l,columns:u}){const[m]=f.useState(()=>new mt.QueryClient),h=f.useMemo(()=>({alertsBaseUrl:e,rulesBaseUrl:s||e,headers:n||void 0}),[e,s,n]);return i.jsx(mt.QueryClientProvider,{client:m,children:i.jsx(_n,{tenant:t,override:h,timeZone:r,userManagementDomain:a,spacesBaseUrl:o,children:Array.isArray(c)?i.jsx(Qs,{alerts:c,loading:!!l,columns:u}):i.jsx(Rl,{columns:u})})})}function Ll(t){const{alerts:e}=Fe(),s=mt.useQuery({queryKey:["alerts","report",t],queryFn:()=>e.getAlertsReport(t),staleTime:6e4});return{data:s.data??[],loading:s.isLoading,error:s.error,refetch:s.refetch}}const Fl=[{title:"ID",dataIndex:"id",key:"id",width:120},{title:"Priority",dataIndex:"priority",key:"priority",width:120},{title:"Timestamp",dataIndex:"timestamp",key:"timestamp",width:220},{title:"Status",dataIndex:"statusType",key:"statusType",width:140},{title:"Description",dataIndex:"description",key:"description"}];exports.AlertAssignment=ea;exports.AlertConsole=Qs;exports.AlertConsoleWidget=Ul;exports.AlertsTable=Vs;exports.ApiProvider=_n;exports.ArchivedTable=Kr;exports.Clock=Xr;exports.DataTable=Jn;exports.MyPreferencesPanel=ol;exports.SettingsPanel=ta;exports.SettingsTabs=sa;exports.exampleAlertColumns=Fl;exports.useAlertStatusList=aa;exports.useAlerts=ia;exports.useAlertsReport=Ll;exports.useApi=Fe;exports.useUpdateAlertStatus=Bs;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),m=require("react"),d=require("antd"),ut=require("@ant-design/icons"),Ae=require("react-toastify"),dt=require("@tanstack/react-query"),da="#FF3B30",ma="#FF9500",fa="#FFCC00",ha="#34C759",Pt={critical:da,high:ma,medium:fa,low:ha},on={Critical:Pt.critical,High:Pt.high,Medium:Pt.medium,Low:Pt.low};function ya(t){return on[t]||on.Low}function ln(t){if(!t||typeof t!="string")return 0;const e=t.trim().split(":");if(e.length!==3)return 0;const[s,n,r]=e,a=Number.parseInt(s,10),o=Number.parseInt(n,10),c=Number.parseFloat(r||"0"),l=Number.isFinite(a)?a:0,u=Number.isFinite(o)?o:0,f=Number.isFinite(c)?c:0;return l*3600+u*60+f}function cn(t){const e=t.thirdPartyIds??t.ThirdPartyIds??t.thirdPartyId??t.ThirdPartyId??"",s=Array.isArray(e)?e.join(","):String(e??"");if(!s||!s.trim())return[];const n=s.split(",").map(o=>parseInt(String(o).trim(),10)).filter(o=>Number.isFinite(o)),r=new Set,a=[];return n.forEach(o=>{r.has(o)||(r.add(o),a.push(o))}),a}const _n="",pa=_n,ga="",Sa="",xa="",va="",un={snl:{alerts:_n,rules:pa},schools:{alerts:ga,rules:Sa},transit:{alerts:xa,rules:va}};function Ue(t,e){const s=(t||"").replace(/\/+$/,""),n=e.startsWith("/")?e:`/${e}`;return`${s}${n}`}function wa(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}function Wt(t,e){if(!e)return t;const s=new URL(t);return Object.entries(e).forEach(([n,r])=>{r!=null&&String(r).length>0&&s.searchParams.set(n,String(r))}),s.toString()}async function Le(t,e){const s={...e.headers,...wa()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.errorMessage||a?.message||`HTTP ${n.status}`;throw new Error(o)}return a}function Aa(t){const e={"Content-Type":"application/json",...t.headers||{}};return{async listAlerts(){const s=Ue(t.baseUrl,"/api/Alert"),n=await Le(s,{method:"GET",headers:e});return Array.isArray(n)?n:[]},async getAlertStatusList(){const s=Ue(t.baseUrl,"/api/Alert/AlertStatusList"),n=await Le(s,{method:"GET",headers:e});return Array.isArray(n)?n:n&&typeof n=="object"&&Array.isArray(n.data)?n.data:[]},async getAlertsReport(s){const n=Ue(t.baseUrl,"/Alerts/GetAlertsReport"),r=Wt(n,s),a=await Le(r,{method:"GET",headers:e});return Array.isArray(a)?a:[]},async updateAlertStatus(s){const n=Ue(t.baseUrl,"/api/Alert/status");return Le(n,{method:"PUT",headers:e,body:JSON.stringify(s??{})})},async getAdminSettings(){const s=Ue(t.baseUrl,"/api/Alert/GetAdminSettings"),n=await Le(s,{method:"GET",headers:e});if(n&&typeof n=="object"){if("data"in n)return n.data;if("userId"in n)return n}return null},async setAdminSettings(s){const n=Ue(t.baseUrl,"/api/Alert/SetAdminSettings"),r={userId:0,isAdminSetting:!0,sortBy:s?.sortBy??"",groupBy:s?.groupBy??null};return Le(n,{method:"POST",headers:e,body:JSON.stringify(r)})},async getPreferenceSettings(){const s=Ue(t.baseUrl,"/api/Alert/GetPreferenceSettings"),n=await Le(s,{method:"GET",headers:e});if(n&&typeof n=="object"){if("data"in n)return n.data;if("anomalyIds"in n)return n}return null},async setPreferenceSettings(s){const n=Ue(t.baseUrl,"/api/Alert/SetPreferenceSettings"),r=await Le(n,{method:"POST",headers:e,body:JSON.stringify(s??{})}),a=r?.responseStatus??!0,o=r?.data??r?.message??"Preferences updated successfully.";return{responseStatus:a,errorMessage:a?"":r?.errorMessage??r?.message??"",statusCode:200,data:o}},async getAlertNotifications(s){const n=Ue(t.baseUrl,"/api/Alert/GetNotifications"),r=Wt(n,{alertId:s}),a=await Le(r,{method:"GET",headers:e});return Array.isArray(a)?a:a&&typeof a=="object"&&Array.isArray(a.data)?a.data:[]},async notifyFamilyMembers(s){const n=Ue(t.baseUrl,"/api/Alert/NotificationToFamilyMembers"),r=Wt(n,{alertId:s});return Le(r,{method:"POST",headers:e})},async sendSMSorEmailNotifications(s,n,r){const a=Ue(t.baseUrl,"/api/Alert/SendSMSorEmailNotifications"),o=Wt(a,{alertId:s,isEmail:n,isSMS:r});return Le(o,{method:"POST",headers:e})},async getTimeZoneMasters(){const s=Ue(t.baseUrl,"/api/UserPreference/GetTimeZoneMasters"),n=await Le(s,{method:"GET",headers:e});return Array.isArray(n)?n:n&&typeof n=="object"&&Array.isArray(n.data)?n.data:[]},async getMyAppPreferences(){const s=Ue(t.baseUrl,"/api/UserPreference/GetMyAppPreferences"),n=await Le(s,{method:"GET",headers:e});if(n&&typeof n=="object"){const r=n.data??n;if(r?.timeZoneUniqueId)return{timeZoneUniqueId:r.timeZoneUniqueId}}return null}}}function dn(t,e){const s=(t||"").replace(/\/+$/,""),n=e.startsWith("/")?e:`/${e}`;return`${s}${n}`}function Ta(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}async function Vt(t,e){const s={...e.headers,...Ta()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.errorMessage||a?.message||`HTTP ${n.status}`;throw new Error(o)}return a}function Na(t){const e={"Content-Type":"application/json",...t.headers||{}},s=dn(t.baseUrl,"/api/Rules"),n=dn(t.baseUrl,"/api/Rules/lookups");return{async getRules(){const r=await Vt(s,{method:"GET",headers:e});return Array.isArray(r)?r:[]},async setEscalationSettings(r){return Vt(s,{method:"POST",headers:e,body:JSON.stringify(r??{})})},async getLookups(){return Vt(n,{method:"GET",headers:e})},async updateRule(r,a){const o=`${s}/${r}`;return Vt(o,{method:"PUT",headers:e,body:JSON.stringify(a??{})})}}}function ba(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Kt={exports:{}},ka=Kt.exports,mn;function Ia(){return mn||(mn=1,(function(t,e){(function(s,n){t.exports=n()})(ka,(function(){var s=1e3,n=6e4,r=36e5,a="millisecond",o="second",c="minute",l="hour",u="day",f="week",h="month",x="quarter",p="year",k="date",j="Invalid Date",O=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,K=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,D={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(C){var T=["th","st","nd","rd"],g=C%100;return"["+C+(T[(g-20)%10]||T[g]||T[0])+"]"}},H=function(C,T,g){var M=String(C);return!M||M.length>=T?C:""+Array(T+1-M.length).join(g)+C},v={s:H,z:function(C){var T=-C.utcOffset(),g=Math.abs(T),M=Math.floor(g/60),w=g%60;return(T<=0?"+":"-")+H(M,2,"0")+":"+H(w,2,"0")},m:function C(T,g){if(T.date()<g.date())return-C(g,T);var M=12*(g.year()-T.year())+(g.month()-T.month()),w=T.clone().add(M,h),R=g-w<0,F=T.clone().add(M+(R?-1:1),h);return+(-(M+(g-w)/(R?w-F:F-w))||0)},a:function(C){return C<0?Math.ceil(C)||0:Math.floor(C)},p:function(C){return{M:h,y:p,w:f,d:u,D:k,h:l,m:c,s:o,ms:a,Q:x}[C]||String(C||"").toLowerCase().replace(/s$/,"")},u:function(C){return C===void 0}},L="en",$={};$[L]=D;var U="$isDayjsObject",q=function(C){return C instanceof re||!(!C||!C[U])},y=function C(T,g,M){var w;if(!T)return L;if(typeof T=="string"){var R=T.toLowerCase();$[R]&&(w=R),g&&($[R]=g,w=R);var F=T.split("-");if(!w&&F.length>1)return C(F[0])}else{var G=T.name;$[G]=T,w=G}return!M&&w&&(L=w),w||!M&&L},S=function(C,T){if(q(C))return C.clone();var g=typeof T=="object"?T:{};return g.date=C,g.args=arguments,new re(g)},E=v;E.l=y,E.i=q,E.w=function(C,T){return S(C,{locale:T.$L,utc:T.$u,x:T.$x,$offset:T.$offset})};var re=(function(){function C(g){this.$L=y(g.locale,null,!0),this.parse(g),this.$x=this.$x||g.x||{},this[U]=!0}var T=C.prototype;return T.parse=function(g){this.$d=(function(M){var w=M.date,R=M.utc;if(w===null)return new Date(NaN);if(E.u(w))return new Date;if(w instanceof Date)return new Date(w);if(typeof w=="string"&&!/Z$/i.test(w)){var F=w.match(O);if(F){var G=F[2]-1||0,Q=(F[7]||"0").substring(0,3);return R?new Date(Date.UTC(F[1],G,F[3]||1,F[4]||0,F[5]||0,F[6]||0,Q)):new Date(F[1],G,F[3]||1,F[4]||0,F[5]||0,F[6]||0,Q)}}return new Date(w)})(g),this.init()},T.init=function(){var g=this.$d;this.$y=g.getFullYear(),this.$M=g.getMonth(),this.$D=g.getDate(),this.$W=g.getDay(),this.$H=g.getHours(),this.$m=g.getMinutes(),this.$s=g.getSeconds(),this.$ms=g.getMilliseconds()},T.$utils=function(){return E},T.isValid=function(){return this.$d.toString()!==j},T.isSame=function(g,M){var w=S(g);return this.startOf(M)<=w&&w<=this.endOf(M)},T.isAfter=function(g,M){return S(g)<this.startOf(M)},T.isBefore=function(g,M){return this.endOf(M)<S(g)},T.$g=function(g,M,w){return E.u(g)?this[M]:this.set(w,g)},T.unix=function(){return Math.floor(this.valueOf()/1e3)},T.valueOf=function(){return this.$d.getTime()},T.startOf=function(g,M){var w=this,R=!!E.u(M)||M,F=E.p(g),G=function(ye,le){var ie=E.w(w.$u?Date.UTC(w.$y,le,ye):new Date(w.$y,le,ye),w);return R?ie:ie.endOf(u)},Q=function(ye,le){return E.w(w.toDate()[ye].apply(w.toDate("s"),(R?[0,0,0,0]:[23,59,59,999]).slice(le)),w)},ne=this.$W,ae=this.$M,oe=this.$D,xe="set"+(this.$u?"UTC":"");switch(F){case p:return R?G(1,0):G(31,11);case h:return R?G(1,ae):G(0,ae+1);case f:var ue=this.$locale().weekStart||0,me=(ne<ue?ne+7:ne)-ue;return G(R?oe-me:oe+(6-me),ae);case u:case k:return Q(xe+"Hours",0);case l:return Q(xe+"Minutes",1);case c:return Q(xe+"Seconds",2);case o:return Q(xe+"Milliseconds",3);default:return this.clone()}},T.endOf=function(g){return this.startOf(g,!1)},T.$set=function(g,M){var w,R=E.p(g),F="set"+(this.$u?"UTC":""),G=(w={},w[u]=F+"Date",w[k]=F+"Date",w[h]=F+"Month",w[p]=F+"FullYear",w[l]=F+"Hours",w[c]=F+"Minutes",w[o]=F+"Seconds",w[a]=F+"Milliseconds",w)[R],Q=R===u?this.$D+(M-this.$W):M;if(R===h||R===p){var ne=this.clone().set(k,1);ne.$d[G](Q),ne.init(),this.$d=ne.set(k,Math.min(this.$D,ne.daysInMonth())).$d}else G&&this.$d[G](Q);return this.init(),this},T.set=function(g,M){return this.clone().$set(g,M)},T.get=function(g){return this[E.p(g)]()},T.add=function(g,M){var w,R=this;g=Number(g);var F=E.p(M),G=function(ae){var oe=S(R);return E.w(oe.date(oe.date()+Math.round(ae*g)),R)};if(F===h)return this.set(h,this.$M+g);if(F===p)return this.set(p,this.$y+g);if(F===u)return G(1);if(F===f)return G(7);var Q=(w={},w[c]=n,w[l]=r,w[o]=s,w)[F]||1,ne=this.$d.getTime()+g*Q;return E.w(ne,this)},T.subtract=function(g,M){return this.add(-1*g,M)},T.format=function(g){var M=this,w=this.$locale();if(!this.isValid())return w.invalidDate||j;var R=g||"YYYY-MM-DDTHH:mm:ssZ",F=E.z(this),G=this.$H,Q=this.$m,ne=this.$M,ae=w.weekdays,oe=w.months,xe=w.meridiem,ue=function(le,ie,Ne,Me){return le&&(le[ie]||le(M,R))||Ne[ie].slice(0,Me)},me=function(le){return E.s(G%12||12,le,"0")},ye=xe||function(le,ie,Ne){var Me=le<12?"AM":"PM";return Ne?Me.toLowerCase():Me};return R.replace(K,(function(le,ie){return ie||(function(Ne){switch(Ne){case"YY":return String(M.$y).slice(-2);case"YYYY":return E.s(M.$y,4,"0");case"M":return ne+1;case"MM":return E.s(ne+1,2,"0");case"MMM":return ue(w.monthsShort,ne,oe,3);case"MMMM":return ue(oe,ne);case"D":return M.$D;case"DD":return E.s(M.$D,2,"0");case"d":return String(M.$W);case"dd":return ue(w.weekdaysMin,M.$W,ae,2);case"ddd":return ue(w.weekdaysShort,M.$W,ae,3);case"dddd":return ae[M.$W];case"H":return String(G);case"HH":return E.s(G,2,"0");case"h":return me(1);case"hh":return me(2);case"a":return ye(G,Q,!0);case"A":return ye(G,Q,!1);case"m":return String(Q);case"mm":return E.s(Q,2,"0");case"s":return String(M.$s);case"ss":return E.s(M.$s,2,"0");case"SSS":return E.s(M.$ms,3,"0");case"Z":return F}return null})(le)||F.replace(":","")}))},T.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},T.diff=function(g,M,w){var R,F=this,G=E.p(M),Q=S(g),ne=(Q.utcOffset()-this.utcOffset())*n,ae=this-Q,oe=function(){return E.m(F,Q)};switch(G){case p:R=oe()/12;break;case h:R=oe();break;case x:R=oe()/3;break;case f:R=(ae-ne)/6048e5;break;case u:R=(ae-ne)/864e5;break;case l:R=ae/r;break;case c:R=ae/n;break;case o:R=ae/s;break;default:R=ae}return w?R:E.a(R)},T.daysInMonth=function(){return this.endOf(h).$D},T.$locale=function(){return $[this.$L]},T.locale=function(g,M){if(!g)return this.$L;var w=this.clone(),R=y(g,M,!0);return R&&(w.$L=R),w},T.clone=function(){return E.w(this.$d,this)},T.toDate=function(){return new Date(this.valueOf())},T.toJSON=function(){return this.isValid()?this.toISOString():null},T.toISOString=function(){return this.$d.toISOString()},T.toString=function(){return this.$d.toUTCString()},C})(),Se=re.prototype;return S.prototype=Se,[["$ms",a],["$s",o],["$m",c],["$H",l],["$W",u],["$M",h],["$y",p],["$D",k]].forEach((function(C){Se[C[1]]=function(T){return this.$g(T,C[0],C[1])}})),S.extend=function(C,T){return C.$i||(C(T,re,S),C.$i=!0),S},S.locale=y,S.isDayjs=q,S.unix=function(C){return S(1e3*C)},S.en=$[L],S.Ls=$,S.p={},S}))})(Kt)),Kt.exports}var Ea=Ia();const Ma=ba(Ea);function Jn(t){if(!t)return"By Severity";const e=t.trim().toLowerCase();return e.includes("created")?"By Created Date":e.includes("updated")||e.includes("modified")?"By Updated Date":"By Severity"}function Kn(t){if(!t||typeof t!="string")return{hours:0,minutes:0,seconds:0};const e=t.split(":").map(a=>parseInt(a,10)),s=Number.isFinite(e[0])?e[0]:0,n=Number.isFinite(e[1])?e[1]:0,r=Number.isFinite(e[2])?e[2]:0;return{hours:s,minutes:n,seconds:r}}function fn(t){const{hours:e,minutes:s,seconds:n}=Kn(t);return Ma().hour(e).minute(s).second(n).millisecond(0)}function je(t,e){const s=(t||"").replace(/\/+$/,""),n=e.startsWith("/")?e:`/${e}`;return`${s}${n}`}function Oa(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}function Bt(t,e){if(!e)return t;const s=new URL(t);return Object.entries(e).forEach(([n,r])=>{r!=null&&String(r).length>0&&s.searchParams.set(n,String(r))}),s.toString()}async function Ce(t,e){const s={...e.headers,...Oa()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.Message||`HTTP ${n.status}`;throw new Error(o)}return a}const ce=(...t)=>t.find(e=>e!=null);function Et(t,e,s={}){const n={};for(const r of e){const a=s[r]??r.charAt(0).toUpperCase()+r.slice(1);n[r]=t?.[a]??t?.[r]}return n}function ja(t){return Array.isArray(t)?t.map(e=>Et(e,["alertLogId","alertId","status","description","actionNotes","createdDate","createdBy","modifiedDate","modifiedBy"])):t}function Ca(t){return{id:String(ce(t?.AlertId,t?.alertId)??""),alertNumber:ce(t?.AlertNumber,t?.alertNumber),priority:ce(t?.Priority,t?.priority,"Low"),timestamp:ce(t?.UpdatedUtc,t?.timestamp,""),statusType:ce(t?.Status,t?.statusType,""),description:ce(t?.Description,t?.description,""),eventName:ce(t?.EventName,t?.eventName),ruleName:ce(t?.RuleName,t?.ruleName),spaceId:ce(t?.SpaceId,t?.spaceId),spaceName:ce(t?.SpaceName,t?.spaceName),anomalyId:ce(t?.AnomalyId,t?.anomalyId),severityId:ce(t?.SeverityId,t?.severityId),assignTeam:ce(t?.AssignTeam,t?.assignTeam),cameraName:ce(t?.CameraName,t?.cameraName),type:ce(t?.Type,t?.type),mediaDetails:ce(t?.MediaDetails,t?.mediaDetails,t?.MediaUrls,t?.mediaUrls),additionalMedia:ce(t?.AdditionalMedia,t?.additionalMedia),timeElapsed:ce(t?.TimeElapsed,t?.timeElapsed),timeRemaining:ce(t?.TimeRemaining,t?.timeRemaining),anomalyName:ce(t?.AnomalyName,t?.anomalyName),alertDetails:ce(t?.AlertDetails,t?.alertDetails),statusHistory:ja(ce(t?.StatusHistory,t?.statusHistory)),isEmailSent:ce(t?.IsEmailSent,t?.isEmailSent),isSMSSent:ce(t?.IsSMSSent,t?.isSMSSent),timeZoneUniqueId:ce(t?.TimeZoneUniqueId,t?.timeZoneUniqueId)}}function Da(t){const e={"Content-Type":"application/json",...t.headers||{}};return{async listAlerts(s){const n=je(t.baseUrl,"/api/detectionpolicy/alerts"),r=Bt(n,{customerId:"99e5c8b5-b9d4-4d35-8885-7f121c532664",pageSize:s?.pageSize??10,page:s?.pageNumber??1,...s?.anomalyId!==void 0&&{anomalyId:s.anomalyId},...s?.spaceId!==void 0&&{spaceId:s.spaceId},...s?.severityId!==void 0&&{severityId:s.severityId},...s?.thirdPartyIds?.length&&{ThirdPartyIds:s.thirdPartyIds.join(",")},isArchived:s?.isArchived??!1}),a=await Ce(r,{method:"GET",headers:e});return{items:Array.isArray(a?.Items)?a.Items.map(Ca):[],total:a?.Total}},async getAlertStatusList(){const s=je(t.baseUrl,"/api/detectionpolicy/alerts/StatusList"),n=await Ce(s,{method:"GET",headers:e});return(Array.isArray(n)?n:[]).map(a=>Et(a,["alertStatusId","value","statusName"]))},async getAlertsReport(s){const n=je(t.baseUrl,"/api/detectionpolicy/alerts/GetAlertsReport"),r=Bt(n,s),a=await Ce(r,{method:"GET",headers:e});return Array.isArray(a)?a:[]},async updateAlertStatus(s){const n=je(t.baseUrl,"/api/detectionpolicy/alerts/Log"),r={AlertId:s.alertId??s.alertUniqueId??s.AlertId,Status:s.status??s.Status??"",Notes:s.notes??s.Notes??""};return Ce(n,{method:"POST",headers:e,body:JSON.stringify(r)})},async getAdminSettings(){const s=je(t.baseUrl,"/api/detectionpolicy/alerts/GetAdminSettings"),n=await Ce(s,{method:"GET",headers:e});if(n&&typeof n=="object"){const r=n.data??n.Data??n;if(r&&typeof r=="object")return Et(r,["userId","isAdminSetting","sortBy"],{sortBy:"SortOption"})}return null},async setAdminSettings(s){const n=je(t.baseUrl,"/api/detectionpolicy/alerts/SetAdminSettings"),r={Settings:{UserId:0,IsAdminSetting:!0,SortOption:s?.sortBy??"",GroupBy:s?.groupBy??null}};return Ce(n,{method:"POST",headers:e,body:JSON.stringify(r)})},async getPreferenceSettings(){const s=je(t.baseUrl,"/api/detectionpolicy/alerts/GetPreferenceSettings"),n=await Ce(s,{method:"GET",headers:e});if(n&&typeof n=="object"){if("data"in n)return n.data;if("anomalyIds"in n)return n}return null},async setPreferenceSettings(s){const n=je(t.baseUrl,"/api/detectionpolicy/alerts/SetPreferenceSettings"),r=u=>{const{hours:f,minutes:h,seconds:x}=Kn(u);return(f*3600+h*60+x)*1e7},a={Settings:{UserId:0,AnomalyIds:Array.isArray(s?.anomalyIds)?s.anomalyIds.map(u=>String(u)):[],DoNotDisturbStart:{Ticks:r(s?.doNotDisturbStart)},DoNotDisturbEnd:{Ticks:r(s?.doNotDisturbEnd)},InApp:!!s?.inApp,SMS:!!s?.sms,Email:!!s?.email,SortBy:s?.sortBy??""}},o=await Ce(n,{method:"POST",headers:e,body:JSON.stringify(a)}),c=o?.responseStatus??!0,l=o?.data??o?.message??"Preferences updated successfully.";return{responseStatus:c,errorMessage:c?"":o?.errorMessage??o?.Message??o?.message??"",statusCode:200,data:l}},async sendSMSorEmailNotifications(s,n,r){const a=je(t.baseUrl,"/api/detectionpolicy/alerts/SendSMSorEmailNotifications"),o=Bt(a,{alertId:s,isEmail:n,isSMS:r});return Ce(o,{method:"POST",headers:e})},async getAlertNotifications(s){const n=je(t.baseUrl,"/api/detectionpolicy/alerts/GetNotifications"),r=Bt(n,{alertId:s}),a=await Ce(r,{method:"GET",headers:e});let o=[];return Array.isArray(a)?o=a:Array.isArray(a?.data)&&(o=a.data),o.map(c=>Et(c,["alertNotificationSentId","alertId","notificationType","receipientName","receipentPhoneNumber","messageSID","messageStatus","receipientEmail","notificationReceipientType","sentAt"]))},async getTimeZoneMasters(){const s=je(t.baseUrl,"/api/TimeZoneMaster"),n=await Ce(s,{method:"GET",headers:e});return(Array.isArray(n?.Data)?n.Data:[]).map(a=>Et(a,["timeZoneUniqueId","ianaTimeZoneId","timeZoneName","offset"]))},async getAllSpaces(){const s=t.spacesBaseUrl||t.baseUrl,n=je(s,"/api/AllSpaces"),r=await Ce(n,{method:"GET",headers:e});return(Array.isArray(r?.Data)?r.Data:[]).map(o=>({spaceId:o?.SpaceId??o?.spaceId,spaceName:o?.SpaceName??o?.spaceName??""}))},async getMyAppPreferences(){const s=je(t.baseUrl,"/MyProfile"),n=await Ce(s,{method:"GET",headers:e}),r=n?.data?.userGuid??n?.Data?.userGuid??n?.userGuid;if(!r)return null;const a=je(t.baseUrl,`/api/GetMyAppPreferences/${r}`),o=await Ce(a,{method:"GET",headers:e});if(o&&typeof o=="object"){const c=o.data??o.Data??o,l=c?.timeZoneUniqueId??c?.TimeZoneUniqueId;if(l)return{timeZoneUniqueId:l}}return null}}}function Ra(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}async function Je(t,e){const s={...e.headers,...Ra()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.errorMessage||a?.message||`HTTP ${n.status}`;throw new Error(o)}return a}function Ua(t){const e={"Content-Type":"application/json",...t.headers||{}},s=new URL("/api/detectionpolicy/rules",t.baseUrl).toString();return{async getRules(){const n=await Je(s,{method:"GET",headers:e});return(Array.isArray(n?.Data)?n?.Data:[]).map(a=>({...a,ruleId:a.ruleId??a.RuleId,ruleName:a.ruleName??a.RuleName??a.Name,escalationSettings:a.escalationSettings??a.EscalationSettings}))},async setEscalationSettings(n){return Je(s,{method:"POST",headers:e,body:JSON.stringify(n??{})})},async getLookups(){const n=y=>new URL(y,t.baseUrl).toString(),r=t.userManagementBaseUrl||t.baseUrl,a=[Je(n("/api/detectionpolicy/lookups/actiontypes"),{method:"GET",headers:e}),Je(n("/api/detectionpolicy/lookups/anomalies"),{method:"GET",headers:e}),Je(n("/api/detectionpolicy/lookups/thirdparty"),{method:"GET",headers:e}),Je(n("/api/detectionpolicy/lookups/severity"),{method:"GET",headers:e}),Je(n("/api/detectionpolicy/lookups/scheduletypes"),{method:"GET",headers:e}),Je(new URL("/user/user-roles",r).toString(),{method:"GET",headers:e})],[o,c,l,u,f,h]=await Promise.allSettled(a),x=y=>{if(y.status!=="fulfilled")return[];const S=y.value;return Array.isArray(S)?S:Array.isArray(S?.Data)?S.Data:Array.isArray(S?.data)?S.data:[]},p=x(o),k=x(c),j=x(l),O=x(u),K=x(f),D=h.status==="fulfilled"?h.value:null;let H=[];Array.isArray(D)?H=D:Array.isArray(D?.Data)?H=D.Data:Array.isArray(D?.data)&&(H=D.data);const v=p.map(y=>({actionTypeId:Number(y?.ActionTypeId),name:y?.DisplayName??y?.Name??""})),L=k.map(y=>({recordId:y?.AnomalyId,anomalyName:y?.DisplayName??y?.Name??""})),$=j.map(y=>({thirdPartyId:Number(y?.ThirdPartyId),thirdPartyName:y?.ThirdPartyName??y?.Name??""})),U=H.map(y=>({userRoleId:y.UserRoleId??y.userRoleId??y.Id??y.id??0,userRoleName:y.UserRoleName??y.userRoleName??y.Name??y.name??""})),q={actionTypes:v,anomalies:L,thirdParties:$};return O.length&&(q.severities=O.map(y=>({severityId:y?.SeverityId??y?.severityId,severityName:y?.DisplayName??y?.SeverityName??y?.Name??y?.name??""}))),K.length&&(q.scheduleTypes=K),U.length&&(q.userRoles=U),q},async updateRule(n,r){const a=`${s}/${n}`,{escalationSettings:o,Anomaly:c,Severity:l,...u}=r??{};return Je(a,{method:"PUT",headers:e,body:JSON.stringify({...u,CustomerId:"99e5c8b5-b9d4-4d35-8885-7f121c532664",Version:{DeDupWindowSeconds:0,IncludeSubjectInHash:!0},AnomalyId:c?.AnomalyId,SeverityId:l?.SeverityId,EscalationSettings:o?{...o,ThirdPartyIds:o.thirdPartyId??[]}:{}})})}}}function La(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}async function et(t,e){const s={...e.headers,...La()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.errorMessage||a?.message||`HTTP ${n.status}`;throw new Error(o)}return a}function Fa(t){const e={"Content-Type":"application/json",...t.headers||{}},s=new URL("/list-rule",t.baseUrl).toString();return{async getRules(){const n=await et(s,{method:"POST",headers:e,body:JSON.stringify({command:"get-all"})});return(Array.isArray(n?.data)?n.data:[]).map(a=>({...a,ruleId:a.RuleId??a.ruleId,ruleName:a.RuleName??a.ruleName,ruleDesc:a.RuleDesc??a.ruleDesc??null}))},async setEscalationSettings(n){return et(s,{method:"POST",headers:e,body:JSON.stringify(n??{})})},async getLookups(){const n=U=>new URL(U,t.baseUrl).toString(),r=t.userManagementBaseUrl||t.baseUrl,a=[et(n("/api/ActionTypeMaster/GetAll"),{method:"GET",headers:e}),et(n("/api/anomaly/anomaly-list"),{method:"POST",headers:e,body:JSON.stringify({RuleLevel:1})}),et(n("/api/Lookup/ThirdParties"),{method:"GET",headers:e}),et(n("/api/anomaly/severity-list"),{method:"GET",headers:e}),et(new URL("/user/user-roles",r).toString(),{method:"GET",headers:e})],[o,c,l,u,f]=await Promise.allSettled(a),h=U=>{if(U.status!=="fulfilled")return[];const q=U.value;return Array.isArray(q)?q:Array.isArray(q?.data)?q.data:[]},x=h(o),p=h(c),k=h(l),j=h(u),O=f.status==="fulfilled"?f.value:null,K=x.map(U=>({actionTypeId:U?.ActionTypeUniqueId,name:U?.Name??""})),D=p.map(U=>({recordId:U?.AnomalyId,anomalyName:U?.DisplayName??U?.Name??""})),H=k.map(U=>({thirdPartyId:Number(U?.ThirdPartyId),thirdPartyName:U?.ThirdPartyName??U?.Name??""}));let v=[];Array.isArray(O)?v=O:Array.isArray(O?.Data)?v=O.Data:Array.isArray(O?.data)&&(v=O.data);const L=v.map(U=>({userRoleId:U.userRoleId??0,userRoleName:U.userRoleName??""})),$={actionTypes:K,anomalies:D,thirdParties:H};return j.length&&($.severities=j.map(U=>({SeverityId:U.SeverityId,DisplayName:U.SeverityName??U.DisplayName??""}))),L.length&&($.userRoles=L),$},async updateRule(n,r){const a=new URL("/update-rule",t.baseUrl).toString(),{escalationSettings:o,ruleId:c,ruleName:l,ruleDesc:u,...f}=r??{},h=o??{},x=(h.escalationSettingsActionTypeIds??[]).filter(k=>k!=null&&!Number.isNaN(k)),p={Level1UserRoleId:h.level1UserRoleId??0,Level1PostAssistTime:h.level1PostAssistTime??0,Level2UserRoleId:h.level2UserRoleId??0,Level2PostAssistTime:h.level2PostAssistTime??0,Level3UserRoleId:h.level3UserRoleId??0,Level3PostAssistTime:h.level3PostAssistTime??0,EscalationSettingsActionTypeIds:x,ThirdPartyIds:h.thirdPartyId??[],HumanLoop:h.humanLoop??!1};return et(a,{method:"POST",headers:e,body:JSON.stringify({...f,RuleId:c??f.RuleId??n,RuleName:l??f.RuleName,RuleDesc:u??f.RuleDesc??null,ActionTypeUniqueIdList:x,EscalationSettings:p})})}}}function $e(t,e){const s=(t||"").replace(/\/+$/,""),n=e.startsWith("/")?e:`/${e}`;return`${s}${n}`}function $a(){try{const t=localStorage.getItem("authToken");return t?{Authorization:`Bearer ${t}`}:{}}catch{return{}}}function Zt(t,e){if(!e)return t;const s=new URL(t);return Object.entries(e).forEach(([n,r])=>{r!=null&&String(r).length>0&&s.searchParams.set(n,String(r))}),s.toString()}async function Pe(t,e){const s={...e.headers,...$a()},n=await fetch(t,{...e,headers:s});if(n.status===401)throw window.location.href="/login",new Error("Unauthorized");if(n.status===204)return{};const r=await n.text();let a={};if(r)try{a=JSON.parse(r)}catch{a={ok:n.ok,status:n.status,raw:r}}if(!n.ok){const o=a?.errorMessage||a?.message||`HTTP ${n.status}`;throw new Error(o)}return a}function Pa(t){const e={"Content-Type":"application/json",...t.headers||{}};return{async listAlerts(s){const n=$e(t.baseUrl,"/api/Alerts"),r=Zt(n,{pageSize:s?.pageSize??10,pageNumber:s?.pageNumber??1}),a=await Pe(r,{method:"GET",headers:e});return Array.isArray(a)?a:[]},async getAlertStatusList(){const s=$e(t.baseUrl,"/api/Alerts/GetAlertStatus"),n=await Pe(s,{method:"GET",headers:e});return Array.isArray(n)?n:n&&typeof n=="object"&&Array.isArray(n.data)?n.data:[]},async getAlertsReport(s){const n=$e(t.baseUrl,"/Alerts/GetAlertsReport"),r=Zt(n,s),a=await Pe(r,{method:"GET",headers:e});return Array.isArray(a)?a:[]},async updateAlertStatus(s){const n=$e(t.baseUrl,"/api/Alerts/UpdateAlertLog"),r={alertId:s.alertId,action:s.status,notes:s.notes};return Pe(n,{method:"PUT",headers:e,body:JSON.stringify(r??{})})},async getAdminSettings(){const s=$e(t.baseUrl,"/api/Alerts/GetAdminSettings"),n=await Pe(s,{method:"GET",headers:e});if(n&&typeof n=="object"){if("data"in n)return n.data;if("userId"in n)return n}return null},async setAdminSettings(s){const n=$e(t.baseUrl,"/api/Alerts/SetAdminSettings"),r={userId:0,isAdminSetting:!0,sortBy:s?.sortBy??"",groupBy:s?.groupBy??null};return Pe(n,{method:"POST",headers:e,body:JSON.stringify(r)})},async getPreferenceSettings(){const s=$e(t.baseUrl,"/api/Alerts/GetPreferenceSettings"),n=await Pe(s,{method:"GET",headers:e});if(n&&typeof n=="object"){if("data"in n)return n.data;if("anomalyIds"in n)return n}return null},async setPreferenceSettings(s){const n=$e(t.baseUrl,"/api/Alerts/SetPreferenceSettings"),r=await Pe(n,{method:"POST",headers:e,body:JSON.stringify(s??{})}),a=r?.responseStatus??!0,o=r?.data??r?.message??"Preferences updated successfully.";return{responseStatus:a,errorMessage:a?"":r?.errorMessage??r?.message??"",statusCode:200,data:o}},async getAlertNotifications(s){const n=$e(t.baseUrl,"/api/Alerts/GetNotifications"),r=Zt(n,{alertId:s}),a=await Pe(r,{method:"GET",headers:e});return Array.isArray(a)?a:a&&typeof a=="object"&&Array.isArray(a.data)?a.data:[]},async sendSMSorEmailNotifications(s,n,r){const a=$e(t.baseUrl,"/api/Alerts/SendSMSorEmailNotifications"),o=Zt(a,{alertId:s,isEmail:n,isSMS:r});return Pe(o,{method:"POST",headers:e})},async getTimeZoneMasters(){const s=$e(t.baseUrl,"/api/UserPreference/GetTimeZoneMasters"),n=await Pe(s,{method:"GET",headers:e});return Array.isArray(n)?n:n&&typeof n=="object"&&Array.isArray(n.data)?n.data:[]},async getMyAppPreferences(){const s=$e(t.baseUrl,"/api/UserPreference/GetMyAppPreferences"),n=await Pe(s,{method:"GET",headers:e});if(n&&typeof n=="object"){const r=n.data??n;if(r?.timeZoneUniqueId)return{timeZoneUniqueId:r.timeZoneUniqueId}}return null}}}const Qn=m.createContext(null);function Xn({tenant:t="snl",override:e,timeZone:s,userManagementDomain:n,spacesBaseUrl:r,children:a}){const o=m.useMemo(()=>{const l=e?.alertsBaseUrl?.trim()||un[t]?.alerts||"";let u=e?.rulesBaseUrl?.trim()||un[t]?.rules||"";t==="snl"&&(u=l);const f=e?.headers;return{tenant:t,alertsBaseUrl:l,rulesBaseUrl:u,headers:f,timeZone:s,userManagementDomain:n,spacesBaseUrl:r}},[t,e?.alertsBaseUrl,e?.rulesBaseUrl,JSON.stringify(e?.headers||{}),s,n,r]),c=m.useMemo(()=>{const l={baseUrl:o.alertsBaseUrl,headers:o.headers},u={baseUrl:o.rulesBaseUrl,headers:o.headers},f={schools:()=>Da({...l,spacesBaseUrl:o.spacesBaseUrl}),transit:()=>Pa(l),snl:()=>Aa(l)},h={schools:()=>Ua({...u,userManagementBaseUrl:o.userManagementDomain}),transit:()=>Fa({...u,userManagementBaseUrl:o.userManagementDomain}),snl:()=>Na({baseUrl:o.alertsBaseUrl,headers:o.headers})};return{config:o,alerts:f[o.tenant](),rules:h[o.tenant]()}},[o]);return i.jsx(Qn.Provider,{value:c,children:a})}function De(){const t=m.useContext(Qn);if(!t)throw new Error("useApi must be used inside ApiProvider");return t}const Wa={Critical:"#FFE2E2",High:"#FF95004D",Medium:"#FEF9C2",Low:"#E0EDFF"},Va={Critical:"#FF3B30",High:"#FFB86A",Medium:"#FFCC00",Low:"#007AFF"},Zs=6,zs=7;function hn(t,e,s){const n=t===Zs,r=t===zs,a=e.isEmailSent??!1,o=e.isSMSSent??!1,c=n&&a||r&&o,l=n?"Send Email":r?"Send SMS":s,u=n&&a?"Email sent":r&&o?"SMS sent":l,f=n&&a?"Email sent":r&&o?"SMS sent":`Click to ${l}`;return{isDisabled:c,buttonText:u,tooltipTitle:f}}function Ba(t){const e=new Set;(t||[]).forEach(n=>{const r=n.anomalyName;typeof r=="string"&&r.trim().length>0&&e.add(r.trim())});const s=Array.from(e).map(n=>({label:n,value:n}));return[{label:"All Types",value:"All"},...s]}function Za(t){const e=new Set;(t||[]).forEach(n=>{const r=n.spaceName;typeof r=="string"&&r.trim().length>0&&e.add(r.trim())});const s=Array.from(e).map(n=>({label:n,value:n}));return[{label:"All",value:"All"},...s]}function xs(t,e){return`${t}-${e?"email":"sms"}`}function zt(t){return t===Zs||t===zs}function is({value:t,onChange:e,options:s,className:n,dropdownWidth:r}){return i.jsx(d.Select,{className:n,options:s,value:t,onChange:e,dropdownMatchSelectWidth:r??260})}const za=[{label:"All levels",value:"All"},{label:"Critical",value:"Critical"},{label:"High",value:"High"},{label:"Medium",value:"Medium"},{label:"Low",value:"Low"}];function Ha({value:t,onChange:e,options:s}){return i.jsx(is,{className:"w-[140px]",value:t,onChange:e,options:s||za})}const qa=[{label:"All Types",value:"All"},{label:"Weapon Detection",value:"Weapon"},{label:"Unauthorized Access",value:"Unauthorized"},{label:"Aggressive Behavior",value:"Aggressive"}];function Ga({value:t,onChange:e,options:s}){return i.jsx(is,{className:"w-[220px]",dropdownWidth:280,value:t,onChange:e,options:s||qa})}function Ya({value:t,onChange:e,options:s}){return i.jsx(is,{className:"w-[100px]",value:t,onChange:e,options:s||[]})}const _a=[{label:"All",value:"All"},{label:"SOS",value:"SOS"},{label:"911",value:"911"},{label:"Aegix",value:"Aegix"},{label:"Eli",value:"Eli"},{label:"Skydio",value:"Skydio"}];function Ja({value:t,onChange:e,options:s}){return i.jsx(is,{className:"w-[130px]",value:t,onChange:e,options:s||_a})}function er({columns:t,data:e,loading:s=!1,pageSize:n=10,total:r,currentPage:a,rowKey:o="id",toolbar:c,tableProps:l,onPageChange:u}){const f=r!==void 0;return i.jsxs("div",{children:[c,i.jsx(d.Table,{rowKey:o,dataSource:e,columns:t,loading:s,pagination:{pageSize:n,...f?{total:r,current:a}:{},showSizeChanger:!1,showTotal:h=>`Total: ${h}`,onChange:u},bordered:!0,...l})]})}function Hs({data:t,loading:e=!1,pageSize:s=10,total:n,currentPage:r,columns:a,severityOptions:o,anomalyOptions:c,spaceOptions:l,renderActions:u,onAlertIdClick:f,onRefetch:h,onPageChange:x,onFilterChange:p,excludeCompleted:k=!0,resetKey:j}){const[O,K]=m.useState("All"),[D,H]=m.useState("All"),[v,L]=m.useState("All"),[$,U]=m.useState("All"),[q,y]=m.useState("");m.useEffect(()=>{j!==void 0&&(K("All"),H("All"),L("All"),U("All"),y(""))},[j]);const[S,E]=m.useState([{label:"All",value:"All"}]),[re,Se]=m.useState([]),[C,T]=m.useState([]),[g,M]=m.useState([]),[w,R]=m.useState(new Set),{rules:F,alerts:G}=De(),Q={6:{title:"Email",kind:"icon",icon:i.jsx(ut.MailOutlined,{})},7:{title:"SMS",kind:"icon",icon:i.jsx(ut.MessageOutlined,{})}},ne=m.useMemo(()=>Ba(t),[t]),ae=m.useMemo(()=>Za(t),[t]);m.useEffect(()=>{if(!G.getAllSpaces)return;let J=!0;return(async()=>{try{const Z=await G.getAllSpaces();if(J){const de=Z.map(pe=>({label:pe.spaceName,value:String(pe.spaceId)}));Se([{label:"All",value:"All"},...de])}}catch(Z){console.error("Error loading space options",Z)}})(),()=>{J=!1}},[G]),m.useEffect(()=>{let J=!0;return(async()=>{try{const Z=await F.getLookups(),pe=(Array.isArray(Z.thirdParties)?Z.thirdParties:[]).map(ve=>({label:ve.thirdPartyName,value:String(ve.thirdPartyId)})),Oe=(Array.isArray(Z.anomalies)?Z.anomalies:[]).map(ve=>({label:ve.anomalyName,value:String(ve.recordId)})),Re=(Array.isArray(Z.severities)?Z.severities:[]).map(ve=>({label:ve.severityName,value:String(ve.severityId)}));J&&(E([{label:"All",value:"All"},...pe]),Oe.length&&T([{label:"All Types",value:"All"},...Oe]),Re.length&&M([{label:"All levels",value:"All"},...Re]))}catch(Z){console.error("Error loading filter options",Z)}})(),()=>{J=!1}},[F]);const oe=m.useMemo(()=>(t||[]).some(J=>cn(J).length>0),[t]);m.useEffect(()=>{if(!p)return;const J={anomalyId:C.length>1&&D!=="All"?D:void 0,spaceId:re.length>1&&v!=="All"?Number(v):void 0,severityId:g.length>1&&O!=="All"?Number(O):void 0,thirdPartyIds:$==="All"?void 0:[Number($)]};p(J),x?.(1)},[D,v,O,$,C.length,re.length,g.length]);const xe=m.useMemo(()=>{const J=!!p;return(t||[]).filter(Z=>{const de=J||O==="All"||(g.length>1?String(Z.severityId)===String(O):Z.priority===O),pe=`${Z.id} ${Z.description} ${Z.statusType}`.toLowerCase(),Te=!q||pe.includes(q.toLowerCase()),Oe=J||D==="All"||(C.length>1?String(Z.anomalyId)===String(D):(Z.anomalyName||"").toLowerCase()===D.toLowerCase()),Ze=J||v==="All"||(re.length>1?String(Z.spaceId)===String(v):(Z.spaceName||"").toLowerCase()===v.toLowerCase()),Re=J||!oe||$==="All"||cn(Z).includes(Number($)),ve=!k||!["completed","false positive"].includes(String(Z.statusType||"").toLowerCase());return de&&Te&&Oe&&Ze&&Re&&ve})},[t,O,q,D,v,$,oe,k,re,C,g,p]),ue=c?.length?c:ne,me=C.length>1?C:ue,ye=l?.length?l:ae,le=re.length>1?re:ye,ie=g.length>1?g:o,Ne=[{title:"Severity",dataIndex:"priority",key:"priority",width:120,render:J=>i.jsx(d.Tag,{className:"px-[10px] py-[2px]",style:{border:`2px solid ${Va[J]}`,backgroundColor:Wa[J]},children:J})},{title:"Tracker",key:"tracker",width:140,render:(J,Z)=>i.jsx("a",{onClick:de=>{de.preventDefault(),f?.(Z,{tab:"track",sourceTab:"active"})},className:"text-blue-600 hover:underline",children:"Tracker"})},{title:"Call to action/Human in the loop",key:"actions",width:320,render:(J,Z)=>{if(u)return i.jsx(i.Fragment,{children:u(Z)});const de=async(it,$t)=>{const ht=xs(Z.id,it);R(we=>new Set(we).add(ht));try{const we=await G.sendSMSorEmailNotifications?.(Z.id,it,$t);we?.responseStatus||we?.Success||we?.success?(Ae.toast.success(we?.message||we.data||(it?"Email sent successfully":"SMS sent successfully")),h?.()):Ae.toast.error(we?.message||we?.data||we?.errorMessage||"Failed to send notification")}catch(we){Ae.toast.error(we?.message||"Failed to send notification")}finally{R(we=>{const _e=new Set(we);return _e.delete(ht),_e})}},pe=Zs,Te=zs,Oe=Q[pe],Ze=Q[Te],Re=hn(pe,Z,Oe?.title),ve=hn(Te,Z,Ze?.title),kt=xs(Z.id,!0),ze=xs(Z.id,!1),at=zt(pe)&&w.has(kt),ft=zt(Te)&&w.has(ze);return i.jsxs(d.Space,{size:"middle",children:[i.jsx(d.Tooltip,{title:Re.tooltipTitle,children:i.jsx(d.Button,{size:"small",disabled:Re.isDisabled,loading:at,onClick:zt(pe)?()=>de(!0,!1):void 0,icon:!at&&Oe?.icon,className:"flex flex-col items-center justify-center gap-1",style:{height:"fit-content"},children:Re.buttonText})},String(pe)),i.jsx(d.Tooltip,{title:ve.tooltipTitle,children:i.jsx(d.Button,{size:"small",disabled:ve.isDisabled,loading:ft,onClick:zt(Te)?()=>de(!1,!0):void 0,icon:!ft&&Ze?.icon,className:"flex flex-col items-center justify-center gap-1",style:{height:"fit-content"},children:ve.buttonText})},String(Te))]})}},{title:"Alert Timestamp",dataIndex:"timestamp",key:"timestamp",width:220,render:(J,Z)=>{const de=Z?.timeElapsed,pe=Z?.timeRemaining,Te=de?ln(de):0,Oe=pe?ln(pe):0,Ze=Math.round(Te/(Te+Oe)*100);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-[70px]",children:"Elapsed:"}),i.jsx("span",{className:"font-medium",children:de??"-"})]}),i.jsx(d.Progress,{percent:Ze,showInfo:!1,size:"small",strokeColor:ya(Z.priority)}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-[70px]",children:"Remaining"}),i.jsx("span",{className:"font-medium",children:pe??"-"})]})]})}},{title:"Status",dataIndex:"statusType",key:"statusType",width:140},{title:"Description",dataIndex:"description",key:"description",render:(J,Z)=>i.jsxs("div",{children:[i.jsx("a",{onClick:de=>{de.preventDefault(),f?.(Z,{sourceTab:"active"})},className:"inline-block mb-1 text-blue-600",children:Z.alertNumber}),i.jsx("div",{className:"text-black/65",children:J})]})}],Me=a&&a.length?a:Ne;return i.jsx("div",{children:i.jsx(er,{rowKey:"id",data:xe,columns:Me,loading:e,pageSize:s,total:n,currentPage:r,onPageChange:x,toolbar:i.jsxs(d.Row,{gutter:[12,12],className:"mb-3",align:"middle",children:[i.jsx(d.Col,{flex:"none",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:"Severity"}),i.jsx(Ha,{value:O,onChange:K,options:ie})]})}),i.jsx(d.Col,{flex:"none",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:"Anomaly type"}),i.jsx(Ga,{value:D,onChange:H,options:me})]})}),i.jsx(d.Col,{flex:"none",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:"Space"}),i.jsx(Ya,{value:v,onChange:L,options:le})]})}),i.jsx(d.Col,{flex:"none",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:"Action Taken"}),i.jsx(Ja,{value:$,onChange:U,options:S})]})}),i.jsx(d.Col,{flex:"auto"}),i.jsx(d.Col,{flex:"none",children:i.jsx(d.Input.Search,{allowClear:!0,placeholder:"Search",onSearch:y,onChange:J=>y(J.target.value),className:"w-[260px] ",enterButton:!0})})]})})})}function qs(){const{alerts:t}=De(),e=dt.useQueryClient();return dt.useMutation({mutationFn:s=>t.updateAlertStatus(s),onSuccess:()=>{e.invalidateQueries({queryKey:["alerts","list"]}),e.invalidateQueries({queryKey:["alerts","report"]})}})}class mt extends Error{}class Ka extends mt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Qa extends mt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Xa extends mt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class St extends mt{}class tr extends mt{constructor(e){super(`Invalid unit ${e}`)}}class be extends mt{}class tt extends mt{constructor(){super("Zone is an abstract class")}}const N="numeric",Ye="short",Fe="long",ts={year:N,month:N,day:N},sr={year:N,month:Ye,day:N},ei={year:N,month:Ye,day:N,weekday:Ye},nr={year:N,month:Fe,day:N},rr={year:N,month:Fe,day:N,weekday:Fe},ar={hour:N,minute:N},ir={hour:N,minute:N,second:N},or={hour:N,minute:N,second:N,timeZoneName:Ye},lr={hour:N,minute:N,second:N,timeZoneName:Fe},cr={hour:N,minute:N,hourCycle:"h23"},ur={hour:N,minute:N,second:N,hourCycle:"h23"},dr={hour:N,minute:N,second:N,hourCycle:"h23",timeZoneName:Ye},mr={hour:N,minute:N,second:N,hourCycle:"h23",timeZoneName:Fe},fr={year:N,month:N,day:N,hour:N,minute:N},hr={year:N,month:N,day:N,hour:N,minute:N,second:N},yr={year:N,month:Ye,day:N,hour:N,minute:N},pr={year:N,month:Ye,day:N,hour:N,minute:N,second:N},ti={year:N,month:Ye,day:N,weekday:Ye,hour:N,minute:N},gr={year:N,month:Fe,day:N,hour:N,minute:N,timeZoneName:Ye},Sr={year:N,month:Fe,day:N,hour:N,minute:N,second:N,timeZoneName:Ye},xr={year:N,month:Fe,day:N,weekday:Fe,hour:N,minute:N,timeZoneName:Fe},vr={year:N,month:Fe,day:N,weekday:Fe,hour:N,minute:N,second:N,timeZoneName:Fe};class Rt{get type(){throw new tt}get name(){throw new tt}get ianaName(){return this.name}get isUniversal(){throw new tt}offsetName(e,s){throw new tt}formatOffset(e,s){throw new tt}offset(e){throw new tt}equals(e){throw new tt}get isValid(){throw new tt}}let vs=null;class os extends Rt{static get instance(){return vs===null&&(vs=new os),vs}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:s,locale:n}){return jr(e,s,n)}formatOffset(e,s){return Ct(this.offset(e),s)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const js=new Map;function si(t){let e=js.get(t);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),js.set(t,e)),e}const ni={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function ri(t,e){const s=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(s),[,r,a,o,c,l,u,f]=n;return[o,r,a,c,l,u,f]}function ai(t,e){const s=t.formatToParts(e),n=[];for(let r=0;r<s.length;r++){const{type:a,value:o}=s[r],c=ni[a];a==="era"?n[c]=o:V(c)||(n[c]=parseInt(o,10))}return n}const ws=new Map;class Xe extends Rt{static create(e){let s=ws.get(e);return s===void 0&&ws.set(e,s=new Xe(e)),s}static resetCache(){ws.clear(),js.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=Xe.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:s,locale:n}){return jr(e,s,n,this.name)}formatOffset(e,s){return Ct(this.offset(e),s)}offset(e){if(!this.valid)return NaN;const s=new Date(e);if(isNaN(s))return NaN;const n=si(this.name);let[r,a,o,c,l,u,f]=n.formatToParts?ai(n,s):ri(n,s);c==="BC"&&(r=-Math.abs(r)+1);const x=cs({year:r,month:a,day:o,hour:l===24?0:l,minute:u,second:f,millisecond:0});let p=+s;const k=p%1e3;return p-=k>=0?k:1e3+k,(x-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let yn={};function ii(t,e={}){const s=JSON.stringify([t,e]);let n=yn[s];return n||(n=new Intl.ListFormat(t,e),yn[s]=n),n}const Cs=new Map;function Ds(t,e={}){const s=JSON.stringify([t,e]);let n=Cs.get(s);return n===void 0&&(n=new Intl.DateTimeFormat(t,e),Cs.set(s,n)),n}const Rs=new Map;function oi(t,e={}){const s=JSON.stringify([t,e]);let n=Rs.get(s);return n===void 0&&(n=new Intl.NumberFormat(t,e),Rs.set(s,n)),n}const Us=new Map;function li(t,e={}){const{base:s,...n}=e,r=JSON.stringify([t,n]);let a=Us.get(r);return a===void 0&&(a=new Intl.RelativeTimeFormat(t,e),Us.set(r,a)),a}let Mt=null;function ci(){return Mt||(Mt=new Intl.DateTimeFormat().resolvedOptions().locale,Mt)}const Ls=new Map;function wr(t){let e=Ls.get(t);return e===void 0&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),Ls.set(t,e)),e}const Fs=new Map;function ui(t){let e=Fs.get(t);if(!e){const s=new Intl.Locale(t);e="getWeekInfo"in s?s.getWeekInfo():s.weekInfo,"minimalDays"in e||(e={...Ar,...e}),Fs.set(t,e)}return e}function di(t){const e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));const s=t.indexOf("-u-");if(s===-1)return[t];{let n,r;try{n=Ds(t).resolvedOptions(),r=t}catch{const l=t.substring(0,s);n=Ds(l).resolvedOptions(),r=l}const{numberingSystem:a,calendar:o}=n;return[r,a,o]}}function mi(t,e,s){return(s||e)&&(t.includes("-u-")||(t+="-u"),s&&(t+=`-ca-${s}`),e&&(t+=`-nu-${e}`)),t}function fi(t){const e=[];for(let s=1;s<=12;s++){const n=W.utc(2009,s,1);e.push(t(n))}return e}function hi(t){const e=[];for(let s=1;s<=7;s++){const n=W.utc(2016,11,13+s);e.push(t(n))}return e}function Ht(t,e,s,n){const r=t.listingMode();return r==="error"?null:r==="en"?s(e):n(e)}function yi(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||wr(t.locale).numberingSystem==="latn"}class pi{constructor(e,s,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:a,...o}=n;if(!s||Object.keys(o).length>0){const c={useGrouping:!1,...n};n.padTo>0&&(c.minimumIntegerDigits=n.padTo),this.inf=oi(e,c)}}format(e){if(this.inf){const s=this.floor?Math.floor(e):e;return this.inf.format(s)}else{const s=this.floor?Math.floor(e):Ks(e,3);return ge(s,this.padTo)}}}class gi{constructor(e,s,n){this.opts=n,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),c=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Xe.create(c).valid?(r=c,this.dt=e):(r="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const a={...this.opts};a.timeZone=a.timeZone||r,this.dtf=Ds(s,a)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(s=>{if(s.type==="timeZoneName"){const n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...s,value:n}}else return s}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Si{constructor(e,s,n){this.opts={style:"long",...n},!s&&Mr()&&(this.rtf=li(e,n))}format(e,s){return this.rtf?this.rtf.format(e,s):Wi(s,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,s){return this.rtf?this.rtf.formatToParts(e,s):[]}}const Ar={firstDay:1,minimalDays:4,weekend:[6,7]};class se{static fromOpts(e){return se.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,s,n,r,a=!1){const o=e||he.defaultLocale,c=o||(a?"en-US":ci()),l=s||he.defaultNumberingSystem,u=n||he.defaultOutputCalendar,f=Ps(r)||he.defaultWeekSettings;return new se(c,l,u,f,o)}static resetCache(){Mt=null,Cs.clear(),Rs.clear(),Us.clear(),Ls.clear(),Fs.clear()}static fromObject({locale:e,numberingSystem:s,outputCalendar:n,weekSettings:r}={}){return se.create(e,s,n,r)}constructor(e,s,n,r,a){const[o,c,l]=di(e);this.locale=o,this.numberingSystem=s||c||null,this.outputCalendar=n||l||null,this.weekSettings=r,this.intl=mi(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=a,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=yi(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),s=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&s?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:se.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Ps(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,s=!1){return Ht(this,e,Rr,()=>{const n=this.intl==="ja"||this.intl.startsWith("ja-");s&=!n;const r=s?{month:e,day:"numeric"}:{month:e},a=s?"format":"standalone";if(!this.monthsCache[a][e]){const o=n?c=>this.dtFormatter(c,r).format():c=>this.extract(c,r,"month");this.monthsCache[a][e]=fi(o)}return this.monthsCache[a][e]})}weekdays(e,s=!1){return Ht(this,e,Fr,()=>{const n=s?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=s?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=hi(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return Ht(this,void 0,()=>$r,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[W.utc(2016,11,13,9),W.utc(2016,11,13,19)].map(s=>this.extract(s,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Ht(this,e,Pr,()=>{const s={era:e};return this.eraCache[e]||(this.eraCache[e]=[W.utc(-40,1,1),W.utc(2017,1,1)].map(n=>this.extract(n,s,"era"))),this.eraCache[e]})}extract(e,s,n){const r=this.dtFormatter(e,s),a=r.formatToParts(),o=a.find(c=>c.type.toLowerCase()===n);return o?o.value:null}numberFormatter(e={}){return new pi(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,s={}){return new gi(e,this.intl,s)}relFormatter(e={}){return new Si(this.intl,this.isEnglish(),e)}listFormatter(e={}){return ii(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||wr(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Or()?ui(this.locale):Ar}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let As=null;class Ee extends Rt{static get utcInstance(){return As===null&&(As=new Ee(0)),As}static instance(e){return e===0?Ee.utcInstance:new Ee(e)}static parseSpecifier(e){if(e){const s=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(s)return new Ee(us(s[1],s[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Ct(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Ct(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,s){return Ct(this.fixed,s)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class xi extends Rt{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function nt(t,e){if(V(t)||t===null)return e;if(t instanceof Rt)return t;if(bi(t)){const s=t.toLowerCase();return s==="default"?e:s==="local"||s==="system"?os.instance:s==="utc"||s==="gmt"?Ee.utcInstance:Ee.parseSpecifier(s)||Xe.create(t)}else return rt(t)?Ee.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new xi(t)}const Gs={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},pn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},vi=Gs.hanidec.replace(/[\[|\]]/g,"").split("");function wi(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let s=0;s<t.length;s++){const n=t.charCodeAt(s);if(t[s].search(Gs.hanidec)!==-1)e+=vi.indexOf(t[s]);else for(const r in pn){const[a,o]=pn[r];n>=a&&n<=o&&(e+=n-a)}}return parseInt(e,10)}else return e}const $s=new Map;function Ai(){$s.clear()}function He({numberingSystem:t},e=""){const s=t||"latn";let n=$s.get(s);n===void 0&&(n=new Map,$s.set(s,n));let r=n.get(e);return r===void 0&&(r=new RegExp(`${Gs[s]}${e}`),n.set(e,r)),r}let gn=()=>Date.now(),Sn="system",xn=null,vn=null,wn=null,An=60,Tn,Nn=null;class he{static get now(){return gn}static set now(e){gn=e}static set defaultZone(e){Sn=e}static get defaultZone(){return nt(Sn,os.instance)}static get defaultLocale(){return xn}static set defaultLocale(e){xn=e}static get defaultNumberingSystem(){return vn}static set defaultNumberingSystem(e){vn=e}static get defaultOutputCalendar(){return wn}static set defaultOutputCalendar(e){wn=e}static get defaultWeekSettings(){return Nn}static set defaultWeekSettings(e){Nn=Ps(e)}static get twoDigitCutoffYear(){return An}static set twoDigitCutoffYear(e){An=e%100}static get throwOnInvalid(){return Tn}static set throwOnInvalid(e){Tn=e}static resetCaches(){se.resetCache(),Xe.resetCache(),W.resetCache(),Ai()}}class Ge{constructor(e,s){this.reason=e,this.explanation=s}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Tr=[0,31,59,90,120,151,181,212,243,273,304,334],Nr=[0,31,60,91,121,152,182,213,244,274,305,335];function Ve(t,e){return new Ge("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Ys(t,e,s){const n=new Date(Date.UTC(t,e-1,s));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const r=n.getUTCDay();return r===0?7:r}function br(t,e,s){return s+(Ut(t)?Nr:Tr)[e-1]}function kr(t,e){const s=Ut(t)?Nr:Tr,n=s.findIndex(a=>a<e),r=e-s[n];return{month:n+1,day:r}}function _s(t,e){return(t-e+7)%7+1}function ss(t,e=4,s=1){const{year:n,month:r,day:a}=t,o=br(n,r,a),c=_s(Ys(n,r,a),s);let l=Math.floor((o-c+14-e)/7),u;return l<1?(u=n-1,l=Dt(u,e,s)):l>Dt(n,e,s)?(u=n+1,l=1):u=n,{weekYear:u,weekNumber:l,weekday:c,...ds(t)}}function bn(t,e=4,s=1){const{weekYear:n,weekNumber:r,weekday:a}=t,o=_s(Ys(n,1,e),s),c=xt(n);let l=r*7+a-o-7+e,u;l<1?(u=n-1,l+=xt(u)):l>c?(u=n+1,l-=xt(n)):u=n;const{month:f,day:h}=kr(u,l);return{year:u,month:f,day:h,...ds(t)}}function Ts(t){const{year:e,month:s,day:n}=t,r=br(e,s,n);return{year:e,ordinal:r,...ds(t)}}function kn(t){const{year:e,ordinal:s}=t,{month:n,day:r}=kr(e,s);return{year:e,month:n,day:r,...ds(t)}}function In(t,e){if(!V(t.localWeekday)||!V(t.localWeekNumber)||!V(t.localWeekYear)){if(!V(t.weekday)||!V(t.weekNumber)||!V(t.weekYear))throw new St("Cannot mix locale-based week fields with ISO-based week fields");return V(t.localWeekday)||(t.weekday=t.localWeekday),V(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),V(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Ti(t,e=4,s=1){const n=ls(t.weekYear),r=Be(t.weekNumber,1,Dt(t.weekYear,e,s)),a=Be(t.weekday,1,7);return n?r?a?!1:Ve("weekday",t.weekday):Ve("week",t.weekNumber):Ve("weekYear",t.weekYear)}function Ni(t){const e=ls(t.year),s=Be(t.ordinal,1,xt(t.year));return e?s?!1:Ve("ordinal",t.ordinal):Ve("year",t.year)}function Ir(t){const e=ls(t.year),s=Be(t.month,1,12),n=Be(t.day,1,ns(t.year,t.month));return e?s?n?!1:Ve("day",t.day):Ve("month",t.month):Ve("year",t.year)}function Er(t){const{hour:e,minute:s,second:n,millisecond:r}=t,a=Be(e,0,23)||e===24&&s===0&&n===0&&r===0,o=Be(s,0,59),c=Be(n,0,59),l=Be(r,0,999);return a?o?c?l?!1:Ve("millisecond",r):Ve("second",n):Ve("minute",s):Ve("hour",e)}function V(t){return typeof t>"u"}function rt(t){return typeof t=="number"}function ls(t){return typeof t=="number"&&t%1===0}function bi(t){return typeof t=="string"}function ki(t){return Object.prototype.toString.call(t)==="[object Date]"}function Mr(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Or(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Ii(t){return Array.isArray(t)?t:[t]}function En(t,e,s){if(t.length!==0)return t.reduce((n,r)=>{const a=[e(r),r];return n&&s(n[0],a[0])===n[0]?n:a},null)[1]}function Ei(t,e){return e.reduce((s,n)=>(s[n]=t[n],s),{})}function wt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Ps(t){if(t==null)return null;if(typeof t!="object")throw new be("Week settings must be an object");if(!Be(t.firstDay,1,7)||!Be(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Be(e,1,7)))throw new be("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Be(t,e,s){return ls(t)&&t>=e&&t<=s}function Mi(t,e){return t-e*Math.floor(t/e)}function ge(t,e=2){const s=t<0;let n;return s?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function st(t){if(!(V(t)||t===null||t===""))return parseInt(t,10)}function ot(t){if(!(V(t)||t===null||t===""))return parseFloat(t)}function Js(t){if(!(V(t)||t===null||t==="")){const e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function Ks(t,e,s="round"){const n=10**e;switch(s){case"expand":return t>0?Math.ceil(t*n)/n:Math.floor(t*n)/n;case"trunc":return Math.trunc(t*n)/n;case"round":return Math.round(t*n)/n;case"floor":return Math.floor(t*n)/n;case"ceil":return Math.ceil(t*n)/n;default:throw new RangeError(`Value rounding ${s} is out of range`)}}function Ut(t){return t%4===0&&(t%100!==0||t%400===0)}function xt(t){return Ut(t)?366:365}function ns(t,e){const s=Mi(e-1,12)+1,n=t+(e-s)/12;return s===2?Ut(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][s-1]}function cs(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function Mn(t,e,s){return-_s(Ys(t,1,e),s)+e-1}function Dt(t,e=4,s=1){const n=Mn(t,e,s),r=Mn(t+1,e,s);return(xt(t)-n+r)/7}function Ws(t){return t>99?t:t>he.twoDigitCutoffYear?1900+t:2e3+t}function jr(t,e,s,n=null){const r=new Date(t),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);const o={timeZoneName:e,...a},c=new Intl.DateTimeFormat(s,o).formatToParts(r).find(l=>l.type.toLowerCase()==="timezonename");return c?c.value:null}function us(t,e){let s=parseInt(t,10);Number.isNaN(s)&&(s=0);const n=parseInt(e,10)||0,r=s<0||Object.is(s,-0)?-n:n;return s*60+r}function Cr(t){const e=Number(t);if(typeof t=="boolean"||t===""||!Number.isFinite(e))throw new be(`Invalid unit value ${t}`);return e}function rs(t,e){const s={};for(const n in t)if(wt(t,n)){const r=t[n];if(r==null)continue;s[e(n)]=Cr(r)}return s}function Ct(t,e){const s=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),r=t>=0?"+":"-";switch(e){case"short":return`${r}${ge(s,2)}:${ge(n,2)}`;case"narrow":return`${r}${s}${n>0?`:${n}`:""}`;case"techie":return`${r}${ge(s,2)}${ge(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function ds(t){return Ei(t,["hour","minute","second","millisecond"])}const Oi=["January","February","March","April","May","June","July","August","September","October","November","December"],Dr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ji=["J","F","M","A","M","J","J","A","S","O","N","D"];function Rr(t){switch(t){case"narrow":return[...ji];case"short":return[...Dr];case"long":return[...Oi];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Ur=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Lr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ci=["M","T","W","T","F","S","S"];function Fr(t){switch(t){case"narrow":return[...Ci];case"short":return[...Lr];case"long":return[...Ur];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const $r=["AM","PM"],Di=["Before Christ","Anno Domini"],Ri=["BC","AD"],Ui=["B","A"];function Pr(t){switch(t){case"narrow":return[...Ui];case"short":return[...Ri];case"long":return[...Di];default:return null}}function Li(t){return $r[t.hour<12?0:1]}function Fi(t,e){return Fr(e)[t.weekday-1]}function $i(t,e){return Rr(e)[t.month-1]}function Pi(t,e){return Pr(e)[t.year<0?0:1]}function Wi(t,e,s="always",n=!1){const r={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(t)===-1;if(s==="auto"&&a){const h=t==="days";switch(e){case 1:return h?"tomorrow":`next ${r[t][0]}`;case-1:return h?"yesterday":`last ${r[t][0]}`;case 0:return h?"today":`this ${r[t][0]}`}}const o=Object.is(e,-0)||e<0,c=Math.abs(e),l=c===1,u=r[t],f=n?l?u[1]:u[2]||u[1]:l?r[t][0]:t;return o?`${c} ${f} ago`:`in ${c} ${f}`}function On(t,e){let s="";for(const n of t)n.literal?s+=n.val:s+=e(n.val);return s}const Vi={D:ts,DD:sr,DDD:nr,DDDD:rr,t:ar,tt:ir,ttt:or,tttt:lr,T:cr,TT:ur,TTT:dr,TTTT:mr,f:fr,ff:yr,fff:gr,ffff:xr,F:hr,FF:pr,FFF:Sr,FFFF:vr};class ke{static create(e,s={}){return new ke(e,s)}static parseFormat(e){let s=null,n="",r=!1;const a=[];for(let o=0;o<e.length;o++){const c=e.charAt(o);c==="'"?((n.length>0||r)&&a.push({literal:r||/^\s+$/.test(n),val:n===""?"'":n}),s=null,n="",r=!r):r||c===s?n+=c:(n.length>0&&a.push({literal:/^\s+$/.test(n),val:n}),n=c,s=c)}return n.length>0&&a.push({literal:r||/^\s+$/.test(n),val:n}),a}static macroTokenToFormatOpts(e){return Vi[e]}constructor(e,s){this.opts=s,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,s){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...s}).format()}dtFormatter(e,s={}){return this.loc.dtFormatter(e,{...this.opts,...s})}formatDateTime(e,s){return this.dtFormatter(e,s).format()}formatDateTimeParts(e,s){return this.dtFormatter(e,s).formatToParts()}formatInterval(e,s){return this.dtFormatter(e.start,s).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,s){return this.dtFormatter(e,s).resolvedOptions()}num(e,s=0,n=void 0){if(this.opts.forceSimple)return ge(e,s);const r={...this.opts};return s>0&&(r.padTo=s),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,s){const n=this.loc.listingMode()==="en",r=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(p,k)=>this.loc.extract(e,p,k),o=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",c=()=>n?Li(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(p,k)=>n?$i(e,p):a(k?{month:p}:{month:p,day:"numeric"},"month"),u=(p,k)=>n?Fi(e,p):a(k?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),f=p=>{const k=ke.macroTokenToFormatOpts(p);return k?this.formatWithSystemDefault(e,k):p},h=p=>n?Pi(e,p):a({era:p},"era"),x=p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return c();case"d":return r?a({day:"numeric"},"day"):this.num(e.day);case"dd":return r?a({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return r?a({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return r?a({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return r?a({month:"numeric"},"month"):this.num(e.month);case"MM":return r?a({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return r?a({year:"numeric"},"year"):this.num(e.year);case"yy":return r?a({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?a({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?a({year:"numeric"},"year"):this.num(e.year,6);case"G":return h("short");case"GG":return h("long");case"GGGGG":return h("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return f(p)}};return On(ke.parseFormat(s),x)}formatDurationFromString(e,s){const n=this.opts.signMode==="negativeLargestOnly"?-1:1,r=f=>{switch(f[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},a=(f,h)=>x=>{const p=r(x);if(p){const k=h.isNegativeDuration&&p!==h.largestUnit?n:1;let j;return this.opts.signMode==="negativeLargestOnly"&&p!==h.largestUnit?j="never":this.opts.signMode==="all"?j="always":j="auto",this.num(f.get(p)*k,x.length,j)}else return x},o=ke.parseFormat(s),c=o.reduce((f,{literal:h,val:x})=>h?f:f.concat(x),[]),l=e.shiftTo(...c.map(r).filter(f=>f)),u={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return On(o,a(l,u))}}const Wr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function At(...t){const e=t.reduce((s,n)=>s+n.source,"");return RegExp(`^${e}$`)}function Tt(...t){return e=>t.reduce(([s,n,r],a)=>{const[o,c,l]=a(e,r);return[{...s,...o},c||n,l]},[{},null,1]).slice(0,2)}function Nt(t,...e){if(t==null)return[null,null];for(const[s,n]of e){const r=s.exec(t);if(r)return n(r)}return[null,null]}function Vr(...t){return(e,s)=>{const n={};let r;for(r=0;r<t.length;r++)n[t[r]]=st(e[s+r]);return[n,null,s+r]}}const Br=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Bi=`(?:${Br.source}?(?:\\[(${Wr.source})\\])?)?`,Qs=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Zr=RegExp(`${Qs.source}${Bi}`),Xs=RegExp(`(?:[Tt]${Zr.source})?`),Zi=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,zi=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Hi=/(\d{4})-?(\d{3})/,qi=Vr("weekYear","weekNumber","weekDay"),Gi=Vr("year","ordinal"),Yi=/(\d{4})-(\d\d)-(\d\d)/,zr=RegExp(`${Qs.source} ?(?:${Br.source}|(${Wr.source}))?`),_i=RegExp(`(?: ${zr.source})?`);function vt(t,e,s){const n=t[e];return V(n)?s:st(n)}function Ji(t,e){return[{year:vt(t,e),month:vt(t,e+1,1),day:vt(t,e+2,1)},null,e+3]}function bt(t,e){return[{hours:vt(t,e,0),minutes:vt(t,e+1,0),seconds:vt(t,e+2,0),milliseconds:Js(t[e+3])},null,e+4]}function Lt(t,e){const s=!t[e]&&!t[e+1],n=us(t[e+1],t[e+2]),r=s?null:Ee.instance(n);return[{},r,e+3]}function Ft(t,e){const s=t[e]?Xe.create(t[e]):null;return[{},s,e+1]}const Ki=RegExp(`^T?${Qs.source}$`),Qi=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Xi(t){const[e,s,n,r,a,o,c,l,u]=t,f=e[0]==="-",h=l&&l[0]==="-",x=(p,k=!1)=>p!==void 0&&(k||p&&f)?-p:p;return[{years:x(ot(s)),months:x(ot(n)),weeks:x(ot(r)),days:x(ot(a)),hours:x(ot(o)),minutes:x(ot(c)),seconds:x(ot(l),l==="-0"),milliseconds:x(Js(u),h)}]}const eo={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function en(t,e,s,n,r,a,o){const c={year:e.length===2?Ws(st(e)):st(e),month:Dr.indexOf(s)+1,day:st(n),hour:st(r),minute:st(a)};return o&&(c.second=st(o)),t&&(c.weekday=t.length>3?Ur.indexOf(t)+1:Lr.indexOf(t)+1),c}const to=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function so(t){const[,e,s,n,r,a,o,c,l,u,f,h]=t,x=en(e,r,n,s,a,o,c);let p;return l?p=eo[l]:u?p=0:p=us(f,h),[x,new Ee(p)]}function no(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const ro=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,ao=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,io=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function jn(t){const[,e,s,n,r,a,o,c]=t;return[en(e,r,n,s,a,o,c),Ee.utcInstance]}function oo(t){const[,e,s,n,r,a,o,c]=t;return[en(e,c,s,n,r,a,o),Ee.utcInstance]}const lo=At(Zi,Xs),co=At(zi,Xs),uo=At(Hi,Xs),mo=At(Zr),Hr=Tt(Ji,bt,Lt,Ft),fo=Tt(qi,bt,Lt,Ft),ho=Tt(Gi,bt,Lt,Ft),yo=Tt(bt,Lt,Ft);function po(t){return Nt(t,[lo,Hr],[co,fo],[uo,ho],[mo,yo])}function go(t){return Nt(no(t),[to,so])}function So(t){return Nt(t,[ro,jn],[ao,jn],[io,oo])}function xo(t){return Nt(t,[Qi,Xi])}const vo=Tt(bt);function wo(t){return Nt(t,[Ki,vo])}const Ao=At(Yi,_i),To=At(zr),No=Tt(bt,Lt,Ft);function bo(t){return Nt(t,[Ao,Hr],[To,No])}const Cn="Invalid Duration",qr={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},ko={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...qr},We=146097/400,yt=146097/4800,Io={years:{quarters:4,months:12,weeks:We/7,days:We,hours:We*24,minutes:We*24*60,seconds:We*24*60*60,milliseconds:We*24*60*60*1e3},quarters:{months:3,weeks:We/28,days:We/4,hours:We*24/4,minutes:We*24*60/4,seconds:We*24*60*60/4,milliseconds:We*24*60*60*1e3/4},months:{weeks:yt/7,days:yt,hours:yt*24,minutes:yt*24*60,seconds:yt*24*60*60,milliseconds:yt*24*60*60*1e3},...qr},ct=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Eo=ct.slice(0).reverse();function Ke(t,e,s=!1){const n={values:s?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new ee(n)}function Gr(t,e){let s=e.milliseconds??0;for(const n of Eo.slice(1))e[n]&&(s+=e[n]*t[n].milliseconds);return s}function Dn(t,e){const s=Gr(t,e)<0?-1:1;ct.reduceRight((n,r)=>{if(V(e[r]))return n;if(n){const a=e[n]*s,o=t[r][n],c=Math.floor(a/o);e[r]+=c*s,e[n]-=c*o*s}return r},null),ct.reduce((n,r)=>{if(V(e[r]))return n;if(n){const a=e[n]%1;e[n]-=a,e[r]+=a*t[n][r]}return r},null)}function Rn(t){const e={};for(const[s,n]of Object.entries(t))n!==0&&(e[s]=n);return e}class ee{constructor(e){const s=e.conversionAccuracy==="longterm"||!1;let n=s?Io:ko;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||se.create(),this.conversionAccuracy=s?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,s){return ee.fromObject({milliseconds:e},s)}static fromObject(e,s={}){if(e==null||typeof e!="object")throw new be(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new ee({values:rs(e,ee.normalizeUnit),loc:se.fromObject(s),conversionAccuracy:s.conversionAccuracy,matrix:s.matrix})}static fromDurationLike(e){if(rt(e))return ee.fromMillis(e);if(ee.isDuration(e))return e;if(typeof e=="object")return ee.fromObject(e);throw new be(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,s){const[n]=xo(e);return n?ee.fromObject(n,s):ee.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,s){const[n]=wo(e);return n?ee.fromObject(n,s):ee.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,s=null){if(!e)throw new be("need to specify a reason the Duration is invalid");const n=e instanceof Ge?e:new Ge(e,s);if(he.throwOnInvalid)throw new Xa(n);return new ee({invalid:n})}static normalizeUnit(e){const s={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!s)throw new tr(e);return s}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,s={}){const n={...s,floor:s.round!==!1&&s.floor!==!1};return this.isValid?ke.create(this.loc,n).formatDurationFromString(this,e):Cn}toHuman(e={}){if(!this.isValid)return Cn;const s=e.showZeros!==!1,n=ct.map(r=>{const a=this.values[r];return V(a)||a===0&&!s?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(a)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Ks(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const s=this.toMillis();return s<0||s>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},W.fromMillis(s,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Gr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const s=ee.fromDurationLike(e),n={};for(const r of ct)(wt(s.values,r)||wt(this.values,r))&&(n[r]=s.get(r)+this.get(r));return Ke(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const s=ee.fromDurationLike(e);return this.plus(s.negate())}mapUnits(e){if(!this.isValid)return this;const s={};for(const n of Object.keys(this.values))s[n]=Cr(e(this.values[n],n));return Ke(this,{values:s},!0)}get(e){return this[ee.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const s={...this.values,...rs(e,ee.normalizeUnit)};return Ke(this,{values:s})}reconfigure({locale:e,numberingSystem:s,conversionAccuracy:n,matrix:r}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:s}),matrix:r,conversionAccuracy:n};return Ke(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Dn(this.matrix,e),Ke(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Rn(this.normalize().shiftToAll().toObject());return Ke(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>ee.normalizeUnit(o));const s={},n={},r=this.toObject();let a;for(const o of ct)if(e.indexOf(o)>=0){a=o;let c=0;for(const u in n)c+=this.matrix[u][o]*n[u],n[u]=0;rt(r[o])&&(c+=r[o]);const l=Math.trunc(c);s[o]=l,n[o]=(c*1e3-l*1e3)/1e3}else rt(r[o])&&(n[o]=r[o]);for(const o in n)n[o]!==0&&(s[a]+=o===a?n[o]:n[o]/this.matrix[a][o]);return Dn(this.matrix,s),Ke(this,{values:s},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const s of Object.keys(this.values))e[s]=this.values[s]===0?0:-this.values[s];return Ke(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=Rn(this.values);return Ke(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function s(n,r){return n===void 0||n===0?r===void 0||r===0:n===r}for(const n of ct)if(!s(this.values[n],e.values[n]))return!1;return!0}}const pt="Invalid Interval";function Mo(t,e){return!t||!t.isValid?fe.invalid("missing or invalid start"):!e||!e.isValid?fe.invalid("missing or invalid end"):e<t?fe.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}class fe{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,s=null){if(!e)throw new be("need to specify a reason the Interval is invalid");const n=e instanceof Ge?e:new Ge(e,s);if(he.throwOnInvalid)throw new Qa(n);return new fe({invalid:n})}static fromDateTimes(e,s){const n=It(e),r=It(s),a=Mo(n,r);return a??new fe({start:n,end:r})}static after(e,s){const n=ee.fromDurationLike(s),r=It(e);return fe.fromDateTimes(r,r.plus(n))}static before(e,s){const n=ee.fromDurationLike(s),r=It(e);return fe.fromDateTimes(r.minus(n),r)}static fromISO(e,s){const[n,r]=(e||"").split("/",2);if(n&&r){let a,o;try{a=W.fromISO(n,s),o=a.isValid}catch{o=!1}let c,l;try{c=W.fromISO(r,s),l=c.isValid}catch{l=!1}if(o&&l)return fe.fromDateTimes(a,c);if(o){const u=ee.fromISO(r,s);if(u.isValid)return fe.after(a,u)}else if(l){const u=ee.fromISO(n,s);if(u.isValid)return fe.before(c,u)}}return fe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",s){if(!this.isValid)return NaN;const n=this.start.startOf(e,s);let r;return s?.useLocaleWeeks?r=this.end.reconfigure({locale:n.locale}):r=this.end,r=r.startOf(e,s),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:s}={}){return this.isValid?fe.fromDateTimes(e||this.s,s||this.e):this}splitAt(...e){if(!this.isValid)return[];const s=e.map(It).filter(o=>this.contains(o)).sort((o,c)=>o.toMillis()-c.toMillis()),n=[];let{s:r}=this,a=0;for(;r<this.e;){const o=s[a]||this.e,c=+o>+this.e?this.e:o;n.push(fe.fromDateTimes(r,c)),r=c,a+=1}return n}splitBy(e){const s=ee.fromDurationLike(e);if(!this.isValid||!s.isValid||s.as("milliseconds")===0)return[];let{s:n}=this,r=1,a;const o=[];for(;n<this.e;){const c=this.start.plus(s.mapUnits(l=>l*r));a=+c>+this.e?this.e:c,o.push(fe.fromDateTimes(n,a)),n=a,r+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const s=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return s>=n?null:fe.fromDateTimes(s,n)}union(e){if(!this.isValid)return this;const s=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return fe.fromDateTimes(s,n)}static merge(e){const[s,n]=e.sort((r,a)=>r.s-a.s).reduce(([r,a],o)=>a?a.overlaps(o)||a.abutsStart(o)?[r,a.union(o)]:[r.concat([a]),o]:[r,o],[[],null]);return n&&s.push(n),s}static xor(e){let s=null,n=0;const r=[],a=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),o=Array.prototype.concat(...a),c=o.sort((l,u)=>l.time-u.time);for(const l of c)n+=l.type==="s"?1:-1,n===1?s=l.time:(s&&+s!=+l.time&&r.push(fe.fromDateTimes(s,l.time)),s=null);return fe.merge(r)}difference(...e){return fe.xor([this].concat(e)).map(s=>this.intersection(s)).filter(s=>s&&!s.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:pt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=ts,s={}){return this.isValid?ke.create(this.s.loc.clone(s),e).formatInterval(this):pt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:pt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:pt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:pt}toFormat(e,{separator:s=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${s}${this.e.toFormat(e)}`:pt}toDuration(e,s){return this.isValid?this.e.diff(this.s,e,s):ee.invalid(this.invalidReason)}mapEndpoints(e){return fe.fromDateTimes(e(this.s),e(this.e))}}class qt{static hasDST(e=he.defaultZone){const s=W.now().setZone(e).set({month:12});return!e.isUniversal&&s.offset!==s.set({month:6}).offset}static isValidIANAZone(e){return Xe.isValidZone(e)}static normalizeZone(e){return nt(e,he.defaultZone)}static getStartOfWeek({locale:e=null,locObj:s=null}={}){return(s||se.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:s=null}={}){return(s||se.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:s=null}={}){return(s||se.create(e)).getWeekendDays().slice()}static months(e="long",{locale:s=null,numberingSystem:n=null,locObj:r=null,outputCalendar:a="gregory"}={}){return(r||se.create(s,n,a)).months(e)}static monthsFormat(e="long",{locale:s=null,numberingSystem:n=null,locObj:r=null,outputCalendar:a="gregory"}={}){return(r||se.create(s,n,a)).months(e,!0)}static weekdays(e="long",{locale:s=null,numberingSystem:n=null,locObj:r=null}={}){return(r||se.create(s,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:s=null,numberingSystem:n=null,locObj:r=null}={}){return(r||se.create(s,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return se.create(e).meridiems()}static eras(e="short",{locale:s=null}={}){return se.create(s,null,"gregory").eras(e)}static features(){return{relative:Mr(),localeWeek:Or()}}}function Un(t,e){const s=r=>r.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=s(e)-s(t);return Math.floor(ee.fromMillis(n).as("days"))}function Oo(t,e,s){const n=[["years",(l,u)=>u.year-l.year],["quarters",(l,u)=>u.quarter-l.quarter+(u.year-l.year)*4],["months",(l,u)=>u.month-l.month+(u.year-l.year)*12],["weeks",(l,u)=>{const f=Un(l,u);return(f-f%7)/7}],["days",Un]],r={},a=t;let o,c;for(const[l,u]of n)s.indexOf(l)>=0&&(o=l,r[l]=u(t,e),c=a.plus(r),c>e?(r[l]--,t=a.plus(r),t>e&&(c=t,r[l]--,t=a.plus(r))):t=c);return[t,r,c,o]}function jo(t,e,s,n){let[r,a,o,c]=Oo(t,e,s);const l=e-r,u=s.filter(h=>["hours","minutes","seconds","milliseconds"].indexOf(h)>=0);u.length===0&&(o<e&&(o=r.plus({[c]:1})),o!==r&&(a[c]=(a[c]||0)+l/(o-r)));const f=ee.fromObject(a,n);return u.length>0?ee.fromMillis(l,n).shiftTo(...u).plus(f):f}const Co="missing Intl.DateTimeFormat.formatToParts support";function te(t,e=s=>s){return{regex:t,deser:([s])=>e(wi(s))}}const Do=" ",Yr=`[ ${Do}]`,_r=new RegExp(Yr,"g");function Ro(t){return t.replace(/\./g,"\\.?").replace(_r,Yr)}function Ln(t){return t.replace(/\./g,"").replace(_r," ").toLowerCase()}function qe(t,e){return t===null?null:{regex:RegExp(t.map(Ro).join("|")),deser:([s])=>t.findIndex(n=>Ln(s)===Ln(n))+e}}function Fn(t,e){return{regex:t,deser:([,s,n])=>us(s,n),groups:e}}function Gt(t){return{regex:t,deser:([e])=>e}}function Uo(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Lo(t,e){const s=He(e),n=He(e,"{2}"),r=He(e,"{3}"),a=He(e,"{4}"),o=He(e,"{6}"),c=He(e,"{1,2}"),l=He(e,"{1,3}"),u=He(e,"{1,6}"),f=He(e,"{1,9}"),h=He(e,"{2,4}"),x=He(e,"{4,6}"),p=O=>({regex:RegExp(Uo(O.val)),deser:([K])=>K,literal:!0}),j=(O=>{if(t.literal)return p(O);switch(O.val){case"G":return qe(e.eras("short"),0);case"GG":return qe(e.eras("long"),0);case"y":return te(u);case"yy":return te(h,Ws);case"yyyy":return te(a);case"yyyyy":return te(x);case"yyyyyy":return te(o);case"M":return te(c);case"MM":return te(n);case"MMM":return qe(e.months("short",!0),1);case"MMMM":return qe(e.months("long",!0),1);case"L":return te(c);case"LL":return te(n);case"LLL":return qe(e.months("short",!1),1);case"LLLL":return qe(e.months("long",!1),1);case"d":return te(c);case"dd":return te(n);case"o":return te(l);case"ooo":return te(r);case"HH":return te(n);case"H":return te(c);case"hh":return te(n);case"h":return te(c);case"mm":return te(n);case"m":return te(c);case"q":return te(c);case"qq":return te(n);case"s":return te(c);case"ss":return te(n);case"S":return te(l);case"SSS":return te(r);case"u":return Gt(f);case"uu":return Gt(c);case"uuu":return te(s);case"a":return qe(e.meridiems(),0);case"kkkk":return te(a);case"kk":return te(h,Ws);case"W":return te(c);case"WW":return te(n);case"E":case"c":return te(s);case"EEE":return qe(e.weekdays("short",!1),1);case"EEEE":return qe(e.weekdays("long",!1),1);case"ccc":return qe(e.weekdays("short",!0),1);case"cccc":return qe(e.weekdays("long",!0),1);case"Z":case"ZZ":return Fn(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return Fn(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return Gt(/[a-z_+-/]{1,256}?/i);case" ":return Gt(/[^\S\n\r]/);default:return p(O)}})(t)||{invalidReason:Co};return j.token=t,j}const Fo={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function $o(t,e,s){const{type:n,value:r}=t;if(n==="literal"){const l=/^\s+$/.test(r);return{literal:!l,val:l?" ":r}}const a=e[n];let o=n;n==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=s.hour12?"hour12":"hour24");let c=Fo[o];if(typeof c=="object"&&(c=c[a]),c)return{literal:!1,val:c}}function Po(t){return[`^${t.map(s=>s.regex).reduce((s,n)=>`${s}(${n.source})`,"")}$`,t]}function Wo(t,e,s){const n=t.match(e);if(n){const r={};let a=1;for(const o in s)if(wt(s,o)){const c=s[o],l=c.groups?c.groups+1:1;!c.literal&&c.token&&(r[c.token.val[0]]=c.deser(n.slice(a,a+l))),a+=l}return[n,r]}else return[n,{}]}function Vo(t){const e=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let s=null,n;return V(t.z)||(s=Xe.create(t.z)),V(t.Z)||(s||(s=new Ee(t.Z)),n=t.Z),V(t.q)||(t.M=(t.q-1)*3+1),V(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),V(t.u)||(t.S=Js(t.u)),[Object.keys(t).reduce((a,o)=>{const c=e(o);return c&&(a[c]=t[o]),a},{}),s,n]}let Ns=null;function Bo(){return Ns||(Ns=W.fromMillis(1555555555555)),Ns}function Zo(t,e){if(t.literal)return t;const s=ke.macroTokenToFormatOpts(t.val),n=Xr(s,e);return n==null||n.includes(void 0)?t:n}function Jr(t,e){return Array.prototype.concat(...t.map(s=>Zo(s,e)))}class Kr{constructor(e,s){if(this.locale=e,this.format=s,this.tokens=Jr(ke.parseFormat(s),e),this.units=this.tokens.map(n=>Lo(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,r]=Po(this.units);this.regex=RegExp(n,"i"),this.handlers=r}}explainFromTokens(e){if(this.isValid){const[s,n]=Wo(e,this.regex,this.handlers),[r,a,o]=n?Vo(n):[null,null,void 0];if(wt(n,"a")&&wt(n,"H"))throw new St("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:s,matches:n,result:r,zone:a,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function Qr(t,e,s){return new Kr(t,s).explainFromTokens(e)}function zo(t,e,s){const{result:n,zone:r,specificOffset:a,invalidReason:o}=Qr(t,e,s);return[n,r,a,o]}function Xr(t,e){if(!t)return null;const n=ke.create(e,t).dtFormatter(Bo()),r=n.formatToParts(),a=n.resolvedOptions();return r.map(o=>$o(o,t,a))}const bs="Invalid DateTime",$n=864e13;function Ot(t){return new Ge("unsupported zone",`the zone "${t.name}" is not supported`)}function ks(t){return t.weekData===null&&(t.weekData=ss(t.c)),t.weekData}function Is(t){return t.localWeekData===null&&(t.localWeekData=ss(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function lt(t,e){const s={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new W({...s,...e,old:s})}function ea(t,e,s){let n=t-e*60*1e3;const r=s.offset(n);if(e===r)return[n,e];n-=(r-e)*60*1e3;const a=s.offset(n);return r===a?[n,r]:[t-Math.min(r,a)*60*1e3,Math.max(r,a)]}function Yt(t,e){t+=e*60*1e3;const s=new Date(t);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),hour:s.getUTCHours(),minute:s.getUTCMinutes(),second:s.getUTCSeconds(),millisecond:s.getUTCMilliseconds()}}function Qt(t,e,s){return ea(cs(t),e,s)}function Pn(t,e){const s=t.o,n=t.c.year+Math.trunc(e.years),r=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,a={...t.c,year:n,month:r,day:Math.min(t.c.day,ns(n,r))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=ee.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),c=cs(a);let[l,u]=ea(c,s,t.zone);return o!==0&&(l+=o,u=t.zone.offset(l)),{ts:l,o:u}}function gt(t,e,s,n,r,a){const{setZone:o,zone:c}=s;if(t&&Object.keys(t).length!==0||e){const l=e||c,u=W.fromObject(t,{...s,zone:l,specificOffset:a});return o?u:u.setZone(c)}else return W.invalid(new Ge("unparsable",`the input "${r}" can't be parsed as ${n}`))}function _t(t,e,s=!0){return t.isValid?ke.create(se.create("en-US"),{allowZ:s,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Es(t,e,s){const n=t.c.year>9999||t.c.year<0;let r="";if(n&&t.c.year>=0&&(r+="+"),r+=ge(t.c.year,n?6:4),s==="year")return r;if(e){if(r+="-",r+=ge(t.c.month),s==="month")return r;r+="-"}else if(r+=ge(t.c.month),s==="month")return r;return r+=ge(t.c.day),r}function Wn(t,e,s,n,r,a,o){let c=!s||t.c.millisecond!==0||t.c.second!==0,l="";switch(o){case"day":case"month":case"year":break;default:if(l+=ge(t.c.hour),o==="hour")break;if(e){if(l+=":",l+=ge(t.c.minute),o==="minute")break;c&&(l+=":",l+=ge(t.c.second))}else{if(l+=ge(t.c.minute),o==="minute")break;c&&(l+=ge(t.c.second))}if(o==="second")break;c&&(!n||t.c.millisecond!==0)&&(l+=".",l+=ge(t.c.millisecond,3))}return r&&(t.isOffsetFixed&&t.offset===0&&!a?l+="Z":t.o<0?(l+="-",l+=ge(Math.trunc(-t.o/60)),l+=":",l+=ge(Math.trunc(-t.o%60))):(l+="+",l+=ge(Math.trunc(t.o/60)),l+=":",l+=ge(Math.trunc(t.o%60)))),a&&(l+="["+t.zone.ianaName+"]"),l}const ta={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Ho={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},qo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Xt=["year","month","day","hour","minute","second","millisecond"],Go=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Yo=["year","ordinal","hour","minute","second","millisecond"];function es(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new tr(t);return e}function Vn(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return es(t)}}function _o(t){if(jt===void 0&&(jt=he.now()),t.type!=="iana")return t.offset(jt);const e=t.name;let s=Vs.get(e);return s===void 0&&(s=t.offset(jt),Vs.set(e,s)),s}function Bn(t,e){const s=nt(e.zone,he.defaultZone);if(!s.isValid)return W.invalid(Ot(s));const n=se.fromObject(e);let r,a;if(V(t.year))r=he.now();else{for(const l of Xt)V(t[l])&&(t[l]=ta[l]);const o=Ir(t)||Er(t);if(o)return W.invalid(o);const c=_o(s);[r,a]=Qt(t,c,s)}return new W({ts:r,zone:s,loc:n,o:a})}function Zn(t,e,s){const n=V(s.round)?!0:s.round,r=V(s.rounding)?"trunc":s.rounding,a=(c,l)=>(c=Ks(c,n||s.calendary?0:2,s.calendary?"round":r),e.loc.clone(s).relFormatter(s).format(c,l)),o=c=>s.calendary?e.hasSame(t,c)?0:e.startOf(c).diff(t.startOf(c),c).get(c):e.diff(t,c).get(c);if(s.unit)return a(o(s.unit),s.unit);for(const c of s.units){const l=o(c);if(Math.abs(l)>=1)return a(l,c)}return a(t>e?-0:0,s.units[s.units.length-1])}function zn(t){let e={},s;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],s=Array.from(t).slice(0,t.length-1)):s=Array.from(t),[e,s]}let jt;const Vs=new Map;class W{constructor(e){const s=e.zone||he.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Ge("invalid input"):null)||(s.isValid?null:Ot(s));this.ts=V(e.ts)?he.now():e.ts;let r=null,a=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(s))[r,a]=[e.old.c,e.old.o];else{const c=rt(e.o)&&!e.old?e.o:s.offset(this.ts);r=Yt(this.ts,c),n=Number.isNaN(r.year)?new Ge("invalid input"):null,r=n?null:r,a=n?null:c}this._zone=s,this.loc=e.loc||se.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=a,this.isLuxonDateTime=!0}static now(){return new W({})}static local(){const[e,s]=zn(arguments),[n,r,a,o,c,l,u]=s;return Bn({year:n,month:r,day:a,hour:o,minute:c,second:l,millisecond:u},e)}static utc(){const[e,s]=zn(arguments),[n,r,a,o,c,l,u]=s;return e.zone=Ee.utcInstance,Bn({year:n,month:r,day:a,hour:o,minute:c,second:l,millisecond:u},e)}static fromJSDate(e,s={}){const n=ki(e)?e.valueOf():NaN;if(Number.isNaN(n))return W.invalid("invalid input");const r=nt(s.zone,he.defaultZone);return r.isValid?new W({ts:n,zone:r,loc:se.fromObject(s)}):W.invalid(Ot(r))}static fromMillis(e,s={}){if(rt(e))return e<-$n||e>$n?W.invalid("Timestamp out of range"):new W({ts:e,zone:nt(s.zone,he.defaultZone),loc:se.fromObject(s)});throw new be(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,s={}){if(rt(e))return new W({ts:e*1e3,zone:nt(s.zone,he.defaultZone),loc:se.fromObject(s)});throw new be("fromSeconds requires a numerical input")}static fromObject(e,s={}){e=e||{};const n=nt(s.zone,he.defaultZone);if(!n.isValid)return W.invalid(Ot(n));const r=se.fromObject(s),a=rs(e,Vn),{minDaysInFirstWeek:o,startOfWeek:c}=In(a,r),l=he.now(),u=V(s.specificOffset)?n.offset(l):s.specificOffset,f=!V(a.ordinal),h=!V(a.year),x=!V(a.month)||!V(a.day),p=h||x,k=a.weekYear||a.weekNumber;if((p||f)&&k)throw new St("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(x&&f)throw new St("Can't mix ordinal dates with month/day");const j=k||a.weekday&&!p;let O,K,D=Yt(l,u);j?(O=Go,K=Ho,D=ss(D,o,c)):f?(O=Yo,K=qo,D=Ts(D)):(O=Xt,K=ta);let H=!1;for(const S of O){const E=a[S];V(E)?H?a[S]=K[S]:a[S]=D[S]:H=!0}const v=j?Ti(a,o,c):f?Ni(a):Ir(a),L=v||Er(a);if(L)return W.invalid(L);const $=j?bn(a,o,c):f?kn(a):a,[U,q]=Qt($,u,n),y=new W({ts:U,zone:n,o:q,loc:r});return a.weekday&&p&&e.weekday!==y.weekday?W.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${y.toISO()}`):y.isValid?y:W.invalid(y.invalid)}static fromISO(e,s={}){const[n,r]=po(e);return gt(n,r,s,"ISO 8601",e)}static fromRFC2822(e,s={}){const[n,r]=go(e);return gt(n,r,s,"RFC 2822",e)}static fromHTTP(e,s={}){const[n,r]=So(e);return gt(n,r,s,"HTTP",s)}static fromFormat(e,s,n={}){if(V(e)||V(s))throw new be("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:a=null}=n,o=se.fromOpts({locale:r,numberingSystem:a,defaultToEN:!0}),[c,l,u,f]=zo(o,e,s);return f?W.invalid(f):gt(c,l,n,`format ${s}`,e,u)}static fromString(e,s,n={}){return W.fromFormat(e,s,n)}static fromSQL(e,s={}){const[n,r]=bo(e);return gt(n,r,s,"SQL",e)}static invalid(e,s=null){if(!e)throw new be("need to specify a reason the DateTime is invalid");const n=e instanceof Ge?e:new Ge(e,s);if(he.throwOnInvalid)throw new Ka(n);return new W({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,s={}){const n=Xr(e,se.fromObject(s));return n?n.map(r=>r?r.val:null).join(""):null}static expandFormat(e,s={}){return Jr(ke.parseFormat(e),se.fromObject(s)).map(r=>r.val).join("")}static resetCache(){jt=void 0,Vs.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?ks(this).weekYear:NaN}get weekNumber(){return this.isValid?ks(this).weekNumber:NaN}get weekday(){return this.isValid?ks(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Is(this).weekday:NaN}get localWeekNumber(){return this.isValid?Is(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Is(this).weekYear:NaN}get ordinal(){return this.isValid?Ts(this.c).ordinal:NaN}get monthShort(){return this.isValid?qt.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?qt.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?qt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?qt.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,s=6e4,n=cs(this.c),r=this.zone.offset(n-e),a=this.zone.offset(n+e),o=this.zone.offset(n-r*s),c=this.zone.offset(n-a*s);if(o===c)return[this];const l=n-o*s,u=n-c*s,f=Yt(l,o),h=Yt(u,c);return f.hour===h.hour&&f.minute===h.minute&&f.second===h.second&&f.millisecond===h.millisecond?[lt(this,{ts:l}),lt(this,{ts:u})]:[this]}get isInLeapYear(){return Ut(this.year)}get daysInMonth(){return ns(this.year,this.month)}get daysInYear(){return this.isValid?xt(this.year):NaN}get weeksInWeekYear(){return this.isValid?Dt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Dt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:s,numberingSystem:n,calendar:r}=ke.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:s,numberingSystem:n,outputCalendar:r}}toUTC(e=0,s={}){return this.setZone(Ee.instance(e),s)}toLocal(){return this.setZone(he.defaultZone)}setZone(e,{keepLocalTime:s=!1,keepCalendarTime:n=!1}={}){if(e=nt(e,he.defaultZone),e.equals(this.zone))return this;if(e.isValid){let r=this.ts;if(s||n){const a=e.offset(this.ts),o=this.toObject();[r]=Qt(o,a,e)}return lt(this,{ts:r,zone:e})}else return W.invalid(Ot(e))}reconfigure({locale:e,numberingSystem:s,outputCalendar:n}={}){const r=this.loc.clone({locale:e,numberingSystem:s,outputCalendar:n});return lt(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const s=rs(e,Vn),{minDaysInFirstWeek:n,startOfWeek:r}=In(s,this.loc),a=!V(s.weekYear)||!V(s.weekNumber)||!V(s.weekday),o=!V(s.ordinal),c=!V(s.year),l=!V(s.month)||!V(s.day),u=c||l,f=s.weekYear||s.weekNumber;if((u||o)&&f)throw new St("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&o)throw new St("Can't mix ordinal dates with month/day");let h;a?h=bn({...ss(this.c,n,r),...s},n,r):V(s.ordinal)?(h={...this.toObject(),...s},V(s.day)&&(h.day=Math.min(ns(h.year,h.month),h.day))):h=kn({...Ts(this.c),...s});const[x,p]=Qt(h,this.o,this.zone);return lt(this,{ts:x,o:p})}plus(e){if(!this.isValid)return this;const s=ee.fromDurationLike(e);return lt(this,Pn(this,s))}minus(e){if(!this.isValid)return this;const s=ee.fromDurationLike(e).negate();return lt(this,Pn(this,s))}startOf(e,{useLocaleWeeks:s=!1}={}){if(!this.isValid)return this;const n={},r=ee.normalizeUnit(e);switch(r){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(r==="weeks")if(s){const a=this.loc.getStartOfWeek(),{weekday:o}=this;o<a&&(n.weekNumber=this.weekNumber-1),n.weekday=a}else n.weekday=1;if(r==="quarters"){const a=Math.ceil(this.month/3);n.month=(a-1)*3+1}return this.set(n)}endOf(e,s){return this.isValid?this.plus({[e]:1}).startOf(e,s).minus(1):this}toFormat(e,s={}){return this.isValid?ke.create(this.loc.redefaultToEN(s)).formatDateTimeFromString(this,e):bs}toLocaleString(e=ts,s={}){return this.isValid?ke.create(this.loc.clone(s),e).formatDateTime(this):bs}toLocaleParts(e={}){return this.isValid?ke.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:s=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:a=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=es(o);const c=e==="extended";let l=Es(this,c,o);return Xt.indexOf(o)>=3&&(l+="T"),l+=Wn(this,c,s,n,r,a,o),l}toISODate({format:e="extended",precision:s="day"}={}){return this.isValid?Es(this,e==="extended",es(s)):null}toISOWeekDate(){return _t(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:s=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:a=!1,format:o="extended",precision:c="milliseconds"}={}){return this.isValid?(c=es(c),(r&&Xt.indexOf(c)>=3?"T":"")+Wn(this,o==="extended",s,e,n,a,c)):null}toRFC2822(){return _t(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return _t(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Es(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:s=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(s||e)&&(n&&(r+=" "),s?r+="z":e&&(r+="ZZ")),_t(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():bs}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const s={...this.c};return e.includeConfig&&(s.outputCalendar=this.outputCalendar,s.numberingSystem=this.loc.numberingSystem,s.locale=this.loc.locale),s}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,s="milliseconds",n={}){if(!this.isValid||!e.isValid)return ee.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=Ii(s).map(ee.normalizeUnit),o=e.valueOf()>this.valueOf(),c=o?this:e,l=o?e:this,u=jo(c,l,a,r);return o?u.negate():u}diffNow(e="milliseconds",s={}){return this.diff(W.now(),e,s)}until(e){return this.isValid?fe.fromDateTimes(this,e):this}hasSame(e,s,n){if(!this.isValid)return!1;const r=e.valueOf(),a=this.setZone(e.zone,{keepLocalTime:!0});return a.startOf(s,n)<=r&&r<=a.endOf(s,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const s=e.base||W.fromObject({},{zone:this.zone}),n=e.padding?this<s?-e.padding:e.padding:0;let r=["years","months","days","hours","minutes","seconds"],a=e.unit;return Array.isArray(e.unit)&&(r=e.unit,a=void 0),Zn(s,this.plus(n),{...e,numeric:"always",units:r,unit:a})}toRelativeCalendar(e={}){return this.isValid?Zn(e.base||W.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(W.isDateTime))throw new be("min requires all arguments be DateTimes");return En(e,s=>s.valueOf(),Math.min)}static max(...e){if(!e.every(W.isDateTime))throw new be("max requires all arguments be DateTimes");return En(e,s=>s.valueOf(),Math.max)}static fromFormatExplain(e,s,n={}){const{locale:r=null,numberingSystem:a=null}=n,o=se.fromOpts({locale:r,numberingSystem:a,defaultToEN:!0});return Qr(o,e,s)}static fromStringExplain(e,s,n={}){return W.fromFormatExplain(e,s,n)}static buildFormatParser(e,s={}){const{locale:n=null,numberingSystem:r=null}=s,a=se.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new Kr(a,e)}static fromFormatParser(e,s,n={}){if(V(e)||V(s))throw new be("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:a=null}=n,o=se.fromOpts({locale:r,numberingSystem:a,defaultToEN:!0});if(!o.equals(s.locale))throw new be(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${s.locale}`);const{result:c,zone:l,specificOffset:u,invalidReason:f}=s.explainFromTokens(e);return f?W.invalid(f):gt(c,l,n,`format ${s.format}`,e,u)}static get DATE_SHORT(){return ts}static get DATE_MED(){return sr}static get DATE_MED_WITH_WEEKDAY(){return ei}static get DATE_FULL(){return nr}static get DATE_HUGE(){return rr}static get TIME_SIMPLE(){return ar}static get TIME_WITH_SECONDS(){return ir}static get TIME_WITH_SHORT_OFFSET(){return or}static get TIME_WITH_LONG_OFFSET(){return lr}static get TIME_24_SIMPLE(){return cr}static get TIME_24_WITH_SECONDS(){return ur}static get TIME_24_WITH_SHORT_OFFSET(){return dr}static get TIME_24_WITH_LONG_OFFSET(){return mr}static get DATETIME_SHORT(){return fr}static get DATETIME_SHORT_WITH_SECONDS(){return hr}static get DATETIME_MED(){return yr}static get DATETIME_MED_WITH_SECONDS(){return pr}static get DATETIME_MED_WITH_WEEKDAY(){return ti}static get DATETIME_FULL(){return gr}static get DATETIME_FULL_WITH_SECONDS(){return Sr}static get DATETIME_HUGE(){return xr}static get DATETIME_HUGE_WITH_SECONDS(){return vr}}function It(t){if(W.isDateTime(t))return t;if(t&&t.valueOf&&rt(t.valueOf()))return W.fromJSDate(t);if(t&&typeof t=="object")return W.fromObject(t);throw new be(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function Jo(t,e){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0,timeZone:e})}function Ko(t,e){try{const s=W.fromJSDate(t,{zone:"utc"}).setZone(e),n=s.toJSDate().toLocaleString("en-US",{timeZone:e,timeZoneName:"short"}).split(" ").pop()||void 0,r=s.toFormat("ZZ")||void 0;return{abbr:n,offset:r}}catch{return{}}}function Qo(t){if(!t)return"-";try{const e=new Date(t),s=u=>String(u).padStart(2,"0"),n=s(e.getMonth()+1),r=s(e.getDate()),a=e.getFullYear(),o=s(e.getHours()),c=s(e.getMinutes()),l=s(e.getSeconds());return`${n}/${r}/${a} ${o}:${c}:${l}`}catch{return"-"}}function as(t,e="UTC"){if(!t)return"-";const s=W.fromISO(t,{zone:"utc"}).setZone(e);if(!s.isValid)return"-";const n=s.offsetNameShort,r=s.toFormat("ZZZZ"),a=n.startsWith("GMT")||n===r?r:`${n}/${r}`;return`${s.toFormat("MM/dd/yyyy, hh:mm:ss a")} (${a})`}const Xo={Critical:"#FF3B30",High:"#FFB86A",Medium:"#FFCC00",Low:"#007AFF"},el={Critical:"#FFE2E2",High:"#FF95004D",Medium:"#FEF9C2",Low:"#E0EDFF"};function sa({alerts:t,loading:e=!1,pageSize:s=10,total:n,currentPage:r,severityOptions:a,anomalyOptions:o,spaceOptions:c,onAlertIdClick:l,onFilterChange:u,onPageChange:f,onRefetch:h,resetKey:x}){const p=qs(),k=["completed","false positive"],j=async D=>{try{const H=await p.mutateAsync({alertUniqueId:D.alertId??D.id,alertId:D.id,status:"Reopen",notes:"Reopened",modifiedBy:0});if(H?.responseStatus||H?.Success){const v=H?.Message||H?.data||"Alert reopened successfully.";Ae.toast.success(v)}else{const v=H?.errorMessage||H?.Message||"Failed to reopen alert";Ae.toast.error(v)}}catch{Ae.toast.error("Failed to reopen alert. Please try again.")}},O=[{title:"Severity",dataIndex:"priority",key:"priority",width:120,render:D=>i.jsx(d.Tag,{className:"px-[10px] py-[2px]",style:{border:`2px solid ${Xo[D]}`,backgroundColor:el[String(D)]},children:D})},{title:"Timestamp",dataIndex:"timestamp",key:"timestamp",width:200,render:D=>Qo(D)},{title:"Status",dataIndex:"statusType",key:"statusType",width:140},{title:"Description",dataIndex:"description",key:"description",render:(D,H)=>i.jsxs("div",{children:[i.jsx("a",{onClick:v=>{v.preventDefault(),l?.(H,{sourceTab:"archived"})},className:"inline-block mb-1 text-blue-600",children:H.alertNumber}),i.jsx("div",{className:"text-black/65",children:D})]})},{title:"",key:"menu",width:60,align:"right",render:(D,H)=>i.jsx(d.Dropdown,{trigger:["click"],menu:{items:[{key:"reopen",label:"Reopen"}],onClick:({key:v})=>{v==="reopen"&&j(H)}},children:i.jsx(d.Button,{type:"text",icon:i.jsx(ut.MoreOutlined,{})})})}],K=u?t:(t||[]).filter(D=>k.includes((D.statusType||"").toLowerCase()));return i.jsx(Hs,{data:K,loading:e,pageSize:s,total:n,currentPage:r,columns:O,severityOptions:a,anomalyOptions:o,spaceOptions:c,renderActions:void 0,onAlertIdClick:l,onFilterChange:u,onPageChange:f,onRefetch:h,resetKey:x,excludeCompleted:!1})}function tl({size:t=120,time:e,timeZone:s="America/New_York"}){const{hours:n,minutes:r,seconds:a}=m.useMemo(()=>{const h=new Intl.DateTimeFormat("en-US",{timeZone:s,hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}).formatToParts(e);return{hours:parseInt(h.find(x=>x.type==="hour")?.value||"0",10),minutes:parseInt(h.find(x=>x.type==="minute")?.value||"0",10),seconds:parseInt(h.find(x=>x.type==="second")?.value||"0",10)}},[e,s]),o=a*6,c=r*6+a*.1,l=n%12*30+r*.5,u=t/2;return i.jsxs("div",{className:"relative rounded-full border border-gray-300 bg-white",style:{width:t,height:t},role:"img","aria-label":"Analog Clock",children:[[...Array(12)].map((f,h)=>{const x=h*30,p=6,k=u-4,j=k-p,O=(x-90)*(Math.PI/180),K=u+j*Math.cos(O),D=u+j*Math.sin(O),H=u+k*Math.cos(O),v=u+k*Math.sin(O);return i.jsx("svg",{className:"absolute inset-0",width:t,height:t,children:i.jsx("line",{x1:K,y1:D,x2:H,y2:v,stroke:"#9CA3AF",strokeWidth:h%3===0?2:1,strokeLinecap:"round"})},h)}),i.jsx("svg",{className:"absolute inset-0",width:t,height:t,style:{transform:`rotate(${l}deg)`},children:i.jsx("line",{x1:u,y1:u,x2:u,y2:u-t*.25,stroke:"#1F2937",strokeWidth:4,strokeLinecap:"round"})}),i.jsx("svg",{className:"absolute inset-0",width:t,height:t,style:{transform:`rotate(${c}deg)`},children:i.jsx("line",{x1:u,y1:u,x2:u,y2:u-t*.35,stroke:"#374151",strokeWidth:3,strokeLinecap:"round"})}),i.jsx("svg",{className:"absolute inset-0",width:t,height:t,style:{transform:`rotate(${o}deg)`},children:i.jsx("line",{x1:u,y1:u+t*.08,x2:u,y2:u-t*.38,stroke:"#EF4444",strokeWidth:1.5,strokeLinecap:"round"})}),i.jsx("div",{className:"absolute bg-gray-900 rounded-full",style:{width:8,height:8,left:u-4,top:u-4}})]})}function na({label:t="USA",timeZone:e="America/New_York",updateIntervalMs:s=1e3,className:n}){const[r,a]=m.useState(new Date);m.useEffect(()=>{const u=setInterval(()=>a(new Date),s);return()=>clearInterval(u)},[s]);const o=m.useMemo(()=>Jo(r,e),[r,e]),{abbr:c,offset:l}=m.useMemo(()=>Ko(r,e),[r,e]);return i.jsxs("div",{className:`flex items-center gap-3 ${n||""}`,children:[i.jsx(tl,{time:r,timeZone:e,size:80}),i.jsxs("div",{className:"flex flex-col items-baseline gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[i.jsx("span",{className:"uppercase",children:t}),c&&i.jsxs("span",{className:"p-2 rounded-md border text-[10px] leading-none text-gray-600 bg-gray-50",children:[c," ",l]})]}),i.jsx("div",{className:"text-2xl font-semibold text-gray-700 tracking-wide",children:o})]})]})}const{Text:sl}=d.Typography;function nl({sortBy:t,onChange:e,showActions:s,onSave:n,onClear:r,saving:a}){return i.jsxs(d.Row,{gutter:[16,16],align:"middle",children:[i.jsx(d.Col,{xs:24,md:8,lg:5,children:i.jsxs(d.Space,{className:"w-full items-center",direction:"horizontal",size:12,children:[i.jsx(sl,{className:"text-gray-600 whitespace-nowrap",children:"Sort By:"}),i.jsx(d.Select,{placeholder:"By Severity",value:t,onChange:o=>e({sortBy:o}),options:[{label:"By Severity",value:"By Severity"},{label:"By Created Date",value:"By Created Date"}],className:"w-full",style:{minWidth:"200px"}})]})}),i.jsx(d.Col,{xs:24,md:8,style:{alignSelf:"end"},children:s?i.jsxs(d.Space,{className:"w-full",direction:"horizontal",size:8,children:[i.jsx(d.Button,{onClick:r,disabled:a,children:"Clear"}),i.jsx(d.Button,{type:"primary",onClick:n,loading:a,children:"Save"})]}):null})]})}const Bs=t=>i.jsxs(d.Tag,{children:[i.jsx(ut.PlusOutlined,{})," ",t.length," more"]}),{Text:Qe}=d.Typography;function rl(t){const{selectedRule:e,setSelectedRule:s,ruleOptions:n,minsOptions:r,roleOptions:a,l1mins:o,setL1mins:c,l1role:l,setL1role:u,l2mins:f,setL2mins:h,l2role:x,setL2role:p,l3mins:k,setL3mins:j,l3role:O,setL3role:K,actions:D,setActions:H,thirdPartyIds:v,setThirdPartyIds:L,humanLoop:$,setHumanLoop:U,isAutoExpire:q,setAutoExpire:y,onClear:S,onSave:E,saving:re,onActionTypesLoaded:Se}=t,{rules:C,config:T}=De(),g=T.tenant==="schools",[M,w]=m.useState([]),[R,F]=m.useState([]),[G,Q]=m.useState(!1);m.useEffect(()=>{let ue=!1;return(async()=>{try{Q(!0);const me=await C.getLookups();if(ue||!me||!Array.isArray(me.actionTypes))return;const ye=me.actionTypes.map(ie=>({label:ie.name,value:String(ie.actionTypeId)}));w(ye),Se&&Se(me.actionTypes);const le=Array.isArray(me.thirdParties)?me.thirdParties.map(ie=>({label:ie.thirdPartyName,value:ie.thirdPartyIds??ie.thirdPartyId})):[];F(le)}catch(me){console.error("Error loading lookups",me)}finally{ue||Q(!1)}})(),()=>{ue=!0}},[]);const ne=typeof o=="number"||typeof l=="number",ae=typeof f=="number"||typeof x=="number",oe=typeof o=="number"||typeof l=="number"||typeof f=="number"||typeof x=="number"||typeof k=="number"||typeof O=="number"||Array.isArray(D)&&D.length>0||Array.isArray(v)&&v.length>0||!!$||!!q,xe=!!e&&oe&&!re;return i.jsxs(d.Spin,{spinning:!!re||G,children:[i.jsxs(d.Row,{gutter:[16,16],align:"bottom",children:[i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsx(Qe,{className:"text-gray-700 font-medium block mb-1",children:"Rules"}),i.jsx(d.Select,{placeholder:"Rules",value:e,onChange:s,options:n,className:"w-full"})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(Qe,{className:"text-gray-700 font-medium block mb-1",children:"Level 1 (mins)"})}),i.jsx(d.Col,{span:14,children:i.jsx(Qe,{className:"text-gray-700 font-medium block mb-1",children:"Escalate to"})})]}),i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(d.Select,{className:"w-full",placeholder:"Mins",value:o,onChange:c,options:r})}),i.jsx(d.Col,{span:14,children:i.jsx(d.Select,{placeholder:"Escalate to",className:"w-full",value:l,onChange:u,options:a})})]})]})}),ne&&i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(Qe,{className:"text-gray-700 font-medium block mb-1",children:"Level 2 (mins)"})}),i.jsx(d.Col,{span:14,children:i.jsx(Qe,{className:"text-gray-700 font-medium block mb-1",children:"Escalate to"})})]}),i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(d.Select,{className:"w-full",placeholder:"Mins",value:f,onChange:h,options:r})}),i.jsx(d.Col,{span:14,children:i.jsx(d.Select,{placeholder:"Escalate to",className:"w-full",value:x,onChange:p,options:a})})]})]})}),ae&&i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(Qe,{className:"text-gray-700 font-medium block mb-1",children:"Level 3 (mins)"})}),i.jsx(d.Col,{span:14,children:i.jsx(Qe,{className:"text-gray-700 font-medium block mb-1",children:"Escalate to"})})]}),i.jsxs(d.Row,{gutter:8,children:[i.jsx(d.Col,{span:10,children:i.jsx(d.Select,{className:"w-full",placeholder:"Mins",value:k,onChange:j,options:r})}),i.jsx(d.Col,{span:14,children:i.jsx(d.Select,{placeholder:"Escalate to",className:"w-full",value:O,onChange:K,options:a})})]})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsx(Qe,{className:"text-gray-700 font-medium block mb-1",children:"Pick Actions"}),i.jsx(d.Select,{mode:"multiple",placeholder:"Select response actions",className:"w-full",value:D,onChange:H,options:M,maxTagCount:1,maxTagPlaceholder:Bs})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{children:[i.jsx(Qe,{className:"text-gray-700 font-medium block mb-1",children:"Notify"}),i.jsx(d.Select,{mode:"multiple",placeholder:"Notify",className:"w-full",value:v,onChange:L,options:R,maxCount:2,maxTagPlaceholder:Bs})]})})]}),i.jsxs(d.Row,{gutter:[16,16],align:"bottom",className:"mt-4 items-center",children:[i.jsx(d.Col,{xs:24,sm:12,md:8,lg:7,children:i.jsxs("div",{className:"flex items-center h-full gap-8",children:[!g&&i.jsx(d.Checkbox,{checked:$,onChange:ue=>U(ue.target.checked),className:"w-full",children:"Human-In-The-Loop"}),i.jsx(d.Checkbox,{checked:q,onChange:ue=>y(ue.target.checked),className:"w-full",children:"Auto-expire in 5 minutes"})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(d.Button,{onClick:S,children:"Clear"}),i.jsx(d.Button,{type:"primary",onClick:E,loading:!!re,disabled:!xe,children:"Save"})]})})]})]})}function al({entries:t,userRoles:e,onEdit:s,loading:n}){const{config:r}=De(),a=r.tenant==="schools",o=new Map(e.map(l=>[l.userRoleId,l.userRoleName])),c=l=>l.map(u=>o.get(u)||String(u)).join(", ");return i.jsx(d.Table,{rowKey:"id",dataSource:t,pagination:{pageSize:10,showSizeChanger:!0,showTotal:(l,u)=>`${u[0]}-${u[1]} of ${l} items`},loading:n,columns:[{title:"Rule",dataIndex:"ruleOrSeverityLabel",key:"rule"},{title:"Level 1",key:"l1",render:(l,u)=>i.jsxs("span",{children:[u.l1.minutes?`Action taken in (${u.l1.minutes} Mins)`:"No Action taken in 0 Min",u.l1.roles?.length?`, Escalate to (${c(u.l1.roles)})`:""]})},{title:"Level 2",key:"l2",render:(l,u)=>i.jsxs("span",{children:[u.l2.minutes?`Action taken in (${u.l2.minutes} Mins)`:"No Action taken in 0 Min",u.l2.roles?.length?`, Escalate to (${c(u.l2.roles)})`:""]})},{title:"Level 3",key:"l3",render:(l,u)=>i.jsxs("span",{children:[u.l3.minutes?`Action taken in (${u.l3.minutes} Mins)`:"No Action taken in 0 Min",u.l3.roles?.length?`, Escalate to (${c(u.l3.roles)})`:""]})},{title:"Pick Actions",key:"actionsCol",render:(l,u)=>u.actions?.length?u.actions.join(", "):"-"},{title:"Notify",key:"notify",render:(l,u)=>u.notify?.length?u.notify.join(", "):"-"},...a?[]:[{title:"Human-In-The-Loop",key:"humanLoop",render:(l,u)=>u.humanLoop?"Yes":"No"}],{title:"Auto Expire",key:"isAutoExpire",render:(l,u)=>u.isAutoExpire?"Yes":"No"},{title:"Actions",key:"ops",render:(l,u)=>i.jsx(d.Button,{type:"text",onClick:()=>s(u.id),children:i.jsx(ut.EditOutlined,{})})}]})}const{Title:il,Text:Ms}=d.Typography;function ra({userRoles:t,rules:e,rawRules:s}){const{rules:n}=De(),[r,a]=m.useState(!1),[o,c]=m.useState(!1),[l,u]=m.useState(s),[f,h]=m.useState(),[x,p]=m.useState([]),k=m.useMemo(()=>t.map(v=>({label:v.userRoleName,value:v.userRoleId})),[t]),j=m.useMemo(()=>(e||[]).map(v=>({label:v.Name||"-",value:v.RuleId||v.Name||""})),[e]),O=m.useMemo(()=>(e||[]).map((v,L)=>({key:v.RuleId||v.Name||String(L),ruleName:v.Name||"-",ruleDesc:v.Description||""})),[e]);m.useEffect(()=>{let v=!1;return(async()=>{try{a(!0);const L=await n.getRules();v||u(Array.isArray(L)?L:[])}catch{!v&&Array.isArray(s)&&u(s)}finally{v||a(!1)}})(),()=>{v=!0}},[]),m.useEffect(()=>{!l&&Array.isArray(s)&&u(s)},[s]),m.useEffect(()=>{if(!f||!Array.isArray(l)){p([]);return}const v=l.find($=>$?.ruleId===f||$?.RuleId===f||$?.ruleName===f),L=v?.userRoleIds??v?.UserRoleIds;p(Array.isArray(L)?L:[])},[f,l]);const K=m.useMemo(()=>{if(!Array.isArray(l)||!l.length)return{};const v={};for(const L of O){const $=l.find(y=>y?.ruleId===L.key||y?.ruleName===L.key||y?.RuleId===L.key||y?.ruleName===L.ruleName||y?.Name===L.ruleName),U=$?.userRoleIds??$?.UserRoleIds,q=Array.isArray(U)?U:[];q.length&&(v[L.key]=q)}return v},[l,O]),D=()=>{h(void 0),p([])},H=async()=>{if(!f){Ae.toast.info("Please select a rule");return}try{c(!0);const v=Array.isArray(l)?l.find(y=>y?.ruleId===f||y?.RuleId===f||y?.ruleName===f):void 0,L=typeof v?.recordId=="number"?v.recordId:v?.ruleId||v?.RuleId||void 0;if(!v||!L)throw new Error(`Unable to find rule identifier for rule ${f}`);const $=x.map(y=>{const S=t.find(E=>E.userRoleId===y);return{id:y,name:S?.userRoleName??String(y)}}),U={...v,ruleId:f,userRoleIds:x,userRoles:$},q=await n.updateRule(L,U);if(!q?.responseStatus&&!q?.Success&&!q?.success)Ae.toast.error(q?.errorMessage||q?.Message||"Error saving Alert Assignment");else{Ae.toast.success("Alert assignment saved"),h(void 0),p([]);try{const y=await n.getRules();u(Array.isArray(y)?y:[])}catch(y){console.error("Failed to refresh rules after save",y)}}}catch(v){console.error("Failed to save alert assignment",v),Ae.toast.error(v instanceof Error?v.message:"Error saving Alert Assignment")}finally{c(!1)}};return i.jsxs("div",{className:"w-full",children:[i.jsx(il,{level:4,className:"!mb-4",children:"Alert Assignment"}),i.jsx(d.Spin,{spinning:o||r,children:i.jsxs(d.Row,{gutter:[16,16],align:"bottom",className:"mb-6",children:[i.jsx(d.Col,{xs:24,sm:12,md:8,lg:6,children:i.jsxs("div",{children:[i.jsx(Ms,{className:"text-gray-700 font-medium block mb-1",children:"Rules"}),i.jsx(d.Select,{placeholder:"Rules",value:f,onChange:h,options:j,className:"w-full"})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,lg:8,children:i.jsxs("div",{children:[i.jsx(Ms,{className:"text-gray-700 font-medium block mb-1",children:"Alert Notification To"}),i.jsx(d.Select,{mode:"multiple",placeholder:"Select roles",className:"w-full",value:x,onChange:p,options:k,maxTagCount:1,maxTagPlaceholder:Bs})]})}),i.jsx(d.Col,{xs:24,sm:12,md:8,lg:4,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(d.Button,{onClick:D,disabled:o,children:"Cancel"}),i.jsx(d.Button,{type:"primary",onClick:H,loading:o,disabled:o||!f,children:"Save"})]})})]})}),i.jsx(d.Table,{rowKey:"key",dataSource:O,loading:r,pagination:{pageSize:10,showSizeChanger:!0,showTotal:(v,L)=>`${L[0]}-${L[1]} of ${v} items`},columns:[{title:"Rule Name",dataIndex:"ruleName",key:"ruleName"},{title:"Description",dataIndex:"ruleDesc",key:"ruleDesc"},{title:"Alert Notification To",key:"assign",render:(v,L)=>{const $=K[L.key]??[];return $.length?i.jsx("div",{className:"flex flex-wrap gap-1",children:$.map(U=>{const q=t.find(y=>y.userRoleId===U);return i.jsx(d.Tag,{children:q?.userRoleName??String(U)},U)})}):i.jsx(Ms,{type:"secondary",children:"—"})}}]})]})}const{Title:Hn}=d.Typography;function Os(t){return!t||typeof t!="object"?{}:{level1UserRoleId:t.level1UserRoleId??t.Level1UserRoleId,level1PostAssistTime:t.level1PostAssistTime??t.Level1PostAssistTime,level2UserRoleId:t.level2UserRoleId??t.Level2UserRoleId,level2PostAssistTime:t.level2PostAssistTime??t.Level2PostAssistTime,level3UserRoleId:t.level3UserRoleId??t.Level3UserRoleId,level3PostAssistTime:t.level3PostAssistTime??t.Level3PostAssistTime,escalationSettingsActionTypeIds:t.escalationSettingsActionTypeIds??t.EscalationSettingsActionTypeIds,thirdPartyId:t.thirdPartyId??t.ThirdPartyId??t.ThirdPartyIds,humanLoop:t.humanLoop??t.HumanLoop,isAutoExpire:t.isAutoExpire??t.IsAutoExpire}}function aa({severities:t,rules:e,userRoles:s,rawRules:n,loadingRules:r,onSave:a}){const{rules:o,alerts:c}=De(),[l,u]=m.useState("By Severity"),[f,h]=m.useState("By severity"),[x,p]=m.useState("By Severity"),[k,j]=m.useState(!1),[O,K]=m.useState(!1),[D,H]=m.useState(!1),[v,L]=m.useState(null),[$,U]=m.useState("rules"),[q,y]=m.useState(),[S,E]=m.useState(),[re,Se]=m.useState(),[C,T]=m.useState(),[g,M]=m.useState(),[w,R]=m.useState(),[F,G]=m.useState(),[Q,ne]=m.useState(),[ae,oe]=m.useState([]),[xe,ue]=m.useState([]),[me,ye]=m.useState(!1),[le,ie]=m.useState(!1),[Ne,Me]=m.useState({}),[J,Z]=m.useState({}),[de,pe]=m.useState(s||[]),[Te,Oe]=m.useState([]),[Ze,Re]=m.useState(!1),[ve,kt]=m.useState(!1),[ze,at]=m.useState(n||[]);m.useEffect(()=>{n&&n.length&&at(n)},[n]),m.useEffect(()=>{if(!ze||!ze.length)return;const A=Object.keys(Ne).length>0||Object.keys(J).length>0;if(Te.length&&!A)return;const z=ze.map((B,I)=>{const X=e.find(Ie=>Ie.RuleId===(B.ruleId||B.ruleName))?.Name||B.ruleName||B.Name||"-",P=Os(B.escalationSettings),_=typeof P.level1UserRoleId=="number"&&P.level1UserRoleId>0?[P.level1UserRoleId]:[],ys=typeof P.level2UserRoleId=="number"&&P.level2UserRoleId>0?[P.level2UserRoleId]:[],ps=typeof P.level3UserRoleId=="number"&&P.level3UserRoleId>0?[P.level3UserRoleId]:[],nn=(Array.isArray(P.escalationSettingsActionTypeIds)?P.escalationSettingsActionTypeIds:[]).map(Ie=>Ne[Ie]||String(Ie)),an=(Array.isArray(P.thirdPartyId)?P.thirdPartyId:[]).map(Ie=>J[Ie]||String(Ie)),gs=typeof P.humanLoop=="boolean"?P.humanLoop:null,Ss=typeof P.isAutoExpire=="boolean"?P.isAutoExpire:null;return{id:String(B.ruleId||B.ruleName||I),ruleOrSeverityLabel:X,l1:{minutes:P.level1PostAssistTime??void 0,roles:_},l2:{minutes:P.level2PostAssistTime??void 0,roles:ys},l3:{minutes:P.level3PostAssistTime??void 0,roles:ps},actions:nn,notify:an,humanLoop:gs,isAutoExpire:Ss}});Oe(z)},[ze,e,Ne,J]);const ft=m.useMemo(()=>t.map(A=>({label:A.DisplayName,value:A.SeverityId})),[t]),it=m.useMemo(()=>e.map(A=>({label:A.Name,value:A.RuleId})),[e]),$t=m.useMemo(()=>de.map(A=>({label:A.userRoleName,value:A.userRoleId})),[de]),ht=m.useMemo(()=>[1,3,5,10,15,20,30,45,60].map(A=>({label:`${A}`,value:A})),[]);m.useEffect(()=>{let A=!1;async function z(){try{H(!0),L(null);const B=await c.getAdminSettings();if(!A&&B){const I=Jn(B.sortBy);u(I),p(I),j(!1)}}catch(B){if(!A){const I=B instanceof Error?B.message:"Failed to load admin settings";L(I)}}finally{A||H(!1)}}return z(),()=>{A=!0}},[]),m.useEffect(()=>{if(!S)return;const A=X=>{const P=Number(X);return!isNaN(P)&&P>0?P:void 0},z=X=>{const P=Number(X);return!isNaN(P)&&P>0?P:void 0},B=(ze||[]).find(X=>X?.ruleId===S||X?.ruleName===S||X?.RuleId===S),I=Os(B?.escalationSettings);if(I&&typeof I=="object"){Se(z(I.level1PostAssistTime)),T(A(I.level1UserRoleId)),M(z(I.level2PostAssistTime)),R(A(I.level2UserRoleId)),G(z(I.level3PostAssistTime)),ne(A(I.level3UserRoleId));const X=Array.isArray(I.escalationSettingsActionTypeIds)?I.escalationSettingsActionTypeIds:[];oe(X.map(P=>String(P))),ue(Array.isArray(I.thirdPartyId)?I.thirdPartyId:[]),ye(!!I.humanLoop),ie(!!I.isAutoExpire)}},[$,S,ze]);const we=async()=>{try{kt(!0);const A=await o.getRules(),z=Array.isArray(A)?A:Array.isArray(A?.data)?A.data:[];at(z);const B=z.map((I,X)=>{const P=e.find(Ie=>Ie.RuleId===(I.ruleId||I.ruleName))?.Name||I.ruleName||I.Name||"-",_=Os(I.escalationSettings??I.EscalationSettings),ys=typeof _.level1UserRoleId=="number"&&_.level1UserRoleId>0?[_.level1UserRoleId]:[],ps=typeof _.level2UserRoleId=="number"&&_.level2UserRoleId>0?[_.level2UserRoleId]:[],sn=typeof _.level3UserRoleId=="number"&&_.level3UserRoleId>0?[_.level3UserRoleId]:[],rn=(Array.isArray(_.escalationSettingsActionTypeIds)?_.escalationSettingsActionTypeIds:[]).map(Ie=>Ne[Ie]||String(Ie)),gs=(Array.isArray(_.thirdPartyId)?_.thirdPartyId:[]).map(Ie=>J[Ie]||String(Ie)),Ss=typeof _.humanLoop=="boolean"?_.humanLoop:null;return{id:String(I.ruleId||I.ruleName||X),ruleOrSeverityLabel:P,l1:{minutes:_.level1PostAssistTime??void 0,roles:ys},l2:{minutes:_.level2PostAssistTime??void 0,roles:ps},l3:{minutes:_.level3PostAssistTime??void 0,roles:sn},actions:rn,notify:gs,humanLoop:Ss}});Oe(B)}catch(A){console.error("Failed to refetch entries",A)}finally{kt(!1)}};m.useEffect(()=>{let A=!1;return(async()=>{try{const z=await o.getLookups();if(A||!z)return;const B={};if(Array.isArray(z.thirdParties))for(const X of z.thirdParties){const P=X.thirdPartyIds??X.thirdPartyId;typeof P=="number"&&(B[P]=X.thirdPartyName)}Z(B);const I=Array.isArray(z.userRoles)?z.userRoles.map(X=>({userRoleId:X.userRoleId??X.id,userRoleName:X.userRoleName??X.name})):[];A||pe(I.length?I:s||[])}catch(z){console.error("Error loading lookups",z)}})(),()=>{A=!0}},[]);const _e=async()=>{K(!0);try{const A=await c.setAdminSettings({sortBy:l,groupBy:"string"});A?.responseStatus&&A?.data&&Ae.toast.success(A.data),p(l),j(!1)}catch(A){console.error("Error saving admin settings",A)}finally{K(!1)}},hs=()=>{u(x),j(!1)},b=async()=>{Re(!0),a?.({ruleId:S,levels:[{minutes:re,role:C},{minutes:g,role:w},{minutes:F,role:Q}],actions:ae,thirdPartyIds:xe,humanLoop:me,isAutoExpire:le});try{if(S){const z=Array.isArray(ae)?ae.map(_=>Number.isNaN(Number(_))?_:Number(_)):[],B=(ze||[]).find(_=>_?.ruleId===S||_?.ruleName===S||_?.RuleId===S),I=typeof B?.recordId=="number"?B.recordId:B?.ruleId||B?.RuleId||void 0;if(!B||!I){Ae.toast.error("Unable to find rule identifier for update");return}const X={...B,escalationSettings:{level1UserRoleId:C??0,level1PostAssistTime:re??0,level2UserRoleId:w??0,level2PostAssistTime:g??0,level3UserRoleId:Q??0,level3PostAssistTime:F??0,escalationSettingsActionTypeIds:z,thirdPartyId:Array.isArray(xe)?xe:[],humanLoop:me,isAutoExpire:le}},P=await o.updateRule(I,X);P?.responseStatus||P?.Success||P?.success?(Ae.toast.success("Escalation settings saved"),await we(),E(void 0),Se(void 0),T(void 0),M(void 0),R(void 0),G(void 0),ne(void 0),oe([]),ue([]),ye(!1),ie(!1)):Ae.toast.error(P?.errorMessage||P?.Message||"Error saving Escalation Settings")}}catch(z){console.error("Error saving escalation settings",z)}finally{Re(!1)}},Y=()=>{u("By Severity"),h("By severity"),U("rules"),y(void 0),E(void 0),Se(void 0),T(void 0),M(void 0),R(void 0),G(void 0),ne(void 0),oe([]),ue([]),ye(!1),ie(!1)};return i.jsxs("div",{className:"w-full",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx(Hn,{level:4,className:"!mb-2",children:"Admin Settings"}),i.jsxs(d.Spin,{spinning:D,children:[v?i.jsxs("div",{className:"text-sm text-red-600 mb-2",children:["Failed to load settings: ",v]}):null,i.jsx(nl,{sortBy:l,groupBy:f,onChange:A=>{A.sortBy&&(u(A.sortBy),j(!0)),A.groupBy&&(h(A.groupBy),j(!0))},showActions:k,onSave:_e,onClear:hs,saving:O})]})]}),i.jsx(d.Divider,{className:"my-6"}),i.jsxs("div",{children:[i.jsx(Hn,{level:4,className:"!mb-4",children:"Escalation Settings"}),i.jsx(rl,{escBasis:$,setEscBasis:U,selectedSeverity:q,setSelectedSeverity:y,selectedRule:S,setSelectedRule:E,severityOptions:ft,ruleOptions:it,minsOptions:ht,roleOptions:$t,l1mins:re,setL1mins:Se,l1role:C,setL1role:T,l2mins:g,setL2mins:M,l2role:w,setL2role:R,l3mins:F,setL3mins:G,l3role:Q,setL3role:ne,actions:ae,setActions:oe,thirdPartyIds:xe,setThirdPartyIds:ue,humanLoop:me,setHumanLoop:ye,onClear:Y,onSave:b,saving:Ze,onActionTypesLoaded:A=>{const z={};for(const B of A)typeof B.actionTypeId=="number"&&(z[B.actionTypeId]=B.name);Me(z)},isAutoExpire:le,setAutoExpire:ie})]}),i.jsx(d.Divider,{className:"my-6"}),i.jsx(al,{entries:Te,userRoles:de,loading:ve||r,onEdit:A=>{U("rules");const z=Te.find(I=>I.id===A),B=e.find(I=>I.RuleId===A)||(z?e.find(I=>I.Name===z.ruleOrSeverityLabel):void 0);E(B?B.RuleId:A)}}),i.jsx(d.Divider,{className:"my-6"}),i.jsx(ra,{userRoles:de,rules:e,rawRules:n}),i.jsx(d.Divider,{})]})}const{Title:qn,Text:Jt}=d.Typography;function ol({severities:t,rules:e,onSave:s,onCancel:n}){const{rules:r,alerts:a}=De(),o=[{label:"By Severity",value:"By Severity"},{label:"By Created Date",value:"By Created Date"}],[c,l]=m.useState("By Severity"),[u,f]=m.useState(new Set),[h,x]=m.useState(null),[p,k]=m.useState(null),[j,O]=m.useState({inApp:!1,sms:!1,email:!1}),[K,D]=m.useState([]),[H,v]=m.useState(!0),[L,$]=m.useState(!1);m.useEffect(()=>{let y=!1;return(async()=>{try{const S=await a.getPreferenceSettings();if(y||!S)return;O({inApp:!!S.inApp,sms:!!S.sms,email:!!S.email});const E=Jn(S.sortBy);l(E==="By Created Date"?"By Created Date":"By Severity"),x(fn(S.doNotDisturbStart)),k(fn(S.doNotDisturbEnd)),Array.isArray(S.anomalyIds)&&f(new Set(S.anomalyIds.map(re=>String(re))))}catch(S){console.error("Error in loading my preferences: ",S)}})(),()=>{y=!0}},[]),m.useEffect(()=>{let y=!1;return(async()=>{try{v(!0);const S=await r.getLookups();if(y||!S)return;const E=Array.isArray(S.anomalies)?S.anomalies:[];D(E)}catch(S){console.error("Failed to load anomalies lookups",S)}finally{y||v(!1)}})(),()=>{y=!0}},[]);const U=y=>{f(S=>{const E=new Set(S);return E.has(y)?E.delete(y):E.add(y),E})},q=async()=>{s?.({sortBy:c,subscribedRuleIds:Array.from(u),dnd:{from:h,to:p},channels:j});try{$(!0);const y=h?h.format?.("HH:mm:ss")??"00:00:00":"00:00:00",S=p?p.format?.("HH:mm:ss")??"00:00:00":"00:00:00",E=Array.from(u).map(Se=>Number(Se)).filter(Se=>Number.isFinite(Se)),re=await a.setPreferenceSettings({anomalyIds:E,doNotDisturbStart:y,doNotDisturbEnd:S,inApp:!!j.inApp,sms:!!j.sms,email:!!j.email,sortBy:c});re?.responseStatus&&Ae.toast.success(re?.data||"Preferences updated successfully.")}catch(y){console.error("Error in saving my preferences: ",y)}finally{$(!1)}};return i.jsxs("div",{className:"w-full",children:[i.jsx(d.Row,{gutter:[16,16],align:"middle",className:"mb-4",children:i.jsx(d.Col,{xs:24,md:8,children:i.jsxs(d.Space,{direction:"horizontal",size:12,className:"w-full items-center",children:[i.jsx(Jt,{className:"text-gray-600",children:"Sort By:"}),i.jsx(d.Select,{className:"w-[240px]",value:c,options:o,onChange:l})]})})}),i.jsxs("div",{className:"mb-4",children:[i.jsx(qn,{level:5,className:"!mb-2",children:"Anomalies"}),H?i.jsx("div",{className:"py-4",children:i.jsx(d.Spin,{})}):i.jsx(d.Space,{direction:"vertical",size:10,className:"w-full",children:(Array.isArray(K)?K:[]).map(y=>{const S=String(y.recordId),E=y.anomalyName;return i.jsx(d.Checkbox,{checked:u.has(S),onChange:()=>U(S),children:E},S)})})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx(qn,{level:5,className:"!mb-2",children:"Notification Timing & Channels"}),i.jsx(d.Row,{gutter:[16,16],align:"middle",className:"mb-3",children:i.jsx(d.Col,{xs:24,md:12,children:i.jsxs(d.Space,{direction:"horizontal",size:12,className:"w-full items-center",children:[i.jsx(Jt,{children:"Do Not Disturb mode:"}),i.jsxs(d.Space,{size:12,className:"w-full",children:[i.jsxs(d.Space,{direction:"horizontal",size:8,className:"items-center",children:[i.jsx(Jt,{children:"From"}),i.jsx(d.TimePicker,{value:h,onChange:y=>x(y),format:"HH:mm"})]}),i.jsxs(d.Space,{direction:"horizontal",size:8,className:"items-center",children:[i.jsx(Jt,{children:"To"}),i.jsx(d.TimePicker,{value:p,onChange:y=>k(y),format:"HH:mm"})]})]})]})})}),i.jsxs(d.Row,{gutter:[24,12],children:[i.jsx(d.Col,{children:i.jsx(d.Checkbox,{checked:j.inApp,onChange:y=>O({...j,inApp:y.target.checked}),children:"In-app"})}),i.jsx(d.Col,{children:i.jsx(d.Checkbox,{checked:j.sms,onChange:y=>O({...j,sms:y.target.checked}),children:"SMS"})}),i.jsx(d.Col,{children:i.jsx(d.Checkbox,{checked:j.email,onChange:y=>O({...j,email:y.target.checked}),children:"Email"})})]})]}),i.jsx(d.Divider,{}),i.jsxs(d.Space,{className:"gap-3",children:[i.jsx(d.Button,{onClick:n,disabled:L,children:"Cancel"}),i.jsx(d.Button,{type:"primary",onClick:q,loading:L,children:"Save"})]})]})}function ia({severities:t,rules:e,userRoles:s,rawRules:n,loadingRules:r}){return i.jsx("div",{className:"w-full",children:i.jsx(aa,{severities:t,rules:e,userRoles:s,rawRules:n,loadingRules:r})})}const ll="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIZSURBVHgBnZW/b9NAFMe/z3H6i1ZNJUBFQsL/QQkLCFBtRhhKF1ibhBmpXbtgFlYqsTG0gRGWwgAjMb8EYmjYGN0pCCrVVaX+SBxf37PiqHWcOu5Xsux79+6j77vz3RH66IbdsDTQPCFngmBwqMCPBwVXoe204Fd/2ZfrSWMpHrDshtGCvsY9FlKkFNYD+Es/7EtuX+itp1sLnLrScTWoPMYsfnty/lUPtAOs4syiUgQOoWHJpG9kdBiX11Z+UaZCk1YT+vOzACuzYxgf7hZbyBGvhTi9af+7SkQbyKi7M8N4ZJ5D+eU2dg9UN07KvyNOS8io6UkNFXMMj1/vnACKAuTmNXZpIqME+LF+iIbX7ukjkClODWTQw+ujuGYMYfXzXnICbxSBDrxAUvYDhkrZp6ggUC8+sDI7mpj9YmESb3/uJ5Z9TJ5A3eORvzsBpgs6lufGT2TKPNY3fbxh6Knis0FTSjnx+LP3u5DJicDi/t7MCFadPaRJQTl02/5vKcKnpITluYkwrWjksebs48Pvg3SoUkXtq32hxt+1pITI8Zc/zcGACN59ty/WdWnklV5ukZ+49wU8MUJIF3mBGlqUr3Dv1+wpl20v9UuP75pElyrgc3XK7UJFbLvK4DJiv9ggDmWcjO9G4imWvW00yV/hjvtpOFnpQOVLkcO+0EhyevGrROG1ol1hREFc8ZGxyddIje+v9c4i9+gI5z7MozLxclgAAAAASUVORK5CYII=",cl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKeSURBVHgBjVVdbtpAEJ5ZmygPfTBSaVWpUt0bwFuURgJOUG5QeoLACbw+QeAEwA3SGxgJokh9CDeI+xSpTRU/Imw8nbFZx6QQGAl5d2fm229+dkDYI2f6oaUAOwhWExBcPnL4FwFBSLCexpCMf+qPi12++PKgpR/cGOwRa1pwQIjgOoWkf6s/hOVzVd588R+/xWjf5YAY8Y0+ErQrZFfnXg3lK3uGm7A+RISOxfbit5NprqBxxgBoeEIVHehqtI9lSz+5McaaITaA2J17bycFaBayMOS8IaT+zHuv4Ui58P9oAvB4Ga0paUgqbFGswL5idIcIx3P9DCiXrQB7iJawcTiCkMMIUlj7Jo8zr6Yv/EfRXXIqRnzUxnP9u46Id8Q5Sslq3+pqWErHAPKqvxROC/ZMuJwKJ8bkPouUkrYUqgt5IgMDKAxfAYT8nAZnmR2A5J47YSjrFKyOYpZN2SiIJ8YjRqVfASyAFVg9s2F2gXwRsClMXdnYcFpq5PyiQ8KEilaywc79+aEow2i7fdCF46SIpuTvCGi2kWSXjCM4QqS4Zl3yjwQ0UySwrBfGRJNjQKW4ZrmEpL45CxUDTGWdgmoZgxOoDA6zxYgr7ZudhWk3x6Sp4kl0nZmgujQhcH5Cvqy/Hxi5hdL+dgsWxR2rma4FkLeDw+PMM243+t2YB0jDDI9nMBquyWqI3tjmLYguQfqDzxebty/DIcnePr9jfePVfDhSzv2/Hs8LAY3kMmFfTCl+rl3uu1GWF6Jx+X3vkpa+58jeeNyXvY3Pd8N+a0hvgK9ge3hMTmG5CPTnSICWcFpXaDfZUcAck99yOnZM/id3hcmAFV/hgEilU6p0TcH2gpZYS98xc/kXUJ8YImPFzfeLh0cgXbMp8n/yD3ySPZSK0MWKAAAAAElFTkSuQmCC";function ms(){const{config:t}=De();return{timeZoneDetails:m.useMemo(()=>{const s=t.timeZone||Intl.DateTimeFormat().resolvedOptions().timeZone;return{timeZoneUniqueId:"",ianaTimeZoneId:s,timeZoneName:s,offset:""}},[t.timeZone]),loading:!1}}function ul(t){const e=(t.status||"").toLowerCase()==="completed"?i.jsx("img",{src:ll,alt:"completed",style:{width:20,height:20}}):i.jsx("img",{src:cl,alt:"pending",style:{width:20,height:20}});return{title:i.jsxs("div",{className:"flex flex-col gap-0 min-w-0",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"block text-sm break-words mb-1 overflow-visible whitespace-normal",children:i.jsx("b",{children:t.title})}),t.description?i.jsx("span",{className:"text-gray-500 text-xs",children:t.description}):null]}),t.timestamp?i.jsx("span",{className:"text-gray-500 text-xs",children:t.timestamp}):null]}),icon:e,description:null}}function dl({data:t}){const{timeZoneDetails:e}=ms();return console.log("summary",t),i.jsx("div",{className:"w-full",children:i.jsx(d.Tabs,{type:"card",items:[{key:"action",label:"Action Taken",children:i.jsxs("div",{className:"w-full",style:{maxHeight:"50vh",overflowY:"auto"},children:[i.jsx(d.Card,{className:"mb-4 rounded-md p-4",bordered:!0,children:i.jsxs("div",{className:"grid grid-cols-4 gap-6 text-xs",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-gray-500",children:"Alert ID"}),i.jsx("span",{className:"text-black",children:t.summary.alertNumber})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-gray-500",children:"Severity"}),i.jsx("span",{className:"text-black",children:t.summary.severity})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-gray-500",children:"Location"}),i.jsx("span",{className:"text-black",children:t.summary.location})]})]})}),i.jsxs(d.Card,{className:"rounded-md p-4",bordered:!0,children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("h4",{className:"text-sm text-black font-medium",children:"Response Timeline/ Audit trail/log"})}),i.jsx("div",{className:"mt-2",children:i.jsx(d.Steps,{direction:"vertical",size:"small",current:1,items:(t.timeline||[]).map(ul)})})]})]})},{key:"notification",label:"Notification Sent",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",style:{maxHeight:"50vh",overflowY:"auto"},children:[(t.notifications||[]).map((s,n)=>i.jsxs(d.Card,{className:"rounded-md p-4",bordered:!0,children:[i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("h4",{className:"text-sm text-black font-medium",children:s.channelLabel}),i.jsx("span",{className:"text-xs text-gray-500 mt-1",children:as(s.sentAt,e?.ianaTimeZoneId)})]}),i.jsxs("span",{className:"text-[11px] px-2 py-1 rounded-full bg-green-50 text-green-700 border border-green-200",children:[s.delivered,"/",s.total," Delivered"]})]}),i.jsxs("div",{className:"mt-4 text-xs",children:[i.jsxs("div",{className:"text-black",children:[" ",s.messageTitle]}),s.messageBody?i.jsx("div",{className:"text-gray-600",children:s.messageBody}):null]}),i.jsxs("div",{className:"mt-4",children:[i.jsxs("div",{className:"text-xs text-black font-medium",children:["Recipients (",s.total,")"]}),i.jsx("div",{className:"mt-2 flex flex-col gap-3 text-xs",children:(s.recipients||[]).map((r,a)=>{const o=String(r?.notificationReceipientType||"").toLowerCase()==="EscalationNotification".toLowerCase();return i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("span",{className:"text-black",children:[r.name," - ",i.jsx("span",{style:{color:o?"#FF3B30":"#FFB86A"},children:o?"Escalation Notification":"Alert Notification"})]}),i.jsxs("span",{className:"text-gray-500",children:[r.role," . ",r.phone]})]}),i.jsx("span",{className:`text-[11px] px-3 py-[2px] rounded ${r.status==="Delivered"?"bg-green-50 text-green-700 border border-green-200":"bg-red-50 text-red-700 border border-red-200"}`,children:r.status})]},a)})})]})]},n)),t?.notifications?.length?null:i.jsx("span",{className:"text-gray-500 text-xs",children:"No notifications."})]})}]})})}const ml=({alertId:t,id:e,priority:s,spaceName:n,alertNumber:r,statusHistory:a,notifGroups:o})=>{const c={alertId:t??String(e??""),incidentId:"-",severity:s||"",location:n||"",alertNumber:r??""},{timeZoneDetails:l}=ms(),u=a?.length?a.map(h=>{const x=(h?.status||h?.eventStatus||"").toLowerCase()==="completed"?"Completed":"Inprogress",p=h?.createdDate?as(h.createdDate,l?.ianaTimeZoneId):h?.timestamp?as(h.timestamp,l?.ianaTimeZoneId):"";return{status:x,title:h?.status||h?.eventStatus||"Status Update",description:h?.description||h?.actionNotes||"",timestamp:p}}):[],f={summary:c,timeline:u,notifications:o??[]};return i.jsx(dl,{data:f})};const fl=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hl=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,s,n)=>n?n.toUpperCase():s.toLowerCase()),Gn=t=>{const e=hl(t);return e.charAt(0).toUpperCase()+e.slice(1)},oa=(...t)=>t.filter((e,s,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===s).join(" ").trim(),yl=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var pl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const gl=m.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:s=2,absoluteStrokeWidth:n,className:r="",children:a,iconNode:o,...c},l)=>m.createElement("svg",{ref:l,...pl,width:e,height:e,stroke:t,strokeWidth:n?Number(s)*24/Number(e):s,className:oa("lucide",r),...!a&&!yl(c)&&{"aria-hidden":"true"},...c},[...o.map(([u,f])=>m.createElement(u,f)),...Array.isArray(a)?a:[a]]));const fs=(t,e)=>{const s=m.forwardRef(({className:n,...r},a)=>m.createElement(gl,{ref:a,iconNode:e,className:oa(`lucide-${fl(Gn(t))}`,`lucide-${t}`,n),...r}));return s.displayName=Gn(t),s};const Sl=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],xl=fs("image-off",Sl);const vl=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],wl=fs("loader-circle",vl);const Al=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],la=fs("maximize-2",Al);const Tl=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Nl=fs("minimize-2",Tl),bl=({isOpen:t,onClose:e,src:s,type:n="image"})=>{const[r,a]=m.useState(!1),[o,c]=m.useState(!1);return m.useEffect(()=>{t&&c(!1)},[t,s]),m.useEffect(()=>{t&&(!s||o)&&e()},[t,s,o,e]),t?i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-70",role:"button",tabIndex:0,"aria-label":"Close media preview",onClick:e,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),e())},onTouchStart:e,children:i.jsxs("div",{className:`relative ${r?"w-full h-full":"max-w-5xl max-h-[90vh] w-full"} flex items-center justify-center`,onClick:l=>l.stopPropagation(),children:[n==="image"?i.jsx("img",{src:s,alt:"preview",className:`object-contain rounded-lg shadow-lg ${r?"w-full h-full":"max-w-full max-h-[90vh]"}`,onError:()=>c(!0)}):i.jsx("video",{src:s,controls:!0,className:`object-contain rounded-lg shadow-lg ${r?"w-full h-full":"max-w-full max-h-[90vh]"}`,onError:()=>c(!0)}),i.jsx("button",{onClick:e,className:"absolute top-3 right-3 text-white bg-black/50 rounded-full p-2 hover:bg-black/70",children:"✕"}),i.jsx("button",{onClick:()=>a(!r),className:"absolute bottom-3 right-3 text-white bg-black/50 rounded-full p-2 hover:bg-black/70",children:r?i.jsx(Nl,{size:20}):i.jsx(la,{size:20})})]})}):null};function kl(t){if(!t||typeof t!="string")return!1;const e=t.split("?")[0].toLowerCase();return e.endsWith(".mp4")||e.endsWith(".webm")||e.endsWith(".ogg")||e.endsWith(".m3u8")}function Yn(t){const e=(t?.mediaType||t?.type||"").toString().toLowerCase();return e==="video"||e==="mp4"?!0:kl(t?.mediaUrl||t)}function Il(t){const e=t?.mediaUrl;let s=null;if(Array.isArray(e))s=e;else if(typeof e=="string")try{const n=JSON.parse(e);Array.isArray(n)&&(s=n)}catch{}return s&&s.length>0?s.map(n=>({...t,mediaUrl:n})):[t]}function El(t){const e=t;return e?(Array.isArray(e)?e:[e]).flatMap(Il):[]}const Ml={Critical:"#FF3B30",High:"#FFB86A",Medium:"#FFCC00",Low:"#007AFF"},Ol={Critical:"#FFE2E2",High:"#FF95004D",Medium:"#FEF9C2",Low:"#E0EDFF"},jl=({isModalOpen:t,handleModalClose:e,selectedRow:s,fetchAlertLogs:n,alertStatusList:r=[],alertStatusLoading:a=!1,initialTab:o="details",sourceTab:c})=>{const[l,u]=m.useState(),[f,h]=m.useState(""),[x,p]=m.useState(!1),k=m.useRef(null),[j,O]=m.useState("details"),[K,D]=m.useState(void 0),H=qs(),{alerts:v,rules:L,config:$}=De(),{timeZoneDetails:U}=ms(),[q,y]=m.useState(null),[S,E]=m.useState(!1),[re,Se]=m.useState(!1),[C,T]=m.useState(void 0),[g,M]=m.useState(void 0),[w,R]=m.useState({}),[F,G]=m.useState({}),Q=(b,Y,A)=>{const z=F[b];return w[b]===!1&&!z?i.jsxs("div",{className:"w-full flex flex-col items-center justify-center min-h-[200px] bg-gray-100 rounded-lg gap-2 text-gray-400",children:[i.jsx(xl,{size:40}),i.jsx("span",{className:"text-sm",children:"Media not available"})]}):i.jsxs("div",{className:"relative w-full flex justify-center items-center min-h-[200px]",children:[z&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-100 rounded-lg z-10",children:i.jsx(wl,{size:32,className:"animate-spin text-gray-400"})}),i.jsx("img",{src:b,alt:Y.caption||`media-${A}`,className:`max-w-full max-h-[90vh] object-contain rounded-lg shadow-lg transition-opacity duration-200 ${z?"opacity-0":"opacity-100"}`,onLoad:()=>G(B=>({...B,[b]:!1})),onError:()=>G(B=>({...B,[b]:!1}))},b)]})},ne=s?.originalData||{},{eventName:ae,anomalyName:oe,alertId:xe,timestamp:ue,description:me,spaceName:ye,assignTeam:le,priority:ie,statusType:Ne,id:Me,alertDetails:J,statusHistory:Z,mediaDetails:de,alertNumber:pe}=ne,Te=b=>{const Y=String(b||"").toLowerCase();return Y==="delivered"||Y==="sent"?"Delivered":Y==="failed"?"Failed":"Queued"},Oe=b=>({name:b?.receipientName||b?.recipientName||"-",role:b?.receipientRoleName||"",phone:b?.receipentPhoneNumber||b?.recipientPhoneNumber||b?.receipientEmail||b?.recipientEmail||"",status:Te(b?.messageStatus),notificationReceipientType:b?.notificationReceipientType||""}),Ze=(b,Y)=>{const A=Y.map(Oe),z=A.filter(P=>P.status==="Delivered").length,B=Y.map(P=>P?.sentAt).filter(Boolean).sort((P,_)=>new Date(_).getTime()-new Date(P).getTime())[0],I=Y[0]||{},X=[I?.severityName,I?.anomalyName].filter(Boolean).join(" - ")||`${b} Notification`;return{channelLabel:`${b} Notification`,sentAt:B||"",messageTitle:X,messageBody:"",total:A.length,delivered:z,recipients:A}},Re=b=>{const Y=new Map;return(b||[]).forEach(A=>{const z=String(A?.notificationType||"Unknown"),B=Y.get(z)||[];B.push(A),Y.set(z,B)}),Array.from(Y.entries()).map(([A,z])=>Ze(A,z))},ve=async b=>{try{const Y=await v.getAlertNotifications(b),A=Re(Y);D(A)}catch{D(void 0)}};m.useEffect(()=>{if(j!=="track"||!Me)return;let b=!1;return ve(Me).then(()=>{b&&D(void 0)}),()=>{b=!0}},[j,Me]),m.useEffect(()=>{t?O(o):(u(void 0),h(""))},[t,o]),m.useEffect(()=>{if(!t||$.tenant!=="snl")return;let b=!1;return E(!0),L.getLookups().then(Y=>{b||(y(Y.alertStatusTypes??[]),E(!1))}).catch(()=>{b||(y([]),E(!1))}),()=>{b=!0}},[t,$.tenant]);const ze=c==="archived"||["completed","false positive"].includes(String(Ne||"").toLowerCase()),at=b=>{const Y=String(b?.value||"").toLowerCase(),A=String(b?.statusName||"").toLowerCase();return Y.includes("reopen")||A.includes("reopen")},ft=oe==="Elopement Attempt"||oe==="Elopement Completed",it=r.filter(b=>{const Y=at(b);return typeof c<"u"?c==="archived"?Y:!Y:ze?Y:!Y}).map(b=>({value:b.value,label:b.statusName})),ht=(q??[]).filter(b=>b.isElopementStatus===ft).map(b=>({value:b.alertStatusTypeName,label:b.alertStatusTypeName})),we=$.tenant==="snl"&&q!==null?ht:it,_e=m.useMemo(()=>El(de),[de]);m.useEffect(()=>{let b=!1;const Y=new AbortController,A=async I=>{if(I){b||R(X=>({...X,[I]:!1}));try{const X=await fetch(I,{method:"HEAD",signal:Y.signal});if(X.ok){b||R(_=>({..._,[I]:!0}));return}if(X.status===404){b||R(_=>({..._,[I]:!1}));return}if(!(await fetch(I,{method:"GET",signal:Y.signal})).ok)throw new Error("Media not available");b||R(_=>({..._,[I]:!0}))}catch{b||R(X=>({...X,[I]:!1}))}}};R({});const z=_e.filter(I=>!Yn(I)).map(I=>I?.mediaUrl||I).filter(I=>typeof I=="string"&&I.length>0),B={};return z.forEach(I=>{B[I]=!0}),G(B),z.forEach(I=>A(I)),()=>{b=!0,Y.abort()}},[_e]);const hs=async()=>{try{p(!0);const b={alertUniqueId:xe,alertId:Me,status:l?String(l):void 0,notes:f.trim(),modifiedBy:0},Y=await H.mutateAsync(b);if(Y?.responseStatus||Y?.Success){const A=Y?.Message||Y?.data||"Alert updated successfully.";Ae.toast.success(A,{autoClose:1500,onClose:()=>{n(),e()}}),u(void 0),h("")}else{const A=Y?.errorMessage||Y?.Message||"Failed to update alert status";Ae.toast.error(A)}}catch(b){console.error("Error updating alert status:",b),Ae.toast.error("Failed to update alert status. Please try again.")}finally{p(!1)}};return i.jsx(d.Modal,{open:t,onCancel:e,width:1e3,footer:j==="details"?i.jsxs("div",{className:"flex flex-row gap-2 justify-start",children:[i.jsx(d.Button,{onClick:e,className:"bg-[#6C757D] text-white",children:"Cancel"}),i.jsx(d.Button,{type:"primary",onClick:hs,loading:x,children:x?"Saving...":"Save Changes"})]}):null,children:s&&i.jsx(d.Tabs,{activeKey:j,onChange:b=>O(b),items:[{key:"details",label:"Alert Detail",children:i.jsxs("div",{className:"grid grid-cols-2 gap-2",style:{maxHeight:"50vh",overflowY:"auto"},children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("div",{className:"text-sm font-bold",children:ae||"Alert Event"}),J?.firstName?i.jsxs("div",{className:"text-sm text-gray-500",children:["Resident ID/Name: ",J?.firstName," ",J?.lastName||"","   ",J?.residentId||""]}):null,i.jsxs("div",{className:"text-sm text-gray-500",children:["Timestamp: ",as(ue,U?.ianaTimeZoneId)]}),i.jsxs("div",{className:"font-sm text-gray-500",children:[i.jsx("b",{className:"text-black text-sm/6",children:"Description:"})," ",me||"No description available"]}),ye&&i.jsxs("div",{className:"font-sm text-gray-500",children:["Space: ",ye]}),le&&i.jsxs("div",{className:"font-sm text-gray-500",children:["Assigned to: ",le]}),i.jsxs("div",{className:"flex gap-2 justify-start mt-3",children:[i.jsxs(d.Tag,{className:"font-sm text-gray-500 rounded-[8px] py-2 px-3",style:{border:`2px solid ${Ml[String(ie)]||"#DFE4EA"}`,backgroundColor:Ol[String(ie)]},children:["Severity: ",ie||"N/A"]}),i.jsxs(d.Tag,{className:"font-sm text-gray-500 rounded-[8px] py-2 px-3",style:String(Ne||"").toLowerCase()==="completed"?{background:"#E7F6EC",border:"0.68px solid var(--Green, #34C759)"}:{background:"#E0EDFF",border:"1px solid var(--Grays-Gray-4, #D1D1D6)"},children:["Status: ",Ne||"N/A"]})]}),i.jsx("div",{className:"w-full flex flex-col justify-start items-start mt-2 font-bold",children:i.jsxs("div",{className:"w-full mt-4",children:[i.jsx("div",{className:"flex flex-col gap-2",children:i.jsx(d.Select,{placeholder:"Change Status",className:"w-full text-gray-500",onChange:b=>u(b),value:l,options:we,loading:$.tenant==="snl"?S:a})}),i.jsxs("div",{className:"flex flex-col gap-2 mt-3",children:[i.jsx("label",{htmlFor:"action-details-input",className:"text-xs text-gray-500 font-medium",children:"Action Taken (Comments)"}),i.jsx("textarea",{id:"action-details-input",placeholder:"Enter details...",className:"w-full text-gray-500 h-20 border border-grey-500 rounded-md p-2",value:f,onChange:b=>h(b.target.value)})]})]})})]}),i.jsx("div",{className:"flex flex-col gap-4",children:i.jsxs("div",{className:"w-full mt-1",children:[i.jsxs("div",{className:"w-full flex items-center justify-between",children:[i.jsx("h3",{className:"text-black font-bold text-sm",children:"Camera Footage"}),_e.length>1?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>k.current?.prev?.(),className:"w-6 h-6 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 text-gray-600","aria-label":"Previous media",children:i.jsx(ut.LeftOutlined,{style:{fontSize:12}})}),i.jsx("button",{type:"button",onClick:()=>k.current?.next?.(),className:"w-6 h-6 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 text-gray-600","aria-label":"Next media",children:i.jsx(ut.RightOutlined,{style:{fontSize:12}})})]}):null]}),_e.length?i.jsx("div",{className:"w-full",children:i.jsx(d.Carousel,{ref:k,dots:!0,className:"w-full",children:_e.map((b,Y)=>{const A=b.mediaUrl||b,z=Yn(b);return i.jsxs("div",{className:"flex justify-center items-center relative",children:[z?i.jsxs("video",{width:"240",height:"200",controls:!0,className:"max-w-full max-h-[90vh] object-contain rounded-lg shadow-lg",children:[i.jsx("source",{src:A}),"Your browser does not support the video tag."]}):Q(String(A),b,Y),b.caption&&i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:b.caption}),!z&&w[String(A)]?i.jsx("button",{onClick:()=>{Se(!0),T(A),M(b.type||"image")},className:"absolute bottom-3 right-3 text-white bg-black/50 rounded-full p-2 hover:bg-black/70",children:i.jsx(la,{size:20})}):null]},String(A)||Y)})})}):null]})}),i.jsx(bl,{isOpen:re,onClose:()=>Se(!1),src:C||"",type:g||"image"})]})},{key:"track",label:"Track Incident",children:i.jsx(ml,{alertId:xe,id:Me,priority:ie,spaceName:ye,alertNumber:pe,statusHistory:Z,notifGroups:K})}]})})};function ca(){const{alerts:t}=De(),e=dt.useQuery({queryKey:["alerts","statusList"],queryFn:()=>t.getAlertStatusList(),staleTime:5*6e4});return{list:e.data??[],loading:e.isLoading,error:e.error,refetch:e.refetch}}function tn({alerts:t,loading:e=!1,columns:s,total:n,currentPage:r,onRefetch:a,onPageChange:o,onFilterChange:c}){const[l,u]=m.useState(!1),[f,h]=m.useState(null),[x,p]=m.useState("details"),{list:k,loading:j}=ca(),{timeZoneDetails:O}=ms(),K=O?.timeZoneName??"UTC",D=O?.ianaTimeZoneId??"UTC";function H(S,E){h(S),p(E?.tab??"details"),$(E?.sourceTab??"active"),u(!0)}function v(){u(!1)}const[L,$]=m.useState("active"),[U,q]=m.useState(0),y=f?{originalData:{...f,alertId:f.alertId??f.id,mediaDetails:f.mediaDetails}}:null;return i.jsxs("div",{className:"p-6 flex flex-col items-start justify-start min-h-screen w-full overflow-auto",children:[i.jsxs("div",{className:"w-full grid grid-cols-3 sm:grid-cols-1 items-center mb-4",children:[i.jsx("h1",{className:"text-xl font-bold text-black",children:"Alert Console"}),i.jsx("div",{className:"flex items-center justify-start sm:justify-center",children:i.jsx(na,{label:K,timeZone:D})})]}),i.jsx(d.Tabs,{defaultActiveKey:"active",className:"w-full",tabBarStyle:{fontSize:"medium"},onChange:S=>{const E=S==="archived";q(re=>re+1),o?.(1),c?.({isArchived:E}),E||a?.()},items:[{key:"active",label:"Active",children:i.jsx(Hs,{data:t,loading:e,pageSize:10,total:n,currentPage:r,columns:s||[],onAlertIdClick:H,onRefetch:a,onPageChange:o,onFilterChange:c,resetKey:U})},{key:"archived",label:"Archived",children:i.jsx(sa,{alerts:t,loading:e,columns:s||[],total:n,currentPage:r,onAlertIdClick:H,onFilterChange:c,onPageChange:o,onRefetch:a,resetKey:U})},{key:"settings",label:"Settings",children:i.jsx(Cl,{})}]}),i.jsx(jl,{isModalOpen:l,handleModalClose:v,selectedRow:y,fetchAlertLogs:()=>{},alertStatusList:k,alertStatusLoading:j,initialTab:x,sourceTab:L})]})}function Cl(){const[t,e]=m.useState([]),[s,n]=m.useState([]),[r,a]=m.useState([]),[o,c]=m.useState([]),[l,u]=m.useState(!0),{rules:f}=De();return m.useEffect(()=>{let h=!0;return(async()=>{try{const x=await f.getRules();if(!h)return;c(Array.isArray(x)?x:[]);const p=(x||[]).map((k,j)=>({RuleId:k.ruleId||k.ruleName||String(j),Name:k.ruleName||k.Name||"-",Description:k.ruleDesc||k.Description||"",SeverityId:0}));e(p);try{const k=await f.getLookups(),j=Array.isArray(k?.userRoles)?k.userRoles.map(O=>({userRoleId:O.userRoleId??O.id,userRoleName:O.userRoleName??O.name})):[];n(j),a(Array.isArray(k?.severities)?k.severities:[])}catch{}}catch{}finally{h&&u(!1)}})(),()=>{h=!1}},[]),i.jsx(ia,{severities:r,rules:t,userRoles:s,rawRules:o,loadingRules:l})}function Dl(t){return Array.isArray(t)?{items:t}:t}function ua(t=1,e){const{alerts:s}=De(),n=dt.useQuery({queryKey:["alerts","list",t,e],queryFn:()=>s.listAlerts({pageNumber:t,pageSize:10,...e}).then(Dl),staleTime:3e4});return{alerts:n.data?.items??[],total:n.data?.total,loading:n.isLoading,error:n.error,refetch:n.refetch}}function Rl(t){const[e,s]=m.useState(1),[n,r]=m.useState({}),{alerts:a,total:o,loading:c,refetch:l}=ua(e,n),u=f=>{"isArchived"in f?r({isArchived:f.isArchived}):r(h=>({...h,...f}))};return i.jsx(tn,{alerts:a,loading:c,columns:t.columns,total:o,currentPage:e,onRefetch:l,onPageChange:s,onFilterChange:u})}function Ul({tenant:t,apiDomain:e,rulesDomain:s,headers:n,timeZone:r,userManagementDomain:a,spacesBaseUrl:o,alerts:c,loading:l,columns:u}){const[f]=m.useState(()=>new dt.QueryClient),h=m.useMemo(()=>({alertsBaseUrl:e,rulesBaseUrl:s||e,headers:n||void 0}),[e,s,n]);return i.jsx(dt.QueryClientProvider,{client:f,children:i.jsx(Xn,{tenant:t,override:h,timeZone:r,userManagementDomain:a,spacesBaseUrl:o,children:Array.isArray(c)?i.jsx(tn,{alerts:c,loading:!!l,columns:u}):i.jsx(Rl,{columns:u})})})}function Ll(t){const{alerts:e}=De(),s=dt.useQuery({queryKey:["alerts","report",t],queryFn:()=>e.getAlertsReport(t),staleTime:6e4});return{data:s.data??[],loading:s.isLoading,error:s.error,refetch:s.refetch}}const Fl=[{title:"ID",dataIndex:"id",key:"id",width:120},{title:"Priority",dataIndex:"priority",key:"priority",width:120},{title:"Timestamp",dataIndex:"timestamp",key:"timestamp",width:220},{title:"Status",dataIndex:"statusType",key:"statusType",width:140},{title:"Description",dataIndex:"description",key:"description"}];exports.AlertAssignment=ra;exports.AlertConsole=tn;exports.AlertConsoleWidget=Ul;exports.AlertsTable=Hs;exports.ApiProvider=Xn;exports.ArchivedTable=sa;exports.Clock=na;exports.DataTable=er;exports.MyPreferencesPanel=ol;exports.SettingsPanel=aa;exports.SettingsTabs=ia;exports.exampleAlertColumns=Fl;exports.useAlertStatusList=ca;exports.useAlerts=ua;exports.useAlertsReport=Ll;exports.useApi=De;exports.useUpdateAlertStatus=qs;
2
2
  //# sourceMappingURL=index.cjs.map