/*! * Leadoo bot * @copyright Leadoo - All rights reserved * @see https://leadoo.com */(()=>{var e,t,n,r,i={50:(e,t,n)=>{"use strict";n.d(t,{DS:()=>a,JW:()=>i,K9:()=>l,n:()=>o,nf:()=>s,vq:()=>c});var r=n(6124);function i(e){(0,r.HN)().getNativeMethod("document.body.appendChild")(e)}function o(e){return(0,r.HN)().getNativeMethod("document.createElement")(e)}function s(e,t,n){return(0,r.HN)().getNativePrototypeMethod(e,"insertBefore","window.Element.prototype.insertBefore")(t,n)}function a(e){const t=[];let n=e.parentNode;for(;n;)t.push(n),n=n.parentNode;return t}function l(e,t){return a(t).indexOf(e)>=0}function c(e){return e.nodeType===Node.ELEMENT_NODE}},259:(e,t,n)=>{"use strict";n.d(t,{o:()=>a,z:()=>s});var r=n(9443),i=n(471);const o=["Chat","CTA","Custom","InPage","Visual"];function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;if(!e[i.FZ])throw new Error(`No API found for name: ${i.FZ}`);return e[i.FZ]}function a(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;"object"==typeof t[i.FZ]&&t[i.FZ]?e=t[i.FZ]:(e={},(0,r.oq)(t,i.FZ,e)),o.forEach((t=>{e[t]||(0,r.oq)(e,t,{})}))}},329:(e,t,n)=>{"use strict";n.d(t,{y:()=>y});var r=n(8048),i=n(6430),o=n.n(i),s=n(3162),a=n(1981);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t{let{answer:t}=e;const n=t.map((e=>c(c({},e),{},{isLoaded:void 0})));return(0,s.h)(s.Fragment,null,n.map((e=>(0,s.h)(r.Hg,{key:e.attachmentID,file:e,deleteAlt:(0,a.t)("a11y.attachment.delete-icon-alt"),imageAlt:(0,a.t)("a11y.attachment.image-icon-alt"),fileAlt:(0,a.t)("a11y.attachment.file-icon-alt"),isAnswer:!0}))))};var h=n(3985);const p=e=>{let{answer:t,freeInput:n,answerAnimation:i,nodeId:o}=e;const a=t.map((e=>({text:e.text})));return(0,s.h)(s.Fragment,null,a.map(((e,t)=>(0,s.h)(r.vJ,{key:t,nodeId:`${o}-${t}`,timeout:.15*t,classNames:"ld-answer",animation:i,dataSettings:"bot-answer",isAnswer:!0},(0,s.h)(h.m,{text:e.text,freeInput:n})))))};var f=n(4912),m=n(2131);function g(e){let{text:t,freeInput:n,iconType:i}=e;return(0,s.h)("div",{className:"ld-answer-row"},i&&(0,s.h)(r.In,{className:"ld-answer-row-icon",name:m.XP[i],alt:(0,a.t)(m.Hj[i])}),(0,s.h)(h.m,{freeInput:n,text:t}))}const v=e=>{let{answer:t,freeInput:n}=e;const r=(0,f.useMemo)((()=>{if("string"==typeof t)return t.split(/\n/).map((e=>({text:e})));if(Array.isArray(t))return t.map((e=>{var t,n;return{text:Array.isArray(e.value)?null!==(t=null===(n=e.value[0])||void 0===n?void 0:n.text)&&void 0!==t?t:"":String(e.value),iconType:e.type}}));if("object"==typeof t&&!t.id){const e=[];return Object.keys(t).forEach((n=>{e.push({text:t[n],iconType:n})})),e}return[{text:t.text}]}),[t]);return r.length?(0,s.h)(s.Fragment,null,r.map(((e,t)=>(0,s.h)(g,{key:t,text:e.text,freeInput:n,iconType:e.iconType})))):(0,s.h)(g,{text:"-",freeInput:n})};function y(e){let{answer:t,nodeId:n,freeInput:i=!1,answerAnimation:l}=e;const c=Array.isArray(t)&&t.some((e=>Boolean(e.text))),u=Array.isArray(t)&&t.some((e=>Boolean(e.attachmentID)));return(0,s.h)("div",Object.assign({className:o()("answer-wrapper",{"answer-wrapper-multiple":c})},c?{role:"group"}:{}),(0,s.h)("span",{className:"visually-hidden"},(0,a.t)("a11y.own.sent-by")),c&&(0,s.h)(p,{answer:t,nodeId:n,freeInput:i,answerAnimation:l}),!c&&(0,s.h)(r.vJ,{classNames:"ld-answer",nodeId:n,animation:l,isAnswer:!0,dataSettings:"bot-answer"},u?(0,s.h)(d,{answer:t}):(0,s.h)(v,{answer:t,freeInput:i})))}},373:(e,t,n)=>{"use strict";function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;const t=[e.location.href,e.document.URL,e.document.referrer];if(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;try{return e.self!==e.top}catch(e){return!0}}(e)){const[n]=t.splice(2,1);t.unshift(n);try{e.top&&t.unshift(e.top.location.href)}catch(e){/DOMException/i.test(e.message)||console.error(e)}}return t.find((e=>e&&e.trim().length>0))||null}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return new Promise((t=>{const{document:n}=e;if(n.body)return t();const r=()=>{n.removeEventListener("DOMContentLoaded",r),n.removeEventListener("load",r),t()};n.addEventListener("DOMContentLoaded",r),n.addEventListener("load",r)}))}n.d(t,{_:()=>r,j:()=>i})},471:(e,t,n)=>{"use strict";n.d(t,{FZ:()=>h,GE:()=>d,Gt:()=>D,Ih:()=>b,L0:()=>C,Np:()=>N,OJ:()=>T,OL:()=>S,Pn:()=>$,RO:()=>k,RR:()=>p,RX:()=>x,S9:()=>_,Wl:()=>y,Wq:()=>o,Zg:()=>j,dJ:()=>E,ed:()=>u,eg:()=>R,i$:()=>O,iZ:()=>w,jy:()=>L,mv:()=>P,nR:()=>s,qE:()=>l,qF:()=>f,rR:()=>m,wW:()=>a,wg:()=>g,x3:()=>c,xK:()=>v,xx:()=>I,xy:()=>A,z4:()=>i});var r=n(7915);const i="ldapi",o="answer_submitted",s="bot_init",a="bot_restart",l="bot_triggered",c="cta_triggered",u="livechat_end",d="lead_verified",h="Leadoo",p=[r.TL.BubbleImageAnswers,r.TL.MessageAndAnswers,r.TL.IconAndAnswers,r.TL.CardAndAnswers,r.TL.ImageOrGIFAndAnswers],f=500,m=30,g=255,v=1023,y=127,b=32,_=64,w=128,x=2048,C=[r.sw.CheckGroup,r.sw.RadioGroup,r.sw.Dropdown],k=[r.xi.AdvancedCalculatorResult,r.xi.AdvancedRouterResult,r.xi.ApiCall,r.xi.CalculatorResult,r.xi.Say],S=1024,O=[r.xi.AdvancedCalculatorResult,r.xi.ApiCall,r.xi.Rating],j=[r.xi.AdvancedCalculatorResult,r.xi.ApiCall],P=[null,.25,.5,.75,1],E=[r.xi.BookingCalendar,r.xi.Calendar,r.xi.PhonePrompt],T=[r.xi.CustomForm,r.xi.CTAForm,r.xi.BookingCalendar],I=[r.xi.EmailPrompt,r.xi.CompanyPrompt,r.xi.PhonePrompt,r.xi.TextPrompt],N=1,A=2,L=["app","asp","aspx","bat","bin","cgi","chm","cmd","com","csh","dll","exe","htaccess","htpasswd","ins","isp","jar","js","jse","jsp","lnk","msi","php","pif","reg","scr","sct","sh","torrent","url","vb","vbe","vbs","vbscript","wsc","wsf","wsh"],D="anyone",R=[r.xi.SoftLiveChat],M="unset",$={width:M,height:M,top:M,left:M,right:M,bottom:M,zIndex:M,display:M,position:M,boxSizing:M,maxWidth:M,maxHeight:M,flex:M}},506:(e,t,n)=>{"use strict";n.d(t,{Gt:()=>l,_z:()=>c,xD:()=>a});var r=n(1856);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t{if(!1===r.U.includes(n.type))return;let i;try{i=await l(e,n)}catch(e){return void console.error(e)}t(i)};return e.on("message",n),()=>{e.off("message",n)}}async function l(e,t){var n;return o(o({},t),{},{text:null!==(n=t.text)&&void 0!==n?n:""})}async function c(e,t,n,r,i){const o={};"string"==typeof r&&(o.tag=r),Array.isArray(i)&&(o.attachments=i),await e.sendText(t,n,o)}},515:(e,t,n)=>{"use strict";n.d(t,{p:()=>_,h:()=>w});var r=n(3162),i=n(4912),o=n(868),s=n(9336),a=n(9844),l=n(725);function c(e,t){const{emitter:n}=(0,i.useContext)(l.d);(0,i.useEffect)((()=>(n.addListener(e,t),()=>{n.removeListener(e,t)})),[n,e,t])}var u=n(785),d=n(5822),h=n(3976),p=n(5235),f=n(3503),m=n(8753),g=n(5166),v=n(471),y=n(5468),b=n(7915);const _=(0,r.createContext)({});function w(e){const{active:t=!0,children:n,initialStateGetter:w=f.L7,reloadBot:x,destroyBot:C,skipStartDelay:k=!1}=e,S=(0,i.useMemo)(d.tU,[]),[O,j,P]=(0,u.i)(f.eT,w),{dispatch:E,state:T}=(0,i.useContext)(l.d),[I,N]=(0,i.useState)(!1),A=O.feedback.submited.includes(b.eU.BOT);(0,i.useEffect)((()=>{S.intentNextNo&&((async()=>{await(0,y.G)(!1,S.intentNextNo,j,E,S)})(),S.intentNextNo=null)}),[S.intentNextNo]);const L=(0,i.useCallback)((async(e,t,n,r)=>{if(S.mock)return;const{prompt:i}=P();if(!i||!i.question)throw new Error("Unable to submit answer: No prompt");const{question:o,answers:s,encryptionKey:l}=i;(0,h.Rm)(`submit answer (question=${o.id} type=${o.type})`);try{const i=await(0,g.V)(o.type);let c=!1,u=null;null!=i&&i.handleAnswer&&((0,a.Nw)(),u=await i.handleAnswer({answerNextNo:t,answers:s,answerValue:e,botGlobals:T.globals,dispatch:j,globals:S,question:o,setSubmitting:N,isIntentSession:n}),u===b.bf.Handled&&(c=!0)),c||await(0,y.p)(o,s,e,l,t,j,E,N,u,S,A,r)}catch(e){throw console.error(e),N(!1),(0,m.BZ)(e,j),(0,p.U)(e),e}}),[T.globals,j,P,S,A]),D=(0,i.useCallback)((()=>{(0,m.ni)(P,j,E,C).catch((e=>{console.error(e),(0,m.BZ)(e,j)}))}),[j,E,P,C,L]),R=(0,i.useCallback)((async()=>{if(!x)throw new Error("No bot flow reload specified");await x()}),[x]),M=(0,i.useRef)(!1);(0,i.useEffect)((()=>{t&&!M.current&&(M.current=!0,(async()=>{k||await(0,o.y)(700),D()})())}),[t,k,D]);const $=(0,i.useCallback)((()=>{j({type:f.Ud.Reload}),(0,s.P)(v.wW),S.refreshed=!0,D()}),[j,D]);c(b.we.Reload,$);const U=(0,i.useCallback)((()=>{j({type:f.Ud.Reload})}),[j]);return c(b.we.Destroy,U),(0,r.h)(_.Provider,{value:{dispatch:j,getState:P,start:D,reload:R,state:O,submitAnswer:L,setSubmitting:N,submitting:I}},n)}},564:(e,t,n)=>{"use strict";n.d(t,{A:()=>o,y:()=>s});var r=n(471),i=n(7915);function o(e){var t;return e.botType===i.YK.Visual?(null===(t=e.question)||void 0===t?void 0:t.type)!==i.xi.AdvancedRouterResult||e.question.text?r.i$:[...r.i$,i.xi.AdvancedRouterResult]:e.botType===i.YK.Chat?r.RO:[...r.RO,i.xi.Rating]}function s(e){var t;return e.botType===i.YK.Visual?(null===(t=e.question)||void 0===t?void 0:t.type)!==i.xi.AdvancedRouterResult||e.question.text?r.Zg:[...r.Zg,i.xi.AdvancedRouterResult]:e.botType===i.YK.Chat?r.RO:[...r.RO,i.xi.Rating]}},725:(e,t,n)=>{"use strict";n.d(t,{d:()=>l,v:()=>c});var r=n(4486),i=n(3162),o=n(4912),s=n(785),a=n(7659);n(7915);const l=(0,i.createContext)({});function c(e){const{children:t}=e,n=(0,o.useMemo)((()=>new r.default),[]),[c,u,d]=(0,s.i)(a.YM,a.gW);return(0,i.h)(l.Provider,{value:{dispatch:u,emitter:n,getState:d,state:c}},t)}},731:(e,t,n)=>{var r=n(7095),i=n(3048)(r);i.push([e.id,"#ld-bot-flow{position:fixed;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-end;flex-wrap:nowrap}#ld-bot-flow.ld-flow-left-aligned{align-items:flex-start}#ld-bot-flow.ld-flow-centered{align-items:center}#ld-bot-flow.ld-flow-hidden{visibility:hidden}#ld-bot-flow.ld-flow-horizontal{flex-direction:row;justify-content:flex-end}#ld-bot-flow.ld-flow-horizontal-left{flex-direction:row-reverse}#ld-bot-flow>*{flex:0 0 auto}",""]),e.exports=i},785:(e,t,n)=>{"use strict";n.d(t,{i:()=>i});var r=n(4912);function i(e,t){const n=(0,r.useMemo)(t,[]),i=(0,r.useRef)(n),o=(0,r.useCallback)((()=>i.current),[]),s=(0,r.useRef)(((t,n)=>(i.current=e(t,n),i.current))).current,[a,l]=(0,r.useReducer)(s,null,t);return[a,l,o]}},798:(e,t,n)=>{"use strict";n.d(t,{CN:()=>h,cl:()=>d,dz:()=>p,tl:()=>u,wh:()=>c});var r=n(4912),i=n(9747);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:null,{allow_empty:o=0}=e;const s=r?t.find((e=>e.id===r)):null;return s&&s.meta&&"object"==typeof s.meta&&(o="boolean"==typeof s.meta.required?s.meta.required?0:1:o),"dropdown"===n?t=>(0,i.Xd)((0,i.Oo)(e,{subType:n}),t,{allowEmpty:!!o}):"radioGroup"===n||"checkGroup"===n?t=>(0,i.xA)((0,i.Oo)(e,{subType:n}),t,{allowEmpty:!!o}):(0,i.iJ)(e,t,{allowEmptyOverride:!!o,subType:n})}function c(e,t){return t.reduce(((n,r)=>{var i,o;return s(s({},n),{},{[`${r.id}`]:l(e,t,null!==(i=null===(o=r.meta)||void 0===o?void 0:o.type)&&void 0!==i?i:null,r.id)})}),{})}function u(e){return d(e,[arguments.length>1&&void 0!==arguments[1]?arguments[1]:null],!1)[0]}function d(e,t,n){if(n&&t.some((e=>null===e)))throw new Error("Unable to output transformer hash when subTypes contains null");return(0,r.useMemo)(n?()=>t.reduce(((t,n)=>s(s({},t),{},{[n]:(0,i.$w)(e,{subType:n})})),{}):()=>t.map((t=>(0,i.$w)(e,{subType:t}))),[e,t])}function h(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const[r]=p(e,t,[n]);return r}function p(e,t,n){return(0,r.useMemo)((()=>n.map((n=>(0,i.iJ)(e,t,{subType:n})))),[e,n])}},854:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParallelChannel=void 0;const r=n(1419);class i extends r.Channel{constructor(e){super(e),this._parallelism=2,this._runningTasks=[],this.canRunAcrossTaskTypes=!1}get isEmpty(){return super.isEmpty&&this._runningTasks.length<=0}get parallelism(){return this._parallelism}get runningTasks(){return this._runningTasks}set parallelism(e){const t=Math.max(e,1);this._parallelism=t}_runNextItem(){const e=()=>{this.isRunning=!1,this.emit("stopped")};if(0===this.runningTasks.length&&0===this.tasks.length)return void e();let t=this.parallelism-this.runningTasks.length;if(!(t<=0))for(;t>0;){if(!this.canRunAcrossTaskTypes&&this.runningTasks.length>0&&this.tasks.length>0){if(this.runningTasks[0].type!==this.tasks[0].type)return}t-=1;const e=this.retrieveNextItem();if(!e)return;this.runningTasks.push(e),e.execute().then((()=>{this.runningTasks.splice(this.runningTasks.indexOf(e),1),this._runNextItem()}))}}}t.ParallelChannel=i},868:(e,t,n)=>{"use strict";function r(e){return new Promise((t=>setTimeout(t,e)))}n.d(t,{y:()=>r})},890:(e,t,n)=>{"use strict";n.d(t,{$1:()=>r,Cg:()=>f,GK:()=>p,j1:()=>y});var r,i=n(9336),o=n(9164),s=n(3484),a=n(471),l=n(5822),c=n(3976),u=n(5133),d=n(8241);!function(e){e.LaunchTriggerReset="ld_bot_autoopen_",e.LaunchCtaReset="ld_bot_ctaopen_"}(r||(r={}));const h=[d.TL.TemporaryMessage,d.TL.ImageOrGIF,d.TL.BubbleImage,d.TL.BubbleImageAnswers,d.TL.MessageAndAnswers,d.TL.IconAndAnswers,d.TL.CardAndAnswers,d.TL.ImageOrGIFAndAnswers];async function p(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,l.tU)();const[t]=await Promise.all([(0,o.kL)(e)]),{settings:{bot_id:n,launch_auto_open:u,launch_trigger_scroll:h=null,launch_trigger_time:p=null,launcher_visible:f}}=e,v=h?a.mv[h]:null,y=r.LaunchTriggerReset+n,b=localStorage.getItem(y);if(b&&parseInt(b,10)>(new Date).getTime())return!1;if((0,c.Rm)(`preflight config: ${JSON.stringify({auto:u,scr:v,time:p})}`),t)return(0,c.Rm)("livechat session available: will open bot"),!0;if(!f||!s._A.visible)return(0,c.Rm)("bot launcher not visible"),!1;let _=[];switch(u){case d.EU.Never:return!1;case d.EU.Immediately:return(0,i.P)(a.qE,{trigger:"auto-open"}),!0;case d.EU.Scroll:if(!h)return!1;null!==v&&v>0&&(_=m(_,v,a.qE));break;case d.EU.Time:if(!p)return!1;_=g(_,p,a.qE);break;case d.EU.Scroll_time:if(!h||!p)return!1;_=g(_,p,a.qE),null!==v&&v>0&&(_=m(_,v,a.qE));break;default:return!0}return Promise.race(_).then((()=>!0))}async function f(){await v()&&((0,c.Rm)("cta trigger activated"),s.hl.hasOpened||(s.hl.isOpen=!0,s.hl.hasOpened=!0))}function m(e,t,n){return e.push((0,u.m)(t).then((()=>{(0,i.P)(n,{trigger:"scroll"})}))),e}function g(e,t,n){return e.push(new Promise((e=>{setTimeout((()=>{(0,i.P)(n,{trigger:"time"}),e()}),1e3*t)}))),e}async function v(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,l.tU)();const{settings:{bot_id:t,launch_cta_open:n,launch_cta_scroll:o,launch_cta_time:s}}=e,c=o?a.mv[o]:null,u=r.LaunchCtaReset+t,h=localStorage.getItem(u);if(h&&parseInt(h,10)>(new Date).getTime())return!1;let p=[];switch(n){case d.EU.Never:return!1;case d.EU.Immediately:return(0,i.P)(a.x3,{trigger:"auto-open"}),!0;case d.EU.Scroll:if(!o)return!1;null!==c&&c>0&&(p=m(p,c,a.x3));break;case d.EU.Time:if(!s)return!1;p=g(p,s,a.x3);break;case d.EU.Scroll_time:if(!o||!s)return!1;p=g(p,s,a.x3),null!==c&&c>0&&(p=m(p,c,a.x3));break;default:return!0}return Promise.race(p).then((()=>!0))}async function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,l.tU)();const{settings:{bot_id:n,launch_style:i,launch_trigger_reset:o,launch_cta_reset:a}}=t;if(h.includes(i)||e===r.LaunchTriggerReset){const t=e===r.LaunchTriggerReset?o:a,i=e+n,l=(new Date).getTime(),c=new Date(l+1e3*t).getTime();e===r.LaunchCtaReset&&(s.hl.isCTAKeyDeleted=!1),localStorage.setItem(i,`${c}`),setTimeout((()=>{localStorage.removeItem(i),e===r.LaunchTriggerReset?p().then((e=>{e&&(s._A.isOpen=!0,s._A.hasOpened=!0,s.gU.isOpen=!0,s.gU.hasOpened=!0)})):v().then((e=>{e&&(s.hl.isOpen=!0,s.hl.hasOpened=!0,s.hl.isCTAKeyDeleted=!0)}))}),1e3*t)}}},931:(e,t,n)=>{"use strict";n.d(t,{At:()=>o,F:()=>a,c1:()=>s});var r=n(5235),i=n(373);function o(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,i._)();if(!n)return null;try{t=decodeURIComponent(e)}catch(n){(0,r.U)(n),t=e}const o=new RegExp(t).exec(n);return o&&o[1]||null}function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;const n=decodeURIComponent(e);try{const e=t.evaluate(n,t,null,XPathResult.STRING_TYPE,null);return"string"==typeof e.stringValue&&e.stringValue.length>0?e.stringValue:null}catch(e){return console.error("Error processing XPath result",e),null}}function a(e,t){var n;const r=e.split("."),i=null!==(n=r.shift())&&void 0!==n?n:"";let o=null;if(/^\d+$/.test(i))o=parseInt(i,10);else if("*"===i){let e;return e=Array.isArray(t)?t:t&&"object"==typeof t?Object.keys(t).map((e=>t[e])):[t],e.map((e=>a(r.join("."),e))).find((e=>null!==e))||null}let s=null;return t&&"object"==typeof t&&("number"==typeof o&&void 0!==t[o]?s=t[o]:void 0!==t[i]&&(s=t[i])),r.length>0?a(r.join("."),s):null===s?null:`${s}`}},973:(e,t,n)=>{"use strict";n.d(t,{I:()=>l,d:()=>a});var r=n(9443);const i="Leadoo",o=["Chat","CTA","Custom","InPage","Visual"];let s=null;function a(){if(!s)throw new Error("API is not initialised");return s}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;"object"==typeof e[i]&&e[i]?s=e[i]:(s={},(0,r.oq)(e,i,s));const t=s;o.forEach((e=>{t[e]||(0,r.oq)(t,e,{})}))}},992:(e,t,n)=>{"use strict";n.d(t,{j:()=>r.j});var r=n(7232)},1002:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(4215),i=n(7915);async function o(e,t,n){if(!e)return null;if(t===i.sw.Phone){const t=await(0,r.l)(n.id,e);return null!=t?t:null}if(t===i.sw.Email&&n.email_non_free){const t=await(0,r.B)(n.id,e);return null!=t?t:null}return null}},1329:(e,t,n)=>{"use strict";n.d(t,{$z:()=>g,Ge:()=>y,LC:()=>b,Tk:()=>p,iT:()=>f,im:()=>v,kv:()=>h,r6:()=>w,tG:()=>d,ts:()=>m,uv:()=>_});var r=n(1981),i=n(471),o=n(5822);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;ta(a({},e),function(e,t,n){if(!1===u.test(e)||!1===u.test(t))return[];const r=[],i=Math.ceil(c/n),[o,s]=t.split(":").map((e=>parseInt(e,10)));let[a,l]=e.split(":").map((e=>parseInt(e,10)));do{if(r.push(`${_(a)}:${_(l)}`),l+=n,l>59){const e=Math.floor(l/60);a+=e,l-=60*e}if(a>23)break;if(a>o||a===o&&l>s)break}while(r.length<=i);return r}(n.from,n.to,t).reduce(((e,t)=>a(a({},e),{},{[t]:t})),{}))),{}))}function f(e,t,n,r){if(!t)return[];const o=`${m(t).getDate()}`;let s=e[o]?e[o]:[];return n!==i.Gt&&(s=s.filter((e=>e.allowed_owners.find((e=>e.user_id===parseInt(n,10)))))),r?s:s.map((e=>e.from))}function m(e){return h(new Date(e))}function g(e,t){const n=function(e){const t=new Date(e),n=t.getDay(),r=t.getDate()-n+(0===n?-6:1);return new Date(t.setDate(r))}(v(e)),r=function(e,t){const n=new Date(e),r=[];do{r.push(n.toLocaleString(t,{weekday:"short"}).substring(0,1)),n.setDate(n.getDate()+1)}while(r.length<7);return r}(n,t);return r}function v(e){const t=new Date(e);return t.setDate(1),t}function y(e,t){return e.toLocaleString(t,{month:"long"})}function b(e){return`${e.getFullYear()}-${_(e.getMonth()+1)}-${_(e.getDate())}`}function _(e){return e<10?`${arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0"}${e}`:`${e}`}function w(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();const n=new Date(e);let r=n.getHours();const i=n.getMinutes();if(t.t24)return`${_(r)}:${_(i)}`;let s="AM";return r>11&&(s="PM"),r>12&&(r-=12),`${_(r)}:${_(i)} ${s}`}},1417:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1419:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Channel=void 0;const i=n(6506),o=n(9027),s=n(9955),a=n(1517);function l(e,t){const{type:n,created:r}=e,{type:i,created:o}=t;return n===a.TaskPriority.High&&i!==a.TaskPriority.High?-1:i===a.TaskPriority.High&&n!==a.TaskPriority.High?1:i===a.TaskPriority.Tail&&n!==a.TaskPriority.Tail?-1:n===a.TaskPriority.Tail&&i!==a.TaskPriority.Tail?1:r=0;t-=1)this.tasks[t].type===e&&this.tasks.splice(t,1);else this.tasks.splice(0,1/0)}enqueue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.TaskPriority.Normal,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(n){const e=this.getStackedItems(n);if(e.length>0)return e[e.length-1].queuedPromise}const i=new s.Task(e,t,n);return"number"==typeof r&&r>=0&&(i.timeLimit=r),this.tasks.push(i),this.sort(),this.autostart&&this.start(),i.queuedPromise}getStackedItems(e){return this.tasks.filter((t=>t.stack&&t.stack===e))}retrieveNextItem(){return this.tasks.shift()}sort(){this.tasks.sort(l)}start(){return!this.isRunning&&(this.emit("started"),this.isRunning=!0,setTimeout((()=>this._runNextItem()),0),!0)}waitForEmpty(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(this,void 0,void 0,(function*(){const{throwForFailures:t=!1}=e;if(yield new Promise((e=>{if(this.isEmpty)return e();this.once("stopped",(()=>{e()}))})),t&&this._taskErrors.length>0)throw new o.Layerr(this._taskErrors[0],"Enqueued task failed")}))}_runNextItem(){const e=this.retrieveNextItem();e?e.execute(this._tasksThrow).then((()=>{e.error&&this._taskErrors.push(e.error)})).then((()=>this._runNextItem())).catch((e=>{console.error(e)})):(this.isRunning=!1,this.emit("stopped"))}}t.Channel=c},1517:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TaskPriority=t.ErrorCode=void 0,function(e){e.TaskTimeout="TASKTIMEOUT"}(t.ErrorCode||(t.ErrorCode={})),function(e){e.Normal="normal",e.High="high-priority",e.Tail="tail"}(t.TaskPriority||(t.TaskPriority={}))},1624:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseArguments=void 0;const r=n(9657);t.parseArguments=function(e){let t,n="";if(0===e.length)t={};else if(r.isError(e[0]))t={cause:e[0]},n=e.slice(1).join(" ")||"";else if(e[0]&&"object"==typeof e[0])t=Object.assign({},e[0]),n=e.slice(1).join(" ")||"";else{if("string"!=typeof e[0])throw new Error("Invalid arguments passed to Layerr");t={},n=n=e.join(" ")||""}return{options:t,shortMessage:n}}},1626:(e,t,n)=>{"use strict";n.d(t,{T:()=>g,f:()=>m});var r=n(3162),i=n(4912),o=n(5429),s=n(3089),a=n(3609),l=n(8538),c=n(785),u=n(890),d=n(1870),h=n(3484),p=n(471),f=n(8241);const m=(0,r.createContext)({});function g(e){const t=(0,a.P)("settings"),{children:n,initialStateGetter:g=d.q8}=e,[v,y]=(0,c.i)(d.v7,g),[b,_]=(0,o.z)(h._A,"isOpen"),[w,x]=(0,o.z)(h._A,"hasOpened"),[C,k]=(0,o.z)(h.hl,"isOpen"),[S,O]=(0,o.z)(h.hl,"hasOpened"),[j,P]=(0,o.z)(h.hl,"isCTAKeyDeleted"),[E,T]=(0,i.useState)(0),[I,N]=(0,o.z)(h._A,"visible"),A=(0,i.useCallback)((()=>{Date.now()-E{Date.now()-E{k(!0),O(!0)}),[E]),R=(0,i.useCallback)((()=>{k(!1),O(!1),(0,u.j1)(u.$1.LaunchCtaReset)}),[E]),M=(0,i.useCallback)((()=>{N(!0)}),[]),$=(0,i.useCallback)((()=>{b?L():A()}),[b,A,L]),U=(0,i.useCallback)((()=>{C?R():D()}),[C,D,R]),F=(0,s.h)(),q=(0,l.i)(b),B=(0,i.useCallback)((()=>q?q.state.chat:(0,d.q8)()),[q]);return!1===q||F?null:(0,r.h)(m.Provider,{value:{close:L,dispatch:y,getState:B,hasOpened:w,isOpen:b,hasStyleOpened:S,isCTAKeyDeleted:j,isStyleOpen:C,setIsCTAKeyDeleted:P,open:A,openCTA:D,closeCTA:R,showBot:M,lcSession:q,state:v,toggle:$,toggleCTA:U,visible:I}},n)}},1662:(e,t,n)=>{"use strict";n.d(t,{D:()=>c,L:()=>u});var r=n(5784),i=n(506),o=n(1856);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;ta(a({},e),{},{avatar:null}))),s=(new r.ChannelQueue).createParallelChannel("messages",5);for(let t=0;t{n[t]=await(0,i.Gt)(e,n[t])}));return await s.waitForEmpty(),n}function u(e){let t=null;for(const[n,r]of e.channels)if((r.subscribe||r.state.subscribed)&&!r.broadcast){t=n;break}if(!t)throw new Error("Failed locating user channel config");return t}},1786:(e,t,n)=>{"use strict";n.d(t,{$:()=>C});var r=n(4817),i=n(8364),o=n(4912),s=n(868),a=n(1626),l=n(1981),c=n(2658),u=n(5822),d=n(5048),h=n(3976),p=n(7201),f=n(5235),m=n(1662),g=n(3503),v=n(1870),y=n(7852),b=n(515),_=n(9833),w=n(7915);const x=["event-assign-new","event-assign-transfer","event-client-leave","event-client-rejoin","event-ended-agent","event-ended-inactive","event-ended-timeout","event-vis-platform-switch"];function C(e){const{useAgentInfo:t,useChatInfo:n}=e,{connected:C,disconnect:k,dispatch:S,fetchInitialMessages:O,getState:j,id:P,onMessage:E,startTimeout:T,state:I}=(0,o.useContext)(_.k),{dispatch:N,state:A,submitAnswer:L}=(0,o.useContext)(b.p),{state:D,dispatch:R}=(0,o.useContext)(a.f),M=(0,o.useMemo)(u.tU,[]),$=(0,o.useRef)(!1),U=(0,o.useRef)(!1),F=t(),q=n(),B=(0,i.tH)(),z=(0,o.useMemo)((()=>(0,m.L)(B)),[B]),V=(0,o.useCallback)((e=>{var t,n,i,o,s,a;switch(e.type){case r.Go.Event:{var l;const t=null!==(l=e.text)&&void 0!==l?l:"";var u,p,f;if(x.includes(t))"event-ended-agent"===t&&(M.finished=!0,M.nextPosition=null),N({payload:null!==(u=null===(p=e.payload)||void 0===p?void 0:p.event)&&void 0!==u?u:{},text:null!==(f=e.text)&&void 0!==f?f:"",type:g.Ud.AddLiveChatEvent});break}case r.Go.Message:N({ownMessage:e.from===P,sender:null!==(t=e.from)&&void 0!==t?t:null,status:w.dm.Sent,tag:null!==(n=null===(i=e.payload)||void 0===i?void 0:i.tag)&&void 0!==n?n:`notag:${P}`,text:(null!==(o=e.text)&&void 0!==o?o:"").trim(),timestamp:null!==(s=e.timestamp)&&void 0!==s?s:Date.now(),attachments:null===(a=e.payload)||void 0===a?void 0:a.attachments,type:g.Ud.AddUpdateLiveChatMessage});break;case r.Go.TimeoutCancelled:S({type:y.nM.CancelTimeout});break;case r.Go.TimeoutStarted:{const{timeoutCancelled:t}=j();if(t)(0,h.Rm)("livechat timeout start received, but timeout already cancelled");else{const{start:t,timeout:n,timeoutMessage:r}=e.payload||{};(0,c.B)(t,"livechat timeout start"),(0,c.B)(n,"livechat timeout"),(0,c.B)(r,"livechat timeout message");const i=(0,d.A)(t,n);null===i?(0,h.Rm)(`timeout present but no time left: ${i}`):((0,h.Rm)(`livechat timeout started: ${i}s`),S({start:t,timeout:n,timeoutMessage:r,type:y.nM.SetTimeout}),T())}break}default:throw new Error(`Failed handling LiveChat message: Unexpected type: ${e.type}`)}}),[N,j,P,T]);return(0,o.useEffect)((()=>{const e=E(V);return()=>{e()}}),[V,E]),(0,o.useEffect)((()=>{const{agent:e,agentOnline:t,agentTyping:n}=D,r="string"==typeof F.name&&"string"==typeof F.avatar;r&&!e?R({agent:{avatar:F.avatar,name:F.name},type:v.hA.SetAgent}):!r&&e&&R({agent:null,type:v.hA.SetAgent}),n!==F.typing&&R({typing:F.typing,type:v.hA.SetAgentTyping}),t!==F.online&&R({online:F.online,type:v.hA.SetAgentOnline})}),[F,D,R]),(0,o.useEffect)((()=>{if(!q)return;const{disconnectType:e}=j();var t;e!==y.Jx.Instant&&(U.current||(q.completed||q.deleted)&&(U.current=!0,S({type:y.nM.CompleteChat}),R({agent:null,type:v.hA.SetAgent}),k().catch((e=>{console.error(e)})),N({type:g.Ud.AddLiveChatInfoMessage,payload:{message:(0,l.t)("lc.complete"),hideTimeout:!0}}),L("",null),null!==(t=M.companyRatings)&&void 0!==t&&null!==(t=t.find((e=>e.type===p.p[w.eU.LIVECHAT])))&&void 0!==t&&t.enabled&&M.leadID&&(async()=>{await(0,s.y)(900),N({type:g.Ud.BotRatingPrompt,feedbackType:w.eU.LIVECHAT,open:!0,chatID:null!=z?z:""})})()))}),[null==q?void 0:q.completed,null==q?void 0:q.deleted,k,R,S,j,L]),(0,o.useEffect)((()=>{C&&($.current||($.current=!0,O().then((e=>{for(const t of e)V(t)})).catch((e=>{console.error(e),(0,f.U)(e)}))))}),[C,O,V]),(0,o.useEffect)((()=>{if(I.timeoutShow){A.items.find((e=>e.type===g.rV.LiveChatTimeout))||N({type:g.Ud.AddLiveChatTimeout})}}),[A,N,I]),null}},1831:(e,t,n)=>{"use strict";function r(e){if(!i(e))throw new Error("Parameter was not an error")}function i(e){return!!e&&"object"==typeof e&&"[object Error]"===(t=e,Object.prototype.toString.call(t))||e instanceof Error;var t}n.d(t,{Z0:()=>w});const o="Layerr";let s=o;class a extends Error{constructor(e,t){const n=[...arguments],{options:r,shortMessage:o}=function(e){let t,n="";if(0===e.length)t={};else if(i(e[0]))t={cause:e[0]},n=e.slice(1).join(" ")||"";else if(e[0]&&"object"==typeof e[0])t=Object.assign({},e[0]),n=e.slice(1).join(" ")||"";else{if("string"!=typeof e[0])throw new Error("Invalid arguments passed to Layerr");t={},n=n=e.join(" ")||""}return{options:t,shortMessage:n}}(n);let a=o;if(r.cause&&(a=`${a}: ${r.cause.message}`),super(a),this.message=a,r.name&&"string"==typeof r.name?this.name=r.name:this.name=s,r.cause&&Object.defineProperty(this,"_cause",{value:r.cause}),Object.defineProperty(this,"_info",{value:{}}),r.info&&"object"==typeof r.info&&Object.assign(this._info,r.info),Error.captureStackTrace){const e=r.constructorOpt||this.constructor;Error.captureStackTrace(this,e)}}static cause(e){return r(e),e._cause&&i(e._cause)?e._cause:null}static fullStack(e){var t;r(e);const n=a.cause(e);return n?`${e.stack}\ncaused by: ${a.fullStack(n)}`:null!==(t=e.stack)&&void 0!==t?t:""}static info(e){r(e);const t={},n=a.cause(e);return n&&Object.assign(t,a.info(n)),e._info&&Object.assign(t,e._info),t}toString(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e}}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t{const e=new Uint8Array(1);return n.getRandomValues(e),e[0]/255};if("function"==typeof(null==n?void 0:n.randomBytes))return()=>n.randomBytes(1).readUInt8()/255;throw new a({info:c({code:"PRNG_DETECT"},g)},"Failed to find a reliable PRNG")}function y(e,t){let n="";for(;e>0;e--)n=_(t)+n;return n}function b(e,t){if(isNaN(e))throw new a({info:c({code:"ENC_TIME_NAN"},g)},`Time must be a number: ${e}`);if(e>p)throw new a({info:c({code:"ENC_TIME_SIZE_EXCEED"},g)},`Cannot encode a time larger than ${p}: ${e}`);if(e<0)throw new a({info:c({code:"ENC_TIME_NEG"},g)},`Time must be positive: ${e}`);if(!1===Number.isInteger(e))throw new a({info:c({code:"ENC_TIME_TYPE"},g)},`Time must be an integer: ${e}`);let n,r="";for(let i=t;i>0;i--)n=e%h,r=d.charAt(n)+r,e=(e-n)/h;return r}function _(e){let t=Math.floor(e()*h);return t===h&&(t=h-1),d.charAt(t)}function w(e,t){const n=t||v();return b(isNaN(e)?Date.now():e,f)+y(m,n)}},1856:(e,t,n)=>{"use strict";n.d(t,{U:()=>i});var r=n(4817);const i=[r.Go.Message,r.Go.Event,r.Go.TimeoutCancelled,r.Go.TimeoutStarted]},1870:(e,t,n)=>{"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;ts,q8:()=>l,v7:()=>a}),function(e){e.SetAgent="set-agent",e.SetAgentOnline="set-agent-online",e.SetAgentTyping="set-agent-typing",e.SetState="set-state"}(s||(s={}))},1935:(e,t,n)=>{"use strict";n.d(t,{l:()=>o});let r=null;function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;if(!function(e){let t;try{t=window[e];const n="__storage_test__";return t.setItem(n,n),t.removeItem(n),!0}catch(e){return e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&t&&0!==t.length}}(e))return null;const n=t[e];return{async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=n.getItem(e);return null===r?t:JSON.parse(r)},async remove(e){n.removeItem(e)},async set(e,t){n.setItem(e,JSON.stringify(t))}}}function o(){if(null===r&&(r=i("localStorage")),!r)throw new Error("No shared storage available");return r}},1944:(e,t,n)=>{"use strict";n.d(t,{R:()=>r});const r=(0,n(5738).L)({loaded:[],loading:[]})},1981:(e,t,n)=>{"use strict";n.d(t,{t:()=>o});var r=n(5822);function i(e,t){const n=[...t],r=n.shift();if(!r)return null;const o=e[r];return n.length<=0?"string"==typeof(s=o)||"number"==typeof s?o:null:o&&"object"==typeof o?i(o,n):null;var s}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,r.tU)();const{i18n:o}=n;if(!o)return e;const s=i(o,e.split("."));return"string"==typeof s?function(e,t){let n=e;return Object.keys(t).forEach((e=>{let r=n;const i=`{{${e}}}`;for(;(n=n.replace(i,t[e]||""))!==r;)r=n})),n}(s,t):e}},2095:(e,t,n)=>{"use strict";n.d(t,{v:()=>d});var r=n(8048),i=n(6430),o=n.n(i),s=n(3162),a=n(4912),l=n(1981),c=n(5822),u=n(9725);function d(e){var t;let{question:n,botIcon:i,nodeId:d,showMedia:h=!1}=e;const p=(0,a.useMemo)(c.tU,[]);return(0,s.h)("div",{className:"question-wrapper","data-nodeid":d,"data-questionid":n.id},i&&(0,s.h)(r.eu,{className:"question-avatar",src:null!=i?i:"",alt:(0,l.t)("chat.bot-avatar-alt")}),!i&&(0,s.h)("div",{className:"question-icon-margin"}),(0,s.h)(r.vJ,{nodeId:d,classNames:o()("ld-question",{"media-question":h}),dataSettings:"bot-question"},h&&(0,s.h)(u.H,{question:n,insideContent:!1}),(0,s.h)(r.o5,{dataSettings:"bot-question-text"},p.botName&&(0,s.h)("span",{className:"visually-hidden"},(0,l.t)("a11y.sent-by",{name:p.botName})),(0,s.h)("span",{dangerouslySetInnerHTML:{__html:null!==(t=n.text)&&void 0!==t?t:""}}))))}},2131:(e,t,n)=>{"use strict";n.d(t,{$O:()=>l,Hj:()=>h,On:()=>u,T:()=>m,U2:()=>f,XP:()=>c,og:()=>a});var r=n(9440),i=n(6281),o=n(471),s=n(7915);function a(e){switch(e){case s.sw.Message:return o.xK;case s.sw.Name:case s.sw.CompanyName:return o.wg;case s.sw.Email:case s.sw.Location:case s.sw.City:case s.sw.Country:return o.iZ;case s.sw.Postcode:return o.S9;case s.sw.Phone:return o.Ih;case s.sw.FirstName:case s.sw.LastName:return o.Wl;default:return o.wg}}function l(e,t){switch(e){case s.xi.AI:return i.j3;case s.xi.NamePrompt:return s.UL.FirstName===t||s.UL.LastName===t?o.Wl:o.wg;case s.xi.CompanyPrompt:return o.wg;case s.xi.TextPrompt:return o.xK;case s.xi.EmailPrompt:return o.iZ;case s.xi.PhonePrompt:return o.Ih;default:return o.wg}}const c={city:r.mFJ,companyName:r.u$N,country:r.gqn,email:r.Hws,firstName:r.PMU,lastName:r.PMU,location:r.XEf,name:r.PMU,other:r._OQ,phone:r.YZw,zip:r.DY1,dropdown:r.uHP,time:r.rsu},u={companyName:r.ovv,email:r.qFr,firstName:r.HIn,lastName:r.HIn,name:r.HIn,other:r.yJ6,phone:r.stL,location:r.MBo,city:r.qhU,country:r.CpH,zip:r.iG7},d="input.icon-alt.",h={city:`${d}city`,companyName:`${d}companyName`,country:`${d}country`,email:`${d}email`,firstName:`${d}firstName`,lastName:`${d}lastName`,location:`${d}location`,name:`${d}name`,other:`${d}other`,phone:`${d}phone`,zip:`${d}zip`,dropdown:`${d}dropdown`,time:`${d}time`},p="input.label.",f={city:`${p}city`,companyName:`${p}companyName`,country:`${p}country`,email:`${p}email`,firstName:`${p}firstName`,lastName:`${p}lastName`,location:`${p}location`,name:`${p}name`,other:`${p}other`,phone:`${p}phone`,zip:`${p}zip`};function m(e,t){return"string"==typeof e&&e||t}},2135:(e,t,n)=>{"use strict";Object.freeze({})},2240:(e,t,n)=>{"use strict";function r(e,t){if(null===e){const e=new Error(t);throw e.name="AssertionError",e}}n.d(t,{b:()=>r})},2276:(e,t,n)=>{"use strict";n.d(t,{GU:()=>i,bJ:()=>r.b});var r=n(8500);class i extends Error{constructor(e,t){const n=[...arguments],{options:i,shortMessage:o}=function(e){let t,n="";if(0===e.length)t={};else if((0,r.b)(e[0]))t={cause:e[0]},n=e.slice(1).join(" ")||"";else if(e[0]&&"object"==typeof e[0])t=Object.assign({},e[0]),n=e.slice(1).join(" ")||"";else{if("string"!=typeof e[0])throw new Error("Invalid arguments passed to Layerr");t={},n=n=e.join(" ")||""}return{options:t,shortMessage:n}}(n);let s=o;if(i.cause&&(s=`${s}: ${i.cause.message}`),super(s),this.message=s,i.name&&"string"==typeof i.name?this.name=i.name:this.name="Layerr",i.cause&&Object.defineProperty(this,"_cause",{value:i.cause}),Object.defineProperty(this,"_info",{value:{}}),i.info&&"object"==typeof i.info&&Object.assign(this._info,i.info),Error.captureStackTrace){const e=i.constructorOpt||this.constructor;Error.captureStackTrace(this,e)}}static cause(e){return(0,r.t)(e),e._cause&&(0,r.b)(e._cause)?e._cause:null}static fullStack(e){(0,r.t)(e);const t=i.cause(e);return t?`${e.stack}\ncaused by: ${i.fullStack(t)}`:e.stack}static info(e){(0,r.t)(e);const t={},n=i.cause(e);return n&&Object.assign(t,i.info(n)),e._info&&Object.assign(t,e._info),t}cause(){return i.cause(this)}toString(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e}}},2336:(e,t,n)=>{var r=n(7095),i=n(3048)(r);i.push([e.id,"#root,body{width:100%;height:100%}",""]),e.exports=i},2365:e=>{e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";function r(e,t){for(var n=0;n0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},o=function(){};function s(e,t,n){if(void 0===n&&(n={}),n["content-type"]&&n["content-type"].indexOf("application/json")>=0)try{return e&&"string"==typeof e?JSON.parse(e):e}catch(e){}return e}function a(e){return e?e.trim().split(/\r\n|\n/g).reduce((function(e,t){var n=i(t.split(/:(.+)/),2),r=n[0],o=n[1];return r&&o&&(e[r.toLowerCase()]=o.trim()),e}),{}):{}}function l(e){var t=e.url,n=e.method,i=void 0===n?"GET":n,l=e.headers,u=void 0===l?{}:l,d=e.body,h=void 0===d?null:d,p=e.XMLHR,f=void 0===p?XMLHttpRequest:p,m=e.withCredentials,g=void 0!==m&&m,v=e.parser,y=void 0===v?s:v,b=e.onProgress,_=void 0===b?o:b,w=e.autoContentType,x=void 0===w||w,C=e.timeout,k=void 0===C?null:C;return new Promise((function(n,o){if(e.data){var s=new Error("sendRequest uses 'body' rather than 'data', but saw 'data' property");return s.code="config",o(s)}var l,d,p,m,v=Object.assign({},u),b=h;x&&b&&"object"==typeof b&&null===c(v,"Content-Type")&&(b=JSON.stringify(b),l=v,p=(d="Content-Type").toLowerCase(),m=r(Object.keys(l),(function(e){return e.toLowerCase()===p}))||d,l[m]="application/json");var w=new f;w.open(i,t,!0),k&&(w.timeout=k,w.ontimeout=function(){var e=new Error("Requested timed-out after "+k+" milliseconds");e.code="timeout",o(e)}),w.withCredentials="boolean"==typeof g&&g,Object.keys(v).map((function(e){w.setRequestHeader(e,v[e])})),w.upload.addEventListener("progress",(function(e){if(e.lengthComputable){var t=Math.round(100*e.loaded/e.total);isNaN(t)||_(t)}})),w.onerror=function(){var e="Request error ("+w.status+" "+w.statusText+", state: "+w.readyState+"): "+i+" "+t;w.responseText&&(e=e+": "+w.responseText.substring(0,50));var n=new Error(e);n.status=w.status,n.statusText=w.statusText,o(n)},w.onreadystatechange=function(){if(4===w.readyState)if(w.status>=200&&w.status<300||302===w.status||304===w.status){var e=a(w.getAllResponseHeaders());n({_req:w,body:y(w.responseText,w.status,e),headers:e,status:w.status,statusText:w.statusText})}else{var r={};try{r=a(w.getAllResponseHeaders())}catch(e){}var s=r["x-ld-req"]||"",l=(s?"Request failed ("+s+")":"Request failed")+" ("+w.status+" "+w.statusText+"): "+i+" "+t;w.responseText&&(l=l+": "+w.responseText.substring(0,50));var c=new Error(l);c.status=w.status,c.statusText=w.statusText,o(c)}},w.send(b)}))}function c(e,t){var n=t.toLowerCase(),i=r(Object.keys(e),(function(e){return e.toLowerCase()===n}))||t;return e[i]?{key:i,value:e[i]}:null}},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(0);n.d(t,"getHeader",(function(){return r.a})),n.d(t,"sendRequest",(function(){return r.b}));var i=n(1);for(var o in i)["default","getHeader","sendRequest"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(o)}])},2652:(e,t,n)=>{"use strict";n.d(t,{l:()=>s,r:()=>o});var r=n(5822),i=n(7915);function o(e){return{allow_empty:!0,answer_motif_id:null,bot_id:(arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,r.tU)()).botID,category_id:null,dropdown_id:null,email_non_free:!1,enable_rating:!1,id:-1,img_overlay:null,is_city:!1,is_company_name:!1,is_country:!1,is_email:!1,is_end:!1,is_fb_chat:!1,is_live_chat:!1,is_location:!1,is_multiline:!1,is_name:!1,is_other:!1,is_phone:!1,is_personalization_booking:!1,is_sensitive:!1,is_trigger_lead:!1,is_wa_chat:!1,is_zip_code:!1,label_id:null,lookup_query_id:null,lookup_settings_id:null,max_answers_count:null,media_settings:null,meta:{},min_answers_count:null,next_no:null,order_no:0,score:null,start_message:null,sub_text:null,text:null,type:e,video_overlay:null}}function s(e,t){if(null!=e&&e.type&&[i.xi.SingleChoice,i.xi.SingleChoiceURL].includes(e.type)){const e=t;if(null!=e&&e.is_end)return null;const n=null==e?void 0:e.next_no;if(n)return n}if(null!=e&&e.is_end)return null;var n;if(null!=e&&e.next_no||null!=e&&e.order_no)return null!==(n=null==e?void 0:e.next_no)&&void 0!==n?n:(null==e?void 0:e.order_no)+1;throw new Error("Cannot resolve next question position: No current question or position for calculation")}},2658:(e,t,n)=>{"use strict";function r(e,t){if(null==e)throw new Error(`Value is not set: ${t}`)}n.d(t,{B:()=>r})},2786:(e,t,n)=>{"use strict";var r,i,o,s,a,l,c,u;n.d(t,{UL:()=>c,xi:()=>u}),function(e){e[e.Indefinite=1]="Indefinite",e[e.Schedule=0]="Schedule"}(r||(r={})),function(e){e[e.Auto=0]="Auto",e[e.Manual=1]="Manual"}(i||(i={})),function(e){e[e.Ended=3]="Ended",e[e.Launched=1]="Launched",e[e.Paused=2]="Paused"}(o||(o={})),function(e){e[e.BestConversionRate=0]="BestConversionRate",e[e.BestEngagementRate=1]="BestEngagementRate",e[e.MostLeadConversions=2]="MostLeadConversions"}(s||(s={})),function(e){e[e.Document=3]="Document",e[e.Internal=0]="Internal",e[e.URL=2]="URL",e[e.Window=1]="Window"}(a||(a={})),function(e){e[e.AdvancedAnalytics=16]="AdvancedAnalytics",e[e.Automation=17]="Automation",e[e.BannerBots=14]="BannerBots",e[e.CallbackBot=6]="CallbackBot",e[e.ChatBot=3]="ChatBot",e[e.CTABot=19]="CTABot",e[e.CustomerProfiles=13]="CustomerProfiles",e[e.Feedback=8]="Feedback",e[e.InPageBot=4]="InPageBot",e[e.Integrations=18]="Integrations",e[e.LiveChat=5]="LiveChat",e[e.Media=7]="Media",e[e.Messaging=11]="Messaging",e[e.OrganizationProfiles=15]="OrganizationProfiles",e[e.Page=1]="Page",e[e.Remarketing=10]="Remarketing",e[e.Video=2]="Video",e[e.VisualBot=9]="VisualBot"}(l||(l={})),function(e){e.FullName="",e.FirstName="first",e.LastName="last",e.Separate="separate"}(c||(c={})),function(e){e[e.AdvancedCalculatorResult=33]="AdvancedCalculatorResult",e[e.AdvancedRouterResult=34]="AdvancedRouterResult",e[e.AI=48]="AI",e[e.ApiCall=51]="ApiCall",e[e.Rating=52]="Rating",e[e.AttachmentPrompt=44]="AttachmentPrompt",e[e.AttachmentPromptSingle=43]="AttachmentPromptSingle",e[e.BookingCalendar=35]="BookingCalendar",e[e.CalculatorResult=31]="CalculatorResult",e[e.Calendar=22]="Calendar",e[e.Carousel=16]="Carousel",e[e.CompanyPrompt=3]="CompanyPrompt",e[e.ContactForm=9]="ContactForm",e[e.CTAForm=47]="CTAForm",e[e.CustomForm=45]="CustomForm",e[e.Dropdown=15]="Dropdown",e[e.EmailPrompt=2]="EmailPrompt",e[e.LiveChat=99]="LiveChat",e[e.LocationForm=6]="LocationForm",e[e.LookupCarousel=1016]="LookupCarousel",e[e.LookupDropdown=1015]="LookupDropdown",e[e.LookupMultipleChoice=1014]="LookupMultipleChoice",e[e.LookupSingleChoice=1011]="LookupSingleChoice",e[e.LookupSingleChoiceURL=1012]="LookupSingleChoiceURL",e[e.LookupQuery=36]="LookupQuery",e[e.MultipleChoice=14]="MultipleChoice",e[e.NamePrompt=1]="NamePrompt",e[e.TextPrompt=5]="TextPrompt",e[e.PhonePrompt=4]="PhonePrompt",e[e.RangeSelector=21]="RangeSelector",e[e.Say=0]="Say",e[e.SingleChoice=11]="SingleChoice",e[e.SingleChoiceURL=12]="SingleChoiceURL",e[e.SoftLiveChat=2099]="SoftLiveChat",e[e.SingleChoiceAPI=2011]="SingleChoiceAPI",e[e.MultipleChoiceAPI=2014]="MultipleChoiceAPI",e[e.DropdownSelectAPI=2015]="DropdownSelectAPI",e[e.CarouselAPI=2016]="CarouselAPI",e[e.Country=7]="Country"}(u||(u={}))},2791:()=>{Array.prototype.fill||Object.defineProperty(Array.prototype,"fill",{value:function(e){if(null==this)throw new TypeError("this is null or not defined");const t=Object(this),n=t.length>>>0,r=arguments[1]|0;let i=r<0?Math.max(n+r,0):Math.min(r,n);const o=arguments[2],s=void 0===o?n:o|0,a=s<0?Math.max(n+s,0):Math.min(s,n);for(;i{var r=n(2336);r&&r.__esModule&&(r=r.default),e.exports="string"==typeof r?r:r.toString()},2966:(e,t,n)=>{"use strict";n.d(t,{x:()=>d});var r=n(9443),i=n(9336),o=n(8949),s=n(4456),a=n(471),l=n(5822),c=n(3976);const u=["name","email","companyName","phone","location"];async function d(e,t,n,d){let h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:(0,l.tU)();if(h.leadID||(0,c.Rm)(`lead generated: ${n}`),h.leadID=n,t&&function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,l.tU)();const i=n.lead=n.lead||{};let o=t;switch(e){case r.xi.NamePrompt:i.name=o;break;case r.xi.EmailPrompt:i.email=o;break;case r.xi.PhonePrompt:i.phone=o;break;case r.xi.CompanyPrompt:i.company=o;break;case r.xi.TextPrompt:i.message=o;break;case r.xi.BookingCalendar:case r.xi.CustomForm:{const t="string"==typeof o?JSON.parse(o):o,n=e===r.xi.BookingCalendar?t.contactInfo:t;o={},u.forEach((e=>{const t=n.find((t=>t.type===e));t&&t.value&&(o[e]=t.value)}))}case r.xi.LiveChat:case r.xi.ContactForm:"object"==typeof o&&(["name","email","phone"].forEach((e=>{i[e]=o[e]||i[e]})),i.company=o.companyName||i.company);case r.xi.LocationForm:"object"==typeof o&&(i.location=o.location||i.location)}}(e,t,h),!h.leadVerified&&d){h.leadVerified=!0,(0,c.Rm)(`lead verified: ${n}`);const e=await(0,o.Vy)();h.dvTexts=null!=e?e:{},(0,s._N)(n,h),(0,i.P)(a.GE,{leadID:n})}}},3048:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,i,o){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(r)for(var a=0;a0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},3089:(e,t,n)=>{"use strict";n.d(t,{K:()=>a,h:()=>s});var r=n(4912),i=n(4543),o=n(3609);function s(){const e=(0,o.P)("destroyed"),[t,n]=(0,r.useState)(e);return(0,r.useEffect)((()=>{if(t||!e)return;const r=setTimeout((()=>{n(!0)}),250);return()=>{clearTimeout(r),n(!0)}}),[t,e]),t}function a(e){const t=(0,o.P)("tag",!1),n=(0,r.useRef)(!1),s=(0,r.useCallback)((t=>{!n.current&&t.destroy&&(n.current=!0,e().catch(console.error).finally((()=>{t.destroyed=!0})))}),[e]);(0,r.useEffect)((()=>{if(t)return(0,i.An)(t,s)}),[s,t])}},3132:e=>{function t(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("function"!=typeof e)throw new TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw new RangeError("`wait` must not be negative.");const{immediate:r}="boolean"==typeof n?{immediate:n}:n;let i,o,s,a,l;function c(){const t=i,n=o;return i=void 0,o=void 0,l=e.apply(t,n),l}function u(){const e=Date.now()-a;e=0?s=setTimeout(u,t-e):(s=void 0,r||(l=c()))}const d=function(){if(i&&this!==i&&Object.getPrototypeOf(this)===Object.getPrototypeOf(i))throw new Error("Debounced method called with different contexts of the same prototype.");i=this;for(var e=arguments.length,n=new Array(e),d=0;dvoid 0!==s}),d.clear=()=>{s&&(clearTimeout(s),s=void 0)},d.flush=()=>{s&&d.trigger()},d.trigger=()=>{l=c(),d.clear()},d}e.exports.debounce=t,e.exports=t},3148:(e,t,n)=>{"use strict";n.d(t,{Ov:()=>l,bH:()=>c,yQ:()=>u});var r=n(9443),i=n(5822),o=n(3976),s=n(259);const a={enumerable:!0,configurable:!0};function l(e,t,n,i,o){let l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:(0,s.z)();const c=l[e],u=o||function(e,t){let n=null,r=e;for(;t.hasOwnProperty(r);)null===n?n=2:n+=1,r=`${e}_${n}`;return r}(t,c),d=c[u]||{};(0,r.oq)(c,u,d,a);for(const e in i)(0,r.oq)(d,e,i[e],a);return c.first||(0,r.oq)(c,"first",d,a),c.last=d,n&&(0,r.oq)(l.Custom,n,d,a),[d,u]}function c(){return`${(0,i.tU)().tag}`}async function u(){(0,o.Rm)("reloading bot");(0,i.tU)().cleanup.forEach((e=>{try{e()}catch(e){(0,o.Rm)(`cleanup callback failed: ${e.message}`),console.error(e)}})),(0,i.cL)()}},3162:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Component:()=>O,Fragment:()=>S,cloneElement:()=>Q,createContext:()=>K,createElement:()=>x,createRef:()=>k,h:()=>x,hydrate:()=>G,isValidElement:()=>s,options:()=>i,render:()=>W,toChildArray:()=>L});var r,i,o,s,a,l,c,u,d,h,p,f,m,g={},v=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,b=Array.isArray;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(e,t,n){var i,o,s,a={};for(s in t)"key"==s?i=t[s]:"ref"==s?o=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?r.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return C(e,a,i,o,null)}function C(e,t,n,r,s){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++o:s,__i:-1,__u:0};return null==s&&null!=i.vnode&&i.vnode(a),a}function k(){return{current:null}}function S(e){return e.children}function O(e,t){this.props=e,this.context=t}function j(e,t){if(null==t)return e.__?j(e.__,e.__i+1):null;for(var n;tc&&a.sort(u),e=a.shift(),c=a.length,e.__d&&(n=void 0,o=(r=(t=e).__v).__e,s=[],l=[],t.__P&&((n=_({},r)).__v=r.__v+1,i.vnode&&i.vnode(n),U(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,s,null==o?j(r):o,!!(32&r.__u),l),n.__v=r.__v,n.__.__k[n.__i]=n,F(s,n,l),n.__e!=o&&P(n)));T.__r=0}function I(e,t,n,r,i,o,s,a,l,c,u){var d,h,p,f,m,y,b=r&&r.__k||v,_=t.length;for(l=N(n,t,b,l,_),d=0;d<_;d++)null!=(p=n.__k[d])&&(h=-1==p.__i?g:b[p.__i]||g,p.__i=d,y=U(e,p,h,i,o,s,a,l,c,u),f=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&z(h.ref,null,p),u.push(p.ref,p.__c||f,p)),null==m&&null!=f&&(m=f),4&p.__u||h.__k===p.__k?l=A(p,l,e):"function"==typeof p.type&&void 0!==y?l=y:f&&(l=f.nextSibling),p.__u&=-7);return n.__e=m,l}function N(e,t,n,r,i){var o,s,a,l,c,u=n.length,d=u,h=0;for(e.__k=new Array(i),o=0;o0?C(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,a=null,-1!=(c=s.__i=D(s,n,l,d))&&(d--,(a=n[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(i>u?h--:il?h--:h++,s.__u|=4))):e.__k[o]=null;if(d)for(o=0;o(null==l||2&l.__u?0:1))for(i=n-1,o=n+1;i>=0||o=0){if((l=t[i])&&!(2&l.__u)&&s==l.key&&a==l.type)return i;i--}if(o0?e:b(e)?e.map(q):_({},e)}function B(e,t,n,o,s,a,l,c,u){var d,h,p,f,m,v,y,_=n.props,x=t.props,C=t.type;if("svg"==C?s="http://www.w3.org/2000/svg":"math"==C?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=a)for(d=0;d2&&(l.children=arguments.length>3?r.call(arguments,2):n),C(e.type,l,i||e.key,o||e.ref,null)}function K(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach((function(e){e.__e=!0,E(e)}))},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+m++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}r=v.slice,i={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},o=0,s=function(e){return null!=e&&null==e.constructor},O.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),E(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),E(this))},O.prototype.render=S,a=[],c="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},T.__r=0,d=/(PointerCapture)$|Capture$/i,h=0,p=$(!1),f=$(!0),m=0},3356:(e,t,n)=>{"use strict";n.d(t,{M:()=>o});var r=n(4912),i=n(7081);function o(e,t){return(0,r.useMemo)((()=>e?(0,i.ai)(e,t):[]),[e,t])}},3410:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3464:(e,t,n)=>{"use strict";n.d(t,{Uu:()=>o,pp:()=>a,ub:()=>s});var r=n(9443),i=n(5822);function o(e){switch(e){case"name":case"email":return e;case"firstName":return"given-name";case"lastName":return"family-name";case"city":return"address-level2";case"companyName":return"organization";case"country":return"country-name";case"location":return"address-line1";case"phone":return"tel";case"zip":return"postal-code";default:return null}}function s(e){switch(e){case r.xi.NamePrompt:return"name";case r.xi.EmailPrompt:return"email";case r.xi.CompanyPrompt:return"organization";default:return null}}function a(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,i.tU)(),r=arguments.length>3?arguments[3]:void 0;const{botName:o,language:s}=n,a=e.getDocument();if(!a)throw new Error("No document found for bot frame");const l=a.createElement("meta");l.setAttribute("charset","utf8"),a.head.insertBefore(l,a.head.firstElementChild);const c=a.createElement("title"),u=r||`${o} - Leadoo bot`;e.attr({title:u}),c.innerHTML=u,a.head.appendChild(c),s&&a.documentElement.setAttribute("lang",s),t&&(document.documentElement.setAttribute("lang",s),document.title=u)}},3484:(e,t,n)=>{"use strict";n.d(t,{_A:()=>i,gU:()=>o,hl:()=>s});var r=n(5738);const i=(0,r.L)({hasOpened:!1,isOpen:!1,visible:!0}),o=(0,r.L)({hasOpened:!1,isOpen:!1}),s=(0,r.L)({hasOpened:!1,isOpen:!1,isCTAKeyDeleted:!1})},3503:(e,t,n)=>{"use strict";n.d(t,{L7:()=>h,Ud:()=>r,eT:()=>d,rV:()=>i,rz:()=>o});var r,i,o,s=n(1831),a=n(7915);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;te.id===t.id));return c(c({},e),{},n?{items:e.items.map((e=>{if(e.id===t.id){const n=e;return c(c({},n),{},{tokens:[...n.tokens,...t.tokens]})}return e}))}:{items:[...e.items,{finishedStreaming:!1,finishedTyping:!1,id:t.id,messageID:t.messageID,question:t.question,sources:t.sources,suggestions:null,tokens:t.tokens,ts:p(),type:i.AIResponse}]})}case r.AddAIIntent:return c(c({},e),{},{items:[...e.items,{finishedStreaming:!0,finishedTyping:!1,suggestions:null,id:t.id,messageID:t.messageID,question:t.question,sources:t.sources,tokens:t.tokens,ts:p(),type:i.AIIntent}]});case r.AddAISuggestions:{const n=e.items.find((e=>e.type===i.AIResponse&&e.messageID===t.messageID));if(!n)throw new Error(`No existing response for AI message: ${t.messageID}`);return c(c({},e),{},{items:e.items.map((e=>e===n?c(c({},n),{},{suggestions:t.suggestions}):e))})}case r.AddLiveChatEvent:return c(c({},e),{},{items:[...e.items,{id:(0,s.Z0)(),payload:t.payload,text:t.text,ts:p(),type:i.LiveChatEvent}]});case r.AddLeadCriteria:return c(c({},e),{},{items:[...e.items,{id:(0,s.Z0)(),payload:t.payload,ts:p(),type:i.LeadCriteria}]});case r.AddLiveChatInfoMessage:{const n=t.payload.hideTimeout?e.items.map((e=>e.type===i.LiveChatTimeout?c(c({},e),{},{hidden:!0}):e)):e.items;return c(c({},e),{},{items:[...n,{id:(0,s.Z0)(),payload:t.payload.message,ts:p(),type:i.LiveChatInfoMessage}]})}case r.AddUpdateLiveChatMessage:var u;if(t.ownMessage&&t.status){const n=e.items.find((e=>e.type===i.LiveChatMessage&&e.tag===t.tag));if(n)return c(c({},e),{},{items:e.items.map((e=>e.id!==n.id?e:c(c({},e),{},{sender:t.sender,status:t.status,ts:t.timestamp})))})}return c(c({},e),{},{items:[...e.items,{id:(0,s.Z0)(),ownMessage:t.ownMessage,sender:t.sender,status:null!==(u=t.status)&&void 0!==u?u:a.dm.Sending,tag:t.tag,text:t.text,ts:t.timestamp,attachments:t.attachments,type:i.LiveChatMessage}]});case r.AddLiveChatTimeout:return c(c({},e),{},{items:[...e.items,{id:(0,s.Z0)(),ts:p(),type:i.LiveChatTimeout}]});case r.AddQuestion:return c(c({},e),{},{items:[...e.items,{id:(0,s.Z0)(),answers:t.answers,question:t.question,encryptionKey:null,ts:p(),type:i.Question}]});case r.AnswerPrompt:return c(c({},e),{},{items:[...e.items,{answer:t.answer,editable:!!t.editable,freeInput:t.freeInput,id:(0,s.Z0)(),ts:p(),type:i.Answer}]});case r.ClearItems:return c(c({},e),{},{items:[],loading:[],prompt:null,promptAnswered:!1,promptEditingAnswer:null});case r.ClosePrompt:return c(c({},e),{},{prompt:null,promptAnswered:!1,promptEditingAnswer:null});case r.HideLiveChatTimeout:{const t=e.items.map((e=>e.type===i.LiveChatTimeout?c(c({},e),{},{hidden:!0}):e));return c(c({},e),{},{items:t})}case r.Prompt:return c(c({},e),{},{prompt:{id:(0,s.Z0)(),answers:t.answers,question:t.question,encryptionKey:t.encryptionKey,ts:p(),type:i.Question},promptEditingAnswer:t.editingAnswer});case r.SetAIResponseFinished:return c(c({},e),{},{items:e.items.map((e=>e.type===i.AIResponse&&e.id===t.id?c(c({},e),{},{finishedStreaming:!0}):e))});case r.SetAITypingFinished:return c(c({},e),{},{items:e.items.map((e=>e.type===i.AIResponse&&e.id===t.id?c(c({},e),{},{finishedTyping:!0}):e))});case r.SetError:return c(c({},e),{},{error:t.error});case r.SetLoading:return c(c({},e),{},{loading:[...new Set([...e.loading,...t.loading])]});case r.SetPromptAnswered:return c(c({},e),{},{promptAnswered:!!t.answered});case r.SetReady:return c(c({},e),{},{loading:e.loading.filter((e=>!1===t.ready.includes(e)))});case r.SetState:return c(c({},e),t.state);case r.Start:return c(c({},e),{},{loading:[...new Set([...e.loading,o.Next])],started:!0});case r.Reload:return c(c({},e),{error:null,items:[],loading:[],prompt:null,promptAnswered:!1,promptEditingAnswer:null,currentFeedback:"",feedback:{answered:!1,open:!1,submited:[],chatID:""},started:!1});default:throw new Error(`Unknown bot flow action: ${t.type}`)}}function h(){return{error:null,items:[],loading:[],prompt:null,promptAnswered:!1,promptEditingAnswer:null,currentFeedback:"",feedback:{answered:!1,open:!1,submited:[],chatID:""},started:!1}}function p(){return Date.now()}!function(e){e.AddAIIntent="add-ai-intent",e.AddAIPrompt="add-ai-prompt",e.AddAIResponse="add-ai-response",e.AddAISuggestions="add-ai-suggestions",e.AddLeadCriteria="add-lead-criteria",e.AddLiveChatEvent="add-lc-event",e.AddLiveChatInfoMessage="add-lc-info-message",e.AddLiveChatTimeout="add-lc-timeout",e.AddUpdateLiveChatMessage="add-update-lc-message",e.AddQuestion="add-question",e.AnswerPrompt="answer-prompt",e.BotRatingPrompt="bot-rating-prompt",e.VisualBotRating="visual-bot-rating",e.ClearItems="clear-items",e.ClosePrompt="close-prompt",e.HideLiveChatTimeout="hide-lc-timeout",e.Prompt="prompt",e.SetAIResponseFinished="set-ai-response-finished",e.SetAITypingFinished="set-ai-typing-finished",e.SetError="set-error",e.SetLoading="set-loading",e.SetPromptAnswered="set-prompt-answered",e.SetReady="set-ready",e.SetState="set-state",e.Start="start",e.Reload="reload"}(r||(r={})),function(e){e.AIIntent="ai-intent",e.AIPrompt="ai-prompt",e.AIResponse="ai-response",e.Answer="answer",e.LiveChatEvent="lc-event",e.LeadCriteria="lead-criteria",e.LiveChatMessage="lc-message",e.LiveChatInfoMessage="lc-info-message",e.LiveChatTimeout="lc-timeout",e.Question="question"}(i||(i={})),function(e){e.Current="current",e.Next="next"}(o||(o={}))},3609:(e,t,n)=>{"use strict";n.d(t,{P:()=>o});var r=n(4912),i=n(5822);function o(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=(0,r.useMemo)(i.tU,[]),[o,s]=(0,r.useState)(n[e]);if((0,r.useEffect)((()=>{const{_:t}=n,r=s,i=t=>{t===e&&r(n[e])};return t.on("set",i),()=>{t.off("set",i)}}),[n,e]),t&&null==o)throw new Error(`Failed fetching required global: '${String(e)}' is null/undefined`);return o}},3650:(e,t,n)=>{"use strict";function r(e){if(null!==e)return e}n.d(t,{Q:()=>r})},3798:(e,t,n)=>{"use strict";n.d(t,{e:()=>a});var r=n(4023),i=n(9610);const o="a,aside,b,div,footer,header,i,p,strong,span",s=[[e=>(0,r.hL)(e.document.createElement,e),e=>{const t=e.document.createElement("iframe");return e.document.body.appendChild(t),t}],[e=>(0,r.hL)(e.document.body.insertAdjacentHTML,e),e=>{const t=l();return e.document.body.insertAdjacentHTML("afterbegin",``),e.frames[t]}],[e=>{const t=e.document.body.querySelector(o);return!!t&&"string"==typeof t.innerHTML},e=>{const t=[...e.document.body.children].reverse(),n=o.split(","),r=l(),i=t.find((e=>n.includes(e.tagName.toLowerCase())));if(!i)throw new Error("No element found for innerHTML insertion");return i.innerHTML=`${i.innerHTML}`,e.frames[r]}]];async function a(e){return await(0,i.j)(e),new Promise(((t,n)=>{var r;const i=function(e){const t=s.find((t=>{let[n]=t;return n(e)}));if(!t)throw new Error("Found no reliable iframe insertion method");return t[1](e)}(e);if(i.setAttribute("style","display: none; visibility: hidden;"),"complete"===(null===(r=i.contentWindow)||void 0===r||null===(r=r.document)||void 0===r?void 0:r.readyState))return t(i.contentWindow);i.addEventListener("load",(()=>{if(!i.contentWindow)return n(new Error("IFrame loaded but no window available"));t(i.contentWindow)}))}))}function l(){return`sf_${Date.now()}_${Math.floor(999999*Math.random())}`}},3842:(e,t,n)=>{"use strict";n.d(t,{t:()=>i});var r=n(9443);function i(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.__&&e._ instanceof r.bk)return e.__;const n=new r.bk,i={},o=(e,t)=>{n.emit("set",e,t)},s=Object.keys(e);for(const t of s)Object.defineProperty(i,t,{enumerable:!0,get:()=>e[t],set(n){e[t]=n,o(t,n)}});return Object.defineProperty(i,"_",{value:n,configurable:!1,writable:!1,enumerable:!1}),Object.defineProperty(i,"__",{value:i,configurable:!1,writable:!1,enumerable:!1}),t&&setTimeout((()=>{const t=Object.keys(e);for(const n of t)o(n,e[n])}),10),i}},3848:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelQueue=void 0;const r=n(6506),i=n(1419),o=n(854);class s extends r.EventEmitter{constructor(){super(),this._channels={}}get channels(){return this._channels}createChannel(e){if(this.channelExists(e))throw new Error(`Cannot create channel: channel already exists: ${e}`);return this.channels[e]=new i.Channel(e),this.channels[e]}createParallelChannel(e,t){if(this.channelExists(e))throw new Error(`Cannot create channel: channel already exists: ${e}`);const n=this.channels[e]=new o.ParallelChannel(e);return t&&(n.parallelism=t),n}channel(e){return!0!==this.channelExists(e)?this.createChannel(e):this.channels[e]}channelExists(e){return this.channels.hasOwnProperty(e)}}t.ChannelQueue=s},3924:(e,t,n)=>{"use strict";n.d(t,{y:()=>o});var r=n(7266);const i=()=>{};function o(){const e=[];let t=!1;const n=()=>{if(0!==e.length)return t=!0,Promise.resolve().then((()=>{const[t,n,i]=e.shift();let o=t;if("function"==typeof o)try{const e=o();if(!(0,r.y)(e))return void n(e);o=e}catch(e){return void i(e)}if((0,r.y)(o))return o.then((e=>{n(e)}),(e=>(i(e),Promise.resolve())))})).catch(i).then(n);t=!1},o=r=>new Promise(((i,o)=>{e.push([r,i,o]),t||n()}));return{enqueue:o,whenComplete:()=>o(i)}}},3976:(e,t,n)=>{"use strict";n.d(t,{Rm:()=>c,YW:()=>l,aP:()=>u});var r=n(5834);const i="leadoo:bot",o=[];let s,a=!1;function l(e){a||(s=(0,r.hM)(`${i}:${e}`),a=!0)}function c(e){s||(s=(0,r.hM)("leadoo:debug")),s(e)}function u(e){return o.push(e),()=>{const t=o.indexOf(e);t>=0&&o.splice(t,1)}}},3983:(e,t,n)=>{"use strict";n.d(t,{t:()=>g,v:()=>m});var r=n(3162),i=n(4912),o=n(9336),s=n(3089),a=n(2658),l=n(5500),c=n(3976),u=n(7659),d=n(725),h=n(3148),p=n(259),f=n(7915);const m=(0,r.createContext)({});function g(e){const{botCode:t,botTypeName:n,children:g,closeBot:v,customAPI:y,destroyCallbacks:b,openBot:_,showBot:w}=e,[x,C]=(0,i.useState)(!1),k=(0,i.useRef)(null),[S,O]=(0,i.useState)(null),{dispatch:j,emitter:P}=(0,i.useContext)(d.d),[E,T]=(0,i.useState)([]),I=(0,i.useCallback)((e=>(T((t=>[...t,e])),()=>{T((t=>t.filter((t=>t!==e))))})),[]),[N,A]=(0,i.useState)([]),L=(0,i.useCallback)((e=>(A((t=>[...t,e])),()=>{A((t=>t.filter((t=>t!==e))))})),[]);(0,i.useEffect)((()=>{if(b)return T((e=>[...e,...b])),()=>T((e=>e.filter((e=>!1===b.includes(e)))))}),[b]);const D=(0,i.useCallback)((async()=>{await(0,l.S)((async()=>{(0,c.Rm)("api triggered destroy");for(const e of E)try{(0,a.B)(k.current,"API reference"),await e(k.current)}catch(e){console.error(e)}P.emit(f.we.Destroy)}))}),[E]),R=(0,i.useCallback)(((e,t)=>(0,o.M)(e,t)),[]),M=(0,i.useCallback)((e=>(0,c.aP)(e)),[]),$=(0,i.useCallback)((async()=>{(0,c.Rm)("api triggered reload");for(const e of N)try{(0,a.B)(k.current,"API reference"),await e(k.current)}catch(e){console.error(e)}P.emit(f.we.Reload),await(0,h.yQ)()}),[P,N]),U=(0,i.useCallback)((()=>{if(!v)throw new Error("Not implemented for this bot type: close");v()}),[v]),F=(0,i.useCallback)((()=>{if(!_)throw new Error("Not implemented for this bot type: open");_()}),[_]),q=(0,i.useCallback)((()=>{if(!w)throw new Error("Not implemented for this bot type: show");w()}),[w]),B=(0,i.useCallback)((e=>{(0,c.Rm)(`toggle debug: ${!!e}`),j({key:"debug",value:!!e,type:u._q.SetGlobal})}),[j]),z=(0,i.useMemo)((()=>{const e={close:U,destroy:D,getTag:h.bH,onEvent:R,onLogEvent:M,open:F,reload:$,show:q,toggleDebug:B};return k.current=e,e}),[U,D,R,M,F,$,q,B]),[V,H]=(0,i.useState)(null);return(0,i.useEffect)((()=>{t&&((0,p.o)(),C(!0))}),[t]),(0,i.useEffect)((()=>{if(!x||!t)return;const[e,r]=(0,h.Ov)(n,t,null!=y?y:null,z,V);V||H(r),O(e)}),[z,t,n,y,x,V]),(0,s.K)(D),(0,r.h)(m.Provider,{value:{api:null!=S?S:z,registerDestroyCallback:I,registerReloadCallback:L}},g)}},3985:(e,t,n)=>{"use strict";n.d(t,{m:()=>i});var r=n(3162);function i(e){let{freeInput:t,text:n}=e;return t?(0,r.h)("div",{"data-settings":"bot-answer-text",className:"ld-answer-content"},n||"-"):(0,r.h)("div",{"data-settings":"bot-answer-text",className:"ld-answer-content",dangerouslySetInnerHTML:{__html:n||"-"}})}},4023:(e,t,n)=>{"use strict";n.d(t,{hL:()=>u,rH:()=>a,vG:()=>l});const r=/^\[object .+?Constructor\]$/,i=/__restorefunc_bound_method__/;function o(e,t){return function(){for(var n=arguments.length,r=new Array(n),i=0;i2&&void 0!==arguments[2]?arguments[2]:null;const r=e.split(".");let i=t;return{method:r.reduce(((t,n)=>{if(n.trim().length<=0)throw new Error("Path cannot contain empty properties");if(!t[n])throw new Error(`Cannot resolve path (${e}): Property not found: ${n}`);return i=t,t[n]}),i),context:null!=n?n:i}}function a(e,t,n){let r=s(e,t.top);if(!r)throw new Error("Unknown method (top window): "+e);if(r&&!c(r.method,t.top,n)){if(r=s(e,t.safe,r.context),!r)throw new Error("Unknown method (safe window): "+e);if(!c(r.method,t.safe,n))throw new Error("Failed finding a native method for: "+e)}return o(r.method,r.context)}function l(e,t,n,r){const i=e[t];if(u(i,r.window))return o(i,e);const a=s(n,r,e);if(!a)throw new Error("Unknown method (safe window): "+n);if(!u(a.method,r.window))throw new Error("Failed finding a native method prototype: "+n);return o(a.method,a.context)}function c(e,t,n){return"string"==typeof e?function(e,t,n){const r=s(e,t);return!!r&&c(r.method,t,n)}(e,t,n):u(e,n)}function u(e,t){const n=function(e){const t=e.Object.prototype.toString;return new RegExp("^"+String(t).replace(/[.*+?^${}()|[\]\/\\]/g,"\\$&").replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$")}(t);var o=typeof e;const s="function"===o?t.Function.prototype.toString.call(e):null;return s?i.test(s)||n.test(s):e&&"object"==o&&r.test(toString.call(e))||!1}},4089:(e,t,n)=>{"use strict";n.d(t,{G:()=>c});var r=n(2658),i=n(931),o=n(5822),s=n(3976),a=n(7915);const l="DV source path";function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();const{dynVarEnvCollected:t,dynamicVarsEnv:n}=e;return Array.isArray(n)&&0!==n.length?((0,s.Rm)(`collecting env vars: ${n.length} total`),n.reduce(((e,n)=>{let o=null;const{id:c,source:d,sourcePath:h}=n;if(t.indexOf(c)>=0)return e;if(d===a.De.Window){(0,r.B)(h,l);o=u((0,i.F)(h,window),n.type)}else if(d===a.De.URL){(0,r.B)(h,l);o=u((0,i.At)(h),n.type)}else if(d===a.De.Document){(0,r.B)(h,l);o=u((0,i.c1)(h),n.type)}return null===o?e:(t.push(c),(0,s.Rm)(`collect env var: ${c} = ${JSON.stringify(o)} (${d} @ ${h})`),[...e,{id:c,value:o}])}),[])):[]}function u(e,t){return null===e?null:t===a.M0.Number?/\./.test(e)?parseFloat(e):parseInt(e,10):e}},4154:(e,t,n)=>{"use strict";n.d(t,{YA:()=>c,ZI:()=>u,nr:()=>h});var r=n(9443),i=n(2276),o=n(5822),s=n(7915);const a=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,l=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;function c(){return d()?(0,r.AM)(new Promise(((e,t)=>{navigator.webkitTemporaryStorage.queryUsageAndQuota(((t,n)=>{e(n{t(new i.GU(e,"Failed querying storage quota"))}))})),500,!1,"Timed-out waiting for Incognito check"):Promise.resolve(!1)}function u(){const e=(0,o.tU)();if(null!==e.deviceType)return e.deviceType;return e.deviceType=function(){let e=s.bq.Desktop;return(a.test(navigator.userAgent)||l.test(navigator.userAgent.substr(0,4)))&&(e=s.bq.Mobile),e}()}function d(){return-1!==navigator.userAgent.indexOf("Chrome")}function h(){return-1!==navigator.userAgent.indexOf("Safari")&&!d()}},4215:(e,t,n)=>{"use strict";n.d(t,{B:()=>s,l:()=>a});var r=n(8949),i=n(1981),o=n(7547);function s(e,t){return(0,r.zk)(e,t).then((e=>{if(e){let t=`Email validation failed: ${e}`;return"free"===e&&(t=(0,i.t)("invalid.free-email")),t}})).catch((e=>(0,o.k)(e)))}function a(e,t){return(0,r.Jd)(e,t).catch((e=>(0,o.k)(e)))}},4256:(e,t,n)=>{var r=n(3162),i=n(4912);function o(e,t){for(var n in t)e[n]=t[n];return e}function s(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function a(e,t){var n=t(),r=i.useState({t:{__:n,u:t}}),o=r[0].t,s=r[1];return i.useLayoutEffect((function(){o.__=n,o.u=t,l(o)&&s({t:o})}),[e,n,t]),i.useEffect((function(){return l(o)&&s({t:o}),e((function(){l(o)&&s({t:o})}))}),[e]),n}function l(e){var t,n,r=e.u,i=e.__;try{var o=r();return!((t=i)===(n=o)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}function c(e){e()}function u(e){return e}function d(){return[!1,c]}var h=i.useLayoutEffect;function p(e,t){this.props=e,this.context=t}function f(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:s(this.props,e)}function i(t){return this.shouldComponentUpdate=n,r.createElement(e,t)}return i.displayName="Memo("+(e.displayName||e.name)+")",i.prototype.isReactComponent=!0,i.__f=!0,i}(p.prototype=new r.Component).isPureReactComponent=!0,p.prototype.shouldComponentUpdate=function(e,t){return s(this.props,e)||s(this.state,t)};var m=r.options.__b;r.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),m&&m(e)};var g="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function v(e){function t(t){var n=o({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=g,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var y=function(e,t){return null==e?null:r.toChildArray(r.toChildArray(e).map(t))},b={map:y,forEach:y,count:function(e){return e?r.toChildArray(e).length:0},only:function(e){var t=r.toChildArray(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:r.toChildArray},_=r.options.__e;r.options.__e=function(e,t,n,r){if(e.then)for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);_(e,t,n,r)};var w=r.options.unmount;function x(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=o({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return x(e,t,n)}))),e}function C(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return C(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function k(){this.__u=0,this.o=null,this.__b=null}function S(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function O(e){var t,n,i;function o(o){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){i=e})),i)throw i;if(!n)throw t;return r.createElement(n,o)}return o.displayName="Lazy",o.__f=!0,o}function j(){this.i=null,this.l=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),w&&w(e)},(k.prototype=new r.Component).__c=function(e,t){var n=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(n);var i=S(r.__v),o=!1,s=function(){o||(o=!0,n.__R=null,i?i(a):a())};n.__R=s;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=C(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},k.prototype.componentWillUnmount=function(){this.o=[]},k.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=x(this.__b,n,i.__O=i.__P)}this.__b=null}var o=t.__a&&r.createElement(r.Fragment,null,e.fallback);return o&&(o.__u&=-33),[r.createElement(r.Fragment,null,t.__a?null:e.children),o]};var P=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.p.removeChild(e)}}}r.render(r.createElement(E,{context:t.context},e.__v),t.h)}function I(e,t){var n=r.createElement(T,{__v:e,p:t});return n.containerInfo=t,n}(j.prototype=new r.Component).__a=function(e){var t=this,n=S(t.__v),r=t.l.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),P(t,e,r)):i()};n?n(o):o()}},j.prototype.render=function(e){this.i=null,this.l=new Map;var t=r.toChildArray(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},j.prototype.componentDidUpdate=j.prototype.componentDidMount=function(){var e=this;this.l.forEach((function(t,n){P(e,n,t)}))};var N="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,A=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,L=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,D=/[A-Z0-9]/g,R="undefined"!=typeof document,M=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function $(e,t,n){return null==t.__k&&(t.textContent=""),r.render(e,t),"function"==typeof n&&n(),e?e.__c:null}function U(e,t,n){return r.hydrate(e,t),"function"==typeof n&&n(),e?e.__c:null}r.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(r.Component.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var F=r.options.event;function q(){}function B(){return this.cancelBubble}function z(){return this.defaultPrevented}r.options.event=function(e){return F&&(e=F(e)),e.persist=q,e.isPropagationStopped=B,e.isDefaultPrevented=z,e.nativeEvent=e};var V,H={enumerable:!1,configurable:!0,get:function(){return this.class}},W=r.options.vnode;r.options.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={},o=-1===n.indexOf("-");for(var s in t){var a=t[s];if(!("value"===s&&"defaultValue"in t&&null==a||R&&"children"===s&&"noscript"===n||"class"===s||"className"===s)){var l=s.toLowerCase();"defaultValue"===s&&"value"in t&&null==t.value?s="value":"download"===s&&!0===a?a="":"translate"===l&&"no"===a?a=!1:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?s="ondblclick":"onchange"!==l||"input"!==n&&"textarea"!==n||M(t.type)?"onfocus"===l?s="onfocusin":"onblur"===l?s="onfocusout":L.test(s)&&(s=l):l=s="oninput":o&&A.test(s)?s=s.replace(D,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===l&&i[s=l]&&(s="oninputCapture"),i[s]=a}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=r.toChildArray(t.children).forEach((function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=r.toChildArray(t.children).forEach((function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",H)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=N,W&&W(e)};var G=r.options.__r;r.options.__r=function(e){G&&G(e),V=e.__c};var Q=r.options.diffed;r.options.diffed=function(e){Q&&Q(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),V=null};var K={ReactCurrentDispatcher:{current:{readContext:function(e){return V.__n[e.__c].props.value},useCallback:i.useCallback,useContext:i.useContext,useDebugValue:i.useDebugValue,useDeferredValue:u,useEffect:i.useEffect,useId:i.useId,useImperativeHandle:i.useImperativeHandle,useInsertionEffect:h,useLayoutEffect:i.useLayoutEffect,useMemo:i.useMemo,useReducer:i.useReducer,useRef:i.useRef,useState:i.useState,useSyncExternalStore:a,useTransition:d}}};function Y(e){return r.createElement.bind(null,e)}function J(e){return!!e&&e.$$typeof===N}function Z(e){return J(e)&&e.type===r.Fragment}function X(e){return!!e&&!!e.displayName&&("string"==typeof e.displayName||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function ee(e){return J(e)?r.cloneElement.apply(null,arguments):e}function te(e){return!!e.__k&&(r.render(null,e),!0)}function ne(e){return e&&(e.base||1===e.nodeType&&e)||null}var re=function(e,t){return e(t)},ie=function(e,t){return e(t)},oe=r.Fragment,se=J,ae={useState:i.useState,useId:i.useId,useReducer:i.useReducer,useEffect:i.useEffect,useLayoutEffect:i.useLayoutEffect,useInsertionEffect:h,useTransition:d,useDeferredValue:u,useSyncExternalStore:a,startTransition:c,useRef:i.useRef,useImperativeHandle:i.useImperativeHandle,useMemo:i.useMemo,useCallback:i.useCallback,useContext:i.useContext,useDebugValue:i.useDebugValue,version:"18.3.1",Children:b,render:$,hydrate:U,unmountComponentAtNode:te,createPortal:I,createElement:r.createElement,createContext:r.createContext,createFactory:Y,cloneElement:ee,createRef:r.createRef,Fragment:r.Fragment,isValidElement:J,isElement:se,isFragment:Z,isMemo:X,findDOMNode:ne,Component:r.Component,PureComponent:p,memo:f,forwardRef:v,flushSync:ie,unstable_batchedUpdates:re,StrictMode:oe,Suspense:k,SuspenseList:j,lazy:O,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:K};Object.defineProperty(t,"Component",{enumerable:!0,get:function(){return r.Component}}),Object.defineProperty(t,"Fragment",{enumerable:!0,get:function(){return r.Fragment}}),Object.defineProperty(t,"createContext",{enumerable:!0,get:function(){return r.createContext}}),Object.defineProperty(t,"createElement",{enumerable:!0,get:function(){return r.createElement}}),Object.defineProperty(t,"createRef",{enumerable:!0,get:function(){return r.createRef}}),t.Children=b,t.PureComponent=p,t.StrictMode=oe,t.Suspense=k,t.SuspenseList=j,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K,t.cloneElement=ee,t.createFactory=Y,t.createPortal=I,t.default=ae,t.findDOMNode=ne,t.flushSync=ie,t.forwardRef=v,t.hydrate=U,t.isElement=se,t.isFragment=Z,t.isMemo=X,t.isValidElement=J,t.lazy=O,t.memo=f,t.render=$,t.startTransition=c,t.unmountComponentAtNode=te,t.unstable_batchedUpdates=re,t.useDeferredValue=u,t.useInsertionEffect=h,t.useSyncExternalStore=a,t.useTransition=d,t.version="18.3.1",Object.keys(i).forEach((function(e){"default"===e||t.hasOwnProperty(e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}))},4351:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.createToken=void 0;var o=n(5026);Object.defineProperty(t,"createToken",{enumerable:!0,get:function(){return o.createToken}}),i(n(1417),t)},4456:(e,t,n)=>{"use strict";n.d(t,{Ke:()=>I,Kj:()=>j,T2:()=>x,YC:()=>T,_N:()=>E,_Q:()=>A,bD:()=>L,jx:()=>N,wD:()=>P});n(4351);var r=n(7846),i=n(2658),o=n(7588),s=n(50),a=n(5822),l=n(3976),c=n(7915);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const i=window,c=!(!e||!t.preview),{companyCode:u}=t;if(c)return(0,l.Rm)("analytics script insertion disabled by preview"),Promise.resolve();if(!1===t.insertAnalytics)return(0,l.Rm)("analytics script insertion disabled by company"),Promise.resolve();let d=null;if(i.Leadoo&&i.Leadoo.Analytics)d=Promise.resolve();else{(0,l.Rm)("inserting analytics script");const e=(0,s.n)("script");e.src="https://bot.leadoo.com/i/al/lanlt.js?code=[COMPANY]".replace("[COMPANY]",u),e.async=!0;let t=!1;d=new Promise((n=>{const r=setTimeout((()=>{t=!0,(0,l.Rm)("timed-out waiting for analytics script to load"),n()}),_);e.addEventListener("load",(()=>{O((()=>{clearTimeout(r),t?(0,l.Rm)("analytics script loaded late"):((0,l.Rm)("analytics script connected"),n())}))})),e.addEventListener("error",(()=>{clearTimeout(r),(0,l.Rm)("analytics script failed to load"),n()}))})),i.document.body.appendChild(e)}const h=e&&t.gtm||null;if(O((e=>{(0,l.Rm)(`analytics system active (sending: ${r.toString()})`),e.toggleTransfer(r),h&&((0,l.Rm)(`bot-specific GTM: ${h}`),e.setGTMCode(h)),S(b),e.pageVisit()})),e){const e=t;return d.then((()=>(0,o.M)(e))).then((()=>{n&&((0,l.Rm)("inserting GTM script"),O((e=>{e.insertGTMScript().catch((e=>{console.error(e)}))}))),e.consent&&O((e=>{(0,l.Rm)("analytics tracking enabled"),e.toggleTracking(!0),w||(e.trackID(),w=!0),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,a.tU)();if(e.preview)return;O((t=>{t.onTrackingID((t=>{(0,l.Rm)(`received device ID from analytics: ${t}`),e.deviceID=t}))}))}()}))}))}return d.then((()=>(0,o.M)(t)))}function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,a.tU)();return{bot_category:e.category,bot_name:e.botInternalName,bot_nickname:e.botName,dvTexts:e.dvTexts,lead_id:e.leadID}}function k(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,a.tU)();const{botCode:t,botID:n,companyID:r,token:o}=e;(0,i.B)(n,"bot ID"),(0,i.B)(t,"bot code");const s={bot_id:n,bot_code:t,company_id:r,discussion_id:null};return o&&(s.discussion_id=o),s}function S(e){(0,l.Rm)(` ∓ ${e} (sent)`)}function O(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;Array.isArray(t.ldanalytics)||(t.ldanalytics=[]),t.ldanalytics.push(e)}function j(e,t,n,o){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:(0,a.tU)(),l=arguments.length>5?arguments[5]:void 0;const{answers:u,gtmDL:h}=s;s.preview||O((a=>{S(p),a.trackEvent(p,d(d({},k(s)),{},{answer_ids:t||[],answer_text:n,answer_json:o,question_id:e.id}));const f=function(e,t){return[c.xi.CompanyPrompt,c.xi.ContactForm,c.xi.CTAForm,c.xi.CustomForm,c.xi.EmailPrompt,c.xi.LocationForm,c.xi.NamePrompt,c.xi.TextPrompt,c.xi.PhonePrompt].includes(e.type)?"":t}(e,n);if((0,i.B)(u,"answers"),s.gtmDisc||(s.gtmDisc=!0,a.trackGTMEvent("DISCUSSION",s.module,f,l||(0,r.WN)(u,t).join(","),C(s),h)),e.type===c.xi.SingleChoice||e.type===c.xi.SingleChoiceURL){const[e]=t,n=u.find((t=>t.id===e));if(!n)throw new Error("No answer found for selected single-choice option");a.trackGTMEvent("GTM",s.module,f,n.label_name,C(s),h),n.gtm_event_name&&a.trackGTMEvent(n.gtm_event_name,s.module,f,n.label_name,C(s),h)}else if(e.type===c.xi.AI)if(n&&0===t.length);else{const[e]=t,n=u.find((t=>t.id===e));if(!n)throw new Error("No answer found for selected AI option");a.trackGTMEvent("GTM",s.module,f,n.label_name,C(s),h),n.gtm_event_name&&a.trackGTMEvent(n.gtm_event_name,s.module,f,n.label_name,C(s),h)}}))}function P(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,a.tU)();e.preview||O((t=>{S(f),t.trackEvent(f,k(e))}))}function E(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,a.tU)();t.preview||O((n=>{S(y),n.trackEvent(y,d(d({},k(t)),{},{answer_json:t.lcData?t.lcData:{},lead_id:e})),n.trackGTMEvent("LEAD",t.module,"",t.labelTexts.join(","),C(t),t.gtmDL)}))}function T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,a.tU)();t.preview||O((n=>{S(v),n.trackEvent(v,d(d({},k(t)),{},{answer_json:e}))}))}function I(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,a.tU)();t.preview||O((n=>{S(g),n.trackEvent(g,d(d({},k(t)),{},{lc_channel:e})),n.trackGTMEvent("LC_TRIGGER",t.module,"","",C(t),t.gtmDL)}))}function N(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,a.tU)();e.preview||O((t=>{t.trackGTMEvent("USER_TRIGGER",e.module,"","",C(e),e.gtmDL)}))}function A(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,a.tU)();e.preview||O((t=>{S(m),t.trackEvent(m,k(e)),t.trackGTMEvent("TRIGGER",e.module,"","",C(e),e.gtmDL)}))}function L(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,a.tU)()).preview||O((e=>{w||(e.toggleTracking(!0),e.trackID(),w=!0)}))}},4486:(e,t,n)=>{"use strict";n.r(t),n.d(t,{EventEmitter:()=>r,default:()=>i});var r=n(9374);const i=r},4543:(e,t,n)=>{"use strict";n.d(t,{An:()=>p,KI:()=>h});var r=n(9443),i=n(973),o=n(2658),s=n(5822),a=n(3842);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)(),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,i.d)();if(t.tag)throw new Error(`Cannot register tag '${e}': a tag is already registered: ${t.tag}`);if(t.tag=e,n.tags||(n.tags={}),n.tags[e]){const t=n.tags[e];for(const e in d)void 0===t[e]&&(t[e]=d[e])}else n.tags[e]=c({},d)}function p(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,i.d)();(0,o.B)(n.tags[e],"API tag instance");const s=(0,a.t)(n.tags[e],!0),l=Object.keys(d),c=r=>{l.includes(r)&&t(n.tags[e])};return s._.on("set",c),(0,r.oq)(n.tags,e,s,{configurable:!0,enumerable:!0,writable:!0}),()=>{s._.off("set",c)}}},4817:(e,t,n)=>{"use strict";n.d(t,{GM:()=>Fn,Go:()=>Re,Kj:()=>Mn,go:()=>Ae});var r=n(4486);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t{Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelQueue=void 0;const r=n(345),i=n(597),o=n(452);class s extends r.EventEmitter{constructor(){super(),this._channels={}}get channels(){return this._channels}createChannel(e){if(this.channelExists(e))throw new Error(`Cannot create channel: channel already exists: ${e}`);return this.channels[e]=new i.Channel(e),this.channels[e]}createParallelChannel(e,t){if(this.channelExists(e))throw new Error(`Cannot create channel: channel already exists: ${e}`);const n=this.channels[e]=new o.ParallelChannel(e);return t&&(n.parallelism=t),n}channel(e){return!0!==this.channelExists(e)?this.createChannel(e):this.channels[e]}channelExists(e){return this.channels.hasOwnProperty(e)}}t.ChannelQueue=s},126:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseArguments=void 0;const r=n(211);t.parseArguments=function(e){let t,n="";if(0===e.length)t={};else if(r.isError(e[0]))t={cause:e[0]},n=e.slice(1).join(" ")||"";else if(e[0]&&"object"==typeof e[0])t=Object.assign({},e[0]),n=e.slice(1).join(" ")||"";else{if("string"!=typeof e[0])throw new Error("Invalid arguments passed to Layerr");t={},n=n=e.join(" ")||""}return{options:t,shortMessage:n}}},162:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(597),t),i(n(452),t),i(n(86),t),i(n(978),t),i(n(791),t)},201:(e,t,n)=>{const r=n(714);e.exports=function(e){let t,n,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"maxAge";const s=async()=>{if(void 0!==t)return;const s=async s=>{i=r();const a=s[1][o]-Date.now();return a<=0?(e.delete(s[0]),void i.resolve()):(t=s[0],n=setTimeout((()=>{e.delete(s[0]),i&&i.resolve()}),a),"function"==typeof n.unref&&n.unref(),i.promise)};try{for(const t of e)await s(t)}catch(e){}t=void 0},a=e.set.bind(e);return e.set=(r,o)=>{e.has(r)&&e.delete(r);const l=a(r,o);return t&&t===r&&(t=void 0,void 0!==n&&(clearTimeout(n),n=void 0),void 0!==i&&(i.reject(void 0),i=void 0)),s(),l},s(),e}},211:(e,t)=>{function n(e){return"[object Error]"===(t=e,Object.prototype.toString.call(t))||e instanceof Error;var t}Object.defineProperty(t,"__esModule",{value:!0}),t.isError=t.inherit=t.assertError=void 0,t.assertError=function(e){if(!n(e))throw new Error("Parameter was not an error")},t.inherit=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.isError=n},249:(e,t)=>{t.MS=t.dM=void 0;const n={};function r(e){const t=n[e];if(!t)throw new Error(`No interval found for ID: ${e}`);if(null!==t.timer)throw new Error(`Interval already running on ID: ${e}`);t.timer=setTimeout((()=>{if(!t.timer)return;let n;try{n=t.fn()}catch(e){}if(n&&"function"==typeof n.then){const i=()=>{t.timer&&(t.timer=null,r(e))};n.then(i,i)}else t.timer=null,r(e)}),t.delay)}t.dM=function(e){e&&n[e]&&(clearTimeout(n[e].timer),n[e].timer=null,delete n[e])},t.MS=function(e,t){const i=`${Date.now()}:${Math.floor(1e6*Math.random())}`;return n[i]={delay:t,fn:e,timer:null},r(i),i}},278:(e,t,n)=>{const r=n(201);class i{constructor(e,t){if(this.maxAge=e,this[Symbol.toStringTag]="Map",this.data=new Map,r(this.data),t)for(const[e,n]of t)this.set(e,n)}get size(){return this.data.size}clear(){this.data.clear()}delete(e){return this.data.delete(e)}has(e){return this.data.has(e)}get(e){const t=this.data.get(e);if(t)return t.data}set(e,t){return this.data.set(e,{maxAge:Date.now()+this.maxAge,data:t}),this}values(){return this.createIterator((e=>e[1].data))}keys(){return this.data.keys()}entries(){return this.createIterator((e=>[e[0],e[1].data]))}forEach(e,t){for(const[n,r]of this.entries())e.apply(t,[r,n,this])}[Symbol.iterator](){return this.entries()}*createIterator(e){for(const t of this.data.entries())yield e(t)}}e.exports=i},334:e=>{function t(e,t,n){var r,i,o,s,a;function l(){var c=Date.now()-s;c=0?r=setTimeout(l,t-c):(r=null,n||(a=e.apply(o,i),o=i=null))}null==t&&(t=100);var c=function(){o=this,i=arguments,s=Date.now();var c=n&&!r;return r||(r=setTimeout(l,t)),c&&(a=e.apply(o,i),o=i=null),a};return c.clear=function(){r&&(clearTimeout(r),r=null)},c.flush=function(){r&&(a=e.apply(o,i),o=i=null,clearTimeout(r),r=null)},c}t.debounce=t,e.exports=t},345:e=>{e.exports=r},452:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParallelChannel=void 0;const r=n(597);class i extends r.Channel{constructor(e){super(e),this._parallelism=2,this._runningTasks=[],this.canRunAcrossTaskTypes=!1}get isEmpty(){return super.isEmpty&&this._runningTasks.length<=0}get parallelism(){return this._parallelism}get runningTasks(){return this._runningTasks}set parallelism(e){const t=Math.max(e,1);this._parallelism=t}_runNextItem(){if(0===this.runningTasks.length&&0===this.tasks.length)return void(()=>{this.isRunning=!1,this.emit("stopped")})();let e=this.parallelism-this.runningTasks.length;if(!(e<=0))for(;e>0;){if(!this.canRunAcrossTaskTypes&&this.runningTasks.length>0&&this.tasks.length>0&&this.runningTasks[0].type!==this.tasks[0].type)return;e-=1;const t=this.retrieveNextItem();if(!t)return;this.runningTasks.push(t),t.execute().then((()=>{this.runningTasks.splice(this.runningTasks.indexOf(t),1),this._runNextItem()}))}}}t.ParallelChannel=i},468:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Layerr=void 0;const r=n(211),i=n(126);function o(e,t){const n=[...arguments];if(this instanceof o==0)throw new Error("Cannot invoke 'Layerr' like a function: It must be called with 'new'");const{options:r,shortMessage:s}=i.parseArguments(n);this.name="Layerr",r.name&&"string"==typeof r.name&&(this.name=r.name);let a=s;if(r.cause&&(Object.defineProperty(this,"_cause",{value:r.cause}),a=`${a}: ${r.cause.message}`),this.message=a,Object.defineProperty(this,"_info",{value:{}}),r.info&&"object"==typeof r.info&&Object.assign(this._info,r.info),Error.call(this,a),Error.captureStackTrace){const e=r.constructorOpt||this.constructor;Error.captureStackTrace(this,e)}return this}t.Layerr=o,r.inherit(o,Error),o.prototype.cause=function(){return o.cause(this)||void 0},o.prototype.toString=function(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e},o.cause=function(e){return r.assertError(e),r.isError(e._cause)?e._cause:null},o.fullStack=function(e){r.assertError(e);const t=o.cause(e);return t?`${e.stack}\ncaused by: ${o.fullStack(t)}`:e.stack},o.info=function(e){r.assertError(e);const t={},n=o.cause(e);return n&&Object.assign(t,o.info(n)),e._info&&Object.assign(t,e._info),t}},585:e=>{var t=1e3,n=60*t,r=60*n,i=24*r,o=7*i;function s(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,a){a=a||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(s){var a=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*o;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===l&&isFinite(e))return a.long?function(e){var o=Math.abs(e);return o>=i?s(e,o,i,"day"):o>=r?s(e,o,r,"hour"):o>=n?s(e,o,n,"minute"):o>=t?s(e,o,t,"second"):e+" ms"}(e):function(e){var o=Math.abs(e);return o>=i?Math.round(e/i)+"d":o>=r?Math.round(e/r)+"h":o>=n?Math.round(e/n)+"m":o>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},597:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Channel=void 0;const i=n(345),o=n(625),s=n(978),a=n(791);function l(e,t){const{type:n,created:r}=e,{type:i,created:o}=t;return n===a.TaskPriority.High&&i!==a.TaskPriority.High?-1:i===a.TaskPriority.High&&n!==a.TaskPriority.High?1:i===a.TaskPriority.Tail&&n!==a.TaskPriority.Tail?-1:n===a.TaskPriority.Tail&&i!==a.TaskPriority.Tail?1:r=0;t-=1)this.tasks[t].type===e&&this.tasks.splice(t,1);else this.tasks.splice(0,1/0)}enqueue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.TaskPriority.Normal,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(n){const e=this.getStackedItems(n);if(e.length>0)return e[e.length-1].queuedPromise}const i=new s.Task(e,t,n);return"number"==typeof r&&r>=0&&(i.timeLimit=r),this.tasks.push(i),this.sort(),this.autostart&&this.start(),i.queuedPromise}getStackedItems(e){return this.tasks.filter((t=>t.stack&&t.stack===e))}retrieveNextItem(){return this.tasks.shift()}sort(){this.tasks.sort(l)}start(){return!this.isRunning&&(this.emit("started"),this.isRunning=!0,setTimeout((()=>this._runNextItem()),0),!0)}waitForEmpty(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(this,void 0,void 0,(function*(){const{throwForFailures:t=!1}=e;if(yield new Promise((e=>{if(this.isEmpty)return e();this.once("stopped",(()=>{e()}))})),t&&this._taskErrors.length>0)throw new o.Layerr(this._taskErrors[0],"Enqueued task failed")}))}_runNextItem(){const e=this.retrieveNextItem();e?e.execute(this._tasksThrow).then((()=>{e.error&&this._taskErrors.push(e.error)})).then((()=>this._runNextItem())).catch((e=>{console.error(e)})):(this.isRunning=!1,this.emit("stopped"))}}t.Channel=c},621:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.createToken=void 0;var o=n(896);Object.defineProperty(t,"createToken",{enumerable:!0,get:function(){return o.createToken}}),i(n(684),t)},625:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Layerr=void 0;var o=n(468);Object.defineProperty(t,"Layerr",{enumerable:!0,get:function(){return o.Layerr}}),i(n(784),t)},684:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},714:e=>{e.exports=()=>{const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}},745:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}l((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(n(714));function s(e){let t,n,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"maxAge";const a=()=>r(this,void 0,void 0,(function*(){if(void 0!==t)return;const a=a=>r(this,void 0,void 0,(function*(){i=o.default();const r=a[1][s]-Date.now();return r<=0?(e.delete(a[0]),void i.resolve()):(t=a[0],n=setTimeout((()=>{e.delete(a[0]),i&&i.resolve()}),r),"function"==typeof n.unref&&n.unref(),i.promise)}));try{for(const t of e)yield a(t)}catch(e){}t=void 0})),l=e.set.bind(e);return e.set=(r,o)=>{e.has(r)&&e.delete(r);const s=l(r,o);return t&&t===r&&(t=void 0,void 0!==n&&(clearTimeout(n),n=void 0),void 0!==i&&(i.reject(void 0),i=void 0)),a(),s},a(),e}t.default=s,e.exports=s,e.exports.default=s},784:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},791:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TaskPriority=t.ErrorCode=void 0,function(e){e.TaskTimeout="TASKTIMEOUT"}(t.ErrorCode||(t.ErrorCode={})),(n=t.TaskPriority||(t.TaskPriority={})).Normal="normal",n.High="high-priority",n.Tail="tail"},896:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createToken=void 0,t.createToken=function(){var e=[],t=!1;return{cancel:function(){if(!t){t=!0;for(var n=0,r=e;n=0)throw new Error("Callback already registered");var r;return e.push(n),t&&(r=setTimeout(n,0)),function(){clearTimeout(r);var t=e.indexOf(n);t>=0&&e.splice(t,1)}},throwIfCancelled:function(e){if(t)throw new Error(e||"Token was cancelled")}}}},909:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeLimit=void 0;const r=n(625),i=n(791);t.timeLimit=function(e,t){let n;return Promise.race([e,new Promise(((e,o)=>{n=setTimeout((()=>{o(new r.Layerr({info:{code:i.ErrorCode.TaskTimeout}},`Timed-out waiting for task: ${t} ms`))}),t)}))]).then((e=>(clearTimeout(n),e)))}},978:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Task=void 0;const i=n(909),o=n(791);t.Task=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.TaskPriority.Normal,n=arguments.length>2?arguments[2]:void 0;if(this._error=null,this._rejectFn=null,this._resolveFn=null,this._stack=null,e instanceof Promise!=1&&"function"!=typeof e)throw new Error("Invalid task item: Expected a Promise or Function");this._target="function"==typeof e?e:()=>e,this._stack=null!=n?n:null,this._type=t,this._timeLimit=-1,this._resolveFn=null,this._rejectFn=null,this._queuedPromise=new Promise(((e,t)=>{this._resolveFn=e,this._rejectFn=t}));const r=new Date;this._created=r.getTime()}get created(){return this._created}get error(){return this._error}get queuedPromise(){return this._queuedPromise}get stack(){return this._stack}get target(){return this._target}get timeLimit(){return this._timeLimit}get type(){return this._type}set timeLimit(e){this._timeLimit=e}execute(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t,n;return r(this,void 0,void 0,(function*(){const r=this.target;let o;try{o=r()}catch(r){return this._error=r,e?null===(t=this._rejectFn)||void 0===t||t.call(this,r):null===(n=this._resolveFn)||void 0===n||n.call(this),Promise.resolve()}let s=o instanceof Promise?o:Promise.resolve(o);this.timeLimit>=0&&(s=(0,i.timeLimit)(s,this.timeLimit)),yield s.then((e=>{var t;null===(t=this._resolveFn)||void 0===t||t.call(this,e)})).catch((t=>{var n,r;this._error=t,e?null===(n=this._rejectFn)||void 0===n||n.call(this,t):null===(r=this._resolveFn)||void 0===r||r.call(this)}))}))}}},991:e=>{e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){function r(e,t){for(var n=0;n0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},o=function(){};function s(e,t,n){if(void 0===n&&(n={}),n["content-type"]&&n["content-type"].indexOf("application/json")>=0)try{return e&&"string"==typeof e?JSON.parse(e):e}catch(e){}return e}function a(e){return e?e.trim().split(/\r\n|\n/g).reduce((function(e,t){var n=i(t.split(/:(.+)/),2),r=n[0],o=n[1];return r&&o&&(e[r.toLowerCase()]=o.trim()),e}),{}):{}}function l(e){var t=e.url,n=e.method,i=void 0===n?"GET":n,l=e.headers,u=void 0===l?{}:l,d=e.body,h=void 0===d?null:d,p=e.XMLHR,f=void 0===p?XMLHttpRequest:p,m=e.withCredentials,g=void 0!==m&&m,v=e.parser,y=void 0===v?s:v,b=e.onProgress,_=void 0===b?o:b,w=e.autoContentType,x=void 0===w||w,C=e.timeout,k=void 0===C?null:C;return new Promise((function(n,o){if(e.data){var s=new Error("sendRequest uses 'body' rather than 'data', but saw 'data' property");return s.code="config",o(s)}var l,d,p,m,v=Object.assign({},u),b=h;x&&b&&"object"==typeof b&&null===c(v,"Content-Type")&&(b=JSON.stringify(b),l=v,p=(d="Content-Type").toLowerCase(),m=r(Object.keys(l),(function(e){return e.toLowerCase()===p}))||d,l[m]="application/json");var w=new f;w.open(i,t,!0),k&&(w.timeout=k,w.ontimeout=function(){var e=new Error("Requested timed-out after "+k+" milliseconds");e.code="timeout",o(e)}),w.withCredentials="boolean"==typeof g&&g,Object.keys(v).map((function(e){w.setRequestHeader(e,v[e])})),w.upload.addEventListener("progress",(function(e){if(e.lengthComputable){var t=Math.round(100*e.loaded/e.total);isNaN(t)||_(t)}})),w.onerror=function(){var e="Request error ("+w.status+" "+w.statusText+", state: "+w.readyState+"): "+i+" "+t;w.responseText&&(e=e+": "+w.responseText.substring(0,50));var n=new Error(e);n.status=w.status,n.statusText=w.statusText,o(n)},w.onreadystatechange=function(){if(4===w.readyState)if(w.status>=200&&w.status<300||302===w.status||304===w.status){var e=a(w.getAllResponseHeaders());n({_req:w,body:y(w.responseText,w.status,e),headers:e,status:w.status,statusText:w.statusText})}else{var r={};try{r=a(w.getAllResponseHeaders())}catch(e){}var s=r["x-ld-req"]||"",l=(s?"Request failed ("+s+")":"Request failed")+" ("+w.status+" "+w.statusText+"): "+i+" "+t;w.responseText&&(l=l+": "+w.responseText.substring(0,50));var c=new Error(l);c.status=w.status,c.statusText=w.statusText,o(c)}},w.send(b)}))}function c(e,t){var n=t.toLowerCase(),i=r(Object.keys(e),(function(e){return e.toLowerCase()===n}))||t;return e[i]?{key:i,value:e[i]}:null}},function(e,t){},function(e,t,n){n.r(t);var r=n(0);n.d(t,"getHeader",(function(){return r.a})),n.d(t,"sendRequest",(function(){return r.b}));var i=n(1);for(var o in i)["default","getHeader","sendRequest"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(o)}])}},l={};function c(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return a[e].call(n.exports,n,n.exports,c),n.exports}c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};function d(e){if(!h(e))throw new Error("Parameter was not an error")}function h(e){return"[object Error]"===(t=e,Object.prototype.toString.call(t))||e instanceof Error;var t}c.r(u),c.d(u,{Decoder:()=>Jt,Encoder:()=>Kt,PacketType:()=>Qt,protocol:()=>Gt});class p extends Error{constructor(e,t){const n=[...arguments],{options:r,shortMessage:i}=function(e){let t,n="";if(0===e.length)t={};else if(h(e[0]))t={cause:e[0]},n=e.slice(1).join(" ")||"";else if(e[0]&&"object"==typeof e[0])t=Object.assign({},e[0]),n=e.slice(1).join(" ")||"";else{if("string"!=typeof e[0])throw new Error("Invalid arguments passed to Layerr");t={},n=n=e.join(" ")||""}return{options:t,shortMessage:n}}(n);let o=i;if(r.cause&&(o=`${o}: ${r.cause.message}`),super(o),this.message=o,r.name&&"string"==typeof r.name?this.name=r.name:this.name="Layerr",r.cause&&Object.defineProperty(this,"_cause",{value:r.cause}),Object.defineProperty(this,"_info",{value:{}}),r.info&&"object"==typeof r.info&&Object.assign(this._info,r.info),Error.captureStackTrace){const e=r.constructorOpt||this.constructor;Error.captureStackTrace(this,e)}}static cause(e){return d(e),e._cause&&h(e._cause)?e._cause:null}static fullStack(e){d(e);const t=p.cause(e);return t?`${e.stack}\ncaused by: ${p.fullStack(t)}`:e.stack}static info(e){d(e);const t={},n=p.cause(e);return n&&Object.assign(t,p.info(n)),e._info&&Object.assign(t,e._info),t}cause(){return p.cause(this)}toString(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e}}var f=c(162);const m=(e,t,n,r)=>{if("length"===n||"prototype"===n)return;if("arguments"===n||"caller"===n)return;const i=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);!g(i,o)&&r||Object.defineProperty(e,n,o)},g=function(e,t){return void 0===e||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},v=(e,t)=>`/* Wrapped ${e}*/\n${t}`,y=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),b=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");var _=c(745);const w=new WeakMap;var x=c(585),C=c.n(x),k=c(278),S=c.n(k),O=c(334),j=c.n(O),P=c(345);Object.freeze({});const E=Function.prototype.call.bind(Object.prototype.toString);function T(e){return e.map((e=>Array.isArray(e)?T(e):N(e)?I(e):e))}function I(e){const t=Object.assign({},e);for(const e in t)t.hasOwnProperty(e)&&(Array.isArray(t[e])?t[e]=T(t[e]):N(t[e])&&(t[e]=I(t[e])));return t}function N(e){return!!e&&"object"==typeof e&&"[object Object]"===function(e){const t=E(e);return"[object Object]"!==t?t:`[object ${Object.getPrototypeOf(e).constructor.name}]`}(e)}function A(e,t){return[...new Set([...Object.keys(e),...Object.keys(t)])].reduce(((n,r)=>{const i=e.hasOwnProperty(r),s=t.hasOwnProperty(r);let a;if(i&&s){const n=N(e[r]),i=N(t[r]);a=n&&i?A(e[r],t[r]):t[r]}else a=i?e[r]:t[r],N(a)&&(a=I(a));return o(o({},n),{},{[r]:a})}),{})}var L,D,R,M,$,U,F,q,B;(B=L||(L={}))[B.Indefinite=1]="Indefinite",B[B.Schedule=0]="Schedule",function(e){e[e.Auto=0]="Auto",e[e.Manual=1]="Manual"}(D||(D={})),function(e){e[e.Ended=3]="Ended",e[e.Launched=1]="Launched",e[e.Paused=2]="Paused"}(R||(R={})),function(e){e[e.BestConversionRate=0]="BestConversionRate",e[e.BestEngagementRate=1]="BestEngagementRate",e[e.MostLeadConversions=2]="MostLeadConversions"}(M||(M={})),function(e){e[e.Document=3]="Document",e[e.Internal=0]="Internal",e[e.URL=2]="URL",e[e.Window=1]="Window"}($||($={})),function(e){e[e.AdvancedAnalytics=16]="AdvancedAnalytics",e[e.Automation=17]="Automation",e[e.BannerBots=14]="BannerBots",e[e.CallbackBot=6]="CallbackBot",e[e.ChatBot=3]="ChatBot",e[e.CTABot=19]="CTABot",e[e.CustomerProfiles=13]="CustomerProfiles",e[e.Feedback=8]="Feedback",e[e.InPageBot=4]="InPageBot",e[e.Integrations=18]="Integrations",e[e.LiveChat=5]="LiveChat",e[e.Media=7]="Media",e[e.Messaging=11]="Messaging",e[e.OrganizationProfiles=15]="OrganizationProfiles",e[e.Page=1]="Page",e[e.Remarketing=10]="Remarketing",e[e.Video=2]="Video",e[e.VisualBot=9]="VisualBot"}(U||(U={})),function(e){e.FullName="",e.FirstName="first",e.LastName="last",e.Separate="separate"}(F||(F={})),function(e){e[e.AdvancedCalculatorResult=33]="AdvancedCalculatorResult",e[e.AdvancedRouterResult=34]="AdvancedRouterResult",e[e.AI=48]="AI",e[e.ApiCall=51]="ApiCall",e[e.Rating=52]="Rating",e[e.AttachmentPrompt=44]="AttachmentPrompt",e[e.AttachmentPromptSingle=43]="AttachmentPromptSingle",e[e.BookingCalendar=35]="BookingCalendar",e[e.CalculatorResult=31]="CalculatorResult",e[e.Calendar=22]="Calendar",e[e.Carousel=16]="Carousel",e[e.CompanyPrompt=3]="CompanyPrompt",e[e.ContactForm=9]="ContactForm",e[e.CTAForm=47]="CTAForm",e[e.CustomForm=45]="CustomForm",e[e.Dropdown=15]="Dropdown",e[e.EmailPrompt=2]="EmailPrompt",e[e.LiveChat=99]="LiveChat",e[e.LocationForm=6]="LocationForm",e[e.LookupCarousel=1016]="LookupCarousel",e[e.LookupDropdown=1015]="LookupDropdown",e[e.LookupMultipleChoice=1014]="LookupMultipleChoice",e[e.LookupSingleChoice=1011]="LookupSingleChoice",e[e.LookupSingleChoiceURL=1012]="LookupSingleChoiceURL",e[e.LookupQuery=36]="LookupQuery",e[e.MultipleChoice=14]="MultipleChoice",e[e.NamePrompt=1]="NamePrompt",e[e.TextPrompt=5]="TextPrompt",e[e.PhonePrompt=4]="PhonePrompt",e[e.RangeSelector=21]="RangeSelector",e[e.Say=0]="Say",e[e.SingleChoice=11]="SingleChoice",e[e.SingleChoiceURL=12]="SingleChoiceURL",e[e.SoftLiveChat=2099]="SoftLiveChat",e[e.SingleChoiceAPI=2011]="SingleChoiceAPI",e[e.MultipleChoiceAPI=2014]="MultipleChoiceAPI",e[e.DropdownSelectAPI=2015]="DropdownSelectAPI",e[e.CarouselAPI=2016]="CarouselAPI",e[e.Country=7]="Country"}(q||(q={}));var z=c(249),V={455:e=>{e.exports=e=>{if("number"!=typeof e)throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(1e3*e)%1e3,nanoseconds:t(1e6*e)%1e3}}},258:(e,t,n)=>{const r=n(455);e.exports=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Number.isFinite(e))throw new TypeError("Expected a finite number");t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);const n=[],i=(e,r,i,o)=>{if(!(0!==n.length&&t.colonNotation||0!==e||t.colonNotation&&"m"===i))return;let s,a;if(o=(o||e||"0").toString(),t.colonNotation){s=n.length>0?":":"",a="";const e=o.includes(".")?o.split(".")[0].length:o.length,t=n.length>0?2:1;o="0".repeat(Math.max(0,t-e))+o}else s="",a=t.verbose?" "+(l=r,1===e?l:`${l}s`):i;var l;n.push(s+o+a)},o=r(e);if(i(Math.trunc(o.days/365),"year","y"),i(o.days%365,"day","d"),i(o.hours,"hour","h"),i(o.minutes,"minute","m"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3)if(i(o.seconds,"second","s"),t.formatSubMilliseconds)i(o.milliseconds,"millisecond","ms"),i(o.microseconds,"microsecond","µs"),i(o.nanoseconds,"nanosecond","ns");else{const e=o.milliseconds+o.microseconds/1e3+o.nanoseconds/1e6,n="number"==typeof t.millisecondsDecimalDigits?t.millisecondsDecimalDigits:0,r=e>=1?Math.round(e):Math.ceil(e),s=n?e.toFixed(n):r;i(Number.parseFloat(s,10),"millisecond","ms",s)}else{const n=((e,t)=>{const n=Math.floor(e*10**t+1e-7);return(Math.round(n)/10**t).toFixed(t)})(e/1e3%60,"number"==typeof t.secondsDecimalDigits?t.secondsDecimalDigits:1),r=t.keepDecimalsOnWholeSeconds?n:n.replace(/\.0+$/,"");i(Number.parseFloat(r,10),"second","s",r)}if(0===n.length)return"0"+(t.verbose?" milliseconds":"ms");if(t.compact)return n[0];if("number"==typeof t.unitCount){const e=t.colonNotation?"":" ";return n.slice(0,Math.max(t.unitCount,1)).join(e)}return t.colonNotation?n.join(""):n.join(" ")}},196:e=>{var t=/(\*|\?)/g;function n(e,t){this.text=e=e||"",this.hasWild=e.indexOf("*")>=0,this.separator=t,this.parts=e.split(t).map(this.classifyPart.bind(this))}n.prototype.match=function(e){var t,n,r=!0,i=this.parts,o=i.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(n=(e||"").split(this.separator),t=0;r&&t=0||e.indexOf("?")>=0?new RegExp(e.replace(t,".$1")):e},e.exports=function(e,t,r){var i=new n(e,r||/[\/\.]/);return void 0!==t?i.match(t):i}},246:()=>{}},H={};function W(e){var t=H[e];if(void 0!==t)return t.exports;var n=H[e]={exports:{}};return V[e](n,n.exports,W),n.exports}W.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return W.d(t,{a:t}),t},W.d=(e,t)=>{for(var n in t)W.o(t,n)&&!W.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},W.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),W.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var G={};(()=>{W.d(G,{xN:()=>b,Iq:()=>p,cM:()=>_,bp:()=>f,Y9:()=>C});var e=W(196),t=W.n(e),n=W(258),r=W.n(n);const i=["#a0937d","#a7c5eb","#bdd2b6","#cc7351","#d35d6e","#e08f62","#fbc6a4","#f4a9a8","#ce97b0","#5aa469","#70af85","#8b5e83","#8f4068","#9dad7f","#94d0cc","#949cdf"];let o=null;function s(){o||(o=[...i],function(e){for(let t=e.length-1;t>0;t-=1){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}}(o));const e=o.shift();return o.push(e),e}var a=W(246),l=W.n(a);function c(){if("undefined"!=typeof window)return window;if(void 0!==W.g)return W.g;if("undefined"!=typeof self)return self;throw new Error("Unable to determine global context")}function u(e,t){return e.map((e=>Array.isArray(e)?`[${u(e,", ")}]`:e&&"object"==typeof e&&"function"==typeof e.toString||"function"==typeof e?e.toString():`${e}`)).join(t)}function d(){console.log(...arguments)}let h=d;function p(){return h}function f(e){h=e||d}let m=null,g={};const v={},y={};function b(e){if(!x(e))return function(){};const t=v[e]=v[e]||s();return function(){for(var n=arguments.length,r=new Array(n),i=0;i1?t-1:0),r=1;ri.add(e))),"string"==typeof(null===(n=null===(t=r.process)||void 0===t?void 0:t.env)||void 0===n?void 0:n.DEBUG)&&r.process.env.DEBUG.split(",").forEach((e=>i.add(e))),[...i]}().reduce(((e,t)=>{let n=t.trim(),r=!0;return/^-/.test(n)&&(n=n.substring(1),r=!1),!1!==e[n]&&(e[n]=r),e}),{})),void 0===g[e])for(const n in m)if(t()(n,e)&&(g[e]=!!m[n],!g[e]))break;return g[e]}function C(e,t){g[e]=t}})();var Q=G.xN;const K="leadoo:livechat:client",Y="leadoo:livechat:connection",J="leadoo:livechat:main",Z="leadoo:livechat:renotify",X="leadoo:livechat:worker",ee=[K,Y,J,Z,X].reduce(((e,t)=>(e[t]=Q(t),e)),{}),te=ee[K],ne=ee[Y],re=ee[J],ie=ee[Z],oe=ee[X];class se extends P.default{emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r0&&(i=i.replace(/^[\/]+/,"")),i=r0?"?":"")+s.join("&")}("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}var le=c(991);function ce(){return le.sendRequest}const ue="2023-06-26",de="x-ld-clientmode",he=C()("1m"),pe=15e3;function fe(e,t,n){const r={url:ae(e,`/chat/channel/${n}`),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((e=>e.body))}function me(e,t,n,r,i){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[];const s=[];r&&"number"==typeof i&&s.push(`count=${r}`,`start=${i}`),o.length>0&&o.forEach((e=>{s.push(`type[]=${e}`)}));let a=ae(e,`/chat/channel/${n}/messages`);s.length>0&&(a=`${a}?${s.join("&")}`);const l={url:a,method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(l).then((e=>{const{messages:t,fetched:n}=e.body;return{messages:t,fetched:n}}))}function ge(e,t,n,r,i){const o={url:ae(e,`/chat/channel/${n}/assignment`),method:null===r?"DELETE":"POST",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return r&&(o.body={alternateCategoryID:i,clientID:r}),ce()(o).then((()=>{}))}var ve,ye,be,_e=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};class we{constructor(e,t,n){this._timer=null,this.__clientListeners=[],this.__online=!0,this.__open=[],this._client=e,this._endpoint=t,this._token=n,this._removeChat=this.__removeChat.bind(this),this._updateOpenChats=j()((()=>this.__updateOpenChats()),500,!1),this._queue=new f.ChannelQueue}get openChats(){return this.__open}start(){return _e(this,arguments,void 0,(function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.__notify;return function*(){if(null===e._timer){if(!t)throw new p("Time is required for first call to 'start");if(ie(`starting: check: ${t}`),e.__notify=t,!e._client.isConnected)throw new p("Cannot start renotify: Not connected");yield e._updateOpenChats(),yield e._queue.channel("startstop").enqueue((()=>_e(e,void 0,void 0,(function*(){if(null!==this._timer)return void ie("cannot start: timer in use");this._client.on("chatAssigned",this._updateOpenChats),this._client.on("chatUnassigned",this._updateOpenChats),this.__clientListeners.push(["chatAssigned",this._updateOpenChats],["chatUnassigned",this._updateOpenChats]);const e=()=>{this.__online=!0},t=()=>{this.__online=!1},n=this.__stopReconnect.bind(this);this._client.on("disconnected",n),this.__clientListeners.push(["disconnected",n]),this._client.on("online",e),this._client.on("offline",t),this.__clientListeners.push(["online",e],["offline",t]),this._client.on("channelSubscribed",this._updateOpenChats),this.__clientListeners.push(["channelSubscribed",this._updateOpenChats]),this._client.on("channelUnsubscribed",this._updateOpenChats),this.__clientListeners.push(["channelUnsubscribed",this._updateOpenChats]),this._client.on("chatCompleted",this._removeChat),this.__clientListeners.push(["chatCompleted",this._removeChat]),this._client.on("chatDeleted",this._removeChat),this.__clientListeners.push(["chatDeleted",this._removeChat]),this._timer=(0,z.MS)((()=>this._check()),this.__notify),ie("started")}))))}}()}))}stop(){return _e(this,void 0,void 0,(function*(){yield this._queue.channel("startstop").enqueue((()=>_e(this,void 0,void 0,(function*(){null!==this._timer&&(ie("stopping"),(0,z.dM)(this._timer),this.__clientListeners.forEach((e=>{let[t,n]=e;this._client.off(t,n)})),this.__clientListeners=[],yield this._queue.channel("check").enqueue((()=>{})),this._timer=null,ie("stopped"))}))))}))}_check(){return this._queue.channel("check").enqueue((()=>{null!==this._timer&&this.__online&&(ie(`check: ${this.__open.length}`),this.__open.length>0&&this._client.emit("openChats",{count:this.__open.length,chats:[...this.__open]}))}))}__removeChat(e){return ie(`remove chat: ${e}`),this._queue.channel("check").enqueue((()=>this._updateOpenChats().then((()=>{this.__open=this.__open.filter((t=>{const n=this._client.getChannelConfig(t.channel);return!!n&&n.id!==e}))}))))}__stopReconnect(){ie("stopping due to disconnection: will restart once the connection is restored"),this.stop().then((()=>new Promise((e=>{const t=()=>{e()};this._client.once("reconnected",t),this.__clientListeners.push(["reconnected",t])})))).then((()=>this.__updateOpenChats())).catch((e=>{console.error(e),stop()}))}__updateOpenChats(){return _e(this,void 0,void 0,(function*(){ie("update open chats");try{const e=yield function(e,t,n){const r={url:ae(e,`/chat/client/${n}/open-chats`),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((e=>{const{chats:t}=e.body;return t}))}(this._endpoint,this._token,this._client.id);return ie(`updated open chats: ${e.length}`),this.__open=e,Promise.resolve()}catch(e){const t=new p(e,"Failed updating open chats");console.error(t)}}))}}function xe(e){return/^company_\d+$/.test(e)}function Ce(e,t){return e.length===t.length&&(0===e.length||e.every(((e,n)=>e===t[n])))}function ke(e){return new Promise((t=>{!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var n;(("boolean"!=typeof __DEV__||!0!==__DEV__||!/ReactNative/i.test(null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.product))&&"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope?self:window).setTimeout(e,t)}(t,e)}))}function Se(e){throw __to_bugsnag_from_ca__(e),e}class Oe extends P.default{constructor(){super(),this._ready=!1}destroy(){this.worker.port.close()}executeRequest(e){this.worker.port.postMessage(JSON.stringify(e))}setReady(){this._ready||(this._ready=!0,this.emit("ready"))}setSharedWorker(e){this.worker=e}getSharedWorker(){return this.worker}}!function(e){e.Open="open",e.Active="active",e.Unanswered="unanswered",e.Archived="archived",e.Historical="historical"}(ve||(ve={})),function(e){e.ClientError="error",e.IncomingMessage="ongoing",e.OpenChats="open",e.Reassignment="reassignment",e.ServerError="err",e.SetupError="setErr"}(ye||(ye={})),function(e){e.Auth="auth",e.Start="start",e.Stop="stop"}(be||(be={}));var je=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};let Pe=null;var Ee,Te,Ie,Ne,Ae,Le,De,Re;!function(e){e.Subscribe="subscribe",e.Broadcast="broadcast",e.BroadcastAndSubscribe="broadcast/subscribe",e.Idle="idle"}(Ee||(Ee={})),function(e){e.Connecting="connecting",e.Connected="connected",e.Disconnected="disconnected",e.FailedWillRetry="failed-retry"}(Te||(Te={})),function(e){e.Agent="agent",e.User="user"}(Ie||(Ie={})),function(e){e.Connected="connected",e.Connecting="connecting",e.Disconnected="disconnected"}(Ne||(Ne={})),function(e){e.Polling="polling",e.SSE="sse",e.Websocket="websocket"}(Ae||(Ae={})),function(e){e.Android="android",e.iOS="ios"}(Le||(Le={})),function(e){e.ConnectionFailed="connect-failed",e.ReconnectionFailed="reconnect-failed",e.SocketResponseTimeout="socket-response-timeout"}(De||(De={})),function(e){e.Attachment="attachment",e.ChatAssigned="assigned",e.ChatUnassigned="unassigned",e.CompleteChat="completeChat",e.DeleteChat="deleteChat",e.Event="event",e.Message="message",e.Presence="presence",e.Rated="rating",e.SetState="stateSet",e.SetTitle="titleSet",e.TimeoutCancelled="timeoutCancel",e.TimeoutStarted="timeoutStart",e.Typing="typing",e.VisibilityChanged="visibilityChange"}(Re||(Re={}));var Me=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};class $e{constructor(e,t,n){this.__lcWorker=null,this.__isDisconnecting=!1,this._client=e,this._endpoint=t,this._token=n,this._disconnectWorker=this.__disconnectSSE.bind(this),this._notifyWorkerErrors=j()(this.__notifyWorkerErrors,150,!0).bind(this),this._notifyWorkerNotifications=j()(this.__notifyWorkerNotifications,150,!1).bind(this)}get sharedWorker(){return this.__lcWorker.getSharedWorker()}start(e,t,n,r,i){return Me(this,void 0,void 0,(function*(){if(!this.__lcWorker){if(!this._client.isConnected)throw new p("Cannot enable worker: Not connected");oe("enable notification worker");try{this.__lcWorker=yield function(e){return je(this,void 0,void 0,(function*(){re("booting worker");const t=yield function(e){return je(this,void 0,void 0,(function*(){if(null!==Pe)return Pe;re("fetching worker script"),Pe=fetch(e).then((e=>e.blob()));const t=yield Pe;return re("fetched worker script"),t}))}(e),n=URL.createObjectURL(t);re(`initialising worker: ${n}`);let r,i=!1;const o=e=>{/blob/i.test(e.blockedURI)&&"worker-src"===e.violatedDirective&&(i=!0,console.warn("Leadoo LiveChat encountered a security policy restriction that is preventing advanced chat features from working. Please check our documentation as to how to resolve this error: https://docs.leadoo.io/docs/config-page-security#content-security-policy"))},s=new Oe;document.addEventListener("securitypolicyviolation",o);try{r=new SharedWorker(n)}catch(e){yield ke(250),document.removeEventListener("securitypolicyviolation",o);const t=new p({cause:e,info:{recoverable:i}},i?"Failed starting LiveChat worker: Blocked by CSP":"Failed booting LiveChat worker");throw __to_bugsnag_from_ca__(t),s.emit("sseErrors",{icon:"",message:t.message,type:ye.SetupError}),t}return document.removeEventListener("securitypolicyviolation",o),s.setSharedWorker(r),function(e){e.worker.port.addEventListener("message",(t=>{let n=null,r=null;try{if("string"==typeof t.data)oe(t.data);else switch(r=t.data,r.type){case ye.OpenChats:case ye.IncomingMessage:case ye.Reassignment:e.emit("sseNotifications",r.payload);break;case ye.ClientError:n=t.data.err,__to_bugsnag_from_ca__(n),e.emit("sseErrors",{icon:"",message:n.message,type:r.type})}}catch(n){return void oe(`error from initialising worker events: ${n}`)}})),e.worker.port.start()}(s),s.setReady(),s}))}(e)}catch(e){this._notifyWorkerErrors({icon:r,message:e.message,type:ye.SetupError})}oe("notification worker ready"),this.__lcWorker.executeRequest({clientID:this._client.id,endpoint:this._endpoint,token:this._token,type:be.Auth}),this._client.on("disconnected",this._disconnectWorker),this.__lcWorker.on("sseErrors",this._notifyWorkerErrors),this.__lcWorker.on("sseNotifications",this._notifyWorkerNotifications),this.__lcWorker.executeRequest({clientID:this._client.id,notification:{description:n,icon:r,title:t},poll:i,type:be.Start}),oe("notification worker has started")}}))}stop(){return Me(this,void 0,void 0,(function*(){this.__lcWorker&&(this.__isDisconnecting||(this.__isDisconnecting=!0,oe("disable notification worker"),this.__lcWorker.executeRequest({clientID:this._client.id,type:be.Stop}),this._client.off("disconnected",this._disconnectWorker),this.__lcWorker.off("sseErrors",this._notifyWorkerErrors),this.__lcWorker.off("sseNotifications",this._notifyWorkerNotifications),yield ke(250),this.__lcWorker.destroy(),this.__lcWorker=null,this.__isDisconnecting=!1))}))}__disconnectSSE(){oe("stopping due to disconnection: will restart from the front-end once the connection is restored"),this._client.disableNotificationWorker().then((()=>{oe("notification worker disconnected")})).catch((e=>{console.error(e),stop()}))}__notifyWorkerErrors(e){if(!this.__lcWorker){const t=new p(`Notify sse errors: notification worker not initialised: ${e.message}`);throw this._client.emit("sseErrors",{icon:e.icon,message:t.message,type:ye.SetupError}),t}oe(`update sse errors: error=${e.message}`),this._client.emit("sseErrors",e)}__notifyWorkerNotifications(e){return Me(this,void 0,void 0,(function*(){if(!this.__lcWorker)throw new p("Notify sse notifications: notification worker not initialised");let t=null;e.from&&(t=this._client.getStates()[e.from],t||(t=yield this._client.getState(e.from,!0))),oe(`update sse notifications: from=${JSON.stringify(t)}; message=${e.message}; type=${e.type}`),this._client.emit("sseNotifications",Object.assign(Object.assign({},e),{from:t}))}))}}const Ue=Object.create(null);Ue.open="0",Ue.close="1",Ue.ping="2",Ue.pong="3",Ue.message="4",Ue.upgrade="5",Ue.noop="6";const Fe=Object.create(null);Object.keys(Ue).forEach((e=>{Fe[Ue[e]]=e}));const qe={type:"error",data:"parser error"},Be="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),ze="function"==typeof ArrayBuffer,Ve=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,He=(e,t,n)=>{let{type:r,data:i}=e;return Be&&i instanceof Blob?t?n(i):We(i,n):ze&&(i instanceof ArrayBuffer||Ve(i))?t?n(i):We(new Blob([i]),n):n(Ue[r]+(i||""))},We=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Ge(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Qe;const Ke="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)Ke["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(e)]=e;const Ye="function"==typeof ArrayBuffer,Je=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Xe(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:Ze(e.substring(1),t)}:Fe[n]?e.length>1?{type:Fe[n],data:e.substring(1)}:{type:Fe[n]}:qe},Ze=(e,t)=>{if(Ye){const n=(e=>{let t,n,r,i,o,s=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const c=new ArrayBuffer(s),u=new Uint8Array(c);for(t=0;t>4,u[l++]=(15&r)<<4|i>>2,u[l++]=(3&i)<<6|63&o;return c})(e);return Xe(n,t)}return{base64:!0,data:e}},Xe=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,et=String.fromCharCode(30);let tt;function nt(e){return e.reduce(((e,t)=>e+t.length),0)}function rt(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iPromise.resolve().then(e):(e,t)=>t(e,0),st="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function at(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const lt=st.setTimeout,ct=st.clearTimeout;function ut(e,t){t.useNativeTimers?(e.setTimeoutFn=lt.bind(st),e.clearTimeoutFn=ct.bind(st)):(e.setTimeoutFn=st.setTimeout.bind(st),e.clearTimeoutFn=st.clearTimeout.bind(st))}function dt(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function ht(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class pt extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class ft extends it{constructor(e){super(),this.writable=!1,ut(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new pt(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Je(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class mt extends ft{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(et),r=[];for(let e=0;e{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach(((e,o)=>{He(e,!1,(e=>{r[o]=e,++i===n&&t(r.join(et))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=ht()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let gt=!1;try{gt="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(B){}const vt=gt;function yt(){}class bt extends mt{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}class _t extends it{constructor(e,t,n){super(),this.createRequest=e,ut(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=at(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn((()=>{this._onError("number"==typeof n.status?n.status:0)}),0))},n.send(this._data)}catch(e){return void this.setTimeoutFn((()=>{this._onError(e)}),0)}"undefined"!=typeof document&&(this._index=_t.requestsCount++,_t.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=yt,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete _t.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function wt(){for(let e in _t.requests)_t.requests.hasOwnProperty(e)&&_t.requests[e].abort()}_t.requestsCount=0,_t.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",wt):"function"==typeof addEventListener&&addEventListener("onpagehide"in st?"pagehide":"unload",wt,!1));const xt=function(){const e=Ct({xdomain:!1});return e&&null!==e.responseType}();function Ct(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||vt))return new XMLHttpRequest}catch(e){}if(!t)try{return new(st[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const kt="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class St extends ft{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=kt?{}:at(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.doWrite(n,e)}catch(e){}r&&ot((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ht()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Ot=st.WebSocket||st.MozWebSocket,jt={websocket:class extends St{createSocket(e,t,n){return kt?new Ot(e,t,n):t?new Ot(e,t):new Ot(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends ft{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this._transport.ready.then((()=>{this._transport.createBidirectionalStream().then((e=>{const t=function(e,t){tt||(tt=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(nt(n)<1)break;const e=rt(n,1);o=!(128&~e[0]),i=127&e[0],r=i<126?3:126===i?1:2}else if(1===r){if(nt(n)<2)break;const e=rt(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(nt(n)<8)break;const e=rt(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(qe);break}i=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(nt(n)e){a.enqueue(qe);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=new TransformStream({transform(e,t){!function(e,t){Be&&e.data instanceof Blob?e.data.arrayBuffer().then(Ge).then(t):ze&&(e.data instanceof ArrayBuffer||Ve(e.data))?t(Ge(e.data)):He(e,!1,(e=>{Qe||(Qe=new TextEncoder),t(Qe.encode(e))}))}(e,(n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(n)}))}});r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{n.read().then((e=>{let{done:t,value:n}=e;t||(this.onPacket(n),i())})).catch((e=>{}))};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then((()=>this.onOpen()))}))}))}write(e){this.writable=!1;for(let t=0;t{r&&ot((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends bt{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=xt&&!t}request(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(e,{xd:this.xd},this.opts),new _t(Ct,this.uri(),e)}}},Pt=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Et=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Tt(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=Pt.exec(e||""),o={},s=14;for(;s--;)o[Et[s]]=i[s]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1),"/"==t.slice(-1)&&n.splice(n.length-1,1),n}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,o.query),o}const It="function"==typeof addEventListener&&"function"==typeof removeEventListener,Nt=[];It&&addEventListener("offline",(()=>{Nt.forEach((e=>e()))}),!1);class At extends it{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=Tt(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Tt(t.host).host);ut(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach((e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e})),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Nt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);const e=this.opts.rememberUpgrade&&At.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",(e=>this._onClose("transport close",e)))}onOpen(){this.readyState="open",At.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn((()=>{this._onClose("ping timeout")}),e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,ot((()=>{this._onClose("ping timeout")}),this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}_onError(e){if(At.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),It&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Nt.indexOf(this._offlineEventListener);-1!==e&&Nt.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}At.protocol=4;class Lt extends At{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;At.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function i(){n||(n=!0,c(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,i(),this.emitReserved("upgradeError",n)};function s(){o("transport closed")}function a(){o("socket closed")}function l(e){t&&e.name!==t.name&&i()}const c=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",s),this.off("close",a),this.off("upgrading",l)};t.once("open",r),t.once("error",o),t.once("close",s),this.once("close",a),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{n||t.open()}),200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:{};(!t.transports||t.transports&&"string"==typeof t.transports[0])&&(t.transports=(t.transports||["polling","websocket","webtransport"]).map((e=>jt[e])).filter((e=>!!e))),super(e,t)}}const Rt="function"==typeof ArrayBuffer,Mt=Object.prototype.toString,$t="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Mt.call(Blob),Ut="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Mt.call(File);function Ft(e){return Rt&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||$t&&e instanceof Blob||Ut&&e instanceof File}function qt(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t=0&&e.num1?i-1:0),s=1;s{delete this.acks[e];for(let t=0;t1?t-1:0),r=1;r{const i=(e,n)=>e?r(e):t(n);i.withError=!0,n.push(i),this.emit(e,...n)}))}_addToQueue(e){var t=this;let n;"function"==typeof e[e.length-1]&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((function(e){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;st._opts.retries&&(t._queue.shift(),n&&n(e)):(t._queue.shift(),n&&n(null,...o)),r.pending=!1,t._drainQueue()})),this._queue.push(r),this._drainQueue()}_drainQueue(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Qt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach((e=>{if(!this.sendBuffer.some((t=>String(t.id)===e))){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}}))}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Qt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Qt.EVENT:case Qt.BINARY_EVENT:this.onevent(e);break;case Qt.ACK:case Qt.BINARY_ACK:this.onack(e);break;case Qt.DISCONNECT:this.ondisconnect();break;case Qt.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(){for(var r=arguments.length,i=new Array(r),o=0;othis.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Qt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}nn.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},nn.prototype.reset=function(){this.attempts=0},nn.prototype.setMin=function(e){this.ms=e},nn.prototype.setMax=function(e){this.max=e},nn.prototype.setJitter=function(e){this.jitter=e};class rn extends it{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,ut(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new nn({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||u;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Dt(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Xt(t,"open",(function(){n.onopen(),e&&e()})),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=Xt(t,"error",i);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{r(),i(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Xt(e,"ping",this.onping.bind(this)),Xt(e,"data",this.ondata.bind(this)),Xt(e,"error",this.onerror.bind(this)),Xt(e,"close",this.onclose.bind(this)),Xt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){ot((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new tn(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;ne())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const on={};function sn(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=Tt(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=on[i]&&o in on[i].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new rn(r,t):(on[i]||(on[i]=new rn(r,t)),a=on[i]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(sn,{Manager:rn,Socket:tn,io:sn,connect:sn});var an=c(621);function ln(e){if(!cn(e))throw new Error("Parameter was not an error")}function cn(e){return!!e&&"object"==typeof e&&"[object Error]"===(t=e,Object.prototype.toString.call(t))||e instanceof Error;var t}class un extends Error{constructor(e,t){const n=[...arguments],{options:r,shortMessage:i}=function(e){let t,n="";if(0===e.length)t={};else if(cn(e[0]))t={cause:e[0]},n=e.slice(1).join(" ")||"";else if(e[0]&&"object"==typeof e[0])t=Object.assign({},e[0]),n=e.slice(1).join(" ")||"";else{if("string"!=typeof e[0])throw new Error("Invalid arguments passed to Layerr");t={},n=n=e.join(" ")||""}return{options:t,shortMessage:n}}(n);let o=i;if(r.cause&&(o=`${o}: ${r.cause.message}`),super(o),this.message=o,r.name&&"string"==typeof r.name?this.name=r.name:this.name="Layerr",r.cause&&Object.defineProperty(this,"_cause",{value:r.cause}),Object.defineProperty(this,"_info",{value:{}}),r.info&&"object"==typeof r.info&&Object.assign(this._info,r.info),Error.captureStackTrace){const e=r.constructorOpt||this.constructor;Error.captureStackTrace(this,e)}}static cause(e){return ln(e),e._cause&&cn(e._cause)?e._cause:null}static fullStack(e){var t;ln(e);const n=un.cause(e);return n?`${e.stack}\ncaused by: ${un.fullStack(n)}`:null!==(t=e.stack)&&void 0!==t?t:""}static info(e){ln(e);const t={},n=un.cause(e);return n&&Object.assign(t,un.info(n)),e._info&&Object.assign(t,e._info),t}toString(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e}}const dn="0123456789ABCDEFGHJKMNPQRSTVWXYZ",hn=0xffffffffffff,pn=Object.freeze({source:"ulid"});function fn(e){let t=Math.floor(32*e());return 32===t&&(t=31),dn.charAt(t)}function mn(e,t){const n=t||function(){const e="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:null,t=e&&(e.crypto||e.msCrypto)||null;if("function"==typeof(null==t?void 0:t.getRandomValues))return()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]/255};if("function"==typeof(null==t?void 0:t.randomBytes))return()=>t.randomBytes(1).readUInt8()/255;throw new un({info:o({code:"PRNG_DETECT"},pn)},"Failed to find a reliable PRNG")}();return function(e){if(isNaN(e))throw new un({info:o({code:"ENC_TIME_NAN"},pn)},`Time must be a number: ${e}`);if(e>hn)throw new un({info:o({code:"ENC_TIME_SIZE_EXCEED"},pn)},`Cannot encode a time larger than ${hn}: ${e}`);if(e<0)throw new un({info:o({code:"ENC_TIME_NEG"},pn)},`Time must be positive: ${e}`);if(!1===Number.isInteger(e))throw new un({info:o({code:"ENC_TIME_TYPE"},pn)},`Time must be an integer: ${e}`);let t,n="";for(let r=10;r>0;r--)t=e%32,n=dn.charAt(t)+n,e=(e-t)/32;return n}(isNaN(e)?Date.now():e)+function(e,t){let n="";for(;e>0;e--)n=fn(t)+n;return n}(16,n)}var gn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};function vn(){throw new Error("Not implemented")}class yn extends se{constructor(e,t){super(),this.__status=Ne.Disconnected,this._host=e,this._token=t}get status(){return this.__status}connect(){return gn(this,void 0,void 0,(function*(){}))}disconnect(){return gn(this,void 0,void 0,(function*(){}))}presence(e,t){return gn(this,void 0,void 0,(function*(){vn()}))}send(e,t){return gn(this,void 0,void 0,(function*(){vn()}))}subscribe(e){return gn(this,void 0,void 0,(function*(){return vn(),[]}))}unsubscribe(e){return gn(this,void 0,void 0,(function*(){vn()}))}setStatus(e){if(this.__status!==e)switch(this.__status=e,this.__status){case Ne.Connected:this.emit("connected");break;case Ne.Connecting:this.emit("connecting");break;case Ne.Disconnected:this.emit("disconnected")}}}var bn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};const _n=C()("15s"),wn=C()("25s"),xn=1/0,Cn=C()("15s");function kn(e,t,n){const r={auth:{clientMode:ue,token:t},autoConnect:!1,path:"/sock/",reconnection:!0,reconnectionAttempts:xn,reconnectionDelay:_n,reconnectionDelayMax:wn,withCredentials:!0};return n.transports&&(r.transports=n.transports),sn(e,r)}class Sn extends yn{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super(e,t),this._cancelToken=(0,an.createToken)(),this.__callbacks=new Map,this.__lastConnectionError=null,this._host=e,this._token=t;const{factory:r=kn}=n;this._socket=r(this._host,this._token,n),this._addSocketListeners()}connect(){const e=Object.create(null,{connect:{get:()=>super.connect}});return bn(this,void 0,void 0,(function*(){if(yield e.connect.call(this),ne(`connect socket: ${this._host}`),this.status!==Ne.Disconnected)throw new p({info:{status:this.status}},"Cannot connect: socket in invalid state");this.setStatus(Ne.Connecting),this.__lastConnectionError=null,this._socket.connect()}))}disconnect(){const e=Object.create(null,{disconnect:{get:()=>super.disconnect}});return bn(this,void 0,void 0,(function*(){if(yield e.disconnect.call(this),ne("disconnect socket"),this._cancelToken.cancel(),-1===[Ne.Connected,Ne.Connecting].indexOf(this.status))throw new p({info:{status:this.status}},"Cannot disconnect: socket in invalid state");this.setStatus(Ne.Disconnected),this._socket.disconnect()}))}presence(e,t){return bn(this,void 0,void 0,(function*(){if(ne(`send presence: ${e.join(", ")}`),this.status!==Ne.Connected)throw new p({info:{status:this.status}},"Cannot set presence: socket not connected");yield this.__sendSocketMessage("presence",{channels:e,visible:t})}))}send(e,t){return bn(this,void 0,void 0,(function*(){if(ne(`send message: ${t.type} @ ${e}`),this.status!==Ne.Connected)throw new p({info:{status:this.status}},"Cannot send: socket not connected");yield this.__sendSocketMessage("message",{message:t})}))}subscribe(e){return bn(this,void 0,void 0,(function*(){if(ne(`subscribe: ${e.join(", ")}`),this.status!==Ne.Connected)throw new p({info:{status:this.status}},"Cannot subscribe: socket not connected");const t=yield this.__sendSocketMessage("subscribe",{channels:e});return t&&t.subscribed||[]}))}unsubscribe(e){return bn(this,void 0,void 0,(function*(){if(ne(`unsubscribe: ${e.join(", ")}`),this.status!==Ne.Connected)throw new p({info:{status:this.status}},"Cannot unsubscribe: socket not connected");yield this.__sendSocketMessage("unsubscribe",{channels:e})}))}_addSocketListeners(){this._socket.on("connect",(()=>this.__handleConnectionChange())),this._socket.on("disconnect",(()=>this.__handleConnectionChange())),this._socket.io.on("reconnect",(()=>this.__handleReconnect())),this._socket.io.on("reconnect_attempt",(()=>this.__handleReconnectAttempt())),this._socket.io.on("reconnect_error",(e=>{this.__lastConnectionError=new p({cause:e,info:{code:De.ReconnectionFailed}},"Socket reconnection failed")})),this._socket.io.on("reconnect_failed",(()=>this.__handleReconnectFailed())),this._socket.on("connect_error",(e=>this.__handleConnectError(e))),this._socket.on("chat_message",(e=>this.__handleChatMessage(e))),this._socket.on("response",(e=>this.__handleMessageResponse(e)))}__cleanupCallbacks(){ne(`cleaning up ${this.__callbacks.size} callbacks`);for(const[e,t]of this.__callbacks.entries()){delete this.__callbacks[e];try{t(null)}catch(e){console.error(e)}}}__getRequestID(){return mn()}__handleChatMessage(e){let t,n;try{t=JSON.parse(e)}catch(e){return void ne(`chat message payload parse error: ${e.message}`)}if("unread"!==t.type)if("error"!==t.type){try{n=JSON.parse(t.message)}catch(e){return void ne(`chat message parse error: ${e.message}`)}this.emit("message",n)}else ne(`socket error from server: ${t.message}`);else{const e=JSON.parse(t.message);this.emit("unread",e)}}__handleConnectError(e){ne(`socket connection error: ${e.message}`),this.setStatus(Ne.Disconnected),this.__lastConnectionError=new p({cause:e,info:{code:De.ConnectionFailed}},"Socket connection failed"),this.emit("connectionError",this.__lastConnectionError)}__handleConnectionChange(){this._socket.id?(ne("socket connected"),this.setStatus(Ne.Connected)):(ne("socket disconnected"),this.setStatus(Ne.Disconnected),this.__cleanupCallbacks())}__handleMessageResponse(e){let t;try{t=JSON.parse(e)}catch(e){return void ne(`message response parse error: ${e.message}`)}const n=this.__callbacks.get(t.wsmid);n?(this.__callbacks.delete(t.wsmid),n(t.response)):ne(`message response callback not found: ${t.wsmid}`)}__handleReconnectAttempt(){ne("socket reconnecting"),this.setStatus(Ne.Connecting)}__handleReconnectFailed(){ne("giving up: socket reconnect failed"),this.setStatus(Ne.Disconnected),this.emit("connectionError",this.__lastConnectionError||new p("Unknown socket connection error"))}__handleReconnect(){ne("socket reconnected"),this.setStatus(Ne.Connected),this.emit("reconnected")}__sendSocketMessage(e,t){return bn(this,void 0,void 0,(function*(){const n=this.__getRequestID();return new Promise(((r,i)=>{const o=()=>{this.__callbacks.delete(n),clearTimeout(s)},s=setTimeout((()=>{if(a(),this._cancelToken.isCancelled())return r(null);o(),i(new p({info:{code:De.SocketResponseTimeout,type:e,wsmid:n}},"Timed-out waiting for response on socket"))}),Cn),a=this._cancelToken.onCancel((()=>{clearTimeout(s)}));this.__callbacks.set(n,(e=>{o(),r(e)})),this._socket.emit(e,JSON.stringify(Object.assign(Object.assign({},t),{wsmid:n})))}))}))}}var On,jn,Pn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};!function(e){e.Flush="lc_flush",e.Message="lc_message",e.Unread="lc_unread"}(On||(On={})),function(e){e.Presence="presence",e.SendMessage="send-message",e.Subscribe="subscribe",e.Unsubscribe="unsubscribe"}(jn||(jn={}));class En extends yn{constructor(){super(...arguments),this.__connectionID=mn(),this.__eventCleanups=[],this.__eventSource=null}connect(){const e=Object.create(null,{connect:{get:()=>super.connect}});return Pn(this,void 0,void 0,(function*(){if(yield e.connect.call(this),ne(`connect sse: ${this._host}`),this.status!==Ne.Disconnected)throw new p({info:{status:this.status}},"Cannot connect: connection in invalid state");return this.setStatus(Ne.Connecting),new Promise(((e,t)=>{this.__eventSource=new EventSource(this.__getConnectionURL()),this.__attachListeners();const n=()=>{i(),t(new Error("Connection failed"))},r=()=>{i(),e()},i=()=>{this.__eventSource.removeEventListener("error",n),this.__eventSource.removeEventListener("open",r);const e=this.__eventCleanups.indexOf(i);e>=0&&this.__eventCleanups.splice(e,1)};this.__eventCleanups.push(i),this.__eventSource.addEventListener("error",n),this.__eventSource.addEventListener("open",r)}))}))}disconnect(){const e=Object.create(null,{disconnect:{get:()=>super.disconnect}});return Pn(this,void 0,void 0,(function*(){if(yield e.disconnect.call(this),ne("disconnect sse"),this.__eventSource){for(const e of this.__eventCleanups)e();this.__eventCleanups=[],this.__eventSource.close(),this.__eventSource=null}this.setStatus(Ne.Disconnected)}))}presence(e,t){return Pn(this,void 0,void 0,(function*(){ne(`send presence: ${e.join(", ")}`),yield this.__sendPayload({channels:e,connectionID:this.__connectionID,eventID:mn(),type:jn.Presence,visible:t})}))}send(e,t){return Pn(this,void 0,void 0,(function*(){if(ne(`send message: ${t.type} @ ${e}`),this.status!==Ne.Connected)throw new p({info:{status:this.status}},"Cannot send: socket not connected");yield this.__sendPayload({connectionID:this.__connectionID,eventID:mn(),message:t,type:jn.SendMessage})}))}subscribe(e){return Pn(this,void 0,void 0,(function*(){if(ne(`subscribe: ${e.join(", ")}`),this.status!==Ne.Connected)throw new p({info:{status:this.status}},"Cannot subscribe: socket not connected");return(yield this.__sendPayload({channels:e,connectionID:this.__connectionID,eventID:mn(),type:jn.Subscribe})).subscribed}))}unsubscribe(e){return Pn(this,void 0,void 0,(function*(){if(ne(`unsubscribe: ${e.join(", ")}`),this.status!==Ne.Connected)throw new p({info:{status:this.status}},"Cannot unsubscribe: socket not connected");yield this.__sendPayload({channels:e,connectionID:this.__connectionID,eventID:mn(),type:jn.Unsubscribe})}))}__attachListeners(){const e=()=>{const e=new p({info:{code:De.ConnectionFailed}},"SSE connection failed");this.emit("connectionError",e),this.__detectConnectivity()},t=()=>{this.__detectConnectivity()},n=e=>{const t=JSON.parse(e.data);switch(null==t?void 0:t.type){case On.Message:{const{message:e}=t;this.emit("message",e);break}case On.Unread:{const{channel:e,count:n}=t;this.emit("unread",{channel:e,count:n});break}}};this.__eventCleanups.push((()=>{for(const e of Object.values(On))this.__eventSource.removeEventListener(e,n);this.__eventSource.removeEventListener("error",e),this.__eventSource.removeEventListener("open",t)}));for(const e of Object.values(On))this.__eventSource.addEventListener(e,n);this.__eventSource.addEventListener("error",e),this.__eventSource.addEventListener("open",t)}__detectConnectivity(){var e;switch(null===(e=this.__eventSource)||void 0===e?void 0:e.readyState){case EventSource.CLOSED:this.setStatus(Ne.Disconnected);break;case EventSource.CONNECTING:this.setStatus(Ne.Connecting);break;case EventSource.OPEN:this.setStatus(Ne.Connected)}}__getConnectionURL(){const e=new URL(this._host);return e.pathname=ae(e.pathname,"/chat/sse/v1/io"),e.searchParams.set("connection",this.__connectionID),e.searchParams.set("token",this._token),e.searchParams.set(de,ue),e}__sendPayload(e){return Pn(this,void 0,void 0,(function*(){var t;const n=yield ce()({url:this.__getConnectionURL().toString().replace(this.__getConnectionURL().search,""),method:"POST",headers:{Authorization:`Bearer ${this._token}`,"Content-Type":"application/json",[de]:ue},body:JSON.stringify({event:e}),timeout:15e3});if(200!==n.status||"object"!=typeof(null===(t=n.body)||void 0===t?void 0:t.result))throw new Error(`Bad response: ${n.status} ${n.statusText}`);return n.body.result}))}}var Tn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};const In=()=>{},Nn=C()("5s"),An=C()("1h"),Ln=C()("15s"),Dn=C()("4s"),Rn=C()("10s");class Mn extends se{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(super(),this._queue=null,this._renotifier=null,this._worker=null,this.__channels=new Map,this.__client=null,this.__connected=null,this.__id=null,this.__lastTyping=null,this.__lastVisibleSetting=Date.now(),this.__presenceSeen=new Map,this.__presenceTimer=null,this.__states=new Map,this.__typingTimeout=null,this.__visible=!0,this._endpoint=e,this._token=t,this._queue=new f.ChannelQueue,n.socket)this.__connection=n.socket;else if(n.transport===Ae.SSE)te("connection option: transport: sse"),this.__connection=new En(e,t);else{const{transport:r}=n,i={};r&&(te(`connection option: transport: ${r}`),i.transports=[r]),this.__connection=new Sn(e,t,i)}this.__connection.on("connecting",(()=>{this.emit("connecting")})),this.__connection.on("connected",(()=>{this.__connected=Date.now(),te("connected"),this.emit("connected"),this.emit("online")})),this.__connection.on("connectionError",(e=>{te(`socket connection failed: ${e.message}`),this.emit("connectionError",new p(e,"LiveChat connection failed")),this.emit("offline")})),this.__connection.on("disconnected",(()=>{this.__connected=null,this.__togglePresenceTimer(!1),te("disconnected"),this.emit("disconnected"),this.emit("offline")})),this.__connection.on("reconnected",(()=>{this.__connected=Date.now(),this.emit("reconnected"),this.__togglePresenceTimer(!0),te("reconnected"),this.__resubscribe().then((()=>{this.emit("online")})).catch((e=>{te(`re-subscription error after reconnect: ${e.message}`),console.error(e)}))})),this.__connection.on("message",(e=>this.__handleIncomingMessage(e))),this.__connection.on("unread",(e=>{this.__handleUnreadUpdate(e.channel,e.count)})),this.__delayedProcessStateTypingStates=j()(this.processStaleTypingStates.bind(this),250),this.__lookup=function(e){let{cacheKey:t,cache:n=new Map,maxAge:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"number"==typeof r&&_(n);const i=function(){for(var i=arguments.length,o=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};const{name:r}=e;for(const r of Reflect.ownKeys(t))m(e,t,r,n);((e,t)=>{const n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)})(e,t),((e,t,n)=>{const r=""===n?"":`with ${n.trim()}() `,i=v.bind(null,r,t.toString());Object.defineProperty(i,"name",b),Object.defineProperty(e,"toString",o(o({},y),{},{value:i}))})(e,t,r)}(i,e,{ignoreNonConfigurable:!0}),w.set(i,n),i}((e=>function(e,t,n){if(!n)throw new Error("Unable to get client info: No client ID provided");const r={url:ae(e,`/chat/client/${n}`),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((e=>e.body))}(this._endpoint,this._token,e)),{maxAge:1e3}),this.__messages=new(S())(An),this.__presence=new(S())(he),this.__typingClients=new(S())(Rn)}get channels(){return this.__channels}get client(){return this.__client}get connection(){return this.__connection}get id(){return this.__id}get isConnected(){return this.__connection.status===Ne.Connected}get isConnecting(){return this.__connection.status===Ne.Connecting}get renotifier(){return this._renotifier}get version(){return"7.3.12"}get visible(){return this.__visible}get worker(){return this._worker}assignChannel(e,t,n){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot assign channel: Not connected");if(!this.__channels.has(e))throw new p(`Cannot assign channel: No config: ${e}`);te(`assign channel: ${e} => ${t}`),yield this.__updateChannel(e);const r=this.__channels.get(e);if(r.channel.assignment!==t){if(t===this.id);else{const e=yield this.lookup(t);e.type!==Ie.Agent&&Se(new p({info:{clientID:t,clientType:e.type,channel:r}},"Cannot assign channel: Client is not an agent")),!n||e.allCategories||e.categoryIDs.includes(n)||Se(new p({info:{clientID:t,clientCategoryIDs:e.categoryIDs,allCategories:e.allCategories,alternateCategoryID:n,channel:r}},"Cannot assign channel: Mismatched alternate category ID"))}yield ge(this._endpoint,this._token,e,t,n)}else te(`channel already assigned to client: ${t}`)}))}broadcast(e,t){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot add broadcast channel: Not connected");if(this.__channels.has(e))throw new p(`Cannot add broadcast channel: Already added: ${e}`);te(`broadcast: ${e} (subscribe: ${t})`),this.__channels.set(e,{id:e,broadcast:!0,subscribe:t,presence:!1,state:{lastTS:null,lastID:null,lastUpdate:null,subscribed:!1,unread:0},channel:null}),this.emit("channelUpdated",e),xe(e)||(yield this.__updateChannel(e)),t?yield this.subscribe([{channelID:e}]):this.emit("channelSubscribed",e)}))}cancelTimeout(e){return Tn(this,void 0,void 0,(function*(){te("cancel timeout"),yield function(e,t,n){const r={url:ae(e,`/chat/channel/${n}/timeout`),method:"DELETE",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((()=>{}))}(this._endpoint,this._token,e)}))}canSubscribe(e){return Tn(this,void 0,void 0,(function*(){const[t,n,r]=yield Promise.all([this.chatCompleted(e),this.chatDeleted(e),this.canView(e)]);return!t&&!n&&r}))}canView(e){return Tn(this,void 0,void 0,(function*(){var t;if(xe(e))return te(`cannot view: channel is a company channel: ${e}`),!1;if(this.client.type===Ie.User&&(null===(t=this.channels.get(e))||void 0===t?void 0:t.subscribe))return!0;const{assignment:n,categoryID:r}=yield fe(this._endpoint,this._token,e);return!this.isOutsideCategory(r)&&(!n||n===this.id||this.client.admin)}))}chatCompleted(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot complete chat: Not connected");return this.__channels.has(e)&&(yield this.__updateChannel(e)),!!(yield this.lookupChannel(e)).completed}))}chatDeleted(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot delete chat: Not connected");return this.__channels.has(e)&&(yield this.__updateChannel(e)),!!(yield this.lookupChannel(e)).deleted}))}completeChat(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot complete chat: Not connected");if(!this.__channels.has(e))throw new p(`Cannot complete chat: No config: ${e}`);te(`complete chat: ${e}`),yield this.__updateChannel(e);const t=this.__channels.get(e);if(t.channel.deleted||t.channel.completed)return void te(`chat already completed/deleted: ${t.id}`);const n=this.__getBroadcastChannels();yield Promise.all([this.__connection.send(t.id,{type:Re.CompleteChat,system:!0,channel:t.id}),...n.map((e=>this.__connection.send(e.id,{type:Re.CompleteChat,system:!0,channel:e.id,payload:{channel:t.id}})))]),yield this.__updateChannel(e),te(`completed chat: ${t.id}`)}))}connect(){return Tn(this,void 0,void 0,(function*(){if(te(`connect (client=${this.version})`),this.isConnected||this.isConnecting)te("already connected: skipping connect");else{yield new Promise(((e,t)=>{if(this.isConnected||this.isConnecting)return void e();const n=()=>{this.__connection.off("connected",r),this.__connection.off("connectionError",i)},r=()=>{n(),e()},i=e=>{te("connection failed"),n(),this.emit("connectionError",e),t(new p(e,"Connection failed"))};this.__connection.once("connected",r),this.__connection.once("connectionError",i),te("connecting"),this.__connection.connect()}));try{this.__id=yield function(e,t){const n={url:ae(e,"/chat/my/id"),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(n).then((e=>{const{id:t}=e.body;return t}))}(this._endpoint,this._token),yield this.__fetchClientInfo()}catch(e){throw this.__connection.disconnect(),new p(e,"Failed connecting")}this.__togglePresenceTimer(!0),te("connected")}}))}deleteChat(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot delete chat: Not connected");if(!this.__channels.has(e))throw new p(`Cannot delete chat: No config: ${e}`);te(`delete channel: ${e}`),yield this.__updateChannel(e);const t=this.__channels.get(e);t.channel.deleted?te(`chat already deleted: ${t.id}`):(yield function(e,t,n){const r={url:ae(e,`/chat/channel/${n}`),method:"DELETE",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((()=>{}))}(this._endpoint,this._token,t.id),yield this.__updateChatDeleted(e,!0),te(`deleted channel: ${t.id}`))}))}disableNotificationWorker(){return Tn(this,void 0,void 0,(function*(){te("start to disable notification worker"),this._worker?(yield this._worker.stop(),this._worker=null):te("worker agent for sse is not initialised")}))}disconnect(){return Tn(this,void 0,void 0,(function*(){te("disconnect"),this.isConnected||this.isConnecting?(this.__togglePresenceTimer(!1),yield new Promise((e=>{if(!this.isConnected&&!this.isConnecting)return void e();let t=()=>{te("disconnected"),this.__connection.off("disconnected",t),t=In,e()};this.__connection.once("disconnected",t),te("disconnecting");try{this.__connection.disconnect()}catch(e){te(`disconnect error: ${e.message}`),t()}}))):te("not connected: skipping disconnect")}))}enableNotificationWorker(e,t,n,r,i){return Tn(this,void 0,void 0,(function*(){te("start to enable notification worker"),this._worker||(te("initialise new notification worker"),this._worker=new $e(this,this._endpoint,this._token)),yield this._worker.start(e,t,n,r,i)}))}getAgents(){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot fetch agents: Not connected");const e=yield this.lookup(this.id);return function(e,t,n){const r={url:ae(e,`/chat/company/${n}/agents`),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((e=>{const{agents:t}=e.body;return t}))}(this._endpoint,this._token,e.companyID)}))}getCategories(){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot fetch categories: Not connected");const e=yield this.lookup(this.id);return function(e,t,n){const r={url:ae(e,`/chat/company/${n}/categories`),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((e=>{const{categories:t}=e.body;return t}))}(this._endpoint,this._token,e.companyID)}))}getChannelAssignment(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot fetch channel assignment: Not connected");return(yield this.lookupChannel(e)).assignment}))}getChannelCategory(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot fetch channel category: Not connected");return(yield this.lookupChannel(e)).categoryID}))}getChannelConfig(e){return this.__channels.has(e)?this.__channels.get(e):null}getChannelLeadID(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot fetch channel lead ID: Not connected");return(yield this.lookupChannel(e)).leadID}))}getChannelMembers(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot fetch channel members: Not connected");const t=yield this.lookupChannel(e);return function(e,t,n){const r={url:ae(e,`/chat/channel/${n}/members`),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((e=>{const{members:t}=e.body;return t}))}(this._endpoint,this._token,t.channel)}))}getChannelMessages(e){return Tn(this,arguments,void 0,(function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return function*(){if(!t.isConnected)throw new p("Cannot fetch channel messages: Not connected");let o;return o=null===n?yield me(t._endpoint,t._token,e,void 0,void 0,i):yield me(t._endpoint,t._token,e,n,r,i),o.messages}()}))}getChat(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot fetch recent chats: Not connected");const t=yield this.lookup(this.id),n=yield function(e,t,n,r){return i=this,s=function*(){const i={url:ae(e,`/chat/company/${n}/chat/${r}`),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(i).then((e=>{const{chat:t}=e.body;return t}))},new((o=void 0)||(o=Promise))((function(e,t){function n(e){try{a(s.next(e))}catch(e){t(e)}}function r(e){try{a(s.throw(e))}catch(e){t(e)}}function a(t){t.done?e(t.value):function(e){return e instanceof o?e:new o((function(t){t(e)}))}(t.value).then(n,r)}a((s=s.apply(i,[])).next())}));var i,o,s}(this._endpoint,this._token,t.companyID,e);return this.__updateChannelFromCompanyMessage(n),n}))}getChats(e,t){return Tn(this,arguments,void 0,(function(e,t){var n=this;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return function*(){if(!n.isConnected)throw new p("Cannot fetch recent chats: Not connected");const s=yield n.lookup(n.id),a=yield function(e,t,n,r,i){let o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,s=arguments.length>7&&void 0!==arguments[7]&&arguments[7],a=ae(e,`/chat/company/${n}/chats?state=${r}&count=${i}&offset=${arguments.length>5&&void 0!==arguments[5]?arguments[5]:0}`);"number"==typeof o&&(a=`${a}&since=${o}`),!0===s&&(a=`${a}&only=total`);const l={url:a,method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(l).then((e=>{const{messages:t,total:n}=e.body;return{chats:t,total:n}}))}(n._endpoint,n._token,s.companyID,e,t,r,i,o);for(const e of a.chats)n.__updateChannelFromCompanyMessage(e);return a}()}))}getCompanySettings(){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot fetch online agents: Not connected");return function(e,t,n){const r={url:ae(e,`/chat/company/${n}/settings`),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((e=>e.body))}(this._endpoint,this._token,this.client.companyID)}))}getOnlineAgents(){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot fetch online agents: Not connected");return function(e,t,n){const r={url:ae(e,`/chat/company/${n}/online-agents`),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((e=>{const{clients:t}=e.body;return t}))}(this._endpoint,this._token,this.client.companyID)}))}getPresence(){const e={};for(const[t,n]of this.__presence.entries())e[t]=n;return e}getState(e){return Tn(this,arguments,void 0,(function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function*(){if(!t.isConnected)throw new p("Cannot get state: Not connected");if(!e)throw new p("Invalid client ID for state request");return te(`get state: ${e} (force=${n})`),yield t._queue.channel("state-update").enqueue((()=>Tn(t,void 0,void 0,(function*(){if(n||!this.__states.has(e)||Date.now()-this.__states.get(e).lastUpdate>=Ln){te(`update state: ${e}`);const t=yield function(e,t,n){const r={url:ae(e,`/chat/client/${n}/state`),method:"GET",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe};return ce()(r).then((e=>{const{state:t}=e.body;return t||{}}))}(this._endpoint,this._token,e);this.__updateState(e,t,Date.now())}}))),f.TaskPriority.High,`fetch-state:${e}`),t.__states.get(e).state}()}))}getStates(){const e={};for(const[t,n]of this.__states.entries())e[t]=n.state;return e}getUnreadCounts(){const e={};for(const[t,n]of this.__channels.entries())n.state.unread>0&&(e[t]=n.state.unread);return e}isBroadcasting(e){const t=this.__channels.get(e);return!!t&&t.broadcast}isOutsideCategory(e){const{allCategories:t,categoryIDs:n,type:r}=this.__client;return!(!e||r!==Ie.Agent||t||-1!==n.indexOf(e))}isSubscribed(e){const t=this.__channels.get(e);return!!t&&t.state.subscribed}lookup(e){return Tn(this,void 0,void 0,(function*(){if(!e)throw new Error(`Failed requesting client details: Invalid client ID provided: ${e}`);return this.__lookup(e)}))}lookupChannel(e){return Tn(this,void 0,void 0,(function*(){if(!e)throw new Error(`Failed requesting channel details: Invalid channel ID provided: ${e}`);return this._queue.channel("channel-update").enqueue((()=>Tn(this,void 0,void 0,(function*(){const t=yield fe(this._endpoint,this._token,e),n=this.__channels.get(e);return n&&(this.__channels.set(e,Object.assign(Object.assign({},n),{channel:t})),this.emit("channelUpdated",e)),t}))),f.TaskPriority.High,`lookup-channel:${e}`)}))}markRead(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot mark read: Not connected");if(0!==e.length){te(`mark ${e.length} as read`),yield function(e,t,n){const r={url:ae(e,"/chat/channels/mark-read"),method:"POST",timeout:pe,headers:{Authorization:`Bearer ${t}`,[de]:ue},body:{channels:n}};return ce()(r).then((()=>{}))}(this._endpoint,this._token,e);for(const t of e){const e=this.__channels.get(t);e?xe(t)?te(`cannot mark read: channel is a company channel: ${t}`):(this.__channels.set(t,Object.assign(Object.assign({},e),{state:Object.assign(Object.assign({},e.state),{unread:0})})),this.emit("channelUpdated",t)):te(`cannot mark read locally: channel not registered: ${t}`)}this.__notifyUnread()}}))}notifyLeadData(e,t){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot notify: Not connected");if(this.client.type!==Ie.Agent)throw new p("Cannot notify: Must be an agent to perform this action");yield function(e,t,n,r){const i={url:ae(e,`/chat/client/${n}/notify/lead-data`),method:"POST",headers:{Authorization:`Bearer ${t}`,[de]:ue},body:{channels:r},timeout:pe};return ce()(i).then((()=>{}))}(this._endpoint,this._token,e,t)}))}presence(e,t){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot update presence: Not connected");te(`mark presence on channels: ${e.join(", ")}`);const n=[];for(const[t,r]of this.__channels.entries())r.broadcast?(this.__channels.set(t,Object.assign(Object.assign({},r),{presence:!0})),n.push(t)):e.includes(t)?(r.presence||te(`presence on: ${t}`),this.__channels.set(t,Object.assign(Object.assign({},r),{presence:!0})),this.emit("channelUpdated",t),n.push(t)):(r.presence&&te(`presence off: ${t}`),this.__channels.set(t,Object.assign(Object.assign({},r),{presence:!1})),this.emit("channelUpdated",t));"boolean"!=typeof t||(yield this.setVisibility(t),t)?yield this.__connection.presence(n,this.__visible):yield function(e,t){const n={url:ae(e,"/chat/my/presence"),method:"DELETE",headers:{Authorization:`Bearer ${t}`,[de]:ue}};return ce()(n).then((()=>{}))}(this._endpoint,this._token)}))}processStaleTypingStates(){var e,t;const n=[],r=[],i={};for(const[o,s]of this.__typingClients.entries())s.tse!==this.id))),this.emit("typingClientsInChannels",i)}registerDevice(e,t){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot register device: Not connected");te(`register device: ${e} = ${t}`),yield function(e,t,n,r){const i={url:ae(e,"/chat/my/device"),method:"PUT",headers:{Authorization:`Bearer ${t}`,[de]:ue},body:{device:{type:n,token:r}},timeout:pe};return ce()(i).then((()=>{}))}(this._endpoint,this._token,e,t)}))}sendText(e,t){return Tn(this,arguments,void 0,(function(e,t){var n=this;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){if(!n.isConnected)throw new p("Cannot send on channel: Not connected");const{attachments:i=null,tag:o=null}=r,s=n.__channels.get(e);if(!s)throw new p(`Cannot send on channel: No config: ${e}`);const a=n.__getBroadcastChannels();te(`send text for channel ${s.id}: ${t}`);const l={type:Re.Message,system:!1,channel:s.id,text:t};o&&(l.payload=l.payload||{},l.payload.tag=o),Array.isArray(i)&&(l.payload=l.payload||{},l.payload.attachments=i),yield Promise.all([n.__connection.send(s.id,l),...a.map((e=>n.__connection.send(e.id,{type:Re.Message,system:!0,channel:e.id,payload:{channel:s.id,tag:o}})))]),n.typing(s.id,!1)}()}))}setState(e){return Tn(this,arguments,void 0,(function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function*(){if(!t.isConnected)throw new p("Cannot update state: Not connected");if(!e||"object"!=typeof e)throw new Error("Invalid state: must be an object");let r;return te(`set state (merge=${n})`),r=n?A(yield t.getState(t.id,!0),e):I(e),r=yield function(e,t,n,r){const i={url:ae(e,`/chat/client/${n}/state`),method:"PUT",headers:{Authorization:`Bearer ${t}`,[de]:ue},body:{state:r},timeout:pe};return ce()(i).then((e=>{const{state:t}=e.body;return t}))}(t._endpoint,t._token,t.id,r),te(`state updated (merge=${n})`),t.__updateState(t.id,r,Date.now()),r}()}))}setTitle(e,t){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot set title: Not connected");if(!t||0===t.length)throw new p(`Invalid channel title: ${t}`);const n=this.__channels.get(e);if(!n)throw new p(`Cannot set title: No config: ${e}`);te(`set channel title: ${e} => ${t}`),yield function(e,t,n,r){const i={url:ae(e,`/chat/channel/${n}/title`),method:"PUT",headers:{Authorization:`Bearer ${t}`,[de]:ue},body:{title:r},timeout:pe};return ce()(i).then((()=>{}))}(this._endpoint,this._token,n.id,t);const r=this.__getBroadcastChannels(),i={channel:n.id,title:t};yield Promise.all([this.__connection.send(n.id,{type:Re.SetTitle,system:!0,channel:n.id,text:"",payload:i}),...r.map((e=>this.__connection.send(e.id,{type:Re.SetTitle,system:!0,channel:e.id,payload:i})))]),this.emit("title",{channel:e,title:t}),te("channel title changed")}))}setVisibility(e){return Tn(this,void 0,void 0,(function*(){this.__visible!==e&&(this.__visible=e,yield function(e,t,n){const r={url:ae(e,"/chat/my/visibility"),method:"PUT",headers:{Authorization:`Bearer ${t}`,[de]:ue},body:{visible:n},timeout:pe};return ce()(r).then((()=>{}))}(this._endpoint,this._token,e),te(`visibility changed: visible: ${e}`),this.emit("visibilityChanged",e))}))}subscribe(e){return Tn(this,void 0,void 0,(function*(){var t;if(!this.isConnected)throw new p("Cannot subscribe to channel: Not connected");const n=new Set,r=e.reduce(((e,t)=>{let{channelID:r,alternateCategoryID:i=null}=t;if(this.__channels.has(r)){let e=this.__channels.get(r);i&&e.channel.categoryID!==i&&this.__channels.delete(r)}if(this.__channels.has(r)){let t=this.__channels.get(r);if(t.state.subscribed||!t.subscribe)return e;e.push(t)}else{const t={id:r,broadcast:!1,subscribe:!0,presence:!1,state:{lastID:null,lastTS:null,lastUpdate:null,subscribed:!1,unread:0},channel:null,alternateCategoryID:i};e.push(t),this.__channels.set(r,t),n.add(r)}return e}),[]);if(n.size>0){const{chats:e,expired:i}=yield function(e,t,n){const r={url:ae(e,"/chat/channels/get-info"),method:"POST",headers:{Authorization:`Bearer ${t}`,[de]:ue},timeout:pe,body:{channels:n}};return ce()(r).then((e=>{const{chats:t,expired:n=[]}=e.body;return{chats:t,expired:n}}))}(this._endpoint,this._token,[...n]);for(const o of n){const n=r.find((e=>e.id===o)),s=e.find((e=>e.channel===o)),a=Object.assign(Object.assign({},s),{categoryID:null!==(t=n.alternateCategoryID)&&void 0!==t?t:s.categoryID});if(!a){te(`subscription cancelled: no chat info received: ${o}`),this.__channels.delete(o);const e=r.indexOf(n);r.splice(e,1);continue}n.channel=a,n.state.lastUpdate=Date.now();const l=i.indexOf(o)>=0,c=this.isOutsideCategory(null==a?void 0:a.categoryID);if(this.client.type!==Ie.Agent||this.client.admin||!a.assignment||a.assignment===this.id){if(l||c){te(`subscription cancelled: ${l?"channel expired":"channel not in own category"}: ${o}`),n.subscribe=!1,n.broadcast=!1;const e=r.indexOf(n);r.splice(e,1)}this.__channels.set(o,n),this.emit("channelUpdated",o)}else{te(`subscription cancelled: channel assigned to other: ${o}`),this.__channels.delete(o);const e=r.indexOf(n);r.splice(e,1)}}}const i=r.map((e=>e.id));if(i.length<=0)return[];te(`subscribe channels: ${i.join(", ")}`);const o=yield this.__connection.subscribe(i);for(const e of o){const t=r.find((t=>t.id===e));this.__channels.set(e,Object.assign(Object.assign({},t),{state:Object.assign(Object.assign({},t.state),{subscribed:!0})})),this.emit("channelUpdated",e),this.emit("channelSubscribed",e)}return te(`subscribed channels: ${o.join(", ")}`),o}))}toggleRenotifier(e,t){return Tn(this,void 0,void 0,(function*(){this._renotifier||(this._renotifier=new we(this,this._endpoint,this._token),this.emit("renotifierCreated")),e?yield this._renotifier.start(t):yield this._renotifier.stop()}))}typing(e,t){return Tn(this,void 0,void 0,(function*(){yield this.__typing(e,t)}))}unassignChannel(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot unassign channel: Not connected");if(!this.__channels.has(e))throw new p(`Cannot unassign channel: No config: ${e}`);te(`unassign channel: ${e}`),yield this.__updateChannel(e);const t=this.__channels.get(e);t.channel.assignment?yield ge(this._endpoint,this._token,e,null):te(`channel is not assigned to a client: ${t.id}`)}))}unsubscribe(e){return Tn(this,void 0,void 0,(function*(){if(!this.isConnected)throw new p("Cannot unsubscribe to channel: Not connected");te(`unsubscribe channels: ${e.join(", ")}`);const t=e.reduce(((e,t)=>{if(this.__channels.has(t)){const n=this.__channels.get(t);e.push(n)}else te(`skip unsubscribe: no config: ${t}`);return e}),[]),n=t.map((e=>e.id));if(!(n.length<=0)){te(`unsubscribe channels: ${n.join(", ")}`),yield this.__connection.unsubscribe(n);for(const e of t)this.__channels.set(e.id,Object.assign(Object.assign({},e),{state:Object.assign(Object.assign({},e.state),{subscribed:!1})})),this.emit("channelUnsubscribed",e.id),this.__handleUnreadUpdate(e.id,0);te(`unsubscribed channels: ${n.join(", ")}`)}}))}__fetchClientInfo(){return Tn(this,void 0,void 0,(function*(){this.__client||(yield this._queue.channel("client-info").enqueue((()=>Tn(this,void 0,void 0,(function*(){te("fetch client info");const e=yield this.lookup(this.id);te(`received client info: ${e.type}`),this.__client=Object.freeze(Object.assign({},e)),this.client.admin&&te("client is admin"),te(`client categories: ${e.allCategories?"all":e.categoryIDs.join(", ")}`)}))),void 0,"info"))}))}__getBroadcastChannels(){const e=[];return this.__channels.forEach((t=>{t.broadcast&&e.push(t)})),e}__handleIncomingMessage(e){if(e.id&&e.type||Se(new p({info:{message:e}},"Invalid message received")),te(`incoming: ${e.type} (${e.id} from ${e.channel})`),e.system||this.__messages.has(e.id)){if(e.system)switch(e.type){case Re.ChatAssigned:this.__updateChatAssignment(e.payload.channel,e.payload.client,e.payload.assigner,e.payload.categoryID).catch((e=>{te(`chat assignment error: ${e.message}`),console.error(e)}));break;case Re.ChatUnassigned:this.__updateChatAssignment(e.payload.channel,null,e.payload.assigner,null).catch((e=>{te(`chat assignment error: ${e.message}`),console.error(e)}));break;case Re.CompleteChat:this.__updateChatCompleted(e.payload?e.payload.channel:e.channel,!0).catch((e=>{te(`chat completion error: ${e.message}`),console.error(e)}));break;case Re.DeleteChat:this.__updateChatDeleted(e.payload?e.payload.channel:e.channel,!0).catch((e=>{te(`chat deletion error: ${e.message}`),console.error(e)}));break;case Re.Message:this.__handleMessageSubscription(e);break;case Re.Presence:{if(null!==e.from)break;te(`presence message: ${JSON.stringify(e)}`);const t=JSON.parse(e.text);this.__updatePresence(e.channel,t);break}case Re.SetState:if(null===e.from&&this.__connected&&e.timestamp>=this.__connected){if(!this.__channels.get(e.channel)){te(`cannot process state setting: no config for channel: ${e.channel}`);break}const{client:t,state:n}=e.payload;this.__updateState(t,n,e.timestamp)}break;case Re.SetTitle:{const{channel:t,title:n}=e.payload,r=this.__channels.get(t);if(r){if(!r.channel){te(`no channel to update title for: ${t}`);break}this.__channels.set(t,Object.assign(Object.assign({},r),{channel:Object.assign(Object.assign({},r.channel),{title:n})})),this.emit("channelUpdated",t),this.emit("title",{channel:t,title:n})}break}case Re.Typing:if(e.from===this.id)break;this.__typingClients.set(e.from,{clientID:e.from,ts:e.timestamp,typing:"1"===e.text,channel:e.channel}),this.__delayedProcessStateTypingStates();break;case Re.VisibilityChanged:{const{payload:{client:t,visible:n},timestamp:r}=e;t===this.id&&n!==this.__visible&&r>this.__lastVisibleSetting&&(this.__visible=n,this.__lastVisibleSetting=r,this.emit("visibilityChanged",n));break}case Re.Rated:this.__handleRating(e);break;default:te(`unknown message type: ${e.type} (${e.id})`)}}else this.__messages.set(e.id,e),te(`message received: ${e.id} (from=${e.from} channel=${e.channel} type=${e.type})`),this.emit("message",e);!0===e.system&&this.emit("system",e)}__handleRating(e){var t,n,r,i;const o=e.channel,s=this.__channels.get(o),a=(null===(n=null===(t=e.payload)||void 0===t?void 0:t.event)||void 0===n?void 0:n.rating)||null,l=(null===(i=null===(r=e.payload)||void 0===r?void 0:r.event)||void 0===i?void 0:i.feedback)||null;if(s){if(!s.channel)return void te(`no channel to update rating for: ${o}`);this.__channels.set(o,Object.assign(Object.assign({},s),{channel:Object.assign(Object.assign({},s.channel),{rating:a,feedback:l})})),this.emit("channelUpdated",o),this.emit("rating",e)}}__handleMessageSubscription(e){var t;const n=(null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.channel)||e.channel;this.client.type===Ie.Agent&&(this.__channels.has(n)||xe(n)||(te(`subscribe channel with message: ${n} (message=${e.id} type=${e.type})`),this.subscribe([{channelID:n}]).then((e=>{e.indexOf(n)>=0&&this.emit("autoSubscribed",n)})).catch((e=>{te(`message subscription error: ${e.message}`),console.error(e)}))))}__handleUnreadUpdate(e,t){if(!this.__channels.has(e))return void te(`cannot update unread count: no config for channel: ${e}`);if(xe(e))return void te(`cannot update unread count: channel is a company channel: ${e}`);if(!this.isSubscribed(e)&&t>0)return void te(`cannot update unread count: channel is unsubscribed: ${e}`);const n=this.__channels.get(e);n.state.unread!==t&&(te(`unread count: ${e} = ${t}`),this.__channels.set(e,Object.assign(Object.assign({},n),{state:Object.assign(Object.assign({},n.state),{unread:t})})),this.emit("channelUpdated",e),this.__notifyUnread())}__notifyUnread(){const e={};for(const[t,n]of this.__channels.entries())!n.broadcast||n.subscribe?e[t]=n.state.unread:te(`skip channel unread notify: broadcast only channel: ${t}`);this.emit("unreadCounts",e)}__resubscribe(){return Tn(this,void 0,void 0,(function*(){te("resubscribe channels");const e=[];for(const[t,n]of this.__channels.entries())n.subscribe&&e.push(t);if(0===e.length)return void te("no channels subscribed: nothing to do");te(`subscribe channels: ${e.join(", ")}`);const t=yield this.__connection.subscribe(e);for(const e of t){const t=this.__channels.get(e);this.__channels.set(e,Object.assign(Object.assign({},t),{state:Object.assign(Object.assign({},t.state),{subscribed:!0})})),this.emit("channelUpdated",e)}te(`resubscribed channels: ${t.join(", ")}`)}))}__togglePresenceTimer(e){if(e){if(null!==this.__presenceTimer)return;te("presence timer => on"),this.__presenceTimer=(0,z.MS)(this.__touchPresence.bind(this),Nn)}else{if(null===this.__presenceTimer)return;te("presence timer => off"),(0,z.dM)(this.__presenceTimer),this.__presenceTimer=null}}__touchPresence(){return Tn(this,void 0,void 0,(function*(){try{const e=[];for(const t of this.__channels.values())t.presence&&e.push(t.id);te(`presence: ${e.join(", ")} (visible=${this.__visible})`),yield this.__connection.presence(e,this.__visible)}catch(e){te(`presence error: ${e.message}`)}for(const[e,t]of this.__presenceSeen.entries()){const n=this.__presence.get(e)||[];Ce(t,n)||(this.__presenceSeen.set(e,[...n]),this.emit("presence",{channel:e,clients:[...n]}))}}))}__typing(e){return Tn(this,arguments,void 0,(function(e){var t=this;let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function*(){yield t._queue.channel("typing").enqueue((()=>Tn(t,void 0,void 0,(function*(){if(clearTimeout(this.__typingTimeout),n&&(this.__typingTimeout=setTimeout((()=>this.__typing(e,!1)),Dn)),n===this.__lastTyping)return;te(`typing: ${n} @ ${e}`),this.__lastTyping=n;const t=this.__channels.get(e);yield this.__connection.send(t.id,{type:Re.Typing,system:!0,channel:t.id,text:n?"1":"0"})})))),t.__delayedProcessStateTypingStates()}()}))}__updateChannel(e){return Tn(this,void 0,void 0,(function*(){if(!this.__channels.has(e))throw new p(`Cannot update channel info: No channel registered: ${e}`);yield this._queue.channel("channel-update").enqueue((()=>Tn(this,void 0,void 0,(function*(){const t=yield fe(this._endpoint,this._token,e);te(`updated channel: ${e} (completed=${t.completed} deleted=${!!t.deleted})`);const n=this.__channels.get(e);n&&(this.__channels.set(e,Object.assign(Object.assign({},n),{state:Object.assign(Object.assign({},n.state),{lastUpdate:Date.now()}),channel:Object.assign({},t)})),this.emit("channelUpdated",e))}))),f.TaskPriority.Normal,`update-channel:${e}`)}))}__updateChannelFromCompanyMessage(e){if(!this.__channels.has(e.channel))return;const t=this.__channels.get(e.channel);t.channel&&(this.__channels.set(t.id,Object.assign(Object.assign({},t),{channel:Object.assign(Object.assign({},t.channel),{assignment:e.assignment,completed:e.completed,deleted:e.deleted,leadID:e.leadID,state:e.state,title:e.channelTitle})})),this.emit("channelUpdated",t.id))}__updateChatAssignment(e,t,n,r){return Tn(this,void 0,void 0,(function*(){if(xe(e))throw new p(`Cannot update chat for channel: Channel is company channel: ${e}`);let i=!1;const o=yield this.canView(e);yield this._queue.channel("channel-update").enqueue((()=>Tn(this,void 0,void 0,(function*(){if(te(`start assignment update for channel: ${e} (subscribed: ${this.isSubscribed(e)})`),!o)return te(`unable to update chat assignment: no access: ${e}`),void(this.isSubscribed(e)&&(yield this.unsubscribe([e])));if(!this.isSubscribed(e))if(te(`updating chat assignment requires subscription: ${e}`),t&&t!==this.id)te(`unable to update chat assignment: assigned to another: ${e} (assignee: ${t})`);else{if(te(`subscribing channel for chat assignment: ${e}`),-1===(yield this.subscribe([{channelID:e,alternateCategoryID:r}])).indexOf(e))throw new p(`Cannot update chat assignment: Failed subscribing new channel: ${e}`);this.emit("autoSubscribed",e)}const s=this.__channels.get(e);if(!s.channel)return te(`no channel to update assignment for: fetching channel instead: ${e}`),void(i=!0);s.channel.assignment!==t||r?(this.__channels.set(s.id,Object.assign(Object.assign({},s),{channel:Object.assign(Object.assign({},s.channel),{assignment:t})})),this.emit("channelUpdated",e),te(`chat assignment: ${s.id} now assigned to: ${t}`),t?this.emit("chatAssigned",{channel:s.id,assignment:t,assigner:n,alternateCategoryID:r}):this.emit("chatUnassigned",{channel:s.id,assignment:null,assigner:n})):te(`chat assignment already matches: ${e} => ${t}`)}))),f.TaskPriority.Normal,`update-assignment:${e}:${null!=t?t:""}:${null!=r?r:""}`),i&&(yield this.__updateChannel(e),te(`chat assignment: ${e} now assigned to: ${this.__channels.get(e).channel.assignment}`))}))}__updateChatCompleted(e){return Tn(this,arguments,void 0,(function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function*(){if(t.__channels.has(e)){if(xe(e))throw new p(`Cannot update chat for channel: Channel is company channel: ${e}`);yield t._queue.channel("channel-update").enqueue((()=>Tn(t,void 0,void 0,(function*(){const t=this.__channels.get(e),r=!!t.channel&&!!t.channel.completed,i=yield fe(this._endpoint,this._token,e);r||!i.completed&&!n||(this.__channels.set(e,Object.assign(Object.assign({},t),{broadcast:!1,subscribe:!1,channel:Object.assign(Object.assign({},i),{completed:i.completed||Date.now()})})),this.emit("channelUpdated",e),te(`chat completed: ${e}`),this.emit("chatCompleted",e))}))),f.TaskPriority.Normal,`update-completed:${e}`)}}()}))}__updateChatDeleted(e){return Tn(this,arguments,void 0,(function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function*(){if(t.__channels.has(e)){if(xe(e))throw new p(`Cannot update chat for channel: Channel is company channel: ${e}`);yield t._queue.channel("channel-update").enqueue((()=>Tn(t,void 0,void 0,(function*(){const t=this.__channels.get(e),r=!!t.channel&&!!t.channel.deleted,i=yield fe(this._endpoint,this._token,e);r||!i.deleted&&!n||(this.__channels.set(e,Object.assign(Object.assign({},t),{channel:Object.assign({},i)})),this.emit("channelUpdated",e),te(`chat deleted: ${e}`),this.emit("chatDeleted",e))}))),f.TaskPriority.Normal,`update-deleted:${e}`)}}()}))}__updatePresence(e,t){if(!this.__channels.has(e))return;const n=t.sort();this.__presence.set(e,n),this.__presenceSeen.set(e,n),this.emit("presence",{channel:e,clients:[...n]})}__updateState(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();te(`update client state: ${e} (${JSON.stringify(t)})`),this.__states.set(e,{state:t,lastUpdate:n}),this.emit("state",{clientID:e,state:t})}}var $n,Un=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};($n||($n={})).Message="lc_message";class Fn extends yn{constructor(e){super(e,null),this.__connectionID=mn(),this.__eventCleanups=[],this.__eventSource=null}checkConnection(){return Un(this,void 0,void 0,(function*(){ne("check mock sse connection start"),yield new Promise(((e,t)=>{if(this.status===Ne.Connected)return ne("mock sse already connected!"),void e();const n=()=>{this.off("connectionError",i),this.off("connected",r)},r=()=>{ne("mock sse connected"),n(),e()},i=e=>{n(),ne("mock sse connection failed");const r=new p(e,"Mock connection failed");t(r)};this.once("connected",r),this.once("connectionError",i),this.connect()})),ne("check mock sse connection end")}))}connect(){const e=Object.create(null,{connect:{get:()=>super.connect}});return Un(this,void 0,void 0,(function*(){if(yield e.connect.call(this),ne(`connect mock sse: ${this._host}`),this.status!==Ne.Disconnected)throw new p({info:{status:this.status}},"Cannot connect: connection in invalid state");return this.setStatus(Ne.Connecting),new Promise(((e,t)=>{this.__eventSource=new EventSource(this.__getConnectionURL()),this.__attachListeners();const n=()=>{i(),t(new Error("Mock connection failed"))},r=()=>{i(),e()},i=()=>{this.__eventSource.removeEventListener("error",n),this.__eventSource.removeEventListener("open",r);const e=this.__eventCleanups.indexOf(i);e>=0&&this.__eventCleanups.splice(e,1)};this.__eventCleanups.push(i),this.__eventSource.addEventListener("error",n),this.__eventSource.addEventListener("open",r)}))}))}disconnect(){const e=Object.create(null,{disconnect:{get:()=>super.disconnect}});return Un(this,void 0,void 0,(function*(){if(yield e.disconnect.call(this),ne("disconnect mock sse"),this.__eventSource){for(const e of this.__eventCleanups)e();this.__eventCleanups=[],this.__eventSource.close(),this.__eventSource=null}this.setStatus(Ne.Disconnected)}))}__attachListeners(){const e=e=>{const t=new p({info:{code:De.ConnectionFailed}},`SSE mock connection failed: ${JSON.stringify({err:e})}`);this.emit("connectionError",t),this.__detectConnectivity()},t=()=>{this.__detectConnectivity()},n=e=>{const t=JSON.parse(e.data);switch(null==t?void 0:t.type){case $n.Message:{const{message:e}=t;this.emit("message",e);break}}};this.__eventCleanups.push((()=>{for(const e of Object.values($n))this.__eventSource.removeEventListener(e,n);this.__eventSource.removeEventListener("error",e),this.__eventSource.removeEventListener("open",t)}));for(const e of Object.values($n))this.__eventSource.addEventListener(e,n);this.__eventSource.addEventListener("error",e),this.__eventSource.addEventListener("open",t)}__detectConnectivity(){var e;switch(null===(e=this.__eventSource)||void 0===e?void 0:e.readyState){case EventSource.CLOSED:this.setStatus(Ne.Disconnected);break;case EventSource.CONNECTING:this.setStatus(Ne.Connecting);break;case EventSource.OPEN:this.setStatus(Ne.Connected)}}__getConnectionURL(){const e=new URL(this._host);return e.pathname=ae(e.pathname,"/public/test"),e.searchParams.set("connection",this.__connectionID),e.searchParams.set(de,ue),e}}window.__to_bugsnag_from_ca__=e=>{window.__to_bugsnag__&&window.__to_bugsnag__(e)}},4912:(e,t,n)=>{"use strict";n.r(t),n.d(t,{useCallback:()=>S,useContext:()=>O,useDebugValue:()=>j,useEffect:()=>_,useErrorBoundary:()=>P,useId:()=>E,useImperativeHandle:()=>C,useLayoutEffect:()=>w,useMemo:()=>k,useReducer:()=>b,useRef:()=>x,useState:()=>y});var r,i,o,s,a=n(3162),l=0,c=[],u=a.options,d=u.__b,h=u.__r,p=u.diffed,f=u.__c,m=u.unmount,g=u.__;function v(e,t){u.__h&&u.__h(i,e,l||t),l=0;var n=i.__H||(i.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function y(e){return l=1,b(R,e)}function b(e,t,n){var o=v(r++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):R(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=i,!i.__f)){var s=function(e,t,n){if(!o.__c.__H)return!0;var r=o.__c.__H.__.filter((function(e){return!!e.__c}));if(r.every((function(e){return!e.__N})))return!a||a.call(this,e,t,n);var i=o.__c.props!==e;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(i=!0)}})),a&&a.call(this,e,t,n)||i};i.__f=!0;var a=i.shouldComponentUpdate,l=i.componentWillUpdate;i.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,s(e,t,n),a=r}l&&l.call(this,e,t,n)},i.shouldComponentUpdate=s}return o.__N||o.__}function _(e,t){var n=v(r++,3);!u.__s&&D(n.__H,t)&&(n.__=e,n.u=t,i.__H.__h.push(n))}function w(e,t){var n=v(r++,4);!u.__s&&D(n.__H,t)&&(n.__=e,n.u=t,i.__h.push(n))}function x(e){return l=5,k((function(){return{current:e}}),[])}function C(e,t,n){l=6,w((function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}}),null==n?n:n.concat(e))}function k(e,t){var n=v(r++,7);return D(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function S(e,t){return l=8,k((function(){return e}),t)}function O(e){var t=i.context[e.__c],n=v(r++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(i)),t.props.value):e.__}function j(e,t){u.useDebugValue&&u.useDebugValue(t?t(e):e)}function P(e){var t=v(r++,10),n=y();return t.__=e,i.componentDidCatch||(i.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]}function E(){var e=v(r++,11);if(!e.__){for(var t=i.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function T(){for(var e;e=c.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(A),e.__H.__h.forEach(L),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){i=null,d&&d(e)},u.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),g&&g(e,t)},u.__r=function(e){h&&h(e),r=0;var t=(i=e.__c).__H;t&&(o===i?(t.__h=[],i.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.forEach(A),t.__h.forEach(L),t.__h=[],r=0)),o=i},u.diffed=function(e){p&&p(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==c.push(t)&&s===u.requestAnimationFrame||((s=u.requestAnimationFrame)||N)(T)),t.__H.__.forEach((function(e){e.u&&(e.__H=e.u),e.u=void 0}))),o=i=null},u.__c=function(e,t){t.some((function(e){try{e.__h.forEach(A),e.__h=e.__h.filter((function(e){return!e.__||L(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],u.__e(n,e.__v)}})),f&&f(e,t)},u.unmount=function(e){m&&m(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{A(e)}catch(e){t=e}})),n.__H=void 0,t&&u.__e(t,n.__v))};var I="function"==typeof requestAnimationFrame;function N(e){var t,n=function(){clearTimeout(r),I&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);I&&(t=requestAnimationFrame(n))}function A(e){var t=i,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),i=t}function L(e){var t=i;e.__c=e.__(),i=t}function D(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function R(e,t){return"function"==typeof t?t(e):t}},5026:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createToken=void 0,t.createToken=function(){var e=[],t=!1;return{cancel:function(){if(!t){t=!0;for(var n=0,r=e;n=0)throw new Error("Callback already registered");var r;return e.push(n),t&&(r=setTimeout(n,0)),function(){clearTimeout(r);var t=e.indexOf(n);t>=0&&e.splice(t,1)}},throwIfCancelled:function(e){if(t)throw new Error(e||"Token was cancelled")}}}},5048:(e,t,n)=>{"use strict";function r(e,t){const n=e+1e3*t-Date.now();return n<0?null:Math.floor(n/1e3)}n.d(t,{A:()=>r})},5133:(e,t,n)=>{"use strict";function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;const n=t.document.scrollingElement;if(!n)throw new Error("No scroll element detected");const r=()=>(n.scrollTop+t.innerHeight)/n.scrollHeight>=e;return new Promise((e=>{if(r())return e();const n=()=>{r()&&(t.removeEventListener("scroll",n),e())};t.addEventListener("scroll",n)}))}n.d(t,{m:()=>r})},5166:(e,t,n)=>{"use strict";n.d(t,{V:()=>a});var r=n(2658);var i=n(1944),o=n(7915);async function s(e){if(!i.R.loaded.find((t=>t.type===e))&&!i.R.loading.includes(e))switch(i.R.loading=[...i.R.loading,e],e){case o.QE.AI:{const t=await async function(){return n.e(493).then(n.bind(n,7946))}();i.R.loaded=[...i.R.loaded,t.getPlugin()],i.R.loading=i.R.loading.filter((t=>t!==e));break}default:throw new Error(`Unsupported plugin type: ${e}`)}}async function a(e){let t=null;if(e===o.xi.AI)t=o.QE.AI;if(t){await s(t);const e=i.R.loaded.find((e=>e.type===t));return(0,r.B)(e,"loaded plugin"),e}return null}},5235:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,U:()=>o});var r=n(5822);async function i(){var e,t;return!0!==(null!==(e=null===(t=(0,r.tU)().settings)||void 0===t?void 0:t.flags)&&void 0!==e?e:{}).bugsnag?null:n.e(872).then(n.bind(n,1253))}function o(e){i().then((t=>{t&&t.notify("error",e)})).catch(console.error)}},5272:(e,t,n)=>{"use strict"},5384:(e,t,n)=>{"use strict";n.d(t,{B:()=>o});var r=n(9687),i=n.n(r);function o(e){return i()(e)}},5429:(e,t,n)=>{"use strict";n.d(t,{z:()=>r.z});var r=n(5889)},5468:(e,t,n)=>{"use strict";n.d(t,{G:()=>W,p:()=>G});var r=n(868),i=n(5822),o=n(3976),s=n(2652),a=n(1329),l=n(8098),c=n(7915);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t{const r=p.includes(t.type);switch(t.type){case c.xi.Calendar:return((e,t)=>{var n,r,i,o;const s=e.split(" "),c=s[0],u=s[1],d=null!==(n=null===(r=t.meta)||void 0===r?void 0:r.step)&&void 0!==n?n:0,h=null!==(i=null===(o=t.meta)||void 0===o?void 0:o.is_choose_time)&&void 0!==i&&i,p=(0,a.tG)(`${c}${u?`T${u}`:""}`,d,!1,h);return(0,l.qi)(t.order_no,p),{value:{time:p}}})(e,t);case c.xi.BookingCalendar:return((e,t)=>{var n,r,i,o,s,c,u;const h=e.date.split(" "),p=h[0],f=h[1],m=null!==(n=null===(r=t.meta)||void 0===r?void 0:r.step)&&void 0!==n?n:0,g=null===(i=null===(o=t.meta)||void 0===o?void 0:o.is_choose_time)||void 0===i||i,v=null!==(s=null===(c=t.meta)||void 0===c?void 0:c.hideNames)&&void 0!==s&&s,y=(0,a.tG)(`${p}${f?`T${f}`:""}`,m,!0,g);return(0,l.qi)(t.order_no,y),{value:d({time:y},v?{}:{name:null!==(u=e.calendarOwnerName)&&void 0!==u?u:""})}})(e,t);case c.xi.Carousel:var i;return(null===(i=t.meta)||void 0===i?void 0:i.carouselType)===c.zm.Multiple?((e,t)=>{const n=e.map((e=>{var t,n,r,i,o;const s=Boolean(null===(t=e.meta)||void 0===t?void 0:t.exitAction),a=null!==(n=null===(r=e.meta)||void 0===r||null===(r=r.cardContent)||void 0===r||null===(r=r.find((e=>"text"===e.type&&e.value)))||void 0===r?void 0:r.value)&&void 0!==n?n:"";return{text:s?null!==(i=null===(o=e.meta)||void 0===o?void 0:o.exitTitle)&&void 0!==i?i:"":a}}));return(0,l.qi)(t,n.join(", ")),{value:n}})(e,t.order_no):((e,t)=>{var n,r,i,o,s;const a=e,c=Boolean(null===(n=a.meta)||void 0===n?void 0:n.exitAction)?null!==(r=null===(i=a.meta)||void 0===i?void 0:i.exitTitle)&&void 0!==r?r:"":null!==(o=null===(s=a.meta)||void 0===s||null===(s=s.cardContent)||void 0===s||null===(s=s.find((e=>"text"===e.type&&e.value)))||void 0===s?void 0:s.value)&&void 0!==o?o:"";return(0,l.qi)(t,c),{value:c}})(e,t.order_no);case c.xi.CustomForm:return Array.isArray(e)?{value:e.map((e=>{var t,r;return e.type===c.sw.Country?d(d({},e),{},{value:null!==(t=null===(r=n.find((t=>String(t.id)===String(e.id))))||void 0===r||null===(r=r.meta)||void 0===r||null===(r=r.allowedCompanyCountries)||void 0===r||null===(r=r.find((t=>String(t.id)===e.value)))||void 0===r?void 0:r.name)&&void 0!==t?t:""}):e})),freeInput:r}:{value:e,freeInput:r};case c.xi.Country:return{value:e.name};default:return{value:e,freeInput:r}}};var m=n(3503),g=n(7659),v=n(2276);function y(e){if("undefined"!=typeof window){e instanceof ArrayBuffer&&(e=new Uint8Array(e));const t=String.fromCharCode(...e);return window.btoa(t)}return Buffer.from(e).toString("base64")}function b(e){if("undefined"!=typeof window){const t=window.atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;et)throw new Error(`Binary string is too long for padding; expected not more than ${t}`);return n.set(e),n.set(r,e.length),n.set(r,e.length+1),n}async function k(e,t){const n=await _(),r=await async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:256;const t=await _();return await t.subtle.generateKey({name:"AES-GCM",length:e},!0,["encrypt","decrypt"])}(),i=n.getRandomValues(new Uint8Array(12)),o=(new TextEncoder).encode(e),s=await n.subtle.encrypt({name:"AES-GCM",iv:i},r,o),a=await n.subtle.exportKey("raw",r),l=await n.subtle.encrypt({name:"RSA-OAEP"},t.body,a),c=function(e){const t=[e.keyID,e.ts,e.ivLength,e.encryptedAESKeyLength].join(";");return C((new TextEncoder).encode(t),w)}({ts:Date.now(),keyID:t.keyID,ivLength:12,encryptedAESKeyLength:l.byteLength}),u=new Uint8Array(c.length+l.byteLength+i.byteLength+s.byteLength);return u.set(new Uint8Array(c),0),u.set(new Uint8Array(l),c.length),u.set(i,c.length+l.byteLength),u.set(new Uint8Array(s),c.length+l.byteLength+i.byteLength),y(u)}async function S(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"spki";const n=b(e);if(n.length<=x)throw new Error("Invalid key format");const r=n.slice(0,x),i=n.slice(x),o=(new TextDecoder).decode(function(e){const t=e.indexOf(0);return t>0?e.slice(0,t):e}(r)),s=await async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"jwk";const n=await _();if("jwk"===t){if("string"!=typeof e)throw new Error("JWK input must be a string");const t=JSON.parse(e);let r;switch(t.kty){case"RSA":"RSA-OAEP-256"===t.alg&&(r={name:"RSA-OAEP",hash:{name:"SHA-256"}});break;case"oct":"A256GCM"===t.alg&&(r={name:"AES-GCM",length:256})}if(!r)throw new Error(`Unknown algorithm ${t.kty} ${t.alg}`);return await n.subtle.importKey("jwk",t,r,!0,t.key_ops)}if(!(e instanceof Uint8Array))throw new Error("Binary input must be a Uint8Array");let r=[];return"spki"===t?r=["encrypt"]:"pkcs8"===t?r=["decrypt"]:"raw"===t&&(r=["encrypt","decrypt"]),await n.subtle.importKey(t,e,{name:"RSA-OAEP",hash:"SHA-256"},!0,r)}(i,t);return{keyID:o,body:s}}var O=n(9336),j=n(9844),P=n(9443),E=n(471);const T=[c.xi.AttachmentPrompt,c.xi.AttachmentPromptSingle],I=[c.xi.Carousel,c.xi.Dropdown,c.xi.MultipleChoice,c.xi.SingleChoice,c.xi.SingleChoiceURL];function N(e){return{isEnd:e.is_end,image:e.img_answer,labelName:e.label_name,labelValue:e.label_value,subText:e.sub_text,text:e.text,url:e.is_sent_to_url?e.url:null}}function A(e,t){const[n]=function(e,t){const{name:n=P.UL.FullName}=e.meta||{};if(E.xx.indexOf(e.type)>=0)return["text",null];if(e.type===c.xi.NamePrompt&&n!==P.UL.Separate)return["text",null];if(E.dJ.indexOf(e.type)>=0)return["complex",null];if(I.indexOf(e.type)>=0)return["option",t.map((e=>N(e)))];if(T.indexOf(e.type)>=0)return["upload",null];if(e.type===c.xi.RangeSelector){if(!e.meta)throw new Error("Question meta not available");const{items:t,metric:n,min:r,max:i,rangeType:o,step:s}=e.meta;return["range",{items:t,metric:n,min:r,max:i,rangeType:o,step:s}]}return[null,null]}(e,t);return n}var L=n(2658),D=n(7588),R=n(5166);function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $(e){for(var t=1;t4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:(0,i.tU)(),u=arguments.length>6?arguments[6]:void 0;if(a.mock||a.preview&&a.targetQuestion)return{render:!0};try{const i=await async function(e,t,n,r){var i,s;let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,u=arguments.length>5?arguments[5]:void 0,d=arguments.length>6?arguments[6]:void 0;const{meta:h,type:p}=e;u.hasInteracted=!0;let f=!0;const{name:m=null}=h||{},g=null===m?c.UL.FullName:m,v=A(e,t),y=await(0,R.V)(e.type);if(y&&y.handlesQuestion){var b;if((0,j.Nw)(),await(0,D.k)(!0),f=!(null===(b=y.questionRendersAnswers)||void 0===b||!b.call(y,e)),a===c.bf.Handled)return{render:f}}if(p===c.xi.Say||e.type===c.xi.AdvancedRouterResult&&e.text)(0,j.Nw)(),(0,l.qi)(e.order_no,n.text),await(0,D.k)(!0);else{if(p===c.xi.LiveChat||p===c.xi.SoftLiveChat)return(0,j.Nw)(),await(0,D.k)(!0),{render:!1};if(p===c.xi.SingleChoice||p===c.xi.SingleChoiceURL||p===c.xi.AI||p===c.xi.Carousel&&(null===(i=e.meta)||void 0===i?void 0:i.carouselType)===c.zm.Single){const t=n;if((0,l.qi)(e.order_no,t.text),!t)throw new Error("No answer provided for single-choice submission");if((0,j.Nw)(),await(0,j.$O)(t.id,u),(0,O.P)(E.Wq,{questionID:e.id,answerType:v,answer:N(t)}),t.is_live_chat){if((0,o.Rm)("answer triggers livechat"),!t.category_id)throw new Error("No LiveChat category specified");return{liveChatAnswer:t,render:f}}t.is_end&&((0,o.Rm)("answer marks end: ending discussion"),u.finished=!0)}else if(p===c.xi.MultipleChoice||p===c.xi.Carousel&&(null===(s=e.meta)||void 0===s?void 0:s.carouselType)===c.zm.Multiple){if((0,j.Nw)(),await(0,j.rY)(n.map((e=>e.id)),u),(0,l.qi)(e.order_no,n.map((e=>e.text)).join(", ")),(0,O.P)(E.Wq,{questionID:e.id,answerType:v,answer:n.map((e=>N(e)))}),p===c.xi.Carousel){const t=n.find((e=>{var t;return null===(t=e.meta)||void 0===t?void 0:t.exitAction}));u.finished=t?t.is_end:!e.next_no}}else if(p===c.xi.Calendar)(0,j.Nw)(),await(0,j.CP)(n),(0,O.P)(E.Wq,{questionID:e.id,answerType:v,answer:n});else if(p===c.xi.BookingCalendar){const r=n;(0,j.Nw)(),await(0,j.nL)(r,u);const i=$($({},r),{},{contactInfo:r.contactInfo.map((e=>{const n=t.find((t=>t.id===e.id));return{key:null==n?void 0:n.text,type:e.type,value:e.value}}))});(0,O.P)(E.Wq,{questionID:e.id,answerType:v,answer:i})}else if(p===c.xi.ContactForm||p===c.xi.LocationForm||p===c.xi.NamePrompt&&g===c.UL.Separate)(0,j.Nw)(),await(0,j.fp)(n,u),(0,O.P)(E.Wq,{questionID:e.id,answerType:v,answer:n});else if(E.xx.indexOf(p)>=0||p===c.xi.RangeSelector||p===c.xi.NamePrompt&&g!==c.UL.Separate){(0,j.Nw)();let t=n;e.is_sensitive&&r&&n&&(t=await async function(e,t){const n=await S(t);return await k(e,n)}(n,r)),await(0,j.ym)(t,u),(0,O.P)(E.Wq,{questionID:e.id,answerType:v,answer:t})}else if(p===c.xi.Dropdown){const t=n.id;(0,L.B)(t,"dropdown answer ID"),(0,j.Nw)(),await(0,j.$O)(t,u),(0,O.P)(E.Wq,{questionID:e.id,answerType:v,answer:n.text})}else if(p===c.xi.Country)(0,j.Nw)(),await(0,j.BZ)(n,u);else if(p===c.xi.AttachmentPrompt){const t=n.map((e=>e.attachmentID)).filter(Boolean);(0,j.Nw)(),await(0,j.wn)(t),(0,O.P)(E.Wq,{questionID:e.id,answerType:v,answer:n})}else{if(p!==c.xi.CustomForm&&p!==c.xi.CTAForm)return p===c.xi.CalculatorResult?(u.nextPosition||(0,o.Rm)("calculator result has no next position"),{render:!1}):((0,o.Rm)(`no answer handler for question type: ${p}`),{render:!1});{const r=n;(0,j.Nw)(),await(0,j.Jm)(r,void 0,d),(0,O.P)(E.Wq,{questionID:e.id,answerType:v,answer:r.map((e=>{const n=t.find((t=>t.id===e.id));return{key:null==n?void 0:n.text,type:e.type,value:e.value}}))})}}}[c.xi.AI,c.xi.Carousel].includes(p)||(u.finished=e.is_end||n.is_end);return{render:!0}}(e,t,n,r,s,a,u);return i}catch(e){throw new v.GU(e,"Failed submitting answer")}}var q=n(8753);function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function z(e){for(var t=1;t4&&void 0!==arguments[4]?arguments[4]:(0,i.tU)(),s=arguments.length>5?arguments[5]:void 0;const a=[c.YK.Chat,c.YK.Inpage].includes(o.botType);n({answered:!0,type:m.Ud.SetPromptAnswered}),H(a,800),n({type:m.Ud.ClosePrompt}),H(a,250),t&&await(0,q.s2)({answerEnd:e,answerNextNo:t,dispatchBotFlow:n,dispatchBotGlobals:r,globals:o,abortContoller:s})}async function G(e,t,n,r,a,l,u,d){let h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,p=arguments.length>9&&void 0!==arguments[9]?arguments[9]:(0,i.tU)(),v=arguments.length>10?arguments[10]:void 0,y=arguments.length>11&&void 0!==arguments[11]?arguments[11]:[];const b=[c.YK.Chat,c.YK.Inpage].includes(p.botType);d(!0);const{liveChatAnswer:_=null,render:w}=await F(e,t,n,r,h,p,y);if(w){var x;const r=f(n,e,t);l({answer:r.value,editable:!1,freeInput:null!==(x=r.freeInput)&&void 0!==x&&x,type:m.Ud.AnswerPrompt})}if(l({answered:!0,type:m.Ud.SetPromptAnswered}),H(b,800),p.botType===c.YK.Visual&&p.finished||(d(!1),l({type:m.Ud.ClosePrompt})),H(b,250),_){var C,k,S,O,j;const t=_.start_message||(null===(C=_.livechat)||void 0===C?void 0:C.criteria.msg_start)||e.start_message;t&&u({key:"lcStartMsg",value:t,type:g._q.SetGlobal}),(0,o.Rm)(`transitioning to soft livechat question (answer=${_.id} category=${_.category_id})`);const n=z(z({},(0,s.r)(c.xi.SoftLiveChat)),{},{category_id:_.category_id,id:e.id,is_end:e.is_end||_.is_end,is_live_chat:!0,livechat:{criteria:null!==(k=null===(S=_.livechat)||void 0===S?void 0:S.criteria)&&void 0!==k?k:null,facebook:null,livechat:null===(O=null===(j=_.livechat)||void 0===j?void 0:j.agentAvailable)||void 0===O||O,whatsapp:null},next_no:_.next_no||e.next_no,order_no:e.order_no,text:e.text});await(0,q.s2)({answerEnd:_.is_end,answerNextNo:a,dispatchBotFlow:l,dispatchBotGlobals:u,globals:p,softQuestion:n,isBotRatingSubmited:v})}else{if(p.finished)return;const e=!(!n||!0!==(null==n?void 0:n.is_end));await(0,q.s2)({answerEnd:e,answerNextNo:a,dispatchBotFlow:l,dispatchBotGlobals:u,globals:p,isBotRatingSubmited:v})}}},5500:(e,t,n)=>{"use strict";n.d(t,{S:()=>a});var r=n(9897),i=n(2658),o=n(5822),s=n(3976);function a(e){const t=(0,o.tU)();return t.destroyed?Promise.resolve():(t.destroying=!0,(0,s.Rm)("destroying bot"),Promise.resolve().then((()=>{t.cleanup.forEach((e=>{try{e()}catch(e){(0,s.Rm)(`cleanup callback failed: ${e.message}`),console.error(e)}}))})).then(e).then((()=>{var e;t.destroying=!1,t.destroyed=!0,t.lock&&t.lock.release(),t.cleanup.splice(0,1/0),(0,i.B)(t.botCode,"bot code"),null===(e=(0,r.X)())||void 0===e||e.push({type:"deregister",code:t.botCode})})).then((()=>{(0,s.Rm)("destruction complete")})))}},5591:(e,t,n)=>{"use strict";function r(e){try{return new URL(e),!0}catch{return!1}}n.d(t,{Gz:()=>r,i$:()=>i});const i=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!-]))?/gi},5721:(e,t,n)=>{"use strict";n.d(t,{o:()=>i});var r=n(4912);function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const[n,i]=(0,r.useState)(null),[o,s]=(0,r.useState)(null),[a,l]=(0,r.useState)(!1),c=(0,r.useRef)(!1);(0,r.useEffect)((()=>(c.current=!0,()=>{c.current=!1})),[]);const u=(0,r.useCallback)((async function(){if(c.current){l(!0),s(null);try{const t=await e(...arguments);if(!c.current)return;l(!1),i(t)}catch(e){if(!c.current)return;i(null),s(e),console.error(e)}}}),[e]),d=(0,r.useRef)(!1),h=(0,r.useRef)(!1),p=(0,r.useCallback)((function(){for(var e=arguments.length,t=new Array(e),n=0;n{u(...t).then((()=>{if(h.current)return h.current=!1,void r();d.current=!1}))};r()}),[u]),f=(0,r.useCallback)((()=>{i(null)}),[i]),m=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{Array.isArray(t)&&!m.current&&(m.current=!0,p(...t))}),[p,t]),[n,o,a,p,f]}},5738:(e,t,n)=>{"use strict";n.d(t,{L:()=>l});var r=n(6062);const i=Object.freeze(["_events","_eventsCount","addListener","emit","eventNames","listeners","listenerCount","off","on","once","removeAllListeners","removeListener"]);class o extends r{emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=0)throw new Error(`Failed configuring state: Property is reserved and cannot be used: ${e}`);const r={defineProperty:(e,t,n)=>!0,getOwnPropertyDescriptor(e,o){if(i.indexOf(o)>=0){const e=Reflect.getOwnPropertyDescriptor(t,o)||{value:r.get(t,o)};return Object.defineProperty(t,o,e),e}{const e=Reflect.getOwnPropertyDescriptor(n,o)||{value:r.get(n,o)};return Object.defineProperty(n,o,e),e}},deleteProperty:(e,r)=>i.indexOf(r)>=0?(delete t[r],!0):r in n&&(delete n[r],!0),get:(e,r)=>i.indexOf(r)>=0?t[r]:n[r],has:(e,r)=>i.indexOf(r)>=0?r in t:r in n,ownKeys:e=>[...new Set([...Object.getOwnPropertySymbols(n),...Object.getOwnPropertyNames(n)])],set(e,r,o){if(i.indexOf(r)>=0){if(["function"].indexOf(typeof t[r])>=0)throw new Error(`Failed updating state: Property is reserved and cannot be used: ${r}`);return t[r]=o,!0}const s=n[r];return t.emit("before",{property:r,newValue:o,currentValue:s}),n[r]=o,t.emit("update",{property:r,newValue:o,oldValue:s}),!0}};return new Proxy(t,r)}},5784:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(1419),t),i(n(854),t),i(n(3848),t),i(n(9955),t),i(n(1517),t)},5822:(e,t,n)=>{"use strict";n.d(t,{cL:()=>d,tU:()=>u,wd:()=>h});var r=n(9443),i=n(3842),o=n(7915);const s={answeredConsents:{},aiCurrentNodeID:null,aiSessionHistory:{lastPrompt:null,history:[]},aiSession:null,answerMotif:null,answers:null,cleanup:[],dvTexts:{},dynVarEnvCollected:[],fbPageID:null,finished:!1,gtmDisc:!1,hasInitd:!1,hideInitial:!1,interaction:!1,labels:{},labelTexts:[],lcAudio:null,lcCategory:null,lcChannel:null,lcCriteria:null,lcData:null,lcState:null,lead:null,leadID:null,leadVerified:!1,mustInit:!0,nextPosition:1,prefetched:null,refreshed:!1,prefetchedStarted:!1,question:null,score:0,encryptionKey:null,token:null,triggeredLead:!1,triggerPreviewPos:null,waNumber:null},a={ab:null,aiSessionHistory:{lastPrompt:null,history:[]},aiMessage:null,aiSession:null,animQueue:(0,r.y0)(),answerOptionStyles:null,api:null,apiName:null,apiRoot:null,botCode:null,botIcon:null,botID:null,botInternalName:"",botName:"",botType:null,branding:!0,category:null,companyCode:null,companyID:null,companyRatings:null,consent:!1,customAPI:null,destroyed:!1,destroying:!1,deviceID:null,deviceType:null,dialogueSpeed:o.zV.Medium,dynamicVarsEnv:[],footerContent:null,gtm:null,gtmDL:null,hasInteracted:!1,headerContent:null,i18n:{},insertAnalytics:!0,isBotVisible:!0,language:"en-GB",launchSrc:null,launchWidth:0,lcEvents:!0,liveChat:null,lock:null,maxHeight:null,maxUpload:0,mock:!1,mockStyles:null,module:null,mpTarget:null,nofocus:!1,noscroll:!1,persist:!0,preview:!1,prevState:!1,privacyURL:null,privacyText:null,protections:[],remainClosed:!1,seamless:!0,settings:null,showImmediate:!0,startMessage:null,t24:!1,tag:null,targetQuestion:null,theme:null,timeoutContainer:null,ui:{},visualFullscreen:!0,winHeight:0,xIgnore:!1,zIndex:2147483647};let l=null;const c={ab:null,apiRoot:"https://bot.leadoo.com",answerOptionStyles:null,botCode:"28d50440815a5579",botIcon:"https://res.leadoo.com/image-lib/crop/01jqyesfqpfbsj9cc93s8rf0j8",botID:2160506,botInternalName:"LIVE APRIL 2025 - Chatbot Global - CO",botName:"Digital Assistant",branding:true,category:"Default",companyCode:"01f1037e",companyID:8267,companyRatings:null,dynamicVarsEnv:[],dialogueSpeed:2,enableBotRating:false,enableLCRating:false,footerContent:null,gtm:"",gtmDL:"",headerContent:null,i18n:{"a11y":{"agent-avatar-alt":"Mensaje del agente","chat-close-icon-alt":"Icono del botón de cierre del chat","chat-end-icon-alt":"Icono del botón de finalización del chat","chat-launch-close-alt":"Icono de cerrar el chatbot","chat-launch-open-icon-alt":"Icono de abrir el chatbot","chat-launch-title":"Lanzamiento del chatbot de Leadoo","chat-reload-icon-alt":"Volver a cargar el chatbot","chat-user-icon-alt":"Icono de usuario de chat","chat-win-title":"Ventana del chatbot de Leadoo","inpage-win-title":"Ventana del bot de Leadoo en la pĆ”gina","multi-choice-check-alt":"Opción mĆŗltiple marcada","submit-icon-alt":"Enviar respuesta","cta-launch-title":"Leadoo CTA bot launcher","cta-win-title":"Leadoo CTA window","input":{"icon":{"alt":"Free text input"},"dropdown":{"label":"Select option for \"{{name}}\"","arrow-alt":"Open dropdown"}},"visual-win-title":"Leadoo Visual bot window","cta-launch":{"label":"Call-To-Action bot (currently {{state}})"},"cta-lauch":{"state":{"open":"open","closed":"closed"}},"bar-image-alt":"Bar image","attachment-uploader-icon-alt":"Upload attachments","file-upload-icon-alt":"Pending file upload","powered-by-leadoo-alt":"Powered by Leadoo","validation-err-icon-alt":"Validation error","close-icon-alt":"Close icon","answer-selected-alt":"Answer option selected","calendar":{"expand-icon-alt":"Expand","duration-icon-alt":"Meeting duration","back-button-icon-alt":"Go back","timezone-edit-icon-alt":"Edit timezone","location-icon-alt":"Meeting location","identity-icon-alt":"Calendar user identity","user-dropdown-icon-alt":"Select user","month-previous-icon-alt":"Change to previous month","month-next-icon-alt":"Change to next month","confirm-icon-alt":"Confirm date"},"star-rate-alt":"Rate {{current}} out of {{total}}","text-input-icon-alt":"Text input icon","answer-url-icon":"Answer option opens URL: {{url}}","square-edit-outline-icon-alt":"Square edit outline icon","file-image-icon-alt":"File image icon","file-icon-alt":"File","pdf-icon-alt":"PDF document","archive-icon-alt":"Archive file","image-icon-alt":"Image file","word-icon-alt":"Text document","excel-icon-alt":"Spreadsheet","audio-icon-alt":"Audio file","video-icon-alt":"Video file","livechat":{"remove-attachment-icon-alt":"Remove attachment","attachment-download-icon-alt":"Download attachment","submit-icon-alt":"Send message","add-attachment-icon-alt":"Add attachment","end-livechat":"End livechat"},"chat-select":{"livechat-alt":"LiveChat discussion","facebook-alt":"Facebook Messenger chat","whatsapp-alt":"WhatsApp chat"},"dropdown-icon-alt":"Dropdown for {{name}}","cta-form-sent-alt":"Information submitted successfully","bot":{"error-icon":"Error icon"},"chat-trigger":{"title":"Start chat via Leadoo","image":{"title":"Leadoo bot image trigger","alt":"Trigger image"},"modal":{"title":"Leadoo bot modal trigger"},"choices":{"title":"Leadoo bot choices trigger"}},"attachment":{"delete-icon-alt":"Delete attachment","image-icon-alt":"Image","file-icon-alt":"File","upload-icon-alt":"Upload","skip":"Skip","loaded":"File loaded","image-preview":{"image-alt":"Image preview","download":"Download","close-preview":"Close image"}},"booking":{"time-icon-alt":"Booking time","booking-for-icon-alt":"Booking for"},"link":{"new-tab":"opens in a new tab","current-tab":"opens in current tab"},"inpage":{"frame":{"title":"{{botName}} - Leadoo bot"}},"sent-by":"Sent by: {{name}}","own":{"sent-by":"Sent by: You"},"cta-trigger":{"title":"Leadoo CTA bot trigger button"},"close-image-preview":"Close image","image-preview-alt":"Attachment Image Preview","chat-close-options":"Close chat suggestions","chat-trigger-close":{"title":"Close chat"},"reload-btn":"Reload bot","close-btn":"Close bot"},"chat":{"agent":"Servicio de atención al cliente","end-chat":"Fin de la conversación","is-typing":"{{nombre}} estĆ” escribiendo...","several-typing":"Varias personas estĆ”n escribiendo...","win-close":"Cerrar","win-restart":"Reiniciar","question":{"calendar-cont":{"first":"Pick time","second":"Continue","third":"Confirm"},"loading":"Question is loading"},"iframe":{"title":"Chatbot interaction","aria-label":"Interactive chatbot"},"bot-avatar-alt":"Bot says","bot-header":{"avatar-alt":"Bot header avatar"},"multiple-choice":{"hint":"Please choose up to {{maxAnswers}} options","hint-required":"Please choose {{minAnswers}} to {{maxAnswers}} options"},"header":{"status":{"unavailable":"Currently unavailable","available":"Now available","typing":"typing"}},"bot-rating":{"feedback-placeholder":"Tell us about your experience...","feedback-send-button":"Send","feedback-rate-header":"Rate discussion","feedback-rate-subheader":"How was your discussion?","feedback-return-text":"Return to rating","feedback-success-header":"Feedback sent!","feedback-success-subheader":"Thank you for your feedback!","rated":"Rated","rate":"Rate","feedback-return-back":"Back","feedback-rate-sub":{"ai":"How helpful was the AI?","bot":"How was your discussion?"}},"rating":{"submit-error":"Something went wrong"}},"invalid":{"in-email":"El correo electrónico no es vĆ”lido","in-phone":"El nĆŗmero de telĆ©fono no es vĆ”lido","max-chars":"MĆ”ximo de {{max}} caracteres permitidos","is-empty":"No puede quedar vacĆ­o","is-number":"El valor debe ser numĆ©rico","is-max-number-length":"Se ha superado la longitud mĆ”xima","is-above-zero":"El valor no puede ser negativo","free-email":"Por favor, utiliza una dirección de correo electrónico de empresa","calendar":{"booking":{"slot-occupied":"Tu selección estĆ” ocupada, elige otra por favor","unknown-error":"Algo ha ido mal. Por favor, intĆ©ntalo de nuevo mĆ”s tarde o ponte en contacto con el administrador."}},"field-empty":"{{field}} no puede quedar vacĆ­o","dropdown":{"format":"Dropdown value is invalid","props":"Dropdown value malformed"},"attachments":{"max-files":"You can upload a maximum of {{max}} files.","type":"File format error","size":"The maximum file size is {{size}}."},"min-answers":"Please select at least {{min}} options","max-answers":"Please select at most {{max}} options","field-not-number":"{{field}} must be a number","field-negative":"{{field}} cannot be negative","field-max-number":"{{field}} must be a valid number"},"lc":{"complete":"El chat ha terminado","lc-btn":"LiveChat","msg-plc":"Escribe el mensaje...","open-wa":"Abrir WhatsApp","switch-to":"Cambiar a:","welcome":"Ā”Bienvenido a este chat!","event":{"client-ref":"TĆŗ","event-client-leave":"{{nombre}} abandonó el chat","event-client-rejoin":"{{nombre}} se ha vuelto a unir al chat","event-vis-platform-switch":"{{nombre}} movió el chat a {{plataforma}}","event-ended-agent":"El agente terminó el chat","event-ended-inactive":"El chat se cerró por inactividad","event-assign-transfer":"El chat fue transferido al agente: {{nombre}}","event-chat-started":"{{nombre}} empezó el chat desde {{fuente}}","event-assign-new":"{{nombre}} se unió al chat","event-ended-timeout":"Chat has timed out. User returned to chatbot."},"empty-message":"Empty message","start":{"prompt":{"message":"The livechat hasn't started yet. Please send a message first!"}}},"up":{"all-files-uploaded":"Todos los archivos subidos","complete":"Carga completada","drag-files":"(arrastra los archivos o haz clic para examinarlos)","drop-files":"Pon los archivos aquĆ­","try-again":"(haz clic aquĆ­ para volver a intentarlo)","upload-files":"Subir archivos","drop-or-browse":"Drop files to upload or browse"},"privacy":{"interact":"Haciendo clic o escribiendo aceptas nuestra ","terms":"Condiciones de uso"},"input":{"hover":{"phone-input":"Formato del nĆŗmero de telĆ©fono: +15417543010"},"label":{"city":"Ciudad","companyName":"Empresa","country":"PaĆ­s","email":"Dirección de correo electrónico","location":"Dirección","name":"Nombre","other":"Mensaje","phone":"NĆŗmero de telĆ©fono","zip":"Código postal","ai":"ĀæEn quĆ© puedo ayudarte?","firstName":"First Name","lastName":"Last Name","search":{"country":"Search country","option":"Search option"},"country-dd":{"search":{"option":"Search"}}},"placeholder":{"city":"Ciudad","companyName":"Empresa","country":"PaĆ­s","email":"Correo electrónico","location":"Dirección","name":"Nombre","other":"Escribe tu mensaje aquĆ­","phone":"TelĆ©fono","zip":"Código postal","ai":"ĀæEn quĆ© puedo ayudarte?","message":"Mensaje","postcode":"Código Postal","firstName":"First Name","lastName":"Last Name","livechat":"Send message...","dropdown":"Choose from below","dropdown-country":"Choose country from below"},"icon-alt":{"other":"Mensaje","city":"City","companyName":"Company","country":"Country","email":"Email","firstName":"First name","lastName":"Last name","location":"Location","name":"Name","phone":"Phone","zip":"Post code","dropdown":"Dropdown","time":"Time"},"message":{"placeholder":"Escriba aquĆ­ su mensaje..."},"other":{"placeholder":"Escriba aquĆ­ su mensaje..."},"dropdown":{"placeholder":"Selecciona"},"required":"required","email":{"placeholder":"e.g., john.doe@example.com"},"company":{"placeholder":"e.g., XYZ Corporation"},"phone":{"placeholder":"e.g., 07523123123"},"firstName":{"placeholder":"e.g., John"},"lastName":{"placeholder":"e.g., Doe"},"name":{"placeholder":"e.g., John Doe"},"country":{"placeholder":"e.g., United Kingdom"},"city":{"placeholder":"e.g., London"},"location":{"placeholder":"e.g., Main street"},"postcode":{"placeholder":"e.g., SW1A 1AA"},"companyName":{"placeholder":"e.g., XYZ Corporation"},"zip":{"placeholder":"e.g., SW1A 1AA"},"dropdown-country":{"placeholder":"Select country"}},"dropdown":{"select":"Selecciona"},"phone-input":{"is-possible":"El formato del nĆŗmero es correcto, pero el nĆŗmero no es vĆ”lido","invalid-country-code":"Prefijo telefónico del paĆ­s no vĆ”lido","too-short":"NĆŗmero de telĆ©fono demasiado corto","too-long":"NĆŗmero de telĆ©fono demasiado largo","not-a-number":"NĆŗmero de telĆ©fono no vĆ”lido"},"visual":{"question":{"attachment-cont":"Subir","cal-cont":"Confirmar","dropdown-cont":"Continuar","dropdown-cta":"--- Elija la respuesta ---","multi-choice-cont":"Confirmar","multi-txt-cont":"Continuar","range-cont":"Continuar","say-cont":"Continuar","text-cont":"Continuar","upload":{"drop-msg":"Deposita los archivos para adjuntarlos...","files-heading":"Se cargarĆ”n los siguientes archivos:","prompt-browse-link":"Consultar","prompt-drag-files":"Arrastra los archivos aquĆ­ o","upload-heading":"Cargando:"},"custom-form-cont":"Continuar","calc-result":"Continuar","calendar-cont":{"first":"Continue","second":"Confirm"},"loading":"Loading..."}},"error":{"communication":"Ha ocurrido un error, por favor, intĆ©ntalo de nuevo","visual":{"attachment-upload":"Attachment(s) failed to upload","drop-event":"Invalid/broken drop event"},"api":{"livechat-missing-cat-answer":"LiveChat configuration on an answer is missing a category","livechat-missing-cat-question":"LiveChat configuration on a question is missing a category","lookup-query-configuration":"Lookup query is misconfigured","validation-error":"Request / response payload validation failed","node-meta-parse-failure":"Node has invalid configuration - unable to parse","attachment":{"download-invalid-jwt":"Attachment token is invalid or corrupt"},"calendar":{"slots":"Failed fetching calendar slots from booking service","slot":{"occupied":"Calendar slot already occupied"}},"lead":{"updated":"Failed processing updated lead data"},"request-payload-invalid":"Invalid request content: bot sent invalid data: {{invalid}}","email":{"invalid":"Email is invalid"},"dv":{"number":{"required":"Message must be a number"},"invalid-value-internal":"Invalid value for variable"},"ai":{"service-unavailable":"AI service is currently unavailable","service-busy":"AI service is currently busy","service-incorrect-prompt":"AI service was not able to handle the prompt. Please try again.","service-timeout":"The AI service took too long to respond","violate-policy-content":"This message sent was detected to violate our usage policy. Please restart the bot and try another topic."},"livechat-criteria-unmet":"LiveChat cannot start: More information is required by set criteria","lookup-upload-missing-fields":"Lookup data invalid: Required upload fields are missing: {{invalid}}","lookup-not-found":"No lookup found for requested ID","answer-required":"An answer is required but no value was provided: {{invalid}}","min-answers-unsatisfied":"Question requires at least {{min}} answers","max-answers-unsatisfied":"Question expects at most {{max}} answers","bot-type-invalid":"Requested bot type is incorrect or not valid for the requested resource","bot-question-mismatch":"Tried to submit data for the wrong question/node","math":{"bad-input":"Could not run calculation: Received bad input value: {{invalid}}","bad-result":"Could not complete calculation: Received bad result for input: {{invalid}}"},"phone":{"invalid":"Phone number is invalid"},"domain":{"invalid":"Domain access denied"}},"attachments":{"required":"Please add a file before submitting"},"bot":{"title":"Something went wrong. Click here to copy the error message.","copy":{"title":"Copy"},"copied":{"title":"Copied"}},"structure":{"invalid-answers":"Item answer format is invalid"},"attachment":{"file-size":{"max":"File size too large. Files cannot be larger than {{size}} MB.","min":"File size too small. Files cannot be smaller than {{size}} kB."},"file-type":"Sorry, this file type is not supported."}},"calendar":{"booking":{"no-available-time-slots":"No hay mĆ”s franjas horarias disponibles para este dĆ­a","select-a-day":"Selecciona una fecha para mostrar las franjas horarias","fill-in-email":"Introduce tu correo electrónico para confirmar","schedule-time":"Programar","schedule-duration":"{{duración}} min","your-timezone":"Time zone","location-not-specified":"Not specified","description":{"show-more":"Show more","show-less":"Show less"},"title":{"booking-detail":"Confirm selection","confirm-email":"Confirm with your email address","contact-info":"Provide Your Contact Information"},"button":{"go-back":"Back","confirm":"Select","return-to-calendar":"Return to calendar"},"full-days-list":"Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday","full-months-list":"January|February|March|April|May|June|July|August|September|October|November|December","select-date-please":"Please, select a date on the previous screen","meet-with":"Meet with","meet-with-anyone":"Anyone","booking-for-caption":"Booking time for:","calendar-title":"Select the time","select-time":{"title":"Available time"},"options-info":"Select a date to see available times","meeting-location":{"icon":"Meeting location"},"options":{"multiple":"Multiple options"},"conferencing":"Conferencing"},"month":{"previous":"Previous month","next":"Next month"},"calendar":{"available":{"time":"Select time"}}},"inpage":{"question":{"cal-cont":"Confirmar"}},"personal-bot":{"page-host":{"watermark":{"title":"Construye el tuyo","link":"Asistente de ventas"}}},"cta":{"submission":{"sent":"Ā”Enviado!","sent-msg":"Gracias por ponerse en contacto con nosotros. Pronto nos pondremos en contacto con usted.","sending":"Sending...","sending-msg":"Thank you for getting in touch! We will get back to you soon!"},"send":"Send","launch":{"title":"Get In Touch"},"win-close":"Close"},"num":{"sep":{"thousands":","}},"livechat":{"timeout":{"description":"Will return to the Chatbot in:","button-wait":"Keep waiting","timing-out":"Our agents are busy at the moment, we are sorry about this inconvenience.","cancelled":"One of our agents will be with you shortly...","button":"Keep waiting"},"attachments":{"title":"Attachments"}},"answer":{"submit":{"label":"Submit","carousel":{"label":"Submit"}}},"ai":{"response":{"disclaimer":"AI answer","tooltip":"This is an AI-generated response and can sometimes provide inaccurate or incorrect information. Always double-check any critical facts from a reliable source.","sources":{"title":"Sources","more":"Show sources","less":"Hide sources","doc":{"icon":"Document"},"web":{"icon":"Webpage"}}},"node":{"unavailable":"Encountered a problem. It could be that the AI service is down or there was unsolvable error. Please try again later."}},"download":"Download","bot-rating":{"feedback-label":"Would you like to share more details with us?"},"common":{"validation":{"extension":"The file must be one of type: {{extensions}}","content-type":"The content type of the file should be one of {{content_types}}","forbidden-content-type":"Invalid file content type","forbidden-extension":"Invalid file extension","max-height":"Invalid file height. Max height allowed is {{height}}px.","max-width":"Invalid file width. Max width allowed is {{width}}px.","min-size":"Invalid file size. Min size allowed is {{size}}.","max-size":"Invalid file size. Max size allowed is {{size}}."}},"test":{"key":"My Test Key"},"a11y-field-required":"This field is required"},insertAnalytics:true,isBotVisible:true,language:"es-CO",maxUpload:10485760,mock:false,module:"chat",mpTarget:null,preview:false,privacyURL:null,privacyText:null,remainClosed:false,settings:[{"bot_id":2160506,"bot_icon_visible":true,"device_type":1,"exit_intent_time":15,"flags":null,"launch_auto_open":0,"launch_cta_scroll":1,"launch_cta_open":1,"launch_cta_reset":3600,"launch_cta_time":0,"launch_description":"Estamos aquĆ­ para ayudarte. Ā”Haz clic para empezar!","launch_icon_size":1,"launch_size":100,"launch_image":null,"launch_pos_hor":"r","launch_pos_vert":100,"launch_style":2,"launch_title_alt":null,"launch_title":"ĀæTienes preguntas? šŸ‘‹","launch_trigger_reset":3600,"launch_trigger_scroll":1,"launch_trigger_time":0,"launcher_visible":true,"trigger_button_bg":null,"trigger_button_round":false,"trigger_button_size":1,"trigger_button_text_color":null,"trigger_button_text":"Start","trigger_image":null,"trigger_image_type":1,"trigger_type":0},{"bot_id":2160506,"bot_icon_visible":true,"device_type":2,"exit_intent_time":15,"flags":null,"launch_auto_open":0,"launch_cta_scroll":1,"launch_cta_open":1,"launch_cta_reset":3600,"launch_cta_time":0,"launch_description":"Estamos aquĆ­ para ayudarte. Ā”Haz clic para empezar!","launch_icon_size":1,"launch_size":100,"launch_image":null,"launch_pos_hor":"r","launch_pos_vert":100,"launch_style":2,"launch_title_alt":null,"launch_title":"ĀæTienes preguntas? šŸ‘‹","launch_trigger_reset":3600,"launch_trigger_scroll":1,"launch_trigger_time":0,"launcher_visible":true,"trigger_button_bg":null,"trigger_button_round":false,"trigger_button_size":1,"trigger_button_text_color":null,"trigger_button_text":"Start","trigger_image":null,"trigger_image_type":1,"trigger_type":0}],t24:true,targetQuestion:null,theme:{},visualFullscreen:true};function u(){return l||(l=(0,i.t)(a)),l}function d(){for(const e in s){const t=s[e];Array.isArray(t)?a[e]=[...s[e]]:a[e]=t&&"object"==typeof t?JSON.parse(JSON.stringify(s[e])):t}}function h(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u();!function(e){const t=/^\[LD:/;for(const n in e)if(t.test(e[n]))throw new Error(`Placeholder configuration not initialised: Property not set: ${n}`)}(e);for(const n in e)t[n]=null!==e[n]&&void 0!==e[n]||void 0===a[n]?e[n]:a[n]}d()},5826:(e,t,n)=>{"use strict";n.d(t,{A:()=>s,_:()=>o});var r=n(3162),i=n(2658);const o=(0,r.createContext)({});function s(e){const{children:t,document:n,iframe:s}=e;return(0,i.B)(n,"Bot frame document"),(0,r.h)(o.Provider,{value:{document:n,iframe:s}},t)}},5834:(e,t,n)=>{"use strict";n.d(t,{hM:()=>a});var r={455:e=>{e.exports=e=>{if("number"!=typeof e)throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(1e3*e)%1e3,nanoseconds:t(1e6*e)%1e3}}},258:(e,t,n)=>{const r=n(455);e.exports=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Number.isFinite(e))throw new TypeError("Expected a finite number");t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);const n=[],i=(e,r,i,o)=>{if(!(0!==n.length&&t.colonNotation||0!==e||t.colonNotation&&"m"===i))return;let s,a;if(o=(o||e||"0").toString(),t.colonNotation){s=n.length>0?":":"",a="";const e=o.includes(".")?o.split(".")[0].length:o.length,t=n.length>0?2:1;o="0".repeat(Math.max(0,t-e))+o}else s="",a=t.verbose?" "+(l=r,1===e?l:`${l}s`):i;var l;n.push(s+o+a)},o=r(e);if(i(Math.trunc(o.days/365),"year","y"),i(o.days%365,"day","d"),i(o.hours,"hour","h"),i(o.minutes,"minute","m"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3)if(i(o.seconds,"second","s"),t.formatSubMilliseconds)i(o.milliseconds,"millisecond","ms"),i(o.microseconds,"microsecond","µs"),i(o.nanoseconds,"nanosecond","ns");else{const e=o.milliseconds+o.microseconds/1e3+o.nanoseconds/1e6,n="number"==typeof t.millisecondsDecimalDigits?t.millisecondsDecimalDigits:0,r=e>=1?Math.round(e):Math.ceil(e),s=n?e.toFixed(n):r;i(Number.parseFloat(s,10),"millisecond","ms",s)}else{const n=((e,t)=>{const n=Math.floor(e*10**t+1e-7);return(Math.round(n)/10**t).toFixed(t)})(e/1e3%60,"number"==typeof t.secondsDecimalDigits?t.secondsDecimalDigits:1),r=t.keepDecimalsOnWholeSeconds?n:n.replace(/\.0+$/,"");i(Number.parseFloat(r,10),"second","s",r)}if(0===n.length)return"0"+(t.verbose?" milliseconds":"ms");if(t.compact)return n[0];if("number"==typeof t.unitCount){const e=t.colonNotation?"":" ";return n.slice(0,Math.max(t.unitCount,1)).join(e)}return t.colonNotation?n.join(""):n.join(" ")}},196:e=>{var t=/(\*|\?)/g;function n(e,t){this.text=e=e||"",this.hasWild=e.indexOf("*")>=0,this.separator=t,this.parts=e.split(t).map(this.classifyPart.bind(this))}n.prototype.match=function(e){var t,n,r=!0,i=this.parts,o=i.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(n=(e||"").split(this.separator),t=0;r&&t=0||e.indexOf("?")>=0?new RegExp(e.replace(t,".$1")):e},e.exports=function(e,t,r){var i=new n(e,r||/[\/\.]/);return void 0!==t?i.match(t):i}},246:()=>{}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var s={};(()=>{o.d(s,{xN:()=>w,Iq:()=>m,cM:()=>x,bp:()=>g,Y9:()=>S});var e=o(196),t=o.n(e),n=o(258),r=o.n(n);const i=["#a0937d","#a7c5eb","#bdd2b6","#cc7351","#d35d6e","#e08f62","#fbc6a4","#f4a9a8","#ce97b0","#5aa469","#70af85","#8b5e83","#8f4068","#9dad7f","#94d0cc","#949cdf"];let a=null;function l(){a||(a=[...i],function(e){for(let t=e.length-1;t>0;t-=1){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}}(a));const e=a.shift();return a.push(e),e}var c=o(246),u=o.n(c);function d(){if("undefined"!=typeof window)return window;if(void 0!==o.g)return o.g;if("undefined"!=typeof self)return self;throw new Error("Unable to determine global context")}function h(e,t){return e.map((e=>Array.isArray(e)?`[${h(e,", ")}]`:e&&"object"==typeof e&&"function"==typeof e.toString||"function"==typeof e?e.toString():`${e}`)).join(t)}function p(){console.log(...arguments)}let f=p;function m(){return f}function g(e){f=e||p}let v=null,y={};const b={},_={};function w(e){if(!k(e))return function(){};const t=b[e]=b[e]||l();return function(){for(var n=arguments.length,r=new Array(n),i=0;i1?t-1:0),r=1;ri.add(e))),"string"==typeof(null===(n=null===(t=r.process)||void 0===t?void 0:t.env)||void 0===n?void 0:n.DEBUG)&&r.process.env.DEBUG.split(",").forEach((e=>i.add(e))),[...i]}().reduce(((e,t)=>{let n=t.trim(),r=!0;return/^-/.test(n)&&(n=n.substring(1),r=!1),!1!==e[n]&&(e[n]=r),e}),{})),void 0===y[e])for(const n in v)if(t()(n,e)&&(y[e]=!!v[n],!y[e]))break;return y[e]}function S(e,t){y[e]=t}})();var a=s.xN},5850:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l,g:()=>c});var r=n(2276),i=n(1981);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timeLimit=void 0;const r=n(9027),i=n(1517);t.timeLimit=function(e,t){let n;return Promise.race([e,new Promise(((e,o)=>{n=setTimeout((()=>{o(new r.Layerr({info:{code:i.ErrorCode.TaskTimeout}},`Timed-out waiting for task: ${t} ms`))}),t)}))]).then((e=>(clearTimeout(n),e)))}},5889:(e,t,n)=>{"use strict";n.d(t,{z:()=>i});var r=n(4256);function i(e,t){const[n,i]=(0,r.useState)(e[t]),o=(0,r.useCallback)((n=>{e[t]=n}),[e]);return(0,r.useEffect)((()=>{const n=e=>{let{property:n,newValue:r}=e;n===t&&i(r)};return i(e[t]),e.on("update",n),()=>{e.off("update",n)}}),[e]),[n,o]}},5949:(e,t,n)=>{"use strict";function r(e){return Object.keys(e).map((t=>e[t]))}function i(e,t){return e.then((e=>t(e,null)),(e=>t(null,e)))}n.d(t,{H7:()=>i,KQ:()=>r})},5994:(e,t,n)=>{"use strict";async function r(){return n.e(931).then(n.bind(n,2777))}n.d(t,{L:()=>r})},6055:(e,t,n)=>{"use strict";n.d(t,{M:()=>i});var r=n(4912);function i(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const[n,i]=(0,r.useState)(null);return(0,r.useEffect)((()=>{if(!t)return;let n=!0;return e().then((e=>{n&&i((()=>e))})),()=>{n=!1}}),[t,e]),n}},6062:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i{"use strict";n.d(t,{HN:()=>s,YW:()=>a});var r=n(992),i=n(2658);n(50),n(5822);let o=null;function s(){return(0,i.B)(o,"RestoreSession not initialised"),o}async function a(){o||(o=await(0,r.j)(),o.precacheMethods(["document.createElement"]))}},6274:(e,t,n)=>{"use strict";n.d(t,{f:()=>s,y:()=>o});let r=null;function i(){return n.e(614).then(n.bind(n,5594))}async function o(){r=r||i();return(await r).PhoneTextfield}async function s(){r=r||i();return(await r).COUNTRIES}},6281:(e,t,n)=>{"use strict";n.d(t,{FC:()=>a,RJ:()=>l,j3:()=>i});var r=n(9443);r.xi.DropdownSelectAPI,r.xi.MultipleChoiceAPI,r.xi.SingleChoiceAPI,r.xi.CarouselAPI;const i=512;r.xi.LookupDropdown,r.xi.LookupMultipleChoice,r.xi.LookupSingleChoice,r.xi.LookupCarousel;var o,s;!function(e){e.Other="Other",e.Query="Query",e.NoResult="NoResult"}(o||(o={})),function(e){e[e.bot=1]="bot",e[e.ai=2]="ai",e[e.livechat=3]="livechat"}(s||(s={}));const a=10,l=["image/webp","image/png","image/avif","image/gif","image/jpeg"]},6430:(e,t)=>{var n; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e="",t=0;t{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i{var r=n(731);r&&r.__esModule&&(r=r.default),e.exports="string"==typeof r?r:r.toString()},6816:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i{"use strict";n.d(t,{GZ:()=>l,ai:()=>s,fl:()=>a});var r=n(1981),i=n(3464),o=n(7915);function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{subTextPlaceholder:n=!1}=t;return e.reduce(((e,t)=>{if(!t.meta)throw new Error(`Custom form answer invalid: Meta not specified: ${t.id}`);const r={id:`${t.id}`,type:t.meta.type||o.sw.Message,width:t.meta.width||"full",required:!0===t.meta.required,multiline:!0===t.meta.multiline,text:"",placeholder:null,autoComplete:(0,i.Uu)(t.meta.type)};return Array.isArray(t.meta.options)&&(r.options=t.meta.options),"string"==typeof t.meta.placeholder&&t.meta.placeholder.length>0?r.placeholder=t.meta.placeholder:n&&t.sub_text&&(r.placeholder=t.sub_text),"string"==typeof t.text&&t.text.length>0&&(r.text=t.text),t.meta.allowedCompanyCountries&&(r.allowedCompanyCountries=t.meta.allowedCompanyCountries),t.meta.preferredCompanyCountries&&(r.preferredCompanyCountries=t.meta.preferredCompanyCountries),[...e,r]}),[])}function a(e){switch(e){case o.sw.Name:return(0,r.t)("input.name.placeholder");case o.sw.FirstName:return(0,r.t)("input.firstName.placeholder");case o.sw.LastName:return(0,r.t)("input.lastName.placeholder");case o.sw.Email:return(0,r.t)("input.email.placeholder");case o.sw.CompanyName:return(0,r.t)("input.company.placeholder");case o.sw.Phone:return(0,r.t)("input.phone.placeholder");case o.sw.Country:return(0,r.t)("input.country.placeholder");case o.sw.City:return(0,r.t)("input.city.placeholder");case o.sw.Location:return(0,r.t)("input.location.placeholder");case o.sw.Postcode:return(0,r.t)("input.postcode.placeholder");case o.sw.Message:return(0,r.t)("input.message.placeholder");case o.sw.Dropdown:return(0,r.t)("input.dropdown.placeholder");default:return""}}function l(e){switch(e){case o.sw.Name:return(0,r.t)("input.placeholder.name");case o.sw.FirstName:return(0,r.t)("input.placeholder.firstName");case o.sw.LastName:return(0,r.t)("input.placeholder.lastName");case o.sw.Email:return(0,r.t)("input.placeholder.email");case o.sw.CompanyName:return(0,r.t)("input.placeholder.companyName");case o.sw.Phone:return(0,r.t)("input.placeholder.phone");case o.sw.Country:return(0,r.t)("input.placeholder.country");case o.sw.City:return(0,r.t)("input.placeholder.city");case o.sw.Location:return(0,r.t)("input.placeholder.location");case o.sw.Postcode:return(0,r.t)("input.placeholder.postcode");case o.sw.Message:return(0,r.t)("input.placeholder.message");case o.sw.Dropdown:return(0,r.t)("input.placeholder.dropdown");default:return""}}},7095:e=>{"use strict";e.exports=function(e){return e[1]}},7201:(e,t,n)=>{"use strict";n.d(t,{p:()=>i});var r=n(7915);const i={[r.eU.BOT]:1,[r.eU.BOT_NODE]:1,[r.eU.AI]:2,[r.eU.LIVECHAT]:3}},7232:(e,t,n)=>{"use strict";n.d(t,{j:()=>a});var r=n(2240),i=n(4023),o=n(3798);class s{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;this.__cache=new Map,this._safeWindow=null,this._currentWindow=e}getNativeMethod(e){if((0,r.b)(this._safeWindow,"RestoreSession not initialised"),this.__cache.has(e))return this.__cache.get(e);const t=(0,i.rH)(e,this.getEntryPoints(),this._safeWindow);return this.__cache.set(e,t),t}getNativePrototypeMethod(e,t,n){return(0,r.b)(this._safeWindow,"RestoreSession not initialised"),(0,i.vG)(e,t,n,this.getEntryPoints().safe)}async init(){this._safeWindow||(this._safeWindow=await(0,o.e)(this._currentWindow))}precacheMethods(e){(0,r.b)(this._safeWindow,"RestoreSession not initialised");for(const t of e){if(this.__cache.has(t))continue;const e=(0,i.rH)(t,this.getEntryPoints(),this._safeWindow);this.__cache.set(t,e)}}getEntryPoints(){var e;return(0,r.b)(this._safeWindow,"RestoreSession not initialised"),{top:{window:this._currentWindow,document:this._currentWindow.document},safe:{window:this._safeWindow,document:null===(e=this._safeWindow)||void 0===e?void 0:e.document}}}}async function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;const t=new s(e);return await t.init(),t}},7266:(e,t,n)=>{"use strict";function r(e){return e instanceof Promise||!(!e||"object"!=typeof e||"function"!=typeof e.then)}function i(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return Promise.race([e,new Promise(((e,o)=>{n=setTimeout((()=>{if(r)return e();let t="Timed-out waiting for async task";i&&(t=`${t}: ${i}`),o(new Error(t))}),t)}))]).then((e=>(clearTimeout(n),e)))}n.d(t,{A:()=>i,y:()=>r})},7547:(e,t,n)=>{"use strict";n.d(t,{k:()=>o});var r=n(2276),i=n(1981);function o(e){const{friendly:t=null}=r.GU.info(e);return(t?(0,i.t)(t):e.message)||(0,i.t)("error.communication")}},7588:(e,t,n)=>{"use strict";n.d(t,{M:()=>c,k:()=>l});var r=n(5822),i=n(1935);const o="ld_bot_consent",s=1,a=0;function l(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,r.tU)(),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,i.l)();return t.consent=e,n?n.set(o,!0===e?s:a):Promise.resolve()}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.tU)();return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,i.l)();return e?e.get(o,a).then((e=>e===s)):Promise.resolve(!1)}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,i.l)()).then((t=>{e.consent=t}))}},7659:(e,t,n)=>{"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;ta,_q:()=>s,gW:()=>l}),function(e){e.ResetAll="reset",e.SetGlobal="set"}(s||(s={}))},7846:(e,t,n)=>{"use strict";n.d(t,{AV:()=>f,Bg:()=>p,Bw:()=>m,WN:()=>d,kj:()=>h,ls:()=>v,sn:()=>g,tN:()=>u});var r=n(8949),i=n(471),o=n(5822),s=n(2966),a=n(3976),l=n(564),c=n(7915);function u(e,t){try{const n=Array.isArray(e.dv)?e.dv:[];return n.length>0?n[0].answer_id?t.filter((e=>!!n.find((t=>t.answer_id===e)))):n.reduce(((e,t)=>t.answer_id?e:[...e,t.id]),[]):[]}catch(e){return console.error(e),[]}}function d(e,t){return t.some((e=>"number"!=typeof e))?[]:e.reduce(((e,n)=>{if(n.id&&-1===t.indexOf(n.id))return e;if(Array.isArray(n.value)){const t=n.value.reduce(((e,t)=>t.label?[...e,t.label]:e),[]);return[...e,...t]}const r=n.label_name||null;return r?[...e,r]:e}),[])}function h(e,t,n){const{type:r}=e;if(i.OJ.includes(r)){return r===c.xi.BookingCalendar?n.contactInfo:n}return r===c.xi.LocationForm||r===c.xi.ContactForm?n:r===c.xi.Dropdown||r===c.xi.MultipleChoice||r===c.xi.SingleChoice||r===c.xi.SingleChoiceURL?t:null}function p(e,t,n,r){const{type:i}=e;return i===c.xi.BookingCalendar?r.date:i===c.xi.CTAForm||i===c.xi.CustomForm||i===c.xi.LocationForm||i===c.xi.ContactForm?"":i===c.xi.Dropdown||i===c.xi.MultipleChoice||i===c.xi.SingleChoice||i===c.xi.SingleChoiceURL?n.reduce(((e,n)=>{var r,i;return`${e}${e.length>0?",":""}${null!==(r=null===(i=t.find((e=>`${e.id}`==`${n}`)))||void 0===i?void 0:i.text)&&void 0!==r?r:""}`}),""):"string"==typeof r?r:""}function f(e){return{category_id:null,dynamic_type:null,gtm_event_name:null,id:0,img_answer:null,is_end:!1,is_live_chat:!1,is_lookup_query:!1,is_sent_to_url:!1,label_id:null,meta:{},next_no:null,order:1,priority:0,question_id:e,score:0,score2:null,start_message:null,sub_text:null,target_link:null,text:"",url:null}}function m(e,t,n){let r=n;if(t.some((e=>{var t;return!(null===(t=e.lookup)||void 0===t||!t.lookupID)}))){const t=new Set;for(const n of e){var i;null!==(i=n.lookup)&&void 0!==i&&i.itemID&&"number"==typeof n.next_no&&t.add(n.next_no)}1===t.size&&(r=t.values().next().value)}return r}function g(e,t){return t.reduce(((t,n)=>{var r,i;const o=e.find((e=>{var t;return(null===(t=e.lookup)||void 0===t?void 0:t.itemID)===n}));return o&&null!==(r=o.lookup)&&void 0!==r&&r.itemID&&null!==(i=o.lookup)&&void 0!==i&&i.lookupID?[...t,{itemID:o.lookup.itemID,lookupID:o.lookup.lookupID}]:t}),[])}function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();return(0,l.A)(t).includes(e.type)?((0,a.Rm)(`triggering early lead on question: ${e.id}`),t.triggeredLead=!0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();return(0,r.Jx)({answer:null,dynamicVars:[],isDynamicVarsForAnswers:!1,lookupAnswers:null}).then((n=>{let{leadID:r,leadConverted:i}=n;(0,s.x)(e.type,"",r,i,t)}))}(e,t)):Promise.resolve()}},7852:(e,t,n)=>{"use strict";n.d(t,{Bv:()=>c,Jx:()=>i,QA:()=>u,nM:()=>r});var r,i,o=n(5048);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t{"use strict";n.d(t,{Ak:()=>p.Ak,Ap:()=>p.Ap,De:()=>p.De,Et:()=>p.Et,M0:()=>p.M0,QE:()=>u,TL:()=>p.TL,UL:()=>p.UL,YK:()=>p.YK,Zj:()=>d,_X:()=>p._X,aY:()=>s,bf:()=>c,bq:()=>o,dm:()=>a,eU:()=>h,ff:()=>p.ff,sw:()=>p.sw,we:()=>r,xi:()=>p.xi,zV:()=>p.zV,zm:()=>p.zm,zu:()=>p.zu});var r,i,o,s,a,l,c,u,d,h,p=n(8241);!function(e){e.Destroy="destroy",e.Reload="reload"}(r||(r={})),function(e){e.Bot="bot",e.Launch="launch",e.Media="media",e.Prompt="prompt"}(i||(i={})),function(e){e[e.Any=0]="Any",e[e.Desktop=1]="Desktop",e[e.Mobile=2]="Mobile"}(o||(o={})),function(e){e.ExternalSizing="external",e.InternalSizing="internal"}(s||(s={})),function(e){e.Failed="failed",e.Sending="sending",e.Sent="sent"}(a||(a={})),function(e){e.Document="document",e.Static="static",e.URL="url",e.Window="window"}(l||(l={})),function(e){e.Defer="defer",e.Handled="handled"}(c||(c={})),function(e){e.AI="ai"}(u||(u={})),function(e){e.Iframe="iframe",e.InLine="inline"}(d||(d={})),function(e){e.AI="ai",e.BOT="bot",e.BOT_NODE="bot_node",e.LIVECHAT="livechat"}(h||(h={}))},8048:(e,t,n)=>{"use strict";n.d(t,{$n:()=>Br,$p:()=>Jr,$z:()=>Ir,Bg:()=>Sr,Cv:()=>si,GW:()=>Nr,HD:()=>Tr,Hg:()=>Or,In:()=>Zr,Kr:()=>Ar,NO:()=>Kr,NQ:()=>Wr,NZ:()=>ei,P7:()=>qr,PM:()=>Fr,Q$:()=>Er,RN:()=>zr,Rh:()=>ri,Rq:()=>fi,S:()=>kr,U9:()=>vi,VK:()=>_i,Vf:()=>Dr,W5:()=>oi,WA:()=>hi,WQ:()=>Rr,Xy:()=>ni,Ze:()=>mi,aG:()=>Hr,bL:()=>Ur,eE:()=>ui,eu:()=>jr,fL:()=>ti,fg:()=>ii,fs:()=>bi,hX:()=>Lr,i2:()=>ci,jm:()=>Cr,kZ:()=>li,mW:()=>pi,n0:()=>Qr,ni:()=>Gr,o5:()=>wi,oo:()=>yi,pE:()=>ai,qf:()=>Xr,qp:()=>di,rA:()=>Mr,sX:()=>Pr,uA:()=>xi,vJ:()=>$r,wP:()=>Yr,wq:()=>Vr,xx:()=>gi});var r=n(9509),i=n(4256);const o=["src","className","alt"],s=["children","display","direction","className"],a=["alt","className","name","iconUrl","decorative","dataSettings"],l=["children","className","isAccessible","dataSettings"],c=["onTypingProgress","text","typing","typingDelay"],u=["className","moveSensivity","onSwipeMove","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeEnd","children","imitateTouch","winDocument"],d=["children","className","disabled","endIcon","fullWidth","onClick","rounded","size","startIcon","type","variant","dataSettings","dataSettingsText"];function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t{var n; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(){var r={}.hasOwnProperty;function i(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return y.d(t,{a:t}),t},y.d=(e,t)=>{for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var b={};y.d(b,{jm:()=>We,e8:()=>At,S:()=>Lt,Bg:()=>Ge,Hg:()=>Ye,eu:()=>O,cc:()=>B,sX:()=>Je,Q$:()=>et,HD:()=>tt,$z:()=>rt,gk:()=>V,GW:()=>st,Kr:()=>lt,hX:()=>ct,Vf:()=>xt,WQ:()=>Tt,rA:()=>Vt,vJ:()=>Wt,xe:()=>z,bL:()=>mr,PM:()=>mt,ke:()=>Gt,P7:()=>Qt,az:()=>j,$n:()=>Et,mT:()=>Kt,RN:()=>yn,wq:()=>H,aG:()=>W,NQ:()=>_n,Sc:()=>xn,ni:()=>kn,n0:()=>G,mo:()=>Q,Wp:()=>K,XY:()=>Y,NO:()=>cr,wP:()=>Pt,Mu:()=>$,i8:()=>J,$p:()=>P,RJ:()=>U,op:()=>F,In:()=>A,qf:()=>Sn,NZ:()=>Pn,fL:()=>En,Xy:()=>Tn,Rh:()=>L,gy:()=>Zt,fg:()=>Yt,W5:()=>nn,S0:()=>on,n6:()=>an,Cv:()=>en,zC:()=>fn,qG:()=>dn,rJ:()=>cn,ym:()=>Xt,pE:()=>Jt,kZ:()=>rn,iT:()=>sn,jP:()=>ln,i2:()=>tn,vV:()=>pn,kS:()=>hn,Hy:()=>un,eE:()=>Nn,qp:()=>Z,RB:()=>Kn,WA:()=>X,mW:()=>er,m9:()=>tr,ZL:()=>R,Rq:()=>xr,eU:()=>q,Ze:()=>M,Ap:()=>Gn,xx:()=>nr,DY:()=>ee,U9:()=>rr,oo:()=>ir,fs:()=>or,ks:()=>te,MN:()=>ne,VK:()=>me,o5:()=>ve,SP:()=>lr,uA:()=>mn,sM:()=>Dt,Wx:()=>vt,pn:()=>Mt});const _=(w={Fragment:()=>r.FK,jsx:()=>r.Y,jsxs:()=>r.FD},x={},y.d(x,w),x);var w,x;const C=(e=>{var t={};return y.d(t,e),t})({Children:()=>i.Children,Fragment:()=>i.Fragment,createContext:()=>i.createContext,createElement:()=>i.createElement,forwardRef:()=>i.forwardRef,useCallback:()=>i.useCallback,useContext:()=>i.useContext,useEffect:()=>i.useEffect,useMemo:()=>i.useMemo,useReducer:()=>i.useReducer,useRef:()=>i.useRef,useState:()=>i.useState});var k=y(6942),S=y.n(k);const O=(0,C.forwardRef)((function(e,t){let{src:n,className:r,alt:i="No Image"}=e,s=m(e,o);return(0,_.jsx)("img",p(p({"data-settings":"bot-avatar"},s),{},{alt:i,className:S()("avatar",r),draggable:!1,ref:t,src:n}))})),j=(0,C.forwardRef)((function(e,t){let{children:n,display:r="block",direction:i,className:o=""}=e,a=m(e,s);return(0,_.jsx)("div",p(p({className:S()("box",`box-${r}`,{[`box-direction-${i}`]:i},o),ref:t},a),{},{children:n}))}));function P(e){let{value:t,className:n}=e;const r=(t-0)*(0-251.3272)/100+251.3272;return(0,_.jsx)("div",{className:S()("file-loading",n),children:(0,_.jsxs)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",children:[(0,_.jsx)("circle",{className:"underlay",cx:"50",cy:"50",fill:"transparent",r:"40",strokeDasharray:"251.3272",strokeDashoffset:"0"}),(0,_.jsx)("circle",{className:"overlay",cx:"50",cy:"50",fill:"transparent",r:"40",strokeDasharray:"251.3272",strokeDashoffset:r,strokeLinecap:"round"})]})})}const E="2.13.4",T=window.ldIconCache=new Map;let I;function N(){return`ld-ico-${Math.floor(999999*Math.random())}`}function A(e){let{alt:t,className:n,name:r,iconUrl:i,decorative:o=!1,dataSettings:s}=e,l=m(e,a);const c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(I||(I={delete:e=>{T.delete(e)},get:e=>{if(T.has(e))return T.get(e)},has:e=>T.has(e),set:(e,t)=>{T.set(e,t)}}),I);const[n,r]=(0,C.useState)(null);return(0,C.useEffect)((()=>{if(!e)return;const n=`svgicon:${e}`;if(t.has(n))return void r(t.get(n));let i=!0;return fetch(e).then((t=>{if(!t.ok)throw new Error(`Request failed (${t.status} ${t.statusText}): ${e}`);return t.text()})).then((e=>{i&&(r(e),t.set(n,e))})).catch((e=>{console.error(e)})),()=>{i=!1}}),[e]),n}((0,C.useMemo)((()=>r?function(e){if(/\.svg$/i.test(e))throw new Error(`Invalid icon name: Provide only the name, not the filename: ${e}`);return`https://res.leadoo.com/icons/bot-icons/v${E}/icons/${e}.svg`}(r):i),[r,i])),u=(0,C.useMemo)(N,[]),d=(0,C.useRef)(null);return(0,C.useEffect)((()=>{if(!c||!d.current)return;const e=(new DOMParser).parseFromString(c,"image/svg+xml").documentElement;"svg"===e.nodeName.toLowerCase()&&(d.current.innerHTML="",d.current.appendChild(e))}),[c]),(0,C.useEffect)((()=>{if(null==d||!d.current)return;const e=d.current.children[0];if(e&&!(e.getElementsByTagName("title").length>0))if(e.setAttribute("focusable","false"),o)e.setAttribute("aria-hidden","true");else if(t){const n=document.createElement("title");n.id=u,n.textContent=t,e.insertBefore(n,e.firstChild),e.setAttribute("aria-labelledby",u),e.setAttribute("role","img")}}),[t,d,c]),(0,_.jsx)("span",p(p({"data-settings":s},l),{},{className:S()("icon",n),ref:d}))}function L(e){let{animation:t="flash"}=e;return(0,_.jsxs)("div",{className:"loading",children:[(0,_.jsx)("div",{className:S()("loading-dot",`loading-${t}`)}),(0,_.jsx)("div",{className:S()("loading-dot",`loading-${t}`)}),(0,_.jsx)("div",{className:S()("loading-dot",`loading-${t}`)})]})}const D=(e=>{var t={};return y.d(t,e),t})({createPortal:()=>i.createPortal});function R(e){let{children:t,id:n}=e;const r=(0,C.useRef)(document.createElement("div"));return(0,C.useEffect)((()=>{var e;const t=r.current;let i=document.getElementById(n||""),o=!1;if(!i){i=document.createElement("div");const e=Math.floor(1e9*Math.random());i.id="portal-"+e,i.setAttribute("role","portal"),document.body.appendChild(i),o=!0}if(null!=r&&r.current)return null!==(e=i)&&void 0!==e&&e.appendChild(r.current),()=>{var e,n;o?null===(e=i)||void 0===e||e.remove():null===(n=i)||void 0===n||n.removeChild(t)}}),[]),(0,D.createPortal)(t,r.current)}const M=(0,C.forwardRef)((function(e,t){let{children:n,className:r="",isAccessible:i=!1,dataSettings:o}=e,s=m(e,l);return(0,_.jsx)("div",p(p({"data-settings":o,className:S()("scrollbar",r,{accessible:i}),ref:t,tabIndex:i?0:-1},s),{},{children:n}))}));var $,U,F,q,B,z,V,H,W,G,Q,K,Y,J,Z,X,ee,te,ne,re;function ie(){return{rendered:[],tokensLeft:[],tokensProcessed:[]}}function oe(e,t){switch(t.type){case re.Reset:return p(p({},e),{},{rendered:[],tokensLeft:Array.isArray(t.left)?[...t.left]:[],tokensProcessed:[]});case re.SetTokens:return p(p({},e),{},{rendered:Array.isArray(t.rendered)?[...t.rendered]:e.rendered,tokensLeft:Array.isArray(t.left)?[...t.left]:e.tokensLeft,tokensProcessed:Array.isArray(t.processed)?[...t.processed]:e.tokensProcessed});default:throw new Error(`Unknown typer action: ${t.type}`)}}!function(e){e.PREDEFINED="predefined_list",e.NUMBER="number",e.DATE="date",e.TEXT="text_field"}($||($={})),function(e){e.aiDiscussionCount="aiDiscussionCount",e.andOr="andOr",e.attachments="attachments",e.botCategories="botCategories",e.botDiscussions="discussionCount",e.bookings="bookings",e.bots="bots",e.botsPresets="botsPresets",e.botTypes="botTypes",e.city="city",e.conversionPage="conversionPage",e.country="country",e.countryNew="countryNew",e.consents="consents",e.customFields="customFields",e.customKeyword="customKeyword",e.decisionMakers="decisionMakersCount",e.deviceType="deviceType",e.eventCount="eventCount",e.firstSeen="firstSeen",e.headcount="headcount",e.industry="industry",e.labels="labels",e.labelGroup="labelGroup",e.lastSeen="lastSeen",e.leads="leadsCount",e.livechatCount="livechatCount",e.pageVisit="pageVisit",e.rating="rating",e.revenue="revenue",e.scoreRange="scoreRange",e.source="source",e.sourceFirst="sourceFirst",e.sourceLast="sourceLast",e.sourceSession="sourceSession",e.userProfiles="customerProfilesCnt",e.utm="utm",e.utmSession="utmSession",e.utmFirst="utmFirst",e.variables="variables",e.utmLast="utmLast",e.zipCode="zipCode"}(U||(U={})),function(e){e.SELECT="select",e.OPTIONS_ARRAY="options-array",e.TEXT_ARRAY="text-array",e.RADIO_GROUP="radio-group",e.CHECKBOX_GROUP="checkbox-group",e.SCORE_RANGE="score-range",e.UTM_ARRAY="utm-array",e.UTM_SESSION_ARRAY="utm-session-array",e.RANGE_GROUP="range-group",e.CUSTOM_FIELD="custom-field",e.RATING="rating",e.CONSENTS="consents"}(F||(F={})),function(e){e.BOT_RATING="botRating",e.LC_RATING="lcRating",e.AI_RATING="aiRating"}(q||(q={})),function(e){e.IMAGE="image",e.COLOUR="colour"}(B||(B={})),function(e){e.SLIDE="slide",e.APPEAR="appear"}(z||(z={})),function(e){e.COVER="cover",e.CONTAIN="contain"}(V||(V={})),function(e){e[e.TEXT=1]="TEXT",e[e.VISUAL=2]="VISUAL",e[e.PRODUCT=3]="PRODUCT",e[e.BUTTON=4]="BUTTON"}(H||(H={})),function(e){e.IMAGE="image",e.IMAGE_URL="image-url",e.TEXT="text",e.BUTTON="button"}(W||(W={})),function(e){e.APPEAR="appear",e.FADEIN="fade-in",e.SCALE="scale"}(G||(G={})),function(e){e.revenue="org.revenue",e.headcount="org.headcount",e.headcountRange="org.headcountRange",e.industry="org.industry",e.country="org.country",e.userProfiles="org.userProfiles",e.sessionCount="org.sessionCount",e.customerSessionCount="customer.sessionCount",e.hasDecisionMakers="org.decisionMakersCount",e.isConverted="customer.isConverted",e.visitedPage="customer.visitedPage",e.notVisitedPage="customer.notVisitedPage",e.referrerDomain="referrerDomain",e.utm="utm",e.leadCity="lead.city",e.postalCode="lead.postalCode",e.leadScore="lead.score",e.leadLabels="lead.labels",e.attachmentsCount="lead.attachmentsCount",e.botName="bot.name",e.botType="bot.type",e.botCategory="bot.category",e.botLabels="bot.labels",e.eventCount="visitor_tracking.eventCount",e.convertedUsers="visitor_tracking.convertedUsersCount",e.pageVisits="visitor_tracking.pageVisits",e.pageVisitsCount="visitor_tracking.pageVisitsCount",e.visitorSource="visitor_tracking.source",e.visitorUtm="visitor_tracking.utm",e.orgCustomField="org.custom",e.customField=".custom",e.customerCustomField="customer.custom",e.customerLeadConversion="customer.leadConversion",e.customerCompany="customer.company",e.orgPageVisitsCount="org.pageVisitsCount",e.customerLabels="customer.labels",e.customerPageVisitsCount="customer.pageVisitsCount"}(Q||(Q={})),function(e){e.IS_ABOVE_EQUAL="gte",e.IS_BELOW_EQUAL="lte",e.EQUAL="eq",e.IS_ABOVE="gt",e.IS_BELOW="lt",e.IN="in",e.IS_TRUE="is_true",e.IS_FALSE="is_false"}(K||(K={})),function(e){e.AUTOCOMPLETE="autocomplete",e.SINGLE_AUTOCOMPLETE="single_autocomplete",e.COUNT="count",e.FIELD_ARRAY="field_array",e.TEXT_FIELD="text_field",e.EXPAND_SELECT="expand_select",e.SIMPLE_SELECT="simple_select",e.RANGE="range",e.EXISTS="exists",e.CUSTOM_FIELD="custom_field"}(Y||(Y={})),function(e){e.DESKTOP="desktop",e.MOBILE="mobile"}(J||(J={})),function(e){e.ERROR="error",e.READ="read",e.RECEIVED="received",e.SENDING="sending",e.SENT="sent"}(Z||(Z={})),function(e){e.TYPING="typing",e.ONLINE="online",e.OFFLINE="offline"}(X||(X={})),function(e){e.LEFT="left",e.CENTER="center",e.RIGHT="right"}(ee||(ee={})),function(e){e.Elements="elements",e.Text="text"}(te||(te={})),function(e){e[e.FULL=1]="FULL",e[e.INSIDE=2]="INSIDE"}(ne||(ne={})),function(e){e.Reset="reset",e.SetTokens="set-tokens"}(re||(re={}));const se=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];function ae(){return(0,_.jsx)("span",{className:"cursor",children:"|"})}function le(e){return e.reduce(((e,t)=>("string"==typeof t?e.push(...t.split("").map((e=>({text:e,type:te.Text})))):e.push(t),e)),[])}function ce(e,t){for(const n of e){if("string"==typeof n)continue;if(n.id===t)return n;const e=ce(n.children,t);if(e)return e}return null}function ue(e,t){if("string"==typeof e)return(0,_.jsxs)(C.Fragment,{children:[e,t?(0,_.jsx)(ae,{}):null]});const n=e.children.map(((e,n,r)=>ue(e,n===r.length-1&&t)));return function(e,t,n,r,i){const o=se.includes(e.toLowerCase()),s=(0,C.createElement)(e,p(p({},n),{},{id:t})),a=(0,C.createElement)(e,p(p({},n),{},{id:t}),r,i?(0,_.jsx)(ae,{}):null);return(0,_.jsx)(C.Fragment,{children:o&&(0,_.jsxs)(C.Fragment,{children:[s,i?(0,_.jsx)(ae,{}):null]})||a},t)}(e.tag,e.id,e.attributes,n,!(n.length>0)&&t)}function de(e,t){const n=[...e];if(t.type===te.Text)if(t.parentID){const e=ce(n,t.parentID);if(!e)throw new Error(`Failed rendering tokenised text: No parent element found for ID: ${t.parentID}`);const r=e.children.length,i=r>0?e.children[r-1]:null;"string"==typeof i?e.children[r-1]=`${i}${t.text}`:e.children.push(t.text)}else{const e=n.length,r=e>0?n[e-1]:null;"string"==typeof r?n[e-1]=`${r}${t.text}`:n.push(t.text)}else if(t.type===te.Elements)for(const e of t.elements)if(e.parentID){const t=ce(n,e.parentID);if(!t)throw new Error(`Failed rendering tokenised element: No parent element found for ID: ${e.parentID}`);t.children.push({attributes:e.attributes,children:[],id:e.id,tag:e.tag})}else n.push({attributes:e.attributes,children:[],id:e.id,tag:e.tag});return n}const he=[10,80],pe=()=>{};function fe(e,t){return!(e.type!==t.type||e.type===te.Text&&t.type===te.Text&&e.text!==t.text||e.type===te.Elements&&t.type===te.Elements&&(n=e.elements,r=t.elements,n.length!==r.length||!n.every((e=>{const t=r.find((t=>e.id===t.id&&e.tag===t.tag));return!!t&&(!e.parentID&&!t.parentID||e.parentID===t.parentID)}))));var n,r}function me(e){const{onTypingProgress:t=pe,text:n,typing:r=!0,typingDelay:i=he}=e,o=m(e,c),[s,a,l]=function(e,t){const n=(0,C.useMemo)(t,[]),r=(0,C.useRef)(n),i=(0,C.useCallback)((()=>r.current),[]),o=(0,C.useRef)(((t,n)=>(r.current=e(t,n),r.current))).current,[s,a]=(0,C.useReducer)(o,null,t);return[s,a,i]}(oe,ie),[u,d]=(0,C.useState)((()=>Math.random())),h=(0,C.useMemo)((()=>"string"==typeof n?n.split(/\n/g).reduce(((e,t,n,r)=>{const i=le(t.split(""));return n[i[0],i[1]]),[i.join(",")]);return(0,C.useEffect)((()=>{if(!r){let e=[];for(const t of h)e=de(e,t);return a({left:[],processed:h,rendered:e,type:re.SetTokens}),void t(h.length,h.length)}{const e=l(),t=function(e,t){if(e.length!==t.length)return!1;for(let n=0;n0&&function(e,t){if(t.length>e.length)return!1;for(let n=0;n{const r=Math.random()*(f[1]-f[0])+f[0];e=setTimeout((()=>{const e=l(),r=e.tokensLeft[0];if(!r)return void t(h.length,h.length);const i=[...e.tokensProcessed,e.tokensLeft[0]];a({left:e.tokensLeft.slice(1),processed:i,rendered:de(e.rendered,r),type:re.SetTokens}),t(i.length,h.length),n()}),r)};return n(),()=>{null!==e&&clearTimeout(e)}}),[a,l,u,t,h,r,f]),(0,_.jsx)("div",p(p({},o),{},{className:S()("typer",o.className),children:s.rendered.map(((e,t,n)=>ue(e,t===n.length-1&&r)))}))}const ge={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"};function ve(e){let{ariaLive:t,component:n,children:r,onClick:i,variant:o="body1",align:s="inherit",truncated:a=!1,className:l="",customHTML:c="",id:u,role:d,dataSettings:h}=e;const f=n||ge[o];return(0,_.jsx)(f,p(p({"aria-live":t,className:S()("typography",{[`typography-align-${s}`]:"inherit"!==s,[`typography-${o}`]:"inherit"!==o,"typography-truncated":a,[l]:l}),onClick:i,role:d},c?{dangerouslySetInnerHTML:{__html:c}}:{}),{},{id:u,"data-settings":h,children:r}))}const ye="alert-outline",be="arrow-left",_e="check",we="chevron-left",xe="chevron-right",Ce="close",ke="cloud-download-outline",Se="file-document-outline",Oe="file-image",je="link-variant",Pe="pencil",Ee="search-web",Te="ld-warning",Ie="ld-upload-outline",Ne="ld-telegram-send",Ae="ld-telegram-send-alt",Le="ld-open-new",De="ld-exit-sharp-outline",Re="ld-copy-alt",Me="ld-close",$e="ld-clock-outline",Ue="ld-checkmark",Fe="ld-checkmark-sharp",qe="ld-attachment",Be="ld-arrow-refresh",ze="ld-arrow-down",Ve="ld-ai-message";var He;function We(e){var t,n;let{sources:r,title:i,seeMoreTitle:o,seeLessTitle:s,showSources:a,webIconAlt:l,docIconAlt:c}=e;const[u,d]=(0,C.useState)(!1),h=(0,C.useRef)(null),p=()=>{d((e=>!e))};return(0,_.jsxs)(j,{className:S()("ai-source-array",{"ai-source-array-show":a,"ai-source-array-show-all":a&&u}),children:[!u&&(0,_.jsxs)("button",{className:S()("ai-source-array-collapse","ai-source-array-collapse-show"),onClick:p,children:[(0,_.jsx)(ve,{className:"ai-source-array-collapse-title",component:"span",children:o}),(0,_.jsx)(A,{name:ze,decorative:!0})]}),(0,_.jsxs)("div",{className:S()("ai-source-array-content",{"ai-source-array-content-show":u,"ai-source-array-content-hide":!u}),ref:h,style:{maxHeight:u&&null!==(t=null===(n=h.current)||void 0===n?void 0:n.scrollHeight)&&void 0!==t?t:0},children:[(0,_.jsx)(ve,{className:"ai-source-array-title",children:i}),(0,_.jsx)("div",{className:"ai-source-array-wrapper",children:r.map((e=>{return(0,_.jsxs)("button",{className:S()("ai-source-array-item",{"ai-source-array-item-link":e.url&&e.type===He.WebPage}),onClick:(t=e.url,()=>{t&&window.open(t,"_blank")}),type:"button",children:[(0,_.jsx)(A,{alt:e.type===He.WebPage?l:c,name:e.type===He.WebPage?je:Se}),e.title||e.url]},e.id);var t}))}),(0,_.jsxs)("button",{className:S()("ai-source-array-collapse","ai-source-array-collapse-hide"),onClick:p,children:[(0,_.jsx)(ve,{className:"ai-source-array-collapse-title",component:"span",children:s}),(0,_.jsx)(A,{className:"invert-vert",name:ze,decorative:!0})]})]})]})}!function(e){e.Document="document",e.WebPage="web_page"}(He||(He={}));const Ge=(0,C.forwardRef)((function(e,t){let{children:n,isVisible:r,disableFadeIn:i=!1,className:o}=e;return(0,_.jsx)(j,{className:S()("answer-prompt",o,{"answer-prompt-show":r,"answer-prompt-hide":!r}),ref:t,children:(0,_.jsx)("div",{className:"answer-prompt-bg",children:(0,_.jsx)("div",{className:S()("answer-prompt-wrap",{"answer-prompt-wrap-visible":r&&!i,"answer-prompt-wrap-visible-disable":i,"answer-prompt-wrap-hidden":!r}),children:n})})})})),Qe=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],Ke=e=>{const t=e<0?-e:e,n=[];let r=0;const i=Math.round;let o=Math.floor(Math.log(t)/Math.log(1e3));if(o>8?o=8:o<0&&(o=0),0===t)n[0]=0,n[1]=Qe[0];else{r=t/Math.pow(1e3,o);const e=Math.pow(10,1);n[0]=i(r*e)/e,1e3===n[0]&&(n[0]=1,o++),n[1]=1===o?"kB":Qe[o]}return n.join(" ")};function Ye(e){let{deleteAlt:t,imageAlt:n,fileAlt:r,disabled:i=!1,file:o,fileLoadedTitle:s,index:a,downloadID:l,handleDownload:c,handleDelete:u,isAnswer:d=!1}=e;const[h,p]=(0,C.useState)(!1),f="boolean"!=typeof o.isLoaded||h,m=!1===o.isLoaded,g=!h&&o.isLoaded,v=!d;(0,C.useEffect)((()=>{o.isLoaded&&setTimeout((()=>{p(!0)}),1e3)}),[o.isLoaded]);const y=o.error?`${o.title} ${o.error.message}`:`${o.title} ${Ke(o.size)}`,b=(0,C.useCallback)((e=>{!i&&u&&"number"==typeof a&&(e.stopPropagation(),u(e,o.title,a))}),[i,o.title,u,a]),w=(0,C.useCallback)((()=>{l&&c&&c(l)}),[c,l]);return(0,_.jsxs)("div",{className:S()("attachment-item",{"attachment-item-answer":d,"attachment-item-download":Boolean(l)}),onClick:w,children:[(0,_.jsxs)("div",{className:S()("attachment-item-icon-wrapper",{"attachment-item-icon-wrapper-answer":d,"attachment-item-icon-wrapper-error":o.error}),children:[f&&!m&&(0,_.jsx)(A,{alt:o.isImage?n:r,name:o.isImage?Oe:Re}),g&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(A,{name:Fe,decorative:!0}),s&&(0,_.jsx)("span",{className:"attachment-item-loaded",role:"status",children:`${s} - ${o.title}`})]}),m&&(0,_.jsx)(P,{className:"attachment-item-loading",value:50})]}),(0,_.jsxs)("div",{className:S()("attachment-item-info",{"attachment-item-info-answer":d}),children:[(0,_.jsx)(ve,{"aria-describedby":"upload-error",className:"attachment-item-info-title",truncated:!0,children:o.title}),o.error?(0,_.jsx)(ve,{ariaLive:"assertive",className:"attachment-item-info-error",component:"p",id:"upload-error",variant:"subtitle2",children:o.error.message}):(0,_.jsx)(ve,{className:S()("attachment-item-info-size",{"attachment-item-info-size-answer":d}),component:"p",variant:"subtitle2",children:Ke(o.size)})]}),v&&(0,_.jsx)("button",{className:"attachment-item-clear-icon",onClick:b,children:(0,_.jsx)(A,{alt:`${t} - ${y}`,name:Ce})})]})}function Je(e){let{deleteAlt:t,imageAlt:n,fileAlt:r,files:i,onDeleteFile:o,title:s,skipTitle:a,fileLoadedTitle:l,uploadAlt:c,uploadFiles:u,onSkip:d,disabled:h=!1,disableEvents:p=!1}=e;const f=(0,C.useRef)(null),[m,g]=(0,C.useState)(!1),v=(0,C.useCallback)((e=>{var t;const n=[...null!==(t=e.target.files)&&void 0!==t?t:[]];u(n),e.target.value=""}),[u]),y=(0,C.useCallback)((()=>{var e;p||h||null==f||null===(e=f.current)||void 0===e||e.click()}),[h,p]),b=(0,C.useCallback)((e=>{var t;if(e.preventDefault(),e.stopPropagation(),p||h)return;g(!1);const n=[...null!==(t=e.dataTransfer.files)&&void 0!==t?t:[]];u(n)}),[h,p,u]),w=(0,C.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),p||h||(["dragenter","dragover"].includes(e.type)?g(!0):"dragleave"===e.type&&g(!1))}),[h,p]),x=(0,C.useCallback)(((e,t,n)=>{if(e.stopPropagation(),p||h)return;const r=i.find(((e,r)=>e.title===t&&n===r));r&&o(r,n)}),[h,p,i,o]),k=(0,C.useCallback)((e=>{h||"Enter"!==e.code&&"Space"!==e.code||(e.preventDefault(),e.stopPropagation(),y())}),[h,y]);return(0,_.jsxs)("div",{className:"bot-attachments",children:[(0,_.jsxs)("div",{className:S()("bot-attachments-upload",{"bot-attachments-upload-active":m}),onClick:y,onDragEnter:e=>w(e),onDragLeave:e=>w(e),onDragOver:e=>w(e),onDrop:e=>b(e),onKeyDown:k,role:"button",tabIndex:0,children:[(0,_.jsx)("input",{className:"bot-attachments-upload-input",disabled:h,onChange:v,ref:f,type:"file",multiple:!0}),(0,_.jsx)(ve,{className:"bot-attachments-upload-title",component:"span",children:s}),(0,_.jsx)(A,{alt:c,className:"bot-attachments-upload-icon",name:Ie})]}),Boolean(i.length)&&(0,_.jsx)(M,{className:"bot-attachments-upload-list",children:i.map(((e,i)=>(0,_.jsx)(Ye,{deleteAlt:t,disabled:h,file:e,fileAlt:r,fileLoadedTitle:l,handleDelete:x,imageAlt:n,index:i},`${e.title}-${i}`)))}),a&&(0,_.jsx)(j,{className:"bot-attachments-skip",display:"flex",children:(0,_.jsxs)("button",{className:"bot-attachments-skip-button",onClick:d,children:[(0,_.jsx)(ve,{className:"bot-attachments-skip-title",component:"span",variant:"h4",children:a}),(0,_.jsx)(A,{className:"bot-attachments-skip-icon",name:xe})]})})]})}const Ze=(e,t,n)=>{const r=new Date(e);return`${t[r.getDay()]}, ${n[r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`};function Xe(e){let{selectedISO:t,calDate:n,todayISO:r,allowPastDates:i,isBooking:o,daysList:s,focusedISO:a,monthsList:l,onDaySelect:c,calculateNonCurrent:u,disabled:d}=e;const h=(0,C.useRef)(null),p=u(n.iso),f=d||!i&&(n.iso{var e;a!==n.iso||f||null===(e=h.current)||void 0===e||e.focus()}),[a,n.iso,f]),(0,_.jsx)("button",{"aria-label":m,"aria-pressed":t===n.iso,className:S()("bot-calendar-body-grid-day",{"bot-calendar-body-grid-day-hidden":"current"!==n.type,"bot-calendar-body-grid-day-selected":t&&t===n.iso,"bot-calendar-body-grid-day-current":r===n.iso}),disabled:f||n.isWeekend,onClick:()=>c(n),ref:h,tabIndex:a!==n.iso?-1:0,children:(0,_.jsx)(ve,{component:"span",children:n.day})})}function et(e){let{calendarDays:t,weekdayNames:n,onDayClick:r,todayISO:i,selectedISO:o,focusedISO:s,setFocusShift:a,allowPastDates:l,calculateNonCurrent:c,isBooking:u,daysList:d,monthsList:h,disabled:p=!1}=e;const f=(0,C.useRef)(null),m=(0,C.useCallback)((e=>{switch(e.code){case"ArrowDown":a(7);break;case"ArrowUp":a(-7);break;case"ArrowLeft":a(-1);break;case"ArrowRight":a(1)}}),[a]);return(0,C.useEffect)((()=>{const e=f.current;return null!=e&&e.addEventListener("keydown",m),()=>null==e?void 0:e.removeEventListener("keydown",m)}),[m]),(0,_.jsx)("div",{className:"bot-calendar-body",ref:f,children:n.length>0&&t.length>0&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:S()("bot-calendar-body-grid","bot-calendar-body-header"),children:n.map((e=>(0,_.jsx)("div",{className:"bot-calendar-body-grid-weekday",children:(0,_.jsx)(ve,{variant:"subtitle2",children:e})},e)))}),(0,_.jsx)("div",{className:"bot-calendar-body-grid",children:t.map(((e,t)=>(0,_.jsx)(C.Fragment,{children:e.map((e=>(0,_.jsx)("div",{children:(0,_.jsx)(Xe,{allowPastDates:l,calculateNonCurrent:c,calDate:e,daysList:d,disabled:p,focusedISO:s,isBooking:u,monthsList:h,onDaySelect:r,selectedISO:o,todayISO:i})},e.iso)))},t)))})]})})}function tt(e){let{month:t,year:n,onChange:r,disabled:i=!1,prevBtnAriaLabel:o,nextBtnAriaLabel:s}=e;return(0,_.jsxs)("div",{className:"bot-calendar-header",children:[(0,_.jsx)("button",{"aria-disabled":`${i}`,"aria-label":o,className:S()("navigation-button",{"navigation-button-disabled":i}),onClick:e=>{i||(e.stopPropagation(),e.preventDefault(),r(-1))},role:"button",children:(0,_.jsx)(A,{name:we,decorative:!0})}),(0,_.jsxs)(ve,{dataSettings:"bot-calendar-color","aria-atomic":"true","aria-label":`${t} ${n}`,"aria-live":"assertive",className:"bot-calendar-header-title",children:[t," ",n]}),(0,_.jsx)("button",{"aria-disabled":"false","aria-label":s,className:"navigation-button",onClick:e=>{i||(e.stopPropagation(),e.preventDefault(),r(1))},role:"button",children:(0,_.jsx)(A,{name:xe,decorative:!0})})]})}function nt(e){let{children:t,isOpen:n,isClose:r}=e;return(0,_.jsx)("div",{className:S()("bot-calendar-modal",{"bot-calendar-modal-show":n,"bot-calendar-modal-hide":!n}),children:(0,_.jsx)("div",{className:S()("bot-calendar-modal-bg",{"bot-calendar-modal-bg-show":n,"bot-calendar-modal-bg-hide":r}),children:(0,_.jsx)("div",{className:"bot-calendar-modal-content",children:t})})})}const rt=function(e){let{isOpen:t,isClose:n,children:r,portalTarget:i}=e;return(0,D.createPortal)((0,_.jsx)(nt,{isClose:n,isOpen:t,children:r}),i)},it=(e,t)=>{if(t.infiniteLoop&&(e+=t.itemCloneCount),0===e)return 0;let n=-e*t.slidePercent;const r=t.itemsCount-1;return e&&(e!==r||t.infiniteLoop)?n+=(100-t.slidePercent)/2:e===r&&(n+=100-t.slidePercent),n},ot=e=>{let{className:t,moveSensivity:n,onSwipeMove:r,onSwipeLeft:i,onSwipeRight:o,onSwipeStart:s,onSwipeEnd:a,children:l,imitateTouch:c=!1,winDocument:d}=e,h=m(e,u);const f=(0,C.useRef)(null),g=(0,C.useRef)(0),v=(0,C.useRef)(0),y=(0,C.useRef)(!1),b=(0,C.useRef)(!1),w=(0,C.useRef)(null),x=e=>"touches"in e?e.touches[0].pageX:e.screenX,k=e=>{v.current=x(e),s(e)},S=(0,C.useCallback)((e=>{if(!v.current)return;const t=x(e)-v.current;b.current=!0,w.current&&cancelAnimationFrame(w.current),w.current=requestAnimationFrame((()=>{r(t,e)})),e.cancelable&&e.preventDefault(),g.current=t}),[r]),O=(0,C.useCallback)((e=>{a(e),b.current&&g.current&&(g.current<-n?null==i||i():g.current>n&&(null==o||o())),v.current=0,b.current=!1,g.current=0}),[n,a,i,o]),j=e=>{y.current&&S(e)},P=e=>{y.current=!1,(null!=d?d:document).removeEventListener("mouseup",P),(null!=d?d:document).removeEventListener("mousemove",j),O(e)};return(0,C.useEffect)((()=>{if(!f.current)return;const e=f.current,t=e=>{S(e)};return e.addEventListener("touchmove",t,{passive:!1,capture:!0}),()=>{e.removeEventListener("touchmove",t)}}),[S]),(0,_.jsx)("div",p(p({className:t,onMouseDown:c?e=>{y.current=!0,(null!=d?d:document).addEventListener("mouseup",P),(null!=d?d:document).addEventListener("mousemove",j),k(e)}:void 0,onTouchEnd:O,onTouchStart:k,ref:f},h),{},{children:l}))},st=e=>{let{children:t,ariaLabel:n,infiniteLoop:r=!1,imitateTouch:i=!1,fullWidth:o=!1,centerMode:s=!0,onSwipeStart:a,onSwipeMove:l,onSwipeEnd:c,itemLabel:u,prevArrowLabel:d,nextArrowLabel:h,singleCentered:f=!1,slidePercent:m=80,showArrows:g=!0,winDocument:v}=e;const y=(0,C.useRef)(!1),[b,w]=(0,C.useState)(!1),[x,k]=(0,C.useState)(0),[O,j]=(0,C.useState)(0),[P,E]=(0,C.useState)({cancelClick:!1,swipeMovementStarted:!1}),T=(0,C.useRef)([]),I=C.Children.count(t),N=g&&I>0,L=1===I||I<3&&m<33,D=L?0:m<33?2:1,R=(0,C.useCallback)((e=>{let t=it(x,{infiniteLoop:r,slidePercent:m,itemsCount:I,itemCloneCount:D})+100/(240/e);const n=Math.abs(e)>5;return r&&n&&(t>0?t=0:t<100*-(I-1)&&(t=100*-(I-1))),(n||P.swipeMovementStarted)&&(P.swipeMovementStarted||E(p(p({},P),{},{swipeMovementStarted:!0}))),n&&!P.cancelClick&&E(p(p({},P),{},{cancelClick:!0})),t}),[I,r,x,D,m,P]),M=(0,C.useCallback)(((e,t)=>{l&&l(t);const n=R(e);return j(n),!0}),[R,j,l]),$=e=>t?C.Children.map(t,((t,n)=>{let r={minWidth:m+"%",width:L?m+"%":"unset"};b&&P.swipeMovementStarted&&(r=p(p({},r),{},{pointerEvents:"none"}));const o={ref:e=>((e,t)=>{T.current||(T.current=[]),T.current[t]=e})(e,n),key:"itemKey"+n+(e?"clone":""),className:S()("slide",{selected:n===x&&!L,"center-mode":s}),imitateTouch:i,style:r};return(0,_.jsx)("li",p(p({},o),{},{children:t}))})):[],U=$(!0),F=U.slice(0,D),q=U.slice(-D),B=(0,C.useCallback)((()=>{const e=it(x,{infiniteLoop:r,slidePercent:m,itemsCount:I,itemCloneCount:D});j(e)}),[I,r,x,D,m]),z=e=>{if("number"!=typeof e)return;const t=I-1;e<0?e=r?t:0:e>t&&(e=r?0:t),k(e)},V=()=>{z(x-1)},H=()=>{z(x+1)};return(0,C.useEffect)((()=>{y.current=!0}),[]),(0,C.useEffect)((()=>{b||B()}),[b,B]),(0,_.jsx)(_.Fragment,{children:(0,_.jsx)("div",{"aria-label":n,className:S()("bot-carousel",{"bot-carousel-full-width":o}),children:(0,_.jsxs)("div",{className:"carousel",children:[N&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("button",{"aria-label":d,className:S()("bot-carousel-arrow","bot-carousel-arrow-prev",{"bot-carousel-arrow-hidden":0===x&&!r||L}),onClick:e=>{e.preventDefault(),V()},children:(0,_.jsx)(A,{name:"ld-arrow-left",dataSettings:"carousel-arrow-color"})}),(0,_.jsx)("button",{"aria-label":h,className:S()("bot-carousel-arrow","bot-carousel-arrow-next",{"bot-carousel-arrow-hidden":x===I-1&&!r||L}),onClick:e=>{e.preventDefault(),H()},children:(0,_.jsx)(A,{name:"ld-arrow-right",dataSettings:"carousel-arrow-color"})})]}),(0,_.jsx)("div",{className:"bot-carousel-slider-wrapper",children:(0,_.jsxs)(ot,{className:S()("slider",{animated:!b,centered:f&&L,end:L}),imitateTouch:i,moveSensivity:5,onSwipeEnd:e=>{w(!1),E({cancelClick:!1,swipeMovementStarted:!1}),c&&c(e)},onSwipeLeft:()=>{H(),E(p(p({},P),{},{cancelClick:!0}))},onSwipeMove:M,onSwipeRight:()=>{V(),E(p(p({},P),{},{cancelClick:!0}))},onSwipeStart:e=>{w(!0),a&&a(e)},style:{transform:`translate(${O}%)`},winDocument:v,children:[r&&!L&&q,$(),r&&!L&&F]})}),!L&&(0,_.jsx)("div",{className:"carousel-control",role:"group",children:C.Children.map(t,((e,t)=>(0,_.jsx)("button",{"data-settings":"carousel-dot-color","aria-label":`${null!=u?u:""} ${t}`,className:S()("carousel-control-dot",{"carousel-control-dot-selected":t===x}),onClick:e=>{return n=t,e.preventDefault(),void z(n);var n}},t)))})]})})})},at={[H.TEXT]:["dynamic-title",""],[H.VISUAL]:["","dynamic-title",""],[H.PRODUCT]:["","dynamic-title","dynamic-details-top","","dynamic-details-bottom","dynamic-button"],[H.BUTTON]:["","dynamic-title","","dynamic-button"]},lt=e=>{let{cardContent:t,cardTemplateID:n,id:r,onSelect:i,onButtonClick:o,isDynamicNode:s=!1,forceShowImage:a=!1,imitateTouch:l=!1,isSelected:c=!1,isMock:u=!1}=e;const d=t.map(((e,t,r)=>{var i;const o=at[n]&&at[n][t];return"half"===e.width&&"half"===(null===(i=r[t-1])||void 0===i?void 0:i.width)?p(p({},e),{},{rightAligned:!0,dynamicCn:o}):p(p({},e),{},{dynamicCn:o})})).filter((e=>{const t=[W.IMAGE_URL,W.IMAGE].includes(e.type);return e.type===W.BUTTON?Boolean(e.value)||Boolean(e.title):!(!t||!a)||Boolean(e.value)}));return(0,_.jsxs)("div",{className:S()("carousel-card",{"carousel-card-interactive":r,"carousel-card-mock":u}),onClick:()=>{l||i(r)},onDoubleClick:()=>{l&&i(r)},"data-settings":"carousel-card-bg",children:[c&&(0,_.jsx)("div",{className:S()("carousel-card-selected",{"carousel-card-selected-mock":u})}),d.map((e=>(e=>{var t,n;switch(e.type){case W.TEXT:{var r,i,a,l;const t=`${null!==(r=e.prefix)&&void 0!==r?r:""}${null!==(i=e.value)&&void 0!==i?i:""}${null!==(a=e.postfix)&&void 0!==a?a:""}`;return(0,_.jsx)("div",{className:S()("carousel-card-item",{"carousel-card-item-half":"half"===e.width}),children:(0,_.jsx)(ve,{className:S()("carousel-card-text",{"align-right":e.rightAligned,"carousel-card-text-full":"half"!==e.width,[null!==(l=e.dynamicCn)&&void 0!==l?l:""]:s}),customHTML:t,dataSettings:"carousel-card-text"})})}case W.BUTTON:return(0,_.jsx)("div",{className:S()("carousel-card-item",{"carousel-card-item-half":"half"===e.width,"carousel-card-item-flex-end":"half"===e.width}),children:(0,_.jsx)("button",{className:S()("carousel-card-button",{"align-right":e.rightAligned,"carousel-card-button-full":"full"===e.width,[null!==(t=e.dynamicCn)&&void 0!==t?t:""]:s}),onClick:t=>((e,t)=>{if(e.stopPropagation(),e.preventDefault(),s){var n,r,i;const e=`${null!==(n=t.prefix)&&void 0!==n?n:""}${null!==(r=t.value)&&void 0!==r?r:""}${null!==(i=t.postfix)&&void 0!==i?i:""}`;o&&o(e,"_blank")}else t.url&&t.target_link&&o&&o(t.url,t.target_link)})(t,e),children:(0,_.jsx)("p",{className:"carousel-card-button-text",dangerouslySetInnerHTML:{__html:null!==(n=s?e.title:e.value)&&void 0!==n?n:""}})})});case W.IMAGE:case W.IMAGE_URL:{const t=e.mode===V.CONTAIN;return(0,_.jsx)("div",{style:t?{"--ldvar-botCarouselImageBg":`url(${e.value})`}:void 0,className:S()("carousel-card-item",{"carousel-card-item-half":"half"===e.width,"carousel-card-image-wrapper":t}),children:e.value?(0,_.jsx)("img",{alt:"Bot carousel image",className:S()("carousel-card-image",{"carousel-card-image-contain":t}),draggable:"false",src:e.value}):(0,_.jsx)("div",{className:S()("carousel-card-image","carousel-card-image-empty"),children:(0,_.jsx)(A,{name:"image-remove"})})})}default:return null}})(e)))]})},ct=(0,C.forwardRef)((function(e,t){let{children:n,innerRef:r}=e;return(0,_.jsx)(M,{ref:t,isAccessible:!0,children:(0,_.jsx)(j,{"aria-live":"polite",className:"bot-content-wrapper",direction:"column",display:"flex",ref:r,children:n})})}));function ut(e){let{error:t,helperText:n,helperTextPosition:r}=e;return(0,_.jsxs)("p",{className:S()("helper-text",{"helper-text-absolute":"absolute"===r,"helper-text-static":"static"===r,"helper-text-error":t}),children:[t&&(0,_.jsx)(A,{className:"helper-text-icon",name:Te}),n]})}const dt=(e,t,n,r,i,o)=>{const[s,a]=(0,C.useState)(0),l=(0,C.useMemo)((()=>Number(!r)+Number(!i)),[r,i]),c=(0,C.useCallback)((e=>{const r=s+1===t.length+l?0:s+1,i=s{(r||0!==s)&&e.current[s].focus()}),[s,l,r]),(0,C.useEffect)((()=>((o||document).addEventListener("keydown",c,!0),()=>(o||document).removeEventListener("keydown",c,!0))),[c,o]),[s,a,l]},ht="Enter",pt=13,ft=(e,t)=>{const n=e.includes("px")?Number(e.replace("px","")):t;return nk||`input-${Math.floor(9999*Math.random())}`),[k]),z=t?t+(v?"*":""):t,V=(0,C.useCallback)((e=>{i(e.target.value)}),[i]),H=(0,C.useCallback)((e=>{if(g||F)return;const t=e.key===ht||e.code===ht||e.keyCode===pt;e.shiftKey||e.ctrlKey||!t?e.ctrlKey||e.altKey||l&&l():(e.preventDefault(),e.stopPropagation(),L&&a&&a(r),c&&c())}),[c,a,l,g,F,L,r]),W=()=>{q(!0)},G=()=>{q(!1)};return(0,C.useEffect)((()=>{if(!m||!f||!M.current)return;const e=getComputedStyle(M.current),t=ft(e.lineHeight,19),n=ft(e.paddingTop,14)+ft(e.paddingBottom,14);M.current.style.height=`${t+n}px`;const r=M.current.scrollHeight||t+n,i=b*t+n,o=Math.min(r,i);M.current.style.height=o+"px";const s=(o-n)/t;s!==$&&U(s)}),[r,b,$,m,f,i]),(0,C.useEffect)((()=>{var e;N&&(null==M||null===(e=M.current)||void 0===e||e.focus())}),[N]),(0,C.useEffect)((()=>{u&&M.current&&u(M.current)}),[M.current]),(0,_.jsxs)("div",{className:"bot-textfield-wrapper",children:[t&&(0,_.jsx)("label",{"data-settings":"bot-textfield-label",className:S()("bot-textfield-label",{"bot-textfield-label-error":I}),htmlFor:B,children:z}),(0,_.jsxs)("div",{className:S()("bot-textfield",j,{"bot-textfield-full-width":E}),children:[(0,_.jsxs)("div",{className:S()("bot-textfield-input-wrapper",{"bot-textfield-input-wrapper-disabled":T,"bot-textfield-input-wrapper-error":I}),children:[f?(0,_.jsx)("textarea",{"aria-describedby":D,"aria-label":t?void 0:x,autoComplete:P,className:S()("bot-textfield-input","bot-textfield-textarea",R,{"bot-textfield-textarea-error":I}),disabled:T,id:B,maxLength:w,name:B,onBlur:o,onChange:V,onCompositionEnd:G,onCompositionStart:W,onFocus:s,onKeyDown:H,placeholder:n,ref:M,rows:$,value:r}):(0,_.jsxs)(_.Fragment,{children:[p&&(0,_.jsx)(A,{"data-settings":"bot-textfield-icon",alt:O,className:"bot-textfield-start-icon",name:p}),(0,_.jsx)("input",{"aria-describedby":D,"aria-label":t?void 0:x,autoComplete:P,className:S()("bot-textfield-input",{"bot-textfield-input-error":I,"bot-textfield-input-start-icon":Boolean(p)}),"data-settings":"bot-textfield-input",disabled:T,id:B,maxLength:w,name:B,onBlur:o,onChange:V,onCompositionEnd:G,onCompositionStart:W,onFocus:s,onKeyDown:H,placeholder:n,ref:M,type:"text",value:r})]}),(0,_.jsx)("div",{className:"bot-textfield-outline"})]}),d&&(0,_.jsx)(ut,{error:I,helperText:d,helperTextPosition:h})]})]})}const gt=new Map,vt=()=>{var e;const[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)({inView:!1,entry:void 0});(0,C.useEffect)((()=>{if(!t)return;const e=((e,t)=>{const{id:n,observer:r,elements:i}=(()=>{const e=(new Date).getTime().toString();let t=gt.get(e);if(!t){const n=new Map;t={id:e,observer:new IntersectionObserver((e=>{e.forEach((e=>{var t;const r=e.isIntersecting;null===(t=n.get(e.target))||void 0===t||t.forEach((t=>{t(r,e)}))}))})),elements:n},gt.set(e,t)}return t})(),o=i.get(e)||[];return i.has(e)||i.set(e,o),o.push(t),r.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(i.delete(e),r.unobserve(e)),0===i.size&&(r.disconnect(),gt.delete(n))}})(t,((e,t)=>{i({inView:e,entry:t})}));return()=>{e&&e()}}),[t]);const o=null===(e=r.entry)||void 0===e?void 0:e.target;return(0,C.useEffect)((()=>{!t&&o&&i({inView:!1,entry:void 0})}),[t,o]),[n,r.inView]};function yt(e){let{optionRefs:t,option:n,index:r,selectedItem:i,optionIndexDelta:o,handleSelect:s}=e;const[a,l]=vt();return(0,_.jsx)("button",{"aria-pressed":i===n.value,className:S()("dropdown-option-list-item",{"dropdown-option-list-item-selected":i===n.value,"dropdown-option-list-item-hidden":!l}),onClick:()=>s(n.value),ref:e=>{a(e),t[r+o]=e},role:"option",children:(0,_.jsx)(ve,{className:"dropdown-option-list-item-title",component:"span",children:n.title})},n.value)}function bt(e){let{options:t,selectedItem:n,handleSelect:r,handleClose:i,hideClose:o=!1,hideSearch:s=!1,searchLabel:a="Search",winDocument:l,closeIconAlt:c}=e;const[u,d]=(0,C.useState)(""),h=(0,C.useRef)({}),p=(0,C.useMemo)((()=>(h.current={},t.filter((e=>e.title.toLowerCase().includes(u.toLowerCase()))))),[u,t]),[f,m,g]=dt(h,p,i,s,o,l);return(0,_.jsxs)("div",{className:"dropdown-option-list",children:[!s&&(0,_.jsxs)("div",{className:"dropdown-option-list-header",children:[(0,_.jsx)(mt,{ariaLabel:a,autoFocus:0===f,onChange:e=>{d(e)},onFocus:()=>{m(0)},placeholder:a,startIcon:Ee,value:u,fullWidth:!0}),!o&&(0,_.jsx)("button",{className:"icon-wrapper",onClick:i,ref:e=>{h.current[1]=e},children:(0,_.jsx)(A,{alt:c,name:Ce})})]}),(0,_.jsxs)(M,{"aria-multiselectable":!1,className:S()("dropdown-option-list-scroll",{"dropdown-option-list-search-hidden":s}),id:"options-listbox",role:"listbox",tabIndex:-1,children:[!p.length&&(0,_.jsx)("button",{className:"dropdown-option-list-item",ref:e=>{h.current[g]=e},children:(0,_.jsx)(ve,{className:"dropdown-option-list-item-no-data",component:"span",children:"Options not found"})}),p.map(((e,t)=>(0,_.jsx)(yt,{handleSelect:r,index:t,option:e,optionIndexDelta:g,optionRefs:h.current,selectedItem:n},`${e}-${t}`)))]})]})}function _t(e){let{selectedItem:t,options:n,handleSelect:r,handleClose:i,portalTarget:o,searchLabel:s,winDocument:a,closeIconAlt:l}=e;return(0,D.createPortal)((0,_.jsxs)("div",{className:"dropdown-modal-wrapper",role:"dialog",children:[(0,_.jsx)("div",{className:"dropdown-outside-wrapper",onClick:i}),(0,_.jsx)("div",{className:S()("dropdown-list-wrapper","dropdown-list-wrapper-entrance"),children:(0,_.jsx)(bt,{closeIconAlt:l,handleClose:i,handleSelect:r,options:n,searchLabel:s,selectedItem:t,winDocument:a})})]}),o)}function wt(e){let{selectedItem:t,options:n,handleSelect:r,handleClose:i,renderPopper:o,searchLabel:s,winDocument:a,dropdownRef:l,hideSearch:c=!1}=e;const u=(0,C.useRef)(null);return(0,C.useEffect)((()=>{function e(e){var t,n;const r=(null==u?void 0:u.current)&&!(null!=u&&null!==(t=u.current)&&void 0!==t&&t.contains(e.target)),o=(null==l?void 0:l.current)&&!(null!==(n=l.current)&&void 0!==n&&n.contains(e.target));e.target&&r&&o&&i()}return(a||document).addEventListener("mousedown",e),()=>{(a||document).removeEventListener("mousedown",e)}}),[u,l,i]),(0,_.jsx)("div",{className:S()("dropdown-popper-wrapper",{"dropdown-popper-wrapper-bottom":"bottom"===o.anchor,"dropdown-popper-wrapper-bottom-block":"bottom"===o.anchor&&Boolean(o.block)}),ref:u,role:"dialog",children:(0,_.jsx)(bt,{handleClose:i,handleSelect:r,hideSearch:c,options:n,searchLabel:s,selectedItem:t,winDocument:a,hideClose:!0})})}const xt=(0,C.forwardRef)((function(e,t){var n;let{value:r,options:i,label:o,placeholder:s,closeIconAlt:a,onChange:l,setExternalRef:c,helperText:u,helperTextPosition:d="static",portalTarget:h,disabledToggle:p=!1,fullWidth:f=!1,error:m=!1,size:g="medium",renderPopper:v,isDisableShadow:y=!1,searchLabel:b,ariaLabel:w,id:x=null,className:k,winDocument:O,hideSearch:j=!1,autoFocus:P=!1,required:E=!1}=e;const[T,I]=(0,C.useState)(!1),N=(0,C.useRef)(null),L=(0,C.useMemo)((()=>x||`input-${Math.floor(9999*Math.random())}`),[x]),D=o?o+(E?"*":""):o,R=null===(n=i.find((e=>e.value===r)))||void 0===n?void 0:n.title,M=null!=R?R:s,$=(0,C.useMemo)((()=>{if(w||M)return`${null!=w?w:""}${M?` ${M}`:""}`}),[w,M]),U=e=>{l(e),F()},F=()=>{var e;null!==(e=N.current)&&void 0!==e&&e.focus(),I(!1)};return(0,C.useEffect)((()=>{var e;P&&(null===(e=N.current)||void 0===e||e.focus())}),[P]),(0,C.useEffect)((()=>{c&&(null==N?void 0:N.current)&&c(N.current)}),[N.current]),(0,_.jsxs)("div",{className:"bot-dropdown-wrapper",children:[o&&(0,_.jsx)("label",{className:S()("bot-dropdown-label",{"bot-dropdown-label-error":m}),htmlFor:L,children:D}),(0,_.jsxs)("div",{className:S()("bot-dropdown",k,{"bot-dropdown-full-width":f}),ref:t,children:[(0,_.jsxs)("button",{"aria-autocomplete":"none","aria-controls":"options-listbox","aria-expanded":T,"aria-haspopup":"dialog","aria-label":$,"aria-required":E,className:S()("bot-dropdown-typography-wrapper",{"bot-dropdown-typography-wrapper-disabled":p,"bot-dropdown-typography-wrapper-error":m,"disable-shadow":y}),id:L,onClick:e=>{p||(e.stopPropagation(),I((e=>!e)))},ref:N,role:"combobox",type:"button",children:[(0,_.jsx)(ve,{className:S()("bot-dropdown-typography",{"bot-dropdown-typography-error":m,"bot-dropdown-typography-small":"small"===g,"bot-dropdown-typography-placeholder":!R}),component:"span",children:null!=M&&M.trim()?M:(0,_.jsx)(_.Fragment,{children:"Ā "})}),(0,_.jsx)(A,{className:S()("bot-dropdown-open-icon",{"invert-vert":T}),name:ze,decorative:!0})]}),(0,_.jsx)("div",{className:"bot-dropdown-outline"}),!!v&&T&&(0,_.jsx)(wt,{dropdownRef:N,handleClose:F,handleSelect:U,hideSearch:j,options:i,renderPopper:v,searchLabel:b,selectedItem:r,winDocument:O})]}),u&&(0,_.jsx)(ut,{error:m,helperText:u,helperTextPosition:d}),h&&!v&&T&&(0,_.jsx)(_t,{closeIconAlt:a,handleClose:F,handleSelect:U,options:i,portalTarget:h,searchLabel:b,selectedItem:r,winDocument:O})]})})),Ct=(e,t)=>`${t}/country-flags/${e.toLowerCase()}.svg`;function kt(e){let{optionRefs:t,option:n,index:r,baseUrl:i,optionIndexDelta:o,handleSelect:s,isPreferred:a,selectedItem:l}=e;const[c,u]=vt();return(0,_.jsxs)("button",{"aria-pressed":l===n.id,className:S()("country-option-list-item",{"country-option-list-item-preferred":a,"country-option-list-item-selected":l===n.id,"country-option-list-item-hidden":!u}),onClick:()=>s(n.id),ref:e=>{c(e),t[r+o]=e},role:"option",children:[(0,_.jsx)("img",{alt:n.code,"aria-label":`${n.name} flag icon`,className:"country-option-list-item-flag",src:Ct(n.code,i)}),(0,_.jsx)(ve,{className:"country-option-list-item-title",children:n.name})]},n.code)}function St(e){let{baseUrl:t,availableCountries:n,preferredCountries:r,handleSelect:i,handleClose:o,hideClose:s=!1,hideSearch:a=!1,searchLabel:l="Search",winDocument:c,closeIconAlt:u,selectedItem:d}=e;const[h,p]=(0,C.useState)(""),f=(0,C.useRef)({}),m=(0,C.useMemo)((()=>(f.current={},n.filter((e=>e.name.toLowerCase().includes(h.toLowerCase()))))),[h,n]),g=(0,C.useMemo)((()=>(f.current={},r.filter((e=>e.name.toLowerCase().includes(h.toLowerCase()))))),[h,r]),v=m.length||g.length,[y,b,w]=dt(f,[...g,...m],o,a,s,c);return(0,_.jsxs)("div",{className:"country-option-list",children:[!a&&(0,_.jsxs)("div",{className:"country-option-list-header",children:[(0,_.jsx)(mt,{ariaLabel:l,autoFocus:0===y,onChange:e=>{p(e)},onFocus:()=>{b(0)},placeholder:l,startIcon:"ld-search",value:h,fullWidth:!0}),!s&&(0,_.jsx)("button",{className:"icon-wrapper",onClick:o,ref:e=>{f.current[1]=e},children:(0,_.jsx)(A,{alt:u,name:Ce})})]}),(0,_.jsxs)(M,{"aria-multiselectable":!1,className:S()("country-option-list-scroll",{"country-option-list-search-hidden":a}),id:"options-listbox",role:"listbox",tabIndex:-1,children:[!v&&(0,_.jsx)("button",{className:"country-option-list-item",ref:e=>{f.current[w]=e},children:(0,_.jsx)(ve,{className:"country-option-list-item-no-data",component:"span",children:"Options not found"})}),g.length>0&&(0,_.jsxs)(_.Fragment,{children:[g.map(((e,n)=>(0,_.jsx)(kt,{baseUrl:t,handleSelect:i,index:n,option:e,optionIndexDelta:w,optionRefs:f.current,selectedItem:d,isPreferred:!0},`${e}-${n}`))),(0,_.jsx)("div",{className:"country-option-list-item-divider"})]}),m.map(((e,n)=>(0,_.jsx)(kt,{baseUrl:t,handleSelect:i,index:n,option:e,optionIndexDelta:w,optionRefs:f.current,selectedItem:d},`${e}-${n}`)))]})]})}function Ot(e){let{baseUrl:t,availableCountries:n,preferredCountries:r,handleSelect:i,handleClose:o,portalTarget:s,searchLabel:a,winDocument:l,closeIconAlt:c,selectedItem:u}=e;return(0,D.createPortal)((0,_.jsxs)("div",{className:"dropdown-modal-wrapper",role:"dialog",children:[(0,_.jsx)("div",{className:"dropdown-outside-wrapper",onClick:o}),(0,_.jsx)("div",{className:S()("dropdown-list-wrapper","dropdown-list-wrapper-entrance"),children:(0,_.jsx)(St,{baseUrl:t,closeIconAlt:c,handleClose:o,handleSelect:i,availableCountries:n,preferredCountries:r,searchLabel:a,selectedItem:u,winDocument:l})})]}),s)}function jt(e){let{baseUrl:t,availableCountries:n,preferredCountries:r,handleSelect:i,handleClose:o,renderPopper:s,searchLabel:a,winDocument:l,dropdownRef:c,selectedItem:u,hideSearch:d=!1}=e;const h=(0,C.useRef)(null);return(0,C.useEffect)((()=>{function e(e){var t,n;const r=(null==h?void 0:h.current)&&!(null!=h&&null!==(t=h.current)&&void 0!==t&&t.contains(e.target)),i=(null==c?void 0:c.current)&&!(null!==(n=c.current)&&void 0!==n&&n.contains(e.target));e.target&&r&&i&&o()}return(l||document).addEventListener("mousedown",e),()=>{(l||document).removeEventListener("mousedown",e)}}),[h,c,o]),(0,_.jsx)("div",{className:S()("country-popper-wrapper",{"country-popper-wrapper-bottom":"bottom"===s.anchor,"country-popper-wrapper-bottom-block":"bottom"===s.anchor&&Boolean(s.block)}),ref:h,role:"dialog",children:(0,_.jsx)(St,{baseUrl:t,handleClose:o,handleSelect:i,hideSearch:d,availableCountries:n,preferredCountries:r,searchLabel:a,winDocument:l,selectedItem:u,hideClose:!0})})}const Pt=(0,C.forwardRef)((function(e,t){var n,r,i;let{baseUrl:o,value:s,availableCountries:a,preferredCountries:l,label:c,placeholder:u,closeIconAlt:d,onChange:h,setExternalRef:p,helperText:f,helperTextPosition:m="static",portalTarget:g,disabledToggle:v=!1,fullWidth:y=!1,error:b=!1,size:w="medium",renderPopper:x,isDisableShadow:k=!1,searchLabel:O,ariaLabel:j,id:P=null,className:E,winDocument:T,hideSearch:I=!1,autoFocus:N=!1,required:L=!1}=e;const[D,R]=(0,C.useState)(!1),M=(0,C.useRef)(null),$=(0,C.useMemo)((()=>P||`input-${Math.floor(9999*Math.random())}`),[P]),U=c?c+(L?"*":""):c,F=null===(n=[...a,...l].find((e=>e.id===s)))||void 0===n?void 0:n.name,q=null!=F?F:u,B=null!==(r=null===(i=[...a,...l].find((e=>e.id===s)))||void 0===i?void 0:i.code)&&void 0!==r?r:"",z=(0,C.useMemo)((()=>{if(j||q)return`${null!=j?j:""}${q?` ${q}`:""}`}),[j,q]),V=e=>{h(e),H()},H=()=>{var e;null!==(e=M.current)&&void 0!==e&&e.focus(),R(!1)};return(0,C.useEffect)((()=>{var e;N&&(null===(e=M.current)||void 0===e||e.focus())}),[N]),(0,C.useEffect)((()=>{p&&(null==M?void 0:M.current)&&p(M.current)}),[M.current]),(0,_.jsxs)("div",{className:"bot-dropdown-wrapper",children:[c&&(0,_.jsx)("label",{className:S()("bot-dropdown-label",{"bot-dropdown-label-error":b}),htmlFor:$,children:U}),(0,_.jsxs)("div",{className:S()("bot-dropdown",E,{"bot-dropdown-full-width":y}),ref:t,children:[(0,_.jsxs)("button",{"aria-autocomplete":"none","aria-controls":"options-listbox","aria-expanded":D,"aria-haspopup":"dialog","aria-label":z,"aria-required":L,className:S()("bot-dropdown-typography-wrapper",{"bot-dropdown-typography-wrapper-disabled":v,"bot-dropdown-typography-wrapper-error":b,"disable-shadow":k}),id:$,onClick:e=>{v||(e.stopPropagation(),R((e=>!e)))},ref:M,role:"combobox",type:"button",children:[B?(0,_.jsx)("img",{alt:B,className:"country-icon",src:Ct(B,o)}):(0,_.jsx)(A,{className:S()("country-icon","unselected-icon"),name:"earth",decorative:!0}),(0,_.jsx)(ve,{className:S()("bot-dropdown-typography",{"bot-dropdown-typography-error":b,"bot-dropdown-typography-small":"small"===w}),component:"span",children:null!=q&&q.trim()?q:(0,_.jsx)(_.Fragment,{children:"Ā "})}),(0,_.jsx)(A,{className:S()("bot-dropdown-open-icon",{"invert-vert":D}),name:ze,decorative:!0})]}),(0,_.jsx)("div",{className:"bot-dropdown-outline"}),!!x&&D&&(0,_.jsx)(jt,{baseUrl:o,dropdownRef:M,handleClose:H,handleSelect:V,hideSearch:I,availableCountries:a,preferredCountries:l,renderPopper:x,searchLabel:O,selectedItem:s,winDocument:T})]}),f&&(0,_.jsx)(ut,{error:b,helperText:f,helperTextPosition:m}),g&&!x&&D&&(0,_.jsx)(Ot,{baseUrl:o,closeIconAlt:d,handleClose:H,handleSelect:V,availableCountries:a,preferredCountries:l,portalTarget:g,searchLabel:O,selectedItem:s,winDocument:T})]})})),Et=(0,C.forwardRef)((function(e,t){let{children:n,className:r,disabled:i=!1,endIcon:o,fullWidth:s=!1,onClick:a,rounded:l=!1,size:c="m",startIcon:u,type:h="button",variant:f="contained",dataSettings:g,dataSettingsText:v}=e,y=m(e,d);return(0,_.jsxs)("button",p(p({className:S()("button",r,{[`button-${f}`]:f,[`button-${c}`]:c,"button-rounded":l,"button-disabled":i,"button-fullWidth":s}),"data-settings":g,onClick:a,ref:t,type:h},y),{},{children:[u&&(0,_.jsx)("span",{className:S()({"button-start-icon":u}),children:u}),(0,_.jsx)("span",{"aria-hidden":"false","data-settings":v,className:"button-text",children:n}),o&&(0,_.jsx)("span",{className:S()({"button-end-icon":o}),children:o})]}))}));function Tt(e){let{title:t,errorIconAlt:n,copyTitle:r,copiedTitle:i,errorMessage:o}=e;const[s,a]=(0,C.useState)(!1);return(0,_.jsxs)("div",{className:"bot-error-info",children:[(0,_.jsx)(A,{alt:n,className:"bot-error-info-icon",name:ye}),(0,_.jsxs)("div",{className:"bot-error-info-content",children:[(0,_.jsx)(ve,{className:"bot-error-info-title",component:"span",children:t}),(0,_.jsx)(Et,{className:"bot-error-info-button",onClick:()=>{navigator.clipboard&&navigator.clipboard.writeText&&o&&navigator.clipboard.writeText(o).then((()=>{a(!0),setTimeout((()=>{a(!1)}),3e3)}))},variant:s?"outlined":"contained",children:s?i:r})]})]})}function It(e){return e.sort().join(",")}function Nt(e){return[...new Set(e)]}const At=(0,C.createContext)({});function Lt(e){const{children:t,dependencies:n=[]}=e,[r,i]=(0,C.useState)(n),[o,s]=(0,C.useState)([]),[a,l]=(0,C.useState)([]),[c,u]=(0,C.useState)([]),[d,h]=(0,C.useState)({}),f=It(a),m=It(c),g=(0,C.useCallback)(((e,t,n,r)=>{var i,o,s,a;d[e]?d[e].element===t&&d[e].animation===n&&(a=r,null===(s=d[e].transitions)&&null===a||null!==s&&null!==a&&s.sort().join(",")===a.sort().join(","))||(null!==(i=(o=d[e]).removeListener)&&void 0!==i&&i.call(o),h(p(p({},d),{},{[e]:p(p({},d[e]),{},{animation:n,element:t,removeListener:null,transitions:r})}))):h(p(p({},d),{},{[e]:{animation:n,element:t,removeListener:null,startTimeout:null,transitions:r}}))}),[d]),v=(0,C.useCallback)((e=>{d[e]&&(null!==d[e].startTimeout&&clearTimeout(d[e].startTimeout),a.includes(e)||u((t=>t.filter((t=>t!==e)))))}),[f,d]),y=(0,C.useCallback)((e=>{l((t=>t.filter((t=>t!==e)))),s((t=>Nt([...t,e])))}),[]);return(0,C.useEffect)((()=>{const e=[];for(const[t,n]of Object.entries(d)){if(c.includes(t)||!n.element)continue;e.push(t);const r=()=>{null!==n.startTimeout&&clearTimeout(n.startTimeout),s((e=>e.filter((e=>e!==t)))),l((e=>Nt([...e,t])))},i=e=>{let t=null;for(const[n,r]of Object.entries(d))if(r.element===e){t=n;break}return t};if(n.animation){const e=function(e){if(e.target!==this)return;const t=i(this);t&&e.animationName===d[t].animation&&(s((e=>e.filter((e=>e!==t)))),l((e=>Nt([...e,t]))))},t=function(e){if(e.target!==this)return;const t=i(this);t&&e.animationName===d[t].animation&&null!==n.startTimeout&&clearTimeout(n.startTimeout)};n.element.addEventListener("animationend",e),n.element.addEventListener("animationcancel",e),n.element.addEventListener("animationstart",t),n.removeListener=()=>{var r,i,o;null!==(r=n.element)&&void 0!==r&&r.removeEventListener("animationend",e),null!==(i=n.element)&&void 0!==i&&i.removeEventListener("animationcancel",e),null!==(o=n.element)&&void 0!==o&&o.removeEventListener("animationstart",t),null!==n.startTimeout&&clearTimeout(n.startTimeout)},null!==n.startTimeout&&clearTimeout(n.startTimeout),n.startTimeout=setTimeout((()=>{r()}),1e3)}else{const e=function(e){var t;const n=i(this);n&&(null===(t=d[n].transitions)||void 0===t?void 0:t.includes(e.propertyName))&&(s((e=>e.filter((e=>e!==n)))),l((e=>Nt([...e,n]))))},t=function(e){var t;const r=i(this);r&&(null===(t=d[r].transitions)||void 0===t?void 0:t.includes(e.propertyName))&&null!==n.startTimeout&&clearTimeout(n.startTimeout)};n.element.addEventListener("transitionend",e),n.element.addEventListener("transitioncancel",e),n.element.addEventListener("transitionrun",t),n.element.addEventListener("transitionstart",t),n.removeListener=()=>{var r,i,o,s;null!==(r=n.element)&&void 0!==r&&r.removeEventListener("transitionend",e),null!==(i=n.element)&&void 0!==i&&i.removeEventListener("transitioncancel",e),null!==(o=n.element)&&void 0!==o&&o.removeEventListener("transitionrun",t),null!==(s=n.element)&&void 0!==s&&s.removeEventListener("transitionstart",t),null!==n.startTimeout&&clearTimeout(n.startTimeout)},n.startTimeout=setTimeout((()=>{r()}),1500)}}if(e.length<=0)return;u((t=>Nt([...t,...e])));const t=e.filter((e=>!1===a.includes(e)));t.length>0&&s((e=>Nt([...e,...t])))}),[f,d,m]),(0,C.useEffect)((()=>{(n.length!==r.length||n.some(((e,t)=>e!==r[t])))&&(i([...n]),l([]),s((e=>Nt([...e,...a]))))}),[f,n,r]),(0,_.jsx)(At.Provider,{value:{animatedElements:a,animatingElements:o,deregisterElement:v,registerElement:g,resetAnimations:y},children:t})}function Dt(e,t,n){return Rt(e,t,null,n,arguments.length>3&&void 0!==arguments[3]?arguments[3]:[])}function Rt(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];const{animatedElements:o,animatingElements:s,deregisterElement:a,registerElement:l,resetAnimations:c}=(0,C.useContext)(At),u=o.includes(e),d=s.includes(e),h=It(r),p=It(i),f=(0,C.useMemo)((()=>u?p.split(","):d?h.split(","):[]),[u,d,h,p]),m=(0,C.useCallback)((r=>{r?null!==t?l(e,r,t,null):l(e,r,null,n):a(e)}),[t,a,e,l,n]),g=(0,C.useCallback)((()=>{c(e)}),[e,c]);return(0,C.useMemo)((()=>[m,f,g]),[m,f,g])}function Mt(e,t,n){return Rt(e,null,t,n,arguments.length>3&&void 0!==arguments[3]?arguments[3]:[])}const $t=(e,t)=>{const n=(0,C.useRef)(void 0),r=(0,C.useRef)(void 0);function i(){r.current&&clearTimeout(r.current)}return(0,C.useEffect)((()=>i),[]),function(){for(var o=arguments.length,s=new Array(o),a=0;a{n.current&&e(...n.current)}),t)}},Ut=["fade-from-top-anim"],Ft=["fade-from-top-complete"];function qt(e){let{t,title:n,status:r,isClosed:i}=e;const[o,s]=Dt("bot-title","fade-from-top",Ut,Ft);return(0,_.jsxs)("div",{className:S()("bot-header-title",...s,{"bot-header-title-closed":i}),ref:o,children:[(0,_.jsx)(ve,{component:"h4",className:"bot-header-title-name",variant:"h4",dataSettings:"bot-header-title",children:n}),r===X.TYPING&&(0,_.jsxs)(ve,{className:"bot-header-title-typing",variant:"h6",children:[t("chat.header.status.typing"),"..."]}),r===X.ONLINE&&(0,_.jsx)(ve,{className:"bot-header-title-availability available",dataSettings:"livechat-available",variant:"h6",children:t("chat.header.status.available")}),r===X.OFFLINE&&(0,_.jsx)(ve,{className:"bot-header-title-availability unavailable",variant:"h6",children:t("chat.header.status.unavailable")})]})}const Bt=["fade-from-top-anim"],zt=["fade-from-top-complete"];function Vt(e){let{avatarAlt:t,onClose:n,onRefresh:r,className:i="",status:o,src:s,title:a,isClosed:l,reloadIconAlt:c,closeIconAlt:u,t:d}=e;const[h,p]=Dt("bot-header","fade-from-top",Bt,zt),[f,m]=Dt("bot-avatar","fade-from-top",Bt,zt),[g,v]=Dt("bot-reload","fade-from-top",Bt,zt),[y,b]=Dt("bot-close","fade-from-top",Bt,zt),w=$t((()=>r()),500);return(0,_.jsxs)(j,{"data-settings":"bot-header",className:S()("bot-header",i,...p,{"bot-header-closed":l}),ref:h,children:[s&&(0,_.jsx)(O,{alt:t,className:S()("bot-header-avatar",...m,{"bot-header-avatar-closed":l}),ref:f,src:s}),(0,_.jsx)(qt,{isClosed:l,status:o,t:d,title:a}),(0,_.jsx)("button",{className:S()("bot-header-icon","bot-header-icon-refresh",...v,{"bot-header-icon-closed":l}),"aria-label":d("a11y.reload-btn"),onClick:w,ref:g,"data-settings":"bot-header-font-color",children:(0,_.jsx)(A,{alt:c,name:Be})}),(0,_.jsx)("button",{className:S()("bot-header-icon","bot-header-icon-close",...b,{"bot-header-icon-closed":l}),"aria-label":d("a11y.close-btn"),onClick:n,ref:y,"data-settings":"bot-header-font-color",children:(0,_.jsx)(A,{alt:u,name:Ce})})]})}const Ht=e=>{let{className:t}=e;return(0,_.jsx)("svg",{className:t,fill:"none",height:"11",viewBox:"0 0 12 11",width:"12",xmlns:"http://www.w3.org/2000/svg",children:(0,_.jsx)("path",{d:"M6 1.07149L7.39167 3.70919L7.50639 3.92663L7.74864 3.96855L10.6873 4.47701L8.60874 6.61565L8.43739 6.79196L8.47239 7.03531L8.89691 9.98725L6.22062 8.67131L6 8.56283L5.77938 8.67131L3.10309 9.98725L3.52761 7.03531L3.56261 6.79196L3.39126 6.61565L1.31271 4.47701L4.25136 3.96855L4.49361 3.92663L4.60833 3.70919L6 1.07149Z",stroke:"#3D779E"})})};function Wt(e){let{nodeId:t,animation:n=z.SLIDE,children:r=null,onEditClick:i,isEditable:o=!1,timeout:s,classNames:a="",isAnswer:l=!1,isColumn:c=!1,showGPTMessage:u=!1,gptMessage:d,onRateClick:h,isRated:p,rateText:f,gptTooltipMessage:m,isRateEnabled:g,dataSettings:v}=e;const y=n===z.SLIDE?"slide-to-bottom":"appear-from-bottom",b=(0,C.useMemo)((()=>[`${y}-anim`]),[y]),w=(0,C.useMemo)((()=>[`${y}-complete`]),[y]),[x,k]=Dt(`ld-question-${t}`,y,b,w),[O,P]=(0,C.useState)(!1);return(0,_.jsx)(j,{className:S()("bot-message",a,{"bot-message-gpt":d}),children:(0,_.jsxs)(j,{className:S()("bot-message-wrapper",...null!=k?k:[],{"bot-message-answer":l}),ref:x,style:{animationDelay:s?`${s}s`:"unset"},children:[o&&(0,_.jsx)(A,{className:"bot-message-edit-icon",name:Pe,onClick:i}),(0,_.jsxs)(j,{"data-settings":v,className:S()("bot-message-content",{"bot-message-answer-content":l||c,"bot-message-content-gpt":d,"bot-message-content-gpt-show":d&&u}),children:[r,d&&(0,_.jsxs)(j,{className:S()("bot-message-content-gpt-wrapper",{"bot-message-content-gpt-wrapper-show":u}),children:[(0,_.jsxs)("div",{className:"bot-message-content-gpt-icon-wrapper",onMouseEnter:()=>{P(!0)},onMouseLeave:()=>{P(!1)},children:[(0,_.jsx)(A,{name:Ve,decorative:!0}),O&&m&&(0,_.jsx)("div",{className:"bot-message-content-gpt-icon-wrapper-tooltip",children:(0,_.jsx)(ve,{className:"bot-message-content-gpt-icon-wrapper-tooltip-message",children:m})})]}),(0,_.jsx)(ve,{className:"bot-message-content-gpt-message",children:d}),g&&(0,_.jsxs)("div",{className:"bot-message-content-gpt-rating",onClick:()=>{h&&h()},children:[(0,_.jsx)(ve,{children:f}),(0,_.jsx)(Ht,{className:S()("bot-message-content-gpt-rating-icon",{"bot-message-content-gpt-rating-icon-selected":p})})]})]})]})]})})}function Gt(e){let{children:t,onClick:n,className:r}=e;return(0,_.jsx)(j,{className:S()("bot-trigger",r),onClick:n,children:t})}function Qt(e){let{children:t,classname:n,isClosed:r=!1,isLeftAligned:i=!1,fullscreen:o=!1}=e;return(0,_.jsx)("div",{className:n,style:{display:"none"},children:(0,_.jsx)("div",{className:S()("bot-wrapper",{"right-aligned":!i,"left-aligned":i,"bot-wrapper-closed":r,"bot-fullscreen":o}),children:t})})}function Kt(e){let{min:t,max:n,step:r,selectedOption:i,onSelect:o,className:s}=e;const a=(0,C.useMemo)((()=>function(e,t,n){const r=[];for(let i=e;i<=t;i+=n)r.push(i);return r}(t,n,r)),[t,n,r]);return(0,_.jsx)(j,{className:S()("button-range",s),children:a.map(((e,t)=>(0,_.jsx)(Et,{className:S()("range-btn",{"range-btn-selected":i===e}),onClick:()=>o(e),children:e},`${e}-${t}`)))})}const Yt=60,Jt=40,Zt=20,Xt=14,en=320,tn=220,nn=70,rn=50,on=240,sn=172,an=160,ln=115,cn=45,un=34,dn=160,hn=121,pn=252,fn=320,mn=(e,t,n)=>{const r=n+Math.max(0,Math.min(100,e))/100*(t-n);return Math.round(r)};function gn(e){let{mounted:t,isOpen:n,chatIcon:r,sizePercent:i,closeIconAlt:o,openIconAlt:s}=e;const a=mn(i,Zt,Xt),l=n&&t,c=!n&&t;return(0,_.jsxs)("span",{className:S()("trigger-icon-wrapper"),style:{"--ldvar-iconSize":`${a}px`},children:[(0,_.jsx)(A,{alt:o,className:S()("trigger-icon","close",{invisible:n||!t,appear:n&&!t,show:l,hide:c}),name:Ce}),(0,_.jsx)(A,{alt:s,className:S()("trigger-icon","chat",{invisible:!n||!t,appear:!n&&!t,show:c,hide:l}),iconUrl:r})]})}function vn(e){let{triggerImage:t,triggerImageType:n,closeIconAlt:r,triggerImageAlt:i,isOpen:o,mounted:s}=e;return(0,_.jsxs)("div",{className:S()("trigger-img-wrapper",{inside:n===ne.INSIDE}),children:[o&&s&&(0,_.jsx)(A,{alt:r,className:"image-close-icon",name:Ce}),(0,_.jsx)("img",{alt:i,className:"trigger-image",src:t})]})}function yn(e){let{isOpen:t,handleIsOpen:n,chatIcon:r,triggerImageAlt:i,triggerImage:o,triggerImageType:s,additionalStyles:a,sizePercent:l,closeIconAlt:c,openIconAlt:u,ariaLabel:d}=e;const h=(0,C.useRef)(null),f=mn(l,Yt,Jt),[m,g]=(0,C.useState)(!1),v=Boolean(o)&&s===ne.FULL;(0,C.useEffect)((()=>{var e;m&&(null!==(e=h.current)&&void 0!==e&&e.classList.add("button-trigger-animated"),setTimeout((()=>{var e;null===(e=h.current)||void 0===e||e.classList.remove("button-trigger-animated")}),200))}),[t,m]);const y=(0,C.useCallback)((()=>{g(!0),n()}),[n,g]);return(0,_.jsx)("button",{className:S()("button-trigger","button-trigger-animated",{"button-trigger-appear":!m,"full-image":v}),onClick:y,ref:h,role:"button",style:p(p({},a),{},{width:f,height:f}),"data-settings":"trigger-color","aria-label":d,children:o?(0,_.jsx)(vn,{isOpen:t,mounted:m,triggerImage:o,triggerImageAlt:i,triggerImageType:s}):(0,_.jsx)(gn,{chatIcon:r,closeIconAlt:c,isOpen:t,mounted:m,openIconAlt:u,sizePercent:l})})}const bn=8;function _n(e){let{avatarAlt:t,botIcon:n,containerId:r,description:i,handleClose:o,handleOpen:s,title:a,sizePercent:l,closeIconAlt:c,leftAligned:u,visible:d}=e;const h=(0,C.useRef)(null),p=mn(l,fn,pn),f=mn(l,Yt,Jt);return(0,C.useEffect)((()=>{d&&h.current&&(h.current.style.height="unset")}),[d]),(0,_.jsx)("div",{className:S()("card-trigger",[{"card-trigger-left":u,hidden:!d}]),id:r,onAnimationEnd:e=>{"fadeout"===e.animationName&&(null==h?void 0:h.current)&&(h.current.style.height="0px")},ref:h,style:{width:p},children:(0,_.jsxs)("div",{className:"card-trigger-wrapper",onClick:s,role:"button",style:{paddingTop:f/2+bn},children:[(0,_.jsx)("button",{className:S()("card-trigger-close-icon",{"card-trigger-close-icon-left":u}),onClick:e=>{e.stopPropagation(),o()},children:(0,_.jsx)(A,{alt:c,name:Ce})}),(0,_.jsx)(O,{alt:t,className:"card-trigger-avatar",src:n,style:{width:f,minWidth:f,height:f,top:-f/2}}),(0,_.jsxs)("span",{className:"card-trigger-text-content",children:[(0,_.jsx)("span",{className:"card-trigger-title",dangerouslySetInnerHTML:{__html:null!=a?a:""}}),i&&(0,_.jsx)("span",{className:"card-trigger-description",dangerouslySetInnerHTML:{__html:null!=i?i:""}})]})]})})}function wn(e){let{className:t,text:n,labelID:r}=e;const i=(0,C.useRef)(null),o=(0,C.useRef)(null),[s,a]=(0,C.useState)(0),[l,c]=(0,C.useState)(0),[u,d]=(0,C.useState)(!1);return(0,C.useEffect)((()=>{if(null!=i&&i.current&&null!=o&&o.current){const e=o.current.offsetHeight,t=i.current.getBoundingClientRect().x-8,n=document.body.getBoundingClientRect();a(t),c(i.current.getBoundingClientRect().y-n.y-e)}}),[u]),(0,_.jsx)(_.Fragment,{children:(0,_.jsxs)("p",{className:S()(t,"textlabel"),id:r,onMouseEnter:()=>{var e,t;(null==i||null===(e=i.current)||void 0===e?void 0:e.scrollWidth)===(null===(t=i.current)||void 0===t?void 0:t.clientWidth)||d(!0)},onMouseLeave:()=>{d(!1)},ref:i,children:[n,u&&(0,_.jsx)(R,{id:"textlabel-message",children:(0,_.jsx)("div",{className:"textlabel-message",children:(0,_.jsx)("div",{className:S()("textlabel-message-content",{"textlabel-message-hidden":!u}),ref:o,style:{top:l,left:s},children:(0,_.jsx)("p",{className:"textlabel-message-text",children:n})})})})]})})}function xn(e){var t,n;let{checked:r,onChange:i,disabled:o=!1,label:s,labelID:a,name:l,value:c,withCheckMark:u=!1,customClasses:d={root:"",label:""},flagCode:h,baseUrl:p}=e;return(0,_.jsxs)("label",{className:S()("checkbox",{[null!==(t=d.root)&&void 0!==t?t:""]:d.root}),children:[(0,_.jsx)("input",{"aria-checked":`${r}`,"aria-labelledby":a,checked:r,className:"checkbox-input",disabled:o,name:l,onChange:i,type:"checkbox",value:c}),(0,_.jsx)("span",{className:S()("checkbox-control",{"checkbox-control-checked":r,"checkbox-control-disabled":o,"checkbox-control-with-icon-checked":u&&r,"checkbox-control-with-icon-disabled":u&&o}),children:u&&(0,_.jsx)(A,{className:S()("checkbox-control-icon",{"checkbox-control-icon-inactive":!r}),name:_e})}),s&&(0,_.jsxs)("div",{className:"checkbox-label-wrapper",children:[h&&(0,_.jsx)("img",{alt:h,className:"checkbox-label-flag",src:Ct(h,p)}),(0,_.jsx)(wn,{className:S()("checkbox-label",{"checkbox-label-disabled":o,[null!==(n=d.label)&&void 0!==n?n:""]:d.label}),labelID:a,text:s})]})]})}function Cn(e){let{choiceAnimation:t,handleOptionClick:n,index:r,isMultiple:i,isLast:o,isSuggestion:s,visible:a,leftAligned:l,a11yTranslation:c,linkTarget:u,option:d,isInpage:h,selectedOptions:f,onAnimationEnd:m}=e;const g=t===G.SCALE,v=g?.5:.35,y=s?v+.15:v,b=f.includes(d.id);return(0,_.jsxs)("div",{className:S()("choice-array-item-wrapper",{"choice-array-item-wrapper-multiple":i,"choice-array-item-wrapper-multiple-expanded":i&&b,"left-aligned":l}),children:[(0,_.jsx)("div",{"aria-hidden":"true",className:S()("choice-array-item-selected-check",{"choice-array-item-selected-check-expanded":b&&i}),children:(0,_.jsx)(A,{className:"choice-array-item-selected-check-icon",name:Fe})}),(0,_.jsxs)(Et,p(p({dataSettings:"answer-bg",className:S()("choice-array-item",{"choice-array-item-fade-from-bottom":t===G.APPEAR,"choice-array-item-fade-in":t===G.FADEIN,"choice-array-item-scale":g,"choice-array-item-left-aligned":g&&l,"choice-array-item-selected":b,"choice-array-item-hide":s&&!a,"choice-array-item-padding":h,"choice-array-item-padding-expanded":h&&b,"choice-array-item-padding-multiple":!h&&i,"choice-array-item-padding-multiple-expanded":!h&&i&&b}),onAnimationEnd:()=>{o&&m&&m()},onClick:n(d.id),style:{animationDelay:`${y+.085*r}s`}},i?{"aria-pressed":b}:{}),{},{children:[(0,_.jsx)("span",{"aria-hidden":"false","data-settings":"answer-bg-text",dangerouslySetInnerHTML:{__html:`${d.title}`+(u?`${c}`:"")}}),u&&(0,_.jsx)(A,{className:"choice-array-item-icon",name:Le,decorative:!0})]}),d.id)]})}function kn(e){let{ariaLabeledBy:t,onChange:n,options:r,selectedOptions:i,choiceAnimation:o=G.FADEIN,className:s,disabled:a=!1,leftAligned:l=!1,isMultiple:c=!1,isSmall:u=!1,isSuggestion:d=!1,isTrigger:h=!1,isValid:f,onAnimationEnd:m,isInpage:g=!1,validationID:v,visible:y=!0,disableAutofocus:b=!1}=e;const w=(0,C.useRef)(null),x=e=>()=>{if(a)return;const t=i.includes(e)?i.filter((t=>t!==e)):[...c?[...i,e]:[e]];n(t)};return(0,C.useEffect)((()=>{var e;w.current&&(null===(e=w.current)||void 0===e||null===(e=e.firstChild)||void 0===e?void 0:e.querySelector("button"))&&!b&&("boolean"!=typeof f||f||setTimeout((()=>{var e;null===(e=w.current)||void 0===e||null===(e=e.firstChild)||void 0===e||null===(e=e.querySelector("button"))||void 0===e||e.focus()}),500))}),[f,b]),(0,C.useEffect)((()=>{var e;w.current&&(null===(e=w.current)||void 0===e||null===(e=e.firstChild)||void 0===e?void 0:e.querySelector("button"))&&!b&&setTimeout((()=>{var e;null===(e=w.current)||void 0===e||null===(e=e.firstChild)||void 0===e||null===(e=e.querySelector("button"))||void 0===e||e.focus()}),500)}),[b]),(0,C.useEffect)((()=>{y&&h&&w.current&&(w.current.style.height="unset")}),[y,h]),(0,_.jsx)(j,p(p({"aria-describedby":v},void 0!==f?{"aria-invalid":!f}:{}),{},{"aria-labelledby":t,className:S()("choice-array",s,{"choice-array-trigger":h,"choice-array-trigger-small":h&&u,"choice-array-trigger-left-aligned":h&&l,"choice-array-trigger-hidden":h&&!y,"choice-array-suggestion":d,"choice-array-suggestion-show":d&&y,"choice-array-suggestion-hide":d&&!y,"choice-array-multiple":c}),onAnimationEnd:e=>{h&&(null==w?void 0:w.current)&&"fadeout"===e.animationName&&(w.current.style.height="0px")},ref:w,role:"group",children:r.map(((e,t,n)=>(0,_.jsx)(Cn,{a11yTranslation:e.a11yTranslation,choiceAnimation:h?G.SCALE:o,handleOptionClick:x,index:t,isInpage:g,isLast:t===n.length-1,isMultiple:c,isSuggestion:d,leftAligned:l,linkTarget:e.linkTarget,onAnimationEnd:m,option:e,selectedOptions:i,visible:y},e.id)))}))}function Sn(e){let{containerId:t,imageAlt:n,imageUrl:r,closeIconAlt:i,sizePercent:o,leftAligned:s=!1,onActivate:a,handleClose:l,visible:c=!0}=e;const u=(0,C.useRef)(null),d=mn(o,on,sn),h=mn(o,an,ln),p=(0,C.useCallback)((()=>{l&&l()}),[l]),f=(0,C.useCallback)((()=>{a()}),[a]);return(0,C.useEffect)((()=>{c&&u.current&&(u.current.style.height="unset")}),[c]),(0,_.jsxs)("div",{className:S()("image-trigger",{"left-aligned":s,hidden:!c}),id:t,onAnimationEnd:e=>{"fadeout"===e.animationName&&(null==u?void 0:u.current)&&(u.current.style.height="0px")},ref:u,children:[(0,_.jsx)("div",{className:"image-wrapper",onClick:f,role:"button",style:{width:d,maxWidth:d,minWidth:d},children:r&&(0,_.jsx)("img",{alt:n,className:"image",src:r,style:{height:h}})}),(0,_.jsx)("button",{className:"close-icon",onClick:p,children:(0,_.jsx)(A,{alt:i,name:Ce})})]})}function On(e){let{dropdownTitle:t,dropFilesPlaceholder:n,files:r,handleClose:i,handleDeleteFile:o,handleUploadFiles:s,deleteAlt:a,imageAlt:l,fileAlt:c,uploadAlt:u,disabled:d=!1}=e;return(0,_.jsxs)("div",{className:"dropdown-modal-wrapper",role:"dialog",children:[(0,_.jsx)("div",{className:"dropdown-outside-wrapper",onClick:i}),(0,_.jsxs)("div",{className:S()("dropdown-list-wrapper","dropdown-list-wrapper-entrance"),children:[(0,_.jsxs)("div",{className:"livechat-answer-content-header",onClick:i,children:[(0,_.jsx)(ve,{className:"livechat-answer-content-header-title",children:t}),(0,_.jsx)(A,{className:"invert-vert",name:ze,decorative:!0})]}),(0,_.jsx)("div",{className:"livechat-answer-content",children:(0,_.jsx)(Je,{deleteAlt:a,disabled:d,disableEvents:!1,fileAlt:c,files:r,imageAlt:l,onDeleteFile:o,title:n,uploadAlt:u,uploadFiles:s})})]})]})}function jn(e){let{disabled:t=!1,files:n,handleClose:r,onUploadFiles:i,handleDeleteFile:o,disableEvents:s,dropdownTitle:a,dropFilesPlaceholder:l,portalTarget:c,deleteAlt:u,imageAlt:d,fileAlt:h,uploadAlt:p}=e;return(0,D.createPortal)((0,_.jsx)(On,{deleteAlt:u,disabled:t,disableEvents:s,dropdownTitle:a,dropFilesPlaceholder:l,fileAlt:h,files:n,handleClose:r,handleDeleteFile:o,handleUploadFiles:i,imageAlt:d,uploadAlt:p}),c)}function Pn(e){let{attachmentIconAlt:t,disabled:n=!1,disableEvents:r=!1,dropdownTitle:i,dropFilesPlaceholder:o,exitIconAlt:s,files:a,maxLength:l,message:c,onDeleteFile:u,onExit:d,onMessageChange:h,onSubmit:p,onTyping:f,onUploadFiles:m,placeholder:g,portalTarget:v,showExit:y=!1,submitIconAlt:b,deleteAlt:w,imageAlt:x,fileAlt:k,uploadAlt:O,validationID:E}=e;const[T,I]=(0,C.useState)(!1);return(0,_.jsxs)(j,{className:"livechat-answer",children:[(0,_.jsx)(mt,{disabled:n,id:"lc-textfield",maxLength:l,onChange:h,onSubmit:p,onTyping:f,placeholder:g,rows:3,validationID:E,value:c,autoFocus:!0,isMultiline:!0,submitOnEnter:!0}),(0,_.jsxs)("div",{className:"livechat-answer-actions",children:[(0,_.jsxs)(Et,{"aria-expanded":Boolean(T&&v),"aria-haspopup":"dialog",className:S()("livechat-answer-actions-btn","livechat-answer-actions-add-attachment",{"livechat-answer-actions-btn-disabled":r||n}),disabled:r||n,onClick:()=>{r||I((e=>!e))},role:"combobox",children:[(0,_.jsx)(A,{alt:t,name:qe}),Boolean(a.length)&&(0,_.jsx)("span",{className:S()("attachment-counter",{"attachment-counter-disabled":r}),children:r?(0,_.jsx)(P,{className:"attachment-counter-loading",value:50}):(0,_.jsx)(ve,{className:"attachment-counter-title",children:a.filter((e=>!e.error)).length})})]}),y&&(0,_.jsx)(Et,{className:S()("livechat-answer-actions-btn",{"livechat-answer-actions-btn-disabled":r||n}),disabled:r||n,onClick:d,children:(0,_.jsx)(A,{alt:s,name:De})}),(0,_.jsx)(Et,{className:S()("livechat-answer-actions-btn","livechat-answer-actions-submit",{"livechat-answer-actions-btn-disabled":r||n}),disabled:r||n,onClick:p,children:(0,_.jsx)(A,{alt:b,name:Ne})})]}),T&&v&&(0,_.jsx)(jn,{deleteAlt:w,disabled:n,disableEvents:r,dropdownTitle:i,dropFilesPlaceholder:o,fileAlt:k,files:a,handleClose:()=>I(!1),handleDeleteFile:u,imageAlt:x,onUploadFiles:m,portalTarget:v,uploadAlt:O})]})}function En(e){let{buttonText:t,imgUrl:n,onButtonClick:r,onClick:i,error:o,imageAlt:s=""}=e;const[a,l]=(0,C.useState)(!0);return(0,_.jsx)("div",{className:"attachment-image",children:o?(0,_.jsx)(ve,{ariaLive:"assertive",className:"attachment-item-info-error",id:"upload-error",variant:"subtitle2",children:null==o?void 0:o.message}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"attachment-image-picture-container",onClick:i,children:[(0,_.jsx)("img",{alt:s,className:"attachment-image-picture",onLoad:()=>l(!1),src:n}),a&&(0,_.jsx)(P,{value:70})]}),(0,_.jsx)("div",{className:"attachment-image-buttons",children:(0,_.jsxs)("button",{className:"attachment-image-button",onClick:r,children:[t,(0,_.jsx)(A,{className:"attachment-image-button-icon",name:ke,decorative:!0})]})})]})})}function Tn(e){let{actionButtonText:t,closeButtonText:n,onActionClick:r,onCloseClick:i,imageAlt:o,imageUrl:s,isShow:a=!1}=e;const[l,c]=(0,C.useState)(!0);return a?(0,_.jsxs)("div",{className:"attachment-image-preview",children:[(0,_.jsxs)("div",{className:"attachment-image-preview-header",children:[(0,_.jsxs)("button",{className:"attachment-image-preview-button attachment-image-preview-close-button",onClick:function(){c(!0),i()},children:[(0,_.jsx)(A,{className:"attachment-image-preview-button-icon",name:we,decorative:!0}),(0,_.jsx)(ve,{className:"attachment-image-preview-button-text",children:n})]}),(0,_.jsxs)("button",{className:"attachment-image-preview-button",onClick:r,children:[(0,_.jsx)(ve,{className:"attachment-image-preview-button-text",children:t}),(0,_.jsx)(A,{className:"attachment-image-preview-button-icon",name:ke,decorative:!0})]})]}),(0,_.jsxs)("div",{className:"attachment-image-preview-image-container",children:[(0,_.jsx)("img",{alt:o,className:"attachment-image-preview-image",onLoadStart:()=>c(!0),onLoad:()=>c(!1),src:s}),l&&(0,_.jsx)("div",{className:"attachment-image-preview-loader-container",children:(0,_.jsx)(P,{value:70})})]})]}):null}const In=e=>{switch(e){case Z.SENT:return Ue;case Z.SENDING:return $e;case Z.RECEIVED:case Z.READ:return"check-all";case Z.ERROR:return"ld-error";default:return $e}};function Nn(e){let{time:t,status:n}=e;return(0,_.jsxs)(j,{className:"message-info",display:"flex",children:[(0,_.jsx)("time",{className:"message-info-time",dateTime:t,children:t}),n&&(0,_.jsx)(A,{className:S()({"message-info-icon-read":n===Z.READ,"message-info-icon-error":n===Z.ERROR}),name:In(n),decorative:!0})]})}function An(e){const t=(0,C.useRef)(e);return(0,C.useEffect)((()=>{t.current=e})),(0,C.useCallback)((function(){return t.current(...arguments)}),[])}function Ln(e,t){return e-t}function Dn(e,t,n){return Math.min(Math.max(t,e),n)}function Rn(e,t){var n;const r=(null!=e?e:[]).reduce(((e,n,r)=>{const i=Math.abs(t-n);return null===e||i{const t=Mn(e.value,o,i);return Wn[s].offset(t)}),[s,o,i]),d=(0,C.useCallback)((e=>a?e.value>=l[0]&&e.value<=l[l.length-1]:e.value===l[0]),[a,l]),h=(0,C.useCallback)((e=>{const t=c?Bn(e.value,c):e.value.toString();return`${n}${t}${r}`}),[c,n,r]);return(0,_.jsx)(C.Fragment,{children:t.map(((e,t)=>(0,_.jsxs)(C.Fragment,{children:[(0,_.jsx)("span",{className:S()("slider-mark"),"data-index":t,style:u(e)}),null!==e.label?(0,_.jsx)("span",{className:S()("slider-mark-label",{"slider-mark-label-active":d(e)}),"data-index":t,style:u(e),"aria-hidden":!0,"data-settings":"visual-slider-mark-label",children:h(e)}):null]},e.value)))})}function Vn(e){let{value:t,locale:n,suffix:r="",prefix:i=""}=e;const o=n?Bn(t,n):t.toString();return(0,_.jsx)("span",{className:"slider-thumb-label","data-settings":"visual-slider-thumb-label",children:(0,_.jsx)("span",{className:"slider-thumb-label-value","data-settings":"visual-slider-thumb-label-text",children:`${i}${o}${r}`})})}function Hn(e){let{value:t,max:n,min:r,index:i,orientation:o,disabled:s,suffix:a,prefix:l,showThumbLabel:c,locale:u,handleKeyDown:d}=e;const h=Mn(t,r,n),p=Wn[o].offset(h);return(0,_.jsx)("span",{"aria-orientation":o,"aria-valuemax":n,"aria-valuemin":r,"aria-valuenow":t,className:"slider-thumb","data-index":i,onKeyDown:d,role:"slider",style:p,tabIndex:s?void 0:0,"data-settings":"visual-slider-thumb",children:c&&(0,_.jsx)(Vn,{prefix:l,suffix:a,value:t,locale:u})})}const Wn={horizontal:{offset:e=>({left:`${e}%`}),calculateSize:e=>({width:`${e}%`})},vertical:{offset:e=>({bottom:`${e}%`}),calculateSize:e=>({height:`${e}%`})}};function Gn(e){let{value:t,onChange:n,disabled:r=!1,marks:i=[],max:o=0,min:s=1,suffix:a,prefix:l,orientation:c="horizontal",step:u,heat:d=!1,showThumbLabel:h=!1,locale:f}=e;const m=(0,C.useRef)(void 0),g=(0,C.useRef)(null),v=Array.isArray(t),y=(0,C.useMemo)((()=>(v?t.slice().sort(Ln):[t]).map((e=>Dn(e,s,o)))),[v,o,s,t]),b=(0,C.useCallback)((e=>{r||n(e)}),[r,n]),w=e=>{const n=Number(e.currentTarget.getAttribute("data-index")),r=y[n],a=i.map((e=>e.value)),l=a.indexOf(r);let c;switch(e.key){case"ArrowRight":case"ArrowUp":c=u?r+u:a[l+1]||a[a.length-1];break;case"ArrowLeft":case"ArrowDown":c=u?r-u:a[l-1]||a[0];break;default:return}if(e.preventDefault(),u&&(c=$n(c,u,s)),c=Dn(c,s,o),v){const e=c;c=qn(y,t,c,n).sort(Ln),Fn({sliderRef:g,activeIndex:c.indexOf(e)})}b(c)},x=(0,C.useRef)(void 0),k=(0,C.useCallback)((e=>{var t,n,r,a,l;let{finger:d,move:h=!1,values:p,source:f}=e;const m=null===(t=g.current)||void 0===t?void 0:t.getBoundingClientRect(),y=null!==(n=null==m?void 0:m.width)&&void 0!==n?n:0,b=null!==(r=null==m?void 0:m.height)&&void 0!==r?r:0,_=null!==(a=null==m?void 0:m.bottom)&&void 0!==a?a:0,w=null!==(l=null==m?void 0:m.left)&&void 0!==l?l:0;let C,k;if(C=0===c.indexOf("vertical")?(_-d.y)/b:(d.x-w)/y,k=function(e,t,n){return(n-t)*e+t}(C,s,o),u)k=$n(k,u,s);else{const e=i.map((e=>e.value));k=e[Rn(e,k)]}k=Dn(k,s,o);let S=0;if(v){var O;S=h?null!==(O=x.current)&&void 0!==O?O:-1:Rn(p,k);const e=k;k=qn(p,f,k,S).sort(Ln),S=k.indexOf(e),x.current=S}return{newValue:k,activeIndex:S}}),[v]),O=An((e=>{const n=Un(e,m);if(!n)return;const{newValue:r,activeIndex:i}=k({finger:n,move:!0,values:y,source:t});Fn({sliderRef:g,activeIndex:i}),b(r)})),j=An((e=>{if(!Un(e,m))return;m.current=void 0;const t=g.current&&g.current.ownerDocument||document;t.removeEventListener("mousemove",O),t.removeEventListener("mouseup",j),t.removeEventListener("touchmove",O),t.removeEventListener("touchend",j)})),P=An((e=>{e.preventDefault();const n=e.changedTouches[0];null!==n&&(m.current=n.identifier);const r=Un(e,m);if(!r)return;const{newValue:i,activeIndex:o}=k({finger:r,values:y,source:t});Fn({sliderRef:g,activeIndex:o}),b(i);const s=g.current&&g.current.ownerDocument||document;s.addEventListener("touchmove",O),s.addEventListener("touchend",j)}));(0,C.useEffect)((()=>{const e=g.current;null==e||e.addEventListener("touchstart",P);const t=g.current&&g.current.ownerDocument||document;return()=>{null!=e&&e.removeEventListener("touchstart",P),t.removeEventListener("mousemove",O),t.removeEventListener("mouseup",j),t.removeEventListener("touchmove",O),t.removeEventListener("touchend",j)}}),[j,O,P]);const E=Mn(v?y[0]:s,s,o),T=Mn(y[y.length-1],s,o)-E,I=p(p({},Wn[c].offset(E)),Wn[c].calculateSize(T)),N=i.length>0&&i.some((e=>e.label));return(0,_.jsxs)("span",{className:S()("slider",{"slider-vertical":"vertical"===c,"slider-marked":N,"slider-disabled":r}),onMouseDown:e=>{e.preventDefault();const n=Un(e,m);if(!n)return;const{newValue:r,activeIndex:i}=k({finger:n,values:y,source:t});Fn({sliderRef:g,activeIndex:i}),b(r);const o=g.current&&g.current.ownerDocument||document;o.addEventListener("mousemove",O),o.addEventListener("mouseup",j)},ref:g,"data-settings":"visual-slider-line",children:[(0,_.jsx)("span",{className:S()("slider-rail",{"slider-rail-heat":d})}),(0,_.jsx)("span",{className:"slider-track",style:I}),(0,_.jsx)("input",{type:"hidden",value:y.join(",")}),(0,_.jsx)(zn,{marks:i,prefix:l,suffix:a,max:o,min:s,orientation:c,range:v,sliderValues:y,locale:f}),y.map(((e,t)=>(0,_.jsx)(Hn,{disabled:r,handleKeyDown:w,index:t,max:o,min:s,orientation:c,prefix:l,showThumbLabel:h,suffix:a,value:e,locale:f},t)))]})}function Qn(e){let{value:t,onChange:n,min:r,max:i,step:o,suffix:s,prefix:a}=e;const[l,c]=(0,C.useState)(t);(0,C.useEffect)((()=>{c(t)}),[t]);const u=(e,t)=>{const n=parseInt(e.replace(/[^0-9]/g,"")||"0"),r=[...l];r[t]=n,c(r)},d=()=>{const e=l.map((e=>$n(e,null!=o?o:1,r))).map((e=>e>i?i:eu(e,0),value:l[0].toString()}),s&&(0,_.jsx)("span",{className:"multi-range-control-item-suffix",children:s})]}),(0,_.jsxs)("div",{className:"multi-range-control-item",children:[a&&(0,_.jsx)("span",{className:"multi-range-control-item-prefix",children:a}),(0,_.jsx)(mt,{onBlur:d,onChange:e=>u(e,1),value:l[1].toString()}),s&&(0,_.jsx)("span",{className:"multi-range-control-item-suffix",children:s})]})]})}function Kn(e){let{value:t,onChange:n,min:r,max:i,step:o,suffix:s,prefix:a,disabled:l,orientation:c="horizontal",className:u,controlled:d=!1,locale:h}=e;const p=[{value:r,label:`${r}`},{value:i,label:`${i}`}];return(0,_.jsxs)("div",{className:S()("multi-range",u,{"multi-range-controlled":d}),children:[(0,_.jsx)(Gn,{marks:d?[]:p,max:i,min:r,onChange:n,orientation:c,prefix:a,disabled:l,showThumbLabel:!d,step:o,suffix:s,value:t,locale:h}),d&&(0,_.jsx)(Qn,{max:i,min:r,onChange:n,prefix:a,step:o,suffix:s,value:t})]})}function Yn(e){let{optionRefs:t,option:n,index:r,baseUrl:i,countryCode:o,optionIndexDelta:s,handleSelect:a}=e;const[l,c]=vt();return(0,_.jsxs)("button",{"aria-pressed":o===n.code,className:S()("dropdown-option-list-item",{"dropdown-option-list-item-selected":o===n.code,"dropdown-option-list-item-hidden":!c}),onClick:()=>a(n.code),ref:e=>{l(e),t[r+s]=e},role:"option",children:[(0,_.jsx)("img",{alt:n.code,"aria-label":`${n.title} flag icon`,className:"dropdown-option-list-item-flag",src:Ct(n.code,i)}),(0,_.jsx)(ve,{className:"dropdown-option-list-item-title",children:`${n.title} +${n.telCode}`})]},n.code)}function Jn(e){let{options:t,countryCode:n,handleClose:r,handleSelect:i,hideClose:o=!1,winDocument:s,searchLabel:a="Search",closeIconAlt:l,baseUrl:c}=e;const[u,d]=(0,C.useState)(""),h=(0,C.useRef)({}),p=(0,C.useMemo)((()=>(h.current={},t.filter((e=>e.title.toLowerCase().includes(u.toLowerCase()))))),[t,u]),[f,m,g]=dt(h,p,r,!1,o,s);return(0,_.jsxs)("div",{className:"dropdown-option-list",children:[(0,_.jsxs)("div",{className:"dropdown-option-list-header",children:[(0,_.jsx)(mt,{ariaLabel:a,autoFocus:0===f,onChange:e=>{d(e)},onFocus:()=>{m(0)},placeholder:a,startIcon:Ee,value:u,fullWidth:!0}),!o&&(0,_.jsx)("button",{className:"icon-wrapper",onClick:r,ref:e=>{h.current[1]=e},children:(0,_.jsx)(A,{alt:l,name:Ce})})]}),(0,_.jsxs)(M,{"aria-multiselectable":!1,className:"dropdown-option-list-scroll",id:"options-listbox",role:"listbox",tabIndex:-1,children:[!p.length&&(0,_.jsx)("button",{className:"dropdown-option-list-item",ref:e=>{h.current[g]=e},children:(0,_.jsx)(ve,{className:"dropdown-option-list-item-no-data",component:"span",variant:"subtitle1",children:"Options not found"})}),p.map(((e,t)=>(0,_.jsx)(Yn,{baseUrl:c,countryCode:n,handleSelect:i,index:t,option:e,optionIndexDelta:g,optionRefs:h.current},`${e}-${t}`)))]})]})}function Zn(e){let{options:t,countryCode:n,handleSelect:r,handleClose:i,portalTarget:o,winDocument:s,searchLabel:a,closeIconAlt:l,baseUrl:c}=e;return(0,D.createPortal)((0,_.jsxs)("div",{className:"dropdown-modal-wrapper",role:"dialog",children:[(0,_.jsx)("div",{className:"dropdown-outside-wrapper",onClick:i}),(0,_.jsx)("div",{className:S()("dropdown-list-wrapper","dropdown-list-wrapper-entrance"),children:(0,_.jsx)(Jn,{baseUrl:c,closeIconAlt:l,countryCode:n,handleClose:i,handleSelect:r,options:t,searchLabel:a,winDocument:s})})]}),o)}function Xn(e){let{options:t,countryCode:n,handleSelect:r,handleClose:i,renderPopper:o,searchLabel:s,winDocument:a,dropdownRef:l,baseUrl:c}=e;const u=(0,C.useRef)(null);return(0,C.useEffect)((()=>{function e(e){var t,n;const r=(null==u?void 0:u.current)&&!(null!=u&&null!==(t=u.current)&&void 0!==t&&t.contains(e.target)),o=(null==l?void 0:l.current)&&!(null!==(n=l.current)&&void 0!==n&&n.contains(e.target));e.target&&r&&o&&i()}return(a||document).addEventListener("mousedown",e),()=>{(a||document).removeEventListener("mousedown",e)}}),[u,l,i]),(0,_.jsx)("div",{className:S()("dropdown-popper-wrapper",{"dropdown-popper-wrapper-bottom":"bottom"===o.anchor,"dropdown-popper-wrapper-center":"center"===o.anchor,"dropdown-popper-wrapper-bottom-block":"bottom"===o.anchor&&Boolean(o.block)}),ref:u,role:"dialog",children:(0,_.jsx)(Jn,{baseUrl:c,countryCode:n,handleClose:i,handleSelect:r,options:t,searchLabel:s,winDocument:a,hideClose:!0})})}const er=(0,C.forwardRef)((function(e,t){var n,r;let{value:i,label:o,placeholder:s,closeIconAlt:a,setExternalRef:l,onChange:c,onBlur:u,onEnterPress:d,onSubmit:h,helperText:p,helperTextPosition:f="static",maxLength:m,ariaLabel:g,id:v=null,portalTarget:y,countriesOptions:b,fullWidth:w=!1,autoFocus:x=!1,error:k=!1,disabled:O=!1,searchLabel:j,required:P=!1,renderPopper:E,winDocument:T,submitOnEnter:I=!1,baseUrl:N,dataSettings:L={input:"bot-textfield-input",label:"bot-textfield-label"}}=e;const D=(0,C.useRef)(null),R=(0,C.useMemo)((()=>v||`input-${Math.floor(9999*Math.random())}`),[v]),M=(0,C.useRef)(null),[$,U]=(0,C.useState)(!1),F=o?o+(P?"*":""):o,q=null!==(n=null===(r=b.find((e=>e.code===i.countryCode)))||void 0===r?void 0:r.telCode)&&void 0!==n?n:"",B=(0,C.useMemo)((()=>{var e,t;if(m)return m-((null!==(e=null===(t=i.countryCode)||void 0===t?void 0:t.length)&&void 0!==e?e:0)+1)}),[m,i.countryCode]),z=e=>{c(e,i.phoneNumber),V()},V=()=>{var e;null!==(e=M.current)&&void 0!==e&&e.focus(),U(!1)};return(0,C.useEffect)((()=>{l&&(null==M?void 0:M.current)&&l(M.current)}),[M.current]),(0,C.useEffect)((()=>{var e;x&&(null===(e=M.current)||void 0===e||e.focus())}),[x]),(0,_.jsxs)("div",{className:"phone-textfield-wrapper",children:[o&&(0,_.jsx)("label",{className:S()("phone-textfield-label",{"phone-textfield-label-error":k}),"data-settings":L.label,htmlFor:R,children:F}),(0,_.jsxs)("div",{className:S()("phone-textfield",{"phone-textfield-full-width":w}),ref:t,children:[(0,_.jsxs)("div",{className:S()("phone-textfield-input-wrapper",{"phone-textfield-input-wrapper-error":k}),"data-settings":L.input,children:[(0,_.jsxs)("button",{"aria-autocomplete":"none","aria-controls":"options-listbox","aria-expanded":$,"aria-haspopup":"dialog","aria-label":`${null!=g?g:""} (${q})`,"aria-required":P,className:"phone-textfield-select-country",onClick:()=>{U((e=>!e))},ref:M,role:"combobox",type:"button",children:[(0,_.jsx)("img",{alt:i.countryCode,className:"phone-textfield-select-country-icon",src:Ct(i.countryCode,N)}),(0,_.jsx)(ve,{className:"phone-textfield-country-code",component:"span",children:`+${q}`}),(0,_.jsx)(A,{className:S()({"invert-vert":$}),name:ze,decorative:!0})]}),(0,_.jsx)("input",{"aria-label":o?void 0:g,autoComplete:"tel",className:S()("phone-textfield-input",{"phone-textfield-input-error":k}),id:R,maxLength:B,name:R,onBlur:u,onChange:e=>{const t=e.target.value.replace(/[^0-9]/g,"");c(i.countryCode,t)},onKeyDown:e=>{const t=e.key===ht||e.code===ht||e.keyCode===pt;e.shiftKey||e.ctrlKey||!t||(e.preventDefault(),e.stopPropagation(),I&&h&&(O||(e.stopPropagation(),h&&h(`+${q}${i}`),U(!1))),d&&d())},placeholder:s,ref:D,type:"tel",value:i.phoneNumber}),(0,_.jsx)("div",{className:"phone-textfield-outline"})]}),"string"==typeof p?(0,_.jsx)(ut,{error:k,helperText:p,helperTextPosition:f}):p,y&&!E&&$&&(0,_.jsx)(Zn,{baseUrl:N,closeIconAlt:a,countryCode:i.countryCode,handleClose:V,handleSelect:z,options:b,portalTarget:y,searchLabel:j,winDocument:T}),!!E&&$&&(0,_.jsx)(Xn,{baseUrl:N,countryCode:i.countryCode,dropdownRef:M,handleClose:V,handleSelect:z,options:b,renderPopper:E,searchLabel:j,winDocument:T})]})]})}));function tr(e){let{options:t,selectedOption:n,onSelect:r,direction:i="horizontal",className:o}=e;const s=e=>{const t=e.currentTarget.value;r(t)};return(0,_.jsx)(j,{className:S()("point-range",o,{"point-range-vertical":"vertical"===i}),children:t.map(((e,t)=>(0,_.jsxs)("div",{className:"point-range-option",children:[(0,_.jsx)(xn,{checked:n===e,onChange:s,value:e,withCheckMark:!0}),(0,_.jsx)(ve,{className:"point-range-option-title",variant:"h4",children:e})]},`${e}-${t}`)))})}function nr(e){let{avatarAlt:t,botIcon:n,closeDelay:r,description:i,showMessage:o,opened:s,sizePercent:a,leftAligned:l=!1,visibilityCb:c,onClick:u,title:d}=e;const[h,p]=(0,C.useState)(!1),[f,m]=(0,C.useState)(!1),g=(0,C.useCallback)((()=>{setTimeout((()=>{m(!0)}),r)}),[r]),v=(0,C.useCallback)((e=>{"expand"===e.animationName&&r&&g()}),[r,g]);return(0,C.useEffect)((()=>{const{matches:e}=window.matchMedia("(prefers-reduced-motion: reduce)");r&&e&&g()}),[r,g]),(0,C.useEffect)((()=>{o&&(p(!0),m(!1))}),[o]),(0,C.useEffect)((()=>{s&&!f&&m(!0),c&&c(!f)}),[s,c,f]),(0,_.jsx)("div",{className:S()("temporary-message",{"close-anim":f&&h,hidden:!h,"left-aligned":l}),onAnimationEnd:v,onClick:u,children:(0,_.jsxs)("div",{className:"content-wrapper",children:[n&&(0,_.jsx)(O,{alt:t,className:S()("bot-icon",{"left-aligned":l}),src:n}),(0,_.jsxs)("div",{className:S()("text-container",{small:a<50,"left-aligned":l}),children:[(0,_.jsx)("div",{className:S()("title","no-select",{"no-wrap":i,small:a<50}),dangerouslySetInnerHTML:{__html:null!=d?d:""}}),i&&(0,_.jsx)("div",{className:S()("description","no-select","no-wrap",{small:a<50}),dangerouslySetInnerHTML:{__html:null!=i?i:""}})]})]})})}function rr(e){let{avatarAlt:t,botIcon:n,containerId:r,description:i,handleClose:o,handleOpen:s,title:a,sizePercent:l,closeIconAlt:c,leftAligned:u,visible:d}=e;const h=(0,C.useRef)(null),p=mn(l,fn,pn);return(0,C.useEffect)((()=>{d&&h.current&&(h.current.style.height="unset")}),[d]),(0,_.jsx)("div",{className:S()("text-bubble-trigger",[{"text-bubble-trigger-left":u,hidden:!d}]),id:r,onAnimationEnd:e=>{"fadeout"===e.animationName&&(null==h?void 0:h.current)&&(h.current.style.height="0px")},ref:h,style:{width:p},children:(0,_.jsxs)("div",{className:"text-bubble-wrapper",onClick:s,role:"button",children:[(0,_.jsx)("button",{className:S()("text-bubble-close-icon",{"text-bubble-close-icon-left":u}),onClick:e=>{e.stopPropagation(),o()},children:(0,_.jsx)(A,{alt:c,name:Ce})}),(0,_.jsxs)("span",{className:"text-bubble-content",children:[(0,_.jsxs)("span",{className:"text-bubble-header",children:[n&&(0,_.jsx)(O,{alt:t,className:"text-bubble-avatar",src:n}),(0,_.jsx)("span",{className:"text-bubble-title",dangerouslySetInnerHTML:{__html:null!=a?a:""}})]}),i&&(0,_.jsx)("span",{className:"text-bubble-description",dangerouslySetInnerHTML:{__html:null!=i?i:""}})]})]})})}function ir(e){let{isOpen:t,title:n,handleIsOpen:r,triggerImage:i,sizePercent:o,leftAligned:s=!1}=e;const a=mn(o,cn,un),l=mn(o,dn,hn);return(0,_.jsx)("button",{className:S()("text-button-trigger",[{"text-button-trigger-hidden":t,"left-aligned":s}]),onClick:r,style:{width:a,height:l,backgroundImage:i?`url("${i}")`:"unset"},type:"button","data-settings":"text-button-trigger",children:(0,_.jsx)("span",{className:S()("text-button-title",{small:o<50}),dangerouslySetInnerHTML:{__html:null!=n?n:""},"data-settings":"text-button-trigger-text",style:{width:l-4,top:l,height:a,lineHeight:`${a}px`}})})}function or(e){let{containerId:t,description:n,sizePercent:r,handleOpen:i,title:o,leftAligned:s,visible:a,fullWidth:l=!1}=e;const c=(0,C.useRef)(null);return(0,_.jsx)("div",{className:S()("text-message-trigger",{hidden:!a,"left-aligned":s}),id:t,onAnimationEnd:e=>{"fadeout"===e.animationName&&(null==c?void 0:c.current)&&(c.current.style.height="0px")},onClick:i,ref:c,children:(0,_.jsx)("div",{className:"content-wrapper",children:(0,_.jsxs)("div",{className:S()("text-container",{small:r<50,"left-aligned":s,"full-width":l}),children:[(0,_.jsx)("div",{className:S()("title","no-select",{"no-wrap":n,small:r<50}),dangerouslySetInnerHTML:{__html:null!=o?o:""}}),n&&(0,_.jsx)("div",{className:S()("description","no-select","no-wrap",{small:r<50}),dangerouslySetInnerHTML:{__html:null!=n?n:""}})]})})})}function sr(e){let{textRef:t}=e;const[n,r]=(0,C.useState)(0);return(0,C.useEffect)((()=>{if(!t.current)return;const e=t.current.clientHeight;r(e)}),[t]),(0,_.jsx)("div",{style:{minHeight:n},className:"without-overlay"})}function ar(e){return e.split(" ").slice(0,2).join(" ").replace(/,/g,"")}function lr(e){let{checkIconAlt:t,disabled:n,onClick:r,image:i,showOverlay:o,showPartialOverlay:s,subtitle:a,title:l,selected:c,shortText:u=!1,mobile:d,override:h,url:p,urlIconAlt:f,extraClassnames:m}=e;const g=(0,C.useRef)(null),v=(0,C.useMemo)((()=>!1===/\S/.test(l)&&(!a||!1===/\S/.test(a))),[l,a]);return(0,_.jsx)("div",{className:S()("visual-answer-option-container",{override:h,mobile:d}),children:(0,_.jsxs)("button",{"aria-checked":c,disabled:n,className:S()("visual-answer-option",{selected:c,"has-image":i,"image-only":i&&v},m),onClick:e=>{e.preventDefault(),r()},role:"checkbox",children:[o&&(0,_.jsx)("div",{className:"overlay"}),i&&(0,_.jsx)("div",{className:"image-content",children:(0,_.jsx)("div",{className:"answer-img",style:{backgroundImage:`url('${i}')`},children:"Ā "})}),(0,_.jsx)("div",{ref:g,className:"text-content","data-settings":"visual-answer-container",children:l&&(0,_.jsxs)(C.Fragment,{children:[(0,_.jsx)("div",{className:S()("title",{"no-subtitle":!a}),dangerouslySetInnerHTML:{__html:u?ar(l):l},"data-settings":"visual-answer-title"}),a&&(0,_.jsx)("div",{"data-settings":"visual-answer-subtitle",className:"subtitle",dangerouslySetInnerHTML:{__html:u?ar(a):a}})]})}),s&&(0,_.jsx)(sr,{textRef:g}),p&&(0,_.jsx)("div",{className:"check-mark inside url-icon",children:(0,_.jsx)(A,{name:"logout",className:"small",alt:f})}),!p&&(0,_.jsx)("div",{className:S()("check-mark","inside",{hidden:!c}),children:(0,_.jsx)(A,{name:"check-bold",alt:t})})]})})}const cr=e=>{let{label:t,onChange:n,id:r,value:i}=e;return(0,_.jsxs)("label",{className:"consent-label",htmlFor:String(r),children:[(0,_.jsx)("input",{className:"consent-checkbox",type:"checkbox",checked:i,onChange:e=>{n(e.target.checked)},"aria-checked":i,id:String(r)}),t]})},ur=e=>{let{feedbackLabel:t,feedbackPlaceholder:n,value:r,onFeedbackSubmit:i,onValueChange:o,feedbackSendButtonText:s,maxLength:a,error:l,helperText:c,helperTextPosition:u}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ve,{className:"rating-prompt-step-feedback",children:t}),(0,_.jsx)(mt,{classNames:"rating-prompt-step-feedback-field",error:l,helperText:c,helperTextPosition:u,maxLength:a,multilineFieldClassName:"rating-prompt-step-feedback-multiline",onChange:o,placeholder:n,rows:3,value:r,isMultiline:!0}),(0,_.jsx)("div",{className:"rating-prompt-step-feedback-button-wrapper",children:(0,_.jsx)(Et,{className:"rating-prompt-step-feedback-button",endIcon:(0,_.jsx)(A,{className:"rating-prompt-step-feedback-button-icon",name:Ae}),onClick:i,children:s})})]})},dr=e=>{let{ratingValue:t,onRatingChange:n}=e;const[r,i]=(0,C.useState)(0),[o,s]=(0,C.useState)(!1),a=e=>()=>{i(e+1),s(!0)},l=()=>{i(0),s(!1)},c=e=>()=>{n(e+1)};return(0,_.jsx)("div",{className:"rating-stars",children:[...Array(5)].map(((e,n)=>(0,_.jsx)("svg",{className:S()("rating-stars-item",{"rating-stars-item-selected":n{let{header:t,subheader:n,rating:r,onRatingChange:i}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ve,{className:"rate-step-heading",children:t}),(0,_.jsx)(ve,{className:"rate-step-subheading",children:n}),(0,_.jsx)("div",{className:"rate-step-stars-wrapper",children:(0,_.jsx)(dr,{onRatingChange:i,ratingValue:r})})]})},pr=e=>{let{className:t}=e;return(0,_.jsxs)("svg",{className:t,fill:"none",height:"85",viewBox:"0 0 98 85",width:"98",xmlns:"http://www.w3.org/2000/svg",children:[(0,_.jsx)("path",{d:"M79 69.9999C84.8139 71.8666 86.1905 74.2429 86.5 79.9999M25 52.9999C25 52.9999 21.5 57.5 16.5 57.4999M16.5 57.4999C10 56.5 12.5 51 12.5 51C12.5 51 17.5 50.9999 16.5 57.4999ZM16.5 57.4999C12.1461 63.8612 8.42915 64.1145 1 62.4999",stroke:"#295BB8",strokeLinecap:"round"}),(0,_.jsx)("circle",{cx:"48.5",cy:"3",fill:"#1DABAF",r:"3"}),(0,_.jsx)("circle",{cx:"57.5",cy:"80",fill:"#007E9F",r:"1"}),(0,_.jsx)("circle",{cx:"56.5",cy:"8",fill:"#F8A646",r:"2"}),(0,_.jsx)("circle",{cx:"65.5",cy:"83",fill:"#3D779E",r:"2"}),(0,_.jsx)("circle",{cx:"91.5",cy:"40",r:"2.5",stroke:"#F8A646"}),(0,_.jsx)("circle",{cx:"28.5",cy:"74",r:"2.5",stroke:"#FEEDDA"}),(0,_.jsx)("circle",{cx:"21.5",cy:"31",r:"2.5",stroke:"#CEF4E3"}),(0,_.jsx)("path",{d:"M82.5 18C96.5 18 91 4.5 97.5 3",stroke:"#FEEDDA",strokeLinecap:"round"})]})},fr=e=>{let{header:t,subheader:n}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"rating-prompt-step-finish",children:(0,_.jsx)("div",{className:"rating-prompt-step-finish-circle",children:(0,_.jsxs)("div",{className:"rating-prompt-step-finish-circle-bg",children:[(0,_.jsx)(A,{className:"rating-prompt-step-finish-circle-icon",name:Ue}),(0,_.jsx)(pr,{className:"rating-prompt-step-finish-particles"})]})})}),(0,_.jsx)(ve,{className:"rating-prompt-step-finish-text",children:t}),(0,_.jsx)(ve,{className:"rating-prompt-step-finish-subtext",children:n})]})};function mr(e){let{isVisible:t,onChange:n,handleClose:r,rateHeader:i,rateSubheader:o,feedbackPlaceholder:s,feedbackSendButtonText:a,successHeader:l,successSubheader:c,feedbackLabel:u,disableFadeIn:d=!1,className:h,returnText:p,error:f,helperText:m,helperTextPosition:g,maxLength:v}=e;const[y,b]=(0,C.useState)(0),[w,x]=(0,C.useState)(0),[k,O]=(0,C.useState)(""),P=e=>{x(e),b(1),n(e,k)},E=e=>{O(e)},T=()=>{n(w,k).then((()=>{b(2)}))};return(0,_.jsx)(j,{className:S()("rating-prompt",h,{"rating-prompt-show":t,"rating-prompt-hide":!t}),children:(0,_.jsx)("div",{className:"rating-prompt-bg",children:(0,_.jsx)("div",{className:S()("rating-prompt-wrap",{"rating-prompt-wrap-visible":t&&!d,"rating-prompt-wrap-visible-disable":d,"rating-prompt-wrap-hidden":!t}),children:(0,_.jsxs)("div",{className:"rating-prompt-step",children:[(0,_.jsxs)("div",{className:S()("rating-prompt-step-header",{"rating-prompt-step-header-with-back":1===y}),children:[1===y&&(0,_.jsxs)("div",{className:"rating-prompt-step-header-back-wrapper",onClick:()=>{b(0)},children:[(0,_.jsx)(A,{className:"rating-prompt-step-header-back-icon",name:be}),(0,_.jsx)(ve,{className:"rating-prompt-step-header-back-text",children:p})]}),(0,_.jsx)("div",{className:"rating-prompt-step-header-icon-wrapper",onClick:()=>{r(),b(0),x(0),O("")},children:(0,_.jsx)(A,{name:Me})})]}),(()=>{switch(y){case 0:return(0,_.jsx)(hr,{header:i,onRatingChange:P,rating:w,subheader:o});case 1:return(0,_.jsx)(ur,{error:f,feedbackLabel:u,feedbackPlaceholder:s,feedbackSendButtonText:a,helperText:m,helperTextPosition:g,maxLength:v,onFeedbackSubmit:T,onValueChange:E,value:k});case 2:return(0,_.jsx)(fr,{header:l,subheader:c});default:return(0,_.jsx)(_.Fragment,{})}})()]})})})})}var gr;!function(e){e[e.Rating=0]="Rating",e[e.Feedback=1]="Feedback",e[e.Success=2]="Success"}(gr||(gr={}));const vr=e=>{let{currentStep:t,returnText:n,onReturn:r,onClose:i,isLast:o}=e;return(0,_.jsxs)("div",{className:S()("rating-header",{"rating-header-with-back":t===gr.Feedback}),children:[t===gr.Feedback&&(0,_.jsxs)("div",{className:"rating-header-back-wrapper",onClick:r,children:[(0,_.jsx)(A,{className:"rating-header-back-icon",name:be}),(0,_.jsx)(ve,{className:"rating-header-back-text",children:n})]}),t!==gr.Success&&!o&&(0,_.jsx)("div",{className:"rating-header-icon-wrapper",onClick:i,children:(0,_.jsx)(A,{name:Me})})]})},yr=e=>{let{feedbackLabel:t,feedbackPlaceholder:n,value:r,onFeedbackSubmit:i,onValueChange:o,feedbackSendButtonText:s,maxLength:a,error:l,helperText:c,helperTextPosition:u}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ve,{className:"feedback",children:t}),(0,_.jsx)(mt,{classNames:"feedback-field",error:l,helperText:c,helperTextPosition:u,maxLength:a,multilineFieldClassName:"feedback-multiline",onChange:o,placeholder:n,rows:3,value:r,isMultiline:!0}),(0,_.jsx)("div",{className:"feedback-button-wrapper",children:(0,_.jsx)(Et,{className:"feedback-button",endIcon:(0,_.jsx)(A,{className:"feedback-button-icon",name:Ae}),onClick:i,children:s})})]})},br=e=>{let{header:t,subheader:n,rating:r,onRatingChange:i}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ve,{className:"rate-heading",children:t}),(0,_.jsx)(ve,{className:"rate-subheading",children:n}),(0,_.jsx)("div",{className:"rate-stars-wrapper",children:(0,_.jsx)(dr,{onRatingChange:i,ratingValue:r})})]})},_r=e=>{let{className:t}=e;return(0,_.jsxs)("svg",{className:t,fill:"none",height:"85",viewBox:"0 0 98 85",width:"98",xmlns:"http://www.w3.org/2000/svg",children:[(0,_.jsx)("path",{d:"M79 69.9999C84.8139 71.8666 86.1905 74.2429 86.5 79.9999M25 52.9999C25 52.9999 21.5 57.5 16.5 57.4999M16.5 57.4999C10 56.5 12.5 51 12.5 51C12.5 51 17.5 50.9999 16.5 57.4999ZM16.5 57.4999C12.1461 63.8612 8.42915 64.1145 1 62.4999",stroke:"#295BB8",strokeLinecap:"round"}),(0,_.jsx)("circle",{cx:"48.5",cy:"3",fill:"#1DABAF",r:"3"}),(0,_.jsx)("circle",{cx:"57.5",cy:"80",fill:"#007E9F",r:"1"}),(0,_.jsx)("circle",{cx:"56.5",cy:"8",fill:"#F8A646",r:"2"}),(0,_.jsx)("circle",{cx:"65.5",cy:"83",fill:"#3D779E",r:"2"}),(0,_.jsx)("circle",{cx:"91.5",cy:"40",r:"2.5",stroke:"#F8A646"}),(0,_.jsx)("circle",{cx:"28.5",cy:"74",r:"2.5",stroke:"#FEEDDA"}),(0,_.jsx)("circle",{cx:"21.5",cy:"31",r:"2.5",stroke:"#CEF4E3"}),(0,_.jsx)("path",{d:"M82.5 18C96.5 18 91 4.5 97.5 3",stroke:"#FEEDDA",strokeLinecap:"round"})]})},wr=e=>{let{header:t,subheader:n}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"finish",children:(0,_.jsx)("div",{className:"finish-circle",children:(0,_.jsxs)("div",{className:"finish-circle-bg",children:[(0,_.jsx)(A,{className:"finish-circle-icon",name:Ue}),(0,_.jsx)(_r,{className:"finish-particles"})]})})}),(0,_.jsx)(ve,{className:"finish-text",children:t}),(0,_.jsx)(ve,{className:"finish-subtext",children:n})]})},xr=e=>{let{returnText:t,rateHeaderText:n,rateSubheaderText:r,onClose:i,onChange:o,error:s,feedbackLabel:a,feedbackPlaceholder:l,feedbackSendButtonText:c,helperText:u,maxLength:d,successHeader:h,successSubheader:p,isLast:f}=e;const[m,g]=(0,C.useState)(gr.Rating),[v,y]=(0,C.useState)(0),[b,w]=(0,C.useState)(""),[x,k]=(0,C.useState)(!1),O=e=>{y(e),g(gr.Feedback),o(e,b)},j=()=>{o(v,b).then((()=>{g(gr.Success),i()}))},P=e=>{w(e)};return(0,_.jsxs)("div",{className:S()("rating-content",{"rating-content-disabled":x}),children:[(0,_.jsx)(vr,{currentStep:m,returnText:t,onClose:()=>{i(),k(!0)},onReturn:()=>{g(gr.Rating)},isLast:f}),(()=>{switch(m){case gr.Rating:return(0,_.jsx)(br,{header:n,onRatingChange:O,rating:v,subheader:r});case gr.Feedback:return(0,_.jsx)(yr,{error:s,feedbackLabel:a,feedbackPlaceholder:l,feedbackSendButtonText:c,helperText:u,maxLength:d,onFeedbackSubmit:j,onValueChange:P,value:b});case gr.Success:return(0,_.jsx)(wr,{header:h,subheader:p});default:return(0,_.jsx)(_.Fragment,{})}})()]})},Cr=b.jm,kr=b.S,Sr=b.Bg,Or=b.Hg,jr=b.eu,Pr=b.sX,Er=b.Q$,Tr=b.HD,Ir=b.$z,Nr=b.GW,Ar=b.Kr,Lr=b.hX,Dr=b.Vf,Rr=b.WQ,Mr=b.rA,$r=b.vJ,Ur=b.bL,Fr=b.PM,qr=b.P7,Br=b.$n,zr=b.RN,Vr=b.wq,Hr=b.aG,Wr=b.NQ,Gr=b.ni,Qr=b.n0,Kr=b.NO,Yr=b.wP,Jr=b.$p,Zr=b.In,Xr=b.qf,ei=b.NZ,ti=b.fL,ni=b.Xy,ri=b.Rh,ii=b.fg,oi=b.W5,si=b.Cv,ai=b.pE,li=b.kZ,ci=b.i2,ui=b.eE,di=b.qp,hi=b.WA,pi=b.mW,fi=b.Rq,mi=b.Ze,gi=b.xx,vi=b.U9,yi=b.oo,bi=b.fs,_i=b.VK,wi=b.o5,xi=b.uA},8098:(e,t,n)=>{"use strict";n.d(t,{HR:()=>c,hj:()=>o,j1:()=>a,qG:()=>l,qi:()=>s,r0:()=>i});var r=n(5822);function i(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,r.tU)();if(n.aiSessionHistory){var i;const r=null===(i=n.aiSessionHistory.history)||void 0===i?void 0:i.find((t=>t&&t.position===e));r?r.sessionID&&(n.aiSession=r.sessionID):n.aiSessionHistory.history.push({position:e,questionID:t})}}function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,r.tU)();if(n.aiSessionHistory){const r=n.aiSessionHistory.history.findIndex((t=>t&&t.position===e));-1!==r&&(n.aiSessionHistory.history[r].sessionID?n.aiSession=n.aiSessionHistory.history[r].sessionID||null:n.aiSessionHistory.history[r].sessionID=t)}}function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,r.tU)();n.aiSessionHistory&&(n.aiSessionHistory.lastPrompt=t)}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.tU)();return e.aiSessionHistory?e.aiSessionHistory.lastPrompt:null}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,r.tU)();if(t.aiSessionHistory){const n=t.aiSessionHistory.history.findIndex((t=>t&&t.position===e));return!(-1===n||!t.aiSessionHistory.history[n].sessionID)}return!1}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,r.tU)();if(t.aiSessionHistory){const n=t.aiSessionHistory.history.findIndex((t=>t&&t.questionID===e));return-1!==n&&t.aiSessionHistory.history[n].sessionID?t.aiSessionHistory.history[n].sessionID:null}return null}},8241:(e,t,n)=>{"use strict";n.d(t,{Ak:()=>I,Ap:()=>E,De:()=>w,EU:()=>l,Et:()=>T,M0:()=>x,TL:()=>m,UL:()=>W.UL,YK:()=>h,_X:()=>A,ff:()=>S,sw:()=>g,xi:()=>W.xi,zV:()=>c,zm:()=>p,zu:()=>N});var r,i,o,s,a,l,c,u,d,h,p,f,m,g,v,y,b,_,w,x,C,k,S,O,j,P,E,T,I,N,A,L,D,R,M,$,U,F,q,B,z,V,H,W=n(9443);!function(e){e[e.Indefinite=1]="Indefinite",e[e.Schedule=0]="Schedule"}(r||(r={})),function(e){e[e.Auto=0]="Auto",e[e.Manual=1]="Manual"}(i||(i={})),function(e){e[e.Ended=3]="Ended",e[e.Launched=1]="Launched",e[e.Paused=2]="Paused"}(o||(o={})),function(e){e[e.BestConversionRate=0]="BestConversionRate",e[e.BestEngagementRate=1]="BestEngagementRate",e[e.MostLeadConversions=2]="MostLeadConversions"}(s||(s={})),function(e){e.Document="document",e.WebPage="web_page"}(a||(a={})),function(e){e[e.Never=0]="Never",e[e.Immediately=1]="Immediately",e[e.Scroll=2]="Scroll",e[e.Time=3]="Time",e[e.Scroll_time=4]="Scroll_time"}(l||(l={})),function(e){e[e.Fast=3]="Fast",e[e.Medium=2]="Medium",e[e.Slow=1]="Slow"}(c||(c={})),function(e){e[e.Large=3]="Large",e[e.Medium=2]="Medium",e[e.Small=1]="Small"}(u||(u={})),function(e){e[e.Button=1]="Button",e[e.ExitIntent=3]="ExitIntent",e[e.ByPageLoad=2]="ByPageLoad",e[e.Standard=0]="Standard"}(d||(d={})),function(e){e.Auto="auto",e.Chat="chat",e.CTA="cta",e.Dynamic="dynamic",e.Inpage="inpage",e.Platform="platform",e.Visual="visual"}(h||(h={})),function(e){e.Multiple="multiple",e.Single="single"}(p||(p={})),function(e){e[e.Normal=1]="Normal",e[e.Small=2]="Small"}(f||(f={})),function(e){e[e.SimpleIcon=1]="SimpleIcon",e[e.TemporaryMessage=2]="TemporaryMessage",e[e.ImageOrGIF=3]="ImageOrGIF",e[e.TextCTA=6]="TextCTA",e[e.BubbleImage=7]="BubbleImage",e[e.BubbleImageAnswers=8]="BubbleImageAnswers",e[e.MessageAndAnswers=9]="MessageAndAnswers",e[e.IconAndAnswers=10]="IconAndAnswers",e[e.CardAndAnswers=11]="CardAndAnswers",e[e.ImageOrGIFAndAnswers=12]="ImageOrGIFAndAnswers"}(m||(m={})),function(e){e.CheckGroup="checkGroup",e.City="city",e.CompanyName="companyName",e.Country="country",e.Dropdown="dropdown",e.Email="email",e.FirstName="firstName",e.LastName="lastName",e.Location="location",e.Message="other",e.Name="name",e.Phone="phone",e.Postcode="zip",e.RadioGroup="radioGroup"}(g||(g={})),function(e){e[e.Any=0]="Any",e[e.Desktop=1]="Desktop",e[e.Mobile=2]="Mobile"}(v||(v={})),function(e){e.Normal="normal",e.SPA="spa"}(y||(y={})),function(e){e.Page="page",e.Slots="slots"}(b||(b={})),function(e){e[e.ReadValue=1]="ReadValue",e[e.SetValue=2]="SetValue",e[e.AddValue=3]="AddValue"}(_||(_={})),function(e){e[e.Document=3]="Document",e[e.Internal=0]="Internal",e[e.URL=2]="URL",e[e.Window=1]="Window"}(w||(w={})),function(e){e[e.Number=2]="Number",e[e.Text=1]="Text"}(x||(x={})),function(e){e.Free="free"}(C||(C={})),function(e){e.AIServiceError="err/ai/serviceError",e.AIStreamConfigNotFound="err/ai/streaming/configNotFound",e.AnswerInvalidForQuestion="err/answer/payloadInvalidForQuestion",e.AnswerInvalidType="err/answer/invalidType",e.AnswerMissingCategory="err/answer/categoryNotSet",e.AnswerRequired="err/answer/emptyButRequired",e.AssetNotFound="err/asset/notFound",e.AttachmentLeadMismatch="err/attachment/leadIDMismatch",e.AttachmentMediaInvalid="err/attachment/invalidMedia",e.AttachmentUploadNotFound="err/attachment/uploadNotFound",e.BadBotType="err/bot/badType",e.BotCodeInvalid="err/bot/botCodeInvalid",e.BotConfigInvalid="err/bot/configInvalid",e.BotDeleted="err/bot/deleted",e.BotIDMismatch="err/bot/botIDMismatch",e.BotIsTemplate="err/bot/isTemplate",e.BotNotActive="err/bot/notActive",e.BotNotPublished="err/bot/notPublished",e.CalendarServiceError="err/calendar/serviceError",e.CalendarSlotOccupied="err/calendar/slotOccupied",e.CompanyCodeInvalid="err/company/companyCodeInvalid",e.CompanyDeleted="err/company/deleted",e.CompanyIDMismatch="err/company/companyIDMismatch",e.CompanyInactive="err/company/inactive",e.DBResultInvalid="err/db/resultInvalid",e.DisabledByUser="err/feature/disabledByUser",e.DomainInvalid="err/domain/invalid",e.DomainForbidden="err/domain/forbidden",e.DynamicConfigurationInvalid="err/dynamic/invalid",e.DynamicVariableInvalidUserValue="err/dv/invalidUserValue",e.DynamicVariableInvalidValue="err/dv/invalidValue",e.EncryptionServiceError="err/encryption/serviceError",e.ItemNotProvided="err/advNodes/itemNotProvided",e.ItemTypeUnknown="err/advNodes/itemTypeUnknown",e.ItemTypeUnrecognised="err/enum/itemUnrecognised",e.JWTGeneric="err/jwt/generic",e.JWTPayload="err/jwt/payload",e.LeadBotMismatch="err/lead/botIDMismatch",e.LeadCreatePayloadInvalid="err/lead/createPayloadInvalid",e.LeadDataResponseInvalid="err/lead/dataResponseInvalid",e.LeadLabelsResponseInvalid="err/lead/labelsResponseInvalid",e.LeadTokenMissing="err/lead/tokenMissing",e.LeadTokenMismatch="err/lead/tokenMismatch",e.LiveChatRequestFailed="err/livechat/requestFailed",e.LiveChatRequestInvalid="err/livechat/requestInvalid",e.LookupConfigurationInvalid="err/lookup/invalid",e.LookupCSVParse="err/lookup/csvParseError",e.LookupEmptyNoNextPosition="err/lookup/emptyNoNext",e.LookupMappingsInvalid="err/lookup/invalidMappings",e.LookupReservedColumns="err/lookup/reservedColumns",e.LookupRowNotFound="err/lookup/rowNotFound",e.LookupUploadEmpty="err/lookup/emptyUpload",e.MathExpressionFailure="err/advNodes/canNotExecuteExpression",e.MediaPartnerNoResult="err/mediaPartner/noResult",e.PageURLInvalid="err/page/invalidURL",e.ProfileServiceError="err/profile/serviceError",e.PublicAPIKeyEmpty="err/auth/publicAPIKeyEmpty",e.PublicAPIKeyInvalid="err/auth/publicAPIKeyInvalid",e.QuestionNoAttachments="err/question/attachmentsNotSupported",e.QuestionMissingCategory="err/question/categoryNotSet",e.QuestionMissingConfiguration="err/question/configurationIncomplete",e.QuestionInvalidSource="err/question/invalidDBSource",e.QuestionInvalidType="err/question/invalidType",e.RequestPayloadInvalid="err/request/payloadInvalid",e.RequestPayloadTooLarge="err/request/payloadTooLarge",e.ResourceNotFound="err/resource/notFound",e.ResourceSchemaInvalid="err/resource/invalidSchema",e.ResourceRelationshipInvalid="err/resource/relationshipInvalid",e.UploadMissingFields="err/upload/missingFields"}(k||(k={})),function(e){e.AIServiceBusy="error.api.ai.service-busy",e.AIServiceIncorrectPrompt="error.api.ai.service-incorrect-prompt",e.AIServiceTimeout="error.api.ai.service-timeout",e.AIServiceUnavailable="error.api.ai.service-unavailable",e.AIViolatePolicyContent="error.api.ai.violate-policy-content",e.AnswerRequired="error.api.answer-required",e.AttachmentDownloadInvalidJWT="error.api.attachment.download-invalid-jwt",e.BotNodeOwnership="error.api.bot-question-mismatch",e.BotTypeInvalid="error.api.bot-type-invalid",e.CalendarBookingSlots="error.api.calendar.slots",e.CalendarBookingSlotOccupied="error.api.calendar.slot.occupied",e.DomainValidation="error.api.domain.invalid",e.DynamicNodeConfig="error.api.dynamic-node-configuration",e.DynamicVariableInvalidValueInternal="error.api.dv.invalid-value-internal",e.DynamicVariableNumberRequired="error.api.dv.number.required",e.EmailValidation="error.api.email.invalid",e.EncryptionServiceBusy="Encryption service is busy",e.GenericValidation="error.api.validation-error",e.LeadUpdate="error.api.lead.updated",e.LiveChatAnswerMissingCategory="error.api.livechat-missing-cat-answer",e.LiveChatCriteriaUnmet="error.api.livechat-criteria-unmet",e.LiveChatQuestionMissingCategory="error.api.livechat-missing-cat-question",e.LookupMissing="error.api.lookup-not-found",e.LookupQueryConfig="error.api.lookup-query-configuration",e.LookupUploadMissingFields="error.api.lookup-upload-missing-fields",e.MathEvalBadInput="error.api.math.bad-input",e.MathEvalBadResult="error.api.math.bad-result",e.MaxAnswersUnsatisfied="error.api.max-answers-unsatisfied",e.MinAnswersUnsatisfied="error.api.min-answers-unsatisfied",e.NodeInvalidMeta="error.api.node-meta-parse-failure",e.PhoneValidation="error.api.phone.invalid",e.RequestInvalid="error.api.request-payload-invalid",e.SanitizingSecurityIssue="This message was sanitized due to security reasons"}(S||(S={})),function(e){e.Header="header",e.Footer="footer"}(O||(O={})),function(e){e[e.New=1]="New",e[e.NoReply=2]="NoReply",e[e.NoLead=3]="NoLead",e[e.ReplyLead=4]="ReplyLead"}(j||(j={})),function(e){e.Email="email",e.Number="number",e.String="string"}(P||(P={})),function(e){e.Left="left",e.Right="right",e.Center="center"}(E||(E={})),function(e){e.Top="top",e.BelowHeading="below-heading",e.BelowSubheading="below-subheading",e.Bottom="bottom"}(T||(T={})),function(e){e.Full="full",e.Large="large",e.Medium="medium",e.Small="small"}(I||(I={})),function(e){e.Image="image",e.Video="video"}(N||(N={})),function(e){e.Youtube="youtube",e.Vimeo="vimeo"}(A||(A={})),function(e){e[e.Text=1]="Text",e[e.Number=2]="Number"}(L||(L={})),function(e){e.Document="document",e.Static="static",e.URL="url",e.Window="window"}(D||(D={})),function(e){e[e.Bot=1]="Bot",e[e.AI=2]="AI",e[e.Livechat=3]="Livechat"}(R||(R={})),function(e){e.Button="button",e.Point="point",e.Range="range",e.Scale="scale",e.HeatScale="heat-scale",e.InfinityScale="infinity-scale"}(M||(M={})),function(e){e[e.Always=1]="Always",e[e.Consent=2]="Consent",e[e.Never=3]="Never",e[e.CMP=4]="CMP"}($||($={})),function(e){e[e.Input=1]="Input",e[e.Output=2]="Output"}(U||(U={})),function(e){e[e.FULL=1]="FULL",e[e.INSIDE=2]="INSIDE"}(F||(F={})),function(e){e[e.Contain=1]="Contain",e[e.NotContain=2]="NotContain",e[e.PageSpecific=0]="PageSpecific"}(q||(q={})),function(e){e[e.ReadValue=1]="ReadValue",e[e.SetValue=2]="SetValue",e[e.AddValue=3]="AddValue"}(B||(B={})),function(e){e[e.Number=2]="Number",e[e.Text=1]="Text"}(z||(z={})),function(e){e[e.Always=2]="Always",e[e.Disabled=0]="Disabled",e[e.Manual=1]="Manual"}(V||(V={})),function(e){e[e.StoreAlways=0]="StoreAlways",e[e.StoreAfterTracking=1]="StoreAfterTracking",e[e.Never=2]="Never"}(H||(H={}))},8364:(e,t,n)=>{"use strict";n.d(t,{$9:()=>pe,TF:()=>ye,Y_:()=>ge,Zo:()=>ve,dZ:()=>K,tH:()=>we,vh:()=>xe});var r=n(4486),i=n(4256),o={86:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelQueue=void 0;const r=n(345),i=n(597),o=n(452);class s extends r.EventEmitter{constructor(){super(),this._channels={}}get channels(){return this._channels}createChannel(e){if(this.channelExists(e))throw new Error(`Cannot create channel: channel already exists: ${e}`);return this.channels[e]=new i.Channel(e),this.channels[e]}createParallelChannel(e,t){if(this.channelExists(e))throw new Error(`Cannot create channel: channel already exists: ${e}`);const n=this.channels[e]=new o.ParallelChannel(e);return t&&(n.parallelism=t),n}channel(e){return!0!==this.channelExists(e)?this.createChannel(e):this.channels[e]}channelExists(e){return this.channels.hasOwnProperty(e)}}t.ChannelQueue=s},126:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseArguments=void 0;const r=n(211);t.parseArguments=function(e){let t,n="";if(0===e.length)t={};else if(r.isError(e[0]))t={cause:e[0]},n=e.slice(1).join(" ")||"";else if(e[0]&&"object"==typeof e[0])t=Object.assign({},e[0]),n=e.slice(1).join(" ")||"";else{if("string"!=typeof e[0])throw new Error("Invalid arguments passed to Layerr");t={},n=n=e.join(" ")||""}return{options:t,shortMessage:n}}},162:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(597),t),i(n(452),t),i(n(86),t),i(n(978),t),i(n(791),t)},201:(e,t,n)=>{const r=n(714);e.exports=function(e){let t,n,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"maxAge";const s=async()=>{if(void 0!==t)return;const s=async s=>{i=r();const a=s[1][o]-Date.now();return a<=0?(e.delete(s[0]),void i.resolve()):(t=s[0],n=setTimeout((()=>{e.delete(s[0]),i&&i.resolve()}),a),"function"==typeof n.unref&&n.unref(),i.promise)};try{for(const t of e)await s(t)}catch(e){}t=void 0},a=e.set.bind(e);return e.set=(r,o)=>{e.has(r)&&e.delete(r);const l=a(r,o);return t&&t===r&&(t=void 0,void 0!==n&&(clearTimeout(n),n=void 0),void 0!==i&&(i.reject(void 0),i=void 0)),s(),l},s(),e}},211:(e,t)=>{function n(e){return"[object Error]"===(t=e,Object.prototype.toString.call(t))||e instanceof Error;var t}Object.defineProperty(t,"__esModule",{value:!0}),t.isError=t.inherit=t.assertError=void 0,t.assertError=function(e){if(!n(e))throw new Error("Parameter was not an error")},t.inherit=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.isError=n},278:(e,t,n)=>{const r=n(201);class i{constructor(e,t){if(this.maxAge=e,this[Symbol.toStringTag]="Map",this.data=new Map,r(this.data),t)for(const[e,n]of t)this.set(e,n)}get size(){return this.data.size}clear(){this.data.clear()}delete(e){return this.data.delete(e)}has(e){return this.data.has(e)}get(e){const t=this.data.get(e);if(t)return t.data}set(e,t){return this.data.set(e,{maxAge:Date.now()+this.maxAge,data:t}),this}values(){return this.createIterator((e=>e[1].data))}keys(){return this.data.keys()}entries(){return this.createIterator((e=>[e[0],e[1].data]))}forEach(e,t){for(const[n,r]of this.entries())e.apply(t,[r,n,this])}[Symbol.iterator](){return this.entries()}*createIterator(e){for(const t of this.data.entries())yield e(t)}}e.exports=i},345:e=>{e.exports=r},452:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParallelChannel=void 0;const r=n(597);class i extends r.Channel{constructor(e){super(e),this._parallelism=2,this._runningTasks=[],this.canRunAcrossTaskTypes=!1}get isEmpty(){return super.isEmpty&&this._runningTasks.length<=0}get parallelism(){return this._parallelism}get runningTasks(){return this._runningTasks}set parallelism(e){const t=Math.max(e,1);this._parallelism=t}_runNextItem(){if(0===this.runningTasks.length&&0===this.tasks.length)return void(()=>{this.isRunning=!1,this.emit("stopped")})();let e=this.parallelism-this.runningTasks.length;if(!(e<=0))for(;e>0;){if(!this.canRunAcrossTaskTypes&&this.runningTasks.length>0&&this.tasks.length>0&&this.runningTasks[0].type!==this.tasks[0].type)return;e-=1;const t=this.retrieveNextItem();if(!t)return;this.runningTasks.push(t),t.execute().then((()=>{this.runningTasks.splice(this.runningTasks.indexOf(t),1),this._runNextItem()}))}}}t.ParallelChannel=i},468:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Layerr=void 0;const r=n(211),i=n(126);function o(e,t){const n=[...arguments];if(this instanceof o==0)throw new Error("Cannot invoke 'Layerr' like a function: It must be called with 'new'");const{options:r,shortMessage:s}=i.parseArguments(n);this.name="Layerr",r.name&&"string"==typeof r.name&&(this.name=r.name);let a=s;if(r.cause&&(Object.defineProperty(this,"_cause",{value:r.cause}),a=`${a}: ${r.cause.message}`),this.message=a,Object.defineProperty(this,"_info",{value:{}}),r.info&&"object"==typeof r.info&&Object.assign(this._info,r.info),Error.call(this,a),Error.captureStackTrace){const e=r.constructorOpt||this.constructor;Error.captureStackTrace(this,e)}return this}t.Layerr=o,r.inherit(o,Error),o.prototype.cause=function(){return o.cause(this)||void 0},o.prototype.toString=function(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e},o.cause=function(e){return r.assertError(e),r.isError(e._cause)?e._cause:null},o.fullStack=function(e){r.assertError(e);const t=o.cause(e);return t?`${e.stack}\ncaused by: ${o.fullStack(t)}`:e.stack},o.info=function(e){r.assertError(e);const t={},n=o.cause(e);return n&&Object.assign(t,o.info(n)),e._info&&Object.assign(t,e._info),t}},585:e=>{var t=1e3,n=60*t,r=60*n,i=24*r,o=7*i;function s(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,a){a=a||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(s){var a=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*o;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===l&&isFinite(e))return a.long?function(e){var o=Math.abs(e);return o>=i?s(e,o,i,"day"):o>=r?s(e,o,r,"hour"):o>=n?s(e,o,n,"minute"):o>=t?s(e,o,t,"second"):e+" ms"}(e):function(e){var o=Math.abs(e);return o>=i?Math.round(e/i)+"d":o>=r?Math.round(e/r)+"h":o>=n?Math.round(e/n)+"m":o>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},597:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Channel=void 0;const i=n(345),o=n(625),s=n(978),a=n(791);function l(e,t){const{type:n,created:r}=e,{type:i,created:o}=t;return n===a.TaskPriority.High&&i!==a.TaskPriority.High?-1:i===a.TaskPriority.High&&n!==a.TaskPriority.High?1:i===a.TaskPriority.Tail&&n!==a.TaskPriority.Tail?-1:n===a.TaskPriority.Tail&&i!==a.TaskPriority.Tail?1:r=0;t-=1)this.tasks[t].type===e&&this.tasks.splice(t,1);else this.tasks.splice(0,1/0)}enqueue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.TaskPriority.Normal,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(n){const e=this.getStackedItems(n);if(e.length>0)return e[e.length-1].queuedPromise}const i=new s.Task(e,t,n);return"number"==typeof r&&r>=0&&(i.timeLimit=r),this.tasks.push(i),this.sort(),this.autostart&&this.start(),i.queuedPromise}getStackedItems(e){return this.tasks.filter((t=>t.stack&&t.stack===e))}retrieveNextItem(){return this.tasks.shift()}sort(){this.tasks.sort(l)}start(){return!this.isRunning&&(this.emit("started"),this.isRunning=!0,setTimeout((()=>this._runNextItem()),0),!0)}waitForEmpty(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(this,void 0,void 0,(function*(){const{throwForFailures:t=!1}=e;if(yield new Promise((e=>{if(this.isEmpty)return e();this.once("stopped",(()=>{e()}))})),t&&this._taskErrors.length>0)throw new o.Layerr(this._taskErrors[0],"Enqueued task failed")}))}_runNextItem(){const e=this.retrieveNextItem();e?e.execute(this._tasksThrow).then((()=>{e.error&&this._taskErrors.push(e.error)})).then((()=>this._runNextItem())).catch((e=>{console.error(e)})):(this.isRunning=!1,this.emit("stopped"))}}t.Channel=c},625:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Layerr=void 0;var o=n(468);Object.defineProperty(t,"Layerr",{enumerable:!0,get:function(){return o.Layerr}}),i(n(784),t)},714:e=>{e.exports=()=>{const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}},784:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},791:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TaskPriority=t.ErrorCode=void 0,function(e){e.TaskTimeout="TASKTIMEOUT"}(t.ErrorCode||(t.ErrorCode={})),(n=t.TaskPriority||(t.TaskPriority={})).Normal="normal",n.High="high-priority",n.Tail="tail"},909:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeLimit=void 0;const r=n(625),i=n(791);t.timeLimit=function(e,t){let n;return Promise.race([e,new Promise(((e,o)=>{n=setTimeout((()=>{o(new r.Layerr({info:{code:i.ErrorCode.TaskTimeout}},`Timed-out waiting for task: ${t} ms`))}),t)}))]).then((e=>(clearTimeout(n),e)))}},978:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Task=void 0;const i=n(909),o=n(791);t.Task=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.TaskPriority.Normal,n=arguments.length>2?arguments[2]:void 0;if(this._error=null,this._rejectFn=null,this._resolveFn=null,this._stack=null,e instanceof Promise!=1&&"function"!=typeof e)throw new Error("Invalid task item: Expected a Promise or Function");this._target="function"==typeof e?e:()=>e,this._stack=null!=n?n:null,this._type=t,this._timeLimit=-1,this._resolveFn=null,this._rejectFn=null,this._queuedPromise=new Promise(((e,t)=>{this._resolveFn=e,this._rejectFn=t}));const r=new Date;this._created=r.getTime()}get created(){return this._created}get error(){return this._error}get queuedPromise(){return this._queuedPromise}get stack(){return this._stack}get target(){return this._target}get timeLimit(){return this._timeLimit}get type(){return this._type}set timeLimit(e){this._timeLimit=e}execute(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t,n;return r(this,void 0,void 0,(function*(){const r=this.target;let o;try{o=r()}catch(r){return this._error=r,e?null===(t=this._rejectFn)||void 0===t||t.call(this,r):null===(n=this._resolveFn)||void 0===n||n.call(this),Promise.resolve()}let s=o instanceof Promise?o:Promise.resolve(o);this.timeLimit>=0&&(s=(0,i.timeLimit)(s,this.timeLimit)),yield s.then((e=>{var t;null===(t=this._resolveFn)||void 0===t||t.call(this,e)})).catch((t=>{var n,r;this._error=t,e?null===(n=this._rejectFn)||void 0===n||n.call(this,t):null===(r=this._resolveFn)||void 0===r||r.call(this)}))}))}}}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return o[e].call(n.exports,n,n.exports,a),n.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const l=(c={createContext:()=>i.createContext,default:()=>i,useCallback:()=>i.useCallback,useContext:()=>i.useContext,useEffect:()=>i.useEffect,useMemo:()=>i.useMemo,useReducer:()=>i.useReducer,useRef:()=>i.useRef,useState:()=>i.useState},u={},a.d(u,c),u);var c,u,d,h,p,f,m,g,v,y,b,_,w,x,C;function k(e,t){switch(t.type){case x.AddChat:return Object.assign(Object.assign({},e),{chats:Object.assign(Object.assign({},e.chats),{[t.chat.channel]:t.chat})});case x.AddChats:return Object.assign(Object.assign({},e),{chats:Object.assign(Object.assign({},e.chats),t.chats.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.channel]:t})),{}))});case x.RemoveChats:{const n=Object.assign({},e.chats);for(const e of t.channels)delete n[e];return Object.assign(Object.assign({},e),{chats:n})}case x.RestartState:return t.state;case x.UpdateChatAssignment:{const{alternateCategoryID:n,assignment:r,channel:i}=t;if(!e.chats[i])return e;let o,s=e.chats[i].state;return e.chats[i].completed||e.chats[i].deleted||(r?(s=d.Active,o=Object.assign(Object.assign({},e.totals),{[d.Active]:e.totals[d.Active]+1,[d.Open]:e.totals[d.Open]-1})):(s=d.Open,o=Object.assign(Object.assign({},e.totals),{[d.Active]:e.totals[d.Active]-1,[d.Open]:e.totals[d.Open]+1})),s=r?d.Active:d.Open),Object.assign(Object.assign(Object.assign({},e),{chats:Object.assign(Object.assign({},e.chats),{[i]:Object.assign(Object.assign({},e.chats[i]),{categoryID:null!=n?n:e.chats[i].categoryID,assignment:r,state:s})})}),o||{})}case x.UpdateChatMessage:{const{message:n}=t;if(!n.from)return e;const r=e.chats[n.channel];return r?Object.assign(Object.assign({},e),{chats:Object.assign(Object.assign({},e.chats),{[n.channel]:Object.assign(Object.assign({},r),{message:n})})}):e}case x.UpdateChatTitle:{const{channel:n,title:r}=t;return e.chats[n]?Object.assign(Object.assign({},e),{chats:Object.assign(Object.assign({},e.chats),{[n]:Object.assign(Object.assign({},e.chats[n]),{channelTitle:r})})}):e}case x.UpdateTotal:{const{state:n,total:r}=t;return Object.assign(Object.assign({},e),{totals:Object.assign(Object.assign({},e.totals),{[n]:r})})}case x.Rated:{const{channel:n,feedback:r,rating:i}=t;return Object.assign(Object.assign({},e),{chats:Object.assign(Object.assign({},e.chats),{[n]:Object.assign(Object.assign({},e.chats[n]),{feedback:r,rating:i})})})}default:throw new Error(`Unknown chats action: ${t.type}`)}}function S(e){return{chats:{},totals:Object.keys(d).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:0})),{})}}function O(e,t,n){var r;return!(n.client.type!==g.User||!(null===(r=n.channels.get(t))||void 0===r?void 0:r.subscribe))||!e.assignment||e.assignment===n.id||n.client.admin}(C=d||(d={})).Open="open",C.Active="active",C.Unanswered="unanswered",C.Archived="archived",C.Historical="historical",function(e){e.ClientError="error",e.IncomingMessage="ongoing",e.OpenChats="open",e.Reassignment="reassignment",e.ServerError="err",e.SetupError="setErr"}(h||(h={})),function(e){e.Auth="auth",e.Start="start",e.Stop="stop"}(p||(p={})),function(e){e.Subscribe="subscribe",e.Broadcast="broadcast",e.BroadcastAndSubscribe="broadcast/subscribe",e.Idle="idle"}(f||(f={})),function(e){e.Connecting="connecting",e.Connected="connected",e.Disconnected="disconnected",e.FailedWillRetry="failed-retry"}(m||(m={})),function(e){e.Agent="agent",e.User="user"}(g||(g={})),function(e){e.Connected="connected",e.Connecting="connecting",e.Disconnected="disconnected"}(v||(v={})),function(e){e.Polling="polling",e.SSE="sse",e.Websocket="websocket"}(y||(y={})),function(e){e.Android="android",e.iOS="ios"}(b||(b={})),function(e){e.ConnectionFailed="connect-failed",e.ReconnectionFailed="reconnect-failed",e.SocketResponseTimeout="socket-response-timeout"}(_||(_={})),function(e){e.Attachment="attachment",e.ChatAssigned="assigned",e.ChatUnassigned="unassigned",e.CompleteChat="completeChat",e.DeleteChat="deleteChat",e.Event="event",e.Message="message",e.Presence="presence",e.Rated="rating",e.SetState="stateSet",e.SetTitle="titleSet",e.TimeoutCancelled="timeoutCancel",e.TimeoutStarted="timeoutStart",e.Typing="typing",e.VisibilityChanged="visibilityChange"}(w||(w={})),function(e){e.AddChat="add-chat",e.AddChats="add-chats",e.Rated="rating",e.RemoveChats="remove-chats",e.RestartState="restart-state",e.UpdateChatAssignment="update-chat-assignment",e.UpdateChatMessage="update-chat-message",e.UpdateChatTitle="update-chat-title",e.UpdateTotal="update-total"}(x||(x={}));var j=a(162),P=a(345),E=a(278),T=a.n(E);function I(e){if(!N(e))throw new Error("Parameter was not an error")}function N(e){return"[object Error]"===(t=e,Object.prototype.toString.call(t))||e instanceof Error;var t}class A extends Error{constructor(e,t){const n=[...arguments],{options:r,shortMessage:i}=function(e){let t,n="";if(0===e.length)t={};else if(N(e[0]))t={cause:e[0]},n=e.slice(1).join(" ")||"";else if(e[0]&&"object"==typeof e[0])t=Object.assign({},e[0]),n=e.slice(1).join(" ")||"";else{if("string"!=typeof e[0])throw new Error("Invalid arguments passed to Layerr");t={},n=n=e.join(" ")||""}return{options:t,shortMessage:n}}(n);let o=i;if(r.cause&&(o=`${o}: ${r.cause.message}`),super(o),this.message=o,r.name&&"string"==typeof r.name?this.name=r.name:this.name="Layerr",r.cause&&Object.defineProperty(this,"_cause",{value:r.cause}),Object.defineProperty(this,"_info",{value:{}}),r.info&&"object"==typeof r.info&&Object.assign(this._info,r.info),Error.captureStackTrace){const e=r.constructorOpt||this.constructor;Error.captureStackTrace(this,e)}}static cause(e){return I(e),e._cause&&N(e._cause)?e._cause:null}static fullStack(e){I(e);const t=A.cause(e);return t?`${e.stack}\ncaused by: ${A.fullStack(t)}`:e.stack}static info(e){I(e);const t={},n=A.cause(e);return n&&Object.assign(t,A.info(n)),e._info&&Object.assign(t,e._info),t}cause(){return A.cause(this)}toString(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e}}var L,D=a(585),R=a.n(D);function M(e){return t=this,r=function*(){yield new Promise((t=>{setTimeout((()=>{t()}),e)}))},new((n=void 0)||(n=Promise))((function(e,i){function o(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(o,s)}a((r=r.apply(t,[])).next())}));var t,n,r}!function(e){e.ChatFetch="chat-fetch",e.ChatCountsFetch="chat-counts-fetch",e.ChatsFetch="chats-fetch",e.ClientInfo="client-info"}(L||(L={}));var $=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))};const U=R()("5s");class F extends P.default{constructor(e,t){super(),this.__categoriesLoading=new Set([]),this.__unreadCountsListener=null,this.__client=e,this.__eventService=t,this.__queue=new j.ChannelQueue,this.__channelChats=this.__queue.createParallelChannel("chats",2),this.__channelChatCounts=this.__queue.createParallelChannel("chat-counts",2),this.__timeoutMessages=new(T())(U),this.__unreadCounts=e.getUnreadCounts(),this.init()}get unreadCounts(){return this.__unreadCounts}destroy(){this.__unreadCountsListener&&(this.__client.on("unreadCounts",this.__unreadCountsListener),this.__unreadCountsListener=null)}fetchChat(e){this.__queue.channel("chat").enqueue((()=>$(this,void 0,void 0,(function*(){if(this.__client.client.type!==g.Agent)return;yield M(250);const t=yield this.__client.getChat(e);this.emit("chatFetched",t)}))),j.TaskPriority.Normal,e).catch((t=>{const n=new A({cause:t,info:{query:{channel:e},type:L.ChatFetch}},"Failed fetching chat");console.error(n),this.__eventService.emitError(n)}))}fetchChatCounts(e){this.__channelChatCounts.enqueue((()=>$(this,void 0,void 0,(function*(){if(this.__client.client.type!==g.Agent)return;yield M(300);const t=yield this.__client.getChats(e,1,0,void 0,!0);this.emit("chatsCountFetched",e,t.total)}))),j.TaskPriority.Normal).catch((t=>{this.__categoriesLoading.delete(e);const n=new A({cause:t,info:{query:{category:e},type:L.ChatCountsFetch}},"Failed fetching chats total for category");console.error(n),this.__eventService.emitError(n)}))}fetchChats(e,t,n,r){const i=`${e}:${t}:${n}`;this.__channelChats.enqueue((()=>$(this,void 0,void 0,(function*(){this.toggleCategoryLoading(e,!0),yield M(300);const i=yield this.__client.getChats(e,t,n,r);this.toggleCategoryLoading(e,!1),this.emit("chatsFetched",e,i)}))),j.TaskPriority.Normal,i).catch((i=>{this.__categoriesLoading.delete(e);const o=new A({cause:i,info:{query:{category:e,count:t,offset:n,sinceTS:r},type:L.ChatsFetch}},"Failed fetching chats");console.error(o),this.__eventService.emitError(o)}))}getCategoriesLoading(){return[...this.__categoriesLoading]}getChatTimeoutMessages(e){return $(this,void 0,void 0,(function*(){return this.__queue.channel("timeout-messages").enqueue((()=>$(this,void 0,void 0,(function*(){if(this.__timeoutMessages.has(e))return this.__timeoutMessages.get(e);const t=yield this.__client.getChannelMessages(e,void 0,void 0,[w.TimeoutCancelled,w.TimeoutStarted]);return this.__timeoutMessages.set(e,t),t}))),j.TaskPriority.Normal,e)}))}init(){this.__unreadCountsListener=e=>{this.__unreadCounts=e,this.emit("unreadCounts",this.__unreadCounts)},this.__client.on("unreadCounts",this.__unreadCountsListener)}toggleCategoryLoading(e,t){t?this.__categoriesLoading.add(e):this.__categoriesLoading.delete(e),this.emit("categoriesLoading",[...this.__categoriesLoading])}}var q;function B(e,t){switch(t.type){case q.SetChannelTypers:return Object.assign(Object.assign({},e),{channelTyping:Object.assign({},t.typers)});case q.SetTypingClients:return Object.assign(Object.assign({},e),{typing:[...t.clients]});default:throw new Error(`Unknown general action: ${t.type}`)}}function z(e){return{channelTyping:{},typing:[]}}!function(e){e.SetChannelTypers="set-typing-clients-in-channel",e.SetTypingClients="set-typing-clients"}(q||(q={}));var V=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))};const H=R()("15s");class W extends P.default{constructor(e,t){super(),this.__client=e,this.__eventService=t,this.__queue=new j.ChannelQueue,this.__clientInfo=new(T())(H)}destroy(){}fetchClientInfo(e){this.__queue.channel("client-info").enqueue((()=>V(this,void 0,void 0,(function*(){if(this.__clientInfo.has(e))return;const t=yield this.__client.lookup(e);this.__clientInfo.set(e,t),this.emit("clientInfoUpdated",t)}))),j.TaskPriority.Normal,e).catch((t=>{const n=new A({cause:t,info:{query:{clientID:e},type:L.ClientInfo}},"Failed fetching client info");console.error(n),this.__eventService.emitError(n)}))}fetchClientState(e){this.__queue.channel("client-state").enqueue((()=>V(this,void 0,void 0,(function*(){const t=yield this.__client.getState(e,!1);this.emit("clientStateFetched",e,t)}))),j.TaskPriority.Normal,`state:${e}`).catch((t=>{const n=new A({cause:t,info:{query:{clientID:e},type:L.ClientInfo}},"Failed fetching client info");console.error(n),this.__eventService.emitError(n)}))}getClientInfo(e){return this.__clientInfo.has(e)?this.__clientInfo.get(e):null}getClientsInfo(){const e={};for(const[t,n]of this.__clientInfo.entries())e[t]=n;return e}}class G extends P.default{emitError(e){this.emit("error",{error:e})}}const Q=(0,l.createContext)({});function K(e){const{client:t}=e,n=(0,l.useMemo)((()=>new G),[]),r=(0,l.useMemo)((()=>!!t),[t]),[i,o]=(0,l.useState)(null),[s,a]=(0,l.useState)(null),[c,u,h]=function(e,t,n){const r=(0,l.useRef)(null),i=(0,l.useCallback)((()=>r.current),[]),o=(0,l.useRef)(((t,n)=>r.current=e(t,n))).current,[s,a]=(0,l.useReducer)(o,null,n);return[s,a,i]}(k,0,S),[p,f]=(0,l.useReducer)(B,null,z);return(0,l.useEffect)((()=>{if(!t)return;const r=new F(e.client,n);o(r);const i=new W(e.client,n);a(i);const s=function(e,t,n,r){const i=i=>{const o=n().chats[i.channel];r({alternateCategoryID:i.alternateCategoryID,assignment:i.assignment,channel:i.channel,type:x.UpdateChatAssignment});const s=e.isOutsideCategory(i.alternateCategoryID);o&&t.fetchChatCounts(o.state),i.assignment===e.id&&t.fetchChatCounts(d.Active),s?e.unsubscribe([i.channel]).catch((e=>{console.error(e)})):O(Object.assign(Object.assign({},o),{assignment:i.assignment}),i.channel,e)&&t.fetchChat(i.channel)},o=r=>{var i,o,s;const a=n().chats[r];a&&t.fetchChatCounts(a.state);const l=null!==(s=null===(o=null===(i=e.channels.get(r))||void 0===i?void 0:i.channel)||void 0===o?void 0:o.state)&&void 0!==s?s:null;l&&t.fetchChatCounts(l),a&&O(a,r,e)&&t.fetchChat(r)},s=r=>{var i,o,s;const a=n().chats[r];a&&t.fetchChatCounts(a.state);const l=null!==(s=null===(o=null===(i=e.channels.get(r))||void 0===i?void 0:i.channel)||void 0===o?void 0:o.state)&&void 0!==s?s:null;l&&t.fetchChatCounts(l),O(a,r,e)&&t.fetchChat(r)},a=e=>{const i=n().chats[e];r({channels:[e],type:x.RemoveChats}),i&&t.fetchChatCounts(i.state)},l=()=>{r({state:S(),type:x.RestartState})},c=i=>{var o,s,a;r({alternateCategoryID:null,assignment:null,channel:i.channel,type:x.UpdateChatAssignment});const l=n().chats[i.channel];l&&t.fetchChatCounts(l.state);const c=null!==(a=null===(s=null===(o=e.channels.get(i.channel))||void 0===o?void 0:o.channel)||void 0===s?void 0:s.state)&&void 0!==a?a:null;c&&t.fetchChatCounts(c),O(Object.assign(Object.assign({},l),{assignment:null}),i.channel,e)&&t.fetchChat(i.channel)},u=e=>{r({chat:e,type:x.AddChat})},h=(e,t)=>{r({state:e,total:t,type:x.UpdateTotal})},p=(e,t)=>{r({state:e,total:t.total,type:x.UpdateTotal}),r({chats:t.chats,type:x.AddChats})},f=e=>{r({type:x.UpdateChatMessage,message:e})},m=n=>{var r,i;t.fetchChat(n),(null===(i=null===(r=e.channels.get(n))||void 0===r?void 0:r.channel)||void 0===i?void 0:i.state)===d.Open&&t.fetchChatCounts(d.Open)},g=e=>{r({channel:e.channel,title:e.title,type:x.UpdateChatTitle})},v=e=>{var t,n,i,o;r({channel:e.channel,feedback:(null===(n=null===(t=e.payload)||void 0===t?void 0:t.event)||void 0===n?void 0:n.feedback)||null,rating:(null===(o=null===(i=e.payload)||void 0===i?void 0:i.event)||void 0===o?void 0:o.rating)||null,type:x.Rated})};return e.on("autoSubscribed",m),e.on("chatAssigned",i),e.on("chatCompleted",o),e.on("chatDeleted",s),e.on("channelUnsubscribed",a),e.on("chatUnassigned",c),e.on("disconnected",l),e.on("title",g),e.on("message",f),e.on("rating",v),t.on("chatFetched",u),t.on("chatsCountFetched",h),t.on("chatsFetched",p),()=>{e.off("autoSubscribed",m),e.off("chatAssigned",i),e.off("chatCompleted",o),e.off("chatDeleted",s),e.off("channelUnsubscribed",a),e.off("chatUnassigned",c),e.off("disconnected",l),e.off("title",g),e.off("message",f),e.off("rating",v),t.off("chatFetched",u),t.off("chatsCountFetched",h),t.off("chatsFetched",p)}}(e.client,r,h,u),l=function(e,t){const n=e=>{t({clients:e,type:q.SetTypingClients})},r=e=>{t({type:q.SetChannelTypers,typers:e})},i=()=>{e.processStaleTypingStates()};return e.on("chatCompleted",i),e.on("chatDeleted",i),e.on("typingClients",n),e.on("typingClientsInChannels",r),()=>{e.off("chatCompleted",i),e.off("chatDeleted",i),e.off("typingClients",n),e.off("typingClientsInChannels",r)}}(e.client,f);return()=>{r.destroy(),s(),l()}}),[t,n]),l.default.createElement(Q.Provider,{value:{available:r,chatService:i,chatsState:c,client:e.client,clientService:s,dispatchChatsState:u,dispatchGeneralState:f,eventService:n,generalState:p,getChatsState:h}},e.children)}var Y,J,Z,X,ee,te,ne,re,ie;function oe(){const e=(0,l.useContext)(Q);if(!e||!e.client)throw new Error("Failed processing hook: LiveChat context is invalid or not present")}function se(){oe();const{client:e}=(0,l.useContext)(Q);return(0,l.useMemo)((()=>e.client.id),[e])}function ae(e){return e.sort().join(",")}function le(){for(var e=arguments.length,t=new Array(e),n=0;ne.length===t[0].length))&&t[0].every((e=>{for(let n=1;ne===t)))return!1;return!0})))}function ce(){oe();const{client:e}=(0,l.useContext)(Q),[t,n]=(0,l.useState)((()=>function(e){const t=[];for(const[,n]of e.entries())n.channel&&t.push(n.channel);return t}(e.channels))),r=(0,l.useCallback)((t=>{e.channels.get(t).channel?n((n=>[...n.filter((e=>e.channel!==t)),e.channels.get(t).channel])):n((e=>e.filter((e=>e.channel!==t))))}),[e]);return(0,l.useEffect)((()=>(e.on("channelUpdated",r),()=>{e.off("channelUpdated",r)})),[e,r]),t}function ue(e,t,n){var r=this,i=(0,l.useRef)(null),o=(0,l.useRef)(0),s=(0,l.useRef)(null),a=(0,l.useRef)([]),c=(0,l.useRef)(),u=(0,l.useRef)(),d=(0,l.useRef)(e),h=(0,l.useRef)(!0);(0,l.useEffect)((function(){d.current=e}),[e]);var p=!t&&0!==t&&"undefined"!=typeof window;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var f=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,g="maxWait"in n,v=g?Math.max(+n.maxWait||0,t):null;(0,l.useEffect)((function(){return h.current=!0,function(){h.current=!1}}),[]);var y=(0,l.useMemo)((function(){var e=function(e){var t=a.current,n=c.current;return a.current=c.current=null,o.current=e,u.current=d.current.apply(n,t)},n=function(e,t){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(e):setTimeout(e,t)},l=function(e){if(!h.current)return!1;var n=e-i.current;return!i.current||n>=t||n<0||g&&e-o.current>=v},y=function(t){return s.current=null,m&&a.current?e(t):(a.current=c.current=null,u.current)},b=function e(){var r=Date.now();if(l(r))return y(r);if(h.current){var s=t-(r-i.current),a=g?Math.min(s,v-(r-o.current)):s;n(e,a)}},_=function(){var d=Date.now(),p=l(d);if(a.current=[].slice.call(arguments),c.current=r,i.current=d,p){if(!s.current&&h.current)return o.current=i.current,n(b,t),f?e(i.current):u.current;if(g)return n(b,t),e(i.current)}return s.current||n(b,t),u.current};return _.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),o.current=0,a.current=i.current=c.current=s.current=null},_.isPending=function(){return!!s.current},_.flush=function(){return s.current?y(Date.now()):u.current},_}),[f,g,t,v,m,p]);return y}function de(e){oe();const{clientService:t}=(0,l.useContext)(Q),[n,r]=(0,l.useState)((()=>t?t.getClientInfo(e):null)),i=(0,l.useCallback)((()=>{if(!t)return;const n=t.getClientInfo(e);n&&r(n)}),[t,e]);return(0,l.useEffect)((()=>{if(!e)throw new A("Client info hook failed: No client ID specified");if(t)return t.on("clientInfoUpdated",i),t.fetchClientInfo(e),()=>{t.off("clientInfoUpdated",i)}}),[t,e,i]),n}function he(e,t){return t.reduce(((t,n)=>e[n]?Object.assign(Object.assign({},t),{[n]:e[n]}):t),{})}function pe(e){oe();const{client:t,clientService:n}=(0,l.useContext)(Q),r=(0,l.useMemo)((()=>he(t.getStates(),e)),[t,e]),[i,o]=(0,l.useState)(r),s=(0,l.useCallback)(((t,n)=>{-1!==e.indexOf(t)&&o((e=>Object.assign(Object.assign({},e),{[t]:n})))}),[ae(e)]);(0,l.useEffect)((()=>{if(n)return n.on("clientStateFetched",s),()=>{n.off("clientStateFetched",s)}}),[n,s]),(0,l.useEffect)((()=>{if(n)for(const t of e)n.fetchClientState(t)}),[n,ae(e)]);const a=(0,l.useCallback)((()=>{const n=he(t.getStates(),e);o(n)}),[t,e]),c=(0,l.useCallback)((t=>{-1!==e.indexOf(t.clientID)&&a()}),[a]);return(0,l.useEffect)((()=>(t.on("state",c),()=>{t.off("state",c)})),[t,c]),i}function fe(e){if(!this.channels.has(e))return!0;if(!this.client)return!1;const t=this.channels.get(e).channel;return!t||!(this.client.type!==g.User||!this.channels.get(e).subscribe)||!this.isOutsideCategory(t.categoryID)&&(!t.assignment||t.assignment===this.client.id||this.client.admin)}function me(e){oe();const{client:t}=(0,l.useContext)(Q),n=(0,l.useMemo)((()=>fe.bind(t)),[t]),[r,i]=(0,l.useState)((()=>n(e))),o=_e(e);return(0,l.useEffect)((()=>{let n=!0;return t.canView(e).then((e=>{n&&i(e)})).catch((e=>{console.error(e),n&&i(!1)})),()=>{n=!1}}),[t,e,o]),r}function ge(e){oe();const{chatService:t,chatsState:n,client:r}=(0,l.useContext)(Q),i=(0,l.useMemo)((()=>n.chats[e]||null),[n,e]),o=me(e),s=_e(e),[a,c]=(0,l.useState)(null),u=ce(),d=se(),{type:h=null}=de(d)||{};return(0,l.useEffect)((()=>{const n=u.find((t=>t.channel===e)),s=r.isSubscribed(e);t&&s&&(i&&i.assignment===(null==n?void 0:n.assignment)||o&&t.fetchChat(e))}),[o,e,u,t,r,s]),(0,l.useEffect)((()=>{if(h!==g.User)return void c(null);const t=u.find((t=>t.channel===e));c(t?{agentAnswered:!1,assignment:t.assignment,categoryID:t.categoryID,channel:e,channelTitle:t.title,companyID:t.companyID,completed:t.completed,deleted:t.deleted,feedback:null,leadID:t.leadID,message:null,rating:null,state:t.state}:null)}),[e,u,h]),a||i}function ve(e){oe();const{client:t}=(0,l.useContext)(Q),[n,r]=(0,l.useState)([]),[i,o]=(0,l.useState)([]),s=ce(),[a,c]=(0,l.useState)(null),u=(0,l.useRef)(!1),d=(0,l.useCallback)((()=>{u.current||(u.current=!0,c(null),t.getChannelMembers(e).then((e=>{u.current=!1,r((t=>le(t,e)?t:e))})).catch((e=>{console.error(e),u.current=!1,c(e)})))}),[e,t]),h=ue(d,500,{leading:!0});return(0,l.useEffect)((()=>{u.current=!1,d()}),[t,d]),(0,l.useEffect)((()=>{const n=n=>{var r,i;n.channel===e&&((null===(r=t.client)||void 0===r?void 0:r.type)===g.User&&s.find((t=>t.channel===e))||(null===(i=t.client)||void 0===i?void 0:i.admin)||n.assignment&&n.assignment===t.id)&&d()},r=t=>{t.channel===e&&(!t.from||i.indexOf(t.from)>=0||(o([...i,t.from]),h()))};return t.on("chatAssigned",n),t.on("message",r),()=>{t.off("chatAssigned",n),t.off("message",r)}}),[e,t,s,d,h,i]),{error:a,members:n}}function ye(e){const t=be(e),n=se();return t.filter((e=>e!==n))}function be(e){oe();const{client:t}=(0,l.useContext)(Q),[n,r]=(0,l.useState)((()=>t.getPresence()[e]||[])),i=(0,l.useCallback)((t=>{const{channel:n,clients:i}=t;e===n&&r((e=>le(e,i)?e:[...i]))}),[e]);return(0,l.useEffect)((()=>{if(e)return t.on("presence",i),()=>{t.off("presence",i)};r([])}),[t,e,i]),n}function _e(e){oe();const{client:t}=(0,l.useContext)(Q),[n,r]=(0,l.useState)(Date.now()),i=ue(r,250);return(0,l.useEffect)((()=>{const n=t=>{t.channel===e&&i(Date.now())},r=t=>{t===e&&i(Date.now())};return t.on("chatAssigned",n),t.on("chatUnassigned",n),t.on("channelSubscribed",r),t.on("channelUnsubscribed",r),()=>{t.off("chatAssigned",n),t.off("chatUnassigned",n),t.off("channelSubscribed",r),t.off("channelUnsubscribed",r)}}),[t,e,i]),n}function we(){oe();const{client:e}=(0,l.useContext)(Q);return e}function xe(e){return function(){oe();const{generalState:e}=(0,l.useContext)(Q);return Object.assign({},e.channelTyping)}()[e]||[]}Q.displayName="LiveChatClientContext",Object.freeze({}),Function.prototype.call.bind(Object.prototype.toString),function(e){e[e.Indefinite=1]="Indefinite",e[e.Schedule=0]="Schedule"}(Y||(Y={})),function(e){e[e.Auto=0]="Auto",e[e.Manual=1]="Manual"}(J||(J={})),function(e){e[e.Ended=3]="Ended",e[e.Launched=1]="Launched",e[e.Paused=2]="Paused"}(Z||(Z={})),function(e){e[e.BestConversionRate=0]="BestConversionRate",e[e.BestEngagementRate=1]="BestEngagementRate",e[e.MostLeadConversions=2]="MostLeadConversions"}(X||(X={})),function(e){e[e.Document=3]="Document",e[e.Internal=0]="Internal",e[e.URL=2]="URL",e[e.Window=1]="Window"}(ee||(ee={})),function(e){e[e.AdvancedAnalytics=16]="AdvancedAnalytics",e[e.Automation=17]="Automation",e[e.BannerBots=14]="BannerBots",e[e.CallbackBot=6]="CallbackBot",e[e.ChatBot=3]="ChatBot",e[e.CTABot=19]="CTABot",e[e.CustomerProfiles=13]="CustomerProfiles",e[e.Feedback=8]="Feedback",e[e.InPageBot=4]="InPageBot",e[e.Integrations=18]="Integrations",e[e.LiveChat=5]="LiveChat",e[e.Media=7]="Media",e[e.Messaging=11]="Messaging",e[e.OrganizationProfiles=15]="OrganizationProfiles",e[e.Page=1]="Page",e[e.Remarketing=10]="Remarketing",e[e.Video=2]="Video",e[e.VisualBot=9]="VisualBot"}(te||(te={})),function(e){e.FullName="",e.FirstName="first",e.LastName="last",e.Separate="separate"}(ne||(ne={})),function(e){e[e.AdvancedCalculatorResult=33]="AdvancedCalculatorResult",e[e.AdvancedRouterResult=34]="AdvancedRouterResult",e[e.AI=48]="AI",e[e.ApiCall=51]="ApiCall",e[e.Rating=52]="Rating",e[e.AttachmentPrompt=44]="AttachmentPrompt",e[e.AttachmentPromptSingle=43]="AttachmentPromptSingle",e[e.BookingCalendar=35]="BookingCalendar",e[e.CalculatorResult=31]="CalculatorResult",e[e.Calendar=22]="Calendar",e[e.Carousel=16]="Carousel",e[e.CompanyPrompt=3]="CompanyPrompt",e[e.ContactForm=9]="ContactForm",e[e.CTAForm=47]="CTAForm",e[e.CustomForm=45]="CustomForm",e[e.Dropdown=15]="Dropdown",e[e.EmailPrompt=2]="EmailPrompt",e[e.LiveChat=99]="LiveChat",e[e.LocationForm=6]="LocationForm",e[e.LookupCarousel=1016]="LookupCarousel",e[e.LookupDropdown=1015]="LookupDropdown",e[e.LookupMultipleChoice=1014]="LookupMultipleChoice",e[e.LookupSingleChoice=1011]="LookupSingleChoice",e[e.LookupSingleChoiceURL=1012]="LookupSingleChoiceURL",e[e.LookupQuery=36]="LookupQuery",e[e.MultipleChoice=14]="MultipleChoice",e[e.NamePrompt=1]="NamePrompt",e[e.TextPrompt=5]="TextPrompt",e[e.PhonePrompt=4]="PhonePrompt",e[e.RangeSelector=21]="RangeSelector",e[e.Say=0]="Say",e[e.SingleChoice=11]="SingleChoice",e[e.SingleChoiceURL=12]="SingleChoiceURL",e[e.SoftLiveChat=2099]="SoftLiveChat",e[e.SingleChoiceAPI=2011]="SingleChoiceAPI",e[e.MultipleChoiceAPI=2014]="MultipleChoiceAPI",e[e.DropdownSelectAPI=2015]="DropdownSelectAPI",e[e.CarouselAPI=2016]="CarouselAPI",e[e.Country=7]="Country"}(re||(re={})),function(e){e.AddAndSortMessages="add-and-sort-messages",e.AppendMessage="append-message",e.ResetState="reset",e.SetRating="set-rating",e.SetReachedStart="set-reached-start"}(ie||(ie={}))},8500:(e,t,n)=>{"use strict";function r(e){if(!i(e))throw new Error("Parameter was not an error")}function i(e){return"[object Error]"===(t=e,Object.prototype.toString.call(t))||e instanceof Error;var t}n.d(t,{b:()=>i,t:()=>r})},8538:(e,t,n)=>{"use strict";n.d(t,{i:()=>o});var r=n(4912),i=n(9164);function o(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const[t,n]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=e=>{"cleared"===e&&n(null)};return(0,i.kh)(e),(0,i.kL)().then((e=>e?(0,i.T3)(e):null)).then((e=>{n(e)})).catch((e=>{console.error(e)})),()=>{(0,i.Zl)(e)}}),[e]),t}},8572:(e,t,n)=>{"use strict";n.d(t,{h2:()=>o});const r=Function.prototype.call.bind(Object.prototype.toString);function i(e){return e.map((e=>Array.isArray(e)?i(e):s(e)?o(e):e))}function o(e){const t=Object.assign({},e);for(const e in t)t.hasOwnProperty(e)&&(Array.isArray(t[e])?t[e]=i(t[e]):s(t[e])&&(t[e]=o(t[e])));return t}function s(e){return!!e&&"object"==typeof e&&"[object Object]"===function(e){const t=r(e);return"[object Object]"!==t?t:`[object ${Object.getPrototypeOf(e).constructor.name}]`}(e)}},8680:(e,t,n)=>{"use strict";n.d(t,{b:()=>d,s:()=>h});var r=n(2365),i=n(2276),o=n(5822),s=n(3976),a=n(8954);var l=n(8949);let c,u=[];async function d(){return c||(c=(0,l.Z0)({position:1}).then((e=>{let{question:t,answers:n}=e;return[t,n]})),c)}async function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();if(!t.leadID)return(0,s.Rm)("not processing question completions: no lead ID"),void u.push(e);const n=[...u,e];u=[],(0,s.Rm)(`processing question completions: ${n.join(", ")}`),await async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();const{token:n}=t,l=(0,a.Mk)(),c={leadID:t.leadID,questionIDs:e,token:n};return(0,r.sendRequest)({url:l,method:"POST",body:c}).then((()=>{(0,s.Rm)(`submitted question completions: ${e.join(", ")}`)})).catch((e=>{throw new i.GU(e,"Failed submitting question completions")}))}(n,t)}},8753:(e,t,n)=>{"use strict";n.d(t,{s2:()=>C,BZ:()=>k,ni:()=>P,BQ:()=>j});var r=n(9443),i=n(2276),o=n(868),s=n(8949),a=n(2658);function l(e){return"number"==typeof e&&!isNaN(e)}var c=n(5822),u=n(3976),d=n(564),h=n(2652),p=n(3503),f=n(7659),m=n(8680),g=n(471),v=n(5166),y=n(7915);function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _(e){for(var t=1;t{b.question&&await(0,m.s)(b.question.id,b),i({ready:[p.rz.Next],type:p.Ud.SetReady}),b.leadID&&await(0,s.WX)(b)};if(!A)return void await M();let $,U;(0,a.B)(A,"fetched question"),(0,a.B)(N,"fetched answers"),Object.assign(b,{answers:N,question:A});const F=(0,d.y)(b),q=await(0,v.V)(A.type);if(null!=q&&q.resolveNextPosition)b.nextPosition=q.resolveNextPosition(A),(0,u.Rm)(`plugin defines next position: ${b.nextPosition}`);else if(A.type===r.xi.CalculatorResult)(0,u.Rm)(`processing calculation node: ${A.id}`),function(e,t,n){var i;const{labels:o,score:s}=n,a=[...t].sort(((e,t)=>{var n,r;const i=null!==(n=e.priority)&&void 0!==n?n:1e3,o=null!==(r=t.priority)&&void 0!==r?r:1e3;return i>o?1:o>i?-1:0})),c=Math.max(0,...(0,r.KQ)(o)),u=c<=0?[]:Object.keys(o).reduce(((e,t)=>(o[t]===c&&e.push(parseInt(t,10)),e)),[]),d=a.find((e=>{const{score:t,score2:n}=e,r=null===n?Number(n):n,i=null!==t&&l(t),o=null!==r&&l(r);return u.length&&null!==e.label_id?u.includes(e.label_id):!(!i&&!o)&&(i&&o?s>=t&&s<=r:i?s>=t:s<=r)}));if(d){if(e.text=d.text,e.sub_text=d.sub_text,e.img_overlay=null!==(i=d.img_answer)&&void 0!==i?i:null,d.is_end)return n.finished=!0,n.nextPosition=null,void(e.is_end=!0);n.nextPosition=d.next_no||e.next_no||e.order_no+1}else n.nextPosition=e.next_no}(A,N,b);else if(F.includes(A.type))if(b.finished)b.nextPosition=null;else{const e=(0,h.l)(b.question);(0,u.Rm)(`setting next question position: ${e}`),b.nextPosition=e,null===b.nextPosition&&(b.finished=!0)}else if(A.type===r.xi.LiveChat||A.type===r.xi.SoftLiveChat){var B,z;if((0,u.Rm)("current question initiates livechat"),b.nextPosition=null,w){if(null===(B=A.livechat)||void 0===B||!B.livechat){var V;b.nextPosition=null!==(V=w.next_no)&&void 0!==V?V:null}}else if(null!==(z=A.livechat)&&void 0!==z&&z.livechat){var H;o({key:"lcStartMsg",value:A.start_message||(null===(H=A.livechat)||void 0===H||null===(H=H.criteria)||void 0===H?void 0:H.msg_start)||null,type:f._q.SetGlobal})}else{const e=(0,h.l)(b.question);(0,u.Rm)(`livechat not currently available: setting next position: ${e}`),b.nextPosition=e}}else(0,u.Rm)("current question defines no next position"),b.nextPosition=null;null!=q&&q.handlesQuestion?((0,u.Rm)(`question uses plugin: ${A.id} (${q.type})`),$=q.questionRendersContent?q.questionRendersContent(A):S(A),U=q.questionRequiresPrompt?q.questionRequiresPrompt(A):O(A,b)):($=S(A),U=O(A,b));$&&(0,u.Rm)(`current question renders a node: ${A.id}`);U&&(0,u.Rm)(`current question requires a prompt: ${A.id}`);if(await x(b,E),$||A.type===r.xi.Rating)if(A.type===r.xi.Rating&&j){const e=(0,h.l)(b.question);(0,u.Rm)(`setting next question position: ${e}`),b.nextPosition=e,null===b.nextPosition&&(b.finished=!0)}else(0,u.Rm)(`recording question: ${A.id}`),i({answers:N,question:A,type:p.Ud.AddQuestion});U&&((0,u.Rm)(`forming prompt: ${A.id}`),i({answers:N,editingAnswer:null,encryptionKey:L,question:A,type:p.Ud.Prompt}));i({ready:[p.rz.Next],type:p.Ud.SetReady});const W=A.type===r.xi.CalculatorResult&&b.botType===y.YK.Visual&&A.text;if(b.nextPosition&&!W)return C(_(_({},e),{},{answerNextNo:null,softQuestion:null}));if(b.finished)return void await M()}(e)}catch(t){if(e.dispatchBotFlow({ready:[p.rz.Next],type:p.Ud.SetReady}),"AbortError"!==t.name)throw new i.GU(t,"Failed processing next bot node")}}function k(e,t,n){const{friendly:r}=i.GU.info(e),o="string"==typeof r?r:e.name||e.message;let s="";"string"==typeof e.message&&(s=`${e.message}\n`),s=`${s}${e.message}\n${i.GU.fullStack(e)}`,t({error:{onRetry:n,message:s,title:o},type:p.Ud.SetError})}function S(e){var t,n;return e.type===r.xi.LiveChat?null!==(t=null===(n=e.livechat)||void 0===n?void 0:n.livechat)&&void 0!==t&&t:e.type!==r.xi.SoftLiveChat&&(e.type===r.xi.Rating||e.type!==r.xi.AdvancedCalculatorResult&&(e.type!==r.xi.AdvancedRouterResult||e.type===r.xi.AdvancedRouterResult&&Boolean(e.text))&&Boolean(e.text))}function O(e,t){const n=(0,d.y)(t);var i,o;return e.type===r.xi.LiveChat||e.type===r.xi.SoftLiveChat?null===(i=null===(o=e.livechat)||void 0===o?void 0:o.livechat)||void 0===i||i:!!S(e)&&!n.includes(e.type)}async function j(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,c.tU)();const t=await(0,s.hZ)(e);(0,u.Rm)(`received token: ${t}`),e.token=t}async function P(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:(0,c.tU)();if(!e().started){if(t({type:p.Ud.Start}),!o.mock){try{var s;const e=null===(s=o.settings)||void 0===s?void 0:s.launch_style;g.RR.includes(e)&&!o.refreshed||(await j(),o.refreshed=!1)}catch(e){(0,u.Rm)(`failed initialising: ${e.message}`);const{status:t}=i.GU.info(e);throw 404===t&&await r(),e}return C({answerEnd:!1,answerNextNo:null,dispatchBotFlow:t,dispatchBotGlobals:n,globals:o})}window.parent.postMessage(JSON.stringify({type:"mock-loaded"}),"*")}}},8834:(e,t,n)=>{"use strict";n.d(t,{b:()=>r});var r=n(6816)},8949:(e,t,n)=>{"use strict";n.d(t,{DZ:()=>b,Jd:()=>v,Jx:()=>O,K6:()=>P,Vy:()=>k,WX:()=>_,Z0:()=>w,eT:()=>m,eU:()=>x,hZ:()=>j,kc:()=>T,kl:()=>C,mA:()=>S,vX:()=>E,wZ:()=>I,zk:()=>y});var r=n(2658),i=n(373),o=n(4089),s=n(5822),a=n(8098),l=n(3976),c=n(5850),u=n(8954),d=n(7915);function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:(0,s.tU)();const{companyCode:t,leadID:n,token:r}=e;if(!n||!r)throw new Error("Lead ID and token must be set to end discussion");const i={companyCode:t,leadID:n,token:r},o=(0,u.Tf)(e);(0,l.Rm)(`ending discussion for lead: ${n}`);const a=await fetch(o,{method:"POST",headers:p({},m),body:JSON.stringify(i)});(0,c.g)(a)}async function w(e){const{position:t,bookingDate:n=null,timezone:i,abortContoller:o}=e,h=(0,s.tU)();(0,r.B)(h.botCode,"bot code"),(0,l.Rm)(`fetching question at position: ${t}`);const p=(0,u.ND)(h.botCode,t,n,i,h),f=await fetch(p,{signal:o});(0,c.g)(f);const{question:m,answers:g,answerMotif:v,key:y}=await f.json();if((0,l.Rm)(`received question payload at position ${t}: ID = ${m.id} (type: ${m.type})`),m.type===d.xi.AI&&(0,a.r0)(t,m.id),m.label_id&&m.label_name){const e=m.label_id,t=m.label_name;h.labels[e]=h.labels[e]?h.labels[e]+1:1,-1===h.labelTexts.indexOf(t)&&h.labelTexts.push(t)}return{question:m,answers:g,answerMotif:v,encryptionKey:y}}async function x(e,t){const n=await fetch(e,{method:"POST",headers:p({},m),body:JSON.stringify({properties:t})});(0,c.g)(n);return await n.text()}async function C(e){const t=await fetch(u.J1,{method:"POST",headers:p({},m),body:JSON.stringify({properties:e})});(0,c.g)(t);return await t.json()}async function k(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,s.tU)();if(e.preview)return{};const t=(0,u.wM)(e),n=await fetch(t);(0,c.g)(n);const{leadVariables:r}=await n.json();return r}async function S(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,s.tU)();const i=(0,u.fP)(e,t,n,r),o=await fetch(i);if(!o.ok)throw new Error(`Failed getting calendar digest: Request failed: ${o.status} ${o.statusText}`);const{digest:a}=await o.json();return a}async function O(e){var t;const n=(0,s.tU)(),{answer:a,dynamicVars:d,isDynamicVarsForAnswers:h,lookupAnswers:f=null,scoreInc:g=0,consents:v,companyCountry:y}=e;if(!n.token)throw new Error("Unable to submit answer: No lead token found");const b=(0,i._)();(0,r.B)(b,"top page URL");const _={ab:n.ab,answer:null!=a?a:null,deviceID:n.deviceID,deviceType:n.deviceType,dynamicVars:d,dynamicVarsEnv:(0,o.G)(n),isDynamicVarsForAnswers:h,leadID:n.leadID,leadToken:n.token,lookupAnswers:f,totalScore:n.score+g,companyCountry:0===y?void 0:y,url:b,consents:v},w=(0,u.GY)();(0,l.Rm)(`submit answer(s) for question: ${null===(t=n.question)||void 0===t?void 0:t.id}`);const x=await fetch(w,{method:"POST",headers:p({},m),body:JSON.stringify(_)});(0,c.g)(x);const{leadID:C,leadConverted:k}=await x.json();if(!C)throw new Error("No lead returned from service");return{leadID:C,leadConverted:k}}async function j(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,s.tU)();(0,l.Rm)(`firing trigger for bot: ${e.botCode}`);const t=(0,u.ep)(e),n={ab:e.ab,companyCode:e.companyCode},r=await fetch(t,{method:"POST",headers:p({},m),body:JSON.stringify(n)});(0,c.g)(r);const i=await r.json();if(!i||!i.token)throw new Error("No token returned from service");return i.token}async function P(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,s.tU)(),i=arguments.length>4?arguments[4]:void 0;const o=(0,u.zE)(e,t,n,r,i);if(!(await fetch(o,{method:"POST"})).ok)throw new Error("Error submitting rating");return{category:t}}async function E(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,s.tU)();const{botCode:r,leadID:i,token:o}=n,{name:a,type:l}=e,c=l||g,d=new FormData;d.append("file",e);const h=(0,u.$U)(r,i,t,a,c,o),p=await fetch(h,{method:"POST",body:d});if(!p.ok)throw new Error(`Failed uploading file: Request failed: ${p.status} ${p.statusText}`);const{attachmentID:f,leadID:m}=await p.json();return{attachmentID:f,leadID:m}}async function T(e){const t=new FormData;for(const n of e)t.append("files[]",n);const n=(0,u.np)(),r=await fetch(n,{method:"POST",body:t});if(!r.ok)throw new Error(`Failed validating file: Request failed: ${r.status} ${r.statusText}`);return await r.json()}async function I(e,t,n,r,i,o){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:(0,s.tU)();const l=(0,u.PB)(a),c=await fetch(l,{method:"POST",headers:p({},m),body:JSON.stringify({leadTimezone:e,botTimezone:t,schedule:n,currentDate:r,startTime:i,endTime:o})});if(!c.ok)throw new Error(`Failed getting calendar timetable: Request failed: ${c.status} ${c.statusText}`);const{monthMatrix:d,monthSchedule:h}=await c.json();return{monthMatrix:d,monthSchedule:h}}},8954:(e,t,n)=>{"use strict";n.d(t,{$U:()=>x,DD:()=>u,GY:()=>h,J1:()=>l,Mk:()=>_,ND:()=>y,PB:()=>k,Tf:()=>f,ag:()=>g,eQ:()=>a,ei:()=>b,ep:()=>w,fP:()=>d,kO:()=>c,np:()=>C,qk:()=>m,wM:()=>v,zE:()=>p});var r=n(2658),i=n(373),o=n(5822),s=n(7915);const a="https://bot.leadoo.com/styles/mock/chat.css",l="https://bot.leadoo.com/styles/mock/theme-properties";function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();const{apiRoot:n,botCode:r,preview:i}=t;return`${n}/api/v2/ai/bot/${r}/question/${e}/stream-config?preview=${i?1:0}`}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();const{apiRoot:n,preview:r}=t;return`${n}/api/v2/ai/stream/${e}?preview=${r?1:0}`}function d(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,o.tU)();const{apiRoot:i,botCode:s,preview:a}=r;return`${i}/api/v2/calendar/bot/${s}/position/${e}/digest?ts=${t}&tz=${n}&preview=${a?1:0}`}function h(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();const{apiRoot:t,botCode:n,question:r,preview:i}=e;if(!r)throw new Error("Cannot generate collect URL for null question");return`${t}/api/v2/in/bot/${n}/question/${r.id}/answer?preview=${i?1:0}`}function p(e,t,n){var r;let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,o.tU)(),a=arguments.length>4?arguments[4]:void 0;const{apiRoot:l,botCode:c,leadID:u,token:d,preview:h,question:p}=i,f=null==p||null===(r=p.meta)||void 0===r?void 0:r.model;return`${l}/api/v2/rating/bot/${c}?${t===s.eU.LIVECHAT&&a?`chatID=${a}&`:""}lead=${u}&category=${t}&rating=${e}&feedback=${n}${f&&t===s.eU.AI?`&aiModel=${f}`:""}&token=${d}&preview=${h?1:0}`}function f(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();const{apiRoot:t,botCode:n,preview:r}=e;return`${t}/api/v2/in/bot/${n}/end?preview=${r?1:0}`}function m(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,o.tU)();const{apiRoot:i,botCode:s}=r,a=new URL(`${i}/api/v2/file/bot/${s}/download/${t}/url`);return a.searchParams.set("lead",`${e}`),a.searchParams.set("token",n),a.toString()}function g(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();const{apiRoot:n,preview:r}=t;return`${n}/api/v2/validate/q/${e}/email?preview=${r?1:0}`}function v(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();const{apiRoot:t,botCode:n,leadID:r,token:i}=e;return`${t}/api/v2/lead/${r}/gtm?botcode=${n}&token=${i}`}function y(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:(0,o.tU)();const{apiRoot:s,preview:a,leadID:l,token:c}=i;let u=`${s}/api/v2/flow/bot/${e}/position/${t}/question?preview=${a?1:0}`;if(l&&c&&(u=`${u}&lead=${l}&token=${c}`),n){const e=r||Intl.DateTimeFormat().resolvedOptions().timeZone;u=`${u}&booking=${n}&tz=${encodeURIComponent(e)}`}return u}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();const{apiRoot:n,preview:r}=t;return`${n}/api/v2/validate/q/${e}/phone?preview=${r?1:0}`}function _(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();const{apiRoot:t,botCode:n,preview:r}=e;return`${t}/api/v2/in/bot/${n}/complete-questions?preview=${r?1:0}`}function w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();const{apiRoot:t,botCode:n,preview:r}=e;return`${t}/api/v2/in/bot/${n}/init?preview=${r?1:0}`}function x(e,t,n,s,a,l){let c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:(0,o.tU)();const{apiRoot:u,deviceID:d,deviceType:h,preview:p}=c,f=(0,i._)();(0,r.B)(f,"top page URL");let m=`${u}/api/v2/file/bot/${e}/upload?question=${n}&filename=${encodeURIComponent(s)}&mime=${encodeURIComponent(a)}&token=${l}&preview=${p?1:0}&device_id=${d||""}&device_type=${h}&page_url=${encodeURIComponent(f)}`;return"number"==typeof t&&t>0&&(m=`${m}&lead=${t}`),m}function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();const{apiRoot:t}=e;return`${t}/api/v2/file/validation`}function k(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();const{apiRoot:t}=e;return`${t}/api/v2/calendar/timetable`}},9027:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Layerr=void 0;var o=n(9606);Object.defineProperty(t,"Layerr",{enumerable:!0,get:function(){return o.Layerr}}),i(n(3410),t)},9028:(e,t,n)=>{"use strict";function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"_blank",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"noopener,noreferrer";window.__leadoo_href_link?window.location.href=e:window.open(e,t,n)}n.d(t,{F:()=>r})},9111:(e,t,n)=>{"use strict";n.d(t,{W:()=>u});var r=n(4912),i=n(3503),o=n(7659),s=n(7852),a=n(725),l=n(515),c=n(9833);function u(){const{dispatch:e,initComplete:t,state:n}=(0,r.useContext)(c.k),{dispatch:u,state:d}=(0,r.useContext)(a.d),{dispatch:h}=(0,r.useContext)(l.p);return(0,r.useEffect)((()=>{const r=d.globals.lcStartMsg;!n.startMessageShown&&r&&t&&(e({shown:!0,type:s.nM.SetStartMessageShown}),u({key:"lcStartMsg",value:null,type:o._q.SetGlobal}),h({payload:{message:r,hideTimeout:!1},type:i.Ud.AddLiveChatInfoMessage}))}),[d.globals.lcStartMsg,u,e,t,n.startMessageShown]),null}},9164:(e,t,n)=>{"use strict";n.d(t,{DP:()=>g,T3:()=>m,Zl:()=>b,gh:()=>y,kL:()=>v,kh:()=>f});var r=n(2658),i=n(373),o=n(5822),s=n(3976),a=n(1935);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();const{type:i}=e;if("lc2"!==i)return await g(),null;const{lcUserData:s,lead:a,leadID:l,leadToken:c,leadVerified:u,score:d,state:h}=e;return Object.assign(r,{lcData:s,lead:a,leadID:l,leadVerified:u,score:d,token:c,question:null!==(t=null===(n=h.botFlow.prompt)||void 0===n?void 0:n.question)&&void 0!==t?t:null}),e}async function g(){const e=(0,a.l)();if(e){await e.remove(d);for(const e of p)e("cleared");p=[]}}async function v(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();const t=(0,a.l)();if(!t)return null;const n=await t.get(d);if(!n)return null;const r=JSON.parse(n);return Date.now()-r.ts>h?((0,s.Rm)("persisted livechat session stale, clearing"),await g(),null):r.companyID!==e.companyID||r.botID!==e.botID?null:r}async function y(e){var t,n;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();const l=(0,a.l)();if(!l)return;const{botFlowState:u,chatState:h,clientName:f,companyChannel:m,liveChatState:g,token:v,userChannel:y}=e,b=c(c({},u),{},{error:null,items:[]});(0,r.B)(s.leadID,"Lead ID must be set before persistence");const _={botCode:s.botCode,botID:s.botID,categoryID:s.category,clientName:f,companyChannel:m,companyCode:s.companyCode,companyID:s.companyID,deviceID:s.deviceID,deviceType:s.deviceType,lcUserData:s.lcData,lead:s.lead,leadID:s.leadID,leadVerified:s.leadVerified,leadToken:s.token,questionID:null!==(t=null===(n=s.question)||void 0===n?void 0:n.id)&&void 0!==t?t:null,score:s.score,state:{botFlow:b,chat:h,liveChat:g},token:v,ts:Date.now(),type:"lc2",url:(0,i._)(),userChannel:y};await l.set(d,JSON.stringify(_));for(const e of p)e("persisted")}function b(e){const t=p.indexOf(e);t>=0&&p.splice(t,1)}},9336:(e,t,n)=>{"use strict";n.d(t,{M:()=>a,P:()=>s});var r=n(9443);const i=[],o=[];function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n={t:Date.now(),type:e,payload:t};o.push(n),i.forEach((e=>{try{e((0,r.h2)(n))}catch(e){console.error(e)}}))}function a(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.push(e),t&&o.forEach((t=>{e((0,r.h2)(t))})),()=>{const t=i.indexOf(e);t>=0&&i.splice(t,1)}}},9374:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i{"use strict";n.d(t,{CpH:()=>p,DY1:()=>x,Gk:()=>i,HIn:()=>r,Hws:()=>C,MBo:()=>d,PMU:()=>E,SYq:()=>g,XED:()=>S,XEf:()=>k,YX$:()=>a,YZw:()=>w,_OQ:()=>f,gqn:()=>_,gzW:()=>l,iG7:()=>h,mFJ:()=>O,ovv:()=>o,pOT:()=>v,qFr:()=>u,qhU:()=>s,rsu:()=>j,stL:()=>m,u$N:()=>P,uHP:()=>y,vu8:()=>b,yJ6:()=>c});const r="account",i="arrow-left",o="briefcase",s="city",a="clock-outline",l="close",c="comment-text",u="email-mark-as-unread",d="home-city",h="mailbox",p="map-marker-radius",f="message-reply-text-outline",m="phone",g="ld-timer-track",v="ld-telegram-send",y="ld-select-outline",b="ld-search-location-outline",_="ld-planet",w="ld-phone",x="ld-mailbox-alt",C="ld-mail",k="ld-location",S="ld-event-count",O="ld-city-alt",j="ld-calendar-time",P="ld-business",E="ld-account"},9443:(e,t,n)=>{"use strict";n.d(t,{AM:()=>s.A,H7:()=>r.H7,KQ:()=>r.KQ,UL:()=>c.UL,bk:()=>i.b,h2:()=>o.h2,oq:()=>a.o,xi:()=>c.xi,y0:()=>l.y});var r=n(5949),i=n(8834),o=(n(2135),n(8572)),s=n(7266),a=n(9809),l=n(3924),c=(n(5272),n(2786))},9505:(e,t,n)=>{"use strict";n.d(t,{nl:()=>C,er:()=>k,jC:()=>S,bP:()=>O});var r=n(4817),i=n(2276),o=n(5850),s=n(8949),a=n(2658),l=n(4154),c=n(373),u=n(3976),d=n(4456),h=n(5235);const p="https://bot.leadoo.com/images/f9d908ebfe1b99d0b82ed95f9dcd13e2.asset.png";var f=n(3132),m=n.n(f);const g="https://bot.leadoo.com/audio/327ca92c459713f7ecb1b970a7fa9fac.asset.mp3",v="https://bot.leadoo.com/audio/67071189a25ac92b602f107800459811.asset.ogg";let y;function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _(e){for(var t=1;t{(0,h.U)(e)}));(0,o.g)(v);const{clientName:y,companyChannel:b,leadID:w,leadConverted:x,liveChatToken:C,userChannel:k}=await v.json();return{clientName:y,companyChannel:b,leadID:w,leadConverted:x,liveChatToken:C,userChannel:k}}({botCode:r,categoryID:i,companyCode:l,deviceID:u,deviceType:d,lcData:p||{},leadID:f,leadToken:m,preview:t.preview,questionID:g.id,url:v});return(0,a.B)(x,"lead ID"),k(C,b,S,y,x,w,n,e,t)}async function k(e,t,n,i,o,s,a,u,d){var h;!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;const n=t.createElement("source");n.setAttribute("src",g),n.setAttribute("type","audio/mpeg");const r=t.createElement("source");r.setAttribute("src",v),r.setAttribute("type","audio/ogg");const i=e.lcAudio=t.createElement("audio");i.appendChild(n),i.appendChild(r),i.setAttribute("preload","auto"),t.body.appendChild(i)}(u);const{botCode:f,botID:b,category:w,companyID:C,deviceID:k,deviceType:S,lcData:O,question:j,token:P}=d,E={};E.transport=r.go.SSE,await(0,l.YA)()?a("detected livechat compatibility issue: incognito"):(0,l.nr)()&&a("detected livechat compatibility issue: safari");const T=new r.Kj("https://livechat.leadoo.com",e,E);return await T.connect(),await T.broadcast(t,!1),await T.subscribe([{channelID:n}]),await T.setState({name:i,avatar:p,lead:_({id:o,token:P},O),botCode:f,botID:b,categoryID:w,companyID:C,deviceID:k,deviceType:S,leadID:o,questionID:null!==(h=null==j?void 0:j.id)&&void 0!==h?h:null,url:(0,c._)()}),await T.setTitle(n,i),await T.presence([n]),T.on("message",(e=>{var t;const n=Date.now()-(null!==(t=e.timestamp)&&void 0!==t?t:0);!isNaN(n)&&n>=0&&n<=x&&e.from!==T.id&&(e.from||e.type===r.Go.Event)&&function(e){y||(y=m()((()=>{var t;return null===(t=e.lcAudio)||void 0===t?void 0:t.play()}),1e3,{immediate:!0})),y()}(u)})),{client:T,clientName:i,companyChannel:t,leadConverted:s,leadID:o,liveChatToken:e,userChannel:n}}async function S(e,t){const{botCode:n,lcCategory:r,companyCode:i,deviceID:l,deviceType:h,leadID:p,token:f,question:m}=t,g=(0,c._)();(0,a.B)(n,"bot code"),(0,a.B)(r,"category ID"),(0,a.B)(f,"lead token"),(0,a.B)(m,"current question"),(0,a.B)(g,"top page URL");const v="object"==typeof e&&e?e:{};let y="https://bot.leadoo.com/api/v2/livechat/auth/check";t.preview&&(y=`${y}?preview=1`);const b=await fetch(y,{method:"POST",headers:_({},s.eT),body:JSON.stringify({profile:v,botCode:n,categoryID:r,companyCode:i,deviceID:l,deviceType:h,leadID:p,questionID:m.id,token:f,url:g})});(0,o.g)(b);const w=await b.json();!t.leadVerified&&w&&w.isVerified&&(t.leadVerified=!0,t.leadID=w.leadID,(0,u.Rm)(`lead verified: ${w.leadID}`),(0,d._N)(w.leadID,t))}async function O(){const e=new r.GM("https://livechat.leadoo.com");try{await e.checkConnection()}catch(e){throw new i.GU(e,"LiveChat connection failed")}finally{await e.disconnect()}}},9509:(e,t,n)=>{var r=n(3162),i=/["&<]/;function o(e){if(0===e.length||!1===i.test(e))return e;for(var t=0,n=0,r="",o="";n{"use strict";n.d(t,{Q:()=>o});var r=n(2658),i=n(4912);function o(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return(0,r.B)(e.meta,"question meta"),function(e,t,n){const r=(0,i.useMemo)((()=>e[t]),[e,t]);if(n&&null==r)throw new Error(`Failed fetching required property: '${String(t)}' is null/undefined`);return r}(e.meta,t,n)}},9606:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Layerr=void 0;const r=n(9657),i=n(1624);function o(e,t){const n=[...arguments];if(this instanceof o==!1)throw new Error("Cannot invoke 'Layerr' like a function: It must be called with 'new'");const{options:r,shortMessage:s}=i.parseArguments(n);this.name="Layerr",r.name&&"string"==typeof r.name&&(this.name=r.name);let a=s;if(r.cause&&(Object.defineProperty(this,"_cause",{value:r.cause}),a=`${a}: ${r.cause.message}`),this.message=a,Object.defineProperty(this,"_info",{value:{}}),r.info&&"object"==typeof r.info&&Object.assign(this._info,r.info),Error.call(this,a),Error.captureStackTrace){const e=r.constructorOpt||this.constructor;Error.captureStackTrace(this,e)}return this}t.Layerr=o,r.inherit(o,Error),o.prototype.cause=function(){return o.cause(this)||void 0},o.prototype.toString=function(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e},o.cause=function(e){return r.assertError(e),r.isError(e._cause)?e._cause:null},o.fullStack=function(e){r.assertError(e);const t=o.cause(e);return t?`${e.stack}\ncaused by: ${o.fullStack(t)}`:e.stack},o.info=function(e){r.assertError(e);const t={},n=o.cause(e);return n&&Object.assign(t,o.info(n)),e._info&&Object.assign(t,e._info),t}},9610:(e,t,n)=>{"use strict";async function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;await new Promise((t=>{const{document:n}=e;if(n.body)return t();const r=()=>{n.removeEventListener("DOMContentLoaded",r),n.removeEventListener("load",r),t()};n.addEventListener("DOMContentLoaded",r),n.addEventListener("load",r)}))}n.d(t,{j:()=>r})},9657:(e,t)=>{"use strict";function n(e){return"[object Error]"===(t=e,Object.prototype.toString.call(t))||e instanceof Error;var t}Object.defineProperty(t,"__esModule",{value:!0}),t.isError=t.inherit=t.assertError=void 0,t.assertError=function(e){if(!n(e))throw new Error("Parameter was not an error")},t.inherit=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.isError=n},9687:function(e,t){!function(){function n(e){if(!e)return!1;return/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}e.exports&&(t=e.exports=n),t.isValidEmail=n}()},9725:(e,t,n)=>{"use strict";n.d(t,{H:()=>h});var r=n(3162),i=n(6430),o=n.n(i),s=n(7915);const a=/https?:\/\/(?:www\.)?(?:youtube\.com\/(?:watch\?v=|embed\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,l=/https?:\/\/(?:www\.)?vimeo\.com\/(?:video\/)?(\d+)/;function c(e){return[function(e){switch(e){case s.Et.Top:return"media-top";case s.Et.Bottom:return"media-bottom";case s.Et.BelowHeading:return"media-below-heading";case s.Et.BelowSubheading:return"media-below-subheading";default:return""}}(e.position),function(e){switch(e){case s.Ap.Left:return"media-left";case s.Ap.Center:return"media-center";case s.Ap.Right:return"media-right";default:return""}}(e.alignment),e.height?`media-height-${e.height}`:"",e.width?`media-width-${e.width}`:"",e.size?`media-size-${e.size}`:""].filter(Boolean).join(" ")}function u(e){var t,n,i,a,l,u,d,h;let{question:p}=e;const f=null!==(t=null===(n=p.media_settings)||void 0===n?void 0:n.image_position)&&void 0!==t?t:s.Et.Top,m=null!==(i=null===(a=p.media_settings)||void 0===a?void 0:a.image_alignment)&&void 0!==i?i:s.Ap.Center,g=null!==(l=null===(u=p.media_settings)||void 0===u?void 0:u.image_width)&&void 0!==l?l:s.Ak.Full,v=c({position:f,alignment:m,height:null!==(d=null===(h=p.media_settings)||void 0===h?void 0:h.image_height)&&void 0!==d?d:s.Ak.Large,width:g});return(0,r.h)("div",{className:o()("question-media",v)},(0,r.h)("img",{src:p.img_overlay,alt:""}))}function d(e){var t,n,i,u,d,h,p;let{question:f}=e;const m=null!==(t=null===(n=f.media_settings)||void 0===n?void 0:n.video_position)&&void 0!==t?t:s.Et.Top,g=null!==(i=null===(u=f.media_settings)||void 0===u?void 0:u.video_alignment)&&void 0!==i?i:s.Ap.Center,v=null!==(d=null===(h=f.media_settings)||void 0===h?void 0:h.video_size)&&void 0!==d?d:s.Ak.Full,y=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;try{const n=e.match(a),r=e.match(l);return n?{url:`https://www.youtube.com/embed/${n[1]}?rel=0${t?`&start=${t}`:""}`,type:s._X.Youtube}:r?{url:`https://player.vimeo.com/video/${r[1]}${t?`#t=${t}s`:""}`,type:s._X.Vimeo}:null}catch(e){return console.error("Error parsing video URL:",e),null}}(f.video_overlay,null===(p=f.media_settings)||void 0===p?void 0:p.video_start_time),b=c({position:m,alignment:g,size:v});return y?(0,r.h)("div",{className:o()("question-media",b)},(0,r.h)("iframe",{src:y.url,title:(y.type===s._X.Youtube?"YouTube":"Vimeo")+" video player",allow:"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",allowFullScreen:!0})):null}function h(e){var t,n,i;let{question:o,insideContent:a=!0}=e;const l=(null===(t=o.media_settings)||void 0===t?void 0:t.type)===s.zu.Video,c=l?o.video_overlay:o.img_overlay,h=l?null===(n=o.media_settings)||void 0===n?void 0:n.video_position:null===(i=o.media_settings)||void 0===i?void 0:i.image_position,p=(h===s.Et.Top||h===s.Et.Bottom)&&a;return!c||p?null:(0,r.h)(r.Fragment,null,l?(0,r.h)(d,{question:o}):(0,r.h)(u,{question:o}))}},9747:(e,t,n)=>{"use strict";n.d(t,{$w:()=>f,Oo:()=>h,UU:()=>w,Xd:()=>g,iJ:()=>p,oW:()=>y,xA:()=>m});var r=n(9443),i=n(5384),o=n(1981),s=n(471),a=n(5822);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const u=/^\+?\d{6,}$/,d=[!0];function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{meta:n,type:i}=e,{subType:s=null}=t,{name:a=null}=n||{},l=null===a?r.UL.FullName:a;switch(i){case r.xi.NamePrompt:return l===r.UL.FirstName?(0,o.t)("input.label.firstName"):l===r.UL.LastName?(0,o.t)("input.label.lastName"):(0,o.t)("input.label.name");case r.xi.EmailPrompt:return(0,o.t)("input.label.email");case r.xi.PhonePrompt:return(0,o.t)("input.label.phone");case r.xi.TextPrompt:return(0,o.t)("input.label.other");case r.xi.CompanyPrompt:return(0,o.t)("input.label.companyName");case r.xi.CTAForm:case r.xi.CustomForm:case r.xi.LiveChat:case r.xi.SoftLiveChat:case r.xi.LocationForm:case r.xi.ContactForm:case r.xi.BookingCalendar:switch(s){case"companyName":case"company":return(0,o.t)("input.label.companyName");case"name":return l===r.UL.FirstName?(0,o.t)("input.label.firstName"):l===r.UL.LastName?(0,o.t)("input.label.lastName"):(0,o.t)("input.label.name");case"firstName":case"lastName":case"phone":case"email":case"city":case"country":case"location":case"zip":case"other":return(0,o.t)(`input.label.${s}`)}default:return null}}function p(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{allow_empty:i=0,dv:o=[],type:s}=e,{allowEmptyOverride:a=null,subType:u=null}=n,p={allowEmpty:null!==a?!!a:!!i,openFieldDynamicVarType:1!==o.length||o[0].answer_id?null:o[0].type};switch(s){case r.xi.CTAForm:case r.xi.CustomForm:case r.xi.LiveChat:case r.xi.SoftLiveChat:case r.xi.LocationForm:case r.xi.ContactForm:case r.xi.BookingCalendar:return function(n,i){const a=function(e){for(var t=1;te.id.toString()===i));if(e){const t=o.find((t=>t.answer_id===e.id));t&&(p.openFieldDynamicVarType=t.type),a.allowEmpty=e.meta&&!1===e.meta.required||!1}}return"phone"===u?b(d,n,a):"email"===u?v(d,n,a):_(d,n,a)};case r.xi.CompanyPrompt:case r.xi.NamePrompt:case r.xi.TextPrompt:return t=>_(h(e),t,p);case r.xi.EmailPrompt:return t=>v(h(e),t,p);case r.xi.PhonePrompt:return t=>b(h(e),t,p);default:return()=>d}}function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{type:n}=e,{subType:i=null}=t;switch(n){case r.xi.EmailPrompt:return e=>e.trim();case r.xi.PhonePrompt:return e=>e.replace(/[\s-]/g,"");case r.xi.CTAForm:case r.xi.CustomForm:case r.xi.LiveChat:case r.xi.SoftLiveChat:case r.xi.LocationForm:case r.xi.BookingCalendar:case r.xi.ContactForm:return e=>"email"===i?e.trim():"phone"===i?e.replace(/[\s-]/g,""):e;case r.xi.CompanyPrompt:case r.xi.NamePrompt:case r.xi.TextPrompt:default:return e=>e}}function m(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{allowEmpty:r=!0}=n;return 0===t.length?!0===r?d:[!1,(0,o.t)("invalid.field-empty",{field:null!=e?e:"check"})]:d}function g(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{allowEmpty:r=!0}=n,i=null!=e?e:"dropdown";return Array.isArray(t)&&!t.length?!0===r?d:[!1,(0,o.t)("invalid.field-empty",{field:i})]:Array.isArray(t)?"number"!=typeof t[0].id||"string"!=typeof t[0].text?[!1,(0,o.t)("invalid.dropdown.props",{field:i})]:d:[!1,(0,o.t)("invalid.dropdown.format",{field:i})]}function v(e,t){return""===t?(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allowEmpty?d:[!1,(0,o.t)("invalid.field-empty",{field:null!=e?e:"email"})]:!1===(0,i.B)(t)?[!1,(0,o.t)("invalid.in-email",{field:null!=e?e:"email"})]:d}function y(e){return!1===u.test(e)?(0,o.t)("invalid.in-phone",{field:"phone"}):null}function b(e,t){return""!==t||(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allowEmpty?d:[!1,(0,o.t)("invalid.field-empty",{field:null!=e?e:"phone"})]}function _(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{openFieldDynamicVarType:r=null,allowEmpty:i=!1}=n,a=null!=e?e:"text";if(!i&&""===String(t).trim())return[!1,(0,o.t)("invalid.field-empty",{field:a})];if(s.Np,r===s.xy&&!i){const e=Number(String(t).replace("%","").replace(",",".").trim());if(Number.isNaN(e))return[!1,(0,o.t)("invalid.field-not-number",{field:a})];if(e>Number.MAX_SAFE_INTEGER||e1&&void 0!==arguments[1]?arguments[1]:(0,a.tU)();const n=e.type,r=e.name,i=t.maxUpload,l=r.substr(r.lastIndexOf(".")+1),c=n.substr(n.lastIndexOf("/")+1),u=s.jy.find((e=>e===c||e===l));return Boolean(u)?(0,o.t)("error.attachment.file-type"):e.size>=i?(0,o.t)("error.attachment.file-size.max",{size:""+i/1024/1024}):e.size{"use strict";function r(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Object.defineProperty(e,t,Object.assign({enumerable:!1,configurable:!1,writable:!1,value:n},r))}n.d(t,{o:()=>r})},9833:(e,t,n)=>{"use strict";n.d(t,{k:()=>S,m:()=>O});var r=n(3162),i=n(4912),o=n(868),s=n(9336),a=n(9844),l=n(785),c=n(2658),u=n(7547),d=n(5822),h=n(2966),p=n(5048),f=n(3976),m=n(5235),g=n(5994),v=n(7852),y=n(4456),b=n(9164),_=n(471),w=n(3983),x=n(1786),C=n(9111),k=n(7915);const S=(0,r.createContext)({});function O(e){const{children:t,initialStateGetter:n=v.QA,lcSession:O=null}=e,{api:P,registerDestroyCallback:E,registerReloadCallback:T}=(0,i.useContext)(w.v),I=(0,i.useMemo)(d.tU,[]),[N,A,L]=(0,l.i)(v.Bv,n),[D,R]=(0,i.useState)(null),[M,$]=(0,i.useState)(null),U=(0,i.useMemo)((()=>D?D.LiveChatClientProvider:j),[D]),[F,q]=(0,i.useState)(!1),[B,z]=(0,i.useState)(!1),[V,H]=(0,i.useState)(!1),[W,G]=(0,i.useState)(null),[Q,K]=(0,i.useState)(null),[Y,J]=(0,i.useState)(!1),[Z,X]=(0,i.useState)(""),[ee,te]=(0,i.useState)(!1),ne=(0,i.useMemo)((()=>{var e;return null!==(e=null==M?void 0:M.id)&&void 0!==e?e:null}),[M,B]),re=(0,i.useRef)(null),ie=(0,i.useCallback)((async()=>{try{if(A({shown:!0,type:v.nM.SetPromptShown}),F||D)return(0,c.B)(D,"livechat library"),D;(0,f.Rm)("initialising livechat module");const e=await(0,g.L)();return R(e),q(!0),e}catch(e){throw(0,m.U)(e),e}}),[F,D]),[oe,se]=(0,i.useState)(!1),ae=(0,i.useCallback)((async()=>{if(!O||oe)return;se(!0);const{active:e,startDisconnect:t}=O.state.liveChat;e&&t&&((0,f.Rm)("clearing remnant persistence"),await(0,b.DP)(),A({active:!1,type:v.nM.SetActive}),A({startDisconnect:!1,type:v.nM.SetStartDisconnect}),A({shown:!1,type:v.nM.SetStartMessageShown}),A({shown:!1,type:v.nM.SetPromptShown}),(0,f.Rm)("cleared remnant persistence"),await P.reload(),(0,f.Rm)("connected livechat with new session"))}),[P,b.DP,A,oe,O]),le=(0,i.useRef)(!1),ce=(0,i.useCallback)((async()=>{var e,t;if((0,c.B)(D,"livechat module"),le.current)return null;le.current=!0,H(!0),(0,f.Rm)("connecting livechat"),A({disconnectType:v.Jx.Flow,type:v.nM.SetDisconnectType});const{client:n,clientName:r,companyChannel:i,leadID:o,leadConverted:s,liveChatToken:a,userChannel:l}=await D.connectLiveChat(P,I,f.Rm);return(0,y.Ke)(l,I),await(0,h.x)(null!==(e=null===(t=I.question)||void 0===t?void 0:t.type)&&void 0!==e?e:k.xi.LiveChat,I.lcData,o,s,I),(0,c.B)(I.leadID,"lead ID"),G({clientName:r,companyChannel:i,leadVerified:s,token:a,userChannel:l}),n.on("online",(()=>{z(!0)})),n.on("offline",(()=>{z(!1)})),H(!1),(0,f.Rm)(`connected livechat: ${r}`),$(n),A({active:!0,type:v.nM.SetActive}),z(!0),n}),[P,A,I,D]),ue=(0,i.useCallback)((async()=>{if(A({startDisconnect:!0,type:v.nM.SetStartDisconnect}),(0,c.B)(D,"livechat module"),!le.current)return;le.current=!1,(0,c.B)(M,"livechat client"),H(!1);const e=D.getUserChannel(M);try{var t;null!==(t=M.getChannelConfig(e).channel)&&void 0!==t&&t.completed||((0,f.Rm)(`completing chat: ${e}`),await M.completeChat(e))}catch(e){console.error(e),(0,m.U)(e)}await(0,o.y)(2500),z(!1),G(null),A({active:!1,type:v.nM.SetActive}),A({startDisconnect:!1,type:v.nM.SetStartDisconnect}),A({shown:!1,type:v.nM.SetStartMessageShown}),A({shown:!1,type:v.nM.SetPromptShown}),(0,s.P)(_.ed),await M.disconnect(),M.removeAllListeners(),$(null),await(0,b.DP)()}),[M,A,D]);(0,i.useEffect)((()=>{ae().catch((e=>{console.error(e),(0,m.U)(e)}))}),[ae]);const[de,he]=(0,i.useState)(!1),[pe,fe]=(0,i.useState)(!1);(0,i.useEffect)((()=>{O&&!de&&(he(!0),ie().catch((e=>{console.error(e),(0,m.U)(e)})))}),[de,ie,O]),(0,i.useEffect)((()=>{O&&!pe&&D&&!le.current&&(le.current=!0,fe(!0),D.connectLiveChatWithToken(O.token,O.companyChannel,O.userChannel,O.clientName,O.leadID,O.leadVerified,f.Rm,P,I).then((e=>{let{client:t}=e;G({clientName:O.clientName,companyChannel:O.companyChannel,leadVerified:O.leadVerified,token:O.token,userChannel:O.userChannel}),t.on("online",(()=>{z(!0)})),t.on("offline",(()=>{z(!1)})),(0,f.Rm)(`re-connected livechat: ${O.clientName}`),$(t),z(!0)})).catch((e=>{console.error(e),(0,m.U)(e)})))}),[P,I,pe,O,D]);const me=(0,i.useCallback)((async()=>{D&&(A({disconnectType:v.Jx.Instant,type:v.nM.SetDisconnectType}),ue().then((()=>{A({type:v.nM.Reset})})).catch((e=>{(0,f.Rm)("failed disconnecting livechat by API"),console.error(e),(0,m.U)(e)})))}),[ue,A,D]);(0,i.useEffect)((()=>{const e=E(me),t=T(me);return()=>{e(),t()}}),[me,E,T]);const ge=(0,i.useCallback)((async()=>((0,c.B)(D,"livechat module"),(0,c.B)(M,"livechat client"),D.fetchInitialMessages(M))),[M,D]),ve=(0,i.useCallback)((()=>{const{timeout:e}=L();return e?(0,p.A)(e.start,e.timeout):null}),[L]),ye=(0,i.useCallback)((()=>{re.current&&(clearInterval(re.current),re.current=null)}),[]),be=(0,i.useCallback)((()=>{const e=ve();null!==e&&0!==e?re.current=setInterval((()=>{const e=ve();if(null===e||0===e)return void ye();A({secondsLeft:e,type:v.nM.SetTimeoutTimeLeft});const{timeoutShow:t}=L();e>0&&e<=_.rR&&!t&&A({type:v.nM.ShowTimeout})}),1e3):ye()}),[A,L,ve,ye]),_e=(0,i.useCallback)((async(e,t,n)=>{(0,a.Nw)(),(0,c.B)(D,"livechat module");let r=M,i=0;if(!r)try{r=await ce(),i=500}catch(e){(0,m.U)(e);const t=(0,u.k)(e);K(t)}(0,c.B)(r,"livechat client");const o=D.getUserChannel(r);setTimeout((()=>{D.sendMessage(r,o,e,t,n).catch((e=>{console.error(e),(0,m.U)(e)}))}),i)}),[M,ce,D]),we=(0,i.useCallback)((e=>{if(!D||!M)return;const t=D.getUserChannel(M);M.typing(t,e)}),[M,D]),xe=(0,i.useCallback)((()=>{(0,c.B)(D,"livechat module"),(0,c.B)(M,"livechat client");const e=D.getUserChannel(M);M.cancelTimeout(e).catch((e=>{console.error(e),(0,m.U)(e)}))}),[M,D]),Ce=(0,i.useCallback)((e=>{if(!D||!M)return()=>{};return D.onMessage(M,(t=>{e(t)}))}),[M,D]);return!O||D&&M?(0,r.h)(S.Provider,{value:{authResult:W,cancelTimeout:xe,connected:B,connecting:V,disconnect:ue,dispatch:A,fetchInitialMessages:ge,getState:L,id:ne,initComplete:Y,initialise:ie,initialised:F,lcAuthError:Q,lib:D,onMessage:Ce,sendMessage:_e,setInitComplete:J,startTimeout:be,state:N,typing:we,imgPreviewUrl:Z,isShowImgPreview:ee,setImgPreviewUrl:X,setIsShowImgPreview:te}},(0,r.h)(U,{client:M},t,D&&N.active&&(0,r.h)(x.$,{useAgentInfo:D.useAgentInfo,useChatInfo:D.useChatInfo}),D&&(0,r.h)(C.W,null))):((0,f.Rm)("livechat render empty due to missing dependencies"),null)}function j(e){return(0,r.h)(r.Fragment,null,e.children)}},9844:(e,t,n)=>{"use strict";n.d(t,{$O:()=>w,BZ:()=>y,CP:()=>m,Jm:()=>v,Nw:()=>P,fp:()=>b,nL:()=>g,rY:()=>_,wn:()=>p,ym:()=>x});var r=n(9443),i=n(7846),o=n(7588),s=n(5822),a=n(2966),l=n(3976),c=n(4456),u=n(471),d=n(8949),h=n(7915);function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)();const{answers:n,question:r}=t;return r&&Array.isArray(n)?Promise.resolve().then((()=>j(t))).then((()=>{(0,l.Rm)(`answering question ${null==r?void 0:r.id} with attachments: ${e.join(", ")}`);const{scoreInc:n}=C(r,[],[],t);return(0,l.Rm)(`answer score: ${n} (total: ${t.score+n})`),(0,d.Jx)({answer:e,dynamicVars:[],isDynamicVarsForAnswers:!1,scoreInc:n}).then((e=>(t.score+=n,e)))})).then((i=>S(r,n,e,null,i.leadID,i.leadConverted,t))):Promise.reject(new Error("No current question/answers in state"))}function f(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,s.tU)();const i=n.map((e=>e.id)),o=n.find((e=>"dropdown"===e.type));(0,l.Rm)(`answering question ${null==e?void 0:e.id} with ${n.length} custom form answers`);const{lookupAnswers:a,scoreInc:c}=C(e,t,i,r);if(o&&Array.isArray(o.value))for(const e of o.value)O(e);return(0,l.Rm)(`answer score: ${c} (total: ${r.score+c})`),{answerIDs:i,lookupAnswers:a,scoreInc:c}}async function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)();const{question:n}=t;if(!n)throw new Error("No current question in state");if("string"!=typeof e)throw new Error(`Invalid answer type for calendar: ${e}`);j(t),(0,l.Rm)(`answering question ${n.id} with value: ${JSON.stringify(e)}`);const r=await(0,d.Jx)({answer:e,dynamicVars:(0,i.tN)(n,[]),isDynamicVarsForAnswers:k(n)});await S(n,[],[],e,r.leadID,r.leadConverted,t)}async function g(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)();const{question:n,answers:r}=t;if(!n||!Array.isArray(r))throw new Error("No current question/answers in state");if("string"!=typeof(null==e?void 0:e.date))throw new Error(`Invalid answer type for booking calendar: ${e}`);!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)();const n=e.labelID,r=e.labelName;n&&r&&(t.labels[n]=t.labels[n]?t.labels[n]+1:1,-1===t.labelTexts.indexOf(r)&&t.labelTexts.push(r))}(e),j(t),(0,l.Rm)(`answering question ${n.id} with value: ${JSON.stringify(e)}`);const{lookupAnswers:o,scoreInc:a,answerIDs:c}=f(n,r,e.contactInfo,t),u=await(0,d.Jx)({answer:{booking:e},dynamicVars:(0,i.tN)(n,c),isDynamicVarsForAnswers:k(n),lookupAnswers:o,scoreInc:a});await S(n,r,[],e,u.leadID,u.leadConverted,t)}function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)(),n=arguments.length>2?arguments[2]:void 0;const{answers:r,question:o}=t;return o&&Array.isArray(r)?Promise.resolve().then((()=>j(t))).then((()=>{var t;const n=e.find((e=>e.type===h.sw.Email)),i=r.find((e=>e.id===(null==n?void 0:n.id)));Boolean(null==i||null===(t=i.meta)||void 0===t?void 0:t.required)||null!=n&&n.value})).then((()=>{const{lookupAnswers:s,scoreInc:a,answerIDs:l}=f(o,r,e,t);return(0,d.Jx)({answer:{form:e},dynamicVars:(0,i.tN)(o,l),isDynamicVarsForAnswers:k(o),lookupAnswers:s,scoreInc:a,consents:n}).then((e=>(t.score+=a,e)))})).then((n=>S(o,r,[],e,n.leadID,n.leadConverted,t))):Promise.reject(new Error("No current question/answers in state"))}function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)();const{question:n}=t;return n?Promise.resolve().then((()=>j(t))).then((()=>{if(e.label_id&&e.label){const n=e.label_id,r=e.label;t.labels[n]=t.labels[n]?t.labels[n]+1:1,r&&-1===t.labelTexts.indexOf(r)&&t.labelTexts.push(r)}const{scoreInc:r}=C(n,[],[],t);return(0,l.Rm)(`answer score: ${r} (total: ${t.score+r})`),(0,d.Jx)({answer:null,dynamicVars:(0,i.tN)(n,[]),isDynamicVarsForAnswers:k(n),scoreInc:r,companyCountry:e.id}).then((e=>(t.score+=r,e)))})).then((r=>{var i;return S(n,[],[],e.name,r.leadID,r.leadConverted,t,null!==(i=e.label)&&void 0!==i?i:"")})):Promise.reject(new Error("No current question in state"))}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)();const{answers:n,question:r}=t;return r&&Array.isArray(n)?Promise.resolve().then((()=>j(t))).then((()=>{const o=n.reduce(((e,t)=>t.id?[...e,t.id]:e),[]);(0,l.Rm)(`answering question ${r.id} with ${n.length} legacy form answers`);const{lookupAnswers:s,scoreInc:a}=C(r,n,o,t);return(0,l.Rm)(`answer score: ${a} (total: ${t.score+a})`),(0,d.Jx)({answer:{legacyForm:e},dynamicVars:(0,i.tN)(r,o),isDynamicVarsForAnswers:k(r),lookupAnswers:s,scoreInc:a}).then((e=>(t.score+=a,e)))})).then((i=>S(r,n,[],e,i.leadID,i.leadConverted,t))):Promise.reject(new Error("No current question/answers in state"))}function _(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)();const{answers:n,question:r}=t;return r&&Array.isArray(n)?Array.isArray(n)&&0!==n.length?Promise.resolve().then((()=>j(t))).then((()=>{(0,l.Rm)(`answering question ${r.id} with answers: ${e.join(", ")}`);const{lookupAnswers:o,scoreInc:s}=C(r,n,e,t);return(0,l.Rm)(`answer score: ${s} (total: ${t.score+s})`),(0,d.Jx)({answer:e,dynamicVars:(0,i.tN)(r,e),isDynamicVarsForAnswers:k(r),lookupAnswers:o,scoreInc:s}).then((e=>(t.score+=s,e)))})).then((i=>S(r,n,e,null,i.leadID,i.leadConverted,t))):Promise.reject(new Error("No answers for current question")):Promise.reject(new Error("No current question/answers in state"))}function w(e){return _([e],arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)())}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)();const{question:n}=t;return n?"string"!=typeof e?Promise.reject(new Error(`Invalid answer type for text input: ${e}`)):Promise.resolve().then((()=>j(t))).then((()=>{(0,l.Rm)(`answering question ${n.id} with text: "${e}"`);const{scoreInc:r}=C(n,[],[],t);return(0,l.Rm)(`answer score: ${r} (total: ${t.score+r})`),(0,d.Jx)({answer:e,dynamicVars:(0,i.tN)(n,[]),isDynamicVarsForAnswers:k(n),scoreInc:r}).then((e=>(t.score+=r,e)))})).then((r=>S(n,[],[],e,r.leadID,r.leadConverted,t))):Promise.reject(new Error("No current question in state"))}function C(e,t,n,r){const{score:o=0,label_id:s}=e;let a=null!=o?o:0,l=!1;if(s){const e=s;r.labels[e]=r.labels[e]?r.labels[e]+1:1}n.forEach((e=>{const n=t.find((t=>t.id==e));if(r.startMessage=n.start_message,a+=n&&n.score||0,n.labelID)O(n);else if(n.label_id){const e=`${n.label_id}`;r.labels[e]=r.labels[e]?r.labels[e]+1:1}n.lookup&&(l=!0)})),(0,i.WN)(t,n).forEach((e=>{e&&-1===r.labelTexts.indexOf(e)&&r.labelTexts.push(e)}));let c=null;return l&&(c=(0,i.sn)(t,n)),{lookupAnswers:c,scoreInc:a}}function k(e){var t,n;return(null!==(t=null===(n=e.dv)||void 0===n?void 0:n.length)&&void 0!==t?t:0)>0&&!!e.dv[0].answer_id}async function S(e,t,n,r,o,l,d,p){if(u.OJ.includes(e.type)){!function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,s.tU)();if(n.length>0)for(const e of n)if(Array.isArray(e.value))for(const t of e.value)if(t){const e=t.labelID,n=t.labelName;e&&n&&(r.labels[e]=r.labels[e]?r.labels[e]+1:1,-1===r.labelTexts.indexOf(n)&&r.labelTexts.push(n))}}(t,n,e.type===h.xi.BookingCalendar?null==r?void 0:r.contactInfo:r)}else!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,s.tU)();for(const r of t){const t=e.find((e=>e.id===r));if(t&&t.label_name){const e=t.label_id,r=t.label_name;e&&r&&(n.labels[e]=n.labels[e]?n.labels[e]+1:1,-1===n.labelTexts.indexOf(r)&&n.labelTexts.push(r))}}}(t,n);await(0,a.x)(e.type,r,o,l,d),(0,c.Kj)(e,n,(0,i.Bg)(e,t,n,r),(0,i.kj)(e,n,r),d,p)}function O(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,s.tU)();const n=`${e.labelID}`,r=`${e.label}`;n&&r&&(t.labels[n]=t.labels[n]?t.labels[n]+1:1,-1===t.labelTexts.indexOf(r)&&t.labelTexts.push(r))}function j(e){e.triggeredLead=!0,e.hasInteracted=!0}function P(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,s.tU)();e.interaction||(e.interaction=!0,(0,l.Rm)("interaction tracked - consent measured"),(0,r.H7)((0,o.k)(!0),((e,t)=>{t&&((0,l.Rm)(`consent modification failed: ${t.message}`),console.error(t)),(0,c.bD)(),(0,c.wD)()})))}},9897:(e,t,n)=>{"use strict";n.d(t,{X:()=>l,y:()=>u});var r=n(9443),i=n(3976),o=n(471);const s={};function a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;switch(e.type){case"deregister":for(const t of n[o.z4])c(t)&&"bot_destroy"===t.type&&a(t,e.code);delete s[e.code],(0,i.Rm)(`deregistered bot for callbacks: ${e.code}`);break;case"register":s[e.code]=s[e.code]||[],(0,i.Rm)(`registered bot for callbacks: ${e.code}`);for(const t of n[o.z4])c(t)&&"bot_create"===t.type&&a(t,e.code);break;case"bot_create":{const{cb:n,code:r=null}=e;if(r&&r!==t)break;if(t){s[t].push(n);try{n(t)}catch(e){console.error(e)}}break}case"bot_destroy":{const{cb:n,code:r=null}=e;if(r&&r!==t)break;if(t)try{n(t)}catch(e){console.error(e)}break}default:console.error(new Error(`Unknown callback type: ${e.type}`))}}function l(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window)[o.z4]}function c(e){return!!e&&"object"==typeof e}function u(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,t=[];Array.isArray(e[o.z4])&&(t=e[o.z4]);try{return(0,r.oq)(e,o.z4,t),!0}catch(e){return!1}}(e);if(!t)return;const n=e[o.z4],i=n.push.bind(n),l=n.unshift.bind(n),c=()=>{setTimeout((()=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;const t=e[o.z4].splice(0,1/0);for(const n of t)if("function"==typeof n)try{n(e.Leadoo)}catch(e){console.error(e)}else if(n&&"object"==typeof n&&n.type){const{type:t}=n,r=n.cb||null;if("bot_create"===t){for(const e in s)-1===s[e].indexOf(r)&&a(n,e);e[o.z4].silentPush(n)}else"bot_destroy"===t?e[o.z4].silentPush(n):"register"!==t&&"deregister"!==t||a(n)}}(e)}),0)};n.push=function(){const e=i(...arguments);return c(),e},n.silentPush=i,n.unshift=function(){const e=l(...arguments);return c(),e},c()}},9955:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Task=void 0;const i=n(5875),o=n(1517);t.Task=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.TaskPriority.Normal,n=arguments.length>2?arguments[2]:void 0;if(this._error=null,this._rejectFn=null,this._resolveFn=null,this._stack=null,e instanceof Promise!=!0&&"function"!=typeof e)throw new Error("Invalid task item: Expected a Promise or Function");this._target="function"==typeof e?e:()=>e,this._stack=null!=n?n:null,this._type=t,this._timeLimit=-1,this._resolveFn=null,this._rejectFn=null,this._queuedPromise=new Promise(((e,t)=>{this._resolveFn=e,this._rejectFn=t}));const r=new Date;this._created=r.getTime()}get created(){return this._created}get error(){return this._error}get queuedPromise(){return this._queuedPromise}get stack(){return this._stack}get target(){return this._target}get timeLimit(){return this._timeLimit}get type(){return this._type}set timeLimit(e){this._timeLimit=e}execute(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t,n;return r(this,void 0,void 0,(function*(){const r=this.target;let o;try{o=r()}catch(r){return this._error=r,e?null===(t=this._rejectFn)||void 0===t||t.call(this,r):null===(n=this._resolveFn)||void 0===n||n.call(this),Promise.resolve()}let s=o instanceof Promise?o:Promise.resolve(o);this.timeLimit>=0&&(s=(0,i.timeLimit)(s,this.timeLimit)),yield s.then((e=>{var t;null===(t=this._resolveFn)||void 0===t||t.call(this,e)})).catch((t=>{var n,r;this._error=t,e?null===(n=this._rejectFn)||void 0===n||n.call(this,t):null===(r=this._resolveFn)||void 0===r||r.call(this)}))}))}}}},o={};function s(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={id:e,exports:{}};return i[e].call(n.exports,n,n.exports,s),n.exports}s.m=i,s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var i=Object.create(null);s.r(i);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&r&&n;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>o[e]=()=>n[e]));return o.default=()=>n,s.d(i,o),i},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>(({111:"livechat-console",262:"calendar-visual",493:"plugin-ai",614:"phone-input",667:"calendar-core",872:"bugsnag",931:"livechat"}[e]||e)+"."+{111:"ea42065df8b94d817109",147:"1c00a9c25cfc2ecfa390",262:"e27da0b86de4e8a27e35",493:"20be493f61a6d7cd3048",614:"171f669bab2e2c7d5d3a",667:"0690a29b68adc7daa877",872:"165e5f7160929f9707f9",931:"0fafd454c78d572483b0"}[e]+".chunk.js"),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},r="@leadoo/bots:",s.l=(e,t,i,o)=>{if(n[e])n[e].push(t);else{var a,l;if(void 0!==i)for(var c=document.getElementsByTagName("script"),u=0;u{a.onerror=a.onload=null,clearTimeout(p);var i=n[e];if(delete n[e],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((e=>e(r))),t)return t(r)},p=setTimeout(h.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=h.bind(null,a.onerror),a.onload=h.bind(null,a.onload),l&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.p="https://bot.leadoo.com/",(()=>{var e={377:0,379:0};s.f.j=(t,n)=>{var r=s.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise(((n,i)=>r=e[t]=[n,i]));n.push(r[2]=i);var o=s.p+s.u(t),a=new Error;s.l(o,(n=>{if(s.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+i+": "+o+")",a.name="ChunkLoadError",a.type=i,a.request=o,r[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var r,i,[o,a,l]=n,c=0;if(o.some((t=>0!==e[t]))){for(r in a)s.o(a,r)&&(s.m[r]=a[r]);if(l)l(s)}for(t&&t(n);c{"use strict";var e=s(9897),t=s(9336),n=(s(2791),s(9443)),r=s(973),i=s(4154),o=s(5822),a=s(3976);var l=s(4543),c=s(2276);const u="script[src*='/bot/'][src*='/chat.js']";let d=null;function h(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();if(d)return d;const{botCode:t,companyCode:n,mock:r}=e,i=r?`${u}[src*='mock=1']`:`${u}[src*='code=${t}']`,s=[...document.querySelectorAll(i),...document.querySelectorAll(`${u}[src*='/dynamic/r/chat'][src*='company=${n}']`)];if(d=s.find((e=>"attached"!==e.getAttribute("data-ld")))||null,!d)throw new c.GU(`No bot script found for query: ${u}`);return d.setAttribute("data-ld","attached"),d}var p=s(7915);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function m(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:h(),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,o.tU)();const{deviceType:r}=n,i=Array.isArray(n.settings)?n.settings.find((e=>e.device_type==r)):n.settings;!function(e,t){if(e.hasOwnProperty("nopersist")&&((0,a.Rm)(`${v} nopersist = ${e.nopersist.toString()}`),t.persist=!e.nopersist),e.hasOwnProperty("xignore")&&((0,a.Rm)(`${v} xignore = ${e.xignore.toString()}`),t.xIgnore=Boolean(e.xignore)),"string"==typeof e.zindex){let n=null;"auto"===e.zindex?n="auto":/^\d+$/.test(e.zindex)&&(n=parseInt(e.zindex,10)),null!==n&&((0,a.Rm)(`${v} zIndex = ${n}`),t.zIndex=n)}"string"==typeof e.api&&e.api.length>0&&((0,a.Rm)(`${v} api = ${e.api}`),t.customAPI=e.api),"string"==typeof e.tag&&e.tag.length>0&&((0,a.Rm)(`${v} tag = ${e.tag}`),(0,l.KI)(e.tag)),"string"==typeof e.device&&/^\d$/.test(e.device)&&((0,a.Rm)(`${v} device = ${e.device}`),t.deviceType=parseInt(e.device,10))}(m(m({},function(e){const[,t=""]=e.src.split("#"),n=e.getAttribute("data-ctrl")||"";return`${t},${n}`.split(/,/g).reduce(((e,t)=>{const n=t.trim();if(!n)return e;const[r,i=!0]=n.split("=");let o=i;return"string"==typeof o&&(/^(no|false|0)$/i.test(o)?o=!1:/^(yes|true|1)$/i.test(o)&&(o=!0)),e[r]=o,e}),{})}(t)),null!==(e=i.flags)&&void 0!==e?e:{}),n)}const _=10;function w(e,t,n){return`calc(((${100*e}% - ${2*t}px) + ${t}px) - ${e*n}px)`}function x(e){const t=window.getComputedStyle(e,null),n=t.getPropertyValue("-webkit-transform")||t.getPropertyValue("-moz-transform")||t.getPropertyValue("-ms-transform")||t.getPropertyValue("-o-transform")||t.getPropertyValue("transform");if(!n||!/^matrix/.test(n))return 0;const r=n.split("(")[1].split(")")[0].split(","),i=parseFloat(r[0]),o=parseFloat(r[1]);return Math.round(Math.atan2(o,i)*(180/Math.PI))}function C(e){const t=[];for(const n of e.children)"IFRAME"===n.tagName?t.push(n):n.children.length>0&&t.push(...C(n));return t}function k(e){switch(e){case"l":return 0;case"c":return 50;case"r":return 100;default:throw new Error(`Invalid horizontal position: ${e}`)}}function S(e,t,n,r,i,o,s){const a=i?function(e,t,n){const r=n-_;let i=0,o=0;for(const t of e){let e=parseInt(t.dataset.height,10),n=parseInt(t.dataset.width,10);const r=x(t);if(90===Math.abs(r)){const t=e;e=n,n=t}e&&(n>i&&(i=n),e>o&&(o=e))}let s=t*o;const a=s+o;if(a>n){let e=0;const t=e=a-n;e-=Math.min(s,t),s-=t-e,e>0&&(o-=e)}return o=Math.min(r,o),{calc:`(((100% - 10px) * ${t}) + ${_-t*o}px)`,height:o,width:i}}(t,n,o):function(e,t,n,r){const i=n-_,o=e.reduce(((e,t)=>{const n=t.dataset.show&&"0"===t.dataset.show?0:parseInt(t.dataset.height,10),r=parseInt(t.dataset.width,10);return n?[...e,{width:r,height:n}]:e}),[]);let s=0,a=0;for(const e of o)"vertical"===r?(e.width>s&&(s=e.width),a+=e.height):"horizontal"===r&&(e.height>a&&(a=e.height),s+=e.width);let l=t*a;const c=l+a;if(c>n){let e=0;const t=e=c-n;e-=Math.min(l,t),l-=t-e,e>0&&(a-=e)}return a=Math.min(i,a),{calc:`(((100% - 10px) * ${t}) + ${_-t*a}px)`,height:a,width:s}}(t,n,o,s);Object.assign(e.style,{width:`${a.width}px`,height:`${a.height}px`,top:`calc${a.calc}`,left:w(r,0,a.width)})}function O(e,t){const n={};for(const r in e)t.includes(r)||(n[r]=e[r]);return n}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t0;)for(r-=1,t=0;t<2;t+=1)n+=" ";return n}function L(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.document;const n=t.createElement("style");return n.setAttribute("type","text/css"),t.head.appendChild(n),n.appendChild(t.createTextNode(e)),n}function D(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.document,n="";return function e(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Object.keys(t).forEach((i=>{const o=t[i];if("object"!=typeof o||!o)throw new Error(`Invalid CSS structure for expression: ${i}`);if("object"==typeof Object.values(o)[0])return n=`${n}\n${A(r)}${i} {`,e(o,r+1),void(n=`${n}\n${A(r)}}`);const s=Object.keys(o).reduce(((e,t)=>{return[...e,(n=t,T.test(n)?`${A(r+1)}${N(t)}: ${o[t]};`:`${A(r+1)}${t}: ${o[t]};`)];var n}),[]);s.length>0&&(n=`${n}\n${A(r)}${i} {\n${s.join("\n")}\n${A(r)}}`)}))}(e),L(n,t)}var R=s(471),M=s(3162),$=s(4912),U=s(6430),F=s.n(U),q=s(6711),B=s.n(q);function z(e,t,n){if(e&&e.addEventListener){e.addEventListener(t,n,!1);const r={remove:function(){!function(e,t,n){if(!e||!e.removeEventListener)throw new Error("Element does not support `removeEventListener`");e.removeEventListener(t,n,!1)}(e,t,n),delete r.remove}};return r}throw new Error("Element does not support `addEventListener`")}function V(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;const t=e.document;return{width:Math.max(t.documentElement.clientWidth,e.innerWidth||0),height:Math.max(t.documentElement.clientHeight,e.innerHeight||0)}}function H(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;const t=(0,$.useMemo)((()=>V()),[]),[n,r]=(0,$.useState)([t.width,t.height]);return(0,$.useEffect)((()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;const n=()=>e(),{remove:r}=z(t,"resize",n),{remove:i}=z(t,"orientationchange",n);return()=>{null==i||i(),null==r||r()}}((()=>{const e=V();r([e.width,e.height])}),e)),[]),n}const W=(0,M.createContext)({});function G(e){const{children:t,horPos:n,overlap:r=!1,stackDirection:i,triggerPreviewPos:o,vertPos:s}=e,[a,l]=(0,$.useState)(null),[,c]=H(),u=(0,$.useCallback)((()=>{if(!a)return;const e=C(a);S(a,e,s/100,(null!=o?o:n)/100,r,c,i)}),[a,o,c,i]);return(0,$.useEffect)((()=>{u()}),[u]),(0,M.h)(W.Provider,{value:{reposition:u,setFrameContainer:l,stackDirection:i}},t)}function Q(e){const{alignment:t="right",open:n,visible:r,centered:i=!1}=e,{reposition:s,setFrameContainer:a,stackDirection:l}=(0,$.useContext)(W),c=(0,$.useMemo)(o.tU,[]),u=(0,$.useMemo)((()=>{if(c.xIgnore)return{"x-ignore":""}}),[c.xIgnore]);return(0,$.useEffect)((()=>{const e=L(B(),window.document);return()=>{e.remove()}}),[]),(0,$.useEffect)((()=>()=>{a(null)}),[]),(0,$.useEffect)((()=>{s()}),[n,s]),(0,M.h)("div",Object.assign({"data-bot-code":c.botCode,id:"ld-bot-flow",className:F()({"ld-flow-left-aligned":"left"===t,"ld-flow-centered":i,"ld-flow-hidden":!r,"ld-flow-horizontal":"horizontal"===l&&"right"===t,"ld-flow-horizontal-left":"horizontal"===l&&"left"===t,"ld-flow-vertical":"vertical"===l}),ref:a},u),e.children)}var K=s(725),Y=s(515),J=s(50),Z=s(3503),X=s(3983);const ee=X.v;function te(e){const{botCode:t,botTypeName:n,children:r,closeBot:i,customAPI:o,openBot:s,showBot:a}=e,l=(0,$.useCallback)((async e=>{!function(){const e=document.getElementById("ld-chat-app");e&&e.remove()}(),e.modalOpened&&(e.modalOpened=!1)}),[]);return(0,M.h)(X.t,{botCode:t,botTypeName:n,closeBot:i,customAPI:o,destroyCallbacks:[l],openBot:s,showBot:a},r)}var ne=s(1626);var re=s(8048),ie=s(9833),oe=s(5235),se=s(9164);function ae(){const{authResult:e,connected:t,getState:n}=(0,$.useContext)(ie.k),{getState:r}=(0,$.useContext)(ne.f),{getState:i}=(0,$.useContext)(Y.p),[o,s]=(0,$.useState)(!1),{startDisconnect:l}=n();return(0,$.useEffect)((()=>{if(o&&!l||!t)return;if(s(!0),!e)return void console.error("No LiveChat authentication result for persistence");const c=n(),u=r(),d=i();(0,se.gh)({botFlowState:d,chatState:u,clientName:e.clientName,companyChannel:e.companyChannel,liveChatState:c,token:e.token,userChannel:e.userChannel}).then((()=>{(0,a.Rm)("livechat state persisted")})).catch((e=>{(0,a.Rm)("failed persisting livechat"),console.error(e),(0,oe.U)(e)}))}),[e,t,o,l]),null}function le(e,t){for(var n in t)e[n]=t[n];return e}function ce(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function ue(e,t){var n=t(),r=(0,$.useState)({t:{__:n,u:t}}),i=r[0].t,o=r[1];return(0,$.useLayoutEffect)((function(){i.__=n,i.u=t,de(i)&&o({t:i})}),[e,n,t]),(0,$.useEffect)((function(){return de(i)&&o({t:i}),e((function(){de(i)&&o({t:i})}))}),[e]),n}function de(e){var t,n,r=e.u,i=e.__;try{var o=r();return!(i===o&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}function he(e){e()}function pe(e){return e}function fe(){return[!1,he]}var me=$.useLayoutEffect;function ge(e,t){this.props=e,this.context=t}function ve(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:ce(this.props,e)}function r(t){return this.shouldComponentUpdate=n,(0,M.createElement)(e,t)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(ge.prototype=new M.Component).isPureReactComponent=!0,ge.prototype.shouldComponentUpdate=function(e,t){return ce(this.props,e)||ce(this.state,t)};var ye=M.options.__b;M.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ye&&ye(e)};var be="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function _e(e){function t(t){var n=le({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=be,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var we=function(e,t){return null==e?null:(0,M.toChildArray)((0,M.toChildArray)(e).map(t))},xe=(M.toChildArray,M.options.__e);M.options.__e=function(e,t,n,r){if(e.then)for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);xe(e,t,n,r)};var Ce=M.options.unmount;function ke(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=le({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return ke(e,t,n)}))),e}function Se(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return Se(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Oe(){this.__u=0,this.o=null,this.__b=null}function je(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Pe(){this.i=null,this.l=null}M.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ce&&Ce(e)},(Oe.prototype=new M.Component).__c=function(e,t){var n=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(n);var i=je(r.__v),o=!1,s=function(){o||(o=!0,n.__R=null,i?i(a):a())};n.__R=s;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Se(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},Oe.prototype.componentWillUnmount=function(){this.o=[]},Oe.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=ke(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&(0,M.createElement)(M.Fragment,null,e.fallback);return i&&(i.__u&=-33),[(0,M.createElement)(M.Fragment,null,t.__a?null:e.children),i]};var Ee=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.h.removeChild(e)}}}(0,M.render)((0,M.createElement)(Te,{context:t.context},e.__v),t.v)}function Ne(e,t){var n=(0,M.createElement)(Ie,{__v:e,h:t});return n.containerInfo=t,n}(Pe.prototype=new M.Component).__a=function(e){var t=this,n=je(t.__v),r=t.l.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),Ee(t,e,r)):i()};n?n(o):o()}},Pe.prototype.render=function(e){this.i=null,this.l=new Map;var t=(0,M.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Pe.prototype.componentDidUpdate=Pe.prototype.componentDidMount=function(){var e=this;this.l.forEach((function(t,n){Ee(e,n,t)}))};var Ae="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Le=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,De=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Re=/[A-Z0-9]/g,Me="undefined"!=typeof document,$e=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};M.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(M.Component.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var Ue=M.options.event;function Fe(){}function qe(){return this.cancelBubble}function Be(){return this.defaultPrevented}M.options.event=function(e){return Ue&&(e=Ue(e)),e.persist=Fe,e.isPropagationStopped=qe,e.isDefaultPrevented=Be,e.nativeEvent=e};var ze,Ve={enumerable:!1,configurable:!0,get:function(){return this.class}},He=M.options.vnode;M.options.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={},i=-1===n.indexOf("-");for(var o in t){var s=t[o];if(!("value"===o&&"defaultValue"in t&&null==s||Me&&"children"===o&&"noscript"===n||"class"===o||"className"===o)){var a=o.toLowerCase();"defaultValue"===o&&"value"in t&&null==t.value?o="value":"download"===o&&!0===s?s="":"translate"===a&&"no"===s?s=!1:"o"===a[0]&&"n"===a[1]?"ondoubleclick"===a?o="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||$e(t.type)?"onfocus"===a?o="onfocusin":"onblur"===a?o="onfocusout":De.test(o)&&(o=a):a=o="oninput":i&&Le.test(o)?o=o.replace(Re,"-$&").toLowerCase():null===s&&(s=void 0),"oninput"===a&&r[o=a]&&(o="oninputCapture"),r[o]=s}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=(0,M.toChildArray)(t.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==n&&null!=r.defaultValue&&(r.value=(0,M.toChildArray)(t.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",Ve)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=Ae,He&&He(e)};var We=M.options.__r;M.options.__r=function(e){We&&We(e),ze=e.__c};var Ge=M.options.diffed;M.options.diffed=function(e){Ge&&Ge(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),ze=null};$.useCallback,$.useContext,$.useDebugValue,$.useEffect,$.useId,$.useImperativeHandle,$.useLayoutEffect,$.useMemo,$.useReducer,$.useRef,$.useState;M.Fragment,$.useState,$.useId,$.useReducer,$.useEffect,$.useLayoutEffect,$.useRef,$.useImperativeHandle,$.useMemo,$.useCallback,$.useContext,$.useDebugValue,M.createElement,M.createContext,M.createRef,M.Fragment,M.Component;var Qe=s(5826);function Ke(e){const{css:t,url:n}=e,r=(0,$.useMemo)(o.tU,[]),{document:i}=(0,$.useContext)(Qe._);return(0,$.useEffect)((()=>{if(t){const e=i.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,i.head.appendChild(e),()=>{var t;return null===(t=e.parentElement)||void 0===t?void 0:t.removeChild(e)}}if(n){const e=i.createElement("link");return e.setAttribute("rel","stylesheet"),e.setAttribute("href",n),i.head.appendChild(e),()=>{var t;return null===(t=e.parentElement)||void 0===t?void 0:t.removeChild(e)}}}),[t,i,r,n]),null}function Ye(){const e=(0,$.useMemo)(o.tU,[]),t=(0,$.useMemo)((()=>{let t=`https://bot.leadoo.com/styles/${e.botType}/application.css`;return e.preview&&(t=`${t}?preview=1`),t}),[e]);return(0,M.h)(Ke,{url:t})}var Je=s(3609);function Ze(){const e=(0,Je.P)("botCode",!1),t=(0,Je.P)("botType"),n=(0,Je.P)("mock"),r=(0,Je.P)("mockStyles",!1),i=(0,Je.P)("preview"),o=(0,$.useMemo)((()=>{if(!e||n)return;let r=`https://bot.leadoo.com/styles/bot/${e}/${t}/theme.css`;return i&&(r=`${r}?preview=1`),r}),[e,t,n]);return n&&r?(0,M.h)(Ke,{css:r}):o?(0,M.h)(Ke,{url:o}):null}var Xe=s(3464);function et(e,t){if(e.className="",e.classList.add("ld-body"),"string"==typeof t&&t){const n=t.split(/\s+/g);e.classList.add(...n)}}var tt=s(4486);const nt=()=>{};function rt(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:nt;const o=e.getWindow();if(!o)throw new Error("Iframe not ready: No content window available");return function(e,t){var n;let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:nt,s=arguments.length>5?arguments[5]:void 0;const a=null===(n=e.contentWindow)||void 0===n?void 0:n.document;let l;const c=(t,n)=>{l&&l.width===t&&l.height===n||(l={width:t,height:n},r&&(e.style.width=`${t}px`,e.dataset.width=`${t}`),i&&(e.style.height=`${n}px`,e.dataset.height=`${n}`,e.style.minHeight=`${n}px`),e.dataset.show&&"0"===e.dataset.show&&(e.style.height="0px",e.dataset.height="0",e.dataset.minHeight="0px"),o(t,n))};let u=null,d=[],h=null;const p=()=>{const e=a.querySelector(t);e&&u!==e&&(h&&h(),u=e,d=(0,J.DS)(u),h=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;const i=new ResizeObserver((e=>{let n=null;for(const t of e)if(t.borderBoxSize&&t.borderBoxSize[0]?n={height:t.borderBoxSize[0].blockSize,width:t.borderBoxSize[0].inlineSize}:t.contentRect&&(n={height:t.contentRect.height,width:t.contentRect.width}),n)break;n&&t(n.width,n.height)}));if(i.observe(e),n){const n=e.getBoundingClientRect();t(n.width,n.height)}const o=()=>{i.disconnect()};return null==r||r.addEventListener("pagehide",o),()=>{i.unobserve(e),null==r||r.removeEventListener("pagehide",o)}}(u,c,!0,s))};p();const f=new MutationObserver((e=>{let n=!1;e:for(const r of e)for(const e of[r.target,...r.addedNodes])if(d.includes(e)||(0,J.vq)(e)&&e.matches(t)){n=!0;break e}n&&p()}));return f.observe(a.body,{attributes:!1,childList:!0,subtree:!0}),()=>{f.disconnect(),h&&(h(),h=null)}}(e.el,t,n,r,((t,n)=>{e.emit("resize",t,n),i(t,n)}),o)}function it(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ot(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:null;const t=e||(0,J.n)("iframe"),n=new tt.default;let r=!1,i=!1;const o={attr:ct,bindElementSize:(e,t,n,r)=>rt(o,e,t,n,r),ee:n,el:t,emit:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i{const e=o.getWindow();return e?e.document:null},getWindow:()=>i?t.contentWindow:null,isLoaded:()=>r,isMounted:()=>i,isReady:()=>r&&i,mount:(e,t)=>dt.call(o,(function(){i=!0,n.emit("mount"),at.call(o)}),s,e,t),on:(e,t)=>(n.on(e,t),()=>{n.off(e,t)}),once:(e,t)=>(n.once(e,t),()=>{n.off(e,t)}),style:e=>{const n=function(e){return e.split(";").reduce(((e,t)=>{const n=t.trim(),r=n.indexOf(":");if(-1===r)return e;const i=n.substring(0,r).trim(),o=n.substring(r+1).trim();return P(P({},e),{},{[i]:o})}),{})}(t.getAttribute("style")||"");t.setAttribute("style",function(e){return Object.keys(e).reduce(((t,n)=>[...t,`${n}: ${e[n]}`]),[]).join("; ")}(ot(ot({},n),e)))},unmount:()=>{i&&(t.remove(),i=!1,r=!1)}},s=()=>{r=!0,n.emit("load"),at.call(o)};var a;e&&(i=(0,J.K9)(window.document.body,e),"complete"===(null===(a=e.contentWindow)||void 0===a||null===(a=a.document)||void 0===a?void 0:a.readyState)?s():e.addEventListener("load",(()=>s())));return o.attr=o.attr.bind(o),o}function ct(e){if("string"==typeof e)return this.el.getAttribute(e);for(const t in e)null===e[t]?this.el.removeAttribute(t):this.el.setAttribute(t,e[t])}async function ut(e){const t=this.el;t.addEventListener("load",(()=>e())),t.setAttribute("priority","high"),this.style({border:"none"})}async function dt(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;await ut.call(this,t),(0,J.nf)(n,this.el,r),e()}var ht=s(2847),pt=s.n(ht);function ft(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mt(e){for(var t=1;tg?lt(g):null),[g]);(0,$.useEffect)((()=>{_(!1)}),[g]),(0,$.useEffect)((()=>{if(C){if(!C.isLoaded())return C.once("load",(()=>{_(!0)}));_(!0)}}),[C]);const k=(0,$.useMemo)((()=>{if(!g||!w||!b)return null;let e=w.querySelector("#root");return e?et(e,s):e=function(e,t){var n;const r=null===(n=e.contentWindow)||void 0===n?void 0:n.document;if(!r)throw new Error("Cannot create iframe contents: No document available");const i=r.createElement("div");return i.setAttribute("id","root"),et(i,t),r.body.appendChild(i),D({body:{display:"inline-block",margin:0,overflowX:"hidden",overflowY:"hidden"},"#root":{display:"inline-block",opacity:0}},r),i}(g,s),C&&(0,Xe.pp)(C,!1,y,d),c&&e.setAttribute("style",`max-width: ${c.width}px; max-height: ${c.height}px`),e}),[w,g,b,s,d]),S=(0,$.useMemo)((()=>{if("boolean"==typeof a)return a?0:-1}),[a]),O=(0,$.useMemo)((()=>{let e=mt({},vt);return i?e=mt(mt({},e),{},{position:"fixed",top:"0px",left:"0px",bottom:"0px",right:"0px",minWidth:"100%",maxWidth:"100vw",minHeight:"100%",maxHeight:"100vh"}):l&&(g&&(g.dataset.width=`${l.width}`,g.dataset.height=`${l.height}`),e=mt(mt({},e),{},{width:`${l.width}px`,height:`${l.height}px`})),"boolean"==typeof a&&(g&&(g.dataset.show=Number(a).toString()),a||(e.display="none",e.height="0px")),mt(mt({},e),{},{visibility:f?"visible":"hidden"})}),[i,g,a,l,f]);return(0,$.useEffect)((()=>{var e;if(!g)return;const t=null==g||null===(e=g.contentWindow)||void 0===e||null===(e=e.document)||void 0===e?void 0:e.readyState;t&&"complete"===t&&(b||_(!0),x(g.contentWindow.document))}),[g,b]),(0,$.useEffect)((()=>{if(b&&C&&u===p.aY.InternalSizing)return C.bindElementSize("#root",!0,!0,(()=>{m()}))}),[C,m,b,u]),(0,$.useEffect)((()=>{"boolean"==typeof a&&m()}),[a,m]),(0,$.useEffect)((()=>{if(!C||!b||u!==p.aY.ExternalSizing)return;const e=L(pt(),C.getDocument());return()=>{e.remove()}}),[C,b,u]),(0,$.useEffect)((()=>{r&&g&&b&&g.focus()}),[r,g,b]),(0,M.h)("iframe",{className:F()("ld-app-cont",{"ld-app-launcher":!h,"ld-app-window":h},n),onLoad:()=>_(!0),tabIndex:S,ref:v,style:O},k&&C&&C.getDocument()&&b&&Ne((0,M.h)(Qe.A,{document:C.getDocument(),iframe:C},t,(0,M.h)(Ze,null),(0,M.h)(Ye,null)),k))}var bt=s(7852),_t=s(8949),wt=s(5468);const xt={enable_rating:!1,allow_empty:!1,answer_motif_id:null,bot_id:0,category_id:null,dropdown_id:null,email_non_free:!1,id:0,img_overlay:null,is_end:!1,is_multiline:!1,is_location:!1,is_country:!1,is_city:!1,is_zip_code:!1,is_name:!1,is_email:!1,is_phone:!1,is_company_name:!1,is_personalization_booking:!1,is_sensitive:!1,is_other:!1,is_live_chat:!1,is_fb_chat:!1,is_trigger_lead:!1,is_wa_chat:!1,label_id:null,lookup_query_id:null,lookup_settings_id:null,max_answers_count:20,min_answers_count:0,media_settings:null,meta:{},next_no:2,order_no:1,score:0,start_message:null,sub_text:null,type:p.xi.Say,text:null,video_overlay:null};var Ct;!function(e){e.Calendar="calendar",e.CustomForm="custom-form",e.MultiChoice="multiple-choice",e.SaySomething="say-something",e.SingleChoice="single-choice",e.SingleChoiceUrl="single-choice-url",e.Carousel="carousel"}(Ct||(Ct={}));var kt=s(7201),St=s(5429),Ot=s(1944);function jt(e){var t;let{children:r,isLatest:i,item:o,nodeId:s,botIcon:a}=e;const{dispatch:l}=(0,$.useContext)(Y.p),[c]=(0,St.z)(Ot.R,"loaded"),u=(0,$.useMemo)((()=>c.filter((e=>{var t;return e.rendersFlowItem&&e.rendersFlowItem(o.type)&&(null===(t=o.question)||void 0===t?void 0:t.type)!==n.xi.Rating}))),[c,o]),d=u.length>0?u[0]:null;return(0,M.h)(M.Fragment,null,d&&d.rendersFlowItem&&(0,M.h)(M.Fragment,null,null===(t=d.renderFlowItem)||void 0===t?void 0:t.call(d,{dispatch:l,item:o,nodeID:s,isLatest:i,botIcon:a}))||r)}var Pt=s(329),Et=s(1981),Tt=s(2131),It=s(1329),Nt=s(3985);function At(e){let{userData:t,nodeId:n,timestamp:r}=e;const i=(0,$.useMemo)((()=>(0,It.r6)(r)),[r]),o=(0,$.useMemo)((()=>{const e=[];return Object.keys(t).forEach((n=>{e.push({text:t[n],iconType:n})})),e}),[t]);return(0,M.h)("div",{className:"lc-message-user"},(0,M.h)(re.vJ,{nodeId:n,classNames:"ld-answer",isAnswer:!0},(0,M.h)("span",{className:"visually-hidden"},(0,Et.t)("a11y.own.sent-by")),o.map(((e,t)=>(0,M.h)("div",{className:"ld-answer-row",key:t},e.iconType&&(0,M.h)(re.In,{className:"ld-answer-row-icon",name:Tt.XP[e.iconType],alt:(0,Et.t)(Tt.Hj[e.iconType])}),(0,M.h)(Nt.m,{key:t,text:e.text,freeInput:!0}))))),r&&(0,M.h)(re.eE,{status:re.qp.SENT,time:i}))}const Lt="event-assign-new",Dt="event-assign-transfer",Rt="event-client-rejoin",Mt="event-client-leave",$t="event-ended-agent";function Ut(e){let{payload:t,text:n}=e;const r=(0,$.useMemo)((()=>{const e=`lc.event.${n}`;return[Rt,Mt].includes(n)?null:[Lt,Dt,$t].includes(n)?(0,Et.t)(e,{name:t.name}):(0,Et.t)(e)}),[t,n]);return r&&(0,M.h)("div",{className:"lc-event"},(0,M.h)("div",{className:"lc-event-bar"}),(0,M.h)(re.o5,{className:"lc-event-text"},r),(0,M.h)("div",{className:"lc-event-bar"}))}function Ft(e){let{startMessage:t,nodeId:n,timestamp:r}=e;const i=(0,$.useMemo)(o.tU,[]),s=(0,$.useMemo)((()=>(0,It.r6)(r)),[r]);return(0,M.h)("div",{className:"lc-message-info"},(0,M.h)(re.vJ,{nodeId:n,classNames:"ld-question"},(0,M.h)(re.o5,null,i.botName&&(0,M.h)("span",{className:"visually-hidden"},(0,Et.t)("a11y.sent-by",{name:i.botName})),(0,M.h)("span",{dangerouslySetInnerHTML:{__html:t}}))),r&&(0,M.h)(re.eE,{status:re.qp.SENT,time:s}))}function qt(e){let{message:t,isOwnMessage:n,altMessage:r}=e;return(0,M.h)(re.o5,null,(0,M.h)("div",{"data-settings":n?"bot-answer-text":"bot-question-text",className:F()({"ld-answer-content":n,"ld-answer-content-empty":!t}),dangerouslySetInnerHTML:{__html:t||r}}))}var Bt;!function(e){e.ForbiddenFileExtension="common.validation.forbidden-extension",e.ForbiddenFileContentType="common.validation.forbidden-content-type",e.InvalidContentType="common.validation.content-type",e.InvalidExtension="common.validation.extension",e.InvalidMaxSize="common.validation.max-size",e.InvalidMaxHeight="common.validation.max-height",e.InvalidMaxWidth="common.validation.max-width",e.InvalidMinSize="common.validation.min-size"}(Bt||(Bt={}));const zt={ffd8ffe0:"image/jpeg",ffd8ffe1:"image/jpeg",ffd8ffe2:"image/jpeg","89504e47":"image/png",47494638:"image/gif",52494646:"image/webp","00002fb5":"image/avif","00020":"image/avif","00000020":"image/avif","504b0304":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",d0cf11e0:"application/vnd.ms-excel"},Vt={allowed_extensions:["jpg","jpeg","png","gif","webp","avif"],allowed_content_types:["image/webp","image/png","image/avif","image/gif","image/jpeg"],allowed_empty_extension:!0,max_size:10485760,max_height:null,max_width:null,min_size:1024,forbidden_extensions:[],forbidden_content_types:[]},Ht=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],Wt=e=>{const t=Math.abs(e),n=[];let r=0,i=Math.floor(Math.log(t)/Math.log(1e3));if(i>8?i=8:i<0&&(i=0),0===t)n[0]=0,n[1]=Ht[0];else{r=t/Math.pow(1e3,i);const e=Math.pow(10,2);n[0]=Math.round(r*e)/e,n[1]=1===i?"kB":Ht[i]}return n.join(" ")};async function Gt(e,t,n){const{width:r,height:i}=await async function(e){return new Promise(((t,n)=>{const r=new Image;r.src=URL.createObjectURL(e),r.onload=()=>{const{width:e,height:n}=r;URL.revokeObjectURL(r.src),t({width:e,height:n})},r.onerror=n}))}(e);t.max_width&&r&&!function(e,t){return e.max_width&&e.max_width>t}(t,r)&&n.push({errorKey:Bt.InvalidMaxWidth,errorParams:{width:t.max_width}}),t.max_height&&i&&!function(e,t){return e.max_height&&e.max_height>t}(t,i)&&n.push({errorKey:Bt.InvalidMaxHeight,errorParams:{height:t.max_height}})}async function Qt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vt;const{name:n,size:r}=e,i=await async function(e){try{const t=await e.arrayBuffer(),n=new Uint8Array(t).slice(0,4),r=Array.from(n).map((e=>e.toString(16).padStart(2,"0"))).join("");return"text/csv"===e.type?"text/csv":zt[r]||"unknown"}catch(e){return console.error("Error reading file:",e),"unknown"}}(e),o=function(e,t){var n,r;const i=[],o=e.name.split("."),s=o.length>1&&null!==(n=null===(r=o.pop())||void 0===r?void 0:r.toLowerCase())&&void 0!==n?n:"";return function(e,t){return!(!e.allowed_empty_extension||""!==t)||e.allowed_extensions.includes(t)}(t,s)||i.push({errorKey:Bt.InvalidExtension,errorParams:{extensions:t.allowed_extensions.join(", ")}}),function(e,t){return!(!e.allowed_empty_extension||""!==t)||!e.forbidden_extensions.includes(t)}(t,s)||i.push({errorKey:Bt.ForbiddenFileExtension}),function(e,t){return e.allowed_content_types.includes(t)}(t,e.mimetype)||i.push({errorKey:Bt.InvalidContentType,errorParams:{content_types:t.allowed_content_types.join(", ")}}),function(e,t){return!e.forbidden_content_types.includes(t)}(t,e.mimetype)||i.push({errorKey:Bt.ForbiddenFileContentType}),function(e,t){return e.max_size>t}(t,e.size)||i.push({errorKey:Bt.InvalidMaxSize,errorParams:{size:Wt(t.max_size)}}),function(e,t){return e.min_size{r.preview?l(!1):async function(){if(!r.token)return;l(!0),(0,Yt.B)(r.botID,"bot ID"),(0,Yt.B)(r.leadID,"lead ID");const t=await(0,_t.DZ)({attachmentID:e.attachment.attachmentID,leadID:r.leadID,token:r.token});s(t);const n=await async function(t){const n=await fetch(t),r=await n.blob(),i=new File([r],e.attachment.title),o=await Qt(i);return o.length?o:null}(t);u(!n),l(!1)}()}),[]),(0,M.h)(M.Fragment,null,a?(0,M.h)(re.$p,{value:70}):(0,M.h)(M.Fragment,null,d===Kt.IMAGE&&(0,M.h)(re.fL,{buttonText:(0,Et.t)("a11y.attachment.image-preview.download"),onButtonClick:h,onClick:function(){c&&i&&(t(i),n(!0))},imgUrl:i,imageAlt:(0,Et.t)("a11y.attachment.image-preview.image-alt")}),d===Kt.FILE&&(0,M.h)(re.Hg,{file:e.attachment,handleDownload:h,downloadID:e.attachment.attachmentID,deleteAlt:(0,Et.t)("a11y.attachment.delete-icon-alt"),imageAlt:(0,Et.t)("a11y.attachment.image-icon-alt"),fileAlt:(0,Et.t)("a11y.attachment.file-icon-alt"),isAnswer:!0})))}!function(e){e.IMAGE="image",e.FILE="file"}(Kt||(Kt={}));const Xt=/\.(jpg|jpeg|png|gif|webp|avif)$/gi;function en(e){var t,n;let{attachments:r=[],nodeId:i,ownMessage:o,status:s,text:a,timestamp:l}=e;const{state:c}=(0,$.useContext)(ne.f),u=(0,$.useMemo)((()=>(0,It.r6)(l)),[l]),d=(0,$.useMemo)((()=>a.split(/\n/).map((e=>e))),[a]),h=d.length>1,f=(0,$.useMemo)((()=>{switch(s){case p.dm.Failed:return re.qp.ERROR;case p.dm.Sending:return re.qp.SENDING;case p.dm.Sent:return re.qp.SENT;default:return}}),[s]),m=(0,$.useMemo)((()=>r.map((e=>{var t;return{title:e.filename,attachmentID:e.id,isLoaded:!0,isImage:Boolean(null===(t=e.filename)||void 0===t?void 0:t.match(Xt)),size:e.size}}))),[r]),g=h||Boolean(m.length)?"":(0,Et.t)("lc.empty-message");return(0,M.h)("div",{className:F()({"lc-message-agent":!o,"lc-message-user":o})},(0,M.h)(re.vJ,{nodeId:i,classNames:F()({"ld-question":!o,"ld-answer":o}),isAnswer:o,dataSettings:o?"bot-answer":"bot-question",isColumn:!0},(0,M.h)("span",{className:"visually-hidden"},o?(0,Et.t)("a11y.own.sent-by"):(0,Et.t)("a11y.sent-by",{name:null!==(t=null===(n=c.agent)||void 0===n?void 0:n.name)&&void 0!==t?t:""})),d.map(((e,t)=>(0,M.h)(qt,{key:t,isOwnMessage:o,message:e,altMessage:g}))),m.map((e=>(0,M.h)(Zt,{attachment:e,key:e.attachmentID})))),l&&(0,M.h)(re.eE,{status:f,time:u}))}function tn(e){var t;let{hidden:n}=e;const{cancelTimeout:r,state:i}=(0,$.useContext)(ie.k),{dispatch:o}=(0,$.useContext)(Y.p),s=(0,$.useRef)(null),{timeoutCancelled:a,timeoutSecondsLeft:l,timeout:c}=i,u=a?(0,Et.t)("livechat.timeout.cancelled"):null!==(t=null==c?void 0:c.timeoutMessage)&&void 0!==t?t:(0,Et.t)("livechat.timeout.timing-out"),d=(0,$.useMemo)((()=>new Date(1e3*(null!=l?l:0)).toISOString().substring(14,19)),[l]),h=0===l,p=(0,$.useCallback)((()=>{r(),o({type:Z.Ud.HideLiveChatTimeout})}),[r]);return(0,$.useEffect)((()=>{var e;n||h||null===(e=s.current)||void 0===e||e.focus()}),[n]),n?null:(0,M.h)(M.Fragment,null,(0,M.h)("div",{className:F()("lc-message-agent","lc-timeout")},(0,M.h)(re.vJ,{nodeId:"unique-id",classNames:"ld-question",isColumn:!0},(0,M.h)("div",{className:"timeout-content"},(0,M.h)(re.o5,{className:F()({"timer-visible":!h})},u),!h&&(0,M.h)(M.Fragment,null,(0,M.h)(re.o5,{className:"timeout-description"},(0,Et.t)("livechat.timeout.description")),null!==l&&(0,M.h)("div",{role:"timer","aria-live":l%10?"off":"polite",className:"timeout-counter"},d))),!h&&(0,M.h)("div",{className:"lc-keep-waiting"},(0,M.h)(re.$n,{className:"lc-waiting",ref:s,onClick:p},(0,Et.t)("livechat.timeout.button-wait"),(0,M.h)("span",{className:"visually-hidden"},(0,Et.t)("livechat.timeout.button-wait.description")))))))}var nn=s(2095),rn=s(7846);function on(e){let{question:t,botIcon:n,nodeId:r}=e;const i=(0,o.tU)(),{submitAnswer:s,dispatch:a}=(0,$.useContext)(Y.p),[l,c]=(0,$.useState)(!1),u=(0,$.useMemo)((()=>{var e;const n=null===(e=i.companyRatings)||void 0===e?void 0:e.find((e=>e.type===kt.p[p.eU.BOT])),r={feedback_title:(null==n?void 0:n.feedback_title)||(0,Et.t)("bot-rating.feedback-label"),feedback_placeholder:(null==n?void 0:n.feedback_placeholder)||(0,Et.t)("chat.bot-rating.feedback-placeholder"),submit_button_text:(null==n?void 0:n.submit_button_text)||(0,Et.t)("chat.bot-rating.feedback-send-button"),rating_title:(null==n?void 0:n.rating_title)||(0,Et.t)("chat.bot-rating.feedback-rate-header"),rating_subtitle:(null==n?void 0:n.rating_subtitle)||(0,Et.t)("chat.bot-rating.feedback-rate-subheader")};var o,s,a,l,c;return(null==t?void 0:t.type)===p.xi.Rating?{feedback_title:(null==t||null===(o=t.meta)||void 0===o||null===(o=o.ratingSettings)||void 0===o?void 0:o.feedbackTitle)||(null==r?void 0:r.feedback_title),feedback_placeholder:(null==t||null===(s=t.meta)||void 0===s||null===(s=s.ratingSettings)||void 0===s?void 0:s.feedbackPlaceholder)||(null==r?void 0:r.feedback_placeholder),submit_button_text:(null==t||null===(a=t.meta)||void 0===a||null===(a=a.ratingSettings)||void 0===a?void 0:a.submitButtonText)||(null==r?void 0:r.submit_button_text),rating_title:(null==t||null===(l=t.meta)||void 0===l||null===(l=l.ratingSettings)||void 0===l?void 0:l.title)||(null==r?void 0:r.rating_title),rating_subtitle:(null==t||null===(c=t.meta)||void 0===c||null===(c=c.ratingSettings)||void 0===c?void 0:c.subtitle)||(null==r?void 0:r.rating_subtitle)}:r}),[t]),d=(0,$.useCallback)((async()=>{try{await s("",null)}catch(e){console.error(e)}}),[s]);return(0,$.useEffect)((()=>{!i.leadID&&t&&(0,rn.ls)(t,i)}),[i.leadID]),(0,M.h)("div",{className:F()("rating-wrapper","question-wrapper"),"data-nodeid":r,"data-questionid":null==t?void 0:t.id},n&&(0,M.h)(re.eu,{className:"question-avatar",src:null!=n?n:"",alt:(0,Et.t)("chat.bot-avatar-alt")}),!n&&(0,M.h)("div",{className:"question-icon-margin"}),(0,M.h)(re.vJ,{nodeId:r,classNames:F()("ld-question")},(0,M.h)(M.Fragment,null,(0,M.h)(re.Rq,{returnText:(0,Et.t)("chat.bot-rating.feedback-return-text"),rateHeaderText:u.rating_title,rateSubheaderText:u.rating_subtitle,feedbackLabel:u.feedback_title,feedbackPlaceholder:u.feedback_placeholder,feedbackSendButtonText:u.submit_button_text,maxLength:2048,onClose:d,onChange:(e,t)=>{const n=(0,_t.K6)(e,p.eU.BOT,t,i,"");return c(!1),n.then((()=>{a({type:Z.Ud.VisualBotRating})})).catch((e=>{console.error({e}),c(!0)})),n},error:l,helperText:(0,Et.t)(l?"chat.rating.submit-error":""),successHeader:(0,Et.t)("chat.bot-rating.feedback-success-header"),successSubheader:(0,Et.t)("chat.bot-rating.feedback-success-subheader"),isLast:i.finished}))))}function sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function an(e){for(var t=1;t{var t;let{botIcon:r,isLatest:i,item:s,nodeId:a,answerAnimation:l,isInpage:c}=e;const u=(0,$.useMemo)(o.tU,[]),{dispatch:d,state:h}=(0,$.useContext)(Y.p),{dispatch:f}=(0,$.useContext)(K.d),m=s.type===Z.rV.Question&&s.question.type!==n.xi.LiveChat&&s.question.type!==n.xi.AI,g=s.type===Z.rV.Answer&&!s.answer.is_live_chat,v=null===(t=u.companyRatings)||void 0===t||null===(t=t.find((e=>e.type===kt.p[p.eU.BOT])))||void 0===t?void 0:t.enabled,y=s.type===Z.rV.Question&&s.question.type===n.xi.Rating,b=h.feedback.submited.includes(p.eU.BOT);return(0,$.useEffect)((()=>{var e;null!==(e=u.companyRatings)&&void 0!==e&&null!==(e=e.find((e=>e.type===kt.p[p.eU.BOT])))&&void 0!==e&&e.enabled&&u.finished&&u.leadID&&(m||g)&&i&&d({type:Z.Ud.BotRatingPrompt,feedbackType:p.eU.BOT,open:!0}),s.type===Z.rV.Question&&s.question.type===n.xi.Rating&&u.leadID&&d({type:Z.Ud.BotRatingPrompt,feedbackType:p.eU.BOT_NODE,open:!0}),s.type===Z.rV.Question&&s.question.type===n.xi.Rating&&h.feedback.submited.includes(p.eU.BOT_NODE)&&(async()=>{await(0,wt.G)(s.question.is_end,s.question.next_no,d,f,u)})()}),[]),(0,$.useEffect)((()=>{v&&u.finished&&c&&!y&&!b&&d({answers:[],question:an(an({},xt),{},{id:-1,bot_id:-1,type:n.xi.Rating}),type:Z.Ud.AddQuestion})}),[y]),(0,M.h)(jt,{botIcon:r,isLatest:i,item:s,nodeId:a},s.type===Z.rV.Question&&s.question.type!==n.xi.Rating&&(0,M.h)(nn.v,{botIcon:r,nodeId:a,question:s.question,showMedia:!0}),c&&s.type===Z.rV.Question&&s.question.type===n.xi.Rating&&(0,M.h)(on,{botIcon:r,nodeId:a,question:s.question}),s.type===Z.rV.Answer&&(0,M.h)(Pt.y,{nodeId:a,answer:s.answer,freeInput:s.freeInput,answerAnimation:l}),s.type===Z.rV.LiveChatInfoMessage&&(0,M.h)(Ft,{nodeId:a,startMessage:s.payload,timestamp:s.ts}),s.type===Z.rV.LeadCriteria&&(0,M.h)(At,{nodeId:a,userData:s.payload,timestamp:s.ts}),s.type===Z.rV.LiveChatMessage&&(0,M.h)(en,{attachments:s.attachments,nodeId:a,ownMessage:s.ownMessage,status:s.status,text:s.text,timestamp:s.ts}),s.type===Z.rV.LiveChatEvent&&(0,M.h)(Ut,{payload:s.payload,text:s.text}),s.type===Z.rV.LiveChatTimeout&&(0,M.h)(tn,{hidden:s.hidden}))}));function un(e){let{isLCActive:t}=e;return(0,M.h)("div",{className:"lc-start-prompt"},(0,M.h)(re.o5,{align:"center",className:F()("lc-start-prompt-text",{"lc-start-prompt-fadeout":t})},(0,Et.t)("lc.start.prompt.message")))}function dn(e){let{botIcon:t,nodeId:n}=e;return(0,M.h)("div",{className:"question-wrapper","data-nodeid":n},t&&(0,M.h)(re.eu,{className:"question-avatar",src:null!=t?t:"",alt:(0,Et.t)("chat.bot-avatar-alt")}),!t&&(0,M.h)("div",{className:"question-icon-margin"}),(0,M.h)(re.vJ,{nodeId:n,classNames:F()("ld-question","ld-loading")},(0,M.h)("span",{className:"visually-hidden"},(0,Et.t)("chat.question.loading")),(0,M.h)(re.Rh,{animation:"typing"})))}var hn=s(8098),pn=s(9505);function fn(e){let{classNamePrefix:t,brandingLink:n,className:r,overlayPosition:i=!1}=e;const{branding:s,privacyURL:a,privacyText:l}=(0,$.useMemo)(o.tU,[]),[c,u]=function(){const e=(0,$.useMemo)(o.tU,[]),t=(0,$.useMemo)((()=>e.consent),[]);return[(0,Je.P)("consent"),t]}(),d=(0,$.useMemo)((()=>c!==u),[c,u]),h=function(e){const t=e.indexOf("{"),n=e.lastIndexOf("}");if(-1!==t&&-1!==n&&tBoolean(e.value)))}return[{type:"text",value:e}]}(l||`${(0,Et.t)("privacy.interact")} {${(0,Et.t)("privacy.terms")}}`);return(0,M.h)("div",{className:F()(`${t}-powered-by`,c&&!s&&"hidden",d&&"animated",{overlay:i,[null!=r?r:""]:r})},(0,M.h)("div",{className:F()("disclaimer",!c&&"visible",d&&"animated"),"data-settings":"disclaimer"},h.map(((e,t)=>"text"===e.type?(0,M.h)(M.Fragment,{key:t},e.value):(0,M.h)("a",{key:t,href:null!=a?a:void 0,rel:"noreferrer",target:"_blank"},e.value,(0,M.h)("span",{className:"visually-hidden"},`(${(0,Et.t)("a11y.link.new-tab")})`))))),s&&(0,M.h)("div",{className:F()("link",c&&"visible",d&&"animated")},(0,M.h)("a",{className:"branding-link",href:n,rel:"noreferrer",target:"_blank",lang:"en","data-settings":"disclaimer"},"Powered By ",(0,M.h)("span",{className:"semi-bold"},"Leadoo"),(0,M.h)("span",{className:"visually-hidden"},`(${(0,Et.t)("a11y.link.new-tab")})`))))}const mn=(e,t)=>{const n=(0,$.useCallback)((t=>{if("Escape"===t.code)return t.preventDefault(),void e()}),[e]);(0,$.useEffect)((()=>((t||document).addEventListener("keydown",n),()=>(t||document).removeEventListener("keydown",n))),[n,t])};var gn=s(6055),vn=s(9440),yn=s(6281),bn=s(9594),_n=s(9747);function wn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xn(e){for(var t=1;t!l.filter((e=>Boolean(e.error))).length),[l]);(0,$.useEffect)((()=>{if(0===g.length){if(y.length>0)try{n(l)}catch(e){m((0,Et.t)("error.visual.attachment-upload"))}return}const[e]=g;if(!u.token)throw new Error("No token available");(0,_t.vX)(e,r.id).then((e=>{u.leadID||(u.leadID=e.leadID);const t=l.length-g.length,n=l.map(((n,r)=>r===t?xn(xn({},n),{},{attachmentID:e.attachmentID,isLoaded:!0}):n));c(n),b([...y,e.attachmentID]),v(g.slice(1))})).catch((e=>{console.error(e.message);const t=l.map((e=>xn(xn({},e),{},{attachmentID:void 0,isLoaded:void 0})));c(t),b([]),v([]),m((0,Et.t)("error.visual.attachment-upload"))}))}),[r,g,l,y,d,u]);const w=(0,$.useCallback)(((e,t)=>{m(null);const n=e.map((e=>{var t;const n=(0,_n.UU)(e,u),r={title:e.name,size:e.size,file:e,isImage:Boolean(null===(t=e.name)||void 0===t?void 0:t.match(Sn))};return n?xn(xn({},r),{},{error:{message:n}}):r})).slice(0,yn.FC-t.length);t=[...t,...n],c(t)}),[l]),x=(0,$.useCallback)((()=>{if(!l.length)return void m((0,Et.t)("error.attachments.required"));const e=l.map((e=>e.file)),t=l.map((e=>xn(xn({},e),{},{isLoaded:!1})));c(t),v(e)}),[l]),C=(0,$.useCallback)(((e,t)=>{c(l.filter(((e,n)=>n!==t))),m(null)}),[l]);return(0,M.h)(M.Fragment,null,(0,M.h)(kn.Provider,{value:{files:l,onDeleteFile:C,handleFileUpload:w,handleSkipAttachments:()=>{n([])},setUploadError:m,uploadingQueue:g,uploadError:f,showSkipButton:p,submitting:i}},t),(0,M.h)(re.$n,{disabled:i||g.length>0||!_,onClick:x,className:s},a?(0,M.h)(M.Fragment,null,h||(0,Et.t)("answer.submit.label"),"Ā ",(0,M.h)(re.In,{name:vn.pOT,decorative:!0})):h||(0,Et.t)("answer.submit.label")))}function jn(e){let{errorMessage:t}=e;const{files:n,onDeleteFile:r,submitting:i,setUploadError:o,uploadingQueue:s,handleFileUpload:a,handleSkipAttachments:l,showSkipButton:c,uploadError:u}=(0,$.useContext)(kn),d=t||u;return(0,M.h)(M.Fragment,null,(0,M.h)(re.sX,{files:n,onDeleteFile:r,title:(0,Et.t)("up.drop-or-browse"),uploadFiles:e=>{o(null),a(e,[...n])},disableEvents:i||s.length>0,deleteAlt:(0,Et.t)("a11y.attachment.delete-icon-alt"),imageAlt:(0,Et.t)("a11y.attachment.image-icon-alt"),fileAlt:(0,Et.t)("a11y.attachment.file-icon-alt"),uploadAlt:(0,Et.t)("a11y.attachment.upload-icon-alt"),skipTitle:c?(0,Et.t)("a11y.attachment.skip"):void 0,fileLoadedTitle:(0,Et.t)("a11y.attachment.loaded"),onSkip:l}),d&&(0,M.h)(re.o5,{className:F()("validation-error","attachments-error"),role:"alert"},u||t))}var Pn=s(798),En=s(7547),Tn=s(4215);const In={[n.xi.NamePrompt]:vn.PMU,[n.xi.EmailPrompt]:vn.Hws,[n.xi.CompanyPrompt]:vn.u$N,[n.xi.TextPrompt]:void 0},Nn="input.label.",An={[n.xi.NamePrompt]:`${Nn}name`,[n.xi.CompanyPrompt]:`${Nn}companyName`,[n.xi.EmailPrompt]:`${Nn}email`,[n.xi.TextPrompt]:`${Nn}other`};function Ln(e){var t,r,i,o,s,a,l;let{handleSubmit:c,question:u,setAnswer:d,submitting:h,fullWidth:p=!1,disableAutofocus:f=!1}=e;const[m,g]=(0,$.useState)(""),[v,y]=(0,$.useState)(null),b=(0,bn.Q)(u,"continueText",!1),_=(0,$.useMemo)((()=>An[u.type]?u.allow_empty?`${(0,Et.t)(An[u.type])}`:`${(0,Et.t)(An[u.type])} (${(0,Et.t)("input.required")})`:void 0),[u]),w=((e,t)=>{switch(e){case n.xi.NamePrompt:return t===n.UL.FirstName?(0,Et.t)("input.firstName.placeholder"):t===n.UL.LastName?(0,Et.t)("input.lastName.placeholder"):(0,Et.t)("input.name.placeholder");case n.xi.EmailPrompt:return(0,Et.t)("input.email.placeholder");case n.xi.CompanyPrompt:return(0,Et.t)("input.company.placeholder");case n.xi.TextPrompt:return(0,Et.t)("input.message.placeholder");default:return""}})(u.type,null!==(t=null===(r=u.meta)||void 0===r?void 0:r.name)&&void 0!==t?t:""),x=(0,Tt.T)(null===(i=u.meta)||void 0===i?void 0:i.placeholder,w),C=((e,t)=>{switch(e){case n.xi.NamePrompt:return t===n.UL.FirstName?(0,Et.t)("input.placeholder.firstName"):t===n.UL.LastName?(0,Et.t)("input.placeholder.lastName"):(0,Et.t)("input.placeholder.name");case n.xi.EmailPrompt:return(0,Et.t)("input.placeholder.email");case n.xi.CompanyPrompt:return(0,Et.t)("input.placeholder.companyName");case n.xi.TextPrompt:return(0,Et.t)("input.placeholder.message");default:return""}})(u.type,null!==(o=null===(s=u.meta)||void 0===s?void 0:s.name)&&void 0!==o?o:""),k=(0,Tt.T)(null===(a=u.meta)||void 0===a?void 0:a.label,C),S=(0,Pn.CN)(u,[]),O=(0,$.useCallback)((async()=>{const[e,t=null]=S(m);if(e){if(u.type===n.xi.EmailPrompt&&u.email_non_free&&m){const e=await(0,Tn.B)(u.id,m);if(e)return void y(e)}try{await c(m)}catch(t){const e=(0,En.k)(t);y(e)}}else y(t)}),[c,u,m]);return(0,M.h)("form",{className:"answer-prompt-form"},(0,M.h)("div",{className:F()("answer-prompt-wrapper","zoom-scroll")},(0,M.h)(re.PM,{ariaLabel:_,autocomplete:null!==(l=(0,Xe.ub)(u.type))&&void 0!==l?l:"on",autoFocus:!f,disabled:h,error:Boolean(v),fullWidth:p,helperText:null!=v?v:"",isMultiline:u.is_multiline,label:k,newLineOnEnter:u.is_multiline,maxLength:(0,Tt.$O)(u.type),onChange:e=>{g(e),d(e),y(null)},onSubmit:O,placeholder:x,required:!u.allow_empty,startIcon:In[u.type],submitOnEnter:!u.is_multiline,value:m})),(0,M.h)(re.$n,{disabled:h,className:"submit-btn",onClick:O},b||(0,Et.t)("answer.submit.label")))}function Dn(e,t){return"number"==typeof e.min_answers_count&&e.min_answers_count>t?{message:"invalid.min-answers",param:{min:e.min_answers_count.toString()}}:"number"==typeof e.max_answers_count&&e.max_answers_count({title:e.text,id:e.id}))),b=(0,$.useCallback)((e=>{if(h.mock)return;g(null);const n=t.filter((t=>e.find((e=>e===t.id))));f(e),r(n)}),[t,r]),_=(0,$.useCallback)((async()=>{const e=Dn(n,p.length);if(e)return void g((0,Et.t)(e.message,e.param));g(null);const r=t.filter((e=>p.find((t=>t===e.id)))),o=(0,rn.Bw)(t,r,null);try{await i(r,o)}catch(e){const t=(0,En.k)(e);g(t)}}),[t,i,n,p]);return(0,M.h)(M.Fragment,null,(0,M.h)(Rn.Provider,{value:{maxAnswers:n.max_answers_count,minAnswers:n.min_answers_count,onSelect:b,options:y,selectedOptions:p,submitting:s,validationError:m,disableAutofocus:l}},a),(0,M.h)(re.$n,{disabled:s,className:"submit-btn",onClick:_,dataSettings:u,dataSettingsText:d},c?(0,M.h)(M.Fragment,null,v||(0,Et.t)("answer.submit.label"),"Ā ",(0,M.h)(re.In,{name:vn.pOT,decorative:!0})):v||(0,Et.t)("answer.submit.label")))}function $n(e){let{animation:t=re.n0.FADEIN,isInpage:n=!1}=e;const{submitting:r,onSelect:i,selectedOptions:o,options:s,validationError:a,minAnswers:l,maxAnswers:c,disableAutofocus:u}=(0,$.useContext)(Rn),d="number"==typeof l||"number"==typeof c,h=(0,$.useMemo)((()=>{const e="number"==typeof c;return e&&!l?"chat.multiple-choice.hint":"number"==typeof l&&e?"chat.multiple-choice.hint-required":"chat.multiple-choice.hint.min-only"}),[c,l]);return(0,M.h)(M.Fragment,null,d&&(0,M.h)(re.o5,{id:"multiple-choice-label",className:"multiple-choice-hint"},(0,Et.t)(h,{minAnswers:String(l),maxAnswers:String(Math.min(null!=c?c:1,s.length))})),(0,M.h)(re.ni,{ariaLabeledBy:"multiple-choice-label",disabled:r,selectedOptions:o,onChange:i,options:s,isInpage:n,choiceAnimation:t,isValid:!a,disableAutofocus:u,isMultiple:!0,validationID:"validation"}),a&&(0,M.h)(re.o5,{ariaLive:"assertive",id:"validation",className:"validation-error"},a))}function Un(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Fn(e){for(var t=1;tfunction(e){var t;if(e.type===n.xi.NamePrompt)switch(null===(t=e.meta)||void 0===t?void 0:t.name){case n.UL.FirstName:return["firstName"];case n.UL.LastName:return["lastName"];case n.UL.Separate:return["firstName","lastName"];default:return["name"]}const r=[["is_name","name"],["is_email","email"],["is_phone","phone"],["is_company_name","companyName"],["is_location","location"],["is_city","city"],["is_country","country"],["is_zip_code","zip"],["is_other","other"]].reduce(((t,n)=>(e[n[0]]&&t.push(n[1]),t)),[]);if(r.length>0)return r;switch(e.type){case n.xi.CompanyPrompt:return["companyName"];case n.xi.EmailPrompt:return["email"];case n.xi.NamePrompt:return["name"];case n.xi.TextPrompt:return["other"];case n.xi.PhonePrompt:return["phone"];default:return[]}}(t)),[t]),[b,_]=(0,$.useState)(y.reduce(((e,t)=>Fn(Fn({},e),{},{[t]:""})),{})),w=(0,Pn.dz)(t,i,y),x=(0,$.useCallback)((async()=>{let e=!0;const n={};return await Promise.all(y.map((async(r,i)=>{const[o,s=null]=w[i](b[r]);if(o){const i=await async function(e,t,n){if(!e)return null;if(t===p.sw.Phone){const t=(0,_n.oW)(e);return null!=t?t:null}if(t===p.sw.Email&&n.email_non_free){const t=await(0,Tn.B)(n.id,e);return null!=t?t:null}return null}(b[r],r,t);i&&(e=!1,n[r]=i)}o||(e=!1),s&&(n[r]=s)}))),h(n),e}),[y,b,w]),C=(0,$.useCallback)((async()=>{if(await x())try{await o(b)}catch(e){const t=(0,En.k)(e);m(t)}}),[t,i,o,b,d]);return(0,M.h)("form",{className:"answer-prompt-form"},(0,M.h)(Bn.Provider,{value:{inputs:y,inputValues:b,setInputValues:_,responseError:f,setResponseError:m,validationErrors:d,setValidationErrors:h,handleSubmitClick:C,autoFocusDelay:l,disableAutofocus:c}},r),(0,M.h)(re.$n,{disabled:s,className:a,onClick:C},u?(0,M.h)(M.Fragment,null,v||(0,Et.t)("answer.submit.label"),"Ā ",(0,M.h)(re.In,{name:vn.pOT,decorative:!0})):v||(0,Et.t)("answer.submit.label")))}function Vn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hn(e){for(var t=1;tr.reduce(((e,t)=>Hn(Hn({},e),{},{[t]:"firstName"===t&&g&&g[0]||"lastName"===t&&g&&(g[1]||g[0])||(0,Et.t)(`input.${t}.placeholder`)})),{})),[r]),b=(0,$.useMemo)((()=>r.reduce(((e,t)=>Hn(Hn({},e),{},{[t]:"firstName"===t&&v&&v[0]||"lastName"===t&&v&&(v[1]||v[0])||(0,Et.t)(`input.placeholder.${t}`)})),{})),[r]),_=(0,$.useCallback)(((e,t)=>{if(o(Hn(Hn({},i),{},{[e]:t})),s(null),l[e]){const t=Hn({},l);delete t[e],c(t)}}),[i,l]),w=(0,$.useCallback)((e=>{if(e===r.length-1)u();else{const t=e+1;m.current[t].focus()}}),[u,r,m]);return(0,$.useEffect)((()=>{m.current&&m.current[0]&&!h&&setTimeout((()=>{m.current[0].focus()}),d)}),[m.current,d,h]),(0,M.h)(M.Fragment,null,r.map(((e,r)=>{var o;return(0,M.h)("div",{key:e,className:"custom-field-item"},(0,M.h)(re.PM,{autocomplete:null!==(o=(0,Xe.Uu)(e))&&void 0!==o?o:"on",setExternalRef:e=>m.current[r]=e,error:Boolean(l[e]?l[e]:null),ariaLabel:(0,Et.t)(Tt.U2[e]),helperText:l[e],label:b[e],maxLength:(0,Tt.og)(e),onChange:t=>_(e,t),onEnterPress:()=>w(r),placeholder:y[e],startIcon:Tt.XP[e]||null,value:i[e],fullWidth:n,required:!t.allow_empty}))})),a&&(0,M.h)(re.o5,{className:"validation-error"},a))}function Qn(e){let{answers:t,handleSubmit:n,question:r,submitting:i,animation:s=re.n0.FADEIN,disableAutofocus:a=!1}=e;const l=(0,$.useMemo)(o.tU,[]),[c,u]=(0,$.useState)([]),d=t.map((e=>({title:e.text,id:e.id,linkTarget:e.is_sent_to_url?e.target_link:null,a11yTranslation:"_blank"===e.target_link?(0,Et.t)("a11y.link.new-tab"):(0,Et.t)("a11y.link.current-tab")}))),h=(0,$.useCallback)((async e=>{if(l.mock)return;if(1!==e.length)throw new Error(`Invalid single choice answer: Expected 1 option, received: ${e.length}`);const r=t.find((t=>t.id===e[0]));if(!r)throw new Error(`Invalid single choice answer: No answers in question with selected ID: ${e[0]}`);var i;(u(e),r&&r.url&&r.is_sent_to_url)&&(0,Jt.F)(r.url,null!==(i=r.target_link)&&void 0!==i?i:"_blank");try{await n(r,r.next_no)}catch(e){console.error(e)}}),[n,t,r]);return(0,M.h)(re.ni,{disabled:i,onChange:h,options:d,selectedOptions:c,choiceAnimation:s,disableAutofocus:a})}var Kn=s(5166),Yn=s(5721);async function Jn(){return s.e(667).then(s.bind(s,5059))}const Zn=()=>{};function Xn(e){let{children:t,disabled:n=!1,onClick:r=Zn}=e;const i=(0,o.tU)(),s=(0,$.useCallback)((e=>{e.preventDefault(),r()}),[r]);return(0,M.h)(re.$n,{dataSettings:"submit-btn",dataSettingsText:"submit-btn-text",className:"submit-btn",disabled:!i.mock&&n,onClick:s},t)}function er(e){let{answers:t,question:n,chatContainerRef:r,handleSubmit:i}=e;const[o]=(0,Yn.o)(Jn,[]),{document:s}=(0,$.useContext)(Qe._),a=n.type===p.xi.BookingCalendar,l=(0,$.useCallback)((async e=>{await i(e)}),[n,a]);return o?(0,M.h)("div",{className:"calendar-prompt"},(0,M.h)(o.Calendar,{continueButton:Xn,loader:(0,M.h)(re.$p,{className:"calendar-prompt-loading",value:50}),onSubmit:l,answers:t,question:n,chatContainerRef:r,winDocument:s})):(0,M.h)("div",{className:"calendar-prompt"},(0,M.h)(re.$p,{className:"calendar-prompt-loading",value:50}))}var tr=s(5591);function nr(e){var t,n,r;let{answers:i,question:s,handleSubmit:a,submitting:l}=e;const{document:c}=(0,$.useContext)(Qe._),u=(0,o.tU)(),d=(0,bn.Q)(s,"carouselType",!0),h=(0,bn.Q)(s,"continueText",!1),f=(0,bn.Q)(s,"confirmSubmit",!1),m=d===p.zm.Multiple,g=!m&&"boolean"==typeof f&&!1===f,[v,y]=(0,$.useState)([]),[b,_]=(0,$.useState)(null),w=i.filter((e=>{var t;return!(null!==(t=e.meta)&&void 0!==t&&t.exitAction)})),x=i.filter((e=>{var t;return null===(t=e.meta)||void 0===t?void 0:t.exitAction}))[0],C=Boolean(x&&(null===(t=x.meta)||void 0===t?void 0:t.isExitEnabled)),k=w.some((e=>{var t;return null===(t=e.meta)||void 0===t||null===(t=t.cardContent)||void 0===t?void 0:t.find((e=>Boolean(e.dynamic_meta_type)))})),S=w.some((e=>{var t;return null===(t=e.meta)||void 0===t||null===(t=t.cardContent)||void 0===t?void 0:t.find((e=>[re.aG.IMAGE,re.aG.IMAGE_URL].includes(e.type)&&e.value))})),O=(0,$.useCallback)((async e=>{const t=i.find((t=>t.id===e));t&&a(t,t.next_no)}),[i,a]),j=(0,$.useCallback)((async e=>{if(l||u.mock)return;const t=i.find((t=>t.id===e));if(!t)throw new Error(`Invalid carousel node answer: No answers in question with selected ID: ${e}`);var n;t&&t.url&&t.is_sent_to_url&&(0,Jt.F)(t.url,null!==(n=t.target_link)&&void 0!==n?n:"_blank");v.includes(e)?y(v.filter((t=>t!==e))):y(m?[...new Set([...v,e])]:[e]),g&&O(e)}),[a,O,l,i,s,g,v]),P=(0,$.useCallback)((async()=>{const e=i.filter((e=>v.find((t=>t===e.id)))),t=m&&Dn(s,v.length);if(t)_((0,Et.t)(t.message,t.param));else{_(null);try{if(m){const t=(0,rn.Bw)(i,e,s.next_no);await a(e,t)}else 1===e.length&&await a(e[0],e[0].next_no)}catch(e){const t=(0,En.k)(e);_(t)}}}),[a,v,m,s,i]),E=(0,$.useCallback)((async()=>{try{const e=m?[x]:x;await a(e,x.next_no)}catch(e){console.error(e)}}),[a,m,x]),T=(0,$.useCallback)(((e,t)=>{tr.i$.test(e)&&(0,Jt.F)(e,t)}),[Jt.F]);return(0,M.h)("form",{className:"answer-prompt-form"},(0,M.h)("div",{className:F()("answer-prompt-wrapper","carousel-wrapper","zoom-scroll"),"data-settings":"answer-prompt-bg"},(0,M.h)(re.GW,{winDocument:c,slidePercent:75,singleCentered:!0,infiniteLoop:!0},w.map((e=>{var t,n,r,i;return(0,M.h)(re.Kr,{onSelect:j,onButtonClick:T,key:e.id,id:e.id,forceShowImage:S,isSelected:v.includes(e.id),isDynamicNode:k,cardTemplateID:null!==(t=null===(n=e.meta)||void 0===n?void 0:n.cardTemplateId)&&void 0!==t?t:re.wq.TEXT,cardContent:null!==(r=null===(i=e.meta)||void 0===i?void 0:i.cardContent)&&void 0!==r?r:[],isMock:u.mock})}))),b&&(0,M.h)(re.o5,{ariaLive:"assertive",id:"validation",className:"validation-error"},b),C&&(0,M.h)(re.$n,{disabled:l,className:"exit-btn",onClick:E},null!==(n=null==x||null===(r=x.meta)||void 0===r?void 0:r.exitTitle)&&void 0!==n?n:"")),!g&&(0,M.h)(re.$n,{dataSettings:"submit-btn",dataSettingsText:"submit-btn-text",disabled:l,className:"submit-btn",onClick:P},h||(0,Et.t)("answer.submit.carousel.label")))}function rr(e){var t,n;let{chatContainerRef:r,handleSubmit:i,question:o,submitting:s}=e;const[a,l]=(0,$.useState)(0),{document:c}=(0,$.useContext)(Qe._),u=(0,bn.Q)(o,"continueText",!1),d=(0,bn.Q)(o,"allowedCompanyCountries",!0),h=(0,bn.Q)(o,"preferredCompanyCountries",!0),p=(null==d?void 0:d.filter((e=>!(null!=h&&h.some((t=>t.id===e.id))))))||[],f=(0,$.useMemo)((()=>o.allow_empty?`${(0,Et.t)("input.dropdown-country.placeholder")}`:`${(0,Et.t)("input.dropdown-country.placeholder")} (${(0,Et.t)("input.required")})`),[o]),m=(0,Tt.T)(null===(t=o.meta)||void 0===t?void 0:t.placeholder,(0,Et.t)("input.dropdown-country.placeholder")),g=(0,Tt.T)(null===(n=o.meta)||void 0===n?void 0:n.label,(0,Et.t)("input.placeholder.dropdown-country")),v=(0,$.useCallback)((async()=>{const e=[...d,...h].find((e=>a===e.id));if(!e&&!o.allow_empty)throw new Error("No answer selected");try{await i(null!=e?e:{id:0,name:"",code:""})}catch(e){console.error(e)}}),[i,a]);return(0,M.h)("form",{className:"answer-prompt-form"},(0,M.h)("div",{className:F()("answer-prompt-wrapper","zoom-scroll")},(0,M.h)(re.wP,{ariaLabel:f,closeIconAlt:(0,Et.t)("a11y.close-icon-alt"),value:a,label:g,onChange:e=>{l(e)},placeholder:m,availableCountries:p,preferredCountries:h,portalTarget:r.current,searchLabel:(0,Et.t)("input.label.country-dd.search.option"),disabledToggle:s,winDocument:c,baseUrl:"https://res.leadoo.com",autoFocus:!0,fullWidth:!0})),(0,M.h)(re.$n,{disabled:!o.allow_empty&&!a||s,className:"submit-btn",onClick:v},u||(0,Et.t)("answer.submit.label")))}var ir=s(3356),or=s(1002);function sr(e){const t=e.split(/[_-]/);return t[t.length-1]}var ar=s(7081),lr=s(6274);function cr(e){var t,n,r;let{chatContainerRef:i,inputInfo:s,inputValues:a,onChange:l,onEnterPress:c,setExternalRef:u,validationError:d}=e;const h=(0,o.tU)(),{document:f}=(0,$.useContext)(Qe._),[m,g]=(0,$.useState)(0),v=null!==(t=s.preferredCompanyCountries)&&void 0!==t?t:[],y=(null!==(n=s.allowedCompanyCountries)&&void 0!==n?n:[]).filter((e=>!v.find((t=>t.id===e.id)))),b=e=>{g(e),l(s.id,String(e))},_=sr(h.language),[w,x]=(0,$.useState)({countryCode:_,phoneNumber:""}),C=s.type===p.sw.Phone,k=(0,gn.M)(lr.y,C),S=(0,gn.M)(lr.f,C),O=s.required&&s.text&&!s.text.trim(),j=(0,$.useMemo)((()=>{const e=s.placeholder||(0,ar.fl)(s.type);return O?`${e} *`:e}),[s.placeholder,s.type]),P=O?"":s.text||(0,ar.GZ)(s.type),E=(0,$.useCallback)(((e,t)=>{var n,r,i;(0,Yt.B)(S,"phone input countries"),x({countryCode:e,phoneNumber:t});const o=null!==(n=null===(r=S.find((t=>t.code===e)))||void 0===r?void 0:r.telCode)&&void 0!==n?n:"",a=null!==(i=null==t?void 0:t.trim().split(" ").join(""))&&void 0!==i?i:"",c=a?`+${o}${a}`:"";l(s.id,c)}),[S]);if(s.type===p.sw.Dropdown){var T,I,N,A;const e=null!==(T=null===(I=s.options)||void 0===I?void 0:I.map((e=>{var t;return{title:e.text,value:null!==(t=e.id)&&void 0!==t?t:0}})))&&void 0!==T?T:[];return(0,M.h)("div",{className:"custom-field-item"},(0,M.h)(re.Vf,{closeIconAlt:(0,Et.t)("a11y.close-icon-alt"),error:Boolean(d),fullWidth:!0,helperText:null!=d?d:"",label:P,onChange:e=>((e,t)=>{const n=t.find((t=>t.id===e));n&&l(s.id,[n])})(e,s.options),options:e,placeholder:j,portalTarget:i.current,required:s.required,searchLabel:(0,Et.t)("input.label.search.option"),setExternalRef:u,value:null!==(N=null===(A=a[s.id][0])||void 0===A?void 0:A.id)&&void 0!==N?N:"",winDocument:f}))}return s.type===p.sw.Country?(0,M.h)("div",{className:"custom-field-item"},(0,M.h)(re.wP,{ariaLabel:P,closeIconAlt:(0,Et.t)("a11y.close-icon-alt"),value:m,label:P,onChange:b,placeholder:j,availableCountries:y,preferredCountries:v,portalTarget:i.current,required:s.required,searchLabel:(0,Et.t)("input.label.country-dd.search.option"),winDocument:f,baseUrl:"https://res.leadoo.com",error:Boolean(d),helperText:null!=d?d:"",setExternalRef:u,fullWidth:!0})):C?k&&S?(0,M.h)("div",{className:"custom-field-item"},(0,M.h)(k,{ariaLabel:Tt.U2[s.type]?(0,Et.t)(Tt.U2[s.type]):void 0,closeIconAlt:(0,Et.t)("a11y.close-icon-alt"),countriesOptions:S,error:Boolean(d),fullWidth:!0,helperText:null!=d?d:"",label:P,maxLength:(0,Tt.og)(p.sw.Phone),onChange:E,onEnterPress:c,placeholder:j,portalTarget:i.current,required:s.required,searchLabel:(0,Et.t)("input.label.search.country"),setExternalRef:u,value:w,baseUrl:"https://res.leadoo.com",winDocument:f})):null:(0,M.h)("div",{className:"custom-field-item"},(0,M.h)(re.PM,{ariaLabel:Tt.U2[s.type]?(0,Et.t)(Tt.U2[s.type]):void 0,autocomplete:null!==(r=s.autoComplete)&&void 0!==r?r:"on",error:Boolean(d),fullWidth:!0,helperText:null!=d?d:"",label:P,id:`${s.id}-${s.type}`,isMultiline:s.multiline,maxLength:(0,Tt.og)(s.type),onChange:e=>{l(s.id,e)},newLineOnEnter:s.multiline&&s.type===p.sw.Message,placeholder:j,onEnterPress:c,required:s.required,setExternalRef:u,startIcon:Tt.XP[s.type]||void 0,startIconAlt:Tt.U2[s.type]?(0,Et.t)(Tt.U2[s.type]):void 0,value:a[s.id]?a[s.id].toString():""}))}function ur(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function dr(e){for(var t=1;tObject.fromEntries(h.map((e=>[e.id,Boolean(c.answeredConsents&&c.answeredConsents[e.id])])))),[h,c.answeredConsents]),[v,y]=(0,$.useState)(g),[b,_]=(0,$.useState)(null),[w,x]=(0,$.useState)(l.reduce(((e,t)=>dr(dr({},e),{},{[t.id]:t.type==p.sw.Dropdown?[]:""})),{})),C=(0,Pn.wh)(s,n),k=(0,$.useCallback)((async()=>{let e=!0;const t={},n=dr({},w);return await Promise.all(l.map((async(r,i)=>{const[o,a=null]=C[r.id](w[r.id],r.id);if(o){const o=await(0,or.Z)(w[r.id],r.type,s);var l;if(o)if(o instanceof Object)n[r.id]=o.validPhone;else e&&(null===(l=u.current[i])||void 0===l||l.focus()),e=!1,t[r.id]=o}o||(e&&u.current[i].focus(),e=!1),a&&(t[r.id]=a)}))),x(n),m(t),{formValues:n,allValid:e}}),[l,w,C]),S=(0,$.useCallback)(((e,t)=>{_(null),x((n=>dr(dr({},n),{},{[e]:t})))}),[]),O=(0,$.useCallback)((async()=>{if(c.mock)return;const{formValues:e,allValid:t}=await k();if(!t)return;const n=Object.keys(e).reduce(((t,n)=>{const r=l.find((e=>e.id===n));if(!r)throw new Error(`No custom form input found for ID: ${n}`);return[...t,{id:parseInt(r.id,10),type:r.type,value:e[r.id]}]}),[]);try{await i(n,void 0,h.map((e=>({id:e.id,status:Number(Boolean(v[e.id]))}))))}catch(e){const t=(0,En.k)(e);_(t)}}),[i,l,w,k]),j=(0,$.useCallback)((e=>{if(e===l.length-1)O();else{const t=e+1;u.current[t].focus()}}),[O,l,u]);return(0,$.useEffect)((()=>{let e;return u.current&&u.current[0]&&(e=setTimeout((()=>{u.current[0].focus()}),500)),()=>{clearTimeout(e)}}),[u.current]),(0,M.h)("form",{className:"answer-prompt-form"},(0,M.h)(re.Ze,{className:"answer-prompt-scroll",dataSettings:"answer-prompt-bg"},(0,M.h)("div",{className:"answer-prompt-wrapper"},l.map(((e,t)=>(0,M.h)(cr,{setExternalRef:e=>u.current[t]=e,chatContainerRef:r,inputInfo:e,inputValues:w,key:e.id,onChange:S,onEnterPress:()=>j(t),validationError:f[e.id]?f[e.id]:null}))),Boolean(h.length)&&(0,M.h)("div",{className:"consents-wrapper"},h.map((e=>{return(0,M.h)(re.NO,{key:e.id,label:e.text,id:e.id,onChange:(t=e.id,e=>{y((n=>dr(dr({},n),{},{[t]:e}))),c.answeredConsents=dr(dr({},c.answeredConsents),{},{[t]:e?1:0})}),value:v[e.id]||!1});var t}))),b&&(0,M.h)(re.o5,{className:"validation-error"},b))),(0,M.h)(re.$n,{className:"submit-btn",disabled:a,onClick:O,dataSettings:"submit-btn",dataSettingsText:"submit-btn-text"},d||(0,Et.t)("answer.submit.label")))}function fr(e){var t,n;let{answers:r,chatContainerRef:i,handleSubmit:o,question:s,setAnswer:a,submitting:l}=e;const[c,u]=(0,$.useState)(""),{document:d}=(0,$.useContext)(Qe._),h=(0,bn.Q)(s,"continueText",!1),p=(0,$.useMemo)((()=>r.map((e=>{var t;return{title:e.text,value:null!==(t=e.id)&&void 0!==t?t:0}}))),[r]),f=(0,$.useMemo)((()=>s.allow_empty?`${(0,Et.t)("input.dropdown.placeholder")}`:`${(0,Et.t)("input.dropdown.placeholder")} (${(0,Et.t)("input.required")})`),[s]),m=(0,Tt.T)(null===(t=s.meta)||void 0===t?void 0:t.placeholder,(0,Et.t)("input.dropdown.placeholder")),g=(0,Tt.T)(null===(n=s.meta)||void 0===n?void 0:n.label,(0,Et.t)("input.placeholder.dropdown")),v=(0,$.useCallback)((async()=>{const e=r.find((e=>c===e.id));if(!e)throw new Error("No answer selected");try{await o(e,e.next_no)}catch(e){console.error(e)}}),[r,o,c]);return(0,M.h)("form",{className:"answer-prompt-form"},(0,M.h)("div",{className:F()("answer-prompt-wrapper","zoom-scroll")},(0,M.h)(re.Vf,{ariaLabel:f,closeIconAlt:(0,Et.t)("a11y.close-icon-alt"),value:c,label:g,onChange:e=>{u(e);const t=r.find((t=>e===t.id));t&&a(t)},placeholder:m,options:p,portalTarget:i.current,searchLabel:(0,Et.t)("input.label.search.option"),disabledToggle:l,winDocument:d,autoFocus:!0,fullWidth:!0})),(0,M.h)(re.$n,{disabled:!c||l,className:"submit-btn",onClick:v},h||(0,Et.t)("answer.submit.label")))}async function mr(){return s.e(111).then(s.bind(s,3264))}function gr(e){let{criteria:t,question:n,chatContainerRef:r}=e;const[i]=(0,Yn.o)(mr,[]);return i?(0,M.h)(M.Fragment,null,(0,M.h)(i.LiveChatConsole,{chatContainerRef:r,criteria:t,question:n})):null}function vr(e){var t,n;let{chatContainerRef:r,handleSubmit:i,question:s,setAnswer:a,submitting:l}=e;const c=(0,o.tU)(),u=(0,gn.M)(lr.y),d=(0,gn.M)(lr.f),h=(0,bn.Q)(s,"continueText",!1),{document:p}=(0,$.useContext)(Qe._),f=(0,$.useMemo)((()=>sr(c.language)),[c]),[m,g]=(0,$.useState)(f),[v,y]=(0,$.useState)(""),[b,_]=(0,$.useState)(""),w=(0,$.useMemo)((()=>s.allow_empty?`${(0,Et.t)(Tt.U2.phone)}`:`${(0,Et.t)(Tt.U2.phone)} (${(0,Et.t)("input.required")})`),[s]),x=(0,Tt.T)(null===(t=s.meta)||void 0===t?void 0:t.placeholder,(0,Et.t)("input.phone.placeholder")),C=(0,Tt.T)(null===(n=s.meta)||void 0===n?void 0:n.label,(0,Et.t)("input.placeholder.phone")),k=(0,Pn.CN)(s,[]),S=(0,Pn.tl)(s),O=(0,$.useCallback)(((e,t)=>{var n,r;(0,Yt.B)(d,"phone input countries"),g(e),y(t);const i=null!==(n=null===(r=d.find((t=>t.code===e)))||void 0===r?void 0:r.telCode)&&void 0!==n?n:"";a(`+${i}${t}`),_("")}),[d]),j=(0,$.useCallback)((async()=>{var e,t,n;(0,Yt.B)(d,"phone input countries");const r=null!==(e=null===(t=d.find((e=>e.code===m)))||void 0===t?void 0:t.telCode)&&void 0!==e?e:"",o=null!==(n=null==v?void 0:v.trim().split(" ").join(""))&&void 0!==n?n:"";let a=o?`+${r}${o}`:"";const[l,c]=k(a);if(!l)return void _(null!=c?c:(0,Et.t)("invalid.in-phone"));const u=await(0,Tn.l)(s.id,a);if(u){if(!(u instanceof Object))return void _(u);a=u.validPhone}const h=S(a);try{await i(h)}catch(e){const t=(0,En.k)(e);_(t)}}),[m,i,d,v,s,S,k]);return(0,M.h)("form",{className:"answer-prompt-form"},(0,M.h)("div",{className:F()("answer-prompt-wrapper","zoom-scroll")},u&&d&&(0,M.h)(u,{ariaLabel:w,autoFocus:!0,closeIconAlt:(0,Et.t)("a11y.close-icon-alt"),countriesOptions:d,disabled:l,error:Boolean(b),helperText:b,maxLength:R.Ih,label:C,onChange:O,onSubmit:j,placeholder:x,portalTarget:r.current,searchLabel:(0,Et.t)("input.label.search.country"),winDocument:p,value:{countryCode:m,phoneNumber:v},required:!s.allow_empty,baseUrl:"https://res.leadoo.com",submitOnEnter:!0})),(0,M.h)(re.$n,{disabled:l,className:"submit-btn",onClick:j},h||(0,Et.t)("answer.submit.label")))}const yr=ve((e=>{var t,r;let{chatContainerRef:i,handleSubmit:s,setAnswer:a}=e;const l=(0,$.useMemo)(o.tU,[]),{dispatch:c,state:u,submitting:d}=(0,$.useContext)(Y.p),[h,p]=(0,$.useMemo)((()=>{var e,t,n;return[null===(e=u.prompt)||void 0===e?void 0:e.question,null!==(t=null===(n=u.prompt)||void 0===n?void 0:n.answers)&&void 0!==t?t:[]]}),[u.prompt]),f=(0,$.useCallback)((()=>h&&(0,Kn.V)(h.type)||Promise.resolve(null)),[h]),m=(0,gn.M)(f,!!u.prompt);if(!u.prompt)return null;switch(null==h?void 0:h.type){case n.xi.NamePrompt:var g;return(null==h||null===(g=h.meta)||void 0===g?void 0:g.name)===n.UL.Separate?(0,M.h)(zn,{answers:p,handleSubmit:s,question:h,submitting:d,submitClassname:"submit-btn",autoFocusDelay:500},(0,M.h)(re.Ze,{className:"answer-prompt-scroll"},(0,M.h)("div",{className:"answer-prompt-wrapper"},(0,M.h)(Gn,{question:h,fullWidth:!0})))):(0,M.h)(Ln,{handleSubmit:s,question:h,setAnswer:a,submitting:d,fullWidth:!0});case n.xi.Carousel:return(0,M.h)(nr,{answers:p,handleSubmit:s,question:h,setAnswer:a,submitting:d});case n.xi.EmailPrompt:case n.xi.CompanyPrompt:case n.xi.TextPrompt:return(0,M.h)(Ln,{question:h,setAnswer:a,handleSubmit:s,submitting:d,fullWidth:!0});case n.xi.MultipleChoice:return(0,M.h)(Mn,{answers:p,handleSubmit:s,question:h,setAnswer:a,submitting:d,dataSettings:"submit-btn",dataSettingsText:"submit-btn-text"},(0,M.h)(re.Ze,{className:"answer-prompt-scroll",dataSettings:"answer-prompt-bg"},(0,M.h)("div",{className:"answer-prompt-wrapper"},(0,M.h)($n,null))));case n.xi.SingleChoice:case n.xi.SingleChoiceURL:return(0,M.h)(re.Ze,{className:"answer-prompt-scroll",dataSettings:"answer-prompt-bg"},(0,M.h)("div",{className:"answer-prompt-wrapper"},(0,M.h)(Qn,{answers:p,handleSubmit:s,question:h,submitting:d})));case n.xi.PhonePrompt:return(0,M.h)(vr,{chatContainerRef:i,handleSubmit:s,question:h,setAnswer:a,submitting:d});case n.xi.Country:return(0,M.h)(rr,{chatContainerRef:i,handleSubmit:s,question:h,submitting:d});case n.xi.Dropdown:return(0,M.h)(fr,{answers:p,chatContainerRef:i,handleSubmit:s,question:h,setAnswer:a,submitting:d});case n.xi.Calendar:case n.xi.BookingCalendar:return(0,M.h)(er,{answers:p,question:h,chatContainerRef:i,handleSubmit:s});case n.xi.LocationForm:case n.xi.ContactForm:return(0,M.h)(zn,{answers:p,handleSubmit:s,question:h,submitting:d,submitClassname:"submit-btn",autoFocusDelay:500},(0,M.h)(re.Ze,{className:"answer-prompt-scroll"},(0,M.h)("div",{className:"answer-prompt-wrapper"},(0,M.h)(Gn,{question:h,fullWidth:!0}))));case n.xi.CustomForm:return(0,M.h)(pr,{answers:p,chatContainerRef:i,handleSubmit:s,question:h,submitting:d});case n.xi.AttachmentPrompt:return(0,M.h)(On,{handleSubmit:s,question:h,setAnswer:a,submitting:d,submitClassname:"submit-btn"},(0,M.h)("div",{className:F()("answer-prompt-wrapper","zoom-scroll")},(0,M.h)(jn,null)));case n.xi.LiveChat:case n.xi.SoftLiveChat:var v,y;return null!=h&&null!==(t=h.livechat)&&void 0!==t&&t.livechat?(0,M.h)(gr,{chatContainerRef:i,criteria:null!==(v=null===(y=h.livechat)||void 0===y?void 0:y.criteria)&&void 0!==v?v:null,question:h}):null}return(0,M.h)(M.Fragment,null,(null==m?void 0:m.rendersPromptContents)&&h&&m.rendersPromptContents(h)&&(null===(r=m.renderPromptContents)||void 0===r?void 0:r.call(m,{answers:p,disabled:u.loading.includes(Z.rz.Current),dispatch:c,globals:l,handleSubmit:s,hideDuringSubmit:!1,isAppearing:!1,isShowScroll:!0,items:u.items,promptKey:`ans-${u.items.length}`,question:h,setAnswer:a,submitting:d}))||null)})),br=[n.xi.SingleChoice,n.xi.MultipleChoice,n.xi.SingleChoiceURL];const _r=_e((function(e,t){var r,i,o,s,a;let{chatContainerRef:l,handleSubmit:c,setAnswer:u}=e;const{state:d}=(0,$.useContext)(Y.p),h=null===(r=d.prompt)||void 0===r?void 0:r.question,p=(0,Je.P)("prefetched",!1),f=br.find((e=>e===(null==h?void 0:h.type))),m=(0,$.useCallback)((async(e,t,n)=>{await c(e,t,n)}),[c]),g=(0,$.useMemo)((()=>{var e;return!d.promptAnswered&&!!d.prompt&&(null===(e=d.prompt)||void 0===e||null===(e=e.question)||void 0===e?void 0:e.type)!==n.xi.Say}),[d]);return(0,M.h)(re.Bg,{className:F()("answer-input-wrapper",{"expanded-prompt":(null===(i=d.prompt)||void 0===i||null===(i=i.question)||void 0===i?void 0:i.type)&&[n.xi.Calendar,n.xi.AI].includes(null===(o=d.prompt)||void 0===o||null===(o=o.question)||void 0===o?void 0:o.type),"carousel-prompt":(null===(s=d.prompt)||void 0===s||null===(s=s.question)||void 0===s?void 0:s.type)&&(null===(a=d.prompt)||void 0===a||null===(a=a.question)||void 0===a?void 0:a.type)===n.xi.Carousel}),disableFadeIn:Boolean(f),isVisible:g,ref:t},h&&!p&&(0,M.h)(yr,{chatContainerRef:l,handleSubmit:m,setAnswer:u}))}));function wr(e){var t,n,r,i;let{isOpen:s,handleCloseBot:a,handleReloadBot:l}=e;const c=(0,o.tU)(),{state:u}=(0,$.useContext)(ne.f),{connected:d}=(0,$.useContext)(ie.k),h=(0,$.useMemo)((()=>{if((d||c.mock)&&u.agent)return u.agentTyping?re.WA.TYPING:u.agentOnline?re.WA.ONLINE:re.WA.OFFLINE}),[u.agent,u.agentOnline,u.agentTyping,d]),p=(0,$.useMemo)((()=>u.agent&&(d||c.mock)?{avatar:u.agent.avatar,name:u.agent.name}:{avatar:c.botIcon,name:c.botName}),[d,null===(t=u.agent)||void 0===t?void 0:t.avatar,null===(n=u.agent)||void 0===n?void 0:n.name,c.botIcon,c.botName]);return(0,M.h)(re.rA,{avatarAlt:"",isClosed:!s,onClose:a,onRefresh:l,reloadIconAlt:(0,Et.t)("a11y.chat-reload-icon-alt"),closeIconAlt:(0,Et.t)("a11y.chat-close-icon-alt"),src:null!==(r=p.avatar)&&void 0!==r?r:"",status:h,title:null!==(i=p.name)&&void 0!==i?i:"",t:Et.t})}function xr(e){var t,n;let{fullscreen:r}=e;const i=(0,$.useMemo)(o.tU,[]),{getState:s,state:l,dispatch:c,setSubmitting:u,submitAnswer:d,reload:h}=(0,$.useContext)(Y.p),{dispatch:f}=(0,$.useContext)(K.d),{state:m,disconnect:g,lib:v,isShowImgPreview:y,imgPreviewUrl:b,setIsShowImgPreview:_}=(0,$.useContext)(ie.k),{document:w}=(0,$.useContext)(Qe._),{close:x,isOpen:C}=(0,$.useContext)(ne.f),[k,S]=(0,$.useState)(""),[O,j]=(0,$.useState)(0),[P,E]=(0,$.useState)(!1),T=(0,$.useRef)(null),I=(0,$.useRef)(null),N=(0,$.useRef)(null),A=(0,$.useRef)(null),L=(0,$.useRef)(null),D=l.items[l.items.length-1],R=(null==D?void 0:D.type)===Z.rV.Question?null==D?void 0:D.question:null,U=(0,$.useMemo)((()=>{var e;const t=null===(e=i.companyRatings)||void 0===e?void 0:e.find((e=>e.type===kt.p[l.currentFeedback]));var n,r,o,s,a;return l.currentFeedback===p.eU.BOT_NODE?{feedback_title:(null==R||null===(n=R.meta)||void 0===n||null===(n=n.ratingSettings)||void 0===n?void 0:n.feedbackTitle)||(null==t?void 0:t.feedback_title),feedback_placeholder:(null==R||null===(r=R.meta)||void 0===r||null===(r=r.ratingSettings)||void 0===r?void 0:r.feedbackPlaceholder)||(null==t?void 0:t.feedback_placeholder),submit_button_text:(null==R||null===(o=R.meta)||void 0===o||null===(o=o.ratingSettings)||void 0===o?void 0:o.submitButtonText)||(null==t?void 0:t.submit_button_text),rating_title:(null==R||null===(s=R.meta)||void 0===s||null===(s=s.ratingSettings)||void 0===s?void 0:s.title)||(null==t?void 0:t.rating_title),rating_subtitle:(null==R||null===(a=R.meta)||void 0===a||null===(a=a.ratingSettings)||void 0===a?void 0:a.subtitle)||(null==t?void 0:t.rating_subtitle)}:t}),[l.currentFeedback]),q=(0,$.useMemo)((()=>{switch(l.currentFeedback){case p.eU.AI:return l.feedback.submited.includes(p.eU.AI);case p.eU.BOT:return l.feedback.submited.includes(p.eU.BOT)||l.feedback.submited.includes(p.eU.BOT_NODE);case p.eU.BOT_NODE:return l.feedback.submited.includes(p.eU.BOT_NODE);case p.eU.LIVECHAT:return l.feedback.submited.includes(p.eU.LIVECHAT);default:return!1}}),[l.currentFeedback,l.feedback]);!function(e,t){const[n,r]=(0,$.useState)(!1),i=(0,$.useRef)(!1),o=(0,$.useRef)(!1),{state:s}=(0,$.useContext)(Y.p),a=(0,$.useCallback)((()=>{if(!e.current)return;o.current=!0;const{scrollTop:t,scrollHeight:n,clientHeight:s}=e.current,a=100*t/(n-s);r(Math.round(a)>=100||i.current),100===Math.round(a)&&(i.current=!1)}),[]);(0,$.useEffect)((()=>{if(!e.current)return;const r=new ResizeObserver((()=>{e.current&&(e.current.scrollHeight===e.current.clientHeight?o.current=!1:!n&&o.current||(i.current=!0,e.current.scrollTop=e.current.scrollHeight))}));return r.observe(e.current),null!=t&&t.current&&r.observe(t.current),()=>{r.unobserve(e.current),null!=t&&t.current&&r.unobserve(t.current)}}),[n,s.items,s.loading]),(0,$.useEffect)((()=>{var t;return null===(t=e.current)||void 0===t||t.addEventListener("scroll",a),()=>{var t;null===(t=e.current)||void 0===t||t.removeEventListener("scroll",a)}}),[a])}(T,I);const B=(0,$.useCallback)((()=>{i.mock||x()}),[x]),z=(0,$.useCallback)((async()=>{var e;i.mock||(v&&await g(),null===(e=L.current)||void 0===e||e.abort(),await h(),u(!1))}),[h,g,v]);mn(B,w),(0,$.useEffect)((()=>(L.current=new AbortController,()=>{L.current=null})),[]),(0,$.useEffect)((()=>{if(!N.current)return;const e=new ResizeObserver((()=>{var e;N.current&&j(null!==(e=N.current.clientHeight)&&void 0!==e?e:0)}));return e.observe(N.current),()=>e.unobserve(N.current)}),[l.prompt]);const V=(0,$.useCallback)((async(e,t,n)=>{const r=null!=e?e:k;await d(r,null!=t?t:null,void 0,n)}),[k,d]);return(0,$.useEffect)((()=>{if(i.prefetched&&i.prefetchedStarted){var e,t,n,r,o;const l=null!==(e=null===(t=s().prompt)||void 0===t?void 0:t.answers)&&void 0!==e?e:[],c=(null===(n=i.prefetched.question)||void 0===n?void 0:n.type)===p.xi.MultipleChoice,u=l.filter((e=>{var t;return e.id&&(null===(t=i.prefetched)||void 0===t||null===(t=t.selectedAnswerIDs)||void 0===t?void 0:t.includes(e.id))})),h=c?null===(r=i.prefetched.question)||void 0===r?void 0:r.next_no:null===(o=u[0])||void 0===o?void 0:o.next_no;if(!u.length)return i.prefetched=null,void(i.prefetchedStarted=!1);const f=c?u:u[0];d(f,null!=h?h:null).catch((e=>{console.error(e),(0,a.Rm)("failed submitting prefetched answer")})).finally((()=>{i.prefetched=null,i.prefetchedStarted=!1}))}}),[s,i.prefetched,i.prefetchedStarted,d]),(0,$.useEffect)((()=>{var e,t;if(null!==(e=l.prompt)&&void 0!==e&&e.question&&(null===(t=l.prompt)||void 0===t?void 0:t.question.type)===p.xi.AI&&(0,hn.qG)(l.prompt.question.order_no)){const e=(0,hn.j1)();e&&d(e,null,!0)}else;}),[null===(t=l.prompt)||void 0===t?void 0:t.question]),(0,$.useEffect)((()=>{var e;null!==(e=l.prompt)&&void 0!==e&&e.question&&l.prompt.question.type===p.xi.LiveChat&&(0,pn.bP)().catch((e=>{var t;console.error(e),c({type:Z.Ud.SetError,error:{title:"LiveChat Connection",message:e}}),null!==(t=l.prompt)&&void 0!==t&&t.question.next_no&&(0,wt.G)(!1,l.prompt.question.next_no,c,f,i).then((()=>{c({type:Z.Ud.SetError,error:{title:"LiveChat Connection",message:e}})})).catch((e=>console.error(e)))}))}),[null===(n=l.prompt)||void 0===n?void 0:n.question]),(0,M.h)("div",{"aria-hidden":!C,className:F()("chat-content",{"chat-content-fullscreen":r}),ref:A},(0,M.h)("div",{className:"background"}),(0,M.h)(wr,{isOpen:C,handleCloseBot:B,handleReloadBot:z}),(0,M.h)("div",{className:"bot-content",style:{height:`calc(100% - 64px - ${O}px)`},"data-settings":"bot-background"},l.error&&(0,M.h)(re.WQ,{copiedTitle:(0,Et.t)("error.bot.copied.title"),copyTitle:(0,Et.t)("error.bot.copy.title"),errorIconAlt:(0,Et.t)("a11y.bot.error-icon"),errorMessage:l.error.message,title:(0,Et.t)(l.error.title)||(0,Et.t)("error.bot.title")}),(0,M.h)(re.hX,{ref:T,innerRef:I},l.items.map(((e,t,n)=>(0,M.h)(cn,{isLatest:t===(null==n?void 0:n.length)-1,item:e,key:e.id,nodeId:e.id}))),l.loading.includes(Z.rz.Next)&&(0,M.h)(dn,{nodeId:`${l.items.length}`})),m.startPrompt&&(0,M.h)(un,{isLCActive:m.active}),(0,M.h)(fn,{brandingLink:"https://leadoo.com/what-is-chatbot?utm_source=product&utm_medium=poweredby&utm_campaign=chatbot",className:F()({"policy-bottom":0===O}),classNamePrefix:"chat"})),(0,M.h)(_r,{chatContainerRef:A,handleSubmit:V,ref:N,setAnswer:S}),(0,M.h)(re.bL,{isVisible:l.feedback.open&&!q,feedbackLabel:(null==U?void 0:U.feedback_title)||(0,Et.t)("bot-rating.feedback-label"),feedbackPlaceholder:(null==U?void 0:U.feedback_placeholder)||(0,Et.t)("chat.bot-rating.feedback-placeholder"),feedbackSendButtonText:(null==U?void 0:U.submit_button_text)||(0,Et.t)("chat.bot-rating.feedback-send-button"),handleClose:()=>{c({type:Z.Ud.BotRatingPrompt,feedbackType:l.currentFeedback,open:!1});const e=l.items[l.items.length-1];e&&e.type===Z.rV.Question&&(L.current=new AbortController,(async t=>{await(0,wt.G)(e.question.is_end,e.question.next_no,c,f,i,null===(t=L.current)||void 0===t?void 0:t.signal)})())},rateHeader:(null==U?void 0:U.rating_title)||(0,Et.t)("chat.bot-rating.feedback-rate-header"),rateSubheader:(null==U?void 0:U.rating_subtitle)||(0,Et.t)("chat.bot-rating.feedback-rate-sub."+(l.currentFeedback===p.eU.AI?"ai":"bot")),returnText:(0,Et.t)("chat.bot-rating.feedback-return-text"),successHeader:(0,Et.t)("chat.bot-rating.feedback-success-header"),successSubheader:(0,Et.t)("chat.bot-rating.feedback-success-subheader"),onChange:(e,t)=>{const n=(0,_t.K6)(e,l.currentFeedback===p.eU.BOT_NODE?p.eU.BOT:l.currentFeedback,t,i,l.feedback.chatID);return E(!1),n.then((()=>{c({type:Z.Ud.BotRatingPrompt,feedbackType:l.currentFeedback,open:!0,submited:!0,chatID:l.feedback.chatID})})).catch((e=>{console.error({e}),E(!0)})),n},error:P,helperText:(0,Et.t)(P?"chat.rating.submit-error":""),maxLength:2048}),(0,M.h)(re.Xy,{actionButtonText:(0,Et.t)("a11y.attachment.image-preview.download"),closeButtonText:(0,Et.t)("a11y.attachment.image-preview.close-preview"),imageAlt:(0,Et.t)("a11y.attachment.image-preview.image-alt"),imageUrl:b,onActionClick:function(){b&&(0,Jt.F)(b)},onCloseClick:()=>_(!1),isShow:y}))}var Cr=s(8954),kr=s(1870);function Sr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Or(e){for(var t=1;t{e({answers:n,question:t,type:Z.Ud.AddQuestion}),e({answers:n,editingAnswer:null,question:t,encryptionKey:null,type:Z.Ud.Prompt})}))}(t);break;case Ir.Carousel:!function(e){const t=Or(Or({},Pr),{},{id:-1,bot_id:-1,type:p.xi.Carousel,text:"Great choice! I can certainly help with that. I'll show you a carousel of our popular products. Here we go:",sub_text:Tr,meta:{carouselType:p.zm.Single,confirmSubmit:!0}}),n=[Or(Or({},Er),{},{id:1,text:"",sub_text:"",meta:{cardContent:[{type:"image",width:"full",value:"https://res.leadoo.com/preview/preview1.jpeg"},{type:"text",width:"full",value:"Product name #1"},{type:"text",width:"full",value:"Product description and price"}],cardTemplateId:2}}),Or(Or({},Er),{},{id:2,text:"",sub_text:"",meta:{cardContent:[{type:"image",width:"full",value:"https://res.leadoo.com/preview/preview2.jpeg"},{type:"text",width:"full",value:"Product name #2"},{type:"text",width:"full",value:"Product description and price"}],cardTemplateId:2}}),Or(Or({},Er),{},{id:3,text:"",sub_text:"",meta:{cardContent:[{type:"image",width:"full",value:"https://res.leadoo.com/preview/preview3.jpeg"},{type:"text",width:"full",value:"Product name #3"},{type:"text",width:"full",value:"Product description and price"}],cardTemplateId:2}})];e({type:Z.Ud.ClearItems}),e({answers:n,question:t,type:Z.Ud.AddQuestion}),e({answers:n,editingAnswer:null,question:t,encryptionKey:null,type:Z.Ud.Prompt})}(t);break;case Ir.LiveChat:!function(e,t){const n=Or(Or({},Pr),{},{id:-1,bot_id:-1,type:p.xi.LiveChat,text:"How can I help you today?",sub_text:Tr,start_message:"Hello_ayo",livechat:{livechat:!0,facebook:null,whatsapp:null,criteria:{is_company_name:!1,is_email:!1,is_name:!0,is_phone:!1,enable_lc_rating:!1,msg_start:"Global Start Message"}}}),r=[];e({type:Z.Ud.ClearItems}),e({answers:r,question:n,type:Z.Ud.AddQuestion}),e({answers:r,editingAnswer:null,question:n,encryptionKey:null,type:Z.Ud.Prompt}),e({type:Z.Ud.SetReady,ready:[Z.rz.Next]}),t({agent:{avatar:"https://res.leadoo.com/preview/preview4.jpeg",name:"John Doe"},type:kr.hA.SetAgent}),e({type:Z.Ud.AddLiveChatEvent,text:"event-assign-new",payload:{name:"Agent",assignerID:"1"}}),e({type:Z.Ud.AddUpdateLiveChatMessage,text:"Hello! Thank you for reaching out. How can I assist you today?",status:p.dm.Sent,timestamp:Date.now(),ownMessage:!1,sender:"1",tag:"tag:1"}),e({ownMessage:!0,sender:"2",status:p.dm.Sent,tag:"tag:2",text:"Could you tell me more about your product?",timestamp:Date.now(),type:Z.Ud.AddUpdateLiveChatMessage})}(t,n);break;case Ir.SingleChoice:!function(e){const t=[Or(Or({},Pr),{},{id:-1,bot_id:-1,type:p.xi.Say,text:"Hello! šŸ‘‹ My name is Robotron, and I'm a chatbot here to help you right now.",sub_text:Tr}),Or(Or({},Pr),{},{id:-1,bot_id:-1,type:p.xi.SingleChoice,text:"How can I help you today?",sub_text:Tr})],n=[Or(Or({},Er),{},{id:1,text:"I’m new and want to learn more",sub_text:"Suspendisse aliquet urna ut dolor rutrum, id tincidunt ante viverra."}),Or(Or({},Er),{},{id:2,text:"Can you contact me?",sub_text:"Nam finibus, erat et congue porttitor, odio enim fringilla urna."}),Or(Or({},Er),{},{id:3,text:"I have a question",sub_text:"Aliquam sed nulla magna. Donec posuere enim sed risus vestibulum varius."}),Or(Or({},Er),{},{id:4,text:"Other",sub_text:"Nunc vestibulum risus ante, at gravida sapien fringilla quis."})];e({type:Z.Ud.ClearItems}),t.forEach((t=>{e({answers:n,question:t,type:Z.Ud.AddQuestion}),e({answers:n,editingAnswer:null,question:t,encryptionKey:null,type:Z.Ud.Prompt})}))}(t);break;case Ir.SingleChoiceUrl:!function(e){const t=Or(Or({},Pr),{},{id:-1,bot_id:-1,type:p.xi.SingleChoice,text:"Lorem Ipsum",sub_text:Tr}),n=[Or(Or({},Er),{},{id:1,text:"Duis efficitur",sub_text:"Suspendisse aliquet urna ut dolor rutrum, id tincidunt ante viverra.",img_answer:"https://res.leadoo.com/preview/preview1.jpeg",url:"https://leadoo.com/bots/visualbot/",is_sent_to_url:!0}),Or(Or({},Er),{},{id:2,text:"Nulla ut neque vehicula, viverra mauris in",sub_text:"Nam finibus, erat et congue porttitor, odio enim fringilla urna.",img_answer:"https://res.leadoo.com/preview/preview2.jpeg"}),Or(Or({},Er),{},{id:3,text:"Ut lacus tellus",sub_text:"Aliquam sed nulla magna. Donec posuere enim sed risus vestibulum varius.",img_answer:"https://res.leadoo.com/preview/preview3.jpeg"})];e({type:Z.Ud.ClearItems}),e({answers:n,question:t,type:Z.Ud.AddQuestion}),e({answers:n,editingAnswer:null,question:t,encryptionKey:null,type:Z.Ud.Prompt})}(t)}}function Lr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Dr(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:(0,o.tU)(),i=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;const{command:l}=e;if("set-styles"===l){const{properties:n}=e;if(!n||"object"!=typeof n)throw new Error("Invalid properties: Expected hash");(async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,o.tU)();const[r,i]=await Promise.all([(0,_t.eU)(Cr.eQ,e),(0,_t.kl)(e)]),s=t.getElementById("mock-styles");s&&(s.disabled=!0,s.remove());const a=t.createElement("style");a.type="text/css",a.id="mock-styles",a.innerText=r,t.head.appendChild(a),n.theme=i})(n,t).catch((e=>console.error(e)))}else if("set-mock"===l){const{mock:t}=e;s(),r.settings=Dr(Dr({},r.settings||{}),{},{launcher_visible:!1}),Ar(t,n,a)}else if("set-header"===l){const{settings:t}=e;r.botIcon=t.botIcon,r.botName=t.botName}else if("set-trigger"===l){const{settings:t}=e;r.botIcon=t.botIcon,r.deviceType=t.deviceType,r.triggerPreviewPos=t.isTriggerPreview?k(t.launch_pos_hor):null,r.settings=Dr(Dr({},r.settings||{}),t),i()}}function $r(){const e=(0,$.useMemo)(o.tU,[]),t=(0,$.useMemo)((()=>window),[]),{document:n}=(0,$.useContext)(Qe._),{dispatch:r}=(0,$.useContext)(Y.p),{close:i,open:s,dispatch:a}=(0,$.useContext)(ne.f);return(0,$.useEffect)((()=>{e.mock&&t.parent.postMessage(JSON.stringify({type:"reset-styles"}),"*")}),[]),(0,$.useEffect)((()=>{if(!e.mock)return;const l=e=>{try{if(!e.data||"string"!=typeof e.data)return;const t=JSON.parse(e.data);"chat-mock"===t.type&&Mr(t,n,r,(0,o.tU)(),i,s,a)}catch(e){console.error(e)}};return t.addEventListener("message",l,!1),()=>{t.removeEventListener("message",l,!1)}}),[e,n,t]),(0,$.useEffect)((()=>{const e=e=>{if(0===e.detail)return;const n=e.target;if(n instanceof HTMLElement&&n.hasAttribute("data-settings")){const e=n.getAttribute("data-settings");return void(e&&t.parent.postMessage(JSON.stringify({type:"interactive-preview",settingsValue:e}),"*"))}const r=n.closest("[data-settings]");if(r){const e=r.getAttribute("data-settings");e&&t.parent.postMessage(JSON.stringify({type:"interactive-preview",settingsValue:e}),"*")}};return n.addEventListener("click",e),()=>{n.removeEventListener("click",e)}}),[n,t]),(0,$.useEffect)((()=>{const e=e=>{const t=e.target;if(t instanceof HTMLElement&&t.hasAttribute("data-settings"))t.classList.add("hovered");else{const e=t.closest("[data-settings]");e&&e.classList.add("hovered")}},t=e=>{const t=e.target;if(t instanceof HTMLElement&&t.hasAttribute("data-settings"))t.classList.remove("hovered");else{const e=t.closest("[data-settings]");e&&e.classList.remove("hovered")}};return n.addEventListener("mouseover",e),n.addEventListener("mouseout",t),()=>{n.removeEventListener("mouseover",e),n.removeEventListener("mouseout",t)}}),[n]),null}!function(e){e.Calendar="calendar",e.CustomForm="custom-form",e.MultiChoice="multiple-choice",e.SaySomething="say-something",e.SingleChoice="single-choice",e.SingleChoiceUrl="single-choice-url",e.Carousel="carousel",e.LiveChat="livechat"}(Ir||(Ir={}));function Ur(e){const{alignment:t="right",lcSession:n}=e,r=(0,$.useMemo)(o.tU,[]),{hasOpened:i,isOpen:s}=(0,$.useContext)(ne.f),a=H(),l=(0,$.useMemo)((()=>({width:390,height:700})),[]),c=(0,$.useMemo)((()=>a[0]<600),[a]),[u,d]=(0,$.useState)(!1),[h,f]=(0,$.useState)(0);(0,$.useEffect)((()=>{s!==u&&(!u&&s&&f((e=>e+1)),d(s))}),[s,u]);const m=(0,$.useCallback)((()=>n?n.state.liveChat:(0,bt.QA)()),[n]);return s?(0,M.h)(yt,{fullscreen:c,size:l,sizing:p.aY.ExternalSizing,show:s,isBotWindow:!0,autoFocus:!0},r.mock&&(0,M.h)($r,null),(0,M.h)(re.S,{dependencies:[h]},(0,M.h)(re.P7,{classname:"chat-body",isClosed:!s,fullscreen:c,isLeftAligned:"left"===t},(0,M.h)(ie.m,{initialStateGetter:m,lcSession:n},i&&(0,M.h)(xr,{fullscreen:c}),(0,M.h)(ae,null))))):null}const Fr="https://bot.leadoo.com/images/e053844f6f689a8ea2e8b23f31af954c.asset.svg";var qr=s(4456);function Br(e){let{horPos:t,launchSize:n,launchVisibility:r,triggerImage:i,triggerImageType:s,isMobile:a}=e;const l=(0,$.useMemo)(o.tU,[]),{isOpen:c,toggle:u}=(0,$.useContext)(ne.f),d=t<50,h=(0,$.useCallback)((()=>{l.mock||(c||(0,qr.jx)(l),u())}),[u]);return(0,M.h)(yt,{sizing:p.aY.InternalSizing,title:c?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title"),visible:r,rootClassName:F()({"launcher-mobile":a})},l.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("launch-wrap",{"left-aligned":d})},(0,M.h)(re.RN,{chatIcon:Fr,handleIsOpen:h,isOpen:c,sizePercent:n,triggerImage:i,triggerImageType:s,triggerImageAlt:(0,Et.t)("a11y.chat-trigger.image.alt"),openIconAlt:(0,Et.t)("a11y.chat-launch-open-icon-alt"),closeIconAlt:(0,Et.t)("a11y.chat-close-icon-alt"),ariaLabel:c?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title")})))}var zr=s(3650),Vr=s(890);function Hr(e){let{botIcon:t,title:n,description:r,horPos:i,launchSize:s,triggerImage:a,triggerImageType:l,launchVisibility:c,isMobile:u}=e;const d=(0,$.useMemo)(o.tU,[]),{hasOpened:h,isOpen:f,toggle:m,open:g,hasStyleOpened:v,toggleCTA:y,isCTAKeyDeleted:b,setIsCTAKeyDeleted:_}=(0,$.useContext)(ne.f),[w,x]=(0,$.useState)(!1),C=(0,re.uA)(s,re.Cv,re.i2),k=(0,re.uA)(s,re.W5,re.kZ),S=Vr.$1.LaunchCtaReset+(0,o.tU)().botID,O=!h&&v&&b,j=(0,$.useCallback)((()=>{d.mock||(f||(0,qr.jx)(d),m())}),[m]),P=i<50;(0,$.useEffect)((()=>{const e=localStorage.getItem(S);_(!e)}),[S]);const E=!d.mock&&(f||!w||!O);return(0,M.h)(yt,{sizing:p.aY.InternalSizing,title:f?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title"),visible:c,rootLimitSize:{width:330,height:90},rootClassName:F()({"launcher-mobile":u})},d.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("launch-wrap","launch-2-wrap",{"left-aligned":P,closed:E}),style:{width:E?k:C,height:k}},(0,M.h)(re.xx,Object.assign({avatarAlt:(0,Et.t)("chat.bot-avatar-alt"),botIcon:t,description:(0,zr.Q)(r),showMessage:d.mock||O,opened:h,sizePercent:s,leftAligned:P,onClick:()=>{d.mock||(g(),f||(0,qr.jx)(d),y())},title:n,visibilityCb:x},d.mock?{}:{closeDelay:6e3})),(0,M.h)(re.RN,{chatIcon:Fr,handleIsOpen:j,isOpen:f,triggerImage:a,triggerImageType:l,triggerImageAlt:(0,Et.t)("a11y.chat-trigger.image.alt"),openIconAlt:(0,Et.t)("a11y.chat-launch-open-icon-alt"),closeIconAlt:(0,Et.t)("a11y.chat-close-icon-alt"),sizePercent:s,ariaLabel:f?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title")})))}function Wr(e){let{horPos:t,imageUrl:n,launchVisibility:r,launchSize:i,triggerImage:s,triggerImageType:a,isMobile:l}=e;const{hasOpened:c,isOpen:u,open:d,toggle:h,hasStyleOpened:f,closeCTA:m}=(0,$.useContext)(ne.f),g=(0,$.useMemo)(o.tU,[]),v=t<50,y=!c&&f,b=(0,$.useCallback)((()=>{g.mock||(u||(0,qr.jx)(g),h())}),[h]),_=(0,$.useCallback)((()=>{g.mock||(m(),u||(0,qr.jx)(g),d())}),[m,d]);return(0,M.h)(M.Fragment,null,(0,M.h)(yt,{show:g.mock||y,sizing:p.aY.InternalSizing,title:(0,Et.t)("a11y.chat-trigger.image.title"),visible:r,rootClassName:F()({"launcher-mobile":l})},g.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("media-wrap",{"left-aligned":v})},(0,M.h)(re.qf,{containerId:"cta-image",imageAlt:"Bot CTA",imageUrl:n,sizePercent:i,leftAligned:v,onActivate:_,handleClose:m,visible:g.mock||y}))),(0,M.h)(yt,{sizing:p.aY.InternalSizing,title:u?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title"),visible:r,rootClassName:F()({"launcher-mobile":l})},g.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("launch-wrap","launch-wrap-media",{"left-aligned":v})},(0,M.h)(re.RN,{additionalStyles:{bottom:"0px",right:v?"unset":"0px",left:v?"0px":"unset"},chatIcon:Fr,handleIsOpen:b,isOpen:u,triggerImage:s,triggerImageType:a,triggerImageAlt:(0,Et.t)("a11y.chat-trigger.image.alt"),openIconAlt:(0,Et.t)("a11y.chat-launch-open-icon-alt"),closeIconAlt:(0,Et.t)("a11y.chat-close-icon-alt"),sizePercent:i,ariaLabel:u?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title")}))))}function Gr(e){let{title:t,horPos:n,launchSize:r,launchVisibility:i,triggerImage:s,isMobile:a}=e;const l=(0,$.useMemo)(o.tU,[]),{isOpen:c,toggle:u}=(0,$.useContext)(ne.f),d=(0,$.useCallback)((()=>{l.mock||(c||(0,qr.jx)(l),u())}),[u]),h=n<50;return(0,M.h)(yt,{show:!c,sizing:p.aY.InternalSizing,title:c?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title"),visible:i,rootClassName:F()({"launcher-mobile":a})},l.mock&&(0,M.h)($r,null),(0,M.h)(re.oo,{isOpen:c,title:t,triggerImage:s,handleIsOpen:d,leftAligned:h,sizePercent:r}))}function Qr(e){let{title:t,horPos:n,botIcon:r,description:i,launchSize:s,launchVisibility:a,triggerImage:l,triggerImageType:c,isMobile:u}=e;const d=(0,$.useMemo)(o.tU,[]),{hasOpened:h,isOpen:f,toggle:m,hasStyleOpened:g,toggleCTA:v}=(0,$.useContext)(ne.f),[y,b]=(0,$.useState)(!1),_=!h&&!y&&g;(0,$.useEffect)((()=>{g&&b(!1)}),[g]);const w=(0,$.useCallback)((()=>{d.mock||(b(!0),f||(0,qr.jx)(d),m())}),[f,m]),x=n<50,C=d.mock||_;return(0,M.h)(M.Fragment,null,(0,M.h)(yt,{show:C,sizing:p.aY.InternalSizing,title:(0,Et.t)("a11y.chat-trigger.modal.title"),visible:a,rootLimitSize:{width:344,height:172},rootClassName:F()({"launcher-mobile":u})},d.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("media-wrap",{"left-aligned":x})},(0,M.h)(re.U9,{avatarAlt:(0,Et.t)("chat.bot-avatar-alt"),botIcon:r,containerId:"bubble-text",description:(0,zr.Q)(i),sizePercent:s,leftAligned:x,handleClose:v,handleOpen:w,title:t,visible:C}))),(0,M.h)(yt,{sizing:p.aY.InternalSizing,title:f?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title"),visible:a,rootLimitSize:{width:80,height:80},rootClassName:F()({"launcher-mobile":u})},d.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("launch-wrap","launch-wrap-media",{"left-aligned":x})},(0,M.h)(re.RN,{chatIcon:Fr,handleIsOpen:w,isOpen:f,sizePercent:s,additionalStyles:{bottom:"0px",right:x?"unset":"0px",left:x?"0px":"unset"},triggerImage:l,triggerImageType:c,triggerImageAlt:(0,Et.t)("a11y.chat-trigger.image.alt"),openIconAlt:(0,Et.t)("a11y.chat-launch-open-icon-alt"),closeIconAlt:(0,Et.t)("a11y.chat-close-icon-alt"),ariaLabel:f?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title")}))))}var Kr=s(8753),Yr=s(8680);const Jr=[p.xi.SingleChoice,p.xi.SingleChoiceURL,p.xi.MultipleChoice];function Zr(){const[e,t]=(0,$.useState)([null,[]]),n=(0,$.useRef)(!0),r=(0,o.tU)();return(0,$.useEffect)((()=>{if(!r.mock)return(0,Yr.b)().then((e=>{let[r,i]=e;n.current&&!1!==Jr.includes(r.type)&&t([r,i])})).catch((e=>{console.error(e)})),()=>{n.current=!1}}),[]),e}function Xr(e){let{handleAnswerSubmit:t,visible:r,isSmall:i,leftAligned:s,setOptionsClosed:a}=e;const l=(0,$.useMemo)(o.tU,[]),[c,u]=(0,$.useState)([]),[d,h]=(0,$.useState)(null),[p,f]=Zr(),m=(null==p?void 0:p.type)===n.xi.MultipleChoice,g=(0,$.useMemo)((()=>l.mock?[{title:"Option 1",id:-1},{title:"Option 2",id:-2}]:f.map((e=>({title:e.text,id:e.id})))),[f]);return(0,M.h)("div",{className:F()("media-wrap",{"left-aligned":s})},(0,M.h)("div",{className:"close-wrapper"},(0,M.h)(re.In,{dataSettings:"close-trigger-options",onClick:()=>{a(!0)},className:"close-btn",role:"button",alt:(0,Et.t)("a11y.chat-close-options"),name:vn.gzW,tabIndex:0,"aria-label":(0,Et.t)("a11y.chat-close-options")})),(0,M.h)(re.ni,{selectedOptions:c,onChange:e=>{l.mock||(m?(h(null),u(e)):t(e))},options:g,visible:r,isSmall:i,leftAligned:s,isMultiple:m,isTrigger:!0}),m&&(0,M.h)(M.Fragment,null,d&&(0,M.h)(re.o5,{ariaLive:"assertive",id:"validation",className:"validation-error"},d),(0,M.h)("div",{className:"submit-wrapper"},(0,M.h)(re.$n,{style:{animationDelay:.5+.085*g.length+"s"},className:"submit-btn",onClick:()=>{if(!p)return;const e=Dn(p,c.length);e?h((0,Et.t)(e.message,e.param)):t(c)},fullWidth:!0},(0,M.h)("span",{className:"submit-btn-text"},(0,Et.t)("answer.submit.label"))))))}function ei(e){let{launchSize:t,launchVisibility:n,toggleOpen:r,isLeftAligned:i,isMobile:s}=e;const l=(0,$.useMemo)(o.tU,[]),{hasOpened:c,hasStyleOpened:u}=(0,$.useContext)(ne.f),{dispatch:d}=(0,$.useContext)(Y.p),[h,f]=Zr(),[m,g]=(0,$.useState)(!1),v=!c&&u,y=l.mock||v&&!l.leadID&&!m,b=(0,$.useCallback)((e=>{if(e.length){if(l.prefetched={answers:f,question:h,selectedAnswerIDs:e},l.prefetchedStarted=!0,(0,a.Rm)(`set prefetch data - question = ${l.prefetched.question.id} answers = ${l.prefetched.selectedAnswerIDs}`),d({type:Z.Ud.SetPromptAnswered,answered:!0}),null!=h&&h.type&&[p.xi.SingleChoiceURL,p.xi.SingleChoice].includes(null==h?void 0:h.type)){const n=f.filter((t=>e.includes(t.id)))[0];var t;if(n&&n.url&&n.is_sent_to_url)(0,Jt.F)(n.url,null!==(t=n.target_link)&&void 0!==t?t:"_blank")}r()}}),[f,l,h,r]);return(0,M.h)(yt,{show:y,sizing:p.aY.InternalSizing,title:(0,Et.t)("a11y.chat-trigger.choices.title"),visible:n,rootClassName:F()({"launcher-mobile":s})},l.mock&&(0,M.h)($r,null),(0,M.h)(Xr,{handleAnswerSubmit:b,visible:y,isSmall:t<50,leftAligned:i,setOptionsClosed:g}))}function ti(e){let{horPos:t,launchSize:n,launchVisibility:r,triggerImage:i,triggerImageType:s,toggleOpen:a,isMobile:l}=e;const c=(0,$.useMemo)(o.tU,[]),{isOpen:u}=(0,$.useContext)(ne.f),d=t<50;return(0,M.h)(M.Fragment,null,(0,M.h)(ei,{toggleOpen:a,launchSize:n,launchVisibility:r,isMobile:l,isLeftAligned:d}),(0,M.h)(yt,{sizing:p.aY.InternalSizing,title:u?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title"),visible:r,rootClassName:F()({"launcher-mobile":l}),rootLimitSize:{width:80,height:80}},c.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("launch-wrap","launch-wrap-media",{"left-aligned":d})},(0,M.h)(re.RN,{chatIcon:Fr,handleIsOpen:a,isOpen:u,sizePercent:n,additionalStyles:{bottom:"0px",right:d?"unset":"0px",left:d?"0px":"unset"},triggerImage:i,triggerImageType:s,triggerImageAlt:(0,Et.t)("a11y.chat-trigger.image.alt"),openIconAlt:(0,Et.t)("a11y.chat-launch-open-icon-alt"),closeIconAlt:(0,Et.t)("a11y.chat-close-icon-alt"),ariaLabel:u?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title")}))))}function ni(e){var t;let{title:n,horPos:r,botIcon:i,botIconVisible:s,launchSize:a,launchVisibility:l,triggerImage:c,triggerImageType:u,isMobile:d}=e;const h=(0,$.useMemo)(o.tU,[]),{hasOpened:f,isOpen:m,isStyleOpen:g,toggle:v,hasStyleOpened:y,toggleCTA:b,closeCTA:_}=(0,$.useContext)(ne.f),[w]=Zr(),x=!f&&y,C=(0,$.useCallback)((async()=>{h.mock||(h.token||await(0,Kr.BQ)(),m||(0,qr.jx)(h),v(),g&&_())}),[f,g,v,h.token,h.mock]),k=r<50,S=h.mock||x&&!h.leadID;return(0,$.useEffect)((()=>{m&&!h.token&&(0,Kr.BQ)()}),[m]),(0,M.h)(M.Fragment,null,(0,M.h)(yt,{show:S,sizing:p.aY.InternalSizing,title:(0,Et.t)("a11y.chat-trigger.modal.title"),visible:l,rootLimitSize:{width:344,height:172},rootClassName:F()({"launcher-mobile":d})},h.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("media-wrap",{"left-aligned":k})},(0,M.h)(re.U9,{avatarAlt:(0,Et.t)("chat.bot-avatar-alt"),botIcon:s?i:null,containerId:"bubble-prompt",description:null!==(t=null==w?void 0:w.text)&&void 0!==t?t:void 0,sizePercent:a,leftAligned:k,handleClose:b,handleOpen:C,title:n,visible:S}))),(0,M.h)(ti,{horPos:r,launchSize:a,launchVisibility:l,triggerImage:c,triggerImageType:u,isMobile:d,toggleOpen:C}))}function ri(e){var t;let{title:n,horPos:r,launchSize:i,launchVisibility:s,triggerImage:a,triggerImageType:l,isMobile:c}=e;const u=(0,$.useMemo)(o.tU,[]),{hasOpened:d,isOpen:h,isStyleOpen:f,toggle:m,hasStyleOpened:g,closeCTA:v}=(0,$.useContext)(ne.f),[y]=Zr(),b=(0,re.uA)(i,re.Cv,re.i2),_=(0,re.uA)(i,re.fg,re.pE),w=(0,re.uA)(i,re.W5,re.kZ),x=!d&&g,C=r<50,k=u.mock||x&&!u.leadID,S=!u.mock&&(h||!x),O=(0,$.useCallback)((async()=>{u.mock||(u.token||await(0,Kr.BQ)(),h||(0,qr.jx)(u),m(),f&&v())}),[d,f,m,u.token,u.mock]);return(0,$.useEffect)((()=>{h&&!u.token&&(0,Kr.BQ)()}),[h]),(0,M.h)(M.Fragment,null,(0,M.h)(ei,{toggleOpen:O,launchSize:i,launchVisibility:s,isMobile:c,isLeftAligned:C}),(0,M.h)(yt,{sizing:p.aY.InternalSizing,title:(0,Et.t)("a11y.chat-trigger.modal.title"),visible:s,rootLimitSize:{width:330,height:90},rootClassName:F()({"launcher-mobile":c})},u.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("launch-wrap","launch-2-wrap",{"left-aligned":C,closed:S,"launch-message-wrap":!S}),style:{width:S?w:b,height:S?w:_}},!S&&(0,M.h)(re.fs,{containerId:"bubble-prompt",description:null!==(t=null==y?void 0:y.text)&&void 0!==t?t:void 0,leftAligned:C,sizePercent:i,handleOpen:O,title:n,visible:k}),(0,M.h)(re.RN,{chatIcon:Fr,handleIsOpen:O,isOpen:h,triggerImage:a,triggerImageType:l,triggerImageAlt:(0,Et.t)("a11y.chat-trigger.image.alt"),openIconAlt:(0,Et.t)("a11y.chat-launch-open-icon-alt"),closeIconAlt:(0,Et.t)("a11y.chat-close-icon-alt"),sizePercent:i,ariaLabel:h?(0,Et.t)("a11y.chat-trigger-close.title"):(0,Et.t)("a11y.chat-trigger.title")}))))}function ii(e){let{horPos:t,launchSize:n,launchVisibility:r,triggerImage:i,triggerImageType:s,isMobile:a}=e;const l=(0,$.useMemo)(o.tU,[]),{hasOpened:c,isOpen:u,isStyleOpen:d,toggle:h,closeCTA:p}=(0,$.useContext)(ne.f),f=(0,$.useCallback)((async()=>{l.mock||(l.token||await(0,Kr.BQ)(),u||(0,qr.jx)(l),h(),d&&p())}),[c,d,h,l.token,l.mock]);return(0,$.useEffect)((()=>{u&&!l.token&&(0,Kr.BQ)()}),[u]),(0,M.h)(M.Fragment,null,(0,M.h)(ti,{horPos:t,launchSize:n,launchVisibility:r,triggerImage:i,triggerImageType:s,isMobile:a,toggleOpen:f}))}function oi(e){var t;let{title:n,horPos:r,botIcon:i,launchSize:s,launchVisibility:a,triggerImage:l,triggerImageType:c,isMobile:u}=e;const d=(0,$.useMemo)(o.tU,[]),{hasOpened:h,isOpen:f,isStyleOpen:m,toggle:g,hasStyleOpened:v,toggleCTA:y,closeCTA:b}=(0,$.useContext)(ne.f),[_]=Zr(),w=!h&&v,x=(0,$.useCallback)((async()=>{d.mock||(d.token||await(0,Kr.BQ)(),f||(0,qr.jx)(d),g(),m&&b())}),[h,m,g,d.token,d.mock]),C=r<50,k=d.mock||w&&!d.leadID;return(0,$.useEffect)((()=>{f&&!d.token&&(0,Kr.BQ)()}),[f]),(0,M.h)(M.Fragment,null,(0,M.h)(yt,{show:k,sizing:p.aY.InternalSizing,title:(0,Et.t)("a11y.chat-trigger.modal.title"),visible:a,rootLimitSize:{width:344,height:205},rootClassName:F()({"launcher-mobile":u})},d.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("media-wrap","card-wrap",{"left-aligned":C})},(0,M.h)(re.NQ,{avatarAlt:(0,Et.t)("chat.bot-avatar-alt"),botIcon:null!=i?i:"",containerId:"bubble-prompt",description:null!==(t=null==_?void 0:_.text)&&void 0!==t?t:void 0,sizePercent:s,leftAligned:C,handleClose:y,handleOpen:x,title:n,visible:k}))),(0,M.h)(ti,{horPos:r,launchSize:s,launchVisibility:a,triggerImage:l,triggerImageType:c,isMobile:u,toggleOpen:x}))}function si(e){let{horPos:t,imageUrl:n,launchVisibility:r,launchSize:i,triggerImage:s,triggerImageType:a,isMobile:l}=e;const{hasOpened:c,isOpen:u,open:d,toggle:h,hasStyleOpened:f,closeCTA:m}=(0,$.useContext)(ne.f),g=(0,$.useMemo)(o.tU,[]),v=t<50,y=!c&&f,b=(0,$.useCallback)((async()=>{g.mock||(g.token||await(0,Kr.BQ)(),u||(0,qr.jx)(g),h())}),[h]),_=(0,$.useCallback)((()=>{g.mock||(m(),u||(0,qr.jx)(g),d())}),[m,d]);return(0,$.useEffect)((()=>{u&&!g.token&&(0,Kr.BQ)()}),[u]),(0,M.h)(M.Fragment,null,(0,M.h)(yt,{show:g.mock||y,sizing:p.aY.InternalSizing,title:(0,Et.t)("a11y.chat-trigger.image.title"),visible:r,rootClassName:F()({"launcher-mobile":l})},g.mock&&(0,M.h)($r,null),(0,M.h)("div",{className:F()("media-wrap",{"left-aligned":v})},(0,M.h)(re.qf,{containerId:"cta-image",imageAlt:"Bot CTA",imageUrl:n,sizePercent:i,leftAligned:v,onActivate:_,handleClose:m,visible:g.mock||y}))),(0,M.h)(ti,{horPos:t,launchSize:i,launchVisibility:r,triggerImage:s,triggerImageType:a,isMobile:l,toggleOpen:b}))}function ai(e){let{botIcon:t,botIconVisible:n,horPos:r,launchDescription:i,launchImage:s,launchSize:a,launchTitle:l,launchTitleAlt:c,launchVisibility:u,triggerImage:d,triggerImageType:h,style:f}=e;const m=(0,o.tU)(),g=(0,$.useMemo)((()=>{var e;return m.mock?{botIcon:m.botIcon,botIconVisible:m.settings.bot_icon_visible,horPos:k(m.settings.launch_pos_hor),launchDescription:m.settings.launch_description,launchImage:m.settings.launch_image,launchSize:m.settings.launch_size,launchTitle:null!==(e=m.settings.launch_title)&&void 0!==e?e:"",launchTitleAlt:m.settings.launch_title_alt,style:m.settings.launch_style,triggerImage:m.settings.trigger_image,triggerImageType:m.settings.trigger_image_type,launchVisibility:m.settings.launcher_visible,isMobile:m.deviceType===p.bq.Mobile}:{botIcon:t,botIconVisible:n,horPos:r,launchDescription:i,launchImage:s,launchSize:a,launchTitle:l,launchTitleAlt:c,style:f,triggerImage:d,triggerImageType:h,launchVisibility:u,isMobile:m.deviceType===p.bq.Mobile}}),[m.settings,m.deviceType,m.botIcon]);if(!(m.mock&&g.launchVisibility||!m.mock))return null;switch(g.style){case p.TL.SimpleIcon:return(0,M.h)(Br,{horPos:g.horPos,launchSize:g.launchSize,launchVisibility:g.launchVisibility,triggerImage:g.triggerImage,triggerImageType:g.triggerImageType,isMobile:g.isMobile});case p.TL.TemporaryMessage:return(0,M.h)(Hr,{horPos:g.horPos,botIcon:g.botIcon,title:g.launchTitle,description:g.launchDescription,launchVisibility:g.launchVisibility,launchSize:g.launchSize,triggerImage:g.triggerImage,triggerImageType:g.triggerImageType,isMobile:g.isMobile});case p.TL.ImageOrGIF:return(0,M.h)(Wr,{horPos:g.horPos,imageUrl:g.launchImage,launchSize:g.launchSize,triggerImage:g.triggerImage,triggerImageType:g.triggerImageType,launchVisibility:g.launchVisibility,isMobile:g.isMobile});case p.TL.TextCTA:return(0,M.h)(Gr,{title:g.launchTitleAlt,horPos:g.horPos,launchSize:g.launchSize,triggerImage:g.triggerImage,launchVisibility:g.launchVisibility,isMobile:g.isMobile});case p.TL.BubbleImage:return(0,M.h)(Qr,{horPos:g.horPos,botIcon:g.botIcon,title:g.launchTitle,description:g.launchDescription,launchSize:g.launchSize,triggerImage:g.triggerImage,triggerImageType:g.triggerImageType,launchVisibility:g.launchVisibility,isMobile:g.isMobile});case p.TL.BubbleImageAnswers:return(0,M.h)(ni,{horPos:g.horPos,botIcon:g.botIcon,botIconVisible:g.botIconVisible,title:g.launchTitle,launchSize:g.launchSize,triggerImage:g.triggerImage,triggerImageType:g.triggerImageType,launchVisibility:g.launchVisibility,isMobile:g.isMobile});case p.TL.MessageAndAnswers:return(0,M.h)(ri,{horPos:g.horPos,title:g.launchTitle,launchSize:g.launchSize,triggerImage:g.triggerImage,triggerImageType:g.triggerImageType,launchVisibility:g.launchVisibility,isMobile:g.isMobile});case p.TL.IconAndAnswers:return(0,M.h)(ii,{horPos:g.horPos,launchSize:g.launchSize,triggerImage:g.triggerImage,triggerImageType:g.triggerImageType,launchVisibility:g.launchVisibility,isMobile:g.isMobile});case p.TL.CardAndAnswers:return(0,M.h)(oi,{horPos:g.horPos,botIcon:g.botIcon,title:g.launchTitle,launchSize:g.launchSize,triggerImage:g.triggerImage,triggerImageType:g.triggerImageType,launchVisibility:g.launchVisibility,isMobile:g.isMobile});case p.TL.ImageOrGIFAndAnswers:return(0,M.h)(si,{horPos:g.horPos,imageUrl:g.launchImage,launchSize:g.launchSize,triggerImage:g.triggerImage,triggerImageType:g.triggerImageType,launchVisibility:g.launchVisibility,isMobile:g.isMobile});default:throw new Error(`Invalid launch style: ${f}`)}}function li(e){const t=(0,$.useMemo)(o.tU,[]),{settings:{launch_style:n}}=t,r=R.RR.includes(n);return(0,M.h)(K.v,null,(0,M.h)(ne.T,null,(0,M.h)(ci,{config:e.config,prefetch:r})))}function ci(e){let{config:t,prefetch:n}=e;const r=(0,$.useMemo)(o.tU,[]),{close:i,lcSession:s,open:a,showBot:l}=(0,$.useContext)(ne.f);return(0,M.h)(te,{botCode:r.botCode,botTypeName:"Chat",closeBot:i,customAPI:r.customAPI,openBot:a,showBot:l},(0,M.h)(ui,{config:t,lcSession:s,prefetch:n}))}function ui(e){let{config:t,lcSession:n,prefetch:r}=e;const{botIcon:i,botIconVisible:s,horPos:a,launchDescription:l,launchImage:c,launchSize:u,launchTitle:d,launchTitleAlt:h,launchVisibility:f,style:m,triggerImage:g,triggerImageType:v,vertPos:y}=t,{api:b}=(0,$.useContext)(ee),{isOpen:_,visible:w}=(0,$.useContext)(ne.f),x=(0,$.useMemo)(o.tU,[]),C=(0,$.useCallback)((()=>n?n.state.botFlow:(0,Z.L7)()),[n]),S=(0,$.useMemo)((()=>x.mock?{horPos:k(x.settings.launch_pos_hor)}:{horPos:a}),[x.settings,x.botIcon]);(0,$.useEffect)((()=>{x.destroyed&&b.destroy()}),[b,x]);const O=S.horPos<50?"left":"right";return(0,M.h)(Y.h,{active:r||_,initialStateGetter:C,reloadBot:b.reload,destroyBot:b.destroy},(0,M.h)(G,{horPos:a,overlap:(j=m,j===p.TL.TextCTA),stackDirection:"vertical",vertPos:y,triggerPreviewPos:x.triggerPreviewPos},(0,M.h)(Q,{alignment:O,open:_,visible:w},(0,M.h)(Ur,{alignment:O,lcSession:n}),(0,M.h)(ai,{botIcon:i,botIconVisible:s,horPos:a,launchDescription:l,launchImage:c,launchSize:u,launchTitle:d,launchTitleAlt:h,launchVisibility:f,style:m,triggerImage:g,triggerImageType:v}))));var j}function di(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function hi(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)();if(!Array.isArray(e.settings))return;const{deviceType:t,preview:n}=e,r=e.settings.find((e=>e.device_type==t));if(!r)throw new Error(`No matching settings found for device: ${t}`);e.settings=r,n&&(e.settings.launcher_visible=!0,(0,a.Rm)("forcing visibility for preview")),(0,a.Rm)(`resolved settings for device: ${t}`)}(n),await async function(){await(0,_i.YW)();const e=await(0,oe.A)();if(e){(0,a.Rm)("initialising bugsnag");const{botCode:t,botID:n,companyCode:r,companyID:i}=(0,o.tU)();await e.initialise("4e30ab8572223eed601cb876970ce2a2",{botCode:t,botID:n,companyCode:r,companyID:i})}}(),(0,a.Rm)("waiting for page to become ready"),await(0,gi.j)(),(0,a.Rm)("page ready: continue init");const s=n.lock=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return"object"!=typeof t[bi]&&(t[bi]={}),t[bi][e]?null:(t[bi][e]=!0,{release:()=>{t[bi][e]=!1}})}("chat");if(!s)throw new Error("Failed obtaining chat lock: Multiple chat bots are running");n.preview&&(0,a.Rm)("preview mode");const l=function(){if(y.test(window.location.href))return p.Zj.Iframe;if(!h())throw new Error("Failed detecting injection type: No parent script found");return p.Zj.InLine}();n.mock||(await(0,qr.T2)(!0,n,l===p.Zj.Iframe),(0,qr._Q)(n)),wi._A.visible=n.isBotVisible,(0,a.Rm)("creating UI"),await fi(),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,o.tU)(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.document;D({"#ld-chat-app .ld-app-cont":hi({},O(R.Pn,["width","height"])),"#ld-chat-app, #ld-bot-flow":hi({},R.Pn),"#ld-chat-app #ld-bot-flow":{zIndex:`${"number"==typeof e.zIndex?e.zIndex-2:e.zIndex} !important`},"#ld-chat-app .ld-app-launcher":{zIndex:`${"number"==typeof e.zIndex?e.zIndex-2:e.zIndex} !important`},"#ld-chat-app .ld-app-window":{zIndex:`${"number"==typeof e.zIndex?e.zIndex-1:e.zIndex} !important`}},t)}(n),await(0,mi.M)(),(0,e.y)(),(0,e.X)().push({type:"register",code:n.botCode}),(0,t.P)(R.nR,{botType:"chat",deviceType:n.deviceType}),yi({type:"bot-init",botType:"chat"});let c=!0;n.mock||([,c]=await Promise.all([await(0,Vr.Cg)(),await(0,Vr.GK)()])),c&&((0,a.Rm)("bot trigger activated"),wi._A.hasOpened||(wi._A.isOpen=!0,wi._A.hasOpened=!0)),(0,a.Rm)("initialisation complete")})().catch((e=>{(0,a.Rm)(`fatal initialisation error: ${e.message}`),console.error(e),yi({type:"bot-init-failure",botType:"chat"}),(0,oe.U)(e)}))})()})();