(function(){try{window.PSM_CONFIG={"dealer":{"id":28866,"guid":"fe31c4cb7196471dbaa373fa44b8a079","name":"D & S Harley-Davidson","newInventoryUrl":"","preOwnedInventoryUrl":"","timeZone":"-07:00","enableAugurScript":true,"chat":{"enabled":false,"bubbleColor":"#11A4E8","textColor":"#FFF","enableFirstName":false,"enableLastName":false,"enableDepartments":false,"mobilePosition":0,"desktopPosition":0,"rightPos":"0","bottomPos":"0","customButtonText":"Text Us!"},"associations":[{"dealerId":"fe31c4cb7196471dbaa373fa44b8a079","keyDealershipId":28866,"name":"D & S Harley-Davidson","showOnReviewTool":true}],"departments":[{"id":2854,"name":"Sales","dealerId":28866},{"id":7940,"name":"Service","dealerId":28866},{"id":13026,"name":"Parts","dealerId":28866}],"welcomeBack":{"enabled":false,"buttonText":"MY RECENTLY VIEWED INVENTORY","defaultState":0},"reviewToolEnabled":true,"reviewCarousel":{"enabled":false,"slideInterval":0},"feedbackFormEnabled":false},"global":{"localHostUrl":"https://psm.blob.core.windows.net/static","scriptApiUrl":"https://scriptapi.customerconnections.io/api/PSM/OnboardEvent","onboardWebAppUrl":"https://scriptapi.customerconnections.io/api/","lvrmWebAppUrl":"https://lvrmwebapp.azurewebsites.net/","isReviewSite":false,"isDebug":false}};"use strict";(()=>{var Zt=Object.create;var ge=Object.defineProperty,Xt=Object.defineProperties,en=Object.getOwnPropertyDescriptor,tn=Object.getOwnPropertyDescriptors,nn=Object.getOwnPropertyNames,et=Object.getOwnPropertySymbols,on=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty,rn=Object.prototype.propertyIsEnumerable;var tt=(e,t,n)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))nt.call(t,n)&&tt(e,n,t[n]);if(et)for(var n of et(t))rn.call(t,n)&&tt(e,n,t[n]);return e},fe=(e,t)=>Xt(e,tn(t));var an=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,n)=>(typeof require!="undefined"?require:t)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var sn=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of nn(t))!nt.call(e,i)&&i!==n&&ge(e,i,{get:()=>t[i],enumerable:!(o=en(t,i))||o.enumerable});return e};var ln=(e,t,n)=>(n=e!=null?Zt(on(e)):{},sn(t||!e||!e.__esModule?ge(n,"default",{value:e,enumerable:!0}):n,e));var F=(e,t,n)=>new Promise((o,i)=>{var r=l=>{try{s(n.next(l))}catch(d){i(d)}},a=l=>{try{s(n.throw(l))}catch(d){i(d)}},s=l=>l.done?o(l.value):Promise.resolve(l.value).then(r,a);s((n=n.apply(e,t)).next())});function ot(e,t){document.fonts&&window.FontFace&&new window.FontFace("Bebas Neue","url("+e+"/css/BebasNeue-Regular.ttf)").load().then(function(a){document.fonts.add(a)}).catch(function(a){});let n=(t||"").toLowerCase(),o=window.__PSM_WRAPPER_DONE_GUIDS__=window.__PSM_WRAPPER_DONE_GUIDS__||{};if(n&&o[n])return!0;n&&(o[n]=!0);try{let r=document.currentScript;if(r&&!r.defer){let a=document.createElement("script");a.src=r.src,a.defer=!0;let s=function(){r.parentNode&&r.parentNode.removeChild(r),(document.head||document.documentElement).appendChild(a)};return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s):s(),!1}}catch(r){}let i=window.__PSM_LOADED_GUIDS__=window.__PSM_LOADED_GUIDS__||{};return n&&i[n]?(console.log("Firestorm Script already loaded for Dealer "+t),!1):(n&&(i[n]=!0),window.PSMScriptLoaded=!0,window.PSMScriptDealerId=t,!0)}function it(e,t){let n=window;n.psm_timer_data=n.psm_timer_data||{version:"1.1",createdAt:new Date().toISOString(),marks:[],durations:{},startTimes:{},meta:{dealerId:e,dealerGuid:t,fp:{token:"8SMYTmlRdqyGTGMYPwF5",endpointUsed:"https://metrics.psmmarketing.com",importMs:null,loadMs:null,getMs:null,requestTag:null,visitorId:null,errors:[]}}},n.psm_timer=n.psm_timer||function(){let o=n.psm_timer_data;function i(){return window.performance&&performance.now?performance.now():Date.now()}function r(d){o.startTimes[d]=i(),o.marks.push({label:d,type:"start",t:o.startTimes[d],at:new Date().toISOString()})}function a(d){let u=o.startTimes[d];if(typeof u=="number"){let p=i()-u;return o.durations[d]=(o.durations[d]||0)+p,delete o.startTimes[d],o.marks.push({label:d,type:"end",t:p,at:new Date().toISOString()}),p}return 0}function s(d,u){o.marks.push({label:d,type:"note",t:0,value:u,at:new Date().toISOString()})}function l(){let d=Object.keys(o.durations).sort().map(u=>({label:u,ms:Math.round(o.durations[u])}));console.groupCollapsed("%cPSM Timer","font-weight:bold"),d.length?console.table(d):console.log("No durations yet."),console.log("meta:",o.meta),console.log("marks:",o.marks),console.groupEnd()}return{start:r,end:a,note:s,print:l}}(),n.psmTimer=function(){return n.psm_timer_data}}function $(e){let t=document.cookie,n=t.indexOf(" "+e+"=");if(n==-1&&(n=t.indexOf(e+"=")),n==-1)t="";else{n=t.indexOf("=",n)+1;var o=t.indexOf(";",n);o==-1&&(o=t.length),t=unescape(t.substring(n,o))}return t===""?null:t}function rt(e,t,n){let o="";if(n){let i=new Date;i.setTime(i.getTime()+n*24*60*60*1e3),o="; expires="+i.toUTCString()}document.cookie=e+"="+(t||"")+o+"; path=/"}function N(e){let t=new XMLHttpRequest;t.open(e.method,e.url,!0),e.headers&&Object.keys(e.headers).forEach(n=>{t.setRequestHeader(n,e.headers[n])}),(!e.headers||!e.headers["Content-Type"])&&t.setRequestHeader("Content-Type","application/json;charset=UTF-8"),t.setRequestHeader("X-Referer",location.href),t.onload=()=>{if(t.status===200)try{let n=JSON.parse(t.responseText);e.onSuccess(n)}catch(n){try{let o=JSON.parse(JSON.parse(t.responseText));e.onSuccess(o)}catch(o){e.onSuccess(t.responseText)}}else e.onError&&e.onError(t.responseText)},t.onerror=()=>{e.onError&&e.onError("Network Error")},e.data?t.send(JSON.stringify(e.data)):t.send()}function R(e){if(document.createStyleSheet)document.createStyleSheet(e);else{let t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",e),document.head?document.head.appendChild(t):document.body.appendChild(t)}}function le(e){let t=document.createElement("textarea");return t.innerHTML=e,t.value}function _e(e){return e.replace(/[^0-9]/gi,"")}function dn(e){return e.substring(0,10)}function j(e){return dn(_e(e))}function Z(e){let t=()=>{e.value=j(e.value)};e.addEventListener("input",t),e.addEventListener("paste",()=>{window.setTimeout(t,0)}),e.addEventListener("blur",t),t()}function z(e){if(console.log("tealium_event: "+e),typeof window.utag_data=="object"){let t=O({},window.utag_data);Object.keys(t).forEach(function(n){(n.startsWith("cp.")||n.startsWith("ut."))&&delete t[n]}),e==="wr_google_click"&&(t.website_name="google",t.site_section="testimonials",t.site_sub_section="other"),t.tealium_event=e,window.utag&&window.utag.link&&window.utag.link(t)}}function he(e,t,n,o,i,r,a){console.log("tealium_event: "+e);let s={};if(typeof window.utag_data=="object"){let l=window.utag_data;["ga4_id","ga_ua_id","page_h1","page_title","page_title_count","piwik_id","site_company_city","site_company_name","site_company_state","site_company_zip_code","site_id","site_internal_id","site_platform","site_section","site_sub_section","site_phone_main","product_category","product_condition","product_custom_image_count","product_description_char_count","product_industry","product_make","product_model","product_msrp","product_on_sale","product_original_price","product_subcategory","product_type","product_videos_count","product_year","oem_brp_id","oem_polaris_id","oem_harley_id","oem_bmw_id"].forEach(u=>{l.hasOwnProperty(u)&&(s[u]=l[u])}),s.form_id="price_drop_alert",s.form_name="price drop alert",s.form_type="unit_alert",e==="ua_price_drop_alert_submit"&&a&&(s.form_submission_email=a.email,s.form_submission_first_name=a.firstName,s.form_submission_id=a.dealerGuid,s.form_submission_last_name=a.lastName,s.form_submission_phone_number=a.phone,s.form_submission_alert_type=a.alertType),s.product_id=t,s.product_image_url=r,s.product_name=o,s.product_price=i,s.product_uri=n,s.tealium_event=e,window.utag&&window.utag.link&&window.utag.link(s)}}function be(e,t){console.log("tealium_event: "+e);let n={};if(typeof window.utag_data=="object"){let o=window.utag_data;["ga4_id","ga_ua_id","page_h1","page_title","page_title_count","piwik_id","site_company_city","site_company_name","site_company_state","site_company_zip_code","site_id","site_internal_id","site_platform","site_section","site_sub_section","site_phone_main","oem_brp_id","oem_polaris_id","oem_harley_id","oem_bmw_id"].forEach(r=>{o.hasOwnProperty(r)&&(n[r]=o[r])}),n.form_id="inventory_updates",n.form_name="inventory updates",n.form_type="unit_alert",e==="ua_inventory_updates_submit"&&t&&(n.form_submission_email=t.email,n.form_submission_first_name=t.firstName,n.form_submission_id=t.dealerGuid,n.form_submission_last_name=t.lastName,n.form_submission_phone_number=t.phone,n.form_submission_alert_type=t.alertType,n.form_submission_category=t.category,n.form_submission_make=t.make,n.form_submission_condition=t.condition),n.tealium_event=e,window.utag&&window.utag.link&&window.utag.link(n)}}function D(e){let t=(e||"").trim();if(!t)return t;for(;t.endsWith("/");)t=t.slice(0,-1);return t.toLowerCase().endsWith("/api/psm/onboardevent")&&(t=t.slice(0,-21)),t.toLowerCase().endsWith("/api")&&(t=t.slice(0,-4)),t}function ve(e,t){var i,r,a;let n=t||window.PSM_CONFIG;if(!n||!n.global){console.warn("PSM_CONFIG not available for welcomeBackCheck");return}if(n.global.isReviewSite){console.log("Welcome Back VDP Disabled on Review Sites");return}let o=(i=n.dealer)==null?void 0:i.welcomeBack;if(console.log("[PSM WB] Config snapshot",{dealerGuid:(r=n.dealer)==null?void 0:r.guid,dealerId:(a=n.dealer)==null?void 0:a.id,enabled:o==null?void 0:o.enabled,defaultState:o==null?void 0:o.defaultState,location:o==null?void 0:o.location,desktopAdjustment:o==null?void 0:o.desktopAdjustment,mobileLocation:o==null?void 0:o.mobileLocation,mobileAdjustment:o==null?void 0:o.mobileAdjustment}),n.dealer.welcomeBack.enabled){let l=`${D(n.global.scriptApiUrl||n.global.localHostUrl.replace("localhost:55341","localhost:5184"))}/api/script/vdp-history?id=${encodeURIComponent(e)}&dealerId=${n.dealer.id}`;N({method:"GET",url:l,onSuccess:d=>{d.success?cn(d,n):console.log(d.message)},onError:d=>{console.log(d)}})}else console.log("PSM Dealer Welcome Back VDP Disabled")}function cn(e,t){var k;if(document.getElementById("div-PSMWelcomeBackStart"))return;let n=t||window.PSM_CONFIG;if(!n||!n.dealer||!n.global){console.warn("[PSM WB] Missing config during modal render");return}let o=n.dealer.welcomeBack,i=n.global.localHostUrl,r=document.createElement("div"),a="Welcome Back";e.firstName!==""?a+=" "+e.firstName:a="Recently Viewed Inventory";let s=o.buttonText,l="<table width='100%'>";for(let y=0;y<e.vehicles.length;y++){let M=e.vehicles[y],c=M.title.replace("|||",'"');l+=`<tr><td><img src='${M.image}' alt='${c}' /></td><td><span class='psm-wb-vehicle-title'>${c}</span><br /><span class='psm-wb-vehicle-link'><a class='psm-view-again-link' data-url='${M.url}'>View Again</a></span></td></tr>`}l+="</table>";let d=`
    <div id='div-PSMWelcomeBackStart' class='psm-welcome-back-start psm-welcome-back-button psm-anchor-bottom'>${s}</div>
    <div id='div-psm-welcome-back-bubble' class='psm-welcome-back-bubble border round'>
        <span id='psm-welcome-back-start-close' class='psm-welcome-back-start-close'>&times;</span>
        <div class='psm-welcome-back-text'>
            <p><span class='psm-welcome-back-header'>${a}!</span></p>
            <!-- Trigger/Open The Modal -->
            <p>
                <div id='btnPSMWelcomeBack' class='psm-welcome-back-button psm-welcome-back-button'>Recently Viewed Inventory</div>
            </p>
            <hr>
            <span class='psm-welcome-back-other-text'>or view</span>
            <div class='psm-welcome-back-other-options'>
                <div id='psm-welcome-back-other-text-new-1' class='psm-welcome-back-other-text-new psm-welcome-back-button'>All New Inventory</div>
                <div id='psm-welcome-back-other-text-po-1' class='psm-welcome-back-other-text-po psm-welcome-back-button'>All Pre-Owned Inventory</div>
            </div>
        </div>
    </div>
    <!-- The Modal -->
    <div id='modal-psm-welcome-back' class='psm-welcome-back'>
        <!-- Modal content -->
        <div class='psm-welcome-back-content'>
            <span id='btnPSMWelcomeBackClose' class='psm-welcome-back-close'>&times;</span>
            <div class='psm-welcome-back-header'>
                ${a}
            </div>
            <div class='psm-welcome-back-vehicles'>
                ${l}
            </div>
            <hr>
            <div class='psm-welcome-back-other-options'>
                <div id='psm-welcome-back-other-text-new' class='psm-welcome-back-other-text-new psm-welcome-back-button'>All New Inventory</div>
                <div id='psm-welcome-back-other-text-po' class='psm-welcome-back-other-text-po psm-welcome-back-button'>All Pre-Owned Inventory</div>
            </div>
        </div>
    </div>`;r.innerHTML=d,R(`${i}/css/psmwb.css?vs=4`),document.body.appendChild(r),r.querySelectorAll(".psm-view-again-link").forEach(y=>{y.addEventListener("click",M=>{let c=M.target.getAttribute("data-url");z("rvi_product_page_click"),c&&window.open(c,"_blank")})});let p=document.getElementById("div-PSMWelcomeBackStart"),g=document.getElementById("div-psm-welcome-back-bubble"),w=window.innerWidth;if(p)if(w>767){let y=o.desktopAdjustment||(o.location===2||o.location===3?"100":"30"),M=o.location||0;M===1?p.style.setProperty("right",`${o.desktopAdjustment||"30"}px`,"important"):M===0?p.style.setProperty("left",`${o.desktopAdjustment||"30"}px`,"important"):M===2?(p.style.transform="rotate(-90deg)",p.style.right="-100px",p.style.bottom=`${o.desktopAdjustment||"100"}px`,p.style.borderRadius="0px 0px 6px 6px"):(p.style.transform="rotate(90deg)",p.style.left="-100px",p.style.bottom=`${o.desktopAdjustment||"100"}px`,p.style.borderRadius="6px 6px 0px 0")}else o.mobileLocation===1?(p.style.transform="rotate(-90deg)",p.style.right="-98px",p.style.bottom=`${o.mobileAdjustment||"120"}px`,p.style.borderRadius="0px 0px 6px 6px"):(p.style.transform="rotate(90deg)",p.style.left="-98px",p.style.bottom=`${o.mobileAdjustment||"120"}px`,p.style.borderRadius="6px 6px 0px 0");if(p){let y=window.getComputedStyle(p);console.log("[PSM WB] Placement applied",{dealerGuid:(k=n.dealer)==null?void 0:k.guid,viewportWidth:w,location:o.location,mobileLocation:o.mobileLocation,right:y.right,left:y.left,bottom:y.bottom,transform:y.transform,display:y.display})}g&&(o.location===1?g.style.setProperty("right","30px","important"):g.style.setProperty("left","30px","important"));let f=!1;document.cookie.indexOf("PSMRVIWidgetScreenShown=1")>0&&(f=!0);let v=document.getElementById("div-PSMWelcomeBackStart"),_=document.getElementById("div-psm-welcome-back-bubble"),b=document.getElementById("modal-psm-welcome-back");if(f)b&&(b.style.display="none"),v&&(v.style.display="block");else{f=!0;let y=new Date;y.setDate(y.getDate()+1),document.cookie="PSMRVIWidgetScreenShown=1; path=/; Expires="+y.toString();let M=o.defaultState;M===0?v&&(v.style.display="block"):M===1?(v&&(v.style.display="none"),_&&(_.style.display="block")):(v&&(v.style.display="none"),b&&(b.style.display="block"),_&&(_.style.display="block"))}document.addEventListener("click",function(y){let M=y.target;if(M&&M.id==="modal-psm-welcome-back"){let c=document.getElementById("modal-psm-welcome-back");if(c){c.style.display==="block"&&(c.style.display="none");let S=document.getElementById("div-PSMWelcomeBackStart");S&&(S.style.display="block")}}});let m=document.getElementById("div-PSMWelcomeBackStart");m&&m.addEventListener("click",()=>{let y=document.getElementById("modal-psm-welcome-back");y&&(y.style.display="block"),m&&(m.style.display="none"),z("rvi_launcher_click")});let P=document.getElementById("psm-welcome-back-start-close");P&&P.addEventListener("click",()=>{let y=document.getElementById("div-psm-welcome-back-bubble");y&&(y.style.display="none"),m&&(m.style.display="block")});let h=document.getElementById("btnPSMWelcomeBack");h&&h.addEventListener("click",()=>{let y=document.getElementById("modal-psm-welcome-back");y&&(y.style.display="block"),z("rvi_launch_widget_recently_viewed_inventory_click")});let L=document.getElementById("btnPSMWelcomeBackClose");L&&L.addEventListener("click",()=>{let y=document.getElementById("modal-psm-welcome-back");y&&(y.style.display="none"),m&&(m.style.display="block")}),de("psm-welcome-back-other-text-new","rvi_primary_widget_new_inventory_click",n.dealer.newInventoryUrl),de("psm-welcome-back-other-text-new-1","rvi_launch_widget_new_inventory_click",n.dealer.newInventoryUrl),de("psm-welcome-back-other-text-po","rvi_primary_widget_preowned_inventory_click",n.dealer.preOwnedInventoryUrl),de("psm-welcome-back-other-text-po-1","rvi_launch_widget_preowned_inventory_click",n.dealer.preOwnedInventoryUrl)}function de(e,t,n){let o=document.getElementById(e);o&&o.addEventListener("click",()=>{z(t),window.location.href=n})}function at(){return F(this,null,function*(){var t;let e=yield import("https://metrics.psmmarketing.com/web/v3/8SMYTmlRdqyGTGMYPwF5");return(t=e.default)!=null?t:e})}var lt=8e3,dt=50;function Se(e,t){let n=(t||"").toLowerCase();return`${e}|${window.location.pathname}|${n}`}function ct(){let e=window;return e.__PSM_FPJS_CLIENT_PROMISE__||(e.__PSM_FPJS_CLIENT_PROMISE__=at().then(t=>t.load({endpoint:["https://metrics.psmmarketing.com",t.defaultEndpoint]})).catch(t=>{throw e.__PSM_FPJS_CLIENT_PROMISE__=null,t})),e.__PSM_FPJS_CLIENT_PROMISE__}function mn(e){let t=window;return t.__PSM_FP_ONBOARD_IDENTIFY_PROMISE__||(t.__PSM_FP_ONBOARD_IDENTIFY_PROMISE__=ct().then(n=>n.get({tag:e}))),t.__PSM_FP_ONBOARD_IDENTIFY_PROMISE__}function mt(e,t,n,o,i="",r){var d,u;if(!o)return;let a=pn(n),s=0,l=(d=$("firestorm_dev_id"))!=null?d:"";l!=null&&l!==""&&(s=1),s===0&&(l=(u=$("OnboardCook"+e))!=null?u:"",l!=null&&l!==""&&(s=1)),yn({timeout:lt,interval:dt},p=>!!(p&&(p.ga4_id||p.site_id||p.page_title))).then(p=>{let g=window;g.__PSM_ONBOARD_SENT__=g.__PSM_ONBOARD_SENT__||{};let w=ut(p);if(l&&l!==""){let f=Se(l,t);if(g.__PSM_ONBOARD_SENT__[f]){console.log("Onboard event already sent for device/page: "+f);return}console.log("prior onboarding-id: "+l),yt(l,e,t,a,w,i,r);return}un({dealerId:e,dealerGuid:t,onboardUrl:a,tealiumPayload:w,additionalDealerGuids:i,config:r})})}function un(e){var l,d,u,p;let t=window,n=$("firestorm_dev_id");if(n!=null&&n!==""){yt(n,e.dealerId,e.dealerGuid,e.onboardUrl,e.tealiumPayload,e.additionalDealerGuids,e.config);return}if(t.__PSM_ONBOARD_FP_QUEUE__=t.__PSM_ONBOARD_FP_QUEUE__||[],t.__PSM_ONBOARD_FP_QUEUE__.push(e),t.__PSM_ONBOARD_FP_COMPLETION__)return;t.__PSM_ONBOARD_IN_PROGRESS__=!0;let o=t.__PSM_ONBOARD_FP_QUEUE__[0],i=gn(o.dealerId,o.tealiumPayload,o.additionalDealerGuids),r=(u=(d=(l=t.psm_timer_data)==null?void 0:l.meta)==null?void 0:d.fp)!=null?u:null;function a(){return window.performance&&performance.now?performance.now():Date.now()}(p=t.psm_timer)!=null&&p.start&&t.psm_timer.start("fp_get");let s=a();t.__PSM_ONBOARD_FP_COMPLETION__=mn(i).then(g=>{var f;let w=a();return(f=t.psm_timer)!=null&&f.end&&t.psm_timer.end("fp_get"),r&&(r.getMs=w-s,r.requestTag=i,r.visitorId=g==null?void 0:g.visitorId),g}).then(g=>{let w=g==null?void 0:g.visitorId;if(!w){console.log("Onboard fingerprint returned no visitor id"),t.__PSM_ONBOARD_FP_QUEUE__=[];return}console.log("onboarding-id: "+w),rt("firestorm_dev_id",w,1);let f=()=>{var _,b;let v=(t.__PSM_ONBOARD_FP_QUEUE__||[]).splice(0);for(let m of v)(b=(_=m.config)==null?void 0:_.global)!=null&&b.isDebug&&console.log("[PSM] Onboard-event POST for dealer",m.dealerGuid,"keyDealershipId=",m.dealerId),fn(w,m.dealerId,m.dealerGuid,m.onboardUrl,m.tealiumPayload,m.additionalDealerGuids,m.config)};for(f();t.__PSM_ONBOARD_FP_QUEUE__&&t.__PSM_ONBOARD_FP_QUEUE__.length>0;)f()}).catch(g=>{let w=g instanceof Error?g.message:String(g);r&&(r.errors=r.errors||[],r.errors.push(w)),console.log(w),t.__PSM_FP_ONBOARD_IDENTIFY_PROMISE__=null,t.__PSM_ONBOARD_FP_QUEUE__=[]}).finally(()=>{t.__PSM_ONBOARD_FP_COMPLETION__=null,t.__PSM_ONBOARD_IN_PROGRESS__=!1})}function pn(e){let t=D(e);return t&&t+"/"}function we(){let e=window,t=e.utag_data&&typeof e.utag_data=="object"&&!Array.isArray(e.utag_data)?e.utag_data:{},n=e.utag&&e.utag.data&&typeof e.utag.data=="object"&&!Array.isArray(e.utag.data)?e.utag.data:{};return O(O({},t),n)}function B(e,t){if(!(!e||typeof e!="object"))for(let n of t){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let o=e[n];if(o!=null&&!(typeof o=="string"&&o.trim()===""))return o}}function st(e){if(!e||typeof e!="object")return!1;let t=e.tealium_event||e.tealiumevent,o=B(e,["product_id","productId","inventory_id","inventoryId","unit_id","unitId","vehicle_id","vehicleId","listing_id","listingId","stock_number","stockNumber","stock_num","sku","oem_harley_id","oem_polaris_id","oem_brp_id","oem_bmw_id"])!==void 0;return!!(t||o||e.product_name||e.productName||e.interestedin||e.product_make||e.productMake||e.product_model||e.productModel||e.product_uri||e.productUri||e.product_url)}function yn(e={},t){let{timeout:n=lt,interval:o=dt}=e,i=Date.now();return new Promise(r=>{(function a(){let s=we();if(typeof t=="function"?t(s):!!(s&&(s.ga4_id||s.site_id||s.site_internal_id||s.page_title)))return r(s);if(Date.now()-i>=n)return console.warn("Timeout waiting for Tealium readiness; proceeding with best available data."),r(s||null);setTimeout(a,o)})()})}function ut(e){let t=e&&typeof e=="object"?e:we(),n={tealiumevent:"",interestedin:"",product_id:"",product_brand:"",product_category:"",product_subcategory:"",product_condition:"",product_image_url:"",product_industry:"",product_year:0,product_make:"",product_model:"",product_name:"",product_original_price:0,product_price:0,product_type:"",product_uri:""},o=B(t,["tealium_event","tealiumevent","event_name"]);o!==void 0&&(n.tealiumevent=o);let i=B(t,["product_name","productName","inventory_title","title"]);i!==void 0&&(n.interestedin=i,n.product_name=i);let r=B(t,["product_id","productId","inventory_id","inventoryId","unit_id","unitId","vehicle_id","vehicleId","listing_id","listingId","stock_number","stockNumber","stock_num","sku","oem_harley_id","oem_polaris_id","oem_brp_id","oem_bmw_id"]);r!==void 0&&(n.product_id=r);let a=B(t,["product_brand","productBrand","brand"]);a!==void 0&&(n.product_brand=a);let s=B(t,["product_category","productCategory","category"]);s!==void 0&&(n.product_category=s);let l=B(t,["product_subcategory","productSubcategory","subcategory"]);l!==void 0&&(n.product_subcategory=l);let d=B(t,["product_condition","productCondition","condition"]);d!==void 0&&(n.product_condition=d);let u=B(t,["product_image_url","productImageUrl","product_image","image_url","primary_image_url"]);u!==void 0&&(n.product_image_url=u);let p=B(t,["product_industry","productIndustry","industry"]);p!==void 0&&(n.product_industry=p);let g=B(t,["product_year","productYear","year","vehicle_year"]);g!==void 0&&(n.product_year=g);let w=B(t,["product_make","productMake","make"]);w!==void 0&&(n.product_make=w);let f=B(t,["product_model","productModel","model"]);f!==void 0&&(n.product_model=f);let v=B(t,["product_original_price","productOriginalPrice","msrp","product_msrp"]);v!==void 0&&(n.product_original_price=v);let _=B(t,["product_price","productPrice","price","sale_price"]);_!==void 0&&(n.product_price=_);let b=B(t,["product_type","productType","type"]);b!==void 0&&(n.product_type=b);let m=B(t,["product_uri","productUri","product_url","productUrl","page_url"]);return m!==void 0&&(n.product_uri=m),n}function pt(e){let t=ut(we());return st(t)?t:st(e)?e:t}function gn(e,t,n=""){let o={dealerid:e,requestType:"onboard",tealium_data:JSON.stringify(t)};return n&&(o.additional_dealers=n),o}function X(e){return!e||typeof e!="object"?Promise.resolve(null):ct().then(t=>t.get({tag:e})).catch(t=>{let n=t instanceof Error?t.message:String(t);return console.log(n),null})}function yt(e,t,n,o,i,r,a){var v,_,b;let s=window,l=(b=(_=(v=s.psm_timer_data)==null?void 0:v.meta)==null?void 0:_.fp)!=null?b:null;function d(){return window.performance&&performance.now?performance.now():Date.now()}let u=Se(e,n);s.__PSM_ONBOARD_SENT__=s.__PSM_ONBOARD_SENT__||{},s.__PSM_ONBOARD_SENT__[u]=!0,s.__PSM_ONBOARD_IN_PROGRESS__=!1;let p=d();ve(e,a);let g={DealerId:t,DealerGuid:n,PageVisited:encodeURIComponent(window.location.href),DeviceId:e,TealiumDatas:pt(i),AdditionalDealerGuids:r||void 0};l&&(l.onboard_buildMs=d()-p,l.visitorId=e);let w=d(),f=D(o)+"/api/Script/onboard-event";N({method:"POST",url:f,data:g,headers:{"x-apiKey":"eb094e9e-3fa7-4402-b49e-08a04c1847eb","Content-Type":"application/json;charset=UTF-8"},onSuccess:m=>{let P=d();l&&(l.onboard_sendMs=P-w,l.onboard_status=200),m!=null&&m.success?console.log("Onboarded page for "+e):(console.log(m==null?void 0:m.html),l&&(l.onboard_error=(m==null?void 0:m.html)||"unknown inline error"))},onError:m=>{l&&(l.onboard_error=m),console.log(m)}})}function fn(e,t,n,o,i,r,a){var f,v,_;let s=window,l=(_=(v=(f=s.psm_timer_data)==null?void 0:f.meta)==null?void 0:v.fp)!=null?_:null;function d(){return window.performance&&performance.now?performance.now():Date.now()}let u=Se(e,n);if(s.__PSM_ONBOARD_SENT__||(s.__PSM_ONBOARD_SENT__={}),s.__PSM_ONBOARD_SENT__[u]){console.log("Onboard already sent for "+e);return}s.__PSM_ONBOARD_SENT__[u]=!0;let p=d();ve(e,a);let g={DealerId:t,DealerGuid:n,PageVisited:encodeURIComponent(window.location.href),DeviceId:e,TealiumDatas:pt(i),AdditionalDealerGuids:r||void 0};l&&(l.onboard_buildMs=d()-p,l.visitorId=e);let w=d();N({method:"POST",url:`${D(o)}/api/Script/onboard-event`,data:g,headers:{"x-apiKey":"eb094e9e-3fa7-4402-b49e-08a04c1847eb","Content-Type":"application/json;charset=UTF-8"},onSuccess:b=>{let m=d();l&&(l.onboard_sendMs=m-w,l.onboard_status=200),b!=null&&b.success?console.log("Onboarded page for "+e):(console.log(b==null?void 0:b.html),l&&(l.onboard_error=(b==null?void 0:b.html)||"unknown inline error"))},onError:b=>{l&&(l.onboard_error=b),console.log(b)}})}function gt(e,t,n,o,i){let r=[],a=!0;return(!e||e.trim().length===0)&&(r.push("First Name is required."),a=!1),(!t||t.trim().length===0)&&(r.push("Last Name is required."),a=!1),!o||o.trim().length===0?(r.push("Email is required."),a=!1):/^\S+@\S+\.\S+$/.test(o)||(r.push("Please enter a valid email address."),a=!1),i===""&&(r.push("To receive alerts, please select at least one preference: Email, Text, or both."),a=!1),i.includes("Text")&&(!n||n.trim().length===0?(r.push("Phone Number is required."),a=!1):/^\d+$/.test(n.trim())?n.trim().charAt(0)==="1"&&(r.push("Phone Number cannot start with 1."),a=!1):(r.push("Phone Number must contain only numbers."),a=!1)),{isValid:a,errors:r}}function ft(e,t,n,o,i,r,a){let s=[],l=!0;return(!e||e.trim().length===0)&&(s.push("First Name is required."),l=!1),(!t||t.trim().length===0)&&(s.push("Last Name is required."),l=!1),a!=="Email"&&(!n||n.trim().length<10?(s.push("Phone Number is required."),l=!1):/^\d+$/.test(n.trim())||(s.push("Phone Number must contain only numbers."),l=!1)),n&&n.substring(0,1)==="1"&&(s.push("Invalid Phone Number. Cannot start with 1"),l=!1),!o||o.trim().length===0?(s.push("Email is required."),l=!1):/^\S+@\S+\.\S+$/.test(o)||(s.push("Please enter a valid email address."),l=!1),r==="-1"&&i==="-1"&&(s.push("Make or Category is required."),l=!1),{isValid:l,errors:s}}function _t(e,t,n,o,i,r){let a=[],s=!0;return i&&(!e||e.trim().length===0)&&(a.push("First Name is required."),s=!1),r&&(!t||t.trim().length===0)&&(a.push("Last Name is required."),s=!1),!n||n.trim().length<10?(a.push("Phone Number is required."),s=!1):/^\d+$/.test(n.trim())?n.substring(0,1)==="1"&&(a.push("Invalid Phone Number. Cannot start with 1"),s=!1):(a.push("Phone Number must contain only numbers."),s=!1),(!o||o.trim().length===0)&&(a.push("Message is required."),s=!1),{isValid:s,errors:a}}function ht(e){if(!e.dealer.chat.enabled)return;let t=e.dealer.chat,n=e.dealer.guid,o=e.global.localHostUrl,i=t.desktopPosition===0||t.desktopPosition===2||t.desktopPosition===3?"desktop-cc-chat-left":"desktop-cc-chat-right",a=t.desktopPosition===2||t.desktopPosition===3?"desktop-cc-chat-top":"desktop-cc-chat-bottom",s=t.mobilePosition===1?"mobile-cc-chat-right":"mobile-cc-chat-left",l=new Date().getTime();R(`${o}/css/PSM-CC-Chat.css?vs=4?${l}`);let d=_n(e),u=hn(e),p=bn(e),g=t.customButtonText,w=`
    <div id="cc-chat-module" class="${i} ${s} ${a}" style="display: block; position:fixed; z-index:15712491247;">
        <div id="cc-chat-box" style="display: none;" class="cc-chat-box stepZero">
            <div class="cmds"> <a class="cmd-close">x close</a> </div>
            ${d}
            <div class="dept-list">
                <div class="dept-list-title">${g}</div>
                ${u}
            </div>
            ${p}
            <div id="cc-success-message" class="cc-success-message">Sending....</div>
        </div>
    </div>
    <div id="cc-chat-button-main" class="cc-chat-button-main active ${i} ${s}" style="z-index:15712491247; background: ${t.bubbleColor}; color: ${t.textColor};">${g}</div>
    `,f=document.createElement("div");f.innerHTML=w,document.body.appendChild(f);let v=document.getElementById("cc-chat-module"),_=document.querySelector(".cc-chat-box"),b=document.getElementById("cc-chat-button-main"),m=document.getElementById("cmdSubmit");m&&(m.style.cssText=`background: ${t.bubbleColor}; color: ${t.textColor};`,m.onclick=()=>Sn(e));let P=document.getElementById("PSM-CC-Phone");P&&Z(P);let h=()=>_.style.display==="block",L=I=>{_.style.setProperty("display",I?"block":"none",I?"":"important"),I?_.classList.add("active"):_.classList.remove("active"),b&&b.style.setProperty("display",I?"none":"block","important")},k=()=>{L(!h()),vn()},y=()=>{_.classList.add("stepZero"),_.classList.remove("stepOne","stepTwo","stepThree")},M=()=>{_.classList.remove("stepZero"),_.classList.add("stepOne");let I=document.getElementById("PSM-CC-DealerId").value,x=document.getElementById(`ul-departments-${I}`);x&&(x.style.display="block"),_.classList.remove("stepTwo","stepThree")},c=()=>{_.classList.remove("stepZero","stepOne"),_.classList.add("stepTwo"),_.classList.remove("stepThree")},S=document.querySelector(".cc-chat-button-main");S&&(S.onclick=()=>{let I=h();k(),I||(e.dealer.associations.length>1?y():e.dealer.chat.enableDepartments?(document.getElementById("PSM-CC-DealerId").value=e.dealer.guid,M()):(document.getElementById("PSM-CC-DealerId").value=e.dealer.guid,c()))});let E=document.querySelector(".cmd-close");E&&(E.onclick=k),e.dealer.associations.length>1&&document.querySelectorAll(".loc-list li").forEach(x=>{x.style.cssText=`background: ${t.bubbleColor}; color: ${t.textColor}; `,x.addEventListener("click",function(){let C=this.getAttribute("data-dealer-id"),A=document.getElementById("PSM-CC-DealerId");C&&(A.value=C),e.dealer.chat.enableDepartments?M():c()})}),e.dealer.chat.enableDepartments&&document.querySelectorAll(".dept-list li").forEach(x=>{x.style.cssText=`background: ${t.bubbleColor}; color: ${t.textColor}; `,x.addEventListener("click",function(){let C=this.getAttribute("data-department-id"),A=document.getElementById("PSM-CC-DepartmentId");C&&(A.value=C),c()})})}function _n(e){if(e.dealer.associations.length<=1)return"";let t='<div class="loc-list"><div class="loc-list-title">Choose Location</div><ol>';return e.dealer.associations.forEach(n=>{t+=`<li data-dealer-id="${n.dealerId}">${bt(n.name)}</li>`}),t+="</ol></div>",t}function hn(e){let t="";return e.dealer.associations.forEach(n=>{t+=`<ol class="psm-ul-list" id="ul-departments-${n.dealerId}" style="display: none;">`,e.dealer.chat.enableDepartments&&e.dealer.departments.filter(o=>o.dealerId===n.keyDealershipId).forEach(o=>{t+=`<li data-department-id="${o.id}">${bt(o.name)}</li>`}),t+="</ol>"}),t}function bn(e){let t=e.dealer.chat,n=t.enableFirstName?'<label for="PSM-CC-FirstName">First Name<span class="required">*</span></label><br /> <input type="text" id="PSM-CC-FirstName" placeholder="First Name*" required="required" aria-label="First Name" auto-fill="new-password"/><br />':'<input type="text" id="PSM-CC-FirstName" placeholder="First Name*" style="display: none;" />',o=t.enableLastName?'<label for="PSM-CC-LastName">Last Name<span class="required">*</span></label><br /><input type="text" id="PSM-CC-LastName" placeholder="Last Name*" required="required" aria-label="Last Name" auto-fill="new-password"/><br />':'<input type="text" id="PSM-CC-LastName" placeholder="Last Name*" style="display: none;" />';return`<div class="cc-contact-form">
        <label for="PSM-CC-FirstName" hidden="hidden">First Name<span class="required">*</span></label> 
        <input type="text" id="PSM-CC-DealerId" hidden="hidden" required="required" value="${e.dealer.guid}"/>
        <label for="PSM-CC-FirstName">First Name<span class="required">*</span></label> 
        <input type="text" id="PSM-CC-DepartmentId" hidden="hidden" required="required"/>
        ${n}
        ${o}
        <label for="PSM-CC-Phone">Phone Number<span class="required">*</span></label><br />
        <input type="text" id="PSM-CC-Phone" placeholder="Phone*" maxlength="10" required="required" aria-label="Phone Number" auto-fill="new-password"/><br />
        <label for="PSM-CC-Message">Message<span class="required">*</span></label><br />
        <textarea type="text" id="PSM-CC-Message" placeholder="Message*" required="required" aria-label="Message"></textarea>
        <button id="cmdSubmit" class="btnSubmit">Send Message</button>
        <p class="legalize"><i>I agree to receive text messages at the number provided. Message and data rates apply.</i></p>
        <div id="cc-validation" class="cc-validation" style="font-weight:bold; color:red; margin-top:15px;"></div>
        <div class="callout-link">Fueled by <a href="https://www.customerconnections.io" target="_blank"><img src="//cc.localwebdominator.com/Content/CC-logo.jpg" title="Customer Connections" alt="Customer Connections" class="lazyload" loading=lazy></a></div>
    </div>`}function bt(e){let t=document.createElement("div");return t.innerText=e,t.innerHTML}function vn(){var n,o,i,r;let e=document.querySelector(".cc-chat-box");e.classList.add("stepZero"),e.classList.remove("stepOne","stepTwo","stepThree");let t=document.getElementsByClassName("psm-ul-list");for(let a=0;a<t.length;a++)t[a].style.display="none";document.getElementById("PSM-CC-DepartmentId").value="",document.getElementById("PSM-CC-FirstName").value="",document.getElementById("PSM-CC-LastName").value="",document.getElementById("PSM-CC-Phone").value="",document.getElementById("PSM-CC-Message").value="",(n=document.getElementById("PSM-CC-FirstName"))==null||n.classList.remove("error"),(o=document.getElementById("PSM-CC-LastName"))==null||o.classList.remove("error"),(i=document.getElementById("PSM-CC-Phone"))==null||i.classList.remove("error"),(r=document.getElementById("PSM-CC-Message"))==null||r.classList.remove("error")}function Sn(e){let t=document.getElementById("PSM-CC-DealerId").value,n=document.getElementById("PSM-CC-DepartmentId").value,o=document.getElementById("PSM-CC-FirstName").value,i=document.getElementById("PSM-CC-LastName").value,r=j(document.getElementById("PSM-CC-Phone").value);document.getElementById("PSM-CC-Phone").value=r;let a=document.getElementById("PSM-CC-Message").value,s=_t(o,i,r,a,e.dealer.chat.enableFirstName,e.dealer.chat.enableLastName),l=document.getElementById("cc-validation");if(l&&(l.innerHTML=s.errors.join("<br/>")),s.isValid){N({method:"POST",url:"https://api.customerconnections.io/api/PSM/AddMessage/",data:{DealerGuid:t,DepartmentId:n,FirstName:o,LastName:i,PhoneNumber:r,Message:a,ReturnJson:"true"},onSuccess:u=>{var g;let p=document.getElementById("cc-success-message");p&&(p.innerHTML=u.Message,p.style.cssText="display: block;"),X({custid:(g=u==null?void 0:u.CustomerId)!=null?g:u==null?void 0:u.customerId,requestType:"Customer Connections"})}});let d=document.querySelector(".cc-chat-box");d.classList.remove("stepZero","stepOne","stepTwo"),d.classList.add("stepThree")}}var vt='<span class="psm-pd-bell" aria-hidden="true" style="display:inline-flex;align-items:center;justify-content:center;width:1em;height:1em;flex-shrink:0;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="100%" height="100%"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg></span>';function St(e){return e==null?"":String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function wn(e){console.log("[PSM PriceDrop] ProcessPSMCallbackInfo payload:",e);let t=window.ProcessPSMCallbackInfo;if(typeof t=="function")try{t(e)}catch(n){console.error("ProcessPSMCallbackInfo execution failed:",n)}else console.log("[PSM PriceDrop] ProcessPSMCallbackInfo is not defined.")}function Pn(e,t){var n,o,i,r;return{Message:(o=(n=t==null?void 0:t.Message)!=null?n:t==null?void 0:t.message)!=null?o:"",CustomerId:(r=(i=t==null?void 0:t.CustomerId)!=null?i:t==null?void 0:t.customerId)!=null?r:0,DealerGuid:e.DealerGuid,FirstName:e.FirstName,LastName:e.LastName,PhoneNumber:e.PhoneNumber,Email:e.Email,UnitId:e.UnitId,UnitName:e.UnitName,UnitURL:e.UnitURL,UnitImageURL:e.UnitImageURL,CurrentPrice:e.CurrentPrice,AlertType:e.AlertType,SubscriptionType:"Price Drop Alert"}}function Mt(e,t){try{window.dispatchEvent(new CustomEvent(e,{detail:t}))}catch(n){console.error(`[PSM PriceDrop] Failed to dispatch ${e}:`,n)}}var ee,te,ne,oe,ie,ce=0,Pe=!1;function It(e){if(!e.dealer.priceDrop||!e.dealer.priceDrop.enabled||e.global.isReviewSite)return;let t=e.dealer.priceDrop,n=e.global.localHostUrl;window.pdunits=Array.isArray(e.priceDropUnits)?e.priceDropUnits:[],Mn(e,t,n),Tn(e);let o=i=>{Array.isArray(i)&&(window.pdunits=i),G(e)};window.loadPDWidgets=o,window.loadPDWidget=o,window.rebindPriceDropWidgets=o}function Mn(e,t,n){let o=document.createElement("div");o.innerHTML=In(e),document.body.appendChild(o),R(`${n}/css/psmPriceDrop.css?v=13`),document.addEventListener("click",function(l){let d=l.target;if(d&&d.id==="modal-psm-pricedrop"){let u=document.getElementById("modal-psm-pricedrop");u&&u.style.display==="block"&&(u.style.display="none",ce===1&&Pt())}});let i=document.getElementById("btnPSMPriceDropClose");i&&i.addEventListener("click",()=>{let l=document.getElementById("modal-psm-pricedrop");l&&l.style.display==="block"&&(l.style.display="none",ce===1&&Pt())});let r=document.getElementById("PSM-PD-TextType"),a=document.getElementById("PSM-PD-Phone");r&&a&&r.addEventListener("change",()=>{r.checked?a.setAttribute("placeholder","Phone*"):a.setAttribute("placeholder","Phone")}),a&&Z(a);let s=document.getElementById("psm-PD-FormSubmit");s&&(s.style.background=t.buttonColor,s.style.color=t.textColor,s.style.padding="10px",s.style.borderRadius="10px",s.onclick=()=>Cn(e)),Mt("psm:pricedrop:ready",{dealerGuid:e.dealer.guid,modalId:"modal-psm-pricedrop",formId:"div-pricedrop-form",recaptchaHostId:"PSM-PD-RecaptchaHost"}),window.addEventListener("load",()=>G(e),!1),window.addEventListener("DOMContentLoaded",()=>G(e)),(document.readyState==="complete"||document.readyState==="interactive")&&G(e)}function In(e){return`
    <!-- The Price Drop Modal -->
    <div id='modal-psm-pricedrop' class='psm-pricedrop' style='display: none'>
        <!-- Price Drop Modal content -->
        <div class='psm-pricedrop-content'>
            <span id='btnPSMPriceDropClose' class='psm-pricedrop-close'>&times;</span>
            <div class='psm-pricedrop-header'>
                GET PRICE DROP ALERTS
            </div>
            <div class='psm-pricedrop-text' id='div-psm-pricedrop-text'>
                Provide your details to receive an email and/or text alert when the price drops on this unit.
            </div>
            <div id='divdiv-pricedrop-form' class='form-for-colorbox'>
            <div id='div-pricedrop-form' class='div-pricedrop-form'>
            <div class='PD-row'>
                <div class='PD-input-group'>
                    <input type='text' id='PSM-PD-FirstName' class='PD-form-input' placeholder='First Name*' required />
                    <span id='pd-error-firstname' class='PD-error-msg'></span>
                </div>
                <div class='PD-input-group'>
                    <input type='text' id='PSM-PD-LastName' class='PD-form-input' placeholder='Last Name*' required />
                    <span id='pd-error-lastname' class='PD-error-msg'></span>
                </div>
            </div>
            <div class='PD-row'>
                <div class='PD-input-group'>
                    <input type='text' id='PSM-PD-Email' class='PD-form-input' placeholder='Email*' required />
                    <span id='pd-error-email' class='PD-error-msg'></span>
                </div>
                <div class='PD-input-group'>
                    <input type='text' id='PSM-PD-Phone' class='PD-form-input' placeholder='Phone*' maxlength='10' />
                    <span id='pd-error-phone' class='PD-error-msg'></span>
                </div>
            </div>
                <div class='psm-pricedrop-alert'>
                    <label for='PSM-PD-Type'>Alert Preference<span class='required'>*</span></label>
                    <div>
                        <div>
                            <label for='PSM-PD-EmailType' style='font-weight: normal !Important;'>Email</label>
                            <input type='checkbox' checked id='PSM-PD-EmailType' value='Email' />
                        </div>
                        <div>
                            <label for='PSM-PD-PhoneType' style='font-weight: normal !Important;'>Text</label>
                            <input type='checkbox' checked id='PSM-PD-TextType' value='Text' />
                        </div>
                    </div>
                    <p class='legalize'><i>I agree to receive text messages at the number provided. Message and data rates apply.</i><br />
                    <i>Use of your information is governed by our <a href='${e.dealer.privacyPolicyUrl}'>Privacy Policy</a>.</i>
                    </p>
                    <div id='PSM-PD-RecaptchaHost' class='psm-pd-recaptcha-host'></div>
                    <button id='psm-PD-FormSubmit' class='PD-FormSubmit'>Sign Up</button>
                    <div id='PD-validation' class='PD-validation'></div>
                </div>
            </div>
            </div>
            <div id='div-pd-success-message' class='div-pd-success-message' style='display: none'>
                Sending....
                <div class='lds-ellipsis'><div></div><div></div><div></div><div></div></div>
            </div>
        </div>
    </div>`}function wt(e){var n,o,i;let t=document.getElementById("modal-psm-pricedrop");if(t){(t.style.display==="none"||t.style.display==="")&&(t.style.display="block"),ee=this.getAttribute("data-psm-unitid")||"",te=this.getAttribute("data-psm-uniturl")||"",oe=this.getAttribute("data-psm-unitname")||"",ie=this.getAttribute("data-psm-unitprice")||"",ne=this.getAttribute("data-psm-unitimageurl")||"",he("ua_price_drop_alert_load",ee,te,oe,ie,ne);let r=window.jQuery;if(typeof r=="function")try{r(document).trigger("cbox_complete"),r(document).trigger("box_complete")}catch(s){}let a=window.reCaptchaLoad;if(typeof r=="function"&&typeof a=="function")try{let s=r("#divdiv-pricedrop-form");s.length&&a(s,"#psm-PD-FormSubmit")}catch(s){console.error("[PSM PriceDrop] Legacy reCaptchaLoad fallback failed:",s)}Mt("psm:pricedrop:open",{dealerGuid:(i=(o=(n=window.PSM_CONFIG)==null?void 0:n.dealer)==null?void 0:o.guid)!=null?i:"",modalId:"modal-psm-pricedrop",formId:"div-pricedrop-form",recaptchaHostId:"PSM-PD-RecaptchaHost",unitId:ee,unitUrl:te,unitName:oe,unitPrice:ie,unitImageUrl:ne})}e.stopPropagation()}function En(){let e=window.pdunits;return Array.isArray(e)?e:e?[e]:[]}function G(e){kn(e,En())}function Et(e){var i,r;let t=window.PSM_CONFIG;if(!t||!t.dealer)return;let n=(r=(i=e==null?void 0:e.dealer)==null?void 0:i.priceDrop)!=null?r:t.dealer.priceDrop;if(!n)return;let o=fe(O({},t),{dealer:fe(O({},t.dealer),{priceDrop:n})});G(o)}function Tt(e){var n;Array.isArray(e)&&(window.pdunits=e);let t=window.PSM_CONFIG;(n=t==null?void 0:t.dealer)!=null&&n.priceDrop&&G(t)}function Tn(e){let n=`${D(e.global.scriptApiUrl)}/api/Script/price-drop-units?dealerGuid=${encodeURIComponent(e.dealer.guid)}`;fetch(n).then(o=>o.json()).then(o=>{let i=o&&o.units?o.units:Array.isArray(o)?o:[];window.pdunits=Array.isArray(i)?i:i?[i]:[],G(e)}).catch(o=>{console.error("Error loading price drop units:",o),window.pdunits=[],G(e)})}function kn(e,t){let n=e.dealer.priceDrop,o=document.getElementsByClassName("psm-pricedrop-srp-widget");for(let r=0;r<o.length;r++){let a=o[r];a.innerHTML='<span class="psm-pd-widget-content" style="display:inline-flex;align-items:center;gap:6px;">'+vt+'<span class="psm-pd-widget-text">'+St(n.srpText)+"</span></span>",a.style.color=n.textColor,n.displayType===0?(a.style.backgroundColor=n.buttonColor,a.classList.add("psm-PD-ButtonType-New")):(a.style.backgroundColor=n.buttonColor||"",a.classList.add("psm-PD-LinkType","price")),a.onclick=s=>wt.call(a,s),a.dataset.psmUnitid==="12346"||e.global.isDebug||t.length===0?a.style.display="block":a.style.display=t.includes(a.dataset.psmUnitid||"")?"block":"none"}let i=document.getElementsByClassName("psm-pricedrop-vdp-widget");for(let r=0;r<i.length;r++){let a=i[r];a.innerHTML='<span class="psm-pd-widget-content" style="display:inline-flex;align-items:center;gap:6px;">'+vt+'<span class="psm-pd-widget-text">'+St(n.vdpText)+"</span></span>",a.style.color=n.textColor,n.displayType===0?(a.style.backgroundColor=n.buttonColor,a.classList.add("psm-PD-ButtonType-New")):(a.style.backgroundColor=n.buttonColor||"",a.classList.add("psm-PD-LinkType","price")),a.onclick=s=>wt.call(a,s),a.dataset.psmUnitid==="12345"||e.global.isDebug||t.length===0?a.style.display="block":a.style.display=t.includes(a.dataset.psmUnitid||"")?"block":"none"}}function Pt(){var o,i,r,a;document.getElementById("PSM-PD-FirstName").value="",document.getElementById("PSM-PD-LastName").value="",document.getElementById("PSM-PD-Phone").value="",document.getElementById("PSM-PD-Email").value="",(o=document.getElementById("PSM-PD-FirstName"))==null||o.classList.remove("error"),(i=document.getElementById("PSM-PD-LastName"))==null||i.classList.remove("error"),(r=document.getElementById("PSM-PD-Phone"))==null||r.classList.remove("error"),(a=document.getElementById("PSM-PD-Email"))==null||a.classList.remove("error");let e=document.getElementById("div-pd-success-message");e&&(e.style.display="none");let t=document.getElementById("div-pricedrop-form");t&&(t.style.display="flex");let n=document.getElementById("div-psm-pricedrop-text");n&&(n.style.display="block"),ce=0}function Cn(e){if(Pe)return;let t=document.getElementById("PSM-PD-FirstName").value,n=document.getElementById("PSM-PD-LastName").value,o=j(document.getElementById("PSM-PD-Phone").value);document.getElementById("PSM-PD-Phone").value=o;let i=document.getElementById("PSM-PD-Email").value,r=document.getElementById("PSM-PD-EmailType"),a=document.getElementById("PSM-PD-TextType"),s=r.checked?r.value:"",l=a.checked?a.value:"",d="";s==="Email"&&l==="Text"?d="EmailText":(s==="Email"&&(d+="Email"),l==="Text"&&(d+="Text"));let u=gt(t,n,o,i,d);["firstname","lastname","email","phone"].forEach(w=>{let f=document.getElementById("pd-error-"+w);f&&(f.innerText="")});let g=document.getElementById("PD-validation");if(g&&(g.innerHTML=u.errors.join("<br>")),u.isValid){let w={DealerGuid:e.dealer.guid,FirstName:t,LastName:n,PhoneNumber:o,Email:i,UnitId:ee,UnitName:oe,UnitURL:te,UnitImageURL:ne,CurrentPrice:ie,AlertType:d};Pe=!0;let f=document.getElementById("psm-PD-FormSubmit");f&&(f.disabled=!0,f.style.opacity="0.7",f.style.cursor="not-allowed");let v=document.getElementById("div-pd-success-message");v&&(v.style.display="block");let _=document.getElementById("div-pricedrop-form");_&&(_.style.display="none");let b=document.getElementById("div-psm-pricedrop-text");b&&(b.style.display="none"),fetch(`${D(e.global.scriptApiUrl)}/api/Script/price-drop-subscriber`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json;charset=UTF-8",Accept:"application/json"},body:JSON.stringify({DealerGuid:e.dealer.guid,FirstName:t,LastName:n,PhoneNumber:o,Email:i,AlertType:d,UnitName:oe,UnitId:ee,UnitURL:te,UnitImageURL:ne,CurrentPrice:ie})}).then(m=>F(this,null,function*(){if(!m.ok){let L=m.headers.get("content-type")||"",k="Error with Submission, please try again...";if(L.toLowerCase().includes("application/json")){let y=yield m.json();k=(y==null?void 0:y.Message)||(y==null?void 0:y.message)||k}else{let y=yield m.text();if(y)try{let M=JSON.parse(y);k=(M==null?void 0:M.Message)||(M==null?void 0:M.message)||y}catch(M){k=y}}throw new Error(k)}if((m.headers.get("content-type")||"").toLowerCase().includes("application/json"))return m.json();let h=yield m.text();try{return JSON.parse(h)}catch(L){return{Message:h}}})).then(m=>{var L,k,y,M;let P=(k=(L=m==null?void 0:m.Message)!=null?L:m==null?void 0:m.message)!=null?k:"",h=(M=(y=m==null?void 0:m.CustomerId)!=null?y:m==null?void 0:m.customerId)!=null?M:0;h>0&&wn(Pn(w,m)),ce=1,he("ua_price_drop_alert_submit",ee,te,oe,ie,ne,{email:i,firstName:t,dealerGuid:e.dealer.guid,lastName:n,phone:o,alertType:d}),v&&(v.innerHTML=P),X({custid:h,requestType:"Price Drp"})}).catch(m=>{let P=m instanceof Error&&m.message?m.message:"Error with Submission, please try again...";g&&(g.innerHTML=P),v&&(v.style.display="none"),_&&(_.style.display="block"),b&&(b.style.display="block")}).finally(()=>{Pe=!1,f&&(f.disabled=!1,f.style.opacity="1",f.style.cursor="pointer")})}}function kt(e){let t=(e||"").replace(/^#/,"");if(t.length===6){let n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);if(!isNaN(n)&&!isNaN(o)&&!isNaN(i))return{r:n,g:o,b:i}}if(t.length===3){let n=parseInt(t[0]+t[0],16),o=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16);if(!isNaN(n)&&!isNaN(o)&&!isNaN(i))return{r:n,g:o,b:i}}return null}function Ct(e,t,n){let o=i=>Math.max(0,Math.min(255,Math.round(i)));return"#"+[e,t,n].map(o).map(i=>i.toString(16).padStart(2,"0")).join("")}function Lt(e,t){let n=kt(e);if(!n)return e;let o=1-Math.max(0,Math.min(1,t));return Ct(n.r*o,n.g*o,n.b*o)}function xt(e,t){let n=kt(e);if(!n)return e;let o=Math.max(0,Math.min(1,t));return Ct(n.r+(255-n.r)*o,n.g+(255-n.g)*o,n.b+(255-n.b)*o)}function Ln(e){console.log("[PSM InventoryUpdates] ProcessPSMCallbackInfo payload:",e);let t=window.ProcessPSMCallbackInfo;if(typeof t=="function")try{t(e)}catch(n){console.error("ProcessPSMCallbackInfo execution failed:",n)}else console.log("[PSM InventoryUpdates] ProcessPSMCallbackInfo is not defined.")}function xn(e,t){var n,o,i,r;return{Message:(o=(n=t==null?void 0:t.Message)!=null?n:t==null?void 0:t.message)!=null?o:"",CustomerId:(r=(i=t==null?void 0:t.CustomerId)!=null?i:t==null?void 0:t.customerId)!=null?r:0,DealerGuid:e.DealerGuid,FirstName:e.FirstName,LastName:e.LastName,PhoneNumber:e.PhoneNumber,Email:e.Email,Make:e.Make,Category:e.Category,AlertType:e.AlertType,Status:e.Status,SubscriptionType:"Inventory Update"}}function Nt(e){if(!e.dealer.inventoryUpdates||!e.dealer.inventoryUpdates.enabled||e.global.isReviewSite)return;let t=e.dealer.inventoryUpdates,n=e.global.localHostUrl;Dn(e,t,n)}function Dn(e,t,n){let o="<option value='-1'>All Categories</option>",i="<option value='-1'>All Makes</option>",r=t.lighterBackColor||Lt(t.backColor,.3),a=`
    <div id='div-psm-inventoryupdate-content' class='psm-inventoryupdate-content' style='background: linear-gradient(to bottom, ${t.backColor}, ${t.backColor} 70%); color:${t.foreColor};'>
        <div id='div-psm-inventoryupdate-content-close' style='display: none;'>X</div>
        <h9 id='psm-inventoryupdate-header'>${t.headlineText}</h9>

        <div id='div-inventoryupdate-form' class='div-inventoryupdate-form' style='background-color: ${r};'>
            <table>
                <tr>
                    <td>
                        <div class='div-inventoryupdate-header'><p>${t.modalFormHeaderText}</p></div>
                    </td>
                    <td>
                        <table class='psm-iu-form-table' style='width:100%;'>
                            <tr>
                                <td style='vertical-align:top;'>
                                    <label for='PSM-IU-FirstName'>First Name<span class='required'>*</span></label><br /> 
                                    <input type='text' id='PSM-IU-FirstName' placeholder='First Name*' required='required' aria-label='First Name' />
                                </td>
                                <td style='vertical-align:top;'>
                                    <label for='PSM-IU-LastName'>Last Name<span class='required'>*</span></label><br />
                                    <input type='text' id='PSM-IU-LastName' placeholder='Last Name*' required='required' aria-label='Last Name' />
                                </td>
                            </tr>
                            <tr>
                                <td style='vertical-align:top;'>
                                    <label for='PSM-IU-Email'>Email Address<span class='required'>*</span></label><br />
                                    <input type='text' id='PSM-IU-Email' placeholder='Email*' required='required' aria-label='Email Address' />
                                </td>
                                <td style='vertical-align:top;'>
                                    <label for='PSM-IU-Phone'>Cell Phone Number<span class='required'>*</span></label><br />
                                    <input type='text' id='PSM-IU-Phone' placeholder='Phone' maxlength='10' required='required' aria-label='Phone Number' />
                                </td>
                            </tr>
                            <tr>
                                <td style='vertical-align:top;'>
                                    <label for='PSM-IU-Category'>Category<span class='required'>*</span></label><br />
                                    <select id='PSM-IU-Category' name='PSM-IU-Category' placeholder='Category*' required='required' aria-label='Category'>
                                        ${o}
                                    </select>
                                </td>
                                <td style='vertical-align:top;'>
                                    <label for='PSM-IU-Make'>Make<span class='required'>*</span></label><br />
                                    <select id='PSM-IU-Make' name='PSM-IU-Make' placeholder='Make*' required='required' aria-label='Make'>
                                        ${i}
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td style='vertical-align:top;'>
                                    <label for='PSM-IU-Status'>Condition<span class='required'>*</span></label><br />
                                    <select id='PSM-IU-Status' name='PSM-IU-Status' placeholder='Status*' required='required' aria-label='Status'>
                                        <option value='All' selected>All</option>
                                        <option value='New'>New</option>
                                        <option value='Used'>Used</option>
                                    </select>
                                </td>
                                <td style='vertical-align:top;'>
                                    <label for='PSM-IU-Type'>Type<span class='required'>*</span></label><br />
                                    <select id='PSM-IU-Type' name='PSM-IU-Type' placeholder='Status*' required='required' aria-label='Type'>
                                        <option value='EmailText' selected>Email & Text</option>
                                        <option value='Email'>Email Only</option>
                                        <option value='Text'>Text Only</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td colspan='2'>
                                    <p class='legalize'><i>I agree to receive text messages at the number provided. Message and data rates apply.</i><br />
                                    <i>Use of your information is governed by our <a href='${e.dealer.privacyPolicyUrl}'>Privacy Policy</a>.</i>
                                    </p>
                                    <button id='psm-IU-FormSubmit' class='IU-FormSubmit'>Sign Up</button>
                                    <div id='IU-validation' class='IU-validation'></div>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <div id='div-iu-success-message' class='div-iu-success-message'>
            Sending....
            <div class='lds-ellipsis'><div></div><div></div><div></div><div></div></div>
        </div>
    </div>`,s=document.createElement("div");s.innerHTML=a,document.body.appendChild(s),R(`${n}/css/psmInventoryUpdate.css?vs=16`),Un(e),Nn(e);let l=document.getElementById("div-psm-inventoryupdate-content");l&&(l.style.display="block",l.style.height="50px");let d=document.getElementById("psm-inventoryupdate-header");d&&(d.onclick=f=>{Rt(),f.stopPropagation()}),document.addEventListener("click",function(f){f.target.closest(".psm-inventoryupdate-content")||Dt()});let u=document.getElementById("div-psm-inventoryupdate-content-close");u&&(u.onclick=f=>{Dt(),u.style.display="none",f.stopPropagation()});let p=document.getElementById("psm-IU-FormSubmit");p&&(p.style.background=t.backColor,p.style.color=t.foreColor,p.style.padding="10px",p.style.borderRadius="10px",p.style.border=`2px solid ${xt(t.backColor,.25)}`,p.style.cursor="pointer",p.onclick=()=>Hn(e));let g=document.getElementById("PSM-IU-Phone");g&&Z(g);let w=document.getElementById("PSM-IU-Type");w&&w.addEventListener("change",function(){let f=this.value,v=document.querySelector("label[for='PSM-IU-Phone'] .required");f==="Email"?(g.removeAttribute("required"),v&&v.classList.add("hidden"),g.setAttribute("placeholder","Phone")):(g.setAttribute("required","required"),v&&v.classList.remove("hidden"),g.setAttribute("placeholder","Phone*"))}),window.addEventListener("load",()=>Bt(e),!1),window.addEventListener("DOMContentLoaded",()=>Bt(e))}function me(e,t,n){e.innerHTML=`<option value='-1'>${t}</option>`,n.forEach(o=>{let i=o.value||o.editValue||(o.id!=null?String(o.id):"");if(!i||i==="-1")return;let r=o.displayName||o.name||o.text||"",a=document.createElement("option");a.value=i,a.text=r,e.appendChild(a)})}function Bn(e,t,n){var a;if(n==="-1")return"All Categories";let o=(t==null?void 0:t.selectedIndex)!=null&&t.selectedIndex>=0?(((a=t.options[t.selectedIndex])==null?void 0:a.text)||"").trim():"";if(o&&o!==n)return o;let i=(e.categories||[]).find(s=>{let l=(s==null?void 0:s.value)||(s==null?void 0:s.editValue)||((s==null?void 0:s.id)!=null?String(s.id):"");return String(l)===String(n)});return((i==null?void 0:i.displayName)||"").trim()||n}function Un(e){let t=document.getElementById("PSM-IU-Category");if(!t)return;if(e.categories&&e.categories.length){me(t,"All Categories",e.categories);return}let o=`${D(e.global.scriptApiUrl)}/api/Script/categories?dealerGuid=${encodeURIComponent(e.dealer.guid)}`;fetch(o).then(i=>i.json()).then(i=>{let r=i&&i.categories?i.categories:Array.isArray(i)?i:[];me(t,"All Categories",r)}).catch(i=>{console.error("Error loading categories:",i),t.innerHTML="<option value='-1'>All Categories</option>"})}function Nn(e){let t=document.getElementById("PSM-IU-Make");if(!t)return;if(e.makes&&e.makes.length){me(t,"All Makes",e.makes);return}let o=`${D(e.global.scriptApiUrl)}/api/Script/makes?dealerGuid=${encodeURIComponent(e.dealer.guid)}`;fetch(o).then(i=>i.json()).then(i=>{let r=i&&i.makes?i.makes:Array.isArray(i)?i:[];me(t,"All Makes",r)}).catch(i=>{console.error("Error loading makes:",i),t.innerHTML="<option value='-1'>All Makes</option>"})}function Rt(){let e=document.getElementById("div-psm-inventoryupdate-content"),t=document.getElementById("div-psm-inventoryupdate-content-close");e&&(e.style.height==="50px"?(e.style.height="auto",t&&(t.style.display="block"),be("ua_inventory_updates_load")):(e.style.height="50px",t&&(t.style.display="none")))}function Dt(){let e=document.getElementById("div-psm-inventoryupdate-content");e&&e.style.height==="auto"&&(e.style.height="50px")}function Rn(e){return`<div class="invUpdRow" >
        <div>
            <img width="50" src="https://psmfirestorm.blob.core.windows.net/3ee22f0d-ae8a-410f-b12b-cbcdc7359a3a/microphone-.png">
        </div>
        <div>
            <h8>${e.dealer.inventoryUpdates.inlineTileText}</h8>
            <p><span class="emph">Sign up</span> <span class="txt">to receive an email alert when products that meet your needs are in stock.</span></p>
        </div></div>`}function Bt(e){let t=e.dealer.inventoryUpdates,n=document.getElementsByClassName("psm-inventoryupdate-widget");for(let i=0;i<n.length;i++){let r=n[i];t.inlineTileEnabled?(r.innerHTML=Rn(e),r.style.display="block",r.onclick=a=>{Rt(),a.stopPropagation()}):r.style.display="none"}let o=document.getElementsByClassName("invUpdRow");for(let i=0;i<o.length;i++){let r=o[i];r.style.backgroundColor=t.backColor,r.style.color=t.foreColor}}function Me(){let e=document.getElementById("PSM-IU-Make");if(!e||e.selectedIndex<0)return"";let t=e.options[e.selectedIndex].text,n=t.replace(/[©®™℠]/g,"").replace(/\s{2,}/g," ").trim();return n.length?n:t}function An(){var e,t,n,o,i,r,a,s;document.getElementById("PSM-IU-Category").value="-1",document.getElementById("PSM-IU-FirstName").value="",document.getElementById("PSM-IU-LastName").value="",document.getElementById("PSM-IU-Phone").value="",document.getElementById("PSM-IU-Email").value="",document.getElementById("PSM-IU-Make").value="-1",document.getElementById("PSM-IU-Status").value="All",document.getElementById("PSM-IU-Type").value="EmailText",(e=document.getElementById("PSM-IU-FirstName"))==null||e.classList.remove("error"),(t=document.getElementById("PSM-IU-LastName"))==null||t.classList.remove("error"),(n=document.getElementById("PSM-IU-Phone"))==null||n.classList.remove("error"),(o=document.getElementById("PSM-IU-Email"))==null||o.classList.remove("error"),(i=document.getElementById("PSM-IU-Make"))==null||i.classList.remove("error"),(r=document.getElementById("PSM-IU-Category"))==null||r.classList.remove("error"),(a=document.getElementById("PSM-IU-Status"))==null||a.classList.remove("error"),(s=document.getElementById("PSM-IU-Type"))==null||s.classList.remove("error")}function Hn(e){var _,b;let t=document.getElementById("PSM-IU-FirstName").value,n=document.getElementById("PSM-IU-LastName").value,o=j(document.getElementById("PSM-IU-Phone").value);document.getElementById("PSM-IU-Phone").value=o;let i=document.getElementById("PSM-IU-Email").value,r=document.getElementById("PSM-IU-Category"),a=document.getElementById("PSM-IU-Make"),s=(_=a==null?void 0:a.value)!=null?_:"-1",l=Me(),d=s==="-1"?"All":l,u=(b=r==null?void 0:r.value)!=null?b:"-1",p=Bn(e,r,u),g=document.getElementById("PSM-IU-Type").value,w=document.getElementById("PSM-IU-Status").value,f=ft(t,n,o,i,u,s,g),v=document.getElementById("IU-validation");if(v&&(v.innerHTML=f.errors.join("<br/>")),f.isValid){let m={DealerGuid:e.dealer.guid,FirstName:t,LastName:n,PhoneNumber:o,Email:i,Make:d,Category:p,AlertType:g,Status:w},P=document.getElementById("div-iu-success-message"),h=document.getElementById("div-inventoryupdate-form");P&&(P.style.display="block"),h&&(h.style.display="none"),On(P);let L=D(e.global.scriptApiUrl);fetch(`${L}/api/Script/inventory-updates-subscriber`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json;charset=UTF-8",Accept:"application/json"},body:JSON.stringify({DealerGuid:e.dealer.guid,FirstName:t,LastName:n,PhoneNumber:o,Email:i,Make:d,Category:u,AlertType:g,Status:w})}).then(k=>F(this,null,function*(){if(!k.ok){let c=yield k.text();throw new Error(c||"Error with Submission, please try again...")}if((k.headers.get("content-type")||"").toLowerCase().includes("application/json"))return k.json();let M=yield k.text();try{return JSON.parse(M)}catch(c){return{Message:M}}})).then(k=>{var S,E,I,x;let y=(E=(S=k==null?void 0:k.Message)!=null?S:k==null?void 0:k.message)!=null?E:"",M=(x=(I=k==null?void 0:k.CustomerId)!=null?I:k==null?void 0:k.customerId)!=null?x:0,c=M<=0;if(c||Ln(xn(m,k)),c||be("ua_inventory_updates_submit",{firstName:t,lastName:n,dealerGuid:e.dealer.guid,phone:o,email:i,make:d,category:p,alertType:g,condition:w}),c||An(),P&&(Ut(P,y,c),c)){let C=document.getElementById("psm-iu-try-again");C&&(C.onclick=()=>{P&&(P.style.display="none"),h&&(h.style.display="block"),v&&(v.innerHTML="")})}c||X({custid:M,requestType:"Inventory Update"})}).catch(k=>{if(P){P.style.display="block",Ut(P,"Error with Submission, please try again...",!0);let y=document.getElementById("psm-iu-try-again");y&&(y.onclick=()=>{P&&(P.style.display="none"),h&&(h.style.display="block"),v&&(v.innerHTML="")})}})}}function On(e){e&&(e.style.boxSizing="border-box",e.style.width="100%",e.style.padding="18px 46px 18px 20px",e.style.textAlign="center",e.style.overflowWrap="anywhere",e.style.wordBreak="break-word",e.innerHTML=`
        <div style="display:flex; justify-content:center; align-items:center; gap:12px; width:100%;">
            <span>Sending....</span>
            <div class='lds-ellipsis'><div></div><div></div><div></div><div></div></div>
        </div>`)}function Ut(e,t,n){e&&(e.style.boxSizing="border-box",e.style.width="100%",e.style.padding="20px 46px 20px 20px",e.style.textAlign="left",e.style.overflowWrap="anywhere",e.style.wordBreak="break-word",e.innerHTML=t||"",n&&(e.innerHTML+="<br/><br/><button id='psm-iu-try-again' class='IU-FormSubmit'>Try Again</button>"))}function Ht(e){let t=document.getElementById("divLVRM-Reviews");t&&(e.dealer.reviewToolEnabled?Ot(e.dealer.guid,!0,e):t.innerHTML="Review Tool Disabled");let n=document.getElementById("divLVRM-Review-Carousel");if(n)if(e.dealer.reviewToolEnabled&&e.dealer.reviewCarousel){n.style.display="block",n.innerHTML='<div style="width: 600px; height: 300px; margin: 0 auto; text-align: center; margin-top: 60px;"><img src="https://psm.blob.core.windows.net/psmdata/Images/loading_transparent.gif" alt="Loading" /><br />Loading reviews carousel...</div>',Ee(e.dealer.reviewCarousel);let o=`${e.global.lvrmWebAppUrl}Widget/load-widget-html?dealerGUID=${e.dealer.guid}&widgetId=1`;fetch(o,{method:"GET",mode:"cors",headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():i.text().then(r=>{var s;let a="Something went wrong. Please contact the administrator if the problem persists.";try{let u=(s=new DOMParser().parseFromString(r,"text/html").querySelector("title"))==null?void 0:s.innerText;u&&(a=u)}catch(l){}throw new Error(a)})).then(i=>{i&&(n.innerHTML=i,n.style.display="block",Ee(e.dealer.reviewCarousel),setTimeout(()=>Ee(e.dealer.reviewCarousel),1500),Ie(n),qn(e.dealer.reviewCarousel.slideInterval,n))}).catch(i=>{n.innerText=(i==null?void 0:i.message)||"An unexpected error occurred. Please try again later."}),window.addEventListener("load",()=>Ie(n)),window.addEventListener("resize",()=>Ie(n))}else n.style.display="block",n.innerText="Review Tool or Review Carousel is disabled"}function Ot(e,t,n){let o=document.getElementById("divLVRM-Reviews");if(!o)return;let i='<div class="psm-review-container"><h1>Read What Our Customers Are Saying</h1><hr >';o.style.display="block",t||(o.innerHTML=i+'<div style="width: 600px;height: 300px;margin: 0 auto;display: flex;align-items: center;justify-content: flex-start;text-align: center;flex-direction: column;"><img src="https://psm.blob.core.windows.net/psmdata/Images/loading_transparent.gif" alt="Loading"></div>');let r=D(n.global.scriptApiUrl||n.global.localHostUrl.replace("localhost:55341","localhost:5184")),a=Fn(),s=`${r}/api/script/reviews?id=${encodeURIComponent(e)}&originalDealerGUID=${encodeURIComponent(n.dealer.guid)}&isInitial=${t}&domain=${encodeURIComponent(a)}`;N({method:"GET",url:s,onSuccess:l=>{var d,u,p,g,w,f,v,_,b,m,P,h,L,k,y,M,c,S,E,I,x,C,A,ue,ke,Ce,Le,xe,De,Be,Ue,Ne,Re,Ae,He,Oe,Fe,$e;if(t&&R(`${n.global.localHostUrl}/css/psmreview.css?vs=8`),o.style.display="block",l.success){let pe=(u=(d=l.dealerOptions)!=null?d:l.DealerOptions)!=null?u:[],Ge=(g=(p=l.reviews)!=null?p:l.Reviews)!=null?g:[],Jt=(w=l.isGoogleURLEnabled)!=null?w:l.IsGoogleURLEnabled,Kt=(f=l.isFacebookURLEnabled)!=null?f:l.IsFacebookURLEnabled,qe=(v=l.googleURL)!=null?v:l.GoogleURL,We=(_=l.facebookURL)!=null?_:l.FacebookURL;i+="<div>",i+="<div id='divPSMLocations' style='display:none;'>Current Location: <select id='psmDealerSelect' class='psm-dealer-select'>";for(let U=0;U<pe.length;U++){let T=pe[U];U===0&&(i+="<option value='all' locationId='0'>Show All Locations</option>");let V=(P=(m=(b=T.EditValue)!=null?b:T.editValue)!=null?m:T.value)!=null?P:"",ae=(L=(h=T.ColumnOne)!=null?h:T.columnOne)!=null?L:"",J=(y=(k=T.ColumnTwo)!=null?k:T.columnTwo)!=null?y:null,K=(S=(c=(M=T.DisplayName)!=null?M:T.displayName)!=null?c:T.name)!=null?S:"",Q=e==V?"selected":"",Y=J!=null&&t?J:Q;i+=`<option value="${V}" locationId="${ae}" ${Y}>${K}</option>`}i+="</select><br /></div>",Jt&&qe&&(i+=`<a class="psm-reviews-button psm-google-click" href="${qe}" target="_blank"><img src="https://psm.blob.core.windows.net/psmdata/Images/icon-google.png" alt="Google" height="15" />&nbsp;&nbsp;Write Review on Google</a>`),Kt&&We&&(i+=`<a class="psm-reviews-button" href="${We}" target="_blank"><img src="https://psm.blob.core.windows.net/psmdata/Images/icon-facebook.png" alt="Facebook" height="15" />&nbsp;&nbsp;Write Review on Facebook</a>`),n.dealer.feedbackFormEnabled&&(i+='<a href="javascript:void(0);" id="btnOpenFeedback" class="psm-reviews-link">Send Dealer Feedback</a>'),i+="</div>",i+=" <div class='psm-reviews-heading-text'><p>Highlights from our reviews are shared below. All reviews can be viewed on the respective review sites.</p></div>";let ye="<div class='psm-review-row-padding'>";for(let U=0;U<Ge.length;U++){let T=Ge[U],V=(I=(E=T.CommentPreview)!=null?E:T.commentPreview)!=null?I:"",ae=(C=(x=T.ShowMoreButton)!=null?x:T.showMoreButton)!=null?C:!1,J=(ue=(A=T.ReviewDescSafe)!=null?A:T.reviewDescSafe)!=null?ue:"",K=(Ce=(ke=T.RatingImageURL)!=null?ke:T.ratingImageURL)!=null?Ce:"",Q=(xe=(Le=T.FullName)!=null?Le:T.fullName)!=null?xe:"",Y=(Be=(De=T.Rating)!=null?De:T.rating)!=null?Be:"",se=(Ne=(Ue=T.ReviewDateDisplay)!=null?Ue:T.reviewDateDisplay)!=null?Ne:"",Qe=(Ae=(Re=T.SourceURL)!=null?Re:T.sourceURL)!=null?Ae:"",Ye=(Oe=(He=T.TypeText)!=null?He:T.typeText)!=null?Oe:"",Qt=($e=(Fe=T.DealerName)!=null?Fe:T.dealerName)!=null?$e:"",Ze=le(V);if(ae){let W=Xe=>Xe?String(Xe).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"",Yt=J.replace(/\|&\|/g,"&#39;");Ze+=` <br /><span class="psm-read-more" style="cursor: pointer; padding-top:5px; display: block;" 
                          data-image="${W(K||"")}" 
                          data-name="${W(Q||"")}" 
                          data-rating="${W(Y||"")}" 
                          data-desc="${W(Yt)}" 
                          data-date="${W(se||"")}" 
                          data-source="${W(Qe||"")}" 
                          data-type="${W(Ye||"")}"><u><b>Read Full Review</b></u></span>`}ye+=`<div class='psm-review-third'><b>${Qt}</b><br /><img src='${K}' alt='${Y}' /><br /><div class='psm-review-comments'>${le(Ze.replace(/\|&\|/g,"&#39;"))}</div><table width='100%' style='padding: 2px;'><tr><td><b>${Q}</b><br />${se}</td><td align='right'><img height='30' src='${Qe}' alt='${Ye}' /></td></tr></table></div>`}ye+="</div>",i+=ye,o.innerHTML=i;let je=document.getElementById("psmReviewsModal");je&&je.remove(),document.body.insertAdjacentHTML("beforeend",`<div id='psmReviewsModal' class='psm-reviews-modal'>
                    <div class='psm-reviews-modal-content'>
                        <span class='psm-reviews-modal-close'>&times;</span>
                        <div id='psm-reviews-modal-content'></div>
                    </div>
                  </div>`),n.dealer.feedbackFormEnabled&&document.body.insertAdjacentHTML("beforeend",$n(n));let ze=o.querySelector(".psm-google-click");ze&&ze.addEventListener("click",()=>z("wr_google_click"));let Ve=document.getElementById("btnOpenFeedback");Ve&&Ve.addEventListener("click",Gn),o.querySelectorAll(".psm-read-more").forEach(U=>{U.addEventListener("click",function(){let T=this.dataset,V=T.image||"",ae=T.name||"",J=T.rating||"",K=T.desc||"",Q=T.date||"",Y=T.source||"",se=T.type||"";Te(V,ae,J,K,Q,Y,se)})});let Je=document.querySelector(".psm-reviews-modal-close");if(Je){Je.addEventListener("click",()=>{let T=document.getElementById("psmReviewsModal");T&&T.style.setProperty("display","none","important")});let U=document.getElementById("psmReviewsModal");U&&U.addEventListener("click",T=>{T.target===U&&U.style.setProperty("display","none","important")})}let Ke=document.getElementById("psmDealerSelect");Ke&&(Ke.addEventListener("change",function(){Ot(this.value,!1,n)}),pe.length>1&&(document.getElementById("divPSMLocations").style.display="block"))}else o.innerHTML=`<div style="width: 600px; height: 300px; margin: 0 auto; text-align: center; margin-top: 60px;">${l.message}</div>`},onError:l=>{o.innerHTML=`<div style="width: 600px; height: 300px; margin: 0 auto; text-align: center; margin-top: 60px;">${l}</div>`}})}function Fn(){let e=window.location.hostname||"",t=window.location.port;return t&&t!=="80"&&t!=="443"&&(e+=`:${t}`),e}function Te(e,t,n,o,i,r,a){let s=document.getElementById("psmReviewsModal");if(!s){console.error("PSM Reviews Modal not found");return}let l=b=>b?String(b).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"",d=l(e||""),u=l(n||""),p=l(r||""),g=l(a||""),w=l(t||""),f=l(i||""),v=le((o||"").replace(/\|&\|/g,"&#39;"));s.style.setProperty("display","block","important");let _=document.getElementById("psm-reviews-modal-content");_?_.innerHTML=`<div class='psm-review-third'><img src='${d}' alt='${u}' /><br /><div class='psm-review-comments'>${v}</div><table width='100%'><tr><td><b>${w}</b><br />${f}</td><td align='right'><img height='30' src='${p}' alt='${g}' /></td></tr></table></div>`:console.error("PSM Reviews Modal content element not found")}function $n(e){return""}function Gn(){let e=document.getElementById("modal-dealer-feedback");e&&(e.style.display="block")}function Ie(e=document){e.querySelectorAll(".repman-carousel-item").forEach(n=>{let o=n.querySelector(".repman-carousel-content"),i=o?o.querySelector("p"):null;if(o&&i){let r=o.offsetHeight,a=parseFloat(getComputedStyle(i).lineHeight),s=Math.floor(r/a);i.style.maxHeight=`${r}px`,i.style.webkitLineClamp=s,i.style.lineClamp=s}})}function qn(e,t){let n=t.querySelector(".repman-carousel"),o=t.querySelectorAll(".repman-carousel-slide"),i=0,r=null,a=1,s=0,l=Math.max(1,Number(e)||5)*1e3;if(!n||o.length===0)return;let d=y=>{if(!y)return!0;let M=(y.getAttribute("href")||"").toLowerCase();return y.classList.contains("carousel-control")||y.hasAttribute("data-slide")||y.hasAttribute("data-target")||M.startsWith("#invunit")},u=t.querySelector(".prev"),p=t.querySelector(".next");d(u)&&(u=null),d(p)&&(p=null);let g=o[0].parentElement;if(!g)return;let w=n,f=g;f.style.transition="transform 420ms ease",f.style.willChange="transform";let v=f;v.__psmAutoScrollInterval&&(clearInterval(v.__psmAutoScrollInterval),v.__psmAutoScrollInterval=void 0);let _=v.__psmResizeHandler;_&&(window.removeEventListener("resize",_),v.__psmResizeHandler=void 0);function b(){let y=w.clientWidth||0;return y>=1e3?4:y>=560?2:1}function m(){a=b(),s=Math.max(0,Math.ceil(o.length/a)-1),f.style.display="flex",f.style.flexWrap="nowrap",o.forEach(y=>{let M=y,c=`${100/a}%`;M.style.flex=`0 0 ${c}`,M.style.maxWidth=c,M.style.boxSizing="border-box"}),i>s&&(i=s)}function P(){let y=i*a,M=o[y],c=M?M.offsetLeft:0;f.style.transform=`translate3d(${-c}px, 0, 0)`}function h(){r&&clearInterval(r),!(s<=0)&&(r=setInterval(()=>{i=i<s?i+1:0,P()},l),v.__psmAutoScrollInterval=r)}function L(){r&&(clearInterval(r),r=null),v.__psmAutoScrollInterval=void 0}u&&(u.onclick=()=>{i=i>0?i-1:s,P(),h()}),p&&(p.onclick=()=>{i=i<s?i+1:0,P(),h()}),m(),P();let k=()=>{m(),P(),h()};window.addEventListener("resize",k),v.__psmResizeHandler=k,w.onmouseenter=null,w.onmouseleave=null,h()}function Ee(e){let t=document.getElementById("divLVRM-Review-Carousel");if(!t||!e)return;let n=q(e,"containerHeight","ContainerHeight"),o=q(e,"containerWidth","ContainerWidth"),i=q(e,"arrowsColor","ArrowsColor"),r=q(e,"borderColor","BorderColor"),a=q(e,"widgetBackgroundColor","WidgetBackgroundColor"),s=q(e,"reviewDateColor","ReviewDateColor"),l=q(e,"reviewTextColor","ReviewTextColor"),d=q(e,"headingTextColor","HeadingTextColor"),u=jn(t.parentElement),p=Wn(u),g=p?"#fff":"#000",w=p?"#ddd":"#000",f=p?"rgba(255,255,255,0.06)":"#fff",v=p?"#fff":"#000",_=re(r)?r:w,b=re(l)?l:g,m=re(d)?d:g,P=re(s)?s:g,h=re(a)?a:f,L=re(i)?i:v;t.style.setProperty("--rc-border",_),t.style.setProperty("--rc-p",b),t.style.setProperty("--rc-date",P),t.style.setProperty("--rc-bg",h),t.style.setProperty("--rc-heading",m),t.style.setProperty("--rc-arrow",L),At(n)&&(t.style.height=n),At(o)&&(t.style.width=o)}function q(e,t,n){var i,r;let o=(r=(i=e==null?void 0:e[t])!=null?i:e==null?void 0:e[n])!=null?r:"";return String(o!=null?o:"").trim()}function Wn(e){if(!e||(e=e.trim().toLowerCase(),e==="transparent"||e==="rgba(0, 0, 0, 0)")||e==="#fff"||e==="#ffffff"||e==="white")return!1;if(e==="#000"||e==="#000000"||e==="black")return!0;let t=0,n=0,o=0;if(e[0]==="#")if(e.length===4)t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),o=parseInt(e[3]+e[3],16);else if(e.length===7)t=parseInt(e.substring(1,3),16),n=parseInt(e.substring(3,5),16),o=parseInt(e.substring(5,7),16);else return!1;else{let r=e.match(/\d+/g);if(!r||r.length<3)return!1;t=parseInt(r[0],10),n=parseInt(r[1],10),o=parseInt(r[2],10)}return(.2126*t+.7152*n+.0722*o)/255<.55}function jn(e){for(;e&&e!==document.body;){let t=getComputedStyle(e).backgroundColor;if(t&&t!=="rgba(0, 0, 0, 0)"&&t!=="transparent")return t;e=e.parentElement}return getComputedStyle(document.body).backgroundColor||"rgb(255,255,255)"}function re(e){if(!e||(e=e.trim().toLowerCase(),e===""||e==="0"||e==="transparent"||e==="null"||e==="undefined"))return!1;if(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(e)||/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+(\s*,\s*(0|1|0?\.\d+))?\s*\)$/i.test(e))return!0;let t=new Option().style;return t.color=e,t.color!==""}function At(e){return!e||(e=e.trim().toLowerCase(),e===""||e==="0"||e==="0px"||e==="null"||e==="undefined")?!1:/^\d+(\.\d+)?(px|%|vh|vw|rem|em)$/.test(e)}function Ft(e,t){let n=/\/shopper-guide\b/i,o=window;o.__SG_DEBUG=o.__SG_DEBUG||!1;function i(...c){if(o.__SG_DEBUG)try{console.log.apply(console,c)}catch(S){}}function r(){try{return n.test(location.pathname)}catch(c){return!1}}function a(){return o.utag&&o.utag.data?o.utag.data:null}function s(){return o.utag_data||null}function l(c){let S=a()||{},E=s()||{},I={};try{I=Object.assign({},S,E,c||{})}catch(x){for(let C in S)I[C]=S[C];for(let C in E)I[C]=E[C];for(let C in c||{})I[C]=c[C]}return I}function d(c){let S=parseInt(c,10);return isNaN(S)?0:S}function u(c){return(c==null?"":""+c).trim().toLowerCase()}function p(c){return{DateCreated:new Date().toISOString(),DealerId:e,DeviceId:$("firestorm_dev_id"),CustomerId:0,tealium_event:c.tealium_event||"",ga4_id:c.ga4_id||c.ga_client_id||"",page_h1:c.page_h1||"",page_title:c.page_title||document.title||"",page_title_count:d(c.page_title_count||0),shopper_guide_step:d(c.shopper_guide_step||0),shopper_guide_question:c.shopper_guide_question||"",site_company_name:c.site_company_name||"",site_company_city:c.site_company_city||"",site_company_state:c.site_company_state||"",site_company_zip_code:c.site_company_zip_code||"",site_phone_main:c.site_phone_main||"",site_id:c.site_id||"",site_internal_id:c.site_internal_id||"",site_platform:c.site_platform||"",site_platform_brand:c.site_platform_brand||"",site_section:c.site_section||""}}let g=-1,w=0;function f(c){return r()&&c>0&&c!==g}function v(c){let S=p(c);i("[SG] send step",S.shopper_guide_step,"event=",S.tealium_event,S);try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json","x-apiKey":"eb094e9e-3fa7-4402-b49e-08a04c1847eb","X-Referer":location.href},body:JSON.stringify(S),keepalive:!0}).catch(function(E){console&&console.warn("ShopperGuide post failed",E)})}catch(E){}}function _(c){if(!r()){i("[SG] skip: not target");return}let S=l(c);if(!S){i("[SG] skip: no data");return}let E=d(S.shopper_guide_step),I=d(w),x=I>1&&E===1,C=u(S.tealium_event);x&&C==="shopper_guide_view"&&(S.tealium_event="shopper_guide_start_over",i("[SG] reset detected ("+I+" -> "+E+") with shopper_guide_view; overriding event to shopper_guide_start_over")),f(E)?(g=E,v(S)):i("[SG] skip: step",E,"lastStepSent",g,"was",I,"evt",C),w=E}function b(c,S,E){let I=c&&c[S];if(typeof I!="function"||I.__sg_instrumented)return;let x=E(I);x.__sg_instrumented=!0,c[S]=x}function m(){o.utag&&(b(o.utag,"track",function(c){return function(S,E){try{i("[SG] utag.track",S,E),_(E)}catch(I){}return c.apply(this,arguments)}}),b(o.utag,"view",function(c){return function(S){try{i("[SG] utag.view",S),_(S)}catch(E){}return c.apply(this,arguments)}}),b(o.utag,"link",function(c){return function(S){try{i("[SG] utag.link",S),_(S)}catch(E){}return c.apply(this,arguments)}}))}let P=null,h=null;function L(c,S){if(!(!c||typeof c!="object")&&!c.__sg_step_watched)try{let E=c.hasOwnProperty("shopper_guide_step")?c.shopper_guide_step:void 0;Object.defineProperty(c,"shopper_guide_step",{configurable:!0,enumerable:!0,get:function(){return E},set:function(I){E=I,i("[SG] step set ("+S+") ->",I);try{_(c)}catch(x){}}}),Object.defineProperty(c,"__sg_step_watched",{value:!0,enumerable:!1}),i("[SG] watcher via defineProperty on",S)}catch(E){try{let I=new Proxy(c,{set:function(x,C,A){if(x[C]=A,C==="shopper_guide_step"){i("[SG] step set Proxy("+S+") ->",A);try{_(x)}catch(ue){}}return!0}});S==="utag.data"&&o.utag&&o.utag.data===c&&(o.utag.data=I),S==="utag_data"&&o.utag_data===c&&(o.utag_data=I),i("[SG] watcher via Proxy on",S)}catch(I){i("[SG] failed to watch",S,I)}}}function k(){let c=0,S=setInterval(function(){c++;let E=a(),I=s();E&&E!==P&&(P=E,L(E,"utag.data"),_()),I&&I!==h&&(h=I,L(I,"utag_data"),_()),m(),c>1200&&clearInterval(S)},1e3)}function y(){["pushState","replaceState"].forEach(function(c){let S=history[c];if(typeof S!="function"||S.__sg_instrumented)return;let E=function(...I){let x=S.apply(this,I);return setTimeout(function(){i("[SG] history."+c+" -> check");try{_()}catch(C){}},0),x};E.__sg_instrumented=!0,history[c]=E}),window.addEventListener("popstate",function(){i("[SG] popstate");try{_()}catch(c){}}),window.addEventListener("hashchange",function(){i("[SG] hashchange");try{_()}catch(c){}})}function M(){i("[SG] start. isTarget=",r(),"href=",location.href);let c=l();w=d(c&&c.shopper_guide_step),m(),y();let S=a();S&&(P=S,L(S,"utag.data"));let E=s();E&&(h=E,L(E,"utag_data")),_(),k();let I=0,x=setInterval(function(){I++;try{_()}catch(C){}I>600&&clearInterval(x)},1e3);o.__SG_status=function(){let C=l();return{href:location.href,isTarget:r(),step:d(C.shopper_guide_step),lastStepSent:g,lastStepObserved:w,event:C&&C.tealium_event||"",hasUtag:!!o.utag,has_utag_data:!!o.utag_data}},o.__SG_forceSend=function(){_()}}r()?M():y()}function $t(e){e.dealer.enableAugurScript&&Vn(e)}function zn(e){let t=window;if(!t.boatyard||typeof t.boatyard.registerAnalyticsCallback!="function"){console.warn("Boatyard not available or registerAnalyticsCallback not found");return}["dr_load","signup_success","dr_get_quote_next_steps_click","dr_trade_in_added","dr_trade_in_photos_added","dr_form_submit"].forEach(o=>{t.boatyard.registerAnalyticsCallback(o,i=>{Jn(e,i)})}),console.log("Boatyard callbacks registered for Digital Retailing events")}function Vn(e,t=1e4,n=100){let o=Date.now(),i=window,r=setInterval(()=>{i.boatyard&&typeof i.boatyard.registerAnalyticsCallback=="function"?(clearInterval(r),console.log("Boatyard ready. Registering callbacks."),zn(e)):Date.now()-o>t&&(clearInterval(r),console.warn("Timed out waiting for window.boatyard.registerAnalyticsCallback"))},n)}function Jn(e,t){let n=$("firestorm_dev_id")||"",i=`${D(e.global.scriptApiUrl||e.global.onboardWebAppUrl)}/api/Script/RegisterPaymentGenieEvent?DealerId=${e.dealer.id}&DeviceId=${n}`;N({method:"POST",url:i,headers:{"x-apiKey":"eb094e9e-3fa7-4402-b49e-08a04c1847eb","Content-Type":"application/json;charset=UTF-8"},data:t,onSuccess:r=>{let a;try{a=typeof r=="string"?JSON.parse(r):r,typeof a=="string"&&(a=JSON.parse(a))}catch(s){console.error("Failed to parse Digital Retail response:",s);return}a.success?console.log(`Digital Retail Event Saved for ${n}`):console.log(a.message||"Unknown error")},onError:r=>{console.error("Digital Retail Event Error:",r)}})}function Gt(e){if(!e.dealer.feedbackFormEnabled)return;let t=document.getElementById("btnSendFeedback");t&&t.addEventListener("click",()=>Qn(e));let n=document.getElementById("txtPhone");n&&n.addEventListener("input",o=>{let i=o.target,r=i.value.replace(/\D/g,"").substring(0,10),a="";r.length>0&&(a="("+r.substring(0,3)),r.length>=4&&(a+=") "+r.substring(3,6)),r.length>=7&&(a+="-"+r.substring(6)),i.value=a}),qt(e)}function Kn(e){let t=document.getElementById("modal-dealer-feedback");t&&(t.style.display="none");let n=document.getElementById("txtFirstName"),o=document.getElementById("txtLastName"),i=document.getElementById("txtEmail"),r=document.getElementById("txtPhone"),a=document.getElementById("txtFeedback"),s=document.getElementById("txtCaptchaInput");n&&(n.value=""),o&&(o.value=""),i&&(i.value=""),r&&(r.value=""),a&&(a.value=""),s&&(s.value=""),document.querySelectorAll("#modal-dealer-feedback .psm-feedback-text-danger.psm-feedback-small").forEach(l=>{l.innerText="",l.style.display="none"}),qt(e)}function qt(e){let n=`${D(e.global.scriptApiUrl||e.global.onboardWebAppUrl)}/api/Script/get-captcha`;fetch(n).then(o=>o.json()).then(o=>{let i=document.getElementById("imgCaptcha"),r=document.getElementById("hdnCaptchaExpected");i&&o.captchaBase64&&(i.src=o.captchaBase64),r&&o.captchaText&&(r.value=o.captchaText)}).catch(o=>{console.error("CAPTCHA reload error",o)})}function Qn(e){var w,f,v,_,b,m,P;document.querySelectorAll(".psm-feedback-text-danger.psm-feedback-small").forEach(h=>{h.style.display="none"});let t=(w=document.getElementById("txtFirstName"))==null?void 0:w.value.trim(),n=(f=document.getElementById("txtLastName"))==null?void 0:f.value.trim(),o=(v=document.getElementById("txtEmail"))==null?void 0:v.value.trim(),i=(_=document.getElementById("txtPhone"))==null?void 0:_.value.trim(),r=(b=document.getElementById("txtFeedback"))==null?void 0:b.value.trim(),a=(m=document.getElementById("txtCaptchaInput"))==null?void 0:m.value.trim(),s=(P=document.getElementById("hdnCaptchaExpected"))==null?void 0:P.value.trim(),l=!0,d=i.replace(/\D/g,"");if(d.length>0&&d.substring(0,1)==="1"){let h=document.getElementById("errPhone");h&&(h.innerText="Invalid phone number. Cannot start with 1.",h.style.display="block"),l=!1}if(!t){let h=document.getElementById("errFirstName");h&&(h.innerText="Please enter first name.",h.style.display="block"),l=!1}if(!n){let h=document.getElementById("errLastName");h&&(h.innerText="Please enter last name.",h.style.display="block"),l=!1}if(!o||!/^\S+@\S+\.\S+$/.test(o)){let h=document.getElementById("errEmail");h&&(h.innerText="Please enter a valid email.",h.style.display="block"),l=!1}if(!r){let h=document.getElementById("errFeedback");h&&(h.innerText="Please enter feedback.",h.style.display="block"),l=!1}if(a){if(s!==a){let h=document.getElementById("errCaptcha");h&&(h.innerText="Please enter valid CAPTCHA.",h.style.display="block"),l=!1}}else{let h=document.getElementById("errCaptcha");h&&(h.innerText="Please enter CAPTCHA.",h.style.display="block"),l=!1}if(!l)return;let u=document.getElementById("div-dealer-feedback-success-message");u&&(u.style.display="block"),document.body.style.cursor="wait";let p=D(e.global.scriptApiUrl||e.global.onboardWebAppUrl),g=_e(i);N({method:"POST",url:`${p}/api/Script/SaveDealerFeedback`,headers:{"Content-Type":"application/json;charset=UTF-8"},data:{DealerGUID:e.dealer.guid,OriginalDealerGUID:e.dealer.guid,FirstName:t,LastName:n,Email:o,Phone:g,Feedback:r},onSuccess:h=>{if(u&&(u.style.display="none"),document.body.style.cursor="default",h.success)alert("Thank you for your feedback!"),Kn(e);else{let L=document.getElementById("errCaptcha");L&&(L.innerText=h.message||"Submission failed. Please try again.",L.style.display="block")}},onError:h=>{u&&(u.style.display="none"),document.body.style.cursor="default";let L=document.getElementById("errCaptcha");L&&(L.innerText="Unexpected response from server.",L.style.display="block")}})}function Wt(e,t){let n=document.getElementById("psmDealerSelect");if(!n)return;let o=n.querySelectorAll("option[locationId]");for(let i=0;i<o.length;i++){let r=o[i];if(parseInt(r.getAttribute("locationId")||"0",10)===e){n.value=r.value,n.dispatchEvent(new Event("change"));break}}}function jt(e){var r;let t=(((r=e==null?void 0:e.dealer)==null?void 0:r.guid)||"").toLowerCase();if(!t)return;let n=window;if(n.__PSM_SCRIPT_FIRE_SENT_GUIDS__=n.__PSM_SCRIPT_FIRE_SENT_GUIDS__||{},n.__PSM_SCRIPT_FIRE_SENT_GUIDS__[t])return;n.__PSM_SCRIPT_FIRE_SENT_GUIDS__[t]=!0;let o=D(e.global.scriptApiUrl||e.global.onboardWebAppUrl||"");if(!o)return;let i={dealerId:e.dealer.id,dealerGuid:e.dealer.guid,requestUrl:window.location.href,isReviewSite:!!e.global.isReviewSite};fetch(`${o}/api/Script/register-script-fire`,{method:"POST",mode:"cors",keepalive:!0,headers:{"Content-Type":"application/json;charset=UTF-8"},body:JSON.stringify(i)}).catch(()=>{})}function Yn(){try{if(!(typeof window!="undefined"&&window.location&&window.location.search&&window.location.search.includes("psm_debug=1")||typeof window!="undefined"&&window.localStorage&&window.localStorage.getItem("psm_debug")==="1"))return()=>{};let t=document.createElement("div");t.id="psm-debug-overlay",t.style.position="fixed",t.style.bottom="10px",t.style.right="10px",t.style.zIndex="2147483647",t.style.maxWidth="420px",t.style.maxHeight="220px",t.style.overflow="auto",t.style.background="rgba(0,0,0,0.85)",t.style.color="#fff",t.style.fontSize="11px",t.style.fontFamily="Consolas, monospace",t.style.padding="8px",t.style.borderRadius="6px",t.style.boxShadow="0 2px 8px rgba(0,0,0,0.3)",t.innerText=`PSM debug enabled
`;let n=()=>{if(!t.parentElement){if(document.body){document.body.appendChild(t);return}document.documentElement&&document.documentElement.appendChild(t)}};n();let o=window.setInterval(()=>{n(),t.parentElement&&window.clearInterval(o)},200),i=[],r=a=>{let s=`[${new Date().toISOString()}] ${a}`;for(i.push(s);i.length>30;)i.shift();t.innerText=i.join(`
`)};return window.__PSM_DEBUG_STATUS__=()=>i.slice(),window.setInterval(()=>{r("heartbeat")},5e3),window.addEventListener("error",a=>{r(`ERROR: ${a.message}`)}),window.addEventListener("unhandledrejection",a=>{r(`REJECT: ${String(a.reason)}`)}),r}catch(e){return()=>{}}}var H=Yn();function zt(e){return F(this,null,function*(){var f,v,_;let t=window.ProcessPSMCallbackInfo;if(typeof t!="function")throw new Error("ProcessPSMCallbackInfo is not defined.");if(!(e!=null&&e.apiKey))throw new Error("apiKey is required.");let n=window.PSM_CONFIG,o=D(((f=n==null?void 0:n.global)==null?void 0:f.scriptApiUrl)||((v=n==null?void 0:n.global)==null?void 0:v.onboardWebAppUrl)||"");if(!o)throw new Error("Unable to resolve ScriptAPI base URL.");let i=e.dealerGuid||((_=n==null?void 0:n.dealer)==null?void 0:_.guid);if(!i)throw new Error("dealerGuid is required (or present in PSM_CONFIG.dealer.guid).");let r=new URLSearchParams;r.set("dealerGuid",i),e.fromUtc&&r.set("fromUtc",e.fromUtc),e.toUtc&&r.set("toUtc",e.toUtc),typeof e.includePriceDrop=="boolean"&&r.set("includePriceDrop",String(e.includePriceDrop)),typeof e.includeInventoryUpdates=="boolean"&&r.set("includeInventoryUpdates",String(e.includeInventoryUpdates)),typeof e.maxRowsPerType=="number"&&r.set("maxRowsPerType",String(e.maxRowsPerType));let a=`${o}/api/Script/callback-backfill-leads?${r.toString()}`,s=yield fetch(a,{method:"GET",headers:{Accept:"application/json","x-apiKey":e.apiKey}});if(!s.ok){let b=yield s.text();throw new Error(b||`Backfill request failed (${s.status})`)}let l=yield s.json(),d=Array.isArray(l==null?void 0:l.leads)?l.leads:[],u=b=>{if(!b||typeof b!="object")return b;let m={};return Object.keys(b).forEach(P=>{if(!P)return;let h=P.charAt(0).toUpperCase()+P.slice(1);m[h]=b[P]}),m},p=0,g=0;for(let b of d){let m=u(b);try{t(m),p++}catch(P){g++,console.error("[PSM] ProcessPSMCallbackInfo replay failed for lead:",m,P)}}let w={success:!0,dealerGuid:i,fetched:d.length,sent:p,failed:g};return console.log("[PSM] replayMissingLeadCallbacks summary:",w),w})}var Vt={applyPriceDropWidgetStyles:Et,rebindPriceDropWidgets:Tt,replayMissingLeadCallbacks:zt,init:function(e){var i;let t=window.__PSM_INIT_DONE_GUIDS__=window.__PSM_INIT_DONE_GUIDS__||{},n=(((i=e==null?void 0:e.dealer)==null?void 0:i.guid)||"").toLowerCase();if(n&&t[n])return;window.PSM_CONFIG=e,H("init start");let o=D(e.global.scriptApiUrl||e.global.onboardWebAppUrl);if(e.global.scriptApiUrl=o,e.global.onboardWebAppUrl=o?o+"/":e.global.onboardWebAppUrl,!ot(e.global.localHostUrl,e.dealer.guid)){H("initWrapper returned false (duplicate/defer)");return}n&&(t[n]=!0),window.__PSM_INIT_DONE__=!0,jt(e),setTimeout(function(){H("start: timer"),it(e.dealer.id,e.dealer.guid);let r=new Set((typeof window!="undefined"&&window.location&&window.location.search&&new URLSearchParams(window.location.search).get("psm_disable")||"").split(",").map(d=>d.trim().toLowerCase()).filter(Boolean)),a=[{name:"chat",run:()=>ht(e)},{name:"price-drop",run:()=>It(e)},{name:"inventory-updates",run:()=>Nt(e)},{name:"reviews",run:()=>Ht(e)},{name:"digital-retailing",run:()=>$t(e)},{name:"dealer-feedback",run:()=>Gt(e)}],s=d=>{if(d>=a.length)return;let u=a[d];if(r.has(u.name)){H(`skip: ${u.name}`),window.__PSM_INIT_STEP__=`skip:${u.name}`,setTimeout(()=>s(d+1),0);return}H(`start: ${u.name}`),window.__PSM_INIT_STEP__=u.name;try{u.run()}catch(p){H(`error: ${u.name}: ${String(p)}`)}setTimeout(()=>s(d+1),0)};s(0);let l=Array.from(new Set([e.dealer.guid,...(e.dealer.associations||[]).map(d=>d.dealerId).filter(Boolean)])).join(";");H("start: onboarding"),mt(e.dealer.id,e.dealer.guid,o,e.dealer.enableAugurScript,l,e),H("start: shopper guide"),Ft(e.dealer.id,o+"/api/Script/RegisterShopperGuideEvent"),window.ShowPSMReviewDetails=Te,window.getInventoryUpdatesMakeValue=Me,window.selectPSMDealerByExternalLocationId=d=>{Wt(d,e)},H("init complete")},0)}};window.PSM=Vt;window.ReplayMissingLeadCallbacks=zt;typeof window!="undefined"&&window.PSM_CONFIG&&window.PSM&&typeof window.PSM.init=="function"&&window.PSM.init(window.PSM_CONFIG);var Ii=Vt;})();
}catch(e){try{console.log('PSM script error');}catch(_){}}})();