import{c as e,C as t,a as n,b as r,O as i,i as a,j as s,P as o,B as l,Q as c,f as u,d,k as p,L as g,R as h,J as m,S as f,U as _,z as b,V as v,X as y,x as w,Y as k,Z as x,u as I,y as S,$ as E,A,t as T,N as C,e as z,E as D}from"./7.DaJJFJ3Z.chunk.js";import{k as $,i as M,h as F,s as P,f as R,n as O,g as B,r as q,j,l as U,c as N}from"./3.CJvEkDRx.chunk.js";import{a as L,c as V,p as G,b as Z,f as H,d as W,u as Y,k as Q,t as J,s as X,F as K,o as ee,m as te,e as ne,h as re,_ as ie,H as ae,j as se,i as oe,q as le,l as ce,v as ue}from"./2.pu7iWzia.chunk.js";function de(e,t){return t=t||{},new Promise(function(n,r){var i=new XMLHttpRequest,a=[],s=[],o={},l=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:l,headers:{keys:function(){return a},entries:function(){return s},get:function(e){return o[e.toLowerCase()]},has:function(e){return e.toLowerCase()in o}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,n){a.push(t=t.toLowerCase()),s.push([t,n]),o[t]=o[t]?o[t]+","+n:n}),n(l())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)})}function pe(e,t){return[].concat(...t.map(e))}function ge(e,t){return $(t).reduce((n,r)=>(n[r]=e(t[r]),n),{})}function he(e){let t=e.trim();if(0===t.length)return"";if(1===t.length)return t.toLowerCase();if(/^[a-z\d]+$/.test(t))return t;return t!==t.toLowerCase()&&(t=function(e){let t=e,n=!1,r=!1,i=!1;for(let a=0;at.toUpperCase()),t}function me(e){return M(e)?e:[e]}function fe(e){return $(e).map(t=>[t,e[t]])}function _e(e,t){for(let n=t.length-1;n>=0;n--)if(e(t[n]))return t[n]}function be(e,t,n){for(let r=t;r>=0;r--)if(e(n[r]))return r;return-1}function ve(e,t){return be(e,t.length-1,t)}function ye(e,t){if(e<=0)return[];const n=[];for(;e--;)n.push(t);return n}function we(t){const n=e();return F(n,t)?we(t):n}function ke(e,t){const n="string"==typeof e?e.split("."):e;let r=0,i=t;for(;i&&r(t[n[e]]=n,t),{})}function Ie(e){return e.length>0?e[e.length-1]:void 0}function Se(e,t){return $(t).reduce((n,r)=>(Object.defineProperty(n,e(r),{value:t[r],enumerable:!0}),n),{})}function Ee(e){return $(e).map(t=>e[t])}function Ae(e,t){const n="function"==typeof e?e:t=>ke(e,t);return(M(t)?[...t]:Ee(t)).sort((e,t)=>n(e)-n(t))}function Te(e,n){return t((t,n)=>-1!==e.indexOf(n),n)}function Ce(e,t){return e.reduce((e,n)=>(e[n]=t[n],e),{})}function ze(e,t){return e.reduce((e,n)=>(F(n,t)&&(e[n]=t[n]),e),{})}function De(e,t){return t.filter(t=>!e(t))}function $e(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function Me(e,t){if($e(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;ie)break;i+=a.length+1,r.push(a)}return 0===r.length?`${t.slice(0,e)}...`:`${r.join(" ")}...`}function Pe(e,t,n){const r=be(t=>!e(t),t,n);return r===t?[]:n.slice(r+1,t+1)}function Re(e){return $(e).map(t=>[t,e[t]])}function Oe(e,t){return e===t?0:e{const r=e(t);return-1===n.indexOf(r)&&(n.push(r),!0)})}function qe(e,t,n){return[...n.slice(0,e),t,...n.slice(e+1,n.length)]}function je(e){return void 0===e&&(e=-1),function(t){return function(n,r){if(0===n){var i,a=!1,s=e,o=function(e,t){i(e,t)};!function e(){t(0,function(t,n){return 0===t?(i=n,a?void o(1):(a=!0,void r(0,o))):2===t&&n&&0!==s?(s--,void e()):void r(t,n)})}()}}}}const Ue={},Ne=e=>t=>(n,r)=>{if(0!==n)return;let i,a,s=!1,o=Ue;t(0,(t,n)=>{if(0===t)return i=n,e(0,(e,t)=>0===e?(a=t,void a(1)):1===e?(o=void 0,a(2),i(2),void(s&&r(2))):void(2===e&&(a=null,t&&(o=t,i(2),s&&r(e,t))))),s=!0,r(0,(e,t)=>{o===Ue&&(2===e&&a&&a(2),i(e,t))}),void(o!==Ue&&r(2,o));2===t&&a(2),r(t,n)})};function Le(){const e=P();return[e,()=>{const t=new Error("Destroyed.");t.code="DESTROYED",e(2,t)}]}function Ve(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const Ge=e();let Ze=0;const He=e=>{const t=document.createElement("a");if(t.href=e,t.origin)return"null"===t.origin?"*":t.origin;const n=t.protocol.length>4?t.protocol:window.location.protocol;let r;return r=t.host.length?"80"===t.port||"443"===t.port?t.hostname:t.host:window.location.host,`${n}//${r}`};function We(e,t){let{frame:n,targetOrigin:r=He(n.src),handshakeRetry:i={}}=e;void 0===t&&(t={});const[a,s]=L(t),[o,l]=Le(),c=Ze++,u=n.contentWindow,d=V(),p=(e,t)=>ie(Ge,c,e,t),g=e=>{u.postMessage(e,r)},h=G(Z(),H(e=>e.owner===Ge&&e.instance===c),Ne(o),R),m=W(d,h,p,g),f=G(Y(h,g,p(se,s),null),Q(i.interval||500),je(i.count||5),J(1),X(e=>K in e?G(Y(h,g,p(ae)),te(()=>e.data)):ee(()=>e)),Ne(o),R),_=ne(m,d.emit,g,a);return G(f,X(()=>h),re(_)),{api:m,destroy:l,handshake$:f}}function Ye(){return new Promise(e=>{const t=()=>{document.body?e(document.body):setTimeout(t,100)};t()})}function Qe(e){const{parentNode:t}=e;t&&t.removeChild(e)}const Je=(e,t)=>{const n=document.createElement("iframe");return e.appendChild(n),n.src=t,n};function Xe(e,t){let{onConnected:n,...r}=e;const i=!r.frame,a=(e=>{if(e.frame)return e.frame;const{container:t,url:n}=e;return Je(t,n)})(r),[s,o]=Le();let l;const c=()=>{i&&Qe(a),l?l.destroy():o()};return G(ce(a,"load"),X(()=>le((e,n)=>{let i=function(e,t){const{api:n,destroy:r,handshake$:i}=We(e,t);return{destroy:r,promise:G(i,te(e=>(n.data=e,n.destroy=r,n)),oe)}}({...r,frame:a},t);return i.promise.then(e,n),l=i,i.destroy})),je(),Ne(s),re(e=>{e.destroy=c,e.frame=a,n(e)})),{destroy:c,frame:a}}const Ke=e=>Re(e).map(e=>e.map(encodeURIComponent).join("=")).join("&"),et=/(?:[^:]+:\/\/)?([^/\s]+)/;function tt(e){const t=e.match(et);return t&&t[1]}const nt=(e,t)=>n(t)[e],rt=/^(?:https?:)?\/\/[^/]+\/([^?#]+)/,it=e=>{const t=e.match(rt);return`/${t&&t[1]||""}`},at=/^((http(s)?:)?\/\/)/,st=e=>{const t=e.match(at);return t?t[2]:null},ot=(e,t)=>{if(0===Object.keys(t).length)return e;const a=r(e),s=it(e),o=i(e)?n(e):{},l=Ke({...o,...t});return e.indexOf("#")>-1?`${a}${s}?${l}#${e.split("#")[1]}`:`${a}${s}?${l}`},lt=(e,t)=>{if(-1===e.indexOf("?"))return e;const r=n(e);if(a(r))return e;if(Object.keys(r).every(e=>!t.includes(e)))return e;t.forEach(e=>delete r[e]);const[i]=e.split("?"),s=ot(i,r);return e.indexOf("#")>-1?`${s}#${e.split("#")[1]}`:s};function ct(){return ct=Object.assign?Object.assign.bind():function(e){for(var t=1;tn)throw new Error(e+" can not be empty and can only be "+n+" characters long.")},mt=function(e){if("string"!=typeof(e=gt(e)))throw new Error("`text` must be a string or a number.");e=e.trim(),ht("`text`",e,pt)},ft=function(e,t){return new Error('Attribute with key "'+e+'" is invalid. '+t)},_t=O,bt=Object.freeze({sendMessage:function(e){var t=e.text,n=e.postback;if(mt(t),void 0!==n){if("string"!=typeof n)throw new Error("`postback` must be a string.");ht("`postback`",n,pt)}},sendSystemMessage:function(e){var t=e.text,n=e.recipients;if(mt(t),void 0!==n&&-1===dt.indexOf(n))throw new Error("`recipients` can only be one of: "+dt+".")},setAttributes:function(e){if(!e||"object"!=typeof e)throw new Error("`attributes` must be a plain object (with shape such as `{ key: 'value' }`).");var t=Object.keys(e);if(t.length>99)throw new Error("The maximum number of attributes is 99.");t.forEach(function(t){var n=gt(e[t]);if(t=gt(t),!/^[\w-]{1,128}$/.test(t))throw ft(t,"Key must be between 1-128 characters long and can only contain alpha-numeric, underscore and dash characters.");if("string"!=typeof n)throw ft(t,"Value must be a string or a number.");ht("Value",n,1024)})},setExternalLink:function(e){if("string"==typeof e){if(!/^https:\/\//.test(e))throw new Error("`externalLink` has to be a HTTPS URL.")}else if(null!==e)throw new Error("`externalLink` has to be a string or null.")},setIsFragile:function(e){if("boolean"!=typeof e)throw new Error("`setIsFragile` argument value can not be empty and must be a boolean.")},getIdentityTransferToken:function(){},updateCustomerData:function(e){if(!e)throw new Error("`updateUserData` arguments values can not be empty.");if(e.email&&"string"!=typeof e.email)throw new Error("`updateUserData` argument `email` has to be a string.");if(e.name&&"string"!=typeof e.name)throw new Error("`updateUserData` argument `name` has to be a string.")},sendPostback:function(e){if(!e||"object"!=typeof e)throw new Error("`postback` must be a plain object.");if("string"!=typeof e.id)throw new Error("`postback.id` has to be a string.");if(ht("`postback.id`",e.id,pt),void 0!==e.type&&"string"!=typeof e.type)throw new Error("`postback.type` has to be a string.");if("string"==typeof e.type&&ht("`postback.type`",e.type,pt),void 0!==e.toggled&&"boolean"!=typeof e.toggled)throw new Error("`postback.toggled` must be a boolean.");if(void 0!==e.ecommerce){if("object"!=typeof e.ecommerce||null===e.ecommerce)throw new Error("`postback.ecommerce` must be a plain object.");if(void 0!==e.ecommerce.optionId&&"string"!=typeof e.ecommerce.optionId)throw new Error("`postback.ecommerce.optionId` must be a string.");if("string"==typeof e.ecommerce.optionId&&ht("`postback.ecommerce.optionId`",e.ecommerce.optionId,pt),void 0!==e.ecommerce.productId&&"string"!=typeof e.ecommerce.productId)throw new Error("`postback.ecommerce.productId` must be a string.");if("string"==typeof e.ecommerce.productId&&ht("`postback.ecommerce.productId`",e.ecommerce.productId,pt),void 0!==e.ecommerce.quantity&&"number"!=typeof e.ecommerce.quantity)throw new Error("`postback.ecommerce.quantity` must be a number.")}},close:_t,setTitle:function(e){if("string"!=typeof e)throw new Error("`setTitle` argument value has to be a string.");ht("`title`",e,1024)}}),vt=function(e){var t=r(e);if(!/chatbot\.com$/.test(t))return e;var n=s(o(i(e)));if(!n.p)return e;try{var a=JSON.parse(atob(n.p));return a.url?decodeURIComponent(a.url):e}catch(l){return e}};function yt(e,t){var n,r=vt(e.url),i=ue(function(e){return"function"==typeof e},t),a=i[0],s=i[1],o=l(function(e,t){return function(){return bt[t].apply(bt,arguments),e.apply(void 0,arguments)}},a),c=Xe(ct({},e,{targetOrigin:"*"}),ct({},s,o,{supportedMethods:Object.keys(o)})),u=c.destroy,d=c.frame;return d.sandbox=ut,{destroy:u,frame:d,title:(n=r,nt("moment-title",n)||tt(n))}}const wt=["xS94WbAZR","pJw7AxJZg"],kt=["DfltarqcrRoA5ZoZ","UsDoxZQESkzF0qds"];function xt(e){return wt.includes(e)}function It(e){return kt.includes(e)}const St=()=>"feade1d6c3f17748ae4c8d917a1e1068",Et=()=>"bb9e5b2f1ab480e4a715977b7b1b4279",At={whatsapp:"ee631a7ff555f8b6e354705201860c81",messenger:"0e655920289dbafb0376a0f4491372d9",apple:"22cc83ef7905d174b6a0eccb9ce404c0",telegram:"b0c559436b7d82f29d971faab4c6c2aa",twilio:"f14e86a88bd213b7b3717c9f76e5e823",instagram:"506038b7a51013790f6c159967b562ae"},Tt=()=>At,Ct=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,zt=/[\0-\x1F\x7F-\x9F]/,Dt=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,$t=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;function Mt(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function Ft(e){return Object.prototype.toString.call(e)}function Pt(e){return"[object Function]"===Ft(e)}function Rt(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const Ot={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};const Bt={"http:":{validate:function(e,t,n){const r=e.slice(t);return n.re.http||(n.re.http=new RegExp(`^\\/\\/${n.re.src_auth}${n.re.src_host_port_strict}${n.re.src_path}`,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){const r=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+`(?:localhost|(?:(?:${n.re.src_domain})\\.)+${n.re.src_domain_root})`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?t>=3&&":"===e[t-3]||t>=3&&"/"===e[t-3]?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){const r=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp(`^${n.re.src_email_name}@${n.re.src_host_strict}`,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},qt="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function jt(e){const t=e.re=function(e){const t={};e=e||{},t.src_Any=Ct.source,t.src_Cc=zt.source,t.src_Z=$t.source,t.src_P=Dt.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");const n="[><|]";return t.src_pseudo_letter=`(?:(?!${n}|${t.src_ZPCc})${t.src_Any})`,t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth=`(?:(?:(?!${t.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`,t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator=`(?=$|${n}|${t.src_ZPCc})(?!${e["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${t.src_ZPCc}))`,t.src_path=`(?:[/?#](?:(?!${t.src_ZCc}|${n}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${t.src_ZCc}|\\]).)*\\]|\\((?:(?!${t.src_ZCc}|[)]).)*\\)|\\{(?:(?!${t.src_ZCc}|[}]).)*\\}|\\"(?:(?!${t.src_ZCc}|["]).)+\\"|\\'(?:(?!${t.src_ZCc}|[']).)+\\'|\\'(?=${t.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${t.src_ZCc}|[.]|$)|`+(e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+`,(?!${t.src_ZCc}|$)|;(?!${t.src_ZCc}|$)|\\!+(?!${t.src_ZCc}|[!]|$)|\\?(?!${t.src_ZCc}|[?]|$))+|\\/)?`,t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+`|${t.src_pseudo_letter}{1,63})`,t.src_domain="(?:"+t.src_xn+`|(?:${t.src_pseudo_letter})|(?:${t.src_pseudo_letter}(?:-|${t.src_pseudo_letter}){0,61}${t.src_pseudo_letter}))`,t.src_host=`(?:(?:(?:(?:${t.src_domain})\\.)*${t.src_domain}))`,t.tpl_host_fuzzy="(?:"+t.src_ip4+`|(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${t.src_ZPCc}|>|$))`,t.tpl_email_fuzzy=`(^|${n}|"|\\(|${t.src_ZCc})(${t.src_email_name}@${t.tpl_host_fuzzy_strict})`,t.tpl_link_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${t.src_ZPCc}))((?![$+<=>^\`||])${t.tpl_host_port_fuzzy_strict}${t.src_path})`,t.tpl_link_no_ip_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${t.src_ZPCc}))((?![$+<=>^\`||])${t.tpl_host_port_no_ip_fuzzy_strict}${t.src_path})`,t}(e.__opts__),n=e.__tlds__.slice();function r(e){return e.replace("%TLDS%",t.src_tlds)}e.onCompile(),e.__tlds_replaced__||n.push("a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]"),n.push(t.src_xn),t.src_tlds=n.join("|"),t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),"i"),t.email_fuzzy_global=RegExp(r(t.tpl_email_fuzzy),"ig"),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),"i"),t.link_fuzzy_global=RegExp(r(t.tpl_link_fuzzy),"ig"),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),"i"),t.link_no_ip_fuzzy_global=RegExp(r(t.tpl_link_no_ip_fuzzy),"ig"),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),"i");const i=[];function a(e,t){throw new Error(`(LinkifyIt) Invalid schema "${e}": ${t}`)}e.__compiled__={},Object.keys(e.__schemas__).forEach(function(t){const n=e.__schemas__[t];if(null===n)return;const r={validate:null,link:null};if(e.__compiled__[t]=r,"[object Object]"===Ft(n))return!function(e){return"[object RegExp]"===Ft(e)}(n.validate)?Pt(n.validate)?r.validate=n.validate:a(t,n):r.validate=function(e){return function(t,n){const r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}(n.validate),void(Pt(n.normalize)?r.normalize=n.normalize:n.normalize?a(t,n):r.normalize=function(e,t){t.normalize(e)});!function(e){return"[object String]"===Ft(e)}(n)?a(t,n):i.push(t)}),i.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[""]={validate:null,normalize:function(e,t){t.normalize(e)}};const s=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(Rt).join("|");e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|${t.src_ZPCc}))(${s})`,"i"),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|${t.src_ZPCc}))(${s})`,"ig"),e.re.schema_at_start=RegExp(`^${e.re.schema_search.source}`,"i"),e.re.pretest=RegExp(`(${e.re.schema_test.source})|(${e.re.host_fuzzy_test.source})|@`,"i")}function Ut(e,t,n,r){const i=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}function Nt(e,t){if(!(this instanceof Nt))return new Nt(e,t);var n;t||(n=e,Object.keys(n||{}).reduce(function(e,t){return e||Ot.hasOwnProperty(t)},!1)&&(t=e,e={})),this.__opts__=Mt({},Ot,t),this.__schemas__=Mt({},Bt,e),this.__compiled__={},this.__tlds__=qt,this.__tlds_replaced__=!1,this.re={},jt(this)}var Lt,Vt;Nt.prototype.add=function(e,t){return this.__schemas__[e]=t,jt(this),this},Nt.prototype.set=function(e){return this.__opts__=Mt(this.__opts__,e),this},Nt.prototype.test=function(e){if(!e.length)return!1;let t,n;if(this.re.schema_test.test(e))for(n=this.re.schema_search,n.lastIndex=0;null!==(t=n.exec(e));)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0;return!!(this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&e.search(this.re.host_fuzzy_test)>=0&&null!==e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))||!!(this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&e.indexOf("@")>=0&&null!==e.match(this.re.email_fuzzy))},Nt.prototype.pretest=function(e){return this.re.pretest.test(e)},Nt.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},Nt.prototype.match=function(e){const t=[],n=[],r=[],i=[];let a,s,o;function l(e,t){return e?t?e.index!==t.index?e.index=t.lastIndex?e:t:e:t}if(!e.length)return null;if(this.re.schema_test.test(e))for(o=this.re.schema_search,o.lastIndex=0;null!==(a=o.exec(e));)s=this.testSchemaAt(e,a[2],o.lastIndex),s&&n.push({schema:a[2],index:a.index+a[1].length,lastIndex:a.index+a[0].length+s});if(this.__opts__.fuzzyLink&&this.__compiled__["http:"])for(o=this.__opts__.fuzzyIP?this.re.link_fuzzy_global:this.re.link_no_ip_fuzzy_global,o.lastIndex=0;null!==(a=o.exec(e));)r.push({schema:"",index:a.index+a[1].length,lastIndex:a.index+a[0].length});if(this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"])for(o=this.re.email_fuzzy_global,o.lastIndex=0;null!==(a=o.exec(e));)i.push({schema:"mailto:",index:a.index+a[1].length,lastIndex:a.index+a[0].length});const c=[0,0,0];let u=0;for(;;){const a=[n[c[0]],i[c[1]],r[c[2]]],s=l(l(a[0],a[1]),a[2]);if(!s)break;if(s===a[0]?c[0]++:s===a[1]?c[1]++:c[2]++,s.index{const t=e();t&&c().push(t)},0):q.useEffect(e,t)}function Ht(e,t){return e===t}function Wt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ht,n=null,r=null;return function(){return function(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,i=0;i1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:{},i=void 0,a=void 0;"function"==typeof n?(console.warn('[re-reselect] Deprecation warning: "selectorCreator" argument is discouraged and will be removed in the upcoming major release. Please use "options.selectorCreator" instead.'),i=new r,a=n):(i=n.cacheObject||new r,a=n.selectorCreator||Yt);var s=function(){var n=e.apply(void 0,arguments);if("string"==typeof n||"number"==typeof n){var r=i.get(n);return void 0===r&&(r=a.apply(void 0,t),i.set(n,r)),r.apply(void 0,arguments)}};return s.getMatchingSelector=function(){var t=e.apply(void 0,arguments);return i.get(t)},s.removeMatchingSelector=function(){var t=e.apply(void 0,arguments);i.remove(t)},s.clearCache=function(){i.clear()},s.resultFunc=t[t.length-1],s}}const Xt=(e,t)=>t,Kt=(e,t)=>ke(t.replace(/\//gi,"."),e.views),en=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.views.current,nn=e=>e.session.connectionState,rn=e=>e.entities.chats.byIds,an=(e,t)=>rn(e)[t],sn=(e,t,n)=>an(e,t).events.byIds[n],on=(e,t,n)=>sn(e,t,an(e,t).events.serverIdsMapping[n]),ln=(e,t,n)=>!!sn(e,t,n),cn=(e,t)=>an(e,t).events.byIds,un=Jt([(e,t)=>an(e,t).events.orderedIds,cn],(e,t)=>e.map(e=>t[e]))(Xt),dn=Jt([an,un],(e,t)=>({...e,events:t}))(Xt),pn=(e,t)=>!!an(e,t),gn=e=>ge(t=>{let{id:n}=t;return dn(e,n)},rn(e)),hn=e=>e.entities.users.byIds,mn=e=>hn(e)[(e=>e.session.id)(e)],fn=(e,t)=>hn(e)[t],_n=(e,t)=>!!fn(e,t),bn=(e,t)=>{var n;return null==(n=e.views)?void 0:n.Chat[t].timeline},vn=e=>mn(e).id,yn=Jt([un,vn],(e,t)=>_e(e=>{let{delivered:n,author:r}=e;return n&&r===t},e))(Xt),wn=Jt([un,vn],(e,t)=>_e(e=>{let{seen:n,author:r}=e;return n&&r===t},e))(Xt),kn={boosters:!0,form:!0,system_message:!0},xn=Yt([un,e=>mn(e).id],(e,t)=>ve(e=>{const n=e.author===t&&"message"===e.type,r=!!e.properties&&"file"===e.properties.serverType,i=!0===e.seen&&!kn[e.type]&&Boolean(e.serverId);return n&&!r||i},e)),In=(e,t)=>e.author!==t&&!e.seen&&!kn[e.type],Sn=(e,t)=>{const n=xn(e,t),r=mn(e).id;return un(e,t).slice(n+1).filter(e=>In(e,r))},En=(e,t)=>Ie(Sn(e,t)),An=Jt([(e,t)=>an(e,t).participants,hn],(e,t)=>e.map(e=>t[e]))(Xt);function Tn(e,t){if(void 0===t)return e.application;const n=t;return e.application[n]}const Cn=Object.freeze(Object.defineProperty({__proto__:null,getApplicationState:Tn,getChat:dn,getChatByServerId:(e,t)=>dn(e,e.entities.chats.serverIdsMapping[t]),getChatList:e=>{var t;return null==(t=e.views)?void 0:t.ChatList},getChats:gn,getConnectionState:nn,getCurrentView:tn,getDefaultView:en,getEvent:sn,getEventByServerId:on,getEvents:un,getIndexedEvents:cn,getLastDeliveredEvent:yn,getLastEvent:(e,t)=>Ie(un(e,t)),getLastSeenAgentEvent:(e,t)=>{const n=xn(e,t);if(-1===n)return null;const r=mn(e).id,i=un(e,t).slice(n+1);return u(e=>In(e,r),i)},getLastSeenEvent:wn,getLastUnseenEvent:En,getParticipants:An,getSessionUser:mn,getSessionUserId:vn,getTimeline:bn,getUnseenCount:(e,t)=>Sn(e,t).length,getUser:fn,getUserByServerId:(e,t)=>fn(e,e.entities.users.serverIdsMapping[t]),getUsers:hn,getView:Kt,hasChat:pn,hasEvent:ln,hasEventByServerId:(e,t,n)=>!!on(e,t,n),hasUser:_n,localize:(e,t,n,r)=>{let i=e.localization[t];const a=e.application.language;if(void 0===i)return"";if("object"==typeof i&&a){const e=new Intl.PluralRules(a);if(void 0===r)return i[e.select(1)];const t=e.select(r);if(!(t in i))return"";i=i[t]}return n?Object.keys(n).reduce((e,t)=>e.replace(new RegExp(`%${t}%`,"g"),n[t]),i):i}},Symbol.toStringTag,{value:"Module"})),zn="not_initialized";var Dn;Dn="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")();var $n,Mn,Fn=("function"==typeof(Mn=Dn.Symbol)?Mn.observable?$n=Mn.observable:($n=Mn("observable"),Mn.observable=$n):$n="@@observable",$n);const Pn=Object.freeze(Object.defineProperty({__proto__:null,default:Fn},Symbol.toStringTag,{value:"Module"})),Rn=(e,t)=>{const n=function(n){const r=Object.create(n);r.action=(t,r)=>{const i={type:e,payload:t};r&&(i.meta=r),n.dispatch(i)};for(var i=arguments.length,a=new Array(i>1?i-1:0),s=1;se,n},On=(e,t)=>{const n=`REQUEST_${e}`,r=Rn(e,t),i=function(e){for(var i=arguments.length,a=new Array(i>1?i-1:0),s=1;s{const{promise:s,resolve:o,reject:c}=Ve();e.dispatch({type:n,payload:{...t,meta:i,resolve:o,reject:c}}),l=s,l.then(()=>{r(e,...a)},O)},t(o,...a),void 0===l)throw new Error(`You forgot to call \`action\` handler in ${n} creator.`);return l};return i.toString=()=>n,{actionMethod:r,requestActionMethod:i}},Bn=(e,t)=>{if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("bindActionMethods expects a plain object with actionMethods as values.");return ge(e=>((e,t)=>function(){for(var n=arguments.length,r=new Array(n),i=0;i(t[void 0]&&console.warn(["Reducer contains an 'undefined' action type.","Have you misspelled a constant?"].join("\n")),function(n,r){return void 0===n&&(n=e),F(r.type,t)?t[r.type](n,r.payload):n}),jn=(e,t)=>{if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("bindSelectors expects a plain object with selectors as values.");return ge(e=>((e,t)=>function(){for(var n=arguments.length,r=new Array(n),i=0;it.reduce((e,t)=>t(e,n),e)},Nn=e=>{let{id:t,serverId:n=null,active:r=!0,participants:i=[],properties:a}=e;if("string"!=typeof t)throw new Error("Chat ID has to be a string.");if(null!==n&&t!==n)throw new Error(`If serverId is given ("${n}") it should match id ("${t}").`);return{id:t,serverId:n,active:r,participants:i,properties:a}},Ln=e=>{let{id:t,type:n,author:r,content:i,timestamp:a,own:s,serverId:o=null,thread:l=null,serverTimestamp:c=null,delivered:u=!0,seen:d=!1,failed:p=!1,properties:g={}}=e;if("string"!=typeof t)throw new Error("Event ID has to be a string.");if("string"!=typeof n)throw new Error("Event has to have string `type` property.");if(null!==o&&t!==o)throw new Error(`If serverId is given ("${o}") it should match id ("${t}").`);return{id:t,serverId:o,type:n,thread:l,author:r,content:i,own:s,timestamp:a,serverTimestamp:c,delivered:u,seen:d,failed:p,properties:g}},Vn=e=>{let{id:t,serverId:n=t,type:r=null,name:i=null,email:a=null,suggestedEmail:s=null,phoneNumber:o=null,avatar:l=null,properties:c={}}=e;if("string"!=typeof t)throw new Error("User ID has to be a string.");return{id:t,serverId:n,type:r,name:i,email:a,suggestedEmail:s,phoneNumber:o,avatar:l,properties:c}},Gn=["content","delivered","failed","properties","seen","serverTimestamp","thread"],Zn=(e,t)=>e.forEach(e=>{if(F(e,t))throw new Error(`Updating \`${String(e)}\` property is not possible.`)}),Hn=Rn("ADD_VIEW",function(e,t,n){let{action:r,getState:i}=e;if(void 0===n&&(n={}),Kt(i(),t))throw new Error(`There is already the "${t}" view. It has to be unique.`);return r({name:t,data:n}),Kt(i(),t)}),Wn=Rn("SET_CURRENT_VIEW",(e,t)=>{let{action:n,getState:r}=e;if(!Kt(r(),t)){const e=en(r());if(!e)throw new Error(`Given view "${t}" doesn't exist.`);return n({name:e}),tn(r())}return n({name:t}),tn(r())}),Yn=Rn("UPDATE_VIEW",(e,t,n)=>{let{action:r,getState:i}=e;if(!Kt(i(),t))throw new Error(`There is no "${t}" view. You should add it first.`);return r({name:t,data:n}),Kt(i(),t)}),Qn=Rn("SET_DEFAULT_VIEW",(e,t,n)=>{let{action:r,getState:i}=e;return r({name:n,path:t}),Kt(i(),`${t}/${n}`)}),Jn=Rn("ADD_CHAT",(e,t)=>{let{action:n,getState:r}=e;const{events:i=[],...a}=t;if(a.id&&pn(r(),a.id))throw new Error(`There is already a chat with "${a.id}" ID. It has to be unique.`);const s=u(e=>!_n(r(),e),i.map(e=>e.author).concat(a.participants||[]));if(s)throw new Error(`Given user ("${s}") doesn't exist. You should add it first.`);const o=a.id||we(gn(r()));return n({id:o,chat:Nn({...a,id:o}),events:i.map(Ln)}),dn(r(),o)}),Xn=Rn("ADD_EVENT",(e,t,n)=>{let{action:r,getState:i}=e;const{id:a,serverId:s}=n,o=i();if(!a||!s||a===s){if(!pn(o,t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);if(!ln(o,t,a)){if(!_n(o,n.author))throw new Error(`Specified author ("${n.author}") doesn't exist. You should add it first.`);return r({id:a,chat:t,event:Ln({...n,timestamp:n.timestamp??Date.now(),own:n.author===vn(o)})}),sn(i(),t,a)}}}),Kn=Rn("REMOVE_EVENT",(e,t,n)=>{let{action:r,getState:i}=e;const a=i();if(!pn(a,t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);if(!ln(a,t,n))throw new Error(`There is no event with "${n}" ID in this chat ("${t}").`);r({id:n,chat:t})}),er=Rn("ADD_HISTORY_EVENTS",(e,t,n)=>{let{action:r,getState:i}=e;const a=i();if(!pn(a,t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);n.forEach(e=>{if(ln(a,t,e.id))throw new Error(`There is already an event with "${e.id}" ID in this chat ("${t}"). It has to be unique.`);if(!_n(a,e.author))throw new Error(`Specified author ("${e.author}") doesn't exist. You should add it first.`)});const s=vn(a);r({chat:t,events:n.map(e=>Ln({...e,serverId:e.id,own:e.author===s}))})}),tr=Rn("ADD_PARTICIPANT",(e,t,n)=>{let{action:r,getState:i}=e;if(!pn(i(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);if(!_n(i(),n))throw new Error(`Given user ("${n}") doesn't exist. You should add it first.`);return r({chat:t,user:n}),An(i(),t)}),nr=Rn("ADD_USER",(e,t)=>{let{action:n,getState:r}=e;const{id:i}=t;if(_n(r(),i))throw new Error(`There is already a user with "${i}" ID. It has to be unique.`);return n({id:i,user:Vn(t)}),fn(r(),i)}),rr=Rn("FLUSH_CHAT",(e,t)=>{let{action:n,getState:r}=e;if(!pn(r(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);return n({id:t}),dn(r(),t)}),ir=Rn("RECALCULATE_TIMELINE",(e,t)=>{let{action:n,getState:r}=e;if(!pn(r(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);return n({id:t}),bn(r(),t)}),ar=Rn("REMOVE_PARTICIPANT",(e,t,n)=>{let{action:r,getState:i}=e;if(!pn(i(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);if(!_n(i(),n))throw new Error(`Given user ("${n}") doesn't exist. You should add it first.`);return r({chat:t,user:n}),An(i(),t)}),sr=Rn("SEND_EVENT",(e,t,n,r)=>{let{action:i,getState:a}=e;if(!pn(a(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);if(ln(a(),t,n.id))throw new Error(`There is already an event with "${n.id}" ID in this chat ("${t}"). It has to be unique.`);const s=n.id||we(cn(a(),t));return i({id:s,chat:t,event:Ln({...n,author:mn(a()).id,own:!0,id:s,timestamp:Date.now(),delivered:!1})},r),sn(a(),t,s)}),or=Rn("SET_APPLICATION_STATE",(e,t)=>{let{action:n,getApplicationState:r}=e;if(!t||a(t))throw new Error("Given data object is empty.");return n(t),r()}),lr=Rn("UPDATE_FEATURE",(e,t,n)=>{let{action:r,getApplicationState:i}=e;if(!n||!t||a(n))throw new Error("Given data object is empty.");return r({feature:t,data:n}),i()}),cr=Rn("SET_CONNECTION_STATE",(e,t)=>{let{action:n,getState:r}=e;return n({connectionState:t}),nn(r())}),ur=Rn("SET_CHAT_SERVER_ID",(e,t,n)=>{let{action:r,getState:i}=e;if(!pn(i(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);if(null!==dn(i(),t).serverId)throw new Error(`Chat with "${t}" ID has already serverId.`);return r({id:t,serverId:n}),dn(i(),t)}),dr=Rn("CLEAR_CHAT_SERVER_ID",(e,t)=>{let{action:n,getState:r}=e;if(!pn(r(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);return n({id:t}),dn(r(),t)}),pr=Rn("SET_EVENT_DATA",(e,t,n,r)=>{let{action:i,getState:a}=e;if(!pn(a(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);if(!ln(a(),t,n))throw new Error(`There is no "${n}" event in "${t}" chat. You should add it first.`);return Zn(["id","type","own"],r),i({chat:t,id:n,data:{...ze(Gn.concat("author","serverId","timestamp"),r),own:r.author===vn(a())}}),sn(a(),t,n)}),gr=Rn("SET_EVENT_SERVER_ID",(e,t,n,r)=>{let{action:i,getState:a}=e;if(!pn(a(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);if(!ln(a(),t,n))throw new Error(`There is no "${n}" event in "${t}" chat. You should add it first.`);if(null!==sn(a(),t,n).serverId)throw new Error(`Event with "${n}" ID has already serverId.`);return i({chat:t,id:n,serverId:r}),sn(a(),t,n)}),hr=Rn("SET_LOCALIZATION",(e,t)=>{let{action:n}=e;n(t)}),mr=Rn("SET_USER_SERVER_ID",(e,t,n)=>{let{action:r,getState:i}=e;if(!_n(i(),t))throw new Error(`There is no "${t}" user. You should add it first.`);if(null!==fn(i(),t).serverId)throw new Error(`User with "${t}" ID has already serverId.`);return r({id:t,serverId:n}),fn(i(),t)}),fr=Rn("CLEAR_USER_SERVER_ID",(e,t)=>{let{action:n,getState:r}=e;if(!_n(r(),t))throw new Error(`There is no "${t}" user. You should add it first.`);return n({id:t}),fn(r(),t)}),{actionMethod:_r,requestActionMethod:br}=On("SET_USER_PROPERTIES",(e,t,n)=>{let{action:r,getState:i}=e;if(!_n(i(),t))throw new Error(`There is no user with "${t}" ID. You should add it first.`);return r({id:t,properties:n}),fn(i(),t)}),{actionMethod:vr,requestActionMethod:yr}=On("UPDATE_CHAT",(e,t,n,r)=>{let{action:i,getState:a}=e;if(!pn(a(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);return Zn(["id","participants","events"],n),i({id:t,data:ze(["active","properties"],n)},r),dn(a(),t)}),{actionMethod:wr,requestActionMethod:kr}=On("UPDATE_EVENT",(e,t,n,r)=>{let{action:i,getState:a}=e;if(!pn(a(),t))throw new Error(`There is no chat with "${t}" ID. You should add it first.`);if(!ln(a(),t,n))throw new Error(`There is no "${n}" event in "${t}" chat. You should add it first.`);return Zn(["id","type","author","own","timestamp"],r),i({chat:t,id:n,data:ze(Gn,r)}),sn(a(),t,n)}),{actionMethod:xr,requestActionMethod:Ir}=On("UPDATE_USER",(e,t,n)=>{let{action:r,getState:i}=e;if(!_n(i(),t))throw new Error(`There is no user with "${t}" ID. You should add it first.`);return Zn(["id","type"],n),r({id:t,data:ze(["name","email","suggestedEmail","phoneNumber","avatar","properties"],n)}),fn(i(),t)}),Sr=Object.freeze(Object.defineProperty({__proto__:null,addChat:Jn,addEvent:Xn,addHistoryEvents:er,addParticipant:tr,addUser:nr,addView:Hn,clearChatServerId:dr,clearUserServerId:fr,flushChat:rr,recalculateTimeline:ir,removeEvent:Kn,removeParticipant:ar,requestSetUserProperties:br,requestUpdateChat:yr,requestUpdateEvent:kr,requestUpdateUser:Ir,sendEvent:sr,setApplicationState:or,setChatServerId:ur,setConnectionState:cr,setCurrentView:Wn,setDefaultView:Qn,setEventData:pr,setEventServerId:gr,setLocalization:hr,setUserProperties:_r,setUserServerId:mr,updateChat:vr,updateEvent:wr,updateFeature:lr,updateUser:xr,updateView:Yn},Symbol.toStringTag,{value:"Module"})),Er="connected",Ar="disconnected",Tr="fakely_connected",Cr="reconnecting",zr="scheduled_reconnecting",Dr="4c8c0751-837f-4a11-928e-047b2d095307",$r="01a3bafb-f822-4a6e-b2ff-f235d7c7bb63",Mr=e=>1===e||5===e,Fr=(e,t)=>Tn(e,"visibility").state===t,Pr=e=>Tn(e,"mobile")&&Tn(e,"config").hasCustomMobileSettings,Rr=e=>{var t;const n=Tn(e,"config"),r=!!(null==(t=n.features.textApp)?void 0:t.enabled),i=!!Tn(e,"enableMinimizedMessageInputLayout");return(r||i||(e=>{const{organizationId:t,group:n}=Tn(e);return t===Dr&&void 0!==n&&Mr(n)})(e))&&"circle"===(e=>{const t=Tn(e,"config");return!0===Tn(e,"mobile")?t.mobileMinimizedType:t.minimizedType})(e)&&"smooth"===n.theme.name},Or=d?1:3,Br="not_ready",qr="ready",jr="bootstrapped",Ur="chatbotChatId",Nr="chatbot-agent",Lr=18e5,Vr=d?100:1e3,Gr="From",Zr=(e,t)=>{if(isNaN(e))return null;try{return e.toLocaleString(navigator.language,{currency:t,currencyDisplay:"narrowSymbol",style:"currency"})}catch{return`${e.toFixed(2)} ${t}`}},Hr="_text_cart",Wr="_text_cart_url",Yr=[Hr,Wr],Qr=e=>e.slice(e.lastIndexOf("/")+1),Jr=e=>{if("object"!=typeof e||null===e)return 0;const{qty:t,quantity:n}=e,r=Number(t??n);return!Number.isFinite(r)||r<=0?0:Math.floor(r)},Xr=e=>{if(!Array.isArray(e))return{};const t={};return e.forEach(e=>{const n=Jr(e),r=null==e?void 0:e.variantId;if(0===n||"string"!=typeof r&&"number"!=typeof r)return;const i=Qr(String(r));t[i]=(t[i]??0)+n}),t},Kr=e=>{try{return new Intl.NumberFormat(navigator.language,{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??2}catch{return 2}},ei=e=>{const t=e??{},n=(e=>{if("string"!=typeof e||0===e.length)return null;try{const t=JSON.parse(e);return"object"!=typeof t||null===t||Array.isArray(t)?null:t}catch{return null}})(t[Hr]),r="string"==typeof(i=null==n?void 0:n.version)&&Number(i)>=2?n:null;var i;const a=(s=null==r?void 0:r.items,Array.isArray(s)?s.reduce((e,t)=>e+Jr(t),0):0);var s;const o=null==r?void 0:r.currency,l="string"==typeof o&&o.length>0?o:null,c="number"==typeof(u=null==r?void 0:r.total)&&Number.isInteger(u)?u:null;var u;const d=((e,t)=>{if(null===e)return null;if(!t)return e.toString();const n=e/10**Kr(t);return Zr(n,t)})(c,l),p=(e=>{if("string"!=typeof e)return null;try{const t=new URL(e);return"https:"===t.protocol||"http:"===t.protocol?t.href:null}catch{return null}})(t[Wr]);return{count:a,quantitiesByVariantId:Xr(null==r?void 0:r.items),total:c,value:d,currency:l,url:p,isComplete:a>0&&null!==d&&null!==l&&null!==p}},ti="upsell_goal",ni=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),ri=e=>"number"==typeof e&&Number.isInteger(e)&&e>0,ii=e=>"string"==typeof e&&/^[A-Z]{3}$/.test(e),ai=e=>{if("string"!=typeof e||0===e.length)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!ni(t)||"valid"!==t.status||!ni(t.discount))return null;const n=(e=>ni(e)?"minimum_subtotal"===e.type&&ri(e.amount)&&ii(e.currency)?{type:"minimum_subtotal",amount:e.amount,currency:e.currency}:"minimum_quantity"===e.type&&ri(e.quantity)?{type:"minimum_quantity",quantity:e.quantity}:null:null)(t.discount.threshold),r=(e=>ni(e)?"percentage_discount"===e.type&&"number"==typeof e.percentage&&e.percentage>0&&e.percentage<=1?{type:"percentage_discount",percentage:e.percentage}:"fixed_amount_discount"===e.type&&ri(e.amount)&&ii(e.currency)?{type:"fixed_amount_discount",amount:e.amount,currency:e.currency}:"free_shipping"===e.type?{type:"free_shipping"}:null:null)(t.discount.reward);return n&&r?{threshold:n,reward:r}:null},si=(e,t)=>Zr(e/10**Kr(t),t)??`${e} ${t}`,oi=e=>{switch(e.type){case"percentage_discount":return`${t=e.percentage,new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:2}).format(t)} off`;case"fixed_amount_discount":return`${si(e.amount,e.currency)} off`;case"free_shipping":return"free shipping"}var t},li=(e,t)=>"free_shipping"===t.type?`Add ${e} for free shipping`:`Add ${e} to get ${oi(t)}`,ci="liveChatChatId",ui="email_prompt",di="message_draft",pi=100,gi=20,hi="Invalid `chat.id`",mi="Move chat to mobile",fi={labs:"https://mobile-chat.labs.livechat.com/chat-widget-moment/",staging:"https://mobile-chat.staging.livechat.com/chat-widget-moment/",production:"https://mobile-chat.livechat.com/chat-widget-moment/"},_i=1500,bi=100,vi="before_send_message",yi=800,wi=".+@.+\\..+",ki=e=>{const{currentChat:t}=e.getApplicationState();if(!t)throw new Error("Current chat is not set");return t},xi=(e,t)=>{const n=t.getChat(e).properties.currentAgent;return n?ss(t,n):null},Ii=(e,t)=>t.getApplicationState("config").features[e],Si=e=>Ii("continuousChat",e).enabled,Ei=e=>Ii("chatHistory",e).enabled,Ai=e=>Ki(e)&&!Si(e),Ti=(e,t,n)=>{let{authorPredicate:r,lastSeenPredicate:i}=t;const a=n.getEvents(e),s=Pe(e=>r(e)||!e.seen,ve(i,a),a);return De(r,s)},Ci=(e,t,n)=>{const r=n.getSessionUserId();return Ti(e,{authorPredicate:e=>e.author!==r,lastSeenPredicate:e=>(e.serverTimestamp||e.timestamp)<=t},n)},zi=(e,t,n)=>{const r=n.getSessionUserId();return Ti(e,{authorPredicate:e=>e.author===r,lastSeenPredicate:e=>e.timestamp<=t},n)},Di=(e,t,n)=>{const r=e.getEvent(t,n);if(r.type===di&&null===r.serverId){const n=_e(e=>e.type===di,e.getEvents(t));return r.id===(null==n?void 0:n.id)?e.localize("not_sent_yet"):null}if(!r.own)return null;if(r.failed)return"Message not sent";if(r.seen){const r=e.getLastSeenEvent(t);return r&&n===r.id?e.localize("message_read"):null}const i=e.getLastDeliveredEvent(t);return i&&n===i.id?e.localize("message_delivered"):null},$i=e=>{const t=e.getApplicationState("config");return!0===e.getApplicationState("mobile")?t.mobileMinimizedType:t.minimizedType},Mi=e=>Pr(e.getState()),Fi=e=>{const{config:t}=e.getApplicationState();return Mi(e)?t.mobileScreenPosition:t.screenPosition},Pi=e=>{const{config:t}=e.getApplicationState();return Mi(e)?t.mobileOffset:t.screenOffset},Ri=(e,t)=>Ei(e)&&e.getChat(t).properties.hasMoreHistory,Oi=(e,t)=>{const{fakeAgentMessageId:n}=e.getChat(t).properties;return n?e.getEvent(t,n):null},Bi=(e,t)=>!!Oi(e,t),qi=e=>{const{embedded:t,actingAsDirectLink:n,isInCustomContainer:r,isMinimizedForcefullyDisabled:i}=e.getApplicationState();return!(!t||n||r||i)},ji=(e,t)=>{const{active:n,properties:{queued:r}}=t.getChat(ci);if(n||r)return!1;const{availability:i,readyState:s,websiteTextSelection:o}=t.getApplicationState();return!(!Si(t)&&"online"!==i)&&((!Ds(t)||!o.text)&&(!zs(t)&&(s===Br||(!Ga(t,"maximized")||a(t.getEvents(e))))))},Ui=(e,t)=>{if(Ei(t))return!1;const{availability:n,embedded:r,actingAsDirectLink:i,isInCustomContainer:a,defaultWidget:s}=t.getApplicationState(),o=t.getChat(e);return"livechat"===s&&r&&!i&&!a&&!o.active&&!o.properties.ended&&"offline"===n&&!Ki(t)},Ni=e=>e.getConnectionState()===Er,Li=e=>e.getConnectionState()===Cr||(e=>e.getConnectionState()===Ar)(e),Vi=(e,t,n)=>{const r=e.getChat(t),i=r.properties.lastThread,a=i===n||!i&&!n;return r.active&&a&&!Li(e)},Gi=(e,t)=>{if(t<0)return null;const n=e[t];return n.own&&"message"===n.type?null:"system_message"===n.type||"rich_message_postback"===n.type?Gi(e,t-1):n.properties.quickReplies?n:null},Zi=(e,t)=>{const n=t.getEvents(e),r=Gi(n,n.length-1);if(!r)return null;const{invitation:i,welcomeMessage:a}=r.properties;return i||a||t.getChat(e).active?r:null},Hi=(e,t)=>{const{availability:n}=t.getApplicationState(),{active:r,properties:{queued:i,ended:a}}=t.getChat(e);if(i)return t.localize("embedded_waiting_for_operator");const s=xi(e,t);return r&&s?t.localize("embedded_chat_with",{operator:s.name}):a?t.localize("embedded_chat_ended"):"online"===n?t.localize("embedded_chat_now"):Ki(t)||Si(t)?t.localize("embedded_leave_message"):t.localize("agents_not_available")},Wi=(e,t)=>{var n,r;const i=e.getChat(t),a=Si(e);if(e.getApplicationState().hideTextComposer)return null;if(e.getApplicationState().limitReached)return null;if(fa(e)&&!_a(e))return null;if(t===Ur&&!i.properties.ended&&!1===(null==(n=Ii("chatbotIntegration",e))?void 0:n.properties.showTextField))return i.properties.isAnsweringQuestion?"text":null;if(i.active){const n=Sa(e),i=e.getChat(t).properties.currentAgent;return(null==(r=null==n?void 0:n.properties)?void 0:r.useFixedAnswers)&&(null==n?void 0:n.author)===i?null:"text"}if(Ba(e,t))return null;if(ta(e)){if(ds(e)){const t=_e(e=>"form"===e.type,e.getEvents(ci));if(t&&"postchat"===t.properties.formType)return Xi(e)?"startChatAgain":"text"}return null}return!i.properties.ended||a&&!Xi(e)&&t!==Ur?a||"offline"!==e.getApplicationState().availability?Bi(e,ci)||((e,t)=>{const{awaitingWelcomeMessage:n}=e.getChat(t).properties;return!!n})(e,t)?Xi(e)&&Ii("preChatAfterGreeting",e).enabled?"requestPrechat":((e,t,n)=>{const r=xi(t,e);return(null==r?void 0:r.properties.isBot)&&!n&&"ai_agent"!==(null==r?void 0:r.properties.botType)||ia(e)})(e,t,i.properties.starting)?"startChat":"text":a?Xi(e)?"offline"===e.getApplicationState().availability?null:"requestPrechat":"text":a&&i.properties.ended?"text":null:null:ds(e)&&!Xi(e)?"text":"startChatAgain"},Yi=(e,t)=>!!t.getChat(e).properties.starting,Qi=e=>e.getApplicationState("license")===g||e.getApplicationState("organizationId")===Dr,Ji=e=>e.getApplicationState("config").theme.name,Xi=e=>e.getApplicationState().config.features.preChatForm.enabled,Ki=e=>e.getApplicationState().config.features.ticketForm.enabled,ea=(e,t)=>{const n=_e(e=>"form"===e.type,e.getEvents(ci));if(!n)return null;const{properties:r}=n;return!r.answered&&"ask_for_email"!==r.formId&&("string"!=typeof t||r.formType===t)?n.id:null},ta=(e,t)=>!!ea(e,t),na=(e,t)=>{const n=e.getEvents(ci),r=n.findIndex(e=>e.id===t.id);return n.some((e,n)=>n>r&&e.properties.answered&&e.thread===t.thread&&e.properties.formId===t.properties.formId)},ra=e=>e.getEvents(ci).filter(e=>{var t;return null==(t=e.properties)?void 0:t.isPreview}),ia=e=>{const{properties:{groupHasProbableQueue:t}}=e.getChat(ci);return!!t},aa=e=>{const{active:t,properties:{queued:n,ended:r,startChatAgainPending:i,currentAgent:a}}=e.getChat(ci),{availability:s,limitReached:o}=e.getApplicationState(),l=Si(e),c=Ki(e);return!(!o||c&&!l)||"offline"===s&&(!(r&&!i)&&(l?!a&&!n:!t&&!n&&!c))},sa=e=>{const t=ki(e);return Boolean(xi(t,e))&&!("modern"===Ji(e)&&ta(e))&&!((e,t)=>!!t.getChat(e).properties.queued)(t,e)&&!aa(e)},oa=e=>{var t,n;return Boolean(null==(n=null==(t=e.getView("Homescreen"))?void 0:t.apps)?void 0:n.find(e=>xt(e.id)))},la=e=>{const t=e.getApplicationState().defaultWidget,n=ki(e);return n===Ur?!e.getChat(n).properties.agentActivity&&("Chat"===e.getCurrentView()&&Ma(e)):("openwidget"!==t||"Chat"===e.getCurrentView())&&(!(!fa(e)||e.getView("Chat/queue"))||!Ra(e)&&Ma(e))},ca=e=>{const t=e.getLastEvent(ci);return!!t&&("form"===t.type&&"ticket"===t.properties.formType&&t.properties.answered)},ua=e=>{const{nonProfitLicense:t}=e.getApplicationState("config");return t},da=e=>{const{actingAsDirectLink:t,isInCustomContainer:n,mobileWrapper:r,embedded:i,hideMinimizeButton:a}=e.getApplicationState();return!t&&!n&&(r||i)&&!a},pa=e=>{const{actingAsDirectLink:t,isInCustomContainer:n,isInShopifyCheckoutUI:r,embedded:i,mobile:a,isPreview:s,isConfigurator:o}=e.getApplicationState();return!t&&i&&!n&&!r&&bs(e)&&!a&&(!s||o)},ga=e=>{const{isLargeWidget:t,ecommerceExpansionCollapsed:n}=e.getApplicationState();return Ga(e,"maximized")&&!t&&!n},ha=e=>Boolean(e.getApplicationState("invitation").current),ma=e=>{const t=xa(e);return!!Yi(ci,e)||e.getChat(ci).active&&t.some(e=>!!e.own||e.properties.welcomeMessage)},fa=e=>e.getChat(ci).properties.queued,_a=e=>{var t;return Boolean(null==(t=Ii("queue",e))?void 0:t.writingInQueueEnabled)},ba=e=>Ii("fileSharing",e).enabled,va=e=>!e.getApplicationState("mobile")&&Ii("emojiPicker",e).enabled,ya=e=>!Li(e),wa=e=>!Li(e)&&!e.getApplicationState("disableSendingMessage"),ka=Yt([e=>un(e,ci),e=>dn(e,ci).properties.lastThread],(e,t)=>{return Pe(e=>e.thread===t,(n=e).length-1,n);var n}),xa=e=>ka(e.getState()),Ia=Yt([e=>ka(e),e=>vn(e)],(e,t)=>_e(e=>"system"!==e.author&&e.author!==t,e)),Sa=e=>Ia(e.getState()),Ea=(e,t)=>{if(e.hasEvent(ci,t)){const{properties:n}=e.getEvent(ci,t);return n.invitation}return!1},Aa=e=>!e.getApplicationState().mobile&&"bar"===$i(e),Ta=e=>{const t=Oi(e,ci);return t&&t.properties.invitation?t:null},Ca=function(e,t){void 0===t&&(t=Ta(e));const{availability:n,invitation:r}=e.getApplicationState();return!(("offline"!==n||Si(e))&&!Aa(e))||(!t||Boolean(t&&p(t.properties.uniqueId,r.hiddenIds)))},za=function(e,t){void 0===t&&(t=Ta(e));const{invitation:n}=e.getApplicationState();return Boolean(t&&p(t.properties.uniqueId,n.displayedIds))},Da=e=>{const t=Ta(e);return!t||Ca(e,t)?null:t.id},$a=e=>{const{formType:t,fields:n,answered:r}=e.properties,i=n.filter(e=>e.answer&&e.label);return"ticket"!==t&&r&&a(i)},Ma=e=>{const t=ki(e),n=e.getEvents(t);return a(n)||n.every(e=>"form"===e.type&&$a(e))},Fa=e=>{const t=ki(e),n=e.getEvents(t);return a(n)||n.every(e=>"form"===e.type&&$a(e)||e.properties.invitation||e.properties.welcomeMessage)},Pa=e=>bs(e)&&aa(e)&&(e=>{const t=ki(e);return 0===e.getEvents(t).length})(e),Ra=e=>sa(e)||aa(e)||fa(e),Oa=(e,t)=>e.getEvents(t).find(e=>e.type===di&&null===e.serverId)??null,Ba=(e,t)=>Boolean(Oa(e,t)),qa=(e,t)=>{const n=e.getChat(t).active,r=Xi(e),i=Ii("preChatAfterGreeting",e).enabled,a=Boolean(Ta(e));return!!r&&(a?i:!n)},ja=e=>{const{embedded:t,actingAsDirectLink:n}=e.getApplicationState();return!t||n?"direct_link":"code"},Ua=Yt([e=>un(e,ci)],e=>e.filter(e=>"file"===e.type&&!e.delivered&&!e.properties.canceled)),Na=e=>Ua(e.getState()),La=e=>e.getChat(ci).serverId,Va=e=>{const{mobile:t}=e.getApplicationState();return Ii(t?"mobileMinimized":"minimized",e).enabled},Ga=(e,t)=>e.getApplicationState("visibility").state===t,Za=(e,t)=>{const n=e.getApplicationState("config").properties.license;return Object.keys(n).some(e=>n[e][t])},Ha=e=>{const t=e.getApplicationState("integrationName");return Ii("hideTrademark",e).enabled||"string"==typeof t&&"shopify"===t.toLowerCase()},Wa=(e,t)=>e.getApplicationState("config").properties.license[t],Ya=e=>{const{language:t,isPreview:n}=e.getApplicationState();if("en"!==t||n)return!1;const r=Wa(e,"a9f288b2883da20306d30e179067406f");return Boolean(null==r?void 0:r.transfer_identity_enabled)},Qa=e=>{const t=Wa(e,"632cead4b282481a422dd4e1d1567449");return{url:null==t?void 0:t.widget_message_box_moment_url,height:null==t?void 0:t.widget_message_box_moment_height}},Ja=e=>{var t,n;const{url:r}=Qa(e);return{disabled:!e.getChat(ci).active||!xi(ci,e),visible:ef(r)&&(null==(n=null==(t=e.getView("Moment"))?void 0:t.data)?void 0:n.url)!==r}},Xa=e=>e.getChat(ci).active?e.getChat(ci).properties.lastThread:null,Ka=e=>e.getView("minimized"),es=e=>{var t;return Boolean(null==(t=e.getApplicationState("recommendations"))?void 0:t.isVisible)},ts=e=>e.localize(e.getApplicationState("limitReached")||!Si(e)?"agents_not_available":"agents_not_available_continuous"),ns=e=>{const t=e.getView("Chat/queue"),n=t&&t.numberInQueue,r=(e=>{const t=e.localize("user_in_queue"),{fields:n}=e.getView("Chat/prechat");if(!n||a(n))return t;const r=n.find(e=>{let{meta:t}=e;return t&&"groupSelect"===t});if(!r||!r.options||a(r.options))return t;const i=r.options.find(t=>{let{groupNumber:n}=t;return n===e.getApplicationState("group")});return i&&i.queueTemplate?i.queueTemplate:t})(e),i=r.includes("%minutes%");let s=r.replace(/%number%/g,`**${n}**`),o=null;return i&&(o=Math.floor(t.waitingTime/60),s=s.replace(/%minutes%/g,`**${o}**`)),{message:s,waitingTime:o}},rs=e=>{if(e.getApplicationState("isPreview"))return!1;if(!Ii("rating",e).enabled)return!1;if(Li(e))return!1;const{active:t,properties:{rate:n}}=e.getChat(ci);if(!t||n)return!1;const r=(e=>{const{properties:{timestamp:t}}=e.getChat(ci);if(!t)return 0;const n=xa(e);if(!n||0===(null==n?void 0:n.length))return 0;const r=_e(e=>"system_message"!==e.type,n);return r?r.timestamp-t:0})(e)/1e3/60;return r>2&&(e=>xa(e).some(e=>{let{author:t,own:n,properties:r}=e;return!n&&"system"!==t&&!r.invitation&&!r.welcomeMessage}))(e)},is=e=>"offline"===e.getApplicationState("availability"),as=e=>{if(ds(e))return!1;if(!Ii("homeScreen",e).enabled)return!1;return!("modern"===Ji(e))},ss=(e,t)=>e.getUser(t),os=(e,t)=>{if(!t)return"_blank";if(ki(e)!==Ur)return"_blank";const{page:n}=e.getApplicationState();return tt(t)===tt(n.url)?"_parent":"_blank"},ls=e=>{const t=Ta(e);return t&&t.properties.quickReplies?t:null},cs=e=>Ee(Tt()).some(t=>Boolean(((e,t)=>e.getApplicationState("config").properties.group[t])(e,t))),us=e=>{const{page:t}=e.getApplicationState(),n=tt(t.url);return!!n&&("text.com"===n||n.endsWith(".text.com"))},ds=e=>Ii("textApp",e).enabled,ps=e=>"smooth"===Ji(e)&&ds(e)&&!e.getApplicationState("pipMode")&&!e.getApplicationState("mobile")&&e.getApplicationState("actingAsDirectLink"),gs=e=>"modern"===Ji(e)?"modern":ps(e)?"full-viewport":bs(e)?e.getApplicationState("isLargeWidget")?"ta-large":"ta-default":"default",hs=e=>{const{organizationId:t,group:n}=e.getApplicationState();return t===Dr&&void 0!==n&&Mr(n)},ms=e=>{const{aiAgentActive:t}=e.getApplicationState();return!0===t},fs=e=>Ga(e,"minimized")&&Ts(e)&&ms(e)&&!e.getApplicationState("limitReached")&&!e.getChat(ci).active&&!Da(e),_s=e=>{if(!ms(e))return[];const t=Oi(e,ci);if(!(null==t?void 0:t.properties.welcomeMessage))return[];const n=t.properties.quickReplies;return(null==n?void 0:n.length)?n.map(e=>e.text):[]},bs=e=>ds(e)||(e=>{const{organizationId:t,group:n}=e.getApplicationState();return t===Dr&&void 0!==n&&(e=>2===e||27===e)(n)})(e)||hs(e),vs=(e,t)=>{const n=Wi(e,t),r=e.getApplicationState("privacyPolicyBannerState");return(Ii("privacyPolicy",e).enabled||hs(e))&&("visible"===r||"closing"===r)&&!!n&&"requestPrechat"!==n},ys=Wt((e,t)=>ei({[Hr]:e,[Wr]:t})),ws=e=>{const t=(e=>{var t;const n=(null==(t=e.getSessionUser())?void 0:t.properties)??{};return Ce(Yr,n)})(e);return ys(t[Hr],t[Wr])},ks=(e,t)=>void 0===t?0:ws(e).quantitiesByVariantId[Qr(t)]??0,xs=Wt((e,t)=>((e,t)=>{if(!e||0===t.count)return null;const{threshold:n,reward:r}=e;if("fixed_amount_discount"===r.type&&r.currency!==t.currency)return null;let i,a=null;if("minimum_subtotal"===n.type){if(n.currency!==t.currency||null===t.total)return null;i=t.total/n.amount,i<1&&(a=si(n.amount-t.total,n.currency))}else if(i=t.count/n.quantity,i<1){const e=n.quantity-t.count;a=`${e} more ${1===e?"item":"items"}`}return null===a?{isReached:!0,progress:1,label:`You've unlocked ${oi(r)}!`}:{isReached:!1,progress:Math.max(0,i),label:li(a,r)}})(ai(e),t)),Is=e=>xs(e.getChat(ci).properties.upsellGoal??null,ws(e)),Ss=e=>(e=>!xa(e).some(e=>{let{author:t,own:n}=e;return!n&&"system"!==t}))(e),Es=e=>Rr(e.getState()),As=e=>{const{availability:t}=e.getApplicationState();return Es(e)&&(e=>{const t=Tn(e,"config");return Pr(e)?t.mobileMinimizedInputEnabled:t.minimizedInputEnabled})(e.getState())&&"offline"!==t&&!fa(e)&&!aa(e)&&!Li(e)},Ts=e=>As(e)&&!e.getApplicationState("minimizedMessageInput").closed,Cs=e=>"livechat"===e.getApplicationState("defaultWidget")?e.localize("back"):e.localize("go_back_to_homescreen"),zs=e=>{var t,n;const{isFocused:r}=e.getApplicationState("minimizedMessageInput");return r||!!(null==(n=null==(t=Ka(e))?void 0:t.messageInput)?void 0:n.trim())},Ds=e=>{const{minimizedMessageInput:t}=e.getApplicationState();return"hidden"!==t.state},$s=e=>{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)},Ms=e=>{navigator.clipboard?navigator.clipboard.writeText(e).catch($s):$s(e)},Fs=e=>{var t,n;if(e.__unsafeProperties.enableTextApp)return e.__unsafeProperties.group.offlineMessagesEnabled?"offline_message":"helpdesk";const r="feade1d6c3f17748ae4c8d917a1e1068",i=Boolean(null==(t=e.properties.group[r])?void 0:t.forwardTicketFormToHelpdesk),a=!!e.__unsafeProperties.license&&e.__unsafeProperties.license.licenseinboundForwardingToHelpdeskEnabled,s=null==(n=e.properties.license[r])?void 0:n.hdLicenseID;return"number"==typeof s&&s>-1&&(i||a)?"helpdesk":e.__unsafeProperties.group.offlineMessagesEnabled?"offline_message":"livechat"},Ps=(e,t)=>e().then(e=>fetch("https://api.helpdesk.com/v1/externalTickets",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.accessToken}`},body:JSON.stringify(t)}).then(e=>e.ok?e.json():Promise.reject(new Error(`Helpdesk ticket request failed with status ${e.status}`))).then(e=>{let{ID:t}=e;return{id:t}}));var Rs,Os;const Bs=B(function(){if(Os)return Rs;Os=1;const e={};return Rs=(...t)=>(n,r)=>{if(0!==n)return;const i=t.length;if(0===i)return r(0,()=>{}),r(1,[]),void r(2);let a=i,s=i,o=i;const l=new Array(i),c=new Array(i),u=(e,t)=>{if(0!==e)for(let n=0;n{l[n]=e,t(0,(t,d)=>{if(0===t)c[n]=d,0===--a&&r(0,u);else if(1===t){const t=s?l[n]===e?--s:s:0;if(l[n]=d,0===t){const e=new Array(i);for(let t=0;t(n,r)=>{if(0!==n)return;let i;r(0,e=>{2===e&&i&&(i.unsubscribe?i.unsubscribe():i())}),t=t[e]?t[e]():t,i=t.subscribe({next:e=>r(1,e),error:e=>r(2,e),complete:()=>r(2)})}}()),Zs=e=>(t,n)=>{if(0!==t)return;let r=!1;e.then(e=>{r||(n(1,e),r||n(2))},e=>{r||n(2,e)}),n(0,e=>{2===e&&(r=!0)})};var Hs,Ws;const Ys=B(Ws?Hs:(Ws=1,Hs=function(...e){let t=e[0];for(let n=1,r=e.length;nt=>(n,r)=>{if(0!==n)return;let i;t(0,(t,n)=>{0===t?(i=n,r(0,(e,t)=>{0!==e&&i(e,t)}),r(1,e)):r(t,n)})}));var Ks,eo;const to=B(eo?Ks:(eo=1,Ks=e=>t=>(n,r)=>{0===n&&t(0,(t,n)=>{r(t,1===t?e(n):n)})}));function no(e){return t=>U(to(e)(t))}var ro,io,ao=function(){},so={};function oo(e){var t,n,r=[],i=!1,a=so;return function(s,o){if(0===s){if(a!==so)return o(0,ao),i&&o(1,n),void o(2,a);r.push(o);var l=function(e,n){if(2!==e)a===so&&t(e,n);else{var i=r.indexOf(o);-1!==i&&r.splice(i,1)}};1!==r.length?(o(0,l),i&&a===so&&o(1,n)):e(0,function(e,s){if(0===e)return t=s,void o(0,l);1===e&&(i=!0,n=s);var c=r.slice(0);2===e&&(a=s,r=null),c.forEach(function(t){t(e,s)})})}}}const lo=B(io?ro:(io=1,ro=e=>t=>(n,r)=>{if(0!==n)return;let i,a=0;t(0,(t,n)=>{0===t?(i=n,r(t,n)):1===t&&at=>(n,r)=>{0===n&&t(0,(t,n)=>{1===t&&void 0!==n&&e&&e(n),r(t,n)})},uo=d?100:600,po=300,go=d?300:5e3,ho=304,mo=d?500:15e3,fo=d?100:1e3,_o=d?100:600,bo=mo,vo=200,yo=60,wo=360,ko=130,xo=h,Io=(d?300:5e3)-fo,So=_o+mo,Eo=d?500:15e3,Ao=d?100:1e3,To=d?100:600,Co=Eo,zo=200,Do=60,$o=360,Mo=95,Fo=h,Po=(d?300:5e3)-Ao,Ro=To+Eo,Oo=2;function Bo(e,t){return Ys(Gs(e),Xs(e.getState()),to(t),js(Me))}const qo=(e,t)=>Ys(Bo(e,e=>e.application.readyState),H(e=>e===t),J(1),oo);let jo=0;const Uo=(e,t,n,r)=>{const i=++jo,a=`${t}-done`,s=t=>{(null==t?void 0:t.correlationId)===i&&(e.off(a,s),n())};return e.on(a,s),e.emit(t,{...r,correlationId:i}),()=>{e.off(a,s)}},No=()=>{if((e=window.matchMedia)&&/native code/.test(String(e))){return!window.matchMedia("(hover: none)").matches}var e;return!0},Lo=()=>"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1||p("iPad",navigator.userAgent),Vo=()=>p(navigator.platform,["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"]),Go=()=>Vo()&&/CriOS/.test(navigator.userAgent),Zo=()=>/mobile/gi.test(navigator.userAgent)&&!Lo(),Ho=()=>Zo()||Lo(),Wo=()=>p("Chrome",navigator.userAgent),Yo=()=>{const e=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);return e?parseInt(e[2],10):0},Qo=()=>/Firefox/.test(navigator.userAgent),Jo=()=>!Wo()&&/Safari/.test(navigator.userAgent),Xo=24,Ko=6,el=8,tl=60,nl=40,rl=296,il=228,al=21,sl=260,ol=d?100:400,ll=d?500:1e4,cl=300,ul=d?0:400,dl=ul+300-ol,pl={width:"320px",height:"116px"},gl=100,hl={width:"320px",height:"186px"},ml={width:"320px",height:"354px"},fl=26,_l=22,bl=360,vl=296,yl=150,wl=240,kl=7,xl=24,Il=2,Sl=200,El=8,Al=8,Tl=8,Cl=360,zl=8,Dl=20,$l={recommendations:{width:"392px",height:"286px"},mobileRecommendations:{width:"100%",height:"286px"}},Ml=(e,t)=>{e.getApplicationState("recommendations").products.length>0||Ys(Bo(e,e=>e.application.page),co(t=>ym(e,t.url)),to(()=>(e=>{const{history:t,updatedAt:n}=e.getApplicationState("locationHistory");return n-(new Date).getTime()>18e5?[]:t})(e)),H(e=>e.length>=Or),Us(e=>{return Zs(Promise.all([Promise.resolve(e),(n=t.call,r=e,n("/v1.0/recommendations/match","POST",{pages:r}))]));var n,r}),J(1),no(t=>{let[n,r]=t;return Ys(qo(e,qr),to(()=>[n,r]))}),re(t=>{let[n,r]=t;return function(e,t,n){let{products:r,id:i}=t;void 0===n&&(n=!0);const{recommendations:a}=e.getApplicationState(),s=null==a?void 0:a.hiddenIds.includes(i),o={...a,id:i,products:r};if(e.setApplicationState({recommendations:o}),!s){const t=!n;e.setApplicationState({recommendations:{...o,hasSeen:t,isVisible:t}}),mm(e,{},{scheduleRerender:t}),Pl(e,"recommendations")}}(e,{products:r,id:`h=${n.join(",")}&t=${(new Date).getTime()}`})}))},Fl={visitorCounter:-1,recommendations:-1,googleReviews:-1,contactInvitation:-1,chatBotGreeting:-1},Pl=(e,t)=>{if("recommendations"===t)return mm(e,{eventsQueue:[t]},{scheduleRerender:!1}),_m(e,{transitionState:"hidden",hidden:!0}),fm(e,{transitionState:"hidden",hidden:!0}),bm(e,{transitionState:"hidden",hidden:!0}),void vm(e,{transitionState:"hidden",hidden:!0});const n=e.getView("minimized").eventsQueue??[];mm(e,{eventsQueue:[].concat(n,[t])},{scheduleRerender:!1})},Rl=(e,t)=>{const n=e.getView("minimized").eventsQueue??[];mm(e,{eventsQueue:n.filter(e=>e!==t)},{scheduleRerender:!1})},Ol=()=>{Object.values(Fl).forEach(e=>window.clearTimeout(e))},Bl=(e,t)=>{function n(t){return()=>{Uo(e,"resize-to-theme-size",t)}}Ol();const r="visitorCounter"===t&&Boolean(e.getApplicationState("googleReviews")),i=e.getApplicationState("contactInvitation").hasSeen;switch(t){case"visitorCounter":Fl.visitorCounter=window.setTimeout(n(()=>{fm(e,{transitionState:"shown"}),Fl.visitorCounter=window.setTimeout(()=>{fm(e,{transitionState:"hidden"})},Ro)}),r?0:Po);break;case"recommendations":(e=>{const t=Zo(),n=t?$l.mobileRecommendations:$l.recommendations,r=e.getApplicationState("recommendations");if(r.hidden)return;mm(e,{resizeBubbleAnimation:"shrink"}),e.emit("resize-request",{...n,maximized:!1,ignoreHorizontalOffset:t}),e.once("resize-request-done",()=>e.setApplicationState({recommendations:{...r,isVisible:!0,hasSeen:!0,animation:"show"}}))})(e);break;case"googleReviews":Fl.googleReviews=window.setTimeout(n(()=>{_m(e,{transitionState:"shown"}),Fl.googleReviews=window.setTimeout(()=>{_m(e,{transitionState:"hidden"})},So)}),Io);break;case"contactInvitation":Fl.contactInvitation=window.setTimeout(n(()=>{bm(e,{transitionState:"shown"})}),i?0:go);break;case"chatBotGreeting":Fl.chatBotGreeting=window.setTimeout(n(()=>{vm(e,{transitionState:"shown"})}),0);break;default:return}},ql=e=>{Ys(qo(e,jr),no(()=>Bo(e,()=>(e=>{const t=e.getView("minimized").eventsQueue;return(null==t?void 0:t.length)?t[0]:null})(e))),H(t=>{if(!t||!Ga(e,"minimized"))return!1;const n=e.getApplicationState(t);return!!n&&!n.isVisible}),re(t=>{Bl(e,t)})),Ys(Bo(e,e=>e.application.visibility.state),H(e=>"maximized"===e),re(Ol)),Ys(Bo(e,()=>{var t;return null==(t=e.getApplicationState("visitorCounter"))?void 0:t.transitionState}),H(e=>"hidden"===e),re(()=>{Rl(e,"visitorCounter")})),Ys(Bo(e,()=>{var t;return null==(t=e.getApplicationState("googleReviews"))?void 0:t.transitionState}),H(e=>"hidden"===e),re(()=>{Rl(e,"googleReviews")})),Ys(Bo(e,e=>{var t;return(null==(t=e.application.recommendations)?void 0:t.hiddenIds)??[]}),H(t=>{const n=e.getApplicationState("recommendations");return n&&t.includes(n.id)}),re(()=>{Rl(e,"recommendations")})),Ys(Bo(e,()=>{var t;return null==(t=e.getApplicationState("contactInvitation"))?void 0:t.transitionState}),H(e=>"hidden"===e),re(()=>{Rl(e,"contactInvitation")})),Ys(Bo(e,()=>{var t;return null==(t=e.getApplicationState("chatBotGreeting"))?void 0:t.transitionState}),H(e=>"hidden"===e),re(()=>{Rl(e,"chatBotGreeting")}))};function jl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let Ul={async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};const Nl=/[&<>"']/,Ll=new RegExp(Nl.source,"g"),Vl=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Gl=new RegExp(Vl.source,"g"),Zl={"&":"&","<":"<",">":">",'"':""","'":"'"},Hl=e=>Zl[e];function Wl(e,t){if(t){if(Nl.test(e))return e.replace(Ll,Hl)}else if(Vl.test(e))return e.replace(Gl,Hl);return e}const Yl=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Ql(e){return e.replace(Yl,(e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")}const Jl=/(^|[^\[])\^/g;function Xl(e,t){e="string"==typeof e?e:e.source,t=t||"";const n={replace:(t,r)=>(r=(r=r.source||r).replace(Jl,"$1"),e=e.replace(t,r),n),getRegex:()=>new RegExp(e,t)};return n}const Kl=/[^\w:]/g,ec=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function tc(e,t,n){if(e){let e;try{e=decodeURIComponent(Ql(n)).replace(Kl,"").toLowerCase()}catch(r){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!ec.test(n)&&(n=function(e,t){nc[" "+e]||(rc.test(e)?nc[" "+e]=e+"/":nc[" "+e]=cc(e,"/",!0));e=nc[" "+e];const n=-1===e.indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(ic,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(ac,"$1")+t:e+t}(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(r){return null}return n}const nc={},rc=/^[^:]+:\/*[^/]*$/,ic=/^([^:]+:)[\s\S]*$/,ac=/^([^:]+:\/*[^/]*)[\s\S]*$/;const sc={exec:function(){}};function oc(e){let t,n,r=1;for(;r{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(/ \|/);let r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>t)n.splice(t);else for(;n.length1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function pc(e,t,n,r){const i=t.href,a=t.title?Wl(t.title):null,s=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){r.state.inLink=!0;const e={type:"link",raw:n,href:i,title:a,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,e}return{type:"image",raw:n,href:i,title:a,text:Wl(s)}}class gc{constructor(e){this.options=e||Ul}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:cc(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const r=n[1];return t.split("\n").map(e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=r.length?e.slice(r.length):e}).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=cc(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=t[0].replace(/^ *>[ \t]?/gm,""),n=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:r,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,r,i,a,s,o,l,c,u,d,p,g,h=t[1].trim();const m=h.length>1,f={type:"list",raw:"",ordered:m,start:m?+h.slice(0,-1):"",loose:!1,items:[]};h=m?`\\d{1,9}\\${h.slice(-1)}`:`\\${h}`,this.options.pedantic&&(h=m?h:"[*+-]");const _=new RegExp(`^( {0,3}${h})((?:[\t ][^\\n]*)?(?:\\n|$))`);for(;e&&(g=!1,t=_.exec(e))&&!this.rules.block.hr.test(e);){if(n=t[0],e=e.substring(n.length),c=t[2].split("\n",1)[0].replace(/^\t+/,e=>" ".repeat(3*e.length)),u=e.split("\n",1)[0],this.options.pedantic?(a=2,p=c.trimLeft()):(a=t[2].search(/[^ ]/),a=a>4?1:a,p=c.slice(a),a+=t[1].length),o=!1,!c&&/^ *$/.test(u)&&(n+=u+"\n",e=e.substring(u.length+1),g=!0),!g){const t=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),r=new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),i=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),s=new RegExp(`^ {0,${Math.min(3,a-1)}}#`);for(;e&&(d=e.split("\n",1)[0],u=d,this.options.pedantic&&(u=u.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!i.test(u))&&!s.test(u)&&!t.test(u)&&!r.test(e);){if(u.search(/[^ ]/)>=a||!u.trim())p+="\n"+u.slice(a);else{if(o)break;if(c.search(/[^ ]/)>=4)break;if(i.test(c))break;if(s.test(c))break;if(r.test(c))break;p+="\n"+u}o||u.trim()||(o=!0),n+=d+"\n",e=e.substring(d.length+1),c=u.slice(a)}}f.loose||(l?f.loose=!0:/\n *\n *$/.test(n)&&(l=!0)),this.options.gfm&&(r=/^\[[ xX]\] /.exec(p),r&&(i="[ ] "!==r[0],p=p.replace(/^\[[ xX]\] +/,""))),f.items.push({type:"list_item",raw:n,task:!!r,checked:i,loose:!1,text:p}),f.raw+=n}f.items[f.items.length-1].raw=n.trimRight(),f.items[f.items.length-1].text=p.trimRight(),f.raw=f.raw.trimRight();const b=f.items.length;for(s=0;s"space"===e.type),t=e.length>0&&e.some(e=>/\n.*\n/.test(e.raw));f.loose=t}if(f.loose)for(s=0;s$/,"$1").replace(this.rules.inline._escapes,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){const t=this.rules.block.table.exec(e);if(t){const e={type:"table",header:lc(t[1]).map(e=>({text:e})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];let n,r,i,a,s=e.align.length;for(n=0;n({text:e}));for(s=e.header.length,r=0;r/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):Wl(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;const t=cc(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;const n=e.length;let r=0,i=0;for(;i-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^$/.test(e)?n.slice(1):n.slice(1,-1)),pc(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:r?r.replace(this.rules.inline._escapes,"$1"):r},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return pc(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrong.lDelim.exec(e);if(!r)return;if(r[3]&&n.match(/[\p{L}\p{N}]/u))return;const i=r[1]||r[2]||"";if(!i||i&&(""===n||this.rules.inline.punctuation.exec(n))){const n=r[0].length-1;let i,a,s=n,o=0;const l="*"===r[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(r=l.exec(t));){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=i.length,r[3]||r[4]){s+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){o+=a;continue}if(s-=a,s>0)continue;a=Math.min(a,a+s+o);const t=e.slice(0,n+r.index+(r[0].length-i.length)+a);if(Math.min(n,a)%2){const e=t.slice(1,-1);return{type:"em",raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}const l=t.slice(2,-2);return{type:"strong",raw:t,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return n&&r&&(e=e.substring(1,e.length-1)),e=Wl(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e,t){const n=this.rules.inline.autolink.exec(e);if(n){let e,r;return"@"===n[2]?(e=Wl(this.options.mangle?t(n[1]):n[1]),r="mailto:"+e):(e=Wl(n[1]),r=e),{type:"link",raw:n[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let e,r;if("@"===n[2])e=Wl(this.options.mangle?t(n[0]):n[0]),r="mailto:"+e;else{let t;do{t=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(t!==n[0]);e=Wl(n[0]),r="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let e;return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):Wl(n[0]):n[0]:Wl(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:e}}}}const hc={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:sc,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};hc.def=Xl(hc.def).replace("label",hc._label).replace("title",hc._title).getRegex(),hc.bullet=/(?:[*+-]|\d{1,9}[.)])/,hc.listItemStart=Xl(/^( *)(bull) */).replace("bull",hc.bullet).getRegex(),hc.list=Xl(hc.list).replace(/bull/g,hc.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+hc.def.source+")").getRegex(),hc._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",hc._comment=/|$)/,hc.html=Xl(hc.html,"i").replace("comment",hc._comment).replace("tag",hc._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),hc.paragraph=Xl(hc._paragraph).replace("hr",hc.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",hc._tag).getRegex(),hc.blockquote=Xl(hc.blockquote).replace("paragraph",hc.paragraph).getRegex(),hc.normal=oc({},hc),hc.gfm=oc({},hc.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),hc.gfm.table=Xl(hc.gfm.table).replace("hr",hc.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",hc._tag).getRegex(),hc.gfm.paragraph=Xl(hc._paragraph).replace("hr",hc.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",hc.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",hc._tag).getRegex(),hc.pedantic=oc({},hc.normal,{html:Xl("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",hc._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:sc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Xl(hc.normal._paragraph).replace("hr",hc.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",hc.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const mc={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:sc,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:sc,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\.5&&(n="x"+n.toString(16)),r+="&#"+n+";";return r}mc._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",mc.punctuation=Xl(mc.punctuation).replace(/punctuation/g,mc._punctuation).getRegex(),mc.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,mc.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,mc._comment=Xl(hc._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),mc.emStrong.lDelim=Xl(mc.emStrong.lDelim).replace(/punct/g,mc._punctuation).getRegex(),mc.emStrong.rDelimAst=Xl(mc.emStrong.rDelimAst,"g").replace(/punct/g,mc._punctuation).getRegex(),mc.emStrong.rDelimUnd=Xl(mc.emStrong.rDelimUnd,"g").replace(/punct/g,mc._punctuation).getRegex(),mc._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,mc._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,mc._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,mc.autolink=Xl(mc.autolink).replace("scheme",mc._scheme).replace("email",mc._email).getRegex(),mc._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,mc.tag=Xl(mc.tag).replace("comment",mc._comment).replace("attribute",mc._attribute).getRegex(),mc._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,mc._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,mc._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,mc.link=Xl(mc.link).replace("label",mc._label).replace("href",mc._href).replace("title",mc._title).getRegex(),mc.reflink=Xl(mc.reflink).replace("label",mc._label).replace("ref",hc._label).getRegex(),mc.nolink=Xl(mc.nolink).replace("ref",hc._label).getRegex(),mc.reflinkSearch=Xl(mc.reflinkSearch,"g").replace("reflink",mc.reflink).replace("nolink",mc.nolink).getRegex(),mc.normal=oc({},mc),mc.pedantic=oc({},mc.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Xl(/^!?\[(label)\]\((.*?)\)/).replace("label",mc._label).getRegex(),reflink:Xl(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",mc._label).getRegex()}),mc.gfm=oc({},mc.normal,{escape:Xl(mc.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\t+" ".repeat(n.length));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),r=t[t.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?t.push(n):(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),r=t[t.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(r.raw+="\n"+n.raw,r.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(i=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startBlock.forEach(function(e){r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(i)))r=t[t.length-1],a&&"paragraph"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),a=i.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r,i,a,s,o,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(a=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,a.index)+"["+dc("a",a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(a=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,a.index)+"["+dc("a",a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(a=this.tokenizer.rules.inline.escapedEmSt.exec(l));)l=l.slice(0,a.index+a[0].length-2)+"++"+l.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(s||(o=""),s=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,l,o))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e,_c))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e,_c))){if(i=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startInline.forEach(function(e){r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(i,fc))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),s=!0,r=t[t.length-1],r&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class vc{constructor(e){this.options=e||Ul}code(e,t,n){const r=(t||"").match(/\S*/)[0];if(this.options.highlight){const t=this.options.highlight(e,r);null!=t&&t!==e&&(n=!0,e=t)}return e=e.replace(/\n$/,"")+"\n",r?'
'+(n?e:Wl(e,!0))+"
\n":"
"+(n?e:Wl(e,!0))+"
\n"}blockquote(e){return`
\n${e}
\n`}html(e){return e}heading(e,t,n,r){if(this.options.headerIds){return`${e}\n`}return`${e}\n`}hr(){return this.options.xhtml?"
\n":"
\n"}list(e,t,n){const r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"}listitem(e){return`
  • ${e}
  • \n`}checkbox(e){return" "}paragraph(e){return`

    ${e}

    \n`}table(e,t){return t&&(t=`${t}`),"\n\n"+e+"\n"+t+"
    \n"}tablerow(e){return`\n${e}\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`\n`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return this.options.xhtml?"
    ":"
    "}del(e){return`${e}`}link(e,t,n){if(null===(e=tc(this.options.sanitize,this.options.baseUrl,e)))return n;let r='",r}image(e,t,n){if(null===(e=tc(this.options.sanitize,this.options.baseUrl,e)))return n;let r=`${n}":">",r}text(e){return e}}class yc{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class wc{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,r=0;if(this.seen.hasOwnProperty(n)){r=this.seen[e];do{r++,n=e+"-"+r}while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=r,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class kc{constructor(e){this.options=e||Ul,this.options.renderer=this.options.renderer||new vc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new yc,this.slugger=new wc}static parse(e,t){return new kc(t).parse(e)}static parseInline(e,t){return new kc(t).parseInline(e)}parse(e,t=!0){let n,r,i,a,s,o,l,c,u,d,p,g,h,m,f,_,b,v,y,w="";const k=e.length;for(n=0;n0&&"paragraph"===f.tokens[0].type?(f.tokens[0].text=v+" "+f.tokens[0].text,f.tokens[0].tokens&&f.tokens[0].tokens.length>0&&"text"===f.tokens[0].tokens[0].type&&(f.tokens[0].tokens[0].text=v+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:v}):m+=v),m+=this.parse(f.tokens,h),u+=this.renderer.listitem(m,b,_);w+=this.renderer.list(u,p,g);continue;case"html":w+=this.renderer.html(d.text);continue;case"paragraph":w+=this.renderer.paragraph(this.parseInline(d.tokens));continue;case"text":for(u=d.tokens?this.parseInline(d.tokens):d.text;n+1{r(e.text,e.lang,function(t,n){if(t)return s(t);null!=n&&n!==e.text&&(e.text=n,e.escaped=!0),o--,0===o&&s()})},0))}),void(0===o&&s())}function r(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"

    An error occurred:

    "+Wl(e.message+"",!0)+"
    ";throw e}try{const n=bc.lex(e,t);if(t.walkTokens){if(t.async)return Promise.all(xc.walkTokens(n,t.walkTokens)).then(()=>kc.parse(n,t)).catch(r);xc.walkTokens(n,t.walkTokens)}return kc.parse(n,t)}catch(i){r(i)}}function Ic(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sc(e,t,n){return t&&function(e,t){for(var n=0;n{const n=oc({},e);if(n.async=xc.defaults.async||n.async,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if(e.renderer){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if(e.tokenizer){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");t[e.level]?t[e.level].unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){const t=xc.defaults.renderer||new vc;for(const n in e.renderer){const r=t[n];t[n]=(...i)=>{let a=e.renderer[n].apply(t,i);return!1===a&&(a=r.apply(t,i)),a}}n.renderer=t}if(e.tokenizer){const t=xc.defaults.tokenizer||new gc;for(const n in e.tokenizer){const r=t[n];t[n]=(...i)=>{let a=e.tokenizer[n].apply(t,i);return!1===a&&(a=r.apply(t,i)),a}}n.tokenizer=t}if(e.walkTokens){const t=xc.defaults.walkTokens;n.walkTokens=function(n){let r=[];return r.push(e.walkTokens.call(this,n)),t&&(r=r.concat(t.call(this,n))),r}}xc.setOptions(n)})},xc.walkTokens=function(e,t){let n=[];for(const r of e)switch(n=n.concat(t.call(xc,r)),r.type){case"table":for(const e of r.header)n=n.concat(xc.walkTokens(e.tokens,t));for(const e of r.rows)for(const r of e)n=n.concat(xc.walkTokens(r.tokens,t));break;case"list":n=n.concat(xc.walkTokens(r.items,t));break;default:xc.defaults.extensions&&xc.defaults.extensions.childTokens&&xc.defaults.extensions.childTokens[r.type]?xc.defaults.extensions.childTokens[r.type].forEach(function(e){n=n.concat(xc.walkTokens(r[e],t))}):r.tokens&&(n=n.concat(xc.walkTokens(r.tokens,t)))}return n},xc.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");uc(t=oc({},xc.defaults,t||{}));try{const n=bc.lexInline(e,t);return t.walkTokens&&xc.walkTokens(n,t.walkTokens),kc.parseInline(n,t)}catch(n){if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"

    An error occurred:

    "+Wl(n.message+"",!0)+"
    ";throw n}},xc.Parser=kc,xc.parser=kc.parse,xc.Renderer=vc,xc.TextRenderer=yc,xc.Lexer=bc,xc.lexer=bc.lex,xc.Tokenizer=gc,xc.Slugger=wc,xc.parse=xc,xc.options,xc.setOptions,xc.use,xc.walkTokens,xc.parseInline,kc.parse,bc.lex;const $c=new Nt,Mc=["A","UL","OL","LI","STRONG","EM","BR","DEL","CODE","PRE"];let Fc=function(){function e(){return Ic(this,e),Ac(this,e,arguments)}return zc(e,vc),Sc(e,[{key:"link",value:function(e,t,n){const r=$c.match(n);return r&&r.length>1?n:`
    ${n}`}}])}(),Pc=function(){function e(){return Ic(this,e),Ac(this,e,arguments)}return zc(e,Fc),Sc(e,[{key:"list",value:function(e,t,n){let r=n;return e.replace(Rc,()=>t?r+++". ":"- ")}},{key:"listitem",value:function(e){return`${Rc}${e}`}}])}();const Rc="%list-item%",Oc=e=>e.replace(/\n+$/,"");function Bc(e,t,n){if(function(e,t){let n=e.parentNode;for(;n;){if(n.nodeName===t)return!0;n=n.parentNode}return!1}(e,"A"))return e.textContent;if(null===e.textContent)return null;const r=$c.match(e.textContent);if(!r||0===r.length)return e.textContent;const[i]=Array.from(r).reduce((t,i,a)=>{let[s,o]=t;return s.push(e.textContent.slice(o,i.index),q.createElement(n??"a",{href:i.url,target:"_blank",rel:"nofollow noopener"},i.text)),a===r.length-1&&s.push(e.textContent.slice(i.lastIndex)),[s,i.lastIndex]},[[],0]);return q.createElement(q.Fragment,{key:t},...i)}function qc(e){xc.setOptions({renderer:new Pc});const t=xc.parse(e),n=new DOMParser,{body:r}=n.parseFromString(t,"text/html");return r?Oc(r.textContent||""):""}const jc=e=>{let{template:t,root:n,preserveLists:r,limit:i,linkComponent:a=null}=e;const s=(null==n?void 0:n.props)??{},o=(null==n?void 0:n.component)??q.Fragment,l=q.useMemo(()=>{try{const e=new DOMParser;xc.setOptions({renderer:r?new Pc:new Fc});const n=Oc(xc.parse(t)),{body:s}=e.parseFromString(n,"text/html");return s?function(e,t,n){let r=0,i=!1;const a=e=>Array.from(e).map((e,s)=>{if("#text"===e.nodeName)return n?i?null:e.textContent&&e.textContent.length+r{const t=r(e);return!!t&&/chatbot\.com$/.test(t)},Nc=e=>{const t=s(o(i(e)));if(t.p)try{return ge(decodeURIComponent,JSON.parse(atob(t.p)))}catch{return null}return null},Lc=/^\s+$/,Vc=/^(?:\s+|[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?)*/;function Gc(e){let t=null,n=0;for(;t=Vc.exec(e);){const r=t[0];if(e=e.slice(r.length),Lc.test(r)||n++,n>3)return!1}return!e}const Zc=e=>{let{id:t,authorId:n,timestamp:r,serverId:i=t,threadId:a=null,seen:s=!1}=e;return{id:t,serverId:i,thread:a,author:n,timestamp:r,seen:s}},Hc=e=>{let{id:t,customId:n,authorId:r,timestamp:i,threadId:a,properties:s,seen:o,serverId:l,type:c,text:u,urlDetails:d,...p}=e;return p},Wc=e=>F("bb9e5b2f1ab480e4a715977b7b1b4279",e.properties)?{reaction:ke("bb9e5b2f1ab480e4a715977b7b1b4279.message_reaction",e.properties)}:null,Yc=e=>{const t=F("aa8151b317737a3e79d8e3384e6082de",e.properties)?ke("aa8151b317737a3e79d8e3384e6082de.use_fixed_answers",e.properties):void 0,n=ke("chats.use_fixed_answers",e.properties);return void 0===t&&void 0===n?null:{useFixedAnswers:Boolean(t)||Boolean(n)}},Qc=e=>{if(e.urlDetails){const{urlDetails:t}=e;return{...Zc(e),type:"url_preview",properties:{serverType:e.type,title:t.title,description:t.description,image:{url:t.imageUrl,link:t.url}}}}if(Gc(e.text)){return{...Zc(e),type:"emoji",properties:{serverType:e.type,text:e.text,...Hc(e)}}}return{...Zc(e),type:"message",properties:{serverType:e.type,text:e.text,customId:e.customId,...Hc(e)}}},Jc=e=>{switch(e.type){case"url":if(m(e.value))return null;if(Uc(e.value)){const t=Nc(e.value);if(t&&t.url)return{...e,proxiedValue:t.url}}return e;case"webview":if(m(e.value))return null;if(Uc(e.value)){const t=Nc(e.value);if(t&&t.url)return{...e,proxiedValue:t.url}}return e;default:return e}},Xc=e=>{const t={};return"string"==typeof e.title&&(t.title=e.title),"string"==typeof e.subtitle&&(t.subtitle=e.subtitle),e.image&&(t.image={...e.image,link:e.image.url}),e.buttons&&(t.buttons=e.buttons.map(Jc).filter(Boolean)),t},Kc=e=>{const t={...Zc(e),type:"system_message",properties:{serverType:e.type,systemMessageType:e.systemMessageType,defaultText:e.text}};return e.textVars&&(t.properties.textVariables=e.textVars),t},eu=e=>e.replace(/index[0-9]*_/gi,""),tu=(e,t)=>{const n=u(e=>"groupSelect"===e.meta,e);return Object.keys(t).reduce((r,i)=>{const a=t[i];if("rateComment"===i)return r.rateComment=a,r;if("rating"===i)return r.rate=null===a?a:eu(a),r;const s=u(e=>e.name===i,e),{serverName:o}=s;return n&&o&&o===n.serverName&&(r.choosenGroupIndex=t[n.name].match(/index([0-9]*)_/)[1],r.choosenGroup=parseInt(eu(a),10)),s.options?r.fields[o]=M(a)?a.map(eu):eu(a):r.fields[o]=a,r},{fields:{}})};var nu="__test_storage_support__",ru="@@test",iu=function(e){void 0===e&&(e="local");try{var t="session"===e?window.sessionStorage:window.localStorage;return t.setItem(nu,ru),t.getItem(nu)!==ru?!1:(t.removeItem(nu),!0)}catch(n){return!1}},au=function(){var e=Object.create(null);return{getItem:function(t){var n=e[t];return"string"==typeof n?n:null},setItem:function(t,n){e[t]=n},removeItem:function(t){delete e[t]},clear:function(){e=Object.create(null)}}}();function su(e){const t=function(e){try{return window.localStorage}catch(t){return t instanceof Error&&"SecurityError"===t.name&&e?e:iu()?window.localStorage:au}}(e);return{setItem:(e,n)=>new Promise(r=>r(t.setItem(e,n))),getItem:e=>new Promise(n=>n(t.getItem(e))),removeItem:e=>new Promise(n=>n(t.removeItem(e)))}}su();const ou="file",lu="form",cu="filled_form",uu="message",du="rich_message",pu="system_message",gu="custom",hu="accept_greeting",mu="cancel_greeting",fu="check_goals",_u="deactivate_chat",bu="delete_chat_properties",vu="delete_event_properties",yu="delete_thread_properties",wu="get_chat",ku="get_customer",xu="get_form",Iu="get_url_info",Su="list_chats",Eu="list_group_statuses",Au="list_threads",Tu="login",Cu="mark_events_as_seen",zu="request_welcome_message",Du="resume_chat",$u="send_event",Mu="send_greeting_button_clicked",Fu="send_customer_actions",Pu="send_rich_message_postback",Ru="send_sneak_peek",Ou="set_customer_session_fields",Bu="start_chat",qu="update_chat_properties",ju="update_customer",Uu="update_customer_page",Nu="update_event_properties",Lu="update_thread_properties",Vu="upload_file",Gu="chat_deactivated",Zu="chat_properties_deleted",Hu="chat_properties_updated",Wu="chat_transferred",Yu="customer_disconnected",Qu="customer_side_storage_updated",Ju="customer_updated",Xu="event_properties_deleted",Ku="event_properties_updated",ed="event_updated",td="events_marked_as_seen",nd="greeting_accepted",rd="greeting_canceled",id="groups_status_updated",ad="incoming_chat",sd="incoming_event",od="incoming_greeting",ld="incoming_multicast",cd="incoming_rich_message_postback",ud="incoming_typing_indicator",dd="incoming_welcome_message",pd="queue_position_updated",gd="thread_properties_deleted",hd="thread_properties_updated",md="user_added_to_chat",fd="user_removed_from_chat",_d="incoming_thinking_indicator",bd="incoming_event_preview",vd=Object.freeze(Object.defineProperty({__proto__:null,CHAT_DEACTIVATED:Gu,CHAT_PROPERTIES_DELETED:Zu,CHAT_PROPERTIES_UPDATED:Hu,CHAT_TRANSFERRED:Wu,CUSTOMER_DISCONNECTED:Yu,CUSTOMER_SIDE_STORAGE_UPDATED:Qu,CUSTOMER_UPDATED:Ju,EVENTS_MARKED_AS_SEEN:td,EVENT_PROPERTIES_DELETED:Xu,EVENT_PROPERTIES_UPDATED:Ku,EVENT_UPDATED:ed,GREETING_ACCEPTED:nd,GREETING_CANCELED:rd,GROUPS_STATUS_UPDATED:id,INCOMING_CHAT:ad,INCOMING_EVENT:sd,INCOMING_EVENT_PREVIEW:bd,INCOMING_GREETING:od,INCOMING_MULTICAST:ld,INCOMING_RICH_MESSAGE_POSTBACK:cd,INCOMING_THINKING_INDICATOR:_d,INCOMING_TYPING_INDICATOR:ud,INCOMING_WELCOME_MESSAGE:dd,QUEUE_POSITION_UPDATED:pd,THREAD_PROPERTIES_DELETED:gd,THREAD_PROPERTIES_UPDATED:hd,USER_ADDED_TO_CHAT:md,USER_REMOVED_FROM_CHAT:fd},Symbol.toStringTag,{value:"Module"})),yd="customer",wd=Object.freeze({success:!0}),kd=["prechat","postchat","ticket","ask_for_email"],xd=e=>null!==e&&!kd.includes(e),Id=(e,t)=>{const n={id:t.id,authorId:t.author_id,createdAt:t.created_at,threadId:e,properties:t.properties||{}};return void 0!==t.custom_id&&(n.customId=t.custom_id),n},Sd=(e,t)=>{let n,r,i,a;t.height>t.width?(n="height",r="width",i=t.height,a=t.width):(n="width",r="height",i=t.width,a=t.height);const s=e/i;return{[n]:Math.ceil(Math.min(i,e)),[r]:Math.ceil(Math.min(s*a,a))}},Ed=(e,t)=>void 0!==t.width&&void 0!==t.height?((e,t)=>({...Id(e,t),type:ou,contentType:t.content_type,url:t.url,name:t.name,width:t.width,height:t.height,thumbnails:{default:{url:t.thumbnail_url,...Sd(300,t)},high:{url:t.thumbnail2x_url,...Sd(600,t)}},...t.alternative_text&&{alternativeText:t.alternative_text}}))(e,t):{...Id(e,t),type:ou,contentType:t.content_type,url:t.url,name:t.name},Ad=e=>{const t={};if("string"==typeof e.title&&(t.title=e.title),"string"==typeof e.subtitle&&(t.subtitle=e.subtitle),e.image){const{image:n}=e;t.image={url:n.url,name:n.name,...n.alternative_text&&{alternativeText:n.alternative_text}}}return e.ecommerce&&(t.ecommerce={productId:e.ecommerce.product_id,viewType:e.ecommerce.view_type,..."string"==typeof e.ecommerce.label&&{label:e.ecommerce.label},...Array.isArray(e.ecommerce.options)&&{options:e.ecommerce.options.map(e=>({label:e.label,optionId:e.option_id,...void 0!==e.price&&{price:e.price},...void 0!==e.regular_price&&{regularPrice:e.regular_price},...void 0!==e.max_price&&{maxPrice:e.max_price},...void 0!==e.currency&&{currency:e.currency},..."string"==typeof e.color&&{color:e.color},...e.image_url&&{imageUrl:e.image_url,..."string"==typeof e.image_thumbnail_url&&{imageThumbnailUrl:e.image_thumbnail_url}},..."boolean"==typeof e.available&&{available:e.available},..."boolean"==typeof e.selected&&{selected:e.selected}}))},...Array.isArray(e.ecommerce.addons)&&{addons:e.ecommerce.addons.map(e=>"price_range"===e.addon_type?{addonType:e.addon_type,...void 0!==e.range_from&&{rangeFrom:e.range_from},...void 0!==e.range_to&&{rangeTo:e.range_to},..."string"==typeof e.currency&&{currency:e.currency}}:{addonType:e.addon_type})}}),e.buttons&&(t.buttons=e.buttons.map(e=>{switch(e.type){case"message":case"add_to_cart":case"show_gallery":case"copy":case"phone":return{type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,value:e.value,role:e.role||"default",...e.button_id&&{buttonId:e.button_id}};case"cancel":return{type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,role:e.role||"default",...e.button_id&&{buttonId:e.button_id}};case"url":{const t={type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,value:e.value,role:e.role||"default",...e.button_id&&{buttonId:e.button_id}};return e.target&&(t.target=e.target),t}case"open_external":return{type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,value:e.value,role:e.role||"default",...e.button_id&&{buttonId:e.button_id},...e.target&&{target:e.target}};case"webview":return{type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,value:e.value,role:e.role||"default",...e.button_id&&{buttonId:e.button_id}};default:return{text:e.text,postbackId:e.postback_id,userIds:e.user_ids,role:e.role||"default",...e.button_id&&{buttonId:e.button_id}}}})),t},Td=(e,t)=>{switch(t.type){case ou:return Ed(e,t);case lu:return((e,t)=>({...Id(e,t),authorId:xd(t.form_type??null)?t.author_id:"system",type:lu,formId:t.form_id,...t.form_type&&{formType:t.form_type},fields:t.fields}))(e,t);case cu:return((e,t)=>({...Id(e,t),type:cu,formId:t.form_id,...t.form_type&&{formType:t.form_type},fields:t.fields.map(e=>{if("group_chooser"===e.type){if(!e.answer)return e;const{group_id:t,...n}=e.answer;return{...e,answer:{...n,groupId:t}}}return e})}))(e,t);case uu:return((e,t)=>({...Id(e,t),type:uu,text:t.text}))(e,t);case du:return((e,t)=>{switch(t.template_id){case"cards":case"quick_replies":case"sticker":case"ecommerce":return{...Id(e,t),type:du,template:t.template_id,..."string"==typeof t.layout&&{layout:t.layout},elements:t.elements.map(Ad)};default:return null}})(e,t);case pu:return((e,t)=>{const n={...Id(e,{...t,author_id:"system"}),type:pu,text:t.text,systemMessageType:t.system_message_type};return t.text_vars&&(n.textVars=t.text_vars),n})(e,t);case gu:return((e,t)=>({...Id(e,t),type:gu,...t.content&&{content:t.content}}))(e,t);default:return null}},Cd=e=>({id:e.id,addon:e.addon||null,uniqueId:e.unique_id,displayedFirstTime:e.displayed_first_time,isExitIntent:e.is_exit_intent,accepted:e.accepted||!1,subtype:e.subtype||"greeting",event:Td(null,e.event),agent:{id:e.agent.id,name:e.agent.name,avatar:e.agent.avatar,jobTitle:e.agent.job_title,isBot:e.agent.is_bot||!1}}),zd=function(e){return void 0===e&&(e={}),e.group_ids?{groupIds:e.group_ids}:{}},Dd=e=>ge(e=>e.events_seen_up_to?e.events_seen_up_to:null,xe("id",e)),$d=(e,t)=>{const n=t.properties||{};return{id:t.id,chatId:e,active:t.active,access:zd(t.access),createdAt:t.created_at,userIds:t.user_ids,events:t.events.map(e=>Td(t.id,e)).filter(Boolean),properties:n,previousThreadId:t.previous_thread_id||null,nextThreadId:t.next_thread_id||null,queue:t.queue?Bd(t.queue):null}},Md=e=>({id:e.id,access:zd(e.access),users:e.users.map(qd),properties:e.properties||{},eventsSeenUpToMap:Dd(e.users)}),Fd=e=>{const t=ze(["avatar","email","name"],e);return"phone_number"in e&&(t.phoneNumber=e.phone_number),e.session_fields&&(t.sessionFields=e.session_fields.reduce((e,t)=>{const[n]=Object.keys(t);return e[n]=t[n],e},{})),"suggested_email"in e&&(t.suggestedEmail=e.suggested_email),t},Pd=e=>{const t=Fd(e);return{id:e.id,type:yd,...t,sessionFields:t.sessionFields||{}}},Rd=e=>{const{statistics:t}=e;return{...Pd(e),statistics:{chatsCount:t.chats_count,threadsCount:t.threads_count,visitsCount:t.visits_count,pageViewsCount:t.page_views_count,greetingsShownCount:t.greetings_shown_count,greetingsAcceptedCount:t.greetings_accepted_count}}},Od=e=>({position:e.position,waitTime:e.wait_time}),Bd=e=>({...Od(e),queuedAt:e.queued_at}),qd=e=>{return e.type===yd?{...Pd(n=e),present:n.present}:{id:(t=e).id,type:"agent",name:t.name,avatar:t.avatar,jobTitle:t.job_title,present:t.present};var t,n},jd=e=>"offline"===e?"offline":"online",Ud=e=>({chatId:e.chat_id,properties:e.properties}),Nd=e=>{const t={chatId:e.chat_id,threadId:e.thread_id,transferredTo:{...e.transferred_to.agent_ids&&{agentIds:e.transferred_to.agent_ids},...e.transferred_to.group_ids&&{groupIds:e.transferred_to.group_ids}},queue:e.queue?Bd(e.queue):null};return"manual"===e.reason?{...t,reason:e.reason,requesterId:e.requester_id}:{...t,reason:e.reason}},Ld=e=>({id:e.id,...Fd(e)}),Vd=e=>({chatId:e.chat_id,threadId:e.thread_id,eventId:e.event_id,properties:e.properties}),Gd=e=>({chatId:e.chat_id,threadId:e.thread_id,eventId:e.event_id,properties:e.properties}),Zd=e=>{const t=e.thread_id;return{chatId:e.chat_id,threadId:t,event:Td(t,e.event)}},Hd=e=>({chatId:e.chat_id,userId:e.user_id,seenUpTo:e.seen_up_to}),Wd=e=>({uniqueId:e.unique_id}),Yd=e=>{const{chat:t}=e;return{chat:{...Md(t),thread:$d(t.id,t.thread)}}},Qd=e=>({chatId:e.chat_id,event:Td(e.thread_id,e.event)}),Jd=e=>Cd(e),Xd=e=>({userId:e.user_id,chatId:e.chat_id,threadId:e.thread_id,eventId:e.event_id,postback:e.postback}),Kd=e=>{const{chat_id:t,typing_indicator:n}=e;return{chatId:t,typingIndicator:{authorId:n.author_id,isTyping:n.is_typing}}},ep=e=>{const{chat_id:t,thread_id:n,author_id:r,sent_at:i,custom_id:a,title:s,description:o}=e;return{chatId:t,threadId:n,authorId:r,sentAt:i,...a&&{customId:a},...s&&{title:s},...o&&{description:o}}},tp=e=>({chatId:e.chat_id,threadId:e.thread_id,event:Td(e.thread_id,e.event)}),np=e=>({id:e.id,event:Td(null,e.event)}),rp=e=>({chatId:e.chat_id,threadId:e.thread_id,queue:Od(e.queue)}),ip=e=>({chatId:e.chat_id,threadId:e.thread_id,properties:e.properties}),ap=e=>({chatId:e.chat_id,threadId:e.thread_id,properties:e.properties}),sp=e=>({chatId:e.chat_id,user:qd(e.user),present:e.user.present}),op=e=>({chatId:e.chat_id,userId:e.user_id,reason:e.reason}),lp=e=>e.map(e=>{switch(e.type){case"group_chooser":return{...e,options:e.options.map(e=>{let{group_id:t,...n}=e;return{...n,groupId:t}})};case"rating":{const{comment_label:t,...n}=e;return{...n,commentLabel:t}}default:return e}}),cp=e=>{const t=e.map((e,t)=>({...e,id:String(t)}));return lp(t)},up=e=>{const t=!("id"in e.fields[0]);return{id:e.id,fields:t?cp(e.fields):lp(e.fields)}},dp=e=>e.enabled?{...e,form:up(e.form)}:e,pp=e=>{const t={url:e.url};return e.title&&(t.title=e.title),e.description&&(t.description=e.description),e.image_url&&(t.imageUrl=`https://${f(e.image_url)}`,e.image_width&&e.image_height&&(t.imageWidth=e.image_width,t.imageHeight=e.image_height)),t},gp=e=>{const{id:t,predicted_agent:n,queue:r}=e;return{id:t,predictedAgent:{id:n.id,type:n.type,name:n.name,avatar:n.avatar,jobTitle:n.job_title,isBot:n.is_bot,botType:n.bot_type},queue:r}},hp=e=>{let{online_groups_ids:t,customer_groups:n}=e;if(!t)return"offline";const r=n.monitoring.id;return p(r,t)?"online":"offline"},mp=e=>{const t=e.chats_summary.map(e=>{let{id:t,active:n,access:r,last_thread_created_at:i,last_thread_id:a,last_event_per_type:s,properties:o={},users:l}=e;const c={id:t,active:n,access:zd(r),properties:o,users:l.map(qd),lastThreadId:a||null,lastThreadCreatedAt:i||null,eventsSeenUpToMap:Dd(l)};if(!s)return c;c.lastEventsPerType=ge(e=>Td(e.thread_id,e.event),s);const u=s,d=Ie(Object.keys(u).map(e=>u[e]).sort((e,t)=>e.thread_id===t.thread_id?Oe(e.event.created_at,t.event.created_at):Oe(e.thread_created_at,t.thread_created_at)));return d&&c.lastEventsPerType&&(c.lastEvent=c.lastEventsPerType[d.event.type]),c});return{chatsSummary:Ae(e=>{let{lastEvent:t,order:n}=e;return-1*((void 0!==t?t.timestamp:n)??0)},t),totalChats:e.total_chats,users:Be(e=>e.id,pe(e=>e.users,t)),previousPageId:e.previous_page_id||null,nextPageId:e.next_page_id||null}},fp=e=>e.groups_status,_p=(e,t)=>({threads:t.threads.map(t=>$d(e.payload.chat_id,t)),previousPageId:t.previous_page_id||null,nextPageId:t.next_page_id||null}),bp=e=>{const{__priv_dynamic_config:t,chats:n,greeting:r}=e;return{dynamicConfig:t,customer:Rd(e.customer),availability:hp(t),chats:n.map(t=>({id:t.chat_id,active:"has_active_thread"in t?t.has_active_thread:e.has_active_thread,hasUnreadEvents:t.has_unread_events})),...r&&{greeting:Cd(r)}}},vp=e=>{switch(e.action){case Gu:return{action:e.action,payload:{chatId:e.payload.chat_id}};case Zu:return{action:e.action,payload:(t=e.payload,{chatId:t.chat_id,properties:t.properties})};case Hu:return{action:e.action,payload:Ud(e.payload)};case Wu:return{action:e.action,payload:Nd(e.payload)};case Qu:case Yu:return{action:e.action,payload:e.payload};case Ju:return{action:e.action,payload:Ld(e.payload)};case Xu:return{action:e.action,payload:Vd(e.payload)};case Ku:return{action:e.action,payload:Gd(e.payload)};case ed:return{action:e.action,payload:Zd(e.payload)};case td:return{action:e.action,payload:Hd(e.payload)};case nd:case rd:return{action:e.action,payload:Wd(e.payload)};case id:return{action:e.action,payload:e.payload};case ad:return{action:e.action,payload:Yd(e.payload)};case sd:return{action:e.action,payload:Qd(e.payload)};case od:return{action:e.action,payload:Jd(e.payload)};case ld:return{action:e.action,payload:e.payload};case cd:return{action:e.action,payload:Xd(e.payload)};case ud:return{action:e.action,payload:Kd(e.payload)};case _d:return{action:e.action,payload:ep(e.payload)};case bd:return{action:e.action,payload:tp(e.payload)};case dd:return{action:e.action,payload:np(e.payload)};case pd:return{action:e.action,payload:rp(e.payload)};case gd:return{action:e.action,payload:ip(e.payload)};case hd:return{action:e.action,payload:ap(e.payload)};case md:return{action:e.action,payload:sp(e.payload)};case fd:return{action:e.action,payload:op(e.payload)}}var t},yp=e=>{var t;let{request:n,response:r}=e;switch(r.action){case hu:case mu:case bu:case vu:case yu:return{action:r.action,payload:wd};case wu:return{action:r.action,payload:(i=r.payload,{...Md(i),thread:i.thread?$d(i.id,i.thread):null})};case ku:return{action:r.action,payload:Rd(r.payload)};case xu:return{action:r.action,payload:dp(r.payload)};case Iu:return{action:r.action,payload:pp(r.payload)};case Su:return{action:r.action,payload:mp(r.payload)};case Eu:return{action:r.action,payload:fp(r.payload)};case Au:return{action:r.action,payload:_p(n,r.payload)};case Tu:return{action:r.action,payload:bp(r.payload)};case Cu:return{action:r.action,payload:wd};case zu:return{action:r.action,payload:gp(r.payload)};case Ru:case Ou:case Mu:case Pu:case qu:case ju:return{action:r.action,payload:wd};case Uu:return{action:r.action,payload:{...wd,groups:null==(t=r.payload)?void 0:t.groups}};case Nu:case Lu:return{action:r.action,payload:wd}}var i},wp=e=>({code:e.type.toUpperCase(),message:e.message}),kp=["prechat","postchat","ticket"],xp=e=>null!==e&&kp.includes(e),Ip=e=>{const t=e.fields??[],n=t.filter(e=>"radio"===e.type);return 4===t.length&&2===n.length&&n.every(e=>{var t;return 2===(null==(t=e.options)?void 0:t.length)})&&t.some(e=>"rating"===e.type)&&t.some(e=>"rateComment"===e.name)},Sp={question:{type:"text"},checkbox_for_email:{type:"checkbox",meta:"confirm_subscription"},header:{type:"information"},skill:{type:"group_select"}},Ep=e=>e.map((e,t)=>{const n={};return F("label",e)&&(n.label=e.label),F("checked",e)&&(n.checked=e.checked),n.value=String(t),F("skill_id",e)&&(n.value=String(e.skill_id)),F("embedded_chat_hide_when_offline",e)&&(n.ticketFormDisabled=Boolean(e.embedded_chat_hide_when_offline)),F("queue_template",e)&&(n.queueTemplate=e.queue_template),n}),Ap=e=>{let t=!1;const n={fields:e.fields.sort((e,t)=>e.order-t.order).map((e,n)=>{const r={};if("facebookConnect"===e.type)return t=!0,!1;e.id?r.name=e.id:-1===["header","information"].indexOf(e.type)&&(r.name=String(n)),F("value",e)&&(r.value=e.value),F("label",e)&&(r.label=e.label),F("required",e)&&(r.required=e.required),"rating"===e.type&&(r.commentLabel=e.options[0]),e.skills&&e.skills.length>0?r.options=Ep(e.skills):e.options&&e.options.length>0&&(e.options_data?r.options=Ep(e.options_data):b(e.options[0])?r.options=e.options.map((e,t)=>{let{label:n}=e;return{label:n,value:String(t)}}):r.options=e.options.map((e,t)=>({label:e,value:String(t)}))),e.serverType&&(r.serverType=e.serverType);const{type:i,meta:a}=(e=>({type:Sp[e]&&Sp[e].type||e,meta:Sp[e]&&Sp[e].meta||!1}))(e.type);return r.type=i,a&&(r.meta=a),r}).filter(Boolean)};return e.id&&(n.id=e.id),t&&(n.facebookConnect=!0),n},Tp=e=>({...e,fields:e.fields.map(e=>{switch(e.type){case"name":case"subject":return{...e,maxLength:1024};case"email":case"textarea":return{...e,required:!0};default:return e}})}),Cp=e=>{let{hdLicenseID:t,organizationId:n,isTextAppEnabled:r,group:i,pageUrl:a,form:s,answers:o,additionalInfo:l}=e;const c=((e,t)=>{const n=Se(e=>"message"===e?"textarea":e,e);return t.fields.map(e=>{if("information"===e.type)return null;const t={type:e.type,text:"undefined"!=typeof document?qc(e.label):e.label,serverType:e.serverType};return(e.name in n||e.type in n)&&("options"in e?t.value=me(n[e.name]).map(t=>u(e=>e.value===t,e.options).label).join(", "):e.name in n?t.value=n[e.name]:t.value=n[e.type],t.value=_(t.value),t.text=`${t.text} ${t.value}`),t}).filter(Boolean)})(o,s),d=u(e=>"email"===e.type||"email"===e.serverType,c),p=u(e=>"name"===e.type||"name"===e.serverType,c);if(!d)throw new Error("Missing email");if(!u(e=>"textarea"===e.type,c))throw new Error("Missing message");const g=u(e=>"subject"===e.type||"subject"===e.serverType,c),h=c.filter(e=>{let{type:t,serverType:n}=e;return-1===["name","email","subject"].indexOf(n||t)}).map(e=>{let{text:t}=e;return t}).join("\n");return{...g&&g.value&&{subject:g.value},message:{text:h},requester:{email:d.value,...p&&p.value&&{name:p.value}},integration:{type:"livechat",...r?{organizationID:n}:{licenseID:t},teamID:String(i),referenceReason:l.lastDisplayedReason,referenceReasonAt:l.lastDisplayedAt,...a&&{referenceURL:a}}}},zp=(e,t)=>{const{requester:n,message:r,subject:i}=t,{text:a}=r,{name:s,email:o}=n;return{id:e,text:a,...i&&{subject:i},visitor:{name:s||null,email:o||null}}},Dp={group_chooser:"select",header:"information",name:"text",question:"text",subject:"text",checkbox_for_email:"checkbox"},$p=(e,t)=>e.getSessionUser().serverId===t.authorId,Mp=(e,t)=>$p(e,t)?e.getSessionUser().id:t.authorId,Fp=(e,t)=>{if("file"===t.type)return t.id;if($p(e,t))return"customId"in t&&e.hasEvent(ci,t.customId)?t.customId:t.id;const n=e.getEventByServerId(ci,t.id);return n?n.id:t.id},Pp=e=>(null==e?void 0:e.groupIds)?e.groupIds[0]:null,Rp=e=>"offline"===e?"offline":"online",Op=(e,t)=>{const n=e.getSessionUser().serverId,r=Ie(t.filter(e=>e.present&&e.id!==n));return r?r.id:null},Bp=function(e,t,n){void 0===n&&(n=()=>!1);const r=[],i=new Set;return t.forEach(t=>{const a=Qp(e,{...t,seen:n(t)},r,i);a&&r.push(a)}),r.filter(e=>!i.has(e.id))},qp=(e,t)=>{let{chat:n,chat:{thread:r,users:i}}=t;return{id:n.id,active:r.active,agent:Op(e,i),events:Bp(e,r.events),group:Pp(n.access),thread:r.id,previousThread:r.previousThreadId,properties:ig(r)}},jp=e=>{let{id:t,active:n,access:r,lastThreadId:i}=e;return{id:t,active:n,lastThreadId:i,group:Pp(r)}},Up=(t,n)=>({...n,type:t,fields:n.fields.reduce((t,n)=>{let{id:r,...i}=n;const a={...i,type:Dp[i.type]||i.type,serverName:r,serverType:i.type};if("information"===a.type)a.value=a.label.replace(//gi,"\n");else if("checkbox_for_email"===i.type)a.meta="confirm_subscription",a.label="",a.options=[{label:i.label,checked:i.checked,value:"index0_0",originalValue:"0"}],i.checked&&(a.defaultValue=[a.options[0].value]);else if(i.options){const e="group_chooser"===i.type;e&&(a.meta="groupSelect"),a.options=a.options.map((t,n)=>{const r=e?t.groupId:t.id;return{...Te(["id","checked"],t),value:`index${n}_${r}`,originalValue:String(r)}})}return a.name=p(i.type,["name","email","rating","phone"])?i.type:`${e()}_${r}`,"rating"===i.type?[].concat(t,[a,{name:"rateComment",type:"textarea",label:a.commentLabel,required:!1,dependOn:"rating"}]):[].concat(t,[a])},[])}),Np=e=>Tp(Up("ticket",e)),Lp=(e,t)=>{const n=e.getSessionUser().serverId,{[n]:r,...i}=t;return{sessionUserSeenUpTo:r,latestOtherUserSeenUpTo:Ie(Ee(i).filter(Boolean).sort())}},Vp=e=>{const t=ve(e=>"systemMessageType"in e&&"rating.chat_commented"===e.systemMessageType,e),n=ve(e=>"systemMessageType"in e&&"rating.chat_rated"===e.systemMessageType,e),r=ve(e=>"systemMessageType"in e&&"rating.chat_rating_canceled"===e.systemMessageType,e);return e.filter((e,i)=>{const a="systemMessageType"in e&&["rating.chat_rated","rating.chat_commented","rating.chat_rating_canceled"].includes(e.systemMessageType),s="filled_form"===e.type&&!e.fields.some(e=>"answer"in e&&Boolean(e.answer));return!a&&!s||i===t||i===n||i===r&&r>n})},Gp=e=>{if(!e)return!1;const{events:t,active:n}=e;if(n)return!0;if(!t.length)return!1;const r=t[0],i=Ie(t);return 2!==t.length||"filled_form"!==r.type||"system_message"!==i.type||"manual_archived_customer"!==i.systemMessageType||r.fields.some(e=>"answer"in e&&Boolean(e.answer))},Zp=(e,t)=>{let{thread:n,users:r,eventsSeenUpToMap:i}=t;const a=e.getSessionUser().serverId,s=Op(e,r),{sessionUserSeenUpTo:o,latestOtherUserSeenUpTo:l}=Lp(e,i);if(!Gp(n))return{thread:null,eventsSeenUpToMap:i};const{id:c,active:u,events:d,access:p}=n,g=u?d:Vp(d);return{thread:{id:c,active:u,agent:u?s:null,events:Bp(e,g,e=>e.authorId===a?l>=e.createdAt:o>=e.createdAt),group:Pp(p),properties:ig(n)},eventsSeenUpToMap:i}},Hp=(e,t)=>{let{thread:n}=t;const{id:r,active:i,events:a,access:s}=n,{eventsSeenUpToMap:o}=e.getChat(ci).properties,l=e.getSessionUser().serverId,{sessionUserSeenUpTo:c,latestOtherUserSeenUpTo:u}=Lp(e,o);return Gp(n)?{id:r,active:i,events:Bp(e,Vp(a),e=>e.authorId===l?u>=e.createdAt:c>=e.createdAt),group:Pp(s),properties:ig(n)}:null},Wp=e=>{let{properties:t,...n}=e;if("lc2"in t){const e=t.lc2;if("greeting_unique_id"in e)return((e,t)=>{const n=Qc({...e});return n.properties={...n.properties,invitation:!0,subtype:e.subtype,id:t.greeting_id,uniqueId:t.greeting_unique_id},n})(n,e);if(e.welcome_message)return((e,t)=>{var n;return Qc({...e,welcomeMessage:!0,...(null==(n=t.chats)?void 0:n.formatting)&&{formatting:t.chats.formatting},..."bb9e5b2f1ab480e4a715977b7b1b4279"in t&&{reaction:t.bb9e5b2f1ab480e4a715977b7b1b4279.message_reaction},...Yc({properties:t})})})(n,t)}return((e,t)=>{var n;return Qc({...e,...t.url_details&&{urlDetails:t.url_details},...t.translation&&{translation:lg(t.translation)},...(null==(n=t.chats)?void 0:n.formatting)&&{formatting:t.chats.formatting},..."bb9e5b2f1ab480e4a715977b7b1b4279"in t&&{reaction:t.bb9e5b2f1ab480e4a715977b7b1b4279.message_reaction},...Yc({properties:t})})})(n,t)},Yp=e=>{var t,n;const r=(e=>{var t,n;switch(e.template){case"quick_replies":{const r=e.elements[0];return(null==r?void 0:r.title)||(null==(t=null==r?void 0:r.buttons)?void 0:t.length)?{...Zc(e),type:"message",properties:{serverType:e.type,text:r.title??"",...(null==(n=r.buttons)?void 0:n.length)&&{quickReplies:r.buttons.map(e=>({type:e.type,text:e.text,value:e.value,postbackId:e.postbackId,...e.buttonId&&{buttonId:e.buttonId}}))},...Wc(e),...Yc(e)}}:null}case"sticker":{const t=e.elements[0].image;return{...Zc(e),type:"sticker",properties:{serverType:e.type,url:t.url,name:t.name,...Wc(e),...Yc(e)}}}case"ecommerce":return{...Zc(e),type:"product_cards",properties:{serverType:e.type,...e.layout&&{layout:e.layout},elements:e.elements}};default:{if(e.elements.length>1)return{...Zc(e),type:"carousel",properties:{serverType:e.type,cards:e.elements.map(Xc)}};const t=e.elements[0];if(1===Object.keys(t).length&&t.image){const{image:n}=t;return{...Zc(e),type:"image_preview",properties:{name:n.name,serverType:e.type,url:n.url,...n.alternativeText&&{alternativeText:n.alternativeText},...Wc(e),...Yc(e)}}}return{...Zc(e),type:"rich_message",properties:{serverType:e.type,card:Xc(t),...Wc(e),...Yc(e)}}}}})(e);return r?"lc2"in e.properties&&"greeting_unique_id"in e.properties.lc2?(r.properties={...r.properties,invitation:!0,subtype:e.subtype,id:e.properties.lc2.greeting_id,uniqueId:e.properties.lc2.greeting_unique_id,..."bb9e5b2f1ab480e4a715977b7b1b4279"in e.properties&&{reaction:e.properties.bb9e5b2f1ab480e4a715977b7b1b4279.message_reaction}},r):((null==(t=e.properties.chats)?void 0:t.formatting)&&(r.properties={...r.properties,formatting:e.properties.chats.formatting}),r.properties={...r.properties,...Yc(e)},"lc2"in e.properties&&(null==(n=e.properties.lc2)?void 0:n.welcome_message)&&(r.properties={...r.properties,welcomeMessage:!0}),r):null},Qp=function(e,t,n,r){void 0===n&&(n=[]);const i={...t,id:Fp(e,t),serverId:t.id,authorId:Mp(e,t),timestamp:new Date(t.createdAt).getTime()};switch(i.type){case"form":return Xp(e,i);case"filled_form":return Kp(e,i,n,r);case"message":return Wp(i);case"rich_message":return Yp(i);case"file":return(e=>{if(e.thumbnails){const{thumbnails:t}=e,n={...Zc(e),type:"image_preview",properties:{name:e.name,serverType:e.type,...t.default,link:e.url,srcSet:`${t.default.url} 1x, ${t.high.url} 2x`,...Wc(e),...Yc(e)}};return e.alternativeText&&(n.properties.alternativeText=e.alternativeText),n}return{...Zc(e),type:"message",properties:{serverType:e.type,text:e.name,url:e.url,...e.alternativeText&&{alternativeText:e.alternativeText},...Wc(e),...Yc(e)}}})(i);case"system_message":return eg(i);case"custom":return Jp(i);default:return null}},Jp=e=>{const{properties:t,customId:n,content:r}=e;return{...Zc(e),type:"custom",properties:{...t,customId:n},...void 0!==r&&{content:r}}},Xp=(t,n)=>{var r;const i={...n,fields:n.fields.map(t=>t.id?t:{...t,id:e()})},{author:a,...s}=Zc(i);return{...s,author:t.hasUser(a)?a:"system",type:"form",properties:{answered:!1,formType:i.formType||(null==(r=i.properties.lc2)?void 0:r.form_type)||null,fields:Up("",i).fields,formId:i.formId.replace(/_[0-9]+/,""),...Yc(i)}}},Kp=function(e,t,n,r){var i;void 0===n&&(n=[]);const a=function(e,t,n,r){var i;void 0===n&&(n=[]);const a=t.formType||(null==(i=t.properties.lc2)?void 0:i.form_type)||null;if(!xd(a))return;const s=e.getEvents(ci),o=_e(e=>"form"===e.type&&!e.properties.answered&&e.properties.formId===t.formId,[].concat(s,n));return o&&(r&&r.add(o.id),s.includes(o)&&e.updateEvent(ci,o.id,{properties:{...o.properties,answered:!0}})),null==o?void 0:o.author}(e,t,n,r);return{...Zc(t),...void 0!==a&&{author:a},type:"form",properties:{answered:!0,formId:t.formId,formType:t.formType||(null==(i=t.properties.lc2)?void 0:i.form_type)||null,fields:t.fields.filter(e=>"answer"in e||"answers"in e&&0!==e.answers.length).map(e=>{if("string"==typeof e.answer)return e;if("answers"in e){const{answers:t,...n}=e;return{...n,answer:t.map(e=>{let{label:t}=e;return t})}}return{...e,answer:e.answer.label}})}}},eg=e=>{switch(e.systemMessageType){case"archived_customer_disconnected":case"routing.archived_inactive":return Kc({...e,systemMessageType:"client_inactive"});case"manual_archived_agent":return Kc({...e,systemMessageType:"operator_closed_session",textVars:{operator:e.textVars.agent}});case"manual_archived_customer":return Kc({...e,systemMessageType:"chat_closed_by_customer"});case"system_archived":case"customer_banned":case"routing.archived_deleted":case"routing.archived_disconnected":case"routing.archived_offline":case"routing.archived_other":case"routing.archived_remotely_signed_out":case"routing.archived_signed_out":return Kc({...e,systemMessageType:"chat_session_closed"});case"routing.assigned_other":return Kc({...e,systemMessageType:"user_transfer",textVars:{operator:e.textVars.agent}});case"routing.assigned_deleted":case"routing.assigned_disconnected":case"routing.assigned_inactive":case"routing.assigned_remotely_signed_out":case"routing.assigned_signed_out":return Kc({...e,systemMessageType:"user_transfer",textVars:{operator:e.textVars.agent_added}});case"chat_transferred":return Kc({...e,systemMessageType:"user_transfer",textVars:{operator:e.textVars.targets}});case"agent_joined":case"agent_added":return Kc({...e,systemMessageType:"operator_joined_conference",textVars:{operator:e.textVars.agent}});case"agent_left":case"agent_removed":return Kc({...e,systemMessageType:"operator_left_conference",textVars:{operator:e.textVars.agent}});case"rating.chat_rated":return Kc({...e,systemMessageType:`rate_me_confirmation_${e.textVars.score}`});case"rating.chat_commented":return Kc({...e,systemMessageType:"rate_me_comment_added",textVars:{comment:e.textVars.comment}});case"rating.chat_rating_canceled":return Kc({...e,systemMessageType:"rate_me_cancel"});case"custom":{const{systemMessageType:t,...n}=e;return Kc(n)}default:return null}},tg=e=>{const{score:t,comment:n}=e;return{..."number"==typeof t&&{rate:1===t?"good":"bad"},..."string"==typeof n&&{rateComment:n}}},ng=e=>({position:e.position,waitingTime:e.waitTime}),rg=e=>{var t;const n=null==(t=null==e?void 0:e.dd0cb976ba03903db60900542bdf7b13)?void 0:t[ti];return"string"==typeof n&&n.length>0?n:null},ig=e=>({..."rating"in e.properties&&tg(e.properties.rating),upsellGoal:rg(e.properties),...e.queue&&{queue:ng(e.queue)},timestamp:new Date(e.createdAt).getTime()}),ag=(e,t)=>{const n={event:Qp(e,t.event),author:{...t.agent,type:"agent"}};var r;return n.event.properties={...n.event.properties,invitation:!0,id:t.id,addon:t.addon,uniqueId:t.uniqueId,accepted:t.accepted,type:(r=n.event,r.properties.quickReplies?"quick_replies":"rich_message"===r.type?"card":"plain_text"),subtype:t.subtype,receivedFirstTime:t.displayedFirstTime,isExitIntent:t.isExitIntent},n},sg=(e,t)=>{const n={...t.event,id:we(e.getIndexedEvents(ci))},r=Qp(e,n);return{id:n.id,author:Mp(e,n),type:"message",thread:null,...r,serverId:null,properties:{text:"",...null==r?void 0:r.properties,welcomeMessage:!0,id:t.id}}},og=(e,t)=>{const{type:n,id:r}=t;switch(n){case"filled_form":{const{formId:e,...n}=t;return{customId:n.customId,formId:e,...n}}case"emoji":case"message":case"message_draft":case"url_preview":{const{text:n,triggeredBy:i}=t.properties,a={type:"message",customId:r,text:n};if(i){const t=e.getEvent(ci,i.event);t&&t.thread&&t.serverId?a.postback={id:i.button.postbackId,type:"message",value:i.button.value,eventId:t.serverId,threadId:t.thread}:a.properties={c5e4f61e1a6c3b1521b541bc5c5a2ac5:{postback_id:i.button.postbackId}}}return a}case"custom_system_message":{const{recipients:e,text:n}=t.properties;return{type:"system_message",customId:r,text:n,recipients:e,systemMessageType:"custom"}}case"file":return{type:"file",customId:r,url:t.properties.serverUrl,alternativeText:t.properties.alternativeText};default:return}},lg=e=>({sourceLangCode:e.source_lang_code,targetLangCode:e.target_lang_code,targetMessage:e.target_message}),cg=(e,t)=>{const n=Qp(e,t);return n.id=t.customId,n.properties={...n.properties,isPreview:!0},n},ug=e=>"subject"===e.serverType?"subject":"name"===e.name?"name":"text"===e.type?"question":e.type,dg=(e,t)=>{let{id:n,serverId:r,properties:{formType:i,formId:a,fields:s}}=e;const o=tu(s,t),l=o.fields,c={filledForm:{type:"filled_form",formId:a,formType:i,...!r&&{customId:n},fields:s.filter(e=>void 0!==e.serverName&&"rating"!==e.type&&"information"!==e.type).map(e=>{if("groupSelect"===e.meta)return{type:"group_chooser",id:e.serverName,label:qc(e.label),answer:{id:String(o.choosenGroupIndex),groupId:o.choosenGroup,label:e.options[o.choosenGroupIndex].label}};if("confirm_subscription"===e.meta){const t=l[e.serverName];return{type:"checkbox_for_email",id:e.serverName,label:e.options[0].label,answer:!!t&&p(e.options[0].originalValue,t)}}if(M(e.options)){const t={type:ug(e),id:e.serverName,label:qc(e.label)},n=F(e.serverName,l)?me(l[e.serverName]):[],r=e.options.filter(e=>p(e.originalValue,n)).map(e=>({label:e.label,value:e.originalValue}));if("checkbox"===t.type)t.answers=r.map(e=>{let{label:t,value:n}=e;return{label:t,id:n}});else if(r.length){const e=r[0];t.answer={id:e.value,label:e.label}}return t}return F(e.serverName,l)?{type:ug(e),id:e.serverName,label:qc(e.label),answer:l[e.serverName]}:{type:ug(e),id:e.serverName,label:qc(e.label)}}),properties:{...i&&xp(i)&&{lc2:{form_type:i}}}}};return void 0!==o.choosenGroup&&(c.choosenGroup=o.choosenGroup),c},pg=d?0:150,gg=(e,t)=>e.filter(e=>e.serverName in t).map(e=>({type:e.type,label:e.label,value:e.options?me(t[e.serverName]).map(t=>u(e=>e.originalValue===t,e.options).label).join(", "):t[e.serverName]})),hg=(e,t,n,r)=>{e.emit(`on_${t}_survey_submitted`,{form_data:gg(n,r)})},mg=(e,t,n)=>{hg(e,"prechat",t,n)},fg=(e,t,n)=>{hg(e,"postchat",t,n)},_g=(e,t)=>{e.emit("on_rating_comment_submitted",t)},bg=(e,t)=>{e.emit("on_rating_submitted",null===t?"none":t)},vg=(e,t,n)=>{e.emit("on_message",{text:t.properties.text,timestamp:n/1e3,user_type:"visitor",visitor_name:e.getSessionUser().name})},yg=(e,t,n,r)=>{let{id:i,text:a,visitor:{email:s,name:o},subject:l}=r;const c={form_data:gg(t,n),ticket_id:i,text:a,visitor_name:o,visitor_email:s};l&&(c.ticket_subject=l),e.emit("on_ticket_created",c)},wg=()=>"openwidget.com"===window.location.hostname||window.location.hostname.endsWith(".openwidget.com"),kg=e=>{let{type:t,license:n,organizationId:r,...i}=e;return{...n?{licence_id:n.toString()}:{},...r?{organization_id:r}:{},event_id:t,message:JSON.stringify(i)}},xg=e=>{if(wg())return Promise.resolve();return de("https://applog.livechatinc.com/logs",{method:"POST",headers:{Accept:"*/*","Content-Type":"application/x-www-form-urlencoded"},body:Ke(kg(e))}).then(()=>Promise.resolve()).catch(O)},Ig=e=>{if(wg()||!("sendBeacon"in navigator))return;const t=new Blob([Ke(kg(e))],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon("https://applog.livechatinc.com/logs",t)},Sg=iu()?window.localStorage:au,Eg="_livechat_has_visited",Ag=[/sendURLToGuardwareProxy/i,/safari-extension:\/\//],Tg=new Map,Cg=(e,t)=>{let{type:n,errorMessage:r,count:i,source:a}=e;i<=1||Dg(a,"Informational","error_throttle_summary",{throttledType:n,throttledErrorMessage:r,totalOccurrences:i},t)},zg=!("true"===Sg.getItem(Eg));Sg.setItem(Eg,"true");const Dg=function(e,t,n,r,i){void 0===i&&(i=xg);const{timeZone:a}=(new Intl.DateTimeFormat).resolvedOptions(),s=(null==r?void 0:r.license)||Mm(),o=Fm(),l={type:`${e}_${n}`,...s?{license:s}:{},...o?{organizationId:o}:{},userAgent:navigator.userAgent,mobile:Zo(),timeZone:String(a),logVersion:"2026-06-29",firstTimeVisitor:zg,severity:t,lc_env:"production",...r};if(a){const[e]=a.split("/");e!==a&&(l.timeZoneArea=String(e))}return i(l)},$g=function(e,t,n,r){var i;void 0===r&&(r="chat_widget");const a={};if(t instanceof Error?(a.errorMessage=t.message,a.stack=t.stack,a.code=t.code):(null==t?void 0:t.message)?a.errorMessage=t.name?`${t.name}: ${t.message}`:t.message:a.errorMessage=JSON.stringify({error:t}),s=a,Ag.some(e=>e.test(`${s.errorMessage} ${s.stack}`)))return;var s;const o=Date.now();(e=>{Tg.forEach((t,n)=>{e-t.lastSeenAt>3e5&&(Cg(t,xg),Tg.delete(n))})})(o);const l=String(a.errorMessage??""),c=`${r}|${e}|${l}`,u=(null==(i=Tg.get(c))?void 0:i.count)??0;return 1===u?(Tg.set(c,{type:e,errorMessage:l,count:u+1,source:r,lastSeenAt:o}),Mg("error_throttle_started",{throttledType:e,throttledErrorMessage:l},r)):u>1?void Tg.set(c,{type:e,errorMessage:l,count:u+1,source:r,lastSeenAt:o}):(Tg.set(c,{type:e,errorMessage:l,count:1,source:r,lastSeenAt:o}),b(n)||(n={meta:JSON.stringify({info:n})}),Dg(r,"Error",e,{...n,...a}))},Mg=function(e,t,n){return void 0===n&&(n="chat_widget"),Dg(n,"Informational",e,t)},Fg=e=>Dg("chat_widget","Notice",e);window.addEventListener("pagehide",e=>{e.persisted||Tg.forEach(e=>Cg(e,Ig))});const Pg=e=>Mg("chat_started",e),Rg=e=>Mg("chat_rated",e),Og=e=>Mg("widget_opened",e),Bg=(e,t)=>Mg(`potential_connection_problem_${e}`,t),qg=e=>Mg("suggested_question_clicked",e),jg=()=>ke("webkit.messageHandlers.iosMobileWidget.postMessage",window)?"ios":!!ke("androidMobileWidget.postMessage",window)&&"android",Ug=e=>window.androidMobileWidget.postMessage(JSON.stringify(e)),Ng=e=>window.webkit.messageHandlers.iosMobileWidget.postMessage(e),Lg=(()=>{const e=jg();return"android"===e?Ug:"ios"===e?Ng:null})(),Vg=()=>Boolean(jg()),Gg=e=>{Lg&&(Lg({messageType:"uiReady"}),e.on("add_event",t=>{let{event:n}=t;if("message"!==n.type)return;const r=e.getUser(n.author).name;Lg({messageType:"newMessage",text:n.properties.text,id:n.id,timestamp:n.timestamp,author:{name:r}})}),e.on("mobile_wrapper_minimize_intent",()=>{Lg({messageType:"hideChatWindow"})}))},Zg={light:{maxModifier:.7},dark:{maxModifier:.5}};function Hg(e,t,n){return v(e,n)>v(t,n)?e:t}const Wg=function(e,t,n){void 0===n&&(n=0);const r=v(e,t),i=qm(t),{maxModifier:a}=Zg[i?"light":"dark"];if(n>=5)return e;const s=a-r/4.5*.5;if(r>=4.5)return e;const o=i?y(s,e):w(s,e);return v(o,t)>=4.5?o:Wg(o,t,n+1)},Yg=(e,t,n)=>{const r=jm(e)?w:y;return E(n,r(t,e))},Qg=(e,t)=>{const n=e.variant||"light",r=I[n],i=e.customJson||{},{agentbarBackgroundColor:a,agentMessageColorBackground:s}=e,o=jm(e.titlebarBackgroundColor)?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.065)",l=jm(a)?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.05)",c=jm(a)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.2)",u=jm(a)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.1)",d=k.primaryTextColor,p=x.primaryTextColor,g=Hg(d,p,e.ctaColor),h=Wg(e.ctaColor,r.surface),m=Ym(s),f=t?r.chatBackground:e.backgroundColor,_=Hg(d,p,f),b=Yg(f,.1,.3),v=Yg(f,.15,.3),y=Hg(d,p,b);return S({name:e.name,variant:n,iconTheme:e.name,showMessageAvatar:"modern"!==e.name,colors:{agentBarText:e.agentbarText,agentBarBackground:a,cta:e.ctaColor,ctaText:g,minimizedIcon:e.minimizedColorIcon,minimizedBackground:e.minimizedColorBackground,background:f,visitorMessageText:e.visitorMessageColorText,visitorMessageBackground:e.visitorMessageColorBackground,systemMessage:e.systemMessageColor,agentMessageBackground:s,agentMessageText:e.agentMessageColorText,minimizedText:e.minimizedColorText,titleBarText:e.titlebarText,titleBarBackgroundColor:e.titlebarBackgroundColor,quickRepliesColor:h,lighterOppositeTitleBarColor:o,decorativeOppositeAgentBarColor:l,lighterOppositeAgentBarColor:c,codeBlockBackgroundColor:m,adjustedChatBackground:b,adjustedChatBackgroundHover:v,adjustedChatBackgroundTextColor:y},AgentBar:{css:{background:a,color:e.agentbarText},IconButton:{css:{background:{default:"transparent",active:c}}}},Form:{IconButton:{css:{background:{default:"rgba(0, 0, 0, 0.05)",active:e.ctaColor},color:{default:r.formIconColor,active:g}}}},ChatSummary:{Icon:{color:e.minimizedColorIcon}},Maximized:{css:{background:f}},Message:{own:{Bubble:{css:{background:"modern"===e.name?"transparent":e.visitorMessageColorBackground,color:e.visitorMessageColorText}}},system:{Bubble:{css:{color:e.systemMessageColor}}},Bubble:{css:{background:"modern"===e.name?"transparent":s,color:e.agentMessageColorText}},css:{color:e.systemMessageColor}},TypingIndicator:{css:{color:e.systemMessageColor}},Minimized:{MinimizedBubble:{css:{color:e.minimizedColorText,backgroundColor:e.minimizedColorBackground},Icon:{color:e.minimizedColorIcon}},MinimizedBar:{css:{color:e.minimizedColorText,backgroundColor:e.minimizedColorBackground},Icon:{color:e.minimizedColorIcon}}},TitleBar:{css:{background:"modern"===e.name?e.titlebarBackgroundColor:"transparent",color:"modern"===e.name?e.titlebarText:_},HourGlassLabel:{css:{backgroundColor:l}}},DividerLabel:{css:{color:e.systemMessageColor,borderColor:u}},TextComposer:{IconButton:{css:{background:{active:e.ctaColor}},active:{Icon:{color:g}}}}},i)},Jg=[0,2,4,6,8,1,3,5,7,9],Xg=e=>e.replace(/\b(?:\d[ -]*?){8,15}((?:\d[ -]*?){4})\b/g,(e,t)=>{const n=e.replace(/(-|\s)/g,"");return(e=>{if(/[^0-9-\s]+/.test(e))return!1;const t=e.replace(/\D/g,"");let n,r=t.length,i=1,a=0;for(;r;)n=parseInt(t.charAt(--r),10),a+=(i^=1)?Jg[n]:n;return a&&a%10==0})(n)?`${(e=>{const t=e%4,n=t?4-t:0,r=Math.floor(e/4)+(t?1:0)-n-1,i=ye(n,"XXX"),a=ye(r,"XXXX");return i.concat(a).join("-").concat("-")})(n.length)}${t}`:e}),Kg=e=>{let t=0;return e.split("").forEach(e=>{const n=e.charCodeAt(0);t=(t<<5)-t+n,t&=t}),t},eh=(e,t)=>Kg(e)%(1/t)==0;(new Nt).tlds(Gt);const th=(e,t,n)=>{const r=A(t=>t.name===e,n);return-1!==r?qe(r,{...n[r],defaultValue:t},n):n},nh=(e,t,n)=>{e.addEvent(t,{...n,serverId:n.serverId||null})},rh=(e,t,n)=>{let{systemMessageType:r,textVariables:i,text:a}=n;nh(e,t,{id:we(e.getIndexedEvents(ci)),serverId:null,type:"system_message",author:"system",seen:!0,properties:N({systemMessageType:r,textVariables:i,defaultText:a})})},ih=e=>{om(e),(e=>{Na(e).forEach(t=>{e.emit("cancel_upload",{eventId:t.id})})})(e),e.updateChat(ci,{active:!1,properties:{ended:!0,queued:!1,agentActivity:null}}),e.setApplicationState({greetingsMuted:!1})},ah=e=>{e.setApplicationState({eyeCatcher:{...e.getApplicationState().eyeCatcher,hidden:!0}})},sh=(e,t)=>{const n=e.getApplicationState("lightbox"),r={...n,...t.mode&&t.mode!==n.mode&&{mode:t.mode},...t.state&&t.state!==n.state&&{state:t.state},...void 0!==t.currentImageEventId&&{currentImageEventId:t.currentImageEventId},...void 0!==t.sourceEventId&&{sourceEventId:t.sourceEventId},...t.productImages&&{productImages:t.productImages},..."imagesScrollPosition"in t&&{imagesScrollPosition:t.imagesScrollPosition},...void 0!==t.productAction&&{productAction:t.productAction},...void 0!==t.productActionButton&&{productActionButton:t.productActionButton},...void 0!==t.skipEnterAnimations&&{skipEnterAnimations:t.skipEnterAnimations},...void 0!==t.canScrollLeft&&{canScrollLeft:t.canScrollLeft},...void 0!==t.canScrollRight&&{canScrollRight:t.canScrollRight}};e.setApplicationState({lightbox:r})},oh=function(e,t,n,r,i,a,s){if(void 0===a&&(a=0),void 0===s&&(s=null),0===n.length)return;const o={},l=n.map(e=>{const n=`i${we(o)}`;return o[n]={eventId:n,link:e,alt:t},n}),c=l[a]??l[0]??null;sh(e,{mode:"product",state:"initializing",currentImageEventId:c,sourceEventId:i,productImages:{orderedEventIds:l,eventIdDataMap:o},productAction:r,productActionButton:s,imagesScrollPosition:void 0,skipEnterAnimations:!1})},lh=(e,t,n)=>{if(0===n.length)return;const r=e.getApplicationState("lightbox");if("product"!==r.mode||"closing"===r.state||"closed"===r.state)return;const i=r.currentImageEventId,a=i?r.productImages.eventIdDataMap[i]:null,s=!!(a&&i&&n.includes(a.link));let o=!1;const l={},c=n.map(e=>{if(s&&!o&&a&&i&&e===a.link)return o=!0,l[i]=a,i;const n=`i${we(l)}`;return l[n]={eventId:n,link:e,alt:t},n});sh(e,{productImages:{orderedEventIds:c,eventIdDataMap:l},...s?{}:{currentImageEventId:c[0]??null},skipEnterAnimations:!0})},ch=e=>{const t=e.getApplicationState("lightbox").productAction;(null==t?void 0:t.postback)&&Vi(e,ci,t.thread)&&Ih(e,{eventId:t.postback.eventId,postback:t.postback.payload})},uh=e=>{Ni(e)||e.setApplicationState({pendingGreetingHide:!0})},dh=e=>{const t=Ta(e);if(!t||!t.properties.uniqueId||Ca(e,t))return;const{invitation:n}=e.getApplicationState();var r;e.setApplicationState({invitation:{...n,hiddenIds:[].concat(n.hiddenIds,[t.properties.uniqueId])}}),mm(e,{showIndicator:void 0,greetingImageRendered:!1,greetingEventId:void 0}),eh(e.getSessionUser().serverId,.01)&&(r={minimizedType:$i(e),greetingId:t.properties.id,greetingUniqueId:t.properties.uniqueId,greetingType:t.properties.type,greetingSubtype:t.properties.subtype,greetingAddon:t.properties.addon||"none"},Mg("greeting_dismissed",r)),e.emit("render-minimized")},ph=function(e,t,n){let{skipAnimations:r=!1}=void 0===n?{}:n;if(!Es(e))return void dh(e);const{closed:i,greetingAnimationState:a,deferred:s}=e.getApplicationState("minimizedMessageInput"),o=()=>{var n,r;e.removeEvent(ci,t);const a=!(null==(r=null==(n=Ka(e))?void 0:n.messageInput)?void 0:r.trim()),o=i||a&&s||!As(e);Im(e,{state:o?"hidden":a?"classic":"full",closingGreetingId:null,greetingAnimationState:"hidden"},{render:!0,scheduledRender:!0})};r?o():"exit"!==a&&("hidden"!==a?Im(e,{state:"full",closingGreetingId:t,greetingAnimationState:"exit"},{render:!0}):o())},gh=(e,t)=>{var n,r;const{closingGreetingId:i,closed:a,deferred:s}=e.getApplicationState("minimizedMessageInput"),o=!(null==(r=null==(n=Ka(e))?void 0:n.messageInput)?void 0:r.trim());i===t&&(C(),dh(e),a||o&&s||!As(e)?Im(e,{state:"hidden",closingGreetingId:null,greetingAnimationState:"hidden"},{render:!0}):(Im(e,{state:o?"retracting":"full",closed:!1,closingGreetingId:null,greetingAnimationState:"hidden"},{render:!0}),o&&hh(e)))},hh=e=>{setTimeout(()=>{"retracting"===e.getApplicationState("minimizedMessageInput").state&&Im(e,{state:"classic",closed:!1,closingGreetingId:null,greetingAnimationState:"hidden"},{render:!0})},ol)},mh=(e,t)=>{e.removeEvent(ci,t),Im(e,{state:"full",closingGreetingId:null,greetingAnimationState:"hidden"})},fh=e=>{const t=Ta(e);if(!t||!t.properties.uniqueId||za(e))return;const{invitation:n}=e.getApplicationState();e.setApplicationState({invitation:{...n,displayedIds:[].concat(n.displayedIds,[t.properties.uniqueId]),displayedAt:Date.now()}})},_h=function(e,t){let{shouldMaintainModality:n=!0}=void 0===t?{}:t;Ga(e,"maximized")||e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:"maximized",...!n&&{interactionModality:"virtual"}},minimizedMessageInput:{...e.getApplicationState("minimizedMessageInput"),isFocused:!1,state:As(e)?"classic":"hidden",autoExpanded:!1}})},bh=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const{visibility:r,destroyed:i,isMinimizedForcefullyDisabled:a}=e.getApplicationState();!t&&"hidden"===r.state&&r.forced||"minimized"===r.state||(!Va(e)||Ui(ci,e)||i||a?e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:"hidden"}}):n||!e.getView("Moment").show?(e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:"minimized"}}),mm(e,{bubbleHoverState:!1})):e.emit("request_close_moment"))},vh=e=>{Ga(e,"minimized")&&e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:"hidden"}})},yh=e=>{const t=e.getApplicationState("minimizedMessageInput"),n=t.state;("hidden"!==t.greetingAnimationState||!("classic"===n||"hidden"===n))&&Im(e,{state:t.closed||!As(e)?"hidden":"classic",greetingAnimationState:"hidden",closingGreetingId:null},{render:!1})},wh=(e,t)=>{let{id:n,active:r=!0,thread:i,previousThread:a,group:s,agent:o,queued:l=!1,timestamp:c}=t;null===e.getChat(ci).serverId&&e.setChatServerId(ci,n);const u=e.getChat(ci).properties.fakeAgentMessageId,d={awaitingWelcomeMessage:!1,ended:!1,queued:l,fakeAgentMessageId:null,lastThread:i,previousThread:a,currentAgent:o,timestamp:c,starting:!1};"number"==typeof s&&(d.group=s),ah(e),e.setApplicationState({disableSendingMessage:!1}),e.updateChat(ci,{active:r,properties:d}),u&&yh(e),im(e),am(e),e.setApplicationState({hidden:!1}),e.getApplicationState("welcomeMessageId")&&e.setApplicationState({welcomeMessageId:null,welcomeMessageScope:null});const{readyState:p}=e.getApplicationState();p===Br||Ga(e,"maximized")||(e.setCurrentView("Chat"),_h(e,{shouldMaintainModality:!1}))},kh=function(e,t,n){void 0===n&&(n={});const r=Ii("creditCardMasking",e).enabled?(e=>Xg(e.replace(/\/\/(\S*):(\S*)@/g,"//****:****@")))(t):t;return{type:Gc(r)?"emoji":"message",thread:Xa(e),properties:N({text:r,...n})}},xh=function(e,t,n,r,i){void 0===r&&(r=void 0),void 0===i&&(i=void 0),e.sendEvent(t,kh(e,n,{triggeredBy:r,source:i}))},Ih=(e,t)=>{let{eventId:n,postback:r}=t;const i=ki(e),a=Xa(e);"add_to_cart"===r.type&&e.emit("sending_product_card_postback",{eventId:n,postbackId:r.id}),e.sendEvent(i,{type:"rich_message_postback",thread:a,properties:{eventId:n,postback:r}},void 0)},Sh=function(e,t,n,r){switch(void 0===r&&(r=1),e.type){case"show_gallery":return{id:e.postbackId,type:"show_gallery",toggled:!0,ecommerce:{product_id:t}};case"url":return{id:e.postbackId,type:"url",toggled:!0,ecommerce:{product_id:t}};case"add_to_cart":return{id:e.postbackId,type:"add_to_cart",toggled:!0,ecommerce:{option_id:n??e.value,product_id:t,quantity:r}};case"open_external":return{id:e.postbackId,type:"open_external",toggled:!0,ecommerce:{option_id:n??e.value,product_id:t}};default:return null}},Eh=e=>{let{urlButton:t,eventId:n,thread:r,productId:i,selectedVariantId:a}=e;if(!t)return null;const s=t.postbackId?Sh(t,i,a):null;return{url:t.value,label:t.text,postback:s?{eventId:n,payload:s}:null,thread:r}},Ah=e=>{let{actionButton:t,eventId:n,thread:r,addedKey:i,productId:a,selectedVariantId:s}=e;if(!t)return null;const o=t.postbackId?Sh(t,a,s):null;return{type:t.type,label:t.text,value:t.value,postback:o?{eventId:n,payload:o}:null,eventId:n,thread:r,addedKey:i}},Th=(e,t)=>{let{eventId:n,button:r,productId:i,selectedVariantId:a,quantity:s}=t;if(!r.postbackId)return;const o=Sh(r,i,a,s);o&&Ih(e,{eventId:n,postback:o})},Ch=(e,t)=>{var n;let{eventId:r,userId:i,postbackId:a}=t;const s=e.getEventByServerId(ci,r);i===(null==(n=e.getSessionUser())?void 0:n.serverId)&&e.emit("incoming_rich_message_postback",{eventId:(null==s?void 0:s.id)??r,postbackId:a})},zh=(e,t,n)=>{e.setApplicationState({messageDraft:n,initialMessageDraft:null})},Dh=(e,t,n,r)=>{const{quickReplies:i}=n.properties,a=i[r];if(n.properties.welcomeMessage&&qg({context:"maximized"}),n.properties.invitation){if(e.getApplicationState("isPreview"))return;um(e,n.id,a)}else xh(e,t,a.text,{type:"quick_reply",event:n.id,button:a},n.properties.welcomeMessage?"suggested_questions_maximized":void 0)},$h=(e,t,n)=>{const r=Oa(e,t);r?e.updateEvent(t,r.id,{properties:n.properties}):nh(e,t,{...n,seen:!0,type:di,author:e.getSessionUserId(),id:we(e.getIndexedEvents(ci))}),r||Oh(e),e.setCurrentView("Chat")},Mh=function(e,t,n,r,i){void 0===r&&(r=void 0),void 0===i&&(i=void 0);const a=e.getApplicationState("invitation").current,s=e.getEvent(t,a),o=kh(e,n,{triggeredBy:r,source:i,...s&&{fromGreeting:{...Ce(["id","uniqueId"],s.properties)}}});if(!qa(e,t))return e.setCurrentView("Chat"),void e.sendEvent(t,o);$h(e,t,o)},Fh=(e,t,n)=>{if(is(e)&&!Si(e))return;if(!qa(e,t))return void e.setApplicationState({initialMessageDraft:n});const r=kh(e,n);$h(e,t,r)},Ph=(e,t,n)=>{let{text:r,recipients:i="all"}=n;e.sendEvent(t,{type:"custom_system_message",thread:Xa(e),properties:{text:r.trim(),recipients:i}})},Rh=(e,t)=>{e.updateChat(ci,{properties:{currentAgent:t}})},Oh=e=>{if(!ta(e,"prechat")){const t=e.getView("Chat/prechat");Jh(e,t)}},Bh=(e,t)=>{const{properties:{rate:n,rateComment:r}}=e.getChat(ci);let{fields:i,...a}=t;n&&(i=th("rating",n,i)),r&&(i=th("rateComment",r,i)),Jh(e,{...a,fields:i})},qh=e=>{const t=ki(e);e.updateChat(t,{properties:{startChatAgainPending:!0}})},jh=function(e,t,n){let{chatId:r,forced:i}=void 0===n?{}:n;e.updateChat(ci,{properties:{startChatAgainPending:!1}}),em(e);const{properties:{lastThread:a},serverId:s}=e.getChat(ci);if(i||!Ei(e)||s&&r!==s)e.flushChat(t),r&&e.setChatServerId(ci,r);else{rm(e);const t=Oi(e,ci);t&&e.removeEvent(ci,t.id)}e.updateChat(t,{properties:{agentActivity:null,awaitingWelcomeMessage:!1,ended:!1,fakeAgentMessageId:null,lastThread:a,loadingHistory:!1,queued:!1,rate:null,rateComment:null,transcriptSentTo:null}}),e.setApplicationState({disableSendingMessage:!1,greetingsMuted:!1})},Uh=e=>{e.updateChat(ci,{properties:{rate:null,rateComment:null,transcriptSentTo:null}})},Nh=(e,t)=>{var n,r;const i=t.getApplicationState("config"),a=e.__unsafeProperties.enableTextApp??!1;t.setApplicationState({config:{...i,features:{...i.features,homeScreen:{enabled:Nm(e)},utmParams:{enabled:Gm(e)},addToWebsiteButton:{enabled:Zm(e)},fileSharing:{enabled:"1"===e.properties.license.core["attachments.enable_for_visitors"]},agentAvatar:{enabled:e.__unsafeProperties.group.hasAgentAvatarsEnabled},continuousChat:{enabled:"1"===e.properties.license.core.continuous_chat_widget_enabled},chatHistory:{enabled:"1"===e.properties.license.core.customer_history_enabled},rating:{enabled:e.__unsafeProperties.group.ratingEnabled},emailTranscript:{enabled:e.__unsafeProperties.group.transcriptButtonEnabled},logo:e.__unsafeProperties.group.logo.enabled?{enabled:!0,path:e.__unsafeProperties.group.logo.src}:{enabled:!1,path:void 0},linksPreview:{enabled:e.__unsafeProperties.group.linksUnfurlingEnabled},ticketForm:{enabled:"ticketForm"in e,mode:e.__unsafeProperties.ticketFormMode||Fs(e)},queue:{writingInQueueEnabled:Um(e)},preChatForm:{enabled:"prechatForm"in e},preChatAfterGreeting:{enabled:e.__unsafeProperties.group.prechatFormAfterGreetingEnabled},creditCardMasking:{enabled:!!e.__unsafeProperties.license&&e.__unsafeProperties.license.creditCardMaskingEnabled},hideTrademark:{enabled:e.__unsafeProperties.group.hasHiddenTrademark||!1===e.isPoweredByEnabled},disableSounds:{enabled:!e.__unsafeProperties.group.hasSoundsEnabled},minimized:{enabled:!e.__unsafeProperties.group.disabledMinimized},mobileMinimized:{enabled:e.__unsafeProperties.group.hasCustomMobileSettings?!e.__unsafeProperties.group.disabledMinimizedOnMobile:!e.__unsafeProperties.group.disabledMinimized},hideOnInit:{enabled:e.__unsafeProperties.group.hideOnInit},textApp:{enabled:a},privacyPolicy:{enabled:(null==(n=e.__unsafeProperties.group.privacyPolicy)?void 0:n.enabled)??!1,text:(null==(r=e.__unsafeProperties.group.privacyPolicy)?void 0:r.text)??""}},minimizedType:e.__unsafeProperties.group.minimizedType,mobileMinimizedType:e.__unsafeProperties.group.minimizedTypeOnMobile,theme:S(i.theme,Qg(e.__unsafeProperties.group.theme,a)),screenPosition:e.__unsafeProperties.group.screenPosition,disabledOnMobile:e.__unsafeProperties.group.disabledOnMobile,disabledMinimized:e.__unsafeProperties.group.disabledMinimized,hasCustomMobileSettings:e.__unsafeProperties.group.hasCustomMobileSettings,mobileScreenPosition:e.__unsafeProperties.group.screenPositionOnMobile,mobileOffset:{x:e.__unsafeProperties.group.offsetXOnMobile,y:e.__unsafeProperties.group.offsetYOnMobile},mobileDisabledMinimized:e.__unsafeProperties.group.disabledMinimizedOnMobile,minimizedInputEnabled:Lm(e),mobileMinimizedInputEnabled:Vm(e),nonProfitLicense:!!e.__unsafeProperties.license&&e.__unsafeProperties.license.nonProfit,properties:e.properties,screenOffset:{x:e.__unsafeProperties.group.offsetX,y:e.__unsafeProperties.group.offsetY}}}),t.getApplicationState("config").features.disableSounds.enabled&&t.setApplicationState({muted:!0})},Lh=(e,t,n)=>{const r=e.getApplicationState("config");e.setApplicationState({config:{...r,features:S(r.features,{[t]:n})}})},Vh=(e,t)=>{Lh(e,t,{enabled:!1})},Gh=(e,t,n)=>{Lh(e,t,{enabled:!0,...n})},Zh=(e,t)=>{try{const n=JSON.parse(t).filter(e=>{let{template_id:t}=e;return"moment"===t||"links"===t});if(a(n))return;Gh(e,"boosters",{items:n.map(e=>{if("links"===e.template_id)return{id:e.id,template:e.template_id,links:e.links};const t={type:e.action.type,label:e.action.label,url:e.action.url};return{id:e.id,template:e.template_id,title:e.title,description:e.description,icon:e.icon,action:t}})})}catch(n){}},Hh=(e,t,n)=>{const r={answered:!0};n&&(r.fields=n.properties.fields,n.id&&!e.getEvent(ci,t).serverId&&e.setEventServerId(ci,t,n.id)),e.updateEvent(ci,t,{properties:r});const i=e.getEvent(ci,t);$a(i)&&Promise.resolve().then(()=>{e.hasEvent(ci,t)&&e.removeEvent(ci,t)})},Wh=(e,t)=>{var n;t.properties.receivedFirstTime&&eh(e.getSessionUser().serverId,.01)&&(n={minimizedType:$i(e),greetingId:t.properties.id,greetingUniqueId:t.properties.uniqueId,greetingType:t.properties.type,greetingSubtype:t.properties.subtype,greetingAddon:t.properties.addon||"none"},Mg("greeting_displayed",n))},Yh=(e,t)=>{var n,r,i,a,s;const{defaultWidget:o,embedded:l,actingAsDirectLink:c,greetingsMuted:u}=e.getApplicationState();Rh(e,t.author),"openwidget"===o&&(e=>{const t=e.getApplicationState("recommendations");Ol(),mm(e,{eventsQueue:[]},{scheduleRerender:!1}),_m(e,{transitionState:"hidden",hidden:!0}),fm(e,{transitionState:"hidden",hidden:!0}),bm(e,{transitionState:"hidden",hidden:!0}),e.setApplicationState({recommendations:{...t,isVisible:!1,hiddenIds:[].concat(t.hiddenIds,[t.id]),hidden:!0}})})(e),"bar"!==$i(e)&&ah(e),im(e),sm(e);const d=Ta(e);var p;d&&(p={minimizedType:$i(e),greetingId:null==(n=d.properties)?void 0:n.id,greetingUniqueId:null==(r=d.properties)?void 0:r.uniqueId,greetingType:null==(i=d.properties)?void 0:i.type,greetingSubtype:null==(a=d.properties)?void 0:a.subtype,greetingAddon:(null==(s=d.properties)?void 0:s.addon)||"none"},Mg("greeting_not_canceled",p),Es(e)?mh(e,d.id):e.removeEvent(ci,d.id)),me(t.properties.cards||t.properties.card).filter(Boolean).forEach(t=>{t.title&&(t.title=Bm(e,t.title)),t.subtitle&&(t.subtitle=Bm(e,t.subtitle)),t.buttons&&(t.buttons.forEach(e=>e.invitation=!0),l&&!c||t.buttons.filter(e=>"url"===e.type&&"target"in e).forEach(e=>e.target="new"))});const g=we(e.getIndexedEvents(ci));nh(e,ci,{...t,seen:!u,id:g,properties:{...t.properties,...t.properties.text&&{text:Bm(e,t.properties.text)}}}),e.updateChat(ci,{properties:{fakeAgentMessageId:g}}),e.setApplicationState({invitation:{...e.getApplicationState("invitation"),current:g}}),t.properties.receivedFirstTime&&e.setCurrentView("Chat"),Ga(e,"maximized")||(Ca(e,t)&&t.properties.receivedFirstTime&&!u?_h(e,{shouldMaintainModality:!1}):Ca(e,t)||bh(e,!0)),u||Wh(e,t),e.emit("render-minimized")},Qh=(e,t)=>{const n=(new Date).toISOString();e.setApplicationState({config:{...e.getApplicationState("config"),features:{...e.getApplicationState("config").features,ticketForm:{...e.getApplicationState("config").features.ticketForm,additionalInfo:{lastDisplayedReason:t,lastDisplayedAt:n}}}}}),Jh(e,e.getView("Chat/ticketForm"))},Jh=(e,t)=>{const n={formType:t.type,formId:t.id,fields:t.fields};if(ta(e)){const{id:t}=e.getLastEvent(ci);return e.updateEvent(ci,t,{properties:n})}const r=we(e.getIndexedEvents(ci));return nh(e,ci,{id:r,type:"form",author:"system",properties:n})},Xh=(e,t)=>{const n=e.getView("Moment");if(n.show&&!t.wasTriggeredByGreeting)return n.data.url===t.url?void e.emit("request_expand_moment"):void e.emit("request_expand_moment",{nextMoment:t});ef(t.url)?(e.updateView("Moment",{show:!0,data:t}),n.show&&e.emit("request_expand_moment")):rh(e,ci,{text:"Link attached to the button is invalid."})},Kh=e=>{const{productActionButton:t,state:n}=e.getApplicationState("lightbox");if("closing"!==n&&t&&Vi(e,ci,t.thread)&&("add_to_cart"!==t.type||!e.getApplicationState("pendingProductCardKeys").includes(t.addedKey))&&(sh(e,{state:"closing"}),t.postback&&Ih(e,{eventId:t.postback.eventId,postback:t.postback.payload}),"open_external"===t.type)){const n=e.getEvent(ci,t.eventId);Xh(e,{url:t.value,title:t.label,source:"product_card",displayMode:"ecommerce",event:n})}},em=function(e,t){void 0===t&&(t=!1),e.updateView("Moment",{show:!1,data:{}}),t&&bh(e)},tm=(e,t)=>{e.requestUpdateUser(e.getSessionUser().id,t)},nm=(e,t)=>{const n=e.getSessionUser().id;var r;null!==e.getUser(n).serverId&&e.clearUserServerId(n),e.setUserServerId(n,t),e.setApplicationState({testGroup:(r=t,Kg(r)%2?"A":"B")})},rm=function(e,t){void 0===t&&(t=void 0);const n=ea(e,t);n&&e.removeEvent(ci,n)},im=e=>{rm(e,"prechat")},am=e=>{rm(e,"postchat")},sm=e=>{rm(e,"ticket")},om=e=>{const t=e.getEvents(ci);for(const n of t)"form"===n.type&&!n.properties.answered&&xd(n.properties.formType)&&e.removeEvent(ci,n.id)},lm=(e,t,n)=>{const r=ke("error.details.errors",e);if(!r)return void n();const i=r.reduce((e,n)=>"requester.email"===n.field?{...e,email:t("invalid_email")}:"requester.name"===n.field?{...e,name:n.message}:e,{});a(i)?n():n(i)},cm=e=>{(e=>{const{lastThread:t,currentAgent:n,queued:r}=e.getChat(ci).properties;return!(!Si(e)||n||r)&&!_e(e=>{let{type:n,thread:r}=e;return"email_prompt"===n&&r===t},e.getEvents(ci))})(e)&&(e=>{const t=ui,{properties:{lastThread:n}}=e.getChat(ci);e.hasEvent(ci,t)&&e.removeEvent(ci,t),xa(e).find(e=>"form"===e.type&&"ask_for_email"===e.properties.formId)||e.addEvent(ci,{id:t,serverId:null,seen:!0,type:ui,author:"system",thread:n})})(e)},um=function(e,t,n,r){void 0===r&&(r=!1),p(n.type,["message","webview"])&&_h(e);const i=ki(e);switch(e.emit("rich_greeting_button_clicked",{button:n,event:e.getEvent(i,t)}),n.type){case"message":Mh(e,i,n.text,{event:t,button:n});break;case"webview":Xh(e,{url:n.value,wasTriggeredByGreeting:r,source:r?"targeted_message":"rich_message",event:e.getEvent(i,t)});break;case"cancel":hm(e,i,t);break;case"copy":return void Ms(n.value)}},dm=e=>{e.emit("start_thread")},pm=function(e,t,n){void 0===n&&(n="button");const r=e.getChat(ci),i=p("image",t.type);(p(["clipboard","drag"],n)||Math.random()<.1)&&Mg("file_upload_added",{uploadSource:n}),vs(e,ci)&&xm(e),e.sendEvent(ci,{type:"file",thread:r.properties.lastThread,properties:{name:t.name.substring(0,255),progress:0,finished:!1,failed:!1,failReason:null,fileType:i?"image":"other",url:i?URL.createObjectURL(t):null,uploadSource:n}},{file:t})},gm=function(e,t,n){let{force:r=!1,preventMute:i=!1,skipAnimations:a=!1}=void 0===n?{}:n;!i&&za(e)&&Aa(e)&&e.setApplicationState({greetingsMuted:!0}),zs(e)&&!r||(Es(e)?ph(e,t,{skipAnimations:a}):(e.removeEvent(ci,t),setTimeout(()=>e.emit("render-minimized"),0)))},hm=(e,t,n)=>{const r=e.getChat(t),{mobile:i}=e.getApplicationState(),a=e.getEvent(t,n);var s;!r.active&&a&&(eh(e.getSessionUser().serverId,.01)&&(s={mobile:i,greetingId:a.properties.id,greetingUniqueId:a.properties.uniqueId,greetingType:a.properties.type,greetingSubtype:a.properties.subtype,greetingAddon:a.properties.addon||"none",minimizedType:$i(e)},Mg("greeting_canceled",s)),e.emit("request_cancel_greeting",a))},mm=function(e,t,n){let{scheduleRerender:r=!0}=void 0===n?{}:n;const i=e.getView("minimized"),a={...i,...t};JSON.stringify(i)!==JSON.stringify(a)&&(e.updateView("minimized",a),r&&setTimeout(()=>e.emit("render-minimized"),0))},fm=(e,t)=>{const{session:n,transitionState:r}=t,i={...e.getApplicationState("visitorCounter")||{},...n&&{session:n},transitionState:r,...void 0!==t.hidden?{hidden:t.hidden}:{},isVisible:!!r&&"hidden"!==r};e.setApplicationState({visitorCounter:i}),e.emit("render-minimized")},_m=(e,t)=>{const{transitionState:n}=t,r={...e.getApplicationState("googleReviews"),transitionState:n,...void 0!==t.hidden?{hidden:t.hidden}:{},isVisible:!!n&&"hidden"!==n};e.setApplicationState({googleReviews:r}),e.emit("render-minimized")},bm=(e,t)=>{const n=e.getApplicationState("contactInvitation"),r=t.transitionState??n.transitionState,i={...n,transitionState:r,...void 0!==t.hidden?{hidden:t.hidden}:{},isVisible:!!r&&"hidden"!==r,hasSeen:void 0!==t.hasSeen?t.hasSeen:n.hasSeen};e.setApplicationState({contactInvitation:i}),t.transitionState&&e.emit("render-minimized")},vm=(e,t)=>{const n=e.getApplicationState("chatBotGreeting"),r=t.transitionState??n.transitionState,i={...n,transitionState:r,isVisible:!!r&&"hidden"!==r,text:void 0!==t.text?t.text:n.text,hidden:void 0!==t.hidden?t.hidden:n.hidden,hasSeen:void 0!==t.hasSeen?t.hasSeen:n.hasSeen};e.setApplicationState({chatBotGreeting:i}),t.transitionState&&e.emit("render-minimized")},ym=(e,t)=>{const{history:n}=e.getApplicationState("locationHistory"),r=(new Date).getTime();if(n.length&&Ie(n)===t)return void e.setApplicationState({locationHistory:{history:n,updatedAt:r}});const i=[].concat(n.slice(-10),[t]);e.setApplicationState({locationHistory:{history:i,updatedAt:r}})},wm=T(500,e=>{e.emit("scroll_to_bottom")}),km=e=>{wm(e)},xm=e=>{e.getApplicationState().isPreview||(e.setApplicationState({privacyPolicyBannerState:"closing"}),setTimeout(()=>{e.setApplicationState({privacyPolicyBannerState:"hidden"})},pg))},Im=function(e,t,n){let{state:r,closed:i,isPrivacyPolicyBannerClosing:a,isSuggestedQuestionsClosing:s,closingGreetingId:o,greetingAnimationState:l,deferred:c,autoExpanded:u}=t;void 0===n&&(n={render:!0,scheduledRender:!1});const d=e.getApplicationState("minimizedMessageInput"),p="boolean"==typeof u?u:"full"===r&&d.autoExpanded;e.setApplicationState({minimizedMessageInput:{...d,state:r,..."boolean"==typeof i&&{closed:i},...void 0!==a&&{isPrivacyPolicyBannerClosing:a},...void 0!==s&&{isSuggestedQuestionsClosing:s},..."full"===r&&{isSuggestedQuestionsClosing:!1},...("string"==typeof o||null===o)&&{closingGreetingId:o},..."string"==typeof l&&{greetingAnimationState:l},..."boolean"==typeof c&&{deferred:c},autoExpanded:p,..."hidden"===r&&{isFocused:!1,autoExpanded:!1}}}),n.render&&(n.scheduledRender?setTimeout(()=>e.emit("render-minimized"),0):e.emit("render-minimized"))},Sm=(e,t)=>{const n=((e,t)=>{if(t.id===e.getSessionUser().serverId||"customer"===t.type){const e={id:t.id,type:"customer"};return t.name&&"Customer"!==t.name&&(e.name=t.name),t.email&&(e.email=t.email),t.phoneNumber&&(e.phoneNumber=t.phoneNumber),t.sessionFields&&(e.properties=t.sessionFields),e}return{id:t.id,type:t.type,name:t.name,avatar:t.avatar?`https://${f(t.avatar)}`:"",properties:{jobTitle:t.jobTitle,isBot:t.isBot||!1,...t.botType&&{botType:t.botType}}}})(e,t);if(e.getSessionUser().serverId!==n.id)return e.getUser(n.id)?n.properties?(n.properties.isBot&&e.updateUser(n.id,{properties:{isBot:!0}}),void(n.properties.botType&&e.updateUser(n.id,{properties:{botType:n.properties.botType}}))):void $g("no_parsed_user_properties",new Error,{meta:JSON.stringify({user:t,parsedUser:n})}):void e.addUser(n);e.updateUser(e.getSessionUserId(),ze(["name","email","phoneNumber","properties"],n))},Em=(e,t)=>{if(Bi(e,ci)&&Ga(e,"maximized"))return;if(t.properties.id!==e.getApplicationState("welcomeMessageId"))return;e.setApplicationState({disableSendingMessage:!1}),e.updateChat(ci,{properties:{agentActivity:null,awaitingWelcomeMessage:!1}});const n=ms(e)&&"questions_only"===e.getApplicationState("welcomeMessageScope")&&!Ga(e,"maximized"),r=!ma(e)&&(!Xi(e)||n);if(r){if(ms(e)){const t=Oi(e,ci);if(Da(e))return;t&&e.removeEvent(ci,t.id)}Tm(e,{...t,seen:!0}),e.updateChat(ci,{properties:{fakeAgentMessageId:t.id}})}const{quickReplies:i}=t.properties;r&&ms(e)&&(null==i?void 0:i.length)&&(e.setApplicationState({suggestedQuestions:{animation:{questionIndex:0,phase:"typing"}}}),e.emit("render-minimized"))},Am=(e,t,n)=>{"message"===t&&e.getApplicationState("readyState")!==Br&&((e,t)=>{const{author:n,timestamp:r,properties:{text:i}}=e.getEvent(ci,t),a=e.getUser(n),s=a.type,o={text:i,timestamp:Math.floor(r/1e3),user_type:"agent"===s?s:"visitor"};"agent"===s?(o.agent_name=a.name,o.agent_login=a.id):o.visitor_name=a.name,e.emit("on_message",o)})(e,n)},Tm=(e,t)=>{nh(e,ci,t),Am(e,t.properties.serverType,t.id)},Cm=e=>{const t=e.getApplicationState("isLargeWidget");e.setApplicationState({isLargeWidget:!t}),e.emit("resize-to-theme-size",{animated:!0})},zm=(e,t)=>{e.setApplicationState({minimizedMessageInput:{...e.getApplicationState("minimizedMessageInput"),isFocused:t}})},Dm=e=>{e.emit("resize-to-theme-size"),Im(e,{state:"full",autoExpanded:!0},{render:!0})},$m=e=>{e.setApplicationState({suggestedQuestionsAutoExpandDismissed:!0}),Im(e,{state:"classic",autoExpanded:!1},{render:!0})},Mm=()=>{const e=n(window.location.search);return parseInt((()=>{const e=String(window.location).match(/licen(?:s|c)e\/g?(\d+)/);return e?e[1]:null})()||e.license_id,10)},Fm=()=>n(window.location.search).organization_id||"",Pm=e=>{const t=parseInt(e,10);return t>-1?t:null},Rm=e=>"group"in e?Pm(e.group):"groups"in e?Pm(e.groups):null,Om=()=>"1"===nt("unique_groups",window.location.search)||"1"===nt("unique_group",window.location.search),Bm=function(e,t,n){var r;void 0===n&&(n={});const i=void 0!==n.name?n.name:(e=>{const{name:t}=e.getSessionUser();return t||e.localize("client")})(e),a=void 0!==n.agent?n.agent:(()=>{try{return(e=>{const t=xi(ci,e);if(!t)throw new Error("Current chat agent is undefined");if(!t.name)throw new Error("Current chat agent name is undefined");return t.name})(e)}catch{return""}})(),s=(null==(r=e.getSessionUser())?void 0:r.properties)||{};return t.replace(/%name%/g,i).replace(/%agent%/g,a).replace(/%customer-field\.([^%]+)%/g,(e,t)=>String(s[t]??""))},qm=e=>D(e)>.7,jm=e=>D(e)<=.179,Um=e=>{var t;return Boolean(null==(t=e.properties.license.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.messaging_in_queue_enabled)},Nm=e=>{var t;return Boolean(null==(t=e.properties.group.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.homescreen_enabled)},Lm=e=>{var t;return!1!==(null==(t=e.properties.group.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.minimized_input_enabled)},Vm=e=>{var t;return!1!==(null==(t=e.properties.group.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.mobile_minimized_input_enabled)},Gm=e=>{var t;return Boolean(null==(t=e.properties.license.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.utm_params_enabled)},Zm=e=>{var t;return Boolean(null==(t=e.properties.license.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.add_to_website_enabled)},Hm=e=>`https://${e}.${"api"===e?"livechatinc":"livechat"}.com`,Wm=()=>{const e=document.createElement("video"),t=document.createElement("canvas");return navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia?navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1}).then(t=>(e.srcObject=t,e.play())).then(()=>new Promise(e=>{setTimeout(e,150)})).then(()=>{t.width=e.videoWidth,t.height=e.videoHeight;t.getContext("2d").drawImage(e,0,0,e.videoWidth,e.videoHeight);const n=((e,t)=>{const[n,r]=e.split(","),i=n.match(/:(.*?);/)[1],a=atob(r);let s=a.length;const o=new Uint8Array(s);for(;s--;)o[s]=a.charCodeAt(s);return new File([o],t,{type:i})})(t.toDataURL("image/png"),"screenshot.png");return e.srcObject.getTracks().forEach(e=>e.stop()),n}):Promise.reject(new Error("Screen sharing is not supported"))},Ym=e=>jm(e)?E(.1,w(.1,e)):E(.2,y(.15,e));function Qm(e,t,n){if(e.startsWith(n))return e;const r=[e,t],i=JSON.stringify(r),a=btoa(i),s=new URL("/v1.0/t/link",n);return s.searchParams.set("d",a),s.toString()}function Jm(e){return"https://cdn.livechat-files.com/api/file/lc/main/default/logo/sz2tt7jpJ6VJwBo.png"===z(e)}const Xm=e=>{const{x:t,y:n,width:r,height:i}=e.target.getBoundingClientRect();return{x:t,y:n,width:r,height:i}},Km=(e,t)=>{const{name:n,email:r,phoneNumber:i,suggestedEmail:a}=ge(e=>"string"==typeof e?_(e):e,Ce(["email","name","phoneNumber","suggestedEmail"],e)),s={email:r||a,phone:i};return n===t("client")?s:{...s,name:n}},ef=e=>!!e&&(e=>{const t=st(e);return!t||"https:"===t||!1})(vt(e)),tf=e=>({id:e.id,name:e.title??"",text:e.description,icon:e.icon,action:{label:e.action.label,type:"button",value:e.action.url},properties:{}}),nf=(e,t)=>{var n,r,i,s;const o=Ii("logo",e),l=o.enabled?z(o.path):"",c=Ii("boosters",e),u=null==(n=c.items)?void 0:n.find(e=>It(e.id)),d=null==(r=c.items)?void 0:r.find(e=>xt(e.id)),p=null==(i=c.items)?void 0:i.find(e=>"links"===e.id),g=null==(s=e.getApplicationState("config").properties.license.feade1d6c3f17748ae4c8d917a1e1068)?void 0:s.hdLicenseID,h="number"==typeof g&&g>-1,m=e.getApplicationState("config").properties.group,f={apps:[],channels:[]};u&&f.apps.push({...tf(u),trademarkLink:"https://www.knowledgebase.com/?utm_source=chat_window&utm_medium=referral&utm_campaign=home_screen",trademarkLinkAnchor:"Powered by KnowledgeBase"}),d&&h&&(f.apps.push(tf(d)),e.on("send_helpdesk_form",n=>{t(n).then(t=>e.emit("send_helpdesk_form_success",t)).catch(t=>e.emit("send_helpdesk_form_error",t))}),e.addView("HelpdeskTicketForm",{isLoading:!0,hasFetchingError:!1})),a(m)||fe(Tt()).forEach(e=>{let[t,n]=e;const r=m[n];r&&f.channels.push({name:t,url:r.button_url_v2})}),e.addView("Homescreen",f),Gh(e,"livechatIntegration",{name:"livechat_integration",enabled:!0,properties:{organizationId:e.getApplicationState().organizationId}}),p&&Gh(e,"links",{enabled:!0,name:"links",properties:{links:p.links}}),e.setApplicationState({header:{text:"",logo:l,backgroundType:"gradient"}})},rf=(e,t)=>{let n;return r=>{const i=e(r);if(void 0===i)return n;const a=t(r,i);return n=a,a}},af=(e,t)=>document.referrer?f(r(document.referrer)||""):e?`lc${e}`:`orgId${t}`,sf={};function of(e,t){let{query:n={},jsonpParam:r="jsonp",callbackName:i}=void 0===t?{}:t;return new Promise((t,a)=>{Ye().then(s=>{const o=document.createElement("script"),l=i||we(sf);sf[l]=!0;const c=`__${l}`,u=window;u[c]=e=>{delete sf[l],delete u[c],Qe(o),t(e)},o.src=`${e}?${Ke({...n,[r]:c})}`,o.addEventListener("error",()=>{setTimeout(()=>{const e=new Error("JSONP request failed.");e.code="JSONP_REQUEST_FAILED",a(e)},100)}),s.appendChild(o)})})}const lf=/\.([a-z]{1,})$/i,cf=e=>{let{__priv:t}=e;const n={enabled:!0,x:parseInt(t.group["embedded_chat.eye_grabber.x"])+15,y:parseInt(t.group["embedded_chat.eye_grabber.y"]),src:z(t.group["embedded_chat.eye_grabber.path"])};if(-1!==n.src.indexOf("/default/eyeCatchers/")){const e=n.src.match(lf)[1];n.srcset={"1x":n.src,"2x":n.src.replace(new RegExp(`\\.${e}`,"i"),`-2x.${e}`)}}return n},uf=e=>({"x-region":e.region??""}),df=(e,t)=>`${(e=>{let{region:t}=e;return`https://api${(e=>"fra"===e||"eu-west3"===e?"-fra":"")(t)}.livechatinc.com`})(t)}/v3.6/customer/action/${e}`,pf=e=>{let{licenseId:t,organizationId:n}=e;return of(`https://api.livechatinc.com/global-mapper/${t?`lc_license_id/${t}`:`organization_id/${n}`}/region`,{callbackName:"lc_region"}).then(e=>e.region).catch(()=>{const e=new Error("Fetch region failed");throw e.code="FETCH_REGION_FAILED",e})},gf=["ACCESS_NOT_RESOLVED","CUSTOMER_BANNED","FETCH_REGION_FAILED","JSONP_REQUEST_FAILED"],hf=e=>{if(!gf.includes(null==e?void 0:e.code))throw e;console.warn(`[LiveChat] ${e.message}`)},mf=function(e,t){let{validateDefaultWidget:n=!0}=void 0===t?{}:t;return of(df("get_dynamic_configuration",e),{query:{...uf(e),...e.organizationId?{organization_id:e.organizationId}:{},...e.licenseId?{license_id:e.licenseId}:{},client_id:"c5e4f61e1a6c3b1521b541bc5c5a2ac5",url:lt(e.url,["cw_configurator","dev_language","dev_enable_textapp","dev_theme_variant","dev_theme_name","dev_minimized_type","dev_screen_position","dev_offset_x","dev_offset_y","dev_show_logo","dev_show_avatar","dev_sounds_enabled","dev_rating_enabled","dev_transcript_enabled","dev_company_logo_url","dev_agent_avatar_url"]),..."number"==typeof e.groupId&&{group_id:e.groupId},...e.channelType&&{channel_type:e.channelType},...e.skipCodeInstallationTracking&&{test:1},...e.productName&&{origin:e.productName},...e.integrationName&&{implementation_type:e.integrationName}}}).then(t=>{if(t.error)switch(t.error.type){case"misdirected_request":return mf({...e,region:t.error.data.region});case"license_not_found":{if("direct_link"===e.channelType){const t=Ke({utm_source:"expired_chat_link",utm_medium:"referral",utm_campaign:`lc_${e.licenseId}`});window.location.replace(`https://www.livechat.com/expired-chat-link/?${t}`)}const t=new Error("License not found");throw t.code="LICENSE_NOT_FOUND",t}default:{const e=new Error(t.error.message);throw e.code=t.error.type.toUpperCase(),e}}if(e.licenseId!==g&&e.organizationId!==Dr||(t.default_widget="livechat"),n&&"livechat"!==t.default_widget){const e=new Error(`The 'default_widget' is not 'livechat', but instead: '${t.default_widget}'`);throw e.code="DEFAULT_WIDGET_NOT_LIVECHAT",e.organizationId=t.organization_id,e.defaultWidget=t.default_widget,e}if(!t.livechat_active){if("direct_link"===e.channelType){const t=Ke({utm_source:"expired_chat_link",utm_medium:"referral",utm_campaign:`lc_${e.licenseId}`});window.location.replace(`https://www.livechat.com/expired-chat-link/?${t}`)}const t=new Error("License expired");throw t.code="LICENSE_EXPIRED",t}if(!t.livechat.domain_allowed){const e=new Error("Current domain is not added to the allowlist.");throw e.code="DOMAIN_NOT_ALLOWED",e}return r=t,i=e.region,{organizationId:r.organization_id,groupId:r.livechat.group_id,clientLimitExceeded:r.livechat.client_limit_exceeded,configVersion:r.livechat.config_version,localizationVersion:r.livechat.localization_version,onlineGroupIds:r.livechat.online_group_ids||[],region:i||null,language:r.livechat.language,aiAgentActive:r.livechat.ai_agent_active};var r,i})},ff=e=>{var t,n;const r="feade1d6c3f17748ae4c8d917a1e1068",i=Boolean(null==(t=e.properties.group[r])?void 0:t.forwardTicketFormToHelpdesk),a="1"===e.__priv.license["helpdesk.inbound_forwarding"],s=null==(n=e.properties.license[r])?void 0:n.hdLicenseID;return"number"==typeof s&&s>-1&&(i||a)},_f=(e,t)=>t.includes(e)?e:t[0],bf=(e,t)=>e,vf=e=>of(df("get_configuration",e),{callbackName:"lc_static_config",query:{organization_id:e.organizationId,version:e.version,...uf(e),..."number"==typeof e.groupId&&{group_id:e.groupId}}}).then(e=>(e=>{const t="1"===nt("enable_text",window.location.search)?(e=>({...e,__priv:{...e.__priv,enable_textapp:!0,group:{...e.__priv.group,"chat_window.new_theme.name":"smooth","chat_window.theme.minimized":"circle","chat_window.mobile_minimized_theme":"circle","embedded_chat.display_eye_catcher":"0"}}}))(e):e,{buttons:n,allowed_domains:r,prechat_form:i,ticket_form:a,__priv:s,properties:o,...l}=t,c=s.group,u=bf("boolean"==typeof s.enable_textapp?s.enable_textapp:void 0),d=bf(_f(c["chat_window.new_theme.name"],["smooth","modern"])),p=bf(_f(c["chat_window.new_theme.variant"],["light","dark"])),g=c["chat_window.new_theme.background_color"],h=bf(_f(c["chat_window.theme.minimized"],["circle","bar"])),m=bf("1"===c["chat_window.display_avatar"]),f=bf("0"===c["chat_window.disable_sounds"]),_=bf("1"===c["rate_me.enabled"]),b=bf("1"===c["chat_window.display_transcript_button"]),v=bf("1"===c["chat_window.display_logo"]),y=bf(c["chat_window.logo_path"]),w=bf(c.language),k=bf(_f(c["chat_window.screen_position"],["right","left"])),x=bf(parseInt(c["chat_window.offset_x"])),I=bf(parseInt(c["chat_window.offset_y"])),S="0"===s.group.tickets_enabled,E=!Boolean(s.disable_native_tickets)&&Boolean(a),A=ff(t),T=u?Boolean(a):S||A||E;return{...l,...i&&{prechatForm:up(i)},...T&&a&&{ticketForm:up(a)},properties:o,buttons:n.map(e=>"image"===e.type?{id:e.id,type:e.type,onlineValue:z(e.online_value),offlineValue:z(e.offline_value)}:{id:e.id,type:e.type,onlineValue:e.online_value,offlineValue:e.offline_value}),...r&&{allowedDomains:r},__unsafeProperties:{...s.s&&{s:!0},..."boolean"==typeof u?{enableTextApp:u}:{},group:{chatBoosters:s.group.chat_boosters,disabledMinimized:"1"===s.group["chat_window.disable_minimized"],disabledMinimizedOnMobile:"1"===s.group["chat_window.mobile_disable_minimized"],disabledOnMobile:"1"===s.group["chat_window.hide_on_mobile"],eyeCatcher:"1"===s.group["embedded_chat.display_eye_catcher"]?cf(t):{enabled:!1},hasAgentAvatarsEnabled:m,hasCustomMobileSettings:"1"===s.group["chat_window.custom_mobile_settings"],hasHiddenTrademark:"1"===s.group["chat_window.hide_trademark"],hasSoundsEnabled:f,initiallyHidden:"1"===s.group["chat_window.hide_on_init"]||"1"===s.group["chat_window.disable_minimized"],initiallyHiddenOnMobile:"1"===s.group["chat_window.mobile_hide_on_init"]||"1"===s.group["chat_window.mobile_disable_minimized"],hideOnInit:"1"===s.group["chat_window.hide_on_init"],language:w,linksUnfurlingEnabled:"1"===s.group.links_unfurling,privacyPolicy:{enabled:"1"===s.group["privacy_policy.enabled"],text:s.group["privacy_policy.text"]},logo:v?{enabled:!0,src:y}:{enabled:!1},minimizedType:h,minimizedTypeOnMobile:s.group["chat_window.mobile_minimized_theme"],offlineMessagesEnabled:S,offsetX:x,offsetXOnMobile:parseInt(s.group["chat_window.mobile_offset_x"]),offsetY:I,offsetYOnMobile:parseInt(s.group["chat_window.mobile_offset_y"]),prechatFormAfterGreetingEnabled:"1"===s.group.pre_chat_survey_after_greeting,ratingEnabled:_,screenPosition:k,screenPositionOnMobile:_f(s.group["chat_window.mobile_screen_position"],["right","left"]),transcriptButtonEnabled:b,theme:{name:d,variant:p,customJson:s.group["chat_window.new_theme.custom_json"],agentbarBackgroundColor:s.group["chat_window.new_theme.agentbar_background_color"],agentbarText:s.group["chat_window.new_theme.agentbar_text"],agentMessageColorBackground:s.group["chat_window.new_theme.agent_message_color_background"],agentMessageColorText:s.group["chat_window.new_theme.agent_message_color_text"],backgroundColor:g,ctaColor:s.group["chat_window.new_theme.cta_color"],minimizedColorBackground:s.group["chat_window.new_theme.minimized_color_background"],minimizedColorIcon:s.group["chat_window.new_theme.minimized_color_icon"],minimizedColorText:s.group["chat_window.new_theme.minimized_color_text"],systemMessageColor:s.group["chat_window.new_theme.system_message_color"],titlebarBackgroundColor:s.group["chat_window.new_theme.titlebar_background_color"],titlebarText:s.group["chat_window.new_theme.titlebar_text"],visitorMessageColorBackground:s.group["chat_window.new_theme.visitor_message_color_background"],visitorMessageColorText:s.group["chat_window.new_theme.visitor_message_color_text"]}},license:{creditCardMaskingEnabled:"1"===s.license.mask_credit_cards,nonProfit:"1"===s.license.non_profit,licenseinboundForwardingToHelpdeskEnabled:"1"===s.license["helpdesk.inbound_forwarding"]},helpdeskIntegrationEnabled:A,ticketFormMode:(C=t,D=Boolean(u),void 0===D&&(D=Boolean(C.__priv.enable_textapp)),D?"1"===C.__priv.group.tickets_enabled?"helpdesk":"offline_message":ff(C)?"helpdesk":"0"===C.__priv.group.tickets_enabled?"offline_message":"livechat")}};var C,D})(e)),yf=e=>of(df("get_localization",e),{callbackName:"lc_localization",query:{organization_id:e.organizationId,version:e.version,language:e.language,...uf(e),..."number"==typeof e.groupId&&{group_id:e.groupId}}}).then(e=>Se(e=>e.toLowerCase(),e));export{as as $,Ml as A,vi as B,Er as C,fe as D,qr as E,no as F,Xs as G,Zs as H,qo as I,dn as J,lo as K,ci as L,Oo as M,su as N,Fr as O,Og as P,$i as Q,Cr as R,zr as S,ha as T,Si as U,jg as V,Om as W,Ei as X,Ri as Y,xa as Z,Ie as _,Mg as a,_h as a$,ds as a0,Pg as a1,ge as a2,oo as a3,Bs as a4,js as a5,Ho as a6,Ne as a7,Im as a8,me as a9,Mh as aA,Xi as aB,dm as aC,Fh as aD,pn as aE,Fg as aF,Va as aG,ah as aH,uh as aI,ph as aJ,Mm as aK,Rm as aL,jr as aM,Je as aN,We as aO,Qe as aP,nt as aQ,Fi as aR,Hg as aS,Me as aT,ke as aU,jc as aV,xi as aW,Ki as aX,Bm as aY,bs as aZ,Pi as a_,Zt as aa,Br as ab,Gg as ac,Vg as ad,hf as ae,ze as af,we as ag,$l as ah,Es as ai,gs as aj,Wo as ak,bi as al,Ca as am,Ii as an,_s as ao,Ds as ap,ml as aq,hl as ar,pl as as,Dm as at,ll as au,Ts as av,Da as aw,zs as ax,En as ay,is as az,Et as b,Sr as b$,bh as b0,Qg as b1,Ye as b2,Np as b3,Zh as b4,nf as b5,oa as b6,St as b7,Ve as b8,Fn as b9,en as bA,qn as bB,lr as bC,xe as bD,Vn as bE,mr as bF,pr as bG,gr as bH,ar as bI,tr as bJ,er as bK,Kn as bL,Ee as bM,hr as bN,zn as bO,Yn as bP,ir as bQ,Hn as bR,gn as bS,qe as bT,Ae as bU,mn as bV,_e as bW,Un as bX,jn as bY,Cn as bZ,Bn as b_,fr as ba,dr as bb,ur as bc,br as bd,Ir as be,_r as bf,xr as bg,wr as bh,vr as bi,Qn as bj,Kt as bk,Wn as bl,cr as bm,nn as bn,or as bo,Tn as bp,sr as bq,kr as br,yr as bs,rr as bt,nr as bu,Xn as bv,Jn as bw,fn as bx,sn as by,tn as bz,he as c,To as c$,Sg as c0,Zo as c1,xd as c2,qm as c3,sh as c4,Jo as c5,ch as c6,Kh as c7,Vi as c8,Nt as c9,La as cA,Cs as cB,Ha as cC,da as cD,No as cE,qc as cF,vm as cG,xt as cH,Qm as cI,ho as cJ,po as cK,uo as cL,yo as cM,wo as cN,xo as cO,vo as cP,_o as cQ,fo as cR,bo as cS,ko as cT,mo as cU,Do as cV,$o as cW,Fo as cX,Mo as cY,Eo as cZ,Ao as c_,Gt as ca,Ms as cb,tt as cc,_l as cd,xc as ce,st as cf,os as cg,Yo as ch,Qo as ci,Ji as cj,Ke as ck,mi as cl,Xm as cm,Xh as cn,fi as co,Ya as cp,vt as cq,yt as cr,it as cs,em as ct,tm as cu,xh as cv,Za as cw,Ph as cx,Ih as cy,ki as cz,ot as d,rh as d$,zo as d0,Co as d1,Ka as d2,mm as d3,es as d4,bl as d5,vl as d6,wl as d7,yl as d8,kl as d9,Wi as dA,za as dB,qg as dC,yh as dD,dh as dE,cl as dF,ul as dG,dl as dH,Dl as dI,Sl as dJ,Al as dK,Cl as dL,zl as dM,Tl as dN,El as dO,Hi as dP,ps as dQ,ba as dR,ya as dS,pm as dT,iu as dU,Na as dV,Yt as dW,Vo as dX,Ja as dY,zh as dZ,Qa as d_,Il as da,xl as db,Fe as dc,al as dd,ol as de,Xo as df,Ko as dg,el as dh,um as di,$m as dj,il as dk,rl as dl,As as dm,tl as dn,hs as dp,nl as dq,zm as dr,fh as ds,Uo as dt,gh as du,sl as dv,fl as dw,xm as dx,pg as dy,gl as dz,Gh as e,cu as e$,va as e0,wa as e1,Li as e2,qh as e3,yi as e4,Dh as e5,Oh as e6,Go as e7,Ea as e8,Pa as e9,Ai as eA,ls as eB,Km as eC,wi as eD,ui as eE,Ni as eF,$a as eG,na as eH,Ce as eI,Zr as eJ,Gr as eK,ks as eL,Qr as eM,Th as eN,Eh as eO,Ah as eP,oh as eQ,lh as eR,Ip as eS,rf as eT,Ba as eU,Di as eV,Wm as eW,Sa as eX,Re as eY,gu as eZ,pu as e_,ts as ea,Is as eb,ws as ec,vs as ed,Zi as ee,di as ef,Jt as eg,ss as eh,af as ei,us as ej,Ur as ek,rs as el,sa as em,aa as en,fa as eo,Fa as ep,ns as eq,Jm as er,ta as es,Cm as et,pa as eu,$r as ev,ua as ew,la as ex,De as ey,It as ez,Bo as f,gi as f$,ou as f0,uu as f1,$u as f2,yd as f3,Fu as f4,Mu as f5,fu as f6,Tu as f7,Uu as f8,jd as f9,Nu as fA,qu as fB,Ru as fC,Pu as fD,zu as fE,Cu as fF,Eu as fG,Iu as fH,xu as fI,ku as fJ,yu as fK,vu as fL,bu as fM,_u as fN,mu as fO,hu as fP,Ar as fQ,ra as fR,Ss as fS,jh as fT,nm as fU,Ui as fV,vh as fW,nh as fX,im as fY,Tm as fZ,pi as f_,Yu as fa,vd as fb,Su as fc,ad as fd,Gu as fe,sd as ff,wu as fg,wd as fh,md as fi,bd as fj,_d as fk,ud as fl,id as fm,Qu as fn,hd as fo,pd as fp,Bu as fq,Du as fr,wp as fs,yp as ft,vp as fu,Vu as fv,ju as fw,Ou as fx,Au as fy,Lu as fz,Hm as g,co as g$,pe as g0,am as g1,om as g2,Rh as g3,wh as g4,ih as g5,Bh as g6,cg as g7,km as g8,Qp as g9,ag as gA,qp as gB,zi as gC,Ci as gD,gm as gE,Bg as gF,Tr as gG,lg as gH,Qi as gI,ng as gJ,tg as gK,ti as gL,rg as gM,tu as gN,dg as gO,Cp as gP,yg as gQ,Hh as gR,mg as gS,Vh as gT,fg as gU,cm as gV,Tp as gW,Ap as gX,zp as gY,lm as gZ,Up as g_,ga,Qh as gb,Uh as gc,hi as gd,Rg as ge,bg as gf,_g as gg,vg as gh,Oi as gi,Am as gj,og as gk,ve as gl,Sm as gm,mh as gn,Yh as go,Wh as gp,ji as gq,Yi as gr,ca as gs,Oa as gt,Bi as gu,sm as gv,ma as gw,ja as gx,Ch as gy,qi as gz,to as h,cs as h0,sg as h1,Em as h2,Us as h3,fs as h4,Ta as h5,_i as h6,Zp as h7,Hp as h8,jp as h9,Fs as ha,Rp as hb,Nr as hc,Uc as hd,Nc as he,Lr as hf,Vr as hg,bm as i,Ga as j,Pl as k,$g as l,Se as m,_m as n,pf as o,Ys as p,mf as q,vf as r,Ps as s,yf as t,de as u,Te as v,Lh as w,fm as x,Nh as y,ql as z};