@eka-care/medassist-widget 0.1.124 → 0.1.125-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/medassist-widget-CardList-ST569rut.js +1 -0
- package/dist/medassist-widget-DoctorCard-B_xw-xWd.js +1 -0
- package/dist/medassist-widget-ElicitationInput-DKEz5EVH.js +1 -0
- package/dist/medassist-widget-FocusCarousel-af7aMXWo.js +1 -0
- package/dist/medassist-widget-MediaCard-CLipu6gc.js +1 -0
- package/dist/medassist-widget-MultiSelect-zx2GZY3z.js +1 -0
- package/dist/medassist-widget-VoiceAgentScreen-BK0p37RC.js +3 -380
- package/dist/medassist-widget-check-BaHLRs-2.js +1 -5
- package/dist/medassist-widget-chevron-right-CKYbGWbY.js +1 -7
- package/dist/medassist-widget-html2canvas.esm-CphxV6YW.js +3 -4833
- package/dist/medassist-widget-map-pin-Bx-5lPdC.js +1 -14
- package/dist/medassist-widget-mood-angry-BQqxy8gg.js +1 -10
- package/dist/medassist-widget-mood-bad-BBDRkdRc.js +1 -10
- package/dist/medassist-widget-mood-happy-oLG7NUhq.js +1 -9
- package/dist/medassist-widget-mood-neutral-CbcKAQbC.js +1 -10
- package/dist/medassist-widget-mood-poor-t4w5iE4B.js +1 -10
- package/dist/medassist-widget.css +1 -1
- package/dist/medassist-widget.js +15 -14720
- package/package.json +4 -4
- package/dist/medassist-widget-CardList-Dx2bzaVC.js +0 -222
- package/dist/medassist-widget-DoctorCard-Cn_E83qL.js +0 -552
- package/dist/medassist-widget-FocusCarousel-C8sm1Tm0.js +0 -99
- package/dist/medassist-widget-MediaCard-yhz2Z0ZQ.js +0 -179
- package/dist/medassist-widget-MultiSelect-BnExX-Ty.js +0 -414
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as d,u as e,l as M,x as w,r as _,s as z,z as C,B as g,v as j,d as A,A as H}from"./medassist-widget.js";import{C as S}from"./medassist-widget-check-BaHLRs-2.js";import{M as v}from"./medassist-widget-map-pin-Bx-5lPdC.js";import{FocusCarousel as V}from"./medassist-widget-FocusCarousel-af7aMXWo.js";const q=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],b=d("building-2",q),B=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],L=d("calendar",B),$=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],F=d("dollar-sign",$),I=[["path",{d:"M4 10h12",key:"1y6xl8"}],["path",{d:"M4 14h9",key:"1loblj"}],["path",{d:"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",key:"1j6lzo"}]],Z=d("euro",I),D=[["path",{d:"M6 3h12",key:"ggurg9"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"m6 13 8.5 8",key:"u1kupk"}],["path",{d:"M6 13h3",key:"wdp6ag"}],["path",{d:"M9 13c6.667 0 6.667-10 0-10",key:"1nkvk2"}]],E=d("indian-rupee",D),G=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],O=d("map",G),P=[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]],R=d("ticket",P),T={voucher:R,pharmacy:b,hospital:b,map:O,location_pin:v,"location pin":v,check:S,calendar:L,rupee:E,dollar:F,euro:Z};function f({name:t,className:o,size:r=16}){const n=t?.trim().toLowerCase().replace(/\s+/g,"_");if(!n)return null;const s=T[n];if(s)return e(s,{className:o,size:r,"aria-hidden":!0})}function N({card:t,onSelect:o,disabled:r=!1}){const{title:n,tags:s,icon:h,img:u,description:m,banner_text:i,items:p,primary_cta:a,secondary_cta:c}=t,k=l=>{if(!r&&(l.link&&window.open(l.link,"_blank","noopener,noreferrer"),l.text||l.title)){let y=!1;t?.primary_cta?.tool_result&&(y=!0),o?.({message:l.text||l.title,selectedCard:t?.title,selectedComponent:t,selected_id:t.card_id,...y?{tool_result:t.primary_cta?.tool_result}:{}})}},x=!!u;return e(j,{className:"w-full h-full flex flex-col overflow-hidden rounded-xl border border-black-200 dark:border-white-200 bg-elicitationBg text-card-foreground shadow-none",children:[e(M,{className:`flex flex-row items-center justify-between gap-3 p-3 ${x?"bg-primary/[20%]":""}`,children:[e("div",{className:"min-w-0 flex-1 overflow-hidden",children:[n?e(w,{className:"text-base font-bold leading-tight tracking-tight truncate",children:n}):null,s?e("p",{className:"mt-1 text-sm text-muted-foreground truncate",children:s}):null]}),x?e("div",{className:"shrink-0",children:e("img",{src:u,alt:n??"profile",className:"h-16 w-16 rounded-full object-cover border-2 border-background"})}):h?e("div",{className:"shrink-0 text-muted-foreground",children:e(f,{name:h,size:24,className:"text-primary"})}):null]}),e(_,{className:"flex-1 space-y-3 pt-3 overflow-hidden",children:[m?e("div",{className:"text-sm text-foreground leading-snug prose prose-sm max-w-none prose-strong:font-semibold prose-p:my-0 break-words",children:e(z,{children:m})}):null,i?e("div",{className:"rounded-full px-4 py-2 text-center text-sm font-semibold bg-primary/15 text-primary truncate",children:i}):null,p?.length?e("div",{className:"flex flex-col gap-y-1",children:p.map((l,y)=>e("div",{className:"flex items-center gap-1.5 text-xs text-foreground min-w-0",children:[l.icon?e(f,{name:l.icon,size:12,className:"shrink-0 text-muted-foreground"}):null,e("span",{className:"truncate",children:l.text})]},y))}):null]}),a?.title||c?.title?e(C,{className:"flex justify-center flex-wrap gap-2 pt-0",children:[a&&e(g,{type:"button",variant:"default",size:"sm",className:`gap-1.5 truncate ${c?"":"w-full"}`,disabled:r,onClick:()=>k(a),children:[a.icon?e(f,{name:a.icon,size:14,className:"shrink-0"}):null,e("span",{className:"truncate",children:a.title})]}),c&&e(g,{type:"button",variant:"outline",size:"sm",className:"gap-1.5 truncate",disabled:r,onClick:()=>k(c),children:[c.icon?e(f,{name:c.icon,size:14,className:"shrink-0"}):null,e("span",{className:"truncate",children:c.title})]})]}):null]})}function W({cards:t,onSelect:o,disabled:r=!1,className:n,orientation:s="vertical"}){const[h,u]=A(!1),m=H(!1),i=(t??[]).filter(a=>!!a?.card_id);if(!i.length)return e("p",{className:"text-sm text-muted-foreground py-2",children:"No options available."});const p=async a=>{m.current||(m.current=!0,u(!0),await o?.(a))};return s!=="horizontal"?e("div",{className:n??"flex flex-col gap-3 mt-3",children:i.map(a=>e(N,{card:a,onSelect:p,disabled:r||h},a.card_id))}):e(V,{count:i.length,renderItem:a=>e(N,{card:i[a],onSelect:p,disabled:r||h})})}export{W as CardList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as C,d as u,A as D,y as j,u as e,b,C as G,T as $,q,_ as he,k as ue,l as xe,m as be,n as fe,o as ge,p as ye,e as X,r as ve,I as we,s as ke,B as w,t as Z,v as Ne,w as _e,a as ee}from"./medassist-widget.js";import{C as Ce}from"./medassist-widget-check-BaHLRs-2.js";import{M as te}from"./medassist-widget-map-pin-Bx-5lPdC.js";import{C as $e,a as Me}from"./medassist-widget-chevron-right-CKYbGWbY.js";const Se=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ae=C("arrow-right",Se),Ae=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]],je=C("calendar-x-2",Ae),ze=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Le=C("clock",ze),Be=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Te=C("ellipsis",Be),He=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Ie=C("external-link",He),Oe=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Ee=C("languages",Oe),Ve=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],De=C("search",Ve);function qe({value:o,onValueChange:a,placeholder:m="Select an option",className:p,triggerClassName:z,contentClassName:L,disabled:y=!1,options:d=[],size:B="default",icon:P}){const[v,k]=u(!1),T=D(null),i=D(null),f=d.find(s=>s.value===o);j(()=>{const s=g=>{v&&g.key==="Escape"&&(k(!1),i.current?.focus())};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[v]);const h=s=>{a?.(s),k(!1),i.current?.focus()},M=()=>{y||k(!v)};return e("div",{className:b("relative w-full",p),children:[e("button",{ref:i,type:"button",onClick:M,disabled:y,className:b('border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*="text-"])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 overflow-hidden',B==="default"?"min-h-9":"min-h-8",z),"aria-expanded":v,"aria-haspopup":"listbox",children:[P,e("span",{className:b("flex-1 text-left min-w-0 overflow-hidden break-words line-clamp-2",!f&&"text-muted-foreground"),children:f?f.label:m}),e(G,{className:b("size-4 opacity-50 pointer-events-none shrink-0 transition-transform duration-200",v&&"rotate-180")})]}),v&&e("div",{ref:T,className:b("bg-surface text-foreground animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 relative z-50 max-h-[136px] min-w-[8rem] w-full overflow-x-hidden overflow-y-auto overscroll-contain rounded-md shadow-md mt-1",L),role:"listbox",children:e("div",{className:"p-1",children:d.length===0?e("div",{className:"px-3 py-2 text-sm text-muted-foreground text-center",children:"No options available"}):d.map(s=>{const g=s.value===o;return e("div",{onClick:()=>h(s.value),className:b("relative flex w-full cursor-pointer items-center gap-1 rounded-sm py-2.5 px-3 text-sm outline-none select-none transition-colors duration-150","hover:bg-accent hover:text-accent-foreground","focus-visible:bg-accent focus-visible:text-accent-foreground","active:bg-accent/80",g&&"bg-accent/50 text-foreground",y&&"pointer-events-none opacity-50 cursor-not-allowed"),role:"option","aria-selected":g,tabIndex:y?-1:0,onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),y||h(s.value))},children:[e("span",{className:"flex-1 text-left min-w-0 break-words line-clamp-2",children:s.label}),g&&e("span",{className:"absolute right-3 flex size-4 items-center justify-center shrink-0 pointer-events-none",children:e(Ce,{className:"size-4 text-foreground"})})]},s.value)})})})]})}function re({date:o}){return e("div",{className:"flex flex-col items-center justify-center gap-3 pt-5 pb-4",children:[e("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-black-100 dark:bg-white-100",children:e(je,{className:"h-7 w-7 text-text-secondary","aria-hidden":!0})}),e("p",{className:"text-sm font-medium text-text-secondary text-center",children:`No slots available ${o&&`on ${_e(o)}`||""}`})]})}function Pe({doctor:o,doctorDetails:a,onSelect:m,disabled:p,isActive:z=!0}){const L=$(()=>new Date().toISOString().slice(0,10),[]),y=$(()=>{if(a?.hospitals?.[0]?.hospital_id)return a?.hospitals?.[0]?.hospital_id},[a?.hospitals]),[d,B]=u(y),[P,v]=u(!1),[k,T]=u(!1),[i,f]=u(null),[h,M]=u(null),[s,g]=u(0),[N,K]=u(!1),[H,J]=u(!1),[S,Q]=u(!1),[I,R]=u(!1),[Y,ie]=u(!1),F=D(!1),O=D(null);j(()=>{B(y)},[y]);const n=o.availability??[],ne=q(async()=>{if(!S&&(J(!0),!n.length&&m&&a)){Q(!0);try{await m({...o,hospital_id:d})}finally{Q(!1)}}},[H,S,m,a,n.length,d]),le=q(t=>{a&&(B(t),f(null),M(null),g(0),F.current=!1,m?.({...o,hospital_id:t}))},[o,m,a]);j(()=>{z||J(!1)},[z]),j(()=>{if(!H||!n.length||F.current)return;F.current=!0;const t=n.find(l=>l.date===o.preferred_date)||n[0],r=t.date;r&&(f(r),t.slots?.length||m?.({...o,hospital_id:d,preferred_date:r}))},[n,H,o.preferred_date]);const E=$(()=>n.find(t=>t.date===i)?.slots??[],[n,i]);he(()=>{const t=O.current;t&&(t.scrollTop=0,R(t.scrollHeight>t.clientHeight+2))},[i,E.length]);const se=q(()=>{const t=O.current;t&&R(t.scrollTop+t.clientHeight<t.scrollHeight-4)},[]),oe=()=>{O.current?.scrollBy({top:120,behavior:"smooth"})},de=$(()=>{if(!n.length)return[];const t=Math.min(s+3,n.length);return n.slice(s,t).map(r=>{if(r.date)return{...r,...ue(r.date)}})},[n,s]),U=n[0]?.date,ce=s>0||!!U&&U>L;j(()=>{if(!i||n.length===0)return;const t=n.findIndex(r=>r.date===i);t<0||g(r=>t>=r&&t<r+3?r:Math.min(t,Math.max(0,n.length-3)))},[i,n]);const A=q(async t=>{f(t),M(null),K(!1);const r=n.find(l=>l.date===t);if(!(r?.slots?.length||Array.isArray(r?.slots)&&r?.slots.length===0)){v(!0);try{await m?.({...o,hospital_id:d,preferred_date:t})}catch{}finally{v(!1)}}},[o,d,m,n]),c=$(()=>n.find(t=>t.date===i)?.cta??o.cta,[n,i,o.cta]),V=$(()=>p||k||!c?.text&&!i,[p,c,i,k]),W=async()=>{if(!k)try{T(!0);let t;f(pe=>(t=o?.preferred_date??pe,t));const r=c?.text,l=!!r,x=c?.action?c.action===ee.SYNAPSE_CTA_ACTIONS.TOOL_CALL:!l,_=i&&h?` on ${t} at ${h}.`:"";await m?.({...o,hospital_id:d,preferred_date:t??void 0,preferred_slot_time:h??void 0},`${r||`I want to book an appointment with Dr. ${a?.name}`}${_}`,c?.tool_result,x)}catch{}finally{T(!1)}},me=()=>{if(N)return;const t=c?.text,r=!!t;if(!r&&!i)return;K(!0);const l=c?.action?c.action===ee.SYNAPSE_CTA_ACTIONS.TOOL_CALL:!r,x=i&&h?` on ${i} at ${h}.`:"";m?.({...o,hospital_id:d,preferred_date:i??void 0,preferred_slot_time:h??void 0},`${t||`I want to book an appointment with Dr. ${a?.name}`}${x}`,c?.tool_result,l)};return a?e(Ne,{className:"max-w-md h-full rounded-xl border border-black-200 dark:border-white-200 shadow-none p-0 bg-elicitationBg overflow-hidden",children:[e(xe,{className:"flex flex-row items-center gap-3 bg-primary/[20%] rounded-t-xl p-2 border-b border-border-subtle overflow-hidden",children:[e(be,{className:"h-12 w-12 ring-2 ring-primary/20 flex-shrink-0",children:[a.profile_pic&&e(fe,{src:a.profile_pic,alt:`${a.name} profile photo`,crossOrigin:"anonymous"}),e(ge,{className:"bg-secondary text-primary",children:ye(a.name)})]}),e("div",{className:"min-w-0",children:[e("h3",{className:"font-bold text-slate-900 leading-tight",style:{fontSize:"0.95rem"},children:[e("span",{children:a.name}),a.profile_link&&e("a",{href:a.profile_link,target:"_blank",rel:"noreferrer","aria-label":"View profile",className:"inline-block align-middle ml-2 text-primary hover:text-primary/70 transition-colors",children:e(Ie,{className:"h-3.5 w-3.5 inline","aria-hidden":!0})})]}),e("p",{className:"mt-0.5 text-xs text-slate-600 line-clamp-1 hover:line-clamp-none hover:whitespace-normal cursor-help",title:`${a.specialty}${a.experience?` \u2022 ${a.experience}`:""}`,children:[a.specialty,a.experience&&e(X,{children:[" \u2022 ",a.experience]})]})]})]}),e(ve,{className:"px-3 py-2",children:[e("div",{className:"grid gap-1 pb-2 border-b border-border-subtle",children:[a.timings&&e("div",{className:"flex items-start gap-2 min-w-0",children:[e(Le,{className:"h-3.5 w-3.5 text-primary mt-0.5 flex-shrink-0","aria-hidden":!0}),e("span",{className:"text-text-secondary text-xs line-clamp-1 min-w-0",children:a.timings})]}),a.languages&&e("div",{className:"flex items-center gap-2 min-w-0",children:[e(Ee,{className:"h-3.5 w-3.5 text-primary flex-shrink-0","aria-hidden":!0}),e("span",{className:"text-text-secondary text-xs line-clamp-1 min-w-0",children:a.languages})]}),a.hospitals?.length>1&&d?e(qe,{options:a.hospitals.map(t=>({value:t.hospital_id,label:t.name||""})),placeholder:"Select Hospital",disabled:p,onValueChange:le,value:d,triggerClassName:"h-8 text-xs px-3 rounded-lg border-border text-primary font-medium",icon:e(te,{className:"h-3.5 w-3.5 text-primary flex-shrink-0","aria-hidden":!0})}):e("div",{className:"flex items-center gap-1.5 min-w-0",children:[e(te,{className:"h-3.5 w-3.5 text-primary flex-shrink-0","aria-hidden":!0}),e("span",{className:"text-text-secondary text-xs line-clamp-1 min-w-0",children:a.hospitals?.[0]?.name||""})]}),a.info&&e("div",{className:"flex items-start gap-2 min-w-0",children:[e(we,{className:"h-3.5 w-3.5 text-primary flex-shrink-0","aria-hidden":!0}),e("div",{className:"min-w-0 flex-1",children:[e("div",{className:b("text-text-secondary text-xs leading-snug prose prose-sm max-w-none prose-strong:font-semibold prose-p:my-0 break-words overflow-hidden",!Y&&"line-clamp-1"),children:e(ke,{children:a.info})}),e("button",{type:"button",onClick:()=>ie(t=>!t),"aria-expanded":Y,className:"mt-0.5 flex items-center gap-1 text-[11px] font-semibold text-primary hover:text-primary/80 transition-colors",children:[e(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),Y?"View less":"View more"]})]})]})]}),H?S?e("p",{className:"pt-3 text-sm text-text-secondary text-center",children:"Loading..."}):n.length>0?e("div",{className:"pt-3",children:[e("div",{className:"flex items-center gap-2",children:[e(w,{type:"button",variant:"outline",size:"icon",onClick:()=>{if(s>0){const x=Math.max(0,s-3);g(x);const _=n[x]?.date;_&&A(_);return}const t=n[0]?.date,r=i&&(!t||i<t)?i:t;if(!r)return;const l=Z(r,-1);l<L||(f(l),A(l))},disabled:p||!ce,"aria-label":"Previous 3 days",className:"h-12 w-6 flex-shrink-0 rounded-lg border-border bg-surface text-primary hover:bg-black-100 dark:hover:bg-white-100 hover:text-primary disabled:opacity-50",children:e($e,{className:"h-4 w-4"})}),e("div",{className:"flex-1 grid grid-cols-3 gap-1 min-w-0",children:de.map((t,r)=>{if(!t||!t.date)return null;const l=i===t.date,x=(t?.slots||[]).length>0;return e(w,{type:"button",variant:"outline",onClick:()=>t.date&&A(t.date),disabled:p,"aria-current":l?"date":void 0,className:b("flex flex-col items-center justify-center h-12 rounded-lg border-2 p-0 gap-0 min-w-0 transition-all leading-tight",l?"border-primary border-2 ring-2 ring-primary/20 bg-primary/[20%] shadow-sm":x?"border-border bg-elicitationBg hover:bg-black-100 dark:hover:bg-white-100":"border-border bg-elicitationBg opacity-60 hover:bg-black-100 dark:hover:bg-white-100"),children:[e("span",{className:b("text-[10px] tracking-wide w-full text-center",l?"font-semibold text-text-primary":"text-black-700"),children:t.weekday}),e("span",{className:b("text-xs w-full text-center",l?"font-bold text-text-primary":"font-semibold text-black-700"),children:[t.dayNum," ",t.month]})]},`${t.date}-${r}`)})}),e(w,{type:"button",variant:"outline",size:"icon",onClick:()=>{if(s+3>=n.length){const l=n[n.length-1]?.date,x=i&&(!l||i>l)?i:l;if(x){const _=Z(x,1);f(_),A(_)}return}const t=Math.min(Math.max(0,n.length-3),s+3);g(t);const r=n[t]?.date;r&&A(r)},disabled:p,"aria-label":"Next 3 days",className:"h-12 w-6 flex-shrink-0 rounded-lg border-border bg-surface text-primary hover:bg-black-100 dark:hover:bg-white-100 hover:text-primary disabled:opacity-50",children:e(Me,{className:"h-4 w-4"})})]}),i&&e("div",{className:"mt-2",children:E.length>0?e("div",{className:"relative",children:[e("div",{ref:O,onScroll:se,className:"grid grid-cols-3 gap-2 overflow-y-auto overscroll-contain",style:{maxHeight:"108px"},children:E.map((t,r)=>{if(!t)return null;const l=h===t;return e(w,{type:"button",variant:"outline",onClick:()=>M(t),"aria-pressed":l,disabled:p,className:b("h-9 rounded-lg px-2 text-xs transition-all",l?"border-primary bg-primary/20 text-primary shadow-sm font-bold":"border-border bg-elicitationBg text-text-primary font-medium hover:bg-black-100 hover:text-black dark:hover:bg-white-100 hover:text-black"),children:e("span",{children:t})},t||`slot-${r}`)})}),I&&e("div",{className:"absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-elicitationBg via-elicitationBg to-transparent pointer-events-none flex items-end justify-center pb-1",children:e("button",{type:"button",onClick:oe,className:"pointer-events-auto flex items-center gap-1 text-xs font-semibold text-primary hover:text-primary/80 transition-colors",children:[e(G,{className:"h-3.5 w-3.5","aria-hidden":!0}),"More slots"]})})]}):P?e("p",{className:"text-sm text-text-secondary px-1",children:"Fetching slots..."}):e(re,{date:i})}),E?.length?e(w,{type:"button",onClick:me,disabled:N||p||!h,"aria-disabled":N||p||!h,className:`w-full h-10 gap-2 bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-60 shadow-sm font-semibold ${I?"":" mt-2"}`,children:[c?.title||"Book appointment",e(ae,{className:"h-4 w-4","aria-hidden":!0})]}):e(w,{type:"button",onClick:W,disabled:V,"aria-disabled":V,className:`w-full h-10 gap-2 bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-60 shadow-sm font-semibold ${I?"":" mt-2"}`,children:[c?.title||"Book appointment",e(ae,{className:"h-4 w-4","aria-hidden":!0})]})]}):e(X,{children:[e(re,{date:i}),e(w,{type:"button",onClick:W,disabled:V,"aria-disabled":V,className:`w-full h-10 gap-2 bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-60 shadow-sm font-semibold ${I?"":" mt-2"}`,children:[c?.title||"Book appointment",e(De,{className:"h-4 w-4","aria-hidden":!0})]})]}):e("div",{className:"pt-3",children:e(w,{type:"button",variant:"outline",onClick:ne,disabled:p||S,className:"w-full h-8 gap-1 text-xs border-primary/40 text-primary hover:bg-primary/10 disabled:opacity-60 font-medium rounded-lg",children:[S?"Loading...":"Show available slots",e(G,{className:"h-3.5 w-3.5","aria-hidden":!0})]})})]})]}):null}export{Pe as DoctorCard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as q,u as t,b as y,C as W,B as z,S as I,N as G,A as F,d as j,T as E,y as O,q as f,a as A,e as J}from"./medassist-widget.js";const R=q(({className:n,type:i,...c},o)=>{const d=n&&typeof n=="string"&&n.includes("placeholder:");return t("input",{type:i,className:y("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",!d&&"placeholder:text-muted-foreground",n),ref:o,...c})});R.displayName="Input";const Q=()=>t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"},"aria-hidden":"true",children:[t("clipPath",{id:"indian-flag-clip",children:t("circle",{cx:"8",cy:"8",r:"8"})}),t("g",{clipPath:"url(#indian-flag-clip)",children:[t("rect",{width:"16",height:"5.34",fill:"#FF9933"}),t("rect",{y:"5.33",width:"16",height:"5.34",fill:"#FFFFFF"}),t("rect",{y:"10.66",width:"16",height:"5.34",fill:"#128807"})]}),t("circle",{cx:"8",cy:"8",r:"2.2",fill:"none",stroke:"#000088",strokeWidth:"0.6"})]}),U="+91";function X(n){const i=n.replace(/\D/g,""),c=i.slice(0,5),o=i.slice(5,10);return o?`${c} ${o}`:c}function Z({value:n,onChange:i,onKeyDown:c,disabled:o,theme:d,isMobile:m,maxLength:s,isMobileValid:l,onSend:p}){return t("div",{className:"px-2 pt-3 pb-2 space-y-2 w-full",children:[t("p",{className:"px-1 text-xs font-semibold tracking-wide text-foreground uppercase",children:"Enter your mobile number"}),t("div",{className:"flex items-center gap-2 w-full",children:[t("div",{className:y("inline-flex items-center gap-2 rounded-full px-3 shrink-0 py-2 min-h-[56px]",o&&"opacity-60",d?.textColor==="white"?"bg-white-100":"bg-black-100"),style:{fontSize:m?"16px":"14px"},children:[t(Q,{}),t("span",{className:"text-sm font-medium text-foreground",children:U}),t(W,{className:"h-4 w-4 text-muted-foreground","aria-hidden":!0})]}),t("div",{className:y("flex items-center gap-1 rounded-full px-2 py-2 flex-1 min-w-0",o&&"opacity-60",d?.textColor==="white"?"bg-white-100":"bg-black-100"),children:[t(R,{type:"tel",autoComplete:"tel-national",value:X(n),onChange:i,onKeyDown:c,placeholder:"88888 88888",className:y("w-full h-full shadow-none border-0 outline-none focus-visible:ring-0 focus-visible:ring-offset-0","text-sm placeholder:text-muted-foreground/40 bg-transparent","disabled:cursor-not-allowed rounded-none break-words overflow-wrap-anywhere whitespace-pre-wrap","text-foreground px-3 py-2 pr-11 min-h-[40px]"),style:{fontSize:m?"16px":"14px"},maxLength:s?s+1:void 0,inputMode:"numeric",autoFocus:!o,disabled:o}),t(z,{type:"button",size:"icon",onClick:p,disabled:o||!l,variant:"ghost",className:`h-10 w-10 ${l?"bg-primary":"bg-none"} hover:bg-primary/90 rounded-full transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95 shrink-0 disabled:opacity-50 disabled:pointer-events-none disabled:hover:scale-100`,title:l?"Submit mobile number":"Enter a valid mobile number","aria-label":l?"Submit mobile number":"Enter a valid mobile number",children:t(I,{className:`w-4 h-4 ${l?"text-primary-foreground":"text-primary"}`})})]})]})]})}const H=6,ee=30,te=(n,i)=>n.disabled===i.disabled&&n.isMobile===i.isMobile&&n.validation?.pattern===i.validation?.pattern&&n.validation?.minLength===i.validation?.minLength&&n.validation?.maxLength===i.validation?.maxLength&&n.serverMessage===i.serverMessage&&n.theme?.textColor===i.theme?.textColor;function ne({disabled:n,isMobile:i,validation:c,onSubmit:o,onResendOtp:d,serverMessage:m}){const s=F([]),[l,p]=j(0),[b,w]=j(!1),N=F(!1),M=F(o),k=F(d),r=c?.maxLength??H,x=E(()=>new RegExp(c?.pattern??`^\\d{${r}}$`),[c?.pattern,r]);O(()=>{M.current=o},[o]),O(()=>{k.current=d},[d]),O(()=>{if(!m)return;const e=m.toLowerCase();e.includes("otp")&&(e.includes("invalid")||e.includes("incorrect")||e.includes("wrong"))&&(N.current=!1,w(!1))},[m]);const g=f(()=>s.current.map(e=>e?.value.replace(/\D/g,"").slice(-1)??""),[]),S=f(()=>{const e=g().join(""),a=e.length===r&&x.test(e);N.current!==a&&(N.current=a,w(a))},[r,x,g]),$=f(e=>{e<r-1&&s.current[e+1]?.focus()},[r]),D=f(e=>{e>0&&s.current[e-1]?.focus()},[]),P=E(()=>Array.from({length:r},(e,a)=>a),[r]),C=f(e=>{for(let h=0;h<r;h++){const v=s.current[h];v&&(v.value=e[h]??"")}S();const a=Math.min(e.length,r-1);s.current[a]?.focus()},[S,r]),T=f((e,a)=>{const h=a.target.value.replace(/\D/g,"");if(h.length>1){C(h.slice(0,r));return}const v=h.slice(-1);a.target.value=v,S(),v&&$(e)},[S,C,$,r]),L=f((e,a)=>{if(a.key==="Backspace"&&!s.current[e]?.value){D(e);return}if(a.key==="Enter"&&!a.shiftKey&&!n){a.preventDefault();const h=g().join("");if(h.length===r&&x.test(h))M.current(h);else{const v=g().findIndex(Y=>!Y);s.current[v===-1?0:v]?.focus()}}},[n,D,r,x,g]),u=f(e=>{e.preventDefault();const a=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,r);a&&C(a)},[C,r]),_=f(()=>{if(n)return;const e=g().join("");e.length===r&&x.test(e)&&M.current(e)},[n,r,x,g]),K=f(()=>{if(!(l>0||n)){for(const e of s.current)e&&(e.value="");N.current=!1,w(!1),s.current[0]?.focus(),k.current?.(),p(ee)}},[n,l]);O(()=>{n||s.current[0]?.focus()},[n]),O(()=>{if(b){l>0&&p(0);return}if(l<=0)return;const e=setTimeout(()=>p(a=>a-1),1e3);return()=>clearTimeout(e)},[b,l]);const V=E(()=>P.map(e=>t("input",{ref:a=>{s.current[e]=a},type:"text",inputMode:"numeric",maxLength:i&&e===0?r:1,onChange:a=>T(e,a),onKeyDown:a=>L(e,a),onPaste:u,disabled:n,tabIndex:0,style:{fontSize:i?"16px":"14px",backgroundColor:"var(--input-box-bg)"},className:y("h-10 w-10 rounded-full border text-center text-lg font-semibold text-foreground","border-border shadow-sm outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 focus-visible:border-transparent","disabled:cursor-not-allowed disabled:opacity-50"),autoComplete:e===0?"one-time-code":"off","aria-label":`Digit ${e+1}`},e)),[n,P,T,L,u,i,r]);return t("div",{className:"px-4 pt-3 pb-2 space-y-3",children:t("div",{className:"flex flex-col gap-3",children:[t("div",{className:"flex items-center justify-between",children:[t("p",{className:"text-xs font-semibold tracking-wide text-foreground uppercase",children:"Please enter the OTP"}),!b&&t("button",{type:"button",onClick:K,disabled:n||l>0,className:y("text-xs font-medium underline underline-offset-2","text-primary hover:opacity-90 disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed"),children:["Resend OTP",l>0?` (00:${String(l).padStart(2,"0")}s)`:""]})]}),t("div",{className:"flex items-center w-full gap-2 justify-between",children:[t("div",{className:"flex items-center gap-2",children:V}),t(z,{type:"button",size:"icon",onClick:_,disabled:n,variant:"ghost",className:`h-10 w-10 ${b?"bg-primary":"bg-none"} hover:bg-primary/90 rounded-full transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95 shrink-0 disabled:opacity-50 disabled:pointer-events-none disabled:hover:scale-100`,title:b?"Submit OTP":"Enter the full OTP to submit","aria-label":b?"Submit OTP":"Enter the full OTP to submit",children:t(I,{className:`w-4 h-4 ${b?"text-primary-foreground":"text-primary"}`})})]})]})})}const ie=G(ne,te);function le({value:n,onChange:i,onKeyDown:c,placeholder:o,disabled:d,theme:m,isMobile:s,isEmailValid:l,onSend:p}){return t("div",{className:"px-2 pt-3 pb-2 space-y-2 w-full",children:[t("p",{className:"px-1 text-xs font-semibold tracking-wide text-foreground uppercase",children:"Enter your email address"}),t("div",{className:y("flex items-center gap-1 rounded-full px-2 py-2 w-full",d&&"opacity-60",m?.textColor==="white"?"bg-white-100":"bg-black-100"),children:[t(R,{type:"email",autoComplete:"email",value:n,onChange:i,onKeyDown:c,placeholder:o??"username@example.com",className:y("w-full h-full shadow-none border-0 outline-none focus-visible:ring-0 focus-visible:ring-offset-0","text-sm placeholder:text-muted-foreground/40 bg-transparent","disabled:cursor-not-allowed rounded-none break-words overflow-wrap-anywhere whitespace-pre-wrap","text-foreground px-3 py-2 pr-11 min-h-[40px]"),style:{fontSize:s?"16px":"14px"},autoFocus:!d,disabled:d}),t(z,{type:"button",size:"icon",onClick:p,disabled:d||!l,variant:"ghost",className:`h-10 w-10 ${l?"bg-primary":"bg-none"} hover:bg-primary/90 rounded-full transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95 shrink-0 disabled:opacity-50 disabled:pointer-events-none disabled:hover:scale-100`,title:l?"Submit email address":"Enter a valid email address","aria-label":l?"Submit email address":"Enter a valid email address",children:t(I,{className:`w-4 h-4 ${l?"text-primary-foreground":"text-primary"}`})})]})]})}const B=10,ae=10,re=/^[6-9][0-9]{9}$/,oe=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function se({elicitationEntry:n,value:i,onChange:c,isDisabled:o,theme:d,isMobile:m,onSend:s}){const{component:l,pattern:p,minLength:b,maxLength:w,description:N,disp_toast_msg:M,tool_key:k}=n??{},r=E(()=>l===A.SYNAPSE_COMPONENTS.MOBILE,[l]),x=E(()=>l===A.SYNAPSE_COMPONENTS.OTP,[l]),g=E(()=>l===A.SYNAPSE_COMPONENTS.EMAIL,[l]);if(!r&&!x&&!g)return null;const S=M?.trim()??"",$=u=>{const _=u.target.value.replace(/\D/g,""),K=w??B;c(_.slice(0,K))},D=i.length===(b??ae)&&(p?new RegExp(p).test(i):re.test(i)),P=p?new RegExp(p).test(i):oe.test(i),C=()=>{!P||o||s({toolCalled:!0,tool_key:k})},T=u=>{u.key==="Enter"&&(u.preventDefault(),C())},L=()=>{!D||o||s({toolCalled:!0,tool_key:k})};return t(J,{children:[r&&t(Z,{value:i,onChange:$,onSend:L,onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),L())},placeholder:N??"Enter your mobile number",disabled:o,isMobileValid:D,theme:d,isMobile:m,maxLength:w??B}),x&&t(ie,{disabled:o,isMobile:m,validation:{pattern:p,minLength:b,maxLength:w},onSubmit:u=>{s({message:u,toolCalled:!0,tool_key:k})},onResendOtp:()=>{s({toolCalled:!0,resend:!0,tool_key:k})},serverMessage:S,theme:d}),g&&t(le,{value:i,onChange:u=>c(u.target.value),onKeyDown:T,disabled:o,isEmailValid:P,theme:d,isMobile:m,placeholder:N,onSend:C})]})}export{se as ElicitationInput};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d,A as m,y as T,_ as F,u as r,b as x}from"./medassist-widget.js";import{C as R,a as X}from"./medassist-widget-chevron-right-CKYbGWbY.js";const g=12,I=.76,$=3;function j({count:s,renderItem:h,className:b}){const[n,N]=d(0),[o,M]=d(0),[z,A]=d(()=>Math.min($,s)),i=m(null),f=m(0),p=m(0);if(T(()=>{A(e=>Math.max(e,Math.min(n+2,s)))},[n,s]),F(()=>{const e=i.current;if(!e)return;const a=u=>{const v=Math.round(u);M(w=>w===v?w:v)};a(e.clientWidth);let t=0;const y=new ResizeObserver(([u])=>{cancelAnimationFrame(t),t=requestAnimationFrame(()=>a(u.contentRect.width))});return y.observe(e),()=>{cancelAnimationFrame(t),y.disconnect()}},[]),s===0)return null;const l=e=>N(Math.max(0,Math.min(s-1,e))),c=o*I;if(s===1)return r("div",{ref:i,className:x("mt-3 w-full",b),children:o>0&&r("div",{className:"ml-auto",style:{width:c},children:h(0,!0)})});const k=(o-c)/2,C=o>0?k-n*(c+g):0;return r("div",{ref:i,className:x("mt-3 w-full",b),children:o>0&&r("div",{className:"relative w-full",children:[r("div",{className:"w-full overflow-hidden py-3",onTouchStart:e=>{f.current=e.touches[0].clientX,p.current=e.touches[0].clientY},onTouchEnd:e=>{const a=e.changedTouches[0].clientX-f.current,t=e.changedTouches[0].clientY-p.current;Math.abs(a)>Math.abs(t)&&Math.abs(a)>50&&l(n+(a<0?1:-1))},children:r("div",{className:"flex items-stretch",style:{transform:`translateX(${C}px)`,transition:"transform 400ms cubic-bezier(0.4, 0, 0.2, 1)",gap:`${g}px`},"aria-live":"polite",children:Array.from({length:z},(e,a)=>{const t=a===n;return r("div",{"aria-hidden":!t,style:{flex:`0 0 ${c}px`,position:"relative",opacity:t?1:.6,transform:t?"scale(1.05)":"scale(0.9)",zIndex:t?20:10,transition:"all 400ms cubic-bezier(0.4, 0, 0.2, 1)",borderRadius:12},children:h(a,t)},a)})})}),n>0&&r("button",{type:"button","aria-label":"Previous",onClick:()=>l(n-1),className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 h-10 w-10 p-2 flex items-center justify-center rounded-full bg-background/90 shadow-md border border-primary text-primary hover:bg-muted transition-colors",children:r(R,{size:18})}),n<s-1&&r("button",{type:"button","aria-label":"Next",onClick:()=>l(n+1),className:"absolute right-0 top-1/2 -translate-y-1/2 z-10 h-10 w-10 p-2 flex items-center justify-center rounded-full bg-background/90 shadow-md border border-primary text-primary hover:bg-muted transition-colors",children:r(X,{size:18})})]})})}export{j as FocusCarousel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as d,A as N,d as x,y as j,u as e,v as R,r as C,F as L,e as D,B as M}from"./medassist-widget.js";const U=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],P=d("camera",U),$=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],z=d("download",$),E=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],F=d("image-off",E),H=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],T=d("lock",H);function u(r){try{return new URL(r,window.location.href).pathname.toLowerCase().endsWith(".pdf")}catch{return r.toLowerCase().split("?")[0].endsWith(".pdf")}}function A(r,n="download.pdf"){try{const t=new URL(r,window.location.href).pathname.split("/").pop();return t?decodeURIComponent(t):n}catch{return r.split("?")[0].split("/").pop()||n}}async function _(r){try{const n=await fetch(r,{headers:{Range:"bytes=-4096"}});if(!n.ok&&n.status!==206)return"error";const t=await n.arrayBuffer();return new TextDecoder("latin1").decode(t.slice(-4096)).includes("/Encrypt")?"protected":"ok"}catch{return"unknown"}}function y(r,n){const t=document.createElement("a");t.href=r,t.download=n,document.body.appendChild(t),t.click(),t.remove()}async function O(r){const n=A(r);try{const t=await fetch(r);if(!t.ok)throw new Error(`HTTP ${t.status}`);const o=URL.createObjectURL(await t.blob());y(o,n),URL.revokeObjectURL(o)}catch{const t=document.createElement("a");t.href=r,t.download=n,t.target="_blank",t.rel="noopener",document.body.appendChild(t),t.click(),t.remove()}}async function g(r,n){if(r.current)try{const t=(await import("./medassist-widget-html2canvas.esm-CphxV6YW.js")).default,o=await t(r.current,{useCORS:!0});y(o.toDataURL("image/png"),n)}catch{}}function V({card:r}){const{title:n,description:t,tags_text:o,banner_text:m,action:s,link:a}=r,i=N(null),[b,h]=x(!1),[l,f]=x("loading"),p=!!a&&u(a),c=!!a&&!u(a);j(()=>{if(h(!1),!a||!u(a))return;let w=!1;return f("loading"),_(a).then(v=>{w||f(v)}),()=>{w=!0}},[a]);const k=()=>{s==="screenshot"?g(i,`screenshot-${Date.now()}.png`):s==="download"&&(p&&a?O(a):g(i,"card.png"))};return e("div",{className:"flex flex-col gap-2",children:[e(R,{ref:i,className:"overflow-hidden rounded-xl border border-border bg-elicitationBg text-card-foreground shadow-sm",children:e(C,{className:"p-3 space-y-2",children:[e("div",{className:`flex items-start gap-3 ${c?"justify-between":"justify-center"}`,children:[e("div",{className:`space-y-2 ${c?"min-w-0 flex-1":"flex flex-col items-center"}`,children:[n&&e("span",{className:"inline-block rounded-full px-3 py-1 text-sm font-semibold bg-primary text-primary-foreground",children:n}),t&&e("p",{className:`text-sm text-foreground leading-snug ${c?"":"text-center"}`,children:t}),m&&e("span",{className:"inline-block rounded-full px-3 py-1 text-xs font-semibold bg-green-600 text-white",children:m})]}),c&&e("div",{className:"shrink-0 h-24 w-24 rounded-lg overflow-hidden border border-border",children:b?e("div",{className:"flex h-full w-full items-center justify-center bg-muted text-muted-foreground",children:e(F,{className:"h-6 w-6"})}):e("img",{src:a,alt:n??"media",className:"h-full w-full object-cover",onError:()=>h(!0)})})]}),p&&e("button",{type:"button",onClick:()=>window.open(a,"_blank","noopener,noreferrer"),className:"relative w-full h-48 sm:h-72 md:h-80 max-h-[70vh] rounded-lg border border-border overflow-hidden cursor-pointer p-0 bg-transparent","aria-label":`Open ${n??"PDF"}`,children:[l==="loading"&&e("div",{className:"h-full w-full animate-pulse bg-muted"}),(l==="ok"||l==="unknown")&&e("iframe",{src:a,title:n??"PDF preview",className:"w-full h-full pointer-events-none"}),l==="protected"&&e("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-muted/50 text-muted-foreground",children:[e(T,{className:"h-8 w-8"}),e("span",{className:"text-sm font-medium text-foreground",children:"Password-protected PDF"}),e("span",{className:"text-xs",children:"Tap to open and unlock"})]}),l==="error"&&e("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-muted/50 text-muted-foreground",children:[e(L,{className:"h-8 w-8"}),e("span",{className:"text-sm font-medium text-foreground",children:"PDF"}),e("span",{className:"text-xs",children:"Tap to open"})]}),e("span",{className:"absolute inset-0","aria-hidden":"true"})]}),o&&e(D,{children:[e("div",{className:"border-t border-border"}),e("p",{className:"text-xs text-muted-foreground",children:o})]})]})}),s&&e("div",{className:"flex justify-end",children:e(M,{type:"button",variant:"outline",size:"sm",className:"rounded-md px-5 gap-1.5",onClick:k,children:[s==="screenshot"?e(P,{className:"h-4 w-4"}):e(z,{className:"h-4 w-4"}),s==="screenshot"?"Screenshot":"Download"]})})]})}export{V as MediaCard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as x,y as N,q as G,d as w,R as V,f as B,T as X,D as _,g as Y,u as i,P as I,h as J,e as D,i as F,j as R,b as S}from"./medassist-widget.js";import{C as Q}from"./medassist-widget-check-BaHLRs-2.js";var U=V[" useInsertionEffect ".trim().toString()]||B;function Z({prop:e,defaultProp:t,onChange:a=()=>{},caller:d}){const[c,n,l]=ee({defaultProp:t,onChange:a}),u=e!==void 0,o=u?e:c;{const p=x(e!==void 0);N(()=>{const h=p.current;if(h!==u){const v=h?"controlled":"uncontrolled",k=u?"controlled":"uncontrolled"}p.current=u},[u,d])}const f=G(p=>{if(u){const h=te(p)?p(e):p;h!==e&&l.current?.(h)}else n(p)},[u,e,n,l]);return[o,f]}function ee({defaultProp:e,onChange:t}){const[a,d]=w(e),c=x(a),n=x(t);return U(()=>{n.current=t},[t]),N(()=>{c.current!==a&&(n.current?.(a),c.current=a)},[a,c]),[a,d,n]}function te(e){return typeof e=="function"}function oe(e){const t=x({value:e,previous:e});return X(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function re(e){const[t,a]=w(void 0);return B(()=>{if(e){a({width:e.offsetWidth,height:e.offsetHeight});const d=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const n=c[0];let l,u;if("borderBoxSize"in n){const o=n.borderBoxSize,f=Array.isArray(o)?o[0]:o;l=f.inlineSize,u=f.blockSize}else l=e.offsetWidth,u=e.offsetHeight;a({width:l,height:u})});return d.observe(e,{box:"border-box"}),()=>d.unobserve(e)}else a(void 0)},[e]),t}var P="Checkbox",[ne]=Y(P),[ae,E]=ne(P);function ce(e){const{__scopeCheckbox:t,checked:a,children:d,defaultChecked:c,disabled:n,form:l,name:u,onCheckedChange:o,required:f,value:p="on",internal_do_not_use_render:h}=e,[v,k]=Z({prop:a,defaultProp:c??!1,onChange:o,caller:P}),[g,r]=w(null),[b,s]=w(null),m=x(!1),q=g?!!l||!!g.closest("form"):!0,y={checked:v,disabled:n,setChecked:k,control:g,setControl:r,name:u,form:l,value:p,hasConsumerStoppedPropagationRef:m,required:f,defaultChecked:C(c)?!1:c,isFormControl:q,bubbleInput:b,setBubbleInput:s};return i(ae,{scope:t,...y,children:le(h)?h(y):d})}var M="CheckboxTrigger",O=_(({__scopeCheckbox:e,onKeyDown:t,onClick:a,...d},c)=>{const{control:n,value:l,disabled:u,checked:o,required:f,setControl:p,setChecked:h,hasConsumerStoppedPropagationRef:v,isFormControl:k,bubbleInput:g}=E(M,e),r=F(c,p),b=x(o);return N(()=>{const s=n?.form;if(s){const m=()=>h(b.current);return s.addEventListener("reset",m),()=>s.removeEventListener("reset",m)}},[n,h]),i(I.button,{type:"button",role:"checkbox","aria-checked":C(o)?"mixed":o,"aria-required":f,"data-state":K(o),"data-disabled":u?"":void 0,disabled:u,value:l,...d,ref:r,onKeyDown:R(t,s=>{s.key==="Enter"&&s.preventDefault()}),onClick:R(a,s=>{h(m=>C(m)?!0:!m),g&&k&&(v.current=s.isPropagationStopped(),v.current||s.stopPropagation())})})});O.displayName=M;var A=_((e,t)=>{const{__scopeCheckbox:a,name:d,checked:c,defaultChecked:n,required:l,disabled:u,value:o,onCheckedChange:f,form:p,...h}=e;return i(ce,{__scopeCheckbox:a,checked:c,defaultChecked:n,disabled:u,required:l,onCheckedChange:f,name:d,form:p,value:o,internal_do_not_use_render:({isFormControl:v})=>i(D,{children:[i(O,{...h,ref:t,__scopeCheckbox:a}),v&&i(j,{__scopeCheckbox:a})]})})});A.displayName=P;var H="CheckboxIndicator",L=_((e,t)=>{const{__scopeCheckbox:a,forceMount:d,...c}=e,n=E(H,a);return i(J,{present:d||C(n.checked)||n.checked===!0,children:i(I.span,{"data-state":K(n.checked),"data-disabled":n.disabled?"":void 0,...c,ref:t,style:{pointerEvents:"none",...e.style}})})});L.displayName=H;var T="CheckboxBubbleInput",j=_(({__scopeCheckbox:e,...t},a)=>{const{control:d,hasConsumerStoppedPropagationRef:c,checked:n,defaultChecked:l,required:u,disabled:o,name:f,value:p,form:h,bubbleInput:v,setBubbleInput:k}=E(T,e),g=F(a,k),r=oe(n),b=re(d);N(()=>{const m=v;if(!m)return;const q=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(q,"checked").set,W=!c.current;if(r!==n&&y){const $=new Event("click",{bubbles:W});m.indeterminate=C(n),y.call(m,C(n)?!1:n),m.dispatchEvent($)}},[v,r,n,c]);const s=x(C(n)?!1:n);return i(I.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??s.current,required:u,disabled:o,name:f,value:p,form:h,...t,tabIndex:-1,ref:g,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});j.displayName=T;function le(e){return typeof e=="function"}function C(e){return e==="indeterminate"}function K(e){return C(e)?"indeterminate":e?"checked":"unchecked"}const z=_(({className:e,...t},a)=>i(A,{ref:a,className:S("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:i(L,{className:S("grid place-content-center text-current"),children:i(Q,{className:"h-4 w-4"})})}));z.displayName=A.displayName;function se({options:e,selectedValues:t,onSelectionChange:a,additionalOption:d,className:c,required:n=!0,maxSelections:l,disabled:u}){const o=d?{id:`extra-${d}`,label:d==="all_of_the_above"?"All of the above":"None of the above",value:d==="all_of_the_above"?"All of the above":"None of the above"}:null,f=r=>o?r.filter(b=>b!==o.value):r,p=r=>o?d==="none_of_the_above"?r?[o.value]:[]:d==="all_of_the_above"?r?[...e.map(b=>b.value),o.value]:f(t):r?[...t,o.value]:f(t):t,h=(r,b)=>{const s=o?f(t):t;return b?l&&s.length>=l?null:[...s,r]:s.filter(m=>m!==r)},v=r=>!(n&&r.length===0&&t.length===1),k=(r,b)=>{const s=o&&r===o.value?p(b):h(r,b);s!==null&&v(s)&&a(s)},g=o?t.filter(r=>r!==o.value).length:t.length;return e.length?i("div",{className:S(c),children:[i("div",{className:"space-y-3",children:[e.map(r=>{const b=u||l&&g>=l&&!t.includes(r.value);let s=t.includes(r.value);return i("div",{className:"flex items-center space-x-3",children:[i(z,{id:r.id,checked:s,disabled:!!b,onCheckedChange:m=>k(r.value,!!m),className:"mt-0.5 border border-muted-foreground text-primary-foreground"}),i("label",{htmlFor:r.id,className:S("text-sm font-normal leading-4 cursor-pointer",b?"text-muted-foreground cursor-not-allowed":s?"text-primary":"text-secondary-foreground"),children:r.label})]},r.id)}),o&&i(D,{children:[i("div",{className:"border-t border-border-medium my-3"}),i("div",{className:"flex items-center space-x-3",children:[i(z,{id:o.id,checked:t.includes(o.value),onCheckedChange:r=>k(o.value,r),className:"mt-0.5 border border-muted-foreground"}),i("label",{htmlFor:o.id,className:"text-sm font-medium leading-none cursor-pointer text-secondary-foreground",children:o.label})]})]})]}),l&&g>=l&&i("p",{className:"text-sm text-blue-600 mt-3",children:l===1?"You can select only 1 option":`Maximum ${l} selections allowed`})]}):null}export{se as MultiSelectGroup};
|