mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-04-11 18:08:16 +00:00
- Streaming AI chat via Vercel AI SDK v6 UI message stream — tool-based
generative UI (pick_branch, list_departments, show_clinic_timings,
show_doctors, show_doctor_slots, suggest_booking). Typing indicator,
markdown suppressed, text parts hidden when widgets are rendered.
- Centralized Preact store (store.tsx) for visitor, leadId, captchaToken,
bookingPrefill, doctors roster, branches, selectedBranch — replaces prop
drilling across chat/book/contact tabs.
- Cloudflare Turnstile captcha gate rendered via light-DOM portal so it
renders correctly inside the shadow DOM (Turnstile CSS doesn't cross
shadow boundaries).
- Lead dedup helper (findOrCreateLeadByPhone, 24h phone window) shared
across chat-start / book / contact so one visitor == one lead. Booking
upgrades existing lead status NEW → APPOINTMENT_SET via updateLeadStatus.
- Pre-chat name+phone form captures the visitor; chat transcript logged
to leadActivity records after each stream.
- Booking wizard gains a branch step 0 (skipped for single-branch
hospitals); departments + doctors filtered by selectedBranch. Chat slot
picks prefill the booking details step and lock the branch.
- Window-level captcha gate, modal maximize mode, header badge showing
selected branch, widget font inherits from host page (fix :host { all:
initial } override).
- 23 FA Pro 7.1 duotone icons bundled — medical departments, nav, actions,
hospital/location-dot for branch context.
- main.ts: resolve public/ from process.cwd() so widget.js serves in both
dev and prod. tsconfig: exclude widget-src/public/data from server tsc.
- captcha.guard: switch from reCAPTCHA v3 to Cloudflare Turnstile verify.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
464 lines
77 KiB
JavaScript
464 lines
77 KiB
JavaScript
(function(){"use strict";var tt,C,$t,j,Mt,Tt,Bt,_t,et,J,It,wt,bt,xt,Pt,it={},nt=[],le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ot=Array.isArray;function A(t,e){for(var n in e)t[n]=e[n];return t}function vt(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function ae(t,e,n){var o,l,r,s={};for(r in e)r=="key"?o=e[r]:r=="ref"?l=e[r]:s[r]=e[r];if(arguments.length>2&&(s.children=arguments.length>3?tt.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(r in t.defaultProps)s[r]===void 0&&(s[r]=t.defaultProps[r]);return rt(t,s,o,l,null)}function rt(t,e,n,o,l){var r={type:t,props:e,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l??++$t,__i:-1,__u:0};return l==null&&C.vnode!=null&&C.vnode(r),r}function O(t){return t.children}function lt(t,e){this.props=t,this.context=e}function q(t,e){if(e==null)return t.__?q(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?q(t):null}function ce(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,o=[],l=[],r=A({},e);r.__v=e.__v+1,C.vnode&&C.vnode(r),kt(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[n]:null,o,n??q(e),!!(32&e.__u),l),r.__v=e.__v,r.__.__k[r.__i]=r,At(o,r,l),e.__e=e.__=null,r.__e!=n&&Nt(r)}}function Nt(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),Nt(t)}function yt(t){(!t.__d&&(t.__d=!0)&&j.push(t)&&!at.__r++||Mt!=C.debounceRendering)&&((Mt=C.debounceRendering)||Tt)(at)}function at(){try{for(var t,e=1;j.length;)j.length>e&&j.sort(Bt),t=j.shift(),e=j.length,ce(t)}finally{j.length=at.__r=0}}function Dt(t,e,n,o,l,r,s,p,u,c,d){var a,g,h,m,k,w,x,_=o&&o.__k||nt,I=e.length;for(u=se(n,e,_,u,I),a=0;a<I;a++)(h=n.__k[a])!=null&&(g=h.__i!=-1&&_[h.__i]||it,h.__i=a,w=kt(t,h,g,l,r,s,p,u,c,d),m=h.__e,h.ref&&g.ref!=h.ref&&(g.ref&&zt(g.ref,null,h),d.push(h.ref,h.__c||m,h)),k==null&&m!=null&&(k=m),(x=!!(4&h.__u))||g.__k===h.__k?(u=Ht(h,u,t,x),x&&g.__e&&(g.__e=null)):typeof h.type=="function"&&w!==void 0?u=w:m&&(u=m.nextSibling),h.__u&=-7);return n.__e=k,u}function se(t,e,n,o,l){var r,s,p,u,c,d=n.length,a=d,g=0;for(t.__k=new Array(l),r=0;r<l;r++)(s=e[r])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=t.__k[r]=rt(null,s,null,null,null):ot(s)?s=t.__k[r]=rt(O,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=t.__k[r]=rt(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):t.__k[r]=s,u=r+g,s.__=t,s.__b=t.__b+1,p=null,(c=s.__i=de(s,n,u,a))!=-1&&(a--,(p=n[c])&&(p.__u|=2)),p==null||p.__v==null?(c==-1&&(l>d?g--:l<d&&g++),typeof s.type!="function"&&(s.__u|=4)):c!=u&&(c==u-1?g--:c==u+1?g++:(c>u?g--:g++,s.__u|=4))):t.__k[r]=null;if(a)for(r=0;r<d;r++)(p=n[r])!=null&&(2&p.__u)==0&&(p.__e==o&&(o=q(p)),jt(p,p));return o}function Ht(t,e,n,o){var l,r;if(typeof t.type=="function"){for(l=t.__k,r=0;l&&r<l.length;r++)l[r]&&(l[r].__=t,e=Ht(l[r],e,n,o));return e}t.__e!=e&&(o&&(e&&t.type&&!e.parentNode&&(e=q(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function de(t,e,n,o){var l,r,s,p=t.key,u=t.type,c=e[n],d=c!=null&&(2&c.__u)==0;if(c===null&&p==null||d&&p==c.key&&u==c.type)return n;if(o>(d?1:0)){for(l=n-1,r=n+1;l>=0||r<e.length;)if((c=e[s=l>=0?l--:r++])!=null&&(2&c.__u)==0&&p==c.key&&u==c.type)return s}return-1}function Et(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||le.test(e)?n:n+"px"}function ct(t,e,n,o,l){var r,s;t:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof o=="string"&&(t.style.cssText=o=""),o)for(e in o)n&&e in n||Et(t.style,e,"");if(n)for(e in n)o&&n[e]==o[e]||Et(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(It,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=n,n?o?n[J]=o[J]:(n[J]=wt,t.addEventListener(e,r?xt:bt,r)):t.removeEventListener(e,r?xt:bt,r);else{if(l=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break t}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function Wt(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e[et]==null)e[et]=wt++;else if(e[et]<n[J])return;return n(C.event?C.event(e):e)}}}function kt(t,e,n,o,l,r,s,p,u,c){var d,a,g,h,m,k,w,x,_,I,z,N,D,b,T,P=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),r=[p=e.__e=n.__e]),(d=C.__b)&&d(e);t:if(typeof P=="function")try{if(x=e.props,_=P.prototype&&P.prototype.render,I=(d=P.contextType)&&o[d.__c],z=d?I?I.props.value:d.__:o,n.__c?w=(a=e.__c=n.__c).__=a.__E:(_?e.__c=a=new P(x,z):(e.__c=a=new lt(x,z),a.constructor=P,a.render=he),I&&I.sub(a),a.state||(a.state={}),a.__n=o,g=a.__d=!0,a.__h=[],a._sb=[]),_&&a.__s==null&&(a.__s=a.state),_&&P.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=A({},a.__s)),A(a.__s,P.getDerivedStateFromProps(x,a.__s))),h=a.props,m=a.state,a.__v=e,g)_&&P.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),_&&a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(_&&P.getDerivedStateFromProps==null&&x!==h&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(x,z),e.__v==n.__v||!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(x,a.__s,z)===!1){e.__v!=n.__v&&(a.props=x,a.state=a.__s,a.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(B){B&&(B.__=e)}),nt.push.apply(a.__h,a._sb),a._sb=[],a.__h.length&&s.push(a);break t}a.componentWillUpdate!=null&&a.componentWillUpdate(x,a.__s,z),_&&a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(h,m,k)})}if(a.context=z,a.props=x,a.__P=t,a.__e=!1,N=C.__r,D=0,_)a.state=a.__s,a.__d=!1,N&&N(e),d=a.render(a.props,a.state,a.context),nt.push.apply(a.__h,a._sb),a._sb=[];else do a.__d=!1,N&&N(e),d=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++D<25);a.state=a.__s,a.getChildContext!=null&&(o=A(A({},o),a.getChildContext())),_&&!g&&a.getSnapshotBeforeUpdate!=null&&(k=a.getSnapshotBeforeUpdate(h,m)),b=d!=null&&d.type===O&&d.key==null?Ft(d.props.children):d,p=Dt(t,ot(b)?b:[b],e,n,o,l,r,s,p,u,c),a.base=e.__e,e.__u&=-161,a.__h.length&&s.push(a),w&&(a.__E=a.__=null)}catch(B){if(e.__v=null,u||r!=null)if(B.then){for(e.__u|=u?160:128;p&&p.nodeType==8&&p.nextSibling;)p=p.nextSibling;r[r.indexOf(p)]=null,e.__e=p}else{for(T=r.length;T--;)vt(r[T]);Ct(e)}else e.__e=n.__e,e.__k=n.__k,B.then||Ct(e);C.__e(B,e,n)}else r==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):p=e.__e=pe(n.__e,e,n,o,l,r,s,u,c);return(d=C.diffed)&&d(e),128&e.__u?void 0:p}function Ct(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Ct))}function At(t,e,n){for(var o=0;o<n.length;o++)zt(n[o],n[++o],n[++o]);C.__c&&C.__c(e,t),t.some(function(l){try{t=l.__h,l.__h=[],t.some(function(r){r.call(l)})}catch(r){C.__e(r,l.__v)}})}function Ft(t){return typeof t!="object"||t==null||t.__b>0?t:ot(t)?t.map(Ft):A({},t)}function pe(t,e,n,o,l,r,s,p,u){var c,d,a,g,h,m,k,w=n.props||it,x=e.props,_=e.type;if(_=="svg"?l="http://www.w3.org/2000/svg":_=="math"?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),r!=null){for(c=0;c<r.length;c++)if((h=r[c])&&"setAttribute"in h==!!_&&(_?h.localName==_:h.nodeType==3)){t=h,r[c]=null;break}}if(t==null){if(_==null)return document.createTextNode(x);t=document.createElementNS(l,_,x.is&&x),p&&(C.__m&&C.__m(e,r),p=!1),r=null}if(_==null)w===x||p&&t.data==x||(t.data=x);else{if(r=r&&tt.call(t.childNodes),!p&&r!=null)for(w={},c=0;c<t.attributes.length;c++)w[(h=t.attributes[c]).name]=h.value;for(c in w)h=w[c],c=="dangerouslySetInnerHTML"?a=h:c=="children"||c in x||c=="value"&&"defaultValue"in x||c=="checked"&&"defaultChecked"in x||ct(t,c,null,h,l);for(c in x)h=x[c],c=="children"?g=h:c=="dangerouslySetInnerHTML"?d=h:c=="value"?m=h:c=="checked"?k=h:p&&typeof h!="function"||w[c]===h||ct(t,c,h,w[c],l);if(d)p||a&&(d.__html==a.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(a&&(t.innerHTML=""),Dt(e.type=="template"?t.content:t,ot(g)?g:[g],e,n,o,_=="foreignObject"?"http://www.w3.org/1999/xhtml":l,r,s,r?r[0]:n.__k&&q(n,0),p,u),r!=null)for(c=r.length;c--;)vt(r[c]);p||(c="value",_=="progress"&&m==null?t.removeAttribute("value"):m!=null&&(m!==t[c]||_=="progress"&&!m||_=="option"&&m!=w[c])&&ct(t,c,m,w[c],l),c="checked",k!=null&&k!=t[c]&&ct(t,c,k,w[c],l))}return t}function zt(t,e,n){try{if(typeof t=="function"){var o=typeof t.__u=="function";o&&t.__u(),o&&e==null||(t.__u=t(e))}else t.current=e}catch(l){C.__e(l,n)}}function jt(t,e,n){var o,l;if(C.unmount&&C.unmount(t),(o=t.ref)&&(o.current&&o.current!=t.__e||zt(o,null,e)),(o=t.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(r){C.__e(r,e)}o.base=o.__P=null}if(o=t.__k)for(l=0;l<o.length;l++)o[l]&&jt(o[l],e,n||typeof t.type!="function");n||vt(t.__e),t.__c=t.__=t.__e=void 0}function he(t,e,n){return this.constructor(t,n)}function ue(t,e,n){var o,l,r,s;e==document&&(e=document.documentElement),C.__&&C.__(t,e),l=(o=!1)?null:e.__k,r=[],s=[],kt(e,t=e.__k=ae(O,null,[t]),l||it,it,e.namespaceURI,l?null:e.firstChild?tt.call(e.childNodes):null,r,l?l.__e:e.firstChild,o,s),At(r,t,s)}function ge(t){function e(n){var o,l;return this.getChildContext||(o=new Set,(l={})[e.__c]=this,this.getChildContext=function(){return l},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(r){this.props.value!=r.value&&o.forEach(function(s){s.__e=!0,yt(s)})},this.sub=function(r){o.add(r);var s=r.componentWillUnmount;r.componentWillUnmount=function(){o&&o.delete(r),s&&s.call(r)}}),n.children}return e.__c="__cC"+Pt++,e.__=t,e.Provider=e.__l=(e.Consumer=function(n,o){return n.children(o)}).contextType=e,e}tt=nt.slice,C={__e:function(t,e,n,o){for(var l,r,s;e=e.__;)if((l=e.__c)&&!l.__)try{if((r=l.constructor)&&r.getDerivedStateFromError!=null&&(l.setState(r.getDerivedStateFromError(t)),s=l.__d),l.componentDidCatch!=null&&(l.componentDidCatch(t,o||{}),s=l.__d),s)return l.__E=l}catch(p){t=p}throw t}},$t=0,lt.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=A({},this.state),typeof t=="function"&&(t=t(A({},n),this.props)),t&&A(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),yt(this))},lt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),yt(this))},lt.prototype.render=O,j=[],Tt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Bt=function(t,e){return t.__v.__b-e.__v.__b},at.__r=0,_t=Math.random().toString(8),et="__d"+_t,J="__a"+_t,It=/(PointerCapture)$|Capture$/i,wt=0,bt=Wt(!1),xt=Wt(!0),Pt=0;var fe=0;function i(t,e,n,o,l,r){e||(e={});var s,p,u=e;if("ref"in u)for(p in u={},e)p=="ref"?s=e[p]:u[p]=e[p];var c={type:t,props:u,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--fe,__i:-1,__u:0,__source:l,__self:r};if(typeof t=="function"&&(s=t.defaultProps))for(p in s)u[p]===void 0&&(u[p]=s[p]);return C.vnode&&C.vnode(c),c}let U="",F="";const me=(t,e)=>{U=t,F=e},st=()=>({"Content-Type":"application/json","X-Widget-Key":F}),_e=async()=>{const t=await fetch(`${U}/api/widget/init?key=${F}`);if(!t.ok)throw new Error("Widget init failed");return t.json()},we=async()=>{const t=await fetch(`${U}/api/widget/doctors?key=${F}`);if(!t.ok)throw new Error("Failed to load doctors");return t.json()},be=async(t,e)=>{const n=await fetch(`${U}/api/widget/slots?key=${F}&doctorId=${t}&date=${e}`);if(!n.ok)throw new Error("Failed to load slots");return n.json()},xe=async t=>{const e=await fetch(`${U}/api/widget/book?key=${F}`,{method:"POST",headers:st(),body:JSON.stringify(t)});if(!e.ok)throw new Error("Booking failed");return e.json()},ve=async t=>{const e=await fetch(`${U}/api/widget/lead?key=${F}`,{method:"POST",headers:st(),body:JSON.stringify(t)});if(!e.ok)throw new Error("Submission failed");return e.json()},ye=async(t,e)=>{const n=await fetch(`${U}/api/widget/chat-start?key=${F}`,{method:"POST",headers:st(),body:JSON.stringify({name:t,phone:e})});if(!n.ok)throw new Error("Chat start failed");return n.json()},ke=async(t,e,n)=>{const o=await fetch(`${U}/api/widget/chat?key=${F}`,{method:"POST",headers:st(),body:JSON.stringify({leadId:t,messages:e,branch:n})});if(!o.ok||!o.body)throw new Error("Chat failed");return o.body};var K,L,St,Ot,G=0,Ut=[],M=C,Rt=M.__b,qt=M.__r,Kt=M.diffed,Vt=M.__c,Yt=M.unmount,Jt=M.__;function dt(t,e){M.__h&&M.__h(L,t,G||e),G=0;var n=L.__H||(L.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function v(t){return G=1,Ce(Xt,t)}function Ce(t,e,n){var o=dt(K++,2);if(o.t=t,!o.__c&&(o.__=[Xt(void 0,e),function(p){var u=o.__N?o.__N[0]:o.__[0],c=o.t(u,p);u!==c&&(o.__N=[c,o.__[1]],o.__c.setState({}))}],o.__c=L,!L.__f)){var l=function(p,u,c){if(!o.__c.__H)return!0;var d=o.__c.__H.__.filter(function(g){return g.__c});if(d.every(function(g){return!g.__N}))return!r||r.call(this,p,u,c);var a=o.__c.props!==p;return d.some(function(g){if(g.__N){var h=g.__[0];g.__=g.__N,g.__N=void 0,h!==g.__[0]&&(a=!0)}}),r&&r.call(this,p,u,c)||a};L.__f=!0;var r=L.shouldComponentUpdate,s=L.componentWillUpdate;L.componentWillUpdate=function(p,u,c){if(this.__e){var d=r;r=void 0,l(p,u,c),r=d}s&&s.call(this,p,u,c)},L.shouldComponentUpdate=l}return o.__N||o.__}function W(t,e){var n=dt(K++,3);!M.__s&&Qt(n.__H,e)&&(n.__=t,n.u=e,L.__H.__h.push(n))}function V(t){return G=5,Q(function(){return{current:t}},[])}function Q(t,e){var n=dt(K++,7);return Qt(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function ze(t,e){return G=8,Q(function(){return t},e)}function Se(t){var e=L.context[t.__c],n=dt(K++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(L)),e.props.value):t.__}function Le(){for(var t;t=Ut.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(pt),e.__h.some(Lt),e.__h=[]}catch(n){e.__h=[],M.__e(n,t.__v)}}}M.__b=function(t){L=null,Rt&&Rt(t)},M.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Jt&&Jt(t,e)},M.__r=function(t){qt&&qt(t),K=0;var e=(L=t.__c).__H;e&&(St===L?(e.__h=[],L.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.some(pt),e.__h.some(Lt),e.__h=[],K=0)),St=L},M.diffed=function(t){Kt&&Kt(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Ut.push(e)!==1&&Ot===M.requestAnimationFrame||((Ot=M.requestAnimationFrame)||$e)(Le)),e.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),St=L=null},M.__c=function(t,e){e.some(function(n){try{n.__h.some(pt),n.__h=n.__h.filter(function(o){return!o.__||Lt(o)})}catch(o){e.some(function(l){l.__h&&(l.__h=[])}),e=[],M.__e(o,n.__v)}}),Vt&&Vt(t,e)},M.unmount=function(t){Yt&&Yt(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(o){try{pt(o)}catch(l){e=l}}),n.__H=void 0,e&&M.__e(e,n.__v))};var Gt=typeof requestAnimationFrame=="function";function $e(t){var e,n=function(){clearTimeout(o),Gt&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(n,35);Gt&&(e=requestAnimationFrame(n))}function pt(t){var e=L,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),L=e}function Lt(t){var e=L;t.__c=t.__(),L=e}function Qt(t,e){return!t||t.length!==e.length||e.some(function(n,o){return n!==t[o]})}function Xt(t,e){return typeof e=="function"?e(t):e}const Me="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",Zt=()=>typeof window>"u"||window.turnstile?Promise.resolve():(window.__helixTurnstileLoading||(window.__helixTurnstileLoading=new Promise((t,e)=>{const n=document.createElement("script");n.src=Me,n.async=!0,n.defer=!0,n.onload=()=>{const o=()=>{window.turnstile?t():setTimeout(o,50)};o()},n.onerror=()=>e(new Error("Turnstile failed to load")),document.head.appendChild(n)})),window.__helixTurnstileLoading),Te=({siteKey:t,onToken:e,onError:n})=>{const o=V(null),l=V(null),r=V(null),s=V(e),p=V(n),[u,c]=v("loading");return s.current=e,p.current=n,W(()=>{if(!t||!o.current)return;let d=!1;const a=document.createElement("div");a.setAttribute("data-helix-turnstile",""),a.style.cssText=["position:fixed","z-index:2147483647","width:300px","height:65px","pointer-events:auto"].join(";"),document.body.appendChild(a),l.current=a;const g=()=>{if(!o.current||!l.current)return;const k=o.current.getBoundingClientRect();l.current.style.top=`${k.top}px`,l.current.style.left=`${k.left}px`};g(),window.addEventListener("resize",g),window.addEventListener("scroll",g,!0);let h=0;const m=()=>{g(),h=requestAnimationFrame(m)};return h=requestAnimationFrame(m),Zt().then(()=>{var k;if(!(d||!l.current||!window.turnstile))try{r.current=window.turnstile.render(l.current,{sitekey:t,callback:w=>s.current(w),"error-callback":()=>{var w;c("error"),(w=p.current)==null||w.call(p)},"expired-callback":()=>s.current(""),theme:"light",size:"normal"}),c("ready")}catch{c("error"),(k=p.current)==null||k.call(p)}}).catch(()=>{var k;c("error"),(k=p.current)==null||k.call(p)}),()=>{if(d=!0,cancelAnimationFrame(h),window.removeEventListener("resize",g),window.removeEventListener("scroll",g,!0),r.current&&window.turnstile){try{window.turnstile.remove(r.current)}catch{}r.current=null}a.remove(),l.current=null}},[t]),i("div",{class:"widget-captcha",children:[i("div",{class:"widget-captcha-mount",ref:o}),u==="loading"&&i("div",{class:"widget-captcha-status",children:"Loading verification…"}),u==="error"&&i("div",{class:"widget-captcha-status widget-captcha-error",children:"Verification failed to load. Please refresh."})]})},Be=t=>`
|
|
/* all: initial isolates the widget from host-page style bleed, but we then
|
|
explicitly re-enable font-family inheritance so the widget picks up the
|
|
host page's font stack instead of falling back to system default. */
|
|
:host {
|
|
all: initial;
|
|
font-family: inherit;
|
|
font-size: 14px;
|
|
line-height: 1.4;
|
|
color: #1f2937;
|
|
}
|
|
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }
|
|
|
|
.widget-bubble {
|
|
width: 56px; height: 56px; border-radius: 50%;
|
|
background: #fff; color: ${t.colors.primary};
|
|
display: flex; align-items: center; justify-content: center;
|
|
cursor: pointer; border: 1px solid #e5e7eb;
|
|
box-shadow: 0 6px 20px rgba(17, 24, 39, 0.15), 0 2px 4px rgba(17, 24, 39, 0.08);
|
|
transition: transform 0.2s, box-shadow 0.2s; outline: none;
|
|
}
|
|
.widget-bubble:hover {
|
|
transform: scale(1.08);
|
|
box-shadow: 0 10px 28px rgba(17, 24, 39, 0.2), 0 4px 8px rgba(17, 24, 39, 0.1);
|
|
}
|
|
.widget-bubble img { width: 32px; height: 32px; border-radius: 6px; }
|
|
.widget-bubble svg { width: 26px; height: 26px; }
|
|
|
|
.widget-panel {
|
|
width: 380px; height: 520px; border-radius: 16px;
|
|
background: #fff; box-shadow: 0 8px 32px rgba(0,0,0,0.12);
|
|
display: flex; flex-direction: column; overflow: hidden;
|
|
border: 1px solid #e5e7eb; position: absolute; bottom: 68px; right: 0;
|
|
animation: slideUp 0.25s ease-out;
|
|
transition: width 0.25s ease, height 0.25s ease, border-radius 0.25s ease;
|
|
}
|
|
@keyframes slideUp {
|
|
from { opacity: 0; transform: translateY(12px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
@keyframes widgetFadeIn {
|
|
from { opacity: 0; }
|
|
to { opacity: 1; }
|
|
}
|
|
|
|
/* Maximized modal mode */
|
|
.widget-backdrop {
|
|
position: fixed; inset: 0;
|
|
background: rgba(17, 24, 39, 0.55);
|
|
backdrop-filter: blur(2px);
|
|
animation: widgetFadeIn 0.2s ease-out;
|
|
z-index: 1;
|
|
}
|
|
.widget-panel-maximized {
|
|
position: fixed;
|
|
top: 50%; left: 50%; right: auto; bottom: auto;
|
|
transform: translate(-50%, -50%);
|
|
width: min(960px, 92vw);
|
|
height: min(720px, 88vh);
|
|
max-width: 92vw; max-height: 88vh;
|
|
border-radius: 20px;
|
|
box-shadow: 0 24px 64px rgba(0,0,0,0.25);
|
|
z-index: 2;
|
|
animation: widgetFadeIn 0.2s ease-out;
|
|
}
|
|
|
|
.widget-header {
|
|
display: flex; align-items: center; gap: 10px;
|
|
padding: 14px 16px; background: ${t.colors.primary}; color: #fff;
|
|
}
|
|
.widget-header img { width: 32px; height: 32px; border-radius: 8px; }
|
|
.widget-header-text { flex: 1; min-width: 0; }
|
|
.widget-header-name { font-size: 14px; font-weight: 600; }
|
|
.widget-header-sub { font-size: 11px; opacity: 0.85; }
|
|
.widget-header-branch {
|
|
display: inline-flex; align-items: center; gap: 3px;
|
|
font-weight: 500;
|
|
}
|
|
.widget-header-btn {
|
|
background: none; border: none; color: #fff; cursor: pointer;
|
|
padding: 6px; opacity: 0.8; display: flex; align-items: center;
|
|
justify-content: center; border-radius: 6px; margin-left: 2px;
|
|
transition: background 0.15s, opacity 0.15s;
|
|
}
|
|
.widget-header-btn:hover { opacity: 1; background: rgba(255,255,255,0.15); }
|
|
|
|
.widget-tabs {
|
|
display: flex; border-bottom: 1px solid #e5e7eb; background: #fafafa;
|
|
}
|
|
.widget-tab {
|
|
flex: 1; padding: 10px 0; text-align: center; font-size: 12px;
|
|
font-weight: 500; cursor: pointer; border: none; background: none;
|
|
color: #6b7280; border-bottom: 2px solid transparent;
|
|
transition: all 0.15s; display: inline-flex; align-items: center;
|
|
justify-content: center; gap: 6px;
|
|
}
|
|
.widget-tab.active {
|
|
color: ${t.colors.primary}; border-bottom-color: ${t.colors.primary};
|
|
font-weight: 600;
|
|
}
|
|
|
|
.widget-body { flex: 1; overflow-y: auto; padding: 16px; }
|
|
.widget-panel-maximized .widget-body { padding: 24px 32px; }
|
|
.widget-panel-maximized .widget-tabs { padding: 0 16px; }
|
|
.widget-panel-maximized .widget-tab { padding: 14px 0; font-size: 13px; }
|
|
|
|
.widget-input {
|
|
width: 100%; padding: 10px 12px; border: 1px solid #d1d5db;
|
|
border-radius: 8px; font-size: 13px; outline: none;
|
|
transition: border-color 0.15s;
|
|
}
|
|
.widget-input:focus { border-color: ${t.colors.primary}; }
|
|
.widget-textarea { resize: vertical; min-height: 60px; font-family: inherit; }
|
|
.widget-select {
|
|
width: 100%; padding: 10px 12px; border: 1px solid #d1d5db;
|
|
border-radius: 8px; font-size: 13px; background: #fff; outline: none;
|
|
}
|
|
.widget-label { font-size: 12px; font-weight: 500; color: #374151; margin-bottom: 4px; display: block; }
|
|
.widget-field { margin-bottom: 12px; }
|
|
|
|
.widget-section-title {
|
|
font-size: 13px; font-weight: 600; color: #1f2937;
|
|
margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
|
|
}
|
|
.widget-section-sub {
|
|
font-size: 12px; color: #6b7280; margin-bottom: 16px;
|
|
}
|
|
.widget-error {
|
|
color: #dc2626; font-size: 12px; margin-bottom: 8px;
|
|
padding: 8px 10px; background: #fef2f2; border-radius: 6px;
|
|
border: 1px solid #fecaca;
|
|
}
|
|
|
|
.widget-btn {
|
|
width: 100%; padding: 10px 16px; border: none; border-radius: 8px;
|
|
font-size: 13px; font-weight: 600; cursor: pointer;
|
|
transition: opacity 0.15s; color: #fff; background: ${t.colors.primary};
|
|
}
|
|
.widget-btn:hover { opacity: 0.9; }
|
|
.widget-btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
.widget-btn-secondary { background: #f3f4f6; color: #374151; }
|
|
.widget-btn-with-icon {
|
|
display: inline-flex; align-items: center; justify-content: center; gap: 6px;
|
|
}
|
|
.widget-btn-row {
|
|
display: flex; gap: 8px; margin-top: 12px;
|
|
}
|
|
.widget-btn-row > .widget-btn { flex: 1; }
|
|
|
|
/* Row buttons — department list, doctor list, etc. */
|
|
.widget-row-btn {
|
|
width: 100%; display: flex; align-items: center; gap: 12px;
|
|
padding: 12px 14px; margin-bottom: 6px; border: 1px solid #e5e7eb;
|
|
border-radius: 10px; background: #fff; cursor: pointer;
|
|
text-align: left; color: #1f2937; transition: all 0.15s;
|
|
font-family: inherit;
|
|
}
|
|
.widget-row-btn:hover {
|
|
border-color: ${t.colors.primary};
|
|
background: ${t.colors.primaryLight};
|
|
}
|
|
.widget-row-btn.widget-row-btn-stack { align-items: flex-start; }
|
|
.widget-row-icon {
|
|
display: inline-flex; align-items: center; justify-content: center;
|
|
width: 32px; height: 32px; border-radius: 8px;
|
|
background: ${t.colors.primaryLight}; color: ${t.colors.primary};
|
|
flex-shrink: 0;
|
|
}
|
|
.widget-row-main { flex: 1; min-width: 0; }
|
|
.widget-row-label { font-size: 13px; font-weight: 600; color: #1f2937; }
|
|
.widget-row-sub { font-size: 11px; color: #6b7280; margin-top: 2px; }
|
|
.widget-row-chevron {
|
|
display: inline-flex; color: #9ca3af; flex-shrink: 0;
|
|
}
|
|
.widget-row-btn:hover .widget-row-chevron { color: ${t.colors.primary}; }
|
|
|
|
.widget-slots {
|
|
display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0;
|
|
}
|
|
.widget-slot {
|
|
padding: 8px; text-align: center; font-size: 12px; border-radius: 6px;
|
|
border: 1px solid #e5e7eb; cursor: pointer; background: #fff;
|
|
transition: all 0.15s;
|
|
}
|
|
.widget-slot:hover { border-color: ${t.colors.primary}; }
|
|
.widget-slot.selected { background: ${t.colors.primary}; color: #fff; border-color: ${t.colors.primary}; }
|
|
.widget-slot.unavailable { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }
|
|
|
|
.widget-success {
|
|
text-align: center; padding: 32px 16px;
|
|
display: flex; flex-direction: column; align-items: center;
|
|
}
|
|
.widget-success-icon {
|
|
display: flex; align-items: center; justify-content: center;
|
|
width: 80px; height: 80px; border-radius: 50%;
|
|
background: #ecfdf5; margin-bottom: 16px;
|
|
}
|
|
.widget-success-title { font-size: 16px; font-weight: 600; color: #059669; margin-bottom: 8px; }
|
|
.widget-success-text { font-size: 13px; color: #6b7280; line-height: 1.6; }
|
|
|
|
/* Chat empty state */
|
|
.chat-empty {
|
|
text-align: center; padding: 32px 8px 16px;
|
|
}
|
|
.chat-intro {
|
|
padding: 24px 4px 8px;
|
|
display: flex; flex-direction: column;
|
|
}
|
|
.chat-intro .chat-empty-icon { align-self: center; }
|
|
.chat-intro .chat-empty-title { text-align: center; font-size: 15px; font-weight: 600; color: #1f2937; margin-bottom: 6px; }
|
|
.chat-intro .chat-empty-text { text-align: center; font-size: 12px; color: #6b7280; margin-bottom: 20px; line-height: 1.5; }
|
|
.chat-empty-icon {
|
|
display: flex; align-items: center; justify-content: center;
|
|
margin-bottom: 12px;
|
|
}
|
|
.chat-empty-title {
|
|
font-size: 15px; font-weight: 600; color: #1f2937; margin-bottom: 6px;
|
|
}
|
|
.chat-empty-text {
|
|
font-size: 12px; color: #6b7280; margin-bottom: 18px; line-height: 1.5;
|
|
}
|
|
|
|
.chat-messages { flex: 1; overflow-y: auto; padding: 12px 0; }
|
|
.chat-msg { margin-bottom: 10px; display: flex; }
|
|
.chat-msg.user { justify-content: flex-end; }
|
|
.chat-msg.assistant { justify-content: flex-start; }
|
|
.chat-msg-stack {
|
|
display: flex; flex-direction: column; gap: 6px;
|
|
max-width: 85%;
|
|
}
|
|
.chat-msg.user .chat-msg-stack { align-items: flex-end; }
|
|
.chat-msg.assistant .chat-msg-stack { align-items: flex-start; }
|
|
.chat-bubble {
|
|
padding: 10px 14px; border-radius: 12px;
|
|
font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
|
|
}
|
|
.chat-msg.user .chat-bubble { background: ${t.colors.primary}; color: #fff; border-bottom-right-radius: 4px; }
|
|
.chat-msg.assistant .chat-bubble { background: #f3f4f6; color: #1f2937; border-bottom-left-radius: 4px; }
|
|
|
|
/* Typing indicator (animated dots) */
|
|
.chat-typing-dots {
|
|
display: inline-flex; gap: 4px; align-items: center;
|
|
padding: 2px 0;
|
|
}
|
|
.chat-typing-dots > span {
|
|
width: 6px; height: 6px; border-radius: 50%;
|
|
background: #9ca3af; display: inline-block;
|
|
animation: chatDot 1.4s ease-in-out infinite both;
|
|
}
|
|
.chat-typing-dots > span:nth-child(2) { animation-delay: 0.16s; }
|
|
.chat-typing-dots > span:nth-child(3) { animation-delay: 0.32s; }
|
|
@keyframes chatDot {
|
|
0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
|
|
40% { transform: translateY(-4px); opacity: 1; }
|
|
}
|
|
|
|
/* Generic chat widget (tool UI) container */
|
|
.chat-widget {
|
|
background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
|
|
padding: 12px; font-size: 12px; color: #1f2937;
|
|
width: 100%; max-width: 300px;
|
|
}
|
|
.chat-widget-title {
|
|
font-size: 12px; font-weight: 600; color: #374151;
|
|
display: flex; align-items: center; gap: 6px;
|
|
margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.03em;
|
|
}
|
|
.chat-widget-loading {
|
|
display: inline-flex; align-items: center; gap: 8px;
|
|
padding: 8px 12px; background: #f3f4f6; border-radius: 10px;
|
|
font-size: 12px; color: #6b7280;
|
|
}
|
|
.chat-widget-loading-label { font-style: italic; }
|
|
.chat-widget-empty { font-size: 12px; color: #6b7280; font-style: italic; }
|
|
.chat-widget-error { font-size: 12px; color: #dc2626; padding: 8px 12px; background: #fef2f2; border-radius: 8px; border: 1px solid #fecaca; }
|
|
|
|
/* Branch picker cards */
|
|
.chat-widget-branches .chat-widget-branch-card {
|
|
width: 100%; display: block; text-align: left;
|
|
padding: 10px 12px; margin-bottom: 6px;
|
|
background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
|
|
cursor: pointer; font-family: inherit; transition: all 0.15s;
|
|
}
|
|
.chat-widget-branches .chat-widget-branch-card:last-child { margin-bottom: 0; }
|
|
.chat-widget-branches .chat-widget-branch-card:hover {
|
|
border-color: ${t.colors.primary};
|
|
background: ${t.colors.primaryLight};
|
|
}
|
|
.chat-widget-branch-name { font-size: 13px; font-weight: 600; color: #1f2937; margin-bottom: 2px; }
|
|
.chat-widget-branch-meta { font-size: 11px; color: #6b7280; }
|
|
|
|
/* Department chip grid */
|
|
.chat-widget-dept-grid {
|
|
display: flex; flex-wrap: wrap; gap: 6px;
|
|
}
|
|
.chat-widget-dept-chip {
|
|
display: inline-flex; align-items: center; gap: 6px;
|
|
padding: 6px 10px; border-radius: 999px;
|
|
border: 1px solid ${t.colors.primary};
|
|
background: ${t.colors.primaryLight};
|
|
color: ${t.colors.primary};
|
|
font-size: 11px; font-weight: 500; cursor: pointer;
|
|
font-family: inherit; transition: all 0.15s;
|
|
}
|
|
.chat-widget-dept-chip:hover {
|
|
background: ${t.colors.primary}; color: #fff;
|
|
}
|
|
|
|
/* Doctor cards */
|
|
.chat-widget-doctor-card {
|
|
padding: 10px; background: #f9fafb; border-radius: 8px;
|
|
border: 1px solid #f3f4f6; margin-bottom: 6px;
|
|
}
|
|
.chat-widget-doctor-card:last-child { margin-bottom: 0; }
|
|
.chat-widget-doctor-name { font-size: 13px; font-weight: 600; color: #1f2937; margin-bottom: 2px; }
|
|
.chat-widget-doctor-meta { font-size: 11px; color: #6b7280; line-height: 1.4; }
|
|
.chat-widget-doctor-action {
|
|
margin-top: 8px; width: 100%;
|
|
display: inline-flex; align-items: center; justify-content: center; gap: 6px;
|
|
padding: 6px 10px; font-size: 11px; font-weight: 600;
|
|
color: ${t.colors.primary};
|
|
background: #fff;
|
|
border: 1px solid ${t.colors.primary};
|
|
border-radius: 6px; cursor: pointer;
|
|
font-family: inherit; transition: all 0.15s;
|
|
}
|
|
.chat-widget-doctor-action:hover {
|
|
background: ${t.colors.primary}; color: #fff;
|
|
}
|
|
|
|
/* Clinic timings widget */
|
|
.chat-widget-timings .chat-widget-timing-dept {
|
|
margin-bottom: 10px; padding-bottom: 8px;
|
|
border-bottom: 1px solid #f3f4f6;
|
|
}
|
|
.chat-widget-timings .chat-widget-timing-dept:last-child {
|
|
margin-bottom: 0; padding-bottom: 0; border-bottom: 0;
|
|
}
|
|
.chat-widget-timing-dept-name {
|
|
display: flex; align-items: center; gap: 6px;
|
|
font-size: 12px; font-weight: 600; color: ${t.colors.primary};
|
|
margin-bottom: 4px;
|
|
}
|
|
.chat-widget-timing-row {
|
|
padding: 4px 0 4px 22px;
|
|
}
|
|
.chat-widget-timing-doctor {
|
|
font-size: 12px; font-weight: 500; color: #1f2937;
|
|
}
|
|
.chat-widget-timing-hours {
|
|
font-size: 11px; color: #4b5563; line-height: 1.4;
|
|
}
|
|
.chat-widget-timing-clinic {
|
|
font-size: 11px; color: #9ca3af; font-style: italic;
|
|
}
|
|
|
|
/* Slots grid widget */
|
|
.chat-widget-slots-doctor { font-size: 13px; font-weight: 600; color: #1f2937; }
|
|
.chat-widget-slots-meta { font-size: 11px; color: #6b7280; margin-bottom: 8px; }
|
|
.chat-widget-slots-grid {
|
|
display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
|
|
}
|
|
.chat-widget-slot-btn {
|
|
padding: 8px 6px; font-size: 12px; font-weight: 500;
|
|
color: ${t.colors.primary};
|
|
background: ${t.colors.primaryLight};
|
|
border: 1px solid ${t.colors.primary};
|
|
border-radius: 6px; cursor: pointer;
|
|
font-family: inherit; transition: all 0.15s;
|
|
}
|
|
.chat-widget-slot-btn:hover {
|
|
background: ${t.colors.primary}; color: #fff;
|
|
}
|
|
.chat-widget-slot-btn.unavailable {
|
|
color: #9ca3af; background: #f3f4f6;
|
|
border-color: #e5e7eb; cursor: not-allowed;
|
|
text-decoration: line-through;
|
|
}
|
|
|
|
/* Booking suggestion card */
|
|
.chat-widget-booking {
|
|
display: flex; gap: 12px; align-items: flex-start;
|
|
background: ${t.colors.primaryLight};
|
|
border-color: ${t.colors.primary};
|
|
}
|
|
.chat-widget-booking-icon {
|
|
flex-shrink: 0; width: 40px; height: 40px;
|
|
border-radius: 10px; background: #fff;
|
|
display: flex; align-items: center; justify-content: center;
|
|
color: ${t.colors.primary};
|
|
}
|
|
.chat-widget-booking-body { flex: 1; min-width: 0; }
|
|
.chat-widget-booking-title { font-size: 13px; font-weight: 600; color: #1f2937; margin-bottom: 2px; }
|
|
.chat-widget-booking-reason { font-size: 12px; color: #4b5563; line-height: 1.5; margin-bottom: 6px; }
|
|
.chat-widget-booking-dept { font-size: 11px; color: ${t.colors.primary}; font-weight: 500; margin-bottom: 8px; }
|
|
.chat-widget-booking .widget-btn { padding: 8px 14px; font-size: 12px; }
|
|
|
|
.chat-input-row { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid #e5e7eb; }
|
|
.chat-input { flex: 1; }
|
|
.chat-send {
|
|
width: 36px; height: 36px; border-radius: 8px;
|
|
background: ${t.colors.primary}; color: #fff;
|
|
border: none; cursor: pointer; display: flex;
|
|
align-items: center; justify-content: center;
|
|
flex-shrink: 0;
|
|
}
|
|
.chat-send:hover { opacity: 0.9; }
|
|
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
|
|
.quick-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 12px; }
|
|
.quick-action {
|
|
padding: 6px 12px; border-radius: 16px; font-size: 11px;
|
|
border: 1px solid ${t.colors.primary}; color: ${t.colors.primary};
|
|
background: ${t.colors.primaryLight}; cursor: pointer;
|
|
transition: all 0.15s; font-family: inherit;
|
|
}
|
|
.quick-action:hover { background: ${t.colors.primary}; color: #fff; }
|
|
|
|
.widget-steps { display: flex; gap: 4px; margin-bottom: 16px; }
|
|
.widget-step {
|
|
flex: 1; height: 3px; border-radius: 2px; background: #e5e7eb;
|
|
}
|
|
.widget-step.active { background: ${t.colors.primary}; }
|
|
.widget-step.done { background: #059669; }
|
|
|
|
/* Captcha gate — full-panel verification screen */
|
|
.widget-captcha-gate {
|
|
flex: 1; display: flex; flex-direction: column; align-items: center;
|
|
justify-content: center; padding: 32px 24px; text-align: center;
|
|
background: #fafafa;
|
|
}
|
|
.widget-captcha-gate-icon {
|
|
display: flex; align-items: center; justify-content: center;
|
|
width: 96px; height: 96px; border-radius: 50%;
|
|
background: ${t.colors.primaryLight}; margin-bottom: 20px;
|
|
}
|
|
.widget-captcha-gate-title {
|
|
font-size: 17px; font-weight: 600; color: #1f2937; margin-bottom: 8px;
|
|
}
|
|
.widget-captcha-gate-text {
|
|
font-size: 13px; color: #6b7280; margin-bottom: 24px; line-height: 1.5;
|
|
max-width: 280px;
|
|
}
|
|
.widget-captcha {
|
|
display: flex; flex-direction: column; align-items: center;
|
|
gap: 8px; width: 100%;
|
|
}
|
|
/* Placeholder reserves space for the Turnstile widget which is portaled to
|
|
document.body (light DOM) and visually positioned over this element. */
|
|
.widget-captcha-mount {
|
|
width: 300px; height: 65px;
|
|
display: block;
|
|
}
|
|
.widget-captcha-status {
|
|
font-size: 11px; color: #6b7280; text-align: center;
|
|
}
|
|
.widget-captcha-error { color: #dc2626; }
|
|
`,Ie={"message-dots":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path opacity=".4" fill="currentColor" d="M0 128L0 352c0 53 43 96 96 96l32 0 0 72c0 13.3 10.7 24 24 24 5.2 0 10.2-1.7 14.4-4.8l115.2-86.4c4.2-3.1 9.2-4.8 14.4-4.8l120 0c53 0 96-43 96-96l0-224c0-53-43-96-96-96L96 32C43 32 0 75 0 128zM160 240a32 32 0 1 1 -64 0 32 32 0 1 1 64 0zm128 0a32 32 0 1 1 -64 0 32 32 0 1 1 64 0zm128 0a32 32 0 1 1 -64 0 32 32 0 1 1 64 0z"/><path fill="currentColor" d="M96 240a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm128 0a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm160-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>',calendar:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path opacity=".4" fill="currentColor" d="M0 160l448 0 0 272c0 26.5-21.5 48-48 48L48 480c-26.5 0-48-21.5-48-48L0 160z"/><path fill="currentColor" d="M160 32c0-17.7-14.3-32-32-32S96 14.3 96 32l0 32-48 0C21.5 64 0 85.5 0 112l0 48 448 0 0-48c0-26.5-21.5-48-48-48l-48 0 0-32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 32-128 0 0-32z"/></svg>',phone:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path opacity=".4" fill="currentColor" d="M86.8 90l19 47c5 12.3 19 18.2 31.2 13.3s18.2-19 13.3-31.2l-19-47c-5-12.3-19-18.2-31.2-13.3-12.3 5-18.2 19-13.3 31.2zm275 285c-5 12.3 1 26.3 13.3 31.2l47 19c12.3 5 26.3-1 31.2-13.3s-1-26.3-13.3-31.2l-47-19c-12.3-5-26.3 1-31.2 13.3z"/><path fill="currentColor" d="M112.1 1.4c19.7-5.4 40.3 4.7 48.1 23.5l40.5 97.3c6.9 16.5 2.1 35.6-11.8 47l-44.1 36.1c32.5 71.6 89 130 159.3 164.9L342.8 323c11.3-13.9 30.4-18.6 47-11.8L487 351.8c18.8 7.8 28.9 28.4 23.5 48.1l-1.5 5.5C491.4 470.1 428.9 525.3 352.6 509.2 177.6 472.1 39.9 334.4 2.8 159.4-13.3 83.1 41.9 20.6 106.5 2.9l5.5-1.5zM131.3 72c-5-12.3-19-18.2-31.2-13.3S81.8 77.7 86.8 90l19 47c5 12.3 19 18.2 31.2 13.3s18.2-19 13.3-31.2l-19-47zM393 361.7c-12.3-5-26.3 1-31.2 13.3s1 26.3 13.3 31.2l47 19c12.3 5 26.3-1 31.2-13.3s-1-26.3-13.3-31.2l-47-19z"/></svg>',"paper-plane-top":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path opacity=".4" fill="currentColor" d="M32 479c0 18.1 14.7 33 32.8 33 4.7 0 9.4-1 13.7-3L554.2 290c13.3-6.1 21.8-19.4 21.8-34l-448 0-93.2 209.6C33 469.8 32 474.4 32 479z"/><path fill="currentColor" d="M78.5 3L554.2 222c13.3 6.1 21.8 19.4 21.8 34L128 256 34.8 46.4C33 42.2 32 37.6 32 33 32 14.8 46.7 0 64.8 0 69.5 0 74.2 1 78.5 3z"/></svg>',xmark:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"/></svg>',"circle-check":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path opacity=".4" fill="currentColor" d="M0 256a256 256 0 1 0 512 0 256 256 0 1 0 -512 0zm135.1 7.1c9.4-9.4 24.6-9.4 33.9 0L221.1 315.2 340.5 151c7.8-10.7 22.8-13.1 33.5-5.3s13.1 22.8 5.3 33.5L243.4 366.1c-4.1 5.7-10.5 9.3-17.5 9.8s-13.9-2-18.8-7l-72-72c-9.4-9.4-9.4-24.6 0-33.9z"/><path fill="currentColor" d="M340.5 151c7.8-10.7 22.8-13.1 33.5-5.3s13.1 22.8 5.3 33.5L243.4 366.1c-4.1 5.7-10.5 9.3-17.5 9.8s-13.9-2-18.8-7l-72-72c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0L221.1 315.2 340.5 151z"/></svg>',sparkles:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path opacity=".4" fill="currentColor" d="M352 448c0 4.8 3 9.1 7.5 10.8L416 480 437.2 536.5c1.7 4.5 6 7.5 10.8 7.5s9.1-3 10.8-7.5L480 480 536.5 458.8c4.5-1.7 7.5-6 7.5-10.8s-3-9.1-7.5-10.8L480 416 458.8 359.5c-1.7-4.5-6-7.5-10.8-7.5s-9.1 3-10.8 7.5L416 416 359.5 437.2c-4.5 1.7-7.5 6-7.5 10.8zM384 64c0 4.8 3 9.1 7.5 10.8L448 96 469.2 152.5c1.7 4.5 6 7.5 10.8 7.5s9.1-3 10.8-7.5L512 96 568.5 74.8c4.5-1.7 7.5-6 7.5-10.8s-3-9.1-7.5-10.8L512 32 490.8-24.5c-1.7-4.5-6-7.5-10.8-7.5s-9.1 3-10.8 7.5L448 32 391.5 53.2c-4.5 1.7-7.5 6-7.5 10.8z"/><path fill="currentColor" d="M205.1 73.3c-2.6-5.7-8.3-9.3-14.5-9.3s-11.9 3.6-14.5 9.3L123.4 187.4 9.3 240C3.6 242.6 0 248.3 0 254.6s3.6 11.9 9.3 14.5L123.4 321.8 176 435.8c2.6 5.7 8.3 9.3 14.5 9.3s11.9-3.6 14.5-9.3l52.7-114.1 114.1-52.7c5.7-2.6 9.3-8.3 9.3-14.5s-3.6-11.9-9.3-14.5L257.8 187.4 205.1 73.3z"/></svg>',"hands-praying":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path opacity=".4" fill="currentColor" d="M352 224l0 119.6c0 57.2 37.9 107.4 92.8 123.1l154.4 44.1c9.7 2.8 20 .8 28.1-5.2S640 490 640 480l0-96c0-13.8-8.8-26-21.9-30.4l-58.1-19.4 0-110.7c0-29-9.3-57.3-26.5-80.7L440.2 16.3C427.1-1.5 402.1-5.3 384.3 7.8s-21.6 38.1-8.5 55.9L464 183.4 464 296c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-72c0-17.7-14.3-32-32-32s-32 14.3-32 32z"/><path fill="currentColor" d="M200 320c13.3 0 24-10.7 24-24l0-72c0-17.7 14.3-32 32-32s32 14.3 32 32l0 119.6c0 57.2-37.9 107.4-92.8 123.1L40.8 510.8c-9.7 2.8-20 .8-28.1-5.2S0 490 0 480l0-96c0-13.8 8.8-26 21.9-30.4L80 334.3 80 223.6c0-29 9.3-57.3 26.5-80.7L199.8 16.3c13.1-17.8 38.1-21.6 55.9-8.5s21.6 38.1 8.5 55.9L176 183.4 176 296c0 13.3 10.7 24 24 24z"/></svg>',"hand-wave":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path opacity=".4" fill="currentColor" d="M73.4 265.4c-12.5 12.5-12.5 32.8 0 45.3 8.8 8.8 55.2 55.2 139.1 139.1l4.9 4.9c22.2 22.2 49.2 36.9 77.6 44.1 58 17 122.8 6.6 173.6-32.7 47.6-36.8 75.5-93.5 75.5-153.7L544 136c0-22.1-17.9-40-40-40s-40 17.9-40 40l0 77.7c0 4.7-6 7-9.4 3.7l-192-192c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L344 197.3c5.2 5.2 5.2 13.6 0 18.7s-13.6 5.2-18.7 0L182.6 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L280 261.3c5.2 5.2 5.2 13.6 0 18.7s-13.6 5.2-18.7 0L134.6 153.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L216 325.3c5.2 5.2 5.2 13.6 0 18.7s-13.6 5.2-18.7 0c-33.5-33.5-59.8-59.8-78.6-78.6-12.5-12.5-32.8-12.5-45.3 0z"/><path fill="currentColor" d="M392.2 67.4c1.9 13.1 14 22.2 27.2 20.4s22.2-14 20.4-27.2l-1.2-8.5c-5.5-38.7-36-69.1-74.7-74.7l-8.5-1.2c-13.1-1.9-25.3 7.2-27.2 20.4s7.2 25.3 20.4 27.2l8.5 1.2c17.6 2.5 31.4 16.3 33.9 33.9l1.2 8.5zM55.8 380.6c-1.9-13.1-14-22.2-27.2-20.4s-22.2 14-20.4 27.2l1.2 8.5c5.5 38.7 36 69.1 74.7 74.7l8.5 1.2c13.1 1.9 25.3-7.2 27.2-20.4s-7.2-25.3-20.4-27.2L90.9 423c-17.6-2.5-31.4-16.3-33.9-33.9l-1.2-8.5z"/></svg>',"shield-check":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path opacity=".4" fill="currentColor" d="M16 140c.5 99.2 41.3 280.7 213.6 363.2 16.7 8 36.1 8 52.7 0 172.4-82.5 213.2-263.9 213.7-363.2 .1-26.2-16.3-47.9-38.3-57.2L269.4 2.9C265.3 1 260.7 0 256.1 0s-9.2 1-13.4 2.9L54.3 82.8c-22 9.3-38.4 31-38.3 57.2zM166.8 293.5c-9.2-9.5-9-24.7 .6-33.9 9.5-9.2 24.7-9 33.9 .6 8.8 9.1 17.7 18.3 26.5 27.4 28.5-39.2 57.1-78.5 85.6-117.7 7.8-10.7 22.8-13.1 33.5-5.3s13.1 22.8 5.3 33.5c-34.1 46.9-68.3 93.9-102.4 140.8-4.2 5.7-10.7 9.4-17.8 9.8s-14-2.2-18.9-7.3c-15.5-16-30.9-32-46.4-48z"/><path fill="currentColor" d="M313.4 169.9c7.8-10.7 22.8-13.1 33.5-5.3s13.1 22.8 5.3 33.5L249.8 338.9c-4.2 5.7-10.7 9.4-17.8 9.8s-14-2.2-18.9-7.3l-46.4-48c-9.2-9.5-9-24.7 .6-33.9s24.7-8.9 33.9 .6l26.5 27.4 85.6-117.7z"/></svg>',"arrow-left":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path opacity=".4" fill="currentColor" d="M77.3 256l32 32 370.7 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-370.7 0-32 32z"/><path fill="currentColor" d="M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l160-160c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L77.3 256 214.6 393.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0l-160-160z"/></svg>',"arrow-right":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path opacity=".4" fill="currentColor" d="M0 256c0 17.7 14.3 32 32 32l370.7 0 32-32-32-32-370.7 0c-17.7 0-32 14.3-32 32z"/><path fill="currentColor" d="M502.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L434.7 256 297.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg>',"up-right-and-down-left-from-center":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path opacity=".4" fill="currentColor" d="M0 344L0 488c0 13.3 10.7 24 24 24l144 0c9.7 0 18.5-5.8 22.2-14.8s1.7-19.3-5.2-26.2l-39-39 87-87c9.4-9.4 9.4-24.6 0-33.9l-32-32c-9.4-9.4-24.6-9.4-33.9 0l-87 87-39-39c-6.9-6.9-17.2-8.9-26.2-5.2S0 334.3 0 344z"/><path fill="currentColor" d="M488 0L344 0c-9.7 0-18.5 5.8-22.2 14.8S320.2 34.1 327 41l39 39-87 87c-9.4 9.4-9.4 24.6 0 33.9l32 32c9.4 9.4 24.6 9.4 33.9 0l87-87 39 39c6.9 6.9 17.2 8.9 26.2 5.2S512 177.7 512 168l0-144c0-13.3-10.7-24-24-24z"/></svg>',"down-left-and-up-right-to-center":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path opacity=".4" fill="currentColor" d="M7.5 439c-9.4 9.4-9.4 24.6 0 33.9l32 32c9.4 9.4 24.6 9.4 33.9 0l87-87 39 39c6.9 6.9 17.2 8.9 26.2 5.2s14.8-12.5 14.8-22.2l0-144c0-13.3-10.7-24-24-24l-144 0c-9.7 0-18.5 5.8-22.2 14.8s-1.7 19.3 5.2 26.2l39 39-87 87z"/><path fill="currentColor" d="M473.5 7c-9.4-9.4-24.6-9.4-33.9 0l-87 87-39-39c-6.9-6.9-17.2-8.9-26.2-5.2S272.5 62.3 272.5 72l0 144c0 13.3 10.7 24 24 24l144 0c9.7 0 18.5-5.8 22.2-14.8s1.7-19.3-5.2-26.2l-39-39 87-87c9.4-9.4 9.4-24.6 0-33.9l-32-32z"/></svg>',hospital:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path opacity=".4" fill="currentColor" d="M0 192L0 448c0 35.3 28.7 64 64 64l176 0 0-112c0-17.7 14.3-32 32-32l32 0c17.7 0 32 14.3 32 32l0 112 176 0c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64l-64 0 0-64c0-35.3-28.7-64-64-64L192 0c-35.3 0-64 28.7-64 64l0 64-64 0c-35.3 0-64 28.7-64 64zm64 16c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm0 128c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zM216 152c0-8.8 7.2-16 16-16l32 0 0-32c0-8.8 7.2-16 16-16l16 0c8.8 0 16 7.2 16 16l0 32 32 0c8.8 0 16 7.2 16 16l0 16c0 8.8-7.2 16-16 16l-32 0 0 32c0 8.8-7.2 16-16 16l-16 0c-8.8 0-16-7.2-16-16l0-32-32 0c-8.8 0-16-7.2-16-16l0-16zm232 56c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm0 128c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32z"/><path fill="currentColor" d="M264 104c0-8.8 7.2-16 16-16l16 0c8.8 0 16 7.2 16 16l0 32 32 0c8.8 0 16 7.2 16 16l0 16c0 8.8-7.2 16-16 16l-32 0 0 32c0 8.8-7.2 16-16 16l-16 0c-8.8 0-16-7.2-16-16l0-32-32 0c-8.8 0-16-7.2-16-16l0-16c0-8.8 7.2-16 16-16l32 0 0-32zM112 256l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16zm16 112c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32zm112 32c0-17.7 14.3-32 32-32l32 0c17.7 0 32 14.3 32 32l0 112-96 0 0-112zm272-32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32zM496 256l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16z"/></svg>',"location-dot":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path opacity=".4" fill="currentColor" d="M0 188.6c0 119.3 120.2 262.3 170.4 316.8 11.8 12.8 31.5 12.8 43.3 0 50.2-54.5 170.4-197.5 170.4-316.8 0-104.1-86-188.6-192-188.6S0 84.4 0 188.6zM256 192a64 64 0 1 1 -128 0 64 64 0 1 1 128 0z"/><path fill="currentColor" d="M128 192a64 64 0 1 1 128 0 64 64 0 1 1 -64 0z"/></svg>',stethoscope:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path opacity=".4" fill="currentColor" d="M160 348.8c10.3 2.1 21 3.2 32 3.2s21.7-1.1 32-3.2l0 19.2c0 61.9 50.1 112 112 112s112-50.1 112-112l0-85.5c10 3.5 20.8 5.5 32 5.5s22-1.9 32-5.5l0 85.5c0 97.2-78.8 176-176 176S160 465.2 160 368l0-19.2z"/><path fill="currentColor" d="M80 0C53.5 0 32 21.5 32 48l0 144c0 88.4 71.6 160 160 160s160-71.6 160-160l0-144c0-26.5-21.5-48-48-48L256 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0 0 128c0 53-43 96-96 96s-96-43-96-96l0-128 32 0c17.7 0 32-14.3 32-32S145.7 0 128 0L80 0zM448 192a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm128 0a96 96 0 1 0 -192 0 96 96 0 1 0 192 0z"/></svg>',"heart-pulse":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path opacity=".4" fill="currentColor" d="M0 165.1l0 2.6c0 23.6 6.2 48 16.6 72.3l106 0c3.2 0 6.1-1.9 7.4-4.9l31.8-76.3c3.7-8.8 12.3-14.6 21.8-14.8s18.3 5.4 22.2 14.1l51.3 113.9 41.4-82.8c4.1-8.1 12.4-13.3 21.5-13.3s17.4 5.1 21.5 13.3l23.2 46.3c1.4 2.7 4.1 4.4 7.2 4.4l123.6 0c10.5-24.3 16.6-48.7 16.6-72.3l0-2.6C512 91.6 452.4 32 378.9 32 336.2 32 296 52.5 271 87.1l-15 20.7-15-20.7C216 52.5 175.9 32 133.1 32 59.6 32 0 91.6 0 165.1zM42.5 288c47.2 73.8 123 141.7 170.4 177.9 12.4 9.4 27.6 14.1 43.1 14.1s30.8-4.6 43.1-14.1C346.6 429.7 422.4 361.8 469.6 288l-97.8 0c-21.2 0-40.6-12-50.1-31l-1.7-3.4-42.5 85.1c-4.1 8.3-12.7 13.5-22 13.3s-17.6-5.7-21.4-14.1l-49.3-109.5-10.5 25.2c-8.7 20.9-29.1 34.5-51.7 34.5l-80.2 0z"/><path fill="currentColor" d="M42.5 288c-10.1-15.8-18.9-31.9-25.8-48l106 0c3.2 0 6.1-1.9 7.4-4.9l31.8-76.3c3.7-8.8 12.3-14.6 21.8-14.8s18.3 5.4 22.2 14.1l51.3 113.9 41.4-82.8c4.1-8.1 12.4-13.3 21.5-13.3s17.4 5.1 21.5 13.3l23.2 46.3c1.4 2.7 4.1 4.4 7.2 4.4l123.6 0c-6.9 16.1-15.7 32.2-25.8 48l-97.8 0c-21.2 0-40.6-12-50.1-31l-1.7-3.4-42.5 85.1c-4.1 8.3-12.7 13.5-22 13.3s-17.6-5.7-21.4-14.1l-49.3-109.5-10.5 25.2c-8.7 20.9-29.1 34.5-51.7 34.5l-80.2 0z"/></svg>',bone:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M197.4 160c-3.9 0-7.2-2.8-8.1-6.6-10.2-42.1-48.1-73.4-93.3-73.4-53 0-96 43-96 96 0 29.1 12.9 55.1 33.3 72.7 4.3 3.7 4.3 10.8 0 14.5-20.4 17.6-33.3 43.7-33.3 72.7 0 53 43 96 96 96 45.2 0 83.1-31.3 93.3-73.4 .9-3.8 4.2-6.6 8.1-6.6l245.1 0c3.9 0 7.2 2.8 8.1 6.6 10.2 42.1 48.1 73.4 93.3 73.4 53 0 96-43 96-96 0-29.1-12.9-55.1-33.3-72.7-4.3-3.7-4.3-10.8 0-14.5 20.4-17.6 33.3-43.7 33.3-72.7 0-53-43-96-96-96-45.2 0-83.1 31.3-93.3 73.4-.9 3.8-4.2 6.6-8.1 6.6l-245.1 0z"/></svg>',"person-pregnant":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path opacity=".4" fill="currentColor" d="M136 24a56 56 0 1 0 112 0 56 56 0 1 0 -112 0z"/><path fill="currentColor" d="M74.6 305.8l29-43.5-30.5 113.5c-2.6 9.6-.6 19.9 5.5 27.8S94 416 104 416l8 0 0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96 32 0 0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-110.8c8.6-4.5 16.8-10 24.3-16.5l4-3.4c22.6-19.4 35.7-47.7 35.7-77.6 0-35.9-18.8-69.1-49.6-87.6l-30.4-18.2 0-1.8c0-46.5-37.7-84.1-84.1-84.1-28.1 0-54.4 14.1-70 37.5L21.4 270.2c-9.8 14.7-5.8 34.6 8.9 44.4s34.6 5.8 44.4-8.9z"/></svg>',ear:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path opacity=".4" fill="currentColor" d="M0 192L0 384c0 70.7 57.3 128 128 128l9.3 0c52.3 0 99.4-31.9 118.8-80.5l20.1-50.2c5.5-13.7 15.8-24.8 27.8-33.4 48.4-34.9 80-91.7 80-156 0-106-86-192-192-192S0 86 0 192zm64 0c0-70.7 57.3-128 128-128s128 57.3 128 128l0 8c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-8c0-44.2-35.8-80-80-80s-80 35.8-80 80l0 16.4c36 4 64 34.5 64 71.6 0 39.8-32.2 72-72 72l-16 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-16 0c-13.3 0-24-10.7-24-24l0-40z"/><path fill="currentColor" d="M192 112c-44.2 0-80 35.8-80 80l0 16.4c36 4 64 34.5 64 71.6 0 39.8-32.2 72-72 72l-16 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-16 0c-13.3 0-24-10.7-24-24l0-40c0-70.7 57.3-128 128-128s128 57.3 128 128l0 8c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-8c0-44.2-35.8-80-80-80z"/></svg>',baby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path opacity=".4" fill="currentColor" d="M7.7 144.5c13-17.9 38-21.8 55.9-8.8L99.8 162c26.8 19.5 59.1 30 92.2 30s65.4-10.5 92.2-30l36.2-26.4c17.9-13 42.9-9 55.9 8.8s9 42.9-8.8 55.9l-36.2 26.4c-13.6 9.9-28.1 18.2-43.3 25l0 36.3-192 0 0-36.3c-15.2-6.7-29.7-15.1-43.3-25L16.5 200.3c-17.9-13-21.8-38-8.8-55.9zM47.2 401.1l50.2-71.8c20.2 17.7 40.4 35.3 60.6 53l-26 37.2 24.3 24.3c15.6 15.6 15.6 40.9 0 56.6s-40.9 15.6-56.6 0l-48-48C38 438.6 36.1 417 47.2 401.1zM264 88a72 72 0 1 1 -144 0 72 72 0 1 1 144 0zM226 382.3c20.2-17.7 40.4-35.3 60.6-53l50.2 71.8c11.1 15.9 9.2 37.5-4.5 51.2l-48 48c-15.6 15.6-40.9 15.6-56.6 0s-15.6-40.9 0-56.6l24.3-24.3-26-37.2z"/><path fill="currentColor" d="M160 384l-64-56 0-40 192 0 0 40-64 56-64 0z"/></svg>',brain:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path opacity=".4" fill="currentColor" d="M8 272c0 26.2 12.6 49.4 32 64-10 13.4-16 30-16 48 0 44.2 35.8 80 80 80 .7 0 1.3 0 2 0 7.1 27.6 32.2 48 62 48l32 0c17.7 0 32-14.3 32-32l0-448c0-17.7-14.3-32-32-32L176 0c-30.9 0-56 25.1-56 56l0 24c-44.2 0-80 35.8-80 80 0 15 4.1 29 11.2 40.9-25.7 13.3-43.2 40.1-43.2 71.1zM280 32l0 448c0 17.7 14.3 32 32 32l32 0c29.8 0 54.9-20.4 62-48 .7 0 1.3 0 2 0 44.2 0 80-35.8 80-80 0-18-6-34.6-16-48 19.4-14.6 32-37.8 32-64 0-30.9-17.6-57.8-43.2-71.1 7.1-12 11.2-26 11.2-40.9 0-44.2-35.8-80-80-80l0-24c0-30.9-25.1-56-56-56L312 0c-17.7 0-32 14.3-32 32z"/><path fill="currentColor" d="M232 32l48 0 0 448-48 0 0-448z"/></svg>',eye:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path opacity=".4" fill="currentColor" d="M2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6 14.9 35.7 46.2 87.7 93 131.1 47.1 43.7 111.8 80.6 192.6 80.6s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1-47.1-43.7-111.8-80.6-192.6-80.6S142.5 68.8 95.4 112.6C48.6 156 17.3 208 2.5 243.7zM432 256a144 144 0 1 1 -288 0 144 144 0 1 1 288 0z"/><path fill="currentColor" d="M288 192c0 35.3-28.7 64-64 64-11.5 0-22.3-3-31.7-8.4-1 10.9-.1 22.1 2.9 33.2 13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-12.2-45.7-55.5-74.8-101.1-70.8 5.3 9.3 8.4 20.1 8.4 31.7z"/></svg>',tooth:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M145 5.7L224 32 303 5.7C314.3 1.9 326 0 337.9 0 398.7 0 448 49.3 448 110.1l0 68.5c0 29.4-9.5 58.1-27.2 81.6l-1.1 1.5c-12.9 17.2-21.3 37.4-24.3 58.7L373.7 471.9c-3.3 23-23 40.1-46.2 40.1-22.8 0-42.3-16.5-46-39L261.3 351.6c-3-18.2-18.8-31.6-37.3-31.6s-34.2 13.4-37.3 31.6L166.5 473c-3.8 22.5-23.2 39-46 39-23.2 0-42.9-17.1-46.2-40.1L52.6 320.5c-3-21.3-11.4-41.5-24.3-58.7l-1.1-1.5C9.5 236.7 0 208.1 0 178.7l0-68.5C0 49.3 49.3 0 110.1 0 122 0 133.7 1.9 145 5.7z"/></svg>'},Pe=(t,e=16,n="currentColor")=>Ie[t].replace("<svg",`<svg width="${e}" height="${e}" style="vertical-align:middle;color:${n};flex-shrink:0"`),X=t=>{const e=t.toLowerCase().replace(/_/g," ");return e.includes("cardio")||e.includes("heart")?"heart-pulse":e.includes("ortho")||e.includes("bone")||e.includes("spine")?"bone":e.includes("gyn")||e.includes("obstet")||e.includes("maternity")||e.includes("pregnan")?"person-pregnant":e.includes("ent")||e.includes("otolaryn")||e.includes("ear")||e.includes("nose")||e.includes("throat")?"ear":e.includes("pediatric")||e.includes("paediatric")||e.includes("child")||e.includes("neonat")?"baby":e.includes("neuro")||e.includes("psych")||e.includes("mental")?"brain":e.includes("ophthal")||e.includes("eye")||e.includes("vision")||e.includes("retina")?"eye":e.includes("dental")||e.includes("dent")||e.includes("tooth")?"tooth":"stethoscope"},y=({name:t,size:e=16,color:n="currentColor",class:o})=>{const l=Pe(t,e,n);return i("span",{class:o,dangerouslySetInnerHTML:{__html:l}})};async function*Ne(t){const e=t.getReader(),n=new TextDecoder;let o="";try{for(;;){const{done:l,value:r}=await e.read();if(l)break;o+=n.decode(r,{stream:!0});let s;for(;(s=o.indexOf(`
|
|
|
|
`))!==-1;){const p=o.slice(0,s);o=o.slice(s+2);const u=p.split(`
|
|
`);for(const c of u){if(!c.startsWith("data:"))continue;const d=c.slice(5).trimStart();if(!(!d||d==="[DONE]"))try{yield JSON.parse(d)}catch{}}}}}finally{e.releaseLock()}}const De=({part:t,onDepartmentClick:e,onShowDoctorSlots:n,onSuggestBooking:o,onPickSlot:l,onPickBranch:r})=>{var s,p,u,c;if(t.state==="input-streaming"||t.state==="input-available")return i(Ee,{toolName:t.toolName});if(t.state==="output-error")return i("div",{class:"chat-widget-error",children:["Couldn't load: ",t.errorText??"unknown error"]});switch(t.toolName){case"pick_branch":{const d=t.output;return(s=d==null?void 0:d.branches)!=null&&s.length?i(We,{branches:d.branches,onPick:r}):null}case"list_departments":{const d=t.output;return(p=d==null?void 0:d.departments)!=null&&p.length?i(Ae,{departments:d.departments,onPick:e}):null}case"show_clinic_timings":{const d=t.output;return(u=d==null?void 0:d.departments)!=null&&u.length?i(Fe,{departments:d.departments}):null}case"show_doctors":{const d=t.output;return(c=d==null?void 0:d.doctors)!=null&&c.length?i(je,{department:d.department,doctors:d.doctors,onPickDoctor:n}):i("div",{class:"chat-widget-empty",children:["No doctors found in ",(d==null?void 0:d.department)??"this department","."]})}case"show_doctor_slots":{const d=t.output;return d?d.error||!d.doctor?i("div",{class:"chat-widget-empty",children:d.error??"Doctor not found."}):i(Oe,{data:d,onPickSlot:l}):null}case"suggest_booking":{const d=t.output;return i(Re,{reason:(d==null?void 0:d.reason)??"Book an appointment.",department:(d==null?void 0:d.department)??null,onBook:o})}default:return null}},He={pick_branch:"Fetching branches…",list_departments:"Looking up departments…",show_clinic_timings:"Fetching clinic hours…",show_doctors:"Looking up doctors…",show_doctor_slots:"Checking availability…",suggest_booking:"Thinking about booking options…"},Ee=({toolName:t})=>i("div",{class:"chat-widget-loading",children:[i("span",{class:"chat-typing-dots","aria-hidden":"true",children:[i("span",{}),i("span",{}),i("span",{})]}),i("span",{class:"chat-widget-loading-label",children:He[t]??"Working…"})]}),We=({branches:t,onPick:e})=>i("div",{class:"chat-widget chat-widget-branches",children:[i("div",{class:"chat-widget-title",children:"Which branch?"}),t.map(n=>i("button",{class:"chat-widget-branch-card",onClick:()=>e(n.name),children:[i("div",{class:"chat-widget-branch-name",children:n.name}),i("div",{class:"chat-widget-branch-meta",children:[n.doctorCount," ",n.doctorCount===1?"doctor":"doctors",n.departmentCount>0?` • ${n.departmentCount} ${n.departmentCount===1?"department":"departments"}`:""]})]},n.name))]}),Ae=({departments:t,onPick:e})=>i("div",{class:"chat-widget chat-widget-departments",children:[i("div",{class:"chat-widget-title",children:"Departments"}),i("div",{class:"chat-widget-dept-grid",children:t.map(n=>i("button",{class:"chat-widget-dept-chip",onClick:()=>e(n),title:`Show doctors in ${n}`,children:[i(y,{name:X(n),size:16}),i("span",{children:n})]},n))})]}),Fe=({departments:t})=>i("div",{class:"chat-widget chat-widget-timings",children:[i("div",{class:"chat-widget-title",children:[i(y,{name:"calendar",size:14})," Clinic hours"]}),t.map(e=>i("div",{class:"chat-widget-timing-dept",children:[i("div",{class:"chat-widget-timing-dept-name",children:[i(y,{name:X(e.name),size:14}),i("span",{children:e.name})]}),e.entries.map(n=>i("div",{class:"chat-widget-timing-row",children:[i("div",{class:"chat-widget-timing-doctor",children:n.name}),i("div",{class:"chat-widget-timing-hours",children:n.hours}),n.clinic&&i("div",{class:"chat-widget-timing-clinic",children:n.clinic})]},`${e.name}-${n.name}`))]},e.name))]}),je=({department:t,doctors:e,onPickDoctor:n})=>i("div",{class:"chat-widget chat-widget-doctors",children:[i("div",{class:"chat-widget-title",children:[i(y,{name:X(t),size:14})," ",t]}),e.map(o=>i("div",{class:"chat-widget-doctor-card",children:[i("div",{class:"chat-widget-doctor-name",children:o.name}),o.specialty&&i("div",{class:"chat-widget-doctor-meta",children:o.specialty}),o.visitingHours&&i("div",{class:"chat-widget-doctor-meta",children:o.visitingHours}),o.clinic&&i("div",{class:"chat-widget-doctor-meta",children:o.clinic}),i("button",{class:"chat-widget-doctor-action",onClick:()=>n(o.name),children:[i(y,{name:"calendar",size:12})," See available appointments"]})]},o.id))]}),Oe=({data:t,onPickSlot:e})=>{if(!t.doctor)return null;const n=t.doctor,l=t.slots.filter(r=>r.available).length>0;return i("div",{class:"chat-widget chat-widget-slots",children:[i("div",{class:"chat-widget-title",children:[i(y,{name:"calendar",size:14})," Available slots"]}),i("div",{class:"chat-widget-slots-doctor",children:n.name}),i("div",{class:"chat-widget-slots-meta",children:[Ue(t.date),n.clinic?` • ${n.clinic}`:""]}),l?i("div",{class:"chat-widget-slots-grid",children:t.slots.map(r=>i("button",{class:`chat-widget-slot-btn ${r.available?"":"unavailable"}`,disabled:!r.available,onClick:()=>r.available&&e({doctorId:n.id,date:t.date,time:r.time}),children:r.time},r.time))}):i("div",{class:"chat-widget-empty",children:"No slots available on this date."})]})},Ue=t=>{const e=new Date(t+"T00:00:00");return isNaN(e.getTime())?t:e.toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})},Re=({reason:t,department:e,onBook:n})=>i("div",{class:"chat-widget chat-widget-booking",children:[i("div",{class:"chat-widget-booking-icon",children:i(y,{name:"calendar",size:28})}),i("div",{class:"chat-widget-booking-body",children:[i("div",{class:"chat-widget-booking-title",children:"Book an appointment"}),i("div",{class:"chat-widget-booking-reason",children:t}),e&&i("div",{class:"chat-widget-booking-dept",children:["Suggested: ",e]}),i("button",{class:"widget-btn",onClick:n,children:"Book now"})]})]}),te=ge(null),qe=({children:t})=>{const[e,n]=v({name:"",phone:""}),[o,l]=v(null),[r,s]=v(""),[p,u]=v(null),[c,d]=v([]),[a,g]=v(!1),[h,m]=v(""),[k,w]=v(null),x=ze(z=>{n(N=>({...N,...z}))},[]),_=Q(()=>{var N,D;const z=new Set;for(const b of c){const T=(D=(N=b.clinic)==null?void 0:N.clinicName)==null?void 0:D.trim();T&&z.add(T)}return Array.from(z).sort()},[c]);W(()=>{k||_.length===1&&w(_[0])},[_,k]),W(()=>{let z=!1;return g(!0),m(""),we().then(N=>{z||(d(N),g(!1))}).catch(()=>{z||(m("Failed to load doctors"),g(!1))}),()=>{z=!0}},[]);const I={visitor:e,updateVisitor:x,leadId:o,setLeadId:l,captchaToken:r,setCaptchaToken:s,bookingPrefill:p,setBookingPrefill:u,doctors:c,doctorsLoading:a,doctorsError:h,branches:_,selectedBranch:k,setSelectedBranch:w};return i(te.Provider,{value:I,children:t})},ht=()=>{const t=Se(te);if(!t)throw new Error("useWidgetStore must be used inside a WidgetStoreProvider");return t},Ke=["What departments do you have?","Show me cardiologists","Clinic timings","How do I book?"],Ve=t=>t.parts.filter(e=>e.type==="text").map(e=>e.text).join(""),R=(t,e,n)=>{t(o=>o.map(l=>l.id===e?n(l):l))},Ye=(t,e,n)=>{const o=t[t.length-1];return(o==null?void 0:o.type)==="text"?[...t.slice(0,-1),{type:"text",text:o.text+e,state:n}]:[...t,{type:"text",text:e,state:n}]},ut=(t,e,n,o)=>{const l=t.findIndex(r=>r.type==="tool"&&r.toolCallId===e);if(l>=0){const s={...t[l],...n};return[...t.slice(0,l),s,...t.slice(l+1)]}return[...t,{...o,...n}]},ee=()=>`m_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,Je=({onRequestBooking:t})=>{const{visitor:e,updateVisitor:n,leadId:o,setLeadId:l,setBookingPrefill:r,selectedBranch:s,setSelectedBranch:p}=ht(),[u,c]=v([]),[d,a]=v(""),[g,h]=v(!1),[m,k]=v(!1),[w,x]=v(""),_=V(null);W(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[u]);const I=async()=>{const b=e.name.trim(),T=e.phone.trim();if(!(!b||!T)){k(!0),x("");try{const{leadId:P}=await ye(b,T);l(P)}catch{x("Could not start chat. Please try again.")}finally{k(!1)}}},z=async(b,T)=>{if(!b.trim()||g||!o)return;const P={id:ee(),role:"user",parts:[{type:"text",text:b.trim(),state:"done"}]},B=ee(),gt={id:B,role:"assistant",parts:[]},ft=[...u,P].map(E=>({role:E.role,content:Ve(E)}));c(E=>[...E,P,gt]),a(""),h(!0);const Z=T!==void 0?T:s;try{const E=await ke(o,ft,Z);for await(const $ of Ne(E))switch($.type){case"text-delta":typeof $.delta=="string"&&R(c,B,S=>({...S,parts:Ye(S.parts,$.delta,"streaming")}));break;case"text-end":R(c,B,S=>({...S,parts:S.parts.map(Y=>Y.type==="text"?{...Y,state:"done"}:Y)}));break;case"tool-input-start":R(c,B,S=>({...S,parts:ut(S.parts,$.toolCallId,{state:"input-streaming",toolName:$.toolName},{type:"tool",toolCallId:$.toolCallId,toolName:$.toolName,state:"input-streaming"})}));break;case"tool-input-available":R(c,B,S=>({...S,parts:ut(S.parts,$.toolCallId,{state:"input-available",toolName:$.toolName,input:$.input},{type:"tool",toolCallId:$.toolCallId,toolName:$.toolName,state:"input-available",input:$.input})}));break;case"tool-output-available":R(c,B,S=>({...S,parts:ut(S.parts,$.toolCallId,{state:"output-available",output:$.output},{type:"tool",toolCallId:$.toolCallId,toolName:"unknown",state:"output-available",output:$.output})}));break;case"tool-output-error":R(c,B,S=>({...S,parts:ut(S.parts,$.toolCallId,{state:"output-error",errorText:$.errorText},{type:"tool",toolCallId:$.toolCallId,toolName:"unknown",state:"output-error",errorText:$.errorText})}));break;case"error":R(c,B,S=>({...S,parts:[...S.parts,{type:"text",text:"Sorry, I encountered an error. Please try again.",state:"done"}]}));break;default:break}}catch{R(c,B,E=>({...E,parts:[...E.parts,{type:"text",text:"Sorry, I encountered an error. Please try again.",state:"done"}]}))}finally{h(!1)}},N=b=>{r(b),t(b)},D=b=>{p(b),z(`I'm interested in the ${b} branch.`,b)};return o?i("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[i("div",{class:"chat-messages",ref:_,children:[u.length===0&&i("div",{class:"chat-empty",children:[i("div",{class:"chat-empty-icon",children:i(y,{name:"hand-wave",size:40,color:"#f59e0b"})}),i("div",{class:"chat-empty-title",children:["Hi ",e.name.split(" ")[0]||"there",", how can we help?"]}),i("div",{class:"chat-empty-text",children:"Ask about doctors, clinics, packages, or book an appointment."}),i("div",{class:"quick-actions",children:Ke.map(b=>i("button",{class:"quick-action",onClick:()=>z(b),children:b},b))})]}),u.map(b=>i(Ge,{msg:b,onDepartmentClick:T=>z(`Show me doctors in ${T}`),onShowDoctorSlots:T=>z(`Show available appointments for ${T}`),onSuggestBooking:()=>t(),onPickSlot:N,onPickBranch:D},b.id))]}),i("div",{class:"chat-input-row",children:[i("input",{class:"widget-input chat-input",placeholder:"Type a message...",value:d,onInput:b=>a(b.target.value),onKeyDown:b=>b.key==="Enter"&&z(d),disabled:g}),i("button",{class:"chat-send",onClick:()=>z(d),disabled:g||!d.trim(),"aria-label":"Send message",children:i(y,{name:"paper-plane-top",size:16,color:"#fff"})})]})]}):i("div",{class:"chat-intro",children:[i("div",{class:"chat-empty-icon",children:i(y,{name:"hand-wave",size:40,color:"#f59e0b"})}),i("div",{class:"chat-empty-title",children:"Hi! How can we help?"}),i("div",{class:"chat-empty-text",children:"Share your name and phone so we can follow up if needed."}),w&&i("div",{class:"widget-error",children:w}),i("div",{class:"widget-field",children:[i("label",{class:"widget-label",children:"Full Name *"}),i("input",{class:"widget-input",placeholder:"Your name",value:e.name,onInput:b=>n({name:b.target.value})})]}),i("div",{class:"widget-field",children:[i("label",{class:"widget-label",children:"Phone Number *"}),i("input",{class:"widget-input",placeholder:"+91 9876543210",value:e.phone,onInput:b=>n({phone:b.target.value}),onKeyDown:b=>b.key==="Enter"&&I()})]}),i("button",{class:"widget-btn",onClick:I,disabled:!e.name.trim()||!e.phone.trim()||m,children:m?"Starting…":"Start Chat"})]})},Ge=({msg:t,onDepartmentClick:e,onShowDoctorSlots:n,onSuggestBooking:o,onPickSlot:l,onPickBranch:r})=>{const s=t.role==="assistant"&&t.parts.length===0,u=t.parts.some(c=>c.type==="tool")?t.parts.filter(c=>c.type==="tool"):t.parts;return i("div",{class:`chat-msg ${t.role}`,children:i("div",{class:"chat-msg-stack",children:[s&&i("div",{class:"chat-bubble",children:i(ie,{})}),u.map((c,d)=>c.type==="text"?i("div",{class:"chat-bubble",children:c.text||i(ie,{})},d):i(De,{part:c,onDepartmentClick:e,onShowDoctorSlots:n,onSuggestBooking:o,onPickSlot:l,onPickBranch:r},d))]})})},ie=()=>i("span",{class:"chat-typing-dots","aria-label":"Assistant is typing",children:[i("span",{}),i("span",{}),i("span",{})]}),Qe=()=>{const{visitor:t,updateVisitor:e,captchaToken:n,bookingPrefill:o,setBookingPrefill:l,doctors:r,doctorsLoading:s,doctorsError:p,branches:u,selectedBranch:c,setSelectedBranch:d}=ht(),a=u.length>1&&!c,[g,h]=v(a?"branch":"department"),[m,k]=v(""),[w,x]=v(null),[_,I]=v(""),[z,N]=v([]),[D,b]=v(""),[T,P]=v(""),[B,gt]=v(!1),[ft,Z]=v(""),[E,$]=v(""),S=Q(()=>{if(!c)return r;const f=c.toLowerCase();return r.filter(H=>{var mt;return String(((mt=H.clinic)==null?void 0:mt.clinicName)??"").toLowerCase().includes(f)})},[r,c]),Y=Q(()=>[...new Set(S.map(f=>f.department).filter(Boolean))],[S]),ei=m?S.filter(f=>f.department===m):[];W(()=>{p&&Z(p)},[p]),W(()=>{var H;if(!o||r.length===0)return;const f=r.find(mt=>mt.id===o.doctorId);f&&((H=f.clinic)!=null&&H.clinicName&&!c&&d(f.clinic.clinicName),k(f.department),x(f),I(o.date),b(o.time),h("details"),l(null))},[o,r]);const ii=f=>{x(f),I(new Date().toISOString().split("T")[0]),h("datetime")};W(()=>{w&&_&&be(w.id,_).then(N).catch(()=>{})},[w,_]);const ni=async()=>{if(!(!w||!D||!t.name.trim()||!t.phone.trim())){gt(!0),Z("");try{const f=`${_}T${D}:00`,H=await xe({departmentId:m,doctorId:w.id,scheduledAt:f,patientName:t.name.trim(),patientPhone:t.phone.trim(),chiefComplaint:T,captchaToken:n});$(H.reference),h("success")}catch{Z("Booking failed. Please try again.")}finally{gt(!1)}}},oe=a?["branch","department","doctor","datetime","details"]:["department","doctor","datetime","details"],re=oe.indexOf(g);return i("div",{children:[g!=="success"&&i("div",{class:"widget-steps",children:oe.map((f,H)=>i("div",{class:`widget-step ${H<re?"done":H===re?"active":""}`},H))}),ft&&i("div",{class:"widget-error",children:ft}),g==="branch"&&i("div",{children:[i("div",{class:"widget-section-title",children:"Select Branch"}),s&&u.length===0&&i("div",{class:"widget-section-sub",children:"Loading…"}),u.map(f=>i("button",{class:"widget-row-btn",onClick:()=>{d(f),h("department")},children:[i(y,{class:"widget-row-icon",name:"hospital",size:20}),i("span",{class:"widget-row-label",children:f}),i(y,{class:"widget-row-chevron",name:"arrow-right",size:14})]},f))]}),g==="department"&&i("div",{children:[i("div",{class:"widget-section-title",children:[c&&i(O,{children:[i(y,{class:"widget-row-icon",name:"hospital",size:16}),c," — "]}),"Select Department"]}),s&&Y.length===0&&i("div",{class:"widget-section-sub",children:"Loading…"}),Y.map(f=>i("button",{class:"widget-row-btn",onClick:()=>{k(f),h("doctor")},children:[i(y,{class:"widget-row-icon",name:X(f),size:20}),i("span",{class:"widget-row-label",children:f.replace(/_/g," ")}),i(y,{class:"widget-row-chevron",name:"arrow-right",size:14})]},f)),u.length>1&&i("button",{class:"widget-btn widget-btn-secondary widget-btn-with-icon",style:{marginTop:"8px"},onClick:()=>h("branch"),children:[i(y,{name:"arrow-left",size:14}),"Change branch"]})]}),g==="doctor"&&i("div",{children:[i("div",{class:"widget-section-title",children:[i(y,{class:"widget-row-icon",name:X(m),size:16}),m.replace(/_/g," ")]}),ei.map(f=>{var H;return i("button",{class:"widget-row-btn widget-row-btn-stack",onClick:()=>ii(f),children:[i("div",{class:"widget-row-main",children:[i("div",{class:"widget-row-label",children:f.name}),i("div",{class:"widget-row-sub",children:[f.visitingHours??""," ",(H=f.clinic)!=null&&H.clinicName?`• ${f.clinic.clinicName}`:""]})]}),i(y,{class:"widget-row-chevron",name:"arrow-right",size:14})]},f.id)}),i("button",{class:"widget-btn widget-btn-secondary widget-btn-with-icon",style:{marginTop:"8px"},onClick:()=>h("department"),children:[i(y,{name:"arrow-left",size:14}),"Back"]})]}),g==="datetime"&&i("div",{children:[i("div",{class:"widget-section-title",children:[w==null?void 0:w.name," — Pick Date & Time"]}),i("div",{class:"widget-field",children:[i("label",{class:"widget-label",children:"Date"}),i("input",{class:"widget-input",type:"date",value:_,min:new Date().toISOString().split("T")[0],onInput:f=>{I(f.target.value),b("")}})]}),z.length>0&&i("div",{children:[i("label",{class:"widget-label",children:"Available Slots"}),i("div",{class:"widget-slots",children:z.map(f=>i("button",{class:`widget-slot ${f.time===D?"selected":""} ${f.available?"":"unavailable"}`,onClick:()=>f.available&&b(f.time),disabled:!f.available,children:f.time},f.time))})]}),i("div",{class:"widget-btn-row",children:[i("button",{class:"widget-btn widget-btn-secondary widget-btn-with-icon",onClick:()=>h("doctor"),children:[i(y,{name:"arrow-left",size:14}),"Back"]}),i("button",{class:"widget-btn widget-btn-with-icon",disabled:!D,onClick:()=>h("details"),children:["Next",i(y,{name:"arrow-right",size:14,color:"#fff"})]})]})]}),g==="details"&&i("div",{children:[i("div",{class:"widget-section-title",children:"Your Details"}),i("div",{class:"widget-field",children:[i("label",{class:"widget-label",children:"Full Name *"}),i("input",{class:"widget-input",placeholder:"Your name",value:t.name,onInput:f=>e({name:f.target.value})})]}),i("div",{class:"widget-field",children:[i("label",{class:"widget-label",children:"Phone Number *"}),i("input",{class:"widget-input",placeholder:"+91 9876543210",value:t.phone,onInput:f=>e({phone:f.target.value})})]}),i("div",{class:"widget-field",children:[i("label",{class:"widget-label",children:"Chief Complaint"}),i("textarea",{class:"widget-input widget-textarea",placeholder:"Describe your concern...",value:T,onInput:f=>P(f.target.value)})]}),i("div",{class:"widget-btn-row",children:[i("button",{class:"widget-btn widget-btn-secondary widget-btn-with-icon",onClick:()=>h("datetime"),children:[i(y,{name:"arrow-left",size:14}),"Back"]}),i("button",{class:"widget-btn",disabled:!t.name.trim()||!t.phone.trim()||B,onClick:ni,children:B?"Booking...":"Book Appointment"})]})]}),g==="success"&&i("div",{class:"widget-success",children:[i("div",{class:"widget-success-icon",children:i(y,{name:"circle-check",size:56,color:"#059669"})}),i("div",{class:"widget-success-title",children:"Appointment Booked!"}),i("div",{class:"widget-success-text",children:["Reference: ",i("strong",{children:E}),i("br",{}),w==null?void 0:w.name," • ",_," at ",D,i("br",{}),i("br",{}),"We'll send a confirmation SMS to your phone."]})]})]})},Xe=()=>{const{visitor:t,updateVisitor:e,captchaToken:n}=ht(),[o,l]=v(""),[r,s]=v(""),[p,u]=v(!1),[c,d]=v(!1),[a,g]=v(""),h=async()=>{if(!(!t.name.trim()||!t.phone.trim())){u(!0),g("");try{await ve({name:t.name.trim(),phone:t.phone.trim(),interest:o.trim()||void 0,message:r.trim()||void 0,captchaToken:n}),d(!0)}catch{g("Submission failed. Please try again.")}finally{u(!1)}}};return c?i("div",{class:"widget-success",children:[i("div",{class:"widget-success-icon",children:i(y,{name:"hands-praying",size:56,color:"#059669"})}),i("div",{class:"widget-success-title",children:"Thank you!"}),i("div",{class:"widget-success-text",children:["An agent will call you shortly on ",t.phone,".",i("br",{}),"We typically respond within 30 minutes during business hours."]})]}):i("div",{children:[i("div",{class:"widget-section-title",children:"Get in touch"}),i("div",{class:"widget-section-sub",children:"Leave your details and we'll call you back."}),a&&i("div",{class:"widget-error",children:a}),i("div",{class:"widget-field",children:[i("label",{class:"widget-label",children:"Full Name *"}),i("input",{class:"widget-input",placeholder:"Your name",value:t.name,onInput:m=>e({name:m.target.value})})]}),i("div",{class:"widget-field",children:[i("label",{class:"widget-label",children:"Phone Number *"}),i("input",{class:"widget-input",placeholder:"+91 9876543210",value:t.phone,onInput:m=>e({phone:m.target.value})})]}),i("div",{class:"widget-field",children:[i("label",{class:"widget-label",children:"Interested In"}),i("select",{class:"widget-select",value:o,onChange:m=>l(m.target.value),children:[i("option",{value:"",children:"Select (optional)"}),i("option",{value:"Consultation",children:"General Consultation"}),i("option",{value:"Health Checkup",children:"Health Checkup"}),i("option",{value:"Surgery",children:"Surgery"}),i("option",{value:"Second Opinion",children:"Second Opinion"}),i("option",{value:"Other",children:"Other"})]})]}),i("div",{class:"widget-field",children:[i("label",{class:"widget-label",children:"Message"}),i("textarea",{class:"widget-input widget-textarea",placeholder:"How can we help? (optional)",value:r,onInput:m=>s(m.target.value)})]}),i("button",{class:"widget-btn",disabled:!t.name.trim()||!t.phone.trim()||p,onClick:h,children:p?"Sending...":"Send Message"})]})},Ze=({config:t,shadow:e})=>(W(()=>{const n=document.createElement("style");return n.textContent=Be(t),e.appendChild(n),()=>{e.removeChild(n)}},[t,e]),i(qe,{children:i(ti,{config:t,shadow:e})})),ti=({config:t,shadow:e})=>{const[n,o]=v(!1),[l,r]=v("chat"),[s,p]=v(!1),{captchaToken:u,setCaptchaToken:c,selectedBranch:d}=ht();W(()=>{if(!s)return;const h=e.host,m=h.getAttribute("style");h.style.cssText="position:fixed;inset:0;z-index:999999;";const k=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{m!==null?h.setAttribute("style",m):h.removeAttribute("style"),document.body.style.overflow=k}},[s,e]),W(()=>{if(!s)return;const h=m=>{m.key==="Escape"&&p(!1)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[s]);const a=!!t.captchaSiteKey&&!u,g=()=>{p(!1),o(!1)};return i("div",{children:[!n&&i("button",{class:"widget-bubble",onClick:()=>o(!0),"aria-label":"Open chat",children:t.brand.logo?i("img",{src:t.brand.logo,alt:t.brand.name}):i(y,{name:"message-dots",size:26,color:t.colors.primary})}),n&&i(O,{children:[s&&i("div",{class:"widget-backdrop",onClick:()=>p(!1)}),i("div",{class:`widget-panel ${s?"widget-panel-maximized":""}`,children:[i("div",{class:"widget-header",children:[t.brand.logo&&i("img",{src:t.brand.logo,alt:""}),i("div",{class:"widget-header-text",children:[i("div",{class:"widget-header-name",children:t.brand.name}),i("div",{class:"widget-header-sub",children:["We're here to help",d&&i(O,{children:[" • ",i("span",{class:"widget-header-branch",children:[i(y,{name:"location-dot",size:10,color:"#fff"}),d]})]})]})]}),i("button",{class:"widget-header-btn",onClick:()=>p(h=>!h),"aria-label":s?"Restore":"Maximize",title:s?"Restore":"Maximize",children:i(y,{name:s?"down-left-and-up-right-to-center":"up-right-and-down-left-from-center",size:14,color:"#fff"})}),i("button",{class:"widget-header-btn",onClick:g,"aria-label":"Close",title:"Close",children:i(y,{name:"xmark",size:16,color:"#fff"})})]}),a?i("div",{class:"widget-captcha-gate",children:[i("div",{class:"widget-captcha-gate-icon",children:i(y,{name:"shield-check",size:56,color:t.colors.primary})}),i("div",{class:"widget-captcha-gate-title",children:"Quick security check"}),i("div",{class:"widget-captcha-gate-text",children:"Please verify you're not a bot to continue."}),i(Te,{siteKey:t.captchaSiteKey,onToken:c})]}):i(O,{children:[i("div",{class:"widget-tabs",children:[i("button",{class:`widget-tab ${l==="chat"?"active":""}`,onClick:()=>r("chat"),children:[i(y,{name:"message-dots",size:14})," Chat"]}),i("button",{class:`widget-tab ${l==="book"?"active":""}`,onClick:()=>r("book"),children:[i(y,{name:"calendar",size:14})," Book"]}),i("button",{class:`widget-tab ${l==="contact"?"active":""}`,onClick:()=>r("contact"),children:[i(y,{name:"phone",size:14})," Contact"]})]}),i("div",{class:"widget-body",children:[l==="chat"&&i(Je,{onRequestBooking:()=>r("book")}),l==="book"&&i(Qe,{}),l==="contact"&&i(Xe,{})]})]})]})]})]})},ne=async()=>{const t=document.querySelector("script[data-key]");if(!t){console.error("[HelixWidget] Missing data-key attribute");return}const e=t.getAttribute("data-key")??"",n=t.src.replace(/\/widget\.js.*$/,"");me(n,e);let o;try{o=await _e()}catch(p){console.error("[HelixWidget] Init failed:",p);return}o.captchaSiteKey&&Zt().catch(()=>{console.warn("[HelixWidget] Turnstile preload failed — gate will retry on open")});const l=document.createElement("div");l.id="helix-widget-host",l.style.cssText="position:fixed;bottom:20px;right:20px;z-index:999999;",document.body.appendChild(l);const r=l.attachShadow({mode:"open"}),s=document.createElement("div");r.appendChild(s),ue(i(Ze,{config:o,shadow:r}),s)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ne):ne()})();
|