@tavus/embed 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.
- package/dist/index.iife.js +1 -1
- package/dist/index.mjs +4 -4
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -54,7 +54,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
54
54
|
`;function _g(e){return e.replace(/\s(width|height)="\d+"/g,``)}function vg(e,t){let n=_g(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 yg={pixelarticons:{close:vg(Qh,`Close`),cancel:vg($h,`Cancel`),leave:vg(ig,`Leave call`),more:vg(cg,`More`),error:vg(tg,`Error`),mic:vg(ag,`Microphone`),"mic-off":vg(og,`Microphone muted`),cam:vg(gg,`Camera`),"cam-off":vg(Jh,`Camera off`),"screen-share":vg(ug,`Screen share`),pip:vg(lg,`Picture in picture`),user:vg(fg,`User`),"face-smile":vg(mg,`Camera off`),captions:vg(Yh,`Closed captions`),chat:vg(Xh,`Chat`),fullscreen:vg(rg,`Enter fullscreen`),"fullscreen-exit":vg(eg,`Exit fullscreen`),expand:vg(ng,`Expand`),collapse:vg(eg,`Collapse`),send:vg(dg,`Send`),"external-link":vg(hg,`External link`),clock:vg(Zh,`Clock`),moon:vg(sg,`Unavailable`),users:vg(pg,`Busy`)},lucide:qh};function bg({name:e,...t}){let{config:n}=Xp(),r=(yg[n.value.customization.style.icon_library]??yg.pixelarticons)[e];return P(r,{...t})}var xg=`Ready when you are`,Sg=`Start the conversation`;function Cg(e){return typeof e==`string`&&e.length>0?e:``}function wg(e){let t=Cg(e.replica_thumbnail_image_url)||null,n=Cg(e.replica_thumbnail_video_url)||null;return!t&&!n?null:{imageUrl:t,videoUrl:n}}function Tg(e){let{preview:t}=e.customization,{background:n}=t,r=wg(e),i;i=n.type?n.type:r?`replica`:`background-gradient`;let a=Cg(n.url);return{title:t.title||xg,description:t.description||``,btn_title:t.btn_title||Sg,background:{type:i,url:a}}}var Eg={backgroundImage:`linear-gradient(to bottom right, var(--color-primary), var(--color-base-300))`},Dg=`#t=0.1`;function Og(e){return e.includes(`#`)?e:`${e}${Dg}`}function kg({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:Og(s),muted:!0,playsinline:!0,preload:`metadata`,controls:!1,onError:()=>i(s)}):P(E,{children:t})}function Ag({variant:e,replica:t}){let[n,r]=O(!1);return k(()=>{r(!1)},[e.url]),e.type===`replica`&&t?P(kg,{replica:t,fallback:P(`div`,{class:`absolute inset-0`,style:Eg})}):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:Eg})}function jg({className:e=``}){let{config:t}=Xp(),n=Tg(t.value),r=wg(t.value);return P(`div`,{class:`relative size-16 shrink-0 rounded-box overflow-hidden bg-base-300 ${e}`,children:P(Ag,{variant:n.background,replica:r})})}var Mg=`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 Ng({title:e,description:t,media:n,children:r,overlay:i}){return P(`div`,{class:Mg,children:[n===void 0?P(jg,{}):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 Pg({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 Fg={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 Ig(e,t){let n=t?.[e];return{title:n?.title||Fg[e].title,description:n?.description||Fg[e].description}}var Lg={daily_limit:`clock`,total_limit:`moon`,busy:`users`,error:`error`,captcha_unsupported:`error`},Rg={daily_limit:`never`,total_limit:`never`,busy:`always`,error:`when-retryable`,captcha_unsupported:`never`};function zg({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(bg,{name:Lg[e],size:`2rem`})})}function Bg({cause:e,canRetry:t,onRetry:n,onCancel:r,isStarting:i=!1}){let{config:a}=Xp(),o=a.value.customization?.unavailable_screen,s=Ig(e,o),c=o?.cta??[],l=Rg[e],u=l===`always`||l===`when-retryable`&&t,d=u||c.length>0||!!r;return P(Ng,{media:P(zg,{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(Pg,{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 Vg(){let e=N(Kf);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}}var Hg={start_button:`Start the conversation`,ready_to_start:``};function Ug(){let{config:e}=Xp(),{preview:t}=e.value.customization;return j(()=>({start_button:t.btn_title??Hg.start_button,ready_to_start:t.description??Hg.ready_to_start}),[t])}function Wg(){return N(bt)?.layout??`inline`}function Gg({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 Kg({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 qg=`text-preview-title @max-mobile:text-preview-title-narrow`,Jg=`text-preview-title-full-screen`,Yg=`text-sm @max-mobile:text-xs`,Xg=`text-preview-description-full-screen`;function Zg({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?Jg:qg} font-medium leading-tight`,children:e}),t&&P(`p`,{class:`${n?Xg:Yg} text-white/80 leading-snug`,children:t})]})}var Qg=`absolute inset-0 overflow-hidden bg-base-100 motion-safe:animate-[tavusFadeUp_280ms_ease-out]`,$g=`absolute inset-x-0 top-0 h-2/5 bg-linear-to-b from-black/60 to-transparent`,e_=`absolute inset-x-0 bottom-0 h-2/5 bg-linear-to-t from-black/70 to-transparent`,t_=`absolute inset-0 bg-black/45`,n_=`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 r_({title:e,description:t,children:n,align:r=`low`,overlay:i,class:a,role:o,"aria-live":s}){let{config:c}=Xp(),l=Tg(c.value),u=wg(c.value),d=Wg()===`full-screen`;return P(`div`,{class:a?`${Qg} ${a}`:Qg,role:o,"aria-live":s,children:[P(Ag,{variant:l.background,replica:u}),r===`center`?P(E,{children:[P(`div`,{class:t_}),P(`div`,{class:`${n_} flex flex-col items-center justify-center gap-3`,children:n})]}):P(E,{children:[(e||t)&&(d?P(`div`,{class:$g}):P(E,{children:[P(`div`,{class:`${$g} hidden @max-mobile:block`}),P(`div`,{class:e_})]})),d?P(`div`,{class:n_,children:[P(Zg,{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:`${n_} 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(Zg,{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 i_={video:`cam`,audio:`mic`,chat:`chat`},a_={"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 o_({children:e,loading:t=!1,...n}){let{config:r}=Xp(),i=Wg(),a=i_[r.value.customization.conversation.modality],o=a!==void 0&&i===`full-screen`;return P(Pg,{class:`btn-preview-action rounded-box ${a_[i]}`,loading:t,...n,children:o?P(`span`,{class:`flex items-center justify-center gap-2`,children:[P(bg,{name:a,"aria-hidden":!0}),e]}):e})}var s_=`Thanks for joining`,c_=`You can start a new conversation whenever you're ready.`,l_=`Start a new conversation`;function u_(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`||t.protocol===`mailto:`}catch{return!1}}function d_({text:e,onRestart:t,isStarting:n=!1,permissionRequest:r=null}){let{config:i}=Xp(),a=Wg()===`full-screen`,o=i.value.customization.after_call,s=o.cta.filter(e=>u_(e.url)),c=o.title||e?.title||s_,l=o.description||e?.description||c_,u=e?.restart||l_;return P(r_,{title:c,description:l,children:[P(`div`,{class:`relative`,children:[r&&P(Kg,{message:Gg(r),class:`absolute bottom-full mb-3 z-20 ${a?`left-1/2 -translate-x-1/2`:`right-0`}`}),P(o_,{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 f_(){let e=Hd(),t=Wd(),{isOff:n}=Xd(t),{camState:r}=$d();return{isCamReady:j(()=>r===`granted`,[r]),isCamMuted:n,localSessionId:t,onToggleCamera:M(()=>{e?.setLocalVideo(n)},[e,n])}}function p_(){let e=Hd(),t=Wd(),{isOff:n}=Zd(t),{micState:r}=$d();return{isMicReady:j(()=>r===`granted`,[r]),isMicMuted:n,localSessionId:t,onToggleMicrophone:M(()=>{e?.setLocalAudio(n)},[e,n])}}function m_(){let e=Hd(),t=Wd(),{isOff:n}=Qd(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 h_={microphone:`microphone`,camera:`camera`};function g_({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 __(){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(g_,{})}),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 v_=U(({device:e,onClose:t})=>{let n=h_[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(bg,{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(__,{})}),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(g_,{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`})]})]})]})})}),y_=we({open:()=>{},close:()=>{}});function b_(){return N(y_)}function x_({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(y_.Provider,{value:a,children:[e,t&&P(v_,{device:t,onClose:i})]})}var S_=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:`!`})),C_=`select-control-pill relative inline-flex items-center bg-neutral text-neutral-content`,w_=`absolute inset-0 w-full h-full opacity-0 cursor-pointer appearance-none disabled:cursor-not-allowed`,T_=`absolute right-1.5 top-1/2 -translate-y-1/2 pointer-events-none flex items-center`,E_=`absolute left-0 top-0 h-full aspect-square flex items-center justify-center pointer-events-none`,D_=`absolute left-0 top-0 z-10 btn btn-control btn-neutral`;function O_(){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 k_(){let e=Wd(),t=A(null),n=A(void 0);return ef(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 A_({value:e,devices:t,disabled:n,onChange:r,label:i}){return P(E,{children:[P(`select`,{class:w_,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:T_,children:P(O_,{})})]})}function j_(e){return P(`div`,{class:C_,children:P(A_,{...e})})}function M_({iconName:e,...t}){return P(`div`,{class:C_,children:[P(`span`,{class:E_,"aria-hidden":`true`,children:P(bg,{name:e})}),P(A_,{...t})]})}var N_=U(({level:e=!1})=>{let{onToggleMicrophone:t,isMicReady:n,isMicMuted:r}=p_(),{microphones:i,currentMic:a,setMicrophone:o}=$d();if(!a||(i?.length??0)<=1)return P(I_,{level:e});let s=e&&n&&!r;return P(`div`,{class:`relative inline-flex items-center`,children:[P(j_,{value:a?.device?.deviceId,devices:i||[],disabled:!n,onChange:e=>o(e),label:`Select microphone`}),P(`button`,{type:`button`,onClick:t,disabled:!n,class:`${D_} overflow-hidden`,"aria-label":r?`Unmute microphone`:`Mute microphone`,"aria-pressed":r,children:[s&&P(k_,{}),P(`span`,{class:`relative z-10 inline-flex`,children:P(bg,{name:r||!n?`mic-off`:`mic`})})]})]})});function P_(){let{onToggleCamera:e,isCamMuted:t}=f_(),{camera:n,requestCamera:r}=um(),{open:i}=b_(),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 F_=U(()=>{let{isCamReady:e}=f_(),{currentCam:t,cameras:n,setCamera:r}=$d(),i=P_();return!t||(n?.length??0)<=1?P(L_,{}):P(`div`,{class:`relative inline-flex items-center`,children:[P(j_,{value:t?.device?.deviceId,devices:n||[],disabled:!e,onChange:e=>r(e),label:`Select camera`}),P(`button`,{type:`button`,onClick:i.onClick,class:D_,"aria-label":i.label,"aria-pressed":!i.isOn,children:P(bg,{name:i.isOn?`cam`:`cam-off`})})]})}),I_=U(({level:e=!1})=>{let{onToggleMicrophone:t,isMicMuted:n}=p_(),{mic:r,requestMic:i}=um(),{open:a}=b_(),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(k_,{}),P(`span`,{class:`relative z-10 inline-flex`,children:P(bg,{name:n||!r.isGranted?`mic-off`:`mic`})})]}),r.needsAttention&&P(S_,{})]})}),L_=U(()=>{let{isOn:e,onClick:t,label:n,needsAttention:r}=P_();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(bg,{name:e?`cam`:`cam-off`})}),r&&P(S_,{})]})});U(({compact:e=!1}={})=>{let{isMicReady:t}=p_(),{microphones:n,currentMic:r,setMicrophone:i}=$d();return(n?.length??0)<=1?null:P(M_,{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}=f_(),{currentCam:n,cameras:r,setCamera:i}=$d();return(r?.length??0)<=1?null:P(M_,{iconName:`cam`,value:n?.device?.deviceId,devices:r,disabled:!t,onChange:e=>i(e),label:`Select camera`,compact:e})});var R_=U((e={})=>{let{onToggleScreenshare:t,isScreenSharing:n}=m_();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(bg,{name:`screen-share`})})});function z_(e){let t=N(Ep);if(!t)throw Error(`useConversation must be used within ConversationProvider`);return k(()=>{if(e)return t.__registerSubscriber(e),()=>t.__unregisterSubscriber(e)},[e]),t}var B_=we(null);function V_({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(B_.Provider,{value:a,children:e})}function H_(){let e=N(B_);if(!e)throw Error(`ClosedCaptions components must be used within <ClosedCaptionsProvider>`);return e}var U_=U(()=>{let{isEnabled:e,toggle:t}=H_();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(bg,{name:`captions`,"aria-label":e?`Closed Captions On`:`Closed Captions Off`})})}),W_=U(()=>{let{isEnabled:e}=H_(),{captionText:t,captionRole:n}=z_(),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]})})})}),G_=we(null);function K_({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(G_.Provider,{value:o,children:e})}function q_(){let e=N(G_);if(!e)throw Error(`Chat components must be used within <ChatProvider>`);return e}var J_=U((e={})=>{let{isOpen:t,toggle:n}=q_();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(bg,{name:`chat`})})}),Y_=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})]})}),X_=U(({docked:e=!1,headerAction:t}={})=>{let{isOpen:n,close:r}=q_(),{chatMessages:i,sendChat:a,session:o}=z_(),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(bg,{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(Y_,{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(bg,{name:`send`,size:18})})]})]})});function Z_({label:e}){return P(r_,{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 Q_=U(()=>P(Z_,{label:`Connecting…`})),$_=U(()=>P(Z_,{label:`Leaving…`}));function ev({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(bg,{name:e?`fullscreen-exit`:`fullscreen`,size:`calc(var(--size-field, 0.25rem) * 3.5)`})})]})}var tv=U(({id:e})=>{let t=Gd()===e,n=A(null),r=A(null),i=A(null),a=A(void 0);ef(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%`}})]})})}),nv=[0,1,2],rv=.05,iv=450;function av({sessionId:e,className:t=``}){let{config:n}=Xp(),r=Tg(n.value),i=wg(n.value),a=A(null),o=A(void 0),s=A(void 0),[c,l]=O(!1),u=A(!1);return ef(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>rv?(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)},iv))}))},[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:[nv.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(Ag,{variant:r.background,replica:i})})]})}function ov({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 sv=e=>!!e.user_id?.includes(`tavus-replica`);function cv(){return Jd({filter:sv})}function lv(e){let t=cv()[0],n=Xd(t??``),r=Ud(),[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 uv=U(({isAudioOnly:e})=>{let t=lv(e);return t.phase===`left`?P($_,{}):t.phase===`connecting`?P(Q_,{}):e?P(ov,{class:`flex items-center justify-center`,children:[P(av,{sessionId:t.replicaId}),P(Mf,{sessionId:t.replicaId})]}):P(`div`,{class:`relative w-full h-full`,children:[P(jf,{automirror:!0,sessionId:t.replicaId,type:`video`,fit:`cover`,className:`absolute inset-0 w-full h-full object-cover ${t.videoState.isOff?`hidden`:``}`}),P(Mf,{sessionId:t.replicaId})]})}),dv=U(({onLeave:e})=>{let{config:t}=Xp(),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(uv,{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(I_,{}),!n&&P(L_,{}),P(`button`,{type:`button`,class:`btn btn-control btn-error`,onClick:e,"aria-label":`Leave call`,children:P(bg,{name:`leave`,"aria-label":`Leave Call`})})]})]})})});function fv(e,t){return e<=0||t<=0?!1:e/t<.75}var pv=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&&fv(s,l),h=n||m;return P(E,{children:[m&&P(jf,{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(jf,{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`:``}`})]})}),mv=new Set([`mcp-ui.tavus.io`,`mcp-ui.tavus-preview.io`]),hv=[`.sandbox-tavus.io`],gv=new Set([`tavusapi.com`]);function _v(e){let t;try{t=new URL(e)}catch{return!1}return xv(t)?!0:t.protocol===`https:`?mv.has(t.hostname)?!0:hv.some(e=>t.hostname.endsWith(e)):!1}function vv(e){return _v(e)}function yv(e){try{return xv(new URL(e))}catch{return!1}}function bv(e){let t;try{t=new URL(e)}catch{return!1}return Sv(t)?!0:t.protocol===`https:`&&gv.has(t.hostname)}function xv(e){return Sv(e)}function Sv(e){return!Cv()||e.protocol!==`http:`&&e.protocol!==`https:`?!1:[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e.hostname)}function Cv(){try{let e=globalThis.location?.hostname;return typeof e==`string`&&[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e)}catch{return!1}}function wv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Tv=new Set([`canvas.question`,`canvas.input`,`canvas.calendar`,`canvas.scheduling_embed`]);[...new Set([`direct_user`,`autonomous`,`system`])];var Ev=new Set([`clear`,`replacement`]);function Dv(e,t,n){return t===`submit`&&n===`direct_user`&&Tv.has(e)}function Ov(e,t,n,r){if(r!==void 0&&(!r||n===void 0||!Dv(e,t,n)))throw Error(`Canvas response text is allowed only for a supported direct-user submit.`)}function kv(e,t){if(t===`system`||Ev.has(e))throw Error(`Canvas producer interactions cannot mint host-only system actions.`)}async function Av(e){try{await e.teardownResource({},{timeout:1e3})}catch{}try{await e.close?.()}catch{}}var jv=`tavus.canvas.interaction`,Mv=[`safe-area-right`,`safe-area-left`,`safe-area-bottom`,`full`],Nv=`safe-area-right`,Pv={x:275/1280,y:111/720,width:730/1280,height:609/720},Fv={type:`snapshot_mirror`};function Iv(e){return oy(e)?e.message_type===`conversation`&&e.event_type===`conversation.tool_call`&&typeof e.conversation_id==`string`&&oy(e.properties):!1}function Lv(e){if(!oy(e))return null;let t=by(e,`component`),n=by(e,`component_version`),r=by(e,`sandbox_url`),i=Cy(e,`mcp_server_url`,vv),a=Cy(e,`api_base_url`,bv),o=Cy(e,`interaction_url`,bv),s=uy(e.layout),c=Ty(e),l=e.version;return l!==1||!t||!n||!r||!_v(r)||!zv(r,t,n)||i===null||a===null||o===null||s===null||c===null?null:{version:l,component:t,component_version:n,resource_uri:by(e,`resource_uri`),sandbox_url:r,mcp_server_url:i,mcp_tool_name:by(e,`mcp_tool_name`),api_base_url:a,interaction_url:o,...c,layout:s,host_context:oy(e.host_context)?e.host_context:void 0}}var Rv=/^\/canvas\/([^/]+)\/([^/]+)(?:\/|$)/;function zv(e,t,n){let r;try{r=new URL(e)}catch{return!1}let i=Rv.exec(r.pathname);return i?t===`canvas.${i[1]}`&&n===i[2]:yv(e)}function Bv(e){if(e===void 0)return{ok:!0,value:{}};if(oy(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 oy(t)?{ok:!0,value:t}:{ok:!1,error:Error(`Magic Canvas tool arguments must decode to an object.`)}}catch(e){return{ok:!1,error:sy(e)}}}function Vv(e){let t=e.properties.name;if(t!==`canvas_clear`&&t!==`update_component`)return null;let n=Bv(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(!oy(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 Hv=[`safe-area-left`,`safe-area-right`];function Uv(e){let t=Hv.includes(e.preferred_slot)?e.preferred_slot:Nv;return t===e.preferred_slot&&e.display_mode===`inline`?e:{...e,preferred_slot:t,display_mode:`inline`}}function Wv(e){return e.display_mode===`fullscreen`?`full`:e.preferred_slot}function Gv(e,t){return[t]}function Kv(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 Gv(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=ny(t.updates),i,a=e.map(e=>{if(!n(e))return e;let t={...e,arguments:{...e.arguments,...r.componentArguments},layout:Uv({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&&Wv(o.layout)===Wv(i.layout)?a:Gv(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 qv(e){if(!oy(e)||!Array.isArray(e.content))return null;for(let t of e.content){if(!oy(t))continue;let e=(oy(t._meta)?t._meta:null)?.[jv];if(oy(e))return wy(e)}return null}function Jv(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 kv(n,t.initiation_source),Ov(e.canvas_config.component,n,t.initiation_source,t.response_text),{interaction_id:t.interaction_id??ay(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:oy(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 Yv(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 Xv(e,t){if(!oy(e)||!Array.isArray(e.content))return``;let n=e.content.map(e=>oy(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?(Ov(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 Zv(e,t){let n=oy(t.structuredContent)?t.structuredContent:void 0,r=cy(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: ${ly(n)}`),r&&r!==a&&o.push(r),o.join(`
|
|
56
56
|
`)}function Qv({conversationId:e,toolCallId:t,args:n,canvasConfig:r}){let i=ny(n);return{id:t,conversation_id:e,tool_call_id:t,arguments:i.componentArguments,canvas_config:r,layout:Uv({preferred_slot:i.preferredSlot??r.layout?.preferred_slot??ry(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??Pv,backdrop:i.backdrop??r.layout?.backdrop??Fv}),revision:0}}function $v(e,t){let n=e.layout.display_mode;return{...e.layout,display_mode:n,viable_slot:n===`fullscreen`?`full`:ty(e.layout.preferred_slot,t)}}function ey(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:Fv};let a=[...n].reverse()[0];if(!a||t.width<900)return{active:!1,video_shift_x:0,backdrop:Fv};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`?Sy(16+o+24-c,0,u):-Sy(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 ty(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 ny(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:dy(e.layout)??dy(e.preferred_slot)??dy(e.preferredSlot),displayMode:fy(e),avoidSafeArea:py(e),safeArea:my(e),backdrop:hy(e)}}function ry(e){switch(e){case`canvas.alert`:return`safe-area-bottom`;case`canvas.chart`:case`canvas.image`:case`canvas.video`:return`full`;default:return Nv}}function iy(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 ay(e,t){return`ci_${e.replace(/[^a-zA-Z0-9_-]/g,`_`)}_${t}_${globalThis.crypto?.randomUUID?.()??Math.random().toString(36).slice(2,10)}`}var oy=wv;function sy(e){return e instanceof Error?e:Error(String(e))}function cy(e){return Array.isArray(e)?e.map(e=>oy(e)&&e.type===`text`&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
|
|
57
|
-
`).trim():``}function ly(e){let t=JSON.stringify(e);return t?t.length<=2e3?t:`${t.slice(0,2e3)}...`:`{}`}function uy(e){if(e===void 0)return;if(!oy(e))return null;let t=dy(e),n=gy(e.safe_area??e.safeArea),r=_y(e.backdrop);return n===null||r===null?null:{...t?{preferred_slot:t}:{},...vy(e.avoid_safe_area??e.avoidSafeArea,`avoid_safe_area`),...n?{safe_area:n}:{},...r?{backdrop:r}:{}}}function dy(e){if(typeof e==`string`&&yy(e))return e;if(!oy(e))return;let t=e.preferred_slot??e.preferredSlot??e.slot;return typeof t==`string`&&yy(t)?t:void 0}function fy(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 py(e){let t=oy(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 my(e){let t=oy(e.layout)?e.layout:void 0;return gy(e.safe_area??e.safeArea??t?.safe_area??t?.safeArea)??void 0}function hy(e){let t=oy(e.layout)?e.layout:void 0;return _y(e.backdrop??t?.backdrop)??void 0}function gy(e){if(e===void 0)return;if(!oy(e))return null;let t=xy(e,`x`),n=xy(e,`y`),r=xy(e,`width`),i=xy(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:Sy(t,0,1),y:Sy(n,0,1),width:Sy(r,0,1),height:Sy(i,0,1)}}function _y(e){if(e===void 0)return;if(e===`snapshot_mirror`||e===`none`)return{type:e};if(!oy(e))return null;let t=e.type;return t===`snapshot_mirror`||t===`none`?{type:t}:null}function vy(e,t){return typeof e==`boolean`?{[t]:e}:{}}function yy(e){return Mv.includes(e)}function by(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function xy(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function Sy(e,t,n){return Math.min(Math.max(e,t),n)}function Cy(e,t,n){let r=by(e,t);if(r)return n(r)?r:null}function wy(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&&!oy(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 Ty(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=by(e,`issued_card_capability`);return i?{protocol_mode:`v1`,protocol_version:1,issued_card_capability:i}:null}var Ey=`tavus-deployment magic-canvas/0.0.0`;function Dy(e){if(!Iv(e)||e.canvas_config===void 0||e.canvas_config===null)return null;let t=Lv(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=Bv(e.properties.arguments);if(!r.ok)throw r.error;return Qv({conversationId:e.conversation_id,toolCallId:n,args:r.value,canvasConfig:t})}function Oy(e){if(!Iv(e))return null;if(e.canvas_config!==void 0&&e.canvas_config!==null){let t=Dy(e);return t?{kind:`show`,instance:t}:null}return Vv(e)}function ky(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 Ay(e,t){return{theme:e.theme,displayMode:t?.display_mode??`inline`,availableDisplayModes:[`inline`,`fullscreen`],...t?{containerDimensions:iy(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:Ey,styles:{variables:jy(e.cssVars)}}}function jy(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`,...My(e)}}function My(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 Ny=96;function Py(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 Fy(e){let t=e?.getRootNode();return t instanceof ShadowRoot?t:document}function Iy(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 Ly(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??Pv,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 Ry(e,t,n){let[r,i]=O(()=>e?Py(Fy(n?.current)):null);return $e(()=>{if(!e){i(null);return}let t=Fy(n?.current),r=()=>i(Py(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 zy(e,t,n){let[r,i]=O(()=>t?Iy(e.current):null);return $e(()=>{if(!t){i(null);return}let n=()=>i(Iy(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 By(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`&&Ly(e,r,i,a)),side:o}}function Vy(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>=Ny&&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(Ny,Math.min(h,c-48));return{centerX:(u+d)/2-r,centerY:(f+p)/2-a,diameter:g}}var Hy=`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 Uy(e,t){let n=Math.abs(t)/2;return e===`left`?`${n}px center`:`calc(100% - ${n}px) center`}function Wy(e,t,n){let[r,i]=O(()=>e&&t?Vy(t,Fy(n?.current),Iy(n?.current)):null);return $e(()=>{if(!e||!t){i(null);return}let r=Fy(n?.current),a=()=>i(Vy(t,r,Iy(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 Gy(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 Ky=1;function qy(e,t,n){return Math.min(Math.max(e,t),n)}function Jy(e,t,n,r){let i=Math.min(e.diameter/t.height,1),a=r?.safe_area??Pv,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:qy(e.centerX-o,e.centerX+c-t.width*i,e.centerX-c),ty:qy(e.centerY-s,e.centerY+c-t.height*i,e.centerY-c)}}var Yy=[`cx`,`cy`,`r`,`tx`,`ty`,`s`,`shift`];function Xy(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=Jy(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 Zy(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||Qy()){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 Yy){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?Yy.map(t=>Math.round(e[t]*100)).join():``,t]),k(()=>()=>{o.current&&globalThis.cancelAnimationFrame(o.current)},[])}function Qy(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function $y({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 eb(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:Uy(i,e?t:r.current.shift),translateX:e?0:-r.current.shift}}function tb(e,t,n){return`${e.side??``}:${e.active}:${t}:${n??``}`}function nb({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 rb({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(nb,{snapshotUrl:e,transformOrigin:r})})}function ib({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 ab({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% - ${Ky}px)`}:{right:`calc(100% - ${Ky}px)`},children:P(nb,{snapshotUrl:t,transformOrigin:`center`})})]})})}function ob({canvasLayoutEffect:e,smartSidecarActive:t,isScreenSharing:n,fill:r,captureSnapshot:i,transition:a=Hy,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),_=tb(e,h,c),{usePip:v,side:y}=By(e,s,c,Ry(s!==`shift`,_,g),h,zy(g,s!==`shift`,_)),b=Wy(s!==`shift`,y,g),x=eb(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=Gy(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 Zy(C?Xy(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(rb,{snapshotUrl:f,translateX:x.translateX,transition:a,transformOrigin:x.transformOrigin}),E&&P(ib,{ambient:l,usePip:v,transition:a}),P(`div`,{"data-morph":`fg`,class:`absolute inset-0 z-10`,children:P(ab,{morphCapable:C,snapshotUrl:f,mirrorSide:x.side,videoShiftX:h,transition:a,sceneRef:ee,videoWrapRef:te,fill:r,videoRef:d})}),C&&b&&P($y,{geom:b,visible:S&&ne}),u]})}var sb=480,cb=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?`${sb}px`:`0px`,right:o<0?`${sb}px`:`0px`,transition:`left ${Hy}, right ${Hy}`},children:[P(jf,{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(av,{sessionId:e})}):P(jf,{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 lb(e){return e&&Object.assign(pb,e),pb}var ub,db,fb,pb,mb=t((()=>{db=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},fb=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},(ub=globalThis).__zod_globalConfig??(ub.__zod_globalConfig={}),pb=globalThis.__zod_globalConfig}));function hb(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 gb(e,t){return typeof t==`bigint`?t.toString():t}function _b(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function vb(e){return e==null}function yb(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function bb(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 xb(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Kb)return r===void 0&&(r=Kb,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Sb(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Cb(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function wb(e){return JSON.stringify(e)}function Tb(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}function Eb(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Db(e){if(Eb(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Eb(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Ob(e){return Db(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function kb(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ab(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 jb(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function Mb(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 Ab(e,Cb(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 Sb(this,`shape`,e),e},checks:[]}))}function Nb(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 Ab(e,Cb(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 Sb(this,`shape`,r),r},checks:[]}))}function Pb(e,t){if(!Db(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 Ab(e,Cb(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Sb(this,`shape`,n),n}}))}function Fb(e,t){if(!Db(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ab(e,Cb(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Sb(this,`shape`,n),n}}))}function Ib(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Ab(e,Cb(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Sb(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Lb(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 Ab(t,Cb(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 Sb(this,`shape`,i),i},checks:[]}))}function Rb(e,t,n){return Ab(t,Cb(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 Sb(this,`shape`,i),i}}))}function zb(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 Bb(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 Vb(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Hb(e){return typeof e==`string`?e:e?.message}function Ub(e,t,n){let r=e.message?e.message:Hb(e.inst?._zod.def?.error?.(e))??Hb(t?.error?.(e))??Hb(n.customError?.(e))??Hb(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 Wb(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Gb(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Kb,qb,Jb,Yb,Xb,Zb=t((()=>{mb(),Kb=Symbol(`evaluating`),qb=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{},Jb=_b(()=>{if(pb.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),Yb=new Set([`string`,`number`,`symbol`]),Xb={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}}));function Qb(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 $b(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 ex,tx,nx,rx=t((()=>{mb(),Zb(),ex=(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,gb,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tx=W(`$ZodError`,ex),nx=W(`$ZodError`,ex,{Parent:Error})})),ix,ax,ox,sx,cx,lx,ux,dx,fx,px,mx,hx,gx,_x,vx=t((()=>{mb(),rx(),Zb(),ix=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 db;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ub(e,a,lb())));throw qb(t,i?.callee),t}return o.value},ax=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=>Ub(e,a,lb())));throw qb(t,i?.callee),t}return o.value},ox=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 db;return a.issues.length?{success:!1,error:new(e??tx)(a.issues.map(e=>Ub(e,i,lb())))}:{success:!0,data:a.value}},sx=ox(nx),cx=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=>Ub(e,i,lb())))}:{success:!0,data:a.value}},lx=cx(nx),ux=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ix(e)(t,n,i)},dx=e=>(t,n,r)=>ix(e)(t,n,r),fx=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ax(e)(t,n,i)},px=e=>async(t,n,r)=>ax(e)(t,n,r),mx=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ox(e)(t,n,i)},hx=e=>(t,n,r)=>ox(e)(t,n,r),gx=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return cx(e)(t,n,i)},_x=e=>async(t,n,r)=>cx(e)(t,n,r)}));function yx(){return new RegExp(Nx,`u`)}function bx(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 xx(e){return RegExp(`^${bx(e)}$`)}function Sx(e){let t=bx({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(`^${Hx}T(?:${r})$`)}var Cx,wx,Tx,Ex,Dx,Ox,kx,Ax,jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx,Zx,Qx=t((()=>{Cx=/^[cC][0-9a-z]{6,}$/,wx=/^[0-9a-z]+$/,Tx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ex=/^[0-9a-vA-V]{20}$/,Dx=/^[A-Za-z0-9]{27}$/,Ox=/^[a-zA-Z0-9_-]{21}$/,kx=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ax=/^([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})$/,jx=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)$/,Mx=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Nx=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Px=/^(?:(?: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])$/,Fx=/^(([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}|:))$/,Ix=/^((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])$/,Lx=/^(([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])$/,Rx=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zx=/^[A-Za-z0-9_-]*$/,Bx=/^https?$/,Vx=/^\+[1-9]\d{6,14}$/,Hx=`(?:(?:\\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])))`,Ux=RegExp(`^${Hx}$`),Wx=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Gx=/^-?\d+$/,Kx=/^-?\d+(?:\.\d+)?$/,qx=/^(?:true|false)$/i,Jx=/^null$/i,Yx=/^undefined$/i,Xx=/^[^A-Z]*$/,Zx=/^[^a-z]*$/})),$x,eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS=t((()=>{mb(),Qx(),Zb(),$x=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),eS={number:`number`,bigint:`bigint`,object:`date`},tS=W(`$ZodCheckLessThan`,(e,t)=>{$x.init(e,t);let n=eS[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})}}),nS=W(`$ZodCheckGreaterThan`,(e,t)=>{$x.init(e,t);let n=eS[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})}}),rS=W(`$ZodCheckMultipleOf`,(e,t)=>{$x.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):bb(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})}}),iS=W(`$ZodCheckNumberFormat`,(e,t)=>{$x.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Xb[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=Gx)}),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})}}),aS=W(`$ZodCheckMaxLength`,(e,t)=>{var n;$x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!vb(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=Wb(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),oS=W(`$ZodCheckMinLength`,(e,t)=>{var n;$x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!vb(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=Wb(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),sS=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;$x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!vb(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=Wb(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})}}),cS=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;$x.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=()=>{})}),lS=W(`$ZodCheckRegex`,(e,t)=>{cS.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})}}),uS=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Xx,cS.init(e,t)}),dS=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Zx,cS.init(e,t)}),fS=W(`$ZodCheckIncludes`,(e,t)=>{$x.init(e,t);let n=kb(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})}}),pS=W(`$ZodCheckStartsWith`,(e,t)=>{$x.init(e,t);let n=RegExp(`^${kb(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})}}),mS=W(`$ZodCheckEndsWith`,(e,t)=>{$x.init(e,t);let n=RegExp(`.*${kb(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})}}),hS=W(`$ZodCheckOverwrite`,(e,t)=>{$x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),_S,vS=t((()=>{_S=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 ly(e){let t=JSON.stringify(e);return t?t.length<=2e3?t:`${t.slice(0,2e3)}...`:`{}`}function uy(e){if(e===void 0)return;if(!oy(e))return null;let t=dy(e),n=gy(e.safe_area??e.safeArea),r=_y(e.backdrop);return n===null||r===null?null:{...t?{preferred_slot:t}:{},...vy(e.avoid_safe_area??e.avoidSafeArea,`avoid_safe_area`),...n?{safe_area:n}:{},...r?{backdrop:r}:{}}}function dy(e){if(typeof e==`string`&&yy(e))return e;if(!oy(e))return;let t=e.preferred_slot??e.preferredSlot??e.slot;return typeof t==`string`&&yy(t)?t:void 0}function fy(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 py(e){let t=oy(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 my(e){let t=oy(e.layout)?e.layout:void 0;return gy(e.safe_area??e.safeArea??t?.safe_area??t?.safeArea)??void 0}function hy(e){let t=oy(e.layout)?e.layout:void 0;return _y(e.backdrop??t?.backdrop)??void 0}function gy(e){if(e===void 0)return;if(!oy(e))return null;let t=xy(e,`x`),n=xy(e,`y`),r=xy(e,`width`),i=xy(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:Sy(t,0,1),y:Sy(n,0,1),width:Sy(r,0,1),height:Sy(i,0,1)}}function _y(e){if(e===void 0)return;if(e===`snapshot_mirror`||e===`none`)return{type:e};if(!oy(e))return null;let t=e.type;return t===`snapshot_mirror`||t===`none`?{type:t}:null}function vy(e,t){return typeof e==`boolean`?{[t]:e}:{}}function yy(e){return Mv.includes(e)}function by(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function xy(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function Sy(e,t,n){return Math.min(Math.max(e,t),n)}function Cy(e,t,n){let r=by(e,t);if(r)return n(r)?r:null}function wy(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&&!oy(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 Ty(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=by(e,`issued_card_capability`);return i?{protocol_mode:`v1`,protocol_version:1,issued_card_capability:i}:null}var Ey=`tavus-deployment magic-canvas/0.0.0`;function Dy(e){if(!Iv(e)||e.canvas_config===void 0||e.canvas_config===null)return null;let t=Lv(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=Bv(e.properties.arguments);if(!r.ok)throw r.error;return Qv({conversationId:e.conversation_id,toolCallId:n,args:r.value,canvasConfig:t})}function Oy(e){if(!Iv(e))return null;if(e.canvas_config!==void 0&&e.canvas_config!==null){let t=Dy(e);return t?{kind:`show`,instance:t}:null}return Vv(e)}function ky(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 Ay(e,t){return{theme:e.theme,displayMode:t?.display_mode??`inline`,availableDisplayModes:[`inline`,`fullscreen`],...t?{containerDimensions:iy(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:Ey,styles:{variables:jy(e.cssVars)}}}function jy(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`,...My(e)}}function My(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 Ny=96;function Py(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 Fy(e){let t=e?.getRootNode();return t instanceof ShadowRoot?t:document}function Iy(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 Ly(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??Pv,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 Ry(e,t,n){let[r,i]=O(()=>e?Py(Fy(n?.current)):null);return $e(()=>{if(!e){i(null);return}let t=Fy(n?.current),r=()=>i(Py(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 zy(e,t,n){let[r,i]=O(()=>t?Iy(e.current):null);return $e(()=>{if(!t){i(null);return}let n=()=>i(Iy(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 By(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`&&Ly(e,r,i,a)),side:o}}function Vy(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>=Ny&&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(Ny,Math.min(h,c-48));return{centerX:(u+d)/2-r,centerY:(f+p)/2-a,diameter:g}}var Hy=`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 Uy(e,t){let n=Math.abs(t)/2;return e===`left`?`${n}px center`:`calc(100% - ${n}px) center`}function Wy(e,t,n){let[r,i]=O(()=>e&&t?Vy(t,Fy(n?.current),Iy(n?.current)):null);return $e(()=>{if(!e||!t){i(null);return}let r=Fy(n?.current),a=()=>i(Vy(t,r,Iy(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 Gy(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 Ky=1;function qy(e,t,n){return Math.min(Math.max(e,t),n)}function Jy(e,t,n,r){let i=Math.min(e.diameter/t.height,1),a=r?.safe_area??Pv,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:qy(e.centerX-o,e.centerX+c-t.width*i,e.centerX-c),ty:qy(e.centerY-s,e.centerY+c-t.height*i,e.centerY-c)}}var Yy=[`cx`,`cy`,`r`,`tx`,`ty`,`s`,`shift`];function Xy(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=Jy(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 Zy(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||Qy()){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 Yy){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?Yy.map(t=>Math.round(e[t]*100)).join():``,t]),k(()=>()=>{o.current&&globalThis.cancelAnimationFrame(o.current)},[])}function Qy(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function $y({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 eb(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:Uy(i,e?t:r.current.shift),translateX:e?0:-r.current.shift}}function tb(e,t,n){return`${e.side??``}:${e.active}:${t}:${n??``}`}function nb({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 rb({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(nb,{snapshotUrl:e,transformOrigin:r})})}function ib({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 ab({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% - ${Ky}px)`}:{right:`calc(100% - ${Ky}px)`},children:P(nb,{snapshotUrl:t,transformOrigin:`center`})})]})})}function ob({canvasLayoutEffect:e,smartSidecarActive:t,isScreenSharing:n,fill:r,captureSnapshot:i,transition:a=Hy,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),_=tb(e,h,c),{usePip:v,side:y}=By(e,s,c,Ry(s!==`shift`,_,g),h,zy(g,s!==`shift`,_)),b=Wy(s!==`shift`,y,g),x=eb(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=Gy(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 Zy(C?Xy(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(rb,{snapshotUrl:f,translateX:x.translateX,transition:a,transformOrigin:x.transformOrigin}),E&&P(ib,{ambient:l,usePip:v,transition:a}),P(`div`,{"data-morph":`fg`,class:`absolute inset-0 z-10`,children:P(ab,{morphCapable:C,snapshotUrl:f,mirrorSide:x.side,videoShiftX:h,transition:a,sceneRef:ee,videoWrapRef:te,fill:r,videoRef:d})}),C&&b&&P($y,{geom:b,visible:S&&ne}),u]})}var sb=480,cb=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?`${sb}px`:`0px`,right:o<0?`${sb}px`:`0px`,transition:`left ${Hy}, right ${Hy}`},children:[P(jf,{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(av,{sessionId:e})}):P(jf,{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 lb(e){return e&&Object.assign(pb,e),pb}var ub,db,fb,pb,mb=t((()=>{db=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},fb=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},(ub=globalThis).__zod_globalConfig??(ub.__zod_globalConfig={}),pb=globalThis.__zod_globalConfig}));function hb(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 gb(e,t){return typeof t==`bigint`?t.toString():t}function _b(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function vb(e){return e==null}function yb(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function bb(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 xb(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Kb)return r===void 0&&(r=Kb,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Sb(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Cb(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function wb(e){return JSON.stringify(e)}function Tb(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}function Eb(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Db(e){if(Eb(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Eb(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Ob(e){return Db(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function kb(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ab(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 jb(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function Mb(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 Ab(e,Cb(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 Sb(this,`shape`,e),e},checks:[]}))}function Nb(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 Ab(e,Cb(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 Sb(this,`shape`,r),r},checks:[]}))}function Pb(e,t){if(!Db(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 Ab(e,Cb(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Sb(this,`shape`,n),n}}))}function Fb(e,t){if(!Db(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ab(e,Cb(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Sb(this,`shape`,n),n}}))}function Ib(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Ab(e,Cb(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Sb(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Lb(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 Ab(t,Cb(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 Sb(this,`shape`,i),i},checks:[]}))}function Rb(e,t,n){return Ab(t,Cb(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 Sb(this,`shape`,i),i}}))}function zb(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 Bb(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 Vb(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Hb(e){return typeof e==`string`?e:e?.message}function Ub(e,t,n){let r=e.message?e.message:Hb(e.inst?._zod.def?.error?.(e))??Hb(t?.error?.(e))??Hb(n.customError?.(e))??Hb(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 Wb(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Gb(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Kb,qb,Jb,Yb,Xb,Zb=t((()=>{mb(),Kb=Symbol(`evaluating`),qb=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{},Jb=_b(()=>{if(pb.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),Yb=new Set([`string`,`number`,`symbol`]),Xb={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}}));function Qb(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 $b(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 ex,tx,nx,rx=t((()=>{mb(),Zb(),ex=(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,gb,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tx=W(`$ZodError`,ex),nx=W(`$ZodError`,ex,{Parent:Error})})),ix,ax,ox,sx,cx,lx,ux,dx,fx,px,mx,hx,gx,_x,vx=t((()=>{mb(),rx(),Zb(),ix=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 db;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ub(e,a,lb())));throw qb(t,i?.callee),t}return o.value},ax=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=>Ub(e,a,lb())));throw qb(t,i?.callee),t}return o.value},ox=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 db;return a.issues.length?{success:!1,error:new(e??tx)(a.issues.map(e=>Ub(e,i,lb())))}:{success:!0,data:a.value}},sx=ox(nx),cx=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=>Ub(e,i,lb())))}:{success:!0,data:a.value}},lx=cx(nx),ux=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ix(e)(t,n,i)},dx=e=>(t,n,r)=>ix(e)(t,n,r),fx=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ax(e)(t,n,i)},px=e=>async(t,n,r)=>ax(e)(t,n,r),mx=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ox(e)(t,n,i)},hx=e=>(t,n,r)=>ox(e)(t,n,r),gx=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return cx(e)(t,n,i)},_x=e=>async(t,n,r)=>cx(e)(t,n,r)}));function yx(){return new RegExp(Nx,`u`)}function bx(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 xx(e){return RegExp(`^${bx(e)}$`)}function Sx(e){let t=bx({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(`^${Hx}T(?:${r})$`)}var Cx,wx,Tx,Ex,Dx,Ox,kx,Ax,jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx,Zx,Qx=t((()=>{Cx=/^[cC][0-9a-z]{6,}$/,wx=/^[0-9a-z]+$/,Tx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ex=/^[0-9a-vA-V]{20}$/,Dx=/^[A-Za-z0-9]{27}$/,Ox=/^[a-zA-Z0-9_-]{21}$/,kx=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ax=/^([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})$/,jx=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)$/,Mx=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Nx=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Px=/^(?:(?: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])$/,Fx=/^(([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}|:))$/,Ix=/^((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])$/,Lx=/^(([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])$/,Rx=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zx=/^[A-Za-z0-9_-]*$/,Bx=/^https?$/,Vx=/^\+[1-9]\d{6,14}$/,Hx=`(?:(?:\\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])))`,Ux=RegExp(`^${Hx}$`),Wx=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Gx=/^-?\d+$/,Kx=/^-?\d+(?:\.\d+)?$/,qx=/^(?:true|false)$/i,Jx=/^null$/i,Yx=/^undefined$/i,Xx=/^[^A-Z]*$/,Zx=/^[^a-z]*$/})),$x,eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS=t((()=>{mb(),Qx(),Zb(),$x=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),eS={number:`number`,bigint:`bigint`,object:`date`},tS=W(`$ZodCheckLessThan`,(e,t)=>{$x.init(e,t);let n=eS[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})}}),nS=W(`$ZodCheckGreaterThan`,(e,t)=>{$x.init(e,t);let n=eS[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})}}),rS=W(`$ZodCheckMultipleOf`,(e,t)=>{$x.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):bb(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})}}),iS=W(`$ZodCheckNumberFormat`,(e,t)=>{$x.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Xb[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=Gx)}),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})}}),aS=W(`$ZodCheckMaxLength`,(e,t)=>{var n;$x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!vb(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=Wb(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),oS=W(`$ZodCheckMinLength`,(e,t)=>{var n;$x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!vb(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=Wb(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),sS=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;$x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!vb(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=Wb(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})}}),cS=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;$x.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=()=>{})}),lS=W(`$ZodCheckRegex`,(e,t)=>{cS.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})}}),uS=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Xx,cS.init(e,t)}),dS=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Zx,cS.init(e,t)}),fS=W(`$ZodCheckIncludes`,(e,t)=>{$x.init(e,t);let n=kb(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})}}),pS=W(`$ZodCheckStartsWith`,(e,t)=>{$x.init(e,t);let n=RegExp(`^${kb(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})}}),mS=W(`$ZodCheckEndsWith`,(e,t)=>{$x.init(e,t);let n=RegExp(`.*${kb(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})}}),hS=W(`$ZodCheckOverwrite`,(e,t)=>{$x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),_S,vS=t((()=>{_S=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
|
`))}}})),yS,bS=t((()=>{yS={major:4,minor:4,patch:3}}));function xS(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}function SS(e){if(!zx.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return xS(t.padEnd(Math.ceil(t.length/4)*4,`=`))}function CS(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 wS(e,t,n){e.issues.length&&t.issues.push(...Vb(n,e.issues)),t.value[n]=e.value}function TS(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Vb(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 ES(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=jb(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function DS(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=>TS(e,n,i,t,u,d))):TS(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 OS(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=>!zb(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=>Ub(e,r,lb())))}),t)}function kS(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Db(e)&&Db(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=kS(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=kS(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 AS(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}),zb(e))return e;let o=kS(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}function jS(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}function MS(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function NS(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 PS(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 FS(e){return e.value=Object.freeze(e.value),e}function IS(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(Gb(e))}}var LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC,hC,gC,_C,vC,yC,bC,xC,SC,CC,wC,TC,EC,DC,OC,kC,AC,jC,MC,NC,PC,FC,IC,LC=t((()=>{gS(),mb(),vS(),vx(),Qx(),Zb(),bS(),LS=W(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yS;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=zb(e),i;for(let a of t){if(a._zod.def.when){if(Bb(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 db;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=zb(e,t))});else{if(e.issues.length===t)continue;r||=zb(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(zb(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new db;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 db;return o.then(e=>t(e,r,a))}return t(o,r,a)}}xb(e,`~standard`,()=>({validate:t=>{try{let n=sx(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return lx(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),RS=W(`$ZodString`,(e,t)=>{LS.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Wx(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}}),zS=W(`$ZodStringFormat`,(e,t)=>{cS.init(e,t),RS.init(e,t)}),BS=W(`$ZodGUID`,(e,t)=>{t.pattern??=Ax,zS.init(e,t)}),VS=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??=jx(e)}else t.pattern??=jx();zS.init(e,t)}),HS=W(`$ZodEmail`,(e,t)=>{t.pattern??=Mx,zS.init(e,t)}),US=W(`$ZodURL`,(e,t)=>{zS.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Bx.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})}}}),WS=W(`$ZodEmoji`,(e,t)=>{t.pattern??=yx(),zS.init(e,t)}),GS=W(`$ZodNanoID`,(e,t)=>{t.pattern??=Ox,zS.init(e,t)}),KS=W(`$ZodCUID`,(e,t)=>{t.pattern??=Cx,zS.init(e,t)}),qS=W(`$ZodCUID2`,(e,t)=>{t.pattern??=wx,zS.init(e,t)}),JS=W(`$ZodULID`,(e,t)=>{t.pattern??=Tx,zS.init(e,t)}),YS=W(`$ZodXID`,(e,t)=>{t.pattern??=Ex,zS.init(e,t)}),XS=W(`$ZodKSUID`,(e,t)=>{t.pattern??=Dx,zS.init(e,t)}),ZS=W(`$ZodISODateTime`,(e,t)=>{t.pattern??=Sx(t),zS.init(e,t)}),QS=W(`$ZodISODate`,(e,t)=>{t.pattern??=Ux,zS.init(e,t)}),$S=W(`$ZodISOTime`,(e,t)=>{t.pattern??=xx(t),zS.init(e,t)}),eC=W(`$ZodISODuration`,(e,t)=>{t.pattern??=kx,zS.init(e,t)}),tC=W(`$ZodIPv4`,(e,t)=>{t.pattern??=Px,zS.init(e,t),e._zod.bag.format=`ipv4`}),nC=W(`$ZodIPv6`,(e,t)=>{t.pattern??=Fx,zS.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})}}}),rC=W(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ix,zS.init(e,t)}),iC=W(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Lx,zS.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})}}}),aC=W(`$ZodBase64`,(e,t)=>{t.pattern??=Rx,zS.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{xS(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),oC=W(`$ZodBase64URL`,(e,t)=>{t.pattern??=zx,zS.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{SS(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),sC=W(`$ZodE164`,(e,t)=>{t.pattern??=Vx,zS.init(e,t)}),cC=W(`$ZodJWT`,(e,t)=>{zS.init(e,t),e._zod.check=n=>{CS(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),lC=W(`$ZodNumber`,(e,t)=>{LS.init(e,t),e._zod.pattern=e._zod.bag.pattern??Kx,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}}),uC=W(`$ZodNumberFormat`,(e,t)=>{iS.init(e,t),lC.init(e,t)}),dC=W(`$ZodBoolean`,(e,t)=>{LS.init(e,t),e._zod.pattern=qx,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}}),fC=W(`$ZodUndefined`,(e,t)=>{LS.init(e,t),e._zod.pattern=Yx,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}}),pC=W(`$ZodNull`,(e,t)=>{LS.init(e,t),e._zod.pattern=Jx,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}}),mC=W(`$ZodUnknown`,(e,t)=>{LS.init(e,t),e._zod.parse=e=>e}),hC=W(`$ZodNever`,(e,t)=>{LS.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),gC=W(`$ZodArray`,(e,t)=>{LS.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=>wS(t,n,e))):wS(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}}),_C=W(`$ZodObject`,(e,t)=>{if(LS.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=_b(()=>ES(t));xb(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=Eb,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=>TS(n,t,e,s,r,i))):TS(a,t,e,s,r,i)}return i?DS(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),vC=W(`$ZodObjectJIT`,(e,t)=>{_C.init(e,t);let n=e._zod.parse,r=_b(()=>ES(t)),i=e=>{let t=new _S([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=wb(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=wb(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
|
@@ -17672,10 +17672,10 @@ function Ay(e) {
|
|
|
17672
17672
|
};
|
|
17673
17673
|
}
|
|
17674
17674
|
function jy(e) {
|
|
17675
|
-
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 = {},
|
|
17676
|
-
t && (
|
|
17677
|
-
},
|
|
17678
|
-
return
|
|
17675
|
+
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) => {
|
|
17676
|
+
t && (s[e] = t);
|
|
17677
|
+
}, l = (e, t, n) => e && n ? `color-mix(in oklch, ${e} ${t}%, ${n})` : void 0;
|
|
17678
|
+
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;
|
|
17679
17679
|
}
|
|
17680
17680
|
//#endregion
|
|
17681
17681
|
//#region ../core/src/magic-canvas/persona-presentation.tsx
|