@tavus/widget 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,7 +54,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
54
54
  `;function kh(e){return e.replace(/\s(width|height)="\d+"/g,``)}function Ah(e,t){let n=kh(e);return({size:e=`var(--icon-size, 1.5rem)`,class:r,"aria-label":i,"aria-hidden":a})=>P(`span`,{class:r,role:a?void 0:`img`,"aria-hidden":a||void 0,"aria-label":a?void 0:i??t,style:{display:`inline-flex`,width:e,height:e},dangerouslySetInnerHTML:{__html:n.replace(`<svg`,`<svg width="100%" height="100%"`)}})}var jh={pixelarticons:{close:Ah(uh,`Close`),cancel:Ah(dh,`Cancel`),leave:Ah(gh,`Leave call`),more:Ah(bh,`More`),error:Ah(ph,`Error`),mic:Ah(_h,`Microphone`),"mic-off":Ah(vh,`Microphone muted`),cam:Ah(Oh,`Camera`),"cam-off":Ah(oh,`Camera off`),"screen-share":Ah(Sh,`Screen share`),pip:Ah(xh,`Picture in picture`),user:Ah(wh,`User`),"face-smile":Ah(Eh,`Camera off`),captions:Ah(sh,`Closed captions`),chat:Ah(ch,`Chat`),fullscreen:Ah(hh,`Enter fullscreen`),"fullscreen-exit":Ah(fh,`Exit fullscreen`),expand:Ah(mh,`Expand`),collapse:Ah(fh,`Collapse`),send:Ah(Ch,`Send`),"external-link":Ah(Dh,`External link`),clock:Ah(lh,`Clock`),moon:Ah(yh,`Unavailable`),users:Ah(Th,`Busy`)},lucide:ah};function Mh({name:e,...t}){let{config:n}=Bp(),r=(jh[n.value.customization.style.icon_library]??jh.pixelarticons)[e];return P(r,{...t})}var Nh=`Ready when you are`,Ph=`Start the conversation`;function Fh(e){return typeof e==`string`&&e.length>0?e:``}function Ih(e){let t=Fh(e.replica_thumbnail_image_url)||null,n=Fh(e.replica_thumbnail_video_url)||null;return!t&&!n?null:{imageUrl:t,videoUrl:n}}function Lh(e){let{preview:t}=e.customization,{background:n}=t,r=Ih(e),i;i=n.type?n.type:r?`replica`:`background-gradient`;let a=Fh(n.url);return{title:t.title||Nh,description:t.description||``,btn_title:t.btn_title||Ph,background:{type:i,url:a}}}var Rh={backgroundImage:`linear-gradient(to bottom right, var(--color-primary), var(--color-base-300))`},zh=`#t=0.1`;function Bh(e){return e.includes(`#`)?e:`${e}${zh}`}function Vh({replica:e,fallback:t=null}){let[n,r]=O(()=>new Set),i=e=>r(t=>new Set(t).add(e)),a=`absolute inset-0 w-full h-full object-cover`,{imageUrl:o,videoUrl:s}=e;return o&&!n.has(o)?P(`img`,{class:a,src:o,loading:`lazy`,alt:``,onError:()=>i(o)}):s&&!n.has(s)?P(`video`,{class:a,src:Bh(s),muted:!0,playsinline:!0,preload:`metadata`,controls:!1,onError:()=>i(s)}):P(E,{children:t})}function Hh({variant:e,replica:t}){let[n,r]=O(!1);return k(()=>{r(!1)},[e.url]),e.type===`replica`&&t?P(Vh,{replica:t,fallback:P(`div`,{class:`absolute inset-0`,style:Rh})}):e.type===`custom-image`&&e.url&&!n?P(`img`,{class:`absolute inset-0 w-full h-full object-cover`,src:e.url,loading:`lazy`,alt:``,onError:()=>r(!0)}):P(`div`,{class:`absolute inset-0`,style:Rh})}function Uh({className:e=``}){let{config:t}=Bp(),n=Lh(t.value),r=Ih(t.value);return P(`div`,{class:`relative size-16 shrink-0 rounded-box overflow-hidden bg-base-300 ${e}`,children:P(Hh,{variant:n.background,replica:r})})}var Wh=`absolute inset-0 bg-base-100 text-base-content flex flex-col items-center justify-center gap-6 px-6 py-8 text-center overflow-y-auto motion-safe:animate-[tavusFadeUp_280ms_ease-out]`;function Gh({title:e,description:t,media:n,children:r,overlay:i}){return P(`div`,{class:Wh,children:[n===void 0?P(Uh,{}):n,(e||t)&&P(`div`,{class:`flex flex-col items-center gap-3 max-w-sm`,children:[e&&P(`h2`,{class:`text-lg font-medium leading-snug`,children:e}),t&&P(`p`,{class:`text-base text-base-content/60 tracking-wide leading-snug`,children:t})]}),r&&P(`div`,{class:`flex flex-col items-center gap-3`,children:r}),i]})}function Kh({loading:e=!1,disabled:t,class:n,children:r,...i}){return P(`button`,{type:`button`,class:`btn relative ${n?` ${n}`:``}`,disabled:t||e,"aria-busy":e||void 0,...i,children:[P(`span`,{children:r}),e&&P(`span`,{class:`absolute inset-0 flex items-center justify-center backdrop-blur-xs`,"aria-hidden":`true`,children:P(`span`,{class:`loading loading-spinner loading-sm`})})]})}var qh={daily_limit:{title:`PAL is at today's limit`,description:`This PAL can take more conversations tomorrow.`},total_limit:{title:`PAL is unavailable`,description:`This PAL isn't available right now. Please check back later.`},busy:{title:`PAL is in another conversation`,description:`Please try again in a moment.`},error:{title:`Couldn't load this PAL`,description:`This PAL couldn't be loaded. Please try again later.`},captcha_unsupported:{title:`This PAL isn't available on this device`,description:`The security check couldn't run in this browser. Please try another device.`}};function Jh(e,t){let n=t?.[e];return{title:n?.title||qh[e].title,description:n?.description||qh[e].description}}var Yh={daily_limit:`clock`,total_limit:`moon`,busy:`users`,error:`error`,captcha_unsupported:`error`},Xh={daily_limit:`never`,total_limit:`never`,busy:`always`,error:`when-retryable`,captcha_unsupported:`never`};function Zh({cause:e}){return P(`div`,{class:`flex size-16 shrink-0 items-center justify-center rounded-box bg-base-200 text-base-content/70`,children:P(Mh,{name:Yh[e],size:`2rem`})})}function Qh({cause:e,canRetry:t,onRetry:n,onCancel:r,isStarting:i=!1}){let{config:a}=Bp(),o=a.value.customization?.unavailable_screen,s=Jh(e,o),c=o?.cta??[],l=Xh[e],u=l===`always`||l===`when-retryable`&&t,d=u||c.length>0||!!r;return P(Gh,{media:P(Zh,{cause:e}),title:s.title,description:s.description,children:d&&P(`div`,{class:`flex flex-wrap items-center justify-center gap-2`,children:[u&&P(Kh,{class:`btn-neutral rounded-box`,disabled:!t,loading:i,onClick:n,children:`Try again`}),c.map(e=>P(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`btn btn-outline rounded-box`,children:e.title},e.url)),r&&P(`button`,{type:`button`,class:`btn btn-ghost`,onClick:r,children:`Close`})]})})}function $h(){let e=N(If);return{state:e.flowSignal.value,isStarting:e.isStarting,permissionRequest:e.permissionRequest,unavailableCause:e.unavailableCause,canRetry:e.canRetry,start:e.start,join:e.join,cancel:e.cancel,leave:e.leave,restart:e.restart}}function eg(){return N(ut)?.layout??`inline`}function tg({kind:e,status:t}){if(e===`camera`)return`Allow camera access to use video. Camera is optional.`;switch(t){case`blocked`:return`Microphone is blocked. Allow access in your browser settings to continue.`;case`in-use`:return`Your microphone is in use by another app. Close it and try again.`;case`not-found`:return`No microphone found. Connect one to continue.`;case`unsupported`:return`This browser can't access your microphone.`;default:return`Allow microphone access to start the conversation.`}}function ng({message:e,class:t}){return P(`div`,{class:`w-max max-w-[min(20rem,80vw)] ${t??``}`,children:[P(`div`,{class:`px-4 py-2 rounded-box bg-neutral text-neutral-content text-sm font-medium shadow-lg text-center`,role:`status`,"aria-live":`polite`,children:e}),P(`svg`,{class:`absolute left-1/2 -translate-x-1/2 top-full text-neutral`,width:`16`,height:`8`,viewBox:`0 0 16 8`,"aria-hidden":`true`,children:P(`path`,{d:`M0 0 L8 8 L16 0 Z`,fill:`currentColor`})})]})}var rg=`text-preview-title @max-mobile:text-preview-title-narrow`,ig=`text-preview-title-full-screen`,ag=`text-sm @max-mobile:text-xs`,og=`text-preview-description-full-screen`;function sg({title:e,description:t,fullScreen:n}){return!e&&!t?null:P(`div`,{class:`flex flex-col gap-1 text-left ${n?`max-w-xl`:`max-w-sm`}`,children:[e&&P(`h2`,{class:`${n?ig:rg} font-medium leading-tight`,children:e}),t&&P(`p`,{class:`${n?og:ag} text-white/80 leading-snug`,children:t})]})}var cg=`absolute inset-0 overflow-hidden bg-base-100 motion-safe:animate-[tavusFadeUp_280ms_ease-out]`,lg=`absolute inset-x-0 top-0 h-2/5 bg-linear-to-b from-black/60 to-transparent`,ug=`absolute inset-x-0 bottom-0 h-2/5 bg-linear-to-t from-black/70 to-transparent`,dg=`absolute inset-0 bg-black/45`,fg=`absolute inset-0 overflow-y-auto p-8 @max-mobile:p-5 text-white [text-shadow:0_1px_3px_rgb(0_0_0/0.45)]`;function pg({title:e,description:t,children:n,align:r=`low`,overlay:i,class:a,role:o,"aria-live":s}){let{config:c}=Bp(),l=Lh(c.value),u=Ih(c.value),d=eg()===`full-screen`;return P(`div`,{class:a?`${cg} ${a}`:cg,role:o,"aria-live":s,children:[P(Hh,{variant:l.background,replica:u}),r===`center`?P(E,{children:[P(`div`,{class:dg}),P(`div`,{class:`${fg} flex flex-col items-center justify-center gap-3`,children:n})]}):P(E,{children:[(e||t)&&(d?P(`div`,{class:lg}):P(E,{children:[P(`div`,{class:`${lg} hidden @max-mobile:block`}),P(`div`,{class:ug})]})),d?P(`div`,{class:fg,children:[P(sg,{title:e,description:t,fullScreen:!0}),P(`div`,{class:`absolute inset-x-8 @max-mobile:inset-x-5 bottom-[20%] flex flex-col items-center gap-3`,children:n})]}):P(`div`,{class:`${fg} grid grid-cols-[1fr_auto] grid-rows-[1fr_auto] gap-x-6`,children:[P(`div`,{class:`col-start-1 row-start-2 self-center @max-mobile:col-span-2 @max-mobile:row-start-1 @max-mobile:self-start`,children:P(sg,{title:e,description:t})}),P(`div`,{class:`col-start-2 row-start-2 self-end justify-self-end flex flex-col items-end gap-3`,children:n})]})]}),i]})}var mg={video:`cam`,audio:`mic`,chat:`chat`},hg={"full-screen":`btn-lg px-16 @max-3xl:px-10 @max-md:btn-md @max-md:px-5`,inline:`px-8 @max-mobile:px-5`};function gg({children:e,loading:t=!1,...n}){let{config:r}=Bp(),i=eg(),a=mg[r.value.customization.conversation.modality],o=a!==void 0&&i===`full-screen`;return P(Kh,{class:`btn-preview-action rounded-box ${hg[i]}`,loading:t,...n,children:o?P(`span`,{class:`flex items-center justify-center gap-2`,children:[P(Mh,{name:a,"aria-hidden":!0}),e]}):e})}var _g=`Thanks for joining`,vg=`You can start a new conversation whenever you're ready.`,yg=`Start a new conversation`;function bg(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`||t.protocol===`mailto:`}catch{return!1}}function xg({text:e,onRestart:t,isStarting:n=!1,permissionRequest:r=null}){let{config:i}=Bp(),a=eg()===`full-screen`,o=i.value.customization.after_call,s=o.cta.filter(e=>bg(e.url)),c=o.title||e?.title||_g,l=o.description||e?.description||vg,u=e?.restart||yg;return P(pg,{title:c,description:l,children:[P(`div`,{class:`relative`,children:[r&&P(ng,{message:tg(r),class:`absolute bottom-full mb-3 z-20 ${a?`left-1/2 -translate-x-1/2`:`right-0`}`}),P(gg,{onClick:t,loading:n,children:u})]}),s.length>0&&P(`div`,{class:`flex flex-wrap items-center gap-2 ${a?`justify-center`:`justify-end`}`,children:s.map(e=>P(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`btn rounded-box border-white/50 bg-black/35 text-white backdrop-blur-xs hover:bg-black/50`,children:e.title},e.url))})]})}function Sg(){let e=Md(),t=Pd(),{isOff:n}=Bd(t),{camState:r}=Ud();return{isCamReady:j(()=>r===`granted`,[r]),isCamMuted:n,localSessionId:t,onToggleCamera:M(()=>{e?.setLocalVideo(n)},[e,n])}}function Cg(){let e=Md(),t=Pd(),{isOff:n}=Vd(t),{micState:r}=Ud();return{isMicReady:j(()=>r===`granted`,[r]),isMicMuted:n,localSessionId:t,onToggleMicrophone:M(()=>{e?.setLocalAudio(n)},[e,n])}}function wg(){let e=Md(),t=Pd(),{isOff:n}=Hd(t),r=!n;return{isScreenSharing:r,localSessionId:t,onToggleScreenshare:M(()=>{r?e?.stopScreenShare():e?.startScreenShare({displayMediaOptions:{audio:!1,selfBrowserSurface:`exclude`,surfaceSwitching:`include`,video:{width:1920,height:1080}}})},[e,r])}}var Tg={microphone:`microphone`,camera:`camera`};function Eg({class:e}){return P(`svg`,{class:e,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[P(`circle`,{cx:`7`,cy:`8`,r:`2.2`,stroke:`currentColor`,"stroke-width":`1.6`}),P(`circle`,{cx:`16`,cy:`16`,r:`2.2`,stroke:`currentColor`,"stroke-width":`1.6`}),P(`path`,{d:`M2 8h2.5M9.5 8H22M2 16h11.5M18.5 16H22`,stroke:`currentColor`,"stroke-width":`1.6`,"stroke-linecap":`round`})]})}function Dg(){return P(`svg`,{viewBox:`0 0 240 180`,class:`w-full h-auto text-base-content/70`,fill:`none`,"aria-hidden":`true`,children:[P(`rect`,{x:`10`,y:`20`,width:`220`,height:`150`,rx:`10`,stroke:`currentColor`,"stroke-width":`2`}),P(`path`,{d:`M10 46h220`,stroke:`currentColor`,"stroke-width":`2`}),P(`circle`,{cx:`26`,cy:`33`,r:`3.5`,stroke:`currentColor`,"stroke-width":`1.6`}),P(`circle`,{cx:`40`,cy:`33`,r:`3.5`,stroke:`currentColor`,"stroke-width":`1.6`}),P(`circle`,{cx:`54`,cy:`33`,r:`3.5`,stroke:`currentColor`,"stroke-width":`1.6`}),P(`path`,{d:`M78 33h14M86 27l-6 6 6 6M104 27v12`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),P(`rect`,{x:`118`,y:`25`,width:`96`,height:`16`,rx:`8`,stroke:`currentColor`,"stroke-width":`1.6`}),P(`circle`,{class:`text-info`,cx:`128`,cy:`33`,r:`11`,fill:`currentColor`,opacity:`0.18`}),P(`circle`,{class:`text-info`,cx:`128`,cy:`33`,r:`11`,stroke:`currentColor`,"stroke-width":`1.6`}),P(`g`,{class:`text-info`,transform:`translate(120 25) scale(0.66)`,children:P(Eg,{})}),P(`g`,{transform:`translate(34 78)`,children:[P(`rect`,{x:`0`,y:`8`,width:`34`,height:`26`,rx:`5`,stroke:`currentColor`,"stroke-width":`2`}),P(`path`,{d:`M34 16l14-8v26l-14-8`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linejoin":`round`})]}),P(`g`,{transform:`translate(40 120)`,children:[P(`rect`,{x:`6`,y:`0`,width:`14`,height:`24`,rx:`7`,stroke:`currentColor`,"stroke-width":`2`}),P(`path`,{d:`M0 20a13 13 0 0 0 26 0M13 33v8`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`})]}),P(`path`,{d:`M150 64l34 14-14 4-2 16-18-34Z`,fill:`currentColor`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linejoin":`round`})]})}var Og=U(({device:e,onClose:t})=>{let n=Tg[e];return k(()=>{let e=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]),P(`div`,{class:`absolute inset-0 z-50 flex items-center justify-center p-4 bg-black/50 motion-safe:animate-[tavusFadeUp_180ms_ease-out]`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tavus-blocked-title`,onClick:t,children:P(`div`,{class:`relative w-full max-w-md rounded-box bg-base-100 text-base-content shadow-xl overflow-hidden`,onClick:e=>e.stopPropagation(),children:[P(`button`,{type:`button`,class:`btn btn-sm btn-circle btn-ghost absolute top-2 right-2 z-10`,onClick:t,"aria-label":`Close`,children:P(Mh,{name:`close`,size:`1.1rem`})}),P(`div`,{class:`grid @3xl:grid-cols-[1fr_1.2fr] gap-4 p-5 @max-md:p-4`,children:[P(`div`,{class:`flex items-center justify-center @max-md:hidden`,children:P(Dg,{})}),P(`div`,{class:`flex flex-col gap-4`,children:[P(`h2`,{id:`tavus-blocked-title`,class:`text-lg font-semibold leading-snug pr-6`,children:[`Access to your `,n,` is blocked`]}),P(`ol`,{class:`flex flex-col gap-3 text-sm`,children:[P(`li`,{class:`flex items-start gap-2`,children:[P(`span`,{class:`font-semibold tabular-nums`,children:`1.`}),P(`span`,{class:`leading-snug`,children:[`Click the `,P(Eg,{class:`inline-block align-text-bottom h-4 w-4 mx-0.5`}),` `,`settings icon in your browser's address bar`]})]}),P(`li`,{class:`flex items-start gap-2`,children:[P(`span`,{class:`font-semibold tabular-nums`,children:`2.`}),P(`span`,{class:`leading-snug`,children:[`Allow `,n,` access, then reload the page`]})]})]}),P(`button`,{type:`button`,class:`btn btn-neutral btn-sm self-start`,onClick:t,children:`Got it`})]})]})]})})}),kg=we({open:()=>{},close:()=>{}});function Ag(){return N(kg)}function jg({children:e}){let[t,n]=O(null),r=M(e=>n(e),[]),i=M(()=>n(null),[]),a=j(()=>({open:r,close:i}),[r,i]);return P(kg.Provider,{value:a,children:[e,t&&P(Og,{device:t,onClose:i})]})}var Mg=U(()=>P(`span`,{"aria-hidden":`true`,class:`absolute -top-0.5 -right-0.5 z-20 flex h-4 w-4 items-center justify-center rounded-full bg-warning text-warning-content text-[0.6rem] font-bold leading-none ring-2 ring-base-100 pointer-events-none`,children:`!`})),Ng=`select-control-pill relative inline-flex items-center bg-neutral text-neutral-content`,Pg=`absolute inset-0 w-full h-full opacity-0 cursor-pointer appearance-none disabled:cursor-not-allowed`,Fg=`absolute right-1.5 top-1/2 -translate-y-1/2 pointer-events-none flex items-center`,Ig=`absolute left-0 top-0 h-full aspect-square flex items-center justify-center pointer-events-none`,Lg=`absolute left-0 top-0 z-10 btn btn-control btn-neutral`;function Rg(){return P(`svg`,{style:{width:`var(--chevron-size, 0.75rem)`,height:`var(--chevron-size, 0.75rem)`},viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:P(`path`,{d:`M4 6L8 10L12 6`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})})}function zg(){let e=Pd(),t=A(null),n=A(void 0);return Wd(e??``,M(e=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let n=Math.max(0,Math.min(1,e**.6));t.current?.style.setProperty(`--mic-level`,String(n))})},[])),P(`span`,{ref:t,"aria-hidden":`true`,class:`pointer-events-none absolute inset-x-0 bottom-0 z-0 bg-success/70`,style:{"--mic-level":`0`,height:`calc(var(--mic-level, 0) * 100%)`,transition:`height 100ms ease-out`}})}function Bg({value:e,devices:t,disabled:n,onChange:r,label:i}){return P(E,{children:[P(`select`,{class:Pg,value:e,onChange:e=>r(e.target.value),disabled:n,"aria-label":i,children:t.map(({device:e})=>P(`option`,{value:e.deviceId,children:e.label},e.deviceId))}),P(`span`,{class:Fg,children:P(Rg,{})})]})}function Vg(e){return P(`div`,{class:Ng,children:P(Bg,{...e})})}function Hg({iconName:e,...t}){return P(`div`,{class:Ng,children:[P(`span`,{class:Ig,"aria-hidden":`true`,children:P(Mh,{name:e})}),P(Bg,{...t})]})}var Ug=U(({level:e=!1})=>{let{onToggleMicrophone:t,isMicReady:n,isMicMuted:r}=Cg(),{microphones:i,currentMic:a,setMicrophone:o}=Ud();if(!a||(i?.length??0)<=1)return P(Kg,{level:e});let s=e&&n&&!r;return P(`div`,{class:`relative inline-flex items-center`,children:[P(Vg,{value:a?.device?.deviceId,devices:i||[],disabled:!n,onChange:e=>o(e),label:`Select microphone`}),P(`button`,{type:`button`,onClick:t,disabled:!n,class:`${Lg} overflow-hidden`,"aria-label":r?`Unmute microphone`:`Mute microphone`,"aria-pressed":r,children:[s&&P(zg,{}),P(`span`,{class:`relative z-10 inline-flex`,children:P(Mh,{name:r||!n?`mic-off`:`mic`})})]})]})});function Wg(){let{onToggleCamera:e,isCamMuted:t}=Sg(),{camera:n,requestCamera:r}=em(),{open:i}=Ag(),a=n.isGranted&&!t;return{isOn:a,onClick:()=>{if(n.isBlocked)return i(`camera`);if(a)return e();r()},label:a?`Turn camera off`:n.isGranted?`Turn camera on`:`Enable camera`,needsAttention:n.needsAttention}}var Gg=U(()=>{let{isCamReady:e}=Sg(),{currentCam:t,cameras:n,setCamera:r}=Ud(),i=Wg();return!t||(n?.length??0)<=1?P(qg,{}):P(`div`,{class:`relative inline-flex items-center`,children:[P(Vg,{value:t?.device?.deviceId,devices:n||[],disabled:!e,onChange:e=>r(e),label:`Select camera`}),P(`button`,{type:`button`,onClick:i.onClick,class:Lg,"aria-label":i.label,"aria-pressed":!i.isOn,children:P(Mh,{name:i.isOn?`cam`:`cam-off`})})]})}),Kg=U(({level:e=!1})=>{let{onToggleMicrophone:t,isMicMuted:n}=Cg(),{mic:r,requestMic:i}=em(),{open:a}=Ag(),o=()=>{if(r.isGranted)return t();if(r.isBlocked)return a(`microphone`);i()},s=r.isGranted?n?`Unmute microphone`:`Mute microphone`:`Allow microphone access`,c=e&&r.isGranted&&!n;return P(`span`,{class:`relative inline-flex`,children:[P(`button`,{type:`button`,onClick:o,class:`btn btn-control btn-neutral relative overflow-hidden`,"aria-label":s,"aria-pressed":r.isGranted?n:void 0,children:[c&&P(zg,{}),P(`span`,{class:`relative z-10 inline-flex`,children:P(Mh,{name:n||!r.isGranted?`mic-off`:`mic`})})]}),r.needsAttention&&P(Mg,{})]})}),qg=U(()=>{let{isOn:e,onClick:t,label:n,needsAttention:r}=Wg();return P(`span`,{class:`relative inline-flex`,children:[P(`button`,{type:`button`,onClick:t,class:`btn btn-control btn-neutral`,"aria-label":n,"aria-pressed":!e,children:P(Mh,{name:e?`cam`:`cam-off`})}),r&&P(Mg,{})]})});U(({compact:e=!1}={})=>{let{isMicReady:t}=Cg(),{microphones:n,currentMic:r,setMicrophone:i}=Ud();return(n?.length??0)<=1?null:P(Hg,{iconName:`mic`,value:r?.device?.deviceId,devices:n,disabled:!t,onChange:e=>i(e),label:`Select microphone`,compact:e})}),U(({compact:e=!1}={})=>{let{isCamReady:t}=Sg(),{currentCam:n,cameras:r,setCamera:i}=Ud();return(r?.length??0)<=1?null:P(Hg,{iconName:`cam`,value:n?.device?.deviceId,devices:r,disabled:!t,onChange:e=>i(e),label:`Select camera`,compact:e})});var Jg=U((e={})=>{let{onToggleScreenshare:t,isScreenSharing:n}=wg();return P(`button`,{type:`button`,onClick:t,class:`btn btn-control ${n?`btn-primary`:`btn-neutral`}`,"aria-label":n?`Stop screen share`:`Start screen share`,"aria-pressed":n,children:P(Mh,{name:`screen-share`})})});function Yg(e){let t=N(gp);if(!t)throw Error(`useConversation must be used within ConversationProvider`);return k(()=>{if(e)return t.__registerSubscriber(e),()=>t.__unregisterSubscriber(e)},[e]),t}var Xg=we(null);function Zg({children:e,defaultEnabled:t=!1}){let[n,r]=O(t),i=M(()=>r(e=>!e),[]),a=j(()=>({isEnabled:n,toggle:i}),[n,i]);return P(Xg.Provider,{value:a,children:e})}function Qg(){let e=N(Xg);if(!e)throw Error(`ClosedCaptions components must be used within <ClosedCaptionsProvider>`);return e}var $g=U(()=>{let{isEnabled:e,toggle:t}=Qg();return P(`button`,{type:`button`,onClick:t,"aria-pressed":e,class:`btn btn-control ${e?`btn-primary`:`btn-neutral`}`,"aria-label":e?`Hide captions`:`Show captions`,children:P(Mh,{name:`captions`,"aria-label":e?`Closed Captions On`:`Closed Captions Off`})})}),e_=U(()=>{let{isEnabled:e}=Qg(),{captionText:t,captionRole:n}=Yg(),r=t.value,i=n.value;return!e||!r?null:P(`div`,{class:`pointer-events-none absolute bottom-24 left-1/2 -translate-x-1/2 max-w-[80%] px-4 py-2 rounded-box bg-black/60 text-white z-40`,role:`status`,"aria-live":`polite`,children:P(`div`,{class:`text-sm leading-5 max-h-15 overflow-hidden flex flex-col justify-end text-center`,children:P(`div`,{children:[P(`span`,{class:`text-xs ${i===`replica`?`text-secondary`:`text-primary`} mr-2`,children:i===`replica`?`PAL`:`You`}),r]})})})}),t_=we(null);function n_({children:e,defaultOpen:t=!1}){let[n,r]=O(t),i=M(()=>r(e=>!e),[]),a=M(()=>r(!1),[]),o=j(()=>({isOpen:n,toggle:i,close:a}),[n,i,a]);return P(t_.Provider,{value:o,children:e})}function r_(){let e=N(t_);if(!e)throw Error(`Chat components must be used within <ChatProvider>`);return e}var i_=U((e={})=>{let{isOpen:t,toggle:n}=r_();return P(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":t?`Close chat`:`Open chat`,class:`btn btn-control ${t?`btn-primary`:`btn-neutral`}`,children:P(Mh,{name:`chat`})})}),a_=U(({message:e})=>{let t=e.sender===`user`;return P(`li`,{class:`flex flex-col gap-1 ${t?`items-end`:`items-start`}`,children:[P(`span`,{class:`text-xs ${t?`text-primary`:`text-secondary`}`,children:t?`You`:`PAL`}),P(`span`,{class:`px-3 py-2 rounded-field text-sm max-w-[80%] ${t?`bg-primary text-primary-content`:`bg-base-200 text-base-content`}`,children:e.text})]})}),o_=U(({docked:e=!1,headerAction:t}={})=>{let{isOpen:n,close:r}=r_(),{chatMessages:i,sendChat:a,session:o}=Yg(),s=o.value?.conversationId??null,c=i.value,[l,u]=O(``),d=A(null);k(()=>{let e=d.current;e&&(e.scrollTop=e.scrollHeight)},[c.length]);let f=M(()=>{let e=l.trim();e&&s&&(a(e),u(``))},[l,a,s]),p=M(e=>{e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),f())},[f]),m=!!l.trim()&&!!s;return P(`aside`,{class:e?`absolute inset-0 w-full h-full bg-base-100 flex flex-col z-30`:`absolute top-0 right-0 w-80 h-full bg-base-100 border-l border-base-300 flex flex-col z-30 transition-transform ${n?`translate-x-0`:`translate-x-full`} @max-mobile:w-full`,"aria-hidden":!e&&!n,inert:!e&&!n,children:[P(`header`,{class:`flex items-center justify-between px-4 py-3 border-b border-base-300`,children:[P(`span`,{class:`font-medium text-base-content`,children:`Chat`}),e?t:P(`button`,{type:`button`,class:`btn btn-ghost btn-sm btn-circle`,onClick:r,"aria-label":`Close chat`,children:P(Mh,{name:`close`,size:20})})]}),P(`ul`,{ref:d,class:`flex-1 overflow-y-auto p-4 flex flex-col gap-3`,role:`log`,"aria-live":`polite`,children:c.length===0?P(`li`,{class:`text-center text-sm opacity-70`,children:s?`Send a message to start the conversation.`:`Connecting…`}):c.map(e=>P(a_,{message:e},e.id))}),P(`form`,{class:`flex items-end gap-2 p-3 border-t border-base-300`,onSubmit:e=>{e.preventDefault(),f()},children:[P(`textarea`,{class:`textarea textarea-bordered textarea-sm flex-1 resize-none`,value:l,onChange:e=>u(e.target.value),onKeyDown:p,placeholder:s?`Type a message…`:`Connecting…`,disabled:!s,rows:1,"aria-label":`Message`}),P(`button`,{type:`submit`,class:`btn btn-primary btn-sm btn-circle`,disabled:!m,"aria-label":`Send message`,children:P(Mh,{name:`send`,size:18})})]})]})});function s_({label:e}){return P(pg,{align:`center`,role:`status`,"aria-live":`polite`,class:`z-2`,children:P(`div`,{class:`flex items-center gap-2`,children:[P(`span`,{class:`loading loading-spinner loading-sm`}),P(`span`,{class:`text-base font-medium`,children:e})]})})}var c_=U(()=>P(s_,{label:`Connecting…`})),l_=U(()=>P(s_,{label:`Leaving…`}));function u_({active:e,onToggle:t,tooltip:n,nudge:r=!1}){return P(`div`,{class:`flex items-center gap-2`,children:[r&&P(`span`,{class:`rounded-field bg-base-100 px-2 py-1 text-xs font-medium whitespace-nowrap text-base-content shadow-md motion-safe:animate-[tavusFadeUp_180ms_ease-out]`,children:`Expand for a better view`}),P(`button`,{type:`button`,onClick:t,class:`btn btn-xs btn-control ${r?`btn-primary`:e?`btn-info`:`btn-neutral`}`,"aria-label":n??(e?`Exit fullscreen`:`Enter fullscreen`),title:n,children:P(Mh,{name:e?`fullscreen-exit`:`fullscreen`,size:`calc(var(--size-field, 0.25rem) * 3.5)`})})]})}var d_=U(({id:e})=>{let t=Fd()===e,n=A(null),r=A(null),i=A(null),a=A(void 0);Wd(e,M(e=>{a.current&&cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{let t=Number(Math.max(.01,e).toFixed(2));n.current&&r.current&&i.current&&(n.current.style.height=`${20+t*40}%`,r.current.style.height=`${20+t*130}%`,i.current.style.height=`${20+t*40}%`)})},[]));let o=`w-[3px] rounded-full bg-base-100 transition-[opacity] ${t?`opacity-100`:`opacity-50`}`;return P(`div`,{class:`flex items-center justify-center w-6 h-6`,children:P(`div`,{class:`flex items-center justify-center gap-[2px] w-full h-full`,children:[P(`div`,{ref:n,class:o,style:{height:`20%`}}),P(`div`,{ref:r,class:o,style:{height:`20%`}}),P(`div`,{ref:i,class:o,style:{height:`20%`}})]})})}),f_=[0,1,2],p_=.05,m_=450;function h_({sessionId:e,className:t=``}){let{config:n}=Bp(),r=Lh(n.value),i=Ih(n.value),a=A(null),o=A(void 0),s=A(void 0),[c,l]=O(!1),u=A(!1);return Wd(e??``,M(t=>{e&&(o.current&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let e=Math.max(0,Math.min(1,t**.6));a.current?.style.setProperty(`--audio-level`,String(e)),e>p_?(s.current&&=(clearTimeout(s.current),void 0),u.current||(u.current=!0,l(!0))):u.current&&s.current===void 0&&(s.current=setTimeout(()=>{s.current=void 0,u.current=!1,l(!1)},m_))}))},[e])),k(()=>()=>{o.current&&cancelAnimationFrame(o.current),s.current&&clearTimeout(s.current)},[]),P(`div`,{ref:a,class:`relative aspect-square w-full max-w-[min(48cqi,16rem)] mx-auto pointer-events-none ${t}`,style:{"--audio-level":`0`},"aria-hidden":`true`,children:[f_.map(e=>P(`div`,{class:`absolute inset-[16%] rounded-full will-change-transform`,style:{border:`2px solid var(--color-primary)`,opacity:0,animation:c?`tavusAudioWave 2.4s ease-out ${e*.8}s infinite`:`none`,"--wave-peak":`calc(0.18 + var(--audio-level, 0) * 0.5)`}},e)),P(`div`,{class:`absolute inset-[16%] rounded-full`,style:{background:`radial-gradient(circle, color-mix(in oklab, var(--color-primary) 60%, transparent), transparent 70%)`,filter:`blur(20px)`,scale:`calc(1 + var(--audio-level, 0) * 0.25)`,opacity:`calc(0.35 + var(--audio-level, 0) * 0.5)`,transition:`scale 120ms ease-out, opacity 120ms ease-out`}}),P(`div`,{class:`absolute inset-[20%] rounded-full overflow-hidden bg-base-300 ring-2 ring-base-100/20 shadow-xl will-change-transform`,style:{scale:`calc(1 + var(--audio-level, 0) * 0.06)`,transition:`scale 100ms ease-out`},children:P(Hh,{variant:r.background,replica:i})})]})}function g_({children:e,class:t,className:n,...r}){return P(`div`,{class:`tavus-mesh-bg ${t??n??``}`,...r,children:[P(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-1`}),P(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-2`}),P(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-3`}),P(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-4`}),P(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-5`}),P(`div`,{class:`absolute inset-0 bg-linear-to-t from-black/30 via-black/10 to-transparent pointer-events-none backdrop-blur-xs`}),e]})}var __=e=>!!e.user_id?.includes(`tavus-replica`);function v_(){return Rd({filter:__})}function y_(e){let t=v_()[0],n=Bd(t??``),r=Nd(),[i,a]=O(!1);return k(()=>{t&&(n.state===`playable`||e)&&a(!0)},[t,n.state,e]),r===`left-meeting`||r===`error`?{phase:`left`}:!i||!t?{phase:`connecting`}:{phase:`ready`,replicaId:t,videoState:n}}var b_=U(({isAudioOnly:e})=>{let t=y_(e);return t.phase===`left`?P(l_,{}):t.phase===`connecting`?P(c_,{}):e?P(g_,{class:`flex items-center justify-center`,children:[P(h_,{sessionId:t.replicaId}),P(Sf,{sessionId:t.replicaId})]}):P(`div`,{class:`relative w-full h-full`,children:[P(xf,{automirror:!0,sessionId:t.replicaId,type:`video`,fit:`cover`,className:`absolute inset-0 w-full h-full object-cover ${t.videoState.isOff?`hidden`:``}`}),P(Sf,{sessionId:t.replicaId})]})}),x_=U(({onLeave:e})=>{let{config:t}=Bp(),n=t.value.customization.conversation.modality===`audio`;return P(`div`,{class:`@container/pip w-full h-full`,children:P(`div`,{class:`relative w-full h-full overflow-hidden bg-linear-to-br from-base-300 to-base-200 text-base-content`,children:[P(`div`,{class:`relative w-full h-full z-5`,children:P(b_,{isAudioOnly:n})}),P(`div`,{class:`absolute bottom-4 w-full inset-x-0 z-20 flex justify-center items-center gap-2 @max-mobile:gap-1`,children:[P(Kg,{}),!n&&P(qg,{}),P(`button`,{type:`button`,class:`btn btn-control btn-error`,onClick:e,"aria-label":`Leave call`,children:P(Mh,{name:`leave`,"aria-label":`Leave Call`})})]})]})})});function S_(e,t){return e<=0||t<=0?!1:e/t<.75}var C_=U(({personaSessionId:e,localSessionId:t,isScreenSharing:n,avatarOff:r,videoRef:i})=>{let a=A(null),o=i??a,[s,c]=O(0),[l,u]=O(0),d=M(({aspectRatio:e})=>c(e),[]);k(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let{width:t,height:n}=e[e.length-1].contentRect;u(n>0?t/n:0)});return t.observe(e),()=>t.disconnect()},[o]);let f=n?t??``:e,p=!n&&r,m=!n&&S_(s,l),h=n||m;return P(E,{children:[m&&P(xf,{sessionId:e,type:`video`,fit:`cover`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 w-full h-full object-cover scale-110 blur-xl brightness-[0.55] ${p?`hidden`:``}`}),P(xf,{ref:o,automirror:!0,sessionId:f,type:n?`screenVideo`:`video`,fit:h?`contain`:`cover`,onResize:n?void 0:d,className:`absolute inset-0 w-full h-full transition-all ${h?`object-contain`:`object-cover`} ${p?`hidden`:``}`})]})}),w_=new Set([`mcp-ui.tavus.io`,`mcp-ui.tavus-preview.io`]),T_=[`.sandbox-tavus.io`],E_=new Set([`tavusapi.com`]);function D_(e){let t;try{t=new URL(e)}catch{return!1}return j_(t)?!0:t.protocol===`https:`?w_.has(t.hostname)?!0:T_.some(e=>t.hostname.endsWith(e)):!1}function O_(e){return D_(e)}function k_(e){try{return j_(new URL(e))}catch{return!1}}function A_(e){let t;try{t=new URL(e)}catch{return!1}return M_(t)?!0:t.protocol===`https:`&&E_.has(t.hostname)}function j_(e){return M_(e)}function M_(e){return!N_()||e.protocol!==`http:`&&e.protocol!==`https:`?!1:[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e.hostname)}function N_(){try{let e=globalThis.location?.hostname;return typeof e==`string`&&[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e)}catch{return!1}}function P_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var F_=new Set([`canvas.question`,`canvas.input`,`canvas.calendar`,`canvas.scheduling_embed`]);[...new Set([`direct_user`,`autonomous`,`system`])];var I_=new Set([`clear`,`replacement`]);function L_(e,t,n){return t===`submit`&&n===`direct_user`&&F_.has(e)}function R_(e,t,n,r){if(r!==void 0&&(!r||n===void 0||!L_(e,t,n)))throw Error(`Canvas response text is allowed only for a supported direct-user submit.`)}function z_(e,t){if(t===`system`||I_.has(e))throw Error(`Canvas producer interactions cannot mint host-only system actions.`)}async function B_(e){try{await e.teardownResource({},{timeout:1e3})}catch{}try{await e.close?.()}catch{}}var V_=`tavus.canvas.interaction`,H_=[`safe-area-right`,`safe-area-left`,`safe-area-bottom`,`full`],U_=`safe-area-right`,W_={x:275/1280,y:111/720,width:730/1280,height:609/720},G_={type:`snapshot_mirror`};function K_(e){return gv(e)?e.message_type===`conversation`&&e.event_type===`conversation.tool_call`&&typeof e.conversation_id==`string`&&gv(e.properties):!1}function q_(e){if(!gv(e))return null;let t=Av(e,`component`),n=Av(e,`component_version`),r=Av(e,`sandbox_url`),i=Nv(e,`mcp_server_url`,O_),a=Nv(e,`api_base_url`,A_),o=Nv(e,`interaction_url`,A_),s=bv(e.layout),c=Fv(e),l=e.version;return l!==1||!t||!n||!r||!D_(r)||!Y_(r,t,n)||i===null||a===null||o===null||s===null||c===null?null:{version:l,component:t,component_version:n,resource_uri:Av(e,`resource_uri`),sandbox_url:r,mcp_server_url:i,mcp_tool_name:Av(e,`mcp_tool_name`),api_base_url:a,interaction_url:o,...c,layout:s,host_context:gv(e.host_context)?e.host_context:void 0}}var J_=/^\/canvas\/([^/]+)\/([^/]+)(?:\/|$)/;function Y_(e,t,n){let r;try{r=new URL(e)}catch{return!1}let i=J_.exec(r.pathname);return i?t===`canvas.${i[1]}`&&n===i[2]:k_(e)}function X_(e){if(e===void 0)return{ok:!0,value:{}};if(gv(e))return{ok:!0,value:e};if(typeof e!=`string`)return{ok:!1,error:Error(`Magic Canvas tool arguments must be an object or JSON string.`)};try{let t=JSON.parse(e);return gv(t)?{ok:!0,value:t}:{ok:!1,error:Error(`Magic Canvas tool arguments must decode to an object.`)}}catch(e){return{ok:!1,error:_v(e)}}}function Z_(e){let t=e.properties.name;if(t!==`canvas_clear`&&t!==`update_component`)return null;let n=X_(e.properties.arguments);if(!n.ok)throw n.error;if(t===`canvas_clear`){let t=n.value.tool_call_id,r=n.value.reason;if(t!==void 0&&typeof t!=`string`)throw Error(`Magic Canvas clear tool_call_id must be a string when provided.`);if(r!==void 0&&typeof r!=`string`)throw Error(`Magic Canvas clear reason must be a string when provided.`);return{kind:`clear`,conversation_id:e.conversation_id,tool_call_id:t,reason:r}}let r=n.value.tool_call_id,i=n.value.updates;if(typeof r!=`string`||r.length===0)throw Error(`Magic Canvas update_component requires a target tool_call_id.`);if(!gv(i))throw Error(`Magic Canvas update_component requires an object updates payload.`);return{kind:`update`,conversation_id:e.conversation_id,tool_call_id:r,updates:i}}var Q_=[`safe-area-left`,`safe-area-right`];function $_(e){let t=Q_.includes(e.preferred_slot)?e.preferred_slot:U_;return t===e.preferred_slot&&e.display_mode===`inline`?e:{...e,preferred_slot:t,display_mode:`inline`}}function ev(e){return e.display_mode===`fullscreen`?`full`:e.preferred_slot}function tv(e,t){return[t]}function nv(e,t){switch(t.kind){case`show`:{let n=e.find(e=>e.id===t.instance.id),r=n?{...t.instance,revision:n.revision+1}:t.instance;return tv(e.filter(e=>e.id!==t.instance.id),r)}case`update`:{let n=e=>e.conversation_id===t.conversation_id&&e.tool_call_id===t.tool_call_id,r=fv(t.updates),i,a=e.map(e=>{if(!n(e))return e;let t={...e,arguments:{...e.arguments,...r.componentArguments},layout:$_({preferred_slot:r.preferredSlot??e.layout.preferred_slot,display_mode:r.displayMode??e.layout.display_mode,avoid_safe_area:r.avoidSafeArea??e.layout.avoid_safe_area,safe_area:r.safeArea??e.layout.safe_area,backdrop:r.backdrop??e.layout.backdrop}),revision:e.revision+1};return i=t,t});if(i===void 0)return a;let o=e.find(n);return o&&ev(o.layout)===ev(i.layout)?a:tv(a.filter(e=>!n(e)),i)}case`clear`:return t.tool_call_id?e.filter(e=>e.conversation_id!==t.conversation_id||e.tool_call_id!==t.tool_call_id):e.filter(e=>e.conversation_id!==t.conversation_id)}}function rv(e){if(!gv(e)||!Array.isArray(e.content))return null;for(let t of e.content){if(!gv(t))continue;let e=(gv(t._meta)?t._meta:null)?.[V_];if(gv(e))return Pv(e)}return null}function iv(e,t){let n=t.type,r=t.value;if(!n)throw Error(`Magic Canvas interaction is missing type.`);if(r===void 0)throw Error(`Magic Canvas interaction is missing value.`);if(e.canvas_config.protocol_mode===`v1`&&!t.interaction_id)throw Error(`Magic Canvas v1 interaction requires a producer-supplied interaction_id.`);if(e.canvas_config.protocol_mode===`v1`&&(t.protocol_version!==1||!t.initiation_source||!t.initiated_at||!Number.isSafeInteger(t.producer_revision)||(t.producer_revision??-1)<0||!t.payload_digest))throw Error(`Magic Canvas v1 interaction causal envelope is incomplete.`);if(e.canvas_config.protocol_mode===`v1`&&t.producer_revision!==e.revision)throw Error(`Magic Canvas v1 interaction does not match the mounted card revision.`);return z_(n,t.initiation_source),R_(e.canvas_config.component,n,t.initiation_source,t.response_text),{interaction_id:t.interaction_id??hv(e.tool_call_id,n),conversation_id:e.conversation_id,tool_call_id:e.tool_call_id,component:e.canvas_config.component,component_version:e.canvas_config.component_version,type:n,value:r,metadata:gv(t.metadata)?t.metadata:{},protocol_mode:e.canvas_config.protocol_mode,protocol_version:t.protocol_version,initiation_source:t.initiation_source,initiated_at:t.initiated_at,producer_revision:t.producer_revision,payload_digest:t.payload_digest,response_text:t.response_text,issued_card_capability:e.canvas_config.issued_card_capability}}function av(e){return e.type===`dismiss`||e.type===`clear`?!0:e.type!==`submit`&&e.type!==`skip`?!1:e.component===`canvas.question`||e.component===`canvas.input`||e.component===`canvas.calendar`}function ov(e,t){if(!gv(e)||!Array.isArray(e.content))return``;let n=e.content.map(e=>gv(e)&&e.type===`text`&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
55
55
  `).trim();if(!t){if(n)throw Error(`Magic Canvas response text requires a validated interaction.`);return``}if(t.protocol_mode===void 0&&t.response_text===void 0)return n?(R_(t.component,t.type,`direct_user`,n),n):``;if(t.response_text===void 0){if(n)throw Error(`Magic Canvas silent interaction included raw text.`);return``}if(n!==t.response_text)throw Error(`Magic Canvas raw text does not match the validated response text.`);return t.response_text}function sv(e,t){let n=gv(t.structuredContent)?t.structuredContent:void 0,r=vv(t.content),i=typeof n?.state==`string`?n.state:`updated`,a=typeof n?.summary==`string`?n.summary:r,o=[`Magic Canvas state update for ${e.canvas_config.component} (${e.tool_call_id}).`,`State: ${i}.`];return a&&o.push(`Summary: ${a}`),n&&o.push(`Structured state: ${yv(n)}`),r&&r!==a&&o.push(r),o.join(`
56
56
  `)}function cv({conversationId:e,toolCallId:t,args:n,canvasConfig:r}){let i=fv(n);return{id:t,conversation_id:e,tool_call_id:t,arguments:i.componentArguments,canvas_config:r,layout:$_({preferred_slot:i.preferredSlot??r.layout?.preferred_slot??pv(r.component),display_mode:i.displayMode??`inline`,avoid_safe_area:i.avoidSafeArea??r.layout?.avoid_safe_area??!0,safe_area:i.safeArea??r.layout?.safe_area??W_,backdrop:i.backdrop??r.layout?.backdrop??G_}),revision:0}}function lv(e,t){let n=e.layout.display_mode;return{...e.layout,display_mode:n,viable_slot:n===`fullscreen`?`full`:dv(e.layout.preferred_slot,t)}}function uv(e,t){let n=e.filter(e=>!e.avoid_safe_area||e.display_mode===`fullscreen`?!1:e.viable_slot===`safe-area-left`||e.viable_slot===`safe-area-right`),r=n.some(e=>e.viable_slot===`safe-area-left`),i=n.some(e=>e.viable_slot===`safe-area-right`);if(r&&i)return{active:!1,video_shift_x:0,backdrop:G_};let a=[...n].reverse()[0];if(!a||t.width<900)return{active:!1,video_shift_x:0,backdrop:G_};let o=Math.min(448,Math.max(0,t.width-32)),s=a.safe_area,c=s.x*t.width,l=(s.x+s.width)*t.width,u=Math.min(360,t.width*.3),d=0;return d=a.viable_slot===`safe-area-left`?Mv(16+o+24-c,0,u):-Mv(l-(t.width-16-o-24),0,u),{active:!0,side:a.viable_slot===`safe-area-left`?`left`:`right`,video_shift_x:Math.round(d),safe_area:s,backdrop:a.backdrop}}function dv(e,t){return e===`full`||e===`safe-area-bottom`&&t.visualViewportHeight!==void 0&&t.visualViewportHeight<t.height*.75?`full`:(e===`safe-area-left`||e===`safe-area-right`)&&t.width<768&&t.height>=t.width?`safe-area-bottom`:e}function fv(e){let t={};for(let[n,r]of Object.entries(e))n!==`layout`&&n!==`preferred_slot`&&n!==`preferredSlot`&&n!==`display_mode`&&n!==`displayMode`&&n!==`presentation`&&n!==`fullscreen`&&n!==`avoid_safe_area`&&n!==`avoidSafeArea`&&n!==`safe_area`&&n!==`safeArea`&&n!==`backdrop`&&(t[n]=r);return{componentArguments:t,preferredSlot:xv(e.layout)??xv(e.preferred_slot)??xv(e.preferredSlot),displayMode:Sv(e),avoidSafeArea:Cv(e),safeArea:wv(e),backdrop:Tv(e)}}function pv(e){switch(e){case`canvas.alert`:return`safe-area-bottom`;case`canvas.chart`:case`canvas.image`:case`canvas.video`:return`full`;default:return U_}}function mv(e,t){let n=t?.displayScale??1;if(e.display_mode===`fullscreen`||e.viable_slot===`full`)return{maxWidth:void 0,maxHeight:void 0,displayScale:n};let r=t?.maxHeight??720;return e.viable_slot===`safe-area-bottom`?{maxWidth:720,maxHeight:r,displayScale:n}:{width:384,maxHeight:r,displayScale:n}}function hv(e,t){return`ci_${e.replace(/[^a-zA-Z0-9_-]/g,`_`)}_${t}_${globalThis.crypto?.randomUUID?.()??Math.random().toString(36).slice(2,10)}`}var gv=P_;function _v(e){return e instanceof Error?e:Error(String(e))}function vv(e){return Array.isArray(e)?e.map(e=>gv(e)&&e.type===`text`&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
57
- `).trim():``}function yv(e){let t=JSON.stringify(e);return t?t.length<=2e3?t:`${t.slice(0,2e3)}...`:`{}`}function bv(e){if(e===void 0)return;if(!gv(e))return null;let t=xv(e),n=Ev(e.safe_area??e.safeArea),r=Dv(e.backdrop);return n===null||r===null?null:{...t?{preferred_slot:t}:{},...Ov(e.avoid_safe_area??e.avoidSafeArea,`avoid_safe_area`),...n?{safe_area:n}:{},...r?{backdrop:r}:{}}}function xv(e){if(typeof e==`string`&&kv(e))return e;if(!gv(e))return;let t=e.preferred_slot??e.preferredSlot??e.slot;return typeof t==`string`&&kv(t)?t:void 0}function Sv(e){if(e.presentation===!0||e.fullscreen===!0)return`fullscreen`;if(e.presentation===!1||e.fullscreen===!1)return`inline`;let t=e.display_mode??e.displayMode;return t===`fullscreen`||t===`inline`?t:void 0}function Cv(e){let t=gv(e.layout)?e.layout:void 0,n=e.avoid_safe_area??e.avoidSafeArea??t?.avoid_safe_area??t?.avoidSafeArea;return typeof n==`boolean`?n:void 0}function wv(e){let t=gv(e.layout)?e.layout:void 0;return Ev(e.safe_area??e.safeArea??t?.safe_area??t?.safeArea)??void 0}function Tv(e){let t=gv(e.layout)?e.layout:void 0;return Dv(e.backdrop??t?.backdrop)??void 0}function Ev(e){if(e===void 0)return;if(!gv(e))return null;let t=jv(e,`x`),n=jv(e,`y`),r=jv(e,`width`),i=jv(e,`height`);return t===void 0||n===void 0||r===void 0||i===void 0||t<0||n<0||r<=0||i<=0||t+r>1.001||n+i>1.001?null:{x:Mv(t,0,1),y:Mv(n,0,1),width:Mv(r,0,1),height:Mv(i,0,1)}}function Dv(e){if(e===void 0)return;if(e===`snapshot_mirror`||e===`none`)return{type:e};if(!gv(e))return null;let t=e.type;return t===`snapshot_mirror`||t===`none`?{type:t}:null}function Ov(e,t){return typeof e==`boolean`?{[t]:e}:{}}function kv(e){return H_.includes(e)}function Av(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function jv(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function Mv(e,t,n){return Math.min(Math.max(e,t),n)}function Nv(e,t,n){let r=Av(e,t);if(r)return n(r)?r:null}function Pv(e){return e.interaction_id!==void 0&&typeof e.interaction_id!=`string`||e.component!==void 0&&typeof e.component!=`string`||e.component_version!==void 0&&typeof e.component_version!=`string`||e.type!==void 0&&typeof e.type!=`string`||e.metadata!==void 0&&!gv(e.metadata)||e.protocol_version!==void 0&&typeof e.protocol_version!=`number`||e.initiation_source!==void 0&&e.initiation_source!==`direct_user`&&e.initiation_source!==`autonomous`&&e.initiation_source!==`system`&&e.initiation_source!==`unknown`||e.initiated_at!==void 0&&typeof e.initiated_at!=`string`||e.producer_revision!==void 0&&typeof e.producer_revision!=`number`||e.payload_digest!==void 0&&typeof e.payload_digest!=`string`||e.response_text!==void 0&&typeof e.response_text!=`string`?null:e}function Fv(e){let t=Object.hasOwn(e,`protocol_mode`),n=Object.hasOwn(e,`protocol_version`),r=Object.hasOwn(e,`issued_card_capability`);if(!t&&!n&&!r)return{};if(e.protocol_mode===`legacy`)return n&&e.protocol_version!==null||r?null:{protocol_mode:`legacy`,protocol_version:null};if(e.protocol_mode!==`v1`||e.protocol_version!==1)return null;let i=Av(e,`issued_card_capability`);return i?{protocol_mode:`v1`,protocol_version:1,issued_card_capability:i}:null}var Iv=`tavus-deployment magic-canvas/0.0.0`;function Lv(e){if(!K_(e)||e.canvas_config===void 0||e.canvas_config===null)return null;let t=q_(e.canvas_config),n=e.properties.tool_call_id;if(!t)return null;if(!n)throw Error(`Received Magic Canvas tool call without tool_call_id.`);let r=X_(e.properties.arguments);if(!r.ok)throw r.error;return cv({conversationId:e.conversation_id,toolCallId:n,args:r.value,canvasConfig:t})}function Rv(e){if(!K_(e))return null;if(e.canvas_config!==void 0&&e.canvas_config!==null){let t=Lv(e);return t?{kind:`show`,instance:t}:null}return Z_(e)}function zv(e){return{body:{interaction_id:e.interaction_id,tool_call_id:e.tool_call_id,component:e.component,component_version:e.component_version,type:e.type,value:e.value,metadata:e.metadata}}}function Bv(e,t){return{theme:e.theme,displayMode:t?.display_mode??`inline`,availableDisplayModes:[`inline`,`fullscreen`],...t?{containerDimensions:mv(t),layout:{preferred_slot:t.preferred_slot,viable_slot:t.viable_slot,avoid_safe_area:t.avoid_safe_area,safe_area:t.safe_area,backdrop:t.backdrop}}:{},platform:`web`,userAgent:Iv,styles:{variables:Vv(e.cssVars)}}}function Vv(e){return{"--border-radius-md":e[`--radius-box`]??e[`--tavus-boxes-radius`]??`0.5rem`,"--border-radius-sm":e[`--radius-field`]??e[`--tavus-field-radius`]??`0.375rem`,"--border-radius-xs":e[`--radius-selector`]??`0.25rem`,"--border-radius-lg":e[`--radius-box`]??e[`--tavus-boxes-radius`]??`0.75rem`,"--border-width-regular":e[`--border`]??e[`--tavus-border-width`]??`1px`,"--font-text-sm-size":`0.875rem`,"--font-text-md-size":`1rem`,...Hv(e)}}function Hv(e){let t=e[`--color-base-content`],n=e[`--color-base-100`],r=e[`--color-base-200`],i=e[`--color-base-300`],a=e[`--color-error`],o={},s=(e,t)=>{t&&(o[e]=t)},c=(e,t,n)=>e&&n?`color-mix(in oklch, ${e} ${t}%, ${n})`:void 0;return s(`--color-background-primary`,n),s(`--color-background-secondary`,r),s(`--color-border-secondary`,i),s(`--color-border-primary`,c(t,28,n)),s(`--color-text-primary`,t),s(`--color-text-secondary`,c(t,62,n)),s(`--color-text-danger`,a),s(`--color-border-danger`,a),o}var Uv=96;function Wv(e=document){let t=Array.from(e.querySelectorAll(`[data-canvas-card]`)).map(e=>e.getBoundingClientRect());return t.length===0?null:{left:Math.min(...t.map(e=>e.left)),right:Math.max(...t.map(e=>e.right)),top:Math.min(...t.map(e=>e.top)),bottom:Math.max(...t.map(e=>e.bottom))}}function Gv(e){let t=e?.getRootNode();return t instanceof ShadowRoot?t:document}function Kv(e){if(!e)return null;let t=e.getBoundingClientRect();return t.width<=0||t.height<=0?null:{left:t.left,right:t.right,top:t.top,bottom:t.bottom}}function qv(e,t,n,r){if(!t)return!1;let i=r?r.left:0,a=r?r.top:0,o=r?r.right-r.left:globalThis.innerWidth,s=r?r.bottom-r.top:globalThis.innerHeight,c=e?.safe_area??W_,l=i+c.x*o+n,u=i+(c.x+c.width)*o+n,d=a+c.y*s,f=a+(c.y+c.height)*s;return l<t.right&&u>t.left&&d<t.bottom&&f>t.top}function Jv(e,t,n){let[r,i]=O(()=>e?Wv(Gv(n?.current)):null);return $e(()=>{if(!e){i(null);return}let t=Gv(n?.current),r=()=>i(Wv(t)),a=new ResizeObserver(r),o=()=>{for(let e of t.querySelectorAll(`[data-canvas-card]`))a.observe(e)};r(),o(),a.observe(document.documentElement);let s=globalThis.requestAnimationFrame(()=>{r(),o()});return globalThis.addEventListener(`resize`,r),()=>{a.disconnect(),globalThis.removeEventListener(`resize`,r),globalThis.cancelAnimationFrame(s)}},[e,t,n]),e?r:null}function Yv(e,t,n){let[r,i]=O(()=>t?Kv(e.current):null);return $e(()=>{if(!t){i(null);return}let n=()=>i(Kv(e.current)),r=new ResizeObserver(n);n(),e.current&&r.observe(e.current),r.observe(document.documentElement);let a=globalThis.requestAnimationFrame(n);return globalThis.addEventListener(`resize`,n),()=>{r.disconnect(),globalThis.removeEventListener(`resize`,n),globalThis.cancelAnimationFrame(a)}},[t,n,e]),t?r:null}function Xv(e,t,n,r,i,a){let o=e?.side??(n===`safe-area-left`?`left`:n===`safe-area-right`?`right`:null);return{usePip:o!=null&&(t===`pip`||t===`auto`&&qv(e,r,i,a)),side:o}}function Zv(e,t=document,n){let r=n?n.left:0,i=n?n.right:globalThis.innerWidth,a=n?n.top:0,o=n?n.bottom:globalThis.innerHeight,s=i-r,c=o-a,l=Array.from(t.querySelectorAll(`[data-canvas-card]`)).map(e=>e.getBoundingClientRect()),u,d,f,p;if(l.length>0){let t=Math.min(...l.map(e=>e.left)),n=Math.max(...l.map(e=>e.right));f=Math.min(...l.map(e=>e.top)),p=Math.max(...l.map(e=>e.bottom)),[u,d]=e===`right`?[r,t]:[n,i]}else{let t=Math.min(448,Math.max(0,s-32));[u,d]=e===`right`?[r,i-16-t]:[r+16+t,i],f=a,p=o}let m=d-u>=144&&p-f>=Uv&&u>=r&&d<=i;if(l.length>0&&!m){let t=Math.min(448,Math.max(0,s-32));[u,d]=e===`right`?[r,i-16-t]:[r+16+t,i],f=a,p=o}let h=Math.max(0,d-u-48),g=Math.max(Uv,Math.min(h,c-48));return{centerX:(u+d)/2-r,centerY:(f+p)/2-a,diameter:g}}var Qv=`560ms linear(0, 0, .0001, .0002, .0003, .0005, .0007, .001, .0013, .0016, .002, .0024, .0029, .0033, .0039, .0044, .005, .0057, .0063, .007, .0079, .0086, .0094, .0103, .0112, .0121, .0132 1.84%, .0153, .0175, .0201, .0226, .0253, .0283, .0313, .0345, .038, .0416, .0454, .0493, .0535, .0576, .0621, .0667, .0714, .0764, .0816 5.04%, .0897, .098 5.62%, .1071, .1165, .1263 6.56%, .137, .1481 7.25%, .1601 7.62%, .1706 7.94%, .1819 8.28%, .194, .2068 9.02%, .2331 9.79%, .2898 11.44%, .3151 12.18%, .3412 12.95%, .3533, .365 13.66%, .3786, .3918, .4045, .4167, .4288, .4405, .452, .4631 16.72%, .4759, .4884, .5005, .5124, .5242, .5354, .5467, .5576, .5686, .5791, .5894, .5995, .6094, .6194, .6289, .6385, .6477, .6569, .6659 24.45%, .6702, .6747, .6789, .6833, .6877, .6919, .696, .7002, .7043, .7084, .7125, .7165, .7205, .7244, .7283, .7321, .7358, .7396, .7433, .7471, .7507, .7544, .7579, .7615, .7649, .7685, .7718, .7752, .7786, .782, .7853, .7885, .7918, .7951, .7982, .8013, .8043, .8075, .8104, .8135, .8165, .8195, .8224, .8253, .8281, .8309, .8336, .8365, .8391, .8419, .8446, .8472, .8499, .8524, .855, .8575, .8599, .8625 37.27%, .8651, .8678, .8703, .8729, .8754, .8779, .8803, .8827, .8851, .8875, .8898, .892, .8942, .8965, .8987, .9009, .903, .9051, .9071, .9092, .9112, .9132, .9151, .9171, .919, .9209, .9227, .9245, .9262, .928, .9297, .9314, .9331, .9347, .9364, .9379, .9395, .941, .9425, .944, .9454, .9469, .9483, .9497, .951, .9524, .9537, .955, .9562, .9574, .9586, .9599, .961, .9622, .9633, .9644, .9655, .9665, .9676, .9686, .9696, .9705, .9715, .9724, .9733, .9742, .975, .9758, .9766, .9774, .9782, .9789, .9796, .9804, .9811, .9817, .9824, .9831, .9837, .9843, .9849, .9855, .986, .9866, .9871, .9877, .9882, .9887, .9892, .9896 70.56%, .9905 71.67%, .9914 72.82%, .9922, .9929 75.2%, .9936 76.43%, .9942 77.71%, .9948 79.03%, .9954 80.39%, .9959 81.81%, .9963 83.28%, .9968 84.82%, .9972 86.41%, .9975 88.07%, .9979 89.81%, .9982 91.64%, .9984 93.56%, .9987 95.58%, .9989 97.72%, .9991)`;function $v(e,t){let n=Math.abs(t)/2;return e===`left`?`${n}px center`:`calc(100% - ${n}px) center`}function ey(e,t,n){let[r,i]=O(()=>e&&t?Zv(t,Gv(n?.current),Kv(n?.current)):null);return $e(()=>{if(!e||!t){i(null);return}let r=Gv(n?.current),a=()=>i(Zv(t,r,Kv(n?.current))),o=new ResizeObserver(a),s=()=>{for(let e of r.querySelectorAll(`[data-canvas-card]`))o.observe(e)};a(),s(),n?.current&&o.observe(n.current),o.observe(document.documentElement);let c=globalThis.requestAnimationFrame(()=>{a(),s()});return globalThis.addEventListener(`resize`,a),()=>{o.disconnect(),globalThis.removeEventListener(`resize`,a),globalThis.cancelAnimationFrame(c)}},[e,t,n]),e&&t?r:null}function ty(e,t){let[n,r]=O(null);return $e(()=>{if(!t){r(null);return}let n=e.current;if(!n)return;let i=()=>{let e=n.clientWidth,t=n.clientHeight;r(e&&t?{width:e,height:t}:null)},a=new ResizeObserver(i);return a.observe(n),i(),()=>a.disconnect()},[t,e]),t?n:null}var ny=1;function ry(e,t,n){return Math.min(Math.max(e,t),n)}function iy(e,t,n,r){let i=Math.min(e.diameter/t.height,1),a=r?.safe_area??W_,o=((a.x+a.width/2)*t.width+n)*i,s=(a.y+a.height/2)*t.height*i,c=e.diameter/2;return{scale:i,tx:ry(e.centerX-o,e.centerX+c-t.width*i,e.centerX-c),ty:ry(e.centerY-s,e.centerY+c-t.height*i,e.centerY-c)}}var ay=[`cx`,`cy`,`r`,`tx`,`ty`,`s`,`shift`];function oy(e,t,n,r,i){if(!n)return null;let{width:a,height:o}=n,s={x:a/2,y:o/2},c=null;if(e&&(c=iy(e,n,r,i),s={x:(e.centerX-c.tx)/c.scale,y:(e.centerY-c.ty)/c.scale}),t&&c&&e)return{cx:s.x,cy:s.y,r:e.diameter/2/c.scale,tx:c.tx,ty:c.ty,s:c.scale,shift:r};let l=Math.hypot(Math.max(s.x,a-s.x),Math.max(s.y,o-s.y));return{cx:s.x,cy:s.y,r:l*1.1,tx:0,ty:0,s:1,shift:r}}function sy(e,t,n){let r=A(null),i=A(e),a=A(n),o=A(0),s=A(0);i.current=e,a.current=n,k(()=>{let e=i.current;if(!e)return;if(!r.current||cy()){r.current={values:{...e},velocity:{cx:0,cy:0,r:0,tx:0,ty:0,s:0,shift:0}},a.current(e,!0);return}if(o.current)return;let n=Math.max(t,160)/4e3;s.current=performance.now();let c=e=>{o.current=0;let t=i.current,l=r.current;if(!t||!l)return;let u=Math.min((e-s.current)/1e3,1/30);s.current=e;let d=!0;for(let e of ay){let r=(t[e]-l.values[e])/(n*n)-2/n*l.velocity[e],i=l.velocity[e]+r*u,a=l.values[e]+i*u,o=e===`s`?.001:.25;Math.abs(t[e]-a)<o&&Math.abs(i)*n<o?(l.values[e]=t[e],l.velocity[e]=0):(l.values[e]=a,l.velocity[e]=i,d=!1)}a.current(l.values,d),d||(o.current=globalThis.requestAnimationFrame(c))};o.current=globalThis.requestAnimationFrame(c)},[e?ay.map(t=>Math.round(e[t]*100)).join():``,t]),k(()=>()=>{o.current&&globalThis.cancelAnimationFrame(o.current)},[])}function cy(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function ly({geom:e,visible:t}){return P(`div`,{"aria-hidden":`true`,"data-morph":`ring`,class:`pointer-events-none absolute z-10 rounded-full`,style:{top:`${e.centerY-e.diameter/2}px`,left:`${e.centerX-e.diameter/2}px`,width:`${e.diameter}px`,height:`${e.diameter}px`,boxShadow:`0 0 0 3px rgb(255 255 255 / 12%), 0 18px 50px rgb(0 0 0 / 55%)`,opacity:+!!t,transition:`opacity 240ms ease-out`}})}function uy(e,t){let n=t>=0?`left`:`right`,r=A({side:n,shift:t});k(()=>{e&&(r.current={side:n,shift:t})},[e,n,t]);let i=e?n:r.current.side;return{side:i,transformOrigin:$v(i,e?t:r.current.shift),translateX:e?0:-r.current.shift}}function dy(e,t,n){return`${e.side??``}:${e.active}:${t}:${n??``}`}function fy({snapshotUrl:e,transformOrigin:t}){return P(`div`,{class:`absolute inset-0 bg-cover bg-center`,style:{backgroundImage:`url("${e}")`,transform:`scaleX(-1)`,transformOrigin:t}})}function py({snapshotUrl:e,translateX:t,transition:n,transformOrigin:r}){return P(`div`,{"aria-hidden":`true`,"data-morph":`mirror`,class:`pointer-events-none absolute z-0 overflow-hidden`,style:{inset:`0 0`,transform:`translate3d(${t}px, 0, 0)`,transition:`transform ${n}`,willChange:`transform`},children:P(fy,{snapshotUrl:e,transformOrigin:r})})}function my({ambient:e,usePip:t,transition:n}){return e===`none`?null:P(`div`,{"aria-hidden":`true`,"data-morph":`ambient`,class:`pointer-events-none absolute inset-0 z-0`,style:{opacity:+!!t,transition:`opacity ${n}`,background:e===`darker`?`rgb(0 0 0 / 40%)`:`rgb(0 0 0 / 15%)`}})}function hy({morphCapable:e,snapshotUrl:t,mirrorSide:n,videoShiftX:r,transition:i,sceneRef:a,videoWrapRef:o,fill:s,videoRef:c}){return P(`div`,{ref:a,"data-morph":`scene`,class:`absolute inset-0`,style:e?{transformOrigin:`top left`}:void 0,children:P(`div`,{ref:o,class:`absolute inset-0`,style:e?void 0:{transform:`translate3d(${r}px, 0, 0)`,transition:`transform ${i}`},children:[s(c),e&&t!==null&&P(`div`,{"aria-hidden":`true`,"data-morph":`window-mirror`,class:`absolute top-0 bottom-0 w-full`,style:n===`right`?{left:`calc(100% - ${ny}px)`}:{right:`calc(100% - ${ny}px)`},children:P(fy,{snapshotUrl:t,transformOrigin:`center`})})]})})}function gy({canvasLayoutEffect:e,smartSidecarActive:t,isScreenSharing:n,fill:r,captureSnapshot:i,transition:a=Qv,transitionMs:o=560,personaMode:s=`shift`,renderedSlot:c=null,ambient:l=`default`,children:u}){let d=A(null),[f,p]=O(null),m=t&&e.backdrop.type===`snapshot_mirror`,h=t?e.video_shift_x:0,g=A(null),_=dy(e,h,c),{usePip:v,side:y}=Xv(e,s,c,Jv(s!==`shift`,_,g),h,Yv(g,s!==`shift`,_)),b=ey(s!==`shift`,y,g),x=uy(m,h);k(()=>{if(!m)return;let e=!1,t=0,n,r=0,a=()=>{if(e)return;let t=i(d.current);if(t){p(t);return}r+=1,r<8&&(n=globalThis.setTimeout(a,150))};return typeof globalThis.requestAnimationFrame==`function`?t=globalThis.requestAnimationFrame(a):n=globalThis.setTimeout(a,0),()=>{e=!0,t&&globalThis.cancelAnimationFrame?.(t),n&&globalThis.clearTimeout(n)}},[m,e.side,e.video_shift_x,i]),k(()=>{if(m||f===null)return;let e=globalThis.setTimeout(()=>{p(null)},o);return()=>globalThis.clearTimeout(e)},[m,f,o]);let S=v&&y!=null&&b!=null,C=s!==`shift`,w=ty(g,C),T=f!==null&&!C,E=C&&y!=null,ee=A(null),te=A(null),[ne,re]=O(!0),ie=A(!0),ae=M((e,t)=>{let n=ee.current;n&&(n.style.clipPath=`circle(${e.r}px at ${e.cx}px ${e.cy}px)`,n.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.s})`);let r=te.current;r&&(r.style.transform=`translate3d(${e.shift}px, 0, 0)`),ie.current!==t&&(ie.current=t,re(t))},[]);return sy(C?oy(b,S,w,h,e):null,o,ae),P(`div`,{ref:g,class:`relative w-full h-full overflow-hidden ${n?`flex items-center justify-center`:``}`,children:[T&&f!==null&&P(py,{snapshotUrl:f,translateX:x.translateX,transition:a,transformOrigin:x.transformOrigin}),E&&P(my,{ambient:l,usePip:v,transition:a}),P(`div`,{"data-morph":`fg`,class:`absolute inset-0 z-10`,children:P(hy,{morphCapable:C,snapshotUrl:f,mirrorSide:x.side,videoShiftX:h,transition:a,sceneRef:ee,videoWrapRef:te,fill:r,videoRef:d})}),C&&b&&P(ly,{geom:b,visible:S&&ne}),u]})}var _y=480,vy=U(({personaSessionId:e,isAudioOnly:t,avatarOff:n,canvasLayoutEffect:r,smartSidecarActive:i})=>{let a=t||n,o=i?r.video_shift_x:0;return P(`div`,{class:`absolute inset-0 overflow-hidden`,children:P(`div`,{class:`absolute top-0 bottom-0`,style:{left:o>0?`${_y}px`:`0px`,right:o<0?`${_y}px`:`0px`,transition:`left ${Qv}, right ${Qv}`},children:[P(xf,{automirror:!0,sessionId:e,type:`screenVideo`,fit:`contain`,className:`absolute inset-0 w-full h-full object-contain`}),P(`div`,{class:`absolute bottom-4 right-4 aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10`,children:a?P(`div`,{class:`flex w-full h-full items-center justify-center`,children:P(h_,{sessionId:e})}):P(xf,{automirror:!0,sessionId:e,type:`video`,fit:`cover`,className:`w-full h-full object-cover`})})]})})});function W(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}function yy(e){return e&&Object.assign(Cy,e),Cy}var by,xy,Sy,Cy,wy=t((()=>{xy=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Sy=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},(by=globalThis).__zod_globalConfig??(by.__zod_globalConfig={}),Cy=globalThis.__zod_globalConfig}));function Ty(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ey(e,t){return typeof t==`bigint`?t.toString():t}function Dy(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Oy(e){return e==null}function ky(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ay(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function jy(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==nb)return r===void 0&&(r=nb,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function My(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ny(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Py(e){return JSON.stringify(e)}function Fy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}function Iy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ly(e){if(Iy(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Iy(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Ry(e){return Ly(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function zy(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function By(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Vy(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function Hy(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return By(e,Ny(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return My(this,`shape`,e),e},checks:[]}))}function Uy(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return By(e,Ny(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return My(this,`shape`,r),r},checks:[]}))}function Wy(e,t){if(!Ly(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return By(e,Ny(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return My(this,`shape`,n),n}}))}function Gy(e,t){if(!Ly(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return By(e,Ny(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return My(this,`shape`,n),n}}))}function Ky(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return By(e,Ny(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return My(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function qy(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return By(t,Ny(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return My(this,`shape`,i),i},checks:[]}))}function Jy(e,t,n){return By(t,Ny(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return My(this,`shape`,i),i}}))}function Yy(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Xy(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Zy(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Qy(e){return typeof e==`string`?e:e?.message}function $y(e,t,n){let r=e.message?e.message:Qy(e.inst?._zod.def?.error?.(e))??Qy(t?.error?.(e))??Qy(n.customError?.(e))??Qy(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function eb(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function tb(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var nb,rb,ib,ab,ob,sb=t((()=>{wy(),nb=Symbol(`evaluating`),rb=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{},ib=Dy(()=>{if(Cy.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),ab=new Set([`string`,`number`,`symbol`]),ob={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}}));function cb(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function lb(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var ub,db,fb,pb=t((()=>{wy(),sb(),ub=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ey,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},db=W(`$ZodError`,ub),fb=W(`$ZodError`,ub,{Parent:Error})})),mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob=t((()=>{wy(),pb(),sb(),mb=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new xy;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>$y(e,a,yy())));throw rb(t,i?.callee),t}return o.value},hb=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>$y(e,a,yy())));throw rb(t,i?.callee),t}return o.value},gb=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new xy;return a.issues.length?{success:!1,error:new(e??db)(a.issues.map(e=>$y(e,i,yy())))}:{success:!0,data:a.value}},_b=gb(fb),vb=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>$y(e,i,yy())))}:{success:!0,data:a.value}},yb=vb(fb),bb=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return mb(e)(t,n,i)},xb=e=>(t,n,r)=>mb(e)(t,n,r),Sb=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return hb(e)(t,n,i)},Cb=e=>async(t,n,r)=>hb(e)(t,n,r),wb=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return gb(e)(t,n,i)},Tb=e=>(t,n,r)=>gb(e)(t,n,r),Eb=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return vb(e)(t,n,i)},Db=e=>async(t,n,r)=>vb(e)(t,n,r)}));function kb(){return new RegExp(Ub,`u`)}function Ab(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function jb(e){return RegExp(`^${Ab(e)}$`)}function Mb(e){let t=Ab({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Qb}T(?:${r})$`)}var Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx=t((()=>{Nb=/^[cC][0-9a-z]{6,}$/,Pb=/^[0-9a-z]+$/,Fb=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ib=/^[0-9a-vA-V]{20}$/,Lb=/^[A-Za-z0-9]{27}$/,Rb=/^[a-zA-Z0-9_-]{21}$/,zb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Bb=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Vb=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Hb=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ub=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Wb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Kb=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,qb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yb=/^[A-Za-z0-9_-]*$/,Xb=/^https?$/,Zb=/^\+[1-9]\d{6,14}$/,Qb=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,$b=RegExp(`^${Qb}$`),ex=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},tx=/^-?\d+$/,nx=/^-?\d+(?:\.\d+)?$/,rx=/^(?:true|false)$/i,ix=/^null$/i,ax=/^undefined$/i,ox=/^[^A-Z]*$/,sx=/^[^a-z]*$/})),lx,ux,dx,fx,px,mx,hx,gx,_x,vx,yx,bx,xx,Sx,Cx,wx,Tx,Ex=t((()=>{wy(),cx(),sb(),lx=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ux={number:`number`,bigint:`bigint`,object:`date`},dx=W(`$ZodCheckLessThan`,(e,t)=>{lx.init(e,t);let n=ux[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fx=W(`$ZodCheckGreaterThan`,(e,t)=>{lx.init(e,t);let n=ux[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),px=W(`$ZodCheckMultipleOf`,(e,t)=>{lx.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ay(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),mx=W(`$ZodCheckNumberFormat`,(e,t)=>{lx.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ob[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=tx)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),hx=W(`$ZodCheckMaxLength`,(e,t)=>{var n;lx.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oy(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=eb(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gx=W(`$ZodCheckMinLength`,(e,t)=>{var n;lx.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oy(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=eb(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),_x=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;lx.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oy(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=eb(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),vx=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;lx.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),yx=W(`$ZodCheckRegex`,(e,t)=>{vx.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),bx=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ox,vx.init(e,t)}),xx=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=sx,vx.init(e,t)}),Sx=W(`$ZodCheckIncludes`,(e,t)=>{lx.init(e,t);let n=zy(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Cx=W(`$ZodCheckStartsWith`,(e,t)=>{lx.init(e,t);let n=RegExp(`^${zy(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),wx=W(`$ZodCheckEndsWith`,(e,t)=>{lx.init(e,t);let n=RegExp(`.*${zy(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Tx=W(`$ZodCheckOverwrite`,(e,t)=>{lx.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),Dx,Ox=t((()=>{Dx=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
57
+ `).trim():``}function yv(e){let t=JSON.stringify(e);return t?t.length<=2e3?t:`${t.slice(0,2e3)}...`:`{}`}function bv(e){if(e===void 0)return;if(!gv(e))return null;let t=xv(e),n=Ev(e.safe_area??e.safeArea),r=Dv(e.backdrop);return n===null||r===null?null:{...t?{preferred_slot:t}:{},...Ov(e.avoid_safe_area??e.avoidSafeArea,`avoid_safe_area`),...n?{safe_area:n}:{},...r?{backdrop:r}:{}}}function xv(e){if(typeof e==`string`&&kv(e))return e;if(!gv(e))return;let t=e.preferred_slot??e.preferredSlot??e.slot;return typeof t==`string`&&kv(t)?t:void 0}function Sv(e){if(e.presentation===!0||e.fullscreen===!0)return`fullscreen`;if(e.presentation===!1||e.fullscreen===!1)return`inline`;let t=e.display_mode??e.displayMode;return t===`fullscreen`||t===`inline`?t:void 0}function Cv(e){let t=gv(e.layout)?e.layout:void 0,n=e.avoid_safe_area??e.avoidSafeArea??t?.avoid_safe_area??t?.avoidSafeArea;return typeof n==`boolean`?n:void 0}function wv(e){let t=gv(e.layout)?e.layout:void 0;return Ev(e.safe_area??e.safeArea??t?.safe_area??t?.safeArea)??void 0}function Tv(e){let t=gv(e.layout)?e.layout:void 0;return Dv(e.backdrop??t?.backdrop)??void 0}function Ev(e){if(e===void 0)return;if(!gv(e))return null;let t=jv(e,`x`),n=jv(e,`y`),r=jv(e,`width`),i=jv(e,`height`);return t===void 0||n===void 0||r===void 0||i===void 0||t<0||n<0||r<=0||i<=0||t+r>1.001||n+i>1.001?null:{x:Mv(t,0,1),y:Mv(n,0,1),width:Mv(r,0,1),height:Mv(i,0,1)}}function Dv(e){if(e===void 0)return;if(e===`snapshot_mirror`||e===`none`)return{type:e};if(!gv(e))return null;let t=e.type;return t===`snapshot_mirror`||t===`none`?{type:t}:null}function Ov(e,t){return typeof e==`boolean`?{[t]:e}:{}}function kv(e){return H_.includes(e)}function Av(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function jv(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function Mv(e,t,n){return Math.min(Math.max(e,t),n)}function Nv(e,t,n){let r=Av(e,t);if(r)return n(r)?r:null}function Pv(e){return e.interaction_id!==void 0&&typeof e.interaction_id!=`string`||e.component!==void 0&&typeof e.component!=`string`||e.component_version!==void 0&&typeof e.component_version!=`string`||e.type!==void 0&&typeof e.type!=`string`||e.metadata!==void 0&&!gv(e.metadata)||e.protocol_version!==void 0&&typeof e.protocol_version!=`number`||e.initiation_source!==void 0&&e.initiation_source!==`direct_user`&&e.initiation_source!==`autonomous`&&e.initiation_source!==`system`&&e.initiation_source!==`unknown`||e.initiated_at!==void 0&&typeof e.initiated_at!=`string`||e.producer_revision!==void 0&&typeof e.producer_revision!=`number`||e.payload_digest!==void 0&&typeof e.payload_digest!=`string`||e.response_text!==void 0&&typeof e.response_text!=`string`?null:e}function Fv(e){let t=Object.hasOwn(e,`protocol_mode`),n=Object.hasOwn(e,`protocol_version`),r=Object.hasOwn(e,`issued_card_capability`);if(!t&&!n&&!r)return{};if(e.protocol_mode===`legacy`)return n&&e.protocol_version!==null||r?null:{protocol_mode:`legacy`,protocol_version:null};if(e.protocol_mode!==`v1`||e.protocol_version!==1)return null;let i=Av(e,`issued_card_capability`);return i?{protocol_mode:`v1`,protocol_version:1,issued_card_capability:i}:null}var Iv=`tavus-deployment magic-canvas/0.0.0`;function Lv(e){if(!K_(e)||e.canvas_config===void 0||e.canvas_config===null)return null;let t=q_(e.canvas_config),n=e.properties.tool_call_id;if(!t)return null;if(!n)throw Error(`Received Magic Canvas tool call without tool_call_id.`);let r=X_(e.properties.arguments);if(!r.ok)throw r.error;return cv({conversationId:e.conversation_id,toolCallId:n,args:r.value,canvasConfig:t})}function Rv(e){if(!K_(e))return null;if(e.canvas_config!==void 0&&e.canvas_config!==null){let t=Lv(e);return t?{kind:`show`,instance:t}:null}return Z_(e)}function zv(e){return{body:{interaction_id:e.interaction_id,tool_call_id:e.tool_call_id,component:e.component,component_version:e.component_version,type:e.type,value:e.value,metadata:e.metadata}}}function Bv(e,t){return{theme:e.theme,displayMode:t?.display_mode??`inline`,availableDisplayModes:[`inline`,`fullscreen`],...t?{containerDimensions:mv(t),layout:{preferred_slot:t.preferred_slot,viable_slot:t.viable_slot,avoid_safe_area:t.avoid_safe_area,safe_area:t.safe_area,backdrop:t.backdrop}}:{},platform:`web`,userAgent:Iv,styles:{variables:Vv(e.cssVars)}}}function Vv(e){return{"--border-radius-md":e[`--radius-box`]??e[`--tavus-boxes-radius`]??`0.5rem`,"--border-radius-sm":e[`--radius-field`]??e[`--tavus-field-radius`]??`0.375rem`,"--border-radius-xs":e[`--radius-selector`]??`0.25rem`,"--border-radius-lg":e[`--radius-box`]??e[`--tavus-boxes-radius`]??`0.75rem`,"--border-width-regular":e[`--border`]??e[`--tavus-border-width`]??`1px`,"--font-text-sm-size":`0.875rem`,"--font-text-md-size":`1rem`,...Hv(e)}}function Hv(e){let t=e[`--color-base-content`],n=e[`--color-base-100`],r=e[`--color-base-200`],i=e[`--color-base-300`],a=e[`--color-error`],o=e[`--color-primary`],s={},c=(e,t)=>{t&&(s[e]=t)},l=(e,t,n)=>e&&n?`color-mix(in oklch, ${e} ${t}%, ${n})`:void 0;return c(`--color-background-primary`,n),c(`--color-background-secondary`,r),c(`--color-border-secondary`,i),c(`--color-border-primary`,l(t,28,n)),c(`--color-text-primary`,t),c(`--color-text-secondary`,l(t,62,n)),c(`--color-text-danger`,a),c(`--color-border-danger`,a),c(`--color-ring-primary`,o),s}var Uv=96;function Wv(e=document){let t=Array.from(e.querySelectorAll(`[data-canvas-card]`)).map(e=>e.getBoundingClientRect());return t.length===0?null:{left:Math.min(...t.map(e=>e.left)),right:Math.max(...t.map(e=>e.right)),top:Math.min(...t.map(e=>e.top)),bottom:Math.max(...t.map(e=>e.bottom))}}function Gv(e){let t=e?.getRootNode();return t instanceof ShadowRoot?t:document}function Kv(e){if(!e)return null;let t=e.getBoundingClientRect();return t.width<=0||t.height<=0?null:{left:t.left,right:t.right,top:t.top,bottom:t.bottom}}function qv(e,t,n,r){if(!t)return!1;let i=r?r.left:0,a=r?r.top:0,o=r?r.right-r.left:globalThis.innerWidth,s=r?r.bottom-r.top:globalThis.innerHeight,c=e?.safe_area??W_,l=i+c.x*o+n,u=i+(c.x+c.width)*o+n,d=a+c.y*s,f=a+(c.y+c.height)*s;return l<t.right&&u>t.left&&d<t.bottom&&f>t.top}function Jv(e,t,n){let[r,i]=O(()=>e?Wv(Gv(n?.current)):null);return $e(()=>{if(!e){i(null);return}let t=Gv(n?.current),r=()=>i(Wv(t)),a=new ResizeObserver(r),o=()=>{for(let e of t.querySelectorAll(`[data-canvas-card]`))a.observe(e)};r(),o(),a.observe(document.documentElement);let s=globalThis.requestAnimationFrame(()=>{r(),o()});return globalThis.addEventListener(`resize`,r),()=>{a.disconnect(),globalThis.removeEventListener(`resize`,r),globalThis.cancelAnimationFrame(s)}},[e,t,n]),e?r:null}function Yv(e,t,n){let[r,i]=O(()=>t?Kv(e.current):null);return $e(()=>{if(!t){i(null);return}let n=()=>i(Kv(e.current)),r=new ResizeObserver(n);n(),e.current&&r.observe(e.current),r.observe(document.documentElement);let a=globalThis.requestAnimationFrame(n);return globalThis.addEventListener(`resize`,n),()=>{r.disconnect(),globalThis.removeEventListener(`resize`,n),globalThis.cancelAnimationFrame(a)}},[t,n,e]),t?r:null}function Xv(e,t,n,r,i,a){let o=e?.side??(n===`safe-area-left`?`left`:n===`safe-area-right`?`right`:null);return{usePip:o!=null&&(t===`pip`||t===`auto`&&qv(e,r,i,a)),side:o}}function Zv(e,t=document,n){let r=n?n.left:0,i=n?n.right:globalThis.innerWidth,a=n?n.top:0,o=n?n.bottom:globalThis.innerHeight,s=i-r,c=o-a,l=Array.from(t.querySelectorAll(`[data-canvas-card]`)).map(e=>e.getBoundingClientRect()),u,d,f,p;if(l.length>0){let t=Math.min(...l.map(e=>e.left)),n=Math.max(...l.map(e=>e.right));f=Math.min(...l.map(e=>e.top)),p=Math.max(...l.map(e=>e.bottom)),[u,d]=e===`right`?[r,t]:[n,i]}else{let t=Math.min(448,Math.max(0,s-32));[u,d]=e===`right`?[r,i-16-t]:[r+16+t,i],f=a,p=o}let m=d-u>=144&&p-f>=Uv&&u>=r&&d<=i;if(l.length>0&&!m){let t=Math.min(448,Math.max(0,s-32));[u,d]=e===`right`?[r,i-16-t]:[r+16+t,i],f=a,p=o}let h=Math.max(0,d-u-48),g=Math.max(Uv,Math.min(h,c-48));return{centerX:(u+d)/2-r,centerY:(f+p)/2-a,diameter:g}}var Qv=`560ms linear(0, 0, .0001, .0002, .0003, .0005, .0007, .001, .0013, .0016, .002, .0024, .0029, .0033, .0039, .0044, .005, .0057, .0063, .007, .0079, .0086, .0094, .0103, .0112, .0121, .0132 1.84%, .0153, .0175, .0201, .0226, .0253, .0283, .0313, .0345, .038, .0416, .0454, .0493, .0535, .0576, .0621, .0667, .0714, .0764, .0816 5.04%, .0897, .098 5.62%, .1071, .1165, .1263 6.56%, .137, .1481 7.25%, .1601 7.62%, .1706 7.94%, .1819 8.28%, .194, .2068 9.02%, .2331 9.79%, .2898 11.44%, .3151 12.18%, .3412 12.95%, .3533, .365 13.66%, .3786, .3918, .4045, .4167, .4288, .4405, .452, .4631 16.72%, .4759, .4884, .5005, .5124, .5242, .5354, .5467, .5576, .5686, .5791, .5894, .5995, .6094, .6194, .6289, .6385, .6477, .6569, .6659 24.45%, .6702, .6747, .6789, .6833, .6877, .6919, .696, .7002, .7043, .7084, .7125, .7165, .7205, .7244, .7283, .7321, .7358, .7396, .7433, .7471, .7507, .7544, .7579, .7615, .7649, .7685, .7718, .7752, .7786, .782, .7853, .7885, .7918, .7951, .7982, .8013, .8043, .8075, .8104, .8135, .8165, .8195, .8224, .8253, .8281, .8309, .8336, .8365, .8391, .8419, .8446, .8472, .8499, .8524, .855, .8575, .8599, .8625 37.27%, .8651, .8678, .8703, .8729, .8754, .8779, .8803, .8827, .8851, .8875, .8898, .892, .8942, .8965, .8987, .9009, .903, .9051, .9071, .9092, .9112, .9132, .9151, .9171, .919, .9209, .9227, .9245, .9262, .928, .9297, .9314, .9331, .9347, .9364, .9379, .9395, .941, .9425, .944, .9454, .9469, .9483, .9497, .951, .9524, .9537, .955, .9562, .9574, .9586, .9599, .961, .9622, .9633, .9644, .9655, .9665, .9676, .9686, .9696, .9705, .9715, .9724, .9733, .9742, .975, .9758, .9766, .9774, .9782, .9789, .9796, .9804, .9811, .9817, .9824, .9831, .9837, .9843, .9849, .9855, .986, .9866, .9871, .9877, .9882, .9887, .9892, .9896 70.56%, .9905 71.67%, .9914 72.82%, .9922, .9929 75.2%, .9936 76.43%, .9942 77.71%, .9948 79.03%, .9954 80.39%, .9959 81.81%, .9963 83.28%, .9968 84.82%, .9972 86.41%, .9975 88.07%, .9979 89.81%, .9982 91.64%, .9984 93.56%, .9987 95.58%, .9989 97.72%, .9991)`;function $v(e,t){let n=Math.abs(t)/2;return e===`left`?`${n}px center`:`calc(100% - ${n}px) center`}function ey(e,t,n){let[r,i]=O(()=>e&&t?Zv(t,Gv(n?.current),Kv(n?.current)):null);return $e(()=>{if(!e||!t){i(null);return}let r=Gv(n?.current),a=()=>i(Zv(t,r,Kv(n?.current))),o=new ResizeObserver(a),s=()=>{for(let e of r.querySelectorAll(`[data-canvas-card]`))o.observe(e)};a(),s(),n?.current&&o.observe(n.current),o.observe(document.documentElement);let c=globalThis.requestAnimationFrame(()=>{a(),s()});return globalThis.addEventListener(`resize`,a),()=>{o.disconnect(),globalThis.removeEventListener(`resize`,a),globalThis.cancelAnimationFrame(c)}},[e,t,n]),e&&t?r:null}function ty(e,t){let[n,r]=O(null);return $e(()=>{if(!t){r(null);return}let n=e.current;if(!n)return;let i=()=>{let e=n.clientWidth,t=n.clientHeight;r(e&&t?{width:e,height:t}:null)},a=new ResizeObserver(i);return a.observe(n),i(),()=>a.disconnect()},[t,e]),t?n:null}var ny=1;function ry(e,t,n){return Math.min(Math.max(e,t),n)}function iy(e,t,n,r){let i=Math.min(e.diameter/t.height,1),a=r?.safe_area??W_,o=((a.x+a.width/2)*t.width+n)*i,s=(a.y+a.height/2)*t.height*i,c=e.diameter/2;return{scale:i,tx:ry(e.centerX-o,e.centerX+c-t.width*i,e.centerX-c),ty:ry(e.centerY-s,e.centerY+c-t.height*i,e.centerY-c)}}var ay=[`cx`,`cy`,`r`,`tx`,`ty`,`s`,`shift`];function oy(e,t,n,r,i){if(!n)return null;let{width:a,height:o}=n,s={x:a/2,y:o/2},c=null;if(e&&(c=iy(e,n,r,i),s={x:(e.centerX-c.tx)/c.scale,y:(e.centerY-c.ty)/c.scale}),t&&c&&e)return{cx:s.x,cy:s.y,r:e.diameter/2/c.scale,tx:c.tx,ty:c.ty,s:c.scale,shift:r};let l=Math.hypot(Math.max(s.x,a-s.x),Math.max(s.y,o-s.y));return{cx:s.x,cy:s.y,r:l*1.1,tx:0,ty:0,s:1,shift:r}}function sy(e,t,n){let r=A(null),i=A(e),a=A(n),o=A(0),s=A(0);i.current=e,a.current=n,k(()=>{let e=i.current;if(!e)return;if(!r.current||cy()){r.current={values:{...e},velocity:{cx:0,cy:0,r:0,tx:0,ty:0,s:0,shift:0}},a.current(e,!0);return}if(o.current)return;let n=Math.max(t,160)/4e3;s.current=performance.now();let c=e=>{o.current=0;let t=i.current,l=r.current;if(!t||!l)return;let u=Math.min((e-s.current)/1e3,1/30);s.current=e;let d=!0;for(let e of ay){let r=(t[e]-l.values[e])/(n*n)-2/n*l.velocity[e],i=l.velocity[e]+r*u,a=l.values[e]+i*u,o=e===`s`?.001:.25;Math.abs(t[e]-a)<o&&Math.abs(i)*n<o?(l.values[e]=t[e],l.velocity[e]=0):(l.values[e]=a,l.velocity[e]=i,d=!1)}a.current(l.values,d),d||(o.current=globalThis.requestAnimationFrame(c))};o.current=globalThis.requestAnimationFrame(c)},[e?ay.map(t=>Math.round(e[t]*100)).join():``,t]),k(()=>()=>{o.current&&globalThis.cancelAnimationFrame(o.current)},[])}function cy(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function ly({geom:e,visible:t}){return P(`div`,{"aria-hidden":`true`,"data-morph":`ring`,class:`pointer-events-none absolute z-10 rounded-full`,style:{top:`${e.centerY-e.diameter/2}px`,left:`${e.centerX-e.diameter/2}px`,width:`${e.diameter}px`,height:`${e.diameter}px`,boxShadow:`0 0 0 3px rgb(255 255 255 / 12%), 0 18px 50px rgb(0 0 0 / 55%)`,opacity:+!!t,transition:`opacity 240ms ease-out`}})}function uy(e,t){let n=t>=0?`left`:`right`,r=A({side:n,shift:t});k(()=>{e&&(r.current={side:n,shift:t})},[e,n,t]);let i=e?n:r.current.side;return{side:i,transformOrigin:$v(i,e?t:r.current.shift),translateX:e?0:-r.current.shift}}function dy(e,t,n){return`${e.side??``}:${e.active}:${t}:${n??``}`}function fy({snapshotUrl:e,transformOrigin:t}){return P(`div`,{class:`absolute inset-0 bg-cover bg-center`,style:{backgroundImage:`url("${e}")`,transform:`scaleX(-1)`,transformOrigin:t}})}function py({snapshotUrl:e,translateX:t,transition:n,transformOrigin:r}){return P(`div`,{"aria-hidden":`true`,"data-morph":`mirror`,class:`pointer-events-none absolute z-0 overflow-hidden`,style:{inset:`0 0`,transform:`translate3d(${t}px, 0, 0)`,transition:`transform ${n}`,willChange:`transform`},children:P(fy,{snapshotUrl:e,transformOrigin:r})})}function my({ambient:e,usePip:t,transition:n}){return e===`none`?null:P(`div`,{"aria-hidden":`true`,"data-morph":`ambient`,class:`pointer-events-none absolute inset-0 z-0`,style:{opacity:+!!t,transition:`opacity ${n}`,background:e===`darker`?`rgb(0 0 0 / 40%)`:`rgb(0 0 0 / 15%)`}})}function hy({morphCapable:e,snapshotUrl:t,mirrorSide:n,videoShiftX:r,transition:i,sceneRef:a,videoWrapRef:o,fill:s,videoRef:c}){return P(`div`,{ref:a,"data-morph":`scene`,class:`absolute inset-0`,style:e?{transformOrigin:`top left`}:void 0,children:P(`div`,{ref:o,class:`absolute inset-0`,style:e?void 0:{transform:`translate3d(${r}px, 0, 0)`,transition:`transform ${i}`},children:[s(c),e&&t!==null&&P(`div`,{"aria-hidden":`true`,"data-morph":`window-mirror`,class:`absolute top-0 bottom-0 w-full`,style:n===`right`?{left:`calc(100% - ${ny}px)`}:{right:`calc(100% - ${ny}px)`},children:P(fy,{snapshotUrl:t,transformOrigin:`center`})})]})})}function gy({canvasLayoutEffect:e,smartSidecarActive:t,isScreenSharing:n,fill:r,captureSnapshot:i,transition:a=Qv,transitionMs:o=560,personaMode:s=`shift`,renderedSlot:c=null,ambient:l=`default`,children:u}){let d=A(null),[f,p]=O(null),m=t&&e.backdrop.type===`snapshot_mirror`,h=t?e.video_shift_x:0,g=A(null),_=dy(e,h,c),{usePip:v,side:y}=Xv(e,s,c,Jv(s!==`shift`,_,g),h,Yv(g,s!==`shift`,_)),b=ey(s!==`shift`,y,g),x=uy(m,h);k(()=>{if(!m)return;let e=!1,t=0,n,r=0,a=()=>{if(e)return;let t=i(d.current);if(t){p(t);return}r+=1,r<8&&(n=globalThis.setTimeout(a,150))};return typeof globalThis.requestAnimationFrame==`function`?t=globalThis.requestAnimationFrame(a):n=globalThis.setTimeout(a,0),()=>{e=!0,t&&globalThis.cancelAnimationFrame?.(t),n&&globalThis.clearTimeout(n)}},[m,e.side,e.video_shift_x,i]),k(()=>{if(m||f===null)return;let e=globalThis.setTimeout(()=>{p(null)},o);return()=>globalThis.clearTimeout(e)},[m,f,o]);let S=v&&y!=null&&b!=null,C=s!==`shift`,w=ty(g,C),T=f!==null&&!C,E=C&&y!=null,ee=A(null),te=A(null),[ne,re]=O(!0),ie=A(!0),ae=M((e,t)=>{let n=ee.current;n&&(n.style.clipPath=`circle(${e.r}px at ${e.cx}px ${e.cy}px)`,n.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.s})`);let r=te.current;r&&(r.style.transform=`translate3d(${e.shift}px, 0, 0)`),ie.current!==t&&(ie.current=t,re(t))},[]);return sy(C?oy(b,S,w,h,e):null,o,ae),P(`div`,{ref:g,class:`relative w-full h-full overflow-hidden ${n?`flex items-center justify-center`:``}`,children:[T&&f!==null&&P(py,{snapshotUrl:f,translateX:x.translateX,transition:a,transformOrigin:x.transformOrigin}),E&&P(my,{ambient:l,usePip:v,transition:a}),P(`div`,{"data-morph":`fg`,class:`absolute inset-0 z-10`,children:P(hy,{morphCapable:C,snapshotUrl:f,mirrorSide:x.side,videoShiftX:h,transition:a,sceneRef:ee,videoWrapRef:te,fill:r,videoRef:d})}),C&&b&&P(ly,{geom:b,visible:S&&ne}),u]})}var _y=480,vy=U(({personaSessionId:e,isAudioOnly:t,avatarOff:n,canvasLayoutEffect:r,smartSidecarActive:i})=>{let a=t||n,o=i?r.video_shift_x:0;return P(`div`,{class:`absolute inset-0 overflow-hidden`,children:P(`div`,{class:`absolute top-0 bottom-0`,style:{left:o>0?`${_y}px`:`0px`,right:o<0?`${_y}px`:`0px`,transition:`left ${Qv}, right ${Qv}`},children:[P(xf,{automirror:!0,sessionId:e,type:`screenVideo`,fit:`contain`,className:`absolute inset-0 w-full h-full object-contain`}),P(`div`,{class:`absolute bottom-4 right-4 aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10`,children:a?P(`div`,{class:`flex w-full h-full items-center justify-center`,children:P(h_,{sessionId:e})}):P(xf,{automirror:!0,sessionId:e,type:`video`,fit:`cover`,className:`w-full h-full object-cover`})})]})})});function W(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}function yy(e){return e&&Object.assign(Cy,e),Cy}var by,xy,Sy,Cy,wy=t((()=>{xy=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Sy=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},(by=globalThis).__zod_globalConfig??(by.__zod_globalConfig={}),Cy=globalThis.__zod_globalConfig}));function Ty(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ey(e,t){return typeof t==`bigint`?t.toString():t}function Dy(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Oy(e){return e==null}function ky(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ay(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function jy(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==nb)return r===void 0&&(r=nb,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function My(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ny(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Py(e){return JSON.stringify(e)}function Fy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}function Iy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ly(e){if(Iy(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Iy(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Ry(e){return Ly(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function zy(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function By(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Vy(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function Hy(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return By(e,Ny(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return My(this,`shape`,e),e},checks:[]}))}function Uy(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return By(e,Ny(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return My(this,`shape`,r),r},checks:[]}))}function Wy(e,t){if(!Ly(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return By(e,Ny(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return My(this,`shape`,n),n}}))}function Gy(e,t){if(!Ly(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return By(e,Ny(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return My(this,`shape`,n),n}}))}function Ky(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return By(e,Ny(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return My(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function qy(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return By(t,Ny(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return My(this,`shape`,i),i},checks:[]}))}function Jy(e,t,n){return By(t,Ny(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return My(this,`shape`,i),i}}))}function Yy(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Xy(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Zy(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Qy(e){return typeof e==`string`?e:e?.message}function $y(e,t,n){let r=e.message?e.message:Qy(e.inst?._zod.def?.error?.(e))??Qy(t?.error?.(e))??Qy(n.customError?.(e))??Qy(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function eb(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function tb(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var nb,rb,ib,ab,ob,sb=t((()=>{wy(),nb=Symbol(`evaluating`),rb=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{},ib=Dy(()=>{if(Cy.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),ab=new Set([`string`,`number`,`symbol`]),ob={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}}));function cb(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function lb(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var ub,db,fb,pb=t((()=>{wy(),sb(),ub=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ey,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},db=W(`$ZodError`,ub),fb=W(`$ZodError`,ub,{Parent:Error})})),mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob=t((()=>{wy(),pb(),sb(),mb=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new xy;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>$y(e,a,yy())));throw rb(t,i?.callee),t}return o.value},hb=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>$y(e,a,yy())));throw rb(t,i?.callee),t}return o.value},gb=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new xy;return a.issues.length?{success:!1,error:new(e??db)(a.issues.map(e=>$y(e,i,yy())))}:{success:!0,data:a.value}},_b=gb(fb),vb=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>$y(e,i,yy())))}:{success:!0,data:a.value}},yb=vb(fb),bb=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return mb(e)(t,n,i)},xb=e=>(t,n,r)=>mb(e)(t,n,r),Sb=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return hb(e)(t,n,i)},Cb=e=>async(t,n,r)=>hb(e)(t,n,r),wb=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return gb(e)(t,n,i)},Tb=e=>(t,n,r)=>gb(e)(t,n,r),Eb=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return vb(e)(t,n,i)},Db=e=>async(t,n,r)=>vb(e)(t,n,r)}));function kb(){return new RegExp(Ub,`u`)}function Ab(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function jb(e){return RegExp(`^${Ab(e)}$`)}function Mb(e){let t=Ab({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Qb}T(?:${r})$`)}var Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx=t((()=>{Nb=/^[cC][0-9a-z]{6,}$/,Pb=/^[0-9a-z]+$/,Fb=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ib=/^[0-9a-vA-V]{20}$/,Lb=/^[A-Za-z0-9]{27}$/,Rb=/^[a-zA-Z0-9_-]{21}$/,zb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Bb=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Vb=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Hb=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ub=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Wb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Kb=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,qb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yb=/^[A-Za-z0-9_-]*$/,Xb=/^https?$/,Zb=/^\+[1-9]\d{6,14}$/,Qb=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,$b=RegExp(`^${Qb}$`),ex=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},tx=/^-?\d+$/,nx=/^-?\d+(?:\.\d+)?$/,rx=/^(?:true|false)$/i,ix=/^null$/i,ax=/^undefined$/i,ox=/^[^A-Z]*$/,sx=/^[^a-z]*$/})),lx,ux,dx,fx,px,mx,hx,gx,_x,vx,yx,bx,xx,Sx,Cx,wx,Tx,Ex=t((()=>{wy(),cx(),sb(),lx=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ux={number:`number`,bigint:`bigint`,object:`date`},dx=W(`$ZodCheckLessThan`,(e,t)=>{lx.init(e,t);let n=ux[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fx=W(`$ZodCheckGreaterThan`,(e,t)=>{lx.init(e,t);let n=ux[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),px=W(`$ZodCheckMultipleOf`,(e,t)=>{lx.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ay(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),mx=W(`$ZodCheckNumberFormat`,(e,t)=>{lx.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ob[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=tx)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),hx=W(`$ZodCheckMaxLength`,(e,t)=>{var n;lx.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oy(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=eb(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gx=W(`$ZodCheckMinLength`,(e,t)=>{var n;lx.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oy(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=eb(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),_x=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;lx.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oy(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=eb(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),vx=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;lx.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),yx=W(`$ZodCheckRegex`,(e,t)=>{vx.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),bx=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ox,vx.init(e,t)}),xx=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=sx,vx.init(e,t)}),Sx=W(`$ZodCheckIncludes`,(e,t)=>{lx.init(e,t);let n=zy(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Cx=W(`$ZodCheckStartsWith`,(e,t)=>{lx.init(e,t);let n=RegExp(`^${zy(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),wx=W(`$ZodCheckEndsWith`,(e,t)=>{lx.init(e,t);let n=RegExp(`.*${zy(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Tx=W(`$ZodCheckOverwrite`,(e,t)=>{lx.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),Dx,Ox=t((()=>{Dx=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
58
58
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
59
59
  `))}}})),kx,Ax=t((()=>{kx={major:4,minor:4,patch:3}}));function jx(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}function Mx(e){if(!Yb.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return jx(t.padEnd(Math.ceil(t.length/4)*4,`=`))}function Nx(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}function Px(e,t,n){e.issues.length&&t.issues.push(...Zy(n,e.issues)),t.value[n]=e.value}function Fx(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Zy(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Ix(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Vy(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Lx(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Fx(e,n,i,t,u,d))):Fx(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}function Rx(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Yy(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>$y(e,r,yy())))}),t)}function zx(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ly(e)&&Ly(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=zx(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=zx(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Bx(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Yy(e))return e;let o=zx(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}function Vx(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}function Hx(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function Ux(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Wx(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}function Gx(e){return e.value=Object.freeze(e.value),e}function Kx(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(tb(e))}}var qx,Jx,Yx,Xx,Zx,Qx,$x,eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS,_S,vS,yS,bS,xS,SS,CS,wS,TS,ES,DS,OS,kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS=t((()=>{Ex(),wy(),Ox(),Ob(),cx(),sb(),Ax(),qx=W(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=kx;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Yy(e),i;for(let a of t){if(a._zod.def.when){if(Xy(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new xy;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Yy(e,t))});else{if(e.issues.length===t)continue;r||=Yy(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Yy(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new xy;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new xy;return o.then(e=>t(e,r,a))}return t(o,r,a)}}jy(e,`~standard`,()=>({validate:t=>{try{let n=_b(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return yb(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Jx=W(`$ZodString`,(e,t)=>{qx.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ex(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Yx=W(`$ZodStringFormat`,(e,t)=>{vx.init(e,t),Jx.init(e,t)}),Xx=W(`$ZodGUID`,(e,t)=>{t.pattern??=Bb,Yx.init(e,t)}),Zx=W(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Vb(e)}else t.pattern??=Vb();Yx.init(e,t)}),Qx=W(`$ZodEmail`,(e,t)=>{t.pattern??=Hb,Yx.init(e,t)}),$x=W(`$ZodURL`,(e,t)=>{Yx.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Xb.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),eS=W(`$ZodEmoji`,(e,t)=>{t.pattern??=kb(),Yx.init(e,t)}),tS=W(`$ZodNanoID`,(e,t)=>{t.pattern??=Rb,Yx.init(e,t)}),nS=W(`$ZodCUID`,(e,t)=>{t.pattern??=Nb,Yx.init(e,t)}),rS=W(`$ZodCUID2`,(e,t)=>{t.pattern??=Pb,Yx.init(e,t)}),iS=W(`$ZodULID`,(e,t)=>{t.pattern??=Fb,Yx.init(e,t)}),aS=W(`$ZodXID`,(e,t)=>{t.pattern??=Ib,Yx.init(e,t)}),oS=W(`$ZodKSUID`,(e,t)=>{t.pattern??=Lb,Yx.init(e,t)}),sS=W(`$ZodISODateTime`,(e,t)=>{t.pattern??=Mb(t),Yx.init(e,t)}),cS=W(`$ZodISODate`,(e,t)=>{t.pattern??=$b,Yx.init(e,t)}),lS=W(`$ZodISOTime`,(e,t)=>{t.pattern??=jb(t),Yx.init(e,t)}),uS=W(`$ZodISODuration`,(e,t)=>{t.pattern??=zb,Yx.init(e,t)}),dS=W(`$ZodIPv4`,(e,t)=>{t.pattern??=Wb,Yx.init(e,t),e._zod.bag.format=`ipv4`}),fS=W(`$ZodIPv6`,(e,t)=>{t.pattern??=Gb,Yx.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),pS=W(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Kb,Yx.init(e,t)}),mS=W(`$ZodCIDRv6`,(e,t)=>{t.pattern??=qb,Yx.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}}),hS=W(`$ZodBase64`,(e,t)=>{t.pattern??=Jb,Yx.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{jx(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),gS=W(`$ZodBase64URL`,(e,t)=>{t.pattern??=Yb,Yx.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Mx(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),_S=W(`$ZodE164`,(e,t)=>{t.pattern??=Zb,Yx.init(e,t)}),vS=W(`$ZodJWT`,(e,t)=>{Yx.init(e,t),e._zod.check=n=>{Nx(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),yS=W(`$ZodNumber`,(e,t)=>{qx.init(e,t),e._zod.pattern=e._zod.bag.pattern??nx,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),bS=W(`$ZodNumberFormat`,(e,t)=>{mx.init(e,t),yS.init(e,t)}),xS=W(`$ZodBoolean`,(e,t)=>{qx.init(e,t),e._zod.pattern=rx,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),SS=W(`$ZodUndefined`,(e,t)=>{qx.init(e,t),e._zod.pattern=ax,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),CS=W(`$ZodNull`,(e,t)=>{qx.init(e,t),e._zod.pattern=ix,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),wS=W(`$ZodUnknown`,(e,t)=>{qx.init(e,t),e._zod.parse=e=>e}),TS=W(`$ZodNever`,(e,t)=>{qx.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),ES=W(`$ZodArray`,(e,t)=>{qx.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Px(t,n,e))):Px(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}}),DS=W(`$ZodObject`,(e,t)=>{if(qx.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Dy(()=>Ix(t));jy(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Iy,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Fx(n,t,e,s,r,i))):Fx(a,t,e,s,r,i)}return i?Lx(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),OS=W(`$ZodObjectJIT`,(e,t)=>{DS.init(e,t);let n=e._zod.parse,r=Dy(()=>Ix(t)),i=e=>{let t=new Dx([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Py(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Py(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
60
60
  if (${n}.issues.length) {
package/dist/index.mjs CHANGED
@@ -17366,10 +17366,10 @@ function Bv(e) {
17366
17366
  };
17367
17367
  }
17368
17368
  function Vv(e) {
17369
- let t = e["--color-base-content"], n = e["--color-base-100"], r = e["--color-base-200"], i = e["--color-base-300"], a = e["--color-error"], o = {}, s = (e, t) => {
17370
- t && (o[e] = t);
17371
- }, c = (e, t, n) => e && n ? `color-mix(in oklch, ${e} ${t}%, ${n})` : void 0;
17372
- return s("--color-background-primary", n), s("--color-background-secondary", r), s("--color-border-secondary", i), s("--color-border-primary", c(t, 28, n)), s("--color-text-primary", t), s("--color-text-secondary", c(t, 62, n)), s("--color-text-danger", a), s("--color-border-danger", a), o;
17369
+ let t = e["--color-base-content"], n = e["--color-base-100"], r = e["--color-base-200"], i = e["--color-base-300"], a = e["--color-error"], o = e["--color-primary"], s = {}, c = (e, t) => {
17370
+ t && (s[e] = t);
17371
+ }, l = (e, t, n) => e && n ? `color-mix(in oklch, ${e} ${t}%, ${n})` : void 0;
17372
+ return c("--color-background-primary", n), c("--color-background-secondary", r), c("--color-border-secondary", i), c("--color-border-primary", l(t, 28, n)), c("--color-text-primary", t), c("--color-text-secondary", l(t, 62, n)), c("--color-text-danger", a), c("--color-border-danger", a), c("--color-ring-primary", o), s;
17373
17373
  }
17374
17374
  //#endregion
17375
17375
  //#region ../core/src/magic-canvas/persona-presentation.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tavus/widget",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "Tavus conversational video AI <tavus-widget> launcher custom element for the web.",
5
5
  "keywords": [
6
6
  "ai",