metaeditor
Version:
The Pixel Streaming library for ReactJS facilitates the integration of Unreal Engine v.5 into a web browser. It enables the transmission of commands and receipt of callbacks from the stream server once Unreal Engine is launched.
3 lines (2 loc) • 21.9 kB
JavaScript
;function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("metaeditor4-ui"),n=require("react"),r=e(n),o=e(require("semver")),a=require("rsuite"),i=e(require("moment")),c=e(require("short-uuid")),u=require("react-json-tree"),l=require("react-jss"),s=require("metaeditor4-ue"),f=e(require("@rsuite/icons/legacy/Spinner")),d=e(require("@rsuite/icons/PlayOutline")),p=require("react-portal"),m=e(require("@rsuite/icons/CheckRound")),h=e(require("@rsuite/icons/Tools"));function v(){v=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function l(e,t,n,o){var a=Object.create((t&&t.prototype instanceof d?t:d).prototype),i=new P(o||[]);return r(a,"_invoke",{value:x(e,n,i)}),a}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f={};function d(){}function p(){}function m(){}var h={};u(h,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(L([])));g&&g!==t&&n.call(g,a)&&(h=g);var w=m.prototype=d.prototype=Object.create(h);function E(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var o;r(this,"_invoke",{value:function(r,a){function i(){return new t((function(o,i){!function r(o,a,i,c){var u=s(e[o],e,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,i,c)}),(function(e){r("throw",e,i,c)})):t.resolve(f).then((function(e){l.value=e,i(l)}),(function(e){return r("throw",e,i,c)}))}c(u.arg)}(r,a,o,i)}))}return o=o?o.then(i,i):i()}})}function x(e,t,n){var r="suspendedStart";return function(o,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var c=S(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=s(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function S(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=s(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function L(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return p.prototype=m,r(w,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:p,configurable:!0}),p.displayName=u(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u(e,c,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},E(b.prototype),u(b.prototype,i,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,r,o,a){void 0===a&&(a=Promise);var i=new b(l(t,n,r,o),a);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(w),u(w,c,"Generator"),u(w,a,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=L,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(C),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function y(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function g(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){y(a,r,o,i,c,"next",e)}function c(e){y(a,r,o,i,c,"throw",e)}i(void 0)}))}}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key))?o:String(o),r)}var o}function E(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function b(){return(b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function x(e,t){return"UPDATE"===t.type?b({},e,t.payload):e}var S={packageVersion:{latest:null,current:null,needUpdate:!1}};function k(){return C.apply(this,arguments)}function C(){return(C=g(v().mark((function e(){return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=3,new Promise((function(e,t){fetch("https://registry.npmjs.org/metaeditor").then((function(e){return e.json()})).then((function(t){try{var n=t["dist-tags"].latest,r=o.gt(n,"4.0.8");e({latest:n,current:"4.0.8",needUpdate:r})}catch(t){console.error("Can't parse npm data"),e(null)}})).catch((function(e){console.error("Can't check package version"),t(e)}))}));case 3:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var P=n.createContext({}),L=function(e){var t=function(){var e=n.useReducer(x,S),t=e[0],r=e[1];n.useEffect((function(){o.getNpmPackageVersion()}),[]);var o=new(function(){function e(){}var n=e.prototype;return n.dispatch=function(e){r({type:"UPDATE",payload:e})},n.getNpmPackageVersion=function(){var e=g(v().mark((function e(){return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k();case 2:this.dispatch({packageVersion:e.sent});case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),E(e,[{key:"state",get:function(){return t}}]),e}());return o}();return n.createElement(P.Provider,{value:t},e.children)};function j(e,t){return"UPDATE"===t.type?b({},e,t.payload):e}var O={playerConfig:null,webrtcStatus:null,webrtcMessage:!1,streamStatus:null,streamMessage:!1,freezeFrame:!1},R=n.createContext({}),N=function(){return n.useContext(R)},D=function(e){var t,r,o,a,i,c,u=(t=n.useReducer(j,O),r=t[0],o=t[1],a=n.useState([]),i=a[0],c=a[1],new(function(){function e(){}var t=e.prototype;return t.dispatch=function(e){o({type:"UPDATE",payload:e})},t.setWebrtcStatus=function(e,t){void 0===t&&(t=!1),this.dispatch({webrtcStatus:e,webrtcMessage:t})},t.setStreamStatus=function(e,t){void 0===t&&(t=!1),this.dispatch({streamStatus:e,streamMessage:t})},t.setFreezeFrame=function(e){this.dispatch({freezeFrame:e})},t.addCommand=function(e){o({type:"ADD_COMMAND",payload:e}),c((function(t){return[e].concat(t).slice(0,100)}))},t.saveConfig=function(e){this.dispatch({playerConfig:e})},E(e,[{key:"state",get:function(){return r}},{key:"commandsList",get:function(){return i}},{key:"isStreamActive",get:function(){return"play"===r.streamStatus}},{key:"isWebrtcError",get:function(){return["failed","disconnected","disconnectedRestart"].includes(r.webrtcStatus)}}]),e}()));return n.createElement(R.Provider,{value:u},e.children)},I=function(e){return n.createElement(u.JSONTree,{invertTheme:!1,theme:{extend:F,valueLabel:{}},data:e.data})},F={scheme:"monokai",author:"wimer hazenberg (http://www.monokai.nl)",base00:"transparent",base01:"#383830",base02:"#49483e",base03:"#75715e",base04:"#a59f85",base05:"#f8f8f2",base06:"#f5f4f1",base07:"#f9f8f5",base08:"#f92672",base09:"#fd971f",base0A:"#f4bf75",base0B:"#a6e22e",base0C:"#a1efe4",base0D:"#66d9ef",base0E:"#ae81ff",base0F:"#cc6633"};function _(){var e,t,r=(e=N(),t=a.useToaster(),new(function(){function r(){}return r.prototype.save=function(r,o,u){var l={type:r,uuid:c.generate(),date:i.utc().format(),payload:o};e.addCommand(l),("boolean"==typeof(null==u?void 0:u.debug)?u.debug:e.state.playerConfig.debugMode)&&t.push(n.createElement(a.Notification,{type:"success",header:"Command",closable:!0},n.createElement(I,{data:l})),{placement:(null==u?void 0:u.placement)||"bottomEnd",duration:(null==u?void 0:u.duration)||2e3})},r}()));return new(function(){function e(){}var t=e.prototype;return t.play=function(){this.player.stream.play()},t.reconnect=function(){this.player.stream.reconnect()},t.emitUi=function(e,t){window.emitUIInteraction(e),r.save("ui",e,t)},t.emitSys=function(e,t){window.emitCommand(e),r.save("sys",e,t)},t.resetResolution=function(){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;this.emitSys({"Resolution.Width":e,"Resolution.Height":t},{debug:!1})},E(e,[{key:"player",get:function(){return"undefined"!=typeof window&&window.player?window.player:null}}]),e}())}function M(e,t,r){var o=n.useRef(null);n.useEffect((function(){r&&(o.current=r)}),[r]),n.useEffect((function(){if(e&&e.addEventListener){var n=function(e){return o.current(e)};return e.addEventListener(t,n),function(){e.removeEventListener(t,n)}}}),[t,e])}function T(){var e=N(),t="undefined"!=typeof window&&window.player?window.player:null,n=null==t?void 0:t.stream;M(n,"webRtcAutoConnect",(function(){e.setWebrtcStatus("autoConnect")})),M(n,"webRtcConnecting",(function(){e.setWebrtcStatus("connecting")})),M(n,"webRtcConnected",(function(){e.setWebrtcStatus("connected")})),M(n,"webRtcFailed",(function(){e.setWebrtcStatus("failed")})),M(n,"webRtcDisconnected",(function(t){var n=t.data;e.setWebrtcStatus(0==n.showActionOrErrorOnDisconnect?"disconnected":"disconnectedRestart",n.eventString)})),M(n,"videoInitialized",(function(){e.setStreamStatus("initialized")})),M(n,"streamLoading",(function(){e.setStreamStatus("loading")})),M(n,"playStreamError",(function(t){e.setStreamStatus("error",t.data.message)})),M(n,"playStream",(function(){e.setStreamStatus("play")})),M(n,"playStreamRejected",(function(t){e.setStreamStatus("rejected",t.data.reason)})),M(n,"loadFreezeFrame",(function(t){e.setFreezeFrame(t.data.shouldShowPlayOverlay)}))}var A=l.createUseStyles({rootDiv:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:10,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",pointerEvents:"none",padding:"3rem","& > *":{pointerEvents:"all"}},webrtcError:{display:"flex",flexDirection:"column",alignItems:"center","& > h5":{textAlign:"center",marginBottom:"1rem"}}}),z=function(e){var t=e.show,r=N(),o=_();return t?"connected"==r.state.webrtcStatus?n.createElement(d,{onClick:function(e){e.preventDefault(),e.stopPropagation(),o.play()},style:{color:"#fff",fontSize:"10em",cursor:"pointer"}}):n.createElement(f,{pulse:!0,style:{color:"#fff",fontSize:"3em"}}):null},U=function(e){var t=e.show,r=A(),o=N(),i=_();return t?n.createElement("div",{className:r.webrtcError},n.createElement("h5",null,o.state.webrtcMessage),n.createElement(a.Button,{onClick:function(){i.reconnect()},appearance:"primary"},"Restart")):null};function H(){var e=A(),t=N();if(_(),t.isStreamActive)return null;var r=t.isWebrtcError;return n.createElement("div",{className:e.rootDiv},n.createElement(U,{show:r}),n.createElement(z,{show:!r}))}function W(){var e=_(),t=[{title:"Restart stream",onClick:function(){e.reconnect()}},{title:"Reset resolution",onClick:function(){e.resetResolution()}}];return n.createElement(a.Navbar,{appearance:"subtle"},n.createElement(a.Navbar.Brand,{as:"a",href:"http://metaeditor.io/",target:"_blank"},"Metaeditor"," v","4.0.8"),n.createElement(a.Nav,{onSelect:function(){},activeKey:void 0},n.createElement(a.Nav.Menu,{title:"Tools"},t.map((function(e,t){return n.createElement(a.Nav.Item,{key:t,onClick:e.onClick},e.title)}))),n.createElement(a.Nav.Menu,{title:"Help"},n.createElement(a.Nav.Item,{as:"a",href:"https://metaeditor.io/docs",target:"_blank"},"Documentation"),n.createElement(a.Nav.Item,{as:"a",href:"https://unrealos.com/p/contacts/",target:"_blank"},"Support"))),n.createElement(a.Nav,{pullRight:!0},n.createElement(a.Nav.Item,{as:"a",href:"https://unrealos.com/apps/metaeditor/",target:"_blank"},n.createElement(a.Button,{color:"green",appearance:"primary",startIcon:n.createElement(m,null)},"Buy Pro"))))}function q(e){var t=function(e){return"undefined"!=typeof window&&window.matchMedia(e).matches},r=n.useState(t(e)),o=r[0],a=r[1];function i(){a(t(e))}return n.useEffect((function(){var t=window.matchMedia(e);return i(),t.addListener?t.addListener(i):t.addEventListener("change",i),function(){t.removeListener?t.removeListener(i):t.removeEventListener("change",i)}}),[e]),o}var B=["title","children","contentPadding","onClose"],V=n.forwardRef((function(e,t){var r=e.title,o=e.children,i=e.contentPadding,c=e.onClose,u=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(o[n]=e[n]);return o}(e,B),l=q("(min-width: 768px)"),s=(q("(max-width: 768px)"),n.useState(!1)),f=s[0],d=s[1];return n.useImperativeHandle(t,(function(){return{open:function(){d(!0)},close:function(){d(!1)}}})),n.createElement(n.Fragment,null,n.createElement(a.Drawer,Object.assign({},u,{size:l?u.size||"xs":"full",open:f,onClose:function(){d(!1),c&&c()}}),n.createElement(a.Drawer.Header,null,n.createElement(a.Drawer.Title,null,r)),n.createElement(a.Drawer.Body,{style:{padding:i}},f&&o)))}));function G(){var e=N(),t=_();return n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement("h6",null,"Current config"),n.createElement(I,{data:e.state}),n.createElement(a.Divider,null),n.createElement("h6",null,"Commands history"),n.createElement(I,{data:e.commandsList}),n.createElement(a.Divider,null),n.createElement(a.Button,{onClick:function(){t.resetResolution()}},"Reset resolution")))}var Y=n.forwardRef((function(e,t){var r=n.useRef(null);return n.useImperativeHandle(t,(function(){return{open:function(){null==r||r.current.open()},close:function(){null==r||r.current.close()}}})),n.createElement(V,{backdrop:!0,contentPadding:20,placement:"right",title:"Tools Panel",ref:r},n.createElement("div",{style:{height:"100%"}},n.createElement(G,null)))}));function J(){var e=n.useRef(null),t="undefined"!=typeof document&&document.getElementById("controls");return n.createElement(n.Fragment,null,n.createElement(Y,{ref:e}),n.createElement(p.Portal,{node:t},n.createElement("button",{onClick:function(){return e.current.open()}},n.createElement(h,{style:{fontSize:24,lineHeight:0}}))))}var K=l.createUseStyles({message:{cursor:"pointer",backgroundColor:"var(--rs-message-warning-bg)",color:"var(--rs-message-warning-text)",padding:".3rem 1rem",transition:"background-color .1s linear","&:hover":{backgroundColor:"var(--rs-orange-800)"}}});function Q(){var e=n.useContext(P),t=K(),r=e.state.packageVersion;return r.needUpdate?n.createElement("div",{className:t.message,onClick:function(){window.open("https://www.npmjs.com/package/metaeditor")}},"Update ","Metaeditor"," from version ",r.current," to ",r.latest):null}var X=l.createUseStyles({appbar:{position:"fixed",top:0,right:0,left:0,zIndex:20,backgroundColor:"#000"}});function Z(e){var t=e.show,r=n.useRef(null),o=X(),a="undefined"!=typeof document&&document.getElementById("playerUI");return n.useEffect((function(){var e=r.current.clientHeight+"px";document.documentElement.style.setProperty("--appbar-height",e);var t=function(t){var n=document.getElementById(t);n&&(n.style.top=e)};t("controls"),t("connection")}),[]),n.createElement(n.Fragment,null,n.createElement(p.Portal,{node:a},n.createElement("div",{className:o.appbar,ref:r},n.createElement(Q,null),t&&n.createElement(W,null))),t&&n.createElement(J,null))}var $=l.createUseStyles({containerRoot:{position:"fixed",top:"var(--appbar-height)",right:0,left:0,bottom:0,padding:"1rem",paddingTop:0,pointerEvents:"none",display:"flex",flexDirection:"column",justifyContent:"flex-end","& > div":{"& > *":{pointerEvents:"all"}}}});function ee(e){var t=e.children,r=$();return n.createElement("div",{className:r.containerRoot},n.createElement("div",null,t))}var te=l.createUseStyles({"@global":{"& body":{width:"100vw",height:"var(--window-height)",overflow:"hidden"},"#playOverlay":{display:"none"},"#infoOverlay":{display:"none"},"#disconnectOverlay":{display:"none"},"#connection":{bottom:"auto !important",left:"auto !important",right:"2rem !important"}},rootDiv:{zIndex:0,position:"absolute",top:0,right:0,left:0,bottom:0,width:"100vw",height:"100vh",minHeight:"-webkit-fill-available"}});function ne(e){var r,o,a=e.showToolbar,i=e.psHost,c=N(),u=te(),l=n.useRef(null);return r=n.useState({width:0,height:0}),o=r[1],n.useEffect((function(){function e(){o({width:window.innerWidth,height:window.innerHeight});var e=document.documentElement;e.style.setProperty("--window-width",window.innerWidth+"px"),e.style.setProperty("--window-height",window.innerHeight+"px")}return window.addEventListener("resize",e),e(),function(){return window.removeEventListener("resize",e)}}),[]),T(),n.useEffect((function(){c.saveConfig(e)}),[e]),n.useEffect((function(){s.Logger.SetLoggerVerbosity(0);var n=new s.Config({useUrlParams:!0,initialSettings:{AutoPlayVideo:e.autoPlay,AutoConnect:!0,ss:i,StartVideoMuted:!0,HoveringMouse:!0,FakeMouseWithTouches:!0,MatchViewportRes:!0}}),r=new s.PixelStreaming(n),o=new t.Application({stream:r});l.current&&!l.current.textContent&&(window.player=o,l.current.appendChild(o.rootElement))}),[]),n.useEffect((function(){document.getElementById("uiFeatures").style.visibility=a?"visible":"hidden"}),[a]),n.createElement(n.Fragment,null,n.createElement(H,null),n.createElement(Z,{show:a}),n.createElement("div",{ref:l,className:u.rootDiv}),e.children?n.createElement(ee,null,e.children):"")}var re=new t.PixelStreamingApplicationStyle,oe={actions:_,events:T,listener:M};exports.Context={stream:N},exports.Hooks=oe,exports.MetaPlayer=function(e){var t=n.useState(!1),r=t[0],o=t[1];return n.useEffect((function(){o(!0)}),[]),r?n.createElement(a.CustomProvider,{theme:"dark"},n.createElement(ne,Object.assign({},e))):null},exports.MetaProvider=function(e){return r.createElement(L,null,r.createElement(D,null,e.children))},exports.PixelStreamingApplicationStyles=re;
//# sourceMappingURL=metaeditor.cjs.production.min.js.map