@wexio/messenger-widget-react 1.7.4 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/widget-react.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/widget-react.js
CHANGED
|
@@ -86,7 +86,7 @@ globalThis.process===void 0&&(globalThis.process={env:{},nextTick:function(e){se
|
|
|
86
86
|
`),d=[...t.truncated?[a(`truncated`)]:[],a(`exported`,{org:n,when:Ai(o,r,i)})].join(`
|
|
87
87
|
`);return`${u}\n\n---\n\n${s.join(`
|
|
88
88
|
|
|
89
|
-
`)}\n\n---\n${d}\n`}function Ni(e){return e?`wexio:news-last-read:${e}`:`wexio:news-last-read`}function Pi(e,t){return e?e!==t:!1}function Fi({enabled:e,locale:t}){let n=I(),r=n.publicKey,i=n.storage,{data:a}=tn({variables:{args:{locale:t,limit:1}},skip:!e}),o=a?.visitorNewsList?.items?.[0]?._id??null,[s,c]=Y(null);K(()=>{if(!(typeof window>`u`))try{c(i.getItem(Ni(r)))}catch{c(null)}},[r,i]);let l=G(()=>{if(o){c(o);try{i.setItem(Ni(r),o)}catch{}}},[o,r,i]);return{hasUnread:e&&Pi(o,s),markRead:l}}var Ii=class extends Error{constructor(e=`permanent outbox failure`){super(e),this.name=`PermanentOpError`}},Li=`wexio-outbox`,Ri=`queues`,zi=1;function Bi(e,t){return[...e.filter(e=>!(e.clientKey===t.clientKey||t.semantics===`convergence`&&t.convergenceKey!==void 0&&e.semantics===`convergence`&&e.convergenceKey===t.convergenceKey)),t]}function Vi(e,t,n){return e.map(e=>e.clientKey===t?{...e,...n}:e)}function Hi(e,t){return e.filter(e=>e.clientKey!==t)}function Ui(e,t){let n=e.filter(e=>!(e.semantics===`beacon`&&e.expiresAt!=null&&e.expiresAt<=t));return n.length===e.length?e:n}function Wi(e){return e.filter(e=>e.status!==`sending`).sort((e,t)=>e.createdAt-t.createdAt)}function Gi(e){return e.filter(e=>e.semantics!==`beacon`)}function Ki(e){return Math.min(6e4,2e3*2**Math.max(0,e-1))}function qi(e){return!!e&&typeof e==`object`&&typeof e.clientKey==`string`&&typeof e.op==`string`&&typeof e.createdAt==`number`}function Ji(){let e=new Map;return{load:t=>Promise.resolve((e.get(t)??[]).filter(qi)),save:(t,n)=>(n.length===0?e.delete(t):e.set(t,n),Promise.resolve())}}function Yi(){return typeof indexedDB>`u`?Promise.resolve(null):new Promise(e=>{let t;try{t=indexedDB.open(Li,zi)}catch{e(null);return}t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(Ri)||e.createObjectStore(Ri)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)})}async function Xi(e){if(!e)return[];let t=await Yi();return t?new Promise(n=>{try{let r=t.transaction(Ri,`readonly`).objectStore(Ri).get(e);r.onsuccess=()=>{let e=r.result;n(Array.isArray(e)?e.filter(qi):[])},r.onerror=()=>n([])}catch{n([])}}):[]}async function Zi(e,t){if(!e)return;let n=await Yi();if(n)return new Promise(r=>{try{let i=n.transaction(Ri,`readwrite`),a=i.objectStore(Ri);t.length===0?a.delete(e):a.put(t,e),i.oncomplete=()=>r(),i.onerror=()=>r(),i.onabort=()=>r()}catch{r()}})}var Qi={load:Xi,save:Zi};function $i(){return typeof indexedDB>`u`?Ji():Qi}function ea(e,t=$i(),n={}){let r=[],i=!1,a=new Set,o=()=>{for(let e of a)e(r)},s=(n.crossTab??!0)&&typeof BroadcastChannel<`u`?new BroadcastChannel(`${Li}:${e}`):null;return s&&(s.onmessage=async()=>{r=await t.load(e),o()}),{get:()=>r,set:n=>{i=!0,r=n,t.save(e,Gi(n)),s?.postMessage(`changed`),o()},subscribe:e=>(a.add(e),()=>a.delete(e)),ready:t.load(e).then(e=>{if(!i&&e.length>0){let t=Date.now();r=e.map(e=>e.status===`sending`&&(e.sendingSince===void 0||e.sendingSince>t||t-e.sendingSince>12e4)?{...e,status:`queued`}:e),o()}}),dispose:()=>{a.clear(),s?.close()}}}function ta(){try{if(typeof crypto<`u`&&`randomUUID`in crypto)return crypto.randomUUID()}catch{}return`ck-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function na(){return typeof navigator<`u`&&!navigator.onLine}function ra({publicKey:e,enabled:t,isolated:n=!1,paused:r=!1,run:i,onSent:a,isPermanent:o,onDropped:s}){let[c,l]=Y([]),[u,d]=Y(typeof navigator>`u`?!0:navigator.onLine),f=J(i),p=J(a),m=J(o),h=J(s);K(()=>{f.current=i,p.current=a,m.current=o,h.current=s});let g=J(null),_=J(!1),v=J(r);v.current=r;let y=J(null),b=J(()=>{});b.current=G(()=>{let e=g.current;!e||_.current||na()||v.current||(_.current=!0,(async()=>{try{for(;!(na()||v.current);){let t=Date.now(),n=Ui(e.get(),t);n!==e.get()&&e.set(n);let r=Wi(e.get()),i=r.find(e=>(e.nextAttemptAt??0)<=t);if(!i){let e=r.reduce((e,t)=>Math.min(e,t.nextAttemptAt??0),1/0);e!==1/0&&e>t&&(y.current&&clearTimeout(y.current),y.current=setTimeout(()=>b.current(),e-t));break}e.set(Vi(e.get(),i.clientKey,{status:`sending`,sendingSince:Date.now()}));try{let t=await f.current(i,{patch:t=>e.set(Vi(e.get(),i.clientKey,{payload:t}))});p.current(i,t),e.set(Hi(e.get(),i.clientKey))}catch(t){if(t instanceof Ii||m.current?.(t)===!0)e.set(Hi(e.get(),i.clientKey)),h.current?.(i,t);else{let t=i.attempts+1;e.set(Vi(e.get(),i.clientKey,{status:`failed`,attempts:t,nextAttemptAt:Date.now()+Ki(t)}))}}}}finally{_.current=!1}})())},[]),K(()=>{if(!t||!e){l([]);return}let r=n?ea(e,Ji(),{crossTab:!1}):ea(e);g.current=r,l(r.get());let i=r.subscribe(e=>l(e));return r.ready.then(()=>{l(r.get()),b.current()}),()=>{i(),r.dispose(),g.current=null}},[t,e,n]);let x=J(r);return K(()=>{let e=x.current;if(x.current=r,r||!e)return;y.current&&clearTimeout(y.current);let t=g.current;if(t){let e=t.get().map(e=>({...e,nextAttemptAt:0}));e.length>0&&t.set(e)}b.current()},[r]),K(()=>{if(typeof window>`u`)return;let e=()=>{d(!0),y.current&&clearTimeout(y.current);let e=g.current;if(e){let t=e.get().map(e=>({...e,nextAttemptAt:0}));t.length>0&&e.set(t)}b.current()},t=()=>d(!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,t),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,t)}},[]),K(()=>()=>{y.current&&clearTimeout(y.current)},[]),{ops:c,online:u,enqueue:G(e=>{let t={clientKey:ta(),op:e.op,semantics:e.semantics,...e.convergenceKey===void 0?{}:{convergenceKey:e.convergenceKey},payload:e.payload,createdAt:Date.now(),status:`queued`,attempts:0,...e.semantics===`beacon`&&e.ttlMs!==void 0?{expiresAt:Date.now()+e.ttlMs}:{}},n=g.current;return n&&(n.set(Bi(n.get(),t)),b.current()),t},[]),retry:G(e=>{let t=g.current;t&&(y.current&&clearTimeout(y.current),t.set(Vi(t.get(),e,{status:`queued`,attempts:0,nextAttemptAt:0})),b.current())},[]),discard:G(e=>{let t=g.current;t&&t.set(Hi(t.get(),e))},[]),clear:G(()=>{y.current&&clearTimeout(y.current);let t=g.current;t?t.set([]):e&&Zi(e,[])},[e])}}Array.from({length:21},(e,t)=>`wx-nt_${t+1}`);var ia=`wx-nt_`;function aa(e){return e?e.startsWith(`http://`)||e.startsWith(`https://`)?e:e.startsWith(ia)?O(`/sounds/${e}.mp3`):null:null}var oa=`wexio:sound-muted`;function sa(e){let t=I().storage,[n,r]=Y(!1),i=J(null),a=J(null);K(()=>{typeof window>`u`||r(t.getItem(oa)===`1`)},[t]),K(()=>{if(typeof window>`u`)return;i.current?.pause(),a.current?.pause();let t=aa(e?.inboundSoundId),n=aa(e?.outboundSoundId),r=typeof e?.volume==`number`?Math.max(0,Math.min(1,e.volume)):.5;return i.current=t?ca(t,r):null,a.current=n?ca(n,r):null,()=>{i.current?.pause(),a.current?.pause()}},[e]);let o=G(()=>{r(e=>{let n=!e;try{t.setItem(oa,n?`1`:`0`)}catch{}return n})},[t]),s=G(t=>{if(n||e&&e.enabled===!1)return;let r=t===`inbound`?i.current:a.current;r&&(r.currentTime=0,r.play().catch(()=>{}))},[n,e]);return{muted:n,toggleMuted:o,playInbound:()=>s(`inbound`),playOutbound:()=>s(`outbound`)}}function ca(e,t){let n=new Audio;return n.preload=`none`,n.volume=t,n.src=e,n}function la(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>Object.hasOwn(t,n)&&la(e[n],t[n])):!1}function ua(e){let t=J(void 0),n=J(!1);return(!n.current||!la(t.current,e))&&(t.current=e,n.current=!0),t.current}function da(e,t){let[n,r]=Y(`dark`),i=Te(),a=i.themeRoot,o=i.themeOverride,s=i.kind,c=I().storage;return K(()=>{let n=new URL(window.location.href).searchParams.get(`theme`),i=e&&fa(e)?e:null,l=t?.allowed!==!1,u=t?.preference&&fa(t.preference)?t.preference:null,d=(()=>{if(!l)return null;try{let e=c.getItem(`wexio:theme`);return e&&fa(e)?e:null}catch{return null}})(),f=()=>{if(o&&fa(o))return o;if(n&&fa(n))return n;if(l){if(u&&u!==`auto`)return u;if(d&&d!==`auto`&&!u)return d}return i&&i!==`auto`?i:`auto`};if(l&&u)try{c.setItem(`wexio:theme`,u)}catch{}let p=f(),m=a??document.documentElement,h=()=>{let e=p===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:p;m.dataset.theme=e,r(e)};h();let g=window.matchMedia(`(prefers-color-scheme: dark)`),_=()=>p===`auto`&&h();g.addEventListener?.(`change`,_);let v=e=>{if(!gt(e,s)||!e.data||typeof e.data!=`object`||e.data.type!==`wexio:preview-theme-mode:v1`&&e.data.type!==`wexio:theme:v1`)return;let t=e.data.mode;t&&fa(t)&&(p=t,h())};return window.addEventListener(`message`,v),()=>{g.removeEventListener?.(`change`,_),window.removeEventListener(`message`,v)}},[e,a,o,s,t?.preference,t?.allowed,c]),n}function fa(e){return e===`light`||e===`dark`||e===`auto`}function pa({enabled:e,refetch:t,onSettled:n}){let r=J(e),i=J(t),a=J(n),o=J(!1);K(()=>{r.current=e,i.current=t,a.current=n});let s=G(async()=>{if(!r.current||o.current)return;o.current=!0;let e=Date.now();try{await i.current(),a.current(e)}catch{}finally{o.current=!1}},[]);return K(()=>{if(!e||typeof window>`u`)return;let t=()=>void s(),n=()=>{document.hidden||s()};return window.addEventListener(`online`,t),document.addEventListener(`visibilitychange`,n),()=>{window.removeEventListener(`online`,t),document.removeEventListener(`visibilitychange`,n)}},[e,s]),s}var ma=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,ha=`wexio-turnstile-script`,ga=null;function _a(){return typeof window>`u`?Promise.reject(Error(`turnstile: no window`)):window.turnstile?Promise.resolve():ga||(ga=new Promise((e,t)=>{let n=document.getElementById(ha);if(n){if(window.turnstile)return e();n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,()=>t(Error(`turnstile: script load error`)),{once:!0});return}let r=document.createElement(`script`);r.id=ha,r.src=ma,r.async=!0,r.defer=!0,r.addEventListener(`load`,()=>e(),{once:!0}),r.addEventListener(`error`,()=>{r.remove(),t(Error(`turnstile: script load error`))},{once:!0}),document.head.appendChild(r)}).catch(e=>{throw ga=null,e}),ga)}function va(e){let{siteKey:t,theme:n,position:r=`right`}=e,i=J(null),a=J(n);return K(()=>{a.current=n},[n]),K(()=>{if(typeof document>`u`)return;let e=document.createElement(`div`);return e.style.position=`fixed`,e.style.bottom=`88px`,r===`left`?e.style.left=`16px`:e.style.right=`16px`,e.style.zIndex=`60`,document.body.appendChild(e),i.current=e,()=>{e.remove(),i.current=null}},[r]),{getToken:G(async()=>{if(!t)return;await _a();let e=i.current,n=typeof window<`u`?window.turnstile:void 0;if(!e||!n)throw Error(`turnstile: not ready`);return new Promise((r,i)=>{let a=n.render(e,{sitekey:t,execution:`render`,appearance:`interaction-only`,retry:`auto`,"refresh-expired":`auto`,callback:e=>{r(e);try{n.remove(a)}catch{}},"error-callback":()=>{try{n.remove(a)}catch{}i(Error(`turnstile: error`))},"expired-callback":()=>{try{n.remove(a)}catch{}i(Error(`turnstile: expired before submission`))},"timeout-callback":()=>{try{n.remove(a)}catch{}i(Error(`turnstile: timeout`))}})})},[t])}}function ya(e,t){if(typeof window>`u`)return`en`;if(!t?.ignoreVisitorOverrides){let e=xa(new URL(window.location.href).searchParams.get(`lang`));if(e)return e;let t=xa(Sa(`wexio-locale`));if(t)return t}if(e&&e!==`AUTO`&&e!==`WEBSITE`){let t=xa(e);if(t)return t}else if(e===`WEBSITE`){let e=xa(document.documentElement.lang);if(e)return e}return xa(navigator.language)||`en`}var ba=new Map(y.map(e=>[e.toLowerCase(),e]));function xa(e){if(!e)return null;let t=e.toLowerCase().replace(/_/g,`-`),n=ba.get(t);if(n)return n;let r=t.split(`-`)[0];return ba.get(r)??null}function Sa(e){let t=document.cookie.split(`;`);for(let n of t){let[t,...r]=n.trim().split(`=`);if(t===e)return decodeURIComponent(r.join(`=`))}return null}var Ca=2147483647,wa=5e3,Ta=6e4,Ea=15*6e4;function Da(e,t,n){let r=(e,t=Ea)=>({delayMs:Math.min(t,e*2**Math.min(n,10)),streak:n+1});if(typeof e!=`number`||!Number.isFinite(e)||e<=0)return r(Ta);let i=(e-t)*1e3;return i<wa?r(wa,Math.min(Ea,Math.max(wa,e*1e3-wa))):{delayMs:Math.min(Ca,i),streak:0}}var Oa=`network_unreachable`,ka=`preview_visitor_limit`;function Aa(e){if(!e||typeof e!=`object`)return!1;let t=e;if(Array.isArray(t.graphQLErrors)&&t.graphQLErrors.length>0)return!1;if(t.networkError)return!0;let n=typeof t.message==`string`?t.message:``;return/failed to fetch|networkerror|network request failed|load failed|err_|fetch/i.test(n)}var ja=e=>e?`wexio:visitor-id:${e}`:`wexio:visitor-id`,Ma=e=>e?`wexio:visitor-session:${e}`:`wexio:visitor-session`,Na=`wexio:visitor-id`,Pa=`wexio:visitor-session`;function Fa(e,t=ae(),n=ve(`local`)){if(!(typeof window>`u`))try{let r={token:e.token,chatId:e.chatId,peopleId:e.peopleId,displayName:e.displayName,expiresAt:Date.now()+e.expiresIn*1e3};n.setItem(Ma(t),JSON.stringify(r))}catch{}}function Ia(e,t){if(typeof window>`u`)return null;try{let n=t.getItem(Ma(e));if(!n&&e){let r=t.getItem(Pa);r&&(t.setItem(Ma(e),r),t.removeItem(Pa),n=r)}if(!n)return null;let r=JSON.parse(n);return typeof r?.token!=`string`||typeof r?.expiresAt!=`number`||r.expiresAt-Ra*1e3<=Date.now()?(t.removeItem(Ma(e)),null):r}catch{return null}}function La(e,t){if(!(typeof window>`u`))try{t.removeItem(Ma(e)),t.removeItem(Pa)}catch{}}var Ra=30,za=120,Ba=3e4,Va=`wexio:prechat-submitted:`;function Ha(e=ee()){e.token=null;let t=e.publicKey,n=e.storage;if(La(t,n),!(typeof window>`u`))try{n.removeItem(ja(t)),n.removeItem(Na);for(let e=n.length-1;e>=0;e--){let t=n.key(e);t?.startsWith(Va)&&n.removeItem(t)}}catch{}}function Ua(e){let[t,n]=Y({token:null,chatId:null,peopleId:null,displayName:null,isAuthenticating:e.enabled,error:null,verified:!1,blocked:!1}),r=I(),{token:i,holding:a}=Ce(),o=e.enabled&&!a,[s,c]=Y(i);s!==i&&(c(i),r.token=null,n({token:null,chatId:null,peopleId:null,displayName:null,isAuthenticating:o,error:null,verified:!1,blocked:!1}));let[l]=Be(),[u]=We(),d=J(e.identity??null);d.current=i?null:e.identity??null;let f=J(e.getTurnstileToken);f.current=e.getTurnstileToken;let p=J(null),m=J(!1),h=J(0),g=J(0),_=G(async e=>{if(r.preview.paused){n(e=>({...e,isAuthenticating:!1}));return}if(m.current){n(e=>({...e,isAuthenticating:!1,error:ka}));return}n(e=>({...e,isAuthenticating:!0,error:null}));try{let t=Ga(r.publicKey,r.storage),i=r.preview.active?null:d.current,a=ya(),o;try{o=await f.current?.()??void 0}catch(t){if(e.current)return;n(e=>({...e,isAuthenticating:!1,error:`turnstile_failed:${t.message}`}));return}if(e.current)return;let s;if(i&&(i.googleIdToken||i.jwt||i.userId&&i.userHash)){let n=await u({variables:{input:{visitorId:t,...i.googleIdToken?{googleIdToken:i.googleIdToken}:i.jwt?{jwt:i.jwt}:{userId:i.userId,userHash:i.userHash},name:i.name,email:i.email,phone:i.phone,contextSnapshot:JSON.stringify({...i.attributes&&typeof i.attributes==`object`?i.attributes:{},locale:a}),turnstileToken:o}}});if(e.current)return;s=n.data?.startIdentifiedVisitor}else{let n=await l({variables:{input:{visitorId:t,turnstileToken:o,contextSnapshot:JSON.stringify({locale:a})}}});if(e.current)return;s=n.data?.startAnonymousVisitor}if(!s&&r.preview.paused){n(e=>({...e,isAuthenticating:!1,error:null}));return}if(!s){n(e=>({...e,isAuthenticating:!1,error:`handshake_empty_response`}));return}if(s.visitorId&&s.visitorId!==t)try{r.storage.setItem(ja(r.publicKey),s.visitorId)}catch{}r.token=s.token,n({token:s.token,chatId:s.chatId,peopleId:s.peopleId,displayName:s.displayName,isAuthenticating:!1,error:null,verified:s.kind===`identified`,blocked:s.blocked??!1}),s.kind===`identified`?Fa({token:s.token,chatId:s.chatId,peopleId:s.peopleId,displayName:s.displayName,expiresIn:s.expiresIn},r.publicKey,r.storage):La(r.publicKey,r.storage);let c=Da(s.expiresIn,Ra,h.current);h.current=c.streak;let m=c.delayMs;r.preview.active&&typeof s.expiresIn==`number`&&s.expiresIn<za&&(r.preview.requestRefresh(),m=Math.max(Ba,m)),p.current&&clearTimeout(p.current),g.current=Date.now()+m,p.current=setTimeout(()=>{e.current||_(e)},m)}catch(t){if(e.current)return;if(be(t,Ot.previewVisitorLimit)){m.current=!0,n({token:null,chatId:null,peopleId:null,displayName:null,isAuthenticating:!1,error:ka,verified:!1,blocked:!1});return}let i=r.preview.paused;n({token:null,chatId:null,peopleId:null,displayName:null,isAuthenticating:!1,error:i?null:Aa(t)?Oa:t.message,verified:!1,blocked:!1})}},[l,u,r]),v=i?null:e.identity,y=v?.googleIdToken?`google:${v.googleIdToken}`:v?.jwt?`jwt:${v.jwt}`:v?.userId&&v?.userHash?`${v.userId}:${v.userHash}`:null,b=J(e.epoch);return K(()=>{b.current!==e.epoch&&(b.current=e.epoch,h.current=0,r.token=null,n({token:null,chatId:null,peopleId:null,displayName:null,isAuthenticating:o,error:null,verified:!1,blocked:!1}))},[e.epoch,o,r]),K(()=>{if(!o){n(e=>({...e,isAuthenticating:!1}));return}if(typeof window>`u`)return;let e={current:!1};h.current=0;let t=d.current||i?null:Ia(r.publicKey,r.storage);if(t){r.token=t.token,n({token:t.token,chatId:t.chatId,peopleId:t.peopleId,displayName:t.displayName,isAuthenticating:!1,error:null,verified:!0,blocked:!1});let i=Math.min(Ca,Math.max(0,t.expiresAt-Date.now()));g.current=t.expiresAt,p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{e.current||(La(r.publicKey,r.storage),_(e))},i)}else _(e);let a=()=>{e.current||typeof document>`u`||document.hidden||g.current!==0&&Date.now()>=g.current&&_(e)};return document.addEventListener(`visibilitychange`,a),()=>{e.current=!0,document.removeEventListener(`visibilitychange`,a),p.current&&(clearTimeout(p.current),p.current=null)}},[o,_,y,e.epoch,r,i]),K(()=>{if(!o||typeof window>`u`)return;let e=!1,t={current:!1};return r.onUnauthorized=()=>{e||(e=!0,La(r.publicKey,r.storage),r.token=null,_(t).finally(()=>{e=!1}))},r.onIntegrationMismatch=()=>{if(!e){e=!0,La(r.publicKey,r.storage),r.token=null;try{let e=r.publicKey;r.storage.removeItem(ja(e))}catch{}_(t).finally(()=>{e=!1})}},()=>{t.current=!0,r.onUnauthorized=null,r.onIntegrationMismatch=null}},[o,e.epoch,_,r]),t}function Wa(e){let[t,n]=Y({identity:null,prefill:null});return K(()=>{if(e.visitorIdentity||e.visitorPrefill||typeof window>`u`)return;let t=t=>{if(!gt(t,e.kind))return;let r=t.data;if(!(!r||typeof r!=`object`))if(r.type===`wexio:identify:v1`){let e=r.user;if(!e||typeof e!=`object`)return;let t=typeof e.googleIdToken==`string`,i=typeof e.jwt==`string`,a=typeof e.userId==`string`&&typeof e.userHash==`string`;if(!t&&!i&&!a)return;n(n=>({...n,identity:{googleIdToken:t?e.googleIdToken:void 0,jwt:i?e.jwt:void 0,userId:typeof e.userId==`string`?e.userId:void 0,userHash:typeof e.userHash==`string`?e.userHash:void 0,name:typeof e.name==`string`?e.name:void 0,email:typeof e.email==`string`?e.email:void 0,phone:typeof e.phone==`string`?e.phone:void 0,attributes:e.attributes&&typeof e.attributes==`object`?e.attributes:void 0}}))}else if(r.type===`wexio:prefill:v1`){let e=r.prefill;if(!e||typeof e!=`object`)return;n(t=>({...t,prefill:{name:typeof e.name==`string`?e.name:void 0,email:typeof e.email==`string`?e.email:void 0,phone:typeof e.phone==`string`?e.phone:void 0}}))}else r.type===`wexio:shutdown:v1`&&n({identity:null,prefill:null})};return window.addEventListener(`message`,t),window.parent?.postMessage({type:`wexio:widget:ready:v1`},`*`),()=>window.removeEventListener(`message`,t)},[e.kind,e.visitorIdentity,e.visitorPrefill]),{identity:e.visitorIdentity??t.identity,prefill:e.visitorPrefill??t.prefill}}function Ga(e=ae(),t=ve(`local`)){try{let n=ja(e),r=t.getItem(n);if(r)return r;if(e){let e=t.getItem(Na);if(e)return t.setItem(n,e),t.removeItem(Na),e}let i=Ka();return t.setItem(n,i),i}catch{return Ka()}}function Ka(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<`u`&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let t=0;t<16;t++)e[t]=Math.floor(Math.random()*256);return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}var qa={themeMode:null,language:null,desktopNotifications:!1},Ja=new Set;function Ya(e,t){if(qa[e]!==t){qa={...qa,[e]:t};for(let e of Ja)e(qa)}}function Xa(){let[e,t]=Y(qa);return K(()=>(Ja.add(t),t(qa),()=>{Ja.delete(t)}),[]),e}var Za=null,Qa=new Set;function $a(e){if(Ye(e)&&Za!==e){Za=e;for(let t of Qa)t(e)}}var eo=new Set;function to(e){if(e){$a(e);return}let t=Za!==null;if(Za=null,t)for(let e of eo)e()}function no(e){return eo.add(e),()=>{eo.delete(e)}}function ro(e){return Qa.add(e),()=>{Qa.delete(e)}}var io={en:()=>import(`./widget-react-CkrkZ3pp.js`).then(e=>e.n).then(e=>e.default),"en-US":()=>import(`./widget-react-BXlRglvP2.js`).then(e=>e.default),"en-GB":()=>import(`./widget-react-DdIv5LKJ2.js`).then(e=>e.default),uk:()=>import(`./widget-react-DV3BZAN0.js`).then(e=>e.default),de:()=>import(`./widget-react-RWR7XGaa.js`).then(e=>e.default),es:()=>import(`./widget-react-CrWgGrOv2.js`).then(e=>e.default),"es-MX":()=>import(`./widget-react-Ci-9Gtq-2.js`).then(e=>e.default),fr:()=>import(`./widget-react-CTr72oJP2.js`).then(e=>e.default),it:()=>import(`./widget-react-D71FBbwd.js`).then(e=>e.default),nl:()=>import(`./widget-react-BZ7sDBzB.js`).then(e=>e.default),pt:()=>import(`./widget-react-BJLMVdT8.js`).then(e=>e.default),"pt-BR":()=>import(`./widget-react-CVu0iQzo.js`).then(e=>e.default),sv:()=>import(`./widget-react-CESpzeFW.js`).then(e=>e.default),da:()=>import(`./widget-react-DtxeNDUn.js`).then(e=>e.default),no:()=>import(`./widget-react-DpT7-wmd.js`).then(e=>e.default),fi:()=>import(`./widget-react-DSej45hO2.js`).then(e=>e.default),pl:()=>import(`./widget-react--SnHxPOY.js`).then(e=>e.default),cs:()=>import(`./widget-react-oMWtXf4y.js`).then(e=>e.default),sk:()=>import(`./widget-react-x1O7Aw-0.js`).then(e=>e.default),tr:()=>import(`./widget-react-C7ABw9U-.js`).then(e=>e.default),ro:()=>import(`./widget-react-B4O9LryX.js`).then(e=>e.default),hu:()=>import(`./widget-react-D3JyG2-s.js`).then(e=>e.default),el:()=>import(`./widget-react-DFBUOrVn2.js`).then(e=>e.default),ar:()=>import(`./widget-react-CCfIguE3.js`).then(e=>e.default),he:()=>import(`./widget-react-DR9wD8RF2.js`).then(e=>e.default),hi:()=>import(`./widget-react-CiXpsVM3.js`).then(e=>e.default),th:()=>import(`./widget-react-DySiCebV.js`).then(e=>e.default),vi:()=>import(`./widget-react-G5Axrzd4.js`).then(e=>e.default),id:()=>import(`./widget-react-CO_-SXaO.js`).then(e=>e.default),ja:()=>import(`./widget-react-BDwkTnhP.js`).then(e=>e.default),ko:()=>import(`./widget-react-JRr_KL3e.js`).then(e=>e.default),zh:()=>import(`./widget-react-D8sZCT6W.js`).then(e=>e.default),"zh-TW":()=>import(`./widget-react-bxGcWjbs.js`).then(e=>e.default)};async function ao(e){return(io[e]??io.en)()}var oo={themeMode:null,themeModeEditable:!0,language:null,desktopNotifications:!1,loaded:!1};function so(e){let{data:t}=sr({skip:!e.enabled||!!e.isDummy}),n=t?.visitorProfile,r=Xa(),i=e.isDummy?{themeMode:r.themeMode,themeModeEditable:!0,language:r.language,desktopNotifications:r.desktopNotifications,loaded:!0}:n?{themeMode:co(n.preferences.themeMode),themeModeEditable:n.themeModeEditable,language:n.preferences.language??null,desktopNotifications:!!n.preferences.desktopNotifications,loaded:!0}:e.enabled?oo:{...oo,loaded:!0};return K(()=>{if(i.loaded&&i.language){try{document.cookie=`wexio-locale=${encodeURIComponent(i.language)}; path=/; max-age=${3600*24*365}; samesite=lax`}catch{}$a(i.language)}},[i.loaded,i.language]),i}function co(e){if(typeof e!=`string`)return null;let t=e.toLowerCase();return t===`light`||t===`dark`?t:t===`auto`||t===`system`?`auto`:null}function lo(e,t,n){let r=!1,i=t.preview.token,a=a=>{if(!t.preview.active)return;if(a instanceof MessageEvent){if(typeof a.data!=`string`)return;try{let e=pe(JSON.parse(a.data));e&&t.preview.report(e,i)}catch{}return}if(e.readyState!==2||r||!t.publicKey)return;r=!0;let o=i;Si({publicKey:t.publicKey,token:n,previewToken:o}).then(e=>{e.kind===`unauthorized`&&e.previewReason&&t.preview.report(e.previewReason,o)})};return e.addEventListener(`error`,a),()=>e.removeEventListener(`error`,a)}var uo=3e3,fo=6e4,po=1e4;function mo({token:e,visitorId:t=null,enabled:n=!0,epoch:r=0,onUpdate:i,onAdd:a,onReopen:o}){let s=I(),c=J(i);K(()=>{c.current=i},[i]);let l=J(a);K(()=>{l.current=a},[a]);let u=J(o);K(()=>{u.current=o},[o]);let d=J(!1),f=J(!0),p=J(e);p.current=e;let m=!!e;K(()=>{if(!n||!m||typeof window>`u`)return;let e=s.publicKey;if(!e)return;let t=!1,r=0,i,a,o=()=>{},h=()=>{let n=p.current;if(!n)return;let m=`${re()}/api/web/realtime/threads?token=${encodeURIComponent(n)}&publicKey=${encodeURIComponent(e)}`,g=new EventSource(m,{withCredentials:!1}),_=e=>{try{c.current(JSON.parse(e.data))}catch{console.warn(`[wexio] unparseable threadUpdated frame`,e.data)}},v=e=>{try{l.current?.(JSON.parse(e.data))}catch{console.warn(`[wexio] unparseable threadAdded frame`,e.data)}},y=()=>{d.current&&f.current&&(f.current=!1,u.current?.()),d.current=!0,clearTimeout(a),a=setTimeout(()=>{r=0,f.current=!0},po)},b=e=>{e instanceof MessageEvent||(clearTimeout(a),o(),!t&&(i=setTimeout(h,Math.min(fo,uo*2**r)),r+=1))};g.addEventListener(`open`,y),g.addEventListener(`threadUpdated`,_),g.addEventListener(`threadAdded`,v);let x=lo(g,s,n);g.addEventListener(`error`,b),o=()=>{x(),g.removeEventListener(`open`,y),g.removeEventListener(`threadUpdated`,_),g.removeEventListener(`threadAdded`,v),g.removeEventListener(`error`,b),g.close()}};return h(),()=>{t=!0,clearTimeout(i),clearTimeout(a),o()}},[m,t,n,r,s])}function ho({chatId:e,token:t,visitorId:n=null,enabled:r=!0,onMessage:i}){let a=I(),o=J(i);K(()=>{o.current=i},[i]);let s=J(t);s.current=t;let c=!!t;K(()=>{if(!r||!e||!c||typeof window>`u`)return;let t=a.publicKey;if(!t)return;let n=!1,i=0,l,u,d=()=>{},f=()=>{let r=s.current;if(!r)return;let c=`${re()}/api/web/realtime/${encodeURIComponent(e)}?token=${encodeURIComponent(r)}&publicKey=${encodeURIComponent(t)}`,p=new EventSource(c,{withCredentials:!1}),m=e=>{try{let t=JSON.parse(e.data);o.current(t)}catch{console.warn(`[wexio] unparseable SSE frame`,e.data)}},h=e=>{try{let t=JSON.parse(e.data);o.current({...t,update:!0})}catch{console.warn(`[wexio] unparseable SSE frame`,e.data)}},g=()=>{clearTimeout(u),u=setTimeout(()=>{i=0},po)},_=e=>{e instanceof MessageEvent||(clearTimeout(u),d(),!n&&(l=setTimeout(f,Math.min(fo,uo*2**i)),i+=1))};p.addEventListener(`open`,g),p.addEventListener(`message`,m),p.addEventListener(`messageUpdate`,h);let v=lo(p,a,r);p.addEventListener(`error`,_),d=()=>{v(),p.removeEventListener(`open`,g),p.removeEventListener(`message`,m),p.removeEventListener(`messageUpdate`,h),p.removeEventListener(`error`,_),p.close()}};return f(),()=>{n=!0,clearTimeout(l),clearTimeout(u),d()}},[e,c,n,r,a])}function go(e){let[t,n]=Y(!1),[r,i]=Y(!1);return K(()=>(e.onUnavailable=()=>{n(!0),(e.publicKey?xt(e.publicKey):Promise.resolve()).finally(()=>i(!0))},()=>{e.onUnavailable=null}),[e]),{unavailable:t,evicted:r}}var _o={status:null};function vo(e){let t=e.assignment;return t?t.assignedStatus===`connected`?{status:`connected`,...t.operator?{operator:t.operator}:{}}:t.assignedStatus===`pending`?{status:`pending`,...t.estimate?{estimate:t.estimate}:{}}:{status:null}:null}function yo(e,t,n=new Date){let r=new Date(e);if(Number.isNaN(r.getTime()))return``;let i=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),a=new Intl.DateTimeFormat(t,{hour:`numeric`,minute:`2-digit`}).format(r);if(i(r,n))return a;let o=new Date(n);return o.setDate(n.getDate()+1),i(r,o)?`${new Intl.RelativeTimeFormat(t,{numeric:`auto`}).format(1,`day`)}, ${a}`:`${new Intl.DateTimeFormat(t,{weekday:`short`}).format(r)}, ${a}`}function bo(e){let t=e.assignment;if(!t?.messageId)return null;let n={id:t.messageId,direction:`OUTBOUND`,text:``,ageLabel:``,...e.sentAt?{createdAt:e.sentAt}:{},sender:{kind:`system`,name:`System`}};return t.assignedStatus===`connected`?{...n,system:{type:`OPERATOR_CONNECTED`,...t.operator?.name?{operatorName:t.operator.name}:{},...t.operator?.avatar?{operatorAvatar:t.operator.avatar}:{}}}:t.assignedStatus===null?{...n,system:{type:`CHAT_RESOLVED`,...t.initiator?{initiator:t.initiator}:{}}}:null}function xo(e,t,n){if(e.basis===`business_hours`)return e.availableAt?t(`assignment.eta.businessHours`,{time:yo(e.availableAt,n)}):null;if(e.basis===`operator_load`){if(typeof e.etaMinutes==`number`)return t(`assignment.eta.minutes`,{minutes:e.etaMinutes});if(e.soft)return t(`assignment.eta.soft`)}return null}var So=2048,Co=2048;function wo(e){try{let t=new URL(e).protocol;return t===`http:`||t===`https:`}catch{return!1}}function To(e){if(!e.url||!wo(e.url))return;let t=e.title?.slice(0,200),n=e.referrer?.slice(0,Co),r=e.description?.trim().slice(0,500);return{url:e.url.slice(0,So),...t?{title:t}:{},...n?{referrer:n}:{},...r?{description:r}:{}}}var Eo=null;function Do(e){if(!gt(e,`iframe`))return;let t=e.data;!t||typeof t!=`object`||t.type!==`wexio:host-navigation:v1`||typeof t.url==`string`&&(Eo={url:t.url,title:typeof t.title==`string`?t.title:void 0,referrer:typeof t.referrer==`string`?t.referrer:void 0,description:typeof t.description==`string`?t.description:void 0})}typeof window<`u`&&window.addEventListener(`message`,Do);function Oo(){return document.querySelector(`meta[name="description"]`)?.getAttribute(`content`)?.trim()||(document.querySelector(`meta[property="og:description"]`)?.getAttribute(`content`)??void 0)}function ko(e){if(!(typeof window>`u`)){if(e===`iframe`){let e=new URLSearchParams(window.location.search).get(`referer`)??void 0;return To(Eo??{url:e})}return To({url:window.location.href,title:document.title,referrer:document.referrer,description:Oo()})}}var Ao=!1,jo=/(["'`]page["'`]|VisitorPageInput)/;function Mo(e){let t=e??{};return[...t.errors??[],...t.graphQLErrors??[],...t.networkError?.result?.errors??[]].map(e=>e?.message??``)}function No(e){return Mo(e).some(e=>jo.test(e))}async function Po(e){let t=e.options?.variables?.input;if(!t)return e.send(e.options);let{page:n,...r}=t,i=n??e.page,a=t=>({...e.options,variables:{...e.options?.variables,input:t}});if(Ao||!i)return e.send(a(r));let o;try{o=await e.send(a({...r,page:i}))}catch(t){if(!No(t))throw t;return Ao=!0,e.send(a(r))}return No(o)?(Ao=!0,e.send(a(r))):o}function Fo(){let e=Te().kind,[t,n]=et();return[G(n=>Po({send:t,options:n,page:ko(e)}),[t,e]),n]}function Io(e){return e.kind===`home`||e.kind===`messages`||e.kind===`help`||e.kind===`news`||e.kind===`profile`}function Lo(e,t){switch(e.kind){case`messages`:return t.home?{kind:`home`}:t.help?{kind:`help`}:t.news?{kind:`news`}:t.profile?{kind:`profile`}:{kind:`messages`};case`help-category`:return e.origin??{kind:`help`};case`help-article`:return e.origin?e.origin:e.from===`category`&&e.fromCategoryId?{kind:`help-category`,categoryId:e.fromCategoryId}:{kind:`help`};case`news-article`:return e.origin??{kind:`news`};case`messages-thread`:return e.origin??{kind:`messages`};default:return{kind:`home`}}}function Ro(e,t){return e.kind===`help-article`||e.kind===`news-article`||e.kind===`help-category`||e.kind===`messages-thread`?{...e,origin:t}:e}function zo(e,t){return e.kind===`news-article`&&t.kind===`news-article`?{...e,origin:t.origin}:e.kind===`help-article`&&t.kind===`help-article`?{...e,origin:t.origin,...t.origin?{}:{from:t.from,fromCategoryId:t.fromCategoryId}}:Ro(e,t)}function Bo(e){switch(e.kind){case`home`:return`home`;case`messages`:case`messages-thread`:return`messages`;case`help`:case`help-category`:case`help-article`:return`help`;case`news`:case`news-article`:return`news`;case`profile`:return`profile`}}function Vo(e,t){return e===`home`?t.home:e===`messages`?t.messenger:e===`help`?t.help:e===`news`?t.news:!!t.profile}function Ho(e){return+!!e.home+ +!!e.messenger+ +!!e.help+ +!!e.news+ +!!e.profile}function Uo(e,t){if(Vo(e,t))return e;for(let e of[`home`,`messages`,`help`,`news`,`profile`])if(Vo(e,t))return e;return e}function Wo(e){switch(e){case`PHOTO`:return`🖼️`;case`VIDEO`:return`🎥`;case`AUDIO`:return`🎵`;case`VOICE`:return`🎤`;case`FILE`:return`📄`;case`GIF`:return`🎞️`;case`STICKER`:return`🩷`;default:return`📎`}}function Go(e){switch(e){case`PENDING`:return`PENDING`;case`RESOLVED`:return`RESOLVED`;case`CLOSED`:return`CLOSED`;default:return`OPEN`}}function Ko(e){if(typeof e==`string`)return e;if(typeof e==`number`||e instanceof Date){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toISOString()}return``}function qo(e){return e.replace(/<[^>]*>/g,` `).replace(/ /g,` `).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/�*39;|'/g,`'`).replace(/\s+/g,` `).trim()}function Jo(e){let t=e.lastMessagePreview?qo(e.lastMessagePreview):``,n=e.lastMessageMediaType??null,r=e.lastMessageMediaThumbUrl??null,i=Ko(e.lastMessageAt??e.updatedAt),a=!!e.lastMessageFromVisitor;if(t)return{text:t,at:i,fromVisitor:a,...n?{media:!0,mediaType:n,mediaThumbUrl:r}:{}};if(n)return{text:``,at:i,fromVisitor:a,media:!0,mediaType:n,mediaThumbUrl:r};let o=e.lastMessageSenderKind;return e.lastMessageAt&&o&&o!==`system`?{text:``,at:i,fromVisitor:a,media:!0}:null}function Yo(e,t){return{chatId:e.id,threadKey:e.threadKey??null,title:null,status:Go(e.status),blocked:e.blocked??!1,unreadCount:e.unReadCount??0,updatedAt:Ko(e.updatedAt),preview:Jo(e),senderName:t,lastSenderKind:e.lastMessageSenderKind??null,lastSenderName:e.lastMessageSenderName??null}}function Xo(e,t){let n=e?.visitorThreads?.threads;return n?n.map(e=>Yo(e,t)):[]}var Zo=[`status`,`title`,`unreadCount`,`updatedAt`,`preview`,`lastSenderKind`,`lastSenderName`,`blocked`],Qo=e=>e?Date.parse(e):NaN;function $o(e,t){let n=Qo(t.lastMessageAt),r=Qo(e?.preview?.at);if(!Number.isNaN(n)&&!Number.isNaN(r))return n<r;let i=Qo(t.updatedAt),a=Qo(e?.updatedAt);return!Number.isNaN(i)&&!Number.isNaN(a)&&i<a}function es(e){switch(e){case`PENDING`:return`PENDING`;case`RESOLVED`:return`RESOLVED`;case`CLOSED`:return`CLOSED`;default:return`OPEN`}}function ts(e,t,n=Date.now()){let r={...e};return $o(e,t)||(ns(r,t),Zo.some(t=>r[t]!==e?.[t])&&(r.contentAt=n)),t.typing!==void 0&&(r.typing=!!t.typing?.active),t.assignment!==void 0&&(r.assignedStatus=t.assignment?.assignedStatus??null,r.assignedOperatorName=t.assignment?.operator?.name??null),r}function ns(e,t){if(t.status!=null&&(e.status=es(t.status)),t.title!=null&&(e.title=t.title),t.unReadCount!=null&&(e.unreadCount=t.unReadCount),t.updatedAt!=null&&(e.updatedAt=Ko(t.updatedAt)),(t.lastMessagePreview!=null||t.lastMessageAt!=null)&&(e.typing=!1),t.lastMessagePreview!=null||t.lastMessageMediaType!=null){let n=t.lastMessagePreview?qo(t.lastMessagePreview):``,r=t.lastMessageMediaType??null,i=t.lastMessageMediaThumbUrl??null,a=Ko(t.lastMessageAt??t.updatedAt),o=!!t.lastMessageFromVisitor;n?e.preview={text:n,at:a,fromVisitor:o,...r?{media:!0,mediaType:r,mediaThumbUrl:i}:{}}:r?e.preview={text:``,at:a,fromVisitor:o,media:!0,mediaType:r,mediaThumbUrl:i}:t.lastMessageAt!=null&&t.lastMessageSenderKind&&t.lastMessageSenderKind!==`system`&&(e.preview={text:``,at:a,fromVisitor:o,media:!0})}t.lastMessageSenderKind!=null&&(e.lastSenderKind=t.lastMessageSenderKind,e.lastSenderName=t.lastMessageSenderName??null),t.blocked!=null&&(e.blocked=t.blocked)}function rs(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e)){if(a.contentAt!==void 0&&a.contentAt>t){r[i]=a;continue}if(!Zo.some(e=>a[e]!==void 0)){r[i]=a;continue}n=!0;let e={...a};for(let t of Zo)delete e[t];delete e.contentAt,Object.values(e).some(e=>e!==void 0)&&(r[i]=e)}return n?r:e}function is(e,t){if(!t)return e;let n=Qo(t.preview?.at),r=Qo(e.preview?.at),i=!Number.isNaN(n)&&!Number.isNaN(r)&&n<r?void 0:t;return{...e,...i?.status===void 0?{}:{status:i.status},...i?.title===void 0?{}:{title:i.title},...i?.unreadCount===void 0?{}:{unreadCount:i.unreadCount},...i?.updatedAt===void 0?{}:{updatedAt:i.updatedAt},...i?.preview===void 0?{}:{preview:i.preview},...t.typing===void 0?{}:{typing:t.typing},...t.assignedStatus===void 0?{}:{assignedStatus:t.assignedStatus},...t.assignedOperatorName===void 0?{}:{assignedOperatorName:t.assignedOperatorName},...i?.lastSenderKind===void 0?{}:{lastSenderKind:i.lastSenderKind},...i?.lastSenderName===void 0?{}:{lastSenderName:i.lastSenderName},...i?.blocked===void 0?{}:{blocked:i.blocked}}}var as=f(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),os=f(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),ss=f(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),cs=f(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),ls=f(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),us=f(`book`,[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}]]),ds=f(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),fs=f(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),ps=f(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),ms=f(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),hs=f(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),gs=f(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),_s=f(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),vs=f(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),ys=f(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),bs=f(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),xs=f(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ss=f(`gamepad-2`,[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]),Cs=f(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),ws=f(`heart`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]),Ts=f(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),Es=f(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),Ds=f(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Os=f(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),ks=f(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),As=f(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),js=f(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ms=f(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Ns=f(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Ps=f(`message-circle-more`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),Fs=f(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),Is=f(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ls=f(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Rs=f(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),zs=f(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Bs=f(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Vs=f(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),Hs=f(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Us=f(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Ws=f(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Gs=f(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ks=f(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),qs=f(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),Js=f(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Ys=f(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Xs=f(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Zs=f(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),Qs=f(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),$s=f(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),ec=f(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),tc=f(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),nc=f(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),rc=f(`video`,[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]),ic=f(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),ac=f(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),oc=f(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),sc=f(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),cc={sm:`h-3.5 min-w-3.5 px-0.75 text-[8px]`,md:`h-5 min-w-5 px-1.5 text-[10px]`},lc={duration:.2,ease:[.2,0,0,1]},uc={duration:.12,ease:[.2,0,0,1]};function dc({count:e,size:t=`sm`,className:n,dot:r,label:i}){let a=r&&e<=0;return X(kt,{children:(e>0||a)&&Z(o.span,{role:`status`,initial:{opacity:0},animate:{opacity:1,transition:lc},exit:{opacity:0,transition:uc},className:u(`inline-flex`,n),"aria-label":i??`${e} unread`,children:[X(`span`,{"aria-hidden":`true`,className:`absolute inset-0 -z-10 rounded-full bg-wx-danger opacity-40 blur-[2px]`}),X(`span`,{className:u(`relative flex items-center justify-center`,`rounded-full bg-wx-danger font-bold leading-none text-white`,cc[t]),children:a?null:e>99?`99+`:e})]},`badge`)})}var fc=[`home`,`messages`,`help`,`news`,`profile`];function pc({active:e,features:t,onChange:n,unreadCount:r=0,newsUnread:a=!1}){let o=i(`tabs`),s=i(`news`),c=ln(),l=ln(),d=fc.filter(e=>gc(e,t));return X(`div`,{className:`px-3 pt-2 pb-2`,children:X(`nav`,{role:`tablist`,className:u(`relative flex w-full items-center gap-1`,`rounded-full bg-wx-bg-elevated/70 p-1 backdrop-blur-md`,`shadow-[inset_0_0_0_1px_rgb(0_0_0/0.04)]`),children:d.map(t=>{let i=t===e;if(t===`home`)return X(mc,{id:t,label:o(t),isActive:i,onClick:()=>n(t),parentHandlers:c.parentHandlers,icon:X(Ft,{ref:c.iconRef,size:16})},t);if(t===`messages`)return X(mc,{id:t,label:o(t),isActive:i,onClick:()=>n(t),parentHandlers:l.parentHandlers,icon:X(Mt,{ref:l.iconRef,size:16}),badgeCount:r},t);let u=t===`help`?hs:t===`news`?an:tc;return X(hc,{id:t,label:o(t),isActive:i,onClick:()=>n(t),Icon:u,showDot:t===`news`&&a,dotLabel:s(`unread`)},t)})})})}function mc({id:e,label:t,isActive:n,onClick:r,icon:i,parentHandlers:a,badgeCount:s=0}){return Z(`button`,{type:`button`,role:`tab`,"aria-selected":n,onClick:r,...a,className:u(`relative z-10 flex items-center justify-center gap-1.5 rounded-full px-3 py-2`,`transition-colors duration-150`,n?`flex-[2_2_0%] text-wx-fg`:`flex-1 text-wx-fg-muted hover:text-wx-fg`),children:[n&&X(o.span,{layoutId:`bottom-nav-pill`,className:`absolute inset-0 -z-10 rounded-full bg-wx-bg shadow-[0_2px_8px_rgba(0,0,0,0.08)]`,transition:{type:`spring`,stiffness:420,damping:36}}),Z(`span`,{className:`relative inline-flex shrink-0 items-center justify-center`,children:[i,X(dc,{count:s,size:`sm`,className:`absolute -top-1.5 -right-2 z-20`})]}),X(o.span,{animate:{width:n?`auto`:0,opacity:+!!n,marginLeft:n?0:-4},initial:!1,transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden text-[11px] font-semibold tracking-tight whitespace-nowrap`,children:t})]})}function hc({id:e,label:t,isActive:n,onClick:r,Icon:i,showDot:a=!1,dotLabel:s}){let c=Lt();return K(()=>{n&&c.start({scale:[1,1.15,1]})},[n,c]),Z(o.button,{type:`button`,role:`tab`,"aria-selected":n,onClick:r,onHoverStart:()=>c.start({rotate:[0,-10,10,0]}),className:u(`relative z-10 flex items-center justify-center gap-1.5 rounded-full px-3 py-2`,`transition-colors duration-150`,n?`flex-[2_2_0%] text-wx-fg`:`flex-1 text-wx-fg-muted hover:text-wx-fg`),children:[n&&X(o.span,{layoutId:`bottom-nav-pill`,className:`absolute inset-0 -z-10 rounded-full bg-wx-bg shadow-[0_2px_8px_rgba(0,0,0,0.08)]`,transition:{type:`spring`,stiffness:420,damping:36}}),Z(`span`,{className:`relative inline-flex shrink-0 items-center justify-center`,children:[X(o.span,{animate:c,transition:{duration:.4},children:X(i,{size:16,strokeWidth:n?2.2:1.8})}),X(dc,{count:0,dot:a,label:s,size:`sm`,className:`absolute -top-1.5 -right-2 z-20`})]}),X(o.span,{animate:{width:n?`auto`:0,opacity:+!!n,marginLeft:n?0:-4},initial:!1,transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden text-[11px] font-semibold tracking-tight whitespace-nowrap`,children:t})]})}function gc(e,t){return e===`home`?t.home:e===`messages`?t.messenger:e===`help`?t.help:e===`news`?t.news:!!t.profile}var _c=3e3;function vc({online:e,showBranding:t}){let n=i(`messages`),r=i(`branding`),[a,s]=Y(!1),c=J(e);K(()=>{let t=c.current;if(c.current=e,!e){s(!1);return}if(!t&&e){s(!0);let e=setTimeout(()=>s(!1),_c);return()=>clearTimeout(e)}},[e]);let l=e?a?`online`:t?`branding`:null:`offline`,d=`absolute inset-0 flex items-center justify-center gap-1.5 px-4 text-[10px] font-medium`;return X(`div`,{className:u(`relative shrink-0`,l?`h-[26px]`:`h-0`),children:Z(kt,{initial:!1,mode:`wait`,children:[l===`offline`&&Z(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:u(d,`bg-wx-danger/10 text-wx-danger`),children:[X(oc,{"aria-hidden":`true`,className:`size-3`}),X(`span`,{children:n(`offlineBanner`)})]},`offline`),l===`online`&&Z(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:u(d,`bg-wx-success/10 text-wx-success`),children:[X(sc,{"aria-hidden":`true`,className:`size-3`}),X(`span`,{children:n(`backOnline`)})]},`online`),l===`branding`&&Z(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:u(d,`bg-wx-bg text-wx-fg-subtle`),children:[X(`span`,{children:r(`poweredBy`)}),X(`a`,{href:`https://wexio.io?ref=widget`,target:`_blank`,rel:`noopener`,className:`font-semibold text-wx-fg-muted transition-colors hover:text-wx-fg`,children:r(`wexio`)})]},`branding`)]})})}function yc({title:e,subtitle:t,organizationLogoUrl:n,muted:r,onToggleMute:a,onBack:o,onClose:s,showResolve:c,onResolve:l,onDownloadTranscript:d,downloadingTranscript:f,expanded:p,onToggleExpand:m}){let h=i(`header`),g=i(`header`),_=ln(),v=ln();return Z(`header`,{"data-wx-top-bar":!0,className:u(`flex items-center gap-3 border-b border-wx-border bg-wx-bg px-3 py-3`),children:[o&&X(Kt,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":h(`back`),onClick:o,className:`size-8 shrink-0`,..._.parentHandlers,children:X(It,{ref:_.iconRef,size:16})}),n&&X(`span`,{className:`h-9 w-9 shrink-0 overflow-hidden rounded-full`,children:X(`img`,{src:n,alt:e,className:`h-full w-full object-cover`})}),Z(`div`,{className:`min-w-0 flex-1`,children:[X(`p`,{className:`truncate text-sm font-semibold text-wx-fg`,children:e}),t&&X(`p`,{className:`truncate text-xs text-wx-fg-muted`,children:t})]}),X(xc,{muted:r,onToggleMute:a,showResolve:!!c&&!!l,onResolve:l,onDownloadTranscript:d,downloadingTranscript:!!f}),m&&X(Kt,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":g(p?`collapse`:`expand`),onClick:m,className:`group size-8 shrink-0`,children:X(`span`,{className:`block transition-transform duration-200 ease-out group-hover:scale-110 group-active:scale-90`,children:X(Cc,{expanded:!!p})})}),X(Kt,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":h(`close`),onClick:s,className:`size-8 shrink-0`,...v.parentHandlers,children:X(Nt,{ref:v.iconRef,size:16})})]})}function bc(){return Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[X(`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`}),X(`path`,{d:`m9 11 3 3L22 4`})]})}function xc({muted:e,onToggleMute:t,showResolve:n,onResolve:r,onDownloadTranscript:a,downloadingTranscript:o}){let s=i(`header`),c=i(`sound`),l=i(`messages`),[u,d]=Y(!1),f=J(null);K(()=>{if(!u)return;let e=e=>{f.current&&!e.composedPath().includes(f.current)&&d(!1)},t=e=>{e.key===`Escape`&&d(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[u]);let p=e=>()=>{d(!1),e?.()};return Z(`div`,{ref:f,className:`relative shrink-0`,children:[X(Kt,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s(`moreActions`),"aria-haspopup":`menu`,"aria-expanded":u,onClick:()=>d(e=>!e),className:`group size-8`,children:X(`span`,{className:`block transition-transform duration-200 ease-out group-hover:scale-110 group-active:scale-90`,children:X(Qt,{icon:bs,size:18})})}),u&&Z(`div`,{role:`menu`,className:`absolute top-full right-0 z-30 mt-1 min-w-44 overflow-hidden rounded-wx-sm border border-wx-border bg-wx-bg py-1 shadow-lg`,children:[a&&X(Sc,{icon:X(Qt,{icon:o?js:ys,size:16}),label:s(`downloadTranscript`),onClick:p(a),disabled:o,spinning:o}),X(Sc,{icon:X(Qt,{icon:e?ac:ic,size:16}),label:c(e?`unmute`:`mute`),onClick:p(t)}),n&&X(Sc,{icon:X(bc,{}),label:l(`resolveConversation`),onClick:p(r)})]})]})}function Sc({icon:e,label:t,onClick:n,disabled:r,spinning:i}){return Z(`button`,{type:`button`,role:`menuitem`,onClick:n,disabled:r,className:`flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-wx-fg transition-colors hover:bg-wx-bg-elevated disabled:cursor-default disabled:opacity-60`,children:[X(`span`,{className:u(`shrink-0 text-wx-fg-muted`,i&&`animate-spin`),children:e}),X(`span`,{className:`truncate`,children:t})]})}function Cc({expanded:e}){return e?Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[X(`polyline`,{points:`4 14 10 14 10 20`}),X(`polyline`,{points:`20 10 14 10 14 4`}),X(`line`,{x1:`14`,y1:`10`,x2:`21`,y2:`3`}),X(`line`,{x1:`3`,y1:`21`,x2:`10`,y2:`14`})]}):Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[X(`polyline`,{points:`15 3 21 3 21 9`}),X(`polyline`,{points:`9 21 3 21 3 15`}),X(`line`,{x1:`21`,y1:`3`,x2:`14`,y2:`10`}),X(`line`,{x1:`3`,y1:`21`,x2:`10`,y2:`14`})]})}function wc({children:e}){let{isDummy:t}=Ct(),r=n(),i=g(),a=i.demo,o=a!==void 0&&typeof a==`object`&&!!a&&Object.keys(a).length>0,[s,c]=Y(null);if(K(()=>{if(!t||o)return;let e=!0;return Ze(r).then(t=>{e&&c(t)}),()=>{e=!1}},[t,o,r]),!t)return X(wn,{children:e});let l=o?i:s?{...i,demo:s}:null;return l?X(On,{locale:r,messages:l,timeZone:typeof Intl<`u`?Intl.DateTimeFormat().resolvedOptions().timeZone:`UTC`,children:e}):null}function Tc({title:e,description:t,meta:n,authors:r,onClick:i,kind:a=`none`,delay:s=0}){let c=a===`article`;return Z(o.button,{type:`button`,onClick:i,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.18,delay:s},className:u(`group flex w-full items-center gap-3 border-wx-border border-b text-start transition-colors`,`hover:bg-wx-bg-elevated/60`,`last:border-b-0`,c?`px-5 py-3`:`px-5 py-3.5`),children:[Z(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 [overflow-wrap:anywhere]`,children:[X(`span`,{className:u(`text-wx-fg`,c?`font-normal text-sm`:`font-semibold text-sm`),children:e}),t&&X(`span`,{className:u(`leading-snug`,c?`truncate text-[11px] text-wx-fg-subtle`:`text-wx-fg-muted text-xs`),children:t}),n&&X(`span`,{className:`text-[11px] text-wx-fg-subtle`,children:n})]}),Z(`span`,{className:`flex shrink-0 items-center gap-2 text-wx-fg-muted`,children:[r&&r.length>0&&X(en,{authors:r}),X(yt,{size:16,className:`transition-transform group-hover:translate-x-0.5 rtl:-scale-x-100 rtl:group-hover:-translate-x-0.5`,"aria-hidden":`true`})]})]})}var Ec=10,Dc=240,Oc=3;function kc({categoryId:e,categoryName:t,categoryDescription:r,categoryArticleCount:a,isDummy:s,onOpenCategory:c,onOpenArticle:l}){let u=i(`help`),d=T(),f=_t(),p=n(),[m,h]=Y(``),g=jc(m,300),_=g.length>=2,{data:v}=qt({variables:{parentId:e,locale:p},skip:s}),y=q(()=>v?.visitorHelpFolders??[],[v]),{data:b,loading:x,fetchMore:S}=Bt({variables:{args:{folderId:e,locale:p,recursive:!1,limit:Ec,offset:0}},skip:s,notifyOnNetworkStatusChange:!0}),{data:C,loading:w}=Bt({variables:{args:{query:g,locale:p,limit:10}},skip:g.length<2||s}),O=s?ue(d).find(t=>t.id===e):null,k=s?E(d).filter(t=>t.categoryId===e):[],A=s?k.map(e=>({id:e.id,slug:e.slug,title:e.title,excerpt:e.excerpt,authors:nn(e.authors),reactionCounts:null})):(b?.visitorHelpList?.items??[]).map(e=>({id:e._id,slug:e.slug,title:e.title,excerpt:e.excerpt??null,authors:nn(e.authors),reactionCounts:e.reactionCounts??null})),j=s?E(d).filter(e=>e.title.toLowerCase().includes(g.toLowerCase())||e.excerpt.toLowerCase().includes(g.toLowerCase())).map(e=>({id:e.id,slug:e.slug,title:e.title,excerpt:e.excerpt,authors:nn(e.authors),reactionCounts:null})):[],M=(C?.visitorHelpList?.items??[]).map(e=>({id:e._id,slug:e.slug,title:e.title,excerpt:e.excerpt??null,authors:nn(e.authors),reactionCounts:e.reactionCounts??null})),N=_?s?j:M:A,P=t??O?.title??``,ee=r??O?.description??``,te=a??O?.articleCount??A.length,ne=q(()=>{let e=new Map;for(let t of A)for(let n of t.authors??[])e.has(n.id)||e.set(n.id,n);return Array.from(e.values())},[A]),F=ne.slice(0,Oc),re=Math.max(0,ne.length-F.length),ie=F[0]?.name??``,ae=!_&&!s&&(b?.visitorHelpList?.meta?.hasNextPage??!1),[oe,se]=Y(!1),ce=G(async()=>{if(!(!ae||oe)){se(!0);try{await S({variables:{args:{folderId:e,locale:p,recursive:!1,limit:Ec,offset:b?.visitorHelpList?.items?.length??0}},updateQuery:(e,{fetchMoreResult:t})=>t?{...e,visitorHelpList:{...t.visitorHelpList,items:[...e.visitorHelpList?.items??[],...t.visitorHelpList?.items??[]]}}:e})}catch{}finally{se(!1)}}},[ae,oe,e,p,S,b]),le=G(e=>{let t=e.currentTarget;t.scrollHeight-t.clientHeight-t.scrollTop<Dc&&ce()},[ce]),de=s&&!D(d)||!s&&!_&&x&&A.length===0&&y.length===0;return X(`div`,{className:`flex h-full min-h-0 flex-col`,children:Z(ze,{followDirection:!0,className:`min-h-0 flex-1`,viewportRef:f,onScroll:le,children:[X(Jt,{value:m,onChange:h,placeholder:u(`searchPlaceholder`)}),!_&&P&&X(o.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2},className:`border-wx-border border-b px-5 py-5`,children:Z(`div`,{className:`flex items-start justify-between gap-4`,children:[Z(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[X(`h2`,{className:`font-semibold text-lg text-wx-fg`,children:P}),ee&&X(`p`,{className:`text-sm text-wx-fg-muted leading-snug`,children:ee}),Z(`div`,{className:`mt-1 flex flex-col gap-0.5 text-wx-fg-subtle text-xs`,children:[X(`span`,{children:u(`articlesCount`,{count:te})}),ie&&X(`span`,{children:u(`authorsByline`,{first:ie,remaining:re})})]})]}),F.length>0&&X(`div`,{className:`shrink-0`,children:X(en,{authors:F})})]})}),de?X(Ac,{}):N.length===0&&y.length===0?X(`div`,{className:`px-5 py-6`,children:X(ct,{children:X(tt,{className:`py-8 text-center`,children:X(`p`,{className:`text-sm text-wx-fg-muted`,children:u(_?`noResults`:`emptyTitle`)})})})}):Z(`div`,{className:`flex flex-col`,children:[N.map((e,t)=>X(Tc,{title:e.title,description:e.excerpt,authors:e.authors,kind:`article`,onClick:()=>l(e.slug),delay:Math.min(t,Ec)*.03},e.id)),!_&&y.map((e,t)=>X(Tc,{title:e.name,description:e.description,meta:(e.articleCount??0)>0?u(`articlesCount`,{count:e.articleCount??0}):void 0,kind:`folder`,onClick:()=>c(e._id,{name:e.name,description:e.description??void 0,articleCount:e.articleCount??0}),delay:(N.length+t)*.03},e._id)),(oe||w)&&X(`div`,{className:`flex justify-center py-3`,children:X(U,{className:`h-3 w-24`})})]})]})})}function Ac(){return X(`div`,{className:`flex flex-col`,children:Array.from({length:3}).map((e,t)=>Z(`div`,{className:`flex items-center gap-3 border-wx-border border-b px-5 py-4 last:border-b-0`,children:[Z(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[X(U,{className:`h-4 w-32 rounded`}),X(U,{className:`h-3 w-56 rounded`})]}),X(U,{className:`h-4 w-4 rounded`})]},t))})}function jc(e,t){let[n,r]=Y(e);return K(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Mc(e,t,n){let r=Object.entries(t).map(([e,t])=>({chatId:`demo-${F(e)}`,threadKey:F(e),title:t.title,status:`OPEN`,unreadCount:0,updatedAt:t.at,preview:null,senderName:n,lastSenderKind:`ai`}));return[...e,...r]}function Nc(e,t,n){return e?{chatId:``,threadKey:t(e.slotId,e.variant.id),status:`OPEN`,unreadCount:0,updatedAt:``,preview:{text:e.variant.text,at:``,fromVisitor:!1},senderName:n}:null}var Pc=`launcher-message`;function Fc(e,t){return{id:`slot:${e.slotId}:${e.variant.id}:${e.variant.contentHash??``}`,text:e.variant.text,sender:{kind:`ai`,name:t},buttons:e.variant.buttons.map(e=>({text:e.label,payload:``})),inPlaceKey:Pc}}function Ic(e){let t=e.find(e=>e.chatId);return t?{kind:`thread`,chatId:t.chatId,threadKey:t.threadKey}:{kind:`list`}}function Lc(e,t,n=e=>F(e)){if(!e)return{kind:`plain`};let r=n(e.slotId,e.variantId);return t.some(e=>e.chatId&&e.threadKey===r)?{kind:`topic-with-slot-text`,slotId:e.slotId}:{kind:`slot-thread`,threadKey:r}}function Rc(e){let{message:t,slotLauncher:n,launcherToMessages:r,threads:i,isOpen:a}=e,{setRoute:o,markResumed:s,openPanel:c,togglePanel:l,setPendingReply:u}=e,d=e.keyFor??(e=>F(e)),f=G((e,t)=>{let n=d(e,t),r=i.find(e=>e.chatId&&e.threadKey===n);return s(),o({kind:`messages-thread`,threadKey:n,chatId:r?.chatId}),n},[i,s,o,d]),{resumeRoute:p,threadsLoading:m}=e,h=G(()=>{let e=p?.();if(e)return s(),e;if(m)return{kind:`messages-thread`,pendingLatest:!0};s();let t=Ic(i);return t.kind===`thread`?{kind:`messages-thread`,chatId:t.chatId,threadKey:t.threadKey}:{kind:`messages`}},[i,m,s,p]);return{onLauncherToggle:G(()=>{!a&&n&&r&&o(h()),l()},[a,n,r,h,o,l]),messagesEntryRoute:h,newConversationRoute:G(e=>{let r={kind:`messages-thread`,threadKey:e};if(!n)return r;let a=Lc(t.top?{slotId:t.top.slotId,variantId:t.top.variant.id}:null,i,d);return a.kind===`slot-thread`?{kind:`messages-thread`,threadKey:a.threadKey}:a.kind===`topic-with-slot-text`?{...r,welcomeSlotId:a.slotId}:r},[n,t.top,i,d]),onBubbleOpen:G(()=>{let e=t.shown;e&&(t.markRead(`click`),f(e.slotId,e.variant.id),c())},[t,f,c]),onBubbleReply:G(e=>{let n=t.shown;n&&(t.markRead(`click`),u({threadKey:f(n.slotId,n.variant.id),text:e}),c())},[t,f,u,c]),onBubbleDismiss:G(()=>t.markRead(`dismiss`),[t])}}var zc={none:0,visitors:1,origin:2,path:3},Bc=e=>Array.isArray(e)&&e.length>0;function Vc(e){return e?Bc(e.paths)?zc.path:Bc(e.origins)?zc.origin:e.visitors===`ANONYMOUS`||e.visitors===`SIGNED_IN`?zc.visitors:zc.none:zc.none}function Hc(e,t){let n=[];return e.forEach((e,r)=>{if(e.kind!==`MESSAGE`)return;let i=ri(e.variants,t);i&&n.push({slotId:e.id,variant:i,specificity:Vc(i.when),order:r,reappearAfterDays:e.reappearAfterDays??null})}),n.sort((e,t)=>t.specificity-e.specificity||e.order-t.order)}function Uc(e,t){return Hc(e,t)[0]??null}var Wc=864e5,Gc=(e,t)=>`wexio:slot-read:${e}:${t}`,Kc=e=>typeof e==`string`?e:void 0;function qc(e,t,n){try{let r=e.getItem(Gc(t,n));if(!r)return{};let i=JSON.parse(r);if(!i||typeof i!=`object`||Array.isArray(i))return{};let a={};for(let[e,t]of Object.entries(i)){if(!t||typeof t!=`object`)continue;let n=t;if(typeof n.contentHash!=`string`)continue;let r=Kc(n.shownAt),i=Kc(n.readAt),o=Kc(n.dismissedAt);a[e]={contentHash:n.contentHash,...r?{shownAt:r}:{},...i?{readAt:i}:{},...o?{dismissedAt:o}:{}}}return a}catch{return{}}}function Jc(e,t,n,r,i){let a=qc(e,t,n),o=r.contentHash??``,s=a[r.id],c=s&&s.contentHash===o?s:{contentHash:o};a[r.id]={...c,...i};try{e.setItem(Gc(t,n),JSON.stringify(a))}catch{}}function Yc(e,t,n,r,i){let a=qc(e,t,n)[r.id],o=a?.shownAt&&(!a.dismissedAt||a.shownAt>a.dismissedAt);a&&a.contentHash===(r.contentHash??``)&&o||Jc(e,t,n,r,{shownAt:new Date(i).toISOString()})}function Xc(e,t,n,r,i,a){let o=new Date(a).toISOString();Jc(e,t,n,r,i===`dismiss`?{dismissedAt:o}:{readAt:o})}function Zc(e,t,n,r){let i=e[t.id];if(!i||i.contentHash!==(t.contentHash??``))return!1;if(i.readAt)return!0;if(!i.dismissedAt)return!1;if(n===null)return!0;let a=Date.parse(i.dismissedAt);return Number.isNaN(a)?!0:r-a<n*Wc}function Qc(e,t,n){let r=e[t.id];if(!r||r.contentHash!==(t.contentHash??``)||r.readAt||!r.dismissedAt||n===null)return null;let i=Date.parse(r.dismissedAt);return Number.isNaN(i)?null:i+n*Wc}var $c=2e9;function el(e){let{slots:t,ctx:n,publicKey:r,storage:i,ready:a,isOpen:o,suppressed:s}=e,c=e.previewVisible===!0,l=e.graceMs??1500,u=J(e.now??Date.now);u.current=e.now??Date.now;let d=r??``,f=q(()=>t.some(e=>e.kind===`MESSAGE`),[t]),p=q(()=>Uc(t,n),[t,n]),[m,h]=Y(0),[g,_]=Y(!1);K(()=>{if(!a){_(!1);return}let e=setTimeout(()=>_(!0),l);return()=>clearTimeout(e)},[a,l]);let v=q(()=>p&&!c?Zc(qc(i,d,p.slotId),p.variant,p.reappearAfterDays,u.current()):!1,[p,i,d,m,c]);K(()=>{if(!p||!v||c)return;let e=Qc(qc(i,d,p.slotId),{id:p.variant.id,contentHash:p.variant.contentHash},p.reappearAfterDays);if(e===null)return;let t=setTimeout(()=>h(e=>e+1),Math.min(Math.max(e-u.current(),0)+50,$c));return()=>clearTimeout(t)},[p,v,i,d,m,c]);let y=e.blocked!==!0,b=y&&g&&!!p&&!v,x=y&&g&&p&&!v&&!o&&!s?p:null,S=J(x);S.current=x;let C=G((e,t)=>{if(c)return;let n={id:e.variant.id,contentHash:e.variant.contentHash};Xc(i,d,e.slotId,n,t,u.current()),h(e=>e+1)},[i,d,c]);K(()=>{!x||c||Yc(i,d,x.slotId,{id:x.variant.id,contentHash:x.variant.contentHash},u.current())},[x,i,d,c]);let w=J(null);K(()=>{if(!o){w.current=x;return}let e=w.current;w.current=null,e&&C(e,`open`)},[o,x,C]);let T=G(e=>{let t=S.current;t&&C(t,e)},[C]);return q(()=>({active:f,top:p,shown:x,unread:b,markRead:T}),[f,p,x,b,T])}var tl={" ":` `,"<":`<`,">":`>`,""":`"`,"'":`'`,"'":`'`,"&":`&`};function nl(e){return e.replace(/&#(\d+);/g,(e,t)=>{let n=Number(t);return Number.isFinite(n)?String.fromCodePoint(n):e}).replace(/ |<|>|"|'|'/gi,e=>tl[e.toLowerCase()]??e).replace(/&/gi,`&`)}function rl(e){return e?/[<&]/.test(e)?nl(e.replace(/<li[^>]*>/gi,`
|
|
89
|
+
`)}\n\n---\n${d}\n`}function Ni(e){return e?`wexio:news-last-read:${e}`:`wexio:news-last-read`}function Pi(e,t){return e?e!==t:!1}function Fi({enabled:e,locale:t}){let n=I(),r=n.publicKey,i=n.storage,{data:a}=tn({variables:{args:{locale:t,limit:1}},skip:!e}),o=a?.visitorNewsList?.items?.[0]?._id??null,[s,c]=Y(null);K(()=>{if(!(typeof window>`u`))try{c(i.getItem(Ni(r)))}catch{c(null)}},[r,i]);let l=G(()=>{if(o){c(o);try{i.setItem(Ni(r),o)}catch{}}},[o,r,i]);return{hasUnread:e&&Pi(o,s),markRead:l}}var Ii=class extends Error{constructor(e=`permanent outbox failure`){super(e),this.name=`PermanentOpError`}},Li=`wexio-outbox`,Ri=`queues`,zi=1;function Bi(e,t){return[...e.filter(e=>!(e.clientKey===t.clientKey||t.semantics===`convergence`&&t.convergenceKey!==void 0&&e.semantics===`convergence`&&e.convergenceKey===t.convergenceKey)),t]}function Vi(e,t,n){return e.map(e=>e.clientKey===t?{...e,...n}:e)}function Hi(e,t){return e.filter(e=>e.clientKey!==t)}function Ui(e,t){let n=e.filter(e=>!(e.semantics===`beacon`&&e.expiresAt!=null&&e.expiresAt<=t));return n.length===e.length?e:n}function Wi(e){return e.filter(e=>e.status!==`sending`).sort((e,t)=>e.createdAt-t.createdAt)}function Gi(e){return e.filter(e=>e.semantics!==`beacon`)}function Ki(e){return Math.min(6e4,2e3*2**Math.max(0,e-1))}function qi(e){return!!e&&typeof e==`object`&&typeof e.clientKey==`string`&&typeof e.op==`string`&&typeof e.createdAt==`number`}function Ji(){let e=new Map;return{load:t=>Promise.resolve((e.get(t)??[]).filter(qi)),save:(t,n)=>(n.length===0?e.delete(t):e.set(t,n),Promise.resolve())}}function Yi(){return typeof indexedDB>`u`?Promise.resolve(null):new Promise(e=>{let t;try{t=indexedDB.open(Li,zi)}catch{e(null);return}t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(Ri)||e.createObjectStore(Ri)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)})}async function Xi(e){if(!e)return[];let t=await Yi();return t?new Promise(n=>{try{let r=t.transaction(Ri,`readonly`).objectStore(Ri).get(e);r.onsuccess=()=>{let e=r.result;n(Array.isArray(e)?e.filter(qi):[])},r.onerror=()=>n([])}catch{n([])}}):[]}async function Zi(e,t){if(!e)return;let n=await Yi();if(n)return new Promise(r=>{try{let i=n.transaction(Ri,`readwrite`),a=i.objectStore(Ri);t.length===0?a.delete(e):a.put(t,e),i.oncomplete=()=>r(),i.onerror=()=>r(),i.onabort=()=>r()}catch{r()}})}var Qi={load:Xi,save:Zi};function $i(){return typeof indexedDB>`u`?Ji():Qi}function ea(e,t=$i(),n={}){let r=[],i=!1,a=new Set,o=()=>{for(let e of a)e(r)},s=(n.crossTab??!0)&&typeof BroadcastChannel<`u`?new BroadcastChannel(`${Li}:${e}`):null;return s&&(s.onmessage=async()=>{r=await t.load(e),o()}),{get:()=>r,set:n=>{i=!0,r=n,t.save(e,Gi(n)),s?.postMessage(`changed`),o()},subscribe:e=>(a.add(e),()=>a.delete(e)),ready:t.load(e).then(e=>{if(!i&&e.length>0){let t=Date.now();r=e.map(e=>e.status===`sending`&&(e.sendingSince===void 0||e.sendingSince>t||t-e.sendingSince>12e4)?{...e,status:`queued`}:e),o()}}),dispose:()=>{a.clear(),s?.close()}}}function ta(){try{if(typeof crypto<`u`&&`randomUUID`in crypto)return crypto.randomUUID()}catch{}return`ck-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function na(){return typeof navigator<`u`&&!navigator.onLine}function ra({publicKey:e,enabled:t,isolated:n=!1,paused:r=!1,run:i,onSent:a,isPermanent:o,onDropped:s}){let[c,l]=Y([]),[u,d]=Y(typeof navigator>`u`?!0:navigator.onLine),f=J(i),p=J(a),m=J(o),h=J(s);K(()=>{f.current=i,p.current=a,m.current=o,h.current=s});let g=J(null),_=J(!1),v=J(r);v.current=r;let y=J(null),b=J(()=>{});b.current=G(()=>{let e=g.current;!e||_.current||na()||v.current||(_.current=!0,(async()=>{try{for(;!(na()||v.current);){let t=Date.now(),n=Ui(e.get(),t);n!==e.get()&&e.set(n);let r=Wi(e.get()),i=r.find(e=>(e.nextAttemptAt??0)<=t);if(!i){let e=r.reduce((e,t)=>Math.min(e,t.nextAttemptAt??0),1/0);e!==1/0&&e>t&&(y.current&&clearTimeout(y.current),y.current=setTimeout(()=>b.current(),e-t));break}e.set(Vi(e.get(),i.clientKey,{status:`sending`,sendingSince:Date.now()}));try{let t=await f.current(i,{patch:t=>e.set(Vi(e.get(),i.clientKey,{payload:t}))});p.current(i,t),e.set(Hi(e.get(),i.clientKey))}catch(t){if(t instanceof Ii||m.current?.(t)===!0)e.set(Hi(e.get(),i.clientKey)),h.current?.(i,t);else{let t=i.attempts+1;e.set(Vi(e.get(),i.clientKey,{status:`failed`,attempts:t,nextAttemptAt:Date.now()+Ki(t)}))}}}}finally{_.current=!1}})())},[]),K(()=>{if(!t||!e){l([]);return}let r=n?ea(e,Ji(),{crossTab:!1}):ea(e);g.current=r,l(r.get());let i=r.subscribe(e=>l(e));return r.ready.then(()=>{l(r.get()),b.current()}),()=>{i(),r.dispose(),g.current=null}},[t,e,n]);let x=J(r);return K(()=>{let e=x.current;if(x.current=r,r||!e)return;y.current&&clearTimeout(y.current);let t=g.current;if(t){let e=t.get().map(e=>({...e,nextAttemptAt:0}));e.length>0&&t.set(e)}b.current()},[r]),K(()=>{if(typeof window>`u`)return;let e=()=>{d(!0),y.current&&clearTimeout(y.current);let e=g.current;if(e){let t=e.get().map(e=>({...e,nextAttemptAt:0}));t.length>0&&e.set(t)}b.current()},t=()=>d(!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,t),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,t)}},[]),K(()=>()=>{y.current&&clearTimeout(y.current)},[]),{ops:c,online:u,enqueue:G(e=>{let t={clientKey:ta(),op:e.op,semantics:e.semantics,...e.convergenceKey===void 0?{}:{convergenceKey:e.convergenceKey},payload:e.payload,createdAt:Date.now(),status:`queued`,attempts:0,...e.semantics===`beacon`&&e.ttlMs!==void 0?{expiresAt:Date.now()+e.ttlMs}:{}},n=g.current;return n&&(n.set(Bi(n.get(),t)),b.current()),t},[]),retry:G(e=>{let t=g.current;t&&(y.current&&clearTimeout(y.current),t.set(Vi(t.get(),e,{status:`queued`,attempts:0,nextAttemptAt:0})),b.current())},[]),discard:G(e=>{let t=g.current;t&&t.set(Hi(t.get(),e))},[]),clear:G(()=>{y.current&&clearTimeout(y.current);let t=g.current;t?t.set([]):e&&Zi(e,[])},[e])}}Array.from({length:21},(e,t)=>`wx-nt_${t+1}`);var ia=`wx-nt_`;function aa(e){return e?e.startsWith(`http://`)||e.startsWith(`https://`)?e:e.startsWith(ia)?O(`/sounds/${e}.mp3`):null:null}var oa=`wexio:sound-muted`;function sa(e){let t=I().storage,[n,r]=Y(!1),i=J(null),a=J(null);K(()=>{typeof window>`u`||r(t.getItem(oa)===`1`)},[t]),K(()=>{if(typeof window>`u`)return;i.current?.pause(),a.current?.pause();let t=aa(e?.inboundSoundId),n=aa(e?.outboundSoundId),r=typeof e?.volume==`number`?Math.max(0,Math.min(1,e.volume)):.5;return i.current=t?ca(t,r):null,a.current=n?ca(n,r):null,()=>{i.current?.pause(),a.current?.pause()}},[e]);let o=G(()=>{r(e=>{let n=!e;try{t.setItem(oa,n?`1`:`0`)}catch{}return n})},[t]),s=G(t=>{if(n||e&&e.enabled===!1)return;let r=t===`inbound`?i.current:a.current;r&&(r.currentTime=0,r.play().catch(()=>{}))},[n,e]);return{muted:n,toggleMuted:o,playInbound:()=>s(`inbound`),playOutbound:()=>s(`outbound`)}}function ca(e,t){let n=new Audio;return n.preload=`none`,n.volume=t,n.src=e,n}function la(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>Object.hasOwn(t,n)&&la(e[n],t[n])):!1}function ua(e){let t=J(void 0),n=J(!1);return(!n.current||!la(t.current,e))&&(t.current=e,n.current=!0),t.current}function da(e,t){let[n,r]=Y(`dark`),i=Te(),a=i.themeRoot,o=i.themeOverride,s=i.kind,c=I().storage;return K(()=>{let n=new URL(window.location.href).searchParams.get(`theme`),i=e&&fa(e)?e:null,l=t?.allowed!==!1,u=t?.preference&&fa(t.preference)?t.preference:null,d=(()=>{if(!l)return null;try{let e=c.getItem(`wexio:theme`);return e&&fa(e)?e:null}catch{return null}})(),f=()=>{if(o&&fa(o))return o;if(n&&fa(n))return n;if(l){if(u&&u!==`auto`)return u;if(d&&d!==`auto`&&!u)return d}return i&&i!==`auto`?i:`auto`};if(l&&u)try{c.setItem(`wexio:theme`,u)}catch{}let p=f(),m=a??document.documentElement,h=()=>{let e=p===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:p;m.dataset.theme=e,r(e)};h();let g=window.matchMedia(`(prefers-color-scheme: dark)`),_=()=>p===`auto`&&h();g.addEventListener?.(`change`,_);let v=e=>{if(!gt(e,s)||!e.data||typeof e.data!=`object`||e.data.type!==`wexio:preview-theme-mode:v1`&&e.data.type!==`wexio:theme:v1`)return;let t=e.data.mode;t&&fa(t)&&(p=t,h())};return window.addEventListener(`message`,v),()=>{g.removeEventListener?.(`change`,_),window.removeEventListener(`message`,v)}},[e,a,o,s,t?.preference,t?.allowed,c]),n}function fa(e){return e===`light`||e===`dark`||e===`auto`}function pa({enabled:e,refetch:t,onSettled:n}){let r=J(e),i=J(t),a=J(n),o=J(!1);K(()=>{r.current=e,i.current=t,a.current=n});let s=G(async()=>{if(!r.current||o.current)return;o.current=!0;let e=Date.now();try{await i.current(),a.current(e)}catch{}finally{o.current=!1}},[]);return K(()=>{if(!e||typeof window>`u`)return;let t=()=>void s(),n=()=>{document.hidden||s()};return window.addEventListener(`online`,t),document.addEventListener(`visibilitychange`,n),()=>{window.removeEventListener(`online`,t),document.removeEventListener(`visibilitychange`,n)}},[e,s]),s}var ma=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,ha=`wexio-turnstile-script`,ga=null;function _a(){return typeof window>`u`?Promise.reject(Error(`turnstile: no window`)):window.turnstile?Promise.resolve():ga||(ga=new Promise((e,t)=>{let n=document.getElementById(ha);if(n){if(window.turnstile)return e();n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,()=>t(Error(`turnstile: script load error`)),{once:!0});return}let r=document.createElement(`script`);r.id=ha,r.src=ma,r.async=!0,r.defer=!0,r.addEventListener(`load`,()=>e(),{once:!0}),r.addEventListener(`error`,()=>{r.remove(),t(Error(`turnstile: script load error`))},{once:!0}),document.head.appendChild(r)}).catch(e=>{throw ga=null,e}),ga)}function va(e){let{siteKey:t,theme:n,position:r=`right`}=e,i=J(null),a=J(n);return K(()=>{a.current=n},[n]),K(()=>{if(typeof document>`u`)return;let e=document.createElement(`div`);return e.style.position=`fixed`,e.style.bottom=`88px`,r===`left`?e.style.left=`16px`:e.style.right=`16px`,e.style.zIndex=`60`,document.body.appendChild(e),i.current=e,()=>{e.remove(),i.current=null}},[r]),{getToken:G(async()=>{if(!t)return;await _a();let e=i.current,n=typeof window<`u`?window.turnstile:void 0;if(!e||!n)throw Error(`turnstile: not ready`);return new Promise((r,i)=>{let a=n.render(e,{sitekey:t,execution:`render`,appearance:`interaction-only`,retry:`auto`,"refresh-expired":`auto`,callback:e=>{r(e);try{n.remove(a)}catch{}},"error-callback":()=>{try{n.remove(a)}catch{}i(Error(`turnstile: error`))},"expired-callback":()=>{try{n.remove(a)}catch{}i(Error(`turnstile: expired before submission`))},"timeout-callback":()=>{try{n.remove(a)}catch{}i(Error(`turnstile: timeout`))}})})},[t])}}function ya(e,t){if(typeof window>`u`)return`en`;if(!t?.ignoreVisitorOverrides){let e=xa(new URL(window.location.href).searchParams.get(`lang`));if(e)return e;let t=xa(Sa(`wexio-locale`));if(t)return t}if(e&&e!==`AUTO`&&e!==`WEBSITE`){let t=xa(e);if(t)return t}else if(e===`WEBSITE`){let e=xa(document.documentElement.lang);if(e)return e}return xa(navigator.language)||`en`}var ba=new Map(y.map(e=>[e.toLowerCase(),e]));function xa(e){if(!e)return null;let t=e.toLowerCase().replace(/_/g,`-`),n=ba.get(t);if(n)return n;let r=t.split(`-`)[0];return ba.get(r)??null}function Sa(e){let t=document.cookie.split(`;`);for(let n of t){let[t,...r]=n.trim().split(`=`);if(t===e)return decodeURIComponent(r.join(`=`))}return null}var Ca=2147483647,wa=5e3,Ta=6e4,Ea=15*6e4;function Da(e,t,n){let r=(e,t=Ea)=>({delayMs:Math.min(t,e*2**Math.min(n,10)),streak:n+1});if(typeof e!=`number`||!Number.isFinite(e)||e<=0)return r(Ta);let i=(e-t)*1e3;return i<wa?r(wa,Math.min(Ea,Math.max(wa,e*1e3-wa))):{delayMs:Math.min(Ca,i),streak:0}}var Oa=`network_unreachable`,ka=`preview_visitor_limit`;function Aa(e){if(!e||typeof e!=`object`)return!1;let t=e;if(Array.isArray(t.graphQLErrors)&&t.graphQLErrors.length>0)return!1;if(t.networkError)return!0;let n=typeof t.message==`string`?t.message:``;return/failed to fetch|networkerror|network request failed|load failed|err_|fetch/i.test(n)}var ja=e=>e?`wexio:visitor-id:${e}`:`wexio:visitor-id`,Ma=e=>e?`wexio:visitor-session:${e}`:`wexio:visitor-session`,Na=`wexio:visitor-id`,Pa=`wexio:visitor-session`;function Fa(e,t=ae(),n=ve(`local`)){if(!(typeof window>`u`))try{let r={token:e.token,chatId:e.chatId,peopleId:e.peopleId,displayName:e.displayName,expiresAt:Date.now()+e.expiresIn*1e3};n.setItem(Ma(t),JSON.stringify(r))}catch{}}function Ia(e,t){if(typeof window>`u`)return null;try{let n=t.getItem(Ma(e));if(!n&&e){let r=t.getItem(Pa);r&&(t.setItem(Ma(e),r),t.removeItem(Pa),n=r)}if(!n)return null;let r=JSON.parse(n);return typeof r?.token!=`string`||typeof r?.expiresAt!=`number`||r.expiresAt-Ra*1e3<=Date.now()?(t.removeItem(Ma(e)),null):r}catch{return null}}function La(e,t){if(!(typeof window>`u`))try{t.removeItem(Ma(e)),t.removeItem(Pa)}catch{}}var Ra=30,za=120,Ba=3e4,Va=`wexio:prechat-submitted:`;function Ha(e=ee()){e.token=null;let t=e.publicKey,n=e.storage;if(La(t,n),!(typeof window>`u`))try{n.removeItem(ja(t)),n.removeItem(Na);for(let e=n.length-1;e>=0;e--){let t=n.key(e);t?.startsWith(Va)&&n.removeItem(t)}}catch{}}function Ua(e){let[t,n]=Y({token:null,chatId:null,peopleId:null,displayName:null,isAuthenticating:e.enabled,error:null,verified:!1,blocked:!1}),r=I(),{token:i,holding:a}=Ce(),o=e.enabled&&!a,[s,c]=Y(i);s!==i&&(c(i),r.token=null,n({token:null,chatId:null,peopleId:null,displayName:null,isAuthenticating:o,error:null,verified:!1,blocked:!1}));let[l]=Be(),[u]=We(),d=J(e.identity??null);d.current=i?null:e.identity??null;let f=J(e.getTurnstileToken);f.current=e.getTurnstileToken;let p=J(null),m=J(!1),h=J(0),g=J(0),_=G(async e=>{if(r.preview.paused){n(e=>({...e,isAuthenticating:!1}));return}if(m.current){n(e=>({...e,isAuthenticating:!1,error:ka}));return}n(e=>({...e,isAuthenticating:!0,error:null}));try{let t=Ga(r.publicKey,r.storage),i=r.preview.active?null:d.current,a=ya(),o;try{o=await f.current?.()??void 0}catch(t){if(e.current)return;n(e=>({...e,isAuthenticating:!1,error:`turnstile_failed:${t.message}`}));return}if(e.current)return;let s;if(i&&(i.googleIdToken||i.jwt||i.userId&&i.userHash)){let n=await u({variables:{input:{visitorId:t,...i.googleIdToken?{googleIdToken:i.googleIdToken}:i.jwt?{jwt:i.jwt}:{userId:i.userId,userHash:i.userHash},name:i.name,email:i.email,phone:i.phone,contextSnapshot:JSON.stringify({...i.attributes&&typeof i.attributes==`object`?i.attributes:{},locale:a}),turnstileToken:o}}});if(e.current)return;s=n.data?.startIdentifiedVisitor}else{let n=await l({variables:{input:{visitorId:t,turnstileToken:o,contextSnapshot:JSON.stringify({locale:a})}}});if(e.current)return;s=n.data?.startAnonymousVisitor}if(!s&&r.preview.paused){n(e=>({...e,isAuthenticating:!1,error:null}));return}if(!s){n(e=>({...e,isAuthenticating:!1,error:`handshake_empty_response`}));return}if(s.visitorId&&s.visitorId!==t)try{r.storage.setItem(ja(r.publicKey),s.visitorId)}catch{}r.token=s.token,n({token:s.token,chatId:s.chatId,peopleId:s.peopleId,displayName:s.displayName,isAuthenticating:!1,error:null,verified:s.kind===`identified`,blocked:s.blocked??!1}),s.kind===`identified`?Fa({token:s.token,chatId:s.chatId,peopleId:s.peopleId,displayName:s.displayName,expiresIn:s.expiresIn},r.publicKey,r.storage):La(r.publicKey,r.storage);let c=Da(s.expiresIn,Ra,h.current);h.current=c.streak;let m=c.delayMs;r.preview.active&&typeof s.expiresIn==`number`&&s.expiresIn<za&&(r.preview.requestRefresh(),m=Math.max(Ba,m)),p.current&&clearTimeout(p.current),g.current=Date.now()+m,p.current=setTimeout(()=>{e.current||_(e)},m)}catch(t){if(e.current)return;if(be(t,Ot.previewVisitorLimit)){m.current=!0,n({token:null,chatId:null,peopleId:null,displayName:null,isAuthenticating:!1,error:ka,verified:!1,blocked:!1});return}let i=r.preview.paused;n({token:null,chatId:null,peopleId:null,displayName:null,isAuthenticating:!1,error:i?null:Aa(t)?Oa:t.message,verified:!1,blocked:!1})}},[l,u,r]),v=i?null:e.identity,y=v?.googleIdToken?`google:${v.googleIdToken}`:v?.jwt?`jwt:${v.jwt}`:v?.userId&&v?.userHash?`${v.userId}:${v.userHash}`:null,b=J(e.epoch);return K(()=>{b.current!==e.epoch&&(b.current=e.epoch,h.current=0,r.token=null,n({token:null,chatId:null,peopleId:null,displayName:null,isAuthenticating:o,error:null,verified:!1,blocked:!1}))},[e.epoch,o,r]),K(()=>{if(!o){n(e=>({...e,isAuthenticating:!1}));return}if(typeof window>`u`)return;let e={current:!1};h.current=0;let t=d.current||i?null:Ia(r.publicKey,r.storage);if(t){r.token=t.token,n({token:t.token,chatId:t.chatId,peopleId:t.peopleId,displayName:t.displayName,isAuthenticating:!1,error:null,verified:!0,blocked:!1});let i=Math.min(Ca,Math.max(0,t.expiresAt-Date.now()));g.current=t.expiresAt,p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{e.current||(La(r.publicKey,r.storage),_(e))},i)}else _(e);let a=()=>{e.current||typeof document>`u`||document.hidden||g.current!==0&&Date.now()>=g.current&&_(e)};return document.addEventListener(`visibilitychange`,a),()=>{e.current=!0,document.removeEventListener(`visibilitychange`,a),p.current&&(clearTimeout(p.current),p.current=null)}},[o,_,y,e.epoch,r,i]),K(()=>{if(!o||typeof window>`u`)return;let e=!1,t={current:!1};return r.onUnauthorized=()=>{e||(e=!0,La(r.publicKey,r.storage),r.token=null,_(t).finally(()=>{e=!1}))},r.onIntegrationMismatch=()=>{if(!e){e=!0,La(r.publicKey,r.storage),r.token=null;try{let e=r.publicKey;r.storage.removeItem(ja(e))}catch{}_(t).finally(()=>{e=!1})}},()=>{t.current=!0,r.onUnauthorized=null,r.onIntegrationMismatch=null}},[o,e.epoch,_,r]),t}function Wa(e){let[t,n]=Y({identity:null,prefill:null});return K(()=>{if(e.visitorIdentity||e.visitorPrefill||typeof window>`u`)return;let t=t=>{if(!gt(t,e.kind))return;let r=t.data;if(!(!r||typeof r!=`object`))if(r.type===`wexio:identify:v1`){let e=r.user;if(!e||typeof e!=`object`)return;let t=typeof e.googleIdToken==`string`,i=typeof e.jwt==`string`,a=typeof e.userId==`string`&&typeof e.userHash==`string`;if(!t&&!i&&!a)return;n(n=>({...n,identity:{googleIdToken:t?e.googleIdToken:void 0,jwt:i?e.jwt:void 0,userId:typeof e.userId==`string`?e.userId:void 0,userHash:typeof e.userHash==`string`?e.userHash:void 0,name:typeof e.name==`string`?e.name:void 0,email:typeof e.email==`string`?e.email:void 0,phone:typeof e.phone==`string`?e.phone:void 0,attributes:e.attributes&&typeof e.attributes==`object`?e.attributes:void 0}}))}else if(r.type===`wexio:prefill:v1`){let e=r.prefill;if(!e||typeof e!=`object`)return;n(t=>({...t,prefill:{name:typeof e.name==`string`?e.name:void 0,email:typeof e.email==`string`?e.email:void 0,phone:typeof e.phone==`string`?e.phone:void 0}}))}else r.type===`wexio:shutdown:v1`&&n({identity:null,prefill:null})};return window.addEventListener(`message`,t),window.parent?.postMessage({type:`wexio:widget:ready:v1`},`*`),()=>window.removeEventListener(`message`,t)},[e.kind,e.visitorIdentity,e.visitorPrefill]),{identity:e.visitorIdentity??t.identity,prefill:e.visitorPrefill??t.prefill}}function Ga(e=ae(),t=ve(`local`)){try{let n=ja(e),r=t.getItem(n);if(r)return r;if(e){let e=t.getItem(Na);if(e)return t.setItem(n,e),t.removeItem(Na),e}let i=Ka();return t.setItem(n,i),i}catch{return Ka()}}function Ka(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<`u`&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let t=0;t<16;t++)e[t]=Math.floor(Math.random()*256);return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}var qa={themeMode:null,language:null,desktopNotifications:!1},Ja=new Set;function Ya(e,t){if(qa[e]!==t){qa={...qa,[e]:t};for(let e of Ja)e(qa)}}function Xa(){let[e,t]=Y(qa);return K(()=>(Ja.add(t),t(qa),()=>{Ja.delete(t)}),[]),e}var Za=null,Qa=new Set;function $a(e){if(Ye(e)&&Za!==e){Za=e;for(let t of Qa)t(e)}}var eo=new Set;function to(e){if(e){$a(e);return}let t=Za!==null;if(Za=null,t)for(let e of eo)e()}function no(e){return eo.add(e),()=>{eo.delete(e)}}function ro(e){return Qa.add(e),()=>{Qa.delete(e)}}var io={en:()=>import(`./widget-react-CkrkZ3pp.js`).then(e=>e.n).then(e=>e.default),"en-US":()=>import(`./widget-react-BXlRglvP2.js`).then(e=>e.default),"en-GB":()=>import(`./widget-react-DdIv5LKJ2.js`).then(e=>e.default),uk:()=>import(`./widget-react-DV3BZAN0.js`).then(e=>e.default),de:()=>import(`./widget-react-RWR7XGaa.js`).then(e=>e.default),es:()=>import(`./widget-react-CrWgGrOv2.js`).then(e=>e.default),"es-MX":()=>import(`./widget-react-Ci-9Gtq-2.js`).then(e=>e.default),fr:()=>import(`./widget-react-CTr72oJP2.js`).then(e=>e.default),it:()=>import(`./widget-react-D71FBbwd.js`).then(e=>e.default),nl:()=>import(`./widget-react-BZ7sDBzB.js`).then(e=>e.default),pt:()=>import(`./widget-react-BJLMVdT8.js`).then(e=>e.default),"pt-BR":()=>import(`./widget-react-CVu0iQzo.js`).then(e=>e.default),sv:()=>import(`./widget-react-CESpzeFW.js`).then(e=>e.default),da:()=>import(`./widget-react-DtxeNDUn.js`).then(e=>e.default),no:()=>import(`./widget-react-DpT7-wmd.js`).then(e=>e.default),fi:()=>import(`./widget-react-DSej45hO2.js`).then(e=>e.default),pl:()=>import(`./widget-react--SnHxPOY.js`).then(e=>e.default),cs:()=>import(`./widget-react-oMWtXf4y.js`).then(e=>e.default),sk:()=>import(`./widget-react-x1O7Aw-0.js`).then(e=>e.default),tr:()=>import(`./widget-react-C7ABw9U-.js`).then(e=>e.default),ro:()=>import(`./widget-react-B4O9LryX.js`).then(e=>e.default),hu:()=>import(`./widget-react-D3JyG2-s.js`).then(e=>e.default),el:()=>import(`./widget-react-DFBUOrVn2.js`).then(e=>e.default),ar:()=>import(`./widget-react-CCfIguE3.js`).then(e=>e.default),he:()=>import(`./widget-react-DR9wD8RF2.js`).then(e=>e.default),hi:()=>import(`./widget-react-CiXpsVM3.js`).then(e=>e.default),th:()=>import(`./widget-react-DySiCebV.js`).then(e=>e.default),vi:()=>import(`./widget-react-G5Axrzd4.js`).then(e=>e.default),id:()=>import(`./widget-react-CO_-SXaO.js`).then(e=>e.default),ja:()=>import(`./widget-react-BDwkTnhP.js`).then(e=>e.default),ko:()=>import(`./widget-react-JRr_KL3e.js`).then(e=>e.default),zh:()=>import(`./widget-react-D8sZCT6W.js`).then(e=>e.default),"zh-TW":()=>import(`./widget-react-bxGcWjbs.js`).then(e=>e.default)};async function ao(e){return(io[e]??io.en)()}var oo={themeMode:null,themeModeEditable:!0,language:null,desktopNotifications:!1,loaded:!1};function so(e){let{data:t}=sr({skip:!e.enabled||!!e.isDummy}),n=t?.visitorProfile,r=Xa(),i=e.isDummy?{themeMode:r.themeMode,themeModeEditable:!0,language:r.language,desktopNotifications:r.desktopNotifications,loaded:!0}:n?{themeMode:co(n.preferences.themeMode),themeModeEditable:n.themeModeEditable,language:n.preferences.language??null,desktopNotifications:!!n.preferences.desktopNotifications,loaded:!0}:e.enabled?oo:{...oo,loaded:!0};return K(()=>{if(i.loaded&&i.language){try{document.cookie=`wexio-locale=${encodeURIComponent(i.language)}; path=/; max-age=${3600*24*365}; samesite=lax`}catch{}$a(i.language)}},[i.loaded,i.language]),i}function co(e){if(typeof e!=`string`)return null;let t=e.toLowerCase();return t===`light`||t===`dark`?t:t===`auto`||t===`system`?`auto`:null}function lo(e,t,n){let r=!1,i=t.preview.token,a=a=>{if(!t.preview.active)return;if(a instanceof MessageEvent){if(typeof a.data!=`string`)return;try{let e=pe(JSON.parse(a.data));e&&t.preview.report(e,i)}catch{}return}if(e.readyState!==2||r||!t.publicKey)return;r=!0;let o=i;Si({publicKey:t.publicKey,token:n,previewToken:o}).then(e=>{e.kind===`unauthorized`&&e.previewReason&&t.preview.report(e.previewReason,o)})};return e.addEventListener(`error`,a),()=>e.removeEventListener(`error`,a)}var uo=3e3,fo=6e4,po=1e4;function mo({token:e,visitorId:t=null,enabled:n=!0,epoch:r=0,onUpdate:i,onAdd:a,onReopen:o}){let s=I(),c=J(i);K(()=>{c.current=i},[i]);let l=J(a);K(()=>{l.current=a},[a]);let u=J(o);K(()=>{u.current=o},[o]);let d=J(!1),f=J(!0),p=J(e);p.current=e;let m=!!e;K(()=>{if(!n||!m||typeof window>`u`)return;let e=s.publicKey;if(!e)return;let t=!1,r=0,i,a,o=()=>{},h=()=>{let n=p.current;if(!n)return;let m=`${re()}/api/web/realtime/threads?token=${encodeURIComponent(n)}&publicKey=${encodeURIComponent(e)}`,g=new EventSource(m,{withCredentials:!1}),_=e=>{try{c.current(JSON.parse(e.data))}catch{console.warn(`[wexio] unparseable threadUpdated frame`,e.data)}},v=e=>{try{l.current?.(JSON.parse(e.data))}catch{console.warn(`[wexio] unparseable threadAdded frame`,e.data)}},y=()=>{d.current&&f.current&&(f.current=!1,u.current?.()),d.current=!0,clearTimeout(a),a=setTimeout(()=>{r=0,f.current=!0},po)},b=e=>{e instanceof MessageEvent||(clearTimeout(a),o(),!t&&(i=setTimeout(h,Math.min(fo,uo*2**r)),r+=1))};g.addEventListener(`open`,y),g.addEventListener(`threadUpdated`,_),g.addEventListener(`threadAdded`,v);let x=lo(g,s,n);g.addEventListener(`error`,b),o=()=>{x(),g.removeEventListener(`open`,y),g.removeEventListener(`threadUpdated`,_),g.removeEventListener(`threadAdded`,v),g.removeEventListener(`error`,b),g.close()}};return h(),()=>{t=!0,clearTimeout(i),clearTimeout(a),o()}},[m,t,n,r,s])}function ho({chatId:e,token:t,visitorId:n=null,enabled:r=!0,onMessage:i}){let a=I(),o=J(i);K(()=>{o.current=i},[i]);let s=J(t);s.current=t;let c=!!t;K(()=>{if(!r||!e||!c||typeof window>`u`)return;let t=a.publicKey;if(!t)return;let n=!1,i=0,l,u,d=()=>{},f=()=>{let r=s.current;if(!r)return;let c=`${re()}/api/web/realtime/${encodeURIComponent(e)}?token=${encodeURIComponent(r)}&publicKey=${encodeURIComponent(t)}`,p=new EventSource(c,{withCredentials:!1}),m=e=>{try{let t=JSON.parse(e.data);o.current(t)}catch{console.warn(`[wexio] unparseable SSE frame`,e.data)}},h=e=>{try{let t=JSON.parse(e.data);o.current({...t,update:!0})}catch{console.warn(`[wexio] unparseable SSE frame`,e.data)}},g=()=>{clearTimeout(u),u=setTimeout(()=>{i=0},po)},_=e=>{e instanceof MessageEvent||(clearTimeout(u),d(),!n&&(l=setTimeout(f,Math.min(fo,uo*2**i)),i+=1))};p.addEventListener(`open`,g),p.addEventListener(`message`,m),p.addEventListener(`messageUpdate`,h);let v=lo(p,a,r);p.addEventListener(`error`,_),d=()=>{v(),p.removeEventListener(`open`,g),p.removeEventListener(`message`,m),p.removeEventListener(`messageUpdate`,h),p.removeEventListener(`error`,_),p.close()}};return f(),()=>{n=!0,clearTimeout(l),clearTimeout(u),d()}},[e,c,n,r,a])}function go(e){let[t,n]=Y(!1),[r,i]=Y(!1);return K(()=>(e.onUnavailable=()=>{n(!0),(e.publicKey?xt(e.publicKey):Promise.resolve()).finally(()=>i(!0))},()=>{e.onUnavailable=null}),[e]),{unavailable:t,evicted:r}}var _o={status:null};function vo(e){let t=e.assignment;return t?t.assignedStatus===`connected`?{status:`connected`,...t.operator?{operator:t.operator}:{}}:t.assignedStatus===`pending`?{status:`pending`,...t.estimate?{estimate:t.estimate}:{}}:{status:null}:null}function yo(e,t,n=new Date){let r=new Date(e);if(Number.isNaN(r.getTime()))return``;let i=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),a=new Intl.DateTimeFormat(t,{hour:`numeric`,minute:`2-digit`}).format(r);if(i(r,n))return a;let o=new Date(n);return o.setDate(n.getDate()+1),i(r,o)?`${new Intl.RelativeTimeFormat(t,{numeric:`auto`}).format(1,`day`)}, ${a}`:`${new Intl.DateTimeFormat(t,{weekday:`short`}).format(r)}, ${a}`}function bo(e){let t=e.assignment;if(!t?.messageId)return null;let n={id:t.messageId,direction:`OUTBOUND`,text:``,ageLabel:``,...e.sentAt?{createdAt:e.sentAt}:{},sender:{kind:`system`,name:`System`}};return t.assignedStatus===`connected`?{...n,system:{type:`OPERATOR_CONNECTED`,...t.operator?.name?{operatorName:t.operator.name}:{},...t.operator?.avatar?{operatorAvatar:t.operator.avatar}:{}}}:t.assignedStatus===null?{...n,system:{type:`CHAT_RESOLVED`,...t.initiator?{initiator:t.initiator}:{}}}:null}function xo(e,t,n){if(e.basis===`business_hours`)return e.availableAt?t(`assignment.eta.businessHours`,{time:yo(e.availableAt,n)}):null;if(e.basis===`operator_load`){if(typeof e.etaMinutes==`number`)return t(`assignment.eta.minutes`,{minutes:e.etaMinutes});if(e.soft)return t(`assignment.eta.soft`)}return null}var So=2048,Co=2048;function wo(e){try{let t=new URL(e).protocol;return t===`http:`||t===`https:`}catch{return!1}}function To(e){if(!e.url||!wo(e.url))return;let t=e.title?.slice(0,200),n=e.referrer?.slice(0,Co),r=e.description?.trim().slice(0,500);return{url:e.url.slice(0,So),...t?{title:t}:{},...n?{referrer:n}:{},...r?{description:r}:{}}}var Eo=null;function Do(e){if(!gt(e,`iframe`))return;let t=e.data;!t||typeof t!=`object`||t.type!==`wexio:host-navigation:v1`||typeof t.url==`string`&&(Eo={url:t.url,title:typeof t.title==`string`?t.title:void 0,referrer:typeof t.referrer==`string`?t.referrer:void 0,description:typeof t.description==`string`?t.description:void 0})}typeof window<`u`&&window.addEventListener(`message`,Do);function Oo(){return document.querySelector(`meta[name="description"]`)?.getAttribute(`content`)?.trim()||(document.querySelector(`meta[property="og:description"]`)?.getAttribute(`content`)??void 0)}function ko(e){if(!(typeof window>`u`)){if(e===`iframe`){let e=new URLSearchParams(window.location.search).get(`referer`)??void 0;return To(Eo??{url:e})}return To({url:window.location.href,title:document.title,referrer:document.referrer,description:Oo()})}}var Ao=!1,jo=/(["'`]page["'`]|VisitorPageInput)/;function Mo(e){let t=e??{};return[...t.errors??[],...t.graphQLErrors??[],...t.networkError?.result?.errors??[]].map(e=>e?.message??``)}function No(e){return Mo(e).some(e=>jo.test(e))}async function Po(e){let t=e.options?.variables?.input;if(!t)return e.send(e.options);let{page:n,...r}=t,i=n??e.page,a=t=>({...e.options,variables:{...e.options?.variables,input:t}});if(Ao||!i)return e.send(a(r));let o;try{o=await e.send(a({...r,page:i}))}catch(t){if(!No(t))throw t;return Ao=!0,e.send(a(r))}return No(o)?(Ao=!0,e.send(a(r))):o}function Fo(){let e=Te().kind,[t,n]=et();return[G(n=>Po({send:t,options:n,page:ko(e)}),[t,e]),n]}function Io(e){return e.kind===`home`||e.kind===`messages`||e.kind===`help`||e.kind===`news`||e.kind===`profile`}function Lo(e,t){switch(e.kind){case`messages`:return t.home?{kind:`home`}:t.help?{kind:`help`}:t.news?{kind:`news`}:t.profile?{kind:`profile`}:{kind:`messages`};case`help-category`:return e.origin??{kind:`help`};case`help-article`:return e.origin?e.origin:e.from===`category`&&e.fromCategoryId?{kind:`help-category`,categoryId:e.fromCategoryId}:{kind:`help`};case`news-article`:return e.origin??{kind:`news`};case`messages-thread`:return{kind:`messages`};default:return{kind:`home`}}}function Ro(e,t){return e.kind===`help-article`||e.kind===`news-article`||e.kind===`help-category`?{...e,origin:t}:e}function zo(e,t){return e.kind===`news-article`&&t.kind===`news-article`?{...e,origin:t.origin}:e.kind===`help-article`&&t.kind===`help-article`?{...e,origin:t.origin,...t.origin?{}:{from:t.from,fromCategoryId:t.fromCategoryId}}:Ro(e,t)}function Bo(e){switch(e.kind){case`home`:return`home`;case`messages`:case`messages-thread`:return`messages`;case`help`:case`help-category`:case`help-article`:return`help`;case`news`:case`news-article`:return`news`;case`profile`:return`profile`}}function Vo(e,t){return e===`home`?t.home:e===`messages`?t.messenger:e===`help`?t.help:e===`news`?t.news:!!t.profile}function Ho(e){return+!!e.home+ +!!e.messenger+ +!!e.help+ +!!e.news+ +!!e.profile}function Uo(e,t){if(Vo(e,t))return e;for(let e of[`home`,`messages`,`help`,`news`,`profile`])if(Vo(e,t))return e;return e}function Wo(e){switch(e){case`PHOTO`:return`🖼️`;case`VIDEO`:return`🎥`;case`AUDIO`:return`🎵`;case`VOICE`:return`🎤`;case`FILE`:return`📄`;case`GIF`:return`🎞️`;case`STICKER`:return`🩷`;default:return`📎`}}function Go(e){switch(e){case`PENDING`:return`PENDING`;case`RESOLVED`:return`RESOLVED`;case`CLOSED`:return`CLOSED`;default:return`OPEN`}}function Ko(e){if(typeof e==`string`)return e;if(typeof e==`number`||e instanceof Date){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toISOString()}return``}function qo(e){return e.replace(/<[^>]*>/g,` `).replace(/ /g,` `).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/�*39;|'/g,`'`).replace(/\s+/g,` `).trim()}function Jo(e){let t=e.lastMessagePreview?qo(e.lastMessagePreview):``,n=e.lastMessageMediaType??null,r=e.lastMessageMediaThumbUrl??null,i=Ko(e.lastMessageAt??e.updatedAt),a=!!e.lastMessageFromVisitor;if(t)return{text:t,at:i,fromVisitor:a,...n?{media:!0,mediaType:n,mediaThumbUrl:r}:{}};if(n)return{text:``,at:i,fromVisitor:a,media:!0,mediaType:n,mediaThumbUrl:r};let o=e.lastMessageSenderKind;return e.lastMessageAt&&o&&o!==`system`?{text:``,at:i,fromVisitor:a,media:!0}:null}function Yo(e,t){return{chatId:e.id,threadKey:e.threadKey??null,title:null,status:Go(e.status),blocked:e.blocked??!1,unreadCount:e.unReadCount??0,updatedAt:Ko(e.updatedAt),preview:Jo(e),senderName:t,lastSenderKind:e.lastMessageSenderKind??null,lastSenderName:e.lastMessageSenderName??null}}function Xo(e,t){let n=e?.visitorThreads?.threads;return n?n.map(e=>Yo(e,t)):[]}var Zo=[`status`,`title`,`unreadCount`,`updatedAt`,`preview`,`lastSenderKind`,`lastSenderName`,`blocked`],Qo=e=>e?Date.parse(e):NaN;function $o(e,t){let n=Qo(t.lastMessageAt),r=Qo(e?.preview?.at);if(!Number.isNaN(n)&&!Number.isNaN(r))return n<r;let i=Qo(t.updatedAt),a=Qo(e?.updatedAt);return!Number.isNaN(i)&&!Number.isNaN(a)&&i<a}function es(e){switch(e){case`PENDING`:return`PENDING`;case`RESOLVED`:return`RESOLVED`;case`CLOSED`:return`CLOSED`;default:return`OPEN`}}function ts(e,t,n=Date.now()){let r={...e};return $o(e,t)||(ns(r,t),Zo.some(t=>r[t]!==e?.[t])&&(r.contentAt=n)),t.typing!==void 0&&(r.typing=!!t.typing?.active),t.assignment!==void 0&&(r.assignedStatus=t.assignment?.assignedStatus??null,r.assignedOperatorName=t.assignment?.operator?.name??null),r}function ns(e,t){if(t.status!=null&&(e.status=es(t.status)),t.title!=null&&(e.title=t.title),t.unReadCount!=null&&(e.unreadCount=t.unReadCount),t.updatedAt!=null&&(e.updatedAt=Ko(t.updatedAt)),(t.lastMessagePreview!=null||t.lastMessageAt!=null)&&(e.typing=!1),t.lastMessagePreview!=null||t.lastMessageMediaType!=null){let n=t.lastMessagePreview?qo(t.lastMessagePreview):``,r=t.lastMessageMediaType??null,i=t.lastMessageMediaThumbUrl??null,a=Ko(t.lastMessageAt??t.updatedAt),o=!!t.lastMessageFromVisitor;n?e.preview={text:n,at:a,fromVisitor:o,...r?{media:!0,mediaType:r,mediaThumbUrl:i}:{}}:r?e.preview={text:``,at:a,fromVisitor:o,media:!0,mediaType:r,mediaThumbUrl:i}:t.lastMessageAt!=null&&t.lastMessageSenderKind&&t.lastMessageSenderKind!==`system`&&(e.preview={text:``,at:a,fromVisitor:o,media:!0})}t.lastMessageSenderKind!=null&&(e.lastSenderKind=t.lastMessageSenderKind,e.lastSenderName=t.lastMessageSenderName??null),t.blocked!=null&&(e.blocked=t.blocked)}function rs(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e)){if(a.contentAt!==void 0&&a.contentAt>t){r[i]=a;continue}if(!Zo.some(e=>a[e]!==void 0)){r[i]=a;continue}n=!0;let e={...a};for(let t of Zo)delete e[t];delete e.contentAt,Object.values(e).some(e=>e!==void 0)&&(r[i]=e)}return n?r:e}function is(e,t){if(!t)return e;let n=Qo(t.preview?.at),r=Qo(e.preview?.at),i=!Number.isNaN(n)&&!Number.isNaN(r)&&n<r?void 0:t;return{...e,...i?.status===void 0?{}:{status:i.status},...i?.title===void 0?{}:{title:i.title},...i?.unreadCount===void 0?{}:{unreadCount:i.unreadCount},...i?.updatedAt===void 0?{}:{updatedAt:i.updatedAt},...i?.preview===void 0?{}:{preview:i.preview},...t.typing===void 0?{}:{typing:t.typing},...t.assignedStatus===void 0?{}:{assignedStatus:t.assignedStatus},...t.assignedOperatorName===void 0?{}:{assignedOperatorName:t.assignedOperatorName},...i?.lastSenderKind===void 0?{}:{lastSenderKind:i.lastSenderKind},...i?.lastSenderName===void 0?{}:{lastSenderName:i.lastSenderName},...i?.blocked===void 0?{}:{blocked:i.blocked}}}var as=f(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),os=f(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),ss=f(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),cs=f(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),ls=f(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),us=f(`book`,[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}]]),ds=f(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),fs=f(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),ps=f(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),ms=f(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),hs=f(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),gs=f(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),_s=f(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),vs=f(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),ys=f(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),bs=f(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),xs=f(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ss=f(`gamepad-2`,[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]),Cs=f(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),ws=f(`heart`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]),Ts=f(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),Es=f(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),Ds=f(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Os=f(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),ks=f(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),As=f(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),js=f(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ms=f(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Ns=f(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Ps=f(`message-circle-more`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),Fs=f(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),Is=f(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ls=f(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Rs=f(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),zs=f(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Bs=f(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Vs=f(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),Hs=f(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Us=f(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Ws=f(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Gs=f(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ks=f(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),qs=f(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),Js=f(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Ys=f(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Xs=f(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Zs=f(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),Qs=f(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),$s=f(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),ec=f(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),tc=f(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),nc=f(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),rc=f(`video`,[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]),ic=f(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),ac=f(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),oc=f(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),sc=f(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),cc={sm:`h-3.5 min-w-3.5 px-0.75 text-[8px]`,md:`h-5 min-w-5 px-1.5 text-[10px]`},lc={duration:.2,ease:[.2,0,0,1]},uc={duration:.12,ease:[.2,0,0,1]};function dc({count:e,size:t=`sm`,className:n,dot:r,label:i}){let a=r&&e<=0;return X(kt,{children:(e>0||a)&&Z(o.span,{role:`status`,initial:{opacity:0},animate:{opacity:1,transition:lc},exit:{opacity:0,transition:uc},className:u(`inline-flex`,n),"aria-label":i??`${e} unread`,children:[X(`span`,{"aria-hidden":`true`,className:`absolute inset-0 -z-10 rounded-full bg-wx-danger opacity-40 blur-[2px]`}),X(`span`,{className:u(`relative flex items-center justify-center`,`rounded-full bg-wx-danger font-bold leading-none text-white`,cc[t]),children:a?null:e>99?`99+`:e})]},`badge`)})}var fc=[`home`,`messages`,`help`,`news`,`profile`];function pc({active:e,features:t,onChange:n,unreadCount:r=0,newsUnread:a=!1}){let o=i(`tabs`),s=i(`news`),c=ln(),l=ln(),d=fc.filter(e=>gc(e,t));return X(`div`,{className:`px-3 pt-2 pb-2`,children:X(`nav`,{role:`tablist`,className:u(`relative flex w-full items-center gap-1`,`rounded-full bg-wx-bg-elevated/70 p-1 backdrop-blur-md`,`shadow-[inset_0_0_0_1px_rgb(0_0_0/0.04)]`),children:d.map(t=>{let i=t===e;if(t===`home`)return X(mc,{id:t,label:o(t),isActive:i,onClick:()=>n(t),parentHandlers:c.parentHandlers,icon:X(Ft,{ref:c.iconRef,size:16})},t);if(t===`messages`)return X(mc,{id:t,label:o(t),isActive:i,onClick:()=>n(t),parentHandlers:l.parentHandlers,icon:X(Mt,{ref:l.iconRef,size:16}),badgeCount:r},t);let u=t===`help`?hs:t===`news`?an:tc;return X(hc,{id:t,label:o(t),isActive:i,onClick:()=>n(t),Icon:u,showDot:t===`news`&&a,dotLabel:s(`unread`)},t)})})})}function mc({id:e,label:t,isActive:n,onClick:r,icon:i,parentHandlers:a,badgeCount:s=0}){return Z(`button`,{type:`button`,role:`tab`,"aria-selected":n,onClick:r,...a,className:u(`relative z-10 flex items-center justify-center gap-1.5 rounded-full px-3 py-2`,`transition-colors duration-150`,n?`flex-[2_2_0%] text-wx-fg`:`flex-1 text-wx-fg-muted hover:text-wx-fg`),children:[n&&X(o.span,{layoutId:`bottom-nav-pill`,className:`absolute inset-0 -z-10 rounded-full bg-wx-bg shadow-[0_2px_8px_rgba(0,0,0,0.08)]`,transition:{type:`spring`,stiffness:420,damping:36}}),Z(`span`,{className:`relative inline-flex shrink-0 items-center justify-center`,children:[i,X(dc,{count:s,size:`sm`,className:`absolute -top-1.5 -right-2 z-20`})]}),X(o.span,{animate:{width:n?`auto`:0,opacity:+!!n,marginLeft:n?0:-4},initial:!1,transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden text-[11px] font-semibold tracking-tight whitespace-nowrap`,children:t})]})}function hc({id:e,label:t,isActive:n,onClick:r,Icon:i,showDot:a=!1,dotLabel:s}){let c=Lt();return K(()=>{n&&c.start({scale:[1,1.15,1]})},[n,c]),Z(o.button,{type:`button`,role:`tab`,"aria-selected":n,onClick:r,onHoverStart:()=>c.start({rotate:[0,-10,10,0]}),className:u(`relative z-10 flex items-center justify-center gap-1.5 rounded-full px-3 py-2`,`transition-colors duration-150`,n?`flex-[2_2_0%] text-wx-fg`:`flex-1 text-wx-fg-muted hover:text-wx-fg`),children:[n&&X(o.span,{layoutId:`bottom-nav-pill`,className:`absolute inset-0 -z-10 rounded-full bg-wx-bg shadow-[0_2px_8px_rgba(0,0,0,0.08)]`,transition:{type:`spring`,stiffness:420,damping:36}}),Z(`span`,{className:`relative inline-flex shrink-0 items-center justify-center`,children:[X(o.span,{animate:c,transition:{duration:.4},children:X(i,{size:16,strokeWidth:n?2.2:1.8})}),X(dc,{count:0,dot:a,label:s,size:`sm`,className:`absolute -top-1.5 -right-2 z-20`})]}),X(o.span,{animate:{width:n?`auto`:0,opacity:+!!n,marginLeft:n?0:-4},initial:!1,transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden text-[11px] font-semibold tracking-tight whitespace-nowrap`,children:t})]})}function gc(e,t){return e===`home`?t.home:e===`messages`?t.messenger:e===`help`?t.help:e===`news`?t.news:!!t.profile}var _c=3e3;function vc({online:e,showBranding:t}){let n=i(`messages`),r=i(`branding`),[a,s]=Y(!1),c=J(e);K(()=>{let t=c.current;if(c.current=e,!e){s(!1);return}if(!t&&e){s(!0);let e=setTimeout(()=>s(!1),_c);return()=>clearTimeout(e)}},[e]);let l=e?a?`online`:t?`branding`:null:`offline`,d=`absolute inset-0 flex items-center justify-center gap-1.5 px-4 text-[10px] font-medium`;return X(`div`,{className:u(`relative shrink-0`,l?`h-[26px]`:`h-0`),children:Z(kt,{initial:!1,mode:`wait`,children:[l===`offline`&&Z(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:u(d,`bg-wx-danger/10 text-wx-danger`),children:[X(oc,{"aria-hidden":`true`,className:`size-3`}),X(`span`,{children:n(`offlineBanner`)})]},`offline`),l===`online`&&Z(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:u(d,`bg-wx-success/10 text-wx-success`),children:[X(sc,{"aria-hidden":`true`,className:`size-3`}),X(`span`,{children:n(`backOnline`)})]},`online`),l===`branding`&&Z(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:u(d,`bg-wx-bg text-wx-fg-subtle`),children:[X(`span`,{children:r(`poweredBy`)}),X(`a`,{href:`https://wexio.io?ref=widget`,target:`_blank`,rel:`noopener`,className:`font-semibold text-wx-fg-muted transition-colors hover:text-wx-fg`,children:r(`wexio`)})]},`branding`)]})})}function yc({title:e,subtitle:t,organizationLogoUrl:n,muted:r,onToggleMute:a,onBack:o,onClose:s,showResolve:c,onResolve:l,onDownloadTranscript:d,downloadingTranscript:f,expanded:p,onToggleExpand:m}){let h=i(`header`),g=i(`header`),_=ln(),v=ln();return Z(`header`,{"data-wx-top-bar":!0,className:u(`flex items-center gap-3 border-b border-wx-border bg-wx-bg px-3 py-3`),children:[o&&X(Kt,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":h(`back`),onClick:o,className:`size-8 shrink-0`,..._.parentHandlers,children:X(It,{ref:_.iconRef,size:16})}),n&&X(`span`,{className:`h-9 w-9 shrink-0 overflow-hidden rounded-full`,children:X(`img`,{src:n,alt:e,className:`h-full w-full object-cover`})}),Z(`div`,{className:`min-w-0 flex-1`,children:[X(`p`,{className:`truncate text-sm font-semibold text-wx-fg`,children:e}),t&&X(`p`,{className:`truncate text-xs text-wx-fg-muted`,children:t})]}),X(xc,{muted:r,onToggleMute:a,showResolve:!!c&&!!l,onResolve:l,onDownloadTranscript:d,downloadingTranscript:!!f}),m&&X(Kt,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":g(p?`collapse`:`expand`),onClick:m,className:`group size-8 shrink-0`,children:X(`span`,{className:`block transition-transform duration-200 ease-out group-hover:scale-110 group-active:scale-90`,children:X(Cc,{expanded:!!p})})}),X(Kt,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":h(`close`),onClick:s,className:`size-8 shrink-0`,...v.parentHandlers,children:X(Nt,{ref:v.iconRef,size:16})})]})}function bc(){return Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[X(`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`}),X(`path`,{d:`m9 11 3 3L22 4`})]})}function xc({muted:e,onToggleMute:t,showResolve:n,onResolve:r,onDownloadTranscript:a,downloadingTranscript:o}){let s=i(`header`),c=i(`sound`),l=i(`messages`),[u,d]=Y(!1),f=J(null);K(()=>{if(!u)return;let e=e=>{f.current&&!e.composedPath().includes(f.current)&&d(!1)},t=e=>{e.key===`Escape`&&d(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[u]);let p=e=>()=>{d(!1),e?.()};return Z(`div`,{ref:f,className:`relative shrink-0`,children:[X(Kt,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s(`moreActions`),"aria-haspopup":`menu`,"aria-expanded":u,onClick:()=>d(e=>!e),className:`group size-8`,children:X(`span`,{className:`block transition-transform duration-200 ease-out group-hover:scale-110 group-active:scale-90`,children:X(Qt,{icon:bs,size:18})})}),u&&Z(`div`,{role:`menu`,className:`absolute top-full right-0 z-30 mt-1 min-w-44 overflow-hidden rounded-wx-sm border border-wx-border bg-wx-bg py-1 shadow-lg`,children:[a&&X(Sc,{icon:X(Qt,{icon:o?js:ys,size:16}),label:s(`downloadTranscript`),onClick:p(a),disabled:o,spinning:o}),X(Sc,{icon:X(Qt,{icon:e?ac:ic,size:16}),label:c(e?`unmute`:`mute`),onClick:p(t)}),n&&X(Sc,{icon:X(bc,{}),label:l(`resolveConversation`),onClick:p(r)})]})]})}function Sc({icon:e,label:t,onClick:n,disabled:r,spinning:i}){return Z(`button`,{type:`button`,role:`menuitem`,onClick:n,disabled:r,className:`flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-wx-fg transition-colors hover:bg-wx-bg-elevated disabled:cursor-default disabled:opacity-60`,children:[X(`span`,{className:u(`shrink-0 text-wx-fg-muted`,i&&`animate-spin`),children:e}),X(`span`,{className:`truncate`,children:t})]})}function Cc({expanded:e}){return e?Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[X(`polyline`,{points:`4 14 10 14 10 20`}),X(`polyline`,{points:`20 10 14 10 14 4`}),X(`line`,{x1:`14`,y1:`10`,x2:`21`,y2:`3`}),X(`line`,{x1:`3`,y1:`21`,x2:`10`,y2:`14`})]}):Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[X(`polyline`,{points:`15 3 21 3 21 9`}),X(`polyline`,{points:`9 21 3 21 3 15`}),X(`line`,{x1:`21`,y1:`3`,x2:`14`,y2:`10`}),X(`line`,{x1:`3`,y1:`21`,x2:`10`,y2:`14`})]})}function wc({children:e}){let{isDummy:t}=Ct(),r=n(),i=g(),a=i.demo,o=a!==void 0&&typeof a==`object`&&!!a&&Object.keys(a).length>0,[s,c]=Y(null);if(K(()=>{if(!t||o)return;let e=!0;return Ze(r).then(t=>{e&&c(t)}),()=>{e=!1}},[t,o,r]),!t)return X(wn,{children:e});let l=o?i:s?{...i,demo:s}:null;return l?X(On,{locale:r,messages:l,timeZone:typeof Intl<`u`?Intl.DateTimeFormat().resolvedOptions().timeZone:`UTC`,children:e}):null}function Tc({title:e,description:t,meta:n,authors:r,onClick:i,kind:a=`none`,delay:s=0}){let c=a===`article`;return Z(o.button,{type:`button`,onClick:i,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.18,delay:s},className:u(`group flex w-full items-center gap-3 border-wx-border border-b text-start transition-colors`,`hover:bg-wx-bg-elevated/60`,`last:border-b-0`,c?`px-5 py-3`:`px-5 py-3.5`),children:[Z(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 [overflow-wrap:anywhere]`,children:[X(`span`,{className:u(`text-wx-fg`,c?`font-normal text-sm`:`font-semibold text-sm`),children:e}),t&&X(`span`,{className:u(`leading-snug`,c?`truncate text-[11px] text-wx-fg-subtle`:`text-wx-fg-muted text-xs`),children:t}),n&&X(`span`,{className:`text-[11px] text-wx-fg-subtle`,children:n})]}),Z(`span`,{className:`flex shrink-0 items-center gap-2 text-wx-fg-muted`,children:[r&&r.length>0&&X(en,{authors:r}),X(yt,{size:16,className:`transition-transform group-hover:translate-x-0.5 rtl:-scale-x-100 rtl:group-hover:-translate-x-0.5`,"aria-hidden":`true`})]})]})}var Ec=10,Dc=240,Oc=3;function kc({categoryId:e,categoryName:t,categoryDescription:r,categoryArticleCount:a,isDummy:s,onOpenCategory:c,onOpenArticle:l}){let u=i(`help`),d=T(),f=_t(),p=n(),[m,h]=Y(``),g=jc(m,300),_=g.length>=2,{data:v}=qt({variables:{parentId:e,locale:p},skip:s}),y=q(()=>v?.visitorHelpFolders??[],[v]),{data:b,loading:x,fetchMore:S}=Bt({variables:{args:{folderId:e,locale:p,recursive:!1,limit:Ec,offset:0}},skip:s,notifyOnNetworkStatusChange:!0}),{data:C,loading:w}=Bt({variables:{args:{query:g,locale:p,limit:10}},skip:g.length<2||s}),O=s?ue(d).find(t=>t.id===e):null,k=s?E(d).filter(t=>t.categoryId===e):[],A=s?k.map(e=>({id:e.id,slug:e.slug,title:e.title,excerpt:e.excerpt,authors:nn(e.authors),reactionCounts:null})):(b?.visitorHelpList?.items??[]).map(e=>({id:e._id,slug:e.slug,title:e.title,excerpt:e.excerpt??null,authors:nn(e.authors),reactionCounts:e.reactionCounts??null})),j=s?E(d).filter(e=>e.title.toLowerCase().includes(g.toLowerCase())||e.excerpt.toLowerCase().includes(g.toLowerCase())).map(e=>({id:e.id,slug:e.slug,title:e.title,excerpt:e.excerpt,authors:nn(e.authors),reactionCounts:null})):[],M=(C?.visitorHelpList?.items??[]).map(e=>({id:e._id,slug:e.slug,title:e.title,excerpt:e.excerpt??null,authors:nn(e.authors),reactionCounts:e.reactionCounts??null})),N=_?s?j:M:A,P=t??O?.title??``,ee=r??O?.description??``,te=a??O?.articleCount??A.length,ne=q(()=>{let e=new Map;for(let t of A)for(let n of t.authors??[])e.has(n.id)||e.set(n.id,n);return Array.from(e.values())},[A]),F=ne.slice(0,Oc),re=Math.max(0,ne.length-F.length),ie=F[0]?.name??``,ae=!_&&!s&&(b?.visitorHelpList?.meta?.hasNextPage??!1),[oe,se]=Y(!1),ce=G(async()=>{if(!(!ae||oe)){se(!0);try{await S({variables:{args:{folderId:e,locale:p,recursive:!1,limit:Ec,offset:b?.visitorHelpList?.items?.length??0}},updateQuery:(e,{fetchMoreResult:t})=>t?{...e,visitorHelpList:{...t.visitorHelpList,items:[...e.visitorHelpList?.items??[],...t.visitorHelpList?.items??[]]}}:e})}catch{}finally{se(!1)}}},[ae,oe,e,p,S,b]),le=G(e=>{let t=e.currentTarget;t.scrollHeight-t.clientHeight-t.scrollTop<Dc&&ce()},[ce]),de=s&&!D(d)||!s&&!_&&x&&A.length===0&&y.length===0;return X(`div`,{className:`flex h-full min-h-0 flex-col`,children:Z(ze,{followDirection:!0,className:`min-h-0 flex-1`,viewportRef:f,onScroll:le,children:[X(Jt,{value:m,onChange:h,placeholder:u(`searchPlaceholder`)}),!_&&P&&X(o.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2},className:`border-wx-border border-b px-5 py-5`,children:Z(`div`,{className:`flex items-start justify-between gap-4`,children:[Z(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[X(`h2`,{className:`font-semibold text-lg text-wx-fg`,children:P}),ee&&X(`p`,{className:`text-sm text-wx-fg-muted leading-snug`,children:ee}),Z(`div`,{className:`mt-1 flex flex-col gap-0.5 text-wx-fg-subtle text-xs`,children:[X(`span`,{children:u(`articlesCount`,{count:te})}),ie&&X(`span`,{children:u(`authorsByline`,{first:ie,remaining:re})})]})]}),F.length>0&&X(`div`,{className:`shrink-0`,children:X(en,{authors:F})})]})}),de?X(Ac,{}):N.length===0&&y.length===0?X(`div`,{className:`px-5 py-6`,children:X(ct,{children:X(tt,{className:`py-8 text-center`,children:X(`p`,{className:`text-sm text-wx-fg-muted`,children:u(_?`noResults`:`emptyTitle`)})})})}):Z(`div`,{className:`flex flex-col`,children:[N.map((e,t)=>X(Tc,{title:e.title,description:e.excerpt,authors:e.authors,kind:`article`,onClick:()=>l(e.slug),delay:Math.min(t,Ec)*.03},e.id)),!_&&y.map((e,t)=>X(Tc,{title:e.name,description:e.description,meta:(e.articleCount??0)>0?u(`articlesCount`,{count:e.articleCount??0}):void 0,kind:`folder`,onClick:()=>c(e._id,{name:e.name,description:e.description??void 0,articleCount:e.articleCount??0}),delay:(N.length+t)*.03},e._id)),(oe||w)&&X(`div`,{className:`flex justify-center py-3`,children:X(U,{className:`h-3 w-24`})})]})]})})}function Ac(){return X(`div`,{className:`flex flex-col`,children:Array.from({length:3}).map((e,t)=>Z(`div`,{className:`flex items-center gap-3 border-wx-border border-b px-5 py-4 last:border-b-0`,children:[Z(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[X(U,{className:`h-4 w-32 rounded`}),X(U,{className:`h-3 w-56 rounded`})]}),X(U,{className:`h-4 w-4 rounded`})]},t))})}function jc(e,t){let[n,r]=Y(e);return K(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Mc(e,t,n){let r=Object.entries(t).map(([e,t])=>({chatId:`demo-${F(e)}`,threadKey:F(e),title:t.title,status:`OPEN`,unreadCount:0,updatedAt:t.at,preview:null,senderName:n,lastSenderKind:`ai`}));return[...e,...r]}function Nc(e,t,n){return e?{chatId:``,threadKey:t(e.slotId,e.variant.id),status:`OPEN`,unreadCount:0,updatedAt:``,preview:{text:e.variant.text,at:``,fromVisitor:!1},senderName:n}:null}var Pc=`launcher-message`;function Fc(e,t){return{id:`slot:${e.slotId}:${e.variant.id}:${e.variant.contentHash??``}`,text:e.variant.text,sender:{kind:`ai`,name:t},buttons:e.variant.buttons.map(e=>({text:e.label,payload:``})),inPlaceKey:Pc}}function Ic(e){let t=e.find(e=>e.chatId);return t?{kind:`thread`,chatId:t.chatId,threadKey:t.threadKey}:{kind:`list`}}function Lc(e,t,n=e=>F(e)){if(!e)return{kind:`plain`};let r=n(e.slotId,e.variantId);return t.some(e=>e.chatId&&e.threadKey===r)?{kind:`topic-with-slot-text`,slotId:e.slotId}:{kind:`slot-thread`,threadKey:r}}function Rc(e){let{message:t,slotLauncher:n,launcherToMessages:r,threads:i,isOpen:a}=e,{setRoute:o,markResumed:s,openPanel:c,togglePanel:l,setPendingReply:u}=e,d=e.keyFor??(e=>F(e)),f=G((e,t)=>{let n=d(e,t),r=i.find(e=>e.chatId&&e.threadKey===n);return s(),o({kind:`messages-thread`,threadKey:n,chatId:r?.chatId}),n},[i,s,o,d]),{resumeRoute:p,threadsLoading:m}=e,h=G(()=>{let e=p?.();if(e)return s(),e;if(m)return{kind:`messages-thread`,pendingLatest:!0};s();let t=Ic(i);return t.kind===`thread`?{kind:`messages-thread`,chatId:t.chatId,threadKey:t.threadKey}:{kind:`messages`}},[i,m,s,p]);return{onLauncherToggle:G(()=>{!a&&n&&r&&o(h()),l()},[a,n,r,h,o,l]),messagesEntryRoute:h,newConversationRoute:G(e=>{let r={kind:`messages-thread`,threadKey:e};if(!n)return r;let a=Lc(t.top?{slotId:t.top.slotId,variantId:t.top.variant.id}:null,i,d);return a.kind===`slot-thread`?{kind:`messages-thread`,threadKey:a.threadKey}:a.kind===`topic-with-slot-text`?{...r,welcomeSlotId:a.slotId}:r},[n,t.top,i,d]),onBubbleOpen:G(()=>{let e=t.shown;e&&(t.markRead(`click`),f(e.slotId,e.variant.id),c())},[t,f,c]),onBubbleReply:G(e=>{let n=t.shown;n&&(t.markRead(`click`),u({threadKey:f(n.slotId,n.variant.id),text:e}),c())},[t,f,u,c]),onBubbleDismiss:G(()=>t.markRead(`dismiss`),[t])}}var zc={none:0,visitors:1,origin:2,path:3},Bc=e=>Array.isArray(e)&&e.length>0;function Vc(e){return e?Bc(e.paths)?zc.path:Bc(e.origins)?zc.origin:e.visitors===`ANONYMOUS`||e.visitors===`SIGNED_IN`?zc.visitors:zc.none:zc.none}function Hc(e,t){let n=[];return e.forEach((e,r)=>{if(e.kind!==`MESSAGE`)return;let i=ri(e.variants,t);i&&n.push({slotId:e.id,variant:i,specificity:Vc(i.when),order:r,reappearAfterDays:e.reappearAfterDays??null})}),n.sort((e,t)=>t.specificity-e.specificity||e.order-t.order)}function Uc(e,t){return Hc(e,t)[0]??null}var Wc=864e5,Gc=(e,t)=>`wexio:slot-read:${e}:${t}`,Kc=e=>typeof e==`string`?e:void 0;function qc(e,t,n){try{let r=e.getItem(Gc(t,n));if(!r)return{};let i=JSON.parse(r);if(!i||typeof i!=`object`||Array.isArray(i))return{};let a={};for(let[e,t]of Object.entries(i)){if(!t||typeof t!=`object`)continue;let n=t;if(typeof n.contentHash!=`string`)continue;let r=Kc(n.shownAt),i=Kc(n.readAt),o=Kc(n.dismissedAt);a[e]={contentHash:n.contentHash,...r?{shownAt:r}:{},...i?{readAt:i}:{},...o?{dismissedAt:o}:{}}}return a}catch{return{}}}function Jc(e,t,n,r,i){let a=qc(e,t,n),o=r.contentHash??``,s=a[r.id],c=s&&s.contentHash===o?s:{contentHash:o};a[r.id]={...c,...i};try{e.setItem(Gc(t,n),JSON.stringify(a))}catch{}}function Yc(e,t,n,r,i){let a=qc(e,t,n)[r.id],o=a?.shownAt&&(!a.dismissedAt||a.shownAt>a.dismissedAt);a&&a.contentHash===(r.contentHash??``)&&o||Jc(e,t,n,r,{shownAt:new Date(i).toISOString()})}function Xc(e,t,n,r,i,a){let o=new Date(a).toISOString();Jc(e,t,n,r,i===`dismiss`?{dismissedAt:o}:{readAt:o})}function Zc(e,t,n,r){let i=e[t.id];if(!i||i.contentHash!==(t.contentHash??``))return!1;if(i.readAt)return!0;if(!i.dismissedAt)return!1;if(n===null)return!0;let a=Date.parse(i.dismissedAt);return Number.isNaN(a)?!0:r-a<n*Wc}function Qc(e,t,n){let r=e[t.id];if(!r||r.contentHash!==(t.contentHash??``)||r.readAt||!r.dismissedAt||n===null)return null;let i=Date.parse(r.dismissedAt);return Number.isNaN(i)?null:i+n*Wc}var $c=2e9;function el(e){let{slots:t,ctx:n,publicKey:r,storage:i,ready:a,isOpen:o,suppressed:s}=e,c=e.previewVisible===!0,l=e.graceMs??1500,u=J(e.now??Date.now);u.current=e.now??Date.now;let d=r??``,f=q(()=>t.some(e=>e.kind===`MESSAGE`),[t]),p=q(()=>Uc(t,n),[t,n]),[m,h]=Y(0),[g,_]=Y(!1);K(()=>{if(!a){_(!1);return}let e=setTimeout(()=>_(!0),l);return()=>clearTimeout(e)},[a,l]);let v=q(()=>p&&!c?Zc(qc(i,d,p.slotId),p.variant,p.reappearAfterDays,u.current()):!1,[p,i,d,m,c]);K(()=>{if(!p||!v||c)return;let e=Qc(qc(i,d,p.slotId),{id:p.variant.id,contentHash:p.variant.contentHash},p.reappearAfterDays);if(e===null)return;let t=setTimeout(()=>h(e=>e+1),Math.min(Math.max(e-u.current(),0)+50,$c));return()=>clearTimeout(t)},[p,v,i,d,m,c]);let y=e.blocked!==!0,b=y&&g&&!!p&&!v,x=y&&g&&p&&!v&&!o&&!s?p:null,S=J(x);S.current=x;let C=G((e,t)=>{if(c)return;let n={id:e.variant.id,contentHash:e.variant.contentHash};Xc(i,d,e.slotId,n,t,u.current()),h(e=>e+1)},[i,d,c]);K(()=>{!x||c||Yc(i,d,x.slotId,{id:x.variant.id,contentHash:x.variant.contentHash},u.current())},[x,i,d,c]);let w=J(null);K(()=>{if(!o){w.current=x;return}let e=w.current;w.current=null,e&&C(e,`open`)},[o,x,C]);let T=G(e=>{let t=S.current;t&&C(t,e)},[C]);return q(()=>({active:f,top:p,shown:x,unread:b,markRead:T}),[f,p,x,b,T])}var tl={" ":` `,"<":`<`,">":`>`,""":`"`,"'":`'`,"'":`'`,"&":`&`};function nl(e){return e.replace(/&#(\d+);/g,(e,t)=>{let n=Number(t);return Number.isFinite(n)?String.fromCodePoint(n):e}).replace(/ |<|>|"|'|'/gi,e=>tl[e.toLowerCase()]??e).replace(/&/gi,`&`)}function rl(e){return e?/[<&]/.test(e)?nl(e.replace(/<li[^>]*>/gi,`
|
|
90
90
|
- `).replace(/<\/(p|div|ul|ol|li|blockquote|h[1-6]|tr)>/gi,`
|
|
91
91
|
`).replace(/<br\s*\/?>/gi,`
|
|
92
92
|
`).replace(/<[^>]*>/g,``)).split(`
|
package/package.json
CHANGED