@digital-realty/ix-notifications 1.2.2 → 1.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/IxNotifications.js +1 -2
- package/dist/src/IxNotifications.js.map +1 -1
- package/dist/src/components/notifications/date-filters.js +1 -1
- package/dist/src/components/notifications/date-filters.js.map +1 -1
- package/dist/src/components/notifications/notification-item.js +1 -2
- package/dist/src/components/notifications/notification-item.js.map +1 -1
- package/dist/src/components/notifications/view-item-dialog.js +1 -1
- package/dist/src/components/notifications/view-item-dialog.js.map +1 -1
- package/dist/src/ix-notifications.min.js +1 -1
- package/dist/src/services/notifications-service.js +1 -1
- package/dist/src/services/notifications-service.js.map +1 -1
- package/dist/src/state/NotificationState.js +1 -2
- package/dist/src/state/NotificationState.js.map +1 -1
- package/dist/src/tw.js +52 -0
- package/dist/src/tw.js.map +1 -1
- package/package.json +3 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{svg,css,html,nothing}from"lit";import{property,customElement,state,query}from"lit/decorators.js";import{MobxLitElement}from"@adobe/lit-mobx";import{differenceInDays}from"date-fns/differenceInDays.js";import{differenceInHours}from"date-fns/differenceInHours.js";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-drawer/ix-drawer.js";import"@digital-realty/ix-icon";import"@material/web/icon/icon.js";import{makeAutoObservable}from"mobx";import{makePersistable,isHydrated,hydrateStore,clearPersistedStore,getPersistedStore}from"mobx-persist-store";import{parse}from"date-fns/parse.js";import{subDays}from"date-fns/subDays.js";import{format}from"date-fns/format.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-icon/ix-icon.js";import{formatDistance}from"date-fns/formatDistance.js";import"@digital-realty/ix-toast/ix-message-toast.js";import{unsafeSVG}from"lit/directives/unsafe-svg.js";import"@digital-realty/ix-switch/ix-switch.js";import"@digital-realty/ix-date/ix-date.js";import"@digital-realty/ix-divider/ix-divider.js";import{computePosition}from"@floating-ui/dom";import{classMap}from"lit/directives/class-map.js";let viewList=svg`<svg viewBox="0 0 24 24"><path d="M3 9H7V5H3V9ZM7 14H3V10H7V14ZM7 19H3V15H7V19ZM20 14H8V10H20V14ZM8 19H20V15H8V19ZM8 9V5H20V9H8Z"/></svg>`,dcim=svg`<svg viewBox="0 0 24 24"><path d="M20 0C17.791 0 16 1.791 16 4C16 6.857 20 11 20 11C20 11 24 6.857 24 4C24 1.791 22.209 0 20 0ZM12 2C6.486 2 2 6.486 2 12C2 17.514 6.486 22 12 22C17.514 22 22 17.514 22 12C22 11.93 21.9912 11.862 21.9902 11.793C21.7532 12.059 21.5575 12.2677 21.4395 12.3887L19.6504 14.3047C19.4484 14.9657 19.1695 15.5919 18.8145 16.1699C18.4985 15.4819 17.806 15 17 15H16V13C16 12.447 15.552 12 15 12H9V10H10C10.552 10 11 9.553 11 9V7.02344L13.0156 7.00781C13.5986 7.00381 14.1175 6.74289 14.4805 6.33789C14.3145 5.89389 14.1875 5.445 14.1035 5L9.99219 5.03125C9.44319 5.03525 9 5.48225 9 6.03125V8H8C7.448 8 7 8.447 7 9V10.1855L4.98047 8.16797C6.34047 5.68697 8.977 4 12 4H14C14 3.397 14.0908 2.81658 14.2578 2.26758C13.5308 2.09858 12.777 2 12 2ZM20 2.57031C20.789 2.57031 21.4297 3.211 21.4297 4C21.4297 4.789 20.789 5.42969 20 5.42969C19.211 5.42969 18.5703 4.789 18.5703 4C18.5703 3.211 19.211 2.57031 20 2.57031ZM4.20703 10.2207L9 15.0137V16C9 17.103 9.897 18 11 18V19.9316C7.06 19.4366 4 16.072 4 12C4 11.388 4.07603 10.7947 4.20703 10.2207ZM10.7793 14H14V16C14 16.553 14.448 17 15 17H17V18.2344C15.875 19.1384 14.502 19.7417 13 19.9297V17C13 16.447 12.552 16 12 16H11V14.5996C11 14.3776 10.9123 14.174 10.7793 14Z"/></svg>`,plannedMaintenance=svg`<svg viewBox="0 0 24 24"><path d="M6 2C4.90575 2 4 2.90575 4 4V20C4 21.0943 4.90575 22 6 22H11V20H6V4H13V9H18V13H20V8L14 2H6ZM12 11V14H15C15 12.343 13.641 11.031 12 11ZM11 12C9.343 12 8 13.343 8 15C8 16.657 9.343 18 11 18C12.657 18 13.969 16.641 14 15H11V12ZM16 15V21H13C13 22.654 14.346 24 16 24H21C22.645 24 24 22.645 24 21V15H16ZM18 17H22V21C22 21.565 21.565 22 21 22C20.449 22 20 21.552 20 21H18V17Z"/></svg>`,trash=svg`<svg viewBox="0 0 24 24"><path d="M15.5 4H19V6H5V4H8.5L9.5 3H14.5L15.5 4ZM8 21C6.9 21 6 20.1 6 19V7H18V19C18 20.1 17.1 21 16 21H8Z"/></svg>`,sortCheck=(svg`<svg viewBox="0 0 24 24"><path d="M11 12C13.21 12 15 10.21 15 8C15 5.79 13.21 4 11 4C8.79 4 7 5.79 7 8C7 10.21 8.79 12 11 12ZM9 17L12 14.06C11.61 14.02 11.32 14 11 14C8.33 14 3 15.34 3 18V20H12L9 17ZM12 17L15.47 20.5L22 13.91L20.6 12.5L15.47 17.67L13.4 15.59L12 17Z"/></svg>`,svg`<svg viewbox="0 0 24 24"><path d="M 3,6 V 8 H 21 V 6 Z M 3,18 H 9 V 16 H 3 Z M 15,13 H 3 v -2 h 12 z"/><rect x="8" y="0.5" width="16" height="16" rx="8"/><path d="M 14.5,10.585 12.415,8.50001 11.705,9.20501 14.5,12 l 6,-5.99999 -0.705,-0.705 z" style="fill:#fff"/></svg>`),TWStyles=css`*,::after,::before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}::after,::before{--tw-content:''}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.dlr-text-default,:host,:host :root,:root,html{font-family:var(--root-primary-font);font-size:var(--text-default-size);line-height:var(--text-default-line-height);letter-spacing:var(--text-default-letter-spacing);font-weight:var(--text-default-weight);-webkit-text-decoration:var(--text-default-decoration);text-decoration:var(--text-default-decoration);text-transform:var(--text-default-transform)}.dlr-text-heading{font-family:var(--root-secondary-font);font-size:var(--text-heading-size);line-height:var(--text-heading-line-height);letter-spacing:var(--text-heading-letter-spacing);font-weight:var(--text-heading-weight);-webkit-text-decoration:var(--text-heading-decoration);text-decoration:var(--text-heading-decoration);text-transform:var(--text-heading-transform)}.dlr-text-caption{font-family:var(--root-primary-font);font-size:var(--text-caption-size);line-height:var(--text-caption-line-height);letter-spacing:var(--text-caption-letter-spacing);font-weight:var(--text-caption-weight);-webkit-text-decoration:var(--text-caption-decoration);text-decoration:var(--text-caption-decoration);text-transform:var(--text-caption-transform)}.static{position:static}.absolute{position:absolute}.relative{position:relative}.-start-0{inset-inline-start:0}.z-50{z-index:50}.z-\\[9999\\]{z-index:9999}.m-0{margin:0}.m-4{margin:1rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-4{margin-bottom:1rem}.ml-14{margin-left:3.5rem}.mr-4{margin-right:1rem}.flex{display:flex}.hidden{display:none}.w-\\[560px\\]{width:560px}.w-\\[580px\\]{width:580px}.grow{flex-grow:1}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.whitespace-nowrap{white-space:nowrap}.text-wrap{text-wrap:wrap}.text-balance{text-wrap:balance}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.border-b{border-bottom-width:1px}.border-l-3{border-left-width:3px}.border-outline{border-color:var(--cp-neutral-blue-12p)}.border-success{border-color:var(--cp-success-50)}.border-transparent{border-color:transparent}.fill-primary{fill:var(--cp-dlr-blue-50)}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-0{padding-bottom:0}.pl-1{padding-left:.25rem}.pl-3\\.5{padding-left:.875rem}.pl-4{padding-left:1rem}.pr-1{padding-right:.25rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.text-on-surface-disabled{color:var(--cp-neutral-blue-50p)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity,1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:150ms}.hover\\:bg-\\[rgba\\(0\\2c 0\\2c 0\\2c 0\\.04\\)\\]:hover{background-color:rgba(0,0,0,.04)}.hover\\:bg-primary-subtle:hover{background-color:var(--cp-dlr-blue-10p)}@media (min-width:600px){.sm\\:flex-col{flex-direction:column}.md\\:flex-col{flex-direction:column}}@media (min-width:1200px){.lg\\:flex-col{flex-direction:column}.xl\\:flex-row{flex-direction:row}}`;var NotificationStatus,NotificationGroups,SubGroups,ApiCallState;(t=>{t.READ="read",t.UNREAD="unread"})(NotificationStatus=NotificationStatus||{}),(t=>{t.PLANNED_MAINTENANCE="Planned Maintenance",t.INCIDENTS="Incidents",t.DCIM_ALERTS="DCIM Alerts",t.SERVICE_TICKETS="Service Tickets"})(NotificationGroups=NotificationGroups||{}),(t=>{t.Remote_Hands="Remote Hands",t.Deliveries="Deliveries",t.Removals="Removals",t.Facility_Access="Facility Access",t.Trouble_Ticket="Trouble Ticket",t.Customer_Care="Customer Care",t.FacilityAccessVisitorAccess="FacilityAccessVisitorAccess",t.FacilityAccessPermanentBadge="FacilityAccessPermanentBadge",t.FacilityAccessOspAccess="FacilityAccessOspAccess",t.FacilityAccessPopPoeAccess="FacilityAccessPopPoeAccess"})(SubGroups=SubGroups||{}),(t=>{t.LOADING="Loading",t.ERROR="Error",t.SUCCESS="Success"})(ApiCallState=ApiCallState||{});let DefaultDateFormat="yyyy-MM-dd",DefaultDisplayDays=30,DefaultDateTimeFormat="yyyy-MM-dd HH:mm:ss",BASE_PATH="http://api.digitalrealty.com/notifications".replace(/\/+$/,"");class Configuration{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return null!=this.configuration.basePath?this.configuration.basePath:BASE_PATH}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||querystring}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){let t=this.configuration.apiKey;if(t)return"function"==typeof t?t:()=>t}get accessToken(){let t=this.configuration.accessToken;if(t)return"function"==typeof t?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}let DefaultConfig=new Configuration;class BaseAPI{constructor(t=DefaultConfig){this.configuration=t,this.fetchApi=async(t,e)=>{let i={url:t,init:e};for(var o of this.middleware)o.pre&&(i=await o.pre({fetch:this.fetchApi,...i})||i);let a=void 0;try{a=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(t){for(var r of this.middleware)r.onError&&(a=await r.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:t,response:a?a.clone():void 0})||a);if(void 0===a)throw t instanceof Error?new FetchError(t,"The request failed and the interceptors did not return an alternative response"):t}for(var n of this.middleware)n.post&&(a=await n.post({fetch:this.fetchApi,url:i.url,init:i.init,response:a.clone()})||a);return a},this.middleware=t.middleware}withMiddleware(...t){var e=this.clone();return e.middleware=e.middleware.concat(...t),e}withPreMiddleware(...t){t=t.map(t=>({pre:t}));return this.withMiddleware(...t)}withPostMiddleware(...t){t=t.map(t=>({post:t}));return this.withMiddleware(...t)}isJsonMime(t){return!!t&&BaseAPI.jsonRegex.test(t)}async request(t,e){var{url:t,init:e}=await this.createFetchParams(t,e),t=await this.fetchApi(t,e);if(t&&200<=t.status&&t.status<300)return t;throw new ResponseError(t,"Response returned an error code")}async createFetchParams(t,e){let i=this.configuration.basePath+t.path,o=(void 0!==t.query&&0!==Object.keys(t.query).length&&(i+="?"+this.configuration.queryParamsStringify(t.query)),Object.assign({},this.configuration.headers,t.headers));Object.keys(o).forEach(t=>void 0===o[t]?delete o[t]:{});var a="function"==typeof e?e:async()=>e,r={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...r,...await a({init:r,context:t})};let n;n=!(isFormData(a.body)||a.body instanceof URLSearchParams||isBlob(a.body))&&this.isJsonMime(o["Content-Type"])?JSON.stringify(a.body):a.body;r={...a,body:n};return{url:i,init:r}}clone(){var t=new this.constructor(this.configuration);return t.middleware=this.middleware.slice(),t}}function isBlob(t){return"undefined"!=typeof Blob&&t instanceof Blob}function isFormData(t){return"undefined"!=typeof FormData&&t instanceof FormData}BaseAPI.jsonRegex=new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$","i");class ResponseError extends Error{constructor(t,e){super(e),this.response=t,this.name="ResponseError"}}class FetchError extends Error{constructor(t,e){super(e),this.cause=t,this.name="FetchError"}}class RequiredError extends Error{constructor(t,e){super(e),this.field=t,this.name="RequiredError"}}let COLLECTION_FORMATS={csv:","};function exists(t,e){t=t[e];return null!=t}function querystring(e,i=""){return Object.keys(e).map(t=>querystringSingleKey(t,e[t],i)).filter(t=>0<t.length).join("&")}function querystringSingleKey(t,e,i=""){var o,a=i+(i.length?`[${t}]`:t);return e instanceof Array?(o=e.map(t=>encodeURIComponent(String(t))).join(`&${encodeURIComponent(a)}=`),encodeURIComponent(a)+"="+o):e instanceof Set?querystringSingleKey(t,Array.from(e),i):e instanceof Date?encodeURIComponent(a)+"="+encodeURIComponent(e.toISOString()):e instanceof Object?querystring(e,a):encodeURIComponent(a)+"="+encodeURIComponent(String(e))}class JSONApiResponse{constructor(t,e=t=>t){this.raw=t,this.transformer=e}async value(){return this.transformer(await this.raw.json())}}class VoidApiResponse{constructor(t){this.raw=t}async value(){}}function StatusFromJSON(t){return StatusFromJSONTyped(t)}function StatusFromJSONTyped(t,e){return t}function StatusToJSON(t){return t}function NotificationFromJSON(t){return NotificationFromJSONTyped(t)}function NotificationFromJSONTyped(t,e){return null==t?t:{id:exists(t,"id")?t.id:void 0,resourceType:exists(t,"resource_type")?t.resource_type:void 0,subGroup:exists(t,"sub_group")?t.sub_group:void 0,createdAt:exists(t,"created_at")?null===t.created_at?null:new Date(t.created_at):void 0,createdBy:exists(t,"created_by")?t.created_by:void 0,subject:exists(t,"subject")?t.subject:void 0,locations:exists(t,"locations")?t.locations:void 0,resourceId:exists(t,"resource_id")?t.resource_id:void 0,status:exists(t,"status")?StatusFromJSON(t.status):void 0,accountNumber:exists(t,"account_number")?t.account_number:void 0}}function GetNotifications200ResponseFromJSON(t){return GetNotifications200ResponseFromJSONTyped(t)}function GetNotifications200ResponseFromJSONTyped(t,e){return null==t?t:{self:exists(t,"self")?t.self:void 0,first:exists(t,"first")?t.first:void 0,prev:exists(t,"prev")?t.prev:void 0,next:exists(t,"next")?t.next:void 0,last:exists(t,"last")?t.last:void 0,items:t.items.map(NotificationFromJSON)}}function NotificationPatchFromJSON(t){return NotificationPatchFromJSONTyped(t)}function NotificationPatchFromJSONTyped(t,e){return null==t?t:{status:StatusFromJSON(t.status)}}function NotificationPatchToJSON(t){if(void 0!==t)return null===t?null:{status:StatusToJSON(t.status)}}function NotificationRequestToJSON(t){if(void 0!==t)return null===t?null:{resource_type:t.resourceType,sub_group:t.subGroup,recipients:t.recipients,account_number:t.accountNumber,locations:t.locations,resource_id:t.resourceId,subject:t.subject,created_at:void 0===t.createdAt?void 0:null===t.createdAt?null:t.createdAt.toISOString()}}class NotificationsApi extends BaseAPI{async createNotificationRaw(t,e){var i={"Content-Type":"application/json"},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications",method:"POST",headers:i,query:{},body:NotificationRequestToJSON(t.notificationRequest)},e));return new JSONApiResponse(o,t=>NotificationFromJSON(t))}async createNotification(t={},e){return(await this.createNotificationRaw(t,e)).value()}async deleteNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling deleteNotificationsById.");var i={},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"DELETE",headers:i,query:{}},e));return new VoidApiResponse(o)}async deleteNotificationsById(t,e){await this.deleteNotificationsByIdRaw(t,e)}async getNotificationsRaw(t,e){var i={},o=(void 0!==t.sort&&(i.sort=t.sort),void 0!==t.cursor&&(i.cursor=t.cursor),void 0!==t.resourceType&&(i.resource_type=t.resourceType),void 0!==t.accountNumber&&(i.account_number=t.accountNumber),void 0!==t.createdAfter&&(i.created_after=t.createdAfter.toISOString()),void 0!==t.createdBefore&&(i.created_before=t.createdBefore.toISOString()),void 0!==t.locationId&&(i.location_id=t.locationId),void 0!==t.subGroup&&(i.sub_group=t.subGroup),void 0!==t.status&&(i.status=t.status),{}),t=(t.prefer&&(o.Prefer=t.prefer.join(COLLECTION_FORMATS.csv)),this.configuration&&this.configuration.accessToken&&(t=await(0,this.configuration.accessToken)("bearerToken",[]))&&(o.Authorization="Bearer "+t),await this.request({path:"/notifications",method:"GET",headers:o,query:i},e));return new JSONApiResponse(t,t=>GetNotifications200ResponseFromJSON(t))}async getNotifications(t={},e){return(await this.getNotificationsRaw(t,e)).value()}async getNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling getNotificationsById.");var i={},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:i,query:{}},e));return new JSONApiResponse(o,t=>NotificationFromJSON(t))}async getNotificationsById(t,e){return(await this.getNotificationsByIdRaw(t,e)).value()}async patchNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling patchNotificationsById.");var i={"Content-Type":"application/json"},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"PATCH",headers:i,query:{},body:NotificationPatchToJSON(t.notificationPatch)},e));return new JSONApiResponse(o,t=>NotificationPatchFromJSON(t))}async patchNotificationsById(t,e){return(await this.patchNotificationsByIdRaw(t,e)).value()}}let APIEndpointPrefixes={Notifications:"notifications"};class ApiClient{constructor(t){this.noInit=!1,this.configuration=t}get notificationsApi(){return new NotificationsApi(new Configuration({basePath:this.configuration.NotificationApiUrl+"/"+APIEndpointPrefixes.Notifications,headers:{Authorization:this.getAuthorization()}}))}getAuthorization(){return this.configuration.getAuthorizationFn?this.configuration.getAuthorizationFn():""}}let isNullOrUndefinedOrEmpty=t=>null==t||""===t,mapResourceTypeToNotificationGroups=t=>{switch(t.toLowerCase()){case"planned maintenance":return NotificationGroups.PLANNED_MAINTENANCE;case"incidents":return NotificationGroups.INCIDENTS;case"dcim alerts":return NotificationGroups.DCIM_ALERTS;case"service tickets":return NotificationGroups.SERVICE_TICKETS;default:return NotificationGroups.PLANNED_MAINTENANCE}},mapStringToNotificationStatus=t=>{switch(t.toLowerCase()){case"unread":return NotificationStatus.UNREAD;case"read":return NotificationStatus.READ;default:return NotificationStatus.UNREAD}},mapParametersToNotificationRequest=t=>({sort:"-created_at",cursor:t,prefer:[""]}),mapParametersToPatchNotificationRequest=(t,e)=>({id:t,notificationPatch:{status:e}}),mapParametersToDeleteNotificationRequest=t=>({id:t}),mapNotificationDataToNotification=t=>{var e;return{subject:null!=(e=t.subject)?e:"",id:t.id,accountNumber:null!=(e=t.accountNumber)?e:"",resourceType:mapResourceTypeToNotificationGroups(null!=(e=t.resourceType)?e:""),subGroup:null!=(e=t.subGroup)?e:"",resourceId:null!=(e=t.resourceId)?e:"",status:mapStringToNotificationStatus(null!=(e=t.status)?e:""),createdAt:isNullOrUndefinedOrEmpty(t.createdAt)?format(new Date,DefaultDateTimeFormat):format(t.createdAt,DefaultDateTimeFormat),createdBy:null!=(e=t.createdBy)?e:"",locations:null!=(e=t.locations)?e:[]}},mapNotificationResponseToNotifications=t=>t.map(t=>mapNotificationDataToNotification(t)),getNextPageCursorfromQueryParam=t=>{t=new URLSearchParams(t),t=t.has("cursor")?t.get("cursor"):"";return null!==t?t:""},handleError=async(e,t=!0)=>{if(e instanceof ResponseError&&400===e.response.status)try{var i=(await e.response.json()).detail;t&&console.error(i)}catch(t){console.error(e)}else console.error(e)},getLocalStorageUser=t=>{t=localStorage.getItem(t);return t?JSON.parse(t):null},getUserAuthorization=t=>"Bearer "+(null==(t=getLocalStorageUser(t))?void 0:t.access_token);class NotificationState{constructor(){this.showDrawer=!1,this.apiClient={noInit:!0},this.baseApiUrl="",this.localStorageKey="",this.NewApiClient=()=>{this.apiClient=new ApiClient({NotificationApiUrl:this.baseApiUrl,getAuthorizationFn:()=>getUserAuthorization(this.localStorageKey)}),this.getNotifications()},this.nextPageCursor="",this.notifications=[],this.unreadNotificationCount=0,this.notificationFilters={SHOW_PLANNED_MAINTENANCE:!0,SHOW_SERVICE_TICKETS:!0,SHOW_DCIM_ALERTS:!0},this.selectedNotification={id:"",resourceType:NotificationGroups.PLANNED_MAINTENANCE,subGroup:"",subject:"",resourceId:"",locations:[],createdAt:"",accountNumber:"",createdBy:"",status:NotificationStatus.READ},this.dateFilters={FROM_DATE:subDays(new Date,DefaultDisplayDays),TO_DATE:new Date},makeAutoObservable(this),makePersistable(this,{name:"notification-state",properties:["notificationFilters","nextPageCursor"],storage:window.localStorage})}get isHydrated(){return isHydrated(this)}async hydrateStore(){await hydrateStore(this)}async clearStoredData(){await clearPersistedStore(this)}async getStoredData(){return getPersistedStore(this)}ConstructApiClient(){return this.apiClient.noInit?this.NewApiClient():this.apiClient}async clearStoredNotificationsData(){this.notifications=[],this.unreadNotificationCount=0,this.nextPageCursor="",this.apiClient={noInit:!0}}async setNotificationReadStatus(e){var t,i=await this.setNotificationAsRead(e.toString());return!0===await i&&(this.ReduceUnreadNotificationCount(),t=this.notifications.findIndex(t=>t.id===e),this.notifications[t].status=NotificationStatus.READ,this.selectedNotification=this.notifications[t]),i}async setNotificationDeleted(e){var t,i=await this.DeleteNotification(e.toString());return!0===i&&("unread"===(null==(t=this.notifications.find(t=>t.id===e))?void 0:t.status)&&this.ReduceUnreadNotificationCount(),t=this.notifications.findIndex(t=>t.id===e),this.notifications.splice(t,1)),{State:!0===i?ApiCallState.SUCCESS:ApiCallState.ERROR,Message:!0===i?"Successfully deleted the notification":"Error while deleting the notification"}}setNotificationDateFilter(t,e){this.dateFilters.FROM_DATE=void 0!==t?parse(t,DefaultDateFormat,new Date):void 0,this.dateFilters.TO_DATE=void 0!==e?parse(e,DefaultDateFormat,new Date):void 0}setNotificationFilter(t,e){switch(t){case NotificationGroups.PLANNED_MAINTENANCE:this.notificationFilters.SHOW_PLANNED_MAINTENANCE=e;break;case NotificationGroups.SERVICE_TICKETS:this.notificationFilters.SHOW_SERVICE_TICKETS=e;break;case NotificationGroups.DCIM_ALERTS:this.notificationFilters.SHOW_DCIM_ALERTS=e}}async getNotifications(){var t,e;void 0!==this.nextPageCursor&&(e=await(null==(e=this.apiClient)?void 0:e.notificationsApi.getNotificationsRaw(mapParametersToNotificationRequest(getNextPageCursorfromQueryParam(this.nextPageCursor))).catch(t=>{handleError(t,!1)})))&&(t=await(null==e?void 0:e.value()),this.notifications=""===this.nextPageCursor?mapNotificationResponseToNotifications(null==t?void 0:t.items):this.notifications.concat(mapNotificationResponseToNotifications(null==t?void 0:t.items)),this.nextPageCursor=void 0===(null==t?void 0:t.next)||null==t?void 0:t.next,this.unreadNotificationCount=null!==e.raw.headers.get("x-total-unread-count")&&void 0!==e.raw.headers.get("x-total-unread-count")?e.raw.headers.get("x-total-unread-count"):0)}async getNotificationsById(t){let e,i;(i=t?await(null==(e=this.apiClient)?void 0:e.notificationsApi.getNotificationsById({id:t}).catch(t=>{handleError(t,!1)})):i)&&(this.selectedNotification=mapNotificationDataToNotification(i))}async setNotificationAsRead(t){var e;return!!t&&(await(null==(e=this.apiClient)?void 0:e.notificationsApi.patchNotificationsById(mapParametersToPatchNotificationRequest(t,"read")).catch(t=>(handleError(t,!1),!1))),!0)}async DeleteNotification(t){let e,i=!1;return t&&await(null==(e=this.apiClient)?void 0:e.notificationsApi.deleteNotificationsById(mapParametersToDeleteNotificationRequest(t)).catch(t=>{handleError(t,!1),i=!1}).then(()=>{i=!0})),i}ReduceUnreadNotificationCount(){0<this.unreadNotificationCount&&--this.unreadNotificationCount}}let NotificationsState=new NotificationState,NotificationsStyle=css`:host{--ix-drawer-border-radius:0;--ix-drawer-padding:0;--ix-drawer-width-sm:320px;--ix-drawer-width-md:320px;--ix-drawer-width-lg:400px}.destructive-icon{color:var(--clr-critical,#db0028);--md-icon-button-icon-color:var(--clr-critical, #DB0028);--md-sys-color-on-surface-variant:var(--clr-critical, #DB0028)}.destructive-icon path{fill:var(--clr-critical,#db0028)}.active-icon{color:var(--clr-primary,#1456e0);--md-icon-button-icon-color:var(--clr-primary, #1456E0);--md-sys-color-on-surface-variant:var(--clr-primary, #1456E0)}.active-icon path{fill:var(--clr-primary,#1456e0)}.inactive-icon{color:var(--clr-on-surface,#092241);--md-icon-button-icon-color:var(--clr-on-surface, #092241);--md-sys-color-on-surface-variant:var(--clr-on-surface, #092241);cursor:default;opacity:.6}.inactive-icon path{fill:var(--clr-on-surface,#092241);opacity:.6}ix-icon-button.sharp{--md-icon-font:'Material Symbols Sharp'!important}.ix-icon-groups{--ix-icon-font-size:32px;--ix-icon-line-height:32px}.ix-icon-groups ix-icon{color:var(--clr-on-surface,#092241);opacity:.6}.ix-icon-groups ix-icon path{fill:var(--clr-on-surface,#092241)}.datefilter-dropdown-content,.filter-dropdown-content{position:absolute;right:5%;top:3rem;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);z-index:3;transition:box-shadow .3s cubic-bezier(.4,0,.2,1) 0s;border-radius:3px;box-shadow:rgba(0,0,0,.2) 0 5px 5px -3px,rgba(0,0,0,.14) 0 8px 10px 1px,rgba(0,0,0,.12) 0 3px 14px 2px;background-color:var(--clr-surface-container-lowest,#fff)}.unread{font-family:var(--root-primary-font, 'sans-serif');padding:0 5px;font-size:var(--text-caption-size,.75rem);line-height:var(--text-caption-line-height,1.33333333em);left:22px;top:0;background:var(--clr-critical,#db0028);letter-spacing:var(--text-caption-letter-spacing,.03333333em)}.notification-tooltip{background-color:var(--cp-neutral-blue-4,#040d19);white-space:nowrap;font-size:var(--text-caption-size,.75rem);z-index:9999;color:var(--clr-on-secondary,#fff)}.notification-modal-subtitle,.notification-modal-title{color:var(--clr-on-surface,#092241);font-family:var(--root-secondary-font, 'sans-serif')}.notification-modal-subtitle{font-size:var(--text-heading-size,1.25rem);line-height:var(--text-heading-line-height,1.2em)}.notification-modal-content{display:inline-grid;grid-template-columns:fit-content(183px) 1fr;grid-template-rows:auto auto;grid-column-gap:24px;grid-row-gap:8px;font-family:var(--root-primary-font, 'sans-serif');font-size:var(--text-default-size,16px);line-height:28px;width:560px;padding-bottom:16px;color:var(--clr-on-surface,#092241)}.notification-modal-content-title{width:183px;color:var(--clr-on-surface-variant,#092241B3)}.notification-modal-subject-title{grid-area:1/1/2/2}.notification-modal-subject-text{grid-area:1/2/2/3}.notification-modal-created-date-title{grid-area:2/1/3/2}.notification-modal-created-date-text{grid-area:2/2/3/3}.notification-modal-site-title{grid-area:3/1/4/2}.notification-modal-site-text{grid-area:3/2/4/3}`,ConfirmationDialog=class extends MobxLitElement{constructor(){super(...arguments),this.textMessage="Are you sure?",this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("confirm-dialog-closed")),this.onClick(!1)}}static get styles(){return[TWStyles,NotificationsStyle]}onClick(t){t=new CustomEvent("on-confirm-selection",{detail:{returnValue:t},bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return html`<ix-dialog ?open="${this.open}" class="w-[580px]" @closed="${this.dialogClosed}"><div slot="headline">${this.textMessage}</div><div slot="actions"><div class="flex flex-row justify-end p-1"><ix-button name="cancel" appearance="text" @click="${()=>this.onClick(!1)}">DISMISS</ix-button><ix-button name="confirm" appearance="text" @click="${()=>this.onClick(!0)}">YES</ix-button></div></div></ix-dialog>`}},ViewItemDialog=(__decorate([property({type:String,attribute:!0})],ConfirmationDialog.prototype,"textMessage",void 0),__decorate([property({type:Boolean,attribute:!0})],ConfirmationDialog.prototype,"open",void 0),ConfirmationDialog=__decorate([customElement("confirmation-dialog")],ConfirmationDialog),class extends MobxLitElement{constructor(){super(...arguments),this.notification={},this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("view-item-dialog-closed"))},this.viewRecord=()=>{this.dialogClosed(),NotificationsState.showDrawer=!1}}static get styles(){return[TWStyles,NotificationsStyle]}getUrl(){var t=this.notification.resourceId;switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return"/service-management/reports?ticketId="+t;case NotificationGroups.SERVICE_TICKETS:switch(this.notification.subGroup){case SubGroups.Remote_Hands:return"/service-management/service-tickets/remote-hands/"+t;case SubGroups.Customer_Care:return"/service-management/service-tickets/customer-care/"+t;case SubGroups.Deliveries:return`/service-management/service-tickets/${SubGroups.Deliveries}/`+t;case SubGroups.Facility_Access:return"/service-management/service-tickets/facility-access/"+t;case SubGroups.Removals:return"/service-management/service-tickets/removals/"+t;case SubGroups.Trouble_Ticket:return"/service-management/service-tickets/trouble-tickets/"+t;case SubGroups.FacilityAccessVisitorAccess:return"/service-management/service-tickets/facility-access/visitor-access/"+t;case SubGroups.FacilityAccessPermanentBadge:return"/service-management/service-tickets/facility-access/permanent-badge/"+t;case SubGroups.FacilityAccessOspAccess:return"/service-management/service-tickets/facility-access/osp-access/"+t;case SubGroups.FacilityAccessPopPoeAccess:return"/service-management/service-tickets/facility-access/pop-poe-access/"+t;default:return""}case NotificationGroups.INCIDENTS:return"/service-management/reports?ticketId="+t;case NotificationGroups.DCIM_ALERTS:return"/dcim/"+t;default:return""}}getLocation(){return void 0===this.notification.locations||this.notification.locations.length<1?"":1<this.notification.locations.length?"Multiple Sites":this.notification.locations[0]}getSubGroupDisplayName(){switch(this.notification.subGroup){case SubGroups.FacilityAccessVisitorAccess:case SubGroups.FacilityAccessPermanentBadge:case SubGroups.FacilityAccessOspAccess:case SubGroups.FacilityAccessPopPoeAccess:return"Facility Access";case"Incidents (GSN)":return"Incidents";case"Emergency Repairs (InSite 1.0)":return"Emergency Repairs";default:return this.notification.subGroup}}render(){return html`<ix-dialog ?open="${this.open}" @closed="${this.dialogClosed}" class="notification-modal" data-testclass="notification-modal"><div slot="headline" class="w-[560px]"><div class="flex flex-col flex-start"><div class="notification-modal-title text-2xl font-bold text-balance">${this.notification.resourceType}</div><div class="notification-modal-subtitle pt-4 pb-0 font-bold text-balance">${this.getSubGroupDisplayName()}</div></div></div><form class="notification-modal-content" slot="content" id="form-id" method="dialog"><div class="notification-modal-content-title notification-modal-subject-title">Subject</div><div class="notification-modal-subject-text font-normal text-wrap">${this.notification.subject}</div><div class="notification-modal-content-title notification-modal-created-date-title">Create Date</div><div class="notification-modal-created-date-text font-normal text-wrap">${format(new Date(this.notification.createdAt),"dd/MM/yyyy HH:mm:ss")}</div><div class="notification-modal-content-title notification-modal-site-title">Site</div><div class="notification-modal-site-text font-normal text-wrap">${this.getLocation()}</div></form><div slot="actions" class="flex flex-row flex-end"><ix-button data-testclass="close-item-modal" form="form-id" appearance="text">Close</ix-button><ix-button data-testclass="view-record" href="${this.getUrl()}" @click="${this.viewRecord}" appearance="text">View Record</ix-button></div></ix-dialog>`}}),NotificationItem=(__decorate([property({type:Object,attribute:!1})],ViewItemDialog.prototype,"notification",void 0),__decorate([property({type:Boolean,attribute:!0})],ViewItemDialog.prototype,"open",void 0),ViewItemDialog=__decorate([customElement("view-item-dialog")],ViewItemDialog),class extends MobxLitElement{constructor(){super(...arguments),this.disabled=!1,this.read=!1,this.notification={},this.showModal=!1,this.showDeleteConfirmation=!1}static get styles(){return[TWStyles,NotificationsStyle]}displayItem(){this.notification.status===NotificationStatus.UNREAD&&(NotificationsState.setNotificationReadStatus(this.notification.id),this.read=!0),this.showModal=!0}deleteItem(){this.disabled||(this.showDeleteConfirmation=!0)}confirmedDelete(t){t.detail.returnValue&&NotificationsState.setNotificationDeleted(this.notification.id).then(t=>{this.showDeleteResultMessage(t,this.notification.id)}),this.showDeleteConfirmation=!1}showDeleteResultMessage(t,e){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:e,content:html`<ix-message-toast data-testid="notification-delete-toast" toastId="${e}" .TMessageToast="${t.State.toLowerCase()}" forceClose>${t.Message}</ix-message-toast>`,autoClose:2e3,durationOut:2e3,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))}calculateDuration(){return void 0!==this.notification.createdAt?differenceInHours(new Date,new Date(this.notification.createdAt))<24?formatDistance(new Date(this.notification.createdAt),new Date,{addSuffix:!0}):html`<ix-date type="static" variant="date-time" .value="${this.notification.createdAt}"></ix-date>`:"N/A"}getNotificationIcon(){switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return plannedMaintenance;case NotificationGroups.SERVICE_TICKETS:return"sync_saved_locally";case NotificationGroups.INCIDENTS:return"report";case NotificationGroups.DCIM_ALERTS:return dcim;default:return"sync_saved_locally"}}getNotificationTitle(){switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return"Planned Maintenance";case NotificationGroups.SERVICE_TICKETS:return this.getServiceTicketSubGroup()+" Service Ticket Update";case NotificationGroups.INCIDENTS:return"Emergency Repair";case NotificationGroups.DCIM_ALERTS:return"DCIM Alert";default:return"sync_saved_locally"}}getServiceTicketSubGroup(){var t,e;switch(null==(t=this.notification)?void 0:t.subGroup){case SubGroups.FacilityAccessVisitorAccess:case SubGroups.FacilityAccessPermanentBadge:case SubGroups.FacilityAccessOspAccess:case SubGroups.FacilityAccessPopPoeAccess:return"Facility Access";default:return null==(e=this.notification)?void 0:e.subGroup}}render(){return html`<div data-testid="notification-item" class="relative notification-item"><div class="hover:bg-[rgba(0,0,0,0.04)] p-2 pl-3.5 flex gap-3 relative cursor-pointer items-center font-bold ${this.read?"notification-item-read border-l-3 border-transparent":"notification-item-unread border-l-3 border-success"}"><ix-icon style="--ix-icon-font-size:24px;--ix-icon-line-height:24px" icon="${this.getNotificationIcon()}" class="${this.read?"inactive-icon":"active-icon"}" @click="${this.displayItem}">${this.getNotificationIcon()}</ix-icon><div class="flex flex-col grow" @click="${this.displayItem}"><div class="grow text-base"><h2 class="dlr-text-caption">${this.getNotificationTitle()}</h2></div><div class="grow text-xs"><h3 class="dlr-text-caption text-on-surface-disabled">${this.calculateDuration()}</h3></div></div><div><view-item-dialog ?open="${this.showModal}" .notification="${this.notification}" @view-item-dialog-closed="${()=>{this.showModal=!1}}"></view-item-dialog><confirmation-dialog ?open="${this.showDeleteConfirmation}" @on-confirm-selection="${this.confirmedDelete}" @confirm-dialog-closed="${()=>{this.showModal=!1}}" textMessage="Are you sure you want to delete this notification?" data-testclass="notification-delete-confirmation"></confirmation-dialog></div><ix-icon-button style="--md-icon-button-icon-size:24px" data-testclass="delete-notification" @click="${this.deleteItem}" @mouseover="${t=>{this.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:this.disabled?"Emergency Repair Notification cannot be removed":"Remove Notification",target:t.target}}))}}" @mouseout="${()=>this.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" ?disabled="${this.disabled}"><ix-icon slot="default" class="${this.disabled?"inactive-icon":"destructive-icon"}">${trash}</ix-icon></ix-icon-button></div></div>`}}),GroupedItem=(__decorate([property({type:Boolean})],NotificationItem.prototype,"disabled",void 0),__decorate([property({type:Boolean})],NotificationItem.prototype,"read",void 0),__decorate([property({type:Object,attribute:!1})],NotificationItem.prototype,"notification",void 0),__decorate([state()],NotificationItem.prototype,"showModal",void 0),__decorate([state()],NotificationItem.prototype,"showDeleteConfirmation",void 0),NotificationItem=__decorate([customElement("notification-item")],NotificationItem),class extends MobxLitElement{constructor(){super(...arguments),this.groupTitle="Group 1",this.groupIcon="public",this.childItems=NotificationsState.notifications,this.isOpen=!1,this.onClick=()=>{this.isOpen=!this.isOpen}}static get styles(){return[TWStyles,NotificationsStyle]}renderNotificationItems(){var t;return this.isOpen?void 0!==(null==(t=this.childItems)?void 0:t.length)&&0<(null==(t=this.childItems)?void 0:t.length)?html`<div>${null==(t=this.childItems)?void 0:t.map(t=>html`<notification-item .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:html`<p class="dlr-text-caption ml-14 font-bold mr-4">No notifications yet.</p>`:html`${nothing}`}render(){var t;return html`<div class="group-container-row border-b border-outline py-3"><div class="flex items-center justify-between"><div class="flex items-center align-middle"><ix-icon-button icon="${this.isOpen?"arrow_drop_down":"arrow_right"}" @click="${this.onClick}" data-testclass="grouped-item-toggle-expand"></ix-icon-button><ix-icon slot="default" class="ix-icon-groups">${unsafeSVG(this.groupIcon)}</ix-icon><p class="m-0 group-name font-bold pl-1">${this.groupTitle}</p><p class="m-0 pl-4">${null==(t=this.childItems)?void 0:t.length.toString().padStart(2,"0")}</p></div></div>${this.renderNotificationItems()}</div>`}}),GroupFilters=(__decorate([property({type:String,attribute:!0})],GroupedItem.prototype,"groupTitle",void 0),__decorate([property({type:String,attribute:!0})],GroupedItem.prototype,"groupIcon",void 0),__decorate([property({type:Array,attribute:!0})],GroupedItem.prototype,"childItems",void 0),__decorate([state()],GroupedItem.prototype,"isOpen",void 0),GroupedItem=__decorate([customElement("grouped-item")],GroupedItem),class extends MobxLitElement{static get styles(){return[TWStyles,NotificationsStyle]}onSwitchChange(t){var t=t.target,e=null==(e=t.attributes.getNamedItem("name"))?void 0:e.value;NotificationsState.setNotificationFilter(e,t.selected),this.requestUpdate()}render(){return html`<div class="flex flex-col"><label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch data-testid="planned-maintenance-switch" class="flex" name="${NotificationGroups.PLANNED_MAINTENANCE}" selected="${NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE}" @change="${this.onSwitchChange}"></ix-switch><span>Planned Maintenance</span></label> <label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch data-testid="service-tickets-switch" class="flex" name="${NotificationGroups.SERVICE_TICKETS}" selected="${NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS}" @change="${this.onSwitchChange}"></ix-switch><span>Service Ticket Updates</span></label> <label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch data-testid="dcim-alerts-switch" class="flex" name="${NotificationGroups.DCIM_ALERTS}" selected="${NotificationsState.notificationFilters.SHOW_DCIM_ALERTS}" @change="${this.onSwitchChange}"></ix-switch><span>${NotificationGroups.DCIM_ALERTS}</span></label></div>`}}),DateFilters=(GroupFilters=__decorate([customElement("group-filters")],GroupFilters),class extends MobxLitElement{constructor(){super(...arguments),this.fromDate=isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.FROM_DATE)?void 0:format(NotificationsState.dateFilters.FROM_DATE,DefaultDateFormat),this.toDate=isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.TO_DATE)?void 0:format(NotificationsState.dateFilters.TO_DATE,DefaultDateFormat),this.maxDate=format(new Date,DefaultDateFormat),this.fromDateErrorText="",this.toDateErrorText=""}static get styles(){return[TWStyles,NotificationsStyle]}onFromDateChange(t){null===t||""===t?this.fromDate=void 0:(this.fromDate=t,void 0!==this.fromDate&&(this.fromDateErrorText=void 0))}onToDateChange(t){null===t||""===t?this.toDate=void 0:(this.toDate=t,void 0!==this.toDate&&(this.toDateErrorText=void 0))}onApplyDateFilter(t){if(t){if(void 0===this.toDate&&void 0!==this.fromDate)return void(this.toDateErrorText="Please select to date");if(void 0===this.fromDate&&void 0!==this.toDate)return void(this.fromDateErrorText="Please select from date");if(this.fromDate>this.toDate)return this.fromDateErrorText="From date cannot be later than To date.",void(this.fromDate=void 0);if(this.fromDateErrorText=void 0,this.toDate<this.fromDate)return this.toDateErrorText="To date cannot be earlier than From date.",void(this.toDate=void 0);this.toDateErrorText=void 0}t=t&&void 0===this.toDateErrorText&&void 0===this.fromDateErrorText,t&&(NotificationsState.setNotificationDateFilter(this.fromDate,this.toDate),this.requestUpdate()),t=new CustomEvent("on-selection",{detail:{returnValue:t},bubbles:!0,composed:!0});this.dispatchEvent(t)}clearDateFilters(){this.fromDate=void 0,this.toDate=void 0,this.fromDateErrorText=void 0,this.toDateErrorText=void 0}render(){return html`<div class="flex flex-col p-4"><div class="flex flex-row items-center"><div class="grow items-center text-xl font-bold">Filter by Date</div><div class="flex flex-row items-center" @click="${this.clearDateFilters}"><label class="grow text-sm text-right pr-1 cursor-pointer">Clear Filter</label><ix-icon-button data-testid="notifications-clear-date-filter" small appearance="default" icon="domain_verification_off" class="active-icon"></ix-icon-button></div></div><ix-divider class="my-2"></ix-divider><div class="flex xl:flex-row lg:flex-col md:flex-col sm:flex-col justify-between item-center my-4"><div class="flex gap-2"><ix-date data-testid="notifications-from-date" .value="${this.fromDate}" max="${this.maxDate}" label="From" name="FromDate" .errorText="${this.fromDateErrorText}" .onChanged="${t=>this.onFromDateChange(t)}"></ix-date><ix-date data-testid="notifications-to-date" .value="${this.toDate}" max="${this.maxDate}" label="To" name="ToDate" .errorText="${this.toDateErrorText}" .onChanged="${t=>this.onToDateChange(t)}"></ix-date></div></div><div class="flex flex-row justify-between"><ix-button data-testid="notifications-cancel-date-filter" type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!1)}">Cancel</ix-button><ix-button data-testid="notifications-activate-date-filter" type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!0)}">Filter List</ix-button></div></div>`}}),NotificationTooltip=(__decorate([state()],DateFilters.prototype,"fromDate",void 0),__decorate([state()],DateFilters.prototype,"toDate",void 0),__decorate([state()],DateFilters.prototype,"maxDate",void 0),__decorate([state()],DateFilters.prototype,"fromDateErrorText",void 0),__decorate([state()],DateFilters.prototype,"toDateErrorText",void 0),DateFilters=__decorate([customElement("date-filters")],DateFilters),class extends MobxLitElement{constructor(){super(...arguments),this.isVisible=!1,this.label="",this.hoveredElement=void 0,this.configureNotificationTooltip=t=>{var{label:t,target:e}=t.detail;this.hoveredElement=e,this.label=t,this.isVisible=!0},this.hideNotificationTooltip=()=>{this.isVisible=!1,this.hoveredElement=void 0,this.label=""}}static get styles(){return[TWStyles,NotificationsStyle]}connectedCallback(){super.connectedCallback(),window.addEventListener("show-notification-tooltip",this.configureNotificationTooltip),window.addEventListener("hide-notification-tooltip",this.hideNotificationTooltip)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("show-notification-tooltip",this.configureNotificationTooltip),window.removeEventListener("hide-notification-tooltip",this.hideNotificationTooltip)}updated(t){t.has("hoveredElement")&&this.isVisible&&this.hoveredElement&&computePosition(this.hoveredElement,this.notificationTooltip,{placement:"bottom-end"}).then(({x:t,y:e})=>{this.notificationTooltip.style.left=t+"px",this.notificationTooltip.style.top=e+12+"px"})}render(){var t={hidden:!this.isVisible};return html`<div class="notification-tooltip z-[9999] rounded absolute p-2 white-text ${classMap(t)}">${this.label}</div><slot></slot>`}});__decorate([query(".notification-tooltip")],NotificationTooltip.prototype,"notificationTooltip",void 0),__decorate([property({type:Boolean,reflect:!0})],NotificationTooltip.prototype,"isVisible",void 0),__decorate([property({type:String,reflect:!0})],NotificationTooltip.prototype,"label",void 0),__decorate([state()],NotificationTooltip.prototype,"hoveredElement",void 0),NotificationTooltip=__decorate([customElement("notification-tooltip")],NotificationTooltip);class IxNotifications extends MobxLitElement{constructor(){super(...arguments),this.showGroupedView=!1,this.showFilters=!1,this.showDateFilters=!1,this.showMarkAllReadConfirmation=!1,this.baseApiUrl="",this.localStorageKey=""}async firstUpdated(){NotificationsState.baseApiUrl=this.baseApiUrl,NotificationsState.localStorageKey=this.localStorageKey,NotificationsState.ConstructApiClient()}connectedCallback(){super.connectedCallback(),window.addEventListener("account-switched",NotificationsState.NewApiClient),window.addEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.addEventListener("beforeunload",this.handleOnbeforeunload)}disconnectedCallback(){super.disconnectedCallback(),this.handleOnbeforeunload(),window.removeEventListener("account-switched",NotificationsState.NewApiClient),window.removeEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.removeEventListener("beforeunload",this.handleOnbeforeunload)}handleOnbeforeunload(){NotificationsState.clearStoredNotificationsData()}toggleDrawer(){NotificationsState.showDrawer=!NotificationsState.showDrawer,NotificationsState.showDrawer||(this.showFilters=!1,this.showDateFilters=!1)}markAllread(){0<NotificationsState.unreadNotificationCount&&(this.showMarkAllReadConfirmation=!0)}confirmedMarkAllRead(t){if(t.detail.returnValue){var t=this.applyNotificationFilters(),i=null==t?void 0:t.filter(t=>t.status===NotificationStatus.UNREAD);if(0<i.length){let e=!0;null!=t&&t.forEach(t=>{NotificationsState.setNotificationReadStatus(t.id).then(t=>{e=e&&t})});t={State:!0===e?ApiCallState.SUCCESS:ApiCallState.ERROR,Message:!0===e?"Successfully marked all the notifications as read":"Error while marking the notifications read, Please try again"};this.showResultMessage(t,i[0].id),this.requestUpdate()}}this.showMarkAllReadConfirmation=!1}showResultMessage(t,e){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:e,content:html`<ix-message-toast data-testid="notification-read-all-toast" toastId="${e}" .TMessageToast="${t.State.toLowerCase()}" forceClose>${t.Message}</ix-message-toast>`,autoClose:3e3,durationOut:3e3,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))}toggleGroupView(){this.showGroupedView=!this.showGroupedView}displayFilters(){this.showFilters=!this.showFilters}applyNotificationFilters(){var t=null==(t=NotificationsState.notifications)?void 0:t.filter(t=>t.resourceType===NotificationGroups.PLANNED_MAINTENANCE&&!0===NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE||t.resourceType===NotificationGroups.SERVICE_TICKETS&&!0===NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS||t.resourceType===NotificationGroups.DCIM_ALERTS&&!0===NotificationsState.notificationFilters.SHOW_DCIM_ALERTS||t.resourceType===NotificationGroups.INCIDENTS);return void 0!==NotificationsState.dateFilters.FROM_DATE&&void 0!==NotificationsState.dateFilters.TO_DATE?t.filter(t=>0<=differenceInHours(new Date(t.createdAt),NotificationsState.dateFilters.FROM_DATE)&&differenceInDays(new Date(t.createdAt),NotificationsState.dateFilters.TO_DATE)<=0):void 0!==NotificationsState.dateFilters.FROM_DATE&&void 0===NotificationsState.dateFilters.TO_DATE?t.filter(t=>0<=differenceInHours(new Date(t.createdAt),NotificationsState.dateFilters.FROM_DATE)):void 0===NotificationsState.dateFilters.FROM_DATE&&void 0!==NotificationsState.dateFilters.TO_DATE?t.filter(t=>differenceInDays(new Date(t.createdAt),NotificationsState.dateFilters.TO_DATE)<=0):t}displayDateFilters(){this.showDateFilters=!this.showDateFilters}renderGroupedView(){var t=this.applyNotificationFilters();return html`<div class="-mx-4 -mt-2"><grouped-item data-testid="planned-maintenance-group" groupTitle="Planned Maintenance" groupIcon="${plannedMaintenance.strings[0]}" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.PLANNED_MAINTENANCE)}"></grouped-item><grouped-item data-testid="emergency-repairs-group" groupTitle="Emergency Repairs" groupIcon="report" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.INCIDENTS)}"></grouped-item><grouped-item data-testid="service-ticket-updates-group" groupTitle="Service Ticket Updates" groupIcon="sync_saved_locally" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.SERVICE_TICKETS)}"></grouped-item><grouped-item data-testid="dcim-alerts-group" groupTitle="${NotificationGroups.DCIM_ALERTS}" groupIcon="${dcim.strings[0]}" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.DCIM_ALERTS)}"></grouped-item></div>`}renderDefaultView(){var t=this.applyNotificationFilters(),e=t.filter(t=>0===differenceInDays(new Date(t.createdAt),new Date)),i=t.filter(t=>0!==differenceInDays(new Date(t.createdAt),new Date));return 0<(null==t?void 0:t.length)?html`<h3>Today</h3>${0<e.length?html`<div class="-mx-4">${null==e?void 0:e.map(t=>html`<notification-item ?read="${t.status!==NotificationStatus.UNREAD}" data-testclass="today-notification" .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:this.renderNoResult()}<h3>Earlier</h3>${0<i.length?html`<div class="-mx-4">${null==i?void 0:i.map(t=>html`<notification-item ?read="${t.status!==NotificationStatus.UNREAD}" data-testclass="earlier-notification" .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:this.renderNoResult()}`:html`<h3>Today</h3>${this.renderNoResult()}`}renderNoResult(){return html`<p class="dlr-text-caption my-4"><strong>No notifications yet.</strong></p>`}handleCloseClick(t){this.showDateFilters=!1,this.showFilters=!1}handleContentScroll(t){null!==t&&t.detail.scrollTop+t.detail.clientHeight>=t.detail.scrollHeight-2&&NotificationsState.getNotifications()}manageFilterVisibility(t){t=t.composedPath();!this.showFilters||t.includes(this.groupFilters)||t.includes(this.groupFiltersButton)||(this.showFilters=!1),!this.showDateFilters||t.includes(this.dateFilters)||t.includes(this.dateFiltersButton)||(this.showDateFilters=!1)}render(){return html`<notification-tooltip data-testid="notifications-tooltip"></notification-tooltip><confirmation-dialog data-testid="notifications-confirm-read-dialog" ?open="${this.showMarkAllReadConfirmation}" @confirm-dialog-closed="${()=>{this.showMarkAllReadConfirmation=!1}}" @on-confirm-selection="${this.confirmedMarkAllRead}" textMessage="Are you sure you want to mark all notifications as read?"></confirmation-dialog><ix-drawer data-testid="notifications-drawer" ?isVisible="${NotificationsState.showDrawer}" .onClosed="${()=>this.toggleDrawer()}" animate-vertical hide-close @on-content-scroll="${this.handleContentScroll}" @click="${this.manageFilterVisibility}" compact="compact"><div slot="content" class="m-4"><div class="flex flex-row justify-between grow items-center notification-header-container mb-4"><h2 data-testid="notifications-heading" class="grow items-center dlr-text-heading">Notifications</h2><div class="flex flex-row justify-end grow items-center options" style="--md-icon-button-icon-size:24px"><ix-icon-button data-testid="notifications-cta-all-read" data-testclass="notifications-cta" @click="${this.markAllread}" @mouseover="${t=>{0<NotificationsState.unreadNotificationCount&&window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Mark All Read",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" icon="markunread_mailbox" class="${NotificationsState.unreadNotificationCount<=0?"inactive-icon":"active-icon"}" .disabled="${NotificationsState.unreadNotificationCount<=0}" filledIcon="true"></ix-icon-button><ix-icon-button data-testid="notifications-cta-sort-type" data-testclass="notifications-cta" @click="${this.toggleGroupView}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Sort by Type",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" label="Sort by Type"><ix-icon slot="default">${this.showGroupedView?sortCheck:"sort"}</ix-icon></ix-icon-button><ix-icon-button data-testid="notifications-cta-filter-type" data-testclass="notifications-cta" @click="${this.displayFilters}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Type",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" id="group-filter-button" label="Filter by Type"><ix-icon slot="default">${viewList}</ix-icon></ix-icon-button><div data-testid="notifications-filter-dropdown" class="filter-dropdown-content ${this.showFilters?"active z-50":"hidden"}"><group-filters></group-filters></div><ix-icon-button data-testid="notifications-cta-filter-date" data-testclass="notifications-cta" @click="${this.displayDateFilters}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Date",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" icon="date_range" class="active-icon" filledIcon="true" id="date-filters-button" label="Filter by Date"></ix-icon-button><div data-testid="notifications-date-filter-dropdown" class="datefilter-dropdown-content ${this.showDateFilters?"active z-50":"hidden"}" @on-selection="${this.handleCloseClick}"><date-filters></date-filters></div></div></div>${this.showGroupedView?this.renderGroupedView():this.renderDefaultView()}</div></ix-drawer>`}}IxNotifications.styles=[TWStyles,NotificationsStyle],__decorate([query("group-filters")],IxNotifications.prototype,"groupFilters",void 0),__decorate([query("ix-icon-button#group-filter-button")],IxNotifications.prototype,"groupFiltersButton",void 0),__decorate([query("date-filters")],IxNotifications.prototype,"dateFilters",void 0),__decorate([query("ix-icon-button#date-filters-button")],IxNotifications.prototype,"dateFiltersButton",void 0),__decorate([state()],IxNotifications.prototype,"showGroupedView",void 0),__decorate([state()],IxNotifications.prototype,"showFilters",void 0),__decorate([state()],IxNotifications.prototype,"showDateFilters",void 0),__decorate([state()],IxNotifications.prototype,"showMarkAllReadConfirmation",void 0),__decorate([property({type:String})],IxNotifications.prototype,"baseApiUrl",void 0),__decorate([property({type:String})],IxNotifications.prototype,"localStorageKey",void 0),window.customElements.define("ix-notifications",IxNotifications);
|
|
1
|
+
import{svg,css,LitElement,html,nothing}from"lit";import{customElement,property,state,query}from"lit/decorators.js";import{MobxLitElement}from"@adobe/lit-mobx";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-drawer/ix-drawer.js";import"@digital-realty/ix-icon";import{makeAutoObservable}from"mobx";import{makePersistable,isHydrated,hydrateStore,clearPersistedStore,getPersistedStore}from"mobx-persist-store";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-icon/ix-icon.js";import"@digital-realty/ix-toast/ix-message-toast.js";import{unsafeSVG}from"lit/directives/unsafe-svg.js";import"@digital-realty/ix-switch/ix-switch.js";import"@digital-realty/ix-date/ix-date.js";import"@digital-realty/ix-divider/ix-divider.js";import{classMap}from"lit/directives/class-map.js";function __decorate(t,e,i,r){var a,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;0<=s;s--)(a=t[s])&&(n=(o<3?a(n):3<o?a(e,i,n):a(e,i))||n);return 3<o&&n&&Object.defineProperty(e,i,n),n}let millisecondsInWeek=6048e5,millisecondsInDay=864e5,millisecondsInMinute=6e4,millisecondsInHour=36e5,millisecondsInSecond=1e3,minutesInMonth=43200,minutesInDay=1440,constructFromSymbol=Symbol.for("constructDateFrom");function constructFrom(t,e){return"function"==typeof t?t(e):t&&"object"==typeof t&&constructFromSymbol in t?t[constructFromSymbol](e):new(t instanceof Date?t.constructor:Date)(e)}function toDate(t,e){return constructFrom(e||t,t)}function addDays(t,e,i){var r=toDate(t,i?.in);return isNaN(e)?constructFrom(i?.in||t,NaN):(e&&r.setDate(r.getDate()+e),r)}let defaultOptions={};function getDefaultOptions$1(){return defaultOptions}function startOfWeek(t,e){var i=getDefaultOptions$1(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,t=toDate(t,e?.in),e=t.getDay(),e=(e<i?7:0)+e-i;return t.setDate(t.getDate()-e),t.setHours(0,0,0,0),t}function startOfISOWeek(t,e){return startOfWeek(t,{...e,weekStartsOn:1})}function getISOWeekYear(t,e){var t=toDate(t,e?.in),e=t.getFullYear(),i=constructFrom(t,0),i=(i.setFullYear(e+1,0,4),i.setHours(0,0,0,0),startOfISOWeek(i)),r=constructFrom(t,0),r=(r.setFullYear(e,0,4),r.setHours(0,0,0,0),startOfISOWeek(r));return t.getTime()>=i.getTime()?e+1:t.getTime()>=r.getTime()?e:e-1}function getTimezoneOffsetInMilliseconds(t){var e=toDate(t),i=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return i.setUTCFullYear(e.getFullYear()),+t-+i}function normalizeDates(t,...e){t=constructFrom.bind(null,t||e.find(t=>"object"==typeof t));return e.map(t)}function startOfDay(t,e){t=toDate(t,e?.in);return t.setHours(0,0,0,0),t}function differenceInCalendarDays(t,e,i){var[i,t]=normalizeDates(i?.in,t,e),e=startOfDay(i),i=startOfDay(t),t=+e-getTimezoneOffsetInMilliseconds(e),e=+i-getTimezoneOffsetInMilliseconds(i);return Math.round((t-e)/millisecondsInDay)}function startOfISOWeekYear(t,e){e=getISOWeekYear(t,e),t=constructFrom(t,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),startOfISOWeek(t)}function compareAsc(t,e){t=+toDate(t)-+toDate(e);return t<0?-1:0<t?1:t}function isDate(t){return t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)}function isValid(t){return!(!isDate(t)&&"number"!=typeof t||isNaN(+toDate(t)))}function differenceInCalendarMonths(t,e,i){var[i,t]=normalizeDates(i?.in,t,e);return 12*(i.getFullYear()-t.getFullYear())+(i.getMonth()-t.getMonth())}function differenceInDays(t,e,i){var[i,t]=normalizeDates(i?.in,t,e),e=compareLocalAsc(i,t),r=Math.abs(differenceInCalendarDays(i,t)),i=(i.setDate(i.getDate()-e*r),Number(compareLocalAsc(i,t)===-e)),t=e*(r-i);return 0==t?0:t}function compareLocalAsc(t,e){t=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return t<0?-1:0<t?1:t}function getRoundingMethod(e){return t=>{t=(e?Math[e]:Math.trunc)(t);return 0===t?0:t}}function differenceInHours(t,e,i){var[t,e]=normalizeDates(i?.in,t,e),t=(+t-+e)/millisecondsInHour;return getRoundingMethod(i?.roundingMethod)(t)}function differenceInMilliseconds(t,e){return+toDate(t)-+toDate(e)}function endOfDay(t,e){t=toDate(t,e?.in);return t.setHours(23,59,59,999),t}function endOfMonth(t,e){t=toDate(t,e?.in),e=t.getMonth();return t.setFullYear(t.getFullYear(),e+1,0),t.setHours(23,59,59,999),t}function isLastDayOfMonth(t,e){t=toDate(t,e?.in);return+endOfDay(t,e)==+endOfMonth(t,e)}function differenceInMonths(t,e,i){var[i,t,e]=normalizeDates(i?.in,t,t,e),r=compareAsc(t,e),a=Math.abs(differenceInCalendarMonths(t,e));if(a<1)return 0;1===t.getMonth()&&27<t.getDate()&&t.setDate(30),t.setMonth(t.getMonth()-r*a);let o=compareAsc(t,e)===-r;t=r*(a-+(o=isLastDayOfMonth(i)&&1===a&&1===compareAsc(i,e)?!1:o));return 0==t?0:t}function differenceInSeconds(t,e,i){t=differenceInMilliseconds(t,e)/1e3;return getRoundingMethod(i?.roundingMethod)(t)}function startOfYear(t,e){t=toDate(t,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}let formatDistanceLocale={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},formatDistance$1=(t,e,i)=>{let r;t=formatDistanceLocale[t];return r="string"==typeof t?t:1===e?t.one:t.other.replace("{{count}}",e.toString()),i?.addSuffix?i.comparison&&0<i.comparison?"in "+r:r+" ago":r};function buildFormatLongFn(e){return(t={})=>{t=t.width?String(t.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}let dateFormats={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},timeFormats={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},dateTimeFormats={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},formatLong={date:buildFormatLongFn({formats:dateFormats,defaultWidth:"full"}),time:buildFormatLongFn({formats:timeFormats,defaultWidth:"full"}),dateTime:buildFormatLongFn({formats:dateTimeFormats,defaultWidth:"full"})},formatRelativeLocale={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},formatRelative=(t,e,i,r)=>formatRelativeLocale[t];function buildLocalizeFn(o){return(t,e)=>{var i,r=e?.context?String(e.context):"standalone";let a;a="formatting"===r&&o.formattingValues?(r=o.defaultFormattingWidth||o.defaultWidth,i=e?.width?String(e.width):r,o.formattingValues[i]||o.formattingValues[r]):(i=o.defaultWidth,r=e?.width?String(e.width):o.defaultWidth,o.values[r]||o.values[i]);e=o.argumentCallback?o.argumentCallback(t):t;return a[e]}}let eraValues={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},quarterValues={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},monthValues={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dayValues={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},dayPeriodValues={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},formattingDayPeriodValues={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ordinalNumber=(t,e)=>{var i=Number(t),t=i%100;if(20<t||t<10)switch(t%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},localize={ordinalNumber:ordinalNumber,era:buildLocalizeFn({values:eraValues,defaultWidth:"wide"}),quarter:buildLocalizeFn({values:quarterValues,defaultWidth:"wide",argumentCallback:t=>t-1}),month:buildLocalizeFn({values:monthValues,defaultWidth:"wide"}),day:buildLocalizeFn({values:dayValues,defaultWidth:"wide"}),dayPeriod:buildLocalizeFn({values:dayPeriodValues,defaultWidth:"wide",formattingValues:formattingDayPeriodValues,defaultFormattingWidth:"wide"})};function buildMatchFn(o){return(t,e={})=>{var i=e.width,r=i&&o.matchPatterns[i]||o.matchPatterns[o.defaultMatchWidth],r=t.match(r);if(!r)return null;let a=r[0];r=i&&o.parsePatterns[i]||o.parsePatterns[o.defaultParseWidth],i=Array.isArray(r)?findIndex(r,t=>t.test(a)):findKey(r,t=>t.test(a)),r=o.valueCallback?o.valueCallback(i):i;return{value:e.valueCallback?e.valueCallback(r):r,rest:t.slice(a.length)}}}function findKey(t,e){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&e(t[i]))return i}function findIndex(e,i){for(let t=0;t<e.length;t++)if(i(e[t]))return t}function buildMatchPatternFn(a){return(t,e={})=>{var i,r=t.match(a.matchPattern);return r&&(r=r[0],i=t.match(a.parsePattern))?(i=a.valueCallback?a.valueCallback(i[0]):i[0],{value:i=e.valueCallback?e.valueCallback(i):i,rest:t.slice(r.length)}):null}}let matchOrdinalNumberPattern=/^(\d+)(th|st|nd|rd)?/i,parseOrdinalNumberPattern=/\d+/i,matchEraPatterns={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},parseEraPatterns={any:[/^b/i,/^(a|c)/i]},matchQuarterPatterns={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},parseQuarterPatterns={any:[/1/i,/2/i,/3/i,/4/i]},matchMonthPatterns={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},parseMonthPatterns={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},matchDayPatterns={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},parseDayPatterns={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},matchDayPeriodPatterns={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},parseDayPeriodPatterns={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},match={ordinalNumber:buildMatchPatternFn({matchPattern:matchOrdinalNumberPattern,parsePattern:parseOrdinalNumberPattern,valueCallback:t=>parseInt(t,10)}),era:buildMatchFn({matchPatterns:matchEraPatterns,defaultMatchWidth:"wide",parsePatterns:parseEraPatterns,defaultParseWidth:"any"}),quarter:buildMatchFn({matchPatterns:matchQuarterPatterns,defaultMatchWidth:"wide",parsePatterns:parseQuarterPatterns,defaultParseWidth:"any",valueCallback:t=>t+1}),month:buildMatchFn({matchPatterns:matchMonthPatterns,defaultMatchWidth:"wide",parsePatterns:parseMonthPatterns,defaultParseWidth:"any"}),day:buildMatchFn({matchPatterns:matchDayPatterns,defaultMatchWidth:"wide",parsePatterns:parseDayPatterns,defaultParseWidth:"any"}),dayPeriod:buildMatchFn({matchPatterns:matchDayPeriodPatterns,defaultMatchWidth:"any",parsePatterns:parseDayPeriodPatterns,defaultParseWidth:"any"})},enUS={code:"en-US",formatDistance:formatDistance$1,formatLong:formatLong,formatRelative:formatRelative,localize:localize,match:match,options:{weekStartsOn:0,firstWeekContainsDate:1}};function getDayOfYear(t,e){t=toDate(t,e?.in);return differenceInCalendarDays(t,startOfYear(t))+1}function getISOWeek(t,e){t=toDate(t,e?.in),e=+startOfISOWeek(t)-+startOfISOWeekYear(t);return Math.round(e/millisecondsInWeek)+1}function getWeekYear(t,e){var i=toDate(t,e?.in),r=i.getFullYear(),a=getDefaultOptions$1(),a=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=constructFrom(e?.in||t,0),o=(o.setFullYear(r+1,0,a),o.setHours(0,0,0,0),startOfWeek(o,e)),t=constructFrom(e?.in||t,0),a=(t.setFullYear(r,0,a),t.setHours(0,0,0,0),startOfWeek(t,e));return+o<=+i?r+1:+a<=+i?r:r-1}function startOfWeekYear(t,e){var i=getDefaultOptions$1(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,r=getWeekYear(t,e),t=constructFrom(e?.in||t,0),r=(t.setFullYear(r,0,i),t.setHours(0,0,0,0),startOfWeek(t,e));return r}function getWeek(t,e){t=toDate(t,e?.in),t=+startOfWeek(t,e)-+startOfWeekYear(t,e);return Math.round(t/millisecondsInWeek)+1}function addLeadingZeros(t,e){return(t<0?"-":"")+Math.abs(t).toString().padStart(e,"0")}let lightFormatters={y(t,e){t=t.getFullYear(),t=0<t?t:1-t;return addLeadingZeros("yy"===e?t%100:t,e.length)},M(t,e){t=t.getMonth();return"M"===e?String(t+1):addLeadingZeros(t+1,2)},d(t,e){return addLeadingZeros(t.getDate(),e.length)},a(t,e){var i=1<=t.getHours()/12?"pm":"am";switch(e){case"a":case"aa":return i.toUpperCase();case"aaa":return i;case"aaaaa":return i[0];default:return"am"===i?"a.m.":"p.m."}},h(t,e){return addLeadingZeros(t.getHours()%12||12,e.length)},H(t,e){return addLeadingZeros(t.getHours(),e.length)},m(t,e){return addLeadingZeros(t.getMinutes(),e.length)},s(t,e){return addLeadingZeros(t.getSeconds(),e.length)},S(t,e){var i=e.length,t=t.getMilliseconds();return addLeadingZeros(Math.trunc(t*Math.pow(10,i-3)),e.length)}},dayPeriodEnum={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},formatters={G:function(t,e,i){var r=0<t.getFullYear()?1:0;switch(e){case"G":case"GG":case"GGG":return i.era(r,{width:"abbreviated"});case"GGGGG":return i.era(r,{width:"narrow"});default:return i.era(r,{width:"wide"})}},y:function(t,e,i){var r;return"yo"===e?(r=t.getFullYear(),i.ordinalNumber(0<r?r:1-r,{unit:"year"})):lightFormatters.y(t,e)},Y:function(t,e,i,r){t=getWeekYear(t,r),r=0<t?t:1-t;return"YY"===e?addLeadingZeros(r%100,2):"Yo"===e?i.ordinalNumber(r,{unit:"year"}):addLeadingZeros(r,e.length)},R:function(t,e){return addLeadingZeros(getISOWeekYear(t),e.length)},u:function(t,e){return addLeadingZeros(t.getFullYear(),e.length)},Q:function(t,e,i){var r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return addLeadingZeros(r,2);case"Qo":return i.ordinalNumber(r,{unit:"quarter"});case"QQQ":return i.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return i.quarter(r,{width:"narrow",context:"formatting"});default:return i.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,i){var r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return addLeadingZeros(r,2);case"qo":return i.ordinalNumber(r,{unit:"quarter"});case"qqq":return i.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return i.quarter(r,{width:"narrow",context:"standalone"});default:return i.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,i){var r=t.getMonth();switch(e){case"M":case"MM":return lightFormatters.M(t,e);case"Mo":return i.ordinalNumber(r+1,{unit:"month"});case"MMM":return i.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return i.month(r,{width:"narrow",context:"formatting"});default:return i.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,i){var r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return addLeadingZeros(r+1,2);case"Lo":return i.ordinalNumber(r+1,{unit:"month"});case"LLL":return i.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return i.month(r,{width:"narrow",context:"standalone"});default:return i.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,i,r){t=getWeek(t,r);return"wo"===e?i.ordinalNumber(t,{unit:"week"}):addLeadingZeros(t,e.length)},I:function(t,e,i){t=getISOWeek(t);return"Io"===e?i.ordinalNumber(t,{unit:"week"}):addLeadingZeros(t,e.length)},d:function(t,e,i){return"do"===e?i.ordinalNumber(t.getDate(),{unit:"date"}):lightFormatters.d(t,e)},D:function(t,e,i){t=getDayOfYear(t);return"Do"===e?i.ordinalNumber(t,{unit:"dayOfYear"}):addLeadingZeros(t,e.length)},E:function(t,e,i){var r=t.getDay();switch(e){case"E":case"EE":case"EEE":return i.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return i.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(r,{width:"short",context:"formatting"});default:return i.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,i,r){var a=t.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return addLeadingZeros(o,2);case"eo":return i.ordinalNumber(o,{unit:"day"});case"eee":return i.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return i.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(a,{width:"short",context:"formatting"});default:return i.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,i,r){var a=t.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return addLeadingZeros(o,e.length);case"co":return i.ordinalNumber(o,{unit:"day"});case"ccc":return i.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return i.day(a,{width:"narrow",context:"standalone"});case"cccccc":return i.day(a,{width:"short",context:"standalone"});default:return i.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,i){var r=t.getDay(),a=0===r?7:r;switch(e){case"i":return String(a);case"ii":return addLeadingZeros(a,e.length);case"io":return i.ordinalNumber(a,{unit:"day"});case"iii":return i.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return i.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return i.day(r,{width:"short",context:"formatting"});default:return i.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,i){var r=1<=t.getHours()/12?"pm":"am";switch(e){case"a":case"aa":return i.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return i.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return i.dayPeriod(r,{width:"narrow",context:"formatting"});default:return i.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,i){t=t.getHours();let r;switch(r=12===t?dayPeriodEnum.noon:0===t?dayPeriodEnum.midnight:1<=t/12?"pm":"am",e){case"b":case"bb":return i.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return i.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return i.dayPeriod(r,{width:"narrow",context:"formatting"});default:return i.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,i){t=t.getHours();let r;switch(r=17<=t?dayPeriodEnum.evening:12<=t?dayPeriodEnum.afternoon:4<=t?dayPeriodEnum.morning:dayPeriodEnum.night,e){case"B":case"BB":case"BBB":return i.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return i.dayPeriod(r,{width:"narrow",context:"formatting"});default:return i.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,i){if("ho"!==t)return lightFormatters.h(e,t);{let t=e.getHours()%12;return 0===t&&(t=12),i.ordinalNumber(t,{unit:"hour"})}},H:function(t,e,i){return"Ho"===e?i.ordinalNumber(t.getHours(),{unit:"hour"}):lightFormatters.H(t,e)},K:function(t,e,i){t=t.getHours()%12;return"Ko"===e?i.ordinalNumber(t,{unit:"hour"}):addLeadingZeros(t,e.length)},k:function(t,e,i){let r=t.getHours();return 0===r&&(r=24),"ko"===e?i.ordinalNumber(r,{unit:"hour"}):addLeadingZeros(r,e.length)},m:function(t,e,i){return"mo"===e?i.ordinalNumber(t.getMinutes(),{unit:"minute"}):lightFormatters.m(t,e)},s:function(t,e,i){return"so"===e?i.ordinalNumber(t.getSeconds(),{unit:"second"}):lightFormatters.s(t,e)},S:function(t,e){return lightFormatters.S(t,e)},X:function(t,e,i){var r=t.getTimezoneOffset();if(0===r)return"Z";switch(e){case"X":return formatTimezoneWithOptionalMinutes(r);case"XXXX":case"XX":return formatTimezone(r);default:return formatTimezone(r,":")}},x:function(t,e,i){var r=t.getTimezoneOffset();switch(e){case"x":return formatTimezoneWithOptionalMinutes(r);case"xxxx":case"xx":return formatTimezone(r);default:return formatTimezone(r,":")}},O:function(t,e,i){var r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+formatTimezoneShort(r,":");default:return"GMT"+formatTimezone(r,":")}},z:function(t,e,i){var r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+formatTimezoneShort(r,":");default:return"GMT"+formatTimezone(r,":")}},t:function(t,e,i){return addLeadingZeros(Math.trunc(+t/1e3),e.length)},T:function(t,e,i){return addLeadingZeros(+t,e.length)}};function formatTimezoneShort(t,e=""){var i=0<t?"-":"+",t=Math.abs(t),r=Math.trunc(t/60),t=t%60;return 0==t?i+String(r):i+String(r)+e+addLeadingZeros(t,2)}function formatTimezoneWithOptionalMinutes(t,e){return t%60==0?(0<t?"-":"+")+addLeadingZeros(Math.abs(t)/60,2):formatTimezone(t,e)}function formatTimezone(t,e=""){var i=0<t?"-":"+",t=Math.abs(t);return i+addLeadingZeros(Math.trunc(t/60),2)+e+addLeadingZeros(t%60,2)}let dateLongFormatter=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},timeLongFormatter=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},dateTimeLongFormatter=(t,e)=>{var i=t.match(/(P+)(p+)?/)||[],r=i[1],i=i[2];if(!i)return dateLongFormatter(t,e);let a;switch(r){case"P":a=e.dateTime({width:"short"});break;case"PP":a=e.dateTime({width:"medium"});break;case"PPP":a=e.dateTime({width:"long"});break;default:a=e.dateTime({width:"full"})}return a.replace("{{date}}",dateLongFormatter(r,e)).replace("{{time}}",timeLongFormatter(i,e))},longFormatters={p:timeLongFormatter,P:dateTimeLongFormatter},dayOfYearTokenRE=/^D+$/,weekYearTokenRE=/^Y+$/,throwTokens=["D","DD","YY","YYYY"];function isProtectedDayOfYearToken(t){return dayOfYearTokenRE.test(t)}function isProtectedWeekYearToken(t){return weekYearTokenRE.test(t)}function warnOrThrowProtectedError(t,e,i){e=message(t,e,i);if(console.warn(e),throwTokens.includes(t))throw new RangeError(e)}function message(t,e,i){var r="Y"===t[0]?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${i}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}let formattingTokensRegExp$1=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,longFormattingTokensRegExp$1=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,escapedStringRegExp$1=/^'([^]*?)'?$/,doubleQuoteRegExp$1=/''/g,unescapedLatinCharacterRegExp$1=/[a-zA-Z]/;function format(i,r,t){var e=getDefaultOptions$1();let a=e.locale??enUS;var o=e.firstWeekContainsDate??e.locale?.options?.firstWeekContainsDate??1,e=e.weekStartsOn??e.locale?.options?.weekStartsOn??0;let n=toDate(i,t?.in);if(!isValid(n))throw new RangeError("Invalid time value");let s=r.match(longFormattingTokensRegExp$1).map(t=>{var e=t[0];return"p"===e||"P"===e?(0,longFormatters[e])(t,a.formatLong):t}).join("").match(formattingTokensRegExp$1).map(t=>{if("''"===t)return{isToken:!1,value:"'"};var e=t[0];if("'"===e)return{isToken:!1,value:cleanEscapedString$1(t)};if(formatters[e])return{isToken:!0,value:t};if(e.match(unescapedLatinCharacterRegExp$1))throw new RangeError("Format string contains an unescaped latin alphabet character `"+e+"`");return{isToken:!1,value:t}}),c=(a.localize.preprocessor&&(s=a.localize.preprocessor(n,s)),{firstWeekContainsDate:o,weekStartsOn:e,locale:a});return s.map(t=>{var e;return t.isToken?((isProtectedWeekYearToken(e=t.value)||isProtectedDayOfYearToken(e))&&warnOrThrowProtectedError(e,r,String(i)),(0,formatters[e[0]])(n,e,a.localize,c)):t.value}).join("")}function cleanEscapedString$1(t){var e=t.match(escapedStringRegExp$1);return e?e[1].replace(doubleQuoteRegExp$1,"'"):t}function formatDistance(t,e,i){var r=getDefaultOptions$1(),r=i?.locale??r.locale??enUS,a=compareAsc(t,e);if(isNaN(a))throw new RangeError("Invalid time value");var o=Object.assign({},i,{addSuffix:i?.addSuffix,comparison:a}),[a,t]=normalizeDates(i?.in,...0<a?[e,t]:[t,e]),e=differenceInSeconds(t,a),n=(getTimezoneOffsetInMilliseconds(t)-getTimezoneOffsetInMilliseconds(a))/1e3,n=Math.round((e-n)/60);let s;return n<2?i?.includeSeconds?e<5?r.formatDistance("lessThanXSeconds",5,o):e<10?r.formatDistance("lessThanXSeconds",10,o):e<20?r.formatDistance("lessThanXSeconds",20,o):e<40?r.formatDistance("halfAMinute",0,o):e<60?r.formatDistance("lessThanXMinutes",1,o):r.formatDistance("xMinutes",1,o):0===n?r.formatDistance("lessThanXMinutes",1,o):r.formatDistance("xMinutes",n,o):n<45?r.formatDistance("xMinutes",n,o):n<90?r.formatDistance("aboutXHours",1,o):n<minutesInDay?(i=Math.round(n/60),r.formatDistance("aboutXHours",i,o)):n<2520?r.formatDistance("xDays",1,o):n<minutesInMonth?(e=Math.round(n/minutesInDay),r.formatDistance("xDays",e,o)):n<2*minutesInMonth?(s=Math.round(n/minutesInMonth),r.formatDistance("aboutXMonths",s,o)):(s=differenceInMonths(t,a))<12?(i=Math.round(n/minutesInMonth),r.formatDistance("xMonths",i,o)):(e=s%12,t=Math.trunc(s/12),e<3?r.formatDistance("aboutXYears",t,o):e<9?r.formatDistance("overXYears",t,o):r.formatDistance("almostXYears",t+1,o))}function getDefaultOptions(){return Object.assign({},getDefaultOptions$1())}function getISODay(t,e){t=toDate(t,e?.in).getDay();return 0===t?7:t}function transpose(t,e){e=isConstructor(e)?new e(0):constructFrom(e,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),e}function isConstructor(t){return"function"==typeof t&&t.prototype?.constructor===t}let TIMEZONE_UNIT_PRIORITY=10;class Setter{subPriority=0;validate(t,e){return!0}}class ValueSetter extends Setter{constructor(t,e,i,r,a){super(),this.value=t,this.validateValue=e,this.setValue=i,this.priority=r,a&&(this.subPriority=a)}validate(t,e){return this.validateValue(t,this.value,e)}set(t,e,i){return this.setValue(t,e,this.value,i)}}class DateTimezoneSetter extends Setter{priority=TIMEZONE_UNIT_PRIORITY;subPriority=-1;constructor(t,e){super(),this.context=t||(t=>constructFrom(e,t))}set(t,e){return e.timestampIsSet?t:constructFrom(t,transpose(t,this.context))}}class Parser{run(t,e,i,r){t=this.parse(t,e,i,r);return t?{setter:new ValueSetter(t.value,this.validate,this.set,this.priority,this.subPriority),rest:t.rest}:null}validate(t,e,i){return!0}}class EraParser extends Parser{priority=140;parse(t,e,i){switch(e){case"G":case"GG":case"GGG":return i.era(t,{width:"abbreviated"})||i.era(t,{width:"narrow"});case"GGGGG":return i.era(t,{width:"narrow"});default:return i.era(t,{width:"wide"})||i.era(t,{width:"abbreviated"})||i.era(t,{width:"narrow"})}}set(t,e,i){return e.era=i,t.setFullYear(i,0,1),t.setHours(0,0,0,0),t}incompatibleTokens=["R","u","t","T"]}let numericPatterns={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},timezonePatterns={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function mapValue(t,e){return t&&{value:e(t.value),rest:t.rest}}function parseNumericPattern(t,e){t=e.match(t);return t?{value:parseInt(t[0],10),rest:e.slice(t[0].length)}:null}function parseTimezonePattern(t,e){var i,r,a,o,t=e.match(t);return t?"Z"===t[0]?{value:0,rest:e.slice(1)}:(i="+"===t[1]?1:-1,r=t[2]?parseInt(t[2],10):0,a=t[3]?parseInt(t[3],10):0,o=t[5]?parseInt(t[5],10):0,{value:i*(r*millisecondsInHour+a*millisecondsInMinute+o*millisecondsInSecond),rest:e.slice(t[0].length)}):null}function parseAnyDigitsSigned(t){return parseNumericPattern(numericPatterns.anyDigitsSigned,t)}function parseNDigits(t,e){switch(t){case 1:return parseNumericPattern(numericPatterns.singleDigit,e);case 2:return parseNumericPattern(numericPatterns.twoDigits,e);case 3:return parseNumericPattern(numericPatterns.threeDigits,e);case 4:return parseNumericPattern(numericPatterns.fourDigits,e);default:return parseNumericPattern(new RegExp("^\\d{1,"+t+"}"),e)}}function parseNDigitsSigned(t,e){switch(t){case 1:return parseNumericPattern(numericPatterns.singleDigitSigned,e);case 2:return parseNumericPattern(numericPatterns.twoDigitsSigned,e);case 3:return parseNumericPattern(numericPatterns.threeDigitsSigned,e);case 4:return parseNumericPattern(numericPatterns.fourDigitsSigned,e);default:return parseNumericPattern(new RegExp("^-?\\d{1,"+t+"}"),e)}}function dayPeriodEnumToHours(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}function normalizeTwoDigitYear(t,e){var i=0<e,e=i?e:1-e;let r;return r=e<=50?t||100:(e=e+50,t+100*Math.trunc(e/100)-(e%100<=t?100:0)),i?r:1-r}function isLeapYearIndex(t){return t%400==0||t%4==0&&t%100!=0}class YearParser extends Parser{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(t,e,i){var r=t=>({year:t,isTwoDigitYear:"yy"===e});switch(e){case"y":return mapValue(parseNDigits(4,t),r);case"yo":return mapValue(i.ordinalNumber(t,{unit:"year"}),r);default:return mapValue(parseNDigits(e.length,t),r)}}validate(t,e){return e.isTwoDigitYear||0<e.year}set(t,e,i){var r=t.getFullYear();return i.isTwoDigitYear?(r=normalizeTwoDigitYear(i.year,r),t.setFullYear(r,0,1),t.setHours(0,0,0,0)):(r="era"in e&&1!==e.era?1-i.year:i.year,t.setFullYear(r,0,1),t.setHours(0,0,0,0)),t}}class LocalWeekYearParser extends Parser{priority=130;parse(t,e,i){var r=t=>({year:t,isTwoDigitYear:"YY"===e});switch(e){case"Y":return mapValue(parseNDigits(4,t),r);case"Yo":return mapValue(i.ordinalNumber(t,{unit:"year"}),r);default:return mapValue(parseNDigits(e.length,t),r)}}validate(t,e){return e.isTwoDigitYear||0<e.year}set(t,e,i,r){var a=getWeekYear(t,r);return i.isTwoDigitYear?(a=normalizeTwoDigitYear(i.year,a),t.setFullYear(a,0,r.firstWeekContainsDate),t.setHours(0,0,0,0)):(a="era"in e&&1!==e.era?1-i.year:i.year,t.setFullYear(a,0,r.firstWeekContainsDate),t.setHours(0,0,0,0)),startOfWeek(t,r)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class ISOWeekYearParser extends Parser{priority=130;parse(t,e){return parseNDigitsSigned("R"===e?4:e.length,t)}set(t,e,i){t=constructFrom(t,0);return t.setFullYear(i,0,4),t.setHours(0,0,0,0),startOfISOWeek(t)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class ExtendedYearParser extends Parser{priority=130;parse(t,e){return parseNDigitsSigned("u"===e?4:e.length,t)}set(t,e,i){return t.setFullYear(i,0,1),t.setHours(0,0,0,0),t}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class QuarterParser extends Parser{priority=120;parse(t,e,i){switch(e){case"Q":case"QQ":return parseNDigits(e.length,t);case"Qo":return i.ordinalNumber(t,{unit:"quarter"});case"QQQ":return i.quarter(t,{width:"abbreviated",context:"formatting"})||i.quarter(t,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(t,{width:"narrow",context:"formatting"});default:return i.quarter(t,{width:"wide",context:"formatting"})||i.quarter(t,{width:"abbreviated",context:"formatting"})||i.quarter(t,{width:"narrow",context:"formatting"})}}validate(t,e){return 1<=e&&e<=4}set(t,e,i){return t.setMonth(3*(i-1),1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class StandAloneQuarterParser extends Parser{priority=120;parse(t,e,i){switch(e){case"q":case"qq":return parseNDigits(e.length,t);case"qo":return i.ordinalNumber(t,{unit:"quarter"});case"qqq":return i.quarter(t,{width:"abbreviated",context:"standalone"})||i.quarter(t,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(t,{width:"narrow",context:"standalone"});default:return i.quarter(t,{width:"wide",context:"standalone"})||i.quarter(t,{width:"abbreviated",context:"standalone"})||i.quarter(t,{width:"narrow",context:"standalone"})}}validate(t,e){return 1<=e&&e<=4}set(t,e,i){return t.setMonth(3*(i-1),1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class MonthParser extends Parser{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(t,e,i){var r=t=>t-1;switch(e){case"M":return mapValue(parseNumericPattern(numericPatterns.month,t),r);case"MM":return mapValue(parseNDigits(2,t),r);case"Mo":return mapValue(i.ordinalNumber(t,{unit:"month"}),r);case"MMM":return i.month(t,{width:"abbreviated",context:"formatting"})||i.month(t,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(t,{width:"narrow",context:"formatting"});default:return i.month(t,{width:"wide",context:"formatting"})||i.month(t,{width:"abbreviated",context:"formatting"})||i.month(t,{width:"narrow",context:"formatting"})}}validate(t,e){return 0<=e&&e<=11}set(t,e,i){return t.setMonth(i,1),t.setHours(0,0,0,0),t}}class StandAloneMonthParser extends Parser{priority=110;parse(t,e,i){var r=t=>t-1;switch(e){case"L":return mapValue(parseNumericPattern(numericPatterns.month,t),r);case"LL":return mapValue(parseNDigits(2,t),r);case"Lo":return mapValue(i.ordinalNumber(t,{unit:"month"}),r);case"LLL":return i.month(t,{width:"abbreviated",context:"standalone"})||i.month(t,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(t,{width:"narrow",context:"standalone"});default:return i.month(t,{width:"wide",context:"standalone"})||i.month(t,{width:"abbreviated",context:"standalone"})||i.month(t,{width:"narrow",context:"standalone"})}}validate(t,e){return 0<=e&&e<=11}set(t,e,i){return t.setMonth(i,1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function setWeek(t,e,i){t=toDate(t,i?.in),e=getWeek(t,i)-e;return t.setDate(t.getDate()-7*e),toDate(t,i?.in)}class LocalWeekParser extends Parser{priority=100;parse(t,e,i){switch(e){case"w":return parseNumericPattern(numericPatterns.week,t);case"wo":return i.ordinalNumber(t,{unit:"week"});default:return parseNDigits(e.length,t)}}validate(t,e){return 1<=e&&e<=53}set(t,e,i,r){return startOfWeek(setWeek(t,i,r),r)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function setISOWeek(t,e,i){t=toDate(t,i?.in),i=getISOWeek(t,i)-e;return t.setDate(t.getDate()-7*i),t}class ISOWeekParser extends Parser{priority=100;parse(t,e,i){switch(e){case"I":return parseNumericPattern(numericPatterns.week,t);case"Io":return i.ordinalNumber(t,{unit:"week"});default:return parseNDigits(e.length,t)}}validate(t,e){return 1<=e&&e<=53}set(t,e,i){return startOfISOWeek(setISOWeek(t,i))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}let DAYS_IN_MONTH=[31,28,31,30,31,30,31,31,30,31,30,31],DAYS_IN_MONTH_LEAP_YEAR=[31,29,31,30,31,30,31,31,30,31,30,31];class DateParser extends Parser{priority=90;subPriority=1;parse(t,e,i){switch(e){case"d":return parseNumericPattern(numericPatterns.date,t);case"do":return i.ordinalNumber(t,{unit:"date"});default:return parseNDigits(e.length,t)}}validate(t,e){var i=isLeapYearIndex(t.getFullYear()),t=t.getMonth();return i?1<=e&&e<=DAYS_IN_MONTH_LEAP_YEAR[t]:1<=e&&e<=DAYS_IN_MONTH[t]}set(t,e,i){return t.setDate(i),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class DayOfYearParser extends Parser{priority=90;subpriority=1;parse(t,e,i){switch(e){case"D":case"DD":return parseNumericPattern(numericPatterns.dayOfYear,t);case"Do":return i.ordinalNumber(t,{unit:"date"});default:return parseNDigits(e.length,t)}}validate(t,e){return isLeapYearIndex(t.getFullYear())?1<=e&&e<=366:1<=e&&e<=365}set(t,e,i){return t.setMonth(0,i),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function setDay(t,e,i){var r=getDefaultOptions$1(),r=i?.weekStartsOn??i?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,t=toDate(t,i?.in),a=t.getDay(),r=7-r;return addDays(t,e<0||6<e?e-(a+r)%7:((7+e%7)%7+r)%7-(a+r)%7,i)}class DayParser extends Parser{priority=90;parse(t,e,i){switch(e){case"E":case"EE":case"EEE":return i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});default:return i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"})}}validate(t,e){return 0<=e&&e<=6}set(t,e,i,r){return(t=setDay(t,i,r)).setHours(0,0,0,0),t}incompatibleTokens=["D","i","e","c","t","T"]}class LocalDayParser extends Parser{priority=90;parse(t,e,i,r){var a=t=>{var e=7*Math.floor((t-1)/7);return(t+r.weekStartsOn+6)%7+e};switch(e){case"e":case"ee":return mapValue(parseNDigits(e.length,t),a);case"eo":return mapValue(i.ordinalNumber(t,{unit:"day"}),a);case"eee":return i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"eeeee":return i.day(t,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});default:return i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"})}}validate(t,e){return 0<=e&&e<=6}set(t,e,i,r){return(t=setDay(t,i,r)).setHours(0,0,0,0),t}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class StandAloneLocalDayParser extends Parser{priority=90;parse(t,e,i,r){var a=t=>{var e=7*Math.floor((t-1)/7);return(t+r.weekStartsOn+6)%7+e};switch(e){case"c":case"cc":return mapValue(parseNDigits(e.length,t),a);case"co":return mapValue(i.ordinalNumber(t,{unit:"day"}),a);case"ccc":return i.day(t,{width:"abbreviated",context:"standalone"})||i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"});case"ccccc":return i.day(t,{width:"narrow",context:"standalone"});case"cccccc":return i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"});default:return i.day(t,{width:"wide",context:"standalone"})||i.day(t,{width:"abbreviated",context:"standalone"})||i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"})}}validate(t,e){return 0<=e&&e<=6}set(t,e,i,r){return(t=setDay(t,i,r)).setHours(0,0,0,0),t}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function setISODay(t,e,i){t=toDate(t,i?.in);return addDays(t,e-getISODay(t,i),i)}class ISODayParser extends Parser{priority=90;parse(t,e,i){var r=t=>0===t?7:t;switch(e){case"i":case"ii":return parseNDigits(e.length,t);case"io":return i.ordinalNumber(t,{unit:"day"});case"iii":return mapValue(i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),r);case"iiiii":return mapValue(i.day(t,{width:"narrow",context:"formatting"}),r);case"iiiiii":return mapValue(i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),r);default:return mapValue(i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),r)}}validate(t,e){return 1<=e&&e<=7}set(t,e,i){return(t=setISODay(t,i)).setHours(0,0,0,0),t}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class AMPMParser extends Parser{priority=80;parse(t,e,i){switch(e){case"a":case"aa":case"aaa":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(t,{width:"narrow",context:"formatting"});default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,e,i){return t.setHours(dayPeriodEnumToHours(i),0,0,0),t}incompatibleTokens=["b","B","H","k","t","T"]}class AMPMMidnightParser extends Parser{priority=80;parse(t,e,i){switch(e){case"b":case"bb":case"bbb":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(t,{width:"narrow",context:"formatting"});default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,e,i){return t.setHours(dayPeriodEnumToHours(i),0,0,0),t}incompatibleTokens=["a","B","H","k","t","T"]}class DayPeriodParser extends Parser{priority=80;parse(t,e,i){switch(e){case"B":case"BB":case"BBB":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(t,{width:"narrow",context:"formatting"});default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,e,i){return t.setHours(dayPeriodEnumToHours(i),0,0,0),t}incompatibleTokens=["a","b","t","T"]}class Hour1to12Parser extends Parser{priority=70;parse(t,e,i){switch(e){case"h":return parseNumericPattern(numericPatterns.hour12h,t);case"ho":return i.ordinalNumber(t,{unit:"hour"});default:return parseNDigits(e.length,t)}}validate(t,e){return 1<=e&&e<=12}set(t,e,i){var r=12<=t.getHours();return r&&i<12?t.setHours(i+12,0,0,0):r||12!==i?t.setHours(i,0,0,0):t.setHours(0,0,0,0),t}incompatibleTokens=["H","K","k","t","T"]}class Hour0to23Parser extends Parser{priority=70;parse(t,e,i){switch(e){case"H":return parseNumericPattern(numericPatterns.hour23h,t);case"Ho":return i.ordinalNumber(t,{unit:"hour"});default:return parseNDigits(e.length,t)}}validate(t,e){return 0<=e&&e<=23}set(t,e,i){return t.setHours(i,0,0,0),t}incompatibleTokens=["a","b","h","K","k","t","T"]}class Hour0To11Parser extends Parser{priority=70;parse(t,e,i){switch(e){case"K":return parseNumericPattern(numericPatterns.hour11h,t);case"Ko":return i.ordinalNumber(t,{unit:"hour"});default:return parseNDigits(e.length,t)}}validate(t,e){return 0<=e&&e<=11}set(t,e,i){return 12<=t.getHours()&&i<12?t.setHours(i+12,0,0,0):t.setHours(i,0,0,0),t}incompatibleTokens=["h","H","k","t","T"]}class Hour1To24Parser extends Parser{priority=70;parse(t,e,i){switch(e){case"k":return parseNumericPattern(numericPatterns.hour24h,t);case"ko":return i.ordinalNumber(t,{unit:"hour"});default:return parseNDigits(e.length,t)}}validate(t,e){return 1<=e&&e<=24}set(t,e,i){return t.setHours(i<=24?i%24:i,0,0,0),t}incompatibleTokens=["a","b","h","H","K","t","T"]}class MinuteParser extends Parser{priority=60;parse(t,e,i){switch(e){case"m":return parseNumericPattern(numericPatterns.minute,t);case"mo":return i.ordinalNumber(t,{unit:"minute"});default:return parseNDigits(e.length,t)}}validate(t,e){return 0<=e&&e<=59}set(t,e,i){return t.setMinutes(i,0,0),t}incompatibleTokens=["t","T"]}class SecondParser extends Parser{priority=50;parse(t,e,i){switch(e){case"s":return parseNumericPattern(numericPatterns.second,t);case"so":return i.ordinalNumber(t,{unit:"second"});default:return parseNDigits(e.length,t)}}validate(t,e){return 0<=e&&e<=59}set(t,e,i){return t.setSeconds(i,0),t}incompatibleTokens=["t","T"]}class FractionOfSecondParser extends Parser{priority=30;parse(t,e){return mapValue(parseNDigits(e.length,t),t=>Math.trunc(t*Math.pow(10,3-e.length)))}set(t,e,i){return t.setMilliseconds(i),t}incompatibleTokens=["t","T"]}class ISOTimezoneWithZParser extends Parser{priority=10;parse(t,e){switch(e){case"X":return parseTimezonePattern(timezonePatterns.basicOptionalMinutes,t);case"XX":return parseTimezonePattern(timezonePatterns.basic,t);case"XXXX":return parseTimezonePattern(timezonePatterns.basicOptionalSeconds,t);case"XXXXX":return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds,t);default:return parseTimezonePattern(timezonePatterns.extended,t)}}set(t,e,i){return e.timestampIsSet?t:constructFrom(t,t.getTime()-getTimezoneOffsetInMilliseconds(t)-i)}incompatibleTokens=["t","T","x"]}class ISOTimezoneParser extends Parser{priority=10;parse(t,e){switch(e){case"x":return parseTimezonePattern(timezonePatterns.basicOptionalMinutes,t);case"xx":return parseTimezonePattern(timezonePatterns.basic,t);case"xxxx":return parseTimezonePattern(timezonePatterns.basicOptionalSeconds,t);case"xxxxx":return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds,t);default:return parseTimezonePattern(timezonePatterns.extended,t)}}set(t,e,i){return e.timestampIsSet?t:constructFrom(t,t.getTime()-getTimezoneOffsetInMilliseconds(t)-i)}incompatibleTokens=["t","T","X"]}class TimestampSecondsParser extends Parser{priority=40;parse(t){return parseAnyDigitsSigned(t)}set(t,e,i){return[constructFrom(t,1e3*i),{timestampIsSet:!0}]}incompatibleTokens="*"}class TimestampMillisecondsParser extends Parser{priority=20;parse(t){return parseAnyDigitsSigned(t)}set(t,e,i){return[constructFrom(t,i),{timestampIsSet:!0}]}incompatibleTokens="*"}let parsers={G:new EraParser,y:new YearParser,Y:new LocalWeekYearParser,R:new ISOWeekYearParser,u:new ExtendedYearParser,Q:new QuarterParser,q:new StandAloneQuarterParser,M:new MonthParser,L:new StandAloneMonthParser,w:new LocalWeekParser,I:new ISOWeekParser,d:new DateParser,D:new DayOfYearParser,E:new DayParser,e:new LocalDayParser,c:new StandAloneLocalDayParser,i:new ISODayParser,a:new AMPMParser,b:new AMPMMidnightParser,B:new DayPeriodParser,h:new Hour1to12Parser,H:new Hour0to23Parser,K:new Hour0To11Parser,k:new Hour1To24Parser,m:new MinuteParser,s:new SecondParser,S:new FractionOfSecondParser,X:new ISOTimezoneWithZParser,x:new ISOTimezoneParser,t:new TimestampSecondsParser,T:new TimestampMillisecondsParser},formattingTokensRegExp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,longFormattingTokensRegExp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,escapedStringRegExp=/^'([^]*?)'?$/,doubleQuoteRegExp=/''/g,notWhitespaceRegExp=/\S/,unescapedLatinCharacterRegExp=/[a-zA-Z]/;function parse(t,e,i,r){var a=()=>constructFrom(i,NaN),o=getDefaultOptions();let n=o.locale??enUS;var s={firstWeekContainsDate:o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,weekStartsOn:o.weekStartsOn??o.locale?.options?.weekStartsOn??0,locale:n};let c=[new DateTimezoneSetter(r?.in,i)];var l,d=[];for(l of e.match(longFormattingTokensRegExp).map(t=>{var e=t[0];return e in longFormatters?(0,longFormatters[e])(t,n.formatLong):t}).join("").match(formattingTokensRegExp)){isProtectedWeekYearToken(l)&&warnOrThrowProtectedError(l,e,t),isProtectedDayOfYearToken(l)&&warnOrThrowProtectedError(l,e,t);let i=l[0];var u=parsers[i];if(u){let e=u.incompatibleTokens;if(Array.isArray(e)){var f=d.find(t=>e.includes(t.token)||t.token===i);if(f)throw new RangeError(`The format string mustn't contain \`${f.fullToken}\` and \`${l}\` at the same time`)}else if("*"===u.incompatibleTokens&&0<d.length)throw new RangeError(`The format string mustn't contain \`${l}\` and any other token at the same time`);d.push({token:i,fullToken:l});f=u.run(t,l,n.match,s);if(!f)return a();c.push(f.setter),t=f.rest}else{if(i.match(unescapedLatinCharacterRegExp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+i+"`");if("''"===l?l="'":"'"===i&&(l=cleanEscapedString(l)),0!==t.indexOf(l))return a();t=t.slice(l.length)}}if(0<t.length&¬WhitespaceRegExp.test(t))return a();o=c.map(t=>t.priority).sort((t,e)=>e-t).filter((t,e,i)=>i.indexOf(t)===e).map(e=>c.filter(t=>t.priority===e).sort((t,e)=>e.subPriority-t.subPriority)).map(t=>t[0]);let h=toDate(i,r?.in);if(isNaN(+h))return a();var m,p={};for(m of o){if(!m.validate(h,s))return a();var g=m.set(h,p,s);Array.isArray(g)?(h=g[0],Object.assign(p,g[1])):h=g}return h}function cleanEscapedString(t){return t.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp,"'")}function subDays(t,e,i){return addDays(t,-30,i)}let viewList=svg`<svg viewBox="0 0 24 24"><path d="M3 9H7V5H3V9ZM7 14H3V10H7V14ZM7 19H3V15H7V19ZM20 14H8V10H20V14ZM8 19H20V15H8V19ZM8 9V5H20V9H8Z"/></svg>`,dcim=svg`<svg viewBox="0 0 24 24"><path d="M20 0C17.791 0 16 1.791 16 4C16 6.857 20 11 20 11C20 11 24 6.857 24 4C24 1.791 22.209 0 20 0ZM12 2C6.486 2 2 6.486 2 12C2 17.514 6.486 22 12 22C17.514 22 22 17.514 22 12C22 11.93 21.9912 11.862 21.9902 11.793C21.7532 12.059 21.5575 12.2677 21.4395 12.3887L19.6504 14.3047C19.4484 14.9657 19.1695 15.5919 18.8145 16.1699C18.4985 15.4819 17.806 15 17 15H16V13C16 12.447 15.552 12 15 12H9V10H10C10.552 10 11 9.553 11 9V7.02344L13.0156 7.00781C13.5986 7.00381 14.1175 6.74289 14.4805 6.33789C14.3145 5.89389 14.1875 5.445 14.1035 5L9.99219 5.03125C9.44319 5.03525 9 5.48225 9 6.03125V8H8C7.448 8 7 8.447 7 9V10.1855L4.98047 8.16797C6.34047 5.68697 8.977 4 12 4H14C14 3.397 14.0908 2.81658 14.2578 2.26758C13.5308 2.09858 12.777 2 12 2ZM20 2.57031C20.789 2.57031 21.4297 3.211 21.4297 4C21.4297 4.789 20.789 5.42969 20 5.42969C19.211 5.42969 18.5703 4.789 18.5703 4C18.5703 3.211 19.211 2.57031 20 2.57031ZM4.20703 10.2207L9 15.0137V16C9 17.103 9.897 18 11 18V19.9316C7.06 19.4366 4 16.072 4 12C4 11.388 4.07603 10.7947 4.20703 10.2207ZM10.7793 14H14V16C14 16.553 14.448 17 15 17H17V18.2344C15.875 19.1384 14.502 19.7417 13 19.9297V17C13 16.447 12.552 16 12 16H11V14.5996C11 14.3776 10.9123 14.174 10.7793 14Z"/></svg>`,plannedMaintenance=svg`<svg viewBox="0 0 24 24"><path d="M6 2C4.90575 2 4 2.90575 4 4V20C4 21.0943 4.90575 22 6 22H11V20H6V4H13V9H18V13H20V8L14 2H6ZM12 11V14H15C15 12.343 13.641 11.031 12 11ZM11 12C9.343 12 8 13.343 8 15C8 16.657 9.343 18 11 18C12.657 18 13.969 16.641 14 15H11V12ZM16 15V21H13C13 22.654 14.346 24 16 24H21C22.645 24 24 22.645 24 21V15H16ZM18 17H22V21C22 21.565 21.565 22 21 22C20.449 22 20 21.552 20 21H18V17Z"/></svg>`,trash=svg`<svg viewBox="0 0 24 24"><path d="M15.5 4H19V6H5V4H8.5L9.5 3H14.5L15.5 4ZM8 21C6.9 21 6 20.1 6 19V7H18V19C18 20.1 17.1 21 16 21H8Z"/></svg>`,sortCheck=(svg`<svg viewBox="0 0 24 24"><path d="M11 12C13.21 12 15 10.21 15 8C15 5.79 13.21 4 11 4C8.79 4 7 5.79 7 8C7 10.21 8.79 12 11 12ZM9 17L12 14.06C11.61 14.02 11.32 14 11 14C8.33 14 3 15.34 3 18V20H12L9 17ZM12 17L15.47 20.5L22 13.91L20.6 12.5L15.47 17.67L13.4 15.59L12 17Z"/></svg>`,svg`<svg viewbox="0 0 24 24"><path d="M 3,6 V 8 H 21 V 6 Z M 3,18 H 9 V 16 H 3 Z M 15,13 H 3 v -2 h 12 z"/><rect x="8" y="0.5" width="16" height="16" rx="8"/><path d="M 14.5,10.585 12.415,8.50001 11.705,9.20501 14.5,12 l 6,-5.99999 -0.705,-0.705 z" style="fill:#fff"/></svg>`),TWStyles=css`*,::after,::before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}::after,::before{--tw-content:''}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.dlr-text-default,:host,:host :root,:root,html{font-family:var(--root-primary-font);font-size:var(--text-default-size);line-height:var(--text-default-line-height);letter-spacing:var(--text-default-letter-spacing);font-weight:var(--text-default-weight);-webkit-text-decoration:var(--text-default-decoration);text-decoration:var(--text-default-decoration);text-transform:var(--text-default-transform)}.dlr-text-heading{font-family:var(--root-secondary-font);font-size:var(--text-heading-size);line-height:var(--text-heading-line-height);letter-spacing:var(--text-heading-letter-spacing);font-weight:var(--text-heading-weight);-webkit-text-decoration:var(--text-heading-decoration);text-decoration:var(--text-heading-decoration);text-transform:var(--text-heading-transform)}.dlr-text-caption{font-family:var(--root-primary-font);font-size:var(--text-caption-size);line-height:var(--text-caption-line-height);letter-spacing:var(--text-caption-letter-spacing);font-weight:var(--text-caption-weight);-webkit-text-decoration:var(--text-caption-decoration);text-decoration:var(--text-caption-decoration);text-transform:var(--text-caption-transform)}.visible{visibility:visible}.collapse{visibility:collapse}.static{position:static}.absolute{position:absolute}.relative{position:relative}.-start-0{inset-inline-start:0}.z-50{z-index:50}.z-\\[9999\\]{z-index:9999}.m-0{margin:0}.m-4{margin:1rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-4{margin-bottom:1rem}.ml-14{margin-left:3.5rem}.mr-4{margin-right:1rem}.block{display:block}.flex{display:flex}.table{display:table}.contents{display:contents}.hidden{display:none}.w-\\[560px\\]{width:560px}.w-\\[580px\\]{width:580px}.flex-grow{flex-grow:1}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.whitespace-nowrap{white-space:nowrap}.text-wrap{text-wrap:wrap}.text-balance{text-wrap:balance}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-l-3{border-left-width:3px}.border-outline{border-color:var(--cp-neutral-blue-12p)}.border-success{border-color:var(--cp-success-50)}.border-transparent{border-color:transparent}.fill-primary{fill:var(--cp-dlr-blue-50)}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-0{padding-bottom:0}.pl-1{padding-left:.25rem}.pl-3{padding-left:.75rem}.pl-3\\.5{padding-left:.875rem}.pl-4{padding-left:1rem}.pr-1{padding-right:.25rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.text-on-surface-disabled{color:var(--cp-neutral-blue-50p)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:150ms}.hover\\:bg-\\[rgba\\(0\\2c 0\\2c 0\\2c 0\\.04\\)\\]:hover{background-color:rgba(0,0,0,.04)}.hover\\:bg-primary-subtle:hover{background-color:var(--cp-dlr-blue-10p)}@media (min-width:600px){.sm\\:flex-col{flex-direction:column}.md\\:flex-col{flex-direction:column}}@media (min-width:1200px){.lg\\:flex-col{flex-direction:column}.xl\\:flex-row{flex-direction:row}}`;class Icon extends LitElement{render(){return html`<slot></slot>`}connectedCallback(){super.connectedCallback(),"false"===this.getAttribute("aria-hidden")?this.removeAttribute("aria-hidden"):this.setAttribute("aria-hidden","true")}}let styles=css`:host{font-size:var(--md-icon-size,24px);width:var(--md-icon-size,24px);height:var(--md-icon-size,24px);color:inherit;font-variation-settings:inherit;font-weight:400;font-family:var(--md-icon-font,Material Symbols Outlined);display:inline-flex;font-style:normal;line-height:1;overflow:hidden;letter-spacing:normal;text-transform:none;user-select:none;white-space:nowrap;word-wrap:normal;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}::slotted(svg){fill:currentColor}::slotted(*){height:100%;width:100%}`,MdIcon=class extends Icon{};var NotificationStatus,NotificationGroups,SubGroups,ApiCallState;MdIcon.styles=[styles],MdIcon=__decorate([customElement("md-icon")],MdIcon),(t=>{t.READ="read",t.UNREAD="unread"})(NotificationStatus=NotificationStatus||{}),(t=>{t.PLANNED_MAINTENANCE="Planned Maintenance",t.INCIDENTS="Incidents",t.DCIM_ALERTS="DCIM Alerts",t.SERVICE_TICKETS="Service Tickets"})(NotificationGroups=NotificationGroups||{}),(t=>{t.Remote_Hands="Remote Hands",t.Deliveries="Deliveries",t.Removals="Removals",t.Facility_Access="Facility Access",t.Trouble_Ticket="Trouble Ticket",t.Customer_Care="Customer Care",t.FacilityAccessVisitorAccess="FacilityAccessVisitorAccess",t.FacilityAccessPermanentBadge="FacilityAccessPermanentBadge",t.FacilityAccessOspAccess="FacilityAccessOspAccess",t.FacilityAccessPopPoeAccess="FacilityAccessPopPoeAccess"})(SubGroups=SubGroups||{}),(t=>{t.LOADING="Loading",t.ERROR="Error",t.SUCCESS="Success"})(ApiCallState=ApiCallState||{});let DefaultDateFormat="yyyy-MM-dd",DefaultDateTimeFormat="yyyy-MM-dd HH:mm:ss",BASE_PATH="http://api.digitalrealty.com/notifications".replace(/\/+$/,"");class Configuration{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return null!=this.configuration.basePath?this.configuration.basePath:BASE_PATH}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||querystring}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){let t=this.configuration.apiKey;if(t)return"function"==typeof t?t:()=>t}get accessToken(){let t=this.configuration.accessToken;if(t)return"function"==typeof t?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}let DefaultConfig=new Configuration;class BaseAPI{constructor(t=DefaultConfig){this.configuration=t,this.fetchApi=async(t,e)=>{let i={url:t,init:e};for(var r of this.middleware)r.pre&&(i=await r.pre({fetch:this.fetchApi,...i})||i);let a=void 0;try{a=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(t){for(var o of this.middleware)o.onError&&(a=await o.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:t,response:a?a.clone():void 0})||a);if(void 0===a)throw t instanceof Error?new FetchError(t,"The request failed and the interceptors did not return an alternative response"):t}for(var n of this.middleware)n.post&&(a=await n.post({fetch:this.fetchApi,url:i.url,init:i.init,response:a.clone()})||a);return a},this.middleware=t.middleware}withMiddleware(...t){var e=this.clone();return e.middleware=e.middleware.concat(...t),e}withPreMiddleware(...t){t=t.map(t=>({pre:t}));return this.withMiddleware(...t)}withPostMiddleware(...t){t=t.map(t=>({post:t}));return this.withMiddleware(...t)}isJsonMime(t){return!!t&&BaseAPI.jsonRegex.test(t)}async request(t,e){var{url:t,init:e}=await this.createFetchParams(t,e),t=await this.fetchApi(t,e);if(t&&200<=t.status&&t.status<300)return t;throw new ResponseError(t,"Response returned an error code")}async createFetchParams(t,e){let i=this.configuration.basePath+t.path,r=(void 0!==t.query&&0!==Object.keys(t.query).length&&(i+="?"+this.configuration.queryParamsStringify(t.query)),Object.assign({},this.configuration.headers,t.headers));Object.keys(r).forEach(t=>void 0===r[t]?delete r[t]:{});var a="function"==typeof e?e:async()=>e,o={method:t.method,headers:r,body:t.body,credentials:this.configuration.credentials},a={...o,...await a({init:o,context:t})};let n;n=!(isFormData(a.body)||a.body instanceof URLSearchParams||isBlob(a.body))&&this.isJsonMime(r["Content-Type"])?JSON.stringify(a.body):a.body;o={...a,body:n};return{url:i,init:o}}clone(){var t=new this.constructor(this.configuration);return t.middleware=this.middleware.slice(),t}}function isBlob(t){return"undefined"!=typeof Blob&&t instanceof Blob}function isFormData(t){return"undefined"!=typeof FormData&&t instanceof FormData}BaseAPI.jsonRegex=new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$","i");class ResponseError extends Error{constructor(t,e){super(e),this.response=t,this.name="ResponseError"}}class FetchError extends Error{constructor(t,e){super(e),this.cause=t,this.name="FetchError"}}class RequiredError extends Error{constructor(t,e){super(e),this.field=t,this.name="RequiredError"}}let COLLECTION_FORMATS={csv:","};function exists(t,e){t=t[e];return null!=t}function querystring(e,i=""){return Object.keys(e).map(t=>querystringSingleKey(t,e[t],i)).filter(t=>0<t.length).join("&")}function querystringSingleKey(t,e,i=""){var r,a=i+(i.length?`[${t}]`:t);return e instanceof Array?(r=e.map(t=>encodeURIComponent(String(t))).join(`&${encodeURIComponent(a)}=`),encodeURIComponent(a)+"="+r):e instanceof Set?querystringSingleKey(t,Array.from(e),i):e instanceof Date?encodeURIComponent(a)+"="+encodeURIComponent(e.toISOString()):e instanceof Object?querystring(e,a):encodeURIComponent(a)+"="+encodeURIComponent(String(e))}class JSONApiResponse{constructor(t,e=t=>t){this.raw=t,this.transformer=e}async value(){return this.transformer(await this.raw.json())}}class VoidApiResponse{constructor(t){this.raw=t}async value(){}}function StatusFromJSON(t){return StatusFromJSONTyped(t)}function StatusFromJSONTyped(t,e){return t}function StatusToJSON(t){return t}function NotificationFromJSON(t){return NotificationFromJSONTyped(t)}function NotificationFromJSONTyped(t,e){return null==t?t:{id:exists(t,"id")?t.id:void 0,resourceType:exists(t,"resource_type")?t.resource_type:void 0,subGroup:exists(t,"sub_group")?t.sub_group:void 0,createdAt:exists(t,"created_at")?null===t.created_at?null:new Date(t.created_at):void 0,createdBy:exists(t,"created_by")?t.created_by:void 0,subject:exists(t,"subject")?t.subject:void 0,locations:exists(t,"locations")?t.locations:void 0,resourceId:exists(t,"resource_id")?t.resource_id:void 0,status:exists(t,"status")?StatusFromJSON(t.status):void 0,accountNumber:exists(t,"account_number")?t.account_number:void 0}}function GetNotifications200ResponseFromJSON(t){return GetNotifications200ResponseFromJSONTyped(t)}function GetNotifications200ResponseFromJSONTyped(t,e){return null==t?t:{self:exists(t,"self")?t.self:void 0,first:exists(t,"first")?t.first:void 0,prev:exists(t,"prev")?t.prev:void 0,next:exists(t,"next")?t.next:void 0,last:exists(t,"last")?t.last:void 0,items:t.items.map(NotificationFromJSON)}}function NotificationPatchFromJSON(t){return NotificationPatchFromJSONTyped(t)}function NotificationPatchFromJSONTyped(t,e){return null==t?t:{status:StatusFromJSON(t.status)}}function NotificationPatchToJSON(t){if(void 0!==t)return null===t?null:{status:StatusToJSON(t.status)}}function NotificationRequestToJSON(t){if(void 0!==t)return null===t?null:{resource_type:t.resourceType,sub_group:t.subGroup,recipients:t.recipients,account_number:t.accountNumber,locations:t.locations,resource_id:t.resourceId,subject:t.subject,created_at:void 0===t.createdAt?void 0:null===t.createdAt?null:t.createdAt.toISOString()}}class NotificationsApi extends BaseAPI{async createNotificationRaw(t,e){var i={"Content-Type":"application/json"},r=(this.configuration&&this.configuration.accessToken&&(r=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+r),await this.request({path:"/notifications",method:"POST",headers:i,query:{},body:NotificationRequestToJSON(t.notificationRequest)},e));return new JSONApiResponse(r,t=>NotificationFromJSON(t))}async createNotification(t={},e){return(await this.createNotificationRaw(t,e)).value()}async deleteNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling deleteNotificationsById.");var i={},r=(this.configuration&&this.configuration.accessToken&&(r=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+r),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"DELETE",headers:i,query:{}},e));return new VoidApiResponse(r)}async deleteNotificationsById(t,e){await this.deleteNotificationsByIdRaw(t,e)}async getNotificationsRaw(t,e){var i={},r=(void 0!==t.sort&&(i.sort=t.sort),void 0!==t.cursor&&(i.cursor=t.cursor),void 0!==t.resourceType&&(i.resource_type=t.resourceType),void 0!==t.accountNumber&&(i.account_number=t.accountNumber),void 0!==t.createdAfter&&(i.created_after=t.createdAfter.toISOString()),void 0!==t.createdBefore&&(i.created_before=t.createdBefore.toISOString()),void 0!==t.locationId&&(i.location_id=t.locationId),void 0!==t.subGroup&&(i.sub_group=t.subGroup),void 0!==t.status&&(i.status=t.status),{}),t=(t.prefer&&(r.Prefer=t.prefer.join(COLLECTION_FORMATS.csv)),this.configuration&&this.configuration.accessToken&&(t=await(0,this.configuration.accessToken)("bearerToken",[]))&&(r.Authorization="Bearer "+t),await this.request({path:"/notifications",method:"GET",headers:r,query:i},e));return new JSONApiResponse(t,t=>GetNotifications200ResponseFromJSON(t))}async getNotifications(t={},e){return(await this.getNotificationsRaw(t,e)).value()}async getNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling getNotificationsById.");var i={},r=(this.configuration&&this.configuration.accessToken&&(r=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+r),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:i,query:{}},e));return new JSONApiResponse(r,t=>NotificationFromJSON(t))}async getNotificationsById(t,e){return(await this.getNotificationsByIdRaw(t,e)).value()}async patchNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling patchNotificationsById.");var i={"Content-Type":"application/json"},r=(this.configuration&&this.configuration.accessToken&&(r=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+r),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"PATCH",headers:i,query:{},body:NotificationPatchToJSON(t.notificationPatch)},e));return new JSONApiResponse(r,t=>NotificationPatchFromJSON(t))}async patchNotificationsById(t,e){return(await this.patchNotificationsByIdRaw(t,e)).value()}}let APIEndpointPrefixes={Notifications:"notifications"};class ApiClient{constructor(t){this.noInit=!1,this.configuration=t}get notificationsApi(){return new NotificationsApi(new Configuration({basePath:this.configuration.NotificationApiUrl+"/"+APIEndpointPrefixes.Notifications,headers:{Authorization:this.getAuthorization()}}))}getAuthorization(){return this.configuration.getAuthorizationFn?this.configuration.getAuthorizationFn():""}}let isNullOrUndefinedOrEmpty=t=>null==t||""===t,mapResourceTypeToNotificationGroups=t=>{switch(t.toLowerCase()){case"planned maintenance":return NotificationGroups.PLANNED_MAINTENANCE;case"incidents":return NotificationGroups.INCIDENTS;case"dcim alerts":return NotificationGroups.DCIM_ALERTS;case"service tickets":return NotificationGroups.SERVICE_TICKETS;default:return NotificationGroups.PLANNED_MAINTENANCE}},mapStringToNotificationStatus=t=>{switch(t.toLowerCase()){case"unread":return NotificationStatus.UNREAD;case"read":return NotificationStatus.READ;default:return NotificationStatus.UNREAD}},mapParametersToNotificationRequest=t=>({sort:"-created_at",cursor:t,prefer:[""]}),mapParametersToPatchNotificationRequest=(t,e)=>({id:t,notificationPatch:{status:e}}),mapParametersToDeleteNotificationRequest=t=>({id:t}),mapNotificationDataToNotification=t=>{var e;return{subject:null!=(e=t.subject)?e:"",id:t.id,accountNumber:null!=(e=t.accountNumber)?e:"",resourceType:mapResourceTypeToNotificationGroups(null!=(e=t.resourceType)?e:""),subGroup:null!=(e=t.subGroup)?e:"",resourceId:null!=(e=t.resourceId)?e:"",status:mapStringToNotificationStatus(null!=(e=t.status)?e:""),createdAt:isNullOrUndefinedOrEmpty(t.createdAt)?format(new Date,DefaultDateTimeFormat):format(t.createdAt,DefaultDateTimeFormat),createdBy:null!=(e=t.createdBy)?e:"",locations:null!=(e=t.locations)?e:[]}},mapNotificationResponseToNotifications=t=>t.map(t=>mapNotificationDataToNotification(t)),getNextPageCursorfromQueryParam=t=>{t=new URLSearchParams(t),t=t.has("cursor")?t.get("cursor"):"";return null!==t?t:""},handleError=async(e,t=!0)=>{if(e instanceof ResponseError&&400===e.response.status)try{var i=(await e.response.json()).detail;t&&console.error(i)}catch(t){console.error(e)}else console.error(e)},getLocalStorageUser=t=>{t=localStorage.getItem(t);return t?JSON.parse(t):null},getUserAuthorization=t=>"Bearer "+(null==(t=getLocalStorageUser(t))?void 0:t.access_token);class NotificationState{constructor(){this.showDrawer=!1,this.apiClient={noInit:!0},this.baseApiUrl="",this.localStorageKey="",this.NewApiClient=()=>{this.apiClient=new ApiClient({NotificationApiUrl:this.baseApiUrl,getAuthorizationFn:()=>getUserAuthorization(this.localStorageKey)}),this.getNotifications()},this.nextPageCursor="",this.notifications=[],this.unreadNotificationCount=0,this.notificationFilters={SHOW_PLANNED_MAINTENANCE:!0,SHOW_SERVICE_TICKETS:!0,SHOW_DCIM_ALERTS:!0},this.selectedNotification={id:"",resourceType:NotificationGroups.PLANNED_MAINTENANCE,subGroup:"",subject:"",resourceId:"",locations:[],createdAt:"",accountNumber:"",createdBy:"",status:NotificationStatus.READ},this.dateFilters={FROM_DATE:subDays(new Date),TO_DATE:new Date},makeAutoObservable(this),makePersistable(this,{name:"notification-state",properties:["notificationFilters","nextPageCursor"],storage:window.localStorage})}get isHydrated(){return isHydrated(this)}async hydrateStore(){await hydrateStore(this)}async clearStoredData(){await clearPersistedStore(this)}async getStoredData(){return getPersistedStore(this)}ConstructApiClient(){return this.apiClient.noInit?this.NewApiClient():this.apiClient}async clearStoredNotificationsData(){this.notifications=[],this.unreadNotificationCount=0,this.nextPageCursor="",this.apiClient={noInit:!0}}async setNotificationReadStatus(e){var t,i=await this.setNotificationAsRead(e.toString());return!0===await i&&(this.ReduceUnreadNotificationCount(),t=this.notifications.findIndex(t=>t.id===e),this.notifications[t].status=NotificationStatus.READ,this.selectedNotification=this.notifications[t]),i}async setNotificationDeleted(e){var t,i=await this.DeleteNotification(e.toString());return!0===i&&("unread"===(null==(t=this.notifications.find(t=>t.id===e))?void 0:t.status)&&this.ReduceUnreadNotificationCount(),t=this.notifications.findIndex(t=>t.id===e),this.notifications.splice(t,1)),{State:!0===i?ApiCallState.SUCCESS:ApiCallState.ERROR,Message:!0===i?"Successfully deleted the notification":"Error while deleting the notification"}}setNotificationDateFilter(t,e){this.dateFilters.FROM_DATE=void 0!==t?parse(t,DefaultDateFormat,new Date):void 0,this.dateFilters.TO_DATE=void 0!==e?parse(e,DefaultDateFormat,new Date):void 0}setNotificationFilter(t,e){switch(t){case NotificationGroups.PLANNED_MAINTENANCE:this.notificationFilters.SHOW_PLANNED_MAINTENANCE=e;break;case NotificationGroups.SERVICE_TICKETS:this.notificationFilters.SHOW_SERVICE_TICKETS=e;break;case NotificationGroups.DCIM_ALERTS:this.notificationFilters.SHOW_DCIM_ALERTS=e}}async getNotifications(){var t,e;void 0!==this.nextPageCursor&&(e=await(null==(e=this.apiClient)?void 0:e.notificationsApi.getNotificationsRaw(mapParametersToNotificationRequest(getNextPageCursorfromQueryParam(this.nextPageCursor))).catch(t=>{handleError(t,!1)})))&&(t=await(null==e?void 0:e.value()),this.notifications=""===this.nextPageCursor?mapNotificationResponseToNotifications(null==t?void 0:t.items):this.notifications.concat(mapNotificationResponseToNotifications(null==t?void 0:t.items)),this.nextPageCursor=void 0===(null==t?void 0:t.next)||null==t?void 0:t.next,this.unreadNotificationCount=null!==e.raw.headers.get("x-total-unread-count")&&void 0!==e.raw.headers.get("x-total-unread-count")?e.raw.headers.get("x-total-unread-count"):0)}async getNotificationsById(t){let e,i;(i=t?await(null==(e=this.apiClient)?void 0:e.notificationsApi.getNotificationsById({id:t}).catch(t=>{handleError(t,!1)})):i)&&(this.selectedNotification=mapNotificationDataToNotification(i))}async setNotificationAsRead(t){var e;return!!t&&(await(null==(e=this.apiClient)?void 0:e.notificationsApi.patchNotificationsById(mapParametersToPatchNotificationRequest(t,"read")).catch(t=>(handleError(t,!1),!1))),!0)}async DeleteNotification(t){let e,i=!1;return t&&await(null==(e=this.apiClient)?void 0:e.notificationsApi.deleteNotificationsById(mapParametersToDeleteNotificationRequest(t)).catch(t=>{handleError(t,!1),i=!1}).then(()=>{i=!0})),i}ReduceUnreadNotificationCount(){0<this.unreadNotificationCount&&--this.unreadNotificationCount}}let NotificationsState=new NotificationState,NotificationsStyle=css`:host{--ix-drawer-border-radius:0;--ix-drawer-padding:0;--ix-drawer-width-sm:320px;--ix-drawer-width-md:320px;--ix-drawer-width-lg:400px}.destructive-icon{color:var(--clr-critical,#db0028);--md-icon-button-icon-color:var(--clr-critical, #DB0028);--md-sys-color-on-surface-variant:var(--clr-critical, #DB0028)}.destructive-icon path{fill:var(--clr-critical,#db0028)}.active-icon{color:var(--clr-primary,#1456e0);--md-icon-button-icon-color:var(--clr-primary, #1456E0);--md-sys-color-on-surface-variant:var(--clr-primary, #1456E0)}.active-icon path{fill:var(--clr-primary,#1456e0)}.inactive-icon{color:var(--clr-on-surface,#092241);--md-icon-button-icon-color:var(--clr-on-surface, #092241);--md-sys-color-on-surface-variant:var(--clr-on-surface, #092241);cursor:default;opacity:.6}.inactive-icon path{fill:var(--clr-on-surface,#092241);opacity:.6}ix-icon-button.sharp{--md-icon-font:'Material Symbols Sharp'!important}.ix-icon-groups{--ix-icon-font-size:32px;--ix-icon-line-height:32px}.ix-icon-groups ix-icon{color:var(--clr-on-surface,#092241);opacity:.6}.ix-icon-groups ix-icon path{fill:var(--clr-on-surface,#092241)}.datefilter-dropdown-content,.filter-dropdown-content{position:absolute;right:5%;top:3rem;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);z-index:3;transition:box-shadow .3s cubic-bezier(.4,0,.2,1) 0s;border-radius:3px;box-shadow:rgba(0,0,0,.2) 0 5px 5px -3px,rgba(0,0,0,.14) 0 8px 10px 1px,rgba(0,0,0,.12) 0 3px 14px 2px;background-color:var(--clr-surface-container-lowest,#fff)}.unread{font-family:var(--root-primary-font, 'sans-serif');padding:0 5px;font-size:var(--text-caption-size,.75rem);line-height:var(--text-caption-line-height,1.33333333em);left:22px;top:0;background:var(--clr-critical,#db0028);letter-spacing:var(--text-caption-letter-spacing,.03333333em)}.notification-tooltip{background-color:var(--cp-neutral-blue-4,#040d19);white-space:nowrap;font-size:var(--text-caption-size,.75rem);z-index:9999;color:var(--clr-on-secondary,#fff)}.notification-modal-subtitle,.notification-modal-title{color:var(--clr-on-surface,#092241);font-family:var(--root-secondary-font, 'sans-serif')}.notification-modal-subtitle{font-size:var(--text-heading-size,1.25rem);line-height:var(--text-heading-line-height,1.2em)}.notification-modal-content{display:inline-grid;grid-template-columns:fit-content(183px) 1fr;grid-template-rows:auto auto;grid-column-gap:24px;grid-row-gap:8px;font-family:var(--root-primary-font, 'sans-serif');font-size:var(--text-default-size,16px);line-height:28px;width:560px;padding-bottom:16px;color:var(--clr-on-surface,#092241)}.notification-modal-content-title{width:183px;color:var(--clr-on-surface-variant,#092241B3)}.notification-modal-subject-title{grid-area:1/1/2/2}.notification-modal-subject-text{grid-area:1/2/2/3}.notification-modal-created-date-title{grid-area:2/1/3/2}.notification-modal-created-date-text{grid-area:2/2/3/3}.notification-modal-site-title{grid-area:3/1/4/2}.notification-modal-site-text{grid-area:3/2/4/3}`,ConfirmationDialog=class extends MobxLitElement{constructor(){super(...arguments),this.textMessage="Are you sure?",this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("confirm-dialog-closed")),this.onClick(!1)}}static get styles(){return[TWStyles,NotificationsStyle]}onClick(t){t=new CustomEvent("on-confirm-selection",{detail:{returnValue:t},bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return html`<ix-dialog ?open="${this.open}" class="w-[580px]" @closed="${this.dialogClosed}"><div slot="headline">${this.textMessage}</div><div slot="actions"><div class="flex flex-row justify-end p-1"><ix-button name="cancel" appearance="text" @click="${()=>this.onClick(!1)}">DISMISS</ix-button><ix-button name="confirm" appearance="text" @click="${()=>this.onClick(!0)}">YES</ix-button></div></div></ix-dialog>`}},ViewItemDialog=(__decorate([property({type:String,attribute:!0})],ConfirmationDialog.prototype,"textMessage",void 0),__decorate([property({type:Boolean,attribute:!0})],ConfirmationDialog.prototype,"open",void 0),ConfirmationDialog=__decorate([customElement("confirmation-dialog")],ConfirmationDialog),class extends MobxLitElement{constructor(){super(...arguments),this.notification={},this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("view-item-dialog-closed"))},this.viewRecord=()=>{this.dialogClosed(),NotificationsState.showDrawer=!1}}static get styles(){return[TWStyles,NotificationsStyle]}getUrl(){var t=this.notification.resourceId;switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return"/service-management/reports?ticketId="+t;case NotificationGroups.SERVICE_TICKETS:switch(this.notification.subGroup){case SubGroups.Remote_Hands:return"/service-management/service-tickets/remote-hands/"+t;case SubGroups.Customer_Care:return"/service-management/service-tickets/customer-care/"+t;case SubGroups.Deliveries:return`/service-management/service-tickets/${SubGroups.Deliveries}/`+t;case SubGroups.Facility_Access:return"/service-management/service-tickets/facility-access/"+t;case SubGroups.Removals:return"/service-management/service-tickets/removals/"+t;case SubGroups.Trouble_Ticket:return"/service-management/service-tickets/trouble-tickets/"+t;case SubGroups.FacilityAccessVisitorAccess:return"/service-management/service-tickets/facility-access/visitor-access/"+t;case SubGroups.FacilityAccessPermanentBadge:return"/service-management/service-tickets/facility-access/permanent-badge/"+t;case SubGroups.FacilityAccessOspAccess:return"/service-management/service-tickets/facility-access/osp-access/"+t;case SubGroups.FacilityAccessPopPoeAccess:return"/service-management/service-tickets/facility-access/pop-poe-access/"+t;default:return""}case NotificationGroups.INCIDENTS:return"/service-management/reports?ticketId="+t;case NotificationGroups.DCIM_ALERTS:return"/dcim/"+t;default:return""}}getLocation(){return void 0===this.notification.locations||this.notification.locations.length<1?"":1<this.notification.locations.length?"Multiple Sites":this.notification.locations[0]}getSubGroupDisplayName(){switch(this.notification.subGroup){case SubGroups.FacilityAccessVisitorAccess:case SubGroups.FacilityAccessPermanentBadge:case SubGroups.FacilityAccessOspAccess:case SubGroups.FacilityAccessPopPoeAccess:return"Facility Access";case"Incidents (GSN)":return"Incidents";case"Emergency Repairs (InSite 1.0)":return"Emergency Repairs";default:return this.notification.subGroup}}render(){return html`<ix-dialog ?open="${this.open}" @closed="${this.dialogClosed}" class="notification-modal" data-testclass="notification-modal"><div slot="headline" class="w-[560px]"><div class="flex flex-col flex-start"><div class="notification-modal-title text-2xl font-bold text-balance">${this.notification.resourceType}</div><div class="notification-modal-subtitle pt-4 pb-0 font-bold text-balance">${this.getSubGroupDisplayName()}</div></div></div><form class="notification-modal-content" slot="content" id="form-id" method="dialog"><div class="notification-modal-content-title notification-modal-subject-title">Subject</div><div class="notification-modal-subject-text font-normal text-wrap">${this.notification.subject}</div><div class="notification-modal-content-title notification-modal-created-date-title">Create Date</div><div class="notification-modal-created-date-text font-normal text-wrap">${format(new Date(this.notification.createdAt),"dd/MM/yyyy HH:mm:ss")}</div><div class="notification-modal-content-title notification-modal-site-title">Site</div><div class="notification-modal-site-text font-normal text-wrap">${this.getLocation()}</div></form><div slot="actions" class="flex flex-row flex-end"><ix-button data-testclass="close-item-modal" form="form-id" appearance="text">Close</ix-button><ix-button data-testclass="view-record" href="${this.getUrl()}" @click="${this.viewRecord}" appearance="text">View Record</ix-button></div></ix-dialog>`}}),NotificationItem=(__decorate([property({type:Object,attribute:!1})],ViewItemDialog.prototype,"notification",void 0),__decorate([property({type:Boolean,attribute:!0})],ViewItemDialog.prototype,"open",void 0),ViewItemDialog=__decorate([customElement("view-item-dialog")],ViewItemDialog),class extends MobxLitElement{constructor(){super(...arguments),this.disabled=!1,this.read=!1,this.notification={},this.showModal=!1,this.showDeleteConfirmation=!1}static get styles(){return[TWStyles,NotificationsStyle]}displayItem(){this.notification.status===NotificationStatus.UNREAD&&(NotificationsState.setNotificationReadStatus(this.notification.id),this.read=!0),this.showModal=!0}deleteItem(){this.disabled||(this.showDeleteConfirmation=!0)}confirmedDelete(t){t.detail.returnValue&&NotificationsState.setNotificationDeleted(this.notification.id).then(t=>{this.showDeleteResultMessage(t,this.notification.id)}),this.showDeleteConfirmation=!1}showDeleteResultMessage(t,e){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:e,content:html`<ix-message-toast data-testid="notification-delete-toast" toastId="${e}" .TMessageToast="${t.State.toLowerCase()}" forceClose>${t.Message}</ix-message-toast>`,autoClose:2e3,durationOut:2e3,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))}calculateDuration(){return void 0!==this.notification.createdAt?differenceInHours(new Date,new Date(this.notification.createdAt))<24?formatDistance(new Date(this.notification.createdAt),new Date,{addSuffix:!0}):html`<ix-date type="static" variant="date-time" .value="${this.notification.createdAt}"></ix-date>`:"N/A"}getNotificationIcon(){switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return plannedMaintenance;case NotificationGroups.SERVICE_TICKETS:return"sync_saved_locally";case NotificationGroups.INCIDENTS:return"report";case NotificationGroups.DCIM_ALERTS:return dcim;default:return"sync_saved_locally"}}getNotificationTitle(){switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return"Planned Maintenance";case NotificationGroups.SERVICE_TICKETS:return this.getServiceTicketSubGroup()+" Service Ticket Update";case NotificationGroups.INCIDENTS:return"Emergency Repair";case NotificationGroups.DCIM_ALERTS:return"DCIM Alert";default:return"sync_saved_locally"}}getServiceTicketSubGroup(){var t,e;switch(null==(t=this.notification)?void 0:t.subGroup){case SubGroups.FacilityAccessVisitorAccess:case SubGroups.FacilityAccessPermanentBadge:case SubGroups.FacilityAccessOspAccess:case SubGroups.FacilityAccessPopPoeAccess:return"Facility Access";default:return null==(e=this.notification)?void 0:e.subGroup}}render(){return html`<div data-testid="notification-item" class="relative notification-item"><div class="hover:bg-[rgba(0,0,0,0.04)] p-2 pl-3.5 flex gap-3 relative cursor-pointer items-center font-bold ${this.read?"notification-item-read border-l-3 border-transparent":"notification-item-unread border-l-3 border-success"}"><ix-icon style="--ix-icon-font-size:24px;--ix-icon-line-height:24px" icon="${this.getNotificationIcon()}" class="${this.read?"inactive-icon":"active-icon"}" @click="${this.displayItem}">${this.getNotificationIcon()}</ix-icon><div class="flex flex-col grow" @click="${this.displayItem}"><div class="grow text-base"><h2 class="dlr-text-caption">${this.getNotificationTitle()}</h2></div><div class="grow text-xs"><h3 class="dlr-text-caption text-on-surface-disabled">${this.calculateDuration()}</h3></div></div><div><view-item-dialog ?open="${this.showModal}" .notification="${this.notification}" @view-item-dialog-closed="${()=>{this.showModal=!1}}"></view-item-dialog><confirmation-dialog ?open="${this.showDeleteConfirmation}" @on-confirm-selection="${this.confirmedDelete}" @confirm-dialog-closed="${()=>{this.showModal=!1}}" textMessage="Are you sure you want to delete this notification?" data-testclass="notification-delete-confirmation"></confirmation-dialog></div><ix-icon-button style="--md-icon-button-icon-size:24px" data-testclass="delete-notification" @click="${this.deleteItem}" @mouseover="${t=>{this.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:this.disabled?"Emergency Repair Notification cannot be removed":"Remove Notification",target:t.target}}))}}" @mouseout="${()=>this.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" ?disabled="${this.disabled}"><ix-icon slot="default" class="${this.disabled?"inactive-icon":"destructive-icon"}">${trash}</ix-icon></ix-icon-button></div></div>`}}),GroupedItem=(__decorate([property({type:Boolean})],NotificationItem.prototype,"disabled",void 0),__decorate([property({type:Boolean})],NotificationItem.prototype,"read",void 0),__decorate([property({type:Object,attribute:!1})],NotificationItem.prototype,"notification",void 0),__decorate([state()],NotificationItem.prototype,"showModal",void 0),__decorate([state()],NotificationItem.prototype,"showDeleteConfirmation",void 0),NotificationItem=__decorate([customElement("notification-item")],NotificationItem),class extends MobxLitElement{constructor(){super(...arguments),this.groupTitle="Group 1",this.groupIcon="public",this.childItems=NotificationsState.notifications,this.isOpen=!1,this.onClick=()=>{this.isOpen=!this.isOpen}}static get styles(){return[TWStyles,NotificationsStyle]}renderNotificationItems(){var t;return this.isOpen?void 0!==(null==(t=this.childItems)?void 0:t.length)&&0<(null==(t=this.childItems)?void 0:t.length)?html`<div>${null==(t=this.childItems)?void 0:t.map(t=>html`<notification-item .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:html`<p class="dlr-text-caption ml-14 font-bold mr-4">No notifications yet.</p>`:html`${nothing}`}render(){var t;return html`<div class="group-container-row border-b border-outline py-3"><div class="flex items-center justify-between"><div class="flex items-center align-middle"><ix-icon-button icon="${this.isOpen?"arrow_drop_down":"arrow_right"}" @click="${this.onClick}" data-testclass="grouped-item-toggle-expand"></ix-icon-button><ix-icon slot="default" class="ix-icon-groups">${unsafeSVG(this.groupIcon)}</ix-icon><p class="m-0 group-name font-bold pl-1">${this.groupTitle}</p><p class="m-0 pl-4">${null==(t=this.childItems)?void 0:t.length.toString().padStart(2,"0")}</p></div></div>${this.renderNotificationItems()}</div>`}}),GroupFilters=(__decorate([property({type:String,attribute:!0})],GroupedItem.prototype,"groupTitle",void 0),__decorate([property({type:String,attribute:!0})],GroupedItem.prototype,"groupIcon",void 0),__decorate([property({type:Array,attribute:!0})],GroupedItem.prototype,"childItems",void 0),__decorate([state()],GroupedItem.prototype,"isOpen",void 0),GroupedItem=__decorate([customElement("grouped-item")],GroupedItem),class extends MobxLitElement{static get styles(){return[TWStyles,NotificationsStyle]}onSwitchChange(t){var t=t.target,e=null==(e=t.attributes.getNamedItem("name"))?void 0:e.value;NotificationsState.setNotificationFilter(e,t.selected),this.requestUpdate()}render(){return html`<div class="flex flex-col"><label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch data-testid="planned-maintenance-switch" class="flex" name="${NotificationGroups.PLANNED_MAINTENANCE}" selected="${NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE}" @change="${this.onSwitchChange}"></ix-switch><span>Planned Maintenance</span></label> <label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch data-testid="service-tickets-switch" class="flex" name="${NotificationGroups.SERVICE_TICKETS}" selected="${NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS}" @change="${this.onSwitchChange}"></ix-switch><span>Service Ticket Updates</span></label> <label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch data-testid="dcim-alerts-switch" class="flex" name="${NotificationGroups.DCIM_ALERTS}" selected="${NotificationsState.notificationFilters.SHOW_DCIM_ALERTS}" @change="${this.onSwitchChange}"></ix-switch><span>${NotificationGroups.DCIM_ALERTS}</span></label></div>`}}),DateFilters=(GroupFilters=__decorate([customElement("group-filters")],GroupFilters),class extends MobxLitElement{constructor(){super(...arguments),this.fromDate=isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.FROM_DATE)?void 0:format(NotificationsState.dateFilters.FROM_DATE,DefaultDateFormat),this.toDate=isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.TO_DATE)?void 0:format(NotificationsState.dateFilters.TO_DATE,DefaultDateFormat),this.maxDate=format(new Date,DefaultDateFormat),this.fromDateErrorText="",this.toDateErrorText=""}static get styles(){return[TWStyles,NotificationsStyle]}onFromDateChange(t){null===t||""===t?this.fromDate=void 0:(this.fromDate=t,void 0!==this.fromDate&&(this.fromDateErrorText=void 0))}onToDateChange(t){null===t||""===t?this.toDate=void 0:(this.toDate=t,void 0!==this.toDate&&(this.toDateErrorText=void 0))}onApplyDateFilter(t){if(t){if(void 0===this.toDate&&void 0!==this.fromDate)return void(this.toDateErrorText="Please select to date");if(void 0===this.fromDate&&void 0!==this.toDate)return void(this.fromDateErrorText="Please select from date");if(this.fromDate>this.toDate)return this.fromDateErrorText="From date cannot be later than To date.",void(this.fromDate=void 0);if(this.fromDateErrorText=void 0,this.toDate<this.fromDate)return this.toDateErrorText="To date cannot be earlier than From date.",void(this.toDate=void 0);this.toDateErrorText=void 0}t=t&&void 0===this.toDateErrorText&&void 0===this.fromDateErrorText,t&&(NotificationsState.setNotificationDateFilter(this.fromDate,this.toDate),this.requestUpdate()),t=new CustomEvent("on-selection",{detail:{returnValue:t},bubbles:!0,composed:!0});this.dispatchEvent(t)}clearDateFilters(){this.fromDate=void 0,this.toDate=void 0,this.fromDateErrorText=void 0,this.toDateErrorText=void 0}render(){return html`<div class="flex flex-col p-4"><div class="flex flex-row items-center"><div class="grow items-center text-xl font-bold">Filter by Date</div><div class="flex flex-row items-center" @click="${this.clearDateFilters}"><label class="grow text-sm text-right pr-1 cursor-pointer">Clear Filter</label><ix-icon-button data-testid="notifications-clear-date-filter" small appearance="default" icon="domain_verification_off" class="active-icon"></ix-icon-button></div></div><ix-divider class="my-2"></ix-divider><div class="flex xl:flex-row lg:flex-col md:flex-col sm:flex-col justify-between item-center my-4"><div class="flex gap-2"><ix-date data-testid="notifications-from-date" .value="${this.fromDate}" max="${this.maxDate}" label="From" name="FromDate" .errorText="${this.fromDateErrorText}" .onChanged="${t=>this.onFromDateChange(t)}"></ix-date><ix-date data-testid="notifications-to-date" .value="${this.toDate}" max="${this.maxDate}" label="To" name="ToDate" .errorText="${this.toDateErrorText}" .onChanged="${t=>this.onToDateChange(t)}"></ix-date></div></div><div class="flex flex-row justify-between"><ix-button data-testid="notifications-cancel-date-filter" type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!1)}">Cancel</ix-button><ix-button data-testid="notifications-activate-date-filter" type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!0)}">Filter List</ix-button></div></div>`}}),min=(__decorate([state()],DateFilters.prototype,"fromDate",void 0),__decorate([state()],DateFilters.prototype,"toDate",void 0),__decorate([state()],DateFilters.prototype,"maxDate",void 0),__decorate([state()],DateFilters.prototype,"fromDateErrorText",void 0),__decorate([state()],DateFilters.prototype,"toDateErrorText",void 0),DateFilters=__decorate([customElement("date-filters")],DateFilters),Math.min),max=Math.max,round=Math.round,createCoords=t=>({x:t,y:t});function getSide(t){return t.split("-")[0]}function getAlignment(t){return t.split("-")[1]}function getOppositeAxis(t){return"x"===t?"y":"x"}function getAxisLength(t){return"y"===t?"height":"width"}let yAxisSides=new Set(["top","bottom"]);function getSideAxis(t){return yAxisSides.has(getSide(t))?"y":"x"}function getAlignmentAxis(t){return getOppositeAxis(getSideAxis(t))}function rectToClientRect(t){var{x:t,y:e,width:i,height:r}=t;return{width:i,height:r,top:e,left:t,right:t+i,bottom:e+r,x:t,y:e}}function computeCoordsFromPlacement(t,e,i){var{reference:r,floating:a}=t,t=getSideAxis(e),o=getAlignmentAxis(e),n=getAxisLength(o),s=getSide(e),c="y"===t,l=r.x+r.width/2-a.width/2,d=r.y+r.height/2-a.height/2,u=r[n]/2-a[n]/2;let f;switch(s){case"top":f={x:l,y:r.y-a.height};break;case"bottom":f={x:l,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-a.width,y:d};break;default:f={x:r.x,y:r.y}}switch(getAlignment(e)){case"start":f[o]-=u*(i&&c?-1:1);break;case"end":f[o]+=u*(i&&c?-1:1)}return f}let computePosition$1=async(e,i,t)=>{var{placement:r="bottom",strategy:a="absolute",middleware:t=[],platform:o}=t,n=t.filter(Boolean),s=await(null==o.isRTL?void 0:o.isRTL(i));let c=await o.getElementRects({reference:e,floating:i,strategy:a}),{x:l,y:d}=computeCoordsFromPlacement(c,r,s),u=r,f={},h=0;for(let t=0;t<n.length;t++){var{name:m,fn:p}=n[t],{x:p,y:g,data:w,reset:y}=await p({x:l,y:d,initialPlacement:r,placement:u,strategy:a,middlewareData:f,rects:c,platform:o,elements:{reference:e,floating:i}});l=null!=p?p:l,d=null!=g?g:d,f={...f,[m]:{...f[m],...w}},y&&h<=50&&(h++,"object"==typeof y&&(y.placement&&(u=y.placement),y.rects&&(c=!0===y.rects?await o.getElementRects({reference:e,floating:i,strategy:a}):y.rects),{x:l,y:d}=computeCoordsFromPlacement(c,u,s)),t=-1)}return{x:l,y:d,placement:u,strategy:a,middlewareData:f}};function hasWindow(){return"undefined"!=typeof window}function getNodeName(t){return isNode(t)?(t.nodeName||"").toLowerCase():"#document"}function getWindow(t){return(null==t||null==(t=t.ownerDocument)?void 0:t.defaultView)||window}function getDocumentElement(t){return null==(t=(isNode(t)?t.ownerDocument:t.document)||window.document)?void 0:t.documentElement}function isNode(t){return!!hasWindow()&&(t instanceof Node||t instanceof getWindow(t).Node)}function isElement(t){return!!hasWindow()&&(t instanceof Element||t instanceof getWindow(t).Element)}function isHTMLElement(t){return!!hasWindow()&&(t instanceof HTMLElement||t instanceof getWindow(t).HTMLElement)}function isShadowRoot(t){return!(!hasWindow()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof getWindow(t).ShadowRoot)}let invalidOverflowDisplayValues=new Set(["inline","contents"]);function isOverflowElement(t){var{overflow:t,overflowX:e,overflowY:i,display:r}=getComputedStyle(t);return/auto|scroll|overlay|hidden|clip/.test(t+i+e)&&!invalidOverflowDisplayValues.has(r)}let tableElements=new Set(["table","td","th"]);function isTableElement(t){return tableElements.has(getNodeName(t))}let topLayerSelectors=[":popover-open",":modal"];function isTopLayer(e){return topLayerSelectors.some(t=>{try{return e.matches(t)}catch(t){return!1}})}let transformProperties=["transform","translate","scale","rotate","perspective"],willChangeValues=["transform","translate","scale","rotate","perspective","filter"],containValues=["paint","layout","strict","content"];function isContainingBlock(t){var e=isWebKit();let i=isElement(t)?getComputedStyle(t):t;return transformProperties.some(t=>!!i[t]&&"none"!==i[t])||!!i.containerType&&"normal"!==i.containerType||!e&&!!i.backdropFilter&&"none"!==i.backdropFilter||!e&&!!i.filter&&"none"!==i.filter||willChangeValues.some(t=>(i.willChange||"").includes(t))||containValues.some(t=>(i.contain||"").includes(t))}function getContainingBlock(t){let e=getParentNode(t);for(;isHTMLElement(e)&&!isLastTraversableNode(e);){if(isContainingBlock(e))return e;if(isTopLayer(e))return null;e=getParentNode(e)}return null}function isWebKit(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}let lastTraversableNodeNames=new Set(["html","body","#document"]);function isLastTraversableNode(t){return lastTraversableNodeNames.has(getNodeName(t))}function getComputedStyle(t){return getWindow(t).getComputedStyle(t)}function getNodeScroll(t){return isElement(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function getParentNode(t){return"html"!==getNodeName(t)&&(t=t.assignedSlot||t.parentNode||isShadowRoot(t)&&t.host||getDocumentElement(t),isShadowRoot(t))?t.host:t}function getNearestOverflowAncestor(t){var e=getParentNode(t);return isLastTraversableNode(e)?(t.ownerDocument||t).body:isHTMLElement(e)&&isOverflowElement(e)?e:getNearestOverflowAncestor(e)}function getOverflowAncestors(t,e,i){void 0===e&&(e=[]);var r=getNearestOverflowAncestor(t),t=r===(null==(t=t.ownerDocument)?void 0:t.body),a=getWindow(r);return t?(getFrameElement(a),e.concat(a,a.visualViewport||[],isOverflowElement(r)?r:[],[])):e.concat(r,getOverflowAncestors(r,[]))}function getFrameElement(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function getCssDimensions(t){var e=getComputedStyle(t);let i=parseFloat(e.width)||0,r=parseFloat(e.height)||0;var e=isHTMLElement(t),a=e?t.offsetWidth:i,e=e?t.offsetHeight:r,t=round(i)!==a||round(r)!==e;return t&&(i=a,r=e),{width:i,height:r,$:t}}function unwrapElement(t){return isElement(t)?t:t.contextElement}function getScale(t){t=unwrapElement(t);if(!isHTMLElement(t))return createCoords(1);var e=t.getBoundingClientRect(),{width:t,height:i,$:r}=getCssDimensions(t);let a=(r?round(e.width):e.width)/t,o=(r?round(e.height):e.height)/i;return a&&Number.isFinite(a)||(a=1),o&&Number.isFinite(o)||(o=1),{x:a,y:o}}let noOffsets=createCoords(0);function getVisualOffsets(t){t=getWindow(t);return isWebKit()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:noOffsets}function shouldAddVisualOffsets(t,e,i){return void 0===e&&(e=!1),!(!i||e&&i!==getWindow(t))&&e}function getBoundingClientRect(i,t,e,r){void 0===t&&(t=!1),void 0===e&&(e=!1);var a=i.getBoundingClientRect(),o=unwrapElement(i);let n=createCoords(1);t&&(r?isElement(r)&&(n=getScale(r)):n=getScale(i));t=shouldAddVisualOffsets(o,e,r)?getVisualOffsets(o):createCoords(0);let s=(a.left+t.x)/n.x,c=(a.top+t.y)/n.y,l=a.width/n.x,d=a.height/n.y;if(o){var i=getWindow(o),u=r&&isElement(r)?getWindow(r):r;let t=i,e=getFrameElement(t);for(;e&&r&&u!==t;){var f=getScale(e),h=e.getBoundingClientRect(),m=getComputedStyle(e),p=h.left+(e.clientLeft+parseFloat(m.paddingLeft))*f.x,h=h.top+(e.clientTop+parseFloat(m.paddingTop))*f.y;s*=f.x,c*=f.y,l*=f.x,d*=f.y,s+=p,c+=h,t=getWindow(e),e=getFrameElement(t)}}return rectToClientRect({width:l,height:d,x:s,y:c})}function getWindowScrollBarX(t,e){var i=getNodeScroll(t).scrollLeft;return e?e.left+i:getBoundingClientRect(getDocumentElement(t)).left+i}function getHTMLOffset(t,e,i){void 0===i&&(i=!1);var r=t.getBoundingClientRect();return{x:r.left+e.scrollLeft-(i?0:getWindowScrollBarX(t,r)),y:r.top+e.scrollTop}}function convertOffsetParentRelativeRectToViewportRelativeRect(t){var{elements:t,rect:e,offsetParent:i,strategy:r}=t,r="fixed"===r,a=getDocumentElement(i),t=!!t&&isTopLayer(t.floating);if(i===a||t&&r)return e;let o={scrollLeft:0,scrollTop:0},n=createCoords(1);var t=createCoords(0),s=isHTMLElement(i),c=((s||!s&&!r)&&("body"===getNodeName(i)&&!isOverflowElement(a)||(o=getNodeScroll(i)),isHTMLElement(i))&&(c=getBoundingClientRect(i),n=getScale(i),t.x=c.x+i.clientLeft,t.y=c.y+i.clientTop),!a||s||r?createCoords(0):getHTMLOffset(a,o,!0));return{width:e.width*n.x,height:e.height*n.y,x:e.x*n.x-o.scrollLeft*n.x+t.x+c.x,y:e.y*n.y-o.scrollTop*n.y+t.y+c.y}}function getClientRects(t){return Array.from(t.getClientRects())}function getDocumentRect(t){var e=getDocumentElement(t),i=getNodeScroll(t),r=t.ownerDocument.body,a=max(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=max(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let n=-i.scrollLeft+getWindowScrollBarX(t);t=-i.scrollTop;return"rtl"===getComputedStyle(r).direction&&(n+=max(e.clientWidth,r.clientWidth)-a),{width:a,height:o,x:n,y:t}}function getViewportRect(t,e){var i=getWindow(t),t=getDocumentElement(t),i=i.visualViewport;let r=t.clientWidth,a=t.clientHeight,o=0,n=0;return i&&(r=i.width,a=i.height,isWebKit()&&"fixed"!==e||(o=i.offsetLeft,n=i.offsetTop)),{width:r,height:a,x:o,y:n}}let absoluteOrFixed=new Set(["absolute","fixed"]);function getInnerBoundingClientRect(t,e){var e=getBoundingClientRect(t,!0,"fixed"===e),i=e.top+t.clientTop,e=e.left+t.clientLeft,r=isHTMLElement(t)?getScale(t):createCoords(1);return{width:t.clientWidth*r.x,height:t.clientHeight*r.y,x:e*r.x,y:i*r.y}}function getClientRectFromClippingAncestor(t,e,i){let r;return rectToClientRect(r="viewport"===e?getViewportRect(t,i):"document"===e?getDocumentRect(getDocumentElement(t)):isElement(e)?getInnerBoundingClientRect(e,i):(i=getVisualOffsets(t),{x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}))}function hasFixedPositionAncestor(t,e){t=getParentNode(t);return!(t===e||!isElement(t)||isLastTraversableNode(t))&&("fixed"===getComputedStyle(t).position||hasFixedPositionAncestor(t,e))}function getClippingElementAncestors(t,e){var i=e.get(t);if(i)return i;let r=getOverflowAncestors(t,[]).filter(t=>isElement(t)&&"body"!==getNodeName(t)),a=null;var o="fixed"===getComputedStyle(t).position;let n=o?getParentNode(t):t;for(;isElement(n)&&!isLastTraversableNode(n);){var s=getComputedStyle(n),c=isContainingBlock(n),c=(c||"fixed"!==s.position||(a=null),o?!c&&!a:!c&&"static"===s.position&&!!a&&absoluteOrFixed.has(a.position)||isOverflowElement(n)&&!c&&hasFixedPositionAncestor(t,n));c?r=r.filter(t=>t!==n):a=s,n=getParentNode(n)}return e.set(t,r),r}function getClippingRect(t){let{element:i,boundary:e,rootBoundary:r,strategy:a}=t;var t=[..."clippingAncestors"===e?isTopLayer(i)?[]:getClippingElementAncestors(i,this._c):[].concat(e),r],o=t[0],t=t.reduce((t,e)=>{e=getClientRectFromClippingAncestor(i,e,a);return t.top=max(e.top,t.top),t.right=min(e.right,t.right),t.bottom=min(e.bottom,t.bottom),t.left=max(e.left,t.left),t},getClientRectFromClippingAncestor(i,o,a));return{width:t.right-t.left,height:t.bottom-t.top,x:t.left,y:t.top}}function getDimensions(t){var{width:t,height:e}=getCssDimensions(t);return{width:t,height:e}}function getRectRelativeToOffsetParent(t,e,i){var r=isHTMLElement(e);let a=getDocumentElement(e);i="fixed"===i,t=getBoundingClientRect(t,!0,i,e);let o={scrollLeft:0,scrollTop:0},n=createCoords(0);function s(){n.x=getWindowScrollBarX(a)}!r&&i||("body"===getNodeName(e)&&!isOverflowElement(a)||(o=getNodeScroll(e)),r?(c=getBoundingClientRect(e,!0,i,e),n.x=c.x+e.clientLeft,n.y=c.y+e.clientTop):a&&s()),i&&!r&&a&&s();var c=!a||r||i?createCoords(0):getHTMLOffset(a,o);return{x:t.left+o.scrollLeft-n.x-c.x,y:t.top+o.scrollTop-n.y-c.y,width:t.width,height:t.height}}function isStaticPositioned(t){return"static"===getComputedStyle(t).position}function getTrueOffsetParent(t,e){if(!isHTMLElement(t)||"fixed"===getComputedStyle(t).position)return null;if(e)return e(t);let i=t.offsetParent;return i=getDocumentElement(t)===i?i.ownerDocument.body:i}function getOffsetParent(e,t){var i=getWindow(e);if(isTopLayer(e))return i;if(!isHTMLElement(e)){let t=getParentNode(e);for(;t&&!isLastTraversableNode(t);){if(isElement(t)&&!isStaticPositioned(t))return t;t=getParentNode(t)}return i}let r=getTrueOffsetParent(e,t);for(;r&&isTableElement(r)&&isStaticPositioned(r);)r=getTrueOffsetParent(r,t);return(!(r&&isLastTraversableNode(r)&&isStaticPositioned(r))||isContainingBlock(r))&&(r||getContainingBlock(e))||i}let getElementRects=async function(t){var e=this.getOffsetParent||getOffsetParent,i=await(0,this.getDimensions)(t.floating);return{reference:getRectRelativeToOffsetParent(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function isRTL(t){return"rtl"===getComputedStyle(t).direction}let platform={convertOffsetParentRelativeRectToViewportRelativeRect:convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement:getDocumentElement,getClippingRect:getClippingRect,getOffsetParent:getOffsetParent,getElementRects:getElementRects,getClientRects:getClientRects,getDimensions:getDimensions,getScale:getScale,isElement:isElement,isRTL:isRTL},computePosition=(t,e,i)=>{var r=new Map,i={platform:platform,...i},r={...i.platform,_c:r};return computePosition$1(t,e,{...i,platform:r})},NotificationTooltip=class extends MobxLitElement{constructor(){super(...arguments),this.isVisible=!1,this.label="",this.hoveredElement=void 0,this.configureNotificationTooltip=t=>{var{label:t,target:e}=t.detail;this.hoveredElement=e,this.label=t,this.isVisible=!0},this.hideNotificationTooltip=()=>{this.isVisible=!1,this.hoveredElement=void 0,this.label=""}}static get styles(){return[TWStyles,NotificationsStyle]}connectedCallback(){super.connectedCallback(),window.addEventListener("show-notification-tooltip",this.configureNotificationTooltip),window.addEventListener("hide-notification-tooltip",this.hideNotificationTooltip)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("show-notification-tooltip",this.configureNotificationTooltip),window.removeEventListener("hide-notification-tooltip",this.hideNotificationTooltip)}updated(t){t.has("hoveredElement")&&this.isVisible&&this.hoveredElement&&computePosition(this.hoveredElement,this.notificationTooltip,{placement:"bottom-end"}).then(({x:t,y:e})=>{this.notificationTooltip.style.left=t+"px",this.notificationTooltip.style.top=e+12+"px"})}render(){var t={hidden:!this.isVisible};return html`<div class="notification-tooltip z-[9999] rounded absolute p-2 white-text ${classMap(t)}">${this.label}</div><slot></slot>`}};__decorate([query(".notification-tooltip")],NotificationTooltip.prototype,"notificationTooltip",void 0),__decorate([property({type:Boolean,reflect:!0})],NotificationTooltip.prototype,"isVisible",void 0),__decorate([property({type:String,reflect:!0})],NotificationTooltip.prototype,"label",void 0),__decorate([state()],NotificationTooltip.prototype,"hoveredElement",void 0),NotificationTooltip=__decorate([customElement("notification-tooltip")],NotificationTooltip);class IxNotifications extends MobxLitElement{constructor(){super(...arguments),this.showGroupedView=!1,this.showFilters=!1,this.showDateFilters=!1,this.showMarkAllReadConfirmation=!1,this.baseApiUrl="",this.localStorageKey=""}async firstUpdated(){NotificationsState.baseApiUrl=this.baseApiUrl,NotificationsState.localStorageKey=this.localStorageKey,NotificationsState.ConstructApiClient()}connectedCallback(){super.connectedCallback(),window.addEventListener("account-switched",NotificationsState.NewApiClient),window.addEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.addEventListener("beforeunload",this.handleOnbeforeunload)}disconnectedCallback(){super.disconnectedCallback(),this.handleOnbeforeunload(),window.removeEventListener("account-switched",NotificationsState.NewApiClient),window.removeEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.removeEventListener("beforeunload",this.handleOnbeforeunload)}handleOnbeforeunload(){NotificationsState.clearStoredNotificationsData()}toggleDrawer(){NotificationsState.showDrawer=!NotificationsState.showDrawer,NotificationsState.showDrawer||(this.showFilters=!1,this.showDateFilters=!1)}markAllread(){0<NotificationsState.unreadNotificationCount&&(this.showMarkAllReadConfirmation=!0)}confirmedMarkAllRead(t){if(t.detail.returnValue){var t=this.applyNotificationFilters(),i=null==t?void 0:t.filter(t=>t.status===NotificationStatus.UNREAD);if(0<i.length){let e=!0;null!=t&&t.forEach(t=>{NotificationsState.setNotificationReadStatus(t.id).then(t=>{e=e&&t})});t={State:!0===e?ApiCallState.SUCCESS:ApiCallState.ERROR,Message:!0===e?"Successfully marked all the notifications as read":"Error while marking the notifications read, Please try again"};this.showResultMessage(t,i[0].id),this.requestUpdate()}}this.showMarkAllReadConfirmation=!1}showResultMessage(t,e){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:e,content:html`<ix-message-toast data-testid="notification-read-all-toast" toastId="${e}" .TMessageToast="${t.State.toLowerCase()}" forceClose>${t.Message}</ix-message-toast>`,autoClose:3e3,durationOut:3e3,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))}toggleGroupView(){this.showGroupedView=!this.showGroupedView}displayFilters(){this.showFilters=!this.showFilters}applyNotificationFilters(){var t=null==(t=NotificationsState.notifications)?void 0:t.filter(t=>t.resourceType===NotificationGroups.PLANNED_MAINTENANCE&&!0===NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE||t.resourceType===NotificationGroups.SERVICE_TICKETS&&!0===NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS||t.resourceType===NotificationGroups.DCIM_ALERTS&&!0===NotificationsState.notificationFilters.SHOW_DCIM_ALERTS||t.resourceType===NotificationGroups.INCIDENTS);return void 0!==NotificationsState.dateFilters.FROM_DATE&&void 0!==NotificationsState.dateFilters.TO_DATE?t.filter(t=>0<=differenceInHours(new Date(t.createdAt),NotificationsState.dateFilters.FROM_DATE)&&differenceInDays(new Date(t.createdAt),NotificationsState.dateFilters.TO_DATE)<=0):void 0!==NotificationsState.dateFilters.FROM_DATE&&void 0===NotificationsState.dateFilters.TO_DATE?t.filter(t=>0<=differenceInHours(new Date(t.createdAt),NotificationsState.dateFilters.FROM_DATE)):void 0===NotificationsState.dateFilters.FROM_DATE&&void 0!==NotificationsState.dateFilters.TO_DATE?t.filter(t=>differenceInDays(new Date(t.createdAt),NotificationsState.dateFilters.TO_DATE)<=0):t}displayDateFilters(){this.showDateFilters=!this.showDateFilters}renderGroupedView(){var t=this.applyNotificationFilters();return html`<div class="-mx-4 -mt-2"><grouped-item data-testid="planned-maintenance-group" groupTitle="Planned Maintenance" groupIcon="${plannedMaintenance.strings[0]}" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.PLANNED_MAINTENANCE)}"></grouped-item><grouped-item data-testid="emergency-repairs-group" groupTitle="Emergency Repairs" groupIcon="report" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.INCIDENTS)}"></grouped-item><grouped-item data-testid="service-ticket-updates-group" groupTitle="Service Ticket Updates" groupIcon="sync_saved_locally" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.SERVICE_TICKETS)}"></grouped-item><grouped-item data-testid="dcim-alerts-group" groupTitle="${NotificationGroups.DCIM_ALERTS}" groupIcon="${dcim.strings[0]}" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.DCIM_ALERTS)}"></grouped-item></div>`}renderDefaultView(){var t=this.applyNotificationFilters(),e=t.filter(t=>0===differenceInDays(new Date(t.createdAt),new Date)),i=t.filter(t=>0!==differenceInDays(new Date(t.createdAt),new Date));return 0<(null==t?void 0:t.length)?html`<h3>Today</h3>${0<e.length?html`<div class="-mx-4">${null==e?void 0:e.map(t=>html`<notification-item ?read="${t.status!==NotificationStatus.UNREAD}" data-testclass="today-notification" .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:this.renderNoResult()}<h3>Earlier</h3>${0<i.length?html`<div class="-mx-4">${null==i?void 0:i.map(t=>html`<notification-item ?read="${t.status!==NotificationStatus.UNREAD}" data-testclass="earlier-notification" .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:this.renderNoResult()}`:html`<h3>Today</h3>${this.renderNoResult()}`}renderNoResult(){return html`<p class="dlr-text-caption my-4"><strong>No notifications yet.</strong></p>`}handleCloseClick(t){this.showDateFilters=!1,this.showFilters=!1}handleContentScroll(t){null!==t&&t.detail.scrollTop+t.detail.clientHeight>=t.detail.scrollHeight-2&&NotificationsState.getNotifications()}manageFilterVisibility(t){t=t.composedPath();!this.showFilters||t.includes(this.groupFilters)||t.includes(this.groupFiltersButton)||(this.showFilters=!1),!this.showDateFilters||t.includes(this.dateFilters)||t.includes(this.dateFiltersButton)||(this.showDateFilters=!1)}render(){return html`<notification-tooltip data-testid="notifications-tooltip"></notification-tooltip><confirmation-dialog data-testid="notifications-confirm-read-dialog" ?open="${this.showMarkAllReadConfirmation}" @confirm-dialog-closed="${()=>{this.showMarkAllReadConfirmation=!1}}" @on-confirm-selection="${this.confirmedMarkAllRead}" textMessage="Are you sure you want to mark all notifications as read?"></confirmation-dialog><ix-drawer data-testid="notifications-drawer" ?isVisible="${NotificationsState.showDrawer}" .onClosed="${()=>this.toggleDrawer()}" animate-vertical hide-close @on-content-scroll="${this.handleContentScroll}" @click="${this.manageFilterVisibility}" compact="compact"><div slot="content" class="m-4"><div class="flex flex-row justify-between grow items-center notification-header-container mb-4"><h2 data-testid="notifications-heading" class="grow items-center dlr-text-heading">Notifications</h2><div class="flex flex-row justify-end grow items-center options" style="--md-icon-button-icon-size:24px"><ix-icon-button data-testid="notifications-cta-all-read" data-testclass="notifications-cta" @click="${this.markAllread}" @mouseover="${t=>{0<NotificationsState.unreadNotificationCount&&window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Mark All Read",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" icon="markunread_mailbox" class="${NotificationsState.unreadNotificationCount<=0?"inactive-icon":"active-icon"}" .disabled="${NotificationsState.unreadNotificationCount<=0}" filledIcon="true"></ix-icon-button><ix-icon-button data-testid="notifications-cta-sort-type" data-testclass="notifications-cta" @click="${this.toggleGroupView}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Sort by Type",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" label="Sort by Type"><ix-icon slot="default">${this.showGroupedView?sortCheck:"sort"}</ix-icon></ix-icon-button><ix-icon-button data-testid="notifications-cta-filter-type" data-testclass="notifications-cta" @click="${this.displayFilters}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Type",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" id="group-filter-button" label="Filter by Type"><ix-icon slot="default">${viewList}</ix-icon></ix-icon-button><div data-testid="notifications-filter-dropdown" class="filter-dropdown-content ${this.showFilters?"active z-50":"hidden"}"><group-filters></group-filters></div><ix-icon-button data-testid="notifications-cta-filter-date" data-testclass="notifications-cta" @click="${this.displayDateFilters}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Date",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" icon="date_range" class="active-icon" filledIcon="true" id="date-filters-button" label="Filter by Date"></ix-icon-button><div data-testid="notifications-date-filter-dropdown" class="datefilter-dropdown-content ${this.showDateFilters?"active z-50":"hidden"}" @on-selection="${this.handleCloseClick}"><date-filters></date-filters></div></div></div>${this.showGroupedView?this.renderGroupedView():this.renderDefaultView()}</div></ix-drawer>`}}IxNotifications.styles=[TWStyles,NotificationsStyle],__decorate([query("group-filters")],IxNotifications.prototype,"groupFilters",void 0),__decorate([query("ix-icon-button#group-filter-button")],IxNotifications.prototype,"groupFiltersButton",void 0),__decorate([query("date-filters")],IxNotifications.prototype,"dateFilters",void 0),__decorate([query("ix-icon-button#date-filters-button")],IxNotifications.prototype,"dateFiltersButton",void 0),__decorate([state()],IxNotifications.prototype,"showGroupedView",void 0),__decorate([state()],IxNotifications.prototype,"showFilters",void 0),__decorate([state()],IxNotifications.prototype,"showDateFilters",void 0),__decorate([state()],IxNotifications.prototype,"showMarkAllReadConfirmation",void 0),__decorate([property({type:String})],IxNotifications.prototype,"baseApiUrl",void 0),__decorate([property({type:String})],IxNotifications.prototype,"localStorageKey",void 0),window.customElements.define("ix-notifications",IxNotifications);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { format } from 'date-fns
|
|
1
|
+
import { format } from 'date-fns';
|
|
2
2
|
import { DefaultDateTimeFormat, NotificationGroups, NotificationStatus, } from '../constants/notifications.js';
|
|
3
3
|
import { isNullOrUndefinedOrEmpty } from '../helper/common.js';
|
|
4
4
|
export const mapResourceTypeToNotificationGroups = (resourceType) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications-service.js","sourceRoot":"","sources":["../../../src/services/notifications-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"notifications-service.js","sourceRoot":"","sources":["../../../src/services/notifications-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAQvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,CAAC,MAAM,mCAAmC,GAAG,CACjD,YAAoB,EACA,EAAE;IACtB,QAAQ,YAAY,CAAC,WAAW,EAAE,EAAE,CAAC;QACnC,KAAK,qBAAqB;YACxB,OAAO,kBAAkB,CAAC,mBAAmB,CAAC;QAChD,KAAK,WAAW;YACd,OAAO,kBAAkB,CAAC,SAAS,CAAC;QACtC,KAAK,aAAa;YAChB,OAAO,kBAAkB,CAAC,WAAW,CAAC;QACxC,KAAK,iBAAiB;YACpB,OAAO,kBAAkB,CAAC,eAAe,CAAC;QAC5C;YACE,OAAO,kBAAkB,CAAC,mBAAmB,CAAC;IAClD,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,MAAc,EACM,EAAE;IACtB,QAAQ,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,kBAAkB,CAAC,MAAM,CAAC;QACnC,KAAK,MAAM;YACT,OAAO,kBAAkB,CAAC,IAAI,CAAC;QACjC;YACE,OAAO,kBAAkB,CAAC,MAAM,CAAC;IACrC,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAChD,MAAc,EACW,EAAE,CAAC,CAAC;IAC7B,IAAI,EAAE,aAAa;IACnB,MAAM;IACN,MAAM,EAAE,CAAC,EAAE,CAAC;CACb,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uCAAuC,GAAG,CACrD,EAAU,EACV,KAAa,EACkB,EAAE,CAAC,CAAC;IACnC,EAAE;IACF,iBAAiB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAuB;CAC1D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wCAAwC,GAAG,CACtD,EAAU,EACsB,EAAE,CAAC,CAAC;IACpC,EAAE;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,QAA0B,EACZ,EAAE;;IAAC,OAAA,CAAC;QAClB,OAAO,EAAE,MAAA,QAAQ,CAAC,OAAO,mCAAI,EAAE;QAC/B,EAAE,EAAE,QAAQ,CAAC,EAAG;QAChB,aAAa,EAAE,MAAA,QAAQ,CAAC,aAAa,mCAAI,EAAE;QAC3C,YAAY,EAAE,mCAAmC,CAC/C,MAAA,QAAQ,CAAC,YAAY,mCAAI,EAAE,CAC5B;QACD,QAAQ,EAAE,MAAA,QAAQ,CAAC,QAAQ,mCAAI,EAAE;QACjC,UAAU,EAAE,MAAA,QAAQ,CAAC,UAAU,mCAAI,EAAE;QACrC,MAAM,EAAE,6BAA6B,CAAC,MAAA,QAAQ,CAAC,MAAM,mCAAI,EAAE,CAAC;QAC5D,SAAS,EAAE,CAAC,wBAAwB,CAAC,QAAQ,CAAC,SAAS,CAAC;YACtD,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAU,EAAE,qBAAqB,CAAC;YACpD,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,EAAE,qBAAqB,CAAC;QAC7C,SAAS,EAAE,MAAA,QAAQ,CAAC,SAAS,mCAAI,EAAE;QACnC,SAAS,EAAE,MAAA,QAAQ,CAAC,SAAS,mCAAI,EAAE;KACpC,CAAC,CAAA;CAAA,CAAC;AAEH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CACpD,QAA4B,EACZ,EAAE,CAClB,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,QAAgB,EAAU,EAAE;IAC1E,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC/C,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC5B,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;AACvD,CAAC,CAAC","sourcesContent":["import { format } from 'date-fns';\nimport { Notification } from '../models/notification.js';\nimport {\n DefaultDateTimeFormat,\n NotificationGroups,\n NotificationStatus,\n} from '../constants/notifications.js';\nimport {\n DeleteNotificationsByIdRequest,\n GetNotificationsRequest,\n NotificationPatch,\n PatchNotificationsByIdRequest,\n Notification as Notificationdata,\n} from '../api/notifications-api/index.js';\nimport { isNullOrUndefinedOrEmpty } from '../helper/common.js';\n\nexport const mapResourceTypeToNotificationGroups = (\n resourceType: string\n): NotificationGroups => {\n switch (resourceType.toLowerCase()) {\n case 'planned maintenance':\n return NotificationGroups.PLANNED_MAINTENANCE;\n case 'incidents':\n return NotificationGroups.INCIDENTS;\n case 'dcim alerts':\n return NotificationGroups.DCIM_ALERTS;\n case 'service tickets':\n return NotificationGroups.SERVICE_TICKETS;\n default:\n return NotificationGroups.PLANNED_MAINTENANCE;\n }\n};\n\nexport const mapStringToNotificationStatus = (\n status: string\n): NotificationStatus => {\n switch (status.toLowerCase()) {\n case 'unread':\n return NotificationStatus.UNREAD;\n case 'read':\n return NotificationStatus.READ;\n default:\n return NotificationStatus.UNREAD;\n }\n};\n\nexport const mapParametersToNotificationRequest = (\n cursor: string\n): GetNotificationsRequest => ({\n sort: '-created_at',\n cursor,\n prefer: [''],\n});\n\nexport const mapParametersToPatchNotificationRequest = (\n id: string,\n staus: string\n): PatchNotificationsByIdRequest => ({\n id,\n notificationPatch: { status: staus } as NotificationPatch,\n});\n\nexport const mapParametersToDeleteNotificationRequest = (\n id: string\n): DeleteNotificationsByIdRequest => ({\n id,\n});\n\nexport const mapNotificationDataToNotification = (\n response: Notificationdata\n): Notification => ({\n subject: response.subject ?? '',\n id: response.id!,\n accountNumber: response.accountNumber ?? '',\n resourceType: mapResourceTypeToNotificationGroups(\n response.resourceType ?? ''\n ),\n subGroup: response.subGroup ?? '',\n resourceId: response.resourceId ?? '',\n status: mapStringToNotificationStatus(response.status ?? ''),\n createdAt: !isNullOrUndefinedOrEmpty(response.createdAt)\n ? format(response.createdAt!, DefaultDateTimeFormat)\n : format(new Date(), DefaultDateTimeFormat),\n createdBy: response.createdBy ?? '',\n locations: response.locations ?? [],\n});\n\nexport const mapNotificationResponseToNotifications = (\n response: Notificationdata[]\n): Notification[] =>\n response.map(element => mapNotificationDataToNotification(element));\n\nexport const getNextPageCursorfromQueryParam = (queryUrl: string): string => {\n const searchParams = new URLSearchParams(queryUrl);\n const nextPageCursor = searchParams.has('cursor')\n ? searchParams.get('cursor')\n : '';\n return nextPageCursor !== null ? nextPageCursor : '';\n};\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { makeAutoObservable } from 'mobx';
|
|
2
2
|
import { clearPersistedStore, getPersistedStore, hydrateStore, isHydrated, makePersistable, } from 'mobx-persist-store';
|
|
3
|
-
import { parse } from 'date-fns
|
|
4
|
-
import { subDays } from 'date-fns/subDays.js';
|
|
3
|
+
import { parse, subDays } from 'date-fns';
|
|
5
4
|
import { NotificationGroups, NotificationStatus, DefaultDateFormat, DefaultDisplayDays, ApiCallState, } from '../constants/notifications.js';
|
|
6
5
|
import { ApiClient } from '../services/api-client.js';
|
|
7
6
|
import { mapNotificationDataToNotification, mapNotificationResponseToNotifications, mapParametersToPatchNotificationRequest, mapParametersToNotificationRequest, mapParametersToDeleteNotificationRequest, getNextPageCursorfromQueryParam, } from '../services/notifications-service.js';
|