var wysihtml5,Base,Handlebars;Object.defineProperty&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(Element.prototype,"textContent")&&!Object.getOwnPropertyDescriptor(Element.prototype,"textContent").get&&!function(){var n=Object.getOwnPropertyDescriptor(Element.prototype,"innerText");Object.defineProperty(Element.prototype,"textContent",{get:function(){return n.get.call(this)},set:function(t){return n.set.call(this,t)}})}();Array.isArray||(Array.isArray=function(n){return"[object Array]"===Object.prototype.toString.call(n)});wysihtml5={version:"0.4.15",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"﻿",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,DELETE_KEY:46},function(n,t){"function"==typeof define&&define.amd?define(n):t.rangy=n()}(function(){function t(n,t){var i=typeof n[t];return i==ot||!(i!=rt||!n[t])||"unknown"==i}function u(n,t){return!(typeof n[t]!=rt||!n[t])}function b(n,t){return typeof n[t]!=h}function c(n){return function(t,i){for(var r=i.length;r--;)if(!n(t,i[r]))return!1;return!0}}function k(n){return n&&p(n,lt)&&w(n,ct)}function d(n){return u(n,"body")?n.body:n.getElementsByTagName("body")[0]}function l(n){u(window,"console")&&t(window.console,"log")&&window.console.log(n)}function g(n,t){t?window.alert(n):l(n)}function i(t){n.initialized=!0;n.supported=!1;g("Rangy is not supported on this page in your browser. Reason: "+t,n.config.alertOnFail)}function ut(t){g("Rangy warning: "+t,n.config.alertOnWarn)}function nt(n){return n.message||n.description||n+""}function a(){var e,s,h,u,a,v,y,c,b;if(!n.initialized){if(s=!1,h=!1,t(document,"createRange")&&(e=document.createRange(),p(e,ht)&&w(e,st)&&(s=!0)),u=d(document),!u||"body"!=u.nodeName.toLowerCase())return i("No body element found"),void 0;if(u&&t(u,"createTextRange")&&(e=u.createTextRange(),k(e)&&(h=!0)),!s&&!h)return i("Neither Range nor TextRange are available"),void 0;n.initialized=!0;n.features={implementsDomRange:s,implementsTextRange:h};for(y in r)(a=r[y])instanceof f&&a.init(a,n);for(c=0,b=o.length;b>c;++c)try{o[c](n)}catch(g){v="Rangy init listener threw an exception. Continuing. Detail: "+nt(g);l(v)}}}function ft(n){n=n||window;a();for(var t=0,i=s.length;i>t;++t)s[t](n)}function f(n,t,i){this.name=n;this.dependencies=t;this.initialized=!1;this.supported=!1;this.initializer=i}function tt(t,i,u,e){var o=new f(i,u,function(t){if(!t.initialized){t.initialized=!0;try{e(n,t);t.supported=!0}catch(r){var u="Module '"+i+"' failed to load: "+nt(r);l(u)}}});r[i]=o}function it(){}function et(){}var e,o,s,v,y,rt="object",ot="function",h="undefined",st=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ht=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],ct=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],lt=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],p=c(t),at=c(u),w=c(b),r={},n={version:"1.3alpha.20140804",initialized:!1,supported:!0,util:{isHostMethod:t,isHostObject:u,isHostProperty:b,areHostMethods:p,areHostObjects:at,areHostProperties:w,isTextRange:k,getBody:d},features:{},modules:r,config:{alertOnFail:!0,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==h?!0:rangyAutoInitialize}};return n.fail=i,n.warn=ut,{}.hasOwnProperty?n.util.extend=function(t,i,r){var f,u;for(var e in i)i.hasOwnProperty(e)&&(f=t[e],u=i[e],r&&null!==f&&"object"==typeof f&&null!==u&&"object"==typeof u&&n.util.extend(f,u,!0),t[e]=u);return i.hasOwnProperty("toString")&&(t.toString=i.toString),t}:i("hasOwnProperty not supported"),function(){var i,t,r=document.createElement("div");r.appendChild(document.createElement("span"));i=[].slice;try{1==i.call(r.childNodes,0)[0].nodeType&&(t=function(n){return i.call(n,0)})}catch(u){}t||(t=function(n){for(var r=[],t=0,i=n.length;i>t;++t)r[t]=n[t];return r});n.util.toArray=t}(),t(document,"addEventListener")?e=function(n,t,i){n.addEventListener(t,i,!1)}:t(document,"attachEvent")?e=function(n,t,i){n.attachEvent("on"+t,i)}:i("Document does not have required addEventListener or attachEvent method"),n.util.addListener=e,o=[],n.init=a,n.addInitListener=function(t){n.initialized?t(n):o.push(t)},s=[],n.addShimListener=function(n){s.push(n)},n.shim=n.createMissingNativeApi=ft,f.prototype={init:function(){for(var n,i,e=this.dependencies||[],t=0,u=e.length;u>t;++t){if(i=e[t],n=r[i],!(n&&n instanceof f))throw Error("required module '"+i+"' not found");if(n.init(),!n.supported)throw Error("required module '"+i+"' not supported");}this.initializer(this)},fail:function(n){throw this.initialized=!0,this.supported=!1,Error("Module '"+this.name+"' failed to load: "+n);},warn:function(t){n.warn("Module "+this.name+": "+t)},deprecationNotice:function(t,i){n.warn("DEPRECATED: "+t+" in module "+this.name+"is deprecated. Please use "+i+" instead")},createError:function(n){return Error("Error in Rangy "+this.name+" module: "+n)}},n.createModule=function(t){var i,r,u;2==arguments.length?(i=arguments[1],r=[]):(i=arguments[2],r=arguments[1]);u=tt(!1,t,r,i);n.initialized&&u.init()},n.createCoreModule=function(n,t,i){tt(!0,n,t,i)},n.RangePrototype=it,n.rangePrototype=new it,n.selectionPrototype=new et,v=!1,y=function(){v||(v=!0,!n.initialized&&n.config.autoInitialize&&a())},typeof window==h?(i("No window found"),void 0):typeof document==h?(i("No document found"),void 0):(t(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",y,!1),e(window,"load",y),n.createCoreModule("DomUtil",[],function(n,t){function rt(n){var t;return typeof n.namespaceURI==r||null===(t=n.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function ut(n){var t=n.parentNode;return 1==t.nodeType?t:null}function u(n){for(var t=0;n=n.previousSibling;)++t;return t}function ft(n){switch(n.nodeType){case 7:case 10:return 0;case 3:case 8:return n.length;default:return n.childNodes.length}}function y(n,t){for(var r=[],i=n;i;i=i.parentNode)r.push(i);for(i=t;i;i=i.parentNode)if(a(r,i))return i;return null}function p(n,t,i){for(var r=i?t:t.parentNode;r;){if(r===n)return!0;r=r.parentNode}return!1}function et(n,t){return p(n,t,!0)}function f(n,t,i){for(var u,r=i?n:n.parentNode;r;){if(u=r.parentNode,u===t)return r;r=u}return null}function w(n){var t=n.nodeType;return 3==t||4==t||8==t}function ot(n){if(!n)return!1;var t=n.nodeType;return 3==t||8==t}function b(n,t){var i=t.nextSibling,r=t.parentNode;return i?r.insertBefore(n,i):r.appendChild(n),n}function st(n,t,i){var e,r,f=n.cloneNode(!1);if(f.deleteData(0,t),n.deleteData(t,n.length-t),b(f,n),i)for(e=0;r=i[e++];)r.node==n&&r.offset>t?(r.node=f,r.offset-=t):r.node==n.parentNode&&r.offset>u(n)&&++r.offset;return f}function e(n){if(9==n.nodeType)return n;if(typeof n.ownerDocument!=r)return n.ownerDocument;if(typeof n.document!=r)return n.document;if(n.parentNode)return e(n.parentNode);throw t.createError("getDocument: no document found for node");}function k(n){var i=e(n);if(typeof i.defaultView!=r)return i.defaultView;if(typeof i.parentWindow!=r)return i.parentWindow;throw t.createError("Cannot get a window object for node");}function d(n){if(typeof n.contentDocument!=r)return n.contentDocument;if(typeof n.contentWindow!=r)return n.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element");}function ht(n){if(typeof n.contentWindow!=r)return n.contentWindow;if(typeof n.contentDocument!=r)return n.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element");}function g(n){return n&&i.isHostMethod(n,"setTimeout")&&i.isHostObject(n,"document")}function ct(n,t,r){var u;if(n?i.isHostProperty(n,"nodeType")?u=1==n.nodeType&&"iframe"==n.tagName.toLowerCase()?d(n):e(n):g(n)&&(u=n.document):u=document,!u)throw t.createError(r+"(): Parameter must be a Window object or DOM node");return u}function lt(n){for(var t;t=n.parentNode;)n=t;return n}function at(n,i,r,e){var h,o,c,l,s;if(n==r)return i===e?0:e>i?-1:1;if(h=f(r,n,!0))return i<=u(h)?-1:1;if(h=f(n,r,!0))return u(h)<e?-1:1;if(o=y(n,r),!o)throw Error("comparePoints error: nodes have no common ancestor");if(c=n===o?o:f(n,o,!0),l=r===o?o:f(r,o,!0),c===l)throw t.createError("comparePoints got to case 4 and childA and childB are the same!");for(s=o.firstChild;s;){if(s===c)return-1;if(s===l)return 1;s=s.nextSibling}}function h(n){var t;try{return t=n.parentNode,!1}catch(i){return!0}}function nt(n){if(!n)return"[No node]";if(s&&h(n))return"[Broken node]";if(w(n))return'"'+n.data+'"';if(1==n.nodeType){var t=n.id?' id="'+n.id+'"':"";return"<"+n.nodeName+t+">[index:"+u(n)+",length:"+n.childNodes.length+"]["+(n.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return n.nodeName}function vt(n){for(var t,i=e(n).createDocumentFragment();t=n.firstChild;)i.appendChild(t);return i}function tt(n){this.root=n;this._next=n}function yt(n){return new tt(n)}function it(n,t){this.node=n;this.offset=t}function c(n){this.code=this[n];this.codeName=n;this.message="DOMException: "+this.codeName}var o,l,a,s,v,r="undefined",i=n.util;i.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method");i.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");o=document.createElement("div");i.areHostMethods(o,["insertBefore","appendChild","cloneNode"]||!i.areHostObjects(o,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation");i.isHostProperty(o,"innerHTML")||t.fail("Element is missing innerHTML property");l=document.createTextNode("test");i.areHostMethods(l,["splitText","deleteData","insertData","appendData","cloneNode"]||!i.areHostObjects(o,["previousSibling","nextSibling","childNodes","parentNode"])||!i.areHostProperties(l,["data"]))||t.fail("Incomplete Text Node implementation");a=function(n,t){for(var i=n.length;i--;)if(n[i]===t)return!0;return!1};s=!1,function(){var i,t=document.createElement("b");t.innerHTML="1";i=t.firstChild;t.innerHTML="<br>";s=h(i);n.features.crashyTextNodes=s}();typeof getComputedStyle!=r?v=function(n,t){return k(n).getComputedStyle(n,null)[t]}:typeof document.documentElement.currentStyle!=r?v=function(n,t){return n.currentStyle[t]}:t.fail("No means of obtaining computed style properties found");tt.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var t,i,n=this._current=this._next;if(this._current)if(t=n.firstChild,t)this._next=t;else{for(i=null;n!==this.root&&!(i=n.nextSibling);)n=n.parentNode;this._next=i}return this._current},detach:function(){this._current=this._next=this.root=null}};it.prototype={equals:function(n){return!!n&&this.node===n.node&&this.offset==n.offset},inspect:function(){return"[DomPosition("+nt(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}};c.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24};c.prototype.toString=function(){return this.message};n.dom={arrayContains:a,isHtmlNamespace:rt,parentElement:ut,getNodeIndex:u,getNodeLength:ft,getCommonAncestor:y,isAncestorOf:p,isOrIsAncestorOf:et,getClosestAncestorIn:f,isCharacterDataNode:w,isTextOrCommentNode:ot,insertAfter:b,splitDataNode:st,getDocument:e,getWindow:k,getIframeWindow:ht,getIframeDocument:d,getBody:i.getBody,isWindow:g,getContentDocument:ct,getRootContainer:lt,comparePoints:at,isBrokenNode:h,inspectNode:nt,getComputedStyleProperty:v,fragmentFromNodeChildren:vt,createIterator:yt,DomPosition:it};n.DOMException=c}),n.createCoreModule("DomRange",["DomUtil"],function(n){function l(n,t){return 3!=n.nodeType&&(y(n,t.startContainer)||y(n,t.endContainer))}function e(n){return n.document||it(n.startContainer)}function gt(n){return new rr(n.parentNode,c(n))}function rt(n){return new rr(n.parentNode,c(n)+1)}function ni(n,i,u){var f=11==n.nodeType?n.firstChild:n;return r(i)?u==i.length?t.insertAfter(n,i):i.parentNode.insertBefore(n,0==u?i:wt(i,u)):u>=i.childNodes.length?i.appendChild(n):i.insertBefore(n,i.childNodes[u]),f}function ti(n,t,r){if(i(n),i(t),e(t)!=e(n))throw new f("WRONG_DOCUMENT_ERR");var o=u(n.startContainer,n.startOffset,t.endContainer,t.endOffset),s=u(n.endContainer,n.endOffset,t.startContainer,t.startOffset);return r?0>=o&&s>=0:0>o&&s>0}function ii(n){for(var i,t,u,r=e(n.range).createDocumentFragment();t=n.next();){if(i=n.isPartiallySelectedSubtree(),t=t.cloneNode(!i),i&&(u=n.getSubtreeIterator(),t.appendChild(ii(u)),u.detach()),10==t.nodeType)throw new f("HIERARCHY_REQUEST_ERR");r.appendChild(t)}return r}function w(n,i,r){var e,o,u,f;for(r=r||{stop:!1};u=n.next();)if(n.isPartiallySelectedSubtree()){if(i(u)===!1)return r.stop=!0,void 0;if(f=n.getSubtreeIterator(),w(f,i,r),f.detach(),r.stop)return}else for(e=t.createIterator(u);o=e.next();)if(i(o)===!1)return r.stop=!0,void 0}function ri(n){for(var t;n.next();)n.isPartiallySelectedSubtree()?(t=n.getSubtreeIterator(),ri(t),t.detach()):n.remove()}function ui(n){for(var t,i,r=e(n.range).createDocumentFragment();t=n.next();){if(n.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),i=n.getSubtreeIterator(),t.appendChild(ui(i)),i.detach()):n.remove(),10==t.nodeType)throw new f("HIERARCHY_REQUEST_ERR");r.appendChild(t)}return r}function ur(n,t,i){var f,u,e=!(!t||!t.length),s=!!i;return e&&(f=RegExp("^("+t.join("|")+")$")),u=[],w(new o(n,!1),function(t){var o,h;(!e||f.test(t.nodeType))&&(!s||i(t))&&(o=n.startContainer,t==o&&r(o)&&n.startOffset==o.length||(h=n.endContainer,t==h&&r(h)&&0==n.endOffset||u.push(t)))}),u}function fi(n){var i=void 0===n.getName?"Range":n.getName();return"["+i+"("+t.inspectNode(n.startContainer)+":"+n.startOffset+", "+t.inspectNode(n.endContainer)+":"+n.endOffset+")]"}function o(n,t){if(this.range=n,this.clonePartiallySelectedTextNodes=t,!n.collapsed){this.sc=n.startContainer;this.so=n.startOffset;this.ec=n.endContainer;this.eo=n.endOffset;var i=n.commonAncestorContainer;this.sc===this.ec&&r(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==i||r(this.sc)?bt(this.sc,i,!0):this.sc.childNodes[this.so],this._last=this.ec!==i||r(this.ec)?bt(this.ec,i,!0):this.ec.childNodes[this.eo-1])}}function ut(n){return function(t,i){for(var u,r=i?t:t.parentNode;r;){if(u=r.nodeType,dt(n,u))return r;r=r.parentNode}return null}}function a(n,t){if(nr(n,t))throw new f("INVALID_NODE_TYPE_ERR");}function v(n,t){if(!dt(t,n.nodeType))throw new f("INVALID_NODE_TYPE_ERR");}function ft(n,t){if(0>t||t>(r(n)?n.length:n.childNodes.length))throw new f("INDEX_SIZE_ERR");}function et(n,t){if(k(n,!0)!==k(t,!0))throw new f("WRONG_DOCUMENT_ERR");}function s(n){if(gi(n,!0))throw new f("NO_MODIFICATION_ALLOWED_ERR");}function b(n,t){if(!n)throw new f(t);}function ei(n){return fr&&t.isBrokenNode(n)||!dt(st,n.nodeType)&&!k(n,!0)}function oi(n,t){return t<=(r(n)?n.length:n.childNodes.length)}function si(n){return!!n.startContainer&&!!n.endContainer&&!ei(n.startContainer)&&!ei(n.endContainer)&&oi(n.startContainer,n.startOffset)&&oi(n.endContainer,n.endOffset)}function i(n){if(!si(n))throw Error("Range error: Range is no longer valid after DOM mutation ("+n.inspect()+")");}function hi(n,t){var u,o,f,e,s;i(n);u=n.startContainer;o=n.startOffset;f=n.endContainer;e=n.endOffset;s=u===f;r(f)&&e>0&&e<f.length&&wt(f,e,t);r(u)&&o>0&&o<u.length&&(u=wt(u,o,t),s?(e-=o,f=u):f==u.parentNode&&e>=c(u)&&e++,o=0);n.setStartAndEnd(u,o,f,e)}function ci(n){i(n);var t=n.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(n.cloneContents()),t.innerHTML}function li(n){n.START_TO_START=nt;n.START_TO_END=ct;n.END_TO_END=ir;n.END_TO_START=lt;n.NODE_BEFORE=at;n.NODE_AFTER=vt;n.NODE_BEFORE_AND_AFTER=yt;n.NODE_INSIDE=tt}function ai(n){li(n);li(n.prototype)}function vi(n,t){return function(){var r,f,e,u,c,h,l;return i(this),r=this.startContainer,f=this.startOffset,e=this.commonAncestorContainer,u=new o(this,!0),r!==e&&(c=bt(r,e,!0),h=rt(c),r=h.node,f=h.offset),w(u,s),u.reset(),l=n(u),u.detach(),t(this,r,f,r,f),l}}function yi(t,f){function e(n,t){return function(i){v(i,ot);v(p(i),st);var r=(n?gt:rt)(i);(t?h:y)(this,r.node,r.offset)}}function h(n,t,i){var r=n.endContainer,e=n.endOffset;(t!==n.startContainer||i!==n.startOffset)&&((p(t)!=p(r)||1==u(t,i,r,e))&&(r=t,e=i),f(n,t,i,r,e))}function y(n,t,i){var r=n.startContainer,e=n.startOffset;(t!==n.endContainer||i!==n.endOffset)&&((p(t)!=p(r)||-1==u(t,i,r,e))&&(r=t,e=i),f(n,r,e,t,i))}var w=function(){};w.prototype=n.rangePrototype;t.prototype=new w;pt.extend(t.prototype,{setStart:function(n,t){a(n,!0);ft(n,t);h(this,n,t)},setEnd:function(n,t){a(n,!0);ft(n,t);y(this,n,t)},setStartAndEnd:function(){var n=arguments,i=n[0],r=n[1],u=i,t=r;switch(n.length){case 3:t=n[2];break;case 4:u=n[2];t=n[3]}f(this,i,r,u,t)},setBoundary:function(n,t,i){this["set"+(i?"Start":"End")](n,t)},setStartBefore:e(!0,!0),setStartAfter:e(!1,!0),setEndBefore:e(!0,!1),setEndAfter:e(!1,!1),collapse:function(n){i(this);n?f(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):f(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(n){a(n,!0);f(this,n,0,n,kt(n))},selectNode:function(n){a(n,!1);v(n,ot);var t=gt(n),i=rt(n);f(this,t.node,t.offset,i.node,i.offset)},extractContents:vi(ui,f),deleteContents:vi(ri,f),canSurroundContents:function(){var n,t;return i(this),s(this.startContainer),s(this.endContainer),n=new o(this,!0),t=n._first&&l(n._first,this)||n._last&&l(n._last,this),n.detach(),!t},splitBoundaries:function(){hi(this)},splitBoundariesPreservingPositions:function(n){hi(this,n)},normalizeBoundaries:function(){var u,e,n,t,h,l,a,o,s;i(this);u=this.startContainer;e=this.startOffset;n=this.endContainer;t=this.endOffset;h=function(i){var r=i.nextSibling;r&&r.nodeType==i.nodeType&&(n=i,t=i.length,i.appendData(r.data),r.parentNode.removeChild(r))};l=function(i){var o,f,r=i.previousSibling;r&&r.nodeType==i.nodeType&&(u=i,o=i.length,e=r.length,i.insertData(0,r.data),r.parentNode.removeChild(r),u==n?(t+=e,n=u):n==i.parentNode&&(f=c(i),t==f?(n=i,t=o):t>f&&t--))};a=!0;r(n)?n.length==t&&h(n):(t>0&&(o=n.childNodes[t-1],o&&r(o)&&h(o)),a=!this.collapsed);a?r(u)?0==e&&l(u):e<u.childNodes.length&&(s=u.childNodes[e],s&&r(s)&&l(s)):(u=n,e=t);f(this,u,e,n,t)},collapseToPoint:function(n,t){a(n,!0);ft(n,t);this.setStartAndEnd(n,t)}});ai(t)}function pi(n){n.collapsed=n.startContainer===n.endContainer&&n.startOffset===n.endOffset;n.commonAncestorContainer=n.collapsed?n.startContainer:t.getCommonAncestor(n.startContainer,n.endContainer)}function wi(n,i,r,u,f){n.startContainer=i;n.startOffset=r;n.endContainer=u;n.endOffset=f;n.document=t.getDocument(i);pi(n)}function h(n){this.startContainer=n;this.startOffset=0;this.endContainer=n;this.endOffset=0;this.document=n;pi(this)}var ot,st,bi,ki,di,k,gi,nr,ht,d,tr,g,nt,ct,ir,lt,at,vt,yt,tt,t=n.dom,pt=n.util,rr=t.DomPosition,f=n.DOMException,r=t.isCharacterDataNode,c=t.getNodeIndex,y=t.isOrIsAncestorOf,it=t.getDocument,u=t.comparePoints,wt=t.splitDataNode,bt=t.getClosestAncestorIn,kt=t.getNodeLength,dt=t.arrayContains,p=t.getRootContainer,fr=n.features.crashyTextNodes;o.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null;this._next=this._first},hasNext:function(){return!!this._next},next:function(){var n=this._current=this._next;return n&&(this._next=n!==this._last?n.nextSibling:null,r(n)&&this.clonePartiallySelectedTextNodes&&(n===this.ec&&(n=n.cloneNode(!0)).deleteData(this.eo,n.length-this.eo),this._current===this.sc&&(n=n.cloneNode(!0)).deleteData(0,this.so))),n},remove:function(){var t,i,n=this._current;!r(n)||n!==this.sc&&n!==this.ec?n.parentNode&&n.parentNode.removeChild(n):(t=n===this.sc?this.so:0,i=n===this.ec?this.eo:n.length,t!=i&&n.deleteData(t,i-t))},isPartiallySelectedSubtree:function(){var n=this._current;return l(n,this.range)},getSubtreeIterator:function(){var t,n,i,r,u,f;return this.isSingleCharacterDataNode?(t=this.range.cloneRange(),t.collapse(!1)):(t=new h(e(this.range)),n=this._current,i=n,r=0,u=n,f=kt(n),y(n,this.sc)&&(i=this.sc,r=this.so),y(n,this.ec)&&(u=this.ec,f=this.eo),wi(t,i,r,u,f)),new o(t,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};ot=[1,3,4,5,7,8,10];st=[2,9,11];bi=[5,6,10,12];ki=[1,3,4,5,7,8,10,11];di=[1,3,4,5,7,8];k=ut([9,11]);gi=ut(bi);nr=ut([6,10,12]);ht=document.createElement("style");d=!1;try{ht.innerHTML="<b>x<\/b>";d=3==ht.firstChild.nodeType}catch(er){}n.features.htmlParsingConforms=d;tr=d?function(n){var i,u=this.startContainer,e=it(u);if(!u)throw new f("INVALID_STATE_ERR");return i=null,1==u.nodeType?i=u:r(u)&&(i=t.parentElement(u)),i=null===i||"HTML"==i.nodeName&&t.isHtmlNamespace(it(i).documentElement)&&t.isHtmlNamespace(i)?e.createElement("body"):i.cloneNode(!1),i.innerHTML=n,t.fragmentFromNodeChildren(i)}:function(n){var r=e(this),i=r.createElement("body");return i.innerHTML=n,t.fragmentFromNodeChildren(i)};g=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"];nt=0;ct=1;ir=2;lt=3;at=0;vt=1;yt=2;tt=3;pt.extend(n.rangePrototype,{compareBoundaryPoints:function(n,t){var e,o,s,h,r,f;return i(this),et(this.startContainer,t.startContainer),r=n==lt||n==nt?"start":"end",f=n==ct||n==nt?"start":"end",e=this[r+"Container"],o=this[r+"Offset"],s=t[f+"Container"],h=t[f+"Offset"],u(e,o,s,h)},insertNode:function(n){if(i(this),v(n,ki),s(this.startContainer),y(n,this.startContainer))throw new f("HIERARCHY_REQUEST_ERR");var t=ni(n,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){var n,t,u;return i(this),this.collapsed?e(this).createDocumentFragment():this.startContainer===this.endContainer&&r(this.startContainer)?(n=this.startContainer.cloneNode(!0),n.data=n.data.slice(this.startOffset,this.endOffset),t=e(this).createDocumentFragment(),t.appendChild(n),t):(u=new o(this,!0),n=ii(u),u.detach(),n)},canSurroundContents:function(){var n,t;return i(this),s(this.startContainer),s(this.endContainer),n=new o(this,!0),t=n._first&&l(n._first,this)||n._last&&l(n._last,this),n.detach(),!t},surroundContents:function(n){if(v(n,di),!this.canSurroundContents())throw new f("INVALID_STATE_ERR");var t=this.extractContents();if(n.hasChildNodes())for(;n.lastChild;)n.removeChild(n.lastChild);ni(n,this.startContainer,this.startOffset);n.appendChild(t);this.selectNode(n)},cloneRange:function(){var n,t,r;for(i(this),n=new h(e(this)),t=g.length;t--;)r=g[t],n[r]=this[r];return n},toString:function(){var n,t,u;return i(this),n=this.startContainer,n===this.endContainer&&r(n)?3==n.nodeType||4==n.nodeType?n.data.slice(this.startOffset,this.endOffset):"":(t=[],u=new o(this,!0),w(u,function(n){(3==n.nodeType||4==n.nodeType)&&t.push(n.data)}),u.detach(),t.join(""))},compareNode:function(n){var t,r,e,u;if(i(this),t=n.parentNode,r=c(n),!t)throw new f("NOT_FOUND_ERR");return e=this.comparePoint(t,r),u=this.comparePoint(t,r+1),0>e?u>0?yt:at:u>0?vt:tt},comparePoint:function(n,t){return i(this),b(n,"HIERARCHY_REQUEST_ERR"),et(n,this.startContainer),u(n,t,this.startContainer,this.startOffset)<0?-1:u(n,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:tr,toHtml:function(){return ci(this)},intersectsNode:function(n,t){var r,f,o,s;return i(this),b(n,"NOT_FOUND_ERR"),it(n)!==e(this)?!1:(r=n.parentNode,f=c(n),b(r,"NOT_FOUND_ERR"),o=u(r,f,this.endContainer,this.endOffset),s=u(r,f+1,this.startContainer,this.startOffset),t?0>=o&&s>=0:0>o&&s>0)},isPointInRange:function(n,t){return i(this),b(n,"HIERARCHY_REQUEST_ERR"),et(n,this.startContainer),u(n,t,this.startContainer,this.startOffset)>=0&&u(n,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(n){return ti(this,n,!1)},intersectsOrTouchesRange:function(n){return ti(this,n,!0)},intersection:function(n){var i,r,t;return this.intersectsRange(n)?(i=u(this.startContainer,this.startOffset,n.startContainer,n.startOffset),r=u(this.endContainer,this.endOffset,n.endContainer,n.endOffset),t=this.cloneRange(),-1==i&&t.setStart(n.startContainer,n.startOffset),1==r&&t.setEnd(n.endContainer,n.endOffset),t):null},union:function(n){if(this.intersectsOrTouchesRange(n)){var t=this.cloneRange();return-1==u(n.startContainer,n.startOffset,this.startContainer,this.startOffset)&&t.setStart(n.startContainer,n.startOffset),1==u(n.endContainer,n.endOffset,this.endContainer,this.endOffset)&&t.setEnd(n.endContainer,n.endOffset),t}throw new f("Ranges do not intersect");},containsNode:function(n,t){return t?this.intersectsNode(n,!1):this.compareNode(n)==tt},containsNodeContents:function(n){return this.comparePoint(n,0)>=0&&this.comparePoint(n,kt(n))<=0},containsRange:function(n){var t=this.intersection(n);return null!==t&&n.equals(t)},containsNodeText:function(n){var i,r,t=this.cloneRange();return t.selectNode(n),i=t.getNodes([3]),i.length>0?(t.setStart(i[0],0),r=i.pop(),t.setEnd(r,r.length),this.containsRange(t)):this.containsNodeContents(n)},getNodes:function(n,t){return i(this),ur(this,n,t)},getDocument:function(){return e(this)},collapseBefore:function(n){this.setEndBefore(n);this.collapse(!1)},collapseAfter:function(n){this.setStartAfter(n);this.collapse(!0)},getBookmark:function(i){var r,u,o,s=e(this),f=n.createRange(s);return i=i||t.getBody(s),f.selectNodeContents(i),r=this.intersection(f),u=0,o=0,r&&(f.setEnd(r.startContainer,r.startOffset),u=(""+f).length,o=u+(""+r).length),{start:u,end:o,containerNode:i}},moveToBookmark:function(n){var f,t,r,e,u,o,s,h=n.containerNode,i=0;for(this.setStart(h,0),this.collapse(!0),f=[h],r=!1,e=!1;!e&&(t=f.pop());)if(3==t.nodeType)u=i+t.length,!r&&n.start>=i&&n.start<=u&&(this.setStart(t,n.start-i),r=!0),r&&n.end>=i&&n.end<=u&&(this.setEnd(t,n.end-i),e=!0),i=u;else for(s=t.childNodes,o=s.length;o--;)f.push(s[o])},getName:function(){return"DomRange"},equals:function(n){return h.rangesEqual(this,n)},isValid:function(){return si(this)},inspect:function(){return fi(this)},detach:function(){}});yi(h,wi);pt.extend(h,{rangeProperties:g,RangeIterator:o,copyComparisonConstants:ai,createPrototypeRange:yi,inspect:fi,toHtml:ci,getRangeDocument:e,rangesEqual:function(n,t){return n.startContainer===t.startContainer&&n.startOffset===t.startOffset&&n.endContainer===t.endContainer&&n.endOffset===t.endOffset}});n.DomRange=h}),n.createCoreModule("WrappedRange",["DomRange"],function(n,t){var o,r,y,p,s,h,a,v,i=n.dom,w=n.util,u=i.DomPosition,f=n.DomRange,e=i.getBody,c=i.getContentDocument,l=i.isCharacterDataNode;n.features.implementsDomRange&&!function(){function s(n){for(var t,i=b.length;i--;)t=b[i],n[t]=n.nativeRange[t];n.collapsed=n.startContainer===n.endContainer&&n.startOffset===n.endOffset}function k(n,t,i,r,u){var f=n.startContainer!==t||n.startOffset!=i,e=n.endContainer!==r||n.endOffset!=u,o=!n.equals(n.nativeRange);(f||e||o)&&(n.setEnd(r,u),n.setStart(t,i))}var r,l,h,u,a,v,y,p,b=f.rangeProperties;o=function(n){if(!n)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=n;s(this)};f.createPrototypeRange(o,k);r=o.prototype;r.selectNode=function(n){this.nativeRange.selectNode(n);s(this)};r.cloneContents=function(){return this.nativeRange.cloneContents()};r.surroundContents=function(n){this.nativeRange.surroundContents(n);s(this)};r.collapse=function(n){this.nativeRange.collapse(n);s(this)};r.cloneRange=function(){return new o(this.nativeRange.cloneRange())};r.refresh=function(){s(this)};r.toString=function(){return""+this.nativeRange};h=document.createTextNode("test");e(document).appendChild(h);u=document.createRange();u.setStart(h,0);u.setEnd(h,0);try{u.setStart(h,1);r.setStart=function(n,t){this.nativeRange.setStart(n,t);s(this)};r.setEnd=function(n,t){this.nativeRange.setEnd(n,t);s(this)};l=function(n){return function(t){this.nativeRange[n](t);s(this)}}}catch(d){r.setStart=function(n,t){try{this.nativeRange.setStart(n,t)}catch(i){this.nativeRange.setEnd(n,t);this.nativeRange.setStart(n,t)}s(this)};r.setEnd=function(n,t){try{this.nativeRange.setEnd(n,t)}catch(i){this.nativeRange.setStart(n,t);this.nativeRange.setEnd(n,t)}s(this)};l=function(n,t){return function(i){try{this.nativeRange[n](i)}catch(r){this.nativeRange[t](i);this.nativeRange[n](i)}s(this)}}}r.setStartBefore=l("setStartBefore","setEndBefore");r.setStartAfter=l("setStartAfter","setEndAfter");r.setEndBefore=l("setEndBefore","setStartBefore");r.setEndAfter=l("setEndAfter","setStartAfter");r.selectNodeContents=function(n){this.setStartAndEnd(n,0,i.getNodeLength(n))};u.selectNodeContents(h);u.setEnd(h,3);a=document.createRange();a.selectNodeContents(h);a.setEnd(h,4);a.setStart(h,2);r.compareBoundaryPoints=-1==u.compareBoundaryPoints(u.START_TO_END,a)&&1==u.compareBoundaryPoints(u.END_TO_START,a)?function(n,t){return t=t.nativeRange||t,n==t.START_TO_END?n=t.END_TO_START:n==t.END_TO_START&&(n=t.START_TO_END),this.nativeRange.compareBoundaryPoints(n,t)}:function(n,t){return this.nativeRange.compareBoundaryPoints(n,t.nativeRange||t)};v=document.createElement("div");v.innerHTML="123";y=v.firstChild;p=e(document);p.appendChild(v);u.setStart(y,1);u.setEnd(y,2);u.deleteContents();"13"==y.data&&(r.deleteContents=function(){this.nativeRange.deleteContents();s(this)},r.extractContents=function(){var n=this.nativeRange.extractContents();return s(this),n});p.removeChild(v);p=null;w.isHostMethod(u,"createContextualFragment")&&(r.createContextualFragment=function(n){return this.nativeRange.createContextualFragment(n)});e(document).removeChild(h);r.getName=function(){return"WrappedRange"};n.WrappedRange=o;n.createNativeRange=function(n){return n=c(n,t,"createNativeRange"),n.createRange()}}();n.features.implementsTextRange&&(y=function(n){var r,f,u,e=n.parentElement(),t=n.duplicate();return t.collapse(!0),r=t.parentElement(),t=n.duplicate(),t.collapse(!1),f=t.parentElement(),u=r==f?r:i.getCommonAncestor(r,f),u==e?u:i.getCommonAncestor(e,u)},p=function(n){return 0==n.compareEndPoints("StartToEnd",n)},s=function(n,t,r,f,e){var o,k,s,p,it,w,d,nt,b,h,tt,c,a,g,y,rt,v=n.duplicate();if(v.collapse(r),o=v.parentElement(),i.isOrIsAncestorOf(t,o)||(o=t),!o.canHaveHTML)return k=new u(o.parentNode,i.getNodeIndex(o)),{boundaryPosition:k,nodeInfo:{nodeIndex:k.offset,containerElement:k.node}};for(s=i.getDocument(o).createElement("span"),s.parentNode&&s.parentNode.removeChild(s),it=r?"StartToStart":"StartToEnd",h=e&&e.containerElement==o?e.nodeIndex:0,tt=o.childNodes.length,c=tt,a=c;;){if(a==tt?o.appendChild(s):o.insertBefore(s,o.childNodes[a]),v.moveToElementText(s),p=v.compareEndPoints(it,n),0==p||h==c)break;if(-1==p){if(c==h+1)break;h=a}else c=c==h+1?h:a;a=Math.floor((h+c)/2);o.removeChild(s)}if(b=s.nextSibling,-1==p&&b&&l(b)){if(v.setEndPoint(r?"EndToStart":"EndToEnd",n),/[\r\n]/.test(b.data))for(y=v.duplicate(),rt=y.text.replace(/\r\n/g,"\r").length,g=y.moveStart("character",rt);-1==(p=y.compareEndPoints("StartToEnd",y));)g++,y.moveStart("character",1);else g=v.text.length;nt=new u(b,g)}else w=(f||!r)&&s.previousSibling,d=(f||r)&&s.nextSibling,nt=d&&l(d)?new u(d,0):w&&l(w)?new u(w,w.data.length):new u(o,i.getNodeIndex(s));return s.parentNode.removeChild(s),{boundaryPosition:nt,nodeInfo:{nodeIndex:a,containerElement:o}}},h=function(n,t){var u,f,r,s,h=n.offset,c=i.getDocument(n.node),o=e(c).createTextRange(),a=l(n.node);return a?(u=n.node,f=u.parentNode):(s=n.node.childNodes,u=h<s.length?s[h]:null,f=n.node),r=c.createElement("span"),r.innerHTML="&#feff;",u?f.insertBefore(r,u):f.appendChild(r),o.moveToElementText(r),o.collapse(!t),f.removeChild(r),a&&o[t?"moveStart":"moveEnd"]("character",h),o},r=function(n){this.textRange=n;this.refresh()},r.prototype=new f(document),r.prototype.refresh=function(){var n,t,i,r=y(this.textRange);p(this.textRange)?t=n=s(this.textRange,r,!0,!0).boundaryPosition:(i=s(this.textRange,r,!0,!1),n=i.boundaryPosition,t=s(this.textRange,r,!1,!1,i.nodeInfo).boundaryPosition);this.setStart(n.node,n.offset);this.setEnd(t.node,t.offset)},r.prototype.getName=function(){return"WrappedTextRange"},f.copyComparisonConstants(r),a=function(n){var i,r,t;return n.collapsed?h(new u(n.startContainer,n.startOffset),!0):(i=h(new u(n.startContainer,n.startOffset),!0),r=h(new u(n.endContainer,n.endOffset),!1),t=e(f.getRangeDocument(n)).createTextRange(),t.setEndPoint("StartToStart",i),t.setEndPoint("EndToEnd",r),t)},r.rangeToTextRange=a,r.prototype.toTextRange=function(){return a(this)},n.WrappedTextRange=r,(!n.features.implementsDomRange||n.config.preferTextRange)&&(v=function(){return this}(),void 0===v.Range&&(v.Range=r),n.createNativeRange=function(n){return n=c(n,t,"createNativeRange"),e(n).createTextRange()},n.WrappedRange=r));n.createRange=function(i){return i=c(i,t,"createRange"),new n.WrappedRange(n.createNativeRange(i))};n.createRangyRange=function(n){return n=c(n,t,"createRangyRange"),new f(n)};n.createIframeRange=function(i){return t.deprecationNotice("createIframeRange()","createRange(iframeEl)"),n.createRange(i)};n.createIframeRangyRange=function(i){return t.deprecationNotice("createIframeRangyRange()","createRangyRange(iframeEl)"),n.createRangyRange(i)};n.addShimListener(function(t){var i=t.document;void 0===i.createRange&&(i.createRange=function(){return n.createRange(i)});i=t=null})}),n.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],function(n,t){function wt(n){return"string"==typeof n?/^backward(s)?$/i.test(n):!!n}function ft(n,i){if(n){if(f.isWindow(n))return n;if(n instanceof o)return n.win;var r=f.getContentDocument(n,t,i);return f.getWindow(r)}return window}function bi(n){return ft(n,"getWinSelection").getSelection()}function oi(n){return ft(n,"getDocSelection").document.selection}function si(n){var t=!1;return n.anchorNode&&(t=1==f.comparePoints(n.anchorNode,n.anchorOffset,n.focusNode,n.focusOffset)),t}function d(n,t,i){var r=i?"end":"start",u=i?"start":"end";n.anchorNode=t[r+"Container"];n.anchorOffset=t[r+"Offset"];n.focusNode=t[u+"Container"];n.focusOffset=t[u+"Offset"]}function ki(n){var t=n.nativeSelection;n.anchorNode=t.anchorNode;n.anchorOffset=t.anchorOffset;n.focusNode=t.focusNode;n.focusOffset=t.focusOffset}function v(n){n.anchorNode=n.focusNode=null;n.anchorOffset=n.focusOffset=0;n.rangeCount=0;n.isCollapsed=!0;n._ranges.length=0}function bt(t){var i;return t instanceof w?(i=n.createNativeRange(t.getDocument()),i.setEnd(t.endContainer,t.endOffset),i.setStart(t.startContainer,t.startOffset)):t instanceof ot?i=t.nativeRange:r.implementsDomRange&&t instanceof f.getWindow(t.startContainer).Range&&(i=t),i}function di(n){if(!n.length||1!=n[0].nodeType)return!1;for(var t=1,i=n.length;i>t;++t)if(!f.isAncestorOf(n[0],n[t]))return!1;return!0}function kt(n){var i=n.getNodes();if(!di(i))throw t.createError("getSingleElementFromRange: range "+n.inspect()+" did not consist of a single element");return i[0]}function dt(n){return!!n&&void 0!==n.text}function hi(n,t){var i=new ot(t);n._ranges=[i];d(n,i,!1);n.rangeCount=1;n.isCollapsed=i.collapsed}function g(t){var i,u,f,r;if(t._ranges.length=0,"None"==t.docSelection.type)v(t);else if(i=t.docSelection.createRange(),dt(i))hi(t,i);else{for(t.rangeCount=i.length,f=e(i.item(0)),r=0;r<t.rangeCount;++r)u=n.createRange(f),u.selectNode(i.item(r)),t._ranges.push(u);t.isCollapsed=1==t.rangeCount&&t._ranges[0].collapsed;d(t,t._ranges[t.rangeCount-1],!1)}}function ci(n,i){for(var u=n.docSelection.createRange(),s=kt(i),h=e(u.item(0)),f=a(h).createControlRange(),r=0,o=u.length;o>r;++r)f.add(u.item(r));try{f.add(s)}catch(c){throw t.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");}f.select();g(n)}function o(n,t,i){this.nativeSelection=n;this.docSelection=t;this._ranges=[];this.win=i;this.refresh()}function li(n){n.win=n.anchorNode=n.focusNode=n._ranges=null;n.rangeCount=n.anchorOffset=n.focusOffset=0;n.detached=!0}function gt(n,t){for(var i,r,u=k.length;u--;)if(i=k[u],r=i.selection,"deleteAll"==t)li(r);else if(i.win==n)return"delete"==t?(k.splice(u,1),!0):r;return"deleteAll"==t&&(k.length=0),null}function ai(n,i){for(var u,s=e(i[0].startContainer),o=a(s).createControlRange(),r=0,f=i.length;f>r;++r){u=kt(i[r]);try{o.add(u)}catch(h){throw t.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)");}}o.select();g(n)}function vi(n,t){if(n.win.document!=e(t))throw new nt("WRONG_DOCUMENT_ERR");}function yi(t){return function(i,r){var u;this.rangeCount?(u=this.getRangeAt(0),u["set"+(t?"Start":"End")](i,r)):(u=n.createRange(this.win.document),u.setStartAndEnd(i,r));this.setSingleRange(u,this.isBackward())}}function pi(n){var t,i,r=[],u=new ti(n.anchorNode,n.anchorOffset),f=new ti(n.focusNode,n.focusOffset),e="function"==typeof n.getName?n.getName():"Selection";if(void 0!==n.rangeCount)for(t=0,i=n.rangeCount;i>t;++t)r[t]=w.inspect(n.getRangeAt(t));return"["+e+"(Ranges: "+r.join(", ")+")(anchor: "+u.inspect()+", focus: "+f.inspect()+"]"}var ni,et,f,y,c,w,ot,nt,ti,tt,st,r,l,e,a,ht,ct,s,b,u,ii,lt,p,it,ri,rt,ui,at,h,wi,vt,k,yt,i,fi,pt,ei,ut;if(n.config.checkSelectionRanges=!0,ni="boolean",et="number",f=n.dom,y=n.util,c=y.isHostMethod,w=n.DomRange,ot=n.WrappedRange,nt=n.DOMException,ti=f.DomPosition,r=n.features,l="Control",e=f.getDocument,a=f.getBody,ht=w.rangesEqual,ct=c(window,"getSelection"),s=y.isHostObject(document,"selection"),r.implementsWinGetSelection=ct,r.implementsDocSelection=s,b=s&&(!ct||n.config.preferTextRange),b?(tt=oi,n.isSelectionValid=function(n){var t=ft(n,"isSelectionValid").document,i=t.selection;return"None"!=i.type||e(i.createRange().parentElement())==t}):ct?(tt=bi,n.isSelectionValid=function(){return!0}):t.fail("Neither document.selection or window.getSelection() detected."),n.getNativeSelection=tt,u=tt(),ii=n.createNativeRange(document),lt=a(document),p=y.areHostProperties(u,["anchorNode","focusNode","anchorOffset","focusOffset"]),r.selectionHasAnchorAndFocus=p,it=c(u,"extend"),r.selectionHasExtend=it,ri=typeof u.rangeCount==et,r.selectionHasRangeCount=ri,rt=!1,ui=!0,at=it?function(t,i){var u=w.getRangeDocument(i),r=n.createRange(u);r.collapseToPoint(i.endContainer,i.endOffset);t.addRange(bt(r));t.extend(i.startContainer,i.startOffset)}:null,y.areHostMethods(u,["addRange","getRangeAt","removeAllRanges"])&&typeof u.rangeCount==et&&r.implementsDomRange&&!function(){var e,l,u,v,i,h,o,f,r,c,s,t=window.getSelection();if(t){for(e=t.rangeCount,l=e>1,u=[],v=si(t),i=0;e>i;++i)u[i]=t.getRangeAt(i);for(h=a(document),o=h.appendChild(document.createElement("div")),o.contentEditable="false",f=o.appendChild(document.createTextNode("   ")),r=document.createRange(),r.setStart(f,1),r.collapse(!0),t.addRange(r),ui=1==t.rangeCount,t.removeAllRanges(),l||(c=window.navigator.appVersion.match(/Chrome\/(.*?) /),c&&parseInt(c[1])>=36?rt=!1:(s=r.cloneRange(),r.setStart(f,0),s.setEnd(f,3),s.setStart(f,2),t.addRange(r),t.addRange(s),rt=2==t.rangeCount)),h.removeChild(o),t.removeAllRanges(),i=0;e>i;++i)0==i&&v?at?at(t,u[i]):(n.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),t.addRange(u[i])):t.addRange(u[i])}}(),r.selectionSupportsMultipleRanges=rt,r.collapsedNonEditableSelectionsSupported=ui,h=!1,lt&&c(lt,"createControlRange")&&(wi=lt.createControlRange(),y.areHostProperties(wi,["item","add"])&&(h=!0)),r.implementsControlRange=h,st=p?function(n){return n.anchorNode===n.focusNode&&n.anchorOffset===n.focusOffset}:function(n){return n.rangeCount?n.getRangeAt(n.rangeCount-1).collapsed:!1},c(u,"getRangeAt")?vt=function(n,t){try{return n.getRangeAt(t)}catch(i){return null}}:p&&(vt=function(t){var r=e(t.anchorNode),i=n.createRange(r);return i.setStartAndEnd(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),i.collapsed!==this.isCollapsed&&i.setStartAndEnd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset),i}),o.prototype=n.selectionPrototype,k=[],yt=function(n){var t,i,r;return n&&n instanceof o?(n.refresh(),n):(n=ft(n,"getNativeSelection"),t=gt(n),i=tt(n),r=s?oi(n):null,t?(t.nativeSelection=i,t.docSelection=r,t.refresh()):(t=new o(i,r,n),k.push({win:n,selection:t})),t)},n.getSelection=yt,n.getIframeSelection=function(i){return t.deprecationNotice("getIframeSelection()","getSelection(iframeEl)"),n.getSelection(f.getIframeWindow(i))},i=o.prototype,!b&&p&&y.areHostMethods(u,["removeAllRanges","addRange"]))i.removeAllRanges=function(){this.nativeSelection.removeAllRanges();v(this)},fi=function(n,t){at(n.nativeSelection,t);n.refresh()},i.addRange=ri?function(t,i){var u,r;h&&s&&this.docSelection.type==l?ci(this,t):wt(i)&&it?fi(this,t):(rt?u=this.rangeCount:(this.removeAllRanges(),u=0),this.nativeSelection.addRange(bt(t).cloneRange()),this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==u+1?(n.config.checkSelectionRanges&&(r=vt(this.nativeSelection,this.rangeCount-1),r&&!ht(r,t)&&(t=new ot(r))),this._ranges[this.rangeCount-1]=t,d(this,t,ut(this.nativeSelection)),this.isCollapsed=st(this)):this.refresh())}:function(n,t){wt(t)&&it?fi(this,n):(this.nativeSelection.addRange(bt(n)),this.refresh())},i.setRanges=function(n){if(h&&s&&n.length>1)ai(this,n);else{this.removeAllRanges();for(var t=0,i=n.length;i>t;++t)this.addRange(n[t])}};else{if(!(c(u,"empty")&&c(ii,"select")&&h&&b))return t.fail("No means of selecting a Range or TextRange was found"),!1;i.removeAllRanges=function(){var n,t,i;try{this.docSelection.empty();"None"!=this.docSelection.type&&(this.anchorNode?n=e(this.anchorNode):this.docSelection.type==l&&(t=this.docSelection.createRange(),t.length&&(n=e(t.item(0)))),n&&(i=a(n).createTextRange(),i.select(),this.docSelection.empty()))}catch(r){}v(this)};i.addRange=function(t){this.docSelection.type==l?ci(this,t):(n.WrappedTextRange.rangeToTextRange(t).select(),this._ranges[0]=t,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,d(this,t,!1))};i.setRanges=function(n){this.removeAllRanges();var t=n.length;t>1?ai(this,n):t&&this.addRange(n[0])}}if(i.getRangeAt=function(n){if(0>n||n>=this.rangeCount)throw new nt("INDEX_SIZE_ERR");return this._ranges[n].cloneRange()},b)pt=function(t){var i;n.isSelectionValid(t.win)?i=t.docSelection.createRange():(i=a(t.win.document).createTextRange(),i.collapse(!0));t.docSelection.type==l?g(t):dt(i)?hi(t,i):v(t)};else if(c(u,"getRangeAt")&&typeof u.rangeCount==et)pt=function(t){if(h&&s&&t.docSelection.type==l)g(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var i=0,r=t.rangeCount;r>i;++i)t._ranges[i]=new n.WrappedRange(t.nativeSelection.getRangeAt(i));d(t,t._ranges[t.rangeCount-1],ut(t.nativeSelection));t.isCollapsed=st(t)}else v(t)};else{if(!p||typeof u.isCollapsed!=ni||typeof ii.collapsed!=ni||!r.implementsDomRange)return t.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;pt=function(n){var t,i=n.nativeSelection;i.anchorNode?(t=vt(i,0),n._ranges=[t],n.rangeCount=1,ki(n),n.isCollapsed=st(n)):v(n)}}i.refresh=function(n){var t,i=n?this._ranges.slice(0):null,r=this.anchorNode,u=this.anchorOffset;if(pt(this),n){if((t=i.length,t!=this._ranges.length)||this.anchorNode!=r||this.anchorOffset!=u)return!0;for(;t--;)if(!ht(i[t],this._ranges[t]))return!0;return!1}};ei=function(n,t){var i,u,r=n.getAllRanges();for(n.removeAllRanges(),i=0,u=r.length;u>i;++i)ht(t,r[i])||n.addRange(r[i]);n.rangeCount||v(n)};i.removeRange=h&&s?function(n){var t,f,o,r,s,u,i,h;if(this.docSelection.type==l){for(t=this.docSelection.createRange(),f=kt(n),o=e(t.item(0)),r=a(o).createControlRange(),u=!1,i=0,h=t.length;h>i;++i)s=t.item(i),s!==f||u?r.add(t.item(i)):u=!0;r.select();g(this)}else ei(this,n)}:function(n){ei(this,n)};!b&&p&&r.implementsDomRange?(ut=si,i.isBackward=function(){return ut(this)}):ut=i.isBackward=function(){return!1};i.isBackwards=i.isBackward;i.toString=function(){for(var i=[],n=0,t=this.rangeCount;t>n;++n)i[n]=""+this._ranges[n];return i.join("")};i.collapse=function(t,i){vi(this,t);var r=n.createRange(t);r.collapseToPoint(t,i);this.setSingleRange(r);this.isCollapsed=!0};i.collapseToStart=function(){if(!this.rangeCount)throw new nt("INVALID_STATE_ERR");var n=this._ranges[0];this.collapse(n.startContainer,n.startOffset)};i.collapseToEnd=function(){if(!this.rangeCount)throw new nt("INVALID_STATE_ERR");var n=this._ranges[this.rangeCount-1];this.collapse(n.endContainer,n.endOffset)};i.selectAllChildren=function(t){vi(this,t);var i=n.createRange(t);i.selectNodeContents(t);this.setSingleRange(i)};i.deleteFromDocument=function(){var t,i,n,r,u;if(h&&s&&this.docSelection.type==l){for(t=this.docSelection.createRange();t.length;)i=t.item(0),t.remove(i),i.parentNode.removeChild(i);this.refresh()}else if(this.rangeCount&&(n=this.getAllRanges(),n.length)){for(this.removeAllRanges(),r=0,u=n.length;u>r;++r)n[r].deleteContents();this.addRange(n[u-1])}};i.eachRange=function(n,t){for(var i=0,r=this._ranges.length;r>i;++i)if(n(this.getRangeAt(i)))return t};i.getAllRanges=function(){var n=[];return this.eachRange(function(t){n.push(t)}),n};i.setSingleRange=function(n,t){this.removeAllRanges();this.addRange(n,t)};i.callMethodOnEachRange=function(n,t){var i=[];return this.eachRange(function(r){i.push(r[n].apply(r,t))}),i};i.setStart=yi(!0);i.setEnd=yi(!1);n.rangePrototype.select=function(n){yt(this.getDocument()).setSingleRange(this,n)};i.changeEachRange=function(n){var t=[],i=this.isBackward();this.eachRange(function(i){n(i);t.push(i)});this.removeAllRanges();i&&1==t.length?this.addRange(t[0],"backward"):this.setRanges(t)};i.containsNode=function(n,t){return this.eachRange(function(i){return i.containsNode(n,t)},!0)||!1};i.getBookmark=function(n){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[n])}};i.moveToBookmark=function(t){for(var f,i,r=[],u=0;f=t.rangeBookmarks[u++];)i=n.createRange(this.win),i.moveToBookmark(f),r.push(i);t.backward?this.setSingleRange(r[0],"backward"):this.setRanges(r)};i.toHtml=function(){var n=[];return this.eachRange(function(t){n.push(w.toHtml(t))}),n.join("")};r.implementsTextRange&&(i.getNativeTextRange=function(){var r,i;if(r=this.docSelection){if(i=r.createRange(),dt(i))return i;throw t.createError("getNativeTextRange: selection is a control selection");}if(this.rangeCount>0)return n.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw t.createError("getNativeTextRange: selection contains no range");});i.getName=function(){return"WrappedSelection"};i.inspect=function(){return pi(this)};i.detach=function(){gt(this.win,"delete");li(this)};o.detachAll=function(){gt(null,"deleteAll")};o.inspect=pi;o.isDirectionBackward=wt;n.Selection=o;n.selectionPrototype=i;n.addShimListener(function(n){void 0===n.getSelection&&(n.getSelection=function(){return yt(n)});n=null})}),n)},this),function(n,t){"function"==typeof define&&define.amd?define(["rangy"],n):n(t.rangy)}(function(n){n.createModule("SaveRestore",["WrappedRange"],function(n,t){function i(n,t){return(t||document).getElementById(n)}function u(n,t){var i,f="selectionBoundary_"+ +new Date+"_"+(""+Math.random()).slice(2),r=y.getDocument(n.startContainer),u=n.cloneRange();return u.collapse(t),i=r.createElement("span"),i.id=f,i.style.lineHeight="0",i.style.display="none",i.className="rangySelectionBoundary",i.appendChild(r.createTextNode(p)),u.insertNode(i),i}function f(n,r,u,f){var e=i(u,n);e?(r[f?"setStartBefore":"setEndBefore"](e),e.parentNode.removeChild(e)):t.warn("Marker element has been removed. Cannot restore selection.")}function c(n,t){return t.compareBoundaryPoints(n.START_TO_START,n)}function e(t,i){var f,r,e=n.DomRange.getRangeDocument(t),o=""+t;return t.collapsed?(r=u(t,!1),{document:e,markerId:r.id,collapsed:!0}):(r=u(t,!1),f=u(t,!0),{document:e,startMarkerId:f.id,endMarkerId:r.id,collapsed:!1,backward:i,toString:function(){return"original text: '"+o+"', new text: '"+t+"'"}})}function o(r,u){var o,e,s,h=r.document;return void 0===u&&(u=!0),o=n.createRange(h),r.collapsed?(e=i(r.markerId,h),e?(e.style.display="inline",s=e.previousSibling,s&&3==s.nodeType?(e.parentNode.removeChild(e),o.collapseToPoint(s,s.length)):(o.collapseBefore(e),e.parentNode.removeChild(e))):t.warn("Marker element has been removed. Cannot restore selection.")):(f(h,o,r.startMarkerId,!0),f(h,o,r.endMarkerId,!1)),u&&o.normalizeBoundaries(),o}function s(t,r){var f,s,u,h,o=[];for(t=t.slice(0),t.sort(c),u=0,h=t.length;h>u;++u)o[u]=e(t[u],r);for(u=h-1;u>=0;--u)f=t[u],s=n.DomRange.getRangeDocument(f),f.collapsed?f.collapseAfter(i(o[u].markerId,s)):(f.setEndBefore(i(o[u].endMarkerId,s)),f.setStartAfter(i(o[u].startMarkerId,s)));return o}function l(i){var r,u,f,e;return n.isSelectionValid(i)?(r=n.getSelection(i),u=r.getAllRanges(),f=1==u.length&&r.isBackward(),e=s(u,f),f?r.setSingleRange(u[0],"backward"):r.setRanges(u),{win:i,rangeInfos:e,restored:!1}):(t.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."),null)}function h(n){for(var i=[],r=n.length,t=r-1;t>=0;t--)i[t]=o(n[t],!0);return i}function a(t,i){var r,u,f,e;t.restored||(r=t.rangeInfos,u=n.getSelection(t.win),f=h(r),e=r.length,1==e&&i&&n.features.selectionHasExtend&&r[0].backward?(u.removeAllRanges(),u.addRange(f[0],!0)):u.setRanges(f),t.restored=!0)}function r(n,t){var r=i(t,n);r&&r.parentNode.removeChild(r)}function v(n){for(var t,f=n.rangeInfos,i=0,u=f.length;u>i;++i)t=f[i],t.collapsed?r(n.doc,t.markerId):(r(n.doc,t.startMarkerId),r(n.doc,t.endMarkerId))}var y=n.dom,p="﻿";n.util.extend(n,{saveRange:e,restoreRange:o,saveRanges:s,restoreRanges:h,saveSelection:l,restoreSelection:a,removeMarkerElement:r,removeMarkers:v})})},this);Base=function(){};Base.extend=function(n,t){var r,u,i,f=Base.prototype.extend;return Base._prototyping=!0,r=new this,f.call(r,n),r.base=function(){},delete Base._prototyping,u=r.constructor,i=r.constructor=function(){if(!Base._prototyping)if(this._constructing||this.constructor==i)this._constructing=!0,u.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||f).call(arguments[0],r)},i.ancestor=this,i.extend=this.extend,i.forEach=this.forEach,i.implement=this.implement,i.prototype=r,i.toString=this.toString,i.valueOf=function(n){return"object"==n?i:u.valueOf()},f.call(i,t),"function"==typeof i.init&&i.init(),i};Base.prototype={extend:function(n,t){var r,f,u,e,o,s,i;if(arguments.length>1)r=this[n],!r||"function"!=typeof t||r.valueOf&&r.valueOf()==t.valueOf()||!/\bbase\b/.test(t)||(f=t.valueOf(),t=function(){var n,t=this.base||Base.prototype.base;return this.base=r,n=f.apply(this,arguments),this.base=t,n},t.valueOf=function(n){return"object"==n?t:f},t.toString=Base.toString),this[n]=t;else if(n){for(u=Base.prototype.extend,Base._prototyping||"function"==typeof this||(u=this.extend||u),e={toSource:null},o=["constructor","toString","valueOf"],s=Base._prototyping?0:1;i=o[s++];)n[i]!=e[i]&&u.call(this,i,n[i]);for(i in n)e[i]||u.call(this,i,n[i])}return this}};Base=Base.extend({constructor:function(){this.extend(arguments[0])}},{ancestor:Object,version:"1.1",forEach:function(n,t,i){for(var r in n)void 0===this.prototype[r]&&t.call(i,n[r],r,n)},implement:function(){for(var n=0;n<arguments.length;n++)"function"==typeof arguments[n]?arguments[n](this.prototype):this.prototype.extend(arguments[n]);return this},toString:function(){return this.valueOf()+""}});wysihtml5.browser=function(){function e(n){return+(/ipad|iphone|ipod/.test(n)&&n.match(/ os (\d+).+? like mac os x/)||[void 0,0])[1]}function o(n){return+(n.match(/android (\d+)/)||[void 0,0])[1]}function n(n,t){var r,i=-1;return"Microsoft Internet Explorer"==navigator.appName?r=RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"):"Netscape"==navigator.appName&&(r=RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})")),r&&null!=r.exec(navigator.userAgent)&&(i=parseFloat(RegExp.$1)),-1===i?!1:n?t?"<"===t?i>n:">"===t?n>i:"<="===t?i>=n:">="===t?n>=i:void 0:n===i:!0}var t=navigator.userAgent,i=document.createElement("div"),r=-1!==t.indexOf("Gecko")&&-1===t.indexOf("KHTML"),f=-1!==t.indexOf("AppleWebKit/"),s=-1!==t.indexOf("Chrome/"),u=-1!==t.indexOf("Opera/");return{USER_AGENT:t,supported:function(){var n=this.USER_AGENT.toLowerCase(),t="contentEditable"in i,r=document.execCommand&&document.queryCommandSupported&&document.queryCommandState,u=document.querySelector&&document.querySelectorAll,f=this.isIos()&&e(n)<5||this.isAndroid()&&o(n)<4||-1!==n.indexOf("opera mobi")||-1!==n.indexOf("hpwos/");return t&&r&&u&&!f},isTouchDevice:function(){return this.supportsEvent("touchmove")},isIos:function(){return/ipad|iphone|ipod/i.test(this.USER_AGENT)},isAndroid:function(){return-1!==this.USER_AGENT.indexOf("Android")},supportsSandboxedIframes:function(){return n()},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in document)},displaysCaretInEmptyContentEditableCorrectly:function(){return n()},hasCurrentStyleProperty:function(){return"currentStyle"in i},hasHistoryIssue:function(){return r&&"Mac"===navigator.platform.substr(0,3)},insertsLineBreaksOnReturn:function(){return r},supportsPlaceholderAttributeOn:function(n){return"placeholder"in n},supportsEvent:function(n){return"on"+n in i||function(){return i.setAttribute("on"+n,"return;"),"function"==typeof i["on"+n]}()},supportsEventsInIframeCorrectly:function(){return!u},supportsHTML5Tags:function(n){var t=n.createElement("div"),i="<article>foo<\/article>";return t.innerHTML=i,t.innerHTML.toLowerCase()===i},supportsCommand:function(){var t={formatBlock:n(10,"<="),insertUnorderedList:n(),insertOrderedList:n()},i={insertHTML:r};return function(n,r){var u=t[r];if(!u){try{return n.queryCommandSupported(r)}catch(f){}try{return n.queryCommandEnabled(r)}catch(e){return!!i[r]}}return!1}}(),doesAutoLinkingInContentEditable:function(){return n()},canDisableAutoLinking:function(){return this.supportsCommand(document,"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return r||u||f},supportsGetAttributeCorrectly:function(){var n=document.createElement("td");return"1"!=n.getAttribute("rowspan")},canSelectImagesInContentEditable:function(){return r||n()||u},autoScrollsToCaret:function(){return!f},autoClosesUnclosedTags:function(){var n,t,r=i.cloneNode(!1);return r.innerHTML="<p><div><\/div>",t=r.innerHTML.toLowerCase(),n="<p><\/p><div><\/div>"===t||"<p><div><\/div><\/p>"===t,this.autoClosesUnclosedTags=function(){return n},n},supportsNativeGetElementsByClassName:function(){return-1!==(document.getElementsByClassName+"").indexOf("[native code]")},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},needsSpaceAfterLineBreak:function(){return u},supportsSpeechApiOn:function(n){var i=t.match(/Chrome\/(\d+)/)||[void 0,0];return i[1]>=11&&("onwebkitspeechchange"in n||"speech"in n)},crashesWhenDefineProperty:function(t){return n(9)&&("XMLHttpRequest"===t||"XDomainRequest"===t)},doesAsyncFocus:function(){return n()},hasProblemsSettingCaretAfterImg:function(){return n()},hasUndoInContextMenu:function(){return r||s||u},hasInsertNodeIssue:function(){return u},hasIframeFocusIssue:function(){return n()},createsNestedInvalidMarkupAfterPaste:function(){return f},supportsMutationEvents:function(){return"MutationEvent"in window},supportsModenPaste:function(){return!("clipboardData"in window)}}}();wysihtml5.lang.array=function(n){return{contains:function(t){if(Array.isArray(t)){for(var i=t.length;i--;)if(-1!==wysihtml5.lang.array(n).indexOf(t[i]))return!0;return!1}return-1!==wysihtml5.lang.array(n).indexOf(t)},indexOf:function(t){if(n.indexOf)return n.indexOf(t);for(var i=0,r=n.length;r>i;i++)if(n[i]===t)return i;return-1},without:function(t){t=wysihtml5.lang.array(t);for(var r=[],i=0,u=n.length;u>i;i++)t.contains(n[i])||r.push(n[i]);return r},get:function(){for(var t=0,r=n.length,i=[];r>t;t++)i.push(n[t]);return i},map:function(t,i){if(Array.prototype.map)return n.map(t,i);for(var u=n.length>>>0,f=Array(u),r=0;u>r;r++)f[r]=t.call(i,n[r],r,n);return f},unique:function(){for(var i=[],r=n.length,t=0;r>t;)wysihtml5.lang.array(i).contains(n[t])||i.push(n[t]),t++;return i}}};wysihtml5.lang.Dispatcher=Base.extend({on:function(n,t){return this.events=this.events||{},this.events[n]=this.events[n]||[],this.events[n].push(t),this},off:function(n,t){this.events=this.events||{};var i,u,r=0;if(n){for(i=this.events[n]||[],u=[];r<i.length;r++)i[r]!==t&&t&&u.push(i[r]);this.events[n]=u}else this.events={};return this},fire:function(n,t){this.events=this.events||{};for(var r=this.events[n]||[],i=0;i<r.length;i++)r[i].call(this,t);return this},observe:function(){return this.on.apply(this,arguments)},stopObserving:function(){return this.off.apply(this,arguments)}});wysihtml5.lang.object=function(n){return{merge:function(t){for(var i in t)n[i]=t[i];return this},get:function(){return n},clone:function(t){var i,r={};if(null===n||!wysihtml5.lang.object(n).isPlainObject())return n;for(i in n)n.hasOwnProperty(i)&&(r[i]=t?wysihtml5.lang.object(n[i]).clone(t):n[i]);return r},isArray:function(){return"[object Array]"===Object.prototype.toString.call(n)},isFunction:function(){return"[object Function]"===Object.prototype.toString.call(n)},isPlainObject:function(){return"[object Object]"===Object.prototype.toString.call(n)}}},function(){var n=/^\s+/,t=/\s+$/,i=/[&<>\t"]/g,r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","\t":"&nbsp; "};wysihtml5.lang.string=function(u){return u+="",{trim:function(){return u.replace(n,"").replace(t,"")},interpolate:function(n){for(var t in n)u=this.replace("#{"+t+"}").by(n[t]);return u},replace:function(n){return{by:function(t){return u.split(n).join(t)}}},escapeHTML:function(n,t){var f=u.replace(i,function(n){return r[n]});return n&&(f=f.replace(/(?:\r\n|\r|\n)/g,"<br />")),t&&(f=f.replace(/  /gi,"&nbsp; ")),f}}}}(),function(n){function e(n,t){return c(n,t)?n:(n===n.ownerDocument.documentElement&&(n=n.ownerDocument.body),i(n,t))}function o(n){return n.replace(t,function(n,t){var i,e,r=(t.match(u)||[])[1]||"",o=l[r];return t=t.replace(u,""),t.split(o).length>t.split(r).length&&(t+=r,r=""),i=t,e=t,t.length>f&&(e=e.substr(0,f)+"..."),"www."===i.substr(0,4)&&(i="http://"+i),'<a href="'+i+'">'+e+"<\/a>"+r})}function s(n){var t=n._wysihtml5_tempElement;return t||(t=n._wysihtml5_tempElement=n.createElement("div")),t}function h(t){var r=t.parentNode,u=n.lang.string(t.data).escapeHTML(),i=s(r.ownerDocument);for(i.innerHTML="<span><\/span>"+o(u),i.removeChild(i.firstChild);i.firstChild;)r.insertBefore(i.firstChild,t);r.removeChild(t)}function c(t,i){for(var u;t.parentNode;){if((t=t.parentNode,u=t.nodeName,t.className&&n.lang.array(t.className.split(" ")).contains(i))||r.contains(u))return!0;if("body"===u)return!1}return!1}function i(u,f){if(!(r.contains(u.nodeName)||u.className&&n.lang.array(u.className.split(" ")).contains(f))){if(u.nodeType===n.TEXT_NODE&&u.data.match(t))return h(u),void 0;for(var o=n.lang.array(u.childNodes).get(),s=o.length,e=0;s>e;e++)i(o[e],f);return u}}var r=n.lang.array(["CODE","PRE","A","SCRIPT","HEAD","TITLE","STYLE"]),t=/((https?:\/\/|www\.)[^\s<]{3,})/gi,u=/([^\w\/\-](,?))$/i,f=100,l={")":"(","]":"[","}":"{"};n.dom.autoLink=e;n.dom.autoLink.URL_REG_EXP=t}(wysihtml5),function(n){var t=n.dom;t.addClass=function(n,i){var r=n.classList;return r?r.add(i):(t.hasClass(n,i)||(n.className+=" "+i),void 0)};t.removeClass=function(n,t){var i=n.classList;return i?i.remove(t):(n.className=n.className.replace(RegExp("(^|\\s+)"+t+"(\\s+|$)")," "),void 0)};t.hasClass=function(n,t){var i,r=n.classList;return r?r.contains(t):(i=n.className,i.length>0&&(i==t||RegExp("(^|\\s)"+t+"(\\s|$)").test(i)))}}(wysihtml5);wysihtml5.dom.contains=function(){var n=document.documentElement;return n.contains?function(n,t){return t.nodeType!==wysihtml5.ELEMENT_NODE&&(t=t.parentNode),n!==t&&n.contains(t)}:n.compareDocumentPosition?function(n,t){return!!(16&n.compareDocumentPosition(t))}:void 0}();wysihtml5.dom.convertToList=function(){function n(n,t){var i=n.createElement("li");return t.appendChild(i),i}function t(n,t){return n.createElement(t)}function i(i,r,u){if("UL"===i.nodeName||"OL"===i.nodeName||"MENU"===i.nodeName)return i;for(var l,v,o,s,h,y,p,f,a=i.ownerDocument,c=t(a,r),w=i.querySelectorAll("br"),b=w.length,e=0;b>e;e++)for(s=w[e];(h=s.parentNode)&&h!==i&&h.lastChild===s;){if("block"===wysihtml5.dom.getStyle("display").from(h)){h.removeChild(s);break}wysihtml5.dom.insert(s).after(s.parentNode)}for(l=wysihtml5.lang.array(i.childNodes).get(),v=l.length,e=0;v>e;e++)f=f||n(a,c),o=l[e],y="block"===wysihtml5.dom.getStyle("display").from(o),p="BR"===o.nodeName,!y||u&&wysihtml5.dom.hasClass(o,u)?p?f=f.firstChild?null:f:f.appendChild(o):(f=f.firstChild?n(a,c):f,f.appendChild(o),f=null);return 0===l.length&&n(a,c),i.parentNode.replaceChild(c,i),c}return i}();wysihtml5.dom.copyAttributes=function(n){return{from:function(t){return{to:function(i){for(var r,u=0,f=n.length;f>u;u++)r=n[u],void 0!==t[r]&&""!==t[r]&&(i[r]=t[r]);return{andTo:arguments.callee}}}}}},function(n){var t=["-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing"],i=function(t){return r(t)?parseInt(n.getStyle("width").from(t),10)<t.offsetWidth:!1},r=function(i){for(var r=0,u=t.length;u>r;r++)if("border-box"===n.getStyle(t[r]).from(i))return t[r]};n.copyStyles=function(r){return{from:function(u){i(u)&&(r=wysihtml5.lang.array(r).without(t));for(var f,o="",s=r.length,e=0;s>e;e++)f=r[e],o+=f+":"+n.getStyle(f).from(u)+";";return{to:function(t){return n.setStyles(o).on(t),{andTo:arguments.callee}}}}}}}(wysihtml5.dom),function(n){n.dom.delegate=function(t,i,r,u){return n.dom.observe(t,r,function(r){for(var f=r.target,e=n.lang.array(t.querySelectorAll(i));f&&f!==t;){if(e.contains(f)){u.call(f,r);break}f=f.parentNode}})}}(wysihtml5),function(n){n.dom.domNode=function(t){var i=[n.ELEMENT_NODE,n.TEXT_NODE],r=function(t){return t.nodeType===n.TEXT_NODE&&/^\s*$/g.test(t.data)};return{prev:function(u){var f=t.previousSibling,e=u&&u.nodeTypes?u.nodeTypes:i;return f?!n.lang.array(e).contains(f.nodeType)||u&&u.ignoreBlankTexts&&r(f)?n.dom.domNode(f).prev(u):f:null},next:function(u){var f=t.nextSibling,e=u&&u.nodeTypes?u.nodeTypes:i;return f?!n.lang.array(e).contains(f.nodeType)||u&&u.ignoreBlankTexts&&r(f)?n.dom.domNode(f).next(u):f:null}}}}(wysihtml5);wysihtml5.dom.getAsDom=function(){var t=function(n,t){var i=t.createElement("div");i.style.display="none";t.body.appendChild(i);try{i.innerHTML=n}catch(r){}return t.body.removeChild(i),i},i=function(t){if(!t._wysihtml5_supportsHTML5Tags){for(var i=0,r=n.length;r>i;i++)t.createElement(n[i]);t._wysihtml5_supportsHTML5Tags=!0}},n=["abbr","article","aside","audio","bdi","canvas","command","datalist","details","figcaption","figure","footer","header","hgroup","keygen","mark","meter","nav","output","progress","rp","rt","ruby","svg","section","source","summary","time","track","video","wbr"];return function(n,r){r=r||document;var u;return"object"==typeof n&&n.nodeType?(u=r.createElement("div"),u.appendChild(n)):wysihtml5.browser.supportsHTML5Tags(r)?(u=r.createElement("div"),u.innerHTML=n):(i(r),u=t(n,r)),u}}();wysihtml5.dom.getParentElement=function(){function n(n,t){return t&&t.length?"string"==typeof t?n===t:wysihtml5.lang.array(t).contains(n):!0}function t(n){return n.nodeType===wysihtml5.ELEMENT_NODE}function i(n,t,i){var r=(n.className||"").match(i)||[];return t?r[r.length-1]===t:!!r.length}function r(n,t,i){var r=(n.getAttribute("style")||"").match(i)||[];return t?r[r.length-1]===t:!!r.length}return function(u,f,e,o){var s=f.cssStyle||f.styleRegExp,h=f.className||f.classRegExp;for(e=e||50;e--&&u&&"BODY"!==u.nodeName&&(!o||u!==o);){if(t(u)&&n(u.nodeName,f.nodeName)&&(!s||r(u,f.cssStyle,f.styleRegExp))&&(!h||i(u,f.className,f.classRegExp)))return u;u=u.parentNode}return null}}();wysihtml5.dom.getStyle=function(){function n(n){return n.replace(i,function(n){return n.charAt(1).toUpperCase()})}var t={float:"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat"},i=/\-[a-z]/g;return function(i){return{from:function(r){var f,e,u,o,s,h,c,l,a;if(r.nodeType===wysihtml5.ELEMENT_NODE){if(f=r.ownerDocument,e=t[i]||n(i),u=r.style,o=r.currentStyle,s=u[e],s)return s;if(o)try{return o[e]}catch(v){}return h=f.defaultView||f.parentWindow,c=("height"===i||"width"===i)&&"TEXTAREA"===r.nodeName,h.getComputedStyle?(c&&(l=u.overflow,u.overflow="hidden"),a=h.getComputedStyle(r,null).getPropertyValue(i),c&&(u.overflow=l||""),a):void 0}}}}}();wysihtml5.dom.getTextNodes=function(n,t){var i=[];for(n=n.firstChild;n;n=n.nextSibling)3==n.nodeType?t&&/^\s*$/.test(n.innerText||n.textContent)||i.push(n):i=i.concat(wysihtml5.dom.getTextNodes(n,t));return i};wysihtml5.dom.hasElementWithTagName=function(){function t(n){return n._wysihtml5_identifier||(n._wysihtml5_identifier=i++)}var n={},i=1;return function(i,r){var f=t(i)+":"+r,u=n[f];return u||(u=n[f]=i.getElementsByTagName(r)),u.length>0}}(),function(n){function i(n){return n._wysihtml5_identifier||(n._wysihtml5_identifier=r++)}var t={},r=1;n.dom.hasElementWithClassName=function(r,u){if(!n.browser.supportsNativeGetElementsByClassName())return!!r.querySelector("."+u);var e=i(r)+":"+u,f=t[e];return f||(f=t[e]=r.getElementsByClassName(u)),f.length>0}}(wysihtml5);wysihtml5.dom.insert=function(n){return{after:function(t){t.parentNode.insertBefore(n,t.nextSibling)},before:function(t){t.parentNode.insertBefore(n,t)},into:function(t){t.appendChild(n)}}};wysihtml5.dom.insertCSS=function(n){return n=n.join("\n"),{into:function(t){var r,u,i=t.createElement("style");return i.type="text/css",i.styleSheet?i.styleSheet.cssText=n:i.appendChild(t.createTextNode(n)),r=t.querySelector("head link"),r?(r.parentNode.insertBefore(i,r),void 0):(u=t.querySelector("head"),u&&u.appendChild(i),void 0)}}},function(n){n.dom.lineBreaks=function(t){function i(n){return"BR"===n.nodeName}function r(t){return i(t)?!0:"block"===n.dom.getStyle("display").from(t)?!0:!1}return{add:function(){var i=t.ownerDocument,u=n.dom.domNode(t).next({ignoreBlankTexts:!0}),f=n.dom.domNode(t).prev({ignoreBlankTexts:!0});u&&!r(u)&&n.dom.insert(i.createElement("br")).after(t);f&&!r(f)&&n.dom.insert(i.createElement("br")).before(t)},remove:function(){var r=n.dom.domNode(t).next({ignoreBlankTexts:!0}),u=n.dom.domNode(t).prev({ignoreBlankTexts:!0});r&&i(r)&&r.parentNode.removeChild(r);u&&i(u)&&u.parentNode.removeChild(u)}}}}(wysihtml5);wysihtml5.dom.observe=function(n,t,i){t="string"==typeof t?[t]:t;for(var r,u,f=0,e=t.length;e>f;f++)u=t[f],n.addEventListener?n.addEventListener(u,i,!1):(r=function(t){"target"in t||(t.target=t.srcElement);t.preventDefault=t.preventDefault||function(){this.returnValue=!1};t.stopPropagation=t.stopPropagation||function(){this.cancelBubble=!0};i.call(n,t)},n.attachEvent("on"+u,r));return{stop:function(){for(var u,f=0,e=t.length;e>f;f++)u=t[f],n.removeEventListener?n.removeEventListener(u,i,!1):n.detachEvent("on"+u,r)}}};wysihtml5.dom.parse=function(n,t){function c(n,t){var c,f,a,v,u,e,o,s,h;for(wysihtml5.lang.object(i).merge(tt).merge(t.rules).get(),c=t.context||n.ownerDocument||document,f=c.createDocumentFragment(),a="string"==typeof n,v=!1,t.clearInternals===!0&&(v=!0),u=a?wysihtml5.dom.getAsDom(n,c):n,i.selectors&&l(u,i.selectors);u.firstChild;)o=u.firstChild,e=r(o,t.cleanUp,v,t.uneditableClass),e&&f.appendChild(e),o!==e&&u.removeChild(o);if(t.unjoinNbsps)for(s=wysihtml5.dom.getTextNodes(f),h=s.length;h--;)s[h].nodeValue=s[h].nodeValue.replace(/([\S\u00A0])\u00A0/gi,"$1 ");return u.innerHTML="",u.appendChild(f),a?wysihtml5.quirks.getCorrectInnerHTML(u):u}function r(n,t,i,f){var o,e,h,l=n.nodeType,c=n.childNodes,a=c.length,v=nt[l],s=0;if(f&&1===l&&wysihtml5.dom.hasClass(n,f))return n;if(e=v&&v(n,i),!e){if(e===!1){for(o=n.ownerDocument.createDocumentFragment(),s=a;s--;)c[s]&&(h=r(c[s],t,i,f),h&&(c[s]===h&&s--,o.insertBefore(h,o.firstChild)));return"block"===wysihtml5.dom.getStyle("display").from(n)&&o.appendChild(n.ownerDocument.createElement("br")),wysihtml5.lang.array(["div","pre","p","table","td","th","ul","ol","li","dd","dl","footer","header","section","h1","h2","h3","h4","h5","h6"]).contains(n.nodeName.toLowerCase())&&n.parentNode.lastChild!==n&&(n.nextSibling&&3===n.nextSibling.nodeType&&/^\s/.test(n.nextSibling.nodeValue)||o.appendChild(n.ownerDocument.createTextNode(" "))),o.normalize&&o.normalize(),o}return null}for(s=0;a>s;s++)c[s]&&(h=r(c[s],t,i,f),h&&(c[s]===h&&s--,e.appendChild(h)));if(t&&e.nodeName.toLowerCase()===u&&(!e.childNodes.length||/^\s*$/gi.test(e.innerHTML)&&(i||"_wysihtml5-temp-placeholder"!==n.className&&"rangySelectionBoundary"!==n.className)||!e.attributes.length)){for(o=e.ownerDocument.createDocumentFragment();e.firstChild;)o.appendChild(e.firstChild);return o.normalize&&o.normalize(),o}return e.normalize&&e.normalize(),e}function l(n,t){var i,r,u,f;for(i in t)if(t.hasOwnProperty(i))for(wysihtml5.lang.object(t[i]).isFunction()?r=t[i]:"string"==typeof t[i]&&h[t[i]]&&(r=h[t[i]]),u=n.querySelectorAll(i),f=u.length;f--;)r(u[f])}function a(n,t){var r,f,s,h=i.tags,e=n.nodeName.toLowerCase(),o=n.scopeName;if(n._wysihtml5||(n._wysihtml5=1,"wysihtml5-temp"===n.className))return null;if(o&&"HTML"!=o&&(e=o+":"+e),"outerHTML"in n&&(wysihtml5.browser.autoClosesUnclosedTags()||"P"!==n.nodeName||"<\/p>"===n.outerHTML.slice(-4).toLowerCase()||(e="div")),e in h){if(r=h[e],!r||r.remove)return null;if(r.unwrap)return!1;r="string"==typeof r?{rename_tag:r}:r}else{if(!n.firstChild)return null;r={rename_tag:u}}if(r.one_of_type&&!v(n,i,r.one_of_type,t)){if(!r.remove_action)return null;if("unwrap"===r.remove_action)return!1;if("rename"!==r.remove_action)return null;s=r.remove_action_rename_to||u}return f=n.ownerDocument.createElement(s||r.rename_tag||e),k(n,f,r,t),p(n,f,r),n=null,f.normalize&&f.normalize(),f}function v(n,t,i,r){var f,u;if("SPAN"===n.nodeName&&!r&&("_wysihtml5-temp-placeholder"===n.className||"rangySelectionBoundary"===n.className))return!0;for(u in i)if(i.hasOwnProperty(u)&&t.type_definitions&&t.type_definitions[u]&&(f=t.type_definitions[u],y(n,f)))return!0;return!1}function y(n,t){var v,i,e,c,l,o,h,a,r=n.getAttribute("class"),u=n.getAttribute("style");if(t.methods)for(o in t.methods)if(t.methods.hasOwnProperty(o)&&s[o]&&s[o](n))return!0;if(r&&t.classes)for(r=r.replace(/^\s+/g,"").replace(/\s+$/g,"").split(f),v=r.length,h=0;v>h;h++)if(t.classes[r[h]])return!0;if(u&&t.styles){u=u.split(";");for(i in t.styles)if(t.styles.hasOwnProperty(i))for(a=u.length;a--;)if(l=u[a].split(":"),l[0].replace(/\s/g,"").toLowerCase()===i&&(t.styles[i]===!0||1===t.styles[i]||wysihtml5.lang.array(t.styles[i]).contains(l[1].replace(/\s/g,"").toLowerCase())))return!0}if(t.attrs)for(e in t.attrs)if(t.attrs.hasOwnProperty(e)&&(c=wysihtml5.dom.getAttribute(n,e),"string"==typeof c&&c.search(t.attrs[e])>-1))return!0;return!1}function p(n,t,i){var r,u;if(i&&i.keep_styles)for(r in i.keep_styles)if(i.keep_styles.hasOwnProperty(r)){if(u="float"===r?n.style.styleFloat||n.style.cssFloat:n.style[r],i.keep_styles[r]instanceof RegExp&&!i.keep_styles[r].test(u))continue;"float"===r?t.style[n.style.styleFloat?"styleFloat":"cssFloat"]=u:n.style[r]&&(t.style[r]=u)}}function w(n,t){var i,r=[];for(i in t)t.hasOwnProperty(i)&&0===i.indexOf(n)&&r.push(i);return r}function o(n,t,i,r){var u,f=it[i];return f&&(t||"alt"===n&&"IMG"==r)&&(u=f(t),"string"==typeof u)?u:!1}function b(n,t){var r,u,e,f,l,a=wysihtml5.lang.object(i.attributes||{}).clone(),s=wysihtml5.lang.object(a).merge(wysihtml5.lang.object(t||{}).clone()).get(),h={},c=wysihtml5.dom.getAttributes(n);for(r in s)if(/\*$/.test(r))for(e=w(r.slice(0,-1),c),f=0,l=e.length;l>f;f++)u=o(e[f],c[e[f]],s[r],n.nodeName),u!==!1&&(h[e[f]]=u);else u=o(r,c[r],s[r],n.nodeName),u!==!1&&(h[r]=u);return h}function k(n,t,r,u){var p,h,w,s,c,e={},nt=r.set_class,k=r.add_class,d=r.add_style,tt=r.set_attributes,l=i.classes,a=0,o=[],g=[],v=[],y=[];if(tt&&(e=wysihtml5.lang.object(tt).clone()),e=wysihtml5.lang.object(e).merge(b(n,r.check_attributes)).get(),nt&&o.push(nt),k)for(s in k)c=ut[k[s]],c&&(w=c(wysihtml5.dom.getAttribute(n,s)),"string"==typeof w&&o.push(w));if(d)for(s in d)c=rt[d[s]],c&&(newStyle=c(wysihtml5.dom.getAttribute(n,s)),"string"==typeof newStyle&&g.push(newStyle));if("string"==typeof l&&"any"===l&&n.getAttribute("class"))if(i.classes_blacklist){for(y=n.getAttribute("class"),y&&(o=o.concat(y.split(f))),p=o.length;p>a;a++)h=o[a],i.classes_blacklist[h]||v.push(h);v.length&&(e["class"]=wysihtml5.lang.array(v).unique().join(" "))}else e["class"]=n.getAttribute("class");else{for(u||(l["_wysihtml5-temp-placeholder"]=1,l._rangySelectionBoundary=1,l["wysiwyg-tmp-selected-cell"]=1),y=n.getAttribute("class"),y&&(o=o.concat(y.split(f))),p=o.length;p>a;a++)h=o[a],l[h]&&v.push(h);v.length&&(e["class"]=wysihtml5.lang.array(v).unique().join(" "))}e["class"]&&u&&(e["class"]=e["class"].replace("wysiwyg-tmp-selected-cell",""),/^\s*$/g.test(e["class"])&&delete e["class"]);g.length&&(e.style=wysihtml5.lang.array(g).unique().join(" "));for(s in e)try{t.setAttribute(s,e[s])}catch(it){}e.src&&(void 0!==e.width&&t.setAttribute("width",e.width),void 0!==e.height&&t.setAttribute("height",e.height))}function d(n){var i,t=n.nextSibling;return t&&t.nodeType===wysihtml5.TEXT_NODE?(t.data=n.data.replace(e,"")+t.data.replace(e,""),void 0):(i=n.data.replace(e,""),n.ownerDocument.createTextNode(i))}function g(n){if(i.comments)return n.ownerDocument.createComment(n.nodeValue)}var nt={1:a,3:d,8:g},u="span",f=/\s+/,tt={tags:{},classes:{}},i={},e=/\uFEFF/g,it={url:function(){var n=/^https?:\/\//i;return function(t){return t&&t.match(n)?t.replace(n,function(n){return n.toLowerCase()}):null}}(),src:function(){var n=/^(\/|https?:\/\/)/i;return function(t){return t&&t.match(n)?t.replace(n,function(n){return n.toLowerCase()}):null}}(),href:function(){var n=/^(#|\/|https?:\/\/|mailto:)/i;return function(t){return t&&t.match(n)?t.replace(n,function(n){return n.toLowerCase()}):null}}(),alt:function(){var n=/[^ a-z0-9_\-]/gi;return function(t){return t?t.replace(n,""):""}}(),numbers:function(){var n=/\D/g;return function(t){return t=(t||"").replace(n,""),t||null}}(),any:function(){return function(n){return n}}()},rt={align_text:function(){var n={left:"text-align: left;",right:"text-align: right;",center:"text-align: center;"};return function(t){return n[(t+"").toLowerCase()]}}()},ut={align_img:function(){var n={left:"wysiwyg-float-left",right:"wysiwyg-float-right"};return function(t){return n[(t+"").toLowerCase()]}}(),align_text:function(){var n={left:"wysiwyg-text-align-left",right:"wysiwyg-text-align-right",center:"wysiwyg-text-align-center",justify:"wysiwyg-text-align-justify"};return function(t){return n[(t+"").toLowerCase()]}}(),clear_br:function(){var n={left:"wysiwyg-clear-left",right:"wysiwyg-clear-right",both:"wysiwyg-clear-both",all:"wysiwyg-clear-both"};return function(t){return n[(t+"").toLowerCase()]}}(),size_font:function(){var n={1:"wysiwyg-font-size-xx-small",2:"wysiwyg-font-size-small",3:"wysiwyg-font-size-medium",4:"wysiwyg-font-size-large",5:"wysiwyg-font-size-x-large",6:"wysiwyg-font-size-xx-large",7:"wysiwyg-font-size-xx-large","-":"wysiwyg-font-size-smaller","+":"wysiwyg-font-size-larger"};return function(t){return n[(t+"").charAt(0)]}}()},s={has_visible_contet:function(){var n,t=["img","video","picture","br","script","noscript","style","table","iframe","object","embed","audio","svg","input","button","select","textarea","canvas"];return function(i){if(n=(i.innerText||i.textContent).replace(/\s/g,""),n&&n.length>0)return!0;for(var r=t.length;r--;)if(i.querySelector(t[r]))return!0;return i.offsetWidth&&i.offsetWidth>0&&i.offsetHeight&&i.offsetHeight>0?!0:!1}}()},h={unwrap:function(n){wysihtml5.dom.unwrap(n)},remove:function(n){n.parentNode.removeChild(n)}};return c(n,t)};wysihtml5.dom.removeEmptyTextNodes=function(n){for(var t,r=wysihtml5.lang.array(n.childNodes).get(),u=r.length,i=0;u>i;i++)t=r[i],t.nodeType===wysihtml5.TEXT_NODE&&""===t.data&&t.parentNode.removeChild(t)};wysihtml5.dom.renameElement=function(n,t){for(var r,i=n.ownerDocument.createElement(t);r=n.firstChild;)i.appendChild(r);return wysihtml5.dom.copyAttributes(["align","className"]).from(n).to(i),n.parentNode.replaceChild(i,n),i};wysihtml5.dom.replaceWithChildNodes=function(n){if(n.parentNode){if(!n.firstChild)return n.parentNode.removeChild(n),void 0;for(var t=n.ownerDocument.createDocumentFragment();n.firstChild;)t.appendChild(n.firstChild);n.parentNode.replaceChild(t,n);n=t=null}},function(n){function t(t){return"block"===n.getStyle("display").from(t)}function i(n){return"BR"===n.nodeName}function r(n){var t=n.ownerDocument.createElement("br");n.appendChild(t)}function u(n,u){if(n.nodeName.match(/^(MENU|UL|OL)$/)){var e,c,l,a,s,f,v=n.ownerDocument,o=v.createDocumentFragment(),h=wysihtml5.dom.domNode(n).prev({ignoreBlankTexts:!0});if(u)for(!h||t(h)||i(h)||r(o);f=n.firstElementChild||n.firstChild;){for(c=f.lastChild;e=f.firstChild;)l=e===c,a=l&&!t(e)&&!i(e),o.appendChild(e),a&&r(o);f.parentNode.removeChild(f)}else for(;f=n.firstElementChild||n.firstChild;){if(f.querySelector&&f.querySelector("div, p, ul, ol, menu, blockquote, h1, h2, h3, h4, h5, h6"))for(;e=f.firstChild;)o.appendChild(e);else{for(s=v.createElement("p");e=f.firstChild;)s.appendChild(e);o.appendChild(s)}f.parentNode.removeChild(f)}n.parentNode.replaceChild(o,n)}}n.resolveList=u}(wysihtml5.dom),function(n){var t=document,i=["parent","top","opener","frameElement","frames","localStorage","globalStorage","sessionStorage","indexedDB"],r=["open","close","openDialog","showModalDialog","alert","confirm","prompt","openDatabase","postMessage","XMLHttpRequest","XDomainRequest"],u=["referrer","write","open","close"];n.dom.Sandbox=Base.extend({constructor:function(t,i){this.callback=t||n.EMPTY_FUNCTION;this.config=n.lang.object({}).merge(i).get();this.editableArea=this._createIframe()},insertInto:function(n){"string"==typeof n&&(n=t.getElementById(n));n.appendChild(this.editableArea)},getIframe:function(){return this.editableArea},getWindow:function(){this._readyError()},getDocument:function(){this._readyError()},destroy:function(){var n=this.getIframe();n.parentNode.removeChild(n)},_readyError:function(){throw Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet");},_createIframe:function(){var r=this,i=t.createElement("iframe");return i.className="wysihtml5-sandbox",n.dom.setAttributes({security:"restricted",allowtransparency:"true",frameborder:0,width:0,height:0,marginwidth:0,marginheight:0}).on(i),n.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()&&(i.src="javascript:'<html><\/html>'"),i.onload=function(){i.onreadystatechange=i.onload=null;r._onLoadIframe(i)},i.onreadystatechange=function(){/loaded|complete/.test(i.readyState)&&(i.onreadystatechange=i.onload=null,r._onLoadIframe(i))},i},_onLoadIframe:function(f){var c,h,o,l,a,e,s;if(n.dom.contains(t.documentElement,f)){if(c=this,h=f.contentWindow,o=f.contentWindow.document,l=t.characterSet||t.charset||"utf-8",a=this._getHtml({charset:l,stylesheets:this.config.stylesheets}),o.open("text/html","replace"),o.write(a),o.close(),this.getWindow=function(){return f.contentWindow},this.getDocument=function(){return f.contentWindow.document},h.onerror=function(n,t,i){throw Error("wysihtml5.Sandbox: "+n,t,i);},!n.browser.supportsSandboxedIframes()){for(e=0,s=i.length;s>e;e++)this._unset(h,i[e]);for(e=0,s=r.length;s>e;e++)this._unset(h,r[e],n.EMPTY_FUNCTION);for(e=0,s=u.length;s>e;e++)this._unset(o,u[e]);this._unset(o,"cookie","",!0)}this.loaded=!0;setTimeout(function(){c.callback(c)},0)}},_getHtml:function(t){var u,i=t.stylesheets,f="",r=0;if(i="string"==typeof i?[i]:i,i)for(u=i.length;u>r;r++)f+='<link rel="stylesheet" href="'+i[r]+'">';return t.stylesheets=f,n.lang.string('<!DOCTYPE html><html><head><meta charset="#{charset}">#{stylesheets}<\/head><body><\/body><\/html>').interpolate(t)},_unset:function(t,i,r,u){try{t[i]=r}catch(e){}try{t.__defineGetter__(i,function(){return r})}catch(e){}if(u)try{t.__defineSetter__(i,function(){})}catch(e){}if(!n.browser.crashesWhenDefineProperty(i))try{var f={get:function(){return r}};u&&(f.set=function(){});Object.defineProperty(t,i,f)}catch(e){}}})}(wysihtml5),function(n){var t=document;n.dom.ContentEditableArea=Base.extend({getContentEditable:function(){return this.element},getWindow:function(){return this.element.ownerDocument.defaultView},getDocument:function(){return this.element.ownerDocument},constructor:function(t,i,r){this.callback=t||n.EMPTY_FUNCTION;this.config=n.lang.object({}).merge(i).get();this.element=r?this._bindElement(r):this._createElement()},_createElement:function(){var n=t.createElement("div");return n.className="wysihtml5-sandbox",this._loadElement(n),n},_bindElement:function(n){return n.className=n.className&&""!=n.className?n.className+" wysihtml5-sandbox":"wysihtml5-sandbox",this._loadElement(n,!0),n},_loadElement:function(n,t){var i,r=this;t||(i=this._getHtml(),n.innerHTML=i);this.getWindow=function(){return n.ownerDocument.defaultView};this.getDocument=function(){return n.ownerDocument};this.loaded=!0;setTimeout(function(){r.callback(r)},0)},_getHtml:function(){return""}})}(wysihtml5),function(){var n={className:"class"};wysihtml5.dom.setAttributes=function(t){return{on:function(i){for(var r in t)i.setAttribute(n[r]||r,t[r])}}}}();wysihtml5.dom.setStyles=function(n){return{on:function(t){var i,r=t.style;if("string"==typeof n)return r.cssText+=";"+n,void 0;for(i in n)"float"===i?(r.cssFloat=n[i],r.styleFloat=n[i]):r[i]=n[i]}}},function(n){n.simulatePlaceholder=function(t,i,r){var e="placeholder",u=function(){var t=i.element.offsetWidth>0&&i.element.offsetHeight>0;i.hasPlaceholderSet()&&(i.clear(),i.element.focus(),t&&setTimeout(function(){var n=i.selection.getSelection();n.focusNode&&n.anchorNode||i.selection.selectNode(i.element.firstChild||i.element)},0));i.placeholderSet=!1;n.removeClass(i.element,e)},f=function(){i.isEmpty()&&(i.placeholderSet=!0,i.setValue(r),n.addClass(i.element,e))};t.on("set_placeholder",f).on("unset_placeholder",u).on("focus:composer",u).on("paste:composer",u).on("blur:composer",f);f()}}(wysihtml5.dom),function(n){var t=document.documentElement;"textContent"in t?(n.setTextContent=function(n,t){n.textContent=t},n.getTextContent=function(n){return n.textContent}):"innerText"in t?(n.setTextContent=function(n,t){n.innerText=t},n.getTextContent=function(n){return n.innerText}):(n.setTextContent=function(n,t){n.nodeValue=t},n.getTextContent=function(n){return n.nodeValue})}(wysihtml5.dom);wysihtml5.dom.getAttribute=function(n,t){var i,r,u,f=!wysihtml5.browser.supportsGetAttributeCorrectly();return t=t.toLowerCase(),i=n.nodeName,"IMG"==i&&"src"==t&&wysihtml5.dom.isLoadedImage(n)===!0?n.src:f&&"outerHTML"in n?(r=n.outerHTML.toLowerCase(),u=-1!=r.indexOf(" "+t+"="),u?n.getAttribute(t):null):n.getAttribute(t)};wysihtml5.dom.getAttributes=function(n){var t,r=!wysihtml5.browser.supportsGetAttributeCorrectly(),u=n.nodeName,i=[];for(t in n.attributes)(n.attributes.hasOwnProperty&&n.attributes.hasOwnProperty(t)||!n.attributes.hasOwnProperty&&Object.prototype.hasOwnProperty.call(n.attributes,t))&&n.attributes[t].specified&&("IMG"==u&&"src"==n.attributes[t].name.toLowerCase()&&wysihtml5.dom.isLoadedImage(n)===!0?i.src=n.src:wysihtml5.lang.array(["rowspan","colspan"]).contains(n.attributes[t].name.toLowerCase())&&r?1!==n.attributes[t].value&&(i[n.attributes[t].name]=n.attributes[t].value):i[n.attributes[t].name]=n.attributes[t].value);return i};wysihtml5.dom.isLoadedImage=function(n){try{return n.complete&&!n.mozMatchesSelector(":-moz-broken")}catch(t){if(n.complete&&"complete"===n.readyState)return!0}},function(n){function e(n,t){for(var i,u,e=[],r=0,f=n.length;f>r;r++)if(i=n[r].querySelectorAll(t),i)for(u=i.length;u--;e.unshift(i[u]));return e}function u(n){n.parentNode.removeChild(n)}function r(n,t){n.parentNode.insertBefore(t,n.nextSibling)}function o(n,t){for(var i=n.nextSibling;1!=i.nodeType;)if(i=i.nextSibling,!t||t==i.tagName.toLowerCase())return i;return null}var t=n.dom,f=function(n){this.el=n;this.isColspan=!1;this.isRowspan=!1;this.firstCol=!0;this.lastCol=!0;this.firstRow=!0;this.lastRow=!0;this.isReal=!0;this.spanCollection=[];this.modified=!1},i=function(n,i){n?(this.cell=n,this.table=t.getParentElement(n,{nodeName:["TABLE"]})):i&&(this.table=i,this.cell=this.table.querySelectorAll("th, td")[0])};i.prototype={addSpannedCellToMap:function(n,t,i,r,u,e){for(var s,h=[],c=i+(e?parseInt(e,10)-1:0),l=r+(u?parseInt(u,10)-1:0),o=i;c>=o;o++)for(void 0===t[o]&&(t[o]=[]),s=r;l>=s;s++)t[o][s]=new f(n),t[o][s].isColspan=u&&parseInt(u,10)>1,t[o][s].isRowspan=e&&parseInt(e,10)>1,t[o][s].firstCol=s==r,t[o][s].lastCol=s==l,t[o][s].firstRow=o==i,t[o][s].lastRow=o==c,t[o][s].isReal=s==r&&o==i,t[o][s].spanCollection=h,h.push(t[o][s])},setCellAsModified:function(n){if(n.modified=!0,n.spanCollection.length>0)for(var t=0,i=n.spanCollection.length;i>t;t++)n.spanCollection[t].modified=!0},setTableMap:function(){for(var c,s,o,u,i,e,h,r=[],l=this.getTableRows(),n=0;n<l.length;n++)for(c=l[n],s=this.getRowCells(c),i=0,void 0===r[n]&&(r[n]=[]),o=0;o<s.length;o++){for(u=s[o];void 0!==r[n][i];)i++;e=t.getAttribute(u,"colspan");h=t.getAttribute(u,"rowspan");e||h?(this.addSpannedCellToMap(u,r,n,i,e,h),i+=e?parseInt(e,10):1):(r[n][i]=new f(u),i++)}return this.map=r,r},getRowCells:function(t){var i=this.table.querySelectorAll("table"),r=i?e(i,"th, td"):[],u=t.querySelectorAll("th, td");return r.length>0?n.lang.array(u).without(r):u},getTableRows:function(){var t=this.table.querySelectorAll("table"),i=t?e(t,"tr"):[],r=this.table.querySelectorAll("tr");return i.length>0?n.lang.array(r).without(i):r},getMapIndex:function(n){for(var i,r=this.map.length,u=this.map&&this.map[0]?this.map[0].length:0,t=0;r>t;t++)for(i=0;u>i;i++)if(this.map[t][i].el===n)return{row:t,col:i};return!1},getElementAtIndex:function(n){return this.setTableMap(),this.map[n.row]&&this.map[n.row][n.col]&&this.map[n.row][n.col].el?this.map[n.row][n.col].el:null},getMapElsTo:function(n){var r,u,t,f,i,e,o=[];if(this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(n),(this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col)&&(r=this.idx_start,this.idx_start=this.idx_end,this.idx_end=r),this.idx_start.col>this.idx_end.col&&(u=this.idx_start.col,this.idx_start.col=this.idx_end.col,this.idx_end.col=u),null!=this.idx_start&&null!=this.idx_end)for(t=this.idx_start.row,f=this.idx_end.row;f>=t;t++)for(i=this.idx_start.col,e=this.idx_end.col;e>=i;i++)o.push(this.map[t][i].el);return o},orderSelectionEnds:function(n){var t,i;return this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(n),(this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col)&&(t=this.idx_start,this.idx_start=this.idx_end,this.idx_end=t),this.idx_start.col>this.idx_end.col&&(i=this.idx_start.col,this.idx_start.col=this.idx_end.col,this.idx_end.col=i),{start:this.map[this.idx_start.row][this.idx_start.col].el,end:this.map[this.idx_end.row][this.idx_end.col].el}},createCells:function(n,t,i){for(var r,u,e=this.table.ownerDocument,o=e.createDocumentFragment(),f=0;t>f;f++){if(r=e.createElement(n),i)for(u in i)i.hasOwnProperty(u)&&r.setAttribute(u,i[u]);r.appendChild(document.createTextNode(" "));o.appendChild(r)}return o},correctColIndexForUnreals:function(n,t){for(var f=this.map[t],r=-1,i=0,u=n;n>i;i++)f[i].isReal&&r++;return r},getLastNewCellOnRow:function(n,t){for(var r,u,e=this.getRowCells(n),i=0,f=e.length;f>i;i++)if(r=e[i],u=this.getMapIndex(r),u===!1||void 0!==t&&u.row!=t)return r;return null},removeEmptyTable:function(){var n=this.table.querySelectorAll("td, th");return n&&0!=n.length?!1:(u(this.table),!0)},splitRowToCells:function(n){var i,u,f;n.isColspan&&(i=parseInt(t.getAttribute(n.el,"colspan")||1,10),u=n.el.tagName.toLowerCase(),i>1&&(f=this.createCells(u,i-1),r(n.el,f)),n.el.removeAttribute("colspan"))},getRealRowEl:function(n,i){var u,e,r=null,f=null;for(i=i||this.idx,u=0,e=this.map[i.row].length;e>u;u++)if(f=this.map[i.row][u],f.isReal&&(r=t.getParentElement(f.el,{nodeName:["TR"]}),r))return r;return null===r&&n&&(r=t.getParentElement(this.map[i.row][i.col].el,{nodeName:["TR"]})||null),r},injectRowAt:function(n,i,u,f,e){var s,h,o=this.getRealRowEl(!1,{row:n,col:i}),c=this.createCells(f,u);o?(s=this.correctColIndexForUnreals(i,n),s>=0?r(this.getRowCells(o)[s],c):o.insertBefore(c,o.firstChild)):(h=this.table.ownerDocument.createElement("tr"),h.appendChild(c),r(t.getParentElement(e.el,{nodeName:["TR"]}),h))},canMerge:function(n){var r,u,t,f,i,e;for(this.to=n,this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(this.to),(this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col)&&(r=this.idx_start,this.idx_start=this.idx_end,this.idx_end=r),this.idx_start.col>this.idx_end.col&&(u=this.idx_start.col,this.idx_start.col=this.idx_end.col,this.idx_end.col=u),t=this.idx_start.row,f=this.idx_end.row;f>=t;t++)for(i=this.idx_start.col,e=this.idx_end.col;e>=i;i++)if(this.map[t][i].isColspan||this.map[t][i].isRowspan)return!1;return!0},decreaseCellSpan:function(n,i){var r=parseInt(t.getAttribute(n.el,i),10)-1;r>=1?n.el.setAttribute(i,r):(n.el.removeAttribute(i),"colspan"==i&&(n.isColspan=!1),"rowspan"==i&&(n.isRowspan=!1),n.firstCol=!0,n.lastCol=!0,n.firstRow=!0,n.lastRow=!0,n.isReal=!0)},removeSurplusLines:function(){var n,f,i,e,r,o,s,h;if(this.setTableMap(),this.map){for(i=0,e=this.map.length;e>i;i++){for(n=this.map[i],s=!0,r=0,o=n.length;o>r;r++)if(f=n[r],!(t.getAttribute(f.el,"rowspan")&&parseInt(t.getAttribute(f.el,"rowspan"),10)>1&&f.firstRow!==!0)){s=!1;break}if(s)for(r=0;o>r;r++)this.decreaseCellSpan(n[r],"rowspan")}for(h=this.getTableRows(),i=0,e=h.length;e>i;i++)n=h[i],0==n.childNodes.length&&/^\s*$/.test(n.textContent||n.innerText)&&u(n)}},fillMissingCells:function(){var i,n,t,e=0,o=0,u=null;if(this.setTableMap(),this.map){for(e=this.map.length,i=0;e>i;i++)this.map[i].length>o&&(o=this.map[i].length);for(n=0;e>n;n++)for(t=0;o>t;t++)this.map[n]&&!this.map[n][t]&&t>0&&(this.map[n][t]=new f(this.createCells("td",1)),u=this.map[n][t-1],u&&u.el&&u.el.parent&&r(this.map[n][t-1].el,this.map[n][t].el))}},rectify:function(){return this.removeEmptyTable()?!1:(this.removeSurplusLines(),this.fillMissingCells(),!0)},unmerge:function(){var n,u,f,r,i,e;if(this.rectify()&&(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx)){if(n=this.map[this.idx.row][this.idx.col],u=t.getAttribute(n.el,"colspan")?parseInt(t.getAttribute(n.el,"colspan"),10):1,f=n.el.tagName.toLowerCase(),n.isRowspan){if(r=parseInt(t.getAttribute(n.el,"rowspan"),10),r>1)for(i=1,e=r-1;e>=i;i++)this.injectRowAt(this.idx.row+i,this.idx.col,u,f,n);n.el.removeAttribute("rowspan")}this.splitRowToCells(n)}},merge:function(n){var r,f,t,e,i,o;if(this.rectify())if(this.canMerge(n)){for(r=this.idx_end.row-this.idx_start.row+1,f=this.idx_end.col-this.idx_start.col+1,t=this.idx_start.row,e=this.idx_end.row;e>=t;t++)for(i=this.idx_start.col,o=this.idx_end.col;o>=i;i++)t==this.idx_start.row&&i==this.idx_start.col?(r>1&&this.map[t][i].el.setAttribute("rowspan",r),f>1&&this.map[t][i].el.setAttribute("colspan",f)):(/^\s*<br\/?>\s*$/.test(this.map[t][i].el.innerHTML.toLowerCase())||(this.map[this.idx_start.row][this.idx_start.col].el.innerHTML+=" "+this.map[t][i].el.innerHTML),u(this.map[t][i].el));this.rectify()}else window.console&&void 0},collapseCellToNextRow:function(n){var i,u,f,s=this.getMapIndex(n.el),e=s.row+1,o={row:e,col:s.col};e<this.map.length&&(i=this.getRealRowEl(!1,o),null!==i&&(u=this.correctColIndexForUnreals(o.col,o.row),u>=0?r(this.getRowCells(i)[u],n.el):(f=this.getLastNewCellOnRow(i,e),null!==f?r(f,n.el):i.insertBefore(n.el,i.firstChild)),parseInt(t.getAttribute(n.el,"rowspan"),10)>2?n.el.setAttribute("rowspan",parseInt(t.getAttribute(n.el,"rowspan"),10)-1):n.el.removeAttribute("rowspan")))},removeRowCell:function(n){n.isReal?n.isRowspan?this.collapseCellToNextRow(n):u(n.el):parseInt(t.getAttribute(n.el,"rowspan"),10)>2?n.el.setAttribute("rowspan",parseInt(t.getAttribute(n.el,"rowspan"),10)-1):n.el.removeAttribute("rowspan")},getRowElementsByCell:function(){var t,n,i,r=[];if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(t=this.map[this.idx.row],n=0,i=t.length;i>n;n++)t[n].isReal&&r.push(t[n].el);return r},getColumnElementsByCell:function(){var n,t,i=[];if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(n=0,t=this.map.length;t>n;n++)this.map[n][this.idx.col]&&this.map[n][this.idx.col].isReal&&i.push(this.map[n][this.idx.col].el);return i},removeRow:function(){var i,n,r,f=t.getParentElement(this.cell,{nodeName:["TR"]});if(f){if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(i=this.map[this.idx.row],n=0,r=i.length;r>n;n++)i[n].modified||(this.setCellAsModified(i[n]),this.removeRowCell(i[n]));u(f)}},removeColCell:function(n){n.isColspan?parseInt(t.getAttribute(n.el,"colspan"),10)>2?n.el.setAttribute("colspan",parseInt(t.getAttribute(n.el,"colspan"),10)-1):n.el.removeAttribute("colspan"):n.isReal&&u(n.el)},removeColumn:function(){if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var n=0,t=this.map.length;t>n;n++)this.map[n][this.idx.col].modified||(this.setCellAsModified(this.map[n][this.idx.col]),this.removeColCell(this.map[n][this.idx.col]))},remove:function(n){if(this.rectify()){switch(n){case"row":this.removeRow();break;case"column":this.removeColumn()}this.rectify()}},addRow:function(n){var u,f,i,o,e,s=this.table.ownerDocument;if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),"below"==n&&t.getAttribute(this.cell,"rowspan")&&(this.idx.row=this.idx.row+parseInt(t.getAttribute(this.cell,"rowspan"),10)-1),this.idx!==!1){for(u=this.map[this.idx.row],f=s.createElement("tr"),i=0,o=u.length;o>i;i++)u[i].modified||(this.setCellAsModified(u[i]),this.addRowCell(u[i],f,n));switch(n){case"below":r(this.getRealRowEl(!0),f);break;case"above":e=t.getParentElement(this.map[this.idx.row][this.idx.col].el,{nodeName:["TR"]});e&&e.parentNode.insertBefore(f,e)}}},addRowCell:function(n,i,r){var u=n.isColspan?{colspan:t.getAttribute(n.el,"colspan")}:null;n.isReal?"above"!=r&&n.isRowspan?n.el.setAttribute("rowspan",parseInt(t.getAttribute(n.el,"rowspan"),10)+1):i.appendChild(this.createCells("td",1,u)):"above"!=r&&n.isRowspan&&n.lastRow?i.appendChild(this.createCells("td",1,u)):c.isRowspan&&n.el.attr("rowspan",parseInt(t.getAttribute(n.el,"rowspan"),10)+1)},add:function(n){this.rectify()&&(("below"==n||"above"==n)&&this.addRow(n),("before"==n||"after"==n)&&this.addColumn(n))},addColCell:function(n,i,u){var f,e=n.el.tagName.toLowerCase();switch(u){case"before":f=!n.isColspan||n.firstCol;break;case"after":f=!n.isColspan||n.lastCol||n.isColspan&&c.el==this.cell}if(f){switch(u){case"before":n.el.parentNode.insertBefore(this.createCells(e,1),n.el);break;case"after":r(n.el,this.createCells(e,1))}n.isRowspan&&this.handleCellAddWithRowspan(n,i+1,u)}else n.el.setAttribute("colspan",parseInt(t.getAttribute(n.el,"colspan"),10)+1)},addColumn:function(n){var u,r,i,f;if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),"after"==n&&t.getAttribute(this.cell,"colspan")&&(this.idx.col=this.idx.col+parseInt(t.getAttribute(this.cell,"colspan"),10)-1),this.idx!==!1)for(i=0,f=this.map.length;f>i;i++)u=this.map[i],u[this.idx.col]&&(r=u[this.idx.col],r.modified||(this.setCellAsModified(r),this.addColCell(r,i,n)))},handleCellAddWithRowspan:function(n,i,u){for(var f,s,l,a=parseInt(t.getAttribute(this.cell,"rowspan"),10)-1,e=t.getParentElement(n.el,{nodeName:["TR"]}),c=n.el.tagName.toLowerCase(),v=this.table.ownerDocument,h=0;a>h;h++)if(f=this.correctColIndexForUnreals(this.idx.col,i+h),e=o(e,"tr"),e)if(f>0)switch(u){case"before":s=this.getRowCells(e);f>0&&this.map[i+h][this.idx.col].el!=s[f]&&f==s.length-1?r(s[f],this.createCells(c,1)):s[f].parentNode.insertBefore(this.createCells(c,1),s[f]);break;case"after":r(this.getRowCells(e)[f],this.createCells(c,1))}else e.insertBefore(this.createCells(c,1),e.firstChild);else l=v.createElement("tr"),l.appendChild(this.createCells(c,1)),this.table.appendChild(l)}};t.table={getCellsBetween:function(n,t){var r=new i(n);return r.getMapElsTo(t)},addCells:function(n,t){var r=new i(n);r.add(t)},removeCells:function(n,t){var r=new i(n);r.remove(t)},mergeCellsBetween:function(n,t){var r=new i(n);r.merge(t)},unmergeCell:function(n){var t=new i(n);t.unmerge()},orderSelectionEnds:function(n,t){var r=new i(n);return r.orderSelectionEnds(t)},indexOf:function(n){var t=new i(n);return t.setTableMap(),t.getMapIndex(n)},findCell:function(n,t){var r=new i(null,n);return r.getElementAtIndex(t)},findRowByCell:function(n){var t=new i(n);return t.getRowElementsByCell()},findColumnByCell:function(n){var t=new i(n);return t.getColumnElementsByCell()},canMerge:function(n,t){var r=new i(n);return r.canMerge(t)}}}(wysihtml5);wysihtml5.dom.query=function(n,t){var i,r,f,u,e=[];for(n.nodeType&&(n=[n]),r=0,f=n.length;f>r;r++)if(i=n[r].querySelectorAll(t),i)for(u=i.length;u--;e.unshift(i[u]));return e};wysihtml5.dom.compareDocumentPosition=function(){var n=document.documentElement;return n.compareDocumentPosition?function(n,t){return n.compareDocumentPosition(t)}:function(n,t){var o,s,i,r,u,f,e,h,c;if(o=9===n.nodeType?n:n.ownerDocument,s=9===t.nodeType?t:t.ownerDocument,n===t)return 0;if(n===t.ownerDocument)return 20;if(n.ownerDocument===t)return 10;if(o!==s)return 1;if(2===n.nodeType&&n.childNodes&&-1!==wysihtml5.lang.array(n.childNodes).indexOf(t))return 20;if(2===t.nodeType&&t.childNodes&&-1!==wysihtml5.lang.array(t.childNodes).indexOf(n))return 10;for(i=n,r=[],u=null;i;){if(i==t)return 10;r.push(i);i=i.parentNode}for(i=t,u=null;i;){if(i==n)return 20;if(f=wysihtml5.lang.array(r).indexOf(i),-1!==f)return e=r[f],h=wysihtml5.lang.array(e.childNodes).indexOf(r[f-1]),c=wysihtml5.lang.array(e.childNodes).indexOf(u),h>c?2:4;u=i;i=i.parentNode}return 1}}();wysihtml5.dom.unwrap=function(n){if(n.parentNode){for(;n.lastChild;)wysihtml5.dom.insert(n.lastChild).after(n);n.parentNode.removeChild(n)}};wysihtml5.dom.getPastedHtml=function(n){var t;return n.clipboardData&&(wysihtml5.lang.array(n.clipboardData.types).contains("text/html")?t=n.clipboardData.getData("text/html"):wysihtml5.lang.array(n.clipboardData.types).contains("text/plain")&&(t=wysihtml5.lang.string(n.clipboardData.getData("text/plain")).escapeHTML(!0,!0))),t};wysihtml5.dom.getPastedHtmlWithDiv=function(n,t){var u=n.selection.getBookmark(),r=n.element.ownerDocument,i=r.createElement("DIV");r.body.appendChild(i);i.style.width="1px";i.style.height="1px";i.style.overflow="hidden";i.setAttribute("contenteditable","true");i.focus();setTimeout(function(){n.selection.setBookmark(u);t(i.innerHTML);i.parentNode.removeChild(i)},0)};wysihtml5.quirks.cleanPastedHTML=function(){var n=function(n){var t=wysihtml5.lang.string(n).trim(),i=t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");return RegExp("^((?!^"+i+"$).)*$","i")},t=function(t,i){var u,f,r=wysihtml5.lang.object(t).clone(!0);for(u in r.tags)if(r.tags.hasOwnProperty(u)&&r.tags[u].keep_styles)for(f in r.tags[u].keep_styles)r.tags[u].keep_styles.hasOwnProperty(f)&&i[f]&&(r.tags[u].keep_styles[f]=n(i[f]));return r},i=function(n,t){var r,i,u;if(!n)return null;for(i=0,u=n.length;u>i;i++)if(n[i].condition||(r=n[i].set),n[i].condition&&n[i].condition.test(t))return n[i].set;return r};return function(n,r){var u,f={color:wysihtml5.dom.getStyle("color").from(r.referenceNode),fontSize:wysihtml5.dom.getStyle("font-size").from(r.referenceNode)},e=t(i(r.rules,n)||{},f);return u=wysihtml5.dom.parse(n,{rules:e,cleanUp:!0,context:r.referenceNode.ownerDocument,uneditableClass:r.uneditableClass,clearInternals:!0,unjoinNbsps:!0}),u}}();wysihtml5.quirks.ensureProperClearing=function(){var n=function(){var n=this;setTimeout(function(){var t=n.innerHTML.toLowerCase();("<p>&nbsp;<\/p>"==t||"<p>&nbsp;<\/p><p>&nbsp;<\/p>"==t)&&(n.innerHTML="")},0)};return function(t){wysihtml5.dom.observe(t.element,["cut","keydown"],n)}}(),function(n){var t="%7E";n.quirks.getCorrectInnerHTML=function(i){var f,e,o,s,r,u=i.innerHTML;if(-1===u.indexOf(t))return u;for(f=i.querySelectorAll("[href*='~'], [src*='~']"),r=0,s=f.length;s>r;r++)e=f[r].href||f[r].src,o=n.lang.string(e).replace("~").by(t),u=n.lang.string(u).replace(o).by(e);return u}}(wysihtml5),function(n){var t="wysihtml5-quirks-redraw";n.quirks.redraw=function(i){n.dom.addClass(i,t);n.dom.removeClass(i,t);try{var r=i.ownerDocument;r.execCommand("italic",!1,null);r.execCommand("italic",!1,null)}catch(u){}}}(wysihtml5);wysihtml5.quirks.tableCellsSelection=function(n,t){function c(){return r.observe(n,"mousedown",function(n){var t=wysihtml5.dom.getParentElement(n.target,{nodeName:["TD","TH"]});t&&l(t)}),i}function l(e){i.start=e;i.end=e;i.cells=[e];i.table=r.getParentElement(i.start,{nodeName:["TABLE"]});i.table&&(f(),r.addClass(e,u),s=r.observe(n,"mousemove",a),h=r.observe(n,"mouseup",v),t.fire("tableselectstart").fire("tableselectstart:composer"))}function f(){var t,i;if(n&&(t=n.querySelectorAll("."+u),t.length>0))for(i=0;i<t.length;i++)r.removeClass(t[i],u)}function e(n){for(var t=0;t<n.length;t++)r.addClass(n[t],u)}function a(n){var s,o=null,u=r.getParentElement(n.target,{nodeName:["TD","TH"]});u&&i.table&&i.start&&(o=r.getParentElement(u,{nodeName:["TABLE"]}),o&&o===i.table&&(f(),s=i.end,i.end=u,i.cells=r.table.getCellsBetween(i.start,u),i.cells.length>1&&t.composer.selection.deselect(),e(i.cells),i.end!==s&&t.fire("tableselectchange").fire("tableselectchange:composer")))}function v(){s.stop();h.stop();t.fire("tableselect").fire("tableselect:composer");setTimeout(function(){o()},0)}function o(){var u=r.observe(n.ownerDocument,"click",function(n){u.stop();r.getParentElement(n.target,{nodeName:["TABLE"]})!=i.table&&(f(),i.table=null,i.start=null,i.end=null,t.fire("tableunselect").fire("tableunselect:composer"))})}function y(n,u){i.start=n;i.end=u;i.table=r.getParentElement(i.start,{nodeName:["TABLE"]});selectedCells=r.table.getCellsBetween(i.start,i.end);e(selectedCells);o();t.fire("tableselect").fire("tableselect:composer")}var r=wysihtml5.dom,i={table:null,start:null,end:null,cells:null,select:y},u="wysiwyg-tmp-selected-cell",s=null,h=null;return c()},function(n){var t=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d\.]+)\s*\)/i,i=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/i,r=/^#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])/i,u=/^#([0-9a-f])([0-9a-f])([0-9a-f])/i,f=function(n){return RegExp("(^|\\s|;)"+n+"\\s*:\\s*[^;$]+","gi")};n.quirks.styleParser={parseColor:function(e,o){var h,s,l,v=f(o),c=e.match(v),a=10;if(c){for(l=c.length;l--;)c[l]=n.lang.string(c[l].split(":")[1]).trim();if(h=c[c.length-1],t.test(h))s=h.match(t);else if(i.test(h))s=h.match(i);else if(r.test(h))s=h.match(r),a=16;else if(u.test(h))return s=h.match(u),s.shift(),s.push(1),n.lang.array(s).map(function(n,t){return 3>t?16*parseInt(n,16)+parseInt(n,16):parseFloat(n)});if(s)return s.shift(),s[3]||s.push(1),n.lang.array(s).map(function(n,t){return 3>t?parseInt(n,a):parseFloat(n)})}return!1},unparseColor:function(n,t){if(t){if("hex"==t)return n[0].toString(16).toUpperCase()+n[1].toString(16).toUpperCase()+n[2].toString(16).toUpperCase();if("hash"==t)return"#"+n[0].toString(16).toUpperCase()+n[1].toString(16).toUpperCase()+n[2].toString(16).toUpperCase();if("rgb"==t)return"rgb("+n[0]+","+n[1]+","+n[2]+")";if("rgba"==t)return"rgba("+n[0]+","+n[1]+","+n[2]+","+n[3]+")";if("csv"==t)return n[0]+","+n[1]+","+n[2]+","+n[3]}return n[3]&&1!==n[3]?"rgba("+n[0]+","+n[1]+","+n[2]+","+n[3]+")":"rgb("+n[0]+","+n[1]+","+n[2]+")"},parseFontSize:function(t){var i=t.match(f("font-size"));return i?n.lang.string(i[i.length-1].split(":")[1]).trim():!1}}}(wysihtml5),function(n){function u(n){var t=0;if(n.parentNode)do t+=n.offsetTop||0,n=n.offsetParent;while(n);return t}function i(n,t){for(var i=0;t!==n;)if(i++,t=t.parentNode,!t)throw Error("not a descendant of ancestor!");return i}function r(n){if(!n.canSurroundContents())for(var t=n.commonAncestorContainer,r=i(t,n.startContainer),u=i(t,n.endContainer);!n.canSurroundContents();)r>u?(n.setStartBefore(n.startContainer),r=i(t,n.startContainer)):(n.setEndAfter(n.endContainer),u=i(t,n.endContainer))}var t=n.dom;n.Selection=Base.extend({constructor:function(n,t,i){window.rangy.init();this.editor=n;this.composer=n.composer;this.doc=this.composer.doc;this.contain=t;this.unselectableClass=i||!1},getBookmark:function(){var n=this.getRange();return n&&r(n),n&&n.cloneRange()},setBookmark:function(n){n&&this.setSelection(n)},setBefore:function(n){var t=rangy.createRange(this.doc);return t.setStartBefore(n),t.setEndBefore(n),this.setSelection(t)},setAfter:function(n){var t=rangy.createRange(this.doc);return t.setStartAfter(n),t.setEndAfter(n),this.setSelection(t)},selectNode:function(i,r){var u=rangy.createRange(this.doc),e=i.nodeType===n.ELEMENT_NODE,f="canHaveHTML"in i?i.canHaveHTML:"IMG"!==i.nodeName,s=e?i.innerHTML:i.data,o=""===s||s===n.INVISIBLE_SPACE,h=t.getStyle("display").from(i),c="block"===h||"list-item"===h;if(o&&e&&f&&!r)try{i.innerHTML=n.INVISIBLE_SPACE}catch(l){}f?u.selectNodeContents(i):u.selectNode(i);f&&o&&e?u.collapse(c):f&&o&&(u.setStartAfter(i),u.setEndAfter(i));this.setSelection(u)},getSelectedNode:function(n){var i,t;return n&&this.doc.selection&&"Control"===this.doc.selection.type&&(t=this.doc.selection.createRange(),t&&t.length)?t.item(0):(i=this.getSelection(this.doc),i.focusNode===i.anchorNode?i.focusNode:(t=this.getRange(this.doc),t?t.commonAncestorContainer:this.doc.body))},fixSelBorders:function(){var n=this.getRange();r(n);this.setSelection(n)},getSelectedOwnNodes:function(){for(var i=this.getOwnRanges(),r=[],n=0,t=i.length;t>n;n++)r.push(i[n].commonAncestorContainer||this.doc.body);return r},findNodesInSelection:function(t){for(var u,e=this.getOwnRanges(),r=[],i=0,f=e.length;f>i;i++)u=e[i].getNodes([1],function(i){return n.lang.array(t).contains(i.nodeName)}),r=r.concat(u);return r},containsUneditable:function(){for(var i=this.getOwnUneditables(),r=this.getSelection(),n=0,t=i.length;t>n;n++)if(r.containsNode(i[n]))return!0;return!1},deleteContents:function(){for(var t=this.getOwnRanges(),n=t.length;n--;)t[n].deleteContents();this.setSelection(t[0])},getPreviousNode:function(t,i){var f,r,u;return t||(f=this.getSelection(),t=f.anchorNode),t===this.contain?!1:(r=t.previousSibling,r===this.contain?!1:(r&&3!==r.nodeType&&1!==r.nodeType?r=this.getPreviousNode(r,i):r&&3===r.nodeType&&/^\s*$/.test(r.textContent)?r=this.getPreviousNode(r,i):i&&r&&1===r.nodeType&&!n.lang.array(["BR","HR","IMG"]).contains(r.nodeName)&&/^[\s]*$/.test(r.innerHTML)?r=this.getPreviousNode(r,i):r||t===this.contain||(u=t.parentNode,u!==this.contain&&(r=this.getPreviousNode(u,i))),r!==this.contain?r:!1))},getSelectionParentsByTag:function(){for(var r,i=this.getSelectedOwnNodes(),u=[],t=0,f=i.length;f>t;t++)r=i[t].nodeName&&"LI"===i[t].nodeName?i[t]:n.dom.getParentElement(i[t],{nodeName:["LI"]},!1,this.contain),r&&u.push(r);return u.length?u:null},getRangeToNodeEnd:function(){if(this.isCollapsed()){var t=this.getRange(),i=t.startContainer,r=t.startOffset,n=rangy.createRange(this.doc);return n.selectNodeContents(i),n.setStart(i,r),n}},caretIsLastInSelection:function(){var n=(rangy.createRange(this.doc),this.getSelection(),this.getRangeToNodeEnd().cloneContents()),t=n.textContent;return/^\s*$/.test(t)},caretIsFirstInSelection:function(){var t=rangy.createRange(this.doc),i=this.getSelection(),u=this.getRange(),r=u.startContainer;return r.nodeType===n.TEXT_NODE?this.isCollapsed()&&r.nodeType===n.TEXT_NODE&&/^\s*$/.test(r.data.substr(0,u.startOffset)):(t.selectNodeContents(this.getRange().commonAncestorContainer),t.collapse(!0),this.isCollapsed()&&(t.startContainer===i.anchorNode||t.endContainer===i.anchorNode)&&t.startOffset===i.anchorOffset)},caretIsInTheBeginnig:function(t){var r=this.getSelection(),i=r.anchorNode,u=r.anchorOffset;return t?0===u&&(i.nodeName&&i.nodeName===t.toUpperCase()||n.dom.getParentElement(i.parentNode,{nodeName:t},1)):0===u&&!this.getPreviousNode(i,!0)},caretIsBeforeUneditable:function(){var i,t,n,r,u=this.getSelection(),f=u.anchorNode,e=u.anchorOffset;if(0===e&&(i=this.getPreviousNode(f,!0),i))for(t=this.getOwnUneditables(),n=0,r=t.length;r>n;n++)if(i===t[n])return t[n];return!1},executeAndRestoreRangy:function(n){var i=this.doc.defaultView||this.doc.parentWindow,t=rangy.saveSelection(i);if(t)try{n()}catch(r){setTimeout(function(){throw r;},0)}else n();rangy.restoreSelection(t)},executeAndRestore:function(i,r){var u,h,l,a,p,v,s,e,c,o=this.doc.body,b=r&&o.scrollTop,k=r&&o.scrollLeft,y="_wysihtml5-temp-placeholder",w='<span class="'+y+'">'+n.INVISIBLE_SPACE+"<\/span>",f=this.getRange(!0);if(!f)return i(o,o),void 0;f.collapsed||(s=f.cloneRange(),v=s.createContextualFragment(w),s.collapse(!1),s.insertNode(v),s.detach());p=f.createContextualFragment(w);f.insertNode(p);v&&(u=this.contain.querySelectorAll("."+y),f.setStartBefore(u[0]),f.setEndAfter(u[u.length-1]));this.setSelection(f);try{i(f.startContainer,f.endContainer)}catch(d){setTimeout(function(){throw d;},0)}if(u=this.contain.querySelectorAll("."+y),u&&u.length)for(e=rangy.createRange(this.doc),l=u[0].nextSibling,u.length>1&&(a=u[u.length-1].previousSibling),a&&l?(e.setStartBefore(l),e.setEndAfter(a)):(h=this.doc.createTextNode(n.INVISIBLE_SPACE),t.insert(h).after(u[0]),e.setStartBefore(h),e.setEndAfter(h)),this.setSelection(e),c=u.length;c--;)u[c].parentNode.removeChild(u[c]);else this.contain.focus();r&&(o.scrollTop=b,o.scrollLeft=k);try{u.parentNode.removeChild(u)}catch(g){}},set:function(n,t){var i=rangy.createRange(this.doc);i.setStart(n,t||0);this.setSelection(i)},insertHTML:function(n){var i,t=(rangy.createRange(this.doc),this.doc.createElement("DIV")),r=this.doc.createDocumentFragment();for(t.innerHTML=n,i=t.lastChild;t.firstChild;)r.appendChild(t.firstChild);this.insertNode(r);i&&this.setAfter(i)},insertNode:function(n){var t=this.getRange();t&&t.insertNode(n)},surround:function(n){var t,i,r=this.getOwnRanges(),u=[];if(0==r.length)return u;for(i=r.length;i--;){t=this.doc.createElement(n.nodeName);u.push(t);n.className&&(t.className=n.className);n.cssStyle&&t.setAttribute("style",n.cssStyle);try{r[i].surroundContents(t);this.selectNode(t)}catch(f){t.appendChild(r[i].extractContents());r[i].insertNode(t)}}return u},deblockAndSurround:function(t){var r,f,i,u=this.doc.createElement("div"),e=rangy.createRange(this.doc);if(u.className=t.className,this.composer.commands.exec("formatBlock",t.nodeName,t.className),r=this.contain.querySelectorAll("."+t.className),r[0])for(r[0].parentNode.insertBefore(u,r[0]),e.setStartBefore(r[0]),e.setEndAfter(r[r.length-1]),f=e.extractContents();f.firstChild;)if(i=f.firstChild,1==i.nodeType&&n.dom.hasClass(i,t.className)){for(;i.firstChild;)u.appendChild(i.firstChild);"BR"!==i.nodeName&&u.appendChild(this.doc.createElement("br"));f.removeChild(i)}else u.appendChild(i);else u=null;return u},scrollIntoView:function(){var r,t=this.doc,f=t.documentElement.scrollHeight>t.documentElement.offsetHeight,i=t._wysihtml5ScrollIntoViewElement=t._wysihtml5ScrollIntoViewElement||function(){var i=t.createElement("span");return i.innerHTML=n.INVISIBLE_SPACE,i}();f&&(this.insertNode(i),r=u(i),i.parentNode.removeChild(i),r>=t.body.scrollTop+t.documentElement.offsetHeight-5&&(t.body.scrollTop=r))},selectLine:function(){n.browser.supportsSelectionModify()?this._selectLine_W3C():this.doc.selection&&this._selectLine_MSIE()},_selectLine_W3C:function(){var t=this.doc.defaultView,n=t.getSelection();n.modify("move","left","lineboundary");n.modify("extend","right","lineboundary")},_selectLine_MSIE:function(){var e,f,n,r,u,t=this.doc.selection.createRange(),i=t.boundingTop,o=this.doc.body.scrollWidth;if(t.moveToPoint){for(0===i&&(n=this.doc.createElement("span"),this.insertNode(n),i=n.offsetTop,n.parentNode.removeChild(n)),i+=1,r=-10;o>r;r+=2)try{t.moveToPoint(r,i);break}catch(s){}for(e=i,f=this.doc.selection.createRange(),u=o;u>=0;u--)try{f.moveToPoint(u,e);break}catch(h){}t.setEndPoint("EndToEnd",f);t.select()}},getText:function(){var n=this.getSelection();return n?""+n:""},getNodes:function(n,t){var i=this.getRange();return i?i.getNodes([n],t):[]},fixRangeOverflow:function(n){var t,i;this.contain&&this.contain.firstChild&&n&&(t=n.compareNode(this.contain),2!==t?(1===t&&n.setStartBefore(this.contain.firstChild),0===t&&n.setEndAfter(this.contain.lastChild),3===t&&(n.setStartBefore(this.contain.firstChild),n.setEndAfter(this.contain.lastChild))):this._detectInlineRangeProblems(n)&&(i=n.endContainer.previousElementSibling,i&&n.setEnd(i,this._endOffsetForNode(i))))},_endOffsetForNode:function(n){var t=document.createRange();return t.selectNodeContents(n),t.endOffset},_detectInlineRangeProblems:function(n){var i=t.compareDocumentPosition(n.startContainer,n.endContainer);return 0==n.endOffset&&4&i},getRange:function(n){var t=this.getSelection(),i=t&&t.rangeCount&&t.getRangeAt(0);return n!==!0&&this.fixRangeOverflow(i),i},getOwnUneditables:function(){var i=t.query(this.contain,"."+this.unselectableClass),r=t.query(i,"."+this.unselectableClass);return n.lang.array(i).without(r)},getOwnRanges:function(){var f,i,r,u,o,t,s,n=[],e=this.getRange();if(e&&n.push(e),this.unselectableClass&&this.contain&&e&&(i=this.getOwnUneditables(),i.length>0))for(u=0,o=i.length;o>u;u++)for(f=[],t=0,s=n.length;s>t;t++){if(n[t])switch(n[t].compareNode(i[u])){case 2:break;case 3:r=n[t].cloneRange();r.setEndBefore(i[u]);f.push(r);r=n[t].cloneRange();r.setStartAfter(i[u]);f.push(r);break;default:f.push(n[t])}n=f}return n},getSelection:function(){return rangy.getSelection(this.doc.defaultView||this.doc.parentWindow)},setSelection:function(n){var t=this.doc.defaultView||this.doc.parentWindow,i=rangy.getSelection(t);return i.setSingleRange(n)},createRange:function(){return rangy.createRange(this.doc)},isCollapsed:function(){return this.getSelection().isCollapsed},getHtml:function(){return this.getSelection().toHtml()},isEndToEndInNode:function(t){var f=this.getRange(),i=f.commonAncestorContainer,r=f.startContainer,u=f.endContainer;if((i.nodeType===n.TEXT_NODE&&(i=i.parentNode),r.nodeType===n.TEXT_NODE&&!/^\s*$/.test(r.data.substr(f.startOffset)))||u.nodeType===n.TEXT_NODE&&!/^\s*$/.test(u.data.substr(f.endOffset)))return!1;for(;r&&r!==i;){if(r.nodeType!==n.TEXT_NODE&&!n.dom.contains(i,r)||n.dom.domNode(r).prev({ignoreBlankTexts:!0}))return!1;r=r.parentNode}for(;u&&u!==i;){if(u.nodeType!==n.TEXT_NODE&&!n.dom.contains(i,u)||n.dom.domNode(u).next({ignoreBlankTexts:!0}))return!1;u=u.parentNode}return n.lang.array(t).contains(i.nodeName)?i:!1},deselect:function(){var n=this.getSelection();n&&n.removeAllRanges()}})}(wysihtml5),function(n,t){function a(n,t,i){if(!n.className)return!1;var r=n.className.match(i)||[];return r[r.length-1]===t}function v(n,t){return!n.getAttribute||!n.getAttribute("style")?!1:(n.getAttribute("style").match(t),n.getAttribute("style").match(t)?!0:!1)}function u(n,t,i){n.getAttribute("style")?(e(n,i),n.getAttribute("style")&&!/^\s*$/.test(n.getAttribute("style"))?n.setAttribute("style",t+";"+n.getAttribute("style")):n.setAttribute("style",t)):n.setAttribute("style",t)}function y(n,t,i){n.className?(f(n,i),n.className+=" "+t):n.className=t}function f(n,t){n.className&&(n.className=n.className.replace(t,""))}function e(n,t){var i,r,u=[];if(n.getAttribute("style")){for(i=n.getAttribute("style").split(";"),r=i.length;r--;)i[r].match(t)||/^\s*$/.test(i[r])||u.push(i[r]);u.length?n.setAttribute("style",u.join(";")):n.removeAttribute("style")}}function o(n,t){var u,i,o,r=[],e=t.split(";"),f=n.getAttribute("style");if(f){for(f=f.replace(/\s/gi,"").toLowerCase(),r.push(RegExp("(^|\\s|;)"+t.replace(/\s/gi,"").replace(/([\(\)])/gi,"\\$1").toLowerCase().replace(";",";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi,"\\s?rgb\\($1,\\s?$2,\\s?$3\\)"),"gi")),u=e.length;u-->0;)/^\s*$/.test(e[u])||r.push(RegExp("(^|\\s|;)"+e[u].replace(/\s/gi,"").replace(/([\(\)])/gi,"\\$1").toLowerCase().replace(";",";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi,"\\s?rgb\\($1,\\s?$2,\\s?$3\\)"),"gi"));for(i=0,o=r.length;o>i;i++)if(f.match(r[i]))return r[i]}return!1}function p(i,r,u,f){return u?o(i,u):f?n.dom.hasClass(i,f):t.dom.arrayContains(r,i.tagName.toLowerCase())}function s(n,t,i,r){for(var u=n.length;u--;)if(!p(n[u],t,i,r))return!1;return n.length?!0:!1}function w(n,t,i){var r=o(n,t);return r?(e(n,r),"remove"):(u(n,t,i),"change")}function b(n,t){return n.className.replace(l," ")==t.className.replace(l," ")}function k(n){for(var t=n.parentNode;n.firstChild;)t.insertBefore(n.firstChild,n);t.removeChild(n)}function d(n,t){if(n.attributes.length!=t.attributes.length)return!1;for(var i,r,u,f=0,e=n.attributes.length;e>f;++f)if((i=n.attributes[f],u=i.name,"class"!=u)&&((r=t.attributes.getNamedItem(u),i.specified!=r.specified)||i.specified&&i.nodeValue!==r.nodeValue))return!1;return!0}function h(n,i){return t.dom.isCharacterDataNode(n)?0==i?!!n.previousSibling:i==n.length?!!n.nextSibling:!0:i>0&&i<n.childNodes.length}function i(n,r,u,f){var e,o;if(t.dom.isCharacterDataNode(r)&&(0==u?(u=t.dom.getNodeIndex(r),r=r.parentNode):u==r.length?(u=t.dom.getNodeIndex(r)+1,r=r.parentNode):e=t.dom.splitDataNode(r,u)),!(e||f&&r===f)){for(e=r.cloneNode(!1),e.id&&e.removeAttribute("id");o=r.childNodes[u];)e.appendChild(o);t.dom.insertAfter(e,r)}return r==n?e:i(n,e.parentNode,t.dom.getNodeIndex(e),f)}function r(t){this.isElementMerge=t.nodeType==n.ELEMENT_NODE;this.firstTextNode=this.isElementMerge?t.lastChild:t;this.textNodes=[this.firstTextNode]}function c(n,t,i,r,u,f,e){this.tagNames=n||[g];this.cssClass=t||(t===!1?!1:"");this.similarClassRegExp=i;this.cssStyle=u||"";this.similarStyleRegExp=f;this.normalize=r;this.applyToAnyTagName=!1;this.container=e}var g="span",l=/\s+/g;r.prototype={doMerge:function(){for(var i,t,r,f=[],n=0,u=this.textNodes.length;u>n;++n)i=this.textNodes[n],t=i.parentNode,f[n]=i.data,n&&(t.removeChild(i),t.hasChildNodes()||t.parentNode.removeChild(t));return this.firstTextNode.data=r=f.join(""),r},getLength:function(){for(var n=this.textNodes.length,t=0;n--;)t+=this.textNodes[n].length;return t},toString:function(){for(var i=[],n=0,t=this.textNodes.length;t>n;++n)i[n]="'"+this.textNodes[n].data+"'";return"[Merge("+i.join(",")+")]"}};c.prototype={getAncestorWithClass:function(i){for(var r;i;){if(r=this.cssClass?a(i,this.cssClass,this.similarClassRegExp):""!==this.cssStyle?!1:!0,i.nodeType==n.ELEMENT_NODE&&"false"!=i.getAttribute("contenteditable")&&t.dom.arrayContains(this.tagNames,i.tagName.toLowerCase())&&r)return i;i=i.parentNode}return!1},getAncestorWithStyle:function(i){for(var r;i;){if(r=this.cssStyle?v(i,this.similarStyleRegExp):!1,i.nodeType==n.ELEMENT_NODE&&"false"!=i.getAttribute("contenteditable")&&t.dom.arrayContains(this.tagNames,i.tagName.toLowerCase())&&r)return i;i=i.parentNode}return!1},getMatchingAncestor:function(n){var t=this.getAncestorWithClass(n),i=!1;return t?this.cssStyle&&(i="class"):(t=this.getAncestorWithStyle(n),t&&(i="style")),{element:t,type:i}},postApply:function(n,t){for(var i,f,s,c,a=n[0],e=n[n.length-1],o=[],l=a,v=e,y=0,p=e.length,u=0,h=n.length;h>u;++u)f=n[u],s=null,f&&f.parentNode&&(s=this.getAdjacentMergeableTextNode(f.parentNode,!1)),s?(i||(i=new r(s),o.push(i)),i.textNodes.push(f),f===a&&(l=i.firstTextNode,y=l.length),f===e&&(v=i.firstTextNode,p=i.getLength())):i=null;if(e&&e.parentNode&&(c=this.getAdjacentMergeableTextNode(e.parentNode,!0),c&&(i||(i=new r(e),o.push(i)),i.textNodes.push(c))),o.length){for(u=0,h=o.length;h>u;++u)o[u].doMerge();t.setStart(l,y);t.setEnd(v,p)}},getAdjacentMergeableTextNode:function(t,i){var r,u=t.nodeType==n.TEXT_NODE,e=u?t.parentNode:t,f=i?"nextSibling":"previousSibling";if(u){if(r=t[f],r&&r.nodeType==n.TEXT_NODE)return r}else if(r=e[f],r&&this.areElementsMergeable(t,r))return r[i?"firstChild":"lastChild"];return null},areElementsMergeable:function(n,i){return t.dom.arrayContains(this.tagNames,(n.tagName||"").toLowerCase())&&t.dom.arrayContains(this.tagNames,(i.tagName||"").toLowerCase())&&b(n,i)&&d(n,i)},createContainer:function(n){var t=n.createElement(this.tagNames[0]);return this.cssClass&&(t.className=this.cssClass),this.cssStyle&&t.setAttribute("style",this.cssStyle),t},applyToTextNode:function(n){var r,i=n.parentNode;1==i.childNodes.length&&t.dom.arrayContains(this.tagNames,i.tagName.toLowerCase())?(this.cssClass&&y(i,this.cssClass,this.similarClassRegExp),this.cssStyle&&u(i,this.cssStyle,this.similarStyleRegExp)):(r=this.createContainer(t.dom.getDocument(n)),n.parentNode.insertBefore(r,n),r.appendChild(n))},isRemovable:function(i){return t.dom.arrayContains(this.tagNames,i.tagName.toLowerCase())&&""===n.lang.string(i.className).trim()&&(!i.getAttribute("style")||""===n.lang.string(i.getAttribute("style")).trim())},undoToTextNode:function(n,t,r,u){var o,s=r?!1:!0,e=r||u,c=!1;t.containsNode(e)||(o=t.cloneRange(),o.selectNode(e),o.isPointInRange(t.endContainer,t.endOffset)&&h(t.endContainer,t.endOffset)&&(i(e,t.endContainer,t.endOffset,this.container),t.setEndAfter(e)),o.isPointInRange(t.startContainer,t.startOffset)&&h(t.startContainer,t.startOffset)&&(e=i(e,t.startContainer,t.startOffset,this.container)));!s&&this.similarClassRegExp&&f(e,this.similarClassRegExp);s&&this.similarStyleRegExp&&(c="change"===w(e,this.cssStyle,this.similarStyleRegExp));this.isRemovable(e)&&!c&&k(e)},applyToRange:function(t){for(var r,e,u,f,o,i=t.length;i--;){if(r=t[i].getNodes([n.TEXT_NODE]),!r.length)try{return e=this.createContainer(t[i].endContainer.ownerDocument),t[i].surroundContents(e),this.selectNode(t[i],e),void 0}catch(s){}if(t[i].splitBoundaries(),r=t[i].getNodes([n.TEXT_NODE]),r.length){for(f=0,o=r.length;o>f;++f)u=r[f],this.getMatchingAncestor(u).element||this.applyToTextNode(u);t[i].setStart(r[0],0);u=r[r.length-1];t[i].setEnd(u,u.length);this.normalize&&this.postApply(r,t[i])}}},undoToRange:function(t){for(var r,u,f,h,e,o,s,i=t.length;i--;){for(r=t[i].getNodes([n.TEXT_NODE]),r.length?(t[i].splitBoundaries(),r=t[i].getNodes([n.TEXT_NODE])):(h=t[i].endContainer.ownerDocument,e=h.createTextNode(n.INVISIBLE_SPACE),t[i].insertNode(e),t[i].selectNode(e),r=[e]),o=0,s=r.length;s>o;++o)t[i].isValid()&&(u=r[o],f=this.getMatchingAncestor(u),"style"===f.type?this.undoToTextNode(u,t[i],!1,f.element):f.element&&this.undoToTextNode(u,t[i],f.element));1==s?this.selectNode(t[i],r[0]):(t[i].setStart(r[0],0),u=r[r.length-1],t[i].setEnd(u,u.length),this.normalize&&this.postApply(r,t[i]))}},selectNode:function(t,i){var r=i.nodeType===n.ELEMENT_NODE,e="canHaveHTML"in i?i.canHaveHTML:!0,f=r?i.innerHTML:i.data,u=""===f||f===n.INVISIBLE_SPACE;if(u&&r&&e)try{i.innerHTML=n.INVISIBLE_SPACE}catch(o){}t.selectNodeContents(i);u&&r?t.collapse(!1):u&&(t.setStartAfter(i),t.setEndAfter(i))},getTextSelectedByRange:function(n,t){var i,u,r=t.cloneRange();return r.selectNodeContents(n),i=r.intersection(t),u=i?""+i:"",r.detach(),u},isAppliedToRange:function(t){for(var i,u,e,s,h,o=[],r="full",f=t.length;f--;){if(u=t[f].getNodes([n.TEXT_NODE]),!u.length)return i=this.getMatchingAncestor(t[f].startContainer).element,i?{elements:[i],coverage:r}:!1;for(e=0,s=u.length;s>e;++e)h=this.getTextSelectedByRange(u[e],t[f]),i=this.getMatchingAncestor(u[e]).element,i&&""!=h?(o.push(i),1===n.dom.getTextNodes(i,!0).length?r="full":"full"===r&&(r="inline")):i||(r="partial")}return o.length?{elements:o,coverage:r}:!1},toggleRange:function(n){var i,t=this.isAppliedToRange(n);t?"full"===t.coverage?this.undoToRange(n):"inline"===t.coverage?(i=s(t.elements,this.tagNames,this.cssStyle,this.cssClass),this.undoToRange(n),i||this.applyToRange(n)):(s(t.elements,this.tagNames,this.cssStyle,this.cssClass)||this.undoToRange(n),this.applyToRange(n)):this.applyToRange(n)}};n.selection.HTMLApplier=c}(wysihtml5,rangy);wysihtml5.Commands=Base.extend({constructor:function(n){this.editor=n;this.composer=n.composer;this.doc=this.composer.doc},support:function(n){return wysihtml5.browser.supportsCommand(this.doc,n)},exec:function(n,t){var i=wysihtml5.commands[n],u=wysihtml5.lang.array(arguments).get(),f=i&&i.exec,r=null;if(this.editor.fire("beforecommand:composer"),f)u.unshift(this.composer),r=f.apply(i,u);else try{r=this.doc.execCommand(n,!1,t)}catch(e){}return this.editor.fire("aftercommand:composer"),r},state:function(n){var t=wysihtml5.commands[n],i=wysihtml5.lang.array(arguments).get(),r=t&&t.state;if(r)return i.unshift(this.composer),r.apply(t,i);try{return this.doc.queryCommandState(n)}catch(u){return!1}},stateValue:function(n){var t=wysihtml5.commands[n],i=wysihtml5.lang.array(arguments).get(),r=t&&t.stateValue;return r?(i.unshift(this.composer),r.apply(t,i)):!1}});wysihtml5.commands.bold={exec:function(n,t){wysihtml5.commands.formatInline.execWithToggle(n,t,"b")},state:function(n,t){return wysihtml5.commands.formatInline.state(n,t,"b")}},function(n){function u(u,f){var s,h,e,y,p,c,l,a,o,w=u.doc,b="_wysihtml5-temp-"+ +new Date,v=0;for(n.commands.formatInline.exec(u,t,r,b,/non-matching-class/g,t,t,!0,!0),h=w.querySelectorAll(r+"."+b),s=h.length;s>v;v++){e=h[v];e.removeAttribute("class");for(o in f)"text"!==o&&e.setAttribute(o,f[o])}c=e;1===s&&(l=i.getTextContent(e),y=!!e.querySelector("*"),p=""===l||l===n.INVISIBLE_SPACE,!y&&p&&(i.setTextContent(e,f.text||e.href),a=w.createTextNode(" "),u.selection.setAfter(e),i.insert(a).after(e),c=a));u.selection.setAfter(c)}function f(n,t,i){for(var f,e,u,r=t.length;r--;){for(f=t[r].attributes,e=f.length;e--;)t[r].removeAttribute(f.item(e).name);for(u in i)i.hasOwnProperty(u)&&t[r].setAttribute(u,i[u])}}var t,r="A",i=n.dom;n.commands.createLink={exec:function(n,t,i){var r=this.state(n,t);r?n.selection.executeAndRestore(function(){f(n,r,i)}):(i="object"==typeof i?i:{href:i},u(n,i))},state:function(t,i){return n.commands.formatInline.state(t,i,"A")}}}(wysihtml5),function(n){function i(n,i){for(var r,u,e,o=i.length,f=0;o>f;f++)r=i[f],u=t.getParentElement(r,{nodeName:"code"}),e=t.getTextContent(r),e.match(t.autoLink.URL_REG_EXP)&&!u?u=t.renameElement(r,"code"):t.replaceWithChildNodes(r)}var t=n.dom;n.commands.removeLink={exec:function(n,t){var r=this.state(n,t);r&&n.selection.executeAndRestore(function(){i(n,r)})},state:function(t,i){return n.commands.formatInline.state(t,i,"A")}}}(wysihtml5),function(n){var t=/wysiwyg-font-size-[0-9a-z\-]+/g;n.commands.fontSize={exec:function(i,r,u){n.commands.formatInline.execWithToggle(i,r,"span","wysiwyg-font-size-"+u,t)},state:function(i,r,u){return n.commands.formatInline.state(i,r,"span","wysiwyg-font-size-"+u,t)}}}(wysihtml5),function(n){var t=/(\s|^)font-size\s*:\s*[^;\s]+;?/gi;n.commands.fontSizeStyle={exec:function(i,r,u){u="object"==typeof u?u.size:u;/^\s*$/.test(u)||n.commands.formatInline.execWithToggle(i,r,"span",!1,!1,"font-size:"+u,t)},state:function(i,r){return n.commands.formatInline.state(i,r,"span",!1,!1,"font-size",t)},stateValue:function(t,i){var u,r=this.state(t,i);return r&&n.lang.object(r).isArray()&&(r=r[0]),r&&(u=r.getAttribute("style"),u)?n.quirks.styleParser.parseFontSize(u):!1}}}(wysihtml5),function(n){var t=/wysiwyg-color-[0-9a-z]+/g;n.commands.foreColor={exec:function(i,r,u){n.commands.formatInline.execWithToggle(i,r,"span","wysiwyg-color-"+u,t)},state:function(i,r,u){return n.commands.formatInline.state(i,r,"span","wysiwyg-color-"+u,t)}}}(wysihtml5),function(n){var t=/(\s|^)color\s*:\s*[^;\s]+;?/gi;n.commands.foreColorStyle={exec:function(i,r,u){var e,f=n.quirks.styleParser.parseColor("object"==typeof u?"color:"+u.color:"color:"+u,"color");f&&(e="color: rgb("+f[0]+","+f[1]+","+f[2]+");",1!==f[3]&&(e+="color: rgba("+f[0]+","+f[1]+","+f[2]+","+f[3]+");"),n.commands.formatInline.execWithToggle(i,r,"span",!1,!1,e,t))},state:function(i,r){return n.commands.formatInline.state(i,r,"span",!1,!1,"color",t)},stateValue:function(t,i,r){var f,u=this.state(t,i);return u&&n.lang.object(u).isArray()&&(u=u[0]),u&&(f=u.getAttribute("style"),f&&f)?(val=n.quirks.styleParser.parseColor(f,"color"),n.quirks.styleParser.unparseColor(val,r)):!1}}}(wysihtml5),function(n){var t=/(\s|^)background-color\s*:\s*[^;\s]+;?/gi;n.commands.bgColorStyle={exec:function(i,r,u){var e,f=n.quirks.styleParser.parseColor("object"==typeof u?"background-color:"+u.color:"background-color:"+u,"background-color");f&&(e="background-color: rgb("+f[0]+","+f[1]+","+f[2]+");",1!==f[3]&&(e+="background-color: rgba("+f[0]+","+f[1]+","+f[2]+","+f[3]+");"),n.commands.formatInline.execWithToggle(i,r,"span",!1,!1,e,t))},state:function(i,r){return n.commands.formatInline.state(i,r,"span",!1,!1,"background-color",t)},stateValue:function(t,i,r){var f,u=this.state(t,i),e=!1;return u&&n.lang.object(u).isArray()&&(u=u[0]),u&&(f=u.getAttribute("style"),f)?(e=n.quirks.styleParser.parseColor(f,"background-color"),n.quirks.styleParser.unparseColor(e,r)):!1}}}(wysihtml5),function(n){function f(t,i,u){t.className?(r(t,u),t.className=n.lang.string(t.className+" "+i).trim()):t.className=i}function e(t,i,r){u(t,r);t.getAttribute("style")?t.setAttribute("style",n.lang.string(t.getAttribute("style")+" "+i).trim()):t.setAttribute("style",i)}function r(t,i){var r=i.test(t.className);return t.className=t.className.replace(i,""),""==n.lang.string(t.className).trim()&&t.removeAttribute("class"),r}function u(t,i){var r=i.test(t.getAttribute("style"));return t.setAttribute("style",(t.getAttribute("style")||"").replace(i,"")),""==n.lang.string(t.getAttribute("style")||"").trim()&&t.removeAttribute("style"),r}function o(n){var t=n.lastChild;t&&s(t)&&t.parentNode.removeChild(t)}function s(n){return"BR"===n.nodeName}function h(t,i){var u,r,f;for(t.selection.isCollapsed()&&t.selection.selectLine(),u=t.selection.surround(i),r=0,f=u.length;f>r;r++)n.dom.lineBreaks(u[r]).remove(),o(u[r])}function c(t){return!!n.lang.string(t.className).trim()}function l(t){return!!n.lang.string(t.getAttribute("style")||"").trim()}var t=n.dom,i=["H1","H2","H3","H4","H5","H6","P","PRE","DIV"];n.commands.formatBlock={exec:function(o,s,a,v,y,p,w){var d,nt,tt,it,k,b=(o.doc,this.state(o,s,a,v,y,p,w)),rt=o.config.useLineBreaks,g=rt?"DIV":"P";return a="string"==typeof a?a.toUpperCase():a,b.length?(o.selection.executeAndRestoreRangy(function(){for(var f,e,i=b.length;i--;){if(y&&(nt=r(b[i],y)),w&&(it=u(b[i],w)),(it||nt)&&null===a&&b[i].nodeName!=g)return;f=c(b[i]);e=l(b[i]);f||e||!rt&&"P"!==a?t.renameElement(b[i],"P"===a?"DIV":g):(n.dom.lineBreaks(b[i]).add(),t.replaceWithChildNodes(b[i]))}}),void 0):((null!==a&&!n.lang.array(i).contains(a)||(d=o.selection.findNodesInSelection(i).concat(o.selection.getSelectedOwnNodes()),o.selection.executeAndRestoreRangy(function(){for(var n=d.length;n--;)k=t.getParentElement(d[n],{nodeName:i}),k==o.element&&(k=null),k&&(a&&(k=t.renameElement(k,a)),v&&f(k,v,y),p&&e(k,p,w),tt=!0)}),!tt))&&h(o,{nodeName:a||g,className:v||null,cssStyle:p||null}),void 0)},state:function(i,r,u,f,e,o,s){var h,c,a,v=i.selection.getSelectedOwnNodes(),l=[];for(u="string"==typeof u?u.toUpperCase():u,c=0,a=v.length;a>c;c++)h=t.getParentElement(v[c],{nodeName:u,className:f,classRegExp:e,cssStyle:o,styleRegExp:s}),h&&-1==n.lang.array(l).indexOf(h)&&l.push(h);return 0==l.length?!1:l}}}(wysihtml5);wysihtml5.commands.formatCode={exec:function(n,t,i){var r,f,e,u=this.state(n);u?n.selection.executeAndRestore(function(){r=u.querySelector("code");wysihtml5.dom.replaceWithChildNodes(u);r&&wysihtml5.dom.replaceWithChildNodes(r)}):(f=n.selection.getRange(),e=f.extractContents(),u=n.doc.createElement("pre"),r=n.doc.createElement("code"),i&&(r.className=i),u.appendChild(r),r.appendChild(e),f.insertNode(u),n.selection.selectNode(u))},state:function(n){var t=n.selection.getSelectedNode();return t&&t.nodeName&&"PRE"==t.nodeName&&t.firstChild&&t.firstChild.nodeName&&"CODE"==t.firstChild.nodeName?t:wysihtml5.dom.getParentElement(t,{nodeName:"CODE"})&&wysihtml5.dom.getParentElement(t,{nodeName:"PRE"})}},function(n){function u(n){var t=r[n];return t?[n.toLowerCase(),t.toLowerCase()]:[n.toLowerCase()]}function i(i,r,f,e,o,s){var h=i;return r&&(h+=":"+r),e&&(h+=":"+e),t[h]||(t[h]=new n.selection.HTMLApplier(u(i),r,f,!0,e,o,s)),t[h]}var r={strong:"b",em:"i",b:"strong",i:"em"},t={};n.commands.formatInline={exec:function(n,t,r,u,f,e,o,s,h){var l=n.selection.createRange(),c=n.selection.getOwnRanges();return c&&0!=c.length?(n.selection.getSelection().removeAllRanges(),i(r,u,f,e,o,n.element).toggleRange(c),s?h||n.cleanUp():(l.setStart(c[0].startContainer,c[0].startOffset),l.setEnd(c[c.length-1].endContainer,c[c.length-1].endOffset),n.selection.setSelection(l),n.selection.executeAndRestore(function(){h||n.cleanUp()},!0,!0)),void 0):!1},execWithToggle:function(t,i,r,u,f,e,o){var s,h=this;this.state(t,i,r,u,f,e,o)&&t.selection.isCollapsed()&&!t.selection.caretIsLastInSelection()&&!t.selection.caretIsFirstInSelection()?(s=h.state(t,i,r,u,f)[0],t.selection.executeAndRestoreRangy(function(){s.parentNode;t.selection.selectNode(s,!0);n.commands.formatInline.exec(t,i,r,u,f,e,o,!0,!0)})):this.state(t,i,r,u,f,e,o)&&!t.selection.isCollapsed()?t.selection.executeAndRestoreRangy(function(){n.commands.formatInline.exec(t,i,r,u,f,e,o,!0,!0)}):n.commands.formatInline.exec(t,i,r,u,f,e,o)},state:function(t,u,f,e,o,s,h){var c,l,a=t.doc,v=r[f]||f;return n.dom.hasElementWithTagName(a,f)||n.dom.hasElementWithTagName(a,v)?e&&!n.dom.hasElementWithClassName(a,e)?!1:(c=t.selection.getOwnRanges(),c&&0!==c.length?(l=i(f,e,o,s,h,t.element).isAppliedToRange(c),l&&l.elements?l.elements:!1):!1):!1}}}(wysihtml5),function(n){n.commands.insertBlockQuote={exec:function(t,i){var u=this.state(t,i),r=t.selection.isEndToEndInNode(["H1","H2","H3","H4","H5","H6","P"]);t.selection.executeAndRestore(function(){if(u)t.config.useLineBreaks&&n.dom.lineBreaks(u).add(),n.dom.unwrap(u);else if(t.selection.isCollapsed()&&t.selection.selectLine(),r){var i=r.ownerDocument.createElement("blockquote");n.dom.insert(i).after(r);i.appendChild(r)}else t.selection.surround({nodeName:"blockquote"})})},state:function(t){var r=t.selection.getSelectedNode(),i=n.dom.getParentElement(r,{nodeName:"BLOCKQUOTE"},!1,t.element);return i?i:!1}}}(wysihtml5);wysihtml5.commands.insertHTML={exec:function(n,t,i){n.commands.support(t)?n.doc.execCommand(t,!1,i):n.selection.insertHTML(i)},state:function(){return!1}},function(n){var t="IMG";n.commands.insertImage={exec:function(i,r,u){var s,f,h,e,o;if(u="object"==typeof u?u:{src:u},s=i.doc,f=this.state(i),f)return i.selection.setBefore(f),e=f.parentNode,e.removeChild(f),n.dom.removeEmptyTextNodes(e),"A"!==e.nodeName||e.firstChild||(i.selection.setAfter(e),e.parentNode.removeChild(e)),n.quirks.redraw(i.element),void 0;f=s.createElement(t);for(o in u)f.setAttribute("className"===o?"class":o,u[o]);i.selection.insertNode(f);n.browser.hasProblemsSettingCaretAfterImg()?(h=s.createTextNode(n.INVISIBLE_SPACE),i.selection.insertNode(h),i.selection.setAfter(h)):i.selection.setAfter(f)},state:function(i){var r,u,f,e=i.doc;return n.dom.hasElementWithTagName(e,t)?(r=i.selection.getSelectedNode(),r?r.nodeName===t?r:r.nodeType!==n.ELEMENT_NODE?!1:(u=i.selection.getText(),u=n.lang.string(u).trim(),u?!1:(f=i.selection.getNodes(n.ELEMENT_NODE,function(n){return"IMG"===n.nodeName}),1!==f.length?!1:f[0])):!1):!1}}}(wysihtml5),function(n){var t="<br>"+(n.browser.needsSpaceAfterLineBreak()?" ":"");n.commands.insertLineBreak={exec:function(i,r){i.commands.support(r)?(i.doc.execCommand(r,!1,null),n.browser.autoScrollsToCaret()||i.selection.scrollIntoView()):i.commands.exec("insertHTML",t)},state:function(){return!1}}}(wysihtml5);wysihtml5.commands.insertOrderedList={exec:function(n,t){wysihtml5.commands.insertList.exec(n,t,"OL")},state:function(n,t){return wysihtml5.commands.insertList.state(n,t,"OL")}};wysihtml5.commands.insertUnorderedList={exec:function(n,t){wysihtml5.commands.insertList.exec(n,t,"UL")},state:function(n,t){return wysihtml5.commands.insertList.state(n,t,"UL")}};wysihtml5.commands.insertList=function(n){var t=function(n,t){if(n&&n.nodeName){"string"==typeof t&&(t=[t]);for(var i=t.length;i--;)if(n.nodeName===t[i])return!0}return!1},r=function(i,r,u){var e,o,f={el:null,other:!1};return i&&(e=n.dom.getParentElement(i,{nodeName:"LI"}),o="UL"===r?"OL":"UL",t(i,r)?f.el=i:t(i,o)?f={el:i,other:!0}:e&&(t(e.parentNode,r)?f.el=e.parentNode:t(e.parentNode,o)&&(f={el:e.parentNode,other:!0}))),f.el&&!u.element.contains(f.el)&&(f.el=null),f},u=function(t,r,u){var f,e="UL"===r?"OL":"UL";u.selection.executeAndRestore(function(){var o,s,h=i(e,u);if(h.length)for(o=h.length;o--;)n.dom.renameElement(h[o],r.toLowerCase());else{for(f=i(["OL","UL"],u),s=f.length;s--;)n.dom.resolveList(f[s],u.config.useLineBreaks);n.dom.resolveList(t,u.config.useLineBreaks)}})},f=function(t,r,u){var f="UL"===r?"OL":"UL";u.selection.executeAndRestore(function(){for(var o=[t].concat(i(f,u)),e=o.length;e--;)n.dom.renameElement(o[e],r.toLowerCase())})},i=function(n,i){for(var f=i.selection.getOwnRanges(),u=[],r=f.length;r--;)u=u.concat(f[r].getNodes([1],function(i){return t(i,n)}));return u},e=function(t,i){i.selection.executeAndRestoreRangy(function(){var u,f,e="_wysihtml5-temp-"+(new Date).getTime(),r=i.selection.deblockAndSurround({nodeName:"div",className:e});r.innerHTML=r.innerHTML.replace(/\uFEFF/g,"");r&&(u=n.lang.array(["","<br>",n.INVISIBLE_SPACE]).contains(r.innerHTML),f=n.dom.convertToList(r,t.toLowerCase(),i.parent.config.uneditableContainerClassname),u&&i.selection.selectNode(f.querySelector("li"),!0))})};return{exec:function(n,t,i){var h=n.doc,s="OL"===i?"insertOrderedList":"insertUnorderedList",c=n.selection.getSelectedNode(),o=r(c,i,n);o.el?o.other?f(o.el,i,n):u(o.el,i,n):n.commands.support(s)?h.execCommand(s,!1,null):e(i,n)},state:function(n,t,i){var f=n.selection.getSelectedNode(),u=r(f,i,n);return u.el&&!u.other?u.el:!1}}}(wysihtml5);wysihtml5.commands.italic={exec:function(n,t){wysihtml5.commands.formatInline.execWithToggle(n,t,"i")},state:function(n,t){return wysihtml5.commands.formatInline.state(n,t,"i")}},function(n){var t="wysiwyg-text-align-center",i=/wysiwyg-text-align-[0-9a-z]+/g;n.commands.justifyCenter={exec:function(r){return n.commands.formatBlock.exec(r,"formatBlock",null,t,i)},state:function(r){return n.commands.formatBlock.state(r,"formatBlock",null,t,i)}}}(wysihtml5),function(n){var t="wysiwyg-text-align-left",i=/wysiwyg-text-align-[0-9a-z]+/g;n.commands.justifyLeft={exec:function(r){return n.commands.formatBlock.exec(r,"formatBlock",null,t,i)},state:function(r){return n.commands.formatBlock.state(r,"formatBlock",null,t,i)}}}(wysihtml5),function(n){var t="wysiwyg-text-align-right",i=/wysiwyg-text-align-[0-9a-z]+/g;n.commands.justifyRight={exec:function(r){return n.commands.formatBlock.exec(r,"formatBlock",null,t,i)},state:function(r){return n.commands.formatBlock.state(r,"formatBlock",null,t,i)}}}(wysihtml5),function(n){var t="wysiwyg-text-align-justify",i=/wysiwyg-text-align-[0-9a-z]+/g;n.commands.justifyFull={exec:function(r){return n.commands.formatBlock.exec(r,"formatBlock",null,t,i)},state:function(r){return n.commands.formatBlock.state(r,"formatBlock",null,t,i)}}}(wysihtml5),function(n){var t="text-align: right;",i=/(\s|^)text-align\s*:\s*[^;\s]+;?/gi;n.commands.alignRightStyle={exec:function(r){return n.commands.formatBlock.exec(r,"formatBlock",null,null,null,t,i)},state:function(r){return n.commands.formatBlock.state(r,"formatBlock",null,null,null,t,i)}}}(wysihtml5),function(n){var t="text-align: left;",i=/(\s|^)text-align\s*:\s*[^;\s]+;?/gi;n.commands.alignLeftStyle={exec:function(r){return n.commands.formatBlock.exec(r,"formatBlock",null,null,null,t,i)},state:function(r){return n.commands.formatBlock.state(r,"formatBlock",null,null,null,t,i)}}}(wysihtml5),function(n){var t="text-align: center;",i=/(\s|^)text-align\s*:\s*[^;\s]+;?/gi;n.commands.alignCenterStyle={exec:function(r){return n.commands.formatBlock.exec(r,"formatBlock",null,null,null,t,i)},state:function(r){return n.commands.formatBlock.state(r,"formatBlock",null,null,null,t,i)}}}(wysihtml5);wysihtml5.commands.redo={exec:function(n){return n.undoManager.redo()},state:function(){return!1}};wysihtml5.commands.underline={exec:function(n,t){wysihtml5.commands.formatInline.execWithToggle(n,t,"u")},state:function(n,t){return wysihtml5.commands.formatInline.state(n,t,"u")}};wysihtml5.commands.undo={exec:function(n){return n.undoManager.undo()},state:function(){return!1}};wysihtml5.commands.createTable={exec:function(n,t,i){var u,f,r;if(i&&i.cols&&i.rows&&parseInt(i.cols,10)>0&&parseInt(i.rows,10)>0){for(r=i.tableStyle?'<table style="'+i.tableStyle+'">':"<table>",r+="<tbody>",f=0;f<i.rows;f++){for(r+="<tr>",u=0;u<i.cols;u++)r+="<td>&nbsp;<\/td>";r+="<\/tr>"}r+="<\/tbody><\/table>";n.commands.exec("insertHTML",r)}},state:function(){return!1}};wysihtml5.commands.mergeTableCells={exec:function(n,t){n.tableSelection&&n.tableSelection.start&&n.tableSelection.end&&(this.state(n,t)?wysihtml5.dom.table.unmergeCell(n.tableSelection.start):wysihtml5.dom.table.mergeCellsBetween(n.tableSelection.start,n.tableSelection.end))},state:function(n){if(n.tableSelection){var t=n.tableSelection.start,i=n.tableSelection.end;if(t&&i&&t==i&&(wysihtml5.dom.getAttribute(t,"colspan")&&parseInt(wysihtml5.dom.getAttribute(t,"colspan"),10)>1||wysihtml5.dom.getAttribute(t,"rowspan")&&parseInt(wysihtml5.dom.getAttribute(t,"rowspan"),10)>1))return[t]}return!1}};wysihtml5.commands.addTableCells={exec:function(n,t,i){if(n.tableSelection&&n.tableSelection.start&&n.tableSelection.end){var r=wysihtml5.dom.table.orderSelectionEnds(n.tableSelection.start,n.tableSelection.end);"before"==i||"above"==i?wysihtml5.dom.table.addCells(r.start,i):("after"==i||"below"==i)&&wysihtml5.dom.table.addCells(r.end,i);setTimeout(function(){n.tableSelection.select(r.start,r.end)},0)}},state:function(){return!1}};wysihtml5.commands.deleteTableCells={exec:function(n,t,i){if(n.tableSelection&&n.tableSelection.start&&n.tableSelection.end){var r,e=wysihtml5.dom.table.orderSelectionEnds(n.tableSelection.start,n.tableSelection.end),u=wysihtml5.dom.table.indexOf(e.start),f=n.tableSelection.table;wysihtml5.dom.table.removeCells(e.start,i);setTimeout(function(){r=wysihtml5.dom.table.findCell(f,u);r||("row"==i&&(r=wysihtml5.dom.table.findCell(f,{row:u.row-1,col:u.col})),"column"==i&&(r=wysihtml5.dom.table.findCell(f,{row:u.row,col:u.col-1})));r&&n.tableSelection.select(r,r)},0)}},state:function(){return!1}};wysihtml5.commands.indentList={exec:function(n){var t=n.selection.getSelectionParentsByTag("LI");return t?this.tryToPushLiLevel(t,n.selection):!1},state:function(){return!1},tryToPushLiLevel:function(n,t){var e,u,r,i,f,o=!1;return t.executeAndRestoreRangy(function(){for(var t=n.length;t--;)i=n[t],e="OL"===i.parentNode.nodeName?"OL":"UL",u=i.ownerDocument.createElement(e),r=wysihtml5.dom.domNode(i).prev({nodeTypes:[wysihtml5.ELEMENT_NODE]}),f=r?r.querySelector("ul, ol"):null,r&&(f?f.appendChild(i):(u.appendChild(i),r.appendChild(u)),o=!0)}),o}};wysihtml5.commands.outdentList={exec:function(n){var t=n.selection.getSelectionParentsByTag("LI");return t?this.tryToPullLiLevel(t,n):!1},state:function(){return!1},tryToPullLiLevel:function(n,t){var i,f,e,r,u,o=!1,s=this;return t.selection.executeAndRestoreRangy(function(){for(var c,h=n.length;h--;)if(r=n[h],r.parentNode&&(i=r.parentNode,"OL"===i.tagName||"UL"===i.tagName)){if(o=!0,f=wysihtml5.dom.getParentElement(i.parentNode,{nodeName:["OL","UL"]},!1,t.element),e=wysihtml5.dom.getParentElement(i.parentNode,{nodeName:["LI"]},!1,t.element),f&&e)r.nextSibling&&(u=s.getAfterList(i,r),r.appendChild(u)),f.insertBefore(r,e.nextSibling);else{for(r.nextSibling&&(u=s.getAfterList(i,r),r.appendChild(u)),c=r.childNodes.length;c--;)i.parentNode.insertBefore(r.childNodes[c],i.nextSibling);i.parentNode.insertBefore(document.createElement("br"),i.nextSibling);r.parentNode.removeChild(r)}0===i.childNodes.length&&i.parentNode.removeChild(i)}}),o},getAfterList:function(n,t){for(var r=n.nodeName,i=document.createElement(r);t.nextSibling;)i.appendChild(t.nextSibling);return i}},function(n){var r=90,f=89,e=8,o=46,s=25,i="data-wysihtml5-selection-node",t="data-wysihtml5-selection-offset",u=('<span id="_wysihtml5-undo" class="_wysihtml5-temp">'+n.INVISIBLE_SPACE+"<\/span>",'<span id="_wysihtml5-redo" class="_wysihtml5-temp">'+n.INVISIBLE_SPACE+"<\/span>",n.dom);n.UndoManager=n.lang.Dispatcher.extend({constructor:function(n){this.editor=n;this.composer=n.composer;this.element=this.composer.element;this.position=0;this.historyStr=[];this.historyDom=[];this.transact();this._observe()},_observe:function(){var t,n=this;this.composer.sandbox.getDocument();u.observe(this.element,"keydown",function(t){if(!t.altKey&&(t.ctrlKey||t.metaKey)){var i=t.keyCode,u=i===r&&!t.shiftKey,e=i===r&&t.shiftKey||i===f;u?(n.undo(),t.preventDefault()):e&&(n.redo(),t.preventDefault())}});u.observe(this.element,"keydown",function(i){var r=i.keyCode;r!==t&&(t=r,(r===e||r===o)&&n.transact())});this.editor.on("newword:composer",function(){n.transact()}).on("beforecommand:composer",function(){n.transact()})},transact:function(){var u,f,h,r,e,c,l,a=this.historyStr[this.position-1],o=this.composer.getValue(!1,!1),v=this.element.offsetWidth>0&&this.element.offsetHeight>0;o!==a&&(c=this.historyStr.length=this.historyDom.length=this.position,c>s&&(this.historyStr.shift(),this.historyDom.shift(),this.position--),this.position++,v&&(u=this.composer.selection.getRange(),f=u&&u.startContainer?u.startContainer:this.element,h=u&&u.startOffset?u.startOffset:0,f.nodeType===n.ELEMENT_NODE?r=f:(r=f.parentNode,e=this.getChildNodeIndex(r,f)),r.setAttribute(t,h),void 0!==e&&r.setAttribute(i,e)),l=this.element.cloneNode(!!o),this.historyDom.push(l),this.historyStr.push(o),r&&(r.removeAttribute(t),r.removeAttribute(i)))},undo:function(){this.transact();this.undoPossible()&&(this.set(this.historyDom[--this.position-1]),this.editor.fire("undo:composer"))},redo:function(){this.redoPossible()&&(this.set(this.historyDom[++this.position-1]),this.editor.fire("redo:composer"))},undoPossible:function(){return this.position>1},redoPossible:function(){return this.position<this.historyStr.length},set:function(n){var u,o,s,e,r,f;for(this.element.innerHTML="",u=0,o=n.childNodes,s=n.childNodes.length;s>u;u++)this.element.appendChild(o[u].cloneNode(!0));n.hasAttribute(t)?(e=n.getAttribute(t),f=n.getAttribute(i),r=this.element):(r=this.element.querySelector("["+t+"]")||this.element,e=r.getAttribute(t),f=r.getAttribute(i),r.removeAttribute(t),r.removeAttribute(i));null!==f&&(r=this.getChildNodeByIndex(r,+f));this.composer.selection.set(r,e)},getChildNodeIndex:function(n,t){for(var i=0,r=n.childNodes,u=r.length;u>i;i++)if(r[i]===t)return i},getChildNodeByIndex:function(n,t){return n.childNodes[t]}})}(wysihtml5);wysihtml5.views.View=Base.extend({constructor:function(n,t,i){this.parent=n;this.element=t;this.config=i;this.config.noTextarea||this._observeViewChange()},_observeViewChange:function(){var n=this;this.parent.on("beforeload",function(){n.parent.on("change_view",function(t){t===n.name?(n.parent.currentView=n,n.show(),setTimeout(function(){n.focus()},0)):n.hide()})})},focus:function(){if(this.element.ownerDocument.querySelector(":focus")!==this.element)try{this.element.focus()}catch(n){}},hide:function(){this.element.style.display="none"},show:function(){this.element.style.display=""},disable:function(){this.element.setAttribute("disabled","disabled")},enable:function(){this.element.removeAttribute("disabled")}}),function(n){var t=n.dom,i=n.browser;n.views.Composer=n.views.View.extend({name:"composer",CARET_HACK:"<br>",constructor:function(n,t,i){this.base(n,t,i);this.config.noTextarea?this.editableArea=t:this.textarea=this.parent.textarea;this.config.contentEditableMode?this._initContentEditableArea():this._initSandbox()},clear:function(){this.element.innerHTML=i.displaysCaretInEmptyContentEditableCorrectly()?"":this.CARET_HACK},getValue:function(t,i){var r=this.isEmpty()?"":n.quirks.getCorrectInnerHTML(this.element);return t!==!1&&(r=this.parent.parse(r,i===!1?!1:!0)),r},setValue:function(n,t){t&&(n=this.parent.parse(n));try{this.element.innerHTML=n}catch(i){this.element.innerText=n}},cleanUp:function(){this.parent.parse(this.element)},show:function(){this.editableArea.style.display=this._displayStyle||"";this.config.noTextarea||this.textarea.element.disabled||(this.disable(),this.enable())},hide:function(){this._displayStyle=t.getStyle("display").from(this.editableArea);"none"===this._displayStyle&&(this._displayStyle=null);this.editableArea.style.display="none"},disable:function(){this.parent.fire("disable:composer");this.element.removeAttribute("contentEditable")},enable:function(){this.parent.fire("enable:composer");this.element.setAttribute("contentEditable","true")},focus:function(t){n.browser.doesAsyncFocus()&&this.hasPlaceholderSet()&&this.clear();this.base();var i=this.element.lastChild;t&&i&&this.selection&&("BR"===i.nodeName?this.selection.setBefore(this.element.lastChild):this.selection.setAfter(this.element.lastChild))},getTextContent:function(){return t.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==(this.config.noTextarea?this.editableArea.getAttribute("data-placeholder"):this.textarea.element.getAttribute("placeholder"))&&this.placeholderSet},isEmpty:function(){var n=this.element.innerHTML.toLowerCase();return/^(\s|<br>|<\/br>|<p>|<\/p>)*$/i.test(n)||""===n||"<br>"===n||"<p><\/p>"===n||"<p><br><\/p>"===n||this.hasPlaceholderSet()},_initContentEditableArea:function(){var n=this;this.config.noTextarea?this.sandbox=new t.ContentEditableArea(function(){n._create()},{},this.editableArea):(this.sandbox=new t.ContentEditableArea(function(){n._create()}),this.editableArea=this.sandbox.getContentEditable(),t.insert(this.editableArea).after(this.textarea.element),this._createWysiwygFormField())},_initSandbox:function(){var n,i=this;this.sandbox=new t.Sandbox(function(){i._create()},{stylesheets:this.config.stylesheets});this.editableArea=this.sandbox.getIframe();n=this.textarea.element;t.insert(this.editableArea).after(n);this._createWysiwygFormField()},_createWysiwygFormField:function(){if(this.textarea.element.form){var n=document.createElement("input");n.type="hidden";n.name="_wysihtml5_mode";n.value=1;t.insert(n).after(this.textarea.element)}},_create:function(){var r,u,f=this;this.doc=this.sandbox.getDocument();this.element=this.config.contentEditableMode?this.sandbox.getContentEditable():this.doc.body;this.config.noTextarea?this.cleanUp():(this.textarea=this.parent.textarea,this.element.innerHTML=this.textarea.getValue(!0,!1));this.selection=new n.Selection(this.parent,this.element,this.config.uneditableContainerClassname);this.commands=new n.Commands(this.parent);this.config.noTextarea||t.copyAttributes(["className","spellcheck","title","lang","dir","accessKey"]).from(this.textarea.element).to(this.element);t.addClass(this.element,this.config.composerClassName);this.config.style&&!this.config.contentEditableMode&&this.style();this.observe();r=this.config.name;r&&(t.addClass(this.element,r),this.config.contentEditableMode||t.addClass(this.editableArea,r));this.enable();!this.config.noTextarea&&this.textarea.element.disabled&&this.disable();u="string"==typeof this.config.placeholder?this.config.placeholder:this.config.noTextarea?this.editableArea.getAttribute("data-placeholder"):this.textarea.element.getAttribute("placeholder");u&&t.simulatePlaceholder(this.parent,this,u);this.commands.exec("styleWithCSS",!1);this._initAutoLinking();this._initObjectResizing();this._initUndoManager();this._initLineBreaking();this.config.noTextarea||!this.textarea.element.hasAttribute("autofocus")&&document.querySelector(":focus")!=this.textarea.element||i.isIos()||setTimeout(function(){f.focus(!0)},100);i.clearsContentEditableCorrectly()||n.quirks.ensureProperClearing(this);this.initSync&&this.config.sync&&this.initSync();this.config.noTextarea||this.textarea.hide();this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var f,e,u,r=this,o=i.canDisableAutoLinking(),s=i.doesAutoLinkingInContentEditable();o&&this.commands.exec("autoUrlDetect",!1);this.config.autoLink&&((!s||s&&o)&&(this.parent.on("newword:composer",function(){t.getTextContent(r.element).match(t.autoLink.URL_REG_EXP)&&r.selection.executeAndRestore(function(i,u){for(var e=r.element.querySelectorAll("."+r.config.uneditableContainerClassname),o=!1,f=e.length;f--;)n.dom.contains(e[f],u)&&(o=!0);o||t.autoLink(u.parentNode,[r.config.uneditableContainerClassname])})}),t.observe(this.element,"blur",function(){t.autoLink(r.element,[r.config.uneditableContainerClassname])})),f=this.sandbox.getDocument().getElementsByTagName("a"),e=t.autoLink.URL_REG_EXP,u=function(i){var r=n.lang.string(t.getTextContent(i)).trim();return"www."===r.substr(0,4)&&(r="http://"+r),r},t.observe(this.element,"keydown",function(n){if(f.length){var o,s=r.selection.getSelectedNode(n.target.ownerDocument),i=t.getParentElement(s,{nodeName:"A"},4);i&&(o=u(i),setTimeout(function(){var n=u(i);n!==o&&n.match(e)&&i.setAttribute("href",n)},0))}}))},_initObjectResizing:function(){if(this.commands.exec("enableObjectResizing",!0),i.supportsEvent("resizeend")){var r=["width","height"],f=r.length,u=this.element;t.observe(u,"resizeend",function(t){var i,e=t.target||t.srcElement,o=e.style,s=0;if("IMG"===e.nodeName){for(;f>s;s++)i=r[s],o[i]&&(e.setAttribute(i,parseInt(o[i],10)),o[i]="");n.quirks.redraw(u)}})}},_initUndoManager:function(){this.undoManager=new n.UndoManager(this.parent)},_initLineBreaking:function(){function u(n){var i=t.getParentElement(n,{nodeName:["P","DIV"]},2);i&&t.contains(r.element,i)&&r.selection.executeAndRestore(function(){r.config.useLineBreaks?t.replaceWithChildNodes(i):"P"!==i.nodeName&&t.renameElement(i,"p")})}var r=this,f=["LI","P","H1","H2","H3","H4","H5","H6"],e=["UL","OL","MENU"];this.config.useLineBreaks||t.observe(this.element,["focus","keydown"],function(){if(r.isEmpty()){var n=r.doc.createElement("P");r.element.innerHTML="";r.element.appendChild(n);i.displaysCaretInEmptyContentEditableCorrectly()?r.selection.selectNode(n,!0):(n.innerHTML="<br>",r.selection.setBefore(n.firstChild))}});t.observe(this.element,"keydown",function(i){var o,s=i.keyCode;if(!i.shiftKey&&(s===n.ENTER_KEY||s===n.BACKSPACE_KEY))return o=t.getParentElement(r.selection.getSelectedNode(),{nodeName:f},4),o?(setTimeout(function(){var f,i=r.selection.getSelectedNode();if("LI"===o.nodeName){if(!i)return;f=t.getParentElement(i,{nodeName:e},2);f||u(i)}s===n.ENTER_KEY&&o.nodeName.match(/^H[1-6]$/)&&u(i)},0),void 0):(r.config.useLineBreaks&&s===n.ENTER_KEY&&!n.browser.insertsLineBreaksOnReturn()&&(i.preventDefault(),r.commands.exec("insertLineBreak")),void 0)})}})}(wysihtml5),function(n){var t=n.dom,r=document,e=window,f=r.createElement("div"),i=["background-color","color","cursor","font-family","font-size","font-style","font-variant","font-weight","line-height","letter-spacing","text-align","text-decoration","text-indent","text-rendering","word-break","word-wrap","word-spacing"],u=["background-color","border-collapse","border-bottom-color","border-bottom-style","border-bottom-width","border-left-color","border-left-style","border-left-width","border-right-color","border-right-style","border-right-width","border-top-color","border-top-style","border-top-width","clear","display","float","margin-bottom","margin-left","margin-right","margin-top","outline-color","outline-offset","outline-width","outline-style","padding-left","padding-right","padding-top","padding-bottom","position","top","left","right","bottom","z-index","vertical-align","text-align","-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing","-webkit-box-shadow","-moz-box-shadow","-ms-box-shadow","box-shadow","-webkit-border-top-right-radius","-moz-border-radius-topright","border-top-right-radius","-webkit-border-bottom-right-radius","-moz-border-radius-bottomright","border-bottom-right-radius","-webkit-border-bottom-left-radius","-moz-border-radius-bottomleft","border-bottom-left-radius","-webkit-border-top-left-radius","-moz-border-radius-topleft","border-top-left-radius","width","height"],o=["html                 { height: 100%; }","body                 { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }","body > p:first-child { margin-top: 0; }","._wysihtml5-temp     { display: none; }",n.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","img:-moz-broken      { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"],s=function(n){if(n.setActive)try{n.setActive()}catch(s){}else{var i=n.style,u=r.documentElement.scrollTop||r.body.scrollTop,f=r.documentElement.scrollLeft||r.body.scrollLeft,o={position:i.position,top:i.top,left:i.left,WebkitUserSelect:i.WebkitUserSelect};t.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(n);n.focus();t.setStyles(o).on(n);e.scrollTo&&e.scrollTo(f,u)}};n.views.Composer.prototype.style=function(){var l,c,h=this,a=r.querySelector(":focus"),e=this.textarea.element,v=e.hasAttribute("placeholder"),p=v&&e.getAttribute("placeholder"),y=e.style.display,w=e.disabled;return this.focusStylesHost=f.cloneNode(!1),this.blurStylesHost=f.cloneNode(!1),this.disabledStylesHost=f.cloneNode(!1),v&&e.removeAttribute("placeholder"),e===a&&e.blur(),e.disabled=!1,e.style.display=l="none",(e.getAttribute("rows")&&"auto"===t.getStyle("height").from(e)||e.getAttribute("cols")&&"auto"===t.getStyle("width").from(e))&&(e.style.display=l=y),t.copyStyles(u).from(e).to(this.editableArea).andTo(this.blurStylesHost),t.copyStyles(i).from(e).to(this.element).andTo(this.blurStylesHost),t.insertCSS(o).into(this.element.ownerDocument),e.disabled=!0,t.copyStyles(u).from(e).to(this.disabledStylesHost),t.copyStyles(i).from(e).to(this.disabledStylesHost),e.disabled=w,e.style.display=y,s(e),e.style.display=l,t.copyStyles(u).from(e).to(this.focusStylesHost),t.copyStyles(i).from(e).to(this.focusStylesHost),e.style.display=y,t.copyStyles(["display"]).from(e).to(this.editableArea),c=n.lang.array(u).without(["display"]),a?a.focus():e.blur(),v&&e.setAttribute("placeholder",p),this.parent.on("focus:composer",function(){t.copyStyles(c).from(h.focusStylesHost).to(h.editableArea);t.copyStyles(i).from(h.focusStylesHost).to(h.element)}),this.parent.on("blur:composer",function(){t.copyStyles(c).from(h.blurStylesHost).to(h.editableArea);t.copyStyles(i).from(h.blurStylesHost).to(h.element)}),this.parent.observe("disable:composer",function(){t.copyStyles(c).from(h.disabledStylesHost).to(h.editableArea);t.copyStyles(i).from(h.disabledStylesHost).to(h.element)}),this.parent.observe("enable:composer",function(){t.copyStyles(c).from(h.blurStylesHost).to(h.editableArea);t.copyStyles(i).from(h.blurStylesHost).to(h.element)}),this}}(wysihtml5),function(n){var t=n.dom,i=n.browser,r={66:"bold",73:"italic",85:"underline"},u=function(n,t,i){var f,u=n.getPreviousNode(t,!0),r=n.getSelectedNode();if(1!==r.nodeType&&r.parentNode!==i&&(r=r.parentNode),u)if(1==r.nodeType){if(f=r.firstChild,1==u.nodeType)for(;r.firstChild;)u.appendChild(r.firstChild);else for(;r.firstChild;)t.parentNode.insertBefore(r.firstChild,t);r.parentNode&&r.parentNode.removeChild(r);n.setBefore(f)}else 1==u.nodeType?u.appendChild(r):t.parentNode.insertBefore(r,t),n.setBefore(r)},f=function(n,t,i,r){var f,e,o;t.isCollapsed()?t.caretIsInTheBeginnig("LI")?(n.preventDefault(),r.commands.exec("outdentList")):t.caretIsInTheBeginnig()?n.preventDefault():(t.caretIsFirstInSelection()&&t.getPreviousNode()&&t.getPreviousNode().nodeName&&/^H\d$/gi.test(t.getPreviousNode().nodeName)&&(f=t.getPreviousNode(),n.preventDefault(),/^\s*$/.test(f.textContent||f.innerText)?f.parentNode.removeChild(f):(e=f.ownerDocument.createRange(),e.selectNodeContents(f),e.collapse(!1),t.setSelection(e))),o=t.caretIsBeforeUneditable(),o&&(n.preventDefault(),u(t,o,i))):t.containsUneditable()&&(n.preventDefault(),t.deleteContents())},e=function(n){if(n.selection.isCollapsed()){if(n.selection.caretIsInTheBeginnig("LI")&&n.commands.exec("indentList"))return}else n.selection.deleteContents();n.commands.exec("insertHTML","&emsp;")};n.views.Composer.prototype.observe=function(){var h,l,u=this,a=this.getValue(!1,!1),s=this.sandbox.getIframe?this.sandbox.getIframe():this.sandbox.getContentEditable(),o=this.element,c=i.supportsEventsInIframeCorrectly()||this.sandbox.getContentEditable?o:this.sandbox.getWindow();t.observe(s,"DOMNodeRemoved",function(){clearInterval(h);u.parent.fire("destroy:composer")});i.supportsMutationEvents()||(h=setInterval(function(){t.contains(document.documentElement,s)||(clearInterval(h),u.parent.fire("destroy:composer"))},250));t.observe(c,["drop","paste","mouseup","focus","keyup"],function(){setTimeout(function(){u.parent.fire("interaction").fire("interaction:composer")},0)});this.config.handleTables&&(!this.tableClickHandle&&this.doc.execCommand&&n.browser.supportsCommand(this.doc,"enableObjectResizing")&&n.browser.supportsCommand(this.doc,"enableInlineTableEditing")&&(this.sandbox.getIframe?this.tableClickHandle=t.observe(s,["focus","mouseup","mouseover"],function(){u.doc.execCommand("enableObjectResizing",!1,"false");u.doc.execCommand("enableInlineTableEditing",!1,"false");u.tableClickHandle.stop()}):setTimeout(function(){u.doc.execCommand("enableObjectResizing",!1,"false");u.doc.execCommand("enableInlineTableEditing",!1,"false")},0)),this.tableSelection=n.quirks.tableCellsSelection(o,u.parent));t.observe(c,"focus",function(n){u.parent.fire("focus",n).fire("focus:composer",n);setTimeout(function(){a=u.getValue(!1,!1)},0)});t.observe(c,"blur",function(n){if(a!==u.getValue(!1,!1)){var t=n;"function"==typeof Object.create&&(t=Object.create(n,{type:{value:"change"}}));u.parent.fire("change",t).fire("change:composer",t)}u.parent.fire("blur",n).fire("blur:composer",n)});t.observe(o,"dragenter",function(){u.parent.fire("unset_placeholder")});t.observe(o,["drop","paste","beforepaste"],function(n){u.parent.fire(n.type,n).fire(n.type+":composer",n)});this.config.copyedFromMarking&&t.observe(o,"copy",function(n){n.clipboardData&&(n.clipboardData.setData("text/html",u.config.copyedFromMarking+u.selection.getHtml()),n.preventDefault());u.parent.fire(n.type,n).fire(n.type+":composer",n)});t.observe(o,"keyup",function(t){var i=t.keyCode;(i===n.SPACE_KEY||i===n.ENTER_KEY)&&u.parent.fire("newword:composer")});this.parent.on("paste:composer",function(){setTimeout(function(){u.parent.fire("newword:composer")},0)});i.canSelectImagesInContentEditable()||t.observe(o,"mousedown",function(t){var i=t.target,r=o.querySelectorAll("img"),f=o.querySelectorAll("."+u.config.uneditableContainerClassname+" img"),e=n.lang.array(r).without(f);"IMG"===i.nodeName&&n.lang.array(e).contains(i)&&u.selection.selectNode(i)});i.canSelectImagesInContentEditable()||t.observe(o,"drop",function(){setTimeout(function(){u.selection.getSelection().removeAllRanges()},0)});i.hasHistoryIssue()&&i.supportsSelectionModify()&&t.observe(o,"keydown",function(n){if(n.metaKey||n.ctrlKey){var t=n.keyCode,r=o.ownerDocument.defaultView,i=r.getSelection();(37===t||39===t)&&(37===t&&(i.modify("extend","left","lineboundary"),n.shiftKey||i.collapseToStart()),39===t&&(i.modify("extend","right","lineboundary"),n.shiftKey||i.collapseToEnd()),n.preventDefault())}});t.observe(o,"keydown",function(n){var t=n.keyCode,i=r[t];(n.ctrlKey||n.metaKey)&&!n.altKey&&i&&(u.commands.exec(i),n.preventDefault());8===t?f(n,u.selection,o,u):u.config.handleTabKey&&9===t&&(n.preventDefault(),e(u,o))});t.observe(o,"keydown",function(t){var i,r=u.selection.getSelectedNode(!0),f=t.keyCode;r&&"IMG"===r.nodeName&&(f===n.BACKSPACE_KEY||f===n.DELETE_KEY)&&(i=r.parentNode,i.removeChild(r),"A"!==i.nodeName||i.firstChild||i.parentNode.removeChild(i),setTimeout(function(){n.quirks.redraw(o)},0),t.preventDefault())});!this.config.contentEditableMode&&i.hasIframeFocusIssue()&&(t.observe(s,"focus",function(){setTimeout(function(){u.doc.querySelector(":focus")!==u.element&&u.focus()},0)}),t.observe(this.element,"blur",function(){setTimeout(function(){u.selection.getSelection().removeAllRanges()},0)}));l={IMG:"Image: ",A:"Link: "};t.observe(o,"mouseover",function(n){var r,u,t=n.target,i=t.nodeName;("A"===i||"IMG"===i)&&(u=t.hasAttribute("title"),u||(r=l[i]+(t.getAttribute("href")||t.getAttribute("src")),t.setAttribute("title",r)))})}}(wysihtml5),function(n){var t=400;n.views.Synchronizer=Base.extend({constructor:function(n,t,i){this.editor=n;this.textarea=t;this.composer=i;this._observe()},fromComposerToTextarea:function(t){this.textarea.setValue(n.lang.string(this.composer.getValue(!1,!1)).trim(),t)},fromTextareaToComposer:function(n){var t=this.textarea.getValue(!1,!1);t?this.composer.setValue(t,n):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(n){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(n):this.fromComposerToTextarea(n)},_observe:function(){var r,i=this,u=this.textarea.element.form,f=function(){r=setInterval(function(){i.fromComposerToTextarea()},t)},e=function(){clearInterval(r);r=null};f();u&&(n.dom.observe(u,"submit",function(){i.sync(!0)}),n.dom.observe(u,"reset",function(){setTimeout(function(){i.fromTextareaToComposer()},0)}));this.editor.on("change_view",function(n){"composer"!==n||r?"textarea"===n&&(i.fromComposerToTextarea(!0),e()):(i.fromTextareaToComposer(!0),f())});this.editor.on("destroy:composer",e)}})}(wysihtml5);wysihtml5.views.Textarea=wysihtml5.views.View.extend({name:"textarea",constructor:function(n,t,i){this.base(n,t,i);this._observe()},clear:function(){this.element.value=""},getValue:function(n){var t=this.isEmpty()?"":this.element.value;return n!==!1&&(t=this.parent.parse(t)),t},setValue:function(n,t){t&&(n=this.parent.parse(n));this.element.value=n},cleanUp:function(){var n=this.parent.parse(this.element.value);this.element.value=n},hasPlaceholderSet:function(){var t=wysihtml5.browser.supportsPlaceholderAttributeOn(this.element),i=this.element.getAttribute("placeholder")||null,n=this.element.value,r=!n;return t&&r||n===i},isEmpty:function(){return!wysihtml5.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var t=this.element,n=this.parent,i={focusin:"focus",focusout:"blur"},r=wysihtml5.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];n.on("beforeload",function(){wysihtml5.dom.observe(t,r,function(t){var r=i[t.type]||t.type;n.fire(r).fire(r+":textarea")});wysihtml5.dom.observe(t,["paste","drop"],function(){setTimeout(function(){n.fire("paste").fire("paste:textarea")},0)})})}}),function(n){var t,i={name:t,style:!0,toolbar:t,showToolbarAfterInit:!0,autoLink:!0,handleTables:!0,handleTabKey:!0,parserRules:{tags:{br:{},span:{},div:{},p:{}},classes:{}},pasteParserRulesets:null,parser:n.dom.parse,composerClassName:"wysihtml5-editor",bodyClassName:"wysihtml5-supported",useLineBreaks:!0,stylesheets:[],placeholderText:t,supportTouchDevices:!0,cleanUp:!0,contentEditableMode:!1,uneditableContainerClassname:"wysihtml5-uneditable-container",copyedFromMarking:'<meta name="copied-from" content="wysihtml5">'};n.Editor=n.lang.Dispatcher.extend({constructor:function(t,r){if(this.editableElement="string"==typeof t?document.getElementById(t):t,this.config=n.lang.object({}).merge(i).merge(r).get(),this._isCompatible=n.browser.supported(),"textarea"!=this.editableElement.nodeName.toLowerCase()&&(this.config.contentEditableMode=!0,this.config.noTextarea=!0),this.config.noTextarea||(this.textarea=new n.views.Textarea(this,this.editableElement,this.config),this.currentView=this.textarea),!this._isCompatible||!this.config.supportTouchDevices&&n.browser.isTouchDevice()){var u=this;return setTimeout(function(){u.fire("beforeload").fire("load")},0),void 0}n.dom.addClass(document.body,this.config.bodyClassName);this.composer=new n.views.Composer(this,this.editableElement,this.config);this.currentView=this.composer;"function"==typeof this.config.parser&&this._initParser();this.on("beforeload",this.handleBeforeLoad)},handleBeforeLoad:function(){this.config.noTextarea||(this.synchronizer=new n.views.Synchronizer(this,this.textarea,this.composer));this.config.toolbar&&(this.toolbar=new n.toolbar.Toolbar(this,this.config.toolbar,this.config.showToolbarAfterInit))},isCompatible:function(){return this._isCompatible},clear:function(){return this.currentView.clear(),this},getValue:function(n,t){return this.currentView.getValue(n,t)},setValue:function(n,t){return this.fire("unset_placeholder"),n?(this.currentView.setValue(n,t),this):this.clear()},cleanUp:function(){this.currentView.cleanUp()},focus:function(n){return this.currentView.focus(n),this},disable:function(){return this.currentView.disable(),this},enable:function(){return this.currentView.enable(),this},isEmpty:function(){return this.currentView.isEmpty()},hasPlaceholderSet:function(){return this.currentView.hasPlaceholderSet()},parse:function(t,i){var r=this.config.contentEditableMode?document:this.composer?this.composer.sandbox.getDocument():null,u=this.config.parser(t,{rules:this.config.parserRules,cleanUp:this.config.cleanUp,context:r,uneditableClass:this.config.uneditableContainerClassname,clearInternals:i});return"object"==typeof t&&n.quirks.redraw(t),u},_initParser:function(){var t,i=this;n.browser.supportsModenPaste()?this.on("paste:composer",function(r){r.preventDefault();t=n.dom.getPastedHtml(r);t&&i._cleanAndPaste(t)}):this.on("beforepaste:composer",function(t){t.preventDefault();n.dom.getPastedHtmlWithDiv(i.composer,function(n){n&&i._cleanAndPaste(n)})})},_cleanAndPaste:function(t){var i=n.quirks.cleanPastedHTML(t,{referenceNode:this.composer.element,rules:this.config.pasteParserRulesets||[{set:this.config.parserRules}],uneditableClass:this.config.uneditableContainerClassname});this.composer.selection.deleteContents();this.composer.selection.insertHTML(i)}})}(wysihtml5),function(n){var t=n.dom,i="wysihtml5-command-dialog-opened",r="input, select, textarea",u="[data-wysihtml5-dialog-field]",f="data-wysihtml5-dialog-field";n.toolbar.Dialog=n.lang.Dispatcher.extend({constructor:function(n,t){this.link=n;this.container=t},_observe:function(){var u,e,o,f,s,h;if(!this._observed){for(u=this,e=function(n){var t=u._serialize();t==u.elementToChange?u.fire("edit",t):u.fire("save",t);u.hide();n.preventDefault();n.stopPropagation()},t.observe(u.link,"click",function(){t.hasClass(u.link,i)&&setTimeout(function(){u.hide()},0)}),t.observe(this.container,"keydown",function(t){var i=t.keyCode;i===n.ENTER_KEY&&e(t);i===n.ESCAPE_KEY&&(u.fire("cancel"),u.hide())}),t.delegate(this.container,"[data-wysihtml5-dialog-action=save]","click",e),t.delegate(this.container,"[data-wysihtml5-dialog-action=cancel]","click",function(n){u.fire("cancel");u.hide();n.preventDefault();n.stopPropagation()}),o=this.container.querySelectorAll(r),f=0,s=o.length,h=function(){clearInterval(u.interval)};s>f;f++)t.observe(o[f],"change",h);this._observed=!0}},_serialize:function(){for(var i=this.elementToChange||{},t=this.container.querySelectorAll(u),r=t.length,n=0;r>n;n++)i[t[n].getAttribute(f)]=t[n].value;return i},_interpolate:function(n){for(var t,r,e,s=document.querySelector(":focus"),o=this.container.querySelectorAll(u),h=o.length,i=0;h>i;i++)t=o[i],t!==s&&(n&&"hidden"===t.type||(r=t.getAttribute(f),e=this.elementToChange&&"boolean"!=typeof this.elementToChange?this.elementToChange.getAttribute(r)||"":t.defaultValue,t.value=e))},show:function(n){if(!t.hasClass(this.link,i)){var f=this,u=this.container.querySelector(r);if(this.elementToChange=n,this._observe(),this._interpolate(),n&&(this.interval=setInterval(function(){f._interpolate(!0)},500)),t.addClass(this.link,i),this.container.style.display="",this.fire("show"),u&&!n)try{u.focus()}catch(e){}}},hide:function(){clearInterval(this.interval);this.elementToChange=null;t.removeClass(this.link,i);this.container.style.display="none";this.fire("hide")}})}(wysihtml5),function(n){var t=n.dom,u={position:"relative"},i={left:0,margin:0,opacity:0,overflow:"hidden",padding:0,position:"absolute",top:0,zIndex:1},f={cursor:"inherit",fontSize:"50px",height:"50px",marginTop:"-25px",outline:0,padding:0,position:"absolute",right:"-4px",top:"50%"},r={"x-webkit-speech":"",speech:""};n.toolbar.Speech=function(e,o){var c,h,l,s=document.createElement("input");return n.browser.supportsSpeechApiOn(s)?(c=e.editor.textarea.element.getAttribute("lang"),c&&(r.lang=c),h=document.createElement("div"),n.lang.object(i).merge({width:o.offsetWidth+"px",height:o.offsetHeight+"px"}),t.insert(s).into(h),t.insert(h).into(o),t.setStyles(f).on(s),t.setAttributes(r).on(s),t.setStyles(i).on(h),t.setStyles(u).on(o),l="onwebkitspeechchange"in s?"webkitspeechchange":"speechchange",t.observe(s,l,function(){e.execCommand("insertText",s.value);s.value=""}),t.observe(s,"click",function(n){t.hasClass(o,"wysihtml5-command-disabled")&&n.preventDefault();n.stopPropagation()}),void 0):(o.style.display="none",void 0)}}(wysihtml5),function(n){var r="wysihtml5-command-disabled",u="wysihtml5-commands-disabled",i="wysihtml5-command-active",f="wysihtml5-action-active",t=n.dom;n.toolbar.Toolbar=Base.extend({constructor:function(t,e,o){this.editor=t;this.container="string"==typeof e?document.getElementById(e):e;this.composer=t.composer;this._getLinks("command");this._getLinks("action");this._observe();o&&this.show();null!=t.config.classNameCommandDisabled&&(r=t.config.classNameCommandDisabled);null!=t.config.classNameCommandsDisabled&&(u=t.config.classNameCommandsDisabled);null!=t.config.classNameCommandActive&&(i=t.config.classNameCommandActive);null!=t.config.classNameActionActive&&(f=t.config.classNameActionActive);for(var h=this.container.querySelectorAll("[data-wysihtml5-command=insertSpeech]"),c=h.length,s=0;c>s;s++)new n.toolbar.Speech(this,h[s])},_getLinks:function(t){for(var i,e,r,u,o,s=this[t+"Links"]=n.lang.array(this.container.querySelectorAll("[data-wysihtml5-"+t+"]")).get(),h=s.length,f=0,c=this[t+"Mapping"]={};h>f;f++)i=s[f],r=i.getAttribute("data-wysihtml5-"+t),u=i.getAttribute("data-wysihtml5-"+t+"-value"),e=this.container.querySelector("[data-wysihtml5-"+t+"-group='"+r+"']"),o=this._getDialog(i,r),c[r+":"+u]={link:i,group:e,name:r,value:u,dialog:o,state:!1}},_getDialog:function(t,i){var f,e,r=this,u=this.container.querySelector("[data-wysihtml5-dialog='"+i+"']");return u&&(f=n.toolbar["Dialog_"+i]?new n.toolbar["Dialog_"+i](t,u):new n.toolbar.Dialog(t,u),f.on("show",function(){e=r.composer.selection.getBookmark();r.editor.fire("show:dialog",{command:i,dialogContainer:u,commandLink:t})}),f.on("save",function(n){e&&r.composer.selection.setBookmark(e);r._execCommand(i,n);r.editor.fire("save:dialog",{command:i,dialogContainer:u,commandLink:t})}),f.on("cancel",function(){r.editor.focus(!1);r.editor.fire("cancel:dialog",{command:i,dialogContainer:u,commandLink:t})})),f},execCommand:function(n,t){if(!this.commandsDisabled){var i=this.commandMapping[n+":"+t];i&&i.dialog&&!i.state?i.dialog.show():this._execCommand(n,t)}},_execCommand:function(n,t){this.editor.focus(!1);this.composer.commands.exec(n,t);this._updateLinkStates()},execAction:function(n){var t=this.editor;"change_view"===n&&t.textarea&&(t.currentView===t.textarea?t.fire("change_view","composer"):t.fire("change_view","textarea"));"showSource"==n&&t.fire("showSource")},_observe:function(){for(var n=this,i=this.editor,r=this.container,e=this.commandLinks.concat(this.actionLinks),o=e.length,f=0;o>f;f++)"A"===e[f].nodeName?t.setAttributes({href:"javascript:;",unselectable:"on"}).on(e[f]):t.setAttributes({unselectable:"on"}).on(e[f]);t.delegate(r,"[data-wysihtml5-command], [data-wysihtml5-action]","mousedown",function(n){n.preventDefault()});t.delegate(r,"[data-wysihtml5-command]","click",function(t){var i=this,r=i.getAttribute("data-wysihtml5-command"),u=i.getAttribute("data-wysihtml5-command-value");n.execCommand(r,u);t.preventDefault()});t.delegate(r,"[data-wysihtml5-action]","click",function(t){var i=this.getAttribute("data-wysihtml5-action");n.execAction(i);t.preventDefault()});i.on("interaction:composer",function(){n._updateLinkStates()});i.on("focus:composer",function(){n.bookmark=null});this.editor.config.handleTables&&(i.on("tableselect:composer",function(){n.container.querySelectorAll('[data-wysihtml5-hiddentools="table"]')[0].style.display=""}),i.on("tableunselect:composer",function(){n.container.querySelectorAll('[data-wysihtml5-hiddentools="table"]')[0].style.display="none"}));i.on("change_view",function(f){i.textarea&&setTimeout(function(){n.commandsDisabled="composer"!==f;n._updateLinkStates();n.commandsDisabled?t.addClass(r,u):t.removeClass(r,u)},0)})},_updateLinkStates:function(){var s,e,o,u,h=this.commandMapping,c=this.actionMapping;for(s in h)u=h[s],this.commandsDisabled?(e=!1,t.removeClass(u.link,i),u.group&&t.removeClass(u.group,i),u.dialog&&u.dialog.hide()):(e=this.composer.commands.state(u.name,u.value),t.removeClass(u.link,r),u.group&&t.removeClass(u.group,r)),u.state!==e&&(u.state=e,e?(t.addClass(u.link,i),u.group&&t.addClass(u.group,i),u.dialog&&("object"==typeof e||n.lang.object(e).isArray()?(!u.dialog.multiselect&&n.lang.object(e).isArray()&&(e=1===e.length?e[0]:!0,u.state=e),u.dialog.show(e)):u.dialog.hide())):(t.removeClass(u.link,i),u.group&&t.removeClass(u.group,i),u.dialog&&u.dialog.hide()));for(s in c)o=c[s],"change_view"===o.name&&(o.state=this.editor.currentView===this.editor.textarea,o.state?t.addClass(o.link,f):t.removeClass(o.link,f))},show:function(){this.container.style.display=""},hide:function(){this.container.style.display="none"}})}(wysihtml5),function(n){n.toolbar.Dialog_createTable=n.toolbar.Dialog.extend({show:function(n){this.base(n)}})}(wysihtml5),function(n){var t=(n.dom,"[data-wysihtml5-dialog-field]"),i="data-wysihtml5-dialog-field";n.toolbar.Dialog_foreColorStyle=n.toolbar.Dialog.extend({multiselect:!0,_serialize:function(){for(var u={},r=this.container.querySelectorAll(t),f=r.length,n=0;f>n;n++)u[r[n].getAttribute(i)]=r[n].value;return u},_interpolate:function(r){for(var f,c=document.querySelector(":focus"),o=this.container.querySelectorAll(t),l=o.length,e=0,s=this.elementToChange?n.lang.object(this.elementToChange).isArray()?this.elementToChange[0]:this.elementToChange:null,h=s?s.getAttribute("style"):null,u=h?n.quirks.styleParser.parseColor(h,"color"):null;l>e;e++)f=o[e],f!==c&&(r&&"hidden"===f.type||"color"===f.getAttribute(i)&&(f.value=u?u[3]&&1!=u[3]?"rgba("+u[0]+","+u[1]+","+u[2]+","+u[3]+");":"rgb("+u[0]+","+u[1]+","+u[2]+");":"rgb(0,0,0);"))}})}(wysihtml5),function(n){n.dom;n.toolbar.Dialog_fontSizeStyle=n.toolbar.Dialog.extend({multiselect:!0,_serialize:function(){return{size:this.container.querySelector('[data-wysihtml5-dialog-field="size"]').value}},_interpolate:function(){var f=document.querySelector(":focus"),t=this.container.querySelector("[data-wysihtml5-dialog-field='size']"),r=this.elementToChange?n.lang.object(this.elementToChange).isArray()?this.elementToChange[0]:this.elementToChange:null,u=r?r.getAttribute("style"):null,i=u?n.quirks.styleParser.parseFontSize(u):null;t&&t!==f&&i&&!/^\s*$/.test(i)&&(t.value=i)}})}(wysihtml5);Handlebars=function(){var i=function(){"use strict";function n(n){this.string=n}var t;return n.prototype.toString=function(){return""+this.string},t=n}(),n=function(n){"use strict";function f(n){return c[n]||"&amp;"}function e(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}function o(n){return n instanceof h?""+n:n||0===n?(n=""+n,a.test(n)?n.replace(l,f):n):""}function s(n){return n||0===n?u(n)&&0===n.length?!0:!1:!0}var i,r,u,t={},h=n,c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},l=/[&<>"'`]/g,a=/[&<>"'`]/;return t.extend=e,i=Object.prototype.toString,t.toString=i,r=function(n){return"function"==typeof n},r(/x/)&&(r=function(n){return"function"==typeof n&&"[object Function]"===i.call(n)}),t.isFunction=r,u=Array.isArray||function(n){return n&&"object"==typeof n?"[object Array]"===i.call(n):!1},t.isArray=u,t.escapeExpression=o,t.isEmpty=s,t}(i),t=function(){"use strict";function t(t,i){var u,f,r;for(i&&i.firstLine&&(u=i.firstLine,t+=" - "+u+":"+i.firstColumn),f=Error.prototype.constructor.call(this,t),r=0;r<n.length;r++)this[n[r]]=f[n[r]];u&&(this.lineNumber=u,this.column=i.firstColumn)}var i,n=["description","fileName","lineNumber","message","name","number","stack"];return t.prototype=Error(),i=t}(),r=function(n,t){"use strict";function e(n,t){this.helpers=n||{};this.partials=t||{};p(this)}function p(n){n.registerHelper("helperMissing",function(n){if(2===arguments.length)return void 0;throw new y("Missing helper: '"+n+"'");});n.registerHelper("blockHelperMissing",function(t,i){var r=i.inverse||function(){},u=i.fn;return f(t)&&(t=t.call(this)),t===!0?u(this):t===!1||null==t?r(this):o(t)?t.length>0?n.helpers.each(t,i):r(this):u(t)});n.registerHelper("each",function(n,t){var i,s,u,h=t.fn,l=t.inverse,r=0,e="";if(f(n)&&(n=n.call(this)),t.data&&(i=c(t.data)),n&&"object"==typeof n)if(o(n))for(s=n.length;s>r;r++)i&&(i.index=r,i.first=0===r,i.last=r===n.length-1),e+=h(n[r],{data:i});else for(u in n)n.hasOwnProperty(u)&&(i&&(i.key=u,i.index=r,i.first=0===r),e+=h(n[u],{data:i}),r++);return 0===r&&(e=l(this)),e});n.registerHelper("if",function(n,t){return f(n)&&(n=n.call(this)),!t.hash.includeZero&&!n||r.isEmpty(n)?t.inverse(this):t.fn(this)});n.registerHelper("unless",function(t,i){return n.helpers["if"].call(this,t,{fn:i.inverse,inverse:i.fn,hash:i.hash})});n.registerHelper("with",function(n,t){return f(n)&&(n=n.call(this)),r.isEmpty(n)?void 0:t.fn(n)});n.registerHelper("log",function(t,i){var r=i.data&&null!=i.data.level?parseInt(i.data.level,10):1;n.log(r,t)})}function l(n,t){u.log(n,t)}var a,v,o,f,s,h,u,c,i={},r=n,y=t;return i.VERSION="1.3.0",a=4,i.COMPILER_REVISION=a,v={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"},i.REVISION_CHANGES=v,o=r.isArray,f=r.isFunction,s=r.toString,h="[object Object]",i.HandlebarsEnvironment=e,e.prototype={constructor:e,logger:u,log:l,registerHelper:function(n,t,i){if(s.call(n)===h){if(i||t)throw new y("Arg not supported with multiple helpers");r.extend(this.helpers,n)}else i&&(t.not=i),this.helpers[n]=t},registerPartial:function(n,t){s.call(n)===h?r.extend(this.partials,n):this.partials[n]=t}},u={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(n,t){if(u.level<=n){var i=u.methodMap[n];"undefined"!=typeof console&&console[i]&&console[i].call(console,t)}}},i.logger=u,i.log=l,c=function(n){var t={};return r.extend(t,n),t},i.createFrame=c,i}(n,t),u=function(n,t,i){"use strict";function s(n){var r,f,t=n&&n[0]||1,i=v;if(t!==i){if(i>t)throw r=o[i],f=o[t],new u("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+f+").");throw new u("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+n[1]+").");}}function h(n,t){if(!t)throw new u("No environment passed to template");var r=function(n,i,r,f,e,o){var s,h=t.VM.invokePartial.apply(this,arguments);if(null!=h)return h;if(t.compile)return s={helpers:f,partials:e,data:o},e[i]=t.compile(n,{data:void 0!==o},t),e[i](r,s);throw new u("The partial "+i+" could not be compiled when running in runtime-only mode");},i={escapeExpression:e.escapeExpression,invokePartial:r,programs:[],program:function(n,t,i){var r=this.programs[n];return i?r=f(n,t,i):r||(r=this.programs[n]=f(n,t)),r},merge:function(n,t){var i=n||t;return n&&t&&n!==t&&(i={},e.extend(i,t),e.extend(i,n)),i},programWithDepth:t.VM.programWithDepth,noop:t.VM.noop,compilerInfo:null};return function(r,u){var f,e,o,s;return u=u||{},o=u.partial?u:t,u.partial||(f=u.helpers,e=u.partials),s=n.call(i,o,r,f,e,u.data),u.partial||t.VM.checkRevision(i.compilerInfo),s}}function c(n,t,i){var u=Array.prototype.slice.call(arguments,3),r=function(n,r){return r=r||{},t.apply(this,[n,r.data||i].concat(u))};return r.program=n,r.depth=u.length,r}function f(n,t,i){var r=function(n,r){return r=r||{},t(n,r.data||i)};return r.program=n,r.depth=0,r}function l(n,t,i,r,f,e){var o={partial:!0,helpers:r,partials:f,data:e};if(void 0===n)throw new u("The partial "+t+" could not be found");if(n instanceof Function)return n(i,o)}function a(){return""}var r={},e=n,u=t,v=i.COMPILER_REVISION,o=i.REVISION_CHANGES;return r.checkRevision=s,r.template=h,r.programWithDepth=c,r.program=f,r.invokePartial=l,r.noop=a,r}(n,t,r);return function(n,t,i,r,u){"use strict";var c,f=n,l=t,a=i,e=r,o=u,s=function(){var n=new f.HandlebarsEnvironment;return e.extend(n,f),n.SafeString=l,n.Exception=a,n.Utils=e,n.VM=o,n.template=function(t){return o.template(t,n)},n},h=s();return h.create=s,c=h}(r,i,t,n,u)}();this.wysihtml5=this.wysihtml5||{};this.wysihtml5.tpl=this.wysihtml5.tpl||{};this.wysihtml5.tpl.blockquote=Handlebars.template(function(n,t,i,r,u){function s(n){var t,i="";return i+="btn-"+a((t=n&&n.options,t=null==t||t===!1?t:t.toolbar,t=null==t||t===!1?t:t.size,typeof t===l?t.apply(n):t)),i}function h(){return' \n      <span class="fa fa-quote-left"><\/span>\n    '}function c(){return'\n      <span class="glyphicon glyphicon-quote"><\/span>\n    '}this.compilerInfo=[4,">= 1.0.0"];i=this.merge(i,n.helpers);u=u||{};var f,e="",l="function",a=this.escapeExpression,o=this;return e+='<li>\n  <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:o.noop,fn:o.program(1,s,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="blockquote" data-wysihtml5-display-format-name="false" tabindex="-1">\n    ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.fa),{hash:{},inverse:o.program(5,c,u),fn:o.program(3,h,u),data:u}),(f||0===f)&&(e+=f),e+="\n  <\/a>\n<\/li>\n",e});this.wysihtml5.tpl.color=Handlebars.template(function(n,t,i,r,u){function c(n){var t,i="";return i+="btn-"+o((t=n&&n.options,t=null==t||t===!1?t:t.toolbar,t=null==t||t===!1?t:t.size,typeof t===e?t.apply(n):t)),i}this.compilerInfo=[4,">= 1.0.0"];i=this.merge(i,n.helpers);u=u||{};var f,s="",e="function",o=this.escapeExpression,h=this;return s+='<li class="dropdown">\n  <a class="btn btn-default dropdown-toggle ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:h.noop,fn:h.program(1,c,u),data:u}),(f||0===f)&&(s+=f),s+='" data-toggle="dropdown" tabindex="-1">\n    <span class="current-color">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.black,typeof f===e?f.apply(t):f))+'<\/span>\n    <b class="caret"><\/b>\n  <\/a>\n  <ul class="dropdown-menu">\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="black"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="black">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.black,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="silver"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="silver">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.silver,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="gray"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="gray">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.gray,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="maroon"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="maroon">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.maroon,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="red"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="red">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.red,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="purple"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="purple">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.purple,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="green"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="green">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.green,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="olive"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="olive">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.olive,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="navy"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="navy">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.navy,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="blue"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="blue">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.blue,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><div class="wysihtml5-colors" data-wysihtml5-command-value="orange"><\/div><a class="wysihtml5-colors-title" data-wysihtml5-command="foreColor" data-wysihtml5-command-value="orange">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.colours,f=null==f||f===!1?f:f.orange,typeof f===e?f.apply(t):f))+"<\/a><\/li>\n  <\/ul>\n<\/li>\n",s});this.wysihtml5.tpl.emphasis=Handlebars.template(function(n,t,i,r,u){function c(n){var t,i="";return i+="btn-"+h((t=n&&n.options,t=null==t||t===!1?t:t.toolbar,t=null==t||t===!1?t:t.size,typeof t===s?t.apply(n):t)),i}function l(n,t){var r,u="";return u+='\n    <a class="btn ',r=i["if"].call(n,(r=n&&n.options,r=null==r||r===!1?r:r.toolbar,null==r||r===!1?r:r.size),{hash:{},inverse:o.noop,fn:o.program(1,c,t),data:t}),(r||0===r)&&(u+=r),u+=' btn-default" data-wysihtml5-command="small" title="CTRL+S" tabindex="-1">'+h((r=n&&n.locale,r=null==r||r===!1?r:r.emphasis,r=null==r||r===!1?r:r.small,typeof r===s?r.apply(n):r))+"<\/a>\n    ",u}this.compilerInfo=[4,">= 1.0.0"];i=this.merge(i,n.helpers);u=u||{};var f,e="",s="function",h=this.escapeExpression,o=this;return e+='<li>\n  <div class="btn-group">\n    <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:o.noop,fn:o.program(1,c,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-command="bold" title="CTRL+B" tabindex="-1">'+h((f=t&&t.locale,f=null==f||f===!1?f:f.emphasis,f=null==f||f===!1?f:f.bold,typeof f===s?f.apply(t):f))+'<\/a>\n    <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:o.noop,fn:o.program(1,c,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-command="italic" title="CTRL+I" tabindex="-1">'+h((f=t&&t.locale,f=null==f||f===!1?f:f.emphasis,f=null==f||f===!1?f:f.italic,typeof f===s?f.apply(t):f))+'<\/a>\n    <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:o.noop,fn:o.program(1,c,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-command="underline" title="CTRL+U" tabindex="-1">'+h((f=t&&t.locale,f=null==f||f===!1?f:f.emphasis,f=null==f||f===!1?f:f.underline,typeof f===s?f.apply(t):f))+"<\/a>\n    ",f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,f=null==f||f===!1?f:f.emphasis,null==f||f===!1?f:f.small),{hash:{},inverse:o.noop,fn:o.program(3,l,u),data:u}),(f||0===f)&&(e+=f),e+="\n  <\/div>\n<\/li>\n",e});this.wysihtml5.tpl["font-styles"]=Handlebars.template(function(n,t,i,r,u){function c(n){var t,i="";return i+="btn-"+o((t=n&&n.options,t=null==t||t===!1?t:t.toolbar,t=null==t||t===!1?t:t.size,typeof t===e?t.apply(n):t)),i}function l(){return'\n      <span class="fa fa-font"><\/span>\n    '}function a(){return'\n      <span class="glyphicon glyphicon-font"><\/span>\n    '}this.compilerInfo=[4,">= 1.0.0"];i=this.merge(i,n.helpers);u=u||{};var f,s="",e="function",o=this.escapeExpression,h=this;return s+='<li class="dropdown">\n  <a class="btn btn-default dropdown-toggle ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:h.noop,fn:h.program(1,c,u),data:u}),(f||0===f)&&(s+=f),s+='" data-toggle="dropdown">\n    ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.fa),{hash:{},inverse:h.program(5,a,u),fn:h.program(3,l,u),data:u}),(f||0===f)&&(s+=f),s+='\n    <span class="current-font">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.font_styles,f=null==f||f===!1?f:f.normal,typeof f===e?f.apply(t):f))+'<\/span>\n    <b class="caret"><\/b>\n  <\/a>\n  <ul class="dropdown-menu">\n    <li><a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="p" tabindex="-1">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.font_styles,f=null==f||f===!1?f:f.normal,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h1" tabindex="-1">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.font_styles,f=null==f||f===!1?f:f.h1,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h2" tabindex="-1">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.font_styles,f=null==f||f===!1?f:f.h2,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h3" tabindex="-1">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.font_styles,f=null==f||f===!1?f:f.h3,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h4" tabindex="-1">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.font_styles,f=null==f||f===!1?f:f.h4,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h5" tabindex="-1">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.font_styles,f=null==f||f===!1?f:f.h5,typeof f===e?f.apply(t):f))+'<\/a><\/li>\n    <li><a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h6" tabindex="-1">'+o((f=t&&t.locale,f=null==f||f===!1?f:f.font_styles,f=null==f||f===!1?f:f.h6,typeof f===e?f.apply(t):f))+"<\/a><\/li>\n  <\/ul>\n<\/li>\n",s});this.wysihtml5.tpl.html=Handlebars.template(function(n,t,i,r,u){function c(n){var t,i="";return i+="btn-"+h((t=n&&n.options,t=null==t||t===!1?t:t.toolbar,t=null==t||t===!1?t:t.size,typeof t===s?t.apply(n):t)),i}function l(){return'\n        <span class="fa fa-pencil"><\/span>\n      '}function a(){return'\n        <span class="glyphicon glyphicon-pencil"><\/span>\n      '}this.compilerInfo=[4,">= 1.0.0"];i=this.merge(i,n.helpers);u=u||{};var f,e="",s="function",h=this.escapeExpression,o=this;return e+='<li>\n  <div class="btn-group">\n    <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:o.noop,fn:o.program(1,c,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-action="change_view" title="'+h((f=t&&t.locale,f=null==f||f===!1?f:f.html,f=null==f||f===!1?f:f.edit,typeof f===s?f.apply(t):f))+'" tabindex="-1">\n      ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.fa),{hash:{},inverse:o.program(5,a,u),fn:o.program(3,l,u),data:u}),(f||0===f)&&(e+=f),e+="\n    <\/a>\n  <\/div>\n<\/li>\n",e});this.wysihtml5.tpl.image=Handlebars.template(function(n,t,i,r,u){function c(){return"modal-sm"}function l(n){var t,i="";return i+="btn-"+h((t=n&&n.options,t=null==t||t===!1?t:t.toolbar,t=null==t||t===!1?t:t.size,typeof t===s?t.apply(n):t)),i}function a(){return'\n      <span class="fa fa-file-image-o"><\/span>\n    '}function v(){return'\n      <span class="glyphicon glyphicon-picture"><\/span>\n    '}this.compilerInfo=[4,">= 1.0.0"];i=this.merge(i,n.helpers);u=u||{};var f,e="",s="function",h=this.escapeExpression,o=this;return e+='<li>\n  <div class="bootstrap-wysihtml5-insert-image-modal modal fade" data-wysihtml5-dialog="insertImage">\n    <div class="modal-dialog ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.smallmodals),{hash:{},inverse:o.noop,fn:o.program(1,c,u),data:u}),(f||0===f)&&(e+=f),e+='">\n      <div class="modal-content">\n        <div class="modal-header">\n          <a class="close" data-dismiss="modal">&times;<\/a>\n          <h3>'+h((f=t&&t.locale,f=null==f||f===!1?f:f.image,f=null==f||f===!1?f:f.insert,typeof f===s?f.apply(t):f))+'<\/h3>\n        <\/div>\n        <div class="modal-body">\n          <div class="form-group">\n            <input value="http://" class="bootstrap-wysihtml5-insert-image-url form-control" data-wysihtml5-dialog-field="src">\n          <\/div> \n        <\/div>\n        <div class="modal-footer">\n          <a class="btn btn-default" data-dismiss="modal" data-wysihtml5-dialog-action="cancel" href="#">'+h((f=t&&t.locale,f=null==f||f===!1?f:f.image,f=null==f||f===!1?f:f.cancel,typeof f===s?f.apply(t):f))+'<\/a>\n          <a class="btn btn-primary" data-dismiss="modal"  data-wysihtml5-dialog-action="save" href="#">'+h((f=t&&t.locale,f=null==f||f===!1?f:f.image,f=null==f||f===!1?f:f.insert,typeof f===s?f.apply(t):f))+'<\/a>\n        <\/div>\n      <\/div>\n    <\/div>\n  <\/div>\n  <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:o.noop,fn:o.program(3,l,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-command="insertImage" title="'+h((f=t&&t.locale,f=null==f||f===!1?f:f.image,f=null==f||f===!1?f:f.insert,typeof f===s?f.apply(t):f))+'" tabindex="-1">\n    ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.fa),{hash:{},inverse:o.program(7,v,u),fn:o.program(5,a,u),data:u}),(f||0===f)&&(e+=f),e+="\n  <\/a>\n<\/li>\n",e});this.wysihtml5.tpl.link=Handlebars.template(function(n,t,i,r,u){function c(){return"modal-sm"}function l(n){var t,i="";return i+="btn-"+s((t=n&&n.options,t=null==t||t===!1?t:t.toolbar,t=null==t||t===!1?t:t.size,typeof t===o?t.apply(n):t)),i}function a(){return'\n      <span class="fa fa-share-square-o"><\/span>\n    '}function v(){return'\n      <span class="glyphicon glyphicon-share"><\/span>\n    '}this.compilerInfo=[4,">= 1.0.0"];i=this.merge(i,n.helpers);u=u||{};var f,e="",o="function",s=this.escapeExpression,h=this;return e+='<li>\n  <div class="bootstrap-wysihtml5-insert-link-modal modal fade" data-wysihtml5-dialog="createLink">\n    <div class="modal-dialog ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.smallmodals),{hash:{},inverse:h.noop,fn:h.program(1,c,u),data:u}),(f||0===f)&&(e+=f),e+='">\n      <div class="modal-content">\n        <div class="modal-header">\n          <a class="close" data-dismiss="modal">&times;<\/a>\n          <h3>'+s((f=t&&t.locale,f=null==f||f===!1?f:f.link,f=null==f||f===!1?f:f.insert,typeof f===o?f.apply(t):f))+'<\/h3>\n        <\/div>\n        <div class="modal-body">\n          <div class="form-group">\n            <input value="http://" class="bootstrap-wysihtml5-insert-link-url form-control" data-wysihtml5-dialog-field="href">\n          <\/div> \n          <div class="checkbox">\n            <label> \n              <input type="checkbox" class="bootstrap-wysihtml5-insert-link-target" checked>'+s((f=t&&t.locale,f=null==f||f===!1?f:f.link,f=null==f||f===!1?f:f.target,typeof f===o?f.apply(t):f))+'\n            <\/label>\n          <\/div>\n        <\/div>\n        <div class="modal-footer">\n          <a class="btn btn-default" data-dismiss="modal" data-wysihtml5-dialog-action="cancel" href="#">'+s((f=t&&t.locale,f=null==f||f===!1?f:f.link,f=null==f||f===!1?f:f.cancel,typeof f===o?f.apply(t):f))+'<\/a>\n          <a href="#" class="btn btn-primary" data-dismiss="modal" data-wysihtml5-dialog-action="save">'+s((f=t&&t.locale,f=null==f||f===!1?f:f.link,f=null==f||f===!1?f:f.insert,typeof f===o?f.apply(t):f))+'<\/a>\n        <\/div>\n      <\/div>\n    <\/div>\n  <\/div>\n  <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:h.noop,fn:h.program(3,l,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-command="createLink" title="'+s((f=t&&t.locale,f=null==f||f===!1?f:f.link,f=null==f||f===!1?f:f.insert,typeof f===o?f.apply(t):f))+'" tabindex="-1">\n    ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.fa),{hash:{},inverse:h.program(7,v,u),fn:h.program(5,a,u),data:u}),(f||0===f)&&(e+=f),e+="\n  <\/a>\n<\/li>\n",e});this.wysihtml5.tpl.lists=Handlebars.template(function(n,t,i,r,u){function c(n){var t,i="";return i+="btn-"+h((t=n&&n.options,t=null==t||t===!1?t:t.toolbar,t=null==t||t===!1?t:t.size,typeof t===s?t.apply(n):t)),i}function l(){return'\n      <span class="fa fa-list-ul"><\/span>\n    '}function a(){return'\n      <span class="glyphicon glyphicon-list"><\/span>\n    '}function v(){return'\n      <span class="fa fa-list-ol"><\/span>\n    '}function y(){return'\n      <span class="glyphicon glyphicon-th-list"><\/span>\n    '}function p(){return'\n      <span class="fa fa-outdent"><\/span>\n    '}function w(){return'\n      <span class="glyphicon glyphicon-indent-right"><\/span>\n    '}function b(){return'\n      <span class="fa fa-indent"><\/span>\n    '}function k(){return'\n      <span class="glyphicon glyphicon-indent-left"><\/span>\n    '}this.compilerInfo=[4,">= 1.0.0"];i=this.merge(i,n.helpers);u=u||{};var f,e="",s="function",h=this.escapeExpression,o=this;return e+='<li>\n  <div class="btn-group">\n    <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:o.noop,fn:o.program(1,c,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-command="insertUnorderedList" title="'+h((f=t&&t.locale,f=null==f||f===!1?f:f.lists,f=null==f||f===!1?f:f.unordered,typeof f===s?f.apply(t):f))+'" tabindex="-1">\n    ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.fa),{hash:{},inverse:o.program(5,a,u),fn:o.program(3,l,u),data:u}),(f||0===f)&&(e+=f),e+='\n    <\/a>\n    <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:o.noop,fn:o.program(1,c,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-command="insertOrderedList" title="'+h((f=t&&t.locale,f=null==f||f===!1?f:f.lists,f=null==f||f===!1?f:f.ordered,typeof f===s?f.apply(t):f))+'" tabindex="-1">\n    ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.fa),{hash:{},inverse:o.program(9,y,u),fn:o.program(7,v,u),data:u}),(f||0===f)&&(e+=f),e+='\n    <\/a>\n    <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:o.noop,fn:o.program(1,c,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-command="Outdent" title="'+h((f=t&&t.locale,f=null==f||f===!1?f:f.lists,f=null==f||f===!1?f:f.outdent,typeof f===s?f.apply(t):f))+'" tabindex="-1">\n    ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.fa),{hash:{},inverse:o.program(13,w,u),fn:o.program(11,p,u),data:u}),(f||0===f)&&(e+=f),e+='\n    <\/a>\n    <a class="btn ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.size),{hash:{},inverse:o.noop,fn:o.program(1,c,u),data:u}),(f||0===f)&&(e+=f),e+=' btn-default" data-wysihtml5-command="Indent" title="'+h((f=t&&t.locale,f=null==f||f===!1?f:f.lists,f=null==f||f===!1?f:f.indent,typeof f===s?f.apply(t):f))+'" tabindex="-1">\n    ',f=i["if"].call(t,(f=t&&t.options,f=null==f||f===!1?f:f.toolbar,null==f||f===!1?f:f.fa),{hash:{},inverse:o.program(17,k,u),fn:o.program(15,b,u),data:u}),(f||0===f)&&(e+=f),e+="\n    <\/a>\n  <\/div>\n<\/li>\n",e}),function(n){"use strict";"function"==typeof define&&define.amd?define("bootstrap.wysihtml5",["jquery","wysihtml5","bootstrap","bootstrap.wysihtml5.templates","bootstrap.wysihtml5.commands"],n):n(jQuery,wysihtml5)}(function(n,t){"use strict";var i=function(n,t){var i,f,r,e=function(n,i,r){if(t.tpl[n])return t.tpl[n]({locale:i,options:r})},u=function(i,r){var u,e;this.el=i;u=n.extend(!0,{},f,r);for(e in u.customTemplates)u.customTemplates.hasOwnProperty(e)&&(t.tpl[e]=u.customTemplates[e]);this.toolbar=this.createToolbar(i,u);this.editor=this.createEditor(u)};u.prototype={constructor:u,createEditor:function(t){t=t||{};t=n.extend(!0,{},t);t.toolbar=this.toolbar[0];this.initializeEditor(this.el[0],t)},initializeEditor:function(n,i){var u,r=new t.Editor(this.el[0],i);if(r.on("beforeload",this.syncBootstrapDialogEvents),r.on("beforeload",this.loadParserRules),r.composer.editableArea.contentDocument?this.addMoreShortcuts(r,r.composer.editableArea.contentDocument.body||r.composer.editableArea.contentDocument,i.shortcuts):this.addMoreShortcuts(r,r.composer.editableArea,i.shortcuts),i&&i.events)for(u in i.events)i.events.hasOwnProperty(u)&&r.on(u,i.events[u]);return r},loadParserRules:function(){"string"===n.type(this.config.parserRules)&&n.ajax({dataType:"json",url:this.config.parserRules,context:this,error:function(){void 0},success:function(n){this.config.parserRules=n;void 0}});this.config.pasteParserRulesets&&"string"===n.type(this.config.pasteParserRulesets)&&n.ajax({dataType:"json",url:this.config.pasteParserRulesets,context:this,error:function(){void 0},success:function(n){this.config.pasteParserRulesets=n}})},syncBootstrapDialogEvents:function(){var t=this;n.map(this.toolbar.commandMapping,function(n){return[n]}).filter(function(n){return n.dialog}).map(function(n){return n.dialog}).forEach(function(i){i.on("show",function(){n(this.container).modal("show")});i.on("hide",function(){n(this.container).modal("hide");setTimeout(t.composer.focus,0)});n(i.container).on("shown.bs.modal",function(){n(this).find("input, select, textarea").first().focus()})});this.on("change_view",function(){n(this.toolbar.container.children).find("a.btn").not('[data-wysihtml5-action="change_view"]').toggleClass("disabled")})},createToolbar:function(t,i){var h,o,c=this,u=n("<ul/>",{"class":"wysihtml5-toolbar",style:"display:none"}),s=i.locale||f.locale||"en";r.hasOwnProperty(s)||(void 0,s="en");h=n.extend(!0,{},r.en,r[s]);for(o in i.toolbar)i.toolbar[o]&&u.append(e(o,h,i));return u.find('a[data-wysihtml5-command="formatBlock"]').click(function(t){var u=t.delegateTarget||t.target||t.srcElement,i=n(u),r=i.data("wysihtml5-display-format-name"),f=i.data("wysihtml5-format-name")||i.html();(void 0===r||"true"===r)&&c.toolbar.find(".current-font").text(f)}),u.find('a[data-wysihtml5-command="foreColor"]').click(function(t){var i=t.target||t.srcElement,r=n(i);c.toolbar.find(".current-color").text(r.html())}),this.el.before(u),u},addMoreShortcuts:function(n,i,r){t.dom.observe(i,"keydown",function(i){var u,e=i.keyCode,f=r[e];(i.ctrlKey||i.metaKey||i.altKey)&&f&&t.commands[f]&&(u=n.toolbar.commandMapping[f+":null"],u&&u.dialog&&!u.state?u.dialog.show():t.commands[f].exec(n.composer,f),i.preventDefault())})}};i={resetDefaults:function(){n.fn.wysihtml5.defaultOptions=n.extend(!0,{},n.fn.wysihtml5.defaultOptionsCache)},bypassDefaults:function(t){return this.each(function(){var i=n(this);i.data("wysihtml5",new u(i,t))})},shallowExtend:function(t){var r=n.extend({},n.fn.wysihtml5.defaultOptions,t||{},n(this).data()),u=this;return i.bypassDefaults.apply(u,[r])},deepExtend:function(t){var r=n.extend(!0,{},n.fn.wysihtml5.defaultOptions,t||{}),u=this;return i.bypassDefaults.apply(u,[r])},init:function(n){var t=this;return i.shallowExtend.apply(t,[n])}};n.fn.wysihtml5=function(t){return i[t]?i[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?(n.error("Method "+t+" does not exist on jQuery.wysihtml5"),void 0):i.init.apply(this,arguments)};n.fn.wysihtml5.Constructor=u;f=n.fn.wysihtml5.defaultOptions={toolbar:{"font-styles":!0,color:!1,emphasis:{small:!0},blockquote:!0,lists:!0,html:!1,link:!0,image:!0,smallmodals:!1},useLineBreaks:!1,parserRules:{classes:{"wysiwyg-color-silver":1,"wysiwyg-color-gray":1,"wysiwyg-color-white":1,"wysiwyg-color-maroon":1,"wysiwyg-color-red":1,"wysiwyg-color-purple":1,"wysiwyg-color-fuchsia":1,"wysiwyg-color-green":1,"wysiwyg-color-lime":1,"wysiwyg-color-olive":1,"wysiwyg-color-yellow":1,"wysiwyg-color-navy":1,"wysiwyg-color-blue":1,"wysiwyg-color-teal":1,"wysiwyg-color-aqua":1,"wysiwyg-color-orange":1},tags:{b:{},i:{},strong:{},em:{},p:{},br:{},ol:{},ul:{},li:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},blockquote:{},u:1,img:{check_attributes:{width:"numbers",alt:"alt",src:"url",height:"numbers"}},a:{check_attributes:{href:"url"},set_attributes:{target:"_blank",rel:"nofollow"}},span:1,div:1,small:1,code:1,pre:1}},locale:"en",shortcuts:{83:"small",75:"createLink"}};void 0===n.fn.wysihtml5.defaultOptionsCache&&(n.fn.wysihtml5.defaultOptionsCache=n.extend(!0,{},n.fn.wysihtml5.defaultOptions));r=n.fn.wysihtml5.locale={}};i(n,t)}),function(n){n.commands.small={exec:function(t,i){return n.commands.formatInline.exec(t,i,"small")},state:function(t,i){return n.commands.formatInline.state(t,i,"small")}}}(wysihtml5),function(n){"function"==typeof define&&define.amd?define("bootstrap.wysihtml5.en-US",["jquery","bootstrap.wysihtml5"],n):n(jQuery)}(function(n){n.fn.wysihtml5.locale.en=n.fn.wysihtml5.locale["en-US"]={font_styles:{normal:"Normal text",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6"},emphasis:{bold:"Bold",italic:"Italic",underline:"Underline",small:"Small"},lists:{unordered:"Unordered list",ordered:"Ordered list",outdent:"Outdent",indent:"Indent"},link:{insert:"Insert link",cancel:"Cancel",target:"Open link in new window"},image:{insert:"Insert image",cancel:"Cancel"},html:{edit:"Edit HTML"},colours:{black:"Black",silver:"Silver",gray:"Grey",maroon:"Maroon",red:"Red",purple:"Purple",green:"Green",olive:"Olive",navy:"Navy",blue:"Blue",orange:"Orange"}}})