/*! phoscon-app 2024-08-14 */

import{initMachine}from"./settings-gateway/settings-gateway-machine.js";function bbInitZigbeeConfig(){let ZigbeeConfig=Backbone.Model.extend({sync:function(method,model,options){return"patch"===method&&(method="update"),Backbone.sync(method,model,options)}});app.ZigbeeConfigCollection=Backbone.Collection.extend({name:"ZigbeeConfig",model:ZigbeeConfig,url:"//"+app.session.gw+"/api/"+app.apikey+"/config/zigbee"}),app.zigbeeConfig=new app.ZigbeeConfigCollection,initMachine();let dotMenu=document.querySelector(".context-menu-icon"),dotIcon=dotMenu.parentNode,dotMenuOuter=document.querySelector(".context-menu-outer");if(dotMenu.addEventListener("click",function(e){dotIcon.classList.contains("show-context")?dotIcon.classList.remove("show-context"):dotIcon.classList.add("show-context")}),dotMenuOuter.addEventListener("click",function(e){dotIcon.classList.remove("show-context")}),screenMax(SCREEN_MAX_WIDTH_PHONE_LANDSCAPE)&&isThisPortrait()){let symbolNav=document.querySelector("#navigationDiv");"none"===document.querySelector("#powerTab").style.display?symbolNav.style.gridTemplateColumns="100px 100px 0px":symbolNav.style.gridTemplateColumns="100px 100px 100px",symbolNav.style.gridGap="0px",document.querySelector("#topViewDiv").style.height=window.innerHeight-212+"px"}else document.querySelector("#topViewDiv").style.height=window.innerHeight-291+"px";window.addEventListener("deviceorientation",event=>{console.log("Orientation changed!"),screenMax(SCREEN_MAX_WIDTH_PHONE_LANDSCAPE)&&isThisPortrait()?document.querySelector("#topViewDiv").style.height=window.innerHeight-212+"px":document.querySelector("#topViewDiv").style.height=window.innerHeight-291+"px"})}initApp(),restGetResource(app.config).then(res=>{bbInitZigbeeConfig(),setTimeout(()=>app.poll.pollRepeated(app.config),5e3)});