/* jce - 2.9.2 | 2021-01-28 | https://www.joomlacontenteditor.net | Copyright (C) 2006 - 2020 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
!function($){var each=tinymce.each,htmlSchema=new tinymce.html.Schema({schema:"html5-strict"}),defaultAttributes={frameborder:1,scrolling:"auto"},validAttributes=["scrolling","frameborder"],IframeDialog={settings:{},init:function(){var attribs,self=this,ed=tinyMCEPopup.editor,elm=ed.selection.getNode();if(tinyMCEPopup.restoreSelection(),TinyMCE_Utils.fillClassList("classlist"),Wf.init(),this.settings.file_browser&&Wf.createBrowsers($("#src"),function(files,data){file=data[0],$("#src").val(file.url),file.width&&$("#width").val(file.width).data("tmp",file.width).trigger("change"),file.height&&$("#height").val(file.height).data("tmp",file.height).trigger("change")}),$("#insert").on("click",function(){self.insert()}),/mce-object/.test(elm.className)){var mediaApi=ed.plugins.media,data=mediaApi.getMediaData(),attribs={};each(data,function(value,name){if("class"===name&&(name="classes",value=value.replace(/mce-(.*)/g,"").replace(/\s+/g," ").trim()),"style"===name){var styleObject=ed.dom.parseStyle(value);each(["top","right","bottom","left"],function(pos){attribs["margin_"+pos]=self.getAttrib(elm,"margin-"+pos),delete styleObject["margin-"+pos]}),tinymce.each(["width","style","color"],function(at){attribs["border_"+at]=self.getAttrib(elm,"border-"+at),delete styleObject["border-"+at]}),delete styleObject.width,delete styleObject.height,value=ed.dom.serializeStyle(styleObject)}"align"===name&&(value=self.getAttrib(elm,"align")),attribs[name]=value}),attribs&&($(".uk-button-text","#insert").text(tinyMCEPopup.getLang("update","Update",!0)),each(["width","height"],function(key){var value=attribs[key]||parseFloat(ed.dom.getAttrib(elm,key)||ed.dom.getStyle(elm,key))||"";$("#"+key).val(value).data("tmp",value),delete attribs[key]}),each(attribs,function(val,key){$("#"+key).is(":checkbox")?(/\d/.test(val)&&(val=parseInt(val)),$("#"+key).prop("checked",!!val)):$("#"+key).val(val).trigger("change")}))}else Wf.setDefaults(this.settings.defaults);WFAggregator.setup({embed:!1}),$("#src").on("change",function(){var data={},v=this.value;(s=WFAggregator.isSupported(v))?(data=WFAggregator.getAttributes(s,v),$(".aggregator_option, .options_description","#options_tab").hide().filter("."+s).show()):$(".options_description","#options_tab").show();for(n in data){var $el=$("#"+n),v=data[n];"width"==n||"height"==n?""!==$el.val()&&$el.hasClass("edited")!==!1||$("#"+n).val(data[n]).data("tmp",data[n]).trigger("change"):$el.is(":checkbox")?(v=parseInt(v),$el.attr("checked",v).prop("checked",v)):$el.val(v)}}).trigger("change"),$(".uk-equalize-checkbox").trigger("equalize:update"),$(".uk-form-controls select").datalist().trigger("datalist:update"),$(".uk-datalist").trigger("datalist:update")},getAttrib:function(e,at){return Wf.getAttrib(e,at)},checkPrefix:function(n){var self=this,v=$(n).val();/^\s*www./i.test(v)?Wf.Modal.confirm(tinyMCEPopup.getLang("iframe_dlg.is_external","The URL you entered seems to be an external link, do you want to add the required http:// prefix?"),function(state){state&&$(n).val("http://"+v),self.insert()}):this.insertAndClose()},insert:function(){tinyMCEPopup.editor;return""===$("#src").val()?(Wf.Modal.alert(tinyMCEPopup.getLang("iframe_dlg.no_src","Please enter a url for the iframe")),!1):""===$("#width").val()||""===$("#height").val()?(Wf.Modal.alert(tinyMCEPopup.getLang("iframe_dlg.no_dimensions","Please enter a width and height for the iframe")),!1):this.checkPrefix($("#src"))},insertAndClose:function(){tinyMCEPopup.restoreSelection();var provider,ed=tinyMCEPopup.editor,data={},args={},elm=ed.selection.getNode();$("input[id], select[id]").each(function(){var value=$(this).val(),name=this.id;$(this).is(":checkbox")&&(value=!!$(this).is(":checked")),"frameborder"===name&&(value=value?1:0),"classes"===name&&(name="class"),value===defaultAttributes[name]&&(value=""),(tinymce.inArray(validAttributes,name)!==-1||htmlSchema.isValid("iframe",name))&&(data[name]=value)}),data.width=data.width||384,data.height=data.height||216,elm=ed.dom.getParent(elm,".mce-object-iframe"),ed.dom.hasClass(elm,"mce-object-preview")&&(elm=elm.firstChild);var innerHTML=$.trim($("#html").val());(provider=WFAggregator.isSupported(data.src))&&$.extend(!0,data,WFAggregator.getValues(provider,data.src)),ed.undoManager.add();var mediaApi=ed.plugins.media;if(elm)data.html=innerHTML,mediaApi.updateMedia(data);else{each(data,function(value,name){""!==value&&(args[name]=value)});var html=ed.dom.createHTML("iframe",args,innerHTML);ed.execCommand("mceInsertContent",!1,html,{skip_undo:1})}tinyMCEPopup.close()}};window.IframeDialog=IframeDialog,tinyMCEPopup.onInit.add(IframeDialog.init,IframeDialog)}(jQuery,tinyMCEPopup);