/*! phoscon-app 2025-08-28 */

var blinkLed=void 0,dimmMs=4e3,advertize=!0,draht=void 0,curColor=0,colors=["#444444","#ffe680","#ff6600","#2a7fff","#66ff00","#2ad4ff","#d40055","#00ff66","#55ff44"];function initSvg(dev){var swel=Snap.select("#switch"),data=Snap("#src-sw-svg svg");if(swel&&data){swel.clear();var s=data.select(dev);if(!s)return!1;var wiz=(s=s.clone()).select(".sw-wizzard");wiz&&wiz.attr("display","none"),swel.append(s);var bb=s.getBBox(),viewBox=swel.attr("viewBox"),width=Math.floor(bb.width+20),height=Math.floor(bb.height+10+10);return viewBox.x=bb.x-10,viewBox.y=bb.y-10,viewBox.width=width,viewBox.height=height,swel.attr("viewBox",viewBox),swel.attr("width",width),swel.attr("height",height),swel.selectAll(".sw-wizzard [data-wizzard-page]").forEach(function(el){el.attr("data-wizzard-page");el.selectAll("text").forEach(function(txt){txt.attr("display","none")})}),swel.selectAll(".sw-target").forEach(function(el){"g"!==el.type&&(el.attr({opacity:1e-5}),el.mousedown(function(e){handleSwitchEvent.call(el.node,EVENT_BUTTON_PRESS,e)}),el.mouseout(function(e){switchState!==STATE_IDLE&&handleSwitchEvent.call(el.node,EVENT_BUTTON_RELEASE,e)}),el.mouseup(function(e){handleSwitchEvent.call(el.node,EVENT_BUTTON_RELEASE,e)}))}),startTime=performance.now(),animate(),!0}}function animate(){requestID=requestAnimationFrame(drawButtons)}function stopAnimation(){requestID&&(cancelAnimationFrame(requestID),requestID=void 0)}!function(){var lastTime=0;window.requestAnimationFrame||(window.requestAnimationFrame=function(callback,element){var currTime=(new Date).getTime(),timeToCall=Math.max(0,16-(currTime-lastTime)),id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);return lastTime=currTime+timeToCall,id}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(id){clearTimeout(id)})}();var EVENT_BUTTON_PRESS=0,EVENT_BUTTON_RELEASE=1,EVENT_TIMER=2,STATE_IDLE=0,STATE_SHORT_PRESS=1,STATE_LONG_PRESS=2,switchState=STATE_IDLE,curButton=void 0,curShortPressAction=void 0,curLongPressAction=void 0,curLongPressDelay=2e3,eFill=void 0,eOpacity=void 0,startTime=0;function execShortPressAction(){var scene,spa=this.dataset.spa;if("on"===spa)sendParameter("on",!0,!1,!0);else if("off"===spa)sendParameter("on",!1,!1,!0);else{if("call-scene"!==spa)return;if(!(scene=this.dataset.scene)||scene<0||scene>255)return;app.session.scid=scene,restRecallScene(function(){})}}function execLongPressAction(){console.log(this)}function handleSwitchEvent(event,e){var el;event===EVENT_BUTTON_RELEASE&&(el=Snap(e.target)).animate({fill:eFill,opacity:eOpacity},600,mina.easeout),switchState===STATE_IDLE?(advertize&&(advertize=!1),event===EVENT_BUTTON_PRESS&&(curButton=e.target,curShortPressAction=$(e.target).data("spa"),curLongPressAction=$(e.target).data("lpa"),curLongPressDelay=parseInt($(e.target).data("lpa-delay")),0===(el=Snap(e.target)).inAnim().length&&(eFill=el.attr("fill"),eOpacity=el.attr("opacity"),el.animate({fill:"#0000ff",opacity:1},20)),startTime=performance.now(),switchState=STATE_SHORT_PRESS)):switchState===STATE_SHORT_PRESS?event===EVENT_BUTTON_RELEASE?(switchState=STATE_IDLE,execShortPressAction.call(this)):event===EVENT_TIMER&&(switchState=STATE_LONG_PRESS,execLongPressAction.call(this)):switchState===STATE_LONG_PRESS&&event===EVENT_BUTTON_RELEASE&&(switchState=STATE_IDLE)}function drawButtons(timestamp){advertize?timestamp-startTime>2e3&&(startTime=timestamp):switchState===STATE_SHORT_PRESS&&curLongPressAction&&timestamp-startTime>curLongPressDelay&&handleSwitchEvent(EVENT_TIMER),animate()}