import{k as e}from"./4.C_rgEAoe.chunk.js";import{p as t,x as n,y as i,z as r,m as o,u as a,A as s,D as l,w as c,f as u,E as d,L as p,F as f,G as m,H as h,I as g,J as y,K as v,N as w,O as b,P as k,Q as x,T as S,U as z,V as E,W as I,X as _,Y as C,Z as F,_ as A,$ as P,a0 as T,a1 as O,a2 as M,a3 as D,l as N,a4 as L,a5 as V,h as R,j as W,k as j,a6 as q,a7 as G,a8 as U,i as H,a9 as B,aa as $,ab as Z,ac as Y,ad as J,ae as X,af as K,ag as Q,ah as ee,ai as te,aj as ne,ak as ie,al as re,am as oe,an as ae,ao as se}from"./3.B5sHuEdG.chunk.js";import{g as le,a as ce,d as ue}from"./6.D_CKFAbE.chunk.js";import{g as de,d as pe,b as fe,m as me,l as he,f as ge,t as ye,a as ve,n as we,o as be,r as ke,c as xe,e as Se,h as ze}from"./5.D_uKc_ak.chunk.js";import{f as Ee,a as Ie,i as _e,m as Ce,c as Fe,r as Ae,C as Pe,u as Te,b as Oe,e as Me,h as De,j as Ne,k as Le,l as Ve,n as Re,o as We,q as je}from"./2.Dt3945Qy.chunk.js";import{d as qe}from"./11.Gv78iMd6.chunk.js";import{i as Ge}from"./12.DJPUQwQu.chunk.js";const Ue={};const He=de((...e)=>(t,n)=>{if(0!==t)return;const i=e.length;if(0===i)return n(0,()=>{}),n(1,[]),void n(2);let r=i,o=i,a=i;const s=new Array(i),l=new Array(i),c=(e,t)=>{if(0!==e)for(let n=0;n{s[t]=Ue,e(0,(e,u)=>{if(0===e)l[t]=u,0==--r&&n(0,c);else if(1===e){const e=o?s[t]===Ue?--o:o:0;if(s[t]=u,0===e){const e=new Array(i);for(let t=0;tt=>(n,i)=>{if(0!==n)return;let r,o=0;t(0,(t,n)=>{0===t?(r=n,i(t,n)):1===t&&o[e,t[e]])}const Je=e=>{let{code:t,message:n}=e;const i=new Error(n);return i.code=t,i},Xe=(e,t)=>a(""+((e,t)=>"https://accounts.livechatinc.com"+(e=>{let{uniqueGroups:t,organizationId:n,groupId:i}=e;return t?"/v2/customer/"+n+"/"+i+"/token":"/v2/customer/token"})(e))(e),{method:"POST",credentials:"include",body:JSON.stringify({response_type:"token",grant_type:"cookie",client_id:e.clientId,organization_id:e.organizationId,redirect_uri:le(String(window.location))+window.location.pathname})}).then(e=>e.json()).then(t=>((e,t)=>{if("identity_exception"in e)throw Je({code:"SSO_IDENTITY_EXCEPTION",message:e.identity_exception});if("oauth_exception"in e)throw Je({code:"SSO_OAUTH_EXCEPTION",message:e.oauth_exception});return{accessToken:e.access_token,entityId:e.entity_id,expiresIn:1e3*e.expires_in,tokenType:e.token_type,creationDate:Date.now(),organizationId:t}})(t,e.organizationId)),Ke=e=>{let{organizationId:t,clientId:n}=e;if("string"!=typeof t||"string"!=typeof n)throw new Error("You need to pass valid configuration object: { organizationId, clientId }.")},Qe=(e,t,n)=>{Ke(e);const i=s(n),r=""+(e.tokenStoragePrefix||"@@lc_auth_token:")+e.organizationId+(e.uniqueGroups?":"+e.groupId:"");let o=null,a=null,l=i.getItem(r).then(e=>{null!==l&&(l=null,e&&(a=JSON.parse(e)))});const c=()=>(o=Xe(e).then(e=>(o=null,i.setItem(r,JSON.stringify(e)),a=e,e),e=>{throw o=null,e}),o),u=()=>o||(a&&!(e=>{let{creationDate:t,expiresIn:n}=e;return Date.now()>=t+n})(a)?Promise.resolve(a):l?l.then(u):c()),d=()=>l?l.then(d):Promise.resolve(!!a);return{getFreshToken:c,getToken:u,hasToken:d,invalidate:()=>(a=null,l=null,i.removeItem(r))}},et=(e,t)=>f(e,"visibility").state===t,tt=e=>x(e).some(e=>{if("form"!==e.type)return!1;const{fields:t}=e.properties;return t.some(e=>"group_chooser"===e.type)}),nt=e=>{const i=t(u(e,e=>et(e,"maximized")),Be(1),ge(Boolean));t(i,ye(1),ge(()=>!Math.floor(1e3*Math.random())),ve(()=>(e=>{m({isMessagingModeEnabled:h(e),isCustomerInvited:g(e),groupAvailability:e.getApplicationState().availability,minimizedType:y(e)})})(e))),t((e=>t(l(e,c),n(()=>t(u(e,e=>d(e,p).active),Be(1),ge(Boolean)))))(e),ve(()=>(e=>{const{s:t,embedded:n,testGroup:i,actingAsDirectLink:r,config:o,language:a,integrationName:s,clientChatNumber:l,clientVisitNumber:c}=e.getApplicationState(),u=o&&o.theme&&o.theme.name,d=v()||"none",f=w(),m=b(e),h=!!k(e,p),I=!!e.getSessionUser().email,_=g(e)?"invitation":"other",C=y(e),F=x(e),A=F.find(e=>!!e.properties.invitation),P=S(F.filter(e=>"message"===e.type||"message_draft"===e.type)),T=z(e);E({s:t,embedded:n,themeName:u,testGroup:i,uniqueGroups:f,minimizedType:C,language:a||"unknown",integrationName:s||"none",mobileBridgeType:d,chatHistoryEnabled:m,hasPreviousChatThreads:h,hasGroupChooser:String(tt(e)),hasBeenImmediatelyQueued:String(e.getChat(p).properties.queued),isCustomerEmailSet:I,actingAsDirectLink:r,chatWidgetWidth:window.innerWidth,chatWidgetHeight:window.innerHeight,clientChatNumber:l+1,clientVisitNumber:c,chatSource:_,fromGreeting:!!Ie(!1,"properties.fromGreeting",P),homescreenEnabled:T,..."invitation"===_&&A&&{greetingId:A.properties.id,greetingUniqueId:A.properties.uniqueId,greetingType:A.properties.type,greetingSubtype:A.properties.subtype,greetingAddon:A.properties.addon||"none"}})})(e)))};window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_js_loaded");const it=e=>new Promise(t=>{const n=performance.getEntriesByName(e);if(!I(n))return void t(n[0]);if("undefined"==typeof PerformanceObserver)return void t(null);const i=setTimeout(()=>{r.disconnect(),t(null)},6e4),r=new PerformanceObserver(n=>{const o=_(t=>t.name===e,n.getEntries());o&&(r.disconnect(),clearTimeout(i),t(o))});r.observe({entryTypes:["paint"]})}),rt=()=>{const e="lc_get_time_"+C();window.performance&&"function"==typeof window.performance.mark&&window.performance.mark(e);const[{startTime:t}]=performance.getEntriesByName(e);return performance.clearMarks(e),t},ot=()=>{if("undefined"==typeof PerformanceObserver)return null;const e=rt(),t=[],n=new PerformanceObserver(e=>{t.push.apply(t,e.getEntries())});n.observe({entryTypes:["longtask"]});const i=()=>{const n=S(t);return n?(i=n,rt()-i.startTime+i.duration):rt()-e;var i};return{disconnect:()=>n.disconnect(),getLongTasks:()=>[].concat(t),waitForIdle:e=>new Promise(r=>{const o=()=>{t.push.apply(t,n.takeRecords());const a=i();a>=e?r():setTimeout(o,Math.ceil(e-a))};o()})}},at=(e,t)=>{if(!e||!t)return null;const n=S(e);return n?Math.max(n.startTime+n.duration,t.startTime):t.startTime},st=()=>{if(Math.floor(1e3*Math.random()))return;const e=function(e){const t=ot();return t?it(e).then(e=>e?t.waitForIdle(5e3).then(()=>(t.disconnect(),t.getLongTasks())):null):Promise.resolve(null)}("first-paint");return{getLogs:()=>Promise.all([e,it("first-paint")]).then(e=>{let[t,n]=e;return F(e=>{return e&&(t=2,Number(e.toFixed(t)));var t},{totalBlockingTime:t&&(i=t.map(e=>e.duration),i.reduce(Ze,0)),firstContentfulPaint:null==n?void 0:n.startTime,timeToInteractive:at(t,n)});var i})}},lt=new RegExp("("+["BetterJsPop","LOCAL_STORAGE is null","Can't find variable: auto","Can't find variable: ext","Can't find variable: $","_avast_submit","No license or organization found in the URL.","getNewsReadStatus4Vivo","is banned!","Object Not Found Matching Id"].join("|")+")"),ct=new RegExp("("+["chrome-extension://","https://www.smybeds.com/"].join("|")+")"),ut=e=>!!(e.message&<.test(e.message)||e.stack&&ct.test(e.stack));window.addEventListener("error",e=>{let{error:t}=e;if(t&&!ut(t))if(t.message&&-1!==t.message.indexOf("Incorrect locale information provided")){const e=navigator.language||navigator.userLanguage||"en-US";A("onerror",t,{"navigator.language":navigator.language,"navigator.userLanguage":navigator.userLanguage,locale:e,err:(()=>{try{return new Intl.Locale(e),!1}catch(t){return!0}})()})}else A("onerror",t)}),window.addEventListener("unhandledrejection",e=>{e&&e.reason&&(ut(e.reason)||A("unhandledrejection",e.reason))});const dt=e=>e.some(_e),pt=(e,a)=>{const s=t(function(){const e=he(()=>!!document.hasFocus&&document.hasFocus()),t=o(()=>!0)(fe(window,"focus")),n=o(()=>!1)(fe(window,"blur"));return me(e,t,n)}(),P);if(!a)return void t(s,ve(t=>{e.setApplicationState({pageFocused:t,applicationFocused:t})}));const l=(c=a,t(pe(()=>r(Promise.race([c.call("isFocused"),new Promise(e=>{return n="focus",i=e,void(t=c).on(n,(function e(r){t.off(n,e),i(r)}));var t,n,i})]))),n(e=>t(Ee(c,"focus"),i(e)))));var c;t(s,ve(t=>{e.setApplicationState({applicationFocused:t}),a.emit("focus",t)})),t(He(s,l),qe(50),o(dt),T(),ve(t=>{e.setApplicationState({pageFocused:t})}))},ft=e=>"function"==typeof e.start&&"function"==typeof e.stop,mt=e=>{ft(e)?e.start(0):e.noteOn(0)},ht=()=>{const e=new(window.AudioContext||window.webkitAudioContext);let t=!0,n=[];const i=t=>new Promise((n,i)=>{e.decodeAudioData(t,n,i)}),r=t=>({play:()=>{const n=e.createBufferSource();n.connect(e.destination),n.buffer=t;return{playback:new Promise((t,i)=>{if(n.onended=()=>t(),mt(n),"running"!==e.state){const t=new Error("Playback failed, AudioContext is in incorrect state '"+e.state+"'");t.name="PlaybackError",i(t)}}),stop(){(e=>{ft(e)?e.stop(0):e.noteOff(0)})(n)}}}});return{preload:e=>(e=>new Promise((t,n)=>{const i=new XMLHttpRequest;i.onload=()=>{t(i.response)},i.onerror=n,i.open("GET",e),i.responseType="arraybuffer",i.send()}))(e).then(i).then(r),playSound:e=>{const i=e.play();return t&&n.push(i),i.playback},unlock:()=>new Promise(i=>{const r=()=>{document.removeEventListener("click",r,!0),t&&(n.forEach(e=>{e.stop()}),n=[],t=!1),e.resume(),(()=>{const t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination),mt(n)})(),i()};document.addEventListener("click",r,!0)})}},gt=/\.(\w+)$/i,yt=new Audio,vt={mp3:"audio/mpeg",ogg:"audio/ogg"},wt=e=>{const t=(e=>{const t=e.match(gt);return t?t[1].toLowerCase():""})(e);return t in vt&&""!==yt.canPlayType(vt[t])},bt=()=>"function"==typeof window.webkitAudioContext||"function"==typeof window.AudioContext,kt=e=>new Promise((t,n)=>{const i=new Audio(e);i.onloadeddata=()=>{t(i)},i.onerror=n}),xt=e=>{const t=e.play();return(n=t)&&"function"==typeof n.then?t:Promise.resolve();var n},St=()=>bt()?(()=>{const e=ht(),t=Ce(t=>{const n=e.preload(t);return n.catch(we),n});return{play:n=>{const i=t(n).then(e.playSound);return i.catch(we),i},preload:t,unlock:()=>e.unlock()}})():(()=>{const e=Ce(kt);return{play:t=>e(t).then(xt),preload:e,unlock:()=>Promise.resolve()}})(),zt=e=>{const t=St(),n=(e=>Object.keys(e).reduce((t,n)=>{const i=_(e=>wt(e),O(e[n]));return t[n]=i,t},{}))(e);return{play:e=>{const i=n[e];t.play(i).then(we,we)},preload:e=>{const i=n[e];t.preload(i).then(we,we)},unlock:()=>t.unlock()}},Et=()=>{const e=zt({new_message:["https://cdn.livechatinc.com/widget/static/media/new_message.CTorF0S8.ogg","https://cdn.livechatinc.com/widget/static/media/new_message.C32z5SiC.mp3"]});return e.unlock().then(()=>function(e,t){let n=0;return function(){const i=Date.now();i-n>=e&&(n=Date.now(),t(...arguments))}}(2e3,t=>{e.play(t)}))};var It={exports:{}},_t={},Ct=be,Ft=ke;function At(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;nQt;Qt++)Kt[Qt]=Qt+1;Kt[15]=0;var en=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,tn=Object.prototype.hasOwnProperty,nn={},rn={};function on(e){return!!tn.call(rn,e)||!tn.call(nn,e)&&(en.test(e)?rn[e]=!0:(nn[e]=!0,!1))}function an(e,t,n,i,r,o,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var sn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){sn[e]=new an(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];sn[t]=new an(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){sn[e]=new an(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){sn[e]=new an(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){sn[e]=new an(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){sn[e]=new an(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){sn[e]=new an(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){sn[e]=new an(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){sn[e]=new an(e,5,!1,e.toLowerCase(),null,!1,!1)}));var ln=/[\-:]([a-z])/g;function cn(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(ln,cn);sn[t]=new an(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(ln,cn);sn[t]=new an(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(ln,cn);sn[t]=new an(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){sn[e]=new an(e,1,!1,e.toLowerCase(),null,!1,!1)})),sn.xlinkHref=new an("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){sn[e]=new an(e,1,!1,e.toLowerCase(),null,!0,!0)}));var un=/["'&<>]/;function dn(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=un.exec(e);if(t){var n,i="",r=0;for(n=t.index;nt}return!1}(e,t,i)?"":null!==i?(e=i.attributeName,3===(n=i.type)||4===n&&!0===t?e+'=""':(i.sanitizeURL&&(t=""+t),e+'="'+dn(t)+'"')):on(e)?e+'="'+dn(t)+'"':""}var fn="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},mn=null,hn=null,gn=null,yn=!1,vn=!1,wn=null,bn=0;function kn(){if(null===mn)throw Error(At(321));return mn}function xn(){if(0bn))throw Error(At(301));if(e===mn)if(vn=!0,e={action:n,next:null},null===wn&&(wn=new Map),void 0===(n=wn.get(t)))wn.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}}function An(){}var Pn=null,Tn={readContext:function(e){var t=Pn.threadID;return Xt(e,t),e[t]},useContext:function(e){kn();var t=Pn.threadID;return Xt(e,t),e[t]},useMemo:Cn,useReducer:_n,useRef:function(e){mn=kn();var t=(gn=Sn()).memoizedState;return null===t?(e={current:e},gn.memoizedState=e):t},useState:function(e){return _n(In,e)},useLayoutEffect:function(){},useCallback:function(e,t){return Cn((function(){return e}),t)},useImperativeHandle:An,useEffect:An,useDebugValue:An,useDeferredValue:function(e){return kn(),e},useTransition:function(){return kn(),[function(e){e()},!1]},useOpaqueIdentifier:function(){return(Pn.identifierPrefix||"")+"R:"+(Pn.uniqueID++).toString(36)},useMutableSource:function(e,t){return kn(),t(e._source)}},On="http://www.w3.org/1999/xhtml";var Mn={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Dn=Ct({menuitem:!0},Mn),Nn={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ln=["Webkit","ms","Moz","O"];Object.keys(Nn).forEach((function(e){Ln.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Nn[t]=Nn[e]}))}));var Vn=/([A-Z])/g,Rn=/^ms-/,Wn=Ft.Children.toArray,jn=Yt.ReactCurrentDispatcher,qn={listing:!0,pre:!0,textarea:!0},Gn=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Un={},Hn={};var Bn=Object.prototype.hasOwnProperty,$n={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null};function Zn(e,t){if(void 0===e)throw Error(At(152,Zt(t)||"Component"))}function Yn(e,t,n){function i(i,r){var o=r.prototype&&r.prototype.isReactComponent,a=function(e,t,n,i){if(i&&("object"==typeof(i=e.contextType)&&null!==i))return Xt(i,n),i[n];if(e=e.contextTypes){for(var r in n={},e)n[r]=t[r];t=n}else t=Jt;return t}(r,t,n,o),s=[],l=!1,c={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===s)return null},enqueueReplaceState:function(e,t){l=!0,s=[t]},enqueueSetState:function(e,t){if(null===s)return null;s.push(t)}};if(o){if(o=new r(i.props,a,c),"function"==typeof r.getDerivedStateFromProps){var u=r.getDerivedStateFromProps.call(null,i.props,o.state);null!=u&&(o.state=Ct({},o.state,u))}}else if(mn={},o=r(i.props,a,c),null==(o=zn(r,i.props,o,a))||null==o.render)return void Zn(e=o,r);if(o.props=i.props,o.context=a,o.updater=c,void 0===(c=o.state)&&(o.state=c=null),"function"==typeof o.UNSAFE_componentWillMount||"function"==typeof o.componentWillMount)if("function"==typeof o.componentWillMount&&"function"!=typeof r.getDerivedStateFromProps&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&"function"!=typeof r.getDerivedStateFromProps&&o.UNSAFE_componentWillMount(),s.length){c=s;var d=l;if(s=null,l=!1,d&&1===c.length)o.state=c[0];else{u=d?c[0]:o.state;var p=!0;for(d=d?1:0;d=o))throw Error(At(304));var a=new Uint16Array(o);for(a.set(r),(Kt=a)[0]=i+1,r=i;r=a.children.length){var s=a.footer;if(""!==s&&(this.previousWasTextNode=!1),this.stack.pop(),"select"===a.type)this.currentSelectValue=null;else if(null!=a.type&&null!=a.type.type&&a.type.type.$$typeof===Dt)this.popProvider(a.type);else if(a.type===Vt){this.suspenseDepth--;var l=i.pop();if(r){r=!1;var c=a.fallbackFrame;if(!c)throw Error(At(303));this.stack.push(c),i[this.suspenseDepth]+="\x3c!--$!--\x3e";continue}i[this.suspenseDepth]+=l}i[this.suspenseDepth]+=s}else{var u=a.children[a.childIndex++],d="";try{d+=this.render(u,a.context,a.domNamespace)}catch(p){if(null!=p&&"function"==typeof p.then)throw Error(At(294));throw p}i.length<=this.suspenseDepth&&i.push(""),i[this.suspenseDepth]+=d}}return i[0]}finally{jn.current=n,Pn=t,En()}},t.render=function(e,t,n){if("string"==typeof e||"number"==typeof e)return""===(n=""+e)?"":this.makeStaticMarkup?dn(n):this.previousWasTextNode?"\x3c!-- --\x3e"+dn(n):(this.previousWasTextNode=!0,dn(n));if(e=(t=Yn(e,t,this.threadID)).child,t=t.context,null===e||!1===e)return"";if(!Ft.isValidElement(e)){if(null!=e&&null!=e.$$typeof){if((n=e.$$typeof)===Pt)throw Error(At(257));throw Error(At(258,n.toString()))}return e=Wn(e),this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),""}var i=e.type;if("string"==typeof i)return this.renderDOM(e,t,n);switch(i){case Bt:case Ht:case Ot:case Mt:case Rt:case Tt:return e=Wn(e.props.children),this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),"";case Vt:throw Error(At(294));case Ut:throw Error(At(343))}if("object"==typeof i&&null!==i)switch(i.$$typeof){case Lt:mn={};var r=i.render(e.props,e.ref);return r=zn(i.render,e.props,r,e.ref),r=Wn(r),this.stack.push({type:null,domNamespace:n,children:r,childIndex:0,context:t,footer:""}),"";case Wt:return e=[Ft.createElement(i.type,Ct({ref:e.ref},e.props))],this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),"";case Dt:return n={type:e,domNamespace:n,children:i=Wn(e.props.children),childIndex:0,context:t,footer:""},this.pushProvider(e),this.stack.push(n),"";case Nt:i=e.type,r=e.props;var o=this.threadID;return Xt(i,o),i=Wn(r.children(i[o])),this.stack.push({type:e,domNamespace:n,children:i,childIndex:0,context:t,footer:""}),"";case Gt:throw Error(At(338));case jt:return i=(r=(i=e.type)._init)(i._payload),e=[Ft.createElement(i,Ct({ref:e.ref},e.props))],this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),""}throw Error(At(130,null==i?i:typeof i,""))},t.renderDOM=function(e,t,n){var i=e.type.toLowerCase();if(!Un.hasOwnProperty(i)){if(!Gn.test(i))throw Error(At(65,i));Un[i]=!0}var r=e.props;if("input"===i)r=Ct({type:void 0},r,{defaultChecked:void 0,defaultValue:void 0,value:null!=r.value?r.value:r.defaultValue,checked:null!=r.checked?r.checked:r.defaultChecked});else if("textarea"===i){var o=r.value;if(null==o){o=r.defaultValue;var a=r.children;if(null!=a){if(null!=o)throw Error(At(92));if(Array.isArray(a)){if(!(1>=a.length))throw Error(At(93));a=a[0]}o=""+a}null==o&&(o="")}r=Ct({},r,{value:void 0,children:""+o})}else if("select"===i)this.currentSelectValue=null!=r.value?r.value:r.defaultValue,r=Ct({},r,{value:void 0});else if("option"===i){a=this.currentSelectValue;var s=function(e){if(null==e)return e;var t="";return Ft.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(r.children);if(null!=a){var l=null!=r.value?r.value+"":s;if(o=!1,Array.isArray(a)){for(var c=0;c":(v+=">",o="");e:{if(null!=(a=r.dangerouslySetInnerHTML)){if(null!=a.__html){a=a.__html;break e}}else if("string"==typeof(a=r.children)||"number"==typeof a){a=dn(a);break e}a=null}return null!=a?(r=[],qn.hasOwnProperty(i)&&"\n"===a.charAt(0)&&(v+="\n"),v+=a):r=Wn(r.children),e=e.type,n=null==n||"http://www.w3.org/1999/xhtml"===n?function(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}(e):"http://www.w3.org/2000/svg"===n&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":n,this.stack.push({domNamespace:n,type:i,children:r,childIndex:0,context:t,footer:o}),this.previousWasTextNode=!1,v},e}();_t.renderToNodeStream=function(){throw Error(At(207))},_t.renderToStaticMarkup=function(e,t){e=new Jn(e,!0,t);try{return e.read(1/0)}finally{e.destroy()}},_t.renderToStaticNodeStream=function(){throw Error(At(208))},_t.renderToString=function(e,t){e=new Jn(e,!1,t);try{return e.read(1/0)}finally{e.destroy()}},_t.version="17.0.2",It.exports=_t;var Xn=It.exports,Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});var Qn=function(e){return function(t){for(var n,i=new RegExp(e.key+"-([a-zA-Z0-9-_]+)","gm"),r={html:t,ids:[],css:""},o={};null!==(n=i.exec(t));)void 0===o[n[1]]&&(o[n[1]]=!0);return r.ids=Object.keys(e.inserted).filter((function(t){if((void 0!==o[t]||void 0===e.registered[e.key+"-"+t])&&!0!==e.inserted[t])return r.css+=e.inserted[t],!0})),r}},ei=function(e){return function(t){for(var n,i=new RegExp(e.key+"-([a-zA-Z0-9-_]+)","gm"),r={html:t,styles:[]},o={};null!==(n=i.exec(t));)void 0===o[n[1]]&&(o[n[1]]=!0);var a=[],s="";return Object.keys(e.inserted).forEach((function(t){void 0===o[t]&&void 0!==e.registered[e.key+"-"+t]||!0===e.inserted[t]||(e.registered[e.key+"-"+t]?(a.push(t),s+=e.inserted[t]):r.styles.push({key:e.key+"-global",ids:[t],css:e.inserted[t]}))})),r.styles.push({key:e.key,ids:a,css:s}),r}};function ti(e,t,n,i){return'"}var ni=function(e,t){return function(n){var i=e.inserted,r=e.key,o=e.registered,a=new RegExp("<|"+r+"-([a-zA-Z0-9-_]+)","gm"),s={},l="",c="",u="";for(var d in i)if(i.hasOwnProperty(d)){var p=i[d];!0!==p&&void 0===o[r+"-"+d]&&(u+=p,c+=" "+d)}""!==u&&(l=ti(r,c.substring(1),u,t));for(var f,m="",h="",g=0;null!==(f=a.exec(n));)if("<"!==f[0]){var y=f[1],v=i[y];!0===v||void 0===v||s[y]||(s[y]=!0,h+=v,m+=" "+y)}else""!==m&&(l+=ti(r,m.substring(1),h,t),m="",h=""),l+=n.substring(g,f.index),g=f.index;return l+=n.substring(g)}},ii=function(e,t){return function(e){var n="";return e.styles.forEach((function(e){n+=ti(e.key,e.ids.join(" "),e.css,t)})),n}};var ri=Kn.default=function(e){!0!==e.compat&&(e.compat=!0);var t=void 0!==e.nonce?' nonce="'+e.nonce+'"':"";return{extractCritical:Qn(e),extractCriticalToChunks:ei(e),renderStylesToString:ni(e,t),constructStyleTagsFromChunks:ii(0,t)}};const oi=console.error,ai=Fe({key:"css"}),si=ri(ai),li=ai.insert;function ci(e,t){Ae(),Te.static=!0,console.error=function(){for(var e=arguments.length,t=new Array(e),n=0;n"string"==typeof e&&e.includes("useLayoutEffect"))||oi.apply(void 0,t)};const n=Xn.renderToString(ke.createElement(Pe,{value:ai},e)),i=si.constructStyleTagsFromChunks(si.extractCriticalToChunks(n));Te.static=!1,console.error=oi;return["\n\t\t"+(t?"":"")+"\n\t\t"+i+"\n\t",n]}function ui(e,n,i,r,o,a){let{adapterOptions:s,props:{onError:l=we,...c},onBootstrap:d=we}=n;Promise.resolve().then(()=>{o({...s,model:r?r.model:{}},e,i,a);const n=i=>{let{readyState:o}=i;if(o===M)return;window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_sdk_ready"),e.off("set_application_state",n),e.getApplicationState("embedded")||(e=>{t(u(e,()=>e.localize("welcome_title")),ve(e=>{document.title=e}))})(e),e.getApplicationState("embedded")&&!bt()||(e=>{let t=!1;e.on("bridge_sound_unlocked",()=>t=!0),Et().then(n=>{t||(e.emit("iframe_sound_unlocked"),e.on("add_event",t=>{let{event:i}=t;const{muted:r}=e.getApplicationState();if(r)return;((e,t)=>"system"!==e.author&&!e.properties.welcomeMessage&&e.author!==t&&"custom"!==e.type)(i,e.getSessionUserId())&&n("new_message")}),e.on("reaction_received",t=>{let{event:i}=t;const{muted:r}=e.getApplicationState();if(r)return;e.getSessionUserId()===i.author&&n("new_message")}))})})(e),D(e),nt(e),pt(e,r);const a=document.getElementById("root");Oe(a,{...c,onError:(e,t)=>{let{componentStack:n}=t;A("react_error",e,{componentStack:n}),xe.render(null,a),l()},store:e},r,ci),window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_bootstrap_end"),d(e)};e.on("set_application_state",n)})}ai.insert=(e,t)=>{let n="";li(e,t,{insert(e){n+=e}},!0),ai.inserted[t.name]=n};const di=(e,t,n)=>{const{organizationId:i}=t,{license:r,group:o,requestedGroup:a,pipMode:s}=e,{language:l}=t.__unsafeProperties.group,c=Ne({application:{organizationId:i,license:r,group:o,requestedGroup:a,region:t.region,rtl:Le(l),language:l,embedded:!1,mobileWrapper:v(),pipMode:s,page:{title:document.title,url:String(document.location),referrer:document.referrer}}},{persistKey:n({...e,organizationId:i})}),{clientLimitExceededLifted:u}=c.getApplicationState(),d=!u&&t.clientLimitExceeded;return c.setApplicationState({visibility:{...c.getApplicationState("visibility"),state:"maximized"},clientLimitExceeded:d}),c.updateUser(c.getSessionUserId(),(()=>{const e=ce(window.location.search),t=q(["name","email"],e);return e.params&&(t.properties=F(e=>String(e),ue(e.params))),t})()),e.initialView&&!c.getCurrentView()&&c.setCurrentView(e.initialView),c};function pi(e,t,n){window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_config_request");const{license:i,organizationId:r,group:o,adapter:a}=e;var s;(s={licenseId:i,organizationId:r,groupId:o,url:Me(String(document.location)),channelType:"direct_link"},R(s).then(e=>W({...s,region:e}).then(e=>{const t=e.groupId;return Promise.all([e,j({organizationId:e.organizationId,licenseId:s.licenseId,groupId:t,region:e.region,version:e.configVersion})]).then(e=>{let[t,n]=e;return{...t,...n}})}))).then(r=>{window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_server_config");const s=r.groupId,l=r.region,c=r.organizationId;De(r.__unsafeProperties.group.language);const u=di({...e,group:s,requestedGroup:o},r,n);N({organizationId:c,licenseId:i,region:l,groupId:s,version:r.localizationVersion,language:r.__unsafeProperties.group.language}).then(u.setLocalization);const d={adapterOptions:{...e,organizationId:c,group:s,requestedGroup:o,region:l,mobile:L()},props:{},onBootstrap:t};V()&&(d.props.onMinimizeButtonPress=()=>u.emit("mobile_wrapper_minimize_intent")),ui(u,d,r,null,a,i)})} /** @livechat/postmate - A powerful, simple, promise-based postMessage library @version v3.0.4 @link https://github.com/dollarshaveclub/postmate @author Jacob Kelley @license MIT **/var fi="application/x-postmate-v1+json",mi=0,hi={handshake:1,"handshake-reply":1,call:1,emit:1,reply:1,request:1},gi=function(e,t){return("string"!=typeof t||e.origin===t)&&(!!e.data&&("object"==typeof e.data&&("postmate"in e.data&&(e.data.type===fi&&!!hi[e.data.postmate]))))},yi=function(){function e(e){var t=this;this.parent=e.parent,this.frame=e.frame,this.child=e.child,this.childOrigin=e.childOrigin,this.events={},this.listener=function(e){if(!gi(e,t.childOrigin))return!1;var n=((e||{}).data||{}).value||{},i=n.data,r=n.name;"emit"===e.data.postmate&&r in t.events&&t.events[r].call(t,i)},this.parent.addEventListener("message",this.listener,!1)}var t=e.prototype;return t.get=function(e){var t=this;return new wi.Promise((function(n){var i=++mi;t.parent.addEventListener("message",(function e(r){r.data.uid===i&&"reply"===r.data.postmate&&(t.parent.removeEventListener("message",e,!1),n(r.data.value))}),!1),t.child.postMessage({postmate:"request",type:fi,property:e,uid:i},t.childOrigin)}))},t.call=function(e,t){this.child.postMessage({postmate:"call",type:fi,property:e,data:t},this.childOrigin)},t.on=function(e,t){this.events[e]=t},t.destroy=function(){window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame)},e}(),vi=function(){function e(e){var t=this;this.model=e.model,this.parent=e.parent,this.parentOrigin=e.parentOrigin,this.child=e.child,this.child.addEventListener("message",(function(e){if(gi(e,t.parentOrigin)){var n=e.data,i=n.property,r=n.uid,o=n.data;"call"!==e.data.postmate?function(e,t){var n="function"==typeof e[t]?e[t]():e[t];return wi.Promise.resolve(n)}(t.model,i).then((function(t){return e.source.postMessage({property:i,postmate:"reply",type:fi,uid:r,value:t},e.origin)})):i in t.model&&"function"==typeof t.model[i]&&t.model[i].call(t,o)}}))}return e.prototype.emit=function(e,t){this.parent.postMessage({postmate:"emit",type:fi,value:{name:e,data:t}},this.parentOrigin)},e}(),wi=function(){function e(e){var t=e.container,n=void 0===t?void 0!==n?n:document.body:t,i=e.model,r=e.url,o=e.iframeAllowedProperties;return this.parent=window,this.frame=document.createElement("iframe"),o&&(this.frame.allow=o),n.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=i||{},this.sendHandshake(r)}return e.prototype.sendHandshake=function(t){var n,i=this,r=function(e){var t=document.createElement("a");t.href=e;var n=t.protocol.length>4?t.protocol:window.location.protocol,i=t.host.length?"80"===t.port||"443"===t.port?t.hostname:t.host:window.location.host;return t.origin||n+"//"+i}(t),o=0;return new e.Promise((function(e,a){i.parent.addEventListener("message",(function t(o){return!!gi(o,r)&&("handshake-reply"===o.data.postmate?(clearInterval(n),i.parent.removeEventListener("message",t,!1),i.childOrigin=o.origin,e(new yi(i))):a("Failed handshake"))}),!1);var s=function(){o++,i.child.postMessage({postmate:"handshake",type:fi,model:i.model},r),5===o&&clearInterval(n)},l=function(){s(),n=setInterval(s,500)};i.frame.attachEvent?i.frame.attachEvent("onload",l):i.frame.addEventListener("load",l),i.frame.src=t}))},e}();wi.debug=!1,wi.Promise=function(){try{return window?window.Promise:Promise}catch(e){return null}}(),wi.Model=function(){function e(e){return this.child=window,this.model=e,this.parent=this.child.parent,this.sendHandshakeReply()}return e.prototype.sendHandshakeReply=function(){var e=this;return new wi.Promise((function(t,n){e.child.addEventListener("message",(function i(r){if(r.data.postmate){if("handshake"===r.data.postmate){e.child.removeEventListener("message",i,!1),r.source.postMessage({postmate:"handshake-reply",type:fi},r.origin),e.parentOrigin=r.origin;var o=r.data.model;return o&&Object.keys(o).forEach((function(t){e.model[t]=o[t]})),t(new vi(e))}return n("Handshake Reply Failed")}}),!1)}))},e}();const bi=wi.Model;wi.Model=function(){return function(e){const t=Se(),n={};return e.resolveRemoteCall=e=>{let{id:t,value:i}=e;const r=n[t];delete n[t],r(i)},e.emitEvent=e=>{let{event:n,data:i}=e;t.emit(n,i)},new bi(e).then(i=>(i.call=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),o=1;o{const o=G(n);n[o]=t,i.emit("remote-call",{id:o,method:e,args:r})})},e.remoteCall=t=>{let{id:n,method:r,args:o}=t;const a="function"==typeof e[r]?e[r].apply(i,o):void 0;a&&"function"==typeof a.then?a.then(e=>{i.call("resolveRemoteCall",{id:n,value:e})}):i.call("resolveRemoteCall",{id:n,value:a})},i.on=t.on,i.off=t.off,i))}}();const ki={minimizedContainerSize:void 0,minimizedVisibility:void 0,maximizedVisibility:void 0,viewAnimated:void 0,viewNotAnimated:void 0,resizeToDimensions:void 0},xi={bar:{width:"281px",height:"63px"},bubble:{width:"84px",height:"84px"},bubblePulse:{width:"90px",height:"90px"},mobileGreetingFull:{width:"100%",height:"50%"},full:{width:"100%",height:"100%"},...U},Si=e=>/px$/.test(e)?Math.ceil(parseFloat(e))+"px":e,zi=e=>u(e,e=>e.application.visibility.state),Ei=e=>{const t=ki[e];t&&clearTimeout(t)},Ii=(e,t)=>e.call("resize",(e=>({...e,width:Si(e.width),height:Si(e.height)}))(t)),_i=(e,t)=>e.call("getMinimizedDimensions").then(n=>{"minimized"===t.getApplicationState().visibility.state&&Ii(e,{...n,ignoreHorizontalOffset:t.getApplicationState("mobile")})}),Ci=(e,t,n)=>{let{transient:i}=n;Ei("minimizedContainerSize"),Ei("resizeToDimensions");const r=t.getApplicationState("mobile"),o=n=>{Ii(e,n).then(()=>_i(e,t))};if(H(t,"maximized"))return void Ii(e,r?{...xi.full,maximized:!0}:{...Ve(t.getApplicationState().config.theme.name),maximized:!0});const a="bar"===y(t),s=!B(t),l=t.getApplicationState().config.theme.name,c=t.getApplicationState().defaultWidget,u=t.getView("minimized"),d=t.getApplicationState().recommendations,p=()=>{var n,i,p,f,m;return(e=>{let{isBar:t,isMobile:n,isBubblePulse:i,hasGreeting:r,hasMinimizedEvents:o,productRecommendationsState:a,themeName:s,callResize:l,resizeMinimizedWithGreeting:c,getWindowSizeForTheme:u,dimensions:d,defaultWidget:p,resizeToDimensions:f}=e;if("livechat"===p&&(n?r?c(d.mobileGreetingFull):l(t?d.bar:d.bubble):t?l(d.bar):r?c(u(s)):l(d.bubble)),"openwidget"===p){if(a.isVisible||a.animation)return a.animation?void l({...n?d.mobileRecommendations:d.recommendations,ignoreHorizontalOffset:n}):void f();if(i)return void l(d.bubblePulse);if(r)return n?void c(d.mobileGreetingFull):void c(u(s));o||l(d.bubble)}})({isBar:a,isMobile:r,hasGreeting:s,isBubblePulse:u.showPulseAnimation,hasMinimizedEvents:!!(null!=(n=t.getApplicationState("visitorCounter"))&&n.isVisible||null!=(i=t.getApplicationState("googleReviews"))&&i.isVisible||null!=(p=t.getApplicationState("chatBotGreeting"))&&p.isVisible||null!=(f=t.getApplicationState("contactInvitation"))&&f.isVisible),productRecommendationsState:{isVisible:!(null==d||!d.isVisible),animation:null!=(m=null==d?void 0:d.animation)?m:null},themeName:l,dimensions:xi,resizeMinimizedWithGreeting:o,getWindowSizeForTheme:Ve,defaultWidget:c,callResize:t=>Ii(e,t),resizeToDimensions:()=>_i(e,t)})};i?ki.minimizedContainerSize=setTimeout(p,300):p()},Fi=(e,t,n)=>{let{transient:i}=n;if(Ei("minimizedVisibility"),Ei("maximizedVisibility"),H(t,"maximized"))e.call("applyFramesStyle",{minimizedFrameStyle:{display:"none"},maximizedFrameStyle:{display:"block"}}),$()&&(ki.maximizedVisibility=setTimeout(()=>{e.call("applyFramesStyle",{minimizedFrameStyle:{},maximizedFrameStyle:{visibility:"visible"}})},Z));else{const t=()=>{e.call("applyFramesStyle",{minimizedFrameStyle:{display:"block"},maximizedFrameStyle:{display:"none",...$()&&{visibility:"hidden"}}})};i?ki.minimizedVisibility=setTimeout(t,300):t()}},Ai={faq:"FAQ","form-contact":"Form-contact","form-feedback":"Form-feedback","form-bugreport":"Form-bugreport",chat:"Chat"},Pi=(e,n,i)=>{e.hasChat(n)?J(e,n,i):t(u(e,e=>X(e,n)),ve(t=>t&&J(e,n,i)))},Ti=(e,t)=>{const n=e.getApplicationState("defaultWidget"),i="openwidget"===n,r=((e,t)=>{if("chatbot"===t)throw new Error('Widget type "chatbot" is not supported.');const n="openwidget"===t,i="object"==typeof e&&null!==e?e:{},r=n?["feature","messageDraft"]:["messageDraft"];for(const a in i)if(!r.includes(a)){throw new Error((n?"OpenWidget:":"[LivechatWidget]")+" You cannot combine "+a+' argument with "maximize" method. You can only use: '+r.join(", "))}const o="messageDraft"in i&&"string"==typeof i.messageDraft?i.messageDraft:void 0;if(n){return{feature:"feature"in i&&"string"==typeof i.feature?i.feature:void 0,messageDraft:o}}return{messageDraft:o}})(t,n);i?((e,t)=>{var n;const{feature:i,messageDraft:r}=t;if(!i)return;if("string"!=typeof i)throw new Error("OpenWidget: Feature name must be a string.");const o=Ai[i];if(!o)throw new Error("OpenWidget: You cannot combine "+i+" feature with 'maximize' method. You can only use: "+Object.keys(Ai).join(", ")+".");const a=e.getApplicationState("config").features,s=Ge(a),l=null==(n=a.livechatIntegration)?void 0:n.enabled,c=l||s,u="Chat"===o;if(!e.getView(o)||u&&!c)throw new Error("OpenWidget: Feature "+i+" is not enabled.");if(u&&r){Pi(e,l?p:K,r)}e.setCurrentView(o)})(e,r):((e,t)=>{const{messageDraft:n}=t;n&&("Chat"!==e.getCurrentView()&&e.setCurrentView("Chat"),Pi(e,p,n))})(e,r)};const Oi=(e,t,n,i)=>{const r=e.getApplicationState("visibility");return i&&"maximized"!==r.state?{state:"hidden",forced:!0}:n?{state:"maximized"}:t?i?{state:"hidden",forced:!0}:{state:"minimized"}:r};function Mi(e,n,r){const{license:o,organizationId:a,group:s,uniqueGroups:l,isIdentityProviderEnabled:c,shouldUseParentStorage:d,adapter:f}=e,m=Ne({application:{organizationId:a,...o?{license:o}:{},group:s}},{persistKey:r(e)}),h=function(e){return{hide(){H(e,"hidden")||e.setApplicationState({visibility:{state:"hidden",forced:!0}})},hideGreeting(){Q(e)},hideEyeCatcher(){ee(e)},isFocused:()=>!!document.hasFocus&&document.hasFocus(),maximize(t,n){try{Ti(e,n)}catch(a){return void console.error(a.message)}const i=t&&te(t,["click","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend"]),r=e.getApplicationState("visibility").interactionModality,o=i?r:"virtual";e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:"maximized",interactionModality:o}})},minimize(){e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:!e.getApplicationState("isMinimizedForcefullyDisabled")&&ne(e)?"minimized":"hidden",interactionModality:"virtual"}})},startStateSync(){e.startStateSync(this)},storeMethod(t){let[n,...i]=t;e[n].apply(e,i)},logInfo(){ie.apply(void 0,arguments)},logError(){A.apply(void 0,arguments)},logNotice(){re.apply(void 0,arguments)},crossFrameEvent(e,t){We(e,{...JSON.parse(t),stopPropagation:we,preventDefault:we})},setInteractionModality(t){e.setApplicationState({visibility:{...e.getApplicationState("visibility"),interactionModality:t}})},setPipConsent(t){e.setApplicationState({pipConsent:t})}}}(m);new wi.Model(h).then(e=>Promise.all([e,m.syncing()])).then(e=>{let[r]=e;window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_postmate_ready");const{clientLimitExceeded:a,customer:h,requestedGroup:g,hidden:y,integrationName:v,isInCustomContainer:w,page:b,region:k,serverConfig:x,actingAsDirectLink:S,isMinimizedForcefullyDisabled:z,initMaximized:E,parentWidth:I,parentHeight:_,defaultWidget:C}=r.model,F=m.getApplicationState("mobile"),A="livechat"===C?x.__unsafeProperties.group.language:x.language,P=S||w||E,{organizationId:T}=x;De(A),m.updateUser(m.getSessionUserId(),h),m.setApplicationState({organizationId:T,clientLimitExceeded:!m.getApplicationState("clientLimitExceededLifted")&&a,actingAsDirectLink:S,isMinimizedForcefullyDisabled:z,embedded:!0,region:k,isInCustomContainer:w,mobileWrapper:null,page:b,rtl:Le(A),language:A,integrationName:v,requestedGroup:g,visibility:Oi(m,F,P,y),clientWidth:I,clientHeight:_,defaultWidget:C});const O={onAnimationEnd:()=>m.emit("animation_end"),onError:()=>{r.call("kill")},onMinimizedRef:e=>{r.minimizedRef=e}};ui(m,{adapterOptions:{organizationId:T,group:s,requestedGroup:g,region:k,uniqueGroups:l,mobile:L(),...c&&{identityProvider:()=>({getToken:()=>r.call("callIdentityProvider","getToken"),getFreshToken:()=>r.call("callIdentityProvider","getFreshToken"),hasToken:()=>r.call("callIdentityProvider","hasToken"),invalidate:()=>r.call("callIdentityProvider","invalidate")})},...d&&{parentStorage:{setItem:(e,t)=>r.call("callParentStorageMethod","setItem",e,t),getItem:e=>r.call("callParentStorageMethod","getItem",e),removeItem:e=>r.call("callParentStorageMethod","removeItem",e)}}},props:O,onBootstrap:()=>{je(r,m);const{visibility:e}=m.getApplicationState();(P||"hidden"!==e.state)&&r.call("show"),((e,n)=>{t(zi(n),i(null),Re,ge(e=>{let[t,n]=e;return"maximized"===t&&"minimized"===n}),ve(()=>{Ei("viewNotAnimated");const t=e=>{n.updateView("minimized",{...n.getView("minimized"),animated:e}),n.emit("render-minimized")};t(!0);const{interactionModality:i}=n.getApplicationState("visibility");ki.viewNotAnimated=setTimeout(()=>{t(!1),"keyboard"===i&&e.call("focusMinimized")},500)})),t(zi(n),Be(1),ve(()=>Fi(e,n,{transient:!0}))),t(u(n,e=>e.application.ready),Be(1),ge(Boolean),ve(()=>requestAnimationFrame(()=>Fi(e,n,{transient:!0})))),Fi(e,n,{transient:!1})})(r,m),((e,n)=>{t(zi(n),Be(1),ve(()=>Ci(e,n,{transient:!0}))),t(u(n,e=>e.application.invitation.hiddenIds.length),Be(1),ve(()=>Ci(e,n,{transient:!0}))),n.on("render-minimized",()=>Ci(e,n,{transient:!0})),e.on("minimized_frame_fonts_ready",()=>Ci(e,n,{transient:!1})),n.on("resize-request",t=>Ii(e,t).then(()=>n.emit("resize-request-done"))),n.on("resize-to-dimensions",()=>_i(e,n)),n.on("resize-to-theme-size",()=>{const t=n.getApplicationState().config.theme.name,i=n.getApplicationState("mobile");return Ii(e,{...i?xi.mobileGreetingFull:Ve(t),ignoreHorizontalOffset:i}).then(()=>n.emit("resize-to-theme-size-done"))}),Ci(e,n,{transient:!1})})(r,m),((e,n)=>{t(u(n,e=>Y(e,p)),ve(t=>{const i=null==t?void 0:t.author;if(i&&n.hasUser(i)){const t=n.getUser(i),r=n.localize("embedded_new_message",{operator:t.name});e.call("setTitleNotification",r)}else e.call("setTitleNotification",null)}))})(r,m),n(m)}},x,r,f,o)})}var Di,Ni;const Li=ce(window.location.search),Vi=oe(),Ri=null!=(Di=Li.organizationId)?Di:"",Wi=ae(Li),ji=w(),qi=null!=(Ni=Li.initial_view)?Ni:null,Gi="1"===(null==Li?void 0:Li.pip_mode),Ui="1"===Li.custom_identity_provider,Hi="1"===Li.use_parent_storage;if(!Vi&&!Ri)throw new Error("No license or organization found in the URL.");function Bi(e,t){const n={...Vi?{license:Vi}:{},organizationId:Ri,group:Wi,uniqueGroups:ji,isIdentityProviderEnabled:Ui,shouldUseParentStorage:Hi,initialView:qi,adapter:e,pipMode:Gi},i=st(),r=e=>{e.setApplicationState({readyState:se}),Ui&&ie("custom_identity_provider_enabled",{}),n.initialView&&!e.getCurrentView()&&e.setCurrentView(n.initialView),i&&i.getLogs().then(e=>{ie("iframe_vitals",ze({...e,isEmbedded:!!Li.embedded}))})};Li.embedded?Mi(n,r,t):pi(n,r,t)}export{Qe as c,Ye as e,et as h,Bi as i,Be as s,$e as t,Ke as v};