text: if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("restrict-entity",{schema:{states:{type:"array",default:["vr","non-vr"]},pause:{type:"boolean",default:!0},hide:{type:"boolean",default:!0}},multiple:!1,init:function(){this.isEnabled=!0,this.stateChanged=(()=>{this.data.states.filter(e=>this.el.is(e)).length?this.isEnabled||(this.data.pause&&this.el.play(),this.data.hide&&(this.el.object3D.visible=!0),this.isEnabled=!0):this.isEnabled&&(this.data.pause&&this.el.pause(),this.data.hide&&(this.el.object3D.visible=!1),this.isEnabled=!1)})},update:function(e){this.stateChanged()},pause:function(){this.el.removeEventListener("stateadded",this.stateChanged),this.el.removeEventListener("stateremoved",this.stateChanged)},play:function(){this.el.addEventListener("stateadded",this.stateChanged),this.el.addEventListener("stateremoved",this.stateChanged)}});