@tvsgroup/support-client 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,29 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>TVS Client Widget - Local Dev</title>
6
+ <script src="./support-client-widget.iife.js"></script>
7
+ <style>
8
+ body {
9
+ background-color: #f0f2f5;
10
+ font-family: sans-serif;
11
+ }
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <!-- The JWT will be injected here by setup_dev.ts or manually -->
16
+ <support-client-widget
17
+ id="019ce36c-561c-7203-b0ad-57738daa7e51"
18
+ jwt="{{WIDGET_JWT}}"
19
+ api-base-url="http://localhost:3100"
20
+ ws-url="ws://localhost:3100/ws"
21
+ ></support-client-widget>
22
+
23
+ <script>
24
+ document.getElementById('019ce36c-561c-7203-b0ad-57738daa7e51').addEventListener('ready', () => {
25
+ console.log('support-client-widget ready');
26
+ });
27
+ </script>
28
+ </body>
29
+ </html>
@@ -17,4 +17,4 @@ var SupportClientWidget=function(on){"use strict";/**
17
17
  * @vue/runtime-dom v3.5.29
18
18
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
19
19
  * @license MIT
20
- **/let Er;const bo=typeof window<"u"&&window.trustedTypes;if(bo)try{Er=bo.createPolicy("vue",{createHTML:e=>e})}catch{}const wo=Er?e=>Er.createHTML(e):e=>e,Zl="http://www.w3.org/2000/svg",Ql="http://www.w3.org/1998/Math/MathML",et=typeof document<"u"?document:null,yo=et&&et.createElement("template"),ea={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?et.createElementNS(Zl,e):t==="mathml"?et.createElementNS(Ql,e):n?et.createElement(e,{is:n}):et.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>et.createTextNode(e),createComment:e=>et.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>et.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,o){const i=n?n.previousSibling:t.lastChild;if(s&&(s===o||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{yo.innerHTML=wo(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const l=yo.content;if(r==="svg"||r==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}t.insertBefore(l,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},ct="transition",Zt="animation",Qt=Symbol("_vtc"),vo={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},ta=ie({},Ss,vo),na=(e=>(e.displayName="Transition",e.props=ta,e))((e,{slots:t})=>Jl(qi,ra(e),t)),wt=(e,t=[])=>{P(e)?e.forEach(n=>n(...t)):e&&e(...t)},xo=e=>e?P(e)?e.some(t=>t.length>1):e.length>1:!1;function ra(e){const t={};for(const g in e)g in vo||(t[g]=e[g]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:a=o,appearActiveClass:f=i,appearToClass:u=l,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:x=`${n}-leave-active`,leaveToClass:_=`${n}-leave-to`}=e,$=sa(s),R=$&&$[0],q=$&&$[1],{onBeforeEnter:V,onEnter:D,onEnterCancelled:j,onLeave:y,onLeaveCancelled:O,onBeforeAppear:W=V,onAppear:ce=D,onAppearCancelled:he=j}=t,H=(g,C,I,B)=>{g._enterCancelled=B,yt(g,C?u:l),yt(g,C?f:i),I&&I()},J=(g,C)=>{g._isLeaving=!1,yt(g,h),yt(g,_),yt(g,x),C&&C()},M=g=>(C,I)=>{const B=g?ce:D,Z=()=>H(C,g,I);wt(B,[C,Z]),_o(()=>{yt(C,g?a:o),tt(C,g?u:l),xo(B)||Co(C,r,R,Z)})};return ie(t,{onBeforeEnter(g){wt(V,[g]),tt(g,o),tt(g,i)},onBeforeAppear(g){wt(W,[g]),tt(g,a),tt(g,f)},onEnter:M(!1),onAppear:M(!0),onLeave(g,C){g._isLeaving=!0;const I=()=>J(g,C);tt(g,h),g._enterCancelled?(tt(g,x),Eo(g)):(Eo(g),tt(g,x)),_o(()=>{g._isLeaving&&(yt(g,h),tt(g,_),xo(y)||Co(g,r,q,I))}),wt(y,[g,I])},onEnterCancelled(g){H(g,!1,void 0,!0),wt(j,[g])},onAppearCancelled(g){H(g,!0,void 0,!0),wt(he,[g])},onLeaveCancelled(g){J(g),wt(O,[g])}})}function sa(e){if(e==null)return null;if(X(e))return[kr(e.enter),kr(e.leave)];{const t=kr(e);return[t,t]}}function kr(e){return Gn(e)}function tt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Qt]||(e[Qt]=new Set)).add(t)}function yt(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Qt];n&&(n.delete(t),n.size||(e[Qt]=void 0))}function _o(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let oa=0;function Co(e,t,n,r){const s=e._endId=++oa,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:l,propCount:a}=ia(e,t);if(!i)return r();const f=i+"end";let u=0;const h=()=>{e.removeEventListener(f,x),o()},x=_=>{_.target===e&&++u>=a&&h()};setTimeout(()=>{u<a&&h()},l+1),e.addEventListener(f,x)}function ia(e,t){const n=window.getComputedStyle(e),r=$=>(n[$]||"").split(", "),s=r(`${ct}Delay`),o=r(`${ct}Duration`),i=So(s,o),l=r(`${Zt}Delay`),a=r(`${Zt}Duration`),f=So(l,a);let u=null,h=0,x=0;t===ct?i>0&&(u=ct,h=i,x=o.length):t===Zt?f>0&&(u=Zt,h=f,x=a.length):(h=Math.max(i,f),u=h>0?i>f?ct:Zt:null,x=u?u===ct?o.length:a.length:0);const _=u===ct&&/\b(?:transform|all)(?:,|$)/.test(r(`${ct}Property`).toString());return{type:u,timeout:h,propCount:x,hasTransform:_}}function So(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>To(n)+To(e[r])))}function To(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Eo(e){return(e?e.ownerDocument:document).body.offsetHeight}function la(e,t,n){const r=e[Qt];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const $n=Symbol("_vod"),ko=Symbol("_vsh"),Ao={name:"show",beforeMount(e,{value:t},{transition:n}){e[$n]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):en(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),en(e,!0),r.enter(e)):r.leave(e,()=>{en(e,!1)}):en(e,t))},beforeUnmount(e,{value:t}){en(e,t)}};function en(e,t){e.style.display=t?e[$n]:"none",e[ko]=!t}const aa=Symbol(""),ca=/(?:^|;)\s*display\s*:/;function ua(e,t,n){const r=e.style,s=le(n);let o=!1;if(n&&!s){if(t)if(le(t))for(const i of t.split(";")){const l=i.slice(0,i.indexOf(":")).trim();n[l]==null&&Ln(r,l,"")}else for(const i in t)n[i]==null&&Ln(r,i,"");for(const i in n)i==="display"&&(o=!0),Ln(r,i,n[i])}else if(s){if(t!==n){const i=r[aa];i&&(n+=";"+i),r.cssText=n,o=ca.test(n)}}else t&&e.removeAttribute("style");$n in e&&(e[$n]=o?r.display:"",e[ko]&&(r.display="none"))}const Oo=/\s*!important$/;function Ln(e,t,n){if(P(n))n.forEach(r=>Ln(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=fa(e,t);Oo.test(n)?e.setProperty(ke(r),n.replace(Oo,""),"important"):e[r]=n}}const Mo=["Webkit","Moz","ms"],Ar={};function fa(e,t){const n=Ar[t];if(n)return n;let r=Ie(t);if(r!=="filter"&&r in e)return Ar[t]=r;r=Hr(r);for(let s=0;s<Mo.length;s++){const o=Mo[s]+r;if(o in e)return Ar[t]=o}return t}const Io="http://www.w3.org/1999/xlink";function Ro(e,t,n,r,s,o=si(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Io,t.slice(6,t.length)):e.setAttributeNS(Io,t,n):n==null||o&&!zr(n)?e.removeAttribute(t):e.setAttribute(t,o?"":Ne(n)?String(n):n)}function jo(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?wo(n):n);return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){const l=o==="OPTION"?e.getAttribute("value")||"":e.value,a=n==null?e.type==="checkbox"?"on":"":String(n);(l!==a||!("_value"in e))&&(e.value=a),n==null&&e.removeAttribute(t),e._value=n;return}let i=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=zr(n):n==null&&l==="string"?(n="",i=!0):l==="number"&&(n=0,i=!0)}try{e[t]=n}catch{}i&&e.removeAttribute(s||t)}function Mt(e,t,n,r){e.addEventListener(t,n,r)}function da(e,t,n,r){e.removeEventListener(t,n,r)}const Fo=Symbol("_vei");function ha(e,t,n,r,s=null){const o=e[Fo]||(e[Fo]={}),i=o[t];if(r&&i)i.value=r;else{const[l,a]=pa(t);if(r){const f=o[t]=ba(r,s);Mt(e,l,f,a)}else i&&(da(e,l,i,a),o[t]=void 0)}}const Po=/(?:Once|Passive|Capture)$/;function pa(e){let t;if(Po.test(e)){t={};let r;for(;r=e.match(Po);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ke(e.slice(2)),t]}let Or=0;const ga=Promise.resolve(),ma=()=>Or||(ga.then(()=>Or=0),Or=Date.now());function ba(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Fe(wa(r,n.value),t,5,[r])};return n.value=e,n.attached=ma(),n}function wa(e,t){if(P(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const No=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,ya=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?la(e,r,i):t==="style"?ua(e,n,r):ln(t)?Vn(t)||ha(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):va(e,t,r,i))?(jo(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ro(e,t,r,i,o,t!=="value")):e._isVueCE&&(/[A-Z]/.test(t)||!le(r))?jo(e,Ie(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Ro(e,t,r,i))};function va(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&No(t)&&L(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return No(t)&&le(n)?!1:t in e}const $o={};function xa(e,t,n){let r=At(e,t);an(r)&&(r=ie({},r,t));class s extends Mr{constructor(i){super(r,i,n)}}return s.def=r,s}const _a=typeof HTMLElement<"u"?HTMLElement:class{};class Mr extends _a{constructor(t,n={},r=Vo){super(),this._def=t,this._props=n,this._createApp=r,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._ob=null,this.shadowRoot&&r!==Vo?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(ie({},t.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;!this.shadowRoot&&!this._resolved&&this._parseSlots(),this._connected=!0;let t=this;for(;t=t&&(t.parentNode||t.host);)if(t instanceof Mr){this._parent=t;break}this._instance||(this._resolved?this._mount(this._def):t&&t._pendingResolve?this._pendingResolve=t._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(t=this._parent){t&&(this._instance.parent=t._instance,this._inheritParentContext(t))}_inheritParentContext(t=this._parent){t&&this._app&&Object.setPrototypeOf(this._app._context.provides,t._instance.provides)}disconnectedCallback(){this._connected=!1,kt(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(t){for(const n of t)this._setAttr(n.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let r=0;r<this.attributes.length;r++)this._setAttr(this.attributes[r].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});const t=(r,s=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:o,styles:i}=r;let l;if(o&&!P(o))for(const a in o){const f=o[a];(f===Number||f&&f.type===Number)&&(a in this._props&&(this._props[a]=Gn(this._props[a])),(l||(l=Object.create(null)))[Ie(a)]=!0)}this._numberProps=l,this._resolveProps(r),this.shadowRoot&&this._applyStyles(i),this._mount(r)},n=this._def.__asyncLoader;n?this._pendingResolve=n().then(r=>{r.configureApp=this._def.configureApp,t(this._def=r,!0)}):t(this._def)}_mount(t){this._app=this._createApp(t),this._inheritParentContext(),t.configureApp&&t.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const n=this._instance&&this._instance.exposed;if(n)for(const r in n)G(this,r)||Object.defineProperty(this,r,{get:()=>Je(n[r])})}_resolveProps(t){const{props:n}=t,r=P(n)?n:Object.keys(n||{});for(const s of Object.keys(this))s[0]!=="_"&&r.includes(s)&&this._setProp(s,this[s]);for(const s of r.map(Ie))Object.defineProperty(this,s,{get(){return this._getProp(s)},set(o){this._setProp(s,o,!0,!this._patching)}})}_setAttr(t){if(t.startsWith("data-v-"))return;const n=this.hasAttribute(t);let r=n?this.getAttribute(t):$o;const s=Ie(t);n&&this._numberProps&&this._numberProps[s]&&(r=Gn(r)),this._setProp(s,r,!1,!0)}_getProp(t){return this._props[t]}_setProp(t,n,r=!0,s=!1){if(n!==this._props[t]&&(this._dirty=!0,n===$o?delete this._props[t]:(this._props[t]=n,t==="key"&&this._app&&(this._app._ceVNode.key=n)),s&&this._instance&&this._update(),r)){const o=this._ob;o&&(this._processMutations(o.takeRecords()),o.disconnect()),n===!0?this.setAttribute(ke(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(ke(t),n+""):n||this.removeAttribute(ke(t)),o&&o.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),Ea(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=ae(this._def,ie(t,this._props));return this._instance||(n.ce=r=>{this._instance=r,r.ce=this,r.isCE=!0;const s=(o,i)=>{this.dispatchEvent(new CustomEvent(o,an(i[0])?ie({detail:i},i[0]):{detail:i}))};r.emit=(o,...i)=>{s(o,i),ke(o)!==o&&s(ke(o),i)},this._setParent()}),n}_applyStyles(t,n){if(!t)return;if(n){if(n===this._def||this._styleChildren.has(n))return;this._styleChildren.add(n)}const r=this._nonce;for(let s=t.length-1;s>=0;s--){const o=document.createElement("style");r&&o.setAttribute("nonce",r),o.textContent=t[s],this.shadowRoot.prepend(o)}}_parseSlots(){const t=this._slots={};let n;for(;n=this.firstChild;){const r=n.nodeType===1&&n.getAttribute("slot")||"default";(t[r]||(t[r]=[])).push(n),this.removeChild(n)}}_renderSlots(){const t=this._getSlots(),n=this._instance.type.__scopeId;for(let r=0;r<t.length;r++){const s=t[r],o=s.getAttribute("name")||"default",i=this._slots[o],l=s.parentNode;if(i)for(const a of i){if(n&&a.nodeType===1){const f=n+"-s",u=document.createTreeWalker(a,1);a.setAttribute(f,"");let h;for(;h=u.nextNode();)h.setAttribute(f,"")}l.insertBefore(a,s)}else for(;s.firstChild;)l.insertBefore(s.firstChild,s);l.removeChild(s)}}_getSlots(){const t=[this];this._teleportTargets&&t.push(...this._teleportTargets);const n=new Set;for(const r of t){const s=r.querySelectorAll("slot");for(let o=0;o<s.length;o++)n.add(s[o])}return Array.from(n)}_injectChildStyle(t){this._applyStyles(t.styles,t)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return this._def.shadowRoot!==!1}_removeChildStyle(t){}}const Lo=e=>{const t=e.props["onUpdate:modelValue"]||!1;return P(t)?n=>un(t,n):t};function Ca(e){e.target.composing=!0}function Do(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Ir=Symbol("_assign");function Uo(e,t,n){return t&&(e=e.trim()),n&&(e=Yn(e)),e}const Sa={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Ir]=Lo(s);const o=r||s.props&&s.props.type==="number";Mt(e,t?"change":"input",i=>{i.target.composing||e[Ir](Uo(e.value,n,o))}),(n||o)&&Mt(e,"change",()=>{e.value=Uo(e.value,n,o)}),t||(Mt(e,"compositionstart",Ca),Mt(e,"compositionend",Do),Mt(e,"change",Do))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[Ir]=Lo(i),e.composing)return;const l=(o||e.type==="number")&&!/^0\d/.test(e.value)?Yn(e.value):e.value,a=t??"";l!==a&&(document.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===a)||(e.value=a))}},Ta=ie({patchProp:ya},ea);let Bo;function Ho(){return Bo||(Bo=Al(Ta))}const Ea=(...e)=>{Ho().render(...e)},Vo=(...e)=>{const t=Ho().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=Aa(r);if(!s)return;const o=t._component;!L(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,ka(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t};function ka(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Aa(e){return le(e)?document.querySelector(e):e}const Oa={class:"typing-indicator flex items-center gap-1 py-2"},Ma={class:"flex gap-0.5"},Ia=((e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n})(At({__name:"TypingIndicator",setup(e){return(t,n)=>(ne(),se("div",Oa,[n[0]||(n[0]=A("span",{class:"text-xs text-gray-500"},"Admin is typing",-1)),A("span",Ma,[(ne(),se(me,null,Ps(3,r=>A("span",{key:r,class:"w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce",style:dn({animationDelay:`${(r-1)*150}ms`})},null,4)),64))])]))}}),[["styles",["@keyframes bounce-d427c516{0%,60%,to{transform:translateY(0)}30%{transform:translateY(-4px)}}.animate-bounce[data-v-d427c516]{animation:bounce-d427c516 1s infinite}"]],["__scopeId","data-v-d427c516"]]);async function Ra(e,t={}){const{filename:n}=t;try{const r=await fetch(e);if(!r.ok)throw new Error(`HTTP error: ${r.status}`);const s=await r.blob(),o=URL.createObjectURL(s),i=document.createElement("a");i.href=o,i.download=n||ja(e)||"download",i.rel="noopener noreferrer",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}catch(r){console.warn("[Download] Fetch failed, falling back to open in new tab:",r instanceof Error?r.message:"Unknown error"),Fa(e)}}function ja(e){try{const r=new URL(e).pathname.split("/"),s=r[r.length-1];return s&&s.split("?")[0]||null}catch{return null}}function Fa(e){const t=document.createElement("a");t.href=e,t.target="_blank",t.rel="noopener noreferrer",document.body.appendChild(t),t.click(),document.body.removeChild(t)}const Pa={class:"message-list flex-1 overflow-y-auto p-4 space-y-3"},Na={key:0,class:"text-center text-gray-400 py-8"},$a={key:0,class:"text-[11px] font-bold text-gray-400 uppercase tracking-widest text-center px-6"},La={key:0,class:"whitespace-pre-wrap"},Da={key:1,class:"mt-2"},Ua=["href"],Ba=["src"],Ha={class:"flex gap-2 mt-1"},Va=["href"],Wa=["onClick"],za={class:"flex-1 min-w-0"},Ka={class:"flex gap-1"},Ya=["onClick"],Ga=["href"],qa={key:2,class:"flex justify-start"},Ja={class:"bg-gray-100 rounded-2xl rounded-bl-md px-4 py-2"},Xa=At({__name:"MessageList",props:{messages:{type:Array},showTyping:{type:Boolean}},setup(e,{expose:t}){const n=e,r=Ce(null);function s(f){if(!f)return!1;const u=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],h=f.toLowerCase();return u.some(x=>h.includes(x))||f.includes("image/")}function o(f){if(!f)return"File";try{const x=new URL(f).pathname.split("/"),_=x[x.length-1];return _&&_.split("?")[0]||"File"}catch{return"File"}}async function i(f){f&&await Ra(f)}function l(f){const u=f.target;u.style.display="none"}function a(){kt(()=>{var f;(f=r.value)==null||f.scrollIntoView({behavior:"smooth"})})}return lt(()=>n.messages.length,()=>{a()}),lt(()=>n.showTyping,()=>{a()}),t({scrollToBottom:a}),(f,u)=>(ne(),se("div",Pa,[e.messages.length===0?(ne(),se("div",Na,[...u[0]||(u[0]=[A("p",{class:"text-sm"},"No messages yet.",-1),A("p",{class:"text-xs mt-1"},"Start a conversation!",-1)])])):(ne(!0),se(me,{key:1},Ps(e.messages,h=>(ne(),se("div",{key:h.id,class:ue(["message-row flex w-full",[h.sender==="user"?"justify-end":"justify-start",h.sender==="system"?"justify-center py-2":""]])},[h.sender==="system"?(ne(),se("div",$a,ft(h.content),1)):(ne(),se("div",{key:1,class:ue(["message-bubble max-w-[80%] px-4 py-2 rounded-2xl text-sm break-words",h.sender==="user"?"bg-blue-500 text-white rounded-br-md":"bg-gray-100 text-gray-800 rounded-bl-md"])},[h.content?(ne(),se("p",La,ft(h.content),1)):qt("",!0),h.attachmentUrl?(ne(),se("div",Da,[s(h.attachmentUrl)?(ne(),se(me,{key:0},[A("a",{href:h.attachmentUrl,target:"_blank",rel:"noopener noreferrer",class:"block"},[A("img",{src:h.attachmentUrl,alt:"Attachment",class:"max-w-full rounded-lg border-0 cursor-pointer hover:opacity-90 transition-opacity max-h-48 object-cover",onError:l},null,40,Ba)],8,Ua),A("div",Ha,[A("a",{href:h.attachmentUrl,target:"_blank",rel:"noopener noreferrer",class:ue(["text-xs underline hover:no-underline",h.sender==="user"?"text-blue-100":"text-blue-600"])}," Open in new tab ",10,Va),A("button",{class:ue(["text-xs underline hover:no-underline",h.sender==="user"?"text-blue-100":"text-blue-600"]),onClick:x=>i(h.attachmentUrl)}," Download ",10,Wa)])],64)):(ne(),se("div",{key:1,class:ue(["flex items-center gap-3 p-2 rounded-lg border",h.sender==="user"?"border-blue-400/30 bg-blue-600/20":"border-gray-200 bg-gray-50"])},[A("div",{class:ue(["w-10 h-10 rounded-lg flex items-center justify-center",h.sender==="user"?"bg-blue-400/30":"bg-gray-200"])},[(ne(),se("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:ue(h.sender==="user"?"text-blue-100":"text-gray-500")},[...u[1]||(u[1]=[A("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"},null,-1),A("polyline",{points:"14 2 14 8 20 8"},null,-1)])],2))],2),A("div",za,[A("p",{class:ue(["text-xs font-medium truncate",h.sender==="user"?"text-blue-50":"text-gray-700"])},ft(o(h.attachmentUrl)),3)]),A("div",Ka,[A("button",{class:ue(["p-1.5 rounded hover:bg-black/10 transition-colors",h.sender==="user"?"text-blue-100":"text-gray-500"]),title:"Download",onClick:x=>i(h.attachmentUrl)},[...u[2]||(u[2]=[A("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[A("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),A("polyline",{points:"7 10 12 15 17 10"}),A("line",{x1:"12",y1:"15",x2:"12",y2:"3"})],-1)])],10,Ya),A("a",{href:h.attachmentUrl,target:"_blank",rel:"noopener noreferrer",class:ue(["p-1.5 rounded hover:bg-black/10 transition-colors",h.sender==="user"?"text-blue-100":"text-gray-500"]),title:"Open in new tab"},[...u[3]||(u[3]=[A("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[A("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),A("polyline",{points:"15 3 21 3 21 9"}),A("line",{x1:"10",y1:"14",x2:"21",y2:"3"})],-1)])],10,Ga)])],2))])):qt("",!0)],2))],2))),128)),e.showTyping?(ne(),se("div",qa,[A("div",Ja,[ae(Ia)])])):qt("",!0),A("div",{ref_key:"scrollAnchor",ref:r,class:"scroll-anchor h-0"},null,512)]))}}),Za={class:"message-input border-t border-gray-200 p-3"},Qa={key:0,class:"mb-2 flex items-center gap-2 p-2 bg-gray-50 rounded-lg"},ec={class:"text-sm text-gray-600 truncate flex-1"},tc={class:"flex items-end gap-2"},nc=["disabled"],rc=["disabled","placeholder"],sc=["disabled","aria-label"],oc={class:"flex items-center justify-between mt-1.5 px-1"},ic={class:"text-xs text-gray-400"},lc={key:0},ac={key:1},Rr=2500,cc=At({__name:"MessageInput",props:{isEnabled:{type:Boolean}},emits:["send","typing","upload"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=Ce(""),i=Ce(null),l=Ce(null),a=Ce(null),f=Te(()=>o.value.length),u=Te(()=>f.value>Rr),h=Te(()=>{const y=o.value.trim();return r.isEnabled&&(y.length>0||a.value!==null)&&y.length<=Rr}),x=Te(()=>r.isEnabled?"Type a message...":"Waiting for connection...");function _(){var y;(y=l.value)==null||y.click()}function $(y){var ce;const O=y.target,W=(ce=O.files)==null?void 0:ce[0];if(W){if(W.size>10*1024*1024){alert("File size must be less than 10MB");return}a.value=W}O.value=""}function R(){a.value=null}function q(){const y=i.value;if(!y)return;y.style.height="auto";const O=Math.min(y.scrollHeight,120);y.style.height=`${O}px`,r.isEnabled&&s("typing")}function V(y){y.key==="Enter"&&!y.shiftKey&&!y.isComposing&&(y.preventDefault(),h.value&&D())}function D(){const y=o.value.trim(),O=a.value;r.isEnabled&&(O&&(s("upload",O),a.value=null),y&&s("send",y),o.value="",kt(()=>{const W=i.value;W&&(W.style.height="auto")}))}function j(){var y;(y=i.value)==null||y.focus()}return t({focus:j}),(y,O)=>(ne(),se("div",Za,[A("input",{ref_key:"fileInputRef",ref:l,type:"file",class:"hidden",accept:"image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,application/msword,.doc,.docx",onChange:$},null,544),a.value?(ne(),se("div",Qa,[O[2]||(O[2]=A("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-gray-500"},[A("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),A("polyline",{points:"14 2 14 8 20 8"})],-1)),A("span",ec,ft(a.value.name),1),A("button",{type:"button",class:"text-gray-400 hover:text-gray-600 p-1",onClick:R},[...O[1]||(O[1]=[A("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[A("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),A("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])):qt("",!0),A("div",tc,[A("button",{disabled:!e.isEnabled,class:ue(["flex items-center justify-center w-10 h-10 text-gray-500 hover:text-gray-700 rounded-full transition-colors disabled:text-gray-300 disabled:cursor-not-allowed",{"hover:bg-gray-100":e.isEnabled}]),"aria-label":"Attach file",onClick:_},[...O[3]||(O[3]=[A("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"},[A("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})],-1)])],10,nc),dr(A("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":O[0]||(O[0]=W=>o.value=W),disabled:!e.isEnabled,placeholder:x.value,class:ue(["flex-1 min-h-[44px] max-h-[120px] px-3 py-2.5 text-sm border border-gray-300 rounded-xl resize-none outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-100 disabled:text-gray-400",{"border-red-400 focus:border-red-500 focus:ring-red-500":u.value}]),rows:"1",onKeydown:V,onInput:q},null,42,rc),[[Sa,o.value]]),A("button",{disabled:!h.value,class:"send-button flex items-center justify-center w-10 h-10 bg-blue-500 text-white rounded-full transition-all hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2","aria-label":e.isEnabled?"Send message":"Cannot send message",onClick:D},[...O[4]||(O[4]=[A("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[A("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),A("polygon",{points:"22 2 15 22 11 13 2 9"})],-1)])],8,sc)]),A("div",oc,[A("p",ic,[e.isEnabled?(ne(),se("span",lc,"Press Enter to send, Shift+Enter for new line")):(ne(),se("span",ac,"Connecting..."))]),e.isEnabled&&f.value>0?(ne(),se("div",{key:0,class:ue(["text-[10px] font-bold uppercase tracking-widest px-2 py-0.5 rounded-md transition-colors",u.value?"bg-red-50 text-red-500":"bg-gray-100 text-gray-400"])},ft(f.value)+" / "+ft(Rr),3)):qt("",!0)])]))}}),uc={class:"chat-window flex flex-col h-full bg-white rounded-xl shadow-lg overflow-hidden"},fc={class:"flex items-center justify-between px-4 py-3 bg-gradient-to-br from-blue-500 to-blue-600 text-white shrink-0"},dc={key:0,class:"flex-1 flex flex-col items-center justify-center p-8"},hc={key:1,class:"flex-1 flex flex-col items-center justify-center p-8"},pc=At({__name:"ChatWindow",props:{status:{type:String},messages:{type:Array},adminTyping:{type:Boolean},isVisible:{type:Boolean}},emits:["close","retry","send","typing","upload"],setup(e,{emit:t}){const n=e,r=t,s=Ce(null),o=Te(()=>n.status==="connecting"),i=Te(()=>n.status==="connected"),l=Te(()=>n.status==="error");return lt(()=>n.status,a=>{a==="connected"&&kt(()=>{var f;(f=s.value)==null||f.scrollToBottom()})}),lt(()=>n.isVisible,a=>{a&&kt(()=>{var f;(f=s.value)==null||f.scrollToBottom()})}),(a,f)=>(ne(),se("div",uc,[A("div",fc,[f[6]||(f[6]=A("div",{class:"flex items-center gap-2"},[A("div",{class:"w-2 h-2 rounded-full bg-green-400"}),A("h2",{class:"text-base font-semibold"},"Support Chat")],-1)),A("button",{class:"flex items-center justify-center w-8 h-8 bg-white/20 border-0 text-white rounded-full cursor-pointer transition-colors hover:bg-white/30 focus:outline-none focus:ring-2 focus:ring-white/50","aria-label":"Close chat",onClick:f[0]||(f[0]=u=>r("close"))},[...f[5]||(f[5]=[A("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"},[A("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),A("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),o.value?(ne(),se("div",dc,[...f[7]||(f[7]=[A("div",{class:"w-10 h-10 border-4 border-blue-200 border-t-blue-500 rounded-full animate-spin mb-4"},null,-1),A("p",{class:"text-gray-600 text-sm"},"Connecting to support...",-1)])])):l.value?(ne(),se("div",hc,[f[8]||(f[8]=co('<div class="w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mb-4"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg></div><p class="text-gray-800 font-medium mb-1">Connection failed</p><p class="text-gray-500 text-sm text-center mb-4"> Unable to connect to support. Please check your connection and try again. </p>',3)),A("button",{class:"px-4 py-2 bg-blue-500 text-white text-sm font-medium rounded-lg transition-colors hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",onClick:f[1]||(f[1]=u=>r("retry"))}," Try Again ")])):(ne(),se(me,{key:2},[ae(Xa,{ref_key:"messageListRef",ref:s,messages:e.messages,"show-typing":e.adminTyping},null,8,["messages","show-typing"]),ae(cc,{"is-enabled":i.value,onSend:f[2]||(f[2]=u=>r("send",u)),onTyping:f[3]||(f[3]=u=>r("typing")),onUpload:f[4]||(f[4]=u=>r("upload",u))},null,8,["is-enabled"])],64))]))}}),Dn={initialDelay:1e3,maxDelay:3e4,multiplier:2,maxFailures:5};function gc(e={}){const t=Ce("disconnected"),n=Ce(null);let r=null,s=null,o=0,i=null,l=!1;function a(j){if(e.wsUrl){const W=new URL(e.wsUrl);return W.searchParams.set("jwt",j),W.toString()}const y=window.location.protocol==="https:"?"wss:":"ws:",O=window.location.host;return`${y}//${O}/ws?jwt=${encodeURIComponent(j)}`}function f(){const j=Dn.initialDelay*Math.pow(Dn.multiplier,o);return Math.min(j,Dn.maxDelay)}function u(){if(l)return;if(o>=Dn.maxFailures){t.value="error",n.value="Max reconnection attempts reached";return}const j=f();o++,i=setTimeout(()=>{!l&&s&&q(s)},j)}function h(){i&&(clearTimeout(i),i=null)}function x(){var j;t.value="connected",n.value=null,o=0,(j=e.onOpen)==null||j.call(e)}function _(j){var y;try{const O=JSON.parse(j.data);typeof O.event=="string"&&O.timestamp!==void 0&&typeof O.timestamp=="number"?(y=e.onMessage)==null||y.call(e,O):console.warn("[WebSocket] Received invalid envelope shape:",O)}catch{console.warn("[WebSocket] Received non-JSON message:",j.data)}}function $(j){var y;r=null,t.value="disconnected",(y=e.onClose)==null||y.call(e,j),l||u()}function R(j){var y;t.value="error",n.value="WebSocket error occurred",(y=e.onError)==null||y.call(e,j)}function q(j){if(!((r==null?void 0:r.readyState)===WebSocket.OPEN||(r==null?void 0:r.readyState)===WebSocket.CONNECTING)){h(),s=j,l=!1,t.value="connecting",n.value=null;try{const y=a(j);r=new WebSocket(y),r.addEventListener("open",x),r.addEventListener("message",_),r.addEventListener("close",$),r.addEventListener("error",R)}catch(y){t.value="error",n.value=y instanceof Error?y.message:"Failed to create WebSocket",u()}}}function V(j,y){if(!r||r.readyState!==WebSocket.OPEN)return!1;const O={event:j,data:y,timestamp:Math.floor(Date.now()/1e3)};try{return r.send(JSON.stringify(O)),!0}catch(W){return console.error("[WebSocket] Failed to send message:",W),!1}}function D(){l=!0,h(),r&&(r.removeEventListener("open",x),r.removeEventListener("message",_),r.removeEventListener("close",$),r.removeEventListener("error",R),(r.readyState===WebSocket.OPEN||r.readyState===WebSocket.CONNECTING)&&r.close(),r=null),t.value="disconnected",s=null,o=0}return{status:Lt(t),lastError:Lt(n),connect:q,send:V,disconnect:D}}function Un(e){try{const t=e.split(".");if(t.length!==3)return null;const n=t[1];if(!n)return null;const r=n+"=".repeat((4-n.length%4)%4),s=atob(r.replace(/-/g,"+").replace(/_/g,"/")),o=JSON.parse(s);return!o.platform_id||!o.external_user_id?null:{platform_id:o.platform_id,external_user_id:o.external_user_id}}catch{return null}}const mc="tvs_support_chat_id";function jr(e,t){return`${mc}:${e}:${t}`}function bc(e,t){try{const n=jr(e,t);return localStorage.getItem(n)}catch{return null}}function Fr(e,t,n){try{const r=jr(e,t);return localStorage.setItem(r,n),!0}catch{return!1}}function tn(e,t){try{const n=jr(e,t);return localStorage.removeItem(n),!0}catch{return!1}}function wc(e){const t=e.apiBaseUrl??"",n=Ce(null),r=Ce([]),s=Ce(!1),o=Ce(null),i=gc({onMessage:$,onOpen:()=>{o.value=null},onError:()=>{o.value="Connection error. Retrying..."},onClose:M=>{M.wasClean||(o.value="Connection lost. Reconnecting...")},wsUrl:e.wsUrl}),l=Te(()=>{switch(i.status.value){case"connecting":return"connecting";case"connected":return"connected";case"error":return"error";case"disconnected":return r.value.length>0?"error":"connecting";default:return"connecting"}}),a=Te(()=>l.value==="connected"),f=Te(()=>l.value==="connecting"),u=Te(()=>l.value==="error");let h=null;const x=300;function _(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function $(M){switch(M.event){case"server:message":{const g=M.data;if(!n.value){const C=Un(e.jwt),I=(C==null?void 0:C.platform_id)??"",B=(C==null?void 0:C.external_user_id)??"";n.value=g.chat_id,I&&B&&Fr(I,B,g.chat_id)}if(g.chat_id!==n.value)return;if(g.sender_type==="admin"&&(r.value.push({id:_(),sender:"admin",content:g.content??"",attachmentUrl:g.attachment_url,createdAt:new Date(g.created_at*1e3)}),s.value=!1),g.sender_type==="user"){let C=-1;for(let I=r.value.length-1;I>=0;I--){const B=r.value[I];if(B&&B.sender==="user"){const Z=!!g.attachment_url&&B.content===""&&B.attachmentUrl===null,z=!g.attachment_url&&B.content===g.content;if(Z||z){C=I;break}}}if(C!==-1){const I=r.value[C];I&&(I.attachmentUrl=g.attachment_url,I.createdAt=new Date(g.created_at*1e3))}else r.value.push({id:_(),sender:"user",content:g.content??"",attachmentUrl:g.attachment_url,createdAt:new Date(g.created_at*1e3)})}break}case"server:error":{const g=M.data;console.error("[Chat] Server error:",g),o.value=g.message||"An error occurred";break}case"server:chat_assigned":{M.data.chat_id===n.value&&r.value.push({id:_(),sender:"system",content:"TVS Agent joined the chat",createdAt:new Date});break}case"server:chat_closed":{if(M.data.chat_id===n.value){r.value.push({id:_(),sender:"system",content:"Chat ended",createdAt:new Date});const C=Un(e.jwt),I=(C==null?void 0:C.platform_id)??"",B=(C==null?void 0:C.external_user_id)??"";setTimeout(()=>{I&&B&&tn(I,B),n.value=null,r.value=[],s.value=!1},3e3)}break}}}async function R(){var M,g;try{const C=await fetch(`${t}/api/chats`,{method:"POST",headers:{Authorization:`Bearer ${e.jwt}`,"Content-Type":"application/json"}});if(!C.ok){const B=await C.json().catch(()=>({}));throw new Error(((M=B.error)==null?void 0:M.message)||"Failed to create chat")}return((g=(await C.json()).data)==null?void 0:g.id)??null}catch(C){return console.error("[Chat] Failed to create chat:",C),o.value=C instanceof Error?C.message:"Failed to create chat",null}}async function q(M){try{const g=await fetch(`${t}/api/chats/${M}`,{method:"GET",headers:{Authorization:`Bearer ${e.jwt}`,"Content-Type":"application/json"}});if(g.status===403||g.status===404)return{notFound:!0};if(!g.ok)return null;const C=await g.json();return!C.ok||!C.data?{notFound:!0}:C.data}catch{return null}}async function V(){try{const M=await fetch(`${t}/api/chats?limit=20&offset=0`,{method:"GET",headers:{Authorization:`Bearer ${e.jwt}`,"Content-Type":"application/json"}});if(!M.ok)return null;const g=await M.json();if(!g.ok||!g.data)return null;const I=g.data.find(B=>B.status==="open"||B.status==="escalated");return I?{id:I.id,status:I.status}:null}catch{return null}}async function D(M){var g;try{const C=await fetch(`${t}/api/chats/${M}/messages?limit=50&offset=0`,{method:"GET",headers:{Authorization:`Bearer ${e.jwt}`,"Content-Type":"application/json"}});if(C.status===403||C.status===404)return{notFound:!0};if(!C.ok)return null;const I=await C.json();return!I.ok||!((g=I.data)!=null&&g.messages)?{notFound:!0}:I.data.messages.map(B=>({id:B.id,content:B.content??"",attachmentUrl:B.attachment_url,sender:B.sender_type,createdAt:new Date(B.created_at*1e3)}))}catch{return null}}async function j(){const M=Un(e.jwt),g=(M==null?void 0:M.platform_id)??"",C=(M==null?void 0:M.external_user_id)??"";if(!g||!C)return y("","");const I=bc(g,C);if(!I)return null;const B=await q(I);if(B===null){n.value=I;const z=await D(I);return z&&"notFound"in z?(tn(g,C),null):(r.value=z??[],I)}if("notFound"in B||B.status==="closed")return tn(g,C),null;n.value=I;const Z=await D(I);return Z&&"notFound"in Z?(tn(g,C),null):(r.value=Z??[],I)}async function y(M,g){const C=await R();return C?(n.value=C,M&&g&&Fr(M,g,C),C):null}async function O(){i.status.value==="connected"||i.status.value==="connecting"||(await j(),i.connect(e.jwt))}function W(){o.value=null,O()}function ce(){!n.value||!a.value||(h&&clearTimeout(h),h=setTimeout(()=>{i.send("client:typing",{chat_id:n.value})},x))}async function he(M){const g=M.trim();if(!g||!a.value)return;if(!n.value){const I=Un(e.jwt),B=(I==null?void 0:I.platform_id)??"",Z=(I==null?void 0:I.external_user_id)??"",z=await V();if(z)n.value=z.id,B&&Z&&Fr(B,Z,z.id);else if(!await y(B,Z)){o.value="Failed to start a new chat session";return}}r.value.push({id:_(),sender:"user",content:g,createdAt:new Date}),s.value=!1,i.send("client:message_send",{chat_id:n.value,content:g})||(r.value.pop(),o.value="Failed to send message")}async function H(M){var g;if(!a.value||!n.value){o.value="Not connected to chat";return}try{const C=await fetch(`${t}/api/chats/${n.value}/attachments/upload-url`,{method:"POST",headers:{Authorization:`Bearer ${e.jwt}`,"Content-Type":"application/json"},body:JSON.stringify({filename:M.name,contentType:M.type,size:M.size})});if(!C.ok){const nt=await C.json().catch(()=>({}));throw new Error(((g=nt.error)==null?void 0:g.message)||"Failed to get upload URL")}const I=await C.json(),{uploadUrl:B,fileKey:Z}=I.data;if(!(await fetch(B,{method:"PUT",headers:{"Content-Type":M.type},body:M})).ok)throw new Error("Failed to upload file");const Q=_();if(r.value.push({id:Q,sender:"user",content:"",createdAt:new Date,attachmentUrl:null}),s.value=!1,!i.send("client:message_send",{chat_id:n.value,content:"",attachment_key:Z})){const nt=r.value.findIndex(rt=>rt.id===Q);nt!==-1&&r.value.splice(nt,1),o.value="Failed to send attachment"}}catch(C){console.error("[Chat] Failed to upload file:",C),o.value=C instanceof Error?C.message:"Failed to upload file"}}function J(){h&&(clearTimeout(h),h=null),i.disconnect()}return kn(J),{status:l,messages:r,adminTyping:s,chatId:n,errorMessage:o,isConnected:a,isConnecting:f,isError:u,connect:O,retry:W,sendMessage:he,sendTyping:ce,uploadFile:H,cleanup:J}}const yc={class:"support-client-widget font-sans"},vc={key:0,class:"bg-red-50 border border-red-200 rounded-lg p-4 text-center max-w-[350px]"},Wo=At({__name:"SupportClientWidget.ce",props:{jwt:{type:String},apiBaseUrl:{type:String},wsUrl:{type:String}},setup(e){const t=e,n=Ce(!1),r=Te(()=>"right-5 bottom-5"),s=wc({jwt:t.jwt,apiBaseUrl:t.apiBaseUrl,wsUrl:t.wsUrl}),o=()=>{n.value=!n.value};return gr(()=>{t.jwt&&s.connect()}),kn(()=>{s.cleanup()}),lt(()=>t.jwt,i=>{i&&s.connect()}),(i,l)=>(ne(),se("div",yc,[e.jwt?(ne(),se(me,{key:1},[ae(na,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"opacity-0 translate-y-4 scale-95","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-95"},{default:vs(()=>[dr(A("div",{class:ue(["fixed chat-panel w-[min(360px,calc(100vw-32px))] h-[min(520px,calc(100vh-120px))] z-[9998]",r.value])},[ae(pc,{status:Je(s).status.value,messages:Je(s).messages.value,"admin-typing":Je(s).adminTyping.value,"is-visible":n.value,onClose:o,onRetry:Je(s).retry,onSend:Je(s).sendMessage,onTyping:Je(s).sendTyping,onUpload:Je(s).uploadFile},null,8,["status","messages","admin-typing","is-visible","onRetry","onSend","onTyping","onUpload"])],2),[[Ao,n.value]])]),_:1}),dr(A("button",{class:ue(["fixed bubble-button w-14 h-14 rounded-full bg-gradient-to-br from-blue-500 to-blue-600 text-white shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 z-[9999] flex items-center justify-center",r.value]),"aria-label":"Open chat",onClick:o},[...l[1]||(l[1]=[A("svg",{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"},[A("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})],-1)])],2),[[Ao,!n.value]])],64)):(ne(),se("div",vc,[...l[0]||(l[0]=[co('<div class="w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-2"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg></div><p class="text-red-600 font-semibold mb-1">Authentication required</p><p class="text-red-800 text-xs"> Please provide a valid JWT token via the <code class="bg-red-100 px-1 py-0.5 rounded font-mono">jwt</code> attribute. </p>',3)])]))]))}}),xc=xa(Wo,{styles:['*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.bottom-5{bottom:1.25rem}.right-5{right:1.25rem}.z-\\[9998\\]{z-index:9998}.z-\\[9999\\]{z-index:9999}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mt-1{margin-top:.25rem}.mt-1\\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.h-0{height:0px}.h-1\\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-8{height:2rem}.h-\\[min\\(520px\\,calc\\(100vh-120px\\)\\)\\]{height:min(520px,calc(100vh - 120px))}.h-full{height:100%}.max-h-48{max-height:12rem}.max-h-\\[120px\\]{max-height:120px}.min-h-\\[44px\\]{min-height:44px}.w-1\\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-8{width:2rem}.w-\\[min\\(360px\\,calc\\(100vw-32px\\)\\)\\]{width:min(360px,calc(100vw - 32px))}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-\\[350px\\]{max-width:350px}.max-w-\\[80\\%\\]{max-width:80%}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-4{--tw-translate-y: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-bl-md{border-bottom-left-radius:.375rem}.rounded-br-md{border-bottom-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-4{border-width:4px}.border-t{border-top-width:1px}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-400\\/30{border-color:#60a5fa4d}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.border-t-blue-500{--tw-border-opacity: 1;border-top-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.bg-blue-400\\/30{background-color:#60a5fa4d}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600\\/20{background-color:#2563eb33}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\\/20{background-color:#fff3}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-1\\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-8{padding-top:2rem;padding-bottom:2rem}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-widest{letter-spacing:.1em}.text-blue-100{--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.text-blue-50{--tw-text-opacity: 1;color:rgb(239 246 255 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring-red-500{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover\\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-black\\/10:hover{background-color:#0000001a}.hover\\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\\:bg-white\\/30:hover{background-color:#ffffff4d}.hover\\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\\:no-underline:hover{text-decoration-line:none}.hover\\:opacity-90:hover{opacity:.9}.hover\\:shadow-xl:hover{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\\:border-red-500:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\\:ring-red-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus\\:ring-white\\/50:focus{--tw-ring-color: rgb(255 255 255 / .5)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-gray-100:disabled{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.disabled\\:bg-gray-300:disabled{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.disabled\\:text-gray-300:disabled{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.disabled\\:text-gray-400:disabled{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}',...Wo.styles||[]]});class Pr extends xc{connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent("ready",{bubbles:!0,composed:!0}))})}disconnectedCallback(){super.disconnectedCallback()}}return customElements.get("support-client-widget")||customElements.define("support-client-widget",Pr),on.SupportClientWidgetElement=Pr,on.default=Pr,Object.defineProperties(on,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),on}({});
20
+ **/let Er;const bo=typeof window<"u"&&window.trustedTypes;if(bo)try{Er=bo.createPolicy("vue",{createHTML:e=>e})}catch{}const wo=Er?e=>Er.createHTML(e):e=>e,Zl="http://www.w3.org/2000/svg",Ql="http://www.w3.org/1998/Math/MathML",et=typeof document<"u"?document:null,yo=et&&et.createElement("template"),ea={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?et.createElementNS(Zl,e):t==="mathml"?et.createElementNS(Ql,e):n?et.createElement(e,{is:n}):et.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>et.createTextNode(e),createComment:e=>et.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>et.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,o){const i=n?n.previousSibling:t.lastChild;if(s&&(s===o||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{yo.innerHTML=wo(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const l=yo.content;if(r==="svg"||r==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}t.insertBefore(l,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},ct="transition",Zt="animation",Qt=Symbol("_vtc"),vo={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},ta=ie({},Ss,vo),na=(e=>(e.displayName="Transition",e.props=ta,e))((e,{slots:t})=>Jl(qi,ra(e),t)),wt=(e,t=[])=>{P(e)?e.forEach(n=>n(...t)):e&&e(...t)},xo=e=>e?P(e)?e.some(t=>t.length>1):e.length>1:!1;function ra(e){const t={};for(const g in e)g in vo||(t[g]=e[g]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:a=o,appearActiveClass:f=i,appearToClass:u=l,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:x=`${n}-leave-active`,leaveToClass:_=`${n}-leave-to`}=e,$=sa(s),R=$&&$[0],q=$&&$[1],{onBeforeEnter:V,onEnter:D,onEnterCancelled:j,onLeave:y,onLeaveCancelled:O,onBeforeAppear:W=V,onAppear:ce=D,onAppearCancelled:he=j}=t,H=(g,C,I,B)=>{g._enterCancelled=B,yt(g,C?u:l),yt(g,C?f:i),I&&I()},J=(g,C)=>{g._isLeaving=!1,yt(g,h),yt(g,_),yt(g,x),C&&C()},M=g=>(C,I)=>{const B=g?ce:D,Z=()=>H(C,g,I);wt(B,[C,Z]),_o(()=>{yt(C,g?a:o),tt(C,g?u:l),xo(B)||Co(C,r,R,Z)})};return ie(t,{onBeforeEnter(g){wt(V,[g]),tt(g,o),tt(g,i)},onBeforeAppear(g){wt(W,[g]),tt(g,a),tt(g,f)},onEnter:M(!1),onAppear:M(!0),onLeave(g,C){g._isLeaving=!0;const I=()=>J(g,C);tt(g,h),g._enterCancelled?(tt(g,x),Eo(g)):(Eo(g),tt(g,x)),_o(()=>{g._isLeaving&&(yt(g,h),tt(g,_),xo(y)||Co(g,r,q,I))}),wt(y,[g,I])},onEnterCancelled(g){H(g,!1,void 0,!0),wt(j,[g])},onAppearCancelled(g){H(g,!0,void 0,!0),wt(he,[g])},onLeaveCancelled(g){J(g),wt(O,[g])}})}function sa(e){if(e==null)return null;if(X(e))return[kr(e.enter),kr(e.leave)];{const t=kr(e);return[t,t]}}function kr(e){return Gn(e)}function tt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Qt]||(e[Qt]=new Set)).add(t)}function yt(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Qt];n&&(n.delete(t),n.size||(e[Qt]=void 0))}function _o(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let oa=0;function Co(e,t,n,r){const s=e._endId=++oa,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:l,propCount:a}=ia(e,t);if(!i)return r();const f=i+"end";let u=0;const h=()=>{e.removeEventListener(f,x),o()},x=_=>{_.target===e&&++u>=a&&h()};setTimeout(()=>{u<a&&h()},l+1),e.addEventListener(f,x)}function ia(e,t){const n=window.getComputedStyle(e),r=$=>(n[$]||"").split(", "),s=r(`${ct}Delay`),o=r(`${ct}Duration`),i=So(s,o),l=r(`${Zt}Delay`),a=r(`${Zt}Duration`),f=So(l,a);let u=null,h=0,x=0;t===ct?i>0&&(u=ct,h=i,x=o.length):t===Zt?f>0&&(u=Zt,h=f,x=a.length):(h=Math.max(i,f),u=h>0?i>f?ct:Zt:null,x=u?u===ct?o.length:a.length:0);const _=u===ct&&/\b(?:transform|all)(?:,|$)/.test(r(`${ct}Property`).toString());return{type:u,timeout:h,propCount:x,hasTransform:_}}function So(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>To(n)+To(e[r])))}function To(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Eo(e){return(e?e.ownerDocument:document).body.offsetHeight}function la(e,t,n){const r=e[Qt];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const $n=Symbol("_vod"),ko=Symbol("_vsh"),Ao={name:"show",beforeMount(e,{value:t},{transition:n}){e[$n]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):en(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),en(e,!0),r.enter(e)):r.leave(e,()=>{en(e,!1)}):en(e,t))},beforeUnmount(e,{value:t}){en(e,t)}};function en(e,t){e.style.display=t?e[$n]:"none",e[ko]=!t}const aa=Symbol(""),ca=/(?:^|;)\s*display\s*:/;function ua(e,t,n){const r=e.style,s=le(n);let o=!1;if(n&&!s){if(t)if(le(t))for(const i of t.split(";")){const l=i.slice(0,i.indexOf(":")).trim();n[l]==null&&Ln(r,l,"")}else for(const i in t)n[i]==null&&Ln(r,i,"");for(const i in n)i==="display"&&(o=!0),Ln(r,i,n[i])}else if(s){if(t!==n){const i=r[aa];i&&(n+=";"+i),r.cssText=n,o=ca.test(n)}}else t&&e.removeAttribute("style");$n in e&&(e[$n]=o?r.display:"",e[ko]&&(r.display="none"))}const Oo=/\s*!important$/;function Ln(e,t,n){if(P(n))n.forEach(r=>Ln(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=fa(e,t);Oo.test(n)?e.setProperty(ke(r),n.replace(Oo,""),"important"):e[r]=n}}const Mo=["Webkit","Moz","ms"],Ar={};function fa(e,t){const n=Ar[t];if(n)return n;let r=Ie(t);if(r!=="filter"&&r in e)return Ar[t]=r;r=Hr(r);for(let s=0;s<Mo.length;s++){const o=Mo[s]+r;if(o in e)return Ar[t]=o}return t}const Io="http://www.w3.org/1999/xlink";function Ro(e,t,n,r,s,o=si(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Io,t.slice(6,t.length)):e.setAttributeNS(Io,t,n):n==null||o&&!zr(n)?e.removeAttribute(t):e.setAttribute(t,o?"":Ne(n)?String(n):n)}function jo(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?wo(n):n);return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){const l=o==="OPTION"?e.getAttribute("value")||"":e.value,a=n==null?e.type==="checkbox"?"on":"":String(n);(l!==a||!("_value"in e))&&(e.value=a),n==null&&e.removeAttribute(t),e._value=n;return}let i=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=zr(n):n==null&&l==="string"?(n="",i=!0):l==="number"&&(n=0,i=!0)}try{e[t]=n}catch{}i&&e.removeAttribute(s||t)}function Mt(e,t,n,r){e.addEventListener(t,n,r)}function da(e,t,n,r){e.removeEventListener(t,n,r)}const Fo=Symbol("_vei");function ha(e,t,n,r,s=null){const o=e[Fo]||(e[Fo]={}),i=o[t];if(r&&i)i.value=r;else{const[l,a]=pa(t);if(r){const f=o[t]=ba(r,s);Mt(e,l,f,a)}else i&&(da(e,l,i,a),o[t]=void 0)}}const Po=/(?:Once|Passive|Capture)$/;function pa(e){let t;if(Po.test(e)){t={};let r;for(;r=e.match(Po);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ke(e.slice(2)),t]}let Or=0;const ga=Promise.resolve(),ma=()=>Or||(ga.then(()=>Or=0),Or=Date.now());function ba(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Fe(wa(r,n.value),t,5,[r])};return n.value=e,n.attached=ma(),n}function wa(e,t){if(P(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const No=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,ya=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?la(e,r,i):t==="style"?ua(e,n,r):ln(t)?Vn(t)||ha(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):va(e,t,r,i))?(jo(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ro(e,t,r,i,o,t!=="value")):e._isVueCE&&(/[A-Z]/.test(t)||!le(r))?jo(e,Ie(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Ro(e,t,r,i))};function va(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&No(t)&&L(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return No(t)&&le(n)?!1:t in e}const $o={};function xa(e,t,n){let r=At(e,t);an(r)&&(r=ie({},r,t));class s extends Mr{constructor(i){super(r,i,n)}}return s.def=r,s}const _a=typeof HTMLElement<"u"?HTMLElement:class{};class Mr extends _a{constructor(t,n={},r=Vo){super(),this._def=t,this._props=n,this._createApp=r,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._ob=null,this.shadowRoot&&r!==Vo?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(ie({},t.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;!this.shadowRoot&&!this._resolved&&this._parseSlots(),this._connected=!0;let t=this;for(;t=t&&(t.parentNode||t.host);)if(t instanceof Mr){this._parent=t;break}this._instance||(this._resolved?this._mount(this._def):t&&t._pendingResolve?this._pendingResolve=t._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(t=this._parent){t&&(this._instance.parent=t._instance,this._inheritParentContext(t))}_inheritParentContext(t=this._parent){t&&this._app&&Object.setPrototypeOf(this._app._context.provides,t._instance.provides)}disconnectedCallback(){this._connected=!1,kt(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(t){for(const n of t)this._setAttr(n.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let r=0;r<this.attributes.length;r++)this._setAttr(this.attributes[r].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});const t=(r,s=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:o,styles:i}=r;let l;if(o&&!P(o))for(const a in o){const f=o[a];(f===Number||f&&f.type===Number)&&(a in this._props&&(this._props[a]=Gn(this._props[a])),(l||(l=Object.create(null)))[Ie(a)]=!0)}this._numberProps=l,this._resolveProps(r),this.shadowRoot&&this._applyStyles(i),this._mount(r)},n=this._def.__asyncLoader;n?this._pendingResolve=n().then(r=>{r.configureApp=this._def.configureApp,t(this._def=r,!0)}):t(this._def)}_mount(t){this._app=this._createApp(t),this._inheritParentContext(),t.configureApp&&t.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const n=this._instance&&this._instance.exposed;if(n)for(const r in n)G(this,r)||Object.defineProperty(this,r,{get:()=>Je(n[r])})}_resolveProps(t){const{props:n}=t,r=P(n)?n:Object.keys(n||{});for(const s of Object.keys(this))s[0]!=="_"&&r.includes(s)&&this._setProp(s,this[s]);for(const s of r.map(Ie))Object.defineProperty(this,s,{get(){return this._getProp(s)},set(o){this._setProp(s,o,!0,!this._patching)}})}_setAttr(t){if(t.startsWith("data-v-"))return;const n=this.hasAttribute(t);let r=n?this.getAttribute(t):$o;const s=Ie(t);n&&this._numberProps&&this._numberProps[s]&&(r=Gn(r)),this._setProp(s,r,!1,!0)}_getProp(t){return this._props[t]}_setProp(t,n,r=!0,s=!1){if(n!==this._props[t]&&(this._dirty=!0,n===$o?delete this._props[t]:(this._props[t]=n,t==="key"&&this._app&&(this._app._ceVNode.key=n)),s&&this._instance&&this._update(),r)){const o=this._ob;o&&(this._processMutations(o.takeRecords()),o.disconnect()),n===!0?this.setAttribute(ke(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(ke(t),n+""):n||this.removeAttribute(ke(t)),o&&o.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),Ea(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=ae(this._def,ie(t,this._props));return this._instance||(n.ce=r=>{this._instance=r,r.ce=this,r.isCE=!0;const s=(o,i)=>{this.dispatchEvent(new CustomEvent(o,an(i[0])?ie({detail:i},i[0]):{detail:i}))};r.emit=(o,...i)=>{s(o,i),ke(o)!==o&&s(ke(o),i)},this._setParent()}),n}_applyStyles(t,n){if(!t)return;if(n){if(n===this._def||this._styleChildren.has(n))return;this._styleChildren.add(n)}const r=this._nonce;for(let s=t.length-1;s>=0;s--){const o=document.createElement("style");r&&o.setAttribute("nonce",r),o.textContent=t[s],this.shadowRoot.prepend(o)}}_parseSlots(){const t=this._slots={};let n;for(;n=this.firstChild;){const r=n.nodeType===1&&n.getAttribute("slot")||"default";(t[r]||(t[r]=[])).push(n),this.removeChild(n)}}_renderSlots(){const t=this._getSlots(),n=this._instance.type.__scopeId;for(let r=0;r<t.length;r++){const s=t[r],o=s.getAttribute("name")||"default",i=this._slots[o],l=s.parentNode;if(i)for(const a of i){if(n&&a.nodeType===1){const f=n+"-s",u=document.createTreeWalker(a,1);a.setAttribute(f,"");let h;for(;h=u.nextNode();)h.setAttribute(f,"")}l.insertBefore(a,s)}else for(;s.firstChild;)l.insertBefore(s.firstChild,s);l.removeChild(s)}}_getSlots(){const t=[this];this._teleportTargets&&t.push(...this._teleportTargets);const n=new Set;for(const r of t){const s=r.querySelectorAll("slot");for(let o=0;o<s.length;o++)n.add(s[o])}return Array.from(n)}_injectChildStyle(t){this._applyStyles(t.styles,t)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return this._def.shadowRoot!==!1}_removeChildStyle(t){}}const Lo=e=>{const t=e.props["onUpdate:modelValue"]||!1;return P(t)?n=>un(t,n):t};function Ca(e){e.target.composing=!0}function Do(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Ir=Symbol("_assign");function Uo(e,t,n){return t&&(e=e.trim()),n&&(e=Yn(e)),e}const Sa={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Ir]=Lo(s);const o=r||s.props&&s.props.type==="number";Mt(e,t?"change":"input",i=>{i.target.composing||e[Ir](Uo(e.value,n,o))}),(n||o)&&Mt(e,"change",()=>{e.value=Uo(e.value,n,o)}),t||(Mt(e,"compositionstart",Ca),Mt(e,"compositionend",Do),Mt(e,"change",Do))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[Ir]=Lo(i),e.composing)return;const l=(o||e.type==="number")&&!/^0\d/.test(e.value)?Yn(e.value):e.value,a=t??"";l!==a&&(document.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===a)||(e.value=a))}},Ta=ie({patchProp:ya},ea);let Bo;function Ho(){return Bo||(Bo=Al(Ta))}const Ea=(...e)=>{Ho().render(...e)},Vo=(...e)=>{const t=Ho().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=Aa(r);if(!s)return;const o=t._component;!L(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,ka(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t};function ka(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Aa(e){return le(e)?document.querySelector(e):e}const Oa={class:"typing-indicator flex items-center gap-1 py-2"},Ma={class:"flex gap-0.5"},Ia=((e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n})(At({__name:"TypingIndicator",setup(e){return(t,n)=>(ne(),se("div",Oa,[n[0]||(n[0]=A("span",{class:"text-xs text-gray-500"},"Admin is typing",-1)),A("span",Ma,[(ne(),se(me,null,Ps(3,r=>A("span",{key:r,class:"w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce",style:dn({animationDelay:`${(r-1)*150}ms`})},null,4)),64))])]))}}),[["styles",["@keyframes bounce-d427c516{0%,60%,to{transform:translateY(0)}30%{transform:translateY(-4px)}}.animate-bounce[data-v-d427c516]{animation:bounce-d427c516 1s infinite}"]],["__scopeId","data-v-d427c516"]]);async function Ra(e,t={}){const{filename:n}=t;try{const r=await fetch(e);if(!r.ok)throw new Error(`HTTP error: ${r.status}`);const s=await r.blob(),o=URL.createObjectURL(s),i=document.createElement("a");i.href=o,i.download=n||ja(e)||"download",i.rel="noopener noreferrer",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}catch(r){console.warn("[Download] Fetch failed, falling back to open in new tab:",r instanceof Error?r.message:"Unknown error"),Fa(e)}}function ja(e){try{const r=new URL(e).pathname.split("/"),s=r[r.length-1];return s&&s.split("?")[0]||null}catch{return null}}function Fa(e){const t=document.createElement("a");t.href=e,t.target="_blank",t.rel="noopener noreferrer",document.body.appendChild(t),t.click(),document.body.removeChild(t)}const Pa={class:"message-list flex-1 overflow-y-auto p-4 space-y-3"},Na={key:0,class:"text-center text-gray-400 py-8"},$a={key:0,class:"text-[11px] font-bold text-gray-400 uppercase tracking-widest text-center px-6"},La={key:0,class:"whitespace-pre-wrap"},Da={key:1,class:"mt-2"},Ua=["href"],Ba=["src"],Ha={class:"flex gap-2 mt-1"},Va=["href"],Wa=["onClick"],za={class:"flex-1 min-w-0"},Ka={class:"flex gap-1"},Ya=["onClick"],Ga=["href"],qa={key:2,class:"flex justify-start"},Ja={class:"bg-gray-100 rounded-2xl rounded-bl-md px-4 py-2"},Xa=At({__name:"MessageList",props:{messages:{type:Array},showTyping:{type:Boolean}},setup(e,{expose:t}){const n=e,r=Ce(null);function s(f){if(!f)return!1;const u=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],h=f.toLowerCase();return u.some(x=>h.includes(x))||f.includes("image/")}function o(f){if(!f)return"File";try{const x=new URL(f).pathname.split("/"),_=x[x.length-1];return _&&_.split("?")[0]||"File"}catch{return"File"}}async function i(f){f&&await Ra(f)}function l(f){const u=f.target;u.style.display="none"}function a(){kt(()=>{var f;(f=r.value)==null||f.scrollIntoView({behavior:"smooth"})})}return lt(()=>n.messages.length,()=>{a()}),lt(()=>n.showTyping,()=>{a()}),t({scrollToBottom:a}),(f,u)=>(ne(),se("div",Pa,[e.messages.length===0?(ne(),se("div",Na,[...u[0]||(u[0]=[A("p",{class:"text-sm"},"No messages yet.",-1),A("p",{class:"text-xs mt-1"},"Start a conversation!",-1)])])):(ne(!0),se(me,{key:1},Ps(e.messages,h=>(ne(),se("div",{key:h.id,class:ue(["message-row flex w-full",[h.sender==="user"?"justify-end":"justify-start",h.sender==="system"?"justify-center py-2":""]])},[h.sender==="system"?(ne(),se("div",$a,ft(h.content),1)):(ne(),se("div",{key:1,class:ue(["message-bubble max-w-[80%] px-4 py-2 rounded-2xl text-sm break-words",h.sender==="user"?"bg-blue-500 text-white rounded-br-md":"bg-gray-100 text-gray-800 rounded-bl-md"])},[h.content?(ne(),se("p",La,ft(h.content),1)):qt("",!0),h.attachmentUrl?(ne(),se("div",Da,[s(h.attachmentUrl)?(ne(),se(me,{key:0},[A("a",{href:h.attachmentUrl,target:"_blank",rel:"noopener noreferrer",class:"block"},[A("img",{src:h.attachmentUrl,alt:"Attachment",class:"max-w-full rounded-lg border-0 cursor-pointer hover:opacity-90 transition-opacity max-h-48 object-cover",onError:l},null,40,Ba)],8,Ua),A("div",Ha,[A("a",{href:h.attachmentUrl,target:"_blank",rel:"noopener noreferrer",class:ue(["text-xs underline hover:no-underline",h.sender==="user"?"text-blue-100":"text-blue-600"])}," Open in new tab ",10,Va),A("button",{class:ue(["text-xs underline hover:no-underline",h.sender==="user"?"text-blue-100":"text-blue-600"]),onClick:x=>i(h.attachmentUrl)}," Download ",10,Wa)])],64)):(ne(),se("div",{key:1,class:ue(["flex items-center gap-3 p-2 rounded-lg border",h.sender==="user"?"border-blue-400/30 bg-blue-600/20":"border-gray-200 bg-gray-50"])},[A("div",{class:ue(["w-10 h-10 rounded-lg flex items-center justify-center",h.sender==="user"?"bg-blue-400/30":"bg-gray-200"])},[(ne(),se("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:ue(h.sender==="user"?"text-blue-100":"text-gray-500")},[...u[1]||(u[1]=[A("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"},null,-1),A("polyline",{points:"14 2 14 8 20 8"},null,-1)])],2))],2),A("div",za,[A("p",{class:ue(["text-xs font-medium truncate",h.sender==="user"?"text-blue-50":"text-gray-700"])},ft(o(h.attachmentUrl)),3)]),A("div",Ka,[A("button",{class:ue(["p-1.5 rounded hover:bg-black/10 transition-colors",h.sender==="user"?"text-blue-100":"text-gray-500"]),title:"Download",onClick:x=>i(h.attachmentUrl)},[...u[2]||(u[2]=[A("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[A("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),A("polyline",{points:"7 10 12 15 17 10"}),A("line",{x1:"12",y1:"15",x2:"12",y2:"3"})],-1)])],10,Ya),A("a",{href:h.attachmentUrl,target:"_blank",rel:"noopener noreferrer",class:ue(["p-1.5 rounded hover:bg-black/10 transition-colors",h.sender==="user"?"text-blue-100":"text-gray-500"]),title:"Open in new tab"},[...u[3]||(u[3]=[A("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[A("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),A("polyline",{points:"15 3 21 3 21 9"}),A("line",{x1:"10",y1:"14",x2:"21",y2:"3"})],-1)])],10,Ga)])],2))])):qt("",!0)],2))],2))),128)),e.showTyping?(ne(),se("div",qa,[A("div",Ja,[ae(Ia)])])):qt("",!0),A("div",{ref_key:"scrollAnchor",ref:r,class:"scroll-anchor h-0"},null,512)]))}}),Za={class:"message-input border-t border-gray-200 p-3"},Qa={key:0,class:"mb-2 flex items-center gap-2 p-2 bg-gray-50 rounded-lg"},ec={class:"text-sm text-gray-600 truncate flex-1"},tc={class:"flex items-end gap-2"},nc=["disabled"],rc=["disabled","placeholder"],sc=["disabled","aria-label"],oc={class:"flex items-center justify-between mt-1.5 px-1"},ic={class:"text-xs text-gray-400"},lc={key:0},ac={key:1},Rr=2500,cc=At({__name:"MessageInput",props:{isEnabled:{type:Boolean}},emits:["send","typing","upload"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=Ce(""),i=Ce(null),l=Ce(null),a=Ce(null),f=Te(()=>o.value.length),u=Te(()=>f.value>Rr),h=Te(()=>{const y=o.value.trim();return r.isEnabled&&(y.length>0||a.value!==null)&&y.length<=Rr}),x=Te(()=>r.isEnabled?"Type a message...":"Waiting for connection...");function _(){var y;(y=l.value)==null||y.click()}function $(y){var ce;const O=y.target,W=(ce=O.files)==null?void 0:ce[0];if(W){if(W.size>10*1024*1024){alert("File size must be less than 10MB");return}a.value=W}O.value=""}function R(){a.value=null}function q(){const y=i.value;if(!y)return;y.style.height="auto";const O=Math.min(y.scrollHeight,120);y.style.height=`${O}px`,r.isEnabled&&s("typing")}function V(y){y.key==="Enter"&&!y.shiftKey&&!y.isComposing&&(y.preventDefault(),h.value&&D())}function D(){const y=o.value.trim(),O=a.value;r.isEnabled&&(O&&(s("upload",O),a.value=null),y&&s("send",y),o.value="",kt(()=>{const W=i.value;W&&(W.style.height="auto")}))}function j(){var y;(y=i.value)==null||y.focus()}return t({focus:j}),(y,O)=>(ne(),se("div",Za,[A("input",{ref_key:"fileInputRef",ref:l,type:"file",class:"hidden",accept:"image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,application/msword,.doc,.docx",onChange:$},null,544),a.value?(ne(),se("div",Qa,[O[2]||(O[2]=A("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-gray-500"},[A("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),A("polyline",{points:"14 2 14 8 20 8"})],-1)),A("span",ec,ft(a.value.name),1),A("button",{type:"button",class:"text-gray-400 hover:text-gray-600 p-1",onClick:R},[...O[1]||(O[1]=[A("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[A("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),A("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])):qt("",!0),A("div",tc,[A("button",{disabled:!e.isEnabled,class:ue(["flex items-center justify-center w-10 h-10 text-gray-500 hover:text-gray-700 rounded-full transition-colors disabled:text-gray-300 disabled:cursor-not-allowed",{"hover:bg-gray-100":e.isEnabled}]),"aria-label":"Attach file",onClick:_},[...O[3]||(O[3]=[A("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"},[A("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})],-1)])],10,nc),dr(A("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":O[0]||(O[0]=W=>o.value=W),disabled:!e.isEnabled,placeholder:x.value,class:ue(["flex-1 min-h-[44px] max-h-[120px] px-3 py-2.5 text-sm border border-gray-300 rounded-xl resize-none outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-100 disabled:text-gray-400",{"border-red-400 focus:border-red-500 focus:ring-red-500":u.value}]),rows:"1",onKeydown:V,onInput:q},null,42,rc),[[Sa,o.value]]),A("button",{disabled:!h.value,class:"send-button flex items-center justify-center w-10 h-10 bg-blue-500 text-white rounded-full transition-all hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2","aria-label":e.isEnabled?"Send message":"Cannot send message",onClick:D},[...O[4]||(O[4]=[A("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[A("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),A("polygon",{points:"22 2 15 22 11 13 2 9"})],-1)])],8,sc)]),A("div",oc,[A("p",ic,[e.isEnabled?(ne(),se("span",lc,"Press Enter to send, Shift+Enter for new line")):(ne(),se("span",ac,"Connecting..."))]),e.isEnabled&&f.value>0?(ne(),se("div",{key:0,class:ue(["text-[10px] font-bold uppercase tracking-widest px-2 py-0.5 rounded-md transition-colors",u.value?"bg-red-50 text-red-500":"bg-gray-100 text-gray-400"])},ft(f.value)+" / "+ft(Rr),3)):qt("",!0)])]))}}),uc={class:"chat-window flex flex-col h-full bg-white rounded-xl shadow-lg overflow-hidden"},fc={class:"flex items-center justify-between px-4 py-3 bg-gradient-to-br from-blue-500 to-blue-600 text-white shrink-0"},dc={key:0,class:"flex-1 flex flex-col items-center justify-center p-8"},hc={key:1,class:"flex-1 flex flex-col items-center justify-center p-8"},pc=At({__name:"ChatWindow",props:{status:{type:String},messages:{type:Array},adminTyping:{type:Boolean},isVisible:{type:Boolean}},emits:["close","retry","send","typing","upload"],setup(e,{emit:t}){const n=e,r=t,s=Ce(null),o=Te(()=>n.status==="connecting"),i=Te(()=>n.status==="connected"),l=Te(()=>n.status==="error");return lt(()=>n.status,a=>{a==="connected"&&kt(()=>{var f;(f=s.value)==null||f.scrollToBottom()})}),lt(()=>n.isVisible,a=>{a&&kt(()=>{var f;(f=s.value)==null||f.scrollToBottom()})}),(a,f)=>(ne(),se("div",uc,[A("div",fc,[f[6]||(f[6]=A("div",{class:"flex items-center gap-2"},[A("div",{class:"w-2 h-2 rounded-full bg-green-400"}),A("h2",{class:"text-base font-semibold"},"Support Chat")],-1)),A("button",{class:"flex items-center justify-center w-8 h-8 bg-white/20 border-0 text-white rounded-full cursor-pointer transition-colors hover:bg-white/30 focus:outline-none focus:ring-2 focus:ring-white/50","aria-label":"Close chat",onClick:f[0]||(f[0]=u=>r("close"))},[...f[5]||(f[5]=[A("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"},[A("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),A("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),o.value?(ne(),se("div",dc,[...f[7]||(f[7]=[A("div",{class:"w-10 h-10 border-4 border-blue-200 border-t-blue-500 rounded-full animate-spin mb-4"},null,-1),A("p",{class:"text-gray-600 text-sm"},"Connecting to support...",-1)])])):l.value?(ne(),se("div",hc,[f[8]||(f[8]=co('<div class="w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mb-4"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg></div><p class="text-gray-800 font-medium mb-1">Connection failed</p><p class="text-gray-500 text-sm text-center mb-4"> Unable to connect to support. Please check your connection and try again. </p>',3)),A("button",{class:"px-4 py-2 bg-blue-500 text-white text-sm font-medium rounded-lg transition-colors hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",onClick:f[1]||(f[1]=u=>r("retry"))}," Try Again ")])):(ne(),se(me,{key:2},[ae(Xa,{ref_key:"messageListRef",ref:s,messages:e.messages,"show-typing":e.adminTyping},null,8,["messages","show-typing"]),ae(cc,{"is-enabled":i.value,onSend:f[2]||(f[2]=u=>r("send",u)),onTyping:f[3]||(f[3]=u=>r("typing")),onUpload:f[4]||(f[4]=u=>r("upload",u))},null,8,["is-enabled"])],64))]))}}),Dn={initialDelay:1e3,maxDelay:31e3,multiplier:2,maxFailures:5};function gc(e={}){const t=Ce("disconnected"),n=Ce(null);let r=null,s=null,o=0,i=null,l=!1;function a(j){if(e.wsUrl){const W=new URL(e.wsUrl);return W.searchParams.set("jwt",j),W.toString()}const y=window.location.protocol==="https:"?"wss:":"ws:",O=window.location.host;return`${y}//${O}/ws?jwt=${encodeURIComponent(j)}`}function f(){const j=Dn.initialDelay*Math.pow(Dn.multiplier,o);return Math.min(j,Dn.maxDelay)}function u(){if(l)return;if(o>=Dn.maxFailures){t.value="error",n.value="Max reconnection attempts reached";return}const j=f();o++,i=setTimeout(()=>{!l&&s&&q(s)},j)}function h(){i&&(clearTimeout(i),i=null)}function x(){var j;t.value="connected",n.value=null,o=0,(j=e.onOpen)==null||j.call(e)}function _(j){var y;try{const O=JSON.parse(j.data);typeof O.event=="string"&&O.timestamp!==void 0&&typeof O.timestamp=="number"?(y=e.onMessage)==null||y.call(e,O):console.warn("[WebSocket] Received invalid envelope shape:",O)}catch{console.warn("[WebSocket] Received non-JSON message:",j.data)}}function $(j){var y;r=null,t.value="disconnected",(y=e.onClose)==null||y.call(e,j),l||u()}function R(j){var y;t.value="error",n.value="WebSocket error occurred",(y=e.onError)==null||y.call(e,j)}function q(j){if(!((r==null?void 0:r.readyState)===WebSocket.OPEN||(r==null?void 0:r.readyState)===WebSocket.CONNECTING)){h(),s=j,l=!1,t.value="connecting",n.value=null;try{const y=a(j);r=new WebSocket(y),r.addEventListener("open",x),r.addEventListener("message",_),r.addEventListener("close",$),r.addEventListener("error",R)}catch(y){t.value="error",n.value=y instanceof Error?y.message:"Failed to create WebSocket",u()}}}function V(j,y){if(!r||r.readyState!==WebSocket.OPEN)return!1;const O={event:j,data:y,timestamp:Math.floor(Date.now()/1e3)};try{return r.send(JSON.stringify(O)),!0}catch(W){return console.error("[WebSocket] Failed to send message:",W),!1}}function D(){l=!0,h(),r&&(r.removeEventListener("open",x),r.removeEventListener("message",_),r.removeEventListener("close",$),r.removeEventListener("error",R),(r.readyState===WebSocket.OPEN||r.readyState===WebSocket.CONNECTING)&&r.close(),r=null),t.value="disconnected",s=null,o=0}return{status:Lt(t),lastError:Lt(n),connect:q,send:V,disconnect:D}}function Un(e){try{const t=e.split(".");if(t.length!==3)return null;const n=t[1];if(!n)return null;const r=n+"=".repeat((4-n.length%4)%4),s=atob(r.replace(/-/g,"+").replace(/_/g,"/")),o=JSON.parse(s);return!o.platform_id||!o.external_user_id?null:{platform_id:o.platform_id,external_user_id:o.external_user_id}}catch{return null}}const mc="tvs_support_chat_id";function jr(e,t){return`${mc}:${e}:${t}`}function bc(e,t){try{const n=jr(e,t);return localStorage.getItem(n)}catch{return null}}function Fr(e,t,n){try{const r=jr(e,t);return localStorage.setItem(r,n),!0}catch{return!1}}function tn(e,t){try{const n=jr(e,t);return localStorage.removeItem(n),!0}catch{return!1}}function wc(e){const t=e.apiBaseUrl??"",n=Ce(null),r=Ce([]),s=Ce(!1),o=Ce(null),i=gc({onMessage:$,onOpen:()=>{o.value=null},onError:()=>{o.value="Connection error. Retrying..."},onClose:M=>{M.wasClean||(o.value="Connection lost. Reconnecting...")},wsUrl:e.wsUrl}),l=Te(()=>{switch(i.status.value){case"connecting":return"connecting";case"connected":return"connected";case"error":return"error";case"disconnected":return r.value.length>0?"error":"connecting";default:return"connecting"}}),a=Te(()=>l.value==="connected"),f=Te(()=>l.value==="connecting"),u=Te(()=>l.value==="error");let h=null;const x=300;function _(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function $(M){switch(M.event){case"server:message":{const g=M.data;if(!n.value){const C=Un(e.jwt),I=(C==null?void 0:C.platform_id)??"",B=(C==null?void 0:C.external_user_id)??"";n.value=g.chat_id,I&&B&&Fr(I,B,g.chat_id)}if(g.chat_id!==n.value)return;if(g.sender_type==="admin"&&(r.value.push({id:_(),sender:"admin",content:g.content??"",attachmentUrl:g.attachment_url,createdAt:new Date(g.created_at*1e3)}),s.value=!1),g.sender_type==="user"){let C=-1;for(let I=r.value.length-1;I>=0;I--){const B=r.value[I];if(B&&B.sender==="user"){const Z=!!g.attachment_url&&B.content===""&&B.attachmentUrl===null,z=!g.attachment_url&&B.content===g.content;if(Z||z){C=I;break}}}if(C!==-1){const I=r.value[C];I&&(I.attachmentUrl=g.attachment_url,I.createdAt=new Date(g.created_at*1e3))}else r.value.push({id:_(),sender:"user",content:g.content??"",attachmentUrl:g.attachment_url,createdAt:new Date(g.created_at*1e3)})}break}case"server:error":{const g=M.data;console.error("[Chat] Server error:",g),o.value=g.message||"An error occurred";break}case"server:chat_assigned":{M.data.chat_id===n.value&&r.value.push({id:_(),sender:"system",content:"TVS Agent joined the chat",createdAt:new Date});break}case"server:chat_closed":{if(M.data.chat_id===n.value){r.value.push({id:_(),sender:"system",content:"Chat ended",createdAt:new Date});const C=Un(e.jwt),I=(C==null?void 0:C.platform_id)??"",B=(C==null?void 0:C.external_user_id)??"";setTimeout(()=>{I&&B&&tn(I,B),n.value=null,r.value=[],s.value=!1},3100)}break}}}async function R(){var M,g;try{const C=await fetch(`${t}/api/chats`,{method:"POST",headers:{Authorization:`Bearer ${e.jwt}`,"Content-Type":"application/json"}});if(!C.ok){const B=await C.json().catch(()=>({}));throw new Error(((M=B.error)==null?void 0:M.message)||"Failed to create chat")}return((g=(await C.json()).data)==null?void 0:g.id)??null}catch(C){return console.error("[Chat] Failed to create chat:",C),o.value=C instanceof Error?C.message:"Failed to create chat",null}}async function q(M){try{const g=await fetch(`${t}/api/chats/${M}`,{method:"GET",headers:{Authorization:`Bearer ${e.jwt}`,"Content-Type":"application/json"}});if(g.status===403||g.status===404)return{notFound:!0};if(!g.ok)return null;const C=await g.json();return!C.ok||!C.data?{notFound:!0}:C.data}catch{return null}}async function V(){try{const M=await fetch(`${t}/api/chats?limit=20&offset=0`,{method:"GET",headers:{Authorization:`Bearer ${e.jwt}`,"Content-Type":"application/json"}});if(!M.ok)return null;const g=await M.json();if(!g.ok||!g.data)return null;const I=g.data.find(B=>B.status==="open"||B.status==="escalated");return I?{id:I.id,status:I.status}:null}catch{return null}}async function D(M){var g;try{const C=await fetch(`${t}/api/chats/${M}/messages?limit=50&offset=0`,{method:"GET",headers:{Authorization:`Bearer ${e.jwt}`,"Content-Type":"application/json"}});if(C.status===403||C.status===404)return{notFound:!0};if(!C.ok)return null;const I=await C.json();return!I.ok||!((g=I.data)!=null&&g.messages)?{notFound:!0}:I.data.messages.map(B=>({id:B.id,content:B.content??"",attachmentUrl:B.attachment_url,sender:B.sender_type,createdAt:new Date(B.created_at*1e3)}))}catch{return null}}async function j(){const M=Un(e.jwt),g=(M==null?void 0:M.platform_id)??"",C=(M==null?void 0:M.external_user_id)??"";if(!g||!C)return y("","");const I=bc(g,C);if(!I)return null;const B=await q(I);if(B===null){n.value=I;const z=await D(I);return z&&"notFound"in z?(tn(g,C),null):(r.value=z??[],I)}if("notFound"in B||B.status==="closed")return tn(g,C),null;n.value=I;const Z=await D(I);return Z&&"notFound"in Z?(tn(g,C),null):(r.value=Z??[],I)}async function y(M,g){const C=await R();return C?(n.value=C,M&&g&&Fr(M,g,C),C):null}async function O(){i.status.value==="connected"||i.status.value==="connecting"||(await j(),i.connect(e.jwt))}function W(){o.value=null,O()}function ce(){!n.value||!a.value||(h&&clearTimeout(h),h=setTimeout(()=>{i.send("client:typing",{chat_id:n.value})},x))}async function he(M){const g=M.trim();if(!g||!a.value)return;if(!n.value){const I=Un(e.jwt),B=(I==null?void 0:I.platform_id)??"",Z=(I==null?void 0:I.external_user_id)??"",z=await V();if(z)n.value=z.id,B&&Z&&Fr(B,Z,z.id);else if(!await y(B,Z)){o.value="Failed to start a new chat session";return}}r.value.push({id:_(),sender:"user",content:g,createdAt:new Date}),s.value=!1,i.send("client:message_send",{chat_id:n.value,content:g})||(r.value.pop(),o.value="Failed to send message")}async function H(M){var g;if(!a.value||!n.value){o.value="Not connected to chat";return}try{const C=await fetch(`${t}/api/chats/${n.value}/attachments/upload-url`,{method:"POST",headers:{Authorization:`Bearer ${e.jwt}`,"Content-Type":"application/json"},body:JSON.stringify({filename:M.name,contentType:M.type,size:M.size})});if(!C.ok){const nt=await C.json().catch(()=>({}));throw new Error(((g=nt.error)==null?void 0:g.message)||"Failed to get upload URL")}const I=await C.json(),{uploadUrl:B,fileKey:Z}=I.data;if(!(await fetch(B,{method:"PUT",headers:{"Content-Type":M.type},body:M})).ok)throw new Error("Failed to upload file");const Q=_();if(r.value.push({id:Q,sender:"user",content:"",createdAt:new Date,attachmentUrl:null}),s.value=!1,!i.send("client:message_send",{chat_id:n.value,content:"",attachment_key:Z})){const nt=r.value.findIndex(rt=>rt.id===Q);nt!==-1&&r.value.splice(nt,1),o.value="Failed to send attachment"}}catch(C){console.error("[Chat] Failed to upload file:",C),o.value=C instanceof Error?C.message:"Failed to upload file"}}function J(){h&&(clearTimeout(h),h=null),i.disconnect()}return kn(J),{status:l,messages:r,adminTyping:s,chatId:n,errorMessage:o,isConnected:a,isConnecting:f,isError:u,connect:O,retry:W,sendMessage:he,sendTyping:ce,uploadFile:H,cleanup:J}}const yc={class:"support-client-widget font-sans"},vc={key:0,class:"bg-red-50 border border-red-200 rounded-lg p-4 text-center max-w-[350px]"},Wo=At({__name:"SupportClientWidget.ce",props:{jwt:{type:String},apiBaseUrl:{type:String},wsUrl:{type:String}},setup(e){const t=e,n=Ce(!1),r=Te(()=>"right-5 bottom-5"),s=wc({jwt:t.jwt,apiBaseUrl:t.apiBaseUrl,wsUrl:t.wsUrl}),o=()=>{n.value=!n.value};return gr(()=>{t.jwt&&s.connect()}),kn(()=>{s.cleanup()}),lt(()=>t.jwt,i=>{i&&s.connect()}),(i,l)=>(ne(),se("div",yc,[e.jwt?(ne(),se(me,{key:1},[ae(na,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"opacity-0 translate-y-4 scale-95","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-95"},{default:vs(()=>[dr(A("div",{class:ue(["fixed chat-panel w-[min(360px,calc(100vw-32px))] h-[min(520px,calc(100vh-120px))] z-[9998]",r.value])},[ae(pc,{status:Je(s).status.value,messages:Je(s).messages.value,"admin-typing":Je(s).adminTyping.value,"is-visible":n.value,onClose:o,onRetry:Je(s).retry,onSend:Je(s).sendMessage,onTyping:Je(s).sendTyping,onUpload:Je(s).uploadFile},null,8,["status","messages","admin-typing","is-visible","onRetry","onSend","onTyping","onUpload"])],2),[[Ao,n.value]])]),_:1}),dr(A("button",{class:ue(["fixed bubble-button w-14 h-14 rounded-full bg-gradient-to-br from-blue-500 to-blue-600 text-white shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 z-[9999] flex items-center justify-center",r.value]),"aria-label":"Open chat",onClick:o},[...l[1]||(l[1]=[A("svg",{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"},[A("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})],-1)])],2),[[Ao,!n.value]])],64)):(ne(),se("div",vc,[...l[0]||(l[0]=[co('<div class="w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-2"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg></div><p class="text-red-600 font-semibold mb-1">Authentication required</p><p class="text-red-800 text-xs"> Please provide a valid JWT token via the <code class="bg-red-100 px-1 py-0.5 rounded font-mono">jwt</code> attribute. </p>',3)])]))]))}}),xc=xa(Wo,{styles:['*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.bottom-5{bottom:1.25rem}.right-5{right:1.25rem}.z-\\[9998\\]{z-index:9998}.z-\\[9999\\]{z-index:9999}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mt-1{margin-top:.25rem}.mt-1\\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.h-0{height:0px}.h-1\\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-8{height:2rem}.h-\\[min\\(520px\\,calc\\(100vh-120px\\)\\)\\]{height:min(520px,calc(100vh - 120px))}.h-full{height:100%}.max-h-48{max-height:12rem}.max-h-\\[120px\\]{max-height:120px}.min-h-\\[44px\\]{min-height:44px}.w-1\\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-8{width:2rem}.w-\\[min\\(360px\\,calc\\(100vw-32px\\)\\)\\]{width:min(360px,calc(100vw - 32px))}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-\\[350px\\]{max-width:350px}.max-w-\\[80\\%\\]{max-width:80%}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-4{--tw-translate-y: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-bl-md{border-bottom-left-radius:.375rem}.rounded-br-md{border-bottom-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-4{border-width:4px}.border-t{border-top-width:1px}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-400\\/30{border-color:#60a5fa4d}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.border-t-blue-500{--tw-border-opacity: 1;border-top-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.bg-blue-400\\/30{background-color:#60a5fa4d}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600\\/20{background-color:#2563eb33}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\\/20{background-color:#fff3}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-1\\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-8{padding-top:2rem;padding-bottom:2rem}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-widest{letter-spacing:.1em}.text-blue-100{--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.text-blue-50{--tw-text-opacity: 1;color:rgb(239 246 255 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring-red-500{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover\\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-black\\/10:hover{background-color:#0000001a}.hover\\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\\:bg-white\\/30:hover{background-color:#ffffff4d}.hover\\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\\:no-underline:hover{text-decoration-line:none}.hover\\:opacity-90:hover{opacity:.9}.hover\\:shadow-xl:hover{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\\:border-red-500:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\\:ring-red-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus\\:ring-white\\/50:focus{--tw-ring-color: rgb(255 255 255 / .5)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-gray-100:disabled{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.disabled\\:bg-gray-300:disabled{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.disabled\\:text-gray-300:disabled{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.disabled\\:text-gray-400:disabled{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}',...Wo.styles||[]]});class Pr extends xc{connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent("ready",{bubbles:!0,composed:!0}))})}disconnectedCallback(){super.disconnectedCallback()}}return customElements.get("support-client-widget")||customElements.define("support-client-widget",Pr),on.SupportClientWidgetElement=Pr,on.default=Pr,Object.defineProperties(on,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),on}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tvsgroup/support-client",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"