@cloudflare/realtimekit-ui 2.0.3-staging.5 → 2.0.3-staging.7

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.
@@ -31,8 +31,11 @@ const RtkAudioTile = class {
31
31
  this.audioEnabled = false;
32
32
  this.volume = 0;
33
33
  this.onAudioUpdate = ({ audioEnabled, audioTrack, }) => {
34
+ var _a;
34
35
  if (!this.participant)
35
36
  return;
37
+ // stop the analyser of the previous track so it does not keep polling
38
+ (_a = this.hark) === null || _a === void 0 ? void 0 : _a.stop();
36
39
  if (audioEnabled && audioTrack) {
37
40
  const stream = new MediaStream();
38
41
  stream.addTrack(audioTrack);
@@ -352,7 +352,7 @@ const RtkSpeakerSelector = class {
352
352
  var _a, _b, _c;
353
353
  (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.self.removeListener('deviceListUpdate', this.deviceListUpdateListener);
354
354
  (_b = this.meeting) === null || _b === void 0 ? void 0 : _b.self.removeListener('deviceUpdate', this.deviceUpdateListener);
355
- (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.self.addListener('mediaPermissionUpdate', this.mediaPermissionUpdate);
355
+ (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.self.removeListener('mediaPermissionUpdate', this.mediaPermissionUpdate);
356
356
  }
357
357
  meetingChanged(meeting) {
358
358
  if (!meeting)
@@ -21,8 +21,11 @@ export class RtkAudioTile {
21
21
  this.audioEnabled = false;
22
22
  this.volume = 0;
23
23
  this.onAudioUpdate = ({ audioEnabled, audioTrack, }) => {
24
+ var _a;
24
25
  if (!this.participant)
25
26
  return;
27
+ // stop the analyser of the previous track so it does not keep polling
28
+ (_a = this.hark) === null || _a === void 0 ? void 0 : _a.stop();
26
29
  if (audioEnabled && audioTrack) {
27
30
  const stream = new MediaStream();
28
31
  stream.addTrack(audioTrack);
@@ -61,7 +61,7 @@ export class RtkSpeakerSelector {
61
61
  var _a, _b, _c;
62
62
  (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.self.removeListener('deviceListUpdate', this.deviceListUpdateListener);
63
63
  (_b = this.meeting) === null || _b === void 0 ? void 0 : _b.self.removeListener('deviceUpdate', this.deviceUpdateListener);
64
- (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.self.addListener('mediaPermissionUpdate', this.mediaPermissionUpdate);
64
+ (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.self.removeListener('mediaPermissionUpdate', this.mediaPermissionUpdate);
65
65
  }
66
66
  meetingChanged(meeting) {
67
67
  if (!meeting)
@@ -0,0 +1 @@
1
+ import{p as t,H as e,w as i,h as s,d as r,t as a}from"./p-BBHQOrFK.js";import{e as o,i as n}from"./p-DhwysA2e.js";import{S as c}from"./p-bRRQr4xn.js";import{i as p}from"./p-CAqYddlg.js";import{d as l}from"./p-D6vw6bT2.js";import{d}from"./p-BYIBbfJ8.js";var v=function(t,e,i,s){var r,a=arguments.length,o=a<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(a<3?r(o):a>3?r(e,i,o):r(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o};const h=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.variant="full",this.iconPack=o,this.t=n(),this.speakerDevices=[],this.currentDevices={speaker:void 0},this.deviceListUpdateListener=async()=>{const t=await this.meeting.self.getSpeakerDevices();this.speakerDevices=t},this.deviceUpdateListener=({device:t})=>{"audiooutput"===t.kind&&(this.currentDevices={speaker:t})},this.mediaPermissionUpdate=async({kind:t,message:e})=>{this.meeting&&"audio"===t&&"ACCEPTED"===e&&(this.speakerDevices=await this.meeting.self.getSpeakerDevices())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e,i;null===(t=this.meeting)||void 0===t||t.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),null===(e=this.meeting)||void 0===e||e.self.removeListener("deviceUpdate",this.deviceUpdateListener),null===(i=this.meeting)||void 0===i||i.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdate)}meetingChanged(t){t&&i((async()=>{var e,i;const{self:s}=t,r=await t.self.getSpeakerDevices(),a=null===(e=t.self.getCurrentDevices())||void 0===e?void 0:e.speaker;this.currentDevices={speaker:a},s.addListener("deviceListUpdate",this.deviceListUpdateListener),s.addListener("deviceUpdate",this.deviceUpdateListener),s.addListener("mediaPermissionUpdate",this.mediaPermissionUpdate),this.speakerDevices=null!=a?[null!==(i=r.find((t=>t.deviceId===a.deviceId)))&&void 0!==i?i:a,...r.filter((t=>t.deviceId!==a.deviceId))]:r}))}testAudio(){var t;null===(t=this.testAudioEl)||void 0===t||t.play()}setDevice(t){var e,i;if(p(this.meeting))return;const s=this.speakerDevices.find((e=>e.deviceId===t));this.currentDevices={speaker:s},null!=s&&(null===(e=this.meeting)||void 0===e||e.self.setDevice(s),null===(i=this.testAudioEl)||void 0===i||i.setSinkId(s.deviceId))}render(){if(!this.meeting)return null;let t=0;return s(r,null,s("audio",{preload:"auto",src:"https://rtk-assets.realtime.cloudflare.com/ui-kit/speaker-test.mp3",ref:t=>this.testAudioEl=t}),s("div",{class:"group "+this.variant,part:"speaker-selection"},this.speakerDevices.length>0&&!p(this.meeting)&&s("div",{class:"container"},s("label",null,"inline"!==this.variant&&this.t("settings.speaker_output"),s("rtk-icon",{icon:this.iconPack.speaker,size:"sm"})),s("div",{class:"row"},s("select",{class:"rtk-select",onChange:t=>this.setDevice(t.target.value)},this.speakerDevices.map((({deviceId:e,label:i})=>{var r;return s("option",{value:e,selected:(null===(r=this.currentDevices.speaker)||void 0===r?void 0:r.deviceId)===e},i||"Speaker "+ ++t)}))))),"full"===this.variant&&s("rtk-button",{variant:"secondary",onClick:()=>this.testAudio()},s("rtk-icon",{icon:this.iconPack.speaker,slot:"start"}),this.t("test"))))}static get watchers(){return{meeting:[{meetingChanged:0}]}}static get style(){return".rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.inline.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0\\.5, 2px)}.inline.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline .container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}"}},[1,"rtk-speaker-selector",{meeting:[16],states:[16],variant:[1],size:[513],iconPack:[16],t:[16],speakerDevices:[32],currentDevices:[32]},void 0,{meeting:[{meetingChanged:0}]}]);function g(){"undefined"!=typeof customElements&&["rtk-speaker-selector","rtk-button","rtk-icon"].forEach((t=>{switch(t){case"rtk-speaker-selector":customElements.get(a(t))||customElements.define(a(t),h);break;case"rtk-button":customElements.get(a(t))||l();break;case"rtk-icon":customElements.get(a(t))||d()}}))}v([c()],h.prototype,"meeting",void 0),v([c()],h.prototype,"states",void 0),v([c()],h.prototype,"iconPack",void 0),v([c()],h.prototype,"t",void 0),g();export{h as R,g as d}
@@ -1 +1 @@
1
- import{p as t,H as s,c as i,h as e,d as o,t as r}from"./p-BBHQOrFK.js";import{e as a,i as n}from"./p-DhwysA2e.js";import{b as c,s as l}from"./p-Dguuxuf6.js";import{S as p}from"./p-bRRQr4xn.js";import{d as m}from"./p-Dh8N1Wv8.js";import{d as u}from"./p-D6vw6bT2.js";import{d}from"./p-BYIBbfJ8.js";import{d as k}from"./p-BxPmWGqJ.js";import{d as f}from"./p-BGz4FsG8.js";import{d as h}from"./p-5i84b0Gw.js";var g=function(t,s,i,e){var o,r=arguments.length,a=r<3?s:null===e?e=Object.getOwnPropertyDescriptor(s,i):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,s,i,e);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(r<3?o(a):r>3?o(s,i,a):o(s,i))||a);return r>3&&a&&Object.defineProperty(s,i,a),a};const v=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.stateUpdate=i(this,"rtkStateUpdate",7),this.iconPack=a,this.t=n()}render(){var t,s;if(!this.meeting)return null;const i={meeting:this.meeting,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},r=this.states,a=!0===(null===(t=null==r?void 0:r.prefs)||void 0===t?void 0:t.muteNotificationSounds)||"true"===c("mute-notification-sounds");return e(o,null,e("rtk-microphone-selector",Object.assign({},i),e("rtk-audio-visualizer",{participant:null===(s=this.meeting)||void 0===s?void 0:s.self,iconPack:this.iconPack,t:this.t,slot:"indicator"})),e("rtk-speaker-selector",Object.assign({},i)),e("div",{class:"group",part:"notification-toggle"},e("div",{class:"row"},e("label",{htmlFor:"notification-toggle"},this.t("settings.notification_sound")),e("rtk-switch",{id:"notification-toggle",checked:!a,onRtkChange:t=>{const{checked:s}=t.target,i=!s;this.stateUpdate.emit({prefs:{muteNotificationSounds:i}}),l("mute-notification-sounds",i)},iconPack:this.iconPack,t:this.t}))))}static get style(){return":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;width:100%;flex-direction:column}audio{visibility:hidden}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.row{display:flex;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}rtk-audio-visualizer{flex-shrink:0}rtk-button{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}rtk-button rtk-icon{margin-right:var(--rtk-space-2, 8px)}"}},[1,"rtk-settings-audio",{meeting:[16],states:[16],size:[513],iconPack:[16],t:[16]}]);function b(){"undefined"!=typeof customElements&&["rtk-settings-audio","rtk-audio-visualizer","rtk-button","rtk-icon","rtk-microphone-selector","rtk-speaker-selector","rtk-switch"].forEach((t=>{switch(t){case"rtk-settings-audio":customElements.get(r(t))||customElements.define(r(t),v);break;case"rtk-audio-visualizer":customElements.get(r(t))||m();break;case"rtk-button":customElements.get(r(t))||u();break;case"rtk-icon":customElements.get(r(t))||d();break;case"rtk-microphone-selector":customElements.get(r(t))||k();break;case"rtk-speaker-selector":customElements.get(r(t))||f();break;case"rtk-switch":customElements.get(r(t))||h()}}))}g([p()],v.prototype,"meeting",void 0),g([p()],v.prototype,"states",void 0),g([p()],v.prototype,"iconPack",void 0),g([p()],v.prototype,"t",void 0),b();export{v as R,b as d}
1
+ import{p as t,H as s,c as i,h as e,d as o,t as r}from"./p-BBHQOrFK.js";import{e as a,i as n}from"./p-DhwysA2e.js";import{b as c,s as l}from"./p-Dguuxuf6.js";import{S as p}from"./p-bRRQr4xn.js";import{d as m}from"./p-Dh8N1Wv8.js";import{d as u}from"./p-D6vw6bT2.js";import{d}from"./p-BYIBbfJ8.js";import{d as k}from"./p-BxPmWGqJ.js";import{d as f}from"./p-CHOs-ZsL.js";import{d as h}from"./p-5i84b0Gw.js";var g=function(t,s,i,e){var o,r=arguments.length,a=r<3?s:null===e?e=Object.getOwnPropertyDescriptor(s,i):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,s,i,e);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(r<3?o(a):r>3?o(s,i,a):o(s,i))||a);return r>3&&a&&Object.defineProperty(s,i,a),a};const v=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.stateUpdate=i(this,"rtkStateUpdate",7),this.iconPack=a,this.t=n()}render(){var t,s;if(!this.meeting)return null;const i={meeting:this.meeting,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},r=this.states,a=!0===(null===(t=null==r?void 0:r.prefs)||void 0===t?void 0:t.muteNotificationSounds)||"true"===c("mute-notification-sounds");return e(o,null,e("rtk-microphone-selector",Object.assign({},i),e("rtk-audio-visualizer",{participant:null===(s=this.meeting)||void 0===s?void 0:s.self,iconPack:this.iconPack,t:this.t,slot:"indicator"})),e("rtk-speaker-selector",Object.assign({},i)),e("div",{class:"group",part:"notification-toggle"},e("div",{class:"row"},e("label",{htmlFor:"notification-toggle"},this.t("settings.notification_sound")),e("rtk-switch",{id:"notification-toggle",checked:!a,onRtkChange:t=>{const{checked:s}=t.target,i=!s;this.stateUpdate.emit({prefs:{muteNotificationSounds:i}}),l("mute-notification-sounds",i)},iconPack:this.iconPack,t:this.t}))))}static get style(){return":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;width:100%;flex-direction:column}audio{visibility:hidden}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.row{display:flex;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}rtk-audio-visualizer{flex-shrink:0}rtk-button{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}rtk-button rtk-icon{margin-right:var(--rtk-space-2, 8px)}"}},[1,"rtk-settings-audio",{meeting:[16],states:[16],size:[513],iconPack:[16],t:[16]}]);function b(){"undefined"!=typeof customElements&&["rtk-settings-audio","rtk-audio-visualizer","rtk-button","rtk-icon","rtk-microphone-selector","rtk-speaker-selector","rtk-switch"].forEach((t=>{switch(t){case"rtk-settings-audio":customElements.get(r(t))||customElements.define(r(t),v);break;case"rtk-audio-visualizer":customElements.get(r(t))||m();break;case"rtk-button":customElements.get(r(t))||u();break;case"rtk-icon":customElements.get(r(t))||d();break;case"rtk-microphone-selector":customElements.get(r(t))||k();break;case"rtk-speaker-selector":customElements.get(r(t))||f();break;case"rtk-switch":customElements.get(r(t))||h()}}))}g([p()],v.prototype,"meeting",void 0),g([p()],v.prototype,"states",void 0),g([p()],v.prototype,"iconPack",void 0),g([p()],v.prototype,"t",void 0),b();export{v as R,b as d}
@@ -1 +1 @@
1
- import{p as t,H as r,h as a,d as i,t as s}from"./p-BBHQOrFK.js";import"./p-DxDYE5-a.js";import"./p-C0vp-Q7v.js";import{e as o,i as e}from"./p-DhwysA2e.js";import"./p-Dguuxuf6.js";import{h as n}from"./p-BWNToYSb.js";import{S as c}from"./p-bRRQr4xn.js";import{d as p}from"./p-BHHJ7_MS.js";import{d}from"./p-BYIBbfJ8.js";import{d as h}from"./p-CTuYqZY2.js";import{d as l}from"./p-B0SC1Zj-.js";var b=function(t,r,a,i){var s,o=arguments.length,e=o<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)e=Reflect.decorate(t,r,a,i);else for(var n=t.length-1;n>=0;n--)(s=t[n])&&(e=(o<3?s(e):o>3?s(r,a,e):s(r,a))||e);return o>3&&e&&Object.defineProperty(r,a,e),e};const m=t(class extends r{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.iconPack=o,this.t=e(),this.audioEnabled=!1,this.volume=0,this.onAudioUpdate=({audioEnabled:t,audioTrack:r})=>{if(this.participant)if(t&&r){const t=new MediaStream;t.addTrack(r),this.calcVolume(t),this.audioEnabled=!0}else this.volume=0,this.audioEnabled=!1}}connectedCallback(){this.participantChanged(this.participant)}disconnectedCallback(){var t,r;null===(t=this.hark)||void 0===t||t.stop(),null===(r=this.participant)||void 0===r||r.removeListener("audioUpdate",this.onAudioUpdate)}participantChanged(t){t&&(this.audioEnabled=t.audioEnabled,t.addListener("audioUpdate",this.onAudioUpdate))}calcVolume(t){this.hark=n(t,{play:!1,interval:100}),this.hark.on("volume_change",(t=>{const r=this.volume;let a=Math.round(10**(t/115)*10);a<3&&(a=0);let i=Math.round((2*r+a)/3);r!==i&&(this.volume=i)}))}render(){if(!this.meeting)return null;const t={meeting:this.meeting,size:this.size,config:this.config,states:this.states,iconPack:this.iconPack,t:this.t};let r="bar-0";return r=this.volume>5?"bar-5":this.volume<0?"bar-0":"bar-"+this.volume,a(i,null,a("div",{class:{"avatar-ctr":!0,speaking:this.audioEnabled,[r]:!0}},a("rtk-avatar",{participant:this.participant,size:this.size},!this.audioEnabled&&a("div",{class:"mic-icon"},a("rtk-icon",{icon:o.mic_off})))),a("rtk-name-tag",Object.assign({variant:"text",participant:this.participant},t)),a("slot",null))}static get watchers(){return{participant:[{participantChanged:0}]}}static get style(){return":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column}.avatar-ctr{box-sizing:border-box;width:100%;flex:1 1 0%;padding:var(--rtk-space-1\\.5, 6px);border:2px solid transparent;border-radius:calc(var(--rtk-border-radius-xl, 40px) + var(--rtk-space-1\\.5, 6px))}.avatar-ctr.speaking{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.bar-0{box-shadow:none}.bar-1{box-shadow:0 0 4px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-2{box-shadow:0 0 8px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-3{box-shadow:0 0 16px 1px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-4{box-shadow:0 0 20px 3px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-5{box-shadow:0 0 24px 6px rgb(var(--rtk-colors-brand-500, 33 96 253))}rtk-avatar{aspect-ratio:1 / 1;height:100%;width:100%;position:relative;border-radius:var(--rtk-border-radius-xl, 40px)}rtk-name-tag{display:block;height:var(--rtk-space-10, 40px);width:100%;text-align:center;line-height:2.5rem}:host([size='sm']) .avatar-ctr{border-radius:calc(var(--rtk-border-radius-lg, 12px) + var(--rtk-space-1\\.5, 6px))}:host([size='sm']) rtk-name-tag{height:var(--rtk-space-7, 28px);line-height:1.75rem}:host([size='sm']) rtk-avatar{border-radius:var(--rtk-border-radius-lg, 12px)}.mic-icon{position:absolute;bottom:calc(var(--rtk-space-1, 4px) * -1);right:calc(var(--rtk-space-1, 4px) * -1);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.mic-icon rtk-icon{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}:host([size='sm']) .mic-icon rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([size='md']) .mic-icon rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}"}},[257,"rtk-audio-tile",{meeting:[16],config:[16],size:[513],states:[16],iconPack:[16],t:[16],participant:[16],audioEnabled:[32],volume:[32]},void 0,{participant:[{participantChanged:0}]}]);function v(){"undefined"!=typeof customElements&&["rtk-audio-tile","rtk-avatar","rtk-icon","rtk-name-tag","rtk-spinner"].forEach((t=>{switch(t){case"rtk-audio-tile":customElements.get(s(t))||customElements.define(s(t),m);break;case"rtk-avatar":customElements.get(s(t))||p();break;case"rtk-icon":customElements.get(s(t))||d();break;case"rtk-name-tag":customElements.get(s(t))||h();break;case"rtk-spinner":customElements.get(s(t))||l()}}))}b([c()],m.prototype,"meeting",void 0),b([c()],m.prototype,"config",void 0),b([c()],m.prototype,"states",void 0),b([c()],m.prototype,"iconPack",void 0),b([c()],m.prototype,"t",void 0),v();const k=m,x=v;export{k as RtkAudioTile,x as defineCustomElement}
1
+ import{p as t,H as r,h as a,d as i,t as s}from"./p-BBHQOrFK.js";import"./p-DxDYE5-a.js";import"./p-C0vp-Q7v.js";import{e as o,i as e}from"./p-DhwysA2e.js";import"./p-Dguuxuf6.js";import{h as n}from"./p-BWNToYSb.js";import{S as c}from"./p-bRRQr4xn.js";import{d as p}from"./p-BHHJ7_MS.js";import{d}from"./p-BYIBbfJ8.js";import{d as h}from"./p-CTuYqZY2.js";import{d as l}from"./p-B0SC1Zj-.js";var b=function(t,r,a,i){var s,o=arguments.length,e=o<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)e=Reflect.decorate(t,r,a,i);else for(var n=t.length-1;n>=0;n--)(s=t[n])&&(e=(o<3?s(e):o>3?s(r,a,e):s(r,a))||e);return o>3&&e&&Object.defineProperty(r,a,e),e};const v=t(class extends r{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.iconPack=o,this.t=e(),this.audioEnabled=!1,this.volume=0,this.onAudioUpdate=({audioEnabled:t,audioTrack:r})=>{var a;if(this.participant)if(null===(a=this.hark)||void 0===a||a.stop(),t&&r){const t=new MediaStream;t.addTrack(r),this.calcVolume(t),this.audioEnabled=!0}else this.volume=0,this.audioEnabled=!1}}connectedCallback(){this.participantChanged(this.participant)}disconnectedCallback(){var t,r;null===(t=this.hark)||void 0===t||t.stop(),null===(r=this.participant)||void 0===r||r.removeListener("audioUpdate",this.onAudioUpdate)}participantChanged(t){t&&(this.audioEnabled=t.audioEnabled,t.addListener("audioUpdate",this.onAudioUpdate))}calcVolume(t){this.hark=n(t,{play:!1,interval:100}),this.hark.on("volume_change",(t=>{const r=this.volume;let a=Math.round(10**(t/115)*10);a<3&&(a=0);let i=Math.round((2*r+a)/3);r!==i&&(this.volume=i)}))}render(){if(!this.meeting)return null;const t={meeting:this.meeting,size:this.size,config:this.config,states:this.states,iconPack:this.iconPack,t:this.t};let r="bar-0";return r=this.volume>5?"bar-5":this.volume<0?"bar-0":"bar-"+this.volume,a(i,null,a("div",{class:{"avatar-ctr":!0,speaking:this.audioEnabled,[r]:!0}},a("rtk-avatar",{participant:this.participant,size:this.size},!this.audioEnabled&&a("div",{class:"mic-icon"},a("rtk-icon",{icon:o.mic_off})))),a("rtk-name-tag",Object.assign({variant:"text",participant:this.participant},t)),a("slot",null))}static get watchers(){return{participant:[{participantChanged:0}]}}static get style(){return":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column}.avatar-ctr{box-sizing:border-box;width:100%;flex:1 1 0%;padding:var(--rtk-space-1\\.5, 6px);border:2px solid transparent;border-radius:calc(var(--rtk-border-radius-xl, 40px) + var(--rtk-space-1\\.5, 6px))}.avatar-ctr.speaking{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.bar-0{box-shadow:none}.bar-1{box-shadow:0 0 4px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-2{box-shadow:0 0 8px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-3{box-shadow:0 0 16px 1px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-4{box-shadow:0 0 20px 3px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-5{box-shadow:0 0 24px 6px rgb(var(--rtk-colors-brand-500, 33 96 253))}rtk-avatar{aspect-ratio:1 / 1;height:100%;width:100%;position:relative;border-radius:var(--rtk-border-radius-xl, 40px)}rtk-name-tag{display:block;height:var(--rtk-space-10, 40px);width:100%;text-align:center;line-height:2.5rem}:host([size='sm']) .avatar-ctr{border-radius:calc(var(--rtk-border-radius-lg, 12px) + var(--rtk-space-1\\.5, 6px))}:host([size='sm']) rtk-name-tag{height:var(--rtk-space-7, 28px);line-height:1.75rem}:host([size='sm']) rtk-avatar{border-radius:var(--rtk-border-radius-lg, 12px)}.mic-icon{position:absolute;bottom:calc(var(--rtk-space-1, 4px) * -1);right:calc(var(--rtk-space-1, 4px) * -1);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.mic-icon rtk-icon{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}:host([size='sm']) .mic-icon rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([size='md']) .mic-icon rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}"}},[257,"rtk-audio-tile",{meeting:[16],config:[16],size:[513],states:[16],iconPack:[16],t:[16],participant:[16],audioEnabled:[32],volume:[32]},void 0,{participant:[{participantChanged:0}]}]);function m(){"undefined"!=typeof customElements&&["rtk-audio-tile","rtk-avatar","rtk-icon","rtk-name-tag","rtk-spinner"].forEach((t=>{switch(t){case"rtk-audio-tile":customElements.get(s(t))||customElements.define(s(t),v);break;case"rtk-avatar":customElements.get(s(t))||p();break;case"rtk-icon":customElements.get(s(t))||d();break;case"rtk-name-tag":customElements.get(s(t))||h();break;case"rtk-spinner":customElements.get(s(t))||l()}}))}b([c()],v.prototype,"meeting",void 0),b([c()],v.prototype,"config",void 0),b([c()],v.prototype,"states",void 0),b([c()],v.prototype,"iconPack",void 0),b([c()],v.prototype,"t",void 0),m();const k=v,x=m;export{k as RtkAudioTile,x as defineCustomElement}
@@ -1 +1 @@
1
- import{R as o,d as s}from"./p-CPRQStTn.js";const t=o,p=s;export{t as RtkSettingsAudio,p as defineCustomElement}
1
+ import{R as m,d as o}from"./p-mgE9e3Hm.js";const s=m,p=o;export{s as RtkSettingsAudio,p as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as r,c as o,h as s,d as i,t as a}from"./p-BBHQOrFK.js";import{e,i as n}from"./p-DhwysA2e.js";import{S as c}from"./p-bRRQr4xn.js";import{d}from"./p-Dh8N1Wv8.js";import{d as l}from"./p-D6vw6bT2.js";import{d as p}from"./p-CW-FAeNP.js";import{d as b}from"./p-BYIBbfJ8.js";import{d as h}from"./p-BxPmWGqJ.js";import{d as k}from"./p-BXHUa6x_.js";import{d as u}from"./p-CPRQStTn.js";import{d as g}from"./p-CMyYEHgz.js";import{d as m}from"./p-BGz4FsG8.js";import{d as v}from"./p-5i84b0Gw.js";var w=function(t,r,o,s){var i,a=arguments.length,e=a<3?r:null===s?s=Object.getOwnPropertyDescriptor(r,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)e=Reflect.decorate(t,r,o,s);else for(var n=t.length-1;n>=0;n--)(i=t[n])&&(e=(a<3?i(e):a>3?i(r,o,e):i(r,o))||e);return a>3&&e&&Object.defineProperty(r,o,e),e};const x=t(class extends r{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.stateUpdate=o(this,"rtkStateUpdate",7),this.keyPressListener=t=>{"Escape"===t.key&&this.close()},this.stageStatusListener=()=>{this.canProduceVideo="ALLOWED"===this.meeting.self.permissions.canProduceVideo},this.iconPack=e,this.t=n(),this.activeTab="connection",this.isMobileMainVisible=!1,this.networkStatus="good",this.canProduceVideo=!1}connectedCallback(){document.addEventListener("keydown",this.keyPressListener),this.meetingChanged(this.meeting)}disconnectedCallback(){var t;this.keyPressListener&&document.removeEventListener("keydown",this.keyPressListener),this.poorConnectionListener&&(null===(t=this.meeting)||void 0===t||t.meta.removeListener("poorConnection",this.poorConnectionListener)),this.meeting.stage.removeListener("stageStatusUpdate",this.stageStatusListener)}meetingChanged(t){null!=t&&(this.canProduceVideo="ALLOWED"===this.meeting.self.permissions.canProduceVideo,this.activeTab=this.canProduceVideo?"video":"audio",this.poorConnectionListener=({score:t})=>{t<7?this.networkStatus="poor":t<4&&(this.networkStatus="poorest"),setTimeout((()=>{this.networkStatus="good"}),5e3)},t.meta.addListener("poorConnection",this.poorConnectionListener),t.stage.addListener("stageStatusUpdate",this.stageStatusListener))}changeTab(t){this.activeTab=t,"sm"===this.size&&(this.isMobileMainVisible||(this.isMobileMainVisible=!0))}close(){this.stateUpdate.emit({activeSettings:!1})}render(){if(!this.meeting)return null;const t={meeting:this.meeting,states:this.states,iconPack:this.iconPack,t:this.t};return s(i,null,s("aside",{class:{hide:this.isMobileMainVisible},part:"menu"},s("header",null,s("h2",null,this.t("settings"))),s("button",{type:"button",class:{active:"audio"===this.activeTab},onClick:()=>this.changeTab("audio")},this.t("audio"),s("div",{class:"right"},s("rtk-icon",{icon:this.iconPack.mic_on}),"sm"===this.size&&s("rtk-icon",{icon:this.iconPack.chevron_right}))),this.canProduceVideo&&s("button",{type:"button",class:{active:"video"===this.activeTab},onClick:()=>this.changeTab("video")},this.t("video"),s("div",{class:"right"},s("rtk-icon",{icon:this.iconPack.video_on}),"sm"===this.size&&s("rtk-icon",{icon:this.iconPack.chevron_right}))),s("button",{type:"none",title:"Your network condition is "+this.networkStatus},this.t("connection"),s("div",{class:"right"},s("rtk-icon",{icon:this.iconPack.wifi,class:this.networkStatus})))),s("main",{class:{active:this.isMobileMainVisible,scrollbar:!0},part:"main-content"},"sm"===this.size&&s("header",null,s("rtk-button",{kind:"icon",class:"back-btn",onClick:()=>this.isMobileMainVisible=!1},s("rtk-icon",{icon:this.iconPack.chevron_left})),s("h2",null,this.t("audio"===this.activeTab?"audio":"video"))),"audio"===this.activeTab&&s("rtk-settings-audio",Object.assign({},t)),"video"===this.activeTab&&s("rtk-settings-video",Object.assign({},t))))}static get watchers(){return{meeting:[{meetingChanged:0}]}}static get style(){return":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60))) var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}header{display:flex;align-items:center;justify-content:space-between;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}.title{font-size:20px;line-height:1}.back-btn,.dismiss-btn{border-radius:var(--rtk-border-radius-sm, 4px);background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.back-btn:hover,.dismiss-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside{box-sizing:border-box;display:flex;min-width:var(--rtk-space-56, 224px);flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));padding-left:var(--rtk-space-2, 8px)}aside button{margin-top:var(--rtk-space-4, 16px);box-sizing:border-box;display:flex;width:100%;align-items:center;justify-content:space-between;border-top-left-radius:var(--rtk-border-radius-sm, 4px);border-bottom-left-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);background-color:transparent;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));cursor:default;font-size:16px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px}aside button .right{display:flex;align-items:center}aside button .right rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}aside button .right rtk-icon:last-child{margin-left:var(--rtk-space-4, 16px)}aside button[type='button']{cursor:pointer;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}aside button[type='button']:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside button[type='button']{border-right:var(--rtk-border-width-md, 2px) solid transparent}aside button.active{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}aside button.active:hover{background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}rtk-icon.poor{--tw-text-opacity:1;color:rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity))}rtk-icon.poorest{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon.good{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}main{display:flex;flex:1 1 0%;align-items:center;justify-content:center;padding-left:var(--rtk-space-6, 24px);padding-right:var(--rtk-space-6, 24px);box-sizing:border-box;width:100%;max-width:calc(100% - var(--rtk-space-56, 224px))}.dismiss-btn{position:absolute;top:var(--rtk-space-3, 12px);right:var(--rtk-space-3, 12px);height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']) aside{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host([size='sm']) .dismiss-btn{top:var(--rtk-space-5, 20px);right:var(--rtk-space-4, 16px)}:host([size='sm']) aside{width:100%;padding-left:var(--rtk-space-0, 0px)}:host([size='sm']) aside button{border-radius:var(--rtk-border-radius-none, 0)}:host([size='sm']) aside button.active{border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent}:host([size='sm']) aside button.active:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([size='sm']) aside.hide{display:none}:host([size='sm']) main{display:none;max-width:100%;overflow-y:auto;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host([size='sm']) main header{justify-content:center}:host([size='sm']) main header rtk-button{position:absolute;left:var(--rtk-space-4, 16px)}:host([size='sm']) main.active{display:block}"}},[1,"rtk-settings",{meeting:[16],states:[16],size:[513],iconPack:[16],t:[16],activeTab:[32],isMobileMainVisible:[32],networkStatus:[32],canProduceVideo:[32]},void 0,{meeting:[{meetingChanged:0}]}]);function f(){"undefined"!=typeof customElements&&["rtk-settings","rtk-audio-visualizer","rtk-button","rtk-camera-selector","rtk-icon","rtk-microphone-selector","rtk-participant-tile","rtk-settings-audio","rtk-settings-video","rtk-speaker-selector","rtk-switch"].forEach((t=>{switch(t){case"rtk-settings":customElements.get(a(t))||customElements.define(a(t),x);break;case"rtk-audio-visualizer":customElements.get(a(t))||d();break;case"rtk-button":customElements.get(a(t))||l();break;case"rtk-camera-selector":customElements.get(a(t))||p();break;case"rtk-icon":customElements.get(a(t))||b();break;case"rtk-microphone-selector":customElements.get(a(t))||h();break;case"rtk-participant-tile":customElements.get(a(t))||k();break;case"rtk-settings-audio":customElements.get(a(t))||u();break;case"rtk-settings-video":customElements.get(a(t))||g();break;case"rtk-speaker-selector":customElements.get(a(t))||m();break;case"rtk-switch":customElements.get(a(t))||v()}}))}w([c()],x.prototype,"meeting",void 0),w([c()],x.prototype,"states",void 0),w([c()],x.prototype,"iconPack",void 0),w([c()],x.prototype,"t",void 0),f();const y=x,j=f;export{y as RtkSettings,j as defineCustomElement}
1
+ import{p as t,H as r,c as o,h as s,d as i,t as a}from"./p-BBHQOrFK.js";import{e,i as n}from"./p-DhwysA2e.js";import{S as c}from"./p-bRRQr4xn.js";import{d}from"./p-Dh8N1Wv8.js";import{d as l}from"./p-D6vw6bT2.js";import{d as p}from"./p-CW-FAeNP.js";import{d as b}from"./p-BYIBbfJ8.js";import{d as h}from"./p-BxPmWGqJ.js";import{d as k}from"./p-BXHUa6x_.js";import{d as u}from"./p-mgE9e3Hm.js";import{d as g}from"./p-CMyYEHgz.js";import{d as m}from"./p-CHOs-ZsL.js";import{d as v}from"./p-5i84b0Gw.js";var w=function(t,r,o,s){var i,a=arguments.length,e=a<3?r:null===s?s=Object.getOwnPropertyDescriptor(r,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)e=Reflect.decorate(t,r,o,s);else for(var n=t.length-1;n>=0;n--)(i=t[n])&&(e=(a<3?i(e):a>3?i(r,o,e):i(r,o))||e);return a>3&&e&&Object.defineProperty(r,o,e),e};const x=t(class extends r{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.stateUpdate=o(this,"rtkStateUpdate",7),this.keyPressListener=t=>{"Escape"===t.key&&this.close()},this.stageStatusListener=()=>{this.canProduceVideo="ALLOWED"===this.meeting.self.permissions.canProduceVideo},this.iconPack=e,this.t=n(),this.activeTab="connection",this.isMobileMainVisible=!1,this.networkStatus="good",this.canProduceVideo=!1}connectedCallback(){document.addEventListener("keydown",this.keyPressListener),this.meetingChanged(this.meeting)}disconnectedCallback(){var t;this.keyPressListener&&document.removeEventListener("keydown",this.keyPressListener),this.poorConnectionListener&&(null===(t=this.meeting)||void 0===t||t.meta.removeListener("poorConnection",this.poorConnectionListener)),this.meeting.stage.removeListener("stageStatusUpdate",this.stageStatusListener)}meetingChanged(t){null!=t&&(this.canProduceVideo="ALLOWED"===this.meeting.self.permissions.canProduceVideo,this.activeTab=this.canProduceVideo?"video":"audio",this.poorConnectionListener=({score:t})=>{t<7?this.networkStatus="poor":t<4&&(this.networkStatus="poorest"),setTimeout((()=>{this.networkStatus="good"}),5e3)},t.meta.addListener("poorConnection",this.poorConnectionListener),t.stage.addListener("stageStatusUpdate",this.stageStatusListener))}changeTab(t){this.activeTab=t,"sm"===this.size&&(this.isMobileMainVisible||(this.isMobileMainVisible=!0))}close(){this.stateUpdate.emit({activeSettings:!1})}render(){if(!this.meeting)return null;const t={meeting:this.meeting,states:this.states,iconPack:this.iconPack,t:this.t};return s(i,null,s("aside",{class:{hide:this.isMobileMainVisible},part:"menu"},s("header",null,s("h2",null,this.t("settings"))),s("button",{type:"button",class:{active:"audio"===this.activeTab},onClick:()=>this.changeTab("audio")},this.t("audio"),s("div",{class:"right"},s("rtk-icon",{icon:this.iconPack.mic_on}),"sm"===this.size&&s("rtk-icon",{icon:this.iconPack.chevron_right}))),this.canProduceVideo&&s("button",{type:"button",class:{active:"video"===this.activeTab},onClick:()=>this.changeTab("video")},this.t("video"),s("div",{class:"right"},s("rtk-icon",{icon:this.iconPack.video_on}),"sm"===this.size&&s("rtk-icon",{icon:this.iconPack.chevron_right}))),s("button",{type:"none",title:"Your network condition is "+this.networkStatus},this.t("connection"),s("div",{class:"right"},s("rtk-icon",{icon:this.iconPack.wifi,class:this.networkStatus})))),s("main",{class:{active:this.isMobileMainVisible,scrollbar:!0},part:"main-content"},"sm"===this.size&&s("header",null,s("rtk-button",{kind:"icon",class:"back-btn",onClick:()=>this.isMobileMainVisible=!1},s("rtk-icon",{icon:this.iconPack.chevron_left})),s("h2",null,this.t("audio"===this.activeTab?"audio":"video"))),"audio"===this.activeTab&&s("rtk-settings-audio",Object.assign({},t)),"video"===this.activeTab&&s("rtk-settings-video",Object.assign({},t))))}static get watchers(){return{meeting:[{meetingChanged:0}]}}static get style(){return":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60))) var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}header{display:flex;align-items:center;justify-content:space-between;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}.title{font-size:20px;line-height:1}.back-btn,.dismiss-btn{border-radius:var(--rtk-border-radius-sm, 4px);background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.back-btn:hover,.dismiss-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside{box-sizing:border-box;display:flex;min-width:var(--rtk-space-56, 224px);flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));padding-left:var(--rtk-space-2, 8px)}aside button{margin-top:var(--rtk-space-4, 16px);box-sizing:border-box;display:flex;width:100%;align-items:center;justify-content:space-between;border-top-left-radius:var(--rtk-border-radius-sm, 4px);border-bottom-left-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);background-color:transparent;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));cursor:default;font-size:16px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px}aside button .right{display:flex;align-items:center}aside button .right rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}aside button .right rtk-icon:last-child{margin-left:var(--rtk-space-4, 16px)}aside button[type='button']{cursor:pointer;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}aside button[type='button']:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside button[type='button']{border-right:var(--rtk-border-width-md, 2px) solid transparent}aside button.active{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}aside button.active:hover{background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}rtk-icon.poor{--tw-text-opacity:1;color:rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity))}rtk-icon.poorest{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon.good{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}main{display:flex;flex:1 1 0%;align-items:center;justify-content:center;padding-left:var(--rtk-space-6, 24px);padding-right:var(--rtk-space-6, 24px);box-sizing:border-box;width:100%;max-width:calc(100% - var(--rtk-space-56, 224px))}.dismiss-btn{position:absolute;top:var(--rtk-space-3, 12px);right:var(--rtk-space-3, 12px);height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']) aside{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host([size='sm']) .dismiss-btn{top:var(--rtk-space-5, 20px);right:var(--rtk-space-4, 16px)}:host([size='sm']) aside{width:100%;padding-left:var(--rtk-space-0, 0px)}:host([size='sm']) aside button{border-radius:var(--rtk-border-radius-none, 0)}:host([size='sm']) aside button.active{border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent}:host([size='sm']) aside button.active:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([size='sm']) aside.hide{display:none}:host([size='sm']) main{display:none;max-width:100%;overflow-y:auto;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host([size='sm']) main header{justify-content:center}:host([size='sm']) main header rtk-button{position:absolute;left:var(--rtk-space-4, 16px)}:host([size='sm']) main.active{display:block}"}},[1,"rtk-settings",{meeting:[16],states:[16],size:[513],iconPack:[16],t:[16],activeTab:[32],isMobileMainVisible:[32],networkStatus:[32],canProduceVideo:[32]},void 0,{meeting:[{meetingChanged:0}]}]);function f(){"undefined"!=typeof customElements&&["rtk-settings","rtk-audio-visualizer","rtk-button","rtk-camera-selector","rtk-icon","rtk-microphone-selector","rtk-participant-tile","rtk-settings-audio","rtk-settings-video","rtk-speaker-selector","rtk-switch"].forEach((t=>{switch(t){case"rtk-settings":customElements.get(a(t))||customElements.define(a(t),x);break;case"rtk-audio-visualizer":customElements.get(a(t))||d();break;case"rtk-button":customElements.get(a(t))||l();break;case"rtk-camera-selector":customElements.get(a(t))||p();break;case"rtk-icon":customElements.get(a(t))||b();break;case"rtk-microphone-selector":customElements.get(a(t))||h();break;case"rtk-participant-tile":customElements.get(a(t))||k();break;case"rtk-settings-audio":customElements.get(a(t))||u();break;case"rtk-settings-video":customElements.get(a(t))||g();break;case"rtk-speaker-selector":customElements.get(a(t))||m();break;case"rtk-switch":customElements.get(a(t))||v()}}))}w([c()],x.prototype,"meeting",void 0),w([c()],x.prototype,"states",void 0),w([c()],x.prototype,"iconPack",void 0),w([c()],x.prototype,"t",void 0),f();const y=x,j=f;export{y as RtkSettings,j as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as e,c as i,h as r,F as o,d as s,t as a}from"./p-BBHQOrFK.js";import{s as n}from"./p-CJsXePY3.js";import{c,e as l,i as d}from"./p-DhwysA2e.js";import{R as p}from"./p-CBJjerDR.js";import{g as h}from"./p-Dguuxuf6.js";import{S as m}from"./p-bRRQr4xn.js";import{g as k}from"./p-vBfDtD_u.js";import{d as v}from"./p-D6vw6bT2.js";import{d as u}from"./p-CW-FAeNP.js";import{d as g}from"./p-BYIBbfJ8.js";import{d as b}from"./p-BxPmWGqJ.js";import{d as f}from"./p-BGz4FsG8.js";import{d as x}from"./p-B0SC1Zj-.js";var w=function(t,e,i,r){var o,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s<3?o(a):s>3?o(e,i,a):o(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const y=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.stateUpdate=i(this,"rtkStateUpdate",7),this.config=c(),this.iconPack=l,this.t=d(),this.isJoining=!1,this.canEditName=!0,this.canProduceAudio=!0,this.socketStateUpdate=({state:t})=>{this.connectionState=t,"connected"===t&&(this.joinError=void 0,this.joinErrorCode=void 0),"failed"===t&&(this.isJoining=!1)},this.join=async()=>{var t,e,i;if(""!==(null===(t=this.displayName)||void 0===t?void 0:t.trim())&&!this.isJoining){if("connected"!==this.connectionState)return void(this.connectionState&&(this.joinError=this.t("failed"===this.connectionState?"network.lost_extended":"network.lost")));this.isJoining=!0,this.joinError=void 0,this.joinErrorCode=void 0,null===(e=this.meeting)||void 0===e||e.self.setName(this.displayName),h.setItem("rtk-display-name",this.displayName);try{await(null===(i=this.meeting)||void 0===i?void 0:i.join())}catch(t){this.isJoining=!1;const{message:e,code:i}=k(this.t,t);this.joinError=e,this.joinErrorCode=i}}}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting.meta.removeListener("socketConnectionUpdate",this.socketStateUpdate)}componentDidLoad(){var t;null===(t=this.inputEl)||void 0===t||t.focus()}meetingChanged(t){var e,i,r;t&&(this.connectionState=null===(e=t.meta.socketState)||void 0===e?void 0:e.state,this.canEditName=null===(i=t.self.permissions.canEditDisplayName)||void 0===i||i,this.displayName=(null===(r=t.self.name)||void 0===r?void 0:r.trim())||(this.canEditName?"":"Participant"),t.meta.addListener("socketConnectionUpdate",this.socketStateUpdate))}render(){var t,e,i,a,c,l;if(!this.meeting)return;const d=!!this.connectionState&&"connected"!==this.connectionState&&!this.joinError,h=this.joinError?this.joinError:this.t("failed"===this.connectionState?"network.lost_extended":"network.lost"),m=""===(null===(t=this.displayName)||void 0===t?void 0:t.trim())||"connected"!==this.connectionState||this.isJoining,k={meeting:this.meeting,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},v=null===(a=null===(i=null===(e=this.meeting)||void 0===e?void 0:e.meta)||void 0===i?void 0:i.meetingTitle)||void 0===a?void 0:a.trim();return r(s,null,r("div",{class:"container"},r("div",{class:"container-tile"},r(p,{element:"rtk-participant-tile",defaults:k,props:{participant:null===(c=this.meeting)||void 0===c?void 0:c.self,size:"md",isPreview:!0},childProps:{participant:null===(l=this.meeting)||void 0===l?void 0:l.self,size:"md"},deepProps:!0}),r("div",{class:"media-selectors"},r("rtk-microphone-selector",Object.assign({},k,{variant:"inline"})),r("rtk-camera-selector",Object.assign({},k,{variant:"inline"})),r("rtk-speaker-selector",Object.assign({},k,{variant:"inline"})))),r("div",{class:"metadata"},v&&""!==v&&r("div",{class:"meeting-title"},v),this.canEditName?r(o,null,r("div",{class:"join-as"},this.t("setup_screen.join_in_as")),r("input",{placeholder:this.t("setup_screen.your_name"),value:this.displayName,spellcheck:!1,autoFocus:!0,ref:t=>{this.inputEl=t},onInput:t=>{this.displayName=t.target.value},onKeyDown:t=>{"Enter"===t.key&&this.join()}})):r("div",{class:"uneditable-name"},r("span",{class:"text"},this.t("setup_screen.join_in_as")," ")," ",r("div",{class:"name"},n(this.displayName,20))),r("rtk-button",{size:"lg",kind:"wide",onClick:this.join,disabled:m},this.isJoining?r("rtk-spinner",{iconPack:this.iconPack}):this.t("join")),(this.joinError||d)&&r("div",{class:"no-network-badge",role:"alert"},r("rtk-icon",{size:"md",variant:"danger",icon:this.iconPack.disconnected}),h),this.meeting&&this.joinError&&r("a",{class:"troubleshoot-link",href:"https://test.realtime.cloudflare.com?authToken="+this.meeting.__internals__.authToken,target:"_blank",rel:"noopener noreferrer"},this.t("network.troubleshoot")),this.joinErrorCode&&r("span",{class:"error-code",part:"error-code"},this.t("join.error_code"),": ",this.joinErrorCode))))}static get watchers(){return{meeting:[{meetingChanged:0}]}}static get style(){return":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;padding:var(--rtk-space-4, 16px);height:100%;min-height:100%;width:100%;display:flex;place-items:center;justify-content:center;--rtk-controlbar-button-background-color:rgb(var(--rtk-colors-background-700, 44 44 44))}.container{width:100%;max-width:1080px;display:flex;align-items:center;justify-content:space-evenly;gap:var(--rtk-space-4, 16px)}.container-tile{display:flex;height:100%;width:100%;max-width:584px;flex-direction:column;gap:var(--rtk-space-2, 8px)}.metadata{display:flex;width:100%;max-width:var(--rtk-space-80, 320px);flex-direction:column;align-items:center;text-align:center}.meeting-title{margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:24px;font-weight:500}.join-as{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:16px;letter-spacing:-0.025em;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.uneditable-name{margin-bottom:var(--rtk-space-6, 24px)}.uneditable-name .text,.uneditable-name .name{display:inline-block}.uneditable-name .name{font-size:16px;font-weight:500}input{margin-bottom:var(--rtk-space-6, 24px);display:block;height:var(--rtk-space-10, 40px);width:100%;max-width:var(--rtk-space-80, 320px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));box-sizing:border-box;font-size:16px;outline:2px solid transparent;outline-offset:2px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}input::-moz-placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}input::placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}input{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}input:focus{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity))}rtk-spinner{color:rgb(var(--rtk-colors-text-1000, 255 255 255));--icon-size:var(--rtk-space-8, 32px)}:host([size='sm']) .container,:host([size='md']) .container{height:100%;flex-direction:column;justify-content:space-evenly}:host([size='sm']) .container-tile,:host([size='md']) .container-tile{height:-moz-min-content;height:min-content;flex-direction:column;justify-content:center}rtk-participant-tile{height:auto;width:100%;max-width:584px}.media-selectors{display:flex;flex-direction:column;justify-content:space-between}.media-selectors .row{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr))}.no-network-badge{margin-top:var(--rtk-space-2, 8px);display:flex;width:100%;flex-direction:row;align-items:center;justify-content:flex-start;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);font-size:12px;color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.75)}.no-network-badge rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px)}.troubleshoot-link{margin-top:var(--rtk-space-1, 4px);font-size:12px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-400, 53 110 253) / var(--tw-text-opacity));text-decoration-line:underline;text-underline-offset:2px}.troubleshoot-link:hover{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.error-code{margin-top:var(--rtk-space-1, 4px);font-size:10px;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}"}},[1,"rtk-setup-screen",{meeting:[16],states:[16],size:[513],config:[16],iconPack:[16],t:[16],displayName:[32],isJoining:[32],joinError:[32],joinErrorCode:[32],canEditName:[32],canProduceAudio:[32],connectionState:[32]},void 0,{meeting:[{meetingChanged:0}]}]);function j(){"undefined"!=typeof customElements&&["rtk-setup-screen","rtk-button","rtk-camera-selector","rtk-icon","rtk-microphone-selector","rtk-speaker-selector","rtk-spinner"].forEach((t=>{switch(t){case"rtk-setup-screen":customElements.get(a(t))||customElements.define(a(t),y);break;case"rtk-button":customElements.get(a(t))||v();break;case"rtk-camera-selector":customElements.get(a(t))||u();break;case"rtk-icon":customElements.get(a(t))||g();break;case"rtk-microphone-selector":customElements.get(a(t))||b();break;case"rtk-speaker-selector":customElements.get(a(t))||f();break;case"rtk-spinner":customElements.get(a(t))||x()}}))}w([m()],y.prototype,"meeting",void 0),w([m()],y.prototype,"states",void 0),w([m()],y.prototype,"config",void 0),w([m()],y.prototype,"iconPack",void 0),w([m()],y.prototype,"t",void 0),j();const z=y,C=j;export{z as RtkSetupScreen,C as defineCustomElement}
1
+ import{p as t,H as e,c as i,h as r,F as o,d as s,t as a}from"./p-BBHQOrFK.js";import{s as n}from"./p-CJsXePY3.js";import{c,e as l,i as d}from"./p-DhwysA2e.js";import{R as p}from"./p-CBJjerDR.js";import{g as h}from"./p-Dguuxuf6.js";import{S as m}from"./p-bRRQr4xn.js";import{g as k}from"./p-vBfDtD_u.js";import{d as v}from"./p-D6vw6bT2.js";import{d as u}from"./p-CW-FAeNP.js";import{d as g}from"./p-BYIBbfJ8.js";import{d as b}from"./p-BxPmWGqJ.js";import{d as f}from"./p-CHOs-ZsL.js";import{d as x}from"./p-B0SC1Zj-.js";var w=function(t,e,i,r){var o,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(s<3?o(a):s>3?o(e,i,a):o(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const y=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.stateUpdate=i(this,"rtkStateUpdate",7),this.config=c(),this.iconPack=l,this.t=d(),this.isJoining=!1,this.canEditName=!0,this.canProduceAudio=!0,this.socketStateUpdate=({state:t})=>{this.connectionState=t,"connected"===t&&(this.joinError=void 0,this.joinErrorCode=void 0),"failed"===t&&(this.isJoining=!1)},this.join=async()=>{var t,e,i;if(""!==(null===(t=this.displayName)||void 0===t?void 0:t.trim())&&!this.isJoining){if("connected"!==this.connectionState)return void(this.connectionState&&(this.joinError=this.t("failed"===this.connectionState?"network.lost_extended":"network.lost")));this.isJoining=!0,this.joinError=void 0,this.joinErrorCode=void 0,null===(e=this.meeting)||void 0===e||e.self.setName(this.displayName),h.setItem("rtk-display-name",this.displayName);try{await(null===(i=this.meeting)||void 0===i?void 0:i.join())}catch(t){this.isJoining=!1;const{message:e,code:i}=k(this.t,t);this.joinError=e,this.joinErrorCode=i}}}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting.meta.removeListener("socketConnectionUpdate",this.socketStateUpdate)}componentDidLoad(){var t;null===(t=this.inputEl)||void 0===t||t.focus()}meetingChanged(t){var e,i,r;t&&(this.connectionState=null===(e=t.meta.socketState)||void 0===e?void 0:e.state,this.canEditName=null===(i=t.self.permissions.canEditDisplayName)||void 0===i||i,this.displayName=(null===(r=t.self.name)||void 0===r?void 0:r.trim())||(this.canEditName?"":"Participant"),t.meta.addListener("socketConnectionUpdate",this.socketStateUpdate))}render(){var t,e,i,a,c,l;if(!this.meeting)return;const d=!!this.connectionState&&"connected"!==this.connectionState&&!this.joinError,h=this.joinError?this.joinError:this.t("failed"===this.connectionState?"network.lost_extended":"network.lost"),m=""===(null===(t=this.displayName)||void 0===t?void 0:t.trim())||"connected"!==this.connectionState||this.isJoining,k={meeting:this.meeting,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},v=null===(a=null===(i=null===(e=this.meeting)||void 0===e?void 0:e.meta)||void 0===i?void 0:i.meetingTitle)||void 0===a?void 0:a.trim();return r(s,null,r("div",{class:"container"},r("div",{class:"container-tile"},r(p,{element:"rtk-participant-tile",defaults:k,props:{participant:null===(c=this.meeting)||void 0===c?void 0:c.self,size:"md",isPreview:!0},childProps:{participant:null===(l=this.meeting)||void 0===l?void 0:l.self,size:"md"},deepProps:!0}),r("div",{class:"media-selectors"},r("rtk-microphone-selector",Object.assign({},k,{variant:"inline"})),r("rtk-camera-selector",Object.assign({},k,{variant:"inline"})),r("rtk-speaker-selector",Object.assign({},k,{variant:"inline"})))),r("div",{class:"metadata"},v&&""!==v&&r("div",{class:"meeting-title"},v),this.canEditName?r(o,null,r("div",{class:"join-as"},this.t("setup_screen.join_in_as")),r("input",{placeholder:this.t("setup_screen.your_name"),value:this.displayName,spellcheck:!1,autoFocus:!0,ref:t=>{this.inputEl=t},onInput:t=>{this.displayName=t.target.value},onKeyDown:t=>{"Enter"===t.key&&this.join()}})):r("div",{class:"uneditable-name"},r("span",{class:"text"},this.t("setup_screen.join_in_as")," ")," ",r("div",{class:"name"},n(this.displayName,20))),r("rtk-button",{size:"lg",kind:"wide",onClick:this.join,disabled:m},this.isJoining?r("rtk-spinner",{iconPack:this.iconPack}):this.t("join")),(this.joinError||d)&&r("div",{class:"no-network-badge",role:"alert"},r("rtk-icon",{size:"md",variant:"danger",icon:this.iconPack.disconnected}),h),this.meeting&&this.joinError&&r("a",{class:"troubleshoot-link",href:"https://test.realtime.cloudflare.com?authToken="+this.meeting.__internals__.authToken,target:"_blank",rel:"noopener noreferrer"},this.t("network.troubleshoot")),this.joinErrorCode&&r("span",{class:"error-code",part:"error-code"},this.t("join.error_code"),": ",this.joinErrorCode))))}static get watchers(){return{meeting:[{meetingChanged:0}]}}static get style(){return":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;padding:var(--rtk-space-4, 16px);height:100%;min-height:100%;width:100%;display:flex;place-items:center;justify-content:center;--rtk-controlbar-button-background-color:rgb(var(--rtk-colors-background-700, 44 44 44))}.container{width:100%;max-width:1080px;display:flex;align-items:center;justify-content:space-evenly;gap:var(--rtk-space-4, 16px)}.container-tile{display:flex;height:100%;width:100%;max-width:584px;flex-direction:column;gap:var(--rtk-space-2, 8px)}.metadata{display:flex;width:100%;max-width:var(--rtk-space-80, 320px);flex-direction:column;align-items:center;text-align:center}.meeting-title{margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:24px;font-weight:500}.join-as{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:16px;letter-spacing:-0.025em;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.uneditable-name{margin-bottom:var(--rtk-space-6, 24px)}.uneditable-name .text,.uneditable-name .name{display:inline-block}.uneditable-name .name{font-size:16px;font-weight:500}input{margin-bottom:var(--rtk-space-6, 24px);display:block;height:var(--rtk-space-10, 40px);width:100%;max-width:var(--rtk-space-80, 320px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));box-sizing:border-box;font-size:16px;outline:2px solid transparent;outline-offset:2px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}input::-moz-placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}input::placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}input{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}input:focus{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity))}rtk-spinner{color:rgb(var(--rtk-colors-text-1000, 255 255 255));--icon-size:var(--rtk-space-8, 32px)}:host([size='sm']) .container,:host([size='md']) .container{height:100%;flex-direction:column;justify-content:space-evenly}:host([size='sm']) .container-tile,:host([size='md']) .container-tile{height:-moz-min-content;height:min-content;flex-direction:column;justify-content:center}rtk-participant-tile{height:auto;width:100%;max-width:584px}.media-selectors{display:flex;flex-direction:column;justify-content:space-between}.media-selectors .row{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr))}.no-network-badge{margin-top:var(--rtk-space-2, 8px);display:flex;width:100%;flex-direction:row;align-items:center;justify-content:flex-start;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);font-size:12px;color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.75)}.no-network-badge rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px)}.troubleshoot-link{margin-top:var(--rtk-space-1, 4px);font-size:12px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-400, 53 110 253) / var(--tw-text-opacity));text-decoration-line:underline;text-underline-offset:2px}.troubleshoot-link:hover{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.error-code{margin-top:var(--rtk-space-1, 4px);font-size:10px;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}"}},[1,"rtk-setup-screen",{meeting:[16],states:[16],size:[513],config:[16],iconPack:[16],t:[16],displayName:[32],isJoining:[32],joinError:[32],joinErrorCode:[32],canEditName:[32],canProduceAudio:[32],connectionState:[32]},void 0,{meeting:[{meetingChanged:0}]}]);function j(){"undefined"!=typeof customElements&&["rtk-setup-screen","rtk-button","rtk-camera-selector","rtk-icon","rtk-microphone-selector","rtk-speaker-selector","rtk-spinner"].forEach((t=>{switch(t){case"rtk-setup-screen":customElements.get(a(t))||customElements.define(a(t),y);break;case"rtk-button":customElements.get(a(t))||v();break;case"rtk-camera-selector":customElements.get(a(t))||u();break;case"rtk-icon":customElements.get(a(t))||g();break;case"rtk-microphone-selector":customElements.get(a(t))||b();break;case"rtk-speaker-selector":customElements.get(a(t))||f();break;case"rtk-spinner":customElements.get(a(t))||x()}}))}w([m()],y.prototype,"meeting",void 0),w([m()],y.prototype,"states",void 0),w([m()],y.prototype,"config",void 0),w([m()],y.prototype,"iconPack",void 0),w([m()],y.prototype,"t",void 0),j();const z=y,C=j;export{z as RtkSetupScreen,C as defineCustomElement}
@@ -1 +1 @@
1
- import{R as s,d as o}from"./p-BGz4FsG8.js";const p=s,r=o;export{p as RtkSpeakerSelector,r as defineCustomElement}
1
+ import{R as s,d as o}from"./p-CHOs-ZsL.js";const p=s,r=o;export{p as RtkSpeakerSelector,r as defineCustomElement}
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2026-10-07T10:43:05",
2
+ "timestamp": "2026-10-07T11:22:29",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.43.5",
@@ -16676,8 +16676,11 @@ const RtkAudioTile = class {
16676
16676
  this.audioEnabled = false;
16677
16677
  this.volume = 0;
16678
16678
  this.onAudioUpdate = ({ audioEnabled, audioTrack, }) => {
16679
+ var _a;
16679
16680
  if (!this.participant)
16680
16681
  return;
16682
+ // stop the analyser of the previous track so it does not keep polling
16683
+ (_a = this.hark) === null || _a === void 0 ? void 0 : _a.stop();
16681
16684
  if (audioEnabled && audioTrack) {
16682
16685
  const stream = new MediaStream();
16683
16686
  stream.addTrack(audioTrack);
@@ -65622,7 +65625,7 @@ const RtkSpeakerSelector = class {
65622
65625
  var _a, _b, _c;
65623
65626
  (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.self.removeListener('deviceListUpdate', this.deviceListUpdateListener);
65624
65627
  (_b = this.meeting) === null || _b === void 0 ? void 0 : _b.self.removeListener('deviceUpdate', this.deviceUpdateListener);
65625
- (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.self.addListener('mediaPermissionUpdate', this.mediaPermissionUpdate);
65628
+ (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.self.removeListener('mediaPermissionUpdate', this.mediaPermissionUpdate);
65626
65629
  }
65627
65630
  meetingChanged(meeting) {
65628
65631
  if (!meeting)
@@ -29,8 +29,11 @@ const RtkAudioTile = class {
29
29
  this.audioEnabled = false;
30
30
  this.volume = 0;
31
31
  this.onAudioUpdate = ({ audioEnabled, audioTrack, }) => {
32
+ var _a;
32
33
  if (!this.participant)
33
34
  return;
35
+ // stop the analyser of the previous track so it does not keep polling
36
+ (_a = this.hark) === null || _a === void 0 ? void 0 : _a.stop();
34
37
  if (audioEnabled && audioTrack) {
35
38
  const stream = new MediaStream();
36
39
  stream.addTrack(audioTrack);
@@ -350,7 +350,7 @@ const RtkSpeakerSelector = class {
350
350
  var _a, _b, _c;
351
351
  (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.self.removeListener('deviceListUpdate', this.deviceListUpdateListener);
352
352
  (_b = this.meeting) === null || _b === void 0 ? void 0 : _b.self.removeListener('deviceUpdate', this.deviceUpdateListener);
353
- (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.self.addListener('mediaPermissionUpdate', this.mediaPermissionUpdate);
353
+ (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.self.removeListener('mediaPermissionUpdate', this.mediaPermissionUpdate);
354
354
  }
355
355
  meetingChanged(meeting) {
356
356
  if (!meeting)
@@ -1 +1 @@
1
- import{r as t,h as i,a as e,e as a,d as r}from"./p-gJCRRBX0.js";import{h as s}from"./p-BWNToYSb.js";import{e as o,i as n}from"./p-DI7wP4CL.js";import{S as c}from"./p-BmRffDYW.js";import{i as l}from"./p-CAqYddlg.js";import"./p-BFTU3MAI.js";const d=(t,i)=>{if(null==t)return;const e=Math.round(1.5),a=[...Array(3)].map(((t,a)=>{let r=a;return r>e-1&&(r=3-r-1),Math.round((r+1)/(e+1)*i)})),{width:r,height:s}=t,o=t.getContext("2d");let n=2;const c=1*r/a.length,l=c-4;o.clearRect(0,0,r,s),o.fillStyle="rgb(0,0,0,0.0)",o.fillRect(0,0,r,s);const d=getComputedStyle(t).getPropertyValue("color");o.fillStyle=d,o.strokeStyle=d,o.lineCap="round",o.lineWidth=4,o.beginPath();for(const t of a){const i=Math.min(-Math.abs(1.2*t/10*s)+s/2,s/2-2.5),e=Math.max(2*(s/2-i),5);o.moveTo(n+l/2,i),o.lineTo(n+l/2,i+e),n+=c}o.stroke()};var p=function(t,i,e,a){var r,s=arguments.length,o=s<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,e):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,a);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(s<3?r(o):s>3?r(i,e,o):r(i,e))||o);return s>3&&o&&Object.defineProperty(i,e,o),o};const h=class{constructor(i){t(this,i),this.variant="bars",this.iconPack=o,this.t=n(),this.hideMuted=!1,this.isScreenShare=!1,this.volume=0}connectedCallback(){this.participantChanged(this.participant)}componentDidLoad(){d(this.visualizer,0)}disconnectedCallback(){var t,i,e;null===(t=this.hark)||void 0===t||t.stop(),this.audioUpdateListener&&(null===(i=this.participant)||void 0===i||i.removeListener("audioUpdate",this.audioUpdateListener)),this.screenShareUpdateListener&&(null===(e=this.participant)||void 0===e||e.removeListener("screenShareUpdate",this.screenShareUpdateListener))}participantChanged(t){null!=t&&(this.audioUpdateListener=({audioEnabled:t,audioTrack:i})=>{var e;if(null===(e=this.hark)||void 0===e||e.stop(),t&&null!=i){this.audioEnabled=!0;const t=new MediaStream;t.addTrack(i),this.calcVolume(t),d(this.visualizer,0)}else this.volume=0,this.audioEnabled=!1},this.isScreenShare?(this.screenShareUpdateListener=({screenShareEnabled:t,screenShareTracks:i})=>{this.audioUpdateListener({audioEnabled:t&&null!=i.audio,audioTrack:i.audio})},this.screenShareUpdateListener({screenShareEnabled:t.screenShareEnabled,screenShareTracks:{audio:t.screenShareTracks.audio,video:t.screenShareTracks.video}}),t.addListener("screenShareUpdate",this.screenShareUpdateListener)):(this.audioUpdateListener(t),t.addListener("audioUpdate",this.audioUpdateListener)))}calcVolume(t){this.hark=s(t,{play:!1,interval:100}),this.hark.on("volume_change",(t=>{const i=this.volume;let e=Math.round(10**(t/115)*10);e<3&&(e=0);let a=Math.round((2*i+e)/3);i!==a&&(this.volume=a,d(this.visualizer,this.volume))}))}render(){return this.hideMuted&&!this.audioEnabled?null:i(e,null,i("div",{class:{audioActivePadding:this.hideMuted&&this.audioEnabled}},i("canvas",{width:"24",height:"24",class:{bars:!0,visible:this.audioEnabled},ref:t=>this.visualizer=t,part:"canvas"}),!this.isScreenShare&&!this.audioEnabled&&i("rtk-icon",{icon:this.iconPack.mic_off,part:"mic-off-icon"})))}static get watchers(){return{participant:[{participantChanged:0}]}}};p([c()],h.prototype,"iconPack",void 0),p([c()],h.prototype,"t",void 0),h.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;width:-moz-fit-content;width:fit-content}.audioActivePadding{padding:var(--rtk-space-1, 4px)}canvas,rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']){transform:scale(0.9)}canvas{display:none}canvas.visible{display:block}canvas.bars{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}";var v=function(t,i,e,a){var r,s=arguments.length,o=s<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,e):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,a);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(s<3?r(o):s>3?r(i,e,o):r(i,e))||o);return s>3&&o&&Object.defineProperty(i,e,o),o};const g=class{constructor(i){t(this,i),this.iconPack=o,this.variant="full",this.t=n(),this.audioinputDevices=[],this.canProduceAudio=!0,this.currentDevices={audio:void 0},this.stageStateListener=()=>{this.canProduceAudio="ALLOWED"===this.meeting.self.permissions.canProduceAudio},this.deviceListUpdateListener=async()=>{const t=await this.meeting.self.getAudioDevices();this.audioinputDevices=t},this.deviceUpdateListener=({device:t})=>{"audioinput"===t.kind&&(this.currentDevices={audio:t})},this.mediaPermissionUpdateListener=async({kind:t,message:i})=>{this.meeting&&"audio"===t&&"ACCEPTED"===i&&(this.audioinputDevices=await this.meeting.self.getAudioDevices())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,i,e,a,r;null===(i=null===(t=this.meeting)||void 0===t?void 0:t.stage)||void 0===i||i.removeListener("stageStatusUpdate",this.stageStateListener),null===(e=this.meeting)||void 0===e||e.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),null===(a=this.meeting)||void 0===a||a.self.removeListener("deviceUpdate",this.deviceUpdateListener),null===(r=this.meeting)||void 0===r||r.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener)}meetingChanged(t){t&&a((async()=>{var i,e;const{self:a,stage:r}=t,s=await t.self.getAudioDevices(),o=null===(i=t.self.getCurrentDevices())||void 0===i?void 0:i.audio;this.currentDevices={audio:o},this.canProduceAudio="ALLOWED"===t.self.permissions.canProduceAudio,null==r||r.addListener("stageStatusUpdate",this.stageStateListener),a.addListener("deviceListUpdate",this.deviceListUpdateListener),a.addListener("deviceUpdate",this.deviceUpdateListener),a.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),this.audioinputDevices=null!=o?[null!==(e=s.find((t=>t.deviceId===o.deviceId)))&&void 0!==e?e:o,...s.filter((t=>t.deviceId!==o.deviceId))]:s}))}setDevice(t){var i;if(l(this.meeting))return;const e=this.audioinputDevices.find((i=>i.deviceId===t));null!=e&&(this.currentDevices={audio:e},null===(i=this.meeting)||void 0===i||i.self.setDevice(e))}render(){if(!this.meeting)return null;let t=0;return i(e,null,this.canProduceAudio&&i("div",{part:"microphone-selection",class:"group container "+this.variant},i("label",{slot:"label"},"inline"!==this.variant&&this.t("settings.microphone_input"),i("rtk-icon",{icon:this.iconPack.mic_on,size:"sm"})),i("div",{class:"row"},i("select",{class:"rtk-select",onChange:t=>this.setDevice(t.target.value)},this.audioinputDevices.map((({deviceId:e,label:a})=>{var r;return i("option",{value:e,selected:(null===(r=this.currentDevices.audio)||void 0===r?void 0:r.deviceId)===e},a||"Microphone "+ ++t)}))),i("slot",{name:"indicator"}))))}static get watchers(){return{meeting:[{meetingChanged:0}]}}};v([c()],g.prototype,"meeting",void 0),v([c()],g.prototype,"iconPack",void 0),v([c()],g.prototype,"t",void 0),g.style=".rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{margin-bottom:var(--rtk-space-2, 8px);display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.inline.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0\\.5, 2px)}.inline.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline.container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}";var u=function(t,i,e,a){var r,s=arguments.length,o=s<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,e):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,a);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(s<3?r(o):s>3?r(i,e,o):r(i,e))||o);return s>3&&o&&Object.defineProperty(i,e,o),o};const k=class{constructor(i){t(this,i),this.variant="full",this.iconPack=o,this.t=n(),this.speakerDevices=[],this.currentDevices={speaker:void 0},this.deviceListUpdateListener=async()=>{const t=await this.meeting.self.getSpeakerDevices();this.speakerDevices=t},this.deviceUpdateListener=({device:t})=>{"audiooutput"===t.kind&&(this.currentDevices={speaker:t})},this.mediaPermissionUpdate=async({kind:t,message:i})=>{this.meeting&&"audio"===t&&"ACCEPTED"===i&&(this.speakerDevices=await this.meeting.self.getSpeakerDevices())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,i,e;null===(t=this.meeting)||void 0===t||t.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),null===(i=this.meeting)||void 0===i||i.self.removeListener("deviceUpdate",this.deviceUpdateListener),null===(e=this.meeting)||void 0===e||e.self.addListener("mediaPermissionUpdate",this.mediaPermissionUpdate)}meetingChanged(t){t&&a((async()=>{var i,e;const{self:a}=t,r=await t.self.getSpeakerDevices(),s=null===(i=t.self.getCurrentDevices())||void 0===i?void 0:i.speaker;this.currentDevices={speaker:s},a.addListener("deviceListUpdate",this.deviceListUpdateListener),a.addListener("deviceUpdate",this.deviceUpdateListener),a.addListener("mediaPermissionUpdate",this.mediaPermissionUpdate),this.speakerDevices=null!=s?[null!==(e=r.find((t=>t.deviceId===s.deviceId)))&&void 0!==e?e:s,...r.filter((t=>t.deviceId!==s.deviceId))]:r}))}testAudio(){var t;null===(t=this.testAudioEl)||void 0===t||t.play()}setDevice(t){var i,e;if(l(this.meeting))return;const a=this.speakerDevices.find((i=>i.deviceId===t));this.currentDevices={speaker:a},null!=a&&(null===(i=this.meeting)||void 0===i||i.self.setDevice(a),null===(e=this.testAudioEl)||void 0===e||e.setSinkId(a.deviceId))}render(){if(!this.meeting)return null;let t=0;return i(e,null,i("audio",{preload:"auto",src:"https://rtk-assets.realtime.cloudflare.com/ui-kit/speaker-test.mp3",ref:t=>this.testAudioEl=t}),i("div",{class:"group "+this.variant,part:"speaker-selection"},this.speakerDevices.length>0&&!l(this.meeting)&&i("div",{class:"container"},i("label",null,"inline"!==this.variant&&this.t("settings.speaker_output"),i("rtk-icon",{icon:this.iconPack.speaker,size:"sm"})),i("div",{class:"row"},i("select",{class:"rtk-select",onChange:t=>this.setDevice(t.target.value)},this.speakerDevices.map((({deviceId:e,label:a})=>{var r;return i("option",{value:e,selected:(null===(r=this.currentDevices.speaker)||void 0===r?void 0:r.deviceId)===e},a||"Speaker "+ ++t)}))))),"full"===this.variant&&i("rtk-button",{variant:"secondary",onClick:()=>this.testAudio()},i("rtk-icon",{icon:this.iconPack.speaker,slot:"start"}),this.t("test"))))}static get watchers(){return{meeting:[{meetingChanged:0}]}}};u([c()],k.prototype,"meeting",void 0),u([c()],k.prototype,"states",void 0),u([c()],k.prototype,"iconPack",void 0),u([c()],k.prototype,"t",void 0),k.style=".rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.inline.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0\\.5, 2px)}.inline.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline .container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}";var f=function(t,i,e,a){var r,s=arguments.length,o=s<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,e):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,a);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(s<3?r(o):s>3?r(i,e,o):r(i,e))||o);return s>3&&o&&Object.defineProperty(i,e,o),o};const b=class{constructor(i){t(this,i),this.onChange=r(this,"rtkChange",4),this.checked=!1,this.readonly=!1,this.disabled=!1,this.iconPack=o,this.t=n(),this.onClick=()=>{this.readonly||this.disabled||(this.checked=!this.checked)},this.onKeyPress=t=>{if(!this.readonly)switch(t.key){case"Enter":case" ":this.checked=!this.checked}}}connectedCallback(){this.checkedChange(this.checked)}checkedChange(t){this.checked=t,this.onChange.emit(t)}render(){return i(e,{key:"af0bcf0202cda77f3ec27510b867ed149c478bdf",role:"switch",tabIndex:this.disabled&&0,"aria-readonly":this.readonly,"aria-checked":this.checked,"aria-disabled":this.disabled,class:{checked:this.checked},onClick:this.onClick,onKeyPress:this.onKeyPress},i("div",{key:"e6f5eeb8acf33e9f058b029423eddc099033053c",class:"switch",part:"switch"}))}static get watchers(){return{checked:[{checkedChange:0}]}}};f([c()],b.prototype,"iconPack",void 0),f([c()],b.prototype,"t",void 0),b.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:inline-flex;height:var(--rtk-space-6, 24px);width:var(--rtk-space-10, 40px);align-items:center;padding:var(--rtk-space-1, 4px);border-radius:9999px;background-color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));cursor:pointer}.switch{box-sizing:border-box;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);background-color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border-radius:9999px;transition-property:var(--rtk-transition-property, all);transition-duration:200ms}:host(.checked){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}:host(.checked) .switch{transform:translateX(100%)}:host([readonly]),:host([disabled]){cursor:not-allowed;opacity:0.6}";export{h as rtk_audio_visualizer,g as rtk_microphone_selector,k as rtk_speaker_selector,b as rtk_switch}
1
+ import{r as t,h as i,a as e,e as a,d as r}from"./p-gJCRRBX0.js";import{h as s}from"./p-BWNToYSb.js";import{e as o,i as n}from"./p-DI7wP4CL.js";import{S as c}from"./p-BmRffDYW.js";import{i as l}from"./p-CAqYddlg.js";import"./p-BFTU3MAI.js";const d=(t,i)=>{if(null==t)return;const e=Math.round(1.5),a=[...Array(3)].map(((t,a)=>{let r=a;return r>e-1&&(r=3-r-1),Math.round((r+1)/(e+1)*i)})),{width:r,height:s}=t,o=t.getContext("2d");let n=2;const c=1*r/a.length,l=c-4;o.clearRect(0,0,r,s),o.fillStyle="rgb(0,0,0,0.0)",o.fillRect(0,0,r,s);const d=getComputedStyle(t).getPropertyValue("color");o.fillStyle=d,o.strokeStyle=d,o.lineCap="round",o.lineWidth=4,o.beginPath();for(const t of a){const i=Math.min(-Math.abs(1.2*t/10*s)+s/2,s/2-2.5),e=Math.max(2*(s/2-i),5);o.moveTo(n+l/2,i),o.lineTo(n+l/2,i+e),n+=c}o.stroke()};var p=function(t,i,e,a){var r,s=arguments.length,o=s<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,e):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,a);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(s<3?r(o):s>3?r(i,e,o):r(i,e))||o);return s>3&&o&&Object.defineProperty(i,e,o),o};const h=class{constructor(i){t(this,i),this.variant="bars",this.iconPack=o,this.t=n(),this.hideMuted=!1,this.isScreenShare=!1,this.volume=0}connectedCallback(){this.participantChanged(this.participant)}componentDidLoad(){d(this.visualizer,0)}disconnectedCallback(){var t,i,e;null===(t=this.hark)||void 0===t||t.stop(),this.audioUpdateListener&&(null===(i=this.participant)||void 0===i||i.removeListener("audioUpdate",this.audioUpdateListener)),this.screenShareUpdateListener&&(null===(e=this.participant)||void 0===e||e.removeListener("screenShareUpdate",this.screenShareUpdateListener))}participantChanged(t){null!=t&&(this.audioUpdateListener=({audioEnabled:t,audioTrack:i})=>{var e;if(null===(e=this.hark)||void 0===e||e.stop(),t&&null!=i){this.audioEnabled=!0;const t=new MediaStream;t.addTrack(i),this.calcVolume(t),d(this.visualizer,0)}else this.volume=0,this.audioEnabled=!1},this.isScreenShare?(this.screenShareUpdateListener=({screenShareEnabled:t,screenShareTracks:i})=>{this.audioUpdateListener({audioEnabled:t&&null!=i.audio,audioTrack:i.audio})},this.screenShareUpdateListener({screenShareEnabled:t.screenShareEnabled,screenShareTracks:{audio:t.screenShareTracks.audio,video:t.screenShareTracks.video}}),t.addListener("screenShareUpdate",this.screenShareUpdateListener)):(this.audioUpdateListener(t),t.addListener("audioUpdate",this.audioUpdateListener)))}calcVolume(t){this.hark=s(t,{play:!1,interval:100}),this.hark.on("volume_change",(t=>{const i=this.volume;let e=Math.round(10**(t/115)*10);e<3&&(e=0);let a=Math.round((2*i+e)/3);i!==a&&(this.volume=a,d(this.visualizer,this.volume))}))}render(){return this.hideMuted&&!this.audioEnabled?null:i(e,null,i("div",{class:{audioActivePadding:this.hideMuted&&this.audioEnabled}},i("canvas",{width:"24",height:"24",class:{bars:!0,visible:this.audioEnabled},ref:t=>this.visualizer=t,part:"canvas"}),!this.isScreenShare&&!this.audioEnabled&&i("rtk-icon",{icon:this.iconPack.mic_off,part:"mic-off-icon"})))}static get watchers(){return{participant:[{participantChanged:0}]}}};p([c()],h.prototype,"iconPack",void 0),p([c()],h.prototype,"t",void 0),h.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;width:-moz-fit-content;width:fit-content}.audioActivePadding{padding:var(--rtk-space-1, 4px)}canvas,rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']){transform:scale(0.9)}canvas{display:none}canvas.visible{display:block}canvas.bars{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}";var v=function(t,i,e,a){var r,s=arguments.length,o=s<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,e):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,a);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(s<3?r(o):s>3?r(i,e,o):r(i,e))||o);return s>3&&o&&Object.defineProperty(i,e,o),o};const g=class{constructor(i){t(this,i),this.iconPack=o,this.variant="full",this.t=n(),this.audioinputDevices=[],this.canProduceAudio=!0,this.currentDevices={audio:void 0},this.stageStateListener=()=>{this.canProduceAudio="ALLOWED"===this.meeting.self.permissions.canProduceAudio},this.deviceListUpdateListener=async()=>{const t=await this.meeting.self.getAudioDevices();this.audioinputDevices=t},this.deviceUpdateListener=({device:t})=>{"audioinput"===t.kind&&(this.currentDevices={audio:t})},this.mediaPermissionUpdateListener=async({kind:t,message:i})=>{this.meeting&&"audio"===t&&"ACCEPTED"===i&&(this.audioinputDevices=await this.meeting.self.getAudioDevices())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,i,e,a,r;null===(i=null===(t=this.meeting)||void 0===t?void 0:t.stage)||void 0===i||i.removeListener("stageStatusUpdate",this.stageStateListener),null===(e=this.meeting)||void 0===e||e.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),null===(a=this.meeting)||void 0===a||a.self.removeListener("deviceUpdate",this.deviceUpdateListener),null===(r=this.meeting)||void 0===r||r.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener)}meetingChanged(t){t&&a((async()=>{var i,e;const{self:a,stage:r}=t,s=await t.self.getAudioDevices(),o=null===(i=t.self.getCurrentDevices())||void 0===i?void 0:i.audio;this.currentDevices={audio:o},this.canProduceAudio="ALLOWED"===t.self.permissions.canProduceAudio,null==r||r.addListener("stageStatusUpdate",this.stageStateListener),a.addListener("deviceListUpdate",this.deviceListUpdateListener),a.addListener("deviceUpdate",this.deviceUpdateListener),a.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),this.audioinputDevices=null!=o?[null!==(e=s.find((t=>t.deviceId===o.deviceId)))&&void 0!==e?e:o,...s.filter((t=>t.deviceId!==o.deviceId))]:s}))}setDevice(t){var i;if(l(this.meeting))return;const e=this.audioinputDevices.find((i=>i.deviceId===t));null!=e&&(this.currentDevices={audio:e},null===(i=this.meeting)||void 0===i||i.self.setDevice(e))}render(){if(!this.meeting)return null;let t=0;return i(e,null,this.canProduceAudio&&i("div",{part:"microphone-selection",class:"group container "+this.variant},i("label",{slot:"label"},"inline"!==this.variant&&this.t("settings.microphone_input"),i("rtk-icon",{icon:this.iconPack.mic_on,size:"sm"})),i("div",{class:"row"},i("select",{class:"rtk-select",onChange:t=>this.setDevice(t.target.value)},this.audioinputDevices.map((({deviceId:e,label:a})=>{var r;return i("option",{value:e,selected:(null===(r=this.currentDevices.audio)||void 0===r?void 0:r.deviceId)===e},a||"Microphone "+ ++t)}))),i("slot",{name:"indicator"}))))}static get watchers(){return{meeting:[{meetingChanged:0}]}}};v([c()],g.prototype,"meeting",void 0),v([c()],g.prototype,"iconPack",void 0),v([c()],g.prototype,"t",void 0),g.style=".rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{margin-bottom:var(--rtk-space-2, 8px);display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.inline.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0\\.5, 2px)}.inline.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline.container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}";var u=function(t,i,e,a){var r,s=arguments.length,o=s<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,e):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,a);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(s<3?r(o):s>3?r(i,e,o):r(i,e))||o);return s>3&&o&&Object.defineProperty(i,e,o),o};const k=class{constructor(i){t(this,i),this.variant="full",this.iconPack=o,this.t=n(),this.speakerDevices=[],this.currentDevices={speaker:void 0},this.deviceListUpdateListener=async()=>{const t=await this.meeting.self.getSpeakerDevices();this.speakerDevices=t},this.deviceUpdateListener=({device:t})=>{"audiooutput"===t.kind&&(this.currentDevices={speaker:t})},this.mediaPermissionUpdate=async({kind:t,message:i})=>{this.meeting&&"audio"===t&&"ACCEPTED"===i&&(this.speakerDevices=await this.meeting.self.getSpeakerDevices())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,i,e;null===(t=this.meeting)||void 0===t||t.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),null===(i=this.meeting)||void 0===i||i.self.removeListener("deviceUpdate",this.deviceUpdateListener),null===(e=this.meeting)||void 0===e||e.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdate)}meetingChanged(t){t&&a((async()=>{var i,e;const{self:a}=t,r=await t.self.getSpeakerDevices(),s=null===(i=t.self.getCurrentDevices())||void 0===i?void 0:i.speaker;this.currentDevices={speaker:s},a.addListener("deviceListUpdate",this.deviceListUpdateListener),a.addListener("deviceUpdate",this.deviceUpdateListener),a.addListener("mediaPermissionUpdate",this.mediaPermissionUpdate),this.speakerDevices=null!=s?[null!==(e=r.find((t=>t.deviceId===s.deviceId)))&&void 0!==e?e:s,...r.filter((t=>t.deviceId!==s.deviceId))]:r}))}testAudio(){var t;null===(t=this.testAudioEl)||void 0===t||t.play()}setDevice(t){var i,e;if(l(this.meeting))return;const a=this.speakerDevices.find((i=>i.deviceId===t));this.currentDevices={speaker:a},null!=a&&(null===(i=this.meeting)||void 0===i||i.self.setDevice(a),null===(e=this.testAudioEl)||void 0===e||e.setSinkId(a.deviceId))}render(){if(!this.meeting)return null;let t=0;return i(e,null,i("audio",{preload:"auto",src:"https://rtk-assets.realtime.cloudflare.com/ui-kit/speaker-test.mp3",ref:t=>this.testAudioEl=t}),i("div",{class:"group "+this.variant,part:"speaker-selection"},this.speakerDevices.length>0&&!l(this.meeting)&&i("div",{class:"container"},i("label",null,"inline"!==this.variant&&this.t("settings.speaker_output"),i("rtk-icon",{icon:this.iconPack.speaker,size:"sm"})),i("div",{class:"row"},i("select",{class:"rtk-select",onChange:t=>this.setDevice(t.target.value)},this.speakerDevices.map((({deviceId:e,label:a})=>{var r;return i("option",{value:e,selected:(null===(r=this.currentDevices.speaker)||void 0===r?void 0:r.deviceId)===e},a||"Speaker "+ ++t)}))))),"full"===this.variant&&i("rtk-button",{variant:"secondary",onClick:()=>this.testAudio()},i("rtk-icon",{icon:this.iconPack.speaker,slot:"start"}),this.t("test"))))}static get watchers(){return{meeting:[{meetingChanged:0}]}}};u([c()],k.prototype,"meeting",void 0),u([c()],k.prototype,"states",void 0),u([c()],k.prototype,"iconPack",void 0),u([c()],k.prototype,"t",void 0),k.style=".rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.inline.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0\\.5, 2px)}.inline.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline .container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}";var f=function(t,i,e,a){var r,s=arguments.length,o=s<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,e):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,a);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(s<3?r(o):s>3?r(i,e,o):r(i,e))||o);return s>3&&o&&Object.defineProperty(i,e,o),o};const b=class{constructor(i){t(this,i),this.onChange=r(this,"rtkChange",4),this.checked=!1,this.readonly=!1,this.disabled=!1,this.iconPack=o,this.t=n(),this.onClick=()=>{this.readonly||this.disabled||(this.checked=!this.checked)},this.onKeyPress=t=>{if(!this.readonly)switch(t.key){case"Enter":case" ":this.checked=!this.checked}}}connectedCallback(){this.checkedChange(this.checked)}checkedChange(t){this.checked=t,this.onChange.emit(t)}render(){return i(e,{key:"af0bcf0202cda77f3ec27510b867ed149c478bdf",role:"switch",tabIndex:this.disabled&&0,"aria-readonly":this.readonly,"aria-checked":this.checked,"aria-disabled":this.disabled,class:{checked:this.checked},onClick:this.onClick,onKeyPress:this.onKeyPress},i("div",{key:"e6f5eeb8acf33e9f058b029423eddc099033053c",class:"switch",part:"switch"}))}static get watchers(){return{checked:[{checkedChange:0}]}}};f([c()],b.prototype,"iconPack",void 0),f([c()],b.prototype,"t",void 0),b.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:inline-flex;height:var(--rtk-space-6, 24px);width:var(--rtk-space-10, 40px);align-items:center;padding:var(--rtk-space-1, 4px);border-radius:9999px;background-color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));cursor:pointer}.switch{box-sizing:border-box;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);background-color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border-radius:9999px;transition-property:var(--rtk-transition-property, all);transition-duration:200ms}:host(.checked){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}:host(.checked) .switch{transform:translateX(100%)}:host([readonly]),:host([disabled]){cursor:not-allowed;opacity:0.6}";export{h as rtk_audio_visualizer,g as rtk_microphone_selector,k as rtk_speaker_selector,b as rtk_switch}
@@ -0,0 +1 @@
1
+ import{r as t,h as r,a}from"./p-gJCRRBX0.js";import"./p-DxDYE5-a.js";import"./p-C0vp-Q7v.js";import{e as i,i as o}from"./p-DI7wP4CL.js";import{h as s}from"./p-BWNToYSb.js";import{S as e}from"./p-BmRffDYW.js";import"./p-Daj_55_i.js";import"./p-BFTU3MAI.js";var c=function(t,r,a,i){var o,s=arguments.length,e=s<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)e=Reflect.decorate(t,r,a,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(e=(s<3?o(e):s>3?o(r,a,e):o(r,a))||e);return s>3&&e&&Object.defineProperty(r,a,e),e};const n=class{constructor(r){t(this,r),this.iconPack=i,this.t=o(),this.audioEnabled=!1,this.volume=0,this.onAudioUpdate=({audioEnabled:t,audioTrack:r})=>{var a;if(this.participant)if(null===(a=this.hark)||void 0===a||a.stop(),t&&r){const t=new MediaStream;t.addTrack(r),this.calcVolume(t),this.audioEnabled=!0}else this.volume=0,this.audioEnabled=!1}}connectedCallback(){this.participantChanged(this.participant)}disconnectedCallback(){var t,r;null===(t=this.hark)||void 0===t||t.stop(),null===(r=this.participant)||void 0===r||r.removeListener("audioUpdate",this.onAudioUpdate)}participantChanged(t){t&&(this.audioEnabled=t.audioEnabled,t.addListener("audioUpdate",this.onAudioUpdate))}calcVolume(t){this.hark=s(t,{play:!1,interval:100}),this.hark.on("volume_change",(t=>{const r=this.volume;let a=Math.round(10**(t/115)*10);a<3&&(a=0);let i=Math.round((2*r+a)/3);r!==i&&(this.volume=i)}))}render(){if(!this.meeting)return null;const t={meeting:this.meeting,size:this.size,config:this.config,states:this.states,iconPack:this.iconPack,t:this.t};let o="bar-0";return o=this.volume>5?"bar-5":this.volume<0?"bar-0":"bar-"+this.volume,r(a,null,r("div",{class:{"avatar-ctr":!0,speaking:this.audioEnabled,[o]:!0}},r("rtk-avatar",{participant:this.participant,size:this.size},!this.audioEnabled&&r("div",{class:"mic-icon"},r("rtk-icon",{icon:i.mic_off})))),r("rtk-name-tag",Object.assign({variant:"text",participant:this.participant},t)),r("slot",null))}static get watchers(){return{participant:[{participantChanged:0}]}}};c([e()],n.prototype,"meeting",void 0),c([e()],n.prototype,"config",void 0),c([e()],n.prototype,"states",void 0),c([e()],n.prototype,"iconPack",void 0),c([e()],n.prototype,"t",void 0),n.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column}.avatar-ctr{box-sizing:border-box;width:100%;flex:1 1 0%;padding:var(--rtk-space-1\\.5, 6px);border:2px solid transparent;border-radius:calc(var(--rtk-border-radius-xl, 40px) + var(--rtk-space-1\\.5, 6px))}.avatar-ctr.speaking{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.bar-0{box-shadow:none}.bar-1{box-shadow:0 0 4px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-2{box-shadow:0 0 8px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-3{box-shadow:0 0 16px 1px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-4{box-shadow:0 0 20px 3px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-5{box-shadow:0 0 24px 6px rgb(var(--rtk-colors-brand-500, 33 96 253))}rtk-avatar{aspect-ratio:1 / 1;height:100%;width:100%;position:relative;border-radius:var(--rtk-border-radius-xl, 40px)}rtk-name-tag{display:block;height:var(--rtk-space-10, 40px);width:100%;text-align:center;line-height:2.5rem}:host([size='sm']) .avatar-ctr{border-radius:calc(var(--rtk-border-radius-lg, 12px) + var(--rtk-space-1\\.5, 6px))}:host([size='sm']) rtk-name-tag{height:var(--rtk-space-7, 28px);line-height:1.75rem}:host([size='sm']) rtk-avatar{border-radius:var(--rtk-border-radius-lg, 12px)}.mic-icon{position:absolute;bottom:calc(var(--rtk-space-1, 4px) * -1);right:calc(var(--rtk-space-1, 4px) * -1);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.mic-icon rtk-icon{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}:host([size='sm']) .mic-icon rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([size='md']) .mic-icon rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}";export{n as rtk_audio_tile}