File manager - Edit - /home/capoccitel/www/components/com_sppagebuilder/assets/js/medium-editor.min.js
Back
"classList"in document.createElement("_")||function(e){"use strict";if("Element"in e){var t="classList",n="prototype",i=e.Element[n],o=Object,s=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},r=Array[n].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},a=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},l=function(e,t){if(""===t)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return r.call(e,t)},c=function(e){for(var t=s.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],i=0,o=n.length;i<o;i++)this.push(n[i]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},d=c[n]=[],u=function(){return new c(this)};if(a[n]=Error[n],d.item=function(e){return this[e]||null},d.contains=function(e){return-1!==l(this,e+="")},d.add=function(){for(var e,t=arguments,n=0,i=t.length,o=!1;e=t[n]+"",-1===l(this,e)&&(this.push(e),o=!0),++n<i;);o&&this._updateClassName()},d.remove=function(){var e,t,n=arguments,i=0,o=n.length,s=!1;do{for(e=n[i]+"",t=l(this,e);-1!==t;)this.splice(t,1),s=!0,t=l(this,e)}while(++i<o);s&&this._updateClassName()},d.toggle=function(e,t){e+="";var n=this.contains(e),i=n?!0!==t&&"remove":!1!==t&&"add";return i&&this[i](e),!0===t||!1===t?t:!n},d.toString=function(){return this.join(" ")},o.defineProperty){var h={get:u,enumerable:!0,configurable:!0};try{o.defineProperty(i,t,h)}catch(e){-2146823252===e.number&&(h.enumerable=!1,o.defineProperty(i,t,h))}}else o[n].__defineGetter__&&i.__defineGetter__(t,u)}}(self),function(e){"use strict";if(e.URL=e.URL||e.webkitURL,e.Blob&&e.URL)try{return new Blob}catch(e){}var a=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||function(e){var a=function(e){return Object.prototype.toString.call(e).match(/^\[object\s(.*)\]$/)[1]},t=function(){this.data=[]},l=function(e,t,n){this.data=e,this.size=e.length,this.type=t,this.encoding=n},n=t.prototype,i=l.prototype,c=e.FileReaderSync,d=function(e){this.code=this[this.name=e]},o="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),s=o.length,r=e.URL||e.webkitURL||e,u=r.createObjectURL,h=r.revokeObjectURL,m=r,f=e.btoa,p=e.atob,g=e.ArrayBuffer,b=e.Uint8Array,v=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(l.fake=i.fake=!0;s--;)d.prototype[o[s]]=s+1;return r.createObjectURL||(m=e.URL=function(e){var t,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");return n.href=e,"origin"in n||("data:"===n.protocol.toLowerCase()?n.origin=null:(t=e.match(v),n.origin=t&&t[1])),n}),m.createObjectURL=function(e){var t,n=e.type;return null===n&&(n="application/octet-stream"),e instanceof l?(t="data:"+n,"base64"===e.encoding?t+";base64,"+e.data:"URI"===e.encoding?t+","+decodeURIComponent(e.data):f?t+";base64,"+f(e.data):t+","+encodeURIComponent(e.data)):u?u.call(r,e):void 0},m.revokeObjectURL=function(e){"data:"!==e.substring(0,5)&&h&&h.call(r,e)},n.append=function(e){var t=this.data;if(b&&(e instanceof g||e instanceof b)){for(var n="",i=new b(e),o=0,s=i.length;o<s;o++)n+=String.fromCharCode(i[o]);t.push(n)}else if("Blob"===a(e)||"File"===a(e)){if(!c)throw new d("NOT_READABLE_ERR");var r=new c;t.push(r.readAsBinaryString(e))}else e instanceof l?"base64"===e.encoding&&p?t.push(p(e.data)):"URI"===e.encoding?t.push(decodeURIComponent(e.data)):"raw"===e.encoding&&t.push(e.data):("string"!=typeof e&&(e+=""),t.push(unescape(encodeURIComponent(e))))},n.getBlob=function(e){return arguments.length||(e=null),new l(this.data.join(""),e,"raw")},n.toString=function(){return"[object BlobBuilder]"},i.slice=function(e,t,n){var i=arguments.length;return i<3&&(n=null),new l(this.data.slice(e,1<i?t:this.data.length),n,this.encoding)},i.toString=function(){return"[object Blob]"},i.close=function(){this.size=0,delete this.data},t}(e);e.Blob=function(e,t){var n=t&&t.type||"",i=new a;if(e)for(var o=0,s=e.length;o<s;o++)Uint8Array&&e[o]instanceof Uint8Array?i.append(e[o].buffer):i.append(e[o]);var r=i.getBlob(n);return!r.slice&&r.webkitSlice&&(r.slice=r.webkitSlice),r};var t=Object.getPrototypeOf||function(e){return e.__proto__};e.Blob.prototype=t(new e.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this),function(e,t){"use strict";"object"==typeof module&&"undefined"!=typeof process&&process&&process.versions&&process.versions.electron||"object"!=typeof module?"function"==typeof define&&define.amd?define(function(){return t}):e.MediumEditor=t:module.exports=t}(this,function(){"use strict";function b(e,t){return this.init(e,t)}return b.extensions={},function(e){function t(e,t){var n,i=Array.prototype.slice.call(arguments,2);t=t||{};for(var o=0;o<i.length;o++){var s=i[o];if(s)for(n in s)s.hasOwnProperty(n)&&void 0!==s[n]&&(e||!1===t.hasOwnProperty(n))&&(t[n]=s[n])}return t}var o=!1;try{var n=document.createElement("div"),i=document.createTextNode(" ");n.appendChild(i),o=n.contains(i)}catch(e){}var m={isIE:"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent),isEdge:null!==/Edge\/\d+/.exec(navigator.userAgent),isFF:-1<navigator.userAgent.toLowerCase().indexOf("firefox"),isMac:0<=e.navigator.platform.toUpperCase().indexOf("MAC"),keyCode:{BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,DELETE:46,K:75,M:77,V:86},isMetaCtrlKey:function(e){return!!(m.isMac&&e.metaKey||!m.isMac&&e.ctrlKey)},isKey:function(e,t){var n=m.getKeyCode(e);return!1===Array.isArray(t)?n===t:-1!==t.indexOf(n)},getKeyCode:function(e){var t=e.which;return null===t&&(t=null!==e.charCode?e.charCode:e.keyCode),t},blockContainerElementNames:["p","h1","h2","h3","h4","h5","h6","blockquote","pre","ul","li","ol","address","article","aside","audio","canvas","dd","dl","dt","fieldset","figcaption","figure","footer","form","header","hgroup","main","nav","noscript","output","section","video","table","thead","tbody","tfoot","tr","th","td"],emptyElementNames:["br","col","colgroup","hr","img","input","source","wbr"],extend:function(){var e=[!0].concat(Array.prototype.slice.call(arguments));return t.apply(this,e)},defaults:function(){var e=[!1].concat(Array.prototype.slice.call(arguments));return t.apply(this,e)},createLink:function(e,t,n,i){var o=e.createElement("a");return m.moveTextRangeIntoElement(t[0],t[t.length-1],o),o.setAttribute("href",n),i&&("_blank"===i&&o.setAttribute("rel","noopener noreferrer"),o.setAttribute("target",i)),o},findOrCreateMatchingTextNodes:function(e,t,n){for(var i=e.createTreeWalker(t,NodeFilter.SHOW_ALL,null,!1),o=[],s=0,r=!1,a=null,l=null;null!==(a=i.nextNode());)if(!(3<a.nodeType))if(3===a.nodeType){if(!r&&n.start<s+a.nodeValue.length&&(r=!0,l=m.splitStartNodeIfNeeded(a,n.start,s)),r&&m.splitEndNodeIfNeeded(a,l,n.end,s),r&&s===n.end)break;if(r&&s>n.end+1)throw new Error("PerformLinking overshot the target!");r&&o.push(l||a),s+=a.nodeValue.length,null!==l&&(s+=l.nodeValue.length,i.nextNode()),l=null}else"img"===a.tagName.toLowerCase()&&(!r&&n.start<=s&&(r=!0),r&&o.push(a));return o},splitStartNodeIfNeeded:function(e,t,n){return t!==n?e.splitText(t-n):null},splitEndNodeIfNeeded:function(e,t,n,i){var o,s;o=i+e.nodeValue.length+(t?t.nodeValue.length:0)-1,s=n-i-(t?e.nodeValue.length:0),n<=o&&i!==o&&0!==s&&(t||e).splitText(s)},splitByBlockElements:function(e){if(3!==e.nodeType&&1!==e.nodeType)return[];var t=[],n=b.util.blockContainerElementNames.join(",");if(3===e.nodeType||0===e.querySelectorAll(n).length)return[e];for(var i=0;i<e.childNodes.length;i++){var o=e.childNodes[i];if(3===o.nodeType)t.push(o);else if(1===o.nodeType){0===o.querySelectorAll(n).length?t.push(o):t=t.concat(b.util.splitByBlockElements(o))}}return t},findAdjacentTextNodeWithContent:function(e,t,n){var i,o=!1,s=n.createNodeIterator(e,NodeFilter.SHOW_TEXT,null,!1);for(i=s.nextNode();i;){if(i===t)o=!0;else if(o&&3===i.nodeType&&i.nodeValue&&0<i.nodeValue.trim().length)break;i=s.nextNode()}return i},findPreviousSibling:function(e){if(!e||m.isMediumEditorElement(e))return!1;for(var t=e.previousSibling;!t&&!m.isMediumEditorElement(e.parentNode);)t=(e=e.parentNode).previousSibling;return t},isDescendant:function(e,t,n){if(!e||!t)return!1;if(e===t)return!!n;if(1!==e.nodeType)return!1;if(o||3!==t.nodeType)return e.contains(t);for(var i=t.parentNode;null!==i;){if(i===e)return!0;i=i.parentNode}return!1},isElement:function(e){return!(!e||1!==e.nodeType)},throttle:function(n,i){var o,s,r,a=null,l=0,c=function(){l=Date.now(),a=null,r=n.apply(o,s),a||(o=s=null)};return i||0===i||(i=50),function(){var e=Date.now(),t=i-(e-l);return o=this,s=arguments,t<=0||i<t?(a&&(clearTimeout(a),a=null),l=e,r=n.apply(o,s),a||(o=s=null)):a||(a=setTimeout(c,t)),r}},traverseUp:function(e,t){if(!e)return!1;do{if(1===e.nodeType){if(t(e))return e;if(m.isMediumEditorElement(e))return!1}e=e.parentNode}while(e);return!1},htmlEntities:function(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},insertHTMLCommand:function(e,t){var n,i,o,s,r,a,l,c=!1,d=["insertHTML",!1,t];if(!b.util.isEdge&&e.queryCommandSupported("insertHTML"))try{return e.execCommand.apply(e,d)}catch(e){}if((n=e.getSelection()).rangeCount){if(l=(i=n.getRangeAt(0)).commonAncestorContainer,m.isMediumEditorElement(l)&&!l.firstChild)i.selectNode(l.appendChild(e.createTextNode("")));else if(3===l.nodeType&&0===i.startOffset&&i.endOffset===l.nodeValue.length||3!==l.nodeType&&l.innerHTML===i.toString()){for(;!m.isMediumEditorElement(l)&&l.parentNode&&1===l.parentNode.childNodes.length&&!m.isMediumEditorElement(l.parentNode);)l=l.parentNode;i.selectNode(l)}for(i.deleteContents(),(o=e.createElement("div")).innerHTML=t,s=e.createDocumentFragment();o.firstChild;)r=o.firstChild,a=s.appendChild(r);i.insertNode(s),a&&((i=i.cloneRange()).setStartAfter(a),i.collapse(!0),b.selection.selectRange(e,i)),c=!0}return e.execCommand.callListeners&&e.execCommand.callListeners(d,c),c},execFormatBlock:function(e,t){var n=m.getTopBlockContainer(b.selection.getSelectionStart(e));if("blockquote"===t){if(n&&Array.prototype.slice.call(n.childNodes).some(function(e){return m.isBlockContainer(e)}))return e.execCommand("outdent",!1,null);if(m.isIE)return e.execCommand("indent",!1,t)}if(n&&t===n.nodeName.toLowerCase()&&(t="p"),m.isIE&&(t="<"+t+">"),n&&"blockquote"===n.nodeName.toLowerCase()){if(m.isIE&&"<p>"===t)return e.execCommand("outdent",!1,t);if((m.isFF||m.isEdge)&&"p"===t)return Array.prototype.slice.call(n.childNodes).some(function(e){return!m.isBlockContainer(e)})&&e.execCommand("formatBlock",!1,t),e.execCommand("outdent",!1,t)}return e.execCommand("formatBlock",!1,t)},setTargetBlank:function(e,t){var n,i=t||!1;if("a"===e.nodeName.toLowerCase())e.target="_blank",e.rel="noopener noreferrer";else for(e=e.getElementsByTagName("a"),n=0;n<e.length;n+=1)!1!==i&&i!==e[n].attributes.href.value||(e[n].target="_blank",e[n].rel="noopener noreferrer")},removeTargetBlank:function(e,t){var n;if("a"===e.nodeName.toLowerCase())e.removeAttribute("target"),e.removeAttribute("rel");else for(e=e.getElementsByTagName("a"),n=0;n<e.length;n+=1)t===e[n].attributes.href.value&&(e[n].removeAttribute("target"),e[n].removeAttribute("rel"))},addClassToAnchors:function(e,t){var n,i,o=t.split(" ");if("a"===e.nodeName.toLowerCase())for(i=0;i<o.length;i+=1)e.classList.add(o[i]);else{var s=e.getElementsByTagName("a");if(0===s.length){var r=m.getClosestTag(e,"a");e=r?[r]:[]}else e=s;for(n=0;n<e.length;n+=1)for(i=0;i<o.length;i+=1)e[n].classList.add(o[i])}},isListItem:function(e){if(!e)return!1;if("li"===e.nodeName.toLowerCase())return!0;for(var t=e.parentNode,n=t.nodeName.toLowerCase();"li"===n||!m.isBlockContainer(t)&&"div"!==n;){if("li"===n)return!0;if(!(t=t.parentNode))return!1;n=t.nodeName.toLowerCase()}return!1},cleanListDOM:function(e,t){if("li"===t.nodeName.toLowerCase()){var n=t.parentElement;"p"===n.parentElement.nodeName.toLowerCase()&&(m.unwrap(n.parentElement,e),b.selection.moveCursor(e,t.firstChild,t.firstChild.textContent.length))}},splitOffDOMTree:function(e,t,n){for(var i=t,o=null,s=!n;i!==e;){var r,a=i.parentNode,l=a.cloneNode(!1),c=s?i:a.firstChild;for(o&&(s?l.appendChild(o):r=o),o=l;c;){var d=c.nextSibling;c===i?(c.hasChildNodes()?c=c.cloneNode(!1):c.parentNode.removeChild(c),c.textContent&&o.appendChild(c),c=s?d:null):(c.parentNode.removeChild(c),(c.hasChildNodes()||c.textContent)&&o.appendChild(c),c=d)}r&&o.appendChild(r),i=a}return o},moveTextRangeIntoElement:function(e,t,n){if(!e||!t)return!1;var i=m.findCommonRoot(e,t);if(!i)return!1;if(t===e){var o=e.parentNode,s=e.nextSibling;return o.removeChild(e),n.appendChild(e),s?o.insertBefore(n,s):o.appendChild(n),n.hasChildNodes()}for(var r,a,l,c=[],d=0;d<i.childNodes.length;d++)if(l=i.childNodes[d],r){if(m.isDescendant(l,t,!0)){a=l;break}c.push(l)}else m.isDescendant(l,e,!0)&&(r=l);var u=a.nextSibling,h=i.ownerDocument.createDocumentFragment();return r===e?(r.parentNode.removeChild(r),h.appendChild(r)):h.appendChild(m.splitOffDOMTree(r,e)),c.forEach(function(e){e.parentNode.removeChild(e),h.appendChild(e)}),a===t?(a.parentNode.removeChild(a),h.appendChild(a)):h.appendChild(m.splitOffDOMTree(a,t,!0)),n.appendChild(h),a.parentNode===i?i.insertBefore(n,a):u?i.insertBefore(n,u):i.appendChild(n),n.hasChildNodes()},depthOfNode:function(e){for(var t=0,n=e;null!==n.parentNode;)n=n.parentNode,t++;return t},findCommonRoot:function(e,t){for(var n=m.depthOfNode(e),i=m.depthOfNode(t),o=e,s=t;n!==i;)i<n?(o=o.parentNode,n-=1):(s=s.parentNode,i-=1);for(;o!==s;)o=o.parentNode,s=s.parentNode;return o},isElementAtBeginningOfBlock:function(e){for(var t;!m.isBlockContainer(e)&&!m.isMediumEditorElement(e);){for(t=e;t=t.previousSibling;)if(0<(3===t.nodeType?t.nodeValue:t.textContent).length)return!1;e=e.parentNode}return!0},isMediumEditorElement:function(e){return e&&e.getAttribute&&!!e.getAttribute("data-medium-editor-element")},getContainerEditorElement:function(e){return m.traverseUp(e,function(e){return m.isMediumEditorElement(e)})},isBlockContainer:function(e){return e&&3!==e.nodeType&&-1!==m.blockContainerElementNames.indexOf(e.nodeName.toLowerCase())},getClosestBlockContainer:function(e){return m.traverseUp(e,function(e){return m.isBlockContainer(e)||m.isMediumEditorElement(e)})},getTopBlockContainer:function(e){var t=!!m.isBlockContainer(e)&&e;return m.traverseUp(e,function(e){return m.isBlockContainer(e)&&(t=e),!(t||!m.isMediumEditorElement(e))&&(t=e,!0)}),t},getFirstSelectableLeafNode:function(e){for(;e&&e.firstChild;)e=e.firstChild;if("table"===(e=m.traverseUp(e,function(e){return-1===m.emptyElementNames.indexOf(e.nodeName.toLowerCase())})).nodeName.toLowerCase()){var t=e.querySelector("th, td");t&&(e=t)}return e},getFirstTextNode:function(e){return m.warn("getFirstTextNode is deprecated and will be removed in version 6.0.0"),m._getFirstTextNode(e)},_getFirstTextNode:function(e){if(3===e.nodeType)return e;for(var t=0;t<e.childNodes.length;t++){var n=m._getFirstTextNode(e.childNodes[t]);if(null!==n)return n}return null},ensureUrlHasProtocol:function(e){return-1===e.indexOf("://")?"http://"+e:e},warn:function(){void 0!==e.console&&"function"==typeof e.console.warn&&e.console.warn.apply(e.console,arguments)},deprecated:function(e,t,n){var i=e+" is deprecated, please use "+t+" instead.";n&&(i+=" Will be removed in "+n),m.warn(i)},deprecatedMethod:function(e,t,n,i){m.deprecated(e,t,i),"function"==typeof this[t]&&this[t].apply(this,n)},cleanupAttrs:function(t,e){e.forEach(function(e){t.removeAttribute(e)})},cleanupTags:function(e,t){-1!==t.indexOf(e.nodeName.toLowerCase())&&e.parentNode.removeChild(e)},unwrapTags:function(e,t){-1!==t.indexOf(e.nodeName.toLowerCase())&&b.util.unwrap(e,document)},getClosestTag:function(e,t){return m.traverseUp(e,function(e){return e.nodeName.toLowerCase()===t.toLowerCase()})},unwrap:function(e,t){for(var n=t.createDocumentFragment(),i=Array.prototype.slice.call(e.childNodes),o=0;o<i.length;o++)n.appendChild(i[o]);n.childNodes.length?e.parentNode.replaceChild(n,e):e.parentNode.removeChild(e)},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}};b.util=m}(window),(d=function(e){b.util.extend(this,e)}).extend=function(e){var t,n=this;t=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return n.apply(this,arguments)},b.util.extend(t,n);var i=function(){this.constructor=t};return i.prototype=n.prototype,t.prototype=new i,e&&b.util.extend(t.prototype,e),t},d.prototype={init:function(){},base:void 0,name:void 0,checkState:void 0,destroy:void 0,queryCommandState:void 0,isActive:void 0,isAlreadyApplied:void 0,setActive:void 0,setInactive:void 0,getInteractionElements:void 0,window:void 0,document:void 0,getEditorElements:function(){return this.base.elements},getEditorId:function(){return this.base.id},getEditorOption:function(e){return this.base.options[e]}},["execAction","on","off","subscribe","trigger"].forEach(function(e){d.prototype[e]=function(){return this.base[e].apply(this.base,arguments)}}),b.Extension=d,function(){function d(e){return b.util.isBlockContainer(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}var e={findMatchingSelectionParent:function(e,t){var n,i=t.getSelection();return 0!==i.rangeCount&&(n=i.getRangeAt(0).commonAncestorContainer,b.util.traverseUp(n,e))},getSelectionElement:function(e){return this.findMatchingSelectionParent(function(e){return b.util.isMediumEditorElement(e)},e)},exportSelection:function(e,t){if(!e)return null;var n=null,i=t.getSelection();if(0<i.rangeCount){var o,s=i.getRangeAt(0),r=s.cloneRange();r.selectNodeContents(e),r.setEnd(s.startContainer,s.startOffset),n={start:o=r.toString().length,end:o+s.toString().length},this.doesRangeStartWithImages(s,t)&&(n.startsWithImage=!0);var a=this.getTrailingImageCount(e,n,s.endContainer,s.endOffset);if(a&&(n.trailingImageCount=a),0!==o){var l=this.getIndexRelativeToAdjacentEmptyBlocks(t,e,s.startContainer,s.startOffset);-1!==l&&(n.emptyBlocksIndex=l)}}return n},importSelection:function(e,t,n,i){if(e&&t){var o=n.createRange();o.setStart(t,0),o.collapse(!0);var s,r=t,a=[],l=0,c=!1,d=!1,u=0,h=!1,m=!1,f=null;for((i||e.startsWithImage||void 0!==e.emptyBlocksIndex)&&(m=!0);!h&&r;)if(3<r.nodeType)r=a.pop();else{if(3!==r.nodeType||d){if(e.trailingImageCount&&d&&("img"===r.nodeName.toLowerCase()&&u++,u===e.trailingImageCount)){for(var p=0;r.parentNode.childNodes[p]!==r;)p++;o.setEnd(r.parentNode,p+1),h=!0}if(!h&&1===r.nodeType)for(var g=r.childNodes.length-1;0<=g;)a.push(r.childNodes[g]),g-=1}else s=l+r.length,!c&&e.start>=l&&e.start<=s&&(m||e.start<s?(o.setStart(r,e.start-l),c=!0):f=r),c&&e.end>=l&&e.end<=s&&(e.trailingImageCount?d=!0:(o.setEnd(r,e.end-l),h=!0)),l=s;h||(r=a.pop())}!c&&f&&(o.setStart(f,f.length),o.setEnd(f,f.length)),void 0!==e.emptyBlocksIndex&&(o=this.importSelectionMoveCursorPastBlocks(n,t,e.emptyBlocksIndex,o)),i&&(o=this.importSelectionMoveCursorPastAnchor(e,o)),this.selectRange(n,o)}},importSelectionMoveCursorPastAnchor:function(e,t){if(e.start===e.end&&3===t.startContainer.nodeType&&t.startOffset===t.startContainer.nodeValue.length&&b.util.traverseUp(t.startContainer,function(e){return"a"===e.nodeName.toLowerCase()})){for(var n=t.startContainer,i=t.startContainer.parentNode;null!==i&&"a"!==i.nodeName.toLowerCase();)i.childNodes[i.childNodes.length-1]!==n?i=null:i=(n=i).parentNode;if(null!==i&&"a"===i.nodeName.toLowerCase()){for(var o=null,s=0;null===o&&s<i.parentNode.childNodes.length;s++)i.parentNode.childNodes[s]===i&&(o=s);t.setStart(i.parentNode,o+1),t.collapse(!0)}}return t},importSelectionMoveCursorPastBlocks:function(e,t,n,i){var o,s,r=e.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,d,!1),a=i.startContainer,l=0;for(n=n||1,o=3===a.nodeType&&b.util.isBlockContainer(a.previousSibling)?a.previousSibling:b.util.getClosestBlockContainer(a);r.nextNode();)if(s){if(s=r.currentNode,++l===n)break;if(0<s.textContent.length)break}else o===r.currentNode&&(s=r.currentNode);return s||(s=o),i.setStart(b.util.getFirstSelectableLeafNode(s),0),i},getIndexRelativeToAdjacentEmptyBlocks:function(e,t,n,i){if(0<n.textContent.length&&0<i)return-1;var o=n;if(3!==o.nodeType&&(o=n.childNodes[i]),o){if(!b.util.isElementAtBeginningOfBlock(o))return-1;var s=b.util.findPreviousSibling(o);if(!s)return-1;if(s.nodeValue)return-1}for(var r=b.util.getClosestBlockContainer(n),a=e.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,d,!1),l=0;a.nextNode();){var c=""===a.currentNode.textContent;if((c||0<l)&&(l+=1),a.currentNode===r)return l;c||(l=0)}return l},doesRangeStartWithImages:function(e,t){if(0!==e.startOffset||1!==e.startContainer.nodeType)return!1;if("img"===e.startContainer.nodeName.toLowerCase())return!0;var n=e.startContainer.querySelector("img");if(!n)return!1;for(var i=t.createTreeWalker(e.startContainer,NodeFilter.SHOW_ALL,null,!1);i.nextNode();){var o=i.currentNode;if(o===n)break;if(o.nodeValue)return!1}return!0},getTrailingImageCount:function(e,t,n,i){if(0===i||1!==n.nodeType)return 0;if("img"!==n.nodeName.toLowerCase()&&!n.querySelector("img"))return 0;for(var o=n.childNodes[i-1];o.hasChildNodes();)o=o.lastChild;for(var s,r=e,a=[],l=0,c=!1,d=!1,u=!1,h=0;!u&&r;)if(3<r.nodeType)r=a.pop();else{if(3!==r.nodeType||d){if("img"===r.nodeName.toLowerCase()&&h++,r===o)u=!0;else if(1===r.nodeType)for(var m=r.childNodes.length-1;0<=m;)a.push(r.childNodes[m]),m-=1}else h=0,s=l+r.length,!c&&t.start>=l&&t.start<=s&&(c=!0),c&&t.end>=l&&t.end<=s&&(d=!0),l=s;u||(r=a.pop())}return h},selectionContainsContent:function(e){var t=e.getSelection();if(!t||t.isCollapsed||!t.rangeCount)return!1;if(""!==t.toString().trim())return!0;var n=this.getSelectedParentElement(t.getRangeAt(0));return!(!n||!("img"===n.nodeName.toLowerCase()||1===n.nodeType&&n.querySelector("img")))},selectionInContentEditableFalse:function(e){var n,t=this.findMatchingSelectionParent(function(e){var t=e&&e.getAttribute("contenteditable");return"true"===t&&(n=!0),"#text"!==e.nodeName&&"false"===t},e);return!n&&t},getSelectionHtml:function(e){var t,n,i,o="",s=e.getSelection();if(s.rangeCount){for(i=e.createElement("div"),t=0,n=s.rangeCount;t<n;t+=1)i.appendChild(s.getRangeAt(t).cloneContents());o=i.innerHTML}return o},getCaretOffsets:function(e,t){var n,i;return t||(t=window.getSelection().getRangeAt(0)),n=t.cloneRange(),i=t.cloneRange(),n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset),i.selectNodeContents(e),i.setStart(t.endContainer,t.endOffset),{left:n.toString().length,right:i.toString().length}},rangeSelectsSingleNode:function(e){var t=e.startContainer;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===e.startOffset+1},getSelectedParentElement:function(e){return e?this.rangeSelectsSingleNode(e)&&3!==e.startContainer.childNodes[e.startOffset].nodeType?e.startContainer.childNodes[e.startOffset]:3===e.startContainer.nodeType?e.startContainer.parentNode:e.startContainer:null},getSelectedElements:function(e){var t,n,i,o=e.getSelection();if(!o.rangeCount||o.isCollapsed||!o.getRangeAt(0).commonAncestorContainer)return[];if(3===(t=o.getRangeAt(0)).commonAncestorContainer.nodeType){for(n=[],i=t.commonAncestorContainer;i.parentNode&&1===i.parentNode.childNodes.length;)n.push(i.parentNode),i=i.parentNode;return n}return[].filter.call(t.commonAncestorContainer.getElementsByTagName("*"),function(e){return"function"!=typeof o.containsNode||o.containsNode(e,!0)})},selectNode:function(e,t){var n=t.createRange();n.selectNodeContents(e),this.selectRange(t,n)},select:function(e,t,n,i,o){var s=e.createRange();return s.setStart(t,n),i?s.setEnd(i,o):s.collapse(!0),this.selectRange(e,s),s},clearSelection:function(e,t){t?e.getSelection().collapseToStart():e.getSelection().collapseToEnd()},moveCursor:function(e,t,n){this.select(e,t,n)},getSelectionRange:function(e){var t=e.getSelection();return 0===t.rangeCount?null:t.getRangeAt(0)},selectRange:function(e,t){var n=e.getSelection();n.removeAllRanges(),n.addRange(t)},getSelectionStart:function(e){var t=e.getSelection().anchorNode;return t&&3===t.nodeType?t.parentNode:t}};b.selection=e}(),function(){function s(e,n){return!!e&&e.some(function(e){if("function"!=typeof e.getInteractionElements)return!1;var t=e.getInteractionElements();return!!t&&(Array.isArray(t)||(t=[t]),t.some(function(e){return b.util.isDescendant(e,n,!0)}))})}var e=function(e){this.base=e,this.options=this.base.options,this.events=[],this.disabledEvents={},this.customEvents={},this.listeners={}};e.prototype={InputEventOnContenteditableSupported:!b.util.isIE&&!b.util.isEdge,attachDOMEvent:function(e,t,n,i){var o=this.base.options.contentWindow,s=this.base.options.ownerDocument;e=b.util.isElement(e)||-1<[o,s].indexOf(e)?[e]:e,Array.prototype.forEach.call(e,function(e){e.addEventListener(t,n,i),this.events.push([e,t,n,i])}.bind(this))},detachDOMEvent:function(e,t,n,i){var o,s,r=this.base.options.contentWindow,a=this.base.options.ownerDocument;e&&(e=b.util.isElement(e)||-1<[r,a].indexOf(e)?[e]:e,Array.prototype.forEach.call(e,function(e){-1!==(o=this.indexOfListener(e,t,n,i))&&(s=this.events.splice(o,1)[0])[0].removeEventListener(s[1],s[2],s[3])}.bind(this)))},indexOfListener:function(e,t,n,i){var o,s,r;for(o=0,s=this.events.length;o<s;o+=1)if((r=this.events[o])[0]===e&&r[1]===t&&r[2]===n&&r[3]===i)return o;return-1},detachAllDOMEvents:function(){for(var e=this.events.pop();e;)e[0].removeEventListener(e[1],e[2],e[3]),e=this.events.pop()},detachAllEventsFromElement:function(t){for(var e=this.events.filter(function(e){return e&&e[0].getAttribute&&e[0].getAttribute("medium-editor-index")===t.getAttribute("medium-editor-index")}),n=0,i=e.length;n<i;n++){var o=e[n];this.detachDOMEvent(o[0],o[1],o[2],o[3])}},attachAllEventsToElement:function(t){this.listeners.editableInput&&(this.contentCache[t.getAttribute("medium-editor-index")]=t.innerHTML),this.eventsCache&&this.eventsCache.forEach(function(e){this.attachDOMEvent(t,e.name,e.handler.bind(this))},this)},enableCustomEvent:function(e){void 0!==this.disabledEvents[e]&&delete this.disabledEvents[e]},disableCustomEvent:function(e){this.disabledEvents[e]=!0},attachCustomEvent:function(e,t){this.setupListener(e),this.customEvents[e]||(this.customEvents[e]=[]),this.customEvents[e].push(t)},detachCustomEvent:function(e,t){var n=this.indexOfCustomListener(e,t);-1!==n&&this.customEvents[e].splice(n,1)},indexOfCustomListener:function(e,t){return this.customEvents[e]&&this.customEvents[e].length?this.customEvents[e].indexOf(t):-1},detachAllCustomEvents:function(){this.customEvents={}},triggerCustomEvent:function(e,t,n){this.customEvents[e]&&!this.disabledEvents[e]&&this.customEvents[e].forEach(function(e){e(t,n)})},destroy:function(){this.detachAllDOMEvents(),this.detachAllCustomEvents(),this.detachExecCommand(),this.base.elements&&this.base.elements.forEach(function(e){e.removeAttribute("data-medium-focused")})},attachToExecCommand:function(){this.execCommandListener||(this.execCommandListener=function(e){this.handleDocumentExecCommand(e)}.bind(this),this.wrapExecCommand(),this.options.ownerDocument.execCommand.listeners.push(this.execCommandListener))},detachExecCommand:function(){var e=this.options.ownerDocument;if(this.execCommandListener&&e.execCommand.listeners){var t=e.execCommand.listeners.indexOf(this.execCommandListener);-1!==t&&e.execCommand.listeners.splice(t,1),e.execCommand.listeners.length||this.unwrapExecCommand()}},wrapExecCommand:function(){var i=this.options.ownerDocument;if(!i.execCommand.listeners){var n=function(t,n){i.execCommand.listeners&&i.execCommand.listeners.forEach(function(e){e({command:t[0],value:t[2],args:t,result:n})})},e=function(){var e=i.execCommand.orig.apply(this,arguments);if(!i.execCommand.listeners)return e;var t=Array.prototype.slice.call(arguments);return n(t,e),e};e.orig=i.execCommand,e.listeners=[],e.callListeners=n,i.execCommand=e}},unwrapExecCommand:function(){var e=this.options.ownerDocument;e.execCommand.orig&&(e.execCommand=e.execCommand.orig)},setupListener:function(e){if(!this.listeners[e]){switch(e){case"externalInteraction":this.attachDOMEvent(this.options.ownerDocument.body,"mousedown",this.handleBodyMousedown.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"click",this.handleBodyClick.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"focus",this.handleBodyFocus.bind(this),!0);break;case"blur":case"focus":this.setupListener("externalInteraction");break;case"editableInput":this.contentCache={},this.base.elements.forEach(function(e){this.contentCache[e.getAttribute("medium-editor-index")]=e.innerHTML},this),this.InputEventOnContenteditableSupported&&this.attachToEachElement("input",this.handleInput),this.InputEventOnContenteditableSupported||(this.setupListener("editableKeypress"),this.keypressUpdateInput=!0,this.attachDOMEvent(document,"selectionchange",this.handleDocumentSelectionChange.bind(this)),this.attachToExecCommand());break;case"editableClick":this.attachToEachElement("click",this.handleClick);break;case"editableBlur":this.attachToEachElement("blur",this.handleBlur);break;case"editableKeypress":this.attachToEachElement("keypress",this.handleKeypress);break;case"editableKeyup":this.attachToEachElement("keyup",this.handleKeyup);break;case"editableKeydown":this.attachToEachElement("keydown",this.handleKeydown);break;case"editableKeydownSpace":case"editableKeydownEnter":case"editableKeydownTab":case"editableKeydownDelete":this.setupListener("editableKeydown");break;case"editableMouseover":this.attachToEachElement("mouseover",this.handleMouseover);break;case"editableDrag":this.attachToEachElement("dragover",this.handleDragging),this.attachToEachElement("dragleave",this.handleDragging);break;case"editableDrop":this.attachToEachElement("drop",this.handleDrop);break;case"editablePaste":this.attachToEachElement("paste",this.handlePaste)}this.listeners[e]=!0}},attachToEachElement:function(t,n){this.eventsCache||(this.eventsCache=[]),this.base.elements.forEach(function(e){this.attachDOMEvent(e,t,n.bind(this))},this),this.eventsCache.push({name:t,handler:n})},cleanupElement:function(e){var t=e.getAttribute("medium-editor-index");t&&(this.detachAllEventsFromElement(e),this.contentCache&&delete this.contentCache[t])},focusElement:function(e){e.focus(),this.updateFocus(e,{target:e,type:"focus"})},updateFocus:function(t,e){var n,i=this.base.getFocusedElement();i&&"click"===e.type&&this.lastMousedownTarget&&(b.util.isDescendant(i,this.lastMousedownTarget,!0)||s(this.base.extensions,this.lastMousedownTarget))&&(n=i),n||this.base.elements.some(function(e){return!n&&b.util.isDescendant(e,t,!0)&&(n=e),!!n},this);var o=!b.util.isDescendant(i,t,!0)&&!s(this.base.extensions,t);n!==i&&(i&&o&&(i.removeAttribute("data-medium-focused"),this.triggerCustomEvent("blur",e,i)),n&&(n.setAttribute("data-medium-focused",!0),this.triggerCustomEvent("focus",e,n))),o&&this.triggerCustomEvent("externalInteraction",e)},updateInput:function(e,t){if(this.contentCache){var n=e.getAttribute("medium-editor-index"),i=e.innerHTML;i!==this.contentCache[n]&&this.triggerCustomEvent("editableInput",t,e),this.contentCache[n]=i}},handleDocumentSelectionChange:function(e){if(e.currentTarget&&e.currentTarget.activeElement){var t,n=e.currentTarget.activeElement;this.base.elements.some(function(e){return!!b.util.isDescendant(e,n,!0)&&(t=e,!0)},this),t&&this.updateInput(t,{target:n,currentTarget:t})}},handleDocumentExecCommand:function(){var e=this.base.getFocusedElement();e&&this.updateInput(e,{target:e,currentTarget:e})},handleBodyClick:function(e){this.updateFocus(e.target,e)},handleBodyFocus:function(e){this.updateFocus(e.target,e)},handleBodyMousedown:function(e){this.lastMousedownTarget=e.target},handleInput:function(e){this.updateInput(e.currentTarget,e)},handleClick:function(e){this.triggerCustomEvent("editableClick",e,e.currentTarget)},handleBlur:function(e){this.triggerCustomEvent("editableBlur",e,e.currentTarget)},handleKeypress:function(e){if(this.triggerCustomEvent("editableKeypress",e,e.currentTarget),this.keypressUpdateInput){var t={target:e.target,currentTarget:e.currentTarget};setTimeout(function(){this.updateInput(t.currentTarget,t)}.bind(this),0)}},handleKeyup:function(e){this.triggerCustomEvent("editableKeyup",e,e.currentTarget)},handleMouseover:function(e){this.triggerCustomEvent("editableMouseover",e,e.currentTarget)},handleDragging:function(e){this.triggerCustomEvent("editableDrag",e,e.currentTarget)},handleDrop:function(e){this.triggerCustomEvent("editableDrop",e,e.currentTarget)},handlePaste:function(e){this.triggerCustomEvent("editablePaste",e,e.currentTarget)},handleKeydown:function(e){return this.triggerCustomEvent("editableKeydown",e,e.currentTarget),b.util.isKey(e,b.util.keyCode.SPACE)?this.triggerCustomEvent("editableKeydownSpace",e,e.currentTarget):b.util.isKey(e,b.util.keyCode.ENTER)||e.ctrlKey&&b.util.isKey(e,b.util.keyCode.M)?this.triggerCustomEvent("editableKeydownEnter",e,e.currentTarget):b.util.isKey(e,b.util.keyCode.TAB)?this.triggerCustomEvent("editableKeydownTab",e,e.currentTarget):b.util.isKey(e,[b.util.keyCode.DELETE,b.util.keyCode.BACKSPACE])?this.triggerCustomEvent("editableKeydownDelete",e,e.currentTarget):void 0}},b.Events=e}(),(c=b.Extension.extend({action:void 0,aria:void 0,tagNames:void 0,style:void 0,useQueryState:void 0,contentDefault:void 0,contentFA:void 0,classList:void 0,attrs:void 0,constructor:function(e){c.isBuiltInButton(e)?b.Extension.call(this,this.defaults[e]):b.Extension.call(this,e)},init:function(){b.Extension.prototype.init.apply(this,arguments),this.button=this.createButton(),this.on(this.button,"click",this.handleClick.bind(this))},getButton:function(){return this.button},getAction:function(){return"function"==typeof this.action?this.action(this.base.options):this.action},getAria:function(){return"function"==typeof this.aria?this.aria(this.base.options):this.aria},getTagNames:function(){return"function"==typeof this.tagNames?this.tagNames(this.base.options):this.tagNames},createButton:function(){var t=this.document.createElement("button"),e=this.contentDefault,n=this.getAria(),i=this.getEditorOption("buttonLabels");return t.classList.add("medium-editor-action"),t.classList.add("medium-editor-action-"+this.name),this.classList&&this.classList.forEach(function(e){t.classList.add(e)}),t.setAttribute("data-action",this.getAction()),n&&(t.setAttribute("title",n),t.setAttribute("aria-label",n)),this.attrs&&Object.keys(this.attrs).forEach(function(e){t.setAttribute(e,this.attrs[e])},this),"fontawesome"===i&&this.contentFA&&(e=this.contentFA),t.innerHTML=e,t},handleClick:function(e){e.preventDefault(),e.stopPropagation();var t=this.getAction();t&&this.execAction(t)},isActive:function(){return this.button.classList.contains(this.getEditorOption("activeButtonClass"))},setInactive:function(){this.button.classList.remove(this.getEditorOption("activeButtonClass")),delete this.knownState},setActive:function(){this.button.classList.add(this.getEditorOption("activeButtonClass")),delete this.knownState},queryCommandState:function(){var e=null;return this.useQueryState&&(e=this.base.queryCommandState(this.getAction())),e},isAlreadyApplied:function(e){var t,n,i=!1,o=this.getTagNames();return!1===this.knownState||!0===this.knownState?this.knownState:(o&&0<o.length&&(i=-1!==o.indexOf(e.nodeName.toLowerCase())),!i&&this.style&&(t=this.style.value.split("|"),n=this.window.getComputedStyle(e,null).getPropertyValue(this.style.prop),t.forEach(function(e){this.knownState||((i=-1!==n.indexOf(e))||"text-decoration"!==this.style.prop)&&(this.knownState=i)},this)),i)}})).isBuiltInButton=function(e){return"string"==typeof e&&b.extensions.button.prototype.defaults.hasOwnProperty(e)},b.extensions.button=c,b.extensions.button.prototype.defaults={bold:{name:"bold",action:"bold",aria:"bold",tagNames:["b","strong"],style:{prop:"font-weight",value:"700|bold"},useQueryState:!0,contentDefault:"<b>B</b>",contentFA:'<i class="fa fa-bold"></i>'},italic:{name:"italic",action:"italic",aria:"italic",tagNames:["i","em"],style:{prop:"font-style",value:"italic"},useQueryState:!0,contentDefault:"<b><i>I</i></b>",contentFA:'<i class="fa fa-italic"></i>'},underline:{name:"underline",action:"underline",aria:"underline",tagNames:["u"],style:{prop:"text-decoration",value:"underline"},useQueryState:!0,contentDefault:"<b><u>U</u></b>",contentFA:'<i class="fa fa-underline"></i>'},strikethrough:{name:"strikethrough",action:"strikethrough",aria:"strike through",tagNames:["strike"],style:{prop:"text-decoration",value:"line-through"},useQueryState:!0,contentDefault:"<s>A</s>",contentFA:'<i class="fa fa-strikethrough"></i>'},superscript:{name:"superscript",action:"superscript",aria:"superscript",tagNames:["sup"],contentDefault:"<b>x<sup>1</sup></b>",contentFA:'<i class="fa fa-superscript"></i>'},subscript:{name:"subscript",action:"subscript",aria:"subscript",tagNames:["sub"],contentDefault:"<b>x<sub>1</sub></b>",contentFA:'<i class="fa fa-subscript"></i>'},image:{name:"image",action:"image",aria:"image",tagNames:["img"],contentDefault:"<b>image</b>",contentFA:'<i class="fa fa-picture-o"></i>'},html:{name:"html",action:"html",aria:"evaluate html",tagNames:["iframe","object"],contentDefault:"<b>html</b>",contentFA:'<i class="fa fa-code"></i>'},orderedlist:{name:"orderedlist",action:"insertorderedlist",aria:"ordered list",tagNames:["ol"],useQueryState:!0,contentDefault:"<b>1.</b>",contentFA:'<i class="fa fa-list-ol"></i>'},unorderedlist:{name:"unorderedlist",action:"insertunorderedlist",aria:"unordered list",tagNames:["ul"],useQueryState:!0,contentDefault:"<b>•</b>",contentFA:'<i class="fa fa-list-ul"></i>'},indent:{name:"indent",action:"indent",aria:"indent",tagNames:[],contentDefault:"<b>→</b>",contentFA:'<i class="fa fa-indent"></i>'},outdent:{name:"outdent",action:"outdent",aria:"outdent",tagNames:[],contentDefault:"<b>←</b>",contentFA:'<i class="fa fa-outdent"></i>'},justifyCenter:{name:"justifyCenter",action:"justifyCenter",aria:"center justify",tagNames:[],style:{prop:"text-align",value:"center"},contentDefault:"<b>C</b>",contentFA:'<i class="fa fa-align-center"></i>'},justifyFull:{name:"justifyFull",action:"justifyFull",aria:"full justify",tagNames:[],style:{prop:"text-align",value:"justify"},contentDefault:"<b>J</b>",contentFA:'<i class="fa fa-align-justify"></i>'},justifyLeft:{name:"justifyLeft",action:"justifyLeft",aria:"left justify",tagNames:[],style:{prop:"text-align",value:"left"},contentDefault:"<b>L</b>",contentFA:'<i class="fa fa-align-left"></i>'},justifyRight:{name:"justifyRight",action:"justifyRight",aria:"right justify",tagNames:[],style:{prop:"text-align",value:"right"},contentDefault:"<b>R</b>",contentFA:'<i class="fa fa-align-right"></i>'},removeFormat:{name:"removeFormat",aria:"remove formatting",action:"removeFormat",contentDefault:"<b>X</b>",contentFA:'<i class="fa fa-eraser"></i>'},quote:{name:"quote",action:"append-blockquote",aria:"blockquote",tagNames:["blockquote"],contentDefault:"<b>“</b>",contentFA:'<i class="fa fa-quote-right"></i>'},pre:{name:"pre",action:"append-pre",aria:"preformatted text",tagNames:["pre"],contentDefault:"<b>0101</b>",contentFA:'<i class="fa fa-code fa-lg"></i>'},h1:{name:"h1",action:"append-h1",aria:"header type one",tagNames:["h1"],contentDefault:"<b>H1</b>",contentFA:'<i class="fa fa-header"><sup>1</sup>'},h2:{name:"h2",action:"append-h2",aria:"header type two",tagNames:["h2"],contentDefault:"<b>H2</b>",contentFA:'<i class="fa fa-header"><sup>2</sup>'},h3:{name:"h3",action:"append-h3",aria:"header type three",tagNames:["h3"],contentDefault:"<b>H3</b>",contentFA:'<i class="fa fa-header"><sup>3</sup>'},h4:{name:"h4",action:"append-h4",aria:"header type four",tagNames:["h4"],contentDefault:"<b>H4</b>",contentFA:'<i class="fa fa-header"><sup>4</sup>'},h5:{name:"h5",action:"append-h5",aria:"header type five",tagNames:["h5"],contentDefault:"<b>H5</b>",contentFA:'<i class="fa fa-header"><sup>5</sup>'},h6:{name:"h6",action:"append-h6",aria:"header type six",tagNames:["h6"],contentDefault:"<b>H6</b>",contentFA:'<i class="fa fa-header"><sup>6</sup>'}},l=b.extensions.button.extend({init:function(){b.extensions.button.prototype.init.apply(this,arguments)},formSaveLabel:"✓",formCloseLabel:"×",activeClass:"medium-editor-toolbar-form-active",hasForm:!0,getForm:function(){},isDisplayed:function(){return!!this.hasForm&&this.getForm().classList.contains(this.activeClass)},showForm:function(){this.hasForm&&this.getForm().classList.add(this.activeClass)},hideForm:function(){this.hasForm&&this.getForm().classList.remove(this.activeClass)},showToolbarDefaultActions:function(){var e=this.base.getExtensionByName("toolbar");e&&e.showToolbarDefaultActions()},hideToolbarDefaultActions:function(){var e=this.base.getExtensionByName("toolbar");e&&e.hideToolbarDefaultActions()},setToolbarPosition:function(){var e=this.base.getExtensionByName("toolbar");e&&e.setToolbarPosition()}}),b.extensions.form=l,a=b.extensions.form.extend({customClassOption:null,customClassOptionText:"Button",linkValidation:!1,placeholderText:"Paste or type a link",targetCheckbox:!1,targetCheckboxText:"Open in new window",name:"anchor",action:"createLink",aria:"link",tagNames:["a"],contentDefault:"<b>#</b>",contentFA:'<i class="fa fa-link"></i>',init:function(){b.extensions.form.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this))},handleClick:function(e){e.preventDefault(),e.stopPropagation();var t=b.selection.getSelectionRange(this.document);return"a"===t.startContainer.nodeName.toLowerCase()||"a"===t.endContainer.nodeName.toLowerCase()||b.util.getClosestTag(b.selection.getSelectedParentElement(t),"a")?this.execAction("unlink"):(this.isDisplayed()||this.showForm(),!1)},handleKeydown:function(e){b.util.isKey(e,b.util.keyCode.K)&&b.util.isMetaCtrlKey(e)&&!e.shiftKey&&this.handleClick(e)},getForm:function(){return this.form||(this.form=this.createForm()),this.form},getTemplate:function(){var e=['<input type="text" class="medium-editor-toolbar-input" placeholder="',this.placeholderText,'">'];return e.push('<a href="#" class="medium-editor-toolbar-save">',"fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':this.formSaveLabel,"</a>"),e.push('<a href="#" class="medium-editor-toolbar-close">',"fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':this.formCloseLabel,"</a>"),this.targetCheckbox&&e.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-target" id="medium-editor-toolbar-anchor-target-field-'+this.getEditorId()+'">','<label for="medium-editor-toolbar-anchor-target-field-'+this.getEditorId()+'">',this.targetCheckboxText,"</label>","</div>"),this.customClassOption&&e.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-button">',"<label>",this.customClassOptionText,"</label>","</div>"),e.join("")},isDisplayed:function(){return b.extensions.form.prototype.isDisplayed.apply(this)},hideForm:function(){b.extensions.form.prototype.hideForm.apply(this),this.getInput().value=""},showForm:function(e){var t=this.getInput(),n=this.getAnchorTargetCheckbox(),i=this.getAnchorButtonCheckbox();if("string"==typeof(e=e||{value:""})&&(e={value:e}),this.base.saveSelection(),this.hideToolbarDefaultActions(),b.extensions.form.prototype.showForm.apply(this),this.setToolbarPosition(),t.value=e.value,t.focus(),n&&(n.checked="_blank"===e.target),i){var o=e.buttonClass?e.buttonClass.split(" "):[];i.checked=-1!==o.indexOf(this.customClassOption)}},destroy:function(){return!!this.form&&(this.form.parentNode&&this.form.parentNode.removeChild(this.form),void delete this.form)},getFormOpts:function(){var e=this.getAnchorTargetCheckbox(),t=this.getAnchorButtonCheckbox(),n={value:this.getInput().value.trim()};return this.linkValidation&&(n.value=this.checkLinkFormat(n.value)),n.target="_self",e&&e.checked&&(n.target="_blank"),t&&t.checked&&(n.buttonClass=this.customClassOption),n},doFormSave:function(){var e=this.getFormOpts();this.completeFormSave(e)},completeFormSave:function(e){this.base.restoreSelection(),this.execAction(this.action,e),this.base.checkSelection()},ensureEncodedUri:function(e){return e===decodeURI(e)?encodeURI(e):e},ensureEncodedUriComponent:function(e){return e===decodeURIComponent(e)?encodeURIComponent(e):e},ensureEncodedParam:function(e){var t=e.split("="),n=t[0],i=t[1];return n+(void 0===i?"":"="+this.ensureEncodedUriComponent(i))},ensureEncodedQuery:function(e){return e.split("&").map(this.ensureEncodedParam.bind(this)).join("&")},checkLinkFormat:function(e){var t=/^([a-z]+:)?\/\/|^(mailto|tel|maps):|^\#/i.test(e),n="",i=e.match(/^(.*?)(?:\?(.*?))?(?:#(.*))?$/),o=i[1],s=i[2],r=i[3];if(/^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/.test(e))return"tel:"+e;if(!t){var a=o.split("/")[0];(a.match(/.+(\.|:).+/)||"localhost"===a)&&(n="http://")}return n+this.ensureEncodedUri(o)+(void 0===s?"":"?"+this.ensureEncodedQuery(s))+(void 0===r?"":"#"+r)},doFormCancel:function(){this.base.restoreSelection(),this.base.checkSelection()},attachFormEvents:function(e){var t=e.querySelector(".medium-editor-toolbar-close"),n=e.querySelector(".medium-editor-toolbar-save"),i=e.querySelector(".medium-editor-toolbar-input");this.on(e,"click",this.handleFormClick.bind(this)),this.on(i,"keyup",this.handleTextboxKeyup.bind(this)),this.on(t,"click",this.handleCloseClick.bind(this)),this.on(n,"click",this.handleSaveClick.bind(this),!0)},createForm:function(){var e=this.document.createElement("div");return e.className="medium-editor-toolbar-form",e.id="medium-editor-toolbar-form-anchor-"+this.getEditorId(),e.innerHTML=this.getTemplate(),this.attachFormEvents(e),e},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},getAnchorTargetCheckbox:function(){return this.getForm().querySelector(".medium-editor-toolbar-anchor-target")},getAnchorButtonCheckbox:function(){return this.getForm().querySelector(".medium-editor-toolbar-anchor-button")},handleTextboxKeyup:function(e){return e.keyCode===b.util.keyCode.ENTER?(e.preventDefault(),void this.doFormSave()):void(e.keyCode===b.util.keyCode.ESCAPE&&(e.preventDefault(),this.doFormCancel()))},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),b.extensions.anchor=a,r=b.Extension.extend({name:"anchor-preview",hideDelay:500,previewValueSelector:"a",showWhenToolbarIsVisible:!1,showOnEmptyLinks:!0,init:function(){this.anchorPreview=this.createPreview(),this.getEditorOption("elementsContainer").appendChild(this.anchorPreview),this.attachToEditables()},getInteractionElements:function(){return this.getPreviewElement()},getPreviewElement:function(){return this.anchorPreview},createPreview:function(){var e=this.document.createElement("div");return e.id="medium-editor-anchor-preview-"+this.getEditorId(),e.className="medium-editor-anchor-preview",e.innerHTML=this.getTemplate(),this.on(e,"click",this.handleClick.bind(this)),e},getTemplate:function(){return'<div class="medium-editor-toolbar-anchor-preview" id="medium-editor-toolbar-anchor-preview"> <a class="medium-editor-toolbar-anchor-preview-inner"></a></div>'},destroy:function(){this.anchorPreview&&(this.anchorPreview.parentNode&&this.anchorPreview.parentNode.removeChild(this.anchorPreview),delete this.anchorPreview)},hidePreview:function(){this.anchorPreview&&this.anchorPreview.classList.remove("medium-editor-anchor-preview-active"),this.activeAnchor=null},showPreview:function(e){return!(!this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")&&!e.getAttribute("data-disable-preview"))||(this.previewValueSelector&&(this.anchorPreview.querySelector(this.previewValueSelector).textContent=e.attributes.href.value,this.anchorPreview.querySelector(this.previewValueSelector).href=e.attributes.href.value),this.anchorPreview.classList.add("medium-toolbar-arrow-over"),this.anchorPreview.classList.remove("medium-toolbar-arrow-under"),this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")||this.anchorPreview.classList.add("medium-editor-anchor-preview-active"),this.activeAnchor=e,this.positionPreview(),this.attachPreviewHandlers(),this)},positionPreview:function(e){e=e||this.activeAnchor;var t,n,i,o,s,r=this.window.innerWidth,a=this.anchorPreview.offsetHeight,l=e.getBoundingClientRect(),c=this.diffLeft,d=this.diffTop,u=this.getEditorOption("elementsContainer"),h=-1<["absolute","fixed"].indexOf(window.getComputedStyle(u).getPropertyValue("position")),m={};t=this.anchorPreview.offsetWidth/2;var f=this.base.getExtensionByName("toolbar");f&&(c=f.diffLeft,d=f.diffTop),n=c-t,h?(o=u.getBoundingClientRect(),["top","left"].forEach(function(e){m[e]=l[e]-o[e]}),m.width=l.width,m.height=l.height,l=m,r=o.width,s=u.scrollTop):s=this.window.pageYOffset,i=l.left+l.width/2,s+=a+l.top+l.height-d-this.anchorPreview.offsetHeight,this.anchorPreview.style.top=Math.round(s)+"px",this.anchorPreview.style.right="initial",i<t?(this.anchorPreview.style.left=n+t+"px",this.anchorPreview.style.right="initial"):r-i<t?(this.anchorPreview.style.left="auto",this.anchorPreview.style.right=0):(this.anchorPreview.style.left=n+i+"px",this.anchorPreview.style.right="initial")},attachToEditables:function(){this.subscribe("editableMouseover",this.handleEditableMouseover.bind(this)),this.subscribe("positionedToolbar",this.handlePositionedToolbar.bind(this))},handlePositionedToolbar:function(){this.showWhenToolbarIsVisible||this.hidePreview()},handleClick:function(e){var t=this.base.getExtensionByName("anchor"),n=this.activeAnchor;t&&n&&(e.preventDefault(),this.base.selectElement(this.activeAnchor),this.base.delay(function(){if(n){var e={value:n.attributes.href.value,target:n.getAttribute("target"),buttonClass:n.getAttribute("class")};t.showForm(e),n=null}}.bind(this))),this.hidePreview()},handleAnchorMouseout:function(){this.anchorToPreview=null,this.off(this.activeAnchor,"mouseout",this.instanceHandleAnchorMouseout),this.instanceHandleAnchorMouseout=null},handleEditableMouseover:function(e){var t=b.util.getClosestTag(e.target,"a");if(!1!==t){if(!this.showOnEmptyLinks&&(!/href=["']\S+["']/.test(t.outerHTML)||/href=["']#\S+["']/.test(t.outerHTML)))return!0;var n=this.base.getExtensionByName("toolbar");if(!this.showWhenToolbarIsVisible&&n&&n.isDisplayed&&n.isDisplayed())return!0;this.activeAnchor&&this.activeAnchor!==t&&this.detachPreviewHandlers(),this.anchorToPreview=t,this.instanceHandleAnchorMouseout=this.handleAnchorMouseout.bind(this),this.on(this.anchorToPreview,"mouseout",this.instanceHandleAnchorMouseout),this.base.delay(function(){this.anchorToPreview&&this.showPreview(this.anchorToPreview)}.bind(this))}},handlePreviewMouseover:function(){this.lastOver=(new Date).getTime(),this.hovering=!0},handlePreviewMouseout:function(e){e.relatedTarget&&/anchor-preview/.test(e.relatedTarget.className)||(this.hovering=!1)},updatePreview:function(){if(this.hovering)return!0;(new Date).getTime()-this.lastOver>this.hideDelay&&this.detachPreviewHandlers()},detachPreviewHandlers:function(){clearInterval(this.intervalTimer),this.instanceHandlePreviewMouseover&&(this.off(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.activeAnchor&&(this.off(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout))),this.hidePreview(),this.hovering=this.instanceHandlePreviewMouseover=this.instanceHandlePreviewMouseout=null},attachPreviewHandlers:function(){this.lastOver=(new Date).getTime(),this.hovering=!0,this.instanceHandlePreviewMouseover=this.handlePreviewMouseover.bind(this),this.instanceHandlePreviewMouseout=this.handlePreviewMouseout.bind(this),this.intervalTimer=setInterval(this.updatePreview.bind(this),200),this.on(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.on(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout)}}),b.extensions.anchorPreview=r,function(){var s,e,r,a;s=[" ","\t","\n","\r"," "," "," "," "," ","\u2028","\u2029"],e="com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw",r=new RegExp("^("+e+")$","i"),a=new RegExp("(((?:(https?://|ftps?://|nntp://)|www\\d{0,3}[.]|[a-z0-9.\\-]+[.](com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)\\/)\\S+(?:[^\\s`!\\[\\]{};:'\".,?«»“”‘’])))|(([a-z0-9\\-]+\\.)?[a-z0-9\\-]+\\.(com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw))","gi");var t=b.Extension.extend({init:function(){b.Extension.prototype.init.apply(this,arguments),this.disableEventHandling=!1,this.subscribe("editableKeypress",this.onKeypress.bind(this)),this.subscribe("editableBlur",this.onBlur.bind(this)),this.document.execCommand("AutoUrlDetect",!1,!1)},isLastInstance:function(){for(var e=0,t=0;t<this.window._mediumEditors.length;t++){var n=this.window._mediumEditors[t];null!==n&&void 0!==n.getExtensionByName("autoLink")&&e++}return 1===e},destroy:function(){this.document.queryCommandSupported("AutoUrlDetect")&&this.isLastInstance()&&this.document.execCommand("AutoUrlDetect",!1,!0)},onBlur:function(e,t){this.performLinking(t)},onKeypress:function(t){this.disableEventHandling||b.util.isKey(t,[b.util.keyCode.SPACE,b.util.keyCode.ENTER])&&(clearTimeout(this.performLinkingTimeout),this.performLinkingTimeout=setTimeout(function(){try{var e=this.base.exportSelection();this.performLinking(t.target)&&this.base.importSelection(e,!0)}catch(e){window.console&&window.console.error("Failed to perform linking",e),this.disableEventHandling=!0}}.bind(this),0))},performLinking:function(e){var t=b.util.splitByBlockElements(e),n=!1;0===t.length&&(t=[e]);for(var i=0;i<t.length;i++)n=this.removeObsoleteAutoLinkSpans(t[i])||n,n=this.performLinkingWithinElement(t[i])||n;return this.base.events.updateInput(e,{target:e,currentTarget:e}),n},removeObsoleteAutoLinkSpans:function(e){if(!e||3===e.nodeType)return!1;for(var t=e.querySelectorAll('span[data-auto-link="true"]'),n=!1,i=0;i<t.length;i++){var o=t[i].textContent;if(-1===o.indexOf("://")&&(o=b.util.ensureUrlHasProtocol(o)),t[i].getAttribute("data-href")!==o&&(l=t[i],!b.util.getClosestTag(l,"a"))){n=!0;var s=o.replace(/\s+$/,"");if(t[i].getAttribute("data-href")===s){var r=o.length-s.length,a=b.util.splitOffDOMTree(t[i],this.splitTextBeforeEnd(t[i],r));t[i].parentNode.insertBefore(a,t[i].nextSibling)}else b.util.unwrap(t[i],this.document)}}var l;return n},splitTextBeforeEnd:function(e,t){for(var n=this.document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),i=!0;i;)i=null!==n.lastChild();for(var o,s,r;0<t&&null!==r;)(s=(o=n.currentNode).nodeValue).length>t?(r=o.splitText(s.length-t),t=0):(r=n.previousNode(),t-=s.length);return r},performLinkingWithinElement:function(e){for(var t=this.findLinkableText(e),n=0;n<t.length;n++){var i=b.util.findOrCreateMatchingTextNodes(this.document,e,t[n]);this.shouldNotLink(i)||this.createAutoLink(i,t[n].href)}return!1},shouldNotLink:function(e){for(var t=!1,n=0;n<e.length&&!1===t;n++)t=!!b.util.traverseUp(e[n],function(e){return"a"===e.nodeName.toLowerCase()||e.getAttribute&&"true"===e.getAttribute("data-auto-link")});return t},findLinkableText:function(e){for(var t=e.textContent,n=null,i=[];null!==(n=a.exec(t));){var o=n.index+n[0].length;!(0!==n.index&&-1===s.indexOf(t[n.index-1])||o!==t.length&&-1===s.indexOf(t[o]))&&(-1!==n[0].indexOf("/")||r.test(n[0].split(".").pop().split("?").shift()))&&i.push({href:n[0],start:n.index,end:o})}return i},createAutoLink:function(e,t){t=b.util.ensureUrlHasProtocol(t);var n=b.util.createLink(this.document,e,t,this.getEditorOption("targetBlank")?"_blank":null),i=this.document.createElement("span");for(i.setAttribute("data-auto-link","true"),i.setAttribute("data-href",t),n.insertBefore(i,n.firstChild);1<n.childNodes.length;)i.appendChild(n.childNodes[1])}});b.extensions.autoLink=t}(),function(){function n(e){var t=b.util.getContainerEditorElement(e);Array.prototype.slice.call(t.parentElement.querySelectorAll("."+i)).forEach(function(e){e.classList.remove(i)})}var i="medium-editor-dragover",e=b.Extension.extend({name:"fileDragging",allowedTypes:["image"],init:function(){b.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(e){e.preventDefault(),e.dataTransfer.dropEffect="copy";var t=e.target.classList?e.target:e.target.parentElement;n(t),"dragover"===e.type&&t.classList.add(i)},handleDrop:function(e){e.preventDefault(),e.stopPropagation(),this.base.selectElement(e.target);var t=this.base.exportSelection();t.start=t.end,this.base.importSelection(t),e.dataTransfer.files&&Array.prototype.slice.call(e.dataTransfer.files).forEach(function(e){this.isAllowedFile(e)&&e.type.match("image")&&this.insertImageFile(e)},this),n(e.target)},isAllowedFile:function(t){return this.allowedTypes.some(function(e){return!!t.type.match(e)})},insertImageFile:function(e){if("function"==typeof FileReader){var t=new FileReader;t.readAsDataURL(e),t.addEventListener("load",function(e){var t=this.document.createElement("img");t.src=e.target.result,b.util.insertHTMLCommand(this.document,t.outerHTML)}.bind(this))}}});b.extensions.fileDragging=e}(),s=b.Extension.extend({name:"keyboard-commands",commands:[{command:"bold",key:"B",meta:!0,shift:!1,alt:!1},{command:"italic",key:"I",meta:!0,shift:!1,alt:!1},{command:"underline",key:"U",meta:!0,shift:!1,alt:!1}],init:function(){b.Extension.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.keys={},this.commands.forEach(function(e){var t=e.key.charCodeAt(0);this.keys[t]||(this.keys[t]=[]),this.keys[t].push(e)},this)},handleKeydown:function(t){var e=b.util.getKeyCode(t);if(this.keys[e]){var n=b.util.isMetaCtrlKey(t),i=!!t.shiftKey,o=!!t.altKey;this.keys[e].forEach(function(e){e.meta!==n||e.shift!==i||e.alt!==o&&void 0!==e.alt||(t.preventDefault(),t.stopPropagation(),"function"==typeof e.command?e.command.apply(this):!1!==e.command&&this.execAction(e.command))},this)}}}),b.extensions.keyboardCommands=s,o=b.extensions.form.extend({name:"fontname",action:"fontName",aria:"change font name",contentDefault:"±",contentFA:'<i class="fa fa-font"></i>',fonts:["","Arial","Verdana","Times New Roman"],init:function(){b.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(e){if(e.preventDefault(),e.stopPropagation(),!this.isDisplayed()){var t=this.document.queryCommandValue("fontName")+"";this.showForm(t)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getSelect().value=""},showForm:function(e){var t=this.getSelect();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),t.value=e||"",t.focus()},destroy:function(){return!!this.form&&(this.form.parentNode&&this.form.parentNode.removeChild(this.form),void delete this.form)},doFormSave:function(){this.base.restoreSelection(),this.base.checkSelection()},doFormCancel:function(){this.base.restoreSelection(),this.clearFontName(),this.base.checkSelection()},createForm:function(){var e,t=this.document,n=t.createElement("div"),i=t.createElement("select"),o=t.createElement("a"),s=t.createElement("a");n.className="medium-editor-toolbar-form",n.id="medium-editor-toolbar-form-fontname-"+this.getEditorId(),this.on(n,"click",this.handleFormClick.bind(this));for(var r=0;r<this.fonts.length;r++)(e=t.createElement("option")).innerHTML=this.fonts[r],e.value=this.fonts[r],i.appendChild(e);return i.className="medium-editor-toolbar-select",n.appendChild(i),this.on(i,"change",this.handleFontChange.bind(this)),s.setAttribute("href","#"),s.className="medium-editor-toobar-save",s.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"✓",n.appendChild(s),this.on(s,"click",this.handleSaveClick.bind(this),!0),o.setAttribute("href","#"),o.className="medium-editor-toobar-close",o.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':"×",n.appendChild(o),this.on(o,"click",this.handleCloseClick.bind(this)),n},getSelect:function(){return this.getForm().querySelector("select.medium-editor-toolbar-select")},clearFontName:function(){b.selection.getSelectedElements(this.document).forEach(function(e){"font"===e.nodeName.toLowerCase()&&e.hasAttribute("face")&&e.removeAttribute("face")})},handleFontChange:function(){var e=this.getSelect().value;""===e?this.clearFontName():this.execAction("fontName",{value:e})},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),b.extensions.fontName=o,i=b.extensions.form.extend({name:"fontsize",action:"fontSize",aria:"increase/decrease font size",contentDefault:"±",contentFA:'<i class="fa fa-text-height"></i>',init:function(){b.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(e){if(e.preventDefault(),e.stopPropagation(),!this.isDisplayed()){var t=this.document.queryCommandValue("fontSize")+"";this.showForm(t)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getInput().value=""},showForm:function(e){var t=this.getInput();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),t.value=e||"",t.focus()},destroy:function(){return!!this.form&&(this.form.parentNode&&this.form.parentNode.removeChild(this.form),void delete this.form)},doFormSave:function(){this.base.restoreSelection(),this.base.checkSelection()},doFormCancel:function(){this.base.restoreSelection(),this.clearFontSize(),this.base.checkSelection()},createForm:function(){var e=this.document,t=e.createElement("div"),n=e.createElement("input"),i=e.createElement("a"),o=e.createElement("a");return t.className="medium-editor-toolbar-form",t.id="medium-editor-toolbar-form-fontsize-"+this.getEditorId(),this.on(t,"click",this.handleFormClick.bind(this)),n.setAttribute("type","range"),n.setAttribute("min","1"),n.setAttribute("max","7"),n.className="medium-editor-toolbar-input",t.appendChild(n),this.on(n,"change",this.handleSliderChange.bind(this)),o.setAttribute("href","#"),o.className="medium-editor-toobar-save",o.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"✓",t.appendChild(o),this.on(o,"click",this.handleSaveClick.bind(this),!0),i.setAttribute("href","#"),i.className="medium-editor-toobar-close",i.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':"×",t.appendChild(i),this.on(i,"click",this.handleCloseClick.bind(this)),t},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},clearFontSize:function(){b.selection.getSelectedElements(this.document).forEach(function(e){"font"===e.nodeName.toLowerCase()&&e.hasAttribute("size")&&e.removeAttribute("size")})},handleSliderChange:function(){var e=this.getInput().value;"4"===e?this.clearFontSize():this.execAction("fontSize",{value:e})},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),b.extensions.fontSize=i,function(){function s(e,t,n){var i=e.clipboardData||t.clipboardData||n.dataTransfer,o={};if(!i)return o;if(i.getData){var s=i.getData("Text");s&&0<s.length&&(o["text/plain"]=s)}if(i.types)for(var r=0;r<i.types.length;r++){var a=i.types[r];o[a]=i.getData(a)}return o}var r="%ME_PASTEBIN%",a=null,l=null,c=function(e){e.stopPropagation()},e=b.Extension.extend({forcePlainText:!0,cleanPastedHTML:!1,preCleanReplacements:[],cleanReplacements:[],cleanAttrs:["class","style","dir"],cleanTags:["meta"],unwrapTags:[],init:function(){b.Extension.prototype.init.apply(this,arguments),(this.forcePlainText||this.cleanPastedHTML)&&(this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.getEditorElements().forEach(function(e){this.on(e,"paste",this.handlePaste.bind(this))},this),this.subscribe("addElement",this.handleAddElement.bind(this)))},handleAddElement:function(e,t){this.on(t,"paste",this.handlePaste.bind(this))},destroy:function(){(this.forcePlainText||this.cleanPastedHTML)&&this.removePasteBin()},handlePaste:function(e,t){if(!e.defaultPrevented){var n=s(e,this.window,this.document),i=n["text/html"],o=n["text/plain"];this.window.clipboardData&&void 0===e.clipboardData&&!i&&(i=o),(i||o)&&(e.preventDefault(),this.doPaste(i,o,t))}},doPaste:function(e,t,n){var i,o,s="";if(this.cleanPastedHTML&&e)return this.cleanPaste(e);if(t){if(this.getEditorOption("disableReturn")||n&&n.getAttribute("data-disable-return"))s=b.util.htmlEntities(t);else if(1<(i=t.split(/[\r\n]+/g)).length)for(o=0;o<i.length;o+=1)""!==i[o]&&(s+="<p>"+b.util.htmlEntities(i[o])+"</p>");else s=b.util.htmlEntities(i[0]);b.util.insertHTMLCommand(this.document,s)}},handlePasteBinPaste:function(e){if(!e.defaultPrevented){var t=s(e,this.window,this.document),n=t["text/html"],i=t["text/plain"],o=l;return!this.cleanPastedHTML||n?(e.preventDefault(),this.removePasteBin(),this.doPaste(n,i,o),void this.trigger("editablePaste",{currentTarget:o,target:o},o)):void setTimeout(function(){this.cleanPastedHTML&&(n=this.getPasteBinHtml()),this.removePasteBin(),this.doPaste(n,i,o),this.trigger("editablePaste",{currentTarget:o,target:o},o)}.bind(this),0)}this.removePasteBin()},handleKeydown:function(e,t){b.util.isKey(e,b.util.keyCode.V)&&b.util.isMetaCtrlKey(e)&&(e.stopImmediatePropagation(),this.removePasteBin(),this.createPasteBin(t))},createPasteBin:function(e){var t,n=b.selection.getSelectionRange(this.document),i=this.window.pageYOffset;l=e,n&&(i+=(t=n.getClientRects()).length?t[0].top:void 0!==n.startContainer.getBoundingClientRect?n.startContainer.getBoundingClientRect().top:n.getBoundingClientRect().top),a=n;var o=this.document.createElement("div");o.id=this.pasteBinId="medium-editor-pastebin-"+ +Date.now(),o.setAttribute("style","border: 1px red solid; position: absolute; top: "+i+"px; width: 10px; height: 10px; overflow: hidden; opacity: 0"),o.setAttribute("contentEditable",!0),o.innerHTML=r,this.document.body.appendChild(o),this.on(o,"focus",c),this.on(o,"focusin",c),this.on(o,"focusout",c),o.focus(),b.selection.selectNode(o,this.document),this.boundHandlePaste||(this.boundHandlePaste=this.handlePasteBinPaste.bind(this)),this.on(o,"paste",this.boundHandlePaste)},removePasteBin:function(){null!==a&&(b.selection.selectRange(this.document,a),a=null),null!==l&&(l=null);var e=this.getPasteBin();e&&e&&(this.off(e,"focus",c),this.off(e,"focusin",c),this.off(e,"focusout",c),this.off(e,"paste",this.boundHandlePaste),e.parentElement.removeChild(e))},getPasteBin:function(){return this.document.getElementById(this.pasteBinId)},getPasteBinHtml:function(){var e=this.getPasteBin();if(!e)return!1;if(e.firstChild&&"mcepastebin"===e.firstChild.id)return!1;var t=e.innerHTML;return!(!t||t===r)&&t},cleanPaste:function(e){var t,n,i,o,s=/<p|<br|<div/.test(e),r=[].concat(this.preCleanReplacements||[],[[new RegExp(/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g),""],[new RegExp(/<!--StartFragment-->|<!--EndFragment-->/g),""],[new RegExp(/<br>$/i),""],[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi),""],[new RegExp(/<\/b>(<br[^>]*>)?$/gi),""],[new RegExp(/<span class="Apple-converted-space">\s+<\/span>/g)," "],[new RegExp(/<br class="Apple-interchange-newline">/g),"<br>"],[new RegExp(/<span[^>]*(font-style:italic;font-weight:(bold|700)|font-weight:(bold|700);font-style:italic)[^>]*>/gi),'<span class="replace-with italic bold">'],[new RegExp(/<span[^>]*font-style:italic[^>]*>/gi),'<span class="replace-with italic">'],[new RegExp(/<span[^>]*font-weight:(bold|700)[^>]*>/gi),'<span class="replace-with bold">'],[new RegExp(/<(\/?)(i|b|a)>/gi),"<$1$2>"],[new RegExp(/<a(?:(?!href).)+href=(?:"|”|“|"|“|”)(((?!"|”|“|"|“|”).)*)(?:"|”|“|"|“|”)(?:(?!>).)*>/gi),'<a href="$1">'],[new RegExp(/<\/p>\n+/gi),"</p>"],[new RegExp(/\n+<p/gi),"<p"],[new RegExp(/<\/?o:[a-z]*>/gi),""],[new RegExp(/<!\[if !supportLists\]>(((?!<!).)*)<!\[endif]\>/gi),"$1"]],this.cleanReplacements||[]);for(t=0;t<r.length;t+=1)e=e.replace(r[t][0],r[t][1]);if(!s)return this.pasteHTML(e);for((i=this.document.createElement("div")).innerHTML="<p>"+e.split("<br><br>").join("</p><p>")+"</p>",n=i.querySelectorAll("a,p,div,br"),t=0;t<n.length;t+=1)switch(o=n[t],o.innerHTML=o.innerHTML.replace(/\n/gi," "),o.nodeName.toLowerCase()){case"p":case"div":this.filterCommonBlocks(o);break;case"br":this.filterLineBreak(o)}this.pasteHTML(i.innerHTML)},pasteHTML:function(e,t){t=b.util.defaults({},t,{cleanAttrs:this.cleanAttrs,cleanTags:this.cleanTags,unwrapTags:this.unwrapTags});var n,i,o,s,r=this.document.createDocumentFragment();for(r.appendChild(this.document.createElement("body")),(s=r.querySelector("body")).innerHTML=e,this.cleanupSpans(s),n=s.querySelectorAll("*"),o=0;o<n.length;o+=1)"a"===(i=n[o]).nodeName.toLowerCase()&&this.getEditorOption("targetBlank")&&b.util.setTargetBlank(i),b.util.cleanupAttrs(i,t.cleanAttrs),b.util.cleanupTags(i,t.cleanTags),b.util.unwrapTags(i,t.unwrapTags);b.util.insertHTMLCommand(this.document,s.innerHTML.replace(/ /g," "))},isCommonBlock:function(e){return e&&("p"===e.nodeName.toLowerCase()||"div"===e.nodeName.toLowerCase())},filterCommonBlocks:function(e){/^\s*$/.test(e.textContent)&&e.parentNode&&e.parentNode.removeChild(e)},filterLineBreak:function(e){this.isCommonBlock(e.previousElementSibling)?this.removeWithParent(e):!this.isCommonBlock(e.parentNode)||e.parentNode.firstChild!==e&&e.parentNode.lastChild!==e?e.parentNode&&1===e.parentNode.childElementCount&&""===e.parentNode.textContent&&this.removeWithParent(e):this.removeWithParent(e)},removeWithParent:function(e){e&&e.parentNode&&(e.parentNode.parentNode&&1===e.parentNode.childElementCount?e.parentNode.parentNode.removeChild(e.parentNode):e.parentNode.removeChild(e))},cleanupSpans:function(e){var t,n,i,o=e.querySelectorAll(".replace-with"),s=function(e){return e&&"#text"!==e.nodeName&&"false"===e.getAttribute("contenteditable")};for(t=0;t<o.length;t+=1)n=o[t],i=this.document.createElement(n.classList.contains("bold")?"b":"i"),n.classList.contains("bold")&&n.classList.contains("italic")?i.innerHTML="<i>"+n.innerHTML+"</i>":i.innerHTML=n.innerHTML,n.parentNode.replaceChild(i,n);for(o=e.querySelectorAll("span"),t=0;t<o.length;t+=1){if(n=o[t],b.util.traverseUp(n,s))return!1;b.util.unwrap(n,this.document)}}});b.extensions.paste=e}(),n=b.Extension.extend({name:"placeholder",text:"Type your text",hideOnClick:!0,init:function(){b.Extension.prototype.init.apply(this,arguments),this.initPlaceholders(),this.attachEventHandlers()},initPlaceholders:function(){this.getEditorElements().forEach(this.initElement,this)},handleAddElement:function(e,t){this.initElement(t)},initElement:function(e){e.getAttribute("data-placeholder")||e.setAttribute("data-placeholder",this.text),this.updatePlaceholder(e)},destroy:function(){this.getEditorElements().forEach(this.cleanupElement,this)},handleRemoveElement:function(e,t){this.cleanupElement(t)},cleanupElement:function(e){e.getAttribute("data-placeholder")===this.text&&e.removeAttribute("data-placeholder")},showPlaceholder:function(e){e&&(b.util.isFF&&0===e.childNodes.length?(e.classList.add("medium-editor-placeholder-relative"),e.classList.remove("medium-editor-placeholder")):(e.classList.add("medium-editor-placeholder"),e.classList.remove("medium-editor-placeholder-relative")))},hidePlaceholder:function(e){e&&(e.classList.remove("medium-editor-placeholder"),e.classList.remove("medium-editor-placeholder-relative"))},updatePlaceholder:function(e,t){return e.querySelector("img, blockquote, ul, ol, table")||""!==e.textContent.replace(/^\s+|\s+$/g,"")?this.hidePlaceholder(e):void(t||this.showPlaceholder(e))},attachEventHandlers:function(){this.hideOnClick&&this.subscribe("focus",this.handleFocus.bind(this)),this.subscribe("editableInput",this.handleInput.bind(this)),this.subscribe("blur",this.handleBlur.bind(this)),this.subscribe("addElement",this.handleAddElement.bind(this)),this.subscribe("removeElement",this.handleRemoveElement.bind(this))},handleInput:function(e,t){var n=this.hideOnClick&&t===this.base.getFocusedElement();this.updatePlaceholder(t,n)},handleFocus:function(e,t){this.hidePlaceholder(t)},handleBlur:function(e,t){this.updatePlaceholder(t)}}),b.extensions.placeholder=n,t=b.Extension.extend({name:"toolbar",align:"center",allowMultiParagraphSelection:!0,buttons:["bold","italic","underline","anchor","h2","h3","quote"],diffLeft:0,diffTop:-10,firstButtonClass:"medium-editor-button-first",lastButtonClass:"medium-editor-button-last",standardizeSelectionStart:!1,static:!1,sticky:!1,stickyTopOffset:0,updateOnEmptySelection:!1,relativeContainer:null,init:function(){b.Extension.prototype.init.apply(this,arguments),this.initThrottledMethods(),this.relativeContainer?this.relativeContainer.appendChild(this.getToolbarElement()):this.getEditorOption("elementsContainer").appendChild(this.getToolbarElement())},forEachExtension:function(t,n){return this.base.extensions.forEach(function(e){return e!==this?t.apply(n||this,arguments):void 0},this)},createToolbar:function(){var t=this.document.createElement("div");return t.id="medium-editor-toolbar-"+this.getEditorId(),t.className="medium-editor-toolbar",this.static?t.className+=" static-toolbar":this.relativeContainer?t.className+=" medium-editor-relative-toolbar":t.className+=" medium-editor-stalker-toolbar",t.appendChild(this.createToolbarButtons()),this.forEachExtension(function(e){e.hasForm&&t.appendChild(e.getForm())}),this.attachEventHandlers(),t},createToolbarButtons:function(){var t,n,e,i,o,s,r=this.document.createElement("ul");return r.id="medium-editor-toolbar-actions"+this.getEditorId(),r.className="medium-editor-toolbar-actions",r.style.display="block",this.buttons.forEach(function(e){"string"==typeof e?(o=e,s=null):(o=e.name,s=e),(i=this.base.addBuiltInExtension(o,s))&&"function"==typeof i.getButton&&(n=i.getButton(this.base),t=this.document.createElement("li"),b.util.isElement(n)?t.appendChild(n):t.innerHTML=n,r.appendChild(t))},this),0<(e=r.querySelectorAll("button")).length&&(e[0].classList.add(this.firstButtonClass),e[e.length-1].classList.add(this.lastButtonClass)),r},destroy:function(){this.toolbar&&(this.toolbar.parentNode&&this.toolbar.parentNode.removeChild(this.toolbar),delete this.toolbar)},getInteractionElements:function(){return this.getToolbarElement()},getToolbarElement:function(){return this.toolbar||(this.toolbar=this.createToolbar()),this.toolbar},getToolbarActionsElement:function(){return this.getToolbarElement().querySelector(".medium-editor-toolbar-actions")},initThrottledMethods:function(){this.throttledPositionToolbar=b.util.throttle(function(){this.base.isActive&&this.positionToolbarIfShown()}.bind(this))},attachEventHandlers:function(){this.subscribe("blur",this.handleBlur.bind(this)),this.subscribe("focus",this.handleFocus.bind(this)),this.subscribe("editableClick",this.handleEditableClick.bind(this)),this.subscribe("editableKeyup",this.handleEditableKeyup.bind(this)),this.on(this.document.documentElement,"mouseup",this.handleDocumentMouseup.bind(this)),this.static&&this.sticky&&this.on(this.window,"scroll",this.handleWindowScroll.bind(this),!0),this.on(this.window,"resize",this.handleWindowResize.bind(this))},handleWindowScroll:function(){this.positionToolbarIfShown()},handleWindowResize:function(){this.throttledPositionToolbar()},handleDocumentMouseup:function(e){return!(e&&e.target&&b.util.isDescendant(this.getToolbarElement(),e.target))&&void this.checkState()},handleEditableClick:function(){setTimeout(function(){this.checkState()}.bind(this),0)},handleEditableKeyup:function(){this.checkState()},handleBlur:function(){clearTimeout(this.hideTimeout),clearTimeout(this.delayShowTimeout),this.hideTimeout=setTimeout(function(){this.hideToolbar()}.bind(this),1)},handleFocus:function(){this.checkState()},isDisplayed:function(){return this.getToolbarElement().classList.contains("medium-editor-toolbar-active")},showToolbar:function(){clearTimeout(this.hideTimeout),this.isDisplayed()||(this.getToolbarElement().classList.add("medium-editor-toolbar-active"),this.trigger("showToolbar",{},this.base.getFocusedElement()))},hideToolbar:function(){this.isDisplayed()&&(this.getToolbarElement().classList.remove("medium-editor-toolbar-active"),this.trigger("hideToolbar",{},this.base.getFocusedElement()))},isToolbarDefaultActionsDisplayed:function(){return"block"===this.getToolbarActionsElement().style.display},hideToolbarDefaultActions:function(){this.isToolbarDefaultActionsDisplayed()&&(this.getToolbarActionsElement().style.display="none")},showToolbarDefaultActions:function(){this.hideExtensionForms(),this.isToolbarDefaultActionsDisplayed()||(this.getToolbarActionsElement().style.display="block"),this.delayShowTimeout=this.base.delay(function(){this.showToolbar()}.bind(this))},hideExtensionForms:function(){this.forEachExtension(function(e){e.hasForm&&e.isDisplayed()&&e.hideForm()})},multipleBlockElementsSelected:function(){var e=new RegExp("<("+b.util.blockContainerElementNames.join("|")+")[^>]*>","g"),t=b.selection.getSelectionHtml(this.document).replace(/<[^\/>][^>]*><\/[^>]+>/gim,"").match(e);return!!t&&1<t.length},modifySelection:function(){var e=this.window.getSelection().getRangeAt(0);if(this.standardizeSelectionStart&&e.startContainer.nodeValue&&e.startOffset===e.startContainer.nodeValue.length){var t=b.util.findAdjacentTextNodeWithContent(b.selection.getSelectionElement(this.window),e.startContainer,this.document);if(t){for(var n=0;0===t.nodeValue.substr(n,1).trim().length;)n+=1;e=b.selection.select(this.document,t,n,e.endContainer,e.endOffset)}}},checkState:function(){if(!this.base.preventSelectionUpdates){if(!this.base.getFocusedElement()||b.selection.selectionInContentEditableFalse(this.window))return this.hideToolbar();var e=b.selection.getSelectionElement(this.window);return!e||-1===this.getEditorElements().indexOf(e)||e.getAttribute("data-disable-toolbar")?this.hideToolbar():this.updateOnEmptySelection&&this.static?this.showAndUpdateToolbar():!b.selection.selectionContainsContent(this.document)||!1===this.allowMultiParagraphSelection&&this.multipleBlockElementsSelected()?this.hideToolbar():void this.showAndUpdateToolbar()}},showAndUpdateToolbar:function(){this.modifySelection(),this.setToolbarButtonStates(),this.trigger("positionToolbar",{},this.base.getFocusedElement()),this.showToolbarDefaultActions(),this.setToolbarPosition()},setToolbarButtonStates:function(){this.forEachExtension(function(e){"function"==typeof e.isActive&&"function"==typeof e.setInactive&&e.setInactive()}),this.checkActiveButtons()},checkActiveButtons:function(){var t,n=[],i=null,e=b.selection.getSelectionRange(this.document),o=function(e){"function"==typeof e.checkState?e.checkState(t):"function"==typeof e.isActive&&"function"==typeof e.isAlreadyApplied&&"function"==typeof e.setActive&&!e.isActive()&&e.isAlreadyApplied(t)&&e.setActive()};if(e&&(this.forEachExtension(function(e){return"function"==typeof e.queryCommandState&&null!==(i=e.queryCommandState())?void(i&&"function"==typeof e.setActive&&e.setActive()):void n.push(e)}),t=b.selection.getSelectedParentElement(e),this.getEditorElements().some(function(e){return b.util.isDescendant(e,t,!0)})))for(;t&&(n.forEach(o),!b.util.isMediumEditorElement(t));)t=t.parentNode},positionToolbarIfShown:function(){this.isDisplayed()&&this.setToolbarPosition()},setToolbarPosition:function(){var e=this.base.getFocusedElement(),t=this.window.getSelection();return e?void(!this.static&&t.isCollapsed||(this.showToolbar(),this.relativeContainer||(this.static?this.positionStaticToolbar(e):this.positionToolbar(t)),this.trigger("positionedToolbar",{},this.base.getFocusedElement()))):this},positionStaticToolbar:function(e){this.getToolbarElement().style.left="0";var t,n=this.document.documentElement&&this.document.documentElement.scrollTop||this.document.body.scrollTop,i=this.window.innerWidth,o=this.getToolbarElement(),s=e.getBoundingClientRect(),r=s.top+n,a=s.left+s.width/2,l=o.offsetHeight,c=o.offsetWidth,d=c/2;switch(this.sticky?n>r+e.offsetHeight-l-this.stickyTopOffset?(o.style.top=r+e.offsetHeight-l+"px",o.classList.remove("medium-editor-sticky-toolbar")):n>r-l-this.stickyTopOffset?(o.classList.add("medium-editor-sticky-toolbar"),o.style.top=this.stickyTopOffset+"px"):(o.classList.remove("medium-editor-sticky-toolbar"),o.style.top=r-l+"px"):o.style.top=r-l+"px",this.align){case"left":t=s.left;break;case"right":t=s.right-c;break;case"center":t=a-d}t<0?t=0:i<t+c&&(t=i-Math.ceil(c)-1),o.style.left=t+"px"},positionToolbar:function(e){this.getToolbarElement().style.left="0",this.getToolbarElement().style.right="initial";var t=e.getRangeAt(0),n=t.getBoundingClientRect();(!n||0===n.height&&0===n.width&&t.startContainer===t.endContainer)&&(n=1===t.startContainer.nodeType&&t.startContainer.querySelector("img")?t.startContainer.querySelector("img").getBoundingClientRect():t.startContainer.getBoundingClientRect());var i,o,s=this.window.innerWidth,r=this.getToolbarElement(),a=r.offsetHeight,l=r.offsetWidth/2,c=this.diffLeft-l,d=this.getEditorOption("elementsContainer"),u=-1<["absolute","fixed"].indexOf(window.getComputedStyle(d).getPropertyValue("position")),h={},m={};u?(o=d.getBoundingClientRect(),["top","left"].forEach(function(e){m[e]=n[e]-o[e]}),m.width=n.width,m.height=n.height,n=m,s=o.width,h.top=d.scrollTop):h.top=this.window.pageYOffset,i=n.left+n.width/2,h.top+=n.top-a,n.top<50?(r.classList.add("medium-toolbar-arrow-over"),r.classList.remove("medium-toolbar-arrow-under"),h.top+=50+n.height-this.diffTop):(r.classList.add("medium-toolbar-arrow-under"),r.classList.remove("medium-toolbar-arrow-over"),h.top+=this.diffTop),i<l?(h.left=c+l,h.right="initial"):s-i<l?(h.left="auto",h.right=0):(h.left=c+i,h.right="initial"),["top","left","right"].forEach(function(e){r.style[e]=h[e]+(isNaN(h[e])?"":"px")})}}),b.extensions.toolbar=t,e=b.Extension.extend({init:function(){b.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(e){var t="medium-editor-dragover";e.preventDefault(),e.dataTransfer.dropEffect="copy","dragover"===e.type?e.target.classList.add(t):"dragleave"===e.type&&e.target.classList.remove(t)},handleDrop:function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.files&&Array.prototype.slice.call(e.dataTransfer.files,0).some(function(e){var t,n;e.type.match("image")&&((t=new FileReader).readAsDataURL(e),n="medium-img-"+ +new Date,b.util.insertHTMLCommand(this.document,'<img class="medium-editor-image-loading" id="'+n+'" />'),t.onload=function(){var e=this.document.getElementById(n);e&&(e.removeAttribute("id"),e.removeAttribute("class"),e.src=t.result)}.bind(this))}.bind(this)),e.target.classList.remove("medium-editor-dragover")}}),b.extensions.imageDragging=e,function(){function i(e,t){if(this.options.disableReturn||t.getAttribute("data-disable-return"))e.preventDefault();else if(this.options.disableDoubleReturn||t.getAttribute("data-disable-double-return")){var n=b.selection.getSelectionStart(this.options.ownerDocument);(n&&""===n.textContent.trim()&&"li"!==n.nodeName.toLowerCase()||n.previousElementSibling&&"br"!==n.previousElementSibling.nodeName.toLowerCase()&&""===n.previousElementSibling.textContent.trim())&&e.preventDefault()}}function e(e){var t,n=b.selection.getSelectionStart(this.options.ownerDocument),i=n.nodeName.toLowerCase(),o=/^(\s+|<br\/?>)?$/i,s=/h\d/i;b.util.isKey(e,[b.util.keyCode.BACKSPACE,b.util.keyCode.ENTER])&&n.previousElementSibling&&s.test(i)&&0===b.selection.getCaretOffsets(n).left?b.util.isKey(e,b.util.keyCode.BACKSPACE)&&o.test(n.previousElementSibling.innerHTML)?(n.previousElementSibling.parentNode.removeChild(n.previousElementSibling),e.preventDefault()):!this.options.disableDoubleReturn&&b.util.isKey(e,b.util.keyCode.ENTER)&&((t=this.options.ownerDocument.createElement("p")).innerHTML="<br>",n.previousElementSibling.parentNode.insertBefore(t,n),e.preventDefault()):b.util.isKey(e,b.util.keyCode.DELETE)&&n.nextElementSibling&&n.previousElementSibling&&!s.test(i)&&o.test(n.innerHTML)&&s.test(n.nextElementSibling.nodeName.toLowerCase())?(b.selection.moveCursor(this.options.ownerDocument,n.nextElementSibling),n.previousElementSibling.parentNode.removeChild(n),e.preventDefault()):b.util.isKey(e,b.util.keyCode.BACKSPACE)&&"li"===i&&o.test(n.innerHTML)&&!n.previousElementSibling&&!n.parentElement.previousElementSibling&&n.nextElementSibling&&"li"===n.nextElementSibling.nodeName.toLowerCase()?((t=this.options.ownerDocument.createElement("p")).innerHTML="<br>",n.parentElement.parentElement.insertBefore(t,n.parentElement),b.selection.moveCursor(this.options.ownerDocument,t),n.parentElement.removeChild(n),e.preventDefault()):b.util.isKey(e,b.util.keyCode.BACKSPACE)&&!1!==b.util.getClosestTag(n,"blockquote")&&0===b.selection.getCaretOffsets(n).left?(e.preventDefault(),b.util.execFormatBlock(this.options.ownerDocument,"p")):b.util.isKey(e,b.util.keyCode.ENTER)&&!1!==b.util.getClosestTag(n,"blockquote")&&0===b.selection.getCaretOffsets(n).right?((t=this.options.ownerDocument.createElement("p")).innerHTML="<br>",n.parentElement.insertBefore(t,n.nextSibling),b.selection.moveCursor(this.options.ownerDocument,t),e.preventDefault()):b.util.isKey(e,b.util.keyCode.BACKSPACE)&&b.util.isMediumEditorElement(n.parentElement)&&!n.previousElementSibling&&n.nextElementSibling&&o.test(n.innerHTML)&&(e.preventDefault(),b.selection.moveCursor(this.options.ownerDocument,n.nextSibling),n.parentElement.removeChild(n))}function n(e,t,n){var i=[];if(e||(e=[]),"string"==typeof e&&(e=t.querySelectorAll(e)),b.util.isElement(e)&&(e=[e]),n)for(var o=0;o<e.length;o++){var s=e[o];!b.util.isElement(s)||s.getAttribute("data-medium-editor-element")||s.getAttribute("medium-editor-textarea-id")||i.push(s)}else i=Array.prototype.slice.apply(e);return i}function o(e){var t=e.parentNode.querySelector('textarea[medium-editor-textarea-id="'+e.getAttribute("medium-editor-textarea-id")+'"]');t&&(t.classList.remove("medium-editor-hidden"),t.removeAttribute("medium-editor-textarea-id")),e.parentNode&&e.parentNode.removeChild(e)}function s(e,t,n){var i,o,s={window:n.options.contentWindow,document:n.options.ownerDocument,base:n};return i=e,o=s,Object.keys(o).forEach(function(e){void 0===i[e]&&(i[e]=o[e])}),"function"==typeof(e=i).init&&e.init(),e.name||(e.name=t),e}function r(){return!this.elements.every(function(e){return!!e.getAttribute("data-disable-toolbar")})&&!1!==this.options.toolbar}function a(e,t){if(!e.getAttribute("data-medium-editor-element")){"textarea"===e.nodeName.toLowerCase()&&(e=function(e){for(var t=this.options.ownerDocument.createElement("div"),n=Date.now(),i="medium-editor-"+n,o=e.attributes;this.options.ownerDocument.getElementById(i);)i="medium-editor-"+ ++n;t.className=e.className,t.id=i,t.innerHTML=e.value,e.setAttribute("medium-editor-textarea-id",i);for(var s=0,r=o.length;s<r;s++)t.hasAttribute(o[s].nodeName)||t.setAttribute(o[s].nodeName,o[s].value);return e.form&&this.on(e.form,"reset",function(e){e.defaultPrevented||this.resetContent(this.options.ownerDocument.getElementById(i))}.bind(this)),e.classList.add("medium-editor-hidden"),e.parentNode.insertBefore(t,e),t}.call(this,e),this.instanceHandleEditableInput||(this.instanceHandleEditableInput=function(e,t){var n=t.parentNode.querySelector('textarea[medium-editor-textarea-id="'+t.getAttribute("medium-editor-textarea-id")+'"]');n&&(n.value=t.innerHTML.trim())}.bind(this),this.subscribe("editableInput",this.instanceHandleEditableInput))),this.options.disableEditing||e.getAttribute("data-disable-editing")||(e.setAttribute("contentEditable",!0),e.setAttribute("spellcheck",this.options.spellcheck)),this.instanceHandleEditableKeydownEnter||(e.getAttribute("data-disable-return")||e.getAttribute("data-disable-double-return"))&&(this.instanceHandleEditableKeydownEnter=i.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter)),this.options.disableReturn||e.getAttribute("data-disable-return")||this.on(e,"keyup",function(e){var t=b.selection.getSelectionStart(this.options.ownerDocument);t&&(b.util.isMediumEditorElement(t)&&0===t.children.length&&!b.util.isBlockContainer(t)&&this.options.ownerDocument.execCommand("formatBlock",!1,"p"),!b.util.isKey(e,b.util.keyCode.ENTER)||b.util.isListItem(t)||b.util.isBlockContainer(t)||("a"===t.nodeName.toLowerCase()?this.options.ownerDocument.execCommand("unlink",!1,null):e.shiftKey||e.ctrlKey||this.options.ownerDocument.execCommand("formatBlock",!1,"p")))}.bind(this));var n=b.util.guid();e.setAttribute("data-medium-editor-element",!0),e.classList.add("medium-editor-element"),e.setAttribute("role","textbox"),e.setAttribute("aria-multiline",!0),e.setAttribute("data-medium-editor-editor-index",t),e.setAttribute("medium-editor-index",n),d[n]=e.innerHTML,this.events.attachAllEventsToElement(e)}return e}function t(){this.subscribe("editableKeydownTab",function(e){var t=b.selection.getSelectionStart(this.options.ownerDocument);"pre"===(t&&t.nodeName.toLowerCase())&&(e.preventDefault(),b.util.insertHTMLCommand(this.options.ownerDocument," ")),b.util.isListItem(t)&&(e.preventDefault(),e.shiftKey?this.options.ownerDocument.execCommand("outdent",!1,null):this.options.ownerDocument.execCommand("indent",!1,null))}.bind(this)),this.subscribe("editableKeydownDelete",e.bind(this)),this.subscribe("editableKeydownEnter",e.bind(this)),this.options.disableExtraSpaces&&this.subscribe("editableKeydownSpace",function(e){var t=b.selection.getSelectionStart(this.options.ownerDocument),n=t.textContent,i=b.selection.getCaretOffsets(t);(void 0===n[i.left-1]||""===n[i.left-1].trim()||void 0!==n[i.left]&&""===n[i.left].trim())&&e.preventDefault()}.bind(this)),this.instanceHandleEditableKeydownEnter||(this.options.disableReturn||this.options.disableDoubleReturn)&&(this.instanceHandleEditableKeydownEnter=i.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter))}function l(){if(this.extensions=[],Object.keys(this.options.extensions).forEach(function(e){"toolbar"!==e&&this.options.extensions[e]&&this.extensions.push(s(this.options.extensions[e],e,this))},this),function(){return!this.options.extensions.imageDragging}.call(this)){var e=this.options.fileDragging;e||(e={},function(){return!1!==this.options.imageDragging}.call(this)||(e.allowedTypes=[])),this.addBuiltInExtension("fileDragging",e)}var t={paste:!0,"anchor-preview":function(){return!!r.call(this)&&!1!==this.options.anchorPreview}.call(this),autoLink:function(){return!1!==this.options.autoLink}.call(this),keyboardCommands:function(){return!1!==this.options.keyboardCommands}.call(this),placeholder:function(){return!1!==this.options.placeholder}.call(this)};Object.keys(t).forEach(function(e){t[e]&&this.addBuiltInExtension(e)},this);var n=this.options.extensions.toolbar;if(!n&&r.call(this)){var i=b.util.extend({},this.options.toolbar,{allowMultiParagraphSelection:this.options.allowMultiParagraphSelection});n=new b.extensions.toolbar(i)}n&&this.extensions.push(s(n,"toolbar",this))}function c(e,t){var n,i;if(n=/^append-(.+)$/gi.exec(e))return b.util.execFormatBlock(this.options.ownerDocument,n[1]);if("fontSize"===e)return t.size&&b.util.deprecated(".size option for fontSize command",".value","6.0.0"),i=t.value||t.size,this.options.ownerDocument.execCommand("fontSize",!1,i);if("fontName"===e)return t.name&&b.util.deprecated(".name option for fontName command",".value","6.0.0"),i=t.value||t.name,this.options.ownerDocument.execCommand("fontName",!1,i);if("createLink"===e)return this.createLink(t);if("image"===e){var o=this.options.contentWindow.getSelection().toString().trim();return this.options.ownerDocument.execCommand("insertImage",!1,o)}if("html"===e){var s=this.options.contentWindow.getSelection().toString().trim();return b.util.insertHTMLCommand(this.options.ownerDocument,s)}if(/justify([A-Za-z]*)$/g.exec(e)){var r=this.options.ownerDocument.execCommand(e,!1,null),a=b.selection.getSelectedParentElement(b.selection.getSelectionRange(this.options.ownerDocument));return a&&function(e){if(e){var i,t=Array.prototype.slice.call(e.childNodes).filter(function(e){var t="div"===e.nodeName.toLowerCase();return t&&!i&&(i=e.style.textAlign),t});t.length&&(this.saveSelection(),t.forEach(function(e){if(e.style.textAlign===i){var t=e.lastChild;if(t){b.util.unwrap(e,this.options.ownerDocument);var n=this.options.ownerDocument.createElement("BR");t.parentNode.insertBefore(n,t.nextSibling)}}},this),e.style.textAlign=i,this.restoreSelection())}}.call(this,b.util.getTopBlockContainer(a)),r}return i=t&&t.value,this.options.ownerDocument.execCommand(e,!1,i)}var d={};b.prototype={init:function(e,t){return this.options=function(e,t){return t&&[["allowMultiParagraphSelection","toolbar.allowMultiParagraphSelection"]].forEach(function(e){t.hasOwnProperty(e[0])&&void 0!==t[e[0]]&&b.util.deprecated(e[0],e[1],"v6.0.0")}),b.util.defaults({},t,e)}.call(this,this.defaults,t),this.origElements=e,this.options.elementsContainer||(this.options.elementsContainer=this.options.ownerDocument.body),this.setup()},setup:function(){this.isActive||(function(e){e._mediumEditors||(e._mediumEditors=[null]),this.id||(this.id=e._mediumEditors.length),e._mediumEditors[this.id]=this}.call(this,this.options.contentWindow),this.events=new b.Events(this),this.elements=[],this.addElements(this.origElements),0!==this.elements.length&&(this.isActive=!0,l.call(this),t.call(this)))},destroy:function(){this.isActive&&(this.isActive=!1,this.extensions.forEach(function(e){"function"==typeof e.destroy&&e.destroy()},this),this.events.destroy(),this.elements.forEach(function(e){this.options.spellcheck&&(e.innerHTML=e.innerHTML),e.removeAttribute("contentEditable"),e.removeAttribute("spellcheck"),e.removeAttribute("data-medium-editor-element"),e.classList.remove("medium-editor-element"),e.removeAttribute("role"),e.removeAttribute("aria-multiline"),e.removeAttribute("medium-editor-index"),e.removeAttribute("data-medium-editor-editor-index"),e.getAttribute("medium-editor-textarea-id")&&o(e)},this),this.elements=[],this.instanceHandleEditableKeydownEnter=null,this.instanceHandleEditableInput=null,function(e){e._mediumEditors&&e._mediumEditors[this.id]&&(e._mediumEditors[this.id]=null)}.call(this,this.options.contentWindow))},on:function(e,t,n,i){return this.events.attachDOMEvent(e,t,n,i),this},off:function(e,t,n,i){return this.events.detachDOMEvent(e,t,n,i),this},subscribe:function(e,t){return this.events.attachCustomEvent(e,t),this},unsubscribe:function(e,t){return this.events.detachCustomEvent(e,t),this},trigger:function(e,t,n){return this.events.triggerCustomEvent(e,t,n),this},delay:function(e){var t=this;return setTimeout(function(){t.isActive&&e()},this.options.delay)},serialize:function(){var e,t={},n=this.elements.length;for(e=0;e<n;e+=1)t[""!==this.elements[e].id?this.elements[e].id:"element-"+e]={value:this.elements[e].innerHTML.trim()};return t},getExtensionByName:function(t){var n;return this.extensions&&this.extensions.length&&this.extensions.some(function(e){return e.name===t&&(n=e,!0)}),n},addBuiltInExtension:function(e,t){var n,i=this.getExtensionByName(e);if(i)return i;switch(e){case"anchor":n=b.util.extend({},this.options.anchor,t),i=new b.extensions.anchor(n);break;case"anchor-preview":i=new b.extensions.anchorPreview(this.options.anchorPreview);break;case"autoLink":i=new b.extensions.autoLink;break;case"fileDragging":i=new b.extensions.fileDragging(t);break;case"fontname":i=new b.extensions.fontName(this.options.fontName);break;case"fontsize":i=new b.extensions.fontSize(t);break;case"keyboardCommands":i=new b.extensions.keyboardCommands(this.options.keyboardCommands);break;case"paste":i=new b.extensions.paste(this.options.paste);break;case"placeholder":i=new b.extensions.placeholder(this.options.placeholder);break;default:b.extensions.button.isBuiltInButton(e)&&(t?(n=b.util.defaults({},t,b.extensions.button.prototype.defaults[e]),i=new b.extensions.button(n)):i=new b.extensions.button(e))}return i&&this.extensions.push(s(i,e,this)),i},stopSelectionUpdates:function(){this.preventSelectionUpdates=!0},startSelectionUpdates:function(){this.preventSelectionUpdates=!1},checkSelection:function(){var e=this.getExtensionByName("toolbar");return e&&e.checkState(),this},queryCommandState:function(e){var t,n=null;(t=/^full-(.+)$/gi.exec(e))&&(e=t[1]);try{n=this.options.ownerDocument.queryCommandState(e)}catch(e){n=null}return n},execAction:function(e,t){var n,i;return(n=/^full-(.+)$/gi.exec(e))?(this.saveSelection(),this.selectAllContents(),i=c.call(this,n[1],t),this.restoreSelection()):i=c.call(this,e,t),"insertunorderedlist"!==e&&"insertorderedlist"!==e||b.util.cleanListDOM(this.options.ownerDocument,this.getSelectedParentElement()),this.checkSelection(),i},getSelectedParentElement:function(e){return void 0===e&&(e=this.options.contentWindow.getSelection().getRangeAt(0)),b.selection.getSelectedParentElement(e)},selectAllContents:function(){var e=b.selection.getSelectionElement(this.options.contentWindow);if(e){for(;1===e.children.length;)e=e.children[0];this.selectElement(e)}},selectElement:function(e){b.selection.selectNode(e,this.options.ownerDocument);var t=b.selection.getSelectionElement(this.options.contentWindow);t&&this.events.focusElement(t)},getFocusedElement:function(){var t;return this.elements.some(function(e){return!t&&e.getAttribute("data-medium-focused")&&(t=e),!!t},this),t},exportSelection:function(){var e=b.selection.getSelectionElement(this.options.contentWindow),t=this.elements.indexOf(e),n=null;return 0<=t&&(n=b.selection.exportSelection(e,this.options.ownerDocument)),null!==n&&0!==t&&(n.editableElementIndex=t),n},saveSelection:function(){this.selectionState=this.exportSelection()},importSelection:function(e,t){if(e){var n=this.elements[e.editableElementIndex||0];b.selection.importSelection(e,n,this.options.ownerDocument,t)}},restoreSelection:function(){this.importSelection(this.selectionState)},createLink:function(e){var t,n=b.selection.getSelectionElement(this.options.contentWindow),i={};if(-1!==this.elements.indexOf(n)){try{if(this.events.disableCustomEvent("editableInput"),e.url&&b.util.deprecated(".url option for createLink",".value","6.0.0"),(t=e.url||e.value)&&0<t.trim().length){var o=this.options.contentWindow.getSelection();if(o){var s,r,a,l,c=o.getRangeAt(0),d=c.commonAncestorContainer;if(3===c.endContainer.nodeType&&3!==c.startContainer.nodeType&&0===c.startOffset&&c.startContainer.firstChild===c.endContainer&&(d=c.endContainer),r=b.util.getClosestBlockContainer(c.startContainer),a=b.util.getClosestBlockContainer(c.endContainer),3!==d.nodeType&&0!==d.textContent.length&&r===a){var u=r||n,h=this.options.ownerDocument.createDocumentFragment();this.execAction("unlink"),s=this.exportSelection(),h.appendChild(u.cloneNode(!0)),n===u?b.selection.select(this.options.ownerDocument,u.firstChild,0,u.lastChild,3===u.lastChild.nodeType?u.lastChild.nodeValue.length:u.lastChild.childNodes.length):b.selection.select(this.options.ownerDocument,u,0,u,u.childNodes.length);var m=this.exportSelection();0===(l=b.util.findOrCreateMatchingTextNodes(this.options.ownerDocument,h,{start:s.start-m.start,end:s.end-m.start,editableElementIndex:s.editableElementIndex})).length&&((h=this.options.ownerDocument.createDocumentFragment()).appendChild(d.cloneNode(!0)),l=[h.firstChild.firstChild,h.firstChild.lastChild]),b.util.createLink(this.options.ownerDocument,l,t.trim());var f=(h.firstChild.innerHTML.match(/^\s+/)||[""])[0].length;b.util.insertHTMLCommand(this.options.ownerDocument,h.firstChild.innerHTML.replace(/^\s+/,"")),s.start-=f,s.end-=f,this.importSelection(s)}else this.options.ownerDocument.execCommand("createLink",!1,t);this.options.targetBlank||"_blank"===e.target?b.util.setTargetBlank(b.selection.getSelectionStart(this.options.ownerDocument),t):b.util.removeTargetBlank(b.selection.getSelectionStart(this.options.ownerDocument),t),e.buttonClass&&b.util.addClassToAnchors(b.selection.getSelectionStart(this.options.ownerDocument),e.buttonClass)}}if(this.options.targetBlank||"_blank"===e.target||e.buttonClass){(i=this.options.ownerDocument.createEvent("HTMLEvents")).initEvent("input",!0,!0,this.options.contentWindow);for(var p=0,g=this.elements.length;p<g;p+=1)this.elements[p].dispatchEvent(i)}}finally{this.events.enableCustomEvent("editableInput")}this.events.triggerCustomEvent("editableInput",i,n)}},cleanPaste:function(e){this.getExtensionByName("paste").cleanPaste(e)},pasteHTML:function(e,t){this.getExtensionByName("paste").pasteHTML(e,t)},setContent:function(e,t){if(t=t||0,this.elements[t]){var n=this.elements[t];n.innerHTML=e,this.checkContentChanged(n)}},getContent:function(e){return e=e||0,this.elements[e]?this.elements[e].innerHTML.trim():null},checkContentChanged:function(e){e=e||b.selection.getSelectionElement(this.options.contentWindow),this.events.updateInput(e,{target:e,currentTarget:e})},resetContent:function(e){if(e){var t=this.elements.indexOf(e);-1!==t&&this.setContent(d[e.getAttribute("medium-editor-index")],t)}else this.elements.forEach(function(e,t){this.setContent(d[e.getAttribute("medium-editor-index")],t)},this)},addElements:function(e){var t=n(e,this.options.ownerDocument,!0);return 0!==t.length&&void t.forEach(function(e){e=a.call(this,e,this.id),this.elements.push(e),this.trigger("addElement",{target:e,currentTarget:e},e)},this)},removeElements:function(e){var t=n(e,this.options.ownerDocument).map(function(e){return e.getAttribute("medium-editor-textarea-id")&&e.parentNode?e.parentNode.querySelector('div[medium-editor-textarea-id="'+e.getAttribute("medium-editor-textarea-id")+'"]'):e});this.elements=this.elements.filter(function(e){return-1===t.indexOf(e)||(this.events.cleanupElement(e),e.getAttribute("medium-editor-textarea-id")&&o(e),this.trigger("removeElement",{target:e,currentTarget:e},e),!1)},this)}},b.getEditorFromElement=function(e){var t=e.getAttribute("data-medium-editor-editor-index"),n=e&&e.ownerDocument&&(e.ownerDocument.defaultView||e.ownerDocument.parentWindow);return n&&n._mediumEditors&&n._mediumEditors[t]?n._mediumEditors[t]:null}}(),b.prototype.defaults={activeButtonClass:"medium-editor-button-active",buttonLabels:!1,delay:0,disableReturn:!1,disableDoubleReturn:!1,disableExtraSpaces:!1,disableEditing:!1,autoLink:!1,elementsContainer:!1,contentWindow:window,ownerDocument:document,targetBlank:!1,extensions:{},spellcheck:!0},b.version=(b.parseVersionString=function(e){var t=e.split("-"),n=t[0].split("."),i=1<t.length?t[1]:"";return{major:parseInt(n[0],10),minor:parseInt(n[1],10),revision:parseInt(n[2],10),preRelease:i,toString:function(){return[n[0],n[1],n[2]].join(".")+(i?"-"+i:"")}}}).call(this,"5.23.3"),b;var e,t,n,i,o,s,r,a,l,c,d}());
| ver. 1.6 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings