@meetelise/chat 1.57.0 → 1.58.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6456,7 +6456,7 @@ xmlns="http://www.w3.org/2000/svg"
6456
6456
  ${os}
6457
6457
  ${as}
6458
6458
  ${ss}
6459
- `,au([ue({attribute:!0})],su.prototype,"isMinimized",void 0),au([ue()],su.prototype,"mobileStyles",void 0),au([ue({type:Boolean})],su.prototype,"isFirstMount",void 0),au([ue({attribute:!1})],su.prototype,"openSSTWindowOnLoad",void 0),au([ue({attribute:!1})],su.prototype,"autoOpenChatWidget",void 0),au([ue()],su.prototype,"phoneNumber",void 0),au([ue({attribute:!0})],su.prototype,"buildingName",void 0),au([ue({attribute:!0})],su.prototype,"chatId",void 0),au([ue({attribute:!0})],su.prototype,"orgLegalName",void 0),au([ue({attribute:!1})],su.prototype,"country",void 0),au([ue({attribute:!1})],su.prototype,"buildingState",void 0),au([ue({attribute:!0})],su.prototype,"chatCallUsHeader",void 0),au([ue({attribute:!1})],su.prototype,"buildingId",void 0),au([ue({type:Number})],su.prototype,"orgId",void 0),au([ue({attribute:!1})],su.prototype,"leadSourceParams",void 0),au([ue({attribute:!0})],su.prototype,"buildingSlug",void 0),au([ue({attribute:!0})],su.prototype,"orgSlug",void 0),au([ue({attribute:!0})],su.prototype,"sgtUrl",void 0),au([ue({attribute:!0})],su.prototype,"selfGuidedTourEnabled",void 0),au([ue({attribute:!0})],su.prototype,"selfGuidedToursTypeOffered",void 0),au([ue({attribute:!0})],su.prototype,"designConcept",void 0),au([ue({attribute:!0})],su.prototype,"featureFlagShowDropdown",void 0),au([ue({attribute:!1})],su.prototype,"leadSources",void 0),au([ue({attribute:!0})],su.prototype,"currentLeadSource",void 0),au([ue({attribute:!0})],su.prototype,"escortedToursLink",void 0),au([ue({attribute:!0})],su.prototype,"escortedToursTypeOffered",void 0),au([ue({attribute:!0})],su.prototype,"virtualToursLink",void 0),au([ue({attribute:!0})],su.prototype,"virtualToursTypeOffered",void 0),au([ue({type:Boolean})],su.prototype,"hasChatEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasChatEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasEmailEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasEmailEnabledMobile",void 0),au([ue({attribute:!0})],su.prototype,"hasApplyNowEnabledDesktop",void 0),au([ue({attribute:!0})],su.prototype,"hasApplyNowEnabledMobile",void 0),au([ue({attribute:!0})],su.prototype,"applicationLink",void 0),au([ue({type:Boolean})],su.prototype,"hasCallUsEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasCallUsEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasTextUsEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasTextUsEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasSSTEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasSSTEnabledMobile",void 0),au([ue({attribute:!1})],su.prototype,"tourTypeOptions",void 0),au([ue({attribute:!1})],su.prototype,"layoutOptions",void 0),au([ue({attribute:!0})],su.prototype,"bedroomPreferenceRequired",void 0),au([ue({attribute:!1})],su.prototype,"brokerIntakeEnabled",void 0),au([ue({attribute:!0})],su.prototype,"hasDynamicSchedulingEnabled",void 0),au([ue({attribute:!0})],su.prototype,"hasPricingCalculatorEnabledDesktop",void 0),au([ue({attribute:!0})],su.prototype,"hasPricingCalculatorEnabledMobile",void 0),au([ue({attribute:!1})],su.prototype,"hasHideMobileFeatures",void 0),au([ue({type:Number})],su.prototype,"right",void 0),au([ue({type:Number})],su.prototype,"bottom",void 0),au([ue({type:Number})],su.prototype,"top",void 0),au([ue({type:Number})],su.prototype,"left",void 0),au([ue({attribute:!0})],su.prototype,"showTourNextToChat",void 0),au([ue({attribute:!1})],su.prototype,"onChatTapped",void 0),au([ue({attribute:!0})],su.prototype,"onClickMinimize",void 0),au([ue({attribute:!0})],su.prototype,"onSstClose",void 0),au([ue({attribute:!0})],su.prototype,"overrideRentgrata",void 0),au([ue({attribute:!1})],su.prototype,"launcherStyles",void 0),au([ue({attribute:!0})],su.prototype,"primaryColor",void 0),au([ue({attribute:!0})],su.prototype,"backgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"leadSourceClient",void 0),au([de()],su.prototype,"leadSourceMultitouchClient",void 0),au([de()],su.prototype,"_isMobile",void 0),au([de()],su.prototype,"isEmailWindowOpen",void 0),au([de()],su.prototype,"isCallUsWindowOpen",void 0),au([de()],su.prototype,"isSSTWindowOpen",void 0),au([de()],su.prototype,"isTextUsWindowOpen",void 0),au([de()],su.prototype,"isCalculatorWindowOpen",void 0),au([de()],su.prototype,"isMobileFeaturesExpanded",void 0),su=au([se("meetelise-launcher")],su);const lu=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",su)},uu=["app.meetelise.com","staging.eliseai.com","localhost"],du={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"}},cu=e=>{const t=window.location.hostname;if(!uu.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 du&&(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=du[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var hu=n(5072),pu=n.n(hu),fu=n(7825),gu=n.n(fu),mu=n(7659),bu=n.n(mu),yu=n(5056),vu=n.n(yu),wu=n(540),Cu=n.n(wu),xu=n(1113),$u=n.n(xu),Su=n(5541),Au={};Au.styleTagTransform=$u(),Au.setAttributes=vu(),Au.insert=bu().bind(null,"head"),Au.domAPI=gu(),Au.insertStyleElement=Cu();pu()(Su.A,Au);Su.A&&Su.A.locals&&Su.A.locals;async function ku(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 Eu(n.data,t)}return[]}catch(e){return[]}}const Eu=(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)})};async function Tu(e){var t,n;if(!e)return!1;try{return null!==(n=null===(t=(await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/aip`)).data)||void 0===t?void 0:t.is_aip)&&void 0!==n&&n}catch(e){return!1}}var _u,Ou=n(8805),Pu=n.n(Ou),Iu=new Uint8Array(16);function Nu(){if(!_u&&!(_u="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 _u(Iu)}const Mu=/^(?:[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 Du=function(e){return"string"==typeof e&&Mu.test(e)};for(var Lu=[],Ru=0;Ru<256;++Ru)Lu.push((Ru+256).toString(16).substr(1));const Uu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Lu[e[t+0]]+Lu[e[t+1]]+Lu[e[t+2]]+Lu[e[t+3]]+"-"+Lu[e[t+4]]+Lu[e[t+5]]+"-"+Lu[e[t+6]]+Lu[e[t+7]]+"-"+Lu[e[t+8]]+Lu[e[t+9]]+"-"+Lu[e[t+10]]+Lu[e[t+11]]+Lu[e[t+12]]+Lu[e[t+13]]+Lu[e[t+14]]+Lu[e[t+15]]).toLowerCase();if(!Du(n))throw TypeError("Stringified UUID is invalid");return n};const Bu=function(e,t,n){var i=(e=e||{}).random||(e.rng||Nu)();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 Uu(i)},ju=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Fu=(e,t,n)=>{const i=Rr(new Date),r=n||`lead_${Bu()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Wr(i),buildingSlug:e,initiatedChat:t}},Hu=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(Gu(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Gu=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if($r(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!Or(t.timestamp,24)},zu=e=>e.startsWith("https://app.meetelise.com/settings/widgets")||e.startsWith("https://app.meetelise.com/settings/marketing/webchat")||e.includes("demo/utilities"),Qu="com.elise.webchat.reopenAfterNavigation",Wu=e=>{try{const t=new URL(e);return`${t.origin}${t.pathname}`}catch{return""}},Vu=e=>{const t={pageUrl:Wu(window.location.href),pageTitle:document.title};return"number"==typeof e&&Number.isInteger(e)&&e>0&&(t.declaredBuildingId=e),t},qu=(e,t=e=>window.location.assign(e))=>{(()=>{try{sessionStorage.setItem(Qu,"true")}catch{}})(),t(e.url)};var Yu;!function(e){e.noReply="no-reply",e.text="text",e.media="media",e.navigation="navigation"}(Yu||(Yu={}));const Ku=e=>e.type===Ju.text,Xu=e=>e.type===Ju.media,Zu=e=>e.type===Ju.navigation;var Ju;!function(e){e.text="text",e.media="media",e.navigation="navigation"}(Ju||(Ju={}));const ed=class{constructor(e,t,n,i=null,r,o,a=null,s=ah.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.firedScheduledTourConfirmationIds=new Set,this.widgetType=ah.Default,this.centralConvo=!1,this.declaredBuildingId=null,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!==Yu.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){const t=e.message.stream_id,i=null!=t?t:String(+e.timetoken);(t?this.reconstructStreamText(t):null!==(n=e.message.text)&&void 0!==n?n:"").includes("confirmed for your")&&this.fireScheduledTourEventOnce(i,e.message)}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=new Map;this.rawPubnubMessages.forEach(e=>{var n;const i=e.message.stream_id;i&&t.set(i,[...null!==(n=t.get(i))&&void 0!==n?n:[],e])});const n=[...t.entries()].filter(([,e])=>!this.isStreamComplete(e)).map(([e])=>e);n.length>0&&(this.streamingMessageTimeout=setTimeout(()=>{Jo({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:Zo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory().then(()=>n.forEach(e=>this.checkAndFireTourConfirmationForStream(e)))},e))},this.isStreamComplete=e=>{var t;const n=e.find(e=>e.message.is_done);if(!n)return!1;const i=new Set(e.map(e=>{var t;return null!==(t=e.message.order)&&void 0!==t?t:0}));for(let e=0;e<=(null!==(t=n.message.order)&&void 0!==t?t:0);e++)if(!i.has(e))return!1;return!0},this.getStreamChunks=e=>this.removeDuplicatedRawPubnubMessages(this.rawPubnubMessages).filter(t=>t.message.stream_id===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)}),this.reconstructStreamText=e=>this.getStreamChunks(e).map(e=>e.message.text).join(""),this.fireScheduledTourEventOnce=(e,t)=>{var n;this.firedScheduledTourConfirmationIds.has(e)||(this.firedScheduledTourConfirmationIds.add(e),So("scheduledTourEvent",{tourDetails:t,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.checkAndFireTourConfirmationForStream=e=>{var t;if(this.reconstructStreamText(e).includes("confirmed for your")){const n=this.getStreamChunks(e);this.fireScheduledTourEventOnce(e,null===(t=n[n.length-1])||void 0===t?void 0:t.message)}},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;So("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)===Yu.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&&Jo({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},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=Fu(this.chatStorageSlug,!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&&Jo({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:Zo.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===ah.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:zu(location.href),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:zu(location.href),...Vu(this.declaredBuildingId),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=>Ar({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(So("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),So("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)?(Jo({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:Zo.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;if(e.message.messageType===Yu.navigation){const n=(e=>{if(!e||"object"!=typeof e)return null;const{url:t,label:n}=e;if("string"!=typeof t||"string"!=typeof n)return null;if(!n.trim())return null;try{const e=new URL(t,window.location.href);return"http:"!==e.protocol&&"https:"!==e.protocol?null:{url:e.href,label:n.trim()}}catch{return null}})(e.message.navigation);n&&t.push({timestamp:e.timetoken,navigation:n,isLeadMessage:!1,type:Ju.navigation})}else if("media"===e.message.messageType)t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:Ju.media});else{if("string"!=typeof e.message.text)return;!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:Ju.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:Ju.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.chatStorageSlug=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};this.centralConvo&&(i.central_convo=!0),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&&Jo({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e}),null}}adoptBuilding(e,t){this.buildingSlug=e,this.buildingWebchatView=t}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(Pu())({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}if(this.centralConvo)return null;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&&Jo({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Jo({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Jo({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}}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!==Yu.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&&Jo({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:Zo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}},td=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"]),nd=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return td.has(t)},id=(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.-]?)?(?:\([2-9]\d{2}\)[\s.-]?|[2-9]\d{2}[\s.-])[2-9]\d{2}[\s.-]?\d{4}/g,d=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,c=/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))},b=document.body.getElementsByTagName("*");let y=!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<b.length;e++)if(b[e].nodeType===Node.ELEMENT_NODE&&!m(b[e])){if(1===b[e].childNodes.length&&b[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=b[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(nd(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,b[e].textContent=n),y=!0,w||(w=!0)}if(b[e].hasAttribute("href")){const t=b[e].getAttribute("href");if(!t)continue;let n="",i=d;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=c):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,nd(t))continue;const u=t.replace(i,n);if(b[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&b[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t}),C&&Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t}),y||Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:Zo.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:Zo.error,buildingSlug:n,orgSlug:t,error:e}),0}},rd=(e,t,n,i)=>{document.querySelectorAll("a").forEach(function(r){const o=r.getAttribute("href");o&&o.startsWith("https://app.meetelise.com/")&&((e,t,n)=>{const[i,r,o,...a]=new URL(e).pathname.split("/").filter(Boolean).map(e=>e.toLowerCase());return 0===a.length&&"tour"===o&&i===t.toLowerCase()&&r===n.toLowerCase()})(o,t,n)&&r.addEventListener("click",t=>{i()&&(t.preventDefault(),e(t))})})};var od=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 ad=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=qn,this.foregroundColorOnPrimaryBackgroundColor="white",this.toExpand=!1}render(){return U`
6459
+ `,au([ue({attribute:!0})],su.prototype,"isMinimized",void 0),au([ue()],su.prototype,"mobileStyles",void 0),au([ue({type:Boolean})],su.prototype,"isFirstMount",void 0),au([ue({attribute:!1})],su.prototype,"openSSTWindowOnLoad",void 0),au([ue({attribute:!1})],su.prototype,"autoOpenChatWidget",void 0),au([ue()],su.prototype,"phoneNumber",void 0),au([ue({attribute:!0})],su.prototype,"buildingName",void 0),au([ue({attribute:!0})],su.prototype,"chatId",void 0),au([ue({attribute:!0})],su.prototype,"orgLegalName",void 0),au([ue({attribute:!1})],su.prototype,"country",void 0),au([ue({attribute:!1})],su.prototype,"buildingState",void 0),au([ue({attribute:!0})],su.prototype,"chatCallUsHeader",void 0),au([ue({attribute:!1})],su.prototype,"buildingId",void 0),au([ue({type:Number})],su.prototype,"orgId",void 0),au([ue({attribute:!1})],su.prototype,"leadSourceParams",void 0),au([ue({attribute:!0})],su.prototype,"buildingSlug",void 0),au([ue({attribute:!0})],su.prototype,"orgSlug",void 0),au([ue({attribute:!0})],su.prototype,"sgtUrl",void 0),au([ue({attribute:!0})],su.prototype,"selfGuidedTourEnabled",void 0),au([ue({attribute:!0})],su.prototype,"selfGuidedToursTypeOffered",void 0),au([ue({attribute:!0})],su.prototype,"designConcept",void 0),au([ue({attribute:!0})],su.prototype,"featureFlagShowDropdown",void 0),au([ue({attribute:!1})],su.prototype,"leadSources",void 0),au([ue({attribute:!0})],su.prototype,"currentLeadSource",void 0),au([ue({attribute:!0})],su.prototype,"escortedToursLink",void 0),au([ue({attribute:!0})],su.prototype,"escortedToursTypeOffered",void 0),au([ue({attribute:!0})],su.prototype,"virtualToursLink",void 0),au([ue({attribute:!0})],su.prototype,"virtualToursTypeOffered",void 0),au([ue({type:Boolean})],su.prototype,"hasChatEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasChatEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasEmailEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasEmailEnabledMobile",void 0),au([ue({attribute:!0})],su.prototype,"hasApplyNowEnabledDesktop",void 0),au([ue({attribute:!0})],su.prototype,"hasApplyNowEnabledMobile",void 0),au([ue({attribute:!0})],su.prototype,"applicationLink",void 0),au([ue({type:Boolean})],su.prototype,"hasCallUsEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasCallUsEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasTextUsEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasTextUsEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasSSTEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasSSTEnabledMobile",void 0),au([ue({attribute:!1})],su.prototype,"tourTypeOptions",void 0),au([ue({attribute:!1})],su.prototype,"layoutOptions",void 0),au([ue({attribute:!0})],su.prototype,"bedroomPreferenceRequired",void 0),au([ue({attribute:!1})],su.prototype,"brokerIntakeEnabled",void 0),au([ue({attribute:!0})],su.prototype,"hasDynamicSchedulingEnabled",void 0),au([ue({attribute:!0})],su.prototype,"hasPricingCalculatorEnabledDesktop",void 0),au([ue({attribute:!0})],su.prototype,"hasPricingCalculatorEnabledMobile",void 0),au([ue({attribute:!1})],su.prototype,"hasHideMobileFeatures",void 0),au([ue({type:Number})],su.prototype,"right",void 0),au([ue({type:Number})],su.prototype,"bottom",void 0),au([ue({type:Number})],su.prototype,"top",void 0),au([ue({type:Number})],su.prototype,"left",void 0),au([ue({attribute:!0})],su.prototype,"showTourNextToChat",void 0),au([ue({attribute:!1})],su.prototype,"onChatTapped",void 0),au([ue({attribute:!0})],su.prototype,"onClickMinimize",void 0),au([ue({attribute:!0})],su.prototype,"onSstClose",void 0),au([ue({attribute:!0})],su.prototype,"overrideRentgrata",void 0),au([ue({attribute:!1})],su.prototype,"launcherStyles",void 0),au([ue({attribute:!0})],su.prototype,"primaryColor",void 0),au([ue({attribute:!0})],su.prototype,"backgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"leadSourceClient",void 0),au([de()],su.prototype,"leadSourceMultitouchClient",void 0),au([de()],su.prototype,"_isMobile",void 0),au([de()],su.prototype,"isEmailWindowOpen",void 0),au([de()],su.prototype,"isCallUsWindowOpen",void 0),au([de()],su.prototype,"isSSTWindowOpen",void 0),au([de()],su.prototype,"isTextUsWindowOpen",void 0),au([de()],su.prototype,"isCalculatorWindowOpen",void 0),au([de()],su.prototype,"isMobileFeaturesExpanded",void 0),su=au([se("meetelise-launcher")],su);const lu=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",su)},uu=["app.meetelise.com","staging.eliseai.com","localhost"],du={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"}},cu=e=>{const t=window.location.hostname;if(!uu.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 du&&(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=du[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var hu=n(5072),pu=n.n(hu),fu=n(7825),gu=n.n(fu),mu=n(7659),bu=n.n(mu),yu=n(5056),vu=n.n(yu),wu=n(540),Cu=n.n(wu),xu=n(1113),$u=n.n(xu),Su=n(5541),Au={};Au.styleTagTransform=$u(),Au.setAttributes=vu(),Au.insert=bu().bind(null,"head"),Au.domAPI=gu(),Au.insertStyleElement=Cu();pu()(Su.A,Au);Su.A&&Su.A.locals&&Su.A.locals;async function ku(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 Eu(n.data,t)}return[]}catch(e){return[]}}const Eu=(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)})};async function Tu(e){var t,n;if(!e)return!1;try{return null!==(n=null===(t=(await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/aip`)).data)||void 0===t?void 0:t.is_aip)&&void 0!==n&&n}catch(e){return!1}}var _u,Ou=n(8805),Pu=n.n(Ou),Iu=new Uint8Array(16);function Nu(){if(!_u&&!(_u="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 _u(Iu)}const Mu=/^(?:[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 Du=function(e){return"string"==typeof e&&Mu.test(e)};for(var Lu=[],Ru=0;Ru<256;++Ru)Lu.push((Ru+256).toString(16).substr(1));const Uu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Lu[e[t+0]]+Lu[e[t+1]]+Lu[e[t+2]]+Lu[e[t+3]]+"-"+Lu[e[t+4]]+Lu[e[t+5]]+"-"+Lu[e[t+6]]+Lu[e[t+7]]+"-"+Lu[e[t+8]]+Lu[e[t+9]]+"-"+Lu[e[t+10]]+Lu[e[t+11]]+Lu[e[t+12]]+Lu[e[t+13]]+Lu[e[t+14]]+Lu[e[t+15]]).toLowerCase();if(!Du(n))throw TypeError("Stringified UUID is invalid");return n};const Bu=function(e,t,n){var i=(e=e||{}).random||(e.rng||Nu)();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 Uu(i)},ju=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Fu=(e,t,n)=>{const i=Rr(new Date),r=n||`lead_${Bu()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Wr(i),buildingSlug:e,initiatedChat:t}},Hu=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(Gu(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Gu=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if($r(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!Or(t.timestamp,24)},zu=e=>e.startsWith("https://app.meetelise.com/settings/widgets")||e.startsWith("https://app.meetelise.com/settings/marketing/webchat")||e.includes("demo/utilities"),Qu="com.elise.webchat.reopenAfterNavigation",Wu=e=>{try{const t=new URL(e);return`${t.origin}${t.pathname}`}catch{return""}},Vu=e=>{const t={pageUrl:Wu(window.location.href),pageTitle:document.title};return"number"==typeof e&&Number.isInteger(e)&&e>0&&(t.declaredBuildingId=e),t},qu=(e,t=e=>window.location.assign(e))=>{(()=>{try{sessionStorage.setItem(Qu,"true")}catch{}})(),t(e.url)};var Yu;!function(e){e.noReply="no-reply",e.text="text",e.media="media",e.navigation="navigation"}(Yu||(Yu={}));const Ku=e=>e.type===Ju.text,Xu=e=>e.type===Ju.media,Zu=e=>e.type===Ju.navigation;var Ju;!function(e){e.text="text",e.media="media",e.navigation="navigation"}(Ju||(Ju={}));const ed=class{constructor(e,t,n,i=null,r,o,a=null,s=sh.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.firedScheduledTourConfirmationIds=new Set,this.widgetType=sh.Default,this.centralConvo=!1,this.declaredBuildingId=null,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!==Yu.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){const t=e.message.stream_id,i=null!=t?t:String(+e.timetoken);(t?this.reconstructStreamText(t):null!==(n=e.message.text)&&void 0!==n?n:"").includes("confirmed for your")&&this.fireScheduledTourEventOnce(i,e.message)}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=new Map;this.rawPubnubMessages.forEach(e=>{var n;const i=e.message.stream_id;i&&t.set(i,[...null!==(n=t.get(i))&&void 0!==n?n:[],e])});const n=[...t.entries()].filter(([,e])=>!this.isStreamComplete(e)).map(([e])=>e);n.length>0&&(this.streamingMessageTimeout=setTimeout(()=>{Jo({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:Zo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory().then(()=>n.forEach(e=>this.checkAndFireTourConfirmationForStream(e)))},e))},this.isStreamComplete=e=>{var t;const n=e.find(e=>e.message.is_done);if(!n)return!1;const i=new Set(e.map(e=>{var t;return null!==(t=e.message.order)&&void 0!==t?t:0}));for(let e=0;e<=(null!==(t=n.message.order)&&void 0!==t?t:0);e++)if(!i.has(e))return!1;return!0},this.getStreamChunks=e=>this.removeDuplicatedRawPubnubMessages(this.rawPubnubMessages).filter(t=>t.message.stream_id===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)}),this.reconstructStreamText=e=>this.getStreamChunks(e).map(e=>e.message.text).join(""),this.fireScheduledTourEventOnce=(e,t)=>{var n;this.firedScheduledTourConfirmationIds.has(e)||(this.firedScheduledTourConfirmationIds.add(e),So("scheduledTourEvent",{tourDetails:t,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.checkAndFireTourConfirmationForStream=e=>{var t;if(this.reconstructStreamText(e).includes("confirmed for your")){const n=this.getStreamChunks(e);this.fireScheduledTourEventOnce(e,null===(t=n[n.length-1])||void 0===t?void 0:t.message)}},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;So("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)===Yu.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&&Jo({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},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=Fu(this.chatStorageSlug,!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&&Jo({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:Zo.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===sh.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:zu(location.href),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:zu(location.href),...Vu(this.declaredBuildingId),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=>Ar({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(So("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),So("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)?(Jo({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:Zo.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;if(e.message.messageType===Yu.navigation){const n=(e=>{if(!e||"object"!=typeof e)return null;const{url:t,label:n}=e;if("string"!=typeof t||"string"!=typeof n)return null;if(!n.trim())return null;try{const e=new URL(t,window.location.href);return"http:"!==e.protocol&&"https:"!==e.protocol?null:{url:e.href,label:n.trim()}}catch{return null}})(e.message.navigation);n&&t.push({timestamp:e.timetoken,navigation:n,isLeadMessage:!1,type:Ju.navigation})}else if("media"===e.message.messageType)t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:Ju.media});else{if("string"!=typeof e.message.text)return;!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:Ju.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:Ju.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.chatStorageSlug=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};this.centralConvo&&(i.central_convo=!0),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&&Jo({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e}),null}}adoptBuilding(e,t){this.buildingSlug=e,this.buildingWebchatView=t}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(Pu())({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}if(this.centralConvo)return null;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&&Jo({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Jo({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Jo({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}}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!==Yu.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&&Jo({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:Zo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}},td=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"]),nd=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return td.has(t)},id=(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.-]?)?(?:\([2-9]\d{2}\)[\s.-]?|[2-9]\d{2}[\s.-])[2-9]\d{2}[\s.-]?\d{4}/g,d=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,c=/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))},b=document.body.getElementsByTagName("*");let y=!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<b.length;e++)if(b[e].nodeType===Node.ELEMENT_NODE&&!m(b[e])){if(1===b[e].childNodes.length&&b[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=b[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(nd(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,b[e].textContent=n),y=!0,w||(w=!0)}if(b[e].hasAttribute("href")){const t=b[e].getAttribute("href");if(!t)continue;let n="",i=d;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=c):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,nd(t))continue;const u=t.replace(i,n);if(b[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&b[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t}),C&&Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t}),y||Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:Zo.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:Zo.error,buildingSlug:n,orgSlug:t,error:e}),0}},rd=(e,t,n,i)=>{document.querySelectorAll("a").forEach(function(r){const o=r.getAttribute("href");o&&o.startsWith("https://app.meetelise.com/")&&((e,t,n)=>{const[i,r,o,...a]=new URL(e).pathname.split("/").filter(Boolean).map(e=>e.toLowerCase());return 0===a.length&&"tour"===o&&i===t.toLowerCase()&&r===n.toLowerCase()})(o,t,n)&&r.addEventListener("click",t=>{i()&&(t.preventDefault(),e(t))})})};var od=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 ad=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=qn,this.foregroundColorOnPrimaryBackgroundColor="white",this.toExpand=!1}render(){return U`
6460
6460
  <button
6461
6461
  class=${this.toExpand?"button-container mini":"button-container"}
6462
6462
  @click=${this.onClick}
@@ -6688,8 +6688,7 @@ xmlns="http://www.w3.org/2000/svg"
6688
6688
  justify-content: space-between;
6689
6689
  }
6690
6690
  .leasing-conversation-body-backdrop {
6691
- background: rgba(193, 193, 193, 0.5);
6692
- backdrop-filter: blur(4px);
6691
+ background: #efefef;
6693
6692
 
6694
6693
  border-top: 1px solid rgba(0, 0, 0, 0.1);
6695
6694
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
@@ -6980,7 +6979,7 @@ xmlns="http://www.w3.org/2000/svg"
6980
6979
  transform: rotate(360deg);
6981
6980
  }
6982
6981
  }
6983
- `,gc([ue({type:Number})],mc.prototype,"spinSpeed",void 0),mc=gc([se("mini-loader")],mc);var bc=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 yc=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=ah.Default}isMessageStillStreamingChunks(){if(!this.message)return!1;const e=this.message.chunks.find(e=>e.isDone);return!e||this.message.chunks.length===e.order}updated(e){if(this.onMount(),!e.has("message"))return;if(!this.message)return;const{hyperlinks:t,markedText:n}=this.mapAndMarkHyperLinks(this.message.message),i=/(https?:\/\/[^\s]+)/g,r=[],o=[];this.parsedMessage=U`${n.trim().split("\n").map(e=>{const n=this.sanitizeMarkdownText(e),a=this.preserveHTMLTags(n);return a?U`${a.map(e=>{const n=t.filter(t=>e.includes(t.id));if(n.length){let t=e;return n.forEach(e=>{o.push({redirectTo:e.link,source:e.link}),t=t.replace(e.id,this.hyperlinkHTML(e.link,e.hyperlink))}),U`${ko(fc.sanitize(t,{ADD_ATTR:["target"]}))} `}if(i.test(e)){const t=this.removeTrailingPunctuation(e);return r.push(this.getLinkData(t)),U`<a
6982
+ `,gc([ue({type:Number})],mc.prototype,"spinSpeed",void 0),mc=gc([se("mini-loader")],mc);var bc=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 yc=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=sh.Default}isMessageStillStreamingChunks(){if(!this.message)return!1;const e=this.message.chunks.find(e=>e.isDone);return!e||this.message.chunks.length===e.order}updated(e){if(this.onMount(),!e.has("message"))return;if(!this.message)return;const{hyperlinks:t,markedText:n}=this.mapAndMarkHyperLinks(this.message.message),i=/(https?:\/\/[^\s]+)/g,r=[],o=[];this.parsedMessage=U`${n.trim().split("\n").map(e=>{const n=this.sanitizeMarkdownText(e),a=this.preserveHTMLTags(n);return a?U`${a.map(e=>{const n=t.filter(t=>e.includes(t.id));if(n.length){let t=e;return n.forEach(e=>{o.push({redirectTo:e.link,source:e.link}),t=t.replace(e.id,this.hyperlinkHTML(e.link,e.hyperlink))}),U`${ko(fc.sanitize(t,{ADD_ATTR:["target"]}))} `}if(i.test(e)){const t=this.removeTrailingPunctuation(e);return r.push(this.getLinkData(t)),U`<a
6984
6983
  class="redirect-link"
6985
6984
  href="${t}"
6986
6985
  target="_blank"
@@ -6989,7 +6988,7 @@ xmlns="http://www.w3.org/2000/svg"
6989
6988
  </a>`}return U`${ko(fc.sanitize(e))} `})}<br />`:U``})}`,this.imagesToDisplay=o,Promise.all(r).then(e=>{this.websitePreviewInfo=e})}hyperlinkHTML(e,t){const n=document.createElement("a");return n.className="redirect-link",n.href=e,n.target="_blank",n.rel="noopener noreferrer",n.textContent=t,n.outerHTML}preserveHTMLTags(e){var t;const n=e.match(/(<\/?[a-z][^>]*>[^<]*<\/?[a-z]*>|[^\s]+[.,?!]?|\S)/gi);return null!==(t=null==n?void 0:n.filter(e=>""!==e.trim()))&&void 0!==t?t:[]}sanitizeMarkdownText(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim,"<b>$1</b>").replace(/\*(.*?)\*/gim,"<i>$1</i>").trim()}removeTrailingPunctuation(e){return[".",",","!","?",":",";"].includes(e[e.length-1])?this.removeTrailingPunctuation(e.slice(0,-1)):e}mapAndMarkHyperLinks(e){const t=Array.from(e.matchAll(/<https?:\/\/[^|]+\|[^>]+>|<a href="[^"]+"(?: target="[^"]*")?>[^<]+<\/a>|\[.*?\]\([^)]*\.[^)]*\)/g)),n=[],i=t.map(t=>{const n=t[0];if(void 0===t.index)return;const i=e[t.index-1],r=e[t.index+n.length];if(n.startsWith("<https")||n.startsWith("<http"))return{matchedLink:n,link:n.split("|")[0].replace("<",""),hyperlink:n.split("|")[1].replace(">",""),addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)};if(n.startsWith("<a href=")){const e=n.match(/href="([^"]+)"/),t=n.match(/>[^<]+</);return{matchedLink:n,link:e?e[1]:"",hyperlink:t?t[0].slice(1,-1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}{const[e,t]=n.split("](");return{matchedLink:n,link:t?t.slice(0,-1):"",hyperlink:e?e.slice(1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}});return i.forEach(t=>{if(t&&t.link&&t.hyperlink){const i=Bu().replace(/-/g,"");n.push({link:this.removeTrailingPunctuation(t.link),hyperlink:this.removeTrailingPunctuation(t.hyperlink),mark:t.matchedLink,id:i}),e=e.replace(t.matchedLink,`${t.addSpaceBefore?" ":""}${i}${t.addSpaceAfter?" ":""}`)}}),{hyperlinks:n,markedText:e}}async getLinkData(e){var t,n,i,o;try{const a=(await r().get(e)).data,s=(new DOMParser).parseFromString(a,"text/html");return s?{title:null!==(n=null===(t=s.querySelector("title"))||void 0===t?void 0:t.textContent)&&void 0!==n?n:null,description:(null===(i=s.querySelector('meta[name="description"]'))||void 0===i?void 0:i.getAttribute("content"))||null,image:(null===(o=s.querySelector('meta[property="og:image"]'))||void 0===o?void 0:o.getAttribute("content"))||null,favicon:null,link:e}:{title:null,description:null,image:null,favicon:null,link:e}}catch(t){return{title:null,description:null,image:null,favicon:null,link:e}}}render(){return this.message?U`<div class="message-inner-body">
6990
6989
  ${this.isMessageStillStreamingChunks()?U`<div class="message-loader"><mini-loader></mini-loader></div>`:""}
6991
6990
  <p
6992
- class=${be({"message-text":this.widgetType!==ah.Utilities,"message-text-large":this.widgetType===ah.Utilities,"webchat-font__desktop":!Tr(),"webchat-font__mobile":Tr()})}
6991
+ class=${be({"message-text":this.widgetType!==sh.Utilities,"message-text-large":this.widgetType===sh.Utilities,"webchat-font__desktop":!Tr(),"webchat-font__mobile":Tr()})}
6993
6992
  >
6994
6993
  ${this.parsedMessage}
6995
6994
  </p>
@@ -7020,9 +7019,9 @@ xmlns="http://www.w3.org/2000/svg"
7020
7019
  />`:""}
7021
7020
 
7022
7021
  <div class="website-preview-body">
7023
- <p class=${be({"message-text":this.widgetType!==ah.Utilities,"message-text-large":this.widgetType===ah.Utilities,"website-preview-title":!0,"webchat-font__desktop":!Tr(),"webchat-font__mobile":Tr()})}>${e.title}</p>
7022
+ <p class=${be({"message-text":this.widgetType!==sh.Utilities,"message-text-large":this.widgetType===sh.Utilities,"website-preview-title":!0,"webchat-font__desktop":!Tr(),"webchat-font__mobile":Tr()})}>${e.title}</p>
7024
7023
  ${e.description?U`<p
7025
- class=${be({"message-text":this.widgetType!==ah.Utilities,"message-text-large":this.widgetType===ah.Utilities,"website-preview-description":!0,"webchat-font__desktop":!Tr(),"webchat-font__mobile":Tr()})}
7024
+ class=${be({"message-text":this.widgetType!==sh.Utilities,"message-text-large":this.widgetType===sh.Utilities,"website-preview-description":!0,"webchat-font__desktop":!Tr(),"webchat-font__mobile":Tr()})}
7026
7025
  >
7027
7026
  ${e.description}
7028
7027
  </p>`:""}
@@ -7296,11 +7295,11 @@ xmlns="http://www.w3.org/2000/svg"
7296
7295
  <path fill-rule="evenodd" clip-rule="evenodd" d="M15 0C17.7614 0 20 2.23858 20 5V15C20 17.7614 17.7614 20 15 20H5C2.23858 20 0 17.7614 0 15V5C0 2.23858 2.23858 0 5 0H15ZM18 5C18 3.34315 16.6569 2 15 2H5C3.34315 2 2 3.34315 2 5V15C2 16.6569 3.34315 18 5 18H15C16.6569 18 18 16.6569 18 15V5Z" fill="${e}"/>
7297
7296
  <path d="M12.1893 9.25L10.4697 7.53033C10.1768 7.23744 10.1768 6.76256 10.4697 6.46967C10.7626 6.17678 11.2374 6.17678 11.5303 6.46967L13.8232 8.76256C14.5066 9.44598 14.5066 10.554 13.8232 11.2374L11.5303 13.5303C11.2374 13.8232 10.7626 13.8232 10.4697 13.5303C10.1768 13.2374 10.1768 12.7626 10.4697 12.4697L12.1893 10.75L6 10.75C5.58579 10.75 5.25 10.4142 5.25 10C5.25 9.58579 5.58579 9.25 6 9.25L12.1893 9.25Z" fill="${e}"/>
7298
7297
  </svg>
7299
- `;var Tc,_c=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 Oc=Tc=class extends oe{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.centralConvo=!1,this.widgetType=ah.Default,this.primaryColor=qn,this.backgroundColor=Yn,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this._isMobile=Tr(),this.shouldAutoScroll=!0,this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;0!==e.length&&(this.shouldAutoScroll=!0,this.messageInput.value="",this.autoResizeMessageInput(),0===this.messages.length&&(this.messages=[{timestamp:0,message:e,isLeadMessage:!0,chunks:[{text:e,order:0,isDone:!0}],type:Ju.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e)))},this.scrollToChatBottom=()=>{this.shouldAutoScroll&&this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"auto"})},this.handleConversationScroll=e=>{const t=e.currentTarget,n=t.scrollHeight-t.clientHeight-t.scrollTop;this.shouldAutoScroll=n<=Tc.AUTO_SCROLL_THRESHOLD_PX},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>this.requiresConsent&&!this.hasReceivedConsent}get consentKey(){return`${this.orgSlug}Consent`}connectedCallback(){super.connectedCallback(),this._cleanupMobileListener=_r(e=>{this._isMobile=e})}disconnectedCallback(){var e;null===(e=this._cleanupMobileListener)||void 0===e||e.call(this),super.disconnectedCallback()}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.simpleChatMessages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener(e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading}),this.onMount();const n=localStorage.getItem(this.consentKey);if(!n)return void(this.hasReceivedConsent=!1);const i=JSON.parse(n),{timestamp:r,consentId:o}=i;Sc(new Date,new Date(r))<7&&o===jo?this.hasReceivedConsent=!0:(this.hasReceivedConsent=!1,localStorage.removeItem(this.consentKey))}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){}}render(){var e,t,n,i,r,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x;if(!this.buildingSlug&&!this.centralConvo)return U``;const $=null===(e=this.building)||void 0===e?void 0:e.id;let S={};if(S=this._isMobile?{top:void 0,bottom:0,left:void 0,right:0}:{top:void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:void 0===this.bottom||isNaN(this.bottom)?"130px":`${this.bottom}px`,left:void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:void 0===this.right||isNaN(this.right)?"18px":`${this.right}px`},22320===$&&(S={...S,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===ah.Utilities)return U`
7298
+ `;var Tc,_c=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 Oc=Tc=class extends oe{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.centralConvo=!1,this.widgetType=sh.Default,this.primaryColor=qn,this.backgroundColor=Yn,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this._isMobile=Tr(),this.shouldAutoScroll=!0,this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;0!==e.length&&(this.shouldAutoScroll=!0,this.messageInput.value="",this.autoResizeMessageInput(),0===this.messages.length&&(this.messages=[{timestamp:0,message:e,isLeadMessage:!0,chunks:[{text:e,order:0,isDone:!0}],type:Ju.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e)))},this.scrollToChatBottom=()=>{this.shouldAutoScroll&&this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"auto"})},this.handleConversationScroll=e=>{const t=e.currentTarget,n=t.scrollHeight-t.clientHeight-t.scrollTop;this.shouldAutoScroll=n<=Tc.AUTO_SCROLL_THRESHOLD_PX},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>this.requiresConsent&&!this.hasReceivedConsent}get consentKey(){return`${this.orgSlug}Consent`}connectedCallback(){super.connectedCallback(),this._cleanupMobileListener=_r(e=>{this._isMobile=e})}disconnectedCallback(){var e;null===(e=this._cleanupMobileListener)||void 0===e||e.call(this),super.disconnectedCallback()}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.simpleChatMessages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener(e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading}),this.onMount();const n=localStorage.getItem(this.consentKey);if(!n)return void(this.hasReceivedConsent=!1);const i=JSON.parse(n),{timestamp:r,consentId:o}=i;Sc(new Date,new Date(r))<7&&o===jo?this.hasReceivedConsent=!0:(this.hasReceivedConsent=!1,localStorage.removeItem(this.consentKey))}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){}}render(){var e,t,n,i,r,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$;if(!this.buildingSlug&&!this.centralConvo)return U``;const S=(null===(e=this.building)||void 0===e?void 0:e.userFirstName)||"Elise",A=null===(t=this.building)||void 0===t?void 0:t.id;let k={};if(k=this._isMobile?{top:void 0,bottom:0,left:void 0,right:0}:{top:void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:void 0===this.bottom||isNaN(this.bottom)?"130px":`${this.bottom}px`,left:void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:void 0===this.right||isNaN(this.right)?"18px":`${this.right}px`},22320===A&&(k={...k,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===sh.Utilities)return U`
7300
7299
  <div
7301
7300
  id="utilities-container"
7302
7301
  class=${be({"pubnub-container__mobile":this._isMobile,"utilities-container__desktop":!this._isMobile})}
7303
- style=${Vn(S)}
7302
+ style=${Vn(k)}
7304
7303
  >
7305
7304
  <div id="utilities-header">
7306
7305
  <div>
@@ -7317,7 +7316,7 @@ xmlns="http://www.w3.org/2000/svg"
7317
7316
  <div
7318
7317
  class=${be({hidden:!this.needsConsent(),"legal-confirmation-container":!0})}
7319
7318
  >
7320
- ${Fo(null!==(t=this.orgSlug)&&void 0!==t?t:null,this.privacyPolicyUrl,this.consentKey,e=>{this.hasReceivedConsent=e},null!==(i=null===(n=this.building)||void 0===n?void 0:n.country)&&void 0!==i?i:null)}
7319
+ ${Fo(null!==(n=this.orgSlug)&&void 0!==n?n:null,this.privacyPolicyUrl,this.consentKey,e=>{this.hasReceivedConsent=e},null!==(r=null===(i=this.building)||void 0===i?void 0:i.country)&&void 0!==r?r:null)}
7321
7320
  </div>
7322
7321
  <div
7323
7322
  id="conversation-body"
@@ -7331,27 +7330,25 @@ xmlns="http://www.w3.org/2000/svg"
7331
7330
  class=${be({hidden:this.needsConsent()})}
7332
7331
  >
7333
7332
  <li class="utilities-disclaimer-message">
7334
- ${Ho({orgSlug:null!==(r=this.orgSlug)&&void 0!==r?r:"",type:"utilities",buildingState:null!==(a=null===(o=this.building)||void 0===o?void 0:o.state)&&void 0!==a?a:null})}
7333
+ ${Ho({orgSlug:null!==(o=this.orgSlug)&&void 0!==o?o:"",type:"utilities",buildingState:null!==(s=null===(a=this.building)||void 0===a?void 0:a.state)&&void 0!==s?s:null})}
7335
7334
  </li>
7336
7335
  <li
7337
7336
  class="message-container ai-message"
7338
- tabindex="0"
7339
7337
  role="article"
7340
- aria-label="Elise: Hi I'm Elise. How can I assist you today?"
7338
+ aria-label="${S}: Hi I'm ${S}. How can I assist you today?"
7341
7339
  >
7342
7340
  <p
7343
7341
  class=${be({"message-text-large":!0,"webchat-font__desktop":!this._isMobile,"webchat-font__mobile":this._isMobile})}
7344
7342
  >
7345
- Hi I'm Elise. How can I assist you today?
7343
+ Hi I'm ${S}. How can I assist you today?
7346
7344
  </p>
7347
7345
  </li>
7348
7346
  ${this.messages.map(e=>U`
7349
7347
  <li
7350
7348
  class=${e.isLeadMessage?"message-container lead-message":"message-container ai-message"}
7351
7349
  key=${e.timestamp}
7352
- tabindex="0"
7353
7350
  role="article"
7354
- aria-label="${e.isLeadMessage?"You":"Elise"}: ${Pc(e)}"
7351
+ aria-label="${e.isLeadMessage?"You":S}: ${Pc(e)}"
7355
7352
  >
7356
7353
  ${Zu(e)?U`<pubnub-navigation
7357
7354
  .message=${e}
@@ -7394,6 +7391,7 @@ xmlns="http://www.w3.org/2000/svg"
7394
7391
  <div id="utilities-inner-footer">
7395
7392
  <textarea
7396
7393
  id="message-input"
7394
+ aria-label="Message"
7397
7395
  class=${be({"webchat-font__desktop":!this._isMobile,"webchat-font__mobile":this._isMobile})}
7398
7396
  placeholder="Ask a Question..."
7399
7397
  @keydown=${e=>{"Enter"===e.key&&(e.preventDefault(),this.sendMessage(this.messageInput.value))}}
@@ -7411,11 +7409,11 @@ xmlns="http://www.w3.org/2000/svg"
7411
7409
  </div>
7412
7410
  </div>
7413
7411
  </div>
7414
- `;if(this.widgetType===ah.Healthcare)return U`
7412
+ `;if(this.widgetType===sh.Healthcare)return U`
7415
7413
  <div
7416
7414
  id="healthchat-container"
7417
7415
  class=${be({"pubnub-container__mobile":this._isMobile,"healthchat-container__desktop":!this._isMobile})}
7418
- style=${Vn(S)}
7416
+ style=${Vn(k)}
7419
7417
  >
7420
7418
  <div id="healthchat-header">
7421
7419
  ${"6a9e65e5-9699-4c96-af75-1741d0df79aa"===this.buildingSlug?U` <div>
@@ -7436,7 +7434,7 @@ xmlns="http://www.w3.org/2000/svg"
7436
7434
  <div
7437
7435
  class=${be({hidden:!this.needsConsent(),"legal-confirmation-container":!0})}
7438
7436
  >
7439
- ${Fo(null!==(s=this.orgSlug)&&void 0!==s?s:null,this.privacyPolicyUrl,this.consentKey,e=>{this.hasReceivedConsent=e},null!==(u=null===(l=this.building)||void 0===l?void 0:l.country)&&void 0!==u?u:null)}
7437
+ ${Fo(null!==(l=this.orgSlug)&&void 0!==l?l:null,this.privacyPolicyUrl,this.consentKey,e=>{this.hasReceivedConsent=e},null!==(d=null===(u=this.building)||void 0===u?void 0:u.country)&&void 0!==d?d:null)}
7440
7438
  </div>
7441
7439
  <div
7442
7440
  id="conversation-body"
@@ -7450,28 +7448,26 @@ xmlns="http://www.w3.org/2000/svg"
7450
7448
  class=${be({hidden:this.needsConsent()})}
7451
7449
  >
7452
7450
  <li class="healthcare-disclaimer-message">
7453
- ${Ho({orgSlug:null!==(d=this.orgSlug)&&void 0!==d?d:"",type:"healthcare",buildingState:null!==(h=null===(c=this.building)||void 0===c?void 0:c.state)&&void 0!==h?h:null})}
7451
+ ${Ho({orgSlug:null!==(c=this.orgSlug)&&void 0!==c?c:"",type:"healthcare",buildingState:null!==(p=null===(h=this.building)||void 0===h?void 0:h.state)&&void 0!==p?p:null})}
7454
7452
  </li>
7455
7453
  <li
7456
7454
  class="message-container ai-message"
7457
- tabindex="0"
7458
7455
  role="article"
7459
- aria-label="Elise: Hi I'm Elise. If this is a medical emergency, please call 911. How can I assist you today?"
7456
+ aria-label="${S}: Hi I'm ${S}. If this is a medical emergency, please call 911. How can I assist you today?"
7460
7457
  >
7461
7458
  <p
7462
7459
  class=${be({"message-text":!0,"webchat-font__desktop":!this._isMobile,"webchat-font__mobile":this._isMobile})}
7463
7460
  >
7464
- Hi I'm Elise. If this is a medical emergency, please call 911.
7465
- How can I assist you today?
7461
+ Hi I'm ${S}. If this is a medical emergency,
7462
+ please call 911. How can I assist you today?
7466
7463
  </p>
7467
7464
  </li>
7468
7465
  ${this.messages.map(e=>U`
7469
7466
  <li
7470
7467
  class=${e.isLeadMessage?"message-container lead-message":"message-container ai-message"}
7471
7468
  key=${e.timestamp}
7472
- tabindex="0"
7473
7469
  role="article"
7474
- aria-label="${e.isLeadMessage?"You":"Elise"}: ${Pc(e)}"
7470
+ aria-label="${e.isLeadMessage?"You":S}: ${Pc(e)}"
7475
7471
  >
7476
7472
  ${Zu(e)?U`<pubnub-navigation
7477
7473
  .message=${e}
@@ -7514,6 +7510,7 @@ xmlns="http://www.w3.org/2000/svg"
7514
7510
  <div id="healthcare-inner-footer">
7515
7511
  <textarea
7516
7512
  id="message-input"
7513
+ aria-label="Message"
7517
7514
  class=${be({"webchat-font__desktop":!this._isMobile,"webchat-font__mobile":this._isMobile})}
7518
7515
  placeholder="Ask a Question..."
7519
7516
  @keydown=${e=>{"Enter"===e.key&&(e.preventDefault(),this.sendMessage(this.messageInput.value))}}
@@ -7531,11 +7528,11 @@ xmlns="http://www.w3.org/2000/svg"
7531
7528
  </div>
7532
7529
  </div>
7533
7530
  </div>
7534
- `;if(!this.building)return U``;const A=this.building.orgId;return U`
7531
+ `;if(!this.building)return U``;const E=this.building.orgId;return U`
7535
7532
  <div
7536
7533
  id="pubnub-chat-container"
7537
7534
  class=${be({"pubnub-container__mobile":this._isMobile,"pubnub-container__desktop":!this._isMobile})}
7538
- style=${Vn(S)}
7535
+ style=${Vn(k)}
7539
7536
  @keydown=${e=>e.stopPropagation()}
7540
7537
  @keyup=${e=>e.stopPropagation()}
7541
7538
  >
@@ -7555,7 +7552,7 @@ xmlns="http://www.w3.org/2000/svg"
7555
7552
  <div
7556
7553
  class=${be({hidden:!this.needsConsent(),"legal-confirmation-container":!0})}
7557
7554
  >
7558
- ${Fo(null!==(p=this.orgSlug)&&void 0!==p?p:null,this.privacyPolicyUrl,this.consentKey,e=>{this.hasReceivedConsent=e},null!==(g=null===(f=this.building)||void 0===f?void 0:f.country)&&void 0!==g?g:null)}
7555
+ ${Fo(null!==(f=this.orgSlug)&&void 0!==f?f:null,this.privacyPolicyUrl,this.consentKey,e=>{this.hasReceivedConsent=e},null!==(m=null===(g=this.building)||void 0===g?void 0:g.country)&&void 0!==m?m:null)}
7559
7556
  </div>
7560
7557
  <div
7561
7558
  id="conversation-body"
@@ -7569,12 +7566,11 @@ xmlns="http://www.w3.org/2000/svg"
7569
7566
  aria-live="polite"
7570
7567
  class=${be({hidden:this.needsConsent()})}
7571
7568
  >
7572
- ${Ho({orgSlug:null!==(m=this.orgSlug)&&void 0!==m?m:"",buildingState:null!==(y=null===(b=this.building)||void 0===b?void 0:b.state)&&void 0!==y?y:null,buildingCountry:null!==(w=null===(v=this.building)||void 0===v?void 0:v.country)&&void 0!==w?w:null,type:"leasing",customAdditionalDisclaimer:null===(C=this.building)||void 0===C?void 0:C.customAdditionalDisclaimer})}
7569
+ ${Ho({orgSlug:null!==(b=this.orgSlug)&&void 0!==b?b:"",buildingState:null!==(v=null===(y=this.building)||void 0===y?void 0:y.state)&&void 0!==v?v:null,buildingCountry:null!==(C=null===(w=this.building)||void 0===w?void 0:w.country)&&void 0!==C?C:null,type:"leasing",customAdditionalDisclaimer:null===(x=this.building)||void 0===x?void 0:x.customAdditionalDisclaimer})}
7573
7570
  ${this.building.welcomeMessage?U` <li
7574
- class=${be({"message-container":!0,"ai-message":!0,"with-box-shadow":444===A})}
7575
- tabindex="0"
7571
+ class=${be({"message-container":!0,"ai-message":!0,"with-box-shadow":444===E})}
7576
7572
  role="article"
7577
- aria-label="Elise: ${this.building.welcomeMessage}"
7573
+ aria-label="${S}: ${this.building.welcomeMessage}"
7578
7574
  >
7579
7575
  <p
7580
7576
  class=${be({"message-text":!0,"webchat-font__desktop":!this._isMobile,"webchat-font__mobile":this._isMobile})}
@@ -7584,11 +7580,10 @@ xmlns="http://www.w3.org/2000/svg"
7584
7580
  </li>`:""}
7585
7581
  ${this.messages.map(e=>U`
7586
7582
  <li
7587
- class=${ho()("message-container",{"lead-message":e.isLeadMessage,"ai-message":!e.isLeadMessage,"with-box-shadow":444===A})}
7583
+ class=${ho()("message-container",{"lead-message":e.isLeadMessage,"ai-message":!e.isLeadMessage,"with-box-shadow":444===E})}
7588
7584
  key=${e.timestamp}
7589
- tabindex="0"
7590
7585
  role="article"
7591
- aria-label="${e.isLeadMessage?"You":"Elise"}: ${Pc(e)}"
7586
+ aria-label="${e.isLeadMessage?"You":S}: ${Pc(e)}"
7592
7587
  >
7593
7588
  ${Zu(e)?U`<pubnub-navigation
7594
7589
  .message=${e}
@@ -7627,6 +7622,7 @@ xmlns="http://www.w3.org/2000/svg"
7627
7622
  >
7628
7623
  <textarea
7629
7624
  id="message-input"
7625
+ aria-label="Message"
7630
7626
  class=${be({"webchat-font__desktop":!this._isMobile,"webchat-font__mobile":this._isMobile})}
7631
7627
  style=${Vn({color:Jn(this.building.orgId,this.building.id)&&this.primaryColor!==qn?"black":void 0})}
7632
7628
  placeholder="Ask a question..."
@@ -7639,15 +7635,14 @@ xmlns="http://www.w3.org/2000/svg"
7639
7635
  tabindex="0"
7640
7636
  id="send-message-bttn"
7641
7637
  @click=${()=>this.sendMessage(this.messageInput.value)}
7642
- ?disabled=${null===(x=this.myPubnub)||void 0===x?void 0:x.isCurrentlyStreamingMessage}
7638
+ ?disabled=${null===($=this.myPubnub)||void 0===$?void 0:$.isCurrentlyStreamingMessage}
7643
7639
  aria-label="Send message"
7644
- aria-describedby="Send message"
7645
7640
  >
7646
7641
  ${Jn(this.building.orgId,this.building.id)&&this.primaryColor!==qn?Ec("black"):Ec("white")}
7647
7642
  </button>
7648
7643
  </div>
7649
7644
  </div>
7650
- `}};Oc.AUTO_SCROLL_THRESHOLD_PX=32,Oc.styles=[Oe,ud,ld,sd,Ac],_c([ue({type:Number})],Oc.prototype,"right",void 0),_c([ue({type:Number})],Oc.prototype,"bottom",void 0),_c([ue({type:Number})],Oc.prototype,"top",void 0),_c([ue({type:Number})],Oc.prototype,"left",void 0),_c([ue({attribute:!0})],Oc.prototype,"onMount",void 0),_c([ue({attribute:!0})],Oc.prototype,"channel",void 0),_c([ue({attribute:!0})],Oc.prototype,"isHealthChat",void 0),_c([ue({attribute:!0})],Oc.prototype,"myPubnub",void 0),_c([ue({attribute:!0})],Oc.prototype,"orgSlug",void 0),_c([ue({attribute:!0})],Oc.prototype,"buildingSlug",void 0),_c([ue({attribute:!0})],Oc.prototype,"centralConvo",void 0),_c([ue({attribute:!0})],Oc.prototype,"widgetType",void 0),_c([ue({attribute:!0})],Oc.prototype,"building",void 0),_c([ue({attribute:!0})],Oc.prototype,"primaryColor",void 0),_c([ue({attribute:!0})],Oc.prototype,"backgroundColor",void 0),_c([ue({attribute:!0})],Oc.prototype,"onClickExit",void 0),_c([ue({attribute:!0})],Oc.prototype,"requiresConsent",void 0),_c([ce("#message-input",!0)],Oc.prototype,"messageInput",void 0),_c([ce("#conversation-body",!0)],Oc.prototype,"messageBody",void 0),_c([de()],Oc.prototype,"_isMobile",void 0),_c([de()],Oc.prototype,"messages",void 0),_c([de()],Oc.prototype,"isLoadingMessages",void 0),_c([de()],Oc.prototype,"hasReceivedConsent",void 0),_c([de()],Oc.prototype,"privacyPolicyUrl",void 0),_c([de()],Oc.prototype,"websitePreviewMapping",void 0),Oc=Tc=_c([se("pubnub-chat")],Oc);const Pc=e=>Ku(e)?e.message:Zu(e)?`Take me to ${e.navigation.label}`:"Media message",Ic="cdn.skypack.dev/@meetelise/chat",Nc="cdn.eliseai.com/@meetelise/chat",Mc=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(Ic)||n.includes(Ic))return"skypack";if(e.includes(Nc)||n.includes(Nc))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){}},Dc=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,Lc={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},Rc="https://applications.eliseai.com",Uc=["Check Availability","Apply Now"],Bc=(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&&Uc.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"),Jo({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:Zo.info,buildingSlug:i,orgSlug:n}),!0},jc=(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&&Bc(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)Bc(s[e],t,n,i)}},Fc=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)Bc(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)jc(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Hc{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Rr(Br(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=vo();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Xo()).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:Rr(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:Rr(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Jo({logType:Zo.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=ia(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:Rr(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Rr(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Wr(e.timestampInitiallyLogged).getTime()-Wr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Rr(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:Rr(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=>Wr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Gc,zc=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 Qc=Gc=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.centralConvo=!1,this.declaredBuildingSlug="",this.orgLevel=!1,this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=Tr(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=fo.always,this.bedroomPreferenceRequired=!1,this.brokerIntakeEnabled=!1,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.openTourSchedulerOnLoad=!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=ah.Default,this.onWidgetLoaded=ru(),this.onSstClose=ru(),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()=>{var e,t;if(!this.orgSlug)return;if(!this.centralConvo&&!this.buildingSlug)return;this.centralConvo&&!this.buildingSlug&&(this.orgLevel=!0);const n=this.centralConvo?await async function(e){const t=`https://app.meetelise.com/api/pub/v1/organization/${e}/webchat/v2`,n=await r().get(t);return ca(n.data)}(this.orgSlug):await da(this.orgSlug,this.buildingSlug);if(!this.isOrgMode()){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{Mc(this.orgSlug,this.buildingSlug)}catch(e){}}if(!await rs(n,this.buildingSlug,this.orgSlug))return;ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==n?void 0:n.launchedDateTime)?.01:.05}),this.buildingWebchatView=n;const i=(()=>{try{const e="true"===sessionStorage.getItem(Qu);return sessionStorage.removeItem(Qu),e}catch{return!1}})();await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),(e=>{const t=new URLSearchParams(window.location.search),n=t.get("rwg_token"),i=t.get("elise_google_env");if(!n||!i||!e)return;const r={rwgToken:n,environment:i,buildingId:e,expiresAt:Date.now()+2592e6};localStorage.setItem(Va,JSON.stringify(r))})(null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.id)&&void 0!==t?t:0),i?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0):"tour"===new URLSearchParams(window.location.search).get("elise_open")&&(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile)?this.openTourSchedulerOnLoad=!0:this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()):"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0),this.isLoading=!1},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,A,k,E,T,_,O,P,I,N,M,D,L,R,U,B,j,F,H,G,z,Q,W,V,q,Y,K,X;const Z=this.buildingWebchatView;if(!Z)return;Z&&this.orgSlug&&!this.orgLevel&&Vc(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 J=Z.featureFlagWebchatMarketingSourceDropdownConfiguration,ee=Z.featureFlagWebchatUseDniPhoneNumberBySource,te=Z.featureFlagInsertDniIntoWebsite,ne=Z.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite;var ie;ie=Co.includes(Z.orgId),$o=ie;const[re,oe,ae,se,le]=await Promise.all([this.isOrgMode()?Promise.resolve([]):ku(this.orgSlug,this.buildingSlug),go(this.buildingSlug),Tu(this.buildingSlug),bo(this.buildingSlug),yo(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Gn(Z.phoneNumber),this.buildingWebchatView.isAip=ae),this.leadSources=re,this.featureFlagShowDropdown=J,this.bedroomPreferenceRequired=se,this.brokerIntakeEnabled=le;const ue=this.orgLevel?null:Z.textWithUsPhoneNumber?Z.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 Jo({logType:Zo.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t},error:t}),null}return null})(this.buildingSlug),de=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,ce=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,he={callDesktop:null!==(d=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(h=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.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!==(y=null===(b=this.buildingWebchatView)||void 0===b?void 0:b.shouldShowEmailDesktop)&&void 0!==y&&y,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)&&!!ue)&&void 0!==x&&x,textMobile:null!==(S=(null===($=this.buildingWebchatView)||void 0===$?void 0:$.shouldShowTextMobile)&&!!ue)&&void 0!==S&&S,sstDesktop:null!==(k=null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(T=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstMobile)&&void 0!==T&&T,calcDesktop:de,calcMobile:ce};var pe,fe;this.enabledChatWidgets=this.withOrgLevelContactOptions(cu(he),null!==(O=null===(_=this.buildingWebchatView)||void 0===_?void 0:_.phoneNumber)&&void 0!==O?O:""),this.orgLevel||(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(rd(this.handleTourClicked,this.orgSlug,this.buildingSlug,()=>this.isConnected),ne&&(fe=this.handleTourClicked,document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(e=>{e&&e.addEventListener("click",e=>{e.preventDefault(),fe(e)})})),"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===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&(pe=null!==(N=null===(I=this.LeadSourceClient)||void 0===I?void 0:I.leadSource)&&void 0!==N?N: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(pe)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(D=this.buildingWebchatView.secondaryColor)&&void 0!==D?D:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==L?L:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(R=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==R?R:null,this.webchatConfigHasAutoOpenChat=null!==(U=this.buildingWebchatView.autoOpenChat)&&void 0!==U&&U,this.requiresConsent=null!==(B=this.buildingWebchatView.requiresConsentForChat)&&void 0!==B&&B,this.hideMobileFeatures=null!==(j=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==j&&j,this.privacyPolicyUrl=null!==(F=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==F?F:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===aa.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===aa.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===aa.EMOJI&&(this.designConcept=aa.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=qn),null===this.backgroundColor&&(this.backgroundColor=Yn);const ge=null!==(G=null===(H=this.buildingWebchatView)||void 0===H?void 0:H.phoneNumber)&&void 0!==G?G:"";let me=null;if(ee&&!this.orgLevel&&(me=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:Gn(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(Q=null===(z=this.LeadSourceClient)||void 0===z?void 0:z.leadSource)&&void 0!==Q?Q:null),me&&!me.isMatch&&(me.number=ge)),te&&(null==me?void 0:me.number)){const e=id(me.number,this.orgSlug,this.buildingSlug);e>0&&ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const be=localStorage.getItem("eliseai_phone_number_devtest");be&&id(be,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=me||{number:ge,isMatch:!1,isPropertyWebsiteCatchall:!0};const ye=null!==(V=null===(W=this.LeadSourceClient)||void 0===W?void 0:W.leadSource)&&void 0!==V?V:null;ye&&(this.leadSources.includes(ye)||this.leadSources.push(ye)),this.isOrgMode()||io(Z.id);if((oe||(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isAip))&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.isLiveOnApplications)&&this.buildingSlug&&!this.orgLevel){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(\?.*)?$/,/\/content\/apply/,/\/apply-now/,/\/apply/,/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=Dc(o,e);l.setAttribute("href",s),a++,Jo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Jo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:Zo.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}if(this.buildingSlug&&this.orgSlug&&!this.orgLevel)try{(e=>{const t=Lc[e];if(!t)return 0;const n=`${Rc}/building/${t}/units`,i=`${Rc}/building/${e}/units`,r=new RegExp(`https://applications\\.eliseai\\.com/building/${t}/units`,"g");let o=0;const a=document.body.getElementsByTagName("a");for(let e=0;e<a.length;e++){const t=a[e],s=t.getAttribute("href");if(!s||!s.includes(n))continue;const l=s.replace(r,i);l!==s&&(t.setAttribute("href",l),o++)}document.body.querySelectorAll("[onclick]").forEach(e=>{const t=e.getAttribute("onclick");if(!t||!t.includes(n))return;const a=t.replace(r,i);a!==t&&(e.setAttribute("onclick",a),o++)})})(this.buildingSlug)}catch{}this.buildingSlug&&!this.orgLevel&&(null===(K=this.buildingWebchatView)||void 0===K?void 0:K.isLiveOnApplications)&&(null===(X=this.buildingWebchatView)||void 0===X?void 0:X.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Fc(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a,s,l,u;if(!this.buildingWebchatView)return;const d=this.chatStorageSlug(),c=Hu(d),h=Gu(d,c),p=h?c:Fu(d,!1);if(!p.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new ra,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new Hc(this.orgSlug,this.buildingSlug),this.myPubnub=new ed(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,p.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),this.myPubnub.chatStorageSlug=d,this.centralConvo){const e=this.myPubnub;e.centralConvo=!0,this.fetchDeclaredBuildingId().then(t=>{e.declaredBuildingId=t})}else this.myPubnub.declaredBuildingId=this.buildingWebchatView.id;const f=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,h&&null!==(n=p.leadId)&&void 0!==n?n:void 0);f&&(Fu(d,p.initiatedChat,f.lead_id),this.isOrgMode()&&f.building_slug&&await this.adoptBuilding(f.building_slug)),this.LeadSourceClient.chatId=this.myPubnub.channel;const g=await(null===(i=this.LeadSourceClient)||void 0===i?void 0:i.generateUserLeadSource({leadId:null!==(o=null===(r=this.myPubnub)||void 0===r?void 0:r.leadUserId)&&void 0!==o?o:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));g&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(g),"property-website"!==ia(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:ia(this.orgSlug):this.myPubnub.leadSource=null!==(u=null===(l=this.LeadSourceClient)||void 0===l?void 0:l.leadSource)&&void 0!==u?u:null;const m=Hu(d);m.initiatedChat&&await this.myPubnub.initializePubnub(m)},this.isOrgMode=()=>this.centralConvo&&!this.buildingSlug,this.chatStorageSlug=()=>this.orgLevel?"":this.buildingSlug,this.adoptBuilding=async e=>{var t;try{const n=await da(this.orgSlug,e);if(!(null==n?void 0:n.id))return;this.buildingSlug=e,this.buildingWebchatView=n,null===(t=this.myPubnub)||void 0===t||t.adoptBuilding(e,n)}catch(e){}},this.withOrgLevelContactOptions=(e,t)=>this.orgLevel?{...e,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,callDesktop:e.callDesktop&&!!t,callMobile:e.callMobile&&!!t}:e,this.fetchDeclaredBuildingId=async()=>{if(!this.declaredBuildingSlug||!this.orgSlug)return null;try{const e=await da(this.orgSlug,this.declaredBuildingSlug);return"number"==typeof(null==e?void 0:e.id)&&e.id>0?e.id:null}catch{return null}},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Gr(Wr(t)));return!!e&&!!n&&!Tr()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",Rr(function(e,t){return ii(2,arguments),wi(e,6e4*vi(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,l;if("Tab"!==e.key)return;const u=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot;let d=[];if(this.displayPubnubChat){const e=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"),t=null===(a=this.shadowRoot)||void 0===a?void 0:a.getElementById("chatAdditionalActionsPubnub");e&&d.push(...this.collectFocusableElements(e)),t&&d.push(...this.collectFocusableElements(t))}else{const e=null!==(l=null!==(s=null==u?void 0:u.getElementById("email-us-window"))&&void 0!==s?s:null==u?void 0:u.getElementById("tour-scheduler-window"))&&void 0!==l?l:null==u?void 0:u.getElementById("call-us-window");e&&(d=this.collectFocusableElements(e))}if(0===d.length)return;e.preventDefault();const c=this.getDeepActiveElement(),h=d.findIndex(e=>e===c);d[e.shiftKey?(h-1+d.length)%d.length:(h+1)%d.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 Ko(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(),ju(this.chatStorageSlug()),this.orgLevel&&(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=_r(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(Gc.FOCUSABLE_SELECTOR)&&Gc.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){Jo({logType:Zo.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,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,A,k,E,T,_,O,P,I,N,M,D,L,R,B,j,F,H,G,z,Q,W,V;lu();const q=this.hideLauncher&&!this.isLoading&&!this._isMobile;return U`
7645
+ `}};Oc.AUTO_SCROLL_THRESHOLD_PX=32,Oc.styles=[Oe,ud,ld,sd,Ac],_c([ue({type:Number})],Oc.prototype,"right",void 0),_c([ue({type:Number})],Oc.prototype,"bottom",void 0),_c([ue({type:Number})],Oc.prototype,"top",void 0),_c([ue({type:Number})],Oc.prototype,"left",void 0),_c([ue({attribute:!0})],Oc.prototype,"onMount",void 0),_c([ue({attribute:!0})],Oc.prototype,"channel",void 0),_c([ue({attribute:!0})],Oc.prototype,"isHealthChat",void 0),_c([ue({attribute:!0})],Oc.prototype,"myPubnub",void 0),_c([ue({attribute:!0})],Oc.prototype,"orgSlug",void 0),_c([ue({attribute:!0})],Oc.prototype,"buildingSlug",void 0),_c([ue({attribute:!0})],Oc.prototype,"centralConvo",void 0),_c([ue({attribute:!0})],Oc.prototype,"widgetType",void 0),_c([ue({attribute:!0})],Oc.prototype,"building",void 0),_c([ue({attribute:!0})],Oc.prototype,"primaryColor",void 0),_c([ue({attribute:!0})],Oc.prototype,"backgroundColor",void 0),_c([ue({attribute:!0})],Oc.prototype,"onClickExit",void 0),_c([ue({attribute:!0})],Oc.prototype,"requiresConsent",void 0),_c([ce("#message-input",!0)],Oc.prototype,"messageInput",void 0),_c([ce("#conversation-body",!0)],Oc.prototype,"messageBody",void 0),_c([de()],Oc.prototype,"_isMobile",void 0),_c([de()],Oc.prototype,"messages",void 0),_c([de()],Oc.prototype,"isLoadingMessages",void 0),_c([de()],Oc.prototype,"hasReceivedConsent",void 0),_c([de()],Oc.prototype,"privacyPolicyUrl",void 0),_c([de()],Oc.prototype,"websitePreviewMapping",void 0),Oc=Tc=_c([se("pubnub-chat")],Oc);const Pc=e=>Ku(e)?e.message:Zu(e)?`Take me to ${e.navigation.label}`:"Media message",Ic="cdn.skypack.dev/@meetelise/chat",Nc="cdn.eliseai.com/@meetelise/chat",Mc=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(Ic)||n.includes(Ic))return"skypack";if(e.includes(Nc)||n.includes(Nc))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){}},Dc=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,Lc={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},Rc="https://applications.eliseai.com",Uc=["Check Availability","Apply Now"],Bc=(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&&Uc.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"),Jo({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:Zo.info,buildingSlug:i,orgSlug:n}),!0},jc=(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&&Bc(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)Bc(s[e],t,n,i)}},Fc=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)Bc(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)jc(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Hc{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Rr(Br(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=vo();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Xo()).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:Rr(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:Rr(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Jo({logType:Zo.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=ia(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:Rr(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Rr(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Wr(e.timestampInitiallyLogged).getTime()-Wr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Rr(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:Rr(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=>Wr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Gc,zc=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 Qc=Gc=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.centralConvo=!1,this.declaredBuildingSlug="",this.hostDeclaredBuildingId=void 0,this.orgLevel=!1,this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=Tr(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=fo.always,this.bedroomPreferenceRequired=!1,this.brokerIntakeEnabled=!1,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.openTourSchedulerOnLoad=!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=sh.Default,this.onWidgetLoaded=ru(),this.onSstClose=ru(),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()=>{var e,t;if(!this.orgSlug)return;if(!this.centralConvo&&!this.buildingSlug)return;this.centralConvo&&!this.buildingSlug&&(this.orgLevel=!0);const n=this.centralConvo?await async function(e){const t=`https://app.meetelise.com/api/pub/v1/organization/${e}/webchat/v2`,n=await r().get(t);return ca(n.data)}(this.orgSlug):await da(this.orgSlug,this.buildingSlug);if(!this.isOrgMode()){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{Mc(this.orgSlug,this.buildingSlug)}catch(e){}}if(!await rs(n,this.buildingSlug,this.orgSlug))return;ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==n?void 0:n.launchedDateTime)?.01:.05}),this.buildingWebchatView=n;const i=(()=>{try{const e="true"===sessionStorage.getItem(Qu);return sessionStorage.removeItem(Qu),e}catch{return!1}})();await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),(e=>{const t=new URLSearchParams(window.location.search),n=t.get("rwg_token"),i=t.get("elise_google_env");if(!n||!i||!e)return;const r={rwgToken:n,environment:i,buildingId:e,expiresAt:Date.now()+2592e6};localStorage.setItem(Va,JSON.stringify(r))})(null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.id)&&void 0!==t?t:0),i?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0):"tour"===new URLSearchParams(window.location.search).get("elise_open")&&(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile)?this.openTourSchedulerOnLoad=!0:this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()):"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0),this.isLoading=!1},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,A,k,E,T,_,O,P,I,N,M,D,L,R,U,B,j,F,H,G,z,Q,W,V,q,Y,K,X;const Z=this.buildingWebchatView;if(!Z)return;Z&&this.orgSlug&&!this.orgLevel&&Vc(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 J=Z.featureFlagWebchatMarketingSourceDropdownConfiguration,ee=Z.featureFlagWebchatUseDniPhoneNumberBySource,te=Z.featureFlagInsertDniIntoWebsite,ne=Z.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite;var ie;ie=Co.includes(Z.orgId),$o=ie;const[re,oe,ae,se,le]=await Promise.all([this.isOrgMode()?Promise.resolve([]):ku(this.orgSlug,this.buildingSlug),go(this.buildingSlug),Tu(this.buildingSlug),bo(this.buildingSlug),yo(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Gn(Z.phoneNumber),this.buildingWebchatView.isAip=ae),this.leadSources=re,this.featureFlagShowDropdown=J,this.bedroomPreferenceRequired=se,this.brokerIntakeEnabled=le;const ue=this.orgLevel?null:Z.textWithUsPhoneNumber?Z.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 Jo({logType:Zo.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t},error:t}),null}return null})(this.buildingSlug),de=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,ce=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,he={callDesktop:null!==(d=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(h=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.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!==(y=null===(b=this.buildingWebchatView)||void 0===b?void 0:b.shouldShowEmailDesktop)&&void 0!==y&&y,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)&&!!ue)&&void 0!==x&&x,textMobile:null!==(S=(null===($=this.buildingWebchatView)||void 0===$?void 0:$.shouldShowTextMobile)&&!!ue)&&void 0!==S&&S,sstDesktop:null!==(k=null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(T=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstMobile)&&void 0!==T&&T,calcDesktop:de,calcMobile:ce};var pe,fe;this.enabledChatWidgets=this.withOrgLevelContactOptions(cu(he),null!==(O=null===(_=this.buildingWebchatView)||void 0===_?void 0:_.phoneNumber)&&void 0!==O?O:""),this.orgLevel||(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(rd(this.handleTourClicked,this.orgSlug,this.buildingSlug,()=>this.isConnected),ne&&(fe=this.handleTourClicked,document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(e=>{e&&e.addEventListener("click",e=>{e.preventDefault(),fe(e)})})),"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===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&(pe=null!==(N=null===(I=this.LeadSourceClient)||void 0===I?void 0:I.leadSource)&&void 0!==N?N: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(pe)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(D=this.buildingWebchatView.secondaryColor)&&void 0!==D?D:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==L?L:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(R=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==R?R:null,this.webchatConfigHasAutoOpenChat=null!==(U=this.buildingWebchatView.autoOpenChat)&&void 0!==U&&U,this.requiresConsent=null!==(B=this.buildingWebchatView.requiresConsentForChat)&&void 0!==B&&B,this.hideMobileFeatures=null!==(j=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==j&&j,this.privacyPolicyUrl=null!==(F=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==F?F:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===aa.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===aa.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===aa.EMOJI&&(this.designConcept=aa.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=qn),null===this.backgroundColor&&(this.backgroundColor=Yn);const ge=null!==(G=null===(H=this.buildingWebchatView)||void 0===H?void 0:H.phoneNumber)&&void 0!==G?G:"";let me=null;if(ee&&!this.orgLevel&&(me=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:Gn(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(Q=null===(z=this.LeadSourceClient)||void 0===z?void 0:z.leadSource)&&void 0!==Q?Q:null),me&&!me.isMatch&&(me.number=ge)),te&&(null==me?void 0:me.number)){const e=id(me.number,this.orgSlug,this.buildingSlug);e>0&&ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const be=localStorage.getItem("eliseai_phone_number_devtest");be&&id(be,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=me||{number:ge,isMatch:!1,isPropertyWebsiteCatchall:!0};const ye=null!==(V=null===(W=this.LeadSourceClient)||void 0===W?void 0:W.leadSource)&&void 0!==V?V:null;ye&&(this.leadSources.includes(ye)||this.leadSources.push(ye)),this.isOrgMode()||io(Z.id);if((oe||(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isAip))&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.isLiveOnApplications)&&this.buildingSlug&&!this.orgLevel){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(\?.*)?$/,/\/content\/apply/,/\/apply-now/,/\/apply/,/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=Dc(o,e);l.setAttribute("href",s),a++,Jo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Jo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:Zo.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}if(this.buildingSlug&&this.orgSlug&&!this.orgLevel)try{(e=>{const t=Lc[e];if(!t)return 0;const n=`${Rc}/building/${t}/units`,i=`${Rc}/building/${e}/units`,r=new RegExp(`https://applications\\.eliseai\\.com/building/${t}/units`,"g");let o=0;const a=document.body.getElementsByTagName("a");for(let e=0;e<a.length;e++){const t=a[e],s=t.getAttribute("href");if(!s||!s.includes(n))continue;const l=s.replace(r,i);l!==s&&(t.setAttribute("href",l),o++)}document.body.querySelectorAll("[onclick]").forEach(e=>{const t=e.getAttribute("onclick");if(!t||!t.includes(n))return;const a=t.replace(r,i);a!==t&&(e.setAttribute("onclick",a),o++)})})(this.buildingSlug)}catch{}this.buildingSlug&&!this.orgLevel&&(null===(K=this.buildingWebchatView)||void 0===K?void 0:K.isLiveOnApplications)&&(null===(X=this.buildingWebchatView)||void 0===X?void 0:X.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Fc(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a,s,l,u;if(!this.buildingWebchatView)return;const d=this.chatStorageSlug(),c=Hu(d),h=Gu(d,c),p=h?c:Fu(d,!1);if(!p.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new ra,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new Hc(this.orgSlug,this.buildingSlug),this.myPubnub=new ed(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,p.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),this.myPubnub.chatStorageSlug=d,this.centralConvo){const e=this.myPubnub;e.centralConvo=!0,void 0!==this.hostDeclaredBuildingId?e.declaredBuildingId=this.hostDeclaredBuildingId:this.fetchDeclaredBuildingId().then(t=>{void 0===this.hostDeclaredBuildingId&&(e.declaredBuildingId=t)})}else this.myPubnub.declaredBuildingId=this.buildingWebchatView.id;const f=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,h&&null!==(n=p.leadId)&&void 0!==n?n:void 0);f&&(Fu(d,p.initiatedChat,f.lead_id),this.isOrgMode()&&f.building_slug&&await this.adoptBuilding(f.building_slug)),this.LeadSourceClient.chatId=this.myPubnub.channel;const g=await(null===(i=this.LeadSourceClient)||void 0===i?void 0:i.generateUserLeadSource({leadId:null!==(o=null===(r=this.myPubnub)||void 0===r?void 0:r.leadUserId)&&void 0!==o?o:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));g&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(g),"property-website"!==ia(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:ia(this.orgSlug):this.myPubnub.leadSource=null!==(u=null===(l=this.LeadSourceClient)||void 0===l?void 0:l.leadSource)&&void 0!==u?u:null;const m=Hu(d);m.initiatedChat&&await this.myPubnub.initializePubnub(m)},this.isOrgMode=()=>this.centralConvo&&!this.buildingSlug,this.chatStorageSlug=()=>this.orgLevel?"":this.buildingSlug,this.adoptBuilding=async e=>{var t;try{const n=await da(this.orgSlug,e);if(!(null==n?void 0:n.id))return;this.buildingSlug=e,this.buildingWebchatView=n,null===(t=this.myPubnub)||void 0===t||t.adoptBuilding(e,n)}catch(e){}},this.withOrgLevelContactOptions=(e,t)=>this.orgLevel?{...e,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,callDesktop:e.callDesktop&&!!t,callMobile:e.callMobile&&!!t}:e,this.fetchDeclaredBuildingId=async()=>{if(!this.declaredBuildingSlug||!this.orgSlug)return null;try{const e=await da(this.orgSlug,this.declaredBuildingSlug);return"number"==typeof(null==e?void 0:e.id)&&e.id>0?e.id:null}catch{return null}},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Gr(Wr(t)));return!!e&&!!n&&!Tr()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",Rr(function(e,t){return ii(2,arguments),wi(e,6e4*vi(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,l;if("Tab"!==e.key)return;const u=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot;let d=[];if(this.displayPubnubChat){const e=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"),t=null===(a=this.shadowRoot)||void 0===a?void 0:a.getElementById("chatAdditionalActionsPubnub");e&&d.push(...this.collectFocusableElements(e)),t&&d.push(...this.collectFocusableElements(t))}else{const e=null!==(l=null!==(s=null==u?void 0:u.getElementById("email-us-window"))&&void 0!==s?s:null==u?void 0:u.getElementById("tour-scheduler-window"))&&void 0!==l?l:null==u?void 0:u.getElementById("call-us-window");e&&(d=this.collectFocusableElements(e))}if(0===d.length)return;e.preventDefault();const c=this.getDeepActiveElement(),h=d.findIndex(e=>e===c);d[e.shiftKey?(h-1+d.length)%d.length:(h+1)%d.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")}}setDeclaredBuildingId(e){this.hostDeclaredBuildingId=e,this.myPubnub&&(this.myPubnub.declaredBuildingId=e)}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new Ko(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(),ju(this.chatStorageSlug()),this.orgLevel&&(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=_r(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(Gc.FOCUSABLE_SELECTOR)&&Gc.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){Jo({logType:Zo.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,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,A,k,E,T,_,O,P,I,N,M,D,L,R,B,j,F,H,G,z,Q,W,V;lu();const q=this.hideLauncher&&!this.isLoading&&!this._isMobile;return U`
7651
7646
  <meta name="viewport" content="width=device-width, initial-scale=1">
7652
7647
  ${this.displayPubnubChat?U`
7653
7648
  <pubnub-chat
@@ -7657,7 +7652,7 @@ xmlns="http://www.w3.org/2000/svg"
7657
7652
  .orgSlug=${this.orgSlug}
7658
7653
  .buildingSlug=${this.buildingSlug}
7659
7654
  .centralConvo=${this.centralConvo}
7660
- .widgetType=${ah.Default}
7655
+ .widgetType=${sh.Default}
7661
7656
  .building=${this.buildingWebchatView}
7662
7657
  .primaryColor=${this.primaryColor}
7663
7658
  .backgroundColor=${this.backgroundColor}
@@ -7899,12 +7894,12 @@ xmlns="http://www.w3.org/2000/svg"
7899
7894
  />
7900
7895
  </svg>
7901
7896
  </button>
7902
- </div>`}};Xc.styles=[Yc],Kc([ue({type:Number})],Xc.prototype,"right",void 0),Kc([ue({type:Number})],Xc.prototype,"bottom",void 0),Kc([ue({type:Number})],Xc.prototype,"top",void 0),Kc([ue({type:Number})],Xc.prototype,"left",void 0),Kc([ue({attribute:!0})],Xc.prototype,"isChatOpen",void 0),Kc([ue({attribute:!0})],Xc.prototype,"onClickCloseChat",void 0),Kc([ue({attribute:!0})],Xc.prototype,"onClickOpenChat",void 0),Xc=Kc([se("simple-launcher")],Xc);var Zc=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 Jc=class extends oe{constructor(){super(...arguments),this.healthcareId="",this.right=0,this.bottom=0,this.top=0,this.left=0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=Hu(this.healthcareId),t=Gu(this.healthcareId,e)?e:Fu(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new ed(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,ah.Healthcare),t.initiatedChat&&await this.myPubnub.initializePubnub(e),Tr()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ju(this.healthcareId),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return lu(),this.isLoading?U``:U`
7897
+ </div>`}};Xc.styles=[Yc],Kc([ue({type:Number})],Xc.prototype,"right",void 0),Kc([ue({type:Number})],Xc.prototype,"bottom",void 0),Kc([ue({type:Number})],Xc.prototype,"top",void 0),Kc([ue({type:Number})],Xc.prototype,"left",void 0),Kc([ue({attribute:!0})],Xc.prototype,"isChatOpen",void 0),Kc([ue({attribute:!0})],Xc.prototype,"onClickCloseChat",void 0),Kc([ue({attribute:!0})],Xc.prototype,"onClickOpenChat",void 0),Xc=Kc([se("simple-launcher")],Xc);var Zc=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 Jc=class extends oe{constructor(){super(...arguments),this.healthcareId="",this.right=0,this.bottom=0,this.top=0,this.left=0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=Hu(this.healthcareId),t=Gu(this.healthcareId,e)?e:Fu(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new ed(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,sh.Healthcare),t.initiatedChat&&await this.myPubnub.initializePubnub(e),Tr()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ju(this.healthcareId),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return lu(),this.isLoading?U``:U`
7903
7898
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
7904
7899
  ${this.displayPubnubChat?U`
7905
7900
  <pubnub-chat
7906
7901
  id="pubnub-chat"
7907
- .widgetType=${ah.Healthcare}
7902
+ .widgetType=${sh.Healthcare}
7908
7903
  .channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
7909
7904
  .myPubnub=${this.myPubnub}
7910
7905
  .buildingSlug=${this.healthcareId}
@@ -7983,13 +7978,13 @@ xmlns="http://www.w3.org/2000/svg"
7983
7978
  line-height: 150%;
7984
7979
  font-size: 16px;
7985
7980
  }
7986
- `,Zc([ue({type:String})],Jc.prototype,"healthcareId",void 0),Zc([ue({type:Number})],Jc.prototype,"right",void 0),Zc([ue({type:Number})],Jc.prototype,"bottom",void 0),Zc([ue({type:Number})],Jc.prototype,"top",void 0),Zc([ue({type:Number})],Jc.prototype,"left",void 0),Zc([de()],Jc.prototype,"launcher",void 0),Zc([de()],Jc.prototype,"currentLeadSource",void 0),Zc([de()],Jc.prototype,"displayPubnubChat",void 0),Zc([de()],Jc.prototype,"myPubnub",void 0),Zc([de()],Jc.prototype,"requiresConsent",void 0),Zc([de()],Jc.prototype,"privacyPolicyUrl",void 0),Zc([de()],Jc.prototype,"isLoading",void 0),Jc=Zc([se("health-chat")],Jc);var eh=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 th=class extends oe{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{(await async function(e){if(!e)return!1;const t="e2e-test-yardi-building";try{return(await r().get(po(t),{params:{building_slug:t,flag_type:"bool",feature_flag:"enable-show-utilities-webchat",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(this.orgSlug)||location.href.includes("demo/utilities"))&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=Hu(this.orgSlug),t=Gu(this.orgSlug,e)?e:Fu(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new ed(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,ah.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),Tr()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ju(this.orgSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return lu(),this.isLoading?U``:U`
7981
+ `,Zc([ue({type:String})],Jc.prototype,"healthcareId",void 0),Zc([ue({type:Number})],Jc.prototype,"right",void 0),Zc([ue({type:Number})],Jc.prototype,"bottom",void 0),Zc([ue({type:Number})],Jc.prototype,"top",void 0),Zc([ue({type:Number})],Jc.prototype,"left",void 0),Zc([de()],Jc.prototype,"launcher",void 0),Zc([de()],Jc.prototype,"currentLeadSource",void 0),Zc([de()],Jc.prototype,"displayPubnubChat",void 0),Zc([de()],Jc.prototype,"myPubnub",void 0),Zc([de()],Jc.prototype,"requiresConsent",void 0),Zc([de()],Jc.prototype,"privacyPolicyUrl",void 0),Zc([de()],Jc.prototype,"isLoading",void 0),Jc=Zc([se("health-chat")],Jc);var eh=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 th=class extends oe{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{(await async function(e){if(!e)return!1;const t="e2e-test-yardi-building";try{return(await r().get(po(t),{params:{building_slug:t,flag_type:"bool",feature_flag:"enable-show-utilities-webchat",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(this.orgSlug)||location.href.includes("demo/utilities"))&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=Hu(this.orgSlug),t=Gu(this.orgSlug,e)?e:Fu(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new ed(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,sh.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),Tr()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ju(this.orgSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return lu(),this.isLoading?U``:U`
7987
7982
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
7988
7983
  ${this.displayPubnubChat?U`
7989
7984
  <pubnub-chat
7990
7985
  id="pubnub-chat"
7991
7986
  .channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
7992
- .widgetType=${ah.Utilities}
7987
+ .widgetType=${sh.Utilities}
7993
7988
  .myPubnub=${this.myPubnub}
7994
7989
  .buildingSlug=${this.orgSlug}
7995
7990
  .onClickExit=${()=>{this.displayPubnubChat=!1}}
@@ -8066,4 +8061,4 @@ xmlns="http://www.w3.org/2000/svg"
8066
8061
  line-height: 150%;
8067
8062
  font-size: 16px;
8068
8063
  }
8069
- `,eh([ue({type:String})],th.prototype,"orgSlug",void 0),eh([ue({type:Number})],th.prototype,"right",void 0),eh([ue({type:Number})],th.prototype,"bottom",void 0),eh([ue({type:Number})],th.prototype,"top",void 0),eh([ue({type:Number})],th.prototype,"left",void 0),eh([de()],th.prototype,"launcher",void 0),eh([de()],th.prototype,"currentLeadSource",void 0),eh([de()],th.prototype,"displayPubnubChat",void 0),eh([de()],th.prototype,"myPubnub",void 0),eh([de()],th.prototype,"requiresConsent",void 0),eh([de()],th.prototype,"privacyPolicyUrl",void 0),eh([de()],th.prototype,"isLoading",void 0),th=eh([se("utilities-chat")],th);const nh=async e=>{const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&Jo({logType:i&&i.data?Zo.info:Zo.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),i.data},ih=async(e,t=5e3)=>new Promise((n,i)=>{const r=new MutationObserver((t,i)=>{const r=document.getElementById(e);r&&(i.disconnect(),n(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),i(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),n(a))});class rh{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),sh();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","region"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),rh.healthChat=a}static start(e,t=!0){var n,i,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;if(t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||"",this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.right,bottom:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.bottom,top:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.top,left:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.left}),sh(),e.studio&&!e.building)return void this.handleStudioContext(e);let d=null;switch(e.widgetType){case ah.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case ah.Default:d=document.createElement("me-chat");break;case ah.Utilities:d=document.createElement("utilities-chat");break;default:d=document.createElement("me-chat")}if(!d)throw new Error("Invalid widget type");d.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),d.setAttribute("widgetType",e.widgetType||ah.Default),d.setAttribute("class","meetelise-chat"),d.setAttribute("role","region"),d.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,d.setAttribute("primaryColor",((e,t)=>{const n=Kn(e),i=0,r=0,o=0,a={r:n.r+Math.round((i-n.r)*t),g:n.g+Math.round((r-n.g)*t),b:n.b+Math.round((o-n.b)*t)};return Xn(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),d instanceof Qc&&(e.centralConvo?(d.setAttribute("centralConvo","true"),e.building&&d.setAttribute("declaredBuildingSlug",e.building)):this.handleBuildingslug(d,e.organization,e.building,e),e.launcherStyles&&(d.launcherStyles=e.launcherStyles),e.mobileStyles&&(d.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(d.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await ih("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),d.overrideRentgrata=!0),e.onSstClose&&(d.onSstClose=e.onSstClose)),e.position&&(d.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),d.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),d.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),d.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(d),d instanceof Qc&&(rh.meChat=d),d instanceof th&&(rh.utilitiesChat=d)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.studioUpdateToken+=1,await this.removeWidget(),this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.activeStudioOptions=null}static async removeWidget(){var e;if(!this.meChat)return;const t=this.meChat;await t.remove(),null===(e=t.parentNode)||void 0===e||e.removeChild(t),rh.meChat=null}static handleStudioContext(e){e.studio&&(this.activeStudioOptions=e)}static updateStudioContext(e){const t=this.activeStudioOptions;if(!(null==t?void 0:t.studio))return;const n=++this.studioUpdateToken;if(e.siteId&&e.siteId!==t.studio.siteId)return void Jo({logType:Zo.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:t.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});const i=oh(e.organization),r=oh(e.building);if(!i||!r)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const o=function(e,t){if(!(null==e?void 0:e.key))return`building:${t}`;return e.key}(e.sessionScope,r),a=function(e){return"Pacific Urban Residential"===e?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e}(i);this.activeStudioOrgSlug===a&&this.activeStudioBuildingSlug===r&&this.activeStudioSessionScopeKey===o||this.removeWidget().then(()=>{n===this.studioUpdateToken&&(this.activeStudioOrgSlug=a,this.activeStudioBuildingSlug=r,this.activeStudioSessionScopeKey=o,this.orgSlug=a,this.start({...t,organization:i,building:r},!1))})}static clearStudioContext(e){this.studioUpdateToken+=1,this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.removeWidget()}static async handleBuildingslug(e,t,n,i){if(n)return void e.setAttribute("buildingSlug",n);if(this.mutationObserver)return;if(!t)return;const r=await nh(t);if(r){const e={...i,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,nh(t).then(e=>{if(!e)return;const n={...i,organization:t,building:e};this.start(n,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,n=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&Jo({logType:n&&n.data?Zo.info:Zo.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),!n||!n.data)return;const i={organization:this.orgSlug,building:n.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(i,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&Jo({logType:i&&i.data===e?Zo.info:Zo.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i&&i.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:i&&i.data===e?null:i&&!i.data?"No match found":i&&i.data!==e?"Mismatch":"No match found"}}),i&&i.data}}function oh(e){return"string"!=typeof e?"":e.trim()}var ah;rh.meChat=null,rh.healthChat=null,rh.utilitiesChat=null,rh.orgSlug="",rh.mutationObserver=null,rh.previousUrl="",rh.hasBuildingSlug=null,rh.brandColor="",rh.backgroundColor="",rh.healthcareId="",rh.activeStudioOrgSlug="",rh.activeStudioBuildingSlug="",rh.activeStudioSessionScopeKey="",rh.activeStudioOptions=null,rh.studioUpdateToken=0,rh.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(ah||(ah={}));const sh=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{ah as WidgetType,rh as default};
8064
+ `,eh([ue({type:String})],th.prototype,"orgSlug",void 0),eh([ue({type:Number})],th.prototype,"right",void 0),eh([ue({type:Number})],th.prototype,"bottom",void 0),eh([ue({type:Number})],th.prototype,"top",void 0),eh([ue({type:Number})],th.prototype,"left",void 0),eh([de()],th.prototype,"launcher",void 0),eh([de()],th.prototype,"currentLeadSource",void 0),eh([de()],th.prototype,"displayPubnubChat",void 0),eh([de()],th.prototype,"myPubnub",void 0),eh([de()],th.prototype,"requiresConsent",void 0),eh([de()],th.prototype,"privacyPolicyUrl",void 0),eh([de()],th.prototype,"isLoading",void 0),th=eh([se("utilities-chat")],th);const nh=async e=>{const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&Jo({logType:i&&i.data?Zo.info:Zo.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),i.data},ih=async(e,t=5e3)=>new Promise((n,i)=>{const r=new MutationObserver((t,i)=>{const r=document.getElementById(e);r&&(i.disconnect(),n(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),i(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),n(a))});class rh{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),lh();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","region"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),rh.healthChat=a}static start(e,t=!0){var n,i,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;if(t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||"",this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.right,bottom:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.bottom,top:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.top,left:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.left}),lh(),e.studio&&!e.building)return void this.handleStudioContext(e);let d=null;switch(e.widgetType){case sh.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case sh.Default:d=document.createElement("me-chat");break;case sh.Utilities:d=document.createElement("utilities-chat");break;default:d=document.createElement("me-chat")}if(!d)throw new Error("Invalid widget type");d.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),d.setAttribute("widgetType",e.widgetType||sh.Default),d.setAttribute("class","meetelise-chat"),d.setAttribute("role","region"),d.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,d.setAttribute("primaryColor",((e,t)=>{const n=Kn(e),i=0,r=0,o=0,a={r:n.r+Math.round((i-n.r)*t),g:n.g+Math.round((r-n.g)*t),b:n.b+Math.round((o-n.b)*t)};return Xn(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),d instanceof Qc&&(e.centralConvo?(d.setAttribute("centralConvo","true"),e.building&&d.setAttribute("declaredBuildingSlug",e.building)):this.handleBuildingslug(d,e.organization,e.building,e),e.launcherStyles&&(d.launcherStyles=e.launcherStyles),e.mobileStyles&&(d.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(d.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await ih("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),d.overrideRentgrata=!0),e.onSstClose&&(d.onSstClose=e.onSstClose)),e.position&&(d.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),d.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),d.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),d.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(d),d instanceof Qc&&(rh.meChat=d),d instanceof th&&(rh.utilitiesChat=d)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.studioUpdateToken+=1,await this.removeWidget(),this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.activeStudioOptions=null}static async removeWidget(){var e;if(!this.meChat)return;const t=this.meChat;await t.remove(),null===(e=t.parentNode)||void 0===e||e.removeChild(t),rh.meChat=null}static handleStudioContext(e){e.studio&&(this.activeStudioOptions=e)}static updateStudioContext(e){var t;const n=this.activeStudioOptions;if(!(null==n?void 0:n.studio))return;const i=++this.studioUpdateToken;if(e.siteId&&e.siteId!==n.studio.siteId)return void Jo({logType:Zo.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:n.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});if("org"===(null===(t=e.sessionScope)||void 0===t?void 0:t.type))return void this.updateStudioOrgContext(e,n,i);const r=oh(e.organization),o=oh(e.building);if(!r||!o)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const a=function(e,t){if(!(null==e?void 0:e.key))return`building:${t}`;return e.key}(e.sessionScope,o),s=ah(r);this.activeStudioOrgSlug===s&&this.activeStudioBuildingSlug===o&&this.activeStudioSessionScopeKey===a||this.removeWidget().then(()=>{i===this.studioUpdateToken&&(this.activeStudioOrgSlug=s,this.activeStudioBuildingSlug=o,this.activeStudioSessionScopeKey=a,this.orgSlug=s,this.start({...n,organization:r,building:o},!1))})}static updateStudioOrgContext(e,t,n){var i;const r=oh(e.organization);if(!r)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const o=ah(r),a=(null===(i=e.sessionScope)||void 0===i?void 0:i.key)||`org:${r}`,s=function(e){const t="string"==typeof e?Number(e):e;return"number"==typeof t&&Number.isInteger(t)&&t>0?t:null}(e.declaredBuildingId);!this.meChat||this.activeStudioOrgSlug!==o||this.activeStudioBuildingSlug||this.activeStudioSessionScopeKey!==a?this.removeWidget().then(()=>{var e;n===this.studioUpdateToken&&(this.activeStudioOrgSlug=o,this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey=a,this.orgSlug=o,this.start({...t,studio:void 0,organization:r,building:void 0,centralConvo:!0},!1),null===(e=this.meChat)||void 0===e||e.setDeclaredBuildingId(s))}):this.meChat.setDeclaredBuildingId(s)}static clearStudioContext(e){this.studioUpdateToken+=1,this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.removeWidget()}static async handleBuildingslug(e,t,n,i){if(n)return void e.setAttribute("buildingSlug",n);if(this.mutationObserver)return;if(!t)return;const r=await nh(t);if(r){const e={...i,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,nh(t).then(e=>{if(!e)return;const n={...i,organization:t,building:e};this.start(n,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,n=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&Jo({logType:n&&n.data?Zo.info:Zo.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),!n||!n.data)return;const i={organization:this.orgSlug,building:n.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(i,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&Jo({logType:i&&i.data===e?Zo.info:Zo.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i&&i.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:i&&i.data===e?null:i&&!i.data?"No match found":i&&i.data!==e?"Mismatch":"No match found"}}),i&&i.data}}function oh(e){return"string"!=typeof e?"":e.trim()}function ah(e){return"Pacific Urban Residential"===e?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e}var sh;rh.meChat=null,rh.healthChat=null,rh.utilitiesChat=null,rh.orgSlug="",rh.mutationObserver=null,rh.previousUrl="",rh.hasBuildingSlug=null,rh.brandColor="",rh.backgroundColor="",rh.healthcareId="",rh.activeStudioOrgSlug="",rh.activeStudioBuildingSlug="",rh.activeStudioSessionScopeKey="",rh.activeStudioOptions=null,rh.studioUpdateToken=0,rh.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(sh||(sh={}));const lh=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{sh as WidgetType,rh as default};