@whereby.com/browser-sdk 0.1.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ name: "Build"
2
+ description: "Installs dependencies and builds lib"
3
+ runs:
4
+ using: "composite"
5
+ steps:
6
+ - uses: actions/setup-node@v2
7
+ with:
8
+ node-version: "16"
9
+ cache: "yarn"
10
+
11
+ - name: Install dependencies
12
+ run: yarn install --frozen-lockfile
13
+ shell: bash
14
+
15
+ - name: Build
16
+ run: yarn build
17
+ shell: bash
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: Build, test & deploy
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - "package.json"
9
+ jobs:
10
+ build_and_test:
11
+ concurrency: build_and_test_main_${{ github.head_ref }}
12
+ name: Build & test
13
+ runs-on: ubuntu-latest
14
+ env:
15
+ GITHUB_TOKEN: ${{ secrets.WHEREBY_GITHUB_TOKEN }}
16
+ steps:
17
+ - name: Checkout source code
18
+ uses: actions/checkout@v2
19
+
20
+ - name: Build
21
+ uses: ./.github/actions/build
22
+
23
+ - name: Test
24
+ run: yarn test
25
+ deploy_cdn:
26
+ concurrency: deploy_cdn_main_${{ github.head_ref }}
27
+ name: Deploy to CDN
28
+ needs: build_and_test
29
+ runs-on: ubuntu-latest
30
+ env:
31
+ GITHUB_TOKEN: ${{ secrets.WHEREBY_GITHUB_TOKEN }}
32
+ steps:
33
+ - name: Checkout source code
34
+ uses: actions/checkout@v2
35
+
36
+ - name: Build
37
+ uses: ./.github/actions/build
38
+
39
+ - name: Configure AWS Credentials
40
+ uses: aws-actions/configure-aws-credentials@v1
41
+ with:
42
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
43
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
44
+ aws-region: eu-west-1
45
+
46
+ - uses: jakejarvis/s3-sync-action@master
47
+ with:
48
+ args: --acl public-read --follow-symlinks
49
+ env:
50
+ AWS_S3_BUCKET: whereby-cdn
51
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
52
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
53
+ AWS_REGION: "es-west-1"
54
+ SOURCE_DIR: "dist/"
55
+ DEST_DIR: "embed/"
56
+
57
+ - name: Invalidate cloudfront publication
58
+ run: aws cloudfront create-invalidation --distribution-id=E6H48QPJYYL39 --paths "/embed/*"
59
+ deploy_npm:
60
+ concurrency: deploy_npm_main_${{ github.head_ref }}
61
+ name: Deploy to npm
62
+ needs: build_and_test
63
+ runs-on: ubuntu-latest
64
+ env:
65
+ GITHUB_TOKEN: ${{ secrets.WHEREBY_GITHUB_TOKEN }}
66
+ steps:
67
+ - name: Checkout source code
68
+ uses: actions/checkout@v2
69
+
70
+ - name: Build
71
+ uses: ./.github/actions/build
72
+
73
+ - name: Deploy to npm
74
+ uses: JS-DevTools/npm-publish@v1
75
+ with:
76
+ token: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: Test
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ jobs:
11
+ test:
12
+ name: Test
13
+ concurrency: test_${{ github.head_ref }}
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - name: Checkout source code
18
+ uses: actions/checkout@v2
19
+
20
+ - name: Build
21
+ uses: ./.github/actions/build
22
+
23
+ - name: Test
24
+ run: yarn test
package/dist/lib.cjs.js CHANGED
@@ -25,6 +25,7 @@ const boolAttrs = [
25
25
  "personality",
26
26
  "subgridLabels",
27
27
  "lowData",
28
+ "breakout",
28
29
  ];
29
30
 
30
31
  heresy.define("WherebyEmbed", {
@@ -37,9 +38,18 @@ heresy.define("WherebyEmbed", {
37
38
  ondisconnected() {
38
39
  window.removeEventListener("message", this);
39
40
  },
40
- observedAttributes: ["displayName", "minimal", "room", "subdomain", "groups", "lang", "metadata", ...boolAttrs].map(
41
- (a) => a.toLowerCase()
42
- ),
41
+ observedAttributes: [
42
+ "displayName",
43
+ "minimal",
44
+ "room",
45
+ "subdomain",
46
+ "lang",
47
+ "metadata",
48
+ "groups",
49
+ "virtualBackgroundUrl",
50
+ "avatarUrl",
51
+ ...boolAttrs,
52
+ ].map((a) => a.toLowerCase()),
43
53
  onattributechanged({ attributeName, oldValue }) {
44
54
  if (["room", "subdomain"].includes(attributeName) && oldValue == null) return;
45
55
  this.render();
@@ -58,20 +68,23 @@ heresy.define("WherebyEmbed", {
58
68
  },
59
69
 
60
70
  // Commands
61
- toggleCamera(enabled) {
71
+ _postCommand(command, args = []) {
62
72
  if (this.iframe.current) {
63
73
  const url = new URL(this.room, `https://${this.subdomain}.whereby.com`);
64
- this.iframe.current.contentWindow.postMessage({ command: "toggle_camera", args: [enabled] }, url.origin);
74
+ this.iframe.current.contentWindow.postMessage({ command, args }, url.origin);
65
75
  }
66
76
  },
77
+ startRecording() {
78
+ this._postCommand("start_recording");
79
+ },
80
+ stopRecording() {
81
+ this._postCommand("stop_recording");
82
+ },
83
+ toggleCamera(enabled) {
84
+ this._postCommand("toggle_camera", [enabled]);
85
+ },
67
86
  toggleMicrophone(enabled) {
68
- if (this.iframe.current) {
69
- const url = new URL(this.room, `https://${this.subdomain}.whereby.com`);
70
- this.iframe.current.contentWindow.postMessage(
71
- { command: "toggle_microphone", args: [enabled] },
72
- url.origin
73
- );
74
- }
87
+ this._postCommand("toggle_microphone", [enabled]);
75
88
  },
76
89
 
77
90
  onmessage({ origin, data }) {
@@ -81,7 +94,16 @@ heresy.define("WherebyEmbed", {
81
94
  this.dispatchEvent(new CustomEvent(type, { detail }));
82
95
  },
83
96
  render() {
84
- const { displayname: displayName, lang, metadata, minimal, room } = this;
97
+ const {
98
+ avatarurl: avatarUrl,
99
+ displayname: displayName,
100
+ lang,
101
+ metadata,
102
+ minimal,
103
+ room,
104
+ groups,
105
+ virtualbackgroundurl: virtualBackgroundUrl,
106
+ } = this;
85
107
  if (!room) return this.html`Whereby: Missing room attr.`;
86
108
  // Get subdomain from room URL, or use it specified
87
109
  let m = /https:\/\/([^.]+)\.whereby.com\/.+/.exec(room);
@@ -90,11 +112,14 @@ heresy.define("WherebyEmbed", {
90
112
  const url = new URL(room, `https://${subdomain}.whereby.com`);
91
113
  Object.entries({
92
114
  jsApi: true,
93
- we: "0.1.0",
115
+ we: "1.6.0",
94
116
  iframeSource: subdomain,
95
117
  ...(displayName && { displayName }),
96
118
  ...(lang && { lang: lang }),
97
119
  ...(metadata && { metadata: metadata }),
120
+ ...(groups && { groups: groups }),
121
+ ...(virtualBackgroundUrl && { virtualBackgroundUrl: virtualBackgroundUrl }),
122
+ ...(avatarUrl && { avatarUrl: avatarUrl }),
98
123
  // the original ?embed name was confusing, so we give minimal
99
124
  ...(minimal != null && { embed: minimal }),
100
125
  ...boolAttrs.reduce(
@@ -116,6 +141,6 @@ heresy.define("WherebyEmbed", {
116
141
  },
117
142
  });
118
143
 
119
- var index = { sdkVersion: "0.1.0" };
144
+ var index = { sdkVersion: "1.6.0" };
120
145
 
121
146
  module.exports = index;
package/dist/lib.esm.js CHANGED
@@ -23,6 +23,7 @@ const boolAttrs = [
23
23
  "personality",
24
24
  "subgridLabels",
25
25
  "lowData",
26
+ "breakout",
26
27
  ];
27
28
 
28
29
  define("WherebyEmbed", {
@@ -35,9 +36,18 @@ define("WherebyEmbed", {
35
36
  ondisconnected() {
36
37
  window.removeEventListener("message", this);
37
38
  },
38
- observedAttributes: ["displayName", "minimal", "room", "subdomain", "groups", "lang", "metadata", ...boolAttrs].map(
39
- (a) => a.toLowerCase()
40
- ),
39
+ observedAttributes: [
40
+ "displayName",
41
+ "minimal",
42
+ "room",
43
+ "subdomain",
44
+ "lang",
45
+ "metadata",
46
+ "groups",
47
+ "virtualBackgroundUrl",
48
+ "avatarUrl",
49
+ ...boolAttrs,
50
+ ].map((a) => a.toLowerCase()),
41
51
  onattributechanged({ attributeName, oldValue }) {
42
52
  if (["room", "subdomain"].includes(attributeName) && oldValue == null) return;
43
53
  this.render();
@@ -56,20 +66,23 @@ define("WherebyEmbed", {
56
66
  },
57
67
 
58
68
  // Commands
59
- toggleCamera(enabled) {
69
+ _postCommand(command, args = []) {
60
70
  if (this.iframe.current) {
61
71
  const url = new URL(this.room, `https://${this.subdomain}.whereby.com`);
62
- this.iframe.current.contentWindow.postMessage({ command: "toggle_camera", args: [enabled] }, url.origin);
72
+ this.iframe.current.contentWindow.postMessage({ command, args }, url.origin);
63
73
  }
64
74
  },
75
+ startRecording() {
76
+ this._postCommand("start_recording");
77
+ },
78
+ stopRecording() {
79
+ this._postCommand("stop_recording");
80
+ },
81
+ toggleCamera(enabled) {
82
+ this._postCommand("toggle_camera", [enabled]);
83
+ },
65
84
  toggleMicrophone(enabled) {
66
- if (this.iframe.current) {
67
- const url = new URL(this.room, `https://${this.subdomain}.whereby.com`);
68
- this.iframe.current.contentWindow.postMessage(
69
- { command: "toggle_microphone", args: [enabled] },
70
- url.origin
71
- );
72
- }
85
+ this._postCommand("toggle_microphone", [enabled]);
73
86
  },
74
87
 
75
88
  onmessage({ origin, data }) {
@@ -79,7 +92,16 @@ define("WherebyEmbed", {
79
92
  this.dispatchEvent(new CustomEvent(type, { detail }));
80
93
  },
81
94
  render() {
82
- const { displayname: displayName, lang, metadata, minimal, room } = this;
95
+ const {
96
+ avatarurl: avatarUrl,
97
+ displayname: displayName,
98
+ lang,
99
+ metadata,
100
+ minimal,
101
+ room,
102
+ groups,
103
+ virtualbackgroundurl: virtualBackgroundUrl,
104
+ } = this;
83
105
  if (!room) return this.html`Whereby: Missing room attr.`;
84
106
  // Get subdomain from room URL, or use it specified
85
107
  let m = /https:\/\/([^.]+)\.whereby.com\/.+/.exec(room);
@@ -88,11 +110,14 @@ define("WherebyEmbed", {
88
110
  const url = new URL(room, `https://${subdomain}.whereby.com`);
89
111
  Object.entries({
90
112
  jsApi: true,
91
- we: "0.1.0",
113
+ we: "1.6.0",
92
114
  iframeSource: subdomain,
93
115
  ...(displayName && { displayName }),
94
116
  ...(lang && { lang: lang }),
95
117
  ...(metadata && { metadata: metadata }),
118
+ ...(groups && { groups: groups }),
119
+ ...(virtualBackgroundUrl && { virtualBackgroundUrl: virtualBackgroundUrl }),
120
+ ...(avatarUrl && { avatarUrl: avatarUrl }),
96
121
  // the original ?embed name was confusing, so we give minimal
97
122
  ...(minimal != null && { embed: minimal }),
98
123
  ...boolAttrs.reduce(
@@ -114,6 +139,6 @@ define("WherebyEmbed", {
114
139
  },
115
140
  });
116
141
 
117
- var index = { sdkVersion: "0.1.0" };
142
+ var index = { sdkVersion: "1.6.0" };
118
143
 
119
144
  export { index as default };
@@ -3,13 +3,13 @@ var e={};try{e.WeakMap=WeakMap}catch(t){e.WeakMap=function(e,t){var n=t.definePr
3
3
  /*! (c) Andrea Giammarchi - ISC */try{s.WeakSet=WeakSet}catch(e){!function(e){var t=new e,n=r.prototype;function r(n){t.set(this,new e),n&&n.forEach(this.add,this)}n.add=function(e){return t.get(this).set(e,1),this},n.delete=function(e){return t.get(this).delete(e)},n.has=function(e){return t.get(this).has(e)},s.WeakSet=r}(WeakMap)}var o,a,i=s.WeakSet,c="-"+Math.random().toFixed(6)+"%",l=!1;
4
4
  /*! (c) Andrea Giammarchi - ISC */try{o=document.createElement("template"),a="tabindex","content"in o&&(o.innerHTML='<p tabindex="'+c+'"></p>',o.content.childNodes[0].getAttribute(a)==c)||(c="_dt: "+c.slice(1,-1)+";",l=!0)}catch(e){}var u="\x3c!--"+c+"--\x3e",h=/^(?:plaintext|script|style|textarea|title|xmp)$/i,f=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
5
5
  /*! (c) Andrea Giammarchi - ISC */
6
- function p(e){return e.join(u).replace(w,C).replace(y,x)}var d=" \\f\\n\\r\\t",m="[^ \\f\\n\\r\\t\\/>\"'=]+",g="[ \\f\\n\\r\\t]+"+m,v="<([A-Za-z]+[A-Za-z0-9:._-]*)((?:",b="(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|<[^>]*?>|"+m.replace("\\/","")+"))?)",y=new RegExp(v+g+b+"+)(["+d+"]*/?>)","g"),w=new RegExp(v+g+b+"*)(["+d+"]*/>)","g"),E=new RegExp("("+g+"\\s*=\\s*)(['\"]?)"+u+"\\2","gi");function x(e,t,n,r){return"<"+t+n.replace(E,N)+r}function N(e,t,n){return t+(n||'"')+c+(n||'"')}function C(e,t,n){return f.test(t)?e:"<"+t+n+"></"+t+">"}const{isArray:k}=Array,{indexOf:A,slice:$}=[];var S=e=>({get:t=>e.get(t),set:(t,n)=>(e.set(t,n),n)});const _=(e,t)=>111===e.nodeType?1/t<0?t?(({firstChild:e,lastChild:t})=>{const n=document.createRange();return n.setStartAfter(e),n.setEndAfter(t),n.deleteContents(),e})(e):e.lastChild:t?e.valueOf():e.firstChild:e,L=e=>{const{childNodes:t}=e,{length:n}=t;if(n<2)return n?t[0]:e;const r=$.call(t,0);return{ELEMENT_NODE:1,nodeType:111,firstChild:r[0],lastChild:r[n-1],valueOf(){if(t.length!==n){let t=0;for(;t<n;)e.appendChild(r[t++])}return e}}};
6
+ function p(e){return e.join(u).replace(w,N).replace(y,C)}var d=" \\f\\n\\r\\t",m="[^ \\f\\n\\r\\t\\/>\"'=]+",g="[ \\f\\n\\r\\t]+"+m,v="<([A-Za-z]+[A-Za-z0-9:._-]*)((?:",b="(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|<[^>]*?>|"+m.replace("\\/","")+"))?)",y=new RegExp(v+g+b+"+)(["+d+"]*/?>)","g"),w=new RegExp(v+g+b+"*)(["+d+"]*/>)","g"),E=new RegExp("("+g+"\\s*=\\s*)(['\"]?)"+u+"\\2","gi");function C(e,t,n,r){return"<"+t+n.replace(E,x)+r}function x(e,t,n){return t+(n||'"')+c+(n||'"')}function N(e,t,n){return f.test(t)?e:"<"+t+n+"></"+t+">"}const{isArray:k}=Array,{indexOf:A,slice:$}=[];var _=e=>({get:t=>e.get(t),set:(t,n)=>(e.set(t,n),n)});const S=(e,t)=>111===e.nodeType?1/t<0?t?(({firstChild:e,lastChild:t})=>{const n=document.createRange();return n.setStartAfter(e),n.setEndAfter(t),n.deleteContents(),e})(e):e.lastChild:t?e.valueOf():e.firstChild:e,L=e=>{const{childNodes:t}=e,{length:n}=t;if(n<2)return n?t[0]:e;const r=$.call(t,0);return{ELEMENT_NODE:1,nodeType:111,firstChild:r[0],lastChild:r[n-1],valueOf(){if(t.length!==n){let t=0;for(;t<n;)e.appendChild(r[t++])}return e}}};
7
7
  /*! (c) Andrea Giammarchi - ISC */
8
- var M=function(e){var t="fragment",n="template",r="content"in o(n)?function(e){var t=o(n);return t.innerHTML=e,t.content}:function(e){var r=o(t),a=o(n),i=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var c=RegExp.$1;a.innerHTML="<table>"+e+"</table>",i=a.querySelectorAll(c)}else a.innerHTML=e,i=a.childNodes;return s(r,i),r};return function(e,t){return("svg"===t?a:r)(e)};function s(e,t){for(var n=t.length;n--;)e.appendChild(t[0])}function o(n){return n===t?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",n)}function a(e){var n=o(t),r=o("div");return r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",s(n,r.firstChild.childNodes),n}}(document),j=(e,t,n,r,s)=>{const o=n.length;let a=t.length,i=o,c=0,l=0,u=null;for(;c<a||l<i;)if(a===c){const t=i<o?l?r(n[l-1],-0).nextSibling:r(n[i-l],0):s;for(;l<i;)e.insertBefore(r(n[l++],1),t)}else if(i===l)for(;c<a;)u&&u.has(t[c])||e.removeChild(r(t[c],-1)),c++;else if(t[c]===n[l])c++,l++;else if(t[a-1]===n[i-1])a--,i--;else if(t[c]===n[i-1]&&n[l]===t[a-1]){const s=r(t[--a],-1).nextSibling;e.insertBefore(r(n[l++],1),r(t[c++],-1).nextSibling),e.insertBefore(r(n[--i],1),s),t[a]=n[i]}else{if(!u){u=new Map;let e=l;for(;e<i;)u.set(n[e],e++)}if(u.has(t[c])){const s=u.get(t[c]);if(l<s&&s<i){let o=c,h=1;for(;++o<a&&o<i&&u.get(t[o])===s+h;)h++;if(h>s-l){const o=r(t[c],0);for(;l<s;)e.insertBefore(r(n[l++],1),o)}else e.replaceChild(r(n[l++],1),r(t[c++],-1))}else c++}else e.removeChild(r(t[c++],-1))}return n},O=function(e,t,n,r,s){var o=s in e,a=e.createDocumentFragment();return a.appendChild(e.createTextNode("g")),a.appendChild(e.createTextNode("")),(o?e.importNode(a,!0):a.cloneNode(!0)).childNodes.length<2?function e(t,n){for(var r=t.cloneNode(),s=t.childNodes||[],o=s.length,a=0;n&&a<o;a++)r.appendChild(e(s[a],n));return r}:o?e.importNode:function(e,t){return e.cloneNode(!!t)}}(document,0,0,0,"importNode"),T="".trim||function(){return String(this).replace(/^\s+|\s+/g,"")},R=l?function(e,t){var n=t.join(" ");return t.slice.call(e,0).sort((function(e,t){return n.indexOf(e.name)<=n.indexOf(t.name)?-1:1}))}:function(e,t){return t.slice.call(e,0)};function W(e,t){for(var n=t.length,r=0;r<n;)e=e.childNodes[t[r++]];return e}function P(e,t,n,r){for(var s=e.childNodes,o=s.length,a=0;a<o;){var i=s[a];switch(i.nodeType){case 1:var l=r.concat(a);Z(i,t,n,l),P(i,t,n,l);break;case 8:var f=i.textContent;if(f===c)n.shift(),t.push(h.test(e.nodeName)?D(e,r):z(i,r.concat(a)));else switch(f.slice(0,2)){case"/*":if("*/"!==f.slice(-2))break;case"👻":e.removeChild(i),a--,o--}break;case 3:h.test(e.nodeName)&&T.call(i.textContent)===u&&(n.shift(),t.push(D(e,r)))}a++}}function Z(e,t,n,r){for(var s=e.attributes,o=[],a=[],i=R(s,n),h=i.length,f=0;f<h;){var p,d=i[f++],m=d.value===c;if(m||1<(p=d.value.split(u)).length){var g=d.name;if(o.indexOf(g)<0){o.push(g);var v=n.shift().replace(m?/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*('|")?$/:new RegExp("^(?:|[\\S\\s]*?\\s)("+g+")\\s*=\\s*('|\")[\\S\\s]*","i"),"$1"),b=s[v]||s[v.toLowerCase()];if(m)t.push(B(b,r,v,null));else{for(var y=p.length-2;y--;)n.shift();t.push(B(b,r,v,p))}}a.push(d)}}f=0;for(var w=(0<(h=a.length)&&l&&!("ownerSVGElement"in e));f<h;){var E=a[f++];w&&(E.value=""),e.removeAttribute(E.name)}var x=e.nodeName;if(/^script$/i.test(x)){var N=document.createElement(x);for(h=s.length,f=0;f<h;)N.setAttributeNode(s[f++].cloneNode(!0));N.textContent=e.textContent,e.parentNode.replaceChild(N,e)}}function z(e,t){return{type:"any",node:e,path:t}}function B(e,t,n,r){return{type:"attr",node:e,path:t,name:n,sparse:r}}function D(e,t){return{type:"text",node:e,path:t}}var F=S(new t);function H(e,t){var n=(e.convert||p)(t),r=e.transform;r&&(n=r(n));var s=M(n,e.type);q(s);var o=[];return P(s,o,t.slice(0),[]),{content:s,updates:function(n){for(var r=[],s=o.length,a=0,i=0;a<s;){var c=o[a++],l=W(n,c.path);switch(c.type){case"any":r.push({fn:e.any(l,[]),sparse:!1});break;case"attr":var u=c.sparse,h=e.attribute(l,c.name,c.node);null===u?r.push({fn:h,sparse:!1}):(i+=u.length-2,r.push({fn:h,sparse:!0,values:u}));break;case"text":r.push({fn:e.text(l),sparse:!1}),l.textContent=""}}return s+=i,function(){var e=arguments.length;if(s!==e-1)throw new Error(e-1+" values instead of "+s+"\n"+t.join("${value}"));for(var o=1,a=1;o<e;){var i=r[o-a];if(i.sparse){var c=i.values,l=c[0],u=1,h=c.length;for(a+=h-2;u<h;)l+=arguments[o++]+c[u++];i.fn(l)}else i.fn(arguments[o++])}return n}}}}function V(e,t){var n=F.get(t)||F.set(t,H(e,t));return n.updates(O.call(document,n.content,!0))}var U=[];function q(e){for(var t=e.childNodes,n=t.length;n--;){var r=t[n];1!==r.nodeType&&0===T.call(r.textContent).length&&e.removeChild(r)}}
9
- /*! (c) Andrea Giammarchi - ISC */var I=function(){var e=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,t=/([^A-Z])([A-Z]+)/g;return function(e,t){return"ownerSVGElement"in e?function(e,t){var n;t?n=t.cloneNode(!0):(e.setAttribute("style","--hyper:style;"),n=e.getAttributeNode("style"));return n.value="",e.setAttributeNode(n),r(n,!0)}(e,t):r(e.style,!1)};function n(e,t,n){return t+"-"+n.toLowerCase()}function r(r,s){var o,a;return function(i){var c,l,u,h;switch(typeof i){case"object":if(i){if("object"===o){if(!s&&a!==i)for(l in a)l in i||(r[l]="")}else s?r.value="":r.cssText="";for(l in c=s?{}:r,i)u="number"!=typeof(h=i[l])||e.test(l)?h:h+"px",!s&&/^--/.test(l)?c.setProperty(l,u):c[l]=u;o="object",s?r.value=function(e){var r,s=[];for(r in e)s.push(r.replace(t,n),":",e[r],";");return s.join("")}(a=c):a=i;break}default:a!=i&&(o="string",a=i,s?r.value=i||"":r.cssText=i||"")}}}}();const G=(e,t)=>{let n,r=!0;const s=document.createAttributeNS(null,t);return t=>{n!==t&&(n=t,null==n?r||(e.removeAttributeNode(s),r=!0):(s.value=t,r&&(e.setAttributeNodeNS(s),r=!1)))}},J=({dataset:e})=>t=>{for(const n in t){const r=t[n];null==r?delete e[n]:e[n]=r}},K=(e,t)=>"dataset"===t?J(e):n=>{e[t]=n},Q=/^(?:form|list)$/i,X=(e,t)=>e.ownerDocument.createTextNode(t);function Y(e){return this.type=e,function(e){var t=U,n=q;return function(r){return t!==r&&(n=V(e,t=r)),n.apply(null,arguments)}}(this)}function ee(e){return e(this)}Y.prototype={attribute(e,t,n){const r="svg"===this.type;switch(t){case"class":if(r)return G(e,t);t="className";case"props":return K(e,t);case"aria":return(e=>t=>{for(const n in t){const r="role"===n?n:`aria-${n}`,s=t[n];null==s?e.removeAttribute(r):e.setAttribute(r,s)}})(e);case"style":return I(e,n,r);case"ref":return(e=>t=>{"function"==typeof t?t(e):t.current=e})(e);case".dataset":return J(e);default:return"."===t.slice(0,1)?K(e,t.slice(1)):"?"===t.slice(0,1)?((e,t,n)=>r=>{n!==!!r&&((n=!!r)?e.setAttribute(t,""):e.removeAttribute(t))})(e,t.slice(1)):"on"===t.slice(0,2)?((e,t)=>{let n,r=t.slice(2);return!(t in e)&&t.toLowerCase()in e&&(r=r.toLowerCase()),t=>{const s=k(t)?t:[t,!1];n!==s[0]&&(n&&e.removeEventListener(r,n,s[1]),(n=s[0])&&e.addEventListener(r,n,s[1]))}})(e,t):!(t in e)||r||Q.test(t)?G(e,t):((e,t)=>{let n;return r=>{n!==r&&(n=r,e[t]!==r&&(null==r?(e[t]="",e.removeAttribute(t)):e[t]=r))}})(e,t)}},any(e,t){const{type:n}=this;let r,s=!1;const o=a=>{switch(typeof a){case"string":case"number":case"boolean":s?r!==a&&(r=a,t[0].textContent=a):(s=!0,r=a,t=j(e.parentNode,t,[X(e,a)],_,e));break;case"function":o(a(e));break;case"object":case"undefined":if(null==a){s=!1,t=j(e.parentNode,t,[],_,e);break}default:if(s=!1,r=a,k(a))if(0===a.length)t.length&&(t=j(e.parentNode,t,[],_,e));else switch(typeof a[0]){case"string":case"number":case"boolean":o(String(a));break;case"function":o(a.map(ee,e));break;case"object":k(a[0])&&(a=a.concat.apply([],a));default:t=j(e.parentNode,t,a,_,e)}else"ELEMENT_NODE"in a?t=j(e.parentNode,t,11===a.nodeType?$.call(a.childNodes):[a],_,e):"text"in a?o(String(a.text)):"any"in a?o(a.any):"html"in a?t=j(e.parentNode,t,$.call(M([].concat(a.html).join(""),n).childNodes),_,e):"length"in a&&o($.call(a))}};return o},text(e){let t;const n=r=>{if(t!==r){t=r;const s=typeof r;"object"===s&&r?"text"in r?n(String(r.text)):"any"in r?n(r.any):"html"in r?n([].concat(r.html).join("")):"length"in r&&n($.call(r).join("")):"function"===s?n(r(e)):e.textContent=null==r?"":r}};return n}};const{create:te,freeze:ne,keys:re}=Object,se=Y.prototype,oe=S(new t),ae=e=>({html:ce("html",e),svg:ce("svg",e),render(t,n){const r="function"==typeof n?n():n,s=oe.get(t)||oe.set(t,ie()),o=r instanceof he?le(e,s,r):r;return o!==s.wire&&(s.wire=o,t.textContent="",t.appendChild(o.valueOf())),t}}),ie=()=>({stack:[],entry:null,wire:null}),ce=(e,n)=>{const r=S(new t);return s.for=(e,t)=>{const o=r.get(e)||r.set(e,te(null));return o[t]||(o[t]=(e=>function(){return le(n,e,s.apply(null,arguments))})(ie()))},s.node=function(){return le(n,ie(),s.apply(null,arguments)).valueOf()},s;function s(){return new he(e,pe.apply(null,arguments))}},le=(e,t,{type:n,template:r,values:s})=>{const{length:o}=s;ue(e,t,s,o);let{entry:a}=t;if(a&&a.template===r&&a.type===n)a.tag(r,...s);else{const o=new e(n);t.entry=a={type:n,template:r,tag:o,wire:L(o(r,...s))}}return a.wire},ue=(e,{stack:t},n,r)=>{for(let s=0;s<r;s++){const r=n[s];r instanceof fe?n[s]=le(e,t[s]||(t[s]=ie()),r):k(r)?ue(e,t[s]||(t[s]=ie()),r,r.length):t[s]=null}r<t.length&&t.splice(r)};function he(e,t){this.type=e,this.template=t.shift(),this.values=t}ne(he);const fe=he;function pe(){let e=[],t=0,{length:n}=arguments;for(;t<n;)e.push(arguments[t++]);return e}ae(Y);var de="function"==typeof cancelAnimationFrame,me=de?cancelAnimationFrame:clearTimeout,ge=de?requestAnimationFrame:setTimeout;function ve(e){var t,n,r,s,o;return i(),function(e,i,l){return r=e,s=i,o=l,n||(n=ge(a)),--t<0&&c(!0),c};function a(){i(),r.apply(s,o||[])}function i(){t=e||1/0,n=de?0:null}function c(e){var t=!!n;return t&&(me(n),e&&a()),t}}
10
- /*! (c) Andrea Giammarchi - ISC */let be=null;const ye=S(new WeakMap),we=(e,t,n)=>{e.apply(t,n)},Ee={async:!1,always:!1},xe=(e,t)=>"function"==typeof t?t(e):t,Ne=(e,t,n,r)=>{const s=be.i++,{hook:o,args:a,stack:i,length:c}=be;s===c&&(be.length=i.push({}));const l=i[s];if(l.args=a,s===c){const s="function"==typeof n,{async:a,always:i}=(s?r:n)||r||Ee;l.$=s?n(t):xe(void 0,t),l._=a?ye.get(o)||ye.set(o,ve()):we,l.f=t=>{const n=e(l.$,t);(i||l.$!==n)&&(l.$=n,l._(o,null,l.args))}}return[l.$,l.f]},Ce=new WeakMap;function ke({hook:e}){return e===this.hook}const Ae=new WeakMap,$e=S(Ae),Se=()=>{},_e=e=>(t,n)=>{const r=be.i++,{hook:s,after:o,stack:a,length:i}=be;if(r<i){const s=a[r],{update:i,values:c,stop:l}=s;if(!n||n.some(Te,c)){s.values=n,e&&l(e);const{clean:r}=s;r&&(s.clean=null,r());const a=()=>{s.clean=t()};e?i(a):o.push(a)}}else{const r=e?ve():Se,i={clean:null,update:r,values:n,stop:Se};be.length=a.push(i),($e.get(s)||$e.set(s,[])).push(i);const c=()=>{i.clean=t()};e?i.stop=r(c):o.push(c)}},Le=e=>{(Ae.get(e)||[]).forEach((e=>{const{clean:t,stop:n}=e;n(),t&&(e.clean=null,t())}))};Ae.has.bind(Ae);const Me=_e(!0),je=_e(!1),Oe=(e,t)=>{const n=be.i++,{stack:r,length:s}=be;return n===s?be.length=r.push({$:e(),_:t}):t&&!t.some(Te,r[n]._)||(r[n]={$:e(),_:t}),r[n].$};function Te(e,t){return e!==this[t]}let Re=null;try{Re=new{o(){}}.o}catch(Ot){}let We=e=>class extends e{};if(Re){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:n}="object"==typeof Reflect?Reflect:{construct(e,n,r){const s=[null];for(let e=0;e<n.length;e++)s.push(n[e]);const o=e.bind.apply(e,s);return t(new o,r.prototype)}};We=function(r,s){function o(){return n(s?e(r):r,arguments,o)}return t(o.prototype,r.prototype),t(o,r)}}const Pe={map:{},re:null},Ze=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let ze=null;const Be=(e,t)=>{const{map:n,re:r}=ze||t;return e.replace(r,((e,t,r,s)=>{const{tagName:o,is:a,element:i}=n[r];return i?t?`</${a}>`:`<${a}${s}`:t?`</${o}>`:`<${o} is="${a}"${s}`}))},De=({tagName:e,is:t,element:n})=>n?t:`${e}[is="${t}"]`,Fe=()=>ze,He=e=>{ze=e},Ve={useCallback:(e,t)=>Oe((()=>e),t),useContext:e=>{const{hook:t,args:n}=be,r=Ce.get(e),s={hook:t,args:n};return r.some(ke,s)||r.push(s),e.value},useEffect:Me,useLayoutEffect:je,useMemo:Oe,useReducer:Ne,useRef:e=>{const t=be.i++,{stack:n,length:r}=be;return t===r&&(be.length=n.push({current:e})),n[t]},useState:(e,t)=>Ne(xe,e,void 0,t)},{render:Ue,html:qe,svg:Ie}=(e=>{const t=te(se);return re(e).forEach((n=>{t[n]=e[n](t[n]||("convert"===n?p:String))})),n.prototype=t,ae(n);function n(){return Y.apply(this,arguments)}})({transform:()=>e=>Be(e,Pe)}),{defineProperties:Ge}=Object,Je=new t,Ke=new t,Qe=new t,Xe=new i,Ye="attributeChangedCallback",et="connectedCallback",tt=`dis${et}`,nt=(e,t,n)=>{if(n in e){const r=e[n];t[n]={configurable:true,value(){return dt.call(this),r.apply(this,arguments)}}}else t[n]={configurable:true,value:dt}},rt=e=>{const{prototype:n}=e,r=[],s={html:{configurable:true,get:ht},svg:{configurable:true,get:ft}};if(s["_🔥"]={value:{events:r,info:null}},"handleEvent"in n||(s.handleEvent={configurable:true,value:pt}),"render"in n&&n.render.length){const{oninit:e}=n;Ge(n,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function n(){const r=be,s=[];be={hook:n,args:arguments,stack:t,i:0,length:t.length,after:s};try{return e.apply(null,arguments)}finally{be=r;for(let e=0,{length:t}=s;e<t;e++)s[e]()}}})(this.render.bind(this,Ve));Ge(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Le.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in n&&(r.push("init"),nt(n,s,"render")),nt(n,s,Ye),nt(n,s,et),nt(n,s,tt),[[Ye,"onattributechanged",mt],[et,"onconnected",gt],[tt,"ondisconnected",bt],[et,"render",vt]].forEach((([e,t,o])=>{if(!(e in n)&&t in n)if("render"!==t&&r.push(t.slice(2)),e in s){const t=s[e].value;s[e]={configurable:true,value(){return t.apply(this,arguments),o.apply(this,arguments)}}}else s[e]={configurable:true,value:o}}));const o=e.booleanAttributes||[];o.forEach((e=>{e in n||(s[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const a=e.observedAttributes||[];a.forEach((e=>{e in n||(s[e]={configurable:true,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const o=new t,a="on"+e in n;a&&r.push(e),s[e]={configurable:true,get(){return o.get(this)},set(t){if(o.set(this,t),a){const n=st(e);if(n.detail=t,Xe.has(this))this.dispatchEvent(n);else{const e=Qe.get(this);e?e.push(n):Qe.set(this,[n])}}}}})),Ge(n,s);const i=o.concat(a);return i.length?Ge(e,{observedAttributes:{configurable:true,get:()=>i}}):e},st=e=>new r(e),ot=(...e)=>new fe("html",e);ot.for=qe.for;const at=(...e)=>new fe("svg",e);at.for=Ie.for;const it=(e,n,r)=>{const s=ct(e,n,new t);return r.set(e,s),s},ct=(e,t,n)=>(r,...s)=>{const o=n.get(r)||((e,t,{info:n})=>{const r=n?Be(t.join("_🔥"),n).split("_🔥"):t;return e.set(t,r),r})(n,r,e["_🔥"]);return Ue(e,(()=>t(o,...s)))};function lt(e){this.addEventListener(e,this)}function ut(e){this.dispatchEvent(e)}function ht(){return Je.get(this)||it(this,ot,Je)}function ft(){return Ke.get(this)||it(this,at,Ke)}function pt(e){this[`on${e.type}`](e)}function dt(){if(!Xe.has(this)){Xe.add(this),this["_🔥"].events.forEach(lt,this),this.dispatchEvent(st("init"));const e=Qe.get(this);e&&(Qe.delete(this),e.forEach(ut,this))}}function mt(e,t,n){const r=st("attributechanged");r.attributeName=e,r.oldValue=t,r.newValue=n,this.dispatchEvent(r)}function gt(){this.dispatchEvent(st("connected"))}function vt(){this.render()}function bt(){this.dispatchEvent(st("disconnected"))}const{create:yt,defineProperty:wt,defineProperties:Et,getOwnPropertyNames:xt,getOwnPropertySymbols:Nt,getOwnPropertyDescriptor:Ct,keys:kt}=Object,At={element:HTMLElement},$t=new t;new t;const St=new t;new t;const _t=e=>{const t=yt(null),n=yt(null),r={prototype:n,statics:t};return xt(e).concat(Nt(e)).forEach((r=>{const s=Ct(e,r);switch(s.enumerable=!1,r){case"extends":r="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[r]=s;break;default:n[r]=s}})),r},Lt=(e,t,n)=>{if(!/^([A-Z][A-Za-z0-9_]*)(<([A-Za-z0-9:._-]+)>|:([A-Za-z0-9:._-]+))?$/.test(e))throw"Invalid name";const{$1:r,$3:s,$4:o}=RegExp;let a=s||o||t.tagName||t.extends||"element";const i="fragment"===a;if(i)a="element";else if(!/^[A-Za-z0-9:._-]+$/.test(a))throw"Invalid tag";let c="",l="";a.indexOf("-")<0?(c=r.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+n,c.indexOf("-")<0&&(l="-heresy")):(c=a+n,a="element");const u=c+l;if(customElements.get(u))throw`Duplicated ${u} definition`;const h=We("object"==typeof t?St.get(t)||((e,t)=>{const{statics:n,prototype:r}=_t(e),s=We(At[t]||(At[t]=document.createElement(t).constructor),!1);return Et(s.prototype,r),Et(s,n),St.set(e,rt(s)),s})(t,a):$t.get(t)||(e=>{const t=We(e,!1);return $t.set(e,rt(t)),t})(t),!0),f="element"===a;if(wt(h,"new",{value:f?()=>document.createElement(u):()=>document.createElement(a,{is:u})}),wt(h.prototype,"is",{value:u}),""===n){const e=(e=>{const{length:t}=e;let n=0,r=0;for(;r<t;)n=(n<<5)-n+e.charCodeAt(r++),n&=n;return n.toString(36)})(c.toUpperCase());Pe.map[r]=Mt(h,a,u,{id:e,i:0}),Pe.re=Ze(kt(Pe.map))}if(i){const{render:e}=h.prototype;wt(h.prototype,"render",{configurable:!0,value(){if(e&&e.apply(this,arguments),this.parentNode){const{firstChild:e}=this;let t=null;if(e){const n=document.createRange();n.setStartBefore(e),n.setEndAfter(this.lastChild),t=n.extractContents(),this.parentNode.replaceChild(t,this)}}}})}const p=[u,h];return f||p.push({extends:a}),customElements.define(...p),{Class:h,is:u,name:r,tagName:a}},Mt=(e,t,n,r)=>{const{prototype:s}=e,o=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,n),a=[De(o)],i=e.includes||e.contains;if(i){const e={};kt(i).forEach((t=>{const n=`-${r.id}-${r.i++}`,{Class:s,is:o,name:c,tagName:l}=Lt(t,i[t],n);a.push(De(e[c]=Mt(s,l,o,r)))}));const t=Ze(kt(e)),{events:n}=s["_🔥"],o={events:n,info:{map:e,re:t}};if(wt(s,"_🔥",{value:o}),"render"in s){const{render:e}=s,{info:t}=o;wt(s,"render",{configurable:!0,value(){const n=Fe();He(t);const r=e.apply(this,arguments);return He(n),r}})}}return"style"in e&&(e=>{if((e||"").length){const t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e));const n=document.head||document.querySelector("head");n.insertBefore(t,n.lastChild)}})(e.style(...a)),o},jt=["audio","background","chat","people","embed","emptyRoomInvitation","help","leaveButton","precallReview","screenshare","video","floatSelf","recording","logo","locking","participantCount","settingsButton","pipButton","moreButton","personality","subgridLabels","lowData"];var Ot,Tt;Ot="WherebyEmbed",Tt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this)},ondisconnected(){window.removeEventListener("message",this)},observedAttributes:["displayName","minimal","room","subdomain","groups","lang","metadata",...jt].map((e=>e.toLowerCase())),onattributechanged({attributeName:e,oldValue:t}){["room","subdomain"].includes(e)&&null==t||this.render()},style:e=>`\n ${e} {\n display: block;\n }\n ${e} iframe {\n border: none;\n height: 100%;\n width: 100%;\n }\n `,toggleCamera(e){if(this.iframe.current){const t=new URL(this.room,`https://${this.subdomain}.whereby.com`);this.iframe.current.contentWindow.postMessage({command:"toggle_camera",args:[e]},t.origin)}},toggleMicrophone(e){if(this.iframe.current){const t=new URL(this.room,`https://${this.subdomain}.whereby.com`);this.iframe.current.contentWindow.postMessage({command:"toggle_microphone",args:[e]},t.origin)}},onmessage({origin:e,data:t}){if(e!==new URL(this.room,`https://${this.subdomain}.whereby.com`).origin)return;const{type:n,payload:r}=t;this.dispatchEvent(new CustomEvent(n,{detail:r}))},render(){const{displayname:e,lang:t,metadata:n,minimal:r,room:s}=this;if(!s)return this.html`Whereby: Missing room attr.`;let o=/https:\/\/([^.]+)\.whereby.com\/.+/.exec(s);const a=o&&o[1]||this.subdomain;if(!a)return this.html`Whereby: Missing subdomain attr.`;const i=new URL(s,`https://${a}.whereby.com`);Object.entries({jsApi:!0,we:"0.1.0",iframeSource:a,...e&&{displayName:e},...t&&{lang:t},...n&&{metadata:n},...null!=r&&{embed:r},...jt.reduce(((e,t)=>null!=this[t.toLowerCase()]?{...e,[t]:this[t.toLowerCase()]}:e),{})}).forEach((([e,t])=>{i.searchParams.has(e)||i.searchParams.set(e,t)})),this.html`
8
+ var j=function(e){var t="fragment",n="template",r="content"in o(n)?function(e){var t=o(n);return t.innerHTML=e,t.content}:function(e){var r=o(t),a=o(n),i=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var c=RegExp.$1;a.innerHTML="<table>"+e+"</table>",i=a.querySelectorAll(c)}else a.innerHTML=e,i=a.childNodes;return s(r,i),r};return function(e,t){return("svg"===t?a:r)(e)};function s(e,t){for(var n=t.length;n--;)e.appendChild(t[0])}function o(n){return n===t?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",n)}function a(e){var n=o(t),r=o("div");return r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",s(n,r.firstChild.childNodes),n}}(document),M=(e,t,n,r,s)=>{const o=n.length;let a=t.length,i=o,c=0,l=0,u=null;for(;c<a||l<i;)if(a===c){const t=i<o?l?r(n[l-1],-0).nextSibling:r(n[i-l],0):s;for(;l<i;)e.insertBefore(r(n[l++],1),t)}else if(i===l)for(;c<a;)u&&u.has(t[c])||e.removeChild(r(t[c],-1)),c++;else if(t[c]===n[l])c++,l++;else if(t[a-1]===n[i-1])a--,i--;else if(t[c]===n[i-1]&&n[l]===t[a-1]){const s=r(t[--a],-1).nextSibling;e.insertBefore(r(n[l++],1),r(t[c++],-1).nextSibling),e.insertBefore(r(n[--i],1),s),t[a]=n[i]}else{if(!u){u=new Map;let e=l;for(;e<i;)u.set(n[e],e++)}if(u.has(t[c])){const s=u.get(t[c]);if(l<s&&s<i){let o=c,h=1;for(;++o<a&&o<i&&u.get(t[o])===s+h;)h++;if(h>s-l){const o=r(t[c],0);for(;l<s;)e.insertBefore(r(n[l++],1),o)}else e.replaceChild(r(n[l++],1),r(t[c++],-1))}else c++}else e.removeChild(r(t[c++],-1))}return n},O=function(e,t,n,r,s){var o=s in e,a=e.createDocumentFragment();return a.appendChild(e.createTextNode("g")),a.appendChild(e.createTextNode("")),(o?e.importNode(a,!0):a.cloneNode(!0)).childNodes.length<2?function e(t,n){for(var r=t.cloneNode(),s=t.childNodes||[],o=s.length,a=0;n&&a<o;a++)r.appendChild(e(s[a],n));return r}:o?e.importNode:function(e,t){return e.cloneNode(!!t)}}(document,0,0,0,"importNode"),T="".trim||function(){return String(this).replace(/^\s+|\s+/g,"")},R=l?function(e,t){var n=t.join(" ");return t.slice.call(e,0).sort((function(e,t){return n.indexOf(e.name)<=n.indexOf(t.name)?-1:1}))}:function(e,t){return t.slice.call(e,0)};function W(e,t){for(var n=t.length,r=0;r<n;)e=e.childNodes[t[r++]];return e}function P(e,t,n,r){for(var s=e.childNodes,o=s.length,a=0;a<o;){var i=s[a];switch(i.nodeType){case 1:var l=r.concat(a);Z(i,t,n,l),P(i,t,n,l);break;case 8:var f=i.textContent;if(f===c)n.shift(),t.push(h.test(e.nodeName)?D(e,r):B(i,r.concat(a)));else switch(f.slice(0,2)){case"/*":if("*/"!==f.slice(-2))break;case"👻":e.removeChild(i),a--,o--}break;case 3:h.test(e.nodeName)&&T.call(i.textContent)===u&&(n.shift(),t.push(D(e,r)))}a++}}function Z(e,t,n,r){for(var s=e.attributes,o=[],a=[],i=R(s,n),h=i.length,f=0;f<h;){var p,d=i[f++],m=d.value===c;if(m||1<(p=d.value.split(u)).length){var g=d.name;if(o.indexOf(g)<0){o.push(g);var v=n.shift().replace(m?/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*('|")?$/:new RegExp("^(?:|[\\S\\s]*?\\s)("+g+")\\s*=\\s*('|\")[\\S\\s]*","i"),"$1"),b=s[v]||s[v.toLowerCase()];if(m)t.push(z(b,r,v,null));else{for(var y=p.length-2;y--;)n.shift();t.push(z(b,r,v,p))}}a.push(d)}}f=0;for(var w=(0<(h=a.length)&&l&&!("ownerSVGElement"in e));f<h;){var E=a[f++];w&&(E.value=""),e.removeAttribute(E.name)}var C=e.nodeName;if(/^script$/i.test(C)){var x=document.createElement(C);for(h=s.length,f=0;f<h;)x.setAttributeNode(s[f++].cloneNode(!0));x.textContent=e.textContent,e.parentNode.replaceChild(x,e)}}function B(e,t){return{type:"any",node:e,path:t}}function z(e,t,n,r){return{type:"attr",node:e,path:t,name:n,sparse:r}}function D(e,t){return{type:"text",node:e,path:t}}var U=_(new t);function F(e,t){var n=(e.convert||p)(t),r=e.transform;r&&(n=r(n));var s=j(n,e.type);q(s);var o=[];return P(s,o,t.slice(0),[]),{content:s,updates:function(n){for(var r=[],s=o.length,a=0,i=0;a<s;){var c=o[a++],l=W(n,c.path);switch(c.type){case"any":r.push({fn:e.any(l,[]),sparse:!1});break;case"attr":var u=c.sparse,h=e.attribute(l,c.name,c.node);null===u?r.push({fn:h,sparse:!1}):(i+=u.length-2,r.push({fn:h,sparse:!0,values:u}));break;case"text":r.push({fn:e.text(l),sparse:!1}),l.textContent=""}}return s+=i,function(){var e=arguments.length;if(s!==e-1)throw new Error(e-1+" values instead of "+s+"\n"+t.join("${value}"));for(var o=1,a=1;o<e;){var i=r[o-a];if(i.sparse){var c=i.values,l=c[0],u=1,h=c.length;for(a+=h-2;u<h;)l+=arguments[o++]+c[u++];i.fn(l)}else i.fn(arguments[o++])}return n}}}}function H(e,t){var n=U.get(t)||U.set(t,F(e,t));return n.updates(O.call(document,n.content,!0))}var V=[];function q(e){for(var t=e.childNodes,n=t.length;n--;){var r=t[n];1!==r.nodeType&&0===T.call(r.textContent).length&&e.removeChild(r)}}
9
+ /*! (c) Andrea Giammarchi - ISC */var I=function(){var e=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,t=/([^A-Z])([A-Z]+)/g;return function(e,t){return"ownerSVGElement"in e?function(e,t){var n;t?n=t.cloneNode(!0):(e.setAttribute("style","--hyper:style;"),n=e.getAttributeNode("style"));return n.value="",e.setAttributeNode(n),r(n,!0)}(e,t):r(e.style,!1)};function n(e,t,n){return t+"-"+n.toLowerCase()}function r(r,s){var o,a;return function(i){var c,l,u,h;switch(typeof i){case"object":if(i){if("object"===o){if(!s&&a!==i)for(l in a)l in i||(r[l]="")}else s?r.value="":r.cssText="";for(l in c=s?{}:r,i)u="number"!=typeof(h=i[l])||e.test(l)?h:h+"px",!s&&/^--/.test(l)?c.setProperty(l,u):c[l]=u;o="object",s?r.value=function(e){var r,s=[];for(r in e)s.push(r.replace(t,n),":",e[r],";");return s.join("")}(a=c):a=i;break}default:a!=i&&(o="string",a=i,s?r.value=i||"":r.cssText=i||"")}}}}();const G=(e,t)=>{let n,r=!0;const s=document.createAttributeNS(null,t);return t=>{n!==t&&(n=t,null==n?r||(e.removeAttributeNode(s),r=!0):(s.value=t,r&&(e.setAttributeNodeNS(s),r=!1)))}},J=({dataset:e})=>t=>{for(const n in t){const r=t[n];null==r?delete e[n]:e[n]=r}},K=(e,t)=>"dataset"===t?J(e):n=>{e[t]=n},Q=/^(?:form|list)$/i,X=(e,t)=>e.ownerDocument.createTextNode(t);function Y(e){return this.type=e,function(e){var t=V,n=q;return function(r){return t!==r&&(n=H(e,t=r)),n.apply(null,arguments)}}(this)}function ee(e){return e(this)}Y.prototype={attribute(e,t,n){const r="svg"===this.type;switch(t){case"class":if(r)return G(e,t);t="className";case"props":return K(e,t);case"aria":return(e=>t=>{for(const n in t){const r="role"===n?n:`aria-${n}`,s=t[n];null==s?e.removeAttribute(r):e.setAttribute(r,s)}})(e);case"style":return I(e,n,r);case"ref":return(e=>t=>{"function"==typeof t?t(e):t.current=e})(e);case".dataset":return J(e);default:return"."===t.slice(0,1)?K(e,t.slice(1)):"?"===t.slice(0,1)?((e,t,n)=>r=>{n!==!!r&&((n=!!r)?e.setAttribute(t,""):e.removeAttribute(t))})(e,t.slice(1)):"on"===t.slice(0,2)?((e,t)=>{let n,r=t.slice(2);return!(t in e)&&t.toLowerCase()in e&&(r=r.toLowerCase()),t=>{const s=k(t)?t:[t,!1];n!==s[0]&&(n&&e.removeEventListener(r,n,s[1]),(n=s[0])&&e.addEventListener(r,n,s[1]))}})(e,t):!(t in e)||r||Q.test(t)?G(e,t):((e,t)=>{let n;return r=>{n!==r&&(n=r,e[t]!==r&&(null==r?(e[t]="",e.removeAttribute(t)):e[t]=r))}})(e,t)}},any(e,t){const{type:n}=this;let r,s=!1;const o=a=>{switch(typeof a){case"string":case"number":case"boolean":s?r!==a&&(r=a,t[0].textContent=a):(s=!0,r=a,t=M(e.parentNode,t,[X(e,a)],S,e));break;case"function":o(a(e));break;case"object":case"undefined":if(null==a){s=!1,t=M(e.parentNode,t,[],S,e);break}default:if(s=!1,r=a,k(a))if(0===a.length)t.length&&(t=M(e.parentNode,t,[],S,e));else switch(typeof a[0]){case"string":case"number":case"boolean":o(String(a));break;case"function":o(a.map(ee,e));break;case"object":k(a[0])&&(a=a.concat.apply([],a));default:t=M(e.parentNode,t,a,S,e)}else"ELEMENT_NODE"in a?t=M(e.parentNode,t,11===a.nodeType?$.call(a.childNodes):[a],S,e):"text"in a?o(String(a.text)):"any"in a?o(a.any):"html"in a?t=M(e.parentNode,t,$.call(j([].concat(a.html).join(""),n).childNodes),S,e):"length"in a&&o($.call(a))}};return o},text(e){let t;const n=r=>{if(t!==r){t=r;const s=typeof r;"object"===s&&r?"text"in r?n(String(r.text)):"any"in r?n(r.any):"html"in r?n([].concat(r.html).join("")):"length"in r&&n($.call(r).join("")):"function"===s?n(r(e)):e.textContent=null==r?"":r}};return n}};const{create:te,freeze:ne,keys:re}=Object,se=Y.prototype,oe=_(new t),ae=e=>({html:ce("html",e),svg:ce("svg",e),render(t,n){const r="function"==typeof n?n():n,s=oe.get(t)||oe.set(t,ie()),o=r instanceof he?le(e,s,r):r;return o!==s.wire&&(s.wire=o,t.textContent="",t.appendChild(o.valueOf())),t}}),ie=()=>({stack:[],entry:null,wire:null}),ce=(e,n)=>{const r=_(new t);return s.for=(e,t)=>{const o=r.get(e)||r.set(e,te(null));return o[t]||(o[t]=(e=>function(){return le(n,e,s.apply(null,arguments))})(ie()))},s.node=function(){return le(n,ie(),s.apply(null,arguments)).valueOf()},s;function s(){return new he(e,pe.apply(null,arguments))}},le=(e,t,{type:n,template:r,values:s})=>{const{length:o}=s;ue(e,t,s,o);let{entry:a}=t;if(a&&a.template===r&&a.type===n)a.tag(r,...s);else{const o=new e(n);t.entry=a={type:n,template:r,tag:o,wire:L(o(r,...s))}}return a.wire},ue=(e,{stack:t},n,r)=>{for(let s=0;s<r;s++){const r=n[s];r instanceof fe?n[s]=le(e,t[s]||(t[s]=ie()),r):k(r)?ue(e,t[s]||(t[s]=ie()),r,r.length):t[s]=null}r<t.length&&t.splice(r)};function he(e,t){this.type=e,this.template=t.shift(),this.values=t}ne(he);const fe=he;function pe(){let e=[],t=0,{length:n}=arguments;for(;t<n;)e.push(arguments[t++]);return e}ae(Y);var de="function"==typeof cancelAnimationFrame,me=de?cancelAnimationFrame:clearTimeout,ge=de?requestAnimationFrame:setTimeout;function ve(e){var t,n,r,s,o;return i(),function(e,i,l){return r=e,s=i,o=l,n||(n=ge(a)),--t<0&&c(!0),c};function a(){i(),r.apply(s,o||[])}function i(){t=e||1/0,n=de?0:null}function c(e){var t=!!n;return t&&(me(n),e&&a()),t}}
10
+ /*! (c) Andrea Giammarchi - ISC */let be=null;const ye=_(new WeakMap),we=(e,t,n)=>{e.apply(t,n)},Ee={async:!1,always:!1},Ce=(e,t)=>"function"==typeof t?t(e):t,xe=(e,t,n,r)=>{const s=be.i++,{hook:o,args:a,stack:i,length:c}=be;s===c&&(be.length=i.push({}));const l=i[s];if(l.args=a,s===c){const s="function"==typeof n,{async:a,always:i}=(s?r:n)||r||Ee;l.$=s?n(t):Ce(void 0,t),l._=a?ye.get(o)||ye.set(o,ve()):we,l.f=t=>{const n=e(l.$,t);(i||l.$!==n)&&(l.$=n,l._(o,null,l.args))}}return[l.$,l.f]},Ne=new WeakMap;function ke({hook:e}){return e===this.hook}const Ae=new WeakMap,$e=_(Ae),_e=()=>{},Se=e=>(t,n)=>{const r=be.i++,{hook:s,after:o,stack:a,length:i}=be;if(r<i){const s=a[r],{update:i,values:c,stop:l}=s;if(!n||n.some(Te,c)){s.values=n,e&&l(e);const{clean:r}=s;r&&(s.clean=null,r());const a=()=>{s.clean=t()};e?i(a):o.push(a)}}else{const r=e?ve():_e,i={clean:null,update:r,values:n,stop:_e};be.length=a.push(i),($e.get(s)||$e.set(s,[])).push(i);const c=()=>{i.clean=t()};e?i.stop=r(c):o.push(c)}},Le=e=>{(Ae.get(e)||[]).forEach((e=>{const{clean:t,stop:n}=e;n(),t&&(e.clean=null,t())}))};Ae.has.bind(Ae);const je=Se(!0),Me=Se(!1),Oe=(e,t)=>{const n=be.i++,{stack:r,length:s}=be;return n===s?be.length=r.push({$:e(),_:t}):t&&!t.some(Te,r[n]._)||(r[n]={$:e(),_:t}),r[n].$};function Te(e,t){return e!==this[t]}let Re=null;try{Re=new{o(){}}.o}catch(Ot){}let We=e=>class extends e{};if(Re){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:n}="object"==typeof Reflect?Reflect:{construct(e,n,r){const s=[null];for(let e=0;e<n.length;e++)s.push(n[e]);const o=e.bind.apply(e,s);return t(new o,r.prototype)}};We=function(r,s){function o(){return n(s?e(r):r,arguments,o)}return t(o.prototype,r.prototype),t(o,r)}}const Pe={map:{},re:null},Ze=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let Be=null;const ze=(e,t)=>{const{map:n,re:r}=Be||t;return e.replace(r,((e,t,r,s)=>{const{tagName:o,is:a,element:i}=n[r];return i?t?`</${a}>`:`<${a}${s}`:t?`</${o}>`:`<${o} is="${a}"${s}`}))},De=({tagName:e,is:t,element:n})=>n?t:`${e}[is="${t}"]`,Ue=()=>Be,Fe=e=>{Be=e},He={useCallback:(e,t)=>Oe((()=>e),t),useContext:e=>{const{hook:t,args:n}=be,r=Ne.get(e),s={hook:t,args:n};return r.some(ke,s)||r.push(s),e.value},useEffect:je,useLayoutEffect:Me,useMemo:Oe,useReducer:xe,useRef:e=>{const t=be.i++,{stack:n,length:r}=be;return t===r&&(be.length=n.push({current:e})),n[t]},useState:(e,t)=>xe(Ce,e,void 0,t)},{render:Ve,html:qe,svg:Ie}=(e=>{const t=te(se);return re(e).forEach((n=>{t[n]=e[n](t[n]||("convert"===n?p:String))})),n.prototype=t,ae(n);function n(){return Y.apply(this,arguments)}})({transform:()=>e=>ze(e,Pe)}),{defineProperties:Ge}=Object,Je=new t,Ke=new t,Qe=new t,Xe=new i,Ye="attributeChangedCallback",et="connectedCallback",tt=`dis${et}`,nt=(e,t,n)=>{if(n in e){const r=e[n];t[n]={configurable:true,value(){return dt.call(this),r.apply(this,arguments)}}}else t[n]={configurable:true,value:dt}},rt=e=>{const{prototype:n}=e,r=[],s={html:{configurable:true,get:ht},svg:{configurable:true,get:ft}};if(s["_🔥"]={value:{events:r,info:null}},"handleEvent"in n||(s.handleEvent={configurable:true,value:pt}),"render"in n&&n.render.length){const{oninit:e}=n;Ge(n,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function n(){const r=be,s=[];be={hook:n,args:arguments,stack:t,i:0,length:t.length,after:s};try{return e.apply(null,arguments)}finally{be=r;for(let e=0,{length:t}=s;e<t;e++)s[e]()}}})(this.render.bind(this,He));Ge(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Le.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in n&&(r.push("init"),nt(n,s,"render")),nt(n,s,Ye),nt(n,s,et),nt(n,s,tt),[[Ye,"onattributechanged",mt],[et,"onconnected",gt],[tt,"ondisconnected",bt],[et,"render",vt]].forEach((([e,t,o])=>{if(!(e in n)&&t in n)if("render"!==t&&r.push(t.slice(2)),e in s){const t=s[e].value;s[e]={configurable:true,value(){return t.apply(this,arguments),o.apply(this,arguments)}}}else s[e]={configurable:true,value:o}}));const o=e.booleanAttributes||[];o.forEach((e=>{e in n||(s[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const a=e.observedAttributes||[];a.forEach((e=>{e in n||(s[e]={configurable:true,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const o=new t,a="on"+e in n;a&&r.push(e),s[e]={configurable:true,get(){return o.get(this)},set(t){if(o.set(this,t),a){const n=st(e);if(n.detail=t,Xe.has(this))this.dispatchEvent(n);else{const e=Qe.get(this);e?e.push(n):Qe.set(this,[n])}}}}})),Ge(n,s);const i=o.concat(a);return i.length?Ge(e,{observedAttributes:{configurable:true,get:()=>i}}):e},st=e=>new r(e),ot=(...e)=>new fe("html",e);ot.for=qe.for;const at=(...e)=>new fe("svg",e);at.for=Ie.for;const it=(e,n,r)=>{const s=ct(e,n,new t);return r.set(e,s),s},ct=(e,t,n)=>(r,...s)=>{const o=n.get(r)||((e,t,{info:n})=>{const r=n?ze(t.join("_🔥"),n).split("_🔥"):t;return e.set(t,r),r})(n,r,e["_🔥"]);return Ve(e,(()=>t(o,...s)))};function lt(e){this.addEventListener(e,this)}function ut(e){this.dispatchEvent(e)}function ht(){return Je.get(this)||it(this,ot,Je)}function ft(){return Ke.get(this)||it(this,at,Ke)}function pt(e){this[`on${e.type}`](e)}function dt(){if(!Xe.has(this)){Xe.add(this),this["_🔥"].events.forEach(lt,this),this.dispatchEvent(st("init"));const e=Qe.get(this);e&&(Qe.delete(this),e.forEach(ut,this))}}function mt(e,t,n){const r=st("attributechanged");r.attributeName=e,r.oldValue=t,r.newValue=n,this.dispatchEvent(r)}function gt(){this.dispatchEvent(st("connected"))}function vt(){this.render()}function bt(){this.dispatchEvent(st("disconnected"))}const{create:yt,defineProperty:wt,defineProperties:Et,getOwnPropertyNames:Ct,getOwnPropertySymbols:xt,getOwnPropertyDescriptor:Nt,keys:kt}=Object,At={element:HTMLElement},$t=new t;new t;const _t=new t;new t;const St=e=>{const t=yt(null),n=yt(null),r={prototype:n,statics:t};return Ct(e).concat(xt(e)).forEach((r=>{const s=Nt(e,r);switch(s.enumerable=!1,r){case"extends":r="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[r]=s;break;default:n[r]=s}})),r},Lt=(e,t,n)=>{if(!/^([A-Z][A-Za-z0-9_]*)(<([A-Za-z0-9:._-]+)>|:([A-Za-z0-9:._-]+))?$/.test(e))throw"Invalid name";const{$1:r,$3:s,$4:o}=RegExp;let a=s||o||t.tagName||t.extends||"element";const i="fragment"===a;if(i)a="element";else if(!/^[A-Za-z0-9:._-]+$/.test(a))throw"Invalid tag";let c="",l="";a.indexOf("-")<0?(c=r.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+n,c.indexOf("-")<0&&(l="-heresy")):(c=a+n,a="element");const u=c+l;if(customElements.get(u))throw`Duplicated ${u} definition`;const h=We("object"==typeof t?_t.get(t)||((e,t)=>{const{statics:n,prototype:r}=St(e),s=We(At[t]||(At[t]=document.createElement(t).constructor),!1);return Et(s.prototype,r),Et(s,n),_t.set(e,rt(s)),s})(t,a):$t.get(t)||(e=>{const t=We(e,!1);return $t.set(e,rt(t)),t})(t),!0),f="element"===a;if(wt(h,"new",{value:f?()=>document.createElement(u):()=>document.createElement(a,{is:u})}),wt(h.prototype,"is",{value:u}),""===n){const e=(e=>{const{length:t}=e;let n=0,r=0;for(;r<t;)n=(n<<5)-n+e.charCodeAt(r++),n&=n;return n.toString(36)})(c.toUpperCase());Pe.map[r]=jt(h,a,u,{id:e,i:0}),Pe.re=Ze(kt(Pe.map))}if(i){const{render:e}=h.prototype;wt(h.prototype,"render",{configurable:!0,value(){if(e&&e.apply(this,arguments),this.parentNode){const{firstChild:e}=this;let t=null;if(e){const n=document.createRange();n.setStartBefore(e),n.setEndAfter(this.lastChild),t=n.extractContents(),this.parentNode.replaceChild(t,this)}}}})}const p=[u,h];return f||p.push({extends:a}),customElements.define(...p),{Class:h,is:u,name:r,tagName:a}},jt=(e,t,n,r)=>{const{prototype:s}=e,o=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,n),a=[De(o)],i=e.includes||e.contains;if(i){const e={};kt(i).forEach((t=>{const n=`-${r.id}-${r.i++}`,{Class:s,is:o,name:c,tagName:l}=Lt(t,i[t],n);a.push(De(e[c]=jt(s,l,o,r)))}));const t=Ze(kt(e)),{events:n}=s["_🔥"],o={events:n,info:{map:e,re:t}};if(wt(s,"_🔥",{value:o}),"render"in s){const{render:e}=s,{info:t}=o;wt(s,"render",{configurable:!0,value(){const n=Ue();Fe(t);const r=e.apply(this,arguments);return Fe(n),r}})}}return"style"in e&&(e=>{if((e||"").length){const t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e));const n=document.head||document.querySelector("head");n.insertBefore(t,n.lastChild)}})(e.style(...a)),o},Mt=["audio","background","chat","people","embed","emptyRoomInvitation","help","leaveButton","precallReview","screenshare","video","floatSelf","recording","logo","locking","participantCount","settingsButton","pipButton","moreButton","personality","subgridLabels","lowData","breakout"];var Ot,Tt;Ot="WherebyEmbed",Tt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this)},ondisconnected(){window.removeEventListener("message",this)},observedAttributes:["displayName","minimal","room","subdomain","lang","metadata","groups","virtualBackgroundUrl","avatarUrl",...Mt].map((e=>e.toLowerCase())),onattributechanged({attributeName:e,oldValue:t}){["room","subdomain"].includes(e)&&null==t||this.render()},style:e=>`\n ${e} {\n display: block;\n }\n ${e} iframe {\n border: none;\n height: 100%;\n width: 100%;\n }\n `,_postCommand(e,t=[]){if(this.iframe.current){const n=new URL(this.room,`https://${this.subdomain}.whereby.com`);this.iframe.current.contentWindow.postMessage({command:e,args:t},n.origin)}},startRecording(){this._postCommand("start_recording")},stopRecording(){this._postCommand("stop_recording")},toggleCamera(e){this._postCommand("toggle_camera",[e])},toggleMicrophone(e){this._postCommand("toggle_microphone",[e])},onmessage({origin:e,data:t}){if(e!==new URL(this.room,`https://${this.subdomain}.whereby.com`).origin)return;const{type:n,payload:r}=t;this.dispatchEvent(new CustomEvent(n,{detail:r}))},render(){const{avatarurl:e,displayname:t,lang:n,metadata:r,minimal:s,room:o,groups:a,virtualbackgroundurl:i}=this;if(!o)return this.html`Whereby: Missing room attr.`;let c=/https:\/\/([^.]+)\.whereby.com\/.+/.exec(o);const l=c&&c[1]||this.subdomain;if(!l)return this.html`Whereby: Missing subdomain attr.`;const u=new URL(o,`https://${l}.whereby.com`);Object.entries({jsApi:!0,we:"1.6.0",iframeSource:l,...t&&{displayName:t},...n&&{lang:n},...r&&{metadata:r},...a&&{groups:a},...i&&{virtualBackgroundUrl:i},...e&&{avatarUrl:e},...null!=s&&{embed:s},...Mt.reduce(((e,t)=>null!=this[t.toLowerCase()]?{...e,[t]:this[t.toLowerCase()]}:e),{})}).forEach((([e,t])=>{u.searchParams.has(e)||u.searchParams.set(e,t)})),this.html`
11
11
  <iframe
12
12
  ref=${this.iframe}
13
- src=${i}
13
+ src=${u}
14
14
  allow="autoplay; camera; microphone; fullscreen; speaker; display-capture" />
15
- `}},("string"==typeof Ot?Lt(Ot,Tt,""):Lt(Ot.name,Ot,"")).Class;var Rt={sdkVersion:"0.1.0"};export{Rt as default};
15
+ `}},("string"==typeof Ot?Lt(Ot,Tt,""):Lt(Ot.name,Ot,"")).Class;var Rt={sdkVersion:"1.6.0"};export{Rt as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whereby.com/browser-sdk",
3
- "version": "0.1.0",
3
+ "version": "1.6.0",
4
4
  "description": "Configurable web component for embedding Whereby video rooms in web applications",
5
5
  "author": "Whereby AS",
6
6
  "license": "MIT",
@@ -1,27 +1,11 @@
1
1
  import { html } from "lit-html";
2
2
  import "./lib";
3
3
 
4
- /**
5
-
6
-
7
-
8
-
9
- "embed",
10
-
11
- "locking",
12
- "participantCount",
13
- "settingsButton",
14
- "pipButton",
15
- "moreButton",
16
- "personality",
17
- "subgridLabels",
18
- "topToolbar",
19
- */
20
-
21
4
  export default {
22
5
  title: "Examples/<whereby-embed>",
23
6
  argTypes: {
24
7
  audio: { control: "boolean" },
8
+ avatarUrl: { control: "text", description: "Image url to use for avatar" },
25
9
  background: { control: "boolean" },
26
10
  chat: { control: "boolean" },
27
11
  displayName: { control: "text", description: "The name to use for the local participant" },
@@ -39,6 +23,7 @@ export default {
39
23
  screenshare: { control: "boolean" },
40
24
  topToolbar: { control: "boolean" },
41
25
  video: { control: "boolean" },
26
+ virtualBackgroundUrl: { control: "text", description: "Image url to use for virtual background" },
42
27
  },
43
28
  };
44
29
 
@@ -46,6 +31,7 @@ const offOn = (arg) => (arg ? "on" : "off");
46
31
 
47
32
  const WherebyEmbed = ({
48
33
  audio,
34
+ avatarUrl,
49
35
  background,
50
36
  chat,
51
37
  displayName,
@@ -60,9 +46,11 @@ const WherebyEmbed = ({
60
46
  room,
61
47
  screenshare,
62
48
  video,
49
+ virtualBackgroundUrl,
63
50
  }) => {
64
51
  return html`<whereby-embed
65
52
  audio=${offOn(audio)}
53
+ avatarUrl=${avatarUrl}
66
54
  background=${offOn(background)}
67
55
  chat=${offOn(chat)}
68
56
  displayName=${displayName}
@@ -76,6 +64,7 @@ const WherebyEmbed = ({
76
64
  recording=${offOn(recording)}
77
65
  screenshare=${offOn(screenshare)}
78
66
  video=${offOn(video)}
67
+ virtualBackgroundUrl=${virtualBackgroundUrl}
79
68
  room="${room}"
80
69
  style="height: 100vh"
81
70
  />`;
@@ -86,6 +75,7 @@ export const Primary = Template.bind({});
86
75
 
87
76
  Primary.args = {
88
77
  audio: true,
78
+ avatarUrl: "",
89
79
  background: true,
90
80
  chat: true,
91
81
  displayName: "Your name",
@@ -99,6 +89,7 @@ Primary.args = {
99
89
  room: process.env.STORYBOOK_ROOM,
100
90
  screenshare: true,
101
91
  video: true,
92
+ virtualBackgroundUrl: "",
102
93
  };
103
94
 
104
95
  Primary.parameters = {
@@ -30,9 +30,11 @@ describe("@whereby/browser-sdk", () => {
30
30
  "minimal",
31
31
  "room",
32
32
  "subdomain",
33
- "groups",
34
33
  "lang",
35
34
  "metadata",
35
+ "groups",
36
+ "virtualbackgroundurl",
37
+ "avatarurl",
36
38
  "audio",
37
39
  "background",
38
40
  "chat",
@@ -55,6 +57,7 @@ describe("@whereby/browser-sdk", () => {
55
57
  "personality",
56
58
  "subgridlabels",
57
59
  "lowdata",
60
+ "breakout",
58
61
  ],
59
62
  })
60
63
  );
@@ -66,6 +69,8 @@ describe("@whereby/browser-sdk", () => {
66
69
  expect(define).toBeCalledWith(
67
70
  expect.any(String),
68
71
  expect.objectContaining({
72
+ startRecording: expect.any(Function),
73
+ stopRecording: expect.any(Function),
69
74
  toggleCamera: expect.any(Function),
70
75
  toggleMicrophone: expect.any(Function),
71
76
  })
package/src/lib/index.js CHANGED
@@ -23,6 +23,7 @@ const boolAttrs = [
23
23
  "personality",
24
24
  "subgridLabels",
25
25
  "lowData",
26
+ "breakout",
26
27
  ];
27
28
 
28
29
  define("WherebyEmbed", {
@@ -35,9 +36,18 @@ define("WherebyEmbed", {
35
36
  ondisconnected() {
36
37
  window.removeEventListener("message", this);
37
38
  },
38
- observedAttributes: ["displayName", "minimal", "room", "subdomain", "groups", "lang", "metadata", ...boolAttrs].map(
39
- (a) => a.toLowerCase()
40
- ),
39
+ observedAttributes: [
40
+ "displayName",
41
+ "minimal",
42
+ "room",
43
+ "subdomain",
44
+ "lang",
45
+ "metadata",
46
+ "groups",
47
+ "virtualBackgroundUrl",
48
+ "avatarUrl",
49
+ ...boolAttrs,
50
+ ].map((a) => a.toLowerCase()),
41
51
  onattributechanged({ attributeName, oldValue }) {
42
52
  if (["room", "subdomain"].includes(attributeName) && oldValue == null) return;
43
53
  this.render();
@@ -56,20 +66,23 @@ define("WherebyEmbed", {
56
66
  },
57
67
 
58
68
  // Commands
59
- toggleCamera(enabled) {
69
+ _postCommand(command, args = []) {
60
70
  if (this.iframe.current) {
61
71
  const url = new URL(this.room, `https://${this.subdomain}.whereby.com`);
62
- this.iframe.current.contentWindow.postMessage({ command: "toggle_camera", args: [enabled] }, url.origin);
72
+ this.iframe.current.contentWindow.postMessage({ command, args }, url.origin);
63
73
  }
64
74
  },
75
+ startRecording() {
76
+ this._postCommand("start_recording");
77
+ },
78
+ stopRecording() {
79
+ this._postCommand("stop_recording");
80
+ },
81
+ toggleCamera(enabled) {
82
+ this._postCommand("toggle_camera", [enabled]);
83
+ },
65
84
  toggleMicrophone(enabled) {
66
- if (this.iframe.current) {
67
- const url = new URL(this.room, `https://${this.subdomain}.whereby.com`);
68
- this.iframe.current.contentWindow.postMessage(
69
- { command: "toggle_microphone", args: [enabled] },
70
- url.origin
71
- );
72
- }
85
+ this._postCommand("toggle_microphone", [enabled]);
73
86
  },
74
87
 
75
88
  onmessage({ origin, data }) {
@@ -79,7 +92,16 @@ define("WherebyEmbed", {
79
92
  this.dispatchEvent(new CustomEvent(type, { detail }));
80
93
  },
81
94
  render() {
82
- const { displayname: displayName, lang, metadata, minimal, room } = this;
95
+ const {
96
+ avatarurl: avatarUrl,
97
+ displayname: displayName,
98
+ lang,
99
+ metadata,
100
+ minimal,
101
+ room,
102
+ groups,
103
+ virtualbackgroundurl: virtualBackgroundUrl,
104
+ } = this;
83
105
  if (!room) return this.html`Whereby: Missing room attr.`;
84
106
  // Get subdomain from room URL, or use it specified
85
107
  let m = /https:\/\/([^.]+)\.whereby.com\/.+/.exec(room);
@@ -93,6 +115,9 @@ define("WherebyEmbed", {
93
115
  ...(displayName && { displayName }),
94
116
  ...(lang && { lang: lang }),
95
117
  ...(metadata && { metadata: metadata }),
118
+ ...(groups && { groups: groups }),
119
+ ...(virtualBackgroundUrl && { virtualBackgroundUrl: virtualBackgroundUrl }),
120
+ ...(avatarUrl && { avatarUrl: avatarUrl }),
96
121
  // the original ?embed name was confusing, so we give minimal
97
122
  ...(minimal != null && { embed: minimal }),
98
123
  ...boolAttrs.reduce(
@@ -1,4 +0,0 @@
1
- {
2
- "editor.defaultFormatter": "esbenp.prettier-vscode",
3
- "editor.formatOnSave": true
4
- }