"use strict";$(document).ready(function(){console.log("ready!");var l=new CSInterface;event=new CSEvent("com.adobe.PhotoshopPersistent","APPLICATION"),event.extensionId=l.getExtensionID(),l.dispatchEvent(event);var e=!1,o=!1,i="td > a";$("#glowContainer").show(),$("#glareContainer").hide(),$("#app-progress").hide(),themeManager.init();var r=new Vue({el:"#app",data:{glowThreshold:245,glowBlur:10,sampleSize:10,glareThreshold:255,glareSize:50,glareShape:"BBTools_GG_Brush_1"},methods:{isValidNumber:function(e){return!isNaN(parseInt(e))&&isFinite(e)}},computed:{isDisabledGlow:function(){return this.glowThreshold<1||255<this.glowThreshold||this.glowBlur<1||100<this.glowBlur||(!1===this.isValidNumber(this.glowThreshold)||!1===this.isValidNumber(this.glowBlur)||void 0)},isDisabledGlare:function(){return this.glareThreshold<1||255<this.glareThreshold||this.glareSize<1||1e3<this.glareSize||this.sampleSize<1||100<this.sampleSize||(!1===this.isValidNumber(this.glareThreshold)||!1===this.isValidNumber(this.glareSize)||!1===this.isValidNumber(this.sampleSize)||void 0)}}}),a=new iro.ColorPicker("#color-picker-container",{width:170,height:170,color:"#f8d061",sliderHeight:20,sliderMargin:14,markerRadius:6});function n(){var e={glowThreshold:r.glowThreshold,glowBlur:r.glowBlur,glowColor:{r:a.color.rgb.r,g:a.color.rgb.g,b:a.color.rgb.b}};l.evalScript("createGlow("+JSON.stringify(e)+")")}function t(){$("#app").hide(),$("#app-progress").show();var e={sampleSize:r.sampleSize,glareThreshold:r.glareThreshold,glareSize:r.glareSize,glareShape:r.glareShape,glareColor:{r:a.color.rgb.r,g:a.color.rgb.g,b:a.color.rgb.b}};l.evalScript("createGlare("+JSON.stringify(e)+")",function(e){"finished"===e&&($(".circle-loader").toggleClass("load-complete"),$(".checkmark").toggle(),$("#app-progress").delay(1e3).fadeOut(300),$("#app").delay(1300).fadeIn(300),setTimeout(function(){$(".circle-loader").toggleClass("load-complete"),$(".checkmark").toggle()},1600))})}function s(){!0===e&&n()}function h(){!0===o&&t()}var c,g,u,d,p=(c=function(){s()},g=250,function(){var e=this,l=arguments,o=u&&!d;clearTimeout(d),d=setTimeout(function(){d=null,u||c.apply(e,l)},g),o&&c.apply(e,l)});$("#autoUpdateGlowValue").change(function(){e=this.checked}),$("#autoUpdateGlareValue").change(function(){o=this.checked}),a.on("color:change",function(e,l){p()}),$("#glowThreshold").change(function(){s()}),$("#glowThresholdValue").change(function(){s()}),$("#glowBlur").change(function(){s()}),$("#glowBlurValue").change(function(){s()}),$("#sampleSize").change(function(){h()}),$("#sampleSizeValue").change(function(){h()}),$("#glareThreshold").change(function(){h()}),$("#glareThresholdValue").change(function(){h()}),$("#glareSize").change(function(){h()}),$("#glareSizeValue").change(function(){h()}),$(i).click(function(){for(var e=0;e<i.length;e++)$(i).removeClass("active");$(this).addClass("active"),h()}),$("#btnCreateGlow").click(function(){n()}),$("#btnCreateGlare").click(function(){t()}),$("#glowTab").click(function(){$("#glowContainer").show(),$("#glareContainer").hide()}),$("#glareTab").click(function(){$("#glowContainer").hide(),$("#glareContainer").show()})});