diff --git a/src/main/assets/calls/index.html b/src/main/assets/calls/index.html index 933eed414..53aa9bea8 100644 --- a/src/main/assets/calls/index.html +++ b/src/main/assets/calls/index.html @@ -9,57 +9,57 @@ - +`+T(l));break}$.push(H)}}if(l.__c!=null&&l.__c.__H!=null){var P=l.__c.__H.__;if(P)for(var D=0;D=n.__.length&&n.__.push({}),n.__[e]}function jt(e){return J=1,At(mt,e)}function At(e,t,n){var o=be(Y++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):mt(void 0,t),function(s){var u=o.__N?o.__N[0]:o.__[0],c=o.t(u,s);u!==c&&(o.__N=[c,o.__[1]],o.__c.setState({}))}],o.__c=k,!k.__f)){var r=function(s,u,c){if(!o.__c.__H)return!0;var v=o.__c.__H.__.filter(function(y){return!!y.__c});if(v.every(function(y){return!y.__N}))return!i||i.call(this,s,u,c);var a=o.__c.props!==s;return v.forEach(function(y){if(y.__N){var h=y.__[0];y.__=y.__N,y.__N=void 0,h!==y.__[0]&&(a=!0)}}),i&&i.call(this,s,u,c)||a};k.__f=!0;var i=k.shouldComponentUpdate,_=k.componentWillUpdate;k.componentWillUpdate=function(s,u,c){if(this.__e){var v=i;i=void 0,r(s,u,c),i=v}_&&_.call(this,s,u,c)},k.shouldComponentUpdate=r}return o.__N||o.__}function Ut(e,t){var n=be(Y++,3);!x.__s&&ht(n.__H,t)&&(n.__=e,n.u=t,k.__H.__h.push(n))}function Ie(e){return J=5,dt(function(){return{current:e}},[])}function dt(e,t){var n=be(Y++,7);return ht(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ft(e,t){return J=8,dt(function(){return e},t)}function Mt(){for(var e;e=pt.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ee),e.__H.__h.forEach(de),e.__H.__h=[]}catch(t){e.__H.__h=[],x.__e(t,e.__v)}}x.__b=function(e){k=null,$e&&$e(e)},x.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),De&&De(e,t)},x.__r=function(e){Se&&Se(e),Y=0;var t=(k=e.__c).__H;t&&(_e===k?(t.__h=[],k.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach(ee),t.__h.forEach(de),t.__h=[],Y=0)),_e=k},x.diffed=function(e){Ee&&Ee(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(pt.push(t)!==1&&Te===x.requestAnimationFrame||((Te=x.requestAnimationFrame)||Lt)(Mt)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),_e=k=null},x.__c=function(e,t){t.some(function(n){try{n.__h.forEach(ee),n.__h=n.__h.filter(function(o){return!o.__||de(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],x.__e(o,n.__v)}}),Pe&&Pe(e,t)},x.unmount=function(e){Oe&&Oe(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{ee(o)}catch(r){t=r}}),n.__H=void 0,t&&x.__e(t,n.__v))};var Re=typeof requestAnimationFrame=="function";function Lt(e){var t,n=function(){clearTimeout(o),Re&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Re&&(t=requestAnimationFrame(n))}function ee(e){var t=k,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),k=t}function de(e){var t=k;e.__c=e.__(),k=t}function ht(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function mt(e,t){return typeof t=="function"?t(e):t}function vt(e,t){for(var n in t)e[n]=t[n];return e}function He(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function je(e,t){this.props=e,this.context=t}(je.prototype=new E).isPureReactComponent=!0,je.prototype.shouldComponentUpdate=function(e,t){return He(this.props,e)||He(this.state,t)};var Ae=p.__b;p.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ae&&Ae(e)};var Wt=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function yt(e){function t(n){var o=vt({},n);return delete o.ref,e(o,n.ref||null)}return t.$$typeof=Wt,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Bt=p.__e;p.__e=function(e,t,n,o){if(e.then){for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t)}Bt(e,t,n,o)};var Ue=p.unmount;function bt(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=vt({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return bt(o,t,n)})),e}function gt(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return gt(o,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function se(){this.__u=0,this.o=null,this.__b=null}function wt(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function K(){this.i=null,this.l=null}p.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ue&&Ue(e)},(se.prototype=new E).__c=function(e,t){var n=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(n);var r=wt(o.__v),i=!1,_=function(){i||(i=!0,n.__R=null,r?r(s):s())};n.__R=_;var s=function(){if(!--o.__u){if(o.state.__a){var u=o.state.__a;o.__v.__k[0]=gt(u,u.__c.__P,u.__c.__O)}var c;for(o.setState({__a:o.__b=null});c=o.o.pop();)c.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(_,_)},se.prototype.componentWillUnmount=function(){this.o=[]},se.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=bt(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&fe(F,null,e.fallback);return r&&(r.__u&=-33),[fe(F,null,t.__a?null:e.children),r]};var Fe=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]{});this.peerConnection=new RTCPeerConnection(en),this.state="connecting",this.iceTricklingBuffer=[],this.iceTricklingDataChannel=this.peerConnection.createDataChannel("iceTrickling",{negotiated:!0,id:1}),this.iceTricklingDataChannel.onmessage=t=>{console.log("received ICE candidate from remote peer",t.data),this.peerConnection.addIceCandidate(JSON.parse(t.data))},this.iceTricklingDataChannel.onopen=()=>{console.log("iceTricklingDataChannel open: sending buffered ICE candidates",this.iceTricklingBuffer);for(const t of this.iceTricklingBuffer)Ve(this.iceTricklingDataChannel,t);this.iceTricklingBuffer=[]}}async init(t,n,o){this.onStateChanged=o,this.peerConnection.ontrack=s=>{const u=s.streams[0];n(u),this.state="in-call",this.onStateChanged(this.state)},t.getTracks().forEach(s=>this.peerConnection.addTrack(s,t));const r=async s=>{const u=qe(this.peerConnection),c={type:"offer",sdp:s},v=new RTCSessionDescription(c);this.peerConnection.setRemoteDescription(v),this.peerConnection.setLocalDescription(await this.peerConnection.createAnswer()),await u;const a=this.peerConnection.localDescription.sdp;this.peerConnection.onicecandidate=this.trickleIceOverDataChannel.bind(this),window.calls.acceptCall(encodeURIComponent(a))},i=s=>{const u={type:"answer",sdp:s},c=new RTCSessionDescription(u);this.peerConnection.setRemoteDescription(c)},_=async()=>{const s=decodeURIComponent(window.location.hash.substring(1));console.log("hash changed",s),s==="call"?await this.startCall():s.startsWith("offer=")?await r(s.substring(6)):s.startsWith("answer=")&&i(s.substring(7))};_(),window.addEventListener("hashchange",_)}async startCall(){const t=qe(this.peerConnection);this.peerConnection.setLocalDescription(await this.peerConnection.createOffer()),await t;const n=this.peerConnection.localDescription.sdp;this.peerConnection.onicecandidate=this.trickleIceOverDataChannel.bind(this),window.calls.startCall(encodeURIComponent(n)),this.state="ringing",this.onStateChanged(this.state)}async endCall(){window.calls.endCall()}getState(){return this.state}trickleIceOverDataChannel(t){if(this.iceTricklingDataChannel.readyState!=="open"){console.log("Gathered new ICE candidate, but iceTricklingDataChannel is not yet open, will buffer it",t.candidate),this.iceTricklingBuffer.push(t.candidate);return}Ve(this.iceTricklingDataChannel,t.candidate)}}function qe(e){(e.localDescription!=null||e.remoteDescription!=null)&&console.warn("gatheredEnoughIce called after setLocalDescription or setRemoteDescription: it might not have captured all ICE candidate events");const t=new Promise(o=>{const r=i=>{i.candidate!=null&&i.candidate.type==="relay"&&(setTimeout(o,100),e.removeEventListener("icecandidate",r))};e.addEventListener("icecandidate",r)}),n=new Promise(o=>{const r=()=>{e.iceGatheringState==="complete"&&(o(),e.removeEventListener("icegatheringstatechange",r))};e.addEventListener("icegatheringstatechange",r)});return Promise.race([t,n])}function Ve(e,t){console.log("sending ICE candidate to remote peer",t),e.send(JSON.stringify(t===null?t:t.toJSON()))}var nn=0;function w(e,t,n,o,r,i){t||(t={});var _,s,u=t;if("ref"in u)for(s in u={},t)s=="ref"?_=t[s]:u[s]=t[s];var c={type:e,props:u,key:n,ref:_,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--nn,__i:-1,__u:0,__source:r,__self:i};if(typeof e=="function"&&(_=e.defaultProps))for(s in _)u[s]===void 0&&(u[s]=_[s]);return p.vnode&&p.vnode(c),c}var ze="/home/runner/work/calls-webapp/calls-webapp/src/components/VideoThumbnail.tsx";const on={position:"absolute",right:"15px",top:"15px",height:"100px",width:"100px",zIndex:1,imageRendering:"crisp-edges",borderRadius:"5px",boxShadow:"rgba(0, 0, 0, 0.29) 0px 2px 8px 0px, rgba(0, 0, 0, 0.28) 0px 2px 8px 0px"};function rn({videoRef:e}){return w("div",{style:on,children:w("video",{style:{borderRadius:"5px",objectFit:"cover",transform:"scaleX(-1)"},width:"100%",height:"100%",muted:!0,autoPlay:!0,playsInline:!0,ref:e},void 0,!1,{fileName:ze,lineNumber:21,columnNumber:7},this)},void 0,!1,{fileName:ze,lineNumber:20,columnNumber:5},this)}var Ye="/home/runner/work/calls-webapp/calls-webapp/src/components/FullscreenVideo.tsx";const an={imageRendering:"crisp-edges",width:"100%",height:"100%"};function ln({videoRef:e}){return w("div",{style:an,children:w("video",{style:{transform:"scaleX(-1)"},width:"100%",height:"100%",autoPlay:!0,playsInline:!0,ref:e},void 0,!1,{fileName:Ye,lineNumber:14,columnNumber:7},this)},void 0,!1,{fileName:Ye,lineNumber:13,columnNumber:5},this)}var Je="/home/runner/work/calls-webapp/calls-webapp/~icons/material-symbols/call-end.jsx";const _n=(e,t)=>w("svg",{viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",ref:t,...e,children:w("path",{fill:"currentColor",d:"M12 8q2.95 0 5.813 1.188T22.9 12.75q.3.3.3.7t-.3.7l-2.3 2.25q-.275.275-.638.3t-.662-.2l-2.9-2.2q-.2-.15-.3-.35t-.1-.45v-2.85q-.95-.3-1.95-.475T12 10t-2.05.175T8 10.65v2.85q0 .25-.1.45t-.3.35l-2.9 2.2q-.3.225-.663.2t-.637-.3l-2.3-2.25q-.3-.3-.3-.7t.3-.7q2.2-2.375 5.075-3.562T12 8"},void 0,!1,{fileName:Je,lineNumber:3,columnNumber:123},void 0)},void 0,!1,{fileName:Je,lineNumber:3,columnNumber:48},void 0),sn=yt(_n),cn="_btn_ppybd_1",un={btn:cn};var fn="/home/runner/work/calls-webapp/calls-webapp/src/components/Button.tsx";function pn({children:e,...t}){return w("div",{className:un.btn,...t,children:e},void 0,!1,{fileName:fn,lineNumber:10,columnNumber:5},this)}var Xe="/home/runner/work/calls-webapp/calls-webapp/src/components/EndCallButton.tsx";const Ge={color:"white",background:"#cb2233",borderRadius:"50%",fontSize:"1.5em"};function dn({...e}){return e.style={...Ge,...e.style||{}},w(pn,{style:Ge,...e,children:w(sn,{},void 0,!1,{fileName:Xe,lineNumber:20,columnNumber:7},this)},void 0,!1,{fileName:Xe,lineNumber:19,columnNumber:5},this)}var Ke="/home/runner/work/calls-webapp/calls-webapp/~icons/material-symbols/person.jsx";const hn=(e,t)=>w("svg",{viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",ref:t,...e,children:w("path",{fill:"currentColor",d:"M12 12q-1.65 0-2.825-1.175T8 8t1.175-2.825T12 4t2.825 1.175T16 8t-1.175 2.825T12 12m-8 8v-2.8q0-.85.438-1.562T5.6 14.55q1.55-.775 3.15-1.162T12 13t3.25.388t3.15 1.162q.725.375 1.163 1.088T20 17.2V20z"},void 0,!1,{fileName:Ke,lineNumber:3,columnNumber:122},void 0)},void 0,!1,{fileName:Ke,lineNumber:3,columnNumber:47},void 0),mn=yt(hn);var vn="/home/runner/work/calls-webapp/calls-webapp/src/components/AvatarCircle.tsx";const Ze={display:"inline-flex",flexDirection:"row",alignItems:"center",padding:"0.5em",color:"white",background:"#c8c7cd",borderRadius:"50%",fontSize:"1.5em"};function yn({children:e,...t}){return t.style={...Ze,...t.style||{}},w("div",{style:Ze,...t,children:e},void 0,!1,{fileName:vn,lineNumber:20,columnNumber:5},this)}var Qe="/home/runner/work/calls-webapp/calls-webapp/src/components/AvatarPlaceholder.tsx";function bn({...e}){return w(yn,{style:{padding:"0.2em",fontSize:"5em"},...e,children:w(mn,{},void 0,!1,{fileName:Qe,lineNumber:12,columnNumber:7},this)},void 0,!1,{fileName:Qe,lineNumber:11,columnNumber:5},this)}var A="/home/runner/work/calls-webapp/calls-webapp/src/App.tsx";const Z=new tn;function gn(){const[e,t]=ie(jt(Z.getState()),"state"),n=ie(Ie(null),"outVidRef"),o=ie(Ie(null),"incVidRef");Ut(()=>{(async()=>{const u=await navigator.mediaDevices.getUserMedia({video:!0,audio:!0});n.current.srcObject=u;const c=v=>{o.current.srcObject=v};await Z.init(u,c,t)})()},[]);const r=Ft(()=>{Z.endCall()},[Z]);let i="";e==="connecting"?i="Connecting...":e==="ringing"&&(i="Ringing...");const _=e==="in-call";return w("div",{style:{height:"100vh",overflow:"hidden"},children:[w("div",{style:{display:_?"block":"none",height:"100%"},children:[w(ln,{videoRef:o},void 0,!1,{fileName:A,lineNumber:54,columnNumber:9},this),w(rn,{videoRef:n},void 0,!1,{fileName:A,lineNumber:55,columnNumber:9},this)]},void 0,!0,{fileName:A,lineNumber:53,columnNumber:7},this),w("div",{style:{position:"absolute",top:0,width:"100%",paddingTop:"1em",textAlign:"center"},children:i},void 0,!1,{fileName:A,lineNumber:58,columnNumber:7},this),w("div",{style:{display:_?"none":"flex",alignItems:"center",textAlign:"center",justifyContent:"center",height:"100%"},children:w(bn,{},void 0,!1,{fileName:A,lineNumber:78,columnNumber:9},this)},void 0,!1,{fileName:A,lineNumber:69,columnNumber:7},this),w("div",{style:{position:"absolute",bottom:"1em",width:"100%",textAlign:"center"},children:w(dn,{onClick:r},void 0,!1,{fileName:A,lineNumber:88,columnNumber:9},this)},void 0,!1,{fileName:A,lineNumber:80,columnNumber:7},this)]},void 0,!0,{fileName:A,lineNumber:52,columnNumber:5},this)}var wn="/home/runner/work/calls-webapp/calls-webapp/src/index.tsx";Ot(w(gn,{},void 0,!1,{fileName:wn,lineNumber:4,columnNumber:8},void 0),document.getElementById("root"));