@meetelise/chat 1.43.36 → 1.43.38

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.
@@ -92,7 +92,7 @@ declare class MyPubnub {
92
92
  isFirstChatMessageSent: boolean;
93
93
  private streamingMessageTimeout;
94
94
  constructor(buildingSlug: string, buildingDetails: BuildingWebchatView | null, orgSlug: string, leadSource: string | null | undefined, leadUserId: string, leadSourceMultitouchClient: LeadSourceMultitouchClient | null, leadSourceClient?: LeadSourceClient | null, widgetType?: WidgetType);
95
- initSession(buildingSlug: string, orgSlug: string): Promise<{
95
+ initSession(buildingSlug: string, orgSlug: string, existingLeadId?: string): Promise<{
96
96
  session_token: string;
97
97
  lead_id: string;
98
98
  channel: string;
@@ -24,6 +24,7 @@ export declare class FeeCalculatorLayout extends LitElement {
24
24
  rentableItems: RentableItemSummary[];
25
25
  units: Unit[];
26
26
  isLoadingUnits: boolean;
27
+ isLoadingLayouts: boolean;
27
28
  onSelectLayout: ((layoutIds: number[]) => void) | null;
28
29
  onUnitSelect: ((unit: Unit) => void) | null;
29
30
  onMoveInDateChange: ((dateString: string) => void) | null;
@@ -5,6 +5,7 @@ export declare class FeeItemComponent extends LitElement {
5
5
  feeQuote: FeeQuote | null;
6
6
  get name(): string;
7
7
  get description(): string;
8
+ get additionalInfo(): string;
8
9
  get triggeredEvent(): string;
9
10
  get amount(): string | null;
10
11
  render(): TemplateResult;
@@ -2,7 +2,6 @@ import { LitElement, TemplateResult } from "lit";
2
2
  import { LayoutOption } from "../../../../fetchBuildingWebchatView";
3
3
  import { Unit } from "../../../../services/fees/fetchBuildingUnits";
4
4
  import "../floorplan-image-card/floorplan-image-card";
5
- import "../../../loaders/mega-loader";
6
5
  export declare class FloorPlanSelector extends LitElement {
7
6
  static styles: import("lit").CSSResult;
8
7
  buildingSlug: string;
@@ -10,6 +9,7 @@ export declare class FloorPlanSelector extends LitElement {
10
9
  selectedLayoutIds: number[];
11
10
  units: Unit[];
12
11
  isLoading: boolean;
12
+ isLoadingLayouts: boolean;
13
13
  onSelectLayout: ((layoutIds: number[]) => void) | null;
14
14
  onUnitSelect: ((unit: Unit) => void) | null;
15
15
  onMoveInDateChange: ((inputDateString: string) => void) | null;
@@ -21,8 +21,8 @@ export declare class FeeCalculator extends LitElement {
21
21
  onClickPhoneOption: ((e: MouseEvent) => void) | null;
22
22
  onClickSSTOption: ((e: MouseEvent) => void) | null;
23
23
  onClickTextUsOption: ((e: MouseEvent) => void) | null;
24
- private isFirstCalculation;
25
24
  private isCalculatingQuote;
25
+ private isLoadingLayouts;
26
26
  private isExporting;
27
27
  private selectedLayoutIds;
28
28
  private selectedUnit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.43.36",
3
+ "version": "1.43.38",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -3303,12 +3303,6 @@ xmlns="http://www.w3.org/2000/svg"
3303
3303
  background-color: var(--primary-color, #ffffff);
3304
3304
  }
3305
3305
 
3306
- .recalculating-loader {
3307
- display: flex;
3308
- align-items: center;
3309
- justify-content: center;
3310
- }
3311
-
3312
3306
  @media (max-width: 767px) {
3313
3307
  .fee-calculator-container {
3314
3308
  width: 100vw;
@@ -3462,6 +3456,40 @@ xmlns="http://www.w3.org/2000/svg"
3462
3456
  color: white;
3463
3457
  }
3464
3458
 
3459
+ .floor-plan-badge.skeleton {
3460
+ cursor: default;
3461
+ width: 56px;
3462
+ height: 18px;
3463
+ padding: 0;
3464
+ border: 1px solid #eaeaea;
3465
+ }
3466
+
3467
+ .unit-card-skeleton {
3468
+ display: flex;
3469
+ min-width: 18rem;
3470
+ width: 100%;
3471
+ height: 4.75rem;
3472
+ border-radius: 4px;
3473
+ border: 2px solid transparent;
3474
+ background-color: #f8f9fa;
3475
+ box-sizing: border-box;
3476
+ }
3477
+
3478
+ .shimmer {
3479
+ background: linear-gradient(90deg, #eaeaea 25%, #f5f5f5 50%, #eaeaea 75%);
3480
+ background-size: 400px 100%;
3481
+ animation: shimmer 1.4s ease-in-out infinite;
3482
+ }
3483
+
3484
+ @keyframes shimmer {
3485
+ 0% {
3486
+ background-position: -200px 0;
3487
+ }
3488
+ 100% {
3489
+ background-position: 200px 0;
3490
+ }
3491
+ }
3492
+
3465
3493
  .advanced-section {
3466
3494
  max-height: 0;
3467
3495
  overflow: hidden;
@@ -3685,38 +3713,20 @@ xmlns="http://www.w3.org/2000/svg"
3685
3713
  </p>
3686
3714
  </div>
3687
3715
  </div>
3688
- `}};fo.styles=ho,po([ue({type:Object})],fo.prototype,"unit",void 0),po([ue()],fo.prototype,"onUnitSelect",void 0),po([ue({type:Boolean})],fo.prototype,"selected",void 0),fo=po([se("floorplan-image-card")],fo);var go=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let mo=class extends oe{constructor(){super(...arguments),this.size=64,this.spinSpeed=.8}updated(){this.style.setProperty("--mega-loader-size",`${this.size}px`),this.style.setProperty("--mega-loader-spin-speed",`${this.spinSpeed}s`)}render(){return B`<div class="spinner"></div>`}};mo.styles=u`
3689
- .spinner {
3690
- border: 4px solid rgba(0, 0, 0, 0.2);
3691
- border-top: 4px solid var(--primary-color, #c057ff);
3692
- border-radius: 50%;
3693
- width: var(--mega-loader-size, 64px);
3694
- height: var(--mega-loader-size, 64px);
3695
- animation: spin var(--mega-loader-spin-speed, 0.8s) linear infinite;
3696
- }
3697
-
3698
- @keyframes spin {
3699
- 0% {
3700
- transform: rotate(0deg);
3701
- }
3702
- 100% {
3703
- transform: rotate(360deg);
3704
- }
3705
- }
3706
- `,go([ue({type:Number})],mo.prototype,"size",void 0),go([ue({type:Number})],mo.prototype,"spinSpeed",void 0),mo=go([se("mega-loader")],mo);var yo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let bo=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.layoutOptions=[],this.selectedLayoutIds=[eo],this.units=[],this.isLoading=!1,this.onSelectLayout=null,this.onUnitSelect=null,this.onMoveInDateChange=null,this.onLeaseTermChange=null,this.moveInDate=pn,this.leaseTerm=12,this.selectedUnit=null,this.handleUnitSelect=e=>{var t;this.selectedUnit=e,null===(t=this.onUnitSelect)||void 0===t||t.call(this,e)},this.handleLayoutChange=e=>{var t;let n;e===eo?n=[eo]:this.selectedLayoutIds.includes(eo)?n=[e]:this.selectedLayoutIds.includes(e)?(n=this.selectedLayoutIds.filter(t=>t!==e),0===n.length&&(n=[eo])):n=[...this.selectedLayoutIds,e],this.selectedLayoutIds=n,null===(t=this.onSelectLayout)||void 0===t||t.call(this,this.selectedLayoutIds)},this.handleMoveInDateChange=e=>{var t;const n=e.target.value;if(n){const[e,t,i]=n.split("-").map(Number);this.moveInDate=new Date(e,t-1,i)}else this.moveInDate=pn;null===(t=this.onMoveInDateChange)||void 0===t||t.call(this,n||pn.toISOString().split("T")[0])},this.handleLeaseTermChange=e=>{var t;this.leaseTerm=parseInt(e.target.value),null===(t=this.onLeaseTermChange)||void 0===t||t.call(this,this.leaseTerm)},this.renderUnitSelection=()=>{var e,t;return this.isLoading?B`
3716
+ `}};fo.styles=ho,po([ue({type:Object})],fo.prototype,"unit",void 0),po([ue()],fo.prototype,"onUnitSelect",void 0),po([ue({type:Boolean})],fo.prototype,"selected",void 0),fo=po([se("floorplan-image-card")],fo);var go=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let mo=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.layoutOptions=[],this.selectedLayoutIds=[eo],this.units=[],this.isLoading=!1,this.isLoadingLayouts=!1,this.onSelectLayout=null,this.onUnitSelect=null,this.onMoveInDateChange=null,this.onLeaseTermChange=null,this.moveInDate=pn,this.leaseTerm=12,this.selectedUnit=null,this.handleUnitSelect=e=>{var t;this.selectedUnit=e,null===(t=this.onUnitSelect)||void 0===t||t.call(this,e)},this.handleLayoutChange=e=>{var t;let n;e===eo?n=[eo]:this.selectedLayoutIds.includes(eo)?n=[e]:this.selectedLayoutIds.includes(e)?(n=this.selectedLayoutIds.filter(t=>t!==e),0===n.length&&(n=[eo])):n=[...this.selectedLayoutIds,e],this.selectedLayoutIds=n,null===(t=this.onSelectLayout)||void 0===t||t.call(this,this.selectedLayoutIds)},this.handleMoveInDateChange=e=>{var t;const n=e.target.value;if(n){const[e,t,i]=n.split("-").map(Number);this.moveInDate=new Date(e,t-1,i)}else this.moveInDate=pn;null===(t=this.onMoveInDateChange)||void 0===t||t.call(this,n||pn.toISOString().split("T")[0])},this.handleLeaseTermChange=e=>{var t;this.leaseTerm=parseInt(e.target.value),null===(t=this.onLeaseTermChange)||void 0===t||t.call(this,this.leaseTerm)},this.renderUnitSelection=()=>{var e,t;return this.isLoading?B`
3707
3717
  <div class="unit-selection">
3708
- <div class="loading-container">
3709
- <mega-loader size="32"></mega-loader>
3718
+ <div class="image-carousel">
3719
+ ${Array.from({length:3},()=>B`<div class="unit-card-skeleton shimmer"></div>`)}
3710
3720
  </div>
3711
3721
  </div>
3712
3722
  `:B`
3713
3723
  <div class="unit-selection">
3714
3724
  <div class="image-carousel">
3715
- ${this.isLoading||0!==(null===(e=this.units)||void 0===e?void 0:e.length)?"":B`
3725
+ ${0===(null===(e=this.units)||void 0===e?void 0:e.length)?B`
3716
3726
  <div class="no-floorplans-container">
3717
3727
  <p>No floorplans found</p>
3718
3728
  </div>
3719
- `}
3729
+ `:""}
3720
3730
  ${null===(t=this.units)||void 0===t?void 0:t.map(e=>{var t;return B`
3721
3731
  <floorplan-image-card
3722
3732
  .unit=${e}
@@ -3726,7 +3736,11 @@ xmlns="http://www.w3.org/2000/svg"
3726
3736
  `})}
3727
3737
  </div>
3728
3738
  </div>
3729
- `},this.renderBadges=()=>B`
3739
+ `},this.renderBadges=()=>this.isLoadingLayouts?B`
3740
+ <div class="floor-plan-selector-badges">
3741
+ ${Array.from({length:4},()=>B`<div class="floor-plan-badge skeleton shimmer"></div>`)}
3742
+ </div>
3743
+ `:B`
3730
3744
  <div class="floor-plan-selector-badges">
3731
3745
  ${this.displayOptions.map(e=>B`
3732
3746
  <div
@@ -3768,7 +3782,7 @@ xmlns="http://www.w3.org/2000/svg"
3768
3782
  ${this.renderUnitSelection()}
3769
3783
  </div>
3770
3784
  </div>
3771
- `}};bo.styles=co,yo([ue({type:String})],bo.prototype,"buildingSlug",void 0),yo([ue({type:Array})],bo.prototype,"layoutOptions",void 0),yo([ue({type:Array})],bo.prototype,"selectedLayoutIds",void 0),yo([ue({type:Array})],bo.prototype,"units",void 0),yo([ue({type:Boolean})],bo.prototype,"isLoading",void 0),yo([ue()],bo.prototype,"onSelectLayout",void 0),yo([ue()],bo.prototype,"onUnitSelect",void 0),yo([ue()],bo.prototype,"onMoveInDateChange",void 0),yo([ue()],bo.prototype,"onLeaseTermChange",void 0),yo([ce()],bo.prototype,"moveInDate",void 0),yo([ce()],bo.prototype,"leaseTerm",void 0),yo([ce()],bo.prototype,"selectedUnit",void 0),bo=yo([se("floor-plan-selector")],bo);const vo=u`
3785
+ `}};mo.styles=co,go([ue({type:String})],mo.prototype,"buildingSlug",void 0),go([ue({type:Array})],mo.prototype,"layoutOptions",void 0),go([ue({type:Array})],mo.prototype,"selectedLayoutIds",void 0),go([ue({type:Array})],mo.prototype,"units",void 0),go([ue({type:Boolean})],mo.prototype,"isLoading",void 0),go([ue({type:Boolean})],mo.prototype,"isLoadingLayouts",void 0),go([ue()],mo.prototype,"onSelectLayout",void 0),go([ue()],mo.prototype,"onUnitSelect",void 0),go([ue()],mo.prototype,"onMoveInDateChange",void 0),go([ue()],mo.prototype,"onLeaseTermChange",void 0),go([ce()],mo.prototype,"moveInDate",void 0),go([ce()],mo.prototype,"leaseTerm",void 0),go([ce()],mo.prototype,"selectedUnit",void 0),mo=go([se("floor-plan-selector")],mo);const yo=u`
3772
3786
  :host {
3773
3787
  display: block;
3774
3788
  width: 100%;
@@ -3803,22 +3817,32 @@ xmlns="http://www.w3.org/2000/svg"
3803
3817
  margin-top: 4px;
3804
3818
  }
3805
3819
 
3820
+ .fee-additional-info {
3821
+ color: #868e96;
3822
+ font-size: 0.8rem;
3823
+ margin-top: 2px;
3824
+ font-style: italic;
3825
+ }
3826
+
3806
3827
  .fee-amount {
3807
3828
  font-size: 1rem;
3808
3829
  align-self: center;
3809
3830
  }
3810
- `;var wo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Co=class extends oe{constructor(){super(...arguments),this.feeQuote=null}get name(){var e,t;if(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceRentableItem)return Sn(this.feeQuote.sourceRentableItem.description||"");const n=null===(t=this.feeQuote)||void 0===t?void 0:t.marketableFee;return(null==n?void 0:n.feeName)?Sn(n.feeName):""}get description(){var e,t,n,i;if(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceRentableItem){return`${this.feeQuote.sourceRentableItem.id}`}return null!==(i=null===(n=null===(t=this.feeQuote)||void 0===t?void 0:t.marketableFee)||void 0===n?void 0:n.description)&&void 0!==i?i:""}get triggeredEvent(){var e,t;const n=null===(t=null===(e=this.feeQuote)||void 0===e?void 0:e.marketableFee)||void 0===t?void 0:t.triggeredByEvent;if(!n)return"";return{APPLICATION_SUBMISSION:"Due at Application Submission",APPLICATION_APPROVAL:"Due at Application Approval",LEASE_SIGNING:"Due at Lease Signing",MOVE_IN:"Due at Move-In"}[n]||n}get amount(){var e;if(!this.feeQuote)return null;const t=null!==(e=this.feeQuote.amountRange.fixedValue)&&void 0!==e?e:0;return 0===t?null:En(t,2)}render(){return this.feeQuote&&this.amount?B`
3831
+ `;var bo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let vo=class extends oe{constructor(){super(...arguments),this.feeQuote=null}get name(){var e,t;if(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceRentableItem)return Sn(this.feeQuote.sourceRentableItem.description||"");const n=null===(t=this.feeQuote)||void 0===t?void 0:t.marketableFee;return(null==n?void 0:n.feeName)?Sn(n.feeName):""}get description(){var e,t,n,i;if(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceRentableItem){return`${this.feeQuote.sourceRentableItem.id}`}return null!==(i=null===(n=null===(t=this.feeQuote)||void 0===t?void 0:t.marketableFee)||void 0===n?void 0:n.description)&&void 0!==i?i:""}get additionalInfo(){var e,t,n;return null!==(n=null===(t=null===(e=this.feeQuote)||void 0===e?void 0:e.marketableFee)||void 0===t?void 0:t.additionalInfo)&&void 0!==n?n:""}get triggeredEvent(){var e,t;const n=null===(t=null===(e=this.feeQuote)||void 0===e?void 0:e.marketableFee)||void 0===t?void 0:t.triggeredByEvent;if(!n)return"";return{APPLICATION_SUBMISSION:"Due at Application Submission",APPLICATION_APPROVAL:"Due at Application Approval",LEASE_SIGNING:"Due at Lease Signing",MOVE_IN:"Due at Move-In"}[n]||n}get amount(){var e;if(!this.feeQuote)return null;const t=null!==(e=this.feeQuote.amountRange.fixedValue)&&void 0!==e?e:0;return 0===t?null:En(t,2)}render(){return this.feeQuote&&this.amount?B`
3811
3832
  <div class="fee-item">
3812
3833
  <div class="fee-info">
3813
3834
  <div class="fee-name">${this.name}</div>
3814
- <div class="fee-description">${this.description}</div>
3835
+ ${this.description?B`<div class="fee-description">${this.description}</div>`:""}
3836
+ ${this.additionalInfo?B`<div class="fee-additional-info">
3837
+ ${this.additionalInfo}
3838
+ </div>`:""}
3815
3839
  ${this.triggeredEvent?B`<div class="fee-triggered-event">
3816
3840
  ${this.triggeredEvent}
3817
3841
  </div>`:""}
3818
3842
  </div>
3819
3843
  <div class="fee-amount">${this.amount}</div>
3820
3844
  </div>
3821
- `:B``}};Co.styles=vo,wo([ue({type:Object})],Co.prototype,"feeQuote",void 0),Co=wo([se("fee-item")],Co);var xo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Ao=class extends oe{constructor(){super(...arguments),this.feeQuotes=[]}get itemType(){const e=this.feeQuotes[0];return(null==e?void 0:e.sourceRentableItem)?Sn(e.sourceRentableItem.description||""):""}get priceGroups(){const e=new Map;return this.feeQuotes.forEach(t=>{var n;const i=null!==(n=t.amountRange.fixedValue)&&void 0!==n?n:0;e.set(i,(e.get(i)||0)+1)}),Array.from(e.entries()).map(([e,t])=>({price:e,count:t})).sort((e,t)=>e.price-t.price)}get totalAmount(){const e=this.feeQuotes.reduce((e,t)=>{var n;return e+(null!==(n=t.amountRange.fixedValue)&&void 0!==n?n:0)},0);return En(e,2)}get priceBreakdown(){const e=this.priceGroups;if(0===e.length)return"";const t=this.getUnitName();return e.map(e=>{return`${e.count} ${n=t,i=e.count,1===i?n:`${n}s`} @ ${En(e.price,2)}/month`;var n,i}).join(" + ")}getUnitName(){var e;const t=this.feeQuotes[0];return function(e){const t=e.toLowerCase();return t.includes("garage")||t.includes("parking")?"space":t.includes("storage")?"unit":t.includes("locker")?"locker":t.includes("bike")?"spot":"unit"}((null===(e=null==t?void 0:t.sourceRentableItem)||void 0===e?void 0:e.description)||"")}render(){return this.feeQuotes.length&&this.totalAmount!==En(0,2)?B`
3845
+ `:B``}};vo.styles=yo,bo([ue({type:Object})],vo.prototype,"feeQuote",void 0),vo=bo([se("fee-item")],vo);var wo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Co=class extends oe{constructor(){super(...arguments),this.feeQuotes=[]}get itemType(){const e=this.feeQuotes[0];return(null==e?void 0:e.sourceRentableItem)?Sn(e.sourceRentableItem.description||""):""}get priceGroups(){const e=new Map;return this.feeQuotes.forEach(t=>{var n;const i=null!==(n=t.amountRange.fixedValue)&&void 0!==n?n:0;e.set(i,(e.get(i)||0)+1)}),Array.from(e.entries()).map(([e,t])=>({price:e,count:t})).sort((e,t)=>e.price-t.price)}get totalAmount(){const e=this.feeQuotes.reduce((e,t)=>{var n;return e+(null!==(n=t.amountRange.fixedValue)&&void 0!==n?n:0)},0);return En(e,2)}get priceBreakdown(){const e=this.priceGroups;if(0===e.length)return"";const t=this.getUnitName();return e.map(e=>{return`${e.count} ${n=t,i=e.count,1===i?n:`${n}s`} @ ${En(e.price,2)}/month`;var n,i}).join(" + ")}getUnitName(){var e;const t=this.feeQuotes[0];return function(e){const t=e.toLowerCase();return t.includes("garage")||t.includes("parking")?"space":t.includes("storage")?"unit":t.includes("locker")?"locker":t.includes("bike")?"spot":"unit"}((null===(e=null==t?void 0:t.sourceRentableItem)||void 0===e?void 0:e.description)||"")}render(){return this.feeQuotes.length&&this.totalAmount!==En(0,2)?B`
3822
3846
  <div class="fee-item">
3823
3847
  <div class="fee-info">
3824
3848
  <div class="fee-name">${this.itemType}</div>
@@ -3826,7 +3850,7 @@ xmlns="http://www.w3.org/2000/svg"
3826
3850
  </div>
3827
3851
  <div class="fee-amount">${this.totalAmount}</div>
3828
3852
  </div>
3829
- `:B``}};Ao.styles=vo,xo([ue({type:Array})],Ao.prototype,"feeQuotes",void 0),Ao=xo([se("grouped-rentable-item")],Ao);const So=u`
3853
+ `:B``}};Co.styles=yo,wo([ue({type:Array})],Co.prototype,"feeQuotes",void 0),Co=wo([se("grouped-rentable-item")],Co);const xo=u`
3830
3854
  .fee-card-section-container {
3831
3855
  margin: 0 12px;
3832
3856
  border-radius: 4px;
@@ -3886,7 +3910,7 @@ xmlns="http://www.w3.org/2000/svg"
3886
3910
  margin: 12px;
3887
3911
  justify-content: space-between;
3888
3912
  }
3889
- `;var Eo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let ko=class extends oe{constructor(){super(...arguments),this.title="Fees",this.fees=[],this.buildingFeesToQuantity={},this.handleQuantityChange=(e,t)=>{this.buildingFeesToQuantity[e]=t,this.requestUpdate()}}get totalAmount(){const e=this.fees.reduce((e,t)=>{var n;return e+(null!==(n=t.amountRange.fixedValue)&&void 0!==n?n:0)},0);return En(e,2)}get groupedRentableItems(){const e=this.fees.filter(e=>e.sourceRentableItem);e.sort((e,t)=>{var n,i;const r=(null===(n=e.sourceRentableItem)||void 0===n?void 0:n.description)||"",o=(null===(i=t.sourceRentableItem)||void 0===i?void 0:i.description)||"";return r.localeCompare(o,navigator.language,{numeric:!0})});const t={};return e.forEach(e=>{var n;const i=(null===(n=e.sourceRentableItem)||void 0===n?void 0:n.description)||"unknown";t[i]||(t[i]=[]),t[i].push(e)}),t}get nonRentableItems(){return this.fees.filter(e=>!e.sourceRentableItem)}render(){return B`
3913
+ `;var Ao=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let So=class extends oe{constructor(){super(...arguments),this.title="Fees",this.fees=[],this.buildingFeesToQuantity={},this.handleQuantityChange=(e,t)=>{this.buildingFeesToQuantity[e]=t,this.requestUpdate()}}get totalAmount(){const e=this.fees.reduce((e,t)=>{var n;return e+(null!==(n=t.amountRange.fixedValue)&&void 0!==n?n:0)},0);return En(e,2)}get groupedRentableItems(){const e=this.fees.filter(e=>e.sourceRentableItem);e.sort((e,t)=>{var n,i;const r=(null===(n=e.sourceRentableItem)||void 0===n?void 0:n.description)||"",o=(null===(i=t.sourceRentableItem)||void 0===i?void 0:i.description)||"";return r.localeCompare(o,navigator.language,{numeric:!0})});const t={};return e.forEach(e=>{var n;const i=(null===(n=e.sourceRentableItem)||void 0===n?void 0:n.description)||"unknown";t[i]||(t[i]=[]),t[i].push(e)}),t}get nonRentableItems(){return this.fees.filter(e=>!e.sourceRentableItem)}render(){return B`
3890
3914
  <div class="fee-card-section-container">
3891
3915
  <div class="fee-card-section-header">
3892
3916
  <h1 class="section-title">${this.title}</h1>
@@ -3910,7 +3934,7 @@ xmlns="http://www.w3.org/2000/svg"
3910
3934
  </div>
3911
3935
  </div>
3912
3936
  </div>
3913
- `}};ko.styles=So,Eo([ue({type:String})],ko.prototype,"title",void 0),Eo([ue({type:Array})],ko.prototype,"fees",void 0),Eo([ce()],ko.prototype,"buildingFeesToQuantity",void 0),ko=Eo([se("fee-card")],ko);const To=u`
3937
+ `}};So.styles=xo,Ao([ue({type:String})],So.prototype,"title",void 0),Ao([ue({type:Array})],So.prototype,"fees",void 0),Ao([ce()],So.prototype,"buildingFeesToQuantity",void 0),So=Ao([se("fee-card")],So);const Eo=u`
3914
3938
  :host {
3915
3939
  --transition-timing: 0.2s ease;
3916
3940
  display: flex;
@@ -4112,7 +4136,7 @@ xmlns="http://www.w3.org/2000/svg"
4112
4136
  font-weight: bold;
4113
4137
  color: #0066cc;
4114
4138
  }
4115
- `;var _o;!function(e){e.NEVER="NEVER",e.ONE_TIME="ONE_TIME",e.MONTHLY="MONTHLY",e.WEEKLY="WEEKLY",e.BI_WEEKLY="BI_WEEKLY",e.ANNUALLY="ANNUALLY",e.DAILY="DAILY"}(_o||(_o={}));var Oo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Po=class extends oe{constructor(){super(...arguments),this.chargeInputs={base_rent:0,num_pets:0,num_vehicles:0,num_applicants:1,num_cats:0,num_dogs:0,num_other_pets:0},this.onChargeInputsChange=null,this.disabled=!1,this.rentableItems=[],this.selectedRentableItems=[],this.onRentableItemAdd=null,this.onRentableItemRemove=null,this.handleRentableItemToggle=e=>{var t,n;if(this.selectedRentableItems.some(t=>t.type===e.type)){const n=this.selectedRentableItems.find(t=>t.type===e.type);n&&(null===(t=this.onRentableItemRemove)||void 0===t||t.call(this,n))}else{const t=e.minAvailableItem||e.allItems[0];if(t){const i={id:t.id,type:e.type};null===(n=this.onRentableItemAdd)||void 0===n||n.call(this,i)}}}}handleIncrement(e){var t,n;const i=(null!==(t=this.chargeInputs[e])&&void 0!==t?t:0)+1;"num_cats"===e||"num_dogs"===e||"num_other_pets"===e?this.updatePetCount({[e]:i}):null===(n=this.onChargeInputsChange)||void 0===n||n.call(this,{[e]:i})}handleDecrement(e){var t,n;const i=null!==(t=this.chargeInputs[e])&&void 0!==t?t:0,r="num_applicants"===e?1:0,o=Math.max(r,i-1);"num_cats"===e||"num_dogs"===e||"num_other_pets"===e?this.updatePetCount({[e]:o}):null===(n=this.onChargeInputsChange)||void 0===n||n.call(this,{[e]:o})}updatePetCount(e){var t,n,i,r;const o={...this.chargeInputs,...e},a=(null!==(t=o.num_cats)&&void 0!==t?t:0)+(null!==(n=o.num_dogs)&&void 0!==n?n:0)+(null!==(i=o.num_other_pets)&&void 0!==i?i:0);null===(r=this.onChargeInputsChange)||void 0===r||r.call(this,{...e,num_pets:a})}getFieldLabel(e){return{base_rent:"Base Rent ($)",num_pets:"Pets",num_vehicles:"Vehicles",num_applicants:"Applicants",num_cats:"Cats",num_dogs:"Dogs",num_other_pets:"All Other Pets"}[e]||e}renderRentableItemRow(e){const t=this.selectedRentableItems.some(t=>t.type===e.type);return B`
4139
+ `;var ko;!function(e){e.NEVER="NEVER",e.ONE_TIME="ONE_TIME",e.MONTHLY="MONTHLY",e.WEEKLY="WEEKLY",e.BI_WEEKLY="BI_WEEKLY",e.ANNUALLY="ANNUALLY",e.DAILY="DAILY"}(ko||(ko={}));var To=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let _o=class extends oe{constructor(){super(...arguments),this.chargeInputs={base_rent:0,num_pets:0,num_vehicles:0,num_applicants:1,num_cats:0,num_dogs:0,num_other_pets:0},this.onChargeInputsChange=null,this.disabled=!1,this.rentableItems=[],this.selectedRentableItems=[],this.onRentableItemAdd=null,this.onRentableItemRemove=null,this.handleRentableItemToggle=e=>{var t,n;if(this.selectedRentableItems.some(t=>t.type===e.type)){const n=this.selectedRentableItems.find(t=>t.type===e.type);n&&(null===(t=this.onRentableItemRemove)||void 0===t||t.call(this,n))}else{const t=e.minAvailableItem||e.allItems[0];if(t){const i={id:t.id,type:e.type};null===(n=this.onRentableItemAdd)||void 0===n||n.call(this,i)}}}}handleIncrement(e){var t,n;const i=(null!==(t=this.chargeInputs[e])&&void 0!==t?t:0)+1;"num_cats"===e||"num_dogs"===e||"num_other_pets"===e?this.updatePetCount({[e]:i}):null===(n=this.onChargeInputsChange)||void 0===n||n.call(this,{[e]:i})}handleDecrement(e){var t,n;const i=null!==(t=this.chargeInputs[e])&&void 0!==t?t:0,r="num_applicants"===e?1:0,o=Math.max(r,i-1);"num_cats"===e||"num_dogs"===e||"num_other_pets"===e?this.updatePetCount({[e]:o}):null===(n=this.onChargeInputsChange)||void 0===n||n.call(this,{[e]:o})}updatePetCount(e){var t,n,i,r;const o={...this.chargeInputs,...e},a=(null!==(t=o.num_cats)&&void 0!==t?t:0)+(null!==(n=o.num_dogs)&&void 0!==n?n:0)+(null!==(i=o.num_other_pets)&&void 0!==i?i:0);null===(r=this.onChargeInputsChange)||void 0===r||r.call(this,{...e,num_pets:a})}getFieldLabel(e){return{base_rent:"Base Rent ($)",num_pets:"Pets",num_vehicles:"Vehicles",num_applicants:"Applicants",num_cats:"Cats",num_dogs:"Dogs",num_other_pets:"All Other Pets"}[e]||e}renderRentableItemRow(e){const t=this.selectedRentableItems.some(t=>t.type===e.type);return B`
4116
4140
  <div class="rentable-item-row">
4117
4141
  <div class="rentable-item-info">
4118
4142
  <div class="rentable-item-label">${e.description}</div>
@@ -4168,7 +4192,7 @@ xmlns="http://www.w3.org/2000/svg"
4168
4192
  </div>
4169
4193
  `:""}
4170
4194
  </div>
4171
- `}};Po.styles=u`
4195
+ `}};_o.styles=u`
4172
4196
  .charge-inputs-container {
4173
4197
  background: white;
4174
4198
  border-radius: 8px;
@@ -4305,7 +4329,7 @@ xmlns="http://www.w3.org/2000/svg"
4305
4329
  opacity: 0.5;
4306
4330
  cursor: not-allowed;
4307
4331
  }
4308
- `,Oo([ue({type:Object})],Po.prototype,"chargeInputs",void 0),Oo([ue()],Po.prototype,"onChargeInputsChange",void 0),Oo([ue({type:Boolean})],Po.prototype,"disabled",void 0),Oo([ue({type:Array})],Po.prototype,"rentableItems",void 0),Oo([ue({type:Array})],Po.prototype,"selectedRentableItems",void 0),Oo([ue()],Po.prototype,"onRentableItemAdd",void 0),Oo([ue()],Po.prototype,"onRentableItemRemove",void 0),Po=Oo([se("charge-inputs")],Po);const Io=u`
4332
+ `,To([ue({type:Object})],_o.prototype,"chargeInputs",void 0),To([ue()],_o.prototype,"onChargeInputsChange",void 0),To([ue({type:Boolean})],_o.prototype,"disabled",void 0),To([ue({type:Array})],_o.prototype,"rentableItems",void 0),To([ue({type:Array})],_o.prototype,"selectedRentableItems",void 0),To([ue()],_o.prototype,"onRentableItemAdd",void 0),To([ue()],_o.prototype,"onRentableItemRemove",void 0),_o=To([se("charge-inputs")],_o);const Oo=u`
4309
4333
  :host {
4310
4334
  --skeleton-bg-color: #eaeaea;
4311
4335
  --skeleton-highlight-color: #f5f5f5;
@@ -4319,8 +4343,8 @@ xmlns="http://www.w3.org/2000/svg"
4319
4343
  background-position: 200px 0;
4320
4344
  }
4321
4345
  }
4322
- `,Mo=u`
4323
- ${Io}
4346
+ `,Po=u`
4347
+ ${Oo}
4324
4348
 
4325
4349
  :host {
4326
4350
  display: block;
@@ -4385,8 +4409,8 @@ xmlns="http://www.w3.org/2000/svg"
4385
4409
  margin-bottom: 10px;
4386
4410
  }
4387
4411
  }
4388
- `,No=u`
4389
- ${Io}
4412
+ `,Io=u`
4413
+ ${Oo}
4390
4414
 
4391
4415
  :host {
4392
4416
  display: block;
@@ -4408,16 +4432,34 @@ xmlns="http://www.w3.org/2000/svg"
4408
4432
  box-sizing: border-box;
4409
4433
  }
4410
4434
  }
4411
- `;var Do=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Lo=class extends oe{constructor(){super(...arguments),this.rows=2,this.header=!0}render(){return B`
4435
+ `;var Mo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let No=class extends oe{constructor(){super(...arguments),this.rows=2,this.header=!0}render(){return B`
4412
4436
  <div class="skeleton-card">
4413
4437
  ${this.header?B`<div class="skeleton-header"></div>`:""}
4414
4438
  ${Array(this.rows).fill(0).map(()=>B`<div class="skeleton-row"></div>`)}
4415
4439
  </div>
4416
- `}};Lo.styles=Mo,Do([ue({type:Number})],Lo.prototype,"rows",void 0),Do([ue({type:Boolean})],Lo.prototype,"header",void 0),Lo=Do([se("skeleton-card")],Lo);var Uo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Ro=class extends oe{constructor(){super(...arguments),this.cards=3,this.rowsPerCard=[3,2,1]}render(){return B`
4440
+ `}};No.styles=Po,Mo([ue({type:Number})],No.prototype,"rows",void 0),Mo([ue({type:Boolean})],No.prototype,"header",void 0),No=Mo([se("skeleton-card")],No);var Do=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Lo=class extends oe{constructor(){super(...arguments),this.cards=3,this.rowsPerCard=[3,2,1]}render(){return B`
4417
4441
  <div class="skeleton-loader">
4418
4442
  ${Array.from({length:this.cards},(e,t)=>{const n=Array.isArray(this.rowsPerCard)?this.rowsPerCard[t]||2:this.rowsPerCard;return B`<skeleton-card .rows=${n}></skeleton-card>`})}
4419
4443
  </div>
4420
- `}};Ro.styles=No,Uo([ue({type:Number})],Ro.prototype,"cards",void 0),Uo([ue({type:Array})],Ro.prototype,"rowsPerCard",void 0),Ro=Uo([se("skeleton-loader")],Ro);var Bo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let jo=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.showSkeletonLoader=!1,this.selectedUnit=null,this.quote=null,this.layoutOptions=[],this.selectedLayoutIds=[eo],this.groupedFees={[qr.ONE_TIME]:[],[qr.MONTHLY]:[],[qr.WEEKLY]:[],[qr.BI_WEEKLY]:[],[qr.ANNUALLY]:[],[qr.DAILY]:[],[qr.AS_NEEDED]:[],[qr.NEVER]:[]},this.rentableItems=[],this.units=[],this.isLoadingUnits=!1,this.onSelectLayout=null,this.onUnitSelect=null,this.onMoveInDateChange=null,this.onLeaseTermChange=null,this.chargeInputs={base_rent:0,num_pets:0,num_vehicles:0,num_applicants:1},this.onChargeInputsChange=null,this.selectedRentableItems=[],this.onRentableItemAdd=null,this.onRentableItemRemove=null}get rentAsFeeQuote(){var e,t;return(null===(e=this.quote)||void 0===e?void 0:e.rentCost)?{marketableFee:{id:"rent",buildingId:this.quote.buildingId||0,feeName:"Rent",amount:this.quote.rentCost,amountDisplay:En(this.quote.rentCost,2),minEstimate:null,maxEstimate:null,percentRentMin:null,percentRentMax:null,percentRent:null,frequency:_o.MONTHLY,category:"Rent",hiddenReason:null,description:`Unit ${null===(t=this.selectedUnit)||void 0===t?void 0:t.unitNumber}`,additionalInfo:null,refundable:!1,unitIds:null,layoutIds:null,startDate:null,endDate:null,triggeredByEvent:null,externalKey:null,chargeCode:null,bundleKey:null,source:null,publicFacing:!0,perApplicant:!1,prorated:null,syncActive:!0},amountRange:{fixedValue:this.quote.rentCost,minValue:null,maxValue:null},chargeInputs:{baseRent:this.quote.rentCost,numPets:0,numDogs:0,numCats:0,numOtherPets:0,numVehicles:0,numApplicants:1,unitId:this.quote.unitId,layoutId:null},isAddon:!1}:null}renderRecurringFeeSection(e,t){return(null==t?void 0:t.length)?B` <fee-card .fees=${t} title=${e}></fee-card> `:null}renderFeeSections(){var e,t;const n=[],i=[{freq:_o.ANNUALLY,title:"Yearly Charges"},{freq:_o.MONTHLY,title:"Monthly Charges"},{freq:_o.BI_WEEKLY,title:"Bi-Weekly Charges"},{freq:_o.WEEKLY,title:"Weekly Charges"},{freq:_o.DAILY,title:"Daily Charges"},{freq:_o.ONE_TIME,title:"One-Time"},{freq:_o.NEVER,title:"No Charges"}],r=null===(e=this.quote)||void 0===e?void 0:e.feeQuotes;for(const{freq:e,title:o}of i){if(!(null==r?void 0:r.length)&&e!==_o.MONTHLY)continue;let i=null!==(t=null==r?void 0:r.filter(t=>{var n,i;if((null===(n=t.marketableFee)||void 0===n?void 0:n.frequency)===e){if(e===_o.ONE_TIME){return["APPLICATION_SUBMISSION","APPLICATION_APPROVAL","LEASE_SIGNING","MOVE_IN"].includes((null===(i=t.marketableFee)||void 0===i?void 0:i.triggeredByEvent)||"")}return!0}return!!t.sourceRentableItem&&("monthly"===t.sourceRentableItem.rentFrequency&&e===_o.MONTHLY||"annually"===t.sourceRentableItem.rentFrequency&&e===_o.ANNUALLY)}))&&void 0!==t?t:[];if(e===_o.MONTHLY){const e=this.rentAsFeeQuote;e&&(i=[e,...i])}const a=this.renderRecurringFeeSection(o,i);a&&n.push(a)}return n}renderTotalCost(){var e;if(!(null===(e=this.quote)||void 0===e?void 0:e.totalMonthlyCost))return null;const t=this.quote.totalMonthlyCost.fixedValue;return t?B`
4444
+ `}};Lo.styles=Io,Do([ue({type:Number})],Lo.prototype,"cards",void 0),Do([ue({type:Array})],Lo.prototype,"rowsPerCard",void 0),Lo=Do([se("skeleton-loader")],Lo);var Uo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Ro=class extends oe{constructor(){super(...arguments),this.size=64,this.spinSpeed=.8}updated(){this.style.setProperty("--mega-loader-size",`${this.size}px`),this.style.setProperty("--mega-loader-spin-speed",`${this.spinSpeed}s`)}render(){return B`<div class="spinner"></div>`}};Ro.styles=u`
4445
+ .spinner {
4446
+ border: 4px solid rgba(0, 0, 0, 0.2);
4447
+ border-top: 4px solid var(--primary-color, #c057ff);
4448
+ border-radius: 50%;
4449
+ width: var(--mega-loader-size, 64px);
4450
+ height: var(--mega-loader-size, 64px);
4451
+ animation: spin var(--mega-loader-spin-speed, 0.8s) linear infinite;
4452
+ }
4453
+
4454
+ @keyframes spin {
4455
+ 0% {
4456
+ transform: rotate(0deg);
4457
+ }
4458
+ 100% {
4459
+ transform: rotate(360deg);
4460
+ }
4461
+ }
4462
+ `,Uo([ue({type:Number})],Ro.prototype,"size",void 0),Uo([ue({type:Number})],Ro.prototype,"spinSpeed",void 0),Ro=Uo([se("mega-loader")],Ro);var Bo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let jo=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.showSkeletonLoader=!1,this.selectedUnit=null,this.quote=null,this.layoutOptions=[],this.selectedLayoutIds=[eo],this.groupedFees={[qr.ONE_TIME]:[],[qr.MONTHLY]:[],[qr.WEEKLY]:[],[qr.BI_WEEKLY]:[],[qr.ANNUALLY]:[],[qr.DAILY]:[],[qr.AS_NEEDED]:[],[qr.NEVER]:[]},this.rentableItems=[],this.units=[],this.isLoadingUnits=!1,this.isLoadingLayouts=!1,this.onSelectLayout=null,this.onUnitSelect=null,this.onMoveInDateChange=null,this.onLeaseTermChange=null,this.chargeInputs={base_rent:0,num_pets:0,num_vehicles:0,num_applicants:1},this.onChargeInputsChange=null,this.selectedRentableItems=[],this.onRentableItemAdd=null,this.onRentableItemRemove=null}get rentAsFeeQuote(){var e,t;return(null===(e=this.quote)||void 0===e?void 0:e.rentCost)?{marketableFee:{id:"rent",buildingId:this.quote.buildingId||0,feeName:"Rent",amount:this.quote.rentCost,amountDisplay:En(this.quote.rentCost,2),minEstimate:null,maxEstimate:null,percentRentMin:null,percentRentMax:null,percentRent:null,frequency:ko.MONTHLY,category:"Rent",hiddenReason:null,description:`Unit ${null===(t=this.selectedUnit)||void 0===t?void 0:t.unitNumber}`,additionalInfo:null,refundable:!1,unitIds:null,layoutIds:null,startDate:null,endDate:null,triggeredByEvent:null,externalKey:null,chargeCode:null,bundleKey:null,source:null,publicFacing:!0,perApplicant:!1,prorated:null,syncActive:!0},amountRange:{fixedValue:this.quote.rentCost,minValue:null,maxValue:null},chargeInputs:{baseRent:this.quote.rentCost,numPets:0,numDogs:0,numCats:0,numOtherPets:0,numVehicles:0,numApplicants:1,unitId:this.quote.unitId,layoutId:null},isAddon:!1}:null}renderRecurringFeeSection(e,t){return(null==t?void 0:t.length)?B` <fee-card .fees=${t} title=${e}></fee-card> `:null}renderFeeSections(){var e,t;const n=[],i=[{freq:ko.ANNUALLY,title:"Yearly Charges"},{freq:ko.MONTHLY,title:"Monthly Charges"},{freq:ko.BI_WEEKLY,title:"Bi-Weekly Charges"},{freq:ko.WEEKLY,title:"Weekly Charges"},{freq:ko.DAILY,title:"Daily Charges"},{freq:ko.ONE_TIME,title:"One-Time"},{freq:ko.NEVER,title:"No Charges"}],r=null===(e=this.quote)||void 0===e?void 0:e.feeQuotes;for(const{freq:e,title:o}of i){if(!(null==r?void 0:r.length)&&e!==ko.MONTHLY)continue;let i=null!==(t=null==r?void 0:r.filter(t=>{var n,i;if((null===(n=t.marketableFee)||void 0===n?void 0:n.frequency)===e){if(e===ko.ONE_TIME){return["APPLICATION_SUBMISSION","APPLICATION_APPROVAL","LEASE_SIGNING","MOVE_IN"].includes((null===(i=t.marketableFee)||void 0===i?void 0:i.triggeredByEvent)||"")}return!0}return!!t.sourceRentableItem&&("monthly"===t.sourceRentableItem.rentFrequency&&e===ko.MONTHLY||"annually"===t.sourceRentableItem.rentFrequency&&e===ko.ANNUALLY)}))&&void 0!==t?t:[];if(e===ko.MONTHLY){const e=this.rentAsFeeQuote;e&&(i=[e,...i])}const a=this.renderRecurringFeeSection(o,i);a&&n.push(a)}return n}renderTotalCost(){var e;if(!(null===(e=this.quote)||void 0===e?void 0:e.totalMonthlyCost))return null;const t=this.quote.totalMonthlyCost.fixedValue;return t?B`
4421
4463
  <div class="total-cost-section">
4422
4464
  <div class="total-cost-row">
4423
4465
  <span class="total-cost-label">Total Monthly Cost:</span>
@@ -4449,6 +4491,7 @@ xmlns="http://www.w3.org/2000/svg"
4449
4491
  .selectedLayoutIds=${this.selectedLayoutIds}
4450
4492
  .units=${this.units}
4451
4493
  .isLoading=${this.isLoadingUnits}
4494
+ .isLoadingLayouts=${this.isLoadingLayouts}
4452
4495
  .onSelectLayout=${this.onSelectLayout}
4453
4496
  .onUnitSelect=${this.onUnitSelect}
4454
4497
  .onMoveInDateChange=${this.onMoveInDateChange}
@@ -4472,7 +4515,7 @@ xmlns="http://www.w3.org/2000/svg"
4472
4515
 
4473
4516
  ${this.renderFeesContent()}
4474
4517
  </div>
4475
- `}};jo.styles=To,Bo([ue({type:String})],jo.prototype,"buildingSlug",void 0),Bo([ue({type:Boolean})],jo.prototype,"showSkeletonLoader",void 0),Bo([ue({type:Object})],jo.prototype,"selectedUnit",void 0),Bo([ue({type:Object})],jo.prototype,"quote",void 0),Bo([ue({type:Array})],jo.prototype,"layoutOptions",void 0),Bo([ue({type:Array})],jo.prototype,"selectedLayoutIds",void 0),Bo([ue({type:Object})],jo.prototype,"groupedFees",void 0),Bo([ue({type:Array})],jo.prototype,"rentableItems",void 0),Bo([ue({type:Array})],jo.prototype,"units",void 0),Bo([ue({type:Boolean})],jo.prototype,"isLoadingUnits",void 0),Bo([ue()],jo.prototype,"onSelectLayout",void 0),Bo([ue()],jo.prototype,"onUnitSelect",void 0),Bo([ue()],jo.prototype,"onMoveInDateChange",void 0),Bo([ue()],jo.prototype,"onLeaseTermChange",void 0),Bo([ue({type:Object})],jo.prototype,"chargeInputs",void 0),Bo([ue()],jo.prototype,"onChargeInputsChange",void 0),Bo([ue({type:Array})],jo.prototype,"selectedRentableItems",void 0),Bo([ue()],jo.prototype,"onRentableItemAdd",void 0),Bo([ue()],jo.prototype,"onRentableItemRemove",void 0),jo=Bo([se("fee-calculator-layout")],jo);var Fo,Ho,$o,zo;!function(e){e.OneTime="OneTime",e.Daily="Daily",e.Weekly="Weekly",e.BiWeekly="BiWeekly",e.Monthly="Monthly",e.Yearly="Yearly",e.Unknown="Unknown"}(Fo||(Fo={})),function(e){e.Debit="Debit",e.Credit="Credit"}(Ho||(Ho={})),function(e){e.Fixed="Fixed",e.UsageBased="UsageBased",e.Varies="Varies"}($o||($o={})),function(e){e.AdminFee="AdminFee",e.ApplicationFee="ApplicationFee",e.Concession="Concession",e.Insurance="Insurance",e.LateFee="LateFee",e.Legal="Legal",e.NonSufficientFundFee="NSF",e.Other="Other",e.Parking="Parking",e.Penalty="Penalty",e.Pest="Pest",e.PetDeposit="PetDeposit",e.PetRent="PetRent",e.Refund="Refund",e.Relet="Relet",e.Rent="Rent",e.SecurityDeposit="SecurityDeposit",e.Storage="Storage",e.Trash="Trash",e.Utility="Utility",e.WaterSewer="WaterSewer"}(zo||(zo={}));const Go=u`
4518
+ `}};jo.styles=Eo,Bo([ue({type:String})],jo.prototype,"buildingSlug",void 0),Bo([ue({type:Boolean})],jo.prototype,"showSkeletonLoader",void 0),Bo([ue({type:Object})],jo.prototype,"selectedUnit",void 0),Bo([ue({type:Object})],jo.prototype,"quote",void 0),Bo([ue({type:Array})],jo.prototype,"layoutOptions",void 0),Bo([ue({type:Array})],jo.prototype,"selectedLayoutIds",void 0),Bo([ue({type:Object})],jo.prototype,"groupedFees",void 0),Bo([ue({type:Array})],jo.prototype,"rentableItems",void 0),Bo([ue({type:Array})],jo.prototype,"units",void 0),Bo([ue({type:Boolean})],jo.prototype,"isLoadingUnits",void 0),Bo([ue({type:Boolean})],jo.prototype,"isLoadingLayouts",void 0),Bo([ue()],jo.prototype,"onSelectLayout",void 0),Bo([ue()],jo.prototype,"onUnitSelect",void 0),Bo([ue()],jo.prototype,"onMoveInDateChange",void 0),Bo([ue()],jo.prototype,"onLeaseTermChange",void 0),Bo([ue({type:Object})],jo.prototype,"chargeInputs",void 0),Bo([ue()],jo.prototype,"onChargeInputsChange",void 0),Bo([ue({type:Array})],jo.prototype,"selectedRentableItems",void 0),Bo([ue()],jo.prototype,"onRentableItemAdd",void 0),Bo([ue()],jo.prototype,"onRentableItemRemove",void 0),jo=Bo([se("fee-calculator-layout")],jo);var Fo,Ho,$o,zo;!function(e){e.OneTime="OneTime",e.Daily="Daily",e.Weekly="Weekly",e.BiWeekly="BiWeekly",e.Monthly="Monthly",e.Yearly="Yearly",e.Unknown="Unknown"}(Fo||(Fo={})),function(e){e.Debit="Debit",e.Credit="Credit"}(Ho||(Ho={})),function(e){e.Fixed="Fixed",e.UsageBased="UsageBased",e.Varies="Varies"}($o||($o={})),function(e){e.AdminFee="AdminFee",e.ApplicationFee="ApplicationFee",e.Concession="Concession",e.Insurance="Insurance",e.LateFee="LateFee",e.Legal="Legal",e.NonSufficientFundFee="NSF",e.Other="Other",e.Parking="Parking",e.Penalty="Penalty",e.Pest="Pest",e.PetDeposit="PetDeposit",e.PetRent="PetRent",e.Refund="Refund",e.Relet="Relet",e.Rent="Rent",e.SecurityDeposit="SecurityDeposit",e.Storage="Storage",e.Trash="Trash",e.Utility="Utility",e.WaterSewer="WaterSewer"}(zo||(zo={}));const Go=u`
4476
4519
  :host {
4477
4520
  display: block;
4478
4521
  --table-header-bg: white;
@@ -4819,7 +4862,7 @@ xmlns="http://www.w3.org/2000/svg"
4819
4862
  </p>
4820
4863
  </div>
4821
4864
  </div>
4822
- `:B``}};ia.styles=ta,na([ue({type:Object})],ia.prototype,"incentive",void 0),ia=na([se("incentive-banner")],ia);var ra=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let oa=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.primaryColor=Ue,this.backgroundColor=Re,this.onCloseClicked=null,this.onClickEmailOption=null,this.onClickPhoneOption=null,this.onClickSSTOption=null,this.onClickTextUsOption=null,this.isFirstCalculation=!0,this.isCalculatingQuote=!1,this.isExporting=!1,this.selectedLayoutIds=[eo],this.selectedUnit=null,this.chargeInputs={base_rent:0,num_pets:0,num_vehicles:0,num_applicants:1,num_cats:0,num_dogs:0,num_other_pets:0},this.desiredRentableItems=[],this.moveInDateString=pn.toISOString().split("T")[0],this.leaseTerm=12,this.buildingWebchatView=null,this.incentives=[],this.quote=null,this.pdfUrl=null,this.groupedFees={[qr.ONE_TIME]:[],[qr.MONTHLY]:[],[qr.WEEKLY]:[],[qr.BI_WEEKLY]:[],[qr.ANNUALLY]:[],[qr.DAILY]:[],[qr.AS_NEEDED]:[],[qr.NEVER]:[]},this.rentableItems=[],this.units=[],this.isLoadingUnits=!0,this.quoteAbortController=null,this.quoteDebounceTimer=null,this.startQuoteApiCall=async()=>{var e;null===(e=this.quoteAbortController)||void 0===e||e.abort(),this.quoteAbortController=new AbortController,this.isCalculatingQuote=!0,await this.performQuoteCalculation(this.quoteAbortController.signal)},this.firstUpdated=async()=>{this.style.setProperty("--primary-color",this.primaryColor),this.style.setProperty("--background-color",this.backgroundColor),await this.setupCalculator(),await this.fetchUnits()},this.setupCalculator=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const[e,t]=await Promise.all([Ui(this.orgSlug,this.buildingSlug),Jr(this.buildingSlug)]);e&&t&&(this.buildingWebchatView=e,this.groupedFees=this.groupFees(t.fees),this.rentableItems=t.rentableItems)},this.requestQuoteCalculation=()=>{if(this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),!this.selectedUnit||!this.moveInDateString)return this.quote=null,this.pdfUrl=null,void(this.isCalculatingQuote=!1);this.quoteDebounceTimer=window.setTimeout(()=>{this.startQuoteApiCall(),this.quoteDebounceTimer=null},1e3)},this.handleUnitSelect=e=>{const t=!this.selectedUnit;if(this.isFirstCalculation=!0,this.selectedUnit=e,t)return this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),this.isCalculatingQuote=!0,void this.startQuoteApiCall();this.requestQuoteCalculation()},this.handleMoveInDateChange=async e=>{this.moveInDateString=e,this.quote=null,this.pdfUrl=null,await this.fetchUnits(),this.selectedUnit&&this.requestQuoteCalculation()},this.handleLeaseTermChange=async e=>{this.leaseTerm=e,this.quote=null,this.pdfUrl=null,await this.fetchUnits(),this.selectedUnit&&this.requestQuoteCalculation()},this.handleChargeInputsChange=e=>{this.chargeInputs={...this.chargeInputs,...e},this.requestQuoteCalculation()},this.handleRentableItemAdd=e=>{this.desiredRentableItems.some(t=>t.id===e.id)||this.desiredRentableItems.push(e),this.requestQuoteCalculation()},this.handleRentableItemRemove=e=>{this.desiredRentableItems=this.desiredRentableItems.filter(t=>t.id!==e.id),this.requestQuoteCalculation()},this.groupFees=e=>e.reduce((e,t)=>{const n=t.frequency||qr.ONE_TIME;return e[n]=[...e[n]||[],t],e},{}),this.handleClickEmailOption=e=>{this.handleClose(),this.onClickEmailOption&&this.onClickEmailOption(e)},this.handleClickPhoneOption=e=>{this.handleClose(),this.onClickPhoneOption&&this.onClickPhoneOption(e)},this.handleClickSSTOption=e=>{this.handleClose(),this.onClickSSTOption&&this.onClickSSTOption(e)},this.handleClickTextUsOption=e=>{this.handleClose(),this.onClickTextUsOption&&this.onClickTextUsOption(e)},this.handleClose=()=>{var e;null===(e=this.onCloseClicked)||void 0===e||e.call(this)},this.handleSelectLayout=async e=>{this.selectedLayoutIds=e,await this.fetchUnits()},this.handleShare=async()=>{var e,t;this.selectedUnit&&this.moveInDateString&&this.pdfUrl&&(ai("feeCalculatorPdfDownloaded",{buildingSlug:this.buildingSlug,quoteId:null!==(t=null===(e=this.quote)||void 0===e?void 0:e.id)&&void 0!==t?t:null}),window.open(this.pdfUrl,"_blank"))},this.fetchUnits=async()=>{let e;this.isLoadingUnits=!0,this.selectedLayoutIds.includes(eo)||(e=this.selectedLayoutIds.map(e=>{return 0===(t=e)?0:Math.floor(t/10);var t}));try{if(this.units=await oo({buildingSlug:this.buildingSlug,moveInDateEarliestString:this.moveInDateString,...e?{numBedrooms:e}:{},leaseTermMin:this.leaseTerm}),this.selectedUnit){this.units.some(e=>{var t;return e.id===(null===(t=this.selectedUnit)||void 0===t?void 0:t.id)})||(this.selectedUnit=null,this.quote=null,this.pdfUrl=null)}}finally{this.isLoadingUnits=!1}}}async performQuoteCalculation(e){if(!this.selectedUnit||!this.moveInDateString)return this.quote=null,this.pdfUrl=null,void(this.isCalculatingQuote=!1);const t=dn(Rn(this.moveInDateString),Rn(this.selectedUnit.earliestAvailable))?this.selectedUnit.earliestAvailable:this.moveInDateString,n=this.selectedUnit.id,i=this.leaseTerm;try{const r=await no({buildingSlug:this.buildingSlug,unitId:n,chargeInputs:this.chargeInputs,rentableItems:this.desiredRentableItems,leaseTerm:i,moveInDate:t},e);this.quote=r.quote,this.pdfUrl=r.pdfUrl||null,this.quote&&ai("feeCalculatorQuoteGenerated",{buildingSlug:this.buildingSlug,unitId:n,leaseTerm:i})}catch(e){"AbortError"!==(null==e?void 0:e.name)&&(this.quote=null,this.pdfUrl=null,this.isCalculatingQuote=!1,Ai({logType:xi.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_CALCULATING_QUOTE]",logData:{error:e}}))}finally{e.aborted||(this.isCalculatingQuote=!1,this.isFirstCalculation=!1)}}get layouts(){var e,t;return null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.layoutOptions)&&void 0!==t?t:[]}updated(e){(e.has("primaryColor")||e.has("backgroundColor"))&&(this.style.setProperty("--primary-color",this.primaryColor),this.style.setProperty("--background-color",this.backgroundColor))}disconnectedCallback(){var e;super.disconnectedCallback(),this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),null===(e=this.quoteAbortController)||void 0===e||e.abort(),this.quoteAbortController=null}render(){var e,t;const n=this.isCalculatingQuote&&!this.isExporting&&!this.isFirstCalculation,i=this.isExporting||this.isCalculatingQuote||!this.selectedUnit||!this.moveInDateString||!this.pdfUrl;return B`
4865
+ `:B``}};ia.styles=ta,na([ue({type:Object})],ia.prototype,"incentive",void 0),ia=na([se("incentive-banner")],ia);var ra=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let oa=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.primaryColor=Ue,this.backgroundColor=Re,this.onCloseClicked=null,this.onClickEmailOption=null,this.onClickPhoneOption=null,this.onClickSSTOption=null,this.onClickTextUsOption=null,this.isCalculatingQuote=!1,this.isLoadingLayouts=!0,this.isExporting=!1,this.selectedLayoutIds=[eo],this.selectedUnit=null,this.chargeInputs={base_rent:0,num_pets:0,num_vehicles:0,num_applicants:1,num_cats:0,num_dogs:0,num_other_pets:0},this.desiredRentableItems=[],this.moveInDateString=pn.toISOString().split("T")[0],this.leaseTerm=12,this.buildingWebchatView=null,this.incentives=[],this.quote=null,this.pdfUrl=null,this.groupedFees={[qr.ONE_TIME]:[],[qr.MONTHLY]:[],[qr.WEEKLY]:[],[qr.BI_WEEKLY]:[],[qr.ANNUALLY]:[],[qr.DAILY]:[],[qr.AS_NEEDED]:[],[qr.NEVER]:[]},this.rentableItems=[],this.units=[],this.isLoadingUnits=!0,this.quoteAbortController=null,this.quoteDebounceTimer=null,this.startQuoteApiCall=async()=>{var e;null===(e=this.quoteAbortController)||void 0===e||e.abort(),this.quoteAbortController=new AbortController,this.isCalculatingQuote=!0,await this.performQuoteCalculation(this.quoteAbortController.signal)},this.firstUpdated=async()=>{this.style.setProperty("--primary-color",this.primaryColor),this.style.setProperty("--background-color",this.backgroundColor),await Promise.allSettled([this.setupCalculator(),this.fetchUnits()])},this.setupCalculator=async()=>{if(!this.buildingSlug||!this.orgSlug)return void(this.isLoadingLayouts=!1);const e=Ui(this.orgSlug,this.buildingSlug).then(e=>{e&&(this.buildingWebchatView=e)}).finally(()=>{this.isLoadingLayouts=!1}),t=Jr(this.buildingSlug).then(e=>{e&&(this.groupedFees=this.groupFees(e.fees),this.rentableItems=e.rentableItems)});await Promise.allSettled([e,t])},this.requestQuoteCalculation=()=>{if(this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),!this.selectedUnit||!this.moveInDateString)return this.quote=null,this.pdfUrl=null,void(this.isCalculatingQuote=!1);this.quoteDebounceTimer=window.setTimeout(()=>{this.startQuoteApiCall(),this.quoteDebounceTimer=null},1e3)},this.handleUnitSelect=e=>{const t=!this.selectedUnit;if(this.selectedUnit=e,t)return this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),this.isCalculatingQuote=!0,void this.startQuoteApiCall();this.requestQuoteCalculation()},this.handleMoveInDateChange=async e=>{this.moveInDateString=e,this.quote=null,this.pdfUrl=null,await this.fetchUnits(),this.selectedUnit&&this.requestQuoteCalculation()},this.handleLeaseTermChange=async e=>{this.leaseTerm=e,this.quote=null,this.pdfUrl=null,await this.fetchUnits(),this.selectedUnit&&this.requestQuoteCalculation()},this.handleChargeInputsChange=e=>{this.chargeInputs={...this.chargeInputs,...e},this.requestQuoteCalculation()},this.handleRentableItemAdd=e=>{this.desiredRentableItems.some(t=>t.id===e.id)||this.desiredRentableItems.push(e),this.requestQuoteCalculation()},this.handleRentableItemRemove=e=>{this.desiredRentableItems=this.desiredRentableItems.filter(t=>t.id!==e.id),this.requestQuoteCalculation()},this.groupFees=e=>e.reduce((e,t)=>{const n=t.frequency||qr.ONE_TIME;return e[n]=[...e[n]||[],t],e},{}),this.handleClickEmailOption=e=>{this.handleClose(),this.onClickEmailOption&&this.onClickEmailOption(e)},this.handleClickPhoneOption=e=>{this.handleClose(),this.onClickPhoneOption&&this.onClickPhoneOption(e)},this.handleClickSSTOption=e=>{this.handleClose(),this.onClickSSTOption&&this.onClickSSTOption(e)},this.handleClickTextUsOption=e=>{this.handleClose(),this.onClickTextUsOption&&this.onClickTextUsOption(e)},this.handleClose=()=>{var e;null===(e=this.onCloseClicked)||void 0===e||e.call(this)},this.handleSelectLayout=async e=>{this.selectedLayoutIds=e,await this.fetchUnits()},this.handleShare=async()=>{var e,t;this.selectedUnit&&this.moveInDateString&&this.pdfUrl&&(ai("feeCalculatorPdfDownloaded",{buildingSlug:this.buildingSlug,quoteId:null!==(t=null===(e=this.quote)||void 0===e?void 0:e.id)&&void 0!==t?t:null}),window.open(this.pdfUrl,"_blank"))},this.fetchUnits=async()=>{let e;this.isLoadingUnits=!0,this.selectedLayoutIds.includes(eo)||(e=this.selectedLayoutIds.map(e=>{return 0===(t=e)?0:Math.floor(t/10);var t}));try{if(this.units=await oo({buildingSlug:this.buildingSlug,moveInDateEarliestString:this.moveInDateString,...e?{numBedrooms:e}:{},leaseTermMin:this.leaseTerm}),this.selectedUnit){this.units.some(e=>{var t;return e.id===(null===(t=this.selectedUnit)||void 0===t?void 0:t.id)})||(this.selectedUnit=null,this.quote=null,this.pdfUrl=null)}}finally{this.isLoadingUnits=!1}}}async performQuoteCalculation(e){if(!this.selectedUnit||!this.moveInDateString)return this.quote=null,this.pdfUrl=null,void(this.isCalculatingQuote=!1);const t=dn(Rn(this.moveInDateString),Rn(this.selectedUnit.earliestAvailable))?this.selectedUnit.earliestAvailable:this.moveInDateString,n=this.selectedUnit.id,i=this.leaseTerm;try{const r=await no({buildingSlug:this.buildingSlug,unitId:n,chargeInputs:this.chargeInputs,rentableItems:this.desiredRentableItems,leaseTerm:i,moveInDate:t},e);this.quote=r.quote,this.pdfUrl=r.pdfUrl||null,this.quote&&ai("feeCalculatorQuoteGenerated",{buildingSlug:this.buildingSlug,unitId:n,leaseTerm:i})}catch(e){"AbortError"!==(null==e?void 0:e.name)&&(this.quote=null,this.pdfUrl=null,this.isCalculatingQuote=!1,Ai({logType:xi.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_CALCULATING_QUOTE]",logData:{error:e}}))}finally{e.aborted||(this.isCalculatingQuote=!1)}}get layouts(){var e,t;return null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.layoutOptions)&&void 0!==t?t:[]}updated(e){(e.has("primaryColor")||e.has("backgroundColor"))&&(this.style.setProperty("--primary-color",this.primaryColor),this.style.setProperty("--background-color",this.backgroundColor))}disconnectedCallback(){var e;super.disconnectedCallback(),this.quoteDebounceTimer&&(clearTimeout(this.quoteDebounceTimer),this.quoteDebounceTimer=null),null===(e=this.quoteAbortController)||void 0===e||e.abort(),this.quoteAbortController=null}render(){var e,t;const n=this.isExporting||this.isCalculatingQuote||!this.selectedUnit||!this.moveInDateString||!this.pdfUrl;return B`
4823
4866
  <div
4824
4867
  class="fee-calculator-container"
4825
4868
  @keydown=${e=>e.stopPropagation()}
@@ -4829,14 +4872,10 @@ xmlns="http://www.w3.org/2000/svg"
4829
4872
  <h1>Estimated Cost Calculator</h1>
4830
4873
 
4831
4874
  <div class="calculator-header-right">
4832
- ${n?B`<div class="recalculating-loader">
4833
- <mega-loader .size=${16} .spinSpeed=${.54}></mega-loader>
4834
- </div>`:""}
4835
-
4836
4875
  <button
4837
4876
  class="share-button"
4838
4877
  @click=${this.handleShare}
4839
- ?disabled=${i}
4878
+ ?disabled=${n}
4840
4879
  >
4841
4880
  ${this.isExporting?B`<mega-loader
4842
4881
  .size=${24}
@@ -4846,7 +4885,7 @@ xmlns="http://www.w3.org/2000/svg"
4846
4885
  <button
4847
4886
  class="apply-button"
4848
4887
  @click=${()=>{var e,t;window.open(null!==(t=null===(e=this.quote)||void 0===e?void 0:e.applicationLink)&&void 0!==t?t:"","_blank","noopener,noreferrer")}}
4849
- ?disabled=${!(null===(e=this.quote)||void 0===e?void 0:e.applicationLink)}
4888
+ ?disabled=${this.isCalculatingQuote||!(null===(e=this.quote)||void 0===e?void 0:e.applicationLink)}
4850
4889
  >
4851
4890
  Apply
4852
4891
  </button>
@@ -4875,7 +4914,7 @@ xmlns="http://www.w3.org/2000/svg"
4875
4914
 
4876
4915
  <fee-calculator-layout
4877
4916
  .buildingSlug=${this.buildingSlug}
4878
- .showSkeletonLoader=${this.isFirstCalculation}
4917
+ .showSkeletonLoader=${this.isCalculatingQuote}
4879
4918
  .selectedUnit=${this.selectedUnit}
4880
4919
  .groupedFees=${this.groupedFees}
4881
4920
  .rentableItems=${this.rentableItems}
@@ -4884,6 +4923,7 @@ xmlns="http://www.w3.org/2000/svg"
4884
4923
  .selectedLayoutIds=${this.selectedLayoutIds}
4885
4924
  .units=${this.units}
4886
4925
  .isLoadingUnits=${this.isLoadingUnits}
4926
+ .isLoadingLayouts=${this.isLoadingLayouts}
4887
4927
  .onSelectLayout=${this.handleSelectLayout}
4888
4928
  .onUnitSelect=${this.handleUnitSelect}
4889
4929
  .onMoveInDateChange=${this.handleMoveInDateChange}
@@ -4902,7 +4942,7 @@ xmlns="http://www.w3.org/2000/svg"
4902
4942
  </div>
4903
4943
  `:""}
4904
4944
  </div>
4905
- `}};oa.styles=zr,ra([ue({attribute:!0})],oa.prototype,"buildingSlug",void 0),ra([ue({attribute:!0})],oa.prototype,"orgSlug",void 0),ra([ue({type:String})],oa.prototype,"primaryColor",void 0),ra([ue({type:String})],oa.prototype,"backgroundColor",void 0),ra([ue()],oa.prototype,"onCloseClicked",void 0),ra([ue()],oa.prototype,"onClickEmailOption",void 0),ra([ue()],oa.prototype,"onClickPhoneOption",void 0),ra([ue()],oa.prototype,"onClickSSTOption",void 0),ra([ue()],oa.prototype,"onClickTextUsOption",void 0),ra([ce()],oa.prototype,"isFirstCalculation",void 0),ra([ce()],oa.prototype,"isCalculatingQuote",void 0),ra([ce()],oa.prototype,"isExporting",void 0),ra([ce()],oa.prototype,"selectedLayoutIds",void 0),ra([ce()],oa.prototype,"selectedUnit",void 0),ra([ce()],oa.prototype,"chargeInputs",void 0),ra([ce()],oa.prototype,"desiredRentableItems",void 0),ra([ce()],oa.prototype,"moveInDateString",void 0),ra([ce()],oa.prototype,"leaseTerm",void 0),ra([ce()],oa.prototype,"buildingWebchatView",void 0),ra([ce()],oa.prototype,"incentives",void 0),ra([ce()],oa.prototype,"quote",void 0),ra([ce()],oa.prototype,"pdfUrl",void 0),ra([ce()],oa.prototype,"groupedFees",void 0),ra([ce()],oa.prototype,"rentableItems",void 0),ra([ce()],oa.prototype,"units",void 0),ra([ce()],oa.prototype,"isLoadingUnits",void 0),oa=ra([se("fee-calculator")],oa);const aa=u`
4945
+ `}};oa.styles=zr,ra([ue({attribute:!0})],oa.prototype,"buildingSlug",void 0),ra([ue({attribute:!0})],oa.prototype,"orgSlug",void 0),ra([ue({type:String})],oa.prototype,"primaryColor",void 0),ra([ue({type:String})],oa.prototype,"backgroundColor",void 0),ra([ue()],oa.prototype,"onCloseClicked",void 0),ra([ue()],oa.prototype,"onClickEmailOption",void 0),ra([ue()],oa.prototype,"onClickPhoneOption",void 0),ra([ue()],oa.prototype,"onClickSSTOption",void 0),ra([ue()],oa.prototype,"onClickTextUsOption",void 0),ra([ce()],oa.prototype,"isCalculatingQuote",void 0),ra([ce()],oa.prototype,"isLoadingLayouts",void 0),ra([ce()],oa.prototype,"isExporting",void 0),ra([ce()],oa.prototype,"selectedLayoutIds",void 0),ra([ce()],oa.prototype,"selectedUnit",void 0),ra([ce()],oa.prototype,"chargeInputs",void 0),ra([ce()],oa.prototype,"desiredRentableItems",void 0),ra([ce()],oa.prototype,"moveInDateString",void 0),ra([ce()],oa.prototype,"leaseTerm",void 0),ra([ce()],oa.prototype,"buildingWebchatView",void 0),ra([ce()],oa.prototype,"incentives",void 0),ra([ce()],oa.prototype,"quote",void 0),ra([ce()],oa.prototype,"pdfUrl",void 0),ra([ce()],oa.prototype,"groupedFees",void 0),ra([ce()],oa.prototype,"rentableItems",void 0),ra([ce()],oa.prototype,"units",void 0),ra([ce()],oa.prototype,"isLoadingUnits",void 0),oa=ra([se("fee-calculator")],oa);const aa=u`
4906
4946
  #minimize-mobile {
4907
4947
  position: absolute;
4908
4948
  top: -12px;
@@ -5634,7 +5674,7 @@ xmlns="http://www.w3.org/2000/svg"
5634
5674
  ${kr}
5635
5675
  ${Tr}
5636
5676
  ${_r}
5637
- `,Aa([ue({attribute:!0})],Sa.prototype,"isMinimized",void 0),Aa([ue()],Sa.prototype,"mobileStyles",void 0),Aa([ue({type:Boolean})],Sa.prototype,"isFirstMount",void 0),Aa([ue({attribute:!1})],Sa.prototype,"autoOpenChatWidget",void 0),Aa([ue()],Sa.prototype,"phoneNumber",void 0),Aa([ue({attribute:!0})],Sa.prototype,"buildingName",void 0),Aa([ue({attribute:!0})],Sa.prototype,"chatId",void 0),Aa([ue({attribute:!0})],Sa.prototype,"orgLegalName",void 0),Aa([ue({attribute:!0})],Sa.prototype,"chatCallUsHeader",void 0),Aa([ue({attribute:!1})],Sa.prototype,"buildingId",void 0),Aa([ue({attribute:!0})],Sa.prototype,"buildingSlug",void 0),Aa([ue({attribute:!0})],Sa.prototype,"orgSlug",void 0),Aa([ue({attribute:!0})],Sa.prototype,"sgtUrl",void 0),Aa([ue({attribute:!0})],Sa.prototype,"selfGuidedTourEnabled",void 0),Aa([ue({attribute:!0})],Sa.prototype,"selfGuidedToursTypeOffered",void 0),Aa([ue({attribute:!0})],Sa.prototype,"designConcept",void 0),Aa([ue({attribute:!0})],Sa.prototype,"featureFlagShowDropdown",void 0),Aa([ue({attribute:!1})],Sa.prototype,"leadSources",void 0),Aa([ue({attribute:!0})],Sa.prototype,"currentLeadSource",void 0),Aa([ue({attribute:!0})],Sa.prototype,"escortedToursLink",void 0),Aa([ue({attribute:!0})],Sa.prototype,"escortedToursTypeOffered",void 0),Aa([ue({attribute:!0})],Sa.prototype,"virtualToursLink",void 0),Aa([ue({attribute:!0})],Sa.prototype,"virtualToursTypeOffered",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasChatEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasChatEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasEmailEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasEmailEnabledMobile",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasApplyNowEnabledDesktop",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasApplyNowEnabledMobile",void 0),Aa([ue({attribute:!0})],Sa.prototype,"applicationLink",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasCallUsEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasCallUsEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasTextUsEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasTextUsEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasSSTEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasSSTEnabledMobile",void 0),Aa([ue({attribute:!1})],Sa.prototype,"tourTypeOptions",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasDynamicSchedulingEnabled",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasPricingCalculatorEnabledDesktop",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasPricingCalculatorEnabledMobile",void 0),Aa([ue({attribute:!1})],Sa.prototype,"hasHideMobileFeatures",void 0),Aa([ue({type:Number})],Sa.prototype,"right",void 0),Aa([ue({type:Number})],Sa.prototype,"bottom",void 0),Aa([ue({type:Number})],Sa.prototype,"top",void 0),Aa([ue({type:Number})],Sa.prototype,"left",void 0),Aa([ue({attribute:!0})],Sa.prototype,"showTourNextToChat",void 0),Aa([ue({attribute:!1})],Sa.prototype,"onChatTapped",void 0),Aa([ue({attribute:!0})],Sa.prototype,"onClickMinimize",void 0),Aa([ue({attribute:!0})],Sa.prototype,"onSstClose",void 0),Aa([ue({attribute:!0})],Sa.prototype,"overrideRentgrata",void 0),Aa([ue({attribute:!1})],Sa.prototype,"launcherStyles",void 0),Aa([ue({attribute:!0})],Sa.prototype,"primaryColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"backgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"leadSourceClient",void 0),Aa([ce()],Sa.prototype,"leadSourceMultitouchClient",void 0),Aa([ce()],Sa.prototype,"_isMobile",void 0),Aa([ce()],Sa.prototype,"isEmailWindowOpen",void 0),Aa([ce()],Sa.prototype,"isCallUsWindowOpen",void 0),Aa([ce()],Sa.prototype,"isSSTWindowOpen",void 0),Aa([ce()],Sa.prototype,"isTextUsWindowOpen",void 0),Aa([ce()],Sa.prototype,"isCalculatorWindowOpen",void 0),Aa([ce()],Sa.prototype,"isMobileFeaturesExpanded",void 0),Sa=Aa([se("meetelise-launcher")],Sa);const Ea=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Sa)},ka=["app.meetelise.com","staging.eliseai.com","localhost"],Ta={calculator:{desktop:"calcDesktop",mobile:"calcMobile"},email:{desktop:"emailDesktop",mobile:"emailMobile"},call:{desktop:"callDesktop",mobile:"callMobile"},text:{desktop:"textDesktop",mobile:"textMobile"},sst:{desktop:"sstDesktop",mobile:"sstMobile"}},_a=e=>{const t=window.location.hostname;if(!ka.includes(t))return e;const n=(e=>{if(!e)return{};try{return e.split(",").reduce((e,t)=>{const[n,i]=t.split(":");return n&&i&&n in Ta&&(e[n]="true"===i.toLowerCase()),e},{})}catch(e){return{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(n).length)return e;const i={...e};return Object.entries(n).forEach(([e,t])=>{const n=Ta[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var Oa=n(5072),Pa=n.n(Oa),Ia=n(7825),Ma=n.n(Ia),Na=n(7659),Da=n.n(Na),La=n(5056),Ua=n.n(La),Ra=n(540),Ba=n.n(Ra),ja=n(1113),Fa=n.n(ja),Ha=n(5541),$a={};$a.styleTagTransform=Fa(),$a.setAttributes=Ua(),$a.insert=Da().bind(null,"head"),$a.domAPI=Ma(),$a.insertStyleElement=Ba();Pa()(Ha.A,$a);Ha.A&&Ha.A.locals&&Ha.A.locals;async function za(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${t}/lead-sources`);if(n.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return n.data.filter(t=>e.includes(t))}return Ga(n.data,t)}return[]}catch(e){return[]}}const Ga=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter(e=>{const t=e.toLowerCase();return!n.map(e=>e.toLowerCase()).includes(t)})};var Qa,qa=n(8805),Wa=n.n(qa),Va=new Uint8Array(16);function Ya(){if(!Qa&&!(Qa="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qa(Va)}const Ka=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Xa=function(e){return"string"==typeof e&&Ka.test(e)};for(var Za=[],Ja=0;Ja<256;++Ja)Za.push((Ja+256).toString(16).substr(1));const es=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Za[e[t+0]]+Za[e[t+1]]+Za[e[t+2]]+Za[e[t+3]]+"-"+Za[e[t+4]]+Za[e[t+5]]+"-"+Za[e[t+6]]+Za[e[t+7]]+"-"+Za[e[t+8]]+Za[e[t+9]]+"-"+Za[e[t+10]]+Za[e[t+11]]+Za[e[t+12]]+Za[e[t+13]]+Za[e[t+14]]+Za[e[t+15]]).toLowerCase();if(!Xa(n))throw TypeError("Stringified UUID is invalid");return n};const ts=function(e,t,n){var i=(e=e||{}).random||(e.rng||Ya)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return es(i)},ns=e=>localStorage.removeItem("com.elise.webchat.slug="+e),is=(e,t,n)=>{const i=On(new Date),r=n||`lead_${ts()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Rn(i),buildingSlug:e,initiatedChat:t}},rs=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(os(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},os=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(dn(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!wn(t.timestamp,24)};var as;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(as||(as={}));const ss=e=>e.type===us.text,ls=e=>e.type===us.media;var us;!function(e){e.text="text",e.media="media"}(us||(us={}));const cs=class{constructor(e,t,n,i=null,r,o,a=null,s=lu.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=lu.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.sessionToken=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==as.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType){this.simpleChatMessages.some(e=>e.type===us.text&&e.message.includes("confirmed for your"))&&ai("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.streamingMessageTimeout=null,this.checkAndHandleDelayStreamingMessages=({delayToFetchHistoryInMs:e=1e4}={})=>{this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null);const t=this.simpleChatMessages.some(e=>{if(!ss(e))return!1;const t=e.chunks.find(e=>e.isDone);return!t||e.chunks.length===t.order});t&&(this.streamingMessageTimeout=setTimeout(()=>{Ai({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory()},e))},this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return!1}})(e.message.text))return;ai("leadProvidedEmail",{buildingId:null===(t=this.buildingWebchatView)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===as.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=is(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken(async()=>{var t,n,i,r,o,a,s,l,u;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout(()=>{this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})},9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),this.widgetType===lu.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):(await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),lead_sources_with_timestamps:(null!==(o=null===(r=this.leadSourceMultitouchClient)||void 0===r?void 0:r.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:null}))&&void 0!==o?o:[]).map(e=>gn({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(ai("firstChatMessageSent",{message:e,buildingId:null===(l=this.buildingWebchatView)||void 0===l?void 0:l.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),ai("chatMessageSent",{message:e,buildingId:null===(u=this.buildingWebchatView)||void 0===u?void 0:u.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))}),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.removeDuplicatedRawPubnubMessages=e=>{const t=new Set;return e.filter(e=>{if("lead_message"===e.message.customType||!e.message.stream_id||!e.message.order)return!0;const n=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(n)?(Ai({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(n),!0)})},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return this.removeDuplicatedRawPubnubMessages(e).forEach(e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:us.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:us.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]}),Object.keys(n).forEach(e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),o=r.map(e=>e.message.text).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map(e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}}),type:us.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)}),t.sort((e,t)=>e.timestamp-t.timestamp),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find(e=>e.message.is_done);return!t||e.length===t.message.order},this.buildingSlug=e,this.buildingWebchatView=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=a,this.leadSourceMultitouchClient=o,this.widgetType=s}async initSession(e,t){try{const n=await r().post(`${this.apiHost}/platformApi/webchat/init`,{building_slug:e,org_slug:t});return this.sessionToken=n.data.session_token,this.leadUserId=n.data.lead_id,this.channel=n.data.channel,n.data}catch(e){return this.buildingWebchatView&&Ai({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),null}}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(Wa())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken(()=>new Promise(()=>this.handleChatListeners())),await this.withAuthToken(()=>this.getChannelHistory()),this.pubnub):void 0}async fetchToken(e,t){try{if(this.sessionToken){const e="healthcare"===this.widgetType?"?industry=health_care":"";return(await r().get(`${this.apiHost}/platformApi/webchat/pn/v2/request-token${e}`,{headers:{"X-Session-Token":this.sessionToken}})).data}return(await r().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${t}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await r().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(e){try{await e()}catch(t){if(t instanceof i.AxiosError&&t&&t.response&&403===t.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const t=await this.fetchToken(this.leadUserId,this.channel);if(!t)return;this.pubnub.setAuthKey(t.auth.result.token),await e()}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},(e,t)=>{e.error?o(e):n(t)})}),a=o.channels[this.channel];if(!a)break;if(a.sort((e,t)=>+e.timetoken-+t.timetoken),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach(e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})}),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter(e=>e.message.messageType!==as.noReply))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},ds=new Set(["8009855990","8338526262","8002221222","8006624357","8002738255","8007997233","8007874889","8006564673","8004224453","8883737888","8006213362","8009506264","8558272736","8008435678","8007862929","8008523836","8007849433","8007729100","8006699777","8006858470","8004322209","8003473735","8008778339","8009552232","8002255342","8009272891","8003049320","8007937724","8002382333","8003353863","8776858878","8003329227","8776554371","8772944357","8772944356","6092925760","6092926735","8007928339","8008329173","8882853036","6092921210","8007929773","8003561561","8003826717","8005727233","8009291040","8888958179","8006879512","8004262537","8773475463","8774149251","8005103102","8889372835","8007010710","8007010720","8774288844","8007929745","8003283838","6092927060","6092928319","8008527899","8662401347","8009923678","8776522873","8776527624","8003313937","8008435437","8776536783","8778392339","8003676274","8006896411"]),hs=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return ds.has(t)},ps=(e,t,n)=>{try{const i=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1"),r=`tel:${i}`,o=`sms:${i}`,a=`whatsapp://send?phone=${i}`,s=`facetime:${i}`,l=`facetime-audio:${i}`,u=/(?:\+1[\s.-]?)?(?:\(\d{3}\)[\s.-]?|\d{3}[\s.-])\d{3}[\s.-]?\d{4}/g,c=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,d=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=/emergency|emergencia/i,f=300,g=e=>!(!e||e.length>f)&&p.test(e),m=e=>{var t,n,i,r;if(g(e.textContent))return!0;if(g(null===(t=e.previousElementSibling)||void 0===t?void 0:t.textContent)||g(null===(n=e.nextElementSibling)||void 0===n?void 0:n.textContent))return!0;const o=e.parentElement;return!(!o||!g(null===(i=o.previousElementSibling)||void 0===i?void 0:i.textContent)&&!g(null===(r=o.nextElementSibling)||void 0===r?void 0:r.textContent))},y=document.body.getElementsByTagName("*");let b=!1;const v=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let w=!1,C=!1,x=0;for(let e=0;e<y.length;e++)if(y[e].nodeType===Node.ELEMENT_NODE&&!m(y[e])){if(1===y[e].childNodes.length&&y[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=y[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(hs(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,y[e].textContent=n),b=!0,w||(w=!0)}if(y[e].hasAttribute("href")){const t=y[e].getAttribute("href");if(!t)continue;let n="",i=c;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=d):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,hs(t))continue;const u=t.replace(i,n);if(y[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&y[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t}),C&&Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t}),b||Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:xi.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:xi.error,buildingSlug:n,orgSlug:t}),0}};var fs=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let gs=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Ue,this.toExpand=!1}render(){return B`
5677
+ `,Aa([ue({attribute:!0})],Sa.prototype,"isMinimized",void 0),Aa([ue()],Sa.prototype,"mobileStyles",void 0),Aa([ue({type:Boolean})],Sa.prototype,"isFirstMount",void 0),Aa([ue({attribute:!1})],Sa.prototype,"autoOpenChatWidget",void 0),Aa([ue()],Sa.prototype,"phoneNumber",void 0),Aa([ue({attribute:!0})],Sa.prototype,"buildingName",void 0),Aa([ue({attribute:!0})],Sa.prototype,"chatId",void 0),Aa([ue({attribute:!0})],Sa.prototype,"orgLegalName",void 0),Aa([ue({attribute:!0})],Sa.prototype,"chatCallUsHeader",void 0),Aa([ue({attribute:!1})],Sa.prototype,"buildingId",void 0),Aa([ue({attribute:!0})],Sa.prototype,"buildingSlug",void 0),Aa([ue({attribute:!0})],Sa.prototype,"orgSlug",void 0),Aa([ue({attribute:!0})],Sa.prototype,"sgtUrl",void 0),Aa([ue({attribute:!0})],Sa.prototype,"selfGuidedTourEnabled",void 0),Aa([ue({attribute:!0})],Sa.prototype,"selfGuidedToursTypeOffered",void 0),Aa([ue({attribute:!0})],Sa.prototype,"designConcept",void 0),Aa([ue({attribute:!0})],Sa.prototype,"featureFlagShowDropdown",void 0),Aa([ue({attribute:!1})],Sa.prototype,"leadSources",void 0),Aa([ue({attribute:!0})],Sa.prototype,"currentLeadSource",void 0),Aa([ue({attribute:!0})],Sa.prototype,"escortedToursLink",void 0),Aa([ue({attribute:!0})],Sa.prototype,"escortedToursTypeOffered",void 0),Aa([ue({attribute:!0})],Sa.prototype,"virtualToursLink",void 0),Aa([ue({attribute:!0})],Sa.prototype,"virtualToursTypeOffered",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasChatEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasChatEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasEmailEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasEmailEnabledMobile",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasApplyNowEnabledDesktop",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasApplyNowEnabledMobile",void 0),Aa([ue({attribute:!0})],Sa.prototype,"applicationLink",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasCallUsEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasCallUsEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasTextUsEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasTextUsEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasSSTEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasSSTEnabledMobile",void 0),Aa([ue({attribute:!1})],Sa.prototype,"tourTypeOptions",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasDynamicSchedulingEnabled",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasPricingCalculatorEnabledDesktop",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasPricingCalculatorEnabledMobile",void 0),Aa([ue({attribute:!1})],Sa.prototype,"hasHideMobileFeatures",void 0),Aa([ue({type:Number})],Sa.prototype,"right",void 0),Aa([ue({type:Number})],Sa.prototype,"bottom",void 0),Aa([ue({type:Number})],Sa.prototype,"top",void 0),Aa([ue({type:Number})],Sa.prototype,"left",void 0),Aa([ue({attribute:!0})],Sa.prototype,"showTourNextToChat",void 0),Aa([ue({attribute:!1})],Sa.prototype,"onChatTapped",void 0),Aa([ue({attribute:!0})],Sa.prototype,"onClickMinimize",void 0),Aa([ue({attribute:!0})],Sa.prototype,"onSstClose",void 0),Aa([ue({attribute:!0})],Sa.prototype,"overrideRentgrata",void 0),Aa([ue({attribute:!1})],Sa.prototype,"launcherStyles",void 0),Aa([ue({attribute:!0})],Sa.prototype,"primaryColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"backgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"leadSourceClient",void 0),Aa([ce()],Sa.prototype,"leadSourceMultitouchClient",void 0),Aa([ce()],Sa.prototype,"_isMobile",void 0),Aa([ce()],Sa.prototype,"isEmailWindowOpen",void 0),Aa([ce()],Sa.prototype,"isCallUsWindowOpen",void 0),Aa([ce()],Sa.prototype,"isSSTWindowOpen",void 0),Aa([ce()],Sa.prototype,"isTextUsWindowOpen",void 0),Aa([ce()],Sa.prototype,"isCalculatorWindowOpen",void 0),Aa([ce()],Sa.prototype,"isMobileFeaturesExpanded",void 0),Sa=Aa([se("meetelise-launcher")],Sa);const Ea=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Sa)},ka=["app.meetelise.com","staging.eliseai.com","localhost"],Ta={calculator:{desktop:"calcDesktop",mobile:"calcMobile"},email:{desktop:"emailDesktop",mobile:"emailMobile"},call:{desktop:"callDesktop",mobile:"callMobile"},text:{desktop:"textDesktop",mobile:"textMobile"},sst:{desktop:"sstDesktop",mobile:"sstMobile"}},_a=e=>{const t=window.location.hostname;if(!ka.includes(t))return e;const n=(e=>{if(!e)return{};try{return e.split(",").reduce((e,t)=>{const[n,i]=t.split(":");return n&&i&&n in Ta&&(e[n]="true"===i.toLowerCase()),e},{})}catch(e){return{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(n).length)return e;const i={...e};return Object.entries(n).forEach(([e,t])=>{const n=Ta[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var Oa=n(5072),Pa=n.n(Oa),Ia=n(7825),Ma=n.n(Ia),Na=n(7659),Da=n.n(Na),La=n(5056),Ua=n.n(La),Ra=n(540),Ba=n.n(Ra),ja=n(1113),Fa=n.n(ja),Ha=n(5541),$a={};$a.styleTagTransform=Fa(),$a.setAttributes=Ua(),$a.insert=Da().bind(null,"head"),$a.domAPI=Ma(),$a.insertStyleElement=Ba();Pa()(Ha.A,$a);Ha.A&&Ha.A.locals&&Ha.A.locals;async function za(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${t}/lead-sources`);if(n.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return n.data.filter(t=>e.includes(t))}return Ga(n.data,t)}return[]}catch(e){return[]}}const Ga=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter(e=>{const t=e.toLowerCase();return!n.map(e=>e.toLowerCase()).includes(t)})};var Qa,qa=n(8805),Wa=n.n(qa),Va=new Uint8Array(16);function Ya(){if(!Qa&&!(Qa="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qa(Va)}const Ka=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Xa=function(e){return"string"==typeof e&&Ka.test(e)};for(var Za=[],Ja=0;Ja<256;++Ja)Za.push((Ja+256).toString(16).substr(1));const es=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Za[e[t+0]]+Za[e[t+1]]+Za[e[t+2]]+Za[e[t+3]]+"-"+Za[e[t+4]]+Za[e[t+5]]+"-"+Za[e[t+6]]+Za[e[t+7]]+"-"+Za[e[t+8]]+Za[e[t+9]]+"-"+Za[e[t+10]]+Za[e[t+11]]+Za[e[t+12]]+Za[e[t+13]]+Za[e[t+14]]+Za[e[t+15]]).toLowerCase();if(!Xa(n))throw TypeError("Stringified UUID is invalid");return n};const ts=function(e,t,n){var i=(e=e||{}).random||(e.rng||Ya)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return es(i)},ns=e=>localStorage.removeItem("com.elise.webchat.slug="+e),is=(e,t,n)=>{const i=On(new Date),r=n||`lead_${ts()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Rn(i),buildingSlug:e,initiatedChat:t}},rs=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(os(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},os=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(dn(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!wn(t.timestamp,24)};var as;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(as||(as={}));const ss=e=>e.type===us.text,ls=e=>e.type===us.media;var us;!function(e){e.text="text",e.media="media"}(us||(us={}));const cs=class{constructor(e,t,n,i=null,r,o,a=null,s=lu.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=lu.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.sessionToken=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==as.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType){this.simpleChatMessages.some(e=>e.type===us.text&&e.message.includes("confirmed for your"))&&ai("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.streamingMessageTimeout=null,this.checkAndHandleDelayStreamingMessages=({delayToFetchHistoryInMs:e=1e4}={})=>{this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null);const t=this.simpleChatMessages.some(e=>{if(!ss(e))return!1;const t=e.chunks.find(e=>e.isDone);return!t||e.chunks.length===t.order});t&&(this.streamingMessageTimeout=setTimeout(()=>{Ai({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory()},e))},this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return!1}})(e.message.text))return;ai("leadProvidedEmail",{buildingId:null===(t=this.buildingWebchatView)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===as.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=is(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken(async()=>{var t,n,i,r,o,a,s,l,u;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout(()=>{this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})},9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),this.widgetType===lu.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):(await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),lead_sources_with_timestamps:(null!==(o=null===(r=this.leadSourceMultitouchClient)||void 0===r?void 0:r.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:null}))&&void 0!==o?o:[]).map(e=>gn({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(ai("firstChatMessageSent",{message:e,buildingId:null===(l=this.buildingWebchatView)||void 0===l?void 0:l.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),ai("chatMessageSent",{message:e,buildingId:null===(u=this.buildingWebchatView)||void 0===u?void 0:u.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))}),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.removeDuplicatedRawPubnubMessages=e=>{const t=new Set;return e.filter(e=>{if("lead_message"===e.message.customType||!e.message.stream_id||!e.message.order)return!0;const n=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(n)?(Ai({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(n),!0)})},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return this.removeDuplicatedRawPubnubMessages(e).forEach(e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:us.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:us.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]}),Object.keys(n).forEach(e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),o=r.map(e=>e.message.text).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map(e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}}),type:us.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)}),t.sort((e,t)=>e.timestamp-t.timestamp),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find(e=>e.message.is_done);return!t||e.length===t.message.order},this.buildingSlug=e,this.buildingWebchatView=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=a,this.leadSourceMultitouchClient=o,this.widgetType=s}async initSession(e,t,n){try{const i={building_slug:e,org_slug:t};n&&(i.lead_id=n);const o=await r().post(`${this.apiHost}/platformApi/webchat/init`,i);return this.sessionToken=o.data.session_token,this.leadUserId=o.data.lead_id,this.channel=o.data.channel,o.data}catch(e){return this.buildingWebchatView&&Ai({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),null}}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(Wa())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken(()=>new Promise(()=>this.handleChatListeners())),await this.withAuthToken(()=>this.getChannelHistory()),this.pubnub):void 0}async fetchToken(e,t){try{if(this.sessionToken){const e="healthcare"===this.widgetType?"?industry=health_care":"";return(await r().get(`${this.apiHost}/platformApi/webchat/pn/v2/request-token${e}`,{headers:{"X-Session-Token":this.sessionToken}})).data}return(await r().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${t}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await r().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(e){try{await e()}catch(t){if(t instanceof i.AxiosError&&t&&t.response&&403===t.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const t=await this.fetchToken(this.leadUserId,this.channel);if(!t)return;this.pubnub.setAuthKey(t.auth.result.token),await e()}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},(e,t)=>{e.error?o(e):n(t)})}),a=o.channels[this.channel];if(!a)break;if(a.sort((e,t)=>+e.timetoken-+t.timetoken),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach(e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})}),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter(e=>e.message.messageType!==as.noReply))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},ds=new Set(["8009855990","8338526262","8002221222","8006624357","8002738255","8007997233","8007874889","8006564673","8004224453","8883737888","8006213362","8009506264","8558272736","8008435678","8007862929","8008523836","8007849433","8007729100","8006699777","8006858470","8004322209","8003473735","8008778339","8009552232","8002255342","8009272891","8003049320","8007937724","8002382333","8003353863","8776858878","8003329227","8776554371","8772944357","8772944356","6092925760","6092926735","8007928339","8008329173","8882853036","6092921210","8007929773","8003561561","8003826717","8005727233","8009291040","8888958179","8006879512","8004262537","8773475463","8774149251","8005103102","8889372835","8007010710","8007010720","8774288844","8007929745","8003283838","6092927060","6092928319","8008527899","8662401347","8009923678","8776522873","8776527624","8003313937","8008435437","8776536783","8778392339","8003676274","8006896411"]),hs=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return ds.has(t)},ps=(e,t,n)=>{try{const i=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1"),r=`tel:${i}`,o=`sms:${i}`,a=`whatsapp://send?phone=${i}`,s=`facetime:${i}`,l=`facetime-audio:${i}`,u=/(?:\+1[\s.-]?)?(?:\(\d{3}\)[\s.-]?|\d{3}[\s.-])\d{3}[\s.-]?\d{4}/g,c=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,d=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=/emergency|emergencia/i,f=300,g=e=>!(!e||e.length>f)&&p.test(e),m=e=>{var t,n,i,r;if(g(e.textContent))return!0;if(g(null===(t=e.previousElementSibling)||void 0===t?void 0:t.textContent)||g(null===(n=e.nextElementSibling)||void 0===n?void 0:n.textContent))return!0;const o=e.parentElement;return!(!o||!g(null===(i=o.previousElementSibling)||void 0===i?void 0:i.textContent)&&!g(null===(r=o.nextElementSibling)||void 0===r?void 0:r.textContent))},y=document.body.getElementsByTagName("*");let b=!1;const v=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let w=!1,C=!1,x=0;for(let e=0;e<y.length;e++)if(y[e].nodeType===Node.ELEMENT_NODE&&!m(y[e])){if(1===y[e].childNodes.length&&y[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=y[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(hs(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,y[e].textContent=n),b=!0,w||(w=!0)}if(y[e].hasAttribute("href")){const t=y[e].getAttribute("href");if(!t)continue;let n="",i=c;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=d):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,hs(t))continue;const u=t.replace(i,n);if(y[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&y[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t}),C&&Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t}),b||Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:xi.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:xi.error,buildingSlug:n,orgSlug:t}),0}};var fs=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let gs=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Ue,this.toExpand=!1}render(){return B`
5638
5678
  <button
5639
5679
  class=${this.toExpand?"button-container mini":"button-container"}
5640
5680
  @click=${this.onClick}
@@ -6806,7 +6846,7 @@ xmlns="http://www.w3.org/2000/svg"
6806
6846
  </button>
6807
6847
  </div>
6808
6848
  </div>
6809
- `}};Ul.styles=[kn,bs,ys,ms,Ml],Ll([ue({type:Number})],Ul.prototype,"right",void 0),Ll([ue({type:Number})],Ul.prototype,"bottom",void 0),Ll([ue({type:Number})],Ul.prototype,"top",void 0),Ll([ue({type:Number})],Ul.prototype,"left",void 0),Ll([ue({attribute:!0})],Ul.prototype,"onMount",void 0),Ll([ue({attribute:!0})],Ul.prototype,"channel",void 0),Ll([ue({attribute:!0})],Ul.prototype,"isHealthChat",void 0),Ll([ue({attribute:!0})],Ul.prototype,"myPubnub",void 0),Ll([ue({attribute:!0})],Ul.prototype,"orgSlug",void 0),Ll([ue({attribute:!0})],Ul.prototype,"buildingSlug",void 0),Ll([ue({attribute:!0})],Ul.prototype,"widgetType",void 0),Ll([ue({attribute:!0})],Ul.prototype,"building",void 0),Ll([ue({attribute:!0})],Ul.prototype,"primaryColor",void 0),Ll([ue({attribute:!0})],Ul.prototype,"backgroundColor",void 0),Ll([ue({attribute:!0})],Ul.prototype,"onClickExit",void 0),Ll([ue({attribute:!0})],Ul.prototype,"requiresConsent",void 0),Ll([de("#message-input",!0)],Ul.prototype,"messageInput",void 0),Ll([de("#conversation-body",!0)],Ul.prototype,"messageBody",void 0),Ll([ce()],Ul.prototype,"_isMobile",void 0),Ll([ce()],Ul.prototype,"messages",void 0),Ll([ce()],Ul.prototype,"isLoadingMessages",void 0),Ll([ce()],Ul.prototype,"hasReceivedConsent",void 0),Ll([ce()],Ul.prototype,"privacyPolicyUrl",void 0),Ll([ce()],Ul.prototype,"websitePreviewMapping",void 0),Ul=Ll([se("pubnub-chat")],Ul);const Rl="cdn.skypack.dev/@meetelise/chat",Bl="cdn.eliseai.com/@meetelise/chat",jl=async(e,t)=>{try{if(Math.random()>=.15)return;const n=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",n=t.textContent||"";if(e.includes(Rl)||n.includes(Rl))return"skypack";if(e.includes(Bl)||n.includes(Bl))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:n},{params:{cdn_version:n},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},Fl=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?`${t}/units`:t,Hl=["Check Availability","Apply Now"],$l=(e,t,n,i)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const n=e.getElementsByTagName("span");if(1!==n.length)return!1;const i=null===(t=n[0].textContent)||void 0===t?void 0:t.trim();return null!=i&&Hl.includes(i)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),Ai({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:xi.info,buildingSlug:i,orgSlug:n}),!0},zl=(e,t,n,i)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&$l(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)$l(s[e],t,n,i)}},Gl=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)$l(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)zl(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Ql{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>On(Pn(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=Ei();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Ci()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),n=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}]};localStorage.setItem(n,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Ai({logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),n=Oi(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:On(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Rn(e.timestampInitiallyLogged).getTime()-Rn(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:On(new Date),r=[{timestampInitiallyLogged:i,leadSourceValue:n,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>Rn(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var ql,Wl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Vl=ql=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=bn(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=ri.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.LeadSourceMultitouchClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=lu.Default,this.onWidgetLoaded=Ca(),this.onSstClose=Ca(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=ke(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Ui(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,t)=>{const n=window.rentgrata;if(!n)return;const i=n.Widget;if(!i)return;const o=i.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{jl(this.orgSlug,this.buildingSlug)}catch(e){}await Er(e,this.buildingSlug,this.orgSlug)&&(Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,M,N,D,L,U,R,B,j,F,H,$,z,G,Q,q,W,V;const Y=this.buildingWebchatView;if(!Y)return;Y&&this.orgSlug&&Kl(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null);const K=Y.featureFlagWebchatMarketingSourceDropdownConfiguration,X=Y.featureFlagWebchatUseDniPhoneNumberBySource,Z=Y.featureFlagInsertDniIntoWebsite,J=Y.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite,[ee,te]=await Promise.all([za(this.orgSlug,this.buildingSlug),oi(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Ie(Y.phoneNumber)),this.leadSources=ee,this.featureFlagShowDropdown=K;const ne=Y.textWithUsPhoneNumber?Y.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",n=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return Ai({logType:xi.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),ie=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,re=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,oe={callDesktop:null!==(c=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==c&&c,callMobile:null!==(h=null===(d=this.buildingWebchatView)||void 0===d?void 0:d.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(b=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==b&&b,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!ne)&&void 0!==x&&x,textMobile:null!==(S=(null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowTextMobile)&&!!ne)&&void 0!==S&&S,sstDesktop:null!==(k=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(_=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==_&&_,calcDesktop:ie,calcMobile:re};var ae,se;this.enabledChatWidgets=_a(oe),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(se=this.handleTourClicked,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",e=>{e.preventDefault(),se(e)})}),J&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(t=>{t&&t.addEventListener("click",t=>{t.preventDefault(),e(t)})})})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var n;if(!t)return;const i=document.createElement("a");i.textContent=t.textContent,i.style.cursor="pointer",i.addEventListener("click",t=>{t.preventDefault(),e(t)}),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)})})(this.handleTourClicked)):(null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&(ae=null!==(I=null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&void 0!==I?I:null,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(ae)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(N=this.buildingWebchatView.secondaryColor)&&void 0!==N?N:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==D?D:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==L?L:null,this.webchatConfigHasAutoOpenChat=null!==(U=this.buildingWebchatView.autoOpenChat)&&void 0!==U&&U,this.requiresConsent=null!==(R=this.buildingWebchatView.requiresConsentForChat)&&void 0!==R&&R,this.hideMobileFeatures=null!==(B=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==B&&B,this.privacyPolicyUrl=null!==(j=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==j?j:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Mi.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Mi.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Mi.EMOJI&&(this.designConcept=Mi.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Ue),null===this.backgroundColor&&(this.backgroundColor=Re);const le=null!==(H=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==H?H:"";let ue=null;if(X&&(ue=await async function(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return n.data?{number:Ie(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(z=null===($=this.LeadSourceClient)||void 0===$?void 0:$.leadSource)&&void 0!==z?z:null),ue&&!ue.isMatch&&(ue.number=le)),Z&&(null==ue?void 0:ue.number)){const e=ps(ue.number,this.orgSlug,this.buildingSlug);e>0&&Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ce=localStorage.getItem("eliseai_phone_number_devtest");ce&&ps(ce,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=ue||{number:le,isMatch:!1,isPropertyWebsiteCatchall:!0};const de=null!==(Q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==Q?Q:null;if(de&&(this.leadSources.includes(de)||this.leadSources.push(de)),Vn(Y.id),te&&this.buildingSlug&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)){const e=((e,t,n)=>{var i;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(i=l.textContent)||void 0===i?void 0:i.toLowerCase())||"",s=Fl(o,e);l.setAttribute("href",s),a++,Ai({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Ai({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:xi.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}this.buildingSlug&&(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isLiveOnApplications)&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Gl(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a;if(!this.buildingWebchatView)return;const s=rs(this.buildingSlug),l=os(this.buildingSlug,s),u=l?s:is(this.buildingSlug,!1);if(!u.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new Pi,this.LeadSourceMultitouchClient=new Ql(this.orgSlug,this.buildingSlug),this.myPubnub=new cs(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,u.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),!l){const e=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug);e&&is(this.buildingSlug,!1,e.lead_id)}this.LeadSourceClient.chatId=this.myPubnub.channel;const c=await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(n=null===(t=this.myPubnub)||void 0===t?void 0:t.leadUserId)&&void 0!==n?n:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));c&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(c),"property-website"!==Oi(this.orgSlug)?this.myPubnub.leadSource=null!==(r=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==r?r:Oi(this.orgSlug):this.myPubnub.leadSource=null!==(a=null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource)&&void 0!==a?a:null,u.initiatedChat&&await this.myPubnub.initializePubnub(s)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Dn(Rn(t)));return!!e&&!!n&&!bn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",On(function(e,t){return Ge(2,arguments),st(e,6e4*at(t))}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s;if("Tab"===e.key){const l=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot,u=this.displayPubnubChat?null===(o=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat"))||void 0===r?void 0:r.shadowRoot)||void 0===o?void 0:o.getElementById("pubnub-chat-container"):null!==(s=null!==(a=null==l?void 0:l.getElementById("email-us-window"))&&void 0!==a?a:null==l?void 0:l.getElementById("tour-scheduler-window"))&&void 0!==s?s:null==l?void 0:l.getElementById("call-us-window");if(!u)return;e.preventDefault();const c=this.displayPubnubChat?Array.from(u.querySelectorAll(ql.FOCUSABLE_SELECTOR)):this.collectFocusableElements(u),d=this.getDeepActiveElement(),h=c.findIndex(e=>e===d);c[e.shiftKey?(h-1+c.length)%c.length:(h+1)%c.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new wi(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ns(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab),this._cleanupMobileListener=vn(e=>{this._isMobile=e})}static isFocusable(e){return!("disabled"in e)||!e.disabled}collectFocusableElements(e){const t=[];e instanceof Element&&e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));const n=e.querySelectorAll("*");for(const e of Array.from(n))e.matches(ql.FOCUSABLE_SELECTOR)&&ql.isFocusable(e)&&t.push(e),e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));return t}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){Ai({logType:xi.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,M,N,D,L,U;Ea();const R=this.hideLauncher&&!this.isLoading&&!this._isMobile;return B`
6849
+ `}};Ul.styles=[kn,bs,ys,ms,Ml],Ll([ue({type:Number})],Ul.prototype,"right",void 0),Ll([ue({type:Number})],Ul.prototype,"bottom",void 0),Ll([ue({type:Number})],Ul.prototype,"top",void 0),Ll([ue({type:Number})],Ul.prototype,"left",void 0),Ll([ue({attribute:!0})],Ul.prototype,"onMount",void 0),Ll([ue({attribute:!0})],Ul.prototype,"channel",void 0),Ll([ue({attribute:!0})],Ul.prototype,"isHealthChat",void 0),Ll([ue({attribute:!0})],Ul.prototype,"myPubnub",void 0),Ll([ue({attribute:!0})],Ul.prototype,"orgSlug",void 0),Ll([ue({attribute:!0})],Ul.prototype,"buildingSlug",void 0),Ll([ue({attribute:!0})],Ul.prototype,"widgetType",void 0),Ll([ue({attribute:!0})],Ul.prototype,"building",void 0),Ll([ue({attribute:!0})],Ul.prototype,"primaryColor",void 0),Ll([ue({attribute:!0})],Ul.prototype,"backgroundColor",void 0),Ll([ue({attribute:!0})],Ul.prototype,"onClickExit",void 0),Ll([ue({attribute:!0})],Ul.prototype,"requiresConsent",void 0),Ll([de("#message-input",!0)],Ul.prototype,"messageInput",void 0),Ll([de("#conversation-body",!0)],Ul.prototype,"messageBody",void 0),Ll([ce()],Ul.prototype,"_isMobile",void 0),Ll([ce()],Ul.prototype,"messages",void 0),Ll([ce()],Ul.prototype,"isLoadingMessages",void 0),Ll([ce()],Ul.prototype,"hasReceivedConsent",void 0),Ll([ce()],Ul.prototype,"privacyPolicyUrl",void 0),Ll([ce()],Ul.prototype,"websitePreviewMapping",void 0),Ul=Ll([se("pubnub-chat")],Ul);const Rl="cdn.skypack.dev/@meetelise/chat",Bl="cdn.eliseai.com/@meetelise/chat",jl=async(e,t)=>{try{if(Math.random()>=.15)return;const n=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",n=t.textContent||"";if(e.includes(Rl)||n.includes(Rl))return"skypack";if(e.includes(Bl)||n.includes(Bl))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:n},{params:{cdn_version:n},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},Fl=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?`${t}/units`:t,Hl=["Check Availability","Apply Now"],$l=(e,t,n,i)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const n=e.getElementsByTagName("span");if(1!==n.length)return!1;const i=null===(t=n[0].textContent)||void 0===t?void 0:t.trim();return null!=i&&Hl.includes(i)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),Ai({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:xi.info,buildingSlug:i,orgSlug:n}),!0},zl=(e,t,n,i)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&$l(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)$l(s[e],t,n,i)}},Gl=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)$l(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)zl(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Ql{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>On(Pn(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=Ei();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Ci()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),n=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}]};localStorage.setItem(n,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Ai({logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),n=Oi(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:On(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Rn(e.timestampInitiallyLogged).getTime()-Rn(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:On(new Date),r=[{timestampInitiallyLogged:i,leadSourceValue:n,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>Rn(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var ql,Wl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Vl=ql=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=bn(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=ri.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.LeadSourceMultitouchClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=lu.Default,this.onWidgetLoaded=Ca(),this.onSstClose=Ca(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=ke(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Ui(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,t)=>{const n=window.rentgrata;if(!n)return;const i=n.Widget;if(!i)return;const o=i.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{jl(this.orgSlug,this.buildingSlug)}catch(e){}await Er(e,this.buildingSlug,this.orgSlug)&&(Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,M,N,D,L,U,R,B,j,F,H,$,z,G,Q,q,W,V;const Y=this.buildingWebchatView;if(!Y)return;Y&&this.orgSlug&&Kl(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null);const K=Y.featureFlagWebchatMarketingSourceDropdownConfiguration,X=Y.featureFlagWebchatUseDniPhoneNumberBySource,Z=Y.featureFlagInsertDniIntoWebsite,J=Y.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite,[ee,te]=await Promise.all([za(this.orgSlug,this.buildingSlug),oi(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Ie(Y.phoneNumber)),this.leadSources=ee,this.featureFlagShowDropdown=K;const ne=Y.textWithUsPhoneNumber?Y.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",n=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return Ai({logType:xi.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),ie=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,re=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,oe={callDesktop:null!==(c=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==c&&c,callMobile:null!==(h=null===(d=this.buildingWebchatView)||void 0===d?void 0:d.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(b=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==b&&b,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!ne)&&void 0!==x&&x,textMobile:null!==(S=(null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowTextMobile)&&!!ne)&&void 0!==S&&S,sstDesktop:null!==(k=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(_=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==_&&_,calcDesktop:ie,calcMobile:re};var ae,se;this.enabledChatWidgets=_a(oe),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(se=this.handleTourClicked,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",e=>{e.preventDefault(),se(e)})}),J&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(t=>{t&&t.addEventListener("click",t=>{t.preventDefault(),e(t)})})})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var n;if(!t)return;const i=document.createElement("a");i.textContent=t.textContent,i.style.cursor="pointer",i.addEventListener("click",t=>{t.preventDefault(),e(t)}),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)})})(this.handleTourClicked)):(null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&(ae=null!==(I=null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&void 0!==I?I:null,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(ae)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(N=this.buildingWebchatView.secondaryColor)&&void 0!==N?N:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==D?D:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==L?L:null,this.webchatConfigHasAutoOpenChat=null!==(U=this.buildingWebchatView.autoOpenChat)&&void 0!==U&&U,this.requiresConsent=null!==(R=this.buildingWebchatView.requiresConsentForChat)&&void 0!==R&&R,this.hideMobileFeatures=null!==(B=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==B&&B,this.privacyPolicyUrl=null!==(j=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==j?j:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Mi.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Mi.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Mi.EMOJI&&(this.designConcept=Mi.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Ue),null===this.backgroundColor&&(this.backgroundColor=Re);const le=null!==(H=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==H?H:"";let ue=null;if(X&&(ue=await async function(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return n.data?{number:Ie(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(z=null===($=this.LeadSourceClient)||void 0===$?void 0:$.leadSource)&&void 0!==z?z:null),ue&&!ue.isMatch&&(ue.number=le)),Z&&(null==ue?void 0:ue.number)){const e=ps(ue.number,this.orgSlug,this.buildingSlug);e>0&&Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ce=localStorage.getItem("eliseai_phone_number_devtest");ce&&ps(ce,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=ue||{number:le,isMatch:!1,isPropertyWebsiteCatchall:!0};const de=null!==(Q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==Q?Q:null;if(de&&(this.leadSources.includes(de)||this.leadSources.push(de)),Vn(Y.id),te&&this.buildingSlug&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)){const e=((e,t,n)=>{var i;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(i=l.textContent)||void 0===i?void 0:i.toLowerCase())||"",s=Fl(o,e);l.setAttribute("href",s),a++,Ai({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Ai({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:xi.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}this.buildingSlug&&(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isLiveOnApplications)&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Gl(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a,s;if(!this.buildingWebchatView)return;const l=rs(this.buildingSlug),u=os(this.buildingSlug,l),c=u?l:is(this.buildingSlug,!1);if(!c.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new Pi,this.LeadSourceMultitouchClient=new Ql(this.orgSlug,this.buildingSlug),this.myPubnub=new cs(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,c.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType);const d=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,u&&null!==(e=c.leadId)&&void 0!==e?e:void 0);d&&is(this.buildingSlug,c.initiatedChat,d.lead_id),this.LeadSourceClient.chatId=this.myPubnub.channel;const h=await(null===(t=this.LeadSourceClient)||void 0===t?void 0:t.generateUserLeadSource({leadId:null!==(i=null===(n=this.myPubnub)||void 0===n?void 0:n.leadUserId)&&void 0!==i?i:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));h&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(h),"property-website"!==Oi(this.orgSlug)?this.myPubnub.leadSource=null!==(o=null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource)&&void 0!==o?o:Oi(this.orgSlug):this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:null;const p=rs(this.buildingSlug);p.initiatedChat&&await this.myPubnub.initializePubnub(p)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Dn(Rn(t)));return!!e&&!!n&&!bn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",On(function(e,t){return Ge(2,arguments),st(e,6e4*at(t))}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s;if("Tab"===e.key){const l=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot,u=this.displayPubnubChat?null===(o=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat"))||void 0===r?void 0:r.shadowRoot)||void 0===o?void 0:o.getElementById("pubnub-chat-container"):null!==(s=null!==(a=null==l?void 0:l.getElementById("email-us-window"))&&void 0!==a?a:null==l?void 0:l.getElementById("tour-scheduler-window"))&&void 0!==s?s:null==l?void 0:l.getElementById("call-us-window");if(!u)return;e.preventDefault();const c=this.displayPubnubChat?Array.from(u.querySelectorAll(ql.FOCUSABLE_SELECTOR)):this.collectFocusableElements(u),d=this.getDeepActiveElement(),h=c.findIndex(e=>e===d);c[e.shiftKey?(h-1+c.length)%c.length:(h+1)%c.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new wi(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ns(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab),this._cleanupMobileListener=vn(e=>{this._isMobile=e})}static isFocusable(e){return!("disabled"in e)||!e.disabled}collectFocusableElements(e){const t=[];e instanceof Element&&e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));const n=e.querySelectorAll("*");for(const e of Array.from(n))e.matches(ql.FOCUSABLE_SELECTOR)&&ql.isFocusable(e)&&t.push(e),e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));return t}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){Ai({logType:xi.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,M,N,D,L,U;Ea();const R=this.hideLauncher&&!this.isLoading&&!this._isMobile;return B`
6810
6850
  <meta name="viewport" content="width=device-width, initial-scale=1">
6811
6851
  <div id="aria-describe-info" style="display: none;">
6812
6852
  EliseAI widget that allows you to chat with a virtual assistant, book
package/src/MyPubnub.ts CHANGED
@@ -209,7 +209,8 @@ class MyPubnub {
209
209
 
210
210
  async initSession(
211
211
  buildingSlug: string,
212
- orgSlug: string
212
+ orgSlug: string,
213
+ existingLeadId?: string
213
214
  ): Promise<{
214
215
  session_token: string;
215
216
  lead_id: string;
@@ -217,9 +218,16 @@ class MyPubnub {
217
218
  expires_in_seconds: number;
218
219
  } | null> {
219
220
  try {
221
+ const payload: Record<string, string> = {
222
+ building_slug: buildingSlug,
223
+ org_slug: orgSlug,
224
+ };
225
+ if (existingLeadId) {
226
+ payload.lead_id = existingLeadId;
227
+ }
220
228
  const response = await axios.post(
221
229
  `${this.apiHost}/platformApi/webchat/init`,
222
- { building_slug: buildingSlug, org_slug: orgSlug }
230
+ payload
223
231
  );
224
232
  this.sessionToken = response.data.session_token;
225
233
  this.leadUserId = response.data.lead_id;
@@ -66,6 +66,9 @@ export class FeeCalculatorLayout extends LitElement {
66
66
  @property({ type: Boolean })
67
67
  isLoadingUnits = false;
68
68
 
69
+ @property({ type: Boolean })
70
+ isLoadingLayouts = false;
71
+
69
72
  @property()
70
73
  onSelectLayout: ((layoutIds: number[]) => void) | null = null;
71
74
 
@@ -277,6 +280,7 @@ export class FeeCalculatorLayout extends LitElement {
277
280
  .selectedLayoutIds=${this.selectedLayoutIds}
278
281
  .units=${this.units}
279
282
  .isLoading=${this.isLoadingUnits}
283
+ .isLoadingLayouts=${this.isLoadingLayouts}
280
284
  .onSelectLayout=${this.onSelectLayout}
281
285
  .onUnitSelect=${this.onUnitSelect}
282
286
  .onMoveInDateChange=${this.onMoveInDateChange}
@@ -35,6 +35,13 @@ const feeItemStyles = css`
35
35
  margin-top: 4px;
36
36
  }
37
37
 
38
+ .fee-additional-info {
39
+ color: #868e96;
40
+ font-size: 0.8rem;
41
+ margin-top: 2px;
42
+ font-style: italic;
43
+ }
44
+
38
45
  .fee-amount {
39
46
  font-size: 1rem;
40
47
  align-self: center;
@@ -32,6 +32,10 @@ export class FeeItemComponent extends LitElement {
32
32
  return this.feeQuote?.marketableFee?.description ?? "";
33
33
  }
34
34
 
35
+ get additionalInfo(): string {
36
+ return this.feeQuote?.marketableFee?.additionalInfo ?? "";
37
+ }
38
+
35
39
  get triggeredEvent(): string {
36
40
  const event = this.feeQuote?.marketableFee?.triggeredByEvent;
37
41
  if (!event) return "";
@@ -61,7 +65,14 @@ export class FeeItemComponent extends LitElement {
61
65
  <div class="fee-item">
62
66
  <div class="fee-info">
63
67
  <div class="fee-name">${this.name}</div>
64
- <div class="fee-description">${this.description}</div>
68
+ ${this.description
69
+ ? html`<div class="fee-description">${this.description}</div>`
70
+ : ""}
71
+ ${this.additionalInfo
72
+ ? html`<div class="fee-additional-info">
73
+ ${this.additionalInfo}
74
+ </div>`
75
+ : ""}
65
76
  ${this.triggeredEvent
66
77
  ? html`<div class="fee-triggered-event">
67
78
  ${this.triggeredEvent}
@@ -49,6 +49,40 @@ const floorPlanSelectorStyles = css`
49
49
  color: white;
50
50
  }
51
51
 
52
+ .floor-plan-badge.skeleton {
53
+ cursor: default;
54
+ width: 56px;
55
+ height: 18px;
56
+ padding: 0;
57
+ border: 1px solid #eaeaea;
58
+ }
59
+
60
+ .unit-card-skeleton {
61
+ display: flex;
62
+ min-width: 18rem;
63
+ width: 100%;
64
+ height: 4.75rem;
65
+ border-radius: 4px;
66
+ border: 2px solid transparent;
67
+ background-color: #f8f9fa;
68
+ box-sizing: border-box;
69
+ }
70
+
71
+ .shimmer {
72
+ background: linear-gradient(90deg, #eaeaea 25%, #f5f5f5 50%, #eaeaea 75%);
73
+ background-size: 400px 100%;
74
+ animation: shimmer 1.4s ease-in-out infinite;
75
+ }
76
+
77
+ @keyframes shimmer {
78
+ 0% {
79
+ background-position: -200px 0;
80
+ }
81
+ 100% {
82
+ background-position: 200px 0;
83
+ }
84
+ }
85
+
52
86
  .advanced-section {
53
87
  max-height: 0;
54
88
  overflow: hidden;
@@ -7,7 +7,9 @@ import floorPlanSelectorStyles from "./floor-plan-selector-styles";
7
7
  import { TODAY } from "../../../../globals";
8
8
 
9
9
  import "../floorplan-image-card/floorplan-image-card";
10
- import "../../../loaders/mega-loader";
10
+
11
+ const SKELETON_BADGE_COUNT = 4;
12
+ const SKELETON_UNIT_COUNT = 3;
11
13
 
12
14
  @customElement("floor-plan-selector")
13
15
  export class FloorPlanSelector extends LitElement {
@@ -28,6 +30,9 @@ export class FloorPlanSelector extends LitElement {
28
30
  @property({ type: Boolean })
29
31
  isLoading = false;
30
32
 
33
+ @property({ type: Boolean })
34
+ isLoadingLayouts = false;
35
+
31
36
  @property()
32
37
  onSelectLayout: ((layoutIds: number[]) => void) | null = null;
33
38
 
@@ -141,8 +146,11 @@ export class FloorPlanSelector extends LitElement {
141
146
  if (this.isLoading) {
142
147
  return html`
143
148
  <div class="unit-selection">
144
- <div class="loading-container">
145
- <mega-loader size="32"></mega-loader>
149
+ <div class="image-carousel">
150
+ ${Array.from(
151
+ { length: SKELETON_UNIT_COUNT },
152
+ () => html`<div class="unit-card-skeleton shimmer"></div>`
153
+ )}
146
154
  </div>
147
155
  </div>
148
156
  `;
@@ -151,7 +159,7 @@ export class FloorPlanSelector extends LitElement {
151
159
  return html`
152
160
  <div class="unit-selection">
153
161
  <div class="image-carousel">
154
- ${!this.isLoading && this.units?.length === 0
162
+ ${this.units?.length === 0
155
163
  ? html`
156
164
  <div class="no-floorplans-container">
157
165
  <p>No floorplans found</p>
@@ -173,6 +181,17 @@ export class FloorPlanSelector extends LitElement {
173
181
  };
174
182
 
175
183
  renderBadges = (): TemplateResult => {
184
+ if (this.isLoadingLayouts) {
185
+ return html`
186
+ <div class="floor-plan-selector-badges">
187
+ ${Array.from(
188
+ { length: SKELETON_BADGE_COUNT },
189
+ () => html`<div class="floor-plan-badge skeleton shimmer"></div>`
190
+ )}
191
+ </div>
192
+ `;
193
+ }
194
+
176
195
  return html`
177
196
  <div class="floor-plan-selector-badges">
178
197
  ${this.displayOptions.map(
@@ -268,12 +268,6 @@ export const feeCalculatorStyles = css`
268
268
  background-color: var(--primary-color, #ffffff);
269
269
  }
270
270
 
271
- .recalculating-loader {
272
- display: flex;
273
- align-items: center;
274
- justify-content: center;
275
- }
276
-
277
271
  @media (max-width: 767px) {
278
272
  .fee-calculator-container {
279
273
  width: 100vw;
@@ -68,10 +68,10 @@ export class FeeCalculator extends LitElement {
68
68
  onClickTextUsOption: ((e: MouseEvent) => void) | null = null;
69
69
 
70
70
  @state()
71
- private isFirstCalculation = true;
71
+ private isCalculatingQuote = false;
72
72
 
73
73
  @state()
74
- private isCalculatingQuote = false;
74
+ private isLoadingLayouts = true;
75
75
 
76
76
  @state()
77
77
  private isExporting = false;
@@ -212,7 +212,6 @@ export class FeeCalculator extends LitElement {
212
212
  } finally {
213
213
  if (!signal.aborted) {
214
214
  this.isCalculatingQuote = false;
215
- this.isFirstCalculation = false;
216
215
  }
217
216
  }
218
217
  }
@@ -226,26 +225,38 @@ export class FeeCalculator extends LitElement {
226
225
  this.style.setProperty("--primary-color", this.primaryColor);
227
226
  this.style.setProperty("--background-color", this.backgroundColor);
228
227
 
229
- await this.setupCalculator();
230
- await this.fetchUnits();
228
+ await Promise.allSettled([this.setupCalculator(), this.fetchUnits()]);
231
229
  };
232
230
 
233
231
  setupCalculator = async (): Promise<void> => {
234
- if (!this.buildingSlug || !this.orgSlug) return;
235
-
236
- const [buildingWebchatView, buildingFeeResponse] = await Promise.all([
237
- fetchBuildingWebchatView(this.orgSlug, this.buildingSlug),
238
- fetchBuildingFeesV2(this.buildingSlug),
239
- ]);
232
+ if (!this.buildingSlug || !this.orgSlug) {
233
+ this.isLoadingLayouts = false;
234
+ return;
235
+ }
240
236
 
241
- if (!buildingWebchatView || !buildingFeeResponse) return;
237
+ // Resolve independently /marketable-fees can be slow and shouldn't gate the layout selector.
238
+ const layoutsPromise = fetchBuildingWebchatView(
239
+ this.orgSlug,
240
+ this.buildingSlug
241
+ )
242
+ .then((view) => {
243
+ if (view) this.buildingWebchatView = view;
244
+ })
245
+ .finally(() => {
246
+ this.isLoadingLayouts = false;
247
+ });
242
248
 
243
- this.buildingWebchatView = buildingWebchatView;
244
- this.groupedFees = this.groupFees(buildingFeeResponse.fees);
245
- this.rentableItems = buildingFeeResponse.rentableItems;
249
+ const feesPromise = fetchBuildingFeesV2(this.buildingSlug).then(
250
+ (response) => {
251
+ if (!response) return;
252
+ this.groupedFees = this.groupFees(response.fees);
253
+ this.rentableItems = response.rentableItems;
254
+ // TODO(Leo): Re-enable
255
+ // this.incentives = response.buildingIncentives;
256
+ }
257
+ );
246
258
 
247
- // TODO(Leo): Re-enable
248
- // this.incentives = buildingFeeResponse.buildingIncentives;
259
+ await Promise.allSettled([layoutsPromise, feesPromise]);
249
260
  };
250
261
 
251
262
  updated(changedProperties: Map<string, unknown>): void {
@@ -294,7 +305,6 @@ export class FeeCalculator extends LitElement {
294
305
 
295
306
  handleUnitSelect = (unit: Unit): void => {
296
307
  const isInitialSelection = !this.selectedUnit;
297
- this.isFirstCalculation = true; // Reset flag to show skeleton loader
298
308
  this.selectedUnit = unit;
299
309
 
300
310
  if (isInitialSelection) {
@@ -451,9 +461,6 @@ export class FeeCalculator extends LitElement {
451
461
  };
452
462
 
453
463
  render(): TemplateResult {
454
- const showLoader =
455
- this.isCalculatingQuote && !this.isExporting && !this.isFirstCalculation;
456
-
457
464
  const exportDisabled =
458
465
  this.isExporting ||
459
466
  this.isCalculatingQuote ||
@@ -471,12 +478,6 @@ export class FeeCalculator extends LitElement {
471
478
  <h1>Estimated Cost Calculator</h1>
472
479
 
473
480
  <div class="calculator-header-right">
474
- ${showLoader
475
- ? html`<div class="recalculating-loader">
476
- <mega-loader .size=${16} .spinSpeed=${0.54}></mega-loader>
477
- </div>`
478
- : ""}
479
-
480
481
  <button
481
482
  class="share-button"
482
483
  @click=${this.handleShare}
@@ -498,7 +499,8 @@ export class FeeCalculator extends LitElement {
498
499
  "noopener,noreferrer"
499
500
  );
500
501
  }}
501
- ?disabled=${!this.quote?.applicationLink}
502
+ ?disabled=${this.isCalculatingQuote ||
503
+ !this.quote?.applicationLink}
502
504
  >
503
505
  Apply
504
506
  </button>
@@ -531,7 +533,7 @@ export class FeeCalculator extends LitElement {
531
533
 
532
534
  <fee-calculator-layout
533
535
  .buildingSlug=${this.buildingSlug}
534
- .showSkeletonLoader=${this.isFirstCalculation}
536
+ .showSkeletonLoader=${this.isCalculatingQuote}
535
537
  .selectedUnit=${this.selectedUnit}
536
538
  .groupedFees=${this.groupedFees}
537
539
  .rentableItems=${this.rentableItems}
@@ -540,6 +542,7 @@ export class FeeCalculator extends LitElement {
540
542
  .selectedLayoutIds=${this.selectedLayoutIds}
541
543
  .units=${this.units}
542
544
  .isLoadingUnits=${this.isLoadingUnits}
545
+ .isLoadingLayouts=${this.isLoadingLayouts}
543
546
  .onSelectLayout=${this.handleSelectLayout}
544
547
  .onUnitSelect=${this.handleUnitSelect}
545
548
  .onMoveInDateChange=${this.handleMoveInDateChange}
@@ -594,20 +594,21 @@ export class MEChat extends LitElement {
594
594
  this.widgetType
595
595
  );
596
596
 
597
- // For new users, create a server-side session for secure v2 token endpoint.
598
- // initSession() overwrites myPubnub.leadUserId and myPubnub.channel with
599
- // server-generated values and stores the session token for v2 auth.
600
- if (!isReturningUser) {
601
- const session = await this.myPubnub.initSession(
597
+ // Always create/resume a server-side session so the client has a fresh
598
+ // sessionToken and never falls back to the insecure V1 token endpoint.
599
+ // For returning users, pass existing leadId so the server rebinds the session.
600
+ const session = await this.myPubnub.initSession(
601
+ this.buildingSlug,
602
+ this.orgSlug,
603
+ isReturningUser ? updatedChatStorageKey.leadId ?? undefined : undefined
604
+ );
605
+ if (session) {
606
+ // Persist the server-provided leadId to localStorage, preserving initiatedChat flag
607
+ createChatStorageKey(
602
608
  this.buildingSlug,
603
- this.orgSlug
609
+ updatedChatStorageKey.initiatedChat,
610
+ session.lead_id
604
611
  );
605
- if (session) {
606
- // Persist the server-provided leadId to localStorage
607
- createChatStorageKey(this.buildingSlug, false, session.lead_id);
608
- }
609
- // If initSession fails, we fall back to the client-generated leadId
610
- // and fetchToken will use the v1 endpoint (which has channel ownership enforcement)
611
612
  }
612
613
 
613
614
  this.LeadSourceClient.chatId = this.myPubnub.channel;
@@ -637,8 +638,11 @@ export class MEChat extends LitElement {
637
638
  } else {
638
639
  this.myPubnub.leadSource = this.LeadSourceClient?.leadSource ?? null;
639
640
  }
640
- if (updatedChatStorageKey.initiatedChat) {
641
- await this.myPubnub.initializePubnub(currentChatStorageKey);
641
+ // Re-read from localStorage so initializePubnub gets the server-provided
642
+ // leadId (not the stale reference captured before initSession).
643
+ const finalChatStorageKey = getChatStorageKey(this.buildingSlug);
644
+ if (finalChatStorageKey.initiatedChat) {
645
+ await this.myPubnub.initializePubnub(finalChatStorageKey);
642
646
  }
643
647
  };
644
648