@mediquo/elements 0.3.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -1
- package/dist/chunks/api-chat-client-CqMn2JEn.js +1 -0
- package/dist/chunks/{apple-pay-outcomes-BlytM6W-.js → apple-pay-outcomes-CjCnBYOD.js} +1 -1
- package/dist/chunks/chunk-4FFT6DC2-CVWibomC.js +1 -0
- package/dist/chunks/chunk-GZF3YFSX-DM-GTqxg.js +1 -0
- package/dist/chunks/chunk-RCFIJTXZ-C6Ir0-sM.js +1 -0
- package/dist/chunks/chunk-S5RWG6G2-DPesx3Od.js +1 -0
- package/dist/chunks/chunk-YMQSBQHL-De_r7BNk.js +1 -0
- package/dist/chunks/chunk-YTQUGGS3-DmCGIoFy.js +1 -0
- package/dist/chunks/consume-CovVqBjI.js +1 -0
- package/dist/chunks/context-consumer-ESdICVAb.js +1 -0
- package/dist/chunks/context-provider--AKuwfs9.js +1 -0
- package/dist/chunks/create-component-BB-6Gu6l.js +1 -0
- package/dist/chunks/create-context-DqP79qjF.js +1 -0
- package/dist/chunks/documentation-view-fFbvjJqx.js +1 -0
- package/dist/chunks/external-CJj32K_p.js +1 -0
- package/dist/chunks/{format-Cm3B1GMy.js → format-CRFiCNHw.js} +1 -1
- package/dist/chunks/get-appointment-query-Ck68BEMg.js +1 -0
- package/dist/chunks/get-patient-profile-query-B0tUDJmT.js +1 -0
- package/dist/chunks/i18n-formats-DYS91YEa.js +1 -0
- package/dist/chunks/{index-B9iWdvW3.js → index-BJcdB5MT.js} +1 -1
- package/dist/chunks/index-CGnPsMVQ.js +1 -0
- package/dist/chunks/index-CLdWVaEs.js +1 -0
- package/dist/chunks/index-CvDnN2NR.js +1 -0
- package/dist/chunks/index-DNUbmrQl.d.ts +31 -0
- package/dist/chunks/index-Xcn-xs13.js +1 -0
- package/dist/chunks/index-czcKClL3.d.ts +47 -0
- package/dist/chunks/isBefore-CPpTogxo.js +1 -0
- package/dist/chunks/{isSameDay-DPfclwIL.js → isSameDay-CuhZMy1T.js} +1 -1
- package/dist/chunks/localized-decorator-BlOuLhym.js +1 -0
- package/dist/chunks/mq-layout-CGcdxGMQ.js +1 -0
- package/dist/chunks/mq-professional-presence-sync-cmg6CXhz.d.ts +22 -0
- package/dist/chunks/mq-unread-count-sync-DTn9dfR4.d.ts +22 -0
- package/dist/chunks/mutation-controller-CR2qcqhH.js +1 -0
- package/dist/chunks/parseISO-Dj3qSTG8.js +1 -0
- package/dist/chunks/price-BmA2Dl9f.js +1 -0
- package/dist/chunks/professional-overview-CfjgnTw4.js +1 -0
- package/dist/chunks/{provide-CfT7g_Zi.js → provide-D2fnEhT2.js} +1 -1
- package/dist/chunks/query-Cjvi4_dT.js +1 -0
- package/dist/chunks/query-controller-BlO1Ax65.js +1 -0
- package/dist/chunks/{refund-cancel-policy-Bm5djPds.js → refund-cancel-policy-D_tUYPyv.js} +1 -1
- package/dist/chunks/schemas.d-5LR6aN9I.d.ts +134 -0
- package/dist/chunks/telemetry-client-Ca71sobH.js +1 -0
- package/dist/env.js +1 -1
- package/dist/i18n.js +1 -1
- package/dist/mq-apple-pay-checkout.js +1 -1
- package/dist/mq-appointment-checkout.js +1 -1
- package/dist/mq-appointment-documentation.d.ts +48 -0
- package/dist/mq-appointment-documentation.js +1 -0
- package/dist/mq-chat-room.js +1 -1
- package/dist/mq-checkout.js +1 -1
- package/dist/mq-documents.d.ts +46 -0
- package/dist/mq-documents.js +1 -0
- package/dist/mq-google-pay-checkout.js +1 -1
- package/dist/mq-immediate-videocall-checkout.js +1 -1
- package/dist/mq-my-appointments.d.ts +48 -178
- package/dist/mq-my-appointments.js +1 -1
- package/dist/mq-professional-presence-sync.d.ts +30 -0
- package/dist/mq-professional-presence-sync.js +1 -0
- package/dist/mq-query-client-provider.js +1 -1
- package/dist/mq-schedule-success.d.ts +9 -0
- package/dist/mq-schedule-success.js +2 -2
- package/dist/mq-schedule.d.ts +24 -12
- package/dist/mq-schedule.js +1 -1
- package/dist/mq-session-provider.d.ts +28 -0
- package/dist/mq-session-provider.js +1 -0
- package/dist/mq-socket-provider.js +1 -1
- package/dist/mq-support-chat.js +1 -1
- package/dist/mq-terms-and-conditions.d.ts +23 -0
- package/dist/mq-terms-and-conditions.js +1 -0
- package/dist/mq-unread-count-sync.d.ts +21 -0
- package/dist/mq-unread-count-sync.js +1 -0
- package/dist/mq-videocall.d.ts +35 -26
- package/dist/mq-videocall.js +1 -1
- package/dist/react/mq-apple-pay-checkout.d.ts +15 -0
- package/dist/react/mq-apple-pay-checkout.js +2 -0
- package/dist/react/mq-appointment-checkout.d.ts +17 -0
- package/dist/react/mq-appointment-checkout.js +2 -0
- package/dist/react/mq-appointment-documentation.d.ts +28 -0
- package/dist/react/mq-appointment-documentation.js +2 -0
- package/dist/react/mq-chat-room.d.ts +21 -0
- package/dist/react/mq-chat-room.js +2 -0
- package/dist/react/mq-checkout.d.ts +18 -0
- package/dist/react/mq-checkout.js +2 -0
- package/dist/react/mq-documents.d.ts +13 -0
- package/dist/react/mq-documents.js +2 -0
- package/dist/react/mq-google-pay-checkout.d.ts +15 -0
- package/dist/react/mq-google-pay-checkout.js +2 -0
- package/dist/react/mq-immediate-videocall-checkout.d.ts +16 -0
- package/dist/react/mq-immediate-videocall-checkout.js +2 -0
- package/dist/react/mq-my-appointments.d.ts +30 -0
- package/dist/react/mq-my-appointments.js +2 -0
- package/dist/react/mq-professional-presence-sync.d.ts +7 -0
- package/dist/react/mq-professional-presence-sync.js +2 -0
- package/dist/react/mq-query-client-provider.d.ts +8 -0
- package/dist/react/mq-query-client-provider.js +2 -0
- package/dist/react/mq-schedule-success.d.ts +29 -0
- package/dist/react/mq-schedule-success.js +2 -0
- package/dist/react/mq-schedule.d.ts +33 -0
- package/dist/react/mq-schedule.js +2 -0
- package/dist/react/mq-session-provider.d.ts +10 -0
- package/dist/react/mq-session-provider.js +2 -0
- package/dist/react/mq-socket-provider.d.ts +9 -0
- package/dist/react/mq-socket-provider.js +2 -0
- package/dist/react/mq-support-chat.d.ts +15 -0
- package/dist/react/mq-support-chat.js +2 -0
- package/dist/react/mq-terms-and-conditions.d.ts +14 -0
- package/dist/react/mq-terms-and-conditions.js +2 -0
- package/dist/react/mq-theme-provider.d.ts +8 -0
- package/dist/react/mq-theme-provider.js +2 -0
- package/dist/react/mq-toast-container.d.ts +8 -0
- package/dist/react/mq-toast-container.js +2 -0
- package/dist/react/mq-unread-count-sync.d.ts +7 -0
- package/dist/react/mq-unread-count-sync.js +2 -0
- package/dist/react/mq-videocall.d.ts +37 -0
- package/dist/react/mq-videocall.js +2 -0
- package/dist/toast.d.ts +3 -0
- package/dist/toast.js +1 -0
- package/dist/ui/mq-calendar.js +1 -1
- package/dist/ui/mq-clamped-text.js +1 -1
- package/dist/ui/mq-time-slot-picker.js +1 -1
- package/package.json +53 -4
- package/dist/chunks/api-chat-client-BTBtu01T.js +0 -1
- package/dist/chunks/chunk-S5RWG6G2-oTcdgk2H.js +0 -1
- package/dist/chunks/chunk-YTQUGGS3-DN-JZpgG.js +0 -1
- package/dist/chunks/context-provider-CiMFpvDA.js +0 -1
- package/dist/chunks/exports-XZaVrMLd.js +0 -1
- package/dist/chunks/external-zAbuzxDj.js +0 -1
- package/dist/chunks/get-patient-profile-query-C8T8DJ7z.js +0 -1
- package/dist/chunks/index-BYHKNPG2.js +0 -1
- package/dist/chunks/index-Bxh8Qfwr.js +0 -1
- package/dist/chunks/isBefore-Cof0D841.js +0 -1
- package/dist/chunks/mq-layout-DpzeL9_i.js +0 -1
- package/dist/chunks/mutation-controller-OVT8NEt6.js +0 -1
- package/dist/chunks/parseISO-jT42c8Ob.js +0 -1
- package/dist/chunks/price-Dtdjx70D.js +0 -1
- package/dist/chunks/query-QJ1INUTG.js +0 -1
- package/dist/chunks/telemetry-client-CKCb9Gnf.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,t}from"./custom-element-DA9Fxvxd.js";import{e as s}from"./provide-CfT7g_Zi.js";import{Q as o,c as i,s as a,M as r}from"./mutation-controller-OVT8NEt6.js";import{l as n}from"./parseISO-jT42c8Ob.js";import{m as l,s as d}from"./runtime-Bg1WXVCx.js";import{i as c,a as m,x as h,E as p}from"./lit-element-DiWJYFwC.js";import{n as g}from"./property-scuRaFcM.js";import{r as u}from"./state-LQivXIgA.js";import{n as v}from"./context-provider-CiMFpvDA.js";import{tokens as y}from"../theme.js";import{a as b,M as f}from"./api-chat-client-BTBtu01T.js";import{xIcon as w}from"../ui/icons/x-icon.js";import"../ui/mq-avatar.js";import"../ui/mq-button.js";import"../ui/mq-skeleton.js";import{o as x}from"./if-defined-BYeVdwgd.js";import{chevronLeftIcon as k}from"../ui/icons/chevron-left-icon.js";import{e as $}from"./query-CeeutdfT.js";import{l as I,z}from"./external-zAbuzxDj.js";import{DownloadFileEvent as C}from"../events.js";import{checkDoubleIcon as T}from"../ui/icons/check-double-icon.js";import{checkIcon as D}from"../ui/icons/check-icon.js";import{getLocale as M}from"../i18n.js";import{S as q,a as S}from"./chunk-YTQUGGS3-DN-JZpgG.js";import{Q as j}from"./query-QJ1INUTG.js";import{e as P}from"./class-map-Co76I6aw.js";const _=v("apiKey"),A=v("token"),E=v("professionalHash"),R=v("roomId"),U=v("consultationId"),B=v("consultationType");class MqChatRoomCloseEvent extends Event{static{this.eventName="mq-chat-room-close"}constructor(){super(MqChatRoomCloseEvent.eventName,{bubbles:!0,composed:!0})}}class MqChatRoomProfileEvent extends Event{static{this.eventName="mq-chat-room-profile"}constructor(){super(MqChatRoomProfileEvent.eventName,{bubbles:!0,composed:!0})}}function H(e,t,s){return{queryKey:["professionals",t.hash],queryFn:()=>e.professionals.getProfessional(t),staleTime:0,...s}}const N=c`header{padding:var(--size-3) var(--size-4);background-color:var(--color-background-primary);display:flex;justify-content:space-between;gap:var(--size-1)}.left-side{display:flex;flex:1;min-width:0;align-items:center;gap:var(--size-3)}.left-side mq-avatar{flex-shrink:0}.info{min-width:0}.ghost-btn{text-align:left;background:0 0;border:none;padding:0;cursor:pointer}.right-side{display:flex;align-items:center}.name{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold);margin:0;color:var(--color-background);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.specialty{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin:0;color:var(--color-white);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.name-skeleton{margin-bottom:var(--size-1)}.profile-title{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-medium);margin:0;color:var(--color-white)}`;let K=class ChatRoomHeader extends m{constructor(){super(...arguments),this.hideCloseButton=!1,this.getProfessionalQuery=new o(this,()=>H(b,{hash:this.professionalHash}))}static{this.styles=N}handleClose(){this.dispatchEvent(new MqChatRoomCloseEvent)}handleClickProfile(){this.dispatchEvent(new MqChatRoomProfileEvent)}renderProfile(){return h`<div class="left-side"><mq-button type="button" size="icon-md" variant="ghost-inverted" @click="${()=>{this.dispatchEvent(new CustomEvent("goto-chat",{bubbles:!0,composed:!0}))}}">${k({size:24})}</mq-button><p class="profile-title">${l("Perfil de profesional")}</p></div>`}renderChat(){return h`${this.getProfessionalQuery.render({complete:e=>h`<button type="button" class="left-side ghost-btn" @click="${this.handleClickProfile}"><mq-avatar src="${x(e.avatar??void 0)}" alt="User Avatar" fallback="John Doe" size="sm"></mq-avatar><div class="info"><p class="name">${e.name}</p><p class="specialty">${e.title}</p></div></button>`,pending:()=>h`<div class="left-side"><mq-skeleton width="45px" height="45px" border-radius="full"></mq-skeleton><div><mq-skeleton class="name-skeleton" height="14px" width="120px"></mq-skeleton><mq-skeleton height="14px" width="100px"></mq-skeleton></div></div>`})}`}render(){return h`<header>${"profile"===this.view?this.renderProfile():this.renderChat()}<div class="right-side">${this.hideCloseButton?p:h`<mq-button type="button" size="icon-md" variant="ghost-inverted" @click="${this.handleClose}">${w({size:24})}</mq-button>`}</div></header>`}};e([g({type:String})],K.prototype,"professionalHash",void 0),e([g({type:Boolean})],K.prototype,"hideCloseButton",void 0),e([g({type:String})],K.prototype,"view",void 0),K=e([n(),t("chat-room-header")],K);const L=/(https?:\/\/[^\s,;:!)\]}\]]+|www\.[^\s,;:!)\]}\]]+|[a-zA-Z0-9][-a-zA-Z0-9]*(?:\.[a-zA-Z0-9][-a-zA-Z0-9]*)+(?:\/[^\s,;:!)\]}\]]*|(?:\?|#|&)[^\s,;:!)\]}\]]*)?)/gi;function F(e){return e.split(L).map((e,t)=>{if(t%2==1){const t=e.startsWith("http")?e:`https://${e}`;return h`<a href="${t}" target="_blank" rel="noopener noreferrer" class="message-link">${e}</a>`}return e})}let O=class TextMessageBubble extends m{static{this.styles=[c`:host{display:block}.message-bubble{padding:var(--size-2_5) var(--size-4);border-radius:var(--border-radius-lg);word-wrap:break-word;font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal)}.message-bubble.received{background-color:var(--chat-received-message-background);color:var(--chat-received-message-foreground);border-bottom-left-radius:0}.message-bubble.sent{background-color:var(--chat-sent-message-background);color:var(--chat-sent-message-foreground);border-bottom-right-radius:0}.message-content{white-space:pre-wrap}.message-paragraph{margin:0 0 var(--size-3) 0}.message-paragraph:last-child{margin-bottom:0}.message-bubble.received .message-content a.message-link,.message-bubble.sent .message-content a.message-link{color:var(--color-primary-link-default);text-decoration:underline}.message-bubble.received .message-content a.message-link:hover,.message-bubble.sent .message-content a.message-link:hover{opacity:.8}`]}formatMessageContent(e){const t=e.split("\n\n").filter(e=>e.trim());if(t.length<=1)return h`<div class="message-content">${F(e)}</div>`;const s=t.map(e=>h`<div class="message-paragraph">${F(e.trim())}</div>`);return h`<div class="message-content">${s}</div>`}render(){return h`<div class="message-bubble ${this.kind}">${this.formatMessageContent(this.message.string)}</div>`}};e([g({type:Object})],O.prototype,"message",void 0),e([g({type:String})],O.prototype,"kind",void 0),O=e([t("text-message-bubble")],O);const Q=c`:host{display:block}.message-bubble{padding:var(--size-2);border-radius:var(--border-radius-lg);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);overflow:hidden}.message-bubble.received{background-color:var(--chat-received-message-background);border-bottom-left-radius:0}.message-bubble.sent{background-color:var(--chat-sent-message-background);border-bottom-right-radius:0}.image-content{display:block;width:229px;height:229px;object-fit:cover;border-radius:var(--border-radius-md)}.image-placeholder{display:flex;align-items:center;justify-content:center;width:100%;max-width:300px;height:200px;background-color:var(--color-gray-light);border-radius:var(--border-radius-md);color:var(--chat-sent-message-foreground);font-size:var(--text-sm)}.image-content{cursor:pointer;transition:opacity .2s ease}.image-content:hover{opacity:.9}.preview-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:var(--dialog-underlay);display:flex;align-items:center;justify-content:center;z-index:1000;cursor:pointer;opacity:0;transition:opacity var(--dialog-transition-duration) ease}.preview-overlay.open{opacity:1}.preview-image{position:fixed;z-index:1000;inset:var(--mq-safe-top,0) var(--mq-safe-right,0) var(--mq-safe-bottom,0) var(--mq-safe-left,0);max-width:calc(100% - var(--mq-safe-left,4px) - var(--mq-safe-right,4px));max-height:calc(100% - var(--mq-safe-top,4px) - var(--mq-safe-bottom,4px));margin:auto;object-fit:contain;cursor:default;box-shadow:var(--dialog-shadow);transform:scale(.95);transition:transform var(--dialog-transition-duration) ease}.preview-overlay.open .preview-image{transform:scale(1)}.preview-close{z-index:1001;display:inline-flex;align-items:center;justify-content:center;height:var(--size-10);width:var(--size-10);position:absolute;top:var(--mq-safe-top,4px);right:var(--mq-safe-right,4px);background:rgba(255,255,255,.3);border:none;color:var(--color-neutrals-text-default);font-size:var(--text-xl);padding:var(--size-2) var(--size-3);border-radius:var(--border-radius-md);cursor:pointer;transition:background var(--dialog-transition-duration) ease}.preview-close:hover{background:var(--dialog-close-hover-bg)}`;let V=class ImageMessageBubble extends m{constructor(){super(...arguments),this.showPreview=!1,this.isPreviewRendered=!1,this.isPreviewActive=!1,this.closeTimer=null}static{this.styles=Q}handleImageError(e){const t=e.target;t.style.display="none";const s=t.nextElementSibling;s&&(s.style.display="flex")}handleImageLoad(e){const t=e.target.nextElementSibling;t&&(t.style.display="none")}handleImageClick(){this.showPreview=!0,this.isPreviewRendered=!0,this.updateComplete.then(()=>{requestAnimationFrame(()=>{this.isPreviewActive=!0})})}handleImageKeyDown(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleImageClick())}handleClosePreview(e){e&&e.stopPropagation(),this.isPreviewActive=!1,this.closeTimer&&window.clearTimeout(this.closeTimer),this.closeTimer=window.setTimeout(()=>{this.isPreviewRendered=!1,this.showPreview=!1,this.closeTimer=null},200)}handleOverlayClick(e){e.target===e.currentTarget&&this.handleClosePreview()}handleOverlayKeyDown(e){"Enter"!==e.key&&" "!==e.key||e.target===e.currentTarget&&(e.preventDefault(),this.handleClosePreview())}handleKeyDown(e){"Escape"===e.key&&this.showPreview&&(e.preventDefault(),this.handleClosePreview())}handlePreviewImageKeyDown(e){e.stopPropagation()}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown.bind(this)),this.closeTimer&&(window.clearTimeout(this.closeTimer),this.closeTimer=null)}render(){const e=this.message.attachment.signed_url??this.message.attachment.url;return h`<div class="message-bubble ${this.kind}"><img class="image-content" src="${e}" width="229" height="229" alt="Shared attachment" @error="${this.handleImageError}" @load="${this.handleImageLoad}" @click="${this.handleImageClick}" @keydown="${this.handleImageKeyDown}" tabindex="0"><div class="image-placeholder" style="display:none">Image unavailable</div></div>${this.showPreview&&this.isPreviewRendered?h`<div class="preview-overlay ${this.isPreviewActive?"open":""}" @click="${this.handleOverlayClick}" @keydown="${this.handleOverlayKeyDown}" tabindex="0"><button class="preview-close" @click="${this.handleClosePreview}" aria-label="Close preview">${w({size:24})}</button> <img class="preview-image" src="${e}" alt="Shared attachment preview" @click="${e=>e.stopPropagation()}" @keydown="${this.handlePreviewImageKeyDown}" tabindex="0"></div>`:""}`}};e([g({type:Object})],V.prototype,"message",void 0),e([g({type:String})],V.prototype,"kind",void 0),e([i({context:A})],V.prototype,"token",void 0),e([u()],V.prototype,"showPreview",void 0),e([u()],V.prototype,"isPreviewRendered",void 0),e([u()],V.prototype,"isPreviewActive",void 0),V=e([t("image-message-bubble")],V);const Y=c`:host{background-color:var(--chat-system-message-background);color:var(--chat-system-message-foreground);display:block;padding:var(--size-2_5) var(--size-4);border-radius:var(--border-radius-lg);font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal)}a.message-link{color:var(--color-primary-link-default);text-decoration:underline}a.message-link:hover{opacity:.8}`;let Z=class SystemMessageBubble extends m{static{this.styles=Y}render(){return h`<div class="system-message-bubble">${F(this.message.string)}</div>`}};e([g({type:Object})],Z.prototype,"message",void 0),Z=e([t("system-message-bubble")],Z);const J=c`:host{display:block}.message-bubble{display:inline-block;padding:var(--size-2_5) var(--size-4);border-radius:var(--border-radius-lg);word-wrap:break-word;font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);text-decoration:underline;color:var(--color-primary-link-default);border:none;cursor:pointer;text-align:left}.message-bubble:hover:not(:disabled){opacity:.8}.message-bubble:disabled{opacity:.5;cursor:not-allowed}.message-bubble.received{background-color:var(--chat-received-message-background);border-bottom-left-radius:0}.message-bubble.sent{background-color:var(--chat-sent-message-background);border-bottom-right-radius:0}.message-content{white-space:pre-wrap}.message-paragraph{margin:0 0 var(--size-3) 0}.message-paragraph:last-child{margin-bottom:0}`;let G=class FileMessageBubble extends m{constructor(){super(...arguments),this.isDownloading=!1}static{this.styles=J}formatMessageContent(e){const t=e.split("\n\n").filter(e=>e.trim());if(t.length<=1)return h`<div class="message-content">${e}</div>`;const s=t.map(e=>h`<div class="message-paragraph">${e.trim()}</div>`);return h`<div class="message-content">${s}</div>`}async handleDownload(){if(this.isDownloading)return;const e=this.message.attachment.url;try{this.isDownloading=!0;const t=await fetch(e,{headers:{Authorization:`Bearer ${this.token}`}});if(!t.ok)throw new Error(`Failed to fetch file: ${t.statusText}`);const s=await t.blob(),o=new FileReader;o.onloadend=()=>{const e=o.result,t=new C({url:e,filename:this.message.attachment.file_name});this.dispatchEvent(t),this.isDownloading=!1},o.onerror=()=>{I.error("Error reading file as data URL"),this.isDownloading=!1},o.readAsDataURL(s)}catch(e){I.error("Error downloading file:",e),this.isDownloading=!1}}render(){return h`<button type="button" @click="${this.handleDownload}" class="message-bubble ${this.kind}" ?disabled="${this.isDownloading}">${this.formatMessageContent(this.message.attachment.file_name)}</button>`}};e([g({type:Object})],G.prototype,"message",void 0),e([g({type:String})],G.prototype,"kind",void 0),e([i({context:A})],G.prototype,"token",void 0),e([u()],G.prototype,"isDownloading",void 0),G=e([t("file-message-bubble")],G);var W=z.enum(["ordinary","system"]).enum;let X=class MessageBubble extends m{constructor(){super(...arguments),this.showTimestamp=!0}static{this.styles=[c`:host{display:block}.timestamp{font-family:var(--font-body);font-size:var(--text-xs);color:var(--color-gray-medium);font-weight:var(--font-weight-normal);text-align:left;display:flex;align-items:center;gap:var(--size-1)}.timestamp.sent{text-align:right;justify-content:flex-end}.status-icon{width:12px;height:12px}.status-icon.read{color:var(--color-primary)}`]}formatTimestamp(e){if(!e)return"";try{const t=new Date(e);return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(t)}catch{return e}}renderStatusIcon(){switch(this.message.status){case f.Sent:return D({size:12,color:"currentColor"});case f.Received:return T({size:12,color:"currentColor"});case f.Read:return T({size:12,color:"currentColor",className:"read"});default:return null}}renderBubbleContent(){switch(this.message.type){case"image":return h`<image-message-bubble .message="${this.message}" .kind="${this.kind}"></image-message-bubble>`;case"file":return h`<file-message-bubble .message="${this.message}" .kind="${this.kind}"></file-message-bubble>`;default:return h`<text-message-bubble .message="${this.message}" .kind="${this.kind}"></text-message-bubble>`}}render(){if(this.message.senderType===W.system)return h`<system-message-bubble .message="${this.message}"></system-message-bubble>`;const e=this.message.createdAt?new Date(this.message.createdAt):this.message.time?new Date(this.message.time):null;return h`${this.renderBubbleContent()} ${this.showTimestamp&&e?h`<div class="timestamp ${this.kind}">${this.formatTimestamp(e.toISOString())} ${"sent"===this.kind?h`<span class="status-icon ${this.message.status===f.Read?"read":""}">${this.renderStatusIcon()}</span>`:""}</div>`:""}`}};e([g({type:String})],X.prototype,"kind",void 0),e([g({type:Object})],X.prototype,"message",void 0),e([g({type:Boolean})],X.prototype,"showTimestamp",void 0),X=e([t("message-bubble")],X);let ee=class DateBanner extends m{constructor(){super(...arguments),this.date=""}static{this.styles=[y,c`:host{display:block;margin-bottom:var(--size-2)}.date-banner{display:flex;align-items:center;justify-content:center;position:relative}.date-text{background-color:var(--color-gray-light);color:var(--color-gray-darker);font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);padding:var(--size-1) var(--size-2);border-radius:var(--border-radius-2xl);white-space:nowrap}`]}formatDate(e){const t=M().replace("_","-"),s=new Date(e),o=new Date,i=new Date(o);i.setDate(i.getDate()-1);const a=new Date(s.getFullYear(),s.getMonth(),s.getDate()),r=new Date(o.getFullYear(),o.getMonth(),o.getDate()),n=new Date(i.getFullYear(),i.getMonth(),i.getDate());return a.getTime()===r.getTime()?l("Hoy"):a.getTime()===n.getTime()?l("Ayer"):s.toLocaleDateString(t,{dateStyle:"medium"})}render(){return h`<div class="date-banner"><span class="date-text">${this.formatDate(this.date)}</span></div>`}};function te(e){return e.createdAt?new Date(e.createdAt):e.time?new Date(e.time):new Date}e([g({type:String})],ee.prototype,"date",void 0),ee=e([n(),t("date-banner")],ee);let se=class MessagesList extends m{constructor(){super(...arguments),this.messages=[]}static{this.styles=[y,c`:host{display:block;width:100%;height:100%;overflow-y:auto;overflow-x:hidden}.messages-container{display:flex;flex-direction:column;padding:var(--size-4);gap:var(--size-1);background-color:var(--color-white);padding-bottom:var(--size-4)}.message-wrapper{display:flex;width:100%}.message-wrapper.received{justify-content:flex-start}.message-wrapper.sent{justify-content:flex-end}.message-wrapper.system{justify-content:center}message-bubble{max-width:70%}`]}scrollToBottom(){requestAnimationFrame(()=>{const e=this.messagesContainerEnd;e&&e.scrollIntoView({behavior:"instant",block:"end"})})}shouldShowMessageTimestamp(e,t){if(e.senderType===W.system)return!1;if(!t)return!0;if(t.senderType!==e.senderType)return!0;if(t.senderType===W.ordinary&&e.senderType===W.ordinary&&t.fromUserHash!==e.fromUserHash)return!0;return(te(t).getTime()-te(e).getTime())/6e4>1}groupMessagesByDate(e){const t=[];let s=null;return e.forEach((o,i)=>{const a=te(o),r=a?.toDateString();r!==s&&(t.push({type:"date",data:a.toDateString()}),s=r??null);const n=e[i+1],l=this.shouldShowMessageTimestamp(o,n);t.push({type:"message",data:o,showTimestamp:l})}),t}firstUpdated(){this.scrollToBottom()}willUpdate(e){e.has("messages")&&this.scrollToBottom()}render(){const e=this.groupMessagesByDate(this.messages),t=e.map((t,s)=>{if("date"===t.type)return h`<date-banner .date="${t.data}"></date-banner>`;const o=this.professionalHash!==t.data.fromUserHash,i=t.data.senderType===W.system?"system":o?"sent":"received";return h`<div class="message-wrapper ${i}"><message-bubble .message="${t.data}" .kind="${i}" .showTimestamp="${t.showTimestamp||"date"===e[s+1]?.type}"></message-bubble></div>`});return h`<div class="messages-container">${t}<div class="messages-container-end"></div></div>`}};e([g({type:Array})],se.prototype,"messages",void 0),e([g({type:String})],se.prototype,"professionalHash",void 0),e([$(".messages-container-end")],se.prototype,"messagesContainerEnd",void 0),se=e([t("messages-list")],se);let oe=class MessageBubbleSkeleton extends m{constructor(){super(...arguments),this.variant="patient",this.height="md",this.showTimestamp=!0}static{this.styles=[c`:host{display:block}.message-bubble{padding:var(--size-4);border-radius:var(--border-radius-lg);margin-bottom:var(--size-1);position:relative;overflow:hidden}.message-bubble.doctor{background-color:var(--color-gray-light);border-bottom-left-radius:0}.message-bubble.patient{background-color:var(--color-background-primary-light);border-bottom-right-radius:0}:host([height=sm]) .message-bubble{height:var(--size-8)}:host([height=md]) .message-bubble{height:var(--size-12)}`]}render(){return h`<div class="message-bubble ${this.variant}"></div>${this.showTimestamp?h`<div class="timestamp-skeleton ${this.variant}"></div>`:""}`}};e([g({type:String})],oe.prototype,"variant",void 0),e([g({type:String})],oe.prototype,"height",void 0),e([g({type:Boolean})],oe.prototype,"showTimestamp",void 0),oe=e([t("message-bubble-skeleton")],oe);let ie=class MessagesSkeleton extends m{constructor(){super(...arguments),this.messageCount=6}static{this.styles=[y,c`:host{display:block;width:100%;height:100%;overflow:hidden}.messages-container{display:flex;flex-direction:column;padding:var(--size-4);gap:var(--size-3);max-width:100%;height:100%;background-color:var(--color-white)}.message-wrapper{display:flex;width:100%}.message-wrapper.doctor{justify-content:flex-start}.message-wrapper.patient{justify-content:flex-end}message-bubble-skeleton{max-width:85%;min-width:60%;width:100%}`]}getSkeletonHeight(e){const t=["sm","md","sm","md","sm","md"];return t[e%t.length]}getSkeletonVariant(e){const t=["doctor","patient","doctor","doctor","patient","doctor","patient"];return t[e%t.length]}renderSkeletonMessages(){return Array.from({length:this.messageCount},(e,t)=>{const s=this.getSkeletonVariant(t),o=this.getSkeletonHeight(t);return h`<div class="message-wrapper ${s}"><message-bubble-skeleton variant="${s}" height="${o}" ?showTimestamp="${t===this.messageCount-1||Math.random()>.7}"></message-bubble-skeleton></div>`})}render(){return h`<div class="messages-container">${this.renderSkeletonMessages()}</div>`}};e([g({type:Number})],ie.prototype,"messageCount",void 0),ie=e([t("messages-skeleton")],ie);var ae=class{constructor(e,t){this.host=e,this.listeners=[],this.host.addController(this),this.socketContext=new a(this.host,{context:q,subscribe:!0,callback:e=>{if(e&&(this.socket=e,t?.listeners)){this.listeners=t.listeners;for(const e of this.listeners)this.socket?.on(e.eventName,e.callback)}}})}hostConnected(){}hostDisconnected(){for(const e of this.listeners)this.socket?.off(e.eventName,e.callback)}};function re(e,t){return{queryKey:["rooms",t.roomId],queryFn:()=>e.rooms.getRoomMessages(t),staleTime:0}}class OptimisticUpdatesController{constructor(e){this.host=e,this.queryClientContext=new a(this.host,{context:j,subscribe:!0,callback:e=>{e&&(this.queryClient=e)}}),this.host.addController(this)}hostConnected(){}appendMessageToRoom(e,t){const s=re(b,{roomId:t}).queryKey;this.queryClient?.setQueriesData({queryKey:s,exact:!0},t=>[...t??[],e])}deleteMessage(e,t){if(!this.queryClient)return;const s=re(b,{roomId:t}).queryKey;this.queryClient.setQueryData(s,t=>(t??[]).map(t=>t.messageId===e?{...t,deletedAt:(new Date).toISOString(),string:l("Este mensaje fue eliminado")}:t))}updateMessageStatus({messageId:e,status:t,roomId:s}){if(!this.queryClient)return;const o=re(b,{roomId:s}).queryKey;this.queryClient.setQueryData(o,s=>(s??[]).map(s=>s.messageId===e?{...s,status:t}:s))}}let ne=class ChatRoomMessages extends m{constructor(){super(...arguments),this.getRoomMessagesQuery=new o(this,()=>re(b,{roomId:this.roomId})),this.optimisticUpdatesController=new OptimisticUpdatesController(this),this.onMessageReceived=e=>{if(e.roomId!==this.roomId)return;const t=function(e){const t={roomId:"string"==typeof e.roomId?Number.parseInt(e.roomId,10):e.roomId,messageId:e.messageId,status:e.status,senderType:e.senderType,fromUserHash:e.fromUserHash,time:e.time,createdAt:e.time?new Date(e.time).toISOString():null,deletedAt:null};switch(e.type){case"string":return{...t,type:"string",string:e.string,auto:e.auto?1:0,attachment:null};case"image":return{...t,type:"image",string:e.fileName||"",auto:0,attachment:{file_name:e.fileName,file_size:e.fileSize,url:e.imageUrl,type:"uncategorized",meta:{duration:0},signed_url:e.imageUrl}};case"file":return{...t,type:"file",string:e.fileName||"",auto:0,attachment:{file_name:e.fileName,file_size:e.fileSize,url:e.fileUrl,type:"uncategorized",meta:{duration:0},signed_url:e.fileUrl}};default:return{...t,type:"string",string:"",auto:0,attachment:null}}}(e);this.optimisticUpdatesController.appendMessageToRoom(t,t.roomId),t.roomId===this.roomId&&e.fromUserHash===this.professionalHash&&this._socketController.socket?.emit(S.messageStatus,e.messageId,this.roomId,f.Read)},this.onMessageDeleted=e=>{e.room_id===this.roomId&&this.optimisticUpdatesController.deleteMessage(e.message_id,e.room_id)},this.onMessageStatusUpdated=e=>{e.roomId===this.roomId&&this.optimisticUpdatesController.updateMessageStatus({messageId:e.messageId,status:e.status,roomId:e.roomId})},this._socketController=new ae(this,{listeners:[{eventName:S.message,callback:this.onMessageReceived},{eventName:S.message_deleted,callback:this.onMessageDeleted},{eventName:S.messageStatus,callback:this.onMessageStatusUpdated}]})}static{this.styles=[y,c`:host{display:block;width:100%;height:100%}`]}render(){return this.getRoomMessagesQuery.render({pending:()=>h`<messages-skeleton messageCount="8"></messages-skeleton>`,complete:e=>h`<messages-list .messages="${e}" .professionalHash="${this.professionalHash}"></messages-list>`})}};e([g({type:Number})],ne.prototype,"roomId",void 0),e([g({type:String})],ne.prototype,"professionalHash",void 0),ne=e([t("chat-room-messages")],ne);var le=class{constructor(e){this.string=e.string,this.roomId=e.roomId,this.messageId=e.messageId,this.type=e.type,this.fileName=e.fileName,this.autoMessage=e.autoMessage,this.senderType=e.senderType,this.attachmentType=e.attachmentType,this.consultationId=e.consultationId,this.consultationType=e.consultationType}toSocketMessage(){return[S.message,this.string,this.roomId,this.messageId,this.type,this.fileName,this.autoMessage,this.senderType,this.attachmentType,this.consultationId,this.consultationType]}},de=class extends le{constructor(e){super({roomId:e.roomId,messageId:e.messageId,string:e.string,type:"string",fileName:null,autoMessage:!1,senderType:W.ordinary,attachmentType:"uncategorized",consultationId:e.consultationId,consultationType:e.consultationType})}},ce=class extends le{constructor(e){super({roomId:e.roomId,messageId:e.messageId,string:e.base64Attachment,fileName:e.fileName,type:e.type,autoMessage:!1,senderType:W.ordinary,attachmentType:"uncategorized",consultationId:e.consultationId,consultationType:e.consultationType})}};async function me(e){return await Promise.all(e.map(async e=>{const t=await function(e){return new Promise((t,s)=>{const o=new FileReader;o.onload=()=>{const i=o.result.split(",")[1];i?t(i):s(new Error(`Invalid data URL format for file: ${e.name}`))},o.onerror=()=>{s(new Error(`Failed to read file: ${e.name}`))},o.readAsDataURL(e)})}(e);return{name:e.name,size:e.size,type:e.type,base64:t}}))}const he=c`:host{display:block;position:absolute;bottom:0;padding:var(--size-2) var(--size-2);background:#fff}.footer-container{display:flex;align-items:center;gap:var(--size-1);max-width:100%}.input-container{flex:1;position:relative;display:flex;align-items:center;border:1px solid var(--color-neutrals-border-disabled);border-radius:var(--border-radius-2xl);padding:0 var(--size-1);overflow:hidden}.input-container:focus-within{border-color:var(--color-primary)}.message-input{flex:1;border:none;outline:0;background:0 0;font-family:var(--font-body);font-size:var(--text-base);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-neutrals-text-default);padding-left:var(--sp-2)}.message-input::placeholder{color:var(--color-neutrals-text-medium)}.attachment-icon{width:var(--size-5);height:var(--size-5);color:var(--color-primary)}.send-icon{width:var(--size-5);height:var(--size-5);color:var(--color-primary)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.send-button{color:var(--color-neutrals-link-disabled);background:0 0;border:none;padding:var(--size-2);border-radius:var(--border-radius-md);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s ease}.send-button:hover:not(.disabled){background:var(--color-primary-light)}.send-button:active:not(.disabled){background-color:var(--color-neutrals-background-active)}.send-button.disabled{cursor:not-allowed;opacity:.4}.send-button.disabled .send-icon{color:var(--color-neutrals-text-disabled)}`;let pe=class ChatRoomFooter extends m{constructor(){super(...arguments),this.isTyping=!1,this.typingTimeoutId=null,this.inputValue="",this.socketController=new ae(this)}static{this.styles=[he]}handleInputChange(e){const t=e.target;this.inputValue=t.value,this.isTyping||(this.socketController.socket?.emit(S.typing,this.roomId),this.isTyping=!0),this.typingTimeoutId&&clearTimeout(this.typingTimeoutId),this.typingTimeoutId=setTimeout(()=>{this.isTyping&&(this.socketController.socket?.emit(S.stop_typing,this.roomId),this.isTyping=!1)},1500)}handleKeyDown(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this.handleSendMessage())}async handleAttachment(e){const t=e.target.files;if(!t||0===t.length)return;const s=t.item(0);if(s)try{const e=(await me([s]))[0];if(!e)return void I.error("Error converting file to base64");const t=e?.type.includes("image")?"image":"file",o=crypto.randomUUID(),i=s.name,a=new ce({type:t,base64Attachment:e.base64,fileName:i,roomId:this.roomId,messageId:o,consultationId:this.consultationId,consultationType:this.consultationType});this.socketController.socket?.emit(...a.toSocketMessage())}catch(e){I.error("Error converting files to base64:",e)}}handleAttachmentClick(){this.attachmentInput.click()}handleSendMessage(){const e=this.inputValue.trim();if(!e)return;const t=crypto.randomUUID();this.isTyping&&(this.socketController.socket?.emit(S.stop_typing,this.roomId),this.isTyping=!1,this.typingTimeoutId&&clearTimeout(this.typingTimeoutId));const s=new de({messageId:t,string:e,roomId:this.roomId,consultationId:this.consultationId,consultationType:this.consultationType});this.socketController.socket?.emit(...s.toSocketMessage()),this.inputValue=""}disconnectedCallback(){this.isTyping&&(this.socketController.socket?.emit(S.stop_typing,this.roomId),this.typingTimeoutId&&clearTimeout(this.typingTimeoutId))}render(){const e=this.inputValue.trim().length>0;return h`<div class="footer-container"><div class="input-container"><input class="message-input" type="text" placeholder="${l("Escribe aquí...")}" .value="${this.inputValue}" @input="${this.handleInputChange}" @keydown="${this.handleKeyDown}"><div><input class="attachment-input sr-only" type="file" accept="image/jpeg,image/jpg,image/png,image/gif,image/bmp,image/tiff,application/pdf,text/*,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,audio/*,video/*" @change="${this.handleAttachment}"><mq-button variant="ghost" size="icon-sm" @click="${this.handleAttachmentClick}" title="${l("Adjuntar archivo")}">${h`<svg class="attachment-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`}</mq-button></div></div><button class="send-button ${e?"":"disabled"}" @click="${this.handleSendMessage}" ?disabled="${!e}" title="${l("Enviar mensaje")}">${h`<svg class="send-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 2L11 13"/><path d="M22 2L15 22L11 13L2 9L22 2z"/></svg>`}</button></div>`}};e([i({context:U})],pe.prototype,"consultationId",void 0),e([i({context:B})],pe.prototype,"consultationType",void 0),e([g({type:Number})],pe.prototype,"roomId",void 0),e([u()],pe.prototype,"inputValue",void 0),e([$(".attachment-input")],pe.prototype,"attachmentInput",void 0),pe=e([t("chat-room-footer")],pe);const ge=e=>({all_week:!0,monday:1===e,tuesday:2===e,wednesday:3===e,thursday:4===e,friday:5===e,saturday:6===e,sunday:7===e,working_week:e>=1&&e<=5,weekend:0===e||6===e});function ue(e,t){const s=ge(6===e?0:e+1);return t.some(e=>{const t=e.days_of_week;return!0===s[t]})}let ve=class AvailabilitySection extends m{constructor(){super(...arguments),this.gaps=[],this.selectedDay=function(){const e=(new Date).getDay();return 0===e?6:e-1}()}static{this.styles=c`:host{display:flex;flex-direction:column;gap:var(--size-3)}.availability-header{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-normal);color:var(--color-primary);text-align:center;margin:0;margin-bottom:var(--size-4) 0}.availability-days{display:flex;flex-direction:row;justify-content:center;gap:var(--size-1);overflow-x:auto;padding-bottom:var(--size-4)}.availability-button{outline:0;border:1px solid var(--color-gray-medium);background:0 0;color:var(--color-gray-medium);cursor:pointer;height:var(--size-9);width:var(--size-10);border-radius:var(--border-radius-sm);text-transform:capitalize;font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium)}.availability-button:hover{background-color:color-mix(in srgb,var(--color-gray-light) 50%,transparent)}.availability-button:focus{background-color:color-mix(in srgb,var(--color-gray-light) 50%,transparent)}.availability-button.active{background:var(--color-primary);color:var(--color-white);border:none}.availability-button:disabled{opacity:.5;cursor:not-allowed;background-color:var(--color-gray-light)}.time-title{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);color:var(--color-gray-dark);margin:0;margin-bottom:var(--size-1)}.time-entries{display:flex;flex-direction:column;gap:var(--size-1);margin-bottom:var(--size-6)}.time-entry{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);color:var(--color-gray-medium);margin:0}`}updated(e){e.has("gaps")&&(void 0===this.selectedDay||ue(this.selectedDay,this.gaps)||(this.selectedDay=void 0))}render(){const e=[{shortLabel:l("Lu"),label:l("Lunes"),key:"monday",disabled:!ue(0,this.gaps)},{shortLabel:l("Ma"),label:l("Martes"),key:"tuesday",disabled:!ue(1,this.gaps)},{shortLabel:l("Mi"),label:l("Miércoles"),key:"wednesday",disabled:!ue(2,this.gaps)},{shortLabel:l("Ju"),label:l("Jueves"),key:"thursday",disabled:!ue(3,this.gaps)},{shortLabel:l("Vi"),label:l("Viernes"),key:"friday",disabled:!ue(4,this.gaps)},{shortLabel:l("Sa"),label:l("Sábado"),key:"saturday",disabled:!ue(5,this.gaps)},{shortLabel:l("Do"),label:l("Domingo"),key:"sunday",disabled:!ue(6,this.gaps)}];return h`<h2 class="availability-header">${l("Disponibilidad")}</h2><div class="availability-days">${e.map((e,t)=>h`<button type="button" class="availability-button ${P({active:this.selectedDay===t&&!e.disabled})}" ?disabled="${e.disabled}" @click="${()=>{e.disabled||(this.selectedDay=t)}}">${e.shortLabel}</button>`)}</div>${void 0===this.selectedDay||e[this.selectedDay]?.disabled?"":(()=>{const t=function(e,t){const s=ge(6===e?0:e+1);return t.filter(e=>{const t=e.days_of_week;return!0===s[t]}).map(e=>({from_time:e.from_time,to_time:e.to_time}))}(this.selectedDay,this.gaps);return h`<div class="availability-time"><p class="time-title">${e[this.selectedDay]?.label}</p><div class="time-entries">${t.length>0?t.map(e=>h`<p class="time-entry">${l("De")} ${e.from_time} ${l("a")} ${e.to_time}</p>`):h`<p class="time-entry">${l("No hay horarios disponibles")}</p>`}</div></div>`})()}`}};e([g({type:Array})],ve.prototype,"gaps",void 0),e([u()],ve.prototype,"selectedDay",void 0),ve=e([n(),t("availability-section")],ve);const ye=c`:host{display:flex;flex-direction:column;height:100%;overflow-y:auto;background-color:var(--color-white)}.profile-container{padding:var(--size-6);display:flex;flex-direction:column}.profile-header{display:flex;flex-direction:column;align-items:center;text-align:center;padding-bottom:var(--size-6);border-bottom:1px solid var(--color-gray-medium);margin-bottom:var(--size-6)}.profile-avatar{margin-bottom:var(--size-2)}.profile-name{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-medium);color:var(--color-text-primary);margin:var(--size-4) 0}.profile-specialty{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);color:var(--color-text-icons--secondary);margin:0;margin-bottom:var(--size-2);text-transform:uppercase}.profile-collegiate{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);color:var(--color-gray-medium);text-transform:uppercase;margin:0}.description-header{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-medium);color:var(--color-primary);margin:0;margin-bottom:var(--size-3)}.description-text{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-foreground);margin:0}`;let be=class ChatRoomProfile extends m{constructor(){super(...arguments),this.getProfessionalQuery=new o(this,()=>H(b,{hash:this.professionalHash}))}static{this.styles=[y,ye]}renderProfile(e){return h`<div class="profile-container"><div class="profile-header"><mq-avatar class="profile-avatar" src="${e.avatar||""}" fallback="${e.name}" alt="${e.name}'s profile picture" size="xl"></mq-avatar><div><h1 class="profile-name">${e.name}</h1>${e.title?h`<p class="profile-specialty">${e.title}</p>`:""} ${e.collegiate_number?h`<p class="profile-collegiate">${l(d`Nº COL. ${e.collegiate_number}`)}</p>`:""}</div></div>${e.chat_schedule&&e.chat_schedule.gaps.length>0?h`<availability-section .gaps="${e.chat_schedule.gaps}"></availability-section>`:p} ${e.description||e.overview?h`<div><h2 class="description-header">${l("Descripción")}</h2><p class="description-text">${e.description||e.overview}</p></div>`:""}</div>`}render(){return this.getProfessionalQuery.render({pending:()=>h``,complete:e=>this.renderProfile(e)})}};function fe(e,t,s){return{queryKey:["unread-messages",t],queryFn:()=>e.rooms.getUnreadMessagesCount(t),staleTime:0,...s}}e([g({type:String})],be.prototype,"professionalHash",void 0),be=e([n(),t("chat-room-profile")],be);const we=c`.root{display:flex;flex-direction:column;height:100%;overflow:hidden}chat-room-header{flex-shrink:0}chat-room-messages{flex:1;overflow-y:auto;overflow-x:hidden}chat-room-footer{position:sticky;bottom:0;left:0;right:0;flex-shrink:0}`;let xe=class MqChatRoom extends m{constructor(){super(...arguments),this.consultationId=void 0,this.consultationType=void 0,this.readonly=!1,this.hideCloseButton=!1,this.view="chat",this.socketController=new ae(this),this.readAllMessagesMutation=new r(this,{mutationFn:()=>b.professionals.readAllMessages({roomId:this.roomId}),onSuccess:()=>{this.queryClientContext?.invalidateQueries({queryKey:fe(b,{roomId:this.roomId}).queryKey})}})}static{this.styles=[y,we]}willUpdate(e){e.has("apiKey")&&this.apiKey&&b.setApiKey(this.apiKey),e.has("token")&&b.setAuthToken(this.token),e.has("roomId")&&(this.socketController.socket?.emit(S.joinRoom,this.roomId),this.readAllMessagesMutation.run(void 0))}render(){return h`<div class="root"><chat-room-header .professionalHash="${this.professionalHash}" .view="${this.view}" .hideCloseButton="${this.hideCloseButton}" @mq-chat-room-profile="${()=>{this.view="profile"}}" @goto-chat="${()=>{this.view="chat"}}"></chat-room-header>${"chat"===this.view?h`<chat-room-messages .roomId="${this.roomId}" .professionalHash="${this.professionalHash}"></chat-room-messages>${this.readonly?p:h`<chat-room-footer .roomId="${this.roomId}"></chat-room-footer>`}`:h`<chat-room-profile .professionalHash="${this.professionalHash}" @mq-chat-room-chat="${()=>{this.view="chat"}}"></chat-room-profile>`}</div>`}};e([s({context:_}),g({type:String,attribute:"api-key"})],xe.prototype,"apiKey",void 0),e([s({context:A}),g({type:String,attribute:"token"})],xe.prototype,"token",void 0),e([s({context:E}),g({type:String,attribute:"professional-hash"})],xe.prototype,"professionalHash",void 0),e([s({context:R}),g({type:Number,attribute:"room-id"})],xe.prototype,"roomId",void 0),e([s({context:U}),g({type:String,attribute:"consultation-id"})],xe.prototype,"consultationId",void 0),e([s({context:B}),g({type:String,attribute:"consultation-type"})],xe.prototype,"consultationType",void 0),e([g({type:Boolean,reflect:!0})],xe.prototype,"readonly",void 0),e([g({type:Boolean,attribute:"hide-close-button"})],xe.prototype,"hideCloseButton",void 0),e([u()],xe.prototype,"view",void 0),e([i({context:j,subscribe:!0})],xe.prototype,"queryClientContext",void 0),xe=e([n(),t("mq-chat-room")],xe);export{xe as M,fe as a,MqChatRoomCloseEvent as b,MqChatRoomProfileEvent as c,H as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e,t,a=new class _Logger{static{this.prefix="[@mediquo/web-components]"}#e(e,...t){console[e](_Logger.prefix,...t)}debug(...e){this.#e("debug",...e)}info(...e){this.#e("info",...e)}warn(...e){this.#e("warn",...e)}error(...e){this.#e("error",...e)}};!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),s={};for(const e of a)s[e]=t[e];return e.objectValues(s)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(e||(e={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(t||(t={}));const s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),n=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return Number.isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},r=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ZodError extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},s=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(s);else if("invalid_return_type"===n.code)s(n.returnTypeError);else if("invalid_arguments"===n.code)s(n.argumentsError);else if(0===n.path.length)a._errors.push(t(n));else{let e=a,s=0;for(;s<n.path.length;){const a=n.path[s];s===n.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(n))):e[a]=e[a]||{_errors:[]},e=e[a],s++}}};return s(this),a}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else a.push(e(s));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const i=(t,a)=>{let n;switch(t.code){case r.invalid_type:n=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case r.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case r.unrecognized_keys:n=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case r.invalid_union:n="Invalid input";break;case r.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case r.invalid_enum_value:n=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case r.invalid_arguments:n="Invalid function arguments";break;case r.invalid_return_type:n="Invalid function return type";break;case r.invalid_date:n="Invalid date";break;case r.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):n="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case r.too_small:n="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case r.too_big:n="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case r.custom:n="Invalid input";break;case r.invalid_intersection_types:n="Intersection results could not be merged";break;case r.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case r.not_finite:n="Number must be finite";break;default:n=a.defaultError,e.assertNever(t)}return{message:n}};let o=i;function d(){return o}const c=e=>{const{data:t,path:a,errorMaps:s,issueData:n}=e,r=[...a,...n.path||[]],i={...n,path:r};if(void 0!==n.message)return{...n,path:r,message:n.message};let o="";const d=s.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:o}};function u(e,t){const a=d(),s=c({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===i?void 0:i].filter(e=>!!e)});e.common.issues.push(s)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const s of t){if("aborted"===s.status)return l;"dirty"===s.status&&e.dirty(),a.push(s.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t){const t=await e.key,s=await e.value;a.push({key:t,value:s})}return ParseStatus.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const s of t){const{key:t,value:n}=s;if("aborted"===t.status)return l;if("aborted"===n.status)return l;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!s.alwaysSet||(a[t.value]=n.value)}return{status:e.value,value:a}}}const l=Object.freeze({status:"aborted"}),p=e=>({status:"dirty",value:e}),h=e=>({status:"valid",value:e}),m=e=>"aborted"===e.status,f=e=>"dirty"===e.status,y=e=>"valid"===e.status,_=e=>"undefined"!=typeof Promise&&e instanceof Promise;var g;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(g||(g={}));class ParseInputLazyPath{constructor(e,t,a,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const v=(e,t)=>{if(y(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError(e.common.issues);return this._error=t,this._error}}};function Z(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:s,description:n}=e;if(t&&(a||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(t,n)=>{const{message:r}=e;return"invalid_enum_value"===t.code?{message:r??n.defaultError}:void 0===n.data?{message:r??s??n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:r??a??n.defaultError}},description:n}}class ZodType{get description(){return this._def.description}_getType(e){return n(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(_(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){const a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},s=this._parseSync({data:e,path:a.path,parent:a});return v(a,s)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return y(a)?{value:a.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>y(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},s=this._parse({data:e,path:a.path,parent:a}),r=await(_(s)?s:Promise.resolve(s));return v(a,r)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,s)=>{const n=e(t),i=()=>s.addIssue({code:r.custom,...a(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(i(),!1)):!!n||(i(),!1)})}refinement(e,t){return this._refinement((a,s)=>!!e(a)||(s.addIssue("function"==typeof t?t(a,s):t),!1))}_refinement(e){return new ZodEffects({schema:this,typeName:Q.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...Z(this._def),schema:this,typeName:Q.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...Z(this._def),innerType:this,defaultValue:t,typeName:Q.ZodDefault})}brand(){return new ZodBranded({typeName:Q.ZodBranded,type:this,...Z(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...Z(this._def),innerType:this,catchValue:t,typeName:Q.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const b=/^c[^\s-]{8,}$/i,k=/^[0-9a-z]+$/,x=/^[0-9A-HJKMNP-TV-Z]{26}$/i,w=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,T=/^[a-z0-9_-]{21}$/i,N=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,O=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,S=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let A;const E=/^(?:(?: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])$/,j=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,C=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,P=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,I=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,R=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,L="((\\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])))",$=new RegExp(`^${L}$`);function M(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function z(e){return new RegExp(`^${M(e)}$`)}function D(e){let t=`${L}T${M(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function F(e,t){return!("v4"!==t&&t||!E.test(e))||!("v6"!==t&&t||!C.test(e))}function U(e,t){if(!N.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const s=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(s));return"object"==typeof n&&null!==n&&((!("typ"in n)||"JWT"===n?.typ)&&(!!n.alg&&(!t||n.alg===t)))}catch{return!1}}function V(e,t){return!("v4"!==t&&t||!j.test(e))||!("v6"!==t&&t||!P.test(e))}class ZodString extends ZodType{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==s.string){const e=this._getOrReturnCtx(t);return u(e,{code:r.invalid_type,expected:s.string,received:e.parsedType}),l}const a=new ParseStatus;let n;for(const s of this._def.checks)if("min"===s.kind)t.data.length<s.value&&(n=this._getOrReturnCtx(t,n),u(n,{code:r.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if("max"===s.kind)t.data.length>s.value&&(n=this._getOrReturnCtx(t,n),u(n,{code:r.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if("length"===s.kind){const e=t.data.length>s.value,i=t.data.length<s.value;(e||i)&&(n=this._getOrReturnCtx(t,n),e?u(n,{code:r.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&u(n,{code:r.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if("email"===s.kind)S.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"email",code:r.invalid_string,message:s.message}),a.dirty());else if("emoji"===s.kind)A||(A=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),A.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"emoji",code:r.invalid_string,message:s.message}),a.dirty());else if("uuid"===s.kind)w.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"uuid",code:r.invalid_string,message:s.message}),a.dirty());else if("nanoid"===s.kind)T.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"nanoid",code:r.invalid_string,message:s.message}),a.dirty());else if("cuid"===s.kind)b.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"cuid",code:r.invalid_string,message:s.message}),a.dirty());else if("cuid2"===s.kind)k.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"cuid2",code:r.invalid_string,message:s.message}),a.dirty());else if("ulid"===s.kind)x.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"ulid",code:r.invalid_string,message:s.message}),a.dirty());else if("url"===s.kind)try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),u(n,{validation:"url",code:r.invalid_string,message:s.message}),a.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"regex",code:r.invalid_string,message:s.message}),a.dirty())}else if("trim"===s.kind)t.data=t.data.trim();else if("includes"===s.kind)t.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty());else if("toLowerCase"===s.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===s.kind)t.data=t.data.toUpperCase();else if("startsWith"===s.kind)t.data.startsWith(s.value)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty());else if("endsWith"===s.kind)t.data.endsWith(s.value)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty());else if("datetime"===s.kind){D(s).test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:"datetime",message:s.message}),a.dirty())}else if("date"===s.kind){$.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:"date",message:s.message}),a.dirty())}else if("time"===s.kind){z(s).test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:"time",message:s.message}),a.dirty())}else"duration"===s.kind?O.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"duration",code:r.invalid_string,message:s.message}),a.dirty()):"ip"===s.kind?F(t.data,s.version)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"ip",code:r.invalid_string,message:s.message}),a.dirty()):"jwt"===s.kind?U(t.data,s.alg)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"jwt",code:r.invalid_string,message:s.message}),a.dirty()):"cidr"===s.kind?V(t.data,s.version)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"cidr",code:r.invalid_string,message:s.message}),a.dirty()):"base64"===s.kind?I.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"base64",code:r.invalid_string,message:s.message}),a.dirty()):"base64url"===s.kind?R.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"base64url",code:r.invalid_string,message:s.message}),a.dirty()):e.assertNever(s);return{status:a.value,value:t.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:r.invalid_string,...g.errToObj(a)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...g.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...g.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function B(e,t){const a=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,n=a>s?a:s;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}ZodString.create=e=>new ZodString({checks:[],typeName:Q.ZodString,coerce:e?.coerce??!1,...Z(e)});class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==s.number){const e=this._getOrReturnCtx(t);return u(e,{code:r.invalid_type,expected:s.number,received:e.parsedType}),l}let a;const n=new ParseStatus;for(const s of this._def.checks)if("int"===s.kind)e.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),u(a,{code:r.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty());else if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty())}else"multipleOf"===s.kind?0!==B(t.data,s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):"finite"===s.kind?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),u(a,{code:r.not_finite,message:s.message}),n.dirty()):e.assertNever(s);return{status:n.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,a,s){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:g.toString(s)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:Q.ZodNumber,coerce:e?.coerce||!1,...Z(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==s.bigint)return this._getInvalidInput(t);let a;const n=new ParseStatus;for(const s of this._def.checks)if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty())}else"multipleOf"===s.kind?t.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):e.assertNever(s);return{status:n.value,value:t.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.bigint,received:t.parsedType}),l}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,a,s){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:g.toString(s)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>new ZodBigInt({checks:[],typeName:Q.ZodBigInt,coerce:e?.coerce??!1,...Z(e)});class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.boolean,received:t.parsedType}),l}return h(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:Q.ZodBoolean,coerce:e?.coerce||!1,...Z(e)});class ZodDate extends ZodType{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==s.date){const e=this._getOrReturnCtx(t);return u(e,{code:r.invalid_type,expected:s.date,received:e.parsedType}),l}if(Number.isNaN(t.data.getTime())){return u(this._getOrReturnCtx(t),{code:r.invalid_date}),l}const a=new ParseStatus;let n;for(const s of this._def.checks)"min"===s.kind?t.data.getTime()<s.value&&(n=this._getOrReturnCtx(t,n),u(n,{code:r.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):"max"===s.kind?t.data.getTime()>s.value&&(n=this._getOrReturnCtx(t,n),u(n,{code:r.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):e.assertNever(s);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:e?.coerce||!1,typeName:Q.ZodDate,...Z(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.symbol,received:t.parsedType}),l}return h(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:Q.ZodSymbol,...Z(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.undefined,received:t.parsedType}),l}return h(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:Q.ZodUndefined,...Z(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.null,received:t.parsedType}),l}return h(e.data)}}ZodNull.create=e=>new ZodNull({typeName:Q.ZodNull,...Z(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return h(e.data)}}ZodAny.create=e=>new ZodAny({typeName:Q.ZodAny,...Z(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return h(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:Q.ZodUnknown,...Z(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.never,received:t.parsedType}),l}}ZodNever.create=e=>new ZodNever({typeName:Q.ZodNever,...Z(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.void,received:t.parsedType}),l}return h(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:Q.ZodVoid,...Z(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==s.array)return u(t,{code:r.invalid_type,expected:s.array,received:t.parsedType}),l;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(u(t,{code:e?r.too_big:r.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(u(t,{code:r.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(u(t,{code:r.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>n.type._parseAsync(new ParseInputLazyPath(t,e,t.path,a)))).then(e=>ParseStatus.mergeArray(a,e));const i=[...t.data].map((e,a)=>n.type._parseSync(new ParseInputLazyPath(t,e,t.path,a)));return ParseStatus.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}}function K(e){if(e instanceof ZodObject){const t={};for(const a in e.shape){const s=e.shape[a];t[a]=ZodOptional.create(K(s))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:K(e.element)}):e instanceof ZodOptional?ZodOptional.create(K(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(K(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map(e=>K(e))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Q.ZodArray,...Z(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),a=e.objectKeys(t);return this._cached={shape:t,keys:a},this._cached}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.object,received:t.parsedType}),l}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const e in a.data)i.includes(e)||o.push(e);const d=[];for(const e of i){const t=n[e],s=a.data[e];d.push({key:{status:"valid",value:e},value:t._parse(new ParseInputLazyPath(a,s,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)d.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)o.length>0&&(u(a,{code:r.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const s=a.data[t];d.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(a,s,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of d){const a=await t.key,s=await t.value;e.push({key:a,value:s,alwaysSet:t.alwaysSet})}return e}).then(e=>ParseStatus.mergeObjectSync(t,e)):ParseStatus.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{const s=this._def.errorMap?.(t,a).message??a.defaultError;return"unrecognized_keys"===t.code?{message:g.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Q.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(t){const a={};for(const s of e.objectKeys(t))t[s]&&this.shape[s]&&(a[s]=this.shape[s]);return new ZodObject({...this._def,shape:()=>a})}omit(t){const a={};for(const s of e.objectKeys(this.shape))t[s]||(a[s]=this.shape[s]);return new ZodObject({...this._def,shape:()=>a})}deepPartial(){return K(this)}partial(t){const a={};for(const s of e.objectKeys(this.shape)){const e=this.shape[s];t&&!t[s]?a[s]=e:a[s]=e.optional()}return new ZodObject({...this._def,shape:()=>a})}required(t){const a={};for(const s of e.objectKeys(this.shape))if(t&&!t[s])a[s]=this.shape[s];else{let e=this.shape[s];for(;e instanceof ZodOptional;)e=e._def.innerType;a[s]=e}return new ZodObject({...this._def,shape:()=>a})}keyof(){return J(e.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:Q.ZodObject,...Z(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:Q.ZodObject,...Z(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:Q.ZodObject,...Z(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map(async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map(e=>new ZodError(e.ctx.common.issues));return u(t,{code:r.invalid_union,unionErrors:a}),l});{let e;const s=[];for(const n of a){const a={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:a});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:a}),a.common.issues.length&&s.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=s.map(e=>new ZodError(e));return u(t,{code:r.invalid_union,unionErrors:n}),l}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:Q.ZodUnion,...Z(t)});const W=t=>t instanceof ZodLazy?W(t.schema):t instanceof ZodEffects?W(t.innerType()):t instanceof ZodLiteral?[t.value]:t instanceof ZodEnum?t.options:t instanceof ZodNativeEnum?e.objectValues(t.enum):t instanceof ZodDefault?W(t._def.innerType):t instanceof ZodUndefined?[void 0]:t instanceof ZodNull?[null]:t instanceof ZodOptional?[void 0,...W(t.unwrap())]:t instanceof ZodNullable?[null,...W(t.unwrap())]:t instanceof ZodBranded||t instanceof ZodReadonly?W(t.unwrap()):t instanceof ZodCatch?W(t._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return u(t,{code:r.invalid_type,expected:s.object,received:t.parsedType}),l;const a=this.discriminator,n=t.data[a],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:r.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),l)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const s=new Map;for(const a of t){const t=W(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(s.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);s.set(n,a)}}return new ZodDiscriminatedUnion({typeName:Q.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...Z(a)})}}function q(t,a){const r=n(t),i=n(a);if(t===a)return{valid:!0,data:t};if(r===s.object&&i===s.object){const s=e.objectKeys(a),n=e.objectKeys(t).filter(e=>-1!==s.indexOf(e)),r={...t,...a};for(const e of n){const s=q(t[e],a[e]);if(!s.valid)return{valid:!1};r[e]=s.data}return{valid:!0,data:r}}if(r===s.array&&i===s.array){if(t.length!==a.length)return{valid:!1};const e=[];for(let s=0;s<t.length;s++){const n=q(t[s],a[s]);if(!n.valid)return{valid:!1};e.push(n.data)}return{valid:!0,data:e}}return r===s.date&&i===s.date&&+t===+a?{valid:!0,data:t}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),s=(e,s)=>{if(m(e)||m(s))return l;const n=q(e.value,s.value);return n.valid?((f(e)||f(s))&&t.dirty(),{status:t.value,value:n.data}):(u(a,{code:r.invalid_intersection_types}),l)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([e,t])=>s(e,t)):s(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}ZodIntersection.create=(e,t,a)=>new ZodIntersection({left:e,right:t,typeName:Q.ZodIntersection,...Z(a)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.array)return u(a,{code:r.invalid_type,expected:s.array,received:a.parsedType}),l;if(a.data.length<this._def.items.length)return u(a,{code:r.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l;!this._def.rest&&a.data.length>this._def.items.length&&(u(a,{code:r.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...a.data].map((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new ParseInputLazyPath(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(n).then(e=>ParseStatus.mergeArray(t,e)):ParseStatus.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:Q.ZodTuple,rest:null,...Z(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.object)return u(a,{code:r.invalid_type,expected:s.object,received:a.parsedType}),l;const n=[],i=this._def.keyType,o=this._def.valueType;for(const e in a.data)n.push({key:i._parse(new ParseInputLazyPath(a,e,a.path,e)),value:o._parse(new ParseInputLazyPath(a,a.data[e],a.path,e)),alwaysSet:e in a.data});return a.common.async?ParseStatus.mergeObjectAsync(t,n):ParseStatus.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:Q.ZodRecord,...Z(a)}:{keyType:ZodString.create(),valueType:e,typeName:Q.ZodRecord,...Z(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.map)return u(a,{code:r.invalid_type,expected:s.map,received:a.parsedType}),l;const n=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map(([e,t],s)=>({key:n._parse(new ParseInputLazyPath(a,e,a.path,[s,"key"])),value:i._parse(new ParseInputLazyPath(a,t,a.path,[s,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of o){const s=await a.key,n=await a.value;if("aborted"===s.status||"aborted"===n.status)return l;"dirty"!==s.status&&"dirty"!==n.status||t.dirty(),e.set(s.value,n.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of o){const s=a.key,n=a.value;if("aborted"===s.status||"aborted"===n.status)return l;"dirty"!==s.status&&"dirty"!==n.status||t.dirty(),e.set(s.value,n.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,a)=>new ZodMap({valueType:t,keyType:e,typeName:Q.ZodMap,...Z(a)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.set)return u(a,{code:r.invalid_type,expected:s.set,received:a.parsedType}),l;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(u(a,{code:r.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(u(a,{code:r.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function o(e){const a=new Set;for(const s of e){if("aborted"===s.status)return l;"dirty"===s.status&&t.dirty(),a.add(s.value)}return{status:t.value,value:a}}const d=[...a.data.values()].map((e,t)=>i._parse(new ParseInputLazyPath(a,e,a.path,t)));return a.common.async?Promise.all(d).then(e=>o(e)):o(d)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:Q.ZodSet,...Z(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return u(t,{code:r.invalid_type,expected:s.function,received:t.parsedType}),l;function a(e,a){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),i].filter(e=>!!e),issueData:{code:r.invalid_arguments,argumentsError:a}})}function n(e,a){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),i].filter(e=>!!e),issueData:{code:r.invalid_return_type,returnTypeError:a}})}const o={errorMap:t.common.contextualErrorMap},p=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return h(async function(...t){const s=new ZodError([]),r=await e._def.args.parseAsync(t,o).catch(e=>{throw s.addIssue(a(t,e)),s}),i=await Reflect.apply(p,this,r);return await e._def.returns._def.type.parseAsync(i,o).catch(e=>{throw s.addIssue(n(i,e)),s})})}{const e=this;return h(function(...t){const s=e._def.args.safeParse(t,o);if(!s.success)throw new ZodError([a(t,s.error)]);const r=Reflect.apply(p,this,s.data),i=e._def.returns.safeParse(r,o);if(!i.success)throw new ZodError([n(r,i.error)]);return i.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:Q.ZodFunction,...Z(a)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:Q.ZodLazy,...Z(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:r.invalid_literal,expected:this._def.value}),l}return{status:"valid",value:e.data}}get value(){return this._def.value}}function J(e,t){return new ZodEnum({values:e,typeName:Q.ZodEnum,...Z(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:Q.ZodLiteral,...Z(t)});class ZodEnum extends ZodType{_parse(t){if("string"!=typeof t.data){const a=this._getOrReturnCtx(t),s=this._def.values;return u(a,{expected:e.joinValues(s),received:a.parsedType,code:r.invalid_type}),l}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const e=this._getOrReturnCtx(t),a=this._def.values;return u(e,{received:e.data,code:r.invalid_enum_value,options:a}),l}return h(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ZodEnum.create=J;class ZodNativeEnum extends ZodType{_parse(t){const a=e.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==s.string&&n.parsedType!==s.number){const t=e.objectValues(a);return u(n,{expected:e.joinValues(t),received:n.parsedType,code:r.invalid_type}),l}if(this._cache||(this._cache=new Set(e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const t=e.objectValues(a);return u(n,{received:n.data,code:r.invalid_enum_value,options:t}),l}return h(t.data)}get enum(){return this._def.values}}ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:Q.ZodNativeEnum,...Z(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return u(t,{code:r.invalid_type,expected:s.promise,received:t.parsedType}),l;const a=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return h(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:Q.ZodPromise,...Z(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:s}=this._processInputParams(t),n=this._def.effect||null,r={addIssue:e=>{u(s,e),e.fatal?a.abort():a.dirty()},get path(){return s.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(s.data,r);if(s.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===a.value)return l;const t=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===t.status?l:"dirty"===t.status||"dirty"===a.value?p(t.value):t});{if("aborted"===a.value)return l;const t=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===t.status?l:"dirty"===t.status||"dirty"===a.value?p(t.value):t}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const t=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===t.status?l:("dirty"===t.status&&a.dirty(),e(t.value),{status:a.value,value:t.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(t=>"aborted"===t.status?l:("dirty"===t.status&&a.dirty(),e(t.value).then(()=>({status:a.value,value:t.value}))))}if("transform"===n.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!y(e))return l;const t=n.transform(e.value,r);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:t}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(e=>y(e)?Promise.resolve(n.transform(e.value,r)).then(e=>({status:a.value,value:e})):l)}e.assertNever(n)}}ZodEffects.create=(e,t,a)=>new ZodEffects({schema:e,typeName:Q.ZodEffects,effect:t,...Z(a)}),ZodEffects.createWithPreprocess=(e,t,a)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:Q.ZodEffects,...Z(a)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===s.undefined?h(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:Q.ZodOptional,...Z(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===s.null?h(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:Q.ZodNullable,...Z(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===s.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:Q.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Z(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return _(s)?s.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new ZodError(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:Q.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Z(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.nan,received:t.parsedType}),l}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:Q.ZodNaN,...Z(e)});const Y=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?l:"dirty"===e.status?(t.dirty(),p(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?l:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:Q.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),a=e=>(y(e)&&(e.value=Object.freeze(e.value)),e);return _(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}}function H(e,t){const a="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof a?{message:a}:a}function G(e,t={},a){return e?ZodAny.create().superRefine((s,n)=>{const r=e(s);if(r instanceof Promise)return r.then(e=>{if(!e){const e=H(t,s),r=e.fatal??a??!0;n.addIssue({code:"custom",...e,fatal:r})}});if(!r){const e=H(t,s),r=e.fatal??a??!0;n.addIssue({code:"custom",...e,fatal:r})}}):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:Q.ZodReadonly,...Z(t)});const X={object:ZodObject.lazycreate};var Q;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Q||(Q={}));const ee=(e,t={message:`Input not instance of ${e.name}`})=>G(t=>t instanceof e,t),te=ZodString.create,ae=ZodNumber.create,se=ZodNaN.create,ne=ZodBigInt.create,re=ZodBoolean.create,ie=ZodDate.create,oe=ZodSymbol.create,de=ZodUndefined.create,ce=ZodNull.create,ue=ZodAny.create,le=ZodUnknown.create,pe=ZodNever.create,he=ZodVoid.create,me=ZodArray.create,fe=ZodObject.create,ye=ZodObject.strictCreate,_e=ZodUnion.create,ge=ZodDiscriminatedUnion.create,ve=ZodIntersection.create,Ze=ZodTuple.create,be=ZodRecord.create,ke=ZodMap.create,xe=ZodSet.create,we=ZodFunction.create,Te=ZodLazy.create,Ne=ZodLiteral.create,Oe=ZodEnum.create,Se=ZodNativeEnum.create,Ae=ZodPromise.create,Ee=ZodEffects.create,je=ZodOptional.create,Ce=ZodNullable.create,Pe=ZodEffects.createWithPreprocess,Ie=ZodPipeline.create,Re={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},Le=l;var $e=Object.freeze({__proto__:null,BRAND:Y,DIRTY:p,EMPTY_PATH:[],INVALID:l,NEVER:Le,OK:h,ParseStatus,Schema:ZodType,ZodAny,ZodArray,ZodBigInt,ZodBoolean,ZodBranded,ZodCatch,ZodDate,ZodDefault,ZodDiscriminatedUnion,ZodEffects,ZodEnum,ZodError,get ZodFirstPartyTypeKind(){return Q},ZodFunction,ZodIntersection,ZodIssueCode:r,ZodLazy,ZodLiteral,ZodMap,ZodNaN,ZodNativeEnum,ZodNever,ZodNull,ZodNullable,ZodNumber,ZodObject,ZodOptional,ZodParsedType:s,ZodPipeline,ZodPromise,ZodReadonly,ZodRecord,ZodSchema:ZodType,ZodSet,ZodString,ZodSymbol,ZodTransformer:ZodEffects,ZodTuple,ZodType,ZodUndefined,ZodUnion,ZodUnknown,ZodVoid,addIssueToContext:u,any:ue,array:me,bigint:ne,boolean:re,coerce:Re,custom:G,date:ie,datetimeRegex:D,defaultErrorMap:i,discriminatedUnion:ge,effect:Ee,enum:Oe,function:we,getErrorMap:d,getParsedType:n,instanceof:ee,intersection:ve,isAborted:m,isAsync:_,isDirty:f,isValid:y,late:X,lazy:Te,literal:Ne,makeIssue:c,map:ke,nan:se,nativeEnum:Se,never:pe,null:ce,nullable:Ce,number:ae,object:fe,get objectUtil(){return t},oboolean:()=>re().optional(),onumber:()=>ae().optional(),optional:je,ostring:()=>te().optional(),pipeline:Ie,preprocess:Pe,promise:Ae,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),record:be,set:xe,setErrorMap:function(e){o=e},strictObject:ye,string:te,symbol:oe,transformer:Ee,tuple:Ze,undefined:de,union:_e,unknown:le,get util(){return e},void:he});export{me as a,Se as b,re as c,_e as d,Oe as e,ce as f,Ne as g,ue as h,ee as i,a as l,ae as n,fe as o,be as r,te as s,le as u,$e as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t,n){return{queryKey:["appointments",t.id],queryFn:()=>e.appointments.getAppointment(t),...n}}function t(e,t){return{queryKey:["patient-profile"],queryFn:()=>e.profile.getPatientProfile(),...t}}export{e as a,t as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,t}from"./custom-element-DA9Fxvxd.js";import{m as a}from"./runtime-Bg1WXVCx.js";import{t as r,c as n,n as s,g as o,p as i,a as l,s as d,l as c}from"./parseISO-jT42c8Ob.js";import{i as v,a as h,x as u}from"./lit-element-DiWJYFwC.js";import{n as p}from"./property-scuRaFcM.js";import{r as g}from"./state-LQivXIgA.js";import{e as m}from"./class-map-Co76I6aw.js";import{chevronLeftIcon as y}from"../ui/icons/chevron-left-icon.js";import{chevronRightIcon as b}from"../ui/icons/chevron-right-icon.js";import{spinnerIcon as f}from"../ui/icons/spinner-icon.js";import{i as D}from"./isSameDay-DPfclwIL.js";import{i as k}from"./isBefore-Cof0D841.js";function w(e,t,a){const s=r(e,a?.in);if(isNaN(t))return n(e,NaN);if(!t)return s;const o=s.getDate(),i=n(e,s.getTime());i.setMonth(s.getMonth()+t+1,0);return o>=i.getDate()?i:(s.setFullYear(i.getFullYear(),i.getMonth(),o),s)}function M(e,t){const a=r(e,t?.in),n=a.getMonth();return a.setFullYear(a.getFullYear(),n+1,0),a.setHours(23,59,59,999),a}function S(e,t){const{start:a,end:r}=function(e,t){const[a,r]=s(e,t.start,t.end);return{start:a,end:r}}(t?.in,e);let o=+a>+r;const i=o?+a:+r,l=o?r:a;l.setHours(0,0,0,0);const d=[];for(;+l<=i;)d.push(n(a,l)),l.setDate(l.getDate()+1),l.setHours(0,0,0,0);return o?d.reverse():d}function x(e,t){const a=r(e,t?.in);return a.setDate(1),a.setHours(0,0,0,0),a}function E(e,t){const a=o(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=r(e,t?.in),i=s.getDay(),l=6+(i<n?-7:0)-(i-n);return s.setDate(s.getDate()+l),s.setHours(23,59,59,999),s}function j(e,t){return+r(e)>+r(t)}function $(e,t){return D(n(e,e),function(e){return n(e,Date.now())}(e))}const N=v`:host{display:block;font-family:var(--font-body)}.calendar{background:var(--color-card);border-radius:var(--border-radius-lg);user-select:none}.calendar-header{display:flex;align-items:center;justify-content:space-between;background:var(--color-primary-background-extraWeak);padding:var(--sp-4);border-radius:var(--border-radius-lg) var(--border-radius-lg) 0 0}.calendar-header-title{font-family:var(--font-titles);font-size:var(--text-lg);font-weight:var(--font-weight-bold);color:var(--color-gray-darkest)}.calendar-body{position:relative;transition:opacity .2s}.calendar-body.loading{opacity:.4;pointer-events:none}.calendar-nav{display:flex;gap:var(--sp-2)}.calendar-nav-button{display:flex;align-items:center;justify-content:center;width:var(--size-8);height:var(--size-8);border:none;background:0 0;border-radius:var(--border-radius-md);cursor:pointer;transition:background-color .2s;color:var(--color-gray-darkest);padding:0}.calendar-nav-button:hover{background:var(--color-background-primary-light)}.calendar-nav-button:disabled{opacity:.3;cursor:not-allowed}.calendar-weekdays{display:grid;grid-template-columns:repeat(7,var(--sp-11));justify-content:space-between;padding:var(--sp-4) var(--sp-4) var(--sp-2) var(--sp-4)}.calendar-weekday{text-align:center;font-size:var(--text-sm);font-weight:var(--font-weight-bold);color:var(--color-gray-darkest);padding:var(--sp-2)}.calendar-days{display:grid;gap:var(--sp-1);grid-template-columns:repeat(7,var(--sp-11));justify-content:space-between;padding:0 var(--sp-4) var(--sp-4) var(--sp-4)}.calendar-day{width:var(--sp-11);height:var(--sp-11);display:flex;align-items:center;justify-content:center;border:none;background:0 0;border-radius:var(--border-radius-full);cursor:pointer;font-family:var(--font-body);font-size:var(--text-sm);font-weight:var(--font-weight-medium);color:var(--color-gray-darkest);transition:all .2s;padding:0;position:relative}.calendar-day:hover:not(:disabled):not(.other-month){background:var(--color-gray-lighter)}.calendar-day.other-month{color:var(--color-gray-medium);background:0 0}.calendar-day:disabled{color:var(--color-gray-medium);background:0 0;cursor:not-allowed}.calendar-day.available:not(.selected){background:var(--color-primary);color:var(--color-white);font-weight:var(--font-weight-semibold)}.calendar-day.available:hover:not(:disabled):not(.selected){background:var(--color-primary-dark)}.calendar-day.selected{background:var(--color-primary);color:var(--color-white);font-weight:var(--font-weight-bold)}.calendar-day.selected:hover:not(:disabled){background:var(--color-primary-dark)}.calendar-day-empty{width:var(--sp-11);height:var(--sp-11)}.calendar-spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;pointer-events:none;z-index:10}@media (min-width:640px){.calendar-weekdays{gap:var(--sp-2)}.calendar-days{gap:var(--sp-2)}}@media (min-width:768px){.calendar-weekdays{gap:var(--sp-3)}.calendar-days{gap:var(--sp-3)}}@media (min-width:1024px){.calendar-weekdays{gap:var(--sp-4)}.calendar-days{gap:var(--sp-4)}}`;class DateSelectEvent extends Event{static{this.eventName="date-select"}constructor(e){super(DateSelectEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class PrevMonthEvent extends Event{static{this.eventName="prev-month"}constructor(e){super(PrevMonthEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class NextMonthEvent extends Event{static{this.eventName="next-month"}constructor(e){super(NextMonthEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}let C=class MqCalendar extends h{constructor(){super(...arguments),this.locale="es-ES",this.isLoading=!1,this.handlePrevMonth=()=>{const e=this.getCurrentMonthDate(),t=w(e,-1,a);var a;this.dispatchEvent(new PrevMonthEvent({currentMonth:t.toISOString()}))},this.handleNextMonth=()=>{const e=w(this.getCurrentMonthDate(),1);this.dispatchEvent(new NextMonthEvent({currentMonth:e.toISOString()}))},this.handleDayClick=e=>{e.isDisabled||(this.selectedDate=e.date,this.value=e.date.toISOString(),this.dispatchEvent(new DateSelectEvent({date:e.date.toISOString()})),this.requestUpdate())}}static{this.styles=[N]}connectedCallback(){super.connectedCallback(),this.value&&(this.selectedDate=i(this.value))}getMonthYear(){const e=this.getCurrentMonthDate();return new Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(e)}getCurrentMonthDate(){return this.currentMonth?i(this.currentMonth):new Date}getWeekdays(){const e=l(new Date(2024,0,1),{weekStartsOn:1}),t=S({start:e,end:E(e,{weekStartsOn:1})}),a=new Intl.DateTimeFormat(this.locale,{weekday:"narrow"});return t.map(e=>a.format(e).toUpperCase())}getDaysInMonth(){const e=this.getCurrentMonthDate(),t=x(e),a=M(e);return S({start:l(t,{weekStartsOn:1}),end:E(a,{weekStartsOn:1})}).map(t=>{const a=function(e,t,a){const[r,n]=s(a?.in,e,t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}(t,e);return this.createCalendarDay(t,a)})}createCalendarDay(e,t){const a=d(e),r=$(a),n=this.isDateAvailable(a);return{date:a,isCurrentMonth:t,isToday:r,isDisabled:this.isDateDisabled(a,n),isSelected:!!this.selectedDate&&D(a,this.selectedDate),isAvailable:n}}isDateAvailable(e){if(!this.availableDays||0===this.availableDays.length)return!1;const t=d(e);return this.availableDays.some(e=>{const a=d(i(e));return D(t,a)})}isDateDisabled(e,t){const a=d(e);if(this.availableDays&&this.availableDays.length>0)return!t;if(this.minDate){const e=d(i(this.minDate));if(k(a,e))return!0}if(this.maxDate){if(j(a,d(i(this.maxDate))))return!0}return!1}render(){const e=this.getDaysInMonth(),t=this.getWeekdays();return u`<div class="calendar"><div class="calendar-header"><button class="calendar-nav-button" @click="${this.handlePrevMonth}" aria-label="${a("Mes anterior")}">${y({size:24})}</button><div class="calendar-header-title">${this.getMonthYear()}</div><button class="calendar-nav-button" @click="${this.handleNextMonth}" aria-label="${a("Mes siguiente")}">${b({size:24})}</button></div><div class="calendar-body ${this.isLoading?"loading":""}"><div class="calendar-weekdays">${t.map(e=>u`<div class="calendar-weekday">${e}</div>`)}</div><div class="calendar-days">${e.map(e=>e.isCurrentMonth?u`<button class="${m({"calendar-day":!0,"other-month":!e.isCurrentMonth,today:e.isToday,selected:e.isSelected,available:e.isAvailable})}" ?disabled="${e.isDisabled||this.isLoading}" @click="${()=>this.handleDayClick(e)}" aria-label="${e.date.toLocaleDateString(this.locale)}">${e.date.getDate()}</button>`:u`<div class="calendar-day-empty"></div>`)}</div>${this.isLoading?u`<div class="calendar-spinner">${f({size:40,color:"var(--color-primary)"})}</div>`:""}</div></div>`}};e([p({type:String})],C.prototype,"locale",void 0),e([p({type:String,attribute:"min-date"})],C.prototype,"minDate",void 0),e([p({type:String,attribute:"max-date"})],C.prototype,"maxDate",void 0),e([p({type:String})],C.prototype,"value",void 0),e([p({type:Boolean,attribute:"is-loading"})],C.prototype,"isLoading",void 0),e([p({type:String,attribute:"current-month"})],C.prototype,"currentMonth",void 0),e([p({type:Array,attribute:"available-days"})],C.prototype,"availableDays",void 0),e([g()],C.prototype,"selectedDate",void 0),C=e([c(),t("mq-calendar")],C);export{DateSelectEvent as D,C as M,NextMonthEvent as N,PrevMonthEvent as P,M as e,j as i,x as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as t,t as e}from"./custom-element-DA9Fxvxd.js";import{x as a,i,a as s}from"./lit-element-DiWJYFwC.js";import{n as r}from"./property-scuRaFcM.js";import{e as o}from"./class-map-Co76I6aw.js";import{t as n,c as l,p as d,s as c,l as h}from"./parseISO-jT42c8Ob.js";import{f as m}from"./format-Cm3B1GMy.js";import"../ui/mq-skeleton.js";import{m as v}from"./runtime-Bg1WXVCx.js";import{i as p}from"./isSameDay-DPfclwIL.js";function u(t,e,a){const i=n(t,a?.in);return isNaN(e)?l(t,NaN):e?(i.setDate(i.getDate()+e),i):i}function g(t,e){const a=d(t);if(e)try{const t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(a),i=e=>t.find(t=>t.type===e)?.value??"";return{dateKey:`${i("year")}-${i("month")}-${i("day")}`,label:`${i("hour")}:${i("minute")}`}}catch{}return{dateKey:m(c(a),"yyyy-MM-dd"),label:m(a,"HH:mm")}}const y=i`:host{display:block;font-family:var(--font-body)}.time-slot-picker{display:flex;flex-direction:column;gap:var(--sp-4);border-radius:var(--border-radius-lg);transition:opacity .2s}.time-slot-picker.is-loading{opacity:.6}.picker-content{display:flex;flex-direction:column;gap:var(--sp-4)}.columns-wrapper{position:relative;display:flex;flex-direction:column;gap:var(--sp-4);flex:1;min-width:0}.grid-container{display:grid;grid-template-columns:repeat(var(--visible-days,4),1fr);gap:var(--sp-2);position:relative}.dates-header{position:sticky;top:0;display:contents;z-index:10;padding-bottom:var(--sp-2)}.nav-button{position:absolute;top:var(--sp-9);transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:var(--size-6);height:var(--size-6);border:none;cursor:pointer;transition:background-color .2s;background:var(--color-primary);color:var(--color-white);border-radius:var(--border-radius-full);padding:0;z-index:20}.nav-button-prev{left:0;transform:translate(-50%,-50%)}.nav-button-next{right:0;transform:translate(50%,-50%)}.nav-button:hover:not(:disabled){background:var(--color-primary-dark)}.nav-button:disabled{background:var(--color-neutrals-background-disabled);color:var(--color-neutrals-text-medium);cursor:not-allowed}.date-card{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--sp-2) var(--sp-3);border:1px solid var(--color-neutrals-border-disabled);background:var(--color-white);border-radius:var(--border-radius-lg);transition:all .2s;min-width:var(--sp-16);height:var(--sp-18);flex:1}.date-weekday{font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);text-transform:capitalize}.date-day{font-size:var(--text-xl);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default)}.date-month{font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);text-transform:capitalize}.time-slots-container{display:contents}.time-slots-column{display:flex;flex-direction:column;gap:var(--sp-2)}.time-slot{padding:var(--sp-2) var(--sp-1);border:1px solid var(--color-border);background:var(--color-muted);border-radius:var(--border-radius-md);cursor:pointer;transition:all .2s;font-family:var(--font-body);font-size:var(--text-sm);font-weight:var(--font-weight-medium);color:var(--color-neutrals-text-default);text-align:center;min-width:var(--sp-16);height:var(--sp-11)}.time-slot:hover{background:var(--color-primary-light)}.time-slot.selected{border-color:var(--color-primary);background:var(--color-primary);color:var(--color-white);font-weight:var(--font-weight-bold)}.empty-state{display:flex;align-items:center;justify-content:center;padding:var(--sp-12) var(--sp-6);text-align:center;grid-column:1/-1;font-size:var(--text-sm);color:var(--color-neutrals-text-weak)}`;class WindowChangeEvent extends Event{static{this.eventName="window-change"}constructor(t){super(WindowChangeEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class SlotSelectEvent extends Event{static{this.eventName="slot-select"}constructor(t){super(SlotSelectEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let f=class MqTimeSlotPicker extends s{constructor(){super(...arguments),this.locale="es-ES",this.slots=[],this.visibleDays=4,this.isLoading=!1,this.handlePrevious=()=>{if(!this.canGoPrevious)return;const t=u(this.getStartDate(),-this.visibleDays),e=c(new Date),a=t<e?e:t,i=this.formatDate(a);this.dispatchEvent(new WindowChangeEvent({windowStartDate:i}))},this.handleNext=()=>{const t=u(this.getStartDate(),this.visibleDays),e=this.formatDate(t);this.dispatchEvent(new WindowChangeEvent({windowStartDate:e}))},this.handleTimeSlotSelect=(t,e)=>{const a=this.formatDate(t.date);this.selectedDate=a,this.selectedSlotKey=e.key,this.dispatchEvent(new SlotSelectEvent({slot:{key:e.key,date:e.date}}))}}static{this.styles=[y]}getStartDate(){return this.windowStartDate?c(d(this.windowStartDate)):c(new Date)}get slotsByDate(){const t=new Map;for(const e of this.slots){const{dateKey:a,label:i}=g(e.date,this.timezone);t.has(a)||t.set(a,[]),t.get(a)?.push({key:e.key,label:i,date:e.date})}for(const e of t.values())e.sort((t,e)=>{const a=d(t.date),i=d(e.date);return a.getTime()-i.getTime()});return t}get visibleDaysList(){const t=this.getStartDate(),e=[],a=this.slotsByDate;for(let i=0;i<this.visibleDays;i++){const s=u(t,i),r=this.formatDate(s),o=a.get(r)||[];e.push({date:s,slots:o})}return e}get canGoPrevious(){return this.getStartDate()>c(new Date)}formatDate(t){return m(t,"yyyy-MM-dd")}formatDayHeader(t){return{weekday:new Intl.DateTimeFormat(this.locale,{weekday:"short"}).format(t),day:new Intl.DateTimeFormat(this.locale,{day:"numeric"}).format(t),month:new Intl.DateTimeFormat(this.locale,{month:"short"}).format(t)}}isDateSelected(t){if(!this.selectedDate)return!1;const e=d(this.selectedDate);return p(t,e)}isTimeSlotSelected(t,e){return this.isDateSelected(t.date)&&this.selectedSlotKey===e.key}get hasSlots(){return this.slots.length>0}renderSkeletonSlots(){return a`${Array.from({length:this.visibleDays}).map((t,e)=>{const i=[2,3,4,3],s=i[e%i.length]??3;return a`<div class="time-slots-column">${Array.from({length:s}).map(()=>a`<mq-skeleton width="100%" height="40px" border-radius="md"></mq-skeleton>`)}</div>`})}`}renderEmptyState(){return a`<div class="empty-state">${v("No hay horarios disponibles")}</div>`}render(){const t=this.canGoPrevious,e=!this.isLoading&&!this.hasSlots;return a`<div class="${o({"time-slot-picker":!0,"is-loading":this.isLoading})}" style="--visible-days:${this.visibleDays}"><div class="picker-content"><div class="columns-wrapper">${t?a`<button class="nav-button nav-button-prev" @click="${this.handlePrevious}" ?disabled="${this.isLoading}" aria-label="${v("Fechas anteriores")}">${a`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1510_1791)"><path d="M8.05454 11.9155L2.72136 6.29527C2.69487 6.26742 2.67385 6.23433 2.65951 6.19791C2.64517 6.16149 2.63779 6.12245 2.63779 6.08302C2.63779 6.04359 2.64517 6.00454 2.65951 5.96812C2.67385 5.9317 2.69487 5.89862 2.72136 5.87077L8.2124 0.0844726L8.61523 0.508968L3.32539 6.08302L8.45738 11.491L8.05454 11.9155Z" fill="currentColor"/></g><defs><clipPath id="clip0_1510_1791"><rect width="11.831" height="11.2273" fill="currentColor" transform="translate(11.2402 0.0844727) rotate(90)"/></clipPath></defs></svg>`}</button>`:null} ${a`<button class="nav-button nav-button-next" @click="${this.handleNext}" ?disabled="${this.isLoading}" aria-label="${v("Fechas siguientes")}">${a`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1510_474)"><path d="M3.94546 0.0845423L9.27864 5.70473C9.30513 5.73258 9.32615 5.76566 9.34049 5.80209C9.35483 5.83851 9.36221 5.87755 9.36221 5.91698C9.36221 5.95641 9.35483 5.99546 9.34049 6.03188C9.32615 6.0683 9.30513 6.10138 9.27864 6.12923L3.7876 11.9155L3.38477 11.491L8.67461 5.91698L3.54262 0.509039L3.94546 0.0845423Z" fill="currentColor"/></g><defs><clipPath id="clip0_1510_474"><rect width="11.831" height="11.2273" fill="currentColor" transform="translate(0.759766 11.9155) rotate(-90)"/></clipPath></defs></svg>`}</button>`}<div class="grid-container"><div class="dates-header">${this.visibleDaysList.map(t=>{const{weekday:e,day:i,month:s}=this.formatDayHeader(t.date);return a`<div class="date-card"><div class="date-weekday">${e}</div><div class="date-day">${i}</div><div class="date-month">${s}</div></div>`})}</div><div class="time-slots-container">${e?this.renderEmptyState():this.isLoading?this.renderSkeletonSlots():this.visibleDaysList.map(t=>{const e=this.isDateSelected(t.date);return a`<div class="${o({"time-slots-column":!0,active:e})}">${t.slots.map(e=>{const i=this.isTimeSlotSelected(t,e);return a`<button class="${o({"time-slot":!0,selected:i})}" @click="${()=>this.handleTimeSlotSelect(t,e)}">${e.label}</button>`})}</div>`})}</div></div></div></div></div>`}};t([r({type:String})],f.prototype,"locale",void 0),t([r({type:String})],f.prototype,"timezone",void 0),t([r({type:Array})],f.prototype,"slots",void 0),t([r({type:String,attribute:"selected-date"})],f.prototype,"selectedDate",void 0),t([r({type:String,attribute:"selected-slot-key"})],f.prototype,"selectedSlotKey",void 0),t([r({type:String,attribute:"window-start-date"})],f.prototype,"windowStartDate",void 0),t([r({type:Number,attribute:"visible-days"})],f.prototype,"visibleDays",void 0),t([r({type:Boolean,attribute:"is-loading"})],f.prototype,"isLoading",void 0),f=t([h(),e("mq-time-slot-picker")],f);export{f as M,SlotSelectEvent as S,WindowChangeEvent as W,u as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as r}from"./parseISO-jT42c8Ob.js";function t(t,o){return+r(t)<+r(o)}export{t as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as t,t as o}from"./custom-element-DA9Fxvxd.js";import{m as C}from"./runtime-Bg1WXVCx.js";import{l as a}from"./parseISO-jT42c8Ob.js";import{a as r,i as n,x as e}from"./lit-element-DiWJYFwC.js";import{n as i}from"./property-scuRaFcM.js";let d=class MQLayout extends r{constructor(){super(...arguments),this.background="default",this.variant="default",this.showMediquoBranding=!0}static{this.styles=n`:host{--content-max-width:560px;display:flex;flex-direction:column;height:100%;width:100%;max-width:var(--content-max-width);margin:0 auto;background-color:var(--color-background)}:host([background=solid]){background-color:var(--color-background)}:host([background=transparent]){background-color:transparent}:host([variant=wide]){--content-max-width:1000px}.content{flex:1;padding:var(--mq-layout-padding,0)}footer{display:flex;flex-direction:column;align-items:center;gap:var(--sp-4);padding-top:var(--sp-10);padding-bottom:var(--sp-3);padding-inline:var(--mq-layout-padding,0);margin-bottom:var(--sp-3);text-align:center}.branding{display:flex;justify-content:center;align-items:center;gap:var(--size-2);font-family:var(--font-body);font-size:var(--text-sm);line-height:normal;font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default)}`}render(){return this.showMediquoBranding?e`<div class="content"><slot></slot></div><footer><div class="branding">${C("Servicio y plataforma prestados por")} ${e`<svg width="82" height="16" viewBox="0 0 82 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M52.4506 8.97739V10.5665C52.4506 11.1054 52.0077 11.5477 51.4682 11.5477C50.9288 11.5477 50.486 11.1054 50.486 10.5665V8.97739H48.8531C48.3276 8.97739 47.8984 8.54894 47.8984 8.02383C47.8984 7.49893 48.3276 7.07053 48.8531 7.07053H50.486V5.48128C50.486 4.94243 50.9288 4.5002 51.4682 4.5002C52.0077 4.5002 52.4506 4.94243 52.4506 5.48128V7.07053H54.0836C54.609 7.07053 55.0379 7.49893 55.0379 8.02383C55.0379 8.54894 54.609 8.97739 54.0836 8.97739H52.4506ZM56.8563 5.46693C56.055 3.75203 54.5229 2.55033 52.6531 2.16979C52.3272 2.10809 51.9339 2.06818 51.5273 2.05679C48.7327 2.10005 46.4191 3.93204 45.7665 6.6209C45.397 8.13705 45.6843 9.78156 46.555 11.134C47.4258 12.4867 48.8053 13.431 50.3396 13.7243C51.7168 13.9883 53.0199 13.8046 54.2312 13.1767L54.2853 13.1506C54.554 13.0306 54.8304 12.9977 55.1481 13.0559L55.2243 13.0728C55.8277 13.2312 56.4308 13.389 57.0345 13.5467C56.8787 12.9784 56.7231 12.4168 56.5656 11.86L56.5512 11.8035C56.4673 11.4258 56.5163 11.0837 56.7011 10.7579C57.5947 9.11014 57.6548 7.17549 56.8563 5.46693ZM59.2901 15.5846C59.0891 15.8486 58.7811 16 58.4446 16C58.2872 16 58.1621 15.967 58.0617 15.9405L57.0944 15.6878C56.3739 15.4997 55.6553 15.312 54.936 15.1233C53.8594 15.6379 52.7204 15.8988 51.5464 15.8988C51.0243 15.8988 50.4877 15.8466 49.9521 15.7439C47.8668 15.3452 45.9973 14.0703 44.823 12.2461C43.6488 10.4223 43.2634 8.19505 43.7656 6.13553C44.6446 2.51324 47.7615 0.0472629 51.5211 0.000260881L51.5409 0L51.5605 0.000391321C52.0913 0.0140876 52.5926 0.0651767 53.0508 0.152094C55.5798 0.666768 57.6424 2.28597 58.7224 4.59729C59.7655 6.82947 59.7232 9.34593 58.6144 11.5401C58.8921 12.5275 59.1643 13.5268 59.4414 14.5471C59.4869 14.7106 59.6124 15.1611 59.2901 15.5846ZM79.7577 8.77869C79.7577 7.05748 78.5162 5.63246 76.7557 5.63246C74.9582 5.63246 73.8092 7.03887 73.8092 8.7416V8.77869C73.8092 10.4814 75.0508 11.9064 76.7927 11.9064C78.6089 11.9064 79.7577 10.4999 79.7577 8.81573V8.77869ZM76.7557 13.868C73.7722 13.868 71.5669 11.5915 71.5669 8.81573V8.77869C71.5669 5.98404 73.7907 3.67068 76.7927 3.67068C79.7949 3.67068 82 5.94717 82 8.7416V8.77869C82 11.5545 79.7764 13.868 76.7557 13.868ZM68.7934 13.7387C68.1816 13.7387 67.6628 13.2571 67.6628 12.6281V12.1285C67.0328 13.0538 66.1247 13.8495 64.6051 13.8495C62.4 13.8495 61.1213 12.3691 61.1213 10.0925V4.89208C61.1213 4.2631 61.6216 3.76329 62.2331 3.76329C62.8633 3.76329 63.3637 4.2631 63.3637 4.89208V9.42637C63.3637 10.944 64.1233 11.7951 65.4575 11.7951C66.7547 11.7951 67.6628 10.9071 67.6628 9.38919V4.89208C67.6628 4.2631 68.1631 3.76329 68.7934 3.76329C69.4048 3.76329 69.9236 4.2631 69.9236 4.89208V12.6281C69.9236 13.2386 69.4233 13.7387 68.7934 13.7387ZM40.4153 3.76329C41.0454 3.76329 41.5457 4.2631 41.5457 4.89208V12.6281C41.5457 13.2571 41.0454 13.7387 40.4153 13.7387C39.8038 13.7387 39.3034 13.2571 39.3034 12.6281V4.89208C39.3034 4.2631 39.7852 3.76329 40.4153 3.76329ZM40.4153 2.4678C39.6925 2.4678 39.1368 2.02361 39.1368 1.35732V1.2464C39.1368 0.580156 39.6925 0.154442 40.4153 0.154442C41.1379 0.154442 41.694 0.580156 41.694 1.2464V1.35732C41.694 2.02361 41.1379 2.4678 40.4153 2.4678ZM34.7693 8.7416C34.7693 6.85382 33.435 5.6139 31.9339 5.6139C30.3961 5.6139 29.1173 6.79821 29.1173 8.7416V8.77869C29.1173 10.6665 30.4145 11.9064 31.9339 11.9064C33.435 11.9064 34.7693 10.6476 34.7693 8.77869V8.7416ZM35.8627 13.7387C35.2325 13.7387 34.7321 13.2571 34.7321 12.6281V12.0172C34.0095 13.0353 32.9903 13.8495 31.3966 13.8495C29.0988 13.8495 26.8566 12.0172 26.8566 8.77869V8.7416C26.8566 5.50298 29.0616 3.67068 31.3966 3.67068C33.0088 3.67068 34.028 4.4665 34.7321 5.39189V1.15383C34.7321 0.524632 35.2325 0.0434802 35.8439 0.0434802C36.4742 0.0434802 36.9745 0.524632 36.9745 1.15383V12.6281C36.9745 13.2571 36.4742 13.7387 35.8627 13.7387ZM21.0065 5.50298C19.6353 5.50298 18.6718 6.55763 18.4678 8.07548H23.4897C23.3416 6.63203 22.4892 5.50298 21.0065 5.50298ZM24.6203 9.55589H18.4864C18.7272 11.1477 19.8578 12.0357 21.3032 12.0357C22.2482 12.0357 22.9895 11.7028 23.6196 11.1846C23.7863 11.0548 23.9346 10.981 24.194 10.981C24.6945 10.981 25.0836 11.3698 25.0836 11.8879C25.0836 12.1654 24.9539 12.406 24.787 12.5727C23.8975 13.3683 22.7858 13.868 21.2662 13.868C18.4308 13.868 16.244 11.8136 16.244 8.79712V8.76021C16.244 5.96556 18.227 3.67068 21.0253 3.67068C24.1384 3.67068 25.6765 6.22475 25.6765 8.48246C25.6765 9.1117 25.1948 9.55589 24.6203 9.55589ZM13.7686 13.7387C13.1387 13.7387 12.6382 13.2571 12.6382 12.6281V8.09396C12.6382 6.53915 11.9155 5.70655 10.6555 5.70655C9.43232 5.70655 8.56142 6.55763 8.56142 8.13083V12.6281C8.56142 13.2571 8.06108 13.7387 7.44958 13.7387C6.81941 13.7387 6.3192 13.2571 6.3192 12.6281V8.07548C6.3192 6.55763 5.57796 5.70655 4.33625 5.70655C3.09479 5.70655 2.24235 6.63203 2.24235 8.13083V12.6281C2.24235 13.2571 1.74205 13.7387 1.1118 13.7387C0.500341 13.7387 0 13.2571 0 12.6281V4.89208C0 4.2631 0.481844 3.76329 1.1118 3.76329C1.74205 3.76329 2.24235 4.2631 2.24235 4.89208V5.35475C2.87235 4.48511 3.72475 3.67068 5.22586 3.67068C6.63431 3.67068 7.63481 4.35545 8.15378 5.39189C8.93198 4.35545 9.96987 3.67068 11.4522 3.67068C13.5833 3.67068 14.8804 5.02183 14.8804 7.40919V12.6281C14.8804 13.2571 14.3988 13.7387 13.7686 13.7387Z" fill="#0A0A22"/></svg>`}</div></footer>`:e`<div class="content"><slot></slot></div>`}};t([i({type:String})],d.prototype,"background",void 0),t([i()],d.prototype,"variant",void 0),t([i({type:Boolean,attribute:"show-mediquo-branding"})],d.prototype,"showMediquoBranding",void 0),d=t([a(),o("mq-layout")],d);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as t,p as e,r,s as i,a as n,n as h,i as o,b as u,t as a,c,f as l,d,e as p,g as b,Q as f}from"./query-QJ1INUTG.js";import{s as y}from"./context-request-event-Dfydf1ub.js";class s{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(t,e)=>{this.unsubscribe&&(this.unsubscribe!==e&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=t,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(t,e)),this.unsubscribe=e},this.host=t,void 0!==e.context){const t=e;this.context=t.context,this.callback=t.callback,this.subscribe=t.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new y(this.context,this.host,this.t,this.subscribe))}}function v({context:t,subscribe:e}){return(r,i)=>{"object"==typeof i?i.addInitializer(function(){new s(this,{context:t,callback:t=>{r.set.call(this,t)},subscribe:e})}):r.constructor.addInitializer(r=>{new s(r,{context:t,callback:t=>{r[i]=t},subscribe:e})})}}var R=class extends t{constructor(t,r){super(),this.options=r,this.#t=t,this.#e=null,this.#s=e(),this.bindMethods(),this.setOptions(r)}#t;#r=void 0;#i=void 0;#n=void 0;#h;#o;#s;#e;#u;#a;#c;#l;#d;#p;#b=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#r.addObserver(this),Q(this.#r,this.options)?this.#f():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return m(this.#r,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return m(this.#r,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#R(),this.#r.removeObserver(this)}setOptions(t){const e=this.options,h=this.#r;if(this.options=this.#t.defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof r(this.options.enabled,this.#r))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#Q(),this.#r.setOptions(this.options),e._defaulted&&!i(this.options,e)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#r,observer:this});const o=this.hasListeners();o&&g(this.#r,h,this.options,e)&&this.#f(),this.updateResult(),!o||this.#r===h&&r(this.options.enabled,this.#r)===r(e.enabled,this.#r)&&n(this.options.staleTime,this.#r)===n(e.staleTime,this.#r)||this.#m();const u=this.#g();!o||this.#r===h&&r(this.options.enabled,this.#r)===r(e.enabled,this.#r)&&u===this.#p||this.#I(u)}getOptimisticResult(t){const e=this.#t.getQueryCache().build(this.#t,t),r=this.createResult(e,t);return function(t,e){if(!i(t.getCurrentResult(),e))return!0;return!1}(this,r)&&(this.#n=r,this.#o=this.options,this.#h=this.#r.state),r}getCurrentResult(){return this.#n}trackResult(t,e){return new Proxy(t,{get:(t,r)=>(this.trackProp(r),e?.(r),"promise"!==r||this.options.experimental_prefetchInRender||"pending"!==this.#s.status||this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(t,r))})}trackProp(t){this.#b.add(t)}getCurrentQuery(){return this.#r}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#t.defaultQueryOptions(t),r=this.#t.getQueryCache().build(this.#t,e);return r.fetch().then(()=>this.createResult(r,e))}fetch(t){return this.#f({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#f(t){this.#Q();let e=this.#r.fetch(this.options,t);return t?.throwOnError||(e=e.catch(h)),e}#m(){this.#v();const t=n(this.options.staleTime,this.#r);if(o||this.#n.isStale||!u(t))return;const e=a(this.#n.dataUpdatedAt,t)+1;this.#l=c.setTimeout(()=>{this.#n.isStale||this.updateResult()},e)}#g(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#r):this.options.refetchInterval)??!1}#I(t){this.#R(),this.#p=t,!o&&!1!==r(this.options.enabled,this.#r)&&u(this.#p)&&0!==this.#p&&(this.#d=c.setInterval(()=>{(this.options.refetchIntervalInBackground||l.isFocused())&&this.#f()},this.#p))}#y(){this.#m(),this.#I(this.#g())}#v(){this.#l&&(c.clearTimeout(this.#l),this.#l=void 0)}#R(){this.#d&&(c.clearInterval(this.#d),this.#d=void 0)}createResult(t,i){const n=this.#r,h=this.options,o=this.#n,u=this.#h,a=this.#o,c=t!==n?t.state:this.#i,{state:l}=t;let b,f={...l},y=!1;if(i._optimisticResults){const e=this.hasListeners(),r=!e&&Q(t,i),o=e&&g(t,n,i,h);(r||o)&&(f={...f,...d(l.data,t.options)}),"isRestoring"===i._optimisticResults&&(f.fetchStatus="idle")}let{error:v,errorUpdatedAt:R,status:m}=f;b=f.data;let w=!1;if(void 0!==i.placeholderData&&void 0===b&&"pending"===m){let t;o?.isPlaceholderData&&i.placeholderData===a?.placeholderData?(t=o.data,w=!0):t="function"==typeof i.placeholderData?i.placeholderData(this.#c?.state.data,this.#c):i.placeholderData,void 0!==t&&(m="success",b=p(o?.data,t,i),y=!0)}if(i.select&&void 0!==b&&!w)if(o&&b===u?.data&&i.select===this.#u)b=this.#a;else try{this.#u=i.select,b=i.select(b),b=p(o?.data,b,i),this.#a=b,this.#e=null}catch(t){this.#e=t}this.#e&&(v=this.#e,b=this.#a,R=Date.now(),m="error");const S="fetching"===f.fetchStatus,O="pending"===m,_="error"===m,C=O&&S,T=void 0!==b,E={status:m,fetchStatus:f.fetchStatus,isPending:O,isSuccess:"success"===m,isError:_,isInitialLoading:C,isLoading:C,data:b,dataUpdatedAt:f.dataUpdatedAt,error:v,errorUpdatedAt:R,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:S,isRefetching:S&&!O,isLoadingError:_&&!T,isPaused:"paused"===f.fetchStatus,isPlaceholderData:y,isRefetchError:_&&T,isStale:I(t,i),refetch:this.refetch,promise:this.#s,isEnabled:!1!==r(i.enabled,t)};if(this.options.experimental_prefetchInRender){const r=t=>{"error"===E.status?t.reject(E.error):void 0!==E.data&&t.resolve(E.data)},i=()=>{const t=this.#s=E.promise=e();r(t)},h=this.#s;switch(h.status){case"pending":t.queryHash===n.queryHash&&r(h);break;case"fulfilled":"error"!==E.status&&E.data===h.value||i();break;case"rejected":"error"===E.status&&E.error===h.reason||i()}}return E}updateResult(){const t=this.#n,e=this.createResult(this.#r,this.options);if(this.#h=this.#r.state,this.#o=this.options,void 0!==this.#h.data&&(this.#c=this.#r),i(e,t))return;this.#n=e;this.#w({listeners:(()=>{if(!t)return!0;const{notifyOnChangeProps:e}=this.options,r="function"==typeof e?e():e;if("all"===r||!r&&!this.#b.size)return!0;const i=new Set(r??this.#b);return this.options.throwOnError&&i.add("error"),Object.keys(this.#n).some(e=>{const r=e;return this.#n[r]!==t[r]&&i.has(r)})})()})}#Q(){const t=this.#t.getQueryCache().build(this.#t,this.options);if(t===this.#r)return;const e=this.#r;this.#r=t,this.#i=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#w(t){b.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(this.#n)}),this.#t.getQueryCache().notify({query:this.#r,type:"observerResultsUpdated"})})}};function Q(t,e){return function(t,e){return!1!==r(e.enabled,t)&&void 0===t.state.data&&!("error"===t.state.status&&!1===e.retryOnMount)}(t,e)||void 0!==t.state.data&&m(t,e,e.refetchOnMount)}function m(t,e,i){if(!1!==r(e.enabled,t)&&"static"!==n(e.staleTime,t)){const r="function"==typeof i?i(t):i;return"always"===r||!1!==r&&I(t,e)}return!1}function g(t,e,i,n){return(t!==e||!1===r(n.enabled,t))&&(!i.suspense||"error"!==t.state.status)&&I(t,i)}function I(t,e){return!1!==r(e.enabled,t)&&t.isStaleByTime(n(e.staleTime,t))}Promise.withResolvers||(Promise.withResolvers=function(){let t,e;const r=new this((r,i)=>{t=r,e=i});return{resolve:t,reject:e,promise:r}});var w=class{constructor(t,e,r){this.host=t,this.optionsFn=e,this._queryClient=r,this.whenQueryClient=Promise.withResolvers(),this.whenQueryObserver=Promise.withResolvers(),this.host.addController(this),this.context=new s(this.host,{context:f,subscribe:!0,callback:t=>{t&&(this.queryClient=t)}}),this.optionsFn&&this.observeQuery(this.optionsFn)}set queryClient(t){this._queryClient=t,t&&this.whenQueryClient.resolve(t),this.host.requestUpdate()}get queryClient(){return this._queryClient}async observeQuery(t,e=!0){const r=await this.whenQueryClient.promise,i=await this.getDefaultedOptions("function"==typeof t?t():t);this.queryObserver=new R(r,i),this.result=e?this.queryObserver.getOptimisticResult(i):void 0,this.host.requestUpdate(),this.whenQueryObserver.resolve(this.queryObserver)}async hostUpdate(){if(this.optionsFn){const t=await this.whenQueryObserver.promise,e=await this.getDefaultedOptions(this.optionsFn());t.setOptions(e)}}hostConnected(){this.subscribe()}async subscribe(){const t=await this.whenQueryObserver.promise;this.unsubscribe?.(),this.unsubscribe=t.subscribe(t=>{this.result=t,this.host.requestUpdate()}),t.updateResult(),this.host.requestUpdate()}hostDisconnected(){this.unsubscribe?.(),this.unsubscribe=void 0}async getDefaultedOptions(t){return(await this.whenQueryClient.promise).defaultQueryOptions(t)}render(t){const e=this.result;return"pending"!==e?.status||"idle"!==e?.fetchStatus||e?.data?e?.isPending?t.pending?.()??null:e?.isError?t.error?.(e?.error)??null:e?.isSuccess?t.complete(e?.data):t.initial?.()??null:t.initial?.()??null}},S=class{constructor(t,e){this.host=t,this.options=e,this._isPending=!1,this._isError=!1,this._isSuccess=!1,this._data=void 0,this._error=void 0,this.host.addController(this)}hostConnected(){}hostDisconnected(){}async run(t){this._isPending=!0,this._isError=!1,this._isSuccess=!1,this._data=void 0,this._error=void 0,this.host.requestUpdate();try{const e=await this.options.mutationFn(t);return this._isPending=!1,this._isSuccess=!0,this._data=e,this.host.requestUpdate(),this.options.onSuccess&&await this.options.onSuccess(e,t),this.options.onSettled&&await this.options.onSettled(e,void 0,t),e}catch(e){if(this._isPending=!1,this._isError=!0,this._error=e,this.host.requestUpdate(),this.options.onError&&await this.options.onError(e,t),this.options.onSettled&&await this.options.onSettled(void 0,e,t),this.options.throwOnError)throw e;return}}reset(){this._isPending=!1,this._isError=!1,this._isSuccess=!1,this._data=void 0,this._error=void 0,this.host.requestUpdate()}updateOptions(t){this.options={...this.options,...t}}get isPending(){return this._isPending}get isError(){return this._isError}get isSuccess(){return this._isSuccess}get isIdle(){return!this._isPending&&!this._isError&&!this._isSuccess}get data(){return this._data}get error(){return this._error}};export{S as M,w as Q,v as c,s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{L as t}from"./runtime-Bg1WXVCx.js";class LocalizeController{constructor(t){this.__litLocalizeEventHandler=t=>{"ready"===t.detail.status&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(t,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(t,this.__litLocalizeEventHandler)}}const e=t=>t.addController(new LocalizeController(t)),n=()=>(t,n)=>(t.addInitializer(e),t),r=6048e5,i=864e5,o=6e4,a=36e5,s=Symbol.for("constructDateFrom");function u(t,e){return"function"==typeof t?t(e):t&&"object"==typeof t&&s in t?t[s](e):t instanceof Date?new t.constructor(e):new Date(e)}function c(t,e){return u(e||t,t)}let l={};function d(){return l}function f(t,e){const n=d(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=c(t,e?.in),o=i.getDay(),a=(o<r?7:0)+o-r;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function m(t,...e){const n=u.bind(null,e.find(t=>"object"==typeof t));return e.map(n)}function D(t,e){const n=c(t,e?.in);return n.setHours(0,0,0,0),n}function N(t,e){const n=()=>u(e?.in,NaN),r=function(t){const e={},n=t.split(p.dateTimeDelimiter);let r;if(n.length>2)return e;/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],p.timeZoneDelimiter.test(e.date)&&(e.date=t.split(p.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length)));if(r){const t=p.timezone.exec(r);t?(e.time=r.replace(t[1],""),e.timezone=t[1]):e.time=r}return e}(t);let i;if(r.date){const t=function(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const i=r[1]?parseInt(r[1]):null,o=r[2]?parseInt(r[2]):null;return{year:null===o?i:100*o,restDateString:t.slice((r[1]||r[2]).length)}}(r.date,2);i=function(t,e){if(null===e)return new Date(NaN);const n=t.match(g);if(!n)return new Date(NaN);const r=!!n[4],i=C(n[1]),o=C(n[2])-1,a=C(n[3]),s=C(n[4]),u=C(n[5])-1;if(r)return function(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}(0,s,u)?function(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const i=r.getUTCDay()||7,o=7*(e-1)+n+1-i;return r.setUTCDate(r.getUTCDate()+o),r}(e,s,u):new Date(NaN);{const t=new Date(0);return function(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(U[e]||(z(t)?29:28))}(e,o,a)&&function(t,e){return e>=1&&e<=(z(t)?366:365)}(e,i)?(t.setUTCFullYear(e,o,Math.max(i,a)),t):new Date(NaN)}}(t.restDateString,t.year)}if(!i||isNaN(+i))return n();const s=+i;let l,d=0;if(r.time&&(d=function(t){const e=t.match(h);if(!e)return NaN;const n=T(e[1]),r=T(e[2]),i=T(e[3]);if(!function(t,e,n){if(24===t)return 0===e&&0===n;return n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}(n,r,i))return NaN;return n*a+r*o+1e3*i}(r.time),isNaN(d)))return n();if(!r.timezone){const t=new Date(s+d),n=c(0,e?.in);return n.setFullYear(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),n.setHours(t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()),n}return l=function(t){if("Z"===t)return 0;const e=t.match(w);if(!e)return 0;const n="+"===e[1]?-1:1,r=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;if(!function(t,e){return e>=0&&e<=59}(0,i))return NaN;return n*(r*a+i*o)}(r.timezone),isNaN(l)?n():c(s+d+l,e?.in)}const p={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},g=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,h=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,w=/^([+-])(\d{2})(?::?(\d{2}))?$/;function C(t){return t?parseInt(t):1}function T(t){return t&&parseFloat(t.replace(",","."))||0}const U=[31,null,31,30,31,30,31,31,30,31,30,31];function z(t){return t%400==0||t%4==0&&t%100!=0}export{f as a,r as b,u as c,d as g,n as l,i as m,m as n,N as p,D as s,c as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as t,t as e}from"./custom-element-DA9Fxvxd.js";import{m as i}from"./runtime-Bg1WXVCx.js";import{l as n}from"./parseISO-jT42c8Ob.js";import{g as o}from"./api-chat-client-BTBtu01T.js";import{a as r}from"./telemetry-client-CKCb9Gnf.js";import{i as a,a as s,E as l,x as p}from"./lit-element-DiWJYFwC.js";import{n as m}from"./property-scuRaFcM.js";import{e as c}from"./class-map-Co76I6aw.js";import{getLocale as h}from"../i18n.js";import{briefcaseIcon as d}from"../ui/icons/briefcase-icon.js";import{calendarIcon as u}from"../ui/icons/calendar-icon.js";import{clockIcon as f}from"../ui/icons/clock-icon.js";import{messageBubbleIcon as v}from"../ui/icons/message-bubble-icon.js";import{phoneIcon as w}from"../ui/icons/phone-icon.js";const y=a`.appointment-details{display:flex;flex-direction:column;gap:var(--sp-3)}.detail-row{display:inline-flex;width:fit-content;align-items:center;gap:var(--sp-2);color:var(--color-neutrals-text-default);font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold)}.detail-row svg{flex-shrink:0}.detail-row span::first-letter{text-transform:uppercase}.detail-row.full-width{width:100%}:host([strike-through]) .detail-row span{text-decoration:line-through}@media (min-width:768px){.appointment-details.wide{flex-direction:row;flex-wrap:wrap}}`;let g=class AppointmentDetails extends s{constructor(){super(...arguments),this.channel=void 0,this.variant="default",this.strikeThrough=!1,this.timezone=void 0,this._appointmentChannelToLabel=t=>{switch(t){case"videocall":return i("Videoconsulta");case"chat":return i("Chat");case"phonecall":return i("Consulta telefónica");default:return""}},this._appointmentChannelToIcon=t=>{switch(t){case"videocall":return d({size:24});case"chat":return v({size:24});case"phonecall":return w({size:24});default:return l}}}static{this.styles=y}render(){const t=h().replace("_","-"),e=new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric",...this.timezone?{timeZone:this.timezone}:{}}),i=new Intl.DateTimeFormat(t,{timeStyle:"short",...this.timezone?{timeZone:this.timezone}:{}}),n=new Date(this.startsAt),a=r(n,this.duration),s=e.format(n),m=i.format(n),d=i.format(a),v=this.timezone?o(this.timezone,n):"";return p`<div class="${c({"appointment-details":!0,wide:"wide"===this.variant})}"><div class="detail-row">${u({size:24})} <span>${s}</span></div><div class="detail-row">${f({size:24})} <span>${m} - ${d}${v?` (${v})`:""}</span></div>${this.channel?p`<div class="detail-row full-width">${this._appointmentChannelToIcon(this.channel)} <span>${this._appointmentChannelToLabel(this.channel)}</span></div>`:l}</div>`}};function j(t){return t/100}function x(t,e){const i=e.replaceAll("_","-");return new Intl.NumberFormat(i,{style:"currency",currency:t.currency}).format(j(t.amount))}function z(t){return null!=t&&t.amount>0}t([m({type:String})],g.prototype,"startsAt",void 0),t([m({type:Number})],g.prototype,"duration",void 0),t([m({type:String})],g.prototype,"channel",void 0),t([m({type:String})],g.prototype,"variant",void 0),t([m({type:Boolean,attribute:"strike-through"})],g.prototype,"strikeThrough",void 0),t([m({type:String})],g.prototype,"timezone",void 0),g=t([n(),e("appointment-details")],g);export{g as A,j as c,x as f,z as h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as t}from"./context-provider-CiMFpvDA.js";var e=t(Symbol.for("tanstack-lit-query")),s=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},i={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},n=new class{#t=i;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,e){return this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}};var r="undefined"==typeof window||"Deno"in globalThis;function o(){}function a(t,e){return"function"==typeof t?t(e):t}function c(t){return"number"==typeof t&&t>=0&&t!==1/0}function u(t,e){return Math.max(t+(e||0)-Date.now(),0)}function h(t,e){return"function"==typeof t?t(e):t}function l(t,e){return"function"==typeof t?t(e):t}function d(t,e){const{type:s="all",exact:i,fetchStatus:n,predicate:r,queryKey:o,stale:a}=t;if(o)if(i){if(e.queryHash!==p(o,e.options))return!1}else if(!v(e.queryKey,o))return!1;if("all"!==s){const t=e.isActive();if("active"===s&&!t)return!1;if("inactive"===s&&t)return!1}return("boolean"!=typeof a||e.isStale()===a)&&((!n||n===e.state.fetchStatus)&&!(r&&!r(e)))}function f(t,e){const{exact:s,status:i,predicate:n,mutationKey:r}=t;if(r){if(!e.options.mutationKey)return!1;if(s){if(y(e.options.mutationKey)!==y(r))return!1}else if(!v(e.options.mutationKey,r))return!1}return(!i||e.state.status===i)&&!(n&&!n(e))}function p(t,e){return(e?.queryKeyHashFn||y)(t)}function y(t){return JSON.stringify(t,(t,e)=>w(e)?Object.keys(e).sort().reduce((t,s)=>(t[s]=e[s],t),{}):e)}function v(t,e){return t===e||typeof t==typeof e&&(!(!t||!e||"object"!=typeof t||"object"!=typeof e)&&Object.keys(e).every(s=>v(t[s],e[s])))}var b=Object.prototype.hasOwnProperty;function m(t,e){if(t===e)return t;const s=S(t)&&S(e);if(!(s||w(t)&&w(e)))return e;const i=(s?t:Object.keys(t)).length,n=s?e:Object.keys(e),r=n.length,o=s?new Array(r):{};let a=0;for(let c=0;c<r;c++){const r=s?c:n[c],u=t[r],h=e[r];if(u===h){o[r]=u,(s?c<i:b.call(t,r))&&a++;continue}if(null===u||null===h||"object"!=typeof u||"object"!=typeof h){o[r]=h;continue}const l=m(u,h);o[r]=l,l===u&&a++}return i===r&&a===i?t:o}function g(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function S(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function w(t){if(!O(t))return!1;const e=t.constructor;if(void 0===e)return!0;const s=e.prototype;return!!O(s)&&(!!s.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(t)===Object.prototype)}function O(t){return"[object Object]"===Object.prototype.toString.call(t)}function F(t,e,s){return"function"==typeof s.structuralSharing?s.structuralSharing(t,e):!1!==s.structuralSharing?m(t,e):e}function C(t,e,s=0){const i=[...t,e];return s&&i.length>s?i.slice(1):i}function T(t,e,s=0){const i=[e,...t];return s&&i.length>s?i.slice(0,-1):i}var j=Symbol();function q(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==j?t.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`))}var U=new class extends s{#s;#i;#n;constructor(){super(),this.#n=t=>{if(!r&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#i||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#i?.(),this.#i=void 0)}setEventListener(t){this.#n=t,this.#i?.(),this.#i=t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()})}setFocused(t){this.#s!==t&&(this.#s=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return"boolean"==typeof this.#s?this.#s:"hidden"!==globalThis.document?.visibilityState}};function A(){let t,e;const s=new Promise((s,i)=>{t=s,e=i});function i(t){Object.assign(s,t),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=e=>{i({status:"fulfilled",value:e}),t(e)},s.reject=t=>{i({status:"rejected",reason:t}),e(t)},s}var E=function(t){setTimeout(t,0)};var R=function(){let t=[],e=0,s=t=>{t()},i=t=>{t()},n=E;const r=i=>{e?t.push(i):n(()=>{s(i)})};return{batch:r=>{let o;e++;try{o=r()}finally{e--,e||(()=>{const e=t;t=[],e.length&&n(()=>{i(()=>{e.forEach(t=>{s(t)})})})})()}return o},batchCalls:t=>(...e)=>{r(()=>{t(...e)})},schedule:r,setNotifyFunction:t=>{s=t},setBatchNotifyFunction:t=>{i=t},setScheduler:t=>{n=t}}}(),P=new class extends s{#r=!0;#i;#n;constructor(){super(),this.#n=t=>{if(!r&&window.addEventListener){const e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#i||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#i?.(),this.#i=void 0)}setEventListener(t){this.#n=t,this.#i?.(),this.#i=t(this.setOnline.bind(this))}setOnline(t){this.#r!==t&&(this.#r=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#r}};function D(t){return Math.min(1e3*2**t,3e4)}function L(t){return"online"!==(t??"online")||P.isOnline()}var k=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function I(t){let e,s=!1,i=0;const o=A(),a=()=>"pending"!==o.status,c=()=>U.isFocused()&&("always"===t.networkMode||P.isOnline())&&t.canRun(),u=()=>L(t.networkMode)&&t.canRun(),h=t=>{a()||(e?.(),o.resolve(t))},l=t=>{a()||(e?.(),o.reject(t))},d=()=>new Promise(s=>{e=t=>{(a()||c())&&s(t)},t.onPause?.()}).then(()=>{e=void 0,a()||t.onContinue?.()}),f=()=>{if(a())return;let e;const o=0===i?t.initialPromise:void 0;try{e=o??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(h).catch(e=>{if(a())return;const o=t.retry??(r?0:3),u=t.retryDelay??D,h="function"==typeof u?u(i,e):u,p=!0===o||"number"==typeof o&&i<o||"function"==typeof o&&o(i,e);var y;!s&&p?(i++,t.onFail?.(i,e),(y=h,new Promise(t=>{n.setTimeout(t,y)})).then(()=>c()?void 0:d()).then(()=>{s?l(e):f()})):l(e)})};return{promise:o,status:()=>o.status,cancel:e=>{if(!a()){const s=new k(e);l(s),t.onCancel?.(s)}},continue:()=>(e?.(),o),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:u,start:()=>(u()?f():d().then(f),o)}}var K=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),c(this.gcTime)&&(this.#o=n.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(r?1/0:3e5))}clearGcTimeout(){this.#o&&(n.clearTimeout(this.#o),this.#o=void 0)}},M=class extends K{#a;#c;#u;#h;#l;#d;#f;constructor(t){super(),this.#f=!1,this.#d=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#h=t.client,this.#u=this.#h.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#a=G(this.options),this.state=t.state??this.#a,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#l?.promise}setOptions(t){if(this.options={...this.#d,...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const t=G(this.options);void 0!==t.data&&(this.setData(t.data,{updatedAt:t.dataUpdatedAt,manual:!0}),this.#a=t)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(t,e){const s=F(this.state.data,t,this.options);return this.#p({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#p({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#l?.promise;return this.#l?.cancel(t),e?e.then(o).catch(o):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#a)}isActive(){return this.observers.some(t=>!1!==l(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===j||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===h(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(t=0){return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!u(this.state.dataUpdatedAt,t))}onFocus(){const t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#l?.continue()}onOnline(){const t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#l?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#l&&(this.#f?this.#l.cancel({revert:!0}):this.#l.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#p({type:"invalidate"})}async fetch(t,e){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#l?.status())if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#l)return this.#l.continueRetry(),this.#l.promise;if(t&&this.setOptions(t),!this.options.queryFn){const t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}const s=new AbortController,i=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#f=!0,s.signal)})},n=()=>{const t=q(this.options,e),s=(()=>{const t={client:this.#h,queryKey:this.queryKey,meta:this.meta};return i(t),t})();return this.#f=!1,this.options.persister?this.options.persister(t,s,this):t(s)},r=(()=>{const t={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#h,state:this.state,fetchFn:n};return i(t),t})();this.options.behavior?.onFetch(r,this),this.#c=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===r.fetchOptions?.meta||this.#p({type:"fetch",meta:r.fetchOptions?.meta}),this.#l=I({initialPromise:e?.initialPromise,fn:r.fetchFn,onCancel:t=>{t instanceof k&&t.revert&&this.setState({...this.#c,fetchStatus:"idle"}),s.abort()},onFail:(t,e)=>{this.#p({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#p({type:"pause"})},onContinue:()=>{this.#p({type:"continue"})},retry:r.options.retry,retryDelay:r.options.retryDelay,networkMode:r.options.networkMode,canRun:()=>!0});try{const t=await this.#l.start();if(void 0===t)throw new Error(`${this.queryHash} data is undefined`);return this.setData(t),this.#u.config.onSuccess?.(t,this),this.#u.config.onSettled?.(t,this.state.error,this),t}catch(t){if(t instanceof k){if(t.silent)return this.#l.promise;if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw this.#p({type:"error",error:t}),this.#u.config.onError?.(t,this),this.#u.config.onSettled?.(this.state.data,t,this),t}finally{this.scheduleGc()}}#p(t){this.state=(e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...x(e.data,this.options),fetchMeta:t.meta??null};case"success":const s={...e,data:t.data,dataUpdateCount:e.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#c=t.manual?s:void 0,s;case"error":const i=t.error;return{...e,error:i,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}})(this.state),R.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:t})})}};function x(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:L(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}function G(t){const e="function"==typeof t.initialData?t.initialData():t.initialData,s=void 0!==e,i=s?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}export{e as Q,K as R,s as S,h as a,c as b,n as c,x as d,F as e,U as f,R as g,q as h,r as i,T as j,C as k,I as l,f as m,o as n,p as o,A as p,M as q,l as r,g as s,u as t,d as u,P as v,a as w,y as x,v as y,j as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as t,t as e,l as a}from"./parseISO-jT42c8Ob.js";import{_ as i,t as n}from"./custom-element-DA9Fxvxd.js";import{m as o,s}from"./runtime-Bg1WXVCx.js";import{i as r,a as p,x as l,E as c}from"./lit-element-DiWJYFwC.js";import{n as d}from"./property-scuRaFcM.js";import{r as u}from"./state-LQivXIgA.js";import{getLocale as _}from"../i18n.js";import{chevronDownIcon as h}from"../ui/icons/chevron-down-icon.js";import"../ui/mq-text-button.js";import"../ui/mq-avatar.js";function y(a,i,n){return function(a,i){return t(a,+e(a)+i)}(a,1e3*i)}function v(t,e){return{queryKey:["organization-specialties"],queryFn:()=>t.organizations.getOrganizationSpecialties(),...e}}const m=r`.header{display:flex;align-items:center;gap:var(--sp-4);margin-bottom:0}.header.expanded{margin-bottom:var(--sp-4)}@media (max-width:768px){.header{--avatar-size-lg:var(--avatar-size-md)}}.professional-info{flex:1}.professional-name{font-family:var(--font-titles);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutral-link-dark);margin:0}.professional-specialty{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutral-text-default);margin:0}.collegiate-number{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);color:var(--color-neutrals-text-medium);margin:0;text-transform:uppercase}.languages{display:flex;flex-wrap:wrap;gap:var(--sp-3)}.language-pill{display:inline-block;background-color:#e5e5e5;color:var(--colors-neutral-text-default);font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);padding:var(--sp-1) var(--sp-2);border-radius:26px;text-transform:uppercase}.description{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);margin-bottom:0;color:var(--color-neutrals-text-medium)}.icon{transition:transform .1s ease-in-out}.rotate-180{transform:rotate(180deg)}.details{display:grid;grid-template-rows:0fr;transition:grid-template-rows .2s ease-out;overflow:hidden}.details[data-expanded=true]{grid-template-rows:1fr}.details-content{overflow:hidden}.details-content>:not(:first-child){margin-top:var(--sp-3)}@media (min-width:769px){:host([always-expanded-on-desktop]) .details{grid-template-rows:1fr}:host([always-expanded-on-desktop]) mq-text-button{display:none}:host([always-expanded-on-desktop]) .header{margin-bottom:var(--sp-4)}}`;let g=class ProfessionalOverview extends p{constructor(){super(...arguments),this.alwaysExpandedOnDesktop=!1,this.detailsExpanded=!1}static{this.styles=m}render(){const t=_().replace("_","-"),e=this.languages.map(e=>l`<span class="language-pill">${new Intl.DisplayNames(t,{type:"language"}).of(e)}</span>`);return l`<div class="header ${this.detailsExpanded?"expanded":""}"><mq-avatar src="${this.avatar}" fallback="${this.name}" alt="${this.name}" size="lg"></mq-avatar><div class="professional-info"><h2 class="professional-name">${this.name}</h2>${this.specialtyName?l`<p class="professional-specialty">${this.specialtyName}</p>`:c}<mq-text-button type="button" size="sm" fontWeight="bold" @click="${()=>{this.detailsExpanded=!this.detailsExpanded}}">${this.detailsExpanded?o("Ocultar detalles"):o("Ver detalles")} ${h({size:24,className:"icon "+(this.detailsExpanded?"rotate-180":"")})}</mq-text-button></div></div><div class="details" data-expanded="${this.detailsExpanded}"><div class="details-content"><div class="languages">${e}</div>${this.collegiateNumber?l`<p class="collegiate-number">${o(s`Nº COL. ${this.collegiateNumber}`)}</p>`:c}<p class="description">${this.description}</p></div></div>`}};i([d({type:String})],g.prototype,"name",void 0),i([d({type:String})],g.prototype,"specialtyName",void 0),i([d({type:String})],g.prototype,"collegiateNumber",void 0),i([d({type:String})],g.prototype,"description",void 0),i([d({type:Array})],g.prototype,"languages",void 0),i([d({type:String})],g.prototype,"avatar",void 0),i([d({type:Boolean,reflect:!0,attribute:"always-expanded-on-desktop"})],g.prototype,"alwaysExpandedOnDesktop",void 0),i([u()],g.prototype,"detailsExpanded",void 0),g=i([a(),n("professional-overview")],g);var f={digestive_system:{de_DE:"Verdauungssystem",en_US:"Digestive System",es_ES:"Aparato Digestivo",ca_ES:"Aparell Digestiu",pt_PT:"Aparelho Digestivo"},orthopedic_surgery_traumatology:{de_DE:"Traumatologie und Orthopädische Chirurgie",en_US:"Traumatology and Orthopedic Surgery",es_ES:"Traumatología y Cirugía Ortopédica",ca_ES:"Traumatologia i Cirurgia Ortopèdica",pt_PT:"Traumatologia e Cirurgia Ortopédica"},gynecology:{de_DE:"Gynäkologie",en_US:"Gynecology",es_ES:"Ginecología",ca_ES:"Ginecologia",pt_PT:"Ginecologia"},endocrinology:{de_DE:"Endokrinologie",en_US:"Endocrinology",es_ES:"Endocrinología",ca_ES:"Endocrinologia",pt_PT:"Endocrinologia"},psychiatry:{de_DE:"Psychiatrie",en_US:"Psychiatry",es_ES:"Psiquiatría",ca_ES:"Psiquiatria",pt_PT:"Psiquiatria"}},x={videocall:{de_DE:"Videosprechstunde",en_US:"Videocall",es_ES:"Videoconsulta",ca_ES:"Videoconsulta",pt_PT:"Videoconsulta"},phonecall:{de_DE:"Telefonische Behandlung",en_US:"Phone consultation",es_ES:"Consulta telefónica",ca_ES:"Consulta telefònica",pt_PT:"Consulta telefónica"}},b={de_DE:"Konsultationspreis",en_US:"Consultation price",es_ES:"Precio de consulta",ca_ES:"Preu de consulta",pt_PT:"Preço da consulta"},w={videocall:"videocall",phonecall:"phonecall",adeslas_videocall:"videocall",adeslas_prod_videocall:"videocall",adeslas_phonecall:"phonecall",adeslas_prod_phonecall:"phonecall"};function E(t,e,a){if(!t)return a??"";const i=w[t];return i?x[i][e]:a??b[e]}var S={consulta_telefonica:"phonecall",videoconsulta:"videocall"},k={"aparato-digestivo":"digestive_system","cirugia-ortopedica-y-traumatologia":"orthopedic_surgery_traumatology",ginecologia:"gynecology",endocrinologia:"endocrinology",psiquiatria:"psychiatry"};function T(t,e,a){const i=a?.trim();if(i)return i;const n=f[t]?.[e];return void 0!==n?n:t}function P(t,e){return{action_type:"event",event_type:"access to videocall button click",patient_hash:t,id_appointment:e}}function q(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function $(t,e){return{action_type:"event",event_type:"modify appoinment button click",patient_hash:t,id_appointment:e}}function D(t,e){return{action_type:"event",event_type:"cancel appoinment button click",patient_hash:t,id_appointment:e}}function z(t,e){return{action_type:"event",event_type:"view appointment document list button click",patient_hash:t,id_appointment:e}}function C(t,e){return{action_type:"event",event_type:"repeat appointment button click",patient_hash:t,id_appointment:e}}function O(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function j(t,e){return{action_type:"event",event_type:"access to videocall button click",patient_hash:t,id_appointment:e}}function K(t,e){return{action_type:"event",event_type:"add to calendar button click",patient_hash:t,id_appointment:e}}function N(t,e){return{action_type:"pageview",event_type:"appointment success page view",patient_hash:t,id_appointment:e}}function U(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function A(t,e){return{action_type:"event",event_type:"update documentation",patient_hash:t,id_appointment:e}}function V(t,e){return{action_type:"pageview",event_type:"documentation page view",patient_hash:t,id_appointment:e}}function G(t,e,a){return{action_type:"event",event_type:"find availability button click",patient_hash:t,speciality_id:e,service_id:a}}function B(t,e,a,i,n,o,s){return{action_type:"debug",event_type:"find availability result",patient_hash:t,speciality_id:e,service_id:a,first_slot_date:i,first_slot_professional_hash:n,total_professionals:o,total_slots:s}}function H(t,e,a,i,n){return{action_type:"event",event_type:"professional schedule slot button click",patient_hash:t,professional_hash:e,start_date:a,speciality_id:i,service_id:n}}function I(t,e,a,i){return{action_type:"event",event_type:"professional availability button click",patient_hash:t,professional_hash:e,speciality_id:a,service_id:i}}function M(t,e,a,i,n){return{action_type:"event",event_type:"confirm appointment button click",patient_hash:t,professional_hash:e,start_date:a,speciality_id:i,service_id:n}}function F(t){return{action_type:"pageview",event_type:"select professional step page view",patient_hash:t}}function J(t,e){return{action_type:"pageview",event_type:"not time yet pageview",patient_hash:t,id_appointment:e}}function L(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function W(t,e){return{action_type:"pageview",event_type:"waiting room pageview",patient_hash:t,id_appointment:e}}function Q(t,e){return{action_type:"pageview",event_type:"videocall pageview",patient_hash:t,id_appointment:e}}class HttpTransport{endpoint;apiKey;constructor(t,e){this.endpoint=t,this.apiKey=e}send(t){fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.apiKey},body:JSON.stringify(t)}).catch(()=>{})}}class MediquoTelemetryClient{_apiKey=null;_transport=null;setApiKey(t){this._apiKey=t,this._buildTransport()}track(t){null!==this._transport&&this._transport.send(t)}_buildTransport(){null!==this._apiKey&&(this._transport=new HttpTransport("https://tracking.____.mediquo.com/sdk",this._apiKey))}}const R=new class AppTelemetryClient extends MediquoTelemetryClient{track(t){}};export{H as A,I as B,B as C,F as D,g as P,S,y as a,N as b,T as c,K as d,O as e,j as f,v as g,$ as h,D as i,C as j,P as k,z as l,q as m,L as n,W as o,Q as p,V as q,A as r,U as s,R as t,k as u,J as v,E as w,M as x,G as y,f as z};
|