let BaseNode=require("../Utils/BaseNode").BaseNode,APJS=require("../../../amazingpro"),CentralDataReset=require("../Utils/CentralDataReset").CentralDataReset;class CGSetVisibility extends BaseNode{constructor(){super(),this.isVisible=!0}_updateScriptComponentRecursively(e,t){var s=e.getComponents("JSScriptComponent");if(s&&0<s.length)for(let e=0;e<s.length;e++){var i=s[e],n=(CentralDataReset.getInstance().registerPropertyResetCallbacksIfNotExistAutoMode(i,["enabled"]),CentralDataReset.getInstance().getPropertyValueFromCentralData(i,["enabled"]));i.enabled=t&&(null==n||n)}e=e.getComponent("Transform");if(e&&e.isInstanceOf("Transform")){var r=e.getSceneObject().getChildren();for(let e=0;e<r.length;e++)r[e]instanceof APJS.SceneObject&&this._updateScriptComponentRecursively(r[e],t)}}getOutput(e){return this.isVisible}execute(e){var t,s;null!=this.inputs[1]&&(t=this.inputs[1](),s=this.inputs[2](),null!=t&&t.isInstanceOf("Entity")?(CentralDataReset.getInstance().registerPropertyResetCallbacksIfNotExistAutoMode(t,["visible"],{objectSetter:(e,t,s)=>{e.setEnabledInHierarchy(s)},objectGetter:(e,t)=>e.isEnabledInHierarchy()}),!0===s?(t.setEnabledInHierarchy(s),this._updateScriptComponentRecursively(t,s)):(this._updateScriptComponentRecursively(t,s),t.setEnabledInHierarchy(s)),this.isVisible=s):this.isVisible=null),this.nexts[0]&&this.nexts[0]()}beforeStart(e){this.sys=e}resetOnRecord(e){this.isVisible=!0}}exports.CGSetVisibility=CGSetVisibility;