@mediquo/elements 0.12.0 → 0.12.1-rc.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.
Files changed (67) hide show
  1. package/dist/chunks/api-chat-client-BZAeIvwy.js +1 -0
  2. package/dist/chunks/{apple-pay-outcomes--uAwZeLE.js → apple-pay-outcomes-BDEoZ3jG.js} +1 -1
  3. package/dist/chunks/{chunk-Y4EKUX25-Bdei04iw.js → chunk-Y4EKUX25-Bix9r5ry.js} +1 -1
  4. package/dist/chunks/{chunk-YTQUGGS3-sBILRfPo.js → chunk-YTQUGGS3-DH0H7ld7.js} +1 -1
  5. package/dist/chunks/{documentation-view-BcA4Vbhp.js → documentation-view-BUhSeZQQ.js} +1 -1
  6. package/dist/chunks/{external-cM_kgYO_.js → external-JLtsAfi6.js} +1 -1
  7. package/dist/chunks/{index-CGWd3FWG.js → index-C8H-Uzbs.js} +1 -1
  8. package/dist/chunks/{index-Dw4Aeoyg.js → index-DTBCUojx.js} +1 -1
  9. package/dist/chunks/{mq-chat-room-BkXGHzrd.js → mq-chat-room-D8z-cbzt.js} +1 -1
  10. package/dist/chunks/{mq-next-appointments-BngkXupq.js → mq-next-appointments-DsfhBPsc.js} +1 -1
  11. package/dist/chunks/{mq-recent-documents-Ee-JRTdl.js → mq-recent-documents-BW54beY8.js} +1 -1
  12. package/dist/chunks/{mq-schedule-DAKftQ3D.js → mq-schedule-DWa7lyBh.js} +1 -1
  13. package/dist/chunks/{mq-support-chat-Bzj5LYHb.js → mq-support-chat-Do9xyxf2.js} +1 -1
  14. package/dist/chunks/mq-videocall-BSUe9dXT.js +1 -0
  15. package/dist/chunks/{next-appointment-card-BE0KW2vv.js → next-appointment-card-CBf_4Err.js} +1 -1
  16. package/dist/env.js +1 -1
  17. package/dist/i18n.js +1 -1
  18. package/dist/mq-api-client-provider.js +1 -1
  19. package/dist/mq-apple-pay-checkout.js +1 -1
  20. package/dist/mq-appointment-checkout.js +1 -1
  21. package/dist/mq-appointment-documentation.js +1 -1
  22. package/dist/mq-chat-room.js +1 -1
  23. package/dist/mq-checkout.js +1 -1
  24. package/dist/mq-dashboard.js +1 -1
  25. package/dist/mq-documents.js +1 -1
  26. package/dist/mq-google-pay-checkout.js +1 -1
  27. package/dist/mq-immediate-videocall-checkout.js +1 -1
  28. package/dist/mq-my-appointments.js +1 -1
  29. package/dist/mq-next-appointments.js +1 -1
  30. package/dist/mq-payment-poller.js +1 -1
  31. package/dist/mq-professional-presence-sync.js +1 -1
  32. package/dist/mq-recent-documents.js +1 -1
  33. package/dist/mq-schedule-success.js +1 -1
  34. package/dist/mq-schedule.js +1 -1
  35. package/dist/mq-socket-provider.js +1 -1
  36. package/dist/mq-support-chat.js +1 -1
  37. package/dist/mq-terms-and-conditions.js +1 -1
  38. package/dist/mq-unread-count-sync.js +1 -1
  39. package/dist/mq-videocall.js +1 -1
  40. package/dist/react/mq-api-client-provider.js +1 -1
  41. package/dist/react/mq-apple-pay-checkout.js +1 -1
  42. package/dist/react/mq-appointment-checkout.js +1 -1
  43. package/dist/react/mq-appointment-documentation.js +1 -1
  44. package/dist/react/mq-chat-room.js +1 -1
  45. package/dist/react/mq-checkout.js +1 -1
  46. package/dist/react/mq-dashboard.js +1 -1
  47. package/dist/react/mq-documents-page.js +1 -1
  48. package/dist/react/mq-documents.js +1 -1
  49. package/dist/react/mq-google-pay-checkout.js +1 -1
  50. package/dist/react/mq-immediate-videocall-checkout.js +1 -1
  51. package/dist/react/mq-my-appointments.js +1 -1
  52. package/dist/react/mq-next-appointments.js +1 -1
  53. package/dist/react/mq-payment-poller.js +1 -1
  54. package/dist/react/mq-professional-presence-sync.js +1 -1
  55. package/dist/react/mq-recent-documents.js +1 -1
  56. package/dist/react/mq-schedule-success.js +1 -1
  57. package/dist/react/mq-schedule.js +1 -1
  58. package/dist/react/mq-socket-provider.js +1 -1
  59. package/dist/react/mq-support-chat.js +1 -1
  60. package/dist/react/mq-terms-and-conditions.js +1 -1
  61. package/dist/react/mq-unread-count-sync.js +1 -1
  62. package/dist/react/mq-videocall.js +1 -1
  63. package/dist/ui/mq-input.d.ts +1 -0
  64. package/dist/ui/mq-input.js +1 -1
  65. package/package.json +2 -2
  66. package/dist/chunks/api-chat-client-Dx-sFrf2.js +0 -1
  67. package/dist/chunks/mq-videocall-Cp7LSoDs.js +0 -1
@@ -1 +0,0 @@
1
- import{_ as t,c as e}from"./custom-element-D2ziPxYE.js";import{a as i,i as o,E as s,x as n}from"./lit-element-DiWJYFwC.js";import{n as r}from"./property-scuRaFcM.js";import{spinnerIcon as a}from"../ui/icons/spinner-icon.js";import{e as l}from"./provide-BwI4DDGF.js";import{c as d}from"./consume-CovVqBjI.js";import{h as c}from"./task-CqjSKFwZ.js";import{A as p}from"./api-client-context-BXGqBAlO.js";import{f as h,A as m,C as u,c as v,n as g,i as b}from"./api-chat-client-Dx-sFrf2.js";import{r as f}from"./state-LQivXIgA.js";import{n as y}from"./create-context-DqP79qjF.js";import{g as w,p as x,a as k}from"./chunk-NIAGR3ZC-BDlNUZa1.js";import{env as $}from"../env.js";import{m as C}from"./runtime-Bg1WXVCx.js";import{l as E}from"./localized-decorator-BlOuLhym.js";import{a as _}from"./addSeconds-fO5orJrt.js";import{getLocale as S}from"../i18n.js";import{calendarIcon as z}from"../ui/icons/calendar-icon.js";import"../ui/mq-page-title.js";import"./professional-overview-Ck_SPivX.js";import{MqViewAppointmentsEvent as T}from"../events.js";import{clockIcon as O}from"../ui/icons/clock-icon.js";import"./documentation-view-BcA4Vbhp.js";import{l as q}from"./chunk-S5RWG6G2-CQJ38pW6.js";import{t as I,u as j,w as R,x as V,y as A}from"./telemetry-client-DA2_SZBC.js";import"./mq-chat-room-BkXGHzrd.js";import{chatbubbleIcon as N}from"../ui/icons/chat-bubble-icon.js";import{micIcon as U}from"../ui/icons/mic-icon.js";import{micOffIcon as W}from"../ui/icons/mic-off-icon.js";import{videoIcon as P}from"../ui/icons/video-icon.js";import{videoOffIcon as M}from"../ui/icons/video-off-icon.js";import"../ui/mq-unread-badge.js";import{Q as D}from"./query-controller-B1byDHlF.js";import{g as L}from"./chunk-Y4EKUX25-Bdei04iw.js";import{l as K}from"./chunk-FUCSYDW7-Duj5hy8S.js";import"../ui/mq-floating-bubble.js";import{e as F}from"./query-CeeutdfT.js";import{M as B}from"./mutation-controller-CR2qcqhH.js";import{alertCircleIcon as H}from"../ui/icons/alert-circle-icon.js";import"../ui/mq-rating.js";import{toast as G}from"../ui/mq-toast.js";import{heartBeatIcon as Q}from"../ui/icons/heartbeat-icon.js";import{timeLeftIcon as Y}from"../ui/icons/time-left-icon.js";import"./mq-layout-BndHxkbb.js";class PermissionController{constructor(t){this.state="prompt",this.host=t,t.addController(this)}async hostConnected(){await this.requestPermissions()}async requestPermissions(){try{const t=await navigator.mediaDevices.getUserMedia({video:!0,audio:!0});for(const e of t.getTracks())e.stop();this.state="granted"}catch{this.state="denied"}finally{this.host.requestUpdate()}}}class InvalidTokenError extends Error{}function Z(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(t){return decodeURIComponent(atob(t).replace(/(.)/g,(t,e)=>{let i=e.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i}))}(e)}catch(t){return atob(e)}}InvalidTokenError.prototype.name="InvalidTokenError";const J=y(Symbol("opentok-service")),X=y(Symbol("params"));class OpenTokService{static{this.URL="https://static.opentok.com/v2/js/opentok.min.js"}_ensureLoaded(){if(!window.OT)throw new Error("OpenTok SDK is not loaded");return window.OT}load(){return new Promise((t,e)=>{if(window.OT)return void t();const i=document.createElement("script");i.src=OpenTokService.URL,i.onload=()=>{t()},i.onerror=e,document.head.appendChild(i)})}initSession(t,e){return this._ensureLoaded().initSession(t,e)}initPublisher(t,e,i){return this._ensureLoaded().initPublisher(t,e,i)}subscribe(t,e,i,o,s){return t.subscribe(e,i,o,s)}}const tt="waiting-room",et="videocall",it="documentation",ot="not-time-yet",st="review";class OpenTokController{constructor(t,e,i,o,s,n){this.isLoading=!0,this.isSessionReady=!1,this.isReconnecting=!1,this.errorMessage="",this.session=null,this.streams=[],this.destroyedStreamIds=new Set,this.openTokService=new OpenTokService,this.session_token=null,this.hasLeftWaitingRoom=!1,this.host=t,this.apiClient=e,t.addController(this),this.appointment=i,this.token=o,this.onCallStarted=s,this.onCallFinished=n,this._loadOpentok()}async _loadOpentok(){try{await this.openTokService.load(),this._initializeSession()}catch{this.isLoading=!1,this.errorMessage="Failed to load OpenTok script",this.host.requestUpdate()}}async _getSessionAndToken(){const t=await this.apiClient.flash.joinCall({callId:this.appointment.call_id});return this.session_token=t.session_token,[t.session_id,t.session_token]}async _initializeSession(){try{const[t,e]=await this._getSessionAndToken();this.session=this.openTokService.initSession($.OPENTOK_API_KEY,t),this.session.on("sessionConnected",()=>{this.isLoading=!1,this.isSessionReady=!0,this.host.requestUpdate()}),this.session.on("sessionDisconnected",()=>{this.isSessionReady=!1,this._leaveWaitingRoom(),setTimeout(()=>{this.onCallFinished(),this.host.requestUpdate()},1e3),this.host.requestUpdate()}),this.session.on("sessionReconnecting",()=>{this.isReconnecting=!0,this.host.requestUpdate()}),this.session.on("sessionReconnected",()=>{this.isReconnecting=!1;const t=this.streams.filter(t=>!this.destroyedStreamIds.has(t.streamId));this.streams=[],this.host.requestUpdate(),requestAnimationFrame(()=>{this.streams=t.filter(t=>!this.destroyedStreamIds.has(t.streamId)),this.host.requestUpdate()})}),this.session.on("streamCreated",t=>{this.streams=[...this.streams,t.stream],this.onCallStarted(),this.host.requestUpdate()}),this.session.on("streamDestroyed",t=>{t.stream?.streamId&&this.destroyedStreamIds.add(t.stream.streamId),setTimeout(()=>{this.streams=this.streams.filter(e=>e.streamId!==t.stream?.streamId),this._leaveWaitingRoom(),this.onCallFinished(),this.host.requestUpdate()},1e3)}),this.session.connect(e,t=>{t&&(this.isLoading=!1,this.errorMessage=`Failed to connect to session: ${t.message}`,this.host.requestUpdate())}),this.apiClient.flash.setReady({professional_hash:this.appointment.from.hash,consultation_id:this.appointment.id,consultation_type:"appointment"})}catch(t){this.isLoading=!1,this.errorMessage=`Error initializing session: ${t instanceof Error?t.message:"Unknown error"}`,this.host.requestUpdate()}}_leaveWaitingRoom(){this.hasLeftWaitingRoom||(this.hasLeftWaitingRoom=!0,this.apiClient.flash.leaveWaitingRoom({professional_hash:this.appointment.from.hash,consultation_id:this.appointment.id,consultation_type:"appointment"}))}hostDisconnected(){this._leaveWaitingRoom(),this.session&&(this.session.disconnect(),this.session.off("streamCreated"),this.session.off("streamDestroyed"),this.session.off("sessionConnected"),this.session.off("sessionDisconnected"),this.session.off("sessionReconnecting"),this.session.off("sessionReconnected"))}}let nt=class NotTimeYetView extends i{static{this.styles=[o`mq-page-title{margin-bottom:var(--size-3)}.description{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-neutrals-text-default);font-weight:var(--font-weight-normal);margin:0;margin-bottom:var(--size-3)}.details-card{background-color:var(--color-background);border-radius:var(--border-radius-xl);padding:var(--size-6) var(--size-4);display:flex;min-width:0;flex-direction:column;gap:var(--size-6);margin-bottom:var(--size-6)}.details-card-title{padding:14px 0;font-size:var(--text-base);line-height:100%;font-weight:var(--font-weight-medium);color:var(--color-gray-darker);text-align:left}.details-rows{display:flex;flex-direction:column;gap:var(--size-3)}.details-row{display:flex;align-items:center;gap:var(--size-2);font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default);font-weight:var(--font-weight-semibold)}.details-row span::first-letter{text-transform:uppercase}@media (min-width:768px){.description{font-size:var(--text-base);line-height:var(--text-base--line-height);margin-bottom:var(--sp-6)}}`]}firstUpdated(){I.track(j(this.loginToken.patient.hash,this.appointment.id??""))}render(){const t=S()?.replace("_","-")??"es-ES",e=w(this.loginToken.patient.timezone),i=new Intl.DateTimeFormat(t,{dateStyle:"full",...e?{timeZone:e}:{}}),o=new Intl.DateTimeFormat(t,{timeStyle:"short",...e?{timeZone:e}:{}}),r=x(this.appointment.start_date),a=_(r,this.appointment.duration),l=e?k(e,r):"";return n`<mq-page-title .title="${C("¡Aún no es la hora!")}" back-label="${C("Salir")}" @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new T({tab:"next"}))}}"></mq-page-title><p class="description">${C("Cuando falten 10 minutos para tu consulta, podrás acceder a la videoconsulta")}</p><div class="details-card"><professional-overview .name="${this.appointment.from.name??""}" .specialtyName="${this.appointment.from.speciality??""}" .collegiateNumber="${this.appointment.from.collegiate_number??void 0}" .description="${this.appointment.from.description??""}" .languages="${this.appointment.from.languages}" .avatar="${this.appointment.from.avatar??""}"></professional-overview><div class="details-rows"><div class="details-row">${z({size:24})} <span>${i.format(r)}</span></div><div class="details-row">${O({size:24})} <span>${o.format(r)} - ${o.format(a)}${l?` (${l})`:""}</span></div></div></div>${!0===this.appointment.has_chat_in_appointment?n`<chat-cta .consultationId="${this.appointment.id}" .roomId="${Number(this.appointment.room_id)}" .professionalHash="${this.appointment.from.hash}" .text="${C("Utiliza el chat para enviar el motivo de consulta, documentos o imágenes")}" .onOpenChat="${()=>{I.track(R(this.loginToken.patient.hash,this.appointment.id??""))}}"></chat-cta>`:s}`}};t([r({type:Object})],nt.prototype,"appointment",void 0),t([d({context:q})],nt.prototype,"loginToken",void 0),nt=t([E(),e("not-time-yet-view")],nt);let rt=class PermissionStatusBanner extends i{static{this.styles=o`:host{display:block;padding:var(--size-5) var(--size-6);background-color:#ebf9ff;border-radius:var(--border-radius-lg);text-align:center}span{color:var(--color-neutrals-text-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal)}`}render(){return n`<span>${C("Espera a ser atendido sin salir de esta pantalla")}</span>`}};rt=t([E(),e("permission-status-banner")],rt);let at=class WaitingRoomLayout extends i{constructor(){super(...arguments),this.isWaitingRoom=!1}static{this.styles=o`.information-container{padding:var(--size-5) var(--size-4);background-color:var(--color-neutrals-background-disabled)}mq-page-title{margin-bottom:var(--size-4)}.content{max-width:560px;margin:0 auto}.information-container p{font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0}.video-container{margin-left:auto;margin-right:auto;margin-bottom:var(--size-6);position:relative;max-height:301px;aspect-ratio:9/16;border-radius:16px;overflow:hidden}@media (min-width:768px){.information-container{background-color:transparent;padding:var(--size-6) 0}.video-container{max-height:454px;aspect-ratio:16/9}.information-container p{font-size:var(--text-base);line-height:var(--text-base--line-height)}}`}firstUpdated(){this.isWaitingRoom&&I.track(V(this.loginToken.patient.hash,this.appointment.id??""))}render(){if(!this.isWaitingRoom)return n`<slot></slot>`;const t=S()?.replace("_","-")??"es-ES",e=w(this.loginToken.patient.timezone),i=e?{timeZone:e}:{},o=new Intl.DateTimeFormat(t,{dateStyle:"short",...i}),r=new Intl.DateTimeFormat(t,{timeStyle:"short",...i}),a=x(this.appointment.start_date),l=_(a,this.appointment.duration),d=e?k(e,a):"",c=o.format(a),p=`${r.format(a)} - ${r.format(l)}${d?` (${d})`:""}`;return n`<permission-status-banner></permission-status-banner><div class="content"><div class="information-container"><mq-page-title .title="${C("Sala de espera")}" back-label="${C("Salir")}" @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new T({tab:"next"}))}}"></mq-page-title><div class="doctor-info"><p>${this.appointment.from.name}</p><p>${c}</p><p>${p}</p></div></div><div class="video-container"><slot></slot></div>${!0===this.appointment.has_chat_in_appointment?n`<chat-cta .consultationId="${this.appointment.id}" .roomId="${Number(this.appointment.room_id)}" .professionalHash="${this.appointment.from.hash}" .text="${C("Utiliza el chat para enviar el motivo de consulta, documentos o imágenes")}" .onOpenChat="${()=>{I.track(R(this.loginToken.patient.hash,this.appointment.id??""))}}"></chat-cta>`:s}</div>`}};t([r({type:Object})],at.prototype,"appointment",void 0),t([r({type:Boolean,attribute:"is-waiting-room"})],at.prototype,"isWaitingRoom",void 0),t([d({context:q})],at.prototype,"loginToken",void 0),at=t([e("waiting-room-layout")],at);class AppointmentCounterController{constructor(t,e){this.startsAtGetter=e,this.formattedTime="--:--",this.interval=null,this.host=t,t.addController(this)}async hostConnected(){this.interval=setInterval(()=>{const t=new Date,e=this.startsAtGetter(),i=t.getTime()-e.getTime(),o=Math.floor(i/1e3),s=Math.floor(o/60),n=o%60;this.formattedTime=`${s.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`,this.host.requestUpdate()},1e3)}hostDisconnected(){this.interval&&clearInterval(this.interval)}}class ToggleAudioEvent extends Event{static{this.eventName="toggle-audio"}constructor(t){super(ToggleAudioEvent.eventName,{bubbles:!0,composed:!0}),this.isAudioOn=t}}class ToggleVideoEvent extends Event{static{this.eventName="toggle-video"}constructor(t){super(ToggleVideoEvent.eventName,{bubbles:!0,composed:!0}),this.isVideoOn=t}}class ToggleChatEvent extends Event{static{this.eventName="toggle-chat"}constructor(t){super(ToggleChatEvent.eventName,{bubbles:!0,composed:!0}),this.isChatOpen=t}}class ViewDocumentationEvent extends Event{static{this.eventName="view-documentation"}constructor(){super(ViewDocumentationEvent.eventName,{bubbles:!0,composed:!0})}}class DownloadFileEvent extends Event{static{this.eventName="download-file"}constructor(t,e){super(DownloadFileEvent.eventName,{bubbles:!0,composed:!0}),this.url=t,this.filename=e}}let lt=class PublisherControls extends i{constructor(){super(...arguments),this.isAudioOn=!1,this.isVideoOn=!0,this.isChatOpen=!1,this.chatEnabled=!1,this.isWaitingRoom=!1,this.unreadQuery=new D(this,()=>L(this.apiClient,{roomId:this.roomId}))}static{this.styles=o`:host{display:flex;justify-content:space-between;gap:var(--size-4)}:host([is-waiting-room]){justify-content:center}.left-controls{display:flex;gap:var(--size-4)}.control-button{border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;width:var(--size-10);height:var(--size-10);padding:var(--size-2);border-radius:12.5px;transition:all .2s ease-in-out}@media (min-width:768px){.control-button{width:var(--size-11);height:var(--size-11);padding:var(--size-2);border-radius:16px}}.control-button:hover{background-color:var(--color-gray-light)}.control-button:focus-visible{outline:0;box-shadow:0 0 0 2px var(--color-primary-light)}.control-button--on{background-color:var(--color-white);color:var(--color-primary)}.control-button--off{background-color:var(--color-white);color:var(--color-negative)}`}toggleAudio(){this.dispatchEvent(new ToggleAudioEvent(!this.isAudioOn))}toggleVideo(){this.dispatchEvent(new ToggleVideoEvent(!this.isVideoOn))}toggleChat(){this.dispatchEvent(new ToggleChatEvent(!this.isChatOpen))}render(){return n`<div class="left-controls">${this.isWaitingRoom||!this.chatEnabled?s:n`<button type="button" class="control-button control-button--on" @click="${this.toggleChat}">${N({size:20})} ${(this.unreadQuery.result?.data?.unread_count??0)>0?n`<mq-unread-badge></mq-unread-badge>`:s}</button>`} <button type="button" class="control-button ${this.isAudioOn?"control-button--on":"control-button--off"}" @click="${this.toggleAudio}">${this.isAudioOn?U({size:20}):W({size:20})}</button> <button type="button" class="control-button ${this.isVideoOn?"control-button--on":"control-button--off"}" @click="${this.toggleVideo}">${this.isVideoOn?P({size:20}):M({size:20})}</button></div>`}};t([d({context:p,subscribe:!0})],lt.prototype,"apiClient",void 0),t([r({type:Boolean})],lt.prototype,"isAudioOn",void 0),t([r({type:Boolean})],lt.prototype,"isVideoOn",void 0),t([r({type:Boolean})],lt.prototype,"isChatOpen",void 0),t([r({type:Boolean})],lt.prototype,"chatEnabled",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-waiting-room"})],lt.prototype,"isWaitingRoom",void 0),t([r({type:Number})],lt.prototype,"roomId",void 0),lt=t([e("publisher-controls")],lt);let dt=class VideoPublisher extends i{constructor(){super(...arguments),this.isWaitingRoom=!1,this.hasChatInAppointment=!1,this.appointmentCounterController=new AppointmentCounterController(this,()=>x(this.startsAt)),this.isAudioOn=!0,this.isVideoOn=!0,this.isChatOpen=!1,this._handleVisibilityChange=()=>{"visible"===document.visibilityState&&this.publisher&&(this.publisher.publishAudio(!1),this.publisher.publishVideo(!1),setTimeout(()=>{this.publisher?.publishAudio(this.isAudioOn),this.publisher?.publishVideo(this.isVideoOn)},500))}}static{this.styles=o`:host{width:100%;height:100%;display:block}.OT_video-element{width:100%;height:100%;background:var(--color-black)}.OT_mute{display:none}video{border-radius:var(--border-radius-lg)}#video-publisher{width:100%;height:100%;transition:width .5s ease-in-out,height .5s ease-in-out;border-radius:var(--border-radius-lg)}:host(:not([is-waiting-room])) #video-publisher{width:121px;height:200px;z-index:50;border-radius:12px;overflow:hidden}:host([is-waiting-room]) .top-items{position:absolute;inset:0}:host(:not([is-waiting-room])) .top-items{position:absolute;z-index:50;top:var(--size-4);left:var(--size-4);right:var(--size-4);display:flex;justify-content:space-between;gap:var(--size-1)}.meta-container{display:flex;align-items:flex-start;gap:var(--size-1);min-width:0}.meta-item{background-color:var(--color-neutrals-text-default);padding:var(--size-2) var(--size-3);color:var(--color-white);font-size:var(--text-xs);line-height:var(--text-xs--line-height);flex-shrink:0}.meta-item:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:1;min-width:0}publisher-controls{position:absolute;z-index:50;bottom:var(--size-4);left:var(--size-4);right:var(--size-4)}mq-chat-room{height:100%}@media (min-width:768px){:host(:not([is-waiting-room])) #video-publisher{width:250px;height:auto;aspect-ratio:16/9}:host(:not([is-waiting-room])) .top-items{top:var(--size-6);left:var(--size-6);right:var(--size-6)}}`}firstUpdated(t){super.firstUpdated(t),this.publisher=this.openTokService.initPublisher(this.publisherEl,{fitMode:"contain",width:"100%",height:"100%",audioFallbackEnabled:!1,insertMode:"append",mirror:!1,publishAudio:this.isAudioOn,publishVideo:this.isVideoOn},t=>{t&&K.error("error initializing publisher",t),this.session.publish(this.publisher)}),document.addEventListener("visibilitychange",this._handleVisibilityChange)}disconnectedCallback(){document.removeEventListener("visibilitychange",this._handleVisibilityChange),super.disconnectedCallback(),this.publisher?.destroy()}async _handleToggleAudioEvent(t){this.isAudioOn=t.isAudioOn,this.publisher.publishAudio(t.isAudioOn)}async _handleToggleVideoEvent(t){this.isVideoOn=t.isVideoOn,this.publisher.publishVideo(t.isVideoOn)}async _handleToggleChatEvent(t){this.isChatOpen=t.isChatOpen}render(){return n`<div class="top-items">${this.isWaitingRoom?n`<div></div>`:n`<div class="meta-container"><span class="meta-item">${this.professionalName}</span> <span class="meta-item">${this.appointmentCounterController.formattedTime}</span></div>`}<div id="video-publisher"></div></div><publisher-controls .isAudioOn="${this.isAudioOn}" .isVideoOn="${this.isVideoOn}" .isChatOpen="${this.isChatOpen}" .chatEnabled="${this.hasChatInAppointment}" .roomId="${Number.parseInt(this.roomId,10)}" ?is-waiting-room="${this.isWaitingRoom}" @toggle-audio="${this._handleToggleAudioEvent}" @toggle-video="${this._handleToggleVideoEvent}" @toggle-chat="${this._handleToggleChatEvent}"></publisher-controls>${this.hasChatInAppointment?n`<mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen?n`<mq-chat-room slot="content" .consultationId="${this.consultationId}" .consultationType="${u.appointment}" token="${this.loginToken.access_token}" .roomId="${Number.parseInt(this.roomId,10)}" .professionalHash="${this.professionalHash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room>`:s}</mq-floating-bubble>`:s}`}};t([r({type:String})],dt.prototype,"consultationId",void 0),t([r({type:String})],dt.prototype,"apiKey",void 0),t([r({type:String})],dt.prototype,"token",void 0),t([r({type:String})],dt.prototype,"roomId",void 0),t([r({type:String})],dt.prototype,"professionalHash",void 0),t([r({type:Object})],dt.prototype,"session",void 0),t([r({type:String})],dt.prototype,"professionalName",void 0),t([r({type:String})],dt.prototype,"startsAt",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-waiting-room"})],dt.prototype,"isWaitingRoom",void 0),t([r({type:Boolean})],dt.prototype,"hasChatInAppointment",void 0),t([d({context:J})],dt.prototype,"openTokService",void 0),t([d({context:q})],dt.prototype,"loginToken",void 0),t([F("#video-publisher")],dt.prototype,"publisherEl",void 0),t([f()],dt.prototype,"isAudioOn",void 0),t([f()],dt.prototype,"isVideoOn",void 0),t([f()],dt.prototype,"isChatOpen",void 0),dt=t([e("video-publisher")],dt);let ct=class VideoSubscriber extends i{constructor(){super(...arguments),this.isVideoOn=!0,this._subscriberProperties={fitMode:"contain",insertMode:"append",width:"100%",height:"100%"},this._handleVisibilityChange=()=>{"visible"===document.visibilityState&&this.subscriber&&(this.subscriber.subscribeToAudio(!1),this.subscriber.subscribeToVideo(!1),setTimeout(()=>{this.subscriber?.subscribeToAudio(!0),this.subscriber?.subscribeToVideo(!0)},500),setTimeout(()=>this._resubscribe(),600))}}static{this.styles=o`:host{position:absolute;inset:0}.OT_subscriber{width:100%;height:100%;position:absolute;inset:0;background:var(--color-neutrals-background-default)}video{width:100%;height:100%}.video-disabled{position:absolute;inset:0;background:var(--color-gray-dark)}.hidden{display:none}`}firstUpdated(){this._subscribe(),document.addEventListener("visibilitychange",this._handleVisibilityChange)}_subscribe(){this.subscriber=this.openTokService.subscribe(this.session,this.stream,this.subscriberEl,this._subscriberProperties,t=>{}),this._attachSubscriberEvents()}_attachSubscriberEvents(){this.subscriber.on("connected",t=>{this.isVideoOn=t.target.stream?.hasVideo??!0}),this.subscriber.on("videoDisabled",()=>{this.isVideoOn=!1}),this.subscriber.on("videoEnabled",()=>{this.isVideoOn=!0}),this.subscriber.on("disconnected",()=>{this.isVideoOn=!1})}_resubscribe(){if(this.subscriber&&this.session&&this.subscriberEl){try{this.session.unsubscribe(this.subscriber)}catch{}this.subscriberEl.innerHTML="",this._subscribe()}}disconnectedCallback(){if(document.removeEventListener("visibilitychange",this._handleVisibilityChange),this.subscriber&&this.session)try{this.session.unsubscribe(this.subscriber)}catch{}super.disconnectedCallback()}render(){return n`<div id="video-subscriber" class="${this.isVideoOn?"":"hidden"}"></div>${this.isVideoOn?n``:n`<div class="video-disabled"></div>`}`}};t([r({type:Object})],ct.prototype,"session",void 0),t([r({type:Object})],ct.prototype,"stream",void 0),t([f()],ct.prototype,"isVideoOn",void 0),t([d({context:J})],ct.prototype,"openTokService",void 0),t([F("#video-subscriber")],ct.prototype,"subscriberEl",void 0),ct=t([e("video-subscriber")],ct);let pt=class VideocallContent extends i{constructor(){super(...arguments),this.streams=[],this.isWaitingRoom=!1,this.isReconnecting=!1}static{this.styles=o`:host{display:block;position:relative;width:100%;height:100%;background:var(--color-gray-darkest);aspect-ratio:16/9}.reconnecting-overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--size-3);background:rgba(0,0,0,.6);z-index:100}.reconnecting-overlay__text{color:var(--color-white);font-size:var(--text-sm);line-height:var(--text-sm--line-height)}.reconnecting-overlay__subtitle{color:var(--color-white);font-size:var(--text-xs);line-height:var(--text-xs--line-height);opacity:.85}`}firstUpdated(){this.isWaitingRoom||I.track(A(this.loginToken.patient.hash,this.appointment.id??""))}updated(t){t.has("isWaitingRoom")&&!0===t.get("isWaitingRoom")&&!this.isWaitingRoom&&I.track(A(this.loginToken.patient.hash,this.appointment.id??""))}render(){return n`<video-publisher .consultationId="${this.appointment.id}" .session="${this.session}" ?is-waiting-room="${this.isWaitingRoom}" .professionalName="${this.appointment.from.name??""}" .professionalHash="${this.appointment.from.hash}" .startsAt="${this.appointment.started_at??(new Date).toISOString()}" .apiKey="${this.apiKey}" .token="${this.token}" .roomId="${this.appointment.room_id}" .hasChatInAppointment="${!0===this.appointment.has_chat_in_appointment}"></video-publisher>${0===this.streams.length?n``:this.streams.map(t=>n`<video-subscriber .session="${this.session}" .stream="${t}"></video-subscriber>`)} ${this.isReconnecting?n`<div class="reconnecting-overlay">${a({color:"var(--color-white)"})} <span class="reconnecting-overlay__text">${C("Reconectando...")} </span><span class="reconnecting-overlay__subtitle">${C("Espere mientras se restablece la conexión")}</span></div>`:""}`}};t([r({type:Object})],pt.prototype,"session",void 0),t([r({type:Array})],pt.prototype,"streams",void 0),t([r({type:String})],pt.prototype,"apiKey",void 0),t([r({type:String})],pt.prototype,"token",void 0),t([r({type:Object})],pt.prototype,"appointment",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-waiting-room"})],pt.prototype,"isWaitingRoom",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-reconnecting"})],pt.prototype,"isReconnecting",void 0),t([d({context:q})],pt.prototype,"loginToken",void 0),pt=t([E(),e("mq-videocall-content")],pt);class ReviewSubmittedEvent extends Event{static{this.eventName="review-submitted"}constructor(){super(ReviewSubmittedEvent.eventName,{bubbles:!0,composed:!0})}}class ReviewSkippedEvent extends Event{static{this.eventName="review-skipped"}constructor(){super(ReviewSkippedEvent.eventName,{bubbles:!0,composed:!0})}}let ht=class ReviewView extends i{constructor(){super(...arguments),this.rating=0,this.comment="",this._reviewMutation=new B(this,{mutationFn:({rating:t,comment:e})=>this.apiClient.consultations.postReview({consultation_id:this.appointment.id??"",consultation_type:u.appointment,rating:t,comment:e.trim()?e.trim():null}),onSuccess:()=>{this.dispatchEvent(new ReviewSubmittedEvent)},onError:t=>{!function(t){const e=t,i=e?.response?.status;return 400===i&&/already exists/i.test(e?.response?.data?.message??"")}(t)?G.error(C("No se ha podido enviar el cuestionario")):this.dispatchEvent(new ReviewSubmittedEvent)}}),this._reconnectMutation=new B(this,{mutationFn:t=>this.apiClient.appointments.reconnectAppointment(t),onSuccess:()=>{this.dispatchEvent(new CustomEvent("review-reconnect",{bubbles:!0,composed:!0}))},onError:()=>{G.error(C("No se ha podido volver a la sala de espera"))}}),this.handleSkip=()=>{this.dispatchEvent(new ReviewSkippedEvent)},this.handleSubmit=()=>{this.rating<1||this.rating>5||this._reviewMutation.isPending||this._reviewMutation.run({rating:this.rating,comment:this.comment})}}static{this.styles=o`:host{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100%;background-color:var(--color-background);box-sizing:border-box}.container{width:100%;max-width:500px;padding:var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-5);box-sizing:border-box}.title{margin:0;padding:0 var(--sp-6);font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-normal);color:var(--color-primary);text-align:center}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--sp-2);padding:var(--sp-1) var(--sp-6)}.subtitle{margin:0;font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-text-icons--secondary);text-align:center}.comment-card{background-color:var(--color-white);border:var(--action-border-width) solid var(--color-border);border-radius:var(--border-radius-lg);box-shadow:0 4px 4px rgba(0,0,0,.05);padding:var(--sp-5);display:flex;flex-direction:column;gap:var(--sp-5)}.comment-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--sp-3)}.comment-label{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm);font-weight:var(--font-weight-medium);color:var(--color-neutrals-text-default)}.comment-counter{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-text-icons--secondary);white-space:nowrap}.textarea{width:100%;box-sizing:border-box;height:var(--size-44);padding:var(--sp-3) var(--sp-4);background-color:var(--color-gray-lighter);border:var(--action-border-width) solid var(--color-border);border-radius:var(--border-radius-md);font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-neutrals-text-default);resize:none}.textarea::placeholder{color:var(--color-text-icons--secondary);opacity:.6}.textarea:focus{outline:0;border-color:var(--color-primary)}.actions{display:flex;gap:var(--sp-4)}.btn{flex:1;height:var(--button-height-md);padding:var(--sp-2) var(--sp-4);border-radius:var(--border-radius-md);font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-medium);cursor:pointer;transition:opacity .15s ease-in-out}.btn:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.btn:disabled{cursor:not-allowed}.btn-skip{background:var(--color-white);border:var(--action-border-width) solid var(--color-primary);color:var(--color-primary)}.btn-skip:hover:not(:disabled){background:var(--color-primary-background-extraWeak)}.btn-submit{background:var(--color-primary);border:var(--action-border-width) solid var(--color-primary);color:var(--color-white)}.btn-submit:hover:not(:disabled){background:var(--color-primary-dark)}.btn-submit:disabled{opacity:.5}.waiting-card{background-color:var(--color-background-primary-light);border-radius:var(--border-radius-lg);padding:var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-2)}.waiting-header{display:flex;align-items:center;gap:var(--sp-2);color:var(--color-neutrals-text-default)}.waiting-title{font-family:var(--font-body);font-size:var(--text-xs);line-height:1;font-weight:var(--font-weight-medium);color:var(--color-neutrals-text-default)}.waiting-body{margin:0;font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);color:var(--color-text-icons--secondary)}.waiting-link{background:0 0;border:0;padding:0;cursor:pointer;color:#3c50ec;font:inherit;text-decoration:none}.waiting-link:hover{text-decoration:none}.waiting-link:disabled{cursor:not-allowed;opacity:.6}`}render(){return n`<div class="container"><h1 class="title">${C("¿Qué tal ha ido tu cita?")}</h1><div class="rating"><mq-rating .value="${this.rating}" .label="${C("Valoración de la consulta")}" @mq-rating-change="${t=>{this.rating=t.value}}"></mq-rating><p class="subtitle">${C("(1 es muy malo, 5 es excelente)")}</p></div><div class="comment-card"><div class="comment-header"><span class="comment-label">${C("¿Tienes comentarios sobre la consulta?")}</span> <span class="comment-counter">${this.comment.length}/${240}</span></div><textarea class="textarea" maxlength="${240}" placeholder="${C("Comparte cómo fue la atención o si tuviste algún problema con la videollamada…")}" .value="${this.comment}" @input="${t=>{this.comment=t.target.value}}"></textarea><div class="actions"><button type="button" class="btn btn-skip" ?disabled="${this._reviewMutation.isPending}" @click="${this.handleSkip}">${C("Omitir")}</button> <button type="button" class="btn btn-submit" ?disabled="${this.rating<1||this._reviewMutation.isPending}" @click="${this.handleSubmit}">${C("Enviar")}</button></div></div><div class="waiting-card"><div class="waiting-header">${H({color:"currentColor",size:18})} <span class="waiting-title">${C("¿Ocurrió algún problema?")}</span></div><p class="waiting-body">${C("Si la cita no se ha podido realizar, puedes")} <button type="button" class="waiting-link" ?disabled="${this._reconnectMutation.isPending}" @click="${()=>this._reconnectMutation.run({appointmentId:this.appointment.id})}">${C("volver a la sala de espera.")}</button></p></div></div>`}};t([d({context:p,subscribe:!0})],ht.prototype,"apiClient",void 0),t([r({type:Object})],ht.prototype,"appointment",void 0),t([f()],ht.prototype,"rating",void 0),t([f()],ht.prototype,"comment",void 0),ht=t([E(),e("review-view")],ht);let mt=class ErrorView extends i{static{this.styles=o`.container{display:grid;place-items:center;width:100%;max-width:447px;margin:0 auto}.card>:not(:first-child){margin-top:var(--size-8)}.title{font-family:var(--font-titles);color:var(--color-neutrals-text-default);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0;margin-bottom:var(--size-3)}.description{color:var(--color-neutrals-text-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:400}`}render(){return n`<div class="container"><div class="card"><slot name="icon"></slot><div class="content"><h1 class="title">${this.title}</h1><p class="description">${this.message}</p></div></div></div>`}};t([r({type:String})],mt.prototype,"title",void 0),t([r({type:String})],mt.prototype,"message",void 0),mt=t([e("error-view")],mt);let ut=class UnexpectedErrorView extends i{render(){return n`<error-view .title="${C("Error desconocido")}" .message="${C("Ha ocurrido un error al cargar la página. Por favor, intenta nuevamente o contacta al soporte.")}"><div slot="icon">${Q()}</div></error-view>`}};ut=t([E(),e("unexpected-error-view")],ut);let vt=class ExpiredAppointmentErrorView extends i{render(){return n`<error-view .title="${C("Consulta caducada")}" .message="${C("Parece que no te hemos encontrado a la hora de tu cita. Puedes programar otra consulta para resolver tus dudas.")}"><div slot="icon">${Y()}</div></error-view>`}};vt=t([E(),e("expired-appointment-error-view")],vt);let gt=class NotFoundErrorView extends i{static{this.styles=o`div{display:flex;flex-direction:column;gap:2px}span{font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:400;color:var(--color-gray-medium)}`}render(){return n`<error-view .title="${C("Página no encontrada")}" .message="${C("La página que estás buscando fue removida, renombrada o puede que no exista.")}"><div slot="icon"><span>404</span> ${Q()}</div></error-view>`}};function bt(t){try{return function(t,e){if("string"!=typeof t)throw new InvalidTokenError("Invalid token specified: must be a string");e||(e={});const i=!0===e.header?0:1,o=t.split(".")[i];if("string"!=typeof o)throw new InvalidTokenError(`Invalid token specified: missing part #${i+1}`);let s;try{s=Z(o)}catch(t){throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${i+1} (${t.message})`)}try{return JSON.parse(s)}catch(t){throw new InvalidTokenError(`Invalid token specified: invalid json for part #${i+1} (${t.message})`)}}(t)}catch{return null}}gt=t([E(),e("not-found-error-view")],gt);let ft=class MqVideocallProvider extends i{static{this.styles=o`*{box-sizing:border-box}:host{display:block;margin:0 auto;width:100%;height:100%}.centered{display:grid;place-items:center;height:100%;min-height:var(--mq-container-min-height)}documentation-view{display:block;padding:var(--sp-4)}`}constructor(){super(),this.apiClient=v(),this.opentokService=new OpenTokService,this.params={appointmentId:this.appointmentId,token:this.token,apiKey:this.apiKey},this.appointmentTask=new c(this,{task:async([t,,])=>{const[e,i,o]=await Promise.all([this.apiClient.flash.getAppointment({appointmentId:t}),this.apiClient.consultations.getReview(t).then(()=>!0).catch(()=>!1),this.apiClient.organizations.getOrganizationSetup().catch(()=>{})]);return{appointment:e,hasReview:i,hasNps:!0===o?.appointments?.has_nps}},args:()=>[this.appointmentId,this.apiKey,this.token]})}willUpdate(t){const e=g(t,{apiKey:this.apiKey,token:this.token},this.inheritedApiClient);if(e&&(this.apiClient=e),this.appointmentTask.value&&!this.opentokController){const{appointment:t,hasReview:e,hasNps:i}=this.appointmentTask.value,o=function(t,e){return h(t)?t.status===m.finished||t.status===m.reporting?e?st:it:tt:ot}(t,i);this.screen=o===st&&e?it:o,this.params={appointmentId:this.appointmentId,token:this.token,apiKey:this.apiKey},this.opentokController=new OpenTokController(this,this.apiClient,t,this.token,()=>{this.screen=et},()=>{this.screen=!i||e?it:st})}}render(){const t=n`<div class="centered">${a({color:"var(--color-primary)"})}</div>`,e=n`<mq-layout background="transparent"><not-found-error-view></not-found-error-view></mq-layout>`;return this.appointmentTask.render({pending:()=>t,error:t=>{const i=bt(this.token);return i?.exp&&i.exp<Date.now()/1e3?n`<mq-layout background="transparent"><expired-appointment-error-view></expired-appointment-error-view></mq-layout>`:b(t)&&t.response?.status&&t.response.status<500?e:n`<mq-layout background="transparent"><unexpected-error-view></unexpected-error-view></mq-layout>`},complete:({appointment:i,hasNps:o})=>{if(this.opentokController?.isLoading)return t;if(this.opentokController?.errorMessage||!this.opentokController)return e;if(this.screen===ot)return n`<mq-layout background="transparent"><not-time-yet-view .appointment="${i}"></not-time-yet-view></mq-layout>`;if(this.screen===st)return n`<mq-layout background="transparent"><review-view .appointment="${i}" @review-submitted="${()=>{this.screen=it}}" @review-skipped="${()=>{this.screen=it}}" @review-reconnect="${()=>{this.screen=tt}}"></review-view></mq-layout>`;if(this.screen===it)return n`<mq-layout background="transparent"><documentation-view .appointment="${i}" .token="${this.token}" ?can-reconnect="${!o}" @reconnect="${()=>{this.screen=tt}}"></documentation-view></mq-layout>`;if(this.screen===tt||this.screen===et){const e=this.opentokController.session;return e?n`<waiting-room-layout .appointment="${i}" ?is-waiting-room="${this.screen===tt}"><mq-videocall-content .apiKey="${this.apiKey}" .token="${this.token}" .session="${e}" .streams="${this.opentokController?.streams??[]}" ?is-waiting-room="${this.screen===tt}" ?is-reconnecting="${this.opentokController.isReconnecting}" .appointment="${i}"></mq-videocall-content></waiting-room-layout>`:t}return n`<mq-layout background="transparent"><unexpected-error-view></unexpected-error-view></mq-layout>`}})}};t([r({type:String,attribute:"appointment-id"})],ft.prototype,"appointmentId",void 0),t([r({type:String,attribute:"api-key"})],ft.prototype,"apiKey",void 0),t([r({type:String})],ft.prototype,"token",void 0),t([d({context:p,subscribe:!0}),f()],ft.prototype,"inheritedApiClient",void 0),t([l({context:p}),f()],ft.prototype,"apiClient",void 0),t([f()],ft.prototype,"screen",void 0),t([l({context:J})],ft.prototype,"opentokService",void 0),t([l({context:X})],ft.prototype,"params",void 0),ft=t([e("mq-videocall-provider")],ft);let yt=class PermissionsRequiredErrorView extends i{static{this.styles=o`.img-container{display:flex;justify-content:center}img{width:100%;height:auto;max-width:229px}`}render(){return n`<error-view .title="${C("Acepta los permisos de cámara y micrófono")}" .message="${C("Parece que has denegado los permisos necesarios para entrar a la videollamada. Edita los permisos en tu navegador para entrar. Una vez concedidos, debes refrescar esta pantalla.")}"><div class="img-container" slot="icon"><img src="${`${$.ASSETS_BASE_URL}/wc-videocall/Miccam_asset.png`}" alt="Miccam_asset" width="229" height="166.44"></div></error-view>`}};yt=t([E(),e("permissions-required-error-view")],yt);let wt=class MqVideocall extends i{constructor(){super(...arguments),this._permissionController=new PermissionController(this)}static{this.styles=o`:host{display:block;width:100%;height:100%}.loading-spinner-container{height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}.permissions-required-error-view-container{height:100%;padding-left:var(--size-4);padding-right:var(--size-4);display:grid;place-items:center}`}render(){return"prompt"===this._permissionController.state?n`<div class="loading-spinner-container">${a({color:"var(--color-primary)"})}</div>`:"denied"===this._permissionController.state?n`<div class="permissions-required-error-view-container"><permissions-required-error-view></permissions-required-error-view></div>`:n`<mq-videocall-provider .appointmentId="${this.appointmentId}" .token="${this.token}" .apiKey="${this.apiKey}"></mq-videocall-provider>`}};t([r({type:String,attribute:"appointment-id"})],wt.prototype,"appointmentId",void 0),t([r({type:String,attribute:"api-key"})],wt.prototype,"apiKey",void 0),t([r({type:String})],wt.prototype,"token",void 0),wt=t([e("mq-videocall")],wt);export{DownloadFileEvent as D,wt as M,ReviewSkippedEvent as R,ToggleAudioEvent as T,ViewDocumentationEvent as V,ReviewSubmittedEvent as a,ToggleChatEvent as b,ToggleVideoEvent as c};