ips.templates.set('vse.classes.title'," <li class='ipsToolbox_sectionTitle ipsType_reset' data-role='{{role}}'>{{title}}</li>");ips.templates.set('vse.classes.item'," <li data-styleID='{{styleid}}' data-themeKey='{{themekey}}'> {{#swatch.back}}  <input class='vseClass_swatch vseClass_swatch--back' value='{{swatch.back.color}}' data-key='{{swatch.back.key}}'> {{/swatch.back}} {{^swatch.back}}   <span class='vseClass_swatch vseClass_swatch--back vseClass_swatch--noStyle'>&times;</span> {{/swatch.back}} {{#swatch.fore}}  <input class='vseClass_swatch vseClass_swatch--fore' value='{{swatch.fore.color}}' data-key='{{swatch.fore.key}}'> {{/swatch.fore}} {{^swatch.fore}}   <span class='vseClass_swatch vseClass_swatch--fore vseClass_swatch--noStyle'>&times;</span> {{/swatch.fore}} {{title}}</li>");ips.templates.set('vse.panels.header',"  <h2 class='ipsType_sectionHead'>{{title}}</h2> {{#desc}}  <p class='ipsType_reset ipsType_light ipsType_small'>   {{desc}}  </p> {{/desc}} <br>");ips.templates.set('vse.panels.wrapper',"  <div class='vseStyleSection' data-role='{{type}}Panel'>  {{{content}}} </div>");ips.templates.set('vse.panels.background',"  <h3>{{#lang}}vseBackground{{/lang}}</h3> <div data-role='backgroundControls' class='ipsGrid'>  <div class='ipsGrid_span3'>   <div data-role='backgroundPreview' class='vseBackground_preview'>&nbsp;</div>  </div>  <div class='ipsGrid_span9'>   <input type='text' class='ipsField_fullWidth color vseBackground_color' data-role='backgroundColor' value='{{backgroundColor}}'>   <br>   <div class='ipsGrid'>    <!--<div class='ipsGrid_span6'>     <button data-ipsTooltip title='{{#lang}}vseBackground_image{{/lang}}' class='ipsButton ipsButton_primary ipsButton_verySmall ipsButton_fullWidth ipsType_center ipsType_large'><i class='fa fa-picture-o'></i></button>    </div>-->    <div class='ipsGrid_span6'>     <button data-ipsTooltip title='{{#lang}}vseBackground_gradient{{/lang}}' data-action='launchGradientEditor' class='ipsButton ipsButton_primary ipsButton_verySmall ipsButton_fullWidth ipsType_center ipsType_large'><i class='fa fa-barcode'></i></button>    </div>   </div>  </div> </div>");ips.templates.set('vse.panels.font',"  <h3>{{#lang}}vseFont_color{{/lang}}</h3> <input type='text' class='ipsField_fullWidth color' data-role='fontColor' value='{{fontColor}}'>");ips.templates.set('vse.gradient.editor',"  <div data-role='gradientPreview' class='vseBackground_gradient'></div> <div class='ipsGrid'>  <button data-action='gradientAngle' data-angle='90' class='ipsButton ipsButton_primary ipsButton_verySmall ipsGrid_span3'>    <i class='fa fa-arrow-down'></i>  </button>  <button data-action='gradientAngle' data-angle='0' class='ipsButton ipsButton_primary ipsButton_verySmall ipsGrid_span3'>   <i class='fa fa-arrow-left'></i>  </button>  <button data-action='gradientAngle' data-angle='45' class='ipsButton ipsButton_primary ipsButton_verySmall ipsGrid_span3'>   <i class='fa fa-arrow-up'></i>  </button>  <button data-action='gradientAngle' data-angle='120' class='ipsButton ipsButton_primary ipsButton_verySmall ipsGrid_span3'>   <i class='fa fa-arrow-right'></i>  </button> </div> <hr class='ipsHr'> <ul class='ipsList_reset' data-role='gradientStops'>  <li class='ipsGrid'>   <p class='ipsType_reset ipsGrid_span1'>&nbsp;</p>   <p class='ipsType_reset ipsType_light ipsType_small ipsGrid_span5'>{{#lang}}vseGradient_color{{/lang}}</p>   <p class='ipsType_reset ipsType_light ipsType_small ipsGrid_span6'>{{#lang}}vseGradient_position{{/lang}}</p>  </li>  <li class='ipsGrid'>   <p class='ipsType_reset ipsGrid_span1'>&nbsp;</p>   <p class='ipsType_reset ipsGrid_span11'><a href='#' class='ipsType_medium' data-action='gradientAddStop'>{{#lang}}vseAddStop{{/lang}}</a></p>  </li> </ul> <hr class='ipsHr'> <div class='ipsGrid'>  {{{buttons}}} </div>");ips.templates.set('vse.gradient.twoButtons'," <button data-action='saveGradient' class='ipsGrid_span8 ipsButton ipsButton_normal ipsButton_verySmall ipsButton_fullWidth'>{{#lang}}vseGradient_save{{/lang}}</button> <button data-action='cancelGradient' class='ipsGrid_span4 ipsButton ipsButton_normal ipsButton_verySmall ipsButton_fullWidth'>{{#lang}}vseCancel{{/lang}}</button>");ips.templates.set('vse.gradient.threeButtons'," <button data-action='saveGradient' class='ipsGrid_span4 ipsButton ipsButton_normal ipsButton_verySmall ipsButton_fullWidth'>{{#lang}}vseSave{{/lang}}</button> <button data-action='cancelGradient' class='ipsGrid_span4 ipsButton ipsButton_normal ipsButton_verySmall ipsButton_fullWidth'>{{#lang}}vseCancel{{/lang}}</button> <button data-action='removeGradient' class='ipsGrid_span4 ipsButton ipsButton_important ipsButton_verySmall ipsButton_fullWidth'>{{#lang}}vseDelete{{/lang}}</button>");ips.templates.set('vse.gradient.stop',"  <li class='ipsGrid'>  <span class='ipsGrid_span1 ipsType_light ipsType_center'><i class='fa fa-bars'></i></span>  <input type='text' class='ipsGrid_span5' value='{{color}}' maxlength='6' pattern='^([0-9a-zA-Z]{6})$'>  <input type='range' class='ipsGrid_span5' min='0' max='100' value='{{location}}'>  <p class='ipsType_reset ipsType_center ipsGrid_span1'><a href='#' data-action='gradientRemoveStop'><i class='fa fa-times'></i></a></p> </li>");ips.templates.set('vse.colorizer.panel',"  <p class='ipsType_light ipsPad'>  {{#lang}}vseColorizer_desc{{/lang}} </p> <div class='ipsPad'>  <div class='ipsGrid'>   <div class='ipsGrid_span5 ipsType_center'>    <input type='text' class='vseColorizer_swatch color' data-role='primaryColor' value='{{primaryColor}}'>    <span class='ipsType_light'>{{#lang}}vseColorizer_primary{{/lang}}</span>   </div>   <div class='ipsGrid_span2'></div>   <div class='ipsGrid_span5 ipsType_center'>    <input type='text' class='vseColorizer_swatch color' data-role='secondaryColor' value='{{secondaryColor}}'>    <span class='ipsType_light'>{{#lang}}vseColorizer_secondary{{/lang}}</span>   </div>  </div>  <br>  <div class='ipsGrid_span4 ipsType_center'>   <input type='text' class='vseColorizer_swatch color' data-role='textColor' value='{{textColor}}'>   <span class='ipsType_light'>{{#lang}}vseColorizer_text{{/lang}}</span>  </div>  <br><br>  <button class='ipsButton ipsButton_veryLight ipsButton_small ipsButton_fullWidth' data-action='invertColors'>{{#lang}}vseColorizer_invert{{/lang}}</button>  <br>  <button class='ipsButton ipsButton_veryLight ipsButton_small ipsButton_fullWidth' data-action='revertColorizer' disabled>{{#lang}}vseColorizer_revert{{/lang}}</button> </div>");;
;(function($,_,undefined){"use strict";ips.controller.register('core.front.vse.window',{_stylesheet:null,_variables:[],_events:{},_exclude:null,_xrayElem:null,_url:'',initialize:function(){this.on(window,'message',this.handleCommand);this.setup();},setup:function(){$('head').append($('<style/>').attr('type','text/css').attr('id','elInjectedStyles')).append($('<style/>').attr('type','text/css').attr('id','elCustomCSS'));this._stylesheet=$('#elInjectedStyles');this._custom=$('#elCustomCSS');this._root=document.documentElement;var url=ips.utils.url.getURIObject(window.location.href);this._url=url.protocol+'://'+url.host;if(url.port&&url.port!=80){this._url=this._url+':'+url.port;}
this.sendCommand('windowReady');this.sendCommand('getStylesheet');},handleCommand:function(e){if(e.originalEvent.origin!=this._url){Debug.error("Invalid origin");return;}
var pieces=e.originalEvent.data.command.split('.');var obj=this;for(var i=0;i<pieces.length-1;i++){if(!_.isUndefined(obj[pieces[i]])){obj=obj[pieces[i]];}else{Debug.error("Couldn't run vse.window."+e.originalEvent.data.command);return;}}
if(obj[pieces[pieces.length-1]]){obj[pieces[pieces.length-1]](e.originalEvent.data);}else{Debug.error("Couldn't run vse.window."+e.originalEvent.data.command);return;}},sendCommand:function(command,data){top.postMessage(_.extend(data||{},{command:command}),this._url);},updateVar:function(data){this._root.style.setProperty('--theme-'+data.var,data.color.r+", "+data.color.g+", "+data.color.b);},varValues:function(data){var self=this;_.each(data.values,function(value){self.updateVar(value);});},updateCustomCSS:function(data){this._custom.html(data.css);},selectorData:function(data){this._variables=data.variables;},createStylesheet:function(data){this._custom.html(data.stylesheet||'');},xrayStart:function(){this._createXRayElem();this._events['down']=$(document).on('mousedown.xray',_.bind(this._doDown,this));this._events['move']=$(document).on('mousemove.xray',_.bind(this._doFalse,this));this._events['over']=$(document).on('mouseover.xray',_.bind(this._doOver,this));},xrayCancel:function(){if(this._xrayElem&&this._xrayElem.length){this._xrayElem.remove();}
this._stop();},_stop:function(){$(document).off('.xray');},_doXray:function(e){e.preventDefault();var elem=$(e.target);if(elem.is(this._exclude)){return;}
var elemPosition=ips.utils.position.getElemPosition(elem);var elemDims={width:elem.outerWidth(),height:elem.outerHeight()};this._xrayElem.css({width:elemDims.width+'px',height:elemDims.height+'px',left:elemPosition.absPos.left+'px',top:elemPosition.absPos.top+'px',zIndex:ips.ui.zIndex()});},_doDown:function(e){e.preventDefault();this._doXray(e);this._stop();this._findMatchingSelectors($(e.target));},_doOver:function(e){this._doXray(e);},_doFalse:function(e){e.preventDefault();},_createXRayElem:function(){if($('#vseXRay').length){$('#vseXRay').remove();}
$('body').append($('<div/>').attr('id','vseXRay'));this._xrayElem=$('#vseXRay');},_findMatchingSelectors:function(elem){var self=this;var toReturn=[];var loopSheets=function(thisElem){var rules=self._cssRules(thisElem);if(rules.length){for(var i=0;i<rules.length;i++){var matches=rules[i].match(/\-\-theme\-(\w+)/i);if(matches&&matches.length){toReturn.push(matches[1]);}}}
if(thisElem.parentNode){loopSheets(thisElem.parentNode);}
return;};loopSheets(elem.get(0));this.sendCommand('varsMatched',{vars:toReturn});},_cssRules(el){var sheets=document.styleSheets,ret=[];if(el===document){return ret;}
el.matches=el.matches||el.webkitMatchesSelector||el.mozMatchesSelector||el.msMatchesSelector||el.oMatchesSelector;for(var i in sheets){try{var rules=sheets[i].rules||sheets[i].cssRules;for(var r in rules){var rule=this._removeVendorPrefixSelectors(rules[r].selectorText);if(el.matches(rule)){console.log(`selector text: ${rules[r].selectorText}`)
ret.push(rules[r].cssText);}}}catch(err){}}
return ret;},_removeVendorPrefixSelectors(selectorText){if(/::-/.test(selectorText)){}else{return selectorText;}}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('core.front.vse.main',{_mainFrame:null,_mainWindow:null,_frameReady:false,_data:{},_originalData:{},_xrayOn:false,_customCSSOpen:false,_url:'',_unsaved:false,_codeMirror:null,_vseData:null,initialize:function(){this.on('click','#vseStartXRay',this.toggleXRay);this.on('click','#vseColorize',this.startColorizer);this.on('click','#vseAddCustomCSS',this.toggleCustomCSS);this.on('click','[data-action="buildSkin"]',this.buildSkin);this.on('click','[data-action="cancelSkin"]',this.cancelSkin);this.on('click','#vseClassList [data-styleID]',this.selectClass);this.on('click','[data-action="back"]',this.editorBack);this.on('change.spectrum move.spectrum',this.colorChange);this.on('colorized',this.styleColorized);this.on('styleUpdated',this.styleUpdated);this.on('revertChanges',this.revertChanges);this.on('invertColors',this.invertColors);this.on('click','[data-action="colorizerBack"]',this.colorizerBack);this.on('closeColorizer',this.colorizerBack);this.on('change','#ipsTabs_vseSection_vseSettingsTab_panel :input',this.settingChanged);this.on(window,'message',this.handleCommand);this.on(window,'beforeunload',this.windowBeforeUnload);this.setup();},setup:function(){var self=this;this._mainFrame=$('#vseMainWrapper');this._mainWindow=this._mainFrame.find('iframe').get(0).contentWindow;if(!ipsVSEData||!_.isObject(ipsVSEData)||!colorizer||!_.isObject(colorizer)){Debug.error("VSE JSON data not found, cannot continue.");return;}
var url=ips.utils.url.getURIObject(window.location.href);this._url=url.protocol+'://'+url.host;if(url.port&&url.port!=80){this._url=this._url+':'+url.port;}
this._codeMirror=CodeMirror.fromTextArea(document.getElementById('vseCustomCSS_editor'),{mode:'css',lineWrapping:true,lineNumbers:true});this._codeMirror.setSize(null,235);this._codeMirror.on('change',function(doc,cm){self._updateCustomCSS();});$('#vseCustomCSS').hide();this._buildClassList();},colorChange:function(e,color){this._updateCssVar($(e.target).attr('data-key'),color);},invertColors:function(e){e.preventDefault();var swatches=this.scope.find('#vseClassList input.vseClass_swatch');var self=this;_.each(swatches,function(swatch){var $swatch=$(swatch);var setting=$swatch.attr('data-key');var color=$swatch.spectrum('get').toHsl();color.l=1-color.l;var updatedColor=$swatch.spectrum('set',color).spectrum('get');self._updateCssVar(setting,updatedColor);});},_updateCssVar:function(key,color){if(_.isUndefined(color)){return;}
this.sendCommand('updateVar',{var:key,color:color.toRgb()});this._unsaved=true;},_getVSEData:function(){if(_.isObject(this._vseData)){return this._vseData;}
this._vseData=ipsVSEData;this._vseData.colors=ipsResumeVse.colors;return this._vseData;},_buildClassList:function(){var self=this;var output='';_.each(this._getVSEData().sections,function(value,key){output+=ips.templates.render('vse.classes.title',{title:ips.getString('vseSection_'+key),key:key});if(_.isObject(value)&&_.size(value)){_.each(value,function(item,itemKey){output+=ips.templates.render('vse.classes.item',{title:item.title,styleid:key+'_'+itemKey,swatch:self._buildSwatch(item,true)});});}});this.scope.find('#vseClassList > ul').html(output);ips.loader.get(['core/interface/spectrum/spectrum.js']).then(function(){var inputs=self.scope.find('#vseClassList input.vseClass_swatch');inputs.each(function(){var options={type:"color",clickoutFiresChange:true,hideAfterPaletteSelect:true,preferredFormat:"hex",showAlpha:false,allowEmpty:false,showInput:true,showInitial:true,replacerClassName:this.className};$(this).spectrum(options);})});},_buildSwatch:function(data,toString){var toReturn={back:false,fore:false};if(!_.isUndefined(data.settings.background)&&!_.isUndefined(this._vseData.colors[data.settings.background])){toReturn.back={color:"rgb("+this._vseData.colors[data.settings.background]+")",key:data.settings.background};}
if(!_.isUndefined(data.settings.foreground)&&!_.isUndefined(this._vseData.colors[data.settings.foreground])){toReturn.fore={color:"rgb("+this._vseData.colors[data.settings.foreground]+")",key:data.settings.foreground};}
return toReturn;},styleColorized:function(e,data){var hue=data.color.h;var type=data.type;var settings=colorizer[type];var self=this;var sat=data.color.s*100;var lig=data.color.l*100;_.each(settings,function(setting){var control=self.scope.find('[data-key="'+setting+'"]');if(!control.length){return;}
var currentColor=tinycolor('rgb('+self._vseData.colors[setting]+')').toHsl();currentColor.h=data.color.h;currentColor.s=Math.max(Math.min((sat / 100)*currentColor.s,1),0);var currentLig=currentColor.l*100;var newLig=data.color.l*100;var lightnessDiff=currentLig-newLig;var remainder=100-currentLig;var percentDiff=(lightnessDiff / 100)*remainder;var fraction=percentDiff / 100;currentColor.l=currentColor.l-fraction;var updatedColor=control.spectrum('set',currentColor).spectrum('get');self._updateCssVar(setting,updatedColor);});},sendCommand:function(command,data){this._mainWindow.postMessage(_.extend(data||{},{command:command}),this._url);},handleCommand:function(e){if(e.originalEvent.origin!=this._url){Debug.error("Invalid origin");return;}
var commandName='command'+e.originalEvent.data.command.charAt(0).toUpperCase()+e.originalEvent.data.command.slice(1);if(!_.isUndefined(this[commandName])){this[commandName](e.originalEvent.data);}},startColorizer:function(e){e.preventDefault();$('#vseColorize, #vseStartXRay').attr('disabled',true);this.scope.find('#vseClassWrap').hide();ips.utils.anim.go('fadeIn',this.scope.find('#vseColorizerPanel'));},colorizerBack:function(e){e.preventDefault();$('#vseColorize, #vseStartXRay').attr('disabled',false);this.scope.find('#vseColorizerPanel').hide();ips.utils.anim.go('fadeIn',this.scope.find('#vseClassWrap'));},toggleCustomCSS:function(e){e.preventDefault();if(this._customCSSOpen){$(e.currentTarget).removeClass('ipsButton_normal').addClass('ipsButton_primary');this._customCSSOpen=false;$('#vseCustomCSS').hide();$('#vseMainWrapper').css({bottom:'0px'});}else{$(e.currentTarget).removeClass('ipsButton_primary').addClass('ipsButton_normal');this._customCSSOpen=true;ips.utils.anim.go('fadeIn',$('#vseCustomCSS'));$('#vseMainWrapper').css({bottom:'300px'});}},toggleXRay:function(e){e.preventDefault();if(this._xrayOn){$(e.currentTarget).removeClass('ipsButton_normal').addClass('ipsButton_primary');this._xrayOn=false;this.stopXRay();}else{$(e.currentTarget).removeClass('ipsButton_primary').addClass('ipsButton_normal');this._xrayOn=true;this.startXRay();}},startXRay:function(){this.sendCommand('xrayStart');},stopXRay:function(){this.sendCommand('xrayCancel');this.scope.find('#vseClassList > ul').find('> li[data-role="xrayResultsTitle"]').remove().end().find('> li').show();},_updateCustomCSS:function(){this._unsaved=true;this._codeMirror.save();this.sendCommand('updateCustomCSS',{css:$('#vseCustomCSS_editor').val()});},commandWindowReady:function(){this._frameReady=true;ips.loader.get(["core/interface/spectrum/spectrum.js"]).then(()=>{this.sendCommand("varValues",{values:this._getVarValues()});});},commandGetStylesheet:function(){this.sendCommand('createStylesheet',{stylesheet:this.scope.find('#vseCustomCSS_editor').val()});},commandVarsMatched:function(data){this.scope.find('#vseClassList > ul > li').hide();var selector=_.map(data.vars,function(thisVar){return"[data-key='"+thisVar+"']";}).join(',');this.scope.find('#vseClassList > ul').find(selector).closest('li').show();},_getVarValues:function(){var swatches=this.scope.find('#vseClassList input.vseClass_swatch');var output=[];_.each(swatches,function(swatch){output.push({var:$(swatch).attr('data-key'),color:$(swatch).spectrum('get').toRgb()});});return output;},windowBeforeUnload:function(e){if(this._unsaved){return"You haven't saved this theme. By leaving this page, you will lose any changes you've made.";}},buildSkin:function(e){var self=this;if(!this._unsaved){ips.ui.alert.show({type:'alert',icon:'info',message:ips.getString('vseNoChanges'),callbacks:{}});return;}
ips.getAjax()(ipsSettings['baseURL']+'?app=core&module=system&controller=vse&do=build'+'&csrfKey='+ipsSettings['csrfKey'],{type:'post',data:this._buildFinalStyleData(),showLoading:true}).done(function(response){self._unsaved=false;ips.ui.alert.show({type:'verify',icon:'success',message:ips.getString('vseSkinBuilt'),buttons:{yes:ips.getString('yes'),no:ips.getString('no')},callbacks:{yes:function(){self._closeEditor(ipsSettings['baseURL']+'?app=core&module=system&controller=vse&do=home&id='+response.theme_set_id+'&csrfKey='+ipsSettings['csrfKey']);}}});}).fail(function(jqXHR,textStatus,errorThrown){Debug.log("Error saving theme:");Debug.error(textStatus);ips.ui.alert.show({type:'alert',icon:'warn',message:ips.getString('vseSkinBuilt_error'),callbacks:{}});});},cancelSkin:function(e){e.preventDefault();var self=this;if(this._unsaved){ips.ui.alert.show({type:'confirm',icon:'question',message:ips.getString('vseUnsaved'),callbacks:{ok:function(){self._closeEditor($(e.currentTarget).attr('href'));}}});}else{this._closeEditor($(e.currentTarget).attr('href'));}},settingChanged:function(){this._unsaved=true;},revertChanges:function(){var self=this;var swatches=this.scope.find('#vseClassList input.vseClass_swatch');_.each(swatches,function(swatch){var $swatch=$(swatch);var setting=$swatch.attr('data-key');var originalColor=self._vseData.colors[setting];var updatedColor=$swatch.spectrum('set','rgb('+originalColor+')').spectrum('get');self._updateCssVar(setting,updatedColor);});this._unsaved=false;},_buildFinalStyleData:function(){var self=this;var settingsObj={};var stylesObj={};var styleBlock='';var orig=this._originalData;var swatches=this.scope.find('#vseClassList input.vseClass_swatch');var colors={};_.each(swatches,function(swatch){var $swatch=$(swatch);colors[$swatch.attr('data-key')]='#'+$swatch.spectrum('get').toHex();});this.scope.find('#ipsTabs_vseSection_vseSettingsTab_panel :input[name]').each(function(){if($(this).attr('name').match(/_checkbox$/)){settingsObj[$(this).attr('name').replace(/_checkbox$/,'')]=$(this).is(':checked')?1:0;}else if($(this).attr('type')=='radio'){settingsObj[$(this).attr('name')]=$('#ipsTabs_vseSection_vseSettingsTab_panel input[name='+$(this).attr('name')+']:checked').val();}else{settingsObj[$(this).attr('name')]=$(this).val();}});return{customcss:$('#vseCustomCSS_editor').val(),colors:colors,settings:settingsObj};},_closeEditor:function(url){ips.getAjax()(ipsSettings['baseURL']+'?app=core&module=system&controller=vse&do=close',{showLoading:true}).always(function(){window.location=url||ips.getSetting('baseURL');});},});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('core.front.vse.colorizer',{initialize:function(){this.on('change.spectrum move.spectrum',this.colorChanged);this.on('click','[data-action="revertColorizer"]',this.revertChanges);this.on('click','[data-action="invertColors"]',this.invertColors);this.setup();},setup:function(){var colors={};var self=this;Debug.log(this.scope.data('styleData'));_.each(colorizer.startColors,function(value,key){colors[key]='#'+value;});this.scope.html(ips.templates.render('vse.colorizer.panel',colors));ips.loader.get(['core/interface/spectrum/spectrum.js']).then(function(){var inputs=self.scope.find('input[type="text"].color');inputs.each(function(){var options={type:"color",clickoutFiresChange:true,hideAfterPaletteSelect:true,preferredFormat:"hex",showAlpha:false,allowEmpty:false,showInput:true,showInitial:true,replacerClassName:this.className};$(this).attr('data-original',$(this).val()).spectrum(options);})});},colorChanged:function(e,color){var self=this;var type=$(e.target).attr('data-role');var hsl=color.toHsl();if(_.isUndefined(colorizer[type])){Debug.error("Can't find data for "+type);return;}
this.trigger('colorized',{color:color.toHsl(),type:type});this.scope.find('[data-action="revertColorizer"]').attr('disabled',false);},revertChanges:function(e){var self=this;ips.ui.alert.show({type:'confirm',icon:'warn',message:ips.getString('vseRevert'),subText:ips.getString('vseRevert_subtext'),callbacks:{ok:function(){self.trigger('revertChanges');self.trigger('closeColorizer');self.scope.find('.vseColorizer_swatch').each(function(){$(this).spectrum('set',$(this).attr('data-original'));});}}});},invertColors:function(e){e.preventDefault();this.trigger('invertColors');},_updatebackground:function(styleData,styleKey,h,s){if(_.isUndefined(styleData.background)){return;}
if(styleData.background.color){styleData.background.color=ips.utils.color.convertHex(styleData.background.color,h,s);}
if(styleData.background.gradient){for(var i=0;i<styleData.background.gradient.stops.length;i++){styleData.background.gradient.stops[i][0]=ips.utils.color.convertHex(styleData.background.gradient.stops[i][0],h,s);}}
this.trigger('styleUpdated',{selector:styleData.selector});},_updatefont:function(styleData,styleKey,h,s){if(_.isUndefined(styleData.font)||_.isUndefined(styleData.font.color)){return;}
styleData.font.color=ips.utils.color.convertHex(styleData.font.color,h,s);this.trigger('styleUpdated',{selector:styleData.selector});}});}(jQuery,_));;