!function(){var t=function(t){t.fn.imageDialog=function(){var t,e=this.cm,a=this.lang,i=this.editor,o=this.settings,l=e.getCursor(),n=e.getSelection(),d=a.dialog.image,r=this.classPrefix,c=r+"image-iframe",s=r+"image-dialog";e.focus();if(i.find("."+s).length<1){var u=(new Date).getTime(),f=o.imageUploadURL+(o.imageUploadURL.indexOf("?")>=0?"&":"?")+"guid="+u;o.crossDomainUpload&&(f+="&callback="+o.uploadCallbackURL+"&dialog_id=editormd-image-dialog-"+u);var g='<form action="'+f+'" target="'+c+'" method="post" enctype="multipart/form-data" class="'+r+'form"><iframe name="'+c+'" id="'+c+'" guid="'+u+'"></iframe><label>'+d.url+"</label><input type=\"text\" placeholder='http://www.example.com/test.jpg' data-url />"+function(){return'<div class="'+r+'file-input"><input type="button" class=\'editormd-btn\' value="'+d.uploadButton+'" /></div>'}()+"<br/><label>"+d.alt+'</label><input type="text" value="'+n+'" data-alt /><br/><label>'+d.link+"</label><input type=\"text\" placeholder='http://www.example.com/' data-link /><br/></form>";t=this.createDialog({title:d.title,width:465,height:254,name:s,content:g,mask:o.dialogShowMask,drag:o.dialogDraggable,lockScreen:o.dialogLockScreen,maskStyle:{opacity:o.dialogMaskOpacity,backgroundColor:o.dialogMaskBgColor},buttons:{enter:[a.buttons.enter,function(){var t=this.find("[data-url]").val(),a=this.find("[data-alt]").val(),i=this.find("[data-link]").val(),o=""!==a?' "'+a+'"':"";return""===i||"http://"===i?e.replaceSelection("!["+a+"]("+t+o+")"):e.replaceSelection("[!["+a+"]("+t+o+")]("+i+o+")"),""===a&&e.setCursor(l.line,l.ch+2),this.hide().lockScreen(!1).hideMask(),!1}],cancel:[a.buttons.cancel,function(){return this.hide().lockScreen(!1).hideMask(),!1}]}}),t.attr("id",r+"image-dialog-"+u)}t=i.find("."+s),t.find('[type="text"]').val(""),t.find("[data-link]").val(""),t.find('[type="button"]').on("click",function(){window.callback.mdeditorUploadImage(function(e){t.find("[data-url]").val(e[0])})}),this.dialogShowMask(t),this.dialogLockScreen(),t.show()}};"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=t:"function"==typeof define?define.amd?define(["editormd"],function(e){t(e)}):define(function(e){var a=e("./../../editormd");t(a)}):t(window.editormd)}();