Files
sisvietnamvn_01/BV_DHYD_HCM/Đội ngũ bác sĩ UMC_files/main.js.download
T

453 lines
889 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(jt){typeof define=="function"&&define.amd?define(jt):jt()})(function(){"use strict";var EK=Object.defineProperty;var Zv=jt=>{throw TypeError(jt)};var AK=(jt,tt,tn)=>tt in jt?EK(jt,tt,{enumerable:!0,configurable:!0,writable:!0,value:tn}):jt[tt]=tn;var Ct=(jt,tt,tn)=>AK(jt,typeof tt!="symbol"?tt+"":tt,tn),IK=(jt,tt,tn)=>tt.has(jt)||Zv("Cannot "+tn);var Yv=(jt,tt,tn)=>tt.has(jt)?Zv("Cannot add the same private member more than once"):tt instanceof WeakSet?tt.add(jt):tt.set(jt,tn);var hc=(jt,tt,tn)=>(IK(jt,tt,"access private method"),tn);/**
* @vue/shared v3.4.21
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/var Rr,Ld,t0;function jt(e,t){const n=new Set(e.split(","));return s=>n.has(s)}const tt={},tn=[],En=()=>{},s0=()=>!1,Ni=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),pc=e=>e.startsWith("onUpdate:"),Xt=Object.assign,mc=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},r0=Object.prototype.hasOwnProperty,ut=(e,t)=>r0.call(e,t),Ve=Array.isArray,Fr=e=>qr(e)==="[object Map]",zr=e=>qr(e)==="[object Set]",Dd=e=>qr(e)==="[object Date]",o0=e=>qr(e)==="[object RegExp]",Ye=e=>typeof e=="function",Et=e=>typeof e=="string",Os=e=>typeof e=="symbol",_t=e=>e!==null&&typeof e=="object",jd=e=>(_t(e)||Ye(e))&&Ye(e.then)&&Ye(e.catch),Nd=Object.prototype.toString,qr=e=>Nd.call(e),i0=e=>qr(e).slice(8,-1),Fd=e=>qr(e)==="[object Object]",gc=e=>Et(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,To=jt(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Fi=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},a0=/-(\w)/g,An=Fi(e=>e.replace(a0,(t,n)=>n?n.toUpperCase():"")),l0=/\B([A-Z])/g,Rs=Fi(e=>e.replace(l0,"-$1").toLowerCase()),zi=Fi(e=>e.charAt(0).toUpperCase()+e.slice(1)),qi=Fi(e=>e?`on${zi(e)}`:""),as=(e,t)=>!Object.is(e,t),Br=(e,t)=>{for(let n=0;n<e.length;n++)e[n](t)},Bi=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},Eo=e=>{const t=parseFloat(e);return isNaN(t)?e:t},c0=e=>{const t=Et(e)?Number(e):NaN;return isNaN(t)?e:t};let zd;const qd=()=>zd||(zd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ht(e){if(Ve(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],r=Et(s)?h0(s):ht(s);if(r)for(const o in r)t[o]=r[o]}return t}else if(Et(e)||_t(e))return e}const u0=/;(?![^(]*\))/g,d0=/:([^]+)/,f0=/\/\*[^]*?\*\//g;function h0(e){const t={};return e.replace(f0,"").split(u0).forEach(n=>{if(n){const s=n.split(d0);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function te(e){let t="";if(Et(e))t=e;else if(Ve(e))for(let n=0;n<e.length;n++){const s=te(e[n]);s&&(t+=s+" ")}else if(_t(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function Ui(e){if(!e)return null;let{class:t,style:n}=e;return t&&!Et(t)&&(e.class=te(t)),n&&(e.style=ht(n)),e}const p0=jt("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Bd(e){return!!e||e===""}function m0(e,t){if(e.length!==t.length)return!1;let n=!0;for(let s=0;n&&s<e.length;s++)n=rr(e[s],t[s]);return n}function rr(e,t){if(e===t)return!0;let n=Dd(e),s=Dd(t);if(n||s)return n&&s?e.getTime()===t.getTime():!1;if(n=Os(e),s=Os(t),n||s)return e===t;if(n=Ve(e),s=Ve(t),n||s)return n&&s?m0(e,t):!1;if(n=_t(e),s=_t(t),n||s){if(!n||!s)return!1;const r=Object.keys(e).length,o=Object.keys(t).length;if(r!==o)return!1;for(const i in e){const a=e.hasOwnProperty(i),c=t.hasOwnProperty(i);if(a&&!c||!a&&c||!rr(e[i],t[i]))return!1}}return String(e)===String(t)}function vc(e,t){return e.findIndex(n=>rr(n,t))}const j=e=>Et(e)?e:e==null?"":Ve(e)||_t(e)&&(e.toString===Nd||!Ye(e.toString))?JSON.stringify(e,Ud,2):String(e),Ud=(e,t)=>t&&t.__v_isRef?Ud(e,t.value):Fr(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,r],o)=>(n[yc(s,o)+" =>"]=r,n),{})}:zr(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>yc(n))}:Os(t)?yc(t):_t(t)&&!Ve(t)&&!Fd(t)?String(t):t,yc=(e,t="")=>{var n;return Os(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};let In;class Vd{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=In,!t&&In&&(this.index=(In.scopes||(In.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const n=In;try{return In=this,t()}finally{In=n}}}on(){In=this}off(){In=this.parent}stop(t){if(this._active){let n,s;for(n=0,s=this.effects.length;n<s;n++)this.effects[n].stop();for(n=0,s=this.cleanups.length;n<s;n++)this.cleanups[n]();if(this.scopes)for(n=0,s=this.scopes.length;n<s;n++)this.scopes[n].stop(!0);if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0,this._active=!1}}}function g0(e){return new Vd(e)}function v0(e,t=In){t&&t.active&&t.effects.push(e)}function Hd(){return In}function y0(e){In&&In.cleanups.push(e)}let or;class bc{constructor(t,n,s,r){this.fn=t,this.trigger=n,this.scheduler=s,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,v0(this,r)}get dirty(){if(this._dirtyLevel===2||this._dirtyLevel===3){this._dirtyLevel=1,Ds();for(let t=0;t<this._depsLength;t++){const n=this.deps[t];if(n.computed&&(b0(n.computed),this._dirtyLevel>=4))break}this._dirtyLevel===1&&(this._dirtyLevel=0),js()}return this._dirtyLevel>=4}set dirty(t){this._dirtyLevel=t?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=Ls,n=or;try{return Ls=!0,or=this,this._runnings++,Wd(this),this.fn()}finally{Gd(this),this._runnings--,or=n,Ls=t}}stop(){var t;this.active&&(Wd(this),Gd(this),(t=this.onStop)==null||t.call(this),this.active=!1)}}function b0(e){return e.value}function Wd(e){e._trackId++,e._depsLength=0}function Gd(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t<e.deps.length;t++)Kd(e.deps[t],e);e.deps.length=e._depsLength}}function Kd(e,t){const n=e.get(t);n!==void 0&&t._trackId!==n&&(e.delete(t),e.size===0&&e.cleanup())}let Ls=!0,_c=0;const Qd=[];function Ds(){Qd.push(Ls),Ls=!1}function js(){const e=Qd.pop();Ls=e===void 0?!0:e}function xc(){_c++}function wc(){for(_c--;!_c&&kc.length;)kc.shift()()}function Jd(e,t,n){if(t.get(e)!==e._trackId){t.set(e,e._trackId);const s=e.deps[e._depsLength];s!==t?(s&&Kd(s,e),e.deps[e._depsLength++]=t):e._depsLength++}}const kc=[];function Xd(e,t,n){xc();for(const s of e.keys()){let r;s._dirtyLevel<t&&(r??(r=e.get(s)===s._trackId))&&(s._shouldSchedule||(s._shouldSchedule=s._dirtyLevel===0),s._dirtyLevel=t),s._shouldSchedule&&(r??(r=e.get(s)===s._trackId))&&(s.trigger(),(!s._runnings||s.allowRecurse)&&s._dirtyLevel!==2&&(s._shouldSchedule=!1,s.scheduler&&kc.push(s.scheduler)))}wc()}const Zd=(e,t)=>{const n=new Map;return n.cleanup=e,n.computed=t,n},Vi=new WeakMap,ir=Symbol(""),Sc=Symbol("");function _n(e,t,n){if(Ls&&or){let s=Vi.get(e);s||Vi.set(e,s=new Map);let r=s.get(n);r||s.set(n,r=Zd(()=>s.delete(n))),Jd(or,r)}}function _s(e,t,n,s,r,o){const i=Vi.get(e);if(!i)return;let a=[];if(t==="clear")a=[...i.values()];else if(n==="length"&&Ve(e)){const c=Number(s);i.forEach((u,d)=>{(d==="length"||!Os(d)&&d>=c)&&a.push(u)})}else switch(n!==void 0&&a.push(i.get(n)),t){case"add":Ve(e)?gc(n)&&a.push(i.get("length")):(a.push(i.get(ir)),Fr(e)&&a.push(i.get(Sc)));break;case"delete":Ve(e)||(a.push(i.get(ir)),Fr(e)&&a.push(i.get(Sc)));break;case"set":Fr(e)&&a.push(i.get(ir));break}xc();for(const c of a)c&&Xd(c,4);wc()}function _0(e,t){var n;return(n=Vi.get(e))==null?void 0:n.get(t)}const x0=jt("__proto__,__v_isRef,__isVue"),Yd=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Os)),ef=w0();function w0(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const s=lt(this);for(let o=0,i=this.length;o<i;o++)_n(s,"get",o+"");const r=s[t](...n);return r===-1||r===!1?s[t](...n.map(lt)):r}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...n){Ds(),xc();const s=lt(this)[t].apply(this,n);return wc(),js(),s}}),e}function k0(e){const t=lt(this);return _n(t,"has",e),t.hasOwnProperty(e)}class tf{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){const r=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return o;if(n==="__v_raw")return s===(r?o?D0:uf:o?cf:lf).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const i=Ve(t);if(!r){if(i&&ut(ef,n))return Reflect.get(ef,n,s);if(n==="hasOwnProperty")return k0}const a=Reflect.get(t,n,s);return(Os(n)?Yd.has(n):x0(n))||(r||_n(t,"get",n),o)?a:Ft(a)?i&&gc(n)?a:a.value:_t(a)?r?Ur(a):dt(a):a}}class nf extends tf{constructor(t=!1){super(!1,t)}set(t,n,s,r){let o=t[n];if(!this._isShallow){const c=Hr(o);if(!Xi(s)&&!Hr(s)&&(o=lt(o),s=lt(s)),!Ve(t)&&Ft(o)&&!Ft(s))return c?!1:(o.value=s,!0)}const i=Ve(t)&&gc(n)?Number(n)<t.length:ut(t,n),a=Reflect.set(t,n,s,r);return t===lt(r)&&(i?as(s,o)&&_s(t,"set",n,s):_s(t,"add",n,s)),a}deleteProperty(t,n){const s=ut(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&s&&_s(t,"delete",n,void 0),r}has(t,n){const s=Reflect.has(t,n);return(!Os(n)||!Yd.has(n))&&_n(t,"has",n),s}ownKeys(t){return _n(t,"iterate",Ve(t)?"length":ir),Reflect.ownKeys(t)}}class S0 extends tf{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const $0=new nf,C0=new S0,T0=new nf(!0),$c=e=>e,Hi=e=>Reflect.getPrototypeOf(e);function Wi(e,t,n=!1,s=!1){e=e.__v_raw;const r=lt(e),o=lt(t);n||(as(t,o)&&_n(r,"get",t),_n(r,"get",o));const{has:i}=Hi(r),a=s?$c:n?Ec:Ao;if(i.call(r,t))return a(e.get(t));if(i.call(r,o))return a(e.get(o));e!==r&&e.get(t)}function Gi(e,t=!1){const n=this.__v_raw,s=lt(n),r=lt(e);return t||(as(e,r)&&_n(s,"has",e),_n(s,"has",r)),e===r?n.has(e):n.has(e)||n.has(r)}function Ki(e,t=!1){return e=e.__v_raw,!t&&_n(lt(e),"iterate",ir),Reflect.get(e,"size",e)}function sf(e){e=lt(e);const t=lt(this);return Hi(t).has.call(t,e)||(t.add(e),_s(t,"add",e,e)),this}function rf(e,t){t=lt(t);const n=lt(this),{has:s,get:r}=Hi(n);let o=s.call(n,e);o||(e=lt(e),o=s.call(n,e));const i=r.call(n,e);return n.set(e,t),o?as(t,i)&&_s(n,"set",e,t):_s(n,"add",e,t),this}function of(e){const t=lt(this),{has:n,get:s}=Hi(t);let r=n.call(t,e);r||(e=lt(e),r=n.call(t,e)),s&&s.call(t,e);const o=t.delete(e);return r&&_s(t,"delete",e,void 0),o}function af(){const e=lt(this),t=e.size!==0,n=e.clear();return t&&_s(e,"clear",void 0,void 0),n}function Qi(e,t){return function(s,r){const o=this,i=o.__v_raw,a=lt(i),c=t?$c:e?Ec:Ao;return!e&&_n(a,"iterate",ir),i.forEach((u,d)=>s.call(r,c(u),c(d),o))}}function Ji(e,t,n){return function(...s){const r=this.__v_raw,o=lt(r),i=Fr(o),a=e==="entries"||e===Symbol.iterator&&i,c=e==="keys"&&i,u=r[e](...s),d=n?$c:t?Ec:Ao;return!t&&_n(o,"iterate",c?Sc:ir),{next(){const{value:f,done:h}=u.next();return h?{value:f,done:h}:{value:a?[d(f[0]),d(f[1])]:d(f),done:h}},[Symbol.iterator](){return this}}}}function Ns(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function E0(){const e={get(o){return Wi(this,o)},get size(){return Ki(this)},has:Gi,add:sf,set:rf,delete:of,clear:af,forEach:Qi(!1,!1)},t={get(o){return Wi(this,o,!1,!0)},get size(){return Ki(this)},has:Gi,add:sf,set:rf,delete:of,clear:af,forEach:Qi(!1,!0)},n={get(o){return Wi(this,o,!0)},get size(){return Ki(this,!0)},has(o){return Gi.call(this,o,!0)},add:Ns("add"),set:Ns("set"),delete:Ns("delete"),clear:Ns("clear"),forEach:Qi(!0,!1)},s={get(o){return Wi(this,o,!0,!0)},get size(){return Ki(this,!0)},has(o){return Gi.call(this,o,!0)},add:Ns("add"),set:Ns("set"),delete:Ns("delete"),clear:Ns("clear"),forEach:Qi(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{e[o]=Ji(o,!1,!1),n[o]=Ji(o,!0,!1),t[o]=Ji(o,!1,!0),s[o]=Ji(o,!0,!0)}),[e,n,t,s]}const[A0,I0,P0,M0]=E0();function Cc(e,t){const n=t?e?M0:P0:e?I0:A0;return(s,r,o)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?s:Reflect.get(ut(n,r)&&r in s?n:s,r,o)}const O0={get:Cc(!1,!1)},R0={get:Cc(!1,!0)},L0={get:Cc(!0,!1)},lf=new WeakMap,cf=new WeakMap,uf=new WeakMap,D0=new WeakMap;function j0(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function N0(e){return e.__v_skip||!Object.isExtensible(e)?0:j0(i0(e))}function dt(e){return Hr(e)?e:Tc(e,!1,$0,O0,lf)}function F0(e){return Tc(e,!1,T0,R0,cf)}function Ur(e){return Tc(e,!0,C0,L0,uf)}function Tc(e,t,n,s,r){if(!_t(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=r.get(e);if(o)return o;const i=N0(e);if(i===0)return e;const a=new Proxy(e,i===2?s:n);return r.set(e,a),a}function Vr(e){return Hr(e)?Vr(e.__v_raw):!!(e&&e.__v_isReactive)}function Hr(e){return!!(e&&e.__v_isReadonly)}function Xi(e){return!!(e&&e.__v_isShallow)}function df(e){return Vr(e)||Hr(e)}function lt(e){const t=e&&e.__v_raw;return t?lt(t):e}function ff(e){return Object.isExtensible(e)&&Bi(e,"__v_skip",!0),e}const Ao=e=>_t(e)?dt(e):e,Ec=e=>_t(e)?Ur(e):e;class hf{constructor(t,n,s,r){this.getter=t,this._setter=n,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new bc(()=>t(this._value),()=>Io(this,this.effect._dirtyLevel===2?2:3)),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=s}get value(){const t=lt(this);return(!t._cacheable||t.effect.dirty)&&as(t._value,t._value=t.effect.run())&&Io(t,4),Ac(t),t.effect._dirtyLevel>=2&&Io(t,2),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function z0(e,t,n=!1){let s,r;const o=Ye(e);return o?(s=e,r=En):(s=e.get,r=e.set),new hf(s,r,o||!r,n)}function Ac(e){var t;Ls&&or&&(e=lt(e),Jd(or,(t=e.dep)!=null?t:e.dep=Zd(()=>e.dep=void 0,e instanceof hf?e:void 0)))}function Io(e,t=4,n){e=lt(e);const s=e.dep;s&&Xd(s,t)}function Ft(e){return!!(e&&e.__v_isRef===!0)}function R(e){return mf(e,!1)}function pf(e){return mf(e,!0)}function mf(e,t){return Ft(e)?e:new q0(e,t)}class q0{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:lt(t),this._value=n?t:Ao(t)}get value(){return Ac(this),this._value}set value(t){const n=this.__v_isShallow||Xi(t)||Hr(t);t=n?t:lt(t),as(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:Ao(t),Io(this,4))}}function y(e){return Ft(e)?e.value:e}const B0={get:(e,t,n)=>y(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const r=e[t];return Ft(r)&&!Ft(n)?(r.value=n,!0):Reflect.set(e,t,n,s)}};function gf(e){return Vr(e)?e:new Proxy(e,B0)}class U0{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:n,set:s}=t(()=>Ac(this),()=>Io(this));this._get=n,this._set=s}get value(){return this._get()}set value(t){this._set(t)}}function V0(e){return new U0(e)}function At(e){const t=Ve(e)?new Array(e.length):{};for(const n in e)t[n]=vf(e,n);return t}class H0{constructor(t,n,s){this._object=t,this._key=n,this._defaultValue=s,this.__v_isRef=!0}get value(){const t=this._object[this._key];return t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return _0(lt(this._object),this._key)}}class W0{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function G0(e,t,n){return Ft(e)?e:Ye(e)?new W0(e):_t(e)&&arguments.length>1?vf(e,t,n):R(e)}function vf(e,t,n){const s=e[t];return Ft(s)?s:new H0(e,t,n)}var Po={FORGE_RELEASE_DIRECTORY:"/home/forge/widget.geteasy.ai/releases/73560873",FORGE_SITE_BRANCH:"main",USER:"forge",SSH_CLIENT:"159.203.150.232 47350 22",npm_config_user_agent:"pnpm/10.2.1 npm/? node/v18.20.8 linux x64",FORGE_CUSTOM_DEPLOY:"1",XDG_SESSION_TYPE:"tty",npm_node_execpath:"/home/forge/.nvm/versions/node/v18.20.8/bin/node",SHLVL:"1",MOTD_SHOWN:"pam",HOME:"/home/forge",OLDPWD:"/home/forge",FORGE_DEPLOY_MESSAGE:"Merge pull request #929 from khaphanspace/pick-inbox-reply-emoji",NVM_BIN:"/home/forge/.nvm/versions/node/v18.20.8/bin",NVM_INC:"/home/forge/.nvm/versions/node/v18.20.8/include/node",FORGE_SITE_USER:"forge",DBUS_SESSION_BUS_ADDRESS:"unix:path=/run/user/1000/bus",FORGE_SITE_ROOT:"/home/forge/widget.geteasy.ai",NVM_DIR:"/home/forge/.nvm",FORGE_MANUAL_DEPLOY:"0",FORGE_REDEPLOY:"0",LOGNAME:"forge",_:"/home/forge/.nvm/versions/node/v18.20.8/bin/pnpm",LARAVEL_FORGE:"1",XDG_SESSION_CLASS:"user",FORGE_DEPLOYMENT_ID:"73560873",npm_config_registry:"https://registry.npmjs.org/",FORGE_COMPOSER:"php8.4 /usr/local/bin/composer",XDG_SESSION_ID:"122648",npm_config_node_gyp:"/home/forge/.local/share/pnpm/.tools/pnpm/10.2.1/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/forge/widget.geteasy.ai/node_modules/.bin:/home/forge/.local/share/pnpm/.tools/pnpm/10.2.1/node_modules/pnpm/dist/node-gyp-bin:/home/forge/.local/share/pnpm/.tools/pnpm/10.2.1/bin:/home/forge/.nvm/versions/node/v18.20.8/bin:/tmp/site-2755124:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",npm_package_name:"jam-easychatgpt-widget",NODE:"/home/forge/.nvm/versions/node/v18.20.8/bin/node",XDG_RUNTIME_DIR:"/run/user/1000",npm_config_frozen_lockfile:"",LANG:"C.UTF-8",FORGE_PHP:"php8.4",FORGE_DEPLOY_COMMIT:"6124e8f2661dc850553f825f5f0cd59341940439",FORGE_SITE_ID:"2755124",npm_lifecycle_script:"vite build --config vite.config.widget.js --mode production",SHELL:"/bin/bash",FORGE_QUICK_DEPLOY:"1",FORGE_ROLLBACK:"0",npm_package_version:"0.0.0",npm_lifecycle_event:"build-widget",npm_config_verify_deps_before_run:"false",NODE_PATH:"/home/forge/widget.geteasy.ai/node_modules/.pnpm/vite@5.4.20_sass@1.93.2/node_modules/vite/bin/node_modules:/home/forge/widget.geteasy.ai/node_modules/.pnpm/vite@5.4.20_sass@1.93.2/node_modules/vite/node_modules:/home/forge/widget.geteasy.ai/node_modules/.pnpm/vite@5.4.20_sass@1.93.2/node_modules:/home/forge/widget.geteasy.ai/node_modules/.pnpm/node_modules",FORGE_SITE_PATH:"/home/forge/widget.geteasy.ai",FORGE_SERVER_ID:"925163",PWD:"/home/forge/widget.geteasy.ai",npm_execpath:"/home/forge/.local/share/pnpm/.tools/pnpm/10.2.1/node_modules/pnpm/bin/pnpm.cjs",FORGE_PHP_FPM:"php8.4-fpm",SSH_CONNECTION:"159.203.150.232 47350 192.168.0.40 22",NVM_CD_FLAGS:"",FORGE_DEPLOY_AUTHOR:"Phước Lộc",npm_command:"run-script",PNPM_SCRIPT_SRC_DIR:"/home/forge/widget.geteasy.ai",INIT_CWD:"/home/forge/widget.geteasy.ai",NODE_ENV:"production"};const Mo=[];function K0(e,...t){Ds();const n=Mo.length?Mo[Mo.length-1].component:null,s=n&&n.appContext.config.warnHandler,r=Q0();if(s)xs(s,n,11,[e+t.map(o=>{var i,a;return(a=(i=o.toString)==null?void 0:i.call(o))!=null?a:JSON.stringify(o)}).join(""),n&&n.proxy,r.map(({vnode:o})=>`at <${ph(n,o.type)}>`).join(`
`),r]);else{const o=[`[Vue warn]: ${e}`,...t];r.length&&o.push(`
`,...J0(r)),console.warn(...o)}js()}function Q0(){let e=Mo[Mo.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const s=e.component&&e.component.parent;e=s&&s.vnode}return t}function J0(e){const t=[];return e.forEach((n,s)=>{t.push(...s===0?[]:[`
`],...X0(n))}),t}function X0({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",s=e.component?e.component.parent==null:!1,r=` at <${ph(e.component,e.type,s)}`,o=">"+n;return e.props?[r,...Z0(e.props),o]:[r+o]}function Z0(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(s=>{t.push(...yf(s,e[s]))}),n.length>3&&t.push(" ..."),t}function yf(e,t,n){return Et(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:Ft(t)?(t=yf(e,lt(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):Ye(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=lt(t),n?t:[`${e}=`,t])}function xs(e,t,n,s){try{return s?e(...s):e()}catch(r){Oo(r,t,n)}}function jn(e,t,n,s){if(Ye(e)){const o=xs(e,t,n,s);return o&&jd(o)&&o.catch(i=>{Oo(i,t,n)}),o}const r=[];for(let o=0;o<e.length;o++)r.push(jn(e[o],t,n,s));return r}function Oo(e,t,n,s=!0){const r=t?t.vnode:null;if(t){let o=t.parent;const i=t.proxy,a=`https://vuejs.org/error-reference/#runtime-${n}`;for(;o;){const u=o.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](e,i,a)===!1)return}o=o.parent}const c=t.appContext.config.errorHandler;if(c){xs(c,null,10,[e,i,a]);return}}Y0(e,n,r,s)}function Y0(e,t,n,s=!0){console.error(e)}let Ro=!1,Ic=!1;const hn=[];let ls=0;const Wr=[];let Fs=null,ar=0;const bf=Promise.resolve();let Pc=null;function kt(e){const t=Pc||bf;return e?t.then(this?e.bind(this):e):t}function ey(e){let t=ls+1,n=hn.length;for(;t<n;){const s=t+n>>>1,r=hn[s],o=Lo(r);o<e||o===e&&r.pre?t=s+1:n=s}return t}function Zi(e){(!hn.length||!hn.includes(e,Ro&&e.allowRecurse?ls+1:ls))&&(e.id==null?hn.push(e):hn.splice(ey(e.id),0,e),_f())}function _f(){!Ro&&!Ic&&(Ic=!0,Pc=bf.then(kf))}function ty(e){const t=hn.indexOf(e);t>ls&&hn.splice(t,1)}function ny(e){Ve(e)?Wr.push(...e):(!Fs||!Fs.includes(e,e.allowRecurse?ar+1:ar))&&Wr.push(e),_f()}function xf(e,t,n=Ro?ls+1:0){for(;n<hn.length;n++){const s=hn[n];if(s&&s.pre){if(e&&s.id!==e.uid)continue;hn.splice(n,1),n--,s()}}}function wf(e){if(Wr.length){const t=[...new Set(Wr)].sort((n,s)=>Lo(n)-Lo(s));if(Wr.length=0,Fs){Fs.push(...t);return}for(Fs=t,ar=0;ar<Fs.length;ar++)Fs[ar]();Fs=null,ar=0}}const Lo=e=>e.id==null?1/0:e.id,sy=(e,t)=>{const n=Lo(e)-Lo(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function kf(e){Ic=!1,Ro=!0,hn.sort(sy);const t=En;try{for(ls=0;ls<hn.length;ls++){const n=hn[ls];n&&n.active!==!1&&(Po.NODE_ENV!=="production"&&t(n),xs(n,null,14))}}finally{ls=0,hn.length=0,wf(),Ro=!1,Pc=null,(hn.length||Wr.length)&&kf()}}function ry(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||tt;let r=n;const o=t.startsWith("update:"),i=o&&t.slice(7);if(i&&i in s){const d=`${i==="modelValue"?"model":i}Modifiers`,{number:f,trim:h}=s[d]||tt;h&&(r=n.map(g=>Et(g)?g.trim():g)),f&&(r=n.map(Eo))}let a,c=s[a=qi(t)]||s[a=qi(An(t))];!c&&o&&(c=s[a=qi(Rs(t))]),c&&jn(c,e,6,r);const u=s[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,jn(u,e,6,r)}}function Sf(e,t,n=!1){const s=t.emitsCache,r=s.get(e);if(r!==void 0)return r;const o=e.emits;let i={},a=!1;if(!Ye(e)){const c=u=>{const d=Sf(u,t,!0);d&&(a=!0,Xt(i,d))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!o&&!a?(_t(e)&&s.set(e,null),null):(Ve(o)?o.forEach(c=>i[c]=null):Xt(i,o),_t(e)&&s.set(e,i),i)}function Yi(e,t){return!e||!Ni(t)?!1:(t=t.slice(2).replace(/Once$/,""),ut(e,t[0].toLowerCase()+t.slice(1))||ut(e,Rs(t))||ut(e,t))}let Ht=null,ea=null;function ta(e){const t=Ht;return Ht=e,ea=e&&e.type.__scopeId||null,t}function nn(e){ea=e}function sn(){ea=null}function Se(e,t=Ht,n){if(!t||e._n)return e;const s=(...r)=>{s._d&&ih(-1);const o=ta(t);let i;try{i=e(...r)}finally{ta(o),s._d&&ih(1)}return i};return s._n=!0,s._c=!0,s._d=!0,s}function MK(){}function $f(e){const{type:t,vnode:n,proxy:s,withProxy:r,props:o,propsOptions:[i],slots:a,attrs:c,emit:u,render:d,renderCache:f,data:h,setupState:g,ctx:p,inheritAttrs:v}=e;let _,k;const w=ta(e);try{if(n.shapeFlag&4){const E=r||s,P=Po.NODE_ENV!=="production"&&g.__isScriptSetup?new Proxy(E,{get(I,M,L){return K0(`Property '${String(M)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(I,M,L)}}):E;_=us(d.call(P,E,f,o,g,h,p)),k=c}else{const E=t;Po.NODE_ENV,_=us(E.length>1?E(o,Po.NODE_ENV!=="production"?{get attrs(){return c},slots:a,emit:u}:{attrs:c,slots:a,emit:u}):E(o,null)),k=t.props?c:oy(c)}}catch(E){Uo.length=0,Oo(E,e,1),_=G(Pn)}let $=_;if(k&&v!==!1){const E=Object.keys(k),{shapeFlag:P}=$;E.length&&P&7&&(i&&E.some(pc)&&(k=iy(k,i)),$=cs($,k))}return n.dirs&&($=cs($),$.dirs=$.dirs?$.dirs.concat(n.dirs):n.dirs),n.transition&&($.transition=n.transition),_=$,ta(w),_}const oy=e=>{let t;for(const n in e)(n==="class"||n==="style"||Ni(n))&&((t||(t={}))[n]=e[n]);return t},iy=(e,t)=>{const n={};for(const s in e)(!pc(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function ay(e,t,n){const{props:s,children:r,component:o}=e,{props:i,children:a,patchFlag:c}=t,u=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return s?Cf(s,i,u):!!i;if(c&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const h=d[f];if(i[h]!==s[h]&&!Yi(u,h))return!0}}}else return(r||a)&&(!a||!a.$stable)?!0:s===i?!1:s?i?Cf(s,i,u):!0:!!i;return!1}function Cf(e,t,n){const s=Object.keys(t);if(s.length!==Object.keys(e).length)return!0;for(let r=0;r<s.length;r++){const o=s[r];if(t[o]!==e[o]&&!Yi(n,o))return!0}return!1}function ly({vnode:e,parent:t},n){for(;t;){const s=t.subTree;if(s.suspense&&s.suspense.activeBranch===e&&(s.el=e.el),s===e)(e=t.vnode).el=n,t=t.parent;else break}}const cy="components",Tf=Symbol.for("v-ndc");function Nt(e){return Et(e)?uy(cy,e,!1)||e:e||Tf}function uy(e,t,n=!0,s=!1){const r=Ht||qt;if(r){const o=r.type;{const a=ya(o,!1);if(a&&(a===t||a===An(t)||a===zi(An(t))))return o}const i=Ef(r[e]||o[e],t)||Ef(r.appContext[e],t);return!i&&s?o:i}}function Ef(e,t){return e&&(e[t]||e[An(t)]||e[zi(An(t))])}const Af=e=>e.__isSuspense;function dy(e,t){t&&t.pendingBranch?Ve(e)?t.effects.push(...e):t.effects.push(e):ny(e)}const fy=Symbol.for("v-scx"),hy=()=>Qr(fy);function ws(e,t){return sa(e,null,t)}function py(e,t){return sa(e,null,{flush:"sync"})}const na={};function Pe(e,t,n){return sa(e,t,n)}function sa(e,t,{immediate:n,deep:s,flush:r,once:o,onTrack:i,onTrigger:a}=tt){if(t&&o){const I=t;t=(...M)=>{I(...M),P()}}const c=qt,u=I=>s===!0?I:lr(I,s===!1?1:void 0);let d,f=!1,h=!1;if(Ft(e)?(d=()=>e.value,f=Xi(e)):Vr(e)?(d=()=>u(e),f=!0):Ve(e)?(h=!0,f=e.some(I=>Vr(I)||Xi(I)),d=()=>e.map(I=>{if(Ft(I))return I.value;if(Vr(I))return u(I);if(Ye(I))return xs(I,c,2)})):Ye(e)?t?d=()=>xs(e,c,2):d=()=>(g&&g(),jn(e,c,3,[p])):d=En,t&&s){const I=d;d=()=>lr(I())}let g,p=I=>{g=$.onStop=()=>{xs(I,c,4),g=$.onStop=void 0}},v;if(Go)if(p=En,t?n&&jn(t,c,3,[d(),h?[]:void 0,p]):d(),r==="sync"){const I=hy();v=I.__watcherHandles||(I.__watcherHandles=[])}else return En;let _=h?new Array(e.length).fill(na):na;const k=()=>{if(!(!$.active||!$.dirty))if(t){const I=$.run();(s||f||(h?I.some((M,L)=>as(M,_[L])):as(I,_)))&&(g&&g(),jn(t,c,3,[I,_===na?void 0:h&&_[0]===na?[]:_,p]),_=I)}else $.run()};k.allowRecurse=!!t;let w;r==="sync"?w=k:r==="post"?w=()=>rn(k,c&&c.suspense):(k.pre=!0,c&&(k.id=c.uid),w=()=>Zi(k));const $=new bc(d,En,w),E=Hd(),P=()=>{$.stop(),E&&mc(E.effects,$)};return t?n?k():_=$.run():r==="post"?rn($.run.bind($),c&&c.suspense):$.run(),v&&v.push(P),P}function my(e,t,n){const s=this.proxy,r=Et(e)?e.includes(".")?If(s,e):()=>s[e]:e.bind(s,s);let o;Ye(t)?o=t:(o=t.handler,n=t);const i=Wo(this),a=sa(r,o.bind(s),n);return i(),a}function If(e,t){const n=t.split(".");return()=>{let s=e;for(let r=0;r<n.length&&s;r++)s=s[n[r]];return s}}function lr(e,t,n=0,s){if(!_t(e)||e.__v_skip)return e;if(t&&t>0){if(n>=t)return e;n++}if(s=s||new Set,s.has(e))return e;if(s.add(e),Ft(e))lr(e.value,t,n,s);else if(Ve(e))for(let r=0;r<e.length;r++)lr(e[r],t,n,s);else if(zr(e)||Fr(e))e.forEach(r=>{lr(r,t,n,s)});else if(Fd(e))for(const r in e)lr(e[r],t,n,s);return e}function Rt(e,t){if(Ht===null)return e;const n=va(Ht)||Ht.proxy,s=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[o,i,a,c=tt]=t[r];o&&(Ye(o)&&(o={mounted:o,updated:o}),o.deep&&lr(i),s.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:c}))}return e}function cr(e,t,n,s){const r=e.dirs,o=t&&t.dirs;for(let i=0;i<r.length;i++){const a=r[i];o&&(a.oldValue=o[i].value);let c=a.dir[s];c&&(Ds(),jn(c,n,8,[e.el,a,e,t]),js())}}const zs=Symbol("_leaveCb"),ra=Symbol("_enterCb");function gy(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Qe(()=>{e.isMounted=!0}),Jn(()=>{e.isUnmounting=!0}),e}const Nn=[Function,Array],Pf={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Nn,onEnter:Nn,onAfterEnter:Nn,onEnterCancelled:Nn,onBeforeLeave:Nn,onLeave:Nn,onAfterLeave:Nn,onLeaveCancelled:Nn,onBeforeAppear:Nn,onAppear:Nn,onAfterAppear:Nn,onAppearCancelled:Nn},vy={name:"BaseTransition",props:Pf,setup(e,{slots:t}){const n=Zn(),s=gy();return()=>{const r=t.default&&Rf(t.default(),!0);if(!r||!r.length)return;let o=r[0];if(r.length>1){for(const h of r)if(h.type!==Pn){o=h;break}}const i=lt(e),{mode:a}=i;if(s.isLeaving)return Oc(o);const c=Of(o);if(!c)return Oc(o);const u=Mc(c,i,s,n);oa(c,u);const d=n.subTree,f=d&&Of(d);if(f&&f.type!==Pn&&!qs(c,f)){const h=Mc(f,i,s,n);if(oa(f,h),a==="out-in")return s.isLeaving=!0,h.afterLeave=()=>{s.isLeaving=!1,n.update.active!==!1&&(n.effect.dirty=!0,n.update())},Oc(o);a==="in-out"&&c.type!==Pn&&(h.delayLeave=(g,p,v)=>{const _=Mf(s,f);_[String(f.key)]=f,g[zs]=()=>{p(),g[zs]=void 0,delete u.delayedLeave},u.delayedLeave=v})}return o}}};function Mf(e,t){const{leavingVNodes:n}=e;let s=n.get(t.type);return s||(s=Object.create(null),n.set(t.type,s)),s}function Mc(e,t,n,s){const{appear:r,mode:o,persisted:i=!1,onBeforeEnter:a,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:f,onLeave:h,onAfterLeave:g,onLeaveCancelled:p,onBeforeAppear:v,onAppear:_,onAfterAppear:k,onAppearCancelled:w}=t,$=String(e.key),E=Mf(n,e),P=(L,V)=>{L&&jn(L,s,9,V)},I=(L,V)=>{const X=V[1];P(L,V),Ve(L)?L.every(T=>T.length<=1)&&X():L.length<=1&&X()},M={mode:o,persisted:i,beforeEnter(L){let V=a;if(!n.isMounted)if(r)V=v||a;else return;L[zs]&&L[zs](!0);const X=E[$];X&&qs(e,X)&&X.el[zs]&&X.el[zs](),P(V,[L])},enter(L){let V=c,X=u,T=d;if(!n.isMounted)if(r)V=_||c,X=k||u,T=w||d;else return;let A=!1;const D=L[ra]=Q=>{A||(A=!0,Q?P(T,[L]):P(X,[L]),M.delayedLeave&&M.delayedLeave(),L[ra]=void 0)};V?I(V,[L,D]):D()},leave(L,V){const X=String(e.key);if(L[ra]&&L[ra](!0),n.isUnmounting)return V();P(f,[L]);let T=!1;const A=L[zs]=D=>{T||(T=!0,V(),D?P(p,[L]):P(g,[L]),L[zs]=void 0,E[X]===e&&delete E[X])};E[X]=e,h?I(h,[L,A]):A()},clone(L){return Mc(L,t,n,s)}};return M}function Oc(e){if(Do(e))return e=cs(e),e.children=null,e}function Of(e){return Do(e)?e.children?e.children[0]:void 0:e}function oa(e,t){e.shapeFlag&6&&e.component?oa(e.component.subTree,t):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Rf(e,t=!1,n){let s=[],r=0;for(let o=0;o<e.length;o++){let i=e[o];const a=n==null?i.key:String(n)+String(i.key!=null?i.key:o);i.type===be?(i.patchFlag&128&&r++,s=s.concat(Rf(i.children,t,a))):(t||i.type!==Pn)&&s.push(a!=null?cs(i,{key:a}):i)}if(r>1)for(let o=0;o<s.length;o++)s[o].patchFlag=-2;return s}/*! #__NO_SIDE_EFFECTS__ */function Zt(e,t){return Ye(e)?Xt({name:e.name},t,{setup:e}):e}const Gr=e=>!!e.type.__asyncLoader;/*! #__NO_SIDE_EFFECTS__ */function Wt(e){Ye(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:s,delay:r=200,timeout:o,suspensible:i=!0,onError:a}=e;let c=null,u,d=0;const f=()=>(d++,c=null,h()),h=()=>{let g;return c||(g=c=t().catch(p=>{if(p=p instanceof Error?p:new Error(String(p)),a)return new Promise((v,_)=>{a(p,()=>v(f()),()=>_(p),d+1)});throw p}).then(p=>g!==c&&c?c:(p&&(p.__esModule||p[Symbol.toStringTag]==="Module")&&(p=p.default),u=p,p)))};return Zt({name:"AsyncComponentWrapper",__asyncLoader:h,get __asyncResolved(){return u},setup(){const g=qt;if(u)return()=>Rc(u,g);const p=w=>{c=null,Oo(w,g,13,!s)};if(i&&g.suspense||Go)return h().then(w=>()=>Rc(w,g)).catch(w=>(p(w),()=>s?G(s,{error:w}):null));const v=R(!1),_=R(),k=R(!!r);return r&&setTimeout(()=>{k.value=!1},r),o!=null&&setTimeout(()=>{if(!v.value&&!_.value){const w=new Error(`Async component timed out after ${o}ms.`);p(w),_.value=w}},o),h().then(()=>{v.value=!0,g.parent&&Do(g.parent.vnode)&&(g.parent.effect.dirty=!0,Zi(g.parent.update))}).catch(w=>{p(w),_.value=w}),()=>{if(v.value&&u)return Rc(u,g);if(_.value&&s)return G(s,{error:_.value});if(n&&!k.value)return G(n)}}})}function Rc(e,t){const{ref:n,props:s,children:r,ce:o}=t.vnode,i=G(e,s,r);return i.ref=n,i.ce=o,delete t.vnode.ce,i}const Do=e=>e.type.__isKeepAlive,jo={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=Zn(),s=n.ctx;if(!s.renderer)return()=>{const w=t.default&&t.default();return w&&w.length===1?w[0]:w};const r=new Map,o=new Set;let i=null;const a=n.suspense,{renderer:{p:c,m:u,um:d,o:{createElement:f}}}=s,h=f("div");s.activate=(w,$,E,P,I)=>{const M=w.component;u(w,$,E,0,a),c(M.vnode,w,$,E,M,a,P,w.slotScopeIds,I),rn(()=>{M.isDeactivated=!1,M.a&&Br(M.a);const L=w.props&&w.props.onVnodeMounted;L&&Fn(L,M.parent,w)},a)},s.deactivate=w=>{const $=w.component;u(w,h,null,1,a),rn(()=>{$.da&&Br($.da);const E=w.props&&w.props.onVnodeUnmounted;E&&Fn(E,$.parent,w),$.isDeactivated=!0},a)};function g(w){Lc(w),d(w,n,a,!0)}function p(w){r.forEach(($,E)=>{const P=ya($.type);P&&(!w||!w(P))&&v(E)})}function v(w){const $=r.get(w);!i||!qs($,i)?g($):i&&Lc(i),r.delete(w),o.delete(w)}Pe(()=>[e.include,e.exclude],([w,$])=>{w&&p(E=>No(w,E)),$&&p(E=>!No($,E))},{flush:"post",deep:!0});let _=null;const k=()=>{_!=null&&r.set(_,Dc(n.subTree))};return Qe(k),jf(k),Jn(()=>{r.forEach(w=>{const{subTree:$,suspense:E}=n,P=Dc($);if(w.type===P.type&&w.key===P.key){Lc(P);const I=P.component.da;I&&rn(I,E);return}g(w)})}),()=>{if(_=null,!t.default)return null;const w=t.default(),$=w[0];if(w.length>1)return i=null,w;if(!Ho($)||!($.shapeFlag&4)&&!($.shapeFlag&128))return i=null,$;let E=Dc($);const P=E.type,I=ya(Gr(E)?E.type.__asyncResolved||{}:P),{include:M,exclude:L,max:V}=e;if(M&&(!I||!No(M,I))||L&&I&&No(L,I))return i=E,$;const X=E.key==null?P:E.key,T=r.get(X);return E.el&&(E=cs(E),$.shapeFlag&128&&($.ssContent=E)),_=X,T?(E.el=T.el,E.component=T.component,E.transition&&oa(E,E.transition),E.shapeFlag|=512,o.delete(X),o.add(X)):(o.add(X),V&&o.size>parseInt(V,10)&&v(o.values().next().value)),E.shapeFlag|=256,i=E,Af($.type)?$:E}}};function No(e,t){return Ve(e)?e.some(n=>No(n,t)):Et(e)?e.split(",").includes(t):o0(e)?e.test(t):!1}function Lf(e,t){Df(e,"a",t)}function yy(e,t){Df(e,"da",t)}function Df(e,t,n=qt){const s=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(ia(t,s,n),n){let r=n.parent;for(;r&&r.parent;)Do(r.parent.vnode)&&by(s,t,n,r),r=r.parent}}function by(e,t,n,s){const r=ia(t,e,s,!0);Lt(()=>{mc(s[t],r)},n)}function Lc(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function Dc(e){return e.shapeFlag&128?e.ssContent:e}function ia(e,t,n=qt,s=!1){if(n){const r=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;Ds();const a=Wo(n),c=jn(t,n,e,i);return a(),js(),c});return s?r.unshift(o):r.push(o),o}}const ks=e=>(t,n=qt)=>(!Go||e==="sp")&&ia(e,(...s)=>t(...s),n),_y=ks("bm"),Qe=ks("m"),xy=ks("bu"),jf=ks("u"),Jn=ks("bum"),Lt=ks("um"),wy=ks("sp"),ky=ks("rtg"),Sy=ks("rtc");function $y(e,t=qt){ia("ec",e,t)}function Ie(e,t,n,s){let r;const o=n;if(Ve(e)||Et(e)){r=new Array(e.length);for(let i=0,a=e.length;i<a;i++)r[i]=t(e[i],i,void 0,o)}else if(typeof e=="number"){r=new Array(e);for(let i=0;i<e;i++)r[i]=t(i+1,i,void 0,o)}else if(_t(e))if(e[Symbol.iterator])r=Array.from(e,(i,a)=>t(i,a,void 0,o));else{const i=Object.keys(e);r=new Array(i.length);for(let a=0,c=i.length;a<c;a++){const u=i[a];r[a]=t(e[u],u,a,o)}}else r=[];return r}function It(e,t,n={},s,r){if(Ht.isCE||Ht.parent&&Gr(Ht.parent)&&Ht.parent.isCE)return t!=="default"&&(n.name=t),G("slot",n,s&&s());let o=e[t];o&&o._c&&(o._d=!1),m();const i=o&&Nf(o(n)),a=oe(be,{key:n.key||i&&i.key||`_${t}`},i||(s?s():[]),i&&e._===1?64:-2);return a.scopeId&&(a.slotScopeIds=[a.scopeId+"-s"]),o&&o._c&&(o._d=!0),a}function Nf(e){return e.some(t=>Ho(t)?!(t.type===Pn||t.type===be&&!Nf(t.children)):!0)?e:null}const jc=e=>e?uh(e)?va(e)||e.proxy:jc(e.parent):null,Fo=Xt(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>jc(e.parent),$root:e=>jc(e.root),$emit:e=>e.emit,$options:e=>Uf(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,Zi(e.update)}),$nextTick:e=>e.n||(e.n=kt.bind(e.proxy)),$watch:e=>my.bind(e)}),Nc=(e,t)=>e!==tt&&!e.__isScriptSetup&&ut(e,t),Cy={get({_:e},t){const{ctx:n,setupState:s,data:r,props:o,accessCache:i,type:a,appContext:c}=e;let u;if(t[0]!=="$"){const g=i[t];if(g!==void 0)switch(g){case 1:return s[t];case 2:return r[t];case 4:return n[t];case 3:return o[t]}else{if(Nc(s,t))return i[t]=1,s[t];if(r!==tt&&ut(r,t))return i[t]=2,r[t];if((u=e.propsOptions[0])&&ut(u,t))return i[t]=3,o[t];if(n!==tt&&ut(n,t))return i[t]=4,n[t];Fc&&(i[t]=0)}}const d=Fo[t];let f,h;if(d)return t==="$attrs"&&_n(e,"get",t),d(e);if((f=a.__cssModules)&&(f=f[t]))return f;if(n!==tt&&ut(n,t))return i[t]=4,n[t];if(h=c.config.globalProperties,ut(h,t))return h[t]},set({_:e},t,n){const{data:s,setupState:r,ctx:o}=e;return Nc(r,t)?(r[t]=n,!0):s!==tt&&ut(s,t)?(s[t]=n,!0):ut(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:r,propsOptions:o}},i){let a;return!!n[i]||e!==tt&&ut(e,i)||Nc(t,i)||(a=o[0])&&ut(a,i)||ut(s,i)||ut(Fo,i)||ut(r.config.globalProperties,i)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:ut(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Ff(){return zf().slots}function Ty(){return zf().attrs}function zf(){const e=Zn();return e.setupContext||(e.setupContext=hh(e))}function aa(e){return Ve(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function Kr(e,t){return!e||!t?e||t:Ve(e)&&Ve(t)?e.concat(t):Xt({},aa(e),aa(t))}let Fc=!0;function Ey(e){const t=Uf(e),n=e.proxy,s=e.ctx;Fc=!1,t.beforeCreate&&qf(t.beforeCreate,e,"bc");const{data:r,computed:o,methods:i,watch:a,provide:c,inject:u,created:d,beforeMount:f,mounted:h,beforeUpdate:g,updated:p,activated:v,deactivated:_,beforeDestroy:k,beforeUnmount:w,destroyed:$,unmounted:E,render:P,renderTracked:I,renderTriggered:M,errorCaptured:L,serverPrefetch:V,expose:X,inheritAttrs:T,components:A,directives:D,filters:Q}=t;if(u&&Ay(u,s,null),i)for(const K in i){const F=i[K];Ye(F)&&(s[K]=F.bind(n))}if(r){const K=r.call(n,n);_t(K)&&(e.data=dt(K))}if(Fc=!0,o)for(const K in o){const F=o[K],ne=Ye(F)?F.bind(n,n):Ye(F.get)?F.get.bind(n,n):En,fe=!Ye(F)&&Ye(F.set)?F.set.bind(n):En,_e=ee({get:ne,set:fe});Object.defineProperty(s,K,{enumerable:!0,configurable:!0,get:()=>_e.value,set:we=>_e.value=we})}if(a)for(const K in a)Bf(a[K],s,n,K);if(c){const K=Ye(c)?c.call(n):c;Reflect.ownKeys(K).forEach(F=>{qc(F,K[F])})}d&&qf(d,e,"c");function H(K,F){Ve(F)?F.forEach(ne=>K(ne.bind(n))):F&&K(F.bind(n))}if(H(_y,f),H(Qe,h),H(xy,g),H(jf,p),H(Lf,v),H(yy,_),H($y,L),H(Sy,I),H(ky,M),H(Jn,w),H(Lt,E),H(wy,V),Ve(X))if(X.length){const K=e.exposed||(e.exposed={});X.forEach(F=>{Object.defineProperty(K,F,{get:()=>n[F],set:ne=>n[F]=ne})})}else e.exposed||(e.exposed={});P&&e.render===En&&(e.render=P),T!=null&&(e.inheritAttrs=T),A&&(e.components=A),D&&(e.directives=D)}function Ay(e,t,n=En){Ve(e)&&(e=zc(e));for(const s in e){const r=e[s];let o;_t(r)?"default"in r?o=Qr(r.from||s,r.default,!0):o=Qr(r.from||s):o=Qr(r),Ft(o)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[s]=o}}function qf(e,t,n){jn(Ve(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function Bf(e,t,n,s){const r=s.includes(".")?If(n,s):()=>n[s];if(Et(e)){const o=t[e];Ye(o)&&Pe(r,o)}else if(Ye(e))Pe(r,e.bind(n));else if(_t(e))if(Ve(e))e.forEach(o=>Bf(o,t,n,s));else{const o=Ye(e.handler)?e.handler.bind(n):t[e.handler];Ye(o)&&Pe(r,o,e)}}function Uf(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:r,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,a=o.get(t);let c;return a?c=a:!r.length&&!n&&!s?c=t:(c={},r.length&&r.forEach(u=>la(c,u,i,!0)),la(c,t,i)),_t(t)&&o.set(t,c),c}function la(e,t,n,s=!1){const{mixins:r,extends:o}=t;o&&la(e,o,n,!0),r&&r.forEach(i=>la(e,i,n,!0));for(const i in t)if(!(s&&i==="expose")){const a=Iy[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const Iy={data:Vf,props:Hf,emits:Hf,methods:zo,computed:zo,beforeCreate:gn,created:gn,beforeMount:gn,mounted:gn,beforeUpdate:gn,updated:gn,beforeDestroy:gn,beforeUnmount:gn,destroyed:gn,unmounted:gn,activated:gn,deactivated:gn,errorCaptured:gn,serverPrefetch:gn,components:zo,directives:zo,watch:My,provide:Vf,inject:Py};function Vf(e,t){return t?e?function(){return Xt(Ye(e)?e.call(this,this):e,Ye(t)?t.call(this,this):t)}:t:e}function Py(e,t){return zo(zc(e),zc(t))}function zc(e){if(Ve(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function gn(e,t){return e?[...new Set([].concat(e,t))]:t}function zo(e,t){return e?Xt(Object.create(null),e,t):t}function Hf(e,t){return e?Ve(e)&&Ve(t)?[...new Set([...e,...t])]:Xt(Object.create(null),aa(e),aa(t??{})):t}function My(e,t){if(!e)return t;if(!t)return e;const n=Xt(Object.create(null),e);for(const s in t)n[s]=gn(e[s],t[s]);return n}function Wf(){return{app:null,config:{isNativeTag:s0,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Oy=0;function Ry(e,t){return function(s,r=null){Ye(s)||(s=Xt({},s)),r!=null&&!_t(r)&&(r=null);const o=Wf(),i=new WeakSet;let a=!1;const c=o.app={_uid:Oy++,_component:s,_props:r,_container:null,_context:o,_instance:null,version:r1,get config(){return o.config},set config(u){},use(u,...d){return i.has(u)||(u&&Ye(u.install)?(i.add(u),u.install(c,...d)):Ye(u)&&(i.add(u),u(c,...d))),c},mixin(u){return o.mixins.includes(u)||o.mixins.push(u),c},component(u,d){return d?(o.components[u]=d,c):o.components[u]},directive(u,d){return d?(o.directives[u]=d,c):o.directives[u]},mount(u,d,f){if(!a){const h=G(s,r);return h.appContext=o,f===!0?f="svg":f===!1&&(f=void 0),e(h,u,f),a=!0,c._container=u,u.__vue_app__=c,va(h.component)||h.component.proxy}},unmount(){a&&(e(null,c._container),delete c._container.__vue_app__)},provide(u,d){return o.provides[u]=d,c},runWithContext(u){const d=qo;qo=c;try{return u()}finally{qo=d}}};return c}}let qo=null;function qc(e,t){if(qt){let n=qt.provides;const s=qt.parent&&qt.parent.provides;s===n&&(n=qt.provides=Object.create(s)),n[e]=t}}function Qr(e,t,n=!1){const s=qt||Ht;if(s||qo){const r=s?s.parent==null?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:qo._context.provides;if(r&&e in r)return r[e];if(arguments.length>1)return n&&Ye(t)?t.call(s&&s.proxy):t}}function Ly(e,t,n,s=!1){const r={},o={};Bi(o,fa,1),e.propsDefaults=Object.create(null),Gf(e,t,r,o);for(const i in e.propsOptions[0])i in r||(r[i]=void 0);n?e.props=s?r:F0(r):e.type.props?e.props=r:e.props=o,e.attrs=o}function Dy(e,t,n,s){const{props:r,attrs:o,vnode:{patchFlag:i}}=e,a=lt(r),[c]=e.propsOptions;let u=!1;if((s||i>0)&&!(i&16)){if(i&8){const d=e.vnode.dynamicProps;for(let f=0;f<d.length;f++){let h=d[f];if(Yi(e.emitsOptions,h))continue;const g=t[h];if(c)if(ut(o,h))g!==o[h]&&(o[h]=g,u=!0);else{const p=An(h);r[p]=Bc(c,a,p,g,e,!1)}else g!==o[h]&&(o[h]=g,u=!0)}}}else{Gf(e,t,r,o)&&(u=!0);let d;for(const f in a)(!t||!ut(t,f)&&((d=Rs(f))===f||!ut(t,d)))&&(c?n&&(n[f]!==void 0||n[d]!==void 0)&&(r[f]=Bc(c,a,f,void 0,e,!0)):delete r[f]);if(o!==a)for(const f in o)(!t||!ut(t,f))&&(delete o[f],u=!0)}u&&_s(e,"set","$attrs")}function Gf(e,t,n,s){const[r,o]=e.propsOptions;let i=!1,a;if(t)for(let c in t){if(To(c))continue;const u=t[c];let d;r&&ut(r,d=An(c))?!o||!o.includes(d)?n[d]=u:(a||(a={}))[d]=u:Yi(e.emitsOptions,c)||(!(c in s)||u!==s[c])&&(s[c]=u,i=!0)}if(o){const c=lt(n),u=a||tt;for(let d=0;d<o.length;d++){const f=o[d];n[f]=Bc(r,c,f,u[f],e,!ut(u,f))}}return i}function Bc(e,t,n,s,r,o){const i=e[n];if(i!=null){const a=ut(i,"default");if(a&&s===void 0){const c=i.default;if(i.type!==Function&&!i.skipFactory&&Ye(c)){const{propsDefaults:u}=r;if(n in u)s=u[n];else{const d=Wo(r);s=u[n]=c.call(null,t),d()}}else s=c}i[0]&&(o&&!a?s=!1:i[1]&&(s===""||s===Rs(n))&&(s=!0))}return s}function Kf(e,t,n=!1){const s=t.propsCache,r=s.get(e);if(r)return r;const o=e.props,i={},a=[];let c=!1;if(!Ye(e)){const d=f=>{c=!0;const[h,g]=Kf(f,t,!0);Xt(i,h),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!o&&!c)return _t(e)&&s.set(e,tn),tn;if(Ve(o))for(let d=0;d<o.length;d++){const f=An(o[d]);Qf(f)&&(i[f]=tt)}else if(o)for(const d in o){const f=An(d);if(Qf(f)){const h=o[d],g=i[f]=Ve(h)||Ye(h)?{type:h}:Xt({},h);if(g){const p=Zf(Boolean,g.type),v=Zf(String,g.type);g[0]=p>-1,g[1]=v<0||p<v,(p>-1||ut(g,"default"))&&a.push(f)}}}const u=[i,a];return _t(e)&&s.set(e,u),u}function Qf(e){return e[0]!=="$"&&!To(e)}function Jf(e){return e===null?"null":typeof e=="function"?e.name||"":typeof e=="object"&&e.constructor&&e.constructor.name||""}function Xf(e,t){return Jf(e)===Jf(t)}function Zf(e,t){return Ve(t)?t.findIndex(n=>Xf(n,e)):Ye(t)&&Xf(t,e)?0:-1}const Yf=e=>e[0]==="_"||e==="$stable",Uc=e=>Ve(e)?e.map(us):[us(e)],jy=(e,t,n)=>{if(t._n)return t;const s=Se((...r)=>(Po.NODE_ENV!=="production"&&qt&&(!n||(n.root,qt.root)),Uc(t(...r))),n);return s._c=!1,s},eh=(e,t,n)=>{const s=e._ctx;for(const r in e){if(Yf(r))continue;const o=e[r];if(Ye(o))t[r]=jy(r,o,s);else if(o!=null){const i=Uc(o);t[r]=()=>i}}},th=(e,t)=>{const n=Uc(t);e.slots.default=()=>n},Ny=(e,t)=>{if(e.vnode.shapeFlag&32){const n=t._;n?(e.slots=lt(t),Bi(t,"_",n)):eh(t,e.slots={})}else e.slots={},t&&th(e,t);Bi(e.slots,fa,1)},Fy=(e,t,n)=>{const{vnode:s,slots:r}=e;let o=!0,i=tt;if(s.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:(Xt(r,t),!n&&a===1&&delete r._):(o=!t.$stable,eh(t,r)),i=t}else t&&(th(e,t),i={default:1});if(o)for(const a in r)!Yf(a)&&i[a]==null&&delete r[a]};function Vc(e,t,n,s,r=!1){if(Ve(e)){e.forEach((h,g)=>Vc(h,t&&(Ve(t)?t[g]:t),n,s,r));return}if(Gr(s)&&!r)return;const o=s.shapeFlag&4?va(s.component)||s.component.proxy:s.el,i=r?null:o,{i:a,r:c}=e,u=t&&t.r,d=a.refs===tt?a.refs={}:a.refs,f=a.setupState;if(u!=null&&u!==c&&(Et(u)?(d[u]=null,ut(f,u)&&(f[u]=null)):Ft(u)&&(u.value=null)),Ye(c))xs(c,a,12,[i,d]);else{const h=Et(c),g=Ft(c);if(h||g){const p=()=>{if(e.f){const v=h?ut(f,c)?f[c]:d[c]:c.value;r?Ve(v)&&mc(v,o):Ve(v)?v.includes(o)||v.push(o):h?(d[c]=[o],ut(f,c)&&(f[c]=d[c])):(c.value=[o],e.k&&(d[e.k]=c.value))}else h?(d[c]=i,ut(f,c)&&(f[c]=i)):g&&(c.value=i,e.k&&(d[e.k]=i))};i?(p.id=-1,rn(p,n)):p()}}}const rn=dy;function zy(e){return qy(e)}function qy(e,t){const n=qd();n.__VUE__=!0;const{insert:s,remove:r,patchProp:o,createElement:i,createText:a,createComment:c,setText:u,setElementText:d,parentNode:f,nextSibling:h,setScopeId:g=En,insertStaticContent:p}=e,v=(N,Y,Z,O=null,U=null,ie=null,me=void 0,ue=null,ge=!!Y.dynamicChildren)=>{if(N===Y)return;N&&!qs(N,Y)&&(O=Ce(N),we(N,U,ie,!0),N=null),Y.patchFlag===-2&&(ge=!1,Y.dynamicChildren=null);const{type:he,ref:Te,shapeFlag:De}=Y;switch(he){case ua:_(N,Y,Z,O);break;case Pn:k(N,Y,Z,O);break;case da:N==null&&w(Y,Z,O,me);break;case be:A(N,Y,Z,O,U,ie,me,ue,ge);break;default:De&1?P(N,Y,Z,O,U,ie,me,ue,ge):De&6?D(N,Y,Z,O,U,ie,me,ue,ge):(De&64||De&128)&&he.process(N,Y,Z,O,U,ie,me,ue,ge,Me)}Te!=null&&U&&Vc(Te,N&&N.ref,ie,Y||N,!Y)},_=(N,Y,Z,O)=>{if(N==null)s(Y.el=a(Y.children),Z,O);else{const U=Y.el=N.el;Y.children!==N.children&&u(U,Y.children)}},k=(N,Y,Z,O)=>{N==null?s(Y.el=c(Y.children||""),Z,O):Y.el=N.el},w=(N,Y,Z,O)=>{[N.el,N.anchor]=p(N.children,Y,Z,O,N.el,N.anchor)},$=({el:N,anchor:Y},Z,O)=>{let U;for(;N&&N!==Y;)U=h(N),s(N,Z,O),N=U;s(Y,Z,O)},E=({el:N,anchor:Y})=>{let Z;for(;N&&N!==Y;)Z=h(N),r(N),N=Z;r(Y)},P=(N,Y,Z,O,U,ie,me,ue,ge)=>{Y.type==="svg"?me="svg":Y.type==="math"&&(me="mathml"),N==null?I(Y,Z,O,U,ie,me,ue,ge):V(N,Y,U,ie,me,ue,ge)},I=(N,Y,Z,O,U,ie,me,ue)=>{let ge,he;const{props:Te,shapeFlag:De,transition:Le,dirs:Ae}=N;if(ge=N.el=i(N.type,ie,Te&&Te.is,Te),De&8?d(ge,N.children):De&16&&L(N.children,ge,null,O,U,Hc(N,ie),me,ue),Ae&&cr(N,null,O,"created"),M(ge,N,N.scopeId,me,O),Te){for(const ot in Te)ot!=="value"&&!To(ot)&&o(ge,ot,null,Te[ot],ie,N.children,O,U,de);"value"in Te&&o(ge,"value",null,Te.value,ie),(he=Te.onVnodeBeforeMount)&&Fn(he,O,N)}Ae&&cr(N,null,O,"beforeMount");const We=By(U,Le);We&&Le.beforeEnter(ge),s(ge,Y,Z),((he=Te&&Te.onVnodeMounted)||We||Ae)&&rn(()=>{he&&Fn(he,O,N),We&&Le.enter(ge),Ae&&cr(N,null,O,"mounted")},U)},M=(N,Y,Z,O,U)=>{if(Z&&g(N,Z),O)for(let ie=0;ie<O.length;ie++)g(N,O[ie]);if(U){let ie=U.subTree;if(Y===ie){const me=U.vnode;M(N,me,me.scopeId,me.slotScopeIds,U.parent)}}},L=(N,Y,Z,O,U,ie,me,ue,ge=0)=>{for(let he=ge;he<N.length;he++){const Te=N[he]=ue?Bs(N[he]):us(N[he]);v(null,Te,Y,Z,O,U,ie,me,ue)}},V=(N,Y,Z,O,U,ie,me)=>{const ue=Y.el=N.el;let{patchFlag:ge,dynamicChildren:he,dirs:Te}=Y;ge|=N.patchFlag&16;const De=N.props||tt,Le=Y.props||tt;let Ae;if(Z&&ur(Z,!1),(Ae=Le.onVnodeBeforeUpdate)&&Fn(Ae,Z,Y,N),Te&&cr(Y,N,Z,"beforeUpdate"),Z&&ur(Z,!0),he?X(N.dynamicChildren,he,ue,Z,O,Hc(Y,U),ie):me||F(N,Y,ue,null,Z,O,Hc(Y,U),ie,!1),ge>0){if(ge&16)T(ue,Y,De,Le,Z,O,U);else if(ge&2&&De.class!==Le.class&&o(ue,"class",null,Le.class,U),ge&4&&o(ue,"style",De.style,Le.style,U),ge&8){const We=Y.dynamicProps;for(let ot=0;ot<We.length;ot++){const it=We[ot],pt=De[it],yt=Le[it];(yt!==pt||it==="value")&&o(ue,it,pt,yt,U,N.children,Z,O,de)}}ge&1&&N.children!==Y.children&&d(ue,Y.children)}else!me&&he==null&&T(ue,Y,De,Le,Z,O,U);((Ae=Le.onVnodeUpdated)||Te)&&rn(()=>{Ae&&Fn(Ae,Z,Y,N),Te&&cr(Y,N,Z,"updated")},O)},X=(N,Y,Z,O,U,ie,me)=>{for(let ue=0;ue<Y.length;ue++){const ge=N[ue],he=Y[ue],Te=ge.el&&(ge.type===be||!qs(ge,he)||ge.shapeFlag&70)?f(ge.el):Z;v(ge,he,Te,null,O,U,ie,me,!0)}},T=(N,Y,Z,O,U,ie,me)=>{if(Z!==O){if(Z!==tt)for(const ue in Z)!To(ue)&&!(ue in O)&&o(N,ue,Z[ue],null,me,Y.children,U,ie,de);for(const ue in O){if(To(ue))continue;const ge=O[ue],he=Z[ue];ge!==he&&ue!=="value"&&o(N,ue,he,ge,me,Y.children,U,ie,de)}"value"in O&&o(N,"value",Z.value,O.value,me)}},A=(N,Y,Z,O,U,ie,me,ue,ge)=>{const he=Y.el=N?N.el:a(""),Te=Y.anchor=N?N.anchor:a("");let{patchFlag:De,dynamicChildren:Le,slotScopeIds:Ae}=Y;Ae&&(ue=ue?ue.concat(Ae):Ae),N==null?(s(he,Z,O),s(Te,Z,O),L(Y.children||[],Z,Te,U,ie,me,ue,ge)):De>0&&De&64&&Le&&N.dynamicChildren?(X(N.dynamicChildren,Le,Z,U,ie,me,ue),(Y.key!=null||U&&Y===U.subTree)&&Wc(N,Y,!0)):F(N,Y,Z,Te,U,ie,me,ue,ge)},D=(N,Y,Z,O,U,ie,me,ue,ge)=>{Y.slotScopeIds=ue,N==null?Y.shapeFlag&512?U.ctx.activate(Y,Z,O,me,ge):Q(Y,Z,O,U,ie,me,ge):W(N,Y,ge)},Q=(N,Y,Z,O,U,ie,me)=>{const ue=N.component=Xy(N,O,U);if(Do(N)&&(ue.ctx.renderer=Me),Zy(ue),ue.asyncDep){if(U&&U.registerDep(ue,H),!N.el){const ge=ue.subTree=G(Pn);k(null,ge,Y,Z)}}else H(ue,N,Y,Z,U,ie,me)},W=(N,Y,Z)=>{const O=Y.component=N.component;if(ay(N,Y,Z))if(O.asyncDep&&!O.asyncResolved){K(O,Y,Z);return}else O.next=Y,ty(O.update),O.effect.dirty=!0,O.update();else Y.el=N.el,O.vnode=Y},H=(N,Y,Z,O,U,ie,me)=>{const ue=()=>{if(N.isMounted){let{next:Te,bu:De,u:Le,parent:Ae,vnode:We}=N;{const Ot=nh(N);if(Ot){Te&&(Te.el=We.el,K(N,Te,me)),Ot.asyncDep.then(()=>{N.isUnmounted||ue()});return}}let ot=Te,it;ur(N,!1),Te?(Te.el=We.el,K(N,Te,me)):Te=We,De&&Br(De),(it=Te.props&&Te.props.onVnodeBeforeUpdate)&&Fn(it,Ae,Te,We),ur(N,!0);const pt=$f(N),yt=N.subTree;N.subTree=pt,v(yt,pt,f(yt.el),Ce(yt),N,U,ie),Te.el=pt.el,ot===null&&ly(N,pt.el),Le&&rn(Le,U),(it=Te.props&&Te.props.onVnodeUpdated)&&rn(()=>Fn(it,Ae,Te,We),U)}else{let Te;const{el:De,props:Le}=Y,{bm:Ae,m:We,parent:ot}=N,it=Gr(Y);ur(N,!1),Ae&&Br(Ae),!it&&(Te=Le&&Le.onVnodeBeforeMount)&&Fn(Te,ot,Y),ur(N,!0);{const pt=N.subTree=$f(N);v(null,pt,Z,O,N,U,ie),Y.el=pt.el}if(We&&rn(We,U),!it&&(Te=Le&&Le.onVnodeMounted)){const pt=Y;rn(()=>Fn(Te,ot,pt),U)}(Y.shapeFlag&256||ot&&Gr(ot.vnode)&&ot.vnode.shapeFlag&256)&&N.a&&rn(N.a,U),N.isMounted=!0,Y=Z=O=null}},ge=N.effect=new bc(ue,En,()=>Zi(he),N.scope),he=N.update=()=>{ge.dirty&&ge.run()};he.id=N.uid,ur(N,!0),he()},K=(N,Y,Z)=>{Y.component=N;const O=N.vnode.props;N.vnode=Y,N.next=null,Dy(N,Y.props,O,Z),Fy(N,Y.children,Z),Ds(),xf(N),js()},F=(N,Y,Z,O,U,ie,me,ue,ge=!1)=>{const he=N&&N.children,Te=N?N.shapeFlag:0,De=Y.children,{patchFlag:Le,shapeFlag:Ae}=Y;if(Le>0){if(Le&128){fe(he,De,Z,O,U,ie,me,ue,ge);return}else if(Le&256){ne(he,De,Z,O,U,ie,me,ue,ge);return}}Ae&8?(Te&16&&de(he,U,ie),De!==he&&d(Z,De)):Te&16?Ae&16?fe(he,De,Z,O,U,ie,me,ue,ge):de(he,U,ie,!0):(Te&8&&d(Z,""),Ae&16&&L(De,Z,O,U,ie,me,ue,ge))},ne=(N,Y,Z,O,U,ie,me,ue,ge)=>{N=N||tn,Y=Y||tn;const he=N.length,Te=Y.length,De=Math.min(he,Te);let Le;for(Le=0;Le<De;Le++){const Ae=Y[Le]=ge?Bs(Y[Le]):us(Y[Le]);v(N[Le],Ae,Z,null,U,ie,me,ue,ge)}he>Te?de(N,U,ie,!0,!1,De):L(Y,Z,O,U,ie,me,ue,ge,De)},fe=(N,Y,Z,O,U,ie,me,ue,ge)=>{let he=0;const Te=Y.length;let De=N.length-1,Le=Te-1;for(;he<=De&&he<=Le;){const Ae=N[he],We=Y[he]=ge?Bs(Y[he]):us(Y[he]);if(qs(Ae,We))v(Ae,We,Z,null,U,ie,me,ue,ge);else break;he++}for(;he<=De&&he<=Le;){const Ae=N[De],We=Y[Le]=ge?Bs(Y[Le]):us(Y[Le]);if(qs(Ae,We))v(Ae,We,Z,null,U,ie,me,ue,ge);else break;De--,Le--}if(he>De){if(he<=Le){const Ae=Le+1,We=Ae<Te?Y[Ae].el:O;for(;he<=Le;)v(null,Y[he]=ge?Bs(Y[he]):us(Y[he]),Z,We,U,ie,me,ue,ge),he++}}else if(he>Le)for(;he<=De;)we(N[he],U,ie,!0),he++;else{const Ae=he,We=he,ot=new Map;for(he=We;he<=Le;he++){const se=Y[he]=ge?Bs(Y[he]):us(Y[he]);se.key!=null&&ot.set(se.key,he)}let it,pt=0;const yt=Le-We+1;let Ot=!1,un=0;const zt=new Array(yt);for(he=0;he<yt;he++)zt[he]=0;for(he=Ae;he<=De;he++){const se=N[he];if(pt>=yt){we(se,U,ie,!0);continue}let ye;if(se.key!=null)ye=ot.get(se.key);else for(it=We;it<=Le;it++)if(zt[it-We]===0&&qs(se,Y[it])){ye=it;break}ye===void 0?we(se,U,ie,!0):(zt[ye-We]=he+1,ye>=un?un=ye:Ot=!0,v(se,Y[ye],Z,null,U,ie,me,ue,ge),pt++)}const Ln=Ot?Uy(zt):tn;for(it=Ln.length-1,he=yt-1;he>=0;he--){const se=We+he,ye=Y[se],ze=se+1<Te?Y[se+1].el:O;zt[he]===0?v(null,ye,Z,ze,U,ie,me,ue,ge):Ot&&(it<0||he!==Ln[it]?_e(ye,Z,ze,2):it--)}}},_e=(N,Y,Z,O,U=null)=>{const{el:ie,type:me,transition:ue,children:ge,shapeFlag:he}=N;if(he&6){_e(N.component.subTree,Y,Z,O);return}if(he&128){N.suspense.move(Y,Z,O);return}if(he&64){me.move(N,Y,Z,Me);return}if(me===be){s(ie,Y,Z);for(let De=0;De<ge.length;De++)_e(ge[De],Y,Z,O);s(N.anchor,Y,Z);return}if(me===da){$(N,Y,Z);return}if(O!==2&&he&1&&ue)if(O===0)ue.beforeEnter(ie),s(ie,Y,Z),rn(()=>ue.enter(ie),U);else{const{leave:De,delayLeave:Le,afterLeave:Ae}=ue,We=()=>s(ie,Y,Z),ot=()=>{De(ie,()=>{We(),Ae&&Ae()})};Le?Le(ie,We,ot):ot()}else s(ie,Y,Z)},we=(N,Y,Z,O=!1,U=!1)=>{const{type:ie,props:me,ref:ue,children:ge,dynamicChildren:he,shapeFlag:Te,patchFlag:De,dirs:Le}=N;if(ue!=null&&Vc(ue,null,Z,N,!0),Te&256){Y.ctx.deactivate(N);return}const Ae=Te&1&&Le,We=!Gr(N);let ot;if(We&&(ot=me&&me.onVnodeBeforeUnmount)&&Fn(ot,Y,N),Te&6)pe(N.component,Z,O);else{if(Te&128){N.suspense.unmount(Z,O);return}Ae&&cr(N,null,Y,"beforeUnmount"),Te&64?N.type.remove(N,Y,Z,U,Me,O):he&&(ie!==be||De>0&&De&64)?de(he,Y,Z,!1,!0):(ie===be&&De&384||!U&&Te&16)&&de(ge,Y,Z),O&&je(N)}(We&&(ot=me&&me.onVnodeUnmounted)||Ae)&&rn(()=>{ot&&Fn(ot,Y,N),Ae&&cr(N,null,Y,"unmounted")},Z)},je=N=>{const{type:Y,el:Z,anchor:O,transition:U}=N;if(Y===be){re(Z,O);return}if(Y===da){E(N);return}const ie=()=>{r(Z),U&&!U.persisted&&U.afterLeave&&U.afterLeave()};if(N.shapeFlag&1&&U&&!U.persisted){const{leave:me,delayLeave:ue}=U,ge=()=>me(Z,ie);ue?ue(N.el,ie,ge):ge()}else ie()},re=(N,Y)=>{let Z;for(;N!==Y;)Z=h(N),r(N),N=Z;r(Y)},pe=(N,Y,Z)=>{const{bum:O,scope:U,update:ie,subTree:me,um:ue}=N;O&&Br(O),U.stop(),ie&&(ie.active=!1,we(me,N,Y,Z)),ue&&rn(ue,Y),rn(()=>{N.isUnmounted=!0},Y),Y&&Y.pendingBranch&&!Y.isUnmounted&&N.asyncDep&&!N.asyncResolved&&N.suspenseId===Y.pendingId&&(Y.deps--,Y.deps===0&&Y.resolve())},de=(N,Y,Z,O=!1,U=!1,ie=0)=>{for(let me=ie;me<N.length;me++)we(N[me],Y,Z,O,U)},Ce=N=>N.shapeFlag&6?Ce(N.component.subTree):N.shapeFlag&128?N.suspense.next():h(N.anchor||N.el);let Re=!1;const Oe=(N,Y,Z)=>{N==null?Y._vnode&&we(Y._vnode,null,null,!0):v(Y._vnode||null,N,Y,null,null,null,Z),Re||(Re=!0,xf(),wf(),Re=!1),Y._vnode=N},Me={p:v,um:we,m:_e,r:je,mt:Q,mc:L,pc:F,pbc:X,n:Ce,o:e};return{render:Oe,hydrate:void 0,createApp:Ry(Oe)}}function Hc({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function ur({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function By(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Wc(e,t,n=!1){const s=e.children,r=t.children;if(Ve(s)&&Ve(r))for(let o=0;o<s.length;o++){const i=s[o];let a=r[o];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=r[o]=Bs(r[o]),a.el=i.el),n||Wc(i,a)),a.type===ua&&(a.el=i.el)}}function Uy(e){const t=e.slice(),n=[0];let s,r,o,i,a;const c=e.length;for(s=0;s<c;s++){const u=e[s];if(u!==0){if(r=n[n.length-1],e[r]<u){t[s]=r,n.push(s);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<u?o=a+1:i=a;u<e[n[o]]&&(o>0&&(t[s]=n[o-1]),n[o]=s)}}for(o=n.length,i=n[o-1];o-- >0;)n[o]=i,i=t[i];return n}function nh(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:nh(t)}const Vy=e=>e.__isTeleport,Bo=e=>e&&(e.disabled||e.disabled===""),sh=e=>typeof SVGElement<"u"&&e instanceof SVGElement,rh=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Gc=(e,t)=>{const n=e&&e.to;return Et(n)?t?t(n):null:n},Hy={name:"Teleport",__isTeleport:!0,process(e,t,n,s,r,o,i,a,c,u){const{mc:d,pc:f,pbc:h,o:{insert:g,querySelector:p,createText:v,createComment:_}}=u,k=Bo(t.props);let{shapeFlag:w,children:$,dynamicChildren:E}=t;if(e==null){const P=t.el=v(""),I=t.anchor=v("");g(P,n,s),g(I,n,s);const M=t.target=Gc(t.props,p),L=t.targetAnchor=v("");M&&(g(L,M),i==="svg"||sh(M)?i="svg":(i==="mathml"||rh(M))&&(i="mathml"));const V=(X,T)=>{w&16&&d($,X,T,r,o,i,a,c)};k?V(n,I):M&&V(M,L)}else{t.el=e.el;const P=t.anchor=e.anchor,I=t.target=e.target,M=t.targetAnchor=e.targetAnchor,L=Bo(e.props),V=L?n:I,X=L?P:M;if(i==="svg"||sh(I)?i="svg":(i==="mathml"||rh(I))&&(i="mathml"),E?(h(e.dynamicChildren,E,V,r,o,i,a),Wc(e,t,!0)):c||f(e,t,V,X,r,o,i,a,!1),k)L?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):ca(t,n,P,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const T=t.target=Gc(t.props,p);T&&ca(t,T,null,u,0)}else L&&ca(t,I,M,u,1)}oh(t)},remove(e,t,n,s,{um:r,o:{remove:o}},i){const{shapeFlag:a,children:c,anchor:u,targetAnchor:d,target:f,props:h}=e;if(f&&o(d),i&&o(u),a&16){const g=i||!Bo(h);for(let p=0;p<c.length;p++){const v=c[p];r(v,t,n,g,!!v.dynamicChildren)}}},move:ca,hydrate:Wy};function ca(e,t,n,{o:{insert:s},m:r},o=2){o===0&&s(e.targetAnchor,t,n);const{el:i,anchor:a,shapeFlag:c,children:u,props:d}=e,f=o===2;if(f&&s(i,t,n),(!f||Bo(d))&&c&16)for(let h=0;h<u.length;h++)r(u[h],t,n,2);f&&s(a,t,n)}function Wy(e,t,n,s,r,o,{o:{nextSibling:i,parentNode:a,querySelector:c}},u){const d=t.target=Gc(t.props,c);if(d){const f=d._lpa||d.firstChild;if(t.shapeFlag&16)if(Bo(t.props))t.anchor=u(i(e),t,a(e),n,s,r,o),t.targetAnchor=f;else{t.anchor=i(e);let h=f;for(;h;)if(h=i(h),h&&h.nodeType===8&&h.data==="teleport anchor"){t.targetAnchor=h,d._lpa=t.targetAnchor&&i(t.targetAnchor);break}u(f,t,d,n,s,r,o)}oh(t)}return t.anchor&&i(t.anchor)}const Kc=Hy;function oh(e){const t=e.ctx;if(t&&t.ut){let n=e.children[0].el;for(;n&&n!==e.targetAnchor;)n.nodeType===1&&n.setAttribute("data-v-owner",t.uid),n=n.nextSibling;t.ut()}}const be=Symbol.for("v-fgt"),ua=Symbol.for("v-txt"),Pn=Symbol.for("v-cmt"),da=Symbol.for("v-stc"),Uo=[];let Xn=null;function m(e=!1){Uo.push(Xn=e?null:[])}function Gy(){Uo.pop(),Xn=Uo[Uo.length-1]||null}let Vo=1;function ih(e){Vo+=e}function ah(e){return e.dynamicChildren=Vo>0?Xn||tn:null,Gy(),Vo>0&&Xn&&Xn.push(e),e}function x(e,t,n,s,r,o){return ah(l(e,t,n,s,r,o,!0))}function oe(e,t,n,s,r){return ah(G(e,t,n,s,r,!0))}function Ho(e){return e?e.__v_isVNode===!0:!1}function qs(e,t){return e.type===t.type&&e.key===t.key}const fa="__vInternal",lh=({key:e})=>e??null,ha=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Et(e)||Ft(e)||Ye(e)?{i:Ht,r:e,k:t,f:!!n}:e:null);function l(e,t=null,n=null,s=0,r=null,o=e===be?0:1,i=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&lh(t),ref:t&&ha(t),scopeId:ea,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Ht};return a?(Qc(c,n),o&128&&e.normalize(c)):n&&(c.shapeFlag|=Et(n)?8:16),Vo>0&&!i&&Xn&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&&Xn.push(c),c}const G=Ky;function Ky(e,t=null,n=null,s=0,r=null,o=!1){if((!e||e===Tf)&&(e=Pn),Ho(e)){const a=cs(e,t,!0);return n&&Qc(a,n),Vo>0&&!o&&Xn&&(a.shapeFlag&6?Xn[Xn.indexOf(e)]=a:Xn.push(a)),a.patchFlag|=-2,a}if(s1(e)&&(e=e.__vccOpts),t){t=pa(t);let{class:a,style:c}=t;a&&!Et(a)&&(t.class=te(a)),_t(c)&&(df(c)&&!Ve(c)&&(c=Xt({},c)),t.style=ht(c))}const i=Et(e)?1:Af(e)?128:Vy(e)?64:_t(e)?4:Ye(e)?2:0;return l(e,t,n,s,r,i,o,!0)}function pa(e){return e?df(e)||fa in e?Xt({},e):e:null}function cs(e,t,n=!1){const{props:s,ref:r,patchFlag:o,children:i}=e,a=t?xn(s||{},t):s;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:a,key:a&&lh(a),ref:t&&t.ref?n&&r?Ve(r)?r.concat(ha(t)):[r,ha(t)]:ha(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==be?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&cs(e.ssContent),ssFallback:e.ssFallback&&cs(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce}}function Be(e=" ",t=0){return G(ua,null,e,t)}function ma(e,t){const n=G(da,null,e);return n.staticCount=t,n}function q(e="",t=!1){return t?(m(),oe(Pn,null,e)):G(Pn,null,e)}function us(e){return e==null||typeof e=="boolean"?G(Pn):Ve(e)?G(be,null,e.slice()):typeof e=="object"?Bs(e):G(ua,null,String(e))}function Bs(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:cs(e)}function Qc(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(Ve(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),Qc(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!(fa in t)?t._ctx=Ht:r===3&&Ht&&(Ht.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Ye(t)?(t={default:t,_ctx:Ht},n=32):(t=String(t),s&64?(n=16,t=[Be(t)]):n=8);e.children=t,e.shapeFlag|=n}function xn(...e){const t={};for(let n=0;n<e.length;n++){const s=e[n];for(const r in s)if(r==="class")t.class!==s.class&&(t.class=te([t.class,s.class]));else if(r==="style")t.style=ht([t.style,s.style]);else if(Ni(r)){const o=t[r],i=s[r];i&&o!==i&&!(Ve(o)&&o.includes(i))&&(t[r]=o?[].concat(o,i):i)}else r!==""&&(t[r]=s[r])}return t}function Fn(e,t,n,s=null){jn(e,t,7,[n,s])}const Qy=Wf();let Jy=0;function Xy(e,t,n){const s=e.type,r=(t?t.appContext:e.appContext)||Qy,o={uid:Jy++,vnode:e,type:s,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,scope:new Vd(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Kf(s,r),emitsOptions:Sf(s,r),emit:null,emitted:null,propsDefaults:tt,inheritAttrs:s.inheritAttrs,ctx:tt,data:tt,props:tt,attrs:tt,slots:tt,refs:tt,setupState:tt,setupContext:null,attrsProxy:null,slotsProxy:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=t?t.root:o,o.emit=ry.bind(null,o),e.ce&&e.ce(o),o}let qt=null;const Zn=()=>qt||Ht;let ga,Jc;{const e=qd(),t=(n,s)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(s),o=>{r.length>1?r.forEach(i=>i(o)):r[0](o)}};ga=t("__VUE_INSTANCE_SETTERS__",n=>qt=n),Jc=t("__VUE_SSR_SETTERS__",n=>Go=n)}const Wo=e=>{const t=qt;return ga(e),e.scope.on(),()=>{e.scope.off(),ga(t)}},ch=()=>{qt&&qt.scope.off(),ga(null)};function uh(e){return e.vnode.shapeFlag&4}let Go=!1;function Zy(e,t=!1){t&&Jc(t);const{props:n,children:s}=e.vnode,r=uh(e);Ly(e,n,r,t),Ny(e,s);const o=r?Yy(e,t):void 0;return t&&Jc(!1),o}function Yy(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=ff(new Proxy(e.ctx,Cy));const{setup:s}=n;if(s){const r=e.setupContext=s.length>1?hh(e):null,o=Wo(e);Ds();const i=xs(s,e,0,[e.props,r]);if(js(),o(),jd(i)){if(i.then(ch,ch),t)return i.then(a=>{dh(e,a)}).catch(a=>{Oo(a,e,0)});e.asyncDep=i}else dh(e,i)}else fh(e)}function dh(e,t,n){Ye(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:_t(t)&&(e.setupState=gf(t)),fh(e)}function fh(e,t,n){const s=e.type;e.render||(e.render=s.render||En);{const r=Wo(e);Ds();try{Ey(e)}finally{js(),r()}}}function e1(e){return e.attrsProxy||(e.attrsProxy=new Proxy(e.attrs,{get(t,n){return _n(e,"get","$attrs"),t[n]}}))}function hh(e){const t=n=>{e.exposed=n||{}};return{get attrs(){return e1(e)},slots:e.slots,emit:e.emit,expose:t}}function va(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(gf(ff(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Fo)return Fo[n](e)},has(t,n){return n in t||n in Fo}}))}const t1=/(?:^|[-_])(\w)/g,n1=e=>e.replace(t1,t=>t.toUpperCase()).replace(/[-_]/g,"");function ya(e,t=!0){return Ye(e)?e.displayName||e.name:e.name||t&&e.__name}function ph(e,t,n=!1){let s=ya(t);if(!s&&t.__file){const r=t.__file.match(/([^/\\]+)\.\w+$/);r&&(s=r[1])}if(!s&&e&&e.parent){const r=o=>{for(const i in o)if(o[i]===t)return i};s=r(e.components||e.parent.type.components)||r(e.appContext.components)}return s?n1(s):n?"App":"Anonymous"}function s1(e){return Ye(e)&&"__vccOpts"in e}const ee=(e,t)=>z0(e,t,Go);function dr(e,t,n=tt){const s=Zn(),r=An(t),o=Rs(t),i=V0((c,u)=>{let d;return py(()=>{const f=e[t];as(d,f)&&(d=f,u())}),{get(){return c(),n.get?n.get(d):d},set(f){const h=s.vnode.props;!(h&&(t in h||r in h||o in h)&&(`onUpdate:${t}`in h||`onUpdate:${r}`in h||`onUpdate:${o}`in h))&&as(f,d)&&(d=f,u()),s.emit(`update:${t}`,n.set?n.set(f):f)}}}),a=t==="modelValue"?"modelModifiers":`${t}Modifiers`;return i[Symbol.iterator]=()=>{let c=0;return{next(){return c<2?{value:c++?e[a]||{}:i,done:!1}:{done:!0}}}},i}function fr(e,t,n){const s=arguments.length;return s===2?_t(t)&&!Ve(t)?Ho(t)?G(e,null,[t]):G(e,t):G(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&Ho(n)&&(n=[n]),G(e,t,n))}const r1="3.4.21",o1="http://www.w3.org/2000/svg",i1="http://www.w3.org/1998/Math/MathML",Us=typeof document<"u"?document:null,mh=Us&&Us.createElement("template"),a1={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const r=t==="svg"?Us.createElementNS(o1,e):t==="mathml"?Us.createElementNS(i1,e):Us.createElement(e,n?{is:n}:void 0);return e==="select"&&s&&s.multiple!=null&&r.setAttribute("multiple",s.multiple),r},createText:e=>Us.createTextNode(e),createComment:e=>Us.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Us.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,r,o){const i=n?n.previousSibling:t.lastChild;if(r&&(r===o||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===o||!(r=r.nextSibling)););else{mh.innerHTML=s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e;const a=mh.content;if(s==="svg"||s==="mathml"){const c=a.firstChild;for(;c.firstChild;)a.appendChild(c.firstChild);a.removeChild(c)}t.insertBefore(a,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Vs="transition",Ko="animation",Qo=Symbol("_vtc"),Yt=(e,{slots:t})=>fr(vy,l1(e),t);Yt.displayName="Transition";const gh={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};Yt.props=Xt({},Pf,gh);const hr=(e,t=[])=>{Ve(e)?e.forEach(n=>n(...t)):e&&e(...t)},vh=e=>e?Ve(e)?e.some(t=>t.length>1):e.length>1:!1;function l1(e){const t={};for(const A in e)A in gh||(t[A]=e[A]);if(e.css===!1)return t;const{name:n="v",type:s,duration:r,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:c=o,appearActiveClass:u=i,appearToClass:d=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,p=c1(r),v=p&&p[0],_=p&&p[1],{onBeforeEnter:k,onEnter:w,onEnterCancelled:$,onLeave:E,onLeaveCancelled:P,onBeforeAppear:I=k,onAppear:M=w,onAppearCancelled:L=$}=t,V=(A,D,Q)=>{pr(A,D?d:a),pr(A,D?u:i),Q&&Q()},X=(A,D)=>{A._isLeaving=!1,pr(A,f),pr(A,g),pr(A,h),D&&D()},T=A=>(D,Q)=>{const W=A?M:w,H=()=>V(D,A,Q);hr(W,[D,H]),yh(()=>{pr(D,A?c:o),Hs(D,A?d:a),vh(W)||bh(D,s,v,H)})};return Xt(t,{onBeforeEnter(A){hr(k,[A]),Hs(A,o),Hs(A,i)},onBeforeAppear(A){hr(I,[A]),Hs(A,c),Hs(A,u)},onEnter:T(!1),onAppear:T(!0),onLeave(A,D){A._isLeaving=!0;const Q=()=>X(A,D);Hs(A,f),f1(),Hs(A,h),yh(()=>{A._isLeaving&&(pr(A,f),Hs(A,g),vh(E)||bh(A,s,_,Q))}),hr(E,[A,Q])},onEnterCancelled(A){V(A,!1),hr($,[A])},onAppearCancelled(A){V(A,!0),hr(L,[A])},onLeaveCancelled(A){X(A),hr(P,[A])}})}function c1(e){if(e==null)return null;if(_t(e))return[Xc(e.enter),Xc(e.leave)];{const t=Xc(e);return[t,t]}}function Xc(e){return c0(e)}function Hs(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Qo]||(e[Qo]=new Set)).add(t)}function pr(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[Qo];n&&(n.delete(t),n.size||(e[Qo]=void 0))}function yh(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let u1=0;function bh(e,t,n,s){const r=e._endId=++u1,o=()=>{r===e._endId&&s()};if(n)return setTimeout(o,n);const{type:i,timeout:a,propCount:c}=d1(e,t);if(!i)return s();const u=i+"end";let d=0;const f=()=>{e.removeEventListener(u,h),o()},h=g=>{g.target===e&&++d>=c&&f()};setTimeout(()=>{d<c&&f()},a+1),e.addEventListener(u,h)}function d1(e,t){const n=window.getComputedStyle(e),s=p=>(n[p]||"").split(", "),r=s(`${Vs}Delay`),o=s(`${Vs}Duration`),i=_h(r,o),a=s(`${Ko}Delay`),c=s(`${Ko}Duration`),u=_h(a,c);let d=null,f=0,h=0;t===Vs?i>0&&(d=Vs,f=i,h=o.length):t===Ko?u>0&&(d=Ko,f=u,h=c.length):(f=Math.max(i,u),d=f>0?i>u?Vs:Ko:null,h=d?d===Vs?o.length:c.length:0);const g=d===Vs&&/\b(transform|all)(,|$)/.test(s(`${Vs}Property`).toString());return{type:d,timeout:f,propCount:h,hasTransform:g}}function _h(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,s)=>xh(n)+xh(e[s])))}function xh(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function f1(){return document.body.offsetHeight}function h1(e,t,n){const s=e[Qo];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const ba=Symbol("_vod"),wh=Symbol("_vsh"),Jo={beforeMount(e,{value:t},{transition:n}){e[ba]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Xo(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:s}){!t!=!n&&(s?t?(s.beforeEnter(e),Xo(e,!0),s.enter(e)):s.leave(e,()=>{Xo(e,!1)}):Xo(e,t))},beforeUnmount(e,{value:t}){Xo(e,t)}};function Xo(e,t){e.style.display=t?e[ba]:"none",e[wh]=!t}const p1=Symbol(""),m1=/(^|;)\s*display\s*:/;function g1(e,t,n){const s=e.style,r=Et(n);let o=!1;if(n&&!r){if(t)if(Et(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&_a(s,a,"")}else for(const i in t)n[i]==null&&_a(s,i,"");for(const i in n)i==="display"&&(o=!0),_a(s,i,n[i])}else if(r){if(t!==n){const i=s[p1];i&&(n+=";"+i),s.cssText=n,o=m1.test(n)}}else t&&e.removeAttribute("style");ba in e&&(e[ba]=o?s.display:"",e[wh]&&(s.display="none"))}const kh=/\s*!important$/;function _a(e,t,n){if(Ve(n))n.forEach(s=>_a(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=v1(e,t);kh.test(n)?e.setProperty(Rs(s),n.replace(kh,""),"important"):e[s]=n}}const Sh=["Webkit","Moz","ms"],Zc={};function v1(e,t){const n=Zc[t];if(n)return n;let s=An(t);if(s!=="filter"&&s in e)return Zc[t]=s;s=zi(s);for(let r=0;r<Sh.length;r++){const o=Sh[r]+s;if(o in e)return Zc[t]=o}return t}const $h="http://www.w3.org/1999/xlink";function y1(e,t,n,s,r){if(s&&t.startsWith("xlink:"))n==null?e.removeAttributeNS($h,t.slice(6,t.length)):e.setAttributeNS($h,t,n);else{const o=p0(t);n==null||o&&!Bd(n)?e.removeAttribute(t):e.setAttribute(t,o?"":n)}}function b1(e,t,n,s,r,o,i){if(t==="innerHTML"||t==="textContent"){s&&i(s,r,o),e[t]=n??"";return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const u=a==="OPTION"?e.getAttribute("value")||"":e.value,d=n??"";(u!==d||!("_value"in e))&&(e.value=d),n==null&&e.removeAttribute(t),e._value=n;return}let c=!1;if(n===""||n==null){const u=typeof e[t];u==="boolean"?n=Bd(n):n==null&&u==="string"?(n="",c=!0):u==="number"&&(n=0,c=!0)}try{e[t]=n}catch{}c&&e.removeAttribute(t)}function Ss(e,t,n,s){e.addEventListener(t,n,s)}function _1(e,t,n,s){e.removeEventListener(t,n,s)}const Ch=Symbol("_vei");function x1(e,t,n,s,r=null){const o=e[Ch]||(e[Ch]={}),i=o[t];if(s&&i)i.value=s;else{const[a,c]=w1(t);if(s){const u=o[t]=$1(s,r);Ss(e,a,u,c)}else i&&(_1(e,a,i,c),o[t]=void 0)}}const Th=/(?:Once|Passive|Capture)$/;function w1(e){let t;if(Th.test(e)){t={};let s;for(;s=e.match(Th);)e=e.slice(0,e.length-s[0].length),t[s[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Rs(e.slice(2)),t]}let Yc=0;const k1=Promise.resolve(),S1=()=>Yc||(k1.then(()=>Yc=0),Yc=Date.now());function $1(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;jn(C1(s,n.value),t,5,[s])};return n.value=e,n.attached=S1(),n}function C1(e,t){if(Ve(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(s=>r=>!r._stopped&&s&&s(r))}else return t}const Eh=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,T1=(e,t,n,s,r,o,i,a,c)=>{const u=r==="svg";t==="class"?h1(e,s,u):t==="style"?g1(e,n,s):Ni(t)?pc(t)||x1(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):E1(e,t,s,u))?b1(e,t,s,o,i,a,c):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),y1(e,t,s,u))};function E1(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Eh(t)&&Ye(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Eh(t)&&Et(n)?!1:t in e}const Ws=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ve(t)?n=>Br(t,n):t};function A1(e){e.target.composing=!0}function Ah(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const zn=Symbol("_assign"),on={created(e,{modifiers:{lazy:t,trim:n,number:s}},r){e[zn]=Ws(r);const o=s||r.props&&r.props.type==="number";Ss(e,t?"change":"input",i=>{if(i.target.composing)return;let a=e.value;n&&(a=a.trim()),o&&(a=Eo(a)),e[zn](a)}),n&&Ss(e,"change",()=>{e.value=e.value.trim()}),t||(Ss(e,"compositionstart",A1),Ss(e,"compositionend",Ah),Ss(e,"change",Ah))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,modifiers:{lazy:n,trim:s,number:r}},o){if(e[zn]=Ws(o),e.composing)return;const i=r||e.type==="number"?Eo(e.value):e.value,a=t??"";i!==a&&(document.activeElement===e&&e.type!=="range"&&(n||s&&e.value.trim()===a)||(e.value=a))}},I1={deep:!0,created(e,t,n){e[zn]=Ws(n),Ss(e,"change",()=>{const s=e._modelValue,r=Jr(e),o=e.checked,i=e[zn];if(Ve(s)){const a=vc(s,r),c=a!==-1;if(o&&!c)i(s.concat(r));else if(!o&&c){const u=[...s];u.splice(a,1),i(u)}}else if(zr(s)){const a=new Set(s);o?a.add(r):a.delete(r),i(a)}else i(Rh(e,o))})},mounted:Ih,beforeUpdate(e,t,n){e[zn]=Ws(n),Ih(e,t,n)}};function Ih(e,{value:t,oldValue:n},s){e._modelValue=t,Ve(t)?e.checked=vc(t,s.props.value)>-1:zr(t)?e.checked=t.has(s.props.value):t!==n&&(e.checked=rr(t,Rh(e,!0)))}const Ph={created(e,{value:t},n){e.checked=rr(t,n.props.value),e[zn]=Ws(n),Ss(e,"change",()=>{e[zn](Jr(e))})},beforeUpdate(e,{value:t,oldValue:n},s){e[zn]=Ws(s),t!==n&&(e.checked=rr(t,s.props.value))}},Mh={deep:!0,created(e,{value:t,modifiers:{number:n}},s){const r=zr(t);Ss(e,"change",()=>{const o=Array.prototype.filter.call(e.options,i=>i.selected).map(i=>n?Eo(Jr(i)):Jr(i));e[zn](e.multiple?r?new Set(o):o:o[0]),e._assigning=!0,kt(()=>{e._assigning=!1})}),e[zn]=Ws(s)},mounted(e,{value:t,modifiers:{number:n}}){Oh(e,t,n)},beforeUpdate(e,t,n){e[zn]=Ws(n)},updated(e,{value:t,modifiers:{number:n}}){e._assigning||Oh(e,t,n)}};function Oh(e,t,n){const s=e.multiple,r=Ve(t);if(!(s&&!r&&!zr(t))){for(let o=0,i=e.options.length;o<i;o++){const a=e.options[o],c=Jr(a);if(s)if(r){const u=typeof c;u==="string"||u==="number"?a.selected=t.includes(n?Eo(c):c):a.selected=vc(t,c)>-1}else a.selected=t.has(c);else if(rr(Jr(a),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Jr(e){return"_value"in e?e._value:e.value}function Rh(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const P1={created(e,t,n){xa(e,t,n,null,"created")},mounted(e,t,n){xa(e,t,n,null,"mounted")},beforeUpdate(e,t,n,s){xa(e,t,n,s,"beforeUpdate")},updated(e,t,n,s){xa(e,t,n,s,"updated")}};function M1(e,t){switch(e){case"SELECT":return Mh;case"TEXTAREA":return on;default:switch(t){case"checkbox":return I1;case"radio":return Ph;default:return on}}}function xa(e,t,n,s,r){const i=M1(e.tagName,n.props&&n.props.type)[r];i&&i(e,t,n,s)}const O1=["ctrl","shift","alt","meta"],R1={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>O1.some(n=>e[`${n}Key`]&&!t.includes(n))},Gt=(e,t)=>{const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=(r,...o)=>{for(let i=0;i<t.length;i++){const a=R1[t[i]];if(a&&a(r,t))return}return e(r,...o)})},L1={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},mr=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=r=>{if(!("key"in r))return;const o=Rs(r.key);if(t.some(i=>i===o||L1[i]===o))return e(r)})},D1=Xt({patchProp:T1},a1);let Lh;function j1(){return Lh||(Lh=zy(D1))}const Xr=(...e)=>{const t=j1().createApp(...e),{mount:n}=t;return t.mount=s=>{const r=F1(s);if(!r)return;const o=t._component;!Ye(o)&&!o.render&&!o.template&&(o.template=r.innerHTML),r.innerHTML="";const i=n(r,!1,N1(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),i},t};function N1(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function F1(e){return Et(e)?document.querySelector(e):e}function Dh(e,t){return function(){return e.apply(t,arguments)}}const{toString:z1}=Object.prototype,{getPrototypeOf:eu}=Object,{iterator:wa,toStringTag:jh}=Symbol,ka=(e=>t=>{const n=z1.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Yn=e=>(e=e.toLowerCase(),t=>ka(t)===e),Sa=e=>t=>typeof t===e,{isArray:Zr}=Array,Yr=Sa("undefined");function Zo(e){return e!==null&&!Yr(e)&&e.constructor!==null&&!Yr(e.constructor)&&wn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Nh=Yn("ArrayBuffer");function q1(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Nh(e.buffer),t}const B1=Sa("string"),wn=Sa("function"),Fh=Sa("number"),Yo=e=>e!==null&&typeof e=="object",U1=e=>e===!0||e===!1,$a=e=>{if(ka(e)!=="object")return!1;const t=eu(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(jh in e)&&!(wa in e)},V1=e=>{if(!Yo(e)||Zo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},H1=Yn("Date"),W1=Yn("File"),G1=Yn("Blob"),K1=Yn("FileList"),Q1=e=>Yo(e)&&wn(e.pipe),J1=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||wn(e.append)&&((t=ka(e))==="formdata"||t==="object"&&wn(e.toString)&&e.toString()==="[object FormData]"))},X1=Yn("URLSearchParams"),[Z1,Y1,eb,tb]=["ReadableStream","Request","Response","Headers"].map(Yn),nb=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ei(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),Zr(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(Zo(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let a;for(s=0;s<i;s++)a=o[s],t.call(null,e[a],a,e)}}function zh(e,t){if(Zo(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,r;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const gr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,qh=e=>!Yr(e)&&e!==gr;function tu(){const{caseless:e,skipUndefined:t}=qh(this)&&this||{},n={},s=(r,o)=>{const i=e&&zh(n,o)||o;$a(n[i])&&$a(r)?n[i]=tu(n[i],r):$a(r)?n[i]=tu({},r):Zr(r)?n[i]=r.slice():(!t||!Yr(r))&&(n[i]=r)};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&ei(arguments[r],s);return n}const sb=(e,t,n,{allOwnKeys:s}={})=>(ei(t,(r,o)=>{n&&wn(r)?e[o]=Dh(r,n):e[o]=r},{allOwnKeys:s}),e),rb=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ob=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},ib=(e,t,n,s)=>{let r,o,i;const a={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)i=r[o],(!s||s(i,e,t))&&!a[i]&&(t[i]=e[i],a[i]=!0);e=n!==!1&&eu(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},ab=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},lb=e=>{if(!e)return null;if(Zr(e))return e;let t=e.length;if(!Fh(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},cb=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&eu(Uint8Array)),ub=(e,t)=>{const s=(e&&e[wa]).call(e);let r;for(;(r=s.next())&&!r.done;){const o=r.value;t.call(e,o[0],o[1])}},db=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},fb=Yn("HTMLFormElement"),hb=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),Bh=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),pb=Yn("RegExp"),Uh=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};ei(n,(r,o)=>{let i;(i=t(r,o,e))!==!1&&(s[o]=i||r)}),Object.defineProperties(e,s)},mb=e=>{Uh(e,(t,n)=>{if(wn(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(wn(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},gb=(e,t)=>{const n={},s=r=>{r.forEach(o=>{n[o]=!0})};return Zr(e)?s(e):s(String(e).split(t)),n},vb=()=>{},yb=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function bb(e){return!!(e&&wn(e.append)&&e[jh]==="FormData"&&e[wa])}const _b=e=>{const t=new Array(10),n=(s,r)=>{if(Yo(s)){if(t.indexOf(s)>=0)return;if(Zo(s))return s;if(!("toJSON"in s)){t[r]=s;const o=Zr(s)?[]:{};return ei(s,(i,a)=>{const c=n(i,r+1);!Yr(c)&&(o[a]=c)}),t[r]=void 0,o}}return s};return n(e,0)},xb=Yn("AsyncFunction"),wb=e=>e&&(Yo(e)||wn(e))&&wn(e.then)&&wn(e.catch),Vh=((e,t)=>e?setImmediate:t?((n,s)=>(gr.addEventListener("message",({source:r,data:o})=>{r===gr&&o===n&&s.length&&s.shift()()},!1),r=>{s.push(r),gr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",wn(gr.postMessage)),kb=typeof queueMicrotask<"u"?queueMicrotask.bind(gr):typeof process<"u"&&process.nextTick||Vh,ce={isArray:Zr,isArrayBuffer:Nh,isBuffer:Zo,isFormData:J1,isArrayBufferView:q1,isString:B1,isNumber:Fh,isBoolean:U1,isObject:Yo,isPlainObject:$a,isEmptyObject:V1,isReadableStream:Z1,isRequest:Y1,isResponse:eb,isHeaders:tb,isUndefined:Yr,isDate:H1,isFile:W1,isBlob:G1,isRegExp:pb,isFunction:wn,isStream:Q1,isURLSearchParams:X1,isTypedArray:cb,isFileList:K1,forEach:ei,merge:tu,extend:sb,trim:nb,stripBOM:rb,inherits:ob,toFlatObject:ib,kindOf:ka,kindOfTest:Yn,endsWith:ab,toArray:lb,forEachEntry:ub,matchAll:db,isHTMLForm:fb,hasOwnProperty:Bh,hasOwnProp:Bh,reduceDescriptors:Uh,freezeMethods:mb,toObjectSet:gb,toCamelCase:hb,noop:vb,toFiniteNumber:yb,findKey:zh,global:gr,isContextDefined:qh,isSpecCompliantForm:bb,toJSONObject:_b,isAsyncFn:xb,isThenable:wb,setImmediate:Vh,asap:kb,isIterable:e=>e!=null&&wn(e[wa])};function st(e,t,n,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),r&&(this.response=r,this.status=r.status?r.status:null)}ce.inherits(st,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ce.toJSONObject(this.config),code:this.code,status:this.status}}});const Hh=st.prototype,Wh={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Wh[e]={value:e}}),Object.defineProperties(st,Wh),Object.defineProperty(Hh,"isAxiosError",{value:!0}),st.from=(e,t,n,s,r,o)=>{const i=Object.create(Hh);ce.toFlatObject(e,i,function(d){return d!==Error.prototype},u=>u!=="isAxiosError");const a=e&&e.message?e.message:"Error",c=t==null&&e?e.code:t;return st.call(i,a,c,n,s,r),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};const Sb=null;function nu(e){return ce.isPlainObject(e)||ce.isArray(e)}function Gh(e){return ce.endsWith(e,"[]")?e.slice(0,-2):e}function Kh(e,t,n){return e?e.concat(t).map(function(r,o){return r=Gh(r),!n&&o?"["+r+"]":r}).join(n?".":""):t}function $b(e){return ce.isArray(e)&&!e.some(nu)}const Cb=ce.toFlatObject(ce,{},null,function(t){return/^is[A-Z]/.test(t)});function Ca(e,t,n){if(!ce.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=ce.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,_){return!ce.isUndefined(_[v])});const s=n.metaTokens,r=n.visitor||d,o=n.dots,i=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&ce.isSpecCompliantForm(t);if(!ce.isFunction(r))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(ce.isDate(p))return p.toISOString();if(ce.isBoolean(p))return p.toString();if(!c&&ce.isBlob(p))throw new st("Blob is not supported. Use a Buffer instead.");return ce.isArrayBuffer(p)||ce.isTypedArray(p)?c&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function d(p,v,_){let k=p;if(p&&!_&&typeof p=="object"){if(ce.endsWith(v,"{}"))v=s?v:v.slice(0,-2),p=JSON.stringify(p);else if(ce.isArray(p)&&$b(p)||(ce.isFileList(p)||ce.endsWith(v,"[]"))&&(k=ce.toArray(p)))return v=Gh(v),k.forEach(function($,E){!(ce.isUndefined($)||$===null)&&t.append(i===!0?Kh([v],E,o):i===null?v:v+"[]",u($))}),!1}return nu(p)?!0:(t.append(Kh(_,v,o),u(p)),!1)}const f=[],h=Object.assign(Cb,{defaultVisitor:d,convertValue:u,isVisitable:nu});function g(p,v){if(!ce.isUndefined(p)){if(f.indexOf(p)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(p),ce.forEach(p,function(k,w){(!(ce.isUndefined(k)||k===null)&&r.call(t,k,ce.isString(w)?w.trim():w,v,h))===!0&&g(k,v?v.concat(w):[w])}),f.pop()}}if(!ce.isObject(e))throw new TypeError("data must be an object");return g(e),t}function Qh(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function su(e,t){this._pairs=[],e&&Ca(e,this,t)}const Jh=su.prototype;Jh.append=function(t,n){this._pairs.push([t,n])},Jh.toString=function(t){const n=t?function(s){return t.call(this,s,Qh)}:Qh;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function Tb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Xh(e,t,n){if(!t)return e;const s=n&&n.encode||Tb;ce.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let o;if(r?o=r(t,n):o=ce.isURLSearchParams(t)?t.toString():new su(t,n).toString(s),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Zh{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ce.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Yh={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Eb={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:su,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ru=typeof window<"u"&&typeof document<"u",ou=typeof navigator=="object"&&navigator||void 0,Ab=ru&&(!ou||["ReactNative","NativeScript","NS"].indexOf(ou.product)<0),Ib=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pb=ru&&window.location.href||"http://localhost",pn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ru,hasStandardBrowserEnv:Ab,hasStandardBrowserWebWorkerEnv:Ib,navigator:ou,origin:Pb},Symbol.toStringTag,{value:"Module"})),...Eb};function Mb(e,t){return Ca(e,new pn.classes.URLSearchParams,{visitor:function(n,s,r,o){return pn.isNode&&ce.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function Ob(e){return ce.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Rb(e){const t={},n=Object.keys(e);let s;const r=n.length;let o;for(s=0;s<r;s++)o=n[s],t[o]=e[o];return t}function ep(e){function t(n,s,r,o){let i=n[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),c=o>=n.length;return i=!i&&ce.isArray(r)?r.length:i,c?(ce.hasOwnProp(r,i)?r[i]=[r[i],s]:r[i]=s,!a):((!r[i]||!ce.isObject(r[i]))&&(r[i]=[]),t(n,s,r[i],o)&&ce.isArray(r[i])&&(r[i]=Rb(r[i])),!a)}if(ce.isFormData(e)&&ce.isFunction(e.entries)){const n={};return ce.forEachEntry(e,(s,r)=>{t(Ob(s),r,n,0)}),n}return null}function Lb(e,t,n){if(ce.isString(e))try{return(t||JSON.parse)(e),ce.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const ti={transitional:Yh,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,o=ce.isObject(t);if(o&&ce.isHTMLForm(t)&&(t=new FormData(t)),ce.isFormData(t))return r?JSON.stringify(ep(t)):t;if(ce.isArrayBuffer(t)||ce.isBuffer(t)||ce.isStream(t)||ce.isFile(t)||ce.isBlob(t)||ce.isReadableStream(t))return t;if(ce.isArrayBufferView(t))return t.buffer;if(ce.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Mb(t,this.formSerializer).toString();if((a=ce.isFileList(t))||s.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Ca(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||r?(n.setContentType("application/json",!1),Lb(t)):t}],transformResponse:[function(t){const n=this.transitional||ti.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(ce.isResponse(t)||ce.isReadableStream(t))return t;if(t&&ce.isString(t)&&(s&&!this.responseType||r)){const i=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?st.from(a,st.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pn.classes.FormData,Blob:pn.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ce.forEach(["delete","get","head","post","put","patch"],e=>{ti.headers[e]={}});const Db=ce.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),jb=e=>{const t={};let n,s,r;return e&&e.split(`
`).forEach(function(i){r=i.indexOf(":"),n=i.substring(0,r).trim().toLowerCase(),s=i.substring(r+1).trim(),!(!n||t[n]&&Db[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},tp=Symbol("internals");function ni(e){return e&&String(e).trim().toLowerCase()}function Ta(e){return e===!1||e==null?e:ce.isArray(e)?e.map(Ta):String(e)}function Nb(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const Fb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function iu(e,t,n,s,r){if(ce.isFunction(s))return s.call(this,t,n);if(r&&(t=n),!!ce.isString(t)){if(ce.isString(s))return t.indexOf(s)!==-1;if(ce.isRegExp(s))return s.test(t)}}function zb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function qb(e,t){const n=ce.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(r,o,i){return this[s].call(this,t,r,o,i)},configurable:!0})})}let kn=class{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function o(a,c,u){const d=ni(c);if(!d)throw new Error("header name must be a non-empty string");const f=ce.findKey(r,d);(!f||r[f]===void 0||u===!0||u===void 0&&r[f]!==!1)&&(r[f||c]=Ta(a))}const i=(a,c)=>ce.forEach(a,(u,d)=>o(u,d,c));if(ce.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(ce.isString(t)&&(t=t.trim())&&!Fb(t))i(jb(t),n);else if(ce.isObject(t)&&ce.isIterable(t)){let a={},c,u;for(const d of t){if(!ce.isArray(d))throw TypeError("Object iterator must return a key-value pair");a[u=d[0]]=(c=a[u])?ce.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}i(a,n)}else t!=null&&o(n,t,s);return this}get(t,n){if(t=ni(t),t){const s=ce.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return Nb(r);if(ce.isFunction(n))return n.call(this,r,s);if(ce.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=ni(t),t){const s=ce.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||iu(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function o(i){if(i=ni(i),i){const a=ce.findKey(s,i);a&&(!n||iu(s,s[a],a,n))&&(delete s[a],r=!0)}}return ce.isArray(t)?t.forEach(o):o(t),r}clear(t){const n=Object.keys(this);let s=n.length,r=!1;for(;s--;){const o=n[s];(!t||iu(this,this[o],o,t,!0))&&(delete this[o],r=!0)}return r}normalize(t){const n=this,s={};return ce.forEach(this,(r,o)=>{const i=ce.findKey(s,o);if(i){n[i]=Ta(r),delete n[o];return}const a=t?zb(o):String(o).trim();a!==o&&delete n[o],n[a]=Ta(r),s[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return ce.forEach(this,(s,r)=>{s!=null&&s!==!1&&(n[r]=t&&ce.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(r=>s.set(r)),s}static accessor(t){const s=(this[tp]=this[tp]={accessors:{}}).accessors,r=this.prototype;function o(i){const a=ni(i);s[a]||(qb(r,i),s[a]=!0)}return ce.isArray(t)?t.forEach(o):o(t),this}};kn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ce.reduceDescriptors(kn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}}),ce.freezeMethods(kn);function au(e,t){const n=this||ti,s=t||n,r=kn.from(s.headers);let o=s.data;return ce.forEach(e,function(a){o=a.call(n,o,r.normalize(),t?t.status:void 0)}),r.normalize(),o}function np(e){return!!(e&&e.__CANCEL__)}function eo(e,t,n){st.call(this,e??"canceled",st.ERR_CANCELED,t,n),this.name="CanceledError"}ce.inherits(eo,st,{__CANCEL__:!0});function sp(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new st("Request failed with status code "+n.status,[st.ERR_BAD_REQUEST,st.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Bb(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Ub(e,t){e=e||10;const n=new Array(e),s=new Array(e);let r=0,o=0,i;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=s[o];i||(i=u),n[r]=c,s[r]=u;let f=o,h=0;for(;f!==r;)h+=n[f++],f=f%e;if(r=(r+1)%e,r===o&&(o=(o+1)%e),u-i<t)return;const g=d&&u-d;return g?Math.round(h*1e3/g):void 0}}function Vb(e,t){let n=0,s=1e3/t,r,o;const i=(u,d=Date.now())=>{n=d,r=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=s?i(u,d):(r=u,o||(o=setTimeout(()=>{o=null,i(r)},s-f)))},()=>r&&i(r)]}const Ea=(e,t,n=3)=>{let s=0;const r=Ub(50,250);return Vb(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,c=i-s,u=r(c),d=i<=a;s=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&d?(a-i)/u:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},rp=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},op=e=>(...t)=>ce.asap(()=>e(...t)),Hb=pn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pn.origin),pn.navigator&&/(msie|trident)/i.test(pn.navigator.userAgent)):()=>!0,Wb=pn.hasStandardBrowserEnv?{write(e,t,n,s,r,o){const i=[e+"="+encodeURIComponent(t)];ce.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),ce.isString(s)&&i.push("path="+s),ce.isString(r)&&i.push("domain="+r),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Gb(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Kb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ip(e,t,n){let s=!Gb(t);return e&&(s||n==!1)?Kb(e,t):t}const ap=e=>e instanceof kn?{...e}:e;function vr(e,t){t=t||{};const n={};function s(u,d,f,h){return ce.isPlainObject(u)&&ce.isPlainObject(d)?ce.merge.call({caseless:h},u,d):ce.isPlainObject(d)?ce.merge({},d):ce.isArray(d)?d.slice():d}function r(u,d,f,h){if(ce.isUndefined(d)){if(!ce.isUndefined(u))return s(void 0,u,f,h)}else return s(u,d,f,h)}function o(u,d){if(!ce.isUndefined(d))return s(void 0,d)}function i(u,d){if(ce.isUndefined(d)){if(!ce.isUndefined(u))return s(void 0,u)}else return s(void 0,d)}function a(u,d,f){if(f in t)return s(u,d);if(f in e)return s(void 0,u)}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,d,f)=>r(ap(u),ap(d),f,!0)};return ce.forEach(Object.keys({...e,...t}),function(d){const f=c[d]||r,h=f(e[d],t[d],d);ce.isUndefined(h)&&f!==a||(n[d]=h)}),n}const lp=e=>{const t=vr({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=kn.from(i),t.url=Xh(ip(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),ce.isFormData(n)){if(pn.hasStandardBrowserEnv||pn.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(ce.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([d,f])=>{u.includes(d.toLowerCase())&&i.set(d,f)})}}if(pn.hasStandardBrowserEnv&&(s&&ce.isFunction(s)&&(s=s(t)),s||s!==!1&&Hb(t.url))){const c=r&&o&&Wb.read(o);c&&i.set(r,c)}return t},Qb=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,s){const r=lp(e);let o=r.data;const i=kn.from(r.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=r,d,f,h,g,p;function v(){g&&g(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(d),r.signal&&r.signal.removeEventListener("abort",d)}let _=new XMLHttpRequest;_.open(r.method.toUpperCase(),r.url,!0),_.timeout=r.timeout;function k(){if(!_)return;const $=kn.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),P={data:!a||a==="text"||a==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:$,config:e,request:_};sp(function(M){n(M),v()},function(M){s(M),v()},P),_=null}"onloadend"in _?_.onloadend=k:_.onreadystatechange=function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.indexOf("file:")===0)||setTimeout(k)},_.onabort=function(){_&&(s(new st("Request aborted",st.ECONNABORTED,e,_)),_=null)},_.onerror=function(E){const P=E&&E.message?E.message:"Network Error",I=new st(P,st.ERR_NETWORK,e,_);I.event=E||null,s(I),_=null},_.ontimeout=function(){let E=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const P=r.transitional||Yh;r.timeoutErrorMessage&&(E=r.timeoutErrorMessage),s(new st(E,P.clarifyTimeoutError?st.ETIMEDOUT:st.ECONNABORTED,e,_)),_=null},o===void 0&&i.setContentType(null),"setRequestHeader"in _&&ce.forEach(i.toJSON(),function(E,P){_.setRequestHeader(P,E)}),ce.isUndefined(r.withCredentials)||(_.withCredentials=!!r.withCredentials),a&&a!=="json"&&(_.responseType=r.responseType),u&&([h,p]=Ea(u,!0),_.addEventListener("progress",h)),c&&_.upload&&([f,g]=Ea(c),_.upload.addEventListener("progress",f),_.upload.addEventListener("loadend",g)),(r.cancelToken||r.signal)&&(d=$=>{_&&(s(!$||$.type?new eo(null,e,_):$),_.abort(),_=null)},r.cancelToken&&r.cancelToken.subscribe(d),r.signal&&(r.signal.aborted?d():r.signal.addEventListener("abort",d)));const w=Bb(r.url);if(w&&pn.protocols.indexOf(w)===-1){s(new st("Unsupported protocol "+w+":",st.ERR_BAD_REQUEST,e));return}_.send(o||null)})},Jb=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let s=new AbortController,r;const o=function(u){if(!r){r=!0,a();const d=u instanceof Error?u:this.reason;s.abort(d instanceof st?d:new eo(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,o(new st(`timeout ${t} of ms exceeded`,st.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:c}=s;return c.unsubscribe=()=>ce.asap(a),c}},Xb=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let s=0,r;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Zb=async function*(e,t){for await(const n of Yb(e))yield*Xb(n,t)},Yb=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)break;yield s}}finally{await t.cancel()}},cp=(e,t,n,s)=>{const r=Zb(e,t);let o=0,i,a=c=>{i||(i=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await r.next();if(u){a(),c.close();return}let f=d.byteLength;if(n){let h=o+=f;n(h)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),r.return()}},{highWaterMark:2})},up=64*1024,{isFunction:Aa}=ce,e_=(({Request:e,Response:t})=>({Request:e,Response:t}))(ce.global),{ReadableStream:dp,TextEncoder:fp}=ce.global,hp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},t_=e=>{e=ce.merge.call({skipUndefined:!0},e_,e);const{fetch:t,Request:n,Response:s}=e,r=t?Aa(t):typeof fetch=="function",o=Aa(n),i=Aa(s);if(!r)return!1;const a=r&&Aa(dp),c=r&&(typeof fp=="function"?(p=>v=>p.encode(v))(new fp):async p=>new Uint8Array(await new n(p).arrayBuffer())),u=o&&a&&hp(()=>{let p=!1;const v=new n(pn.origin,{body:new dp,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!v}),d=i&&a&&hp(()=>ce.isReadableStream(new s("").body)),f={stream:d&&(p=>p.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!f[p]&&(f[p]=(v,_)=>{let k=v&&v[p];if(k)return k.call(v);throw new st(`Response type '${p}' is not supported`,st.ERR_NOT_SUPPORT,_)})});const h=async p=>{if(p==null)return 0;if(ce.isBlob(p))return p.size;if(ce.isSpecCompliantForm(p))return(await new n(pn.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(ce.isArrayBufferView(p)||ce.isArrayBuffer(p))return p.byteLength;if(ce.isURLSearchParams(p)&&(p=p+""),ce.isString(p))return(await c(p)).byteLength},g=async(p,v)=>{const _=ce.toFiniteNumber(p.getContentLength());return _??h(v)};return async p=>{let{url:v,method:_,data:k,signal:w,cancelToken:$,timeout:E,onDownloadProgress:P,onUploadProgress:I,responseType:M,headers:L,withCredentials:V="same-origin",fetchOptions:X}=lp(p),T=t||fetch;M=M?(M+"").toLowerCase():"text";let A=Jb([w,$&&$.toAbortSignal()],E),D=null;const Q=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let W;try{if(I&&u&&_!=="get"&&_!=="head"&&(W=await g(L,k))!==0){let _e=new n(v,{method:"POST",body:k,duplex:"half"}),we;if(ce.isFormData(k)&&(we=_e.headers.get("content-type"))&&L.setContentType(we),_e.body){const[je,re]=rp(W,Ea(op(I)));k=cp(_e.body,up,je,re)}}ce.isString(V)||(V=V?"include":"omit");const H=o&&"credentials"in n.prototype,K={...X,signal:A,method:_.toUpperCase(),headers:L.normalize().toJSON(),body:k,duplex:"half",credentials:H?V:void 0};D=o&&new n(v,K);let F=await(o?T(D,X):T(v,K));const ne=d&&(M==="stream"||M==="response");if(d&&(P||ne&&Q)){const _e={};["status","statusText","headers"].forEach(pe=>{_e[pe]=F[pe]});const we=ce.toFiniteNumber(F.headers.get("content-length")),[je,re]=P&&rp(we,Ea(op(P),!0))||[];F=new s(cp(F.body,up,je,()=>{re&&re(),Q&&Q()}),_e)}M=M||"text";let fe=await f[ce.findKey(f,M)||"text"](F,p);return!ne&&Q&&Q(),await new Promise((_e,we)=>{sp(_e,we,{data:fe,headers:kn.from(F.headers),status:F.status,statusText:F.statusText,config:p,request:D})})}catch(H){throw Q&&Q(),H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new st("Network Error",st.ERR_NETWORK,p,D),{cause:H.cause||H}):st.from(H,H&&H.code,p,D)}}},n_=new Map,pp=e=>{let t=e?e.env:{};const{fetch:n,Request:s,Response:r}=t,o=[s,r,n];let i=o.length,a=i,c,u,d=n_;for(;a--;)c=o[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:t_(t)),d=u;return u};pp();const lu={http:Sb,xhr:Qb,fetch:{get:pp}};ce.forEach(lu,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const mp=e=>`- ${e}`,s_=e=>ce.isFunction(e)||e===null||e===!1,gp={getAdapter:(e,t)=>{e=ce.isArray(e)?e:[e];const{length:n}=e;let s,r;const o={};for(let i=0;i<n;i++){s=e[i];let a;if(r=s,!s_(s)&&(r=lu[(a=String(s)).toLowerCase()],r===void 0))throw new st(`Unknown adapter '${a}'`);if(r&&(ce.isFunction(r)||(r=r.get(t))))break;o[a||"#"+i]=r}if(!r){const i=Object.entries(o).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since :
`+i.map(mp).join(`
`):" "+mp(i[0]):"as no adapter specified";throw new st("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:lu};function cu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new eo(null,e)}function vp(e){return cu(e),e.headers=kn.from(e.headers),e.data=au.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),gp.getAdapter(e.adapter||ti.adapter,e)(e).then(function(s){return cu(e),s.data=au.call(e,e.transformResponse,s),s.headers=kn.from(s.headers),s},function(s){return np(s)||(cu(e),s&&s.response&&(s.response.data=au.call(e,e.transformResponse,s.response),s.response.headers=kn.from(s.response.headers))),Promise.reject(s)})}const yp="1.12.2",Ia={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ia[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const bp={};Ia.transitional=function(t,n,s){function r(o,i){return"[Axios v"+yp+"] Transitional option '"+o+"'"+i+(s?". "+s:"")}return(o,i,a)=>{if(t===!1)throw new st(r(i," has been removed"+(n?" in "+n:"")),st.ERR_DEPRECATED);return n&&!bp[i]&&(bp[i]=!0,console.warn(r(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,a):!0}},Ia.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function r_(e,t,n){if(typeof e!="object")throw new st("options must be an object",st.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let r=s.length;for(;r-- >0;){const o=s[r],i=t[o];if(i){const a=e[o],c=a===void 0||i(a,o,e);if(c!==!0)throw new st("option "+o+" must be "+c,st.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new st("Unknown option "+o,st.ERR_BAD_OPTION)}}const Pa={assertOptions:r_,validators:Ia},ds=Pa.validators;let yr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Zh,response:new Zh}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const o=r.stack?r.stack.replace(/^.+\n/,""):"";try{s.stack?o&&!String(s.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(s.stack+=`
`+o):s.stack=o}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=vr(this.defaults,n);const{transitional:s,paramsSerializer:r,headers:o}=n;s!==void 0&&Pa.assertOptions(s,{silentJSONParsing:ds.transitional(ds.boolean),forcedJSONParsing:ds.transitional(ds.boolean),clarifyTimeoutError:ds.transitional(ds.boolean)},!1),r!=null&&(ce.isFunction(r)?n.paramsSerializer={serialize:r}:Pa.assertOptions(r,{encode:ds.function,serialize:ds.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Pa.assertOptions(n,{baseUrl:ds.spelling("baseURL"),withXsrfToken:ds.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&ce.merge(o.common,o[n.method]);o&&ce.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=kn.concat(i,o);const a=[];let c=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(c=c&&v.synchronous,a.unshift(v.fulfilled,v.rejected))});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,f=0,h;if(!c){const p=[vp.bind(this),void 0];for(p.unshift(...a),p.push(...u),h=p.length,d=Promise.resolve(n);f<h;)d=d.then(p[f++],p[f++]);return d}h=a.length;let g=n;for(;f<h;){const p=a[f++],v=a[f++];try{g=p(g)}catch(_){v.call(this,_);break}}try{d=vp.call(this,g)}catch(p){return Promise.reject(p)}for(f=0,h=u.length;f<h;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=vr(this.defaults,t);const n=ip(t.baseURL,t.url,t.allowAbsoluteUrls);return Xh(n,t.params,t.paramsSerializer)}};ce.forEach(["delete","get","head","options"],function(t){yr.prototype[t]=function(n,s){return this.request(vr(s||{},{method:t,url:n,data:(s||{}).data}))}}),ce.forEach(["post","put","patch"],function(t){function n(s){return function(o,i,a){return this.request(vr(a||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}yr.prototype[t]=n(),yr.prototype[t+"Form"]=n(!0)});let o_=class e0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const s=this;this.promise.then(r=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](r);s._listeners=null}),this.promise.then=r=>{let o;const i=new Promise(a=>{s.subscribe(a),o=a}).then(r);return i.cancel=function(){s.unsubscribe(o)},i},t(function(o,i,a){s.reason||(s.reason=new eo(o,i,a),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new e0(function(r){t=r}),cancel:t}}};function i_(e){return function(n){return e.apply(null,n)}}function a_(e){return ce.isObject(e)&&e.isAxiosError===!0}const uu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(uu).forEach(([e,t])=>{uu[t]=e});function _p(e){const t=new yr(e),n=Dh(yr.prototype.request,t);return ce.extend(n,yr.prototype,t,{allOwnKeys:!0}),ce.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return _p(vr(e,r))},n}const St=_p(ti);St.Axios=yr,St.CanceledError=eo,St.CancelToken=o_,St.isCancel=np,St.VERSION=yp,St.toFormData=Ca,St.AxiosError=st,St.Cancel=St.CanceledError,St.all=function(t){return Promise.all(t)},St.spread=i_,St.isAxiosError=a_,St.mergeConfig=vr,St.AxiosHeaders=kn,St.formToJSON=e=>ep(ce.isHTMLForm(e)?new FormData(e):e),St.getAdapter=gp.getAdapter,St.HttpStatusCode=uu,St.default=St;const{Axios:qK,AxiosError:BK,CanceledError:UK,isCancel:VK,CancelToken:HK,VERSION:WK,all:GK,Cancel:KK,isAxiosError:QK,spread:JK,toFormData:XK,AxiosHeaders:ZK,HttpStatusCode:YK,formToJSON:eQ,getAdapter:tQ,mergeConfig:nQ}=St,an=[];for(let e=0;e<256;++e)an.push((e+256).toString(16).slice(1));function l_(e,t=0){return(an[e[t+0]]+an[e[t+1]]+an[e[t+2]]+an[e[t+3]]+"-"+an[e[t+4]]+an[e[t+5]]+"-"+an[e[t+6]]+an[e[t+7]]+"-"+an[e[t+8]]+an[e[t+9]]+"-"+an[e[t+10]]+an[e[t+11]]+an[e[t+12]]+an[e[t+13]]+an[e[t+14]]+an[e[t+15]]).toLowerCase()}let du;const c_=new Uint8Array(16);function u_(){if(!du){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");du=crypto.getRandomValues.bind(crypto)}return du(c_)}const xp={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function fs(e,t,n){var r;if(xp.randomUUID&&!e)return xp.randomUUID();e=e||{};const s=e.random??((r=e.rng)==null?void 0:r.call(e))??u_();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,l_(s)}function Gs(){return{getStorage:function(s,r){try{if(localStorage.getItem(s)&&r)return JSON.parse(localStorage.getItem(s))[r]||null;if(localStorage.getItem(s))return JSON.parse(localStorage.getItem(s))}catch{if(localStorage.getItem(s))return localStorage.getItem(s)}return null},saveStorage:function(s,r){localStorage.setItem(s,JSON.stringify(r))},clearStorage:function(s="false"){s?localStorage.removeItem(s):localStorage.clear()}}}const wp="eac_uuid",Ma="eac-user-id",d_="rybbit-user-id",Ks=()=>{var o;const{getStorage:e,saveStorage:t,clearStorage:n}=Gs();let s=e(Ma),r=e(d_);if(r)return r;if(!s){const i=e(wp);i&&(s=i,t(Ma,i),n(wp))}return s||(s=fs(),t(Ma,s)),(o=window.rybbit)==null||o.identify(s),s};async function f_(e){return e}const h_=async(e,t)=>e,p_=(e,t,n)=>async function(s){if(!s)throw new Error("userId is required");try{let r=await t(s);return r||(r=fs(),await n(s,r)),e(r),r}catch(r){console.error("Enhanced identify failed:",r)}},m_=()=>{const e=window.rybbit.identify;window.rybbit.identify=p_(e,f_,h_)},g_=()=>{const e=window.rybbit.clearUserId;window.rybbit.clearUserId=()=>{e(),localStorage.removeItem(Ma)}},v_=()=>{m_(),g_()};function es(e){return new Promise(t=>setTimeout(t,e))}function et(e,t={}){let{currency:n}=t;n=n??"VND";const s=n==="VND"?"vi-VN":"en-US";return new Intl.NumberFormat(s,{style:"currency",currency:n}).format(e)}function Oa(e,t="DD/MM/YYYY"){const n=new Date(e),s=String(n.getDate()).padStart(2,"0"),r=String(n.getMonth()+1).padStart(2,"0"),o=n.getFullYear(),i={"DD/MM/YYYY":`${s}/${r}/${o}`,"MM/DD/YYYY":`${r}/${s}/${o}`,"YYYY/MM/DD":`${o}/${r}/${s}`};return i[t]||i["DD/MM/YYYY"]}const to={default:{product:[{id:1,name:"👍 Tóm tắt ưu nhược điểm",message:"Tóm tắt ưu nhược điểm của {title}"},{id:2,name:"🆚 So sánh các mẫu tương đương",message:"So sánh các mẫu tương đương với {title}"},{id:3,name:"{logo} Tại sao nên mua tại {brand}",message:"Tại sao nên mua {title} tại {brand}"}],category:[{id:1,name:"🏆 Top bán chạy",message:"Top {title} bán chạy"},{id:2,name:"💰 Top theo phân khúc giá",message:"Top {title} theo phân khúc giá"},{id:3,name:"🔥 Khuyến mãi hot nhất",message:"Khuyến mãi {title} hot nhất"},{id:4,name:"🔄 So sánh các hãng",message:"So sánh các hãng {title}"}]}},fu="EASYCHATGPT_WIDGET_CLOSE_MESSAGE",hu="easychatgpt-form",ts="ecg_auth_token",Kt="easychatgpt_conversations",no="easychatgpt_group_conversations",Mn="rangdongstorevn-zll",qn="wwwdienmayxanhcom-urk",Bn="wwwthegioididongcom-rtx",pu="easychatgptio-ujc",br="dienmaycholoncom",si="mediamartvn",_r="picovn-drr",so="eco-martvn-a3r",xr="eradovn-fyw",ri="wwwdragontourvn",oi="truemotocarecom",$s="laptop88vn",ii="noithatgiaphongvn",Sn="bvdaihoccomvn-7n5",ns="wwwphucanhvn",wr="viettelstorevn",y_=["bepantoanvn-upq","easyaiagentsapp","viettelstorevn","khaphanspace","consoleeasyaichatapp-pwg"],Ra={SPA:["rangdongstorevn-zll"],SSR:["eradovn-fyw"]};function kp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mu={exports:{}},Pt={},gu={exports:{}},kr={};function Sp(){var e={};return e["align-content"]=!1,e["align-items"]=!1,e["align-self"]=!1,e["alignment-adjust"]=!1,e["alignment-baseline"]=!1,e.all=!1,e["anchor-point"]=!1,e.animation=!1,e["animation-delay"]=!1,e["animation-direction"]=!1,e["animation-duration"]=!1,e["animation-fill-mode"]=!1,e["animation-iteration-count"]=!1,e["animation-name"]=!1,e["animation-play-state"]=!1,e["animation-timing-function"]=!1,e.azimuth=!1,e["backface-visibility"]=!1,e.background=!0,e["background-attachment"]=!0,e["background-clip"]=!0,e["background-color"]=!0,e["background-image"]=!0,e["background-origin"]=!0,e["background-position"]=!0,e["background-repeat"]=!0,e["background-size"]=!0,e["baseline-shift"]=!1,e.binding=!1,e.bleed=!1,e["bookmark-label"]=!1,e["bookmark-level"]=!1,e["bookmark-state"]=!1,e.border=!0,e["border-bottom"]=!0,e["border-bottom-color"]=!0,e["border-bottom-left-radius"]=!0,e["border-bottom-right-radius"]=!0,e["border-bottom-style"]=!0,e["border-bottom-width"]=!0,e["border-collapse"]=!0,e["border-color"]=!0,e["border-image"]=!0,e["border-image-outset"]=!0,e["border-image-repeat"]=!0,e["border-image-slice"]=!0,e["border-image-source"]=!0,e["border-image-width"]=!0,e["border-left"]=!0,e["border-left-color"]=!0,e["border-left-style"]=!0,e["border-left-width"]=!0,e["border-radius"]=!0,e["border-right"]=!0,e["border-right-color"]=!0,e["border-right-style"]=!0,e["border-right-width"]=!0,e["border-spacing"]=!0,e["border-style"]=!0,e["border-top"]=!0,e["border-top-color"]=!0,e["border-top-left-radius"]=!0,e["border-top-right-radius"]=!0,e["border-top-style"]=!0,e["border-top-width"]=!0,e["border-width"]=!0,e.bottom=!1,e["box-decoration-break"]=!0,e["box-shadow"]=!0,e["box-sizing"]=!0,e["box-snap"]=!0,e["box-suppress"]=!0,e["break-after"]=!0,e["break-before"]=!0,e["break-inside"]=!0,e["caption-side"]=!1,e.chains=!1,e.clear=!0,e.clip=!1,e["clip-path"]=!1,e["clip-rule"]=!1,e.color=!0,e["color-interpolation-filters"]=!0,e["column-count"]=!1,e["column-fill"]=!1,e["column-gap"]=!1,e["column-rule"]=!1,e["column-rule-color"]=!1,e["column-rule-style"]=!1,e["column-rule-width"]=!1,e["column-span"]=!1,e["column-width"]=!1,e.columns=!1,e.contain=!1,e.content=!1,e["counter-increment"]=!1,e["counter-reset"]=!1,e["counter-set"]=!1,e.crop=!1,e.cue=!1,e["cue-after"]=!1,e["cue-before"]=!1,e.cursor=!1,e.direction=!1,e.display=!0,e["display-inside"]=!0,e["display-list"]=!0,e["display-outside"]=!0,e["dominant-baseline"]=!1,e.elevation=!1,e["empty-cells"]=!1,e.filter=!1,e.flex=!1,e["flex-basis"]=!1,e["flex-direction"]=!1,e["flex-flow"]=!1,e["flex-grow"]=!1,e["flex-shrink"]=!1,e["flex-wrap"]=!1,e.float=!1,e["float-offset"]=!1,e["flood-color"]=!1,e["flood-opacity"]=!1,e["flow-from"]=!1,e["flow-into"]=!1,e.font=!0,e["font-family"]=!0,e["font-feature-settings"]=!0,e["font-kerning"]=!0,e["font-language-override"]=!0,e["font-size"]=!0,e["font-size-adjust"]=!0,e["font-stretch"]=!0,e["font-style"]=!0,e["font-synthesis"]=!0,e["font-variant"]=!0,e["font-variant-alternates"]=!0,e["font-variant-caps"]=!0,e["font-variant-east-asian"]=!0,e["font-variant-ligatures"]=!0,e["font-variant-numeric"]=!0,e["font-variant-position"]=!0,e["font-weight"]=!0,e.grid=!1,e["grid-area"]=!1,e["grid-auto-columns"]=!1,e["grid-auto-flow"]=!1,e["grid-auto-rows"]=!1,e["grid-column"]=!1,e["grid-column-end"]=!1,e["grid-column-start"]=!1,e["grid-row"]=!1,e["grid-row-end"]=!1,e["grid-row-start"]=!1,e["grid-template"]=!1,e["grid-template-areas"]=!1,e["grid-template-columns"]=!1,e["grid-template-rows"]=!1,e["hanging-punctuation"]=!1,e.height=!0,e.hyphens=!1,e.icon=!1,e["image-orientation"]=!1,e["image-resolution"]=!1,e["ime-mode"]=!1,e["initial-letters"]=!1,e["inline-box-align"]=!1,e["justify-content"]=!1,e["justify-items"]=!1,e["justify-self"]=!1,e.left=!1,e["letter-spacing"]=!0,e["lighting-color"]=!0,e["line-box-contain"]=!1,e["line-break"]=!1,e["line-grid"]=!1,e["line-height"]=!1,e["line-snap"]=!1,e["line-stacking"]=!1,e["line-stacking-ruby"]=!1,e["line-stacking-shift"]=!1,e["line-stacking-strategy"]=!1,e["list-style"]=!0,e["list-style-image"]=!0,e["list-style-position"]=!0,e["list-style-type"]=!0,e.margin=!0,e["margin-bottom"]=!0,e["margin-left"]=!0,e["margin-right"]=!0,e["margin-top"]=!0,e["marker-offset"]=!1,e["marker-side"]=!1,e.marks=!1,e.mask=!1,e["mask-box"]=!1,e["mask-box-outset"]=!1,e["mask-box-repeat"]=!1,e["mask-box-slice"]=!1,e["mask-box-source"]=!1,e["mask-box-width"]=!1,e["mask-clip"]=!1,e["mask-image"]=!1,e["mask-origin"]=!1,e["mask-position"]=!1,e["mask-repeat"]=!1,e["mask-size"]=!1,e["mask-source-type"]=!1,e["mask-type"]=!1,e["max-height"]=!0,e["max-lines"]=!1,e["max-width"]=!0,e["min-height"]=!0,e["min-width"]=!0,e["move-to"]=!1,e["nav-down"]=!1,e["nav-index"]=!1,e["nav-left"]=!1,e["nav-right"]=!1,e["nav-up"]=!1,e["object-fit"]=!1,e["object-position"]=!1,e.opacity=!1,e.order=!1,e.orphans=!1,e.outline=!1,e["outline-color"]=!1,e["outline-offset"]=!1,e["outline-style"]=!1,e["outline-width"]=!1,e.overflow=!1,e["overflow-wrap"]=!1,e["overflow-x"]=!1,e["overflow-y"]=!1,e.padding=!0,e["padding-bottom"]=!0,e["padding-left"]=!0,e["padding-right"]=!0,e["padding-top"]=!0,e.page=!1,e["page-break-after"]=!1,e["page-break-before"]=!1,e["page-break-inside"]=!1,e["page-policy"]=!1,e.pause=!1,e["pause-after"]=!1,e["pause-before"]=!1,e.perspective=!1,e["perspective-origin"]=!1,e.pitch=!1,e["pitch-range"]=!1,e["play-during"]=!1,e.position=!1,e["presentation-level"]=!1,e.quotes=!1,e["region-fragment"]=!1,e.resize=!1,e.rest=!1,e["rest-after"]=!1,e["rest-before"]=!1,e.richness=!1,e.right=!1,e.rotation=!1,e["rotation-point"]=!1,e["ruby-align"]=!1,e["ruby-merge"]=!1,e["ruby-position"]=!1,e["shape-image-threshold"]=!1,e["shape-outside"]=!1,e["shape-margin"]=!1,e.size=!1,e.speak=!1,e["speak-as"]=!1,e["speak-header"]=!1,e["speak-numeral"]=!1,e["speak-punctuation"]=!1,e["speech-rate"]=!1,e.stress=!1,e["string-set"]=!1,e["tab-size"]=!1,e["table-layout"]=!1,e["text-align"]=!0,e["text-align-last"]=!0,e["text-combine-upright"]=!0,e["text-decoration"]=!0,e["text-decoration-color"]=!0,e["text-decoration-line"]=!0,e["text-decoration-skip"]=!0,e["text-decoration-style"]=!0,e["text-emphasis"]=!0,e["text-emphasis-color"]=!0,e["text-emphasis-position"]=!0,e["text-emphasis-style"]=!0,e["text-height"]=!0,e["text-indent"]=!0,e["text-justify"]=!0,e["text-orientation"]=!0,e["text-overflow"]=!0,e["text-shadow"]=!0,e["text-space-collapse"]=!0,e["text-transform"]=!0,e["text-underline-position"]=!0,e["text-wrap"]=!0,e.top=!1,e.transform=!1,e["transform-origin"]=!1,e["transform-style"]=!1,e.transition=!1,e["transition-delay"]=!1,e["transition-duration"]=!1,e["transition-property"]=!1,e["transition-timing-function"]=!1,e["unicode-bidi"]=!1,e["vertical-align"]=!1,e.visibility=!1,e["voice-balance"]=!1,e["voice-duration"]=!1,e["voice-family"]=!1,e["voice-pitch"]=!1,e["voice-range"]=!1,e["voice-rate"]=!1,e["voice-stress"]=!1,e["voice-volume"]=!1,e.volume=!1,e["white-space"]=!1,e.widows=!1,e.width=!0,e["will-change"]=!1,e["word-break"]=!0,e["word-spacing"]=!0,e["word-wrap"]=!0,e["wrap-flow"]=!1,e["wrap-through"]=!1,e["writing-mode"]=!1,e["z-index"]=!1,e}function b_(e,t,n){}function __(e,t,n){}var x_=/javascript\s*\:/img;function w_(e,t){return x_.test(t)?"":t}kr.whiteList=Sp(),kr.getDefaultWhiteList=Sp,kr.onAttr=b_,kr.onIgnoreAttr=__,kr.safeAttrValue=w_;var k_={indexOf:function(e,t){var n,s;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,s=e.length;n<s;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var s,r;if(Array.prototype.forEach)return e.forEach(t,n);for(s=0,r=e.length;s<r;s++)t.call(n,e[s],s,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},trimRight:function(e){return String.prototype.trimRight?e.trimRight():e.replace(/(\s*$)/g,"")}},ai=k_;function S_(e,t){e=ai.trimRight(e),e[e.length-1]!==";"&&(e+=";");var n=e.length,s=!1,r=0,o=0,i="";function a(){if(!s){var d=ai.trim(e.slice(r,o)),f=d.indexOf(":");if(f!==-1){var h=ai.trim(d.slice(0,f)),g=ai.trim(d.slice(f+1));if(h){var p=t(r,i.length,h,g,d);p&&(i+=p+"; ")}}}r=o+1}for(;o<n;o++){var c=e[o];if(c==="/"&&e[o+1]==="*"){var u=e.indexOf("*/",o+2);if(u===-1)break;o=u+1,r=o+1,s=!1}else c==="("?s=!0:c===")"?s=!1:c===";"?s||a():c===`
`&&a()}return ai.trim(i)}var $_=S_,La=kr,C_=$_;function $p(e){return e==null}function T_(e){var t={};for(var n in e)t[n]=e[n];return t}function Cp(e){e=T_(e||{}),e.whiteList=e.whiteList||La.whiteList,e.onAttr=e.onAttr||La.onAttr,e.onIgnoreAttr=e.onIgnoreAttr||La.onIgnoreAttr,e.safeAttrValue=e.safeAttrValue||La.safeAttrValue,this.options=e}Cp.prototype.process=function(e){if(e=e||"",e=e.toString(),!e)return"";var t=this,n=t.options,s=n.whiteList,r=n.onAttr,o=n.onIgnoreAttr,i=n.safeAttrValue,a=C_(e,function(c,u,d,f,h){var g=s[d],p=!1;if(g===!0?p=g:typeof g=="function"?p=g(f):g instanceof RegExp&&(p=g.test(f)),p!==!0&&(p=!1),f=i(d,f),!!f){var v={position:u,sourcePosition:c,source:h,isWhite:p};if(p){var _=r(d,f,v);return $p(_)?d+":"+f:_}else{var _=o(d,f,v);if(!$p(_))return _}}});return a};var E_=Cp;(function(e,t){var n=kr,s=E_;function r(i,a){var c=new s(a);return c.process(i)}t=e.exports=r,t.FilterCSS=s;for(var o in n)t[o]=n[o];typeof window<"u"&&(window.filterCSS=e.exports)})(gu,gu.exports);var vu=gu.exports,yu={indexOf:function(e,t){var n,s;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,s=e.length;n<s;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var s,r;if(Array.prototype.forEach)return e.forEach(t,n);for(s=0,r=e.length;s<r;s++)t.call(n,e[s],s,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},spaceIndex:function(e){var t=/\s|\n|\t/,n=t.exec(e);return n?n.index:-1}},A_=vu.FilterCSS,I_=vu.getDefaultWhiteList,Da=yu;function Tp(){return{a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height","loading"],ins:["datetime"],kbd:[],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]}}var Ep=new A_;function P_(e,t,n){}function M_(e,t,n){}function O_(e,t,n){}function R_(e,t,n){}function Ap(e){return e.replace(D_,"&lt;").replace(j_,"&gt;")}function L_(e,t,n,s){if(n=jp(n),t==="href"||t==="src"){if(n=Da.trim(n),n==="#")return"#";if(!(n.substr(0,7)==="http://"||n.substr(0,8)==="https://"||n.substr(0,7)==="mailto:"||n.substr(0,4)==="tel:"||n.substr(0,11)==="data:image/"||n.substr(0,6)==="ftp://"||n.substr(0,2)==="./"||n.substr(0,3)==="../"||n[0]==="#"||n[0]==="/"))return""}else if(t==="background"){if(ja.lastIndex=0,ja.test(n))return""}else if(t==="style"){if(Ip.lastIndex=0,Ip.test(n)||(Pp.lastIndex=0,Pp.test(n)&&(ja.lastIndex=0,ja.test(n))))return"";s!==!1&&(s=s||Ep,n=s.process(n))}return n=Np(n),n}var D_=/</g,j_=/>/g,N_=/"/g,F_=/&quot;/g,z_=/&#([a-zA-Z0-9]*);?/gim,q_=/&colon;?/gim,B_=/&newline;?/gim,ja=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,Ip=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,Pp=/u\s*r\s*l\s*\(.*/gi;function Mp(e){return e.replace(N_,"&quot;")}function Op(e){return e.replace(F_,'"')}function Rp(e){return e.replace(z_,function(n,s){return s[0]==="x"||s[0]==="X"?String.fromCharCode(parseInt(s.substr(1),16)):String.fromCharCode(parseInt(s,10))})}function Lp(e){return e.replace(q_,":").replace(B_," ")}function Dp(e){for(var t="",n=0,s=e.length;n<s;n++)t+=e.charCodeAt(n)<32?" ":e.charAt(n);return Da.trim(t)}function jp(e){return e=Op(e),e=Rp(e),e=Lp(e),e=Dp(e),e}function Np(e){return e=Mp(e),e=Ap(e),e}function U_(){return""}function V_(e,t){typeof t!="function"&&(t=function(){});var n=!Array.isArray(e);function s(i){return n?!0:Da.indexOf(e,i)!==-1}var r=[],o=!1;return{onIgnoreTag:function(i,a,c){if(s(i))if(c.isClosing){var u="[/removed]",d=c.position+u.length;return r.push([o!==!1?o:c.position,d]),o=!1,u}else return o||(o=c.position),"[removed]";else return t(i,a,c)},remove:function(i){var a="",c=0;return Da.forEach(r,function(u){a+=i.slice(c,u[0]),c=u[1]}),a+=i.slice(c),a}}}function H_(e){for(var t="",n=0;n<e.length;){var s=e.indexOf("<!--",n);if(s===-1){t+=e.slice(n);break}t+=e.slice(n,s);var r=e.indexOf("-->",s);if(r===-1)break;n=r+3}return t}function W_(e){var t=e.split("");return t=t.filter(function(n){var s=n.charCodeAt(0);return s===127?!1:s<=31?s===10||s===13:!0}),t.join("")}Pt.whiteList=Tp(),Pt.getDefaultWhiteList=Tp,Pt.onTag=P_,Pt.onIgnoreTag=M_,Pt.onTagAttr=O_,Pt.onIgnoreTagAttr=R_,Pt.safeAttrValue=L_,Pt.escapeHtml=Ap,Pt.escapeQuote=Mp,Pt.unescapeQuote=Op,Pt.escapeHtmlEntities=Rp,Pt.escapeDangerHtml5Entities=Lp,Pt.clearNonPrintableCharacter=Dp,Pt.friendlyAttrValue=jp,Pt.escapeAttrValue=Np,Pt.onIgnoreTagStripAll=U_,Pt.StripTagBody=V_,Pt.stripCommentTag=H_,Pt.stripBlankChar=W_,Pt.attributeWrapSign='"',Pt.cssFilter=Ep,Pt.getDefaultCSSWhiteList=I_;var Na={},Qs=yu;function G_(e){var t=Qs.spaceIndex(e),n;return t===-1?n=e.slice(1,-1):n=e.slice(1,t+1),n=Qs.trim(n).toLowerCase(),n.slice(0,1)==="/"&&(n=n.slice(1)),n.slice(-1)==="/"&&(n=n.slice(0,-1)),n}function K_(e){return e.slice(0,2)==="</"}function Q_(e,t,n){var s="",r=0,o=!1,i=!1,a=0,c=e.length,u="",d="";e:for(a=0;a<c;a++){var f=e.charAt(a);if(o===!1){if(f==="<"){o=a;continue}}else if(i===!1){if(f==="<"){s+=n(e.slice(r,a)),o=a,r=a;continue}if(f===">"||a===c-1){s+=n(e.slice(r,o)),d=e.slice(o,a+1),u=G_(d),s+=t(o,s.length,u,d,K_(d)),r=a+1,o=!1;continue}if(f==='"'||f==="'")for(var h=1,g=e.charAt(a-h);g.trim()===""||g==="=";){if(g==="="){i=f;continue e}g=e.charAt(a-++h)}}else if(f===i){i=!1;continue}}return r<c&&(s+=n(e.substr(r))),s}var J_=/[^a-zA-Z0-9\\_:.-]/gim;function X_(e,t){var n=0,s=0,r=[],o=!1,i=e.length;function a(h,g){if(h=Qs.trim(h),h=h.replace(J_,"").toLowerCase(),!(h.length<1)){var p=t(h,g||"");p&&r.push(p)}}for(var c=0;c<i;c++){var u=e.charAt(c),d,f;if(o===!1&&u==="="){o=e.slice(n,c),n=c+1,s=e.charAt(n)==='"'||e.charAt(n)==="'"?n:Y_(e,c+1);continue}if(o!==!1&&c===s){if(f=e.indexOf(u,c+1),f===-1)break;d=Qs.trim(e.slice(s+1,f)),a(o,d),o=!1,c=f,n=c+1;continue}if(/\s|\n|\t/.test(u))if(e=e.replace(/\s|\n|\t/g," "),o===!1)if(f=Z_(e,c),f===-1){d=Qs.trim(e.slice(n,c)),a(d),o=!1,n=c+1;continue}else{c=f-1;continue}else if(f=ex(e,c-1),f===-1){d=Qs.trim(e.slice(n,c)),d=Fp(d),a(o,d),o=!1,n=c+1;continue}else continue}return n<e.length&&(o===!1?a(e.slice(n)):a(o,Fp(Qs.trim(e.slice(n))))),Qs.trim(r.join(" "))}function Z_(e,t){for(;t<e.length;t++){var n=e[t];if(n!==" ")return n==="="?t:-1}}function Y_(e,t){for(;t<e.length;t++){var n=e[t];if(n!==" ")return n==="'"||n==='"'?t:-1}}function ex(e,t){for(;t>0;t--){var n=e[t];if(n!==" ")return n==="="?t:-1}}function tx(e){return e[0]==='"'&&e[e.length-1]==='"'||e[0]==="'"&&e[e.length-1]==="'"}function Fp(e){return tx(e)?e.substr(1,e.length-2):e}Na.parseTag=Q_,Na.parseAttr=X_;var nx=vu.FilterCSS,Un=Pt,zp=Na,sx=zp.parseTag,rx=zp.parseAttr,Fa=yu;function za(e){return e==null}function ox(e){var t=Fa.spaceIndex(e);if(t===-1)return{html:"",closing:e[e.length-2]==="/"};e=Fa.trim(e.slice(t+1,-1));var n=e[e.length-1]==="/";return n&&(e=Fa.trim(e.slice(0,-1))),{html:e,closing:n}}function ix(e){var t={};for(var n in e)t[n]=e[n];return t}function ax(e){var t={};for(var n in e)Array.isArray(e[n])?t[n.toLowerCase()]=e[n].map(function(s){return s.toLowerCase()}):t[n.toLowerCase()]=e[n];return t}function qp(e){e=ix(e||{}),e.stripIgnoreTag&&(e.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),e.onIgnoreTag=Un.onIgnoreTagStripAll),e.whiteList||e.allowList?e.whiteList=ax(e.whiteList||e.allowList):e.whiteList=Un.whiteList,this.attributeWrapSign=e.singleQuotedAttributeValue===!0?"'":Un.attributeWrapSign,e.onTag=e.onTag||Un.onTag,e.onTagAttr=e.onTagAttr||Un.onTagAttr,e.onIgnoreTag=e.onIgnoreTag||Un.onIgnoreTag,e.onIgnoreTagAttr=e.onIgnoreTagAttr||Un.onIgnoreTagAttr,e.safeAttrValue=e.safeAttrValue||Un.safeAttrValue,e.escapeHtml=e.escapeHtml||Un.escapeHtml,this.options=e,e.css===!1?this.cssFilter=!1:(e.css=e.css||{},this.cssFilter=new nx(e.css))}qp.prototype.process=function(e){if(e=e||"",e=e.toString(),!e)return"";var t=this,n=t.options,s=n.whiteList,r=n.onTag,o=n.onIgnoreTag,i=n.onTagAttr,a=n.onIgnoreTagAttr,c=n.safeAttrValue,u=n.escapeHtml,d=t.attributeWrapSign,f=t.cssFilter;n.stripBlankChar&&(e=Un.stripBlankChar(e)),n.allowCommentTag||(e=Un.stripCommentTag(e));var h=!1;n.stripIgnoreTagBody&&(h=Un.StripTagBody(n.stripIgnoreTagBody,o),o=h.onIgnoreTag);var g=sx(e,function(p,v,_,k,w){var $={sourcePosition:p,position:v,isClosing:w,isWhite:Object.prototype.hasOwnProperty.call(s,_)},E=r(_,k,$);if(!za(E))return E;if($.isWhite){if($.isClosing)return"</"+_+">";var P=ox(k),I=s[_],M=rx(P.html,function(L,V){var X=Fa.indexOf(I,L)!==-1,T=i(_,L,V,X);return za(T)?X?(V=c(_,L,V,f),V?L+"="+d+V+d:L):(T=a(_,L,V,X),za(T)?void 0:T):T});return k="<"+_,M&&(k+=" "+M),P.closing&&(k+=" /"),k+=">",k}else return E=o(_,k,$),za(E)?u(k):E},u);return h&&(g=h.remove(g)),g};var lx=qp;(function(e,t){var n=Pt,s=Na,r=lx;function o(a,c){var u=new r(c);return u.process(a)}t=e.exports=o,t.filterXSS=o,t.FilterXSS=r,function(){for(var a in n)t[a]=n[a];for(var c in s)t[c]=s[c]}(),typeof window<"u"&&(window.filterXSS=e.exports);function i(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}i()&&(self.filterXSS=e.exports)})(mu,mu.exports);var Bp=mu.exports;const cx=[/<script[\s\S]*?(<\/script>|$)/i,/javascript\s*:/i,/vbscript\s*:/i,/data\s*:\s*text\s*\/\s*html/i,/on\w+\s*=/i,/expression\s*\(/i,/url\s*\(\s*['"]?\s*javascript\s*:/i,/srcdoc\s*=.*<script/i,/\{\{.*\}\}|\$\{.*\}|v-on:|ng-\w+=/,/@\w+\s*=\s*["'][^"']*["']/],Up=[/expression\s*\(/i,/javascript\s*:/i,/vbscript\s*:/i,/data\s*:\s*(?!image\/)/i,/@import/i,/behavior\s*:/i,/-moz-binding/i],Vp=e=>{if(!e||typeof e!="string")return!1;if(cx.some(t=>t.test(e)))return!0;if(/&[a-zA-Z]+;|&#\d+;|&#x[0-9a-fA-F]+;/.test(e)){const t=e.replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#39;/gi,"'").replace(/&amp;/gi,"&").replace(/&#x3C;/gi,"<").replace(/&#x3E;/gi,">").replace(/&#60;/gi,"<").replace(/&#62;/gi,">").replace(/&#x22;/gi,'"').replace(/&#x27;/gi,"'");if(t!==e)return Vp(t)}return!1},ux=e=>{if(!e||typeof e!="string")return"";let t=e.replace(/\/\*[\s\S]*?\*\//g,"").trim();if(Up.some(r=>r.test(t)))return console.warn("Blocked dangerous CSS:",e),"";const n=t.split(";").filter(r=>r.trim()),s=[];return n.forEach(r=>{const o=r.indexOf(":");if(o===-1)return;const i=r.substring(0,o).trim(),a=r.substring(o+1).trim();Up.some(c=>c.test(a))||s.push(`${i}: ${a}`)}),s.join("; ")},Hp={whiteList:{a:["alt","class","href","id","title","target","rel"],b:["class","id"],blockquote:["class","id"],br:[],code:["class","id"],div:["class","id","style"],em:["class","id"],h1:["class","id"],h2:["class","id"],h3:["class","id"],h4:["class","id"],h5:["class","id"],h6:["class","id"],hr:["class","id"],i:["class","id"],p:["class","id","style"],pre:["class","id"],span:["class","id","style"],strong:["class","id"],li:["class","id"],ol:["class","id","start"],ul:["class","id"],table:["class","id"],tbody:["class","id"],td:["class","id","colspan","rowspan"],th:["class","id","colspan","rowspan"],thead:["class","id"],tr:["class","id"],img:["alt","class","id","src","title"],math:["class","id","mathvariant","displaystyle"],mrow:["class","id"],mi:["class","id","mathvariant"],mo:["class","id"],mn:["class","id"],msup:["class","id"],msub:["class","id"],mfrac:["class","id"],msqrt:["class","id"]},stripIgnoreTag:!0,stripIgnoreTagBody:["script","style"],onTagAttr:(e,t,n,s)=>{if(t.toLowerCase().startsWith("on"))return"";if(t==="style"){const r=ux(n);return r?`style="${r}"`:""}if(t==="href"||t==="src"){const r=hx(n);return r!==n?`${t}="${r}"`:null}return s?null:""},onIgnoreTagAttr:(e,t,n,s)=>""},dx=new Bp.FilterXSS(Hp),fx=(e,t={})=>{if(!e||typeof e!="string")return"";const n={...Hp,...t};return(t&&Object.keys(t).length>0?new Bp.FilterXSS(n):dx).process(e)},hx=e=>{if(!e||typeof e!="string")return"#";const t=e.trim().toLowerCase();return t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("data:")&&!t.startsWith("data:image/")?"#blocked":e},Wp=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),px=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Gp=e=>typeof e=="string"&&px.test(e);function ro(e){return(JSON.parse(localStorage.getItem(Kt))||{})[e]}function Kp(){const e=new URLSearchParams(window.location.search).get("conversation_id");return e&&Gp(e)?e:null}const oo={lpnasamarketcom:{category:/(.*)-pc(\d+)\.html$/,product:/(.*)-p(\d+)\.html$/},"picovn-drr":{category:/^\/[^\/]+\.c$/}};function ss(e){var r;const t=document.querySelectorAll('body script[type="application/ld+json"]'),n=document.querySelectorAll('head script[type="application/ld+json"]'),s=[...t,...n];for(const o of s)try{const a=o.textContent.replace(/[\x00-\x1F]+/g," "),c=JSON.parse(a);if((r=c["@context"])!=null&&r.includes("https://schema.org")&&c["@type"]===e)return c}catch(i){console.warn("⚠️ Skipped invalid JSON schema:",i.message);continue}return null}function hs(){const e=document.querySelector('meta[property="og:image"]');return e?e.getAttribute("content"):null}function mx(){const e=document.querySelector('link[rel="canonical"]');return e&&e.href?e.href:window.location.origin+window.location.pathname}function gx(e){if(!oo[e])return null;const t=mx(),n=new URL(t).pathname;if(n==="/")return null;let s=!1,r=!1;return oo[e].category&&(s=n.match(oo[e].category)),oo[e].product&&(r=n.match(oo[e].product)),s?"category":r?"product":null}function Cs(){try{const e={type:null,title:null,description:null,image:null,url:null,price_amount:null,price_currency:null};return[{key:"title",property:"og:title"},{key:"description",property:"og:description"},{key:"image",property:"og:image"},{key:"url",property:"og:url"},{key:"price_amount",property:"product:price:amount"},{key:"price_currency",property:"product:price:currency"}].forEach(({key:n,property:s})=>{let r=`meta[property="${s}"]`;n==="title"&&(r+=':not([itemprop="headline"])');const o=document.querySelector(r);o&&(e[n]=o.getAttribute("content"))}),e}catch{return null}}function vx({handle:e}){if(!oo[e])return null;try{const t=gx(e);if(t)return t;const n=document.querySelector('meta[property="og:type"]');return n&&["product","category"].includes(n.content)?n.content:null}catch{return null}}function yx(e,t="-"){return e&&e.toLowerCase().replace(/\t/g,"").replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a").replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e").replace(/ì|í|ị|ỉ|ĩ/g,"i").replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o").replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u").replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y").replace(/đ/g,"d").replace(/\s+/g,t).replace(/[^A-Za-z0-9_-]/g,"").replace(/-+/g,t)}function bu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Sr=bu();function Qp(e){Sr=e}const Jp=/[&<>"']/,bx=new RegExp(Jp.source,"g"),Xp=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,_x=new RegExp(Xp.source,"g"),xx={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Zp=e=>xx[e];function On(e,t){if(t){if(Jp.test(e))return e.replace(bx,Zp)}else if(Xp.test(e))return e.replace(_x,Zp);return e}const wx=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function kx(e){return e.replace(wx,(t,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const Sx=/(^|[^\[])\^/g;function xt(e,t){let n=typeof e=="string"?e:e.source;t=t||"";const s={replace:(r,o)=>{let i=typeof o=="string"?o:o.source;return i=i.replace(Sx,"$1"),n=n.replace(r,i),s},getRegex:()=>new RegExp(n,t)};return s}function Yp(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const li={exec:()=>null};function em(e,t){const n=e.replace(/\|/g,(o,i,a)=>{let c=!1,u=i;for(;--u>=0&&a[u]==="\\";)c=!c;return c?"|":" |"}),s=n.split(/ \|/);let r=0;if(s[0].trim()||s.shift(),s.length>0&&!s[s.length-1].trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(/\\\|/g,"|");return s}function qa(e,t,n){const s=e.length;if(s===0)return"";let r=0;for(;r<s&&e.charAt(s-r-1)===t;)r++;return e.slice(0,s-r)}function $x(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return-1}function tm(e,t,n,s){const r=t.href,o=t.title?On(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");if(e[0].charAt(0)!=="!"){s.state.inLink=!0;const a={type:"link",raw:n,href:r,title:o,text:i,tokens:s.inlineTokens(i)};return s.state.inLink=!1,a}return{type:"image",raw:n,href:r,title:o,text:On(i)}}function Cx(e,t){const n=e.match(/^(\s+)(?:```)/);if(n===null)return t;const s=n[1];return t.split(`
`).map(r=>{const o=r.match(/^\s+/);if(o===null)return r;const[i]=o;return i.length>=s.length?r.slice(s.length):r}).join(`
`)}class Ba{constructor(t){Ct(this,"options");Ct(this,"rules");Ct(this,"lexer");this.options=t||Sr}space(t){const n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){const n=this.rules.block.code.exec(t);if(n){const s=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?s:qa(s,`
`)}}}fences(t){const n=this.rules.block.fences.exec(t);if(n){const s=n[0],r=Cx(s,n[3]||"");return{type:"code",raw:s,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:r}}}heading(t){const n=this.rules.block.heading.exec(t);if(n){let s=n[2].trim();if(/#$/.test(s)){const r=qa(s,"#");(this.options.pedantic||!r||/ $/.test(r))&&(s=r.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(t){const n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:n[0]}}blockquote(t){const n=this.rules.block.blockquote.exec(t);if(n){let s=n[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
$1`);s=qa(s.replace(/^ *>[ \t]?/gm,""),`
`);const r=this.lexer.state.top;this.lexer.state.top=!0;const o=this.lexer.blockTokens(s);return this.lexer.state.top=r,{type:"blockquote",raw:n[0],tokens:o,text:s}}}list(t){let n=this.rules.block.list.exec(t);if(n){let s=n[1].trim();const r=s.length>1,o={type:"list",raw:"",ordered:r,start:r?+s.slice(0,-1):"",loose:!1,items:[]};s=r?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=r?s:"[*+-]");const i=new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`);let a="",c="",u=!1;for(;t;){let d=!1;if(!(n=i.exec(t))||this.rules.block.hr.test(t))break;a=n[0],t=t.substring(a.length);let f=n[2].split(`
`,1)[0].replace(/^\t+/,k=>" ".repeat(3*k.length)),h=t.split(`
`,1)[0],g=0;this.options.pedantic?(g=2,c=f.trimStart()):(g=n[2].search(/[^ ]/),g=g>4?1:g,c=f.slice(g),g+=n[1].length);let p=!1;if(!f&&/^ *$/.test(h)&&(a+=h+`
`,t=t.substring(h.length+1),d=!0),!d){const k=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),w=new RegExp(`^ {0,${Math.min(3,g-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),$=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:\`\`\`|~~~)`),E=new RegExp(`^ {0,${Math.min(3,g-1)}}#`);for(;t;){const P=t.split(`
`,1)[0];if(h=P,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),$.test(h)||E.test(h)||k.test(h)||w.test(t))break;if(h.search(/[^ ]/)>=g||!h.trim())c+=`
`+h.slice(g);else{if(p||f.search(/[^ ]/)>=4||$.test(f)||E.test(f)||w.test(f))break;c+=`
`+h}!p&&!h.trim()&&(p=!0),a+=P+`
`,t=t.substring(P.length+1),f=h.slice(g)}}o.loose||(u?o.loose=!0:/\n *\n *$/.test(a)&&(u=!0));let v=null,_;this.options.gfm&&(v=/^\[[ xX]\] /.exec(c),v&&(_=v[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:a,task:!!v,checked:_,loose:!1,text:c,tokens:[]}),o.raw+=a}o.items[o.items.length-1].raw=a.trimEnd(),o.items[o.items.length-1].text=c.trimEnd(),o.raw=o.raw.trimEnd();for(let d=0;d<o.items.length;d++)if(this.lexer.state.top=!1,o.items[d].tokens=this.lexer.blockTokens(o.items[d].text,[]),!o.loose){const f=o.items[d].tokens.filter(g=>g.type==="space"),h=f.length>0&&f.some(g=>/\n.*\n/.test(g.raw));o.loose=h}if(o.loose)for(let d=0;d<o.items.length;d++)o.items[d].loose=!0;return o}}html(t){const n=this.rules.block.html.exec(t);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(t){const n=this.rules.block.def.exec(t);if(n){const s=n[1].toLowerCase().replace(/\s+/g," "),r=n[2]?n[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:s,raw:n[0],href:r,title:o}}}table(t){const n=this.rules.block.table.exec(t);if(!n||!/[:|]/.test(n[2]))return;const s=em(n[1]),r=n[2].replace(/^\||\| *$/g,"").split("|"),o=n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(`
`):[],i={type:"table",raw:n[0],header:[],align:[],rows:[]};if(s.length===r.length){for(const a of r)/^ *-+: *$/.test(a)?i.align.push("right"):/^ *:-+: *$/.test(a)?i.align.push("center"):/^ *:-+ *$/.test(a)?i.align.push("left"):i.align.push(null);for(const a of s)i.header.push({text:a,tokens:this.lexer.inline(a)});for(const a of o)i.rows.push(em(a,i.header.length).map(c=>({text:c,tokens:this.lexer.inline(c)})));return i}}lheading(t){const n=this.rules.block.lheading.exec(t);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(t){const n=this.rules.block.paragraph.exec(t);if(n){const s=n[1].charAt(n[1].length-1)===`
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:s,tokens:this.lexer.inline(s)}}}text(t){const n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){const n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:On(n[1])}}tag(t){const n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&/^<a /i.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){const n=this.rules.inline.link.exec(t);if(n){const s=n[2].trim();if(!this.options.pedantic&&/^</.test(s)){if(!/>$/.test(s))return;const i=qa(s.slice(0,-1),"\\");if((s.length-i.length)%2===0)return}else{const i=$x(n[2],"()");if(i>-1){const c=(n[0].indexOf("!")===0?5:4)+n[1].length+i;n[2]=n[2].substring(0,i),n[0]=n[0].substring(0,c).trim(),n[3]=""}}let r=n[2],o="";if(this.options.pedantic){const i=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);i&&(r=i[1],o=i[3])}else o=n[3]?n[3].slice(1,-1):"";return r=r.trim(),/^</.test(r)&&(this.options.pedantic&&!/>$/.test(s)?r=r.slice(1):r=r.slice(1,-1)),tm(n,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer)}}reflink(t,n){let s;if((s=this.rules.inline.reflink.exec(t))||(s=this.rules.inline.nolink.exec(t))){const r=(s[2]||s[1]).replace(/\s+/g," "),o=n[r.toLowerCase()];if(!o){const i=s[0].charAt(0);return{type:"text",raw:i,text:i}}return tm(s,o,s[0],this.lexer)}}emStrong(t,n,s=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!r||r[3]&&s.match(/[\p{L}\p{N}]/u))return;if(!(r[1]||r[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const i=[...r[0]].length-1;let a,c,u=i,d=0;const f=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,n=n.slice(-1*t.length+i);(r=f.exec(n))!=null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(c=[...a].length,r[3]||r[4]){u+=c;continue}else if((r[5]||r[6])&&i%3&&!((i+c)%3)){d+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u+d);const h=[...r[0]][0].length,g=t.slice(0,i+r.index+h+c);if(Math.min(i,c)%2){const v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}const p=g.slice(2,-2);return{type:"strong",raw:g,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(t){const n=this.rules.inline.code.exec(t);if(n){let s=n[2].replace(/\n/g," ");const r=/[^ ]/.test(s),o=/^ /.test(s)&&/ $/.test(s);return r&&o&&(s=s.substring(1,s.length-1)),s=On(s,!0),{type:"codespan",raw:n[0],text:s}}}br(t){const n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t){const n=this.rules.inline.del.exec(t);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(t){const n=this.rules.inline.autolink.exec(t);if(n){let s,r;return n[2]==="@"?(s=On(n[1]),r="mailto:"+s):(s=On(n[1]),r=s),{type:"link",raw:n[0],text:s,href:r,tokens:[{type:"text",raw:s,text:s}]}}}url(t){var s;let n;if(n=this.rules.inline.url.exec(t)){let r,o;if(n[2]==="@")r=On(n[0]),o="mailto:"+r;else{let i;do i=n[0],n[0]=((s=this.rules.inline._backpedal.exec(n[0]))==null?void 0:s[0])??"";while(i!==n[0]);r=On(n[0]),n[1]==="www."?o="http://"+n[0]:o=n[0]}return{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){const n=this.rules.inline.text.exec(t);if(n){let s;return this.lexer.state.inRawBlock?s=n[0]:s=On(n[0]),{type:"text",raw:n[0],text:s}}}}const Tx=/^(?: *(?:\n|$))+/,Ex=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Ax=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ci=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ix=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,nm=/(?:[*+-]|\d{1,9}[.)])/,sm=xt(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,nm).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),_u=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Px=/^[^\n]+/,xu=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Mx=xt(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",xu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ox=xt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,nm).getRegex(),Ua="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",wu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Rx=xt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",wu).replace("tag",Ua).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),rm=xt(_u).replace("hr",ci).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ua).getRegex(),ku={blockquote:xt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",rm).getRegex(),code:Ex,def:Mx,fences:Ax,heading:Ix,hr:ci,html:Rx,lheading:sm,list:Ox,newline:Tx,paragraph:rm,table:li,text:Px},om=xt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ci).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ua).getRegex(),Lx={...ku,table:om,paragraph:xt(_u).replace("hr",ci).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",om).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ua).getRegex()},Dx={...ku,html:xt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",wu).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:li,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:xt(_u).replace("hr",ci).replace("heading",` *#{1,6} *[^
]`).replace("lheading",sm).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},im=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,jx=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,am=/^( {2,}|\\)\n(?!\s*$)/,Nx=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ui="\\p{P}\\p{S}",Fx=xt(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,ui).getRegex(),zx=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,qx=xt(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,ui).getRegex(),Bx=xt("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,ui).getRegex(),Ux=xt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,ui).getRegex(),Vx=xt(/\\([punct])/,"gu").replace(/punct/g,ui).getRegex(),Hx=xt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Wx=xt(wu).replace("(?:-->|$)","-->").getRegex(),Gx=xt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Wx).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Va=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Kx=xt(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Va).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),lm=xt(/^!?\[(label)\]\[(ref)\]/).replace("label",Va).replace("ref",xu).getRegex(),cm=xt(/^!?\[(ref)\](?:\[\])?/).replace("ref",xu).getRegex(),Qx=xt("reflink|nolink(?!\\()","g").replace("reflink",lm).replace("nolink",cm).getRegex(),Su={_backpedal:li,anyPunctuation:Vx,autolink:Hx,blockSkip:zx,br:am,code:jx,del:li,emStrongLDelim:qx,emStrongRDelimAst:Bx,emStrongRDelimUnd:Ux,escape:im,link:Kx,nolink:cm,punctuation:Fx,reflink:lm,reflinkSearch:Qx,tag:Gx,text:Nx,url:li},Jx={...Su,link:xt(/^!?\[(label)\]\((.*?)\)/).replace("label",Va).getRegex(),reflink:xt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Va).getRegex()},$u={...Su,escape:xt(im).replace("])","~|])").getRegex(),url:xt(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Xx={...$u,br:xt(am).replace("{2,}","*").getRegex(),text:xt($u.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ha={normal:ku,gfm:Lx,pedantic:Dx},di={normal:Su,gfm:$u,breaks:Xx,pedantic:Jx};class ps{constructor(t){Ct(this,"tokens");Ct(this,"options");Ct(this,"state");Ct(this,"tokenizer");Ct(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Sr,this.options.tokenizer=this.options.tokenizer||new Ba,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:Ha.normal,inline:di.normal};this.options.pedantic?(n.block=Ha.pedantic,n.inline=di.pedantic):this.options.gfm&&(n.block=Ha.gfm,this.options.breaks?n.inline=di.breaks:n.inline=di.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ha,inline:di}}static lex(t,n){return new ps(n).lex(t)}static lexInline(t,n){return new ps(n).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[]){this.options.pedantic?t=t.replace(/\t/g," ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(a,c,u)=>c+" ".repeat(u.length));let s,r,o,i;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(s=a.call({lexer:this},t,n))?(t=t.substring(s.raw.length),n.push(s),!0):!1))){if(s=this.tokenizer.space(t)){t=t.substring(s.raw.length),s.raw.length===1&&n.length>0?n[n.length-1].raw+=`
`:n.push(s);continue}if(s=this.tokenizer.code(t)){t=t.substring(s.raw.length),r=n[n.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+s.raw,r.text+=`
`+s.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text):n.push(s);continue}if(s=this.tokenizer.fences(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.heading(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.hr(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.blockquote(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.list(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.html(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.def(t)){t=t.substring(s.raw.length),r=n[n.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+s.raw,r.text+=`
`+s.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.lheading(t)){t=t.substring(s.raw.length),n.push(s);continue}if(o=t,this.options.extensions&&this.options.extensions.startBlock){let a=1/0;const c=t.slice(1);let u;this.options.extensions.startBlock.forEach(d=>{u=d.call({lexer:this},c),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(o=t.substring(0,a+1))}if(this.state.top&&(s=this.tokenizer.paragraph(o))){r=n[n.length-1],i&&r.type==="paragraph"?(r.raw+=`
`+s.raw,r.text+=`
`+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):n.push(s),i=o.length!==t.length,t=t.substring(s.raw.length);continue}if(s=this.tokenizer.text(t)){t=t.substring(s.raw.length),r=n[n.length-1],r&&r.type==="text"?(r.raw+=`
`+s.raw,r.text+=`
`+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):n.push(s);continue}if(t){const a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s,r,o,i=t,a,c,u;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)d.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)i=i.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,a.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(c||(u=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(d=>(s=d.call({lexer:this},t,n))?(t=t.substring(s.raw.length),n.push(s),!0):!1))){if(s=this.tokenizer.escape(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.tag(t)){t=t.substring(s.raw.length),r=n[n.length-1],r&&s.type==="text"&&r.type==="text"?(r.raw+=s.raw,r.text+=s.text):n.push(s);continue}if(s=this.tokenizer.link(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(s.raw.length),r=n[n.length-1],r&&s.type==="text"&&r.type==="text"?(r.raw+=s.raw,r.text+=s.text):n.push(s);continue}if(s=this.tokenizer.emStrong(t,i,u)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.codespan(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.br(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.del(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.autolink(t)){t=t.substring(s.raw.length),n.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(t))){t=t.substring(s.raw.length),n.push(s);continue}if(o=t,this.options.extensions&&this.options.extensions.startInline){let d=1/0;const f=t.slice(1);let h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},f),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(o=t.substring(0,d+1))}if(s=this.tokenizer.inlineText(o)){t=t.substring(s.raw.length),s.raw.slice(-1)!=="_"&&(u=s.raw.slice(-1)),c=!0,r=n[n.length-1],r&&r.type==="text"?(r.raw+=s.raw,r.text+=s.text):n.push(s);continue}if(t){const d="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return n}}class Wa{constructor(t){Ct(this,"options");this.options=t||Sr}code(t,n,s){var o;const r=(o=(n||"").match(/^\S*/))==null?void 0:o[0];return t=t.replace(/\n$/,"")+`
`,r?'<pre><code class="language-'+On(r)+'">'+(s?t:On(t,!0))+`</code></pre>
`:"<pre><code>"+(s?t:On(t,!0))+`</code></pre>
`}blockquote(t){return`<blockquote>
${t}</blockquote>
`}html(t,n){return t}heading(t,n,s){return`<h${n}>${t}</h${n}>
`}hr(){return`<hr>
`}list(t,n,s){const r=n?"ol":"ul",o=n&&s!==1?' start="'+s+'"':"";return"<"+r+o+`>
`+t+"</"+r+`>
`}listitem(t,n,s){return`<li>${t}</li>
`}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(t){return`<p>${t}</p>
`}table(t,n){return n&&(n=`<tbody>${n}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+n+`</table>
`}tablerow(t){return`<tr>
${t}</tr>
`}tablecell(t,n){const s=n.header?"th":"td";return(n.align?`<${s} align="${n.align}">`:`<${s}>`)+t+`</${s}>
`}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return"<br>"}del(t){return`<del>${t}</del>`}link(t,n,s){const r=Yp(t);if(r===null)return s;t=r;let o='<a href="'+t+'"';return n&&(o+=' title="'+n+'"'),o+=">"+s+"</a>",o}image(t,n,s){const r=Yp(t);if(r===null)return s;t=r;let o=`<img src="${t}" alt="${s}"`;return n&&(o+=` title="${n}"`),o+=">",o}text(t){return t}}class Cu{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,n,s){return""+s}image(t,n,s){return""+s}br(){return""}}class ms{constructor(t){Ct(this,"options");Ct(this,"renderer");Ct(this,"textRenderer");this.options=t||Sr,this.options.renderer=this.options.renderer||new Wa,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Cu}static parse(t,n){return new ms(n).parse(t)}static parseInline(t,n){return new ms(n).parseInline(t)}parse(t,n=!0){let s="";for(let r=0;r<t.length;r++){const o=t[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const i=o,a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(i.type)){s+=a||"";continue}}switch(o.type){case"space":continue;case"hr":{s+=this.renderer.hr();continue}case"heading":{const i=o;s+=this.renderer.heading(this.parseInline(i.tokens),i.depth,kx(this.parseInline(i.tokens,this.textRenderer)));continue}case"code":{const i=o;s+=this.renderer.code(i.text,i.lang,!!i.escaped);continue}case"table":{const i=o;let a="",c="";for(let d=0;d<i.header.length;d++)c+=this.renderer.tablecell(this.parseInline(i.header[d].tokens),{header:!0,align:i.align[d]});a+=this.renderer.tablerow(c);let u="";for(let d=0;d<i.rows.length;d++){const f=i.rows[d];c="";for(let h=0;h<f.length;h++)c+=this.renderer.tablecell(this.parseInline(f[h].tokens),{header:!1,align:i.align[h]});u+=this.renderer.tablerow(c)}s+=this.renderer.table(a,u);continue}case"blockquote":{const i=o,a=this.parse(i.tokens);s+=this.renderer.blockquote(a);continue}case"list":{const i=o,a=i.ordered,c=i.start,u=i.loose;let d="";for(let f=0;f<i.items.length;f++){const h=i.items[f],g=h.checked,p=h.task;let v="";if(h.task){const _=this.renderer.checkbox(!!g);u?h.tokens.length>0&&h.tokens[0].type==="paragraph"?(h.tokens[0].text=_+" "+h.tokens[0].text,h.tokens[0].tokens&&h.tokens[0].tokens.length>0&&h.tokens[0].tokens[0].type==="text"&&(h.tokens[0].tokens[0].text=_+" "+h.tokens[0].tokens[0].text)):h.tokens.unshift({type:"text",text:_+" "}):v+=_+" "}v+=this.parse(h.tokens,u),d+=this.renderer.listitem(v,p,!!g)}s+=this.renderer.list(d,a,c);continue}case"html":{const i=o;s+=this.renderer.html(i.text,i.block);continue}case"paragraph":{const i=o;s+=this.renderer.paragraph(this.parseInline(i.tokens));continue}case"text":{let i=o,a=i.tokens?this.parseInline(i.tokens):i.text;for(;r+1<t.length&&t[r+1].type==="text";)i=t[++r],a+=`
`+(i.tokens?this.parseInline(i.tokens):i.text);s+=n?this.renderer.paragraph(a):a;continue}default:{const i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return s}parseInline(t,n){n=n||this.renderer;let s="";for(let r=0;r<t.length;r++){const o=t[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const i=this.options.extensions.renderers[o.type].call({parser:this},o);if(i!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){s+=i||"";continue}}switch(o.type){case"escape":{const i=o;s+=n.text(i.text);break}case"html":{const i=o;s+=n.html(i.text);break}case"link":{const i=o;s+=n.link(i.href,i.title,this.parseInline(i.tokens,n));break}case"image":{const i=o;s+=n.image(i.href,i.title,i.text);break}case"strong":{const i=o;s+=n.strong(this.parseInline(i.tokens,n));break}case"em":{const i=o;s+=n.em(this.parseInline(i.tokens,n));break}case"codespan":{const i=o;s+=n.codespan(i.text);break}case"br":{s+=n.br();break}case"del":{const i=o;s+=n.del(this.parseInline(i.tokens,n));break}case"text":{const i=o;s+=n.text(i.text);break}default:{const i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return s}}class fi{constructor(t){Ct(this,"options");this.options=t||Sr}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}}Ct(fi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Zx{constructor(...t){Yv(this,Rr);Ct(this,"defaults",bu());Ct(this,"options",this.setOptions);Ct(this,"parse",hc(this,Rr,Ld).call(this,ps.lex,ms.parse));Ct(this,"parseInline",hc(this,Rr,Ld).call(this,ps.lexInline,ms.parseInline));Ct(this,"Parser",ms);Ct(this,"Renderer",Wa);Ct(this,"TextRenderer",Cu);Ct(this,"Lexer",ps);Ct(this,"Tokenizer",Ba);Ct(this,"Hooks",fi);this.use(...t)}walkTokens(t,n){var r,o;let s=[];for(const i of t)switch(s=s.concat(n.call(this,i)),i.type){case"table":{const a=i;for(const c of a.header)s=s.concat(this.walkTokens(c.tokens,n));for(const c of a.rows)for(const u of c)s=s.concat(this.walkTokens(u.tokens,n));break}case"list":{const a=i;s=s.concat(this.walkTokens(a.items,n));break}default:{const a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(c=>{const u=a[c].flat(1/0);s=s.concat(this.walkTokens(u,n))}):a.tokens&&(s=s.concat(this.walkTokens(a.tokens,n)))}}return s}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(s=>{const r={...s};if(r.async=this.defaults.async||r.async||!1,s.extensions&&(s.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const i=n.renderers[o.name];i?n.renderers[o.name]=function(...a){let c=o.renderer.apply(this,a);return c===!1&&(c=i.apply(this,a)),c}:n.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=n[o.level];i?i.unshift(o.tokenizer):n[o.level]=[o.tokenizer],o.start&&(o.level==="block"?n.startBlock?n.startBlock.push(o.start):n.startBlock=[o.start]:o.level==="inline"&&(n.startInline?n.startInline.push(o.start):n.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(n.childTokens[o.name]=o.childTokens)}),r.extensions=n),s.renderer){const o=this.defaults.renderer||new Wa(this.defaults);for(const i in s.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(i==="options")continue;const a=i,c=s.renderer[a],u=o[a];o[a]=(...d)=>{let f=c.apply(o,d);return f===!1&&(f=u.apply(o,d)),f||""}}r.renderer=o}if(s.tokenizer){const o=this.defaults.tokenizer||new Ba(this.defaults);for(const i in s.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const a=i,c=s.tokenizer[a],u=o[a];o[a]=(...d)=>{let f=c.apply(o,d);return f===!1&&(f=u.apply(o,d)),f}}r.tokenizer=o}if(s.hooks){const o=this.defaults.hooks||new fi;for(const i in s.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(i==="options")continue;const a=i,c=s.hooks[a],u=o[a];fi.passThroughHooks.has(i)?o[a]=d=>{if(this.defaults.async)return Promise.resolve(c.call(o,d)).then(h=>u.call(o,h));const f=c.call(o,d);return u.call(o,f)}:o[a]=(...d)=>{let f=c.apply(o,d);return f===!1&&(f=u.apply(o,d)),f}}r.hooks=o}if(s.walkTokens){const o=this.defaults.walkTokens,i=s.walkTokens;r.walkTokens=function(a){let c=[];return c.push(i.call(this,a)),o&&(c=c.concat(o.call(this,a))),c}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return ps.lex(t,n??this.defaults)}parser(t,n){return ms.parse(t,n??this.defaults)}}Rr=new WeakSet,Ld=function(t,n){return(s,r)=>{const o={...r},i={...this.defaults,...o};this.defaults.async===!0&&o.async===!1&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const a=hc(this,Rr,t0).call(this,!!i.silent,!!i.async);if(typeof s>"u"||s===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(s):s).then(c=>t(c,i)).then(c=>i.hooks?i.hooks.processAllTokens(c):c).then(c=>i.walkTokens?Promise.all(this.walkTokens(c,i.walkTokens)).then(()=>c):c).then(c=>n(c,i)).then(c=>i.hooks?i.hooks.postprocess(c):c).catch(a);try{i.hooks&&(s=i.hooks.preprocess(s));let c=t(s,i);i.hooks&&(c=i.hooks.processAllTokens(c)),i.walkTokens&&this.walkTokens(c,i.walkTokens);let u=n(c,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(c){return a(c)}}},t0=function(t,n){return s=>{if(s.message+=`
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+On(s.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(s);throw s}};const $r=new Zx;function mt(e,t){return $r.parse(e,t)}mt.options=mt.setOptions=function(e){return $r.setOptions(e),mt.defaults=$r.defaults,Qp(mt.defaults),mt},mt.getDefaults=bu,mt.defaults=Sr,mt.use=function(...e){return $r.use(...e),mt.defaults=$r.defaults,Qp(mt.defaults),mt},mt.walkTokens=function(e,t){return $r.walkTokens(e,t)},mt.parseInline=$r.parseInline,mt.Parser=ms,mt.parser=ms.parse,mt.Renderer=Wa,mt.TextRenderer=Cu,mt.Lexer=ps,mt.lexer=ps.lex,mt.Tokenizer=Ba,mt.Hooks=fi,mt.parse=mt,mt.options,mt.setOptions,mt.use,mt.walkTokens,mt.parseInline,ms.parse,ps.lex;const Yx=e=>{let t=e.replace(/\r\n/g,`
`).replace(/\r/g,`
`);const n=/\\{1,2}\[\s*([\s\S]*?)\s*\\{1,2}\]/g;t=t.replace(n,(r,o)=>`<div class="math-block"><code>${o.trim().replace(/\n\s*/g," ").replace(/\s+/g," ")}</code></div>`);const s=/\\{1,2}\(\s*(.*?)\s*\\{1,2}\)/g;return t=t.replace(s,(r,o)=>`<code class="math-inline">${o.trim()}</code>`),t},ew=e=>{const t=e.trim();return/^\d+\.$/.test(t)};mt.setOptions({gfm:!0,breaks:!0,sanitize:!1});const Ga=(e,{separate:t=!0}={})=>{if(typeof e=="string"){const n=e.trim();if(ew(n))return[`<p>${n}</p>`];if(Vp(e))return[`<p class="js-blocked-content">${Wp(e)}</p>`];try{let s=Yx(e);s=s.replace(/\[([^\]]*\|[^\]]*)\]/g,(c,u)=>`[${u.replace(/\|/g,"/")}]`);const r=mt(s),o=fx(r);if(!t)return[o];const i=/\n<p>/gi,a=o.split(i).filter(c=>c.trim().length>0).map((c,u)=>u!==0&&!c.startsWith("<p>")?`<p>${c.trim()}`:c);return a.length===2&&a[0].includes("<h")?[a[0]+`
`+a[1]]:a}catch(s){return console.error("Error processing markdown:",s),[`<p class="processing-error">${Wp(e)}</p>`]}}return[]};async function Cr(e){const t=async()=>new Promise((n,s)=>{const r=new Image;r.onload=()=>{n({status:!0,message:"Hình ảnh hợp lệ",width:r.width,height:r.height})},r.onerror=()=>{s({status:!1,message:"URL hình ảnh không hợp lệ hoặc không thể tải được"})},r.src=e});try{return await t(e)}catch{return{status:!1,message:"URL hình ảnh không hợp lệ hoặc không thể tải được"}}}const io=e=>typeof e=="function",Ka=e=>{try{return JSON.parse(e),typeof e=="string"}catch{return!1}};function um(e,t={}){const{title:n="",logo:s="",brand:r=""}=t;if(!e)return null;const o=JSON.parse(JSON.stringify(e)),i=a=>a.includes("{logo}")?(a=a.split("{logo}"),a=a.map(c=>c===""?`<img src='${s}'/>`:`<span>${c}</span>`),a.join("").replace(/{title}/g,n).replace(/{brand}/g,r).replace(/{category}/g,n).replace(/{product}/g,n)):a.replace(/{title}/g,n).replace(/{brand}/g,r).replace(/{category}/g,n).replace(/{product}/g,n);return o.product&&(o.product=o.product.map(a=>({...a,name:i(a.name),message:i(a.message)}))),o.category&&(o.category=o.category.map(a=>({...a,name:i(a.name),message:i(a.message)}))),o}function Ts(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function hi(e,t=!1){const n=history.pushState,s=history.replaceState,r=()=>{document.readyState==="complete"?e(window.location.href):window.addEventListener("load",()=>e(window.location.href),{once:!0})};history.pushState=function(){n.apply(this,arguments),r()},history.replaceState=function(){s.apply(this,arguments),r()},window.addEventListener("popstate",r),t&&r()}function Qa(e){const t=new URL(e),n={};for(const[s,r]of t.searchParams)n[s]=r;return n}function tw(e,t){try{const n=new URL(e);return Object.entries(t).forEach(([s,r])=>{r!=null&&(n.searchParams.has(s)||n.searchParams.append(s,r))}),n.toString()}catch(n){return console.error("Invalid URL:",n),e}}const dm=(e,t="vi-VN")=>new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0,useGrouping:!0}).format(e),Tu=e=>e!==null&&typeof e=="object";function vn(e){if(typeof e=="string")try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null)return t}catch{return e}return e}function Ja(e){const t=new Date;t.setDate(t.getDate()+e);const n=s=>String(s).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}const fm=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),hm=(e,t="",n=null)=>{if(n||(n=document.getElementById("easychatgpt-widget")),!n){console.warn("⚠️ applyAllStyles: Root element not found");return}Object.keys(e).forEach(s=>{const r=e[s],o=`--${t}${fm(s)}`;typeof r=="object"&&!Array.isArray(r)&&r!==null?hm(r,`${t}${fm(s)}-`,n):n.style.setProperty(o,r)})},pm=(e,t)=>(Object.keys(t).forEach(n=>{const s=e[n],r=t[n];typeof s=="object"&&s&&typeof r=="object"&&r&&!Array.isArray(s)&&!Array.isArray(r)?e[n]=pm({...s},r):e[n]=r}),e);function pi(e){return e===null||typeof e!="object"?e:JSON.parse(JSON.stringify(e))}function ao({title:e,image:t,source:n,isImageValid:s,cartUrl:r="/cart",hideCheckout:o=!1}){const i=o?"":`<a class="checkout-link" href="${window.location.origin+r}"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" size="18" class="lucide lucide-shopping-bag-icon mr-1"><path d="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z"></path><path d="M3 6h18"></path><path d="M16 10a4 4 0 0 1-8 0"></path></svg>Thanh toán ngay</a>`;return`<div class="ecg-cart-success"><a class="product-image" href="${n}"><img src="${t}" alt="${e}" class="${s?"thumbnail":"thumbnail error"}" /></a><div><div class="notify-success"><div>Đã thêm vào giỏ hàng</div></div><a class="product-title" href="${n}">${e}</a>${i}</div></div>`}function nw(e=[],t){const n=pi(e);return n.sort((s,r)=>s.sender_type===t&&r.sender_type===t?(parseInt(s.id)||0)-(parseInt(r.id)||0):0),n}function gs(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.sender_type==="assistant"){let s=t+1;if(s<e.length){const r=e[s];r.sender_type==="user"?n.is_last_assistant_message=!0:r.sender_type==="assistant"&&(r.content_type==="cards"||r.content_type==="product_cards"?(n.is_last_assistant_message=!0,r.is_last_assistant_message=!0):n.is_last_assistant_message=!1)}else n.is_last_assistant_message=!0}}return e}function mi(e){if(!e||e.length===0)return[];const t=r=>/^[-*•]\s/.test(r.trim()),n=[];let s=0;for(;s<e.length;)if(t(e[s])){let r=[e[s]];for(s++;s<e.length&&t(e[s]);)r.push(e[s]),s++;n.push(r.join(`
`))}else{let r=[e[s]];if(s++,s<e.length&&t(e[s]))for(;s<e.length&&t(e[s]);)r.push(e[s]),s++;n.push(r.join(`
`))}return n}function sw({name:e,phone:t,email:n,address:s,items:r,shopName:o}){const i=(r||[]).map(c=>{const u=c.source;let d="";if(u){const g=u.includes("?")?"&":"?";d=`${u}${g}utm_source=easyai`}const f=c.price?et(c.price,{currency:c.currency}):"",h=[f?`Giá: ${f}`:"",`Số lượng: ${c.quantity||1}`].filter(Boolean).join(" - ");return`<div class="eai-order-item">${c.image?`<div class="eai-order-item-img"><img src="${c.image}" alt="${c.title}" /></div>`:""}<div class="eai-order-item-info"><div class="eai-order-item-name">${d?`<a href="${d}" target="_blank">${c.title}</a>`:c.title}</div><div class="eai-order-item-meta">${h}</div></div></div>`}).join(""),a=[];return e&&a.push(`<div><span>Họ tên:</span> <strong>${e}</strong></div>`),t&&a.push(`<div><span>SĐT:</span> <strong>${t}</strong></div>`),n&&a.push(`<div><span>Email:</span> <strong class="eai-order-email">${n}</strong></div>`),s&&a.push(`<div><span>Địa chỉ:</span> <strong class="eai-order-address">${s}</strong></div>`),`<div class="eai-order-summary"><div class="eai-order-summary-inner"><h3 class="eai-order-title">🎉 Đặt hàng thành công!</h3><p class="eai-order-desc">Đơn hàng của bạn đang được hệ thống xử lý và sẽ sớm có nhân viên liên hệ xác nhận.</p><div class="eai-order-section"><div class="eai-order-section-title">Thông tin đặt hàng</div><div class="eai-order-info">${a.join("")}</div></div><div class="eai-order-section"><div class="eai-order-section-title">Đơn hàng</div><div class="eai-order-list">${i}</div></div></div></div>`}const rw="https://console.easyaichat.app",ow=async(e,t={})=>{try{const n=t.apiHost||rw,s=!!t.preview,r=t.workspaceUuid||null,o=window.location.host,i={preview:s,domain:o};e?i.handle=e:r&&(i.workspaceUuid=r);const{data:a}=await St.get(`${n}/api/workspaces/widget`,{params:i,headers:{"X-Easy-Ai-User-Id":Ks()}});!e&&(a!=null&&a.handle)&&(e=a.handle);const c=a.config,u=pm(c,t);return hm(u.ui,"ui-"),a.config=u,a}catch(n){console.error(n)}},B=dt({bot:null,handle:null,conversationId:null,apiDomain:"https://console.easyaichat.app",appDomain:"https://widget.geteasy.ai",forms:{},isOpenForm:!1,isSuccessForm:!1,totalFormItems:0,selectedForm:null,localStorageFormOrder:null,isOpenFormContact:!1,isSuccessFormContact:!1,cart:null,user:null,token:null});Pe(()=>B.selectedForm,e=>{var t;if(((t=e==null?void 0:e.items)==null?void 0:t.length)>0){let n=0;e.items.forEach(s=>{n=n+Number(s.quantity)}),B.totalFormItems=n}else B.totalFormItems=0},{immediate:!0}),Pe(()=>B.handle,()=>{const e=JSON.parse(localStorage.getItem("easychatgpt_conversations"))||{};Object.values(e).length>0&&(B.conversationId=Object.values(e)[0])});const mm={vi:{chat:{placeholder:"Nhập tin nhắn...",typing:"Đang soạn tin nhắn...",typingWithAgent:"{name} đang soạn tin nhắn...",scrollToBottom:"Cuộn xuống cuối",quickPrompts:"Gợi ý nhanh",quickReplyPlaceholder:"Viết tin nhắn...",quickReplyDefault:"Bạn cần hỗ trợ nhanh? 💬 Gõ ngay câu hỏi vào đây nhé!",quickReplyCta:"Tư vấn ngay",reply_to_message:"Trả lời",replying_to:"Đang trả lời",cancel_reply:"Hủy trả lời",original_message_unavailable:"Tin nhắn gốc không còn khả dụng",reply_context:{you_replied_to_yourself:"Bạn đã trả lời chính mình",you_replied_to:"Bạn đã phản hồi",replied_to_themselves:"đã phản hồi chính mình",replied_to_you:"đã phản hồi bạn"},quote_media:{image:"Hình ảnh",gif:"GIF",video:"Video",audio:"Âm thanh",file:"Tệp",sticker:"Sticker",attachment:"Tệp"}},menu:{home:"Trang chủ",messages:"Nhắn tin",help:"Trợ giúp",orders:"Đơn hàng"},help:{title:"Trợ giúp",faq:"Câu hỏi thường gặp",documents:"Tài liệu hữu ích"},survey:{rate:"Đánh giá",closeRate:"Đóng đánh giá"},common:{back:"Quay lại",close:"Đóng",send:"Gửi",sent:"Đã gửi",received:"Đã nhận"},home:{sendMessage:"Gửi tin nhắn",quickLinks:"Liên kết nhanh",defaultWelcome:"👋 Xin chào! Em có thể giúp gì cho anh/chị?",newMessage:"Tin nhắn mới"},form:{placeholder:"Nhập ...",submitting:"Đang gửi...",submitRequest:"Gửi yêu cầu",validation:{required:"{label} là bắt buộc",email:"{label} không hợp lệ",phone:"{label} không hợp lệ",min:"{label} phải có ít nhất {value} ký tự",max:"{label} không được vượt quá {value} ký tự"}}},en:{chat:{placeholder:"Type a message...",typing:"Typing...",typingWithAgent:"{name} is typing...",scrollToBottom:"Scroll to bottom",quickPrompts:"Quick prompts",quickReplyPlaceholder:"Write a message...",quickReplyDefault:"Need quick help? 💬 Type your question here!",quickReplyCta:"Get advice now",reply_to_message:"Reply",replying_to:"Replying to",cancel_reply:"Cancel reply",original_message_unavailable:"Original message is no longer available",reply_context:{you_replied_to_yourself:"You replied to yourself",you_replied_to:"You replied to",replied_to_themselves:"replied to themselves",replied_to_you:"replied to you"},quote_media:{image:"Image",gif:"GIF",video:"Video",audio:"Audio",file:"File",sticker:"Sticker",attachment:"File"}},menu:{home:"Home",messages:"Messages",help:"Help",orders:"Orders"},help:{title:"Help",faq:"Frequently asked questions",documents:"Useful documents"},survey:{rate:"Rate",closeRate:"Close rating"},common:{back:"Back",close:"Close",send:"Send",sent:"Sent",received:"Received"},home:{sendMessage:"Send message",quickLinks:"Quick links",defaultWelcome:"👋 Hello! How can I help you?",newMessage:"New message"},form:{placeholder:"Enter ...",submitting:"Sending...",submitRequest:"Submit request",validation:{required:"{label} is required",email:"Invalid {label}",phone:"Invalid {label}",min:"{label} must be at least {value} characters",max:"{label} must not exceed {value} characters"}}}},gm="vi";function vm(e){return e==="en"?"en":gm}function iw(e,t){return t.split(".").reduce((n,s)=>n==null?void 0:n[s],e)}function aw(e,t={}){return!t||typeof e!="string"?e:e.replace(/\{(\w+)\}/g,(n,s)=>t[s]!==void 0?String(t[s]):`{${s}}`)}function ym(e){const t=vm(e),n=mm[t]||mm[gm];return function(r,o){const i=iw(n,r);return typeof i!="string"?r:aw(i,o)}}const bm=dt({locale:"vi"});let _m=ym("vi");const gi={state:bm,actions:{setLocale(e){const t=vm(e);bm.locale=t,_m=ym(t)},t(e,t){return _m(e,t)}},getters:{}},lw=["home","conversations","helps","order_tracking"],Je=dt({bot:null,handle:null,groupConversationId:null,isOpenLeadForm:!1,dropdownLockCount:0,chatContainerRef:null,rootMarketplaceRef:null,chatState:{isOpen:!1,visitor:null,viewTab:"conversations",unreadMessageCount:0,lastAssistantMessageId:null,lastUnreadMessage:null,assistantProcessing:!1,shouldOpenChatScreen:!1},isCheckInit:!1,isSurveyHidden:!1}),cw={lockDropdown(){Je.dropdownLockCount++},unlockDropdown(){Je.dropdownLockCount=Math.max(0,Je.dropdownLockCount-1)},showNotification(e,t={}){Je.interactionState.activeNotification=e,Je.interactionState.payload=t},hideNotification(){Je.interactionState.activeNotification=null,Je.interactionState.payload=null},setBot(e){var t;Je.bot=e,this.setHandle(e.handle),gi.actions.setLocale((t=e==null?void 0:e.config)==null?void 0:t.language),B.bot=e,B.handle=e.handle},setHandle(e){Je.handle=e},setGroupConversationId(e){Je.groupConversationId=e||null},incrementUnreadMessageCount(){Je.chatState.unreadMessageCount+=1,this.saveChatState()},resetUnreadMessageCount(){Je.chatState.unreadMessageCount=0,Je.chatState.lastUnreadMessage=null,this.saveChatState()},resetChatState(){Je.chatState.unreadMessageCount=0,Je.chatState.lastUnreadMessage=null,Je.chatState.lastAssistantMessageId=null,this.saveChatState()},updateLastUnreadMessage(e){if(Je.chatState.unreadMessageCount===0){Je.chatState.lastUnreadMessage=null,this.saveChatState();return}if(!e||!Array.isArray(e)||e.length===0)return;const t=e.filter(s=>s.sender_type==="assistant"&&!s.is_welcome_message);if(t.length===0)return;const n=t[t.length-1];Je.chatState.lastUnreadMessage={id:n.id,content_type:n.content_type,content:n.content,created_at:n.created_at},this.saveChatState()},setLastAssistantMessageId(e){e<10||(Je.chatState.lastAssistantMessageId=e,this.saveChatState())},updateLastAssistantMessageIdFromMessages(e){if(e&&e.length>0){const t=[...e].reverse().find(n=>n.sender_type==="assistant");t&&t.id&&(Je.chatState.lastAssistantMessageId=t.id,this.saveChatState())}},handleMetricSubmit(e){try{const{handle:t,submission_id:n,source:s}=e.detail;t&&n&&window.rybbit.event("chatbot_widget_contact",{handle:t,submission_id:n,source:s})}catch(t){console.error("Error handling metric submit:",t)}},handleDispatchEvent(){window.addEventListener("metric-submit",this.handleMetricSubmit)},handleEventMessage(){window.addEventListener("message",e=>{var t;try{const n=e.data;if(!n||typeof n!="object")return;n.type==="submit-metric"&&n.submission_id&&(console.log("handleEventMessage submit-metric 01",n,window.rybbit),(t=window.rybbit)==null||t.event("chatbot_widget_contact",{handle:Je.handle,submission_id:n.submission_id,source:n.source??"chatbot"}))}catch(n){console.error("Error handling message event:",n)}}),this.handleDispatchEvent()},async loadScriptTracking(){var i,a,c,u;const e=(a=(i=Je.bot)==null?void 0:i.config)==null?void 0:a.metric_domains,t=window.location.hostname.replace(/^www\./,""),n=(e==null?void 0:e[t])||((u=(c=Je.bot)==null?void 0:c.config)==null?void 0:u.easy_ai_metric_site_id);if(!n||document.querySelector(`script[data-site-id="${n}"]`))return;const r=document.createElement("script");r.src="https://metric.geteasy.ai/api/script.js",r.setAttribute("data-site-id",n),r.defer=!0,document.head.appendChild(r);async function o(){try{const{initMetricWebsiteFactory:d}=await Promise.resolve().then(()=>NP);window.rybbit&&(Ks(),v_(),await d())}catch(d){console.error("Failed to load metrics:",d)}}r.onload=d=>{setTimeout(()=>{o()},2e3)}},setSurveyHidden(){Je.isSurveyHidden=!0,typeof localStorage<"u"&&localStorage.setItem(`survey_hidden_${Je.handle}`,"true")},checkSurveyHidden(){typeof localStorage<"u"&&(Je.isSurveyHidden=localStorage.getItem(`survey_hidden_${Je.handle}`)==="true")},checkChatStateInit(){const t=localStorage.getItem("eac_chat_state");if(t)try{const n=JSON.parse(t);Je.chatState={isOpen:Ts()?!1:n.isOpen||!1,visitor:n.visitor||null,viewTab:n.viewTab||"conversations",unreadMessageCount:n.unreadMessageCount||0,lastAssistantMessageId:n.lastAssistantMessageId||null,lastUnreadMessage:n.lastUnreadMessage||null,assistantProcessing:n.assistantProcessing||!1}}catch(n){console.error("Error parsing chat state from localStorage:",n),this.saveChatState()}else this.saveChatState();Je.isCheckInit=!0,this.checkSurveyHidden()},saveChatState(){if(!Je.isCheckInit)return;const e="eac_chat_state",t={...Je.chatState};Ts()&&(t.isOpen=!1),localStorage.setItem(e,JSON.stringify(t))},updateChatState(e){var t,n;Je.isCheckInit&&(Je.chatState={...Je.chatState,...e},lw.includes(Je.chatState.viewTab)||(Je.chatState.viewTab="conversations"),Je.chatState.isOpen&&Je.chatState.unreadMessageCount>0&&(!((n=(t=Je.bot)==null?void 0:t.config)!=null&&n.page&&Object.values(Je.bot.config.page).some(o=>o&&o.enabled===!0))||Je.chatState.viewTab==="conversations")&&(Je.chatState.unreadMessageCount=0,Je.chatState.lastUnreadMessage=null),Je.chatState.shouldOpenChatScreen&&(Je.chatState.shouldOpenChatScreen=!1),this.saveChatState())},async fetchBotInit(e,t={},n={}){const s=n.workspaceUuid||null;if(!e&&!s)return console.warn("Missing data: handle or workspaceUuid is required"),null;e&&this.setHandle(e);try{const r=await ow(e,{...t,workspaceUuid:s,...n});return r?(this.setBot(r),n.website&&![qn,Bn].includes(r.handle)&&this.loadScriptTracking(),this.checkChatStateInit(),r):void 0}catch(r){return console.error("Error fetch bot in store = ",r),null}}},uw={handle:ee(()=>{var e;return(e=Je.bot)==null?void 0:e.handle}),isAgentEnabled:ee(()=>{var e;return((e=Je.bot)==null?void 0:e.agent_enabled)===!0})},ae={state:Je,actions:cw,getters:uw},dw=dt({user:null,token:null});Ur(dw);const xm=dt({selectedProduct:null,isOpenPanelVariants:!1}),wm={actions:{toggleOpenPanelVariants(e){xm.isOpenPanelVariants=e},setSelectedProduct(e){xm.selectedProduct=e}}},Rn=dt({message:null,type:null}),mn={state:Rn,actions:{success({message:e,duration:t=3e3}){Rn.message=e,Rn.type="success",setTimeout(()=>{Rn.message=null,Rn.type=null},t)},error({message:e,duration:t=3e3}){Rn.message=e,Rn.type="error",setTimeout(()=>{Rn.message=null,Rn.type=null},t)},warning({message:e,duration:t=3e3}){Rn.message=e,Rn.type="warning",setTimeout(()=>{Rn.message=null,Rn.type=null},t)}},getters:{}},Eu="https://widget.geteasy.ai",Xa={ai_product_insight:()=>Promise.resolve().then(()=>BR),ai_summary_page_content:()=>Promise.resolve().then(()=>YR),ai_ask:()=>Promise.resolve().then(()=>rv),eac_image_gallery:()=>Promise.resolve().then(()=>_L),rcm_product_flash_sale:()=>Promise.resolve().then(()=>mD),rcm_product_recommendation:()=>Promise.resolve().then(()=>PD),rcm_flash_sale_register:()=>Promise.resolve().then(()=>hj),rcm_combo:()=>Promise.resolve().then(()=>lN),rcm_combo_horizontal:()=>Promise.resolve().then(()=>TF),rcm_customer_list_modal:()=>Promise.resolve().then(()=>NF)};function fw(e){return e?typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${n}`).join("; "):""}function vi(e,t,n={}){const s=document.querySelector(e);if(!s)return console.error(`Widget: Target element not found: ${e}`),null;if(!(t!=null&&t.type)||!Xa[t.type])return console.error(`Widget: Invalid widget type: ${t.type}`),null;const r={shadowMode:"open",position:"top",props:{},...n},o=`eac-widget-${t.type.toLowerCase().replace(/_/g,"-")}`;if(document.getElementById(o))return null;if((r.position==="before"||r.position==="after")&&!s.parentNode)return console.error(`Widget: Cannot insert ${r.position} target element - no parent node found`),null;const i=document.createElement("div");switch(i.id=o,i.style.cssText=`background: transparent; ${fw(n.style)}`,r.position){case"top":s.firstChild?s.insertBefore(i,s.firstChild):s.appendChild(i);break;case"bottom":s.appendChild(i);break;case"before":s.parentNode.insertBefore(i,s);break;case"after":s.nextSibling?s.parentNode.insertBefore(i,s.nextSibling):s.parentNode.appendChild(i);break;default:s.appendChild(i)}const a=i.attachShadow({mode:r.shadowMode}),c=document.createElement("div");c.className="eac-widget-mount",a.appendChild(c);const u=Wt({loader:Xa[t.type],delay:0,timeout:5e3,onError:(v,_,k)=>{console.error("Widget: Failed to load component:",v),k()}}),d={widget:t,...r.props},f=Xr(u,d);let h=!1;const g=document.createElement("link");g.rel="stylesheet",g.href=`${Eu}/dist/widget/main.css`;const p=()=>{try{f.mount(c),h=!0}catch(v){console.error("Widget: Mount failed:",v)}};return g.onload=()=>{p()},g.onerror=()=>{p()},a.appendChild(g),{update(v,_={}){if(!h)return this;try{f.unmount();const k={widget:v,...r.props,..._},w=Xr(u,k);w.mount(c),this.app=w}catch(k){console.error("Widget: Update error:",k)}return this},remove(){try{h&&f.unmount(),i.remove()}catch(v){console.error("Widget: Remove error:",v)}}}}function hw(e,t=0,n=null){const s="eac-image-gallery",r=document.getElementById(s);r&&r.remove();const o=document.createElement("div");o.id=s,o.style.cssText=`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 99999999999;
background: transparent;
`,document.body.appendChild(o);const i=o.attachShadow({mode:"open"}),a=document.createElement("div");a.className="eac-gallery-mount",i.appendChild(a);const c=document.createElement("link");c.rel="stylesheet",c.href=`${Eu}/dist/widget/main.css`,i.appendChild(c);const u=Wt({loader:Xa.eac_image_gallery,delay:0,timeout:5e3,onError:g=>{console.error("ImageGallery: Failed to load component:",g)}}),d=()=>{n&&n();try{f.unmount()}catch(g){console.error("ImageGallery: Unmount failed:",g)}o.remove()},f=Xr(u,{media:e,initialIndex:t,onRemove:d}),h=()=>{try{f.mount(a)}catch(g){console.error("ImageGallery: Mount failed:",g)}};return c.onload=h,c.onerror=h,{remove:d}}function pw(e=[],t=null){const n="eac-customer-list-modal",s=document.getElementById(n);s&&s.remove();const r=document.createElement("div");r.id=n,r.style.cssText=`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 99999999999;
background: transparent;
`,document.body.appendChild(r);const o=r.attachShadow({mode:"open"}),i=document.createElement("div");i.className="eac-modal-mount",o.appendChild(i);const a=document.createElement("link");a.rel="stylesheet",a.href=`${Eu}/dist/widget/main.css`,o.appendChild(a);const c=Wt({loader:Xa.rcm_customer_list_modal,delay:0,timeout:5e3,onError:h=>{console.error("CustomerListModal: Failed to load component:",h)}}),u=()=>{t&&t();try{d.unmount()}catch(h){console.error("CustomerListModal: Unmount failed:",h)}r.remove()},d=Xr(c,{customers:e,onRemove:u}),f=()=>{try{d.mount(i)}catch(h){console.error("CustomerListModal: Mount failed:",h)}};return a.onload=f,a.onerror=f,{remove:u}}class km{constructor(t={}){Ct(this,"executeCallbacks",(t,n)=>{t!==n&&this.callbacks.forEach(s=>{try{document.readyState==="complete"?s(t,n):document.addEventListener("DOMContentLoaded",()=>s(t,n),{once:!0})}catch(r){console.error("[URLChangeListener] Callback error:",r)}})});Ct(this,"handleChange",(t=window.location.href)=>{const n=this.normalizeUrl(t),s=this.currentUrl;n!==s&&(this.currentUrl=n,this.executeCallbacks(n,s))});this.options={watchPath:!0,watchQuery:!1,ignoreParams:[],...t},this.callbacks=new Set,this.currentUrl=this.normalizeUrl(window.location.href),this.isActive=!1,this.originalPushState=null,this.originalReplaceState=null}normalizeUrl(t){try{const n=new URL(t,window.location.origin);let s="";if(this.options.watchPath&&(s+=n.pathname),this.options.watchQuery){const r=new URLSearchParams(n.search);this.options.ignoreParams.forEach(i=>r.delete(i));const o=r.toString();o&&(s+="?"+o)}return s}catch{return t}}start(){return this.isActive?this:(this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState,history.pushState=(...t)=>{this.originalPushState.apply(history,t),this.handleChange(t[2]?new URL(t[2],window.location.origin).href:window.location.href)},history.replaceState=(...t)=>{this.originalReplaceState.apply(history,t),this.handleChange(t[2]?new URL(t[2],window.location.origin).href:window.location.href)},window.addEventListener("popstate",this.handleChange),this.isActive=!0,this)}stop(){return this.isActive?(this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState),window.removeEventListener("popstate",this.handleChange),this.isActive=!1,this.originalPushState=null,this.originalReplaceState=null,this):this}on(t){if(typeof t!="function")throw new Error("Callback must be a function");return this.callbacks.add(t),this}off(t){return this.callbacks.delete(t),this}trigger(){return this.callbacks.forEach(t=>{try{t(this.currentUrl,null)}catch(n){console.error("[URLChangeListener] Trigger callback error:",n)}}),this}destroy(){return this.stop(),this.callbacks.clear(),this}get active(){return this.isActive}get current(){return this.currentUrl}get listenerCount(){return this.callbacks.size}}function Sm(e,t=!1){const n=new km({watchPath:!0,watchQuery:!1}).on(e).start();return t&&setTimeout(()=>e(n.current,null),0),n}function yi(e,t=!1){const n=new km({watchPath:!0,watchQuery:!0}).on(e).start();return t&&setTimeout(()=>e(n.current,null),1e3),n}const $m="https://widget.geteasy.ai",$t=dt({isInitialized:!1,isTestMode:!1,pageType:null,flash_sales:null,hot_sales:null,recently_viewed:null,also_bought:null,source_product:null,you_may_like:null,bought_together:null,signals:{viewing_now:0,views_7d:0,carts_today:0}}),Cm=e=>{if(!e)return e;try{const t=new URL(e);return`${t.origin}${t.pathname}`}catch{return e.split("?")[0]}},mw=e=>e&&`${Cm(e)}?utm_source=easyai`,gw="https://engine.geteasy.ai/api/recommendations",vw={"31c91fbc-38e2-4e84-868e-da29623b9505":e=>((e.properties??e).image??"").includes("media-new.laptop88.vn")},Au=e=>{const t=e.properties??e,n=e.signals??{};return{id:t.id,name:t.name,image:t.image,link:mw(t.url),sku:t.sku||null,price:Number(t.price)>0?et(Number(t.price)):"Liên hệ",originalPrice:Number(t.originalPrice)>0?et(Number(t.originalPrice)):null,discount:t.discount||null,sale_ends_at:n.sale_ends_at||null,stock_remaining:n.stock_remaining??null,stock_total:n.stock_total??null,viewing_now:n.viewing_now??0,sale_badge:n.sale_badge||null,ordered_count:n.ordered_count??0,ordered_by:n.ordered_by??[]}},yw=async(e,{include:t,itemUrl:n,userId:s})=>{const r=new URLSearchParams({include:t.join(","),workspace_uuid:e});n&&r.set("item_url",Cm(n)),s&&r.set("identified_user_id",s),t.includes("flash_sale")&&r.set("hide_sold_out","true");const o=await fetch(`${gw}?${r}`,{headers:{"X-API-Key":"test"}});if(!o.ok)throw new Error(`[EAI RCM] HTTP ${o.status}`);return o.json()},bw={"31c91fbc-38e2-4e84-868e-da29623b9505":{homepage:()=>window.location.pathname==="/"||!!document.querySelector(".home-page"),product:()=>!!document.querySelector(".product-detail"),cart:()=>/^\/cart/.test(window.location.pathname)||!!document.querySelector(".view-cart"),checkout:()=>/^\/checkout/.test(window.location.pathname)},"18193462-6eba-4fc1-8da9-536e1424ce51":{homepage:()=>window.location.pathname==="/"||window.location.pathname==="/chuyen-dung",product:()=>/^\/[a-z0-9-]+-p-\d+$/.test(window.location.pathname),category:()=>/^\/[a-z0-9-]+-c-\d+\/?$/.test(window.location.pathname),checkout:()=>/^\/don-hang\/?$/.test(window.location.pathname)},"74af8f88-1745-4f44-9726-e7082e53e321":{homepage:()=>window.location.pathname==="/"||window.location.pathname==="/chuyen-dung",product:()=>/^\/[a-z0-9-]+-p-\d+$/.test(window.location.pathname),category:()=>/^\/[a-z0-9-]+-c-\d+\/?$/.test(window.location.pathname),checkout:()=>/^\/don-hang\/?$/.test(window.location.pathname)}},Tm={homepage:{include:["flash_sale","recently_viewed"],rcm_product_flash_sale:{selector:[".eai-homepage-flashsale"],position:"top",props:{phoneNumber:"19002098",brandLogo:$m+"/logo_rangdong.webp",ctaKey:"contact"},dataKey:"flash_sales",style:{margin:"0px auto",padding:"6px 0px 32px 0px",width:"100%",maxWidth:"1224px",backgroundColor:"transparent"}},rcm_product_recommendation:{selector:[".eai-homepage-recommendation"],position:"top",props:{title:"Có thể bạn quan tâm",breakpoints:{768:{slidesPerView:2.5},1024:{slidesPerView:3.2},1280:{slidesPerView:4}}},dataKey:"recently_viewed",style:{margin:"0px auto",padding:"6px 0px 32px 0px",width:"100%",maxWidth:"1224px",backgroundColor:"transparent"}}},product:{include:["flash_sale"],rcm_flash_sale_register:{selector:[".eai-product-flashsale"],position:"top",dataKey:"flash_sales",style:{width:"100%",maxWidth:"1224px",margin:"12px auto 20px"}},rcm_product_recommendation:{selector:[".eai-product-recommendation"],position:"top",props:{title:"Sản phẩm mua kèm",breakpoints:{768:{slidesPerView:1.5},1024:{slidesPerView:1.5},1280:{slidesPerView:1.5}}},dataKey:"also_bought",style:{width:"100%",maxWidth:"1224px",margin:"0px auto",padding:"16px"}}}},Za={"31c91fbc-38e2-4e84-868e-da29623b9505":{homepage:{include:["flash_sale","hot_sale","recently_viewed"],rcm_product_flash_sale:{selector:[".banner-sale"],position:"after",props:{phoneNumber:"02471069999",brandLogo:$m+"/logo_lt88.png",ctaKey:"available"},dataKey:"flash_sales",style:{margin:"32px auto",padding:"0px",width:"100%",maxWidth:"1200px",backgroundColor:"transparent"}},rcm_product_recommendation:{selector:[".banner-sale"],position:"before",props:{title:"Có thể bạn quan tâm",breakpoints:{768:{slidesPerView:2.5},1024:{slidesPerView:3.2},1280:{slidesPerView:4}}},dataKey:"recently_viewed",style:{margin:"32px auto",padding:"0px 6px",width:"100%",maxWidth:"1200px",backgroundColor:"transparent"}}},product:{include:["flash_sale","also_bought"],rcm_flash_sale_register:{selector:[".product-combo-config"],position:"before",dataKey:"flash_sales",style:{width:"100%",margin:"8px auto"}},rcm_combo:{selector:[".btn-add-cart"],position:"after",dataKey:"also_bought",style:{width:"100%",margin:"24px auto 16px auto"}},rcm_combo_horizontal:{selector:[".content-desc-detail"],position:"before",dataKey:"also_bought",style:{width:"100%",margin:"24px auto"}}}},"74af8f88-1745-4f44-9726-e7082e53e321":Tm,"18193462-6eba-4fc1-8da9-536e1424ce51":Tm},Em={"74af8f88-1745-4f44-9726-e7082e53e321":{delay:500},"18193462-6eba-4fc1-8da9-536e1424ce51":{delay:500}};let Ya=[],Am=null;const _w=()=>{Ya.forEach(e=>{try{e.remove()}catch{}}),Ya=[]},el="easy_ai_test_mode",xw=["rcm_combo"],tl=["re_qua_troi","khong_dau_re_hon","re_nhat_roi","gia_re_giat_minh","khong_dau_re_bang","re_nhat_thi_truong"],ww=e=>e.map((t,n)=>({...t,badge:tl[n%tl.length]})),Im=e=>e.map((t,n)=>({...t,badge:tl[n%tl.length],endDate:t.sale_ends_at||Ja(1),flashSaleFrom:Ja(-1),flashSaleTo:t.sale_ends_at||Ja(1)})),ln={state:$t,actions:{checkTestMode(){const e=new URLSearchParams(window.location.search).get(el);e==="true"&&localStorage.setItem(el,"true"),e==="false"&&localStorage.removeItem(el),$t.isTestMode=localStorage.getItem(el)==="true"},detectPageType(e){const t=bw[e];if(!t)return null;for(const[n,s]of Object.entries(t))try{if(s())return n}catch{}return null},async fetchAndStore(e,t,n){var c,u,d,f,h,g,p;const s=t||Ks(),r=$t.pageType,o=Za[e];if(!o)return;const i=o[r],a=(i==null?void 0:i.include)||(r==="homepage"?["flash_sale","hot_sale","recently_viewed"]:["flash_sale","also_bought"]);try{const v={include:a,userId:s};r==="product"&&(v.itemUrl=n||window.location.href);const _=await yw(e,v),k=vw[e]??(()=>!0);$t.flash_sales=(c=_.flash_sale)!=null&&c.length?Im(_.flash_sale.filter(k).map(Au)):null,$t.hot_sales=(u=_.hot_sale)!=null&&u.length?Im(_.hot_sale.filter(k).map(Au)):null,$t.recently_viewed=(d=_.recently_viewed)!=null&&d.length?ww(_.recently_viewed.filter(k).map(Au)):null,$t.also_bought=(f=_.also_bought)!=null&&f.length?_.also_bought.filter(k):null,$t.source_product=_.source_product??null,((p=(g=(h=_.flash_sale)==null?void 0:h[0])==null?void 0:g.signals)==null?void 0:p.viewing_now)!=null&&($t.signals.viewing_now=_.flash_sale[0].signals.viewing_now)}catch(v){console.error("[EAI RCM] ❌ fetchAndStore:",v)}},injectWidgets(e){var t,n;try{const s=Za[e];if(!s)return;const r=$t.pageType||Object.keys(s)[0],o=s[r];if(!o)return;for(const[i,a]of Object.entries(o)){if(i==="include"||e==="31c91fbc-38e2-4e84-868e-da29623b9505"&&r==="product"&&i==="rcm_combo_horizontal"&&document.getElementById("comboset")||xw.includes(i)&&!$t.isTestMode)continue;const c=a.selector.find(f=>document.querySelector(f))||null;if(!c)continue;if(i==="rcm_flash_sale_register"){const f=window.location.pathname;if(!((t=$t.flash_sales)==null?void 0:t.some(p=>{if(!p.link)return!1;try{return new URL(p.link,window.location.origin).pathname===f}catch{return p.link.includes(f)}})))continue;const g=vi(c,{type:i},{position:a.position,style:a.style??{}});g&&Ya.push(g);continue}if(!(((n=$t[a.dataKey])==null?void 0:n.length)>0))continue;const d=vi(c,{type:i},{position:a.position,props:{...a.props,dataKey:a.dataKey},style:a.style??{}});d&&Ya.push(d)}}catch(s){console.error("[EAI RCM] ❌ injectWidgets:",s)}},async init(e){const t=["31c91fbc-38e2-4e84-868e-da29623b9505","74af8f88-1745-4f44-9726-e7082e53e321"];if(this.checkTestMode(),!(!$t.isTestMode&&!t.includes(e)||$t.isInitialized||($t.isInitialized=!0,!Za[e]))&&($t.pageType=this.detectPageType(e),!(!$t.pageType&&!$t.isTestMode)&&(await this.fetchAndStore(e),this.injectWidgets(e),Em[e]&&!Am))){const{delay:s}=Em[e],r=this;Am=Sm(async()=>{_w(),await new Promise(o=>setTimeout(o,s)),$t.flash_sales=null,$t.hot_sales=null,$t.recently_viewed=null,$t.also_bought=null,$t.source_product=null,$t.pageType=r.detectPageType(e),$t.pageType&&(await r.fetchAndStore(e),r.injectWidgets(e))})}},async demoFetch(e,t,n={}){const s=Za[e];s&&($t.pageType=n.page_type||this.detectPageType(e)||Object.keys(s)[0],await this.fetchAndStore(e,t,n.item_url))}}},Pm=!1,kw=e=>({getList(){return e.get(`/bots/${B.handle}/addresses`,{params:{mock:Pm}})},create(t){return e.post(`/bots/${B.handle}/addresses`,t,{params:{mock:Pm}})}}),lo=!1,Sw=e=>({getUser(){return e.get(`/bots/${B.handle}/profile`,{params:{mock:lo}})},updateUser(t){return e.put(`/bots/${B.handle}/profile`,t,{params:{mock:lo}})},login({type:t,identifier:n}){return e.post(`/bots/${B.handle}/auth/login`,{type:t,identifier:n},{params:{mock:lo}})},verifyOtp({code:t,identifier:n}){return e.post(`/bots/${B.handle}/auth/otp/verify`,{code:t,identifier:n},{params:{mock:lo}})},requestOtp({type:t,identifier:n}){return e.post(`/bots/${B.handle}/auth/otp/request`,{type:t,identifier:n},{params:{mock:lo}})},logout(){return e.post(`/bots/${B.handle}/auth/logout`,{},{params:{mock:lo}})}}),Tr=!1,$w=e=>({getList(){return e.get(`/bots/${B.handle}/cart`,{params:{mock:Tr}})},add(t){return e.post(`/bots/${B.handle}/cart/items`,t,{params:{mock:Tr}})},update(t,n){return e.patch(`/bots/${B.handle}/cart/items/${t}`,n,{params:{mock:Tr}})},remove(t){return e.delete(`/bots/${B.handle}/cart/items/${t}`,{params:{mock:Tr}})},coupons(){return e.get(`/bots/${B.handle}/coupons`,{params:{mock:Tr}})},applyCoupon(t){return e.post(`/bots/${B.handle}/cart/coupon`,t,{params:{mock:Tr}})},removeCoupon(t={}){return e.delete(`/bots/${B.handle}/cart/coupon`,{...t,params:{mock:Tr}})}});var Mm={exports:{}};(function(e,t){(function(){var n={expires:"1d",path:"; path=/",domain:"",secure:"",sameSite:"; SameSite=Lax",partitioned:""},s={install:function(r,o){o&&this.config(o.expires,o.path,o.domain,o.secure,o.sameSite,o.partitioned);const i=r.config&&r.config.globalProperties;i&&(r.config.globalProperties.$cookies=this,r.provide&&r.provide("$cookies",this)),(!i||r.prototype)&&(r.prototype.$cookies=this),r.$cookies=this},config:function(r,o,i,a,c,u){n.expires=r||"1d",n.path=o?"; path="+o:"; path=/",n.domain=i?"; domain="+i:"",n.secure=a?"; Secure":"",n.sameSite=c?"; SameSite="+c:"; SameSite=Lax",n.partitioned=u?"; Partitioned":""},get:function(r){var o=decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(r).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null;if(o&&(o.substring(0,1)==="{"&&o.substring(o.length-1,o.length)==="}"||o.substring(0,1)==="["&&o.substring(o.length-1,o.length)==="]"))try{o=JSON.parse(o)}catch{return o}return o},set:function(r,o,i,a,c,u,d,f){if(r){if(/^(?:expires|max\-age|path|domain|secure|SameSite)$/i.test(r))throw new Error('Cookie name illegality. Cannot be set to ["expires","max-age","path","domain","secure","SameSite"] current key name: '+r)}else throw new Error("Cookie name is not found in the first argument.");o&&typeof o=="object"&&(o=JSON.stringify(o));var h="";if(i=i===void 0?n.expires:i,i&&i!==0)switch(i.constructor){case Number:i===1/0||i===-1?h="; expires=Fri, 31 Dec 9999 23:59:59 GMT":h="; max-age="+i;break;case String:if(/^(?:\d+(y|m|d|h|min|s))$/i.test(i)){var g=i.replace(/^(\d+)(?:y|m|d|h|min|s)$/i,"$1");switch(i.replace(/^(?:\d+)(y|m|d|h|min|s)$/i,"$1").toLowerCase()){case"m":h="; max-age="+ +g*2592e3;break;case"d":h="; max-age="+ +g*86400;break;case"h":h="; max-age="+ +g*3600;break;case"min":h="; max-age="+ +g*60;break;case"s":h="; max-age="+g;break;case"y":h="; max-age="+ +g*31104e3;break}}else h="; expires="+i;break;case Date:h="; expires="+i.toUTCString();break}return document.cookie=encodeURIComponent(r)+"="+encodeURIComponent(o)+h+(c?"; domain="+c:n.domain)+(a?"; path="+a:n.path)+(u===void 0?n.secure:u?"; Secure":"")+(d===void 0?n.sameSite:d?"; SameSite="+d:"")+(f===void 0?n.partitioned:f?"; Partitioned":""),this},remove:function(r,o,i){return!r||!this.isKey(r)?!1:(document.cookie=encodeURIComponent(r)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(i?"; domain="+i:n.domain)+(o?"; path="+o:n.path)+"; SameSite=Lax",!0)},isKey:function(r){return new RegExp("(?:^|;\\s*)"+encodeURIComponent(r).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},keys:function(){if(!document.cookie)return[];for(var r=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/),o=0;o<r.length;o++)r[o]=decodeURIComponent(r[o]);return r}};e.exports=s,typeof window<"u"&&(window.$cookies=s)})()})(Mm);var Cw=Mm.exports;const Tt=kp(Cw),co={RECEIVED:"received",START:"start",DELTA:"delta",MESSAGES:"messages",AUDIO:"audio",DONE:"done"},Tw="mp3",Ew=e=>({getConversations({handle:t,conversationId:n,token:s}){const r={"Content-Type":"application/json"};return s&&(r.Authorization=`Bearer ${s}`),e.get(`/bots/${t}/conversations/${n}`,{headers:r})},async sendMessage(t,n,{isFormData:s=!1,onReceived:r=null,onStart:o=null,onDelta:i=null,onMessages:a=null,onAudioChunk:c=null,onComplete:u=null}={}){if(t.mode==="voice")return this._sendVoiceMessage(t,n,{onAudioChunk:c,onStart:o,onComplete:u});if(t.stream===!0)return this._sendStreamMessage(t,n,{onReceived:r,onStart:o,onDelta:i,onMessages:a,onComplete:u});const d={"Content-Type":s?"multipart/form-data":"application/json"};return n&&(d.Authorization=`Bearer ${n}`),e.post("/chat",t,{headers:d})},async sendAgentMessage(t,n){var o,i;const s={"Content-Type":"application/json"};n&&(s.Authorization=`Bearer ${n}`);const r={};for(const[a,c]of Object.entries(t||{}))c!=null&&(r[a]=c);try{const a=await e.post("/agent/chat",r,{headers:s});return a.status===202?{status:"merged",conversation_id:(o=a.data)==null?void 0:o.conversation_id}:{status:"ok",...a.data}}catch(a){if(((i=a==null?void 0:a.response)==null?void 0:i.status)===429)return{status:"busy"};throw a}},async _sendVoiceMessage(t,n,{onAudioChunk:s,onStart:r,onComplete:o}){const i=await this._createVoiceRequest(t,n);return await this._processSSEStream(i,{onAudioChunk:s,onStart:r,onComplete:o,fallbackConversationId:t.conversation_id})},async _sendStreamMessage(t,n,{onReceived:s,onStart:r,onDelta:o,onMessages:i,onComplete:a}){const c=await this._createStreamRequest(t,n);return await this._processSSEStream(c,{onReceived:s,onStart:r,onDelta:o,onMessages:i,onComplete:a,fallbackConversationId:t.conversation_id})},async _createVoiceRequest(t,n){const s="https://console.easyaichat.app",r=this._buildVoiceHeaders(n),o=await fetch(`${s}/api/chat`,{method:"POST",headers:r,body:JSON.stringify(t),credentials:"include"});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o},async _createStreamRequest(t,n){const s="https://console.easyaichat.app",r=this._buildStreamHeaders(n),o=await fetch(`${s}/api/chat`,{method:"POST",headers:r,body:JSON.stringify(t),credentials:"include"});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o},_buildVoiceHeaders(t){const n=Ks(),s=t||Tt.get(ts),r={"Content-Type":"application/json",Accept:"text/event-stream","X-Easy-Ai-User-Id":n};return s&&(r.Authorization=`Bearer ${s}`),r},_buildStreamHeaders(t){const n=Ks(),s=t||Tt.get(ts),r={"Content-Type":"application/json",Accept:"text/event-stream","X-Easy-Ai-User-Id":n};return s&&(r.Authorization=`Bearer ${s}`),r},async _processSSEStream(t,{onReceived:n,onStart:s,onDelta:r,onMessages:o,onAudioChunk:i,onComplete:a,fallbackConversationId:c}){const u=t.body.getReader(),d=new TextDecoder;let f="",h=null,g=c;for(;;){const{done:p,value:v}=await u.read();if(p)break;f+=d.decode(v,{stream:!0});const _=f.split(`
`);f=_.pop()||"";for(const k of _)if(!(!k.trim()||k.startsWith(":"))){if(k.startsWith("event:")){h=k.substring(6).trim();continue}if(k.startsWith("data:")&&h){const w=this._parseEventData(k);if(w){const $=this._handleSSEEvent(h,w,{onReceived:n,onStart:s,onDelta:r,onMessages:o,onAudioChunk:i,onComplete:a});$&&(g=$)}h=null}}}return{data:{messages:[],conversation_id:g,code:0,msg:"success"}}},_parseEventData(t){try{const n=t.substring(5).trim();return JSON.parse(n)}catch(n){return console.error("Error parsing SSE data:",n),null}},_handleSSEEvent(t,n,{onReceived:s,onStart:r,onDelta:o,onMessages:i,onAudioChunk:a,onComplete:c}){switch(t){case co.RECEIVED:s&&s(n);break;case co.START:r&&r(n);break;case co.DELTA:return o&&o({content:n.content||"",content_type:n.content_type||"text",conversation_id:n.conversation_id}),n.conversation_id;case co.MESSAGES:return i&&i({messages:n.messages||[],conversation_id:n.conversation_id}),n.conversation_id;case co.AUDIO:if(a){const u=n.format||Tw;a(n.content,n.sentence_index,n.text,u)}break;case co.DONE:c&&c(n);break}return null}}),Aw=e=>({initConnection(t){return e.post("/live-chat/init",t)}}),Iu=!1,Iw=e=>({provinces(){return e.get(`/bots/${B.handle}/locations/provinces`,{params:{mock:Iu}})},districts(t){return e.get(`/bots/${B.handle}/locations/provinces/${t}/districts`,{params:{mock:Iu}})},wards(t){return e.get(`/bots/${B.handle}/locations/districts/${t}/wards`,{params:{mock:Iu}})}}),bi=!1,Pw=e=>({checkout(t){return e.post(`/bots/${B.handle}/checkout`,t,{params:{mock:bi}})},checkShipping(t){return e.post(`/bots/${B.handle}/cart/shipping-address`,t,{params:{mock:bi}})},getList(t={}){return e.get(`/bots/${B.handle}/orders`,{params:{mock:bi,...t}})},getOne(t){return e.get(`/bots/${B.handle}/orders/${t}`,{params:{mock:bi}})},getStatuses(){return e.get(`/bots/${B.handle}/orders/statuses`,{params:{mock:bi}})},confirm(t,n){return e.post(`/widget/orders/${t}/confirm`,n)}}),Mw=e=>({update({conversationId:t,messageId:n,form:s={reaction:"love"}}){return e.post(`/bots/${B.handle}/conversations/${t}/messages/${n}/reaction`,s)},removeAll({conversationId:t,messageId:n}){return e.post(`/bots/${B.handle}/conversations/${t}/messages/${n}/reset-all-reaction`)}}),Ow=e=>({add({formId:t,formData:n}){return e.post(`/bots/${B.handle}/widgets/${t}/submission`,n)},submitWidget({widgetId:t,formData:n}){return e.post(`/bots/${B.handle}/widgets/${t}/submission`,n)}}),Rw=e=>({getSummary(t){return e.post("/widgets/summary",t)},getComparisonSummary(t){return e.post("/widgets/compare",t)}}),Lw=e=>({showWidget({handle:t,workspaceUuid:n,domain:s,preview:r=!1}){return e.get("/workspaces/widget",{params:{...t?{handle:t}:{},...n?{workspaceUuid:n}:{},domain:s,preview:r}})},submitForm({widgetId:t,handle:n,formData:s}){return e.post(`/bots/${n}/widgets/${t}/submission`,s)},updateAll({handle:t,token:n,expires:s,widgets:r}){return e.put(`/bots/${t}/widgets?expires=${s}&signature=${n}`,{widgets:r})}}),Vn=St.create({baseURL:"https://console.easyaichat.app"+"/api",withCredentials:!0,headers:{"Content-Type":"application/json",Accept:"application/json"}});Vn.interceptors.request.use(e=>{const t=Ks(),n=Tt.get(ts);return e.headers["X-Easy-Ai-User-Id"]=t,n&&(e.headers.Authorization=`Bearer ${n}`),e},e=>Promise.reject(e));const Xe={address:kw(Vn),auth:Sw(Vn),cart:$w(Vn),chat:Ew(Vn),liveChat:Aw(Vn),location:Iw(Vn),order:Pw(Vn),reaction:Mw(Vn),submission:Ow(Vn),summary:Rw(Vn),widget:Lw(Vn)},vt={track:(e,t)=>{var n;(n=window.rybbit)==null||n.event(e,t)},identify:e=>{var t;(t=window.rybbit)==null||t.identify(e)},clearUserId:()=>{var e;(e=window.rybbit)==null||e.clearUserId()},getUserId:()=>{var e;return(e=window.rybbit)==null?void 0:e.getUserId()}},Qt={conversationStart:e=>{vt.track("chatbot_conversation_start",e)},conversationReset:e=>{vt.track("chatbot_conversation_reset",e)},quickPromptClick:e=>{vt.track("chatbot_quick_prompt_click",e)},messageSend:e=>{vt.track("chatbot_message_send",e)},linkClick:e=>{vt.track("chatbot_link_click",e)},ctaClick:e=>{vt.track("chatbot_cta_click",e)},interaction:e=>{vt.track("chatbot_interaction",e)},widgetVoice:e=>{vt.track("chatbot_widget_voice",e)},widgetFollowUpQuestions:e=>{vt.track("chatbot_widget_follow_up_questions",e)},widgetContact:e=>{vt.track("chatbot_widget_contact",e)}},Dw=dt({isPlaying:!1,currentSentenceIndex:null});function jw(){const{isPlaying:e,currentSentenceIndex:t}=At(Dw),n=R(null),s=R(null),r=R(0),o=R([]),i=R(!1),a=R(!1),c=()=>{const _=window.AudioContext||window.webkitAudioContext;return n.value||(n.value=new _({sampleRate:48e3}),s.value=n.value.createGain(),s.value.gain.value=1,s.value.connect(n.value.destination)),n.value},u=async()=>{if(n.value||c(),n.value.state==="suspended")try{await n.value.resume()}catch(_){throw _}},d=async()=>{if(n.value||c(),n.value.state==="suspended")try{await n.value.resume()}catch{}if(!(i.value&&a.value))try{const _=n.value.createBufferSource();_.buffer=n.value.createBuffer(1,1,n.value.sampleRate),_.connect(s.value),_.start(0),i.value=!0,a.value=!0,r.value=n.value.currentTime}catch(_){throw _}},f=_=>{const k=atob(_);return Uint8Array.from(k,$=>$.charCodeAt(0)).buffer},h=async(_,k,w="mp3")=>{try{await u(),e.value=!0,t.value=k;const $=f(_),E=await n.value.decodeAudioData($),P=n.value.createBufferSource();P.buffer=E,P.connect(s.value);const I=n.value.currentTime,M=Math.max(I+.01,r.value);P.start(M),r.value=M+E.duration,o.value.push(P),P.onended=()=>{const L=o.value.indexOf(P);L>-1&&o.value.splice(L,1),o.value.length===0&&(e.value=!1,t.value=null,r.value=n.value.currentTime)}}catch{n.value&&(r.value=n.value.currentTime)}},g=()=>{o.value.forEach(_=>{try{_.stop(),_.disconnect()}catch{}}),o.value=[],n.value&&(r.value=n.value.currentTime),e.value=!1,t.value=null},p=()=>{g()},v=()=>{g(),i.value=!1,a.value=!1,r.value=0};return Lt(()=>{g(),s.value&&(s.value.disconnect(),s.value=null),n.value&&(n.value.close(),n.value=null)}),{isPlaying:e,currentSentenceIndex:t,unlockAudio:d,queueAudioChunk:h,stopAudio:g,clearQueue:p,reset:v}}const Nw=dt({conversationId:null,messages:[],assistantProcessing:!1,newMessageStatus:"unread",storageConversations:{},messagesContainerRef:null});function Om(){const{getStorage:e,saveStorage:t}=Gs(),{conversationId:n,messages:s,assistantProcessing:r,newMessageStatus:o,storageConversations:i,messagesContainerRef:a}=At(Nw),c=ee(()=>{var E;return(E=ae.state.bot)==null?void 0:E.handle}),u=jw(),d=async()=>{try{const{data:E}=await Xe.cart.getList();E.success&&(B.cart=E.data,ECG.sync.emit("cart",{source:"easy-ai-chat",data:E.data}))}catch(E){console.log("error: ",E)}},f=()=>{s.value.find(P=>P.content_type==="attachment")&&d()};(()=>{i.value=e(Kt)??{};const E=Kp();if(E){n.value=E;return}c.value&&(n.value=i.value[c.value]??null)})();const g=()=>{var L,V,X,T,A;s.value=[];const E=((X=(V=(L=B.bot)==null?void 0:L.config)==null?void 0:V.initialMessage)==null?void 0:X.messages)??[],P=Object.values(E).map(D=>D.content);mi(P).forEach(D=>{s.value.push({content:D,content_type:"text",sender_type:"assistant",is_welcome_message:!0})});const M=(A=(T=B.bot)==null?void 0:T.config)==null?void 0:A.introductionMessage;M&&typeof M=="string"&&s.value.push({content:M,content_type:"text",sender_type:"assistant",is_welcome_message:!0,is_introduction_message:!0}),s.value=gs(s.value)},p=()=>{const E=e(Kt);delete E[c.value],t(Kt,E)};function v(){var L,V,X,T,A;const E=((X=(V=(L=B.bot)==null?void 0:L.config)==null?void 0:V.initialMessage)==null?void 0:X.messages)??[],P=(A=(T=B.bot)==null?void 0:T.config)==null?void 0:A.introductionMessage,I=Object.values(E).map(D=>D.content);let M=mi(I).length;if(P&&typeof P=="string"&&(M+=1),M>0)for(let D=0;D<M;D++)s.value[D]&&(s.value[D].is_welcome_message=!0);s.value=gs(s.value)}return{handle:c,messages:s,conversationId:n,assistantProcessing:r,newMessageStatus:o,storageConversations:i,messagesContainerRef:a,send:async({message:E,files:P,onSuccess:I,mode:M,onError:L,onFinish:V,content_type:X,replyTarget:T}={})=>{var F,ne,fe,_e,we,je;if(!E&&(!P||P.length===0)||r.value)return;r.value=!0;const A=(P==null?void 0:P.map(re=>re.file_id))??[],D=E||"";if(s.value.forEach(re=>{re.sender_type==="user"&&delete re.is_last_message}),A.length>0&&s.value.push({content:P,content_type:"attachment",sender_type:"user",timestamp:new Date().toISOString(),is_last_message:!D}),D){const re={content:D,content_type:X||"text",sender_type:"user",audio_url:M==="voice"?!0:void 0,timestamp:new Date().toISOString(),is_last_message:!0};T&&(re.reply_to_message_id=T.id,re.quoted_message={id:T.id,content:T.content,content_type:T.content_type,sender_type:T.sender_type,sender_name:T.sender_name}),s.value.push(re)}let Q=!1;((ne=(F=B.bot)==null?void 0:F.config)==null?void 0:ne.livechat)===!0?Q=!1:Q=((_e=(fe=B.bot)==null?void 0:fe.config)==null?void 0:_e.stream)===!0;let W={handle:c.value,query:D,stream:Q,conversation_id:n.value,attachments:A??[],content_type:X||"text"};M&&(W.mode=M),T!=null&&T.id&&(W.reply_to_message_id=T.id),n.value||Qt.conversationStart({handle:c.value});const H=((we=s.value.filter(re=>re.sender_type==="user"))==null?void 0:we.length)||1;Qt.messageSend({mode:M==="voice"?"voice":"text",content:D,conversation_id:n.value,message_user_order:H}),(async()=>(await es(1200),o.value="sent",await es(2e3),o.value==="sent"&&(o.value="received"),await es(1e3),o.value==="received"&&(o.value="read")))();let K=null;try{const re=(je=B.cart)==null?void 0:je.token,pe=M==="voice"?{onAudioChunk:(Ce,Re,Oe,Me)=>{u.queueAudioChunk(Ce,Re,Oe,Me)},onStart:Ce=>{},onComplete:Ce=>{}}:{onReceived:Ce=>{},onStart:Ce=>{r.value=!0},onDelta:Ce=>{Ce.conversation_id&&!n.value&&(n.value=Ce.conversation_id,i.value[c.value]=Ce.conversation_id,t(Kt,i.value));const Re=Ce.content_type||"text";K&&K.content_type!==Re&&(delete K.is_streaming,s.value=gs(s.value),K={content:"",content_type:Re,sender_type:"assistant",is_streaming:!0},s.value.push(K)),K||(K={content:"",content_type:Re,sender_type:"assistant",is_streaming:!0},s.value.push(K)),K.content+=Ce.content},onMessages:Ce=>{if(Ce.messages&&Ce.messages.length>0){K=null,s.value=gs(Ce.messages);for(let Re=s.value.length-1;Re>=0;Re--)if(s.value[Re].sender_type==="user"){s.value[Re].is_last_message=!0;break}}Ce.conversation_id&&!n.value&&(n.value=Ce.conversation_id,i.value[c.value]=Ce.conversation_id,t(Kt,i.value))},onComplete:Ce=>{}},{data:de}=await Xe.chat.sendMessage(W,re,pe);if(o.value="unread",!Q&&(de!=null&&de.messages)&&de.messages.length>0){s.value=gs(de.messages);for(let Ce=s.value.length-1;Ce>=0;Ce--)if(s.value[Ce].sender_type==="user"){s.value[Ce].is_last_message=!0;break}}c.value==="rangdongstorevn-zll"&&f(),de!=null&&de.conversation_id&&!n.value&&(n.value=de.conversation_id,i.value[c.value]=de.conversation_id,t(Kt,i.value)),io(I)&&I(de)}catch(re){io(L)&&L(re)}finally{r.value=!1,io(V)&&V(),v()}},fetchMessages:async({onSuccess:E,onError:P,onFinish:I}={})=>{var L;if(s.value.length>0)return;const M=(L=B==null?void 0:B.cart)==null?void 0:L.token;if(n.value){r.value=!0;try{const{data:V}=await Xe.chat.getConversations({handle:c.value,conversationId:n.value,token:M});V&&(s.value=gs(V.data),io(E)&&E(V))}catch(V){g(),p(),io(P)&&P(V)}finally{r.value=!1,io(I)&&I()}}else g()},initializeMessages:g,refreshConversation:async()=>{r.value||(u.reset(),s.value=[],n.value=null,delete i.value[c.value],localStorage.setItem(Kt,JSON.stringify(i.value)),g(),Qt.conversationReset())},clickQuickPrompt:E=>{Qt.quickPromptClick({handle:c.value,quick_prompt:E}),ae.state.chatState.shouldOpenChatScreen=!0},voiceAudio:u}}class Pu{constructor(){this.notificationCreatedEvent=".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated"}listenForWhisper(t,n){return this.listen(".client-"+t,n)}notification(t){return this.listen(this.notificationCreatedEvent,t)}stopListeningForNotification(t){return this.stopListening(this.notificationCreatedEvent,t)}stopListeningForWhisper(t,n){return this.stopListening(".client-"+t,n)}}class Rm{constructor(t){this.namespace=t}format(t){return[".","\\"].includes(t.charAt(0))?t.substring(1):(this.namespace&&(t=this.namespace+"."+t),t.replace(/\./g,"\\"))}setNamespace(t){this.namespace=t}}function Fw(e){try{new e}catch(t){if(t instanceof Error&&t.message.includes("is not a constructor"))return!1}return!0}class Mu extends Pu{constructor(t,n,s){super(),this.name=n,this.pusher=t,this.options=s,this.eventFormatter=new Rm(this.options.namespace),this.subscribe()}subscribe(){this.subscription=this.pusher.subscribe(this.name)}unsubscribe(){this.pusher.unsubscribe(this.name)}listen(t,n){return this.on(this.eventFormatter.format(t),n),this}listenToAll(t){return this.subscription.bind_global((n,s)=>{if(n.startsWith("pusher:"))return;let r=String(this.options.namespace??"").replace(/\./g,"\\"),o=n.startsWith(r)?n.substring(r.length+1):"."+n;t(o,s)}),this}stopListening(t,n){return n?this.subscription.unbind(this.eventFormatter.format(t),n):this.subscription.unbind(this.eventFormatter.format(t)),this}stopListeningToAll(t){return t?this.subscription.unbind_global(t):this.subscription.unbind_global(),this}subscribed(t){return this.on("pusher:subscription_succeeded",()=>{t()}),this}error(t){return this.on("pusher:subscription_error",n=>{t(n)}),this}on(t,n){return this.subscription.bind(t,n),this}}class Lm extends Mu{whisper(t,n){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,n),this}}class zw extends Mu{whisper(t,n){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,n),this}}class qw extends Lm{here(t){return this.on("pusher:subscription_succeeded",n=>{t(Object.keys(n.members).map(s=>n.members[s]))}),this}joining(t){return this.on("pusher:member_added",n=>{t(n.info)}),this}whisper(t,n){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,n),this}leaving(t){return this.on("pusher:member_removed",n=>{t(n.info)}),this}}class Dm extends Pu{constructor(t,n,s){super(),this.events={},this.listeners={},this.name=n,this.socket=t,this.options=s,this.eventFormatter=new Rm(this.options.namespace),this.subscribe()}subscribe(){this.socket.emit("subscribe",{channel:this.name,auth:this.options.auth||{}})}unsubscribe(){this.unbind(),this.socket.emit("unsubscribe",{channel:this.name,auth:this.options.auth||{}})}listen(t,n){return this.on(this.eventFormatter.format(t),n),this}stopListening(t,n){return this.unbindEvent(this.eventFormatter.format(t),n),this}subscribed(t){return this.on("connect",n=>{t(n)}),this}error(t){return this}on(t,n){return this.listeners[t]=this.listeners[t]||[],this.events[t]||(this.events[t]=(s,r)=>{this.name===s&&this.listeners[t]&&this.listeners[t].forEach(o=>o(r))},this.socket.on(t,this.events[t])),this.listeners[t].push(n),this}unbind(){Object.keys(this.events).forEach(t=>{this.unbindEvent(t)})}unbindEvent(t,n){this.listeners[t]=this.listeners[t]||[],n&&(this.listeners[t]=this.listeners[t].filter(s=>s!==n)),(!n||this.listeners[t].length===0)&&(this.events[t]&&(this.socket.removeListener(t,this.events[t]),delete this.events[t]),delete this.listeners[t])}}class jm extends Dm{whisper(t,n){return this.socket.emit("client event",{channel:this.name,event:`client-${t}`,data:n}),this}}class Bw extends jm{here(t){return this.on("presence:subscribed",n=>{t(n.map(s=>s.user_info))}),this}joining(t){return this.on("presence:joining",n=>t(n.user_info)),this}whisper(t,n){return this.socket.emit("client event",{channel:this.name,event:`client-${t}`,data:n}),this}leaving(t){return this.on("presence:leaving",n=>t(n.user_info)),this}}class nl extends Pu{subscribe(){}unsubscribe(){}listen(t,n){return this}listenToAll(t){return this}stopListening(t,n){return this}subscribed(t){return this}error(t){return this}on(t,n){return this}}class Nm extends nl{whisper(t,n){return this}}class Uw extends nl{whisper(t,n){return this}}class Vw extends Nm{here(t){return this}joining(t){return this}whisper(t,n){return this}leaving(t){return this}}const Fm=class n0{constructor(t){this.setOptions(t),this.connect()}setOptions(t){this.options={...n0._defaultOptions,...t,broadcaster:t.broadcaster};let n=this.csrfToken();n&&(this.options.auth.headers["X-CSRF-TOKEN"]=n,this.options.userAuthentication.headers["X-CSRF-TOKEN"]=n),n=this.options.bearerToken,n&&(this.options.auth.headers.Authorization="Bearer "+n,this.options.userAuthentication.headers.Authorization="Bearer "+n)}csrfToken(){var t,n;return typeof window<"u"&&(t=window.Laravel)!=null&&t.csrfToken?window.Laravel.csrfToken:this.options.csrfToken?this.options.csrfToken:typeof document<"u"&&typeof document.querySelector=="function"?((n=document.querySelector('meta[name="csrf-token"]'))==null?void 0:n.getAttribute("content"))??null:null}};Fm._defaultOptions={auth:{headers:{}},authEndpoint:"/broadcasting/auth",userAuthentication:{endpoint:"/broadcasting/user-auth",headers:{}},csrfToken:null,bearerToken:null,host:null,key:null,namespace:"App.Events"};let Ou=Fm;class sl extends Ou{constructor(){super(...arguments),this.channels={}}connect(){if(typeof this.options.client<"u")this.pusher=this.options.client;else if(this.options.Pusher)this.pusher=new this.options.Pusher(this.options.key,this.options);else if(typeof window<"u"&&typeof window.Pusher<"u")this.pusher=new window.Pusher(this.options.key,this.options);else throw new Error("Pusher client not found. Should be globally available or passed via options.client")}signin(){this.pusher.signin()}listen(t,n,s){return this.channel(t).listen(n,s)}channel(t){return this.channels[t]||(this.channels[t]=new Mu(this.pusher,t,this.options)),this.channels[t]}privateChannel(t){return this.channels["private-"+t]||(this.channels["private-"+t]=new Lm(this.pusher,"private-"+t,this.options)),this.channels["private-"+t]}encryptedPrivateChannel(t){return this.channels["private-encrypted-"+t]||(this.channels["private-encrypted-"+t]=new zw(this.pusher,"private-encrypted-"+t,this.options)),this.channels["private-encrypted-"+t]}presenceChannel(t){return this.channels["presence-"+t]||(this.channels["presence-"+t]=new qw(this.pusher,"presence-"+t,this.options)),this.channels["presence-"+t]}leave(t){[t,"private-"+t,"private-encrypted-"+t,"presence-"+t].forEach(n=>{this.leaveChannel(n)})}leaveChannel(t){this.channels[t]&&(this.channels[t].unsubscribe(),delete this.channels[t])}socketId(){return this.pusher.connection.socket_id}disconnect(){this.pusher.disconnect()}}class Hw extends Ou{constructor(){super(...arguments),this.channels={}}connect(){let t=this.getSocketIO();this.socket=t(this.options.host??void 0,this.options),this.socket.io.on("reconnect",()=>{Object.values(this.channels).forEach(n=>{n.subscribe()})})}getSocketIO(){if(typeof this.options.client<"u")return this.options.client;if(typeof window<"u"&&typeof window.io<"u")return window.io;throw new Error("Socket.io client not found. Should be globally available or passed via options.client")}listen(t,n,s){return this.channel(t).listen(n,s)}channel(t){return this.channels[t]||(this.channels[t]=new Dm(this.socket,t,this.options)),this.channels[t]}privateChannel(t){return this.channels["private-"+t]||(this.channels["private-"+t]=new jm(this.socket,"private-"+t,this.options)),this.channels["private-"+t]}presenceChannel(t){return this.channels["presence-"+t]||(this.channels["presence-"+t]=new Bw(this.socket,"presence-"+t,this.options)),this.channels["presence-"+t]}leave(t){[t,"private-"+t,"presence-"+t].forEach(n=>{this.leaveChannel(n)})}leaveChannel(t){this.channels[t]&&(this.channels[t].unsubscribe(),delete this.channels[t])}socketId(){return this.socket.id}disconnect(){this.socket.disconnect()}}class zm extends Ou{constructor(){super(...arguments),this.channels={}}connect(){}listen(t,n,s){return new nl}channel(t){return new nl}privateChannel(t){return new Nm}encryptedPrivateChannel(t){return new Uw}presenceChannel(t){return new Vw}leave(t){}leaveChannel(t){}socketId(){return"fake-socket-id"}disconnect(){}}class Ww{constructor(t){this.options=t,this.connect(),this.options.withoutInterceptors||this.registerInterceptors()}channel(t){return this.connector.channel(t)}connect(){if(this.options.broadcaster==="reverb")this.connector=new sl({...this.options,cluster:""});else if(this.options.broadcaster==="pusher")this.connector=new sl(this.options);else if(this.options.broadcaster==="ably")this.connector=new sl({...this.options,cluster:"",broadcaster:"pusher"});else if(this.options.broadcaster==="socket.io")this.connector=new Hw(this.options);else if(this.options.broadcaster==="null")this.connector=new zm(this.options);else if(typeof this.options.broadcaster=="function"&&Fw(this.options.broadcaster))this.connector=new this.options.broadcaster(this.options);else throw new Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} is not supported.`)}disconnect(){this.connector.disconnect()}join(t){return this.connector.presenceChannel(t)}leave(t){this.connector.leave(t)}leaveChannel(t){this.connector.leaveChannel(t)}leaveAllChannels(){for(const t in this.connector.channels)this.leaveChannel(t)}listen(t,n,s){return this.connector.listen(t,n,s)}private(t){return this.connector.privateChannel(t)}encryptedPrivate(t){if(this.connectorSupportsEncryptedPrivateChannels(this.connector))return this.connector.encryptedPrivateChannel(t);throw new Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} does not support encrypted private channels.`)}connectorSupportsEncryptedPrivateChannels(t){return t instanceof sl||t instanceof zm}socketId(){return this.connector.socketId()}registerInterceptors(){typeof Vue<"u"&&Vue!=null&&Vue.http&&this.registerVueRequestInterceptor(),typeof axios=="function"&&this.registerAxiosRequestInterceptor(),typeof jQuery=="function"&&this.registerjQueryAjaxSetup(),typeof Turbo=="object"&&this.registerTurboRequestInterceptor()}registerVueRequestInterceptor(){Vue.http.interceptors.push((t,n)=>{this.socketId()&&t.headers.set("X-Socket-ID",this.socketId()),n()})}registerAxiosRequestInterceptor(){axios.interceptors.request.use(t=>(this.socketId()&&(t.headers["X-Socket-Id"]=this.socketId()),t))}registerjQueryAjaxSetup(){typeof jQuery.ajax<"u"&&jQuery.ajaxPrefilter((t,n,s)=>{this.socketId()&&s.setRequestHeader("X-Socket-Id",this.socketId())})}registerTurboRequestInterceptor(){document.addEventListener("turbo:before-fetch-request",t=>{t.detail.fetchOptions.headers["X-Socket-Id"]=this.socketId()})}}var qm={exports:{}};/*!
* Pusher JavaScript Library v8.4.0
* https://pusher.com/
*
* Copyright 2020, Pusher
* Released under the MIT licence.
*/(function(e,t){(function(s,r){e.exports=r()})(window,function(){return function(n){var s={};function r(o){if(s[o])return s[o].exports;var i=s[o]={i:o,l:!1,exports:{}};return n[o].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=n,r.c=s,r.d=function(o,i,a){r.o(o,i)||Object.defineProperty(o,i,{enumerable:!0,get:a})},r.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},r.t=function(o,i){if(i&1&&(o=r(o)),i&8||i&4&&typeof o=="object"&&o&&o.__esModule)return o;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:o}),i&2&&typeof o!="string")for(var c in o)r.d(a,c,(function(u){return o[u]}).bind(null,c));return a},r.n=function(o){var i=o&&o.__esModule?function(){return o.default}:function(){return o};return r.d(i,"a",i),i},r.o=function(o,i){return Object.prototype.hasOwnProperty.call(o,i)},r.p="",r(r.s=2)}([function(n,s,r){var o=this&&this.__extends||function(){var v=function(_,k){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,$){w.__proto__=$}||function(w,$){for(var E in $)$.hasOwnProperty(E)&&(w[E]=$[E])},v(_,k)};return function(_,k){v(_,k);function w(){this.constructor=_}_.prototype=k===null?Object.create(k):(w.prototype=k.prototype,new w)}}();Object.defineProperty(s,"__esModule",{value:!0});var i=256,a=function(){function v(_){_===void 0&&(_="="),this._paddingCharacter=_}return v.prototype.encodedLength=function(_){return this._paddingCharacter?(_+2)/3*4|0:(_*8+5)/6|0},v.prototype.encode=function(_){for(var k="",w=0;w<_.length-2;w+=3){var $=_[w]<<16|_[w+1]<<8|_[w+2];k+=this._encodeByte($>>>3*6&63),k+=this._encodeByte($>>>2*6&63),k+=this._encodeByte($>>>1*6&63),k+=this._encodeByte($>>>0*6&63)}var E=_.length-w;if(E>0){var $=_[w]<<16|(E===2?_[w+1]<<8:0);k+=this._encodeByte($>>>3*6&63),k+=this._encodeByte($>>>2*6&63),E===2?k+=this._encodeByte($>>>1*6&63):k+=this._paddingCharacter||"",k+=this._paddingCharacter||""}return k},v.prototype.maxDecodedLength=function(_){return this._paddingCharacter?_/4*3|0:(_*6+7)/8|0},v.prototype.decodedLength=function(_){return this.maxDecodedLength(_.length-this._getPaddingLength(_))},v.prototype.decode=function(_){if(_.length===0)return new Uint8Array(0);for(var k=this._getPaddingLength(_),w=_.length-k,$=new Uint8Array(this.maxDecodedLength(w)),E=0,P=0,I=0,M=0,L=0,V=0,X=0;P<w-4;P+=4)M=this._decodeChar(_.charCodeAt(P+0)),L=this._decodeChar(_.charCodeAt(P+1)),V=this._decodeChar(_.charCodeAt(P+2)),X=this._decodeChar(_.charCodeAt(P+3)),$[E++]=M<<2|L>>>4,$[E++]=L<<4|V>>>2,$[E++]=V<<6|X,I|=M&i,I|=L&i,I|=V&i,I|=X&i;if(P<w-1&&(M=this._decodeChar(_.charCodeAt(P)),L=this._decodeChar(_.charCodeAt(P+1)),$[E++]=M<<2|L>>>4,I|=M&i,I|=L&i),P<w-2&&(V=this._decodeChar(_.charCodeAt(P+2)),$[E++]=L<<4|V>>>2,I|=V&i),P<w-3&&(X=this._decodeChar(_.charCodeAt(P+3)),$[E++]=V<<6|X,I|=X&i),I!==0)throw new Error("Base64Coder: incorrect characters for decoding");return $},v.prototype._encodeByte=function(_){var k=_;return k+=65,k+=25-_>>>8&6,k+=51-_>>>8&-75,k+=61-_>>>8&-15,k+=62-_>>>8&3,String.fromCharCode(k)},v.prototype._decodeChar=function(_){var k=i;return k+=(42-_&_-44)>>>8&-i+_-43+62,k+=(46-_&_-48)>>>8&-i+_-47+63,k+=(47-_&_-58)>>>8&-i+_-48+52,k+=(64-_&_-91)>>>8&-i+_-65+0,k+=(96-_&_-123)>>>8&-i+_-97+26,k},v.prototype._getPaddingLength=function(_){var k=0;if(this._paddingCharacter){for(var w=_.length-1;w>=0&&_[w]===this._paddingCharacter;w--)k++;if(_.length<4||k>2)throw new Error("Base64Coder: incorrect padding")}return k},v}();s.Coder=a;var c=new a;function u(v){return c.encode(v)}s.encode=u;function d(v){return c.decode(v)}s.decode=d;var f=function(v){o(_,v);function _(){return v!==null&&v.apply(this,arguments)||this}return _.prototype._encodeByte=function(k){var w=k;return w+=65,w+=25-k>>>8&6,w+=51-k>>>8&-75,w+=61-k>>>8&-13,w+=62-k>>>8&49,String.fromCharCode(w)},_.prototype._decodeChar=function(k){var w=i;return w+=(44-k&k-46)>>>8&-i+k-45+62,w+=(94-k&k-96)>>>8&-i+k-95+63,w+=(47-k&k-58)>>>8&-i+k-48+52,w+=(64-k&k-91)>>>8&-i+k-65+0,w+=(96-k&k-123)>>>8&-i+k-97+26,w},_}(a);s.URLSafeCoder=f;var h=new f;function g(v){return h.encode(v)}s.encodeURLSafe=g;function p(v){return h.decode(v)}s.decodeURLSafe=p,s.encodedLength=function(v){return c.encodedLength(v)},s.maxDecodedLength=function(v){return c.maxDecodedLength(v)},s.decodedLength=function(v){return c.decodedLength(v)}},function(n,s,r){Object.defineProperty(s,"__esModule",{value:!0});var o="utf8: invalid string",i="utf8: invalid source encoding";function a(d){for(var f=new Uint8Array(c(d)),h=0,g=0;g<d.length;g++){var p=d.charCodeAt(g);p<128?f[h++]=p:p<2048?(f[h++]=192|p>>6,f[h++]=128|p&63):p<55296?(f[h++]=224|p>>12,f[h++]=128|p>>6&63,f[h++]=128|p&63):(g++,p=(p&1023)<<10,p|=d.charCodeAt(g)&1023,p+=65536,f[h++]=240|p>>18,f[h++]=128|p>>12&63,f[h++]=128|p>>6&63,f[h++]=128|p&63)}return f}s.encode=a;function c(d){for(var f=0,h=0;h<d.length;h++){var g=d.charCodeAt(h);if(g<128)f+=1;else if(g<2048)f+=2;else if(g<55296)f+=3;else if(g<=57343){if(h>=d.length-1)throw new Error(o);h++,f+=4}else throw new Error(o)}return f}s.encodedLength=c;function u(d){for(var f=[],h=0;h<d.length;h++){var g=d[h];if(g&128){var p=void 0;if(g<224){if(h>=d.length)throw new Error(i);var v=d[++h];if((v&192)!==128)throw new Error(i);g=(g&31)<<6|v&63,p=128}else if(g<240){if(h>=d.length-1)throw new Error(i);var v=d[++h],_=d[++h];if((v&192)!==128||(_&192)!==128)throw new Error(i);g=(g&15)<<12|(v&63)<<6|_&63,p=2048}else if(g<248){if(h>=d.length-2)throw new Error(i);var v=d[++h],_=d[++h],k=d[++h];if((v&192)!==128||(_&192)!==128||(k&192)!==128)throw new Error(i);g=(g&15)<<18|(v&63)<<12|(_&63)<<6|k&63,p=65536}else throw new Error(i);if(g<p||g>=55296&&g<=57343)throw new Error(i);if(g>=65536){if(g>1114111)throw new Error(i);g-=65536,f.push(String.fromCharCode(55296|g>>10)),g=56320|g&1023}}f.push(String.fromCharCode(g))}return f.join("")}s.decode=u},function(n,s,r){n.exports=r(3).default},function(n,s,r){r.r(s);class o{constructor(b,S){this.lastId=0,this.prefix=b,this.name=S}create(b){this.lastId++;var S=this.lastId,z=this.prefix+S,J=this.name+"["+S+"]",ve=!1,Ee=function(){ve||(b.apply(null,arguments),ve=!0)};return this[S]=Ee,{number:S,id:z,name:J,callback:Ee}}remove(b){delete this[b.number]}}var i=new o("_pusher_script_","Pusher.ScriptReceivers"),a={VERSION:"8.4.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},c=a;class u{constructor(b){this.options=b,this.receivers=b.receivers||i,this.loading={}}load(b,S,z){var J=this;if(J.loading[b]&&J.loading[b].length>0)J.loading[b].push(z);else{J.loading[b]=[z];var ve=rt.createScriptRequest(J.getPath(b,S)),Ee=J.receivers.create(function(Ue){if(J.receivers.remove(Ee),J.loading[b]){var nt=J.loading[b];delete J.loading[b];for(var ft=function(Vt){Vt||ve.cleanup()},bt=0;bt<nt.length;bt++)nt[bt](Ue,ft)}});ve.send(Ee)}}getRoot(b){var S,z=rt.getDocument().location.protocol;return b&&b.useTLS||z==="https:"?S=this.options.cdn_https:S=this.options.cdn_http,S.replace(/\/*$/,"")+"/"+this.options.version}getPath(b,S){return this.getRoot(S)+"/"+b+this.options.suffix+".js"}}var d=new o("_pusher_dependencies","Pusher.DependenciesReceivers"),f=new u({cdn_http:c.cdn_http,cdn_https:c.cdn_https,version:c.VERSION,suffix:c.dependency_suffix,receivers:d});const h={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var p={buildLogSuffix:function(C){const b="See:",S=h.urls[C];if(!S)return"";let z;return S.fullUrl?z=S.fullUrl:S.path&&(z=h.baseUrl+S.path),z?`${b} ${z}`:""}},v;(function(C){C.UserAuthentication="user-authentication",C.ChannelAuthorization="channel-authorization"})(v||(v={}));class _ extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class k extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class w extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class $ extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class E extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class P extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class I extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class L extends Error{constructor(b,S){super(S),this.status=b,Object.setPrototypeOf(this,new.target.prototype)}}var X=function(C,b,S,z,J){const ve=rt.createXHR();ve.open("POST",S.endpoint,!0),ve.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var Ee in S.headers)ve.setRequestHeader(Ee,S.headers[Ee]);if(S.headersProvider!=null){let Ue=S.headersProvider();for(var Ee in Ue)ve.setRequestHeader(Ee,Ue[Ee])}return ve.onreadystatechange=function(){if(ve.readyState===4)if(ve.status===200){let Ue,nt=!1;try{Ue=JSON.parse(ve.responseText),nt=!0}catch{J(new L(200,`JSON returned from ${z.toString()} endpoint was invalid, yet status code was 200. Data was: ${ve.responseText}`),null)}nt&&J(null,Ue)}else{let Ue="";switch(z){case v.UserAuthentication:Ue=p.buildLogSuffix("authenticationEndpoint");break;case v.ChannelAuthorization:Ue=`Clients must be authorized to join private or presence channels. ${p.buildLogSuffix("authorizationEndpoint")}`;break}J(new L(ve.status,`Unable to retrieve auth string from ${z.toString()} endpoint - received status: ${ve.status} from ${S.endpoint}. ${Ue}`),null)}},ve.send(b),ve};function T(C){return K(W(C))}var A=String.fromCharCode,D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Q=function(C){var b=C.charCodeAt(0);return b<128?C:b<2048?A(192|b>>>6)+A(128|b&63):A(224|b>>>12&15)+A(128|b>>>6&63)+A(128|b&63)},W=function(C){return C.replace(/[^\x00-\x7F]/g,Q)},H=function(C){var b=[0,2,1][C.length%3],S=C.charCodeAt(0)<<16|(C.length>1?C.charCodeAt(1):0)<<8|(C.length>2?C.charCodeAt(2):0),z=[D.charAt(S>>>18),D.charAt(S>>>12&63),b>=2?"=":D.charAt(S>>>6&63),b>=1?"=":D.charAt(S&63)];return z.join("")},K=window.btoa||function(C){return C.replace(/[\s\S]{1,3}/g,H)};class F{constructor(b,S,z,J){this.clear=S,this.timer=b(()=>{this.timer&&(this.timer=J(this.timer))},z)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var ne=F;function fe(C){window.clearTimeout(C)}function _e(C){window.clearInterval(C)}class we extends ne{constructor(b,S){super(setTimeout,fe,b,function(z){return S(),null})}}class je extends ne{constructor(b,S){super(setInterval,_e,b,function(z){return S(),z})}}var re={now(){return Date.now?Date.now():new Date().valueOf()},defer(C){return new we(0,C)},method(C,...b){var S=Array.prototype.slice.call(arguments,1);return function(z){return z[C].apply(z,S.concat(arguments))}}},pe=re;function de(C,...b){for(var S=0;S<b.length;S++){var z=b[S];for(var J in z)z[J]&&z[J].constructor&&z[J].constructor===Object?C[J]=de(C[J]||{},z[J]):C[J]=z[J]}return C}function Ce(){for(var C=["Pusher"],b=0;b<arguments.length;b++)typeof arguments[b]=="string"?C.push(arguments[b]):C.push(De(arguments[b]));return C.join(" : ")}function Re(C,b){var S=Array.prototype.indexOf;if(C===null)return-1;if(S&&C.indexOf===S)return C.indexOf(b);for(var z=0,J=C.length;z<J;z++)if(C[z]===b)return z;return-1}function Oe(C,b){for(var S in C)Object.prototype.hasOwnProperty.call(C,S)&&b(C[S],S,C)}function Me(C){var b=[];return Oe(C,function(S,z){b.push(z)}),b}function He(C){var b=[];return Oe(C,function(S){b.push(S)}),b}function N(C,b,S){for(var z=0;z<C.length;z++)b.call(S||window,C[z],z,C)}function Y(C,b){for(var S=[],z=0;z<C.length;z++)S.push(b(C[z],z,C,S));return S}function Z(C,b){var S={};return Oe(C,function(z,J){S[J]=b(z)}),S}function O(C,b){b=b||function(J){return!!J};for(var S=[],z=0;z<C.length;z++)b(C[z],z,C,S)&&S.push(C[z]);return S}function U(C,b){var S={};return Oe(C,function(z,J){(b&&b(z,J,C,S)||z)&&(S[J]=z)}),S}function ie(C){var b=[];return Oe(C,function(S,z){b.push([z,S])}),b}function me(C,b){for(var S=0;S<C.length;S++)if(b(C[S],S,C))return!0;return!1}function ue(C,b){for(var S=0;S<C.length;S++)if(!b(C[S],S,C))return!1;return!0}function ge(C){return Z(C,function(b){return typeof b=="object"&&(b=De(b)),encodeURIComponent(T(b.toString()))})}function he(C){var b=U(C,function(z){return z!==void 0}),S=Y(ie(ge(b)),pe.method("join","=")).join("&");return S}function Te(C){var b=[],S=[];return function z(J,ve){var Ee,Ue,nt;switch(typeof J){case"object":if(!J)return null;for(Ee=0;Ee<b.length;Ee+=1)if(b[Ee]===J)return{$ref:S[Ee]};if(b.push(J),S.push(ve),Object.prototype.toString.apply(J)==="[object Array]")for(nt=[],Ee=0;Ee<J.length;Ee+=1)nt[Ee]=z(J[Ee],ve+"["+Ee+"]");else{nt={};for(Ue in J)Object.prototype.hasOwnProperty.call(J,Ue)&&(nt[Ue]=z(J[Ue],ve+"["+JSON.stringify(Ue)+"]"))}return nt;case"number":case"string":case"boolean":return J}}(C,"$")}function De(C){try{return JSON.stringify(C)}catch{return JSON.stringify(Te(C))}}class Le{constructor(){this.globalLog=b=>{window.console&&window.console.log&&window.console.log(b)}}debug(...b){this.log(this.globalLog,b)}warn(...b){this.log(this.globalLogWarn,b)}error(...b){this.log(this.globalLogError,b)}globalLogWarn(b){window.console&&window.console.warn?window.console.warn(b):this.globalLog(b)}globalLogError(b){window.console&&window.console.error?window.console.error(b):this.globalLogWarn(b)}log(b,...S){var z=Ce.apply(this,arguments);Md.log?Md.log(z):Md.logToConsole&&b.bind(this)(z)}}var Ae=new Le,We=function(C,b,S,z,J){(S.headers!==void 0||S.headersProvider!=null)&&Ae.warn(`To send headers with the ${z.toString()} request, you must use AJAX, rather than JSONP.`);var ve=C.nextAuthCallbackID.toString();C.nextAuthCallbackID++;var Ee=C.getDocument(),Ue=Ee.createElement("script");C.auth_callbacks[ve]=function(bt){J(null,bt)};var nt="Pusher.auth_callbacks['"+ve+"']";Ue.src=S.endpoint+"?callback="+encodeURIComponent(nt)+"&"+b;var ft=Ee.getElementsByTagName("head")[0]||Ee.documentElement;ft.insertBefore(Ue,ft.firstChild)},ot=We;class it{constructor(b){this.src=b}send(b){var S=this,z="Error loading "+S.src;S.script=document.createElement("script"),S.script.id=b.id,S.script.src=S.src,S.script.type="text/javascript",S.script.charset="UTF-8",S.script.addEventListener?(S.script.onerror=function(){b.callback(z)},S.script.onload=function(){b.callback(null)}):S.script.onreadystatechange=function(){(S.script.readyState==="loaded"||S.script.readyState==="complete")&&b.callback(null)},S.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(S.errorScript=document.createElement("script"),S.errorScript.id=b.id+"_error",S.errorScript.text=b.name+"('"+z+"');",S.script.async=S.errorScript.async=!1):S.script.async=!0;var J=document.getElementsByTagName("head")[0];J.insertBefore(S.script,J.firstChild),S.errorScript&&J.insertBefore(S.errorScript,S.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class pt{constructor(b,S){this.url=b,this.data=S}send(b){if(!this.request){var S=he(this.data),z=this.url+"/"+b.number+"?"+S;this.request=rt.createScriptRequest(z),this.request.send(b)}}cleanup(){this.request&&this.request.cleanup()}}var yt=function(C,b){return function(S,z){var J="http"+(b?"s":"")+"://",ve=J+(C.host||C.options.host)+C.options.path,Ee=rt.createJSONPRequest(ve,S),Ue=rt.ScriptReceivers.create(function(nt,ft){i.remove(Ue),Ee.cleanup(),ft&&ft.host&&(C.host=ft.host),z&&z(nt,ft)});Ee.send(Ue)}},Ot={name:"jsonp",getAgent:yt},un=Ot;function zt(C,b,S){var z=C+(b.useTLS?"s":""),J=b.useTLS?b.hostTLS:b.hostNonTLS;return z+"://"+J+S}function Ln(C,b){var S="/app/"+C,z="?protocol="+c.PROTOCOL+"&client=js&version="+c.VERSION+(b?"&"+b:"");return S+z}var se={getInitial:function(C,b){var S=(b.httpPath||"")+Ln(C,"flash=false");return zt("ws",b,S)}},ye={getInitial:function(C,b){var S=(b.httpPath||"/pusher")+Ln(C);return zt("http",b,S)}},ze={getInitial:function(C,b){return zt("http",b,b.httpPath||"/pusher")},getPath:function(C,b){return Ln(C)}};class qe{constructor(){this._callbacks={}}get(b){return this._callbacks[le(b)]}add(b,S,z){var J=le(b);this._callbacks[J]=this._callbacks[J]||[],this._callbacks[J].push({fn:S,context:z})}remove(b,S,z){if(!b&&!S&&!z){this._callbacks={};return}var J=b?[le(b)]:Me(this._callbacks);S||z?this.removeCallback(J,S,z):this.removeAllCallbacks(J)}removeCallback(b,S,z){N(b,function(J){this._callbacks[J]=O(this._callbacks[J]||[],function(ve){return S&&S!==ve.fn||z&&z!==ve.context}),this._callbacks[J].length===0&&delete this._callbacks[J]},this)}removeAllCallbacks(b){N(b,function(S){delete this._callbacks[S]},this)}}function le(C){return"_"+C}class xe{constructor(b){this.callbacks=new qe,this.global_callbacks=[],this.failThrough=b}bind(b,S,z){return this.callbacks.add(b,S,z),this}bind_global(b){return this.global_callbacks.push(b),this}unbind(b,S,z){return this.callbacks.remove(b,S,z),this}unbind_global(b){return b?(this.global_callbacks=O(this.global_callbacks||[],S=>S!==b),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(b,S,z){for(var J=0;J<this.global_callbacks.length;J++)this.global_callbacks[J](b,S);var ve=this.callbacks.get(b),Ee=[];if(z?Ee.push(S,z):S&&Ee.push(S),ve&&ve.length>0)for(var J=0;J<ve.length;J++)ve[J].fn.apply(ve[J].context||window,Ee);else this.failThrough&&this.failThrough(b,S);return this}}class Ge extends xe{constructor(b,S,z,J,ve){super(),this.initialize=rt.transportConnectionInitializer,this.hooks=b,this.name=S,this.priority=z,this.key=J,this.options=ve,this.state="new",this.timeline=ve.timeline,this.activityTimeout=ve.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var b=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(b,this.options)}catch(S){return pe.defer(()=>{this.onError(S),this.changeState("closed")}),!1}return this.bindListeners(),Ae.debug("Connecting",{transport:this.name,url:b}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(b){return this.state==="open"?(pe.defer(()=>{this.socket&&this.socket.send(b)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(b){this.emit("error",{type:"WebSocketError",error:b}),this.timeline.error(this.buildTimelineMessage({error:b.toString()}))}onClose(b){b?this.changeState("closed",{code:b.code,reason:b.reason,wasClean:b.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(b){this.emit("message",b)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=b=>{this.onError(b)},this.socket.onclose=b=>{this.onClose(b)},this.socket.onmessage=b=>{this.onMessage(b)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(b,S){this.state=b,this.timeline.info(this.buildTimelineMessage({state:b,params:S})),this.emit(b,S)}buildTimelineMessage(b){return de({cid:this.id},b)}}class at{constructor(b){this.hooks=b}isSupported(b){return this.hooks.isSupported(b)}createConnection(b,S,z,J){return new Ge(this.hooks,b,S,z,J)}}var gt=new at({urls:se,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!rt.getWebSocketAPI()},isSupported:function(){return!!rt.getWebSocketAPI()},getSocket:function(C){return rt.createWebSocket(C)}}),bn={urls:ye,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Dn=de({getSocket:function(C){return rt.HTTPFactory.createStreamingSocket(C)}},bn),Gn=de({getSocket:function(C){return rt.HTTPFactory.createPollingSocket(C)}},bn),Cn={isSupported:function(){return rt.isXHRSupported()}},Jt=new at(de({},Dn,Cn)),jl=new at(de({},Gn,Cn)),Nl={ws:gt,xhr_streaming:Jt,xhr_polling:jl},Lr=Nl,ke=new at({file:"sockjs",urls:ze,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(C,b){return new window.SockJS(C,null,{js_path:f.getPath("sockjs",{useTLS:b.useTLS}),ignore_null_origin:b.ignoreNullOrigin})},beforeOpen:function(C,b){C.send(JSON.stringify({path:b}))}}),is={isSupported:function(C){var b=rt.isXDRSupported(C.useTLS);return b}},xo=new at(de({},Dn,is)),Fl=new at(de({},Gn,is));Lr.xdr_streaming=xo,Lr.xdr_polling=Fl,Lr.sockjs=ke;var zl=Lr;class ql extends xe{constructor(){super();var b=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){b.emit("online")},!1),window.addEventListener("offline",function(){b.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Bl=new ql;class Ul{constructor(b,S,z){this.manager=b,this.transport=S,this.minPingDelay=z.minPingDelay,this.maxPingDelay=z.maxPingDelay,this.pingDelay=void 0}createConnection(b,S,z,J){J=de({},J,{activityTimeout:this.pingDelay});var ve=this.transport.createConnection(b,S,z,J),Ee=null,Ue=function(){ve.unbind("open",Ue),ve.bind("closed",nt),Ee=pe.now()},nt=ft=>{if(ve.unbind("closed",nt),ft.code===1002||ft.code===1003)this.manager.reportDeath();else if(!ft.wasClean&&Ee){var bt=pe.now()-Ee;bt<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(bt/2,this.minPingDelay))}};return ve.bind("open",Ue),ve}isSupported(b){return this.manager.isAlive()&&this.transport.isSupported(b)}}const Li={decodeMessage:function(C){try{var b=JSON.parse(C.data),S=b.data;if(typeof S=="string")try{S=JSON.parse(b.data)}catch{}var z={event:b.event,channel:b.channel,data:S};return b.user_id&&(z.user_id=b.user_id),z}catch(J){throw{type:"MessageParseError",error:J,data:C.data}}},encodeMessage:function(C){return JSON.stringify(C)},processHandshake:function(C){var b=Li.decodeMessage(C);if(b.event==="pusher:connection_established"){if(!b.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:b.data.socket_id,activityTimeout:b.data.activity_timeout*1e3}}else{if(b.event==="pusher:error")return{action:this.getCloseAction(b.data),error:this.getCloseError(b.data)};throw"Invalid handshake"}},getCloseAction:function(C){return C.code<4e3?C.code>=1002&&C.code<=1004?"backoff":null:C.code===4e3?"tls_only":C.code<4100?"refused":C.code<4200?"backoff":C.code<4300?"retry":"refused"},getCloseError:function(C){return C.code!==1e3&&C.code!==1001?{type:"PusherError",data:{code:C.code,message:C.reason||C.message}}:null}};var ys=Li;class Vl extends xe{constructor(b,S){super(),this.id=b,this.transport=S,this.activityTimeout=S.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(b){return this.transport.send(b)}send_event(b,S,z){var J={event:b,data:S};return z&&(J.channel=z),Ae.debug("Event sent",J),this.send(ys.encodeMessage(J))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var b={message:z=>{var J;try{J=ys.decodeMessage(z)}catch(ve){this.emit("error",{type:"MessageParseError",error:ve,data:z.data})}if(J!==void 0){switch(Ae.debug("Event recd",J),J.event){case"pusher:error":this.emit("error",{type:"PusherError",data:J.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",J)}},activity:()=>{this.emit("activity")},error:z=>{this.emit("error",z)},closed:z=>{S(),z&&z.code&&this.handleCloseEvent(z),this.transport=null,this.emit("closed")}},S=()=>{Oe(b,(z,J)=>{this.transport.unbind(J,z)})};Oe(b,(z,J)=>{this.transport.bind(J,z)})}handleCloseEvent(b){var S=ys.getCloseAction(b),z=ys.getCloseError(b);z&&this.emit("error",z),S&&this.emit(S,{action:S,error:z})}}class Hl{constructor(b,S){this.transport=b,this.callback=S,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=b=>{this.unbindListeners();var S;try{S=ys.processHandshake(b)}catch(z){this.finish("error",{error:z}),this.transport.close();return}S.action==="connected"?this.finish("connected",{connection:new Vl(S.id,this.transport),activityTimeout:S.activityTimeout}):(this.finish(S.action,{error:S.error}),this.transport.close())},this.onClosed=b=>{this.unbindListeners();var S=ys.getCloseAction(b)||"backoff",z=ys.getCloseError(b);this.finish(S,{error:z})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(b,S){this.callback(de({transport:this.transport,action:b},S))}}class Wl{constructor(b,S){this.timeline=b,this.options=S||{}}send(b,S){this.timeline.isEmpty()||this.timeline.send(rt.TimelineTransport.getAgent(this,b),S)}}class wo extends xe{constructor(b,S){super(function(z,J){Ae.debug("No callbacks on "+b+" for "+z)}),this.name=b,this.pusher=S,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(b,S){return S(null,{auth:""})}trigger(b,S){if(b.indexOf("client-")!==0)throw new _("Event '"+b+"' does not start with 'client-'");if(!this.subscribed){var z=p.buildLogSuffix("triggeringClientEvents");Ae.warn(`Client event triggered before channel 'subscription_succeeded' event . ${z}`)}return this.pusher.send_event(b,S,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(b){var S=b.event,z=b.data;if(S==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(b);else if(S==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(b);else if(S.indexOf("pusher_internal:")!==0){var J={};this.emit(S,z,J)}}handleSubscriptionSucceededEvent(b){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",b.data)}handleSubscriptionCountEvent(b){b.data.subscription_count&&(this.subscriptionCount=b.data.subscription_count),this.emit("pusher:subscription_count",b.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(b,S)=>{b?(this.subscriptionPending=!1,Ae.error(b.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:b.message},b instanceof L?{status:b.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:S.auth,channel_data:S.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class ko extends wo{authorize(b,S){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:b},S)}}class Gl{constructor(){this.reset()}get(b){return Object.prototype.hasOwnProperty.call(this.members,b)?{id:b,info:this.members[b]}:null}each(b){Oe(this.members,(S,z)=>{b(this.get(z))})}setMyID(b){this.myID=b}onSubscription(b){this.members=b.presence.hash,this.count=b.presence.count,this.me=this.get(this.myID)}addMember(b){return this.get(b.user_id)===null&&this.count++,this.members[b.user_id]=b.user_info,this.get(b.user_id)}removeMember(b){var S=this.get(b.user_id);return S&&(delete this.members[b.user_id],this.count--),S}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Kl=function(C,b,S,z){function J(ve){return ve instanceof S?ve:new S(function(Ee){Ee(ve)})}return new(S||(S=Promise))(function(ve,Ee){function Ue(bt){try{ft(z.next(bt))}catch(Vt){Ee(Vt)}}function nt(bt){try{ft(z.throw(bt))}catch(Vt){Ee(Vt)}}function ft(bt){bt.done?ve(bt.value):J(bt.value).then(Ue,nt)}ft((z=z.apply(C,b||[])).next())})};class Ql extends ko{constructor(b,S){super(b,S),this.members=new Gl}authorize(b,S){super.authorize(b,(z,J)=>Kl(this,void 0,void 0,function*(){if(!z)if(J=J,J.channel_data!=null){var ve=JSON.parse(J.channel_data);this.members.setMyID(ve.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let Ee=p.buildLogSuffix("authorizationEndpoint");Ae.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${Ee}, or the user should be signed in.`),S("Invalid auth response");return}S(z,J)}))}handleEvent(b){var S=b.event;if(S.indexOf("pusher_internal:")===0)this.handleInternalEvent(b);else{var z=b.data,J={};b.user_id&&(J.user_id=b.user_id),this.emit(S,z,J)}}handleInternalEvent(b){var S=b.event,z=b.data;switch(S){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(b);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(b);break;case"pusher_internal:member_added":var J=this.members.addMember(z);this.emit("pusher:member_added",J);break;case"pusher_internal:member_removed":var ve=this.members.removeMember(z);ve&&this.emit("pusher:member_removed",ve);break}}handleSubscriptionSucceededEvent(b){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(b.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Jl=r(1),So=r(0);class Xl extends ko{constructor(b,S,z){super(b,S),this.key=null,this.nacl=z}authorize(b,S){super.authorize(b,(z,J)=>{if(z){S(z,J);return}let ve=J.shared_secret;if(!ve){S(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(So.decode)(ve),delete J.shared_secret,S(null,J)})}trigger(b,S){throw new P("Client events are not currently supported for encrypted channels")}handleEvent(b){var S=b.event,z=b.data;if(S.indexOf("pusher_internal:")===0||S.indexOf("pusher:")===0){super.handleEvent(b);return}this.handleEncryptedEvent(S,z)}handleEncryptedEvent(b,S){if(!this.key){Ae.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!S.ciphertext||!S.nonce){Ae.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+S);return}let z=Object(So.decode)(S.ciphertext);if(z.length<this.nacl.secretbox.overheadLength){Ae.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${z.length}`);return}let J=Object(So.decode)(S.nonce);if(J.length<this.nacl.secretbox.nonceLength){Ae.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${J.length}`);return}let ve=this.nacl.secretbox.open(z,J,this.key);if(ve===null){Ae.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(Ee,Ue)=>{if(Ee){Ae.error(`Failed to make a request to the authEndpoint: ${Ue}. Unable to fetch new key, so dropping encrypted event`);return}if(ve=this.nacl.secretbox.open(z,J,this.key),ve===null){Ae.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(b,this.getDataToEmit(ve))});return}this.emit(b,this.getDataToEmit(ve))}getDataToEmit(b){let S=Object(Jl.decode)(b);try{return JSON.parse(S)}catch{return S}}}class Zl extends xe{constructor(b,S){super(),this.state="initialized",this.connection=null,this.key=b,this.options=S,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var z=rt.getNetwork();z.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),z.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(b){return this.connection?this.connection.send(b):!1}send_event(b,S,z){return this.connection?this.connection.send_event(b,S,z):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var b=(S,z)=>{S?this.runner=this.strategy.connect(0,b):z.action==="error"?(this.emit("error",{type:"HandshakeError",error:z.error}),this.timeline.error({handshakeError:z.error})):(this.abortConnecting(),this.handshakeCallbacks[z.action](z))};this.runner=this.strategy.connect(0,b)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var b=this.abandonConnection();b.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(b){this.timeline.info({action:"retry",delay:b}),b>0&&this.emit("connecting_in",Math.round(b/1e3)),this.retryTimer=new we(b||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new we(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new we(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new we(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(b){return de({},b,{message:S=>{this.resetActivityCheck(),this.emit("message",S)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:S=>{this.emit("error",S)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(b){return de({},b,{connected:S=>{this.activityTimeout=Math.min(this.options.activityTimeout,S.activityTimeout,S.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(S.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let b=S=>z=>{z.error&&this.emit("error",{type:"WebSocketError",error:z.error}),S(z)};return{tls_only:b(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:b(()=>{this.disconnect()}),backoff:b(()=>{this.retryIn(1e3)}),retry:b(()=>{this.retryIn(0)})}}setConnection(b){this.connection=b;for(var S in this.connectionCallbacks)this.connection.bind(S,this.connectionCallbacks[S]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var b in this.connectionCallbacks)this.connection.unbind(b,this.connectionCallbacks[b]);var S=this.connection;return this.connection=null,S}}updateState(b,S){var z=this.state;if(this.state=b,z!==b){var J=b;J==="connected"&&(J+=" with new socket ID "+S.socket_id),Ae.debug("State changed",z+" -> "+J),this.timeline.info({state:b,params:S}),this.emit("state_change",{previous:z,current:b}),this.emit(b,S)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Yl{constructor(){this.channels={}}add(b,S){return this.channels[b]||(this.channels[b]=ec(b,S)),this.channels[b]}all(){return He(this.channels)}find(b){return this.channels[b]}remove(b){var S=this.channels[b];return delete this.channels[b],S}disconnect(){Oe(this.channels,function(b){b.disconnect()})}}function ec(C,b){if(C.indexOf("private-encrypted-")===0){if(b.config.nacl)return Kn.createEncryptedChannel(C,b,b.config.nacl);let S="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",z=p.buildLogSuffix("encryptedChannelSupport");throw new P(`${S}. ${z}`)}else{if(C.indexOf("private-")===0)return Kn.createPrivateChannel(C,b);if(C.indexOf("presence-")===0)return Kn.createPresenceChannel(C,b);if(C.indexOf("#")===0)throw new k('Cannot create a channel with name "'+C+'".');return Kn.createChannel(C,b)}}var tc={createChannels(){return new Yl},createConnectionManager(C,b){return new Zl(C,b)},createChannel(C,b){return new wo(C,b)},createPrivateChannel(C,b){return new ko(C,b)},createPresenceChannel(C,b){return new Ql(C,b)},createEncryptedChannel(C,b,S){return new Xl(C,b,S)},createTimelineSender(C,b){return new Wl(C,b)},createHandshake(C,b){return new Hl(C,b)},createAssistantToTheTransportManager(C,b,S){return new Ul(C,b,S)}},Kn=tc;class Di{constructor(b){this.options=b||{},this.livesLeft=this.options.lives||1/0}getAssistant(b){return Kn.createAssistantToTheTransportManager(this,b,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class bs{constructor(b,S){this.strategies=b,this.loop=!!S.loop,this.failFast=!!S.failFast,this.timeout=S.timeout,this.timeoutLimit=S.timeoutLimit}isSupported(){return me(this.strategies,pe.method("isSupported"))}connect(b,S){var z=this.strategies,J=0,ve=this.timeout,Ee=null,Ue=(nt,ft)=>{ft?S(null,ft):(J=J+1,this.loop&&(J=J%z.length),J<z.length?(ve&&(ve=ve*2,this.timeoutLimit&&(ve=Math.min(ve,this.timeoutLimit))),Ee=this.tryStrategy(z[J],b,{timeout:ve,failFast:this.failFast},Ue)):S(!0))};return Ee=this.tryStrategy(z[J],b,{timeout:ve,failFast:this.failFast},Ue),{abort:function(){Ee.abort()},forceMinPriority:function(nt){b=nt,Ee&&Ee.forceMinPriority(nt)}}}tryStrategy(b,S,z,J){var ve=null,Ee=null;return z.timeout>0&&(ve=new we(z.timeout,function(){Ee.abort(),J(!0)})),Ee=b.connect(S,function(Ue,nt){Ue&&ve&&ve.isRunning()&&!z.failFast||(ve&&ve.ensureAborted(),J(Ue,nt))}),{abort:function(){ve&&ve.ensureAborted(),Ee.abort()},forceMinPriority:function(Ue){Ee.forceMinPriority(Ue)}}}}class $o{constructor(b){this.strategies=b}isSupported(){return me(this.strategies,pe.method("isSupported"))}connect(b,S){return nc(this.strategies,b,function(z,J){return function(ve,Ee){if(J[z].error=ve,ve){sc(J)&&S(!0);return}N(J,function(Ue){Ue.forceMinPriority(Ee.transport.priority)}),S(null,Ee)}})}}function nc(C,b,S){var z=Y(C,function(J,ve,Ee,Ue){return J.connect(b,S(ve,Ue))});return{abort:function(){N(z,rc)},forceMinPriority:function(J){N(z,function(ve){ve.forceMinPriority(J)})}}}function sc(C){return ue(C,function(b){return!!b.error})}function rc(C){!C.error&&!C.aborted&&(C.abort(),C.aborted=!0)}class oc{constructor(b,S,z){this.strategy=b,this.transports=S,this.ttl=z.ttl||1800*1e3,this.usingTLS=z.useTLS,this.timeline=z.timeline}isSupported(){return this.strategy.isSupported()}connect(b,S){var z=this.usingTLS,J=ic(z),ve=J&&J.cacheSkipCount?J.cacheSkipCount:0,Ee=[this.strategy];if(J&&J.timestamp+this.ttl>=pe.now()){var Ue=this.transports[J.transport];Ue&&(["ws","wss"].includes(J.transport)||ve>3?(this.timeline.info({cached:!0,transport:J.transport,latency:J.latency}),Ee.push(new bs([Ue],{timeout:J.latency*2+1e3,failFast:!0}))):ve++)}var nt=pe.now(),ft=Ee.pop().connect(b,function bt(Vt,fc){Vt?(ji(z),Ee.length>0?(nt=pe.now(),ft=Ee.pop().connect(b,bt)):S(Vt)):(ac(z,fc.transport.name,pe.now()-nt,ve),S(null,fc))});return{abort:function(){ft.abort()},forceMinPriority:function(bt){b=bt,ft&&ft.forceMinPriority(bt)}}}}function Co(C){return"pusherTransport"+(C?"TLS":"NonTLS")}function ic(C){var b=rt.getLocalStorage();if(b)try{var S=b[Co(C)];if(S)return JSON.parse(S)}catch{ji(C)}return null}function ac(C,b,S,z){var J=rt.getLocalStorage();if(J)try{J[Co(C)]=De({timestamp:pe.now(),transport:b,latency:S,cacheSkipCount:z})}catch{}}function ji(C){var b=rt.getLocalStorage();if(b)try{delete b[Co(C)]}catch{}}class Dr{constructor(b,{delay:S}){this.strategy=b,this.options={delay:S}}isSupported(){return this.strategy.isSupported()}connect(b,S){var z=this.strategy,J,ve=new we(this.options.delay,function(){J=z.connect(b,S)});return{abort:function(){ve.ensureAborted(),J&&J.abort()},forceMinPriority:function(Ee){b=Ee,J&&J.forceMinPriority(Ee)}}}}class dn{constructor(b,S,z){this.test=b,this.trueBranch=S,this.falseBranch=z}isSupported(){var b=this.test()?this.trueBranch:this.falseBranch;return b.isSupported()}connect(b,S){var z=this.test()?this.trueBranch:this.falseBranch;return z.connect(b,S)}}class jr{constructor(b){this.strategy=b}isSupported(){return this.strategy.isSupported()}connect(b,S){var z=this.strategy.connect(b,function(J,ve){ve&&z.abort(),S(J,ve)});return z}}function Tn(C){return function(){return C.isSupported()}}var Ms=function(C,b,S){var z={};function J(Jv,SK,$K,CK,TK){var Xv=S(C,Jv,SK,$K,CK,TK);return z[Jv]=Xv,Xv}var ve=Object.assign({},b,{hostNonTLS:C.wsHost+":"+C.wsPort,hostTLS:C.wsHost+":"+C.wssPort,httpPath:C.wsPath}),Ee=Object.assign({},ve,{useTLS:!0}),Ue=Object.assign({},b,{hostNonTLS:C.httpHost+":"+C.httpPort,hostTLS:C.httpHost+":"+C.httpsPort,httpPath:C.httpPath}),nt={loop:!0,timeout:15e3,timeoutLimit:6e4},ft=new Di({minPingDelay:1e4,maxPingDelay:C.activityTimeout}),bt=new Di({lives:2,minPingDelay:1e4,maxPingDelay:C.activityTimeout}),Vt=J("ws","ws",3,ve,ft),fc=J("wss","ws",3,Ee,ft),bK=J("sockjs","sockjs",1,Ue),Vv=J("xhr_streaming","xhr_streaming",1,Ue,bt),_K=J("xdr_streaming","xdr_streaming",1,Ue,bt),Hv=J("xhr_polling","xhr_polling",1,Ue),xK=J("xdr_polling","xdr_polling",1,Ue),Wv=new bs([Vt],nt),wK=new bs([fc],nt),kK=new bs([bK],nt),Gv=new bs([new dn(Tn(Vv),Vv,_K)],nt),Kv=new bs([new dn(Tn(Hv),Hv,xK)],nt),Qv=new bs([new dn(Tn(Gv),new $o([Gv,new Dr(Kv,{delay:4e3})]),Kv)],nt),Od=new dn(Tn(Qv),Qv,kK),Rd;return b.useTLS?Rd=new $o([Wv,new Dr(Od,{delay:2e3})]):Rd=new $o([Wv,new Dr(wK,{delay:2e3}),new Dr(Od,{delay:5e3})]),new oc(new jr(new dn(Tn(Vt),Rd,Od)),z,{ttl:18e5,timeline:b.timeline,useTLS:b.useTLS})},Qn=Ms,lc=function(){var C=this;C.timeline.info(C.buildTimelineMessage({transport:C.name+(C.options.useTLS?"s":"")})),C.hooks.isInitialized()?C.changeState("initialized"):C.hooks.file?(C.changeState("initializing"),f.load(C.hooks.file,{useTLS:C.options.useTLS},function(b,S){C.hooks.isInitialized()?(C.changeState("initialized"),S(!0)):(b&&C.onError(b),C.onClose(),S(!1))})):C.onClose()},cc={getRequest:function(C){var b=new window.XDomainRequest;return b.ontimeout=function(){C.emit("error",new w),C.close()},b.onerror=function(S){C.emit("error",S),C.close()},b.onprogress=function(){b.responseText&&b.responseText.length>0&&C.onChunk(200,b.responseText)},b.onload=function(){b.responseText&&b.responseText.length>0&&C.onChunk(200,b.responseText),C.emit("finished",200),C.close()},b},abortRequest:function(C){C.ontimeout=C.onerror=C.onprogress=C.onload=null,C.abort()}},uc=cc;const Fv=256*1024;class PG extends xe{constructor(b,S,z){super(),this.hooks=b,this.method=S,this.url=z}start(b){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},rt.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(b)}close(){this.unloader&&(rt.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(b,S){for(;;){var z=this.advanceBuffer(S);if(z)this.emit("chunk",{status:b,data:z});else break}this.isBufferTooLong(S)&&this.emit("buffer_too_long")}advanceBuffer(b){var S=b.slice(this.position),z=S.indexOf(`
`);return z!==-1?(this.position+=z+1,S.slice(0,z)):null}isBufferTooLong(b){return this.position===b.length&&b.length>Fv}}var Id;(function(C){C[C.CONNECTING=0]="CONNECTING",C[C.OPEN=1]="OPEN",C[C.CLOSED=3]="CLOSED"})(Id||(Id={}));var Nr=Id,MG=1;class OG{constructor(b,S){this.hooks=b,this.session=qv(1e3)+"/"+jG(8),this.location=RG(S),this.readyState=Nr.CONNECTING,this.openStream()}send(b){return this.sendRaw(JSON.stringify([b]))}ping(){this.hooks.sendHeartbeat(this)}close(b,S){this.onClose(b,S,!0)}sendRaw(b){if(this.readyState===Nr.OPEN)try{return rt.createSocketRequest("POST",zv(LG(this.location,this.session))).start(b),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(b,S,z){this.closeStream(),this.readyState=Nr.CLOSED,this.onclose&&this.onclose({code:b,reason:S,wasClean:z})}onChunk(b){if(b.status===200){this.readyState===Nr.OPEN&&this.onActivity();var S,z=b.data.slice(0,1);switch(z){case"o":S=JSON.parse(b.data.slice(1)||"{}"),this.onOpen(S);break;case"a":S=JSON.parse(b.data.slice(1)||"[]");for(var J=0;J<S.length;J++)this.onEvent(S[J]);break;case"m":S=JSON.parse(b.data.slice(1)||"null"),this.onEvent(S);break;case"h":this.hooks.onHeartbeat(this);break;case"c":S=JSON.parse(b.data.slice(1)||"[]"),this.onClose(S[0],S[1],!0);break}}}onOpen(b){this.readyState===Nr.CONNECTING?(b&&b.hostname&&(this.location.base=DG(this.location.base,b.hostname)),this.readyState=Nr.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(b){this.readyState===Nr.OPEN&&this.onmessage&&this.onmessage({data:b})}onActivity(){this.onactivity&&this.onactivity()}onError(b){this.onerror&&this.onerror(b)}openStream(){this.stream=rt.createSocketRequest("POST",zv(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",b=>{this.onChunk(b)}),this.stream.bind("finished",b=>{this.hooks.onFinished(this,b)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(b){pe.defer(()=>{this.onError(b),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function RG(C){var b=/([^\?]*)\/*(\??.*)/.exec(C);return{base:b[1],queryString:b[2]}}function LG(C,b){return C.base+"/"+b+"/xhr_send"}function zv(C){var b=C.indexOf("?")===-1?"?":"&";return C+b+"t="+ +new Date+"&n="+MG++}function DG(C,b){var S=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(C);return S[1]+b+S[3]}function qv(C){return rt.randomInt(C)}function jG(C){for(var b=[],S=0;S<C;S++)b.push(qv(32).toString(32));return b.join("")}var NG=OG,FG={getReceiveURL:function(C,b){return C.base+"/"+b+"/xhr_streaming"+C.queryString},onHeartbeat:function(C){C.sendRaw("[]")},sendHeartbeat:function(C){C.sendRaw("[]")},onFinished:function(C,b){C.onClose(1006,"Connection interrupted ("+b+")",!1)}},zG=FG,qG={getReceiveURL:function(C,b){return C.base+"/"+b+"/xhr"+C.queryString},onHeartbeat:function(){},sendHeartbeat:function(C){C.sendRaw("[]")},onFinished:function(C,b){b===200?C.reconnect():C.onClose(1006,"Connection interrupted ("+b+")",!1)}},BG=qG,UG={getRequest:function(C){var b=rt.getXHRAPI(),S=new b;return S.onreadystatechange=S.onprogress=function(){switch(S.readyState){case 3:S.responseText&&S.responseText.length>0&&C.onChunk(S.status,S.responseText);break;case 4:S.responseText&&S.responseText.length>0&&C.onChunk(S.status,S.responseText),C.emit("finished",S.status),C.close();break}},S},abortRequest:function(C){C.onreadystatechange=null,C.abort()}},VG=UG,HG={createStreamingSocket(C){return this.createSocket(zG,C)},createPollingSocket(C){return this.createSocket(BG,C)},createSocket(C,b){return new NG(C,b)},createXHR(C,b){return this.createRequest(VG,C,b)},createRequest(C,b,S){return new PG(C,b,S)}},Bv=HG;Bv.createXDR=function(C,b){return this.createRequest(uc,C,b)};var WG=Bv,GG={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:i,DependenciesReceivers:d,getDefaultStrategy:Qn,Transports:zl,transportConnectionInitializer:lc,HTTPFactory:WG,TimelineTransport:un,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(C){window.Pusher=C;var b=()=>{this.onDocumentBody(C.ready)};window.JSON?b():f.load("json2",{},b)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:X,jsonp:ot}},onDocumentBody(C){document.body?C():setTimeout(()=>{this.onDocumentBody(C)},0)},createJSONPRequest(C,b){return new pt(C,b)},createScriptRequest(C){return new it(C)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var C=this.getXHRAPI();return new C},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Bl},createWebSocket(C){var b=this.getWebSocketAPI();return new b(C)},createSocketRequest(C,b){if(this.isXHRSupported())return this.HTTPFactory.createXHR(C,b);if(this.isXDRSupported(b.indexOf("https:")===0))return this.HTTPFactory.createXDR(C,b);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var C=this.getXHRAPI();return!!C&&new C().withCredentials!==void 0},isXDRSupported(C){var b=C?"https:":"http:",S=this.getProtocol();return!!window.XDomainRequest&&S===b},addUnloadListener(C){window.addEventListener!==void 0?window.addEventListener("unload",C,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",C)},removeUnloadListener(C){window.addEventListener!==void 0?window.removeEventListener("unload",C,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",C)},randomInt(C){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*C)}},rt=GG,Pd;(function(C){C[C.ERROR=3]="ERROR",C[C.INFO=6]="INFO",C[C.DEBUG=7]="DEBUG"})(Pd||(Pd={}));var dc=Pd;class KG{constructor(b,S,z){this.key=b,this.session=S,this.events=[],this.options=z||{},this.sent=0,this.uniqueID=0}log(b,S){b<=this.options.level&&(this.events.push(de({},S,{timestamp:pe.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(b){this.log(dc.ERROR,b)}info(b){this.log(dc.INFO,b)}debug(b){this.log(dc.DEBUG,b)}isEmpty(){return this.events.length===0}send(b,S){var z=de({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],b(z,(J,ve)=>{J||this.sent++,S&&S(J,ve)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class QG{constructor(b,S,z,J){this.name=b,this.priority=S,this.transport=z,this.options=J||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(b,S){if(this.isSupported()){if(this.priority<b)return Uv(new $,S)}else return Uv(new M,S);var z=!1,J=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),ve=null,Ee=function(){J.unbind("initialized",Ee),J.connect()},Ue=function(){ve=Kn.createHandshake(J,function(Vt){z=!0,bt(),S(null,Vt)})},nt=function(Vt){bt(),S(Vt)},ft=function(){bt();var Vt;Vt=De(J),S(new E(Vt))},bt=function(){J.unbind("initialized",Ee),J.unbind("open",Ue),J.unbind("error",nt),J.unbind("closed",ft)};return J.bind("initialized",Ee),J.bind("open",Ue),J.bind("error",nt),J.bind("closed",ft),J.initialize(),{abort:()=>{z||(bt(),ve?ve.close():J.close())},forceMinPriority:Vt=>{z||this.priority<Vt&&(ve?ve.close():J.close())}}}}function Uv(C,b){return pe.defer(function(){b(C)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:JG}=rt;var XG=function(C,b,S,z,J,ve){var Ee=JG[S];if(!Ee)throw new I(S);var Ue=(!C.enabledTransports||Re(C.enabledTransports,b)!==-1)&&(!C.disabledTransports||Re(C.disabledTransports,b)===-1),nt;return Ue?(J=Object.assign({ignoreNullOrigin:C.ignoreNullOrigin},J),nt=new QG(b,z,ve?ve.getAssistant(Ee):Ee,J)):nt=ZG,nt},ZG={isSupported:function(){return!1},connect:function(C,b){var S=pe.defer(function(){b(new M)});return{abort:function(){S.ensureAborted()},forceMinPriority:function(){}}}};function YG(C){if(C==null)throw"You must pass an options object";if(C.cluster==null)throw"Options object must provide a cluster";"disableStats"in C&&Ae.warn("The disableStats option is deprecated in favor of enableStats")}const eK=(C,b)=>{var S="socket_id="+encodeURIComponent(C.socketId);for(var z in b.params)S+="&"+encodeURIComponent(z)+"="+encodeURIComponent(b.params[z]);if(b.paramsProvider!=null){let J=b.paramsProvider();for(var z in J)S+="&"+encodeURIComponent(z)+"="+encodeURIComponent(J[z])}return S};var tK=C=>{if(typeof rt.getAuthorizers()[C.transport]>"u")throw`'${C.transport}' is not a recognized auth transport`;return(b,S)=>{const z=eK(b,C);rt.getAuthorizers()[C.transport](rt,z,C,v.UserAuthentication,S)}};const nK=(C,b)=>{var S="socket_id="+encodeURIComponent(C.socketId);S+="&channel_name="+encodeURIComponent(C.channelName);for(var z in b.params)S+="&"+encodeURIComponent(z)+"="+encodeURIComponent(b.params[z]);if(b.paramsProvider!=null){let J=b.paramsProvider();for(var z in J)S+="&"+encodeURIComponent(z)+"="+encodeURIComponent(J[z])}return S};var sK=C=>{if(typeof rt.getAuthorizers()[C.transport]>"u")throw`'${C.transport}' is not a recognized auth transport`;return(b,S)=>{const z=nK(b,C);rt.getAuthorizers()[C.transport](rt,z,C,v.ChannelAuthorization,S)}};const rK=(C,b,S)=>{const z={authTransport:b.transport,authEndpoint:b.endpoint,auth:{params:b.params,headers:b.headers}};return(J,ve)=>{const Ee=C.channel(J.channelName);S(Ee,z).authorize(J.socketId,ve)}};function oK(C,b){let S={activityTimeout:C.activityTimeout||c.activityTimeout,cluster:C.cluster,httpPath:C.httpPath||c.httpPath,httpPort:C.httpPort||c.httpPort,httpsPort:C.httpsPort||c.httpsPort,pongTimeout:C.pongTimeout||c.pongTimeout,statsHost:C.statsHost||c.stats_host,unavailableTimeout:C.unavailableTimeout||c.unavailableTimeout,wsPath:C.wsPath||c.wsPath,wsPort:C.wsPort||c.wsPort,wssPort:C.wssPort||c.wssPort,enableStats:uK(C),httpHost:iK(C),useTLS:cK(C),wsHost:aK(C),userAuthenticator:dK(C),channelAuthorizer:hK(C,b)};return"disabledTransports"in C&&(S.disabledTransports=C.disabledTransports),"enabledTransports"in C&&(S.enabledTransports=C.enabledTransports),"ignoreNullOrigin"in C&&(S.ignoreNullOrigin=C.ignoreNullOrigin),"timelineParams"in C&&(S.timelineParams=C.timelineParams),"nacl"in C&&(S.nacl=C.nacl),S}function iK(C){return C.httpHost?C.httpHost:C.cluster?`sockjs-${C.cluster}.pusher.com`:c.httpHost}function aK(C){return C.wsHost?C.wsHost:lK(C.cluster)}function lK(C){return`ws-${C}.pusher.com`}function cK(C){return rt.getProtocol()==="https:"?!0:C.forceTLS!==!1}function uK(C){return"enableStats"in C?C.enableStats:"disableStats"in C?!C.disableStats:!1}function dK(C){const b=Object.assign(Object.assign({},c.userAuthentication),C.userAuthentication);return"customHandler"in b&&b.customHandler!=null?b.customHandler:tK(b)}function fK(C,b){let S;return"channelAuthorization"in C?S=Object.assign(Object.assign({},c.channelAuthorization),C.channelAuthorization):(S={transport:C.authTransport||c.authTransport,endpoint:C.authEndpoint||c.authEndpoint},"auth"in C&&("params"in C.auth&&(S.params=C.auth.params),"headers"in C.auth&&(S.headers=C.auth.headers)),"authorizer"in C&&(S.customHandler=rK(b,S,C.authorizer))),S}function hK(C,b){const S=fK(C,b);return"customHandler"in S&&S.customHandler!=null?S.customHandler:sK(S)}class pK extends xe{constructor(b){super(function(S,z){Ae.debug(`No callbacks on watchlist events for ${S}`)}),this.pusher=b,this.bindWatchlistInternalEvent()}handleEvent(b){b.data.events.forEach(S=>{this.emit(S.name,S)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",b=>{var S=b.event;S==="pusher_internal:watchlist_events"&&this.handleEvent(b)})}}function mK(){let C,b;return{promise:new Promise((z,J)=>{C=z,b=J}),resolve:C,reject:b}}var gK=mK;class vK extends xe{constructor(b){super(function(S,z){Ae.debug("No callbacks on user for "+S)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(S,z)=>{if(S){Ae.warn(`Error during signin: ${S}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:z.auth,user_data:z.user_data})},this.pusher=b,this.pusher.connection.bind("state_change",({previous:S,current:z})=>{S!=="connected"&&z==="connected"&&this._signin(),S==="connected"&&z!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new pK(b),this.pusher.connection.bind("message",S=>{var z=S.event;z==="pusher:signin_success"&&this._onSigninSuccess(S.data),this.serverToUserChannel&&this.serverToUserChannel.name===S.channel&&this.serverToUserChannel.handleEvent(S)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(b){try{this.user_data=JSON.parse(b.user_data)}catch{Ae.error(`Failed parsing user data after signin: ${b.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){Ae.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const b=S=>{S.subscriptionPending&&S.subscriptionCancelled?S.reinstateSubscription():!S.subscriptionPending&&this.pusher.connection.state==="connected"&&S.subscribe()};this.serverToUserChannel=new wo(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((S,z)=>{S.indexOf("pusher_internal:")===0||S.indexOf("pusher:")===0||this.emit(S,z)}),b(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:b,resolve:S}=gK();b.done=!1;const z=()=>{b.done=!0};b.then(z).catch(z),this.signinDonePromise=b,this._signinDoneResolve=S}}class fn{static ready(){fn.isReady=!0;for(var b=0,S=fn.instances.length;b<S;b++)fn.instances[b].connect()}static getClientFeatures(){return Me(U({ws:rt.Transports.ws},function(b){return b.isSupported({})}))}constructor(b,S){yK(b),YG(S),this.key=b,this.config=oK(S,this),this.channels=Kn.createChannels(),this.global_emitter=new xe,this.sessionID=rt.randomInt(1e9),this.timeline=new KG(this.key,this.sessionID,{cluster:this.config.cluster,features:fn.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:dc.INFO,version:c.VERSION}),this.config.enableStats&&(this.timelineSender=Kn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+rt.TimelineTransport.name}));var z=J=>rt.getDefaultStrategy(this.config,J,XG);this.connection=Kn.createConnectionManager(this.key,{getStrategy:z,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",J=>{var ve=J.event,Ee=ve.indexOf("pusher_internal:")===0;if(J.channel){var Ue=this.channel(J.channel);Ue&&Ue.handleEvent(J)}Ee||this.global_emitter.emit(J.event,J.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",J=>{Ae.warn(J)}),fn.instances.push(this),this.timeline.info({instances:fn.instances.length}),this.user=new vK(this),fn.isReady&&this.connect()}channel(b){return this.channels.find(b)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var b=this.connection.isUsingTLS(),S=this.timelineSender;this.timelineSenderTimer=new je(6e4,function(){S.send(b)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(b,S,z){return this.global_emitter.bind(b,S,z),this}unbind(b,S,z){return this.global_emitter.unbind(b,S,z),this}bind_global(b){return this.global_emitter.bind_global(b),this}unbind_global(b){return this.global_emitter.unbind_global(b),this}unbind_all(b){return this.global_emitter.unbind_all(),this}subscribeAll(){var b;for(b in this.channels.channels)this.channels.channels.hasOwnProperty(b)&&this.subscribe(b)}subscribe(b){var S=this.channels.add(b,this);return S.subscriptionPending&&S.subscriptionCancelled?S.reinstateSubscription():!S.subscriptionPending&&this.connection.state==="connected"&&S.subscribe(),S}unsubscribe(b){var S=this.channels.find(b);S&&S.subscriptionPending?S.cancelSubscription():(S=this.channels.remove(b),S&&S.subscribed&&S.unsubscribe())}send_event(b,S,z){return this.connection.send_event(b,S,z)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}fn.instances=[],fn.isReady=!1,fn.logToConsole=!1,fn.Runtime=rt,fn.ScriptReceivers=rt.ScriptReceivers,fn.DependenciesReceivers=rt.DependenciesReceivers,fn.auth_callbacks=rt.auth_callbacks;var Md=s.default=fn;function yK(C){if(C==null)throw"You must pass your app key when you instantiate Pusher."}rt.setup(fn)}])})})(qm);var Gw=qm.exports;const Kw=kp(Gw);window.Pusher=Kw;let Er=null;const Qw=e=>{const t=e.channel.bind(e);e.channel=function(n){const s=t(n);return s.whisper||(s.whisper=function(r,o){if(this.subscription&&this.subscription.trigger)return this.subscription.trigger(`client-${r}`,o);if(this.pusher&&this.pusher.trigger)return this.pusher.trigger(this.name,`client-${r}`,o);throw new Error("Unable to send whisper event")}),s}},Bm=()=>Er||(Er=new Ww({broadcaster:"pusher",key:"8N4y8QSdfIB3nh2D",wsHost:"websocket.geteasy.ai",wsPort:"443",wssPort:"443",forceTLS:!0,cluster:"mt1",encrypted:!0,enabledTransports:["ws","wss"],disableStats:!0,auth:{headers:{}},pusherOptions:{enableStats:!1,encrypted:!0,enabledTransports:["ws","wss"],clientEvents:{enabled:!0}}}),Qw(Er),window.Echo=Er,Er),Um=()=>Er,Jw="https://widget.geteasy.ai",Xw=dt({isMobile:!1}),_i=(e={})=>{const{openInit:t=!1,milliseconds:n}=e,s=768,{isMobile:r}=At(Xw),o=ee({get:()=>ae.state.chatState.isOpen,set:f=>ae.actions.updateChatState({isOpen:f})}),i=()=>{const f=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),h=window.innerWidth<=s,g="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;return[f,h,g].filter(Boolean).length>=2},a=()=>{r.value=i()},c=()=>{n&&!o.value&&setTimeout(()=>o.value=!0,n)};Pe(o,f=>{r.value&&(document.body.style.overflow=f?"hidden":"")});const u=()=>{o.value=!o.value};return(()=>{r.value=i(),!r.value&&(window.location.origin===Jw?c():ae.state.chatState.isOpen||(o.value=t,c()),window.addEventListener("resize",a))})(),{isOpen:o,toggleChatbot:u}},Zw=100,Ru={MESSAGE_SEND:"push.message.send",USER_LEFT:"push.user.left",USER_STATUS:"push.user.status"},Bt={CONVERSATION_PROCESSED:".pull.conversation.processed",MESSAGE_RECEIVED:".pull.message.received",MESSAGE_PROCESSED:".pull.message.processed",STREAM_START:".pull.stream.start",STREAM_DELTA:".pull.stream.delta",STREAM_DONE:".pull.stream.done",STREAM_CANCELLED:".pull.stream.cancelled",STREAM_MESSAGE_PROCESSED:".pull.stream.message.processed",ADMIN_TYPING:".client-push.admin.message.typing",ADMIN_VIEWED:".client-push.admin.conversation.viewed"};let Lu=null;function Yw(){const{getStorage:e,saveStorage:t}=Gs(),{isOpen:n}=_i();if(Lu)return Lu;const s=R(null),r=R(null),o=R([]),i=R(null),a=R(null),c=R(null),u=R(null),d=R(!1),f=R(!1),h=R(null),g=R(!1),p=R(!1),v=Ks(),_=R("unread"),k=R(null),w=R(!1),$=R(null),E=R(0),P=R(!1),I=ee(()=>{var se,ye,ze;return((ze=(ye=(se=ae==null?void 0:ae.state)==null?void 0:se.bot)==null?void 0:ye.config)==null?void 0:ze.livechat)===!0}),M=ee(()=>{var se,ye,ze;return((ze=(ye=(se=ae==null?void 0:ae.state)==null?void 0:se.bot)==null?void 0:ye.config)==null?void 0:ze.stream)===!0}),L=ee(()=>{var se,ye,ze,qe;return!!((qe=(ze=(ye=(se=ae==null?void 0:ae.state)==null?void 0:se.bot)==null?void 0:ye.config)==null?void 0:ze.delay_response)!=null&&qe.active)}),V=async()=>{if(!k.value)return;await kt(),await es(Zw);const se=k.value;se.scrollTo({top:se.scrollHeight,behavior:"smooth"})},X=()=>{const ye=new URLSearchParams(window.location.search).get("conversation_id");return ye&&!Gp(ye)?null:ye};(()=>{var se;try{i.value=e(Kt)??{},a.value=e(no)??{};const ye=X();if(ye){c.value=ye;return}ae.state.handle&&(c.value=i.value[ae.state.handle]??null,u.value=a.value[ae.state.handle]??null,u.value&&((se=ae.actions)==null||se.setGroupConversationId(u.value)))}catch{}})();const A=(se={})=>({user_id:v,handle:ae.state.handle,...se}),D=()=>{s.value&&(M.value&&(s.value.listen(Bt.STREAM_START,De),s.value.listen(Bt.STREAM_DELTA,Le),s.value.listen(Bt.STREAM_DONE,Ae),s.value.listen(Bt.STREAM_CANCELLED,We),s.value.listen(Bt.STREAM_MESSAGE_PROCESSED,ot)),s.value.listen(Bt.CONVERSATION_PROCESSED,it),s.value.listen(Bt.MESSAGE_RECEIVED,pt),s.value.listen(Bt.MESSAGE_PROCESSED,Ot),s.value.listen(Bt.ADMIN_TYPING,un),s.value.listen(Bt.ADMIN_VIEWED,zt))},Q=()=>{s.value&&(s.value.stopListening(Bt.MESSAGE_RECEIVED),s.value.stopListening(Bt.CONVERSATION_PROCESSED),s.value.stopListening(Bt.MESSAGE_PROCESSED),M.value&&(s.value.stopListening(Bt.STREAM_START),s.value.stopListening(Bt.STREAM_DELTA),s.value.stopListening(Bt.STREAM_DONE),s.value.stopListening(Bt.STREAM_CANCELLED),s.value.stopListening(Bt.STREAM_MESSAGE_PROCESSED)),s.value.stopListening(Bt.ADMIN_TYPING),s.value.stopListening(Bt.ADMIN_VIEWED))},W=()=>{const se=Um();if(!se){console.warn("Echo not initialized for connection tracking");return}const ye=se.connector.pusher.connection;d.value=ye.state==="connected",ye.bind("connected",()=>{d.value=!0}),ye.bind("disconnected",()=>{d.value=!1})},H=()=>{var xe,Ge,at,gt,bn,Dn,Gn;let se=((gt=(at=(Ge=(xe=ae==null?void 0:ae.state)==null?void 0:xe.bot)==null?void 0:Ge.config)==null?void 0:at.initialMessage)==null?void 0:gt.messages)??[];se=Object.values(se),Array.isArray(se)||(se=[]);const ye=se.map(Cn=>Cn.content),qe=mi(ye).map((Cn,Jt)=>({id:Jt,content_type:"text",sender_type:"assistant",content:Cn,is_welcome_message:!0})),le=(Gn=(Dn=(bn=ae==null?void 0:ae.state)==null?void 0:bn.bot)==null?void 0:Dn.config)==null?void 0:Gn.introductionMessage;return le&&typeof le=="string"&&qe.push({id:qe.length,content_type:"text",sender_type:"assistant",content:le,is_welcome_message:!0,is_introduction_message:!0}),qe},K=()=>{o.value=[];const se=H();o.value=gs(se)},F=(se=[])=>{let ye=se.filter(qe=>!qe.is_welcome_message);if(!(ye!=null&&ye.length))return;if(!ae.state.chatState.lastAssistantMessageId){const qe=[...ye].reverse().find(le=>le.sender_type==="assistant");qe!=null&&qe.id&&ae.actions.setLastAssistantMessageId(qe.id);return}const ze=ye.findIndex(qe=>qe.id===ae.state.chatState.lastAssistantMessageId);if(ze!==-1){const qe=ye.slice(ze+1).filter(le=>le.sender_type==="assistant"&&!le.is_welcome_message);if(qe.length>0){const le=ae.state.chatState.unreadMessageCount||0;ae.state.chatState.unreadMessageCount=le+qe.length;const xe=qe[qe.length-1];xe!=null&&xe.id&&(ae.state.chatState.lastAssistantMessageId=xe.id),ae.actions.saveChatState();const{isOpen:Ge}=_i();Ge.value||ae.actions.updateLastUnreadMessage(ye)}}},ne=se=>{if(!se.length)return[];const ye=se.reduce((qe,le)=>{const xe=qe.find(Ge=>Ge.type===le.type);return xe?(xe.files.push(le),xe.ids.push(le.file_id)):qe.push({type:le.type,message_id:fs(),files:[le],ids:[le.file_id]}),qe},[]),ze=["image","video","audio","file"];return[...ye.filter(qe=>ze.includes(qe.type)).sort((qe,le)=>ze.indexOf(qe.type)-ze.indexOf(le.type)),...ye.filter(qe=>!ze.includes(qe.type))]},fe=()=>new Promise((se,ye)=>{const ze=Um();if(!ze){ye(new Error("Echo not initialized"));return}const qe=ze.connector.pusher.connection;if(qe.state==="connected"){se();return}const le=setTimeout(()=>{qe.unbind("connected",xe),ye(new Error("Connection timeout"))},1e4),xe=()=>{clearTimeout(le),se()};qe.bind("connected",xe)}),_e=async()=>{if(I.value&&!(g.value||d.value&&s.value)){await pe(ae.state.handle);try{g.value=!0,h.value=null;const se=Bm();if(!se)throw new Error("Failed to initialize Echo");const ye=de();if(!ye){g.value=!1;return}const ze=`chat.${ye}`;s.value=se.channel(ze),D(),W(),await fe()}catch(se){throw h.value=se.message,se}finally{g.value=!1}}},we=async se=>{var ye,ze,qe;if(!(p.value||!I.value))try{p.value=!0,h.value=null,a.value||(a.value=e(no)??{}),c.value||(c.value=e(Kt,se)),u.value||(u.value=e(no,se),u.value&&((ye=ae.actions)==null||ye.setGroupConversationId(u.value)));const{data:le}=await Xe.liveChat.initConnection({handle:se,conversation_id:c.value,group_conversation_id:u.value});if(le!=null&&le.group_conversation_id?(u.value=le.group_conversation_id,a.value||(a.value={}),a.value[ae.state.handle]=u.value,t(no,a.value),(ze=ae.actions)==null||ze.setGroupConversationId(u.value)):le!=null&&le.conversation_id&&u.value,le!=null&&le.conversation_id&&(c.value=le.conversation_id,i.value||(i.value={}),i.value[ae.state.handle]=c.value,t(Kt,i.value)),((qe=le.messages)==null?void 0:qe.length)>0)if(o.value=gs(le.messages),ae.state.chatState.assistantProcessing){if(!ae.state.chatState.isOpen){const xe=[...le.messages].reverse().find(Ge=>Ge.sender_type==="assistant");xe&&(ae.actions.incrementUnreadMessageCount(),ae.actions.setLastAssistantMessageId(xe.id),ae.actions.updateLastUnreadMessage(le.messages))}ae.state.chatState.assistantProcessing=!1,ae.actions.saveChatState()}else F(le.messages);else K();le.conversation&&(r.value=le.conversation,await _e())}catch(le){throw h.value=le.message,le}finally{p.value=!1}},je=async()=>{let se=0;for(;p.value&&se<50;)await es(100),se+=1},re=se=>{var ye;if(se){if(!u.value){const ze=ae.state.groupConversationId||e(no,se);ze&&(u.value=ze,(ye=ae.actions)==null||ye.setGroupConversationId(ze))}if(!c.value){const ze=e(Kt,se);ze&&(c.value=ze)}}},pe=async se=>{if(!se)throw new Error("Missing bot handle");if(re(se),!(u.value||c.value)&&(await je(),re(se),!(u.value||c.value)&&(await we(se),re(se),!u.value&&!c.value)))throw new Error("Missing conversation id")},de=()=>u.value||c.value||null,Ce=async(se={})=>{var Ge,at;const{message:ye,files:ze=[],content_type:qe,replyTarget:le}=se,xe=ye?ye.trim():"";if(!(!xe&&ze.length===0)&&!(!L.value&&f.value))try{(r.value&&((Ge=r.value)==null?void 0:Ge.response_mode)==="auto"||!r.value)&&(f.value=!0,ae.state.chatState.assistantProcessing=!0,ae.actions.saveChatState()),o.value.forEach(Jt=>{Jt.sender_type==="user"&&delete Jt.is_last_message});const gt={message:xe,message_id:fs()},bn=ne(ze);if(bn.forEach(Jt=>{o.value.push({content:Jt.files,content_type:Jt.type,sender_type:"user",message_id:Jt.message_id,is_last_message:!xe})}),xe){const Jt={content:gt.message,message_id:gt.message_id,content_type:qe||"text",sender_type:"user",status:"sending",timestamp:new Date().toISOString(),is_last_message:!0};le&&(Jt.reply_to_message_id=le.id,Jt.quoted_message={id:le.id,content:le.content,content_type:le.content_type,sender_type:le.sender_type,sender_name:le.sender_name}),o.value.push(Jt)}const Dn=((at=o.value.filter(Jt=>Jt.sender_type==="user"))==null?void 0:at.length)||1;if(Qt.messageSend({content:gt.message,message_user_order:Dn,conversation_id:c.value}),_.value="unread",(async()=>(await es(1e3),_.value==="unread"&&(_.value="sent",await es(1500),_.value==="sent"&&(_.value="received",await es(2e3),_.value==="received"&&(_.value="read")))))(),await pe(ae.state.handle),!de())throw f.value=!1,new Error("Missing conversation id");if((!r.value||!s.value)&&await _e(),!s.value)throw f.value=!1,new Error("Channel not ready");const Cn={conversation_id:c.value,group_conversation_id:u.value,content:gt,attachments:bn,content_type:qe||"text",stream:M.value};le!=null&&le.id&&(Cn.reply_to_message_id=le.id),s.value.whisper(Ru.MESSAGE_SEND,A(Cn))}catch(gt){throw f.value=!1,_.value="unread",gt}},Re=()=>{s.value&&(de()&&`${de()}`,s.value.whisper(Ru.USER_LEFT,A()),Q(),s.value.unsubscribe()),s.value=null,d.value=!1},Oe=async()=>{var se;Re(),(se=ae==null?void 0:ae.state)!=null&&se.handle&&(await pe(ae.state.handle),await _e())},Me=async()=>{var ze;if(f.value)return;const se=o.value.filter(qe=>!qe.is_welcome_message).length>0,ye=c.value!==null||u.value!==null;!se||!ye||(Re(),o.value=[],c.value=null,u.value=null,r.value=null,delete i.value[ae.state.handle],delete a.value[ae.state.handle],localStorage.setItem(Kt,JSON.stringify(i.value)),localStorage.setItem(no,JSON.stringify(a.value)),ae.actions.resetChatState(),(ze=ae==null?void 0:ae.state)!=null&&ze.handle&&await we(ae.state.handle),Qt.conversationReset())},He=(se,ye)=>{if(typeof se=="string"&&typeof ye=="string")return se.trim()===ye.trim();try{return JSON.stringify(se)===JSON.stringify(ye)}catch{return!1}},N=(se,ye)=>{if(typeof se!="string"||!new Set(["product_cards","cards","address","iframe","follow_up","image","video","file","gif","sticker","business_card","attachment"]).has(ye))return se;try{return JSON.parse(se)}catch{return se}},Y=(se,ye)=>{const ze=se.content_type||"text";if(ze==="text"&&/widget\.easyaichat\.app\/embed\//.test(se.content))return null;let qe=N(se.content,ze);return new Set(["image","video","file","gif","sticker","business_card","attachment"]).has(ze)&&!Array.isArray(qe)&&(qe=[qe]),{id:ye,message_id:se.message_id,sender_type:se.sender_type||"assistant",conversation_id:se.conversation_id,timestamp:se.timestamp,is_streaming:!0,content:qe,content_type:ze,...se.audio_url?{audio_url:se.audio_url}:{}}},Z=se=>{const ye=o.value.filter(le=>le.is_streaming===!0);if(!ye.length)return null;const ze=ye.find(le=>le.content_type===se.content_type&&He(le.content,se.content));if(ze)return ze;const qe=ye.filter(le=>le.message_id===se.message_id);return qe.length===1?qe[0]:null},O=se=>{const ye=Z(se);if(ye){Object.assign(ye,{...se,is_streaming:!1}),yt(se);return}if(se.content_type==="product_cards"){const qe=o.value.map((le,xe)=>le.is_streaming&&le.content_type==="product_cards"?xe:-1).filter(le=>le!==-1);if(qe.length>0){const[le,...xe]=qe;Object.assign(o.value[le],{...se,is_streaming:!1}),xe.sort((Ge,at)=>at-Ge).forEach(Ge=>o.value.splice(Ge,1)),yt(se);return}}o.value.some(qe=>qe.content_type===se.content_type&&He(qe.content,se.content))||(o.value.push({...se,is_streaming:!1}),yt(se))},U=()=>{f.value=!1,ae.state.chatState.assistantProcessing=!1,ae.actions.saveChatState(),_.value="unread"},ie=se=>o.value.findIndex(ye=>ye.message_id===se&&ye.status==="sending"),me=se=>o.value.findIndex(ye=>ye.message_id===se&&ye.status==="received"),ue=se=>{const ye=me(se);return ye!==-1?ye:ie(se)},ge=(se,ye)=>{se!==-1&&(o.value[se]={...o.value[se],...ye})},he=se=>o.value.find(ye=>se.message_id&&ye.message_id===se.message_id?ye.sender_type===se.sender_type&&ye.content_type===se.content_type:!1),Te=se=>{he(se)||o.value.push(se)},De=se=>{const ye=ro(ae.state.handle);if(se!=null&&se.conversation_id&&se.conversation_id!==ye){P.value=!1;return}P.value=!0,f.value=!0,E.value=0},Le=se=>{if(P.value)try{const ye=`delta-${E.value}`;E.value++;const ze=Y(se,ye);if(!ze)return;o.value.push(ze),f.value=!1,_.value="unread",V()}catch{}},Ae=se=>{P.value&&(se.conversation&&(r.value=se.conversation),U(),E.value=0,P.value=!1)},We=se=>{P.value&&(E.value=0,U(),P.value=!1)},ot=se=>{var ye;(ye=se.message)!=null&&ye.message_id&&O(se.message),se.conversation&&(r.value=se.conversation,se.conversation.response_mode==="manual"&&U())},it=se=>{se.conversation&&(r.value=se.conversation)},pt=se=>{const ye=ro(ae.state.handle);se.conversation_id&&se.conversation_id!==ye&&(c.value=se.conversation_id,i.value||(i.value={}),i.value[ae.state.handle]=se.conversation_id,t(Kt,i.value));let ze=ie(se.message_id);ze!==-1&&ge(ze,{status:"received"})},yt=se=>{if(!(se!=null&&se.id)||se.sender_type!=="assistant")return;ae.actions.setLastAssistantMessageId(se.id);const{isOpen:ye}=_i();ye.value||(ae.actions.incrementUnreadMessageCount(),ae.actions.updateLastUnreadMessage(o.value))},Ot=se=>{if(se.message){const ye=ue(se.message.message_id);ye!==-1?ge(ye,{...se.message,status:"processed"}):he(se.message)||Te(se.message),yt(se.message),se.message.sender_type==="assistant"&&(!M.value||!P.value)&&(U(),V())}se.conversation&&(r.value=se.conversation)},un=se=>{se.toggle_typing!==void 0&&($.value=se.sender,w.value=se.toggle_typing,V())},zt=se=>{var ye;if(s.value){const ze=(ye=r.value)==null?void 0:ye.response_mode;s.value.whisper(Ru.USER_STATUS,A({is_processing:ze==="manual"?!1:f.value,response_mode:ze}))}};Pe(n,async se=>{var ye;se&&((ye=o.value)==null?void 0:ye.length)>0&&ae.actions.updateLastAssistantMessageIdFromMessages(o.value)});const Ln={conversation:r,messages:o,conversationId:c,groupConversationId:u,isConnected:d,isProcessing:f,connectionError:h,newMessageStatus:_,messagesContainerRef:k,agentTyping:w,currentAgent:$,fetchInit:we,connect:_e,sendMessage:Ce,disconnect:Re,reconnect:Oe,refreshConversation:Me};return Lu=Ln,Ln}const Js={TYPING:".agent.typing",BUBBLE:".agent.bubble",EXTRAS:".agent.extras",REACTION:".agent.react"},e2=2,t2=1200,n2={love:"❤️",like:"👍",haha:"🤣",wow:"😮",cry:"😭",dislike:"👎"},s2=e=>{if(!e||typeof e!="object")return null;const t=Object.keys(e)[0];return t?n2[t]??null:null},Du=["image","gif","video","audio","file"],r2=e=>Du.includes(e==null?void 0:e.type)?e.type:"file",o2=e=>{const t=fs();return{id:t,message_id:t,content:[e],content_type:r2(e),sender_type:"user",status:"sending",created_at:new Date().toISOString()}},i2=e=>{var n;const t=(n=e==null?void 0:e.metadata)==null?void 0:n.agent_media;return t!=null&&t.url?{...e,content_type:Du.includes(t.kind)?t.kind:"file",content:[{file_id:e.message_id??e.id,url:t.url,filename:t.filename??"",mime_type:t.mime??null,size:0}]}:Du.includes(e.content_type)&&!Array.isArray(e.content)?{...e,content_type:"text"}:e};let ju=null;function a2(){if(ju)return ju;const{getStorage:e,saveStorage:t}=Gs(),n=R(null),s=R(null),r=R([]),o=R(!1),i=R(!1),a=R(null);let c=null,u=0;const d=()=>new Date().toISOString(),f=re=>typeof re=="string"?re:JSON.stringify(re),h=()=>{r.value=gs(r.value.slice())},g=re=>{if(re.message_id!=null)return r.value.some(de=>de.message_id!=null&&String(de.message_id)===String(re.message_id)&&de.sender_type===re.sender_type||de.id!=null&&String(de.id)===String(re.message_id));const pe=f(re.content);return r.value.some(de=>de.message_id==null&&de.content_type===re.content_type&&de.sender_type===re.sender_type&&f(de.content)===pe)},p=()=>{u<=0&&!o.value&&(i.value=!1)},v=re=>{if(!n.value)return;const pe=e(Kt)??{};pe[n.value]=re,t(Kt,pe)},_=()=>{s.value||(s.value=fs(),v(s.value),F())},k=re=>{!re||re===s.value||(s.value=re,v(re),F())},w=()=>{if(!n.value)return;const re=e(Kt)??{};delete re[n.value],t(Kt,re)},$=()=>{var Ce,Re,Oe,Me,He;r.value=[];const re=((Oe=(Re=(Ce=B.bot)==null?void 0:Ce.config)==null?void 0:Re.initialMessage)==null?void 0:Oe.messages)??[],pe=Object.values(re).map(N=>N.content);mi(pe).forEach(N=>{r.value.push({content:N,content_type:"text",sender_type:"assistant",is_welcome_message:!0})});const de=(He=(Me=B.bot)==null?void 0:Me.config)==null?void 0:He.introductionMessage;de&&typeof de=="string"&&r.value.push({content:de,content_type:"text",sender_type:"assistant",is_welcome_message:!0,is_introduction_message:!0}),h()},E=()=>{ne(),s.value=null,w(),$()},P=async()=>{try{const{data:re}=await Xe.chat.getConversations({handle:n.value,conversationId:s.value});re!=null&&re.data&&(r.value=re.data.map(pe=>{const de=i2(pe);if(de.sender_type==="user"&&de.reactions){const Ce=s2(de.reactions);Ce&&(de.bot_reaction=Ce)}return de}),h())}catch{w(),s.value=null,ne(),$()}},I=re=>{if(!(re!=null&&re.message_id))return null;const pe=r.value.find(de=>de.id!=null&&String(de.id)===String(re.message_id)||de.message_id!=null&&String(de.message_id)===String(re.message_id));return pe?{id:pe.id,content:pe.content,content_type:pe.content_type,sender_type:pe.sender_type,sender_name:pe.sender_name||null}:{id:re.message_id,content:re.preview||"",content_type:"text",sender_type:"user"}},M=({content:re,message_id:pe,quote:de})=>{const Ce={id:pe??fs(),message_id:pe??null,conversation_id:s.value,content:re,content_type:"text",sender_type:"assistant",status:"processed",created_at:d(),quoted_message:I(de)};g(Ce)||(r.value.push(Ce),h())},L=re=>{if(!re||typeof re!="object")return null;if(re.type==="sources"){const pe=Array.isArray(re.sources)?re.sources:[];if(pe.length===0)return null;const de=pe.map(Ce=>({title:Ce.title,link:Ce.url}));return{id:fs(),content_type:"citations",content:JSON.stringify({elements:de}),sender_type:"assistant",status:"processed",created_at:d()}}if(re.type==="iframe"){const pe=re.iframe??{};return pe.src?{id:fs(),content_type:"iframe",content:JSON.stringify({iframe:{src:pe.src,width:pe.width??"100%",height:pe.height??"600px"}}),sender_type:"assistant",status:"processed",created_at:d()}:null}return null},V=re=>{const pe=L(re);!pe||g(pe)||(r.value.push(pe),h())},X=re=>{Array.isArray(re)&&re.forEach(pe=>M({content:pe.content,message_id:pe.message_id,quote:pe.quote}))},T=re=>{Array.isArray(re)&&re.forEach(pe=>V(pe))},A=re=>!(re!=null&&re.conversation_id)||re.conversation_id===s.value,D=re=>{A(re)&&(o.value=(re==null?void 0:re.typing)===!0,o.value?i.value=!0:p())},Q=re=>{A(re)&&M({content:re.content,message_id:re.message_id,quote:re.quote})},W=re=>{A(re)&&T(re.extras)},H=re=>{if(!A(re))return;const pe=re==null?void 0:re.emoji;if(!pe)return;const Ce=(re.message_id!=null?r.value.find(Re=>String(Re.id)===String(re.message_id)||String(Re.message_id)===String(re.message_id)):null)??[...r.value].reverse().find(Re=>Re.sender_type==="user");Ce&&(Ce.bot_reaction=pe,h())},K=()=>{a.value&&(a.value.stopListening(Js.TYPING),a.value.stopListening(Js.BUBBLE),a.value.stopListening(Js.EXTRAS),a.value.stopListening(Js.REACTION),a.value.unsubscribe(),a.value=null,c=null)},F=()=>{if(!s.value)return;const re=Bm();if(!re)return;const pe=`chat.${s.value}`;a.value&&c===pe||(a.value&&K(),a.value=re.channel(pe),c=pe,a.value.listen(Js.TYPING,D),a.value.listen(Js.BUBBLE,Q),a.value.listen(Js.EXTRAS,W),a.value.listen(Js.REACTION,H))},ne=()=>{K()},fe=async re=>{n.value=re??null;const pe=Kp()??(n.value?e(Kt,n.value):null);if(!pe){$();return}s.value=pe,F(),await P()},_e=async re=>{let pe=0;for(;;){const de=await Xe.chat.sendAgentMessage(re);if(de.status!=="busy"||pe>=e2)return de;pe+=1,await es(t2*pe)}},je={onInit:fe,send:async({message:re,files:pe,replyTarget:de}={})=>{const Ce=typeof re=="string"?re.trim():"",Re=(de==null?void 0:de.id)!=null&&/^\d+$/.test(String(de.id))?Number(de.id):null,Oe=Array.isArray(pe)?pe.filter(O=>O==null?void 0:O.file_id):[],Me=Oe.map(O=>O.file_id);if(!Ce&&Me.length===0)return;i.value=!0,r.value.forEach(O=>{O.sender_type==="user"&&delete O.is_last_message});const He=Oe.map(o2);He.forEach(O=>r.value.push(O));let N=null;if(Ce){const O=fs();N={id:O,message_id:O,content:Ce,content_type:"text",sender_type:"user",status:"sending",created_at:d()},r.value.push(N)}const Y=N??He[He.length-1];Y&&(Y.is_last_message=!0),Re&&Y&&(Y.reply_to_message_id=Re,Y.quoted_message={id:de.id,content:de.content,content_type:de.content_type,sender_type:de.sender_type,sender_name:de.sender_name||null}),h(),_();const Z=O=>{He.forEach(U=>U.status=O),N&&(N.status=O)};u+=1;try{const O=await _e({handle:n.value,query:Ce||void 0,conversation_id:s.value,reply_to_message_id:Re??void 0,attachments:Me.length>0?Me:void 0});if(O.status==="busy"){Z("failed");return}O.conversation_id&&k(O.conversation_id),Z("sent"),O.status==="ok"&&(X(O.bubbles),T(O.extras),(O.extras??[]).forEach(U=>{(U==null?void 0:U.type)==="react"&&H({...U,conversation_id:s.value})}))}catch{Z("failed")}finally{u-=1,p()}},refreshConversation:E,messages:r,conversationId:s,agentTyping:o,isProcessing:i,connect:F,disconnect:ne};return ju=je,je}const l2=dt({widgets:{},selectedWidgetEmbed:null,widgetSettingType:null});function Xs(){const{widgetSettingType:e,widgets:t,selectedWidgetEmbed:n}=At(l2),{bot:s}=At(ae.state),r=(d,f)=>(d.name==="demand"&&!d.options&&(d.options=["Tư vấn","Yêu cầu báo giá","Trở thành đối tác","Khiếu nại","Hỗ trợ kỹ thuật","Khác"]),{...d,label:typeof d.label=="object"&&d.label!==null?d.label[f]:d.label,placeholder:typeof d.placeholder=="object"&&d.placeholder!==null?d.placeholder[f]:d.placeholder,hint:typeof d.hint=="object"&&d.hint!==null?d.hint[f]:d.hint,options:Array.isArray(d.options)?d.options:typeof d.options=="object"&&d.options!==null?d.options[f]:d.options}),o=()=>{const d=window.location.href,f=/\/embed\/([^\/]+)\/([a-f0-9-]+)(\?(.+))?/,h=d.match(f);if(h){const g=h[1],p=h[2],v=h[4]||"",_=v?v.split("&").reduce((k,w)=>{const[$,E]=w.split("=");return $&&E&&(k[$]=decodeURIComponent(E)),k},{}):{};return{widgetId:p,queryObject:_,handle:g}}else return console.error("URL does not match expected format"),{widgetId:null,queryObject:{},handle:null}},i=async(d=[])=>{const f=gi.state.locale;if(d.length===0)return;const h=d.reduce((g,p)=>p.active?(p.fields&&Array.isArray(p.fields)&&(p.fields=p.fields.map(v=>r(v,f))),{...g,[p.type]:p}):g,{});t.value=h},a=(d=[])=>{const{widgetId:f,handle:h}=o(),g=d.find(p=>p.id===f);if(g){n.value=g;return}n.value=h===Mn?null:d.find(p=>p.type==="contact")};function c(d){try{const h=new URL(window.location.href).searchParams.get(d);return h?decodeURIComponent(h):null}catch(f){return console.error(`Error extracting ${d}:`,f),null}}const u=async d=>{var f,h;try{if(!d||!((f=B.bot.widgets)!=null&&f.length))return;const g=pi(B.bot.widgets),p=g.findIndex($=>$.id===d.id);if(p===-1)return;g[p]=d;const v=(h=B.bot)==null?void 0:h.handle,_=c("temp_token"),k=c("expires");if(!v||!_)throw new Error("Missing data: handle or token is required");const w=await Xe.widget.updateAll({handle:v,token:_,widgets:g,expires:k});console.log("Response update bot widgets = ",w)}catch(g){throw new Error(g)}};return Qe(()=>{const d=new URLSearchParams(window.location.search);e.value=d.get("widget_setting_type")}),Pe(s,()=>{var d;(d=s.value)!=null&&d.widgets&&i(s.value.widgets)},{immediate:!0}),{widgets:t,selectedWidgetEmbed:n,getWidgetsActive:i,getSelectedWidgetByEmbedLink:a,updateBotWidgets:u,widgetSettingType:e}}const c2={SCROLL_BOTTOM_DELAY:100},u2=dt({pendingMessage:null,currentMessage:""});function Ar(e={}){const{pendingMessage:t,currentMessage:n}=At(u2),{widgets:s}=Xs(),r=ee(()=>{var w,$,E;return((E=($=(w=ae==null?void 0:ae.state)==null?void 0:w.bot)==null?void 0:$.config)==null?void 0:E.livechat)===!0}),o=ae.getters.isAgentEnabled,i=ee(()=>o.value?"agent":r.value?"livechat":"http"),a=Yw(),c=Om(),u=a2(),d=R(!1),f=R(null),h=R(null);Pe(()=>a.currentAgent.value,async w=>{var E,P,I,M;const $=(M=(I=(P=(E=ae==null?void 0:ae.state)==null?void 0:E.bot)==null?void 0:P.config)==null?void 0:I.ui)==null?void 0:M.logo;if(!w||!w.avatar){h.value=$;return}try{(await Cr(w.avatar)).status?h.value=w.avatar:h.value=$}catch{h.value=$}},{immediate:!0}),Pe(f,w=>{w&&(c.messagesContainerRef.value=w,a.messagesContainerRef.value=w)},{deep:!0}),Qe(async()=>{var $,E;const w=(E=($=ae==null?void 0:ae.state)==null?void 0:$.bot)==null?void 0:E.handle;w&&(o.value?await u.onInit(w):r.value&&await a.fetchInit(w))});const g=async()=>{await es(1200);const w=ae.state.chatState.visitor,$=s.value.widget_form_render_pre_send,E=parseInt($==null?void 0:$.maximumMessageCount)||1,I=(r.value?a.messages:c.messages).value.filter(M=>M.sender_type==="user").length;$&&!w&&I>=E&&(ae.state.isOpenLeadForm=!0)},p=async w=>{g(),ae.actions.updateChatState({viewTab:"conversations"});const $=o.value?u.send(w):r.value?a.sendMessage(w):c.send(w);return k(),await $},v=async(w={})=>{if(!(o.value||r.value))return await c.fetchMessages(w)},_=async()=>o.value?u.refreshConversation():r.value?await a.refreshConversation():await c.refreshConversation();async function k(w={}){var E;if(!f.value)return;await kt(),await es(w.delay||c2.SCROLL_BOTTOM_DELAY);const $=((E=f.value)==null?void 0:E.scrollHeight)||0;f.value.scrollTo({top:w.top||$,behavior:w.behavior||"smooth"})}return{isLiveChatEnabled:r,isAgentEnabled:o,chatService:i,pendingMessage:t,currentMessage:n,messages:o.value?u.messages:r.value?a.messages:c.messages,conversationId:o.value?u.conversationId:r.value?a.conversationId:c.conversationId,conversation:r.value?a.conversation:null,assistantProcessing:o.value?d:r.value?a.isProcessing:c.assistantProcessing,newMessageStatus:r.value?a.newMessageStatus:c.newMessageStatus,storageConversations:c.storageConversations,send:p,fetchMessages:v,refreshConversation:_,initializeMessages:c.initializeMessages,clickQuickPrompt:c.clickQuickPrompt,messagesContainerRef:f,scrollToBottom:k,isConnected:a.isConnected,connectionError:a.connectionError,agentTyping:o.value?u.agentTyping:a.agentTyping,currentAgent:a.currentAgent,validatedAgentAvatar:h}}/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var rl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const d2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ne=(e,t)=>({size:n,strokeWidth:s=2,absoluteStrokeWidth:r,color:o,class:i,...a},{attrs:c,slots:u})=>fr("svg",{...rl,width:n||rl.width,height:n||rl.height,stroke:o||rl.stroke,"stroke-width":r?Number(s)*24/Number(n):s,...c,class:["lucide",`lucide-${d2(e)}`],...a},[...t.map(d=>fr(...d)),...u.default?[u.default()]:[]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vm=Ne("ArrowRightIcon",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nu=Ne("AudioLinesIcon",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const f2=Ne("BookOpenTextIcon",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}],["path",{d:"M6 8h2",key:"30oboj"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M16 12h2",key:"7q9ll5"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const h2=Ne("BookOpenIcon",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hm=Ne("CalendarDaysIcon",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ol=Ne("CheckIcon",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const uo=Ne("ChevronDownIcon",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fo=Ne("ChevronLeftIcon",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ir=Ne("ChevronRightIcon",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wm=Ne("ChevronUpIcon",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gm=Ne("CircleAlertIcon",[["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"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const p2=Ne("CircleCheckBigIcon",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const il=Ne("CircleCheckIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Km=Ne("CircleHelpIcon",[["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"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const m2=Ne("CirclePlusIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const g2=Ne("CircleXIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fu=Ne("ClipboardCheckIcon",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const v2=Ne("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qm=Ne("DownloadIcon",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const y2=Ne("EyeIcon",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const b2=Ne("FileSpreadsheetIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zs=Ne("FileTextIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _2=Ne("FileTypeIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const x2=Ne("GiftIcon",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const w2=Ne("GlobeIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const k2=Ne("HandCoinsIcon",[["path",{d:"M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17",key:"geh8rc"}],["path",{d:"m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"1fto5m"}],["path",{d:"m2 16 6 6",key:"1pfhp9"}],["circle",{cx:"16",cy:"9",r:"2.9",key:"1n0dlu"}],["circle",{cx:"6",cy:"5",r:"3",key:"151irh"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jm=Ne("HeadsetIcon",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const S2=Ne("HeartIcon",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $2=Ne("HomeIcon",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const C2=Ne("InfoIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const T2=Ne("LoaderCircleIcon",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const E2=Ne("LoaderIcon",[["line",{x1:"12",x2:"12",y1:"2",y2:"6",key:"gza1u7"}],["line",{x1:"12",x2:"12",y1:"18",y2:"22",key:"1qhbu9"}],["line",{x1:"4.93",x2:"7.76",y1:"4.93",y2:"7.76",key:"xae44r"}],["line",{x1:"16.24",x2:"19.07",y1:"16.24",y2:"19.07",key:"bxnmvf"}],["line",{x1:"2",x2:"6",y1:"12",y2:"12",key:"89khin"}],["line",{x1:"18",x2:"22",y1:"12",y2:"12",key:"pb8tfm"}],["line",{x1:"4.93",x2:"7.76",y1:"19.07",y2:"16.24",key:"1uxjnu"}],["line",{x1:"16.24",x2:"19.07",y1:"7.76",y2:"4.93",key:"6duxfx"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const A2=Ne("MailIcon",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const I2=Ne("MapPinIcon",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const P2=Ne("MenuIcon",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const M2=Ne("MessageCircleMoreIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const O2=Ne("MessageCircleQuestionIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["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"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xm=Ne("MessageCircleIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const R2=Ne("MicOffIcon",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zm=Ne("MicIcon",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const al=Ne("MinusIcon",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ym=Ne("MusicIcon",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zu=Ne("PackageIcon",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qu=Ne("PaperclipIcon",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const L2=Ne("PauseIcon",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const D2=Ne("PenLineIcon",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const j2=Ne("PencilLineIcon",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ll=Ne("PhoneCallIcon",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eg=Ne("PhoneIcon",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tg=Ne("PlayIcon",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ng=Ne("PlusIcon",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const N2=Ne("QuoteIcon",[["path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z",key:"4rm80e"}],["path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",key:"10za9r"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const F2=Ne("RefreshCcwIcon",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cl=Ne("SearchIcon",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sg=Ne("SendHorizontalIcon",[["path",{d:"m3 3 3 9-3 9 19-9Z",key:"1aobqy"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bu=Ne("SendIcon",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cn=Ne("ShoppingBagIcon",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const z2=Ne("SquarePenIcon",[["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.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ul=Ne("StarIcon",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rg=Ne("TicketPercentIcon",[["path",{d:"M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"1l48ns"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const og=Ne("Trash2Icon",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const q2=Ne("TriangleAlertIcon",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const B2=Ne("TruckIcon",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ig=Ne("UserRoundIcon",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ag=Ne("VideoIcon",[["path",{d:"m22 8-6 4 6 4V8Z",key:"50v9me"}],["rect",{width:"14",height:"12",x:"2",y:"6",rx:"2",ry:"2",key:"1rqjg6"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Es=Ne("XIcon",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Ke=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},U2=e=>(nn("data-v-76058769"),e=e(),sn(),e),V2={class:"relative reaction-container"},H2={key:0,class:"select-none selected-reactions mr-2 flex items-center gap-1 bg-white/90 px-2 py-0.5 h-[24px] border border-gray-100 shadow-sm rounded-full transition-transform duration-150 ease-in-out hover:scale-105 will-change-transform-opacity"},W2={class:"text-xs font-medium leading-[100%] tracking-tight text-gray-700"},G2={key:0,class:"leading-[100%]"},K2={class:"flex justify-center items-center px-2 py-0.5 rounded-3xl select-none bg-white/90",style:{"box-shadow":`rgba(0, 0, 0, 0.1) 0px 1px 3px 0px,
rgba(0, 0, 0, 0.06) 0px 1px 2px 0px`}},Q2=["onClick"],J2={class:"custom-tooltip absolute -top-[25px] left-1/2 -translate-x-1/2 scale-[0.8] bg-black/75 text-white text-[10px] px-1.5 py-0.5 rounded whitespace-nowrap opacity-0 pointer-events-none transition-[opacity,transform] duration-200 ease-in-out z-[60] hidden hover-hover:group-hover/emoji:opacity-100 hover-hover:group-hover/emoji:scale-100 after:content-[''] after:absolute after:top-full after:left-1/2 after:-ml-1 after:border-4 after:border-solid after:border-t-black/75 after:border-x-transparent after:border-b-transparent"},X2=U2(()=>l("div",{class:"custom-tooltip absolute -top-[25px] left-1/2 -translate-x-1/2 scale-[0.8] bg-black/75 text-white text-[10px] px-1.5 py-0.5 rounded whitespace-nowrap opacity-0 pointer-events-none transition-[opacity,transform] duration-200 ease-in-out z-[60] hidden hover-hover:group-hover/close:opacity-100 hover-hover:group-hover/close:scale-100 after:content-[''] after:absolute after:top-full after:left-1/2 after:-ml-1 after:border-4 after:border-solid after:border-t-black/75 after:border-x-transparent after:border-b-transparent"}," Xóa ",-1)),Z2={key:0,class:"absolute top-0 left-0 w-full h-full pointer-events-none z-50 overflow-visible"},Y2=350,ek=Ke({__name:"MessageReactions",props:{messageId:{type:[String,Number]},conversationId:{type:[String,Number]},position:{type:String,default:"left"},messageReactions:{type:Object,default:()=>({})},chatViewRef:{type:Object,default:null}},emits:["update:messageReactions"],setup(e,{expose:t,emit:n}){const s=e,r=n,o=R(!1),i=R([]),a=R(!1),c=R(s.messageReactions),u=R(null),d={love:"❤️",like:"👍",haha:"🤣",wow:"😮",cry:"😭",dislike:"👎"},f=[{id:"love",emoji:"❤️",label:"Yêu thích"},{id:"like",emoji:"👍",label:"Thích"},{id:"haha",emoji:"🤣",label:"Haha"},{id:"wow",emoji:"😮",label:"Wow"},{id:"cry",emoji:"😭",label:"Buồn"},{id:"dislike",emoji:"👎",label:"Không thích"}],h=()=>{const Q=Math.random()*Math.PI*2,W=30+Math.random()*60,H=Math.cos(Q)*W,K=Math.sin(Q)*W,F=.4+Math.random()*.3,ne=Math.random()*.15,fe=12+Math.random()*8,_e=.6+Math.random()*.4;return{"--x":`${H}px`,"--y":`${K}px`,"--duration":`${F}s`,"--delay":`${ne}s`,"--size":`${fe}px`,"--opacity":_e}};let g;const p=()=>{a.value=!1,setTimeout(()=>{a.value=!0,g&&clearTimeout(g),g=setTimeout(()=>{a.value=!1},800)},10)},v=ee(()=>Object.keys(c.value||{}).slice(0,3).map(W=>({ui:d[W],id:W}))),_=ee(()=>Object.values(c.value||{}).reduce((Q,W)=>Q+W,0)),k=Q=>{u.value=Q,i.value=[Q],o.value=!1,T(),p(),Qt.interaction({type:"reaction",conversationId:s.conversationId,...Q})},w=()=>{if(u.value){T(),p(),Qt.interaction({type:"reaction",conversationId:s.conversationId,...u.value});return}const Q=f.find(W=>W.id==="love");if(Q){u.value=Q,i.value=[Q],c.value||(c.value={});const W={...c.value};W[Q.id]&&delete W[Q.id],c.value={[Q.id]:(c.value[Q.id]||0)+1,...W},T(),p()}},$=()=>{u.value=null,i.value=[],o.value=!1,A()};Lt(()=>{g&&clearTimeout(g)});const E=()=>{document.dispatchEvent(new CustomEvent("close-all-emoji-pickers",{detail:{except:s.messageId}})),o.value=!0},P=Q=>{const W=document.querySelector(".emoji-picker");W&&!W.contains(Q.target)&&(o.value=!1)};let I,M;Qe(()=>{if(document.addEventListener("click",P,{passive:!0}),s.chatViewRef&&(I=Q=>{if(!Ts()||!o.value)return;const W=s.chatViewRef.querySelector(".emoji-picker.show-emoji");if(!W)return;const H=Q.target.closest(".reaction-container"),K=W.closest(".reaction-container");K&&H!==K&&(o.value=!1)},s.chatViewRef.addEventListener("touchstart",I,{passive:!0}),M=Q=>{var H;((H=Q.detail)==null?void 0:H.except)!==s.messageId&&(o.value=!1)},s.chatViewRef.addEventListener("close-all-emoji-pickers",M)),c.value&&Object.keys(c.value).length>0){const Q=Object.keys(c.value)[0],W=f.find(H=>H.id===Q);W&&(u.value=W,i.value=[W])}}),Lt(()=>{document.removeEventListener("click",P),s.chatViewRef&&(I&&s.chatViewRef.removeEventListener("touchstart",I),M&&s.chatViewRef.removeEventListener("close-all-emoji-pickers",M)),g&&clearTimeout(g)});let L;const V=()=>{Ts()&&(L=setTimeout(()=>{E()},Y2))},X=()=>{Ts()&&L&&clearTimeout(L)},T=async()=>{try{if(!D.value){console.error("Missing required props: messageId or conversationId");return}if(!u.value)return;const{data:Q}=await Xe.reaction.update({conversationId:s.conversationId,messageId:s.messageId,form:{reaction:u.value.id}});if(Q.success){const W=Q.data.reactions;if(r("update:messageReactions",Q.data.reactions),u.value&&W[u.value.id]){const H=u.value.id,K={[H]:W[H]};Object.keys(W).forEach(F=>{F!==H&&(K[F]=W[F])}),c.value=K}else c.value=W}}catch(Q){console.error("Error saving reaction to message:",Q)}},A=async()=>{try{if(!D.value){console.error("Missing required props: messageId or conversationId");return}const{data:Q}=await Xe.reaction.removeAll({conversationId:s.conversationId,messageId:s.messageId});Q.success&&(c.value={},u.value=null,i.value=[],r("update:messageReactions",{}))}catch(Q){console.error("Error removing reactions from message:",Q)}};t({selectedReactions:i,showEmojis:o,openEmojis:E});const D=ee(()=>!!s.messageId&&!!s.conversationId);return(Q,W)=>{var H;return m(),x("div",V2,[l("div",{class:"flex items-center group-reactions",onTouchstartPassive:W[0]||(W[0]=K=>V()),onTouchend:W[1]||(W[1]=K=>X())},[_.value>1?(m(),x("div",H2,[(m(!0),x(be,null,Ie(v.value,K=>(m(),x("div",{key:K.id,class:"text-center"},[l("div",{class:te(["content-center",["love","dislike","like"].includes(K.id)?"text-sm sm:text-xs translate-y-[1px]":"text-sm"])},j(K.ui),3)]))),128)),l("div",W2,j(_.value),1)])):q("",!0),l("button",{onClick:w,class:te(["reaction-button flex items-center justify-center size-[26px] border border-gray-100 shadow-sm rounded-full bg-white select-none transition-[transform,filter,background-color] duration-[150ms,200ms,200ms] ease-[cubic-bezier(0.175,0.885,0.32,1.275),ease,ease] hover:scale-110 active:scale-95 will-change-transform-opacity",[u.value?"grayscale-0":"grayscale",["love","dislike","like"].includes((H=u.value)==null?void 0:H.id)?"text-sm sm:text-xs":"text-sm"]])},[u.value?(m(),x("div",G2,j(u.value.emoji),1)):(m(),oe(y(S2),{key:1,size:"14",class:"text-gray-500"}))],2)],32),l("div",{class:te(["absolute -top-2 z-10 -translate-y-full emoji-picker sm:top-0 origin-center-bottom will-change-[transform,opacity]",[e.position==="center"?"translate-x-[46%] right-0":"translate-x-0 -right-0 sm:-right-3",{"show-emoji":o.value}]])},[l("div",K2,[(m(),x(be,null,Ie(f,(K,F)=>l("button",{key:K.id,class:"emoji-btn bg-transparent border-none cursor-pointer flex items-center justify-center size-[28px] sm:size-[26px] rounded-3xl hover:bg-gray-100 hover:scale-115 relative transition-[transform,background-color] duration-150 ease-in-out will-change-transform",style:ht({"--delay":`${F*.03}s`}),onClick:ne=>k(K)},[l("span",{class:te(["leading-[100%]",["love","dislike","like"].includes(K.id)?"text-base sm:text-sm translate-y-[1px]":"text-lg sm:text-base"])},j(K.emoji),3),l("div",J2,j(K.label),1)],12,Q2)),64)),i.value.length>0?(m(),x("button",{key:0,class:"relative ml-0.5 text-gray-500 bg-transparent border-none cursor-pointer emoji-btn-close hover:text-red-500 group/close",style:{"--delay":`${6*.03}s`},onClick:$},[G(y(Es),{size:"16","stroke-width":"2"}),X2])):q("",!0)])],2),a.value?(m(),x("div",Z2,[(m(),x(be,null,Ie(15,K=>{var F;return l("div",{key:K,class:"firework-particle absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 will-change-[transform,opacity]",style:ht(h())},j(((F=u.value)==null?void 0:F.emoji)||"✨"),5)}),64))])):q("",!0)])}}},[["__scopeId","data-v-76058769"]]);function vs(){const e=ee(()=>gi.state.locale);function t(n,s){return e.value,gi.actions.t(n,s)}return{t,locale:e}}const tk={},nk={viewBox:"0 0 16 16",width:"12",height:"12",fill:"currentColor","aria-hidden":"true"},sk=[l("path",{d:"M6.497 1.035C7.593-.088 9.5.688 9.5 2.257V4.54c1.923.215 3.49 1.246 4.593 2.672C15.328 8.808 16 10.91 16 13v.305c0 .632-.465 1.017-.893 1.127-.422.11-.99.005-1.318-.493-.59-.894-1.2-1.482-1.951-1.859-.611-.307-1.359-.496-2.338-.558v2.23c0 1.57-1.908 2.346-3.003 1.222L.893 9.223a1.75 1.75 0 0 1 .001-2.444l5.603-5.744z"},null,-1)];function rk(e,t){return m(),x("svg",nk,sk)}const lg=Ke(tk,[["render",rk]]),ok={class:"text-xs truncate m-0 mb-0.5 text-gray-600 font-light"},ik={class:"font-medium inline-block max-w-[200px] truncate align-bottom"},ak={class:"font-medium inline-block max-w-[200px] truncate align-bottom"},lk={key:0,class:"text-xs italic opacity-60 m-0"},ck={key:1,class:"flex items-center gap-2 min-w-0"},uk={class:"flex-shrink-0 size-9 rounded-lg overflow-hidden bg-gray-200 flex items-center justify-center"},dk=["src"],fk={class:"min-w-0 flex flex-col gap-0.5"},hk={class:"text-xs m-0 font-medium text-gray-700 truncate"},pk={class:"text-xs m-0 text-gray-500 truncate"},mk={key:0},gk={key:2,class:"text-xs line-clamp-1 m-0 whitespace-pre-wrap break-words text-gray-500"},vk=1500,yk={__name:"ChatBubbleQuote",props:{quotedMessage:{type:Object,required:!0},isUser:{type:Boolean,default:!1}},setup(e){const{t}=vs(),{bot:n}=At(ae.state),s=e,r=R(null),o=ee(()=>{var I,M,L;return((L=(M=(I=n.value)==null?void 0:I.config)==null?void 0:M.ui)==null?void 0:L.name)||""}),i=ee(()=>{var I;return!!((I=s.quotedMessage)!=null&&I.unavailable)}),a=ee(()=>{var I;return!i.value&&!!((I=s.quotedMessage)!=null&&I.id)}),c=(I,M)=>{var V,X;let L=I==null?void 0:I.parentElement;for(;L&&L!==M&&L!==document.body;){const A=getComputedStyle(L).overflowY;if((A==="auto"||A==="scroll"||A==="overlay")&&L.scrollHeight>L.clientHeight)return L;L=L.parentElement}return((V=M==null?void 0:M.querySelector)==null?void 0:V.call(M,".messages-wrapper"))||((X=I==null?void 0:I.closest)==null?void 0:X.call(I,".messages-wrapper"))||null},u=()=>{var X,T,A,D;if(!a.value)return;const I=((T=(X=r.value)==null?void 0:X.getRootNode)==null?void 0:T.call(X))||document,M=s.quotedMessage.id,L=((A=I.getElementById)==null?void 0:A.call(I,`message-${M}`))||((D=I.querySelector)==null?void 0:D.call(I,`[id="message-${M}"]`));if(!L)return;const V=c(L,I);if(V){const Q=V.getBoundingClientRect(),W=L.getBoundingClientRect(),H=W.top-Q.top-V.clientHeight/2+W.height/2;V.scrollTo({top:Math.max(0,V.scrollTop+H),behavior:"smooth"})}else L.scrollIntoView({behavior:"smooth",block:"center"});L.classList.add("quote-target-focus"),setTimeout(()=>{L.classList.remove("quote-target-focus")},vk)},d=ee(()=>{var I;return s.quotedMessage&&(((I=s.quotedMessage.sender)==null?void 0:I.name)||s.quotedMessage.sender_name)||""}),f=ee(()=>{var M;const I=(M=s.quotedMessage)==null?void 0:M.sender_type;return I?s.isUser?I==="user":I!=="user":!1}),h=["image","gif","video","audio","file","sticker","attachment"],g=I=>{const M=document.createElement("div");return M.innerHTML=I,(M.textContent||M.innerText||"").replace(/\s+/g," ").trim()},p=ee(()=>{var I;return((I=s.quotedMessage)==null?void 0:I.content_type)||""}),v=ee(()=>h.includes(p.value)),_=ee(()=>{var M;const I=(M=s.quotedMessage)==null?void 0:M.content;if(Array.isArray(I))return I;if(typeof I=="string")try{const L=JSON.parse(I);return Array.isArray(L)?L:[]}catch{return[]}return[]}),k=ee(()=>{var I;return["image","gif","sticker"].includes(p.value)&&((I=_.value[0])==null?void 0:I.url)||null}),w=ee(()=>({file:Zs,attachment:qu,video:ag,audio:Ym})[p.value]||Zs),$=ee(()=>{const I=p.value;return t(`chat.quote_media.${I==="attachment"?"file":I}`)}),E=ee(()=>{const I=_.value[0];return!I||typeof I!="object"?"":I.filename||I.name||I.title||""}),P=ee(()=>{if(!s.quotedMessage)return"";const I=s.quotedMessage.content;return typeof I=="string"?g(I):""});return(I,M)=>(m(),x("div",{ref_key:"quoteRef",ref:r,class:te(["reply-quote relative hover:bg-gray-200 rounded-2xl bg-gray-50 px-3 translate-y-[18px] pt-2.5 pb-5 mb-1 select-none",[e.isUser?"ml-auto max-w-[70%] w-fit":"mr-auto",a.value?"cursor-pointer":"cursor-default"]]),onClick:u},[l("div",{class:te(["absolute top-0 -translate-y-full flex items-center gap-1 text-gray-700",e.isUser?"right-0":"left-0"])},[G(lg,{class:"text-gray-500"}),l("p",ok,[e.isUser?(m(),x(be,{key:0},[f.value?(m(),x(be,{key:0},[Be(j(y(t)("chat.reply_context.you_replied_to_yourself")),1)],64)):(m(),x(be,{key:1},[Be(j(y(t)("chat.reply_context.you_replied_to"))+" ",1),l("span",ik,j(d.value||o.value),1)],64))],64)):(m(),x(be,{key:1},[l("span",ak,j(d.value||o.value),1),Be(" "+j(f.value?y(t)("chat.reply_context.replied_to_themselves"):y(t)("chat.reply_context.replied_to_you")),1)],64))])],2),i.value?(m(),x("p",lk,j(y(t)("chat.original_message_unavailable")),1)):v.value?(m(),x("div",ck,[l("div",uk,[k.value?(m(),x("img",{key:0,src:k.value,alt:"",class:"size-full object-cover"},null,8,dk)):(m(),oe(Nt(w.value),{key:1,class:"size-4 text-gray-500"}))]),l("div",fk,[l("p",hk,j(d.value||o.value),1),l("p",pk,[l("span",null,"["+j($.value)+"] ",1),E.value?(m(),x("span",mk,j(E.value),1)):q("",!0)])])])):(m(),x("p",gk,j(P.value),1))],2))}},Uu="(?:\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?(?:\\u200D\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?)*)|(?:\\p{Regional_Indicator}{2})";function bk(e){return typeof e!="string"?"":e.replace(/<[^>]*>/g,"").replace(/&nbsp;/gi," ").replace(/\s+/g," ").trim()}function _k(e,t={}){const n=t.maxEmoji??6,s=bk(e);if(!s||!new RegExp(Uu,"u").test(s))return!1;const o=s.match(new RegExp(Uu,"gu"))??[];return o.length===0||o.length>n?!1:s.replace(new RegExp(Uu,"gu"),"").replace(/[\uFE0F\uFE0E\u200D\p{Emoji_Modifier}]/gu,"").replace(/\s+/g,"")===""}const xk=["id"],wk=["innerHTML"],kk=["aria-label","title"],Sk={key:0,class:"text-xs text-gray-500 absolute right-1 -bottom-1 translate-y-full message-user-status"},$k={key:0},Ck={key:1},Tk={key:1,class:"absolute right-1.5 -bottom-3 z-10"},Ek={class:"flex items-center justify-center size-[24px] text-sm leading-none bg-white border border-gray-100 rounded-full shadow-sm select-none"},dl="chatbot-message-table",Ak=500,cg={__name:"ChatBubble",props:{message:Object,isUser:Boolean,anchorId:{type:Boolean,default:!1},chatViewRef:{type:Object,default:null},newMessageStatus:{type:String},isLatestUserMessage:{type:Boolean,default:!1},logo:{type:String}},emits:["reply"],setup(e,{emit:t}){const{t:n}=vs(),s=e,r=ee(()=>{const P=s.message;return!(!P||!/^\d+$/.test(String(P.id??""))||P.is_streaming||P.sender_type!=="assistant"&&P.sender_type!=="user")}),o=R(!1),i=R(null),a=new Map,c=P=>I=>{Qt.linkClick({type:"page",url:P})};function u(P){return/<table[^>]*>[\s\S]*?<\/table>/i.test(P)}function d(P){return u(P)?P.replace(/(<table[\s\S]*?<\/table>)/g,`<div class="${dl}">$1</div>`):P}const f=R(null),h=ee(()=>{const P=s.message.content;return d(P)}),g=ee(()=>{var P;return _k(((P=s.message)==null?void 0:P.content)??"")}),p=ee(()=>s.message.content.includes("ecg-cart-success")),v=ee(()=>s.message.content.includes("eai-order-summary"));Qe(()=>{kt(()=>{var I;const P=(I=f.value)==null?void 0:I.querySelectorAll("a");P==null||P.forEach(M=>{const L=M.getAttribute("href"),V=L.includes(window.location.origin),X=L.includes("dienmayxanh"),T=V||X?"_self":"_blank";M.setAttribute("target",T);const A=c(L);a.set(M,A),M.addEventListener("click",A)})}),o.value=s.message.reactions&&Object.keys(s.message.reactions).length>0}),Jn(()=>{a.forEach((P,I)=>{I.removeEventListener("click",P)}),a.clear()});let _;const k=R(!1),w=()=>{Ts()&&(k.value=!0,_=setTimeout(()=>{i.value.openEmojis(),_=null,o.value=!0},Ak))},$=()=>{Ts()&&(k.value=!1,_&&(clearTimeout(_),_=null))},E=P=>{o.value=Object.keys(P).length>0};return(P,I)=>{var M;return m(),x("div",{id:e.anchorId&&((M=e.message)!=null&&M.id)?`message-${e.message.id}`:void 0,class:te(["relative flex-1 group",[e.isUser?"w-full":h.value.includes(dl)||p.value||v.value?"max-w-full":"w-fit max-w-[92%]"]])},[e.message.quoted_message?(m(),oe(yk,{key:0,quotedMessage:e.message.quoted_message,isUser:e.isUser},null,8,["quotedMessage","isUser"])):q("",!0),l("div",{class:te(["relative w-full",[e.isUser?"ml-auto":"mr-auto"]])},[l("div",{class:te(["message",[e.isUser?"message-user":"message-assistant",v.value?"!w-full":""]]),onTouchstart:I[1]||(I[1]=L=>i.value?w():null),onTouchend:I[2]||(I[2]=L=>i.value?$():null)},[l("div",{class:te(["relative max-w-full",[e.isUser?"ml-auto":"",p.value||v.value||h.value.includes(dl)?"w-full":"w-fit"]])},[l("div",{ref_key:"messageContentRef",ref:f,class:te(["relative px-4 py-3.5 min-w-11 bg-gray-100 rounded-xl prose-sm prose max-sm:select-none",{"bg-primary text-white":e.isUser,"cart-success":p.value,"order-summary":v.value,"has-table":h.value.includes(dl),"emoji-only":g.value}]),innerHTML:h.value},null,10,wk),r.value?(m(),x("button",{key:0,type:"button",onClick:I[0]||(I[0]=L=>P.$emit("reply",e.message)),"aria-label":y(n)("chat.reply_to_message"),title:y(n)("chat.reply_to_message"),class:te(["reply-btn opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity duration-200 flex items-center justify-center size-6 rounded-full bg-gray-50 shadow-sm text-gray-500 hover:bg-gray-100 hover:text-gray-600 absolute top-1/2 -translate-y-1/2",e.isUser?"-left-7":"-right-7"])},[G(y(N2),{class:"size-3"})],10,kk)):q("",!0),e.isUser?q("",!0):(m(),x("div",{key:1,class:te(["absolute right-1.5 -bottom-3",e.message.is_last_assistant_message||o.value?"opacity-100":"opacity-0 md:group-hover:opacity-100 transition-opacity duration-300"])},[G(ek,{ref_key:"messageReactionsRef",ref:i,chatViewRef:e.chatViewRef,messageId:e.message.id,messageReactions:e.message.reactions,conversationId:e.message.chat_conversation_id,position:e.isUser||f.value&&f.value.offsetWidth>260?"left":f.value?"center":"left","onUpdate:messageReactions":E},null,8,["chatViewRef","messageId","messageReactions","conversationId","position"])],2))],2),e.isUser&&e.isLatestUserMessage&&e.newMessageStatus!=="unread"?(m(),x("div",Sk,[e.newMessageStatus==="sent"?(m(),x("span",$k,j(y(n)("common.sent")),1)):e.newMessageStatus==="received"?(m(),x("span",Ck,j(y(n)("common.received")),1)):q("",!0)])):q("",!0)],34)],2),e.isUser&&e.message.bot_reaction?(m(),x("div",Tk,[l("div",Ek,j(e.message.bot_reaction),1)])):q("",!0)],10,xk)}}},Ik={class:"flex items-center gap-2 px-3 py-1.5 pb-2s bg-gray-50 rounded-t-2xl mb-1 overflow-hidden"},Pk={key:0,class:"flex-shrink-0 size-8 rounded-lg overflow-hidden bg-gray-200 flex items-center justify-center"},Mk=["src"],Ok={class:"flex-1 min-w-0"},Rk={class:"flex items-center gap-1 mb-0.5"},Lk={class:"text-xs font-light text-gray-900 truncate m-0"},Dk={class:"font-medium"},jk={key:0,class:"text-xs text-gray-500 truncate m-0"},Nk={key:0},Fk={key:1,class:"text-xs text-gray-500 truncate m-0"},zk=["aria-label"],qk={__name:"ReplyComposerPreview",props:{replyTarget:{type:Object,required:!0}},emits:["cancel"],setup(e){const{t}=vs(),{bot:n}=At(ae.state),s=e,r=ee(()=>{var v,_,k;return((k=(_=(v=n.value)==null?void 0:v.config)==null?void 0:_.ui)==null?void 0:k.name)||""}),o=["image","gif","video","audio","file","sticker","attachment"],i=v=>{const _=document.createElement("div");return _.innerHTML=v,(_.textContent||_.innerText||"").replace(/\s+/g," ").trim()},a=ee(()=>{var v;return((v=s.replyTarget)==null?void 0:v.content_type)||""}),c=ee(()=>o.includes(a.value)),u=ee(()=>{var _;const v=(_=s.replyTarget)==null?void 0:_.content;if(Array.isArray(v))return v;if(typeof v=="string")try{const k=JSON.parse(v);return Array.isArray(k)?k:[]}catch{return[]}return[]}),d=ee(()=>{var v;return["image","gif","sticker"].includes(a.value)&&((v=u.value[0])==null?void 0:v.url)||null}),f=ee(()=>({file:Zs,attachment:qu,video:ag,audio:Ym})[a.value]||Zs),h=ee(()=>{const v=a.value;return t(`chat.quote_media.${v==="attachment"?"file":v}`)}),g=ee(()=>{const v=u.value[0];return!v||typeof v!="object"?"":v.filename||v.name||v.title||""}),p=ee(()=>{if(!s.replyTarget)return"";const v=s.replyTarget.content;return typeof v=="string"?i(v):""});return(v,_)=>(m(),x("div",Ik,[c.value?(m(),x("div",Pk,[d.value?(m(),x("img",{key:0,src:d.value,alt:"",class:"size-full object-cover"},null,8,Mk)):(m(),oe(Nt(f.value),{key:1,class:"size-4 text-gray-500"}))])):q("",!0),l("div",Ok,[l("div",Rk,[G(lg,{class:"text-gray-500"}),l("p",Lk,[Be(j(y(t)("chat.replying_to"))+" ",1),l("span",Dk,j(e.replyTarget.sender_name||r.value),1)])]),c.value?(m(),x("p",jk,[l("span",null,"["+j(h.value)+"]",1),g.value?(m(),x("span",Nk,j(g.value),1)):q("",!0)])):(m(),x("p",Fk,j(p.value),1))]),l("button",{type:"button",onClick:_[0]||(_[0]=k=>v.$emit("cancel")),"aria-label":y(t)("chat.cancel_reply"),class:"flex-shrink-0 flex items-center justify-center size-5 rounded-full hover:bg-gray-200 text-gray-400 transition-colors"},[G(y(Es),{class:"size-4"})],8,zk)]))}};function Bk(e){return Object.prototype.toString.call(e)==="[object Object]"}function ug(e){return Bk(e)||Array.isArray(e)}function Uk(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Vu(e,t){const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;const r=JSON.stringify(Object.keys(e.breakpoints||{})),o=JSON.stringify(Object.keys(t.breakpoints||{}));return r!==o?!1:n.every(i=>{const a=e[i],c=t[i];return typeof a=="function"?`${a}`==`${c}`:!ug(a)||!ug(c)?a===c:Vu(a,c)})}function dg(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function Vk(e,t){if(e.length!==t.length)return!1;const n=dg(e),s=dg(t);return n.every((r,o)=>{const i=s[o];return Vu(r,i)})}function Hu(e){return typeof e=="number"}function Wu(e){return typeof e=="string"}function fl(e){return typeof e=="boolean"}function fg(e){return Object.prototype.toString.call(e)==="[object Object]"}function Dt(e){return Math.abs(e)}function Gu(e){return Math.sign(e)}function xi(e,t){return Dt(e-t)}function Hk(e,t){if(e===0||t===0||Dt(e)<=Dt(t))return 0;const n=xi(Dt(e),Dt(t));return Dt(n/e)}function Wk(e){return Math.round(e*100)/100}function wi(e){return Si(e).map(Number)}function rs(e){return e[ki(e)]}function ki(e){return Math.max(0,e.length-1)}function Ku(e,t){return t===ki(e)}function hg(e,t=0){return Array.from(Array(e),(n,s)=>t+s)}function Si(e){return Object.keys(e)}function pg(e,t){return[e,t].reduce((n,s)=>(Si(s).forEach(r=>{const o=n[r],i=s[r],a=fg(o)&&fg(i);n[r]=a?pg(o,i):i}),n),{})}function Qu(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function Gk(e,t){const n={start:s,center:r,end:o};function s(){return 0}function r(c){return o(c)/2}function o(c){return t-c}function i(c,u){return Wu(e)?n[e](c):e(t,c,u)}return{measure:i}}function $i(){let e=[];function t(r,o,i,a={passive:!0}){let c;if("addEventListener"in r)r.addEventListener(o,i,a),c=()=>r.removeEventListener(o,i,a);else{const u=r;u.addListener(i),c=()=>u.removeListener(i)}return e.push(c),s}function n(){e=e.filter(r=>r())}const s={add:t,clear:n};return s}function Kk(e,t,n,s){const r=$i(),o=1e3/60;let i=null,a=0,c=0;function u(){r.add(e,"visibilitychange",()=>{e.hidden&&p()})}function d(){g(),r.clear()}function f(_){if(!c)return;i||(i=_,n(),n());const k=_-i;for(i=_,a+=k;a>=o;)n(),a-=o;const w=a/o;s(w),c&&(c=t.requestAnimationFrame(f))}function h(){c||(c=t.requestAnimationFrame(f))}function g(){t.cancelAnimationFrame(c),i=null,a=0,c=0}function p(){i=null,a=0}return{init:u,destroy:d,start:h,stop:g,update:n,render:s}}function Qk(e,t){const n=t==="rtl",s=e==="y",r=s?"y":"x",o=s?"x":"y",i=!s&&n?-1:1,a=d(),c=f();function u(p){const{height:v,width:_}=p;return s?v:_}function d(){return s?"top":n?"right":"left"}function f(){return s?"bottom":n?"left":"right"}function h(p){return p*i}return{scroll:r,cross:o,startEdge:a,endEdge:c,measureSize:u,direction:h}}function Pr(e=0,t=0){const n=Dt(e-t);function s(u){return u<e}function r(u){return u>t}function o(u){return s(u)||r(u)}function i(u){return o(u)?s(u)?e:t:u}function a(u){return n?u-n*Math.ceil((u-t)/n):u}return{length:n,max:t,min:e,constrain:i,reachedAny:o,reachedMax:r,reachedMin:s,removeOffset:a}}function mg(e,t,n){const{constrain:s}=Pr(0,e),r=e+1;let o=i(t);function i(h){return n?Dt((r+h)%r):s(h)}function a(){return o}function c(h){return o=i(h),f}function u(h){return d().set(a()+h)}function d(){return mg(e,a(),n)}const f={get:a,set:c,add:u,clone:d};return f}function Jk(e,t,n,s,r,o,i,a,c,u,d,f,h,g,p,v,_,k,w){const{cross:$,direction:E}=e,P=["INPUT","SELECT","TEXTAREA"],I={passive:!1},M=$i(),L=$i(),V=Pr(50,225).constrain(g.measure(20)),X={mouse:300,touch:400},T={mouse:500,touch:600},A=p?43:25;let D=!1,Q=0,W=0,H=!1,K=!1,F=!1,ne=!1;function fe(N){if(!w)return;function Y(O){(fl(w)||w(N,O))&&de(O)}const Z=t;M.add(Z,"dragstart",O=>O.preventDefault(),I).add(Z,"touchmove",()=>{},I).add(Z,"touchend",()=>{}).add(Z,"touchstart",Y).add(Z,"mousedown",Y).add(Z,"touchcancel",Re).add(Z,"contextmenu",Re).add(Z,"click",Oe,!0)}function _e(){M.clear(),L.clear()}function we(){const N=ne?n:t;L.add(N,"touchmove",Ce,I).add(N,"touchend",Re).add(N,"mousemove",Ce,I).add(N,"mouseup",Re)}function je(N){const Y=N.nodeName||"";return P.includes(Y)}function re(){return(p?T:X)[ne?"mouse":"touch"]}function pe(N,Y){const Z=f.add(Gu(N)*-1),O=d.byDistance(N,!p).distance;return p||Dt(N)<V?O:_&&Y?O*.5:d.byIndex(Z.get(),0).distance}function de(N){const Y=Qu(N,s);ne=Y,F=p&&Y&&!N.buttons&&D,D=xi(r.get(),i.get())>=2,!(Y&&N.button!==0)&&(je(N.target)||(H=!0,o.pointerDown(N),u.useFriction(0).useDuration(0),r.set(i),we(),Q=o.readPoint(N),W=o.readPoint(N,$),h.emit("pointerDown")))}function Ce(N){if(!Qu(N,s)&&N.touches.length>=2)return Re(N);const Z=o.readPoint(N),O=o.readPoint(N,$),U=xi(Z,Q),ie=xi(O,W);if(!K&&!ne&&(!N.cancelable||(K=U>ie,!K)))return Re(N);const me=o.pointerMove(N);U>v&&(F=!0),u.useFriction(.3).useDuration(.75),a.start(),r.add(E(me)),N.preventDefault()}function Re(N){const Z=d.byDistance(0,!1).index!==f.get(),O=o.pointerUp(N)*re(),U=pe(E(O),Z),ie=Hk(O,U),me=A-10*ie,ue=k+ie/50;K=!1,H=!1,L.clear(),u.useDuration(me).useFriction(ue),c.distance(U,!p),ne=!1,h.emit("pointerUp")}function Oe(N){F&&(N.stopPropagation(),N.preventDefault(),F=!1)}function Me(){return H}return{init:fe,destroy:_e,pointerDown:Me}}function Xk(e,t){let s,r;function o(f){return f.timeStamp}function i(f,h){const p=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(Qu(f,t)?f:f.touches[0])[p]}function a(f){return s=f,r=f,i(f)}function c(f){const h=i(f)-i(r),g=o(f)-o(s)>170;return r=f,g&&(s=f),h}function u(f){if(!s||!r)return 0;const h=i(r)-i(s),g=o(f)-o(s),p=o(f)-o(r)>170,v=h/g;return g&&!p&&Dt(v)>.1?v:0}return{pointerDown:a,pointerMove:c,pointerUp:u,readPoint:i}}function Zk(){function e(n){const{offsetTop:s,offsetLeft:r,offsetWidth:o,offsetHeight:i}=n;return{top:s,right:r+o,bottom:s+i,left:r,width:o,height:i}}return{measure:e}}function Yk(e){function t(s){return e*(s/100)}return{measure:t}}function eS(e,t,n,s,r,o,i){const a=[e].concat(s);let c,u,d=[],f=!1;function h(_){return r.measureSize(i.measure(_))}function g(_){if(!o)return;u=h(e),d=s.map(h);function k(w){for(const $ of w){if(f)return;const E=$.target===e,P=s.indexOf($.target),I=E?u:d[P],M=h(E?e:s[P]);if(Dt(M-I)>=.5){_.reInit(),t.emit("resize");break}}}c=new ResizeObserver(w=>{(fl(o)||o(_,w))&&k(w)}),n.requestAnimationFrame(()=>{a.forEach(w=>c.observe(w))})}function p(){f=!0,c&&c.disconnect()}return{init:g,destroy:p}}function tS(e,t,n,s,r,o){let i=0,a=0,c=r,u=o,d=e.get(),f=0;function h(){const I=s.get()-e.get(),M=!c;let L=0;return M?(i=0,n.set(s),e.set(s),L=I):(n.set(e),i+=I/c,i*=u,d+=i,e.add(i),L=d-f),a=Gu(L),f=d,P}function g(){const I=s.get()-t.get();return Dt(I)<.001}function p(){return c}function v(){return a}function _(){return i}function k(){return $(r)}function w(){return E(o)}function $(I){return c=I,P}function E(I){return u=I,P}const P={direction:v,duration:p,velocity:_,seek:h,settled:g,useBaseFriction:w,useBaseDuration:k,useFriction:E,useDuration:$};return P}function nS(e,t,n,s,r){const o=r.measure(10),i=r.measure(50),a=Pr(.1,.99);let c=!1;function u(){return!(c||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function d(g){if(!u())return;const p=e.reachedMin(t.get())?"min":"max",v=Dt(e[p]-t.get()),_=n.get()-t.get(),k=a.constrain(v/i);n.subtract(_*k),!g&&Dt(_)<o&&(n.set(e.constrain(n.get())),s.useDuration(25).useBaseFriction())}function f(g){c=!g}return{shouldConstrain:u,constrain:d,toggleActive:f}}function sS(e,t,n,s,r){const o=Pr(-t+e,0),i=f(),a=d(),c=h();function u(p,v){return xi(p,v)<=1}function d(){const p=i[0],v=rs(i),_=i.lastIndexOf(p),k=i.indexOf(v)+1;return Pr(_,k)}function f(){return n.map((p,v)=>{const{min:_,max:k}=o,w=o.constrain(p),$=!v,E=Ku(n,v);return $?k:E||u(_,w)?_:u(k,w)?k:w}).map(p=>parseFloat(p.toFixed(3)))}function h(){if(t<=e+r)return[o.max];if(s==="keepSnaps")return i;const{min:p,max:v}=a;return i.slice(p,v)}return{snapsContained:c,scrollContainLimit:a}}function rS(e,t,n){const s=t[0],r=n?s-e:rs(t);return{limit:Pr(r,s)}}function oS(e,t,n,s){const o=t.min+.1,i=t.max+.1,{reachedMin:a,reachedMax:c}=Pr(o,i);function u(h){return h===1?c(n.get()):h===-1?a(n.get()):!1}function d(h){if(!u(h))return;const g=e*(h*-1);s.forEach(p=>p.add(g))}return{loop:d}}function iS(e){const{max:t,length:n}=e;function s(o){const i=o-t;return n?i/-n:0}return{get:s}}function aS(e,t,n,s,r){const{startEdge:o,endEdge:i}=e,{groupSlides:a}=r,c=f().map(t.measure),u=h(),d=g();function f(){return a(s).map(v=>rs(v)[i]-v[0][o]).map(Dt)}function h(){return s.map(v=>n[o]-v[o]).map(v=>-Dt(v))}function g(){return a(u).map(v=>v[0]).map((v,_)=>v+c[_])}return{snaps:u,snapsAligned:d}}function lS(e,t,n,s,r,o){const{groupSlides:i}=r,{min:a,max:c}=s,u=d();function d(){const h=i(o),g=!e||t==="keepSnaps";return n.length===1?[o]:g?h:h.slice(a,c).map((p,v,_)=>{const k=!v,w=Ku(_,v);if(k){const $=rs(_[0])+1;return hg($)}if(w){const $=ki(o)-rs(_)[0]+1;return hg($,rs(_)[0])}return p})}return{slideRegistry:u}}function cS(e,t,n,s,r){const{reachedAny:o,removeOffset:i,constrain:a}=s;function c(p){return p.concat().sort((v,_)=>Dt(v)-Dt(_))[0]}function u(p){const v=e?i(p):a(p),_=t.map((w,$)=>({diff:d(w-v,0),index:$})).sort((w,$)=>Dt(w.diff)-Dt($.diff)),{index:k}=_[0];return{index:k,distance:v}}function d(p,v){const _=[p,p+n,p-n];if(!e)return p;if(!v)return c(_);const k=_.filter(w=>Gu(w)===v);return k.length?c(k):rs(_)-n}function f(p,v){const _=t[p]-r.get(),k=d(_,v);return{index:p,distance:k}}function h(p,v){const _=r.get()+p,{index:k,distance:w}=u(_),$=!e&&o(_);if(!v||$)return{index:k,distance:p};const E=t[k]-w,P=p+d(E,0);return{index:k,distance:P}}return{byDistance:h,byIndex:f,shortcut:d}}function uS(e,t,n,s,r,o,i){function a(f){const h=f.distance,g=f.index!==t.get();o.add(h),h&&(s.duration()?e.start():(e.update(),e.render(1),e.update())),g&&(n.set(t.get()),t.set(f.index),i.emit("select"))}function c(f,h){const g=r.byDistance(f,h);a(g)}function u(f,h){const g=t.clone().set(f),p=r.byIndex(g.get(),h);a(p)}return{distance:c,index:u}}function dS(e,t,n,s,r,o,i,a){const c={passive:!0,capture:!0};let u=0;function d(g){if(!a)return;function p(v){if(new Date().getTime()-u>10)return;i.emit("slideFocusStart"),e.scrollLeft=0;const w=n.findIndex($=>$.includes(v));Hu(w)&&(r.useDuration(0),s.index(w,0),i.emit("slideFocus"))}o.add(document,"keydown",f,!1),t.forEach((v,_)=>{o.add(v,"focus",k=>{(fl(a)||a(g,k))&&p(_)},c)})}function f(g){g.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function Ci(e){let t=e;function n(){return t}function s(c){t=i(c)}function r(c){t+=i(c)}function o(c){t-=i(c)}function i(c){return Hu(c)?c:c.get()}return{get:n,set:s,add:r,subtract:o}}function gg(e,t){const n=e.scroll==="x"?i:a,s=t.style;let r=null,o=!1;function i(h){return`translate3d(${h}px,0px,0px)`}function a(h){return`translate3d(0px,${h}px,0px)`}function c(h){if(o)return;const g=Wk(e.direction(h));g!==r&&(s.transform=n(g),r=g)}function u(h){o=!h}function d(){o||(s.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:d,to:c,toggleActive:u}}function fS(e,t,n,s,r,o,i,a,c){const d=wi(r),f=wi(r).reverse(),h=k().concat(w());function g(M,L){return M.reduce((V,X)=>V-r[X],L)}function p(M,L){return M.reduce((V,X)=>g(V,L)>0?V.concat([X]):V,[])}function v(M){return o.map((L,V)=>({start:L-s[V]+.5+M,end:L+t-.5+M}))}function _(M,L,V){const X=v(L);return M.map(T=>{const A=V?0:-n,D=V?n:0,Q=V?"end":"start",W=X[T][Q];return{index:T,loopPoint:W,slideLocation:Ci(-1),translate:gg(e,c[T]),target:()=>a.get()>W?A:D}})}function k(){const M=i[0],L=p(f,M);return _(L,n,!1)}function w(){const M=t-i[0]-1,L=p(d,M);return _(L,-n,!0)}function $(){return h.every(({index:M})=>{const L=d.filter(V=>V!==M);return g(L,t)<=.1})}function E(){h.forEach(M=>{const{target:L,translate:V,slideLocation:X}=M,T=L();T!==X.get()&&(V.to(T),X.set(T))})}function P(){h.forEach(M=>M.translate.clear())}return{canLoop:$,clear:P,loop:E,loopPoints:h}}function hS(e,t,n){let s,r=!1;function o(c){if(!n)return;function u(d){for(const f of d)if(f.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}s=new MutationObserver(d=>{r||(fl(n)||n(c,d))&&u(d)}),s.observe(e,{childList:!0})}function i(){s&&s.disconnect(),r=!0}return{init:o,destroy:i}}function pS(e,t,n,s){const r={};let o=null,i=null,a,c=!1;function u(){a=new IntersectionObserver(p=>{c||(p.forEach(v=>{const _=t.indexOf(v.target);r[_]=v}),o=null,i=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:s}),t.forEach(p=>a.observe(p))}function d(){a&&a.disconnect(),c=!0}function f(p){return Si(r).reduce((v,_)=>{const k=parseInt(_),{isIntersecting:w}=r[k];return(p&&w||!p&&!w)&&v.push(k),v},[])}function h(p=!0){if(p&&o)return o;if(!p&&i)return i;const v=f(p);return p&&(o=v),p||(i=v),v}return{init:u,destroy:d,get:h}}function mS(e,t,n,s,r,o){const{measureSize:i,startEdge:a,endEdge:c}=e,u=n[0]&&r,d=p(),f=v(),h=n.map(i),g=_();function p(){if(!u)return 0;const w=n[0];return Dt(t[a]-w[a])}function v(){if(!u)return 0;const w=o.getComputedStyle(rs(s));return parseFloat(w.getPropertyValue(`margin-${c}`))}function _(){return n.map((w,$,E)=>{const P=!$,I=Ku(E,$);return P?h[$]+d:I?h[$]+f:E[$+1][a]-w[a]}).map(Dt)}return{slideSizes:h,slideSizesWithGaps:g,startGap:d,endGap:f}}function gS(e,t,n,s,r,o,i,a,c){const{startEdge:u,endEdge:d,direction:f}=e,h=Hu(n);function g(k,w){return wi(k).filter($=>$%w===0).map($=>k.slice($,$+w))}function p(k){return k.length?wi(k).reduce((w,$,E)=>{const P=rs(w)||0,I=P===0,M=$===ki(k),L=r[u]-o[P][u],V=r[u]-o[$][d],X=!s&&I?f(i):0,T=!s&&M?f(a):0,A=Dt(V-T-(L+X));return E&&A>t+c&&w.push($),M&&w.push(k.length),w},[]).map((w,$,E)=>{const P=Math.max(E[$-1]||0);return k.slice(P,w)}):[]}function v(k){return h?g(k,n):p(k)}return{groupSlides:v}}function vS(e,t,n,s,r,o,i){const{align:a,axis:c,direction:u,startIndex:d,loop:f,duration:h,dragFree:g,dragThreshold:p,inViewThreshold:v,slidesToScroll:_,skipSnaps:k,containScroll:w,watchResize:$,watchSlides:E,watchDrag:P,watchFocus:I}=o,M=2,L=Zk(),V=L.measure(t),X=n.map(L.measure),T=Qk(c,u),A=T.measureSize(V),D=Yk(A),Q=Gk(a,A),W=!f&&!!w,H=f||!!w,{slideSizes:K,slideSizesWithGaps:F,startGap:ne,endGap:fe}=mS(T,V,X,n,H,r),_e=gS(T,A,_,f,V,X,ne,fe,M),{snaps:we,snapsAligned:je}=aS(T,Q,V,X,_e),re=-rs(we)+rs(F),{snapsContained:pe,scrollContainLimit:de}=sS(A,re,je,w,M),Ce=W?pe:je,{limit:Re}=rS(re,Ce,f),Oe=mg(ki(Ce),d,f),Me=Oe.clone(),He=wi(n),N=({dragHandler:yt,scrollBody:Ot,scrollBounds:un,options:{loop:zt}})=>{zt||un.constrain(yt.pointerDown()),Ot.seek()},Y=({scrollBody:yt,translate:Ot,location:un,offsetLocation:zt,previousLocation:Ln,scrollLooper:se,slideLooper:ye,dragHandler:ze,animation:qe,eventHandler:le,scrollBounds:xe,options:{loop:Ge}},at)=>{const gt=yt.settled(),bn=!xe.shouldConstrain(),Dn=Ge?gt:gt&&bn,Gn=Dn&&!ze.pointerDown();Gn&&qe.stop();const Cn=un.get()*at+Ln.get()*(1-at);zt.set(Cn),Ge&&(se.loop(yt.direction()),ye.loop()),Ot.to(zt.get()),Gn&&le.emit("settle"),Dn||le.emit("scroll")},Z=Kk(s,r,()=>N(pt),yt=>Y(pt,yt)),O=.68,U=Ce[Oe.get()],ie=Ci(U),me=Ci(U),ue=Ci(U),ge=Ci(U),he=tS(ie,ue,me,ge,h,O),Te=cS(f,Ce,re,Re,ge),De=uS(Z,Oe,Me,he,Te,ge,i),Le=iS(Re),Ae=$i(),We=pS(t,n,i,v),{slideRegistry:ot}=lS(W,w,Ce,de,_e,He),it=dS(e,n,ot,De,he,Ae,i,I),pt={ownerDocument:s,ownerWindow:r,eventHandler:i,containerRect:V,slideRects:X,animation:Z,axis:T,dragHandler:Jk(T,e,s,r,ge,Xk(T,r),ie,Z,De,he,Te,Oe,i,D,g,p,k,O,P),eventStore:Ae,percentOfView:D,index:Oe,indexPrevious:Me,limit:Re,location:ie,offsetLocation:ue,previousLocation:me,options:o,resizeHandler:eS(t,i,r,n,T,$,L),scrollBody:he,scrollBounds:nS(Re,ue,ge,he,D),scrollLooper:oS(re,Re,ue,[ie,ue,me,ge]),scrollProgress:Le,scrollSnapList:Ce.map(Le.get),scrollSnaps:Ce,scrollTarget:Te,scrollTo:De,slideLooper:fS(T,A,re,K,F,we,Ce,ue,n),slideFocus:it,slidesHandler:hS(t,i,E),slidesInView:We,slideIndexes:He,slideRegistry:ot,slidesToScroll:_e,target:ge,translate:gg(T,t)};return pt}function yS(){let e={},t;function n(u){t=u}function s(u){return e[u]||[]}function r(u){return s(u).forEach(d=>d(t,u)),c}function o(u,d){return e[u]=s(u).concat([d]),c}function i(u,d){return e[u]=s(u).filter(f=>f!==d),c}function a(){e={}}const c={init:n,emit:r,off:i,on:o,clear:a};return c}const bS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function _S(e){function t(o,i){return pg(o,i||{})}function n(o){const i=o.breakpoints||{},a=Si(i).filter(c=>e.matchMedia(c).matches).map(c=>i[c]).reduce((c,u)=>t(c,u),{});return t(o,a)}function s(o){return o.map(i=>Si(i.breakpoints||{})).reduce((i,a)=>i.concat(a),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:s}}function xS(e){let t=[];function n(o,i){return t=i.filter(({options:a})=>e.optionsAtMedia(a).active!==!1),t.forEach(a=>a.init(o,e)),i.reduce((a,c)=>Object.assign(a,{[c.name]:c}),{})}function s(){t=t.filter(o=>o.destroy())}return{init:n,destroy:s}}function hl(e,t,n){const s=e.ownerDocument,r=s.defaultView,o=_S(r),i=xS(o),a=$i(),c=yS(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:f}=o,{on:h,off:g,emit:p}=c,v=T;let _=!1,k,w=u(bS,hl.globalOptions),$=u(w),E=[],P,I,M;function L(){const{container:He,slides:N}=$;I=(Wu(He)?e.querySelector(He):He)||e.children[0];const Z=Wu(N)?I.querySelectorAll(N):N;M=[].slice.call(Z||I.children)}function V(He){const N=vS(e,I,M,s,r,He,c);if(He.loop&&!N.slideLooper.canLoop()){const Y=Object.assign({},He,{loop:!1});return V(Y)}return N}function X(He,N){_||(w=u(w,He),$=d(w),E=N||E,L(),k=V($),f([w,...E.map(({options:Y})=>Y)]).forEach(Y=>a.add(Y,"change",T)),$.active&&(k.translate.to(k.location.get()),k.animation.init(),k.slidesInView.init(),k.slideFocus.init(Me),k.eventHandler.init(Me),k.resizeHandler.init(Me),k.slidesHandler.init(Me),k.options.loop&&k.slideLooper.loop(),I.offsetParent&&M.length&&k.dragHandler.init(Me),P=i.init(Me,E)))}function T(He,N){const Y=_e();A(),X(u({startIndex:Y},He),N),c.emit("reInit")}function A(){k.dragHandler.destroy(),k.eventStore.clear(),k.translate.clear(),k.slideLooper.clear(),k.resizeHandler.destroy(),k.slidesHandler.destroy(),k.slidesInView.destroy(),k.animation.destroy(),i.destroy(),a.clear()}function D(){_||(_=!0,a.clear(),A(),c.emit("destroy"),c.clear())}function Q(He,N,Y){!$.active||_||(k.scrollBody.useBaseFriction().useDuration(N===!0?0:$.duration),k.scrollTo.index(He,Y||0))}function W(He){const N=k.index.add(1).get();Q(N,He,-1)}function H(He){const N=k.index.add(-1).get();Q(N,He,1)}function K(){return k.index.add(1).get()!==_e()}function F(){return k.index.add(-1).get()!==_e()}function ne(){return k.scrollSnapList}function fe(){return k.scrollProgress.get(k.offsetLocation.get())}function _e(){return k.index.get()}function we(){return k.indexPrevious.get()}function je(){return k.slidesInView.get()}function re(){return k.slidesInView.get(!1)}function pe(){return P}function de(){return k}function Ce(){return e}function Re(){return I}function Oe(){return M}const Me={canScrollNext:K,canScrollPrev:F,containerNode:Re,internalEngine:de,destroy:D,off:g,on:h,emit:p,plugins:pe,previousScrollSnap:we,reInit:v,rootNode:Ce,scrollNext:W,scrollPrev:H,scrollProgress:fe,scrollSnapList:ne,scrollTo:Q,selectedScrollSnap:_e,slideNodes:Oe,slidesInView:je,slidesNotInView:re};return X(t,n),setTimeout(()=>c.emit("init"),0),Me}hl.globalOptions=void 0;function Ju(e={},t=[]){const n=Ft(e),s=Ft(t);let r=n?e.value:e,o=s?t.value:t;const i=pf(),a=pf();function c(){a.value&&a.value.reInit(r,o)}return Qe(()=>{!Uk()||!i.value||(hl.globalOptions=Ju.globalOptions,a.value=hl(i.value,r,o))}),Jn(()=>{a.value&&a.value.destroy()}),n&&Pe(e,u=>{Vu(r,u)||(r=u,c())}),s&&Pe(t,u=>{Vk(o,u)||(o=u,c())}),[i,a]}Ju.globalOptions=void 0;const wS={},kS={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},SS=[l("path",{d:"m15 18-6-6 6-6"},null,-1)];function $S(e,t){return m(),x("svg",kS,SS)}const CS=Ke(wS,[["render",$S]]),TS={},ES={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},AS=[l("path",{d:"m9 18 6-6-6-6"},null,-1)];function IS(e,t){return m(),x("svg",ES,AS)}const vg=Ke(TS,[["render",IS]]),PS={class:"embla__container"},MS={key:0,class:"embla__controls hidden md:flex"},OS={key:0,class:"embla__buttons"},RS={key:1,class:"embla__dots"},LS=["onClick"],Ti={__name:"Slider",props:{autoplay:{type:Boolean,default:!1},pagination:{type:Boolean,default:!1},showArrows:{type:Boolean,default:!0},loop:{type:Boolean,default:!1},duration:{type:Number,default:25},slidesPerView:{type:Number,default:null},spaceBetween:{type:Number,default:0},breakpoints:{type:Object,default:null},slidesPerViewMobile:{type:Number,default:null},slidesPerViewTablet:{type:Number,default:null},sizeArrow:{type:String,default:"md",validator:e=>["md","lg","xl"].includes(e)},allowOverflow:{type:Boolean,default:!1}},emits:["change","slideChange","init"],setup(e,{expose:t,emit:n}){const s=n,r=e,[o,i]=Ju({duration:r.duration,loop:r.loop,align:"start",slidesToScroll:1}),a=R([]),c=R(0),u=R(!1),d=R(!0);let f=null;function h(){if(r.breakpoints)return r.breakpoints;const D={};return r.slidesPerViewTablet!=null&&(D[768]={slidesPerView:r.slidesPerViewTablet}),r.slidesPerView!=null&&(r.slidesPerViewTablet!=null||r.slidesPerViewMobile!=null)&&(D[1280]={slidesPerView:r.slidesPerView}),D}const g=R(r.slidesPerViewMobile??r.slidesPerView??null),p=R(r.spaceBetween??0);function v(){if(!r.slidesPerView&&!r.breakpoints)return;const D=window.innerWidth,Q=h(),W=Object.keys(Q).map(Number).sort((K,F)=>K-F);let H={slidesPerView:r.slidesPerViewMobile??r.slidesPerView??1,spaceBetween:r.spaceBetween??0};for(const K of W)if(D>=K)H={...H,...Q[K]};else break;g.value=H.slidesPerView,p.value=H.spaceBetween}const _=ee(()=>!!(r.slidesPerView||r.breakpoints)),k=ee(()=>_.value?{"--slides-per-view":g.value,"--space-between":`${p.value}px`}:{}),w=ee(()=>{switch(r.sizeArrow){case"xl":return"size-14";case"lg":return"size-10";default:return"size-8"}}),$=ee(()=>{switch(r.sizeArrow){case"xl":return"w-6";case"lg":return"w-5";default:return"w-4"}});Qe(()=>{v(),window.addEventListener("resize",v),i.value&&(a.value=i.value.slideNodes(),i.value.on("select",X),V(),E(),s("init",i.value))}),Lt(()=>{window.removeEventListener("resize",v),P()}),Pe(()=>r.autoplay,D=>{D?E():P()});function E(){r.autoplay&&a.value.length>1&&(f=setInterval(()=>{var D;(D=i.value)==null||D.scrollNext()},3e3))}function P(){f&&(clearInterval(f),f=null)}function I(D){var Q;(Q=i.value)==null||Q.scrollTo(D)}function M(){var D;(D=i.value)==null||D.scrollPrev()}function L(){var D;(D=i.value)==null||D.scrollNext()}function V(){i.value&&(u.value=i.value.canScrollPrev(),d.value=i.value.canScrollNext())}function X(){c.value=i.value.selectedScrollSnap(),V();const D={currentIndex:c.value,activeSlide:a.value[c.value],totalSlides:a.value.length};s("change",D),s("slideChange",D)}const T=()=>{r.autoplay&&P()},A=()=>{r.autoplay&&E()};return t({scrollTo:I,scrollPrev:M,scrollNext:L,emblaApi:i,currentSlidesPerView:g}),(D,Q)=>(m(),x("div",{class:"embla-wrapper",onMouseenter:T,onMouseleave:A},[l("div",{class:te(["embla",{"embla--per-view":_.value,"embla--allow-overflow":e.allowOverflow}]),style:ht(k.value),ref_key:"emblaRef",ref:o},[l("div",PS,[It(D.$slots,"default",Ui(pa({selectedIndex:c.value,scrollTo:I})))])],6),a.value&&a.value.length>1?(m(),x("div",MS,[e.showArrows?(m(),x("div",OS,[Rt(l("button",{class:te(["embla__button embla__button--prev",w.value]),onClick:Q[0]||(Q[0]=W=>{var H;return(H=y(i))==null?void 0:H.scrollPrev()})},[G(CS,{class:te($.value)},null,8,["class"])],2),[[Jo,u.value]]),Rt(l("button",{class:te(["embla__button embla__button--next",w.value]),onClick:Q[1]||(Q[1]=W=>{var H;return(H=y(i))==null?void 0:H.scrollNext()})},[G(vg,{class:te($.value)},null,8,["class"])],2),[[Jo,d.value]])])):q("",!0),e.pagination?(m(),x("div",RS,[(m(!0),x(be,null,Ie(a.value,(W,H)=>(m(),x("button",{key:H,class:te(["embla__dot",{"is-selected":H===c.value}]),onClick:K=>I(H)},null,10,LS))),128))])):q("",!0)])):q("",!0)],32))}},DS={},jS={class:"embla__slide"};function NS(e,t){return m(),x("div",jS,[It(e.$slots,"default")])}const pl=Ke(DS,[["render",NS]]),FS={class:"flex flex-col px-2.5 pt-2.5 pb-3 h-full rounded-2xl border border-gray-200 duration-500 group hover:border-primary"},zS=["href"],qS=["src"],BS={key:1,class:"w-full flex items-center justify-center h-full min-h-[118px]"},US=["src"],VS=["href","innerHTML"],HS=["innerHTML"],WS={__name:"CardPreview",props:["item","logo"],setup(e){const n="https://widget.geteasy.ai"+"/link.png";function s(r,o={}){["product","page"].includes(r)&&Qt.linkClick({type:r,...o})}return(r,o)=>(m(),x("div",FS,[l("a",{target:"_blank",href:e.item.source,onClick:o[2]||(o[2]=i=>s("page",{url:e.item.source})),class:"flex overflow-hidden flex-1 justify-center items-center rounded-xl border border-gray-200 max-h-48"},[e.item.image?(m(),x("img",{key:0,src:e.item.image,class:"object-cover w-full h-full",onError:o[0]||(o[0]=i=>(i.target.src=n,i.target.className="max-w-7"))},null,40,qS)):(m(),x("div",BS,[l("img",{src:e.logo,class:"object-cover w-9 h-9 rounded-full",onError:o[1]||(o[1]=i=>i.target.src=n)},null,40,US)]))],8,zS),e.item.title?(m(),x("a",{key:0,target:"_blank",href:e.item.source,onClick:o[3]||(o[3]=i=>s("page",{url:e.item.source})),class:"font-semibold text-gray-700 mt-2 text-sm group-hover:text-primary line-clamp-1 duration-500 break-words min-h-[20px]",innerHTML:e.item.title},null,8,VS)):q("",!0),e.item.description||e.item.source?(m(),x("p",{key:1,class:"text-sm text-gray-500 mt-1 line-clamp-2 break-words min-h-[40px]",innerHTML:e.item.description||e.item.source},null,8,HS)):q("",!0)]))}},GS={class:"rounded-lg flex p-2 group border border-gray-200 hover:border-primary duration-500 w-[96%] max-w-xl"},KS={class:"w-[138px] h-[90px] flex-shrink-0 mr-2"},QS=["href"],JS=["src"],XS={key:1,class:"min-h-[84px] w-full flex items-center justify-center"},ZS=["src"],YS={class:"overflow-hidden space-y-1"},e$=["href","innerHTML"],t$=["innerHTML"],n$={__name:"CardPreviewHorizontal",props:["item","logo"],setup(e){function t(n,s={}){["product","page"].includes(n)&&Qt.linkClick({type:n,...s})}return(n,s)=>(m(),x("div",GS,[l("div",KS,[l("a",{target:"_blank",href:e.item.source,class:te(["flex overflow-hidden justify-center items-center h-full border border-gray-100 rounded",!e.item.image&&"h-full"]),onClick:s[2]||(s[2]=r=>t("page",{url:e.item.source}))},[e.item.image?(m(),x("img",{key:0,src:e.item.image,class:"object-contain w-full h-full",onError:s[0]||(s[0]=r=>(r.target.src=e.logo,r.target.className="max-w-8"))},null,40,JS)):(m(),x("div",XS,[l("img",{src:e.logo,class:"object-cover overflow-hidden w-8 h-8 rounded-full",onError:s[1]||(s[1]=r=>r.target.src=e.logo)},null,40,ZS)]))],10,QS)]),l("div",YS,[e.item.title?(m(),x("a",{key:0,target:"_blank",href:e.item.source,onClick:s[3]||(s[3]=r=>t("page",{url:e.item.source})),class:"text-sm font-semibold text-gray-700 duration-500 group-hover:text-primary line-clamp-2",innerHTML:e.item.title},null,8,e$)):q("",!0),e.item.description||e.item.source?(m(),x("p",{key:1,class:"text-sm text-gray-500 line-clamp-2 break-words leading-[120%]",innerHTML:e.item.description||e.item.source},null,8,t$)):q("",!0)])]))}};function s$(){var r;const e=((r=B.bot)==null?void 0:r.config.apiHost)||B.apiDomain,t=St.create({baseURL:`${e}/api/bots/${B.handle}/forms`});return{submit:async({formData:o,type:i})=>{const a=B.forms&&B.forms[i]&&B.forms[i].id;if(!a||!o)throw new Error("Missing data: formId or formData is required");const{submission_data:c,id:u}=await t.post(`/${a}/submission`,o).then(d=>d.data);return c?{success:!0,data:c,submissionId:u}:{success:!1,data:null,submissionId:null}},getForms:async()=>{const o=JSON.parse(JSON.stringify(B.bot.widgets??[]));if(o.length==0)return;const i=o.reduce((a,c)=>c.active?{...a,[c.type]:c}:a,{});B.forms=i}}}const r$={class:"messages-group w-full"},o$={class:"relative flex size-8 overflow-hidden rounded-full shrink-0 bg-white message-avatar"},i$=["src","alt"],a$={key:0,class:"rounded-2xl bg-white w-full overflow-hidden max-w-[540px]"},l$={class:"flex items-center justify-between pl-4 pr-2.5 h-12 bg-primary"},c$={class:"font-semibold text-base text-white"},u$=l("div",{class:"font-medium"},"Gửi",-1),d$={key:1,class:"flex items-center justify-center mr-1"},f$={key:0,"aria-label":"form-submitted",class:"flex items-center space-x-1 text-sm text-primary bg-white rounded-md px-2 py-1"},h$=l("div",{class:"font-medium"},"Đã gửi",-1),p$={class:"pl-4 pr-3 py-2 border border-primary border-b-2 border-b-primary rounded-b-2xl"},m$={key:0,class:"w-full"},g$={class:"text-sm text-gray-700 border-b border-b-gray-200 last:border-b-0"},v$={class:"text-gray-500 p-2 pl-0 min-w-[114px] content-start"},y$={class:"py-1"},b$={key:0,class:"flex items-center px-2 py-1.5 rounded-md"},_$={class:"font-medium text-gray-700 whitespace-pre-wrap"},x$={key:1,class:"px-2"},w$={key:1,class:"w-full"},k$={class:"text-sm text-gray-700 border-b border-b-gray-200 last:border-b-0"},S$={class:"text-gray-500 p-2 pl-0 min-w-[114px] content-start"},$$={class:"py-1"},C$={class:"font-medium text-gray-700 whitespace-pre-wrap"},T$={key:1},E$={key:0,class:"px-2"},A$=[l("div",{class:"text-sm font-normal text-blue-400 underline underline-offset-2 text-left"}," Nhập thông tin ",-1)],yg={__name:"CardFormContact",props:{message:{type:Object}},setup(e){const t=e,{widgets:n}=Xs(),{getStorage:s}=Gs(),r=R(!1),o=R({}),i=ee(()=>{var h,g;return n.value.contact.is_finish||n.value.contact.submission_data||((g=(h=t.message.content)==null?void 0:h.submission)==null?void 0:g.submission_data)}),a=()=>{B.isOpenFormContact=!0},c=()=>{var h,g;n.value.contact.is_finish=0,n.value.contact.submission_data=null,o.value=((g=(h=t.message.content)==null?void 0:h.submission)==null?void 0:g.submission_data)??{}};Pe(()=>{var h;return(h=n.value.contact)==null?void 0:h.fields},h=>{var g,p;i.value||(p=(g=t.message.content)==null?void 0:g.submission)!=null&&p.submission_data||(o.value||(o.value={}),h==null||h.forEach(v=>{v.value&&(o.value[v.name]=v.value)}))},{deep:!0});const u=ee(()=>{var h,g;return((g=(h=t.message.content)==null?void 0:h.submission)==null?void 0:g.submission_data)??null});Pe(()=>n.value.contact.submission_data,h=>{o.value=h??{}});const d=ee(()=>Object.values(o.value).filter(h=>h).length>1),f=async()=>{if(r.value)return;r.value=!0;const h=s("easychatgpt_conversations",B.handle),g={status:"submitted",message_id:t.message.id,conversation_id:h,submission_data:o.value},{data:p,status:v}=await Xe.submission.submitWidget({widgetId:n.value.contact.id,formData:g});v===200&&(B.isOpenFormContact=!1,n.value.contact.is_finish=1,o.value=p.submission_data),r.value=!1};return Qe(()=>{c(),n.value.contact.message_id=t.message.id}),(h,g)=>(m(),x("div",r$,[l("span",o$,[y(B).bot&&y(B).bot.config.ui.logo?(m(),x("img",{key:0,src:y(B).bot.config.ui.logo,alt:y(B).bot.config.ui.name,class:"w-full h-full object-cover"},null,8,i$)):q("",!0)]),y(n).contact?(m(),x("div",a$,[l("div",l$,[l("div",c$,j(y(n).contact.name),1),!i.value&&d.value?(m(),x("button",{key:0,onClick:g[0]||(g[0]=p=>f()),class:"flex items-center space-x-1 text-sm text-primary bg-white rounded-md px-2 py-1"},[u$,r.value?(m(),oe(y(E2),{key:0,size:"14","stroke-width":"2",class:"animation-rotate"})):(m(),oe(y(Bu),{key:1,size:"14"}))])):(m(),x("div",d$,[i.value?(m(),x("div",f$,[h$,G(y(il),{size:"16","stroke-width":"2"})])):(m(),oe(y(z2),{key:1,size:"20",class:"text-white"}))]))]),l("div",p$,[u.value?(m(),x("table",m$,[(m(!0),x(be,null,Ie(y(n).contact.fields,p=>(m(),x("tr",g$,[l("td",v$,j(p.label),1),l("td",y$,[u.value[p.name]?(m(),x("div",b$,[l("span",_$,j(u.value[p.name]),1)])):(m(),x("div",x$,"-"))])]))),256))])):(m(),x("table",w$,[(m(!0),x(be,null,Ie(y(n).contact.fields,(p,v)=>(m(),x("tr",k$,[l("td",S$,j(p.label),1),l("td",$$,[o.value[p.name]?(m(),x("div",{key:0,onClick:g[1]||(g[1]=_=>!i.value&&a()),class:te(["flex items-center px-2 py-1.5 rounded-md",!i.value&&"hover:bg-gray-100 cursor-pointer"])},[l("span",C$,j(o.value[p.name]),1),i.value?q("",!0):(m(),oe(y(D2),{key:0,size:"14",class:"text-gray-500 ml-auto flex-shrink-0"}))],2)):(m(),x("div",T$,[i.value?(m(),x("div",E$,"-")):(m(),x("button",{key:1,class:"text-gray-700 font-medium px-2 py-1.5 hover:bg-gray-100 w-full rounded-lg",onClick:g[2]||(g[2]=_=>a())},A$))]))])]))),256))]))])])):q("",!0)]))}};function Xu(){return{isLocked:ee(()=>ae.state.dropdownLockCount>0),lockScroll:()=>{ae.actions.lockDropdown()},unlockScroll:()=>{ae.actions.unlockDropdown()}}}const I$={class:"flex items-center justify-between mb-2.5"},P$={class:"flex gap-1 font-semibold text-sm text-gray-900"},M$={class:"grid grid-cols-7 mb-1"},O$={class:"grid grid-cols-7 gap-1"},R$=["disabled","onClick"],L$=300,D$=280,j$=Ke({__name:"FormDatepicker",props:{modelValue:{type:String,default:""},disabled:{type:Boolean,default:!1},locale:{type:String,default:"vi",validator:e=>["vi","en"].includes(e)},iconPosition:{type:String,default:"left",validator:e=>["left","right"].includes(e)},classField:{type:[String,Array,Object],default:""},hasError:{type:Boolean,default:!1}},emits:["update:modelValue","change","blur"],setup(e,{emit:t}){const{lockScroll:n,unlockScroll:s}=Xu(),r=ee(()=>ae.state.chatContainerRef||ae.state.rootMarketplaceRef||"body"),o=e,i=t,a={vi:{months:["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"],weekdays:["CN","T2","T3","T4","T5","T6","T7"],placeholder:"DD/MM/YYYY"},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Su","Mo","Tu","We","Th","Fr","Sa"],placeholder:"DD/MM/YYYY"}},c=ee(()=>a[o.locale]||a.vi),u=R(!1),d=R(null),f=R(null),h=R("bottom"),g=R({}),p=()=>{if(!f.value)return;const K=f.value.getBoundingClientRect(),F=ae.state.chatContainerRef||ae.state.rootMarketplaceRef,ne=F?F.getBoundingClientRect():{top:0,bottom:window.innerHeight,left:0,right:window.innerWidth},fe=ne.bottom-K.bottom,_e=K.top-ne.top,we=fe<L$&&_e>fe;h.value=we?"top":"bottom";const je=Math.max(ne.left,Math.min(K.left,ne.right-D$-4));g.value=we?{position:"fixed",bottom:`${window.innerHeight-K.top+6}px`,left:`${je}px`}:{position:"fixed",top:`${K.bottom+6}px`,left:`${je}px`}},v=new Date;v.setHours(0,0,0,0);const _=R(null),k=R(v.getFullYear()),w=R(v.getMonth()),$=K=>{if(!K)return null;let F=String(K).match(/^(\d{4})-(\d{2})-(\d{2})/);return F?new Date(+F[1],+F[2]-1,+F[3]):(F=String(K).match(/^(\d{2})\/(\d{2})\/(\d{4})$/),F?new Date(+F[3],+F[2]-1,+F[1]):null)},E=K=>{if(!K)return"";const F=String(K.getDate()).padStart(2,"0"),ne=String(K.getMonth()+1).padStart(2,"0"),fe=K.getFullYear();return`${F}/${ne}/${fe}`},P=K=>{if(!K)return"";const F=String(K.getDate()).padStart(2,"0"),ne=String(K.getMonth()+1).padStart(2,"0");return`${K.getFullYear()}-${ne}-${F}`},I=ee(()=>c.value.placeholder),M=ee(()=>E(_.value)),L=ee(()=>c.value.months[w.value]),V=ee(()=>c.value.weekdays),X=ee(()=>{const K=k.value,F=w.value,ne=new Date(K,F,1).getDay(),fe=new Date(K,F+1,0).getDate(),_e=new Date(K,F,0).getDate(),we=[];for(let pe=ne-1;pe>=0;pe--)we.push({key:`prev-${pe}`,day:_e-pe,otherMonth:!0,isToday:!1,isSelected:!1,empty:!1,date:new Date(K,F-1,_e-pe)});for(let pe=1;pe<=fe;pe++){const de=new Date(K,F,pe);we.push({key:`cur-${pe}`,day:pe,otherMonth:!1,isToday:de.getTime()===v.getTime(),isSelected:_.value?de.getTime()===_.value.getTime():!1,empty:!1,date:de})}const je=35,re=Math.max(0,je-we.length);for(let pe=1;pe<=re;pe++)we.push({key:`next-${pe}`,day:pe,otherMonth:!0,isToday:!1,isSelected:!1,empty:!1,date:new Date(K,F+1,pe)});return we.slice(0,je)}),T=()=>{u.value||(p(),n(),u.value=!0,_.value&&(k.value=_.value.getFullYear(),w.value=_.value.getMonth()))},A=()=>{u.value&&s(),u.value=!1,i("blur")},D=()=>{w.value===0?(w.value=11,k.value--):w.value--},Q=()=>{w.value===11?(w.value=0,k.value++):w.value++},W=K=>{_.value=K.date,i("update:modelValue",P(K.date)),i("change",P(K.date)),A()},H=K=>{var F,ne;u.value&&((F=f.value)!=null&&F.contains(K.target)||(ne=d.value)!=null&&ne.contains(K.target)||A())};return Qe(()=>document.addEventListener("mousedown",H)),Jn(()=>{document.removeEventListener("mousedown",H),u.value&&s()}),Pe(()=>o.modelValue,K=>{const F=$(K);F&&(!_.value||F.getTime()!==_.value.getTime())?_.value=F:K||(_.value=null)},{immediate:!0}),(K,F)=>(m(),x("div",{class:te(["relative w-full select-none",{"opacity-70":e.disabled}])},[l("div",{ref_key:"triggerRef",ref:f,class:te(["flex items-center gap-2 w-full h-[42px] px-3 border rounded-xl bg-white transition-colors",[e.classField,{"border-red-500":e.hasError,"border-gray-200 hover:border-gray-300":!e.hasError,"justify-between":e.iconPosition==="right","cursor-not-allowed bg-gray-50":e.disabled,"cursor-pointer":!e.disabled}]]),onClick:F[0]||(F[0]=ne=>!e.disabled&&T())},[e.iconPosition==="left"?(m(),oe(y(Hm),{key:0,class:"w-[18px] h-[18px] shrink-0 text-gray-400",size:18})):q("",!0),l("span",{class:te(["flex-1 text-sm truncate",M.value?"text-gray-700":"text-gray-400"])},j(M.value||I.value),3),e.iconPosition==="right"?(m(),oe(y(Hm),{key:1,class:"w-[18px] h-[18px] shrink-0 text-gray-400",size:18})):q("",!0)],2),(m(),oe(Kc,{to:r.value},[G(Yt,{name:"dp-fade"},{default:Se(()=>[u.value?(m(),x("div",{key:0,class:te([`drop-${h.value}`,"z-[9999] w-[280px] bg-white border border-gray-200 rounded-2xl shadow-xl p-3"]),style:ht(g.value),ref_key:"dropdownRef",ref:d},[l("div",I$,[l("button",{type:"button",class:"w-7 h-7 flex items-center justify-center bg-gray-100 hover:bg-gray-200 rounded-lg cursor-pointer text-[18px] leading-none text-gray-700 transition-colors border-0",onClick:D}," "),l("div",P$,[l("span",null,j(L.value),1),l("span",null,j(k.value),1)]),l("button",{type:"button",class:"w-7 h-7 flex items-center justify-center bg-gray-100 hover:bg-gray-200 rounded-lg cursor-pointer text-[18px] leading-none text-gray-700 transition-colors border-0",onClick:Q}," ")]),l("div",M$,[(m(!0),x(be,null,Ie(V.value,ne=>(m(),x("span",{key:ne,class:"text-center text-[11px] font-semibold text-gray-400 py-1"},j(ne),1))),128))]),l("div",O$,[(m(!0),x(be,null,Ie(X.value,ne=>(m(),x("button",{key:ne.key,type:"button",disabled:ne.empty,class:te(["w-full size-8 flex items-center justify-center border-0 bg-transparent rounded-lg text-sm leading-8 transition-colors cursor-pointer",{"pointer-events-none":ne.empty,"hover:bg-gray-100":!ne.isSelected,"text-gray-300":ne.otherMonth&&!ne.isSelected,"text-gray-700":!ne.otherMonth&&!ne.isSelected&&!ne.isToday,"font-bold text-primary":ne.isToday&&!ne.isSelected,"!bg-primary text-white font-semibold":ne.isSelected}]),onClick:fe=>!ne.empty&&W(ne)},j(ne.empty?"":ne.day),11,R$))),128))])],6)):q("",!0)]),_:1})],8,["to"]))],2))}},[["__scopeId","data-v-e341d518"]]),N$=e=>(nn("data-v-28eacf7e"),e=e(),sn(),e),F$={class:"flex items-center justify-center gap-0.5"},z$={class:"grid items-center justify-items-center gap-0.5",style:{"grid-template-rows":"20px 36px 20px"}},q$=["value"],B$=N$(()=>l("span",{class:"text-lg font-bold text-gray-700 self-center pb-0.5"},":",-1)),U$={class:"grid items-center justify-items-center gap-0.5",style:{"grid-template-rows":"20px 36px 20px"}},V$=["value"],H$=160,W$=150,bg=8,_g=30,G$=Ke({__name:"FormTimer",props:{modelValue:{type:String,default:""},disabled:{type:Boolean,default:!1},locale:{type:String,default:"vi",validator:e=>["vi","en"].includes(e)},classField:{type:[String,Array,Object],default:""},hasError:{type:Boolean,default:!1}},emits:["update:modelValue","change","blur"],setup(e,{emit:t}){const{lockScroll:n,unlockScroll:s}=Xu(),r=ee(()=>ae.state.chatContainerRef||ae.state.rootMarketplaceRef||"body"),o=e,i=t,a={vi:{placeholder:"HH:MM",confirm:"Chọn"},en:{placeholder:"HH:MM",confirm:"Set"}},c=ee(()=>a[o.locale]||a.vi),u=R(!1),d=R(null),f=R(null),h=R("bottom"),g=R({}),p=R(0),v=R(0),_=R("00"),k=R("00"),w=ee(()=>c.value.placeholder),$=ee(()=>{if(!o.modelValue)return"";const[F="",ne=""]=o.modelValue.split(":"),fe=parseInt(F,10),_e=parseInt(ne,10);return isNaN(fe)||isNaN(_e)?"":`${String(fe).padStart(2,"0")}:${String(_e).padStart(2,"0")}`}),E=()=>{if(!d.value)return;const F=d.value.getBoundingClientRect(),ne=ae.state.chatContainerRef||ae.state.rootMarketplaceRef,fe=ne?ne.getBoundingClientRect():{top:0,bottom:window.innerHeight,left:0,right:window.innerWidth},_e=fe.bottom-F.bottom,we=F.top-fe.top,je=_e<H$&&we>_e;h.value=je?"top":"bottom";const re=Math.max(fe.left,Math.min(F.left,fe.right-W$-4));g.value=je?{position:"fixed",bottom:`${window.innerHeight-F.top+6}px`,left:`${re}px`}:{position:"fixed",top:`${F.bottom+6}px`,left:`${re}px`}},P=()=>{u.value?I():(E(),n(),u.value=!0)},I=()=>{u.value&&s(),u.value=!1,i("blur")},M=()=>{p.value=(p.value+1)%24,_.value=String(p.value).padStart(2,"0")},L=()=>{p.value=(p.value+23)%24,_.value=String(p.value).padStart(2,"0")},V=F=>{const ne=F.target.value.replace(/\D/g,"").slice(0,2);F.target.value=ne,_.value=ne;const fe=parseInt(ne,10);isNaN(fe)||(p.value=Math.min(23,fe))},X=()=>{const F=Math.min(23,Math.max(0,parseInt(_.value,10)||0));p.value=F,_.value=String(F).padStart(2,"0")},T=()=>{v.value=(v.value+1)%60,k.value=String(v.value).padStart(2,"0")},A=()=>{v.value=(v.value+59)%60,k.value=String(v.value).padStart(2,"0")},D=F=>{const ne=F.target.value.replace(/\D/g,"").slice(0,2);F.target.value=ne,k.value=ne;const fe=parseInt(ne,10);isNaN(fe)||(v.value=Math.min(59,fe))},Q=()=>{const F=Math.min(59,Math.max(0,parseInt(k.value,10)||0));v.value=F,k.value=String(F).padStart(2,"0")},W=()=>{const F=`${String(p.value).padStart(2,"0")}:${String(v.value).padStart(2,"0")}`;i("update:modelValue",F),i("change",F),I()},H=F=>{if(!F){p.value=bg,v.value=_g,_.value=String(bg).padStart(2,"0"),k.value=String(_g).padStart(2,"0");return}const[ne,fe]=F.split(":").map(Number);isNaN(ne)||isNaN(fe)||(p.value=Math.min(23,Math.max(0,ne)),v.value=Math.min(59,Math.max(0,fe)),_.value=String(p.value).padStart(2,"0"),k.value=String(v.value).padStart(2,"0"))},K=F=>{var ne,fe;u.value&&((ne=d.value)!=null&&ne.contains(F.target)||(fe=f.value)!=null&&fe.contains(F.target)||I())};return Qe(()=>document.addEventListener("mousedown",K)),Jn(()=>{document.removeEventListener("mousedown",K),u.value&&s()}),Pe(()=>o.modelValue,H,{immediate:!0}),(F,ne)=>(m(),x("div",{class:te(["relative w-full select-none",{"opacity-70":e.disabled}])},[l("div",{ref_key:"triggerRef",ref:d,class:te(["flex items-center gap-2 w-full h-[42px] px-3 border rounded-xl bg-white transition-colors",[e.classField,{"border-red-500":e.hasError,"border-gray-200 hover:border-gray-300":!e.hasError,"cursor-not-allowed bg-gray-50":e.disabled,"cursor-pointer":!e.disabled}]]),onClick:ne[0]||(ne[0]=fe=>!e.disabled&&P())},[G(y(v2),{class:"w-[18px] h-[18px] shrink-0 text-gray-400",size:18}),l("span",{class:te(["flex-1 text-sm",$.value?"text-gray-700":"text-gray-400"])},j($.value||w.value),3)],2),(m(),oe(Kc,{to:r.value},[G(Yt,{name:"timer-fade"},{default:Se(()=>[u.value?(m(),x("div",{key:0,class:te([`drop-${h.value}`,"z-[9999] w-[150px] bg-white border border-gray-200 rounded-2xl shadow-xl p-2.5 flex flex-col gap-2"]),style:ht(g.value),ref_key:"dropdownRef",ref:f},[l("div",F$,[l("div",z$,[l("button",{type:"button",class:"w-[50px] h-5 flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-700 rounded-md transition-colors border-0 bg-transparent cursor-pointer",onClick:M},[G(y(Wm),{size:16})]),l("input",{type:"text",inputmode:"numeric",class:"w-[50px] h-9 bg-gray-100 border border-transparent focus:border-primary focus:bg-white rounded-lg text-lg font-medium text-gray-900 text-center outline-none p-0 cursor-text transition-colors appearance-none",value:_.value,onInput:V,onBlur:X,onFocus:ne[1]||(ne[1]=fe=>fe.target.select()),maxlength:"2"},null,40,q$),l("button",{type:"button",class:"w-[50px] h-5 flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-700 rounded-md transition-colors border-0 bg-transparent cursor-pointer",onClick:L},[G(y(uo),{size:16})])]),B$,l("div",U$,[l("button",{type:"button",class:"w-[50px] h-5 flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-700 rounded-md transition-colors border-0 bg-transparent cursor-pointer",onClick:T},[G(y(Wm),{size:16})]),l("input",{type:"text",inputmode:"numeric",class:"w-[50px] h-9 bg-gray-100 border border-transparent focus:border-primary focus:bg-white rounded-lg text-lg font-medium text-gray-900 text-center outline-none p-0 cursor-text transition-colors appearance-none",value:k.value,onInput:D,onBlur:Q,onFocus:ne[2]||(ne[2]=fe=>fe.target.select()),maxlength:"2"},null,40,V$),l("button",{type:"button",class:"w-[50px] h-5 flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-700 rounded-md transition-colors border-0 bg-transparent cursor-pointer",onClick:A},[G(y(uo),{size:16})])])]),l("button",{type:"button",class:"w-full h-8 border-0 rounded-lg bg-primary hover:opacity-90 text-white text-[13px] font-semibold cursor-pointer transition-opacity",onClick:W},j(c.value.confirm),1)],6)):q("",!0)]),_:1})],8,["to"]))],2))}},[["__scopeId","data-v-28eacf7e"]]),K$={class:"field-date-time__label"},Q$={key:0},J$={class:"field-date-time__controls"},X$=Ke({__name:"FieldDateTime",props:{field:{type:Object,required:!0},modelValue:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},classField:{type:[String,Boolean,Array,Object],default:""},locale:{type:String,default:"vi",validator:e=>["vi","en"].includes(e)},iconPosition:{type:String,default:"left",validator:e=>["left","right"].includes(e)},hasError:{type:Boolean,default:!1}},emits:["update:modelValue","validate","focus","blur"],setup(e,{emit:t}){const n=e,s=t,r=R(""),o=R(""),i=ee(()=>{var g;return(g=n.field.validate)==null?void 0:g.includes("required")}),a=g=>{const p=g?String(g):"",[v="",_=""]=p.split(/[T ]/);r.value=v,o.value=_.slice(0,5)},c=g=>{const p=!i.value||!!g;s("validate",n.field.name,p)},u=()=>{const g=r.value&&o.value?`${r.value}T${o.value}`:"";s("update:modelValue",g),c(g)},d=g=>{r.value=g,u()},f=g=>{o.value=g,u()},h=()=>{u(),s("blur")};return Pe(()=>n.modelValue,a,{immediate:!0}),(g,p)=>(m(),x("div",{class:te(["field-date-time",{"is-disabled":e.disabled}])},[l("label",K$,[Be(j(e.field.label)+" ",1),i.value?(m(),x("span",Q$,"*")):q("",!0)]),l("div",J$,[G(j$,{"model-value":r.value,disabled:e.disabled,locale:e.locale,"icon-position":e.iconPosition,"class-field":e.classField,"has-error":e.hasError,"onUpdate:modelValue":d,onBlur:h},null,8,["model-value","disabled","locale","icon-position","class-field","has-error"]),G(G$,{"model-value":o.value,disabled:e.disabled,locale:e.locale,"class-field":e.classField,"has-error":e.hasError,"onUpdate:modelValue":f,onBlur:h},null,8,["model-value","disabled","locale","class-field","has-error"])])],2))}},[["__scopeId","data-v-c47ffb31"]]),Z$=e=>(nn("data-v-a29ef6aa"),e=e(),sn(),e),Y$={class:"relative"},eC={key:0,class:"space-y-1.5"},tC=["for"],nC={key:0},sC=["type","id","value","placeholder","disabled"],rC={key:2,class:"space-y-1.5"},oC=["for"],iC={key:0},aC={class:"relative"},lC=["id","value","disabled"],cC={value:"",disabled:""},uC=["value"],dC=Z$(()=>l("div",{class:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none"},[l("svg",{class:"h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[l("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),fC={key:3,class:"space-y-1.5"},hC=["for"],pC={key:0},mC=["id","value","placeholder","disabled"],gC={key:4,class:"relative"},vC=["for"],yC={class:"flex items-center cursor-pointer relative mt-1"},bC=["type","id","checked","disabled"],_C={class:"absolute text-white opacity-0 peer-checked:opacity-100 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 pointer-events-none"},xC=["innerHTML"],wC={class:"text-xs text-red-500 flex items-center gap-1 pt-0.5 pl-1"},kC=["innerHTML"],SC={class:"text-xs text-gray-500 pl-1"},$C=["innerHTML"],Zu=Ke({__name:"FormFieldV2",props:{field:{type:Object,required:!0},modelValue:{type:[String,Number,Boolean]},error:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","validate"],setup(e,{emit:t}){const{t:n}=vs(),s=e,r=t,o=R(""),i=R(""),a=ee(()=>{var E;return((E=s.field.validate)==null?void 0:E.includes("required"))||!1}),c=ee(()=>!!(o.value||s.error)),u=ee(()=>o.value||s.error),d=ee(()=>[{"bg-gray-50 cursor-not-allowed":s.disabled},"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"]),f=ee(()=>s.field.placeholder||n("form.placeholder")),h=(E,P={})=>n(`form.validation.${E}`,{label:s.field.label,...P}),g=()=>{w(i.value||s.modelValue)},p=(E,P)=>{P?o.value="":o.value=s.field.error||h("required")||"",r("validate",E,P)},v=E=>{if(s.disabled)return;let P=E.target.value;i.value=P,P?w(P):o.value="",r("update:modelValue",P)},_=E=>{s.disabled||(i.value=E,E?w(E):o.value="",r("update:modelValue",E))},k=E=>{if(s.disabled)return;const P=E.target.checked;r("update:modelValue",P),$(P)},w=(E=s.modelValue)=>{var L;o.value="";const P=((L=s.field.validate)==null?void 0:L.split("|"))||[],I=String(E||"").trim();if(P.includes("nullable")&&!I)return r("validate",s.field.name,!0),!0;const M=s.field.name;for(const V of P){if(V==="nullable")continue;const[X,T]=V.split(":");if(X==="required"&&!I)return o.value=s.field.error||h("required"),r("validate",s.field.name,!1),!1;if(!(!I&&X!=="required")){if(M==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(I))return o.value=s.field.error||h("email"),r("validate",s.field.name,!1),!1;if(M==="phone"&&!/^(\+84|0)[3|5|7|8|9][0-9]{8}$/.test(I.replace(/[\s()-]/g,"")))return o.value=s.field.error||h("phone"),r("validate",s.field.name,!1),!1;if(X==="min"&&I.length<parseInt(T))return o.value=s.field.error||h("min",{value:T}),r("validate",s.field.name,!1),!1;if(X==="max"&&I.length>parseInt(T))return o.value=s.field.error||h("max",{value:T}),r("validate",s.field.name,!1),!1}}return r("validate",s.field.name,!0),!0},$=(E=s.modelValue)=>{var I;o.value="";const P=((I=s.field.validate)==null?void 0:I.split("|"))||[];for(const M of P){const[L]=M.split(":");if(L==="required"&&!E)return o.value=s.field.error||h("required"),r("validate",s.field.name,!1),!1}return r("validate",s.field.name,!0),!0};return(E,P)=>(m(),x("div",Y$,[["text","email","tel"].includes(e.field.type)?(m(),x("div",eC,[l("label",{for:e.field.name,class:"field-label"},[Be(j(e.field.label)+" ",1),a.value?(m(),x("span",nC,"*")):q("",!0)],8,tC),l("input",{type:e.field.type,id:e.field.name,value:e.modelValue,placeholder:f.value,onInput:v,onBlur:g,autocomplete:"off",disabled:e.disabled,class:te(["w-full px-3 border border-input rounded-xl focus:outline-none h-[42px] text-base lg:text-sm",d.value])},null,42,sC)])):e.field.type==="date"?(m(),oe(X$,{key:1,"model-value":e.modelValue,field:e.field,disabled:e.disabled,"onUpdate:modelValue":_,onValidate:p,onBlur:g},null,8,["model-value","field","disabled"])):e.field.type==="select"?(m(),x("div",rC,[l("label",{for:e.field.name,class:"field-label"},[Be(j(e.field.label)+" ",1),a.value?(m(),x("span",iC,"*")):q("",!0)],8,oC),l("div",aC,[l("select",{id:e.field.name,value:e.modelValue,onChange:v,onBlur:g,disabled:e.disabled,class:te(["custom-select w-full px-3 border border-input rounded-xl focus:outline-none h-[42px] text-base appearance-none",d.value])},[l("option",cC,j(f.value),1),(m(!0),x(be,null,Ie(e.field.options,(I,M)=>(m(),x("option",{key:M,value:I},j(I),9,uC))),128))],42,lC),dC])])):e.field.type==="textarea"?(m(),x("div",fC,[l("label",{for:e.field.name,class:"field-label"},[Be(j(e.field.label)+" ",1),a.value?(m(),x("span",pC,"*")):q("",!0)],8,hC),l("textarea",{id:e.field.name,value:e.modelValue,placeholder:f.value,onInput:v,onBlur:g,disabled:e.disabled,class:te(["w-full resize-none block px-3 py-2 border border-input rounded-xl focus:outline-none transition-colors duration-200 text-base lg:text-sm",d.value]),rows:"2"},null,42,mC)])):e.field.type==="checkbox"?(m(),x("div",gC,[l("label",{for:e.field.name,class:te(["flex items-start",{"cursor-not-allowed opacity-70":e.disabled}])},[l("div",yC,[l("input",{type:e.field.type,id:e.field.name,checked:e.modelValue,onChange:k,disabled:e.disabled,class:te(["peer h-[18px] w-[18px] cursor-pointer transition-all appearance-none rounded border border-slate-300 checked:bg-primary checked:border-primary outline-none ring-0 focus:ring-0 focus:outline-none",{"cursor-not-allowed opacity-70":e.disabled}])},null,42,bC),l("span",_C,[G(y(ol),{"stroke-width":3,size:14})])]),l("div",{class:"ml-1.5 text-gray-700 prose prose-sm leading-[140%] select-text cursor-pointer",innerHTML:e.field.label},null,8,xC)],10,vC)])):q("",!0),Rt(l("p",wC,[G(y(Gm),{size:"14","stroke-width":"1.5"}),l("div",{innerHTML:u.value},null,8,kC)],512),[[Jo,i.value&&c.value&&e.field.type!=="checkbox"]]),Rt(l("p",SC,[l("div",{innerHTML:e.field.hint},null,8,$C)],512),[[Jo,e.field.hint]])]))}},[["__scopeId","data-v-a29ef6aa"]]),CC={key:"submitted",class:"overflow-auto bg-white text-gray-900 flex flex-col items-center justify-center"},TC={class:"flex flex-col items-center justify-center text-center"},EC={class:"mt-2 text-2xl font-semibold text-gray-950"},AC={class:"mt-1 text-sm text-gray-500"},IC={key:0,class:"bg-gray-50 rounded-xl p-2 py-1 w-full mt-4 divide-y"},PC={class:"min-w-0 flex-1"},MC={class:"text-sm text-gray-500"},OC={class:"mt-1 break-words text-base text-gray-950"},RC={key:"form"},LC={key:0,class:"text-lg font-semibold text-gray-900"},DC={key:1,class:"mt-1 text-sm text-gray-500"},jC={class:"space-y-3"},NC={class:"mt-4"},FC=["disabled"],zC={key:1,class:"px-3 flex justify-center items-center bg-primary h-[48px] text-white rounded-3xl text-center text-sm"},qC=l("div",null,"Đã gửi",-1),BC={class:"flex items-center justify-center gap-2 text-sm text-green-600 bg-green-50 rounded-full py-2 px-3"},UC={__name:"WidgetFormContact",props:{widget:{type:Object,required:!0},messageId:{type:[String,Number],default:null},conversationId:{type:String,default:null},submission:{type:Object,default:null}},setup(e){const t=e,n=R([]),s=R(!1),r=R(!1),o=R(null),i={hint:null,name:"address",type:"text",label:"Địa chỉ",value:null,options:[],validate:"",placeholder:"Nhập địa chỉ"},a=["sieuthichongthamcomvn-lui","chinhnhanvn-of8","kesgroupvn-dk0","kimtingroupcom"],c=dt({}),u=dt({}),d=R(!1),f=R({}),h=R(null),g=ee(()=>![!1,0,"false","0"].includes(t.widget.showFormTitle)),p=ee(()=>v.value&&![!1,0,"false","0"].includes(t.widget.showFormDescription)),v=ee(()=>{const F=t.widget.description;return typeof F=="string"?F:(F==null?void 0:F.vi)??(F==null?void 0:F.en)??""}),_=ee(()=>f.value.source),k=ee(()=>r.value&&_.value!=="website"),w=ee(()=>t.widget.type==="booking_appointment"?"Đặt lịch thành công":"Gửi thông tin thành công"),$=ee(()=>"Cảm ơn bạn! Thông tin của bạn đã được gửi đi."),E=ee(()=>T(t.widget.successTitle)||w.value),P=ee(()=>T(t.widget.successDescription)||$.value),I=ee(()=>T(t.widget.buttonText)||"Gửi yêu cầu"),M=ee(()=>{let F=n.value.filter(we=>!we.hidden);ae.state.handle==="eradovn-fyw"&&(F=F.filter(we=>we.type!=="email"&&we.name!=="demand"));const fe=f.value.hideFields;if(!fe)return F;const _e=fe.split(",").map(we=>we.trim());return F.filter(we=>!_e.includes(we.name))}),L=ee(()=>M.value.filter(F=>{const ne=c[F.name];return ne!=null&&String(ne)!==""})),V=F=>{var ne,fe;return typeof F.label=="string"?F.label:((ne=F.label)==null?void 0:ne.vi)??((fe=F.label)==null?void 0:fe.en)??F.name},X=F=>Array.isArray(F)?F.join(", "):F&&typeof F=="object"?JSON.stringify(F):String(F).replace("T"," "),T=F=>typeof F!="string"?"":F.trim();Pe([r,_],([F,ne])=>{F&&ne==="website"&&setTimeout(()=>{r.value=!1},3e3)});const A=()=>{var fe;const F=o.value;if(!F)return;const ne=F.offsetHeight;window.parent.postMessage({type:"resize-iframe",height:ne+1,message_id:(fe=f.value)==null?void 0:fe.message_id},"*")},D=()=>{setTimeout(A,50)},Q=ee(()=>Object.keys(u).length>0?!1:M.value.filter(ne=>ne.validate==="required").map(ne=>ne.name).every(ne=>{const fe=c[ne];return fe!=null&&String(fe).trim()!==""})),W=(F,ne)=>{ne?delete u[F]:u[F]="",D()},H=async F=>{var _e;if(d.value=!0,Object.keys(u).length>0){D();return}_.value==="website"&&(c.page_url=window.location.href);const fe={status:"submitted",submission_data:c,message_id:t.messageId??f.value.message_id,conversation_id:t.conversationId??f.value.conversation_id};f.value.source==="website"&&(fe.page_url=window.location.href);try{s.value=!0;const we=await Xe.submission.submitWidget({widgetId:t.widget.id,formData:fe});h.value=((_e=we.data)==null?void 0:_e.submission_data)??{...c},r.value=!0,window.parent.postMessage({type:"submit-metric",submission_id:we.data.id},"*")}catch(we){console.error("Error submitting form:",we)}finally{s.value=!1,D()}};Pe([r,s],D);const K=()=>{n.value=t.widget.fields;const F=ae.state.handle;if(F&&a.includes(F)){const ne=n.value.findIndex(fe=>fe.name==="demand");ne!==-1&&(n.value.some(_e=>_e.name==="address")||n.value.splice(ne+1,0,i))}if(setTimeout(A,100),typeof ResizeObserver<"u"){const ne=o.value;ne&&new ResizeObserver(A).observe(ne)}};return Qe(()=>{var ne,fe;K(),f.value=Qa(window.location.href);const F=t.submission??(f.value.submission&&f.value.source!=="website"?JSON.parse(decodeURIComponent(f.value.submission)):null);if(F&&((ne=f.value).message_id??(ne.message_id=F==null?void 0:F.message_id),(fe=f.value).conversation_id??(fe.conversation_id=F==null?void 0:F.conversation_id),h.value=F==null?void 0:F.submission_data,h.value)){for(const _e in h.value)c[_e]=h.value[_e];r.value=!0}}),(F,ne)=>(m(),x("div",{ref_key:"contactWidgetContainer",ref:o,class:"relative"},[G(Yt,{mode:"out-in","enter-active-class":"transition duration-300 ease-out","enter-from-class":"opacity-0 translate-y-3","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition duration-200 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 -translate-y-2"},{default:Se(()=>[k.value?(m(),x("div",CC,[l("div",TC,[l("div",EC,j(E.value),1),l("div",AC,j(P.value),1)]),L.value.length?(m(),x("div",IC,[(m(!0),x(be,null,Ie(L.value,fe=>(m(),x("div",{key:fe.name,class:"p-2"},[l("div",PC,[l("div",MC,j(V(fe)),1),l("div",OC,j(X(c[fe.name])),1)])]))),128))])):q("",!0)])):(m(),x("div",RC,[g.value?(m(),x("div",LC,j(e.widget.name),1)):q("",!0),p.value?(m(),x("div",DC,j(v.value),1)):q("",!0),l("form",{onSubmit:Gt(H,["prevent"]),class:te(p.value||g.value?"mt-3":"mt-0")},[l("div",jC,[(m(!0),x(be,null,Ie(M.value,fe=>(m(),oe(Zu,{key:fe.name,modelValue:c[fe.name],"onUpdate:modelValue":_e=>c[fe.name]=_e,field:fe,error:u[fe.name],disabled:r.value,onValidate:W},null,8,["modelValue","onUpdate:modelValue","field","error","disabled"]))),128))]),l("div",NC,[r.value?q("",!0):(m(),x("button",{key:0,type:"submit",class:te(["w-full font-medium bg-primary text-white text-sm h-[48px] px-8 rounded-xl transition duration-200 focus:outline-none ring-0 flex justify-center items-center",[Q.value?"":"opacity-70 cursor-not-allowed"]]),disabled:s.value||!Q.value},j(s.value?"Đang gửi...":I.value),11,FC)),r.value?(m(),x("div",zC,[qC,G(y(Bu),{size:"16",class:"ml-2"})])):q("",!0),r.value&&_.value==="website"?(m(),x("div",{key:2,class:te(["success-notification transition-opacity duration-300 mt-3",{"opacity-0":!r.value,"opacity-100":r.value}])},[l("div",BC,[G(y(il),{class:"w-5 h-5"}),l("span",null,j(E.value),1)])],2)):q("",!0)])],34)]))]),_:1})],512))}},VC={key:0,class:"w-full"},HC={key:1,class:"w-[95%] flex items-end space-x-2"},WC={class:"flex overflow-hidden relative flex-shrink-0 bg-white rounded-full size-8 message-avatar"},GC=["src","alt"],KC={key:0,class:"rounded-2xl w-full max-w-[420px] p-4 shadow-iframe-card"},QC={key:1,class:"rounded-2xl overflow-hidden w-full max-w-[420px] p-3 pt-4 shadow-iframe-card"},JC=["src"],XC={key:1,class:"w-full h-[calc(100vh-180px)] md:h-[calc(700px-180px)] rounded-2xl border border-gray-100 shadow-custom-soft overflow-hidden"},ZC=["src"],YC=Ke({__name:"CardIframe",props:["item","handle"],setup(e){const{widgets:t}=Xs(),n=e,s=R(180),r=R(!1),o=ee(()=>vn(n.item.content)),i=ee(()=>{var _;return(_=n.item)==null?void 0:_.id}),a=ee(()=>{var _;return((_=n.item)==null?void 0:_.conversation_id)??ro(n.handle)}),c=ee(()=>{var w,$;const _=($=(w=o.value)==null?void 0:w.iframe)==null?void 0:$.src;if(!_)return null;const k=_.match(/\/embed\/[^/]+\/([a-f0-9-]+)/);return k?k[1]:null}),u=ee(()=>{const _=c.value;return _?[t.value.contact,t.value.booking_appointment].find(w=>(w==null?void 0:w.id)===_)??null:null}),d=ee(()=>{var k,w,$;const _=(w=(k=o.value)==null?void 0:k.iframe)==null?void 0:w.src;return _?tw(_,{message_id:i.value,conversation_id:a.value,submission:($=o.value)!=null&&$.submission?encodeURIComponent(JSON.stringify(o.value.submission)):null,preview:r.value}):""}),f=_=>new URLSearchParams(window.location.search).get(_),h=_=>{var k,w;try{const $=_.data;$&&typeof $=="object"&&$.type==="resize-iframe"&&$.height&&((k=$.message_id)==null?void 0:k.toString())===((w=i.value)==null?void 0:w.toString())&&(s.value=$.height)}catch($){console.error("Error handling iframe message:",$)}},g=_=>{try{const k=_.data;k&&typeof k=="object"&&k.type==="submit-metric"&&k.submission_id&&Qt.widgetContact({handle:n.handle,submission_id:k.submission_id})}catch(k){console.error("Error handling iframe message:",k)}},p=_=>{h(_),g(_)},v=()=>{window.addEventListener("message",p)};return Qe(()=>{r.value=!!f("preview")}),Jn(()=>{window.removeEventListener("message",p)}),(_,k)=>{var w,$,E,P,I,M;return($=(w=o.value.iframe)==null?void 0:w.src)!=null&&$.includes("widget.easyaichat.app")||(P=(E=o.value.iframe)==null?void 0:E.src)!=null&&P.includes("widget.geteasy.ai")||(M=(I=o.value.iframe)==null?void 0:I.src)!=null&&M.includes("localhost:5174")?(m(),x("div",VC,[[y(Bn),y(qn),"stagingeasyaichatapp"].includes(y(B).handle)?(m(),oe(yg,{key:0,message:e.item},null,8,["message"])):(m(),x("div",HC,[l("span",WC,[y(B).bot&&y(B).bot.config.ui.logo?(m(),x("img",{key:0,src:y(B).bot.config.ui.logo,alt:y(B).bot.config.ui.name,class:"object-cover w-full h-full"},null,8,GC)):q("",!0)]),u.value?(m(),x("div",KC,[G(UC,{widget:u.value,"message-id":i.value,"conversation-id":a.value,submission:o.value.submission},null,8,["widget","message-id","conversation-id","submission"])])):(m(),x("div",QC,[l("iframe",{src:d.value,style:ht({height:s.value+"px"}),onLoad:v,frameborder:"0",class:"w-full duration-200 transition-height"},null,44,JC)]))]))])):(m(),x("div",XC,[l("iframe",{src:d.value,frameborder:"0",class:"w-full h-full"},null,8,ZC)]))}}},[["__scopeId","data-v-c1d8bdd9"]]),e5={class:"flex overflow-hidden relative bg-white rounded-full size-8 flex-shrink-0 message-avatar"},t5=["src","alt"],n5=["src","alt"],s5={__name:"ProductList",props:{products:{type:Array,default:()=>[]},message:{type:Object,default:()=>null}},emits:["open-flow-checkout","send-message","reset-padding"],setup(e,{emit:t}){const n=t,{bot:s,handle:r}=At(ae.state),o=R(!1),i=[qn,Bn],a=R(!1);Qe(()=>{const p=Qa(window.location.href);(p==null?void 0:p.easy_ai_test_production)==="rangdong"&&(a.value=!0),kt(()=>{n("reset-padding")})});const c=Wt(()=>Promise.resolve().then(()=>lz)),u=Wt(()=>Promise.resolve().then(()=>Mz)),d=Wt(()=>Promise.resolve().then(()=>Yz)),f=Wt(()=>Promise.resolve().then(()=>_q)),h=Wt(()=>Promise.resolve().then(()=>Hq)),g=ee(()=>i.includes(r.value)?{vertical:c,horizontal:u}:r.value===Mn&&a.value?{vertical:h,horizontal:h}:{vertical:d,horizontal:f});return(p,v)=>{var _,k,w,$;return e.products.length>1?(m(),x("div",{key:0,class:te(["grid grid-cols-2 border-l border-gray-200 ecg-slide-up",o.value&&"pointer-events-none opacity-95"])},[(m(!0),x(be,null,Ie(e.products,(E,P)=>(m(),oe(Nt(g.value.vertical),{type:"vertical",item:E,key:`product-${P}-${E.product_sku||""}`,onLoading:v[0]||(v[0]=I=>o.value=I),onOpenFlowCheckout:v[1]||(v[1]=I=>n("open-flow-checkout")),onSendMessage:v[2]||(v[2]=I=>n("send-message",I)),class:"border-r border-b [&:nth-child(1)]:border-t [&:nth-child(2)]:border-t border-gray-200"},null,40,["item"]))),128))],2)):(m(),x("div",{key:1,class:te([o.value&&"pointer-events-none opacity-95","flex items-end space-x-1 w-full max-w-[600px]"])},[l("span",e5,[(k=(_=e.message)==null?void 0:_.sender)!=null&&k.avatar?(m(),x("img",{key:0,src:e.message.sender.avatar,alt:e.message.sender.name,class:"object-cover w-full h-full"},null,8,t5)):(m(),x("img",{key:1,src:($=(w=y(s).config)==null?void 0:w.ui)==null?void 0:$.logo,alt:y(s).config.ui.name,class:"object-cover w-full h-full"},null,8,n5))]),(m(),oe(Nt(g.value.horizontal),{type:"horizontal",item:e.products[0],key:e.products[0].product_sku,onLoading:v[3]||(v[3]=E=>o.value=E),onOpenFlowCheckout:v[4]||(v[4]=E=>n("open-flow-checkout")),onSendMessage:v[5]||(v[5]=E=>n("send-message",E))},null,40,["item"]))],2))}}},xg=e=>{if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,s)).toFixed(2))+" "+n[s]},r5=()=>Date.now().toString(36)+Math.random().toString(36).substring(2,9),Yu={file_upload:[".pdf",".doc",".docx",".xls",".xlsx",".csv"],image_upload:[".jpg",".jpeg",".png",".webp",".bmp",".tiff",".tif",".heic",".avif"],audio_upload:[".mp3",".wav",".ogg",".m4a"]},Ze=dt({files:[],processedFiles:[],acceptTypes:".pdf,.doc,.docx,.jpg,.jpeg,.png,.gif,.xls,.xlsx,.csv",maxFileSize:10*1024*1024,maxFiles:10,uploading:!1,errors:[],toolbarConfig:null,autoUploadOnPaste:!0}),o5=5,i5=()=>ae.getters.isAgentEnabled.value?o5:Ze.maxFiles,wg=ee(()=>i5());function ml(){const{files:e,acceptTypes:t,maxFileSize:n,maxFiles:s,uploading:r,errors:o,processedFiles:i}=At(Ze),a=ee(()=>Ze.files.reduce((M,L)=>M+L.size,0)),c=ee(()=>Ze.files.length),u=ee(()=>{const M=Ze.files.map(V=>({...V,loading:V.uploading||!1}));return[...Ze.processedFiles.map(V=>({...V,loading:!1})),...M]}),d=ee(()=>{var L,V,X,T,A,D;const M=[];return(V=(L=Ze.toolbarConfig)==null?void 0:L.file_upload)!=null&&V.visible&&M.push(...Yu.file_upload),(T=(X=Ze.toolbarConfig)==null?void 0:X.image_upload)!=null&&T.visible&&M.push(...Yu.image_upload),(D=(A=Ze.toolbarConfig)==null?void 0:A.audio_upload)!=null&&D.visible&&M.push(...Yu.audio_upload),M}),f=M=>{var H,K,F,ne,fe,_e;if(Ze.errors=[],!(((K=(H=Ze.toolbarConfig)==null?void 0:H.file_upload)==null?void 0:K.visible)||((ne=(F=Ze.toolbarConfig)==null?void 0:F.image_upload)==null?void 0:ne.visible)||((_e=(fe=Ze.toolbarConfig)==null?void 0:fe.audio_upload)==null?void 0:_e.visible)))return Ze.errors.push("Tính năng upload chưa được kích hoạt"),!1;const V=d.value,X=wg.value,T=Ze.processedFiles.length+Ze.files.length;if(T>=X)return Ze.errors.push(`Chỉ được phép tải lên tối đa ${X} file`),!1;let A=X-T,D=0;const Q=Array.from(M).filter(we=>{const je=`.${we.name.split(".").pop().toLowerCase()}`;return V.includes(je)?A<=0?(D++,!1):we.size>Ze.maxFileSize?(Ze.errors.push(`File "${we.name}" vượt quá kích thước tối đa (${xg(Ze.maxFileSize)})`),!1):(A--,!0):(Ze.errors.push(`File "${we.name}" không thuộc loại được chấp nhận`),!1)});if(D>0&&Ze.errors.push(`Chỉ được phép tải lên tối đa ${X} file. Đã loại bỏ ${D} file cuối`),Q.length===0)return!1;const W=Q.map(we=>{const je={file:we,filename:we.name,size:we.size,mime_type:we.type,uploading:!1};return we.type.startsWith("image/")&&(je.previewUrl=URL.createObjectURL(we)),je});return Ze.files=[...Ze.files,...W],!0},h=M=>{const L=Ze.processedFiles.findIndex(V=>V.file_id===M);if(L!==-1)return Ze.processedFiles.splice(L,1),!0;if(typeof M=="number"&&M<Ze.files.length){const V=Ze.files[M];return V!=null&&V.previewUrl&&URL.revokeObjectURL(V.previewUrl),Ze.files.splice(M,1),!0}return!1},g=()=>{Ze.files.forEach(M=>{M.previewUrl&&URL.revokeObjectURL(M.previewUrl)}),Ze.files=[],Ze.processedFiles=[],Ze.errors=[]},p=M=>{M&&(Ze.toolbarConfig=M)},v=()=>{Ze.errors=[]},_=async M=>{var X;const L=(X=M.clipboardData)==null?void 0:X.items;if(!L)return!1;const V=[];for(let T=0;T<L.length;T++){const A=L[T];if(A.kind==="file"){const D=A.getAsFile();if(D){let Q=D;if(D.type.startsWith("image/")&&D.name==="image.png"){const W=D.type.split("/")[1],H=`image-${r5()}.${W}`;Q=new File([D],H,{type:D.type})}V.push(Q)}}}if(V.length>0){const T=f(V);return T&&Ze.autoUploadOnPaste&&await $(),T}return!1},k=M=>M.type.startsWith("image/")?"image":M.type==="application/pdf"?"file-text":M.type.includes("word")||M.type.includes("doc")?"file-type":"file",w=M=>M.startsWith("image/"),$=async()=>{if(Ze.files.length===0)return!0;const M=ae.state.handle,L="https://console.easyaichat.app";try{Ze.uploading=!0;const V=Ze.files.map(async(A,D)=>{Ze.files[D].uploading=!0;const Q=new FormData;Q.append("file",A.file),Q.append("handle",M);try{const W=await fetch(L+"/api/chat/upload",{method:"POST",body:Q});if(!W.ok)throw new Error(`Lỗi ${W.status}: ${W.statusText}`);const H=await W.json();return Ze.files[D].uploading=!1,H.file}catch(W){return console.log("Update file error: ",W),Ze.files[D].uploading=!1,null}}),X=await Promise.all(V),T=X.filter(A=>A!==null);return Ze.files.forEach(A=>{A.previewUrl&&URL.revokeObjectURL(A.previewUrl)}),Ze.processedFiles=[...Ze.processedFiles,...T],Ze.files=[],T.length===X.length}catch(V){return console.error("Lỗi khi upload files:",V),!1}finally{setTimeout(()=>{Ze.uploading=!1},500)}};return{files:e,processedFiles:i,acceptTypes:t,allowedExtensions:d,maxFileSize:n,maxFiles:s,maxFilesAllowed:wg,uploading:r,errors:o,totalSize:a,fileCount:c,displayFiles:u,validateFiles:f,removeFile:h,clearFiles:g,updateConfig:p,clearErrors:v,handlePaste:_,uploadFilesToServer:$,getFileIconName:k,isImageFile:w,formatFileSize:xg,setupPasteListener:()=>{window.addEventListener("paste",_)},cleanupPasteListener:()=>{window.removeEventListener("paste",_)},setAutoUploadOnPaste:M=>{Ze.autoUploadOnPaste=M}}}const a5=["title"],l5={class:"flex-shrink-0 flex items-center justify-center w-11 h-11 bg-white rounded-lg mr-1.5"},c5={key:0,xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",viewBox:"0 0 32 32"},u5=[ma('<defs><linearGradient id="vscodeIconsFileTypeExcel0" x1="4.494" x2="13.832" y1="-2092.086" y2="-2075.914" gradientTransform="translate(0 2100)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#18884f"></stop><stop offset=".5" stop-color="#117e43"></stop><stop offset="1" stop-color="#0b6631"></stop></linearGradient></defs><path fill="#185c37" d="M19.581 15.35L8.512 13.4v14.409A1.19 1.19 0 0 0 9.705 29h19.1A1.19 1.19 0 0 0 30 27.809V22.5Z"></path><path fill="#21a366" d="M19.581 3H9.705a1.19 1.19 0 0 0-1.193 1.191V9.5L19.581 16l5.861 1.95L30 16V9.5Z"></path><path fill="#107c41" d="M8.512 9.5h11.069V16H8.512Z"></path><path d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2" opacity="0.1"></path><path d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191" opacity="0.2"></path><path d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191" opacity="0.2"></path><path d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191" opacity="0.2"></path><path fill="url(#vscodeIconsFileTypeExcel0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.19 1.19 0 0 1 2 21.959V10.041A1.19 1.19 0 0 1 3.194 8.85"></path><path fill="#fff" d="m5.7 19.873l2.511-3.884l-2.3-3.862h1.847L9.013 14.6c.116.234.2.408.238.524h.017q.123-.281.26-.546l1.342-2.447h1.7l-2.359 3.84l2.419 3.905h-1.809l-1.45-2.711A2.4 2.4 0 0 1 9.2 16.8h-.024a1.7 1.7 0 0 1-.168.351l-1.493 2.722Z"></path><path fill="#33c481" d="M28.806 3h-9.225v6.5H30V4.191A1.19 1.19 0 0 0 28.806 3"></path><path fill="#107c41" d="M19.581 16H30v6.5H19.581Z"></path>',12)],d5={class:"flex-1 min-w-0"},f5={class:"text-xs font-medium text-gray-900 truncate block"},h5={class:"flex items-center text-xs text-gray-500 font-medium"},p5=l("span",{class:"mx-1"},"•",-1),m5={class:"uppercase"},kg={__name:"CardFileDocs",props:{file:{type:Object,default:()=>{}}},setup(e){const t=e,{formatFileSize:n}=ml();function s(i){return i.split(".").pop().toLowerCase()}const r=ee(()=>{switch(s(t.file.filename)){case"xlsx":return{icon:null,color:""};case"pdf":return{icon:Zs,color:"text-red-600"};case"csv":return{icon:b2,color:"text-green-600"};case"docx":return{icon:_2,color:"text-blue-600"};case"txt":return{icon:Zs,color:"text-gray-600"};case"md":return{icon:h2,color:"text-purple-600"};default:return{icon:Zs,color:"text-gray-600"}}}),o=async()=>{if(t.file.url)try{const i=await fetch(t.file.url);if(!i.ok)throw new Error("Failed to fetch file");const a=await i.blob(),c=window.URL.createObjectURL(a),u=document.createElement("a");u.href=c,u.download=t.file.filename||"download",document.body.appendChild(u),u.click(),document.body.removeChild(u),window.URL.revokeObjectURL(c)}catch(i){console.error("Download failed:",i)}};return(i,a)=>(m(),x("div",{title:e.file.name,class:"flex items-center h-full p-1.5 bg-white group"},[l("div",l5,[r.value.icon?(m(),oe(Nt(r.value.icon),{key:1,size:"32",class:te(r.value.color)},null,8,["class"])):(m(),x("svg",c5,u5))]),l("div",d5,[l("p",f5,j(e.file.filename),1),l("div",h5,[l("span",null,j(y(n)(e.file.size)),1),p5,l("span",m5,j(s(e.file.filename)),1)])]),e.file.url?(m(),x("button",{key:0,onClick:o,class:"flex-shrink-0 p-1.5 hover:bg-gray-100 rounded-lg transition-colors",title:"Tải xuống"},[G(y(Qm),{size:"16",class:"text-gray-600"})])):q("",!0)],8,a5))}},g5={class:"space-y-1"},v5=["src"],y5={__name:"CardVideo",props:{message:{type:Object,required:!0}},emits:["open-gallery"],setup(e,{emit:t}){const s=vn(e.message.content),r=Array.isArray(s)?s:[s],o=R([]),i=a=>a?a.includes("#")?a:`${a}#t=0.5`:"";return Qe(()=>{o.value.forEach(a=>{a&&a.load()})}),(a,c)=>(m(),x("div",g5,[(m(!0),x(be,null,Ie(y(r),(u,d)=>(m(),x("div",{class:"relative",key:d},[l("video",{ref_for:!0,ref:f=>o.value[d]=f,controls:"",playsinline:"",preload:"metadata",class:"w-full h-auto transition-all rounded"},[l("source",{src:i(u.url),type:"video/mp4"},null,8,v5),Be(" Your browser does not support the video tag. ")],512)]))),128))]))}},b5={class:"space-y-2"},_5={controls:""},x5=["src"],w5=["src"],k5={__name:"CardAudio",props:{message:{type:Object}},setup(e){const n=e.message.content;return(s,r)=>(m(),x("div",b5,[(m(!0),x(be,null,Ie(y(n),o=>(m(),x("div",{key:o.file_id},[l("audio",_5,[l("source",{src:o.url,type:"audio/ogg"},null,8,x5),l("source",{src:o.url,type:"audio/mpeg"},null,8,w5),Be(" Your browser does not support the audio tag. ")])]))),128))]))}},S5=["src","alt","onClick"],$5={__name:"CardImages",props:{message:{type:Object,required:!0},isUser:{type:Boolean,default:!1}},emits:["open-gallery"],setup(e,{emit:t}){const n=e,s=t,r=vn(n.message.content),o=Array.isArray(r)?r:[r];return(i,a)=>y(o).length>0?(m(),x("div",{key:0,class:te(["grid gap-px rounded overflow-hidden",{"ml-auto":e.isUser&&y(o).length===1,"grid-cols-1 w-[90%] sm:w-[70%]":y(o).length===1,"grid-cols-2":y(o).length===2,"grid-cols-3":y(o).length>=3}])},[(m(!0),x(be,null,Ie(y(o),(c,u)=>(m(),x("div",{key:u,class:te(["lg:hover:opacity-80 overflow-hidden cursor-zoom-in border border-gray-100",y(o).length>1?"aspect-[1/1]":""])},[l("img",{src:c.url,alt:c.url,onClick:d=>s("open-gallery",c.file_id),class:te(["w-full h-full",y(o).length===1?"object-contain":"object-cover"])},null,10,S5)],2))),128))],2)):q("",!0)}},C5={key:4,class:"text-xs text-gray-500 absolute right-1 -bottom-1 translate-y-full message-user-status"},T5={key:0},E5={key:1},A5={__name:"CardAttachment",props:{message:{type:Object},files:{type:Array,default:()=>[]},isUser:Boolean,newMessageStatus:{type:String},isLatestUserMessage:{type:Boolean,default:!1}},setup(e){const t=e;let n=null;const s=o=>{const i=t.files.findIndex(a=>a.file_id===o);i!==-1&&(n=hw(t.files,i,()=>{n=null}))},r=o=>o.sender_type==="user";return Lt(()=>{n&&(n.remove(),n=null)}),(o,i)=>(m(),x("div",{class:te(["relative",["max-w-[88%] space-y-4",r(e.message)&&"ml-auto is-user"]])},[e.message.content_type==="image"||e.message.content_type==="gif"?(m(),oe($5,{key:0,message:e.message,isUser:r(e.message),onOpenGallery:s},null,8,["message","isUser"])):q("",!0),e.message.content_type==="video"?(m(),oe(y5,{key:1,message:e.message,onOpenGallery:s},null,8,["message"])):q("",!0),e.message.content_type==="audio"?(m(),oe(k5,{key:2,message:e.message},null,8,["message"])):q("",!0),e.message.content_type==="file"?(m(),x("div",{key:3,class:te(r(e.message)&&"flex flex-col items-end w-full space-y-2")},[(m(!0),x(be,null,Ie(e.message.content,(a,c)=>(m(),oe(kg,{class:"relative border border-gray-200 overflow-hidden rounded-xl w-[240px] sm:w-[268px] h-[60px]",key:c,file:a},null,8,["file"]))),128))],2)):q("",!0),e.isUser&&e.isLatestUserMessage&&e.newMessageStatus!=="unread"?(m(),x("div",C5,[e.newMessageStatus==="sent"?(m(),x("span",T5,"Đã gửi")):e.newMessageStatus==="received"?(m(),x("span",E5,"Đã nhận")):q("",!0)])):q("",!0)],2))}},I5=["href"],P5={class:"flex-1 flex flex-col min-w-0"},M5={key:0,class:"font-semibold text-primary text-[15px] leading-[150%] mb-1.5 pl-1"},O5={key:1,class:"flex items-start gap-1.5 text-gray-700"},R5={class:"text-sm line-clamp-3"},L5={key:2,class:"flex items-center gap-1.5 text-gray-900 mt-1"},D5={class:"text-sm truncate"},j5={class:"size-6 flex items-center duration-300 group-hover:translate-x-1 bg-gray-50 justify-center group-hover:bg-primary group-hover:text-white ml-auto flex-shrink-0 rounded-full"},N5={__name:"CardStore",props:{store:{type:Object,required:!0}},setup(e){const t=e,n=ee(()=>t.store.google_maps_url?t.store.google_maps_url:t.store.address?`https://www.google.com/maps/search/${encodeURIComponent(t.store.address)}`:"#");function s(r){return!r||r.length===0?"":r.join(" - ")}return(r,o)=>(m(),x("a",{target:"_blank",href:n.value,rel:"noopener noreferrer",class:"flex items-center p-3 hover:bg-white duration-200 group cursor-pointer"},[l("div",P5,[e.store.title?(m(),x("h3",M5,j(e.store.title),1)):q("",!0),e.store.address?(m(),x("div",O5,[G(y(I2),{size:16,class:"flex-shrink-0 mt-1"}),l("span",R5,j(e.store.address),1)])):q("",!0),e.store.phone_numbers&&e.store.phone_numbers.length>0?(m(),x("div",L5,[G(y(ll),{size:16,class:"flex-shrink-0"}),l("span",D5,j(s(e.store.phone_numbers)),1)])):q("",!0)]),l("div",j5,[G(y(Ir),{size:"16"})])],8,I5))}},F5={class:"relative w-[calc(100%-20px)]"},z5={class:"relative pl-[40px]"},q5={class:"absolute bottom-0 left-0"},B5=["src","alt"],U5={class:"border rounded-xl divide-y overflow-hidden"},V5={__name:"ListStores",props:{stores:{type:Array,required:!0,default:()=>[]},logo:{type:String,default:""},botName:{type:String,default:""}},setup(e){const{handle:t}=At(B);return(n,s)=>(m(),x("div",F5,[l("div",z5,[l("div",q5,[l("span",{class:te(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(t)===y(Sn)?"rounded":"rounded-full"])},[l("img",{src:e.logo,alt:e.botName,class:"object-cover w-full h-full"},null,8,B5)],2)]),l("div",U5,[(m(!0),x(be,null,Ie(e.stores,(r,o)=>(m(),oe(N5,{key:o,store:r},null,8,["store"]))),128))])])]))}};function ed(e,t){const n=typeof e=="string"&&!t?`${e}Context`:t,s=Symbol(n);return[r=>{const o=Qr(s,r);if(o||o===null)return o;throw new Error(`Injection \`${s.toString()}\` not found. Component must be used within ${Array.isArray(e)?`one of the following components: ${e.join(", ")}`:`\`${e}\``}`)},r=>(qc(s,r),r)]}function Sg(e,t,n){const s=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),s.dispatchEvent(r)}function H5(e){return Hd()?(y0(e),!0):!1}function W5(e){let t=!1,n;const s=g0(!0);return(...r)=>(t||(n=s.run(()=>e(...r)),t=!0),n)}function td(e){return typeof e=="function"?e():y(e)}const Ei=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const G5=e=>typeof e<"u",K5=Object.prototype.toString,Q5=e=>K5.call(e)==="[object Object]",J5=()=>{};function gl(e){var t;const n=td(e);return(t=n==null?void 0:n.$el)!=null?t:n}const $g=Ei?window:void 0;function X5(...e){let t,n,s,r;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,s,r]=e,t=$g):[t,n,s,r]=e,!t)return J5;Array.isArray(n)||(n=[n]),Array.isArray(s)||(s=[s]);const o=[],i=()=>{o.forEach(d=>d()),o.length=0},a=(d,f,h,g)=>(d.addEventListener(f,h,g),()=>d.removeEventListener(f,h,g)),c=Pe(()=>[gl(t),td(r)],([d,f])=>{if(i(),!d)return;const h=Q5(f)?{...f}:f;o.push(...n.flatMap(g=>s.map(p=>a(d,g,p,h))))},{immediate:!0,flush:"post"}),u=()=>{c(),i()};return H5(u),u}function Z5(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Y5(...e){let t,n,s={};e.length===3?(t=e[0],n=e[1],s=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],s=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:r=$g,eventName:o="keydown",passive:i=!1,dedupe:a=!1}=s,c=Z5(t);return X5(r,o,u=>{u.repeat&&td(a)||c(u)&&n(u)},i)}function e3(){const e=R(!1),t=Zn();return t&&Qe(()=>{e.value=!0},t),e}function t3(e){return JSON.parse(JSON.stringify(e))}function n3(e,t,n,s={}){var r,o,i;const{clone:a=!1,passive:c=!1,eventName:u,deep:d=!1,defaultValue:f,shouldEmit:h}=s,g=Zn(),p=n||(g==null?void 0:g.emit)||((r=g==null?void 0:g.$emit)==null?void 0:r.bind(g))||((i=(o=g==null?void 0:g.proxy)==null?void 0:o.$emit)==null?void 0:i.bind(g==null?void 0:g.proxy));let v=u;v=v||`update:${t.toString()}`;const _=$=>a?typeof a=="function"?a($):t3($):$,k=()=>G5(e[t])?_(e[t]):f,w=$=>{h?h($)&&p(v,$):p(v,$)};if(c){const $=k(),E=R($);let P=!1;return Pe(()=>e[t],I=>{P||(P=!0,E.value=_(I),kt(()=>P=!1))}),Pe(E,I=>{!P&&(I!==e[t]||d)&&w(I)},{deep:d}),E}else return ee({get(){return k()},set($){w($)}})}function nd(e){return e?e.flatMap(t=>t.type===be?nd(t.children):[t]):[]}const[s3]=ed("ConfigProvider");function vl(e){const t=Zn(),n=t==null?void 0:t.type.emits,s={};return n!=null&&n.length||console.warn(`No emitted event found. Please check component: ${t==null?void 0:t.type.__name}`),n==null||n.forEach(r=>{s[qi(An(r))]=(...o)=>e(r,...o)}),s}function r3(e){const t=Zn(),n=Object.keys((t==null?void 0:t.type.props)??{}).reduce((r,o)=>{const i=(t==null?void 0:t.type.props[o]).default;return i!==void 0&&(r[o]=i),r},{}),s=G0(e);return ee(()=>{const r={},o=(t==null?void 0:t.vnode.props)??{};return Object.keys(o).forEach(i=>{r[An(i)]=o[i]}),Object.keys({...n,...r}).reduce((i,a)=>(s.value[a]!==void 0&&(i[a]=s.value[a]),i),{})})}function o3(e,t){const n=r3(e),s=t?vl(t):{};return ee(()=>({...n.value,...s}))}function Ys(){const e=Zn(),t=R(),n=ee(()=>{var i,a;return["#text","#comment"].includes((i=t.value)==null?void 0:i.$el.nodeName)?(a=t.value)==null?void 0:a.$el.nextElementSibling:gl(t)}),s=Object.assign({},e.exposed),r={};for(const i in e.props)Object.defineProperty(r,i,{enumerable:!0,configurable:!0,get:()=>e.props[i]});if(Object.keys(s).length>0)for(const i in s)Object.defineProperty(r,i,{enumerable:!0,configurable:!0,get:()=>s[i]});Object.defineProperty(r,"$el",{enumerable:!0,configurable:!0,get:()=>e.vnode.el}),e.exposed=r;function o(i){t.value=i,!(i instanceof Element||!i)&&(Object.defineProperty(r,"$el",{enumerable:!0,configurable:!0,get:()=>i.$el}),e.exposed=r)}return{forwardRef:o,currentRef:t,currentElement:n}}var i3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ho=new WeakMap,yl=new WeakMap,bl={},sd=0,Cg=function(e){return e&&(e.host||Cg(e.parentNode))},a3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Cg(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},l3=function(e,t,n,s){var r=a3(t,Array.isArray(e)?e:[e]);bl[n]||(bl[n]=new WeakMap);var o=bl[n],i=[],a=new Set,c=new Set(r),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};r.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))d(h);else try{var g=h.getAttribute(s),p=g!==null&&g!=="false",v=(ho.get(h)||0)+1,_=(o.get(h)||0)+1;ho.set(h,v),o.set(h,_),i.push(h),v===1&&p&&yl.set(h,!0),_===1&&h.setAttribute(n,"true"),p||h.setAttribute(s,"true")}catch(k){console.error("aria-hidden: cannot operate on ",h,k)}})};return d(t),a.clear(),sd++,function(){i.forEach(function(f){var h=ho.get(f)-1,g=o.get(f)-1;ho.set(f,h),o.set(f,g),h||(yl.has(f)||f.removeAttribute(s),yl.delete(f)),g||f.removeAttribute(n)}),sd--,sd||(ho=new WeakMap,ho=new WeakMap,yl=new WeakMap,bl={})}},c3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=i3(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live]"))),l3(s,r,n,"aria-hidden")):function(){return null}};function u3(e){let t;Pe(()=>gl(e),n=>{n?t=c3(n):t&&t()}),Lt(()=>{t&&t()})}let d3=0;function Tg(e,t="radix"){const{useId:n}=s3({useId:void 0});return n&&typeof n=="function"?`${t}-${n()}`:`${t}-${++d3}`}function f3(e,t){const n=R(e);function s(r){return t[n.value][r]??n.value}return{state:n,dispatch:r=>{n.value=s(r)}}}const h3=Zt({name:"PrimitiveSlot",inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{var s,r;if(!n.default)return null;const o=nd(n.default()),i=o.findIndex(d=>d.type!==Pn);if(i===-1)return o;const a=o[i];(s=a.props)==null||delete s.ref;const c=a.props?xn(t,a.props):t;t.class&&(r=a.props)!=null&&r.class&&delete a.props.class;const u=cs(a,c);for(const d in c)d.startsWith("on")&&(u.props||(u.props={}),u.props[d]=c[d]);return o.length===1?u:(o[i]=u,o)}}}),_l=Zt({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(e,{attrs:t,slots:n}){const s=e.asChild?"template":e.as;return typeof s=="string"&&["area","img","input"].includes(s)?()=>fr(s,t):s!=="template"?()=>fr(e.as,t,{default:n.default}):()=>fr(h3,t,{default:n.default})}});function p3(e,t){const n=R({}),s=R("none"),r=e.value?"mounted":"unmounted",{state:o,dispatch:i}=f3(r,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),a=h=>{var g;if(Ei){const p=new CustomEvent(h,{bubbles:!1,cancelable:!1});(g=t.value)==null||g.dispatchEvent(p)}};Pe(e,async(h,g)=>{var p;const v=g!==h;if(await kt(),v){const _=s.value,k=xl(t.value);h?(i("MOUNT"),a("enter"),k==="none"&&a("after-enter")):k==="none"||((p=n.value)==null?void 0:p.display)==="none"?(i("UNMOUNT"),a("leave"),a("after-leave")):g&&_!==k?(i("ANIMATION_OUT"),a("leave")):(i("UNMOUNT"),a("after-leave"))}},{immediate:!0});const c=h=>{const g=xl(t.value),p=g.includes(h.animationName),v=o.value==="mounted"?"enter":"leave";h.target===t.value&&p&&(a(`after-${v}`),i("ANIMATION_END")),h.target===t.value&&g==="none"&&i("ANIMATION_END")},u=h=>{h.target===t.value&&(s.value=xl(t.value))},d=Pe(t,(h,g)=>{h?(n.value=getComputedStyle(h),h.addEventListener("animationstart",u),h.addEventListener("animationcancel",c),h.addEventListener("animationend",c)):(i("ANIMATION_END"),g==null||g.removeEventListener("animationstart",u),g==null||g.removeEventListener("animationcancel",c),g==null||g.removeEventListener("animationend",c))},{immediate:!0}),f=Pe(o,()=>{const h=xl(t.value);s.value=o.value==="mounted"?h:"none"});return Lt(()=>{d(),f()}),{isPresent:ee(()=>["mounted","unmountSuspended"].includes(o.value))}}function xl(e){return e&&getComputedStyle(e).animationName||"none"}const m3=Zt({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(e,{slots:t,expose:n}){var s;const{present:r,forceMount:o}=At(e),i=R(),{isPresent:a}=p3(r,i);n({present:a});let c=t.default({present:a});c=nd(c||[]);const u=Zn();if(c&&(c==null?void 0:c.length)>1){const d=(s=u==null?void 0:u.parent)!=null&&s.type.name?`<${u.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${d}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(f=>` - ${f}`).join(`
`)].join(`
`))}return()=>o.value||r.value||a.value?fr(t.default({present:a})[0],{ref:d=>{const f=gl(d);return typeof(f==null?void 0:f.hasAttribute)>"u"||(f!=null&&f.hasAttribute("data-radix-popper-content-wrapper")?i.value=f.firstElementChild:i.value=f),f}}):null}}),[po,g3]=ed("DialogRoot"),v3=Zt({__name:"DialogRoot",props:{open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:!1},modal:{type:Boolean,default:!0}},emits:["update:open"],setup(e,{emit:t}){const n=e,s=n3(n,"open",t,{defaultValue:n.defaultOpen,passive:n.open===void 0}),r=R(),o=R(),{modal:i}=At(n);return g3({open:s,modal:i,openModal:()=>{s.value=!0},onOpenChange:a=>{s.value=a},onOpenToggle:()=>{s.value=!s.value},contentId:"",titleId:"",descriptionId:"",triggerElement:r,contentElement:o}),(a,c)=>It(a.$slots,"default",{open:y(s)})}}),y3=Zt({__name:"Teleport",props:{to:{default:"body"},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(e){const t=e3();return(n,s)=>y(t)||n.forceMount?(m(),oe(Kc,{key:0,to:n.to,disabled:n.disabled},[It(n.$slots,"default")],8,["to","disabled"])):q("",!0)}}),er=Zt({__name:"DialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(e){const t=e;return(n,s)=>(m(),oe(y(y3),Ui(pa(t)),{default:Se(()=>[It(n.$slots,"default")]),_:3},16))}}),b3="dismissableLayer.pointerDownOutside",_3="dismissableLayer.focusOutside";function Eg(e,t){const n=t.closest("[data-dismissable-layer]"),s=e.dataset.dismissableLayer===""?e:e.querySelector("[data-dismissable-layer]"),r=Array.from(e.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(n&&s===n||r.indexOf(s)<r.indexOf(n))}function x3(e,t){var n;const s=((n=t==null?void 0:t.value)==null?void 0:n.ownerDocument)??(globalThis==null?void 0:globalThis.document),r=R(!1),o=R(()=>{});return ws(i=>{if(!Ei)return;const a=async u=>{const d=u.target;if(t!=null&&t.value){if(Eg(t.value,d)){r.value=!1;return}if(u.target&&!r.value){let f=function(){Sg(b3,e,h)};const h={originalEvent:u};u.pointerType==="touch"?(s.removeEventListener("click",o.value),o.value=f,s.addEventListener("click",o.value,{once:!0})):f()}else s.removeEventListener("click",o.value);r.value=!1}},c=window.setTimeout(()=>{s.addEventListener("pointerdown",a)},0);i(()=>{window.clearTimeout(c),s.removeEventListener("pointerdown",a),s.removeEventListener("click",o.value)})}),{onPointerDownCapture:()=>r.value=!0}}function w3(e,t){var n;const s=((n=t==null?void 0:t.value)==null?void 0:n.ownerDocument)??(globalThis==null?void 0:globalThis.document),r=R(!1);return ws(o=>{if(!Ei)return;const i=async a=>{t!=null&&t.value&&(await kt(),!(!t.value||Eg(t.value,a.target))&&a.target&&!r.value&&Sg(_3,e,{originalEvent:a}))};s.addEventListener("focusin",i),o(()=>s.removeEventListener("focusin",i))}),{onFocusCapture:()=>r.value=!0,onBlurCapture:()=>r.value=!1}}const As=dt({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),k3=Zt({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(e,{emit:t}){const n=e,s=t,{forwardRef:r,currentElement:o}=Ys(),i=ee(()=>{var p;return((p=o.value)==null?void 0:p.ownerDocument)??globalThis.document}),a=ee(()=>As.layersRoot),c=ee(()=>o.value?Array.from(a.value).indexOf(o.value):-1),u=ee(()=>As.layersWithOutsidePointerEventsDisabled.size>0),d=ee(()=>{const p=Array.from(a.value),[v]=[...As.layersWithOutsidePointerEventsDisabled].slice(-1),_=p.indexOf(v);return c.value>=_}),f=x3(async p=>{const v=[...As.branches].some(_=>_.contains(p.target));!d.value||v||(s("pointerDownOutside",p),s("interactOutside",p),await kt(),p.defaultPrevented||s("dismiss"))},o),h=w3(p=>{[...As.branches].some(v=>v.contains(p.target))||(s("focusOutside",p),s("interactOutside",p),p.defaultPrevented||s("dismiss"))},o);Y5("Escape",p=>{c.value===a.value.size-1&&(s("escapeKeyDown",p),p.defaultPrevented||s("dismiss"))});let g;return ws(p=>{o.value&&(n.disableOutsidePointerEvents&&(As.layersWithOutsidePointerEventsDisabled.size===0&&(g=i.value.body.style.pointerEvents,i.value.body.style.pointerEvents="none"),As.layersWithOutsidePointerEventsDisabled.add(o.value)),a.value.add(o.value),p(()=>{n.disableOutsidePointerEvents&&As.layersWithOutsidePointerEventsDisabled.size===1&&(i.value.body.style.pointerEvents=g)}))}),ws(p=>{p(()=>{o.value&&(a.value.delete(o.value),As.layersWithOutsidePointerEventsDisabled.delete(o.value))})}),(p,v)=>(m(),oe(y(_l),{ref:y(r),"as-child":p.asChild,as:p.as,"data-dismissable-layer":"",style:ht({pointerEvents:u.value?d.value?"auto":"none":void 0}),onFocusCapture:y(h).onFocusCapture,onBlurCapture:y(h).onBlurCapture,onPointerdownCapture:y(f).onPointerDownCapture},{default:Se(()=>[It(p.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),rd="focusScope.autoFocusOnMount",od="focusScope.autoFocusOnUnmount",Ag={bubbles:!1,cancelable:!0};function S3(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(tr(s,{select:t}),document.activeElement!==n)return!0}function $3(e){const t=Ig(e),n=Pg(t,e),s=Pg(t.reverse(),e);return[n,s]}function Ig(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Pg(e,t){for(const n of e)if(!C3(n,{upTo:t}))return n}function C3(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function T3(e){return e instanceof HTMLInputElement&&"select"in e}function tr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&T3(e)&&t&&e.select()}}const E3=W5(()=>R([]));function A3(){const e=E3();return{add(t){const n=e.value[0];t!==n&&(n==null||n.pause()),e.value=Mg(e.value,t),e.value.unshift(t)},remove(t){var n;e.value=Mg(e.value,t),(n=e.value[0])==null||n.resume()}}}function Mg(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function I3(e){return e.filter(t=>t.tagName!=="A")}const P3=Zt({__name:"FocusScope",props:{loop:{type:Boolean,default:!1},trapped:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["mountAutoFocus","unmountAutoFocus"],setup(e,{emit:t}){const n=e,s=t,{currentRef:r,currentElement:o}=Ys(),i=R(null),a=A3(),c=dt({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});ws(d=>{if(!Ei)return;const f=o.value;if(!n.trapped)return;function h(_){if(c.paused||!f)return;const k=_.target;f.contains(k)?i.value=k:tr(i.value,{select:!0})}function g(_){if(c.paused||!f)return;const k=_.relatedTarget;k!==null&&(f.contains(k)||tr(i.value,{select:!0}))}function p(_){f.contains(i.value)||tr(f)}document.addEventListener("focusin",h),document.addEventListener("focusout",g);const v=new MutationObserver(p);f&&v.observe(f,{childList:!0,subtree:!0}),d(()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",g),v.disconnect()})}),ws(async d=>{const f=o.value;if(await kt(),!f)return;a.add(c);const h=document.activeElement;if(!f.contains(h)){const g=new CustomEvent(rd,Ag);f.addEventListener(rd,p=>s("mountAutoFocus",p)),f.dispatchEvent(g),g.defaultPrevented||(S3(I3(Ig(f)),{select:!0}),document.activeElement===h&&tr(f))}d(()=>{f.removeEventListener(rd,v=>s("mountAutoFocus",v));const g=new CustomEvent(od,Ag),p=v=>{s("unmountAutoFocus",v)};f.addEventListener(od,p),f.dispatchEvent(g),setTimeout(()=>{g.defaultPrevented||tr(h??document.body,{select:!0}),f.removeEventListener(od,p),a.remove(c)},0)})});function u(d){if(!n.loop&&!n.trapped||c.paused)return;const f=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,h=document.activeElement;if(f&&h){const g=d.currentTarget,[p,v]=$3(g);p&&v?!d.shiftKey&&h===v?(d.preventDefault(),n.loop&&tr(p,{select:!0})):d.shiftKey&&h===p&&(d.preventDefault(),n.loop&&tr(v,{select:!0})):h===g&&d.preventDefault()}}return(d,f)=>(m(),oe(y(_l),{ref_key:"currentRef",ref:r,tabindex:"-1","as-child":d.asChild,as:d.as,onKeydown:u},{default:Se(()=>[It(d.$slots,"default")]),_:3},8,["as-child","as"]))}});function M3(e){return e?"open":"closed"}const Og=Zt({__name:"DialogContentImpl",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,s=t,r=po(),{forwardRef:o,currentElement:i}=Ys();return r.titleId||(r.titleId=Tg(void 0,"radix-vue-dialog-title")),r.descriptionId||(r.descriptionId=Tg(void 0,"radix-vue-dialog-description")),Qe(()=>{r.contentElement=i,document.activeElement!==document.body&&(r.triggerElement.value=document.activeElement)}),(a,c)=>(m(),oe(y(P3),{"as-child":"",loop:"",trapped:n.trapFocus,onMountAutoFocus:c[5]||(c[5]=u=>s("openAutoFocus",u)),onUnmountAutoFocus:c[6]||(c[6]=u=>s("closeAutoFocus",u))},{default:Se(()=>[G(y(k3),xn({id:y(r).contentId,ref:y(o),as:a.as,"as-child":a.asChild,"disable-outside-pointer-events":a.disableOutsidePointerEvents,role:"dialog","aria-describedby":y(r).descriptionId,"aria-labelledby":y(r).titleId,"data-state":y(M3)(y(r).open.value)},a.$attrs,{onDismiss:c[0]||(c[0]=u=>y(r).onOpenChange(!1)),onEscapeKeyDown:c[1]||(c[1]=u=>s("escapeKeyDown",u)),onFocusOutside:c[2]||(c[2]=u=>s("focusOutside",u)),onInteractOutside:c[3]||(c[3]=u=>s("interactOutside",u)),onPointerDownOutside:c[4]||(c[4]=u=>s("pointerDownOutside",u))}),{default:Se(()=>[It(a.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),O3=Zt({__name:"DialogContentModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,s=t,r=po(),o=vl(s),{forwardRef:i,currentElement:a}=Ys();return u3(a),(c,u)=>(m(),oe(Og,xn({...n,...y(o)},{ref:y(i),"trap-focus":y(r).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:u[0]||(u[0]=d=>{var f;d.defaultPrevented||(d.preventDefault(),(f=y(r).triggerElement.value)==null||f.focus())}),onPointerDownOutside:u[1]||(u[1]=d=>{const f=d.detail.originalEvent,h=f.button===0&&f.ctrlKey===!0;(f.button===2||h)&&d.preventDefault()}),onFocusOutside:u[2]||(u[2]=d=>{d.preventDefault()})}),{default:Se(()=>[It(c.$slots,"default")]),_:3},16,["trap-focus"]))}}),R3=Zt({__name:"DialogContentNonModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,s=vl(t);Ys();const r=po(),o=R(!1),i=R(!1);return(a,c)=>(m(),oe(Og,xn({...n,...y(s)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:c[0]||(c[0]=u=>{var d;u.defaultPrevented||(o.value||(d=y(r).triggerElement.value)==null||d.focus(),u.preventDefault()),o.value=!1,i.value=!1}),onInteractOutside:c[1]||(c[1]=u=>{var d;u.defaultPrevented||(o.value=!0,u.detail.originalEvent.type==="pointerdown"&&(i.value=!0));const f=u.target;(d=y(r).triggerElement.value)!=null&&d.contains(f)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&i.value&&u.preventDefault()})}),{default:Se(()=>[It(a.$slots,"default")]),_:3},16))}}),L3=Zt({__name:"DialogContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,s=t,r=po(),o=vl(s),{forwardRef:i}=Ys();return(a,c)=>(m(),oe(y(m3),{present:a.forceMount||y(r).open.value},{default:Se(()=>[y(r).modal.value?(m(),oe(O3,xn({key:0,ref:y(i)},{...n,...y(o),...a.$attrs}),{default:Se(()=>[It(a.$slots,"default")]),_:3},16)):(m(),oe(R3,xn({key:1,ref:y(i)},{...n,...y(o),...a.$attrs}),{default:Se(()=>[It(a.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),wl=Zt({__name:"DialogTitle",props:{asChild:{type:Boolean},as:{default:"h2"}},setup(e){const t=e,n=po();return Ys(),(s,r)=>(m(),oe(y(_l),xn(t,{id:y(n).titleId}),{default:Se(()=>[It(s.$slots,"default")]),_:3},16,["id"]))}}),kl=Zt({__name:"DialogDescription",props:{asChild:{type:Boolean},as:{default:"p"}},setup(e){const t=e;Ys();const n=po();return(s,r)=>(m(),oe(y(_l),xn(t,{id:y(n).descriptionId}),{default:Se(()=>[It(s.$slots,"default")]),_:3},16,["id"]))}});function D3(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}D3(),function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32,.72,0,1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top],.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left],.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top],[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height, 0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left],[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height, 0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32,.72,0,1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]:after{content:"";position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]:after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]:after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]:after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]:after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@keyframes fake-animation{}@media (hover: hover) and (pointer: fine){[vaul-drawer]{-webkit-user-select:none;user-select:none}}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();const j3=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const N3=e=>typeof e<"u";function F3(e){return JSON.parse(JSON.stringify(e))}function Rg(e,t,n,s={}){var r,o,i;const{clone:a=!1,passive:c=!1,eventName:u,deep:d=!1,defaultValue:f,shouldEmit:h}=s,g=Zn(),p=n||(g==null?void 0:g.emit)||((r=g==null?void 0:g.$emit)==null?void 0:r.bind(g))||((i=(o=g==null?void 0:g.proxy)==null?void 0:o.$emit)==null?void 0:i.bind(g==null?void 0:g.proxy));let v=u;t||(t="modelValue"),v=v||`update:${t.toString()}`;const _=$=>a?typeof a=="function"?a($):F3($):$,k=()=>N3(e[t])?_(e[t]):f,w=$=>{h?h($)&&p(v,$):p(v,$)};if(c){const $=k(),E=R($);let P=!1;return Pe(()=>e[t],I=>{P||(P=!0,E.value=_(I),kt(()=>P=!1))}),Pe(E,I=>{!P&&(I!==e[t]||d)&&w(I)},{deep:d}),E}else return ee({get(){return k()},set($){w($)}})}const[Lg,z3]=ed("DrawerRoot"),Dg=new WeakMap;function Mt(e,t,n=!1){if(!e||!(e instanceof HTMLElement)||!t)return;const s={};Object.entries(t).forEach(([r,o])=>{if(r.startsWith("--")){e.style.setProperty(r,o);return}s[r]=e.style[r],e.style[r]=o}),!n&&Dg.set(e,s)}function Sl(e,t){if(!e||!(e instanceof HTMLElement))return;const n=Dg.get(e);n&&(t?e.style[t]=n[t]:Object.entries(n).forEach(([s,r])=>{e.style[s]=r}))}function $l(e,t){const n=window.getComputedStyle(e),s=n.transform||n.webkitTransform||n.mozTransform;let r=s.match(/^matrix3d\((.+)\)$/);return r?Number.parseFloat(r[1].split(", ")[Ut(t)?13:12]):(r=s.match(/^matrix\((.+)\)$/),r?Number.parseFloat(r[1].split(", ")[Ut(t)?5:4]):null)}function q3(e){return 8*(Math.log(e+1)-2)}function Ut(e){switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}}const wt={DURATION:.5,EASE:[.32,.72,0,1]},jg=.4;function B3({activeSnapPoint:e,snapPoints:t,drawerRef:n,overlayRef:s,fadeFromIndex:r,onSnapPointChange:o,direction:i}){const a=R(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);function c(){a.value={innerWidth:window.innerWidth,innerHeight:window.innerHeight}}Qe(()=>{typeof window<"u"&&window.addEventListener("resize",c)}),Jn(()=>{typeof window<"u"&&window.removeEventListener("resize",c)});const u=ee(()=>(t.value&&e.value===t.value[t.value.length-1])??null),d=ee(()=>t.value&&t.value.length>0&&((r==null?void 0:r.value)||(r==null?void 0:r.value)===0)&&!Number.isNaN(r==null?void 0:r.value)&&t.value[(r==null?void 0:r.value)??-1]===e.value||!t.value),f=ee(()=>{var w;return((w=t.value)==null?void 0:w.findIndex($=>$===e.value))??null}),h=ee(()=>{var w;return((w=t.value)==null?void 0:w.map($=>{const E=typeof $=="string";let P=0;if(E&&(P=Number.parseInt($,10)),Ut(i.value)){const M=E?P:a.value?$*a.value.innerHeight:0;return a.value?i.value==="bottom"?a.value.innerHeight-M:-a.value.innerHeight+M:M}const I=E?P:a.value?$*a.value.innerWidth:0;return a.value?i.value==="right"?a.value.innerWidth-I:-a.value.innerWidth+I:I}))??[]}),g=ee(()=>{var w;return f.value!==null?(w=h.value)==null?void 0:w[f.value]:null}),p=w=>{var $,E,P,I;const M=(($=h.value)==null?void 0:$.findIndex(L=>L===w))??null;kt(()=>{var L;o(M,h.value),Mt((L=n.value)==null?void 0:L.$el,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Ut(i.value)?`translate3d(0, ${w}px, 0)`:`translate3d(${w}px, 0, 0)`})}),h.value&&M!==h.value.length-1&&M!==(r==null?void 0:r.value)?Mt((E=s.value)==null?void 0:E.$el,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"0"}):Mt((P=s.value)==null?void 0:P.$el,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),e.value=M!==null?((I=t.value)==null?void 0:I[M])??null:null};Pe([e,h,t],()=>{var w;if(e.value){const $=((w=t.value)==null?void 0:w.findIndex(E=>E===e.value))??-1;h.value&&$!==-1&&typeof h.value[$]=="number"&&p(h.value[$])}},{immediate:!0});function v({draggedDistance:w,closeDrawer:$,velocity:E,dismissible:P}){var I,M,L;if(r.value===void 0)return;const V=i.value==="bottom"||i.value==="right"?(g.value??0)-w:(g.value??0)+w,X=f.value===r.value-1,T=f.value===0,A=w>0;if(X&&Mt((I=s.value)==null?void 0:I.$el,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),E>2&&!A){P?$():p(h.value[0]);return}if(E>2&&A&&h&&t.value){p(h.value[t.value.length-1]);return}const D=(M=h.value)==null?void 0:M.reduce((W,H)=>typeof W!="number"||typeof H!="number"?W:Math.abs(H-V)<Math.abs(W-V)?H:W),Q=Ut(i.value)?window.innerHeight:window.innerWidth;if(E>jg&&Math.abs(w)<Q*.4){const W=A?1:-1;if(W>0&&u){p(h.value[(((L=t.value)==null?void 0:L.length)??0)-1]);return}if(T&&W<0&&P&&$(),f.value===null)return;p(h.value[f.value+W]);return}p(D)}function _({draggedDistance:w}){var $;if(g.value===null)return;const E=i.value==="bottom"||i.value==="right"?g.value-w:g.value+w;(i.value==="bottom"||i.value==="right")&&E<h.value[h.value.length-1]||(i.value==="top"||i.value==="left")&&E>h.value[h.value.length-1]||Mt(($=n.value)==null?void 0:$.$el,{transform:Ut(i.value)?`translate3d(0, ${E}px, 0)`:`translate3d(${E}px, 0, 0)`})}function k(w,$){if(!t.value||typeof f.value!="number"||!h.value||r.value===void 0)return null;const E=f.value===r.value-1;if(f.value>=r.value&&$)return 0;if(E&&!$)return 1;if(!d.value&&!E)return null;const P=E?f.value+1:f.value-1,I=E?h.value[P]-h.value[P-1]:h.value[P+1]-h.value[P],M=w/Math.abs(I);return E?1-M:M}return{isLastSnapPoint:u,shouldFade:d,getPercentageDragged:k,activeSnapPointIndex:f,onRelease:v,onDrag:_,snapPointsOffset:h}}let Ai=null;function U3(e){const{isOpen:t,modal:n,nested:s,hasBeenOpened:r}=e,o=R(typeof window<"u"?window.location.href:""),i=R(0);function a(){if(Ai===null&&t.value){Ai={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height};const{scrollX:u,innerHeight:d}=window;document.body.style.position="fixed",document.body.style.top=`-${i.value}px`,document.body.style.left=`-${u}px`,document.body.style.right="0px",document.body.style.height="auto",setTimeout(()=>{requestAnimationFrame(()=>{const f=d-window.innerHeight;f&&i.value>=d&&(document.body.style.top=`-${i.value+f}px`)})},300)}}function c(){if(Ai!==null){const u=-Number.parseInt(document.body.style.top,10),d=-Number.parseInt(document.body.style.left,10);Object.assign(document.body.style,Ai),requestAnimationFrame(()=>{if(o.value!==window.location.href){o.value=window.location.href;return}window.scrollTo(d,u)}),Ai=null}}return Qe(()=>{function u(){i.value=window.scrollY}u(),window.addEventListener("scroll",u),Lt(()=>{window.removeEventListener("scroll",u)})}),Pe([t,r,o],()=>{s.value||!r.value||(t.value?(!window.matchMedia("(display-mode: standalone)").matches&&a(),n.value||setTimeout(()=>{c()},500)):c())}),{restorePositionSetting:c}}const V3=.25,H3=100,Ng=8,Mr=16,W3=26,Fg="vaul-dragging";function G3(e,t){return e&&e.value?e:t}function K3(e){const{emitDrag:t,emitRelease:n,emitClose:s,emitOpenChange:r,open:o,dismissible:i,nested:a,modal:c,shouldScaleBackground:u,scrollLockTimeout:d,closeThreshold:f,activeSnapPoint:h,fadeFromIndex:g,direction:p}=e,v=R(o.value??!1),_=R(!1),k=R(!1),w=R(!1),$=R(!1),E=R(null),P=R(null),I=R(null),M=R(null),L=R(null),V=R(!0),X=R(null),T=R(0),A=R(!1);R(0);const D=R(null);R(0);const Q=ee(()=>{var O;return((O=D.value)==null?void 0:O.$el.getBoundingClientRect().height)||0}),W=G3(e.snapPoints,R(void 0)),{activeSnapPointIndex:H,onRelease:K,snapPointsOffset:F,onDrag:ne,shouldFade:fe,getPercentageDragged:_e}=B3({snapPoints:W,activeSnapPoint:h,drawerRef:D,fadeFromIndex:g,overlayRef:E,onSnapPointChange:we,direction:p});function we(O,U){W.value&&O===U.length-1&&(P.value=new Date)}const{restorePositionSetting:je}=U3({isOpen:v,modal:c,nested:a,hasBeenOpened:_});function re(){return(window.innerWidth-W3)/window.innerWidth}function pe(O,U){var ie;if(!O)return!1;let me=O;const ue=(ie=window.getSelection())==null?void 0:ie.toString(),ge=D.value?$l(D.value.$el,p.value):null,he=new Date;if(me.hasAttribute("data-vaul-no-drag")||me.closest("[data-vaul-no-drag]"))return!1;if(p.value==="right"||p.value==="left")return!0;if(P.value&&he.getTime()-P.value.getTime()<500)return!1;if(ge!==null&&(p.value==="bottom"?ge>0:ge<0))return!0;if(ue&&ue.length>0)return!1;if(L.value&&he.getTime()-L.value.getTime()<d.value&&ge===0||U)return L.value=he,!1;for(;me;){if(me.scrollHeight>me.clientHeight){if(me.scrollTop!==0)return L.value=new Date,!1;if(me.getAttribute("role")==="dialog")return!0}me=me.parentNode}return!0}function de(O){!i.value&&!W.value||D.value&&!D.value.$el.contains(O.target)||(w.value=!0,I.value=new Date,O.target.setPointerCapture(O.pointerId),T.value=Ut(p.value)?O.clientY:O.clientX)}function Ce(O){var U,ie,me,ue,ge,he;if(D.value&&w.value){const Te=p.value==="bottom"||p.value==="right"?1:-1,De=(T.value-(Ut(p.value)?O.clientY:O.clientX))*Te,Le=De>0,Ae=W.value&&!i.value&&!Le;if(Ae&&H.value===0)return;const We=Math.abs(De),ot=document.querySelector("[vaul-drawer-wrapper]");let it=We/Q.value;const pt=_e(We,Le);if(pt!==null&&(it=pt),Ae&&it>=1||!V.value&&!pe(O.target,Le))return;if((U=D==null?void 0:D.value)==null||U.$el.classList.add(Fg),V.value=!0,Mt((ie=D.value)==null?void 0:ie.$el,{transition:"none"}),Mt((me=E.value)==null?void 0:me.$el,{transition:"none"}),W.value&&ne({draggedDistance:De}),Le&&!W.value){const Ot=q3(De),un=Math.min(Ot*-1,0)*Te;Mt((ue=D.value)==null?void 0:ue.$el,{transform:Ut(p.value)?`translate3d(0, ${un}px, 0)`:`translate3d(${un}px, 0, 0)`});return}const yt=1-it;if((fe.value||g.value&&H.value===g.value-1)&&(t(it),Mt((ge=E.value)==null?void 0:ge.$el,{opacity:`${yt}`,transition:"none"},!0)),ot&&E.value&&u.value){const Ot=Math.min(re()+it*(1-re()),1),un=8-it*8,zt=Math.max(0,14-it*14);Mt(ot,{borderRadius:`${un}px`,transform:Ut(p.value)?`scale(${Ot}) translate3d(0, ${zt}px, 0)`:`scale(${Ot}) translate3d(${zt}px, 0, 0)`,transition:"none"},!0)}if(!W.value){const Ot=We*Te;Mt((he=D.value)==null?void 0:he.$el,{transform:Ut(p.value)?`translate3d(0, ${Ot}px, 0)`:`translate3d(${Ot}px, 0, 0)`})}}}function Re(){var O;if(!D.value)return;const U=document.querySelector("[vaul-drawer-wrapper]"),ie=$l(D.value.$el,p.value);Mt(D.value.$el,{transform:"translate3d(0, 0, 0)",transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),Mt((O=E.value)==null?void 0:O.$el,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),u.value&&ie&&ie>0&&v.value&&Mt(U,{borderRadius:`${Ng}px`,overflow:"hidden",...Ut(p.value)?{transform:`scale(${re()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${re()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`},!0)}function Oe(){var O;D.value&&(s(),Mt(D.value.$el,{transform:Ut(p.value)?`translate3d(0, ${p.value==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${p.value==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),Mt((O=E.value)==null?void 0:O.$el,{opacity:"0",transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),He(!1),window.setTimeout(()=>{k.value=!1,v.value=!1},300),window.setTimeout(()=>{W.value&&(h.value=W.value[0])},wt.DURATION*1e3))}ws(()=>{if(!v.value&&u.value&&j3){const O=setTimeout(()=>{Sl(document.body)},200);return()=>clearTimeout(O)}}),Lt(()=>{He(!1),je()});function Me(O){if(!w.value||!D.value)return;D.value.$el.classList.remove(Fg),V.value=!1,w.value=!1,M.value=new Date;const U=$l(D.value.$el,p.value);if(!pe(O.target,!1)||!U||Number.isNaN(U)||I.value===null)return;const ie=M.value.getTime()-I.value.getTime(),me=T.value-(Ut(p.value)?O.clientY:O.clientX),ue=Math.abs(me)/ie;if(ue>.05&&($.value=!0,window.setTimeout(()=>{$.value=!1},200)),W.value){const he=p.value==="bottom"||p.value==="right"?1:-1;K({draggedDistance:me*he,closeDrawer:Oe,velocity:ue,dismissible:i.value}),n(!0);return}if(p.value==="bottom"||p.value==="right"?me>0:me<0){Re(),n(!0);return}if(ue>jg){Oe(),n(!1);return}const ge=Math.min(D.value.$el.getBoundingClientRect().height??0,window.innerHeight);if(U>=ge*f.value){Oe(),n(!1);return}n(!0),Re()}Pe(v,O=>{O&&(P.value=new Date,He(!0)),r(O)},{immediate:!0}),Pe(o,O=>{O?(v.value=O,_.value=!0):Oe()},{immediate:!0});function He(O){const U=document.querySelector("[vaul-drawer-wrapper]");!U||!u.value||(O?(Mt(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),Mt(document.body,{background:"black"},!0),Mt(U,{borderRadius:`${Ng}px`,overflow:"hidden",...Ut(p.value)?{transform:`scale(${re()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${re()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`})):(Sl(U,"overflow"),Sl(U,"transform"),Sl(U,"borderRadius"),Mt(U,{transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`})))}function N(O){var U,ie;const me=O?(window.innerWidth-Mr)/window.innerWidth:1,ue=O?-Mr:0;X.value&&window.clearTimeout(X.value),Mt((U=D.value)==null?void 0:U.$el,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:`scale(${me}) translate3d(0, ${ue}px, 0)`}),!O&&(ie=D.value)!=null&&ie.$el&&(X.value=window.setTimeout(()=>{var ge,he;const Te=$l((ge=D.value)==null?void 0:ge.$el,p.value);Mt((he=D.value)==null?void 0:he.$el,{transition:"none",transform:Ut(p.value)?`translate3d(0, ${Te}px, 0)`:`translate3d(${Te}px, 0, 0)`})},500))}function Y(O){var U;if(O<0)return;const ie=Ut(p.value)?window.innerHeight:window.innerWidth,me=(ie-Mr)/ie,ue=me+O*(1-me),ge=-Mr+O*Mr;Mt((U=D.value)==null?void 0:U.$el,{transform:Ut(p.value)?`scale(${ue}) translate3d(0, ${ge}px, 0)`:`scale(${ue}) translate3d(${ge}px, 0, 0)`,transition:"none"})}function Z(O){var U;const ie=Ut(p.value)?window.innerHeight:window.innerWidth,me=O?(ie-Mr)/ie:1,ue=O?-Mr:0;O&&Mt((U=D.value)==null?void 0:U.$el,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Ut(p.value)?`scale(${me}) translate3d(0, ${ue}px, 0)`:`scale(${me}) translate3d(${ue}px, 0, 0)`})}return{open:o,isOpen:v,modal:c,keyboardIsOpen:A,hasBeenOpened:_,isVisible:k,drawerRef:D,drawerHeightRef:Q,overlayRef:E,isDragging:w,dragStartTime:I,isAllowedToDrag:V,snapPoints:W,activeSnapPoint:h,pointerStart:T,dismissible:i,snapPointsOffset:F,direction:p,shouldFade:fe,fadeFromIndex:g,shouldScaleBackground:u,onPress:de,onDrag:Ce,onRelease:Me,closeDrawer:Oe,onNestedDrag:Y,onNestedRelease:Z,onNestedOpenChange:N,emitClose:s,emitDrag:t,emitRelease:n,emitOpenChange:r,nested:a}}const mo=Zt({__name:"DrawerRoot",props:{activeSnapPoint:{default:void 0},closeThreshold:{default:V3},shouldScaleBackground:{type:Boolean,default:void 0},scrollLockTimeout:{default:H3},fixed:{type:Boolean,default:void 0},dismissible:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},nested:{type:Boolean,default:!1},direction:{default:"bottom"},snapPoints:{default:void 0},fadeFromIndex:{default:void 0}},emits:["drag","release","close","update:open","update:activeSnapPoint","animationEnd"],setup(e,{expose:t,emit:n}){const s=e,r=n;Ff();const o=ee(()=>s.fadeFromIndex??(s.snapPoints&&s.snapPoints.length-1)),i=Rg(s,"open",r,{defaultValue:s.defaultOpen,passive:s.open===void 0}),a=Rg(s,"activeSnapPoint",r,{passive:s.activeSnapPoint===void 0}),c={emitDrag:p=>r("drag",p),emitRelease:p=>r("release",p),emitClose:()=>r("close"),emitOpenChange:p=>{r("update:open",p),setTimeout(()=>{r("animationEnd",p)},wt.DURATION*1e3)}},{closeDrawer:u,hasBeenOpened:d,modal:f,isOpen:h}=z3(K3({...c,...At(s),activeSnapPoint:a,fadeFromIndex:o,open:i}));function g(p){if(i.value!==void 0){c.emitOpenChange(p);return}p?(d.value=!0,h.value=p):u()}return t({open:h}),(p,v)=>(m(),oe(y(v3),{open:y(h),modal:y(f),"onUpdate:open":g},{default:Se(()=>[It(p.$slots,"default",{open:y(h)})]),_:3},8,["open","modal"]))}}),id=Zt({__name:"DrawerRootNested",props:{activeSnapPoint:{},closeThreshold:{},shouldScaleBackground:{type:Boolean},scrollLockTimeout:{},fixed:{type:Boolean},dismissible:{type:Boolean},modal:{type:Boolean},open:{type:Boolean},defaultOpen:{type:Boolean},nested:{type:Boolean},direction:{},snapPoints:{},fadeFromIndex:{}},emits:["drag","release","close","update:open","update:activeSnapPoint","animationEnd"],setup(e,{emit:t}){const n=e,s=t,{onNestedDrag:r,onNestedOpenChange:o,onNestedRelease:i}=Lg();function a(){o(!1)}function c(f){r(f)}function u(f){f&&o(f),s("update:open",f)}const d=o3(n,s);return(f,h)=>(m(),oe(mo,xn(y(d),{nested:"",onClose:a,onDrag:c,onRelease:y(i),"onUpdate:open":u}),{default:Se(()=>[It(f.$slots,"default")]),_:3},16,["onRelease"]))}}),nr=Zt({__name:"DrawerContent",setup(e){const{open:t,isOpen:n,isVisible:s,snapPointsOffset:r,drawerRef:o,onPress:i,onDrag:a,onRelease:c,modal:u,emitOpenChange:d,dismissible:f,keyboardIsOpen:h,closeDrawer:g,direction:p}=Lg(),v=ee(()=>r.value&&r.value.length>0?`${r.value[0]}px`:"0");function _(k){if(!u.value||k.defaultPrevented){k.preventDefault();return}h.value&&(h.value=!1),k.preventDefault(),f.value&&d(!1),!(!f.value||t.value!==void 0)&&g()}return Pe(n,k=>{k&&setTimeout(()=>{s.value=!0},1)},{immediate:!0}),(k,w)=>(m(),oe(y(L3),{ref_key:"drawerRef",ref:o,"vaul-drawer":"","vaul-drawer-direction":y(p),"vaul-drawer-visible":y(s)?"true":"false",style:ht({"--snap-point-height":v.value}),onPointerdown:y(i),onPointermove:y(a),onPointerup:y(c),onPointerDownOutside:_,onEscapeKeyDown:w[0]||(w[0]=$=>{y(f)||$.preventDefault()})},{default:Se(()=>[It(k.$slots,"default")]),_:3},8,["vaul-drawer-direction","vaul-drawer-visible","style","onPointerdown","onPointermove","onPointerup"]))}}),Q3={class:"drawer-form",tabindex:"-1"},J3={class:"relative pt-[40px] bg-white rounded-t-2xl overflow-hidden"},X3=l("div",{tabindex:"-1",class:"w-10 h-[5px] rounded-full absolute bg-gray-300 left-1/2 -translate-x-1/2 top-4 cursor-grab"},null,-1),zg={__name:"FormDrawer",props:Kr(["target"],{open:{},openModifiers:{},success:{},successModifiers:{}}),emits:["update:open","update:success"],setup(e){const t=Ff(),n=dr(e,"open"),s=dr(e,"success"),r=R(!1),o=async i=>{await kt(),r.value=!i};return(i,a)=>(m(),x("div",Q3,[G(y(mo),{open:n.value,modal:!1,"should-scale-background":!1,"onUpdate:open":o},{default:Se(()=>[G(y(er),{to:e.target},{default:Se(()=>[l("div",{onClick:a[0]||(a[0]=c=>n.value=!1),class:te(["drawer-overlay-custom",{"drawer-overlay-custom--open":n.value}])},null,2),G(y(nr),{"aria-describedby":"dialog-description",class:"absolute inset-x-0 bottom-0 z-50 w-full outline-none border-none",tabindex:"-1"},{default:Se(()=>[G(y(wl),{class:"sr-only"},{default:Se(()=>[Be("DrawerTitle")]),_:1}),G(y(kl),{class:"sr-only"},{default:Se(()=>[Be("DrawerDescription")]),_:1}),It(i.$slots,"fields")]),_:3})]),_:3},8,["to"])]),_:3},8,["open"]),y(t).success&&r.value?(m(),oe(y(mo),{key:0,modal:!1,"should-scale-background":!1,open:s.value},{default:Se(()=>[G(y(er),{to:e.target},{default:Se(()=>[l("div",{onClick:a[1]||(a[1]=c=>s.value=!1),class:te(["drawer-overlay-custom",{"drawer-overlay-custom--open":s.value}])},null,2),G(y(nr),{class:"absolute inset-x-0 bottom-0 z-50 w-full outline-none border-none",tabindex:"-1"},{default:Se(()=>[G(y(wl),{class:"sr-only"},{default:Se(()=>[Be("DrawerTitle")]),_:1}),G(y(kl),{class:"sr-only"},{default:Se(()=>[Be("DrawerDescription")]),_:1}),l("div",J3,[X3,It(i.$slots,"success")])]),_:3})]),_:3},8,["to"])]),_:3},8,["open"])):q("",!0)]))}},Z3={tabindex:"-1",class:"relative pb-4 pt-3 bg-white rounded-t-2xl overflow-hidden"},Y3=l("div",{class:"flex justify-center"},[l("div",{tabindex:"-1",class:"w-10 h-[4px] rounded-full bg-gray-500 cursor-grab"})],-1),e4={key:0,class:"py-2 relative"},t4={class:"font-medium text-[18px] text-center tracking-wide text-gray-900"},n4={class:"px-5"},s4={class:"flex items-center space-x-3"},r4=l("button",{type:"submit",tabindex:"-1",class:"flex items-center justify-center h-12 bg-primary text-white border border-gray-200 w-full rounded-lg"}," Gửi yêu cầu ",-1),o4={class:"pb-6 pt-2"},i4={class:"text-[32px] flex items-center justify-center rounded-full"},a4=l("div",{class:"text-center mt-3 pl-2"},[l("div",{class:"font-medium text-gray-600 text-[18px]"}," Cảm ơn bạn đã liên hệ. "),l("div",{class:"text-[14px] text-gray-500 mt-1"}," Chúng tôi sẽ phản hồi lại trong thời gian sớm nhất. ")],-1),l4={__name:"FormContact",props:{form:{type:Object},message:{type:Object},chatViewRef:{type:Object}},setup(e){const{widgets:t}=Xs(),{getStorage:n}=Gs();R([]);const s=R(!1),r=async()=>{if(s.value)return;s.value=!0;const o=n("easychatgpt_conversations",B.handle),i=t.value.contact.fields.reduce((d,f)=>({...d,[f.name]:f.value}),{});if(!o)return;const a={status:"submitted",message_id:t.value.contact.message_id,conversation_id:o,submission_data:i},{data:c,status:u}=await Xe.submission.submitWidget({widgetId:t.value.contact.id,formData:a});u===200&&(B.isOpenFormContact=!1,B.isSuccessFormContact=!0,t.value.contact.is_finish=1,t.value.contact.submission_data=c.submission_data,t.value.contact.fields.forEach(d=>{d.value=""})),s.value=!1};return(o,i)=>(m(),oe(zg,{target:e.chatViewRef,open:y(B).isOpenFormContact,"onUpdate:open":i[3]||(i[3]=a=>y(B).isOpenFormContact=a),success:y(B).isSuccessFormContact,"onUpdate:success":i[4]||(i[4]=a=>y(B).isSuccessFormContact=a)},{fields:Se(()=>{var a;return[l("div",Z3,[Y3,(a=y(t).contact)!=null&&a.name?(m(),x("div",e4,[l("div",t4,j(y(t).contact.name),1)])):q("",!0),l("div",n4,[l("form",{onSubmit:i[1]||(i[1]=Gt(c=>r(),["prevent"])),class:"space-y-4",tabindex:"-1"},[(m(!0),x(be,null,Ie(y(t).contact.fields,(c,u)=>(m(),oe(Zu,{class:"px-0",field:c,key:u,modelValue:c.value,"onUpdate:modelValue":d=>c.value=d},null,8,["field","modelValue","onUpdate:modelValue"]))),128)),l("div",s4,[l("button",{onClick:i[0]||(i[0]=c=>y(B).isOpenFormContact=!1),type:"button",tabindex:"-1",class:"flex items-center justify-center h-12 bg-white hover:bg-gray-100 border border-gray-200 w-full rounded-lg text-gray-600"}," Quay lại "),r4])],32)])])]}),success:Se(()=>[l("div",null,[l("div",o4,[l("div",i4,[G(y(Fu),{"stroke-width":"1",size:"50",class:"text-gray-500"})]),a4]),l("button",{onClick:i[2]||(i[2]=a=>y(B).isSuccessFormContact=!1),class:"p-3 w-full text-sm font-medium text-primary flex items-center justify-center border-t border-t-gray-200 outline-none focus:outline-none"}," Tiếp Tục ")])]),_:1},8,["target","open","success"]))}};function Cl(){var s;const{getStorage:e}=Gs(),t=((s=B.bot)==null?void 0:s.config.apiHost)||B.apiDomain;return{update:async({formData:r,status:o})=>{var u;const i=e("easychatgpt_conversations",B.handle),a=B.forms&&B.forms.order&&B.forms.order.id;if(!a||!i)throw new Error("Missing data: formId or conversationId is required");let{submission_data:c}=await St.post(`${t}/api/bots/${B.handle}/widgets/${a}/submission`,{status:o,conversation_id:i,submission_data:r}).then(d=>d.data);return c?(B.handle!==$s&&(B.isOpenForm=!0),B.selectedForm=c,(!c.items||((u=c.items)==null?void 0:u.length)===0)&&(B.isOpenForm=!1,B.totalFormItems=0),localStorage.setItem(B.localStorageFormOrder,JSON.stringify(c)),{success:!0,data:c}):{success:!1,data:null}}}}const qg=e=>(nn("data-v-cf69952f"),e=e(),sn(),e),c4={class:"ecg-quantity"},u4=["disabled"],d4=[qg(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-minus"},[l("path",{d:"M5 12h14"})],-1))],f4=["min","max","step","disabled"],h4=["disabled"],p4=[qg(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-plus"},[l("path",{d:"M5 12h14"}),l("path",{d:"M12 5v14"})],-1))],Bg=Ke({__name:"FieldQuantity",props:Kr({min:{type:Number,default:1},max:{type:Number,default:99},disabled:{type:Boolean,default:!1},step:{type:Number,default:1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Number.isNaN||window.isNaN,n=/^-?(?:\d+|\d+\.\d+|\.\d+)(?:[eE][-+]?\d+)?$/,s=/\.\d*(?:0|9){10}\d*$/,r=(v,_=1e11)=>s.test(String(v))?Math.round(v*_)/_:v,o=e,i=dr(e,"modelValue"),a=R(null),c=ee(()=>t(i.value)||i.value<o.max),u=ee(()=>t(i.value)||i.value>o.min);function d(){if(!u.value)return;let v=i.value;t(v)&&(v=o.min||1),p(r(v-o.step))}function f(){if(!c.value)return;let v=i.value;t(v)&&(v=o.min||1),p(r(v+o.step))}function h(v){p(v.target.value)}function g(v){const _=v.clipboardData||window.clipboardData;_&&!n.test(_.getData("text"))&&v.preventDefault()}function p(v){let _=typeof v!="number"?parseFloat(v):v;t(_)?(_=o.min||1,a.value.value=_):o.min<=o.max&&(_=Math.min(o.max,Math.max(o.min,_))),i.value=_}return(v,_)=>(m(),x("div",c4,[l("button",{type:"button",class:"ecg-quantity__button ecg-quantity__button--minus",disabled:e.disabled||!u.value,onClick:Gt(d,["prevent"])},d4,8,u4),Rt(l("input",{ref_key:"input",ref:a,type:"number",class:"ecg-quantity__input","onUpdate:modelValue":_[0]||(_[0]=k=>i.value=k),min:e.min,max:e.max,step:e.step,autocomplete:"off",disabled:e.disabled||!u.value&&!c.value,onChange:h,onPaste:g,tabindex:"-1"},null,40,f4),[[on,i.value]]),l("button",{type:"button",class:"ecg-quantity__button ecg-quantity__button--plus",disabled:e.disabled||!c.value,onClick:Gt(f,["prevent"])},p4,8,h4)]))}},[["__scopeId","data-v-cf69952f"]]),m4={class:"flex space-x-2 w-full"},g4=["src","alt"],v4=["src","alt"],y4={class:"flex-1"},b4={class:"flex"},_4={class:"flex-1 mr-1 text-gray-900 text-sm font-medium line-clamp-2"},x4={class:"text-sm font-ligh text-red-500 font-medium"},w4={__name:"CardProductOrder",props:["item"],setup(e){const t=e,n=Ty(),s=R(!1),r=ee(()=>{var d;return((d=B.bot)==null?void 0:d.config.ui.logo)||B.appDomain+"/link.png"}),o=R(t.item.quantity),i=ee(()=>Number(t.item.price)*o.value),a=async d=>{let f=B.selectedForm;f&&(f.items.forEach(h=>{h.sku===t.item.sku&&(h.quantity=d)}),f={...f,items:f.items}),Cl().update({formData:f,status:"draft"})},c=async()=>{let d=B.selectedForm;if(d){const f=d.items.filter(h=>{var g,p;return((g=h.sku)==null?void 0:g.toString())!==((p=t.item.sku)==null?void 0:p.toString())});d={...d,items:f}}await Cl().update({formData:d,status:"draft"}),n.contentFormRef&&(n.contentFormRef.style.height="auto")},u=R(null);return Pe(o,d=>{clearTimeout(u.value),a(Number(d))}),(d,f)=>(m(),x("div",m4,[l("div",{class:te(["w-[90px] flex-shrink-0 h-fit rounded overflow-hidden",(s.value||!e.item.image)&&"aspect-[3/2] flex items-center justify-center border border-gray-100 rounded"])},[e.item.image?(m(),x("img",{key:0,src:e.item.image,alt:e.item.title,class:"w-full h-full object-contain",onError:f[0]||(f[0]=h=>(h.target.src=r.value,h.target.className="max-w-[24px]",s.value=!0))},null,40,g4)):(m(),x("img",{key:1,src:r.value,alt:e.item.title,class:"max-w-[24px] w-full h-full object-contain"},null,8,v4))],2),l("div",y4,[l("div",b4,[l("h3",_4,j(e.item.title),1)]),l("div",null,[l("div",x4,j(y(et)(i.value)),1),G(Bg,{modelValue:o.value,"onUpdate:modelValue":f[1]||(f[1]=h=>o.value=h),class:"mt-1.5"},null,8,["modelValue"])])]),l("div",null,[l("button",{onClick:f[2]||(f[2]=h=>c()),class:"text-gray-400 hover:text-red-400 size-[24px] hover:bg-red-50 flex items-center justify-center rounded"},[G(y(og),{size:"16"})])])]))}},k4={},S4={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"-0.5 -0.5 16 16","stroke-linecap":"round","stroke-linejoin":"round",stroke:"currentColor",height:"16",width:"16",class:"text-gray-500"},$4=[l("path",{d:"M2.5 13.125h10M3.5412500000000002 8.241875A1.42375 1.42375 0 0 0 3.125 9.248125V11.25h2.014375c0.3775 0 0.739375 -0.15 1.00625 -0.41750000000000004l5.9375 -5.940625000000001a1.42375 1.42375 0 0 0 0 -2.0125l-0.5862499999999999 -0.5874999999999999a1.4231250000000002 1.4231250000000002 0 0 0 -2.01375 0.000625z","stroke-width":"1"},null,-1)];function C4(e,t){return m(),x("svg",S4,$4)}const T4=Ke(k4,[["render",C4]]);function E4(e,t){const n=t.split(":")[0],s=t.split(":")[1]??null;switch(n){case"array":return Array.isArray(e);case"required":return!!e;case"email":const r=/^[\w.!?#$%&'=~|{}`+*^][\w\-.!?#$%&'=~|{}`+*^]*@((xn--)?[\w]+([-][\w]+)*\.)+[a-z]{2,}$/i,o=e&&!e.includes("@gnail")&&!e.includes("@gmai.");return e&&r.test(e)&&o;case"date":return new Date(e)!=="Invalid Date"&&!isNaN(new Date(e));case"string":return typeof e=="string";case"phone":return/^(84|19|0[2|3|5|7|8|9])\d{8}$/g.test(e);case"in":const c=s.split(",");return Array.isArray(e)?e.every(u=>c.includes(u.toString())):e&&c.includes(e.toString());case"integer":return!isNaN(e);case"min":return e.length>=parseInt(s);case"max":return e.length<=parseInt(s);default:return!0}}function Ug(e,t){let n={};for(const s of Object.entries(e))Vg(s[1],t[s[0]])||(n[s[0]]="");return n}function Vg(e,t){if(t===void 0)return!0;let n=!0;for(const s of t.split("|"))if(!E4(e,s)){n=!1;break}return n}const A4={class:"ecg-form-wrapper"},I4=["type"],P4=["type"],M4=["value"],O4=["value"],R4={key:3,class:"flex items-center space-x-4"},L4={class:"ecg-form-radio"},D4=["id","name","value"],j4=l("div",{class:"checkmark"},null,-1),N4=["for"],F4={key:4,class:"text-xs text-red-500 pl-1 absolute left-0 bottom-0 translate-y-full"},os={__name:"FormField",props:Kr({field:{type:Object,required:!0},classField:{type:[String,Boolean]}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,n=dr(e,"modelValue"),s=R(""),r=ee(()=>{var o;return(o=t.field.validate)==null?void 0:o.includes("required")});return Pe(()=>n.value,o=>{let i=`${t.field.label?t.field.label:""} không hợp lệ.`;r.value&&!o&&(i=`${t.field.label?t.field.label:""} là bắt buộc.`);const a=Vg(o,t.field.validate);s.value=a===!0?"":i}),(o,i)=>(m(),x("div",A4,[e.field.type==="tel"||e.field.type==="text"||e.field.type==="email"||e.field.type==="number"?Rt((m(),x("input",xn({key:0,type:e.field.type},{...e.field,placeholder:e.field.label+`${r.value?" *":""}`,autocomplete:"off",required:e.field.validate==="required"},{class:["ecg-form-field",e.classField],tabindex:"-1","onUpdate:modelValue":i[0]||(i[0]=a=>n.value=a)}),null,16,I4)),[[P1,n.value]]):e.field.type==="textarea"?Rt((m(),x("textarea",xn({key:1,type:e.field.type},{...e.field,rows:e.field.rows??3,placeholder:e.field.label+`${r.value?" *":""}`,autocomplete:"off",required:e.field.validate==="required"},{class:["ecg-form-field",e.classField],tabindex:"-1","onUpdate:modelValue":i[1]||(i[1]=a=>n.value=a)}),null,16,P4)),[[on,n.value]]):e.field.type==="select"?Rt((m(),x("select",{key:n.value,"onUpdate:modelValue":i[2]||(i[2]=a=>n.value=a),class:te(["ecg-form-field",[n.value?"has-value":"none-value",e.classField]]),tabindex:"-1"},[l("option",{disabled:"",value:n.value===void 0?void 0:""},j(e.field.label),9,M4),(m(!0),x(be,null,Ie(e.field.options,a=>(m(),x("option",{value:e.field.keyValue?a[e.field.keyValue]:a},j(e.field.keyLabel?a[e.field.keyLabel]:a),9,O4))),256))],2)),[[Mh,n.value]]):e.field.type==="checkbox"?(m(),x("div",R4,[(m(!0),x(be,null,Ie(e.field.options,(a,c)=>(m(),x("div",L4,[Rt(l("input",{type:"radio","onUpdate:modelValue":i[3]||(i[3]=u=>n.value=u),id:`${e.field.name}-${c}`,name:e.field.name,value:a},null,8,D4),[[Ph,n.value]]),j4,l("label",{for:`${e.field.name}-${c}`},j(a),9,N4)]))),256))])):q("",!0),s.value?(m(),x("div",F4,j(s.value),1)):q("",!0)]))}},z4={tabindex:"-1",class:"relative pb-4 pt-3 bg-white rounded-t-2xl overflow-hidden outline-none"},q4=l("div",{class:"flex justify-center"},[l("div",{tabindex:"-1",class:"w-10 h-[4px] rounded-full bg-gray-500 cursor-grab"})],-1),B4={class:"pt-2 pb-3 relative"},U4=l("div",{class:"h-[0.5px] w-full bg-gray-100 absolute bottom-0 inset-x-0"},null,-1),V4={class:"px-5 pt-5"},H4={key:0},W4={class:"flex items-center space-x-2"},G4={class:"flex items-center space-x-2"},K4=l("button",{type:"submit",class:"flex items-center justify-center h-11 bg-primary text-white border border-gray-200 w-full rounded-lg"}," Lưu thay đổi ",-1),Q4={key:1},J4={class:"max-h-[208px] overflow-y-auto"},X4={class:"mt-5"},Z4={key:0,"aria-label":"add-information",class:"py-0.5 flex items-center justify-center"},Y4=l("div",{class:"font-medium text-sm text-gray-500 ml-1"}," Thêm địa chỉ ",-1),eT={key:1,class:"flex items-start justify-between"},tT={class:"text-sm text-gray-500 line-clamp-2"},nT={"aria-label":"edit-info"},sT={class:"mt-5 px-1"},rT={class:"flex items-center justify-between"},oT={class:"text-gray-500 mr-2 text-sm"},iT={class:"text-right text-[16px] font-medium"},aT={class:"text-red-500 text-sm"},lT={class:"bg-white z-20 mt-4"},cT=l("div",{class:"text-gray-500 text-[10px] mt-1.5 text-center"}," Nhân viên sẽ gọi tư vấn giá, khuyến mãi chính xác sau khi đặt hàng ",-1),uT={class:"pb-6 pt-2"},dT={class:"text-[32px] flex items-center justify-center rounded-full"},fT=l("div",{class:"text-center mt-3 pl-2"},[l("div",{class:"font-medium text-gray-600 text-[18px]"}," Đặt hàng thành công "),l("div",{class:"text-[14px] text-gray-500 mt-1"}," Chúng tôi sẽ liên hệ với quý khách để xác nhận đơn hàng ")],-1),hT={__name:"FormOrder",props:{chatViewRef:{type:Object}},emits:["send-message"],setup(e,{emit:t}){var g;const n=t,s=((g=B.bot)==null?void 0:g.config.apiHost)||B.apiDomain,r=R(!1),o=R(null),i=ee(()=>{var p,v;return!!((v=(p=B.forms)==null?void 0:p.order)!=null&&v.fields.find(_=>_.name==="gender"||_.label==="Danh xưng"))});Pe(()=>B.forms.order,p=>{p&&B.forms.order.fields.forEach(v=>{v.value=""})}),Pe(()=>B.isOpenForm,p=>{p&&(r.value=!1)});const a=ee(()=>{const{gender:p,full_name:v,phone:_,email:k,address:w}=B.selectedForm;return[p?p+" "+v:v,_,k,w].filter(E=>!!E).join(" | ")}),c=ee(()=>{var v;let p=!1;return B.selectedForm?((v=B.forms.order)==null||v.fields.forEach(_=>{B.selectedForm[_.name]&&(p=!0)}),!p):!1}),u=ee(()=>{var v,_;let p=0;return(_=(v=B.selectedForm)==null?void 0:v.items)==null||_.forEach(k=>{p=p+Number(k.price)*k.quantity}),p}),d=async p=>{await kt();const v=p.offsetHeight;o.value.style.height=v?`${v}px`:"auto"},f=async()=>{var k,w;const p=ro(B.handle);if(!p)return;let v=JSON.parse(localStorage.getItem(B.localStorageFormOrder));v={submission_data:{items:v.items||[]},status:"draft",conversation_id:p},(w=(k=B.forms)==null?void 0:k.order)==null||w.fields.forEach($=>{v.submission_data[$.name]=$.value});const{submission_data:_}=await St.post(`${s}/api/bots/${B.handle}/widgets/${B.forms.order.id}/submission`,v).then($=>$.data);_&&(localStorage.setItem(B.localStorageFormOrder,JSON.stringify(_)),B.selectedForm=_,r.value=!1)},h=async()=>{var w,$,E,P,I;const p=ro(B.handle);if(!p)return;let v=JSON.parse(localStorage.getItem(B.localStorageFormOrder));if(v={status:"submitted",conversation_id:p,submission_data:{...v}},await St.post(`${s}/api/bots/${B.handle}/widgets/${(w=B.forms.order)==null?void 0:w.id}/submission`,v).then(M=>M.data)){console.log("formData",v);const{title:M,full_name:L,phone:V,email:X,address:T,items:A}=v.submission_data,D=L||"";if(B.handle===$s){const Q=sw({name:D,phone:V||"",email:X||"",address:T||"",items:A||[],shopName:(($=B.bot)==null?void 0:$.name)||((I=(P=(E=B.bot)==null?void 0:E.config)==null?void 0:P.ui)==null?void 0:I.title)||""});n("send-message",Q)}if(localStorage.removeItem(B.localStorageFormOrder),B.selectedForm=null,B.isOpenForm=!1,B.isSuccessForm=!0,B.totalFormItems=0,B.forms.order.fields)for(var k in B.forms.order.fields)B.forms.order.fields[k].value=""}};return(p,v)=>(m(),oe(zg,{target:e.chatViewRef,open:y(B).isOpenForm,"onUpdate:open":v[7]||(v[7]=_=>y(B).isOpenForm=_),success:y(B).isSuccessForm,"onUpdate:success":v[8]||(v[8]=_=>y(B).isSuccessForm=_)},{fields:Se(()=>[l("div",z4,[q4,l("div",B4,[G(Yt,{appear:"",mode:"out-in",name:"scale-fade"},{default:Se(()=>[(m(),x("div",{key:r.value,class:"font-medium text-[18px] text-center tracking-wide text-gray-900"},j(r.value?"Thông tin khách hàng":"Giỏ hàng"),1))]),_:1}),U4]),l("div",V4,[l("div",{class:"duration-300",ref_key:"contentFormRef",ref:o},[G(Yt,{appear:"",name:"scale-fade",mode:"out-in",onBeforeEnter:d,onBeforeLeave:d},{default:Se(()=>{var _,k,w;return[(m(),x("div",{key:r.value},[r.value?(m(),x("div",H4,[l("form",{onSubmit:v[3]||(v[3]=Gt($=>f(),["prevent"])),class:"space-y-[18px]"},[i.value?(m(),x(be,{key:0},[l("div",W4,[G(os,{classField:"form-field-custom",field:y(B).forms.order.fields[0],modelValue:y(B).forms.order.fields[0].value,"onUpdate:modelValue":v[0]||(v[0]=$=>y(B).forms.order.fields[0].value=$)},null,8,["field","modelValue"]),G(os,{class:"flex-1",field:y(B).forms.order.fields[1],modelValue:y(B).forms.order.fields[1].value,"onUpdate:modelValue":v[1]||(v[1]=$=>y(B).forms.order.fields[1].value=$)},null,8,["field","modelValue"])]),(m(!0),x(be,null,Ie(y(B).forms.order.fields,($,E)=>(m(),x("div",null,[E>1?(m(),oe(os,{field:$,key:E,modelValue:$.value,"onUpdate:modelValue":P=>$.value=P},null,8,["field","modelValue","onUpdate:modelValue"])):q("",!0)]))),256))],64)):(m(!0),x(be,{key:1},Ie(y(B).forms.order.fields,($,E)=>(m(),oe(os,{field:$,key:E,modelValue:$.value,"onUpdate:modelValue":P=>$.value=P},null,8,["field","modelValue","onUpdate:modelValue"]))),128)),l("div",G4,[l("button",{type:"button",onClick:v[2]||(v[2]=$=>[r.value=!1]),class:"flex items-center justify-center h-11 bg-white hover:bg-gray-100 border border-gray-200 w-full rounded-lg text-gray-600"}," Quay lại "),K4])],32)])):(m(),x("div",Q4,[l("div",J4,[(m(),x("div",{class:"space-y-5",key:(k=(_=y(B).selectedForm)==null?void 0:_.items)==null?void 0:k.length},[(m(!0),x(be,null,Ie(((w=y(B).selectedForm)==null?void 0:w.items)||[],($,E)=>(m(),oe(w4,{key:E,item:$,contentFormRef:o.value},null,8,["item","contentFormRef"]))),128))]))]),l("div",X4,[l("div",{onClick:v[4]||(v[4]=$=>r.value=!0),class:"relative p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 duration-100"},[c.value||!y(B).selectedForm?(m(),x("div",Z4,[G(y(m2),{size:"16",class:"text-gray-500"}),Y4])):(m(),x("div",eT,[l("div",tT,j(a.value),1),l("button",nT,[G(T4)])]))])]),l("div",sT,[l("div",rT,[l("div",oT," Giá tham khảo ("+j(y(B).totalFormItems)+" sản phẩm) ",1),l("div",iT,[l("div",aT,j(y(et)(u.value)),1)])])]),l("div",lT,[l("div",null,[l("button",{onClick:v[5]||(v[5]=$=>h()),class:te([c.value?"cursor-not-allowed opacity-90 bg-gray-100 border-gray-200 text-gray-500":"bg-primary border-primary text-white hover:opacity-80 ","flex items-center justify-center h-11 border w-full rounded-lg text-[16px]"])}," Đặt hàng ",2)]),cT])]))]))]}),_:1})],512)])])]),success:Se(()=>[l("div",null,[l("div",uT,[l("div",dT,[G(y(cn),{"stroke-width":"1",size:"50",class:"text-gray-500"})]),fT]),l("button",{onClick:v[6]||(v[6]=_=>y(B).isSuccessForm=!1),class:"p-3 w-full text-sm text-primary flex items-center justify-center bg-white border-t border-t-gray-200"}," Tiếp tục mua sắm ")])]),_:1},8,["target","open","success"]))}},Hg={__name:"Drawer",props:Kr({slotNames:{type:Array,default:()=>[]},chatViewRef:{type:Object,default:()=>null},isNestedOpen:{type:Boolean,default:!1}},{open:{},openModifiers:{}}),emits:["update:open"],setup(e){const t=e,n=dr(e,"open"),s=R(0),r=R(0),o=R(0),i=R(""),a=R(null);Pe(()=>t.isNestedOpen,g=>{g||(a.value.$el.style.transform="unset")});const c=ee(()=>t.slotNames.find(g=>g.active));Pe(c,()=>{s.value=s.value+1});const u=g=>{i.value.style.height=`${r.value}px`},d=g=>{o.value=g.offsetHeight,i.value.style.height=`${g.offsetHeight}px`},f=g=>{i.value&&i.value.style&&(i.value.style.height="auto")},h=g=>{r.value=g.offsetHeight};return(g,p)=>(m(),oe(y(mo),{open:n.value,"onUpdate:open":p[1]||(p[1]=v=>n.value=v),modal:!1,"should-scale-background":!1},{default:Se(()=>[G(y(er),{to:e.chatViewRef},{default:Se(()=>[l("div",{onClick:p[0]||(p[0]=v=>n.value=!1),class:te(["drawer-overlay-custom",{"drawer-overlay-custom--open":n.value}])},null,2),G(y(nr),{ref_key:"drawerContentWrapperRef",ref:a,class:"flex overflow-hidden absolute right-0 bottom-0 left-0 z-50 flex-col bg-white rounded-t-2xl outline-none"},{default:Se(()=>[G(y(wl),{class:"sr-only"},{default:Se(()=>[Be("DrawerTitle")]),_:1}),G(y(kl),{class:"sr-only"},{default:Se(()=>[Be("DrawerDescription")]),_:1}),l("div",{ref_key:"drawerContentRef",ref:i,class:"content-drawer"},[G(Yt,{onBeforeEnter:u,onEnter:d,onAfterEnter:f,onLeave:h,mode:"out-in",name:"scale-fade"},{default:Se(()=>[(m(),x("div",{key:s.value},[(m(!0),x(be,null,Ie(e.slotNames,(v,_)=>(m(),x(be,{key:_+v.active},[v.active?It(g.$slots,v.name,{key:0}):q("",!0)],64))),128))]))]),_:3})],512)]),_:3},512)]),_:3},8,["to"])]),_:3},8,["open"]))}},pT=[l("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"#f1f5f9"},null,-1),l("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"},null,-1)],en={__name:"IconSpinner",props:{color:{type:String,default:"text-primary"}},setup(e){return(t,n)=>(m(),x("svg",{"aria-hidden":"true",role:"status",class:te(["inline animate-spin",[e.color]]),viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},pT,2))}},mT={class:"flex space-x-3 w-full"},gT={class:"w-[96px] h-[96px] flex-shrink-0 rounded-md overflow-hidden border border-gray-100 flex items-center justify-center"},vT=["src"],yT=["src","alt"],bT={class:"flex-1"},_T={class:"flex flex-1 mr-1 mb-1 w-full text-sm font-medium text-gray-900"},xT={key:0,class:"px-2 py-0.5 mb-1 text-xs text-gray-500 bg-gray-50 rounded w-fit"},wT={class:"flex items-center space-x-1"},kT={class:"text-sm font-semibold text-red-500"},ST={key:0,class:"text-xs text-gray-500"},$T={__name:"CardOrder",props:["item"],setup(e){var u,d;const t=e,n=R(!1),s=((d=(u=B.bot)==null?void 0:u.config)==null?void 0:d.ui.logo)||`${B.appDomain}/link.png`,r=R(null),o=R(t.item.quantity),i=R(!1);Pe(o,()=>{clearTimeout(r.value),r.value=setTimeout(()=>{a()},380)});async function a(){const{data:f}=await Xe.cart.update(t.item.id,{quantity:o.value});f.success&&(B.cart=f.data,ECG.sync.emit("cart",{source:"easy-ai-chat",data:f.data}))}async function c(){try{if(i.value)return;i.value=!0;const{data:f}=await Xe.cart.remove(t.item.id);f.success&&(B.cart=f.data,ECG.sync.emit("cart",{source:"easy-ai-chat",data:f.data}))}catch{}finally{i.value=!1}}return(f,h)=>{var g;return m(),x("div",mT,[l("div",gT,[n.value?(m(),x("img",{key:0,src:y(s),alt:"image error",class:"w-[32px] h-[32px] object-cover"},null,8,vT)):(m(),x("img",{key:1,src:e.item.image,alt:e.item.name,class:"object-contain w-full h-full",onError:h[0]||(h[0]=p=>n.value=!0)},null,40,yT))]),l("div",bT,[l("h3",_T,j(e.item.name),1),(g=e.item.properties)!=null&&g.title?(m(),x("div",xT,j(e.item.properties.title),1)):q("",!0),l("div",null,[l("div",wT,[l("div",kT,j(y(et)(e.item.price)),1),e.item.compare_at_price>e.item.price?(m(),x("del",ST,j(y(et)(e.item.compare_at_price)),1)):q("",!0)]),G(Bg,{modelValue:o.value,"onUpdate:modelValue":h[1]||(h[1]=p=>o.value=p),class:"mt-1.5"},null,8,["modelValue"])])]),l("div",null,[l("button",{onClick:h[2]||(h[2]=p=>c()),class:te([i.value?"bg-red-50 ":"hover:text-red-400 hover:bg-red-50 ","text-gray-400 size-[24px] flex items-center justify-center rounded-full"])},[i.value?(m(),oe(en,{key:0,class:"max-w-[16px] h-[16px] !text-red-500"})):(m(),oe(y(og),{key:1,size:"16"}))],2)])])}}},CT={},TT={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},ET=[l("path",{d:"m15 18-6-6 6-6"},null,-1)];function AT(e,t){return m(),x("svg",TT,ET)}const Wg=Ke(CT,[["render",AT]]),IT={},PT={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},MT=[l("circle",{cx:"12",cy:"12",r:"10"},null,-1),l("path",{d:"M12 16v-4"},null,-1),l("path",{d:"M12 8h.01"},null,-1)];function OT(e,t){return m(),x("svg",PT,MT)}const Tl=Ke(IT,[["render",OT]]),Ii=e=>(nn("data-v-cbe62a30"),e=e(),sn(),e),RT={class:"relative pb-4 pt-5 bg-white rounded-t-2xl overflow-hidden outline-none"},LT=Ii(()=>l("div",{class:"relative text-center mb-4"},[l("div",{class:"font-semibold text-gray-900 text-lg"},"Đăng nhập")],-1)),DT={key:0,class:"text-red-500 flex items-center mt-2 space-x-1"},jT={class:"text-xs"},NT=Ii(()=>l("p",{class:"text-sm text-gray-900"}," Mã xác thực (OTP) sẽ được gửi đến số điện thoại này để xác minh số điện thoại này là của bạn ",-1)),FT={type:"submit",class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium"},zT=Ii(()=>l("div",null,"Tiếp tục",-1)),qT={key:0,class:"absolute left-1/2 -translate-x-1/2 top-1/3"},BT={class:"px-5 py-4 bg-red-50 rounded-xl relative fade-in"},UT=Ii(()=>l("div",{class:"text-center text-sm font-medium text-red-500"},[l("div",null,"Có lỗi xảy ra.")],-1)),VT=[Ii(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"max-w-[14px]"},[l("path",{d:"M18 6 6 18"}),l("path",{d:"m6 6 12 12"})],-1))],Gg=Ke({__name:"AuthLogin",emits:["success","error"],setup(e,{emit:t}){const n=t,s=dt({identifier:"",type:"phone"}),r={identifier:"required|phone"},o=R(!1),i=R(!1),a=R(null),c=R(null);Pe(()=>s.identifier,d=>{d&&(o.value=!1,c.value=null,a.value=null)});const u=async()=>{var d,f;try{const h=Ug(s,r);if(o.value=Object.keys(h).length>0,o.value||i.value)return;i.value=!0;const{data:g}=await Xe.auth.login(s);g&&g.success?n("success",{form:s}):(o.value=!0,g.message==="otp_service_under_maintenance"?c.value="OTP đang bảo trì. Vui lòng quay lại sau.":c.value="Số điện thoại không hợp lệ. Vui lòng thử lại.")}catch(h){console.log(h),a.value=(f=(d=h.response)==null?void 0:d.data)==null?void 0:f.message,n("error",{form:s})}finally{i.value=!1}};return(d,f)=>(m(),x("div",RT,[LT,l("form",{onSubmit:f[1]||(f[1]=Gt(h=>u(),["prevent"])),class:"px-6 space-y-4"},[l("div",null,[Rt(l("input",{type:"tel","onUpdate:modelValue":f[0]||(f[0]=h=>s.identifier=h),placeholder:"Nhập số điện thoại",class:"ecg-form-field !h-12"},null,512),[[on,s.identifier]]),o.value?(m(),x("div",DT,[G(Tl),l("div",jT,j(c.value??"Thông tin bắt buộc. Vui lòng nhập chính xác."),1)])):q("",!0)]),NT,l("button",FT,[i.value?(m(),oe(en,{key:0,class:"mr-1 w-4 h-4"})):q("",!0),zT])],32),a.value?(m(),x("div",qT,[l("div",BT,[UT,l("button",{onClick:f[2]||(f[2]=h=>a.value=null),class:"size-5 text-red-500 rounded-full absolute -top-1 -right-1 bg-red-100 hover:bg-red-200 flex items-center justify-center z-10"},VT)])])):q("",!0)]))}},[["__scopeId","data-v-cbe62a30"]]),ad=e=>(nn("data-v-ca9c6389"),e=e(),sn(),e),HT={class:"relative pb-4 pt-4 bg-white rounded-t-2xl overflow-hidden outline-none"},WT=ad(()=>l("div",{class:"relative text-center mb-4"},[l("div",{class:"font-semibold text-gray-900 text-lg"}," Nhập mã xác minh ")],-1)),GT={class:"px-6 space-y-4"},KT={class:"text-sm text-gray-900"},QT=ad(()=>l("br",null,null,-1)),JT={key:0,class:"ecg-fieldset-error text-red-500 flex items-center mt-2 space-x-1"},XT={class:"text-xs font-medium"},ZT={type:"submit",form:"ecg-form-verify-otp",class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium !mt-6"},YT=ad(()=>l("div",null,"Xác minh",-1)),Kg=Ke({__name:"AuthVerifyOtp",props:["identifier"],emits:["success","error"],setup(e,{emit:t}){const n=e,s=t,r=dt({identifier:n.identifier,code:""}),o=R(!1),i=R(!1),a=R(null);R(null),R(null);const c=async()=>{var d,f;try{const{data:h}=await Xe.auth.getUser();h.success&&(B.user=h.data)}catch(h){((f=(d=h.response.data)==null?void 0:d.raw)==null?void 0:f.message)==="error_token_is_expired"&&(B.user=null,B.token=null,Tt.remove(ts))}},u=async()=>{try{if(o.value=r.code.length<6,o.value||i.value)return;i.value=!0;const{data:d}=await Xe.auth.verifyOtp(r);d.success&&(Tt.set(ts,d.data.access_token,"14d"),ECG.sync.emit("login",{source:"easy-ai-chat",data:d.data}),c(),s("success",{form:r}),r.code="",r.identifier="",Xe.cart.getList())}catch{o.value=!0,a.value="Mã xác thực không hợp lệ. Vui lòng kiểm tra lại"}finally{i.value=!1}};return(d,f)=>(m(),x("div",HT,[WT,l("div",GT,[l("div",null,[l("p",KT,[Be(" Nhập mã xác minh gồm 6 số vừa được gửi đến "),QT,Be(" SĐT "),l("strong",null,j(r.identifier),1),Be(" của bạn. ")])]),l("div",null,[l("form",{onSubmit:f[1]||(f[1]=Gt(h=>u(),["prevent"])),id:"ecg-form-verify-otp"},[Rt(l("input",{type:"number","onUpdate:modelValue":f[0]||(f[0]=h=>r.code=h),placeholder:"Nhập mã xác thực",class:"ecg-form-field !h-12"},null,512),[[on,r.code]])],32),o.value?(m(),x("div",JT,[G(Tl),l("div",XT,j(a.value),1)])):q("",!0)]),l("button",ZT,[i.value?(m(),oe(en,{key:0,class:"mr-1 w-4 h-4"})):q("",!0),YT])])]))}},[["__scopeId","data-v-ca9c6389"]]),e6={},t6={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-ticket-percent"},n6=[l("path",{d:"M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"},null,-1),l("path",{d:"M9 9h.01"},null,-1),l("path",{d:"m15 9-6 6"},null,-1),l("path",{d:"M15 15h.01"},null,-1)];function s6(e,t){return m(),x("svg",t6,n6)}const El=Ke(e6,[["render",s6]]),r6={},o6={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i6=[l("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function a6(e,t){return m(),x("svg",o6,i6)}const go=Ke(r6,[["render",a6]]),l6={class:"flex items-center rounded h-[110px] w-full"},c6=["src","alt"],u6={key:2,class:"absolute inset-0 bg-primary opacity-10"},d6={key:0,class:"absolute inset-0 bg-primary opacity-10"},f6={class:"flex flex-col relative z-10 h-full"},h6={class:"flex items-start"},p6={class:"font-medium text-sm text-gray-900 flex-1"},m6={class:"mt-auto flex md:items-center md:flex-row flex-col md:space-y-0 space-y-1"},g6={class:"text-xs text-gray-500 tracking-tight"},v6={__name:"CardCoupon",props:{isActive:{type:Boolean,default:!1},coupon:{type:Object,default:!1},loading:{type:Boolean,default:!1}},emits:["remove","apply",",onViewDetail"],setup(e,{emit:t}){const n=t;return(s,r)=>(m(),x("div",l6,[l("div",{class:te(["p-2 rounded-lg border border-r-0 w-[110px] h-full flex-shrink-0 flex items-center justify-center relative",e.isActive?"border-primary":"border-gray-200"])},[e.coupon.image?(m(),x("img",{key:0,src:e.coupon.image,alt:e.coupon.title,class:"w-full h-full object-cover rounded-lg relative z-10"},null,8,c6)):(m(),oe(El,{key:1,class:"text-gray-500 scale-125 relative z-10"})),e.isActive?(m(),x("div",u6)):q("",!0)],2),l("div",{class:te(["border-r border-dashed h-[100px] flex-shrink-0",e.isActive?"border-primary":"border-gray-200"])},null,2),l("div",{class:te(["flex-1 p-3 border border-l-0 rounded-lg h-full relative overflow-hidden",e.isActive?"border-primary":"border-gray-200"])},[e.isActive?(m(),x("div",d6)):q("",!0),l("div",f6,[l("div",h6,[l("div",p6,j(e.coupon.title),1),l("button",{class:"w-6 h-6 flex items-center justify-center rounded-md text-primary",onClick:r[0]||(r[0]=o=>n("onViewDetail",e.coupon))},[G(Tl)])]),l("div",m6,[l("div",g6," HSD: "+j(e.coupon.started_at)+"-"+j(e.coupon.ended_at),1),l("button",{onClick:r[1]||(r[1]=o=>e.isActive?n("remove",e.coupon.code):n("apply",e.coupon.code)),class:"px-[8px] w-full md:w-fit py-[6px] text-xs text-white bg-primary rounded-md font-medium flex items-center justify-center ml-auto"},[e.loading?(m(),oe(en,{key:0,class:"w-3 mr-1"})):q("",!0),Be(" "+j(e.isActive?"Bỏ chọn":"Áp dụng"),1)])])])],2)]))}},y6={},b6={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},_6=[l("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},null,-1),l("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},null,-1)];function x6(e,t){return m(),x("svg",b6,_6)}const w6=Ke(y6,[["render",x6]]);function k6(e=2e3){const t=R(!1),n=R(null),s=async i=>{if(navigator.clipboard)try{return await navigator.clipboard.writeText(i),o(),!0}catch(a){return console.error("Failed to copy:",a),r(i)}else return r(i)},r=i=>{try{const a=document.createElement("textarea");a.value=i,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",document.body.appendChild(a),a.focus(),a.select();const c=document.execCommand("copy");return document.body.removeChild(a),c?(o(),!0):!1}catch(a){return console.error("Fallback: Failed to copy:",a),!1}},o=()=>{t.value=!0,n.value&&clearTimeout(n.value),n.value=setTimeout(()=>{t.value=!1},e)};return Jn(()=>{n.value&&clearTimeout(n.value)}),{copied:t,copy:s}}const S6={class:"flex flex-col bg-white rounded-t-3xl h-full pt-5"},$6=l("div",{class:"w-[38px] h-[6px] rounded-full bg-gray-400 cursor-grab mx-auto mb-5"},null,-1),C6={class:"font-semibold text-gray-900 text-xl text-center px-4 mb-6"},T6={class:"relative group"},E6={class:"flex items-center text-sm px-4 py-3 bg-gray-50 relative z-10"},A6=l("div",{class:"w-[33%] text-gray-500"},"Mã",-1),I6={class:"flex-1 flex items-center"},P6={class:"text-gray-700 mr-2"},M6=[l("div",{class:"text-sm text-green-700 px-4 h-11 flex items-center justify-center rounded-lg bg-green-100 whitespace-nowrap"}," Sao chép mã thành công ",-1)],O6={class:"flex text-sm px-4 py-3 bg-white"},R6=l("div",{class:"w-[33%] text-gray-500"},"Hạn sử dụng",-1),L6={class:"flex-1 text-gray-700"},D6={class:"px-4 py-3 bg-gray-50"},j6=l("div",{class:"text-sm mb-3 text-gray-500"},"Điều kiện",-1),N6=["innerHTML"],F6={class:"py-3 px-4 bg-white"},z6={__name:"CouponDetail",props:{coupon:{type:Object},active:{type:Boolean,default:!1}},emits:["apply","remove"],setup(e,{emit:t}){const n=t,{copied:s,copy:r}=k6();return(o,i)=>(m(),x("div",S6,[$6,l("div",C6,j(e.coupon.title),1),l("div",T6,[l("div",E6,[A6,l("div",I6,[l("div",P6,j(e.coupon.code),1),l("button",{onClick:i[0]||(i[0]=a=>y(r)(e.coupon.code)),class:"h-[24px] w-[24px] flex items-center justify-center text-blue-600 bg-blue-50 rounded-full overflow-hidden"},[G(w6)])])]),l("div",{class:te([y(s)?"translate-y-full ":"translate-y-0","absolute left-1/2 -translate-x-1/2 bottom-0 duration-200"])},M6,2)]),l("div",O6,[R6,l("div",L6,j(e.coupon.started_at)+" - "+j(e.coupon.ended_at),1)]),l("div",D6,[j6,l("div",{class:"max-h-[132px] overflow-y-auto prose coupon-detail-desc",innerHTML:e.coupon.description},null,8,N6)]),l("div",F6,[l("button",{onClick:i[1]||(i[1]=a=>e.active?n("remove",e.coupon.code):n("apply",e.coupon.code)),class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium"},j(e.active?"Bỏ chọn":"Áp dụng"),1)])]))}},q6={class:"flex space-x-2 w-full"},B6={class:"w-[86px] h-[86px] flex-shrink-0 rounded-xl overflow-hidden border border-gray-100 flex items-center justify-center"},U6=["src"],V6=["src","alt"],H6={class:"flex-1"},W6={class:"text-gray-700 font-medium text-sm line-clamp-2 mb-2"},G6={class:"flex items-center space-x-4"},K6={class:"text-sm text-red-500 font-medium"},Q6={key:0,class:"text-sm text-gray-500 0 font-light ml-2"},J6={class:"text-sm text-gray-500 ml-auto"},Al={__name:"CardProductCheckout",props:["item"],setup(e){var s,r;const t=((r=(s=B.bot)==null?void 0:s.config)==null?void 0:r.ui.logo)||`${B.appDomain}/link.png`,n=R(!1);return(o,i)=>(m(),x("div",q6,[l("div",B6,[n.value?(m(),x("img",{key:0,src:y(t),alt:"image error",class:"w-[28px] h-[28px]"},null,8,U6)):(m(),x("img",{key:1,src:e.item.image,alt:e.item.name,class:"w-full h-full object-contain",onError:i[0]||(i[0]=a=>n.value=!0)},null,40,V6))]),l("div",H6,[l("h3",W6,j(e.item.name),1),l("div",G6,[l("div",null,[l("span",K6,j(y(et)(Number(e.item.price))),1),e.item.compare_at_price>e.item.price?(m(),x("del",Q6,j(y(et)(Number(e.item.compare_at_price))),1)):q("",!0)]),l("div",J6," x"+j(e.item.quantity),1)])])]))}},X6={class:"flex items-center rounded h-[60px]"},Z6=["src","alt"],Y6={key:2,class:"absolute inset-0 bg-primary opacity-10"},e8={key:0,class:"absolute inset-0 bg-primary opacity-10"},t8={class:"flex items-center relative"},n8={class:"font-medium text-sm text-gray-900 flex-1 line-clamp-1"},s8={__name:"CardCouponActive",props:{isActive:{type:Boolean,default:!1},coupon:{type:Object,default:!1},loading:{type:Boolean,default:!1}},emits:["remove","apply",",onViewDetail"],setup(e,{emit:t}){const n=t;return(s,r)=>(m(),x("div",X6,[l("div",{class:te(["p-2 rounded-lg border border-r-0 w-[60px] h-full flex-shrink-0 flex items-center justify-center relative",e.isActive?"border-primary":"border-gray-200"])},[e.coupon.image?(m(),x("img",{key:0,src:e.coupon.image,alt:e.coupon.title,class:"w-full h-full object-cover rounded-lg relative z-10"},null,8,Z6)):(m(),oe(El,{key:1,class:"text-primary scale-125 relative z-10 w-4"})),e.isActive?(m(),x("div",Y6)):q("",!0)],2),l("div",{class:te(["border-r border-dashed h-[48px] flex-shrink-0",e.isActive?"border-primary":"border-gray-200"])},null,2),l("div",{class:te(["flex-1 p-3 border border-l-0 rounded-lg h-full relative overflow-hidden",e.isActive?"border-primary":"border-gray-200"])},[e.isActive?(m(),x("div",e8)):q("",!0),l("div",t8,[l("div",n8,j(e.coupon.title),1),l("button",{class:"w-8 h-8 flex items-center justify-center rounded-md text-primary mr-1 cursor-pointer",onClick:r[0]||(r[0]=o=>n("onViewDetail",e.coupon))},[G(Tl)]),l("button",{onClick:r[1]||(r[1]=o=>n("remove",e.coupon.code)),class:"px-[12px] w-fit py-[6px] text-xs text-white bg-primary rounded-md font-medium flex items-center justify-center ml-auto"},[e.loading?(m(),oe(en,{key:0,class:"w-3 mr-1"})):q("",!0),Be(" Bỏ chọn ")])])],2)]))}},r8={class:"py-4"},o8={class:"mb-2 space-y-3"},i8=l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto"},null,-1),a8={key:0,class:"font-medium text-xl text-center text-gray-900"},l8={key:0,class:"px-5"},c8={class:"max-h-[320px] pt-4 overflow-y-auto scroll-hidden relative"},u8={class:"space-y-5"},d8={class:"pt-3 px-1"},f8={class:"flex items-center justify-between"},h8={class:"text-gray-500 mr-2 text-sm"},p8={class:"text-right text-base"},m8={class:"text-gray-900 text-sm"},g8={key:0,class:"flex items-center justify-between"},v8=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),y8={class:"text-right text-base"},b8={class:"text-green-500 text-sm"},_8={class:"flex items-center justify-between mt-2"},x8=l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),l("span",{class:"text-xs ml-1"},"(Đã bao gồm VAT)")],-1),w8={class:"text-right text-[16px] font-medium"},k8={class:"text-red-500 text-sm"},S8={class:"bg-white z-20 mt-4"},$8={key:1,class:"px-5 pt-4"},C8=l("div",{class:"flex flex-col items-center justify-center space-y-2 py-2"},[l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-500"},[l("circle",{cx:"8",cy:"21",r:"1"}),l("circle",{cx:"19",cy:"21",r:"1"}),l("path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"})]),l("div",{class:"text-lg font-semibold text-gray-700"}," Giỏ hàng trống "),l("div",{class:"text-sm text-gray-700"}," Chưa có sản phẩm nào trong giỏ hàng của bạn. ")],-1),T8=l("div",{class:"mb-5 space-y-3 relative"},[l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto"}),l("div",{class:"font-medium text-xl text-center text-gray-900"}," Xác nhận đơn hàng ")],-1),E8={class:"px-6 space-y-4 max-h-[520px] overflow-y-scroll scroll-hidden"},A8={key:0,class:"border border-gray-200 rounded-xl"},I8={class:"flex items-center justify-between px-3 py-2 border-b"},P8=l("div",{class:"font-semibold text-gray-700"}," Thông tin người nhận ",-1),M8={class:"px-3 py-4"},O8={class:"space-y-1"},R8={class:"text-sm text-gray-700 font-medium"},L8={key:0,class:"text-sm text-gray-700 font-medium"},D8={class:"text-sm text-gray-700"},j8=[l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M8 12h8"}),l("path",{d:"M12 8v8"})],-1),l("div",null,"Thêm địa chỉ",-1)],N8={class:"w-full"},F8=l("label",{for:"order-email",class:"block text-sm font-medium text-gray-700 mb-1 pl-1"}," Email ",-1),z8={class:"w-full"},q8=l("label",{for:"order-notes",class:"block text-sm font-medium text-gray-700 mb-1 pl-1"}," Ghi chú ",-1),B8={class:"border border-gray-200 rounded-xl"},U8=l("div",{class:"flex items-center justify-between px-3 py-2 border-b"},[l("div",{class:"font-semibold text-gray-700"}," Hình thức thanh toán ")],-1),V8={class:"py-4 px-3"},H8={class:"flex space-x-2"},W8=l("div",{class:"text-sm text-gray-600"}," Thanh toán tiền mặt (COD) ",-1),G8={class:"border border-gray-200 rounded-xl"},K8={class:"flex items-center justify-between mb-2.5 px-3 py-2 border-b border-b-gray-200"},Q8=l("div",{class:"flex items-center space-x-1"},[l("div",{class:"font-semibold text-gray-700"}," Tóm tắt đơn hàng ")],-1),J8={class:"space-y-3 pt-1 pb-3 px-3"},X8={key:0,class:"px-3 pb-3 pt-1"},Z8={class:"px-3 pb-3 pt-1"},Y8={class:"flex items-center justify-between"},eE={class:"text-gray-500 mr-2 text-sm"},tE={class:"text-right text-base"},nE={class:"text-gray-700 text-sm"},sE={key:0,class:"flex items-center justify-between"},rE=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),oE={class:"text-right text-base"},iE={class:"text-green-500 text-sm"},aE={class:"flex items-center justify-between"},lE=l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1),cE={class:"text-right text-base"},uE={class:"text-gray-700 text-sm"},dE={class:"flex items-center justify-between mt-2"},fE=l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),Be(" (Đã bao gồm VAT) ")],-1),hE={class:"text-right text-[16px] font-medium"},pE={class:"text-red-500 text-sm"},mE=l("span",{class:"text-sm text-gray-900"},"Khuyến mãi",-1),gE={class:"flex items-center ml-auto"},vE=l("span",{class:"text-sm text-gray-400 tracking-tight"},"Chọn mã",-1),yE=l("span",null,"Đặt mua",-1),bE=l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto"},null,-1),_E={class:"text-[20px] font-semibold text-gray-900 h-12 flex items-center justify-center"},xE={class:"space-y-3 h-[calc(100%-56px)] overflow-y-auto px-6 relative"},wE={key:0,class:"h-full flex flex-col justify-between"},kE={key:0,class:"absolute top-[46%] -translate-y-1/2 right-[3px] z-10"},SE={key:0,class:"absolute top-[46%] -translate-y-1/2 right-[3px] z-10"},$E={class:"flex items-center justify-between bg-white space-x-2 sticky bottom-0 inset-x-0 py-3"},CE={form:"form-submit-new-address",type:"submit",class:"py-[10px] bg-primary text-white rounded-lg flex-1 flex items-center justify-center"},TE=l("span",null,"Lưu thay đổi",-1),EE={key:1,class:"flex flex-col justify-between h-full space-y-3"},AE={class:"space-y-1 px-4 pt-3 pb-2"},IE={class:"flex items-center justify-between"},PE={class:"text-sm"},ME={key:0,class:"text-xs text-green-500"},OE={class:"text-sm"},RE=l("span",{class:"text-gray-500 mr-1"}," Điện thoại: ",-1),LE={class:"text-gray-900"},DE={class:"text-sm"},jE=l("span",{class:"text-gray-500 mr-1"}," Địa chỉ: ",-1),NE={class:"text-gray-900"},FE={class:"border-t px-4 py-2"},zE=["onClick"],qE={class:"flex items-center justify-between bg-white sticky bottom-0 inset-x-0 py-3 space-x-2"},BE={class:"flex flex-col px-4 pb-3 pt-6 bg-white h-full"},UE=l("div",{class:"font-semibold text-gray-900 text-xl text-center mb-4"}," Khuyến mãi ",-1),VE={class:"mb-4"},HE={class:"flex items-center space-x-2"},WE={class:"relative flex-1"},GE=l("span",null,"Áp dụng",-1),KE={key:0,class:"text-xs text-red-500 mt-1"},QE={class:"flex-1 relative"},JE={class:"space-y-4 overflow-y-auto scroll-hidden absolute inset-0 h-full"},XE={class:"sticky bottom-0 z-10 pt-3"},ZE={key:0,class:"px-6 pt-5 pb-4 bg-white rounded-t-2xl"},YE={class:"relative max-h-[520px] overflow-y-scroll scroll-hidden space-y-4"},eA=l("div",{class:"sticky top-0 z-10 bg-white pb-1"},[l("div",{class:"w-9 h-[6px] rounded-full bg-gray-500 mx-auto cursor-grab mb-3"}),l("div",{class:"text-center mt-1 font-medium text-gray-900 text-lg"}," Đặt hàng thành công ")],-1),tA={key:0,class:"rounded-xl border border-gray-200"},nA=l("div",{class:"py-2 px-4 text-base font-medium text-gray-900 border-b border-b-gray-200"}," Thông tin người nhận ",-1),sA={class:"p-4 space-y-2"},rA={class:"flex space-x-3"},oA={key:0,class:"text-sm text-gray-700 w-[120px] flex-shrink-0"},iA={class:"text-sm text-gray-700 font-medium"},aA={key:0,class:"flex space-x-3"},lA=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Số điện thoại ",-1),cA={class:"text-sm text-gray-700 font-medium"},uA={class:"flex space-x-3"},dA=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Địa chỉ nhận hàng ",-1),fA={class:"text-sm text-gray-700 font-medium"},hA={class:"rounded-xl border border-gray-200"},pA=l("div",{class:"py-2 px-4 text-base font-medium text-gray-900 border-b border-b-gray-200"}," Thông tin đơn hàng ",-1),mA={class:"p-4 space-y-2"},gA={class:"flex space-x-3"},vA=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Mã đơn hàng ",-1),yA={class:"text-sm text-gray-700 font-medium"},bA=l("div",{class:"flex space-x-3"},[l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Phương thức thanh toán "),l("div",{class:"text-sm text-gray-700 font-medium"}," Thanh toán tiền mặt khi nhận hàng (COD) ")],-1),_A={key:0,class:"flex space-x-3"},xA=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ghi chú đơn ",-1),wA={class:"text-sm text-gray-700 font-medium"},kA={key:0,class:"font-semibold text-gray-700 mb-3"},SA={key:1,class:"space-y-3 mb-4 border-b border-b-gray-200 pb-4"},$A={class:"flex items-center justify-between"},CA=l("div",{class:"text-gray-500 mr-2 text-sm"}," Tổng tiền hàng ",-1),TA={class:"text-right text-[16px] font-medium"},EA={class:"text-gray-700 text-sm"},AA={key:0,class:"flex items-center justify-between"},IA=l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1),PA={class:"text-right text-base"},MA={class:"text-gray-700 text-sm"},OA={key:1,class:"flex items-center justify-between"},RA=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),LA={class:"text-right text-[16px] font-medium"},DA={class:"text-green-500 text-sm"},jA={class:"flex items-center justify-between mt-2"},NA=l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),Be(" (Đã bao gồm VAT) ")],-1),FA={class:"text-red-500 text-base font-semibold"},zA={class:"sticky bottom-0 pt-2 bg-white"},qA={__name:"FlowCheckout",props:Kr(["chatViewRef"],{open:{},openModifiers:{}}),emits:["update:open"],setup(e){const t=dr(e,"open"),n=R([]),s=R(null),r=R(null),o=R(0),i=R(!1),a=dt({first_name:"",last_name:"",phone:"",note:"",address:"",province_name:"",province_code:"",district_name:"",district_code:"",ward_name:"",ward_code:"",type:"home",is_default:!1,postal_code:""}),c={phone:"required|phone"},u=R(!1),d=R(!1),f=R(""),h=R(""),g=ee(()=>B.user&&!i.value?[{name:"cart",active:o.value===0},{name:"checkout",active:o.value===1},{name:"success",active:o.value===2}]:[{name:"cart",active:o.value===0},{name:"phone",active:o.value===1},{name:"otp",active:o.value===2},{name:"checkout",active:o.value===3},{name:"success",active:o.value===4},{name:"orders",active:o.value===5},{name:"order-detail",active:o.value===6}]);Pe(t,Z=>{o.value=0,Z&&(i.value=!B.user)});const p=R(null),v=R(!1),_=R(!1),k=async()=>{const{data:Z}=await Xe.cart.getList();Z.success&&(B.cart=Z.data)},w=Z=>{if(g.value.length-1===o.value)return;const O=g.value.findIndex(U=>U.name===Z);if(O!==-1){o.value=O;return}o.value=o.value+1},$=Z=>{if(o.value===0)return;const O=g.value.findIndex(U=>U.name===Z);if(O!==-1){o.value=O;return}o.value=o.value-1},E=R(null),P=R(null),I=async()=>{var Z,O,U;try{const ie=ro(B.handle);if(!((Z=B.forms.order)!=null&&Z.id)||!ie)return;const me={male:"Nam",female:"Nữ"},ue=(U=(O=B.cart)==null?void 0:O.items)==null?void 0:U.map(he=>({...he,sku:he.product_sku,title:he.title??he.name})),ge={status:"submitted",conversation_id:ie,submission_data:{title:me[B.user.gender]??"Khác",full_name:s.value.name,phone:s.value.phone,email:s.value.email??h.value,address:`${s.value.address} ${s.value.ward_name}, ${s.value.district_name}, ${s.value.province_name}`,note:f.value,items:ue}};await Xe.submission.add({formId:B.forms.order.id,formData:ge})}catch(ie){console.log(ie)}},M=async()=>{try{if(v.value)return;P.value=null,v.value=!0;const{data:Z}=await Xe.order.checkout({cart_token:B.cart.token,note:f.value,email:h.value,shipping_address_id:s.value.id});Z.success&&(p.value=Z.data,w(),k(),I())}catch{}finally{v.value=!1,h.value="",f.value=""}},L=async()=>{if(!Tt.get(ts))return;const{data:O}=await Xe.address.getList();O.success&&(n.value=O.data||[],s.value=n.value.find(U=>!!U.is_default)??n.value[0])},V=dt({district:!1,ward:!1}),X=R([]),T=R([]),A=R([]),D=async()=>{const{data:Z}=await Xe.location.provinces();Z.success&&Z.data&&(X.value=Object.values(Z.data))},Q=async Z=>{V.district=!0;const{data:O}=await Xe.location.districts(Z);O.success&&O.data&&(T.value=Object.values(O.data)),V.district=!1},W=async Z=>{V.ward=!0;const{data:O}=await Xe.location.wards(Z);O.success&&O.data&&(A.value=Object.values(O.data)),V.ward=!1};Pe(()=>a.province_code,Z=>{var O,U;a.district_code="",T.value=[],a.ward_code="",A.value=[],Z&&(a.province_name=(U=(O=X.value)==null?void 0:O.find(ie=>ie.code.toString()===Z.toString()))==null?void 0:U.name,Q(Z))}),Pe(()=>a.district_code,Z=>{var O;a.ward_code="",A.value=[],Z&&(a.district_name=(O=T.value.find(U=>U.code===Z))==null?void 0:O.name,W(Z))}),Pe(()=>a.ward_code,Z=>{var O;Z&&(a.ward_name=(O=A.value.find(U=>U.code===Z))==null?void 0:O.name)});const H=()=>{for(const Z in a)switch(Z){case"is_default":a[Z]=!0;break;case"type":a[Z]="home";break;default:a[Z]="";break}},K=()=>{d.value=!1,u.value=!1,H()},F=async()=>{try{const Z=Ug(a,c);if(_.value)return;_.value=!0,a.phone=a.phone.toString();const{data:O}=await Xe.address.create(a);O.success&&(s.value=O.data,n.value.push(O.data),d.value=!1,u.value=!1,H())}catch(Z){console.log("error: ",Z)}finally{_.value=!1}},ne=async(Z={})=>{try{if(Object.keys(Z).length===0)return;const{province_code:O,province_name:U,district_code:ie,district_name:me,ward_code:ue,ward_name:ge,name:he,phone:Te,email:De,address:Le}=Z,Ae={name:he??"",phone:Te??"",email:De??"",address1:Le,province:U,province_code:O,district:me,district_code:ie,ward:ge,ward_code:ue},{data:We}=await Xe.order.checkShipping({address:Ae});We.success&&(B.cart=We.data)}catch{}};Pe(s,Z=>{Z&&ne(Z)},{immediate:!0});const fe=Z=>{w(),E.value=Z.form.identifier},_e=Z=>{w(),L(),k()},we=R("");R("");const je=R(!1),re=R(!1),pe=R(null),de=R([]),Ce=R(!1),Re=dt({}),Oe=ee(()=>{var Z,O;return(O=(Z=B.cart)==null?void 0:Z.coupon)==null?void 0:O.code}),Me=ee(()=>de.value.find(Z=>Z.code===Oe.value)),He=async()=>{const{data:Z}=await Xe.cart.coupons();Z.success&&(de.value=Z.data)},N=async(Z,O="card")=>{const U=O==="text"?"text":Z;try{if(!Z||Re[U])return;Re[U]=!0,Ce.value=!1,re.value=!1;const{data:ie}=await Xe.cart.applyCoupon({code:Z});ie.data&&(B.cart=ie.data),ie.success?O==="text"&&(Ce.value=!1):Ce.value=!0}catch(ie){console.log("Error coupon: ",ie)}finally{Re[U]=!1,we.value=""}},Y=async Z=>{try{if(!Z||Re[Z])return;Re[Z]=!0,Ce.value=!1,re.value=!1;const{data:O}=await Xe.cart.removeCoupon({code:Z});console.log("removeCoupon = ",O),O.data&&(B.cart=O.data)}catch(O){console.log("Error coupon: ",O)}finally{Re[Z]=!1,we.value=""}};return Pe(()=>B.user,Z=>{Z?(L(),He(),D()):(n.value=[],s.value=null)},{immediate:!0}),(Z,O)=>(m(),oe(Hg,{chatViewRef:e.chatViewRef,open:t.value,"onUpdate:open":O[41]||(O[41]=U=>t.value=U),slotNames:g.value,isNestedOpen:u.value||je.value||re.value},{cart:Se(()=>{var U,ie,me,ue;return[l("div",r8,[l("div",o8,[i8,((ie=(U=y(B).cart)==null?void 0:U.items)==null?void 0:ie.length)>0?(m(),x("div",a8," Giỏ hàng ")):q("",!0)]),((ue=(me=y(B).cart)==null?void 0:me.items)==null?void 0:ue.length)>0?(m(),x("div",l8,[l("div",c8,[l("div",u8,[(m(!0),x(be,null,Ie(y(B).cart.items,(ge,he)=>(m(),oe($T,{key:he,item:ge},null,8,["item"]))),128))])]),l("div",d8,[l("div",f8,[l("div",h8,j(y(B).cart.total_items)+" sản phẩm ",1),l("div",p8,[l("div",m8,j(y(et)(y(B).cart.subtotal_price)),1)])]),y(B).cart.total_discounts?(m(),x("div",g8,[v8,l("div",y8,[l("div",b8,j(y(et)(y(B).cart.total_discounts)),1)])])):q("",!0),l("div",_8,[x8,l("div",w8,[l("div",k8,j(y(et)(y(B).cart.total_price-(y(B).cart.shipping_price||0))),1)])])]),l("div",S8,[l("div",null,[l("button",{onClick:O[0]||(O[0]=ge=>(w(),y(B).user&&ne())),class:te(["flex items-center justify-center h-12 border w-full rounded-xl text-base ","bg-primary text-white hover:opacity-80 font-medium"])}," Đặt hàng ")])])])):(m(),x("div",$8,[C8,l("button",{onClick:O[1]||(O[1]=ge=>t.value=!1),class:te(["flex items-center justify-center h-12 border w-full rounded-lg text-base mt-3","bg-primary text-white hover:opacity-80 font-medium"])}," Tiếp tục mua sắm ")]))])]}),phone:Se(()=>[G(Gg,{onSuccess:O[2]||(O[2]=U=>fe(U))})]),otp:Se(()=>[G(Kg,{onSuccess:O[3]||(O[3]=U=>_e(U)),identifier:E.value},null,8,["identifier"])]),checkout:Se(()=>[l("div",{ref_key:"checkoutRef",ref:r,class:"py-4 relative"},[T8,l("button",{onClick:O[4]||(O[4]=U=>$("cart")),class:"size-10 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-900 absolute left-4 top-5"},[G(Wg)]),l("div",E8,[s.value?(m(),x("div",A8,[l("div",I8,[P8,l("button",{onClick:O[5]||(O[5]=U=>u.value=!0),class:"text-sm px-2 py-1 bg-gray-50 hover:bg-gray-100 rounded-md text-gray-500"}," Thay đổi ")]),l("div",M8,[l("div",O8,[l("div",R8,[l("div",null,j((s.value.first_name?`${s.value.first_name} `:"")+(s.value.last_name?s.value.last_name:"")),1)]),s.value.phone?(m(),x("div",L8,[l("div",null,j(s.value.phone),1)])):q("",!0),l("div",D8,[l("div",null,j(`${s.value.address} ${s.value.ward_name}, ${s.value.district_name}, ${s.value.province_name}`),1)])])])])):(m(),x("div",{key:1,onClick:O[6]||(O[6]=U=>(u.value=!0,d.value=!0)),class:"h-[70px] border border-dashed border-gray-300 flex items-center justify-center rounded-xl text-gray-700 cursor-pointer hover:bg-gray-50"},j8)),l("div",N8,[F8,G(os,{modelValue:h.value,"onUpdate:modelValue":O[7]||(O[7]=U=>h.value=U),field:{id:"order-email",name:"email",type:"email",label:"Email"}},null,8,["modelValue"])]),l("div",z8,[q8,Rt(l("textarea",{id:"order-notes","onUpdate:modelValue":O[8]||(O[8]=U=>f.value=U),placeholder:"Nhập ghi chú cho đơn hàng",rows:"2",class:"w-full text-sm rounded-lg border border-gray-200 p-3 text-gray-700 focus:outline-none resize-none"},null,512),[[on,f.value]])]),l("div",B8,[U8,l("div",V8,[l("div",H8,[G(y(k2),{size:"18"}),W8])])]),l("div",G8,[l("div",null,[l("div",K8,[Q8,l("button",{onClick:O[9]||(O[9]=U=>$("cart")),class:"text-sm px-2 py-1 bg-gray-100 hover:bg-gray-200 rounded-md text-gray-500"}," Thay đổi ")]),l("div",J8,[(m(!0),x(be,null,Ie(y(B).cart.items,U=>(m(),oe(Al,{key:U.product_sku,item:U},null,8,["item"]))),128))])]),Me.value?(m(),x("div",X8,[G(s8,{coupon:Me.value,"is-active":!0,onOnViewDetail:O[10]||(O[10]=U=>(re.value=!0,pe.value=U)),onRemove:O[11]||(O[11]=U=>Y(U)),loading:Re[Me.value.code]},null,8,["coupon","loading"])])):q("",!0),l("div",Z8,[l("div",Y8,[l("div",eE,j(y(B).cart.total_items)+" sản phẩm ",1),l("div",tE,[l("div",nE,j(y(et)(y(B).cart.subtotal_price)),1)])]),y(B).cart.total_discounts?(m(),x("div",sE,[rE,l("div",oE,[l("div",iE,j(y(et)(y(B).cart.total_discounts)),1)])])):q("",!0),l("div",aE,[lE,l("div",cE,[l("div",uE,j(y(et)(y(B).cart.shipping_price)),1)])]),l("div",dE,[fE,l("div",hE,[l("div",pE,j(y(et)(y(B).cart.total_price)),1)])])])]),l("div",{class:te(["sticky bottom-0 bg-white border-t border-t-gray-100 z-10",de.value&&de.value.length>0?"pt-0":"pt-4"])},[de.value&&de.value.length>0?(m(),x("div",{key:0,onClick:O[12]||(O[12]=U=>je.value=!0),class:"flex items-center px-1 py-2.5 cursor-pointer"},[G(El,{class:"mr-1 text-primary"}),mE,l("div",gE,[vE,G(vg,{class:"text-gray-400 w-4"})])])):q("",!0),l("button",{onClick:O[13]||(O[13]=U=>M()),class:te(["flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium",v.value&&"opacity-80"])},[v.value?(m(),oe(en,{key:0,class:"w-[16px] h-[16px] mr-2"})):q("",!0),yE],2)],2)])],512),G(y(id),{key:"DrawerRootNested-Address",open:u.value,"onUpdate:open":O[25]||(O[25]=U=>u.value=U),modal:!1},{default:Se(()=>[G(y(er),{to:e.chatViewRef},{default:Se(()=>[l("div",{onClick:O[14]||(O[14]=U=>u.value=!1),class:te(["drawer-overlay-custom !z-50",{"drawer-overlay-custom--open":u.value}])},null,2),G(y(nr),{class:"bg-white pt-4 flex flex-col rounded-t-3xl absolute bottom-0 left-0 right-0 outline-none z-50 overflow-hidden h-[540px]"},{default:Se(()=>[bE,l("div",_E,j(d.value?"Thêm địa chỉ":" Sổ địa chỉ "),1),l("div",xE,[d.value?(m(),x("div",wE,[l("form",{id:"form-submit-new-address",onSubmit:O[21]||(O[21]=Gt(U=>F(),["prevent"])),class:"space-y-[18px]"},[G(os,{modelValue:a.last_name,"onUpdate:modelValue":O[15]||(O[15]=U=>a.last_name=U),field:{name:"last_name",type:"text",label:"Họ và tên",validate:"required"}},null,8,["modelValue"]),G(os,{modelValue:a.phone,"onUpdate:modelValue":O[16]||(O[16]=U=>a.phone=U),field:{name:"phone",type:"number",label:"Số điện thoại",validate:"required"}},null,8,["modelValue"]),G(os,{modelValue:a.province_code,"onUpdate:modelValue":O[17]||(O[17]=U=>a.province_code=U),field:{name:"province_code",type:"select",label:"Tỉnh/Thành phố",validate:"required",keyValue:"code",keyLabel:"name",options:X.value}},null,8,["modelValue","field"]),l("div",{class:te(["relative",V.district&&"pointer-events-none opacity-80 bg-gray-50"])},[G(os,{classField:V.district&&"loading",modelValue:a.district_code,"onUpdate:modelValue":O[18]||(O[18]=U=>a.district_code=U),field:{name:"district_code",type:"select",label:"Quận/Huyện",validate:"required",keyValue:"code",keyLabel:"name",options:T.value}},null,8,["classField","modelValue","field"]),V.district?(m(),x("div",kE,[G(en,{color:"text-gray-700",class:"w-[14px] h-[14px]"})])):q("",!0)],2),l("div",{class:te(["relative",V.ward&&"pointer-events-none opacity-80 bg-gray-50"])},[G(os,{classField:V.ward&&"loading",modelValue:a.ward_code,"onUpdate:modelValue":O[19]||(O[19]=U=>a.ward_code=U),field:{name:"ward_code",type:"select",label:"Phường/Xã",validate:"required",keyValue:"code",keyLabel:"name",options:A.value}},null,8,["classField","modelValue","field"]),V.ward?(m(),x("div",SE,[G(en,{color:"text-gray-700",class:"w-[14px] h-[14px]"})])):q("",!0)],2),G(os,{modelValue:a.address,"onUpdate:modelValue":O[20]||(O[20]=U=>a.address=U),field:{name:"address",type:"textarea",label:"Địa chỉ",validate:"required",rows:2}},null,8,["modelValue"])],32),l("div",$E,[l("button",{onClick:O[22]||(O[22]=U=>K()),class:"py-[10px] bg-gray-100 hover:bg-gray-200 rounded-lg flex-1"}," Quay lại "),l("button",CE,[_.value?(m(),oe(en,{key:0,class:"mr-1 w-4 h-4"})):q("",!0),TE])])])):(m(),x("div",EE,[(m(!0),x(be,null,Ie(n.value,U=>{var ie,me;return m(),x("div",{key:U.id,class:"border border-gray-200 rounded-xl bg-white"},[l("div",AE,[l("div",IE,[l("div",PE,j(U.first_name?`${U.first_name} `:"")+" "+j(U.last_name?U.last_name:""),1),U.is_default?(m(),x("div",ME," Mặc định ")):q("",!0)]),l("div",OE,[RE,l("span",LE,j(U.phone),1)]),l("div",DE,[jE,l("span",NE,j(`${U.address} ${U.ward_name}, ${U.district_name}, ${U.province_name}`),1)])]),l("div",FE,[l("button",{onClick:ue=>(s.value=U,u.value=!1),class:te(["px-3 py-2 rounded-xl text-sm",((ie=s.value)==null?void 0:ie.id)===U.id?"bg-primary text-white cursor-default":"hover:bg-gray-50 text-gray-500 border border-gray-200 "])},j(((me=s.value)==null?void 0:me.id)===U.id?"Đang sử dụng":"Giao đến địa chỉ này"),11,zE)])])}),128)),l("div",qE,[l("button",{class:"px-3 py-[10px] bg-gray-100 rounded-lg flex-1",onClick:O[23]||(O[23]=U=>u.value=!1)}," Quay lại "),l("button",{onClick:O[24]||(O[24]=U=>d.value=!0),class:"px-3 py-[10px] bg-primary text-white rounded-lg flex-1"}," Thêm mới ")])]))])]),_:1})]),_:1},8,["to"])]),_:1},8,["open"]),G(y(id),{open:je.value,"onUpdate:open":O[35]||(O[35]=U=>je.value=U),modal:!1},{default:Se(()=>[G(y(er),{to:e.chatViewRef},{default:Se(()=>[l("div",{onClick:O[26]||(O[26]=U=>je.value=!1),class:te(["drawer-overlay-custom",{"drawer-overlay-custom--open":je.value}])},null,2),G(y(nr),{class:"absolute bottom-0 left-0 right-0 outline-none z-[50] overflow-hidden h-full"},{default:Se(()=>[l("div",BE,[l("button",{onClick:O[27]||(O[27]=U=>je.value=!1),class:"size-10 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-900 absolute right-[12px] top-[14px]"},[G(go)]),UE,l("div",VE,[l("div",HE,[l("div",WE,[Rt(l("input",{type:"text","onUpdate:modelValue":O[28]||(O[28]=U=>we.value=U),placeholder:"Nhập mã khuyến mãi",class:"block w-full h-10 border border-gray-200 rounded-lg text-base pr-6 pl-10 focus:outline-none"},null,512),[[on,we.value]]),G(El,{class:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),we.value?(m(),x("button",{key:0,onClick:O[29]||(O[29]=U=>we.value=""),class:"absolute right-2 top-1/2 -translate-y-1/2 z-10 w-4 h-4 flex items-center justify-center bg-gray-400 rounded-full cursor-pointer"},[G(go,{class:"w-3 text-white"})])):q("",!0)]),l("button",{onClick:O[30]||(O[30]=U=>N(we.value,"text")),class:te([[we.value?"bg-primary text-white":"bg-gray-100 text-gray-300 border border-gray-200 cursor-not-allowed",Re[we.value]&&"opacity-60 cursor-not-allowed"],"h-10 text-sm font-medium rounded-lg hover:opacity-80 px-4 flex items-center"])},[Re.text?(m(),oe(en,{key:0,class:"w-4 mr-1"})):q("",!0),GE],2)]),Ce.value?(m(),x("div",KE," Mã không hợp lệ hoặc bạn không nằm trong chương trình áp dụng ! ")):q("",!0)]),l("div",QE,[l("div",JE,[(m(!0),x(be,null,Ie(de.value,U=>(m(),oe(v6,{key:U.id,coupon:U,loading:Re[U.code],"is-active":U.code===Oe.value,onOnViewDetail:O[31]||(O[31]=ie=>(re.value=!0,pe.value=ie)),onRemove:O[32]||(O[32]=ie=>Y(ie)),onApply:O[33]||(O[33]=ie=>N(ie))},null,8,["coupon","loading","is-active"]))),128))])]),l("div",XE,[l("button",{onClick:O[34]||(O[34]=U=>je.value=!1),class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium"}," Xong ")])])]),_:1})]),_:1},8,["to"])]),_:1},8,["open"]),G(y(id),{open:re.value,"onUpdate:open":O[39]||(O[39]=U=>re.value=U),modal:!1},{default:Se(()=>[G(y(er),{to:e.chatViewRef},{default:Se(()=>[l("div",{onClick:O[36]||(O[36]=U=>re.value=!1),class:te(["drawer-overlay-custom !z-50",{"drawer-overlay-custom--open":re.value}])},null,2),G(y(nr),{class:"absolute bottom-0 left-0 right-0 outline-none z-[50] overflow-hidden h-fit"},{default:Se(()=>[G(z6,{coupon:pe.value,active:pe.value&&pe.value.code===Oe.value,onRemove:O[37]||(O[37]=U=>Y(U)),onApply:O[38]||(O[38]=U=>N(U))},null,8,["coupon","active"])]),_:1})]),_:1},8,["to"])]),_:1},8,["open"])]),success:Se(()=>{var U,ie,me,ue;return[p.value?(m(),x("div",ZE,[l("div",YE,[eA,p.value.shipping_address?(m(),x("div",tA,[nA,l("div",sA,[l("div",rA,[(U=p.value.shipping_address)!=null&&U.name||(ie=s.value)!=null&&ie.last_name?(m(),x("div",oA," Họ và tên ")):q("",!0),l("div",iA,j(p.value.shipping_address.name??((me=s.value)==null?void 0:me.last_name)),1)]),(ue=p.value.shipping_address)!=null&&ue.phone?(m(),x("div",aA,[lA,l("div",cA,j(p.value.shipping_address.phone),1)])):q("",!0),l("div",uA,[dA,l("div",fA,j(p.value.shipping_address.address1),1)])])])):q("",!0),l("div",hA,[pA,l("div",mA,[l("div",gA,[vA,l("div",yA," #"+j(p.value.order_number),1)]),bA,p.value.note?(m(),x("div",_A,[xA,l("div",wA,j(p.value.note),1)])):q("",!0)])]),l("div",null,[p.value.items&&p.value.items.length>0?(m(),x("div",kA," Sản phẩm đã đặt ")):q("",!0),p.value.items&&p.value.items.length>0?(m(),x("div",SA,[(m(!0),x(be,null,Ie(p.value.items,ge=>(m(),oe(Al,{key:ge.product_sku,item:ge},null,8,["item"]))),128))])):q("",!0),l("div",null,[l("div",$A,[CA,l("div",TA,[l("div",EA,j(y(et)(p.value.subtotal_price)),1)])]),p.value.shipping_price?(m(),x("div",AA,[IA,l("div",PA,[l("div",MA,j(y(et)(p.value.shipping_price)),1)])])):q("",!0),p.value.total_discounts?(m(),x("div",OA,[RA,l("div",LA,[l("div",DA,j(y(et)(p.value.total_discounts)),1)])])):q("",!0),l("div",jA,[NA,l("div",FA,j(y(et)(p.value.total_price)),1)])])])]),l("div",zA,[l("button",{onClick:O[40]||(O[40]=ge=>t.value=!1),class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium"}," Tiếp tục mua sắm ")])])):q("",!0)]}),_:1},8,["chatViewRef","open","slotNames","isNestedOpen"]))}},BA=["src"],UA={__name:"ChatBanner",props:{banners:{type:Array,default:()=>[]}},emits:["close"],setup(e,{emit:t}){const n="https://widget.geteasy.ai",s=e,r=t,o=R(!0),i=R(null),a=()=>{var u;((u=i.value)==null?void 0:u.offsetWidth)<480?o.value=!0:o.value=!1},c=ee(()=>s.banners.filter(u=>u.image_url));return Qe(()=>{n!==window.location.origin&&a()}),(u,d)=>c.value.length>0?(m(),x("div",{key:0,ref_key:"chatBannerRef",ref:i,class:te(["chat-banners",o.value?"block":"hidden"])},[G(Ti,{autoplay:!0,pagination:!0},{default:Se(()=>[(m(!0),x(be,null,Ie(c.value,(f,h)=>(m(),oe(pl,{key:h,class:"w-full h-[150px]"},{default:Se(()=>[(m(),oe(Nt(f.link?"a":"div"),{href:f.link,target:"_blank",class:"block w-full h-full"},{default:Se(()=>[l("img",{src:f.image_url,alt:"ecg-banner",class:"object-cover w-full h-full"},null,8,BA)]),_:2},1032,["href"]))]),_:2},1024))),128))]),_:1}),l("button",{onClick:d[0]||(d[0]=f=>r("close")),class:"close-banner-btn"},[G(go,{class:"w-3"})])],2)):q("",!0)}},VA={class:"relative bg-white mx-auto mt-3 mb-2 w-fit max-w-[300px]"},HA={class:"flex justify-end items-end flex-col gap-1"},WA={class:"flex-shrink-0 px-1.5 py-0.5 text-blue-500 bg-blue-50 w-fit rounded-xl flex items-center gap-1"},GA=l("span",{class:"text-xs"},"Tin nhắn thoại",-1),KA={class:"text-sm text-white px-4 py-2.5 bg-primary rounded-xl"},QA={__name:"ChatVoiceCardUser",props:{messageText:{type:String,default:""}},setup(e){return(t,n)=>(m(),x("div",VA,[l("div",HA,[l("div",WA,[G(y(Zm),{size:"14"}),GA]),l("div",KA,j(e.messageText),1)])]))}},JA={viewBox:"0 0 24 24"},XA=["id"],ZA=["stop-color"],YA=["stop-color"],e9=["fill"],t9={__name:"IconAI",props:{fromColor:{type:String,default:"#2a83e9"},toColor:{type:String,default:"#0ea5e9"},id:{type:String,default:""}},setup(e){const t=e,n=ee(()=>t.id||`star-gradient-${Math.random().toString(36).substring(2,9)}`);return(s,r)=>(m(),x("svg",JA,[l("defs",null,[l("linearGradient",{id:n.value,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},[l("stop",{offset:"0%","stop-color":e.fromColor},null,8,ZA),l("stop",{offset:"100%","stop-color":e.toColor},null,8,YA)],8,XA)]),l("path",{fill:`url(#${n.value})`,"fill-rule":"evenodd",d:"M9 4.5a.75.75 0 01.721.544l.813 2.846a3.75 3.75 0 002.576 2.576l2.846.813a.75.75 0 010 1.442l-2.846.813a3.75 3.75 0 00-2.576 2.576l-.813 2.846a.75.75 0 01-1.442 0l-.813-2.846a3.75 3.75 0 00-2.576-2.576l-2.846-.813a.75.75 0 010-1.442l2.846-.813A3.75 3.75 0 007.466 7.89l.813-2.846A.75.75 0 019 4.5zM18 1.5a.75.75 0 01.728.568l.258 1.036c.236.94.97 1.674 1.91 1.91l1.036.258a.75.75 0 010 1.456l-1.036.258c-.94.236-1.674.97-1.91 1.91l-.258 1.036a.75.75 0 01-1.456 0l-.258-1.036a2.625 2.625 0 00-1.91-1.91l-1.036-.258a.75.75 0 010-1.456l1.036-.258a2.625 2.625 0 001.91-1.91l.258-1.036A.75.75 0 0118 1.5zM16.5 15a.75.75 0 01.712.513l.394 1.183c.15.447.5.799.948.948l1.183.395a.75.75 0 010 1.422l-1.183.395c-.447.15-.799.5-.948.948l-.395 1.183a.75.75 0 01-1.422 0l-.395-1.183a1.5 1.5 0 00-.948-.948l-1.183-.395a.75.75 0 010-1.422l1.183-.395c.447-.15.799-.5.948-.948l.395-1.183A.75.75 0 0116.5 15z","clip-rule":"evenodd"},null,8,e9)]))}},n9={class:"shine-wrapper max-h-[18px]"},s9={class:"inline-flex items-center shine-effect"},Pi=Ke({__name:"AITitle",props:{title:{type:String,default:"AI đề xuất"},size:{type:String,default:"sm"}},setup(e){const t=e,n=ee(()=>{switch(t.size){case"sm":return"text-xs";case"md":return"text-sm";case"lg":return"text-base";default:return"text-xs"}});return(s,r)=>(m(),x("div",n9,[l("div",s9,[G(t9,{class:te(["mr-1",[e.size==="lg"?"w-6":e.size==="md"?"w-[18px]":"w-4"]]),style:{"max-width":"24px"}},null,8,["class"]),l("div",{class:te([n.value,"font-semibold leading-[120%]"]),style:{background:"linear-gradient(to right, #2a83e9, #0ea5e9)","background-clip":"text","-webkit-background-clip":"text","-webkit-text-fill-color":"transparent"}},j(e.title),3)])]))}},[["__scopeId","data-v-9bdf7947"]]),r9={class:"ai-suggestion-wrapper"},o9={key:0,class:"ai-suggestion-container pb-1 pt-2 pl-4 pr-[10px] border-t border-gray-50 shadow-[0_-2px_4px_-1px_rgba(0,0,0,0.05)] rounded-t-xl bg-white",style:{"will-change":"max-height, opacity"}},i9=["title"],a9={key:0,class:"w-[48px] max-h-[48px] h-auto rounded overflow-hidden mr-2 flex-shrink-0"},l9=["src","alt"],c9={key:1,class:"size-[48px] flex items-center justify-center"},u9=["src","alt"],d9={class:"relative flex-1"},f9={class:"text-sm leading-[140%] line-clamp-2 text-gray-900"},h9={key:0,class:"flex flex-wrap"},p9=["onClick","innerHTML"],m9="ecg-quick-replies",g9=Ke({__name:"WidgetFeatureAIProductInsight",props:{widget:{type:Object,default:()=>({})}},emits:["sendMessage"],setup(e,{expose:t,emit:n}){var A,D,Q,W;const s=e,r=n,{bot:o,handle:i}=At(ae.state),a=(D=(A=o.value.config)==null?void 0:A.ui)==null?void 0:D.logo,c=(W=(Q=o.value.config)==null?void 0:Q.ui)==null?void 0:W.name,u=R(null),d=R(null),f=R(null),h=R(!1),g=R(!1),p=R([]),v=R(!1),_=R(null),k=(H,K=[],F)=>{var _e;const ne=((_e=s.widget)==null?void 0:_e.dynamic_prompts)??to[i.value]??to.default;let fe=um(ne,{title:H,logo:a,brand:c})[F];return K.length>0&&fe.length>K.length?K.map(we=>fe.find(je=>je.id===we)).filter(Boolean):fe},w=()=>{let H=Tt.get(m9);return(!H||H==="undefined")&&(H={}),H},$=()=>{const H=w(),K=yx(f.value.name);return H[K]??[]},E=H=>{Ar().send({message:H.message}),p.value=p.value.filter(K=>K.id!==H.id),p.value.length===0&&(h.value=!1),r("sendMessage",H.message)},P=()=>{var K;const H=((K=f.value.image)==null?void 0:K.contentUrl)??f.value.image;return Array.isArray(H)?H[0]:H},I=({selector:H,position:K,widget:F,style:ne}={})=>{u.value&&(u.value.remove(),u.value=null),typeof window<"u"&&window.EAC&&!u.value?u.value=window.EAC.injectWidget(H,F,{position:K,style:ne}):u.value=vi(H,F,{position:K,style:ne})},M=({selector:H,position:K,widget:F,style:ne,props:fe}={})=>{d.value&&(d.value.remove(),d.value=null),typeof window<"u"&&window.EAC&&!d.value?d.value=window.EAC.injectWidget(H,F,{position:K,style:ne,props:fe}):d.value=vi(H,F,{position:K,style:ne,props:fe})},L=()=>{const H=ss("Product");if(!H)return;let K=H.sku?"product":"category";if(i.value===xr&&(K="product"),K==="product"&&i.value===Mn&&(I({selector:".gallery-product",position:"bottom",widget:s.widget,style:{margin:"12px 0",borderRadius:"12px",border:"1px solid #e5e7eb",padding:"12px",overflow:"hidden"}}),M({selector:"[data-target='panel-main-item']",position:"before",widget:{type:"ai_summary_page_content"},style:{margin:"16px 0"},props:{isShowHighlight:!1}})),K==="product"&&i.value===xr){const F=Ts()?{selector:"#form1 a#ca",position:"before",widget:s.widget,style:{width:"98%",margin:"0 auto",margin:"12px 0",border:"1px solid #e5e7eb",padding:"12px"}}:{selector:"#form1 ul.tu",position:"before",widget:s.widget,style:{width:"100%",maxWidth:"824px",marginBottom:"12px",border:"1px solid #e5e7eb",padding:"12px"}};I(F)}},V=()=>{f.value=ss("Product");const H=Cs();if(f.value){i.value===xr&&(f.value.name=H.title);const K=$();_.value=P()??hs();let F=f.value.sku?"product":"category";i.value===xr&&(F="product"),p.value=k(f.value.name,K,F),setTimeout(()=>{h.value=!0},200)}else{const K=vx({handle:i.value});if(K){f.value={name:H.title};const F=$();_.value=hs();const ne=K==="product"?"product":"category";p.value=k(f.value.name,F,ne),setTimeout(()=>{h.value=!0},200)}}},X=()=>{p.value=[],h.value=!1,f.value=null,v.value=!1,_.value=null,u.value&&(u.value.remove(),u.value=null)},T=()=>{h.value=!h.value,h.value?g.value=!1:(g.value=!1,setTimeout(()=>{g.value=!0},200))};return Qe(()=>{hi(()=>{Ra.SPA.includes(i.value)&&X(),setTimeout(()=>{V(),Ra.SPA.includes(i.value)&&L()},1500),u.value&&Ra.SPA.includes(i.value)&&(u.value.remove(),u.value=null)},!0),Ra.SSR.includes(i.value)&&L()}),t({tags:p,showToggleButton:g}),(H,K)=>(m(),x("div",r9,[G(Yt,{name:"expand-ai-suggestion"},{default:Se(()=>[f.value&&h.value?(m(),x("div",o9,[l("div",{title:f.value.name,class:"flex items-start"},[_.value&&!v.value?(m(),x("div",a9,[l("img",{src:_.value,alt:f.value.name,onError:K[0]||(K[0]=()=>{v.value=!0}),class:"object-contain w-full h-full"},null,40,l9)])):(m(),x("div",c9,[l("img",{src:y(a),alt:y(c),class:"w-[24px] h-[24px] object-cover rounded-full overflow-hidden"},null,8,u9)])),l("div",d9,[G(Pi,{title:"AI đề xuất",class:"mb-1"}),l("div",f9,j(f.value.name),1)]),l("button",{onClick:T,class:"flex-shrink-0 p-1 ml-2 text-gray-500 transition-colors hover:text-gray-700"},[G(y(uo),{class:"w-4 h-4"})])],8,i9),p.value.length>0?(m(),x("div",h9,[(m(!0),x(be,null,Ie(p.value,F=>(m(),x("button",{key:F.name,onClick:ne=>E(F),class:"prose suggestion-tag",innerHTML:F.name},null,8,p9))),128))])):q("",!0)])):q("",!0)]),_:1}),f.value&&!h.value&&g.value?(m(),x("button",{key:0,onClick:K[1]||(K[1]=F=>T()),class:"flex absolute bottom-0 right-3 z-30 ml-auto gap-1 items-center py-2 px-3 bg-white rounded-3xl rounded-br-md border border-blue-200 hover:bg-blue-50 cursor-pointer ai-suggestion-toggle"},[G(Pi,{title:"AI đề xuất"})])):q("",!0)]))}},[["__scopeId","data-v-36a6a2b9"]]),v9={class:"relative py-4 bg-white rounded-t-2xl overflow-hidden outline-none"},y9=l("div",{class:"relative text-center mb-2"},[l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto mb-2"}),l("div",{class:"font-semibold text-gray-700 text-lg"}," Thông tin cá nhân ")],-1),b9={class:"px-3 divide-y divide-gray-100"},_9={class:"flex px-4 py-3"},x9=l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-500 mr-3"},[l("circle",{cx:"12",cy:"8",r:"5"}),l("path",{d:"M20 21a8 8 0 0 0-16 0"})],-1),w9=l("div",{class:"text-sm text-gray-400"},"Họ và tên",-1),k9={class:"text-base text-gray-700"},S9={class:"flex px-4 py-3"},$9=ma('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-gray-500 mr-3"><path d="M8 2v4"></path><path d="M16 2v4"></path><rect width="18" height="18" x="3" y="4" rx="2"></rect><path d="M3 10h18"></path></svg>',1),C9=l("div",{class:"text-sm text-gray-400"},"Ngày sinh",-1),T9={class:"text-base text-gray-700"},E9={class:"flex px-4 py-3"},A9=ma('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="text-gray-500 mr-3 scale-125"><g clip-path="url(#clip0_2871_105064)"><path d="M16.8719 1.81324C16.871 1.80435 16.8693 1.79573 16.8681 1.78696C16.8665 1.77555 16.8651 1.76411 16.8629 1.75278C16.8608 1.74255 16.858 1.7326 16.8555 1.72253C16.8531 1.71284 16.8509 1.70311 16.848 1.6935C16.845 1.68362 16.8413 1.67408 16.8378 1.66439C16.8344 1.65482 16.8313 1.64516 16.8274 1.63574C16.8236 1.62674 16.8192 1.61812 16.8151 1.60931C16.8105 1.59962 16.8062 1.58985 16.8011 1.58035C16.7966 1.57192 16.7915 1.56395 16.7866 1.55575C16.781 1.54644 16.7758 1.53698 16.7697 1.5279C16.7637 1.51905 16.7571 1.5107 16.7508 1.50219C16.7449 1.49437 16.7395 1.48636 16.7332 1.47873C16.7214 1.46427 16.7087 1.45046 16.6956 1.43711C16.6943 1.43578 16.6932 1.43433 16.6919 1.43303C16.6904 1.4315 16.6887 1.43028 16.6872 1.42876C16.6741 1.41587 16.6605 1.40343 16.6462 1.39172C16.6388 1.38565 16.6311 1.38039 16.6235 1.37474C16.6147 1.36818 16.6061 1.36139 16.597 1.35529C16.5882 1.34941 16.5791 1.3443 16.5701 1.33892C16.5616 1.33385 16.5533 1.32851 16.5445 1.32378C16.5355 1.31897 16.5263 1.31493 16.5171 1.31058C16.5078 1.30615 16.4985 1.3015 16.489 1.29753C16.4803 1.29395 16.4715 1.29109 16.4627 1.28792C16.4522 1.28411 16.4418 1.28014 16.4311 1.27686C16.4226 1.27434 16.414 1.27247 16.4055 1.2703C16.3943 1.26744 16.3832 1.26431 16.3718 1.26206C16.3623 1.26019 16.3528 1.25916 16.3433 1.25771C16.3326 1.25611 16.3221 1.25416 16.3113 1.25309C16.2955 1.25157 16.2797 1.25107 16.2638 1.25069C16.2592 1.25061 16.2547 1.25 16.25 1.25H13.125C12.9592 1.25 12.8003 1.31585 12.6831 1.43306C12.5658 1.55027 12.5 1.70924 12.5 1.875C12.5 2.04076 12.5658 2.19973 12.6831 2.31694C12.8003 2.43415 12.9592 2.5 13.125 2.5H14.7411L12.8322 4.40887C12.2025 3.86831 11.455 3.48283 10.6494 3.28336C9.84389 3.0839 9.00282 3.07599 8.19368 3.26028C7.38453 3.44458 6.62984 3.81593 5.99014 4.34457C5.35043 4.8732 4.84352 5.54441 4.51007 6.30433C4.17662 7.06426 4.0259 7.89175 4.07001 8.72045C4.11412 9.54914 4.35183 10.356 4.76407 11.0762C5.1763 11.7964 5.7516 12.41 6.44381 12.8678C7.13601 13.3255 7.92586 13.6147 8.75 13.712V15.3125H6.875C6.70924 15.3125 6.55027 15.3783 6.43306 15.4956C6.31585 15.6128 6.25 15.7717 6.25 15.9375C6.25 16.1033 6.31585 16.2622 6.43306 16.3794C6.55027 16.4967 6.70924 16.5625 6.875 16.5625H8.75V18.125C8.75 18.2908 8.81585 18.4497 8.93306 18.5669C9.05027 18.6842 9.20924 18.75 9.375 18.75C9.54076 18.75 9.69973 18.6842 9.81694 18.5669C9.93415 18.4497 10 18.2908 10 18.125V16.5625H11.875C12.0408 16.5625 12.1997 16.4967 12.3169 16.3794C12.4342 16.2622 12.5 16.1033 12.5 15.9375C12.5 15.7717 12.4342 15.6128 12.3169 15.4956C12.1997 15.3783 12.0408 15.3125 11.875 15.3125H10V13.712C10.9189 13.604 11.7937 13.2576 12.5374 12.7072C13.2812 12.1568 13.8681 11.4215 14.24 10.5743C14.6119 9.72705 14.7558 8.79731 14.6575 7.87729C14.5591 6.95727 14.222 6.07895 13.6794 5.32944L15.625 3.38391V5C15.625 5.16576 15.6908 5.32473 15.8081 5.44194C15.9253 5.55915 16.0842 5.625 16.25 5.625C16.4158 5.625 16.5747 5.55915 16.6919 5.44194C16.8092 5.32473 16.875 5.16576 16.875 5V1.87519C16.875 1.85451 16.8739 1.83384 16.8719 1.81324ZM9.375 12.5C8.57151 12.5 7.78607 12.2617 7.118 11.8153C6.44992 11.369 5.92922 10.7345 5.62174 9.99215C5.31426 9.24983 5.23381 8.43299 5.39056 7.64495C5.54731 6.8569 5.93423 6.13303 6.50238 5.56488C7.07053 4.99673 7.7944 4.60981 8.58245 4.45306C9.37049 4.29631 10.1873 4.37676 10.9297 4.68424C11.672 4.99172 12.3065 5.51242 12.7528 6.1805C13.1992 6.84857 13.4375 7.63401 13.4375 8.4375C13.4363 9.51457 13.0079 10.5472 12.2463 11.3088C11.4847 12.0704 10.4521 12.4988 9.375 12.5Z" fill="currentColor"></path></g><defs><clipPath id="clip0_2871_105064"><rect width="20" height="20" fill="white"></rect></clipPath></defs></svg>',1),I9=l("div",{class:"text-sm text-gray-400"},"Giới tính",-1),P9={class:"text-base text-gray-700"},M9={class:"flex px-4 py-3"},O9=l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-500 mr-3"},[l("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})],-1),R9=l("div",{class:"text-sm text-gray-400"},"Số điện thoại",-1),L9={class:"text-base text-gray-700"},D9={class:"flex px-4 py-3"},j9=l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"mr-3 text-gray-500"},[l("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),l("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})],-1),N9=l("div",{class:"text-sm text-gray-400"},"Địa chỉ email",-1),F9={class:"text-base text-gray-700"},z9={__name:"AuthAccount",setup(e){const t={male:"Nam",female:"Nữ"};return(n,s)=>(m(),x("div",v9,[y9,l("div",b9,[l("div",_9,[x9,l("div",null,[w9,l("div",k9,j(y(B).user.name),1)])]),l("div",S9,[$9,l("div",null,[C9,l("div",T9,j(y(B).user.birthday),1)])]),l("div",E9,[A9,l("div",null,[I9,l("div",P9,j(t[y(B).user.gender]??"Khác"),1)])]),l("div",M9,[O9,l("div",null,[R9,l("div",L9,j(y(B).user.phone),1)])]),l("div",D9,[j9,l("div",null,[N9,l("div",F9,j(y(B).user.email??"---"),1)])])])]))}},ct=e=>(nn("data-v-d8858f82"),e=e(),sn(),e),q9={class:"flow-auth-checkout relative"},B9=[ct(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-user-round"},[l("circle",{cx:"12",cy:"8",r:"5"}),l("path",{d:"M20 21a8 8 0 0 0-16 0"})],-1)),ct(()=>l("div",null,"Tài khoản",-1))],U9=[ct(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-shopping-bag"},[l("path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z"}),l("path",{d:"M3 6h18"}),l("path",{d:"M16 10a4 4 0 0 1-8 0"})],-1)),ct(()=>l("div",null,"Đơn hàng",-1))],V9=[ct(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-log-out"},[l("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),l("polyline",{points:"16 17 21 12 16 7"}),l("line",{x1:"21",x2:"9",y1:"12",y2:"12"})],-1)),ct(()=>l("div",null,"Đăng xuất",-1))],H9={class:"px-6 py-6 bg-white rounded-t-2xl overflow-hidden"},W9=ct(()=>l("div",{class:"text-center font-medium text-gray-600 text-xl"}," Xác thực thành công 🎉 ",-1)),G9=ct(()=>l("div",{class:"my-6"},[l("p",{class:"text-sm text-gray-900 marker:text-xs"}," Tận hưởng các lợi ích bổ sung và trải nghiệm phong phú hơn cho tài khoản "),l("ul",{class:"pl-8 list-disc mt-3 space-y-2"},[l("li",{class:"text-sm text-gray-900"}," Mua hàng với ưu đãi đặc biệt 💰 "),l("li",{class:"text-sm text-gray-900"}," Lưu lại trạng thái giỏ hàng của bạn. 🎁 "),l("li",{class:"text-sm text-gray-900"}," Kiểm trạng thái đơn hàng. 🛒 "),l("li",{class:"text-sm text-gray-900"},"...")])],-1)),K9={class:"bg-white mt-4"},Q9={class:"px-6 pb-6 pt-3 bg-white rounded-t-2xl relative"},J9=ct(()=>l("div",{class:"flex justify-center mb-2"},[l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto"})],-1)),X9=ct(()=>l("div",{class:"font-medium text-[20px] text-center tracking-wide text-gray-900 mb-3"}," Đơn hàng của tôi ",-1)),Z9={class:"relative h-[520px] overflow-y-scroll scroll-hidden space-y-6"},Y9=[ct(()=>l("div",{class:"h-[48px] rounded-xl bg-gray-100"},null,-1)),ct(()=>l("div",{class:"flex-1 rounded-xl bg-gray-100"},null,-1)),ct(()=>l("div",{class:"h-[60px] rounded-xl bg-gray-100"},null,-1))],eI={class:"rounded-xl bg-white border border-gray-200 overflow-hidden"},tI={class:"py-3 pl-4 pr-3.5 flex items-center justify-between border-b border-b-gray-200"},nI={class:"space-x-1"},sI=ct(()=>l("span",{class:"text-sm text-gray-500"},"Đơn hàng:",-1)),rI={class:"text-sm text-gray-700 font-semibold"},oI={key:0,class:"flex items-center justify-center h-[26px] px-3 text-xs font-medium rounded-md capitalize bg-blue-50 text-blue-600"},iI={class:"w-full max-w-full overflow-x-auto scroll-hidden flex space-x-4 py-3 pr-4"},aI={class:"w-[94px] h-[94px] mx-auto flex items-center justify-center rounded-lg bg-white overflow-hidden"},lI=["src"],cI=["src","alt","onError"],uI={class:"px-1 mt-2"},dI={class:"text-xs line-clamp-2 font-medium"},fI={class:"h-6 min-w-6 px-0.5 font-medium text-gray-500 flex items-center justify-center text-[10px] bg-gray-200 absolute top-0 right-0 rounded-bl-xl"},hI={class:"py-3 px-4 border-t border-t-gray-200 flex items-center justify-between"},pI={class:"text-sm text-gray-700"},mI={class:"text-sm"},gI=ct(()=>l("span",{class:"mr-1 text-gray-500"},"Tổng tiền:",-1)),vI={class:"text-red-500 test-sm font-semibold"},yI=["onClick"],bI={key:0,class:"h-[380px] flex items-center justify-center"},_I=[ct(()=>l("div",null,[l("div",{class:"flex flex-col items-center justify-center space-y-2"},[l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-700"},[l("circle",{cx:"8",cy:"21",r:"1"}),l("circle",{cx:"19",cy:"21",r:"1"}),l("path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"})]),l("div",{class:"text-lg font-semibold text-gray-700"}," Không tìm thấy đơn hàng ")])],-1))],xI={class:"relative py-6 bg-white rounded-t-2xl overflow-hidden outline-none"},wI={class:"flex items-center pl-4 pr-6"},kI={key:0,class:"h-[40px] w-full rounded-xl bg-gray-100 ml-3"},SI=ct(()=>l("div",{class:"font-semibold text-gray-900 text-lg tracking-tight"}," Đơn hàng chi tiết ",-1)),$I={key:0,class:"flex items-center justify-center h-[26px] px-3 text-xs font-medium bg-blue-50 text-blue-600 rounded-md ml-auto"},CI={class:"relative max-h-[480px] overflow-y-scroll scroll-hidden space-y-4 px-6 mt-4"},TI=[ct(()=>l("div",{class:"h-[42px] rounded-xl bg-gray-100"},null,-1)),ct(()=>l("div",{class:"flex-1 rounded-xl bg-gray-100"},null,-1)),ct(()=>l("div",{class:"h-[52px] rounded-xl bg-gray-100"},null,-1))],EI={class:"rounded-xl border border-gray-200"},AI=ct(()=>l("div",{class:"py-3 px-4 text-base font-medium text-gray-900 border-b border-b-gray-200"}," Thông tin người nhận ",-1)),II={class:"py-3 px-4 space-y-2"},PI={key:0,class:"flex space-x-3"},MI=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Họ và tên ",-1)),OI={class:"text-sm text-gray-700 font-medium"},RI={class:"flex space-x-3"},LI=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Số điện thoại ",-1)),DI={class:"text-sm text-gray-700 font-medium"},jI={class:"flex space-x-3"},NI=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Địa chỉ nhận hàng ",-1)),FI={class:"text-sm text-gray-700 font-medium"},zI={class:"rounded-xl border border-gray-200"},qI=ct(()=>l("div",{class:"py-3 px-4 text-base font-medium text-gray-900 border-b border-b-gray-200"}," Thông tin đơn hàng ",-1)),BI={class:"py-3 px-4 space-y-2"},UI={class:"flex space-x-3"},VI=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ngày đặt hàng ",-1)),HI={class:"text-sm text-gray-700 font-medium"},WI={class:"flex space-x-3"},GI=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Mã đơn hàng ",-1)),KI={class:"text-sm text-gray-700 font-medium"},QI=ct(()=>l("div",{class:"flex space-x-3"},[l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Phương thức thanh toán "),l("div",{class:"text-sm text-gray-700 font-medium"}," Thanh toán tiền mặt khi nhận hàng (COD) ")],-1)),JI={key:0,class:"flex space-x-3"},XI=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ghi chú ",-1)),ZI={class:"text-sm text-gray-700 font-medium"},YI=ct(()=>l("div",{class:"font-semibold text-gray-700 mb-3"}," Sản phẩm đã đặt ",-1)),eP={class:"space-y-3 mb-4 border-b border-b-gray-200 pb-4"},tP={class:"flex items-center justify-between"},nP=ct(()=>l("div",{class:"text-gray-500 mr-2 text-sm"}," Tổng tiền hàng ",-1)),sP={class:"text-right text-[16px] font-medium"},rP={class:"text-gray-700 text-sm"},oP={key:0,class:"flex items-center justify-between"},iP=ct(()=>l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1)),aP={class:"text-right text-[16px] font-medium"},lP={class:"text-green-500 text-sm"},cP={key:1,class:"flex items-center justify-between"},uP=ct(()=>l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1)),dP={class:"text-right text-base"},fP={class:"text-gray-700 text-sm"},hP={class:"flex items-center justify-between mt-2"},pP=ct(()=>l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),l("span",{class:"text-xs ml-1"},"(Đã bao gồm VAT)")],-1)),mP={class:"text-red-500 text-base font-semibold"},gP=Ke({__name:"FlowAuth",props:Kr(["chatViewRef"],{open:{},openModifiers:{}}),emits:["update:open"],setup(e){var $,E;const t=dr(e,"open"),n=R("phone"),s=R(!1),r=((E=($=B.bot)==null?void 0:$.config)==null?void 0:E.ui.logo)||`${B.appDomain}/link.png`,o=ee(()=>[{name:"phone",active:n.value==="phone"},{name:"otp",active:n.value==="otp"},{name:"success",active:n.value==="success"},{name:"orders",active:n.value==="orders"},{name:"order-detail",active:n.value==="order-detail"},{name:"account",active:n.value==="account"}]),i=P=>{o.value.find(M=>M.name===P)&&(n.value=P)},a=R(null),c=P=>{i("otp"),a.value=P.form.identifier},u=P=>{i("success")},d=async()=>{try{const P=await Xe.auth.logout();B.user=null,B.token=null,s.value=!1,Tt.remove(ts);const{data:I}=await Xe.cart.getList();I.success&&(B.cart=I.data,ECG.sync.emit("logout",{source:"easy-ai-chat",data:I.data}))}catch{}},f=R([]),h=R(null),g=R({}),p=R(!1),v=R(!1),_=async()=>{try{const{data:P}=await Xe.order.getStatuses();if(P.success){const I=P.data||[];g.value=I.reduce((M,L)=>(M[L.code]=L.name,M),{})}}catch(P){console.log("error: ",P)}},k=async()=>{try{p.value=!0,_();const{data:P}=await Xe.order.getList({paginate:!1});P.success&&(f.value=P.data.orders)}catch(P){const I=P.response.data.raw;I.success&&(f.value=I.data.orders)}finally{p.value=!1}},w=async P=>{try{if(!P||v.value)return;i("order-detail"),v.value=!0;const{data:I}=await Xe.order.getOne(P);I.success&&(h.value=I.data)}catch{}finally{v.value=!1}};return Pe(s,P=>{P&&k()}),(P,I)=>(m(),x(be,null,[l("div",q9,[y(B).user?(m(),x("button",{key:0,onClick:I[0]||(I[0]=M=>s.value=!s.value),class:"size-8 flex items-center justify-center rounded-lg cursor-pointer bg-white/10 hover:bg-white/20"},[G(y(ig),{size:"14"})])):(m(),x("button",{key:1,onClick:I[1]||(I[1]=M=>(t.value=!0,n.value="phone")),class:"size-8 flex items-center justify-center rounded-lg cursor-pointer bg-white/10 hover:bg-white/20"},[G(y(ig),{size:"14"})])),l("div",{class:te(["ecg-account-menu",s.value&&"open"])},[l("button",{onClick:I[2]||(I[2]=M=>(s.value=!1,t.value=!0,n.value="account")),class:"ecg-account-menu-item"},B9),l("button",{onClick:I[3]||(I[3]=M=>(s.value=!1,t.value=!0,n.value="orders")),class:"ecg-account-menu-item"},U9),l("button",{class:"ecg-account-menu-item",onClick:I[4]||(I[4]=M=>d())},V9)],2)]),G(Hg,{chatViewRef:e.chatViewRef,open:t.value,"onUpdate:open":I[7]||(I[7]=M=>t.value=M),slotNames:o.value},{phone:Se(()=>[G(Gg,{onSuccess:c})]),otp:Se(()=>[G(Kg,{identifier:a.value,onSuccess:u},null,8,["identifier"])]),success:Se(()=>[l("div",H9,[W9,G9,l("div",K9,[l("button",{onClick:I[5]||(I[5]=M=>t.value=!1),class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium"}," Tiếp tục mua sắm ")])])]),orders:Se(()=>[l("div",Q9,[J9,X9,l("div",Z9,[p.value?(m(),x(be,{key:0},Ie(3,(M,L)=>l("div",{key:L,class:"rounded-xl animate-pulse bg-white overflow-hidden h-[316px] flex flex-col space-y-3 p-3 border border-gray-100"},Y9)),64)):(m(),x(be,{key:1},[(m(!0),x(be,null,Ie(f.value,M=>(m(),x("div",eI,[l("div",tI,[l("div",nI,[sI,l("span",rI,"#"+j(M.order_number),1)]),g.value[M.status]?(m(),x("div",oI,j(g.value[M.status]),1)):q("",!0)]),l("div",iI,[(m(!0),x(be,null,Ie(M.items,L=>(m(),x("div",{class:te([M.items.length>2?"ml-4 last:ml-0":"ml-4","w-[120px] flex-shrink-0 px-2 pt-6 pb-3 bg-gray-100 rounded-xl relative overflow-hidden"])},[l("div",aI,[L.fe_is_image_error?(m(),x("img",{key:0,src:y(r),alt:"image error",class:"w-[28px] h-[28px]"},null,8,lI)):(m(),x("img",{key:1,src:L.image,alt:L.name,class:"w-full h-full object-cover",onError:V=>L.fe_is_image_error=!0},null,40,cI))]),l("div",uI,[l("div",dI,j(L.name),1)]),l("div",fI," x"+j(L.quantity),1)],2))),256))]),l("div",hI,[l("div",null,[l("div",pI,j(M.total_items)+" sản phẩm ",1),l("div",mI,[gI,l("span",vI,j(y(et)(M.total_price)),1)])]),l("button",{onClick:L=>w(M.id),class:"px-4 h-9 hover:bg-gray-200 text-gray-700 rounded-xl flex items-center justify-center text-sm font-medium border"}," Xem chi tiết ",8,yI)])]))),256)),f.value.length===0?(m(),x("div",bI,_I)):q("",!0)],64))])])]),"order-detail":Se(()=>[l("div",xI,[l("div",wI,[v.value?(m(),x("div",kI)):(m(),x(be,{key:1},[l("button",{onClick:I[6]||(I[6]=M=>i("orders")),class:"size-10 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-900 mr-0.5"},[G(Wg)]),SI,g.value[h.value.status]?(m(),x("div",$I,j(g.value[h.value.status]),1)):q("",!0)],64))]),l("div",CI,[v.value||!h.value?(m(),x(be,{key:0},Ie(3,(M,L)=>l("div",{key:L,class:"rounded-xl animate-pulse bg-white overflow-hidden h-[280px] flex flex-col space-y-3 p-3 border border-gray-200"},TI)),64)):(m(),x(be,{key:1},[l("div",EI,[AI,l("div",II,[h.value.shipping_address.name?(m(),x("div",PI,[MI,l("div",OI,j(h.value.shipping_address.name),1)])):q("",!0),l("div",RI,[LI,l("div",DI,j(h.value.shipping_address.phone),1)]),l("div",jI,[NI,l("div",FI,j(`${h.value.shipping_address.address1}`),1)])])]),l("div",zI,[qI,l("div",BI,[l("div",UI,[VI,l("div",HI,j(y(Oa)(h.value.created_at)),1)]),l("div",WI,[GI,l("div",KI," #"+j(h.value.order_number),1)]),QI,h.value.note?(m(),x("div",JI,[XI,l("div",ZI,j(h.value.note??"---"),1)])):q("",!0)])]),l("div",null,[YI,l("div",eP,[(m(!0),x(be,null,Ie(h.value.items,M=>(m(),oe(Al,{key:M.sku,item:M},null,8,["item"]))),128))]),l("div",null,[l("div",tP,[nP,l("div",sP,[l("div",rP,j(y(et)(h.value.subtotal_price)),1)])]),h.value.total_discounts?(m(),x("div",oP,[iP,l("div",aP,[l("div",lP,j(y(et)(h.value.total_discounts)),1)])])):q("",!0),h.value.shipping_price?(m(),x("div",cP,[uP,l("div",dP,[l("div",fP,j(y(et)(h.value.shipping_price)),1)])])):q("",!0),l("div",hP,[pP,l("div",mP,j(y(et)(h.value.total_price)),1)])])])],64))])])]),account:Se(()=>[G(z9)]),_:1},8,["chatViewRef","open","slotNames"])],64))}},[["__scopeId","data-v-d8858f82"]]),vP={key:0,class:"relative"},yP={key:0,class:"absolute top-0 inset-x-0 -translate-y-[110%]"},bP={class:"bg-red-50 w-[100%] rounded-2xl relative py-3 pl-4 pr-10 flex items-start border border-red-300"},_P={class:"space-y-2"},xP={class:"text-red-600 whitespace-pre-line flex items-start"},wP={class:"pt-0.5"},kP={class:"text-sm"},SP={key:1,class:"custom-scrollbar"},$P={class:"flex space-x-2.5 w-fit pt-2"},CP=["onClick"],TP={key:0,class:"group relative w-full h-full"},EP=["src"],AP={key:0,class:"inset-0 absolute bg-white/10"},IP={key:1,class:"absolute inset-0 flex items-center justify-center"},PP=Ke({__name:"FilePreview",props:{disabled:{type:Boolean,default:!1},showEmptyState:{type:Boolean,default:!0}},setup(e){const t=e,{removeFile:n,displayFiles:s,isImageFile:r,errors:o}=ml();Pe(o,a=>{if(a&&a.length>0){const c=setTimeout(()=>{o.value=[],clearTimeout(c)},5e3)}});const i=a=>{t.disabled||n(a)};return(a,c)=>y(s).length>0||y(o).length>0?(m(),x("div",vP,[y(o).length>0?(m(),x("div",yP,[l("div",bP,[l("div",_P,[(m(!0),x(be,null,Ie(y(o),u=>(m(),x("div",xP,[l("div",wP,[G(y(g2),{size:"20","stroke-width":"1.5",class:"flex-shrink-0 mr-2"})]),l("p",kP,j(u),1)]))),256))]),l("button",{onClick:c[0]||(c[0]=u=>o.value=[]),class:"size-7 flex-shrink-0 rounded-3xl flex items-center justify-center absolute top-2 right-1.5"},[G(y(Es),{size:"18",class:"text-red-500"})])])])):q("",!0),y(s).length>0?(m(),x("div",SP,[l("div",$P,[(m(!0),x(be,null,Ie(y(s),(u,d)=>(m(),x("div",{key:u.file_id||`file-${d}`,class:"eac-card-file"},[l("button",{type:"button",class:"eac-remove-file",onClick:f=>i(u.file_id||d)},[G(y(Es),{size:"12","stroke-width":"2"})],8,CP),l("div",{class:te(["relative border border-gray-200 overflow-hidden rounded-xl",{"w-[240px] sm:w-[268px] h-[60px]":!y(r)(u.mime_type),"w-[80px] h-[80px]":y(r)(u.mime_type),"shadow-sm":y(r)(u.mime_type)}])},[y(r)(u.mime_type)?(m(),x("div",TP,[l("img",{src:u.url||u.previewUrl,alt:"preview",class:"w-full h-full object-cover"},null,8,EP),u.loading?(m(),x("div",AP)):q("",!0),u.loading?(m(),x("div",IP,[G(y(T2),{size:"18",class:"animate-spin text-white mt-1"})])):q("",!0)])):(m(),oe(kg,{key:1,file:u},null,8,["file"]))],2)]))),128))])])):q("",!0)])):q("",!0)}},[["__scopeId","data-v-c3e36a9e"]]),MP={class:"w-fit relative group"},OP=["accept","multiple"],RP=["disabled"],LP={key:0,class:"absolute hidden group-hover:block bg-orange-100 text-orange-500 -right-12 w-[150px] px-3 py-1 text-center text-xs border rounded-xl shadow-sm top-0 -translate-y-full"},DP={__name:"FileTrigger",props:{disabled:{type:Boolean,default:!1},handle:{type:String,default:""},toolbar:{type:Object,default:()=>({})},accept:{type:String,default:""}},setup(e){const t=e,{allowedExtensions:n,validateFiles:s,updateConfig:r,uploadFilesToServer:o,files:i,maxFilesAllowed:a,errors:c,processedFiles:u}=ml();ws(()=>{t.toolbar&&r(t.toolbar)});const d=ee(()=>t.accept?t.accept:n.value.join(",")),f=ee(()=>!0),h=R(null),g=()=>{t.disabled||u.value.length>=a.value||h.value.click()},p=async v=>{if(t.disabled||u.value.length>=a.value)return;const _=v.target.files;if(!_.length)return;const k=u.value.length+i.value.length;if(k>=a.value){c.value=[`Chỉ được phép tải lên tối đa ${a.value} file`],v.target.value="";return}const w=a.value-k,$=Array.from(_).slice(0,w);_.length>w&&(c.value=[`Chỉ được tải thêm ${w} file. Đã loại bỏ ${_.length-w} file cuối`]),s($)&&await o(),v.target.value=""};return(v,_)=>(m(),x("div",MP,[l("input",{ref_key:"fileInput",ref:h,type:"file",class:"hidden",accept:d.value,multiple:f.value,onChange:p},null,40,OP),l("button",{type:"button",class:"size-9 flex items-center justify-center rounded-full sm:hover:bg-gray-100 cursor-pointer text-gray-500",onClick:g,disabled:e.disabled},[G(y(qu),{size:"18"})],8,RP),y(u).length>=y(a)?(m(),x("div",LP," Chỉ được phép tải lên tối đa "+j(y(a))+" file ",1)):q("",!0)]))}},ld={en:"en-US",vi:"vi-VN",ja:"ja-JP"},jP=e=>e&&ld[e]?ld[e]:e&&e.includes("en-")||e==="en"?"en-US":e&&e.includes("vi-")||e==="vi"?"vi-VN":e&&e.includes("ja-")||e==="ja"?"ja-JP":ld.ja,$e=dt({isOpen:!1,isRecording:!1,isProcessing:!1,isStartSpeechToText:!1,showPermissionDenied:!1,permissionStatus:"prompt",recognition:null,recordedTranscript:"",finalTranscript:"",recordTime:0,recordingTimer:null,recordingStartTime:null,maxRecordingTime:60,restartTimeout:null});function cd(){const{isOpen:e,isRecording:t,isProcessing:n,isStartSpeechToText:s,showPermissionDenied:r,permissionStatus:o,recordedTranscript:i,recordTime:a}=At($e),c=ee(()=>{switch($e.permissionStatus){case"prompt":return{type:"info",title:"Cần quyền truy cập mic",message:"Nhấn vào nút mic và cho phép trình duyệt truy cập để bắt đầu nói chuyện với tôi."};case"granted":return null;case"denied":return{type:"error",title:"Không thể truy cập mic",message:"Bạn cần cấp quyền mic trong cài đặt trình duyệt. Nhấn vào biểu tượng ổ khóa bên cạnh URL và bật quyền mic."};case"not_supported":return{type:"error",title:"Trình duyệt không hỗ trợ Mic",message:"Rất tiếc, trình duyệt hiện tại chưa hỗ trợ nhận diện giọng nói. Vui lòng dùng Chrome, Edge hoặc Safari phiên bản mới nhất để trò chuyện."};default:return null}}),u=()=>{$e.isOpen=!$e.isOpen},d=()=>{$e.isOpen=!0},f=()=>{$e.isOpen=!1},h=X=>{$e.isProcessing=X},g=()=>{const X="webkitSpeechRecognition"in window||"SpeechRecognition"in window;return X||($e.permissionStatus="not_supported"),X},p=async()=>{try{return!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia?($e.permissionStatus="not_supported",{granted:!1,reason:"not_supported"}):((await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(T=>T.stop()),$e.permissionStatus="granted",{granted:!0})}catch(X){return X.name==="NotAllowedError"||X.name==="PermissionDeniedError"?($e.permissionStatus="denied",{granted:!1,reason:"denied"}):X.name==="NotFoundError"?($e.permissionStatus="denied",{granted:!1,reason:"not_found"}):($e.permissionStatus="denied",{granted:!1,reason:"error"})}},v=()=>{$e.showPermissionDenied=!0,$e.permissionStatus="denied"},_=()=>{$e.showPermissionDenied=!1},k=()=>{$e.recordTime=0,$e.recordingStartTime=Date.now(),$e.recordingTimer=setInterval(()=>{$e.recordTime=Math.floor((Date.now()-$e.recordingStartTime)/1e3),$e.recordTime>=$e.maxRecordingTime&&I()},1e3)},w=()=>{$e.recordingTimer&&(clearInterval($e.recordingTimer),$e.recordingTimer=null,$e.recordingStartTime&&($e.recordTime=Math.floor((Date.now()-$e.recordingStartTime)/1e3)))},$=()=>{$e.restartTimeout&&(clearTimeout($e.restartTimeout),$e.restartTimeout=null)},E=()=>{try{if(!g())return $e.permissionStatus="not_supported",!1;const X=window.SpeechRecognition||window.webkitSpeechRecognition;return $e.recognition=new X,$e.recognition.continuous=!0,$e.recognition.interimResults=!0,$e.recognition.lang=jP(gi.state.locale),$e.recognition.maxAlternatives=1,$e.recognition.onstart=()=>{$e.isRecording=!0,$e.permissionStatus="granted"},$e.recognition.onend=()=>{$e.isStartSpeechToText&&$e.recognition&&($(),$e.restartTimeout=setTimeout(()=>{if($e.isStartSpeechToText&&$e.recognition)try{$e.recognition.start()}catch{}},300))},$e.recognition.onresult=T=>{let A="";for(let D=T.resultIndex;D<T.results.length;D++){const Q=T.results[D][0].transcript;T.results[D].isFinal?$e.finalTranscript+=Q:A+=Q}$e.recordedTranscript=$e.finalTranscript+A},$e.recognition.onerror=T=>{T.error==="no-speech"&&$e.isStartSpeechToText?($(),$e.restartTimeout=setTimeout(()=>{if($e.isStartSpeechToText&&$e.recognition)try{$e.recognition.start()}catch{}},300)):(T.error==="not-allowed"||T.error==="service-not-allowed")&&($e.isStartSpeechToText=!1,$e.permissionStatus="denied",v())},!0}catch{return $e.permissionStatus="not_supported",!1}},P=async()=>{try{if(!g())return $e.permissionStatus="not_supported",!1;const X=await p();return X.granted?($e.recordedTranscript="",$e.finalTranscript="",!$e.recognition&&!E()?!1:$e.recognition?($e.recognition.start(),$e.isRecording=!0,$e.isStartSpeechToText=!0,$e.permissionStatus="granted",k(),!0):!1):(X.reason==="not_supported"?$e.permissionStatus="not_supported":($e.permissionStatus="denied",v()),!1)}catch{return $e.permissionStatus="denied",!1}},I=()=>{if($(),$e.isStartSpeechToText=!1,$e.recognition)try{return $e.isRecording&&$e.recognition.stop(),$e.isRecording=!1,w(),!0}catch{return!1}return!1};return{isOpen:e,isRecording:t,isProcessing:n,isStartSpeechToText:s,showPermissionDenied:r,permissionStatus:o,permissionMessage:c,recordedTranscript:i,recordTime:a,toggleChatVoice:u,openChatVoice:d,closeChatVoice:f,setProcessing:h,isSpeechRecognitionSupported:g,checkMicrophonePermission:p,showPermissionDeniedMessage:v,hidePermissionDeniedMessage:_,startSpeechRecognition:P,stopSpeechRecognition:I,resetTranscript:()=>{$e.recordedTranscript="",$e.finalTranscript="",$e.recordTime=0},saveTranscript:()=>$e.recordedTranscript&&$e.recordedTranscript.trim()!==""?{type:"voice",content:$e.recordedTranscript,timestamp:new Date().toISOString(),duration:$e.recordTime}:null,releaseMediaResources:()=>{try{if($(),$e.isStartSpeechToText=!1,$e.recognition){try{$e.isRecording&&$e.recognition.stop()}catch{}$e.recognition=null}return $e.recordedTranscript="",$e.finalTranscript="",$e.recordTime=0,$e.isRecording=!1,$e.recordingTimer&&(clearInterval($e.recordingTimer),$e.recordingTimer=null),!0}catch{return!1}}}}const Fe={search:e=>{vt.track("web_search",e)},categoryView:e=>{vt.track("web_category_view",e)},productSelect:e=>{vt.track("web_product_select",e)},productView:e=>{vt.track("web_product_view",e)},addToCart:e=>{vt.track("web_add_to_cart",e)},removeFromCart:e=>{vt.track("web_remove_from_cart",e)},checkout:e=>{vt.track("web_checkout",e)},purchase:e=>{vt.track("web_purchase",e)},cartView:e=>{vt.track("web_cart_view",e)},addShippingInfo:e=>{vt.track("web_add_shipping_info",e)},addPaymentInfo:e=>{vt.track("web_add_payment_info",e)},selectPromotion:e=>{vt.track("web_promotion_select",e)},viewPromotion:e=>{vt.track("web_promotion_view",e)},login:e=>{vt.track("web_login",e)},signUp:e=>{vt.track("web_sign_up",e)},generateLead:e=>{vt.track("web_generate_lead",e)},trackOrder:e=>{vt.track("web_order_track",e)},buttonClick:e=>{vt.track("web_button_click",e)}},NP=Object.freeze(Object.defineProperty({__proto__:null,initMetricWebsiteFactory:async()=>{try{const e=ae.state.handle;if(!e)return;switch(e){case Mn:await Promise.resolve().then(()=>rB);break;case _r:await Promise.resolve().then(()=>jB);break;case $s:await Promise.resolve().then(()=>cU);break;case ii:await Promise.resolve().then(()=>PU);break;case wr:await Promise.resolve().then(()=>KU);break;default:break}}catch(e){console.error(`Failed to load metric for ${handle}:`,e)}},metric:vt,metricChatbot:Qt,metricWebsite:Fe},Symbol.toStringTag,{value:"Module"})),FP={class:"max-h-screen overflow-y-auto scroll-hidden"},zP={class:"flex justify-between items-start mb-4 outline-none ring-0",tabindex:"0"},qP={class:"flex items-center gap-2"},BP={class:"size-8 rounded-full overflow-hidden",style:{"max-width":"32px"}},UP=["src","alt"],VP={key:0,class:"font-semibold text-primary"},HP={class:"mb-5 px-1 select-text"},WP=["innerHTML"],GP=["innerHTML"],KP={class:"space-y-4"},QP={class:"mt-6"},JP=["disabled"],XP={key:1,class:"px-3 flex justify-center items-center bg-primary h-[46px] text-white rounded-xl text-center text-base"},ZP=l("div",null,"Đã gửi thành công",-1),YP={__name:"WidgetFormRenderPreSend",props:{bot:{type:Object,required:!0},widget:{type:Object,required:!0},chatViewRef:{type:Object,required:!0}},setup(e){const t=e,{isOpenLeadForm:n}=At(ae.state),s=R(!Ts()),r=R(!1),o=R(!1),i=dt({}),a=R({}),c=R(!1),u=ee(()=>Object.keys(a.value).length>0?!1:t.widget.fields.filter(g=>{var p;return(p=g.validate)==null?void 0:p.includes("required")}).map(g=>g.name).every(g=>{const p=i[g];return typeof p=="boolean"?p===!0:p&&p.toString().trim()!==""})),d=(h,g)=>{g?delete a.value[h]:a.value[h]=""},f=async()=>{if(c.value=!0,!(Object.keys(a.value).length>0))try{r.value=!0;const g={};t.widget.fields.forEach(_=>{g[_.name]=i[_.name]}),g.user_id=Ks(),g.page_url=window.location.href;const{data:p}=await Xe.submission.submitWidget({widgetId:t.widget.id,formData:{status:"submitted",submission_data:g}}),v={};t.widget.fields.forEach(_=>{["name","phone","email"].includes(_.name)&&(v[_.name]=i[_.name]||"")}),ae.actions.updateChatState({visitor:v,isOpen:!0}),Qt.widgetContact({widget_id:t.widget.id,widget_type:t.widget.type,form_data:(p==null?void 0:p.submission_data)||{}}),o.value=!0,setTimeout(()=>{n.value=!1},1500)}catch(g){console.log("Error: ",g)}finally{r.value=!1}};return(h,g)=>(m(),oe(y(mo),{modal:!s.value,dismissible:!1,open:y(n),"onUpdate:open":g[1]||(g[1]=p=>Ft(n)?n.value=p:null),shouldScaleBackground:!1},{default:Se(()=>[G(y(er),{to:e.chatViewRef},{default:Se(()=>[l("div",{class:te(["drawer-overlay-custom backdrop-blur-sm",[y(n)&&"drawer-overlay-custom--open"]])},null,2),G(y(nr),{"aria-describedby":"widget lead form",class:"absolute p-5 bg-white rounded-3xl bottom-8 lg:bottom-5 z-50 inset-x-4 lg:inset-x-5 outline-none overflow-hidden"},{default:Se(()=>[G(y(wl),{"aria-describedby":"widget lead form title",class:"hidden"}),G(y(kl),{"aria-describedby":"widget lead form desc",class:"hidden"}),l("div",FP,[l("div",zP,[l("div",qP,[l("div",BP,[l("img",{src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"w-full"},null,8,UP)]),e.bot.config.ui.name?(m(),x("div",VP,j(e.bot.config.ui.name),1)):q("",!0)]),q("",!0)]),l("div",null,[l("div",HP,[l("div",{class:"text-gray-800 text-lg font-medium leading-[120%]",innerHTML:e.widget.formHeaderTitle||"Vui lòng để lại thông tin"},null,8,WP),e.widget.formHeaderSubTitle?(m(),x("p",{key:0,innerHTML:e.widget.formHeaderSubTitle,class:"text-base text-gray-700 mt-2 leading-[140%]"},null,8,GP)):q("",!0)]),l("form",{onSubmit:Gt(f,["prevent"])},[l("div",KP,[(m(!0),x(be,null,Ie(t.widget.fields,p=>(m(),oe(Zu,{key:p.name,modelValue:i[p.name],"onUpdate:modelValue":v=>i[p.name]=v,field:p,error:a.value[p.name],disabled:o.value,onValidate:d},null,8,["modelValue","onUpdate:modelValue","field","error","disabled"]))),128))]),l("div",QP,[o.value?q("",!0):(m(),x("button",{key:0,type:"submit",class:te(["w-full font-medium bg-primary text-white text-base h-[46px] rounded-xl focus:outline-none ring-0 flex justify-center items-center",[u.value?"":"opacity-70 cursor-not-allowed"]]),disabled:r.value||!u.value},j(r.value?"Đang gửi...":e.widget.buttonText||"Gửi"),11,JP)),o.value?(m(),x("div",XP,[ZP,G(y(Bu),{size:"16",class:"ml-2"})])):q("",!0)])],32)])])]),_:1})]),_:1},8,["to"])]),_:1},8,["modal","open"]))}},e7={key:0,class:"flex-shrink-0 px-1.5 py-[3px] text-blue-500 bg-blue-50 w-fit rounded-xl flex items-center gap-1.5 translate-y-1.5"},t7=l("span",{class:"text-xs"},"Đang phát trực tiếp",-1),n7={key:1,class:"flex items-center gap-1.5 bg-blue-50 rounded-full pl-1 pr-2.5 py-1 w-fit translate-y-1.5"},s7={class:"text-[11px] leading-3 font-medium tracking-tight tabular-nums text-right text-blue-400"},r7=16,o7={__name:"ChatVoiceCard",props:{audioSrc:{type:String,required:!0},isLastAudio:{type:Boolean,default:!1},assistantProcessing:{type:Boolean,default:!1},voiceProcessing:{type:Boolean,default:!1}},setup(e){const t=e,n=R(null),s=R(!1),r=R(0),o=R(0),i=R([]),a=ee(()=>o.value?r.value/o.value:0),c=ee(()=>{if(!o.value&&!r.value)return"00:00";const p=s.value||r.value>.5?r.value:o.value;return d(p)}),u=()=>Array.from({length:r7},()=>Math.floor(Math.random()*70)+30),d=p=>{if(!p||isNaN(p))return"00:00";const v=Math.floor(p/60),_=Math.floor(p%60);return`${v.toString().padStart(2,"0")}:${_.toString().padStart(2,"0")}`},f=()=>{n.value&&(s.value?n.value.pause():n.value.play())},h=p=>{if(!n.value||!o.value)return;const v=p.currentTarget.getBoundingClientRect(),_=p.clientX-v.left,k=Math.max(0,Math.min(1,_/v.width));n.value.currentTime=k*o.value,r.value=n.value.currentTime},g=()=>{n.value&&(n.value.pause(),n.value=null),t.audioSrc&&(n.value=new Audio(t.audioSrc),s.value=!1,r.value=0,o.value=0,n.value.addEventListener("loadedmetadata",()=>{o.value=n.value.duration}),n.value.addEventListener("timeupdate",()=>{n.value&&(r.value=n.value.currentTime)}),n.value.addEventListener("play",()=>s.value=!0),n.value.addEventListener("pause",()=>s.value=!1),n.value.addEventListener("ended",()=>{s.value=!1,r.value=0}))};return Pe(()=>t.audioSrc,()=>{g()}),Qe(()=>{i.value=u(),g()}),Lt(()=>{n.value&&(n.value.pause(),n.value.src="",n.value=null)}),(p,v)=>e.isLastAudio&&e.voiceProcessing&&!e.assistantProcessing?(m(),x("div",e7,[G(y(Nu),{size:"16"}),t7])):(m(),x("div",n7,[l("button",{onClick:f,class:te([s.value?"bg-blue-500":"bg-blue-400","flex-shrink-0 size-5 flex items-center justify-center text-white rounded-full hover:bg-blue-500 active:scale-95 transition-all duration-200 focus:outline-none"])},[s.value?(m(),oe(y(L2),{key:0,size:10,fill:"currentColor"})):(m(),oe(y(tg),{key:1,size:10,fill:"currentColor",class:"ml-0.5"}))],2),l("div",{class:"flex items-center gap-0.5 h-3.5 cursor-pointer group",onClick:h,title:"Click to seek"},[(m(!0),x(be,null,Ie(i.value,(_,k)=>(m(),x("div",{key:k,class:te(["w-[3px] rounded-full transition-colors duration-100 ease-linear group-hover:opacity-80",k/i.value.length<a.value?"bg-blue-400":"bg-blue-200"]),style:ht({height:`${_}%`})},null,6))),128))]),l("div",s7,j(c.value),1)]))}},i7={__name:"CardAgentJoinExit",props:{message:{type:Object,required:!0},bot:{type:Object,required:!0}},emits:["scroll-to-bottom"],setup(e,{emit:t}){const n=e,s=t;return ee(()=>{const r=n.bot.config.initialMessage.messages||[];return Object.values(r).map(o=>({content:o.content,content_type:o.displayType,sender_type:"assistant",is_welcome_message:!0}))}),Qe(()=>{s("scroll-to-bottom")}),(r,o)=>q("",!0)}},a7={class:"flex items-end gap-2 my-1"},l7={class:"relative flex flex-shrink-0 overflow-hidden bg-white rounded-full size-8 message-avatar"},c7=["src","alt"],u7={class:"flex-1 flex items-center gap-1.5 flex-wrap"},d7=["onClick"],f7={class:"leading-none"},h7={__name:"CardCtaText",props:{elements:{type:Array,default:()=>[]},title:{type:String,default:""},bot:{type:Object,default:()=>({})}},emits:["send-message"],setup(e,{emit:t}){const n=t,s=i=>typeof i=="string"?i:(i==null?void 0:i.label)||i,r=i=>typeof i=="string"?i:(i==null?void 0:i.full_content)||(i==null?void 0:i.label)||i,o=i=>{Qt.ctaClick({type:"follow_up_questions",value:i}),n("send-message",i)};return(i,a)=>{var c,u,d;return m(),x("div",a7,[l("div",l7,[(d=(u=(c=e.bot)==null?void 0:c.config)==null?void 0:u.ui)!=null&&d.logo?(m(),x("img",{key:0,src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"object-cover w-full h-full"},null,8,c7)):q("",!0)]),l("div",u7,[(m(!0),x(be,null,Ie(e.elements,(f,h)=>(m(),x("button",{key:h,onClick:g=>o(r(f)),class:"flex items-center justify-center p-3 border border-primary text-primary hover:bg-primary hover:text-white text-sm rounded-lg transition-colors"},[l("span",f7,j(s(f)),1)],8,d7))),128))])])}}},p7={class:"flex-1 max-w-[300px]"},m7={class:"bg-gray-50/90 border rounded-xl"},g7={class:"flex items-center gap-2 text-sm leading-none text-gray-700"},v7={class:"overflow-hidden"},y7={class:"pb-2 px-1 pt-0"},b7={class:"border-t border-gray-200 pt-2 space-y-1"},_7=["href","title"],x7={class:"flex items-center mt-0.5 justify-center size-4 text-xs bg-gray-400 text-white flex-shrink-0 rounded-full"},w7={class:"leading-5 underline decoration-dashed underline-offset-4 decoration-gray-400 truncate group-hover/cite:decoration-blue-500 min-w-0 break-words"},k7={__name:"CardCitations",props:{citations:{type:Array,default:()=>[]}},setup(e){const t=R(!1),n=s=>{try{return decodeURIComponent(s)}catch{return s}};return(s,r)=>(m(),x("div",p7,[l("div",m7,[l("div",{class:"flex items-center justify-between gap-4 px-3 py-3 cursor-pointer select-none",onClick:r[0]||(r[0]=o=>t.value=!t.value)},[l("div",g7,[G(y(f2),{size:16,class:"shrink-0"}),l("div",null,"Nguồn ("+j(e.citations.length)+")",1)]),G(y(uo),{size:16,class:te(["text-gray-700 transition-transform duration-200",{"rotate-180":t.value}])},null,8,["class"])]),l("div",{class:te(["grid transition-[grid-template-rows] duration-300 ease-in-out",t.value?"grid-rows-[1fr]":"grid-rows-[0fr]"])},[l("div",v7,[l("div",y7,[l("div",b7,[(m(!0),x(be,null,Ie(e.citations,(o,i)=>(m(),x("a",{key:i,href:o.link,target:"_blank",rel:"noopener noreferrer nofollow",title:n(o.title),class:"group/cite flex items-start gap-1.5 py-1.5 px-2 -mx-1 rounded-lg text-sm text-gray-700 hover:text-blue-600 transition-colors duration-150"},[l("div",x7,j(i+1),1),l("span",w7,j(n(o.title)),1)],8,_7))),128))])])])],2)])]))}},S7=e=>(nn("data-v-ddc21beb"),e=e(),sn(),e),$7={class:"flex items-end gap-2 my-1"},C7={class:"relative flex flex-shrink-0 overflow-hidden bg-white rounded-full size-8 message-avatar"},T7=["src","alt"],E7={class:"flex-1 min-w-0"},A7={class:"overflow-hidden rounded-2xl bg-white text-sm border border-gray-200 shadow-sm"},I7={class:"flex items-center gap-3 border-b bg-white border-gray-100 pl-4 pr-2 py-3"},P7={class:"flex items-center gap-1 text-gray-900"},M7=S7(()=>l("div",{class:"text-lg font-semibold text-gray-900"}," Đơn hàng ",-1)),O7={key:0,class:"inline-flex ml-auto items-center gap-1.5 rounded-full bg-amber-50 px-2.5 py-1 text-xs font-medium text-amber-600"},R7={class:"px-4 py-3.5"},L7=["innerHTML"],D7={key:1,class:"mt-3 flex flex-col gap-2"},j7=["disabled","onClick"],N7=Ke({__name:"OrderCard",props:{message:{type:Object,required:!0},bot:{type:Object,default:()=>({})},conversationId:{type:[String,Object],default:null}},setup(e){const t=e,n=R(!1),s=ee(()=>vn(t.message.content)||{}),r=ee(()=>{var f;return Ga(((f=s.value)==null?void 0:f.body_markdown)||"",{separate:!1})[0]||""}),o=ee(()=>{var f,h;return((f=s.value)==null?void 0:f.status)==="draft"&&Array.isArray((h=s.value)==null?void 0:h.actions)&&s.value.actions.length>0}),i={confirmed:"Đã xác nhận",submitted:"Đã xác nhận",cancelled:"Đã hủy",paid:"Đã thanh toán"},a=ee(()=>{var f;return i[(f=s.value)==null?void 0:f.status]||""}),c=ee(()=>{var f,h;return((f=s.value)==null?void 0:f.status)==="cancelled"?"bg-red-50 text-red-600":((h=s.value)==null?void 0:h.status)==="paid"?"bg-green-50 text-green-600":"bg-primary/10 text-primary"}),u=()=>{const f=t.conversationId;return f&&typeof f=="object"&&"value"in f?f.value:f},d=async f=>{if(!(n.value||f.type!=="confirm")){n.value=!0;try{const{data:h}=await Xe.order.confirm(s.value.order_id,{conversation_id:u()}),g=h==null?void 0:h.data;h!=null&&h.success&&g?t.message.content=JSON.stringify({...s.value,...g}):mn.actions.error({message:"Xác nhận đơn thất bại, vui lòng thử lại."})}catch{mn.actions.error({message:"Xác nhận đơn thất bại, vui lòng thử lại."})}finally{n.value=!1}}};return(f,h)=>{var g,p,v;return m(),x("div",$7,[l("div",C7,[(v=(p=(g=e.bot)==null?void 0:g.config)==null?void 0:p.ui)!=null&&v.logo?(m(),x("img",{key:0,src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"object-cover w-full h-full"},null,8,T7)):q("",!0)]),l("div",E7,[l("div",A7,[l("div",I7,[l("div",P7,[G(y(cn),{size:"18",class:"text-gray-700"}),M7]),s.value.status==="draft"?(m(),x("div",O7,[G(en,{class:"size-3 text-current"}),Be(" Chờ xác nhận ")])):q("",!0)]),l("div",R7,[l("div",{class:"prose prose-sm max-w-none",innerHTML:r.value},null,8,L7),a.value?(m(),x("div",{key:0,class:te(["mt-3 inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium",c.value])},[s.value.status!=="cancelled"?(m(),oe(y(il),{key:0,size:"13","stroke-width":"2"})):q("",!0),Be(" "+j(a.value),1)],2)):q("",!0),o.value?(m(),x("div",D7,[(m(!0),x(be,null,Ie(s.value.actions,(_,k)=>(m(),x("button",{key:k,disabled:n.value,onClick:w=>d(_),class:te(["flex h-[44px] w-full items-center justify-center gap-2 rounded-xl px-4 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60",_.style==="primary"?"bg-primary text-white hover:opacity-90":"border border-primary text-primary hover:bg-primary hover:text-white"])},[n.value?(m(),oe(en,{key:0,class:"size-4 text-current"})):_.type==="confirm"?(m(),oe(y(il),{key:1,size:"17","stroke-width":"2"})):(m(),oe(y(cn),{key:2,size:"17","stroke-width":"1.8"})),l("span",null,j(_.label),1)],10,j7))),128))])):q("",!0)])])])])}}},[["__scopeId","data-v-ddc21beb"]]),F7={class:"relative ecg-widget-header"},z7={class:"flex items-center justify-between p-3.5 text-white bg-primary"},q7={class:"flex items-center gap-2"},B7=["aria-label"],U7=["src","alt"],V7={class:"text-base font-medium tracking-tight"},H7={class:"flex gap-1.5"},W7={key:0,class:"text-[10px] leading-[12px] h-3 min-w-3 tracking-tighter text-center font-semibold rounded-full absolute bg-white text-primary top-0 right-0"},G7={key:0,class:"text-[10px] leading-[12px] h-3 min-w-3 tracking-tighter text-center font-semibold rounded-full absolute bg-white text-primary top-0 right-0"},K7={class:"flex flex-col flex-grow px-2 pt-4 space-y-4 duration-100 lg:px-4 chat-content-item"},Q7={class:"space-y-3 mb-4"},J7=["id"],X7=["src","alt"],Z7=["id"],Y7=["src","alt"],eM=["src","alt"],tM={key:2,class:"ml-auto"},nM={key:3,class:"relative w-full"},sM=["onClick"],rM={key:1,class:"relative pl-[40px]"},oM={key:0,class:"absolute bottom-0 left-0"},iM=["src","alt"],aM={key:7,class:"w-full"},lM={key:13,class:"flex items-end gap-2 w-full"},cM=["src","alt"],uM=["src","alt"],dM={key:0,class:"justify-center !items-start messages-group duration-200 pt-4 pb-2"},fM=["src","alt"],hM={class:"messages"},pM={key:1,class:"justify-center !items-start messages-group duration-200 opacity-100 py-4"},mM=["src","alt"],gM={class:"messages"},vM={key:0,class:"flex flex-col items-end py-4 space-y-2"},yM=["onClick","innerHTML"],bM={class:"relative"},_M=["aria-label","title"],xM={class:"relative z-30 bg-white"},wM={class:"w-full px-3 pt-1"},kM={class:"border border-gray-200 rounded-2xl"},SM={key:0,class:"p-2 pb-1"},$M={class:"flex items-center gap-1"},CM={class:"flex-shrink-0"},TM=["innerHTML"],EM={class:"relative flex w-full"},AM={key:0,class:"flex absolute top-1/2 -translate-y-1/2 left-1.5 z-10 items-center quick-prompts"},IM=["title"],PM={key:0,class:"overflow-hidden quick-prompts-popover"},MM=["onClick"],OM=["placeholder"],RM={class:"absolute z-10 flex items-center duration-200 top-1/2 -translate-y-1/2 right-1"},LM={key:0,class:"size-3 rounded-sm bg-white"},Qg={__name:"ChatView",props:{showMenu:{type:Boolean,default:!1}},setup(e){const t=Wt({loader:()=>Promise.resolve().then(()=>YU),delay:1e3}),n=Wt({loader:()=>Promise.resolve().then(()=>CV),delay:1e3}),s=Wt({loader:()=>Promise.resolve().then(()=>EV),delay:1e3}),{bot:r,handle:o}=At(B),{messages:i,conversationId:a,conversation:c,assistantProcessing:u,newMessageStatus:d,storageConversations:f,fetchMessages:h,refreshConversation:g,clickQuickPrompt:p,send:v,currentMessage:_,agentTyping:k,currentAgent:w,messagesContainerRef:$,scrollToBottom:E,validatedAgentAvatar:P,isAgentEnabled:I}=Ar({handle:o.value}),{voiceAudio:M}=Om({handle:o.value}),{processedFiles:L,uploadFilesToServer:V,setupPasteListener:X,cleanupPasteListener:T}=ml(),{isOpen:A,isStartSpeechToText:D,closeChatVoice:Q,releaseMediaResources:W}=cd(),{widgets:H}=Xs(),{isLocked:K}=Xu(),{t:F}=vs(),ne=R(!1),fe=R(!1),_e=R(null),we=le=>{_e.value={id:le.id,content:le.content,content_type:le.content_type,sender_type:le.sender_type,sender_name:le.sender_name||null},kt(()=>{de.value&&de.value.focus()})},je=()=>{_e.value=null},re=R(null),pe=R(null),de=R(null),Ce=R(!1),Re=R(!0),Oe=R(null),Me=R(!1);qc("chatViewRef",re);const He=["file","gif","image","video","audio","sticker","business_card"],N=ee(()=>{const le=[];return i.value.forEach(xe=>{if(He.includes(xe.content_type))try{xe.content.forEach((at,gt)=>{le.push({...at,messageId:xe.id,messageIndex:gt})})}catch(Ge){console.warn("Failed to parse message content:",Ge)}}),le}),Y=ee(()=>!i.value.find(xe=>xe.sender_type==="user")),Z=ee(()=>{var xe,Ge,at;let le=((at=(Ge=(xe=r.value)==null?void 0:xe.config)==null?void 0:Ge.quickPrompt)==null?void 0:at.messages)||[];return le=Object.values(le),le.map(gt=>gt.content)}),O=ee(()=>{var le,xe,Ge;return!!((Ge=(xe=(le=r.value)==null?void 0:le.config)==null?void 0:xe.delay_response)!=null&&Ge.active)}),U=ee(()=>O.value||u.value),ie=ee(()=>{var xe,Ge;const le=(Ge=(xe=r.value)==null?void 0:xe.config)!=null&&Ge.stream?i.value:nw(i.value,"assistant");return gs(le)});Pe(a,le=>{_e.value=null,le?B.localStorageFormOrder=`${hu}-${a.value}`:(localStorage.removeItem(B.localStorageFormOrder),B.selectedForm=null,B.totalFormItems=0)},{immediate:!0});const me=le=>{if(le.key==="Escape"&&_e.value){je();return}if(le.key===" "&&le.stopPropagation(),!(le.key==="Enter"&&le.shiftKey)&&le.key==="Enter"&&!le.shiftKey){if(le.preventDefault(),fe.value||u.value&&!O.value)return;(_.value.trim().length>1||L.value.length>0)&&Ae()}},ue=le=>{if(!de.value)return;de.value.style.height="auto";const Ge=Math.min(de.value.scrollHeight,120);de.value.style.height=`${Ge}px`},ge=le=>{le.stopPropagation(),ue()},he=le=>{le.stopPropagation()},Te=le=>{le.stopPropagation()},De=le=>{if(!$.value)return;const xe=$.value,Ge=xe.scrollTop,at=xe.scrollHeight,gt=xe.clientHeight,bn=at-(Ge+gt);Me.value=bn>300},Le=()=>{E(),Me.value=!1},Ae=async()=>{A.value&&(Q(),W());const le=_.value;_.value="",await V();const xe=L.value,Ge=_e.value;_e.value=null,v({message:le,files:xe,replyTarget:Ge}),L.value=[],de.value&&(de.value.style.height="44px")},We=le=>le.sender_type==="user";function ot(){if(!r.value)return;const le=r.value.config.initialMessage.messages??[],xe=r.value.config.introductionMessage,Ge=Object.values(le).map(gt=>gt.content);let at=mi(Ge).length;if(xe&&typeof xe=="string"&&(at+=1),at>0)for(let gt=0;gt<at;gt++)i.value[gt]&&(i.value[gt].is_welcome_message=!0)}const it=async()=>{var le,xe;try{const Ge=Tt.get(ts);if(!Ge)return;const{data:at}=await Xe.auth.getUser();at.success&&(B.user=at.data,B.token=Ge)}catch(Ge){((xe=(le=Ge.response.data)==null?void 0:le.raw)==null?void 0:xe.message)==="error_token_is_expired"&&(B.user=null,B.token=null,Tt.remove(ts))}},pt=async()=>{const{data:le}=await Xe.cart.getList();le.success&&(B.cart=le.data)},yt=async()=>{o.value===Mn&&await Promise.all([pt(),it()]),h({onSuccess:async()=>{ot()}})},Ot=async le=>{const{source:xe}=le||{};xe==="rangdongstore"&&pt()},un=async()=>{try{await Xe.auth.logout(),B.user=null,B.token=null,Tt.remove(ts),pt()}catch{}},zt=(le={})=>{const{source:xe,data:Ge}=le;xe==="rangdongstore"&&(Tt.set(ts,Ge.access_token,"14d"),it(),pt())};Qe(async()=>{await yt(),s$().getForms(),f.value[o.value]||localStorage.removeItem(`${hu}-${o.value}`),Oe.value=window.location.origin,o.value===Mn&&window.ECG&&(ECG.sync.on("login",zt),ECG.sync.on("logout",un),ECG.sync.on("cart",Ot)),X(),kt(async()=>{ue()}),E({delay:500})}),Lf(()=>{E()}),Lt(()=>{T()});const Ln=()=>{A.value&&(Q(),W())},se=async(le="")=>{await kt(),_.value=le,de.value&&(de.value.style.height="44px"),console.log("Voice input cancelled")},ye=le=>{le&&le.trim()&&(_.value=le,kt(()=>{de.value&&(de.value.focus(),ue())}))},ze=async le=>{(A.value||D.value)&&(Q(),W());const xe=le||"Không có nội dung thoại",Ge=o.value==="g8homevn";if(Ge)try{console.log("[ChatView] Unlocking audio for voice message..."),await M.unlockAudio()}catch(at){console.error("[ChatView] Failed to unlock audio:",at)}v({message:xe,mode:Ge?"voice":void 0,audio_url:Ge?!0:void 0}),_.value="",de.value&&(de.value.style.height="44px")},qe=async le=>{const xe=Tu(le)?le.message:le;p(xe),ne.value=!1,await kt(),v({message:xe})};return Pe(i,()=>{E()}),(le,xe)=>{var Ge,at,gt,bn,Dn,Gn,Cn,Jt,jl,Nl,Lr;return m(),x("div",{id:"chat-view",ref_key:"chatViewRef",ref:re,class:"flex flex-col overflow-hidden bg-white"},[y(r)?(m(),x(be,{key:0},[l("div",F7,[l("div",z7,[l("div",q7,[e.showMenu?(m(),x("button",{key:0,onClick:xe[0]||(xe[0]=ke=>le.$emit("close")),class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":y(F)("common.back")},[G(y(fo),{size:20})],8,B7)):q("",!0),y(r).config.ui.logo&&!e.showMenu?(m(),x("div",{key:1,class:te(["flex items-center justify-center overflow-hidden bg-white size-8 shrink-0",y(o)===y(Sn)?"rounded":"rounded-full"])},[l("img",{src:y(r).config.ui.logo,alt:y(r).config.ui.name,loading:"lazy",class:"object-cover w-full h-full"},null,8,U7)],2)):q("",!0),l("h2",V7,j(y(r).config.ui.name),1)]),l("div",H7,[y(o)===y(Mn)?(m(),x(be,{key:0},[G(gP,{chatViewRef:re.value},null,8,["chatViewRef"]),l("button",{onClick:xe[1]||(xe[1]=ke=>y(B).cart?Ce.value=!0:null),class:te(["relative flex items-center justify-center flex-shrink-0 p-2 rounded-lg size-8 bg-white/10 hover:bg-white/20",y(B).cart?"cursor-pointer":"cursor-not-allowed"])},[G(y(cn),{size:"14"}),y(B).cart&&y(B).cart.total_items?(m(),x("span",W7,j(y(B).cart&&y(B).cart.total_items),1)):q("",!0)],2)],64)):y(B).forms&&y(B).forms.order&&![y(qn),y(Bn),y(si),y(_r),y(so),y(br),y(ns),y(wr)].includes(y(o))?(m(),x("button",{key:1,class:te([y(B).totalFormItems===0?"cursor-not-allowed":"cursor-pointer ","relative flex items-center justify-center rounded-md size-8 bg-white/10 hover:bg-white/20"]),onClick:xe[2]||(xe[2]=ke=>y(B).totalFormItems>0?y(B).isOpenForm=!0:null)},[G(y(cn),{size:"14"}),y(B).totalFormItems>0?(m(),x("span",G7,j(y(B).totalFormItems),1)):q("",!0)],2)):q("",!0),l("div",{class:te(["flex items-center justify-center rounded-lg size-8 bg-white/10 hover:bg-white/20",y(u)?"cursor-wait":"cursor-pointer"]),onClick:xe[3]||(xe[3]=ke=>(y(g)(),Me.value=!1))},[G(y(F2),{size:"14"})],2),It(le.$slots,"actions")])])]),l("div",{class:"messages-wrapper",ref_key:"messagesContainerRef",ref:$,style:ht({overflowY:y(K)?"hidden":""}),onWheel:he,onTouchmove:Te,onScroll:De},[Re.value&&((gt=(at=(Ge=y(r))==null?void 0:Ge.config)==null?void 0:at.banners)==null?void 0:gt.length)>0?(m(),oe(UA,{key:0,banners:y(r).config.banners,onClose:xe[4]||(xe[4]=ke=>Re.value=!1),class:"chat-content-item"},null,8,["banners"])):q("",!0),l("div",K7,[l("div",Q7,[(m(!0),x(be,null,Ie(ie.value,(ke,is)=>{var xo,Fl,zl,ql,Bl,Ul,Li,ys,Vl,Hl,Wl,wo,ko,Gl,Kl,Ql,Jl,So,Xl,Zl,Yl,ec,tc,Kn,Di,bs,$o,nc,sc,rc,oc,Co,ic,ac,ji,Dr;return m(),x(be,{key:ke.id},[ke.is_welcome_message?(m(),x("div",{key:0,id:ke.id?`message-${ke.id}`:void 0,class:te(["messages-group message-assistant",!((xo=ie.value[is+1])!=null&&xo.is_welcome_message)&&"!mt-2"])},[l("span",{class:te(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",[!((Fl=ie.value[is+1])!=null&&Fl.is_welcome_message)||ke.is_introduction_message?"opacity-100":"opacity-0",y(o)===y(Sn)?"rounded":"rounded-full"]])},[y(r).config.ui.logo?(m(),x("img",{key:0,src:y(r).config.ui.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,X7)):q("",!0)],2),l("div",{class:te(["messages",{"is-user":We(ke)}])},[(m(!0),x(be,null,Ie(y(Ga)(ke.content,{separate:!1}),(dn,jr)=>{var Tn,Ms,Qn;return m(),oe(cg,{key:jr,message:{...ke,content:dn},anchorId:!1,chatViewRef:re.value,isUser:We(ke),newMessageStatus:y(d),isLatestUserMessage:ke.is_last_message===!0,logo:(Qn=(Ms=(Tn=y(r))==null?void 0:Tn.config)==null?void 0:Ms.ui)==null?void 0:Qn.logo,onReply:we},null,8,["message","chatViewRef","isUser","newMessageStatus","isLatestUserMessage","logo"])}),128))],2)],10,J7)):ke.content_type!=="system_time_line"?(m(),x("div",{key:1,id:ke.id?`message-${ke.id}`:void 0,class:te(["messages-group",[We(ke)?"message-user":"message-assistant",ke.sender&&"message-sender"]])},[!We(ke)&&(ke.content_type==="text"||He.includes(ke.content_type))?(m(),x(be,{key:0},[ke.is_last_assistant_message||ke.sender||!((zl=ie.value[is])!=null&&zl.sender)&&((ql=ie.value[is+1])!=null&&ql.sender)?(m(),x("span",{key:0,class:te(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y(Sn)?"rounded":"rounded-full"])},[(Bl=ke.sender)!=null&&Bl.avatar?(m(),x("img",{key:0,src:(Ul=ke.sender)==null?void 0:Ul.avatar,alt:(Li=ke.sender)==null?void 0:Li.name,class:"object-cover w-full h-full"},null,8,Y7)):(m(),x("img",{key:1,src:(Vl=(ys=y(r).config)==null?void 0:ys.ui)==null?void 0:Vl.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,eM))],2)):(m(),x("span",{key:1,class:te(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y(Sn)?"rounded":"rounded-full"])},null,2))],64)):q("",!0),ke.content_type==="text"&&!ke.audio_url?(m(),x("div",{key:1,class:te(["messages",{"is-user":We(ke)}])},[(m(!0),x(be,null,Ie(y(Ga)(ke.content,{separate:!ke.is_welcome_message}),(dn,jr)=>{var Tn,Ms,Qn;return m(),x("div",{key:jr,class:"group-message-nested"},[G(cg,{message:{...ke,content:dn},anchorId:!1,chatViewRef:re.value,isUser:We(ke),newMessageStatus:y(d),isLatestUserMessage:ke.is_last_message===!0,logo:(Qn=(Ms=(Tn=y(r))==null?void 0:Tn.config)==null?void 0:Ms.ui)==null?void 0:Qn.logo,onReply:we},null,8,["message","chatViewRef","isUser","newMessageStatus","isLatestUserMessage","logo"])])}),128))],2)):ke.sender_type==="user"&&ke.audio_url?(m(),x("div",tM,[G(QA,{"message-text":ke.content},null,8,["message-text"])])):ke.content_type==="cards"&&((Wl=(Hl=y(vn)(ke.content))==null?void 0:Hl.elements)==null?void 0:Wl.length)>0?(m(),x("div",nM,[((ko=(wo=y(vn)(ke.content))==null?void 0:wo.elements)==null?void 0:ko.length)>1?(m(),oe(Ti,{key:0,class:"w-full max-w-3xl pr-2"},{default:Se(({selectedIndex:dn,scrollTo:jr})=>{var Tn;return[(m(!0),x(be,null,Ie(((Tn=y(vn)(ke.content))==null?void 0:Tn.elements)||[],(Ms,Qn)=>(m(),oe(pl,{key:Qn,class:"w-[65%]"},{default:Se(()=>{var lc,cc,uc;return[l("div",{class:te([[dn===Qn?"opacity-100":"opacity-30"],"relative h-full duration-700"])},[l("div",{onClick:Fv=>jr(Qn),class:te(["absolute inset-0 z-10 cursor-pointer",dn==Qn&&"hidden"])},null,10,sM),G(WS,{item:Ms,logo:(uc=(cc=(lc=y(r))==null?void 0:lc.config)==null?void 0:cc.ui)==null?void 0:uc.logo},null,8,["item","logo"])],2)]}),_:2},1024))),128))]}),_:2},1024)):(m(),x("div",rM,[ke.is_last_assistant_message?(m(),x("div",oM,[l("span",{class:te(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y(Sn)?"rounded":"rounded-full"])},[y(r).config.ui.logo?(m(),x("img",{key:0,src:y(r).config.ui.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,iM)):q("",!0)],2)])):q("",!0),G(n$,{item:(Kl=(Gl=y(vn)(ke.content))==null?void 0:Gl.elements)==null?void 0:Kl[0],logo:(So=(Jl=(Ql=y(r))==null?void 0:Ql.config)==null?void 0:Jl.ui)==null?void 0:So.logo},null,8,["item","logo"])]))])):ke.content_type==="iframe"?(m(),oe(YC,{key:4,item:ke,handle:y(o)},null,8,["item","handle"])):ke.content&&ke.content_type==="product_cards"&&((Zl=(Xl=y(vn)(ke.content))==null?void 0:Xl.elements)==null?void 0:Zl.length)>0?(m(),oe(s5,{key:5,products:((Yl=y(vn)(ke.content))==null?void 0:Yl.elements)||[],message:ke,onSendMessage:xe[5]||(xe[5]=dn=>y(v)({message:dn})),onOpenFlowCheckout:xe[6]||(xe[6]=dn=>Ce.value=!0)},null,8,["products","message"])):ke.content&&ke.content_type==="address"&&((tc=(ec=y(vn)(ke.content))==null?void 0:ec.elements)==null?void 0:tc.length)>0?(m(),oe(V5,{key:6,stores:(Kn=y(vn)(ke.content))==null?void 0:Kn.elements,logo:($o=(bs=(Di=y(r))==null?void 0:Di.config)==null?void 0:bs.ui)==null?void 0:$o.logo,botName:(rc=(sc=(nc=y(r))==null?void 0:nc.config)==null?void 0:sc.ui)==null?void 0:rc.name},null,8,["stores","logo","botName"])):ke.content_type==="form"?(m(),x("div",aM,[G(yg,{message:ke},null,8,["message"])])):ke.content_type==="audio"&&ke.audio_url?(m(),oe(o7,{key:8,audioSrc:ke.audio_url,isLastAudio:ke.is_last_audio,assistantProcessing:y(u),voiceProcessing:y(M).isPlaying.value},null,8,["audioSrc","isLastAudio","assistantProcessing","voiceProcessing"])):[...He,"attachment"].includes(ke.content_type)?(m(),oe(A5,{key:9,message:ke,files:N.value,isUser:We(ke),newMessageStatus:y(d),isLatestUserMessage:ke.is_last_message===!0},null,8,["message","files","isUser","newMessageStatus","isLatestUserMessage"])):ke.content_type==="agent_join"||ke.content_type==="agent_exit"?(m(),oe(i7,{key:10,message:ke,bot:y(r)},null,8,["message","bot"])):ke.content_type==="follow_up"?(m(),oe(h7,{key:11,elements:((oc=y(vn)(ke.content))==null?void 0:oc.elements)||[],title:((Co=y(vn)(ke.content))==null?void 0:Co.title)||"",bot:y(r),onSendMessage:xe[7]||(xe[7]=dn=>y(v)({message:dn}))},null,8,["elements","title","bot"])):ke.content_type==="order"?(m(),oe(N7,{key:12,message:ke,bot:y(r),"conversation-id":y(a)},null,8,["message","bot","conversation-id"])):ke.content_type==="citations"?(m(),x("div",lM,[l("span",{class:te(["flex overflow-hidden relative bg-white size-8 flex-shrink-0 message-avatar",y(o)===y(Sn)?"rounded":"rounded-full"])},[(ic=ke==null?void 0:ke.sender)!=null&&ic.avatar?(m(),x("img",{key:0,src:ke.sender.avatar,alt:ke.sender.name,class:"object-cover w-full h-full"},null,8,cM)):(m(),x("img",{key:1,src:(ji=(ac=y(r).config)==null?void 0:ac.ui)==null?void 0:ji.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,uM))],2),G(k7,{citations:((Dr=y(vn)(ke.content))==null?void 0:Dr.elements)||[]},null,8,["citations"])])):q("",!0)],10,Z7)):q("",!0)],64)}),128)),y(u)&&y(r).is_bot_working_hours&&((bn=y(c))==null?void 0:bn.response_mode)!=="manual"&&y(d)==="read"?(m(),x("div",dM,[l("div",{class:te(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y(Sn)?"rounded":"rounded-full"])},[y(r).config.ui.logo?(m(),x("img",{key:0,src:y(r).config.ui.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,fM)):q("",!0)],2),l("div",hM,[G(y(t),{onStart:y(E)},null,8,["onStart"])])])):q("",!0),y(k)&&!y(u)?(m(),x("div",pM,[l("div",{class:te(["relative flex flex-shrink-0 overflow-hidden bg-white size-8",y(o)===y(Sn)?"rounded":"rounded-full"])},[l("img",{src:y(P)||y(r).config.ui.logo,alt:((Dn=y(w))==null?void 0:Dn.name)||y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,mM)],2),l("div",gM,[G(y(t),{onStart:y(E),agent:y(w)},null,8,["onStart","agent"])])])):q("",!0)])]),l("div",{class:te(["px-4 duration-200",[pe.value&&pe.value.showToggleButton&&!y(u)?"pb-8":"pb-0"]])},[Y.value&&!y(u)?(m(),x("div",vM,[(m(!0),x(be,null,Ie(Z.value,(ke,is)=>(m(),x("div",{key:is,class:"quick-prompt-tag active",onClick:xo=>qe(ke),innerHTML:y(Tu)(ke)?ke.name:ke},null,8,yM))),128))])):q("",!0)],2)],36),l("div",bM,[Me.value&&!y(u)?(m(),x("button",{key:0,onClick:Le,class:"size-8 rounded-full bg-gray-50 border border-gray-200 absolute left-1/2 -translate-x-1/2 -top-0.5 -translate-y-full flex items-center justify-center z-40","aria-label":y(F)("chat.scrollToBottom"),title:y(F)("chat.scrollToBottom")},[G(y(uo),{size:16,class:"text-gray-600"})],8,_M)):q("",!0),(y(H).ai_product_insight||y(to)[y(o)])&&![y(pu)].includes(y(o))?(m(),oe(g9,{key:1,ref_key:"aiSuggestionRef",ref:pe,widget:y(H).ai_product_insight},null,8,["widget"])):q("",!0),l("div",xM,[l("div",wM,[l("div",kM,[G(Yt,{name:"expand",mode:"out-in"},{default:Se(()=>[y(mn).state.message?(m(),x("div",SM,[l("div",{class:te(["px-3 py-2 rounded-md border animate-[slideIn_0.3s_ease-out_forwards]",y(mn).state.type==="success"?"bg-green-50/80 border-green-200 text-green-500":y(mn).state.type==="warning"?"bg-orange-50/80 border-orange-200 text-orange-500":"bg-red-50/80 border-red-200 text-red-500"])},[l("div",$M,[l("div",CM,[y(mn).state.type==="success"?(m(),oe(y(p2),{key:0,class:"text-green-500 size-4"})):y(mn).state.type==="warning"?(m(),oe(y(C2),{key:1,class:"text-orange-500 size-4"})):(m(),oe(y(q2),{key:2,class:"text-red-500 size-4"}))]),l("div",{class:"text-sm leading-[120%] font-normal",innerHTML:y(mn).state.message},null,8,TM)])],2)])):q("",!0)]),_:1}),G(Yt,{name:"expand",mode:"out-in"},{default:Se(()=>[G(PP,{class:"px-3"})]),_:1}),G(Yt,{name:"expand",mode:"out-in"},{default:Se(()=>[_e.value?(m(),oe(qk,{key:0,replyTarget:_e.value,onCancel:je},null,8,["replyTarget"])):q("",!0)]),_:1}),l("div",EM,[Z.value.length>0?(m(),x("div",AM,[l("button",{type:"button",onClick:xe[8]||(xe[8]=ke=>ne.value=!ne.value),class:te(["flex items-center justify-center transition-colors rounded-full size-8 overflow-hidden hover:bg-gray-50",ne.value?"bg-gray-50":"bg-white"]),title:y(F)("chat.quickPrompts")},[G(y(P2),{size:"18",class:"text-gray-500"})],10,IM),ne.value?(m(),x("div",PM,[(m(!0),x(be,null,Ie(Z.value,(ke,is)=>(m(),x("div",{key:is,class:"quick-prompt-item",onClick:xo=>qe(ke)},j(y(Tu)(ke)?ke.name:ke),9,MM))),128))])):q("",!0)])):q("",!0),Rt(l("textarea",{id:"eac-chat-input",class:"resize-none rounded-3xl input",placeholder:y(F)("chat.placeholder"),"onUpdate:modelValue":xe[9]||(xe[9]=ke=>Ft(_)?_.value=ke:null),onKeydown:me,onFocus:xe[10]||(xe[10]=ke=>Ln()),onInput:ge,onCompositionstart:xe[11]||(xe[11]=ke=>fe.value=!0),onCompositionend:xe[12]||(xe[12]=ke=>fe.value=!1),ref_key:"textareaRef",ref:de,rows:"1"},null,40,OM),[[on,y(_)]]),l("div",RM,[(y(H).voice_chat||y(r).is_test_user)&&!y(I)?(m(),oe(y(s),{key:0,assistantProcessing:y(u),voiceProcessing:y(M).isPlaying.value,class:te(["duration-200",[y(_).length>0?"scale-0":"scale-100"]])},null,8,["assistantProcessing","voiceProcessing","class"])):q("",!0),(Cn=(Gn=y(r).config.toolbar)==null?void 0:Gn.file_upload)!=null&&Cn.visible||(jl=(Jt=y(r).config.toolbar)==null?void 0:Jt.image_upload)!=null&&jl.visible||(Lr=(Nl=y(r).config.toolbar)==null?void 0:Nl.audio_upload)!=null&&Lr.visible?(m(),oe(DP,{key:1,handle:y(o),toolbar:y(r).config.toolbar,disabled:y(u)},null,8,["handle","toolbar","disabled"])):q("",!0),l("button",{type:"button",onClick:xe[13]||(xe[13]=ke=>y(u)&&!O.value||y(_).length<=1&&y(L).length===0?null:Ae()),class:te([[y(_).length>1||y(L).length>0||y(i).length>0&&U.value?"bg-primary text-white sm:hover:opacity-80":"bg-gray-100 text-gray-400 cursor-default",y(u)&&!O.value&&"flicker-effect cursor-wait"],"flex items-center justify-center ml-1.5 duration-200 rounded-full size-9"])},[y(u)&&!O.value?(m(),x("div",LM)):(m(),oe(y(sg),{key:1,size:"16"}))],2)])]),y(H).voice_chat?(m(),oe(y(n),{key:0,onCancelTranscription:xe[14]||(xe[14]=ke=>se()),onEditTranscription:xe[15]||(xe[15]=ke=>ye(ke)),onTranscriptionComplete:xe[16]||(xe[16]=ke=>ze(ke))})):q("",!0)])])])]),y(o)===y(Mn)?(m(),oe(qA,{key:0,chatViewRef:re.value,open:Ce.value,"onUpdate:open":xe[17]||(xe[17]=ke=>Ce.value=ke)},null,8,["chatViewRef","open"])):(m(),oe(hT,{key:1,chatViewRef:re.value,onSendMessage:xe[18]||(xe[18]=ke=>y(v)({message:ke}))},null,8,["chatViewRef"])),G(l4,{chatViewRef:re.value},null,8,["chatViewRef"]),re.value&&y(H).widget_form_render_pre_send?(m(),oe(YP,{key:2,bot:y(r),widget:y(H).widget_form_render_pre_send,chatViewRef:re.value},null,8,["bot","widget","chatViewRef"])):q("",!0)],64)):q("",!0)],512)}}},DM=Object.freeze(Object.defineProperty({__proto__:null,default:Qg},Symbol.toStringTag,{value:"Module"})),jM={key:0,class:"text-white font-medium bg-red-500 h-[22px] min-w-[22px] px-0.5 absolute -top-1.5 -right-2.5 z-10 text-sm rounded-full flex items-center justify-center"},NM=["src","alt"],FM={__name:"ChatButton",props:{isOpen:{type:Boolean,default:!1},chatPosition:{type:String,default:"right"}},emits:["toggle"],setup(e,{emit:t}){const n=t,{bot:s,handle:r,chatState:o}=At(ae.state),i=ee(()=>o.value.unreadMessageCount),a=()=>{n("toggle")};return(c,u)=>{var d,f,h;return m(),x("div",{class:te(["duration-300 relative w-fit border-[3px]",[y(r)===y(Sn)?"rounded-lg":"rounded-full",e.isOpen?"translate-y-[150%] opacity-0 invisible":"delay-300",{left:"mr-auto",right:"ml-auto"}[e.chatPosition],i.value>0?" border-white ring-2 ring-red-500":"border-transparent"]])},[i.value>0?(m(),x("div",jM,[l("span",null,j(i.value),1)])):q("",!0),l("button",{"aria-label":"chat-button",class:te(["flex relative justify-center items-center cursor-pointer chat-button disabled:pointer-events-none disabled:opacity-50 group",[[y(Bn),y(qn)].includes(y(r))?"rounded-2xl bg-transparent shadow":y(r)===y(Sn)&&y(s).config.ui.iconImage?"rounded-lg bg-transparent shadow":"rounded-full bg-primary shadow",(d=y(s).config.ui)!=null&&d.iconImage&&((h=(f=y(s).config.ui)==null?void 0:f.iconImage)!=null&&h.includes(".gif"))?"bg-transparent shadow-none":"overflow-hidden"]]),onClick:a},[y(s).config.ui.iconImage?(m(),x("img",{key:0,src:y(s).config.ui.iconImage,alt:y(s).config.ui.name,class:"object-cover w-full h-full"},null,8,NM)):(m(),oe(y(Xm),{key:1,size:"48",class:"block text-white max-w-[56%]"}))],2)],2)}}},zM=["innerHTML"],qM=Ke({__name:"VerticalSlideUp",props:{messages:{type:Array,default:()=>[]},stopIndex:{type:Number,default:0}},setup(e){const t=e,n=R(null),s=R(null),r=R([]),o=dt({verticalSlideList:null,verticalSlideItemHeight:0,indexVertical:0,maxIndexVertical:0,heightSlideItemActive:null,heightSlideItemPreActive:null,isStopVertical:!1,slideInterval:null,hasStarted:!1}),i=R(null),a=()=>{kt(()=>{!n.value||!s.value||t.messages.length===0||(o.verticalSlideList=r.value,o.maxIndexVertical=t.messages.length,h(),n.value&&s.value&&(o.hasStarted=!0,o.slideInterval=setInterval(d,2500)))})},c=()=>{o.isStopVertical=!0},u=()=>{o.isStopVertical=!1},d=()=>{if(!(o.isStopVertical||!o.hasStarted)){if(!n.value||!s.value){clearInterval(o.slideInterval);return}i.value||(o.indexVertical=0,i.value=t.messages[0]),f(),o.verticalSlideItemHeight+=o.heightSlideItemPreActive||0,n.value&&(n.value.style.height=o.heightSlideItemActive>0?`${o.heightSlideItemActive}px`:"42px"),s.value&&(o.verticalSlideItemHeight>=s.value.offsetHeight?(o.verticalSlideItemHeight=0,o.indexVertical=0,i.value=t.messages[o.indexVertical],s.value.style.transform=`translateY(${o.verticalSlideItemHeight}px)`):(i.value=t.messages[o.indexVertical],s.value.style.transform=`translateY(-${o.verticalSlideItemHeight}px)`))}},f=()=>{var p,v,_,k,w,$;o.indexVertical>=o.maxIndexVertical&&(o.indexVertical=0),i.value=t.messages[o.indexVertical+1],o.heightSlideItemPreActive=((v=(p=o.verticalSlideList)==null?void 0:p[o.indexVertical])==null?void 0:v.offsetHeight)||0,o.heightSlideItemActive=((k=(_=o.verticalSlideList)==null?void 0:_[o.indexVertical+1])==null?void 0:k.offsetHeight)||(($=(w=o.verticalSlideList)==null?void 0:w[0])==null?void 0:$.offsetHeight)||42,o.indexVertical+=1},h=()=>{var p;!n.value||!o.verticalSlideList||(o.heightSlideItemActive=((p=o.verticalSlideList[o.indexVertical])==null?void 0:p.offsetHeight)||42,o.verticalSlideItemHeight=0,n.value&&(n.value.style.height=o.heightSlideItemActive>0?`${o.heightSlideItemActive}px`:"42px"))},g=()=>{o.slideInterval&&(clearInterval(o.slideInterval),o.slideInterval=null)};return Pe(()=>t.messages,p=>{p&&p.length>0&&(g(),o.indexVertical=0,o.hasStarted=!1,o.verticalSlideItemHeight=0,a())},{deep:!0}),Qe(()=>{a()}),Lt(()=>{g()}),(p,v)=>(m(),x("div",{ref_key:"verticalCustomSlide",ref:n,class:"vertical-custom-slide duration-500"},[l("div",{ref_key:"verticalMove",ref:s,class:"duration-1000 vertical-move",onMouseover:c,onMouseleave:u},[(m(!0),x(be,null,Ie(e.messages,(_,k)=>(m(),x("div",{key:_+k,ref_for:!0,ref_key:"verticalSlideItem",ref:r,class:te(["flex-1 text-sm text-gray-700 duration-1000 vertical-slide-item",i.value===_||!i.value?"opacity-100":"opacity-0"]),innerHTML:_},null,10,zM))),128))],544)],512))}},[["__scopeId","data-v-62f66be8"]]),BM=dt({quickPrompts:[],welcomeMessages:[],welcomeMessagesDefault:[],quickPromptsDefault:[],keyQuickPrompt:1}),Jg=(e=[])=>(e=Object.values(e),e.map(t=>t.content)),UM={category:["Xin chào Anh/Chị! Em là trợ lý ảo của {brand}.✨","🔍 Anh/Chị đang xem <br/> <strong>{title}</strong>.","Em rất sẵn lòng hỗ trợ Anh/Chị 😊"],product:["Xin chào Anh/Chị! Em là trợ lý ảo của {brand}.✨","🔍 Anh/Chị đang xem <br/> <strong>{title}</strong>.","Em rất sẵn lòng hỗ trợ Anh/Chị 😊"]},Xg={},Zg=(e,t)=>{if(!e||!t)return!1;if(e.includes("*")){const s=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*");try{return new RegExp(s).test(t)}catch{return t.includes(e.replace(/\*/g,""))}}return t.includes(e)},VM=(e,t,n)=>!Array.isArray(e)||e.length===0?null:e.find(s=>{var o;const r=(o=s.url_pattern)==null?void 0:o.trim();return r?Zg(r,t)||Zg(r,n):!1})??null,HM=()=>{const e=document.querySelector(".plc ul.gp");if(document.querySelector(".dloc ul.loc")||e){const n=document.querySelector("ul.ulk li:last-child"),s=document.querySelector("ul.ulip li:last-child");return(n==null?void 0:n.textContent)||(s==null?void 0:s.textContent)}return null};function WM(){const{quickPrompts:e,welcomeMessages:t,welcomeMessagesDefault:n,quickPromptsDefault:s,keyQuickPrompt:r}=At(BM),{widgets:o}=Xs();function i(){var g,p;if(!to[ae.state.handle]&&!o.value.ai_product_insight){t.value=n.value,e.value=s.value;return}const u=ss("Product"),d=Cs();let f="",h="";if(d.title&&u&&(u.name=d.title),u){let{sku:v,name:_}=u;f=v?"product":"category",ae.state.handle===xr&&(f="product"),h=_}else if(ae.state.handle===xr){const v=HM();v&&(f="category",h=v)}if(f&&h){const v=((g=o.value.ai_product_insight)==null?void 0:g.dynamic_prompts)??to[ae.state.handle]??to.default;let _=v;if(f==="category"&&(v==null?void 0:v.category_mode)==="custom"&&Array.isArray(v==null?void 0:v.category_url_rules)){const E=window.location.href,P=window.location.pathname,I=VM(v.category_url_rules,E,P);I&&(I.name&&(h=I.name),((p=I.prompts)==null?void 0:p.length)>0&&(_={...v,category:I.prompts}))}let k=[];Xg[ae.state.handle]?k=Xg[ae.state.handle][f]:k=UM[f];const w=k.map(E=>E.replace("{title}",h).replace("{brand}",B.bot.config.ui.name));t.value=w;let $=um(_,{title:h,logo:ae.state.bot.config.ui.logo,brand:ae.state.bot.config.ui.name})[f];e.value=$,r.value=r.value+1}else t.value=n.value,e.value=s.value}let a=null;const c=u=>{!(u!=null&&u.initialMessage)||!(u!=null&&u.quickPrompt)||(n.value=Jg(u.initialMessage.messages),s.value=Jg(u.quickPrompt.messages),clearTimeout(a),a=setTimeout(()=>{i()},500))};return Pe(()=>ae.state.bot,u=>{u!=null&&u.config&&n.value.length===0&&c(u.config)},{immediate:!0}),Pe(()=>{var u;return(u=ae.state.bot)==null?void 0:u.config},(u,d)=>{!u||!d||u!==d&&c(u)}),hi(()=>{setTimeout(()=>{i()},500)}),{quickPrompts:e,welcomeMessages:t,keyQuickPrompt:r}}const GM=["srcset"],KM=["src","alt","width","height"],Yg=Ke({__name:"Picture",props:{desktopSrc:{type:String,required:!0},mobileSrc:{type:String,default:null},alt:{type:String,default:"Image"},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},classImg:{type:String,default:""}},setup(e){const t=e,n=o=>{const i="https://app.easychatgpt.io",a="https://console.easyaichat.app";return o.includes(i)?o.replace(i,a):o},s=ee(()=>t.mobileSrc||t.desktopSrc),r=ee(()=>t.desktopSrc);return(o,i)=>(m(),x("picture",null,[l("source",{srcset:n(s.value),media:"(max-width: 525px)"},null,8,GM),l("img",{src:n(r.value),alt:e.alt,class:te(e.classImg),width:e.width,height:e.height},null,10,KM)]))}},[["__scopeId","data-v-a2e952ab"]]),QM={key:0},JM={key:0},XM={class:"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-[9999999999]"},ZM={class:"w-[76vw] md:w-[420px] relative"},YM={class:"absolute -top-9 -right-1"},eO="EAC_CLOSE_WIDGET_POPUP_BANNER",tO={__name:"ShapePopupBanner",props:{item:{type:Object,default:()=>{}}},setup(e){const t=e,n=R(!1),s=R(!1),r=R(null),o=R(null),i=ee(()=>{var d;return(d=t.item.banners)==null?void 0:d.find(f=>f.active)}),a=d=>d.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),c=(d,f="")=>{Object.keys(d).forEach(h=>{let g=d[h];const p=`--${f}${a(h)}`;typeof g=="object"&&!Array.isArray(g)&&g!==null?c(g,`${f}${a(h)}-`):(r.value.style.setProperty(p,g),p.includes("-horizontal")?o.value.style.setProperty(p,"0px"):o.value.style.setProperty(p,g))})};Qe(()=>{i.value&&(n.value=!0,c(i.value,"ui-"))});const u=()=>{n.value=!1,s.value=!0,Tt.set(eO,1,"1d")};return(d,f)=>i.value?(m(),x("div",QM,[l("div",{ref_key:"shapePopupBannerRef",ref:r,class:te(["fixed z-[9999999] eac-popup-banner",[`position-${i.value.alignment.position}`,s.value?"translate-x-0":i.value.alignment.position==="left"?"-translate-x-[150%]":"translate-x-[150%]",n.value?"opacity-0":"duration-300"]])},[(m(),oe(Nt(i.value.link?"a":"div"),{href:i.value.link,target:"_blank",class:"w-[70px] rounded-md block cursor-pointer overflow-hidden",onClick:f[0]||(f[0]=h=>s.value=!1)},{default:Se(()=>[G(Yg,{desktopSrc:i.value.image_desktop,mobileSrc:i.value.image_mobile,alt:"eac banner popup",classImg:"w-full h-full object-contain"},null,8,["desktopSrc","mobileSrc"])]),_:1},8,["href"])),l("button",{onClick:f[1]||(f[1]=h=>s.value=!1),class:"md:group-hover:opacity-100 duration-200 absolute left-0 -top-[20px] z-10 text-gray-500 size-[18px] rounded-full bg-white border border-gray-100 flex items-center justify-center"},[G(y(Es),{size:"12","stroke-width":"1.5"})])],2),l("button",{onClick:f[2]||(f[2]=h=>s.value=!0),ref_key:"buttonBannerTrigger",ref:o,"aria-label":"eac-button-banner-trigger",class:te(["fixed z-[9999999] eac-popup-banner button-trigger bg-primary w-5 h-10 flex items-center justify-center -translate-y-full shadow",[`position-${i.value.alignment.position}`,s.value?i.value.alignment.position==="left"?"-translate-x-[100%]":"translate-x-[100%]":"translate-x-0",i.value.alignment.position==="left"?"rounded-r-lg":"rounded-l-lg",n.value?"opacity-0":"duration-300"]])},[G(y(Ir),{"stroke-width":"2.5",class:te(["text-white",i.value.alignment.position==="right"?"rotate-180":"rotate-0"])},null,8,["class"])],2),G(Yt,{name:"fade"},{default:Se(()=>[n.value?(m(),x("div",JM,[l("div",{onClick:f[3]||(f[3]=h=>u()),class:"fixed inset-0 z-[9999999998] bg-black opacity-20"}),l("div",XM,[l("div",ZM,[l("div",YM,[l("button",{"aria-label":"eac-button-close-banner",onClick:f[4]||(f[4]=h=>n.value=!1),class:"size-7 z-50 bg-white shadow text-gray-500 cursor-pointer rounded-full flex items-center justify-center"},[G(y(Es),{size:"18","stroke-width":"2"})])]),(m(),oe(Nt(i.value.link?"a":"div"),{href:i.value.link,target:"_blank",class:"block",onClick:f[5]||(f[5]=h=>u())},{default:Se(()=>[G(Yg,{desktopSrc:i.value.image_desktop,mobileSrc:i.value.image_mobile,alt:"eac banner popup",classImg:"w-full h-full"},null,8,["desktopSrc","mobileSrc"])]),_:1},8,["href"]))])])])):q("",!0)]),_:1})])):q("",!0)}},nO={},sO={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",version:"1.1",fill:"currentColor"},rO=[l("path",{d:"M28 0H4C1.8 0 0 1.8 0 4v18c0 2.2 1.8 4 4 4h6v5.25c0 0.6 0.7 1 1.2 0.6L19 26h9c2.2 0 4-1.8 4-4V4c0-2.2-1.8-4-4-4zM20 8.3c0.9 0 1.7 0.75 1.7 1.7s-0.75 1.7-1.7 1.7-1.7-0.75-1.7-1.7 0.75-1.7 1.7-1.7zM12 8.3c0.9 0 1.7 0.75 1.7 1.7s-0.75 1.7-1.7 1.7-1.7-0.75-1.7-1.7 0.75-1.7 1.7-1.7zM22.2 17.1c-1.6 1.8-4.2 2.9-6.2 2.9s-4.7-1-6.3-2.9c-0.4-0.4-0.3-1 0.1-1.4 0.4-0.4 1-0.3 1.4 0.1 1.2 1.4 2.9 2.2 4.7 2.2 1.8 0 3.6-0.8 4.7-2.2 0.4-0.4 1-0.5 1.4-0.1 0.4 0.4 0.5 1 0.1 1.4z"},null,-1)];function oO(e,t){return m(),x("svg",sO,rO)}const iO=Ke(nO,[["render",oO]]),ud=e=>(nn("data-v-be8af9cc"),e=e(),sn(),e),aO={class:"px-5 pt-8"},lO={key:0,class:"flex flex-col items-center pb-6 sm:pt-3 sm:min-h-[220px] relative"},cO={class:"mb-3"},uO=ud(()=>l("h3",{class:"text-[18px] font-medium text-gray-900 mb-2"}," Cảm ơn bạn đã phản hồi ",-1)),dO=ud(()=>l("p",{class:"text-center text-sm text-gray-600 px-2"},[Be(" Chúng tôi sẽ xem xét và cải thiện dịch vụ "),l("br"),Be(" dựa trên góp ý của bạn ")],-1)),fO={class:"mt-3"},hO={class:"flex items-center justify-center space-x-1"},pO={key:1,"data-name":"eac-widget-form-survey",class:"h-fit sm:max-h-[76vh] overflow-y-auto scroll-hidden"},mO={class:"overflow-y-auto flex-1"},gO={class:"mb-3 relative"},vO=["src","alt"],yO=["innerHTML"],bO={class:"text-xs text-gray-500 text-center mt-1"},_O=["innerHTML"],xO={class:"space-y-4"},wO={class:"flex items-center justify-center space-x-2"},kO=["onClick"],SO={class:"text-sm font-medium mt-1 text-[#FAAD14] text-center"},$O={key:0,class:"flex justify-center flex-wrap gap-1.5 mb-4"},CO=["onClick"],TO={class:"text-xs text-gray-500 text-right"},EO={class:"pt-4 sticky bottom-0 bg-white"},AO=[ud(()=>l("div",null,"Gửi phản hồi",-1))],IO=Ke({__name:"WidgetWebsiteSurvey",props:{bot:{type:Object,default:null},preview:{type:Boolean,default:!1},widget:{type:Object,default:null}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,r=R(!1),o=R(!1),i=dt({rating:5,detailed_feedback:"",feedback_issues:[],page_url:""}),a={"rangdongstorevn-zll":["Tốc độ website","Đăng nhập tài khoản","Tìm kiếm sản phẩm","Cho hàng vào giỏ hàng","Giá sản phẩm","Dịch vụ khách hàng","Khác"],"easychatgptio-ujc":["Tốc độ website","Đăng nhập tài khoản","Tạo AI chatbot","Huấn luyện AI chatbot","Giá sản phẩm","Dịch vụ khách hàng","Khác"],"easychatgptio-qqh":["Tốc độ website","Đăng nhập tài khoản","Tạo AI chatbot","Huấn luyện AI chatbot","Giá sản phẩm","Dịch vụ khách hàng","Khác"],"jamstackvietnamcom-zux":["Tốc độ website","Tìm kiếm dịch vụ","Giá dịch vụ","Dịch vụ khách hàng","Khác"],easyaiagentsapp:["Khả năng tích hợp","Giao diện người dùng","Độ chính xác của bản ghi (transcript)","Chất lượng bản tóm tắt","Khác"],default:["Giao diện website","Thao tác đặt hàng","Dịch vụ khách hàng","Giá sản phẩm","Tài khoản người dùng","Khác"]},c={easyaiagentsapp:{title:"Đánh giá trải nghiệm <br /> Trợ lý Tóm tắt cuộc họp",description:"Phản hồi của bạn rất quan trọng giúp chúng tôi <br /> cải thiện sản phẩm."},default:{title:"Đánh giá trải nghiệm website",description:" Phản hồi của bạn rất quan trọng giúp chúng tôi <br /> cải thiện trang web."}},u=ee(()=>{var w;return a[(w=n.bot)==null?void 0:w.handle]??a.default}),d=ee(()=>{var w;return c[(w=n.bot)==null?void 0:w.handle]??c.default}),f=["Rất tệ","Tệ","Bình thường","Tốt","Rất tốt"],h=w=>{i.rating=w},g=()=>{r.value=!0,i.feedback_issues=[],i.detailed_feedback="";let w=setTimeout(()=>{s("close"),clearTimeout(w),ae.actions.setSurveyHidden(),localStorage.setItem("EAI_SURVEY_HIDDEN","1")},3e3)},p=async()=>{try{if(o.value)return;o.value=!0,i.page_url=window.location.href;const w={status:"submitted",conversation_id:null,message_id:null,submission_data:i};console.log(w);const $=await Xe.submission.submitWidget({widgetId:n.widget.id,formData:w});$.data&&$.status===200&&g()}catch(w){console.log("Error Submission: ",w)}finally{o.value=!1}},v=()=>{g()},_=()=>{i.detailed_feedback.length>300&&(i.detailed_feedback=i.detailed_feedback.slice(0,300))},k=w=>{const $=i.feedback_issues.indexOf(w);$===-1?i.feedback_issues.push(w):i.feedback_issues.splice($,1)};return(w,$)=>{var E;return m(),x("div",aO,[r.value?(m(),x("div",lO,[l("div",cO,[G(y(Fu),{size:"42","stroke-width":"1",class:"text-gray-600"})]),uO,dO,l("div",fO,[l("div",hO,[(m(),x(be,null,Ie(5,P=>G(y(ul),{size:32,"stroke-width":"1",fill:i.rating>=P?"#FAAD14":"none",color:i.rating>=P?"#FAAD14":"#d1d5db",class:te(["star-icon",i.rating>=P?"star-active":""])},null,8,["fill","color","class"])),64))])])])):(m(),x("div",pO,[l("div",mO,[l("div",gO,[l("div",{class:te(["size-[42px] overflow-hidden mx-auto mb-2",((E=n.bot)==null?void 0:E.handle)===y(Sn)?"rounded":"rounded-full"])},[l("img",{src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"w-full h-full object-cover"},null,8,vO)],2),l("h2",{class:"text-[20px] font-medium text-gray-900 text-center",innerHTML:d.value.title},null,8,yO),l("div",bO,[l("span",{innerHTML:d.value.description},null,8,_O)])]),l("div",xO,[l("div",null,[l("div",wO,[(m(),x(be,null,Ie(5,P=>l("div",{key:P,class:"star-wrapper",onClick:I=>h(P)},[G(y(ul),{size:40,"stroke-width":"1",fill:i.rating>=P?"#FAAD14":"none",stroke:"#FAAD14",color:i.rating>=P?"#FAAD14":"#d1d5db",class:te(["star-icon",i.rating>=P?"star-active":"star-inactive"])},null,8,["fill","color","class"])],8,kO)),64))]),l("div",SO,j(f[i.rating-1]),1)]),l("div",null,[i.rating<=3?(m(),x("div",$O,[(m(!0),x(be,null,Ie(u.value,P=>(m(),x("div",{onClick:I=>k(P),class:te(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",i.feedback_issues.includes(P)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},j(P),11,CO))),256))])):q("",!0),Rt(l("textarea",{"onUpdate:modelValue":$[0]||($[0]=P=>i.detailed_feedback=P),placeholder:"Mô tả chi tiết (tối đa 300 ký tự)",rows:3,onInput:_,class:"text-base placeholder:text-xs sm:text-xs text-gray-700 block w-full rounded-md border border-gray-200 px-3 py-2 resize-none focus:outline-none"},null,544),[[on,i.detailed_feedback]]),l("div",TO,j(i.detailed_feedback.length)+" / 300 ",1)])])]),l("div",EO,[l("button",{onClick:$[1]||($[1]=P=>e.preview?v():p()),class:"w-full h-10 text-sm font-medium px-4 flex items-center justify-center bg-primary text-white rounded-lg"},AO)])]))])}}},[["__scopeId","data-v-be8af9cc"]]),sr=e=>(nn("data-v-6d7ef95c"),e=e(),sn(),e),PO={class:"px-5 pt-8"},MO={key:0,class:"flex flex-col items-center pb-6 sm:pt-4 sm:min-h-[240px] relative"},OO={class:"mb-3"},RO=sr(()=>l("h3",{class:"text-[20px] font-medium text-gray-900 mb-2"}," Cảm ơn bạn đã phản hồi ",-1)),LO=sr(()=>l("p",{class:"text-center text-sm text-gray-600 px-2"},[Be(" Chúng tôi sẽ xem xét và cải thiện dịch vụ "),l("br"),Be(" dựa trên góp ý của bạn ")],-1)),DO={class:"mt-3"},jO={class:"flex items-center justify-center space-x-1"},NO={key:1,"data-name":"eac-widget-form-survey",class:"h-fit sm:max-h-[76vh] overflow-y-auto scroll-hidden"},FO={class:"mb-3 relative"},zO={class:"size-[40px] rounded-full overflow-hidden mx-auto mb-2"},qO=["src","alt"],BO=sr(()=>l("h2",{class:"text-base font-medium text-gray-900 text-center"}," Đánh giá trải nghiệm mua hàng ",-1)),UO=sr(()=>l("div",{class:"text-xs text-gray-500 text-center mt-1"},[Be(" Phản hồi của bạn rất quan trọng giúp chúng tôi "),l("br"),Be(" cải thiện trang web. ")],-1)),VO={class:"space-y-4"},HO={class:"space-y-1"},WO={class:"flex items-center justify-center space-x-2"},GO=["onClick"],KO={class:"text-sm font-medium text-[#FAAD14] text-center"},QO={key:0,class:"space-y-1"},JO=sr(()=>l("div",{class:"text-sm text-gray-900"}," Bạn thích điều gì khi đặt hàng ",-1)),XO={class:"flex flex-wrap gap-1"},ZO=["onClick"],YO={key:1,class:"space - y - 1"},eR=sr(()=>l("div",{class:"text-sm text-gray-900"}," Bạn gặp khó khăn gì khi đặt hàng ",-1)),tR={class:"flex flex-wrap gap-1"},nR=["onClick"],sR={class:"space-y-1"},rR=sr(()=>l("div",{class:"text-sm text-gray-900"}," Bạn mong đợi gì từ đơn hàng này ",-1)),oR={class:"flex flex-wrap gap-1"},iR=["onClick"],aR={class:"text-xs text-gray-500 text-right"},lR={class:"pt-3 sticky bottom-0 bg-white"},cR=[sr(()=>l("div",null,"Gửi phản hồi",-1))],uR="survey_order",dR=Ke({__name:"WidgetOrderSurvey",props:{bot:{type:Object,default:null},preview:{type:Boolean,default:!1},widget:{type:Object,default:null}},emits:["open","close"],setup(e,{emit:t}){const n=`${uR}_submitted_ids`,s=e,r=t,o=R(!1),i=R(!1),a=R(""),c=dt({order_id:null,rating:5,positive_feedbacks:[],negative_feedbacks:[],expectations:[],suggestion:""}),u=["Rất tệ","Tệ","Bình thường","Tốt","Rất tốt"],d=E=>{const P=Tt.get(n)||[],I=Array.isArray(P)?[...P,E]:[E];Tt.set(n,I,"30d")},f=E=>{c.rating=E},h=async()=>{try{if(i.value)return;i.value=!0;const E={status:"submitted",conversation_id:null,submission_data:c},P=await Xe.submission.submitWidget({widgetId:s.widget.id,formData:E});P.data&&P.status===200&&(o.value=!0,d(a.value),setTimeout(()=>{r("close")},3e3))}catch(E){console.log("Error Submission: ",E)}finally{i.value=!1}},g=()=>{o.value=!0;let E=setTimeout(()=>{r("close"),clearTimeout(E)},3e3)},p=()=>{c.suggestion.length>300&&(c.suggestion=c.suggestion.slice(0,300))},v=(E,P)=>{const I=c[P].indexOf(E);I===-1?c[P].push(E):c[P].splice(I,1)},_=()=>{c.order_id=a.value,setTimeout(()=>{r("open")},3500)},k=()=>{const E=Tt.get(n)||[];(Array.isArray(E)?E:[]).includes(a.value)||_()};function w(E){let P=E;try{E.includes("://")?P=new URL(E).pathname:P=E.replace(/^(https?:\/\/)?[^\/]+/,"")}catch{P=E.replace(/^(https?:\/\/)?[^\/]+/,"")}return[/^\/dat-hang-thanh-cong(\?.*)?$/,/^\/dat-hang\/thanh-cong(\/[a-zA-Z0-9-_]+)?(\?.*)?$/,/^\/don-hang\/thanh-cong(\/[a-zA-Z0-9-_]+)?(\?.*)?$/,/^\/thanh-toan\/thanh-cong(\/[a-zA-Z0-9-_]+)?(\?.*)?$/,/^\/giao-dich\/thanh-cong(\/[a-zA-Z0-9-_]+)?(\?.*)?$/,/^\/gio-hang-hoan-tat(\?.*)?$/,/^\/dat-hang-hoan-tat(\?.*)?$/,/^\/thanh-toan-hoan-tat(\?.*)?$/,/^\/don-hang-hoan-tat(\?.*)?$/,/^\/checkout\/success(\?.*)?$/,/^\/checkout\/confirm(\?.*)?$/,/^\/checkout\/confirmation(\?.*)?$/,/^\/checkout\/complete(\?.*)?$/,/^\/order\/success(\?.*)?$/,/^\/order\/confirm(\?.*)?$/,/^\/order\/complete(\?.*)?$/,/^\/order-confirmed(\?.*)?$/,/^\/order-placed(\?.*)?$/,/^\/order-received(\?.*)?$/,/^\/payment\/success(\?.*)?$/,/^\/payment\/confirm(\?.*)?$/,/^\/payment-completed(\?.*)?$/,/^\/purchase\/success(\?.*)?$/,/^\/purchase-complete(\?.*)?$/,/^\/transaction\/complete(\?.*)?$/,/^\/thank-you(\?.*)?$/,/^\/thanks(\?.*)?$/,/^\/confirmation\/[a-zA-Z0-9-_]+$/,/^\/order\/confirmed\/[a-zA-Z0-9-_]+$/,/^\/transaction\/[a-zA-Z0-9-_]+\/success$/,/^\/receipt\/[a-zA-Z0-9-_]+$/,/^\/invoice\/[a-zA-Z0-9-_]+$/].some(M=>M.test(P))}function $(E){let P=E,I;try{if(E.includes("://")){const L=new URL(E);P=L.pathname,I=L.searchParams}else{P=E.replace(/^(https?:\/\/)?[^\/]+/,"");const L=E.split("?")[1];L&&(I=new URLSearchParams(L))}}catch{P=E.replace(/^(https?:\/\/)?[^\/]+/,"");const V=E.split("?")[1];V&&(I=new URLSearchParams(V))}if(I){const L=["orderId","orderID","order_id","orderNumber","order_number","orderNumberId","transactionId","transaction_id","transId","trans_id","id","code","reference","ref","confirmation","confirmationNumber","confirmation_number"];for(const V of L)if(I.has(V))return I.get(V)}const M=[/\/order\/([a-zA-Z0-9-_]+)$/,/\/transaction\/([a-zA-Z0-9-_]+)\/success$/,/\/confirmation\/([a-zA-Z0-9-_]+)$/,/\/receipt\/([a-zA-Z0-9-_]+)$/,/\/invoice\/([a-zA-Z0-9-_]+)$/,/\/dat-hang\/thanh-cong\/([a-zA-Z0-9-_]+)$/,/\/([a-zA-Z0-9-_]{8,})$/];for(const L of M){const V=P.match(L);if(V&&V[1])return V[1]}return null}return Qe(()=>{hi(()=>{const E=window.location.href;w(E)?(a.value=$(E),k()):r("close")},!0)}),(E,P)=>(m(),x("div",PO,[o.value?(m(),x("div",MO,[l("div",OO,[G(y(Fu),{size:"42","stroke-width":"1",class:"text-gray-600"})]),RO,LO,l("div",DO,[l("div",jO,[(m(),x(be,null,Ie(5,I=>G(y(ul),{size:32,"stroke-width":"1",fill:c.rating>=I?"#FAAD14":"none",color:c.rating>=I?"#FAAD14":"#d1d5db",class:te(["star-icon",c.rating>=I?"star-active":""])},null,8,["fill","color","class"])),64))])])])):(m(),x("div",NO,[l("div",null,[l("div",FO,[l("div",zO,[l("img",{src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"w-full h-full object-cover"},null,8,qO)]),BO,UO]),l("div",VO,[l("div",HO,[l("div",WO,[(m(),x(be,null,Ie(5,I=>l("div",{key:I,class:"star-wrapper",onClick:M=>f(I)},[G(y(ul),{size:32,"stroke-width":"1",fill:c.rating>=I?"#FAAD14":"none",stroke:"#FAAD14",color:c.rating>=I?"#FAAD14":"#d1d5db",class:te(["star-icon",c.rating>=I?"star-active":"star-inactive"])},null,8,["fill","color","class"])],8,GO)),64))]),l("div",KO,j(u[c.rating-1]),1)]),c.rating>3?(m(),x("div",QO,[JO,l("div",XO,[(m(),x(be,null,Ie(["Giá sản phẩm","Nhiều ưu đãi","Thanh toán dễ dàng"],I=>l("div",{onClick:M=>v(I,"positive_feedbacks"),class:te(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",c.positive_feedbacks.includes(I)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},j(I),11,ZO)),64))])])):(m(),x("div",YO,[eR,l("div",tR,[(m(),x(be,null,Ie(["Tốc độ tải trang","Tìm sản phẩm","Thao tác mua hàng","Mã khuyến mãi","Phương thức thanh toán","Địa chỉ giao nhận"],I=>l("div",{onClick:M=>v(I,"negative_feedbacks"),class:te(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",c.negative_feedbacks.includes(I)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},j(I),11,nR)),64))])])),l("div",sR,[rR,l("div",oR,[(m(),x(be,null,Ie(["Giao nhanh","Sản phẩm đúng mô tả","Đóng gói đẹp"],I=>l("div",{onClick:M=>v(I,"expectations"),class:te(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",c.expectations.includes(I)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},j(I),11,iR)),64))])]),l("div",null,[Rt(l("textarea",{"onUpdate:modelValue":P[0]||(P[0]=I=>c.suggestion=I),placeholder:"Đề xuất dành cho chúng tôi (tối đa 300 ký tự) ",onInput:p,rows:"3",class:"placeholder:text-xs text-gray-700 block w-full rounded-md border border-gray-200 px-3 py-2 resize-none focus:outline-none"},null,544),[[on,c.suggestion]]),l("div",aR,j(c.suggestion.length)+" / 300 ",1)])])]),l("div",lR,[l("button",{onClick:P[1]||(P[1]=I=>e.preview?g():h()),class:"w-full h-10 text-sm font-medium px-4 flex items-center justify-center bg-primary text-white rounded-lg"},cR)])]))]))}},[["__scopeId","data-v-6d7ef95c"]]),fR=["width","height"],hR=[ma('<path d="M29.0312 2.39062V2.39062C21.8342 9.58768 10.1655 9.58768 2.9684 2.39062V2.39062" stroke="url(#paint0_linear_950_398)" stroke-width="3" stroke-linecap="square"></path><defs><linearGradient id="paint0_linear_950_398" x1="9.48412" y1="8.90634" x2="22.5155" y2="-4.12509" gradientUnits="userSpaceOnUse"><stop offset="0%" stop-color="#3A087F"></stop><stop offset="40%" stop-color="#A535EB"></stop><stop offset="70%" stop-color="#FCA63E"></stop><stop offset="88%" stop-color="#54D5A4"></stop><stop offset="100%" stop-color="#1B8AF7"></stop></linearGradient></defs>',2)],pR={__name:"IconEAI",props:{size:{type:String,default:"sm",validator:e=>["sm","md","lg"].includes(e)}},setup(e){const t=e,n=ee(()=>{switch(t.size){case"lg":return{width:48,height:15};case"sm":return{width:20,height:6.25};case"md":default:return{width:32,height:10}}});return(s,r)=>(m(),x("svg",{width:n.value.width,height:n.value.height,viewBox:"0 0 32 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},hR,8,fR))}},mR={key:0,href:"https://geteasy.ai",target:"_blank",rel:"nofollow noreferrer",class:"text-[10px] text-gray-500 font-medium flex items-center space-x-1 px-2 pb-0.5"},gR=l("span",null,"Powered by",-1),vR={class:"flex items-center space-x-1"},yR=l("span",{class:"font-bold text-gray-900"},"Easy AI",-1),ev={__name:"PoweredByEAC",setup(e){const t=ee(()=>{const n=ae.state.handle;return![qn,Bn,br,"nexpovn","g8homevn","tanchauhomecom","govivn","bvdkmocchauvn"].includes(n)});return(n,s)=>t.value?(m(),x("a",mR,[gR,l("div",vR,[G(pR,{class:"mt-px"}),yR])])):q("",!0)}},bR={class:"flex justify-center py-2"},tv={__name:"TemplateWidgetSlide",props:{position:{type:String,default:"right",validator:e=>["left","right"].includes(e)},autoslide:{type:Boolean,default:!1},duration:{type:Number,default:0},handle:{type:String,default:""}},setup(e){const t=e,n=R(!1),s=R(!1),r=()=>{n.value=!n.value},o=()=>{n.value=!1},i=()=>{n.value=!0},a={easyaiagentsapp:["/meetings/recaps","/meetings/","/easyaiagentsapp/widget"]},c=()=>{t.autoslide&&setTimeout(()=>{n.value=!0},t.duration)};return Qe(()=>{c(),hi(()=>{a[t.handle]?a[t.handle].some(d=>window.location.pathname.includes(d))?s.value=!0:s.value=!1:(s.value=!0,c())},!0)}),(u,d)=>(m(),x(be,null,[s.value?It(u.$slots,"trigger",Ui(xn({key:0},{isOpen:n.value,position:e.position,toggleSlide:r,closeSlide:o,openSlide:i}))):q("",!0),G(Yt,{name:"fade"},{default:Se(()=>[n.value?(m(),x("div",{key:0,onClick:o,class:"sm:hidden z-[9999999901] fixed inset-0 bg-black bg-opacity-30"})):q("",!0)]),_:1}),s.value?(m(),x("div",{key:1,class:te(["fixed z-[9999999902] w-screen h-fit max-sm:rounded-t-3xl sm:w-[325px] bg-white overflow-hidden transition-transform duration-500 ease-in-out",e.position==="left"?"left-0 sm:rounded-r-2xl":"right-0 sm:rounded-l-2xl","max-sm:bottom-0 sm:top-[48%] sm:-translate-y-1/2",n.value?"sm:delay-150":"",n.value?{left:"transform max-sm:translate-y-0 sm:translate-x-0",right:"transform max-sm:translate-y-0 sm:-translate-x-0"}[e.position]:{left:"max-sm:translate-y-full sm:-translate-x-full",right:"max-sm:translate-y-full sm:translate-x-full"}[e.position]]),style:{"box-shadow":"rgba(100, 100, 111, 0.2) 0px 7px 29px 0px"}},[l("button",{onClick:o,class:"absolute z-10 right-2 top-3 bg-white text-gray-600 size-8 flex items-center justify-center sm:hover:bg-gray-100 rounded-md"},[G(y(Es),{size:"18","stroke-width":"2"})]),l("div",null,[It(u.$slots,"widget",Ui(pa({isOpen:n.value,closeSlide:o,openSlide:i})))]),l("div",bR,[G(ev)])],2)):q("",!0)],64))}},_R={key:0},xR={key:0},wR=l("div",{class:"absolute inset-0 bg-gray-500/60"},null,-1),kR=["src","alt"],SR={class:"text-sm font-medium text-primary leading-[120%]"},$R={key:1},CR=["onClick"],TR=["onClick","innerHTML"],ER=["onClick","innerHTML"],AR=["onClick"],IR={class:"pb-1 text-base text-white whitespace-nowrap rotate-90"},PR={class:"flex items-center space-x-2"},MR={class:"text-sm sm:text-base"},OR=["title"],nv={__name:"ChatWidget",props:{isPreview:{type:Boolean,default:!1},isOpenInit:{type:Boolean,default:!1}},setup(e){var de,Ce,Re;const t=Wt(()=>Promise.resolve().then(()=>FV)),n=Wt(()=>Promise.resolve().then(()=>rv)),s=Wt(()=>Promise.resolve().then(()=>sH)),r=Wt(()=>Promise.resolve().then(()=>lH)),o=e,{widgets:i,widgetSettingType:a}=Xs(),{t:c}=vs(),{bot:u,handle:d,chatState:f}=At(ae.state),h=R(!1),g=R(!1),p=R(null),v=R(null),_=R(!1),k=R(!1),w=R(!1),{getStorage:$}=Gs(),{isOpen:E,toggleChatbot:P}=_i({openInit:o.isOpenInit,milliseconds:(Re=(Ce=(de=u.value)==null?void 0:de.config)==null?void 0:Ce.ui)==null?void 0:Re.automaticallyExpand}),{clickQuickPrompt:I,send:M,isLiveChatEnabled:L}=Ar(),{quickPrompts:V,welcomeMessages:X,keyQuickPrompt:T}=WM(),A=()=>{const Oe=ss("Product");Oe&&Oe.sku&&(_.value=!0,k.value=!1)},D=ee(()=>_.value?k.value:!0),Q=()=>{_.value&&(k.value=!0)},W=()=>{_.value&&(k.value=!1)};Qe(async()=>{p.value=window.location.hostname;const Oe=$("easychatgpt_conversations",d.value);Oe&&(B.localStorageFormOrder=`${hu}-${Oe}`),fe(),localStorage.getItem("EAI_SURVEY_HIDDEN")==="1"&&(w.value=!0),setTimeout(()=>{h.value=!0},1e3)}),Pe(()=>B.localStorageFormOrder,Oe=>{Oe&&(B.selectedForm=JSON.parse(localStorage.getItem(Oe)))});const H=ee(()=>{var Oe,Me,He,N;return((N=(He=(Me=(Oe=u.value)==null?void 0:Oe.config)==null?void 0:Me.ui)==null?void 0:He.alignment)==null?void 0:N.position)||"right"});Pe(E,Oe=>{Oe?h.value=!1:setTimeout(()=>{h.value=!0},800),A()}),Pe(d,Oe=>{Oe&&[qn,Bn].includes(Oe)&&A()},{immediate:!0});function K(Oe){E.value=!0,h.value=!1,M({message:Oe})}function F(){g.value=!1,Tt.set(fu,1,"1d")}function ne(){ae.actions.resetUnreadMessageCount(),F()}function fe(){Tt.get(fu)!=="1"?(g.value=!0,Tt.remove(fu)):g.value=!1}function _e(){w.value=!0,localStorage.setItem("EAI_SURVEY_HIDDEN","1")}const we=Oe=>Oe!==null&&typeof Oe=="object",je=ee(()=>{var Oe;return(Oe=u.value.widgets)==null?void 0:Oe.find(Me=>Me.type.includes("website_survey")&&Me.active&&!Me.is_deleted)}),re=ee(()=>y_.includes(d.value)&&!o.isPreview),pe=ee(()=>[qn,Bn].includes(d.value));return(Oe,Me)=>{var He,N,Y,Z;return y(u)?(m(),x("div",_R,[re.value?q("",!0):(m(),x("div",{key:0,class:te(["chat-widget",[`position-${y(u).config.ui.alignment.position}`,`btn-size-desktop-${((He=y(u).config.ui.bubble_chat)==null?void 0:He.offset.desktop.size)??"medium"}`,`btn-size-mobile-${((N=y(u).config.ui.bubble_chat)==null?void 0:N.offset.mobile.size)??"medium"}`]]),style:ht([{display:"none"},{"--size-desktop-custom":((Y=y(u).config.ui.bubble_chat)==null?void 0:Y.offset.desktop.custom)??"var(--size-medium)","--size-mobile-custom":((Z=y(u).config.ui.bubble_chat)==null?void 0:Z.offset.mobile.custom)??"var(--size-medium)","--z-index-chatview":9999999999,"--z-index-bubblechat":999999990}])},[l("div",{class:te(["w-screen grow sm:w-[425px] sm:h-[720px] sm:max-h-[calc(100vh-6rem)] z-[var(--z-index-chatview)] overflow-hidden ecg-chat-view sm:rounded-3xl box-shadow-md max-sm:border-t-0 max-sm:border-x-0 fixed max-sm:right-0 sm:right-4 duration-500",[[y(E)?"max-sm:top-0 delay-300":"opacity-0 invisible translate-y-[150%]",pe.value?"h-[calc(100dvh-52px)] max-sm:top-[52px]":"h-dvh rounded-none max-sm:top-0"]]])},[G(y(t),{ref_key:"chatViewRef",ref:v,class:"h-full w-full",onCloseChat:Me[0]||(Me[0]=O=>y(P)())},null,512)],2),l("div",{class:te([[!y(E)&&"z-[var(--z-index-bubblechat)]"],"chat-button-group fixed bottom-[var(--ui-alignment-offset-vertical)] space-y-2"]),onMouseenter:Q,onMouseleave:W},[!y(f).unreadMessageCount&&g.value&&!y(E)&&D.value?(m(),x("div",xR,[l("div",{class:te(["flex-col space-y-2 sm:space-y-3 group",[{left:"items-start",right:"items-end"}[H.value],[y(ri),y(oi),y($s),y(pu)].includes(y(d))||e.isPreview?"flex":"hidden sm:flex"]])},[h.value?(m(),x("div",{key:0,class:te(["pr-0.5 duration-500 group-hover:block inner-close",[[y(ri),y(oi),y($s),y(qn),y(Bn)].includes(y(d))?"sm:hidden":"hidden"]])},[l("button",{onClick:Me[1]||(Me[1]=O=>F()),class:"flex overflow-hidden relative justify-center items-center w-6 h-6 md:w-5 md:h-5 rounded-full hover:opacity-70"},[G(go,{class:"relative z-10 w-4 md:w-3 text-white"}),wR])],2)):q("",!0),(m(),x("div",{key:y(T),class:te([h.value?"translate-y-0 opacity-100 visible":"translate-y-[60%] opacity-0 invisible","px-3 pt-2 cursor-pointer pb-1 box-shadow-md bg-white rounded-xl relative w-[180px] sm:w-[200px] duration-1000 delay-75"]),onClick:Me[2]||(Me[2]=O=>E.value=!0)},[y(u).config.ui?(m(),x("div",{key:0,class:te(["items-center space-x-1 sm:space-x-2 mb-1 sm:mb-1.5",[y(ri),y(oi),y($s),y(qn),y(Bn),y(pu)].includes(y(d))||e.isPreview?"flex":"hidden sm:flex "])},[y(u).config.ui.logo?(m(),x("div",{key:0,class:te(["overflow-hidden size-5 sm:size-6 shrink-0",y(d)===y(Sn)?"rounded":"rounded-full"])},[l("img",{src:y(u).config.ui.logo,alt:y(u).config.ui.name,class:"object-cover w-full h-full"},null,8,kR)],2)):q("",!0),l("div",SR,j(y(u).config.ui.name),1)],2)):q("",!0),y(X)&&y(X).length>0?(m(),x("div",$R,[(m(),oe(qM,{messages:y(X),key:y(X)},null,8,["messages"]))])):q("",!0)],2))],2)])):q("",!0),!y(f).unreadMessageCount&&g.value&&!y(E)&&y(V).length>0&&D.value&&![y($s),y(qn),y(Bn),y(Sn),y(so)].includes(y(d))?(m(!0),x(be,{key:1},Ie(y(V),(O,U)=>(m(),x("div",{key:U,class:te(["duration-500",[y(E)?"translate-y-1/2 opacity-0 invisible":"translate-y-0 opacity-100 visible",[y(ri),y(oi)].includes(y(d))||e.isPreview?"block":"hidden sm:block"]]),onClick:ie=>y(I)(O)},[(m(),x("div",{key:y(T),class:te(["flex-col space-y-3 duration-1000 group",[H.value==="left"?"items-start":"items-end",[y(ri),y(oi)].includes(y(d))||e.isPreview?"flex":"hidden sm:flex"]])},[l("div",{class:te([[h.value?"translate-x-0 opacity-100 visible":"translate-y-full opacity-0 invisible",`delay-${U*200+300}ms`],"duration-1000"])},[we(O)?(m(),x("div",{key:0,onClick:ie=>K(O.message),class:"quick-prompt-tag",innerHTML:O.name},null,8,TR)):(m(),x("div",{key:1,onClick:ie=>K(O),class:"quick-prompt-tag",innerHTML:O},null,8,ER))],2)],2))],10,CR))),128)):q("",!0),G(Yt,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"opacity-0 translate-y-4 scale-50","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-4 scale-50"},{default:Se(()=>[y(f).unreadMessageCount>0&&y(L)?(m(),oe(y(r),{key:0,onToggle:Me[3]||(Me[3]=O=>y(P)()),onClose:Me[4]||(Me[4]=O=>ne()),style:ht({transformOrigin:H.value==="right"?"bottom right":"bottom left"})},null,8,["style"])):q("",!0)]),_:1}),G(FM,{isOpen:y(E),chatPosition:H.value,onToggle:Me[5]||(Me[5]=O=>y(P)())},null,8,["isOpen","chatPosition"])],34)],6)),y(i).ai_ask?(m(),oe(y(n),{key:1,widget:y(i).ai_ask},null,8,["widget"])):q("",!0),y(i).product_card_summary&&y(a)!=="auto_detect_card_product"&&![y(xr)].includes(y(d))?(m(),oe(y(s),{key:2,bot:y(u)},null,8,["bot"])):q("",!0),y(i).popup_banner&&![y(qn),y(Bn)].includes(y(d))?(m(),oe(tO,{key:3,item:y(i).popup_banner},null,8,["item"])):q("",!0),je.value&&!y(ae).state.isSurveyHidden&&!w.value&&!["www.dienmayxanh.com","www.thegioididong.com","www.nhathuocankhang.com"].includes(p.value)?(m(),oe(y(tv),{key:4,position:"right",handle:y(d)},{trigger:Se(({isOpen:O,position:U,toggleSlide:ie})=>[l("div",{class:te(["fixed z-40 w-[30px] h-[98px] sm:h-[112px] sm:w-[34px] group opacity-100",U==="left"?"left-0":"right-0",O?U==="right"?"translate-x-full":"-translate-x-full":"translate-x-0 delay-300"]),style:"top: 30%;"},[l("button",{onClick:ie,class:te(["w-full h-full bg-primary hover:opacity-90 text-white flex items-center justify-center duration-200",U==="left"&&"rounded-r-lg",U==="right"&&"rounded-l-lg"])},[l("div",IR,[l("div",PR,[l("div",MR,j(y(c)("survey.rate")),1),G(iO,{class:"size-[15px] sm:size-[17px] -rotate-90 text-white"})])])],10,AR),l("button",{onClick:Gt(_e,["stop"]),class:te(["absolute -top-[5px] w-4 h-4 rounded-full bg-white shadow-md flex items-center justify-center text-gray-500 hover:text-gray-900 border border-gray-200 z-10 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",[U==="left"?"-right-[5px]":"-left-[5px]"]]),title:y(c)("survey.closeRate")},[G(go,{class:"w-2.5 h-2.5"})],10,OR)],2)]),widget:Se(({closeSlide:O})=>[G(y(IO),{bot:y(u),preview:e.isPreview,widget:je.value,onClose:O},null,8,["bot","preview","widget","onClose"])]),_:1},8,["handle"])):q("",!0),y(i).order_survey&&!["www.dienmayxanh.com","www.thegioididong.com","www.nhathuocankhang.com"].includes(p.value)?(m(),oe(y(tv),{key:5,position:"right"},{widget:Se(({openSlide:O,closeSlide:U})=>[G(y(dR),{bot:y(u),widget:y(i).order_survey,preview:e.isPreview,onOpen:O,onClose:U},null,8,["bot","widget","preview","onOpen","onClose"])]),_:1})):q("",!0)])):q("",!0)}}},sv="https://widget.geteasy.ai",dd="easychatgpt-widget";window.EasyAIChat={_config:null,_initialized:!1,init(e){if(this._initialized)return;this._config=e;const t=async()=>{let n=document.getElementById(dd);if(n!=null&&n.hasAttribute("data-ecg-initialized")){this._initialized=!0;return}n||(n=document.createElement("div"),n.id=dd,document.body.appendChild(n));const s=document.createElement("div"),r=n.attachShadow({mode:"open"});r.appendChild(s),Xr(nv,this._config).mount(s);const o=document.createElement("link");o.rel="stylesheet",o.href=`${sv}/dist/widget/main.css?v=${Date.now()}`,o.onload=()=>{n.setAttribute("data-ecg-initialized","true"),this._initialized=!0},r.appendChild(o);const i=e.handle||null,a=e.workspaceUuid||null;a&&ln.actions.init(a),i&&ae.actions.setHandle(i);const c=await ae.actions.fetchBotInit(i,{},{website:!0,workspaceUuid:a,preview:!!e.preview});!i&&(c!=null&&c.handle)&&(this._config={...this._config,handle:c.handle});const u=a||(c==null?void 0:c.workspace_uuid);u&&!a&&ln.actions.init(u),Ar({handle:(c==null?void 0:c.handle)||i})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()},injectWidget:vi,injectChat(e,{type:t="view"}={}){const n=document.querySelector(e);if(!n){console.error(`Target element not found: ${e}`);return}let s;n.shadowRoot?(s=n.shadowRoot,s.innerHTML=""):s=n.attachShadow({mode:"open"});const r=document.createElement("div");r.setAttribute("id","chat-app"),s.appendChild(r),Xr(t==="view"?Qg:nv,this._config).mount(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${sv}/dist/widget/main.css`,s.appendChild(i);const a=document.getElementById(dd);a&&n.setAttribute("style",a.getAttribute("style"))},send(e){_i().isOpen.value=!0,Ar().send({message:e})},rcm:{init:e=>ln.actions.init(e)},sync:{event:{login:"eac-sync-login",logout:"eac-sync-logout",cart:"eac-sync-cart",namespace:"eac-sync"},emit(e,t){if(!e)return;const n=this.event[e]||`${this.event.namespace}-${e}`;window.dispatchEvent(new CustomEvent(n,{detail:t,bubbles:!0,composed:!0}))},on(e,t){if(!e||typeof t!="function")return;const n=this.event[e]||`${this.event.namespace}-${e}`,s=r=>t(r.detail,r);return window.addEventListener(n,s),()=>window.removeEventListener(n,s)},offAll(e){if(!e)return;const t=this.event[e]||`${this.event.namespace}-${e}`;window.removeEventListener(t,null)}}},window.EasyAI=window.EasyAIChat,window.EAI=window.EasyAIChat,window.EAC=window.EasyAIChat,window.ECG=window.EasyAIChat,window.EasyChatGPT=window.EasyAIChat;const RR={class:"bg-white"},LR=["onClick"],DR={class:"flex-1 text-sm"},jR={key:0,class:"flex flex-col px-1 mt-2"},NR={class:"pl-1"},FR={class:"px-3 py-2 mt-1 text-sm bg-blue-50 rounded-lg"},zR={key:0,class:"ask-ai-result"},qR={key:1,class:"ask-ai-result"},BR=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetFeatureAIProductInsightEmbed",props:{widget:{type:Object,default:()=>({})}},setup(e){const t=e,n=R(null),s=R({}),r=R([]);let o=R(null);const i=[{id:1,name:"👍 Tóm tắt ưu điểm",message:"👍 Tóm tắt ưu điểm của {title}"},{id:2,name:"🆚 So sánh mẫu tương đương",message:"🆚 So sánh các mẫu tương đương của {title}"}],a=ee(()=>{var g,p;return((p=(g=t.widget)==null?void 0:g.dynamic_prompts)==null?void 0:p.product)??i}),c=g=>{if(!g)return;const p=g.split(" ");r.value=[];let v=0;o.value=setInterval(()=>{v<p.length?(r.value.push(p[v]),v++):clearInterval(o.value)},60)},u=()=>{clearInterval(o.value),r.value=[]},d=async()=>{try{const g=window.location.href;if(s.value[g]){c(s.value[g]);return}const{data:p}=await Xe.summary.getSummary({handle:ae.state.handle,source:g});p!=null&&p.highlight&&(s.value[g]=p.highlight,c(s.value[g]))}catch(g){console.log("Failed to get summary:",g)}},f=()=>{const g=Cs(),p=ss("Product");g.title&&(p.name=g.title),p?(n.value=p,d()):n.value=null};Qe(()=>{u(),f()});const h=g=>{const p=g.replace(/{title}/g,n.value.name).replace(/{product}/g,n.value.name);EAC.send(p)};return(g,p)=>(m(),x("div",RR,[(m(!0),x(be,null,Ie(a.value,(v,_)=>(m(),x("div",{key:_,class:"flex justify-between items-center py-2 pr-2 pl-3 text-gray-800 rounded-lg cursor-pointer hover:bg-gray-100",onClick:k=>h(v.message)},[l("div",DR,j(v.name),1),G(y(Ir),{size:"16",class:"text-gray-600"})],8,LR))),128)),r.value?(m(),x("div",jR,[l("div",NR,[G(Pi,{title:"AI đánh giá",size:"md"})]),l("div",FR,[r.value.length?(m(),x("div",zR,[(m(),x("span",{key:r.value.length},j(r.value.join(" ")),1))])):(m(),x("div",qR,"AI đang xử lý ..."))])])):q("",!0)]))}}},Symbol.toStringTag,{value:"Module"})),UR={key:0,class:"p-4 sm:px-4 sm:py-5 w-full border border-blue-100 rounded-2xl bg-blue-50/60"},VR={key:0,class:"flex flex-col"},HR={class:"mb-2 flex items-center gap-1"},WR={class:"text-sm pl-1"},GR={key:0},KR={key:0,class:"mb-1.5"},QR={key:1},JR={class:"space-y-1"},XR=l("span",{class:"size-1 rounded-full bg-gray-700 flex-shrink-0 mr-2 translate-y-2"},null,-1),ZR={key:1,class:"ask-ai-result"},YR=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetSummaryPageContent",props:{widget:{type:Object,default:()=>({})},isShowHighlight:{type:Boolean,default:!0},isShowFeatures:{type:Boolean,default:!0}},setup(e){const t=e,n=R({}),s=ee(()=>{const g=t.isShowHighlight&&r.value.highlight,p=t.isShowFeatures&&r.value.features.length;return g||p}),r=R({highlight:"",features:[]});let o=R(null),i=R("highlight"),a=R(0);const c=g=>{r.value={highlight:"",features:[]},i.value="highlight",a.value=0,g.highlight?u(g.highlight,g):g.features&&g.features.length&&(i.value="features",d(g))},u=(g,p)=>{const v=g.split(" ");let _=0;const k=[],w=setInterval(()=>{_<v.length?(k.push(v[_]),r.value.highlight=k.join(" "),_++):(clearInterval(w),p.features&&p.features.length&&setTimeout(()=>{i.value="features",d(p)},200))},40);o.value=w},d=g=>{if(a.value>=g.features.length)return;const v=g.features[a.value].split(" ");let _=0;const k=[],w=setInterval(()=>{if(_<v.length){k.push(v[_]);const $=[...r.value.features];$[a.value]=k.join(" "),r.value.features=$,_++}else clearInterval(w),a.value++,a.value<g.features.length&&setTimeout(()=>{d(g)},100)},40);o.value=w},f=()=>{clearInterval(o.value),r.value={highlight:"",features:[]},i.value="highlight",a.value=0},h=async()=>{try{const g=ae.state.handle,p=window.location.href;if(n.value[p]){c(n.value[p]);return}const{data:v}=await Xe.summary.getSummary({handle:g,source:p});v&&(v.highlight||v.features&&v.features.length)&&(n.value[p]=v,c(v))}catch(g){console.log("Failed to get summary:",g)}};return Qe(()=>{f(),h()}),(g,p)=>s.value?(m(),x("div",UR,[s.value?(m(),x("div",VR,[l("div",HR,[G(Pi,{title:"AI tóm tắt",size:"md"})]),l("div",WR,[r.value.highlight||r.value.features.length?(m(),x("div",GR,[e.isShowHighlight&&r.value.highlight?(m(),x("div",KR,[l("span",null,j(r.value.highlight),1)])):q("",!0),e.isShowFeatures&&r.value.features.length?(m(),x("div",QR,[l("ul",JR,[(m(!0),x(be,null,Ie(r.value.features,(v,_)=>(m(),x("li",{key:_,class:"flex items-start"},[XR,l("span",null,j(v),1)]))),128))])])):q("",!0)])):(m(),x("div",ZR,"AI đang xử lý ..."))])])):q("",!0)])):q("",!0)}}},Symbol.toStringTag,{value:"Module"})),eL={class:"flex items-center gap-1.5 relative"},tL={class:"flex items-center pl-1.5 text-sm text-gray-700 touch-manipulation cursor-pointer"},nL={class:"transition-all duration-300 w-[130px] opacity-100"},sL=["aria-label"],rv=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetAskAI",props:{widget:{type:Object,required:!0}},setup(e){const t=R(!1),n=R(null),s=R(null),r=R(""),o=R(""),i=R(!1),a=R(!1),c=R(!1),u=R(null),d=R(null),f=R([]),h=dt({top:"0px",left:"0px",transform:"translate(-50%, 100%)",boxShadow:"rgba(100, 100, 111, 0.2) 0px 7px 29px 0px"}),g=e;Pe(t,W=>{W?kt(()=>{s.value&&(s.value.focus(),kt(P))}):(r.value="",o.value="",a.value=!1,c.value=!1,clearTimeout(u.value),d.value=null,I())});const p=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,v=()=>{const W=window.getSelection();if(!W.rangeCount||W.isCollapsed)return null;const K=W.getRangeAt(0).getBoundingClientRect();return K.width===0&&K.height===0?null:{x:K.left+K.width/2,y:K.bottom}},_=(W,H)=>{const K=window.pageXOffset,F=window.pageYOffset,ne=window.innerWidth,fe=window.innerHeight,_e=i.value?16:10,we=50,je=i.value?200:280;let re=W,pe=H,de="-50%",Ce="0%";const Re=fe-H,Oe=H;if(Re<we+_e&&Oe>we+_e?(pe=H-_e,Ce="-100%"):(pe=H+_e,Ce="0%"),i.value)re=ne/2,de="-50%";else{const Me=je/2;W-Me<_e?re=_e+Me:W+Me>ne-_e?re=ne-_e-Me:re=W}h.top=`${pe+F}px`,h.left=`${re+K}px`,h.transform=`translate(${de}, ${Ce})`,kt(()=>{if(!n.value)return;const Me=n.value.getBoundingClientRect();let He=re+K,N=pe+F;Me.left<_e?(He=_e+K,h.transform=`translate(0%, ${Ce})`):Me.right>ne-_e&&(He=ne-_e-Me.width+K,h.transform=`translate(0%, ${Ce})`),(Me.bottom>fe-_e||Me.top<_e)&&(Oe>Re&&Oe>we+_e?(N=pe+F-Me.height-_e*2,h.transform=`translate(${de.includes("0%")?"0%":"-50%"}, 0%)`):(N=_e+F,h.transform=`translate(${de.includes("0%")?"0%":"-50%"}, 0%)`)),h.left=`${He}px`,h.top=`${N}px`,i.value&&Me.width>ne-_e*2&&(n.value.style.maxWidth=`${ne-_e*2}px`)})},k=(W,H,K)=>{r.value=K;const F=window.getSelection();F.rangeCount&&!F.isCollapsed&&(d.value=F.getRangeAt(0).cloneRange()),_(W,H),t.value=!0},w=()=>{t.value=!1,n.value&&(n.value.style.maxWidth=""),I()},$=W=>{setTimeout(()=>{var K,F;((K=n.value)==null?void 0:K.contains(document.activeElement))||((F=n.value)==null?void 0:F.contains(W.relatedTarget))||(a.value=!1,i.value||(c.value=!1,w()))},150)},E=W=>{var ne;W==null||W.stopPropagation(),W==null||W.preventDefault(),c.value=!0;const H=o.value.trim(),K=r.value.trim().replace(/\s+/g," ");let F="";H&&K?F=`<blockquote><p>${K}</p></blockquote><p>${H}</p>`:H?F=`<p>${H}</p>`:K&&(F=`<blockquote><p>${K}</p></blockquote>`),F&&((ne=window.EAC)!=null&&ne.send)&&window.EAC.send(F),setTimeout(w,150)},P=()=>{if(!d.value)return;I();const W=d.value.getClientRects();for(let H=0;H<W.length;H++){const K=W[H],F=document.createElement("span");F.style.position="absolute",F.style.backgroundColor="rgba(0, 123, 255, 0.15)",F.style.pointerEvents="none",F.style.left=`${K.left+window.pageXOffset}px`,F.style.top=`${K.top+window.pageYOffset}px`,F.style.width=`${K.width}px`,F.style.height=`${K.height}px`,F.style.zIndex="999999",document.body.appendChild(F),f.value.push(F)}},I=()=>{f.value.forEach(W=>W.remove()),f.value=[]},M=()=>{clearTimeout(u.value),u.value=setTimeout(()=>{const W=window.getSelection(),H=W==null?void 0:W.toString().trim();if(H&&H.length>0&&!W.isCollapsed){const K=v();K&&k(K.x,K.y,H)}else!a.value&&!c.value&&w()},200)},L=W=>{t.value&&n.value&&!n.value.contains(W.target)&&w()},V=()=>{t.value&&w()},X=(W,H)=>{if(!H||!W)return!1;const K=H.replace(/\*\*\//g,"(.*/)?").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\./g,"\\.");return new RegExp(`^${K}$`).test(W)},T=(W,H="")=>{const K=H.split(`
`).map(ne=>ne.trim()).filter(ne=>ne.length>0);let F=K.length===0;return K.length>0&&(F=K.some(ne=>X(W,ne))),F},A=()=>{clearTimeout(u.value),document.removeEventListener("mouseup",M),document.removeEventListener("selectionchange",M),document.removeEventListener("touchend",M),document.removeEventListener("click",L),window.removeEventListener("orientationchange",D),window.removeEventListener("scroll",V),[".layout-wrapper",".chat-widget-wrapper"].forEach(W=>{const H=document.querySelector(W);H&&H.removeEventListener("scroll",V)}),I(),d.value=null},D=()=>{setTimeout(()=>{i.value=p()},500)},Q=()=>{var K;const W=window.location.pathname;if(!T(W,(K=g.widget)==null?void 0:K.include_path_patterns)){t.value=!1;return}i.value=p(),i.value?(document.addEventListener("selectionchange",M,{passive:!0}),document.addEventListener("touchend",M,{passive:!0})):document.addEventListener("mouseup",M,{passive:!0}),document.addEventListener("click",L,{passive:!1}),i.value&&window.addEventListener("orientationchange",D,{passive:!0}),window.addEventListener("scroll",V,{passive:!0}),[".layout-wrapper",".chat-widget-wrapper"].forEach(F=>{const ne=document.querySelector(F);ne&&ne.addEventListener("scroll",V,{passive:!0})})};return Qe(()=>{hi(()=>{A(),Q()},!0)}),Lt(()=>{A()}),(W,H)=>t.value?(m(),x("div",{key:0,ref_key:"tooltip",ref:n,onClick:H[3]||(H[3]=Gt(()=>{},["stop"])),class:"fixed z-[9999999990] bg-white rounded-xl p-1 border border-gray-200",style:ht(h)},[l("div",eL,[l("div",tL,[G(y(O2),{size:"17","stroke-width":"1.5"}),l("div",nL,[Rt(l("input",{ref_key:"inputRef",ref:s,type:"text","onUpdate:modelValue":H[0]||(H[0]=K=>o.value=K),onKeydown:[mr(E,["enter"]),mr(w,["esc"])],onFocus:H[1]||(H[1]=K=>a.value=!0),onBlur:$,placeholder:"Nhập câu hỏi ✨",class:"border-none w-full outline-none px-2 h-7"},null,544),[[on,o.value]])]),l("button",{"aria-label":`eac-widget-ask-ai${i.value?"-mobile":""}`,class:te(["whitespace-nowrap text-[13px] font-medium tracking-tight h-7 flex justify-center items-center px-2 rounded-lg transition-all duration-300",[(i.value,"bg-gray-50 hover:bg-blue-50 hover:text-blue-500 border border-gray-100"),o.value&&"text-blue-500 !bg-blue-50"]]),onClick:E,onMousedown:H[2]||(H[2]=Gt(()=>{},["prevent"]))}," Hỏi AI ",42,sL)])])],4)):q("",!0)}}},Symbol.toStringTag,{value:"Module"})),rL={class:"relative flex flex-col w-full overflow-hidden h-dvh"},oL={class:"flex items-center justify-between px-3 h-[50px] sm:px-4"},iL={class:"bg-white px-2.5 py-1 rounded-lg text-gray-900"},aL={class:"text-gray-500"},lL={class:"flex gap-2"},cL={class:"flex items-center justify-center h-[calc(100%-80px-50px)] overflow-hidden sm:px-14 py-4 px-2"},uL=["src","alt"],dL=["src"],fL={class:"h-[80px] flex-shrink-0 p-2 flex items-center justify-center"},hL={class:"flex h-full gap-2 overflow-x-auto"},pL=["onClick"],mL=["src","alt"],gL=["data-index","src"],vL=["src"],yL={key:2,class:"absolute inset-0 flex items-center justify-center bg-black/20"},bL={class:"flex items-center justify-center w-6 h-6 rounded-full sm:w-8 sm:h-8 bg-white/70"},_L=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ImageGallery",props:{media:{type:Array,required:!0},initialIndex:{type:Number,default:0},onRemove:{type:Function,default:null}},emits:["close"],setup(e,{emit:t}){const n=e,s=ee(()=>n.media.filter(T=>T.type==="image"||T.type==="video")),r=t,o=R(n.initialIndex),i=R([]),a=R([]);R({});const c=R(null),u=ee(()=>s.value[o.value]||{});Pe(u,T=>{T.type==="video"&&c.value&&c.value.load()});const d=()=>{o.value<s.value.length-1?o.value++:o.value=0,g()},f=()=>{o.value>0?o.value--:o.value=s.value.length-1,g()},h=T=>{o.value=T,g()},g=async()=>{await kt();const T=i.value[o.value];T&&T.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},p=async()=>{try{const T=await fetch(u.value.url);if(!T.ok)throw new Error("Failed to fetch file");const A=await T.blob(),D=window.URL.createObjectURL(A),Q=document.createElement("a");if(Q.href=D,u.value.filename)Q.download=u.value.filename;else{const W=u.value.url.split("?")[0],H=W.substring(W.lastIndexOf("/")+1);Q.download=H||`download_${Date.now()}`}document.body.appendChild(Q),Q.click(),document.body.removeChild(Q),window.URL.revokeObjectURL(D)}catch(T){console.error("Download failed:",T)}},v=T=>new Promise((A,D)=>{T.load();const Q=()=>{T.currentTime=.1,T.removeEventListener("loadedmetadata",Q)},W=()=>{A(),T.removeEventListener("loadeddata",W),T.removeEventListener("error",H)},H=()=>{D(new Error("Cannot load video")),T.removeEventListener("loadedmetadata",Q),T.removeEventListener("loadeddata",W),T.removeEventListener("error",H)};T.addEventListener("loadedmetadata",Q),T.addEventListener("loadeddata",W),T.addEventListener("error",H),setTimeout(()=>{A()},3e3)}),_=async()=>{await kt();for(const[T,A]of s.value.entries())if(A.type==="video"&&A.url){const D=a.value[T];if(D)try{await v(D)}catch(Q){console.error(`Error setting thumbnail for video ${A.url}:`,Q)}}},k=()=>{n.onRemove?n.onRemove():r("close")},w=T=>{T.target===T.currentTarget&&k()},$=T=>{switch(T.key){case"ArrowLeft":f();break;case"ArrowRight":d();break;case"Escape":k();break}},E=R(0),P=R(0),I=R(0),M=R(0),L=T=>{E.value=T.changedTouches[0].screenX,I.value=T.changedTouches[0].screenY},V=T=>{P.value=T.changedTouches[0].screenX,M.value=T.changedTouches[0].screenY},X=()=>{const T=E.value-P.value,A=Math.abs(I.value-M.value);Math.abs(T)>50&&A<100&&(T>0?d():f())};return Qe(async()=>{document.addEventListener("keydown",$),document.body.style.overflow="hidden",g(),await _()}),Lt(()=>{document.removeEventListener("keydown",$),document.body.style.overflow=""}),(T,A)=>(m(),x("div",{class:"flex fixed inset-0 z-[99999999990] justify-center items-center bg-black/40",onClick:w,onTouchstart:L,onTouchmove:V,onTouchend:X},[l("div",rL,[l("div",oL,[l("div",iL,[Be(j(u.value.type==="video"?"Video":"Hình ảnh")+" ",1),l("span",aL,j(o.value+1)+"/"+j(s.value.length),1)]),l("div",lL,[l("button",{onClick:p,class:"p-2 hover:bg-gray-100 rounded-lg transition-colors bg-white",title:"Tải xuống"},[G(y(Qm),{size:"18"})]),l("button",{onClick:k,class:"p-2 hover:bg-gray-100 rounded-lg transition-colors bg-white"},[G(y(Es),{size:"18"})])])]),l("div",cL,[u.value.type==="image"?(m(),x("img",{key:0,src:u.value.url,alt:`Gallery Image ${o.value+1}`,class:"object-contain w-full h-full"},null,8,uL)):u.value.type==="video"?(m(),x("video",{ref_key:"mainVideoRef",ref:c,key:u.value.url,controls:"",playsinline:"","webkit-playsinline":"",preload:"metadata",class:"h-full max-w-full"},[l("source",{src:u.value.url+"#t=0.5",type:"video/mp4"},null,8,dL),Be(" Your browser does not support the video tag. ")])):q("",!0)]),s.value.length>1?(m(),x("button",{key:0,onClick:f,class:"absolute hidden sm:block left-1 top-[46%] -translate-y-1/2 z-20 pointer-events-auto p-2 rounded-full bg-white",title:"Trước"},[G(y(fo),{size:"16",class:"text-gray-500"})])):q("",!0),s.value.length>1?(m(),x("button",{key:1,onClick:d,class:"absolute hidden sm:block right-1 top-[46%] -translate-y-1/2 z-20 pointer-events-auto p-2 rounded-full bg-white",title:"Sau"},[G(y(Ir),{size:"16",class:"text-gray-500"})])):q("",!0),l("div",fL,[l("div",hL,[(m(!0),x(be,null,Ie(s.value,(D,Q)=>(m(),x("div",{key:Q,ref_for:!0,ref:W=>{W&&(i.value[Q]=W)},class:"relative flex-shrink-0 h-full overflow-hidden rounded-lg cursor-pointer group aspect-[1/1]",onClick:W=>h(Q)},[D.type==="image"?(m(),x("img",{key:0,src:D.url,alt:`Thumbnail ${Q+1}`,class:te(["object-cover w-full h-full transition-all border rounded-lg border-gray-100",Q==o.value?"border-primary":""])},null,10,mL)):D.type==="video"?(m(),x("video",{key:1,ref_for:!0,ref:W=>{W&&(a.value[Q]=W)},muted:"",playsinline:"","webkit-playsinline":"",preload:"metadata",class:te(["object-cover w-full h-full transition-all border-2 rounded-lg",Q===o.value?"border-blue-500":"border-gray-200 hover:border-gray-300"]),"data-index":Q,src:D.url+"#t=0.1"},[l("source",{src:D.url,type:"video/mp4"},null,8,vL)],10,gL)):q("",!0),D.type==="video"?(m(),x("div",yL,[l("div",bL,[G(y(tg),{class:"w-3 h-3 sm:w-4 sm:h-4 text-gray-700 ml-0.5"})])])):q("",!0)],8,pL))),128))])])])],32))}}},Symbol.toStringTag,{value:"Module"})),xL={},wL={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},kL=[l("rect",{width:"16",height:"16",rx:"8",fill:"#0959B6"},null,-1),l("path",{d:"M7.36454 4.38676C7.64356 3.87108 8.35644 3.87108 8.63546 4.38676L9.3989 5.7977C9.503 5.99008 9.68228 6.12577 9.89009 6.16945L11.4142 6.48979C11.9712 6.60686 12.1915 7.31311 11.8069 7.74889L10.7547 8.94125C10.6112 9.10382 10.5427 9.32337 10.567 9.54274L10.7455 11.1517C10.8108 11.7397 10.2341 12.1762 9.71735 11.9298L8.30357 11.2558C8.11081 11.1639 7.88919 11.1639 7.69643 11.2558L6.28265 11.9298C5.76594 12.1762 5.18921 11.7397 5.25445 11.1517L5.43296 9.54274C5.4573 9.32337 5.38882 9.10382 5.24534 8.94125L4.19307 7.74889C3.80849 7.31311 4.02878 6.60686 4.58581 6.48979L6.10991 6.16945C6.31772 6.12577 6.49701 5.99008 6.6011 5.7977L7.36454 4.38676Z",fill:"white"},null,-1)];function SL(e,t){return m(),x("svg",wL,kL)}const ov=Ke(xL,[["render",SL]]),$L={},CL={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},TL=[l("path",{d:"M12.3337 0.833313C12.5249 0.833437 12.6993 0.942626 12.783 1.11456C12.8666 1.28669 12.8445 1.4914 12.7263 1.64191L9.69507 5.50031H13.6667C13.8653 5.50031 14.045 5.61736 14.1248 5.79913C14.2044 5.98106 14.1686 6.19324 14.0339 6.33917L6.03394 15.0062C5.87818 15.1746 5.62774 15.2151 5.42651 15.1048C5.22521 14.9944 5.12492 14.7614 5.18335 14.5394L6.6853 8.83331H2.66675C2.49178 8.83331 2.32959 8.7418 2.23901 8.5921C2.14844 8.44241 2.1422 8.25588 2.22339 8.10089L5.89038 1.10089L5.92651 1.0423C6.01953 0.912191 6.17102 0.833313 6.33374 0.833313H12.3337Z",fill:"url(#paint0_linear_745_62583)",stroke:"#9C020C","stroke-linejoin":"round"},null,-1),l("defs",null,[l("linearGradient",{id:"paint0_linear_745_62583",x1:"8.16675",y1:"1.33331",x2:"8.16675",y2:"14.6666",gradientUnits:"userSpaceOnUse"},[l("stop",{"stop-color":"#FFF067"}),l("stop",{offset:"1","stop-color":"#FCE61E"})])],-1)];function EL(e,t){return m(),x("svg",CL,TL)}const Il=Ke($L,[["render",EL]]),AL={},IL={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},PL=[l("g",{"clip-path":"url(#clip0_745_62553)"},[l("path",{d:"M12.4332 1.90002L12.8399 4.47336L15.1799 5.66669L13.9999 8.00002L15.1866 10.3334L12.8266 11.5267L12.4199 14.1L9.82657 13.6934L7.9799 15.5334L6.12657 13.6667L3.55323 14.0934L3.1399 11.5L0.813232 10.3134L1.9999 7.98002L0.819899 5.66669L3.1599 4.46002L3.56657 1.90669L6.14657 2.33336L7.9999 0.460022L9.84657 2.30669L12.4332 1.90002ZM6.33323 4.66669C6.06802 4.66669 5.81366 4.77205 5.62613 4.95958C5.43859 5.14712 5.33323 5.40147 5.33323 5.66669C5.33323 5.93191 5.43859 6.18626 5.62613 6.3738C5.81366 6.56133 6.06802 6.66669 6.33323 6.66669C6.59845 6.66669 6.8528 6.56133 7.04034 6.3738C7.22788 6.18626 7.33323 5.93191 7.33323 5.66669C7.33323 5.40147 7.22788 5.14712 7.04034 4.95958C6.8528 4.77205 6.59845 4.66669 6.33323 4.66669ZM9.66657 9.33336C9.40135 9.33336 9.147 9.43871 8.95946 9.62625C8.77192 9.81379 8.66657 10.0681 8.66657 10.3334C8.66657 10.5986 8.77192 10.8529 8.95946 11.0405C9.147 11.228 9.40135 11.3334 9.66657 11.3334C9.93178 11.3334 10.1861 11.228 10.3737 11.0405C10.5612 10.8529 10.6666 10.5986 10.6666 10.3334C10.6666 10.0681 10.5612 9.81379 10.3737 9.62625C10.1861 9.43871 9.93178 9.33336 9.66657 9.33336ZM5.60657 11.3334L11.3332 5.60669L10.3932 4.66669L4.66657 10.3934L5.60657 11.3334Z",fill:"#FFE58F"})],-1),l("defs",null,[l("clipPath",{id:"clip0_745_62553"},[l("rect",{width:"16",height:"16",fill:"white"})])],-1)];function ML(e,t){return m(),x("svg",IL,PL)}const iv=Ke(AL,[["render",ML]]),OL={},RL={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},LL=[l("rect",{width:"16",height:"16",rx:"8",fill:"#FFF1B8"},null,-1),l("path",{d:"M5.60441 12.0963C5.1167 11.5747 4.62901 11.0323 4.31864 10.3856C4.00829 9.69707 3.91961 8.90427 4.0748 8.1532C4.22998 7.40213 4.58466 6.69278 5.09455 6.08775C5.05022 6.60934 5.24973 7.15177 5.62659 7.54818C5.4049 6.54675 5.7596 5.46186 6.46898 4.66906C7.17836 3.87627 8.15378 3.35467 9.17351 3C8.66364 3.50072 8.59714 4.29351 8.79665 4.96114C8.99617 5.62876 9.41737 6.21293 9.79423 6.81795C10.1711 7.42298 10.5258 8.04887 10.548 8.73736C10.7475 8.38269 10.9692 8.028 11.1022 7.63162C11.2352 7.23521 11.3017 6.81795 11.1909 6.42155C11.5899 6.88054 11.8116 7.33952 11.9224 7.92369C12.0332 8.50787 12.0111 9.11289 11.9446 9.69707C11.8559 10.3438 11.6786 11.0114 11.3017 11.5539C10.8584 12.2006 10.1489 12.6596 9.37306 12.91C7.99859 13.1395 6.64632 12.9517 5.60441 12.0963Z",fill:"#F3705A"},null,-1),l("path",{d:"M7.34185 12.8641C9.00724 13.5566 10.6523 11.4576 9.73839 9.83469C9.73839 9.81305 9.71807 9.81305 9.71807 9.79142C9.79932 10.6786 9.59621 11.3278 9.21032 11.6957C9.41343 11.1763 9.27125 10.5704 9.02753 10.0511C8.78382 9.5534 8.43856 9.09898 8.17453 8.62292C7.91049 8.12523 7.70741 7.56261 7.82927 7C7.34183 7.3895 6.99658 7.97375 6.8544 8.60127C6.71223 9.2288 6.79347 9.92126 7.0575 10.5055C6.75286 10.2675 6.52946 9.87798 6.50914 9.46684C6.18418 9.87798 5.9811 10.4189 6.00139 10.9599C6.00141 11.8038 6.631 12.5612 7.34185 12.8641Z",fill:"#FFD15C"},null,-1)];function DL(e,t){return m(),x("svg",RL,LL)}const av=Ke(OL,[["render",DL]]),lv={__name:"Badge",props:{variant:{type:String,default:"orange",validator:e=>["re_qua_troi","khong_dau_re_hon","re_nhat_roi","gia_re_giat_minh","khong_dau_re_bang","re_nhat_thi_truong","availability","gray"].includes(e)},size:{type:String,default:"md",validator:e=>["sm","md"].includes(e)}},setup(e){const t=e,n={availability:{icon:av,text:"",bg:"bg-gradient-to-r from-yellow-300 via-yellow-400 to-amber-500 text-red-700 shadow-sm"},re_qua_troi:{icon:iv,text:"RẺ QUÁ TRỜI!",bg:"bg-gradient-to-r from-red-600 to-red-800 text-yellow-300"},khong_dau_re_hon:{icon:Il,text:"KHÔNG ĐÂU RẺ HƠN",bg:"bg-gradient-to-r from-orange-400 to-red-600 text-yellow-200"},re_nhat_roi:{icon:ov,text:"RẺ NHẤT RỒI!",bg:"bg-gradient-to-r from-[#9C020C] via-[#C41E3A] to-[#800000] text-yellow-300 border border-red-950 shadow-xl"},gia_re_giat_minh:{icon:iv,text:"Giá RẺ GIẬT MÌNH!!!",bg:"bg-gradient-to-r from-yellow-300 via-yellow-200 to-yellow-100 text-red-600 border border-yellow-400"},khong_dau_re_bang:{icon:Il,text:"KHÔNG ĐÂU RẺ BẰNG",bg:"bg-gradient-to-r from-red-500 to-orange-600 text-yellow-300"},re_nhat_thi_truong:{icon:ov,text:"RẺ NHẤT THỊ TRƯỜNG",bg:"bg-gradient-to-r from-yellow-500 via-orange-400 to-red-600 text-yellow-100"},gray:{icon:null,text:"",bg:"bg-gray-200 text-gray-500 border border-gray-300"}},s=ee(()=>{var a;return((a=n[t.variant])==null?void 0:a.icon)||null}),r=ee(()=>{var a;return((a=n[t.variant])==null?void 0:a.text)||null}),o=ee(()=>{let a="";if(n[t.variant])a=n[t.variant].bg;else switch(t.variant){case"green":a="bg-green-gradient text-yellow-200";break;case"purple":a="bg-purple-gradient text-yellow-200";break;case"red":a="bg-red-gradient text-yellow-300";break;default:a="bg-orange-gradient text-red-800";break}return a}),i=ee(()=>t.size==="sm"?"pl-0.5 pr-1.5 py-[3px] text-xs rounded-full":"px-2 py-1.5 text-[15px] rounded-full");return(a,c)=>(m(),x("div",{class:te(["inline-flex items-center font-bold leading-none justify-center tracking-tight",[o.value,i.value]])},[s.value?(m(),oe(Nt(s.value),{key:0,class:te(["bg-red-gradient rounded-full",e.size==="sm"?"size-sm mr-px":"size-l mr-1"])},null,8,["class"])):q("",!0),It(a.$slots,"default",{},()=>[Be(j(r.value),1)])],2))}},jL={class:"relative w-full"},NL={key:0},FL={key:0},zL=Ke({__name:"ProgressSale",props:{dayToSale:{type:Number,default:null},endDate:{type:String,required:!0},flashSaleTo:{type:String,required:!0},flashSaleFrom:{type:String,required:!0}},setup(e){const t=e,n=R(0),s=R(0),r=R(0),o=R(0),i=R(!1),a=R(0),c=R(1);let u=null;const d=p=>String(p).padStart(2,"0"),f=p=>{if(!p)return null;const v=new Date(p);return isNaN(v.getTime())?null:v},h=()=>{const p=f(t.flashSaleFrom),v=f(t.flashSaleTo);if(!p||!v){a.value=0;return}a.value=Math.max(v.getTime()-p.getTime(),0)},g=()=>{const p=Date.now(),v=f(t.endDate),_=v?v.getTime():0,k=Math.max(_-p,0);if(k<=0||!v){n.value=0,s.value=0,r.value=0,o.value=0,c.value=100,i.value=!0,clearInterval(u);return}i.value=!1,n.value=Math.floor(k/(1e3*60*60*24)),s.value=Math.floor(k%(1e3*60*60*24)/(1e3*60*60)),r.value=Math.floor(k%(1e3*60*60)/(1e3*60)),o.value=Math.floor(k%(1e3*60)/1e3),a.value>0?c.value=Math.max(1,Math.min(100,Math.ceil(k*100/a.value))):c.value=100};return Pe(()=>t.endDate,()=>{h(),g(),clearInterval(u),u=setInterval(g,1e3)}),Qe(()=>{h(),g(),u=setInterval(g,1e3)}),Lt(()=>{clearInterval(u)}),(p,v)=>(m(),x("div",jL,[l("div",{class:te(["timer_deal_process h-[24px]",{is_ended_bg:i.value}])},[l("span",{style:ht({width:c.value+"%"}),class:te(["progress_bar_fill",{active:!i.value,is_ended_fill:i.value}])},null,6)],2),l("div",{class:te(["absolute top-1/2 -translate-y-1/2 left-[8px] font-semibold text-white label text-[11px] md:text-xs flex items-center gap-0.5",{"text-gray-500":i.value}])},[i.value?(m(),x("span",NL,"Chương trình đã kết thúc")):(m(),x(be,{key:1},[Be(" Còn "),n.value>0?(m(),x("span",FL,j(n.value)+" ngày ",1)):q("",!0),Be(j(d(s.value))+":"+j(d(r.value))+":"+j(d(o.value))+" ("+j(c.value)+"%) ",1)],64))],2)]))}},[["__scopeId","data-v-00204529"]]),qL={class:"relative flex flex-col h-full group bg-white border border-red-600 lg:border-gray-200 rounded-xl transition-all duration-300 lg:hover:border-red-600 lg:hover:rounded-b-none"},BL={class:"h-full flex flex-col relative overflow-hidden"},UL={key:0,class:"px-1.5 pt-1.5 pb-px"},VL=["src","alt"],HL={key:0,class:"absolute inset-0 flex items-center justify-center p-4 z-10"},WL=["src"],GL={class:"flex flex-col flex-1 px-2.5 pb-2 pt-1"},KL=["title"],QL={class:"flex flex-col gap-1 mb-2 mt-1"},JL={class:"flex items-center gap-2"},XL={class:"flex items-start justify-between flex-wrap"},ZL={key:0,class:"text-sm text-gray-500 line-through tracking-tight"},YL={class:"leading-none"},eD=Ke({__name:"CardProductVertical",props:{product:{type:Object,required:!0},ctaKey:{type:String,default:"available"},widgetSource:{type:String,default:"widget_pe_unknown"}},setup(e){const t="https://widget.geteasy.ai",n=e,s=ee(()=>{if(!n.product.discount)return"";const u=String(n.product.discount);return u.includes("%")||u.includes("-")?u:`-${u}%`}),r=ee(()=>{const u=`[${n.product.name}](${n.product.link})`;return{available:{label:"Check chi nhánh còn hàng",message:`Sản phẩm này có hàng ở chi nhánh nào? ${u}`},contact:{label:"Liên hệ tư vấn",message:`Liên hệ tư vấn sản phẩm này: ${u}`}}}),o=ee(()=>r.value[n.ctaKey]||r.value.available),i=()=>{var u;Fe.buttonClick({content:o.value.label,source:n.widgetSource}),(u=window.EasyAI)==null||u.send(o.value.message)},a=()=>{var u;Fe.buttonClick({content:"Tìm mẫu tương tự",source:n.widgetSource}),(u=window.EasyAI)==null||u.send(`${n.product.link}
Tìm mẫu tương tự cho sản phẩm này`)},c=()=>{Fe.productSelect({name:n.product.name,price:n.product.price,img:n.product.image,original_price:n.product.originalPrice,discount:n.product.discount,source:n.widgetSource})};return(u,d)=>(m(),x("div",qL,[l("div",BL,[e.product.badge?(m(),x("div",UL,[G(lv,{variant:e.product.badge},null,8,["variant"])])):q("",!0),(m(),oe(Nt(e.product.link?"a":"div"),{href:e.product.link||void 0,onClick:c,class:"aspect-[1/1] overflow-hidden bg-gray-50 relative block"},{default:Se(()=>[l("img",{src:e.product.image,alt:e.product.name,loading:"lazy",class:te(["w-full h-full object-contain md:group-hover:scale-105 transition-transform duration-500",{"opacity-50 grayscale-[50%]":e.product.stock_remaining===0}])},null,10,VL),e.product.stock_remaining===0?(m(),x("div",HL,[l("img",{src:y(t)+"/sold-out-min.webp",alt:"Cháy suất",class:"w-full h-auto object-contain"},null,8,WL)])):q("",!0)]),_:1},8,["href"])),l("div",GL,[(m(),oe(Nt(e.product.link?"a":"div"),{href:e.product.link||void 0,onClick:c,class:"block"},{default:Se(()=>[l("h3",{class:"text-sm sm:text-base font-semibold text-gray-900 md:hover:text-red-600 line-clamp-2 md:group-hover:text-red-600 transition-colors duration-300 cursor-pointer min-h-[2.5rem] mb-1",title:e.product.name},j(e.product.name),9,KL)]),_:1},8,["href"])),l("div",QL,[l("div",JL,[l("span",{class:te(["text-lg md:text-xl font-bold",e.product.stock_remaining===0?"text-gray-400":"text-red-600"])},j(e.product.price),3),e.product.price!=="Liên hệ"&&e.product.discount?(m(),x("div",{key:0,class:te(["rounded-md px-1 font-semibold text-[11px]",e.product.stock_remaining===0?"bg-gray-200 text-gray-500":"bg-red-500 text-white"])},j(s.value),3)):q("",!0)]),l("div",XL,[e.product.price!=="Liên hệ"&&e.product.originalPrice?(m(),x("span",ZL,j(e.product.originalPrice),1)):q("",!0),l("div",{class:te(["text-[11px] tracking-tight font-medium px-1 py-px border",e.product.stock_remaining===0?"bg-yellow-100 text-yellow-700 border-yellow-300":"text-red-600 bg-red-50 border-red-200"])},j(e.product.stock_remaining>0?"Còn "+e.product.stock_remaining+"/"+e.product.stock_total+" suất":"Suất này đã hết!"),3)])]),e.product.stock_remaining>0?(m(),oe(zL,{key:0,"end-date":e.product.endDate,"flash-sale-from":e.product.flashSaleFrom,"flash-sale-to":e.product.flashSaleTo},null,8,["end-date","flash-sale-from","flash-sale-to"])):(m(),x("button",{key:1,onClick:Gt(a,["stop","prevent"]),class:"w-full flex lg:hover:opacity-90 items-center justify-center gap-1 py-1.5 px-3 text-white bg-orange-gradient text-sm font-semibold rounded-lg border border-gray-200"},[G(y(cl),{size:"14","stroke-width":"2.5"}),Be(" Tìm mẫu tương tự ")]))])]),l("button",{onClick:i,class:"w-full gap-1 flex items-center justify-center hover:underline underline-offset-2 tracking-tight transition-all duration-300 z-50 rounded-b bg-orange-gradient text-white text-sm font-medium px-2 py-3 relative opacity-100 pointer-events-auto lg:absolute lg:bottom-0 lg:left-0 lg:right-0 lg:translate-y-full lg:opacity-0 lg:pointer-events-none lg:group-hover:opacity-100 lg:group-hover:pointer-events-auto lg:rounded-b-none lg:group-hover:rounded-b"},[l("span",YL,j(o.value.label),1)])]))}},[["__scopeId","data-v-006d9917"]]),cv=e=>(nn("data-v-ed6650e8"),e=e(),sn(),e),tD={key:0,class:"relative"},nD={class:"h-[64px] lg:h-[90px] flex items-end"},sD={class:"absolute inset-x-0 bottom-0 flex h-full justify-between px-2.5 xl:px-2 md:inset-x-8"},rD={class:"flex items-center -translate-y-2 w-full lg:w-fit"},oD={class:"flex gap-0.5 w-full lg:w-fit items-end overflow-x-auto eai-no-scrollbar"},iD=["onClick"],aD={class:"flex items-center gap-1 md:gap-2 uppercase whitespace-nowrap"},lD={key:0,style:{"box-shadow":"rgba(0, 0, 0, 0.35) 0px 4px 16px"},class:"hidden lg:flex items-center gap-2 bg-gradient-to-r from-red-700 to-red-500 rounded-t-3xl py-3 px-4 absolute -right-4 bottom-0"},cD={class:"p-1 flex relative items-center justify-center w-[160px] xl:w-[180px] bg-white rounded-xl border-4 border-[#FF9300]"},uD=["src"],dD={class:"flex flex-col md:flex-row items-center justify-center gap-2 md:gap-3 mt-1 relative z-30"},fD=cv(()=>l("div",{class:"text-white text-sm font-medium"}," Mỗi SĐT chỉ được mua 1 sản phẩm cùng loại ",-1)),hD=["href"],pD=cv(()=>l("span",{class:"font-bold uppercase text-[11px]"}," Gọi đặt trước ",-1)),mD=Object.freeze(Object.defineProperty({__proto__:null,default:Ke({__name:"WidgetFlashSale",props:{phoneNumber:{type:String,default:null},brandLogo:{type:String,default:null},ctaKey:{type:String,default:"available"}},setup(e){const t="https://widget.geteasy.ai",n=t+"/fs_header_bg.png",s=t+"/text_deal.png",r=t+"/fs_body_bg_mobile.webp",o=t+"/fs_badge_tab.webp",i=t+"/gift_right_icon.webp",a=t+"/fs_body_bg_desk.webp",c=R(!1),u=ee(()=>{var v,_;const p=[];return(v=ln.state.flash_sales)!=null&&v.length&&p.push({id:"flashsale",label:"FlashSale",icon:Il}),(_=ln.state.hot_sales)!=null&&_.length&&p.push({id:"hotsale",label:"HotSale",icon:av}),p}),d=R("");Pe(u,p=>{p.length>0&&!p.some(v=>v.id===d.value)&&(d.value=p[0].id)},{immediate:!0});const f=e,h=()=>{Fe.buttonClick({content:"Gọi đặt trước",source:"widget_pe_flash_sale",href:`tel:${f.phoneNumber}`})},g=ee(()=>d.value==="flashsale"?ln.state.flash_sales||[]:ln.state.hot_sales||[]);return(p,v)=>{var _,k;return(_=y(ln).state.flash_sales)!=null&&_.length||(k=y(ln).state.hot_sales)!=null&&k.length?(m(),x("div",tD,[l("div",nD,[l("div",{class:"relative h-[58px] w-[calc(100%-20px)] md:w-[calc(100%-76px)] mx-auto translate-y-1.5",style:ht({background:`url(${n}) center center / 100% 100% no-repeat`})},[l("div",sD,[l("div",rD,[l("div",oD,[(m(!0),x(be,null,Ie(u.value,w=>(m(),x("button",{key:w.id,onClick:$=>d.value=w.id,class:te(["flex-1 rounded-t-2xl min-w-0 group px-4 lg:px-6 xl:px-8 py-3 font-black md:py-2.5 text-lg md:text-2xl transition-all duration-300 relative overflow-hidden h-full flex items-center justify-center cursor-pointer",d.value===w.id?"text-white":"text-red-300/80 md:hover:text-white"]),style:ht({background:`url(${o}) center center / 100% 100% no-repeat`})},[l("div",aD,[w.icon?(m(),oe(Nt(w.icon),{key:0,class:te([d.value===w.id?"opacity-100 scale-110":"opacity-30 scale-90 md:group-hover:opacity-100 md:group-hover:scale-110","w-5 h-5 md:w-6 md:h-6 transition-all duration-300"])},null,8,["class"])):q("",!0),l("span",null,j(w.label),1)])],14,iD))),128))])]),e.brandLogo?(m(),x("div",lD,[l("img",{src:s,class:"w-[300px] shrink-0",alt:"Deal độc quyền từ"}),l("div",cD,[l("img",{src:e.brandLogo,class:"w-full h-full object-cover rounded-xl",alt:"Brand Logo"},null,8,uD),l("img",{alt:"Gift Box Right",class:"absolute -bottom-5 -right-12 size-16 animate-zoom",src:i})])])):q("",!0)])],4)]),l("div",{class:"px-2 md:px-4 pb-5 md:pb-8 pt-4 relative eai-main-container",style:ht({"--body-bg":`url(${a})`,"--body-bg-mobile":`url(${r})`})},[G(Ti,{"slides-per-view":1.4,"space-between":8,"allow-overflow":!0,breakpoints:{768:{slidesPerView:3},1024:{slidesPerView:4},1280:{slidesPerView:5}},"show-arrows":!0,"size-arrow":"xl",class:te(["p-2 md:p-4 md:pb-3",{"z-50":c.value}])},{default:Se(()=>[(m(!0),x(be,null,Ie(g.value,(w,$)=>(m(),oe(pl,{key:`${d.value}-${$}`},{default:Se(()=>[G(eD,{product:w,"cta-key":e.ctaKey,"widget-source":"widget_pe_flash_sale",onMouseenter:v[0]||(v[0]=E=>c.value=!0),onMouseleave:v[1]||(v[1]=E=>c.value=!1)},null,8,["product","cta-key"])]),_:2},1024))),128))]),_:1},8,["class"]),l("div",dD,[fD,e.phoneNumber?(m(),x("a",{key:0,href:`tel:${e.phoneNumber}`,onClick:h,class:"bg-white hover:bg-red-50 text-red-600 px-2 py-1 rounded-full flex items-center gap-1 shadow transition-all"},[G(y(ll),{class:"w-3 h-3 fill-red-600 eai-shake-icon"}),pD],8,hD)):q("",!0)])],4)])):q("",!0)}}},[["__scopeId","data-v-ed6650e8"]])},Symbol.toStringTag,{value:"Module"})),gD={class:"flex gap-2 items-start h-full"},vD={class:"flex-shrink-0"},yD={class:"w-[72px] h-[72px] flex items-center justify-center rounded bg-gray-50 overflow-hidden"},bD=["src","alt"],_D={class:"flex-1 flex flex-col min-w-0 h-full"},xD={class:"text-sm text-gray-900 group-hover:text-red-600 font-medium line-clamp-1 mb-1"},wD={class:"flex items-center justify-between"},kD={class:"flex items-center gap-1 flex-wrap"},SD={class:"text-sm font-semibold text-red-600 tracking-tight"},$D={key:0,class:"text-white bg-red-500 rounded-md px-1 font-semibold text-[10px]"},CD={key:0,class:"text-[11px] mt-1 w-fit tracking-tight text-red-600 font-medium px-1 py-px bg-red-50 border border-red-200"},TD=Ke({__name:"CardProductHorizontal",props:{image:{type:String,required:!0},name:{type:String,required:!0},price:{type:String,required:!0},originalPrice:{type:String,default:null},discount:{type:[String,Number],default:null},badge:{type:String,default:null},link:{type:String,default:null},stock_remaining:{type:Number,default:null},stock_total:{type:Number,default:null},sale_ends_at:{type:String,default:null},widgetSource:{type:String,default:"widget_pe_unknown"}},emits:["cta-click"],setup(e){const t=e,n=ee(()=>{if(!t.discount)return"";const r=String(t.discount);return r.includes("%")||r.includes("-")?r:`-${r}%`}),s=()=>{Fe.productSelect({name:t.name,price:t.price,img:t.image,original_price:t.originalPrice,discount:t.discount,source:t.widgetSource})};return(r,o)=>(m(),oe(Nt(e.link?"a":"div"),{href:e.link||void 0,onClick:s,class:"group relative bg-white border border-gray-200 rounded-lg p-2 cursor-pointer block transition-colors duration-200"},{default:Se(()=>[l("div",gD,[l("div",vD,[l("div",yD,[l("img",{src:e.image,alt:e.name,loading:"lazy",class:"w-full h-full object-contain"},null,8,bD)])]),l("div",_D,[l("h3",xD,j(e.name),1),l("div",null,[l("div",wD,[l("div",kD,[l("span",SD,j(e.price),1),e.price!=="Liên hệ"&&e.discount?(m(),x("div",$D,j(n.value),1)):q("",!0)])]),e.stock_remaining!=null&&e.stock_total?(m(),x("div",CD," Còn "+j(e.stock_remaining)+"/"+j(e.stock_total)+" suất ",1)):q("",!0)])])])]),_:1},8,["href"]))}},[["__scopeId","data-v-10679a4a"]]),ED={class:"relative"},AD={class:"mb-1"},ID={class:"text-lg font-bold"},PD=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetRecommendation",props:{title:{type:String,default:"Có thể bạn sẽ thích"},autoplay:{type:Boolean,default:!1},dataKey:{type:String,default:"you_may_like"},breakpoints:{type:Object,default:()=>({768:{slidesPerView:2.5},1024:{slidesPerView:3.2},1280:{slidesPerView:4}})}},setup(e){const t=e,n=ee(()=>ln.state[t.dataKey]||[]);return(s,r)=>(m(),x("div",ED,[l("div",AD,[l("h2",ID,j(e.title),1)]),G(Ti,{loop:!1,autoplay:e.autoplay,"size-arrow":"lg","slides-per-view":1.2,"space-between":8,breakpoints:e.breakpoints},{default:Se(()=>[(m(!0),x(be,null,Ie(n.value,(o,i)=>(m(),oe(pl,{key:i},{default:Se(()=>[G(TD,xn(o,{"widget-source":`widget_pe_${e.dataKey}`}),null,16,["widget-source"])]),_:2},1024))),128))]),_:1},8,["autoplay","breakpoints"])]))}}},Symbol.toStringTag,{value:"Module"})),MD={},OD={width:"16",height:"26",viewBox:"0 0 16 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"text-yellow-400"},RD=[l("path",{d:"M5.27059 0C7.54353 0 9.82118 0 12.0941 0C12.64 0.324982 12.7388 0.639809 12.48 1.26946C11.6141 3.39708 10.7435 5.51962 9.87765 7.64724C9.84471 7.72849 9.81647 7.80973 9.77882 7.91637C9.90118 7.91637 9.98588 7.91637 10.0706 7.91637C11.7412 7.91637 13.4118 7.92652 15.0824 7.91129C15.5153 7.90621 15.8259 8.04839 16 8.48508C16 8.62219 16 8.75421 16 8.89131C15.92 9.02334 15.8447 9.16044 15.7647 9.29246C12.7953 14.284 9.82118 19.2755 6.85177 24.267C6.57882 24.724 6.31529 25.181 6.03765 25.6279C5.75059 26.0849 5.20941 26.1255 4.89882 25.7244C4.71529 25.4857 4.71529 25.2166 4.78118 24.9322C5.45882 21.9922 6.13647 19.047 6.81412 16.1069C6.92235 15.6398 7.02588 15.1777 7.13412 14.6801C7.00706 14.6801 6.91294 14.6801 6.82353 14.6801C4.85647 14.6801 2.88941 14.6699 0.922353 14.6851C0.484706 14.6902 0.174118 14.5531 0 14.1164C0 13.9793 0 13.8473 0 13.7102C0.0329412 13.6391 0.0752941 13.568 0.103529 13.4918C1.63765 9.2163 3.17176 4.93567 4.70118 0.655042C4.81412 0.345294 4.97412 0.111713 5.27059 0Z",fill:"currentColor"},null,-1)];function LD(e,t){return m(),x("svg",OD,RD)}const DD=Ke(MD,[["render",LD]]),jD={class:"flex flex-col items-center"},ND={class:"leading-none"},FD={class:"flex flex-col items-center"},zD={class:"leading-none"},qD={class:"flex flex-col items-center"},BD={class:"leading-none"},UD=Ke({__name:"CountDownProduct",props:{endDate:{type:String,required:!0},size:{type:String,default:"md",validator:e=>["sm","md","lg"].includes(e)},showLabel:{type:Boolean,default:!1},isSoldOut:{type:Boolean,default:!1}},emits:["end-flash-sales"],setup(e,{emit:t}){const n=e,s=t;R(0);const r=R(0),o=R(0),i=R(0),a=R(!1);let c=null;const u=ee(()=>{switch(n.size){case"sm":return"size-5 text-[10px]";case"lg":return"size-9 text-lg";default:return"size-6 text-xs"}}),d=ee(()=>{switch(n.size){case"lg":return"text-[10px]";default:return"text-[8px]"}}),f=_=>String(_??0).padStart(2,"0"),h=_=>{if(!_)return null;const k=_.replace(" ","T"),w=new Date(k);return isNaN(w.getTime())?null:w},g=_=>{r.value=Math.floor(_/(1e3*60*60)),o.value=Math.floor(_%(1e3*60*60)/(1e3*60)),i.value=Math.floor(_%(1e3*60)/1e3)},p=()=>{const _=h(n.endDate);if(!_){a.value=!0,clearInterval(c);return}const k=Math.max(_.getTime()-Date.now(),0);g(k),k===0?(a.value=!0,clearInterval(c),c=null,s("end-flash-sales")):a.value=!1},v=()=>{clearInterval(c),p(),c=setInterval(p,1e3)};return Pe(()=>n.endDate,v),Qe(v),Lt(()=>clearInterval(c)),(_,k)=>a.value?(m(),x("div",{key:1,class:te(["text-red-500 font-bold italic",[e.size==="lg"?"text-sm":"text-[10px]"]])}," Chương trình đã kết thúc ",2)):(m(),x("div",{key:0,class:te(["flex items-center",[e.size==="lg"?"gap-2":"gap-0.5"]])},[l("div",jD,[l("div",{class:te(["rounded-md bg-yellow-50 flex items-center justify-center font-bold text-red-600 leading-none shadow-sm",u.value])},[l("span",ND,j(f(r.value)),1)],2),e.showLabel?(m(),x("span",{key:0,class:te(["text-white font-bold mt-1 uppercase tracking-tighter",d.value])},"Giờ",2)):q("",!0)]),e.showLabel?q("",!0):(m(),x("span",{key:0,class:te(["text-white font-bold",[e.size==="lg"?"text-lg pb-0.5":"text-xs pb-0.5"]])},":",2)),l("div",FD,[l("div",{class:te(["rounded-md bg-yellow-50 flex items-center justify-center font-bold text-red-600 leading-none shadow-sm",u.value])},[l("span",zD,j(f(o.value)),1)],2),e.showLabel?(m(),x("span",{key:0,class:te(["text-white font-bold mt-1 uppercase tracking-tighter",d.value])},"Phút",2)):q("",!0)]),e.showLabel?q("",!0):(m(),x("span",{key:1,class:te(["text-white font-bold",[e.size==="lg"?"text-lg pb-0.5":"text-xs pb-0.5"]])},":",2)),l("div",qD,[l("div",{class:te(["rounded-md bg-yellow-50 flex items-center justify-center font-bold text-red-600 leading-none shadow-sm",u.value])},[l("span",BD,j(f(i.value)),1)],2),e.showLabel?(m(),x("span",{key:0,class:te(["text-white font-bold mt-1 uppercase tracking-tighter",d.value])},"Giây",2)):q("",!0)])],2))}},[["__scopeId","data-v-97daa3d7"]]),vo=e=>(nn("data-v-d39ca5f1"),e=e(),sn(),e),VD={class:"flex items-center"},HD={class:"flex items-center relative z-10 shrink-0 gap-1 mr-2"},WD=vo(()=>l("span",{class:"text-white font-bold text-lg"},"Flash Sale",-1)),GD={key:0},KD={class:"text-gray-900 text-[11px] tracking-tight"},QD={key:0,class:"flex items-center text-[11px] text-white mt-2"},JD=vo(()=>l("span",{class:"leading-3"},"Có ",-1)),XD={class:"relative min-w-[18px] h-[14px] mx-0.5 overflow-hidden flex items-center justify-center"},ZD=vo(()=>l("span",{class:"leading-3"},"khách đang xem.",-1)),YD={key:0,class:"relative z-10 space-y-1.5 mt-2.5 md:mt-3"},ej=vo(()=>l("div",{class:"w-px h-4 bg-gray-300 shrink-0"},null,-1)),tj={class:"text-[10px] text-white italic leading-none min-h-[14px]"},nj={key:0,class:"font-medium"},sj={key:1},rj={key:1,class:"absolute top-1.5 right-1 z-20"},oj=["src"],ij={key:0,class:"relative z-10 px-2.5 pt-2.5 pb-2"},aj={class:"flex items-center text-xs font-semibold text-orange-500 mb-1.5"},lj=vo(()=>l("span",{class:"leading-none"},"Đăng ký nhận giá tốt",-1)),cj=vo(()=>l("div",{class:"w-px h-4 bg-gray-300 shrink-0"},null,-1)),uj={class:"text-[11px] italic leading-none min-h-[14px] mt-1.5"},dj={key:0,class:"font-medium text-green-600"},fj={key:1,class:"text-gray-700"},hj=Object.freeze(Object.defineProperty({__proto__:null,default:Ke({__name:"ProductFlashSale",props:{product:{type:Object,default:null},productId:{type:[String,Number],default:null},showSocialProof:{type:Boolean,default:!0},showRegistrationForm:{type:Boolean,default:!0},flashSaleList:{type:Array,default:()=>[]}},emits:["end-flash-sales"],setup(e,{emit:t}){var M,L;const n="https://widget.geteasy.ai",s=e,r=ee(()=>{if(s.product)return s.product;const V=window.location.pathname;return(ln.state.flash_sales??[]).find(T=>T.link&&T.link.includes(V))??null}),o=ee(()=>{var X;const V=(X=r.value)==null?void 0:X.sale_ends_at;if(V){const T=new Date(V);if(!isNaN(T.getTime())&&T>new Date)return V}return Ja(1)}),i=t,a=R(""),c=R(""),u=R(!1),d=R(!1),f=R(((M=r.value)==null?void 0:M.viewing_now)||ln.state.signals.viewing_now||12),h=R(!1),g=ee(()=>a.value.trim().length>0),p=ee(()=>{var V;return((V=r.value)==null?void 0:V.ordered_by)??[]}),v=ee(()=>{var V;return((V=r.value)==null?void 0:V.ordered_count)??p.value.length}),_=R(!1),k=()=>{const V=p.value.map(X=>({name:X.name,phone:X.phone,time:X.ordered_at}));pw(V)},w=ee(()=>{const V=c.value.trim();return V?/^(0|84|\+84)(3|5|7|8|9)([0-9]{8})$/.test(V):!1}),$=async()=>{var V;if(h.value=!0,!g.value||!w.value){_.value=!1,setTimeout(()=>{_.value=!0},10);return}try{if(u.value=!0,await new Promise(X=>setTimeout(X,1e3)),d.value=!0,Fe.generateLead({name:a.value,phone:c.value,page_url:window.location.href,source:"widget_pe_flash_sale_form"}),(V=window.EasyAI)!=null&&V.send&&r.value){const T=r.value.stock_remaining===0?"nhận ưu đãi giá tốt":"nhận suất Flash Sale",A=`[${r.value.name}](${r.value.link||window.location.href})`,D=`- Khách hàng: ${a.value}
- Số điện thoại: ${c.value}
- Nhu cầu: Đăng ký ${T} sản phẩm ${A}`;window.EasyAI.send(D)}a.value="",c.value=""}catch(X){console.error("Registration failed:",X)}finally{u.value=!1}};let E=null;const P=((L=r.value)==null?void 0:L.viewing_now)||ln.state.signals.viewing_now||71;Qe(()=>{E=setInterval(()=>{const V=Math.floor(Math.random()*7)-3;let X=f.value+V;X>P+10&&(X=P+10),X<P-10&&(X=P-10),X<1&&(X=1),f.value=X},3500)}),Lt(()=>{E&&clearInterval(E)});const I=()=>{i("end-flash-sales",s.productId)};return(V,X)=>{var T,A,D,Q,W,H,K;return r.value?(m(),x("div",{key:0,class:te(["rounded-xl overflow-hidden",((T=r.value)==null?void 0:T.stock_remaining)>0?"":"bg-gray-50 border border-gray-200"])},[l("div",{class:te(["relative px-2.5 py-3 overflow-hidden eai-product-flash-sale",((A=r.value)==null?void 0:A.stock_remaining)===0?"grayscale":""])},[l("div",null,[l("div",VD,[l("div",HD,[G(DD,{class:"!text-white"}),WD]),((D=r.value)==null?void 0:D.stock_remaining)>0?(m(),x("div",GD,[G(UD,{"end-date":o.value,onEndFlashSales:I},null,8,["end-date"])])):q("",!0),((Q=r.value)==null?void 0:Q.stock_remaining)>0?(m(),oe(lv,{key:1,variant:"availability",size:"sm",class:"ml-auto"},{default:Se(()=>{var F;return[l("span",KD,[((F=r.value)==null?void 0:F.stock_remaining)!=null?(m(),x(be,{key:0},[Be(" Còn "+j(r.value.stock_remaining)+"/"+j(r.value.stock_total??10)+" suất ",1)],64)):(m(),x(be,{key:1},[Be("Còn vài suất")],64))])]}),_:1})):q("",!0)]),e.showSocialProof?(m(),x("div",QD,[G(y(y2),{size:"15",class:"mr-0.5"}),JD,l("div",XD,[G(Yt,{name:"slide-up"},{default:Se(()=>[(m(),x("span",{key:f.value,class:"absolute inset-x-0 w-full text-center font-semibold text-white"},j(f.value),1))]),_:1})]),ZD,v.value>0?(m(),x("button",{key:0,class:"shrink-0 ml-0.5 font-medium text-white underline px-1 rounded transition-all hover:text-white",onClick:k},j(v.value)+" khách đã đặt ",1)):q("",!0)])):q("",!0)]),((W=r.value)==null?void 0:W.stock_remaining)>0&&e.showRegistrationForm?(m(),x("div",YD,[l("div",{class:te(["flex items-center bg-white rounded-md p-0.5 h-8 shadow-sm transition-all duration-300 border",[_.value?"shake-error":"",h.value&&!d.value&&(!g.value||!w.value)?"border-red-500":"border-transparent"]])},[Rt(l("input",{"onUpdate:modelValue":X[0]||(X[0]=F=>a.value=F),type:"text",placeholder:"Họ và tên",class:te(["flex-1 min-w-0 bg-transparent border-none focus:ring-0 text-[13px] px-2 py-0 h-full focus-within:outline-none",[h.value&&!d.value&&!g.value?"text-red-500 placeholder:text-red-400":"text-gray-900 placeholder:text-gray-500"]]),onKeyup:mr($,["enter"])},null,34),[[on,a.value]]),ej,Rt(l("input",{"onUpdate:modelValue":X[1]||(X[1]=F=>c.value=F),type:"tel",placeholder:"Số điện thoại",class:te(["flex-1 min-w-0 bg-transparent border-none focus:ring-0 text-[13px] px-2 py-0 h-full focus-within:outline-none",[h.value&&!d.value&&!w.value?"text-red-500 placeholder:text-red-400":"text-gray-900 placeholder:text-gray-500"]]),onKeyup:mr($,["enter"])},null,34),[[on,c.value]]),l("button",{class:te(["bg-orange-gradient px-2.5 py-0 rounded-md text-white font-semibold text-xs whitespace-nowrap h-[26px] flex items-center shrink-0 ml-0.5",u.value&&"opacity-50 cursor-not-allowed"]),onClick:$},j(u.value?"Đang gửi":"Đặt ngay"),3)],2),l("div",tj,[d.value?(m(),x("span",nj," Cảm ơn bạn! Chúng tôi sẽ liên hệ tư vấn sớm nhất. ")):(m(),x("span",sj," * Lưu ý: Số lượng & thời gian có hạn. Vui lòng điền thông tin để giữ suất. "))])])):q("",!0),((H=r.value)==null?void 0:H.stock_remaining)===0?(m(),x("div",rj,[l("img",{src:y(n)+"/soldout-min.webp",alt:"Cháy suất",class:"w-[120px] object-contain"},null,8,oj)])):q("",!0)],2),((K=r.value)==null?void 0:K.stock_remaining)===0&&e.showRegistrationForm?(m(),x("div",ij,[l("div",aj,[G(y(x2),{size:"16",class:"mr-0.5"}),lj]),l("div",{class:te(["flex items-center bg-white rounded-md p-0.5 h-8 shadow-sm transition-all duration-300 border border-gray-200",[_.value?"shake-error":"",h.value&&!d.value&&(!g.value||!w.value)?"border-red-500":""]])},[Rt(l("input",{"onUpdate:modelValue":X[2]||(X[2]=F=>a.value=F),type:"text",placeholder:"Họ và tên",class:te(["flex-1 min-w-0 bg-transparent border-none focus:ring-0 text-[13px] px-2 py-0 h-full focus-within:outline-none",[h.value&&!d.value&&!g.value?"text-red-500 placeholder:text-red-400":"text-gray-900 placeholder:text-gray-500"]]),onKeyup:mr($,["enter"])},null,34),[[on,a.value]]),cj,Rt(l("input",{"onUpdate:modelValue":X[3]||(X[3]=F=>c.value=F),type:"tel",placeholder:"Số điện thoại",class:te(["flex-1 min-w-0 bg-transparent border-none focus:ring-0 text-[13px] px-2 py-0 h-full focus-within:outline-none",[h.value&&!d.value&&!w.value?"text-red-500 placeholder:text-red-400":"text-gray-900 placeholder:text-gray-500"]]),onKeyup:mr($,["enter"])},null,34),[[on,c.value]]),l("button",{class:te(["bg-orange-gradient px-2.5 py-0 rounded-md text-white font-semibold text-xs whitespace-nowrap h-[26px] flex items-center shrink-0 ml-0.5",u.value&&"opacity-50 cursor-not-allowed"]),onClick:$},j(u.value?"Đang gửi":"Đăng ký"),3)],2),l("div",uj,[d.value?(m(),x("span",dj," Cảm ơn bạn! Chúng tôi sẽ liên hệ tư vấn sớm nhất. ")):(m(),x("span",fj," * Lưu ý: Suất hiện tại đã hết! Để lại thông tin để nhận tư vấn giá tốt nhất. "))])])):q("",!0)],2)):q("",!0)}}},[["__scopeId","data-v-d39ca5f1"]])},Symbol.toStringTag,{value:"Module"})),pj={key:0,class:"shrink-0"},mj={class:"size-12 shrink-0 flex items-center justify-center cursor-pointer overflow-hidden"},gj=["src","alt"],vj={class:"flex-1 min-w-0 py-1 cursor-pointer"},yj={class:"text-sm line-clamp-2 leading-5 text-gray-900 md:group-hover:text-orange-600 transition-colors duration-300"},bj={class:"shrink-0 text-right flex flex-col justify-center cursor-pointer tracking-tight"},_j={key:0,class:"flex items-center justify-end gap-1 mb-1"},xj={class:"text-[10px] text-red-500 font-semibold bg-red-100 px-1 rounded"},wj={class:"text-[10px] text-gray-400 line-through"},kj={class:"text-sm font-bold text-red-500"},uv=Ke({__name:"RCMProductCombo",props:{product:{type:Object,required:!0},isSelected:{type:Boolean,default:!0},showCheckbox:{type:Boolean,default:!0},highlight:{type:Boolean,default:!1}},emits:["toggle"],setup(e){const t=s=>et(s),n=(s,r)=>{if(!s||!r)return"";const o=parseFloat(s),i=parseFloat(r);return i<=o?"":`-${Math.round((1-o/i)*100)}%`};return(s,r)=>(m(),x("div",{class:te(["flex items-center gap-2 pr-3 py-2.5 pl-2 transition-all h-full group",[e.highlight?"bg-white":"md:hover:bg-orange-50 cursor-pointer"]]),onClick:r[1]||(r[1]=o=>e.highlight?null:s.$emit("toggle"))},[e.showCheckbox?(m(),x("div",pj,[l("button",{onClick:r[0]||(r[0]=Gt(o=>s.$emit("toggle"),["stop"])),class:te(["size-4 rounded flex items-center text-white justify-center transition-colors cursor-pointer border",e.isSelected?"bg-orange-600 border-orange-600 ":"bg-white border-gray-300"])},[e.isSelected?(m(),oe(y(ol),{key:0,size:12,"stroke-width":"3"})):q("",!0)],2)])):q("",!0),l("div",mj,[l("img",{src:e.product.properties.image,class:"w-full h-full object-contain",alt:e.product.properties.name},null,8,gj)]),l("div",vj,[l("h3",yj,j(e.product.properties.name),1)]),l("div",bj,[e.product.properties.originalPrice?(m(),x("div",_j,[l("span",xj,j(n(e.product.properties.price,e.product.properties.originalPrice)),1),l("span",wj,j(t(e.product.properties.originalPrice)),1)])):q("",!0),l("div",kj,j(t(e.product.properties.price)),1)])],2))}},[["__scopeId","data-v-742576ca"]]),Or=e=>(nn("data-v-3a2e4a9d"),e=e(),sn(),e),Sj={key:0},$j=Or(()=>l("h2",{class:"text-base font-semibold text-gray-900 mb-3"},[l("span",{class:"text-white font-semibold text-xs tracking-tight bg-red-600 px-1.5 py-1 rounded"},"Ưu đãi"),Be(" Mua kèm dành riêng cho bạn ")],-1)),Cj={class:"flex-1 space-y-1"},Tj={class:"text-[11px] leading-none"},Ej=Or(()=>l("span",{class:"font-normal"},"Bạn đã được thưởng",-1)),Aj=Or(()=>l("span",{class:"text-teal-600 font-bold ml-1 mr-0.5"},"Miễn phí vận chuyển",-1)),Ij=Or(()=>l("span",{class:"font-normal"},"!",-1)),Pj=Or(()=>l("span",{class:"font-normal"},"Chọn thêm",-1)),Mj={class:"text-orange-600 font-bold mx-1"},Oj=Or(()=>l("span",{class:"font-normal"},[Be("sản phẩm để được "),l("span",{class:"font-bold"},"Miễn phí vận chuyển")],-1)),Rj={class:"w-full h-0.5 bg-gray-200 rounded-full overflow-hidden"},Lj={key:0,class:"border border-gray-300 rounded-lg overflow-hidden bg-white"},Dj={class:"flex justify-center relative z-10 my-1"},jj={class:"size-4 flex items-center justify-center bg-gray-400 rounded-full"},Nj={key:1,class:"border border-gray-200 rounded-lg overflow-hidden bg-white divide-y divide-gray-100"},Fj={class:"border-t border-gray-50"},zj={class:"flex-1 min-w-0 flex items-center gap-1.5"},qj={class:"text-xs text-gray-900 font-medium"},Bj={class:"flex items-center gap-1"},Uj={class:"text-xs w-14 text-red-600 font-semibold whitespace-nowrap"},Vj={key:0,class:"bg-orange-50/50 px-2.5 py-3 space-y-2 overflow-hidden"},Hj=["onClick"],Wj={class:"flex flex-col gap-1 absolute -left-1.5 top-1/2 -translate-y-1/2"},Gj={class:"size-2.5 rounded-full bg-orange-50"},Kj={class:"h-[72px] w-[78px] flex items-center justify-center text-white bg-orange-gradient"},Qj={class:"flex flex-col items-center gap-0 text-xs text-orange-50"},Jj={class:"flex-1 h-[72px] border border-l-0 border-gray-200 rounded-r-md min-w-0 flex items-center gap-2 pl-3 pr-2"},Xj={class:"flex-1"},Zj={class:"text-sm font-semibold text-gray-900"},Yj={class:"text-[10px] leading-3 text-gray-900"},eN={class:"mt-1.5 flex items-center pr-8"},tN={class:"flex-1 h-1 bg-gray-200 rounded-full overflow-hidden"},nN={class:"flex items-center gap-1 mt-0.5 pr-2"},sN={key:1,class:"text-[10px] leading-3 text-gray-700"},rN={class:"text-[10px] leading-3 text-gray-700"},oN={class:"flex flex-col gap-1 mt-2.5 px-0.5"},iN=Or(()=>l("span",null,"Nhận ưu đãi",-1)),aN={class:"text-[10px] font-normal opacity-90"},lN=Object.freeze(Object.defineProperty({__proto__:null,default:Ke({__name:"WidgetCombo",props:{dataKey:{type:String,default:"also_bought"}},setup(e){const t=e,n=R(!1),s=R(null),r=T=>{const A=Math.floor(T/3600),D=Math.floor(T%3600/60),Q=T%60;return`${String(A).padStart(2,"0")}:${String(D).padStart(2,"0")}:${String(Q).padStart(2,"0")}`};let o;Qe(()=>{o=setInterval(()=>{i.value.forEach(T=>{T.remainingTime>0&&T.remainingTime--})},1e3)}),Lt(()=>{o&&clearInterval(o)});const i=R([{id:"V1",title:"Giảm 12% Tối đa 99k",minOrder:25e4,type:"percentage",value:12,maxDiscount:99e3,totalTime:10*3600,remainingTime:8*3600+45*60,tag:null},{id:"V2",title:"Giảm trực tiếp 200k",minOrder:15e5,type:"flat",value:2e5,totalTime:5*3600,remainingTime:35*60+20,tag:"Sắp hết hạn"}]),a=T=>{s.value===T?s.value=null:s.value=T},c=ee(()=>i.value.find(T=>T.id===s.value)),u=ee(()=>{if(!i.value.length)return"00:00:00";if(c.value)return r(Math.max(0,c.value.remainingTime));const T=Math.min(...i.value.map(A=>A.remainingTime));return r(Math.max(0,T))}),d=ee(()=>{const T=ln.state.source_product,A=(ln.state[t.dataKey]||[]).slice(0,2);return!T&&(!A||A.length===0)?[]:[T,...A].filter(Boolean)}),f=ee(()=>d.value&&d.value.length>0?d.value[0]:null),h=ee(()=>d.value&&d.value.length>1?d.value.slice(1,3):[]),g=R([]),p=T=>{const A=g.value.indexOf(T);A>-1?g.value.splice(A,1):g.value.push(T)},v=T=>g.value.includes(T),_=ee(()=>(f.value?1:0)+g.value.length),k=ee(()=>(f.value?1:0)+h.value.length),w=ee(()=>k.value===0?0:Math.round(_.value/k.value*100)),$=ee(()=>w.value>=100),E=T=>et(T),P=T=>{if(!T)return 0;const A=parseFloat(T);return isNaN(A)?0:A},I=ee(()=>{let T=0;const A=D=>{const Q=P(D.originalPrice),W=P(D.price);return!Q||Q<=0?W:Math.max(Q,W)};return f.value&&(T+=A(f.value.properties)),h.value.forEach((D,Q)=>{v(Q)&&(T+=A(D.properties))}),T}),M=ee(()=>{let T=0;return f.value&&(T+=P(f.value.properties.price)),h.value.forEach((A,D)=>{v(D)&&(T+=P(A.properties.price))}),T}),L=ee(()=>{const T=M.value;if(c.value){const A=c.value;if(T>=(A.minOrder||0)){let D=0;return A.type==="percentage"?(D=Math.floor(T*A.value/100),A.maxDiscount&&(D=Math.min(D,A.maxDiscount))):D=A.value,Math.max(0,T-D)}}return T}),V=ee(()=>Math.max(0,I.value-L.value)),X=()=>{var Q,W,H,K;const T=`[${(W=(Q=f.value)==null?void 0:Q.properties)==null?void 0:W.name}](${((K=(H=f.value)==null?void 0:H.properties)==null?void 0:K.url)||window.location.href})`,A=h.value.filter((F,ne)=>v(ne)).map(F=>{var ne,fe;return`[${(ne=F.properties)==null?void 0:ne.name}](${((fe=F.properties)==null?void 0:fe.url)||window.location.href})`});let D=`Nhận khuyến mãi combo:
`;D+=`- Sản phẩm chính: ${T}
`,A.length>0&&(D+=`- Sản phẩm mua kèm: ${A.join(", ")}
`),c.value&&(D+=`- Voucher: ${c.value.title}
`),D+=`- Vận chuyển: ${$.value?"Miễn phí vận chuyển":"Có phí vận chuyển"}
`,alert(D)};return Pe(()=>h.value,T=>{T&&T.length>0&&(g.value=T.map((A,D)=>D))},{immediate:!0}),(T,A)=>f.value?(m(),x("div",Sj,[$j,l("div",{class:te(["flex items-center px-2 py-1.5 rounded-md mb-1.5 transition-colors duration-300",$.value?"bg-teal-50":"bg-orange-50"])},[l("div",{class:te(["size-5 rounded-full flex items-center justify-center mr-1.5 transition-colors duration-300",$.value?"bg-teal-500":"bg-orange-500"])},[G(y(B2),{size:"12","stroke-width":"2",class:"text-white"})],2),l("div",Cj,[l("div",Tj,[$.value?(m(),x(be,{key:0},[Ej,Aj,Ij],64)):(m(),x(be,{key:1},[Pj,l("span",Mj,j(k.value-_.value),1),Oj],64))]),l("div",Rj,[l("div",{class:te(["h-full transition-all duration-500",$.value?"bg-teal-500":"bg-orange-500"]),style:ht({width:`${w.value}%`})},null,6)])])],2),f.value?(m(),x("div",Lj,[G(uv,{product:f.value,"show-checkbox":!1,highlight:""},null,8,["product"])])):q("",!0),l("div",Dj,[l("div",jj,[G(y(ng),{size:10,class:"text-white","stroke-width":"2"})])]),h.value.length>0?(m(),x("div",Nj,[(m(!0),x(be,null,Ie(h.value,(D,Q)=>(m(),oe(uv,{key:D.properties.id||Q,product:D,"is-selected":v(Q),onToggle:W=>p(Q)},null,8,["product","is-selected","onToggle"]))),128)),l("div",Fj,[l("div",{class:"flex bg-orange-50 items-center gap-1.5 py-2 pl-3 pr-2 cursor-pointer transition-colors group",onClick:A[0]||(A[0]=D=>n.value=!n.value)},[G(y(rg),{size:"16",class:"text-orange-600 transition-transform"}),l("div",zj,[l("span",qj,j(c.value?c.value.title:"Voucher giảm đến 200k sắp hết hạn"),1)]),l("div",Bj,[l("div",Uj,j(u.value),1),G(y(Ir),{size:"14",class:te(["text-gray-700 transition-transform duration-300",n.value?"rotate-90":""])},null,8,["class"])])]),G(Yt,{name:"expand"},{default:Se(()=>[n.value?(m(),x("div",Vj,[(m(!0),x(be,null,Ie(i.value,D=>(m(),x("div",{key:D.id,class:"bg-white overflow-hidden rounded-md flex items-center cursor-pointer group transition-all relative",onClick:Q=>a(D.id)},[l("div",Wj,[(m(),x(be,null,Ie(4,Q=>l("div",Gj)),64))]),l("div",Kj,[l("div",Qj,[G(y(rg),{size:"18"}),Be(" Giảm giá ")])]),l("div",Jj,[l("div",Xj,[l("div",Zj,j(D.title),1),l("div",Yj," Đơn tối thiểu "+j(E(D.minOrder)),1),l("div",eN,[l("div",tN,[l("div",{class:"h-full voucher-progress transition-all duration-500 rounded-full",style:ht({width:`${D.remainingTime/D.totalTime*100}%`})},null,4)])]),l("div",nN,[D.tag?(m(),x("div",{key:0,class:te(["text-[10px] leading-3",D.id==="V2"?"text-red-600":"text-gray-700"])},j(D.tag),3)):q("",!0),D.tag?(m(),x("span",sN,"•")):q("",!0),l("div",rN," Hết hạn trong "+j(r(D.remainingTime)),1)])]),l("div",{class:te(["size-5 text-white rounded-full border flex items-center justify-center transition-all shrink-0",s.value===D.id?"bg-orange-500 border-orange-500 ":"bg-white border-gray-200 group-hover:bg-orange-100 group-hover:border-orange-400"])},[s.value===D.id?(m(),oe(y(ol),{key:0,size:12,"stroke-width":"3"})):q("",!0)],2)])],8,Hj))),128))])):q("",!0)]),_:1})])])):q("",!0),l("div",oN,[l("button",{onClick:X,class:"px-4 py-1.5 rounded-lg font-semibold text-sm transition-all duration-200 bg-red-500 text-white shadow-sm md:hover:bg-red-600 active:scale-95 flex flex-col items-center justify-center leading-tight gap-0.5"},[iN,l("span",aN,"Tổng "+j(E(L.value))+" - Tiết kiệm "+j(E(V.value)),1)])])])):q("",!0)}},[["__scopeId","data-v-3a2e4a9d"]])},Symbol.toStringTag,{value:"Module"})),dv=e=>(nn("data-v-b2e81a91"),e=e(),sn(),e),cN=["id"],uN={class:"fc-card"},dN={class:"fc-card__top"},fN=["data-value"],hN=["data-value"],pN=["data-value"],mN={class:"fc-slot"},gN=dv(()=>l("span",{class:"fc-colon"},":",-1)),vN=["id"],yN={class:"fc-card"},bN={class:"fc-card__top"},_N=["data-value"],xN=["data-value"],wN=["data-value"],kN={class:"fc-slot"},SN=dv(()=>l("span",{class:"fc-colon"},":",-1)),$N=["id"],CN={class:"fc-card"},TN={class:"fc-card__top"},EN=["data-value"],AN=["data-value"],IN=["data-value"],PN={class:"fc-slot"},MN=Ke({__name:"FlipCountdown",props:{totalSeconds:{type:Number,default:3600},labels:{type:Object,default:()=>({hours:"Giờ",minutes:"Phút",seconds:"Giây"})},size:{type:String,default:"md",validator:e=>["xs","sm","md","lg","xl"].includes(e)},variant:{type:String,default:"red",validator:e=>["red","yellow","white"].includes(e)}},emits:["elapsed"],setup(e,{emit:t}){const n=e,s=t,r=R(n.totalSeconds),o=ee(()=>{const u=Math.max(0,r.value);return{hours:String(Math.floor(u/3600)).padStart(2,"0"),minutes:String(Math.floor(u%3600/60)).padStart(2,"0"),seconds:String(u%60).padStart(2,"0")}}),i=Math.random().toString(36).slice(2,9),a=R({hours:{current:o.value.hours,previous:o.value.hours,id:`fc-h-${i}`},minutes:{current:o.value.minutes,previous:o.value.minutes,id:`fc-m-${i}`},seconds:{current:o.value.seconds,previous:o.value.seconds,id:`fc-s-${i}`}});Pe(o,u=>{["hours","minutes","seconds"].forEach(d=>{const f=a.value[d];if(u[d]!==f.current){f.previous=f.current,f.current=u[d];const h=document.getElementById(f.id);h&&(h.classList.remove("flip"),h.offsetWidth,h.classList.add("flip"))}})});let c;return Qe(()=>{if(r.value<=0){s("elapsed");return}c=setInterval(()=>{r.value--,r.value<=0&&(clearInterval(c),s("elapsed"))},1e3)}),Lt(()=>{c&&clearInterval(c)}),(u,d)=>(m(),x("div",{class:te(["fc-clock",["is-"+e.size,"is-"+e.variant]])},[l("span",{class:"fc-piece",id:a.value.hours.id},[l("span",uN,[l("b",dN,j(a.value.hours.current),1),l("b",{class:"fc-card__bottom","data-value":a.value.hours.current},null,8,fN),l("b",{class:"fc-card__back","data-value":a.value.hours.previous},null,8,hN),l("b",{class:"fc-card__back-bottom","data-value":a.value.hours.previous},null,8,pN)]),l("span",mN,j(e.labels.hours),1)],8,cN),gN,l("span",{class:"fc-piece",id:a.value.minutes.id},[l("span",yN,[l("b",bN,j(a.value.minutes.current),1),l("b",{class:"fc-card__bottom","data-value":a.value.minutes.current},null,8,_N),l("b",{class:"fc-card__back","data-value":a.value.minutes.previous},null,8,xN),l("b",{class:"fc-card__back-bottom","data-value":a.value.minutes.previous},null,8,wN)]),l("span",kN,j(e.labels.minutes),1)],8,vN),SN,l("span",{class:"fc-piece",id:a.value.seconds.id},[l("span",CN,[l("b",TN,j(a.value.seconds.current),1),l("b",{class:"fc-card__bottom","data-value":a.value.seconds.current},null,8,EN),l("b",{class:"fc-card__back","data-value":a.value.seconds.previous},null,8,AN),l("b",{class:"fc-card__back-bottom","data-value":a.value.seconds.previous},null,8,IN)]),l("span",PN,j(e.labels.seconds),1)],8,$N)],2))}},[["__scopeId","data-v-b2e81a91"]]),Pl=e=>(nn("data-v-56657c6b"),e=e(),sn(),e),ON={class:"border border-red-500 rounded overflow-hidden"},RN={class:"relative overflow-hidden border-b bg-red-500"},LN={class:"relative px-3 py-2 sm:px-4 sm:py-3 flex flex-col sm:flex-row items-center justify-between gap-2 sm:gap-3"},DN={class:"flex items-center gap-1 w-full sm:w-auto justify-center sm:justify-start"},jN=Pl(()=>l("h2",{class:"font-semibold flex items-center gap-1"},[l("span",{class:"text-lg md:text-2xl text-white text-center sm:text-left"},"Ưu đãi mua kèm dành cho bạn")],-1)),NN={class:"shrink-0 flex justify-center w-full sm:w-auto"},FN={class:"flex flex-col w-full bg-gray-50/50"},zN={class:"flex items-stretch px-2 py-3 sm:px-4 sm:py-6 gap-0"},qN={key:0,class:"combo-card shrink-0"},BN={class:"h-full bg-white flex flex-col rounded"},UN={class:"aspect-[1/1] relative overflow-hidden mb-1"},VN=["src","alt"],HN={class:"flex-1 flex flex-col p-1"},WN={class:"text-xs sm:text-sm font-medium line-clamp-2 text-gray-900 mb-1"},GN={class:"space-y-0.5"},KN={class:"text-xs sm:text-sm font-bold text-red-500"},QN={key:0,class:"flex items-center gap-1 flex-wrap"},JN={class:"text-[10px] sm:text-xs text-gray-400 line-through"},XN={class:"text-[10px] sm:text-xs text-red-500 font-semibold bg-red-50 px-1 rounded"},ZN={key:1,class:"flex items-center justify-center shrink-0 px-1 sm:px-4"},YN={class:"rounded-full p-1 sm:p-2"},eF={key:2,class:"flex-1 min-w-0 relative"},tF=["disabled"],nF=["disabled"],sF={class:"flex items-stretch h-full"},rF=["onClick"],oF={class:"aspect-[1/1] relative overflow-hidden mb-1"},iF=["src","alt"],aF={key:0,class:"absolute inset-0 bg-orange-600/5 flex items-center justify-center"},lF={class:"flex-1 flex flex-col p-1"},cF={class:"text-xs sm:text-sm font-medium line-clamp-2 text-gray-900 md:group-hover:text-orange-600 transition-colors duration-300 mb-1"},uF={class:"ml-1"},dF={class:"space-y-0.5"},fF={class:"text-xs sm:text-sm font-bold text-red-500"},hF={key:0,class:"flex items-center gap-1 flex-wrap"},pF={class:"text-[10px] sm:text-xs text-gray-400 line-through"},mF={class:"text-[10px] sm:text-xs text-red-500 font-semibold bg-red-50 px-1 rounded"},gF={class:"flex flex-col lg:flex-row items-center justify-between border-t border-gray-200 p-2 sm:px-6 gap-2 lg:gap-12 bg-white"},vF={class:"flex items-center justify-between w-full lg:w-auto flex-1 lg:pr-16"},yF={class:"flex flex-col font-bold items-center lg:items-start text-center lg:text-left"},bF=Pl(()=>l("span",{class:"text-xs sm:text-sm text-gray-900"},"Tổng tiền gốc:",-1)),_F={class:"text-sm sm:text-base font-medium text-gray-700"},xF={class:"flex flex-col items-center font-bold lg:items-start text-center lg:text-left"},wF=Pl(()=>l("span",{class:"text-xs sm:text-sm text-gray-900"},"Tiết kiệm:",-1)),kF={class:"text-sm sm:text-base text-green-600"},SF={class:"flex font-bold flex-col items-center lg:items-start text-center lg:text-left"},$F=Pl(()=>l("span",{class:"text-xs sm:text-sm text-gray-900"},"Tổng tiền:",-1)),CF={class:"text-sm sm:text-base text-red-500"},TF=Object.freeze(Object.defineProperty({__proto__:null,default:Ke({__name:"WidgetComboHorizontal",props:{dataKey:{type:String,default:"also_bought"}},setup(e){const t=e,n=R(null),s=R(0),r=R(0),o=R(1),i=R(!1),a=R(!0),c=T=>{var A;T&&(r.value=T.slideNodes().length,o.value=((A=n.value)==null?void 0:A.currentSlidesPerView)||1,d(T))},u=T=>{var D,Q;s.value=T.currentIndex,o.value=((D=n.value)==null?void 0:D.currentSlidesPerView)||1;const A=(Q=n.value)==null?void 0:Q.emblaApi;A&&d(A)},d=T=>{i.value=T.canScrollPrev(),a.value=T.canScrollNext()};ee(()=>f.value>=100);const f=ee(()=>w.value===0?0:Math.round(k.value/w.value*100)),h=ee(()=>ln.state.source_product||null),g=ee(()=>(ln.state[t.dataKey]||[]).map(A=>{const D=A.properties??A;return{id:D.id,properties:D,signals:A.signals??{}}})),p=R([]),v=T=>{const A=p.value.indexOf(T);A>-1?p.value.splice(A,1):p.value.push(T)},_=T=>p.value.includes(T),k=ee(()=>(h.value?1:0)+p.value.length),w=ee(()=>(h.value?1:0)+g.value.length),$=T=>et(T),E=(T,A)=>{if(!T||!A)return"";const D=parseFloat(T),Q=parseFloat(A);return Q<=D?"":`-${Math.round((1-D/Q)*100)}%`},P=T=>{if(!T)return 0;const A=parseFloat(T);return isNaN(A)?0:A},I=ee(()=>{let T=0;const A=D=>{const Q=P(D.originalPrice),W=P(D.price);return!Q||Q<=0?W:Math.max(Q,W)};return h.value&&(T+=A(h.value.properties)),p.value.forEach(D=>{g.value[D]&&(T+=A(g.value[D].properties))}),T}),M=ee(()=>{let T=0;return h.value&&(T+=P(h.value.properties.price)),p.value.forEach(A=>{g.value[A]&&(T+=P(g.value[A].properties.price))}),T}),L=ee(()=>M.value),V=ee(()=>Math.max(0,I.value-L.value)),X=()=>{var Q,W,H,K,F;const T=`[${(W=(Q=h.value)==null?void 0:Q.properties)==null?void 0:W.name}](${((K=(H=h.value)==null?void 0:H.properties)==null?void 0:K.url)||window.location.href})`,A=p.value.map(ne=>{var _e,we;const fe=g.value[ne];return`[${(_e=fe.properties)==null?void 0:_e.name}](${((we=fe.properties)==null?void 0:we.url)||window.location.href})`});let D=`Nhận khuyến mãi combo:
`;D+=`- Sản phẩm chính: ${T}
`,A.length>0&&(D+=`- Sản phẩm mua kèm: ${A.join(", ")}
`),(F=window.EasyAI)!=null&&F.send&&window.EasyAI.send(D),Fe!=null&&Fe.generateLead&&Fe.generateLead({source:"widget_combo_chat_trigger",page_url:window.location.href})};return Pe(()=>g.value,T=>{T&&T.length>0&&p.value.length===0&&(p.value=T.map((A,D)=>D))},{immediate:!0}),(T,A)=>(m(),x("div",ON,[l("div",RN,[l("div",LN,[l("div",DN,[G(Il,{class:"size-6 sm:size-7 shrink-0"}),jN]),l("div",NN,[G(MN,{"total-seconds":6312,variant:"white"})])])]),l("div",FN,[l("div",zN,[h.value?(m(),x("div",qN,[l("div",BN,[l("div",UN,[l("img",{src:h.value.properties.image,class:"w-full h-full object-contain",alt:h.value.properties.name},null,8,VN)]),l("div",HN,[l("h3",WN,j(h.value.properties.name),1),l("div",GN,[l("div",KN,j($(h.value.properties.price)),1),h.value.properties.originalPrice?(m(),x("div",QN,[l("span",JN,j($(h.value.properties.originalPrice)),1),l("span",XN,j(E(h.value.properties.price,h.value.properties.originalPrice)),1)])):q("",!0)])])])])):q("",!0),h.value&&g.value.length>0?(m(),x("div",ZN,[l("div",YN,[G(y(ng),{class:"w-3.5 h-3.5 sm:w-[18px] sm:h-[18px] text-gray-700","stroke-width":"3"})])])):q("",!0),g.value.length>0?(m(),x("div",eF,[g.value.length>o.value?(m(),x("button",{key:0,class:"absolute left-0 md:-left-2 shadow-xl top-1/2 -translate-y-1/2 z-10 size-8 sm:size-11 rounded-full border border-gray-200 bg-white flex items-center justify-center text-gray-500 disabled:opacity-0 disabled:cursor-not-allowed",disabled:!i.value,onClick:A[0]||(A[0]=D=>{var Q;return(Q=n.value)==null?void 0:Q.scrollPrev()})},[G(y(fo),{class:"w-4 h-4 sm:w-5 sm:h-5","stroke-width":"3"})],8,tF)):q("",!0),g.value.length>o.value?(m(),x("button",{key:1,class:"absolute right-0 md:-right-2 shadow-xl top-1/2 -translate-y-1/2 z-10 size-8 sm:size-11 rounded-full border border-gray-200 bg-white flex items-center justify-center text-gray-500 disabled:opacity-0 disabled:cursor-not-allowed",disabled:!a.value,onClick:A[1]||(A[1]=D=>{var Q;return(Q=n.value)==null?void 0:Q.scrollNext()})},[G(y(Ir),{class:"w-4 h-4 sm:w-5 sm:h-5","stroke-width":"3"})],8,nF)):q("",!0),G(Ti,{ref_key:"sliderRef",ref:n,"slides-per-view":1,"space-between":4,"show-arrows":!1,breakpoints:{325:{slidesPerView:2,spaceBetween:4},768:{slidesPerView:2,spaceBetween:8},1024:{slidesPerView:3,spaceBetween:8},1280:{slidesPerView:4,spaceBetween:8}},onChange:u,onInit:c},{default:Se(()=>[(m(!0),x(be,null,Ie(g.value,(D,Q)=>(m(),x("div",{key:D.id||Q,class:"embla__slide"},[l("div",sF,[l("div",{class:"flex-1 min-w-0 h-full group bg-white transition-all cursor-pointer flex flex-col rounded",onClick:W=>v(Q)},[l("div",oF,[l("img",{src:D.properties.image,class:"w-full h-full object-contain",alt:D.properties.name},null,8,iF),_(Q)?(m(),x("div",aF)):q("",!0)]),l("div",lF,[l("h3",cF,[l("div",{class:te(["size-3.5 sm:size-4 translate-y-0.5 inline-flex shrink-0 rounded border items-center justify-center transition-all duration-300",_(Q)?"bg-orange-600 border-orange-600 shadow-sm":"bg-white border-gray-300"])},[G(y(ol),{class:te([[_(Q)?"opacity-100":"opacity-0"],"w-2.5 h-2.5 sm:w-3.5 sm:h-3.5 text-white"]),"stroke-width":"2"},null,8,["class"])],2),l("span",uF,j(D.properties.name),1)]),l("div",dF,[l("div",fF,j($(D.properties.price)),1),D.properties.originalPrice?(m(),x("div",hF,[l("span",pF,j($(D.properties.originalPrice)),1),l("span",mF,j(E(D.properties.price,D.properties.originalPrice)),1)])):q("",!0)])])],8,rF)])]))),128))]),_:1},512)])):q("",!0)]),l("div",gF,[l("div",vF,[l("div",yF,[bF,l("span",_F,j($(I.value)),1)]),l("div",xF,[wF,l("span",kF,j($(V.value)),1)]),l("div",SF,[$F,l("span",CF,j($(L.value)),1)])]),l("button",{onClick:X,class:"w-full lg:w-[40%] text-sm sm:text-base px-4 py-2.5 sm:py-3 rounded-md font-semibold transition-all duration-200 bg-red-500 text-white active:scale-[0.95] flex items-center justify-center hover:brightness-110"}," Nhận khuyến mãi ")])])]))}},[["__scopeId","data-v-56657c6b"]])},Symbol.toStringTag,{value:"Module"})),fv=e=>(nn("data-v-0e32e6e0"),e=e(),sn(),e),EF=fv(()=>l("div",{class:"px-4 py-3 border-b border-gray-100 text-center"},[l("h3",{class:"font-bold text-sm uppercase text-gray-800 tracking-wide mt-0.5"}," Khách hàng đã đặt ")],-1)),AF={class:"overflow-y-auto p-3 flex-1"},IF={class:"mb-3 text-gray-700 text-xs font-semibold"},PF={class:"overflow-x-auto eai-no-scrollbar"},MF={class:"w-full text-left border border-gray-100"},OF=fv(()=>l("thead",{class:"border-b-2 border-gray-100"},[l("tr",{class:"border-b-2 border-gray-100 border-t-0 font-bold text-gray-700 text-[11px] bg-white"},[l("th",{class:"py-2 px-1.5 bg-white"},"Khách hàng"),l("th",{class:"py-2 px-1.5 text-center bg-white"}," SĐT "),l("th",{class:"py-2 px-1.5 bg-white"},"Thời gian")])],-1)),RF={class:"text-[11px]"},LF={class:"py-2 px-1.5 text-gray-700 font-medium"},DF={class:"py-2 px-1.5 text-gray-600 text-center"},jF={class:"py-2 px-1.5 text-gray-600"},NF=Object.freeze(Object.defineProperty({__proto__:null,default:Ke({__name:"CustomerListModal",props:{customers:{type:Array,default:()=>[]},onRemove:{type:Function,default:null}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,r=()=>{n.onRemove?n.onRemove():s("close")},o=i=>{i.key==="Escape"&&r()};return Qe(()=>{document.addEventListener("keydown",o)}),Lt(()=>{document.removeEventListener("keydown",o)}),(i,a)=>(m(),x("div",{class:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/50 p-4 eai-customer-modal-overlay",onClick:r},[l("div",{onClick:a[0]||(a[0]=Gt(()=>{},["stop"])),class:"bg-white rounded-xl w-full max-w-sm flex flex-col shadow-2xl relative text-gray-800 max-h-[85vh] overflow-hidden"},[l("button",{class:"absolute top-3 right-3 p-1.5 bg-gray-100/80 rounded-full text-gray-600 hover:text-gray-900 hover:bg-gray-200 transition-colors z-10 block cursor-pointer",onClick:r},[G(y(Es),{class:"w-4 h-4"})]),EF,l("div",AF,[l("div",IF," Có "+j(e.customers.length)+" khách đã đặt ",1),l("div",PF,[l("table",MF,[OF,l("tbody",RF,[(m(!0),x(be,null,Ie(e.customers,(c,u)=>(m(),x("tr",{key:u,class:te(u%2===0?"bg-gray-50":"bg-white")},[l("td",LF,j(c.name),1),l("td",DF,j(c.phone),1),l("td",jF,j(y(Oa)(c.time)),1)],2))),128))])])])])])]))}},[["__scopeId","data-v-0e32e6e0"]])},Symbol.toStringTag,{value:"Module"})),Mi={ADD_CART:"/cart/api/cart/AddProduct"},Oi={DMX_STAGING:"https://staging.dienmayxanh.com",DMX_PRODUCTION:"https://www.dienmayxanh.com",TGDD_STAGING:"https://staging.thegioididong.com",TGDD_PRODUCTION:"https://www.thegioididong.com"},FF={"www.dienmayxanh.com":{ADD_CART:Oi.DMX_PRODUCTION+Mi.ADD_CART},"staging.dienmayxanh.com":{ADD_CART:Oi.DMX_STAGING+Mi.ADD_CART},"www.thegioididong.com":{ADD_CART:Oi.TGDD_PRODUCTION+Mi.ADD_CART},"staging.thegioididong.com":{ADD_CART:Oi.TGDD_STAGING+Mi.ADD_CART},localhost:{ADD_CART:Oi.DMX_PRODUCTION+Mi.ADD_CART}};function hv(){const e=R(!1),t=R(null),n=R(null),s=R(null),{handle:r}=At(ae.state),o=async({productId:c,productCode:u,productType:d,quantity:f})=>{try{e.value=!0,t.value||(t.value=window.location.hostname);const h=FF[t.value].ADD_CART,g={requestChooseServiceDetail:{bringProductsName:"",isTransContact:!1,isUserManual:!1,lstProductCodeMoreColors:"",productId:c},requestProductAdd:[{indexGiftAdds:[],productId:c,productCode:u,productType:Number(d)||1,quantity:Number(f)||1}]},p=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(g)});if(!p.ok)throw new Error(`EAC - Error adding product to cart: ${p.status}`);return await p.json()}catch(h){throw console.error("EAC - Error adding product to cart:",h),h}finally{e.value=!1}},i=(c=[],u)=>{var p,v;const{origin:d,pathname:f}=window.location;let h=(p=c.find(_=>_.href.includes("/cart/single")))==null?void 0:p.href,g=(v=c.find(_=>_.href.includes("/cart/them-vao-gio-hang")))==null?void 0:v.href;if(u===d+f){const _=document.querySelector('a.btn-buynow[href*="/cart/single"]'),k=document.querySelector('a.btn-buynow[href*="/cart/them-vao-gio-hang"]');_!=null&&_.href&&(h=_.href),k!=null&&k.href&&(g=k.href)}h&&(n.value=d+h),g&&(s.value=d+g)},a=c=>{const u=c.split("?")[1];return u?u.split("&").reduce((d,f)=>{const[h,g]=f.split("=");return d[h]=g,d},{}):{}};return Qe(()=>{t.value=window.location.hostname}),{addCart:o,getLinkBuyNowAndSingleCart:i,getParamCTALink:a,isLoading:e,linkSingleCart:n,linkBuyNow:s}}const zF={class:"p-[8px] flex flex-col group h-full"},qF=["src","alt"],BF=["src","alt"],UF={class:"flex flex-col flex-1 mt-2"},VF={class:"flex flex-wrap items-center mt-1"},HF={class:"mr-1 text-red-500 font-semibold text-[15px]"},WF={key:0},GF={key:1},KF={key:2},QF={key:0,class:"text-xs font-light text-gray-500"},JF={key:1,class:"text-xs font-light text-gray-500"},XF={key:0,class:"mt-2 mb-1 variant-attributes"},ZF={class:"mb-0.5 text-xs tracking-tight text-gray-500"},YF={class:"flex space-x-2"},ez=["onClick"],tz={key:1,class:"flex items-center mt-2"},nz={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},sz={key:0,class:"mt-4"},rz={href:"/cart",class:"flex justify-center items-center p-2 w-full text-sm text-white rounded border transition-colors duration-200 bg-[#FC7600] border-[#FC7600] hover:bg-[#FC7600]/80 hover:border-[#FC7600]/80"},oz={key:1,class:"mt-4"},iz=["href"],az=["href"],lz=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"CardProductNew",props:{item:{type:Object}},emits:["open-flow-checkout","send-message","loading"],setup(e,{emit:t}){var P,I;const n=e,s=t,{addCart:r,getLinkBuyNowAndSingleCart:o,linkSingleCart:i,linkBuyNow:a}=hv(),c=R(!1),u=((I=(P=B.bot)==null?void 0:P.config)==null?void 0:I.ui.logo)||`${B.appDomain}/link.png`,d=R(null),f=R(!1);Ka(n.item.links)&&(n.item.links=JSON.parse(n.item.links)),Pe(f,M=>{s("loading",M)});const h=R(!1),g=R(null),p=R(null),v=R(!1),_=()=>{var V,X,T;const{source:M,links:L}=n.item;if(p.value=(V=L==null?void 0:L.variant_items)==null?void 0:V.filter(A=>!A.hasOwnProperty("status")||A.status),v.value=((X=L==null?void 0:L.service_packs)==null?void 0:X.length)>0,((T=p.value)==null?void 0:T.length)>0){const A=p.value[0];A.code&&A.color_hex?g.value=A:g.value=null}o(L==null?void 0:L.cta_links,M)},k=async M=>{if(!Number(M))return;const L=document.querySelector(".header__cart .cart-number");L&&(L.textContent||L.classList.add("has-cart"),L.textContent=M)};async function w(){try{const M=new Date().getTime(),V=`${window.location.origin}/cart/api/cart/info?_=${M}`,T=await(await fetch(V,{method:"GET",headers:{Accept:"application/json"}})).json();if(T&&T.items_count){const A=document.querySelector(".header__cart .cart-number");A&&(A.textContent||A.classList.add("has-cart"),A.textContent=T.items_count)}}catch(M){console.error("Error:",M)}}function $(){var V,X,T,A,D,Q;if(f.value)return;let M=(T=(X=(V=n.item.links)==null?void 0:V.cta_links)==null?void 0:X.find(W=>W.href.includes("/cart/them-vao-gio-hang")))==null?void 0:T.href;if(!M)return s("send-message",`Liên hệ tư vấn ${n.item.title}`);if(f.value=!0,v.value){const W=(A=n.item.links)==null?void 0:A.service_packs,H=((D=W==null?void 0:W[0])==null?void 0:D.data_id)??((Q=W==null?void 0:W[1])==null?void 0:Q.data_id)??1;M=M+`&packageSelection=${H}`}const L=document.createElement("iframe");L.style.display="none",L.src=M,L.onload=async W=>{document.body.removeChild(L),f.value=!1,h.value=!0,w();let{title:H,image:K,source:F}=n.item;const ne=await Cr(K);ne.status||(K=u);const fe=ao({title:H,image:K,source:F,isImageValid:ne.status,cartUrl:"/cart"});s("send-message",fe)},L.onerror=W=>{document.body.removeChild(L),f.value=!1},document.body.appendChild(L)}const E=async()=>{if(v.value||a.value&&!a.value.includes("productCode")){$();return}try{if(!a.value&&!g.value)return s("send-message",`Liên hệ tư vấn ${n.item.title}`);if(f.value)return;f.value=!0;let M={};if(g.value)M={quantity:1,productId:g.value.id,productCode:g.value.code,productType:g.value.product_type};else{const V=Qa(a.value);M={quantity:1,productId:V.productId,productCode:V.productCode,productType:V.productType}}const L=await r(M,v.value);if(L&&L.data){h.value=!0;const V=L.data.products.reduce((W,H)=>W+H.quantity,0);k(V);let{title:X,image:T,source:A}=n.item;const D=await Cr(T);D.status||(T=u);const Q=ao({title:X,image:T,source:A,isImageValid:D.status,cartUrl:"/cart"});s("send-message",Q)}else{const V=L.errormessage;mn.actions.warning({message:V})}}catch(M){console.log(M),M!=null&&M.message&&mn.actions.error({message:"Có lỗi xảy ra, vui lòng thử lại sau"})}finally{f.value=!1}};return Qe(()=>{d.value=window.location.origin,_()}),(M,L)=>{var V,X,T,A;return m(),x("div",zF,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:"_self",class:"rounded overflow-hidden flex items-center justify-center aspect-[1/1]"},{default:Se(()=>[e.item.image&&!c.value?(m(),x("img",{key:0,src:e.item.image,alt:e.item.title,class:"object-contain w-full h-full",onError:L[0]||(L[0]=()=>c.value=!0)},null,40,qF)):(m(),x("img",{key:1,src:y(u),alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,BF))]),_:1},8,["href"])),l("div",UF,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:"_self",class:"text-sm font-medium text-gray-900 line-clamp-1 sm:group-hover:text-primary"},{default:Se(()=>[Be(j(e.item.title),1)]),_:1},8,["href"])),l("div",VF,[l("div",HF,[e.item.texts&&e.item.texts.price?(m(),x("div",WF,j(e.item.texts.price),1)):g.value&&g.value.price_text?(m(),x("div",GF,j(g.value.price_text),1)):e.item.price?(m(),x("div",KF,j(y(et)(e.item.price,{currency:e.item.currency})),1)):q("",!0)]),g.value&&g.value.old_price_text!==g.value.price_text&&g.value.old_price_text!=="0₫"?(m(),x("del",QF,j(g.value.old_price_text),1)):!((X=(V=e.item.links)==null?void 0:V.variant_items)!=null&&X.length)&&e.item.old_price>0&&e.item.old_price!==e.item.price&&e.item.old_price_text!==0?(m(),x("del",JF,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):q("",!0)]),g.value?(m(),x("div",XF,[l("div",ZF," Màu: "+j(g.value.color||""),1),l("div",YF,[(m(!0),x(be,null,Ie(p.value,(D,Q)=>(m(),x("div",{key:Q,class:"cursor-pointer",onClick:W=>g.value=D},[l("div",{class:te(["size-[20px] rounded-full border ring-1 shadow-[inset_0_3px_4px_rgba(0,0,0,0.05)]",g.value.code===D.code?"border-blue-50 ring-blue-300":"border-transparent ring-transparent"]),style:ht({backgroundColor:D.color_hex})},null,6)],8,ez))),128))])])):q("",!0),Number(e.item.rating)||e.item.review_count?(m(),x("div",tz,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):q("",!0),e.item.review_count?(m(),x("div",nz," ("+j(y(dm)(e.item.review_count))+") ",1)):q("",!0)])):q("",!0)]),h.value?(m(),x("div",sz,[l("a",rz,[G(y(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Be(" Thanh toán ngay ")])])):(m(),x("div",oz,[y(i)?(m(),x("a",{key:0,href:y(i),class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Be(" Mua ngay ")],8,iz)):(A=(T=e.item.links)==null?void 0:T.cta_links)!=null&&A.length?(m(),x("button",{key:2,onClick:L[1]||(L[1]=D=>E()),class:te(["flex justify-center items-center p-2 w-full text-sm bg-white rounded border border-gray-200",f.value?"cursor-pointer text-gray-400":"hover:bg-primary hover:text-white hover:border-primary text-gray-600"])},[y(a)||g.value?(m(),x(be,{key:0},[f.value?(m(),oe(en,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"}))],64)):(m(),oe(y(Jm),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),Be(" "+j(y(a)||g.value?"Thêm vào giỏ":"Liên hệ"),1)],2)):(m(),x("a",{key:1,href:e.item.source,class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(cl),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Be(" Xem chi tiết ")],8,az))]))])}}}},Symbol.toStringTag,{value:"Module"})),cz={class:"p-[10px] rounded group border border-gray-200 w-full"},uz={class:"flex"},dz=["src","alt"],fz=["src","alt"],hz={class:"flex flex-col flex-1"},pz={class:"flex flex-wrap items-center mt-1"},mz={class:"mr-1 text-red-500 font-semibold text-[15px]"},gz={key:0},vz={key:1},yz={key:2},bz={key:0,class:"text-xs font-light text-gray-500"},_z={key:1,class:"text-xs font-light text-gray-500"},xz={key:0,class:"my-2 variant-attributes"},wz={class:"mb-0.5 text-xs tracking-tight text-gray-500"},kz={class:"flex space-x-2"},Sz=["onClick"],$z={key:1,class:"flex items-center"},Cz={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Tz={key:0,class:"mt-3"},Ez={href:"/cart",class:"flex justify-center items-center p-2 w-full text-sm text-white rounded border transition-colors duration-200 bg-[#FC7600] border-[#FC7600] hover:bg-[#FC7600]/80 hover:border-[#FC7600]/80"},Az={key:1,class:"mt-3"},Iz=["href"],Pz=["href"],Mz=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"CardProductRowNew",props:{item:{type:Object}},emits:["open-flow-checkout","send-message","loading"],setup(e,{emit:t}){var P,I;const n=e,s=t,{addCart:r,getLinkBuyNowAndSingleCart:o,linkSingleCart:i,linkBuyNow:a}=hv(),c=R(!1),u=((I=(P=B.bot)==null?void 0:P.config)==null?void 0:I.ui.logo)||`${B.appDomain}/link.png`,d=R(null),f=R(!1);Ka(n.item.links)&&(n.item.links=JSON.parse(n.item.links)),Pe(f,M=>{s("loading",M)});const h=R(!1),g=R(null),p=R(null),v=R(!1),_=()=>{var V,X,T;const{source:M,links:L}=n.item;if(p.value=(V=L==null?void 0:L.variant_items)==null?void 0:V.filter(A=>!A.hasOwnProperty("status")||A.status),v.value=((X=L==null?void 0:L.service_packs)==null?void 0:X.length)>0,((T=p.value)==null?void 0:T.length)>0){const A=p.value[0];A.code&&A.color_hex?g.value=A:g.value=null}o(L==null?void 0:L.cta_links,M)},k=async M=>{if(!Number(M))return;const L=document.querySelector(".header__cart .cart-number");L&&(L.textContent||L.classList.add("has-cart"),L.textContent=M)};async function w(){try{const M=new Date().getTime(),V=`${window.location.origin}/cart/api/cart/info?_=${M}`,T=await(await fetch(V,{method:"GET",headers:{Accept:"application/json"}})).json();if(T&&T.items_count){const A=document.querySelector(".header__cart .cart-number");A&&(A.textContent||A.classList.add("has-cart"),A.textContent=T.items_count)}}catch(M){console.error("Error:",M)}}function $(){var V,X,T,A,D,Q;if(f.value)return;let M=(T=(X=(V=n.item.links)==null?void 0:V.cta_links)==null?void 0:X.find(W=>W.href.includes("/cart/them-vao-gio-hang")))==null?void 0:T.href;if(!M)return s("send-message",`Liên hệ tư vấn ${n.item.title}`);if(f.value=!0,v.value){const W=(A=n.item.links)==null?void 0:A.service_packs,H=((D=W==null?void 0:W[0])==null?void 0:D.data_id)??((Q=W==null?void 0:W[1])==null?void 0:Q.data_id)??1;M=M+`&packageSelection=${H}`}const L=document.createElement("iframe");L.style.display="none",L.src=M,L.onload=async W=>{document.body.removeChild(L),f.value=!1,h.value=!0,w();let{title:H,image:K,source:F}=n.item;const ne=await Cr(K);ne.status||(K=u);const fe=ao({title:H,image:K,source:F,isImageValid:ne.status,cartUrl:"/cart"});s("send-message",fe)},L.onerror=W=>{document.body.removeChild(L),f.value=!1},document.body.appendChild(L)}const E=async()=>{if(v.value||a.value&&!a.value.includes("productCode")){$();return}try{if(!a.value&&!g.value)return s("send-message",`Liên hệ tư vấn ${n.item.title}`);if(f.value)return;f.value=!0;let M={};if(g.value)M={quantity:1,productId:g.value.id,productCode:g.value.code,productType:g.value.product_type};else{const V=Qa(a.value);M={quantity:1,productId:V.productId,productCode:V.productCode,productType:V.productType}}const L=await r(M);if(L&&L.data){h.value=!0;const V=L.data.products.reduce((W,H)=>W+H.quantity,0);k(V);let{title:X,image:T,source:A}=n.item;const D=await Cr(T);D.status||(T=u);const Q=ao({title:X,image:T,source:A,isImageValid:D.status,cartUrl:"/cart"});s("send-message",Q)}else{const V=L.errormessage;console.log("Failed to add to cart",V),mn.actions.warning({message:V})}}catch(M){console.log(M),M!=null&&M.message&&mn.actions.error({message:"Có lỗi xảy ra, vui lòng thử lại sau"})}finally{f.value=!1}};return Qe(()=>{d.value=window.location.origin,_()}),(M,L)=>{var V,X;return m(),x("div",cz,[l("div",uz,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:"_self",class:"rounded overflow-hidden size-[124px] flex items-center justify-center mr-2 flex-shrink-0"},{default:Se(()=>[e.item.image&&!c.value?(m(),x("img",{key:0,src:e.item.image,alt:e.item.title,class:"object-contain w-full h-full",onError:L[0]||(L[0]=()=>c.value=!0)},null,40,dz)):(m(),x("img",{key:1,src:y(u),alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,fz))]),_:1},8,["href"])),l("div",hz,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:"_self",class:"text-sm font-medium text-gray-900 line-clamp-2 group-hover:text-primary"},{default:Se(()=>[Be(j(e.item.title),1)]),_:1},8,["href"])),l("div",pz,[l("div",mz,[e.item.texts&&e.item.texts.price?(m(),x("div",gz,j(e.item.texts.price),1)):g.value&&g.value.price_text&&g.value.price_text!=="0₫"?(m(),x("div",vz,j(g.value.price_text),1)):e.item.price&&e.item.price!==0?(m(),x("div",yz,j(y(et)(e.item.price,{currency:e.item.currency})),1)):q("",!0)]),g.value&&g.value.old_price_text!==g.value.price_text&&g.value.old_price_text!=="0₫"?(m(),x("del",bz,j(g.value.old_price_text),1)):e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",_z,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):q("",!0)]),g.value?(m(),x("div",xz,[l("div",wz," Màu: "+j(g.value.color||""),1),l("div",kz,[(m(!0),x(be,null,Ie(p.value,(T,A)=>(m(),x("div",{key:A,class:"cursor-pointer",onClick:D=>g.value=T},[l("div",{class:te(["size-[20px] rounded-full border ring-1 shadow-[inset_0_3px_4px_rgba(0,0,0,0.05)]",g.value.code===T.code?"border-blue-50 ring-blue-300":"border-transparent ring-transparent"]),style:ht({backgroundColor:T.color_hex})},null,6)],8,Sz))),128))])])):q("",!0),Number(e.item.rating)||e.item.review_count?(m(),x("div",$z,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):q("",!0),e.item.review_count?(m(),x("div",Cz," ("+j(y(dm)(e.item.review_count))+") ",1)):q("",!0)])):q("",!0)])]),h.value?(m(),x("div",Tz,[l("a",Ez,[G(y(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Be(" Thanh toán ngay ")])])):(m(),x("div",Az,[y(i)?(m(),x("a",{key:0,href:y(i),class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Be(" Mua ngay ")],8,Iz)):(X=(V=e.item.links)==null?void 0:V.cta_links)!=null&&X.length?(m(),x("button",{key:2,onClick:L[1]||(L[1]=T=>E()),class:te(["flex justify-center items-center p-2 w-full text-sm bg-white rounded border border-gray-200",f.value?"cursor-pointer text-gray-400":"hover:bg-primary hover:text-white hover:border-primary text-gray-600"])},[y(a)||g.value?(m(),x(be,{key:0},[f.value?(m(),oe(en,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"}))],64)):(m(),oe(y(Jm),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),Be(" "+j(y(a)||g.value?"Thêm vào giỏ":"Liên hệ"),1)],2)):(m(),x("a",{key:1,href:e.item.source,class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(cl),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Be(" Xem chi tiết ")],8,Pz))]))])}}}},Symbol.toStringTag,{value:"Module"})),fd="data:image/webp;base64,UklGRs4HAABXRUJQVlA4WAoAAAAQAAAATwAATwAAQUxQSPICAAABoLNt2zk/un7v+86x6dZV2K3KP1ZfwFXMT7A2O1Vx0q5tI7adbGXbnnlxF+P5PdVWETEBDLAKFTDlojn3PbLx+Oc//90q6lriP79+9cH2Zx5YNn46QMMxigG48PpXPmlpuN9suP9SB94PLVScddNBteeUci6ln1JyTimr/aOHzwPvhuI8LPhBUky5aLglxSzp5QkIQwhwzVGplTSiOUp6biaVG1AVmP6mFLNGORa1boEwEAdL/lVKGvUobT6HxgA8rJOialha+nGcRl8e3lbMqmdLuoJGHw62qqnaRukKGj1V8JaaqnGSJgi9BNaoqVon/XQurltgkaJq3tJWqi6Oaf8o100t3Ubo5HlDUbUvas3CtQWuUZKBUc/h2+CoDSqawENgrqJMjHqpzbFbyQapnIfzTKrIyKiHaARWKVqR9aED/5GyFcq6BMZUZGbU/XCToh1JG+B5S4q+Ob06pWyHVMan/qZiSNbSy2Rq0gMLlW15+g4lS7K2Lbfmg8dtKfrqVWt+3aBsifTPdmvibmvKXmv0/4vd1uTt1rQ2WPP3q0qWFP38uDWfL7cl6/jt1mxYqGxJ0iOXydSke6f+pmJI1uzqlLIdRa0LeV7RjqyPT+MmS5JehjEVO6KuA/+RshnSBQRWKVqRdIDKM6liRdQNBBy7lWwo+v0cKgJzFG1oaRWB9qNKFhT9Nw0HBK6xoamHCLR73lSsX9LXU6g6OKb/q1y3rHgJns6BJYp1i1pEg+6BdWrWq6k1NOixgrfVrFNTb0PVCw62qlmfpraBo3cPbynmeuSod8DTr4c1UqxDlNaDp38Hi/5WSqOWkv5dCo5BVoGpr0sxjVKK0lszCBUDDnD1UanEPBo5FunYtRAYvPMwZ5ekEmMuwyg5xiJp91zwjqGGCiZWfaSOOaWUcp8ppZTV8ePVk0Bg6MGBH7vp+VO/aYi/n3r+5nEPLjCSPgBUUy9beMfyx17bsH333n0d9+7evuG1x1fesejyaRVA8AwSVlA4ILYEAADQFwCdASpQAFAAPpE8mkiloyKhKlYMsLASCWwAwRUM/xA2Fnrn5VcyryxE3d6c0ePj1L+YB+nXSS/ZL1GfsT+zvYi9AD+l/3jrO/QA8s/9tfg4/dT0o80i/sfaNXl76ct5g9pApl3j6+n9/l+3Yzf7Gq+vivPeDsxrS8Ac+g4ROxcsYb1Dynxi3fMahIR8AmwnnORqL3l+YpsU6AovnW9ixEvnik3G1/u0FppJvwgoFpoTGooCj/HXcsHZGT+ppelIf9KZwSagAP64fDB/EPBHP9CQUeoZif9cesHyt44/1mUNwqV2KO+5KYBIwMFzENaQSKM5qn/W/jgsPwWGtAzYDwipxSe+YbHkEhlUzrCw3YoOR8Vx+32F5x9ClgVDh96Z6PnpU1Kv4QtLm4ohGi8uQBKAfuXCwPQHV9/jkNUtephv3YHaxZVG3oVJ8h5jQFNXXrcoyK+PaXueO1hhfYuqWViv5TA616B5ahMnR1YL/P0EOECH6QJtZxM0sDjTaNdbcXsm0f/J2Ts6cSA04Ujrr6swaIlZB18HnLJBgs46U6sphVTPoylZ4ATN0B/y4/q+zfyD8A0Mzl1CcwkgeLIMMg5EF9I51UV7TxBzZiSGd/3qN5Sug+24Pf32UJLb3H8aoLhdU6bZESTkB7FYPclMU3EdisGAacV97K9+z1iBK4fei7Ih1TXyM1IUMDjBZi6e5ihvUjTKdUj0NeY7zbBZ9L/c4j9s9OpB0SCK50s6DuzvtOFQpQuRN8/XvOHsrgnEvFFlkHclw9QWBh7UHnel71YTiGSEoIXdnAbKpa+N+bIaSiuLUWx2C4su0zXbFAu9Q4NvkWKPO/arQCYj2dZTVNa1uE/fO+KNXRN4y3B65trNNG02vu9zOQzPOslKfoyr6uR8zdPyBYPoMimypbm+cR7DBudc0ulUN34dOuG3z0Gida533lBAmQP2PBojhagBEJms3kDJ70DD6T/agFpi3S6fPt2O9zDxoPK1qTqIxfC3xkmYAjXX+eqDEBQnE2UI6MSgDpFfq3WA7i8ynHPx5yZw31WxqGez86vDf80bHiNkeDTdusq3x1ndKLV7xUzWVhDmjk+jD/GS2w9kIdxsHPaUK66/rvo/VerYa/NyTRCpYtncY46YUzH5IrWOI6IYNjlxfMWMvwUFKqZFhbfIDvtMYhDOLpln9CSPJW866m+/rF6dMr4BrOENDp6ZQg7Y/uvPM/ZvgIIBDSfOixn0kWCPFJvq7QPW/sSLHlzzxCsfd1bxfBwGOAz0wJ388A9w2/X0lJH+Ugd/bXlSFAIgaihWPLmtamdoC35/RHQ0cWowD2z3yFWaAZvuIQEgkelnrFFNBqRHO+T/8WmFMI8ePR4zzlScQr0mHLjIc5xqM+7ENp7QABi+k6D55pRS6KVMqab4+mt68FCRlA/e8mdr01+nGVIf2L/PdacR75ZfSLyaHhSeYX/yl67hz0nH5BeEkBYqrUZI43bZg5QLUspHsaCf+NGtMA2eFvwBsUQMfm8nPVLb53yqsm5rs9mMqDMvC0YEOFM237KrGPE3tfbzFQ4YSU17vqFw3zTjUKAWoeIWUwlY+3JjlE8+RUCFvuByPBjDAAA=";function pv(){const e=R(!1),t=R(null),n=R(null),s="https://ecommerce.pico.vn",r="/user/api/shopping-cart",o=St.create({baseURL:s,timeout:1e4,headers:{"Content-Type":"application/json"}}),i=()=>{const d=navigator.userAgent.toLowerCase(),f=window.screen.width;return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(d)?f>=768?"Tablet":"Mobile":"Desktop"};o.interceptors.request.use(d=>{try{const f=Tt.get("guestId"),h=Tt.get("access"),g=Tt.get("sale-region")||"MN1",p=i();f&&h&&(d.headers={...d.headers,access:h,channel:"b2c",party:"ecom",platform:p,"sale-region":g,uuid:f})}catch(f){console.warn("Failed to add custom headers:",f)}return d},d=>Promise.reject(d)),o.interceptors.response.use(d=>d,d=>{var h,g;const f=((g=(h=d.response)==null?void 0:h.data)==null?void 0:g.message)||d.message||"API request failed";return console.error("API Error:",f),Promise.reject(d)});const a=async d=>{var h,g;if(!(d!=null&&d.productId))throw new Error("Product ID is required");const f=c();if(!f.isValid)throw new Error(`Missing required cookies: ${f.missing.join(", ")}`);e.value=!0,t.value=null,n.value=null;try{const p={productId:d.productId,shippingMethod:d.shippingMethod||"pickUpInStore",quantity:d.quantity||1,serviceIds:d.serviceIds||[],selectedReceiveAtWarehouse:d.selectedReceiveAtWarehouse||!1},v=await o.post(r,p);return n.value=v.data,v.data}catch(p){const v=((g=(h=p.response)==null?void 0:h.data)==null?void 0:g.message)||p.message||"Failed to add product to cart";throw t.value=v,new Error(v)}finally{e.value=!1}},c=()=>{const f=["guestId","access"].filter(h=>!Tt.get(h));return{isValid:f.length===0,missing:f}},u=()=>({uuid:Tt.get("guestId"),access:Tt.get("access"),saleRegion:Tt.get("sale-region")||"MN1",platform:i()});return ee(()=>c().isValid),ee(()=>u()),{isLoading:Ur(e),error:Ur(t),cartResponse:Ur(n),addToCart:a}}function mv(){R(!1);const e=R(!1),t=(s=1)=>{const r=document.querySelector(".cart-header .count_item");if(r){const o=parseInt(r.textContent)||0;r.textContent=o+s,r.classList.remove("hidden-count")}};return{addToCart:async s=>{try{if(e.value)return;e.value=!0;const r=new FormData;r.append("variantId",s.variantId),r.append("quantity",s.quantity||1);const o=await fetch("https://eco-mart.vn/cart/add",{method:"POST",body:r,headers:{"X-Requested-With":"XMLHttpRequest"}});if(o.ok){const i=o.headers.get("content-type");if(i&&i.includes("application/json")){const a=await o.json();return console.log("Item added to cart successfully:",a),t(s.quantity||1),a}else return console.log("Item added to cart successfully"),t(s.quantity||1),{success:!0,message:"Added to cart"}}else throw new Error(`HTTP error! status: ${o.status}`)}catch(r){throw console.error("Error adding item to cart:",r),r}finally{e.value=!1}}}}function gv(){const e=R(!1),t=(s=1)=>{const r=document.querySelector(".cart-count")||document.querySelector(".shopping-cart .count")||document.querySelector("#cart-count");if(r){const o=parseInt(r.textContent)||0;r.textContent=o+s}};return{addToCart:async s=>{try{if(e.value)return;e.value=!0;const r=new URLSearchParams;r.append("a","cart-add"),r.append("Product_ID",s.productId),r.append("Rule_ID",s.ruleId||""),r.append("quantity",s.quantity||1),r.append("muangay","0"),r.append("ptype",""),r.append("previewDate",""),r.append("promotionList",""),r.append("totalDiscount",""),r.append("comboItems","[]"),r.append("insuranceItems","[]"),r.append("selectedPromotionOffer",""),r.append("selectedPromotionOfferGifts",'[""]'),r.append("selectedPromotionPayment","");const o=window.location.hostname.includes("viettelstore.vn")?"/Site/_Sys/ajax.aspx":"https://viettelstore.vn/Site/_Sys/ajax.aspx",i=await fetch(o,{method:"POST",body:r,headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/x-www-form-urlencoded"}});if(i.ok){const a=await i.text();return a.includes("stt: 1")||a.includes('"stt":1')?(t(s.quantity||1),{success:!0,message:"Thêm vào giỏ hàng thành công"}):(mn.actions.warning({message:"Sản phẩm hiện không thể thêm vào giỏ hàng"}),{success:!1,message:a})}throw new Error(`HTTP error! status: ${i.status}`)}catch(r){throw mn.actions.error({message:"Có lỗi xảy ra, vui lòng thử lại sau"}),r}finally{e.value=!1}}}}const Oz={class:"p-[8px] flex flex-col group sm:hover:shadow duration-200 h-full"},Rz=["src","alt"],Lz=["src","alt"],Dz={class:"flex flex-col flex-1 mt-2"},jz={key:0,class:"mt-1 text-sm text-gray-500 line-clamp-2"},Nz={key:1,class:"flex flex-wrap items-center mt-1"},Fz={class:"mr-1 text-sm font-semibold text-red-500"},zz={key:0},qz={key:1},Bz={key:2},Uz={key:0,class:"text-xs font-light text-gray-500"},Vz={key:2,class:"flex items-center mt-1"},Hz={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Wz={key:0,class:"mt-4"},Gz=["href"],Kz={key:1,class:"mt-4"},Qz=["href"],Jz=["src"],Xz=l("div",{class:"leading-[140%]"},"Chat zalo",-1),Zz=l("div",{class:"leading-[140%]"},"Liên hệ hotline",-1),Yz=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"CardProduct",props:{item:{type:Object}},emits:["open-flow-checkout","send-message","loading"],setup(e,{emit:t}){var V,X;const n={[ii]:"https://zalo.me/0935194469",[ns]:"https://zalo.me/2915476565064825313"},s=e,r=t,o=R(!1),i=((X=(V=B.bot)==null?void 0:V.config)==null?void 0:X.ui.logo)||`${B.appDomain}/link.png`,a=R(null),c=R(!1),u=R(!1),d=R(!1);Ka(s.item.links)&&(s.item.links=JSON.parse(s.item.links)),Pe(c,T=>{r("loading",T)});const f=T=>new URLSearchParams(window.location.search).get(T);Qe(()=>{a.value=window.location.origin,d.value=!!f("preview")});const h=async()=>{var T;if(!c.value)try{c.value=!0;let A=B.selectedForm;const D=pi(s.item);(T=D.texts)!=null&&T.price&&(D.price=0,D.old_price=0);const Q={...D,quantity:1};if(A){let W=!1;A.items.forEach(H=>{var K,F;((K=H.sku)==null?void 0:K.toString())===((F=Q.sku)==null?void 0:F.toString())&&(W=!0,H.quantity=Number(H.quantity)+1)}),A={...A,items:W?A.items:[...A.items,Q]}}else A={items:[Q]};Cl().update({formData:A,status:"draft"}),B.handle===$s&&v({hideCheckout:!0})}catch{}finally{c.value=!1}},g=async()=>{try{if(c.value)return;c.value=!0;const T={quantity:1,product_id:s.item.product_id,product_sku:s.item.product_sku},{data:A}=await Xe.cart.add(T);A.success&&(B.cart=A.data,r("open-flow-checkout"),ECG.sync.emit("cart",{source:"easy-ai-chat",data:A.data}))}catch(T){console.log("ecg error: ",T)}finally{c.value=!1}};function p(){B.handle===Mn?g():B.handle===si?_(s.item.sku):B.handle===_r?k():B.handle===so?$():B.handle===ns?E():B.handle===wr?w():h(),P("add_to_cart",{product_id:s.item.product_sku,name:s.item.title,price:s.item.price,quantity:1})}const v=async(T={})=>{let{title:A,image:D,source:Q}=s.item;const W=L(),H=await Cr(D);H.status||(D=i);const K=ao({title:A,image:D,source:Q,isImageValid:H.status,cartUrl:W,...T});r("send-message",K)};async function _(T){if(c.value)return;const A="https://mediamart.vn/cart/add-items/";try{if(!T)throw new Error("Product IDs are required");c.value=!0;let D="";if(Array.isArray(T)){if(T.length===0)throw new Error("Product IDs array cannot be empty");T.forEach(H=>{if(!H||H<=0)throw new Error("All product IDs must be positive numbers")}),D=T.join(",")}else{if(T<=0)throw new Error("Product ID must be a positive number");D=T.toString()}const Q=A+D+"?utm_source=easyai",W=await fetch(Q,{method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}});if(!W.ok){const H=await W.text();throw console.log("Error response:",H),new Error(`HTTP error! status: ${W.status} - ${H}`)}await W.text(),u.value=!0,v()}catch(D){console.error("Error adding items to cart:",D)}finally{c.value=!1}}async function k(){var T;try{if(c.value)return;c.value=!0;const A=await pv().addToCart({productId:s.item.product_id,quantity:1,serviceIds:[],giftItems:[],selectedReceiveAtWarehouse:!1});if(A&&A.data){u.value=!0,v();const D=(T=A.data.products)==null?void 0:T.reduce((H,K)=>H+K.quantity,0),Q=document.querySelector('a[href="/checkout/cart"] .bg-product-salePrice'),W=document.querySelector("#bottomMobileTab .bg-red.rounded-full");Q&&(Q.textContent=D||0),W&&(W.textContent=D||0)}c.value=!1}catch(A){console.error("Error adding items to cart:",A)}finally{c.value=!1}}async function w(){var T,A;try{if(c.value)return;c.value=!0;const H=(((s.item.links||{}).variants||[])[0]||{}).rule_id||"",K=s.item.product_id||s.item.product_sku||((A=(T=s.item.source)==null?void 0:T.match(/pid(\d+)/))==null?void 0:A[1])||"",F=await gv().addToCart({productId:K,ruleId:H,quantity:1});F&&F.success&&(u.value=!0,v())}catch(D){console.error("ViettelStore: Error adding to cart:",D)}finally{c.value=!1}}async function $(){try{if(c.value||!s.item.product_id)return;c.value=!0;const T=await mv().addToCart({variantId:s.item.product_id,quantity:1});T&&T.success&&(u.value=!0,v()),c.value=!1}catch(T){console.error("Error adding items to cart:",T)}finally{c.value=!1}}async function E(){var T;try{if(c.value)return;const A=(T=s.item.links)==null?void 0:T.purchase_info;if(!A||!A.purchasable||!A.product_id)return;c.value=!0;const D=`${A.product_id}-${A.product_type??0}`,Q=new FormData;Q.append("action","create"),Q.append("item_type","product"),Q.append("item_id",D),Q.append("props[quantity]",1);const H=await(await fetch("https://www.phucanh.vn/ajax/cart.php",{method:"POST",body:Q})).json();if((H.status==="success"||H.status==="error"&&H.error_type==="item-in-cart")&&(H.status==="error"&&H.error_type==="item-in-cart"&&mn.actions.warning({message:H.message||"Sản phẩm đã tồn tại trong giỏ hàng"}),H.status==="success")){u.value=!0;const K=document.getElementById("count_shopping_cart_store");if(K){const F=parseInt(K.textContent)||0;K.textContent=F+1}v()}}catch(A){console.error("Error adding items to cart Phuc Anh:",A)}finally{c.value=!1}}function P(T,A={}){["hotline","add_to_cart","checkout"].includes(T)&&Qt.ctaClick({type:T,...A})}function I(T,A={}){["product","page"].includes(T)&&Qt.linkClick({type:T,...A})}const M=()=>{const{image:T,image_url:A}=s.item;return T||(Array.isArray(A)&&A[0]?A[0]:(o.value=!0,null))},L=()=>({[_r]:"/checkout/cart?utm_source=easyai&utm_medium=productcard",[si]:"/cart?utm_source=easyai&utm_medium=productcard",[so]:"/cart?utm_source=easyai&utm_medium=productcard",[wr]:"/gio-hang.html?utm_source=easyai&utm_medium=productcard",[ns]:"/cart?utm_source=easyai&utm_medium=productcard"})[B.handle]||"/cart";return(T,A)=>{var D,Q,W,H,K,F,ne,fe,_e,we;return m(),x("div",Oz,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:d.value?"_blank":"_self",onClick:A[1]||(A[1]=je=>I("product",{url:e.item.source})),class:"rounded-sm overflow-hidden flex items-center justify-center aspect-[1/1]"},{default:Se(()=>[M()&&!o.value?(m(),x("img",{key:0,src:M(),alt:e.item.title,class:"object-contain w-full h-full",onError:A[0]||(A[0]=()=>o.value=!0)},null,40,Rz)):(m(),x("img",{key:1,src:y(i),alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,Lz))]),_:1},8,["href","target"])),l("div",Dz,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:d.value?"_blank":"_self",onClick:A[2]||(A[2]=je=>I("product",{url:e.item.source})),class:"text-sm font-medium text-gray-900 line-clamp-2 sm:group-hover:text-primary",style:{"word-break":"break-word"}},{default:Se(()=>[Be(j(e.item.title),1)]),_:1},8,["href","target"])),!e.item.price&&!e.item.rating&&e.item.description?(m(),x("p",jz,j(e.item.description),1)):q("",!0),y(B).handle!==y(br)?(m(),x("div",Nz,[l("div",Fz,[e.item.texts&&e.item.texts.price?(m(),x("div",zz,j(e.item.texts.price),1)):e.item.price?(m(),x("div",qz,j(y(et)(e.item.price,{currency:e.item.currency})),1)):(m(),x("div",Bz,"Liên hệ"))]),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",Uz,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):q("",!0)])):q("",!0),Number(e.item.rating)||e.item.review_count?(m(),x("div",Vz,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):q("",!0),e.item.review_count?(m(),x("div",Hz," ("+j(e.item.review_count)+") ",1)):q("",!0)])):q("",!0)]),u.value?(m(),x("div",Wz,[l("a",{href:L(),onClick:A[3]||(A[3]=je=>P("checkout",{product_id:e.item.product_id||e.item.product_sku,name:e.item.title,price:e.item.price,quantity:1})),class:"flex justify-center items-center p-2 w-full text-sm text-white rounded border transition-colors duration-200 bg-[#FC7600] border-[#FC7600] hover:bg-[#FC7600]/80 hover:border-[#FC7600]/80"},[G(y(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Be(" Thanh toán ngay ")],8,Gz)])):(m(),x("div",Kz,[y(B).handle===y(Mn)||y(B).forms.order&&e.item.price&&y(B).handle!==y(br)&&!(y(B).handle===y(ns)&&(!((D=e.item.links)!=null&&D.purchase_info)||!((W=(Q=e.item.links)==null?void 0:Q.purchase_info)!=null&&W.purchasable)||!((K=(H=e.item.links)==null?void 0:H.purchase_info)!=null&&K.product_id)))?(m(),x("button",{key:0,onClick:A[4]||(A[4]=je=>p()),class:te(["flex justify-center items-center p-2 w-full text-sm bg-white rounded border border-gray-200",c.value?"cursor-pointer text-gray-400":"hover:bg-primary hover:text-white hover:border-primary text-gray-600"])},[c.value?(m(),oe(en,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),Be(" Thêm vào giỏ ")],2)):y(B).handle===y(ii)&&!e.item.price||y(B).handle===y(ns)&&(!((F=e.item.links)!=null&&F.purchase_info)||!((fe=(ne=e.item.links)==null?void 0:ne.purchase_info)!=null&&fe.purchasable)||!((we=(_e=e.item.links)==null?void 0:_e.purchase_info)!=null&&we.product_id))?(m(),x("a",{key:1,href:n[y(B).handle],target:"_blank",class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[l("img",{src:y(fd),class:"w-[18px] h-[18px] mr-2"},null,8,Jz),Xz],8,Qz)):y(B).handle===y(br)?(m(),x("a",{key:2,href:"tel:19002628",onClick:A[5]||(A[5]=je=>P("hotline",{value:"19002628"})),class:"flex justify-center items-center p-2 mt-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(ll),{size:"18",class:"mr-2"}),Zz])):q("",!0)]))])}}}},Symbol.toStringTag,{value:"Module"})),eq={class:"p-[12px] group border border-gray-200 w-full"},tq={class:"flex"},nq=["src","alt"],sq=["src","alt"],rq={class:"flex flex-col flex-1"},oq={key:0,class:"my-1 text-sm text-gray-500 line-clamp-2"},iq={class:"flex flex-wrap items-center mt-1"},aq={class:"mr-1 text-sm font-semibold text-red-500"},lq={key:0},cq={key:1},uq={key:2},dq={key:0,class:"text-xs font-light text-gray-500"},fq={key:1,class:"flex items-center"},hq={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},pq={key:0,class:"mt-2"},mq=["href"],gq=["href"],vq=["src"],yq=l("div",{class:"leading-[140%]"},"Chat zalo",-1),bq=l("div",{class:"leading-[140%]"},"Liên hệ hotline",-1),_q=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"CardProductRow",props:{item:{type:Object}},emits:["open-flow-checkout","send-message","loading"],setup(e,{emit:t}){var V,X;const n={[ii]:"https://zalo.me/0935194469",[ns]:"https://zalo.me/2915476565064825313"},s=e,r=t,o=R(!1),i=((X=(V=B.bot)==null?void 0:V.config)==null?void 0:X.ui.logo)||`${B.appDomain}/link.png`,a=R(null),c=R(!1);Ka(s.item.links)&&(s.item.links=JSON.parse(s.item.links));const u=R(!1),d=R(!1);Pe(u,T=>{r("loading",T)});const f=T=>new URLSearchParams(window.location.search).get(T);Qe(()=>{a.value=window.location.origin,c.value=!!f("preview")});const h=async()=>{var T;if(!u.value)try{u.value=!0;let A=B.selectedForm;const D=pi(s.item);(T=D.texts)!=null&&T.price&&(D.price=0,D.old_price=0);const Q={...D,quantity:1};if(A){let W=!1;A.items.forEach(H=>{var K,F;((K=H.sku)==null?void 0:K.toString())===((F=Q.sku)==null?void 0:F.toString())&&(W=!0,H.quantity=Number(H.quantity)+1)}),A={...A,items:W?A.items:[...A.items,Q]}}else A={items:[Q]};Cl().update({formData:A,status:"draft"}),B.handle===$s&&v({hideCheckout:!0})}catch{}finally{u.value=!1}},g=async()=>{try{if(u.value)return;u.value=!0;const T={quantity:1,product_id:s.item.product_id,product_sku:s.item.product_sku},{data:A}=await Xe.cart.add(T);A.success&&(B.cart=A.data,r("open-flow-checkout"),ECG.sync.emit("cart",{source:"easy-ai-chat",data:A.data}))}catch(T){console.log("ecg error: ",T)}finally{u.value=!1}};function p(){B.handle===Mn?g():B.handle===si?_(s.item.sku):B.handle===_r?k():B.handle===so?$():B.handle===ns?E():B.handle===wr?w():h(),P("add_to_cart",{product_id:s.item.product_sku,name:s.item.title,price:s.item.price,quantity:1})}const v=async(T={})=>{let{title:A,image:D,source:Q}=s.item;const W=L(),H=await Cr(D);H.status||(D=i);const K=ao({title:A,image:D,source:Q,isImageValid:H.status,cartUrl:W,...T});r("send-message",K)};async function _(T){if(u.value)return;const A="https://mediamart.vn/cart/add-items/";try{if(!T)throw new Error("Product IDs are required");u.value=!0;let D="";if(Array.isArray(T)){if(T.length===0)throw new Error("Product IDs array cannot be empty");T.forEach(H=>{if(!H||H<=0)throw new Error("All product IDs must be positive numbers")}),D=T.join(",")}else{if(T<=0)throw new Error("Product ID must be a positive number");D=T.toString()}const Q=A+D+"?utm_source=easyai",W=await fetch(Q,{method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}});if(!W.ok){const H=await W.text();throw console.log("Error response:",H),new Error(`HTTP error! status: ${W.status} - ${H}`)}await W.text(),d.value=!0,v()}catch(D){console.error("Error adding items to cart:",D)}finally{u.value=!1}}async function k(){var T;try{if(u.value)return;u.value=!0;const A=await pv().addToCart({productId:s.item.product_id,quantity:1,serviceIds:[],giftItems:[],selectedReceiveAtWarehouse:!1});if(A&&A.data){d.value=!0,v();const D=(T=A.data.products)==null?void 0:T.reduce((H,K)=>H+K.quantity,0),Q=document.querySelector('a[href="/checkout/cart"] .bg-product-salePrice'),W=document.querySelector("#bottomMobileTab .bg-red.rounded-full");Q&&(Q.textContent=D||0),W&&(W.textContent=D||0)}u.value=!1}catch(A){console.error("Error adding items to cart:",A)}finally{u.value=!1}}async function w(){var T,A;try{if(u.value)return;u.value=!0;const H=(((s.item.links||{}).variants||[])[0]||{}).rule_id||"",K=s.item.product_id||s.item.product_sku||((A=(T=s.item.source)==null?void 0:T.match(/pid(\d+)/))==null?void 0:A[1])||"",F=await gv().addToCart({productId:K,ruleId:H,quantity:1});F&&F.success&&(d.value=!0,v())}catch(D){console.error("ViettelStore: Error adding to cart:",D)}finally{u.value=!1}}async function $(){try{if(u.value)return;u.value=!0;const T=await mv().addToCart({variantId:s.item.product_id,quantity:1});T&&T.success&&(d.value=!0,v()),u.value=!1}catch(T){console.error("Error adding items to cart:",T)}finally{u.value=!1}}async function E(){var T;try{if(u.value)return;const A=(T=s.item.links)==null?void 0:T.purchase_info;if(!A||!A.purchasable||!A.product_id)return;u.value=!0;const D=`${A.product_id}-${A.product_type??0}`,Q=new FormData;Q.append("action","create"),Q.append("item_type","product"),Q.append("item_id",D),Q.append("props[quantity]",1);const H=await(await fetch("https://www.phucanh.vn/ajax/cart.php",{method:"POST",body:Q})).json();if(console.log(H),(H.status==="success"||H.status==="error"&&H.error_type==="item-in-cart")&&(H.status==="error"&&H.error_type==="item-in-cart"&&mn.actions.warning({message:H.message||"Sản phẩm đã tồn tại trong giỏ hàng"}),H.status==="success")){d.value=!0;const K=document.getElementById("count_shopping_cart_store");if(K){const F=parseInt(K.textContent)||0;K.textContent=F+1}v()}}catch(A){console.error("Error adding items to cart Phuc Anh:",A)}finally{u.value=!1}}function P(T,A={}){["hotline","add_to_cart","checkout"].includes(T)&&Qt.ctaClick({type:T,...A})}function I(T,A={}){["product","page"].includes(T)&&Qt.linkClick({type:T,...A})}const M=()=>{const{image:T,image_url:A}=s.item;return T||(Array.isArray(A)&&A[0]?A[0]:(o.value=!0,null))},L=()=>({[_r]:"/checkout/cart?utm_source=easyai&utm_medium=productcard",[si]:"/cart?utm_source=easyai&utm_medium=productcard",[so]:"/cart?utm_source=easyai&utm_medium=productcard",[wr]:"/gio-hang.html?utm_source=easyai&utm_medium=productcard",[ns]:"/cart?utm_source=easyai&utm_medium=productcard"})[B.handle]||"/cart";return(T,A)=>{var D,Q,W,H,K,F,ne,fe,_e,we;return m(),x("div",eq,[l("div",tq,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:c.value?"_blank":"_self",onClick:A[1]||(A[1]=je=>I("product",{url:e.item.source})),class:"rounded overflow-hidden w-[110px] h-[110px] flex items-center justify-center mr-3 flex-shrink-0"},{default:Se(()=>[M()&&!o.value?(m(),x("img",{key:0,src:M(),alt:e.item.title,class:"object-contain w-full h-full",onError:A[0]||(A[0]=()=>o.value=!0)},null,40,nq)):(m(),x("img",{key:1,src:y(i),alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,sq))]),_:1},8,["href","target"])),l("div",rq,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:c.value?"_blank":"_self",onClick:A[2]||(A[2]=je=>I("product",{url:e.item.source})),class:"text-sm font-medium text-gray-900 line-clamp-2 group-hover:text-primary",style:{"word-break":"break-word"}},{default:Se(()=>[Be(j(e.item.title),1)]),_:1},8,["href","target"])),!e.item.price&&!e.item.rating&&e.item.description?(m(),x("p",oq,j(e.item.description),1)):q("",!0),l("div",iq,[l("div",aq,[e.item.texts&&e.item.texts.price?(m(),x("div",lq,j(e.item.texts.price),1)):e.item.price?(m(),x("div",cq,j(y(et)(e.item.price,{currency:e.item.currency})),1)):(m(),x("div",uq,"Liên hệ"))]),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",dq,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):q("",!0)]),Number(e.item.rating)||e.item.review_count?(m(),x("div",fq,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):q("",!0),e.item.review_count?(m(),x("div",hq," ("+j(e.item.review_count)+") ",1)):q("",!0)])):q("",!0)])]),d.value?(m(),x("div",pq,[l("a",{href:L(),onClick:A[3]||(A[3]=je=>P("checkout",{product_id:e.item.product_id||e.item.product_sku,name:e.item.title,price:e.item.price,quantity:1})),class:"flex justify-center items-center p-2 w-full text-sm text-white rounded border transition-colors duration-200 bg-[#FC7600] border-[#FC7600] hover:bg-[#FC7600]/80 hover:border-[#FC7600]/80"},[G(y(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Be(" Thanh toán ngay ")],8,mq)])):(m(),x(be,{key:1},[y(B).handle===y(Mn)||y(B).forms.order&&e.item.price&&y(B).handle!==y(br)&&!(y(B).handle===y(ns)&&(!((D=e.item.links)!=null&&D.purchase_info)||!((W=(Q=e.item.links)==null?void 0:Q.purchase_info)!=null&&W.purchasable)||!((K=(H=e.item.links)==null?void 0:H.purchase_info)!=null&&K.product_id)))?(m(),x("button",{key:0,onClick:A[4]||(A[4]=je=>p()),class:te(["flex justify-center items-center p-2.5 mt-2 w-full text-sm bg-white rounded border border-gray-200",u.value?"cursor-pointer text-gray-400":"hover:bg-primary hover:text-white hover:border-primary text-gray-600"])},[u.value?(m(),oe(en,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),Be(" Thêm vào giỏ ")],2)):y(B).handle===y(ii)&&!e.item.price||y(B).handle===y(ns)&&(!((F=e.item.links)!=null&&F.purchase_info)||!((fe=(ne=e.item.links)==null?void 0:ne.purchase_info)!=null&&fe.purchasable)||!((we=(_e=e.item.links)==null?void 0:_e.purchase_info)!=null&&we.product_id))?(m(),x("a",{key:1,href:n[y(B).handle],target:"_blank",class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[l("img",{src:y(fd),class:"w-[18px] h-[18px] mr-2"},null,8,vq),yq],8,gq)):y(br)===y(B).handle?(m(),x("a",{key:2,href:"tel:19002628",onClick:A[5]||(A[5]=je=>P("hotline",{value:"19002628"})),class:"flex justify-center items-center p-2 mt-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(ll),{size:"18",class:"mr-2"}),bq])):q("",!0)],64))])}}}},Symbol.toStringTag,{value:"Module"})),xq={key:0,class:"flex flex-col p-2 group"},wq=["href"],kq=["src","alt"],Sq=["src","alt"],$q={class:"flex flex-col flex-1 mt-2"},Cq=["href"],Tq={class:"flex flex-wrap items-center mt-1"},Eq={class:"mr-1 text-sm font-semibold text-red-500"},Aq={key:0,class:"text-xs font-light text-gray-500"},Iq={key:0,class:"flex items-center mt-1"},Pq={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Mq=l("div",null,"Thêm vào giỏ",-1),Oq={key:1,class:"flex p-2 border border-gray-200 group"},Rq=["href"],Lq=["src","alt"],Dq=["src","alt"],jq={class:"flex flex-col flex-1 ml-3 min-w-0"},Nq=["href"],Fq={class:"flex flex-wrap items-center mt-1"},zq={class:"mr-1 text-sm font-semibold text-red-500"},qq={key:0,class:"text-xs font-light text-gray-500"},Bq={key:0,class:"flex items-center mt-1"},Uq={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Vq=l("div",null,"Thêm vào giỏ",-1),Hq=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"CardProductRangDong",props:{item:{type:Object},type:{type:String,default:"vertical",validator:e=>["vertical","horizontal"].includes(e)}},emits:["open-flow-checkout"],setup(e,{emit:t}){const n="https://widget.geteasy.ai",s=e,r=t,o=R(!1),i=R(!1),a=ee(()=>{var d,f;return((f=(d=ae.bot.config)==null?void 0:d.ui)==null?void 0:f.logo)||`${n}/link.png`}),c=async()=>{try{if(i.value)return;i.value=!0;const d={quantity:1,product_id:s.item.product_id,product_sku:s.item.product_sku},{data:f}=await Xe.cart.add(d);f.success&&(B.cart=f.data,r("open-flow-checkout"),ECG.sync.emit("cart",{source:"easy-ai-chat",data:f.data}))}catch(d){console.log("ecg error: ",d)}finally{i.value=!1}},u=()=>{var f,h,g,p;const d=pi(s.item)??{};((h=(f=d.links)==null?void 0:f.variants)==null?void 0:h.length)>0?(wm.actions.setSelectedProduct({...d,options:((g=d.links)==null?void 0:g.options)??[],variants:((p=d.links)==null?void 0:p.variants)??[]}),wm.actions.toggleOpenPanelVariants(!0)):c()};return(d,f)=>e.type==="vertical"?(m(),x("div",xq,[l("a",{href:e.item.source,target:"_self",class:"rounded overflow-hidden flex items-center justify-center aspect-[1/1]"},[e.item.image&&!o.value?(m(),x("img",{key:0,src:e.item.image,alt:e.item.title,class:"object-cover w-full h-full",onError:f[0]||(f[0]=()=>o.value=!0)},null,40,kq)):(m(),x("img",{key:1,src:a.value,alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,Sq))],8,wq),l("div",$q,[l("a",{href:e.item.source,target:"_self",class:"text-sm font-medium text-gray-900 line-clamp-2 sm:group-hover:text-primary"},j(e.item.title),9,Cq),l("div",Tq,[l("div",Eq,j(y(et)(e.item.price,{currency:e.item.currency})),1),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",Aq,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):q("",!0)]),Number(e.item.rating)||e.item.review_count?(m(),x("div",Iq,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):q("",!0),e.item.review_count?(m(),x("div",Pq," ("+j(e.item.review_count)+") ",1)):q("",!0)])):q("",!0)]),l("button",{onClick:f[1]||(f[1]=h=>u()),class:"flex justify-center items-center p-2 mt-4 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[i.value?(m(),oe(en,{key:0,class:"w-[16px] h-[16px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",class:"mr-1 size-[16px]"})),Mq])])):(m(),x("div",Oq,[l("a",{href:e.item.source,target:"_self",class:"flex overflow-hidden flex-shrink-0 justify-center items-center size-[100px] rounded"},[e.item.image&&!o.value?(m(),x("img",{key:0,src:e.item.image,alt:e.item.title,class:"object-cover w-full h-full",onError:f[2]||(f[2]=()=>o.value=!0)},null,40,Lq)):(m(),x("img",{key:1,src:a.value,alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,Dq))],8,Rq),l("div",jq,[l("a",{href:e.item.source,target:"_self",class:"text-sm font-medium text-gray-900 line-clamp-2 sm:group-hover:text-primary"},j(e.item.title),9,Nq),l("div",Fq,[l("div",zq,j(y(et)(e.item.price,{currency:e.item.currency})),1),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",qq,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):q("",!0)]),Number(e.item.rating)||e.item.review_count?(m(),x("div",Bq,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):q("",!0),e.item.review_count?(m(),x("div",Uq," ("+j(e.item.review_count)+") ",1)):q("",!0)])):q("",!0),l("button",{onClick:f[3]||(f[3]=h=>u()),class:"flex justify-center items-center p-1.5 mt-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[i.value?(m(),oe(en,{key:0,class:"w-[16px] h-[16px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",class:"mr-1 size-[16px]"})),Vq])])]))}}},Symbol.toStringTag,{value:"Module"})),vv=()=>{var n,s;return(ae.state.handle||((s=(n=window==null?void 0:window.EAI)==null?void 0:n._config)==null?void 0:s.handle))===Mn},Hn={addToCart:[".rangdong-add-to-cart"],buyNow:[".btn-buy-now",".rangdong-buy-now"],cartSize:[".cart-box .badge"],cartTotalPrice:[".flex.items-center.justify-between.caption .font-medium.text-red-400.body-text"],purchaseTotalPrice:[".rangdong-purchase-total-price"],quantityInput:["#quantity-product"],purchaseCustomerName:[".rangdong-purchase-customer-name"],purchaseCustomerPhone:[".rangdong-purchase-customer-phone"],purchaseCustomerEmail:[".rangdong-purchase-customer-email"],purchaseCustomerShippingAddress:[".rangdong-purchase-shipping-address"],purchaseCustomerDeliveryMethod:[".rangdong-purchase-delivery-method-name"],purchaseCustomerPaymentGateway:[".rangdong-purchase-payment-gateway-name"]},Ml={category:/^\/([a-z0-9-]+)-c-(\d+)\/?$/,product:/^\/([a-z0-9-]+)-p-(\d+)$/,search:/^\/tim-kiem\?keyword=([^&]+)/,checkout:/^\/don-hang\/?$/,purchase:/^\/dat-hang-thanh-cong\?orderId=([^&]+)/};let hd=[];const yv=(e,t)=>{const n=e.match(t);return(n==null?void 0:n[2])||null},Wq=e=>{const t=e.match(Ml.purchase);return(t==null?void 0:t[1])||null},bv=e=>{for(const[t,n]of Object.entries(Ml))if(n.test(e))return t;return"unknown"},Gq=e=>{if(!e.includes("?"))return{};const[,t]=e.split("?"),n={};return new URLSearchParams(t).forEach((s,r)=>{n[r]=s}),n},Kq=()=>{var e;for(const t of Hn.cartSize){const n=document.querySelector(t);if(n)return((e=n.textContent)==null?void 0:e.trim())||"0"}return"0"},Qq=()=>{var e;for(const t of Hn.cartTotalPrice){const n=document.querySelector(t);if(n)return((e=n.textContent)==null?void 0:e.trim())||"0"}return"0"},Jq=()=>{var e;for(const t of Hn.purchaseTotalPrice){const n=document.querySelector(t);if(n)return((e=n.textContent)==null?void 0:e.trim())||"0"}return"0"},Xq=()=>{var e;for(const t of Hn.quantityInput){const n=document.querySelector(t);if(n)return((e=n.value)==null?void 0:e.trim())||"1"}return"1"},yo=e=>{var t;for(const n of e){const s=document.querySelector(n);if(s)return((t=s.innerText)==null?void 0:t.trim())||""}return""},Zq=()=>({name:yo(Hn.purchaseCustomerName),phone:yo(Hn.purchaseCustomerPhone),email:yo(Hn.purchaseCustomerEmail),shipping_address:yo(Hn.purchaseCustomerShippingAddress),delivery_method:yo(Hn.purchaseCustomerDeliveryMethod),payment_gateway:yo(Hn.purchaseCustomerPaymentGateway)}),Yq=()=>{hd.forEach(({element:e,event:t,handler:n})=>{e.removeEventListener(t,n)}),hd=[]},eB=(e,t,n,s)=>{const r=Xq();Fe.addToCart({id:e??"",name:t??"",price:n??"",image:s??"",quantity:r,brand:"Rạng Đông"})},tB=(e,t,n,s)=>{const r=[];if(Hn.addToCart.forEach(i=>{const a=document.querySelectorAll(i);r.push(...a)}),Hn.buyNow.forEach(i=>{const a=document.querySelectorAll(i);r.push(...a)}),r.length===0)return;const o=()=>{eB(e,t,n,s)};r.forEach(i=>{i.addEventListener("click",o),hd.push({element:i,event:"click",handler:o})})},nB=()=>{const e=Kq(),t=Qq();Fe.checkout({cart_size:e,cart_total_price:t})},sB=e=>{const t=Wq(e),n=Jq(),s=Zq();Fe.purchase({order_id:t??"",total_value:n??"",customer:s})};yi(e=>{if(!vv())return;switch(bv(e)){case"search":const{keyword:n}=Gq(e);Fe.search({search_term:n??""});break;case"purchase":setTimeout(()=>{sB(e)},1500);break}},!0),Sm(e=>{Yq();const t=()=>{var r;const n=bv(e),s=ss("Product")||{};switch(n){case"category":const o=yv(e,Ml.category);Fe.categoryView({category_id:o??"",name:s.name??s.title??"",brand:"Rạng Đông",image:s.image??"",url:window.location.href});break;case"product":const a={id:yv(e,Ml.product)??s.productID??"",sku:s.sku??"",name:s.name??s.title??"",brand:"Rạng Đông",price:((r=s.offers)==null?void 0:r.price)??"",image:s.image??"",url:window.location.href};Fe.productView(a),setTimeout(()=>{tB(a.product_id,a.name,a.price,a.image)},1500);break;case"checkout":setTimeout(()=>{nB()},1500);break}};setTimeout(()=>{vv()&&t()},1e3)},!0);const rB=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),oB=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},iB=()=>window.location.hostname==="m.pico.vn",aB=()=>{var n,s;return(ae.state.handle||((s=(n=window==null?void 0:window.EAI)==null?void 0:n._config)==null?void 0:s.handle))===_r},lB={cart:/^\/checkout\/cart\/?$/,purchase:/^\/checkout\/confirm\/?$/,login:/^\/login\/?$/,register:/^\/register\/?$/,category:/^\/[a-z0-9-]+\.c\/?$/,product:/^\/[a-z0-9-]+-[A-Z0-9]+$/},_v={productCard:[".productCardSwp",".itemProducts"],addToCartButton:["#add-to-cart","#buy-now","#installment"]},xv=e=>{if(!e.includes("?"))return{};const t={};return new URLSearchParams(e.split("?")[1]).forEach((n,s)=>{t[s]=n}),t},cB=e=>xv(e).query||null,uB=e=>e.split("/").filter(Boolean).length===1,dB=e=>{const t=new URL(e,window.location.origin).pathname;if(ss("CollectionPage"))return"category";for(const[s,r]of Object.entries(lB))if(r.test(t))return s;return"unknown"},bo=e=>{const t=e==null?void 0:e.match(/([\d.]+(?:\s*đ)?)/i);return t?t[0].trim():null},pd=e=>{const t=e==null?void 0:e.match(/-([A-Z0-9]+)$/);return t?t[1]:null},fB=()=>{var s,r;const e=ss("CollectionPage");if(e){let o=e.name;if(!o){const i=Cs();o=i==null?void 0:i.title}if(!o){const i=document.querySelector("title");o=(s=i==null?void 0:i.textContent)==null?void 0:s.trim()}return{name:o||"null",brand:"Pico",url:window.location.href,description:e.description||""}}const t=Cs();let n=t==null?void 0:t.title;if(!n){const o=document.querySelector("title");n=(r=o==null?void 0:o.textContent)==null?void 0:r.trim()}return{name:n||"null",brand:"Pico",url:window.location.href}},hB=()=>{setTimeout(()=>Fe.categoryView(fB()),1e3)},pB=e=>{const t=new URL(e,window.location.origin).pathname,n=uB(t)?cB(e):null;n&&Fe.search({search_term:n})},mB=e=>{var o;const t={},n=e.querySelector("a.line-clamp-2");n&&(t.name=(o=n.textContent)==null?void 0:o.trim(),t.product_sku=pd(n.href));const s=e.querySelector(".sale-price .text-2xl.font-extrabold.text-red-500, .sale-price p");s&&(t.price=bo(s.textContent));const r=e.querySelector(".originPrice .text-base.text-zinc-500, .originPrice p");return r&&(t.originPrice=bo(r.textContent)),t},gB=()=>{var i,a,c,u,d,f,h,g,p,v,_,k,w,$;const e=ss("Product");if(e)return{id:e.sku||"",sku:e.sku||"",mpn:e.mpn||"",name:e.name||"",brand:typeof e.brand=="object"?((i=e.brand)==null?void 0:i.name)||"":e.brand||"",price:((c=(a=e.offers)==null?void 0:a.price)==null?void 0:c.toString())||"",originPrice:((d=(u=e.offers)==null?void 0:u.highPrice)==null?void 0:d.toString())||"",image:Array.isArray(e.image)?e.image[0]||"":e.image||"",url:window.location.href};const t={};t.name=((h=(f=document.querySelector("title"))==null?void 0:f.textContent)==null?void 0:h.trim())||((p=(g=document.querySelector("h1"))==null?void 0:g.textContent)==null?void 0:p.trim())||((_=(v=document.querySelector("h3.text-titleDetail"))==null?void 0:v.textContent)==null?void 0:_.trim());const n=Array.from(document.querySelectorAll("li")).find(E=>{var P,I;return(I=(P=E.querySelector(".label"))==null?void 0:P.textContent)==null?void 0:I.includes("Thương hiệu")}),s=n==null?void 0:n.querySelector("span.value a");if(s)t.brand=(k=s.textContent)==null?void 0:k.trim();else{const E=Array.from(document.querySelectorAll(".highLightSpec .label")).find(P=>{var I;return(I=P.textContent)==null?void 0:I.includes("Thương hiệu")});if(E){const P=(w=E.closest(".relative"))==null?void 0:w.querySelector(".value span");P&&(t.brand=($=P.textContent)==null?void 0:$.trim())}}t.product_sku=pd(window.location.pathname);const r=[".text-2xl.font-extrabold.text-red-600",".text-2xl.font-extrabold.text-red-500",".entry-price .text-3xl.font-extrabold.text-orange",".entry-price .text-3xl.font-extrabold.text-white"];for(const E of r){const P=document.querySelector(E);if(P){t.price=bo(P.textContent);break}}const o=[".originPrice .text-base.text-zinc-500",".originPrice p",".entry-price .originPrice",".originPrice.text-dark-800"];for(const E of o){const P=document.querySelector(E);if(P){t.originPrice=bo(P.textContent);break}}return t},vB=()=>{document.addEventListener("click",e=>{for(const t of _v.productCard){const n=e.target.closest(t);if(n){Fe.productSelect(mB(n));break}}})},yB=()=>{setTimeout(()=>Fe.productView(gB()),1500)},bB=()=>{document.querySelectorAll(_v.addToCartButton.join(", ")).forEach(t=>{t.addEventListener("click",()=>{var r,o;const n=ss("Product")||{},s={id:n.sku||"",sku:n.sku||"",name:n.name||"",url:window.location.href,price:((r=n.offers)==null?void 0:r.price)||"",image:Array.isArray(n.image)?n.image[0]||"":n.image||"",brand:typeof n.brand=="object"?((o=n.brand)==null?void 0:o.name)||"":n.brand||""};Fe.addToCart(s)})})},wv=e=>{var n;const t=e.querySelector(".cartItemAction span");return parseInt(((n=t==null?void 0:t.textContent)==null?void 0:n.trim())||"0",10)||0},_B=()=>{const e=Array.from(document.querySelectorAll(".cartItemsContent .cartItem"));if(e.length===0)return"0";const t=e.reduce((n,s)=>n+wv(s),0);return t>0?t.toString():e.length.toString()},md=()=>{var n;const e=(n=document.querySelector(".cartTotal span:nth-child(2)"))==null?void 0:n.textContent,t=bo(e);return t||"0"},xB=()=>Array.from(document.querySelectorAll(".cartItemsContent .cartItem")).map(t=>{var d,f;const n=t.querySelector(".cartItemThumb img"),s=(n==null?void 0:n.src)||(n==null?void 0:n.getAttribute("src"))||"";let r=t.querySelector(".cartItemTitle a");const o=((d=r==null?void 0:r.textContent)==null?void 0:d.trim())||(n==null?void 0:n.getAttribute("alt"))||"";let i;i=t.querySelector(".cartItemPrice p:first-child");const a=((f=i==null?void 0:i.textContent)==null?void 0:f.trim())||"",c=bo(a),u=wv(t);return{name:o,image:s,price:c,quantity:u}}),wB=()=>{setTimeout(()=>{const e=_B();e!=="0"&&Fe.cartView({cart_size:e,cart_total_price:md()})},1500)},kB=()=>{document.addEventListener("click",e=>{var r,o;const t=e.target.closest(".cartItemDelete, button[class*='cartItemDelete'], [data-remove-cart], [data-delete-cart], button[class*='remove'], button[class*='delete'], [aria-label*='xóa'], [aria-label*='remove'], [aria-label*='delete']");if(!t)return;const n=t.closest(".cartItem, [class*='cartItem'], [class*='cart-item'], [data-cart-item]"),s={};if(n){const i=n.querySelector("a, h3, h4, [class*='name'], [class*='title']");i&&(s.name=(r=i.textContent)==null?void 0:r.trim()),s.product_sku=pd((o=n.querySelector("a[href]"))==null?void 0:o.href)}Fe.removeFromCart(s)})},SB=()=>{var r;const e=()=>{const o=xB(),i=o.reduce((c,u)=>c+u.quantity,0).toString();Fe.checkout({cart_size:i,cart_total_price:md(),products:o});const a={total_value:md(),products:o};sessionStorage.setItem("pico_checkout",JSON.stringify(a))},t=document.querySelector("#btnCheckout");if(t){t.addEventListener("click",e);return}const n=['button[type="submit"]',"[data-checkout]","[class*='checkout']","[class*='thanh-toan']","[class*='dat-hang']"],s=["thanh toán","đặt hàng","checkout"];for(const o of n)for(const i of document.querySelectorAll(o)){const a=((r=i.textContent)==null?void 0:r.toLowerCase())||"";if(s.some(c=>a.includes(c))){i.addEventListener("click",e);return}}},$B=()=>{var i,a,c,u,d,f,h,g,p;const e={},t=iB(),n=document.querySelector('input[name="shippingMethod"]:checked');if(n){const v=n.value,_={standard:"Giao hàng tận nơi",pickUpInStore:"Nhận tại cửa hàng"};e.delivery_method=_[v]||v}if(t){const v=document.querySelectorAll('.flex.flex-col .relative.w-full button[type="button"]');if(v.length>0){const _=(c=(a=(i=v[0])==null?void 0:i.querySelector(".truncate"))==null?void 0:a.textContent)==null?void 0:c.trim();_&&_!=="Chọn thành phố"&&(e.city=_)}if(v.length>1){const _=(f=(d=(u=v[1])==null?void 0:u.querySelector(".truncate"))==null?void 0:d.textContent)==null?void 0:f.trim();_&&_!=="Chọn quận huyện"&&(e.district=_)}if(v.length>2){const _=(p=(g=(h=v[2])==null?void 0:h.querySelector(".truncate"))==null?void 0:g.textContent)==null?void 0:p.trim();_&&_!=="Chọn phường xã"&&(e.ward=_)}}else{const v=document.querySelector('input[name="provinceCode[name]"]');v!=null&&v.value&&(e.city=v.value.trim());const _=document.querySelector('input[name="districtCode[name]"]');_!=null&&_.value&&(e.district=_.value.trim());const k=document.querySelector('input[name="wardCode[name]"]');k!=null&&k.value&&(e.ward=k.value.trim())}const s=document.querySelector('input[name="address"][placeholder="Nhập số nhà, tên đường"]');let r="";s!=null&&s.value&&(r=s.value.trim());const o=[r,e.ward,e.district,e.city].filter(Boolean);if(o.length>0&&(e.address=o.join(", ")),e.delivery_method==="pickup"){const v=document.querySelector('input[name="storeCode[name]"]');v!=null&&v.value&&(e.store_name=v.value.trim())}return e},CB=()=>{const e=()=>{const r=$B();Object.keys(r).length>0&&Fe.addShippingInfo(r)},t=oB(e,1e3);document.querySelectorAll('input[name="shippingMethod"]').forEach(r=>{r.addEventListener("change",e,!0)});const n=document.querySelector('input[name="address"][placeholder="Nhập số nhà, tên đường"]');n&&n.addEventListener("input",t,!0),['input[name="provinceCode[name]"]','input[name="districtCode[name]"]','input[name="wardCode[name]"]'].forEach(r=>{const o=document.querySelector(r);o&&(new MutationObserver(t).observe(o,{attributes:!0,attributeFilter:["value"]}),o.addEventListener("input",t,!0),o.addEventListener("change",t,!0))})},TB=()=>{const e=()=>{var s,r;const t=document.querySelector('input[name*="payment"]:checked, input[type="radio"][name*="payment"]:checked, select[name*="payment"]');if(!t)return;const n={method_id:t.id||t.value,method_name:t.getAttribute("data-name")||((r=(s=t.closest("label"))==null?void 0:s.textContent)==null?void 0:r.trim())};Object.keys(n).forEach(o=>!n[o]&&delete n[o]),Object.keys(n).length>0&&Fe.addPaymentInfo(n)};document.querySelectorAll('input[name*="payment"], select[name*="payment"]').forEach(t=>{t.addEventListener("change",e,!0)})},EB=e=>{const t={},n=xv(window.location.href);n.orderNumberId&&(t.order_id=n.orderNumberId);const s=document.body.innerHTML.match(/Đơn hàng:\s*#([A-Z0-9]+)/);if(s&&(t.order_number=s[1]),e)try{const i=JSON.parse(e);t.total_value=i.total_value||"",t.products=i.products||[]}catch(i){console.error("Failed to parse pico checkout data:",i),t.total_value="",t.products=[]}else t.total_value="",t.products=[];const r={gender:"",name:"",phone:"",email:"",shipping_address:"",payment_gateway:"",delivery_method:""},o=document.querySelector(".checkoutPaymentOrderAddress");if(o){const i=o.innerHTML.match(/Khách hàng:<\/span>\s*<span[^>]*>([^-]+)-\s*([\d\s]+)</);i&&(r.name=i[1].trim(),r.phone=i[2].trim().replace(/\s/g,""));const a=o.innerHTML.match(/Giao đến:<\/span>\s*<span[^>]*>([^<]+)</);a&&(r.shipping_address=a[1].trim());const c=o.innerHTML.match(/Hình thức thanh toán:<\/span>\s*<span[^>]*>([^<]+)</);c&&(r.payment_gateway=c[1].trim())}if(!r.name||!r.phone)try{const i=localStorage.getItem("guestInfo");if(i){const a=JSON.parse(i);if(r.gender||(r.gender=a.gender||""),r.name||(r.name=a.name||""),r.phone||(r.phone=a.phone||""),!r.payment_gateway){const c={COD:"Thanh toán khi nhận hàng (COD)",bankTransfer:"Chuyển khoản ngân hàng",creditCard:"Thẻ tín dụng/Ghi nợ"};r.payment_gateway=c[a.payment]||c.COD}}}catch{}return r.delivery_method="",t.customer=r,t};let gd=!1;const AB=()=>{if(gd)return;const e=sessionStorage.getItem("pico_checkout");e&&setTimeout(()=>{const t=EB(e);t.order_id&&(Fe.purchase(t),gd=!0,setTimeout(()=>gd=!1,6e4),sessionStorage.removeItem("pico_checkout"))},1500)},IB=e=>{var n,s;const t=(s=(n=e.querySelector('input[name="phone"]'))==null?void 0:n.value)==null?void 0:s.trim();return t?{phone:t}:{}},PB=e=>{var o,i,a,c,u,d;const t={},n=(i=(o=e.querySelector('input[name="name"]'))==null?void 0:o.value)==null?void 0:i.trim(),s=(c=(a=e.querySelector('input[name="phone"]'))==null?void 0:a.value)==null?void 0:c.trim(),r=(d=(u=e.querySelector('input[name="email"]'))==null?void 0:u.value)==null?void 0:d.trim();return n&&(t.name=n),s&&(t.phone=s),r&&(t.email=r),t},MB=()=>{const e=document.querySelector("form");e&&e.addEventListener("submit",t=>{const n=IB(e);n.phone&&sessionStorage.setItem("pico_login_data",JSON.stringify(n))},!0)},kv=()=>{let e=!1;const t=()=>{var o,i;if(e)return;const s=['[aria-haspopup="menu"] span','[id*="radix"] span'];let r=null;for(const a of s){const c=document.querySelectorAll(a);for(const u of c){const d=(o=u.textContent)==null?void 0:o.trim();if(d&&d.includes("Chào,")){r=d;break}}if(r)break}if(!r){const a=document.querySelectorAll("span");for(const c of a){const u=(i=c.textContent)==null?void 0:i.trim();if(u&&u.includes("Chào,")){r=u;break}}}if(r&&r.includes("Chào,")){const a=sessionStorage.getItem("pico_login_data");if(a)try{const c=JSON.parse(a),u=r.match(/Chào,\s*(.+)/);u&&u[1]&&(c.name=u[1].trim()),Fe.login(c),sessionStorage.removeItem("pico_login_data"),e=!0}catch{}}};setTimeout(t,1e3),new MutationObserver(()=>{t()}).observe(document.body,{childList:!0,subtree:!0})},OB=()=>{const e=s=>{var i;const r=document.querySelector("h3.text-HeadlineLarge"),o=(i=r==null?void 0:r.textContent)==null?void 0:i.trim();if(o&&o.includes("Đăng ký tài khoản thành công")){const a=sessionStorage.getItem("pico_signup_data");if(a)try{const c=JSON.parse(a);Fe.signUp(c),sessionStorage.removeItem("pico_signup_data"),s&&s.disconnect()}catch{}}};setTimeout(()=>e(null),500);const t=new MutationObserver(()=>{e(t)});t.observe(document.body,{childList:!0,subtree:!0});const n=document.querySelector("form");n&&n.addEventListener("submit",s=>{const r=PB(n);(r.phone||r.email)&&sessionStorage.setItem("pico_signup_data",JSON.stringify(r))},!0)},RB=()=>{},LB=()=>{const e=document.getElementById("contact");e&&e.addEventListener("click",()=>{setTimeout(()=>{const t=document.getElementById("headlessui-portal-root");if(!t)return;const n=t.querySelector("form");if(!n)return;const s=()=>{const r={};n.querySelectorAll("input, select, textarea").forEach(a=>{const c=a.name||a.id||"unnamed";a.type==="checkbox"?r[c]=a.checked:a.type==="radio"?a.checked?r[c]=a.value:r[c]||(r[c]=null):r[c]=a.value});const o=r.name||"",i=r.phone||"";if(o&&i){const a=ss("Product")||{};Fe.generateLead({name:o,phone:i,demand:"Tư vấn sản phẩm "+(a.name||""),url:window.location.href})}};n.addEventListener("submit",s)},2e3)})},DB=e=>{const t=dB(e);switch(pB(e),t){case"category":hB();break;case"product":yB(),setTimeout(()=>{bB(),LB()},1500);break;case"cart":wB(),kB(),setTimeout(()=>{SB(),CB(),TB()},1500);break;case"purchase":AB();break;case"login":setTimeout(MB,500),kv();break;case"register":setTimeout(OB,500);break;default:kv();break}};yi(e=>{aB()&&DB(e)},!0),vB(),setTimeout(RB,1500);const jB=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),NB=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},FB=()=>{var n,s;return(ae.state.handle||((s=(n=window==null?void 0:window.EAI)==null?void 0:n._config)==null?void 0:s.handle))==="laptop88vn"},zB={cart:/^\/cart$/,contact:/^\/lien-he$/},Ol={addToCartButton:[".buy-now.btn-add"],removeFromCartButton:[".delete-from-cart"],promotionBanner:["#wrapPopup #popupContact a",".banner-sale a",".owl-stage .owl-item a",".banner-sale-detail a"],productCard:[".product-item",".product-item.js-pro-item"]},qB=()=>!!document.querySelector(".product-detail"),BB=()=>!!document.querySelector(".product-category"),UB=()=>!!document.querySelector(".send-cart");let yn=[],Sv=[];const VB=()=>{yn.forEach(({element:e,event:t,handler:n,options:s})=>{e.removeEventListener(t,n,s)}),yn=[],Sv.forEach(e=>{e.disconnect()}),Sv=[]},_o=e=>e?e.replace(/\D/g,""):"",HB=e=>{for(const[t,n]of Object.entries(zB))if(n.test(e))return t;return"unknown"},WB=()=>{const e=document.querySelector(".search-form"),t=document.getElementById("js-search");if(!e||!t)return;const n=()=>{var r;const s=(r=t.value)==null?void 0:r.trim();s&&Fe.search({search_term:s})};e.addEventListener("submit",n),yn.push({element:e,event:"submit",handler:n})},GB=()=>{var n;const e=Cs();if(e&&e.title)return{name:e.title,brand:null,image:e.image||"",url:window.location.href};const t=document.querySelector("h1");return{name:((n=t==null?void 0:t.textContent)==null?void 0:n.trim())||"",brand:null,image:hs()||"",url:window.location.href}},KB=()=>{setTimeout(()=>{const e=GB();e.name&&Fe.categoryView(e)},1500)},QB=e=>{var p,v;const t=e.getAttribute("data-id")||"",n=e.querySelector(".product-title a"),s=((p=n==null?void 0:n.textContent)==null?void 0:p.trim())||"",r=e.querySelector(".product-img a")||e.querySelector(".product-title a"),o=(r==null?void 0:r.href)||"",i=e.querySelector(".product-img img"),a=(i==null?void 0:i.src)||"",c=e.querySelector(`.item-price, .js-price-configurable-${t}`),u=c?_o(c.textContent):"",d=e.querySelector(".old-price"),f=d?_o(d.textContent):"",h=e.querySelector(".price-saleoff"),g=((v=h==null?void 0:h.textContent)==null?void 0:v.trim())||"";return{id:t,name:s,url:o,price:u,originalPrice:f,discount:g,image:a}},$v=()=>{document.querySelectorAll(Ol.productCard.join(", ")).forEach(t=>{t.querySelectorAll(".product-img a, .product-title a").forEach(s=>{const r=()=>{const o=QB(t);o.name&&Fe.productSelect(o)};s.addEventListener("click",r),yn.push({element:s,event:"click",handler:r})})})},Cv=()=>{var i;let e={id:"",sku:"",name:"",url:window.location.href,price:"",originalPrice:"",discount:"",image:"",quantity:1,brand:null};const t=Cs();t&&(e.name=t.title||"",e.image=t.image||hs()||"");const n=document.querySelector(".buy-now.btn-add");n&&(e.id=n.getAttribute("data-id")||""),e.sku=new URLSearchParams(window.location.search).get("sku")||"";const s=document.querySelector(".product-detail .main-product-mid .price");s&&(e.price=s.getAttribute("data-price")||_o(s.textContent));const r=document.querySelector(".product-detail .main-product-mid .old-price");r&&(e.originalPrice=_o(r.textContent));const o=document.querySelector(".product-detail .main-product-mid .saleof-price");return o&&(e.discount=((i=o.textContent)==null?void 0:i.trim())||""),e.image||(e.image=hs()||""),e},JB=()=>{setTimeout(()=>{const e=Cv();e.name&&Fe.productView(e)},1500)},XB=()=>{document.querySelectorAll(Ol.addToCartButton.join(", ")).forEach(t=>{const n=()=>{const s=Cv();s.name&&Fe.addToCart(s)};t.addEventListener("click",n),yn.push({element:t,event:"click",handler:n})})},vd=()=>{const e=document.querySelectorAll(".js-item-row");return Array.from(e).map(t=>{var c,u,d;const n=((c=t.querySelector(".cart-image img"))==null?void 0:c.src)||"",s=((d=(u=t.querySelector(".name-product a"))==null?void 0:u.textContent)==null?void 0:d.trim().replace(/\s+/g," "))||"",r=t.querySelector(".buy-price"),o=(r==null?void 0:r.value)||"",i=t.querySelector(".buy-quantity"),a=parseInt((i==null?void 0:i.value)||"1",10);return{image:n,name:s,price:o,quantity:a}})},Tv=()=>vd().reduce((n,s)=>n+s.quantity,0).toString(),Ev=()=>{var t,n;const e=((n=(t=document.querySelector(".total-cart-price"))==null?void 0:t.textContent)==null?void 0:n.trim())||"";return _o(e)},ZB=()=>{setTimeout(()=>{const e=Tv(),t=Ev(),n=vd();Fe.cartView({cart_size:e,cart_total_price:t,products:n})},1500)},YB=()=>{document.querySelectorAll(Ol.removeFromCartButton.join(", ")).forEach(t=>{const n=()=>{var r;const s=t.closest(".js-item-row");if(s){const o=s.querySelector(".name-product a"),i=((r=o==null?void 0:o.textContent)==null?void 0:r.trim().replace(/\s+/g," "))||"",a=(o==null?void 0:o.href)||"",c=s.querySelector(".cart-image img"),u=(c==null?void 0:c.src)||"",d=s.querySelector(".buy-price"),f=(d==null?void 0:d.value)||"",h=s.querySelector(".buy-quantity"),g=parseInt((h==null?void 0:h.value)||"1",10);Fe.removeFromCart({name:i,url:a,image:u,price:f,quantity:g})}};t.addEventListener("click",n),yn.push({element:t,event:"click",handler:n})})},Av=()=>{var c,u;const e={},t=document.getElementById("buyer_name");t!=null&&t.value&&(e.name=t.value.trim());const n=document.getElementById("buyer_tel");n!=null&&n.value&&(e.phone=n.value.trim());const s=document.getElementById("buyer_email");s!=null&&s.value&&(e.email=s.value.trim());const r=document.getElementById("buyer_address");r!=null&&r.value&&(e.address=r.value.trim());const o=document.querySelector('input[name="ship_method"]:checked');if(o){const d=o.nextElementSibling;d&&(e.delivery_method=((c=d.textContent)==null?void 0:c.trim())||"")}const i=document.querySelector('input[name="location"]:checked');i!=null&&i.value&&(e.store_location=i.value.trim());const a=document.querySelector('input[name="pay_method"]:checked');if(a){const d=document.querySelector(`label[for="${a.id}"]`);d&&(e.payment_gateway=((u=d.textContent)==null?void 0:u.trim())||"Thanh toán khi nhận hàng (COD)")}else e.payment_gateway="Thanh toán khi nhận hàng (COD)";return e},eU=()=>{const e=document.getElementById("formCart");if(!e)return;const t=()=>{const a=Av();Object.keys(a).length>0&&Fe.addShippingInfo(a)},n=NB(t,1e3);["#buyer_name","#buyer_tel","#buyer_email","#buyer_address"].forEach(a=>{const c=e.querySelector(a);c&&(c.addEventListener("input",n,!0),yn.push({element:c,event:"input",handler:n,options:!0}))}),e.querySelectorAll('input[name="ship_method"]').forEach(a=>{a.addEventListener("change",t,!0),yn.push({element:a,event:"change",handler:t,options:!0})}),e.querySelectorAll('input[name="location"]').forEach(a=>{a.addEventListener("change",t,!0),yn.push({element:a,event:"change",handler:t,options:!0})}),e.querySelectorAll('input[name="pay_method"]').forEach(a=>{a.addEventListener("change",t,!0),yn.push({element:a,event:"change",handler:t,options:!0})})},tU=()=>{const e=document.getElementById("btn-submit");if(!e)return;const t=()=>{const n=Tv(),s=Ev(),r=vd(),o=Av();Fe.checkout({cart_size:n,cart_total_price:s,products:r,...o});const i={customer:{name:o.name||"",phone:o.phone||"",email:o.email||"",shipping_address:o.address||"",delivery_method:o.delivery_method||"",store_location:o.store_location||"",payment_gateway:o.payment_gateway||"Thanh toán khi nhận hàng (COD)"},products:r};sessionStorage.setItem("laptop88_checkout",JSON.stringify(i))};e.addEventListener("click",t),yn.push({element:e,event:"click",handler:t})},nU=()=>{const e={},t=document.querySelectorAll(".block-box-info .item-info");t.forEach(s=>{const r=s.textContent;if(r.includes("Mã đơn hàng:")){const o=r.match(/#(\d+)/);o&&(e.order_id=o[1],e.order_number=o[1])}});const n=sessionStorage.getItem("laptop88_checkout");if(n)try{const s=JSON.parse(n);e.customer=s.customer||{},e.products=s.products||[]}catch(s){console.error("Failed to parse checkout data:",s),e.customer={},e.products=[]}else{e.customer={},e.products=[],t.forEach(r=>{var i,a,c,u,d;const o=r.textContent;if(o.includes("Người nhận:")){const h=(i=o.split(":")[1])==null?void 0:i.trim();h&&(e.customer.name=h)}else if(o.includes("Số điện thoại:")){const h=(a=o.split(":")[1])==null?void 0:a.trim();h&&(e.customer.phone=h)}else if(o.includes("Email:")){const h=(c=o.split(":")[1])==null?void 0:c.trim();h&&(e.customer.email=h)}else if(o.includes("Địa chỉ:")){const h=(u=o.split(":")[1])==null?void 0:u.trim();h&&(e.customer.shipping_address=h)}else if(o.includes("Phương thức thanh toán:")){const h=(d=o.split(":")[1])==null?void 0:d.trim();h&&(e.customer.payment_gateway=h)}});const s=document.querySelectorAll(".product-list .product-item.js-item-row");e.products=Array.from(s).map(r=>{var f,h,g,p,v,_;const o=((f=r.querySelector(".product-img img"))==null?void 0:f.src)||"",i=((g=(h=r.querySelector(".product-info p:first-child"))==null?void 0:h.textContent)==null?void 0:g.trim())||"",a=((p=r.querySelector(".product-info p:nth-child(2)"))==null?void 0:p.textContent)||"",c=parseInt(((v=a.match(/\d+/))==null?void 0:v[0])||"1",10),u=((_=r.querySelector(".product-info p:last-child"))==null?void 0:_.textContent)||"",d=_o(u);return{image:o,name:i,quantity:c,price:d}})}if(e.products&&e.products.length>0){const s=e.products.reduce((r,o)=>{const i=parseFloat(o.price)||0,a=o.quantity||1;return r+i*a},0);e.total_value=s.toString()}return e};let yd=!1;const sU=()=>{yd||setTimeout(()=>{const e=nU();e.order_id&&e.total_value&&(Fe.purchase(e),yd=!0,setTimeout(()=>yd=!1,6e4),sessionStorage.removeItem("laptop88_checkout"))},1500)},rU=()=>{const e=document.getElementById("now_submit"),t=document.getElementById("email_newsletter");if(!e||!t)return;const n=()=>{var o;const r=(o=t.value)==null?void 0:o.trim();r&&r.includes("@")&&Fe.generateLead({email:r,demand:"Khách hàng nhận thông tin khuyến mãi",url:window.location.href})};e.addEventListener("click",n),yn.push({element:e,event:"click",handler:n});const s=document.querySelector(".newleter-form");if(s){const r=o=>{o.preventDefault(),n()};s.addEventListener("submit",r),yn.push({element:s,event:"submit",handler:r})}},oU=()=>{const e=document.querySelector('input[type="submit"].btn_cyan');if(!e)return;const t=()=>{var d,f,h,g;const n=document.getElementById("contact_name"),s=document.getElementById("contact_email"),r=document.getElementById("contact_tel"),o=document.getElementById("contact_message"),i=((d=n==null?void 0:n.value)==null?void 0:d.trim())||"",a=((f=s==null?void 0:s.value)==null?void 0:f.trim())||"",c=((h=r==null?void 0:r.value)==null?void 0:h.trim())||"",u=((g=o==null?void 0:o.value)==null?void 0:g.trim())||"";i&&a&&u&&Fe.generateLead({name:i,phone:c,email:a,demand:"Liên hệ",note:u,url:window.location.href})};e.addEventListener("click",t),yn.push({element:e,event:"click",handler:t})},iU=e=>{const t=e.href||e.getAttribute("href")||"null",n=e.querySelector("img"),s=(n==null?void 0:n.alt)||e.getAttribute("title")||"null",r=(n==null?void 0:n.src)||"";let o="banner";return e.closest("#wrapPopup #popupContact")?o="popup-contact":e.closest(".banner-sale")?o="banner-sale":e.closest(".owl-stage .owl-item")?o="owl-carousel":e.closest(".banner-sale-detail")&&(o="banner-sale-detail"),{link:t,name:s,image:r,source:o}},aU=e=>{Fe.selectPromotion(iU(e))},lU=()=>{const e=document.querySelectorAll(Ol.promotionBanner.join(", "));e.length!==0&&e.forEach(t=>{const n=()=>{aU(t)};t.addEventListener("click",n),yn.push({element:t,event:"click",handler:n})})};yi(e=>{if(!FB())return;VB();const t=new URL(e,window.location.origin).pathname,n=HB(t);UB()?sU():n==="contact"?setTimeout(()=>{oU()},1500):n==="cart"?(ZB(),YB(),setTimeout(()=>{eU(),tU()},1500)):qB()?(JB(),setTimeout(XB,1500)):BB()?(KB(),setTimeout(()=>{$v()},1500)):setTimeout(()=>{$v()},1500),setTimeout(()=>{WB(),lU(),rU()},2e3)},!0);const cU=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),uU=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},dU=()=>{var t,n;return(ae.state.handle||((n=(t=window==null?void 0:window.EAI)==null?void 0:t._config)==null?void 0:n.handle))==="noithatgiaphongvn"},Ri=e=>e?e.replace(/\s+/g,"").replace(/₫|đ/g,"").replace(/&nbsp;/g,""):"",Rl=e=>{try{const t=document.querySelectorAll('script[type="application/ld+json"]');for(let n=0;n<t.length;n++){const s=JSON.parse(t[n].textContent);if(s!=null&&s["@graph"]&&Array.isArray(s["@graph"])){const r=s["@graph"].find(o=>o["@type"]===e);if(r)return r}else if((s==null?void 0:s["@type"])===e)return s}}catch{}return null},$n={searchForm:"form.searchform",searchInput:'input[name="s"]',addToCartButton:'button[name="ux-buy-now"]',removeFromCartButton:".product-remove a.remove",productCard:".product-small.box",productCardLink:".woocommerce-LoopProduct-link",productCardImage:".box-image img:first-child",productCardPrice:".price ins .woocommerce-Price-amount bdi, .price > .woocommerce-Price-amount bdi",productCardId:"a[data-prod_id]",checkoutButton:"#place_order",contactForm:'form[aria-label="Form liên hệ"]',cartItem:".woocommerce-cart-form__cart-item"},bd={cart:/\/gio-hang$/,checkout:/\/thanh-toan$/,purchase:/\/thanh-toan\/order-received\//},_d="noithatgiaphong_checkout",fU=()=>!!Rl("Product"),hU=()=>!!Rl("CollectionPage"),Iv=()=>bd.purchase.test(window.location.pathname),pU=()=>bd.cart.test(window.location.pathname),mU=()=>bd.checkout.test(window.location.pathname)&&!Iv();let xd=[];const gU=()=>{xd.forEach(({element:e,event:t,handler:n,options:s})=>{e.removeEventListener(t,n,s)}),xd=[]},Is=(e,t,n,s)=>{e.addEventListener(t,n,s),xd.push({element:e,event:t,handler:n,options:s})},vU=()=>{document.querySelectorAll($n.searchForm).forEach(t=>{const n=t.querySelector($n.searchInput);if(!n)return;Is(t,"submit",()=>{var o;const r=(o=n.value)==null?void 0:o.trim();r&&Fe.search({search_term:r})})})},yU=()=>{var s;const e=Rl("CollectionPage");if(e!=null&&e.name)return{name:e.name,url:e.url||window.location.href,image:hs()||""};const t=Cs();if(t!=null&&t.title)return{name:t.title,url:window.location.href,image:t.image||hs()||""};const n=document.querySelector("h1");return{name:((s=n==null?void 0:n.textContent)==null?void 0:s.trim())||"",url:window.location.href,image:hs()||""}},bU=()=>{setTimeout(()=>{const e=yU();e.name&&Fe.categoryView(e)},1500)},_U=e=>{var d;const t=e.querySelector($n.productCardLink),n=((d=t==null?void 0:t.textContent)==null?void 0:d.trim())||"",s=(t==null?void 0:t.href)||"",r=e.querySelector($n.productCardImage),o=(r==null?void 0:r.src)||"",i=e.querySelector($n.productCardPrice),a=i?Ri(i.textContent):"",c=e.querySelector($n.productCardId);return{id:(c==null?void 0:c.getAttribute("data-prod_id"))||"",name:n,url:s,price:a,image:o}},Pv=()=>{document.querySelectorAll($n.productCard).forEach(t=>{t.querySelectorAll(".box-image a, "+$n.productCardLink).forEach(s=>{Is(s,"click",()=>{const o=_U(t);o.name&&Fe.productSelect(o)})})})},Mv=()=>{var n;let e={id:"",sku:"",name:"",url:window.location.href,price:"",image:"",quantity:1,brand:null,category:""};const t=Rl("Product");if(t){if(e.name=t.name||"",e.id=t.productID||"",e.sku=t.sku||"",e.category=t.category||"",t.offers&&(e.price=t.offers.price||""),Array.isArray(t.image)&&t.image.length>0){const s=t.image[0];e.image=typeof s=="string"?s:(s==null?void 0:s.url)||""}else typeof t.image=="string"&&(e.image=t.image);(n=t.brand)!=null&&n.name&&(e.brand=t.brand.name)}if(!e.name||!e.image){const s=Cs();s&&(e.name||(e.name=s.title||""),e.image||(e.image=s.image||hs()||""))}return e.image||(e.image=hs()||""),e},xU=()=>{setTimeout(()=>{const e=Mv();e.name&&Fe.productView(e)},1500)},wU=()=>{document.querySelectorAll($n.addToCartButton).forEach(t=>{Is(t,"click",()=>{const s=Mv(),r=document.querySelector("input.qty");r&&(s.quantity=parseInt(r.value||"1",10)),s.name&&Fe.addToCart(s)})})},Ov=()=>{const e=document.querySelectorAll($n.cartItem);return Array.from(e).map(t=>{var g;const n=t.querySelector(".product-name a"),s=((g=n==null?void 0:n.textContent)==null?void 0:g.trim())||"",r=(n==null?void 0:n.href)||"",o=t.querySelector(".product-thumbnail img"),i=(o==null?void 0:o.src)||"",a=t.querySelector(".product-price .woocommerce-Price-amount bdi"),c=a?Ri(a.textContent):"",u=t.querySelector("input.qty"),d=parseInt((u==null?void 0:u.value)||"1",10),f=t.querySelector(".product-remove a.remove");return{id:(f==null?void 0:f.getAttribute("data-product_id"))||"",name:s,url:r,image:i,price:c,quantity:d}})},kU=()=>{const e=document.querySelector(".cart-collaterals .woocommerce-Price-amount bdi");return e?Ri(e.textContent):""},SU=()=>{setTimeout(()=>{const e=Ov(),t=e.reduce((s,r)=>s+r.quantity,0).toString(),n=kU();Fe.cartView({cart_size:t,cart_total_price:n,products:e})},1500)},$U=()=>{document.querySelectorAll($n.removeFromCartButton).forEach(t=>{Is(t,"click",()=>{var p;const s=t.closest($n.cartItem);if(!s)return;const r=s.querySelector(".product-name a"),o=((p=r==null?void 0:r.textContent)==null?void 0:p.trim())||"",i=(r==null?void 0:r.href)||"",a=s.querySelector(".product-thumbnail img"),c=(a==null?void 0:a.src)||"",u=s.querySelector(".product-price .woocommerce-Price-amount bdi"),d=u?Ri(u.textContent):"",f=s.querySelector("input.qty"),h=parseInt((f==null?void 0:f.value)||"1",10),g=t.getAttribute("data-product_id")||"";Fe.removeFromCart({id:g,name:o,url:i,image:c,price:d,quantity:h})})})},wd=()=>{var u,d,f;const e={},t=document.getElementById("billing_last_name");t!=null&&t.value&&(e.name=t.value.trim());const n=document.getElementById("billing_phone");n!=null&&n.value&&(e.phone=n.value.trim());const s=document.getElementById("billing_email");s!=null&&s.value&&(e.email=s.value.trim());const r=document.getElementById("billing_address_1");r!=null&&r.value&&(e.address=r.value.trim());const o=document.getElementById("select2-billing_state-container");if(o){const h=(u=o.textContent)==null?void 0:u.trim();h&&h!=="Chọn tỉnh / thành phố"&&(e.state=h)}const i=document.getElementById("select2-billing_city-container");if(i){const h=(d=i.textContent)==null?void 0:d.trim();h&&h!=="Chọn quận / huyện"&&(e.city=h)}const a=document.getElementById("order_comments");a!=null&&a.value&&(e.note=a.value.trim());const c=document.querySelector('input[name="payment_method"]:checked');if(c){const h=document.querySelector(`label[for="${c.id}"]`);e.payment_gateway=((f=h==null?void 0:h.textContent)==null?void 0:f.trim())||c.value||""}return e},CU=()=>{const e=document.querySelector("form.woocommerce-checkout");if(!e)return;const t=()=>{const i=wd();Object.keys(i).length>0&&Fe.addShippingInfo(i)},n=uU(t,1e3);["#billing_last_name","#billing_phone","#billing_email","#billing_address_1"].forEach(i=>{const a=e.querySelector(i);a&&Is(a,"input",n,!0)}),["billing_state","billing_city"].forEach(i=>{const a=document.getElementById(i);a&&Is(a,"change",t,!0)}),e.querySelectorAll('input[name="payment_method"]').forEach(i=>{Is(i,"change",()=>{const c=wd();c.payment_gateway&&Fe.addPaymentInfo({payment_gateway:c.payment_gateway})},!0)})},TU=()=>{const e=document.querySelector($n.checkoutButton);if(!e)return;Is(e,"click",()=>{const n=Ov(),s=wd(),r=n.reduce((i,a)=>{const c=parseFloat(a.price.replace(/\./g,""))||0;return i+c*a.quantity},0).toString();Fe.checkout({cart_size:n.reduce((i,a)=>i+a.quantity,0).toString(),cart_total_price:r,products:n,...s});const o={customer:{name:s.name||"",phone:s.phone||"",email:s.email||"",shipping_address:[s.address,s.city,s.state].filter(Boolean).join(", "),payment_gateway:s.payment_gateway||""},products:n};sessionStorage.setItem(_d,JSON.stringify(o))})};let kd=!1;const EU=()=>{const e={customer:{},products:[]},t=window.location.pathname.match(/\/order-received\/(\d+)/);t&&(e.order_id=t[1],e.order_number=t[1]),document.querySelectorAll(".woocommerce-customer-details address p").forEach(i=>{var c;const a=((c=i.textContent)==null?void 0:c.trim())||"";a&&!e.customer.name&&(e.customer.name=a)});const s=document.querySelectorAll(".woocommerce-table__line-item.order_item"),r=Array.from(s).map(i=>{var v,_;const a=i.querySelector(".product-name a");let c=((v=a==null?void 0:a.textContent)==null?void 0:v.trim())||"";if(!c){const k=i.querySelector(".product-name");if(k){const w=k.cloneNode(!0),$=w.querySelector(".product-quantity");$&&$.remove(),c=((_=w.textContent)==null?void 0:_.trim())||""}}const u=(a==null?void 0:a.href)||"",d=i.querySelector(".product-quantity"),f=(d==null?void 0:d.textContent)||"",h=parseInt(f.replace(/[^\d]/g,"")||"1",10),g=i.querySelector(".product-total .woocommerce-Price-amount bdi"),p=g?Ri(g.textContent):"";return{name:c,url:u,price:p,quantity:h,image:""}});r.length>0&&(e.products=r);const o=sessionStorage.getItem(_d);if(o)try{const i=JSON.parse(o);i.customer&&Object.keys(i.customer).length>0&&(e.customer={...i.customer,...e.customer})}catch{}if(e.products&&e.products.length>0){const i=e.products.reduce((a,c)=>{const u=parseFloat(c.price.replace(/\./g,""))||0;return a+u*c.quantity},0);e.total_value=i.toString()}return e},AU=()=>{kd||setTimeout(()=>{const e=EU();e.order_id&&(Fe.purchase(e),kd=!0,setTimeout(()=>kd=!1,6e4),sessionStorage.removeItem(_d))},1500)},IU=()=>{document.querySelectorAll($n.contactForm).forEach(t=>{Is(t,"submit",()=>{var a,c,u,d,f,h,g,p;const s=((c=(a=t.querySelector('input[name="your-tel"]'))==null?void 0:a.value)==null?void 0:c.trim())||"",r=((d=(u=t.querySelector('input[name="your-name"]'))==null?void 0:u.value)==null?void 0:d.trim())||"",o=((h=(f=t.querySelector('input[name="your-email"]'))==null?void 0:f.value)==null?void 0:h.trim())||"",i=((p=(g=t.querySelector('textarea[name="your-message"]'))==null?void 0:g.value)==null?void 0:p.trim())||"";!s&&!o||Fe.generateLead({demand:"Liên hệ tư vấn",name:r,phone:s,email:o,note:i,page_url:window.location.href,page_title:document.title})})})};yi(e=>{dU()&&(gU(),Iv()?AU():pU()?(SU(),setTimeout(()=>{$U()},1500)):mU()?setTimeout(()=>{CU(),TU()},1500):setTimeout(()=>{fU()?(xU(),wU()):(hU()&&bU(),Pv())},1500),setTimeout(()=>{vU(),IU()},2e3))},!0);const PU=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),MU=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},OU=()=>{var n,s;return(ae.state.handle||((s=(n=window==null?void 0:window.EAI)==null?void 0:n._config)==null?void 0:s.handle))===wr},Rv={search:/^\/ket-qua-tim-kiem\.html$/,cart:/^\/gio-hang\.html$/,purchase:/^\/dat-hang-thanh-cong\.html$/,product:/^\/([a-z0-9-]+)\/([a-z0-9-]+)-pid(\d+)\.html$/},Ll={addToCartButton:["#dathang1",".btn-add-to-cart"],removeFromCartButton:[".delete-product"],productCard:[".product-info-container.product-item"],loadMoreButton:["#div_Danh_Sach_San_Pham_loadMore_btn",".loadMore_btn"]};let Wn=[],Dl=[],Sd=!1;const RU=()=>{Wn.forEach(({element:e,event:t,handler:n,options:s})=>{e.removeEventListener(t,n,s)}),Wn=[],Dl.forEach(e=>{e.disconnect()}),Dl=[],Sd=!1},Ps=e=>e?e.replace(/\D/g,""):"",LU=e=>{for(const[t,n]of Object.entries(Rv))if(n.test(e))return t;return"unknown"},DU=e=>{const t=new URL(e,window.location.origin);if(!Rv.search.test(t.pathname))return;const n=t.searchParams.get("keyword");n&&Fe.search({search_term:n})},jU=()=>{const e=$d();return!!(e&&!e.mpn)},$d=()=>{var t;const e=document.querySelectorAll('script[type="application/ld+json"]');for(const n of e)try{const r=n.textContent.replace(/[\x00-\x1F]+/g," "),o=JSON.parse(r);if((t=o["@context"])!=null&&t.includes("schema.org")&&o["@type"]==="Product")return o}catch{continue}return null},NU=()=>{setTimeout(()=>{const e=$d();e&&!e.mpn&&Fe.categoryView({name:e.name||"",url:window.location.href,image:e.image||""})},1500)},FU=e=>{var g;const t=e.querySelector("a[data-id]"),n=(t==null?void 0:t.getAttribute("data-id"))||e.getAttribute("data-id")||"",s=(t==null?void 0:t.getAttribute("data-name"))||"",r=(t==null?void 0:t.href)||"",o=e.querySelector(".product-image img.product__img"),i=(o==null?void 0:o.src)||"",a=e.querySelector(".block-box-price .price"),c=a?Ps(a.textContent):"",u=e.querySelector(".block-box-price .price-old"),d=u?Ps(u.textContent):"",f=e.querySelector(".percent-discount-text2"),h=((g=f==null?void 0:f.textContent)==null?void 0:g.trim())||"";return{id:n,sku:n,name:s,url:r,price:c,originalPrice:d,discount:h,image:i}},Cd=()=>{document.querySelectorAll(Ll.productCard.join(", ")).forEach(t=>{t.querySelectorAll("a[data-id]").forEach(s=>{const r=()=>{const o=FU(t);o.name&&Fe.productSelect(o)};s.addEventListener("click",r),Wn.push({element:s,event:"click",handler:r})})})},Lv=()=>{document.querySelectorAll(Ll.loadMoreButton.join(", ")).forEach(t=>{const n=()=>{setTimeout(()=>{Cd()},2500)};t.addEventListener("click",n),Wn.push({element:t,event:"click",handler:n})})},Dv=()=>{var r,o;let e={id:"",sku:"",name:"",url:window.location.href,price:"",originalPrice:"",discount:null,image:"",brand:""};const t=$d();t&&t.mpn&&(e.id=t.mpn||"",e.sku=t.mpn||"",e.name=t.name||"",e.image=t.image||"",e.brand=typeof t.brand=="object"?((r=t.brand)==null?void 0:r.name)||"":t.brand||"");const n=document.querySelector(".wrap-price .new-price");n?e.price=Ps(n.textContent):(o=t==null?void 0:t.offers)!=null&&o.Price&&(e.price=t.offers.Price.toString());const s=document.querySelector(".wrap-price .old-price");return s&&(e.originalPrice=Ps(s.textContent)),e},zU=()=>{setTimeout(()=>{const e=Dv();e.name&&Fe.productView(e)},1500)},qU=()=>{document.querySelectorAll(Ll.addToCartButton.join(", ")).forEach(t=>{const n=()=>{const s=Dv();s.name&&Fe.addToCart(s)};t.addEventListener("click",n),Wn.push({element:t,event:"click",handler:n})})},Td=()=>{const e=document.querySelectorAll(".item-product");return Array.from(e).map(t=>{var w,$;const n=t.querySelector('input[name$=".ProductName"]'),s=(n==null?void 0:n.value)||"",r=t.querySelector('input[name$=".ProductPrice"]'),o=(r==null?void 0:r.value)||"",i=t.querySelector('input[name$=".LinkImage"]'),a=(i==null?void 0:i.value)||"",c=t.querySelector(".number"),u=parseInt(((w=c==null?void 0:c.textContent)==null?void 0:w.trim())||"1",10),d=t.querySelector(".cart-image a")||t.querySelector(".title a"),f=(d==null?void 0:d.href)||"",h=t.querySelector(".price[data-cartid]"),g=h?Ps(h.textContent):o,p=t.querySelector(".price-old"),v=p&&!p.classList.contains("hidden")?Ps(p.textContent):"",_=t.querySelector(".color-rule-id"),k=_?[($=_.textContent)==null?void 0:$.trim()]:[];return{name:s,price:g,originalPrice:v,quantity:u,image:a,url:f,attributes:k}})},jv=()=>document.querySelectorAll(".item-product").length.toString(),Ed=()=>{const e=document.getElementById("totalpayment");if(e){const t=e.getAttribute("data-totalpayment");return t||Ps(e.textContent)}return""},BU=()=>{setTimeout(()=>{const e=jv(),t=Ed(),n=Td();Fe.cartView({cart_size:e,cart_total_price:t,products:n})},1500)},UU=()=>{document.querySelectorAll(Ll.removeFromCartButton.join(", ")).forEach(t=>{const n=()=>{var r;const s=t.closest(".item-product");if(s){const o=s.querySelector('input[name$=".ProductName"]'),i=(o==null?void 0:o.value)||"",a=s.querySelector('input[name$=".LinkImage"]'),c=(a==null?void 0:a.value)||"",u=s.querySelector('input[name$=".ProductPrice"]'),d=(u==null?void 0:u.value)||"",f=s.querySelector(".cart-image a")||s.querySelector(".title a"),h=(f==null?void 0:f.href)||"",g=s.querySelector(".number"),p=parseInt(((r=g==null?void 0:g.textContent)==null?void 0:r.trim())||"1",10);Fe.removeFromCart({name:i,url:h,image:c,price:d,quantity:p})}};t.addEventListener("click",n),Wn.push({element:t,event:"click",handler:n})})},Nv=()=>{var u,d,f,h;const e={},t=g=>{const p=document.querySelectorAll(g);for(const v of p)if(v.value&&v.value.trim()!=="")return v.value.trim();return""},n=document.querySelector('input[name="chkgender"]:checked');n&&(e.gender=n.value==="1"?"Anh":"Chị");const s=t("#popup_payment_inp_hoten, input[name='fullname']");s&&(e.name=s);const r=t("#popup_payment_inp_sdt, input[name='phone']");r&&(e.phone=r);const o=t("#popup_payment_inp_email, input[name='txtMailReceiver']");o&&(e.email=o);const i=document.querySelector(".nav-delivery .btn-default-PaymentType.active");if(i){const g=i.querySelector(".text");e.delivery_method=((u=g==null?void 0:g.textContent)==null?void 0:u.trim())||""}if(e.delivery_method==="Nhận hàng tại cửa hàng"){e.city="",e.ward="",e.address="";const g=document.querySelector("#store-address .item.market .check");if(g){const p=Array.from(g.childNodes).filter(v=>v.nodeType===Node.TEXT_NODE).map(v=>v.textContent.trim()).filter(Boolean).join(" ");e.full_address=p||""}}else{const g=document.querySelector("#ad-market .city-selected");if(g){const k=(d=g.textContent)==null?void 0:d.trim();k&&k!=="Chọn tỉnh, thành"&&(e.city=k)}const p=document.querySelector("#ad-market .ward-selected");if(p){const k=(f=p.textContent)==null?void 0:f.trim();k&&k!=="Chọn phường, xã"&&(e.ward=k)}const v=t("#popup_payment_inp_diachi, input[name='Address'], input[name='address']");v&&(e.address=v);const _=[e.address,e.ward,e.city].filter(Boolean);_.length>0&&(e.full_address=_.join(", "))}const c=document.querySelector(".payment-type .tablinks.active .btn-default-PaymentType");if(c){const g=c.querySelector(".txt-menthod");e.payment_gateway=((h=g==null?void 0:g.textContent)==null?void 0:h.trim())||""}return e},VU=()=>{const e=document.getElementById("ShopCart");if(!e)return;const t=()=>{const d=Nv();if(Object.keys(d).length>0){Fe.addShippingInfo(d);let f={customer:{},products:Td(),cart_total_price:Ed()};try{const h=sessionStorage.getItem("viettelstore_checkout");h&&(f=JSON.parse(h))}catch{}f.customer={...f.customer,gender:d.gender||f.customer.gender||"",name:d.name||f.customer.name||"",phone:d.phone||f.customer.phone||"",email:d.email||f.customer.email||"",shipping_address:d.full_address||f.customer.shipping_address||"",delivery_method:d.delivery_method||f.customer.delivery_method||"",payment_gateway:d.payment_gateway||f.customer.payment_gateway||""},sessionStorage.setItem("viettelstore_checkout",JSON.stringify(f))}},n=MU(t,1e3);["#popup_payment_inp_hoten","input[name='fullname']","#popup_payment_inp_sdt","input[name='phone']","#popup_payment_inp_email","input[name='txtMailReceiver']","#popup_payment_inp_diachi","input[name='Address']","input[name='address']"].forEach(d=>{document.querySelectorAll(d).forEach(h=>{h.addEventListener("input",n,!0),Wn.push({element:h,event:"input",handler:n,options:!0})})}),e.querySelectorAll('input[name="chkgender"]').forEach(d=>{d.addEventListener("change",t,!0),Wn.push({element:d,event:"change",handler:t,options:!0})}),document.querySelectorAll(".nav-delivery .btn-default-PaymentType").forEach(d=>{const f=()=>setTimeout(t,500);d.addEventListener("click",f,!0),Wn.push({element:d,event:"click",handler:f,options:!0})}),document.querySelectorAll(".payment-type .tablinks").forEach(d=>{const f=()=>setTimeout(t,500);d.addEventListener("click",f,!0),Wn.push({element:d,event:"click",handler:f,options:!0})});const a=document.querySelector("#ad-market .city-selected");if(a){const d=new MutationObserver(n);d.observe(a,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:["data-value"]}),Dl.push(d)}const c=document.querySelector("#ad-market .ward-selected");if(c){const d=new MutationObserver(n);d.observe(c,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:["data-value"]}),Dl.push(d)}document.querySelectorAll("#store-address .item.market label, .list-store .item.market label").forEach(d=>{const f=()=>setTimeout(t,300);d.addEventListener("click",f,!0),Wn.push({element:d,event:"click",handler:f,options:!0})})},HU=()=>{const e=document.getElementById("buynow1");if(!e)return;const t=()=>{const n=document.getElementById("agreePolicy");if(!(n!=null&&n.checked))return;const s=jv(),r=Ed(),o=Td(),i=Nv();let a={customer:{},products:o,cart_total_price:r};try{const u=sessionStorage.getItem("viettelstore_checkout");u&&(a=JSON.parse(u))}catch{}const c={gender:i.gender||a.customer.gender||"",name:i.name||a.customer.name||"",phone:i.phone||a.customer.phone||"",email:i.email||a.customer.email||"",shipping_address:i.full_address||a.customer.shipping_address||"",delivery_method:i.delivery_method||a.customer.delivery_method||"",payment_gateway:i.payment_gateway||a.customer.payment_gateway||""};a.customer=c,a.products=o,a.cart_total_price=r,sessionStorage.setItem("viettelstore_checkout",JSON.stringify(a)),Sd||c.name&&c.phone&&(Fe.checkout({cart_size:s,cart_total_price:r,products:o,...c}),Sd=!0)};e.addEventListener("click",t),Wn.push({element:e,event:"click",handler:t})},WU=()=>{var o;const e={},n=new URLSearchParams(window.location.search).get("ordercode");if(n&&(e.order_id=n,e.order_number=n),!e.order_id){const i=document.querySelector(".hightlight.color-black span");i&&(e.order_id=((o=i.textContent)==null?void 0:o.trim())||"",e.order_number=e.order_id)}const s=sessionStorage.getItem("viettelstore_checkout");if(s)try{const i=JSON.parse(s);e.customer=i.customer||{},e.products=i.products||[]}catch(i){console.error("Failed to parse viettelstore checkout data:",i),e.customer={},e.products=[]}else{e.customer={},e.products=[];const i=document.querySelectorAll(".table.product tbody tr");e.products=Array.from(i).map(a=>{var w,$,E,P;const c=a.querySelector(".img img"),u=(c==null?void 0:c.src)||"",d=(($=(w=a.querySelector(".text-medium.color-black"))==null?void 0:w.textContent)==null?void 0:$.trim())||(c==null?void 0:c.alt)||"",h=(((E=a.querySelector(".text-medium.mau-gray[style]"))==null?void 0:E.textContent)||"").match(/Số lượng:\s*(\d+)/),g=h?parseInt(h[1],10):1,p=a.querySelector(".text-medium.mau-red"),v=p?Ps(p.textContent):"",_=a.querySelector("p.text-medium.mau-gray:not([style])"),k=_?[(P=_.textContent)==null?void 0:P.trim()]:[];return{name:d,image:u,price:v,quantity:g,attributes:k}})}const r=document.querySelector(".frame-total-price.price2");if(r)e.total_value=Ps(r.textContent);else if(e.products&&e.products.length>0){const i=e.products.reduce((a,c)=>{const u=parseFloat(c.price)||0,d=c.quantity||1;return a+u*d},0);e.total_value=i.toString()}return e};let Ad=!1;const GU=()=>{Ad||setTimeout(()=>{const e=WU();e.order_id&&(Fe.purchase(e),Ad=!0,setTimeout(()=>Ad=!1,6e4),sessionStorage.removeItem("viettelstore_checkout"))},1500)};yi(e=>{if(!OU())return;RU();const t=new URL(e,window.location.origin).pathname;switch(LU(t)){case"search":DU(e),setTimeout(()=>{Cd(),Lv()},1500);break;case"product":zU(),setTimeout(qU,1500);break;case"cart":BU(),UU(),setTimeout(()=>{VU(),HU()},1500);break;case"purchase":GU();break;default:jU()&&NU(),setTimeout(()=>{Cd(),Lv()},1500);break}},!0);const KU=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),QU=(e=>(nn("data-v-08506e2e"),e=e(),sn(),e))(()=>l("div",{class:"inline-flex items-center justify-center px-5 h-11 rounded-xl bg-gray-100"},[l("span",{class:"ecg-loader"})],-1)),JU={class:"text-xs text-gray-600 ml-2 animate-pulse mt-0.5"},XU={key:0,class:"typing-text"},ZU={key:1,class:"typing-text"},YU=Object.freeze(Object.defineProperty({__proto__:null,default:Ke({__name:"TypingIndicator",props:{variant:{type:String,default:"secondary"},agent:{type:Object,default:()=>null}},emits:["start"],setup(e,{emit:t}){const{t:n}=vs(),s=t;return Qe(()=>{s("start")}),(r,o)=>(m(),x("div",null,[QU,l("div",JU,[e.agent&&e.agent.name?(m(),x("span",XU,j(y(n)("chat.typingWithAgent",{name:e.agent.name})),1)):(m(),x("span",ZU,j(y(n)("chat.typing")),1))])]))}},[["__scopeId","data-v-08506e2e"]])},Symbol.toStringTag,{value:"Module"})),eV={},tV={class:"text-white",xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},nV=[l("path",{fill:"currentColor",d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z"},null,-1),l("path",{d:"M6 12h16"},null,-1)];function sV(e,t){return m(),x("svg",tV,nV)}const rV=Ke(eV,[["render",sV]]),oV={},iV={class:"text-gray-800",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},aV=[l("path",{d:"M3 6h18"},null,-1),l("path",{fill:"currentColor",d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"},null,-1),l("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"},null,-1)];function lV(e,t){return m(),x("svg",iV,aV)}const cV=Ke(oV,[["render",lV]]),uV={key:0,class:"text-center px-4"},dV={class:"mb-3 flex justify-center"},fV={class:"w-12 h-12 bg-red-50 rounded-full flex items-center justify-center"},hV={class:"text-base font-semibold text-gray-900 mb-2"},pV={class:"text-sm text-gray-600 mb-5"},mV={key:1},gV={class:"px-8 pb-4 mb-6 text-center text-gray-500 text-base"},vV={key:0,class:"flex items-center justify-center gap-2 animate-pulse"},yV=l("div",{class:"text-sm"},"Đang nghe ...",-1),bV={key:1,class:"text-gray-900"},_V={class:"flex items-center mx-auto gap-10 max-w-[320px]"},xV={class:"flex flex-col items-center justify-center gap-4"},wV=l("span",{class:"text-sm text-gray-900"},"Xóa",-1),kV={class:"flex flex-col items-center justify-center gap-4"},SV=l("span",{class:"text-sm text-gray-900"},"Gửi tin nhắn",-1),$V=l("span",{class:"text-sm text-gray-900"},"Chỉnh sửa",-1),CV=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatVoiceSetting",emits:["transcriptionComplete","editTranscription","cancelTranscription"],setup(e,{emit:t}){const n=t,{isOpen:s,showPermissionDenied:r,permissionMessage:o,hidePermissionDeniedMessage:i,stopSpeechRecognition:a,releaseMediaResources:c,startSpeechRecognition:u,isSpeechRecognitionSupported:d,setProcessing:f,recordedTranscript:h}=cd(),g=R(!1),p=Qr("chatViewRef",null),v=()=>{i(),g.value=!1,s.value=!1},_=()=>{a(),c(),g.value=!1,s.value=!1,n("cancelTranscription","")},k=async()=>{f(!0);try{a(),await new Promise($=>setTimeout($,100)),h.value&&h.value.trim()!==""&&n("transcriptionComplete",h.value)}catch{}finally{f(!1),c(),g.value=!1,s.value=!1}},w=()=>{a(),h.value&&h.value.trim()!==""&&(n("editTranscription",h.value),h.value=""),g.value=!1,s.value=!1,c()};return Pe(r,$=>{$&&(g.value=!0)}),Pe(s,async $=>{if($&&!g.value){if(!d()){g.value=!0;return}f(!0),g.value=!0,await u(),f(!1)}}),Pe(g,$=>{$||(c(),s.value=!1,i())}),($,E)=>(m(),oe(y(mo),{modal:!1,open:g.value,"onUpdate:open":E[1]||(E[1]=P=>g.value=P),"should-scale-background":!1},{default:Se(()=>[G(y(er),{to:y(p)},{default:Se(()=>[l("div",{onClick:E[0]||(E[0]=P=>g.value=!1),class:te(["drawer-overlay-custom",{"drawer-overlay-custom--open":g.value}])},null,2),G(y(nr),{class:"px-4 pb-10 pt-12 bg-white absolute bottom-0 rounded-t-2xl left-0 right-0 outline-none z-50 overflow-hidden"},{default:Se(()=>[y(o)&&y(o).type==="error"?(m(),x("div",uV,[l("div",dV,[l("div",fV,[G(y(R2),{class:"w-6 h-6 text-red-500"})])]),l("h3",hV,j(y(o).title),1),l("p",pV,j(y(o).message),1),l("button",{onClick:v,class:"w-full py-2.5 px-4 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors text-sm font-medium"}," Đã hiểu ")])):(m(),x("div",mV,[l("div",gV,[y(h)?(m(),x("div",bV,j(y(h)),1)):(m(),x("div",vV,[G(y(Nu),{size:"18"}),yV]))]),l("div",_V,[l("div",xV,[l("button",{onClick:_,class:"bg-gray-100 rounded-full size-[80px] flex items-center justify-center hover:bg-red-50 hover:text-red-600 transition-colors"},[G(cV)]),wV]),l("div",kV,[l("button",{onClick:k,class:"bg-blue-500 rounded-full size-[80px] flex items-center justify-center pulse-animation-3"},[G(rV)]),SV]),l("div",{class:te([y(h)?"opacity-100":"opacity-50 pointer-events-none","flex flex-col items-center justify-center gap-4"])},[l("button",{onClick:w,class:"bg-gray-100 rounded-full size-[80px] flex items-center justify-center hover:bg-orange-50 hover:text-orange-600 transition-colors"},[G(y(j2),{size:"26",class:"text-gray-900"})]),$V],2)])]))]),_:1})]),_:1},8,["to"])]),_:1},8,["open"]))}}},Symbol.toStringTag,{value:"Module"})),TV=["disabled"],EV=Object.freeze(Object.defineProperty({__proto__:null,default:Ke({__name:"ChatVoiceTrigger",props:{assistantProcessing:{type:Boolean,default:!1},voiceProcessing:{type:Boolean,default:!1}},setup(e){const{openChatVoice:t,checkMicrophonePermission:n,showPermissionDeniedMessage:s}=cd(),r=async()=>{(await n()).granted?t():s()};return(o,i)=>(m(),x("button",{onClick:i[0]||(i[0]=a=>r()),class:te(["button-mic-trigger",e.voiceProcessing&&"voice-processing pulse-animation-1"]),disabled:e.assistantProcessing||e.voiceProcessing},[e.voiceProcessing?(m(),oe(y(Nu),{key:0,size:"16"})):(m(),oe(y(Zm),{key:1,size:"18"}))],10,TV))}},[["__scopeId","data-v-d2852a2c"]])},Symbol.toStringTag,{value:"Module"})),AV={class:"px-4 pb-1 pt-2"},IV={class:"flex items-center w-full justify-around pb-3 pt-3.5 px-2 rounded-3xl shadow-sm border border-gray-100 bg-white"},PV={class:"text-xs font-medium"},MV={class:"text-xs font-medium"},OV={class:"text-xs font-medium"},RV={class:"text-xs font-medium"},LV={__name:"ChatMenu",props:{currentScreen:{type:String,required:!0},menu:{type:Object,default:()=>{}}},emits:["change-screen"],setup(e,{emit:t}){const{t:n}=vs(),s=t,r=o=>{s("change-screen",o)};return(o,i)=>(m(),x("div",AV,[l("div",IV,[e.menu.home?(m(),x("button",{key:0,onClick:i[0]||(i[0]=a=>r("home")),class:te(["flex flex-col items-center gap-1 transition-colors",e.currentScreen==="home"?"text-primary":"text-gray-500 hover:text-gray-600"])},[G(y($2),{size:20}),l("div",PV,j(y(n)("menu.home")),1)],2)):q("",!0),l("button",{onClick:i[1]||(i[1]=a=>r("conversations")),class:te(["flex flex-col items-center gap-1 transition-colors",e.currentScreen==="conversations"?"text-primary":"text-gray-500 hover:text-gray-600"])},[G(y(M2),{size:20}),l("div",MV,j(y(n)("menu.messages")),1)],2),e.menu.help_center?(m(),x("button",{key:1,onClick:i[2]||(i[2]=a=>r("helps")),class:te(["flex flex-col items-center gap-1 transition-colors",e.currentScreen==="helps"?"text-primary":"text-gray-500 hover:text-gray-600"])},[G(y(Km),{size:20}),l("div",OV,j(y(n)("menu.help")),1)],2)):q("",!0),e.menu.order_tracking?(m(),x("button",{key:2,onClick:i[3]||(i[3]=a=>r("order_tracking")),class:te(["flex flex-col items-center gap-1 transition-colors",e.currentScreen==="order_tracking"?"text-primary":"text-gray-500 hover:text-gray-600"])},[G(y(zu),{size:20}),l("div",RV,j(y(n)("menu.orders")),1)],2)):q("",!0)])]))}},DV={class:"flex-1 overflow-hidden h-full"},jV={key:0,class:"flex-1 px-4 pb-1"},NV=["innerHTML"],FV=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatContainer",emits:["close-chat"],setup(e){const t=Wt(()=>Promise.resolve().then(()=>HH)),n=Wt(()=>Promise.resolve().then(()=>DM)),s=Wt(()=>Promise.resolve().then(()=>hW)),r=Wt(()=>Promise.resolve().then(()=>IG)),o=R(null),i=ee(()=>{var w;return(w=ae.state.bot)==null?void 0:w.config.ui.signature}),a=ee(()=>{var w,$;return(($=(w=ae.state.bot)==null?void 0:w.config)==null?void 0:$.page)??{}}),c=ee(()=>!a.value||Object.keys(a.value).length===0?!1:Object.values(a.value).some(w=>w&&w.enabled===!0)),u=ee(()=>{var w,$,E;return{home:((w=a.value.home)==null?void 0:w.enabled)||!1,help_center:(($=a.value.help_center)==null?void 0:$.enabled)||!1,order_tracking:((E=a.value.order_tracking)==null?void 0:E.enabled)||!1}}),d=ee(()=>c.value),f=ee(()=>{const w=["conversations"];return u.value.home&&w.push("home"),u.value.help_center&&w.push("helps"),u.value.order_tracking&&w.push("order_tracking"),w.push("chat"),w}),h=()=>c.value&&u.value.home?"home":"conversations",g=w=>w==="chat"?"conversations":f.value.includes(w)?w:h(),p=ee(()=>{const w=ae.state.chatState.viewTab;return g(w)});Qe(()=>{ae.state.chatContainerRef=o.value}),Jn(()=>{ae.state.chatContainerRef=null}),Qe(()=>{let w=ae.state.chatState.viewTab;ae.state.chatState.shouldOpenChatScreen?w="conversations":(!w||w==="chat")&&(w=h());const $=g(w);$!==ae.state.chatState.viewTab&&ae.actions.updateChatState({viewTab:$})});const v=w=>{ae.actions.updateChatState({viewTab:w})},_=()=>{if(u.value.home){ae.actions.updateChatState({viewTab:"home"});return}ae.actions.updateChatState({viewTab:"conversations"})},k=w=>{ae.actions.updateChatState({viewTab:"conversations"}),kt(()=>{setTimeout(()=>{const{send:$}=Ar();$({message:w})},200)})};return(w,$)=>{var E,P,I;return m(),x("div",{id:"ei-chat-container",ref_key:"chatContainerRef",ref:o,class:"flex flex-col h-full w-full bg-gray-50"},[l("div",DV,[(m(),oe(jo,null,[p.value==="home"&&((E=a.value.home)!=null&&E.enabled)?(m(),oe(y(t),{key:0,onCloseChat:$[0]||($[0]=M=>w.$emit("close-chat")),onSendMessage:k,onSetScreen:$[1]||($[1]=M=>v(M)),dataHome:a.value.home},null,8,["dataHome"])):q("",!0)],1024)),(m(),oe(jo,null,[p.value==="conversations"?(m(),oe(y(n),{key:0,class:"h-full w-full pb-1",showMenu:d.value,onClose:_},{actions:Se(()=>[l("button",{onClick:$[2]||($[2]=M=>w.$emit("close-chat")),"aria-label":"eac-close-chat",class:"size-8 rounded-lg flex items-center justify-center bg-white/10 hover:bg-white/20"},[G(y(al),{size:"16"})])]),_:1},8,["showMenu"])):q("",!0)],1024)),(m(),oe(jo,null,[p.value==="helps"&&((P=a.value.help_center)!=null&&P.enabled)?(m(),oe(y(s),{key:0,onClose:_,onCloseChat:$[3]||($[3]=M=>w.$emit("close-chat")),dataHelpCenter:a.value.help_center},null,8,["dataHelpCenter"])):q("",!0)],1024)),(m(),oe(jo,null,[p.value==="order_tracking"&&((I=a.value.order_tracking)!=null&&I.enabled)?(m(),oe(y(r),{key:0,onClose:_,onCloseChat:$[4]||($[4]=M=>w.$emit("close-chat"))})):q("",!0)],1024))]),(m(),oe(jo,null,[d.value&&!["conversations"].includes(p.value)?(m(),oe(LV,{key:0,"current-screen":p.value,menu:u.value,onChangeScreen:v},null,8,["current-screen","menu"])):q("",!0)],1024)),l("div",{class:te(["flex items-center justify-center w-full py-1",[i.value&&i.value.length>35?"flex-col text-center":"flex-row",p.value==="conversations"&&"bg-white",i.value&&i.value.length<=35&&"pl-6 pr-4"]])},[i.value?(m(),x("div",jV,[l("div",{class:"text-[10px] text-gray-500 font-medium leading-[120%]",innerHTML:i.value},null,8,NV)])):q("",!0),G(ev)],2)],512)}}}},Symbol.toStringTag,{value:"Module"})),zV=dt({top:0,left:0,container:null,title:null,link:null,aiText:{},isLoadingSummary:!1});function qV(e){const t=e.trim();return t.startsWith("#")?"id":t.startsWith(".")?"class":null}const BV=(e,t)=>{const n=qV(t),s=t.slice(1);return n==="class"?e.classList.contains(s):n==="id"?e.id===s:!1};function UV(){const{widgets:e}=Xs(),{container:t,title:n,top:s,left:r,link:o,aiText:i,isLoadingSummary:a}=At(zV),c=()=>{t.value=null,n.value=null},u=v=>{var E;const _=v.getBoundingClientRect(),w=["h2","h3",".product-title","strong a",".name_pro",".card-title",".product-name",".title-2"].reduce((P,I)=>{if(P)return P;const M=v.querySelector(I);return M?M.textContent:P},""),$=v.tagName.toLowerCase()==="a"?v.href:((E=v.querySelector("a"))==null?void 0:E.href)||"";return{container:v,title:w,left:_.left,top:_.top,link:$}},d=v=>{c();const _=[".product-card",".card-product",".item-product","#adv3 .c","#uc .c",".km .c",".km .h",".c.jcarousel-item",".q .x",".pkd .h",".pkd .c",".product-card"];let k=null;for(const w of _)if(BV(v.target,w)){k=v.target;break}if(!k)for(const w of _){const $=w.replaceAll(".w-1/2",""),E=v.target.closest($);if(E){k=E;break}}if(k){const w=u(k);t.value=w.container,n.value=w.title,s.value=w.top+8,r.value=w.left+8,o.value=w.link}else t.value=null,n.value=null,s.value=0,r.value=0,o.value=null},f=()=>{t.value&&c()};Qe(()=>{var v,_,k,w,$;((_=(v=e.value.product_card_summary)==null?void 0:v.config_enhances)==null?void 0:_.length)>0&&(($=(w=(k=e.value.product_card_summary.config_enhances[0])==null?void 0:k.widgetSettings)==null?void 0:w.selectorProductCards)==null?void 0:$.length)>0,document.addEventListener("mousemove",d),document.addEventListener("scroll",f),window.addEventListener("resize",f)}),Lt(()=>{document.removeEventListener("mousemove",d),document.removeEventListener("scroll",f),window.removeEventListener("resize",f)});const p=((v,_)=>{let k;return(...w)=>{clearTimeout(k),k=setTimeout(()=>v(...w),_)}})(async()=>{var v;try{if(!o.value||i.value[o.value]||a.value)return;a.value=!0;const{data:_}=await Xe.summary.getSummary({handle:(v=B.bot)==null?void 0:v.handle,source:o.value});_!=null&&_.highlight&&(i.value[o.value]=_.highlight),a.value=!1}catch{a.value=!1}},500);return Pe(o,v=>{v&&p()}),{top:s,left:r,container:t,title:n,aiText:i,link:o,isLoadingSummary:a}}const VV={class:"relative ask-ai-group"},HV={class:"flex items-center bg-white border border-b-[3px] border-gray-200 rounded-lg h-8"},WV={class:"flex justify-center items-center text-gray-900 size-8"},GV={class:"size-[20px] overflow-hidden rounded-full"},KV=["src"],QV=l("div",{class:"text-xs w-[0px] group-hover:opacity-100 group-hover:w-[72px] duration-200"},[l("div",{class:"text-gray-900 whitespace-nowrap opacity-0 delay-100 group-hover:opacity-100"}," Trợ lý AI ")],-1),JV=["onClick"],XV={class:"flex-1"},ZV={class:"flex flex-col px-1 mt-1"},YV={key:0,class:"text-[12px] p-2 rounded-xl bg-blue-50 mt-0.5"},eH={class:"ask-ai-result"},tH={key:1,class:"text-[12px] p-2 rounded-xl bg-blue-50 mt-0.5"},nH=[l("div",{class:"ask-ai-result"},"AI đang xử lý ...",-1)],sH=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetFeatureSummaryCard",props:["bot"],setup(e){const{container:t,title:n,top:s,left:r,link:o,aiText:i}=UV(),a=R(null),c=R([]);let u=R(null);const d=p=>{ECG.send(p)},f=()=>{if(!i.value[o.value])return;const v=`❝${i.value[o.value]}❞`.split(" ");c.value=[];let _=0;u.value=setInterval(()=>{_<v.length?(c.value.push(v[_]),_++):clearInterval(u.value)},60)},h=()=>{c.value.length>0||(clearInterval(u.value),f())},g=()=>{clearInterval(u.value),c.value=[]};return ws(()=>{i.value[o.value]&&c.value.length===0&&(clearInterval(u.value),f())}),Pe(t,()=>{t.value&&a.value.style&&(a.value.style.top=`${s.value}px`,a.value.style.left=`${r.value}px`),g()}),(p,v)=>{var _,k;return m(),x("div",{onMousemove:v[2]||(v[2]=Gt(()=>{},["stop"])),onMouseover:h,ref_key:"ShapeDetectElementRef",ref:a,class:te(["fixed z-50 duration-100 delay-150 group",y(t)?"opacity-100 visible ":"opacity-0 invisible pointer-events-none"])},[l("div",VV,[l("div",HV,[l("div",WV,[l("div",GV,[l("img",{src:(k=(_=y(B).bot)==null?void 0:_.config)==null?void 0:k.ui.logo,class:"object-cover w-full h-full"},null,8,KV)])]),QV]),l("div",{onMouseover:v[0]||(v[0]=Gt(()=>{},["stop"])),onMousemove:v[1]||(v[1]=Gt(()=>{},["stop"])),class:"ask-ai-quick-replies"},[(m(!0),x(be,null,Ie([{name:"✏️ Tóm tắt ưu nhược điểm",content:`Tóm tắt ưu nhược điểm của ${y(n)}`},{name:"🔍 Sản phẩm tương tự",content:`Tìm Sản phẩm tương tự với ${y(n)}`}],(w,$)=>(m(),x("div",{key:$,class:"tag-suggestion",onClick:E=>d(w.content)},[l("div",XV,j(w.name),1),G(y(Ir),{size:"12",class:"text-gray-600"})],8,JV))),128)),l("div",ZV,[G(Pi,{title:"AI đánh giá"}),y(i)[y(o)]&&c.value.length?(m(),x("div",YV,[l("div",eH,[(m(),x("span",{key:c.value.length},j(c.value.join(" ")),1))])])):(m(),x("div",tH,nH))])],32)])],34)}}}},Symbol.toStringTag,{value:"Module"})),rH={class:"flex items-center gap-1"},oH=["src","alt"],iH={class:"flex-1 truncate text-sm tracking-tight relative text-gray-500"},aH=["innerHTML"],lH=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatBoxNewMessage",emits:["toggle","close"],setup(e,{emit:t}){const n=t,s=ee(()=>ae.state.chatState.lastUnreadMessage),r=ee(()=>{var c,u;return(u=(c=ae.state.bot)==null?void 0:c.config)==null?void 0:u.ui}),o=ee(()=>{const c="Bạn có tin nhắn mới";if(!s.value)return c;const{content_type:u,content:d}=s.value;switch(u){case"text":return Ga(d||"",{separate:!1})[0]||c;case"image":return`Đã gửi ${Array.isArray(d)?d.length:1} hình ảnh`;case"video":return`Đã gửi ${Array.isArray(d)?d.length:1} video`;case"file":return`Đã gửi ${Array.isArray(d)?d.length:1} file đính kèm`;case"gif":return`Đã gửi ${Array.isArray(d)?d.length:1} ảnh gif`;case"sticker":return`Đã gửi ${Array.isArray(d)?d.length:1} nhãn`;case"product_cards":return`Có ${Array.isArray(d.elements)?d.elements.length:1} sản phẩm được đề xuất`;default:return"Có tin nhắn mới"}}),i=()=>{n("toggle")},a=()=>{n("close")};return(c,u)=>r.value?(m(),x("div",{key:0,onClick:u[1]||(u[1]=d=>i()),class:te(["p-4 py-3 min-w-[180px] max-w-[280px] cursor-pointer border bg-white rounded-2xl border-gray-100 box-shadow-md relative group",[r.value.alignment.position==="right"?"ml-auto":"mr-auto"]])},[l("button",{onClick:u[0]||(u[0]=Gt(d=>a(),["stop"])),class:"absolute -top-2 -right-2 size-5 bg-white border border-gray-100 rounded-full flex items-center justify-center text-gray-400 hover:text-gray-600 shadow-sm"},[G(go,{class:"size-3"})]),l("div",rH,[l("img",{src:r.value.logo,alt:r.value.name,class:"size-5 object-cover rounded-full overflow-hidden"},null,8,oH),l("div",iH,j(r.value.name),1)]),l("div",{class:"mt-2.5 text-base text-gray-900 leading-[140%] line-clamp-2",innerHTML:o.value},null,8,aH)],2)):q("",!0)}}},Symbol.toStringTag,{value:"Module"})),cH="data:image/webp;base64,UklGRtAGAABXRUJQVlA4WAoAAAAQAAAATwAATwAAQUxQSHQDAAABoLRtmyHJXtAbEV+Ojd2xbdu27XN2trWybdu2Mba9sn1OZkR876KcGRExAWi7ywCg756XP/7NuLmrCtVi1dxx3zxx+V59ASBzKLlYwOx+6/fz2MZ5P9y2hwWslEkA7PTgdNaGEKPW0xhDYO2Mh3YGIGVxBjj9D5Lqg7KNGryS/OMMwLgyWAHOn0yqj+xg9EpOPh8Q2zEBDhlN+sCOB0+OPgSQzhhBnzdIH1nK6Mk3+kBMB6zBkQsZAksbIhceAWvb5oD7yIKlLsh7AdcmgfmMMbLkMfIzA2mLoOdwFsrSa8HhPSFtcOgziTkrmXNSb7iWLLqOZ8GK5hzXFbYFA/zGnJXN+StgmnN4iTkrnPNFuKYyXE7PSntehqwJh62UWi1l3BKukcFQelbccwhMA8FVLFj5gldC6lgMXkmtnnLlIJgawRMsmMCCj0MAWGyQU1OgzNeHBQQP0zOJng9BYNB3CTUNysV9YQSX0TORnpdCLH5nSEXgb7DYJFJToQwbA1fQM5melwMfMaTkQ3Sfw5iOyNnddo5MatzpYsaURF70KENKAh/5OjVfj2NMSeS4edSUKOetZmJX+9R4plY1Of+n5v/l1JQol89JzZwhjCmJHPIuQ0oC370jNXceT02J8vgNV1PToVyzEUYxpiNyFPAEfTo8nwCOZkhH4NFAr4XUVCgX9YLgVfpUeL4KcTiAMRWRB8LBYCRDGgJHwQCC8+nT4HkBBDAw0xhTEDnNwAAQnEufAs/zIKg1+JeheoFDYFDXYTeqVk65O1w9CO5nUbWCD0DQ0ABj6KvlORYwjeCwac5Ypch8Mzg0m+F4qlZHlScgQ/MZrmLQqmjg1cjQquAeBq2GBt4Lh5aNw72sRlTeB2tag3G4mbECnrwO1qCdxuELhtIVjKfAGbQ3w6X0JQuRU7ZGhnYLzmYoVSzIpy0ydOCUUsWCnHQw4NB+h2NKFDy56GpADDpyKGNTqu3S4EnOvbU3IOiow37NqCfpfdBWNHhPkn9f1B0Qg07tTq0XPcn5OWuDbzKw1g+/a3sAYtBpi53qBU+ueHL7Hhuf/fS/C9nioiHPnrsxACsGnbdYL1IZlJx140DU77PNkZfc+uCzL730zIO3XnrkNn0AwIhFOR1eoZL8/XQHiDVWxKBlI2JRWgN5pSi+PhBAZlDfWCdNOmvQcVZQOCA2AwAAEBIAnQEqUABQAD6RQptKJaOpJqZzPAEgEglsALcBrtmeJf3b8pvZUq3924fE0MNfzAP033BHni+jX0AP8B1G3oAeXF7I37m+jk0QVoKAEM28ZX1Bvu/Qd/YAwzNKM/u7WIhKfKfM5UCi/VqPyy1fqXAeNELL+x/0vfCAyanmz6ARgozz/YZk1AcINuzmw5zBsUNBv6rWKBQAAP7+hwO2nl3XheqGaUHr0VXrM5+plmfGH6mWj3uls1bOfMt/ud8vaff/3PhdErNr0VYDglGwtuE5TdY4tJsi/qmB3Fyu5ekjJHM3+/ALHhQ3AapMI0mrValYr818USUxcL7L8aP8m9zXKUbcY/J8IJmEIGTvGZFEO2AOKEk+nYnR4mvbWxhnUJIhpjZtosZGnU7Q64JsR0WWKjYSHFjmEeWxOfJZbvVtvUW9H8H83STcpAL1D3wqajrI14tJWvWwkhihI9066wKy2DJd6uXWfdj3kisfWmJ+Ps/eN64Mv/G3t8kniLVI9P6QP0BBeC1hKku6NqN/01nmr92masef+qGZRMPptSyZivex0QbQd57ZSZkAgs+kPcQQrFrDMZiMzW7KBSZznEGVv1gxivHe50KOxW+90WcrWvmhcTMt2Bvy15JsAySPkK5HGwmMkSMngEhLnwiRaP2W/hetQIA9ZQzWh4rlCIyzfmO71hUcFH4k40wS15dyhTB4tLXLF+zTJT/I2XzBOk0viLeRaxek2Dxi0LQgg/S+9pyWdlt/U0HkhjqJapySw7JzPSRqHyUm8v6b6G31v7M/iei1qCaj1Xap9JP4/54SdujaMqtntHw0rzHM11NGEepodiBwVGkV0kdu74zCvu9Szrw2upBo7hcEkQ6T/HoKnK0XY/ZS1Ta3y0CLl53I/3/JQxt8shI5RsK2qmH0jJYZET2hUWKaH8c7qg17F7dDpRjS6kstyAk9Z8gygk/41sQlApXP0e+5ofkEuaT8Pr4b4KZRrnfpBiBtMhB/PdllZM1VCbItbHtdP4kxENVhE+dheJKTH7ZpVZvKiGo5XZaowwhvlh3hDT3xiX6S+c0GwE9Cq4+XZ6HYyBZhvuvgBPMlxyAA",uH="data:image/webp;base64,UklGRiIDAABXRUJQVlA4WAoAAAAQAAAAOwAAKQAAQUxQSBYCAAABmS8wRPQ/EHS1bTumV9fzft/3W4PYNiu7SmencrIFTmfV2YOks50qG2Cvtarf9syHp5hZmmcHIiZgAgjAFwFQJ2ukkbLSUurVqlGlQrkygYDHcRyloGKxWCgvL2/QkEF9evXp1KVDhzZtIoAvgkIhIll7rDTdGA2qoDQjfdp88cgtQzyxAiSOuKEGCpVSBaKI+DtVRBUTwpcy02ZocsAznhjgiZ13BkLCERDCwX/qFPmnSqnEGE/tdZsv4ovscEbECaCUhQNEfLfM9ZUT8VwB4aDkfaHARVsIbDRFzAODPmwyViMsAwWLIlZuqUcwH4QJKCwGTGEFmAs1RrMiMBmyUmBUYLQKWVUgrKSkZAhlBKiWlgYFmwKBlAZmoESDWjCrUKuKHaBKJTsKFQJ2gIDHkgPTCUuRkKW8HDsCQwbZAQb0sSPQpweEnW6dzCiR06WNGaBfl3aDqihhQqFTtzZdxoFNhRahPk2gjIi/AL8hYQP4DvgARgU+A96DsOFJfAC889MMMY+BUOAVeHyRE+5Awim5WAWcBEQ8d513FkKOEBAloqBUogIOgC8HMXHOcTdUQmECqogoEP9EFagiQjgQwml1GDw5AODcNMV+a0wxSr1yDv5rUSCKAKEezb574SV48gBAJXwtbgAysrKy0hqk1KlRq0qFCuUCgYDHEQ6gVCwWC+Xl5Awa0K9Xt07tWnUZBgC+HABWUDgg5gAAAHAGAJ0BKjwAKgA+kUKcSiWjoqGquAgAsBIJQBmSPD/btNJ4B+ICARCIkGqat3IjrK03S10Sw6ypi4rmAAD+75rHhRPAdCf3sF3YLuwX+t8bGiqpePf6+ZV0dxFTe7agBbBH1AchhTT7x9k/dJRfGFcPovaDi8eVUNUP1q3g8+OUoGyQgbRPetMkJI13uHCbkXFXPGtBGJws9i1MH8nd+a/UHPeexfV+h69/xluP6t0TfCatucBVlP+EPTXNe3S/cE/iobCvjR5ICW3hH/Yn/qxzc/Gmf3c9jY4ABATpB/fLP+nwAAAA",dH="data:image/webp;base64,UklGRugEAABXRUJQVlA4WAoAAAAQAAAAOwAAOwAAQUxQSHcCAAABoF1texox+izL4aQL5mWqIlAB3WMPyxhmTi4ZqqD7oWVuYCzpf4MeW2ogIiZAizsvacmOvT88eDL5/ffJ04c/7ntniSTvNLjz0qqdl0aJzml8edcqybthKi9t+OkfgBRjMjNLKSaAf49tlHw1gJfWXgdiSCyYQgRurJN8b43qzw2C0asFsC+8mn6qWh+NIDBggPEnqqsenHQQWmNQa+Gw5BZy0lmIDB6N85JbwEm3aY0MreWu5DpV0m3mZDrnrlR1qXWWOdnOuaC6Q6ODtGTcckTNW7w+AsvB3mLGJ/JvqFSPiOREZOxVveb1OS150fKlvCSntYblZrBOTvK6TiA3Ajfl5bSBbDsBm+S8fiKUEDgur1X/YCUY/62WdhIpMrBbukQo5aqWjEhlJCZLdySKtff2kgazviIHfiCWc+xBOYnHT0jlPJ9gpRiz33uwN3cx7PUe/swBeyPWw6SHbI3ZU1IpiecPS3r8I7GUyLF9pHIOvJMo1t5bMiaVkZgs1WVCGYGr0i7iUNbbHmnVv1gJxv9r5HWMUELghLzTRobuCTbLyesGIb/ALdWS0zrDcjNYLyfJ6wva3Fq+lpekSn5MzCsybVS9Jq9PMMvJjM/k9eZGh2lzajmqRm+vdZ55PnMuqlbHSrrLPJc596Wqi5x0l9ZysJb7klN3J13A4nDRuCg5LeqkI9DaMNbCUclp8arWJ2MIQwSYfqa6Uq+N/JdAsH4sAF81atS3l9bdBGJIi6QQgFvrJa/+Ky9tOv4fQIwpmZmlFCLAfyc2S77SoM5Lq3dfmRidbXJ1z2qpdhrceUlL3z1w7PHz2Z9/zp4/PnbgvaWSvNPiAFZQOCBKAgAA0A8AnQEqPAA8AD6ROppIpaMioSwSvMiwEglsALc91bx/6T+O/M+a4978nj5mJyfmAfp90gPMB+z3q8f3L1K+gB/iOox9ADy4PZL/dbCL/5zM1Vzm6J7xhy4G/R3MLed+sS6PrZreMRjtw41/Y6bqD02brsXp8yo0yXZ7V2MLgOLuFvePo02QAP7p7DbDiD2AyeFnhD8uelTZYyYXoBksTpcFgc/ktYPE6iT+knfc/9Jtb588XC/1PKhDE1cUpGsvYvD1Vy4oDHQSmA28w5jCAaxFPaJpFp6vXcWSHtl4WMdzB3qEdnw9/xKklfBKXeCWgCVmbyPy5WnuvHtgZ0OGL6Jy1YsvVUV+2C/mhFD1UAUWH1fVs2H+EfdjxT93F6UkxVMkANEm2YyWfHVGqdBEL4ZpU8RK24FaJcZZx6V2vNHS92tAjgAPnCQ7sK05PprSS16cUciKUh8BN189s1C0WtaAqZ8X8XNGaDq1TfbOOQ69pdTOFumUTwycReIq/h+uKoqH5zdq6qH7bKD0ikCnlMOhJX+iiZOSNC3+jYLD32LMU5VT8TYLVA+cLTaQy7w/Egw5udxqoqfrcSapUVLf+5mTzE7ehYGgAB2cUKyKRqN/ReHqvIXB2PP6QTwINn1hZTeQ+rTWfWSoTSZc7F/8yelk1fypMzzkGu5/3k0seBJ4Qw35QRbCW1jWYbcuGDqMereBBHe+m2Y+oAMKFg64a/izMfpfD2NrBPiCOgr+gTsiO6s7Bd33Ksp/4ePaYCvTufb6zat8b0AAAA==",fH="data:image/webp;base64,UklGRsgCAABXRUJQVlA4ILwCAADQDwCdASo8ADwAPpE+mkoloyIhphVc6LASCWwAyPwycMkVbNA7Te2a8wH6k7qB1yHoAfsZ6Y37R/CJ+1Ho7PJOGfdAOsb43XC1Rnd5ntpzshIe31RIcoFm31ExFqzOptCaeeTKd67V7dWliYw17KyFJlv/a7aKs4VfB4xcnRSRCAuZO+dtYAAA/vz4RBV1eN0U1NoEF8pKwqlyuIW6K/4/cbPyMYJ/pQr9SecL6LJwtcjd+OhNpN95DikBQoaXIdSqPer9MxQgALTc+/Xb1G17b3D2E38w4EEIC1Hkg2K5jEsfQ3H/5dIYH392O1/Kp4xHvGy2f3of/n8TerbP+GjTe0WMRRsm8HcL7XzbSZ/eQiTyDOUamFZg1URFvVrGi9WoBX2DjZeoHadtpp6SZphBfnZ5HQd++VNZVS2P+/XTkFQr6aPzrtFFJF+KFBajDJ89rLuuMmFPdTXNI51OO0a4o+/Gs55TJ4v4873zFJV6dIytNWyKx0/iemiS1Mkf2rDqWh0Okq2RE48VzeClfag/9WxzSiQp8H5pAR6+8709epX0Gwi7oO7novsJ4LfYS1Rl4eT5ir1ASGKUe+mVUFexvfIZC/S4PzyQgN6FxF/s6xP5kPu8OvctjT4qU2mM06VwKkQFxWHdhpFiq8P8DFqPLSENIjySy2gOtgbBcMdYffxCqWUrfQPFbBIykRPs94LdOZfMpS/JD5Wn3LfoA3zoG3Jm/343JbsINmvPcjIg4wJZAkTzQRZ2eZtRfwz5QprDxP8ArsM/z3Hce95ow4iTGtl58FHWAQ7glFcgveS1tilLrJE6e22uozcOl+B+rZPk7XuOZk+LFIH3wxP/hL7waKjcJyU35wdJ5UXMshZDVATPsNh7KQnslc3vJIn25/GQD3KuD3n/6NEh/ZYHTwQDe/si+9+Pwp8S0AAA",hH="data:image/webp;base64,UklGRjAFAABXRUJQVlA4WAoAAAAQAAAAOwAAOwAAQUxQSCcBAAABgKPtf9rmp0ea40xwrzQ73ob5PmnOkWYrMwRs/fVbgv6X2yEiGLZtG0m61wvUXgEA4IBsaTydPyy97DDsVcQvH+bTcSkCHLY0FoX2JVP0opWHNZs3UF+Q4iWE4wlBvJBvVRizeQ/IODBFQ0z2Ny6LAWNhykrCPiwc6jvSVMOEVTgUFhQqKHzLAW3GVDFmE9lLBh0Cz6PSZqYTFcf0WngOp5qPyZxBi8DZgyZ3Syq68JrEoomoEr5ewr86RBPRPUN1z27dzqDbVXQ7kmo3G+h2wuyFYhfNoKXXgRtA/k0nEr7m4FBjotP5y3Cw6DPR2BpdWMAAfY2N090xkKpvaW+r18rmDRiLfOuCKXreyMEabOmA6GR4ena3SCQcoSSLu9lkWMxsbUkAAFZQOCDiAwAAkBMAnQEqPAA8AD6RRJxKpaOioagYCACwEglsAJ0yy7i/xPmn1B3AOm2NtC8/LW+A56TpAP6r1FHoAeWT7IX7qekrWQwZMsVmY+UJ6r+wHsV/sAmBREtU2N9/xgfF8opeIE0NsIuAlPZKb6PHYVYRNE5cBqV9wann0N9gYnI/fhLtJO4WqSGSNtUxxPZp2Be4GUBERjBHfLUJyu8fRJ70TL5529MAAP7i5+SrLJ5fkdH4p9w/L6/Ob+7rKmVW0OdOqSVPGBTfp5QZUDS+/q2P/p6Wt+Ib99JrtE6GeFO/a7+3NGcUXQVlxnXIUY0QaJ/kQqw6gxw73cN6jfwaVd4wdnql2QZuQ/p1Xmf0bnsAL2csUpkT5WCBx59ShbqM9UikwsOcerYPHP3ODfKyLVRR01JRYqWV/xxEXKbT0JqGkE2A3UtAw4y0O6wHQ1tck7/HFuQnkrTimYL14QLddiD2kD5PnzZXz66PgIAnDYVBwyQehO4KGMQu2r0ix2Fv242bQk8cOcPCd94shae5zHmuNZMpcbkDzgQ0zN8QKtnCiFIs8IeXPL+1IW/g3bT4/+nkfoBPDPNphUZyxqfVsQ+joRZmLxRIapH1QQdUIBq1PSEvbXzhx9mGzjeygvag7nsNzgw8C93JCPW/yVADO1FvbAqeHjP8To/eu4lrw0eJ56YnH5PEZVXtBz5rzk4k1gDH+ANgsj74npMSrsFoeMm4SKNPLAvJNmQiQeYvNS8N4/eeA0N69CR24KHJuvK0gmz6hrKFNZsgzTFs1CtPQeaJ7adhkMBu0d1pzyBmgo/R01DmsMsKbgyIKK5fu6kYlIyo8BBqK+e4G/hB058OdO32EP4nDigGdWq+7vXKclkPW63iErBpE88OVyGQ9rwTAyBq/pg766uv9fvNWn1j9F0hG/9P+bkp4CjI/Cg5E5gKZSnYXGjwCkJgz/mDVn1Misb80Y0PGYlQCKSj2zQp7bgnxiFm8ynY4r28zFiQUBlaFHU/b+q1ta4yv6q1DJsfRXm3MpHIifySNr/9WxGzXhSV2nwvlN0STPNjkmHfukscGxVtKjA4V6lMB6/uHBiZRHRSmyNuz4aL9r6vlFa4Y88xUQsLvGS5ZHB8CGmpLcALSNlhmIRX3yc9mGHFH0q26/8xbvgk6siErWxyHanUioWtpLbspm7XzJoMjznUfwjD4z6ayPndm1SCX2wfk2HJrxahGkd4nhEfNkNGqUhxrTx5jE1rkjjkLWOXvcXpAyHneYa5e8hENqWeQMJXm1hra6G7Hi9iF7BLo53iY+gL3VAcS1wvIltQRWuAMT8rnyZTIAAAAA==",pH="data:image/webp;base64,UklGRm4DAABXRUJQVlA4WAoAAAAQAAAATwAATwAAQUxQSJoAAAABd6AokqQ2eumZwxccIImICJB3FP/iTUREOKqtPWryh6Fd/hKihIMCfHTUgAKWLJEQB0RCDHSe589HPgE9Ef2fACN1/0XiOCvUqHuCsLMil7BJN34qdXiD0MO2HpTv6fXDEZo7y/r149gPX5BG/F37ZYmvH8d+uH84wvrK0rSe4z1xeDN4WLmETbrxU6m6Bwg7K0bq/psqznI1VlA4IK4CAACwEACdASpQAFAAPoE2kkelIyGhOtJKAKAQCWgAzXw+R9eob5pGRzP/QD3ifjveLeZL9gPVl9Dfnb9SrvR+Q33MywNLEzXvADYsO0rhxXJx7KXxXdoTB8ZWHAkzZylMtACVBtshEWjG9Sp8Q0aCJZi5rxPVt0wtC6gRLvNhYhlSdVP92uGrp3q5eLDCb2QAAP701AsbKZIFRUBPGa3/BQJhqpXKH/+Wf3m4uoqabIf/1OP+Tj/k47PphdOUJnNzbozRRsC9XhpWuovdCGnqO5RELU8yD0YJ+EPyTwahyQ8Fxbix1/aae9iLM6vj1aD1Jr5eEfeYf6o91HoRPEWxro/W2C3FeuarTtDaT/7rsN6dfxBBbChkpEuqXX5rB15SPub9OUXo3t/jrUbhHvEEmKdIWaQcQ/tjsyu3hXM6idjz8Kk2Sv32kL4MsQcGn9MLR3xy3OJl2cEd2H8LqM+x1eD36Ey7bSMk31KpwnrpkZjw6+9MVU6P+qtf+oqFNdSG/pocX2W8EPZ2pIHAoy8+3Wv6352mPlgJdGXKwDIgp0iFBiMipo1scHutKQ/0zxQ9QCuJGQfsPaSz+Qf1SMWX9SUlNXDrDIxVPET12ny8UtWdcarMIt80h1o5M6FCXSR6LoK+MSAsW6UvVrsfZR+6qSHroWbTR5JfEpo2rfunAjSst0JFQ3r/qliI2e31hdYCKKRxmlana4XfQK54DyKptPIiYr5VrER59fGMiceimEcoIQlpK0kAZcYl+eT+nOna90pXtK8OU3X/NSwH+PT65pfBwRi430iM5IXvQ7ClCOPIDZZP6pcwqnE8x1PzTV4OEdgjOHIVuKFt6iYdGV75SaiwOL/QW7q3VDeews5B8ImQX014vPFQZWHKRUie8rV+XfcGPAynLLfble6Z9v4AAA==",mH={id:"eac-home-screen",class:"relative pt-4 flex flex-col h-full w-full"},gH=l("div",{class:"flex flex-col absolute top-0 left-0 w-full xs:rounded-t-lg overflow-hidden h-72"},[l("div",{class:"flex-1 bg-primary"}),l("div",{class:"h-48",style:{background:`linear-gradient(
180deg,
var(--ui-primary-color) 46.88%,
rgba(0, 0, 0, 0) 100%
)`}})],-1),vH={class:"flex flex-col flex-1 overscroll-none overflow-y-auto px-4 pt-0 pb-2 w-full h-full relative"},yH={class:"p-2 py-8 relative"},bH={key:0,class:"text-[28px] font-semibold text-white whitespace-pre-wrap"},_H={key:1,class:"text-base text-white whitespace-pre-wrap mt-2"},xH={class:"flex-1 space-y-6"},wH={class:"bg-white rounded-2xl border border-gray-200/90 shadow-custom-soft overflow-hidden px-4 py-5"},kH={class:"flex-shrink-0"},SH={class:"relative"},$H=["src","alt"],CH=l("div",{class:"size-3 border-2 border-white bg-green-500 rounded-full absolute bottom-0 right-0"},null,-1),TH={class:"flex-1 min-w-0"},EH={class:"mb-1 flex items-center justify-between"},AH={class:"text-gray-600 text-sm tracking-tight"},IH={class:"flex-shrink-0 size-[18px] bg-red-500 text-white text-[11px] font-semibold rounded-full flex items-center justify-center"},PH={class:"flex items-center gap-2"},MH={class:"text-base text-gray-900 font-medium line-clamp-2 flex-1"},OH={key:0,class:"space-y-2"},RH=["onClick"],LH={class:"flex-1 text-sm sm:group-hover:font-semibold sm:group-hover:text-primary"},DH={class:"p-1 duration-300 sm:-translate-x-0.5 sm:group-hover:translate-x-1.5 bg-primary text-white border border-primary rounded-full flex items-center justify-center"},jH={key:1,class:"border border-gray-100 shadow-sm rounded-2xl bg-white overflow-hidden"},NH={class:"py-3 px-4 border-b border-b-gray-100 font-medium"},FH={class:"divide-y divide-gray-100"},zH=["href","target"],qH={class:"size-9 bg-gray-50 rounded-full flex items-center justify-center flex-shrink-0"},BH=["src","alt"],UH={class:"text-left"},VH={class:"text-sm text-gray-900"},HH=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"HomeScreen",props:{dataHome:{type:Object,default:()=>({})}},emits:["close-chat","send-message","set-screen"],setup(e,{emit:t}){const{t:n}=vs(),s=e,r=t,{bot:o}=At(ae.state),{messages:i}=Ar(),a=ee(()=>{var k,w;return((w=(k=o.value)==null?void 0:k.config)==null?void 0:w.ui)||{}}),c=ee(()=>{var k,w,$;return(($=(w=(k=o.value)==null?void 0:k.config)==null?void 0:w.quickPrompt)==null?void 0:$.messages)||[]}),u=ee(()=>{var k;return(k=s.dataHome)==null?void 0:k.title}),d=ee(()=>{var k;return(k=s.dataHome)==null?void 0:k.description}),f=ee(()=>{const k=i.value.filter($=>$.sender_type==="assistant"&&$.content_type==="text");if(k.length===0)return{content:n("home.defaultWelcome"),created_at:null};const w=k[k.length-1];return{content:w.content||n("home.newMessage"),created_at:w.created_at}}),h=()=>{ae.actions.updateChatState({viewTab:"conversations"})},g=k=>{r("send-message",k)},p=(k,w=null)=>k==="custom"?w||w2:{messenger:cH,zalo:fd,hotline:eg,email:A2,phone:eg,youtube:uH,facebook:dH,tiktok:fH,instagram:hH,linkedin:pH}[k]||Xm,v=(k,w)=>w?k==="hotline"||k==="phone"?w.startsWith("tel:")?w:`tel:${w}`:k==="email"?w.startsWith("mailto:")?w:`mailto:${w}`:w:"#",_=ee(()=>{var w;return(((w=s.dataHome)==null?void 0:w.quick_contact)||[]).filter($=>$.enabled!==!1).map($=>({type:$.type,href:v($.type,$.value),target:$.type==="messenger"||$.type==="zalo"||$.type==="custom"?"_blank":void 0,icon:p($.type,$.logo_url),title:$.title,subtitle:$.description,subtitleClass:$.type==="hotline"||$.type==="phone"?"text-red-500 font-medium":"text-gray-500"}))});return(k,w)=>(m(),x("div",mH,[gH,l("div",vH,[l("div",yH,[l("button",{onClick:w[0]||(w[0]=$=>k.$emit("close-chat")),"aria-label":"eac-close-chat",class:"p-2 absolute right-0 top-0 rounded-lg hover:bg-white/10 cursor-pointer text-white"},[G(y(al),{size:"20"})]),u.value?(m(),x("div",bH,j(u.value),1)):q("",!0),d.value?(m(),x("div",_H,j(d.value),1)):q("",!0)]),l("div",xH,[l("div",wH,[l("div",{class:"flex gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-100 py-3 px-2.5 rounded-xl cursor-pointer",onClick:w[1]||(w[1]=$=>h())},[l("div",kH,[l("div",SH,[l("img",{src:a.value.iconImage||a.value.logo,alt:a.value.name,class:"size-12 ring-1 ring-gray-100 border-2 border-white rounded-full object-cover shadow-sm"},null,8,$H),CH])]),l("div",TH,[l("div",EH,[l("div",AH,j(a.value.name),1),l("div",IH,j(y(ae).state.chatState.unreadMessageCount||1),1)]),l("div",PH,[l("p",MH,j(f.value.content),1)])])]),l("button",{onClick:w[2]||(w[2]=$=>h()),class:"w-full mt-3 h-12 rounded-xl text-base text-white bg-primary hover:opacity-90 transition-opacity flex items-center justify-center gap-1"},[Be(j(y(n)("home.sendMessage"))+" ",1),G(y(sg),{size:18})])]),c.value.length>0?(m(),x("div",OH,[(m(!0),x(be,null,Ie(c.value,($,E)=>(m(),x("div",{key:E,onClick:P=>g($.content),class:"overflow-hidden flex items-center rounded-xl cursor-pointer text-gray-900 px-4 py-3.5 gap-2 bg-white border border-gray-200 shadow-sm group"},[l("div",LH,j($.content),1),l("div",DH,[G(y(Vm),{size:"12","stroke-width":"3.5"})])],8,RH))),128))])):q("",!0),_.value.length>0?(m(),x("div",jH,[l("div",NH,j(y(n)("home.quickLinks")),1),l("div",FH,[(m(!0),x(be,null,Ie(_.value,($,E)=>(m(),x("a",{key:E,href:$.href,target:$.target,rel:"nofollow noreferrer",class:"flex items-center gap-2.5 px-3 py-2 bg-white hover:bg-gray-50 transition-colors"},[l("div",qH,[typeof $.icon!="string"?(m(),oe(Nt($.icon),{key:0,size:"22",class:"fill-blue-500 stroke-white stroke-1"})):(m(),x("img",{key:1,src:$.icon,alt:$.title,class:te(["w-6",["tiktok"].includes($.type)?"object-cover rounded-full":"object-contain"])},null,10,BH))]),l("div",UH,[l("div",VH,j($.title),1),l("div",{class:te(["text-xs",$.subtitleClass])},j($.subtitle),3)])],8,zH))),128))])])):q("",!0)])])]))}}},Symbol.toStringTag,{value:"Module"})),WH={class:"flex flex-col h-full bg-gray-50"},GH={class:"flex items-center gap-2 p-3 bg-primary relative"},KH=["aria-label"],QH={class:"text-base font-medium text-white"},JH={class:"flex-1 overflow-y-auto p-4"},XH={class:"space-y-6"},ZH={key:0},YH={class:"flex items-center gap-2 mb-3 px-1 text-gray-800"},eW={class:"font-semibold"},tW={class:"space-y-2"},nW=["onClick"],sW={class:"overflow-hidden"},rW={class:"px-4 pb-4 pt-0"},oW={class:"text-sm text-gray-600 leading-relaxed whitespace-pre-wrap"},iW={key:1},aW={class:"flex items-center gap-2 mb-3 px-1 text-gray-800"},lW={class:"font-semibold"},cW={class:"space-y-2"},uW=["href"],dW={class:"flex-1 text-sm sm:group-hover:font-semibold sm:group-hover:text-primary"},fW={class:"p-1 duration-300 sm:-translate-x-0.5 sm:group-hover:translate-x-1.5 bg-primary text-white border border-primary rounded-full flex items-center justify-center"},hW=Object.freeze(Object.defineProperty({__proto__:null,default:Ke({__name:"ChatHelps",props:{dataHelpCenter:{type:Object,default:()=>({})}},emits:["close","close-chat"],setup(e){const{t}=vs(),n=e,s=R(null),r=ee(()=>{var d;return((d=n.dataHelpCenter)==null?void 0:d.faqs)||[]}),o=ee(()=>{var f;return(((f=n.dataHelpCenter)==null?void 0:f.documents)||[]).map(h=>({icon:h.title.includes("📖")?"📖":"📄",title:h.title.replace(/^📖\s*/,"").trim(),url:h.link}))}),i=d=>{s.value=s.value===d?null:d},a=d=>{d.style.height="0",d.offsetHeight,d.style.height=d.scrollHeight+"px"},c=d=>{d.style.height="auto"},u=d=>{d.style.height=d.scrollHeight+"px",d.offsetHeight,d.style.height="0"};return(d,f)=>(m(),x("div",WH,[l("div",GH,[l("button",{onClick:f[0]||(f[0]=h=>d.$emit("close")),class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":y(t)("common.back")},[G(y(fo),{size:20})],8,KH),l("h2",QH,j(y(t)("help.title")),1),l("button",{onClick:f[1]||(f[1]=h=>d.$emit("close-chat")),"aria-label":"eac-close-chat",class:"p-1.5 rounded-lg hover:bg-white/10 cursor-pointer text-white ml-auto"},[G(y(al),{size:"20"})])]),l("div",JH,[l("div",XH,[r.value.length>0?(m(),x("div",ZH,[l("div",YH,[G(y(Km),{size:18}),l("h3",eW,j(y(t)("help.faq")),1)]),l("div",tW,[(m(!0),x(be,null,Ie(r.value,(h,g)=>(m(),x("div",{key:g,class:"bg-white shadow-sm rounded-xl border border-gray-200 overflow-hidden transition-all duration-200"},[l("button",{onClick:p=>i(g),class:te(["w-full flex items-center justify-between px-4 py-3.5 text-left transition-colors",[s.value===g?"":"hover:bg-gray-100 hover:shadow"]])},[l("span",{class:te(["text-sm text-gray-800 pr-3",s.value===g?"font-semibold":"font-normal"])},j(h.question),3),G(y(uo),{size:16,class:te(["text-gray-500 flex-shrink-0 transition-transform duration-300",{"rotate-180":s.value===g}])},null,8,["class"])],10,nW),G(Yt,{name:"accordion",onEnter:a,onAfterEnter:c,onLeave:u},{default:Se(()=>[Rt(l("div",sW,[l("div",rW,[l("div",oW,j(h.answer),1)])],512),[[Jo,s.value===g]])]),_:2},1024)]))),128))])])):q("",!0),o.value.length>0?(m(),x("div",iW,[l("div",aW,[G(y(Zs),{size:18}),l("h3",lW,j(y(t)("help.documents")),1)]),l("div",cW,[(m(!0),x(be,null,Ie(o.value,(h,g)=>(m(),x("a",{key:g,href:h.url,target:"_blank",rel:"noopener noreferrer",class:"overflow-hidden flex items-center rounded-xl cursor-pointer text-gray-900 px-4 py-3.5 gap-2 bg-white border border-gray-200 shadow-sm group"},[l("div",dW,j(h.title),1),l("div",fW,[G(y(Vm),{size:"12","stroke-width":"3.5"})])],8,uW))),128))])])):q("",!0)])])]))}},[["__scopeId","data-v-6ad2da93"]])},Symbol.toStringTag,{value:"Module"})),pW={class:"flex flex-col h-full bg-gray-50"},mW={class:"flex items-center gap-2 p-3 bg-primary"},gW={class:"text-base font-medium text-white flex-1"},vW={class:"flex-1 overflow-y-auto"},yW={key:0,class:"p-4 space-y-6"},bW={class:"bg-white rounded-2xl border border-gray-200 shadow-sm p-4"},_W={class:"flex items-center gap-2 mb-4 text-gray-800"},xW=l("h3",{class:"text-base font-medium"},"Tra cứu đơn hàng",-1),wW={class:"space-y-3"},kW={class:"relative"},SW=["disabled"],$W={key:1},CW={key:2,class:"flex items-center gap-2"},TW=l("span",{class:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"},null,-1),EW={key:0,class:"bg-red-50 border border-red-200 rounded-xl p-3"},AW={class:"flex items-start gap-2"},IW={class:"text-sm text-red-700"},PW={key:1,class:"p-4 space-y-4"},MW={class:"bg-white rounded-2xl border border-gray-200 shadow-sm overflow-hidden"},OW={class:"p-4"},RW={class:"flex items-center justify-between mb-2"},LW={class:"flex items-center gap-2"},DW=l("span",{class:"text-sm font-medium text-gray-600"}," Mã đơn hàng: ",-1),jW={class:"font-semibold text-gray-800"},NW={class:"flex items-center justify-between"},FW={class:"text-xs text-gray-500"},zW={key:0,class:"bg-white rounded-2xl border border-gray-200 shadow-sm"},qW=l("div",{class:"py-3 px-4 text-base font-medium text-gray-900 border-b border-gray-200"}," Thông tin người nhận ",-1),BW={class:"py-3 px-4 space-y-2"},UW={key:0,class:"flex space-x-3"},VW=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Họ và tên ",-1),HW={class:"text-sm text-gray-700 font-medium"},WW={key:1,class:"flex space-x-3"},GW=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Số điện thoại ",-1),KW={class:"text-sm text-gray-700 font-medium"},QW={key:2,class:"flex space-x-3"},JW=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Địa chỉ nhận hàng ",-1),XW={class:"text-sm text-gray-700 font-medium"},ZW={class:"bg-white rounded-2xl border border-gray-200 shadow-sm"},YW=l("div",{class:"py-3 px-4 text-base font-medium text-gray-900 border-b border-gray-200"}," Thông tin đơn hàng ",-1),eG={class:"py-3 px-4 space-y-2"},tG={class:"flex space-x-3"},nG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ngày đặt hàng ",-1),sG={class:"text-sm text-gray-700 font-medium"},rG={class:"flex space-x-3"},oG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Mã đơn hàng ",-1),iG={class:"text-sm text-gray-700 font-medium"},aG={key:0,class:"flex space-x-3"},lG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Phương thức thanh toán ",-1),cG={class:"text-sm text-gray-700 font-medium"},uG={key:1,class:"flex space-x-3"},dG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ghi chú ",-1),fG={class:"text-sm text-gray-700 font-medium"},hG=l("div",{class:"font-semibold text-gray-700 mb-3"}," Sản phẩm đã đặt ",-1),pG={class:"space-y-3 mb-4 border-b border-b-gray-200 pb-4"},mG={class:"flex items-center justify-between"},gG=l("div",{class:"text-gray-500 mr-2 text-sm"}," Tổng tiền hàng ",-1),vG={class:"text-right text-base"},yG={class:"text-gray-700 text-sm"},bG={key:0,class:"flex items-center justify-between"},_G=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),xG={class:"text-right text-base"},wG={class:"text-green-500 text-sm"},kG={key:1,class:"flex items-center justify-between"},SG=l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1),$G={class:"text-right text-base"},CG={class:"text-gray-700 text-sm"},TG={class:"flex items-center justify-between mt-2"},EG=l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),l("span",{class:"text-xs ml-1"},"(Đã bao gồm VAT)")],-1),AG={class:"text-red-500 text-base font-semibold"},IG=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatOrder",emits:["close","close-chat"],setup(e){const t=R(""),n=R(!1),s=R(null),r=R(""),o=R("search"),i=async()=>{if(t.value.trim()){n.value=!0,r.value="",s.value=null;try{const{data:d}=await Xe.order.getOne(t.value.trim());if(d.success){const f={...(d==null?void 0:d.data)??{},order_number:t.value};s.value=f,o.value="detail"}}catch(d){console.error("Error checking order:",d),r.value="Không tìm thấy đơn hàng. Vui lòng kiểm tra lại mã đơn hàng hoặc liên hệ bộ phận chăm sóc khách hàng."}finally{n.value=!1}}},a=()=>{o.value="search",s.value=null,r.value="",t.value=""},c=d=>({pending:"Đang xử lý",confirmed:"Đã xác nhận",processing:"Đang chuẩn bị",shipped:"Đang giao hàng",delivered:"Đã giao hàng",cancelled:"Đã hủy"})[d]||d,u=d=>({pending:"bg-yellow-100 text-yellow-800",confirmed:"bg-blue-100 text-blue-800",processing:"bg-purple-100 text-purple-800",shipped:"bg-indigo-100 text-indigo-800",delivered:"bg-green-100 text-green-800",cancelled:"bg-red-100 text-red-800"})[d]||"bg-gray-100 text-gray-800";return(d,f)=>(m(),x("div",pW,[l("div",mW,[o.value==="detail"?(m(),x("button",{key:0,onClick:a,class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":"Quay lại"},[G(y(fo),{size:20})])):(m(),x("button",{key:1,onClick:f[0]||(f[0]=h=>d.$emit("close")),class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":"Quay lại"},[G(y(fo),{size:20})])),l("h2",gW,j(o.value==="detail"?"Chi tiết đơn hàng":"Tra cứu đơn hàng"),1),l("button",{onClick:f[1]||(f[1]=h=>d.$emit("close-chat")),class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":"Đóng chat"},[G(y(al),{size:20})])]),l("div",vW,[o.value==="search"?(m(),x("div",yW,[l("div",bW,[l("div",_W,[G(y(zu),{size:18}),xW]),l("div",wW,[l("div",kW,[Rt(l("input",{"onUpdate:modelValue":f[2]||(f[2]=h=>t.value=h),type:"text",placeholder:"Nhập mã đơn hàng (VD: DH123456)",class:"w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/20 focus:border-primary outline-none transition-colors bg-white",onKeyup:mr(i,["enter"])},null,544),[[on,t.value]])]),l("button",{onClick:i,disabled:!t.value.trim()||n.value,class:"w-full py-2.5 bg-primary text-white font-medium rounded-lg hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-opacity flex items-center justify-center gap-2"},[n.value?q("",!0):(m(),oe(y(cl),{key:0,size:18})),n.value?(m(),x("span",CW,[TW,Be(" Đang tìm kiếm... ")])):(m(),x("span",$W,"Kiểm tra đơn hàng"))],8,SW)])]),r.value?(m(),x("div",EW,[l("div",AW,[G(y(Gm),{size:18,class:"text-red-500 flex-shrink-0 mt-0.5"}),l("div",IW,j(r.value),1)])])):q("",!0)])):o.value==="detail"&&s.value?(m(),x("div",PW,[l("div",MW,[l("div",OW,[l("div",RW,[l("div",LW,[G(y(zu),{size:20,class:"text-primary"}),DW,l("span",jW," #"+j(s.value.order_number),1)])]),l("div",NW,[l("div",FW," Ngày đặt: "+j(y(Oa)(s.value.created_at)),1),s.value.status?(m(),x("span",{key:0,class:te(["px-3 py-1 text-xs font-medium rounded-full",u(s.value.status)])},j(c(s.value.status)),3)):q("",!0)])])]),s.value.shipping_address?(m(),x("div",zW,[qW,l("div",BW,[s.value.shipping_address.name?(m(),x("div",UW,[VW,l("div",HW,j(s.value.shipping_address.name),1)])):q("",!0),s.value.shipping_address.phone?(m(),x("div",WW,[GW,l("div",KW,j(s.value.shipping_address.phone),1)])):q("",!0),s.value.shipping_address.address1?(m(),x("div",QW,[JW,l("div",XW,j(s.value.shipping_address.address1),1)])):q("",!0)])])):q("",!0),l("div",ZW,[YW,l("div",eG,[l("div",tG,[nG,l("div",sG,j(y(Oa)(s.value.created_at)),1)]),l("div",rG,[oG,l("div",iG," #"+j(s.value.order_number),1)]),s.value.payment_gateway_names?(m(),x("div",aG,[lG,l("div",cG,j(s.value.payment_gateway_names),1)])):q("",!0),s.value.note?(m(),x("div",uG,[dG,l("div",fG,j(s.value.note),1)])):q("",!0)])]),l("div",null,[hG,l("div",pG,[(m(!0),x(be,null,Ie(s.value.items,h=>(m(),oe(Al,{key:h.sku,item:h},null,8,["item"]))),128))]),l("div",null,[l("div",mG,[gG,l("div",vG,[l("div",yG,j(y(et)(s.value.subtotal_price)),1)])]),s.value.total_discounts?(m(),x("div",bG,[_G,l("div",xG,[l("div",wG,j(y(et)(s.value.total_discounts)),1)])])):q("",!0),s.value.shipping_price?(m(),x("div",kG,[SG,l("div",$G,[l("div",CG,j(y(et)(s.value.shipping_price)),1)])])):q("",!0),l("div",TG,[EG,l("div",AG,j(y(et)(s.value.total_price)),1)])])])])):q("",!0)])]))}}},Symbol.toStringTag,{value:"Module"}))});