Easy Watermark - Version 1.0.6

Version Description

  • [Fixed] Compatibility with other media-related plugins
  • [Fixed] Backup file paths on Windows
  • [Fixed] Bulk actions in media library list view
Download this release

Release Info

Developer bracketspace
Plugin Icon Easy Watermark
Version 1.0.6
Comparing to
See all releases

Code changes from version 1.0.5 to 1.0.6

assets/dist/scripts/attachment-edit.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="../",n(n.s=21)}({0:function(t,e){t.exports=jQuery},1:function(t,e,n){"use strict";n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return o})),n.d(e,"d",(function(){return c}));var r=n(0),i=n.n(r);function s(t,e="info"){const n=i()(document.createElement("div")),r=i()(document.createElement("p")),s=i()(document.createElement("button"));n.addClass("notice notice-"+e+" is-dismissible").hide(),s.addClass("notice-dismiss"),r.html(t),n.append(r).append(s),s.on("click",t=>{t.preventDefault(),n.fadeOut(200,()=>{n.remove()})}),i()("hr.wp-header-end").after(n),n.fadeIn(200)}function a(t,e=!1,n=!0){let r=t.length;for(const i of t.clone().models)(!c(i)||i.get("usedAsWatermark")||!0===e&&!i.get("hasBackup"))&&(!0===n&&t.remove(i),r--);return r}function o(t,e){const n=t.indexOf("?");return-1!==n&&(t=t.substr(0,n)),t+="?v="+e}function c(t){return"object"==typeof t&&t.get&&(t=t.get("mime")),Object.keys(ew.mime).includes(t)}},21:function(t,e,n){"use strict";n.r(e);n(28);var r=n(0),i=n.n(r),s=n(1);new class{constructor(){this.handleClick=this.handleClick.bind(this),this.metabox=i()("#watermarks"),this.metaboxContent=this.metabox.find(".watermarks-metabox"),this.errorMessage=this.metabox.find(".error-message"),this.spinners=this.metabox.find(".spinner"),this.buttons=this.metabox.find("button"),this.form=i()("form#post"),this.postID=this.form.find("#post_ID").val(),this.headerEnd=i()("hr.wp-header-end"),this.image=i()(".wp_attachment_image img.thumbnail"),this.metabox.on("click","button",this.handleClick)}handleClick(t){t.preventDefault();const e=i()(t.target),n=e.data("action");this.buttons.prop("disabled",!0),e.next(".spinner").css("visibility","visible"),this.errorMessage.hide();const r={action:"easy-watermark/"+n,nonce:e.data("nonce"),attachment_id:this.postID};"apply_single"===n&&(r.watermark=e.data("watermark")),i.a.ajax(ajaxurl,{data:r}).done(t=>{if(!0===t.success){if(this.metaboxContent.replaceWith(t.data.metaboxContent),this.metaboxContent=this.metabox.find(".watermarks-metabox"),this.errorMessage=this.metabox.find(".error-message"),this.spinners=this.metabox.find(".spinner"),this.buttons=this.metabox.find("button"),t.data.attachmentVersion){const e=Object(s.c)(this.image.attr("src"),t.data.attachmentVersion);this.image.attr("src",e),"string"==typeof t.data.message&&Object(s.a)(t.data.message,"success")}}else{const e="string"==typeof t.data.message?t.data.message:ew.genericErrorMessage;Object(s.a)(e,"error")}}).fail(()=>{Object(s.a)(ew.genericErrorMessage,"error")}).complete(()=>{this.spinners.css("visibility","hidden"),this.buttons.prop("disabled",!1)})}}},28:function(t,e){}});
1
+ !function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="../",n(n.s=21)}({0:function(e,t){e.exports=jQuery},1:function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return s})),n.d(t,"c",(function(){return c})),n.d(t,"d",(function(){return u}));var r=n(0),a=n.n(r);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=a()(document.createElement("div")),r=a()(document.createElement("p")),o=a()(document.createElement("button"));n.addClass("notice notice-"+t+" is-dismissible").hide(),o.addClass("notice-dismiss"),r.html(e),n.append(r).append(o),o.on("click",(function(e){e.preventDefault(),n.fadeOut(200,(function(){n.remove()}))})),a()("hr.wp-header-end").after(n),n.fadeIn(200)}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.length,a=!0,o=!1,i=void 0;try{for(var s,c=e.clone().models[Symbol.iterator]();!(a=(s=c.next()).done);a=!0){var f=s.value;(!u(f)||f.get("usedAsWatermark")||!0===t&&!f.get("hasBackup"))&&(!0===n&&e.remove(f),r--)}}catch(e){o=!0,i=e}finally{try{a||null==c.return||c.return()}finally{if(o)throw i}}return r}function c(e,t){var n=e.indexOf("?");return-1!==n&&(e=e.substr(0,n)),e+="?v="+t}function u(e){return"object"===o(e)&&e.get&&(e=e.get("mime")),Object.keys(ew.mime).includes(e)}},21:function(e,t,n){"use strict";n.r(t);n(28);var r=n(0),a=n.n(r),o=n(1);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.handleClick=this.handleClick.bind(this),this.metabox=a()("#watermarks"),this.metaboxContent=this.metabox.find(".watermarks-metabox"),this.errorMessage=this.metabox.find(".error-message"),this.spinners=this.metabox.find(".spinner"),this.buttons=this.metabox.find("button"),this.form=a()("form#post"),this.postID=this.form.find("#post_ID").val(),this.headerEnd=a()("hr.wp-header-end"),this.image=a()(".wp_attachment_image img.thumbnail"),this.metabox.on("click","button",this.handleClick)}var t,n,r;return t=e,(n=[{key:"handleClick",value:function(e){var t=this;e.preventDefault();var n=a()(e.target),r=n.data("action");this.buttons.prop("disabled",!0),n.next(".spinner").css("visibility","visible"),this.errorMessage.hide();var i={action:"easy-watermark/"+r,nonce:n.data("nonce"),attachment_id:this.postID};"apply_single"===r&&(i.watermark=n.data("watermark")),a.a.ajax(ajaxurl,{data:i}).done((function(e){if(!0===e.success){if(t.metaboxContent.replaceWith(e.data.metaboxContent),t.metaboxContent=t.metabox.find(".watermarks-metabox"),t.errorMessage=t.metabox.find(".error-message"),t.spinners=t.metabox.find(".spinner"),t.buttons=t.metabox.find("button"),e.data.attachmentVersion){var n=Object(o.c)(t.image.attr("src"),e.data.attachmentVersion);t.image.attr("src",n),"string"==typeof e.data.message&&Object(o.a)(e.data.message,"success")}}else{var r="string"==typeof e.data.message?e.data.message:ew.genericErrorMessage;Object(o.a)(r,"error")}})).fail((function(){Object(o.a)(ew.genericErrorMessage,"error")})).complete((function(){t.spinners.css("visibility","hidden"),t.buttons.prop("disabled",!1)}))}}])&&i(t.prototype,n),r&&i(t,r),e}())},28:function(e,t){}});
assets/dist/scripts/dashboard.js CHANGED
@@ -1,3 +1,3 @@
1
- !function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="../",n(n.s=20)}([function(t,e){t.exports=jQuery},function(t,e,n){"use strict";n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return r})),n.d(e,"c",(function(){return a})),n.d(e,"d",(function(){return l}));var o=n(0),i=n.n(o);function s(t,e="info"){const n=i()(document.createElement("div")),o=i()(document.createElement("p")),s=i()(document.createElement("button"));n.addClass("notice notice-"+e+" is-dismissible").hide(),s.addClass("notice-dismiss"),o.html(t),n.append(o).append(s),s.on("click",t=>{t.preventDefault(),n.fadeOut(200,()=>{n.remove()})}),i()("hr.wp-header-end").after(n),n.fadeIn(200)}function r(t,e=!1,n=!0){let o=t.length;for(const i of t.clone().models)(!l(i)||i.get("usedAsWatermark")||!0===e&&!i.get("hasBackup"))&&(!0===n&&t.remove(i),o--);return o}function a(t,e){const n=t.indexOf("?");return-1!==n&&(t=t.substr(0,n)),t+="?v="+e}function l(t){return"object"==typeof t&&t.get&&(t=t.get("mime")),Object.keys(ew.mime).includes(t)}},function(t,e){t.exports=Backbone},function(t,e,n){var o=n(5);o.registerPlugin(n(9)),t.exports=o},,function(t,e,n){n(6),n(7).polyfill();var o=n(8),i=function(t){if(void 0!==t){var e=document.createElement("div");return e.appendChild(document.createTextNode(t)),e.innerHTML}return""},s=function(t,e){if("string"==typeof e&&0!==e.length)for(var n=e.split(" "),o=0;o<n.length;o++){var i=n[o];i.length&&t.classList.add(i)}},r=function(){var t=document.createElement("div"),e={animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oanimationend",msAnimation:"MSAnimationEnd"};for(var n in e)if(void 0!==t.style[n])return e[n];return!1}(),a="vex",l="vex-content",c="vex-overlay",u="vex-close",d="vex-closing",f="vex-open",p={},h=1,m=!1,b={open:function(t){var e=function(t){console.warn('The "'+t+'" property is deprecated in vex 3. Use CSS classes and the appropriate "ClassName" options, instead.'),console.warn("See http://github.hubspot.com/vex/api/advanced/#options")};t.css&&e("css"),t.overlayCSS&&e("overlayCSS"),t.contentCSS&&e("contentCSS"),t.closeCSS&&e("closeCSS");var n={};n.id=h++,p[n.id]=n,n.isOpen=!0,n.close=function(){if(!this.isOpen)return!0;var t=this.options;if(m&&!t.escapeButtonCloses)return!1;if(!1===function(){return!t.beforeClose||t.beforeClose.call(this)}.bind(this)())return!1;this.isOpen=!1;var e=window.getComputedStyle(this.contentEl);function n(t){return"none"!==e.getPropertyValue(t+"animation-name")&&"0s"!==e.getPropertyValue(t+"animation-duration")}var o=n("")||n("-webkit-")||n("-moz-")||n("-o-"),i=function e(){this.rootEl.parentNode&&(this.rootEl.removeEventListener(r,e),this.overlayEl.removeEventListener(r,e),delete p[this.id],this.rootEl.parentNode.removeChild(this.rootEl),this.bodyEl.removeChild(this.overlayEl),t.afterClose&&t.afterClose.call(this),0===Object.keys(p).length&&document.body.classList.remove(f))}.bind(this);return r&&o?(this.rootEl.addEventListener(r,i),this.overlayEl.addEventListener(r,i),this.rootEl.classList.add(d),this.overlayEl.classList.add(d)):i(),!0},"string"==typeof t&&(t={content:t}),t.unsafeContent&&!t.content?t.content=t.unsafeContent:t.content&&(t.content=i(t.content));var g=n.options=Object.assign({},b.defaultOptions,t),v=n.bodyEl=document.getElementsByTagName("body")[0],y=n.rootEl=document.createElement("div");y.classList.add(a),s(y,g.className);var w=n.overlayEl=document.createElement("div");w.classList.add(c),s(w,g.overlayClassName),g.overlayClosesOnClick&&y.addEventListener("click",(function(t){t.target===y&&n.close()})),v.appendChild(w);var x=n.contentEl=document.createElement("div");if(x.classList.add(l),s(x,g.contentClassName),x.appendChild(g.content instanceof window.Node?g.content:o(g.content)),y.appendChild(x),g.showCloseButton){var k=n.closeEl=document.createElement("div");k.classList.add(u),s(k,g.closeClassName),k.addEventListener("click",n.close.bind(n)),x.appendChild(k)}return document.querySelector(g.appendLocation).appendChild(y),g.afterOpen&&g.afterOpen.call(n),document.body.classList.add(f),n},close:function(t){var e;if(t.id)e=t.id;else{if("string"!=typeof t)throw new TypeError("close requires a vex object or id string");e=t}return!!p[e]&&p[e].close()},closeTop:function(){var t=Object.keys(p);return!!t.length&&p[t[t.length-1]].close()},closeAll:function(){for(var t in p)this.close(t);return!0},getAll:function(){return p},getById:function(t){return p[t]}};window.addEventListener("keyup",(function(t){27===t.keyCode&&(m=!0,b.closeTop(),m=!1)})),window.addEventListener("popstate",(function(){b.defaultOptions.closeAllOnPopState&&b.closeAll()})),b.defaultOptions={content:"",showCloseButton:!0,escapeButtonCloses:!0,overlayClosesOnClick:!0,appendLocation:"body",className:"",overlayClassName:"",contentClassName:"",closeClassName:"",closeAllOnPopState:!0},Object.defineProperty(b,"_escapeHtml",{configurable:!1,enumerable:!1,writable:!1,value:i}),b.registerPlugin=function(t,e){var n=t(b),o=e||n.name;if(b[o])throw new Error("Plugin "+e+" is already registered.");b[o]=n},t.exports=b},function(t,e){
2
  /*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
3
- "document"in window.self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||function(t){"use strict";if("Element"in t){var e=t.Element.prototype,n=Object,o=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},i=Array.prototype.indexOf||function(t){for(var e=0,n=this.length;e<n;e++)if(e in this&&this[e]===t)return e;return-1},s=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},r=function(t,e){if(""===e)throw new s("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new s("INVALID_CHARACTER_ERR","String contains an invalid character");return i.call(t,e)},a=function(t){for(var e=o.call(t.getAttribute("class")||""),n=e?e.split(/\s+/):[],i=0,s=n.length;i<s;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute("class",this.toString())}},l=a.prototype=[],c=function(){return new a(this)};if(s.prototype=Error.prototype,l.item=function(t){return this[t]||null},l.contains=function(t){return-1!==r(this,t+="")},l.add=function(){var t,e=arguments,n=0,o=e.length,i=!1;do{t=e[n]+"",-1===r(this,t)&&(this.push(t),i=!0)}while(++n<o);i&&this._updateClassName()},l.remove=function(){var t,e,n=arguments,o=0,i=n.length,s=!1;do{for(t=n[o]+"",e=r(this,t);-1!==e;)this.splice(e,1),s=!0,e=r(this,t)}while(++o<i);s&&this._updateClassName()},l.toggle=function(t,e){t+="";var n=this.contains(t),o=n?!0!==e&&"remove":!1!==e&&"add";return o&&this[o](t),!0===e||!1===e?e:!n},l.toString=function(){return this.join(" ")},n.defineProperty){var u={get:c,enumerable:!0,configurable:!0};try{n.defineProperty(e,"classList",u)}catch(t){void 0!==t.number&&-2146823252!==t.number||(u.enumerable=!1,n.defineProperty(e,"classList",u))}}else n.prototype.__defineGetter__&&e.__defineGetter__("classList",c)}}(window.self),function(){"use strict";var t=document.createElement("_");if(t.classList.add("c1","c2"),!t.classList.contains("c2")){var e=function(t){var e=DOMTokenList.prototype[t];DOMTokenList.prototype[t]=function(t){var n,o=arguments.length;for(n=0;n<o;n++)t=arguments[n],e.call(this,t)}};e("add"),e("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:n.call(this,t)}}t=null}())},function(t,e,n){"use strict";function o(t,e){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var n=Object(t),o=1;o<arguments.length;o++){var i=arguments[o];if(null!=i)for(var s=Object.keys(Object(i)),r=0,a=s.length;r<a;r++){var l=s[r],c=Object.getOwnPropertyDescriptor(i,l);void 0!==c&&c.enumerable&&(n[l]=i[l])}}return n}t.exports={assign:o,polyfill:function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:o})}}},function(t,e){t.exports=function(t,e){if("string"!=typeof t)throw new TypeError("String expected");e||(e=document);var n=/<([\w:]+)/.exec(t);if(!n)return e.createTextNode(t);t=t.replace(/^\s+|\s+$/g,"");var o=n[1];if("body"==o){return(s=e.createElement("html")).innerHTML=t,s.removeChild(s.lastChild)}var s,r=i[o]||i._default,a=r[0],l=r[1],c=r[2];(s=e.createElement("div")).innerHTML=l+t+c;for(;a--;)s=s.lastChild;if(s.firstChild==s.lastChild)return s.removeChild(s.firstChild);var u=e.createDocumentFragment();for(;s.firstChild;)u.appendChild(s.removeChild(s.firstChild));return u};var n,o=!1;"undefined"!=typeof document&&((n=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',o=!n.getElementsByTagName("link").length,n=void 0);var i={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:o?[1,"X<div>","</div>"]:[0,"",""]};i.td=i.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],i.option=i.optgroup=[1,'<select multiple="multiple">',"</select>"],i.thead=i.tbody=i.colgroup=i.caption=i.tfoot=[1,"<table>","</table>"],i.polyline=i.ellipse=i.polygon=i.circle=i.text=i.line=i.path=i.rect=i.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"]},function(t,e,n){var o;t.exports=function t(e,n,i){function s(a,l){if(!n[a]){if(!e[a]){if(!l&&"function"==typeof o&&o)return o(a,!0);if(r)return r(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};e[a][0].call(u.exports,(function(t){var n=e[a][1][t];return s(n||t)}),u,u.exports,t,e,n,i)}return n[a].exports}for(var r="function"==typeof o&&o,a=0;a<i.length;a++)s(i[a]);return s}({1:[function(t,e,n){"use strict";e.exports=function t(e){if(!e||"object"!=typeof e)return e;if("[object Date]"==Object.prototype.toString.call(e))return new Date(e.getTime());if(Array.isArray(e))return e.map(t);var n={};return Object.keys(e).forEach((function(o){n[o]=t(e[o])})),n}},{}],2:[function(t,e,n){e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("String expected");e||(e=document);var n=/<([\w:]+)/.exec(t);if(!n)return e.createTextNode(t);t=t.replace(/^\s+|\s+$/g,"");var o=n[1];if("body"==o)return(i=e.createElement("html")).innerHTML=t,i.removeChild(i.lastChild);var i,r=s[o]||s._default,a=r[0],l=r[1],c=r[2];for((i=e.createElement("div")).innerHTML=l+t+c;a--;)i=i.lastChild;if(i.firstChild==i.lastChild)return i.removeChild(i.firstChild);for(var u=e.createDocumentFragment();i.firstChild;)u.appendChild(i.removeChild(i.firstChild));return u};var o,i=!1;"undefined"!=typeof document&&((o=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',i=!o.getElementsByTagName("link").length,o=void 0);var s={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:i?[1,"X<div>","</div>"]:[0,"",""]};s.td=s.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],s.option=s.optgroup=[1,'<select multiple="multiple">',"</select>"],s.thead=s.tbody=s.colgroup=s.caption=s.tfoot=[1,"<table>","</table>"],s.polyline=s.ellipse=s.polygon=s.circle=s.text=s.line=s.path=s.rect=s.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"]},{}],3:[function(t,e,n){var o=/^(?:submit|button|image|reset|file)$/i,i=/^(?:input|select|textarea|keygen)/i,s=/(\[[^\[\]]*\])/g;function r(t,e,n){if(e.match(s))!function t(e,n,o){if(0===n.length)return e=o;var i=n.shift(),s=i.match(/^\[(.+?)\]$/);if("[]"===i)return e=e||[],Array.isArray(e)?e.push(t(null,n,o)):(e._values=e._values||[],e._values.push(t(null,n,o))),e;if(s){var r=s[1],a=+r;isNaN(a)?(e=e||{})[r]=t(e[r],n,o):(e=e||[])[a]=t(e[a],n,o)}else e[i]=t(e[i],n,o);return e}(t,function(t){var e=[],n=new RegExp(s),o=/^([^\[\]]*)/.exec(t);for(o[1]&&e.push(o[1]);null!==(o=n.exec(t));)e.push(o[1]);return e}(e),n);else{var o=t[e];o?(Array.isArray(o)||(t[e]=[o]),t[e].push(n)):t[e]=n}return t}function a(t,e,n){return n=n.replace(/(\r)?\n/g,"\r\n"),n=(n=encodeURIComponent(n)).replace(/%20/g,"+"),t+(t?"&":"")+encodeURIComponent(e)+"="+n}e.exports=function(t,e){"object"!=typeof e?e={hash:!!e}:void 0===e.hash&&(e.hash=!0);for(var n=e.hash?{}:"",s=e.serializer||(e.hash?r:a),l=t&&t.elements?t.elements:[],c=Object.create(null),u=0;u<l.length;++u){var d=l[u];if((e.disabled||!d.disabled)&&d.name&&i.test(d.nodeName)&&!o.test(d.type)){var f=d.name,p=d.value;if("checkbox"!==d.type&&"radio"!==d.type||d.checked||(p=void 0),e.empty){if("checkbox"!==d.type||d.checked||(p=""),"radio"===d.type&&(c[d.name]||d.checked?d.checked&&(c[d.name]=!0):c[d.name]=!1),!p&&"radio"==d.type)continue}else if(!p)continue;if("select-multiple"!==d.type)n=s(n,f,p);else{p=[];for(var h=d.options,m=!1,b=0;b<h.length;++b){var g=h[b],v=e.empty&&!g.value,y=g.value||v;g.selected&&y&&(m=!0,n=e.hash&&"[]"!==f.slice(f.length-2)?s(n,f+"[]",g.value):s(n,f,g.value))}!m&&e.empty&&(n=s(n,f,""))}}}if(e.empty)for(var f in c)c[f]||(n=s(n,f,""));return n}},{}],4:[function(t,e,n){var o=t("domify"),i=t("form-serialize"),s=t("deep-clone-simple"),r=function(t){var e=document.createElement("div");e.classList.add("vex-dialog-buttons");for(var n=0;n<t.length;n++){var o=t[n],i=document.createElement("button");i.type=o.type,i.textContent=o.text,i.className=o.className,i.classList.add("vex-dialog-button"),0===n?i.classList.add("vex-first"):n===t.length-1&&i.classList.add("vex-last"),function(t){i.addEventListener("click",function(e){t.click&&t.click.call(this,e)}.bind(this))}.bind(this)(o),e.appendChild(i)}return e};e.exports=function(t){var e={name:"dialog",open:function(e){var n=Object.assign({},s(this.defaultOptions),e);n.unsafeMessage&&!n.message?n.message=n.unsafeMessage:n.message&&(n.message=t._escapeHtml(n.message));var i=n.unsafeContent=function(t){var e=document.createElement("form");e.classList.add("vex-dialog-form");var n=document.createElement("div");n.classList.add("vex-dialog-message"),n.appendChild(t.message instanceof window.Node?t.message:o(t.message));var i=document.createElement("div");return i.classList.add("vex-dialog-input"),i.appendChild(t.input instanceof window.Node?t.input:o(t.input)),e.appendChild(n),e.appendChild(i),e}(n),a=t.open(n);""!==n.yesText&&(n.buttons[0].text=n.yesText),""!==n.noText&&(n.buttons[1].text=n.noText);var l=n.beforeClose&&n.beforeClose.bind(a);if(a.options.beforeClose=function(){var t=!l||l();return t&&n.callback(this.value||!1),t}.bind(a),i.appendChild(r.call(a,n.buttons)),a.form=i,i.addEventListener("submit",n.onSubmit.bind(a)),n.focusFirstInput){var c=a.contentEl.querySelector("button, input, select, textarea");c&&c.focus()}return a},alert:function(t){return"string"==typeof t&&(t={message:t}),t=Object.assign({},s(this.defaultOptions),s(this.defaultAlertOptions),t),this.open(t)},confirm:function(t){if("object"!=typeof t||"function"!=typeof t.callback)throw new Error("dialog.confirm(options) requires options.callback.");return t=Object.assign({},s(this.defaultOptions),s(this.defaultConfirmOptions),t),this.open(t)},prompt:function(e){if("object"!=typeof e||"function"!=typeof e.callback)throw new Error("dialog.prompt(options) requires options.callback.");var n=Object.assign({},s(this.defaultOptions),s(this.defaultPromptOptions)),o={unsafeMessage:'<label for="vex">'+t._escapeHtml(e.label||n.label)+"</label>",input:'<input name="vex" type="text" class="vex-dialog-prompt-input" placeholder="'+t._escapeHtml(e.placeholder||n.placeholder)+'" value="'+t._escapeHtml(e.value||n.value)+'" />'},i=(e=Object.assign(n,o,e)).callback;return e.callback=function(t){if("object"==typeof t){var e=Object.keys(t);t=e.length?t[e[0]]:""}i(t)},this.open(e)},buttons:{YES:{text:"OK",type:"submit",className:"vex-dialog-button-primary",click:function(){this.value=!0}},NO:{text:"Cancel",type:"button",className:"vex-dialog-button-secondary",click:function(){this.value=!1,this.close()}}}};return e.defaultOptions={callback:function(){},afterOpen:function(){},message:"",input:"",yesText:"",noText:"",buttons:[e.buttons.YES,e.buttons.NO],showCloseButton:!1,onSubmit:function(t){return t.preventDefault(),this.options.input&&(this.value=i(this.form,{hash:!0})),this.close()},focusFirstInput:!0},e.defaultAlertOptions={buttons:[e.buttons.YES]},e.defaultPromptOptions={label:"Prompt:",placeholder:"",value:""},e.defaultConfirmOptions={},e}},{"deep-clone-simple":1,domify:2,"form-serialize":3}]},{},[4])(4)},function(t,e,n){var o=n(11);"string"==typeof o&&(o=[[t.i,o,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(13)(o,i);o.locals&&(t.exports=o.locals)},function(t,e,n){(t.exports=n(12)(!1)).push([t.i,'@-webkit-keyframes vex-fadein {\n 0% {\n opacity: 0; }\n 100% {\n opacity: 1; } }\n\n@keyframes vex-fadein {\n 0% {\n opacity: 0; }\n 100% {\n opacity: 1; } }\n\n@-webkit-keyframes vex-fadeout {\n 0% {\n opacity: 1; }\n 100% {\n opacity: 0; } }\n\n@keyframes vex-fadeout {\n 0% {\n opacity: 1; }\n 100% {\n opacity: 0; } }\n\n@-webkit-keyframes vex-rotation {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg); } }\n\n@keyframes vex-rotation {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg); } }\n\n.vex, .vex *, .vex *:before, .vex *:after {\n -moz-box-sizing: border-box;\n box-sizing: border-box; }\n\n.vex {\n position: fixed;\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n z-index: 1111;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0; }\n\n.vex-scrollbar-measure {\n position: absolute;\n top: -9999px;\n width: 50px;\n height: 50px;\n overflow: scroll; }\n\n.vex-overlay {\n -webkit-animation: vex-fadein .5s;\n animation: vex-fadein .5s;\n position: fixed;\n z-index: 1111;\n background: rgba(0, 0, 0, 0.4);\n top: 0;\n right: 0;\n bottom: 0;\n left: 0; }\n\n.vex-overlay.vex-closing {\n -webkit-animation: vex-fadeout .5s forwards;\n animation: vex-fadeout .5s forwards; }\n\n.vex-content {\n -webkit-animation: vex-fadein .5s;\n animation: vex-fadein .5s;\n background: #fff; }\n\n.vex.vex-closing .vex-content {\n -webkit-animation: vex-fadeout .5s forwards;\n animation: vex-fadeout .5s forwards; }\n\n.vex-close:before {\n font-family: Arial, sans-serif;\n content: "\\D7"; }\n\n.vex-dialog-form {\n margin: 0; }\n\n.vex-dialog-button {\n text-rendering: optimizeLegibility;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent; }\n\n.vex-loading-spinner {\n -webkit-animation: vex-rotation .7s linear infinite;\n animation: vex-rotation .7s linear infinite;\n box-shadow: 0 0 1em rgba(0, 0, 0, 0.1);\n position: fixed;\n z-index: 1112;\n margin: auto;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: 2em;\n width: 2em;\n background: #fff; }\n\nbody.vex-open {\n overflow: hidden; }\n',""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",o=t[3];if(!o)return n;if(e&&"function"==typeof btoa){var i=(r=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),s=o.sources.map((function(t){return"/*# sourceURL="+o.sourceRoot+t+" */"}));return[n].concat(s).concat([i]).join("\n")}var r;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},i=0;i<this.length;i++){var s=this[i][0];"number"==typeof s&&(o[s]=!0)}for(i=0;i<t.length;i++){var r=t[i];"number"==typeof r[0]&&o[r[0]]||(n&&!r[2]?r[2]=n:n&&(r[2]="("+r[2]+") and ("+n+")"),e.push(r))}},e}},function(t,e,n){var o,i,s={},r=(o=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=o.apply(this,arguments)),i}),a=function(t,e){return e?e.querySelector(t):document.querySelector(t)},l=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var o=a.call(this,t,n);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(t){o=null}e[t]=o}return e[t]}}(),c=null,u=0,d=[],f=n(14);function p(t,e){for(var n=0;n<t.length;n++){var o=t[n],i=s[o.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](o.parts[r]);for(;r<o.parts.length;r++)i.parts.push(y(o.parts[r],e))}else{var a=[];for(r=0;r<o.parts.length;r++)a.push(y(o.parts[r],e));s[o.id]={id:o.id,refs:1,parts:a}}}}function h(t,e){for(var n=[],o={},i=0;i<t.length;i++){var s=t[i],r=e.base?s[0]+e.base:s[0],a={css:s[1],media:s[2],sourceMap:s[3]};o[r]?o[r].parts.push(a):n.push(o[r]={id:r,parts:[a]})}return n}function m(t,e){var n=l(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=d[d.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),d.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=l(t.insertAt.before,n);n.insertBefore(e,i)}}function b(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=d.indexOf(t);e>=0&&d.splice(e,1)}function g(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var o=function(){0;return n.nc}();o&&(t.attrs.nonce=o)}return v(e,t.attrs),m(t,e),e}function v(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,o,i,s;if(e.transform&&t.css){if(!(s="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=s}if(e.singleton){var r=u++;n=c||(c=g(e)),o=k.bind(null,n,r,!1),i=k.bind(null,n,r,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",v(e,t.attrs),m(t,e),e}(e),o=E.bind(null,n,e),i=function(){b(n),n.href&&URL.revokeObjectURL(n.href)}):(n=g(e),o=C.bind(null,n),i=function(){b(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=h(t,e);return p(n,e),function(t){for(var o=[],i=0;i<n.length;i++){var r=n[i];(a=s[r.id]).refs--,o.push(a)}t&&p(h(t,e),e);for(i=0;i<o.length;i++){var a;if(0===(a=o[i]).refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete s[a.id]}}}};var w,x=(w=[],function(t,e){return w[t]=e,w.filter(Boolean).join("\n")});function k(t,e,n,o){var i=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=x(e,i);else{var s=document.createTextNode(i),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(s,r[e]):t.appendChild(s)}}function C(t,e){var n=e.css,o=e.media;if(o&&t.setAttribute("media",o),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function E(t,e,n){var o=n.css,i=n.sourceMap,s=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||s)&&(o=f(o)),i&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var r=new Blob([o],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(r),a&&URL.revokeObjectURL(a)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var i,s=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(s)?t:(i=0===s.indexOf("//")?s:0===s.indexOf("/")?n+s:o+s.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},,,,,,function(t,e,n){"use strict";n.r(e);var o=n(0),i=n.n(o),s=n(3),r=n.n(s);n(10),n(22);r.a.defaultOptions.className="vex-theme-ew",r.a.defaultOptions.contentClassName="postbox",r.a.dialog.buttons.YES={...r.a.dialog.buttons.YES,className:"button-primary",text:ew.i18n.yes},r.a.dialog.buttons.OK={...r.a.dialog.buttons.YES,className:"button-primary",text:ew.i18n.ok},r.a.dialog.buttons.NO={...r.a.dialog.buttons.NO,className:"button",text:ew.i18n.no};r.a;var a=n(2),l=class extends a.View{constructor(t){super(t),this.state=t.state,this.callback=t.callback,this.handleClick=this.handleClick.bind(this),this.button=this.$el.find("a"),this.spinner=this.$el.find(".spinner"),this.content=this.$el.find(".content"),this.status=this.$el.find(".status"),this.button.on("click",this.handleClick),this.mode=this.state.get("mode"),this.state.on("change",this.update,this)}template(){const t=this.state.get("processed"),e=this.state.get("total"),n=Math.floor(t/e*100);let o=this.state.get("statusText");return`${o=o.replace("{counter}",`${t}/${e}`)} (${n}%)`}handleClick(){this.button.hasClass("disabled")||this.callback()}update(){const t=this.state.get("mode"),e=this.state.get("action");this.mode!==t&&this.toggleMode(t),"processing"===t&&this.action===e&&this.status.html(this.template())}toggleMode(t){this.mode=t,this.action===this.state.get("action")||"loading"!==t&&"processing"!==t?"loading"===t?this.loading():"processing"===t?this.processing():this.reset():this.disable()}disable(){this.button.addClass("disabled")}loading(){this.disable(),this.spinner.css({visibility:"visible"})}processing(){this.content.hide(),this.status.show()}reset(){this.spinner.css({visibility:"hidden"}),this.status.hide(),this.content.show(),this.button.removeClass("disabled")}},c=class extends l{constructor(t){t.el=".tool-bulk-watermark",super(t),this.action="watermark",this.selectWatermark=this.selectWatermark.bind(this),this.toggleButton=this.toggleButton.bind(this),this.select=this.$el.find("select"),this.select.on("change",this.selectWatermark),this.toggleButton()}selectWatermark(){const t=this.select.val(),e=this.select.find("option:selected").data("nonce");this.state.set({watermark:t,nonce:e}),this.toggleButton()}toggleButton(){"-1"===this.select.val()?this.button.addClass("disabled"):this.button.removeClass("disabled")}disable(){super.disable(),this.select.prop({disabled:!0})}processing(){this.select.val("-1"),super.processing()}reset(){super.reset(),this.select.prop({disabled:!1}).change()}},u=class extends l{constructor(t){t.el=".tool-restore",super(t),this.action="restore",this.backupInfo=this.$el.find("p.has-backup"),this.noBackupInfo=this.$el.find("p.no-backup"),this.backupCountInfo=this.$el.find(".backup-count"),this.state.set({backupCount:this.$el.data("backup-count")}),this.toggleInfo()}handleClick(){this.state.set({nonce:this.button.data("nonce")}),super.handleClick()}toggleInfo(){const t=this.state.get("backupCount");0<t?(this.backupCountInfo.text(t),this.backupInfo.show(),this.noBackupInfo.hide()):(this.backupInfo.hide(),this.noBackupInfo.show())}update(){super.update(),this.toggleInfo()}},d=n(1);n(24);i()(document).ready(()=>{switch(i()("a.nav-tab-active").data("tab")){case"settings":new class{constructor(){this.form=i()("form#easy-watermark-settings-form"),this.form.length&&this.init()}init(){this.toggleGroup=this.toggleGroup.bind(this),this.checkboxes=this.form.find("input[data-toggle]"),this.checkboxes.on("change",this.toggleGroup),this.checkboxes.change()}toggleGroup(t){const e=i()(t.target),n=e.data("toggle"),o=this.form.find(`.group-${n}`),s=o.find("input, textarea, select");!0===e.is(":checked")?(o.show(),s.prop("disabled",!1)):(o.hide(),s.prop("disabled",!0))}};break;case"watermarks":new class{constructor(){this.wrap=i()(".watermarks"),this.wrap.length&&this.init()}init(){this.confirm=this.confirm.bind(this),this.deleteButtons=this.wrap.find(".row-actions a.submitdelete"),this.deleteButtons.on("click",this.confirm)}confirm(t){t.preventDefault();const e=i()(t.currentTarget),n=e.data("watermark-name");!function(t="",e=(()=>{})){r.a.dialog.confirm({message:t,callback:e,buttons:[r.a.dialog.buttons.YES,r.a.dialog.buttons.NO]})}(ew.i18n.deleteConfirmation.replace("{watermarkName}",n),t=>{!0===t&&(window.location=e.attr("href"))})}};break;case"tools":new class{constructor(){this.wrap=i()(".tools"),this.wrap.length&&this.init()}init(){this.bulkWatermark=this.bulkWatermark.bind(this),this.restore=this.restore.bind(this),this.state=new a.Model,this.state.set({mode:"none"}),this.bulkWatermarkTool=new c({state:this.state,callback:this.bulkWatermark}),this.restoreTool=new u({state:this.state,callback:this.restore})}bulkWatermark(){this.state.set({action:"watermark",successMessage:ew.i18n.watermarkingSuccessMessage,statusText:ew.i18n.watermarkingStatus}),this.getInfo()}restore(){this.state.set({action:"restore",successMessage:ew.i18n.restoringSuccessMessage,statusText:ew.i18n.restoringStatus}),this.getInfo()}getInfo(){this.state.set({mode:"loading"}),i.a.ajax(ajaxurl,{data:{action:"easy-watermark/tools/get-attachments",nonce:ew.nonce,mode:this.state.get("action")}}).done(t=>{t.success?(this.state.set({items:t.data}),this.start()):Object(d.a)(ew.i18n.genericErrorMessage,"error")}).fail(()=>{Object(d.a)(ew.i18n.genericErrorMessage,"error")})}start(){const t=this.state.get("items");if(!t)return function(t="",e=(()=>{})){r.a.dialog.alert({message:t,callback:e,buttons:[r.a.dialog.buttons.OK]})}(ew.i18n.noItemsToWatermark),void this.state.set({mode:"none"});this.state.set({mode:"processing",processed:0,total:t.length,error:!1,backupCount:0}),this.doActionRecursive(t)}doActionRecursive(t){const e=t.shift(),n=this.state.get("nonce"),o=this.state.get("watermark");let s="easy-watermark/",r=this.state.get("processed"),a=this.state.get("backupCount");"watermark"===this.state.get("action")?s+="all"===o?"apply_all":"apply_single":s+="restore_backup",this.state.set({attachment:e}),i.a.ajax(ajaxurl,{data:{action:s,nonce:n,watermark:o,attachment_id:e.id}}).done(e=>{!0===e.success?(r++,e.data.hasBackup&&a++,this.state.set({processed:r,backupCount:a}),t.length?this.doActionRecursive(t):this.finish()):this.fail(e.data)}).fail(()=>{this.fail(ew.i18n.genericErrorMessage)})}fail(t){const e=this.state.get("attachment").title,n=ew.i18n.bulkActionErrorMessage.replace("{imageTitle}",e).replace("{error}",t);this.state.set({error:n}),this.finish()}finish(){const t=this.state.get("error"),e=this.state.get("processed"),n=this.state.get("successMessage");t?Object(d.a)(t,"error"):Object(d.a)(n.replace("{procesed}",e),"success"),this.state.set({mode:"none"})}}}})},,function(t,e){},,function(t,e){}]);
1
+ !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="../",n(n.s=20)}([function(e,t){e.exports=jQuery},function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return s})),n.d(t,"c",(function(){return c})),n.d(t,"d",(function(){return l}));var o=n(0),r=n.n(o);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=r()(document.createElement("div")),o=r()(document.createElement("p")),i=r()(document.createElement("button"));n.addClass("notice notice-"+t+" is-dismissible").hide(),i.addClass("notice-dismiss"),o.html(e),n.append(o).append(i),i.on("click",(function(e){e.preventDefault(),n.fadeOut(200,(function(){n.remove()}))})),r()("hr.wp-header-end").after(n),n.fadeIn(200)}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=e.length,r=!0,i=!1,a=void 0;try{for(var s,c=e.clone().models[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var u=s.value;(!l(u)||u.get("usedAsWatermark")||!0===t&&!u.get("hasBackup"))&&(!0===n&&e.remove(u),o--)}}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return o}function c(e,t){var n=e.indexOf("?");return-1!==n&&(e=e.substr(0,n)),e+="?v="+t}function l(e){return"object"===i(e)&&e.get&&(e=e.get("mime")),Object.keys(ew.mime).includes(e)}},function(e,t){e.exports=Backbone},function(e,t,n){var o=n(5);o.registerPlugin(n(9)),e.exports=o},,function(e,t,n){n(6),n(7).polyfill();var o=n(8),r=function(e){if(void 0!==e){var t=document.createElement("div");return t.appendChild(document.createTextNode(e)),t.innerHTML}return""},i=function(e,t){if("string"==typeof t&&0!==t.length)for(var n=t.split(" "),o=0;o<n.length;o++){var r=n[o];r.length&&e.classList.add(r)}},a=function(){var e=document.createElement("div"),t={animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oanimationend",msAnimation:"MSAnimationEnd"};for(var n in t)if(void 0!==e.style[n])return t[n];return!1}(),s="vex",c="vex-content",l="vex-overlay",u="vex-close",f="vex-closing",d="vex-open",p={},h=1,b=!1,v={open:function(e){var t=function(e){console.warn('The "'+e+'" property is deprecated in vex 3. Use CSS classes and the appropriate "ClassName" options, instead.'),console.warn("See http://github.hubspot.com/vex/api/advanced/#options")};e.css&&t("css"),e.overlayCSS&&t("overlayCSS"),e.contentCSS&&t("contentCSS"),e.closeCSS&&t("closeCSS");var n={};n.id=h++,p[n.id]=n,n.isOpen=!0,n.close=function(){if(!this.isOpen)return!0;var e=this.options;if(b&&!e.escapeButtonCloses)return!1;if(!1===function(){return!e.beforeClose||e.beforeClose.call(this)}.bind(this)())return!1;this.isOpen=!1;var t=window.getComputedStyle(this.contentEl);function n(e){return"none"!==t.getPropertyValue(e+"animation-name")&&"0s"!==t.getPropertyValue(e+"animation-duration")}var o=n("")||n("-webkit-")||n("-moz-")||n("-o-"),r=function t(){this.rootEl.parentNode&&(this.rootEl.removeEventListener(a,t),this.overlayEl.removeEventListener(a,t),delete p[this.id],this.rootEl.parentNode.removeChild(this.rootEl),this.bodyEl.removeChild(this.overlayEl),e.afterClose&&e.afterClose.call(this),0===Object.keys(p).length&&document.body.classList.remove(d))}.bind(this);return a&&o?(this.rootEl.addEventListener(a,r),this.overlayEl.addEventListener(a,r),this.rootEl.classList.add(f),this.overlayEl.classList.add(f)):r(),!0},"string"==typeof e&&(e={content:e}),e.unsafeContent&&!e.content?e.content=e.unsafeContent:e.content&&(e.content=r(e.content));var m=n.options=Object.assign({},v.defaultOptions,e),y=n.bodyEl=document.getElementsByTagName("body")[0],g=n.rootEl=document.createElement("div");g.classList.add(s),i(g,m.className);var w=n.overlayEl=document.createElement("div");w.classList.add(l),i(w,m.overlayClassName),m.overlayClosesOnClick&&g.addEventListener("click",(function(e){e.target===g&&n.close()})),y.appendChild(w);var k=n.contentEl=document.createElement("div");if(k.classList.add(c),i(k,m.contentClassName),k.appendChild(m.content instanceof window.Node?m.content:o(m.content)),g.appendChild(k),m.showCloseButton){var x=n.closeEl=document.createElement("div");x.classList.add(u),i(x,m.closeClassName),x.addEventListener("click",n.close.bind(n)),k.appendChild(x)}return document.querySelector(m.appendLocation).appendChild(g),m.afterOpen&&m.afterOpen.call(n),document.body.classList.add(d),n},close:function(e){var t;if(e.id)t=e.id;else{if("string"!=typeof e)throw new TypeError("close requires a vex object or id string");t=e}return!!p[t]&&p[t].close()},closeTop:function(){var e=Object.keys(p);return!!e.length&&p[e[e.length-1]].close()},closeAll:function(){for(var e in p)this.close(e);return!0},getAll:function(){return p},getById:function(e){return p[e]}};window.addEventListener("keyup",(function(e){27===e.keyCode&&(b=!0,v.closeTop(),b=!1)})),window.addEventListener("popstate",(function(){v.defaultOptions.closeAllOnPopState&&v.closeAll()})),v.defaultOptions={content:"",showCloseButton:!0,escapeButtonCloses:!0,overlayClosesOnClick:!0,appendLocation:"body",className:"",overlayClassName:"",contentClassName:"",closeClassName:"",closeAllOnPopState:!0},Object.defineProperty(v,"_escapeHtml",{configurable:!1,enumerable:!1,writable:!1,value:r}),v.registerPlugin=function(e,t){var n=e(v),o=t||n.name;if(v[o])throw new Error("Plugin "+t+" is already registered.");v[o]=n},e.exports=v},function(e,t){
2
  /*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
3
+ "document"in window.self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||function(e){"use strict";if("Element"in e){var t=e.Element.prototype,n=Object,o=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},r=Array.prototype.indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},i=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},a=function(e,t){if(""===t)throw new i("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new i("INVALID_CHARACTER_ERR","String contains an invalid character");return r.call(e,t)},s=function(e){for(var t=o.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],r=0,i=n.length;r<i;r++)this.push(n[r]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},c=s.prototype=[],l=function(){return new s(this)};if(i.prototype=Error.prototype,c.item=function(e){return this[e]||null},c.contains=function(e){return-1!==a(this,e+="")},c.add=function(){var e,t=arguments,n=0,o=t.length,r=!1;do{e=t[n]+"",-1===a(this,e)&&(this.push(e),r=!0)}while(++n<o);r&&this._updateClassName()},c.remove=function(){var e,t,n=arguments,o=0,r=n.length,i=!1;do{for(e=n[o]+"",t=a(this,e);-1!==t;)this.splice(t,1),i=!0,t=a(this,e)}while(++o<r);i&&this._updateClassName()},c.toggle=function(e,t){e+="";var n=this.contains(e),o=n?!0!==t&&"remove":!1!==t&&"add";return o&&this[o](e),!0===t||!1===t?t:!n},c.toString=function(){return this.join(" ")},n.defineProperty){var u={get:l,enumerable:!0,configurable:!0};try{n.defineProperty(t,"classList",u)}catch(e){void 0!==e.number&&-2146823252!==e.number||(u.enumerable=!1,n.defineProperty(t,"classList",u))}}else n.prototype.__defineGetter__&&t.__defineGetter__("classList",l)}}(window.self),function(){"use strict";var e=document.createElement("_");if(e.classList.add("c1","c2"),!e.classList.contains("c2")){var t=function(e){var t=DOMTokenList.prototype[e];DOMTokenList.prototype[e]=function(e){var n,o=arguments.length;for(n=0;n<o;n++)e=arguments[n],t.call(this,e)}};t("add"),t("remove")}if(e.classList.toggle("c3",!1),e.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:n.call(this,e)}}e=null}())},function(e,t,n){"use strict";function o(e,t){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var n=Object(e),o=1;o<arguments.length;o++){var r=arguments[o];if(null!=r)for(var i=Object.keys(Object(r)),a=0,s=i.length;a<s;a++){var c=i[a],l=Object.getOwnPropertyDescriptor(r,c);void 0!==l&&l.enumerable&&(n[c]=r[c])}}return n}e.exports={assign:o,polyfill:function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:o})}}},function(e,t){e.exports=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var o=n[1];if("body"==o){return(i=t.createElement("html")).innerHTML=e,i.removeChild(i.lastChild)}var i,a=r[o]||r._default,s=a[0],c=a[1],l=a[2];(i=t.createElement("div")).innerHTML=c+e+l;for(;s--;)i=i.lastChild;if(i.firstChild==i.lastChild)return i.removeChild(i.firstChild);var u=t.createDocumentFragment();for(;i.firstChild;)u.appendChild(i.removeChild(i.firstChild));return u};var n,o=!1;"undefined"!=typeof document&&((n=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',o=!n.getElementsByTagName("link").length,n=void 0);var r={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:o?[1,"X<div>","</div>"]:[0,"",""]};r.td=r.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],r.option=r.optgroup=[1,'<select multiple="multiple">',"</select>"],r.thead=r.tbody=r.colgroup=r.caption=r.tfoot=[1,"<table>","</table>"],r.polyline=r.ellipse=r.polygon=r.circle=r.text=r.line=r.path=r.rect=r.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"]},function(e,t,n){var o;e.exports=function e(t,n,r){function i(s,c){if(!n[s]){if(!t[s]){if(!c&&"function"==typeof o&&o)return o(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[s]={exports:{}};t[s][0].call(u.exports,(function(e){var n=t[s][1][e];return i(n||e)}),u,u.exports,e,t,n,r)}return n[s].exports}for(var a="function"==typeof o&&o,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){"use strict";t.exports=function e(t){if(!t||"object"!=typeof t)return t;if("[object Date]"==Object.prototype.toString.call(t))return new Date(t.getTime());if(Array.isArray(t))return t.map(e);var n={};return Object.keys(t).forEach((function(o){n[o]=e(t[o])})),n}},{}],2:[function(e,t,n){t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var o=n[1];if("body"==o)return(r=t.createElement("html")).innerHTML=e,r.removeChild(r.lastChild);var r,a=i[o]||i._default,s=a[0],c=a[1],l=a[2];for((r=t.createElement("div")).innerHTML=c+e+l;s--;)r=r.lastChild;if(r.firstChild==r.lastChild)return r.removeChild(r.firstChild);for(var u=t.createDocumentFragment();r.firstChild;)u.appendChild(r.removeChild(r.firstChild));return u};var o,r=!1;"undefined"!=typeof document&&((o=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',r=!o.getElementsByTagName("link").length,o=void 0);var i={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:r?[1,"X<div>","</div>"]:[0,"",""]};i.td=i.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],i.option=i.optgroup=[1,'<select multiple="multiple">',"</select>"],i.thead=i.tbody=i.colgroup=i.caption=i.tfoot=[1,"<table>","</table>"],i.polyline=i.ellipse=i.polygon=i.circle=i.text=i.line=i.path=i.rect=i.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"]},{}],3:[function(e,t,n){var o=/^(?:submit|button|image|reset|file)$/i,r=/^(?:input|select|textarea|keygen)/i,i=/(\[[^\[\]]*\])/g;function a(e,t,n){if(t.match(i))!function e(t,n,o){if(0===n.length)return t=o;var r=n.shift(),i=r.match(/^\[(.+?)\]$/);if("[]"===r)return t=t||[],Array.isArray(t)?t.push(e(null,n,o)):(t._values=t._values||[],t._values.push(e(null,n,o))),t;if(i){var a=i[1],s=+a;isNaN(s)?(t=t||{})[a]=e(t[a],n,o):(t=t||[])[s]=e(t[s],n,o)}else t[r]=e(t[r],n,o);return t}(e,function(e){var t=[],n=new RegExp(i),o=/^([^\[\]]*)/.exec(e);for(o[1]&&t.push(o[1]);null!==(o=n.exec(e));)t.push(o[1]);return t}(t),n);else{var o=e[t];o?(Array.isArray(o)||(e[t]=[o]),e[t].push(n)):e[t]=n}return e}function s(e,t,n){return n=n.replace(/(\r)?\n/g,"\r\n"),n=(n=encodeURIComponent(n)).replace(/%20/g,"+"),e+(e?"&":"")+encodeURIComponent(t)+"="+n}t.exports=function(e,t){"object"!=typeof t?t={hash:!!t}:void 0===t.hash&&(t.hash=!0);for(var n=t.hash?{}:"",i=t.serializer||(t.hash?a:s),c=e&&e.elements?e.elements:[],l=Object.create(null),u=0;u<c.length;++u){var f=c[u];if((t.disabled||!f.disabled)&&f.name&&r.test(f.nodeName)&&!o.test(f.type)){var d=f.name,p=f.value;if("checkbox"!==f.type&&"radio"!==f.type||f.checked||(p=void 0),t.empty){if("checkbox"!==f.type||f.checked||(p=""),"radio"===f.type&&(l[f.name]||f.checked?f.checked&&(l[f.name]=!0):l[f.name]=!1),!p&&"radio"==f.type)continue}else if(!p)continue;if("select-multiple"!==f.type)n=i(n,d,p);else{p=[];for(var h=f.options,b=!1,v=0;v<h.length;++v){var m=h[v],y=t.empty&&!m.value,g=m.value||y;m.selected&&g&&(b=!0,n=t.hash&&"[]"!==d.slice(d.length-2)?i(n,d+"[]",m.value):i(n,d,m.value))}!b&&t.empty&&(n=i(n,d,""))}}}if(t.empty)for(var d in l)l[d]||(n=i(n,d,""));return n}},{}],4:[function(e,t,n){var o=e("domify"),r=e("form-serialize"),i=e("deep-clone-simple"),a=function(e){var t=document.createElement("div");t.classList.add("vex-dialog-buttons");for(var n=0;n<e.length;n++){var o=e[n],r=document.createElement("button");r.type=o.type,r.textContent=o.text,r.className=o.className,r.classList.add("vex-dialog-button"),0===n?r.classList.add("vex-first"):n===e.length-1&&r.classList.add("vex-last"),function(e){r.addEventListener("click",function(t){e.click&&e.click.call(this,t)}.bind(this))}.bind(this)(o),t.appendChild(r)}return t};t.exports=function(e){var t={name:"dialog",open:function(t){var n=Object.assign({},i(this.defaultOptions),t);n.unsafeMessage&&!n.message?n.message=n.unsafeMessage:n.message&&(n.message=e._escapeHtml(n.message));var r=n.unsafeContent=function(e){var t=document.createElement("form");t.classList.add("vex-dialog-form");var n=document.createElement("div");n.classList.add("vex-dialog-message"),n.appendChild(e.message instanceof window.Node?e.message:o(e.message));var r=document.createElement("div");return r.classList.add("vex-dialog-input"),r.appendChild(e.input instanceof window.Node?e.input:o(e.input)),t.appendChild(n),t.appendChild(r),t}(n),s=e.open(n);""!==n.yesText&&(n.buttons[0].text=n.yesText),""!==n.noText&&(n.buttons[1].text=n.noText);var c=n.beforeClose&&n.beforeClose.bind(s);if(s.options.beforeClose=function(){var e=!c||c();return e&&n.callback(this.value||!1),e}.bind(s),r.appendChild(a.call(s,n.buttons)),s.form=r,r.addEventListener("submit",n.onSubmit.bind(s)),n.focusFirstInput){var l=s.contentEl.querySelector("button, input, select, textarea");l&&l.focus()}return s},alert:function(e){return"string"==typeof e&&(e={message:e}),e=Object.assign({},i(this.defaultOptions),i(this.defaultAlertOptions),e),this.open(e)},confirm:function(e){if("object"!=typeof e||"function"!=typeof e.callback)throw new Error("dialog.confirm(options) requires options.callback.");return e=Object.assign({},i(this.defaultOptions),i(this.defaultConfirmOptions),e),this.open(e)},prompt:function(t){if("object"!=typeof t||"function"!=typeof t.callback)throw new Error("dialog.prompt(options) requires options.callback.");var n=Object.assign({},i(this.defaultOptions),i(this.defaultPromptOptions)),o={unsafeMessage:'<label for="vex">'+e._escapeHtml(t.label||n.label)+"</label>",input:'<input name="vex" type="text" class="vex-dialog-prompt-input" placeholder="'+e._escapeHtml(t.placeholder||n.placeholder)+'" value="'+e._escapeHtml(t.value||n.value)+'" />'},r=(t=Object.assign(n,o,t)).callback;return t.callback=function(e){if("object"==typeof e){var t=Object.keys(e);e=t.length?e[t[0]]:""}r(e)},this.open(t)},buttons:{YES:{text:"OK",type:"submit",className:"vex-dialog-button-primary",click:function(){this.value=!0}},NO:{text:"Cancel",type:"button",className:"vex-dialog-button-secondary",click:function(){this.value=!1,this.close()}}}};return t.defaultOptions={callback:function(){},afterOpen:function(){},message:"",input:"",yesText:"",noText:"",buttons:[t.buttons.YES,t.buttons.NO],showCloseButton:!1,onSubmit:function(e){return e.preventDefault(),this.options.input&&(this.value=r(this.form,{hash:!0})),this.close()},focusFirstInput:!0},t.defaultAlertOptions={buttons:[t.buttons.YES]},t.defaultPromptOptions={label:"Prompt:",placeholder:"",value:""},t.defaultConfirmOptions={},t}},{"deep-clone-simple":1,domify:2,"form-serialize":3}]},{},[4])(4)},function(e,t,n){var o=n(11);"string"==typeof o&&(o=[[e.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(13)(o,r);o.locals&&(e.exports=o.locals)},function(e,t,n){(e.exports=n(12)(!1)).push([e.i,'@-webkit-keyframes vex-fadein {\n 0% {\n opacity: 0; }\n 100% {\n opacity: 1; } }\n\n@keyframes vex-fadein {\n 0% {\n opacity: 0; }\n 100% {\n opacity: 1; } }\n\n@-webkit-keyframes vex-fadeout {\n 0% {\n opacity: 1; }\n 100% {\n opacity: 0; } }\n\n@keyframes vex-fadeout {\n 0% {\n opacity: 1; }\n 100% {\n opacity: 0; } }\n\n@-webkit-keyframes vex-rotation {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg); } }\n\n@keyframes vex-rotation {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg); } }\n\n.vex, .vex *, .vex *:before, .vex *:after {\n -moz-box-sizing: border-box;\n box-sizing: border-box; }\n\n.vex {\n position: fixed;\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n z-index: 1111;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0; }\n\n.vex-scrollbar-measure {\n position: absolute;\n top: -9999px;\n width: 50px;\n height: 50px;\n overflow: scroll; }\n\n.vex-overlay {\n -webkit-animation: vex-fadein .5s;\n animation: vex-fadein .5s;\n position: fixed;\n z-index: 1111;\n background: rgba(0, 0, 0, 0.4);\n top: 0;\n right: 0;\n bottom: 0;\n left: 0; }\n\n.vex-overlay.vex-closing {\n -webkit-animation: vex-fadeout .5s forwards;\n animation: vex-fadeout .5s forwards; }\n\n.vex-content {\n -webkit-animation: vex-fadein .5s;\n animation: vex-fadein .5s;\n background: #fff; }\n\n.vex.vex-closing .vex-content {\n -webkit-animation: vex-fadeout .5s forwards;\n animation: vex-fadeout .5s forwards; }\n\n.vex-close:before {\n font-family: Arial, sans-serif;\n content: "\\D7"; }\n\n.vex-dialog-form {\n margin: 0; }\n\n.vex-dialog-button {\n text-rendering: optimizeLegibility;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent; }\n\n.vex-loading-spinner {\n -webkit-animation: vex-rotation .7s linear infinite;\n animation: vex-rotation .7s linear infinite;\n box-shadow: 0 0 1em rgba(0, 0, 0, 0.1);\n position: fixed;\n z-index: 1112;\n margin: auto;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: 2em;\n width: 2em;\n background: #fff; }\n\nbody.vex-open {\n overflow: hidden; }\n',""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=(a=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=o.sources.map((function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"}));return[n].concat(i).concat([r]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},r=0;r<this.length;r++){var i=this[r][0];"number"==typeof i&&(o[i]=!0)}for(r=0;r<e.length;r++){var a=e[r];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,n){var o,r,i={},a=(o=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===r&&(r=o.apply(this,arguments)),r}),s=function(e,t){return t?t.querySelector(e):document.querySelector(e)},c=function(e){var t={};return function(e,n){if("function"==typeof e)return e();if(void 0===t[e]){var o=s.call(this,e,n);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}t[e]=o}return t[e]}}(),l=null,u=0,f=[],d=n(14);function p(e,t){for(var n=0;n<e.length;n++){var o=e[n],r=i[o.id];if(r){r.refs++;for(var a=0;a<r.parts.length;a++)r.parts[a](o.parts[a]);for(;a<o.parts.length;a++)r.parts.push(g(o.parts[a],t))}else{var s=[];for(a=0;a<o.parts.length;a++)s.push(g(o.parts[a],t));i[o.id]={id:o.id,refs:1,parts:s}}}}function h(e,t){for(var n=[],o={},r=0;r<e.length;r++){var i=e[r],a=t.base?i[0]+t.base:i[0],s={css:i[1],media:i[2],sourceMap:i[3]};o[a]?o[a].parts.push(s):n.push(o[a]={id:a,parts:[s]})}return n}function b(e,t){var n=c(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=f[f.length-1];if("top"===e.insertAt)o?o.nextSibling?n.insertBefore(t,o.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),f.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var r=c(e.insertAt.before,n);n.insertBefore(t,r)}}function v(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=f.indexOf(e);t>=0&&f.splice(t,1)}function m(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var o=function(){0;return n.nc}();o&&(e.attrs.nonce=o)}return y(t,e.attrs),b(e,t),t}function y(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function g(e,t){var n,o,r,i;if(t.transform&&e.css){if(!(i="function"==typeof t.transform?t.transform(e.css):t.transform.default(e.css)))return function(){};e.css=i}if(t.singleton){var a=u++;n=l||(l=m(t)),o=x.bind(null,n,a,!1),r=x.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",y(t,e.attrs),b(e,t),t}(t),o=C.bind(null,n,t),r=function(){v(n),n.href&&URL.revokeObjectURL(n.href)}):(n=m(t),o=O.bind(null,n),r=function(){v(n)});return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else r()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=h(e,t);return p(n,t),function(e){for(var o=[],r=0;r<n.length;r++){var a=n[r];(s=i[a.id]).refs--,o.push(s)}e&&p(h(e,t),t);for(r=0;r<o.length;r++){var s;if(0===(s=o[r]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete i[s.id]}}}};var w,k=(w=[],function(e,t){return w[e]=t,w.filter(Boolean).join("\n")});function x(e,t,n,o){var r=n?"":o.css;if(e.styleSheet)e.styleSheet.cssText=k(t,r);else{var i=document.createTextNode(r),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}function O(e,t){var n=t.css,o=t.media;if(o&&e.setAttribute("media",o),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function C(e,t,n){var o=n.css,r=n.sourceMap,i=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||i)&&(o=d(o)),r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([o],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,o=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var r,i=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?e:(r=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:o+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")}))}},,,,,,function(e,t,n){"use strict";n.r(t);var o=n(0),r=n.n(o);function i(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.form=r()("form#easy-watermark-settings-form"),this.form.length&&this.init()}var t,n,o;return t=e,(n=[{key:"init",value:function(){this.toggleGroup=this.toggleGroup.bind(this),this.checkboxes=this.form.find("input[data-toggle]"),this.checkboxes.on("change",this.toggleGroup),this.checkboxes.change()}},{key:"toggleGroup",value:function(e){var t=r()(e.target),n=t.data("toggle"),o=this.form.find(".group-".concat(n)),i=o.find("input, textarea, select");!0===t.is(":checked")?(o.show(),i.prop("disabled",!1)):(o.hide(),i.prop("disabled",!0))}}])&&i(t.prototype,n),o&&i(t,o),e}(),s=n(3),c=n.n(s);n(10),n(22);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(n,!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}c.a.defaultOptions.className="vex-theme-ew",c.a.defaultOptions.contentClassName="postbox",c.a.dialog.buttons.YES=u({},c.a.dialog.buttons.YES,{className:"button-primary",text:ew.i18n.yes}),c.a.dialog.buttons.OK=u({},c.a.dialog.buttons.YES,{className:"button-primary",text:ew.i18n.ok}),c.a.dialog.buttons.NO=u({},c.a.dialog.buttons.NO,{className:"button",text:ew.i18n.no});c.a;function d(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var p=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.wrap=r()(".watermarks"),this.wrap.length&&this.init()}var t,n,o;return t=e,(n=[{key:"init",value:function(){this.confirm=this.confirm.bind(this),this.deleteButtons=this.wrap.find(".row-actions a.submitdelete"),this.deleteButtons.on("click",this.confirm)}},{key:"confirm",value:function(e){e.preventDefault();var t=r()(e.currentTarget),n=t.data("watermark-name");!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};c.a.dialog.confirm({message:e,callback:t,buttons:[c.a.dialog.buttons.YES,c.a.dialog.buttons.NO]})}(ew.i18n.deleteConfirmation.replace("{watermarkName}",n),(function(e){!0===e&&(window.location=t.attr("href"))}))}}])&&d(t.prototype,n),o&&d(t,o),e}(),h=n(2);function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var w=function(e){function t(e){var n,o,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o=this,(n=!(r=m(t).call(this,e))||"object"!==b(r)&&"function"!=typeof r?y(o):r).state=e.state,n.callback=e.callback,n.handleClick=n.handleClick.bind(y(n)),n.button=n.$el.find("a"),n.spinner=n.$el.find(".spinner"),n.content=n.$el.find(".content"),n.status=n.$el.find(".status"),n.button.on("click",n.handleClick),n.mode=n.state.get("mode"),n.state.on("change",n.update,y(n)),n}var n,o,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(t,e),n=t,(o=[{key:"template",value:function(){var e=this.state.get("processed"),t=this.state.get("total"),n=Math.floor(e/t*100),o=this.state.get("statusText");return o=o.replace("{counter}","".concat(e,"/").concat(t)),"".concat(o," (").concat(n,"%)")}},{key:"handleClick",value:function(){this.button.hasClass("disabled")||this.callback()}},{key:"update",value:function(){var e=this.state.get("mode"),t=this.state.get("action");this.mode!==e&&this.toggleMode(e),"processing"===e&&this.action===t&&this.status.html(this.template())}},{key:"toggleMode",value:function(e){this.mode=e,this.action===this.state.get("action")||"loading"!==e&&"processing"!==e?"loading"===e?this.loading():"processing"===e?this.processing():this.reset():this.disable()}},{key:"disable",value:function(){this.button.addClass("disabled")}},{key:"loading",value:function(){this.disable(),this.spinner.css({visibility:"visible"})}},{key:"processing",value:function(){this.content.hide(),this.status.show()}},{key:"reset",value:function(){this.spinner.css({visibility:"hidden"}),this.status.hide(),this.content.show(),this.button.removeClass("disabled")}}])&&v(n.prototype,o),r&&v(n,r),t}(h.View);function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function x(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e,t,n){return(C="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=E(e)););return e}(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var S=function(e){function t(e){var n,o,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e.el=".tool-bulk-watermark",o=this,(n=!(r=E(t).call(this,e))||"object"!==k(r)&&"function"!=typeof r?O(o):r).action="watermark",n.selectWatermark=n.selectWatermark.bind(O(n)),n.toggleButton=n.toggleButton.bind(O(n)),n.select=n.$el.find("select"),n.select.on("change",n.selectWatermark),n.toggleButton(),n}var n,o,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&j(e,t)}(t,e),n=t,(o=[{key:"selectWatermark",value:function(){var e=this.select.val(),t=this.select.find("option:selected").data("nonce");this.state.set({watermark:e,nonce:t}),this.toggleButton()}},{key:"toggleButton",value:function(){"-1"===this.select.val()?this.button.addClass("disabled"):this.button.removeClass("disabled")}},{key:"disable",value:function(){C(E(t.prototype),"disable",this).call(this),this.select.prop({disabled:!0})}},{key:"processing",value:function(){this.select.val("-1"),C(E(t.prototype),"processing",this).call(this)}},{key:"reset",value:function(){C(E(t.prototype),"reset",this).call(this),this.select.prop({disabled:!1}).change()}}])&&x(n.prototype,o),r&&x(n,r),t}(w);function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function T(e,t){return!t||"object"!==L(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function N(e,t,n){return(N="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=P(e)););return e}(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var M=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e.el=".tool-restore",(n=T(this,P(t).call(this,e))).action="restore",n.backupInfo=n.$el.find("p.has-backup"),n.noBackupInfo=n.$el.find("p.no-backup"),n.backupCountInfo=n.$el.find(".backup-count"),n.state.set({backupCount:n.$el.data("backup-count")}),n.toggleInfo(),n}var n,o,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(t,e),n=t,(o=[{key:"handleClick",value:function(){this.state.set({nonce:this.button.data("nonce")}),N(P(t.prototype),"handleClick",this).call(this)}},{key:"toggleInfo",value:function(){var e=this.state.get("backupCount");0<e?(this.backupCountInfo.text(e),this.backupInfo.show(),this.noBackupInfo.hide()):(this.backupInfo.hide(),this.noBackupInfo.show())}},{key:"update",value:function(){N(P(t.prototype),"update",this).call(this),this.toggleInfo()}}])&&_(n.prototype,o),r&&_(n,r),t}(w),R=n(1);function I(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var B=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.wrap=r()(".tools"),this.wrap.length&&this.init()}var t,n,o;return t=e,(n=[{key:"init",value:function(){this.bulkWatermark=this.bulkWatermark.bind(this),this.restore=this.restore.bind(this),this.state=new h.Model,this.state.set({mode:"none"}),this.bulkWatermarkTool=new S({state:this.state,callback:this.bulkWatermark}),this.restoreTool=new M({state:this.state,callback:this.restore})}},{key:"bulkWatermark",value:function(){this.state.set({action:"watermark",successMessage:ew.i18n.watermarkingSuccessMessage,statusText:ew.i18n.watermarkingStatus}),this.getInfo()}},{key:"restore",value:function(){this.state.set({action:"restore",successMessage:ew.i18n.restoringSuccessMessage,statusText:ew.i18n.restoringStatus}),this.getInfo()}},{key:"getInfo",value:function(){var e=this;this.state.set({mode:"loading"}),r.a.ajax(ajaxurl,{data:{action:"easy-watermark/tools/get-attachments",nonce:ew.nonce,mode:this.state.get("action")}}).done((function(t){t.success?(e.state.set({items:t.data}),e.start()):Object(R.a)(ew.i18n.genericErrorMessage,"error")})).fail((function(){Object(R.a)(ew.i18n.genericErrorMessage,"error")}))}},{key:"start",value:function(){var e=this.state.get("items");if(!e)return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};c.a.dialog.alert({message:e,callback:t,buttons:[c.a.dialog.buttons.OK]})}(ew.i18n.noItemsToWatermark),void this.state.set({mode:"none"});this.state.set({mode:"processing",processed:0,total:e.length,error:!1,backupCount:0}),this.doActionRecursive(e)}},{key:"doActionRecursive",value:function(e){var t=this,n=e.shift(),o=this.state.get("nonce"),i=this.state.get("watermark"),a="easy-watermark/",s=this.state.get("processed"),c=this.state.get("backupCount");"watermark"===this.state.get("action")?a+="all"===i?"apply_all":"apply_single":a+="restore_backup",this.state.set({attachment:n}),r.a.ajax(ajaxurl,{data:{action:a,nonce:o,watermark:i,attachment_id:n.id}}).done((function(n){!0===n.success?(s++,n.data.hasBackup&&c++,t.state.set({processed:s,backupCount:c}),e.length?t.doActionRecursive(e):t.finish()):t.fail(n.data)})).fail((function(){t.fail(ew.i18n.genericErrorMessage)}))}},{key:"fail",value:function(e){var t=this.state.get("attachment").title,n=ew.i18n.bulkActionErrorMessage.replace("{imageTitle}",t).replace("{error}",e);this.state.set({error:n}),this.finish()}},{key:"finish",value:function(){var e=this.state.get("error"),t=this.state.get("processed"),n=this.state.get("successMessage");e?Object(R.a)(e,"error"):Object(R.a)(n.replace("{procesed}",t),"success"),this.state.set({mode:"none"})}}])&&I(t.prototype,n),o&&I(t,o),e}();n(24);r()(document).ready((function(){switch(r()("a.nav-tab-active").data("tab")){case"settings":new a;break;case"watermarks":new p;break;case"tools":new B}}))},,function(e,t){},,function(e,t){}]);
assets/dist/scripts/media-library.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function s(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,s),r.l=!0,r.exports}s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)s.d(i,r,function(t){return e[t]}.bind(null,r));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="../",s(s.s=18)}({0:function(e,t){e.exports=jQuery},1:function(e,t,s){"use strict";s.d(t,"a",(function(){return o})),s.d(t,"b",(function(){return a})),s.d(t,"c",(function(){return n})),s.d(t,"d",(function(){return l}));var i=s(0),r=s.n(i);function o(e,t="info"){const s=r()(document.createElement("div")),i=r()(document.createElement("p")),o=r()(document.createElement("button"));s.addClass("notice notice-"+t+" is-dismissible").hide(),o.addClass("notice-dismiss"),i.html(e),s.append(i).append(o),o.on("click",e=>{e.preventDefault(),s.fadeOut(200,()=>{s.remove()})}),r()("hr.wp-header-end").after(s),s.fadeIn(200)}function a(e,t=!1,s=!0){let i=e.length;for(const r of e.clone().models)(!l(r)||r.get("usedAsWatermark")||!0===t&&!r.get("hasBackup"))&&(!0===s&&e.remove(r),i--);return i}function n(e,t){const s=e.indexOf("?");return-1!==s&&(e=e.substr(0,s)),e+="?v="+t}function l(e){return"object"==typeof e&&e.get&&(e=e.get("mime")),Object.keys(ew.mime).includes(e)}},16:function(e,t){wp.media&&"function"==typeof wp.media.view.SelectModeToggleButton&&(wp.media.view.SelectModeToggleButton=class extends wp.media.view.SelectModeToggleButton{initialize(){super.initialize(),this.controller.on("processing:activate processing:deactivate",this.toggleDisabled,this)}toggleDisabled(){this.model.set("disabled",this.controller.isModeActive("processing"))}toggleBulkEditHandler(){super.toggleBulkEditHandler(),this.controller.trigger("selection:toggle");const e=this.controller.content.get().toolbar;this.controller.isModeActive("select")?e.$(".watermark-mode-toggle-button").removeClass("hidden"):e.$(".watermark-mode-toggle-button").addClass("hidden"),e.$(".watermark-selector").css("display",""),e.$(".ew-status").css("display","")}})},17:function(e,t){wp.media&&("function"==typeof wp.media.view.AttachmentFilters.All&&(wp.media.view.AttachmentFilters.All=class extends wp.media.view.AttachmentFilters.All{initialize(){super.initialize(),this.controller.on("processing:activate processing:deactivate",this.toggleDisabled,this)}toggleDisabled(){this.$el.prop("disabled",!this.$el.is(":disabled"))}}),"function"==typeof wp.media.view.AttachmentFilters.Uploaded&&(wp.media.view.AttachmentFilters.Uploaded=class extends wp.media.view.AttachmentFilters.Uploaded{initialize(){super.initialize(),this.controller.on("processing:activate processing:deactivate",this.toggleDisabled,this)}toggleDisabled(){this.$el.prop("disabled",!this.$el.is(":disabled"))}}),"function"==typeof wp.media.view.DateFilter&&(wp.media.view.DateFilter=class extends wp.media.view.DateFilter{initialize(){super.initialize(),this.controller.on("processing:activate processing:deactivate",this.toggleDisabled,this)}toggleDisabled(){this.$el.prop("disabled",!this.$el.is(":disabled"))}}))},18:function(e,t,s){"use strict";s.r(t);s(30);var i=s(0),r=s.n(i),o=s(1);if(wp.media&&"function"==typeof wp.media.view.Attachment.Library){const e=wp.media.view.Attachment.Library;wp.media.view.Attachment.Library=e.extend({initialize(){e.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"ewBulkAction:start",this.showLoader),this.listenTo(this.model,"ewBulkAction:done",this.render),this.controller.on("selection:toggle watermark:activate processing:activate",this.disable,this),this.controller.on("watermark:deactivate processing:deactivate",this.enable,this)},render(){e.prototype.render.apply(this,arguments),this.$el.append(r()("<span></span>").addClass("spinner"))},toggleSelection({method:t}){(!this.controller.isModeActive("watermark")||Object(o.d)(this.model)&&!this.model.get("usedAsWatermark")||"between"===t)&&e.prototype.toggleSelection.apply(this,arguments),this.controller.isModeActive("watermark")&&(Object(o.d)(this.model)&&!this.model.get("usedAsWatermark")||this.$el.blur(),"between"===t&&Object(o.b)(this.options.selection))},showLoader(){this.$el.find(".spinner").css({visibility:"visible"})},disable(){if(!this.controller.isModeActive("watermark")&&!this.controller.isModeActive("processing"))return;if(this.hasBadge)return;if(this.controller.isModeActive("processing")&&!this.wasSelected())return;let e;if(Object(o.d)(this.model))if(this.model.get("usedAsWatermark"))e=ew.i18n.usedAsWatermark;else{if(!this.controller.isModeActive("restoring")||this.model.get("hasBackup"))return;e=ew.i18n.noBackupAvailable}else e=ew.i18n.notSupported;const t=r()("<div>",{class:"badge"}).text(e);this.$el.addClass("disabled").append(t),this.hasBadge=!0},enable(){this.controller.isModeActive("watermark")||this.controller.isModeActive("processing")||(this.$el.removeClass("disabled").find(".badge").remove(),this.hasBadge=!1)},wasSelected(){const e=this.controller.state().get("originalSelection");if(e)return!!e.get(this.model.cid)}})}let a=null;wp.media&&"function"==typeof wp.media.view.Button&&(a=class extends wp.media.view.Button{initialize(){super.initialize(),this.controller.on("watermark:activate",()=>{this.$el.removeClass("hidden").show()}),this.controller.on("watermark:deactivate",()=>{this.$el.addClass("hidden").hide()}),this.controller.on("watermark:selected",this.toggleDisabled,this),this.model.set("disabled",!0)}render(){return super.render(),this.controller.isModeActive("watermark")?this.$el.addClass("watermark-button"):this.$el.addClass("watermark-button hidden"),this}click(){super.click(),this.controller.state().get("watermark")&&this.controller.ewWatermark()}toggleDisabled(e){this.model.set("disabled",!e.length)}});var n=a;let l=null;wp.media&&"function"==typeof wp.media.view.Button&&(l=class extends wp.media.view.Button{initialize(){super.initialize(),this.model.set({originalText:this.model.get("text")}),this.controller.on("selection:toggle",this.update,this),this.controller.on("watermark:activate watermark:deactivate",this.render,this),this.controller.on("select:activate select:deactivate",this.render,this)}render(){return super.render(),this.controller.isModeActive("select")&&!this.controller.isModeActive("watermark")?this.$el.addClass("restore-button"):this.$el.addClass("restore-button hidden"),this.update(),this}click(){super.click(),this.controller.isModeActive("select")&&this.controller.ewRestoreBackup()}update(){const e=this.model.get("filteredSelectionCount"),t=Object(o.b)(this.controller.state().get("selection"),!0,!1);t!==e&&(this.model.set({filteredSelectionCount:t,text:`${this.model.get("originalText")} (${t})`}),this.model.set("disabled",!Boolean(t)))}});var c=l;let d=null;if(wp.media&&"function"==typeof wp.media.view.Button){class e extends wp.media.view.Button{initialize(){super.initialize(),this.model.set({originalText:this.model.get("text"),cancelText:this.options.cancelText}),delete this.options.cancelText,this.controller.on("selection:toggle",this.update,this),this.controller.on("watermark:activate",()=>this.$el.html(this.model.get("cancelText"))),this.controller.on("watermark:deactivate",this.update,this)}render(){return super.render(),this.controller.isModeActive("select")?this.$el.addClass("watermark-mode-toggle-button"):this.$el.addClass("watermark-mode-toggle-button hidden"),this.update(),this}click(){super.click(),this.controller.isModeActive("watermark")?this.controller.deactivateMode("watermark"):(this.controller.activateMode("watermark"),Object(o.b)(this.controller.state().get("selection")))}update(){if(this.controller.isModeActive("watermark"))return;const e=this.model.get("filteredSelectionCount"),t=Object(o.b)(this.controller.state().get("selection"),!1,!1);t!==e&&(this.model.set({filteredSelectionCount:t,text:`${this.model.get("originalText")} (${t})`}),this.model.set("disabled",!Boolean(t)),this.controller.state().get("selection").length||this.controller.deactivateMode("watermark"))}}d=e}var h=d;let u=null;if(wp.media&&"function"==typeof wp.media.View){class e extends wp.media.View{constructor(e){super(e),this.controller.on("watermark:activate",this.show,this),this.controller.on("watermark:deactivate",this.hide,this)}events(){return{change:"selectWatermark"}}tagName(){return"select"}selectWatermark(){this.controller.trigger("watermark:selected",this.$el.val()),this.controller.state().set("watermark",this.$el.val())}show(){this.$el.removeClass("hidden")}hide(){this.$el.addClass("hidden")}render(){if(super.render(),this.$el.append(r()("<option>",{value:""}).html(ew.i18n.selectWatermarkLabel)),ew.watermarks){1<Object.keys(ew.watermarks).length&&this.$el.append(r()("<option>",{value:"all"}).html(ew.i18n.allWatermarksLabel));for(const e in ew.watermarks)this.$el.append(r()("<option>",{value:e}).html(ew.watermarks[e]))}return this.controller.isModeActive("select")?this.$el.addClass("watermark-selector"):this.$el.addClass("watermark-selector hidden"),this}}u=e}var p=u;let g=null;if(wp.media&&"function"==typeof wp.media.View){class e extends wp.media.View{tagName(){return"p"}className(){return"ew-status"}template(){let e=this.status.get("text");if(this.status.get("progress")){const t=this.status.get("processed"),s=this.status.get("total"),i=`${t}/${s}`,r=Math.floor(t/s*100);"string"==typeof status&&(e=e.replace("{counter}",i)),e+=` (${r}%)`}return`<span class="status">${e}</span>`}constructor(e){super(e),this.status=this.controller.state().get("ewStatus"),this.status.on("change",this.update,this)}render(){return this.update(),this}update(){this.status.get("visible")?this.$el.removeClass("hidden").html(this.template()):this.$el.addClass("hidden")}cancel(e){e.preventDefault(),this.controller.deactivateMode("watermarking")}}g=e}var w=g;wp.media&&"function"==typeof wp.media.view.AttachmentsBrowser&&(wp.media.view.AttachmentsBrowser=class extends wp.media.view.AttachmentsBrowser{createToolbar(){super.createToolbar(),this.controller.state().get("ewStatus")&&(Object.keys(ew.watermarks).length&&(this.toolbar.set("watermarkModeToggleButton",new h({text:ew.i18n.watermarkModeToggleButtonLabel,cancelText:ew.i18n.cancelLabel,controller:this.controller,priority:-60}).render()),this.toolbar.set("watermarkSelector",new p({controller:this.controller,priority:-50}).render()),this.toolbar.set("watermarkButton",new n({text:ew.i18n.watermarkButtonLabel,style:"primary",controller:this.controller,priority:-40}).render())),this.toolbar.set("restoreButton",new c({text:ew.i18n.restoreButtonLabel,controller:this.controller,priority:-30}).render()),this.toolbar.set("watermarkingStatus",new w({style:"primary",controller:this.controller,priority:-20}).render()),this.controller.on("select:deactivate",()=>this.controller.deactivateMode("watermark")),this.controller.on("watermark:activate",this.hideButtons,this),this.controller.on("watermark:deactivate",this.showButtons,this),this.controller.on("processing:activate processing:deactivate",this.disableViewSwitch,this))}hideButtons(){this.$(".select-mode-toggle-button").addClass("hidden"),this.$(".delete-selected-button").addClass("hidden")}showButtons(){this.$el.html(this.model.get("text")),this.$(".select-mode-toggle-button").removeClass("hidden"),this.$(".delete-selected-button").removeClass("hidden")}disableViewSwitch(){const e=this.toolbar.$(".view-switch");e.hasClass("disabled")?e.removeClass("disabled"):e.addClass("disabled")}});s(16),s(17);var m=s(2);wp.media&&wp.media.view&&wp.media.view.MediaFrame&&"function"==typeof wp.media.view.MediaFrame.Manage&&(wp.media.view.MediaFrame.Manage=class extends wp.media.view.MediaFrame.Manage{browseContent(e){this.state().set({ewCollection:new m.Collection,ewStatus:new m.Model}),super.browseContent(e)}ewBulkAction(){const e=this.state(),t=e.get("selection"),s=e.get("ewAction"),i=t.clone();if(e.set("originalSelection",i),Object(o.b)(t,"restore"===s),!t.length)return;const r=e.get("ewCollection"),a=e.get("ewStatus");r.reset();for(const e of t.models)r.add(e),e.trigger("ewBulkAction:start");this.deactivateMode("watermark").trigger("selection:action:done"),this.activateMode("processing"),a.set({total:r.length,processed:0,error:!1,visible:!0,progress:!0}),this.ewBulkActionRecursive()}ewBulkActionRecursive(){const e=this.state(),t=e.get("ewAction"),s=e.get("watermark");let i,a="easy-watermark/";if("watermark"===t)a+="all"===s?"apply_all":"apply_single",i="all"===s?ew.applyAllNonce:ew.applySingleNonces[s];else{if("restore"!==t)return;a+="restore_backup",i=ew.restoreBackupNonce}const n=e.get("ewStatus"),l=e.get("ewCollection").shift(),c={action:a,nonce:i,watermark:s};let d=n.get("processed");c.attachment_id=l.get("id"),e.set("ewCurrentModel",l),r.a.ajax(ajaxurl,{data:c}).done(e=>{if(!0===e.success){if(e.data.attachmentVersion){l.set("url",Object(o.c)(l.get("url"),e.data.attachmentVersion));const t=l.get("sizes");for(const s of Object.keys(t))t[s].url=Object(o.c)(t[s].url,e.data.attachmentVersion);l.set("sizes",t)}l.set("hasBackup",!!e.data.hasBackup),d++,n.set({processed:d}),l.trigger("ewBulkAction:done"),n.get("total")===d?this.ewBulkActionDone():this.ewBulkActionRecursive()}else{const t="string"==typeof e.data.message?e.data.message:ew.i18n.genericErrorMessage;this.ewBulkActionError(t)}}).fail(()=>{this.ewBulkActionError(ew.i18n.genericErrorMessage)})}ewWatermark(){this.state().set({ewAction:"watermark",ewSuccessMessage:ew.i18n.watermarkingSuccessMessage}).get("ewStatus").set({text:ew.i18n.watermarkingStatus}),this.activateMode("watermarking"),this.ewBulkAction()}ewRestoreBackup(){this.state().set({ewAction:"restore",ewSuccessMessage:ew.i18n.restoringSuccessMessage}).get("ewStatus").set({text:ew.i18n.restoringStatus}),this.activateMode("restoring"),this.ewBulkAction()}ewBulkActionError(e){const t=this.state(),s=t.get("ewStatus"),i=t.get("ewCollection"),r=t.get("ewCurrentModel");r&&i.push(r);for(const e of i.models)e.trigger("ewBulkAction:done");s.set({error:e}),this.ewBulkActionDone()}ewBulkActionDone(){const e=this.state(),t=e.get("ewStatus"),s=e.get("ewCurrentModel"),i=t.get("processed"),r=t.get("error"),a=e.get("ewSuccessMessage");if(this.deactivateMode("watermarking"),this.deactivateMode("restoring"),this.deactivateMode("processing"),i>0&&Object(o.a)(a.replace("{procesed}",i),"success"),r){const e=ew.i18n.bulkActionErrorMessage.replace("{imageTitle}",s.get("title")).replace("{error}",r);Object(o.a)(e,"error")}t.set({visible:!1,progress:!1})}});var k=class extends m.View{constructor(e){super(e),this.controller=e.controller,this.bulkActionSelector=e.bulkActionSelector}},b=class extends k{tagName(){return"select"}className(){return"ew-status"}events(){return{change:"selectWatermark"}}constructor(e){super(e),this.listenTo(this.controller,"change",this.update),this.listenTo(this.controller,"bulkAction:start",this.reset)}render(){super.render(),this.$el.append(r()("<option>",{value:""}).html(ew.i18n.selectWatermarkLabel)),1<Object.keys(ew.watermarks).length&&this.$el.append(r()("<option>",{value:"all"}).html(ew.i18n.allWatermarksLabel));for(const e in ew.watermarks)this.$el.append(r()("<option>",{value:e}).html(ew.watermarks[e]));return this.attach(),this}update(){this.bulkActionSelector.is(this.controller.get("select"))&&("watermark"!==this.controller.get("action")||this.controller.status().get("processing")?this.$el.hide():this.$el.show())}reset(){this.$el.val("all").hide()}attach(){return this.bulkActionSelector.after(this.$el),this.$el.hide(),this}selectWatermark(){this.controller.set("watermark",this.$el.val())}},f=class extends k{tagName(){return"p"}className(){return"ew-status"}template(){let e=this.status.get("text");if(this.status.get("processing")){const t=this.status.get("processed"),s=this.status.get("total"),i=`${t}/${s}`;let r=Math.floor(t/s*100);"string"==typeof e&&(e=e.replace("{counter}",i)),isNaN(r)&&(r=0),e=`${e} (${r}%)`}return e}constructor(e){super(e),this.status=this.controller.status(),this.listenTo(this.status,"change",this.update)}render(){super.render(),this.attach()}update(){this.bulkActionSelector.is(this.controller.get("select"))&&(this.status.get("text")?(this.$el.html(this.template()),this.$el.show()):this.$el.hide())}attach(){return this.bulkActionSelector.parent().append(this.$el),this.$el.hide(),this}},v=class extends k{constructor(e){super(e),this.model=e.model,this.listenTo(this.model,"processing:start",this.showSpinner),this.listenTo(this.model,"processing:done",this.reset),this.listenTo(this.model,"remove",this.deselect),this.controller.on("bulkAction:finished",this.reset,this)}showSpinner(){this.getSpinner().appendTo(this.$el.find("span.media-icon"))}getSpinner(){return this.spinner||(this.spinner=r()("<span>",{class:"spinner ew-spinner"})),this.spinner}reset(){this.spinner&&this.spinner.remove(),this.getStatus().text(""),this.$el.find('input[type="checkbox"]').click().prop("checked",!1)}deselect(){if(this.controller.status().get("processing"))return;let e;this.$el.find('input[type="checkbox"]').click().prop("checked",!1),Object(o.d)(this.model)?this.model.get("usedAsWatermark")?e=ew.i18n.usedAsWatermark:"restore"!==this.controller.get("action")||this.model.get("hasBackup")||(e=ew.i18n.noBackupAvailable):e=ew.i18n.notSupported,this.getStatus().text(` - ${e}`)}getStatus(){return this.status||(this.status=r()("<span>",{class:"ew-status"}),this.$el.find("strong.has-media-icon").append(this.status)),this.status}};class A extends m.Model{constructor(){super(),this.bulkActionsSelectors=r()("select#bulk-action-selector-top, select#bulk-action-selector-bottom"),this.bulkActionsSelectors.length&&this.init()}init(){this.selectBulkAction=this.selectBulkAction.bind(this),this.doAction=this.doAction.bind(this),this.form=r()("form#posts-filter"),this.actionButtons=this.form.find("#doaction, #doaction2"),this.bulkActionsSelectors.each((e,t)=>{const s=r()(t);new b({controller:this,bulkActionSelector:s}).render(),new f({controller:this,bulkActionSelector:s}).render()}).val(-1).on("change",this.selectBulkAction),this.set({attachments:new m.Collection,selection:new m.Collection}),this.actionButtons.on("click",this.doAction),this.on("bulkAction:start",()=>{this.bulkActionsSelectors.val(-1).prop("disabled",!0),this.actionButtons.prop("disabled",!0)}),this.on("bulkAction:finished",()=>{this.bulkActionsSelectors.prop("disabled",!1),this.actionButtons.prop("disabled",!1)})}selectBulkAction(e){const t=r()(e.target);this.set({select:t,action:t.val()})}doAction(e){const t=this.get("action");if(!this.checkAction(t))return;e.preventDefault();const s=this.get("watermark");if("watermark"===t&&!s)return;const i=this.form.find('input[name="media[]"]:checked');if(!i.length)return void this.status().set({text:ew.i18n.noItemsSelected});const o=this.get("attachments"),a=this.get("selection"),n=[];this.trigger("bulkAction:start"),i.each((e,t)=>{const s=r()(t).val(),i=o.get(s);i?a.add(i):n.push(s)}),n.length?(this.status().set({text:'<span class="spinner ew-spinner"></span>'}),r.a.ajax(ajaxurl,{data:{action:"easy-watermark/attachments-info",nonce:ew.attachmentsInfoNonce,attachments:n}}).done(e=>{if(!0===e.success){for(const t of e.data){const e=new m.Model(t);o.push(e),a.push(e),new v({el:`#post-${t.id}`,controller:this,model:e})}this.prepare()}else{const t=e.data.message?e.data.message:ew.i18n.genericErrorMessage;this.actionError(t)}}).fail(()=>{this.actionError(ew.i18n.genericErrorMessage)})):a.length&&this.prepare()}prepare(){const e=this.get("action"),t=this.get("selection"),s="restore"===e,i="watermark"===e?ew.i18n.watermarkingStatus:ew.i18n.restoringStatus,r="watermark"===e?ew.i18n.watermarkingSuccessMessage:ew.i18n.restoringSuccessMessage;if(Object(o.b)(t,s),!t.length)return this.status().set({successMessage:"watermark"===e?ew.i18n.watermarkingNoItems:ew.i18n.restoringNoItems}),void this.actionDone();this.status().set({successMessage:r,text:i,processing:!0,total:t.length,processed:0});for(const e of t.models)e.trigger("processing:start");this.doActionRecursive()}doActionRecursive(){const e=this.get("action"),t=this.get("watermark");let s,i="easy-watermark/";if("watermark"===e)i+="all"===t?"apply_all":"apply_single",s="all"===t?ew.applyAllNonce:ew.applySingleNonces[t];else{if("restore"!==e)return;i+="restore_backup",s=ew.restoreBackupNonce}const a=this.status(),n=this.get("selection"),l=n.shift(),c={action:i,nonce:s,watermark:t};let d=a.get("processed");c.attachment_id=l.get("id"),this.set("currentAttachmentID",c.attachment_id),r.a.ajax(ajaxurl,{data:c}).done(e=>{if(!0===e.success){if(e.data.attachmentVersion){const t=this.form.find("tr#post-"+c.attachment_id+" img"),s=Object(o.c)(t.attr("src"),e.data.attachmentVersion);t.attr({src:s,srcset:""})}d++,a.set({processed:d}),l.set("hasBackup",!!e.data.hasBackup),l.trigger("processing:done"),n.length?this.doActionRecursive():this.actionDone()}else{const t="string"==typeof e.data.message?e.data.message:ew.i18n.genericErrorMessage;this.actionError(t)}}).fail(()=>{this.actionError(ew.i18n.genericErrorMessage)})}actionError(e){this.status().set({error:e}),this.actionDone()}actionDone(){this.trigger("bulkAction:finished"),this.bulkActionsSelectors.prop("disabled",!1);const e=this.status(),t=e.get("processed"),s=e.get("error"),i=e.get("successMessage"),r=this.get("currentAttachmentID");if(t>0?Object(o.a)(i.replace("{procesed}",t),"success"):Object(o.a)(i,"info"),s){const e=this.form.find("tr#post-"+r).find(".column-title a").attr("aria-label"),t=ew.i18n.bulkActionErrorMessage.replace("{imageTitle}",e).replace("{error}",s);Object(o.a)(t,"error")}this.status().set({processing:!1,processed:0,total:0,text:""})}status(){let e=this.get("status");return void 0===e&&((e=new m.Model).set({processed:0,total:0}),this.set({status:e})),e}checkAction(e){return["watermark","restore"].includes(e)}}r()(document).ready(()=>new A)},2:function(e,t){e.exports=Backbone},30:function(e,t){}});
1
+ !function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="../",n(n.s=18)}({0:function(t,e){t.exports=jQuery},1:function(t,e,n){"use strict";n.d(e,"a",(function(){return a})),n.d(e,"b",(function(){return c})),n.d(e,"c",(function(){return s})),n.d(e,"d",(function(){return l}));var r=n(0),o=n.n(r);function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=o()(document.createElement("div")),r=o()(document.createElement("p")),i=o()(document.createElement("button"));n.addClass("notice notice-"+e+" is-dismissible").hide(),i.addClass("notice-dismiss"),r.html(t),n.append(r).append(i),i.on("click",(function(t){t.preventDefault(),n.fadeOut(200,(function(){n.remove()}))})),o()("hr.wp-header-end").after(n),n.fadeIn(200)}function c(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.length,o=!0,i=!1,a=void 0;try{for(var c,s=t.clone().models[Symbol.iterator]();!(o=(c=s.next()).done);o=!0){var u=c.value;(!l(u)||u.get("usedAsWatermark")||!0===e&&!u.get("hasBackup"))&&(!0===n&&t.remove(u),r--)}}catch(t){i=!0,a=t}finally{try{o||null==s.return||s.return()}finally{if(i)throw a}}return r}function s(t,e){var n=t.indexOf("?");return-1!==n&&(t=t.substr(0,n)),t+="?v="+e}function l(t){return"object"===i(t)&&t.get&&(t=t.get("mime")),Object.keys(ew.mime).includes(t)}},16:function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function i(t,e,n){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}wp.media&&"function"==typeof wp.media.view.SelectModeToggleButton&&(wp.media.view.SelectModeToggleButton=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,a(e).apply(this,arguments))}var n,s,l;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,wp.media.view.SelectModeToggleButton),n=e,(s=[{key:"initialize",value:function(){i(a(e.prototype),"initialize",this).call(this),this.controller.on("processing:activate processing:deactivate",this.toggleDisabled,this)}},{key:"toggleDisabled",value:function(){this.model.set("disabled",this.controller.isModeActive("processing"))}},{key:"toggleBulkEditHandler",value:function(){i(a(e.prototype),"toggleBulkEditHandler",this).call(this),this.controller.trigger("selection:toggle");var t=this.controller.content.get().toolbar;this.controller.isModeActive("select")?t.$(".watermark-mode-toggle-button").removeClass("hidden"):t.$(".watermark-mode-toggle-button").addClass("hidden"),t.$(".watermark-selector").css("display",""),t.$(".ew-status").css("display","")}}])&&r(n.prototype,s),l&&r(n,l),e}())},17:function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}function a(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t,e,n){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}wp.media&&("function"==typeof wp.media.view.AttachmentFilters.All&&(wp.media.view.AttachmentFilters.All=function(t){function e(){return r(this,e),a(this,s(e).apply(this,arguments))}return l(e,wp.media.view.AttachmentFilters.All),i(e,[{key:"initialize",value:function(){c(s(e.prototype),"initialize",this).call(this),this.controller.on("processing:activate processing:deactivate",this.toggleDisabled,this)}},{key:"toggleDisabled",value:function(){this.$el.prop("disabled",!this.$el.is(":disabled"))}}]),e}()),"function"==typeof wp.media.view.AttachmentFilters.Uploaded&&(wp.media.view.AttachmentFilters.Uploaded=function(t){function e(){return r(this,e),a(this,s(e).apply(this,arguments))}return l(e,wp.media.view.AttachmentFilters.Uploaded),i(e,[{key:"initialize",value:function(){c(s(e.prototype),"initialize",this).call(this),this.controller.on("processing:activate processing:deactivate",this.toggleDisabled,this)}},{key:"toggleDisabled",value:function(){this.$el.prop("disabled",!this.$el.is(":disabled"))}}]),e}()),"function"==typeof wp.media.view.DateFilter&&(wp.media.view.DateFilter=function(t){function e(){return r(this,e),a(this,s(e).apply(this,arguments))}return l(e,wp.media.view.DateFilter),i(e,[{key:"initialize",value:function(){c(s(e.prototype),"initialize",this).call(this),this.controller.on("processing:activate processing:deactivate",this.toggleDisabled,this)}},{key:"toggleDisabled",value:function(){this.$el.prop("disabled",!this.$el.is(":disabled"))}}]),e}()))},18:function(t,e,n){"use strict";n.r(e);n(30);var r=n(0),o=n.n(r),i=n(1);if(wp.media&&"function"==typeof wp.media.view.Attachment.Library){var a=wp.media.view.Attachment.Library;wp.media.view.Attachment.Library=a.extend({initialize:function(){a.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"ewBulkAction:start",this.showLoader),this.listenTo(this.model,"ewBulkAction:done",this.render),this.controller.on("selection:toggle watermark:activate processing:activate",this.disable,this),this.controller.on("watermark:deactivate processing:deactivate",this.enable,this)},render:function(){a.prototype.render.apply(this,arguments),this.$el.append(o()("<span></span>").addClass("spinner"))},toggleSelection:function(t){var e=t.method;(!this.controller.isModeActive("watermark")||Object(i.d)(this.model)&&!this.model.get("usedAsWatermark")||"between"===e)&&a.prototype.toggleSelection.apply(this,arguments),this.controller.isModeActive("watermark")&&(Object(i.d)(this.model)&&!this.model.get("usedAsWatermark")||this.$el.blur(),"between"===e&&Object(i.b)(this.options.selection))},showLoader:function(){this.$el.find(".spinner").css({visibility:"visible"})},disable:function(){if((this.controller.isModeActive("watermark")||this.controller.isModeActive("processing"))&&!this.hasBadge&&(!this.controller.isModeActive("processing")||this.wasSelected())){var t;if(Object(i.d)(this.model))if(this.model.get("usedAsWatermark"))t=ew.i18n.usedAsWatermark;else{if(!this.controller.isModeActive("restoring")||this.model.get("hasBackup"))return;t=ew.i18n.noBackupAvailable}else t=ew.i18n.notSupported;var e=o()("<div>",{class:"badge"}).text(t);this.$el.addClass("disabled").append(e),this.hasBadge=!0}},enable:function(){this.controller.isModeActive("watermark")||this.controller.isModeActive("processing")||(this.$el.removeClass("disabled").find(".badge").remove(),this.hasBadge=!1)},wasSelected:function(){var t=this.controller.state().get("originalSelection");if(t)return!!t.get(this.model.cid)}})}function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return!e||"object"!==c(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t,e,n){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var h=null;wp.media&&"function"==typeof wp.media.view.Button&&(h=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),l(this,f(e).apply(this,arguments))}var n,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)}(e,wp.media.view.Button),n=e,(r=[{key:"initialize",value:function(){var t=this;u(f(e.prototype),"initialize",this).call(this),this.controller.on("watermark:activate",(function(){t.$el.removeClass("hidden").show()})),this.controller.on("watermark:deactivate",(function(){t.$el.addClass("hidden").hide()})),this.controller.on("watermark:selected",this.toggleDisabled,this),this.model.set("disabled",!0)}},{key:"render",value:function(){return u(f(e.prototype),"render",this).call(this),this.controller.isModeActive("watermark")?this.$el.addClass("watermark-button"):this.$el.addClass("watermark-button hidden"),this}},{key:"click",value:function(){u(f(e.prototype),"click",this).call(this),this.controller.state().get("watermark")&&this.controller.ewWatermark()}},{key:"toggleDisabled",value:function(t){this.model.set("disabled",!t.length)}}])&&s(n.prototype,r),o&&s(n,o),e}());var y=h;function d(t){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function b(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t,e){return!e||"object"!==d(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function w(t,e,n){return(w="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=g(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function v(t,e){return(v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var k=null;wp.media&&"function"==typeof wp.media.view.Button&&(k=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),m(this,g(e).apply(this,arguments))}var n,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e)}(e,wp.media.view.Button),n=e,(r=[{key:"initialize",value:function(){w(g(e.prototype),"initialize",this).call(this),this.model.set({originalText:this.model.get("text")}),this.controller.on("selection:toggle",this.update,this),this.controller.on("watermark:activate watermark:deactivate",this.render,this),this.controller.on("select:activate select:deactivate",this.render,this)}},{key:"render",value:function(){return w(g(e.prototype),"render",this).call(this),this.controller.isModeActive("select")&&!this.controller.isModeActive("watermark")?this.$el.addClass("restore-button"):this.$el.addClass("restore-button hidden"),this.update(),this}},{key:"click",value:function(){w(g(e.prototype),"click",this).call(this),this.controller.isModeActive("select")&&this.controller.ewRestoreBackup()}},{key:"update",value:function(){var t=this.model.get("filteredSelectionCount"),e=Object(i.b)(this.controller.state().get("selection"),!0,!1);e!==t&&(this.model.set({filteredSelectionCount:e,text:"".concat(this.model.get("originalText")," (").concat(e,")")}),this.model.set("disabled",!Boolean(e)))}}])&&b(n.prototype,r),o&&b(n,o),e}());var O=k;function S(t){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function j(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _(t,e){return!e||"object"!==S(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function A(t,e,n){return(A="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=P(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function P(t){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function M(t,e){return(M=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var B=null;wp.media&&"function"==typeof wp.media.view.Button&&(B=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),_(this,P(e).apply(this,arguments))}var n,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&M(t,e)}(e,wp.media.view.Button),n=e,(r=[{key:"initialize",value:function(){var t=this;A(P(e.prototype),"initialize",this).call(this),this.model.set({originalText:this.model.get("text"),cancelText:this.options.cancelText}),delete this.options.cancelText,this.controller.on("selection:toggle",this.update,this),this.controller.on("watermark:activate",(function(){return t.$el.html(t.model.get("cancelText"))})),this.controller.on("watermark:deactivate",this.update,this)}},{key:"render",value:function(){return A(P(e.prototype),"render",this).call(this),this.controller.isModeActive("select")?this.$el.addClass("watermark-mode-toggle-button"):this.$el.addClass("watermark-mode-toggle-button hidden"),this.update(),this}},{key:"click",value:function(){A(P(e.prototype),"click",this).call(this),this.controller.isModeActive("watermark")?this.controller.deactivateMode("watermark"):(this.controller.activateMode("watermark"),Object(i.b)(this.controller.state().get("selection")))}},{key:"update",value:function(){if(!this.controller.isModeActive("watermark")){var t=this.model.get("filteredSelectionCount"),e=Object(i.b)(this.controller.state().get("selection"),!1,!1);e!==t&&(this.model.set({filteredSelectionCount:e,text:"".concat(this.model.get("originalText")," (").concat(e,")")}),this.model.set("disabled",!Boolean(e)),this.controller.state().get("selection").length||this.controller.deactivateMode("watermark"))}}}])&&j(n.prototype,r),o&&j(n,o),e}());var x=B;function E(t){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function $(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function C(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function T(t,e,n){return(T="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=R(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function R(t){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function D(t,e){return(D=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var z=null;wp.media&&"function"==typeof wp.media.View&&(z=function(t){function e(t){var n,r,o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),r=this,(n=!(o=R(e).call(this,t))||"object"!==E(o)&&"function"!=typeof o?C(r):o).controller.on("watermark:activate",n.show,C(n)),n.controller.on("watermark:deactivate",n.hide,C(n)),n}var n,r,i;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&D(t,e)}(e,wp.media.View),n=e,(r=[{key:"events",value:function(){return{change:"selectWatermark"}}},{key:"tagName",value:function(){return"select"}},{key:"selectWatermark",value:function(){this.controller.trigger("watermark:selected",this.$el.val()),this.controller.state().set("watermark",this.$el.val())}},{key:"show",value:function(){this.$el.removeClass("hidden")}},{key:"hide",value:function(){this.$el.addClass("hidden")}},{key:"render",value:function(){if(T(R(e.prototype),"render",this).call(this),this.$el.append(o()("<option>",{value:""}).html(ew.i18n.selectWatermarkLabel)),ew.watermarks)for(var t in 1<Object.keys(ew.watermarks).length&&this.$el.append(o()("<option>",{value:"all"}).html(ew.i18n.allWatermarksLabel)),ew.watermarks)this.$el.append(o()("<option>",{value:t}).html(ew.watermarks[t]));return this.controller.isModeActive("select")?this.$el.addClass("watermark-selector"):this.$el.addClass("watermark-selector hidden"),this}}])&&$(n.prototype,r),i&&$(n,i),e}());var N=z;function W(t){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function F(t){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function L(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function V(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function I(t,e,n){return e&&V(t.prototype,e),n&&V(t,n),t}function U(t,e){return(U=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var H=null;wp.media&&"function"==typeof wp.media.View&&(H=function(t){function e(t){var n,r,o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),r=this,(n=!(o=F(e).call(this,t))||"object"!==W(o)&&"function"!=typeof o?L(r):o).status=n.controller.state().get("ewStatus"),n.status.on("change",n.update,L(n)),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&U(t,e)}(e,wp.media.View),I(e,[{key:"tagName",value:function(){return"p"}},{key:"className",value:function(){return"ew-status"}},{key:"template",value:function(){var t=this.status.get("text");if(this.status.get("progress")){var e=this.status.get("processed"),n=this.status.get("total"),r="".concat(e,"/").concat(n),o=Math.floor(e/n*100);"string"==typeof status&&(t=t.replace("{counter}",r)),t+=" (".concat(o,"%)")}return'<span class="status">'.concat(t,"</span>")}}]),I(e,[{key:"render",value:function(){return this.update(),this}},{key:"update",value:function(){this.status.get("visible")?this.$el.removeClass("hidden").html(this.template()):this.$el.addClass("hidden")}},{key:"cancel",value:function(t){t.preventDefault(),this.controller.deactivateMode("watermarking")}}]),e}());var Q=H;function q(t){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function G(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function J(t,e){return!e||"object"!==q(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function K(t,e,n){return(K="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=X(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function X(t){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Y(t,e){return(Y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}wp.media&&"function"==typeof wp.media.view.AttachmentsBrowser&&(wp.media.view.AttachmentsBrowser=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),J(this,X(e).apply(this,arguments))}var n,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Y(t,e)}(e,wp.media.view.AttachmentsBrowser),n=e,(r=[{key:"createToolbar",value:function(){var t=this;K(X(e.prototype),"createToolbar",this).call(this),this.controller.state().get("ewStatus")&&(Object.keys(ew.watermarks).length&&(this.toolbar.set("watermarkModeToggleButton",new x({text:ew.i18n.watermarkModeToggleButtonLabel,cancelText:ew.i18n.cancelLabel,controller:this.controller,priority:-60}).render()),this.toolbar.set("watermarkSelector",new N({controller:this.controller,priority:-50}).render()),this.toolbar.set("watermarkButton",new y({text:ew.i18n.watermarkButtonLabel,style:"primary",controller:this.controller,priority:-40}).render())),this.toolbar.set("restoreButton",new O({text:ew.i18n.restoreButtonLabel,controller:this.controller,priority:-30}).render()),this.toolbar.set("watermarkingStatus",new Q({style:"primary",controller:this.controller,priority:-20}).render()),this.controller.on("select:deactivate",(function(){return t.controller.deactivateMode("watermark")})),this.controller.on("watermark:activate",this.hideButtons,this),this.controller.on("watermark:deactivate",this.showButtons,this),this.controller.on("processing:activate processing:deactivate",this.disableViewSwitch,this))}},{key:"hideButtons",value:function(){this.$(".select-mode-toggle-button").addClass("hidden"),this.$(".delete-selected-button").addClass("hidden")}},{key:"showButtons",value:function(){this.$el.html(this.model.get("text")),this.$(".select-mode-toggle-button").removeClass("hidden"),this.$(".delete-selected-button").removeClass("hidden")}},{key:"disableViewSwitch",value:function(){var t=this.toolbar.$(".view-switch");t.hasClass("disabled")?t.removeClass("disabled"):t.addClass("disabled")}}])&&G(n.prototype,r),o&&G(n,o),e}());n(16),n(17);var Z=n(2);function tt(t){return(tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function et(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function nt(t,e){return!e||"object"!==tt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function rt(t,e,n){return(rt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=ot(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function ot(t){return(ot=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function it(t,e){return(it=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function at(t){return(at="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ct(t,e){return!e||"object"!==at(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function st(t){return(st=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function lt(t,e){return(lt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}wp.media&&wp.media.view&&wp.media.view.MediaFrame&&"function"==typeof wp.media.view.MediaFrame.Manage&&(wp.media.view.MediaFrame.Manage=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),nt(this,ot(e).apply(this,arguments))}var n,r,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&it(t,e)}(e,wp.media.view.MediaFrame.Manage),n=e,(r=[{key:"browseContent",value:function(t){this.state().set({ewCollection:new Z.Collection,ewStatus:new Z.Model}),rt(ot(e.prototype),"browseContent",this).call(this,t)}},{key:"ewBulkAction",value:function(){var t=this.state(),e=t.get("selection"),n=t.get("ewAction"),r=e.clone();if(t.set("originalSelection",r),Object(i.b)(e,"restore"===n),e.length){var o=t.get("ewCollection"),a=t.get("ewStatus");o.reset();var c=!0,s=!1,l=void 0;try{for(var u,f=e.models[Symbol.iterator]();!(c=(u=f.next()).done);c=!0){var p=u.value;o.add(p),p.trigger("ewBulkAction:start")}}catch(t){s=!0,l=t}finally{try{c||null==f.return||f.return()}finally{if(s)throw l}}this.deactivateMode("watermark").trigger("selection:action:done"),this.activateMode("processing"),a.set({total:o.length,processed:0,error:!1,visible:!0,progress:!0}),this.ewBulkActionRecursive()}}},{key:"ewBulkActionRecursive",value:function(){var t,e=this,n=this.state(),r=n.get("ewAction"),a=n.get("watermark"),c="easy-watermark/";if("watermark"===r)c+="all"===a?"apply_all":"apply_single",t="all"===a?ew.applyAllNonce:ew.applySingleNonces[a];else{if("restore"!==r)return;c+="restore_backup",t=ew.restoreBackupNonce}var s=n.get("ewStatus"),l=n.get("ewCollection").shift(),u={action:c,nonce:t,watermark:a},f=s.get("processed");u.attachment_id=l.get("id"),n.set("ewCurrentModel",l),o.a.ajax(ajaxurl,{data:u}).done((function(t){if(!0===t.success){if(t.data.attachmentVersion){l.set("url",Object(i.c)(l.get("url"),t.data.attachmentVersion));for(var n=l.get("sizes"),r=0,o=Object.keys(n);r<o.length;r++){var a=o[r];n[a].url=Object(i.c)(n[a].url,t.data.attachmentVersion)}l.set("sizes",n)}l.set("hasBackup",!!t.data.hasBackup),f++,s.set({processed:f}),l.trigger("ewBulkAction:done"),s.get("total")===f?e.ewBulkActionDone():e.ewBulkActionRecursive()}else{var c="string"==typeof t.data.message?t.data.message:ew.i18n.genericErrorMessage;e.ewBulkActionError(c)}})).fail((function(){e.ewBulkActionError(ew.i18n.genericErrorMessage)}))}},{key:"ewWatermark",value:function(){this.state().set({ewAction:"watermark",ewSuccessMessage:ew.i18n.watermarkingSuccessMessage}).get("ewStatus").set({text:ew.i18n.watermarkingStatus}),this.activateMode("watermarking"),this.ewBulkAction()}},{key:"ewRestoreBackup",value:function(){this.state().set({ewAction:"restore",ewSuccessMessage:ew.i18n.restoringSuccessMessage}).get("ewStatus").set({text:ew.i18n.restoringStatus}),this.activateMode("restoring"),this.ewBulkAction()}},{key:"ewBulkActionError",value:function(t){var e=this.state(),n=e.get("ewStatus"),r=e.get("ewCollection"),o=e.get("ewCurrentModel");o&&r.push(o);var i=!0,a=!1,c=void 0;try{for(var s,l=r.models[Symbol.iterator]();!(i=(s=l.next()).done);i=!0)s.value.trigger("ewBulkAction:done")}catch(t){a=!0,c=t}finally{try{i||null==l.return||l.return()}finally{if(a)throw c}}n.set({error:t}),this.ewBulkActionDone()}},{key:"ewBulkActionDone",value:function(){var t=this.state(),e=t.get("ewStatus"),n=t.get("ewCurrentModel"),r=e.get("processed"),o=e.get("error"),a=t.get("ewSuccessMessage");if(this.deactivateMode("watermarking"),this.deactivateMode("restoring"),this.deactivateMode("processing"),r>0&&Object(i.a)(a.replace("{procesed}",r),"success"),o){var c=ew.i18n.bulkActionErrorMessage.replace("{imageTitle}",n.get("title")).replace("{error}",o);Object(i.a)(c,"error")}e.set({visible:!1,progress:!1})}}])&&et(n.prototype,r),a&&et(n,a),e}());var ut=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=ct(this,st(e).call(this,t))).controller=t.controller,n.bulkActionSelector=t.bulkActionSelector,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&lt(t,e)}(e,t),e}(Z.View);function ft(t){return(ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function pt(t,e){return!e||"object"!==ft(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ht(t,e,n){return(ht="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=yt(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function yt(t){return(yt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function dt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function bt(t,e,n){return e&&dt(t.prototype,e),n&&dt(t,n),t}function mt(t,e){return(mt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var wt=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=pt(this,yt(e).call(this,t))).listenTo(n.controller,"change",n.update),n.listenTo(n.controller,"bulkAction:start",n.reset),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&mt(t,e)}(e,t),bt(e,[{key:"tagName",value:function(){return"select"}},{key:"className",value:function(){return"ew-status"}},{key:"events",value:function(){return{change:"selectWatermark"}}}]),bt(e,[{key:"render",value:function(){for(var t in ht(yt(e.prototype),"render",this).call(this),this.$el.append(o()("<option>",{value:""}).html(ew.i18n.selectWatermarkLabel)),1<Object.keys(ew.watermarks).length&&this.$el.append(o()("<option>",{value:"all"}).html(ew.i18n.allWatermarksLabel)),ew.watermarks)this.$el.append(o()("<option>",{value:t}).html(ew.watermarks[t]));return this.attach(),this}},{key:"update",value:function(){this.bulkActionSelector.is(this.controller.get("select"))&&("watermark"!==this.controller.get("action")||this.controller.status().get("processing")?this.$el.hide():this.$el.show())}},{key:"reset",value:function(){this.$el.val("all").hide()}},{key:"attach",value:function(){return this.bulkActionSelector.after(this.$el),this.$el.hide(),this}},{key:"selectWatermark",value:function(){this.controller.set("watermark",this.$el.val())}}]),e}(ut);function gt(t){return(gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function vt(t,e){return!e||"object"!==gt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function kt(t,e,n){return(kt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ot(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function Ot(t){return(Ot=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function St(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function jt(t,e,n){return e&&St(t.prototype,e),n&&St(t,n),t}function _t(t,e){return(_t=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var At=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=vt(this,Ot(e).call(this,t))).status=n.controller.status(),n.listenTo(n.status,"change",n.update),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_t(t,e)}(e,t),jt(e,[{key:"tagName",value:function(){return"p"}},{key:"className",value:function(){return"ew-status"}},{key:"template",value:function(){var t=this.status.get("text");if(this.status.get("processing")){var e=this.status.get("processed"),n=this.status.get("total"),r="".concat(e,"/").concat(n),o=Math.floor(e/n*100);"string"==typeof t&&(t=t.replace("{counter}",r)),isNaN(o)&&(o=0),t="".concat(t," (").concat(o,"%)")}return t}}]),jt(e,[{key:"render",value:function(){kt(Ot(e.prototype),"render",this).call(this),this.attach()}},{key:"update",value:function(){this.bulkActionSelector.is(this.controller.get("select"))&&(this.status.get("text")?(this.$el.html(this.template()),this.$el.show()):this.$el.hide())}},{key:"attach",value:function(){return this.bulkActionSelector.parent().append(this.$el),this.$el.hide(),this}}]),e}(ut);function Pt(t){return(Pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Mt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Bt(t){return(Bt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function xt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Et(t,e){return(Et=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var $t=function(t){function e(t){var n,r,o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),r=this,(n=!(o=Bt(e).call(this,t))||"object"!==Pt(o)&&"function"!=typeof o?xt(r):o).model=t.model,n.listenTo(n.model,"processing:start",n.showSpinner),n.listenTo(n.model,"processing:done",n.reset),n.listenTo(n.model,"remove",n.deselect),n.controller.on("bulkAction:finished",n.reset,xt(n)),n}var n,r,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Et(t,e)}(e,t),n=e,(r=[{key:"showSpinner",value:function(){this.getSpinner().appendTo(this.$el.find("span.media-icon"))}},{key:"getSpinner",value:function(){return this.spinner||(this.spinner=o()("<span>",{class:"spinner ew-spinner"})),this.spinner}},{key:"reset",value:function(){this.spinner&&this.spinner.remove(),this.getStatus().text(""),this.$el.find('input[type="checkbox"]').click().prop("checked",!1)}},{key:"deselect",value:function(){var t;this.controller.status().get("processing")||(this.$el.find('input[type="checkbox"]').click().prop("checked",!1),Object(i.d)(this.model)?this.model.get("usedAsWatermark")?t=ew.i18n.usedAsWatermark:"restore"!==this.controller.get("action")||this.model.get("hasBackup")||(t=ew.i18n.noBackupAvailable):t=ew.i18n.notSupported,this.getStatus().text(" - ".concat(t)))}},{key:"getStatus",value:function(){return this.status||(this.status=o()("<span>",{class:"ew-status"}),this.$el.find("strong.has-media-icon").append(this.status)),this.status}}])&&Mt(n.prototype,r),a&&Mt(n,a),e}(ut);function Ct(t){return(Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Tt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Rt(t,e){return!e||"object"!==Ct(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Dt(t){return(Dt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function zt(t,e){return(zt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var Nt=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Rt(this,Dt(e).call(this))).bulkActionsSelectors=o()("select#bulk-action-selector-top, select#bulk-action-selector-bottom"),t.bulkActionsSelectors.length&&t.init(),t}var n,r,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&zt(t,e)}(e,t),n=e,(r=[{key:"init",value:function(){var t=this;this.selectBulkAction=this.selectBulkAction.bind(this),this.doAction=this.doAction.bind(this),this.form=o()("form#posts-filter"),this.actionButtons=this.form.find("#doaction, #doaction2"),this.bulkActionsSelectors.each((function(e,n){var r=o()(n);new wt({controller:t,bulkActionSelector:r}).render(),new At({controller:t,bulkActionSelector:r}).render()})).val(-1).on("change",this.selectBulkAction),this.set({attachments:new Z.Collection,selection:new Z.Collection}),this.actionButtons.on("click",this.doAction),this.on("bulkAction:start",(function(){t.bulkActionsSelectors.val(-1).prop("disabled",!0),t.actionButtons.prop("disabled",!0)})),this.on("bulkAction:finished",(function(){t.bulkActionsSelectors.prop("disabled",!1),t.actionButtons.prop("disabled",!1)}))}},{key:"selectBulkAction",value:function(t){var e=o()(t.target);this.set({select:e,action:e.val()})}},{key:"doAction",value:function(t){var e=this,n=this.get("action");if(this.checkAction(n)){t.preventDefault();var r=this.get("watermark");if("watermark"!==n||r){var i=this.form.find('input[name="media[]"]:checked');if(i.length){var a=this.get("attachments"),c=this.get("selection"),s=[];this.trigger("bulkAction:start"),i.each((function(t,e){var n=o()(e).val(),r=a.get(n);r?c.add(r):s.push(n)})),s.length?(this.status().set({text:'<span class="spinner ew-spinner"></span>'}),o.a.ajax(ajaxurl,{data:{action:"easy-watermark/attachments-info",nonce:ew.attachmentsInfoNonce,attachments:s}}).done((function(t){if(!0===t.success){var n=!0,r=!1,o=void 0;try{for(var i,s=t.data[Symbol.iterator]();!(n=(i=s.next()).done);n=!0){var l=i.value,u=new Z.Model(l);a.push(u),c.push(u),new $t({el:"#post-".concat(l.id),controller:e,model:u})}}catch(t){r=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}e.prepare()}else{var f=t.data.message?t.data.message:ew.i18n.genericErrorMessage;e.actionError(f)}})).fail((function(){e.actionError(ew.i18n.genericErrorMessage)}))):c.length&&this.prepare()}else this.status().set({text:ew.i18n.noItemsSelected})}}}},{key:"prepare",value:function(){var t=this.get("action"),e=this.get("selection"),n="restore"===t,r="watermark"===t?ew.i18n.watermarkingStatus:ew.i18n.restoringStatus,o="watermark"===t?ew.i18n.watermarkingSuccessMessage:ew.i18n.restoringSuccessMessage;if(Object(i.b)(e,n),!e.length)return this.status().set({successMessage:"watermark"===t?ew.i18n.watermarkingNoItems:ew.i18n.restoringNoItems}),void this.actionDone();this.status().set({successMessage:o,text:r,processing:!0,total:e.length,processed:0});var a=!0,c=!1,s=void 0;try{for(var l,u=e.models[Symbol.iterator]();!(a=(l=u.next()).done);a=!0)l.value.trigger("processing:start")}catch(t){c=!0,s=t}finally{try{a||null==u.return||u.return()}finally{if(c)throw s}}this.doActionRecursive()}},{key:"doActionRecursive",value:function(){var t,e=this,n=this.get("action"),r=this.get("watermark"),a="easy-watermark/";if("watermark"===n)a+="all"===r?"apply_all":"apply_single",t="all"===r?ew.applyAllNonce:ew.applySingleNonces[r];else{if("restore"!==n)return;a+="restore_backup",t=ew.restoreBackupNonce}var c=this.status(),s=this.get("selection"),l=s.shift(),u={action:a,nonce:t,watermark:r},f=c.get("processed");u.attachment_id=l.get("id"),this.set("currentAttachmentID",u.attachment_id),o.a.ajax(ajaxurl,{data:u}).done((function(t){if(!0===t.success){if(t.data.attachmentVersion){var n=e.form.find("tr#post-"+u.attachment_id+" img"),r=Object(i.c)(n.attr("src"),t.data.attachmentVersion);n.attr({src:r,srcset:""})}f++,c.set({processed:f}),l.set("hasBackup",!!t.data.hasBackup),l.trigger("processing:done"),s.length?e.doActionRecursive():e.actionDone()}else{var o="string"==typeof t.data.message?t.data.message:ew.i18n.genericErrorMessage;e.actionError(o)}})).fail((function(){e.actionError(ew.i18n.genericErrorMessage)}))}},{key:"actionError",value:function(t){this.status().set({error:t}),this.actionDone()}},{key:"actionDone",value:function(){this.trigger("bulkAction:finished"),this.bulkActionsSelectors.prop("disabled",!1);var t=this.status(),e=t.get("processed"),n=t.get("error"),r=t.get("successMessage"),o=this.get("currentAttachmentID");if(e>0?Object(i.a)(r.replace("{procesed}",e),"success"):Object(i.a)(r,"info"),n){var a=this.form.find("tr#post-"+o).find(".column-title a").attr("aria-label"),c=ew.i18n.bulkActionErrorMessage.replace("{imageTitle}",a).replace("{error}",n);Object(i.a)(c,"error")}this.status().set({processing:!1,processed:0,total:0,text:""})}},{key:"status",value:function(){var t=this.get("status");return void 0===t&&(t=new Z.Model,t.set({processed:0,total:0}),this.set({status:t})),t}},{key:"checkAction",value:function(t){return["watermark","restore"].includes(t)}}])&&Tt(n.prototype,r),a&&Tt(n,a),e}(Z.Model);o()(document).ready((function(){return new Nt}))},2:function(t,e){t.exports=Backbone},30:function(t,e){}});
assets/dist/scripts/uploader.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="../",r(r.s=15)}({0:function(e,t){e.exports=jQuery},15:function(e,t,r){"use strict";r.r(t);var a=r(0),n=r.n(a);r(26);n()(document).ready(()=>{if("undefined"!=typeof wp&&"function"==typeof wp.Uploader){const e=wp.Uploader;wp.Uploader=class extends e{init(){super.init(),this.updateAutoWatermarkParam=this.updateAutoWatermarkParam.bind(this),n()("body").on("change",".ew-watermark-all-switch input",this.updateAutoWatermarkParam),this.param("auto_watermark",ew.autoWatermark)}updateAutoWatermarkParam(e){ew.autoWatermark=n()(e.target).is(":checked"),this.param("auto_watermark",ew.autoWatermark)}}}if("undefined"!=typeof wp&&"function"==typeof wp.media.view.UploaderInline){const e=wp.media.view.UploaderInline;wp.media.view.UploaderInline=e.extend({render(){e.prototype.render.apply(this,arguments),this.$el.hasClass("hidden")||this.$el.find(".ew-watermark-all-switch input").prop("checked",ew.autoWatermark)}})}})},26:function(e,t){}});
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="../",r(r.s=15)}({0:function(e,t){e.exports=jQuery},15:function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n);r(26);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function f(e,t,r){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}o()(document).ready((function(){if("undefined"!=typeof wp&&"function"==typeof wp.Uploader){var e=wp.Uploader;wp.Uploader=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,c(t).apply(this,arguments))}var r,n,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(t,e),r=t,(n=[{key:"init",value:function(){f(c(t.prototype),"init",this).call(this),this.updateAutoWatermarkParam=this.updateAutoWatermarkParam.bind(this),o()("body").on("change",".ew-watermark-all-switch input",this.updateAutoWatermarkParam),this.param("auto_watermark",ew.autoWatermark)}},{key:"updateAutoWatermarkParam",value:function(e){ew.autoWatermark=o()(e.target).is(":checked"),this.param("auto_watermark",ew.autoWatermark)}}])&&i(r.prototype,n),a&&i(r,a),t}(e)}if("undefined"!=typeof wp&&wp.media&&"function"==typeof wp.media.view.UploaderInline){var t=wp.media.view.UploaderInline;wp.media.view.UploaderInline=t.extend({render:function(){t.prototype.render.apply(this,arguments),this.$el.hasClass("hidden")||this.$el.find(".ew-watermark-all-switch input").prop("checked",ew.autoWatermark)}})}}))},26:function(e,t){}});
assets/dist/scripts/watermark-edit.js CHANGED
@@ -1,8 +1,8 @@
1
- !function(t){var e={};function i(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="../",i(i.s=19)}({0:function(t,e){t.exports=jQuery},1:function(t,e,i){"use strict";i.d(e,"a",(function(){return r})),i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return s})),i.d(e,"d",(function(){return c}));var n=i(0),o=i.n(n);function r(t,e="info"){const i=o()(document.createElement("div")),n=o()(document.createElement("p")),r=o()(document.createElement("button"));i.addClass("notice notice-"+e+" is-dismissible").hide(),r.addClass("notice-dismiss"),n.html(t),i.append(n).append(r),r.on("click",t=>{t.preventDefault(),i.fadeOut(200,()=>{i.remove()})}),o()("hr.wp-header-end").after(i),i.fadeIn(200)}function a(t,e=!1,i=!0){let n=t.length;for(const o of t.clone().models)(!c(o)||o.get("usedAsWatermark")||!0===e&&!o.get("hasBackup"))&&(!0===i&&t.remove(o),n--);return n}function s(t,e){const i=t.indexOf("?");return-1!==i&&(t=t.substr(0,i)),t+="?v="+e}function c(t){return"object"==typeof t&&t.get&&(t=t.get("mime")),Object.keys(ew.mime).includes(t)}},19:function(t,e,i){"use strict";i.r(e);var n=i(0),o=i.n(n),r=(i(32),class{constructor(){this.metabox=o()("#watermark-content"),this.form=o()("form#post"),this.imageContent=this.metabox.find(".image-content"),this.textContent=this.metabox.find(".text-content"),this.buttonWrap=this.metabox.find(".select-image-button"),this.button=this.buttonWrap.find("a"),this.imageWrap=this.metabox.find(".watermark-image"),this.image=this.imageWrap.find("img"),this.mimeTypeField=this.metabox.find("input.watermark-mime-type"),this.urlField=this.metabox.find("input.watermark-url"),this.attachmentIdField=this.metabox.find("input.watermark-id"),this.opacityField=this.metabox.find("input#opacity"),this.opacityFieldDesc=this.metabox.find(".opacity-desc"),this.watermarkTextField=this.metabox.find("input.watermark-text"),this.attachmentId=this.attachmentIdField.val(),this.openMediaLibrary=this.openMediaLibrary.bind(this),this.update=this.update.bind(this),this.watermarkTextChange=this.watermarkTextChange.bind(this),this.form.on("ew.update",this.update),this.button.on("click",this.openMediaLibrary),this.image.on("click",this.openMediaLibrary),this.image.attr("src")?(this.imageWrap.show(),this.switchOpacityField(this.mimeTypeField.val())):this.buttonWrap.show(),this.textChangeTimeout=null,this.watermarkTextField.on("input",this.watermarkTextChange)}enable(t){this.metabox.fadeIn(200),"image"===t?(this.imageContent.show(),this.textContent.hide(),this.opacityField.prop("disabled",!1)):(this.textContent.show(),this.imageContent.hide(),this.opacityField.prop("disabled",!0),this.prepareTextPreview())}watermarkTextChange(){clearTimeout(this.textChangeTimeout),this.textChangeTimeout=setTimeout(()=>{this.form.trigger("ew.save")},500)}prepareTextPreview(){this.previewWrap||(this.previewWrap=this.metabox.find(".text-preview"),this.preview=o()(document.createElement("img")),this.previewWrap.hide().append(this.preview)),this.refreshPreview()}refreshPreview(){if(this.watermarkTextField.val().length){const t=this.previewWrap.data("src")+"?t="+Date.now();this.preview.attr("src",t),this.previewWrap.show()}else this.previewWrap.hide()}openMediaLibrary(t){t.preventDefault(),this.frame||this.createMediaFrame(),this.frame.open()}createMediaFrame(){this.frame=wp.media.frames.watermarkSelection=wp.media({title:this.button.data("choose"),library:{type:"image"},button:{text:this.button.data("buttonLabel"),close:!0}}),this.frame.on("select",this.selectImage,this).on("open",this.applySelection,this).on("close",this.checkSelectedAttachment,this)}selectImage(){const t=this.frame.state().get("selection").first(),e=t.get("mime"),i=t.get("url");this.attachmentId=t.get("id"),this.mimeTypeField.val(e),this.urlField.val(i),this.attachmentIdField.val(this.attachmentId),this.switchOpacityField(e),this.image.attr("src",i),this.imageWrap.show(),this.buttonWrap.hide(),this.form.trigger("ew.save")}applySelection(){if(this.attachmentId){const t=this.frame.state().get("selection"),e=wp.media.attachment(this.attachmentId);e.fetch(),e&&t.add([e])}}checkSelectedAttachment(){const t=wp.media.attachment(this.attachmentId);t.fetch(),t&&!0!==t.destroyed||(this.mimeTypeField.val(""),this.urlField.val(""),this.attachmentIdField.val(""),this.imageWrap.hide(),this.buttonWrap.show())}switchOpacityField(t){"image/png"===t?(this.opacityField.parent().hide(),this.opacityFieldDesc.show()):(this.opacityField.parent().show(),this.opacityFieldDesc.hide())}update(){"text"===this.form.find("input.watermark-type:checked").val()&&this.refreshPreview()}}),a=class{constructor(){this.metabox=o()("#alignment")}enable(){this.metabox.fadeIn(200)}},s=class{constructor(){this.metabox=o()("#applying-rules"),this.autoAddCheckbox=this.metabox.find("#watermark-autoadd"),this.hiddenSections=this.metabox.find(".hidden"),this.toggleOptionsVisibility=this.toggleOptionsVisibility.bind(this),this.autoAddCheckbox.on("change",this.toggleOptionsVisibility),this.toggleOptionsVisibility()}enable(){this.metabox.fadeIn(200)}toggleOptionsVisibility(){this.autoAddCheckbox.prop("checked")?this.hiddenSections.show():this.hiddenSections.hide()}},c=class{constructor(){this.metabox=o()("#scaling"),this.scalingModeSelect=this.metabox.find("#watermark-scaling-mode"),this.hiddenSections=this.metabox.find(".hidden"),this.fields=this.metabox.find("input, select"),this.toggleOptionsVisibility=this.toggleOptionsVisibility.bind(this),this.scalingModeSelect.on("change",this.toggleOptionsVisibility),this.toggleOptionsVisibility()}enable(t){"image"===t?(this.metabox.fadeIn(200),this.fields.prop("disabled",!1)):(this.metabox.hide(),this.fields.prop("disabled",!0))}toggleOptionsVisibility(){switch(this.hiddenSections.hide(),this.scalingModeSelect.val()){case"fit_to_width":case"fit_to_height":this.hiddenSections.show();break;case"cover":case"contain":this.hiddenSections.filter(".show-for-all").show()}}},h=class{constructor(){this.metabox=o()("#text-options"),this.form=o()("form#post"),this.colorInput=this.metabox.find("#text-color"),this.fields=this.metabox.find("input, select"),this.colorChangeTimeout=null,this.colorChanged=this.colorChanged.bind(this),this.colorInput.wpColorPicker({palettes:!0,change:this.colorChanged})}colorChanged(){clearTimeout(this.colorChangeTimeout),this.colorChangeTimeout=setTimeout(()=>{this.form.trigger("ew.save")},500)}enable(t){"text"===t?(this.metabox.fadeIn(200),this.fields.prop("disabled",!1)):(this.metabox.hide(),this.fields.prop("disabled",!0))}},l=i(1),d=class{constructor(){this.metabox=o()("#preview"),this.body=o()("body"),this.form=o()("form#post"),this.watermarkTextField=this.form.find("input.watermark-text"),this.attachmentIdField=this.form.find("input.watermark-id"),this.link=this.metabox.find(".select-preview-image"),this.previewWrap=this.metabox.find(".preview-wrap"),this.contentWrap=this.metabox.find(".content-wrap"),this.imageSelector=this.metabox.find(".image-selector"),this.popup=this.metabox.find(".ew-preview-popup"),this.spinner=this.metabox.find("span.spinner"),this.image=o()(document.createElement("img")),this.popup.appendTo(this.body),this.openMediaLibrary=this.openMediaLibrary.bind(this),this.openPopup=this.openPopup.bind(this),this.closePopup=this.closePopup.bind(this),this.selectImage=this.selectImage.bind(this),this.imageSelected=this.imageSelected.bind(this),this.update=this.update.bind(this),this.hasImage=this.previewWrap.data("hasImage"),this.link.on("click",this.openMediaLibrary),this.form.on("ew.update",this.update),this.image.on("click",this.openPopup),this.popup.find(".media-modal-close, .media-modal-backdrop").on("click",this.closePopup),this.imageSelector.hide(),this.contentWrap.hide(),this.previewWrap.prepend(this.image),this.refreshPreview()}enable(){this.metabox.fadeIn(200)}openMediaLibrary(t){t.preventDefault(),this.frame||this.createMediaFrame(),this.frame.open()}createMediaFrame(){this.frame=wp.media.frames.previewImage=wp.media({title:this.link.data("choose"),library:{type:"image"},button:{text:this.link.data("buttonLabel"),close:!0}}),this.frame.on("select",this.selectImage)}selectImage(){const t=this.frame.state().get("selection").first(),e=this.form.find("input[name=post_ID]").val();this.contentWrap.hide(),this.spinner.css("display","block"),o.a.ajax({type:"post",url:ajaxurl,data:{action:"easy-watermark/preview_image",attachment_id:t.id,watermark_id:e,nonce:ew.previewImageNonce}}).done(this.imageSelected).fail(()=>{})}imageSelected(t){if(!0===t.success){if(this.link.html(this.link.data("changeLabel")),this.hasImage=!0,t.data.popup){const e=o()(t.data.popup);this.popup.find(".media-frame-content").replaceWith(e.find(".media-frame-content"))}this.refreshPreview()}}refreshPreview(){if(this.contentWrap.hide(),this.hasImage){this.imageSelector.hide(),this.spinner.css("display","block");const t=Date.now(),e=Object(l.c)(this.previewWrap.data("src"),t);this.popup.find("img").each((e,i)=>{const n=o()(i),r=Object(l.c)(n.attr("src"),t);n.attr("src",r)}),this.image.one("load",()=>{this.spinner.hide(),this.contentWrap.fadeIn(200),this.imageSelector.fadeIn(200)}).attr("src",e)}else this.imageSelector.show()}openPopup(){this.popup.show(),this.body.addClass("modal-open")}closePopup(){this.popup.hide(),this.body.removeClass("modal-open")}hasPreview(){const t=this.form.find("input.watermark-type:checked").val();return!("text"!==t||!this.watermarkTextField.val().length)||!("image"!==t||!this.attachmentIdField.val().length)}update(){this.refreshPreview()}},u=i(4),p=i.n(u),f=class{constructor(){this.metabox=o()("#placeholders"),this.placeholders=this.metabox.find(".placeholders-list li"),this.searchField=this.metabox.find("input.ew-search-placeholders"),this.clipboard=new p.a(".placeholders-list code"),this.clipboardSuccess=this.clipboardSuccess.bind(this),this.filterPlaceholders=this.filterPlaceholders.bind(this),this.clipboard.on("success",this.clipboardSuccess),this.searchField.on("keyup",this.filterPlaceholders)}enable(t){"text"===t?this.metabox.fadeIn(200):this.metabox.hide()}clipboardSuccess(t){const e=o()(t.trigger);e.text("Copied"),setTimeout(()=>{e.text(t.text)},1e3)}filterPlaceholders(t){const e=o()(t.target).val();this.placeholders.hide().each((t,i)=>{const n=o()(i);-1!==n.find("code").text().toLowerCase().indexOf(e)&&n.show()})}},m=class{constructor(){this.fields=o()(".form-field"),this.buttons=this.fields.find("button[data-toggle=dropdown]"),this.dropdowns=this.fields.find(".dropdown-menu[data-target]"),this.links=this.dropdowns.find("a"),this.init()}init(){this.toggleDropdown=this.toggleDropdown.bind(this),this.dropdownSelect=this.dropdownSelect.bind(this),this.hideDropdowns=this.hideDropdowns.bind(this),this.buttons.on("click",this.toggleDropdown),this.links.on("click",this.dropdownSelect),o()(document).on("click",this.hideDropdowns)}toggleDropdown(t){t.preventDefault();const e=o()(t.target),i=e.position();e.next(".dropdown-menu").css({left:i.left,top:i.top+e.height()}).toggle()}dropdownSelect(t){t.preventDefault();const e=o()(t.target),i=e.closest(".dropdown-menu"),n=o()(i.data("target"));n.length&&(n.val(e.data("value")),i.prev("button[data-toggle=dropdown]").text(e.text()))}hideDropdowns(t){o()(t.target).is(this.buttons)||this.dropdowns.hide()}};class g{constructor(){this.selectWatermarkType=this.selectWatermarkType.bind(this),this.triggerSave=this.triggerSave.bind(this),this.form=o()("form#post"),this.selector=this.form.find("input.watermark-type"),this.metaboxes=[new r,new a,new s,new c,new h,new d,new f],new m;const t=this.selector.filter("[checked]");t.length&&this.selectWatermarkType(t[0].value),this.selector.on("change",t=>{this.selectWatermarkType(t.target.value)}),this.form.on("change","input, select",this.triggerSave).on("ew.save",this.triggerSave)}selectWatermarkType(t){for(const e of this.metaboxes)e.enable(t)}triggerSave(){const t={action:"easy-watermark/autosave",nonce:ew.autosaveNonce};let e=this.form.find("[name^=watermark], [name=post_ID]").serialize();for(const i in t)e+="&"+encodeURIComponent(i)+"="+encodeURIComponent(t[i]);o.a.ajax({type:"post",url:ajaxurl,data:e}).done(t=>{!0===t.success&&this.form.trigger("ew.update")}).fail(()=>{})}}o()(document).ready(()=>new g)},32:function(t,e){},4:function(t,e,i){
2
  /*!
3
  * clipboard.js v2.0.4
4
  * https://zenorocha.github.io/clipboard.js
5
  *
6
  * Licensed MIT © Zeno Rocha
7
  */
8
- var n;n=function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=c(i(1)),a=c(i(3)),s=c(i(4));function c(t){return t&&t.__esModule?t:{default:t}}var h=function(t){function e(t,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.resolveOptions(i),n.listenClick(t),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"resolveOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===n(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,s.default)(t,"click",(function(t){return e.onClick(t)}))}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new r.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return l("action",t)}},{key:"defaultTarget",value:function(t){var e=l("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return l("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,i=!!document.queryCommandSupported;return e.forEach((function(t){i=i&&!!document.queryCommandSupported(t)})),i}}]),e}(a.default);function l(t,e){var i="data-clipboard-"+t;if(e.hasAttribute(i))return e.getAttribute(i)}t.exports=h},function(t,e,i){"use strict";var n,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),a=i(2),s=(n=a)&&n.__esModule?n:{default:n},c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.resolveOptions(e),this.initSelection()}return r(t,[{key:"resolveOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var i=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=i+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,s.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,s.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":o(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),t}();t.exports=c},function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var i=t.hasAttribute("readonly");i||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),i||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var n=window.getSelection(),o=document.createRange();o.selectNodeContents(t),n.removeAllRanges(),n.addRange(o),e=n.toString()}return e}},function(t,e){function i(){}i.prototype={on:function(t,e,i){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:i}),this},once:function(t,e,i){var n=this;function o(){n.off(t,o),e.apply(i,arguments)}return o._=e,this.on(t,o,i)},emit:function(t){for(var e=[].slice.call(arguments,1),i=((this.e||(this.e={}))[t]||[]).slice(),n=0,o=i.length;n<o;n++)i[n].fn.apply(i[n].ctx,e);return this},off:function(t,e){var i=this.e||(this.e={}),n=i[t],o=[];if(n&&e)for(var r=0,a=n.length;r<a;r++)n[r].fn!==e&&n[r].fn._!==e&&o.push(n[r]);return o.length?i[t]=o:delete i[t],this}},t.exports=i},function(t,e,i){var n=i(5),o=i(6);t.exports=function(t,e,i){if(!t&&!e&&!i)throw new Error("Missing required arguments");if(!n.string(e))throw new TypeError("Second argument must be a String");if(!n.fn(i))throw new TypeError("Third argument must be a Function");if(n.node(t))return function(t,e,i){return t.addEventListener(e,i),{destroy:function(){t.removeEventListener(e,i)}}}(t,e,i);if(n.nodeList(t))return function(t,e,i){return Array.prototype.forEach.call(t,(function(t){t.addEventListener(e,i)})),{destroy:function(){Array.prototype.forEach.call(t,(function(t){t.removeEventListener(e,i)}))}}}(t,e,i);if(n.string(t))return function(t,e,i){return o(document.body,t,e,i)}(t,e,i);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}},function(t,e){e.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},e.nodeList=function(t){var i=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===i||"[object HTMLCollection]"===i)&&"length"in t&&(0===t.length||e.node(t[0]))},e.string=function(t){return"string"==typeof t||t instanceof String},e.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},function(t,e,i){var n=i(7);function o(t,e,i,n,o){var a=r.apply(this,arguments);return t.addEventListener(i,a,o),{destroy:function(){t.removeEventListener(i,a,o)}}}function r(t,e,i,o){return function(i){i.delegateTarget=n(i.target,e),i.delegateTarget&&o.call(t,i)}}t.exports=function(t,e,i,n,r){return"function"==typeof t.addEventListener?o.apply(null,arguments):"function"==typeof i?o.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,(function(t){return o(t,e,i,n,r)})))}},function(t,e){var i=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}t.exports=function(t,e){for(;t&&t.nodeType!==i;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}}])},t.exports=n()}});
1
+ !function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="../",i(i.s=19)}({0:function(e,t){e.exports=jQuery},1:function(e,t,i){"use strict";i.d(t,"a",(function(){return a})),i.d(t,"b",(function(){return s})),i.d(t,"c",(function(){return c})),i.d(t,"d",(function(){return l}));var n=i(0),o=i.n(n);function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",i=o()(document.createElement("div")),n=o()(document.createElement("p")),r=o()(document.createElement("button"));i.addClass("notice notice-"+t+" is-dismissible").hide(),r.addClass("notice-dismiss"),n.html(e),i.append(n).append(r),r.on("click",(function(e){e.preventDefault(),i.fadeOut(200,(function(){i.remove()}))})),o()("hr.wp-header-end").after(i),i.fadeIn(200)}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e.length,o=!0,r=!1,a=void 0;try{for(var s,c=e.clone().models[Symbol.iterator]();!(o=(s=c.next()).done);o=!0){var u=s.value;(!l(u)||u.get("usedAsWatermark")||!0===t&&!u.get("hasBackup"))&&(!0===i&&e.remove(u),n--)}}catch(e){r=!0,a=e}finally{try{o||null==c.return||c.return()}finally{if(r)throw a}}return n}function c(e,t){var i=e.indexOf("?");return-1!==i&&(e=e.substr(0,i)),e+="?v="+t}function l(e){return"object"===r(e)&&e.get&&(e=e.get("mime")),Object.keys(ew.mime).includes(e)}},19:function(e,t,i){"use strict";i.r(t);var n=i(0),o=i.n(n);i(32);function r(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metabox=o()("#watermark-content"),this.form=o()("form#post"),this.imageContent=this.metabox.find(".image-content"),this.textContent=this.metabox.find(".text-content"),this.buttonWrap=this.metabox.find(".select-image-button"),this.button=this.buttonWrap.find("a"),this.imageWrap=this.metabox.find(".watermark-image"),this.image=this.imageWrap.find("img"),this.mimeTypeField=this.metabox.find("input.watermark-mime-type"),this.urlField=this.metabox.find("input.watermark-url"),this.attachmentIdField=this.metabox.find("input.watermark-id"),this.opacityField=this.metabox.find("input#opacity"),this.opacityFieldDesc=this.metabox.find(".opacity-desc"),this.watermarkTextField=this.metabox.find("input.watermark-text"),this.attachmentId=this.attachmentIdField.val(),this.openMediaLibrary=this.openMediaLibrary.bind(this),this.update=this.update.bind(this),this.watermarkTextChange=this.watermarkTextChange.bind(this),this.form.on("ew.update",this.update),this.button.on("click",this.openMediaLibrary),this.image.on("click",this.openMediaLibrary),this.image.attr("src")?(this.imageWrap.show(),this.switchOpacityField(this.mimeTypeField.val())):this.buttonWrap.show(),this.textChangeTimeout=null,this.watermarkTextField.on("input",this.watermarkTextChange)}var t,i,n;return t=e,(i=[{key:"enable",value:function(e){this.metabox.fadeIn(200),"image"===e?(this.imageContent.show(),this.textContent.hide(),this.opacityField.prop("disabled",!1)):(this.textContent.show(),this.imageContent.hide(),this.opacityField.prop("disabled",!0),this.prepareTextPreview())}},{key:"watermarkTextChange",value:function(){var e=this;clearTimeout(this.textChangeTimeout),this.textChangeTimeout=setTimeout((function(){e.form.trigger("ew.save")}),500)}},{key:"prepareTextPreview",value:function(){this.previewWrap||(this.previewWrap=this.metabox.find(".text-preview"),this.preview=o()(document.createElement("img")),this.previewWrap.hide().append(this.preview)),this.refreshPreview()}},{key:"refreshPreview",value:function(){if(this.watermarkTextField.val().length){var e=this.previewWrap.data("src")+"?t="+Date.now();this.preview.attr("src",e),this.previewWrap.show()}else this.previewWrap.hide()}},{key:"openMediaLibrary",value:function(e){e.preventDefault(),this.frame||this.createMediaFrame(),this.frame.open()}},{key:"createMediaFrame",value:function(){this.frame=wp.media.frames.watermarkSelection=wp.media({title:this.button.data("choose"),library:{type:"image"},button:{text:this.button.data("buttonLabel"),close:!0}}),this.frame.on("select",this.selectImage,this).on("open",this.applySelection,this).on("close",this.checkSelectedAttachment,this)}},{key:"selectImage",value:function(){var e=this.frame.state().get("selection").first(),t=e.get("mime"),i=e.get("url");this.attachmentId=e.get("id"),this.mimeTypeField.val(t),this.urlField.val(i),this.attachmentIdField.val(this.attachmentId),this.switchOpacityField(t),this.image.attr("src",i),this.imageWrap.show(),this.buttonWrap.hide(),this.form.trigger("ew.save")}},{key:"applySelection",value:function(){if(this.attachmentId){var e=this.frame.state().get("selection"),t=wp.media.attachment(this.attachmentId);t.fetch(),t&&e.add([t])}}},{key:"checkSelectedAttachment",value:function(){var e=wp.media.attachment(this.attachmentId);e.fetch(),e&&!0!==e.destroyed||(this.mimeTypeField.val(""),this.urlField.val(""),this.attachmentIdField.val(""),this.imageWrap.hide(),this.buttonWrap.show())}},{key:"switchOpacityField",value:function(e){"image/png"===e?(this.opacityField.parent().hide(),this.opacityFieldDesc.show()):(this.opacityField.parent().show(),this.opacityFieldDesc.hide())}},{key:"update",value:function(){"text"===this.form.find("input.watermark-type:checked").val()&&this.refreshPreview()}}])&&r(t.prototype,i),n&&r(t,n),e}();function s(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metabox=o()("#alignment")}var t,i,n;return t=e,(i=[{key:"enable",value:function(){this.metabox.fadeIn(200)}}])&&s(t.prototype,i),n&&s(t,n),e}();function l(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metabox=o()("#applying-rules"),this.autoAddCheckbox=this.metabox.find("#watermark-autoadd"),this.hiddenSections=this.metabox.find(".hidden"),this.toggleOptionsVisibility=this.toggleOptionsVisibility.bind(this),this.autoAddCheckbox.on("change",this.toggleOptionsVisibility),this.toggleOptionsVisibility()}var t,i,n;return t=e,(i=[{key:"enable",value:function(){this.metabox.fadeIn(200)}},{key:"toggleOptionsVisibility",value:function(){this.autoAddCheckbox.prop("checked")?this.hiddenSections.show():this.hiddenSections.hide()}}])&&l(t.prototype,i),n&&l(t,n),e}();function h(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metabox=o()("#scaling"),this.scalingModeSelect=this.metabox.find("#watermark-scaling-mode"),this.hiddenSections=this.metabox.find(".hidden"),this.fields=this.metabox.find("input, select"),this.toggleOptionsVisibility=this.toggleOptionsVisibility.bind(this),this.scalingModeSelect.on("change",this.toggleOptionsVisibility),this.toggleOptionsVisibility()}var t,i,n;return t=e,(i=[{key:"enable",value:function(e){"image"===e?(this.metabox.fadeIn(200),this.fields.prop("disabled",!1)):(this.metabox.hide(),this.fields.prop("disabled",!0))}},{key:"toggleOptionsVisibility",value:function(){switch(this.hiddenSections.hide(),this.scalingModeSelect.val()){case"fit_to_width":case"fit_to_height":this.hiddenSections.show();break;case"cover":case"contain":this.hiddenSections.filter(".show-for-all").show()}}}])&&h(t.prototype,i),n&&h(t,n),e}();function d(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var p=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metabox=o()("#text-options"),this.form=o()("form#post"),this.colorInput=this.metabox.find("#text-color"),this.fields=this.metabox.find("input, select"),this.colorChangeTimeout=null,this.colorChanged=this.colorChanged.bind(this),this.colorInput.wpColorPicker({palettes:!0,change:this.colorChanged})}var t,i,n;return t=e,(i=[{key:"colorChanged",value:function(){var e=this;clearTimeout(this.colorChangeTimeout),this.colorChangeTimeout=setTimeout((function(){e.form.trigger("ew.save")}),500)}},{key:"enable",value:function(e){"text"===e?(this.metabox.fadeIn(200),this.fields.prop("disabled",!1)):(this.metabox.hide(),this.fields.prop("disabled",!0))}}])&&d(t.prototype,i),n&&d(t,n),e}(),m=i(1);function y(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var b=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metabox=o()("#preview"),this.body=o()("body"),this.form=o()("form#post"),this.watermarkTextField=this.form.find("input.watermark-text"),this.attachmentIdField=this.form.find("input.watermark-id"),this.link=this.metabox.find(".select-preview-image"),this.previewWrap=this.metabox.find(".preview-wrap"),this.contentWrap=this.metabox.find(".content-wrap"),this.imageSelector=this.metabox.find(".image-selector"),this.popup=this.metabox.find(".ew-preview-popup"),this.spinner=this.metabox.find("span.spinner"),this.image=o()(document.createElement("img")),this.popup.appendTo(this.body),this.openMediaLibrary=this.openMediaLibrary.bind(this),this.openPopup=this.openPopup.bind(this),this.closePopup=this.closePopup.bind(this),this.selectImage=this.selectImage.bind(this),this.imageSelected=this.imageSelected.bind(this),this.update=this.update.bind(this),this.hasImage=this.previewWrap.data("hasImage"),this.link.on("click",this.openMediaLibrary),this.form.on("ew.update",this.update),this.image.on("click",this.openPopup),this.popup.find(".media-modal-close, .media-modal-backdrop").on("click",this.closePopup),this.imageSelector.hide(),this.contentWrap.hide(),this.previewWrap.prepend(this.image),this.refreshPreview()}var t,i,n;return t=e,(i=[{key:"enable",value:function(){this.metabox.fadeIn(200)}},{key:"openMediaLibrary",value:function(e){e.preventDefault(),this.frame||this.createMediaFrame(),this.frame.open()}},{key:"createMediaFrame",value:function(){this.frame=wp.media.frames.previewImage=wp.media({title:this.link.data("choose"),library:{type:"image"},button:{text:this.link.data("buttonLabel"),close:!0}}),this.frame.on("select",this.selectImage)}},{key:"selectImage",value:function(){var e=this.frame.state().get("selection").first(),t=this.form.find("input[name=post_ID]").val();this.contentWrap.hide(),this.spinner.css("display","block"),o.a.ajax({type:"post",url:ajaxurl,data:{action:"easy-watermark/preview_image",attachment_id:e.id,watermark_id:t,nonce:ew.previewImageNonce}}).done(this.imageSelected).fail((function(){}))}},{key:"imageSelected",value:function(e){if(!0===e.success){if(this.link.html(this.link.data("changeLabel")),this.hasImage=!0,e.data.popup){var t=o()(e.data.popup);this.popup.find(".media-frame-content").replaceWith(t.find(".media-frame-content"))}this.refreshPreview()}}},{key:"refreshPreview",value:function(){var e=this;if(this.contentWrap.hide(),this.hasImage){this.imageSelector.hide(),this.spinner.css("display","block");var t=Date.now(),i=Object(m.c)(this.previewWrap.data("src"),t);this.popup.find("img").each((function(e,i){var n=o()(i),r=Object(m.c)(n.attr("src"),t);n.attr("src",r)})),this.image.one("load",(function(){e.spinner.hide(),e.contentWrap.fadeIn(200),e.imageSelector.fadeIn(200)})).attr("src",i)}else this.imageSelector.show()}},{key:"openPopup",value:function(){this.popup.show(),this.body.addClass("modal-open")}},{key:"closePopup",value:function(){this.popup.hide(),this.body.removeClass("modal-open")}},{key:"hasPreview",value:function(){var e=this.form.find("input.watermark-type:checked").val();return!("text"!==e||!this.watermarkTextField.val().length)||!("image"!==e||!this.attachmentIdField.val().length)}},{key:"update",value:function(){this.refreshPreview()}}])&&y(t.prototype,i),n&&y(t,n),e}(),v=i(4),g=i.n(v);function w(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var k=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metabox=o()("#placeholders"),this.placeholders=this.metabox.find(".placeholders-list li"),this.searchField=this.metabox.find("input.ew-search-placeholders"),this.clipboard=new g.a(".placeholders-list code"),this.clipboardSuccess=this.clipboardSuccess.bind(this),this.filterPlaceholders=this.filterPlaceholders.bind(this),this.clipboard.on("success",this.clipboardSuccess),this.searchField.on("keyup",this.filterPlaceholders)}var t,i,n;return t=e,(i=[{key:"enable",value:function(e){"text"===e?this.metabox.fadeIn(200):this.metabox.hide()}},{key:"clipboardSuccess",value:function(e){var t=o()(e.trigger);t.text("Copied"),setTimeout((function(){t.text(e.text)}),1e3)}},{key:"filterPlaceholders",value:function(e){var t=o()(e.target).val();this.placeholders.hide().each((function(e,i){var n=o()(i);-1!==n.find("code").text().toLowerCase().indexOf(t)&&n.show()}))}}])&&w(t.prototype,i),n&&w(t,n),e}();function x(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var S=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.fields=o()(".form-field"),this.buttons=this.fields.find("button[data-toggle=dropdown]"),this.dropdowns=this.fields.find(".dropdown-menu[data-target]"),this.links=this.dropdowns.find("a"),this.init()}var t,i,n;return t=e,(i=[{key:"init",value:function(){this.toggleDropdown=this.toggleDropdown.bind(this),this.dropdownSelect=this.dropdownSelect.bind(this),this.hideDropdowns=this.hideDropdowns.bind(this),this.buttons.on("click",this.toggleDropdown),this.links.on("click",this.dropdownSelect),o()(document).on("click",this.hideDropdowns)}},{key:"toggleDropdown",value:function(e){e.preventDefault();var t=o()(e.target),i=t.position();t.next(".dropdown-menu").css({left:i.left,top:i.top+t.height()}).toggle()}},{key:"dropdownSelect",value:function(e){e.preventDefault();var t=o()(e.target),i=t.closest(".dropdown-menu"),n=o()(i.data("target"));n.length&&(n.val(t.data("value")),i.prev("button[data-toggle=dropdown]").text(t.text()))}},{key:"hideDropdowns",value:function(e){o()(e.target).is(this.buttons)||this.dropdowns.hide()}}])&&x(t.prototype,i),n&&x(t,n),e}();function T(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var E=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.selectWatermarkType=this.selectWatermarkType.bind(this),this.triggerSave=this.triggerSave.bind(this),this.form=o()("form#post"),this.selector=this.form.find("input.watermark-type"),this.metaboxes=[new a,new c,new u,new f,new p,new b,new k],new S;var i=this.selector.filter("[checked]");i.length&&this.selectWatermarkType(i[0].value),this.selector.on("change",(function(e){t.selectWatermarkType(e.target.value)})),this.form.on("change","input, select",this.triggerSave).on("ew.save",this.triggerSave)}var t,i,n;return t=e,(i=[{key:"selectWatermarkType",value:function(e){var t=!0,i=!1,n=void 0;try{for(var o,r=this.metaboxes[Symbol.iterator]();!(t=(o=r.next()).done);t=!0)o.value.enable(e)}catch(e){i=!0,n=e}finally{try{t||null==r.return||r.return()}finally{if(i)throw n}}}},{key:"triggerSave",value:function(){var e=this,t={action:"easy-watermark/autosave",nonce:ew.autosaveNonce},i=this.form.find("[name^=watermark], [name=post_ID]").serialize();for(var n in t)i+="&"+encodeURIComponent(n)+"="+encodeURIComponent(t[n]);o.a.ajax({type:"post",url:ajaxurl,data:i}).done((function(t){!0===t.success&&e.form.trigger("ew.update")})).fail((function(){}))}}])&&T(t.prototype,i),n&&T(t,n),e}();o()(document).ready((function(){return new E}))},32:function(e,t){},4:function(e,t,i){
2
  /*!
3
  * clipboard.js v2.0.4
4
  * https://zenorocha.github.io/clipboard.js
5
  *
6
  * Licensed MIT © Zeno Rocha
7
  */
8
+ var n;n=function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=c(i(1)),a=c(i(3)),s=c(i(4));function c(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.resolveOptions(i),n.listenClick(e),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"resolveOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===n(e.container)?e.container:document.body}},{key:"listenClick",value:function(e){var t=this;this.listener=(0,s.default)(e,"click",(function(e){return t.onClick(e)}))}},{key:"onClick",value:function(e){var t=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new r.default({action:this.action(t),target:this.target(t),text:this.text(t),container:this.container,trigger:t,emitter:this})}},{key:"defaultAction",value:function(e){return u("action",e)}},{key:"defaultTarget",value:function(e){var t=u("target",e);if(t)return document.querySelector(t)}},{key:"defaultText",value:function(e){return u("text",e)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],t="string"==typeof e?[e]:e,i=!!document.queryCommandSupported;return t.forEach((function(e){i=i&&!!document.queryCommandSupported(e)})),i}}]),t}(a.default);function u(e,t){var i="data-clipboard-"+e;if(t.hasAttribute(i))return t.getAttribute(i)}e.exports=l},function(e,t,i){"use strict";var n,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=i(2),s=(n=a)&&n.__esModule?n:{default:n},c=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.resolveOptions(t),this.initSelection()}return r(e,[{key:"resolveOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var e=this,t="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[t?"right":"left"]="-9999px";var i=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=i+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,s.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,s.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(e){if(void 0!==e){if(!e||"object"!==(void 0===e?"undefined":o(e))||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function(){return this._target}}]),e}();e.exports=c},function(e,t){e.exports=function(e){var t;if("SELECT"===e.nodeName)e.focus(),t=e.value;else if("INPUT"===e.nodeName||"TEXTAREA"===e.nodeName){var i=e.hasAttribute("readonly");i||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),i||e.removeAttribute("readonly"),t=e.value}else{e.hasAttribute("contenteditable")&&e.focus();var n=window.getSelection(),o=document.createRange();o.selectNodeContents(e),n.removeAllRanges(),n.addRange(o),t=n.toString()}return t}},function(e,t){function i(){}i.prototype={on:function(e,t,i){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:i}),this},once:function(e,t,i){var n=this;function o(){n.off(e,o),t.apply(i,arguments)}return o._=t,this.on(e,o,i)},emit:function(e){for(var t=[].slice.call(arguments,1),i=((this.e||(this.e={}))[e]||[]).slice(),n=0,o=i.length;n<o;n++)i[n].fn.apply(i[n].ctx,t);return this},off:function(e,t){var i=this.e||(this.e={}),n=i[e],o=[];if(n&&t)for(var r=0,a=n.length;r<a;r++)n[r].fn!==t&&n[r].fn._!==t&&o.push(n[r]);return o.length?i[e]=o:delete i[e],this}},e.exports=i},function(e,t,i){var n=i(5),o=i(6);e.exports=function(e,t,i){if(!e&&!t&&!i)throw new Error("Missing required arguments");if(!n.string(t))throw new TypeError("Second argument must be a String");if(!n.fn(i))throw new TypeError("Third argument must be a Function");if(n.node(e))return function(e,t,i){return e.addEventListener(t,i),{destroy:function(){e.removeEventListener(t,i)}}}(e,t,i);if(n.nodeList(e))return function(e,t,i){return Array.prototype.forEach.call(e,(function(e){e.addEventListener(t,i)})),{destroy:function(){Array.prototype.forEach.call(e,(function(e){e.removeEventListener(t,i)}))}}}(e,t,i);if(n.string(e))return function(e,t,i){return o(document.body,e,t,i)}(e,t,i);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}},function(e,t){t.node=function(e){return void 0!==e&&e instanceof HTMLElement&&1===e.nodeType},t.nodeList=function(e){var i=Object.prototype.toString.call(e);return void 0!==e&&("[object NodeList]"===i||"[object HTMLCollection]"===i)&&"length"in e&&(0===e.length||t.node(e[0]))},t.string=function(e){return"string"==typeof e||e instanceof String},t.fn=function(e){return"[object Function]"===Object.prototype.toString.call(e)}},function(e,t,i){var n=i(7);function o(e,t,i,n,o){var a=r.apply(this,arguments);return e.addEventListener(i,a,o),{destroy:function(){e.removeEventListener(i,a,o)}}}function r(e,t,i,o){return function(i){i.delegateTarget=n(i.target,t),i.delegateTarget&&o.call(e,i)}}e.exports=function(e,t,i,n,r){return"function"==typeof e.addEventListener?o.apply(null,arguments):"function"==typeof i?o.bind(null,document).apply(null,arguments):("string"==typeof e&&(e=document.querySelectorAll(e)),Array.prototype.map.call(e,(function(e){return o(e,t,i,n,r)})))}},function(e,t){var i=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}e.exports=function(e,t){for(;e&&e.nodeType!==i;){if("function"==typeof e.matches&&e.matches(t))return e;e=e.parentNode}}}])},e.exports=n()}});
easy-watermark.php CHANGED
@@ -6,7 +6,7 @@
6
  * Author URI: https://bracketspace.com/
7
  * Text Domain: easy-watermark
8
  * Domain Path: /languages
9
- * Version: 1.0.5
10
  * License: GPLv3 or later
11
  *
12
  * @package easy-watermark
6
  * Author URI: https://bracketspace.com/
7
  * Text Domain: easy-watermark
8
  * Domain Path: /languages
9
+ * Version: 1.0.6
10
  * License: GPLv3 or later
11
  *
12
  * @package easy-watermark
readme.txt CHANGED
@@ -1,224 +1,229 @@
1
- === Easy Watermark ===
2
- Contributors: szaleq, bracketspace
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=wojtek%40szalkiewicz%2epl&lc=GB&item_name=Easy%20Watermark%20Wordpress%20Plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
4
- Tags: watermark, image, picture, photo, media, gallery, signature, transparent, upload, admin
5
- Requires at least: 3.8
6
- Requires PHP: 5.6
7
- Tested up to: 5.2
8
- Stable tag: 1.0.5
9
- License: GPLv3 or later
10
- License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
- Text Domain: easy-watermark
12
-
13
- Allows to add watermark to images automatically on upload or manually.
14
-
15
- == Description ==
16
-
17
- Easy Watermark can automatically add watermark to images as they are uploaded to wordpress media library. You can also watermark existing images manually (all at once or an every single image). Watermark can be an image, text or both.
18
-
19
- = See the demo =
20
-
21
- [youtube https://www.youtube.com/watch?v=xM_0Y0oX4o0]
22
-
23
- = Plugin features =
24
-
25
- On one image you can have two watermarks! One of them can be text watermark and the other image watermark. You can control their position and size and apply them to your media independently.
26
-
27
- * Image watermark can be a JPG, PNG or GIF
28
- * Full support for transparency and alpha chanel in PNG and GIF files
29
- * JPG and GIF files and text can have opacity set (from 0 to 100%)
30
- * Text watermark is created using ttf fonts
31
- * Text color, size and rotation can be set
32
- * All built-in image sizes can be watermarked (thumbnail, medium, large and fullsize) as well as all additional sizes registered by themes or plugins
33
- * Plugin can create image backups and allows to easily restore images
34
-
35
- = Image watermark =
36
-
37
- Easy Watermark supports three most popular image formats for watermark: JPG, PNG and GIF. For JPG watermarks you can control the opacity as well.
38
-
39
- Watermark can be applied in on of the 9 positions on the image and you can controll the exact sizing of it.
40
-
41
- = Text watermark =
42
-
43
- Text watermark have a powerful feature of placeholders, which can be dynamically applied to the image. Ie. you can put the name of user who uploaded the image as well as the upload date. Watermark text will be automatically generated and applied.
44
-
45
- The plugin supports a few fonts:
46
-
47
- * Arial
48
- * Arial Black
49
- * Comic Sans MS
50
- * Courier New
51
- * Georgia
52
- * Impact
53
- * Tahoma
54
- * Times New Roman
55
- * Trebuchet MS
56
- * Verdana
57
-
58
- You can also place the text watermark in one of the 9 positions on the image, control the angle, color, opacity and size.
59
-
60
- == Installation ==
61
-
62
- Note: Easy Watermark requires GD extension installed and enabled on a server to work.
63
-
64
- 1. Install via Plugin installation screen in WordPress dashboard or download and unpack plugin zip and upload its content to the `/wp-content/plugins/` directory
65
- 1. Activate the plugin through the 'Plugins' menu in WordPress
66
- 1. Plugin is working. Go to "Tools > Easy Watermark" to set up your watermarks.
67
-
68
- == Frequently asked questions ==
69
-
70
- = Can I remove watermark after it was added? =
71
- Yes, since version 0.6.0 there is an option to "remove" watermark by restoring the original image. Backup feature is enabled by default, you can disable it on the "Tools > Easy Watermark" screen. Note: this will use more space on your server due to the fact that the images will be stored twice.
72
- Only the fullsize image is stored in backup, thumbnails are regenerated during the restoring process.
73
- To restore the original image just go to the attachment edit page. In the "Easy Watermark" meta box you can find the "Restore original image" button. You can also do this via Media page and bulk actions.
74
-
75
- = How can I restore original images after the plugin was uninstalled? =
76
- The plugin doesn't restore your images on deactivation/removal. Please consider to install the plugin again and restore your images before uninstalling.
77
- If you don't have a possibility to do this, you can manually restore your images. Just go to wp-content/ew-backup in your wordpress main directory. You will se there are folders in the same order like in uploads, images are stored as /year/month/imagename.jpg|png. What you need is to copy all the files from ew-backup to uploads dir (it will ask you if you want to override the existing files, click YES). As mensioned before, this will restore only the fullsize images so you need to use some other plugin to generate the thumbnails again (see Force Regenerate Thumbnails by Pedro Elsner).
78
-
79
- = How can I add watermark to pictures that were uploaded before the plugin was installed? =
80
- You can go to "Tools > Easy Watermark > Tools" screen and use bulk action options.
81
-
82
- = How can I adjust watermark image position? =
83
- Watermark position can be adjusted vertically and horizontally by selecting alignment (left, center, right, top, middle, bottom). You can also define horizontal and vertical offset.
84
-
85
- = Can I add both, text and image watermark at once? =
86
- Yes, there is a posibility to add only image, only text or both.
87
-
88
- = How Can I adjust text watermark? =
89
- You can choose text font from the list of ten fonts included to this plugin. You can also set font size, color, angle and opacity. Position of text watermark can be adjusted exactly like the image watermark position.
90
-
91
- = Can I use my font for text watermark? =
92
- Unfortunately no. In PRO version you'll be able to use more fonts.
93
-
94
- = How the scaling of the watermark image works? =
95
- On the watermark image settings page you can se 'Scaling Mode' selection which has 5 options:
96
- * 'None' - watermark scaling is off
97
- * 'Fill' - watermark will fill the entire image
98
- * 'Fit' - watermark width or height will be adjusted to image width or height in such a way that it will be all visible
99
- * 'Fit to Width' - watermark width will always be adjusted to image width
100
- * 'Fit to Height' - watermark height will always be adjusted to image height
101
- If 'Scale to Smaller' checkbox is checked, any scaling will be done only for images smaller than watermark image.
102
- Watermark ratio is always preserved, so it can go beyond the image when the 'Scaling Mode' is set to 'Fill'.
103
- With 'Fit to Width' or 'Fit to Height' options watermark dimensions can be set as a percentage in relation to the image dimensions.
104
-
105
- = What placeholders can I use in text watermark? =
106
- All available placeholders are listed in a box titled 'Placeholders' displayed while creating the Text Watermark.
107
-
108
- == Screenshots ==
109
-
110
- 1. Image watermark settings
111
- 2. Text watermark settings
112
- 3. All watermarks
113
- 4. Easy Watermark settings
114
- 5. Easy Watermark permissions
115
- 6. Watermark control while uploading images
116
- 7. Bulk watermark or restore images on Media screen
117
- 8. Bulk watermark and restore all images
118
-
119
- == Changelog ==
120
-
121
- = 1.0.5 =
122
- * Images will now hold information about applied watermarks which has been removed
123
- * [Fixed] Missing FileBird dependency
124
- * [Fixed] Database query error in bulk actions
125
-
126
- = 1.0.4 =
127
- * [Fixed] Improved error handling
128
- * [Fixed] "Enhanced Media Library" plugin compatibility (and possibly some other plugins which replace media library components)
129
- * [Fixed] Watermark delete error fixed
130
- * [Fixed] Source set filtering improved
131
-
132
- = 1.0.3 =
133
- * [Fixed] FileBird compatibility
134
- * [Fixed] Frontend content builders compatibility
135
-
136
- = 1.0.2 =
137
- * [Fixed] Media library not working with ACF plugin enabled
138
-
139
- = 1.0.1 =
140
- * [Fixed] Freemius screen displayed incorrectly after activation
141
- * [Fixed] Permission settings now actualy works
142
- * [Fixed] Config is now saved in unicode so you can use other character sets, like cyrylic
143
- * [Fixed] Incompatibilities with caching plugins
144
- * [Fixed] Srcset fatal error edge case
145
- * [Fixed] Watermark deleting
146
-
147
- = 1.0.0 =
148
- * The plugin has been rewrote from ground up.
149
-
150
- = 0.7.0 =
151
- * Freemius integration
152
-
153
- = 0.6.1 =
154
- * Minor adjustments for newest WordPress version
155
-
156
- = 0.6.0 =
157
- * Added: backup option for watermarked images - allows to restore original image
158
- * Added: button to restore all original images on the plugins page
159
- * Changed method of watermarking all images
160
- * it now uses ajax and watermarks 10 images at once so it needs less time and memory per request
161
-
162
- = 0.5.2 =
163
- * Fix: watermarking class optimised to avoid out-of-memory errors
164
- * Fix: settings are now kept after deactivation
165
- * Fix: many small bugs in a code
166
- * Added: bunch of new text placeholders
167
- * small changes in UI
168
-
169
- = 0.5.1 =
170
- * fixed cooperation with front-end upload plugins (like BuddyPress Media)
171
- * added possibility to define which post type attachments should be watermarked on upload
172
-
173
- = 0.5 =
174
- * fixed issue with watermarking not selected image types on upload
175
- * png transparency in watermarked images is now preserved
176
- * added possibility to disable watermarking feature for particular roles
177
- * user which can only add posts (like 'author') can only add watermark to the images uploaded by him
178
- * introduced placeholders in text watermark
179
- * color picker changed to Iris (integrated with wordpress)
180
- * added information about image status (watermarked or not)
181
- * added 'Easy Watermark' column in media table and metabox on an image editing page
182
- * a lot of 'invisible' changes in the code
183
-
184
- = 0.4.4 =
185
- * repaired issue with auto-watermark option
186
-
187
- = 0.4.3 =
188
- * added support for additional image sizes registered by some templates or plugins (e.g. 'post-thumbnail')
189
-
190
- = 0.4.2 =
191
- * added possibility to define jpeg quality
192
-
193
- = 0.4.1 =
194
- * added an option to scale watermark only for smaller images
195
- * added confirmation button for 'Add watermark to all images' action
196
- * some changes in the code to make the plugin more compatible
197
-
198
- = 0.4 =
199
- * introduced watermark image scaling option
200
-
201
- = 0.3 =
202
- * added support for all image sizes (thumbnail, medium, large), not only the fullsize image
203
- * plugin now checks if the GD library is available, if not, it'll inform you about it instead of throw errors
204
-
205
- = 0.2.3 =
206
- * added bulk action on media library page
207
-
208
- = 0.2.2 =
209
- * added live text preview on the settings page
210
-
211
- = 0.2.1 =
212
- * some changes on settings page
213
-
214
- = 0.2 =
215
- * added text watermark handling
216
- * corrected issue with auto adding watermark on upload
217
-
218
- = 0.1.1 =
219
- * offset can be now also a percentage, not only pixel value
220
- * changed code structure
221
- * separete class responsible only for watermarking (can be used alone)
222
-
223
- = 0.1 =
224
- * Initial release
 
 
 
 
 
1
+ === Easy Watermark ===
2
+ Contributors: szaleq, bracketspace
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=wojtek%40szalkiewicz%2epl&lc=GB&item_name=Easy%20Watermark%20Wordpress%20Plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
4
+ Tags: watermark, image, picture, photo, media, gallery, signature, transparent, upload, admin
5
+ Requires at least: 3.8
6
+ Requires PHP: 5.6
7
+ Tested up to: 5.2
8
+ Stable tag: 1.0.6
9
+ License: GPLv3 or later
10
+ License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
+ Text Domain: easy-watermark
12
+
13
+ Allows to add watermark to images automatically on upload or manually.
14
+
15
+ == Description ==
16
+
17
+ Easy Watermark can automatically add watermark to images as they are uploaded to wordpress media library. You can also watermark existing images manually (all at once or an every single image). Watermark can be an image, text or both.
18
+
19
+ = See the demo =
20
+
21
+ [youtube https://www.youtube.com/watch?v=xM_0Y0oX4o0]
22
+
23
+ = Plugin features =
24
+
25
+ On one image you can have two watermarks! One of them can be text watermark and the other image watermark. You can control their position and size and apply them to your media independently.
26
+
27
+ * Image watermark can be a JPG, PNG or GIF
28
+ * Full support for transparency and alpha chanel in PNG and GIF files
29
+ * JPG and GIF files and text can have opacity set (from 0 to 100%)
30
+ * Text watermark is created using ttf fonts
31
+ * Text color, size and rotation can be set
32
+ * All built-in image sizes can be watermarked (thumbnail, medium, large and fullsize) as well as all additional sizes registered by themes or plugins
33
+ * Plugin can create image backups and allows to easily restore images
34
+
35
+ = Image watermark =
36
+
37
+ Easy Watermark supports three most popular image formats for watermark: JPG, PNG and GIF. For JPG watermarks you can control the opacity as well.
38
+
39
+ Watermark can be applied in on of the 9 positions on the image and you can controll the exact sizing of it.
40
+
41
+ = Text watermark =
42
+
43
+ Text watermark have a powerful feature of placeholders, which can be dynamically applied to the image. Ie. you can put the name of user who uploaded the image as well as the upload date. Watermark text will be automatically generated and applied.
44
+
45
+ The plugin supports a few fonts:
46
+
47
+ * Arial
48
+ * Arial Black
49
+ * Comic Sans MS
50
+ * Courier New
51
+ * Georgia
52
+ * Impact
53
+ * Tahoma
54
+ * Times New Roman
55
+ * Trebuchet MS
56
+ * Verdana
57
+
58
+ You can also place the text watermark in one of the 9 positions on the image, control the angle, color, opacity and size.
59
+
60
+ == Installation ==
61
+
62
+ Note: Easy Watermark requires GD extension installed and enabled on a server to work.
63
+
64
+ 1. Install via Plugin installation screen in WordPress dashboard or download and unpack plugin zip and upload its content to the `/wp-content/plugins/` directory
65
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
66
+ 1. Plugin is working. Go to "Tools > Easy Watermark" to set up your watermarks.
67
+
68
+ == Frequently asked questions ==
69
+
70
+ = Can I remove watermark after it was added? =
71
+ Yes, since version 0.6.0 there is an option to "remove" watermark by restoring the original image. Backup feature is enabled by default, you can disable it on the "Tools > Easy Watermark" screen. Note: this will use more space on your server due to the fact that the images will be stored twice.
72
+ Only the fullsize image is stored in backup, thumbnails are regenerated during the restoring process.
73
+ To restore the original image just go to the attachment edit page. In the "Easy Watermark" meta box you can find the "Restore original image" button. You can also do this via Media page and bulk actions.
74
+
75
+ = How can I restore original images after the plugin was uninstalled? =
76
+ The plugin doesn't restore your images on deactivation/removal. Please consider to install the plugin again and restore your images before uninstalling.
77
+ If you don't have a possibility to do this, you can manually restore your images. Just go to wp-content/ew-backup in your wordpress main directory. You will se there are folders in the same order like in uploads, images are stored as /year/month/imagename.jpg|png. What you need is to copy all the files from ew-backup to uploads dir (it will ask you if you want to override the existing files, click YES). As mensioned before, this will restore only the fullsize images so you need to use some other plugin to generate the thumbnails again (see Force Regenerate Thumbnails by Pedro Elsner).
78
+
79
+ = How can I add watermark to pictures that were uploaded before the plugin was installed? =
80
+ You can go to "Tools > Easy Watermark > Tools" screen and use bulk action options.
81
+
82
+ = How can I adjust watermark image position? =
83
+ Watermark position can be adjusted vertically and horizontally by selecting alignment (left, center, right, top, middle, bottom). You can also define horizontal and vertical offset.
84
+
85
+ = Can I add both, text and image watermark at once? =
86
+ Yes, there is a posibility to add only image, only text or both.
87
+
88
+ = How Can I adjust text watermark? =
89
+ You can choose text font from the list of ten fonts included to this plugin. You can also set font size, color, angle and opacity. Position of text watermark can be adjusted exactly like the image watermark position.
90
+
91
+ = Can I use my font for text watermark? =
92
+ Unfortunately no. In PRO version you'll be able to use more fonts.
93
+
94
+ = How the scaling of the watermark image works? =
95
+ On the watermark image settings page you can se 'Scaling Mode' selection which has 5 options:
96
+ * 'None' - watermark scaling is off
97
+ * 'Fill' - watermark will fill the entire image
98
+ * 'Fit' - watermark width or height will be adjusted to image width or height in such a way that it will be all visible
99
+ * 'Fit to Width' - watermark width will always be adjusted to image width
100
+ * 'Fit to Height' - watermark height will always be adjusted to image height
101
+ If 'Scale to Smaller' checkbox is checked, any scaling will be done only for images smaller than watermark image.
102
+ Watermark ratio is always preserved, so it can go beyond the image when the 'Scaling Mode' is set to 'Fill'.
103
+ With 'Fit to Width' or 'Fit to Height' options watermark dimensions can be set as a percentage in relation to the image dimensions.
104
+
105
+ = What placeholders can I use in text watermark? =
106
+ All available placeholders are listed in a box titled 'Placeholders' displayed while creating the Text Watermark.
107
+
108
+ == Screenshots ==
109
+
110
+ 1. Image watermark settings
111
+ 2. Text watermark settings
112
+ 3. All watermarks
113
+ 4. Easy Watermark settings
114
+ 5. Easy Watermark permissions
115
+ 6. Watermark control while uploading images
116
+ 7. Bulk watermark or restore images on Media screen
117
+ 8. Bulk watermark and restore all images
118
+
119
+ == Changelog ==
120
+
121
+ = 1.0.6 =
122
+ * [Fixed] Compatibility with other media-related plugins
123
+ * [Fixed] Backup file paths on Windows
124
+ * [Fixed] Bulk actions in media library list view
125
+
126
+ = 1.0.5 =
127
+ * Images will now hold information about applied watermarks which has been removed
128
+ * [Fixed] Missing FileBird dependency
129
+ * [Fixed] Database query error in bulk actions
130
+
131
+ = 1.0.4 =
132
+ * [Fixed] Improved error handling
133
+ * [Fixed] "Enhanced Media Library" plugin compatibility (and possibly some other plugins which replace media library components)
134
+ * [Fixed] Watermark delete error fixed
135
+ * [Fixed] Source set filtering improved
136
+
137
+ = 1.0.3 =
138
+ * [Fixed] FileBird compatibility
139
+ * [Fixed] Frontend content builders compatibility
140
+
141
+ = 1.0.2 =
142
+ * [Fixed] Media library not working with ACF plugin enabled
143
+
144
+ = 1.0.1 =
145
+ * [Fixed] Freemius screen displayed incorrectly after activation
146
+ * [Fixed] Permission settings now actualy works
147
+ * [Fixed] Config is now saved in unicode so you can use other character sets, like cyrylic
148
+ * [Fixed] Incompatibilities with caching plugins
149
+ * [Fixed] Srcset fatal error edge case
150
+ * [Fixed] Watermark deleting
151
+
152
+ = 1.0.0 =
153
+ * The plugin has been rewrote from ground up.
154
+
155
+ = 0.7.0 =
156
+ * Freemius integration
157
+
158
+ = 0.6.1 =
159
+ * Minor adjustments for newest WordPress version
160
+
161
+ = 0.6.0 =
162
+ * Added: backup option for watermarked images - allows to restore original image
163
+ * Added: button to restore all original images on the plugins page
164
+ * Changed method of watermarking all images
165
+ * it now uses ajax and watermarks 10 images at once so it needs less time and memory per request
166
+
167
+ = 0.5.2 =
168
+ * Fix: watermarking class optimised to avoid out-of-memory errors
169
+ * Fix: settings are now kept after deactivation
170
+ * Fix: many small bugs in a code
171
+ * Added: bunch of new text placeholders
172
+ * small changes in UI
173
+
174
+ = 0.5.1 =
175
+ * fixed cooperation with front-end upload plugins (like BuddyPress Media)
176
+ * added possibility to define which post type attachments should be watermarked on upload
177
+
178
+ = 0.5 =
179
+ * fixed issue with watermarking not selected image types on upload
180
+ * png transparency in watermarked images is now preserved
181
+ * added possibility to disable watermarking feature for particular roles
182
+ * user which can only add posts (like 'author') can only add watermark to the images uploaded by him
183
+ * introduced placeholders in text watermark
184
+ * color picker changed to Iris (integrated with wordpress)
185
+ * added information about image status (watermarked or not)
186
+ * added 'Easy Watermark' column in media table and metabox on an image editing page
187
+ * a lot of 'invisible' changes in the code
188
+
189
+ = 0.4.4 =
190
+ * repaired issue with auto-watermark option
191
+
192
+ = 0.4.3 =
193
+ * added support for additional image sizes registered by some templates or plugins (e.g. 'post-thumbnail')
194
+
195
+ = 0.4.2 =
196
+ * added possibility to define jpeg quality
197
+
198
+ = 0.4.1 =
199
+ * added an option to scale watermark only for smaller images
200
+ * added confirmation button for 'Add watermark to all images' action
201
+ * some changes in the code to make the plugin more compatible
202
+
203
+ = 0.4 =
204
+ * introduced watermark image scaling option
205
+
206
+ = 0.3 =
207
+ * added support for all image sizes (thumbnail, medium, large), not only the fullsize image
208
+ * plugin now checks if the GD library is available, if not, it'll inform you about it instead of throw errors
209
+
210
+ = 0.2.3 =
211
+ * added bulk action on media library page
212
+
213
+ = 0.2.2 =
214
+ * added live text preview on the settings page
215
+
216
+ = 0.2.1 =
217
+ * some changes on settings page
218
+
219
+ = 0.2 =
220
+ * added text watermark handling
221
+ * corrected issue with auto adding watermark on upload
222
+
223
+ = 0.1.1 =
224
+ * offset can be now also a percentage, not only pixel value
225
+ * changed code structure
226
+ * separete class responsible only for watermarking (can be used alone)
227
+
228
+ = 0.1 =
229
+ * Initial release
src/classes/Backup/LocalBackupper.php CHANGED
@@ -131,7 +131,7 @@ class LocalBackupper implements BackupperInterface {
131
  return $backup_dir;
132
  }
133
 
134
- return $backup_dir . $filename;
135
 
136
  }
137
 
131
  return $backup_dir;
132
  }
133
 
134
+ return wp_normalize_path( $backup_dir . $filename );
135
 
136
  }
137