vendor/assets/javascripts/tinymce/plugins/image/plugin.js in tinymce-rails-5.0.0 vs vendor/assets/javascripts/tinymce/plugins/image/plugin.js in tinymce-rails-5.0.1

- old
+ new

@@ -2,8 +2,8 @@ * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.0-1 (2019-02-04) + * Version: 5.0.1 (2019-02-21) */ -!function(){"use strict";var e,n,t,r,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]},h=function(e){return function(){return e}},a=function(e){return e},u=h(!1),s=h(!0),c=u,l=s,f=function(){return d},d=(r={fold:function(e,n){return e()},is:c,isSome:c,isNone:l,getOr:t=function(e){return e},getOrThunk:n=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:t,orThunk:n,map:f,ap:f,each:function(){},bind:f,flatten:f,exists:c,forall:l,filter:f,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:h("none()")},Object.freeze&&Object.freeze(r),r),m=function(t){var e=function(){return t},n=function(){return i},r=function(e){return e(t)},i={fold:function(e,n){return n(t)},is:function(e){return t===e},isSome:l,isNone:c,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:n,orThunk:n,map:function(e){return m(e(t))},ap:function(e){return e.fold(f,function(e){return m(e(t))})},each:function(e){e(t)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(t)?i:d},equals:function(e){return e.is(t)},equals_:function(e,n){return e.fold(c,function(e){return n(t,e)})},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return i},y={some:m,none:f,from:function(e){return null===e||e===undefined?d:m(e)}},g=function(n){return function(e){return function(e){if(null===e)return"null";var n=typeof e;return"object"===n&&Array.prototype.isPrototypeOf(e)?"array":"object"===n&&String.prototype.isPrototypeOf(e)?"string":n}(e)===n}},w=g("string"),p=g("object"),v=g("function"),b=g("number"),O=function(e,n){for(var t=0,r=e.length;t<r;t++)n(e[t],t,e)},S=Array.prototype.push,N=function(e){for(var n=[],t=0,r=e.length;t<r;++t){if(!Array.prototype.isPrototypeOf(e[t]))throw new Error("Arr.flatten item "+t+" was not an array, input: "+e);S.apply(n,e[t])}return n},x=(Array.prototype.slice,v(Array.from)&&Array.from,function(){return(x=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)}),T=function(e){var t=y.none(),n=[],r=function(e){i()?a(e):n.push(e)},i=function(){return t.isSome()},o=function(e){O(e,a)},a=function(n){t.each(function(e){setTimeout(function(){n(e)},0)})};return e(function(e){t=y.some(e),o(n),n=[]}),{get:r,map:function(t){return T(function(n){r(function(e){n(t(e))})})},isReady:i}},E={nu:T,pure:function(n){return T(function(e){e(n)})}},D=function(n){var e=function(e){var r;n((r=e,function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=this;setTimeout(function(){r.apply(t,e)},0)}))},t=function(){return E.nu(e)};return{map:function(r){return D(function(t){e(function(e){var n=r(e);t(n)})})},bind:function(t){return D(function(n){e(function(e){t(e).get(n)})})},anonBind:function(t){return D(function(n){e(function(e){t.get(n)})})},toLazy:t,toCached:function(){var n=null;return D(function(e){null===n&&(n=t()),n.get(e)})},get:e}},A={nu:D,pure:function(n){return D(function(e){e(n)})}},C=function(t){return{is:function(e){return t===e},isValue:s,isError:u,getOr:h(t),getOrThunk:h(t),getOrDie:h(t),or:function(e){return C(t)},orThunk:function(e){return C(t)},fold:function(e,n){return n(t)},map:function(e){return C(e(t))},mapError:function(e){return C(t)},each:function(e){e(t)},bind:function(e){return e(t)},exists:function(e){return e(t)},forall:function(e){return e(t)},toOption:function(){return y.some(t)}}},_=function(t){return{is:u,isValue:u,isError:s,getOr:a,getOrThunk:function(e){return e()},getOrDie:function(){return e=String(t),function(){throw new Error(e)}();var e},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,n){return e(t)},map:function(e){return _(t)},mapError:function(e){return _(e(t))},each:o,bind:function(e){return _(t)},exists:u,forall:s,toOption:y.none}},I={value:C,error:_},R=function(o){return x({},o,{toCached:function(){return R(o.toCached())},bindFuture:function(n){return R(o.bind(function(e){return e.fold(function(e){return A.pure(I.error(e))},function(e){return n(e)})}))},bindResult:function(n){return R(o.map(function(e){return e.bind(n)}))},mapResult:function(n){return R(o.map(function(e){return e.map(n)}))},mapError:function(n){return R(o.map(function(e){return e.mapError(n)}))},foldResult:function(n,t){return o.map(function(e){return e.fold(n,t)})},withTimeout:function(e,i){return R(A.nu(function(n){var t=!1,r=window.setTimeout(function(){t=!0,n(I.error(i()))},e);o.get(function(e){t||(window.clearTimeout(r),n(e))})}))}})},L=function(e){return R(A.nu(e))},U=L,P=Object.prototype.hasOwnProperty,k=function(a){return function(){for(var e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];if(0===e.length)throw new Error("Can't merge zero objects");for(var t={},r=0;r<e.length;r++){var i=e[r];for(var o in i)P.call(i,o)&&(t[o]=a(t[o],i[o]))}return t}},M=k(function(e,n){return p(e)&&p(n)?M(e,n):n}),j=k(function(e,n){return n}),z="undefined"!=typeof window?window:Function("return this;")(),B=function(e,n){return function(e,n){for(var t=n!==undefined&&null!==n?n:z,r=0;r<e.length&&t!==undefined&&null!==t;++r)t=t[e[r]];return t}(e.split("."),n)},F={getOrDie:function(e,n){var t=B(e,n);if(t===undefined||null===t)throw e+" not available on this browser";return t}},H=function(){return F.getOrDie("URL")},W=function(e){return H().createObjectURL(e)},G=function(e){H().revokeObjectURL(e)},X=function(e){var n=e.imageList.map(function(e){return{name:"images",type:"selectbox",label:"Image list",items:e}}),t=e.classList.map(function(e){return{name:"classes",type:"selectbox",label:"Class",items:e}});return N([[{name:"src",type:"urlinput",filetype:"image",label:"Source"}],n.toArray(),e.hasDescription?[{name:"alt",type:"input",label:"Image description"}]:[],e.hasImageTitle?[{name:"title",type:"input",label:"Image title"}]:[],e.hasDimensions?[{name:"dimensions",type:"sizeinput"}]:[],[{type:"grid",columns:2,items:N([t.toArray(),e.hasImageCaption?[{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[]])}]])},$=function(e){return{title:"General",items:X(e)}},q=X,V=tinymce.util.Tools.resolve("tinymce.util.Promise"),J=tinymce.util.Tools.resolve("tinymce.util.Tools"),Y=tinymce.util.Tools.resolve("tinymce.util.XHR"),Z=function(e){return!1!==e.settings.image_dimensions},K=function(e){return!0===e.settings.image_advtab},Q=function(e){return e.getParam("image_prepend_url","")},ee=function(e){return e.getParam("image_class_list")},ne=function(e){return!1!==e.settings.image_description},te=function(e){return!0===e.settings.image_title},re=function(e){return!0===e.settings.image_caption},ie=function(e){return e.getParam("image_list",!1)},oe=function(e){return!!e.getParam("images_upload_url",!1)},ae=function(e){return!!e.getParam("images_upload_handler",!1)},ue=function(e){return e.getParam("images_upload_url")},se=function(e){return e.getParam("images_upload_handler")},ce=function(e){return e.getParam("images_upload_base_path")},le=function(e){return e.getParam("images_upload_credentials")},fe=function(e,n){return Math.max(parseInt(e,10),parseInt(n,10))},de=function(e,n){var t=document.createElement("img");function r(e){t.parentNode&&t.parentNode.removeChild(t),n(e)}t.onload=function(){var e={width:fe(t.width,t.clientWidth),height:fe(t.height,t.clientHeight)};r(I.value(e))},t.onerror=function(){r(I.error(undefined))};var i=t.style;i.visibility="hidden",i.position="fixed",i.bottom=i.left="0px",i.width=i.height="auto",document.body.appendChild(t),t.src=e},me=function(e){return e&&(e=e.replace(/px$/,"")),e},ge=function(e){return 0<e.length&&/^[0-9]+$/.test(e)&&(e+="px"),e},pe=function(e){if(e.margin){var n=String(e.margin).split(" ");switch(n.length){case 1:e["margin-top"]=e["margin-top"]||n[0],e["margin-right"]=e["margin-right"]||n[0],e["margin-bottom"]=e["margin-bottom"]||n[0],e["margin-left"]=e["margin-left"]||n[0];break;case 2:e["margin-top"]=e["margin-top"]||n[0],e["margin-right"]=e["margin-right"]||n[1],e["margin-bottom"]=e["margin-bottom"]||n[0],e["margin-left"]=e["margin-left"]||n[1];break;case 3:e["margin-top"]=e["margin-top"]||n[0],e["margin-right"]=e["margin-right"]||n[1],e["margin-bottom"]=e["margin-bottom"]||n[2],e["margin-left"]=e["margin-left"]||n[1];break;case 4:e["margin-top"]=e["margin-top"]||n[0],e["margin-right"]=e["margin-right"]||n[1],e["margin-bottom"]=e["margin-bottom"]||n[2],e["margin-left"]=e["margin-left"]||n[3]}delete e.margin}return e},he=function(e,n){var t=ie(e);"string"==typeof t?Y.send({url:t,success:function(e){n(JSON.parse(e))}}):"function"==typeof t?t(n):n(t)},ve=function(e,n,t){function r(){t.onload=t.onerror=null,e.selection&&(e.selection.select(t),e.nodeChanged())}t.onload=function(){n.width||n.height||!Z(e)||e.dom.setAttribs(t,{width:t.clientWidth,height:t.clientHeight}),r()},t.onerror=r},be=function(i){return new V(function(e,n){var t=function r(){return new(F.getOrDie("FileReader"))}();t.onload=function(){e(t.result)},t.onerror=function(){n(t.error.message)},t.readAsDataURL(i)})},ye=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils").DOM,we=function(e){return e.style.marginLeft&&e.style.marginRight&&e.style.marginLeft===e.style.marginRight?me(e.style.marginLeft):""},Oe=function(e){return e.style.marginTop&&e.style.marginBottom&&e.style.marginTop===e.style.marginBottom?me(e.style.marginTop):""},Se=function(e){return e.style.borderWidth?me(e.style.borderWidth):""},Ne=function(e,n){return e.hasAttribute(n)?e.getAttribute(n):""},xe=function(e,n){return e.style[n]?e.style[n]:""},Te=function(e){return null!==e.parentNode&&"FIGURE"===e.parentNode.nodeName},Ee=function(e,n,t){e.setAttribute(n,t)},De=function(e){var n,t,r,i;Te(e)?(i=(r=e).parentNode,ye.insertAfter(r,i),ye.remove(i)):(n=e,t=ye.create("figure",{"class":"image"}),ye.insertAfter(t,n),t.appendChild(n),t.appendChild(ye.create("figcaption",{contentEditable:!0},"Caption")),t.contentEditable="false")},Ae=function(e,n){var t=e.getAttribute("style"),r=n(null!==t?t:"");0<r.length?(e.setAttribute("style",r),e.setAttribute("data-mce-style",r)):e.removeAttribute("style")},Ce=function(e,r){return function(e,n,t){e.style[n]?(e.style[n]=ge(t),Ae(e,r)):Ee(e,n,t)}},_e=function(e,n){return e.style[n]?me(e.style[n]):Ne(e,n)},Ie=function(e,n){var t=ge(n);e.style.marginLeft=t,e.style.marginRight=t},Re=function(e,n){var t=ge(n);e.style.marginTop=t,e.style.marginBottom=t},Le=function(e,n){var t=ge(n);e.style.borderWidth=t},Ue=function(e,n){e.style.borderStyle=n},Pe=function(e){return"FIGURE"===e.nodeName},ke=function(e,n){var t=document.createElement("img");return Ee(t,"style",n.style),(we(t)||""!==n.hspace)&&Ie(t,n.hspace),(Oe(t)||""!==n.vspace)&&Re(t,n.vspace),(Se(t)||""!==n.border)&&Le(t,n.border),(xe(t,"borderStyle")||""!==n.borderStyle)&&Ue(t,n.borderStyle),e(t.getAttribute("style"))},Me=function(e,n){return{src:Ne(n,"src"),alt:Ne(n,"alt"),title:Ne(n,"title"),width:_e(n,"width"),height:_e(n,"height"),"class":Ne(n,"class"),style:e(Ne(n,"style")),caption:Te(n),hspace:we(n),vspace:Oe(n),border:Se(n),borderStyle:xe(n,"borderStyle")}},je=function(e,n,t,r,i){t[r]!==n[r]&&i(e,r,t[r])},ze=function(r,i){return function(e,n,t){r(e,t),Ae(e,i)}},Be=function(e,n,t){var r=Me(e,t);je(t,r,n,"caption",function(e,n,t){return De(e)}),je(t,r,n,"src",Ee),je(t,r,n,"alt",Ee),je(t,r,n,"title",Ee),je(t,r,n,"width",Ce(0,e)),je(t,r,n,"height",Ce(0,e)),je(t,r,n,"class",Ee),je(t,r,n,"style",ze(function(e,n){return Ee(e,"style",n)},e)),je(t,r,n,"hspace",ze(Ie,e)),je(t,r,n,"vspace",ze(Re,e)),je(t,r,n,"border",ze(Le,e)),je(t,r,n,"borderStyle",ze(Ue,e))},Fe=function(e,n){var t=e.dom.styles.parse(n),r=pe(t),i=e.dom.styles.parse(e.dom.styles.serialize(r));return e.dom.styles.serialize(i)},He=function(e){var n=e.selection.getNode(),t=e.dom.getParent(n,"figure.image");return t?e.dom.select("img",t)[0]:n&&("IMG"!==n.nodeName||n.getAttribute("data-mce-object")||n.getAttribute("data-mce-placeholder"))?null:n},We=function(n,e){var t=n.dom,r=t.getParent(e.parentNode,function(e){return n.schema.getTextBlockElements()[e.nodeName]},n.getBody());return r?t.split(r,e):e},Ge=function(n,e){var t=function(e,n){var t=document.createElement("img");if(Be(e,j(n,{caption:!1}),t),Ee(t,"alt",n.alt),n.caption){var r=ye.create("figure",{"class":"image"});return r.appendChild(t),r.appendChild(ye.create("figcaption",{contentEditable:!0},"Caption")),r.contentEditable="false",r}return t}(function(e){return Fe(n,e)},e);n.dom.setAttrib(t,"data-mce-id","__mcenew"),n.focus(),n.selection.setContent(t.outerHTML);var r=n.dom.select('*[data-mce-id="__mcenew"]')[0];if(n.dom.setAttrib(r,"data-mce-id",null),Pe(r)){var i=We(n,r);n.selection.select(i)}else n.selection.select(r)},Xe=function(e,n){var t=He(e);t?n.src?function(n,e){var t,r=He(n);if(Be(function(e){return Fe(n,e)},e,r),t=r,n.dom.setAttrib(t,"src",t.getAttribute("src")),Pe(r.parentNode)){var i=r.parentNode;We(n,i),n.selection.select(r.parentNode)}else n.selection.select(r),ve(n,e,r)}(e,n):function(e,n){if(n){var t=e.dom.is(n.parentNode,"figure.image")?n.parentNode:n;e.dom.remove(t),e.focus(),e.nodeChanged(),e.dom.isEmpty(e.getBody())&&(e.setContent(""),e.selection.setCursorLocation())}}(e,t):n.src&&Ge(e,n)},$e=function(e){return w(e.value)?e.value:""},qe=function(e,i){var o=[];return J.each(e,function(e){var n=w(e.text)?e.text:w(e.title)?e.title:"";if(e.menu!==undefined){var t=qe(e.menu,i);o.push({text:n,items:t})}else{var r=i(e);o.push({text:n,value:r})}}),o},Ve=function(n){return void 0===n&&(n=$e),function(e){return e?y.from(e).map(function(e){return qe(e,n)}):y.none()}},Je=function(e,t){return function(e,n){for(var t=0;t<e.length;t++){var r=n(e[t],t);if(r.isSome())return r}return y.none()}(e,function(e){return n=e,Object.prototype.hasOwnProperty.call(n,"items")?Je(e.items,t):e.value===t?y.some(e):y.none();var n})},Ye=Ve,Ze=function(e){return Ve($e)(e)},Ke=function(e,n){return e.bind(function(e){return Je(e,n)})},Qe=function(){};function en(u){var n=function(e,r,i,n){var o,t;(o=function a(){return new(F.getOrDie("XMLHttpRequest"))}()).open("POST",u.url),o.withCredentials=u.credentials,o.upload.onprogress=function(e){n(e.loaded/e.total*100)},o.onerror=function(){i("Image upload failed due to a XHR Transport error. Code: "+o.status)},o.onload=function(){var e,n,t;o.status<200||300<=o.status?i("HTTP Error: "+o.status):(e=JSON.parse(o.responseText))&&"string"==typeof e.location?r((n=u.basePath,t=e.location,n?n.replace(/\/$/,"")+"/"+t.replace(/^\//,""):t)):i("Invalid JSON: "+o.responseText)},(t=new FormData).append("file",e.blob(),e.filename()),o.send(t)};return u=J.extend({credentials:!1,handler:n},u),{upload:function(e){return u.url||u.handler!==n?(r=e,i=u.handler,new V(function(e,n){try{i(r,e,n,Qe)}catch(t){n(t.message)}})):V.reject("Upload url missing from the settings.");var r,i}}}var nn,tn,rn,on=function(e){return{title:"Advanced",items:[{type:"input",label:"Style",name:"style"},{type:"grid",columns:2,items:[{type:"input",label:"Vertical space",name:"vspace"},{type:"input",label:"Horizontal space",name:"hspace"},{type:"input",label:"Border width",name:"border"},{type:"selectbox",name:"borderstyle",label:"Border style",items:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]}]}]}},an=function(t){var n,e,r=Ye(function(e){return t.convertURL(e.value||e.url,"src")}),i=A.nu(function(n){he(t,function(e){n(r(e).map(function(e){return N([[{text:"None",value:""}],e])}))})}),o=Ze(ee(t)),a=K(t),u=oe(t),s=ae(t),c=(e=He(n=t))?Me(function(e){return Fe(n,e)},e):{src:"",alt:"",title:"",width:"",height:"","class":"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:""},l=ne(t),f=te(t),d=Z(t),m=re(t),g=ue(t),p=ce(t),h=le(t),v=se(t),b=y.some(Q(t)).filter(function(e){return w(e)&&0<e.length});return i.map(function(e){return{image:c,imageList:e,classList:o,hasAdvTab:a,hasUploadUrl:u,hasUploadHandler:s,hasDescription:l,hasImageTitle:f,hasDimensions:d,hasImageCaption:m,url:g,basePath:p,credentials:h,handler:v,prependURL:b}})},un=function(e){return{title:"Upload",items:[{type:"dropzone",name:"fileinput"}]}},sn=function(e){return{src:{value:e.src,meta:{}},images:e.src,alt:e.alt,title:e.title,dimensions:{width:e.width,height:e.height},classes:e["class"],caption:e.caption,style:e.style,vspace:e.vspace,border:e.border,hspace:e.hspace,borderstyle:e.borderStyle,fileinput:[]}},cn=function(e){return{src:e.src.value,alt:e.alt,title:e.title,width:e.dimensions.width,height:e.dimensions.height,"class":e.classes,style:e.style,caption:e.caption,hspace:e.hspace,vspace:e.vspace,border:e.border,borderStyle:e.borderstyle}},ln=function(e,n){var t,r,i=n.getData();(t=e,r=i.src.value,/^(?:[a-zA-Z]+:)?\/\//.test(r)?y.none():t.prependURL.bind(function(e){return r.substring(0,e.length)!==e?y.some(e+r):y.none()})).each(function(e){n.setData({src:{value:e,meta:i.src.meta}})})},fn=function(e,n){(function(e,n){var t=n.src.meta;if(t===undefined)return y.none();var r=M({},n);return e.hasDescription&&w(t.alt)&&(r.alt=t.alt),e.hasImageTitle&&w(t.title)&&(r.title=t.title),e.hasDimensions&&(w(t.width)&&(r.dimensions.width=t.width),w(t.height)&&(r.dimensions.height=t.height)),w(t["class"])&&Ke(e.classList,t["class"]).each(function(e){r.classes=e.value}),e.hasAdvTab&&(w(t.vspace)&&(r.vspace=t.vspace),w(t.border)&&(r.border=t.border),w(t.hspace)&&(r.hspace=t.hspace),w(t.borderstyle)&&(r.borderstyle=t.borderstyle)),y.some(r)})(e,n.getData()).each(function(e){return n.setData(e)})},dn=function(e,n,t,r){var i,o,a,u,s,c,l,f,d,m,g,p;ln(n,r),fn(n,r),i=e,o=n,a=t,s=(u=r).getData(),c=s.src.value,(l=s.src.meta||{}).width||l.height||!o.hasDimensions||i.imageSize(c).get(function(e){e.each(function(e){a.open&&u.setData({dimensions:e})})}),f=n,d=t,g=(m=r).getData(),p=Ke(f.imageList,g.src.value),d.prevImage=p,m.setData({images:p.map(function(e){return e.value}).getOr("")})},mn=function(e,n,t){var r,i,o,a,u,s=pe(e(t.style)),c=M({},t);return c.vspace=(r=s)["margin-top"]&&r["margin-bottom"]&&r["margin-top"]===r["margin-bottom"]?me(String(r["margin-top"])):"",c.hspace=(i=s)["margin-right"]&&i["margin-left"]&&i["margin-right"]===i["margin-left"]?me(String(i["margin-right"])):"",c.border=(o=s)["border-width"]?me(String(o["border-width"])):"",c.borderstyle=(a=s)["border-style"]?String(a["border-style"]):"",c.style=(u=n)(e(u(s))),c},gn=function(h,v,b){return function(e,n){var t,r,i,o,a,u,s,c,l,f,d,m,g,p;"src"===n.name?dn(h,v,b,e):"images"===n.name?(l=h,f=v,d=b,g=(m=e).getData(),(p=Ke(f.imageList,g.images)).each(function(e){""===g.alt||d.prevImage.map(function(e){return e.text===g.alt}).getOr(!1)?""===e.value?m.setData({src:e,alt:d.prevAlt}):m.setData({src:e,alt:e.text}):m.setData({src:e})}),d.prevImage=p,dn(l,f,d,m)):"alt"===n.name?b.prevAlt=e.getData().alt:"style"===n.name?(a=h,s=(u=e).getData(),c=mn(a.parseStyle,a.serializeStyle,s),u.setData(c)):"vspace"===n.name||"hspace"===n.name||"border"===n.name||"borderstyle"===n.name?(t=h,r=e,i=M(sn(v.image),r.getData()),o=ke(t.normalizeCss,cn(i)),r.setData({style:o})):"fileinput"===n.name&&function(t,r,i,o){var e=o.getData();o.block("Uploading image");var a=e.fileinput[0],u=W(a),s=en({url:r.url,basePath:r.basePath,credentials:r.credentials,handler:r.handler}),c=function(){o.unblock(),G(u)};be(a).then(function(e){var n=t.createBlobCache(a,u,e);s.upload(n).then(function(e){o.setData({src:{value:e,meta:{}}}),o.showTab("General"),dn(t,r,i,o),c()})["catch"](function(e){c(),t.alertErr(o,e)})})}(h,v,b,e)}},pn=function(o){return function(e){var n,t,r,i={prevImage:Ke((n=e).imageList,n.image.src),prevAlt:n.image.alt,open:!0};return{title:"Insert/Edit Image",size:"normal",body:(r=e,r.hasAdvTab||r.hasUploadUrl||r.hasUploadHandler?{type:"tabpanel",tabs:N([[$(r)],r.hasAdvTab?[on(r)]:[],r.hasUploadUrl||r.hasUploadHandler?[un(r)]:[]])}:{type:"panel",items:q(r)}),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:sn(e.image),onSubmit:o.onSubmit(e),onChange:gn(o,e,i),onClose:(t=i,function(){t.open=!1})}}},hn=function(n){var t,r,i,o,a,u,s,e={onSubmit:(s=n,function(t){return function(e){var n=M(sn(t.image),e.getData());s.undoManager.transact(function(){Xe(s,cn(n))}),s.editorUpload.uploadImagesAuto(),e.close()}}),imageSize:(u=n,function(e){return U(function(t){de(u.documentBaseURI.toAbsolute(e),function(e){var n=e.bind(function(e){return(w(e.width)||b(e.width))&&(w(e.height)||b(e.height))?I.value({width:String(e.width),height:String(e.height)}):I.error(undefined)});t(n)})})}),createBlobCache:(a=n,function(e,n,t){return a.editorUpload.blobCache.create({blob:e,blobUri:n,name:e.name?e.name.replace(/\.[^\.]+$/,""):null,base64:t.split(",")[1]})}),alertErr:(o=n,function(e,n){o.windowManager.alert(n,e.close)}),normalizeCss:(i=n,function(e){return Fe(i,e)}),parseStyle:(r=n,function(e){return r.dom.parseStyle(e)}),serializeStyle:(t=n,function(e,n){return t.dom.serializeStyle(e,n)})};return{open:function(){return an(n).map(pn(e)).get(function(e){n.windowManager.open(e)})}}},vn=function(e){e.addCommand("mceImage",hn(e).open)},bn=function(o){return function(e){for(var n,t,r=e.length,i=function(e){e.attr("contenteditable",o?"true":null)};r--;)n=e[r],(t=n.attr("class"))&&/\bimage\b/.test(t)&&(n.attr("contenteditable",o?"false":null),J.each(n.getAll("figcaption"),i))}},yn=function(e){e.on("preInit",function(){e.parser.addNodeFilter("figure",bn(!0)),e.serializer.addNodeFilter("figure",bn(!1))})},wn=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:h(e)}},On={fromHtml:function(e,n){var t=(n||document).createElement("div");if(t.innerHTML=e,!t.hasChildNodes()||1<t.childNodes.length)throw console.error("HTML does not have a single root node",e),new Error("HTML must have a single root node");return wn(t.childNodes[0])},fromTag:function(e,n){var t=(n||document).createElement(e);return wn(t)},fromText:function(e,n){var t=(n||document).createTextNode(e);return wn(t)},fromDom:wn,fromPoint:function(e,n,t){var r=e.dom();return y.from(r.elementFromPoint(n,t)).map(wn)}},Sn=(Node.ATTRIBUTE_NODE,Node.CDATA_SECTION_NODE,Node.COMMENT_NODE,Node.DOCUMENT_NODE,Node.DOCUMENT_TYPE_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE,Node.TEXT_NODE,Node.PROCESSING_INSTRUCTION_NODE,Node.ENTITY_REFERENCE_NODE,Node.ENTITY_NODE,Node.NOTATION_NODE,function(e,n){var t=function(e,n){for(var t=0;t<e.length;t++){var r=e[t];if(r.test(n))return r}return undefined}(e,n);if(!t)return{major:0,minor:0};var r=function(e){return Number(n.replace(t,"$"+e))};return xn(r(1),r(2))}),Nn=function(){return xn(0,0)},xn=function(e,n){return{major:e,minor:n}},Tn={nu:xn,detect:function(e,n){var t=String(n).toLowerCase();return 0===e.length?Nn():Sn(e,t)},unknown:Nn},En="Firefox",Dn=function(e,n){return function(){return n===e}},An=function(e){var n=e.current;return{current:n,version:e.version,isEdge:Dn("Edge",n),isChrome:Dn("Chrome",n),isIE:Dn("IE",n),isOpera:Dn("Opera",n),isFirefox:Dn(En,n),isSafari:Dn("Safari",n)}},Cn={unknown:function(){return An({current:undefined,version:Tn.unknown()})},nu:An,edge:h("Edge"),chrome:h("Chrome"),ie:h("IE"),opera:h("Opera"),firefox:h(En),safari:h("Safari")},_n="Windows",In="Android",Rn="Solaris",Ln="FreeBSD",Un=function(e,n){return function(){return n===e}},Pn=function(e){var n=e.current;return{current:n,version:e.version,isWindows:Un(_n,n),isiOS:Un("iOS",n),isAndroid:Un(In,n),isOSX:Un("OSX",n),isLinux:Un("Linux",n),isSolaris:Un(Rn,n),isFreeBSD:Un(Ln,n)}},kn={unknown:function(){return Pn({current:undefined,version:Tn.unknown()})},nu:Pn,windows:h(_n),ios:h("iOS"),android:h(In),linux:h("Linux"),osx:h("OSX"),solaris:h(Rn),freebsd:h(Ln)},Mn=function(e,n){var t=String(n).toLowerCase();return function(e,n){for(var t=0,r=e.length;t<r;t++){var i=e[t];if(n(i,t,e))return y.some(i)}return y.none()}(e,function(e){return e.search(t)})},jn=function(e,t){return Mn(e,t).map(function(e){var n=Tn.detect(e.versionRegexes,t);return{current:e.name,version:n}})},zn=function(e,t){return Mn(e,t).map(function(e){var n=Tn.detect(e.versionRegexes,t);return{current:e.name,version:n}})},Bn=function(e,n){return-1!==e.indexOf(n)},Fn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Hn=function(n){return function(e){return Bn(e,n)}},Wn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return Bn(e,"edge/")&&Bn(e,"chrome")&&Bn(e,"safari")&&Bn(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Fn],search:function(e){return Bn(e,"chrome")&&!Bn(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return Bn(e,"msie")||Bn(e,"trident")}},{name:"Opera",versionRegexes:[Fn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Hn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Hn("firefox")},{name:"Safari",versionRegexes:[Fn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(Bn(e,"safari")||Bn(e,"mobile/"))&&Bn(e,"applewebkit")}}],Gn=[{name:"Windows",search:Hn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return Bn(e,"iphone")||Bn(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Hn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Hn("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Hn("linux"),versionRegexes:[]},{name:"Solaris",search:Hn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Hn("freebsd"),versionRegexes:[]}],Xn={browsers:h(Wn),oses:h(Gn)},$n=function(e){var n,t,r,i,o,a,u,s,c,l,f,d=Xn.browsers(),m=Xn.oses(),g=jn(d,e).fold(Cn.unknown,Cn.nu),p=zn(m,e).fold(kn.unknown,kn.nu);return{browser:g,os:p,deviceType:(t=g,r=e,i=(n=p).isiOS()&&!0===/ipad/i.test(r),o=n.isiOS()&&!i,a=n.isAndroid()&&3===n.version.major,u=n.isAndroid()&&4===n.version.major,s=i||a||u&&!0===/mobile/i.test(r),c=n.isiOS()||n.isAndroid(),l=c&&!s,f=t.isSafari()&&n.isiOS()&&!1===/safari/i.test(r),{isiPad:h(i),isiPhone:h(o),isTablet:h(s),isPhone:h(l),isTouch:h(c),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:h(f)})}},qn=((nn=function(){var e=navigator.userAgent;return $n(e)},rn=!1,function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return rn||(rn=!0,tn=nn.apply(null,e)),tn}()).browser.isIE(),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]}("element","offset"),function(o){o.ui.registry.addToggleButton("image",{icon:"image",tooltip:"Insert/edit image",onAction:hn(o).open,onSetup:function(e){return o.selection.selectorChangedWithUnbind("img:not([data-mce-object],[data-mce-placeholder]),figure.image",e.setActive).unbind}}),o.ui.registry.addMenuItem("image",{icon:"image",text:"Image...",onAction:hn(o).open}),o.ui.registry.addContextMenu("image",{update:function(e){return Pe(e)||"IMG"===e.nodeName?[(i=e,{text:"Image",icon:"image",onAction:function(){var e,n,t,r=((nn=function(){var e=navigator.userAgent;return $n(e)},rn=!1,function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return rn||(rn=!0,tn=nn.apply(null,e)),tn}()).browser.isIE(),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]}("element","offset"),e=On.fromDom(i),(n=e,t=n.dom(),y.from(t.parentNode).map(On.fromDom)).filter(function(e){return"figure"===e.dom().nodeName.toLowerCase()}).getOr(e));o.selection.select(r.dom()),hn(o).open()}})]:[];var i}})});i.add("image",function(e){yn(e),qn(e),vn(e)}),function Vn(){}}(); +!function(s){"use strict";var e,n,t,r,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]},h=function(e){return function(){return e}},a=function(e){return e},u=h(!1),c=h(!0),l=u,f=c,d=function(){return m},m=(r={fold:function(e,n){return e()},is:l,isSome:l,isNone:f,getOr:t=function(e){return e},getOrThunk:n=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:t,orThunk:n,map:d,ap:d,each:function(){},bind:d,flatten:d,exists:l,forall:f,filter:d,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:h("none()")},Object.freeze&&Object.freeze(r),r),g=function(t){var e=function(){return t},n=function(){return i},r=function(e){return e(t)},i={fold:function(e,n){return n(t)},is:function(e){return t===e},isSome:f,isNone:l,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:n,orThunk:n,map:function(e){return g(e(t))},ap:function(e){return e.fold(d,function(e){return g(e(t))})},each:function(e){e(t)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(t)?i:m},equals:function(e){return e.is(t)},equals_:function(e,n){return e.fold(l,function(e){return n(t,e)})},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return i},y={some:g,none:d,from:function(e){return null===e||e===undefined?m:g(e)}},p=function(n){return function(e){return function(e){if(null===e)return"null";var n=typeof e;return"object"===n&&Array.prototype.isPrototypeOf(e)?"array":"object"===n&&String.prototype.isPrototypeOf(e)?"string":n}(e)===n}},w=p("string"),v=p("object"),b=p("function"),O=p("number"),S=function(e,n){for(var t=0,r=e.length;t<r;t++)n(e[t],t,e)},N=Array.prototype.push,x=function(e){for(var n=[],t=0,r=e.length;t<r;++t){if(!Array.prototype.isPrototypeOf(e[t]))throw new Error("Arr.flatten item "+t+" was not an array, input: "+e);N.apply(n,e[t])}return n},T=(Array.prototype.slice,b(Array.from)&&Array.from,function(){return(T=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)}),E=function(e){var t=y.none(),n=[],r=function(e){i()?a(e):n.push(e)},i=function(){return t.isSome()},o=function(e){S(e,a)},a=function(n){t.each(function(e){setTimeout(function(){n(e)},0)})};return e(function(e){t=y.some(e),o(n),n=[]}),{get:r,map:function(t){return E(function(n){r(function(e){n(t(e))})})},isReady:i}},D={nu:E,pure:function(n){return E(function(e){e(n)})}},A=function(n){var e=function(e){var r;n((r=e,function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=this;setTimeout(function(){r.apply(t,e)},0)}))},t=function(){return D.nu(e)};return{map:function(r){return A(function(t){e(function(e){var n=r(e);t(n)})})},bind:function(t){return A(function(n){e(function(e){t(e).get(n)})})},anonBind:function(t){return A(function(n){e(function(e){t.get(n)})})},toLazy:t,toCached:function(){var n=null;return A(function(e){null===n&&(n=t()),n.get(e)})},get:e}},C={nu:A,pure:function(n){return A(function(e){e(n)})}},_=function(t){return{is:function(e){return t===e},isValue:c,isError:u,getOr:h(t),getOrThunk:h(t),getOrDie:h(t),or:function(e){return _(t)},orThunk:function(e){return _(t)},fold:function(e,n){return n(t)},map:function(e){return _(e(t))},mapError:function(e){return _(t)},each:function(e){e(t)},bind:function(e){return e(t)},exists:function(e){return e(t)},forall:function(e){return e(t)},toOption:function(){return y.some(t)}}},I=function(t){return{is:u,isValue:u,isError:c,getOr:a,getOrThunk:function(e){return e()},getOrDie:function(){return e=String(t),function(){throw new Error(e)}();var e},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,n){return e(t)},map:function(e){return I(t)},mapError:function(e){return I(e(t))},each:o,bind:function(e){return I(t)},exists:u,forall:c,toOption:y.none}},R={value:_,error:I},L=function(o){return T({},o,{toCached:function(){return L(o.toCached())},bindFuture:function(n){return L(o.bind(function(e){return e.fold(function(e){return C.pure(R.error(e))},function(e){return n(e)})}))},bindResult:function(n){return L(o.map(function(e){return e.bind(n)}))},mapResult:function(n){return L(o.map(function(e){return e.map(n)}))},mapError:function(n){return L(o.map(function(e){return e.mapError(n)}))},foldResult:function(n,t){return o.map(function(e){return e.fold(n,t)})},withTimeout:function(e,i){return L(C.nu(function(n){var t=!1,r=window.setTimeout(function(){t=!0,n(R.error(i()))},e);o.get(function(e){t||(window.clearTimeout(r),n(e))})}))}})},U=function(e){return L(C.nu(e))},P=U,k=Object.prototype.hasOwnProperty,M=function(a){return function(){for(var e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];if(0===e.length)throw new Error("Can't merge zero objects");for(var t={},r=0;r<e.length;r++){var i=e[r];for(var o in i)k.call(i,o)&&(t[o]=a(t[o],i[o]))}return t}},j=M(function(e,n){return v(e)&&v(n)?j(e,n):n}),z=M(function(e,n){return n}),B="undefined"!=typeof window?window:Function("return this;")(),F=function(e,n){return function(e,n){for(var t=n!==undefined&&null!==n?n:B,r=0;r<e.length&&t!==undefined&&null!==t;++r)t=t[e[r]];return t}(e.split("."),n)},H={getOrDie:function(e,n){var t=F(e,n);if(t===undefined||null===t)throw e+" not available on this browser";return t}},W=function(){return H.getOrDie("URL")},G=function(e){return W().createObjectURL(e)},X=function(e){W().revokeObjectURL(e)},$=function(e){var n=e.imageList.map(function(e){return{name:"images",type:"selectbox",label:"Image list",items:e}}),t=e.classList.map(function(e){return{name:"classes",type:"selectbox",label:"Class",items:e}});return x([[{name:"src",type:"urlinput",filetype:"image",label:"Source"}],n.toArray(),e.hasDescription?[{name:"alt",type:"input",label:"Image description"}]:[],e.hasImageTitle?[{name:"title",type:"input",label:"Image title"}]:[],e.hasDimensions?[{name:"dimensions",type:"sizeinput"}]:[],[{type:"grid",columns:2,items:x([t.toArray(),e.hasImageCaption?[{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[]])}]])},q=function(e){return{title:"General",items:$(e)}},V=$,J=tinymce.util.Tools.resolve("tinymce.util.Promise"),Y=tinymce.util.Tools.resolve("tinymce.util.Tools"),Z=tinymce.util.Tools.resolve("tinymce.util.XHR"),K=function(e){return!1!==e.settings.image_dimensions},Q=function(e){return!0===e.settings.image_advtab},ee=function(e){return e.getParam("image_prepend_url","")},ne=function(e){return e.getParam("image_class_list")},te=function(e){return!1!==e.settings.image_description},re=function(e){return!0===e.settings.image_title},ie=function(e){return!0===e.settings.image_caption},oe=function(e){return e.getParam("image_list",!1)},ae=function(e){return!!e.getParam("images_upload_url",!1)},ue=function(e){return!!e.getParam("images_upload_handler",!1)},se=function(e){return e.getParam("images_upload_url")},ce=function(e){return e.getParam("images_upload_handler")},le=function(e){return e.getParam("images_upload_base_path")},fe=function(e){return e.getParam("images_upload_credentials")},de=function(e,n){return Math.max(parseInt(e,10),parseInt(n,10))},me=function(e,n){var t=s.document.createElement("img");function r(e){t.parentNode&&t.parentNode.removeChild(t),n(e)}t.onload=function(){var e={width:de(t.width,t.clientWidth),height:de(t.height,t.clientHeight)};r(R.value(e))},t.onerror=function(){r(R.error(undefined))};var i=t.style;i.visibility="hidden",i.position="fixed",i.bottom=i.left="0px",i.width=i.height="auto",s.document.body.appendChild(t),t.src=e},ge=function(e){return e&&(e=e.replace(/px$/,"")),e},pe=function(e){return 0<e.length&&/^[0-9]+$/.test(e)&&(e+="px"),e},he=function(e){if(e.margin){var n=String(e.margin).split(" ");switch(n.length){case 1:e["margin-top"]=e["margin-top"]||n[0],e["margin-right"]=e["margin-right"]||n[0],e["margin-bottom"]=e["margin-bottom"]||n[0],e["margin-left"]=e["margin-left"]||n[0];break;case 2:e["margin-top"]=e["margin-top"]||n[0],e["margin-right"]=e["margin-right"]||n[1],e["margin-bottom"]=e["margin-bottom"]||n[0],e["margin-left"]=e["margin-left"]||n[1];break;case 3:e["margin-top"]=e["margin-top"]||n[0],e["margin-right"]=e["margin-right"]||n[1],e["margin-bottom"]=e["margin-bottom"]||n[2],e["margin-left"]=e["margin-left"]||n[1];break;case 4:e["margin-top"]=e["margin-top"]||n[0],e["margin-right"]=e["margin-right"]||n[1],e["margin-bottom"]=e["margin-bottom"]||n[2],e["margin-left"]=e["margin-left"]||n[3]}delete e.margin}return e},ve=function(e,n){var t=oe(e);"string"==typeof t?Z.send({url:t,success:function(e){n(JSON.parse(e))}}):"function"==typeof t?t(n):n(t)},be=function(e,n,t){function r(){t.onload=t.onerror=null,e.selection&&(e.selection.select(t),e.nodeChanged())}t.onload=function(){n.width||n.height||!K(e)||e.dom.setAttribs(t,{width:t.clientWidth,height:t.clientHeight}),r()},t.onerror=r},ye=function(i){return new J(function(e,n){var t=function r(){return new(H.getOrDie("FileReader"))}();t.onload=function(){e(t.result)},t.onerror=function(){n(t.error.message)},t.readAsDataURL(i)})},we=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils").DOM,Oe=function(e){return e.style.marginLeft&&e.style.marginRight&&e.style.marginLeft===e.style.marginRight?ge(e.style.marginLeft):""},Se=function(e){return e.style.marginTop&&e.style.marginBottom&&e.style.marginTop===e.style.marginBottom?ge(e.style.marginTop):""},Ne=function(e){return e.style.borderWidth?ge(e.style.borderWidth):""},xe=function(e,n){return e.hasAttribute(n)?e.getAttribute(n):""},Te=function(e,n){return e.style[n]?e.style[n]:""},Ee=function(e){return null!==e.parentNode&&"FIGURE"===e.parentNode.nodeName},De=function(e,n,t){e.setAttribute(n,t)},Ae=function(e){var n,t,r,i;Ee(e)?(i=(r=e).parentNode,we.insertAfter(r,i),we.remove(i)):(n=e,t=we.create("figure",{"class":"image"}),we.insertAfter(t,n),t.appendChild(n),t.appendChild(we.create("figcaption",{contentEditable:!0},"Caption")),t.contentEditable="false")},Ce=function(e,n){var t=e.getAttribute("style"),r=n(null!==t?t:"");0<r.length?(e.setAttribute("style",r),e.setAttribute("data-mce-style",r)):e.removeAttribute("style")},_e=function(e,r){return function(e,n,t){e.style[n]?(e.style[n]=pe(t),Ce(e,r)):De(e,n,t)}},Ie=function(e,n){return e.style[n]?ge(e.style[n]):xe(e,n)},Re=function(e,n){var t=pe(n);e.style.marginLeft=t,e.style.marginRight=t},Le=function(e,n){var t=pe(n);e.style.marginTop=t,e.style.marginBottom=t},Ue=function(e,n){var t=pe(n);e.style.borderWidth=t},Pe=function(e,n){e.style.borderStyle=n},ke=function(e){return"FIGURE"===e.nodeName},Me=function(e,n){var t=s.document.createElement("img");return De(t,"style",n.style),(Oe(t)||""!==n.hspace)&&Re(t,n.hspace),(Se(t)||""!==n.vspace)&&Le(t,n.vspace),(Ne(t)||""!==n.border)&&Ue(t,n.border),(Te(t,"borderStyle")||""!==n.borderStyle)&&Pe(t,n.borderStyle),e(t.getAttribute("style"))},je=function(e,n){return{src:xe(n,"src"),alt:xe(n,"alt"),title:xe(n,"title"),width:Ie(n,"width"),height:Ie(n,"height"),"class":xe(n,"class"),style:e(xe(n,"style")),caption:Ee(n),hspace:Oe(n),vspace:Se(n),border:Ne(n),borderStyle:Te(n,"borderStyle")}},ze=function(e,n,t,r,i){t[r]!==n[r]&&i(e,r,t[r])},Be=function(r,i){return function(e,n,t){r(e,t),Ce(e,i)}},Fe=function(e,n,t){var r=je(e,t);ze(t,r,n,"caption",function(e,n,t){return Ae(e)}),ze(t,r,n,"src",De),ze(t,r,n,"alt",De),ze(t,r,n,"title",De),ze(t,r,n,"width",_e(0,e)),ze(t,r,n,"height",_e(0,e)),ze(t,r,n,"class",De),ze(t,r,n,"style",Be(function(e,n){return De(e,"style",n)},e)),ze(t,r,n,"hspace",Be(Re,e)),ze(t,r,n,"vspace",Be(Le,e)),ze(t,r,n,"border",Be(Ue,e)),ze(t,r,n,"borderStyle",Be(Pe,e))},He=function(e,n){var t=e.dom.styles.parse(n),r=he(t),i=e.dom.styles.parse(e.dom.styles.serialize(r));return e.dom.styles.serialize(i)},We=function(e){var n=e.selection.getNode(),t=e.dom.getParent(n,"figure.image");return t?e.dom.select("img",t)[0]:n&&("IMG"!==n.nodeName||n.getAttribute("data-mce-object")||n.getAttribute("data-mce-placeholder"))?null:n},Ge=function(n,e){var t=n.dom,r=t.getParent(e.parentNode,function(e){return n.schema.getTextBlockElements()[e.nodeName]},n.getBody());return r?t.split(r,e):e},Xe=function(n,e){var t=function(e,n){var t=s.document.createElement("img");if(Fe(e,z(n,{caption:!1}),t),De(t,"alt",n.alt),n.caption){var r=we.create("figure",{"class":"image"});return r.appendChild(t),r.appendChild(we.create("figcaption",{contentEditable:!0},"Caption")),r.contentEditable="false",r}return t}(function(e){return He(n,e)},e);n.dom.setAttrib(t,"data-mce-id","__mcenew"),n.focus(),n.selection.setContent(t.outerHTML);var r=n.dom.select('*[data-mce-id="__mcenew"]')[0];if(n.dom.setAttrib(r,"data-mce-id",null),ke(r)){var i=Ge(n,r);n.selection.select(i)}else n.selection.select(r)},$e=function(e,n){var t=We(e);t?n.src?function(n,e){var t,r=We(n);if(Fe(function(e){return He(n,e)},e,r),t=r,n.dom.setAttrib(t,"src",t.getAttribute("src")),ke(r.parentNode)){var i=r.parentNode;Ge(n,i),n.selection.select(r.parentNode)}else n.selection.select(r),be(n,e,r)}(e,n):function(e,n){if(n){var t=e.dom.is(n.parentNode,"figure.image")?n.parentNode:n;e.dom.remove(t),e.focus(),e.nodeChanged(),e.dom.isEmpty(e.getBody())&&(e.setContent(""),e.selection.setCursorLocation())}}(e,t):n.src&&Xe(e,n)},qe=function(e){return w(e.value)?e.value:""},Ve=function(e,i){var o=[];return Y.each(e,function(e){var n=w(e.text)?e.text:w(e.title)?e.title:"";if(e.menu!==undefined){var t=Ve(e.menu,i);o.push({text:n,items:t})}else{var r=i(e);o.push({text:n,value:r})}}),o},Je=function(n){return void 0===n&&(n=qe),function(e){return e?y.from(e).map(function(e){return Ve(e,n)}):y.none()}},Ye=function(e,t){return function(e,n){for(var t=0;t<e.length;t++){var r=n(e[t],t);if(r.isSome())return r}return y.none()}(e,function(e){return n=e,Object.prototype.hasOwnProperty.call(n,"items")?Ye(e.items,t):e.value===t?y.some(e):y.none();var n})},Ze=Je,Ke=function(e){return Je(qe)(e)},Qe=function(e,n){return e.bind(function(e){return Ye(e,n)})},en=function(){};function nn(u){var n=function(e,r,i,n){var o,t;(o=function a(){return new(H.getOrDie("XMLHttpRequest"))}()).open("POST",u.url),o.withCredentials=u.credentials,o.upload.onprogress=function(e){n(e.loaded/e.total*100)},o.onerror=function(){i("Image upload failed due to a XHR Transport error. Code: "+o.status)},o.onload=function(){var e,n,t;o.status<200||300<=o.status?i("HTTP Error: "+o.status):(e=JSON.parse(o.responseText))&&"string"==typeof e.location?r((n=u.basePath,t=e.location,n?n.replace(/\/$/,"")+"/"+t.replace(/^\//,""):t)):i("Invalid JSON: "+o.responseText)},(t=new s.FormData).append("file",e.blob(),e.filename()),o.send(t)};return u=Y.extend({credentials:!1,handler:n},u),{upload:function(e){return u.url||u.handler!==n?(r=e,i=u.handler,new J(function(e,n){try{i(r,e,n,en)}catch(t){n(t.message)}})):J.reject("Upload url missing from the settings.");var r,i}}}var tn,rn,on,an=function(e){return{title:"Advanced",items:[{type:"input",label:"Style",name:"style"},{type:"grid",columns:2,items:[{type:"input",label:"Vertical space",name:"vspace"},{type:"input",label:"Horizontal space",name:"hspace"},{type:"input",label:"Border width",name:"border"},{type:"selectbox",name:"borderstyle",label:"Border style",items:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]}]}]}},un=function(t){var n,e,r=Ze(function(e){return t.convertURL(e.value||e.url,"src")}),i=C.nu(function(n){ve(t,function(e){n(r(e).map(function(e){return x([[{text:"None",value:""}],e])}))})}),o=Ke(ne(t)),a=Q(t),u=ae(t),s=ue(t),c=(e=We(n=t))?je(function(e){return He(n,e)},e):{src:"",alt:"",title:"",width:"",height:"","class":"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:""},l=te(t),f=re(t),d=K(t),m=ie(t),g=se(t),p=le(t),h=fe(t),v=ce(t),b=y.some(ee(t)).filter(function(e){return w(e)&&0<e.length});return i.map(function(e){return{image:c,imageList:e,classList:o,hasAdvTab:a,hasUploadUrl:u,hasUploadHandler:s,hasDescription:l,hasImageTitle:f,hasDimensions:d,hasImageCaption:m,url:g,basePath:p,credentials:h,handler:v,prependURL:b}})},sn=function(e){return{title:"Upload",items:[{type:"dropzone",name:"fileinput"}]}},cn=function(e){return{src:{value:e.src,meta:{}},images:e.src,alt:e.alt,title:e.title,dimensions:{width:e.width,height:e.height},classes:e["class"],caption:e.caption,style:e.style,vspace:e.vspace,border:e.border,hspace:e.hspace,borderstyle:e.borderStyle,fileinput:[]}},ln=function(e){return{src:e.src.value,alt:e.alt,title:e.title,width:e.dimensions.width,height:e.dimensions.height,"class":e.classes,style:e.style,caption:e.caption,hspace:e.hspace,vspace:e.vspace,border:e.border,borderStyle:e.borderstyle}},fn=function(e,n){var t,r,i=n.getData();(t=e,r=i.src.value,/^(?:[a-zA-Z]+:)?\/\//.test(r)?y.none():t.prependURL.bind(function(e){return r.substring(0,e.length)!==e?y.some(e+r):y.none()})).each(function(e){n.setData({src:{value:e,meta:i.src.meta}})})},dn=function(e,n){(function(e,n){var t=n.src.meta;if(t===undefined)return y.none();var r=j({},n);return e.hasDescription&&w(t.alt)&&(r.alt=t.alt),e.hasImageTitle&&w(t.title)&&(r.title=t.title),e.hasDimensions&&(w(t.width)&&(r.dimensions.width=t.width),w(t.height)&&(r.dimensions.height=t.height)),w(t["class"])&&Qe(e.classList,t["class"]).each(function(e){r.classes=e.value}),e.hasAdvTab&&(w(t.vspace)&&(r.vspace=t.vspace),w(t.border)&&(r.border=t.border),w(t.hspace)&&(r.hspace=t.hspace),w(t.borderstyle)&&(r.borderstyle=t.borderstyle)),y.some(r)})(e,n.getData()).each(function(e){return n.setData(e)})},mn=function(e,n,t,r){var i,o,a,u,s,c,l,f,d,m,g,p;fn(n,r),dn(n,r),i=e,o=n,a=t,s=(u=r).getData(),c=s.src.value,(l=s.src.meta||{}).width||l.height||!o.hasDimensions||i.imageSize(c).get(function(e){e.each(function(e){a.open&&u.setData({dimensions:e})})}),f=n,d=t,g=(m=r).getData(),p=Qe(f.imageList,g.src.value),d.prevImage=p,m.setData({images:p.map(function(e){return e.value}).getOr("")})},gn=function(e,n,t){var r,i,o,a,u,s=he(e(t.style)),c=j({},t);return c.vspace=(r=s)["margin-top"]&&r["margin-bottom"]&&r["margin-top"]===r["margin-bottom"]?ge(String(r["margin-top"])):"",c.hspace=(i=s)["margin-right"]&&i["margin-left"]&&i["margin-right"]===i["margin-left"]?ge(String(i["margin-right"])):"",c.border=(o=s)["border-width"]?ge(String(o["border-width"])):"",c.borderstyle=(a=s)["border-style"]?String(a["border-style"]):"",c.style=(u=n)(e(u(s))),c},pn=function(a,u,s,c){var e,n=c.getData();c.block("Uploading image"),(e=n.fileinput,0===e.length?y.none():y.some(e[0])).fold(function(){c.unblock()},function(t){var r=G(t),i=nn({url:u.url,basePath:u.basePath,credentials:u.credentials,handler:u.handler}),o=function(){c.unblock(),X(r)};ye(t).then(function(e){var n=a.createBlobCache(t,r,e);i.upload(n).then(function(e){c.setData({src:{value:e,meta:{}}}),c.showTab("General"),mn(a,u,s,c),o()})["catch"](function(e){o(),a.alertErr(c,e)})})})},hn=function(h,v,b){return function(e,n){var t,r,i,o,a,u,s,c,l,f,d,m,g,p;"src"===n.name?mn(h,v,b,e):"images"===n.name?(l=h,f=v,d=b,g=(m=e).getData(),(p=Qe(f.imageList,g.images)).each(function(e){""===g.alt||d.prevImage.map(function(e){return e.text===g.alt}).getOr(!1)?""===e.value?m.setData({src:e,alt:d.prevAlt}):m.setData({src:e,alt:e.text}):m.setData({src:e})}),d.prevImage=p,mn(l,f,d,m)):"alt"===n.name?b.prevAlt=e.getData().alt:"style"===n.name?(a=h,s=(u=e).getData(),c=gn(a.parseStyle,a.serializeStyle,s),u.setData(c)):"vspace"===n.name||"hspace"===n.name||"border"===n.name||"borderstyle"===n.name?(t=h,r=e,i=j(cn(v.image),r.getData()),o=Me(t.normalizeCss,ln(i)),r.setData({style:o})):"fileinput"===n.name&&pn(h,v,b,e)}},vn=function(o){return function(e){var n,t,r,i={prevImage:Qe((n=e).imageList,n.image.src),prevAlt:n.image.alt,open:!0};return{title:"Insert/Edit Image",size:"normal",body:(r=e,r.hasAdvTab||r.hasUploadUrl||r.hasUploadHandler?{type:"tabpanel",tabs:x([[q(r)],r.hasAdvTab?[an(r)]:[],r.hasUploadUrl||r.hasUploadHandler?[sn(r)]:[]])}:{type:"panel",items:V(r)}),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:cn(e.image),onSubmit:o.onSubmit(e),onChange:hn(o,e,i),onClose:(t=i,function(){t.open=!1})}}},bn=function(n){var t,r,i,o,a,u,s,e={onSubmit:(s=n,function(t){return function(e){var n=j(cn(t.image),e.getData());s.undoManager.transact(function(){$e(s,ln(n))}),s.editorUpload.uploadImagesAuto(),e.close()}}),imageSize:(u=n,function(e){return P(function(t){me(u.documentBaseURI.toAbsolute(e),function(e){var n=e.bind(function(e){return(w(e.width)||O(e.width))&&(w(e.height)||O(e.height))?R.value({width:String(e.width),height:String(e.height)}):R.error(undefined)});t(n)})})}),createBlobCache:(a=n,function(e,n,t){return a.editorUpload.blobCache.create({blob:e,blobUri:n,name:e.name?e.name.replace(/\.[^\.]+$/,""):null,base64:t.split(",")[1]})}),alertErr:(o=n,function(e,n){o.windowManager.alert(n,e.close)}),normalizeCss:(i=n,function(e){return He(i,e)}),parseStyle:(r=n,function(e){return r.dom.parseStyle(e)}),serializeStyle:(t=n,function(e,n){return t.dom.serializeStyle(e,n)})};return{open:function(){return un(n).map(vn(e)).get(function(e){n.windowManager.open(e)})}}},yn=function(e){e.addCommand("mceImage",bn(e).open)},wn=function(o){return function(e){for(var n,t,r=e.length,i=function(e){e.attr("contenteditable",o?"true":null)};r--;)n=e[r],(t=n.attr("class"))&&/\bimage\b/.test(t)&&(n.attr("contenteditable",o?"false":null),Y.each(n.getAll("figcaption"),i))}},On=function(e){e.on("preInit",function(){e.parser.addNodeFilter("figure",wn(!0)),e.serializer.addNodeFilter("figure",wn(!1))})},Sn=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:h(e)}},Nn={fromHtml:function(e,n){var t=(n||s.document).createElement("div");if(t.innerHTML=e,!t.hasChildNodes()||1<t.childNodes.length)throw s.console.error("HTML does not have a single root node",e),new Error("HTML must have a single root node");return Sn(t.childNodes[0])},fromTag:function(e,n){var t=(n||s.document).createElement(e);return Sn(t)},fromText:function(e,n){var t=(n||s.document).createTextNode(e);return Sn(t)},fromDom:Sn,fromPoint:function(e,n,t){var r=e.dom();return y.from(r.elementFromPoint(n,t)).map(Sn)}},xn=(s.Node.ATTRIBUTE_NODE,s.Node.CDATA_SECTION_NODE,s.Node.COMMENT_NODE,s.Node.DOCUMENT_NODE,s.Node.DOCUMENT_TYPE_NODE,s.Node.DOCUMENT_FRAGMENT_NODE,s.Node.ELEMENT_NODE,s.Node.TEXT_NODE,s.Node.PROCESSING_INSTRUCTION_NODE,s.Node.ENTITY_REFERENCE_NODE,s.Node.ENTITY_NODE,s.Node.NOTATION_NODE,function(e,n){var t=function(e,n){for(var t=0;t<e.length;t++){var r=e[t];if(r.test(n))return r}return undefined}(e,n);if(!t)return{major:0,minor:0};var r=function(e){return Number(n.replace(t,"$"+e))};return En(r(1),r(2))}),Tn=function(){return En(0,0)},En=function(e,n){return{major:e,minor:n}},Dn={nu:En,detect:function(e,n){var t=String(n).toLowerCase();return 0===e.length?Tn():xn(e,t)},unknown:Tn},An="Firefox",Cn=function(e,n){return function(){return n===e}},_n=function(e){var n=e.current;return{current:n,version:e.version,isEdge:Cn("Edge",n),isChrome:Cn("Chrome",n),isIE:Cn("IE",n),isOpera:Cn("Opera",n),isFirefox:Cn(An,n),isSafari:Cn("Safari",n)}},In={unknown:function(){return _n({current:undefined,version:Dn.unknown()})},nu:_n,edge:h("Edge"),chrome:h("Chrome"),ie:h("IE"),opera:h("Opera"),firefox:h(An),safari:h("Safari")},Rn="Windows",Ln="Android",Un="Solaris",Pn="FreeBSD",kn=function(e,n){return function(){return n===e}},Mn=function(e){var n=e.current;return{current:n,version:e.version,isWindows:kn(Rn,n),isiOS:kn("iOS",n),isAndroid:kn(Ln,n),isOSX:kn("OSX",n),isLinux:kn("Linux",n),isSolaris:kn(Un,n),isFreeBSD:kn(Pn,n)}},jn={unknown:function(){return Mn({current:undefined,version:Dn.unknown()})},nu:Mn,windows:h(Rn),ios:h("iOS"),android:h(Ln),linux:h("Linux"),osx:h("OSX"),solaris:h(Un),freebsd:h(Pn)},zn=function(e,n){var t=String(n).toLowerCase();return function(e,n){for(var t=0,r=e.length;t<r;t++){var i=e[t];if(n(i,t,e))return y.some(i)}return y.none()}(e,function(e){return e.search(t)})},Bn=function(e,t){return zn(e,t).map(function(e){var n=Dn.detect(e.versionRegexes,t);return{current:e.name,version:n}})},Fn=function(e,t){return zn(e,t).map(function(e){var n=Dn.detect(e.versionRegexes,t);return{current:e.name,version:n}})},Hn=function(e,n){return-1!==e.indexOf(n)},Wn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Gn=function(n){return function(e){return Hn(e,n)}},Xn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return Hn(e,"edge/")&&Hn(e,"chrome")&&Hn(e,"safari")&&Hn(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Wn],search:function(e){return Hn(e,"chrome")&&!Hn(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return Hn(e,"msie")||Hn(e,"trident")}},{name:"Opera",versionRegexes:[Wn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Gn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Gn("firefox")},{name:"Safari",versionRegexes:[Wn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(Hn(e,"safari")||Hn(e,"mobile/"))&&Hn(e,"applewebkit")}}],$n=[{name:"Windows",search:Gn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return Hn(e,"iphone")||Hn(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Gn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Gn("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Gn("linux"),versionRegexes:[]},{name:"Solaris",search:Gn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Gn("freebsd"),versionRegexes:[]}],qn={browsers:h(Xn),oses:h($n)},Vn=function(e){var n,t,r,i,o,a,u,s,c,l,f,d=qn.browsers(),m=qn.oses(),g=Bn(d,e).fold(In.unknown,In.nu),p=Fn(m,e).fold(jn.unknown,jn.nu);return{browser:g,os:p,deviceType:(t=g,r=e,i=(n=p).isiOS()&&!0===/ipad/i.test(r),o=n.isiOS()&&!i,a=n.isAndroid()&&3===n.version.major,u=n.isAndroid()&&4===n.version.major,s=i||a||u&&!0===/mobile/i.test(r),c=n.isiOS()||n.isAndroid(),l=c&&!s,f=t.isSafari()&&n.isiOS()&&!1===/safari/i.test(r),{isiPad:h(i),isiPhone:h(o),isTablet:h(s),isPhone:h(l),isTouch:h(c),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:h(f)})}},Jn=((tn=function(){var e=s.navigator.userAgent;return Vn(e)},on=!1,function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return on||(on=!0,rn=tn.apply(null,e)),rn}()).browser.isIE(),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]}("element","offset"),function(o){o.ui.registry.addToggleButton("image",{icon:"image",tooltip:"Insert/edit image",onAction:bn(o).open,onSetup:function(e){return o.selection.selectorChangedWithUnbind("img:not([data-mce-object],[data-mce-placeholder]),figure.image",e.setActive).unbind}}),o.ui.registry.addMenuItem("image",{icon:"image",text:"Image...",onAction:bn(o).open}),o.ui.registry.addContextMenu("image",{update:function(e){return ke(e)||"IMG"===e.nodeName?[(i=e,{text:"Image",icon:"image",onAction:function(){var e,n,t,r=((tn=function(){var e=s.navigator.userAgent;return Vn(e)},on=!1,function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return on||(on=!0,rn=tn.apply(null,e)),rn}()).browser.isIE(),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]}("element","offset"),e=Nn.fromDom(i),(n=e,t=n.dom(),y.from(t.parentNode).map(Nn.fromDom)).filter(function(e){return"figure"===e.dom().nodeName.toLowerCase()}).getOr(e));o.selection.select(r.dom()),bn(o).open()}})]:[];var i}})});i.add("image",function(e){On(e),Jn(e),yn(e)}),function Yn(){}}(window); \ No newline at end of file