Файл: library/wysihtml5/dist/wysihtml5-0.2.0.min.js
Строк: 5837
<?php
/*
wysihtml5 v0.2.0
https://github.com/xing/wysihtml5
Author: Christopher Blum (https://github.com/tiff)
Copyright (C) 2011 XING AG
Licensed under GNU General Public License
Rangy, a cross-browser JavaScript range and selection library
http://code.google.com/p/rangy/
Copyright 2011, Tim Down
Licensed under the MIT license.
Version: 1.1
Build date: 12 March 2011
*/
var wysihtml5={version:"0.2.0",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"ufeff",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,DELETE_KEY:46},rangy=function(){function a(a,b){var c=typeof a[b];return c==k||!!(c==i&&a[b])||"unknown"==c}function c(a,b){return!!(typeof a[b]==i&&a[b])}function b(a,b){return typeof a[b]!=j}function d(a){return function(b,c){for(var g=c.length;g--;)if(!a(b,c[g]))return!1;
return!0}}function e(a){window.alert("Rangy not supported in your browser. Reason: "+a);r.initialized=!0;r.supported=!1}function f(){if(!r.initialized){var b,d=!1,j=!1;a(document,"createRange")&&(b=document.createRange(),t(b,l)&&w(b,g)&&(d=!0),b.detach());if((b=c(document,"body")?document.body:document.getElementsByTagName("body")[0])&&a(b,"createTextRange"))b=b.createTextRange(),t(b,q)&&w(b,n)&&(j=!0);!d&&!j&&e("Neither Range nor TextRange are implemented");r.initialized=!0;r.features={implementsDomRange:d,
implementsTextRange:j};d=x.concat(s);j=0;for(b=d.length;j<b;++j)try{d[j](r)}catch(f){c(window,"console")&&a(window.console,"log")&&console.log("Init listener threw an exception. Continuing.",f)}}}function h(a){this.name=a;this.supported=this.initialized=!1}var i="object",k="function",j="undefined",g="startContainer,startOffset,endContainer,endOffset,collapsed,commonAncestorContainer,START_TO_START,START_TO_END,END_TO_START,END_TO_END".split(","),l="setStart,setStartBefore,setStartAfter,setEnd,setEndBefore,setEndAfter,collapse,selectNode,selectNodeContents,compareBoundaryPoints,deleteContents,extractContents,cloneContents,insertNode,surroundContents,cloneRange,toString,detach".split(","),
n="boundingHeight,boundingLeft,boundingTop,boundingWidth,htmlText,text".split(","),q="collapse,compareEndPoints,duplicate,getBookmark,moveToBookmark,moveToElementText,parentElement,pasteHTML,select,setEndPoint".split(","),t=d(a),o=d(c),w=d(b),r={initialized:!1,supported:!0,util:{isHostMethod:a,isHostObject:c,isHostProperty:b,areHostMethods:t,areHostObjects:o,areHostProperties:w},features:{},modules:{},config:{alertOnWarn:!1}};r.fail=e;r.warn=function(a){a="Rangy warning: "+a;r.config.alertOnWarn?
window.alert(a):typeof window.console!=j&&typeof window.console.log!=j&&window.console.log(a)};r.init=f;var s=[],x=[];r.addInitListener=function(a){r.initialized?a(r):s.push(a)};var p=[];r.addCreateMissingNativeApiListener=function(a){p.push(a)};r.createMissingNativeApi=function(a){a=a||window;f();for(var b=0,c=p.length;b<c;++b)p[b](a)};h.prototype.fail=function(a){this.initialized=!0;this.supported=!1;throw Error("Module '"+this.name+"' failed to load: "+a);};h.prototype.createError=function(a){return Error("Error in Rangy "+
this.name+" module: "+a)};r.createModule=function(a,b){var c=new h(a);r.modules[a]=c;x.push(function(a){b(a,c);c.initialized=!0;c.supported=!0})};r.requireModules=function(a){for(var b=0,c=a.length,g,d;b<c;++b){d=a[b];g=r.modules[d];if(!g||!(g instanceof h))throw Error("Module '"+d+"' not found");if(!g.supported)throw Error("Module '"+d+"' not supported");}};var v=!1,o=function(){v||(v=!0,r.initialized||f())};if(typeof window==j)e("No window found");else if(typeof document==j)e("No document found");
else return a(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",o,!1),a(window,"addEventListener")?window.addEventListener("load",o,!1):a(window,"attachEvent")?window.attachEvent("onload",o):e("Window does not have required addEventListener or attachEvent method"),r}();
rangy.createModule("DomUtil",function(a,c){function b(a){for(var b=0;a=a.previousSibling;)b++;return b}function d(a,b){var c=[],g;for(g=a;g;g=g.parentNode)c.push(g);for(g=b;g;g=g.parentNode)if(o(c,g))return g;return null}function e(a,b,c){for(c=c?a:a.parentNode;c;){a=c.parentNode;if(a===b)return c;c=a}return null}function f(a){a=a.nodeType;return 3==a||4==a||8==a}function h(a,b){var c=b.nextSibling,g=b.parentNode;c?g.insertBefore(a,c):g.appendChild(a);return a}function i(a){if(9==a.nodeType)return a;
if(typeof a.ownerDocument!=n)return a.ownerDocument;if(typeof a.document!=n)return a.document;if(a.parentNode)return i(a.parentNode);throw Error("getDocument: no document found for node");}function k(a){return!a?"[No node]":f(a)?'"'+a.data+'"':1==a.nodeType?"<"+a.nodeName+(a.id?' id="'+a.id+'"':"")+">["+a.childNodes.length+"]":a.nodeName}function j(a){this._next=this.root=a}function g(a,b){this.node=a;this.offset=b}function l(a){this.code=this[a];this.codeName=a;this.message="DOMException: "+this.codeName}
var n="undefined",q=a.util;q.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||c.fail("document missing a Node creation method");q.isHostMethod(document,"getElementsByTagName")||c.fail("document missing getElementsByTagName method");var t=document.createElement("div");q.areHostMethods(t,["insertBefore","appendChild","cloneNode"])||c.fail("Incomplete Element implementation");t=document.createTextNode("test");q.areHostMethods(t,["splitText","deleteData","insertData",
"appendData","cloneNode"])||c.fail("Incomplete Text Node implementation");var o=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1};j.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next,b;if(this._current){b=a.firstChild;if(!b)for(b=null;a!==this.root&&!(b=a.nextSibling);)a=a.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}};g.prototype={equals:function(a){return this.node===
a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+k(this.node)+":"+this.offset+")]"}};l.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};l.prototype.toString=function(){return this.message};a.dom={arrayContains:o,getNodeIndex:b,getCommonAncestor:d,isAncestorOf:function(a,b,c){for(b=c?b:b.parentNode;b;){if(b===a)return!0;b=b.parentNode}return!1},getClosestAncestorIn:e,
isCharacterDataNode:f,insertAfter:h,splitDataNode:function(a,b){var c;3==a.nodeType?c=a.splitText(b):(c=a.cloneNode(),c.deleteData(0,b),a.deleteData(0,a.length-b),h(c,a));return c},getDocument:i,getWindow:function(a){a=i(a);if(typeof a.defaultView!=n)return a.defaultView;if(typeof a.parentWindow!=n)return a.parentWindow;throw Error("Cannot get a window object for node");},getIframeWindow:function(a){if(typeof a.contentWindow!=n)return a.contentWindow;if(typeof a.contentDocument!=n)return a.contentDocument.defaultView;
throw Error("getIframeWindow: No Window object found for iframe element");},getIframeDocument:function(a){if(typeof a.contentDocument!=n)return a.contentDocument;if(typeof a.contentWindow!=n)return a.contentWindow.document;throw Error("getIframeWindow: No Document object found for iframe element");},getBody:function(a){return q.isHostObject(a,"body")?a.body:a.getElementsByTagName("body")[0]},comparePoints:function(a,c,g,j){var f;if(a==g)return c===j?0:c<j?-1:1;if(f=e(g,a,!0))return c<=b(f)?-1:1;if(f=
e(a,g,!0))return b(f)<j?-1:1;c=d(a,g);a=a===c?c:e(a,c,!0);g=g===c?c:e(g,c,!0);if(a===g)throw Error("comparePoints got to case 4 and childA and childB are the same!");for(c=c.firstChild;c;){if(c===a)return-1;if(c===g)return 1;c=c.nextSibling}throw Error("Should not be here!");},inspectNode:k,createIterator:function(a){return new j(a)},DomPosition:g};a.DOMException=l});
rangy.createModule("DomRange",function(a){function c(a,b){this.range=a;this.clonePartiallySelectedTextNodes=b;if(!a.collapsed){this.sc=a.startContainer;this.so=a.startOffset;this.ec=a.endContainer;this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&m.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc===c&&!m.isCharacterDataNode(this.sc)?this.sc.childNodes[this.so]:m.getClosestAncestorIn(this.sc,
c,!0),this._last=this.ec===c&&!m.isCharacterDataNode(this.ec)?this.ec.childNodes[this.eo-1]:m.getClosestAncestorIn(this.ec,c,!0))}}function b(a){this.code=this[a];this.codeName=a;this.message="RangeException: "+this.codeName}function d(a){return m.getDocument(a.startContainer)}function e(a,b,c){if(b=a._listeners[b])for(var g=0,d=b.length;g<d;++g)b[g].call(a,{target:a,args:c})}function f(a){return new K(a.parentNode,m.getNodeIndex(a))}function h(a){return new K(a.parentNode,m.getNodeIndex(a)+1)}function i(a){return m.isCharacterDataNode(a)?
a.length:a.childNodes?a.childNodes.length:0}function k(a,b,c){var g=11==a.nodeType?a.firstChild:a;m.isCharacterDataNode(b)?c==b.length?m.insertAfter(a,b):b.parentNode.insertBefore(a,0==c?b:m.splitDataNode(b,c)):c>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]);return g}function j(a){for(var b,c,g=d(a.range).createDocumentFragment();c=a.next();){b=a.isPartiallySelectedSubtree();c=c.cloneNode(!b);b&&(b=a.getSubtreeIterator(),c.appendChild(j(b)),b.detach(!0));if(10==c.nodeType)throw new D("HIERARCHY_REQUEST_ERR");
g.appendChild(c)}return g}function g(a,b,c){for(var d,j,c=c||{stop:!1};d=a.next();)if(a.isPartiallySelectedSubtree())if(!1===b(d)){c.stop=!0;break}else{if(d=a.getSubtreeIterator(),g(d,b,c),d.detach(!0),c.stop)break}else for(d=m.createIterator(d);j=d.next();)if(!1===b(j)){c.stop=!0;return}}function l(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),l(b),b.detach(!0)):a.remove()}function n(a){for(var b,c=d(a.range).createDocumentFragment(),g;b=a.next();){a.isPartiallySelectedSubtree()?
(b=b.cloneNode(!1),g=a.getSubtreeIterator(),b.appendChild(n(g)),g.detach(!0)):a.remove();if(10==b.nodeType)throw new D("HIERARCHY_REQUEST_ERR");c.appendChild(b)}return c}function q(a,b,d){var j=!(!b||!b.length),f,h=!!d;j&&(f=RegExp("^("+b.join("|")+")$"));var e=[];g(new c(a,!1),function(a){(!j||f.test(a.nodeType))&&(!h||d(a))&&e.push(a)});return e}function t(a){return"["+("undefined"==typeof a.getName?"Range":a.getName())+"("+m.inspectNode(a.startContainer)+":"+a.startOffset+", "+m.inspectNode(a.endContainer)+
":"+a.endOffset+")]"}function o(a,b,c){this.nodes=q(a,b,c);this._next=this.nodes[0];this._pointer=0}function w(a,b){return 3!=a.nodeType&&(m.isAncestorOf(a,b.startContainer,!0)||m.isAncestorOf(a,b.endContainer,!0))}function r(a){return function(b,c){for(var g,d=c?b:b.parentNode;d;){g=d.nodeType;if(m.arrayContains(a,g))return d;d=d.parentNode}return null}}function s(a){for(var b;b=a.parentNode;)a=b;return a}function x(a,c){if(U(a,c))throw new b("INVALID_NODE_TYPE_ERR");}function p(a){if(!a.startContainer)throw new D("INVALID_STATE_ERR");
}function v(a,c){if(!m.arrayContains(c,a.nodeType))throw new b("INVALID_NODE_TYPE_ERR");}function B(a,b){if(0>b||b>(m.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new D("INDEX_SIZE_ERR");}function A(a,b){if(I(a,!0)!==I(b,!0))throw new D("WRONG_DOCUMENT_ERR");}function F(a){if(V(a,!0))throw new D("NO_MODIFICATION_ALLOWED_ERR");}function H(a,b){if(!a)throw new D(b);}function y(a){if(!I(a.startContainer,!0)||!I(a.endContainer,!0)||!(a.startOffset<=(m.isCharacterDataNode(a.startContainer)?
a.startContainer.length:a.startContainer.childNodes.length))||!(a.endOffset<=(m.isCharacterDataNode(a.endContainer)?a.endContainer.length:a.endContainer.childNodes.length)))throw Error("Range Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")");}function G(a){a.START_TO_START=L;a.START_TO_END=O;a.END_TO_END=W;a.END_TO_START=P;a.NODE_BEFORE=Q;a.NODE_AFTER=R;a.NODE_BEFORE_AND_AFTER=S;a.NODE_INSIDE=M}function u(a){G(a);G(a.prototype)}function E(a,e,K){function r(a,b){return function(c){p(this);
v(c,T);v(s(c),X);c=(a?f:h)(c);(b?I:C)(this,c.node,c.offset)}}function I(a,b,c){var g=a.endContainer,d=a.endOffset;if(b!==a.startContainer||c!==this.startOffset){if(s(b)!=s(g)||1==m.comparePoints(b,c,g,d))g=b,d=c;e(a,b,c,g,d)}}function C(a,b,c){var g=a.startContainer,d=a.startOffset;if(b!==a.endContainer||c!==this.endOffset){if(s(b)!=s(g)||-1==m.comparePoints(b,c,g,d))g=b,d=c;e(a,g,d,b,c)}}function G(a,b,c){(b!==a.startContainer||c!==this.startOffset||b!==a.endContainer||c!==this.endOffset)&&e(a,b,
c,b,c)}function E(a){return function(){p(this);y(this);var b=this.startContainer,d=this.startOffset,j=this.commonAncestorContainer,f=new c(this,!0);if(b!==j)b=m.getClosestAncestorIn(b,j,!0),d=h(b),b=d.node,d=d.offset;g(f,F);f.reset();j=a(f);f.detach();e(this,b,d,b,d);return j}}a.prototype={attachListener:function(a,b){this._listeners[a].push(b)},setStart:function(a,b){p(this);x(a,!0);B(a,b);I(this,a,b)},setEnd:function(a,b){p(this);x(a,!0);B(a,b);C(this,a,b)},setStartBefore:r(!0,!0),setStartAfter:r(!1,
!0),setEndBefore:r(!0,!1),setEndAfter:r(!1,!1),collapse:function(a){p(this);y(this);a?e(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):e(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){p(this);x(a,!0);e(this,a,0,a,i(a))},selectNode:function(a){p(this);x(a,!1);v(a,T);var b=f(a),a=h(a);e(this,b.node,b.offset,a.node,a.offset)},compareBoundaryPoints:function(a,b){p(this);y(this);A(this.startContainer,b.startContainer);
var c=a==P||a==L?"start":"end",g=a==O||a==L?"start":"end";return m.comparePoints(this[c+"Container"],this[c+"Offset"],b[g+"Container"],b[g+"Offset"])},insertNode:function(a){p(this);y(this);v(a,Y);F(this.startContainer);if(m.isAncestorOf(a,this.startContainer,!0))throw new D("HIERARCHY_REQUEST_ERR");this.setStartBefore(k(a,this.startContainer,this.startOffset))},cloneContents:function(){p(this);y(this);var a,b;if(this.collapsed)return d(this).createDocumentFragment();if(this.startContainer===this.endContainer&&
m.isCharacterDataNode(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=d(this).createDocumentFragment(),b.appendChild(a),b;b=new c(this,!0);a=j(b);b.detach();return a},extractContents:E(n),deleteContents:E(l),canSurroundContents:function(){p(this);y(this);F(this.startContainer);F(this.endContainer);var a=new c(this,!0),b=a._first&&w(a._first,this)||a._last&&w(a._last,this);a.detach();return!b},surroundContents:function(a){v(a,Z);
if(!this.canSurroundContents())throw new b("BAD_BOUNDARYPOINTS_ERR");var c=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);k(a,this.startContainer,this.startOffset);a.appendChild(c);this.selectNode(a)},cloneRange:function(){p(this);y(this);for(var a=new z(d(this)),b=N.length,c;b--;)c=N[b],a[c]=this[c];return a},detach:function(){K(this)},toString:function(){p(this);y(this);var a=this.startContainer;if(a===this.endContainer&&m.isCharacterDataNode(a))return 3==
a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],a=new c(this,!0);g(a,function(a){(3==a.nodeType||4==a.nodeType)&&b.push(a.data)});a.detach();return b.join("")},compareNode:function(a){p(this);y(this);var b=a.parentNode,c=m.getNodeIndex(a);if(!b)throw new D("NOT_FOUND_ERR");a=this.comparePoint(b,c);b=this.comparePoint(b,c+1);return 0>a?0<b?S:Q:0<b?R:M},comparePoint:function(a,b){p(this);y(this);H(a,"HIERARCHY_REQUEST_ERR");A(a,this.startContainer);return 0>m.comparePoints(a,
b,this.startContainer,this.startOffset)?-1:0<m.comparePoints(a,b,this.endContainer,this.endOffset)?1:0},createContextualFragment:function(a){p(this);var b=d(this),c=b.createElement("div");c.innerHTML=a;for(a=b.createDocumentFragment();b=c.firstChild;)a.appendChild(b);return a},intersectsNode:function(a,b){p(this);y(this);H(a,"NOT_FOUND_ERR");if(m.getDocument(a)!==d(this))return!1;var c=a.parentNode,g=m.getNodeIndex(a);H(c,"NOT_FOUND_ERR");var j=m.comparePoints(c,g,this.endContainer,this.endOffset),
c=m.comparePoints(c,g+1,this.startContainer,this.startOffset);return b?0>=j&&0<=c:0>j&&0<c},isPointInRange:function(a,b){p(this);y(this);H(a,"HIERARCHY_REQUEST_ERR");A(a,this.startContainer);return 0<=m.comparePoints(a,b,this.startContainer,this.startOffset)&&0>=m.comparePoints(a,b,this.endContainer,this.endOffset)},intersectsRange:function(a){p(this);y(this);if(d(a)!=d(this))throw new D("WRONG_DOCUMENT_ERR");return 0>m.comparePoints(this.startContainer,this.startOffset,a.endContainer,a.endOffset)&&
0<m.comparePoints(this.endContainer,this.endOffset,a.startContainer,a.startOffset)},intersection:function(a){if(this.intersectsRange(a)){var b=m.comparePoints(this.startContainer,this.startOffset,a.startContainer,a.startOffset),c=m.comparePoints(this.endContainer,this.endOffset,a.endContainer,a.endOffset),g=this.cloneRange();-1==b&&g.setStart(a.startContainer,a.startOffset);1==c&&g.setEnd(a.endContainer,a.endOffset);return g}return null},containsNode:function(a,b){return b?this.intersectsNode(a,!1):
this.compareNode(a)==M},containsNodeContents:function(a){return 0<=this.comparePoint(a,0)&&0>=this.comparePoint(a,i(a))},splitBoundaries:function(){p(this);y(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,g=this.endOffset,d=a===c;m.isCharacterDataNode(c)&&g<c.length&&m.splitDataNode(c,g);m.isCharacterDataNode(a)&&0<b&&(a=m.splitDataNode(a,b),d&&(g-=b,c=a),b=0);e(this,a,b,c,g)},normalizeBoundaries:function(){p(this);y(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,
g=this.endOffset,d=function(a){var b=a.nextSibling;if(b&&b.nodeType==a.nodeType)c=a,g=a.length,a.appendData(b.data),b.parentNode.removeChild(b)},j=function(d){var j=d.previousSibling;if(j&&j.nodeType==d.nodeType)a=d,b=j.length,d.insertData(0,j.data),j.parentNode.removeChild(j),a==c&&(g+=b,c=a)},f=!0;m.isCharacterDataNode(c)?c.length==g&&d(c):(0<g&&(f=c.childNodes[g-1])&&m.isCharacterDataNode(f)&&d(f),f=!this.collapsed);f?m.isCharacterDataNode(a)?0==b&&j(a):b<a.childNodes.length&&(d=a.childNodes[b])&&
m.isCharacterDataNode(d)&&j(d):(a=c,b=g);e(this,a,b,c,g)},createNodeIterator:function(a,b){p(this);y(this);return new o(this,a,b)},getNodes:function(a,b){p(this);y(this);return q(this,a,b)},collapseToPoint:function(a,b){p(this);y(this);x(a,!0);B(a,b);G(this,a,b)},collapseBefore:function(a){p(this);this.setEndBefore(a);this.collapse(!1)},collapseAfter:function(a){p(this);this.setStartAfter(a);this.collapse(!0)},getName:function(){return"DomRange"},equals:function(a){return z.rangesEqual(this,a)},inspect:function(){return t(this)}};
u(a)}function J(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset;a.commonAncestorContainer=a.collapsed?a.startContainer:m.getCommonAncestor(a.startContainer,a.endContainer)}function C(a,b,c,g,d){var j=a.startContainer!==b||a.startOffset!==c,f=a.endContainer!==g||a.endOffset!==d;a.startContainer=b;a.startOffset=c;a.endContainer=g;a.endOffset=d;J(a);e(a,"boundarychange",{startMoved:j,endMoved:f})}function z(a){this.startContainer=a;this.startOffset=0;this.endContainer=a;
this.endOffset=0;this._listeners={boundarychange:[],detach:[]};J(this)}a.requireModules(["DomUtil"]);var m=a.dom,K=m.DomPosition,D=a.DOMException;c.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 a=this._current=this._next;if(a)this._next=a!==this._last?a.nextSibling:null,m.isCharacterDataNode(a)&&this.clonePartiallySelectedTextNodes&&(a===
this.ec&&(a=a.cloneNode(!0)).deleteData(this.eo,a.length-this.eo),this._current===this.sc&&(a=a.cloneNode(!0)).deleteData(0,this.so));return a},remove:function(){var a=this._current,b,c;m.isCharacterDataNode(a)&&(a===this.sc||a===this.ec)?(b=a===this.sc?this.so:0,c=a===this.ec?this.eo:a.length,b!=c&&a.deleteData(b,c-b)):a.parentNode&&a.parentNode.removeChild(a)},isPartiallySelectedSubtree:function(){return w(this._current,this.range)},getSubtreeIterator:function(){var a;if(this.isSingleCharacterDataNode)a=
this.range.cloneRange(),a.collapse();else{a=new z(d(this.range));var b=this._current,g=b,j=0,f=b,e=i(b);if(m.isAncestorOf(b,this.sc,!0))g=this.sc,j=this.so;if(m.isAncestorOf(b,this.ec,!0))f=this.ec,e=this.eo;C(a,g,j,f,e)}return new c(a,this.clonePartiallySelectedTextNodes)},detach:function(a){a&&this.range.detach();this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};b.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2};b.prototype.toString=function(){return this.message};
o.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){this._current=this._next;this._next=this.nodes[++this._pointer];return this._current},detach:function(){this._current=this._next=this.nodes=null}};var T=[1,3,4,5,7,8,10],X=[2,9,11],Y=[1,3,4,5,7,8,10,11],Z=[1,3,4,5,7,8],I=r([9,11]),V=r([5,6,10,12]),U=r([6,10,12]),N="startContainer,startOffset,endContainer,endOffset,collapsed,commonAncestorContainer".split(","),L=0,O=1,W=2,P=3,Q=0,R=1,S=2,M=3;E(z,C,function(a){p(a);a.startContainer=
a.startOffset=a.endContainer=a.endOffset=null;a.collapsed=a.commonAncestorContainer=null;e(a,"detach",null);a._listeners=null});z.fromRange=function(a){var b=new z(d(a));C(b,a.startContainer,a.startOffset,a.endContainer,a.endOffset);return b};z.rangeProperties=N;z.RangeIterator=c;z.copyComparisonConstants=u;z.createPrototypeRange=E;z.inspect=t;z.getRangeDocument=d;z.rangesEqual=function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&
a.endOffset===b.endOffset};z.getEndOffset=i;a.DomRange=z;a.RangeException=b});
rangy.createModule("WrappedRange",function(a){function c(a,b,c,d){var h=a.duplicate();h.collapse(c);var i=h.parentElement();e.isAncestorOf(b,i,!0)||(i=b);if(!i.canHaveHTML)return new f(i.parentNode,e.getNodeIndex(i));var b=e.getDocument(i).createElement("span"),t,o=c?"StartToStart":"StartToEnd";do i.insertBefore(b,b.previousSibling),h.moveToElementText(b);while(0<(t=h.compareEndPoints(o,a))&&b.previousSibling);o=b.nextSibling;if(-1==t&&o&&e.isCharacterDataNode(o)){h.setEndPoint(c?"EndToStart":"EndToEnd",
a);if(/[rn]/.test(o.data)){i=h.duplicate();c=i.text.replace(/rn/g,"r").length;for(c=i.moveStart("character",c);-1==i.compareEndPoints("StartToEnd",i);)c++,i.moveStart("character",1)}else c=h.text.length;i=new f(o,c)}else o=(d||!c)&&b.previousSibling,i=(c=(d||c)&&b.nextSibling)&&e.isCharacterDataNode(c)?new f(c,0):o&&e.isCharacterDataNode(o)?new f(o,o.length):new f(i,e.getNodeIndex(b));b.parentNode.removeChild(b);return i}function b(a,b){var c,d,f=a.offset,h=e.getDocument(a.node),i=h.body.createTextRange(),
o=e.isCharacterDataNode(a.node);o?(c=a.node,d=c.parentNode):(c=a.node.childNodes,c=f<c.length?c[f]:null,d=a.node);h=h.createElement("span");h.innerHTML="&#feff;";c?d.insertBefore(h,c):d.appendChild(h);i.moveToElementText(h);i.collapse(!b);d.removeChild(h);if(o)i[b?"moveStart":"moveEnd"]("character",f);return i}a.requireModules(["DomUtil","DomRange"]);var d,e=a.dom,f=e.DomPosition,h=a.DomRange;if(a.features.implementsDomRange)(function(){function a(b){for(var d=c.length,f;d--;)f=c[d],b[f]=b.nativeRange[f]}
var b,c=h.rangeProperties,f;d=function(b){if(!b)throw Error("Range must be specified");this.nativeRange=b;a(this)};h.createPrototypeRange(d,function(a,b,c,g,d){var f=a.startContainer!==b||a.startOffset!=c;(a.endContainer!==g||a.endOffset!=d)&&a.setEnd(g,d);f&&a.setStart(b,c)},function(a){a.nativeRange.detach();a.detached=!0;for(var b=c.length,d;b--;)d=c[b],a[d]=null});b=d.prototype;b.selectNode=function(b){this.nativeRange.selectNode(b);a(this)};b.deleteContents=function(){this.nativeRange.deleteContents();
a(this)};b.extractContents=function(){var b=this.nativeRange.extractContents();a(this);return b};b.cloneContents=function(){return this.nativeRange.cloneContents()};b.surroundContents=function(b){this.nativeRange.surroundContents(b);a(this)};b.collapse=function(b){this.nativeRange.collapse(b);a(this)};b.cloneRange=function(){return new d(this.nativeRange.cloneRange())};b.refresh=function(){a(this)};b.toString=function(){return this.nativeRange.toString()};var i=document.createTextNode("test");e.getBody(document).appendChild(i);
var q=document.createRange();q.setStart(i,0);q.setEnd(i,0);try{q.setStart(i,1),b.setStart=function(b,c){this.nativeRange.setStart(b,c);a(this)},b.setEnd=function(b,c){this.nativeRange.setEnd(b,c);a(this)},f=function(b){return function(c){this.nativeRange[b](c);a(this)}}}catch(t){b.setStart=function(b,c){try{this.nativeRange.setStart(b,c)}catch(g){this.nativeRange.setEnd(b,c),this.nativeRange.setStart(b,c)}a(this)},b.setEnd=function(b,c){try{this.nativeRange.setEnd(b,c)}catch(g){this.nativeRange.setStart(b,
c),this.nativeRange.setEnd(b,c)}a(this)},f=function(b,c){return function(g){try{this.nativeRange[b](g)}catch(d){this.nativeRange[c](g),this.nativeRange[b](g)}a(this)}}}b.setStartBefore=f("setStartBefore","setEndBefore");b.setStartAfter=f("setStartAfter","setEndAfter");b.setEndBefore=f("setEndBefore","setStartBefore");b.setEndAfter=f("setEndAfter","setStartAfter");q.selectNodeContents(i);b.selectNodeContents=q.startContainer==i&&q.endContainer==i&&0==q.startOffset&&q.endOffset==i.length?function(b){this.nativeRange.selectNodeContents(b);
a(this)}:function(a){this.setStart(a,0);this.setEnd(a,h.getEndOffset(a))};q.selectNodeContents(i);q.setEnd(i,3);f=document.createRange();f.selectNodeContents(i);f.setEnd(i,4);f.setStart(i,2);b.compareBoundaryPoints=-1==q.compareBoundaryPoints(q.START_TO_END,f)&&1==q.compareBoundaryPoints(q.END_TO_START,f)?function(a,b){b=b.nativeRange||b;if(a==b.START_TO_END)a=b.END_TO_START;else if(a==b.END_TO_START)a=b.START_TO_END;return this.nativeRange.compareBoundaryPoints(a,b)}:function(a,b){return this.nativeRange.compareBoundaryPoints(a,
b.nativeRange||b)};e.getBody(document).removeChild(i);q.detach();f.detach()})();else if(a.features.implementsTextRange){d=function(a){this.textRange=a;this.refresh()};d.prototype=new h(document);d.prototype.refresh=function(){var a,b,g=this.textRange;a=g.parentElement();var d=g.duplicate();d.collapse(!0);b=d.parentElement();d=g.duplicate();d.collapse(!1);g=d.parentElement();b=b==g?b:e.getCommonAncestor(b,g);b=b==a?b:e.getCommonAncestor(a,b);0==this.textRange.compareEndPoints("StartToEnd",this.textRange)?
b=a=c(this.textRange,b,!0,!0):(a=c(this.textRange,b,!0,!1),b=c(this.textRange,b,!1,!1));this.setStart(a.node,a.offset);this.setEnd(b.node,b.offset)};d.rangeToTextRange=function(a){if(a.collapsed)return b(new f(a.startContainer,a.startOffset),!0,!0);var c=b(new f(a.startContainer,a.startOffset),!0,!1),g=b(new f(a.endContainer,a.endOffset),!1,!1),a=e.getDocument(a.startContainer).body.createTextRange();a.setEndPoint("StartToStart",c);a.setEndPoint("EndToEnd",g);return a};h.copyComparisonConstants(d);
var i=function(){return this}();if("undefined"==typeof i.Range)i.Range=d}d.prototype.getName=function(){return"WrappedRange"};a.WrappedRange=d;a.createNativeRange=function(b){b=b||document;if(a.features.implementsDomRange)return b.createRange();if(a.features.implementsTextRange)return b.body.createTextRange()};a.createRange=function(b){return new d(a.createNativeRange(b||document))};a.createRangyRange=function(a){return new h(a||document)};a.createIframeRange=function(b){return a.createRange(e.getIframeDocument(b))};
a.createIframeRangyRange=function(b){return a.createRangyRange(e.getIframeDocument(b))};a.addCreateMissingNativeApiListener(function(b){b=b.document;if("undefined"==typeof b.createRange)b.createRange=function(){return a.createRange(this)};b=b=null})});
rangy.createModule("WrappedSelection",function(a,c){function b(a,b,c){var g=c?"end":"start",c=c?"start":"end";a.anchorNode=b[g+"Container"];a.anchorOffset=b[g+"Offset"];a.focusNode=b[c+"Container"];a.focusOffset=b[c+"Offset"]}function d(a){a.anchorNode=a.focusNode=null;a.anchorOffset=a.focusOffset=0;a.rangeCount=0;a.isCollapsed=!0;a._ranges.length=0}function e(b){var c;if(b instanceof n){if(c=b._selectionNativeRange,!c)c=a.createNativeRange(g.getDocument(b.startContainer)),c.setEnd(b.endContainer,
b.endOffset),c.setStart(b.startContainer,b.startOffset),b._selectionNativeRange=c,b.attachListener("detach",function(){this._selectionNativeRange=null})}else b instanceof q?c=b.nativeRange:window.Range&&b instanceof Range&&(c=b);return c}function f(a){var b=a.getNodes(),c;a:if(!b.length||1!=b[0].nodeType)c=!1;else{c=1;for(var d=b.length;c<d;++c)if(!g.isAncestorOf(b[0],b[c])){c=!1;break a}c=!0}if(!c)throw Error("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");
return b[0]}function h(c){c._ranges.length=0;if("None"==c.nativeSelection.type)d(c);else{var f=c.nativeSelection.createRange();c.rangeCount=f.length;for(var j,h=g.getDocument(f.item(0)),e=0;e<c.rangeCount;++e)j=a.createRange(h),j.selectNode(f.item(e)),c._ranges.push(j);c.isCollapsed=1==c.rangeCount&&c._ranges[0].collapsed;b(c,c._ranges[c.rangeCount-1],!1)}}function i(a){this.nativeSelection=a;this._ranges=[];this.refresh()}function k(a,b){if(a.anchorNode&&g.getDocument(a.anchorNode)!==g.getDocument(b))throw new t("WRONG_DOCUMENT_ERR");
}function j(a){var b=[],c=new o(a.anchorNode,a.anchorOffset),g=new o(a.focusNode,a.focusOffset),d="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var f=0,j=a.rangeCount;f<j;++f)b[f]=n.inspect(a.getRangeAt(f));return"["+d+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+g.inspect()+"]"}a.requireModules(["DomUtil","DomRange","WrappedRange"]);a.config.checkSelectionRanges=!0;var g=a.dom,l=a.util,n=a.DomRange,q=a.WrappedRange,t=a.DOMException,
o=g.DomPosition,w,r;a.util.isHostMethod(window,"getSelection")?w=function(a){return(a||window).getSelection()}:a.util.isHostObject(document,"selection")?w=function(a){return(a||window).document.selection}:c.fail("No means of obtaining a selection object");a.getNativeSelection=w;var s=w(),x=a.createNativeRange(document),p=g.getBody(document),v=l.areHostObjects(s,l.areHostProperties(s,["anchorOffset","focusOffset"]));a.features.selectionHasAnchorAndFocus=v;var B=l.isHostMethod(s,"extend");a.features.selectionHasExtend=
B;var A="number"==typeof s.rangeCount;a.features.selectionHasRangeCount=A;var F=!1,H=!0;l.areHostMethods(s,["addRange","getRangeAt","removeAllRanges"])&&"number"==typeof s.rangeCount&&a.features.implementsDomRange&&function(){var b=p.appendChild(document.createTextNode("One")),c=p.appendChild(document.createTextNode("Two")),g=a.createNativeRange(document);g.selectNodeContents(b);var d=a.createNativeRange(document);d.selectNodeContents(c);s.removeAllRanges();s.addRange(g);s.addRange(d);F=2==s.rangeCount;
s.removeAllRanges();b.parentNode.removeChild(b);c.parentNode.removeChild(c);b=document.createElement("p");b.contentEditable=!1;c=b.appendChild(document.createTextNode("test"));p.appendChild(b);g=a.createRange();g.collapseToPoint(c,1);s.addRange(g.nativeRange);H=1==s.rangeCount;s.removeAllRanges();p.removeChild(b)}();a.features.selectionSupportsMultipleRanges=F;a.features.collapsedNonEditableSelectionsSupported=H;var y=l.isHostProperty(s,"type"),G=!1,u;p&&l.isHostMethod(p,"createControlRange")&&(u=
p.createControlRange(),l.areHostProperties(u,["item","add"])&&(G=!0));a.features.implementsControlRange=G;r=v?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var E;l.isHostMethod(s,"getRangeAt")?E=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:v&&(E=function(b){var c=g.getDocument(b.anchorNode),c=a.createRange(c);c.setStart(b.anchorNode,b.anchorOffset);c.setEnd(b.focusNode,b.focusOffset);
c.collapsed!==this.isCollapsed&&(c.setStart(b.focusNode,b.focusOffset),c.setEnd(b.anchorNode,b.anchorOffset));return c});a.getSelection=function(a){var a=a||window,b=a._rangySelection;b?(b.nativeSelection=w(a),b.refresh()):(b=new i(w(a)),a._rangySelection=b);return b};a.getIframeSelection=function(b){return a.getSelection(g.getIframeWindow(b))};u=i.prototype;if(v&&l.areHostMethods(s,["removeAllRanges","addRange"])){u.removeAllRanges=function(){this.nativeSelection.removeAllRanges();d(this)};var J=
function(b,c){var g=n.getRangeDocument(c),g=a.createRange(g);g.collapseToPoint(c.endContainer,c.endOffset);b.nativeSelection.addRange(e(g));b.nativeSelection.extend(c.startContainer,c.startOffset);b.refresh()};u.addRange=A?function(c,g){if(g&&B)J(this,c);else{var d;F?d=this.rangeCount:(this.removeAllRanges(),d=0);this.nativeSelection.addRange(e(c));this.rangeCount=this.nativeSelection.rangeCount;this.rangeCount==d+1?(a.config.checkSelectionRanges&&(d=E(this.nativeSelection,this.rangeCount-1))&&!n.rangesEqual(d,
c)&&(c=new q(d)),this._ranges[this.rangeCount-1]=c,b(this,c,m(this.nativeSelection)),this.isCollapsed=r(this)):this.refresh()}}:function(a,b){b&&B?J(this,a):(this.nativeSelection.addRange(e(a)),this.refresh())};u.setRanges=function(a){this.removeAllRanges();for(var b=0,c=a.length;b<c;++b)this.addRange(a[b])}}else if(l.isHostMethod(s,"empty")&&l.isHostMethod(x,"select")&&y&&G)u.removeAllRanges=function(){try{if(this.nativeSelection.empty(),"None"!=this.nativeSelection.type){var a;if(this.anchorNode)a=
g.getDocument(this.anchorNode);else if("Control"==this.nativeSelection.type){var b=this.nativeSelection.createRange();b.length&&(a=g.getDocument(b.item(0)).body.createTextRange())}a&&(a.body.createTextRange().select(),this.nativeSelection.empty())}}catch(c){}d(this)},u.addRange=function(a){if("Control"==this.nativeSelection.type){for(var c=this.nativeSelection.createRange(),a=f(a),d=g.getDocument(c.item(0)),d=g.getBody(d).createControlRange(),j=0,e=c.length;j<e;++j)d.add(c.item(j));try{d.add(a)}catch(i){throw Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");
}d.select();h(this)}else q.rangeToTextRange(a).select(),this._ranges[0]=a,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,b(this,a,!1)},u.setRanges=function(a){this.removeAllRanges();var b=a.length;if(1<b){for(var c=g.getDocument(a[0].startContainer),c=g.getBody(c).createControlRange(),d=0,j;d<b;++d){j=f(a[d]);try{c.add(j)}catch(e){throw Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)");}}c.select();h(this)}else b&&
this.addRange(a[0])};else return c.fail("No means of selecting a Range or TextRange was found"),!1;u.getRangeAt=function(a){if(0>a||a>=this.rangeCount)throw new t("INDEX_SIZE_ERR");return this._ranges[a]};var C;if(l.isHostMethod(s,"getRangeAt")&&"number"==typeof s.rangeCount)C=function(c){c._ranges.length=c.rangeCount=c.nativeSelection.rangeCount;if(c.rangeCount){for(var g=0,f=c.rangeCount;g<f;++g)c._ranges[g]=new a.WrappedRange(c.nativeSelection.getRangeAt(g));b(c,c._ranges[c.rangeCount-1],m(c.nativeSelection));
c.isCollapsed=r(c)}else d(c)};else if(v&&"boolean"==typeof s.isCollapsed&&"boolean"==typeof x.collapsed&&a.features.implementsDomRange)C=function(a){var b;b=a.nativeSelection;b.anchorNode?(b=E(b,0),a._ranges=[b],a.rangeCount=1,b=a.nativeSelection,a.anchorNode=b.anchorNode,a.anchorOffset=b.anchorOffset,a.focusNode=b.focusNode,a.focusOffset=b.focusOffset,a.isCollapsed=r(a)):d(a)};else if(l.isHostMethod(s,"createRange")&&a.features.implementsTextRange)C=function(a){var c=a.nativeSelection.createRange();
"Control"==a.nativeSelection.type?h(a):c&&"undefined"!=typeof c.text?(c=new q(c),a._ranges=[c],b(a,c,!1),a.rangeCount=1,a.isCollapsed=c.collapsed):d(a)};else return c.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;u.refresh=function(a){var b=a?this._ranges.slice(0):null;C(this);if(a){a=b.length;if(a!=this._ranges.length)return!1;for(;a--;)if(!n.rangesEqual(b[a],this._ranges[a]))return!1;return!0}};var z=function(a,b){var c=a.getAllRanges(),g=!1;a.removeAllRanges();
for(var f=0,j=c.length;f<j;++f)g||b!==c[f]?a.addRange(c[f]):g=!0;a.rangeCount||d(a)};u.removeRange=y&&G?function(a){if("Control"==this.nativeSelection.type){for(var b=this.nativeSelection.createRange(),a=f(a),c=g.getDocument(b.item(0)),c=g.getBody(c).createControlRange(),d,j=!1,e=0,i=b.length;e<i;++e)d=b.item(e),d!==a||j?c.add(b.item(e)):j=!0;c.select();h(this)}else z(this,a)}:function(a){z(this,a)};var m;v&&a.features.implementsDomRange?(m=function(a){var b=!1;a.anchorNode&&(b=1==g.comparePoints(a.anchorNode,
a.anchorOffset,a.focusNode,a.focusOffset));return b},u.isBackwards=function(){return m(this)}):m=u.isBackwards=function(){return!1};u.toString=function(){for(var a=[],b=0,c=this.rangeCount;b<c;++b)a[b]=""+this._ranges[b];return a.join("")};u.collapse=function(b,c){k(this,b);var d=a.createRange(g.getDocument(b));d.collapseToPoint(b,c);this.removeAllRanges();this.addRange(d);this.isCollapsed=!0};u.collapseToStart=function(){if(this.rangeCount){var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)}else throw new t("INVALID_STATE_ERR");
};u.collapseToEnd=function(){if(this.rangeCount){var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)}else throw new t("INVALID_STATE_ERR");};u.selectAllChildren=function(b){k(this,b);var c=a.createRange(g.getDocument(b));c.selectNodeContents(b);this.removeAllRanges();this.addRange(c)};u.deleteFromDocument=function(){if(this.rangeCount){var a=this.getAllRanges();this.removeAllRanges();for(var b=0,c=a.length;b<c;++b)a[b].deleteContents();this.addRange(a[c-1])}};u.getAllRanges=
function(){return this._ranges.slice(0)};u.setSingleRange=function(a){this.setRanges([a])};u.containsNode=function(a,b){for(var c=0,g=this._ranges.length;c<g;++c)if(this._ranges[c].containsNode(a,b))return!0;return!1};u.getName=function(){return"WrappedSelection"};u.inspect=function(){return j(this)};u.detach=function(){this.anchorNode&&(g.getWindow(this.anchorNode)._rangySelection=null)};i.inspect=j;a.Selection=i;a.addCreateMissingNativeApiListener(function(b){if("undefined"==typeof b.getSelection)b.getSelection=
function(){return a.getSelection(this)};b=null})});var Base=function(){};
Base.extend=function(a,c){var b=Base.prototype.extend;Base._prototyping=!0;var d=new this;b.call(d,a);d.base=function(){};delete Base._prototyping;var e=d.constructor,f=d.constructor=function(){if(!Base._prototyping)if(this._constructing||this.constructor==f)this._constructing=!0,e.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||b).call(arguments[0],d)};f.ancestor=this;f.extend=this.extend;f.forEach=this.forEach;f.implement=this.implement;f.prototype=
d;f.toString=this.toString;f.valueOf=function(a){return"object"==a?f:e.valueOf()};b.call(f,c);"function"==typeof f.init&&f.init();return f};
Base.prototype={extend:function(a,c){if(1<arguments.length){var b=this[a];if(b&&"function"==typeof c&&(!b.valueOf||b.valueOf()!=c.valueOf())&&/bbaseb/.test(c)){var d=c.valueOf(),c=function(){var a=this.base||Base.prototype.base;this.base=b;var c=d.apply(this,arguments);this.base=a;return c};c.valueOf=function(a){return"object"==a?c:d};c.toString=Base.toString}this[a]=c}else if(a){var e=Base.prototype.extend;!Base._prototyping&&"function"!=typeof this&&(e=this.extend||e);for(var f={toSource:null},
h=["constructor","toString","valueOf"],i=Base._prototyping?0:1;k=h[i++];)a[k]!=f[k]&&e.call(this,k,a[k]);for(var k in a)f[k]||e.call(this,k,a[k])}return this}};
Base=Base.extend({constructor:function(a){this.extend(a)}},{ancestor:Object,version:"1.1",forEach:function(a,c,b){for(var d in a)void 0===this.prototype[d]&&c.call(b,a[d],d,a)},implement:function(){for(var a=0;a<arguments.length;a++)if("function"==typeof arguments[a])arguments[a](this.prototype);else this.prototype.extend(arguments[a]);return this},toString:function(){return""+this.valueOf()}});
wysihtml5.browser=function(){var a=navigator.userAgent,c=document.createElement("div"),b=-1!==a.indexOf("MSIE")&&-1===a.indexOf("Opera"),d=-1!==a.indexOf("Gecko")&&-1===a.indexOf("KHTML"),e=-1!==a.indexOf("AppleWebKit/"),f=-1!==a.indexOf("Opera/");return{USER_AGENT:a,supported:function(){var a=this.USER_AGENT.toLowerCase(),b="contentEditable"in c,d=document.execCommand&&document.queryCommandSupported&&document.queryCommandState,f=document.querySelector&&document.querySelectorAll,a=-1!==a.indexOf("webkit")&&
-1!==a.indexOf("mobile")||-1!==a.indexOf("opera mobi");return b&&d&&f&&!a},supportsSandboxedIframes:function(){return b},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in document)},displaysCaretInEmptyContentEditableCorrectly:function(){return!d},hasCurrentStyleProperty:function(){return"currentStyle"in c},insertsLineBreaksOnReturn:function(){return d},supportsPlaceholderAttributeOn:function(a){return"placeholder"in a},supportsEvent:function(a){var b;if(!(b="on"+
a in c))c.setAttribute("on"+a,"return;"),b="function"===typeof c["on"+a];return b},supportsEventsInIframeCorrectly:function(){return!f},firesOnDropOnlyWhenOnDragOverIsCancelled:function(){return e||d},supportsDataTransfer:function(){try{return e&&(window.Clipboard||window.DataTransfer).prototype.getData}catch(a){return!1}},supportsHTML5Tags:function(a){a=a.createElement("div");a.innerHTML="<article>foo</article>";return"<article>foo</article>"===a.innerHTML.toLowerCase()},supportsCommand:function(){var a=
{formatBlock:b,insertUnorderedList:b||f,insertOrderedList:b||f};return function(b,c){if(!a[c]){try{return b.queryCommandSupported(c)}catch(d){}try{return b.queryCommandEnabled(c)}catch(g){}}return!1}}(),doesAutoLinkingInContentEditable:function(){return b},canDisableAutoLinking:function(){return this.supportsCommand(document,"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return d||f||e},supportsGetAttributeCorrectly:function(){return"1"!=document.createElement("td").getAttribute("rowspan")},
canSelectImagesInContentEditable:function(){return d||b||f},clearsListsInContentEditableCorrectly:function(){return d||b||e},autoScrollsToCaret:function(){return!e},autoClosesUnclosedTags:function(){var a=c.cloneNode(!1),b;a.innerHTML="<p><div></div>";a=a.innerHTML.toLowerCase();b="<p></p><div></div>"===a||"<p><div></div></p>"===a;this.autoClosesUnclosedTags=function(){return b};return b},supportsNativeGetElementsByClassName:function(){return-1!==(""+document.getElementsByClassName).indexOf("[native code]")},
supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},supportsClassList:function(){return"classList"in c},needsSpaceAfterLineBreak:function(){return f},supportsSpeechApiOn:function(b){return 11<=(a.match(/Chrome/(d+)/)||[,0])[1]&&("onwebkitspeechchange"in b||"speech"in b)},crashesWhenDefineProperty:function(a){return b&&("XMLHttpRequest"===a||"XDomainRequest"===a)}}}();
wysihtml5.lang.array=function(a){return{contains:function(c){if(a.indexOf)return-1!==a.indexOf(c);for(var b=0,d=a.length;b<d;b++)if(a[b]===c)return!0;return!1},without:function(c){for(var c=wysihtml5.lang.array(c),b=[],d=0,e=a.length;d<e;d++)c.contains(a[d])||b.push(a[d]);return b},get:function(){for(var c=0,b=a.length,d=[];c<b;c++)d.push(a[c]);return d}}};
wysihtml5.lang.Dispatcher=Base.extend({observe:function(a,c){this.events=this.events||{};this.events[a]=this.events[a]||[];this.events[a].push(c);return this},fire:function(a,c){this.events=this.events||{};for(var b=this.events[a]||[],d=0;d<b.length;d++)b[d].call(this,c);return this},stopObserving:function(a,c){this.events=this.events||{};var b=0,d,e;if(a){for(d=this.events[a]||[],e=[];b<d.length;b++)d[b]!==c&&e.push(d[b]);this.events[a]=e}else this.events={};return this}});
wysihtml5.lang.object=function(a){return{merge:function(c){for(var b in c)a[b]=c[b];return this},get:function(){return a},clone:function(){var c={},b;for(b in a)c[b]=a[b];return c},isArray:function(){return"[object Array]"===Object.prototype.toString.call(a)}}};(function(){var a=/^s+/,c=/s+$/;wysihtml5.lang.string=function(b){b=""+b;return{trim:function(){return b.replace(a,"").replace(c,"")},interpolate:function(a){for(var c in a)b=this.replace("#{"+c+"}").by(a[c]);return b},replace:function(a){return{by:function(c){return b.split(a).join(c)}}}}}})();
(function(a){function c(a){return a.replace(e,function(a,b){var c=(b.match(f)||[])[1]||"",d=i[c],b=b.replace(f,"");b.split(d).length>b.split(c).length&&(b+=c,c="");var e=d=b;b.length>h&&(e=e.substr(0,h)+"...");"www."===d.substr(0,4)&&(d="http://"+d);return'<a href="'+d+'">'+e+"</a>"+c})}function b(f){if(!d.contains(f.nodeName))if(f.nodeType===a.TEXT_NODE&&f.data.match(e)){var j=f.parentNode,g;g=j.ownerDocument;var h=g._wysihtml5_tempElement;if(!h)h=g._wysihtml5_tempElement=g.createElement("div");
g=h;g.innerHTML="<span></span>"+c(f.data);for(g.removeChild(g.firstChild);g.firstChild;)j.insertBefore(g.firstChild,f);j.removeChild(f)}else{j=a.lang.array(f.childNodes).get();g=j.length;for(h=0;h<g;h++)b(j[h]);return f}}var d=a.lang.array("CODE,PRE,A,SCRIPT,HEAD,TITLE,STYLE".split(",")),e=/((https?://|www.)[^s<]{3,})/gi,f=/([^w/-](,?))$/i,h=100,i={")":"(","]":"[","}":"{"};a.dom.autoLink=function(a){var c;a:{c=a;for(var g;c.parentNode;){c=c.parentNode;g=c.nodeName;if(d.contains(g)){c=!0;break a}if("body"===
g)break}c=!1}if(c)return a;if(a===a.ownerDocument.documentElement)a=a.ownerDocument.body;return b(a)};a.dom.autoLink.URL_REG_EXP=e})(wysihtml5);
(function(a){var c=a.browser.supportsClassList(),b=a.dom;b.addClass=function(a,e){if(c)return a.classList.add(e);b.hasClass(a,e)||(a.className+=" "+e)};b.removeClass=function(a,b){if(c)return a.classList.remove(b);a.className=a.className.replace(RegExp("(^|\s+)"+b+"(\s+|$)")," ")};b.hasClass=function(a,b){if(c)return a.classList.contains(b);var f=a.className;return 0<f.length&&(f==b||RegExp("(^|\s)"+b+"(\s|$)").test(f))}})(wysihtml5);
wysihtml5.dom.contains=function(){var a=document.documentElement;if(a.contains)return function(a,b){if(b.nodeType!==wysihtml5.ELEMENT_NODE)b=b.parentNode;return a!==b&&a.contains(b)};if(a.compareDocumentPosition)return function(a,b){return!!(a.compareDocumentPosition(b)&16)}}();
wysihtml5.dom.convertToList=function(){function a(a,b){var d=a.createElement("li");b.appendChild(d);return d}return function(c,b){if("UL"===c.nodeName||"OL"===c.nodeName||"MENU"===c.nodeName)return c;for(var d=c.ownerDocument,e=d.createElement(b),f=wysihtml5.lang.array(c.childNodes).get(),h=f.length,i,k,j,g,l=0;l<h;l++)g=g||a(d,e),i=f[l],k="block"===wysihtml5.dom.getStyle("display").from(i),j="BR"===i.nodeName,k?(g=g.firstChild?a(d,e):g,g.appendChild(i),g=null):j?g=g.firstChild?null:g:g.appendChild(i);
c.parentNode.replaceChild(e,c);return e}}();wysihtml5.dom.copyAttributes=function(a){return{from:function(c){return{to:function(b){for(var d,e=0,f=a.length;e<f;e++)d=a[e],c[d]&&(b[d]=c[d]);return{andTo:arguments.callee}}}}}};
(function(a){var c=["-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing"],b=function(b){for(var e=0,f=c.length;e<f;e++)if("border-box"===a.getStyle(c[e]).from(b))return c[e]};a.copyStyles=function(d){return{from:function(e){b(e)&&parseInt(a.getStyle("width").from(e),10)<e.offsetWidth&&(d=wysihtml5.lang.array(d).without(c));for(var f="",h=d.length,i=0,k;i<h;i++)k=d[i],f+=k+":"+a.getStyle(k).from(e)+";";return{to:function(b){a.setStyles(f).on(b);return{andTo:arguments.callee}}}}}}})(wysihtml5.dom);
(function(a){a.dom.delegate=function(c,b,d,e){return a.dom.observe(c,d,function(d){for(var h=d.target,i=a.lang.array(c.querySelectorAll(b));h&&h!==c;){if(i.contains(h)){e.call(h,d);break}h=h.parentNode}})}})(wysihtml5);
wysihtml5.dom.getAsDom=function(){var a="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".split(",");return function(c,b){var b=b||document,d;if("object"===typeof c&&c.nodeType)d=b.createElement("div"),d.appendChild(c);else if(wysihtml5.browser.supportsHTML5Tags(b))d=b.createElement("div"),d.innerHTML=c;else{d=b;if(!d._wysihtml5_supportsHTML5Tags){for(var e=
0,f=a.length;e<f;e++)d.createElement(a[e]);d._wysihtml5_supportsHTML5Tags=!0}d=b;e=d.createElement("div");e.style.display="none";d.body.appendChild(e);try{e.innerHTML=c}catch(h){}d.body.removeChild(e);d=e}return d}}();
wysihtml5.dom.getParentElement=function(){function a(a,b){return!b||!b.length?!0:"string"===typeof b?a===b:wysihtml5.lang.array(b).contains(a)}return function(c,b,d){d=d||50;if(b.className||b.classRegExp)a:{for(var e=b.nodeName,f=b.className,b=b.classRegExp;d--&&c&&"BODY"!==c.nodeName;){var h;if(h=c.nodeType===wysihtml5.ELEMENT_NODE)if(h=a(c.nodeName,e)){h=f;var i=(c.className||"").match(b)||[];h=!h?!!i.length:i[i.length-1]===h}if(h)break a;c=c.parentNode}c=null}else a:{e=b.nodeName;for(f=d;f--&&
c&&"BODY"!==c.nodeName;){if(a(c.nodeName,e))break a;c=c.parentNode}c=null}return c}}();
wysihtml5.dom.getStyle=function(){function a(a){return a.replace(b,function(a){return a.charAt(1).toUpperCase()})}var c={"float":"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat"},b=/-[a-z]/g;return function(b){return{from:function(e){if(e.nodeType===wysihtml5.ELEMENT_NODE){var f=e.ownerDocument,h=c[b]||a(b),i=e.style,k=e.currentStyle,j=i[h];if(j)return j;if(k)return k[h];var h=f.defaultView||f.parentWindow,f=("height"===b||"width"===b)&&"TEXTAREA"===e.nodeName,g;if(h.getComputedStyle){if(f)g=
i.overflow,i.overflow="hidden";e=h.getComputedStyle(e,null).getPropertyValue(b);if(f)i.overflow=g||"";return e}}}}}}();wysihtml5.dom.hasElementWithTagName=function(){var a={},c=1;return function(b,d){var e=(b._wysihtml5_identifier||(b._wysihtml5_identifier=c++))+":"+d,f=a[e];f||(f=a[e]=b.getElementsByTagName(d));return 0<f.length}}();
(function(a){var c={},b=1;a.dom.hasElementWithClassName=function(d,e){if(!a.browser.supportsNativeGetElementsByClassName())return!!d.querySelector("."+e);var f=(d._wysihtml5_identifier||(d._wysihtml5_identifier=b++))+":"+e,h=c[f];h||(h=c[f]=d.getElementsByClassName(e));return 0<h.length}})(wysihtml5);wysihtml5.dom.insert=function(a){return{after:function(c){c.parentNode.insertBefore(a,c.nextSibling)},before:function(c){c.parentNode.insertBefore(a,c)},into:function(c){c.appendChild(a)}}};
wysihtml5.dom.insertCSS=function(a){a=a.join("n");return{into:function(c){var b=c.head||c.getElementsByTagName("head")[0],d=c.createElement("style");d.type="text/css";d.styleSheet?d.styleSheet.cssText=a:d.appendChild(c.createTextNode(a));b&&b.appendChild(d)}}};
wysihtml5.dom.observe=function(a,c,b){for(var c="string"===typeof c?[c]:c,d,e,f=0,h=c.length;f<h;f++)e=c[f],a.addEventListener?a.addEventListener(e,b,!1):(d=function(c){if(!("target"in c))c.target=c.srcElement;c.preventDefault=c.preventDefault||function(){this.returnValue=!1};c.stopPropagation=c.stopPropagation||function(){this.cancelBubble=!0};b.call(a,c)},a.attachEvent("on"+e,d));return{stop:function(){for(var f,e=0,j=c.length;e<j;e++)f=c[e],a.removeEventListener?a.removeEventListener(f,b,!1):a.detachEvent("on"+
f,d)}}};
wysihtml5.dom.parse=function(){function a(c,f){var j=c.childNodes,e=j.length,h;h=b[c.nodeType];var i=0;h=h&&h(c);if(!h)return null;for(i=0;i<e;i++)(newChild=a(j[i],f))&&h.appendChild(newChild);return f&&1>=h.childNodes.length&&h.nodeName.toLowerCase()===d&&h.innerHTML!==wysihtml5.selection.PLACEHOLDER_TEXT&&!h.attributes.length?h.firstChild:h}function c(a,b){var b=b.toLowerCase(),c;if(c="IMG"==a.nodeName)if(c="src"==b){var d;try{d=a.complete&&!a.mozMatchesSelector(":-moz-broken")}catch(f){a.complete&&"complete"===
a.readyState&&(d=!0)}c=!0===d}return c?a.src:i&&"outerHTML"in a?-1!=a.outerHTML.toLowerCase().indexOf(" "+b+"=")?a.getAttribute(b):null:a.getAttribute(b)}var b={1:function(a){var b,f,i=h.tags;f=a.nodeName.toLowerCase();b=a.scopeName;if(a._wysihtml5)return null;a._wysihtml5=1;b&&"HTML"!=b&&(f=b+":"+f);"outerHTML"in a&&!wysihtml5.browser.autoClosesUnclosedTags()&&"P"===a.nodeName&&"</p>"!==a.outerHTML.slice(-4).toLowerCase()&&(f="div");if(f in i){b=i[f];if(!b||b.remove)return null;b="string"===typeof b?
{rename_tag:b}:b}else if(a.firstChild)b={rename_tag:d};else return null;f=a.ownerDocument.createElement(b.rename_tag||f);var i={},t=b.set_class,o=b.add_class,w=b.set_attributes,r=b.check_attributes,s=h.classes,x=0,p=[];b=[];var v=[],B=[],A;w&&(i=wysihtml5.lang.object(w).clone());if(r)for(A in r)if(w=k[r[A]])w=w(c(a,A)),"string"===typeof w&&(i[A]=w);t&&p.push(t);if(o)for(A in o)if(w=j[o[A]])t=w(c(a,A)),"string"===typeof t&&p.push(t);(B=a.getAttribute("class"))&&(p=p.concat(B.split(e)));for(o=p.length;x<
o;x++)a=p[x],s[a]&&b.push(a);for(s=b.length;s--;)a=b[s],wysihtml5.lang.array(v).contains(a)||v.unshift(a);v.length&&(i["class"]=v.join(" "));for(A in i)try{f.setAttribute(A,i[A])}catch(F){}i.src&&("undefined"!==typeof i.width&&f.setAttribute("width",i.width),"undefined"!==typeof i.height&&f.setAttribute("height",i.height));return f},3:function(a){return a.ownerDocument.createTextNode(a.data)}},d="span",e=/s+/,f={tags:{},classes:{}},h={},i=!wysihtml5.browser.supportsGetAttributeCorrectly(),k={url:function(){var a=
/^https?:///i;return function(b){return!b||!b.match(a)?null:b.replace(a,function(a){return a.toLowerCase()})}}(),alt:function(){var a=/[^ a-z0-9_-]/gi;return function(b){return!b?"":b.replace(a,"")}}(),numbers:function(){var a=/D/g;return function(b){return(b=(b||"").replace(a,""))||null}}()},j={align_img:function(){var a={left:"wysiwyg-float-left",right:"wysiwyg-float-right"};return function(b){return a[(""+b).toLowerCase()]}}(),align_text:function(){var a={left:"wysiwyg-text-align-left",right:"wysiwyg-text-align-right",
center:"wysiwyg-text-align-center",justify:"wysiwyg-text-align-justify"};return function(b){return a[(""+b).toLowerCase()]}}(),clear_br:function(){var a={left:"wysiwyg-clear-left",right:"wysiwyg-clear-right",both:"wysiwyg-clear-both",all:"wysiwyg-clear-both"};return function(b){return a[(""+b).toLowerCase()]}}(),size_font:function(){var a={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(b){return a[(""+b).charAt(0)]}}()};return function(b,c,d,j){wysihtml5.lang.object(h).merge(f).merge(c).get();for(var d=d||b.ownerDocument||document,c=d.createDocumentFragment(),e="string"===typeof b,b=e?wysihtml5.dom.getAsDom(b,d):b;b.firstChild;)d=b.firstChild,b.removeChild(d),(d=a(d,j))&&c.appendChild(d);b.innerHTML="";b.appendChild(c);return e?wysihtml5.quirks.getCorrectInnerHTML(b):b}}();
wysihtml5.dom.removeEmptyTextNodes=function(a){for(var c=wysihtml5.lang.array(a.childNodes).get(),b=c.length,d=0;d<b;d++)a=c[d],a.nodeType===wysihtml5.TEXT_NODE&&""===a.data&&a.parentNode.removeChild(a)};wysihtml5.dom.renameElement=function(a,c){for(var b=a.ownerDocument.createElement(c),d;d=a.firstChild;)b.appendChild(d);wysihtml5.dom.copyAttributes(["align","className"]).from(a).to(b);a.parentNode.replaceChild(b,a);return b};
wysihtml5.dom.replaceWithChildNodes=function(a){if(a.parentNode)if(a.firstChild){for(var c=a.ownerDocument.createDocumentFragment();a.firstChild;)c.appendChild(a.firstChild);a.parentNode.replaceChild(c,a)}else a.parentNode.removeChild(a)};
(function(a){function c(a){var c=a.ownerDocument.createElement("br");a.appendChild(c)}a.resolveList=function(b){if(!("MENU"!==b.nodeName&&"UL"!==b.nodeName&&"OL"!==b.nodeName)){var d=b.ownerDocument.createDocumentFragment(),e=b.previousSibling,f,h,i;for(e&&"block"!==a.getStyle("display").from(e)&&c(d);i=b.firstChild;){for(f=i.lastChild;e=i.firstChild;)h=(h=e===f)&&"block"!==a.getStyle("display").from(e)&&"BR"!==e.nodeName,d.appendChild(e),h&&c(d);i.parentNode.removeChild(i)}b.parentNode.replaceChild(d,
b)}}})(wysihtml5.dom);
(function(a){var c={uaCompatible:"IE=Edge"},b=document,d="parent,top,opener,frameElement,frames,localStorage,globalStorage,sessionStorage,indexedDB".split(","),e="open,close,openDialog,showModalDialog,alert,confirm,prompt,openDatabase,postMessage,XMLHttpRequest,XDomainRequest".split(","),f=["referrer","write","open","close"];a.dom.Sandbox=Base.extend({constructor:function(b,d){this.callback=b||a.EMPTY_FUNCTION;this.config=a.lang.object({}).merge(c).merge(d).get();this.iframe=this._createIframe()},
insertInto:function(a){"string"===typeof a&&(a=b.getElementById(a));a.appendChild(this.iframe)},getIframe:function(){return this.iframe},getWindow:function(){this._readyError()},getDocument:function(){this._readyError()},destroy:function(){var a=this.getIframe();a.parentNode.removeChild(a)},_readyError:function(){throw Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet");},_createIframe:function(){var c=this,d=b.createElement("iframe");d.className="wysihtml5-sandbox";a.dom.setAttributes({security:"restricted",
allowtransparency:"true",frameborder:0,width:0,height:0,marginwidth:0,marginheight:0}).on(d);if(a.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty())d.src="javascript:'<html></html>'";d.onload=function(){d.onreadystatechange=d.onload=null;c._onLoadIframe(d)};d.onreadystatechange=function(){if(/loaded|complete/.test(d.readyState))d.onreadystatechange=d.onload=null,c._onLoadIframe(d)};return d},_onLoadIframe:function(c){if(a.dom.contains(b.documentElement,c)){var i=this,k=c.contentWindow,j=c.contentDocument||
c.contentWindow.document,c=this._getHtml({charset:b.characterSet||b.charset||"utf-8",stylesheets:this.config.stylesheets,uaCompatible:this.config.uaCompatible});j.open("text/html","replace");j.write(c);j.close();this.getWindow=function(){return k};this.getDocument=function(){return j};k.onerror=function(a,b,c){throw Error("wysihtml5.Sandbox: "+a,b,c);};if(!a.browser.supportsSandboxedIframes()){var g;for(c=0,g=d.length;c<g;c++)this._unset(k,d[c]);for(c=0,g=e.length;c<g;c++)this._unset(k,e[c],a.EMPTY_FUNCTION);
for(c=0,g=f.length;c<g;c++)this._unset(j,f[c]);this._unset(j,"cookie","",!0)}this.loaded=!0;setTimeout(function(){i.callback(i)},0)}},_getHtml:function(b){var c=b.stylesheets,d="",f=0,g;if(c="string"===typeof c?[c]:c)for(g=c.length;f<g;f++)d+='<link rel="stylesheet" href="'+c[f]+'">';b.stylesheets=d;return a.lang.string('<!DOCTYPE html><html><head><meta http-equiv="X-UA-Compatible" content="#{uaCompatible}"><meta charset="#{charset}">#{stylesheets}</head><body></body></html>').interpolate(b)},_unset:function(b,
c,d,f){try{b[c]=d}catch(g){}try{b.__defineGetter__(c,function(){return d})}catch(e){}if(f)try{b.__defineSetter__(c,function(){})}catch(n){}if(!a.browser.crashesWhenDefineProperty(c))try{var q={get:function(){return d}};if(f)q.set=function(){};Object.defineProperty(b,c,q)}catch(t){}}})})(wysihtml5);(function(){var a={className:"class"};wysihtml5.dom.setAttributes=function(c){return{on:function(b){for(var d in c)b.setAttribute(a[d]||d,c[d])}}}})();
wysihtml5.dom.setStyles=function(a){return{on:function(c){c=c.style;if("string"===typeof a)c.cssText+=";"+a;else for(var b in a)"float"===b?(c.cssFloat=a[b],c.styleFloat=a[b]):c[b]=a[b]}}};
(function(a){a.simulatePlaceholder=function(c,b,d){var e=function(){b.hasPlaceholderSet()&&b.clear();a.removeClass(b.element,"placeholder")},f=function(){b.isEmpty()&&(b.setValue(d),a.addClass(b.element,"placeholder"))};c.observe("set_placeholder",f).observe("unset_placeholder",e).observe("focus:composer",e).observe("paste:composer",e).observe("blur:composer",f);f()}})(wysihtml5.dom);
(function(a){var c=document.documentElement;"textContent"in c?(a.setTextContent=function(a,c){a.textContent=c},a.getTextContent=function(a){return a.textContent}):"innerText"in c?(a.setTextContent=function(a,c){a.innerText=c},a.getTextContent=function(a){return a.innerText}):(a.setTextContent=function(a,c){a.nodeValue=c},a.getTextContent=function(a){return a.nodeValue})})(wysihtml5.dom);
wysihtml5.quirks.cleanPastedHTML=function(){var a={"a u":wysihtml5.dom.replaceWithChildNodes};return function(c,b,d){var b=b||a,d=d||c.ownerDocument||document,e="string"===typeof c,f,h,i,k=0,c=e?wysihtml5.dom.getAsDom(c,d):c;for(i in b){f=c.querySelectorAll(i);d=b[i];for(h=f.length;k<h;k++)d(f[k])}return e?c.innerHTML:c}}();
(function(a){var c=a.dom;a.quirks.ensureProperClearing=function(){var a=function(){var a=this;setTimeout(function(){var b=a.innerHTML.toLowerCase();if("<p> </p>"==b||"<p> </p><p> </p>"==b)a.innerHTML=""},0)};return function(d){c.observe(d,["cut","keydown"],a)}}();a.quirks.ensureProperClearingOfLists=function(){var b=["OL","UL","MENU"];return function(d){c.observe(d,"keydown",function(e){e.keyCode===a.BACKSPACE_KEY&&(e=a.selection.getSelectedNode(d.ownerDocument),d.firstChild&&a.lang.array(b).contains(d.firstChild.nodeName)&&
(e=c.getParentElement(e,{nodeName:b}))&&e==d.firstChild&&1>=e.childNodes.length&&(e.firstChild?""===e.firstChild.innerHTML:1)&&e.parentNode.removeChild(e))})}}()})(wysihtml5);(function(a){a.quirks.getCorrectInnerHTML=function(c){var b=c.innerHTML;if(-1===b.indexOf("%7E"))return b;var c=c.querySelectorAll("[href*='~'], [src*='~']"),d,e,f,h;for(h=0,f=c.length;h<f;h++)d=c[h].href||c[h].src,e=a.lang.string(d).replace("~").by("%7E"),b=a.lang.string(b).replace(e).by(d);return b}})(wysihtml5);
(function(a){function c(c){var h=c.keyCode;if(!(c.shiftKey||h!==a.ENTER_KEY&&h!==a.BACKSPACE_KEY)){var i=c.target,k=a.selection.getSelectedNode(i.ownerDocument);(k=b.getParentElement(k,{nodeName:d},4))?"LI"===k.nodeName&&(h===a.ENTER_KEY||h===a.BACKSPACE_KEY)&&setTimeout(function(){var c=a.selection.getSelectedNode(i.ownerDocument);c&&!b.getParentElement(c,{nodeName:e},2)&&"P"===c.parentNode.nodeName&&(c=b.renameElement(c.parentNode,"div"),a.selection.selectNode(c))},0):h===a.ENTER_KEY&&(a.commands.exec(i,
"insertLineBreak"),c.preventDefault())}}var b=a.dom,d="LI,DIV,P,H1,H2,H3,H4,H5,H6".split(","),e=["UL","OL","MENU"];a.quirks.insertLineBreakOnReturn=function(a){b.observe(a.ownerDocument,"keydown",c)}})(wysihtml5);(function(a){a.quirks.redraw=function(c){a.dom.addClass(c,"wysihtml5-quirks-redraw");a.dom.removeClass(c,"wysihtml5-quirks-redraw");try{var b=c.ownerDocument;b.execCommand("italic",!1,null);b.execCommand("italic",!1,null)}catch(d){}}})(wysihtml5);
(function(a){function c(a){var f;f=a._wysihtml5CaretPlaceholder=a._wysihtml5CaretPlaceholder||a.createElement("span"),a=f;a.innerHTML=d;return a}function b(a){var b=c(a),d=e.getTextContent(b),k=a.getElementById(b.id),j=0;if(e.contains(a.body,b))return b;if(k)return k;b=a.getElementsByTagName("*");for(k=b.length;j<k;j++)if(a=b[j],a.innerHTML===d)return a;return null}var d="--_CARET_--",e=a.dom;a.selection={PLACEHOLDER_TEXT:d,getBookmark:function(a){return(a=this.getRange(a))&&a.cloneRange()},setBookmark:function(a){a&&
this.setSelection(a)},setBefore:function(a){var b=rangy.createRange(a.ownerDocument);b.setStartBefore(a);b.setEndBefore(a);return this.setSelection(b)},setAfter:function(a){var b=rangy.createRange(a.ownerDocument);b.setStartAfter(a);b.setEndAfter(a);return this.setSelection(b)},selectNode:function(b){var c=rangy.createRange(b.ownerDocument),d=b.nodeType===a.ELEMENT_NODE,k="canHaveHTML"in b?b.canHaveHTML:"IMG"!==b.nodeName,j=d?b.innerHTML:b.data,j=""===j||j===a.INVISIBLE_SPACE,g=e.getStyle("display").from(b),
g="block"===g||"list-item"===g;if(j&&d&&k)try{b.innerHTML=a.INVISIBLE_SPACE}catch(l){}k?c.selectNodeContents(b):c.selectNode(b);k&&j&&d?c.collapse(g):k&&j&&(c.setStartAfter(b),c.setEndAfter(b));this.setSelection(c)},getSelectedNode:function(a,b){var c;if(b&&a.selection&&"Control"===a.selection.type&&(c=a.selection.createRange())&&c.length)return c.item(0);c=this.getSelection(a);return c.focusNode===c.anchorNode?c.focusNode:(c=this.getRange(a))?c.commonAncestorContainer:a.body},executeAndRestore:function(a,
d,e){if(!window.getSelection)return this.executeAndRestoreSimple(a,d);var k=a.body,j=k.scrollTop,g=k.scrollLeft,l=this.getRange(a),n=c(a);if(l){l.insertNode(n);try{d(l.startContainer,l.endContainer)}catch(q){setTimeout(function(){throw q;},0)}if(d=b(a))a=rangy.createRange(a),a.selectNode(d),a.deleteContents(),this.setSelection(a);if(e)k.scrollTop=j,k.scrollLeft=g;try{d.parentNode.removeChild(d)}catch(t){}}else d(k,k)},executeAndRestoreSimple:function(a,b){var c,d,e=this.getRange(a),g,l;if(e){c=e.getNodes([3]);
g=c[0]||e.startContainer;l=c[c.length-1]||e.endContainer;c=g===e.startContainer?e.startOffset:0;d=l===e.endContainer?e.endOffset:l.length;try{b(e.startContainer,e.endContainer)}catch(n){setTimeout(function(){throw n;},0)}e=rangy.createRange(a);try{e.setStart(g,c)}catch(q){}try{e.setEnd(l,d)}catch(t){}try{this.setSelection(e)}catch(o){}}else b(a.body,a.body)},insertHTML:function(a,b){var c=rangy.createRange(a).createContextualFragment(b),d=c.lastChild;this.insertNode(c);d&&this.setAfter(d)},insertNode:function(a){var b=
this.getRange(a.ownerDocument);if(b)b.insertNode(a);else return!1},surround:function(a){var b=this.getRange(a.ownerDocument);if(b)try{b.surroundContents(a),this.selectNode(a)}catch(c){a.appendChild(b.extractContents()),b.insertNode(a)}},scrollIntoView:function(b){var c=b.ownerDocument,d=c.documentElement.scrollHeight>c.documentElement.offsetHeight,e;if(!(e=c._wysihtml5ScrollIntoViewElement))e=c.createElement("span"),e.innerHTML=a.INVISIBLE_SPACE;c=c._wysihtml5ScrollIntoViewElement=e;if(d){this.insertNode(c);
d=c;e=0;if(d.parentNode){do e+=d.offsetTop||0,d=d.offsetParent;while(d)}d=e;c.parentNode.removeChild(c);if(d>b.scrollTop)b.scrollTop=d}},selectLine:function(b){a.browser.supportsSelectionModify()?this._selectLine_W3C(b):b.selection&&this._selectLine_MSIE(b)},_selectLine_W3C:function(a){a=a.defaultView.getSelection();a.modify("extend","left","lineboundary");a.modify("extend","right","lineboundary")},_selectLine_MSIE:function(a){var b=a.selection.createRange(),c=b.boundingTop,d=a.body.scrollWidth,e;
if(b.moveToPoint){if(0===c)e=a.createElement("span"),this.insertNode(e),c=e.offsetTop,e.parentNode.removeChild(e);c+=1;for(e=-10;e<d;e+=2)try{b.moveToPoint(e,c);break}catch(g){}for(a=a.selection.createRange();0<=d;d--)try{a.moveToPoint(d,c);break}catch(l){}b.setEndPoint("EndToEnd",a);b.select()}},getText:function(a){return(a=this.getSelection(a))?a.toString():""},getNodes:function(a,b,c){return(a=this.getRange(a))?a.getNodes([b],c):[]},getRange:function(a){return(a=this.getSelection(a))&&a.rangeCount&&
a.getRangeAt(0)},getSelection:function(a){return rangy.getSelection(a.defaultView||a.parentWindow)},setSelection:function(a){var b=(a.startContainer||a.endContainer).ownerDocument;return rangy.getSelection(b.defaultView||b.parentWindow).setSingleRange(a)}}})(wysihtml5);
(function(a,c){function b(a,b){if(a.attributes.length!=b.attributes.length)return!1;for(var c=0,d=a.attributes.length,e,f;c<d;++c)if(e=a.attributes[c],f=e.name,"class"!=f){f=b.attributes.getNamedItem(f);if(e.specified!=f.specified)return!1;if(e.specified&&e.nodeValue!==f.nodeValue)return!1}return!0}function d(a,b){return c.dom.isCharacterDataNode(a)?0==b?!!a.previousSibling:b==a.length?!!a.nextSibling:!0:0<b&&b<a.childNodes.length}function e(a,b,d){var f;if(c.dom.isCharacterDataNode(b))0==d?(d=c.dom.getNodeIndex(b),
b=b.parentNode):d==b.length?(d=c.dom.getNodeIndex(b)+1,b=b.parentNode):f=c.dom.splitDataNode(b,d);if(!f){f=b.cloneNode(!1);f.id&&f.removeAttribute("id");for(var h;h=b.childNodes[d];)f.appendChild(h);c.dom.insertAfter(f,b)}return b==a?f:e(a,f.parentNode,c.dom.getNodeIndex(f))}function f(b){this.firstTextNode=(this.isElementMerge=b.nodeType==a.ELEMENT_NODE)?b.lastChild:b;this.textNodes=[this.firstTextNode]}function h(a,b,c,d){this.tagNames=a||[i];this.cssClass=b||"";this.similarClassRegExp=c;this.normalize=
d;this.applyToAnyTagName=!1}var i="span",k=/s+/g;f.prototype={doMerge:function(){for(var a=[],b,c,d=0,e=this.textNodes.length;d<e;++d)b=this.textNodes[d],c=b.parentNode,a[d]=b.data,d&&(c.removeChild(b),c.hasChildNodes()||c.parentNode.removeChild(c));return this.firstTextNode.data=a=a.join("")},getLength:function(){for(var a=this.textNodes.length,b=0;a--;)b+=this.textNodes[a].length;return b},toString:function(){for(var a=[],b=0,c=this.textNodes.length;b<c;++b)a[b]="'"+this.textNodes[b].data+"'";
return"[Merge("+a.join(",")+")]"}};h.prototype={getAncestorWithClass:function(b){for(var d;b;){if(this.cssClass)if(d=this.cssClass,b.className){var e=b.className.match(this.similarClassRegExp)||[];d=e[e.length-1]===d}else d=!1;else d=!0;if(b.nodeType==a.ELEMENT_NODE&&c.dom.arrayContains(this.tagNames,b.tagName.toLowerCase())&&d)return b;b=b.parentNode}return!1},postApply:function(a,b){for(var c=a[0],d=a[a.length-1],e=[],h,i=c,k=d,r=0,s=d.length,x,p,v=0,B=a.length;v<B;++v)if(x=a[v],p=this.getAdjacentMergeableTextNode(x.parentNode,
!1)){h||(h=new f(p),e.push(h));h.textNodes.push(x);if(x===c)i=h.firstTextNode,r=i.length;if(x===d)k=h.firstTextNode,s=h.getLength()}else h=null;if(c=this.getAdjacentMergeableTextNode(d.parentNode,!0))h||(h=new f(d),e.push(h)),h.textNodes.push(c);if(e.length){for(v=0,B=e.length;v<B;++v)e[v].doMerge();b.setStart(i,r);b.setEnd(k,s)}},getAdjacentMergeableTextNode:function(b,c){var d=b.nodeType==a.TEXT_NODE,e=d?b.parentNode:b,f=c?"nextSibling":"previousSibling";if(d){if((d=b[f])&&d.nodeType==a.TEXT_NODE)return d}else if((d=
e[f])&&this.areElementsMergeable(b,d))return d[c?"firstChild":"lastChild"];return null},areElementsMergeable:function(a,d){return c.dom.arrayContains(this.tagNames,(a.tagName||"").toLowerCase())&&c.dom.arrayContains(this.tagNames,(d.tagName||"").toLowerCase())&&a.className.replace(k," ")==d.className.replace(k," ")&&b(a,d)},createContainer:function(a){a=a.createElement(this.tagNames[0]);if(this.cssClass)a.className=this.cssClass;return a},applyToTextNode:function(a){var b=a.parentNode;if(1==b.childNodes.length&&
c.dom.arrayContains(this.tagNames,b.tagName.toLowerCase())){if(this.cssClass)if(a=this.cssClass,b.className){if(b.className)b.className=b.className.replace(this.similarClassRegExp,"");b.className+=" "+a}else b.className=a}else b=this.createContainer(c.dom.getDocument(a)),a.parentNode.insertBefore(b,a),b.appendChild(a)},isRemovable:function(b){return c.dom.arrayContains(this.tagNames,b.tagName.toLowerCase())&&a.lang.string(b.className).trim()==this.cssClass},undoToTextNode:function(a,b,c){b.containsNode(c)||
(a=b.cloneRange(),a.selectNode(c),a.isPointInRange(b.endContainer,b.endOffset)&&d(b.endContainer,b.endOffset)&&(e(c,b.endContainer,b.endOffset),b.setEndAfter(c)),a.isPointInRange(b.startContainer,b.startOffset)&&d(b.startContainer,b.startOffset)&&(c=e(c,b.startContainer,b.startOffset)));if(this.similarClassRegExp&&c.className)c.className=c.className.replace(this.similarClassRegExp,"");if(this.isRemovable(c)){b=c;for(c=b.parentNode;b.firstChild;)c.insertBefore(b.firstChild,b);c.removeChild(b)}},applyToRange:function(b){var c=
b.getNodes([a.TEXT_NODE]);if(!c.length)try{var d=this.createContainer(b.endContainer.ownerDocument);b.surroundContents(d);this.selectNode(b,d);return}catch(e){}b.splitBoundaries();c=b.getNodes([a.TEXT_NODE]);if(c.length){for(var f=0,h=c.length;f<h;++f)d=c[f],this.getAncestorWithClass(d)||this.applyToTextNode(d);b.setStart(c[0],0);d=c[c.length-1];b.setEnd(d,d.length);this.normalize&&this.postApply(c,b)}},undoToRange:function(b){var c=b.getNodes([a.TEXT_NODE]),d,e;c.length?(b.splitBoundaries(),c=b.getNodes([a.TEXT_NODE])):
(c=b.endContainer.ownerDocument.createTextNode(a.INVISIBLE_SPACE),b.insertNode(c),b.selectNode(c),c=[c]);for(var f=0,h=c.length;f<h;++f)d=c[f],(e=this.getAncestorWithClass(d))&&this.undoToTextNode(d,b,e);1==h?this.selectNode(b,c[0]):(b.setStart(c[0],0),d=c[c.length-1],b.setEnd(d,d.length),this.normalize&&this.postApply(c,b))},selectNode:function(b,c){var d=c.nodeType===a.ELEMENT_NODE,e="canHaveHTML"in c?c.canHaveHTML:!0,f=d?c.innerHTML:c.data;if((f=""===f||f===a.INVISIBLE_SPACE)&&d&&e)try{c.innerHTML=
a.INVISIBLE_SPACE}catch(h){}b.selectNodeContents(c);f&&d?b.collapse(!1):f&&(b.setStartAfter(c),b.setEndAfter(c))},getTextSelectedByRange:function(a,b){var c=b.cloneRange();c.selectNodeContents(a);var d=c.intersection(b),d=d?d.toString():"";c.detach();return d},isAppliedToRange:function(b){var c=[],d,e=b.getNodes([a.TEXT_NODE]);if(!e.length)return(d=this.getAncestorWithClass(b.startContainer))?[d]:!1;for(var f=0,h=e.length,i;f<h;++f){i=this.getTextSelectedByRange(e[f],b);d=this.getAncestorWithClass(e[f]);
if(""!=i&&!d)return!1;c.push(d)}return c},toggleRange:function(a){this.isAppliedToRange(a)?this.undoToRange(a):this.applyToRange(a)}};a.selection.HTMLApplier=h})(wysihtml5,rangy);
wysihtml5.views.View=Base.extend({constructor:function(a,c,b){this.parent=a;this.element=c;this.config=b;this._observeViewChange()},_observeViewChange:function(){var a=this;this.parent.observe("beforeload",function(){a.parent.observe("change_view",function(c){c===a.name?(a.parent.currentView=a,a.show(),setTimeout(function(){a.focus()},0)):a.hide()})})},focus:function(){if(this.element.ownerDocument.querySelector(":focus")!==this.element)try{this.element.focus()}catch(a){}},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(a){var c=a.dom,b=a.browser,d=a.selection;a.views.Composer=a.views.View.extend({name:"composer",CARET_HACK:"<br>",constructor:function(a,b,c){this.base(a,b,c);this.textarea=this.parent.textarea;this._initSandbox()},clear:function(){this.element.innerHTML=b.displaysCaretInEmptyContentEditableCorrectly()?"":this.CARET_HACK},getValue:function(b){var c=this.isEmpty()?"":a.quirks.getCorrectInnerHTML(this.element);b&&(c=this.parent.parse(c));c=a.lang.string(c).replace(a.INVISIBLE_SPACE).by("");
return c=a.lang.string(c).replace(d.PLACEHOLDER_TEXT).by("")},setValue:function(a,b){b&&(a=this.parent.parse(a));this.element.innerHTML=a},show:function(){this.iframe.style.display=this._displayStyle||"";this.disable();this.enable()},hide:function(){this._displayStyle=c.getStyle("display").from(this.iframe);if("none"===this._displayStyle)this._displayStyle=null;this.iframe.style.display="none"},disable:function(){this.element.removeAttribute("contentEditable");this.base()},enable:function(){this.element.setAttribute("contentEditable",
"true");this.base()},getTextContent:function(){return c.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==this.textarea.element.getAttribute("placeholder")},isEmpty:function(){var a=this.element.innerHTML;return""===a||a===this.CARET_HACK||this.hasPlaceholderSet()||""===this.getTextContent()&&!this.element.querySelector("blockquote, ul, ol, img, embed, object, table, iframe, svg, video, audio, button, input, select, textarea")},_initSandbox:function(){var a=
this;this.sandbox=new c.Sandbox(function(){a._create()},{stylesheets:this.config.stylesheets,uaCompatible:"IE=7"});this.iframe=this.sandbox.getIframe();var b=document.createElement("input");b.type="hidden";b.name="_wysihtml5_mode";b.value=1;var d=this.textarea.element;c.insert(this.iframe).after(d);c.insert(b).after(d)},_create:function(){var d=this;this.element=this.sandbox.getDocument().body;this.textarea=this.parent.textarea;this.element.innerHTML=this.textarea.getValue(!0);this.enable();window.rangy.init();
c.copyAttributes("className,spellcheck,title,lang,dir,accessKey".split(",")).from(this.textarea.element).to(this.element);c.addClass(this.element,this.config.composerClassName);this.config.style&&this.style();this.observe();var f=this.config.name;f&&(c.addClass(this.element,f),c.addClass(this.iframe,f));(f="string"===typeof this.config.placeholder?this.config.placeholder:this.textarea.element.getAttribute("placeholder"))&&c.simulatePlaceholder(this.parent,this,f);a.commands.exec(this.element,"styleWithCSS",
!1);this._initAutoLinking();this._initObjectResizing();(this.textarea.element.hasAttribute("autofocus")||document.querySelector(":focus")==this.textarea.element)&&setTimeout(function(){d.focus()},100);b.insertsLineBreaksOnReturn()||a.quirks.insertLineBreakOnReturn(this.element);b.clearsContentEditableCorrectly()||a.quirks.ensureProperClearing(this.element);b.clearsListsInContentEditableCorrectly()||a.quirks.ensureProperClearingOfLists(this.element);this.initSync&&this.config.sync&&this.initSync();
this.textarea.hide();this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var e=b.canDisableAutoLinking(),f=b.doesAutoLinkingInContentEditable();e&&a.commands.exec(this.element,"autoUrlDetect",!1);if(this.config.autoLink){var h=this.sandbox.getDocument();(!f||f&&e)&&this.parent.observe("newword:composer",function(){d.executeAndRestore(h,function(a,b){c.autoLink(b.parentNode)})});var i=h.getElementsByTagName("a"),k=c.autoLink.URL_REG_EXP,j=function(b){b=a.lang.string(c.getTextContent(b)).trim();
"www."===b.substr(0,4)&&(b="http://"+b);return b};c.observe(this.element,"keydown",function(a){if(i.length){var a=d.getSelectedNode(a.target.ownerDocument),b=c.getParentElement(a,{nodeName:"A"},4),e;b&&(e=j(b),setTimeout(function(){var a=j(b);a!==e&&a.match(k)&&b.setAttribute("href",a)},0))}})}},_initObjectResizing:function(){var d=["width","height"],f=d.length,h=this.element;a.commands.exec(h,"enableObjectResizing",this.config.allowObjectResizing);this.config.allowObjectResizing?b.supportsEvent("resizeend")&&
c.observe(h,"resizeend",function(b){for(var b=b.target||b.srcElement,c=b.style,j=0,g;j<f;j++)g=d[j],c[g]&&(b.setAttribute(g,parseInt(c[g],10)),c[g]="");a.quirks.redraw(h)}):b.supportsEvent("resizestart")&&c.observe(h,"resizestart",function(a){a.preventDefault()})}})})(wysihtml5);
(function(a){var c=a.dom,b=document,d=window,e=b.createElement("div"),f="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".split(","),h="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,width,height".split(","),
i="width,height,top,left,right,bottom".split(","),k=["html { height: 100%; }","body { min-height: 100%; padding: 0; margin: 0; margin-top: -1px; padding-top: 1px; }",a.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","body[disabled] { background-color: #eee !important; color: #999 !important; cursor: default !important; }","img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"],
j=function(a){if(a.setActive)a.setActive();else{var e=a.style,f=b.documentElement.scrollTop||b.body.scrollTop,h=b.documentElement.scrollLeft||b.body.scrollLeft,e={position:e.position,top:e.top,left:e.left,WebkitUserSelect:e.WebkitUserSelect};c.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(a);a.focus();c.setStyles(e).on(a);d.scrollTo&&d.scrollTo(h,f)}};a.views.Composer.prototype.style=function(){var g=this,l=b.querySelector(":focus"),n=this.textarea.element,
q=n.hasAttribute("placeholder"),t=q&&n.getAttribute("placeholder");this.focusStylesHost=this.focusStylesHost||e.cloneNode(!1);this.blurStylesHost=this.blurStylesHost||e.cloneNode(!1);q&&n.removeAttribute("placeholder");n===l&&n.blur();c.copyStyles(h).from(n).to(this.iframe).andTo(this.blurStylesHost);c.copyStyles(f).from(n).to(this.element).andTo(this.blurStylesHost);c.insertCSS(k).into(this.element.ownerDocument);j(n);c.copyStyles(h).from(n).to(this.focusStylesHost);c.copyStyles(f).from(n).to(this.focusStylesHost);
var o=a.lang.array(h).without(["display"]);l?l.focus():n.blur();q&&n.setAttribute("placeholder",t);a.browser.hasCurrentStyleProperty()||c.observe(d,"resize",function(){var a=c.getStyle("display").from(n);n.style.display="";c.copyStyles(i).from(n).to(g.iframe).andTo(g.focusStylesHost).andTo(g.blurStylesHost);n.style.display=a});this.parent.observe("focus:composer",function(){c.copyStyles(o).from(g.focusStylesHost).to(g.iframe);c.copyStyles(f).from(g.focusStylesHost).to(g.element)});this.parent.observe("blur:composer",
function(){c.copyStyles(o).from(g.blurStylesHost).to(g.iframe);c.copyStyles(f).from(g.blurStylesHost).to(g.element)});return this}})(wysihtml5);
(function(a){var c=a.dom,b=a.browser,d={66:"bold",73:"italic",85:"underline"};a.views.Composer.prototype.observe=function(){var e=this,f=this.getValue(),h=this.sandbox.getIframe(),i=this.element,k=b.supportsEventsInIframeCorrectly()?i:this.sandbox.getWindow(),j=b.supportsEvent("drop")?["drop","paste"]:["dragdrop","paste"];c.observe(h,"DOMNodeRemoved",function(){clearInterval(g);e.parent.fire("destroy:composer")});var g=setInterval(function(){c.contains(document.documentElement,h)||(clearInterval(g),
e.parent.fire("destroy:composer"))},250);c.observe(k,"focus",function(){e.parent.fire("focus").fire("focus:composer");setTimeout(function(){f=e.getValue()},0)});c.observe(k,"blur",function(){f!==e.getValue()&&e.parent.fire("change").fire("change:composer");e.parent.fire("blur").fire("blur:composer")});c.observe(i,"dragenter",function(){e.parent.fire("unset_placeholder")});b.firesOnDropOnlyWhenOnDragOverIsCancelled()&&c.observe(i,["dragover","dragenter"],function(a){a.preventDefault()});c.observe(i,
j,function(c){var d=c.dataTransfer,f;d&&b.supportsDataTransfer()&&(f=d.getData("text/html")||d.getData("text/plain"));f?(i.focus(),a.commands.exec(i,"insertHTML",f),e.parent.fire("paste").fire("paste:composer"),c.stopPropagation(),c.preventDefault()):setTimeout(function(){e.parent.fire("paste").fire("paste:composer")},0)});c.observe(i,"keyup",function(b){b=b.keyCode;(b===a.SPACE_KEY||b===a.ENTER_KEY)&&e.parent.fire("newword:composer")});this.parent.observe("paste:composer",function(){setTimeout(function(){e.parent.fire("newword:composer")},
0)});b.canSelectImagesInContentEditable()||c.observe(i,"mousedown",function(b){var c=b.target;"IMG"===c.nodeName&&(a.selection.selectNode(c),b.preventDefault())});c.observe(i,"keydown",function(b){var c=d[b.keyCode];if((b.ctrlKey||b.metaKey)&&c)a.commands.exec(i,c),b.preventDefault()});c.observe(i,"keydown",function(b){var c=a.selection.getSelectedNode(i.ownerDocument,!0),d=b.keyCode;if(c&&"IMG"===c.nodeName&&(d===a.BACKSPACE_KEY||d===a.DELETE_KEY))d=c.parentNode,d.removeChild(c),"A"===d.nodeName&&
!d.firstChild&&d.parentNode.removeChild(d),setTimeout(function(){a.quirks.redraw(i)},0),b.preventDefault()});var l={IMG:"Image: ",A:"Link: "};c.observe(i,"mouseover",function(a){var a=a.target,b=a.nodeName;"A"!==b&&"IMG"!==b||(b=l[b]+(a.getAttribute("href")||a.getAttribute("src")),a.setAttribute("title",b))})}})(wysihtml5);
(function(a){a.views.Synchronizer=Base.extend({constructor:function(a,b,d){this.editor=a;this.textarea=b;this.composer=d;this._observe()},fromComposerToTextarea:function(c){this.textarea.setValue(a.lang.string(this.composer.getValue()).trim(),c)},fromTextareaToComposer:function(a){var b=this.textarea.getValue();b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(a){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(a):this.fromComposerToTextarea(a)},
_observe:function(){var c,b=this,d=this.textarea.element.form,e=function(){c=setInterval(function(){b.fromComposerToTextarea()},400)},f=function(){clearInterval(c);c=null};e();d&&(a.dom.observe(d,"submit",function(){b.sync(!0)}),a.dom.observe(d,"reset",function(){setTimeout(function(){b.fromTextareaToComposer()},0)}));this.editor.observe("change_view",function(a){"composer"===a&&!c?(b.fromTextareaToComposer(!0),e()):"textarea"===a&&(b.fromComposerToTextarea(!0),f())});this.editor.observe("destroy:composer",
f)}})})(wysihtml5);
wysihtml5.views.Textarea=wysihtml5.views.View.extend({name:"textarea",constructor:function(a,c,b){this.base(a,c,b);this._observe()},clear:function(){this.element.value=""},getValue:function(a){var c=this.isEmpty()?"":this.element.value;a&&(c=this.parent.parse(c));return c},setValue:function(a,c){c&&(a=this.parent.parse(a));this.element.value=a},hasPlaceholderSet:function(){var a=wysihtml5.browser.supportsPlaceholderAttributeOn(this.element),c=this.element.getAttribute("placeholder")||null,b=this.element.value;
return a&&!b||b===c},isEmpty:function(){return!wysihtml5.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var a=this.element,c=this.parent,b={focusin:"focus",focusout:"blur"},d=wysihtml5.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];c.observe("beforeload",function(){wysihtml5.dom.observe(a,d,function(a){a=b[a.type]||a.type;c.fire(a).fire(a+":textarea")});wysihtml5.dom.observe(a,["paste","drop"],function(){setTimeout(function(){c.fire("paste").fire("paste:textarea")},
0)})})}});
(function(a){var c=a.dom;a.toolbar.Dialog=a.lang.Dispatcher.extend({constructor:function(a,c){this.link=a;this.container=c},_observe:function(){if(!this._observed){var b=this,d=function(a){var c=b._serialize();c==b.elementToChange?b.fire("edit",c):b.fire("save",c);b.hide();a.preventDefault();a.stopPropagation()};c.observe(b.link,"click",function(){c.hasClass(b.link,"wysihtml5-command-dialog-opened")&&setTimeout(function(){b.hide()},0)});c.observe(this.container,"keydown",function(c){var e=c.keyCode;
e===a.ENTER_KEY&&d(c);e===a.ESCAPE_KEY&&b.hide()});c.delegate(this.container,"[data-wysihtml5-dialog-action=save]","click",d);c.delegate(this.container,"[data-wysihtml5-dialog-action=cancel]","click",function(a){b.fire("cancel");b.hide();a.preventDefault();a.stopPropagation()});for(var e=this.container.querySelectorAll("input, select, textarea"),f=0,h=e.length,i=function(){clearInterval(b.interval)};f<h;f++)c.observe(e[f],"change",i);this._observed=!0}},_serialize:function(){for(var a=this.elementToChange||
{},c=this.container.querySelectorAll("[data-wysihtml5-dialog-field]"),e=c.length,f=0;f<e;f++)a[c[f].getAttribute("data-wysihtml5-dialog-field")]=c[f].value;return a},_interpolate:function(){for(var a,c,e=document.querySelector(":focus"),f=this.container.querySelectorAll("[data-wysihtml5-dialog-field]"),h=f.length,i=0;i<h;i++)if(a=f[i],a!==e)c=a.getAttribute("data-wysihtml5-dialog-field"),c=this.elementToChange?this.elementToChange[c]||"":a.defaultValue,a.value=c},show:function(a){var d=this,e=this.container.querySelector("input, select, textarea");
this.elementToChange=a;this._observe();this._interpolate();if(a)this.interval=setInterval(function(){d._interpolate()},500);c.addClass(this.link,"wysihtml5-command-dialog-opened");this.container.style.display="";this.fire("show");if(e&&!a)try{e.focus()}catch(f){}},hide:function(){clearInterval(this.interval);this.elementToChange=null;c.removeClass(this.link,"wysihtml5-command-dialog-opened");this.container.style.display="none";this.fire("hide")}})})(wysihtml5);
(function(a){var c=a.dom,b={position:"relative"},d={left:0,margin:0,opacity:0,overflow:"hidden",padding:0,position:"absolute",top:0,zIndex:1},e={cursor:"inherit",fontSize:"50px",height:"50px",marginTop:"-25px",outline:0,padding:0,position:"absolute",right:"-4px",top:"50%"},f={"x-webkit-speech":"",speech:""};a.toolbar.Speech=function(h,i){var k=document.createElement("input");if(a.browser.supportsSpeechApiOn(k)){var j=document.createElement("div");a.lang.object(d).merge({width:i.offsetWidth+"px",height:i.offsetHeight+
"px"});c.insert(k).into(j);c.insert(j).into(i);c.setStyles(e).on(k);c.setAttributes(f).on(k);c.setStyles(d).on(j);c.setStyles(b).on(i);c.observe(k,"onwebkitspeechchange"in k?"webkitspeechchange":"speechchange",function(){h.execCommand("insertText",k.value);k.value=""});c.observe(k,"click",function(a){c.hasClass(i,"wysihtml5-command-disabled")&&a.preventDefault();a.stopPropagation()})}else i.style.display="none"}})(wysihtml5);
(function(a){var c=a.dom;a.toolbar.Toolbar=Base.extend({constructor:function(b,c){this.editor=b;this.container="string"===typeof c?document.getElementById(c):c;this.composer=b.composer;this._getLinks("command");this._getLinks("action");this._observe();this.show();for(var e=this.container.querySelectorAll("[data-wysihtml5-command=insertSpeech]"),f=e.length,h=0;h<f;h++)new a.toolbar.Speech(this,e[h])},_getLinks:function(b){for(var c=this[b+"Links"]=a.lang.array(this.container.querySelectorAll("a[data-wysihtml5-"+
b+"]")).get(),e=c.length,f=0,h=this[b+"Mapping"]={},i,k,j,g;f<e;f++)i=c[f],k=i.getAttribute("data-wysihtml5-"+b),j=i.getAttribute("data-wysihtml5-"+b+"-value"),g=this._getDialog(i,k),h[k+":"+j]={link:i,name:k,value:j,dialog:g,state:!1}},_getDialog:function(b,c){var e=this,f=this.container.querySelector("[data-wysihtml5-dialog='"+c+"']"),h=this.composer.sandbox.getDocument(),i,k;f&&(i=new a.toolbar.Dialog(b,f),i.observe("show",function(){k=a.selection.getBookmark(h);e.editor.fire("show:dialog",{command:c,
dialogContainer:f,commandLink:b})}),i.observe("save",function(h){e.editor.focus(!1);k&&a.selection.setBookmark(k);e._execCommand(c,h);e.editor.fire("save:dialog",{command:c,dialogContainer:f,commandLink:b})}),i.observe("cancel",function(){e.editor.focus(!1);e.editor.fire("cancel:dialog",{command:c,dialogContainer:f,commandLink:b})}));return i},execCommand:function(a,c){if(!this.commandsDisabled){var e=this.commandMapping[a+":"+c];e&&e.dialog&&!e.state?e.dialog.show():this._execCommand(a,c)}},_execCommand:function(b,
c){this.editor.focus(!1);a.commands.exec(this.composer.element,b,c);this._updateLinkStates()},execAction:function(a){var c=this.editor;switch(a){case "change_view":c.currentView===c.textarea?c.fire("change_view","composer"):c.fire("change_view","textarea")}},_observe:function(){for(var a=this,d=this.editor,e=this.container,f=this.commandLinks.concat(this.actionLinks),h=f.length,i=0;i<h;i++)c.setAttributes({href:"javascript:;",unselectable:"on"}).on(f[i]);c.delegate(e,"[data-wysihtml5-command]","mousedown",
function(a){a.preventDefault()});c.delegate(e,"[data-wysihtml5-command]","click",function(c){var d=c.target,e=d.getAttribute("data-wysihtml5-command"),d=d.getAttribute("data-wysihtml5-command-value");a.execCommand(e,d);c.preventDefault()});c.delegate(e,"[data-wysihtml5-action]","click",function(c){var d=c.target.getAttribute("data-wysihtml5-action");a.execAction(d);c.preventDefault()});d.observe("focus:composer",function(){a.bookmark=null;clearInterval(a.interval);a.interval=setInterval(function(){a._updateLinkStates()},
500)});d.observe("blur:composer",function(){clearInterval(a.interval)});d.observe("destroy:composer",function(){clearInterval(a.interval)});d.observe("change_view",function(d){setTimeout(function(){a.commandsDisabled="composer"!==d;a._updateLinkStates();a.commandsDisabled?c.addClass(e,"wysihtml5-commands-disabled"):c.removeClass(e,"wysihtml5-commands-disabled")},0)})},_updateLinkStates:function(){var b=this.composer.element,d=this.commandMapping,e,f,h;for(e in d)if(h=d[e],this.commandsDisabled?(f=
!1,c.removeClass(h.link,"wysihtml5-command-active"),h.dialog&&h.dialog.hide()):(f=a.commands.state(b,h.name,h.value),a.lang.object(f).isArray()&&(f=1===f.length?f[0]:!0),c.removeClass(h.link,"wysihtml5-command-disabled")),h.state!==f)(h.state=f)?(c.addClass(h.link,"wysihtml5-command-active"),h.dialog&&("object"===typeof f?h.dialog.show(f):h.dialog.hide())):(c.removeClass(h.link,"wysihtml5-command-active"),h.dialog&&h.dialog.hide())},show:function(){this.container.style.display=""},hide:function(){this.container.style.display=
"none"}})})(wysihtml5);wysihtml5.commands={support:function(a,c){return wysihtml5.browser.supportsCommand(a.ownerDocument,c)},exec:function(a,c,b){var d=this[c],e=d&&d.exec;if(e)return e.call(d,a,c,b);try{return a.ownerDocument.execCommand(c,!1,b)}catch(f){}},state:function(a,c,b){var d=this[c],e=d&&d.state;if(e)return e.call(d,a,c,b);try{return a.ownerDocument.queryCommandState(c)}catch(f){return!1}},value:function(a,c){var b=this[c];if(b=b&&b.value)b(a,c);else try{return a.ownerDocument.queryCommandValue(c)}catch(d){return null}}};
(function(a){a.commands.bold={exec:function(c,b){return a.commands.formatInline.exec(c,b,"b")},state:function(c,b){return a.commands.formatInline.state(c,b,"b")},value:function(){}}})(wysihtml5);
(function(a){function c(c,h){var i=c.ownerDocument,k="_wysihtml5-temp-"+(new Date).getTime(),j=0,g,l,n;a.commands.formatInline.exec(c,b,d,k,/non-matching-class/g);g=i.querySelectorAll(d+"."+k);for(k=g.length;j<k;j++)for(n in l=g[j],l.removeAttribute("class"),h)l.setAttribute(n,h[n]);j=l;1===k&&(n=e.getTextContent(l),k=!!l.querySelector("*"),n=""===n||n===a.INVISIBLE_SPACE,!k&&n&&(e.setTextContent(l,l.href),i=i.createTextNode(" "),a.selection.setAfter(l),a.selection.insertNode(i),j=i));a.selection.setAfter(j)}
var b,d="A",e=a.dom;a.commands.createLink={exec:function(b,d,i){var k=b.ownerDocument,j=this.state(b,d);j?a.selection.executeAndRestore(k,function(){for(var a=j.length,b=0,c,d,f;b<a;b++)c=j[b],d=e.getParentElement(c,{nodeName:"code"}),f=e.getTextContent(c),f.match(e.autoLink.URL_REG_EXP)&&!d?e.renameElement(c,"code"):e.replaceWithChildNodes(c)}):(i="object"===typeof i?i:{href:i},c(b,i))},state:function(b,c){return a.commands.formatInline.state(b,c,"A")},value:function(){return b}}})(wysihtml5);
(function(a){var c=/wysiwyg-font-size-[a-z]+/g;a.commands.fontSize={exec:function(b,d,e){return a.commands.formatInline.exec(b,d,"span","wysiwyg-font-size-"+e,c)},state:function(b,d,e){return a.commands.formatInline.state(b,d,"span","wysiwyg-font-size-"+e,c)},value:function(){}}})(wysihtml5);
(function(a){var c=/wysiwyg-color-[a-z]+/g;a.commands.foreColor={exec:function(b,d,e){return a.commands.formatInline.exec(b,d,"span","wysiwyg-color-"+e,c)},state:function(b,d,e){return a.commands.formatInline.state(b,d,"span","wysiwyg-color-"+e,c)},value:function(){}}})(wysihtml5);
(function(a){function c(b){for(b=b.previousSibling;b&&b.nodeType===a.TEXT_NODE&&!a.lang.string(b.data).trim();)b=b.previousSibling;return b}function b(b){for(b=b.nextSibling;b&&b.nodeType===a.TEXT_NODE&&!a.lang.string(b.data).trim();)b=b.nextSibling;return b}function d(a){return"BR"===a.nodeName?!0:"block"===h.getStyle("display").from(a)?!0:!1}function e(b,c,d,e){if(e)var f=h.observe(b,"DOMNodeInserted",function(b){b=b.target;b.nodeType===a.ELEMENT_NODE&&"inline"!==h.getStyle("display").from(b).substr(0,
6)&&(b.className+=" "+e)});b.execCommand(c,!1,d);f&&f.stop()}function f(a){i.selectLine(a.ownerDocument);i.surround(a);var d=b(a),e=c(a);d&&"BR"===d.nodeName&&d.parentNode.removeChild(d);e&&"BR"===e.nodeName&&e.parentNode.removeChild(e);(d=a.lastChild)&&"BR"===d.nodeName&&d.parentNode.removeChild(d);i.selectNode(a)}var h=a.dom,i=a.selection,k="H1,H2,H3,H4,H5,H6,P,BLOCKQUOTE,DIV".split(",");a.commands.formatBlock={exec:function(j,g,l,n,q){var t=j.ownerDocument,o=this.state(j,g,l,n,q),w,l="string"===
typeof l?l.toUpperCase():l;if(o)i.executeAndRestoreSimple(t,function(){if(q)o.className=o.className.replace(q,"");var e=!!a.lang.string(o.className).trim();if(!e&&o.nodeName===(l||"DIV")){var e=o,f=e.ownerDocument,g=b(e),i=c(e);g&&!d(g)&&e.parentNode.insertBefore(f.createElement("br"),g);i&&!d(i)&&e.parentNode.insertBefore(f.createElement("br"),e);h.replaceWithChildNodes(o)}else e&&h.renameElement(o,"DIV")});else{if(null===l||a.lang.array(k).contains(l))if(w=i.getSelectedNode(t),o=h.getParentElement(w,
{nodeName:k})){i.executeAndRestoreSimple(t,function(){l&&(o=h.renameElement(o,l));if(n){var a=o;a.className?(a.className=a.className.replace(q,""),a.className+=" "+n):a.className=n}});return}if(a.commands.support(j,g))e(t,g,l||"DIV",n);else{o=t.createElement(l||"DIV");if(n)o.className=n;f(o)}}},state:function(a,b,c,d,e){c="string"===typeof c?c.toUpperCase():c;a=i.getSelectedNode(a.ownerDocument);return h.getParentElement(a,{nodeName:c,className:d,classRegExp:e})},value:function(){}}})(wysihtml5);
(function(a){function c(c,f,h){var i=c+":"+f;if(!d[i]){var k=d,j=a.selection.HTMLApplier,g=b[c],c=g?[c.toLowerCase(),g.toLowerCase()]:[c.toLowerCase()];k[i]=new j(c,f,h,!0)}return d[i]}var b={strong:"b",em:"i",b:"strong",i:"em"},d={};a.commands.formatInline={exec:function(b,d,h,i,k){b=a.selection.getRange(b.ownerDocument);if(!b)return!1;c(h,i,k).toggleRange(b);a.selection.setSelection(b)},state:function(d,f,h,i,k){d=d.ownerDocument;f=b[h]||h;if(!a.dom.hasElementWithTagName(d,h)&&!a.dom.hasElementWithTagName(d,
f))return!1;if(i&&!a.dom.hasElementWithClassName(d,i))return!1;d=a.selection.getRange(d);return!d?!1:c(h,i,k).isAppliedToRange(d)},value:function(){}}})(wysihtml5);(function(a){a.commands.insertHTML={exec:function(c,b,d){a.commands.support(c,b)?c.ownerDocument.execCommand(b,!1,d):a.selection.insertHTML(c.ownerDocument,d)},state:function(){return!1},value:function(){}}})(wysihtml5);
(function(a){a.commands.insertImage={exec:function(c,b,d){var d="object"===typeof d?d:{src:d},e=c.ownerDocument,b=this.state(c),f;if(b)a.selection.setBefore(b),d=b.parentNode,d.removeChild(b),a.dom.removeEmptyTextNodes(d),"A"===d.nodeName&&!d.firstChild&&(a.selection.setAfter(d),d.parentNode.removeChild(d)),a.quirks.redraw(c);else{b=e.createElement("IMG");for(f in d)b[f]=d[f];a.selection.insertNode(b);a.selection.setAfter(b)}},state:function(c){var c=c.ownerDocument,b;if(!a.dom.hasElementWithTagName(c,
"IMG"))return!1;b=a.selection.getSelectedNode(c);if(!b)return!1;if("IMG"===b.nodeName)return b;if(b.nodeType!==a.ELEMENT_NODE)return!1;b=a.selection.getText(c);if(b=a.lang.string(b).trim())return!1;c=a.selection.getNodes(c,a.ELEMENT_NODE,function(a){return"IMG"===a.nodeName});return 1!==c.length?!1:c[0]},value:function(a){return(a=this.state(a))&&a.src}}})(wysihtml5);
(function(a){var c="<br>"+(a.browser.needsSpaceAfterLineBreak()?" ":"");a.commands.insertLineBreak={exec:function(b,d){a.commands.support(b,d)?(b.ownerDocument.execCommand(d,!1,null),a.browser.autoScrollsToCaret()||a.selection.scrollIntoView(b)):a.commands.exec(b,"insertHTML",c)},state:function(){return!1},value:function(){}}})(wysihtml5);
(function(a){a.commands.insertOrderedList={exec:function(c,b){var d=c.ownerDocument,e,f,h;a.commands.support(c,b)?d.execCommand(b,!1,null):(e=a.selection.getSelectedNode(d),(h=a.dom.getParentElement(e,{nodeName:["UL","OL"]},4))?a.selection.executeAndRestoreSimple(d,function(){"OL"===h.nodeName?a.dom.resolveList(h):("UL"===h.nodeName||"MENU"===h.nodeName)&&a.dom.renameElement(h,"ol")}):(f=d.createElement("span"),a.selection.surround(f),e=""===f.innerHTML||f.innerHTML===a.INVISIBLE_SPACE,a.selection.executeAndRestoreSimple(d,
function(){h=a.dom.convertToList(f,"ol")}),e&&a.selection.selectNode(h.querySelector("li"))))},state:function(a,b){try{return a.ownerDocument.queryCommandState(b)}catch(d){return!1}},value:function(){}}})(wysihtml5);
(function(a){a.commands.insertUnorderedList={exec:function(c,b){var d=c.ownerDocument,e,f,h;a.commands.support(c,b)?d.execCommand(b,!1,null):(e=a.selection.getSelectedNode(d),(h=a.dom.getParentElement(e,{nodeName:["UL","OL"]}))?a.selection.executeAndRestoreSimple(d,function(){"UL"===h.nodeName?a.dom.resolveList(h):("OL"===h.nodeName||"MENU"===h.nodeName)&&a.dom.renameElement(h,"ul")}):(f=d.createElement("span"),a.selection.surround(f),e=""===f.innerHTML||f.innerHTML===a.INVISIBLE_SPACE,a.selection.executeAndRestoreSimple(d,
function(){h=a.dom.convertToList(f,"ul")}),e&&a.selection.selectNode(h.querySelector("li"))))},state:function(a,b){try{return a.ownerDocument.queryCommandState(b)}catch(d){return!1}},value:function(){}}})(wysihtml5);(function(a){a.commands.italic={exec:function(c,b){return a.commands.formatInline.exec(c,b,"i")},state:function(c,b){return a.commands.formatInline.state(c,b,"i")},value:function(){}}})(wysihtml5);
(function(a){var c=/wysiwyg-text-align-[a-z]+/g;a.commands.justifyCenter={exec:function(b){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-center",c)},state:function(b){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-center",c)},value:function(){}}})(wysihtml5);
(function(a){var c=/wysiwyg-text-align-[a-z]+/g;a.commands.justifyLeft={exec:function(b){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-left",c)},state:function(b){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-left",c)},value:function(){}}})(wysihtml5);
(function(a){var c=/wysiwyg-text-align-[a-z]+/g;a.commands.justifyRight={exec:function(b){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-right",c)},state:function(b){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-right",c)},value:function(){}}})(wysihtml5);
(function(a){var c=/wysiwyg-text-decoration-underline/g;a.commands.underline={exec:function(b,d){return a.commands.formatInline.exec(b,d,"span","wysiwyg-text-decoration-underline",c)},state:function(b,d){return a.commands.formatInline.state(b,d,"span","wysiwyg-text-decoration-underline",c)},value:function(){}}})(wysihtml5);
(function(a){var c={name:void 0,style:!0,toolbar:void 0,autoLink:!0,parserRules:{tags:{br:{},span:{},div:{},p:{}},classes:{}},parser:a.dom.parse,composerClassName:"wysihtml5-editor",bodyClassName:"wysihtml5-supported",stylesheets:[],placeholderText:void 0,allowObjectResizing:!0};a.Editor=a.lang.Dispatcher.extend({constructor:function(b,d){this.textareaElement="string"===typeof b?document.getElementById(b):b;this.config=a.lang.object({}).merge(c).merge(d).get();this.currentView=this.textarea=new a.views.Textarea(this,
this.textareaElement,this.config);if(this._isCompatible=a.browser.supported()){a.dom.addClass(document.body,this.config.bodyClassName);this.currentView=this.composer=new a.views.Composer(this,this.textareaElement,this.config);"function"===typeof this.config.parser&&this._initParser();this.observe("beforeload",function(){this.synchronizer=new a.views.Synchronizer(this,this.textarea,this.composer);if(this.config.toolbar)this.toolbar=new a.toolbar.Toolbar(this,this.config.toolbar)});try{console.log("Heya! This page is using wysihtml5 for rich text editing. Check out https://github.com/xing/wysihtml5")}catch(e){}}else{var f=
this;setTimeout(function(){f.fire("beforeload").fire("load")},0)}},isCompatible:function(){return this._isCompatible},clear:function(){this.currentView.clear();return this},getValue:function(a){return this.currentView.getValue(a)},setValue:function(a,c){if(!a)return this.clear();this.currentView.setValue(a,c);return this},focus:function(a){this.currentView.focus(a);return this},disable:function(){this.currentView.disable();return this},enable:function(){this.currentView.enable();return this},isEmpty:function(){return this.currentView.isEmpty()},
hasPlaceholderSet:function(){return this.currentView.hasPlaceholderSet()},parse:function(b){var c=this.config.parser(b,this.config.parserRules,this.composer.sandbox.getDocument(),!0);"object"===typeof b&&a.quirks.redraw(b);return c},_initParser:function(){this.observe("paste:composer",function(){var b=this;a.selection.executeAndRestore(this.composer.sandbox.getDocument(),function(){a.quirks.cleanPastedHTML(b.composer.element);b.parse(b.composer.element)},!0)});this.observe("paste:textarea",function(){this.textarea.setValue(this.parse(this.textarea.getValue()))})}})})(wysihtml5);
?>