!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.woofmark=e()}}(function(){return function e(t,n,r){function o(i,s){if(!n[i]){if(!t[i]){var c="function"==typeof require&&require;if(!s&&c)return c(i,!0);if(a)return a(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[i]={exports:{}};t[i][0].call(u.exports,function(e){var n=t[i][1][e];return o(n?n:e)},u,u.exports,e,t,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i0)return{x:r[0].left,y:r[0].top,absolute:!0}}}return{x:0,y:0}}function m(t,n){var r=f.createElement("span"),o=t.mirror,a=t.computed;return w(o,h(e).substring(0,n)),"INPUT"===e.tagName&&(o.textContent=o.textContent.replace(/\s/g," ")),w(r,h(e).substring(n)||"."),o.appendChild(r),{x:r.offsetLeft+parseInt(a.borderLeftWidth),y:r.offsetTop+parseInt(a.borderTopWidth)}}function h(e){return k?e.value:e.innerHTML}function v(){function t(e){o[e]=n[e]}var n=u.getComputedStyle?getComputedStyle(e):e.currentStyle,r=f.createElement("div"),o=r.style;return f.body.appendChild(r),"INPUT"!==e.tagName&&(o.wordWrap="break-word"),o.whiteSpace="pre-wrap",o.position="absolute",o.visibility="hidden",l.forEach(t),d?(o.width=parseInt(n.width)-2+"px",e.scrollHeight>parseInt(n.height)&&(o.overflowY="scroll")):o.overflow="hidden",{mirror:r,computed:n}}function w(e,t){k?e.textContent=t:e.innerHTML=t}function y(t){var n=t?"remove":"add";a[n](e,"keydown",x),a[n](e,"keyup",x),a[n](e,"input",x),a[n](e,"paste",x),a[n](e,"change",x)}function b(){y(!0)}var k="INPUT"===e.tagName||"TEXTAREA"===e.tagName,x=s(i,30),T=t||{};return y(),{read:r,refresh:x,destroy:b}}var o=e("sell"),a=e("crossvent"),i=e("seleccion"),s=e("./throttle"),c=i.get,l=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"],u=n,f=document,d=null!==u.mozInnerScreenX&&void 0!==u.mozInnerScreenX;t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./throttle":4,crossvent:10,seleccion:29,sell:31}],4:[function(e,t){"use strict";function n(e,t){var n,r=-1/0;return function(){function o(){clearTimeout(n),n=null;var a=r+t,i=Date.now();i>a?(r=i,e()):n=setTimeout(o,a-i)}n||o()}}t.exports=n},{}],5:[function(e,t){"use strict";function n(e,t){function n(t){o(t),e.files.length&&a.submit(e.files),e.value="",e.value=null}var a=r(t);return c.add(e,"change",n,!1),a}function r(e){function t(e){function t(e){u.append(r.fieldKey,e,e.name)}function a(e,t,n){t.body=n=i(n);var r=n&&n.results&&Array.isArray(n.results)?n.results:[],a=e||t.statusCode<200||t.statusCode>299||n instanceof Error;a?o.emit("error",e):o.emit("success",r,n),o.emit("ended",e,r,n)}o.emit("started",e);var c=Array.prototype.slice.call(e),l=n(c);if(!l)return void o.emit("invalid",c);o.emit("valid",l);var u=new FormData;Object.keys(r.formData).forEach(function(e){u.append(e,r.formData[e])});var f={"Content-Type":"multipart/form-data",headers:{Accept:"application/json"},method:r.method||"PUT",url:r.endpoint||"/api/files",body:u};l.forEach(t),s(f,a)}function n(e){function t(e){var t=u[r.validate]||r.validate;return t(e)}return r.validate?e.filter(t):e}var r=e||{};r.formData=r.formData||{},r.fieldKey=r.fieldKey||"uploads";var o=l({submit:t});return o}function o(e){e.stopPropagation(),e.preventDefault()}function a(e){return f.test(e.type)}function i(e){try{return JSON.parse(e)}catch(t){return t}}var s=e("xhr"),c=e("crossvent"),l=e("contra/emitter"),u={image:a},f=/^image\/(gif|png|p?jpe?g)$/i;t.exports={create:r,setup:n}},{"contra/emitter":9,crossvent:6,xhr:34}],6:[function(e,t){(function(n){"use strict";function r(e,t,n,r){return e.addEventListener(t,n,r)}function o(e,t,n){return e.attachEvent("on"+t,l(e,t,n))}function a(e,t,n,r){return e.removeEventListener(t,n,r)}function i(e,t,n){var r=u(e,t,n);return r?e.detachEvent("on"+t,r):void 0}function s(e,t,n){function r(){var e;return g.createEvent?(e=g.createEvent("Event"),e.initEvent(t,!0,!0)):g.createEventObject&&(e=g.createEventObject()),e}function o(){return new d(t,{detail:n})}var a=-1===p.indexOf(t)?o():r();e.dispatchEvent?e.dispatchEvent(a):e.fireEvent("on"+t,a)}function c(e,t,r){return function(t){var o=t||n.event;o.target=o.target||o.srcElement,o.preventDefault=o.preventDefault||function(){o.returnValue=!1},o.stopPropagation=o.stopPropagation||function(){o.cancelBubble=!0},o.which=o.which||o.keyCode,r.call(e,o)}}function l(e,t,n){var r=u(e,t,n)||c(e,t,n);return v.push({wrapper:r,element:e,type:t,fn:n}),r}function u(e,t,n){var r=f(e,t,n);if(r){var o=v[r].wrapper;return v.splice(r,1),o}}function f(e,t,n){var r,o;for(r=0;rr;r++)o.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))},i=function(e,t,n){for(var r=0,o=e.length;o>r;r++)null==n?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)},s=function(e,t,n){for(var r in e)o.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))},c=function(e,t,o){if(!n(t))throw new TypeError("iterator must be a function");var c;arguments.length>=3&&(c=o),"[object Array]"===r.call(e)?a(e,t,c):"string"==typeof e?i(e,t,c):s(e,t,c)};t.exports=c},{"is-callable":15}],14:[function(e,t){(function(e){var n;n="undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:{},t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],15:[function(e,t){"use strict";var n=Function.prototype.toString,r=/^\s*class\b/,o=function(e){try{var t=n.call(e);return r.test(t)}catch(o){return!1}},a=function(e){try{return o(e)?!1:(n.call(e),!0)}catch(t){return!1}},i=Object.prototype.toString,s="[object Function]",c="[object GeneratorFunction]",l="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if("function"==typeof e&&!e.prototype)return!0;if(l)return a(e);if(o(e))return!1;var t=i.call(e);return t===s||t===c}},{}],16:[function(e,t){function n(e){var t=r.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}t.exports=n;var r=Object.prototype.toString},{}],17:[function(e,t){"use strict";function n(e){e?e in g&&(g[e]={}):g={}}function r(e,t,n,r){function o(t){var o=t.trim();0!==o.length&&e(g[a],o,n,r)}void 0===r&&(r=n,n={});var a=n.context||"defaults";r&&(void 0===g[a]&&(g[a]={}),t.toLowerCase().split(d).forEach(o))}function o(e,t,n){function o(e,t,n,r){var o={handle:r,filter:n.filter};e[t]?e[t].push(o):e[t]=[o]}r(o,e,t,n)}function a(e,t,n){function o(e,t,n,r){function o(e){return e.handle===r&&e.filter===n.filter}e[t]&&(e[t]=e[t].filter(o))}r(o,e,t,n)}function i(e){return e.which||e.keyCode||e.charCode}function s(e){var t=i(e),n=p[t]||String.fromCharCode(t);n&&l(n,e)}function c(e,t){var n=[e];return t.shiftKey&&n.unshift("shift"),t.altKey&&n.unshift("alt"),t.ctrlKey^t.metaKey&&n.unshift("cmd"),n.join("+").toLowerCase()}function l(e,t){function n(e){var n=e.filter;if(n){var r=t.target,o="string"==typeof n;if(o)return u.matchesSelector(r,n)===!1;for(;r.parentElement&&r!==n;)r=r.parentElement;return r!==n}}function r(e){n(e)||e.handle(t)}var o,a=c(e,t);for(o in g)g[o][a]&&g[o][a].forEach(r)}var u=e("sektor"),f=e("crossvent"),d=/\s+/g,p={13:"enter",27:"esc",32:"space"},g={};f.add(window,"keydown",s),t.exports={on:o,off:a,clear:n,handlers:g}},{crossvent:10,sektor:22}],18:[function(e,t){(function(n){"use strict";function r(e,t){return 1===arguments.length?o(e):a(e,t)}function o(e){return JSON.parse(u.getItem(e))}function a(e,t){try{return u.setItem(e,JSON.stringify(t)),!0}catch(n){return!1}}function i(e){return u.removeItem(e)}function s(){return u.clear()}var c=e("./stub"),l=e("./tracking"),u="localStorage"in n&&n.localStorage?n.localStorage:c;r.set=a,r.get=o,r.remove=i,r.clear=s,r.on=l.on,r.off=l.off,t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./stub":19,"./tracking":20}],19:[function(e,t){"use strict";function n(e){return e in i?i[e]:null}function r(e,t){return i[e]=t,!0}function o(e){var t=e in i;return t?delete i[e]:!1}function a(){return i={},!0}var i={};t.exports={getItem:n,setItem:r,removeItem:o,clear:a}},{}],20:[function(e,t){(function(e){"use strict";function n(){e.addEventListener?e.addEventListener("storage",r,!1):e.attachEvent?e.attachEvent("onstorage",r):e.onstorage=r}function r(t){function n(e){e(JSON.parse(t.newValue),JSON.parse(t.oldValue),t.url||t.uri)}t||(t=e.event);var r=i[t.key];r&&r.forEach(n)}function o(e,t){i[e]?i[e].push(t):i[e]=[t],s===!1&&n()}function a(e,t){var n=i[e];n.length>1?n.splice(n.indexOf(t),1):i[e]=[]}var i={},s=!1;t.exports={on:o,off:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],21:[function(e,t){var n=e("trim"),r=e("for-each"),o=function(e){return"[object Array]"===Object.prototype.toString.call(e)};t.exports=function(e){if(!e)return{};var t={};return r(n(e).split("\n"),function(e){var r=e.indexOf(":"),a=n(e.slice(0,r)).toLowerCase(),i=n(e.slice(r+1));"undefined"==typeof t[a]?t[a]=i:o(t[a])?t[a].push(i):t[a]=[t[a],i]}),t}},{"for-each":13,trim:33}],22:[function(e,t){(function(e){"use strict";function n(e,t){var n,r,o,a,i,u=t!==l;u&&(n=t.getAttribute("id"),r=n||s,o="#"+r+" ",a=o+e.replace(/,/g,","+o),i=c.test(e)&&t.parentNode,n||t.setAttribute("id",r));try{return(i||t).querySelectorAll(a||e)}catch(f){return[]}finally{null===n&&t.removeAttribute("id")}}function r(e,t,r,o){var i,s=t||l,c=r||[],u=0;if("string"!=typeof e)return c;if(1!==s.nodeType&&9!==s.nodeType)return[];if(o)for(;i=o[u++];)a(i,e)&&c.push(i);else c.push.apply(c,n(e,s));return c}function o(e,t){return r(e,null,null,t)}function a(e,t){return f.call(e,t)}function i(){return!1}var s="sektor-"+Date.now(),c=/[+~]/,l=e.document,u=l&&l.documentElement||{},f=u.matches||u.webkitMatchesSelector||u.mozMatchesSelector||u.oMatchesSelector||u.msMatchesSelector||i;t.exports=r,r.matches=o,r.matchesSelector=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],23:[function(e,t){(function(n){"use strict";var r,o=n.document,a=e("./getSelectionRaw"),i=e("./getSelectionNullOp"),s=e("./getSelectionSynthetic"),c=e("./isHost");r=c.method(n,"getSelection")?a:"object"==typeof o.selection&&o.selection?s:i,t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./getSelectionNullOp":24,"./getSelectionRaw":25,"./getSelectionSynthetic":26,"./isHost":27}],24:[function(e,t){"use strict";function n(){}function r(){return{removeAllRanges:n,addRange:n}}t.exports=r},{}],25:[function(e,t){(function(e){"use strict";function n(){return e.getSelection()}t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],26:[function(e,t){(function(n){"use strict";function r(e){var t=this,n=e.createRange();this._selection=e,this._ranges=[],"Control"===e.type?d(t):u(n)?f(t,n):s(t)}function o(e,t){for(var n,r=y.createControlRange(),o=0,a=t.length;a>o;++o){n=l(t[o]);try{r.add(n)}catch(i){throw new Error("setRanges(): Element could not be added to control selection")}}r.select(),d(e)}function a(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var r=0,o=n.length;o>r;++r)g(t,n[r])||e.addRange(n[r]);e.rangeCount||s(e)}function i(e,t){var n="start",r="end";e.anchorNode=t[n+"Container"],e.anchorOffset=t[n+"Offset"],e.focusNode=t[r+"Container"],e.focusOffset=t[r+"Offset"]}function s(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0}function c(e){if(!e.length||1!==e[0].nodeType)return!1;for(var t=1,n=e.length;n>t;++t)if(!m(e[0],e[t]))return!1;return!0}function l(e){var t=e.getNodes();if(!c(t))throw new Error("getSingleElementFromRange(): range did not consist of a single element");return t[0]}function u(e){return e&&void 0!==e.text}function f(e,t){e._ranges=[t],i(e,t,!1),e.rangeCount=1,e.isCollapsed=t.collapsed}function d(e){if(e._ranges.length=0,"None"===e._selection.type)s(e);else{var t=e._selection.createRange();if(u(t))f(e,t);else{e.rangeCount=t.length;for(var n,r=0;ra;++a)o.add(n.item(a));try{o.add(r)}catch(s){throw new Error("addRange(): Element could not be added to control selection")}o.select(),d(e)}function g(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}function m(e,t){for(var n=t;n.parentNode;){if(n.parentNode===e)return!0;n=n.parentNode}return!1}function h(){return new r(n.document.selection)}var v=e("./rangeToTextRange"),w=n.document,y=w.body,b=r.prototype;b.removeAllRanges=function(){var e;try{this._selection.empty(),"None"!==this._selection.type&&(e=y.createTextRange(),e.select(),this._selection.empty())}catch(t){}s(this)},b.addRange=function(e){"Control"===this._selection.type?p(this,e):(v(e).select(),this._ranges[0]=e,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,i(this,e,!1))},b.setRanges=function(e){this.removeAllRanges();var t=e.length;t>1?o(this,e):t&&this.addRange(e[0])},b.getRangeAt=function(e){if(0>e||e>=this.rangeCount)throw new Error("getRangeAt(): index out of bounds");return this._ranges[e].cloneRange()},b.removeRange=function(e){if("Control"!==this._selection.type)return void a(this,e);for(var t,n=this._selection.createRange(),r=l(e),o=y.createControlRange(),i=!1,s=0,c=n.length;c>s;++s)t=n.item(s),t!==r||i?o.add(n.item(s)):i=!0;o.select(),d(this)},b.eachRange=function(e,t){var n=0,r=this._ranges.length;for(n=0;r>n;++n)if(e(this.getRangeAt(n)))return t},b.getAllRanges=function(){var e=[];return this.eachRange(function(t){e.push(t)}),e},b.setSingleRange=function(e){this.removeAllRanges(),this.addRange(e)},t.exports=h}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./rangeToTextRange":28}],27:[function(e,t){"use strict";function n(e,t){var n=typeof e[t];return"function"===n||!("object"!==n||!e[t])||"unknown"===n}function r(e,t){return"undefined"!=typeof e[t]}function o(e){return function(t,n){for(var r=n.length;r--;)if(!e(t,n[r]))return!1;return!0}}t.exports={method:n,methods:o(n),property:r,properties:o(r)}},{}],28:[function(e,t){(function(e){"use strict";function n(e){if(e.collapsed)return o({node:e.startContainer,offset:e.startOffset},!0);var t=o({node:e.startContainer,offset:e.startOffset},!0),n=o({node:e.endContainer,offset:e.endOffset},!1),r=i.createTextRange();return r.setEndPoint("StartToStart",t),r.setEndPoint("EndToEnd",n),r}function r(e){var t=e.nodeType;return 3===t||4===t||8===t}function o(e,t){var n,o,s,c,l=e.offset,u=i.createTextRange(),f=r(e.node);return f?(n=e.node,o=n.parentNode):(c=e.node.childNodes,n=l0&&(m=setTimeout(function(){g=!0,d.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",o(e)},e.timeout)),d.setRequestHeader)for(p in y)y.hasOwnProperty(p)&&d.setRequestHeader(p,y[p]);else if(e.headers&&!r(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(d.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(d),d.send(w),d}function s(e){if("document"===e.responseType)return e.responseXML;var t=204===e.status&&e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;return""!==e.responseType||t?null:e.responseXML}function c(){}var l=e("global/window"),u=e("is-function"),f=e("parse-headers"),d=e("xtend");t.exports=a,a.XMLHttpRequest=l.XMLHttpRequest||c,a.XDomainRequest="withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:l.XDomainRequest,n(["get","put","post","patch","head","delete"],function(e){a["delete"===e?"del":e]=function(t,n,r){return n=o(t,n,r),n.method=e.toUpperCase(),i(n)}})},{"global/window":14,"is-function":16,"parse-headers":21,xtend:35}],35:[function(e,t){function n(){for(var e={},t=0;t=33&&40>=n||n>=63232&&63235>=n?e.setMode("moving"):8===n||46===n||127===n?e.setMode("deleting"):13===n?e.setMode("newlines"):27===n?e.setMode("escape"):(16>n||n>20)&&91!==n&&e.setMode("typing")}}function a(e){e.inputState&&e.inputState.text!==e.surface.read(e.inputMode)&&null===e.refreshing&&(e.historyMode="paste",e.saveState(),e.refreshState())}function i(e){var t=e.charCode||e.keyCode,n=89===t||90===t,r=e.ctrlKey||e.metaKey;r&&n&&e.preventDefault()}var s=e("crossvent"),c=e("./InputState");n.prototype.setInputMode=function(e){var t=this;t.inputMode=e,t.reset()},n.prototype.reset=function(){var e=this;return e.inputState=null,e.lastState=null,e.history=[],e.historyPointer=0,e.historyMode="none",e.refreshing=null,e.refreshState(!0),e.saveState(),e},n.prototype.setCommandMode=function(){var e=this;e.historyMode="command",e.saveState(),e.refreshing=setTimeout(function(){e.refreshState()},0)},n.prototype.canUndo=function(){return this.historyPointer>1},n.prototype.canRedo=function(){return this.history[this.historyPointer+1]},n.prototype.undo=function(){var e=this;e.canUndo()&&(e.lastState?(e.lastState.restore(),e.lastState=null):(e.history[e.historyPointer]=new c(e.surface,e.inputMode),e.history[--e.historyPointer].restore())),e.historyMode="none",e.surface.focus(e.inputMode),e.refreshState()},n.prototype.redo=function(){var e=this;e.canRedo()&&e.history[++e.historyPointer].restore(),e.historyMode="none",e.surface.focus(e.inputMode),e.refreshState()},n.prototype.setMode=function(e){var t=this;t.historyMode!==e&&(t.historyMode=e,t.saveState()),t.refreshing=setTimeout(function(){t.refreshState()},1)},n.prototype.refreshState=function(e){var t=this;t.inputState=new c(t.surface,t.inputMode,e),t.refreshing=null},n.prototype.saveState=function(){var e=this,t=e.inputState||new c(e.surface,e.inputMode);return"moving"===e.historyMode?void(e.lastState||(e.lastState=t)):(e.lastState&&(e.history[e.historyPointer-1].text!==e.lastState.text&&(e.history[e.historyPointer++]=e.lastState),e.lastState=null),e.history[e.historyPointer++]=t,void(e.history[e.historyPointer+1]=null))},t.exports=n},{"./InputState":37,crossvent:10}],37:[function(e,t){(function(n){"use strict";function r(e,t,n){this.mode=t,this.surface=e,this.initialState=n||!1,this.init()}var o=n.document,a=e("./isVisibleElement"),i=e("./fixEOL"),s=e("./markdown/MarkdownChunks"),c=e("./html/HtmlChunks"),l={markdown:s,html:c,wysiwyg:c};r.prototype.init=function(){var e=this,t=e.surface.current(e.mode);a(t)&&(this.initialState||!o.activeElement||o.activeElement===t)&&(e.surface.readSelection(e),e.scrollTop=t.scrollTop,e.text||(e.text=e.surface.read(e.mode)))},r.prototype.select=function(){var e=this,t=e.surface.current(e.mode);a(t)&&e.surface.writeSelection(e)},r.prototype.restore=function(){var e=this,t=e.surface.current(e.mode);"string"==typeof e.text&&e.text!==e.surface.read(e.mode)&&e.surface.write(e.mode,e.text),e.select(),t.scrollTop=e.scrollTop},r.prototype.getChunks=function(){var e=this,t=new l[e.mode];return t.before=i(e.text.substring(0,e.start)),t.startTag="",t.selection=i(e.text.substring(e.start,e.end)),t.endTag="",t.after=i(e.text.substring(e.end)),t.scrollTop=e.scrollTop,e.cachedChunks=t,t},r.prototype.setChunks=function(e){var t=this;e.before=e.before+e.startTag,e.after=e.endTag+e.after,t.start=e.before.length,t.end=e.before.length+e.selection.length,t.text=e.before+e.selection+e.after,t.scrollTop=e.scrollTop},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./fixEOL":44,"./html/HtmlChunks":48,"./isVisibleElement":57,"./markdown/MarkdownChunks":59}],38:[function(e,t){"use strict";function n(e,t,n){function a(e){return function(){r.fabricate(e,"click")}}function i(e,t){o[e].boldOrItalic(t,"bold")}function s(e,t){o[e].boldOrItalic(t,"italic")}function c(e,n){o[e].codeblock(n,{fencing:t.fencing})}function l(e,t){o[e].list(t,!1)}function u(e,t){o[e].list(t,!0)}function f(r,a){return function(i,s){o[i].linkOrImageOrAttachment.call(this,s,{editor:n,mode:i,type:r,surface:e,prompts:t.prompts,upload:t[r+"s"],classes:t.classes,mergeHtmlAndAttachment:t.mergeHtmlAndAttachment||p,autoUpload:a})}}function d(e,t,r){return n.addCommandButton(e,t,h(r))}function p(e,t){var n=e.selection||t.title;return{before:e.before,selection:''+n+"",after:e.after}}function g(e){return function(t,n){o[t][e].call(this,n)}}function m(e){e.preventDefault(),e.stopPropagation()}function h(e){return function(t,n,r){m(t),e.call(this,n,r)}}d("bold","cmd+b",i),d("italic","cmd+i",s),d("quote","cmd+j",g("blockquote")),d("code","cmd+e",c),d("ol","cmd+o",u),d("ul","cmd+u",l),d("heading","cmd+d",g("heading")),n.showLinkDialog=a(d("link","cmd+k",f("link"))),n.showImageDialog=a(d("image","cmd+g",f("image"))),n.linkOrImageOrAttachment=f,t.attachments&&(n.showAttachmentDialog=a(d("attachment","cmd+shift+k",f("attachment")))),t.hr&&d("hr","cmd+n",g("hr")) }var r=e("crossvent"),o={markdown:{boldOrItalic:e("./markdown/boldOrItalic"),linkOrImageOrAttachment:e("./markdown/linkOrImageOrAttachment"),blockquote:e("./markdown/blockquote"),codeblock:e("./markdown/codeblock"),heading:e("./markdown/heading"),list:e("./markdown/list"),hr:e("./markdown/hr")},html:{boldOrItalic:e("./html/boldOrItalic"),linkOrImageOrAttachment:e("./html/linkOrImageOrAttachment"),blockquote:e("./html/blockquote"),codeblock:e("./html/codeblock"),heading:e("./html/heading"),list:e("./html/list"),hr:e("./html/hr")}};o.wysiwyg=o.html,t.exports=n},{"./html/blockquote":49,"./html/boldOrItalic":50,"./html/codeblock":51,"./html/heading":52,"./html/hr":53,"./html/linkOrImageOrAttachment":54,"./html/list":55,"./markdown/blockquote":60,"./markdown/boldOrItalic":61,"./markdown/codeblock":62,"./markdown/heading":63,"./markdown/hr":64,"./markdown/linkOrImageOrAttachment":65,"./markdown/list":66,crossvent:10}],39:[function(e,t){"use strict";function n(e){var t,n=[],r=e.length;for(t=0;r>t;t++)n.push(e[t]);return n}t.exports=n},{}],40:[function(e,t){"use strict";function n(e){function t(e,t,n){var s=t.replace(/\?.*$/,r);return s=decodeURIComponent(s),s=encodeURI(s).replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29"),s=s.replace(/\?.*$/,o),{href:i(s),title:a(n)}}return t.apply(null,e.match(s))}function r(e){return e.replace(/\+/g," ")}function o(e){return e.replace(/\+/g,"%2b")}function a(e){return e?e.replace(/^\s+|\s+$/g,"").replace(/"/g,""").replace(//g,">"):null}function i(e){var t=e.replace(/^\s+|\s+$/g,"");return t.length&&"/"!==t[0]&&!c.test(t)?"http://"+t:t}var s=/^\s*(.*?)(?:\s+"(.+)")?\s*$/,c=/^(?:https?|ftp):\/\//;t.exports=n},{}],41:[function(e,t){"use strict";function n(e){function t(e){return r.before+=e,""}function n(e){return r.after=e+r.after,""}var r=this;e&&(t=n=""),r.selection=r.selection.replace(/^(\s*)/,t).replace(/(\s*)$/,n)}t.exports=n},{}],42:[function(e,t){"use strict";function n(e,t){var n=e.className;-1===n.indexOf(t)&&(e.className=(n+" "+t).replace(o,""))}function r(e,t){e.className=e.className.replace(t,"").replace(o,"").replace(a," ")}var o=/^\s+|\s+$/g,a=/\s+/g;t.exports={add:n,rm:r}},{}],43:[function(e,t){"use strict";function n(e,t,n){function r(e,t){return o=t,""}var o,a=e.toString();return a=a.replace(/\/([gim]*)$/,r),a=a.replace(/(^\/|\/$)/g,""),a=t+a+n,new RegExp(a,o)}t.exports=n},{}],44:[function(e,t){"use strict";function n(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")}t.exports=n},{}],45:[function(e,t){"use strict";function n(e,t,n){return function(o){function a(){return l.immediate=!1,i}function i(){e.focus(t.inputMode),s.setChunks(c),s.restore()}e.focus(t.inputMode),t.setCommandMode();var s=new r(e,t.inputMode),c=s.getChunks(),l={async:a,immediate:!0};n.call(l,o,t.inputMode,c),l.immediate&&i()}}var r=e("./InputState");t.exports=n},{"./InputState":37}],46:[function(e,t){(function(n){"use strict";function r(e,t,n){function r(e){a(e).focus()}function a(n){return"wysiwyg"===n?t:e}function p(n){return"wysiwyg"===n?t.innerHTML:e.value}function g(n,r){"wysiwyg"===n?t.innerHTML=r:e.value=r}function m(e){"wysiwyg"===e.mode?b(e):v(e)}function h(e){"wysiwyg"===e.mode?k(e):w(e)}function v(t){var n;if(void 0!==e.selectionStart)e.focus(),e.selectionStart=t.start,e.selectionEnd=t.end,e.scrollTop=t.scrollTop;else if(o.selection){if(o.activeElement&&o.activeElement!==e)return;e.focus(),n=e.createTextRange(),n.moveStart("character",-e.value.length),n.moveEnd("character",-e.value.length),n.moveEnd("character",t.end),n.moveStart("character",t.start),n.select()}}function w(t){void 0!==e.selectionStart?(t.start=e.selectionStart,t.end=e.selectionEnd):o.selection&&y(t)}function y(t){if(!o.activeElement||o.activeElement===e){t.text=i(e.value);var n=o.selection.createRange(),r=i(n.text),a="",c=a+r+a;n.text=c;var l=i(e.value);n.moveStart("character",-c.length),n.text=r,t.start=l.indexOf(a),t.end=l.lastIndexOf(a)-a.length;var u=t.text.length-i(e.value).length;u&&(n.moveStart("character",-r.length),r+=s("\n",u),t.end+=u,n.text=r),t.select()}}function b(e){function n(e,t){function n(e){return Math.max(0,Math.min(s,e))}var r=e.text.length,s=T(t).length,c=r+s;!i.startContainer&&c>=o&&(i.startContainer=t,i.startOffset=n(o-r)),!i.endContainer&&c>=a&&(i.endContainer=t,i.endOffset=n(a-r))}var r=e.cachedChunks||e.getChunks(),o=r.before.length,a=o+r.selection.length,i={};x(t.firstChild,n),t.focus(),u(i)}function k(e){function n(e,t){t===r.anchorNode&&(e.start=e.text.length+r.anchorOffset),t===r.focusNode&&(e.end=e.text.length+r.focusOffset)}var r=l(),o=x(t.firstChild,n),a=o.start||0,i=o.end||0;e.text=o.text,i>a?(e.start=a,e.end=i):(e.start=i,e.end=a)}function x(e,t,n,r){function o(e){x(e,t,a,!1)}var a=n||{text:""};if(!e)return a;var i=1===e.nodeType,s=3===e.nodeType;return t(a,e),s&&(a.text+=T(e)),i&&(e.outerHTML.match(f)&&(a.text+=RegExp.$1),c(e.childNodes).forEach(o),e.outerHTML.match(d)&&(a.text+=RegExp.$1)),r!==!1&&e.nextSibling?x(e.nextSibling,t,a):a}function T(e){return 3===e.nodeType?i(e.textContent||e.innerText||""):""}return{textarea:e,editable:t,droparea:n,focus:r,read:p,write:g,current:a,writeSelection:m,readSelection:h}}var o=n.document,a=e("seleccion"),i=e("./fixEOL"),s=e("./many"),c=e("./cast"),l=a.get,u=a.set,f=/^(<[^>]+(?: [^>]*)?>)/,d=/(<\/[^>]+>)$/;t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./cast":39,"./fixEOL":44,"./many":58,seleccion:29}],47:[function(e,t){"use strict";function n(e){return e.innerText||e.textContent}t.exports=n},{}],48:[function(e,t){"use strict";function n(){}var r=e("../chunks/trim");n.prototype.trim=r,n.prototype.findTags=function(){},n.prototype.skip=function(){},t.exports=n},{"../chunks/trim":41}],49:[function(e,t){"use strict";function n(e){o("blockquote",r.placeholders.quote,e)}var r=e("../strings"),o=e("./wrapping");t.exports=n},{"../strings":76,"./wrapping":56}],50:[function(e,t){"use strict";function n(e,t){o("bold"===t?"strong":"em",r.placeholders[t],e)}var r=e("../strings"),o=e("./wrapping");t.exports=n},{"../strings":76,"./wrapping":56}],51:[function(e,t){"use strict";function n(e){o("pre>=t?4:t-1;e.before=e.before.replace(o,""),e.after=e.after.replace(a,"")}function n(){e.selection||(e.selection=r.placeholders.heading),e.before+="

",e.after="

"+e.after}e.trim();var i=a.exec(e.after),s=o.exec(e.before);s&&i&&s[1]===i[1]?t():n()}var r=e("../strings"),o=/]*)?>$/,a=/^<\/h([1-6])>/;t.exports=n},{"../strings":76}],53:[function(e,t){"use strict";function n(e){e.before+="\n
\n",e.selection=""}t.exports=n},{}],54:[function(e,t){"use strict";function n(e,t){function n(){if(p){if(l.test(e.selection))return e.selection="",!0}else if(c.exec(e.after)&&s.exec(e.before))return e.before=e.before.replace(s,""),e.after=e.after.replace(c,""),!0}function u(n){function o(e){return e.href.length>0}function s(e){return e.title?' title="'+e.title+'"':""}function c(t,n){function r(e){return''}function o(e){return'"}function a(e){return" "+r(e)+o(e)}var i=e.after;e.before+=r(t),e.after=o(t),n.length&&(e.after+=n.map(a).join("")),e.after+=i}function l(n,r){function o(e){return'"}function a(){return""}function i(e){return" "+o(e)+a()}var c=e.after,l=t.classes.input.links,u=l?' class="'+l+'"':"";e.before+=o(n),e.after=a(),r.length&&(e.after+=r.map(i).join("")),e.after+=c}var u,g=n.definitions.map(i).filter(o);if(0===g.length)return void f();var m=g[0];return"attachment"===d?(u=t.mergeHtmlAndAttachment(e,m),e.before=u.before,e.selection=u.selection,e.after=u.after,f(),void r.fabricate(t.surface.textarea,"woofmark-mode-change")):(p?c(m,g.slice(1)):l(m,g.slice(1)),e.selection||(e.selection=a.placeholders[d]),void f())}var f,d=t.type,p="image"===d;"attachment"!==d&&e.trim(),n()||(f=this.async(),t.prompts.close(),(t.prompts[d]||t.prompts.link)(t,o(u)))}var r=e("crossvent"),o=e("../once"),a=e("../strings"),i=e("../chunks/parseLinkInput"),s=/]*)?>$/,c=/^<\/a>/,l=/]*)?\/>$/;t.exports=n},{"../chunks/parseLinkInput":40,"../once":69,"../strings":76,crossvent:10}],55:[function(e,t){"use strict";function n(e,t){function n(t){var n=t?"":u,o=t?"":f;e.before+=n+"
  • ",e.after="
  • "+o+e.after,e.selection||(e.selection=r.placeholders.listitem)}var l=t?"ol":"ul",u="<"+l+">",f="";if(e.trim(),o.test(e.before)&&a.test(e.after)&&l===RegExp.$1)return e.before=e.before.replace(o,""),void(e.after=e.after.replace(a,""));var d=e.before.lastIndexOf("");if(-1===g&&(g=e.after.indexOf("")),-1===g)return void n();var m=d>p?d:p;if(-1===m)return void n();var h=e.before.indexOf(">",m);if(-1===h)return void n();var v=e.before.substr(m,h-m+1);c.test(v)&&(l!==RegExp.$1?(e.before=e.before.substr(0,m)+"<"+l+e.before.substr(m+3),e.after=e.after.substr(0,g)+"]*)?>\s*]*)?>$/,a=/^<\/li>\s*<\/(ul|ol)>/,i=/]*)?>$/,s=/^<\/li( [^>]*)?>/,c=/^<(ul|ol)( [^>]*)?>$/;t.exports=n},{"../strings":76}],56:[function(e,t){"use strict";function n(e,t,n){function a(){n.selection.replace(/<(\/)?([^> ]+)( [^>]*)?>/gi,i)}function i(e,t,r,o,a){var i=o||"",s=!t,c=new RegExp("","i"),l=new RegExp("<"+r+"( [^>]*)?>","i");s&&!c.test(n.selection.substr(a))&&(n.selection+="",n.after=n.after.replace(/^(<\/[^>]+>)/,"$1<"+r+i+">")),t&&!l.test(n.selection.substr(0,a))&&(n.selection="<"+r+i+">"+n.selection,n.before=n.before.replace(/(<[^>]+(?: [^>]*)?>)$/,"$1"))}var s="<"+e,c="]*)?>$","i"),u=new RegExp("^"+c+">","i"),f=new RegExp(s+"( [^>]*)?>","ig"),d=new RegExp(c+"( [^>]*)?>","ig");n.trim();var p=u.exec(n.after),g=l.exec(n.before);if(g&&p)n.before=n.before.replace(l,""),n.after=n.after.replace(u,"");else{n.selection||(n.selection=t);var m=f.test(n.selection);m&&(n.selection=n.selection.replace(f,""),o(n,e)||(n.before+=s+">"));var h=d.test(n.selection);if(h&&(n.selection=n.selection.replace(d,""),o(n,e)||(n.after=c+">"+n.after)),m||h)return void a();o(n,e)?(l.test(n.before)?n.before=n.before.replace(l,""):n.before+=c+">",n.after=u.test(n.after)?n.after.replace(u,""):s+">"+n.after):r(n,e)||(n.after=c+">"+n.after,n.before+=s+">"),a()}}function r(e,t){var n=new RegExp("$","i"),r=new RegExp("^<"+t+"(?: [^>]*)?>","i"),o=n.test(e.before)&&r.test(e.after);return o&&(e.before=e.before.replace(n,""),e.after=e.after.replace(r,"")),o}function o(e,t){function n(e,t){var n=e.match(t);return n?n.length:0}var r=new RegExp("<"+t+"(?: [^>]*)?>","ig"),o=new RegExp("","ig"),a=n(e.before,r),i=n(e.after,r),s=n(e.before,o),c=n(e.after,o),l=a-s>0,u=c-i>0;return l&&u}t.exports=n},{}],57:[function(e,t){(function(e){"use strict";function n(t){return e.getComputedStyle?"none"!==e.getComputedStyle(t,null).getPropertyValue("display"):t.currentStyle?"none"!==t.currentStyle.display:void 0}t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],58:[function(e,t){"use strict";function n(e,t){return new Array(t+1).join(e)}t.exports=n},{}],59:[function(e,t){"use strict";function n(){}var r=e("../many"),o=e("../extendRegExp"),a=e("../chunks/trim");n.prototype.trim=a,n.prototype.findTags=function(e,t){function n(e){return i.startTag=i.startTag+e,""}function r(e){return i.endTag=e+i.endTag,""}var a,i=this;e&&(a=o(e,"","$"),this.before=this.before.replace(a,n),a=o(e,"^",""),this.selection=this.selection.replace(a,n)),t&&(a=o(t,"","$"),this.selection=this.selection.replace(a,r),a=o(t,"^",""),this.after=this.after.replace(a,r))},n.prototype.skip=function(e){function t(e,t,o){var a=n.any?"\\n*":r("\\n?",t),i=r("\n",t);return e.replace(new RegExp(a+o),i)}var n=e||{},o="before"in n?n.before:1,a="after"in n?n.after:1;this.selection=this.selection.replace(/(^\n*)/,""),this.startTag=this.startTag+RegExp.$1,this.selection=this.selection.replace(/(\n*$)/,""),this.endTag=this.endTag+RegExp.$1,this.startTag=this.startTag.replace(/(^\n*)/,""),this.before=this.before+RegExp.$1,this.endTag=this.endTag.replace(/(\n*$)/,""),this.after=this.after+RegExp.$1,this.before&&(this.before=t(this.before,++o,"$")),this.after&&(this.after=t(this.after,++a,""))},t.exports=n},{"../chunks/trim":41,"../extendRegExp":43,"../many":58}],60:[function(e,t){"use strict";function n(e){function t(t,n,r,o){return e.before+=n,e.after=o+e.after,r}function n(t,n){return e.selection=n+e.selection,""}function d(t,n){return e.startTag+=n,""}function p(){for(var t,n=e.before.replace(/\n$/,"").split("\n"),r=!1,o=0;o0,/^>/.test(h)?(t=!0,!r&&h.length>1&&(r=!0)):t=/^[ \t]*$/.test(h)?!0:r,t?v+=h+"\n":(w+=v+h,v="\n");/(^|\n)>/.test(v)||(w+=v,v="")}function g(t){return e.endTag=t,""}function m(t){function n(e,t){return"\n"+t.replace(/^[ ]{0,3}>?[ \t]*$/gm,r)+"\n"}var r=t?"> ":"";e.startTag&&(e.startTag=e.startTag.replace(f,n)),e.endTag&&(e.endTag=e.endTag.replace(u,n))}var h,v="",w="";e.selection=e.selection.replace(c,t),e.before=e.before.replace(i,n),e.selection=e.selection.replace(/^(\s|>)+$/,""),e.selection=e.selection||r.placeholders.quote,e.before&&p(),e.startTag=v,e.before=w,e.after&&(e.after=e.after.replace(/^\n?/,"\n")),e.after=e.after.replace(l,g),/^(?![ ]{0,3}>)/m.test(e.selection)?(o.wrap(e,a.lineLength-2),e.selection=e.selection.replace(/^/gm,"> "),m(!0),e.skip()):(e.selection=e.selection.replace(/^[ ]{0,3}> ?/gm,""),o.unwrap(e),m(!1),!/^(\n|^)[ ]{0,3}>/.test(e.selection)&&e.startTag&&(e.startTag=e.startTag.replace(/\n{0,2}$/,"\n\n")),!/(\n|^)[ ]{0,3}>.*$/.test(e.selection)&&e.endTag&&(e.endTag=e.endTag.replace(/^\n{0,2}/,"\n\n"))),/\n/.test(e.selection)||(e.selection=e.selection.replace(s,d))}var r=e("../strings"),o=e("./wrapping"),a=e("./settings"),i=/(>[ \t]*)$/,s=/^(>[ \t]*)/,c=/^(\n*)([^\r]+?)(\n*)$/,l=/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/,u=/^\n((>|\s)*)\n/,f=/\n((>|\s)*)\n$/;t.exports=n},{"../strings":76,"./settings":67,"./wrapping":68}],61:[function(e,t){"use strict";function n(e,t){var n=/\n{2,}/g,s="bold"===t?2:1;e.trim(),e.selection=e.selection.replace(n,"\n");var c,l=o.exec(e.before)[0],u=r.exec(e.after)[0],f="\\*{"+s+"}",d=Math.min(l.length,u.length);d>=s&&(2!==d||1!==s)?(e.before=e.before.replace(new RegExp(f+"$",""),""),e.after=e.after.replace(new RegExp("^"+f,""),"")):!e.selection&&u?(e.after=e.after.replace(r,""),e.before=e.before.replace(a,"")+u+RegExp.$1):(e.selection||u||(e.selection=i.placeholders[t]),c=1===s?"*":"**",e.before=e.before+c,e.after=c+e.after)}var r=/^(\**)/,o=/(\**$)/,a=/(\s?)$/,i=e("../strings");t.exports=n},{"../strings":76}],62:[function(e,t){"use strict";function n(e,t){function n(){e.trim(),e.findTags(s,s),e.startTag||e.endTag?e.endTag&&!e.startTag?(e.before+=e.endTag,e.endTag=""):e.startTag=e.endTag="":(e.startTag=e.endTag="`",e.selection||(e.selection=r.placeholders.code))}function d(n){function o(t){return e.selection=t+e.selection,""}return n?(e.before=e.before.replace(c,""),void(e.after=e.after.replace(u,""))):(e.before=e.before.replace(/[ ]{4}|```[a-z]*\n$/,o),e.skip({before:/(\n|^)(\t|[ ]{4,}|```[a-z]*\n).*\n$/.test(e.before)?0:1,after:/^\n(\t|[ ]{4,}|\n```)/.test(e.after)?0:1}),void(e.selection?l.test(e.selection)&&f.test(e.selection)?e.selection=e.selection.replace(/(^```[a-z]*\n)|(```$)/g,""):/^[ ]{0,3}\S/m.test(e.selection)?t.fencing?(e.before+="```\n",e.after="\n```"+e.after):p?e.selection=e.selection.replace(/^/gm," "):e.before+=" ":e.selection=e.selection.replace(/^(?:[ ]{4}|[ ]{0,3}\t|```[a-z]*)/gm,""):(t.fencing?(e.startTag="```\n",e.endTag="\n```"):e.startTag=" ",e.selection=r.placeholders.code)))}var p=i.test(e.selection),g=a.test(e.after),m=o.test(e.before),h=c.test(e.before)&&u.test(e.after);h||p||!m&&!g?d(h):n()}var r=e("../strings"),o=/\S[ ]*$/,a=/^[ ]*\S/,i=/\n/,s=/`/,c=/```[a-z]*\n?$/,l=/^```[a-z]*\n/,u=/^\n?```/,f=/\n```$/;t.exports=n},{"../strings":76}],63:[function(e,t){"use strict";function n(e){var t=0;if(e.selection=e.selection.replace(/\s+/g," ").replace(/(^\s+|\s+$)/g,""),!e.selection)return e.startTag="# ",e.selection=o.placeholders.heading,e.endTag="",void e.skip({before:1,after:1});e.findTags(/#+[ ]*/,/[ ]*#+/),/#+/.test(e.startTag)&&(t=RegExp.lastMatch.length),e.startTag=e.endTag="",e.findTags(null,/\s?(-+|=+)/),/=+/.test(e.endTag)&&(t=1),/-+/.test(e.endTag)&&(t=2),e.startTag=e.endTag="",e.skip({before:1,after:1});var n=2>t?4:t-1;n>0&&(e.startTag=r("#",n)+" ")}var r=e("../many"),o=e("../strings");t.exports=n},{"../many":58,"../strings":76}],64:[function(e,t){"use strict";function n(e){e.startTag="----------\n",e.selection="",e.skip({left:2,right:1,any:!0})}t.exports=n},{}],65:[function(e,t){"use strict";function n(e,t){function n(e,n,r,o,a){return t[n]=e.replace(/\s*$/,""),o?(t[n]=e.replace(/["(](.+?)[")]$/,""),o+a):""}return c.lastIndex=0,e.replace(c,n)}function r(e){function t(e){l.test(e)&&r(f[e])}function r(e){u++,e=e.replace(/^[ ]{0,3}\[(attachment-)?(\d+)\]:/," [$1"+u+"]:"),d.push(e)}function o(e,t,n,a,i,s){return n=n.replace(c,o),f[i]?(r(f[i]),t+n+a+u+s):e}var a=e.chunks,i=e.definition,s=e.attachment,c=/(\[)((?:\[[^\]]*\]|[^\[\]])*)(\][ ]?(?:\n[ ]*)?\[)((?:attachment-)?\d+)(\])/g,u=0,f={},d=[];a.before=n(a.before,f),a.selection=n(a.selection,f),a.after=n(a.after,f),a.before=a.before.replace(c,o),i?s||r(i):a.selection=a.selection.replace(c,o);var p=u;return a.after=a.after.replace(c,o),a.after&&(a.after=a.after.replace(/\n*$/,"")),a.after||(a.selection=a.selection.replace(/\n*$/,"")),u=0,Object.keys(f).forEach(t),s&&r(i),a.after+="\n\n"+d.join("\n"),p}function o(e,t){function n(t){function n(n,o){function a(){e.startTag=l?"![":"[",e.endTag="]["+d+"]",e.selection||(e.selection=i.placeholders[c]),o0}var u=t.definitions.map(s).filter(a);u.forEach(n),o()}var o,c=t.type,l="image"===c;return e.trim(),e.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/),e.endTag.length>1&&e.startTag.length>0?(e.startTag=e.startTag.replace(/!?\[/,""),e.endTag="",void r({chunks:e})):(e.selection=e.startTag+e.selection+e.endTag,e.startTag=e.endTag="",/\n\n/.test(e.selection)?void r({chunks:e}):(o=this.async(),t.prompts.close(),void(t.prompts[c]||t.prompts.link)(t,a(n))))}var a=e("../once"),i=e("../strings"),s=e("../chunks/parseLinkInput"),c=/^[ ]{0,3}\[((?:attachment-)?\d+)\]:[ \t]*\n?[ \t]*?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm,l=/^attachment-(\d+)$/i;t.exports=o},{"../chunks/parseLinkInput":40,"../once":69,"../strings":76}],66:[function(e,t){"use strict";function n(e){return" "+e+" "}function r(e,t){function r(e){return u.test(e)&&(h=RegExp.$1),w=f.test(e)?1:0,g(e)}function d(e){return y=f.test(e)?1:0,g(e)}function p(){return n(t?v++ +".":h)}function g(e){var t=/^[ ]{0,3}([*+-]|\d+[.])\s/gm;return e.replace(t,p)}var m,h="-",v=1,w=1,y=1;if(e.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null),!e.before||/\n$/.test(e.before)||/^\n/.test(e.startTag)||(e.before+=e.startTag,e.startTag=""),!e.startTag||(m=/\d+[.]/.test(e.startTag),e.startTag="",e.selection=e.selection.replace(/\n[ ]{4}/g,"\n"),i.unwrap(e),e.skip(),m&&(e.after=e.after.replace(l,g)),t!==m)){e.before=e.before.replace(c,r),e.selection||(e.selection=a.placeholders.listitem);var b=p(),k=o(" ",b.length);e.after=e.after.replace(l,d),e.trim(!0),e.skip({before:w,after:y,any:!0}),e.startTag=b,i.wrap(e,s.lineLength-b.length),e.selection=e.selection.replace(/\n/g,"\n"+k)}}var o=e("../many"),a=e("../strings"),i=e("./wrapping"),s=e("./settings"),c=/(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/,l=/^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/,u=/^\s*([*+-])/,f=/[^\n]\n\n[^\n]/;t.exports=r},{"../many":58,"../strings":76,"./settings":67,"./wrapping":68}],67:[function(e,t){"use strict";t.exports={lineLength:72}},{}],68:[function(e,t){"use strict";function n(e,t){function n(e,t){return a.test(e)?e:t+"\n"}var o=new RegExp("(.{1,"+t+"})( +|$\\n?)","gm");r(e),e.selection=e.selection.replace(o,n).replace(s,"")}function r(e){i.lastIndex=0,e.selection=e.selection.replace(i,"$1 $2")}var o="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)",a=new RegExp("^"+o,""),i=new RegExp("([^\\n])\\n(?!(\\n|"+o+"))","g"),s=/\s+$/;t.exports={wrap:n,unwrap:r}},{}],69:[function(e,t){"use strict";function n(e){var t;return function(){return t?void 0:(t=!0,e.apply(this,arguments))}}t.exports=n},{}],70:[function(e,t){"use strict";function n(e){var t,n=[],o=i.getElementsByTagName("*");for(t in o)-1!==r(o[t].className).indexOf(r(e))&&n.push(o[t]);return n}function r(e){return" "+e+" "}function o(){a(i.body.querySelectorAll?i.body.querySelectorAll(".wk-prompt"):n("wk-prompt"))}function a(e){var t,n=e.length;for(t=0;n>t;t++)e[t].parentElement.removeChild(e[t])}var i=document;t.exports=o},{}],71:[function(e,t){"use strict";function n(e,t){function n(n){t[n]&&(e[n].className+=" "+t[n])}Object.keys(e).forEach(n)}function r(e,t){function r(){O.input.focus()}function m(e){var t=e.which||e.keyCode;t===u&&(v(),e.preventDefault())}function h(e){var t=e.which||e.keyCode;t===f&&(w(),e.preventDefault())}function v(){w(),t({definitions:[O.input.value]})}function w(){M&&y(!0),O.dialog.parentElement&&O.dialog.parentElement.removeChild(O.dialog),e.surface.focus(e.mode)}function y(e){var t=e?"remove":"add";o[t](g,"dragenter",b),o[t](g,"dragend",k),o[t](g,"mouseout",k)}function b(){s.add(S.area,d),s.add(S.area,p)}function k(){s.rm(S.area,d),s.rm(S.area,p),l.stop(e.surface.droparea)}function x(){function r(n){function r(e){return e.href+' "'+e.title+'"'}var o=n[0];O.input.value=o.href+' "'+o.title+'"',w(),t({definitions:n.map(r),attachment:"attachment"===e.type})}S=i.uploads(O,c.prompts.types+(M.restriction||e.type+"s")),y(),o.add(S.area,"dragover",T,!1),o.add(S.area,"drop",E,!1),n(S,e.classes.prompts);var l=a.setup(S.fileinput,{method:M.method,formData:M.formData,fieldKey:M.fieldKey,xhrOptions:M.xhrOptions,endpoint:M.url,validate:M.validate||"image"});return l.on("started",function(){s.rm(S.failed,"wk-prompt-error-show"),s.rm(S.warning,"wk-prompt-error-show")}),l.on("valid",function(){s.add(S.area,"wk-prompt-uploading")}),l.on("invalid",function(){s.add(S.warning,"wk-prompt-error-show")}),l.on("error",function(){s.add(S.failed,"wk-prompt-error-show")}),l.on("success",r),l.on("ended",function(){s.rm(S.area,"wk-prompt-uploading")}),l}function T(e){C(e),e.dataTransfer.dropEffect="copy"}function E(e){k(),C(e),$.submit(e.dataTransfer.files)}function C(e){e.stopPropagation(),e.preventDefault()}var S,R=c.prompts[e.type],O=i({id:"wk-prompt-"+e.type,title:R.title,description:R.description,placeholder:R.placeholder});o.add(O.cancel,"click",w),o.add(O.close,"click",w),o.add(O.ok,"click",v),o.add(O.input,"keypress",m),o.add(O.dialog,"keydown",h),n(O,e.classes.prompts);var M=e.upload;"string"==typeof M&&(M={url:M});var $=null;M&&($=x(),e.autoUpload&&$.submit(e.autoUpload)),setTimeout(r,0)}var o=e("crossvent"),a=e("bureaucracy"),i=e("./render"),s=e("../classes"),c=e("../strings"),l=e("../uploads"),u=13,f=27,d="wk-dragging",p="wk-prompt-upload-dragging",g=document.documentElement;t.exports=r},{"../classes":42,"../strings":76,"../uploads":77,"./render":72,bureaucracy:5,crossvent:10}],72:[function(e,t){(function(n){"use strict";function r(e,t,n){var r=d.createElement(e);return r.className=t,n&&c(r,n),r}function o(e){var t={dialog:r("article","wk-prompt "+e.id),close:r("a","wk-prompt-close"),header:r("header","wk-prompt-header"),h1:r("h1","wk-prompt-title",e.title),section:r("section","wk-prompt-body"),desc:r("p","wk-prompt-description",e.description),inputContainer:r("div","wk-prompt-input-container"),input:r("input","wk-prompt-input"),cancel:r("button","wk-prompt-cancel","Cancel"),ok:r("button","wk-prompt-ok","Ok"),footer:r("footer","wk-prompt-buttons")};return t.ok.type="button",t.header[f](t.h1),t.section[f](t.desc),t.section[f](t.inputContainer),t.inputContainer[f](t.input),t.input.placeholder=e.placeholder,t.cancel.type="button",t.footer[f](t.cancel),t.footer[f](t.ok),t.dialog[f](t.close),t.dialog[f](t.header),t.dialog[f](t.section),t.dialog[f](t.footer),d.body[f](t.dialog),t}function a(e,t){function n(){l.add(d.upload,"wk-focused")}function o(){l.rm(d.upload,"wk-focused")}var a="wk-prompt-fileupload",d={area:r("section","wk-prompt-upload-area"),warning:r("p","wk-prompt-error wk-warning",t),failed:r("p","wk-prompt-error wk-failed",u.prompts.uploadfailed),upload:r("label","wk-prompt-upload"),uploading:r("span","wk-prompt-progress",u.prompts.uploading),drop:r("span","wk-prompt-drop",u.prompts.drop),dropicon:r("p","wk-drop-icon wk-prompt-drop-icon"),browse:r("span","wk-prompt-browse",u.prompts.browse),dragdrop:r("p","wk-prompt-dragdrop",u.prompts.drophint),fileinput:r("input",a)};return d.area[f](d.drop),d.area[f](d.uploading),d.area[f](d.dropicon),d.upload[f](d.browse),d.upload[f](d.fileinput),d.fileinput.id=a,d.fileinput.type="file",d.fileinput.multiple="multiple",e.dialog.className+=" wk-prompt-uploads",e.inputContainer.className+=" wk-prompt-input-container-uploads",e.input.className+=" wk-prompt-input-uploads",e.section.insertBefore(d.warning,e.inputContainer),e.section.insertBefore(d.failed,e.inputContainer),e.section[f](d.upload),e.section[f](d.dragdrop),e.section[f](d.area),c(e.desc,s(e.desc)+u.prompts.upload),i.add(d.fileinput,"focus",n),i.add(d.fileinput,"blur",o),d}var i=e("crossvent"),s=e("../getText"),c=e("../setText"),l=e("../classes"),u=e("../strings"),f="appendChild",d=n.document;o.uploads=a,t.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../classes":42,"../getText":47,"../setText":75,"../strings":76,crossvent:10}],73:[function(e,t){"use strict";function n(e){function t(){var t=e.reset().inputState,n=t.getChunks(),r=n.before.length,o=r+n.selection.length;return[[r,a],[o,i]]}function n(){var t=e.inputState,n=t.getChunks(),o=n.before+n.selection+n.after,c=o.lastIndexOf(a),l=o.lastIndexOf(i)+i.length,u=-1===c?0:c,f=-1===l?0:l;n.before=o.substr(0,u).replace(s,""),n.selection=o.substr(u,f-u).replace(s,""),n.after=o.substr(l).replace(s,"");var d=e.surface.current(e.inputMode),p=r(d,{caret:!0,autoupdateToCaret:!1,tracking:!1});t.setChunks(n),t.restore(!1),t.scrollTop=d.scrollTop=p.read().y-d.getBoundingClientRect().top-50,p.destroy()}var o=Math.random().toString(18).substr(2).replace(/\d+/g,""),a="WoofmarkSelectionOpenMarker"+o,i="WoofmarkSelectionCloseMarker"+o,s=new RegExp(a+"|"+i,"g");return{markers:t(),unmark:n}}var r=e("bullseye");t.exports=n},{bullseye:2}],74:[function(e,t){"use strict";function n(e,t){o(e,a.buttons[t]||t)}function r(e,t){o(e,a.modes[t]||t)}var o=e("./setText"),a=e("./strings");t.exports={modes:r,commands:n}},{"./setText":75,"./strings":76}],75:[function(e,t){"use strict";function n(e,t){e.innerText=e.textContent=t}t.exports=n},{}],76:[function(e,t){"use strict";t.exports={placeholders:{bold:"strong text",italic:"emphasized text",quote:"quoted text",code:"code goes here",listitem:"list item",heading:"Heading Text",link:"link text",image:"image description",attachment:"attachment description"},titles:{bold:"Strong Ctrl+B",italic:"Emphasis Ctrl+I",quote:"Blockquote
    Ctrl+J",code:"Code Sample
     Ctrl+E",ol:"Numbered List 
      Ctrl+O",ul:"Bulleted List