[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 (function(e,t){t.rangy=e()})(function(){function u(n,r){var i=typeof n[r];return i==t||i==e&&!!n[r]||i=="unknown"}function a(t,n){return typeof t[n]==e&&!!t[n]}function f(e,t){return typeof e[t]!=n}function l(e){return function(t,n){var r=n.length;while(r--)if(!e(t,n[r]))return!1;return!0}}function d(e){return e&&c(e,o)&&p(e,s)}function v(e){return a(e,"body")?e.body:e.getElementsByTagName("body")[0]}function E(e){typeof console!=n&&u(console,"log")&&console.log(e)}function S(e,t){y&&t?alert(e):E(e)}function x(e){w.initialized=!0,w.supported=!1,S("Rangy is not supported in this environment. Reason: "+e,w.config.alertOnFail)}function T(e){S("Rangy warning: "+e,w.config.alertOnWarn)}function L(e){return e.message||e.description||String(e)}function A(){if(!y||w.initialized)return;var e,t=!1,n=!1;u(document,"createRange")&&(e=document.createRange(),c(e,i)&&p(e,r)&&(t=!0));var s=v(document);if(!s||s.nodeName.toLowerCase()!="body"){x("No body element found");return}s&&u(s,"createTextRange")&&(e=s.createTextRange(),d(e)&&(n=!0));if(!t&&!n){x("Neither Range nor TextRange are available");return}w.initialized=!0,w.features={implementsDomRange:t,implementsTextRange:n};var o,a;for(var f in g)(o=g[f])instanceof P&&o.init(o,w);for(var l=0,h=k.length;l<h;++l)try{k[l](w)}catch(m){a="Rangy init listener threw an exception. Continuing. Detail: "+L(m),E(a)}}function O(e,t,n){n&&(e+=" in module "+n.name),w.warn("DEPRECATED: "+e+" is deprecated. Please use "+t+" instead.")}function M(e,t,n,r){e[t]=function(){return O(t,n,r),e[n].apply(e,b.toArray(arguments))}}function D(e){e=e||window,A();for(var t=0,n=_.length;t<n;++t)_[t](e)}function P(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function H(e,t,n){var r=new P(e,t,function(t){if(!t.initialized){t.initialized=!0;try{n(w,t),t.supported=!0}catch(r){var i="Module '"+e+"' failed to load: "+L(r);E(i),r.stack&&E(r.stack)}}});return g[e]=r,r}function B(){}function j(){}var e="object",t="function",n="undefined",r=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],i=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],s=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],o=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],c=l(u),h=l(a),p=l(f),m=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,r=e.length;n<r;++n)t(e[n],n)},g={},y=typeof window!=n&&typeof document!=n,b={isHostMethod:u,isHostObject:a,isHostProperty:f,areHostMethods:c,areHostObjects:h,areHostProperties:p,isTextRange:d,getBody:v,forEach:m},w={version:"1.3.0",initialized:!1,isBrowser:y,supported:!0,util:b,features:{},modules:g,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==n?!0:rangyAutoInitialize}};w.fail=x,w.warn=T;var N;(({})).hasOwnProperty?(b.extend=N=function(e,t,n){var r,i;for(var s in t)t.hasOwnProperty(s)&&(r=e[s],i=t[s],n&&r!==null&&typeof r=="object"&&i!==null&&typeof i=="object"&&N(r,i,!0),e[s]=i);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},b.createOptions=function(e,t){var n={};return N(n,t),e&&N(n,e),n}):x("hasOwnProperty not supported"),y||x("Rangy can only run in a browser"),function(){var e;if(y){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{n.call(t.childNodes,0)[0].nodeType==1&&(e=function(e){return n.call(e,0)})}catch(r){}}e||(e=function(e){var t=[];for(var n=0,r=e.length;n<r;++n)t[n]=e[n];return t}),b.toArray=e}();var C;y&&(u(document,"addEventListener")?C=function(e,t,n){e.addEventListener(t,n,!1)}:u(document,"attachEvent")?C=function(e,t,n){e.attachEvent("on"+t,n)}:x("Document does not have required addEventListener or attachEvent method"),b.addListener=C);var k=[];b.deprecationNotice=O,b.createAliasForDeprecatedMethod=M,w.init=A,w.addInitListener=function(e){w.initialized?e(w):k.push(e)};var _=[];w.addShimListener=function(e){_.push(e)},y&&(w.shim=w.createMissingNativeApi=D,M(w,"createMissingNativeApi","shim")),P.prototype={init:function(){var e=this.dependencies||[];for(var t=0,n=e.length,r,i;t<n;++t){i=e[t],r=g[i];if(!r||!(r instanceof P))throw new Error("required module '"+i+"' not found");r.init();if(!r.supported)throw new Error("required module '"+i+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){w.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){w.warn("DEPRECATED: "+e+" in module "+this.name+" is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},w.createModule=function(e){var t,n;arguments.length==2?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var r=H(e,n,t);w.initialized&&w.supported&&r.init()},w.createCoreModule=function(e,t,n){H(e,t,n)},w.RangePrototype=B,w.rangePrototype=new B,w.selectionPrototype=new j,w.createCoreModule("DomUtil",[],function(e,t){function a(e){var t;return typeof e.namespaceURI==n||(t=e.namespaceURI)===null||t=="http://www.w3.org/1999/xhtml"}function f(e){var t=e.parentNode;return t.nodeType==1?t:null}function l(e){var t=0;while(e=e.previousSibling)++t;return t}function c(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}}function h(e,t){var n=[],r;for(r=e;r;r=r.parentNode)n.push(r);for(r=t;r;r=r.parentNode)if(u(n,r))return r;return null}function p(e,t,n){var r=n?t:t.parentNode;while(r){if(r===e)return!0;r=r.parentNode}return!1}function d(e,t){return p(e,t,!0)}function v(e,t,n){var r,i=n?e:e.parentNode;while(i){r=i.parentNode;if(r===t)return i;i=r}return null 2 }function m(e){var t=e.nodeType;return t==3||t==4||t==8}function g(e){if(!e)return!1;var t=e.nodeType;return t==3||t==8}function y(e,t){var n=t.nextSibling,r=t.parentNode;return n?r.insertBefore(e,n):r.appendChild(e),e}function b(e,t,n){var r=e.cloneNode(!1);r.deleteData(0,t),e.deleteData(t,e.length-t),y(r,e);if(n)for(var i=0,s;s=n[i++];)s.node==e&&s.offset>t?(s.node=r,s.offset-=t):s.node==e.parentNode&&s.offset>l(e)&&++s.offset;return r}function w(e){if(e.nodeType==9)return e;if(typeof e.ownerDocument!=n)return e.ownerDocument;if(typeof e.document!=n)return e.document;if(e.parentNode)return w(e.parentNode);throw t.createError("getDocument: no document found for node")}function E(e){var r=w(e);if(typeof r.defaultView!=n)return r.defaultView;if(typeof r.parentWindow!=n)return r.parentWindow;throw t.createError("Cannot get a window object for node")}function S(e){if(typeof e.contentDocument!=n)return e.contentDocument;if(typeof e.contentWindow!=n)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function x(e){if(typeof e.contentWindow!=n)return e.contentWindow;if(typeof e.contentDocument!=n)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function T(e){return e&&r.isHostMethod(e,"setTimeout")&&r.isHostObject(e,"document")}function N(e,t,n){var i;e?r.isHostProperty(e,"nodeType")?i=e.nodeType==1&&e.tagName.toLowerCase()=="iframe"?S(e):w(e):T(e)&&(i=e.document):i=document;if(!i)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return i}function C(e){var t;while(t=e.parentNode)e=t;return e}function k(e,n,r,i){var s,o,u,a,f;if(e==r)return n===i?0:n<i?-1:1;if(s=v(r,e,!0))return n<=l(s)?-1:1;if(s=v(e,r,!0))return l(s)<i?-1:1;o=h(e,r);if(!o)throw new Error("comparePoints error: nodes have no common ancestor");u=e===o?o:v(e,o,!0),a=r===o?o:v(r,o,!0);if(u===a)throw t.createError("comparePoints got to case 4 and childA and childB are the same!");f=o.firstChild;while(f){if(f===u)return-1;if(f===a)return 1;f=f.nextSibling}}function A(e){var t;try{return t=e.parentNode,!1}catch(n){return!0}}function O(e){if(!e)return"[No node]";if(L&&A(e))return"[Broken node]";if(m(e))return'"'+e.data+'"';if(e.nodeType==1){var t=e.id?' id="'+e.id+'"':"";return"<"+e.nodeName+t+">[index:"+l(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function M(e){var t=w(e).createDocumentFragment(),n;while(n=e.firstChild)t.appendChild(n);return t}function D(e,t,n){var r=i(e),s=e.createElement("div");s.contentEditable=""+!!n,t&&(s.innerHTML=t);var o=r.firstChild;return o?r.insertBefore(s,o):r.appendChild(s),s}function P(e){return e.parentNode.removeChild(e)}function H(e){this.root=e,this._next=e}function B(e){return new H(e)}function j(e,t){this.node=e,this.offset=t}function F(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var n="undefined",r=e.util,i=r.getBody;r.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),r.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var s=document.createElement("div");r.areHostMethods(s,["insertBefore","appendChild","cloneNode"]||!r.areHostObjects(s,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),r.isHostProperty(s,"innerHTML")||t.fail("Element is missing innerHTML property");var o=document.createTextNode("test");r.areHostMethods(o,["splitText","deleteData","insertData","appendData","cloneNode"]||!r.areHostObjects(s,["previousSibling","nextSibling","childNodes","parentNode"])||!r.areHostProperties(o,["data"]))||t.fail("Incomplete Text Node implementation");var u=function(e,t){var n=e.length;while(n--)if(e[n]===t)return!0;return!1},L=!1;(function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="<br />",L=A(n),e.features.crashyTextNodes=L})();var _;typeof window.getComputedStyle!=n?_=function(e,t){return E(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=n?_=function(e,t){return e.currentStyle?e.currentStyle[t]:""}:t.fail("No means of obtaining computed style properties found"),H.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e=this._current=this._next,t,n;if(this._current){t=e.firstChild;if(t)this._next=t;else{n=null;while(e!==this.root&&!(n=e.nextSibling))e=e.parentNode;this._next=n}}return this._current},detach:function(){this._current=this._next=this.root=null}},j.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+O(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},F.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},F.prototype.toString=function(){return this.message},e.dom={arrayContains:u,isHtmlNamespace:a,parentElement:f,getNodeIndex:l,getNodeLength:c,getCommonAncestor:h,isAncestorOf:p,isOrIsAncestorOf:d,getClosestAncestorIn:v,isCharacterDataNode:m,isTextOrCommentNode:g,insertAfter:y,splitDataNode:b,getDocument:w,getWindow:E,getIframeWindow:x,getIframeDocument:S,getBody:i,isWindow:T,getContentDocument:N,getRootContainer:C,comparePoints:k,isBrokenNode:A,inspectNode:O,getComputedStyleProperty:_,createTestElement:D,removeNode:P,fragmentFromNodeChildren:M,createIterator:B,DomPosition:j},e.DOMException=F}),w.createCoreModule("DomRange",["DomUtil"],function(e,t){function y(e,t){return e.nodeType!=3&&(a(e,t.startContainer)||a(e,t.endContainer))}function b(e){return e.document||f(e.startContainer)}function w(e){return v(e.startContainer)}function E(e){return new i(e.parentNode,u(e))}function S(e){return new i(e.parentNode,u 3 (e)+1)}function x(e,t,r){var i=e.nodeType==11?e.firstChild:e;return o(t)?r==t.length?n.insertAfter(e,t):t.parentNode.insertBefore(e,r==0?t:c(t,r)):r>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[r]),i}function T(e,t,n){K(e),K(t);if(b(t)!=b(e))throw new s("WRONG_DOCUMENT_ERR");var r=l(e.startContainer,e.startOffset,t.endContainer,t.endOffset),i=l(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return n?r<=0&&i>=0:r<0&&i>0}function N(e){var t;for(var n,r=b(e.range).createDocumentFragment(),i;n=e.next();){t=e.isPartiallySelectedSubtree(),n=n.cloneNode(!t),t&&(i=e.getSubtreeIterator(),n.appendChild(N(i)),i.detach());if(n.nodeType==10)throw new s("HIERARCHY_REQUEST_ERR");r.appendChild(n)}return r}function C(e,t,r){var i,s;r=r||{stop:!1};for(var o,u;o=e.next();)if(e.isPartiallySelectedSubtree()){if(t(o)===!1){r.stop=!0;return}u=e.getSubtreeIterator(),C(u,t,r),u.detach();if(r.stop)return}else{i=n.createIterator(o);while(s=i.next())if(t(s)===!1){r.stop=!0;return}}}function k(e){var t;while(e.next())e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),k(t),t.detach()):e.remove()}function L(e){for(var t,n=b(e.range).createDocumentFragment(),r;t=e.next();){e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),r=e.getSubtreeIterator(),t.appendChild(L(r)),r.detach()):e.remove();if(t.nodeType==10)throw new s("HIERARCHY_REQUEST_ERR");n.appendChild(t)}return n}function A(e,t,n){var r=!!t&&!!t.length,i,s=!!n;r&&(i=new RegExp("^("+t.join("|")+")$"));var u=[];return C(new M(e,!1),function(t){if(r&&!i.test(t.nodeType))return;if(s&&!n(t))return;var a=e.startContainer;if(t==a&&o(a)&&e.startOffset==a.length)return;var f=e.endContainer;if(t==f&&o(f)&&e.endOffset==0)return;u.push(t)}),u}function O(e){var t=typeof e.getName=="undefined"?"Range":e.getName();return"["+t+"("+n.inspectNode(e.startContainer)+":"+e.startOffset+", "+n.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function M(e,t){this.range=e,this.clonePartiallySelectedTextNodes=t;if(!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&o(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc===n&&!o(this.sc)?this.sc.childNodes[this.so]:h(this.sc,n,!0),this._last=this.ec===n&&!o(this.ec)?this.ec.childNodes[this.eo-1]:h(this.ec,n,!0))}}function j(e){return function(t,n){var r,i=n?t:t.parentNode;while(i){r=i.nodeType;if(d(e,r))return i;i=i.parentNode}return null}}function R(e,t){if(q(e,t))throw new s("INVALID_NODE_TYPE_ERR")}function U(e,t){if(!d(t,e.nodeType))throw new s("INVALID_NODE_TYPE_ERR")}function z(e,t){if(t<0||t>(o(e)?e.length:e.childNodes.length))throw new s("INDEX_SIZE_ERR")}function W(e,t){if(F(e,!0)!==F(t,!0))throw new s("WRONG_DOCUMENT_ERR")}function X(e){if(I(e,!0))throw new s("NO_MODIFICATION_ALLOWED_ERR")}function V(e,t){if(!e)throw new s(t)}function $(e,t){return t<=(o(e)?e.length:e.childNodes.length)}function J(e){return!!e.startContainer&&!!e.endContainer&&(!m||!n.isBrokenNode(e.startContainer)&&!n.isBrokenNode(e.endContainer))&&v(e.startContainer)==v(e.endContainer)&&$(e.startContainer,e.startOffset)&&$(e.endContainer,e.endOffset)}function K(e){if(!J(e))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+e.inspect()+")")}function et(e,t){K(e);var n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,a=n===i;o(i)&&s>0&&s<i.length&&c(i,s,t),o(n)&&r>0&&r<n.length&&(n=c(n,r,t),a?(s-=r,i=n):i==n.parentNode&&s>=u(n)&&s++,r=0),e.setStartAndEnd(n,r,i,s)}function tt(e){K(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}function ct(e){e.START_TO_START=rt,e.START_TO_END=it,e.END_TO_END=st,e.END_TO_START=ot,e.NODE_BEFORE=ut,e.NODE_AFTER=at,e.NODE_BEFORE_AND_AFTER=ft,e.NODE_INSIDE=lt}function ht(e){ct(e),ct(e.prototype)}function pt(e,t){return function(){K(this);var n=this.startContainer,r=this.startOffset,i=this.commonAncestorContainer,s=new M(this,!0),o,u;n!==i&&(o=h(n,i,!0),u=S(o),n=u.node,r=u.offset),C(s,X),s.reset();var a=e(s);return s.detach(),t(this,n,r,n,r),a}}function dt(t,n){function i(e,t){return function(n){U(n,_),U(v(n),D);var r=(e?E:S)(n);(t?s:a)(this,r.node,r.offset)}}function s(e,t,r){var i=e.endContainer,s=e.endOffset;if(t!==e.startContainer||r!==e.startOffset){if(v(t)!=v(i)||l(t,r,i,s)==1)i=t,s=r;n(e,t,r,i,s)}}function a(e,t,r){var i=e.startContainer,s=e.startOffset;if(t!==e.endContainer||r!==e.endOffset){if(v(t)!=v(i)||l(t,r,i,s)==-1)i=t,s=r;n(e,i,s,t,r)}}var f=function(){};f.prototype=e.rangePrototype,t.prototype=new f,r.extend(t.prototype,{setStart:function(e,t){R(e,!0),z(e,t),s(this,e,t)},setEnd:function(e,t){R(e,!0),z(e,t),a(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],r=e[1],i=t,s=r;switch(e.length){case 3:s=e[2];break;case 4:i=e[2],s=e[3]}n(this,t,r,i,s)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:i(!0,!0),setStartAfter:i(!1,!0),setEndBefore:i(!0,!1),setEndAfter:i(!1,!1),collapse:function(e){K(this),e?n(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):n(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){R(e,!0),n(this,e,0,e,p(e))},selectNode:function(e){R(e,!1),U(e,_);var t=E(e),r=S(e);n(this,t.node,t.offset,r.node,r.offset)},extractContents:pt(L,n),deleteContents:pt(k,n),canSurroundContents:function(){K(this),X(this.startContainer),X(this.endContainer);var e=new M(this,!0),t=e._first&&y(e._first,this)||e._last&&y(e._last,this);return e.detach(),!t},splitBoundaries:function(){et(this)},splitBoundariesPreservingPositions:function(e){et(this,e)},normalizeBoundaries:function(){K(this);var e=this.startContainer,t=this.startOffset,r=this.endContainer,i=this.endOffset,s=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(r=e,i=e.length,e.appendData(t.data),g(t))},a=function( 4 n){var s=n.previousSibling;if(s&&s.nodeType==n.nodeType){e=n;var o=n.length;t=s.length,n.insertData(0,s.data),g(s);if(e==r)i+=t,r=e;else if(r==n.parentNode){var a=u(n);i==a?(r=n,i=o):i>a&&i--}}},f=!0,l;if(o(r))i==r.length?s(r):i==0&&(l=r.previousSibling,l&&l.nodeType==r.nodeType&&(i=l.length,e==r&&(f=!1),l.appendData(r.data),g(r),r=l));else{if(i>0){var c=r.childNodes[i-1];c&&o(c)&&s(c)}f=!this.collapsed}if(f){if(o(e))t==0?a(e):t==e.length&&(l=e.nextSibling,l&&l.nodeType==e.nodeType&&(r==l&&(r=e,i+=e.length),e.appendData(l.data),g(l)));else if(t<e.childNodes.length){var h=e.childNodes[t];h&&o(h)&&a(h)}}else e=r,t=i;n(this,e,t,r,i)},collapseToPoint:function(e,t){R(e,!0),z(e,t),this.setStartAndEnd(e,t)}}),ht(t)}function vt(e){e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset,e.commonAncestorContainer=e.collapsed?e.startContainer:n.getCommonAncestor(e.startContainer,e.endContainer)}function mt(e,t,r,i,s){e.startContainer=t,e.startOffset=r,e.endContainer=i,e.endOffset=s,e.document=n.getDocument(t),vt(e)}function gt(e){this.startContainer=e,this.startOffset=0,this.endContainer=e,this.endOffset=0,this.document=e,vt(this)}var n=e.dom,r=e.util,i=n.DomPosition,s=e.DOMException,o=n.isCharacterDataNode,u=n.getNodeIndex,a=n.isOrIsAncestorOf,f=n.getDocument,l=n.comparePoints,c=n.splitDataNode,h=n.getClosestAncestorIn,p=n.getNodeLength,d=n.arrayContains,v=n.getRootContainer,m=e.features.crashyTextNodes,g=n.removeNode;M.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 e=this._current=this._next;return e&&(this._next=e!==this._last?e.nextSibling:null,o(e)&&this.clonePartiallySelectedTextNodes&&(e===this.ec&&(e=e.cloneNode(!0)).deleteData(this.eo,e.length-this.eo),this._current===this.sc&&(e=e.cloneNode(!0)).deleteData(0,this.so))),e},remove:function(){var e=this._current,t,n;!o(e)||e!==this.sc&&e!==this.ec?e.parentNode&&g(e):(t=e===this.sc?this.so:0,n=e===this.ec?this.eo:e.length,t!=n&&e.deleteData(t,n-t))},isPartiallySelectedSubtree:function(){var e=this._current;return y(e,this.range)},getSubtreeIterator:function(){var e;if(this.isSingleCharacterDataNode)e=this.range.cloneRange(),e.collapse(!1);else{e=new gt(b(this.range));var t=this._current,n=t,r=0,i=t,s=p(t);a(t,this.sc)&&(n=this.sc,r=this.so),a(t,this.ec)&&(i=this.ec,s=this.eo),mt(e,n,r,i,s)}return new M(e,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var _=[1,3,4,5,7,8,10],D=[2,9,11],P=[5,6,10,12],H=[1,3,4,5,7,8,10,11],B=[1,3,4,5,7,8],F=j([9,11]),I=j(P),q=j([6,10,12]),Q=document.createElement("style"),G=!1;try{Q.innerHTML="<b>x</b>",G=Q.firstChild.nodeType==3}catch(Y){}e.features.htmlParsingConforms=G;var Z=G?function(e){var t=this.startContainer,r=f(t);if(!t)throw new s("INVALID_STATE_ERR");var i=null;return t.nodeType==1?i=t:o(t)&&(i=n.parentElement(t)),i===null||i.nodeName=="HTML"&&n.isHtmlNamespace(f(i).documentElement)&&n.isHtmlNamespace(i)?i=r.createElement("body"):i=i.cloneNode(!1),i.innerHTML=e,n.fragmentFromNodeChildren(i)}:function(e){var t=b(this),r=t.createElement("body");return r.innerHTML=e,n.fragmentFromNodeChildren(r)},nt=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],rt=0,it=1,st=2,ot=3,ut=0,at=1,ft=2,lt=3;r.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){K(this),W(this.startContainer,t.startContainer);var n,r,i,s,o=e==ot||e==rt?"start":"end",u=e==it||e==rt?"start":"end";return n=this[o+"Container"],r=this[o+"Offset"],i=t[u+"Container"],s=t[u+"Offset"],l(n,r,i,s)},insertNode:function(e){K(this),U(e,H),X(this.startContainer);if(a(e,this.startContainer))throw new s("HIERARCHY_REQUEST_ERR");var t=x(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){K(this);var e,t;if(this.collapsed)return b(this).createDocumentFragment();if(this.startContainer===this.endContainer&&o(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=b(this).createDocumentFragment(),t.appendChild(e),t;var n=new M(this,!0);return e=N(n),n.detach(),e},canSurroundContents:function(){K(this),X(this.startContainer),X(this.endContainer);var e=new M(this,!0),t=e._first&&y(e._first,this)||e._last&&y(e._last,this);return e.detach(),!t},surroundContents:function(e){U(e,B);if(!this.canSurroundContents())throw new s("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())while(e.lastChild)e.removeChild(e.lastChild);x(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){K(this);var e=new gt(b(this)),t=nt.length,n;while(t--)n=nt[t],e[n]=this[n];return e},toString:function(){K(this);var e=this.startContainer;if(e===this.endContainer&&o(e))return e.nodeType==3||e.nodeType==4?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new M(this,!0);return C(n,function(e){(e.nodeType==3||e.nodeType==4)&&t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){K(this);var t=e.parentNode,n=u(e);if(!t)throw new s("NOT_FOUND_ERR");var r=this.comparePoint(t,n),i=this.comparePoint(t,n+1);return r<0?i>0?ft:ut:i>0?at:lt},comparePoint:function(e,t){return K(this),V(e,"HIERARCHY_REQUEST_ERR"),W(e,this.startContainer),l(e,t,this.startContainer,this.startOffset)<0?-1:l(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:Z,toHtml:function(){return tt(this)},intersectsNode:function(e,t){K(this);if(v(e)!=w(this))return!1;var n=e.parentNode,r=u(e);if(!n)return!0;var i=l(n,r,this.endContainer,this.endOffset),s=l(n,r+1,this.startContainer,this.startOffset);return t?i<=0&&s>=0:i<0&&s>0},isPointInRange:function(e,t){return K(this),V(e,"HIERARCHY_REQUEST_ERR"),W(e,this.startContainer),l(e,t,this.startContainer,this.startOffset)>=0&&l(e,t,this.endContainer,this.endOffset 5 )<=0},intersectsRange:function(e){return T(this,e,!1)},intersectsOrTouchesRange:function(e){return T(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=l(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=l(this.endContainer,this.endOffset,e.endContainer,e.endOffset),r=this.cloneRange();return t==-1&&r.setStart(e.startContainer,e.startOffset),n==1&&r.setEnd(e.endContainer,e.endOffset),r}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return l(e.startContainer,e.startOffset,this.startContainer,this.startOffset)==-1&&t.setStart(e.startContainer,e.startOffset),l(e.endContainer,e.endOffset,this.endContainer,this.endOffset)==1&&t.setEnd(e.endContainer,e.endOffset),t}throw new s("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==lt},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,p(e))<=0},containsRange:function(e){var t=this.intersection(e);return t!==null&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var r=n.pop();return t.setEnd(r,r.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return K(this),A(this,e,t)},getDocument:function(){return b(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var r=b(this),i=e.createRange(r);t=t||n.getBody(r),i.selectNodeContents(t);var s=this.intersection(i),o=0,u=0;return s&&(i.setEnd(s.startContainer,s.startOffset),o=i.toString().length,u=o+s.toString().length),{start:o,end:u,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);var r=[t],i,s=!1,o=!1,u,a,f;while(!o&&(i=r.pop()))if(i.nodeType==3)u=n+i.length,!s&&e.start>=n&&e.start<=u&&(this.setStart(i,e.start-n),s=!0),s&&e.end>=n&&e.end<=u&&(this.setEnd(i,e.end-n),o=!0),n=u;else{f=i.childNodes,a=f.length;while(a--)r.push(f[a])}},getName:function(){return"DomRange"},equals:function(e){return gt.rangesEqual(this,e)},isValid:function(){return J(this)},inspect:function(){return O(this)},detach:function(){}}),dt(gt,mt),r.extend(gt,{rangeProperties:nt,RangeIterator:M,copyComparisonConstants:ht,createPrototypeRange:dt,inspect:O,toHtml:tt,getRangeDocument:b,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=gt}),w.createCoreModule("WrappedRange",["DomRange"],function(e,t){var n,r,i=e.dom,s=e.util,o=i.DomPosition,u=e.DomRange,a=i.getBody,f=i.getContentDocument,l=i.isCharacterDataNode;e.features.implementsDomRange&&function(){function l(e){var t=o.length,n;while(t--)n=o[t],e[n]=e.nativeRange[n];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function c(e,t,n,r,i){var s=e.startContainer!==t||e.startOffset!=n,o=e.endContainer!==r||e.endOffset!=i,u=!e.equals(e.nativeRange);if(s||o||u)e.setEnd(r,i),e.setStart(t,n)}var r,o=u.rangeProperties,h;n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,l(this)},u.createPrototypeRange(n,c),r=n.prototype,r.selectNode=function(e){this.nativeRange.selectNode(e),l(this)},r.cloneContents=function(){return this.nativeRange.cloneContents()},r.surroundContents=function(e){this.nativeRange.surroundContents(e),l(this)},r.collapse=function(e){this.nativeRange.collapse(e),l(this)},r.cloneRange=function(){return new n(this.nativeRange.cloneRange())},r.refresh=function(){l(this)},r.toString=function(){return this.nativeRange.toString()};var p=document.createTextNode("test");a(document).appendChild(p);var d=document.createRange();d.setStart(p,0),d.setEnd(p,0);try{d.setStart(p,1),r.setStart=function(e,t){this.nativeRange.setStart(e,t),l(this)},r.setEnd=function(e,t){this.nativeRange.setEnd(e,t),l(this)},h=function(e){return function(t){this.nativeRange[e](t),l(this)}}}catch(v){r.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}l(this)},r.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}l(this)},h=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(r){this.nativeRange[t](n),this.nativeRange[e](n)}l(this)}}}r.setStartBefore=h("setStartBefore","setEndBefore"),r.setStartAfter=h("setStartAfter","setEndAfter"),r.setEndBefore=h("setEndBefore","setStartBefore"),r.setEndAfter=h("setEndAfter","setStartAfter"),r.selectNodeContents=function(e){this.setStartAndEnd(e,0,i.getNodeLength(e))},d.selectNodeContents(p),d.setEnd(p,3);var m=document.createRange();m.selectNodeContents(p),m.setEnd(p,4),m.setStart(p,2),d.compareBoundaryPoints(d.START_TO_END,m)==-1&&d.compareBoundaryPoints(d.END_TO_START,m)==1?r.compareBoundaryPoints=function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:r.compareBoundaryPoints=function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var g=document.createElement("div");g.innerHTML="123";var y=g.firstChild,b=a(document);b.appendChild(g),d.setStart(y,1),d.setEnd(y,2),d.deleteContents(),y.data=="13"&&(r.deleteContents=function(){this.nativeRange.deleteContents(),l(this)},r.extractContents=function(){var e=this.nativeRange.extractContents();return l(this),e}),b.removeChild(g),b=null,s.isHostMethod(d,"createContextualFragment")&&(r.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),a(document).removeChild(p),r.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return e=f(e,t,"createNativeRange"),e.createRange()}}();if(e.features.implementsTextRange){var c=function( 6 e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var r=n.parentElement();n=e.duplicate(),n.collapse(!1);var s=n.parentElement(),o=r==s?r:i.getCommonAncestor(r,s);return o==t?o:i.getCommonAncestor(t,o)},h=function(e){return e.compareEndPoints("StartToEnd",e)==0},p=function(e,t,n,r,s){var u=e.duplicate();u.collapse(n);var a=u.parentElement();i.isOrIsAncestorOf(t,a)||(a=t);if(!a.canHaveHTML){var f=new o(a.parentNode,i.getNodeIndex(a));return{boundaryPosition:f,nodeInfo:{nodeIndex:f.offset,containerElement:f.node}}}var c=i.getDocument(a).createElement("span");c.parentNode&&i.removeNode(c);var h,p=n?"StartToStart":"StartToEnd",d,v,m,g,y=s&&s.containerElement==a?s.nodeIndex:0,b=a.childNodes.length,w=b,E=w;for(;;){E==b?a.appendChild(c):a.insertBefore(c,a.childNodes[E]),u.moveToElementText(c),h=u.compareEndPoints(p,e);if(h==0||y==w)break;if(h==-1){if(w==y+1)break;y=E}else w=w==y+1?y:E;E=Math.floor((y+w)/2),a.removeChild(c)}g=c.nextSibling;if(h==-1&&g&&l(g)){u.setEndPoint(n?"EndToStart":"EndToEnd",e);var S;if(/[\r\n]/.test(g.data)){var x=u.duplicate(),T=x.text.replace(/\r\n/g,"\r").length;S=x.moveStart("character",T);while((h=x.compareEndPoints("StartToEnd",x))==-1)S++,x.moveStart("character",1)}else S=u.text.length;m=new o(g,S)}else d=(r||!n)&&c.previousSibling,v=(r||n)&&c.nextSibling,v&&l(v)?m=new o(v,0):d&&l(d)?m=new o(d,d.data.length):m=new o(a,i.getNodeIndex(c));return i.removeNode(c),{boundaryPosition:m,nodeInfo:{nodeIndex:E,containerElement:a}}},d=function(e,t){var n,r,s=e.offset,o=i.getDocument(e.node),u,f,c=a(o).createTextRange(),h=l(e.node);return h?(n=e.node,r=n.parentNode):(f=e.node.childNodes,n=s<f.length?f[s]:null,r=e.node),u=o.createElement("span"),u.innerHTML="&#feff;",n?r.insertBefore(u,n):r.appendChild(u),c.moveToElementText(u),c.collapse(!t),r.removeChild(u),h&&c[t?"moveStart":"moveEnd"]("character",s),c};r=function(e){this.textRange=e,this.refresh()},r.prototype=new u(document),r.prototype.refresh=function(){var e,t,n,r=c(this.textRange);h(this.textRange)?t=e=p(this.textRange,r,!0,!0).boundaryPosition:(n=p(this.textRange,r,!0,!1),e=n.boundaryPosition,t=p(this.textRange,r,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(e.node,e.offset),this.setEnd(t.node,t.offset)},r.prototype.getName=function(){return"WrappedTextRange"},u.copyComparisonConstants(r);var v=function(e){if(e.collapsed)return d(new o(e.startContainer,e.startOffset),!0);var t=d(new o(e.startContainer,e.startOffset),!0),n=d(new o(e.endContainer,e.endOffset),!1),r=a(u.getRangeDocument(e)).createTextRange();return r.setEndPoint("StartToStart",t),r.setEndPoint("EndToEnd",n),r};r.rangeToTextRange=v,r.prototype.toTextRange=function(){return v(this)},e.WrappedTextRange=r;if(!e.features.implementsDomRange||e.config.preferTextRange){var m=function(e){return e("return this;")()}(Function);typeof m.Range=="undefined"&&(m.Range=r),e.createNativeRange=function(e){return e=f(e,t,"createNativeRange"),a(e).createTextRange()},e.WrappedRange=r}}e.createRange=function(n){return n=f(n,t,"createRange"),new e.WrappedRange(e.createNativeRange(n))},e.createRangyRange=function(e){return e=f(e,t,"createRangyRange"),new u(e)},s.createAliasForDeprecatedMethod(e,"createIframeRange","createRange"),s.createAliasForDeprecatedMethod(e,"createIframeRangyRange","createRangyRange"),e.addShimListener(function(t){var n=t.document;typeof n.createRange=="undefined"&&(n.createRange=function(){return e.createRange(n)}),n=t=null})}),w.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],function(e,t){function y(e){return typeof e=="string"?/^backward(s)?$/i.test(e):!!e}function b(e,n){if(!e)return window;if(i.isWindow(e))return e;if(e instanceof J)return e.win;var r=i.getContentDocument(e,t,n);return i.getWindow(r)}function w(e){return b(e,"getWinSelection").getSelection()}function E(e){return b(e,"getDocSelection").document.selection}function S(e){var t=!1;return e.anchorNode&&(t=i.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)==1),t}function j(e,t,n){var r=n?"end":"start",i=n?"start":"end";e.anchorNode=t[r+"Container"],e.anchorOffset=t[r+"Offset"],e.focusNode=t[i+"Container"],e.focusOffset=t[i+"Offset"]}function F(e){var t=e.nativeSelection;e.anchorNode=t.anchorNode,e.anchorOffset=t.anchorOffset,e.focusNode=t.focusNode,e.focusOffset=t.focusOffset}function I(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0}function q(t){var n;return t instanceof u?(n=e.createNativeRange(t.getDocument()),n.setEnd(t.endContainer,t.endOffset),n.setStart(t.startContainer,t.startOffset)):t instanceof a?n=t.nativeRange:p.implementsDomRange&&t instanceof i.getWindow(t.startContainer).Range&&(n=t),n}function R(e){if(!e.length||e[0].nodeType!=1)return!1;for(var t=1,n=e.length;t<n;++t)if(!i.isAncestorOf(e[0],e[t]))return!1;return!0}function U(e){var n=e.getNodes();if(!R(n))throw t.createError("getSingleElementFromRange: range "+e.inspect()+" did not consist of a single element");return n[0]}function z(e){return!!e&&typeof e.text!="undefined"}function W(e,t){var n=new a(t);e._ranges=[n],j(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed}function X(t){t._ranges.length=0;if(t.docSelection.type=="None")I(t);else{var n=t.docSelection.createRange();if(z(n))W(t,n);else{t.rangeCount=n.length;var r,i=v(n.item(0));for(var s=0;s<t.rangeCount;++s)r=e.createRange(i),r.selectNode(n.item(s)),t._ranges.push(r);t.isCollapsed=t.rangeCount==1&&t._ranges[0].collapsed,j(t,t._ranges[t.rangeCount-1],!1)}}}function V(e,n){var r=e.docSelection.createRange(),i=U(n),s=v(r.item(0)),o=m(s).createControlRange();for(var u=0,a=r.length;u<a;++u)o.add(r.item(u));try{o.add(i)}catch(f){throw t.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}o.select(),X(e)}function J(e,t,n){this.nativeSelection=e,this.docSelection=t,this._ranges=[],this.win=n,this.refresh()}function K(e){e.win=e.anchorNode=e.focusNode=e._ranges=null,e.rangeCount=e.anchorOffset= 7 e.focusOffset=0,e.detached=!0}function G(e,t){var n=Q.length,r,i;while(n--){r=Q[n],i=r.selection;if(t=="deleteAll")K(i);else if(r.win==e)return t=="delete"?(Q.splice(n,1),!0):i}return t=="deleteAll"&&(Q.length=0),null}function et(e,n){var r=v(n[0].startContainer),i=m(r).createControlRange();for(var s=0,o,u=n.length;s<u;++s){o=U(n[s]);try{i.add(o)}catch(a){throw t.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}i.select(),X(e)}function st(e,t){if(e.win.document!=v(t))throw new f("WRONG_DOCUMENT_ERR")}function ot(t){return function(n,r){var i;this.rangeCount?(i=this.getRangeAt(0),i["set"+(t?"Start":"End")](n,r)):(i=e.createRange(this.win.document),i.setStartAndEnd(n,r)),this.setSingleRange(i,this.isBackward())}}function ut(e){var t=[],n=new l(e.anchorNode,e.anchorOffset),r=new l(e.focusNode,e.focusOffset),i=typeof e.getName=="function"?e.getName():"Selection";if(typeof e.rangeCount!="undefined")for(var s=0,o=e.rangeCount;s<o;++s)t[s]=u.inspect(e.getRangeAt(s));return"["+i+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+r.inspect()+"]"}e.config.checkSelectionRanges=!0;var n="boolean",r="number",i=e.dom,s=e.util,o=s.isHostMethod,u=e.DomRange,a=e.WrappedRange,f=e.DOMException,l=i.DomPosition,c,h,p=e.features,d="Control",v=i.getDocument,m=i.getBody,g=u.rangesEqual,x=o(window,"getSelection"),T=s.isHostObject(document,"selection");p.implementsWinGetSelection=x,p.implementsDocSelection=T;var N=T&&(!x||e.config.preferTextRange);if(N)c=E,e.isSelectionValid=function(e){var t=b(e,"isSelectionValid").document,n=t.selection;return n.type!="None"||v(n.createRange().parentElement())==t};else{if(!x)return t.fail("Neither document.selection or window.getSelection() detected."),!1;c=w,e.isSelectionValid=function(){return!0}}e.getNativeSelection=c;var C=c();if(!C)return t.fail("Native selection was null (possibly issue 138?)"),!1;var k=e.createNativeRange(document),L=m(document),A=s.areHostProperties(C,["anchorNode","focusNode","anchorOffset","focusOffset"]);p.selectionHasAnchorAndFocus=A;var O=o(C,"extend");p.selectionHasExtend=O;var M=typeof C.rangeCount==r;p.selectionHasRangeCount=M;var _=!1,D=!0,P=O?function(t,n){var r=u.getRangeDocument(n),i=e.createRange(r);i.collapseToPoint(n.endContainer,n.endOffset),t.addRange(q(i)),t.extend(n.startContainer,n.startOffset)}:null;s.areHostMethods(C,["addRange","getRangeAt","removeAllRanges"])&&typeof C.rangeCount==r&&p.implementsDomRange&&function(){var t=window.getSelection();if(t){var n=t.rangeCount,r=n>1,s=[],o=S(t);for(var u=0;u<n;++u)s[u]=t.getRangeAt(u);var a=i.createTestElement(document,"",!1),f=a.appendChild(document.createTextNode("\u00a0\u00a0\u00a0")),l=document.createRange();l.setStart(f,1),l.collapse(!0),t.removeAllRanges(),t.addRange(l),D=t.rangeCount==1,t.removeAllRanges();if(!r){var c=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(c&&parseInt(c[1])>=36)_=!1;else{var h=l.cloneRange();l.setStart(f,0),h.setEnd(f,3),h.setStart(f,2),t.addRange(l),t.addRange(h),_=t.rangeCount==2}}i.removeNode(a),t.removeAllRanges();for(u=0;u<n;++u)u==0&&o?P?P(t,s[u]):(e.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),t.addRange(s[u])):t.addRange(s[u])}}(),p.selectionSupportsMultipleRanges=_,p.collapsedNonEditableSelectionsSupported=D;var H=!1,B;L&&o(L,"createControlRange")&&(B=L.createControlRange(),s.areHostProperties(B,["item","add"])&&(H=!0)),p.implementsControlRange=H,A?h=function(e){return e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset}:h=function(e){return e.rangeCount?e.getRangeAt(e.rangeCount-1).collapsed:!1};var $;o(C,"getRangeAt")?$=function(e,t){try{return e.getRangeAt(t)}catch(n){return null}}:A&&($=function(t){var n=v(t.anchorNode),r=e.createRange(n);return r.setStartAndEnd(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),r.collapsed!==this.isCollapsed&&r.setStartAndEnd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset),r}),J.prototype=e.selectionPrototype;var Q=[],Y=function(e){if(e&&e instanceof J)return e.refresh(),e;e=b(e,"getNativeSelection");var t=G(e),n=c(e),r=T?E(e):null;return t?(t.nativeSelection=n,t.docSelection=r,t.refresh()):(t=new J(n,r,e),Q.push({win:e,selection:t})),t};e.getSelection=Y,s.createAliasForDeprecatedMethod(e,"getIframeSelection","getSelection");var Z=J.prototype;if(!N&&A&&s.areHostMethods(C,["removeAllRanges","addRange"])){Z.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),I(this)};var tt=function(e,t){P(e.nativeSelection,t),e.refresh()};M?Z.addRange=function(t,n){if(H&&T&&this.docSelection.type==d)V(this,t);else if(y(n)&&O)tt(this,t);else{var r;_?r=this.rangeCount:(this.removeAllRanges(),r=0);var i=q(t).cloneRange();try{this.nativeSelection.addRange(i)}catch(s){}this.rangeCount=this.nativeSelection.rangeCount;if(this.rangeCount==r+1){if(e.config.checkSelectionRanges){var o=$(this.nativeSelection,this.rangeCount-1);o&&!g(o,t)&&(t=new a(o))}this._ranges[this.rangeCount-1]=t,j(this,t,it(this.nativeSelection)),this.isCollapsed=h(this)}else this.refresh()}}:Z.addRange=function(e,t){y(t)&&O?tt(this,e):(this.nativeSelection.addRange(q(e)),this.refresh())},Z.setRanges=function(e){if(H&&T&&e.length>1)et(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;t<n;++t)this.addRange(e[t])}}}else{if(!(o(C,"empty")&&o(k,"select")&&H&&N))return t.fail("No means of selecting a Range or TextRange was found"),!1;Z.removeAllRanges=function(){try{this.docSelection.empty();if(this.docSelection.type!="None"){var e;if(this.anchorNode)e=v(this.anchorNode);else if(this.docSelection.type==d){var t=this.docSelection.createRange();t.length&&(e=v(t.item(0)))}if(e){var n=m(e).createTextRange();n.select(),this.docSelection.empty()}}}catch(r){}I(this)},Z.addRange=function(t){this.docSelection.type==d?V(this,t):(e.WrappedTextRange.rangeToTextRange(t).select(),this._ranges[0]=t,this.rangeCount=1,this.isCollapsed= 8 this._ranges[0].collapsed,j(this,t,!1))},Z.setRanges=function(e){this.removeAllRanges();var t=e.length;t>1?et(this,e):t&&this.addRange(e[0])}}Z.getRangeAt=function(e){if(e<0||e>=this.rangeCount)throw new f("INDEX_SIZE_ERR");return this._ranges[e].cloneRange()};var nt;if(N)nt=function(t){var n;e.isSelectionValid(t.win)?n=t.docSelection.createRange():(n=m(t.win.document).createTextRange(),n.collapse(!0)),t.docSelection.type==d?X(t):z(n)?W(t,n):I(t)};else if(o(C,"getRangeAt")&&typeof C.rangeCount==r)nt=function(t){if(H&&T&&t.docSelection.type==d)X(t);else{t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount;if(t.rangeCount){for(var n=0,r=t.rangeCount;n<r;++n)t._ranges[n]=new e.WrappedRange(t.nativeSelection.getRangeAt(n));j(t,t._ranges[t.rangeCount-1],it(t.nativeSelection)),t.isCollapsed=h(t)}else I(t)}};else{if(!A||typeof C.isCollapsed!=n||typeof k.collapsed!=n||!p.implementsDomRange)return t.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;nt=function(e){var t,n=e.nativeSelection;n.anchorNode?(t=$(n,0),e._ranges=[t],e.rangeCount=1,F(e),e.isCollapsed=h(e)):I(e)}}Z.refresh=function(e){var t=e?this._ranges.slice(0):null,n=this.anchorNode,r=this.anchorOffset;nt(this);if(e){var i=t.length;if(i!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=r)return!0;while(i--)if(!g(t[i],this._ranges[i]))return!0;return!1}};var rt=function(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var r=0,i=n.length;r<i;++r)g(t,n[r])||e.addRange(n[r]);e.rangeCount||I(e)};H&&T?Z.removeRange=function(e){if(this.docSelection.type==d){var t=this.docSelection.createRange(),n=U(e),r=v(t.item(0)),i=m(r).createControlRange(),s,o=!1;for(var u=0,a=t.length;u<a;++u)s=t.item(u),s!==n||o?i.add(t.item(u)):o=!0;i.select(),X(this)}else rt(this,e)}:Z.removeRange=function(e){rt(this,e)};var it;!N&&A&&p.implementsDomRange?(it=S,Z.isBackward=function(){return it(this)}):it=Z.isBackward=function(){return!1},Z.isBackwards=Z.isBackward,Z.toString=function(){var e=[];for(var t=0,n=this.rangeCount;t<n;++t)e[t]=""+this._ranges[t];return e.join("")},Z.collapse=function(t,n){st(this,t);var r=e.createRange(t);r.collapseToPoint(t,n),this.setSingleRange(r),this.isCollapsed=!0},Z.collapseToStart=function(){if(!this.rangeCount)throw new f("INVALID_STATE_ERR");var e=this._ranges[0];this.collapse(e.startContainer,e.startOffset)},Z.collapseToEnd=function(){if(!this.rangeCount)throw new f("INVALID_STATE_ERR");var e=this._ranges[this.rangeCount-1];this.collapse(e.endContainer,e.endOffset)},Z.selectAllChildren=function(t){st(this,t);var n=e.createRange(t);n.selectNodeContents(t),this.setSingleRange(n)},Z.deleteFromDocument=function(){if(H&&T&&this.docSelection.type==d){var e=this.docSelection.createRange(),t;while(e.length)t=e.item(0),e.remove(t),i.removeNode(t);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();if(n.length){this.removeAllRanges();for(var r=0,s=n.length;r<s;++r)n[r].deleteContents();this.addRange(n[s-1])}}},Z.eachRange=function(e,t){for(var n=0,r=this._ranges.length;n<r;++n)if(e(this.getRangeAt(n)))return t},Z.getAllRanges=function(){var e=[];return this.eachRange(function(t){e.push(t)}),e},Z.setSingleRange=function(e,t){this.removeAllRanges(),this.addRange(e,t)},Z.callMethodOnEachRange=function(e,t){var n=[];return this.eachRange(function(r){n.push(r[e].apply(r,t||[]))}),n},Z.setStart=ot(!0),Z.setEnd=ot(!1),e.rangePrototype.select=function(e){Y(this.getDocument()).setSingleRange(this,e)},Z.changeEachRange=function(e){var t=[],n=this.isBackward();this.eachRange(function(n){e(n),t.push(n)}),this.removeAllRanges(),n&&t.length==1?this.addRange(t[0],"backward"):this.setRanges(t)},Z.containsNode=function(e,t){return this.eachRange(function(n){return n.containsNode(e,t)},!0)||!1},Z.getBookmark=function(e){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[e])}},Z.moveToBookmark=function(t){var n=[];for(var r=0,i,s;i=t.rangeBookmarks[r++];)s=e.createRange(this.win),s.moveToBookmark(i),n.push(s);t.backward?this.setSingleRange(n[0],"backward"):this.setRanges(n)},Z.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},Z.restoreRanges=function(e){this.removeAllRanges();for(var t=0,n;n=e.ranges[t];++t)this.addRange(n,e.backward&&t==0)},Z.toHtml=function(){var e=[];return this.eachRange(function(t){e.push(u.toHtml(t))}),e.join("")},p.implementsTextRange&&(Z.getNativeTextRange=function(){var n,r;if(n=this.docSelection){var i=n.createRange();if(z(i))return i;throw t.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return e.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw t.createError("getNativeTextRange: selection contains no range")}),Z.getName=function(){return"WrappedSelection"},Z.inspect=function(){return ut(this)},Z.detach=function(){G(this.win,"delete"),K(this)},J.detachAll=function(){G(null,"deleteAll")},J.inspect=ut,J.isDirectionBackward=y,e.Selection=J,e.selectionPrototype=Z,e.addShimListener(function(e){typeof e.getSelection=="undefined"&&(e.getSelection=function(){return Y(e)}),e=null})});var F=!1,I=function(e){F||(F=!0,!w.initialized&&w.config.autoInitialize&&A())};return y&&(document.readyState=="complete"?I():(u(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",I,!1),C(window,"load",I))),w},this),function(e,t){e(t.rangy)}(function(e){return e.createModule("SaveRestore",["WrappedRange"],function(e,t){function o(e,t){return(t||document).getElementById(e)}function u(e,t){var r="selectionBoundary_"+ +(new Date)+"_"+(""+Math.random()).slice(2),i,o=n.getDocument(e.startContainer),u=e.cloneRange();return u.collapse(t),i=o.createElement("span"),i.id=r,i.style.lineHeight="0",i.style.display="none",i.className="rangySelectionBoundary",i.appendChild(o.createTextNode(s)),u.insertNode(i),i}function a(e,n,i,s){var u=o(i,e);u?(n[s?"setStartBefore":"setEndBefore"](u),r(u)):t.warn("Marker element has been removed. Cannot restore selection." 9 )}function f(e,t){return t.compareBoundaryPoints(e.START_TO_START,e)}function l(t,n){var r,s,o=e.DomRange.getRangeDocument(t),a=t.toString(),f=i(n);return t.collapsed?(s=u(t,!1),{document:o,markerId:s.id,collapsed:!0}):(s=u(t,!1),r=u(t,!0),{document:o,startMarkerId:r.id,endMarkerId:s.id,collapsed:!1,backward:f,toString:function(){return"original text: '"+a+"', new text: '"+t.toString()+"'"}})}function c(n,i){var s=n.document;typeof i=="undefined"&&(i=!0);var u=e.createRange(s);if(n.collapsed){var f=o(n.markerId,s);if(f){f.style.display="inline";var l=f.previousSibling;l&&l.nodeType==3?(r(f),u.collapseToPoint(l,l.length)):(u.collapseBefore(f),r(f))}else t.warn("Marker element has been removed. Cannot restore selection.")}else a(s,u,n.startMarkerId,!0),a(s,u,n.endMarkerId,!1);return i&&u.normalizeBoundaries(),u}function h(t,n){var r=[],s,u,a=i(n);t=t.slice(0),t.sort(f);for(var c=0,h=t.length;c<h;++c)r[c]=l(t[c],a);for(c=h-1;c>=0;--c)s=t[c],u=e.DomRange.getRangeDocument(s),s.collapsed?s.collapseAfter(o(r[c].markerId,u)):(s.setEndBefore(o(r[c].endMarkerId,u)),s.setStartAfter(o(r[c].startMarkerId,u)));return r}function p(n){if(!e.isSelectionValid(n))return t.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."),null;var r=e.getSelection(n),i=r.getAllRanges(),s=i.length==1&&r.isBackward(),o=h(i,s);return s?r.setSingleRange(i[0],s):r.setRanges(i),{win:n,rangeInfos:o,restored:!1}}function d(e){var t=[],n=e.length;for(var r=n-1;r>=0;r--)t[r]=c(e[r],!0);return t}function v(t,n){if(!t.restored){var r=t.rangeInfos,i=e.getSelection(t.win),s=d(r),o=r.length;o==1&&n&&e.features.selectionHasExtend&&r[0].backward?(i.removeAllRanges(),i.addRange(s[0],!0)):i.setRanges(s),t.restored=!0}}function m(e,t){var n=o(t,e);n&&r(n)}function g(e){var t=e.rangeInfos;for(var n=0,r=t.length,i;n<r;++n)i=t[n],i.collapsed?m(e.doc,i.markerId):(m(e.doc,i.startMarkerId),m(e.doc,i.endMarkerId))}var n=e.dom,r=n.removeNode,i=e.Selection.isDirectionBackward,s="\ufeff";e.util.extend(e,{saveRange:l,restoreRange:c,saveRanges:h,restoreRanges:d,saveSelection:p,restoreSelection:v,removeMarkerElement:m,removeMarkers:g})}),e},this),function(e,t){e(t.rangy)}(function(e){return e.createModule("Serializer",["WrappedSelection"],function(e,t){function o(e){return e.replace(/</g,"<").replace(/>/g,">")}function u(e,t){t=t||[];var n=e.nodeType,r=e.childNodes,i=r.length,s=[n,e.nodeName,i].join(":"),a="",f="";switch(n){case 3:a=o(e.nodeValue);break;case 8:a="<!--"+o(e.nodeValue)+"-->";break;default:a="<"+s+">",f="</>"}a&&t.push(a);for(var l=0;l<i;++l)u(r[l],t);return f&&t.push(f),t}function a(e){var t=u(e).join("");return i(t).toString(16)}function f(e,t,n){var r=[],i=e;n=n||s.getDocument(e).documentElement;while(i&&i!=n)r.push(s.getNodeIndex(i,!0)),i=i.parentNode;return r.join("/")+":"+t}function l(e,n,r){n||(n=(r||document).documentElement);var i=e.split(":"),o=n,u=i[0]?i[0].split("/"):[],a=u.length,f;while(a--){f=parseInt(u[a],10);if(!(f<o.childNodes.length))throw t.createError("deserializePosition() failed: node "+s.inspectNode(o)+" has no child with index "+f+", "+a);o=o.childNodes[f]}return new s.DomPosition(o,parseInt(i[1],10))}function c(n,r,i){i=i||e.DomRange.getRangeDocument(n).documentElement;if(!s.isOrIsAncestorOf(i,n.commonAncestorContainer))throw t.createError("serializeRange(): range "+n.inspect()+" is not wholly contained within specified root node "+s.inspectNode(i));var o=f(n.startContainer,n.startOffset,i)+","+f(n.endContainer,n.endOffset,i);return r||(o+="{"+a(i)+"}"),o}function p(n,r,i){r?i=i||s.getDocument(r):(i=i||document,r=i.documentElement);var o=h.exec(n),u=o[4];if(u){var f=a(r);if(u!==f)throw t.createError("deserializeRange(): checksums of serialized range root node ("+u+") and target root node ("+f+") do not match")}var c=l(o[1],r,i),p=l(o[2],r,i),d=e.createRange(i);return d.setStartAndEnd(c.node,c.offset,p.node,p.offset),d}function d(e,t,n){t||(t=(n||document).documentElement);var r=h.exec(e),i=r[3];return!i||i===a(t)}function v(t,n,r){t=e.getSelection(t);var i=t.getAllRanges(),s=[];for(var o=0,u=i.length;o<u;++o)s[o]=c(i[o],n,r);return s.join("|")}function m(t,n,r){n?r=r||s.getWindow(n):(r=r||window,n=r.document.documentElement);var i=t.split("|"),o=e.getSelection(r),u=[];for(var a=0,f=i.length;a<f;++a)u[a]=p(i[a],n,r.document);return o.setRanges(u),o}function g(e,t,n){var r;t?r=n?n.document:s.getDocument(t):(n=n||window,t=n.document.documentElement);var i=e.split("|");for(var o=0,u=i.length;o<u;++o)if(!d(i[o],t,r))return!1;return!0}function b(e){var t=e.split(/[;,]/);for(var n=0,r=t.length,i,s;n<r;++n){i=t[n].split("=");if(i[0].replace(/^\s+/,"")==y){s=i[1];if(s)return decodeURIComponent(s.replace(/\s+$/,""))}}return null}function w(e){e=e||window;var t=b(e.document.cookie);t&&m(t,e.doc)}function E(t,n){t=t||window,n=typeof n=="object"?n:{};var r=n.expires?";expires="+n.expires.toUTCString():"",i=n.path?";path="+n.path:"",s=n.domain?";domain="+n.domain:"",o=n.secure?";secure":"",u=v(e.getSelection(t));t.document.cookie=encodeURIComponent(y)+"="+encodeURIComponent(u)+r+i+s+o}var n="undefined",r=e.util;(typeof encodeURIComponent==n||typeof decodeURIComponent==n)&&t.fail("encodeURIComponent and/or decodeURIComponent method is missing");var i=function(){function e(e){var t=[];for(var n=0,r=e.length,i;n<r;++n)i=e.charCodeAt(n),i<128?t.push(i):i<2048?t.push(i>>6|192,i&63|128):t.push(i>>12|224,i>>6&63|128,i&63|128);return t}function n(){var e=[];for(var t=0,n,r;t<256;++t){r=t,n=8;while(n--)(r&1)==1?r=r>>>1^3988292384:r>>>=1;e[t]=r>>>0}return e}function r(){return t||(t=n()),t}var t=null;return function(t){var n=e(t),i=-1,s=r();for(var o=0,u=n.length,a;o<u;++o)a=(i^n[o])&255,i=i>>>8^s[a];return(i^-1)>>>0}}(),s=e.dom,h=/^([^,]+),([^,\{]+)(\{([^}]+)\})?$/,y="rangySerializedSelection";r.extend(e,{serializePosition:f,deserializePosition:l,serializeRange:c,deserializeRange:p,canDeserializeRange:d,serializeSelection:v,deserializeSelection:m,canDeserializeSelection 10 :g,restoreSelectionFromCookie:w,saveSelectionCookie:E,getElementChecksum:a,nodeToInfoString:u}),r.crc32=i}),e},this),function(e,t){e(t.rangy)}(function(e){return e.createModule("ClassApplier",["WrappedSelection"],function(e,t){function l(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(n,e[n])===!1)return!1;return!0}function c(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function h(e,t){return!!e&&(new RegExp("(?:^|\\s)"+t+"(?:\\s|$)")).test(e)}function p(e,t){if(typeof e.classList=="object")return e.classList.contains(t);var n=typeof e.className=="string",r=n?e.className:e.getAttribute("class");return h(r,t)}function d(e,t){if(typeof e.classList=="object")e.classList.add(t);else{var n=typeof e.className=="string",r=n?e.className:e.getAttribute("class");r?h(r,t)||(r+=" "+t):r=t,n?e.className=r:e.setAttribute("class",r)}}function m(e){var t=typeof e.className=="string";return t?e.className:e.getAttribute("class")}function g(e){return e&&e.split(/\s+/).sort().join(" ")}function y(e){return g(m(e))}function b(e,t){return y(e)==y(t)}function w(e,t){var n=t.split(/\s+/);for(var r=0,i=n.length;r<i;++r)if(!p(e,c(n[r])))return!1;return!0}function E(e){var t=e.parentNode;return t&&t.nodeType==1&&!/^(textarea|style|script|select|iframe)$/i.test(t.nodeName)}function S(e,t,n,r,i){var s=e.node,o=e.offset,u=s,a=o;s==r&&o>i&&++a,s==t&&(o==n||o==n+1)&&(u=r,a+=i-n),s==t&&o>n+1&&--a,e.node=u,e.offset=a}function x(e,t,n){e.node==t&&e.offset>n&&--e.offset}function T(e,t,r,i){r==-1&&(r=t.childNodes.length);var s=e.parentNode,o=n.getNodeIndex(e);u(i,function(e){S(e,s,o,t,r)}),t.childNodes.length==r?t.appendChild(e):t.insertBefore(e,t.childNodes[r])}function N(e,t){var r=e.parentNode,i=n.getNodeIndex(e);u(t,function(e){x(e,r,i)}),n.removeNode(e)}function C(e,t,n,r,i){var s,o=[];while(s=e.firstChild)T(s,t,n++,i),o.push(s);return r&&N(e,i),o}function k(e,t){return C(e,e.parentNode,n.getNodeIndex(e),!0,t)}function L(e,t){var n=e.cloneRange();n.selectNodeContents(t);var r=n.intersection(e),i=r?r.toString():"";return i!=""}function A(e){var t=e.getNodes([3]),n=0,r;while((r=t[n])&&!L(e,r))++n;var i=t.length-1;while((r=t[i])&&!L(e,r))--i;return t.slice(n,i+1)}function O(e,t){if(e.attributes.length!=t.attributes.length)return!1;for(var n=0,r=e.attributes.length,i,s,o;n<r;++n){i=e.attributes[n],o=i.name;if(o!="class"){s=t.attributes.getNamedItem(o);if(i===null!=(s===null))return!1;if(i.specified!=s.specified)return!1;if(i.specified&&i.nodeValue!==s.nodeValue)return!1}}return!0}function M(e,t){for(var n=0,r=e.attributes.length,i;n<r;++n){i=e.attributes[n].name;if((!t||!s(t,i))&&e.attributes[n].specified&&i!="class")return!0}return!1}function P(e){var t;return e&&e.nodeType==1&&((t=e.parentNode)&&t.nodeType==9&&t.designMode=="on"||D(e)&&!D(e.parentNode))}function H(e){return(D(e)||e.nodeType!=1&&D(e.parentNode))&&!P(e)}function j(e){return e&&e.nodeType==1&&!B.test(_(e,"display"))}function I(e){if(e.data.length==0)return!0;if(F.test(e.data))return!1;var t=_(e.parentNode,"whiteSpace");switch(t){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(e.data))return!1}return j(e.previousSibling)||j(e.nextSibling)}function q(e){var t=[],n,i;for(n=0;i=e[n++];)t.push(new r(i.startContainer,i.startOffset),new r(i.endContainer,i.endOffset));return t}function R(e,t){for(var n=0,r,i,s,o=e.length;n<o;++n)r=e[n],i=t[n*2],s=t[n*2+1],r.setStartAndEnd(i.node,i.offset,s.node,s.offset)}function U(e,t){return n.isCharacterDataNode(e)?t==0?!!e.previousSibling:t==e.length?!!e.nextSibling:!0:t>0&&t<e.childNodes.length}function z(e,r,i,s){var o,u,a=i==0;if(n.isAncestorOf(r,e))return e;if(n.isCharacterDataNode(r)){var f=n.getNodeIndex(r);if(i==0)i=f;else{if(i!=r.length)throw t.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+i+" in "+r.data);i=f+1}r=r.parentNode}if(U(r,i)){o=r.cloneNode(!1),u=r.parentNode,o.id&&o.removeAttribute("id");var l,c=0;while(l=r.childNodes[i])T(l,o,c++,s);return T(o,u,n.getNodeIndex(r)+1,s),r==e?o:z(e,u,n.getNodeIndex(o),s)}if(e!=r){o=r.parentNode;var h=n.getNodeIndex(r);return a||h++,z(e,o,h,s)}return e}function W(e,t){return e.namespaceURI==t.namespaceURI&&e.tagName.toLowerCase()==t.tagName.toLowerCase()&&b(e,t)&&O(e,t)&&_(e,"display")=="inline"&&_(t,"display")=="inline"}function X(e){var t=e?"nextSibling":"previousSibling";return function(n,r){var i=n.parentNode,s=n[t];if(s){if(s&&s.nodeType==3)return s}else if(r){s=i[t];if(s&&s.nodeType==1&&W(i,s)){var o=s[e?"firstChild":"lastChild"];if(o&&o.nodeType==3)return o}}return null}}function J(e){this.isElementMerge=e.nodeType==1,this.textNodes=[];var t=this.isElementMerge?e.lastChild:e;t&&(this.textNodes[0]=t)}function G(e,t,n){var r,i,s,o,u=this;u.cssClass=u.className=e;var a=null,f={};if(typeof t=="object"&&t!==null){typeof t.elementTagName!="undefined"&&(t.elementTagName=t.elementTagName.toLowerCase()),n=t.tagNames,a=t.elementProperties,f=t.elementAttributes;for(i=0;o=K[i++];)t.hasOwnProperty(o)&&(u[o]=t[o]);r=t.normalize}else r=t;u.normalize=typeof r=="undefined"?!0:r,u.attrExceptions=[];var h=document.createElement(u.elementTagName);u.elementProperties=u.copyPropertiesToElement(a,h,!0),l(f,function(e,t){u.attrExceptions.push(e),f[e]=""+t}),u.elementAttributes=f,u.elementSortedClassName=u.elementProperties.hasOwnProperty("className")?g(u.elementProperties.className+" "+e):e,u.applyToAnyTagName=!1;var p=typeof n;if(p=="string")n=="*"?u.applyToAnyTagName=!0:u.tagNames=c(n.toLowerCase()).split(/\s*,\s*/);else if(p=="object"&&typeof n.length=="number"){u.tagNames=[];for(i=0,s=n.length;i<s;++i)n[i]=="*"?u.applyToAnyTagName=!0:u.tagNames.push(n[i].toLowerCase())}else u.tagNames=[u.elementTagName]}function Y(e,t,n){return new G(e,t,n)}var n=e.dom,r=n.DomPosition,s=n.arrayContains,o=e.util,u=o.forEach,a="span",f=o.isHostMethod(document,"createElementNS"),v=function(){function e(e,t,n){return t&&n?" ":""}return function(t,n){if(typeof t.classList=="object")t.classList.remove(n);else{var r=typeof t. 11 className=="string",i=r?t.className:t.getAttribute("class");i=i.replace(new RegExp("(^|\\s)"+n+"(\\s|$)"),e),r?t.className=i:t.setAttribute("class",i)}}}(),_=n.getComputedStyleProperty,D=function(){var e=document.createElement("div");return typeof e.isContentEditable=="boolean"?function(e){return e&&e.nodeType==1&&e.isContentEditable}:function(e){return!e||e.nodeType!=1||e.contentEditable=="false"?!1:e.contentEditable=="true"||D(e.parentNode)}}(),B=/^inline(-block|-table)?$/i,F=/[^\r\n\t\f \u200B]/,V=X(!1),$=X(!0);J.prototype={doMerge:function(e){var t=this.textNodes,r=t[0];if(t.length>1){var i=n.getNodeIndex(r),s=[],o=0,a,f;u(t,function(t,a){f=t.parentNode,a>0&&(f.removeChild(t),f.hasChildNodes()||n.removeNode(f),e&&u(e,function(e){e.node==t&&(e.node=r,e.offset+=o),e.node==f&&e.offset>i&&(--e.offset,e.offset==i+1&&a<len-1&&(e.node=r,e.offset=o))})),s[a]=t.data,o+=t.data.length}),r.data=s.join("")}return r.data},getLength:function(){var e=this.textNodes.length,t=0;while(e--)t+=this.textNodes[e].length;return t},toString:function(){var e=[];return u(this.textNodes,function(t,n){e[n]="'"+t.data+"'"}),"[Merge("+e.join(",")+")]"}};var K=["elementTagName","ignoreWhiteSpace","applyToEditableOnly","useExistingElements","removeEmptyElements","onElementCreate"],Q={};G.prototype={elementTagName:a,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(e,t,n){var r,i,s={},o,u,a,f;for(var l in e)if(e.hasOwnProperty(l)){u=e[l],a=t[l];if(l=="className")d(t,u),d(t,this.className),t[l]=g(t[l]),n&&(s[l]=u);else if(l=="style"){i=a,n&&(s[l]=o={});for(r in e[l])e[l].hasOwnProperty(r)&&(i[r]=u[r],n&&(o[r]=i[r]));this.attrExceptions.push(l)}else t[l]=u,n&&(s[l]=t[l],f=Q.hasOwnProperty(l)?Q[l]:l,this.attrExceptions.push(f))}return n?s:""},copyAttributesToElement:function(e,t){for(var n in e)e.hasOwnProperty(n)&&!/^class(?:Name)?$/i.test(n)&&t.setAttribute(n,e[n])},appliesToElement:function(e){return s(this.tagNames,e.tagName.toLowerCase())},getEmptyElements:function(e){var t=this;return e.getNodes([1],function(e){return t.appliesToElement(e)&&!e.hasChildNodes()})},hasClass:function(e){return e.nodeType==1&&(this.applyToAnyTagName||this.appliesToElement(e))&&p(e,this.className)},getSelfOrAncestorWithClass:function(e){while(e){if(this.hasClass(e))return e;e=e.parentNode}return null},isModifiable:function(e){return!this.applyToEditableOnly||H(e)},isIgnorableWhiteSpaceNode:function(e){return this.ignoreWhiteSpace&&e&&e.nodeType==3&&I(e)},postApply:function(e,t,n,r){var s=e[0],o=e[e.length-1],a=[],f,l=s,c=o,h=0,p=o.length,d,v;u(e,function(e){v=V(e,!r),v?(f||(f=new J(v),a.push(f)),f.textNodes.push(e),e===s&&(l=f.textNodes[0],h=l.length),e===o&&(c=f.textNodes[0],p=f.getLength())):f=null});var m=$(o,!r);m&&(f||(f=new J(o),a.push(f)),f.textNodes.push(m));if(a.length){for(i=0,len=a.length;i<len;++i)a[i].doMerge(n);t.setStartAndEnd(l,h,c,p)}},createContainer:function(e){var t=n.getDocument(e),r,i=f&&!n.isHtmlNamespace(e)&&(r=e.namespaceURI)?t.createElementNS(e.namespaceURI,this.elementTagName):t.createElement(this.elementTagName);return this.copyPropertiesToElement(this.elementProperties,i,!1),this.copyAttributesToElement(this.elementAttributes,i),d(i,this.className),this.onElementCreate&&this.onElementCreate(i,this),i},elementHasProperties:function(e,t){var n=this;return l(t,function(t,r){if(t=="className")return w(e,r);if(typeof r=="object"){if(!n.elementHasProperties(e[t],r))return!1}else if(e[t]!==r)return!1})},elementHasAttributes:function(e,t){return l(t,function(t,n){if(e.getAttribute(t)!==n)return!1})},applyToTextNode:function(e,t){if(E(e)){var n=e.parentNode;if(n.childNodes.length==1&&this.useExistingElements&&this.appliesToElement(n)&&this.elementHasProperties(n,this.elementProperties)&&this.elementHasAttributes(n,this.elementAttributes))d(n,this.className);else{var r=e.parentNode,i=this.createContainer(r);r.insertBefore(i,e),i.appendChild(e)}}},isRemovable:function(e){return e.tagName.toLowerCase()==this.elementTagName&&y(e)==this.elementSortedClassName&&this.elementHasProperties(e,this.elementProperties)&&!M(e,this.attrExceptions)&&this.elementHasAttributes(e,this.elementAttributes)&&this.isModifiable(e)},isEmptyContainer:function(e){var t=e.childNodes.length;return e.nodeType==1&&this.isRemovable(e)&&(t==0||t==1&&this.isEmptyContainer(e.firstChild))},removeEmptyContainers:function(e){var t=this,n=e.getNodes([1],function(e){return t.isEmptyContainer(e)}),r=[e],i=q(r);u(n,function(e){N(e,i)}),R(r,i)},undoToTextNode:function(e,t,n,r){if(!t.containsNode(n)){var i=t.cloneRange();i.selectNode(n),i.isPointInRange(t.endContainer,t.endOffset)&&(z(n,t.endContainer,t.endOffset,r),t.setEndAfter(n)),i.isPointInRange(t.startContainer,t.startOffset)&&(n=z(n,t.startContainer,t.startOffset,r))}this.isRemovable(n)?k(n,r):v(n,this.className)},splitAncestorWithClass:function(e,t,n){var r=this.getSelfOrAncestorWithClass(e);r&&z(r,e,t,n)},undoToAncestor:function(e,t){this.isRemovable(e)?k(e,t):v(e,this.className)},applyToRange:function(e,t){var n=this;t=t||[];var r=q(t||[]);e.splitBoundariesPreservingPositions(r),n.removeEmptyElements&&n.removeEmptyContainers(e);var i=A(e);if(i.length){u(i,function(e){!n.isIgnorableWhiteSpaceNode(e)&&!n.getSelfOrAncestorWithClass(e)&&n.isModifiable(e)&&n.applyToTextNode(e,r)});var s=i[i.length-1];e.setStartAndEnd(i[0],0,s,s.length),n.normalize&&n.postApply(i,e,r,!1),R(t,r)}var o=n.getEmptyElements(e);u(o,function(e){d(e,n.className)})},applyToRanges:function(e){var t=e.length;while(t--)this.applyToRange(e[t],e);return e},applyToSelection:function(t){var n=e.getSelection(t);n.setRanges(this.applyToRanges(n.getAllRanges()))},undoToRange:function(e,t){var n=this;t=t||[];var r=q(t);e.splitBoundariesPreservingPositions(r),n.removeEmptyElements&&n.removeEmptyContainers(e,r);var i=A(e),s,o,a=i[i.length-1];if(i.length){n.splitAncestorWithClass(e.endContainer,e.endOffset,r),n.splitAncestorWithClass 12 (e.startContainer,e.startOffset,r);for(var f=0,l=i.length;f<l;++f)s=i[f],o=n.getSelfOrAncestorWithClass(s),o&&n.isModifiable(s)&&n.undoToAncestor(o,r);e.setStartAndEnd(i[0],0,a,a.length),n.normalize&&n.postApply(i,e,r,!0),R(t,r)}var c=n.getEmptyElements(e);u(c,function(e){v(e,n.className)})},undoToRanges:function(e){var t=e.length;while(t--)this.undoToRange(e[t],e);return e},undoToSelection:function(t){var n=e.getSelection(t),r=e.getSelection(t).getAllRanges();this.undoToRanges(r),n.setRanges(r)},isAppliedToRange:function(e){if(e.collapsed||e.toString()=="")return!!this.getSelfOrAncestorWithClass(e.commonAncestorContainer);var t=e.getNodes([3]);if(t.length)for(var n=0,r;r=t[n++];)if(!this.isIgnorableWhiteSpaceNode(r)&&L(e,r)&&this.isModifiable(r)&&!this.getSelfOrAncestorWithClass(r))return!1;return!0},isAppliedToRanges:function(e){var t=e.length;if(t==0)return!1;while(t--)if(!this.isAppliedToRange(e[t]))return!1;return!0},isAppliedToSelection:function(t){var n=e.getSelection(t);return this.isAppliedToRanges(n.getAllRanges())},toggleRange:function(e){this.isAppliedToRange(e)?this.undoToRange(e):this.applyToRange(e)},toggleSelection:function(e){this.isAppliedToSelection(e)?this.undoToSelection(e):this.applyToSelection(e)},getElementsWithClassIntersectingRange:function(e){var t=[],n=this;return e.getNodes([3],function(e){var r=n.getSelfOrAncestorWithClass(e);r&&!s(t,r)&&t.push(r)}),t},detach:function(){}},G.util={hasClass:p,addClass:d,removeClass:v,getClass:m,hasSameClasses:b,hasAllClasses:w,replaceWithOwnChildren:k,elementsHaveSameNonClassAttributes:O,elementHasNonClassAttributes:M,splitNodeAt:z,isEditableElement:D,isEditingHost:P,isEditable:H},e.CssClassApplier=e.ClassApplier=G,e.createClassApplier=Y,o.createAliasForDeprecatedMethod(e,"createCssClassApplier","createClassApplier",t)}),e},this),function(e,t){e(t.rangy)}(function(e){return e.createModule("Highlighter",["ClassApplier"],function(e,t){function a(e,t){return e.characterRange.start-t.characterRange.start}function f(e,t){return t?e.getElementById(t):i(e)}function c(e,t){this.type=e,this.converterCreator=t}function h(e,t){l[e]=new c(e,t)}function p(e){var t=l[e];if(t instanceof c)return t.create();throw new Error("Highlighter type '"+e+"' is not valid")}function d(e,t){this.start=e,this.end=t}function m(e,t,n,r,i,s){i?(this.id=i,u=Math.max(u,i+1)):this.id=u++,this.characterRange=t,this.doc=e,this.classApplier=n,this.converter=r,this.containerElementId=s||null,this.applied=!1}function g(e,t){t=t||"textContent",this.doc=e||document,this.classAppliers={},this.highlights=[],this.converter=p(t)}var n=e.dom,r=n.arrayContains,i=n.getBody,s=e.util.createOptions,o=e.util.forEach,u=1,l={};c.prototype.create=function(){var e=this.converterCreator();return e.type=this.type,e},e.registerHighlighterType=h,d.prototype={intersects:function(e){return this.start<e.end&&this.end>e.start},isContiguousWith:function(e){return this.start==e.end||this.end==e.start},union:function(e){return new d(Math.min(this.start,e.start),Math.max(this.end,e.end))},intersection:function(e){return new d(Math.max(this.start,e.start),Math.min(this.end,e.end))},getComplements:function(e){var t=[];if(this.start>=e.start){if(this.end<=e.end)return[];t.push(new d(e.end,this.end))}else t.push(new d(this.start,Math.min(this.end,e.start))),this.end>e.end&&t.push(new d(e.end,this.end));return t},toString:function(){return"[CharacterRange("+this.start+", "+this.end+")]"}},d.fromCharacterRange=function(e){return new d(e.start,e.end)};var v={rangeToCharacterRange:function(e,t){var n=e.getBookmark(t);return new d(n.start,n.end)},characterRangeToRange:function(t,n,r){var i=e.createRange(t);return i.moveToBookmark({start:n.start,end:n.end,containerNode:r}),i},serializeSelection:function(e,t){var n=e.getAllRanges(),r=n.length,i=[],s=r==1&&e.isBackward();for(var o=0,u=n.length;o<u;++o)i[o]={characterRange:this.rangeToCharacterRange(n[o],t),backward:s};return i},restoreSelection:function(e,t,n){e.removeAllRanges();var r=e.win.document;for(var i=0,s=t.length,o,u,a;i<s;++i)u=t[i],a=u.characterRange,o=this.characterRangeToRange(r,u.characterRange,n),e.addRange(o,u.backward)}};h("textContent",function(){return v}),h("TextRange",function(){var t;return function(){if(!t){var n=e.modules.TextRange;if(!n)throw new Error("TextRange module is missing.");if(!n.supported)throw new Error("TextRange module is present but not supported.");t={rangeToCharacterRange:function(e,t){return d.fromCharacterRange(e.toCharacterRange(t))},characterRangeToRange:function(t,n,r){var i=e.createRange(t);return i.selectCharacters(r,n.start,n.end),i},serializeSelection:function(e,t){return e.saveCharacterRanges(t)},restoreSelection:function(e,t,n){e.restoreCharacterRanges(n,t)}}}return t}}()),m.prototype={getContainerElement:function(){return f(this.doc,this.containerElementId)},getRange:function(){return this.converter.characterRangeToRange(this.doc,this.characterRange,this.getContainerElement())},fromRange:function(e){this.characterRange=this.converter.rangeToCharacterRange(e,this.getContainerElement())},getText:function(){return this.getRange().toString()},containsElement:function(e){return this.getRange().containsNodeContents(e.firstChild)},unapply:function(){this.classApplier.undoToRange(this.getRange()),this.applied=!1},apply:function(){this.classApplier.applyToRange(this.getRange()),this.applied=!0},getHighlightElements:function(){return this.classApplier.getElementsWithClassIntersectingRange(this.getRange())},toString:function(){return"[Highlight(ID: "+this.id+", class: "+this.classApplier.className+", character range: "+this.characterRange.start+" - "+this.characterRange.end+")]"}},g.prototype={addClassApplier:function(e){this.classAppliers[e.className]=e},getHighlightForElement:function(e){var t=this.highlights;for(var n=0,r=t.length;n<r;++n)if(t[n].containsElement(e))return t[n];return null},removeHighlights:function(e){for(var t=0,n=this.highlights.length,i;t<n;++t)i=this.highlights[t],r(e,i)&&(i.unapply(),this 13 .highlights.splice(t--,1))},removeAllHighlights:function(){this.removeHighlights(this.highlights)},getIntersectingHighlights:function(e){var t=[],n=this.highlights;return o(e,function(e){o(n,function(n){e.intersectsRange(n.getRange())&&!r(t,n)&&t.push(n)})}),t},highlightCharacterRanges:function(t,n,r){var i,u,a,f=this.highlights,l=this.converter,c=this.doc,h=[],p=t?this.classAppliers[t]:null;r=s(r,{containerElementId:null,exclusive:!0});var v=r.containerElementId,g=r.exclusive,y,b,w;v&&(y=this.doc.getElementById(v),y&&(b=e.createRange(this.doc),b.selectNodeContents(y),w=new d(0,b.toString().length)));var E,S,x,T,N,C;for(i=0,u=n.length;i<u;++i){E=n[i],N=[],w&&(E=E.intersection(w));if(E.start==E.end)continue;for(a=0;a<f.length;++a)x=!1,v==f[a].containerElementId&&(S=f[a].characterRange,T=p==f[a].classApplier,C=!T&&g,(S.intersects(E)||S.isContiguousWith(E))&&(T||C)&&(C&&o(S.getComplements(E),function(e){N.push(new m(c,e,f[a].classApplier,l,null,v))}),x=!0,T&&(E=S.union(E)))),x?(h.push(f[a]),f[a]=new m(c,S.union(E),p,l,null,v)):N.push(f[a]);p&&N.push(new m(c,E,p,l,null,v)),this.highlights=f=N}o(h,function(e){e.unapply()});var k=[];return o(f,function(e){e.applied||(e.apply(),k.push(e))}),k},highlightRanges:function(t,n,r){var u=[],a=this.converter;r=s(r,{containerElement:null,exclusive:!0});var f=r.containerElement,l=f?f.id:null,c;return f&&(c=e.createRange(f),c.selectNodeContents(f)),o(n,function(e){var t=f?c.intersection(e):e;u.push(a.rangeToCharacterRange(t,f||i(e.getDocument())))}),this.highlightCharacterRanges(t,u,{containerElementId:l,exclusive:r.exclusive})},highlightSelection:function(t,n){var r=this.converter,i=t?this.classAppliers[t]:!1;n=s(n,{containerElementId:null,selection:e.getSelection(this.doc),exclusive:!0});var u=n.containerElementId,a=n.exclusive,l=n.selection,c=l.win.document,h=f(c,u);if(!i&&t!==!1)throw new Error("No class applier found for class '"+t+"'");var p=r.serializeSelection(l,h),v=[];o(p,function(e){v.push(d.fromCharacterRange(e.characterRange))});var m=this.highlightCharacterRanges(t,v,{containerElementId:u,exclusive:a});return r.restoreSelection(l,p,h),m},unhighlightSelection:function(t){t=t||e.getSelection(this.doc);var n=this.getIntersectingHighlights(t.getAllRanges());return this.removeHighlights(n),t.removeAllRanges(),n},getHighlightsInSelection:function(t){return t=t||e.getSelection(this.doc),this.getIntersectingHighlights(t.getAllRanges())},selectionOverlapsHighlight:function(e){return this.getHighlightsInSelection(e).length>0},serialize:function(e){var t=this,n=t.highlights,r,i,u,f;return n.sort(a),e=s(e,{serializeHighlightText:!1,type:t.converter.type}),r=e.type,u=r!=t.converter.type,u&&(f=p(r)),i=["type:"+r],o(n,function(n){var r=n.characterRange,s;u&&(s=n.getContainerElement(),r=f.rangeToCharacterRange(t.converter.characterRangeToRange(t.doc,r,s),s));var o=[r.start,r.end,n.id,n.classApplier.className,n.containerElementId];e.serializeHighlightText&&o.push(n.getText()),i.push(o.join("$"))}),i.join("|")},deserialize:function(e){var t=e.split("|"),n=[],r=t[0],i,s,o,u=!1;if(!r||!(i=/^type:(\w+)$/.exec(r)))throw new Error("Serialized highlights are invalid.");s=i[1],s!=this.converter.type&&(o=p(s),u=!0),t.shift();var a,l,c,h,v;for(var g=t.length,y;g-->0;){y=t[g].split("$"),c=new d(+y[0],+y[1]),h=y[4]||null,u&&(v=f(this.doc,h),c=this.converter.rangeToCharacterRange(o.characterRangeToRange(this.doc,c,v),v)),a=this.classAppliers[y[3]];if(!a)throw new Error("No class applier found for class '"+y[3]+"'");l=new m(this.doc,c,a,this.converter,parseInt(y[2]),h),l.apply(),n.push(l)}this.highlights=n}},e.Highlighter=g,e.createHighlighter=function(e,t){return new g(e,t)}}),e},this),function(e,t){e(t.rangy)}(function(e){return e.createModule("TextRange",["WrappedSelection"],function(e,t){function E(e,t){function s(e,t,n){i.push({start:e,end:t,isWord:n})}var n=e.join(""),r,i=[],o=0,u,a;while(r=t.wordRegex.exec(n)){u=r.index,a=u+r[0].length,u>o&&s(o,u,!1);if(t.includeTrailingSpace)while(p.test(e[a]))++a;s(u,a,!0),o=a}return o<e.length&&s(o,e.length,!1),i}function S(e,t){var n=e.slice(t.start,t.end),r={isWord:t.isWord,chars:n,toString:function(){return n.join("")}};for(var i=0,s=n.length;i<s;++i)n[i].token=r;return r}function x(e,t,n){var r=n(e,t),i=[];for(var s=0,o;o=r[s++];)i.push(S(e,o));return i}function N(e){var t=e||"",n=typeof t=="string"?t.split(""):t;return n.sort(function(e,t){return e.charCodeAt(0)-t.charCodeAt(0)}),n.join("").replace(/(.)\1+/g,"$1")}function _(e){var t,n;return e?(t=e.language||v,n={},u(n,k[t]||k[v]),u(n,e),n):k[v]}function D(e,t){var n=a(e,t);return t.hasOwnProperty("wordOptions")&&(n.wordOptions=_(n.wordOptions)),t.hasOwnProperty("characterOptions")&&(n.characterOptions=a(n.characterOptions,T)),n}function j(e,t){var n=P(e,"display",t),r=e.tagName.toLowerCase();return n=="block"&&H&&B.hasOwnProperty(r)?B[r]:n}function F(e){var t=W(e);for(var n=0,r=t.length;n<r;++n)if(t[n].nodeType==1&&j(t[n])=="none")return!0;return!1}function I(e){var t;return e.nodeType==3&&(t=e.parentNode)&&P(t,"visibility")=="hidden"}function q(e){return e&&(e.nodeType==1&&!/^(inline(-block|-table)?|none)$/.test(j(e))||e.nodeType==9||e.nodeType==11)}function R(e){var t=e.lastChild;return t?R(t):e}function U(e){return s.isCharacterDataNode(e)||!/^(area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param)$/i.test(e.nodeName)}function z(e){var t=[];while(e.parentNode)t.unshift(e.parentNode),e=e.parentNode;return t}function W(e){return z(e).concat([e])}function X(e){while(e&&!e.nextSibling)e=e.parentNode;return e?e.nextSibling:null}function V(e,t){return!t&&e.hasChildNodes()?e.firstChild:X(e)}function $(e){var t=e.previousSibling;if(t){e=t;while(e.hasChildNodes())e=e.lastChild;return e}var n=e.parentNode;return n&&n.nodeType==1?n:null}function J(e){if(!e||e.nodeType!=3)return!1;var t=e.data;if(t==="")return!0;var n=e.parentNode;if(!n||n.nodeType!=1)return!1;var r=P(e.parentNode,"whiteSpace");return/^[\t\n\r ]+$/.test(t)&&/^(normal|nowrap)$/.test(r)||/^[\t\r ]+$/.test 14 (t)&&r=="pre-line"}function K(e){if(e.data==="")return!0;if(!J(e))return!1;var t=e.parentNode;return t?F(e)?!0:!1:!0}function Q(e){var t=e.nodeType;return t==7||t==8||F(e)||/^(script|style)$/i.test(e.nodeName)||I(e)||K(e)}function G(e,t){var n=e.nodeType;return n==7||n==8||n==1&&j(e,t)=="none"}function Y(){this.store={}}function tt(e,t,n){return function(r){var i=this.cache;if(i.hasOwnProperty(e))return Z++,i[e];et++;var s=t.call(this,n?this[n]:this,r);return i[e]=s,s}}function nt(e,t){this.node=e,this.session=t,this.cache=new Y,this.positions=new Y}function dt(e,t){this.offset=t,this.nodeWrapper=e,this.node=e.node,this.session=e.session,this.cache=new Y}function vt(){return"[Position("+s.inspectNode(this.node)+":"+this.offset+")]"}function bt(){return Et(),gt=new yt}function wt(){return gt||bt()}function Et(){gt&>.detach(),gt=null}function St(e,n,r,i){function u(){var e=null;return n?(e=s,o||(s=s.previousVisible(),o=!s||r&&s.equals(r))):o||(e=s=s.nextVisible(),o=!s||r&&s.equals(r)),o&&(s=null),e}r&&(n?Q(r.node)&&(r=e.previousVisible()):Q(r.node)&&(r=r.nextVisible()));var s=e,o=!1,a,f=!1;return{next:function(){if(f)return f=!1,a;var e,t;while(e=u()){t=e.getCharacter(i);if(t)return a=e,e}return null},rewind:function(){if(!a)throw t.createError("createCharacterIterator: cannot rewind. Only one position can be rewound.");f=!0},dispose:function(){e=r=null}}}function Tt(e,t,n){function o(e){var t,n,s=[],o=e?r:i,u=!1,a=!1;while(t=o.next()){n=t.character;if(h.test(n))a&&(a=!1,u=!0);else{if(u){o.rewind();break}a=!0}s.push(t)}return s}function p(e){var t=["["+e.length+"]"];for(var n=0;n<e.length;++n)t.push("(word: "+e[n]+", is word: "+e[n].isWord+")");return t}var r=St(e,!1,null,t),i=St(e,!0,null,t),s=n.tokenizer,u=o(!0),a=o(!1).reverse(),f=x(a.concat(u),n,s),l=u.length?f.slice(xt(f,u[0].token)):[],c=a.length?f.slice(0,xt(f,a.pop().token)+1):[];return{nextEndToken:function(){var e,t;while(l.length==1&&!(e=l[0]).isWord&&(t=o(!0)).length>0)l=x(e.chars.concat(t),n,s);return l.shift()},previousStartToken:function(){var e,t;while(c.length==1&&!(e=c[0]).isWord&&(t=o(!1)).length>0)c=x(t.reverse().concat(e.chars),n,s);return c.pop()},dispose:function(){r.dispose(),i.dispose(),l=c=null}}}function Nt(e,t,n,s,o){var u=0,a,f=e,l,c,h=Math.abs(n),p;if(n!==0){var d=n<0;switch(t){case r:l=St(e,d,null,s);while((a=l.next())&&u<h)++u,f=a;c=a,l.dispose();break;case i:var v=Tt(e,s,o),m=d?v.previousStartToken:v.nextEndToken;while((p=m())&&u<h)p.isWord&&(++u,f=d?p.chars[0]:p.chars[p.chars.length-1]);break;default:throw new Error("movePositionBy: unit '"+t+"' not implemented")}d?(f=f.previousVisible(),u=-u):f&&f.isLeadingSpace&&!f.isTrailingSpace&&(t==i&&(l=St(e,!1,null,s),c=l.next(),l.dispose()),c&&(f=c.previousVisible()))}return{position:f,unitsMoved:u}}function Ct(e,t,n,r){var i=e.getRangeBoundaryPosition(t,!0),s=e.getRangeBoundaryPosition(t,!1),o=r?s:i,u=r?i:s;return St(o,!!r,u,n)}function kt(e,t,n){var r=[],i=Ct(e,t,n),s;while(s=i.next())r.push(s);return i.dispose(),r}function Lt(t,n,r){var i=e.createRange(t.node);return i.setStartAndEnd(t.node,t.offset,n.node,n.offset),!i.expand("word",{wordOptions:r})}function At(e,t,n,r,i){function g(e,t){var n=a[e].previousVisible(),r=a[t-1],s=!i.wholeWordsOnly||Lt(n,r,i.wordOptions);return{startPos:n,endPos:r,valid:s}}var s=m(i.direction),o=St(e,s,e.session.getRangeBoundaryPosition(r,s),i.characterOptions),u="",a=[],f,l,c,h,p,d,v=null;while(f=o.next()){l=f.character,!n&&!i.caseSensitive&&(l=l.toLowerCase()),s?(a.unshift(f),u=l+u):(a.push(f),u+=l);if(n){p=t.exec(u);if(p){c=p.index,h=c+p[0].length;if(d){if(!s&&h<u.length||s&&c>0){v=g(c,h);break}}else d=!0}}else if((c=u.indexOf(t))!=-1){v=g(c,c+t.length);break}}return d&&(v=g(c,h)),o.dispose(),v}function Ot(e){return function(){var t=!!gt,n=wt(),r=[n].concat(o.toArray(arguments)),i=e.apply(this,r);return t||Et(),i}}function Mt(e,t){return Ot(function(i,s,o,u){typeof o==n&&(o=s,s=r),u=D(u,A);var a=e;t&&(a=o>=0,this.collapse(!a));var f=Nt(i.getRangeBoundaryPosition(this,a),s,o,u.characterOptions,u.wordOptions),l=f.position;return this[a?"setStart":"setEnd"](l.node,l.offset),f.unitsMoved})}function _t(e){return Ot(function(t,n){n=a(n,T);var r,i=Ct(t,this,n,!e),s=0;while((r=i.next())&&h.test(r.character))++s;i.dispose();var o=s>0;return o&&this[e?"moveStart":"moveEnd"]("character",e?s:-s,{characterOptions:n}),o})}function Dt(e){return Ot(function(t,n){var r=!1;return this.changeEachRange(function(t){r=t[e](n)||r}),r})}var n="undefined",r="character",i="word",s=e.dom,o=e.util,u=o.extend,a=o.createOptions,f=s.getBody,l=/^[ \t\f\r\n]+$/,c=/^[ \t\f\r]+$/,h=/^[\t-\r \u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]+$/,p=/^[\t \u00A0\u1680\u180E\u2000-\u200B\u202F\u205F\u3000]+$/,d=/^[\n-\r\u0085\u2028\u2029]$/,v="en",m=e.Selection.isDirectionBackward,g=!1,y=!1,b=!1,w=!0;(function(){var t=s.createTestElement(document,"<p>1 </p><p></p>",!0),n=t.firstChild,r=e.getSelection();r.collapse(n.lastChild,2),r.setStart(n.firstChild,0),g=(""+r).length==1,t.innerHTML="1 <br />",r.collapse(t,2),r.setStart(t.firstChild,0),y=(""+r).length==1,t.innerHTML="1 <p>1</p>",r.collapse(t,2),r.setStart(t.firstChild,0),b=(""+r).length==1,s.removeNode(t),r.removeAllRanges()})();var T={includeBlockContentTrailingSpace:!0,includeSpaceBeforeBr:!0,includeSpaceBeforeBlock:!0,includePreLineTrailingSpace:!0,ignoreCharacters:""},C={includeBlockContentTrailingSpace:!w,includeSpaceBeforeBr:!y,includeSpaceBeforeBlock:!b,includePreLineTrailingSpace:!0},k={en:{wordRegex:/[a-z0-9]+('[a-z0-9]+)*/gi,includeTrailingSpace:!1,tokenizer:E}},L={caseSensitive:!1,withinRange:null,wholeWordsOnly:!1,wrap:!1,direction:"forward",wordOptions:null,characterOptions:null},A={wordOptions:null,characterOptions:null},O={wordOptions:null,characterOptions:null,trim:!1,trimStart:!0,trimEnd:!0},M={wordOptions:null,characterOptions:null,direction:"forward"},P=s.getComputedStyleProperty,H;(function(){var e=document.createElement("table"),t=f(document);t.appendChild(e),H=P(e,"display")=="block" 15 ,t.removeChild(e)})();var B={table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell"};Y.prototype={get:function(e){return this.store.hasOwnProperty(e)?this.store[e]:null},set:function(e,t){return this.store[e]=t}};var Z=0,et=0,rt={getPosition:function(e){var t=this.positions;return t.get(e)||t.set(e,new dt(this,e))},toString:function(){return"[NodeWrapper("+s.inspectNode(this.node)+")]"}};nt.prototype=rt;var it="EMPTY",st="NON_SPACE",ot="UNCOLLAPSIBLE_SPACE",ut="COLLAPSIBLE_SPACE",at="TRAILING_SPACE_BEFORE_BLOCK",ft="TRAILING_SPACE_IN_BLOCK",lt="TRAILING_SPACE_BEFORE_BR",ct="PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK",ht="TRAILING_LINE_BREAK_AFTER_BR",pt="INCLUDED_TRAILING_LINE_BREAK_AFTER_BR";u(rt,{isCharacterDataNode:tt("isCharacterDataNode",s.isCharacterDataNode,"node"),getNodeIndex:tt("nodeIndex",s.getNodeIndex,"node"),getLength:tt("nodeLength",s.getNodeLength,"node"),containsPositions:tt("containsPositions",U,"node"),isWhitespace:tt("isWhitespace",J,"node"),isCollapsedWhitespace:tt("isCollapsedWhitespace",K,"node"),getComputedDisplay:tt("computedDisplay",j,"node"),isCollapsed:tt("collapsed",Q,"node"),isIgnored:tt("ignored",G,"node"),next:tt("nextPos",V,"node"),previous:tt("previous",$,"node"),getTextNodeInfo:tt("textNodeInfo",function(e){var t=null,n=!1,r=P(e.parentNode,"whiteSpace"),i=r=="pre-line";if(i)t=c,n=!0;else if(r=="normal"||r=="nowrap")t=l,n=!0;return{node:e,text:e.data,spaceRegex:t,collapseSpaces:n,preLine:i}},"node"),hasInnerText:tt("hasInnerText",function(e,t){var n=this.session,r=n.getPosition(e.parentNode,this.getNodeIndex()+1),i=n.getPosition(e,0),s=t?r:i,o=t?i:r;while(s!==o){s.prepopulateChar();if(s.isDefinitelyNonEmpty())return!0;s=t?s.previousVisible():s.nextVisible()}return!1},"node"),isRenderedBlock:tt("isRenderedBlock",function(e){var t=e.getElementsByTagName("br");for(var n=0,r=t.length;n<r;++n)if(!Q(t[n]))return!0;return this.hasInnerText()},"node"),getTrailingSpace:tt("trailingSpace",function(e){if(e.tagName.toLowerCase()=="br")return"";switch(this.getComputedDisplay()){case"inline":var t=e.lastChild;while(t){if(!G(t))return t.nodeType==1?this.session.getNodeWrapper(t).getTrailingSpace():"";t=t.previousSibling}break;case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":break;case"table-cell":return" ";default:return this.isRenderedBlock(!0)?"\n":""}return""},"node"),getLeadingSpace:tt("leadingSpace",function(e){switch(this.getComputedDisplay()){case"inline":case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":case"table-cell":break;default:return this.isRenderedBlock(!1)?"\n":""}return""},"node")});var mt={character:"",characterType:it,isBr:!1,prepopulateChar:function(){var e=this;if(!e.prepopulatedChar){var t=e.node,n=e.offset,r="",i=it,s=!1;if(n>0)if(t.nodeType==3){var o=t.data,u=o.charAt(n-1),a=e.nodeWrapper.getTextNodeInfo(),f=a.spaceRegex;a.collapseSpaces?f.test(u)?n>1&&f.test(o.charAt(n-2))||(a.preLine&&o.charAt(n)==="\n"?(r=" ",i=ct):(r=" ",i=ut)):(r=u,i=st,s=!0):(r=u,i=ot,s=!0)}else{var l=t.childNodes[n-1];l&&l.nodeType==1&&!Q(l)&&(l.tagName.toLowerCase()=="br"?(r="\n",e.isBr=!0,i=ut,s=!1):e.checkForTrailingSpace=!0);if(!r){var c=t.childNodes[n];c&&c.nodeType==1&&!Q(c)&&(e.checkForLeadingSpace=!0)}}e.prepopulatedChar=!0,e.character=r,e.characterType=i,e.isCharInvariant=s}},isDefinitelyNonEmpty:function(){var e=this.characterType;return e==st||e==ot},resolveLeadingAndTrailingSpaces:function(){this.prepopulatedChar||this.prepopulateChar();if(this.checkForTrailingSpace){var e=this.session.getNodeWrapper(this.node.childNodes[this.offset-1]).getTrailingSpace();e&&(this.isTrailingSpace=!0,this.character=e,this.characterType=ut),this.checkForTrailingSpace=!1}if(this.checkForLeadingSpace){var t=this.session.getNodeWrapper(this.node.childNodes[this.offset]).getLeadingSpace();t&&(this.isLeadingSpace=!0,this.character=t,this.characterType=ut),this.checkForLeadingSpace=!1}},getPrecedingUncollapsedPosition:function(e){var t=this,n;while(t=t.previousVisible()){n=t.getCharacter(e);if(n!=="")return t}return null},getCharacter:function(e){function p(){return c||(l=h.getPrecedingUncollapsedPosition(e),c=!0),l}this.resolveLeadingAndTrailingSpaces();var t=this.character,n,r=N(e.ignoreCharacters),i=t!==""&&r.indexOf(t)>-1;if(this.isCharInvariant)return n=i?"":t,n;var s=["character",e.includeSpaceBeforeBr,e.includeBlockContentTrailingSpace,e.includePreLineTrailingSpace,r].join("_"),o=this.cache.get(s);if(o!==null)return o;var u="",a=this.characterType==ut,f,l,c=!1,h=this;if(a)if(this.type==pt)u="\n";else if(t!=" "||!(!p()||l.isTrailingSpace||l.character=="\n"||l.character==" "&&l.characterType==ut))if(t=="\n"&&this.isLeadingSpace)p()&&l.character!="\n"&&(u="\n");else{f=this.nextUncollapsed();if(f){f.isBr?this.type=lt:f.isTrailingSpace&&f.character=="\n"?this.type=ft:f.isLeadingSpace&&f.character=="\n"&&(this.type=at);if(f.character=="\n"){if(this.type!=lt||!!e.includeSpaceBeforeBr)if(this.type!=at||!!e.includeSpaceBeforeBlock)if(this.type!=ft||!f.isTrailingSpace||!!e.includeBlockContentTrailingSpace)if(this.type!=ct||f.type!=st||!!e.includePreLineTrailingSpace)t=="\n"?f.isTrailingSpace?this.isTrailingSpace||this.isBr&&(f.type=ht,p()&&l.isLeadingSpace&&!l.isTrailingSpace&&l.character=="\n"?f.character="":f.type=pt):u="\n":t==" "&&(u=" ")}else u=t}}return r.indexOf(u)>-1&&(u=""),this.cache.set(s,u),u},equals:function(e){return!!e&&this.node===e.node&&this.offset===e.offset},inspect:vt,toString:function(){return this.character}};dt.prototype=mt,u(mt,{next:tt("nextPos",function(e){var t=e.nodeWrapper,n=e.node,r=e.offset,i=t.session;if(!n)return null;var s,o,u;return r==t.getLength()?(s=n.parentNode,o=s?t.getNodeIndex()+1:0):t.isCharacterDataNode()?(s=n,o=r+1):(u=n.childNodes[r],i.getNodeWrapper(u).containsPositions()?(s=u,o=0):(s=n,o=r+1)),s?i.getPosition 16 (s,o):null}),previous:tt("previous",function(e){var t=e.nodeWrapper,n=e.node,r=e.offset,i=t.session,o,u,a;return r==0?(o=n.parentNode,u=o?t.getNodeIndex():0):t.isCharacterDataNode()?(o=n,u=r-1):(a=n.childNodes[r-1],i.getNodeWrapper(a).containsPositions()?(o=a,u=s.getNodeLength(a)):(o=n,u=r-1)),o?i.getPosition(o,u):null}),nextVisible:tt("nextVisible",function(e){var t=e.next();if(!t)return null;var n=t.nodeWrapper,r=t.node,i=t;return n.isCollapsed()&&(i=n.session.getPosition(r.parentNode,n.getNodeIndex()+1)),i}),nextUncollapsed:tt("nextUncollapsed",function(e){var t=e;while(t=t.nextVisible()){t.resolveLeadingAndTrailingSpaces();if(t.character!=="")return t}return null}),previousVisible:tt("previousVisible",function(e){var t=e.previous();if(!t)return null;var n=t.nodeWrapper,r=t.node,i=t;return n.isCollapsed()&&(i=n.session.getPosition(r.parentNode,n.getNodeIndex())),i})});var gt=null,yt=function(){function e(e){var t=new Y;return{get:function(n){var r=t.get(n[e]);if(r)for(var i=0,s;s=r[i++];)if(s.node===n)return s;return null},set:function(n){var r=n.node[e],i=t.get(r)||t.set(r,[]);i.push(n)}}}function n(){this.initCaches()}var t=o.isHostProperty(document.documentElement,"uniqueID");return n.prototype={initCaches:function(){this.elementCache=t?function(){var e=new Y;return{get:function(t){return e.get(t.uniqueID)},set:function(t){e.set(t.node.uniqueID,t)}}}():e("tagName"),this.textNodeCache=e("data"),this.otherNodeCache=e("nodeName")},getNodeWrapper:function(e){var t;switch(e.nodeType){case 1:t=this.elementCache;break;case 3:t=this.textNodeCache;break;default:t=this.otherNodeCache}var n=t.get(e);return n||(n=new nt(e,this),t.set(n)),n},getPosition:function(e,t){return this.getNodeWrapper(e).getPosition(t)},getRangeBoundaryPosition:function(e,t){var n=t?"start":"end";return this.getPosition(e[n+"Container"],e[n+"Offset"])},detach:function(){this.elementCache=this.textNodeCache=this.otherNodeCache=null}},n}();u(s,{nextNode:V,previousNode:$});var xt=Array.prototype.indexOf?function(e,t){return e.indexOf(t)}:function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1};u(e.rangePrototype,{moveStart:Mt(!0,!1),moveEnd:Mt(!1,!1),move:Mt(!0,!0),trimStart:_t(!0),trimEnd:_t(!1),trim:Ot(function(e,t){var n=this.trimStart(t),r=this.trimEnd(t);return n||r}),expand:Ot(function(e,t,n){var s=!1;n=D(n,O);var o=n.characterOptions;t||(t=r);if(t==i){var u=n.wordOptions,a=e.getRangeBoundaryPosition(this,!0),f=e.getRangeBoundaryPosition(this,!1),l=Tt(a,o,u),c=l.nextEndToken(),h=c.chars[0].previousVisible(),p,d;if(this.collapsed)p=c;else{var v=Tt(f,o,u);p=v.previousStartToken()}return d=p.chars[p.chars.length-1],h.equals(a)||(this.setStart(h.node,h.offset),s=!0),d&&!d.equals(f)&&(this.setEnd(d.node,d.offset),s=!0),n.trim&&(n.trimStart&&(s=this.trimStart(o)||s),n.trimEnd&&(s=this.trimEnd(o)||s)),s}return this.moveEnd(r,1,n)}),text:Ot(function(e,t){return this.collapsed?"":kt(e,this,a(t,T)).join("")}),selectCharacters:Ot(function(e,t,n,r,i){var s={characterOptions:i};t||(t=f(this.getDocument())),this.selectNodeContents(t),this.collapse(!0),this.moveStart("character",n,s),this.collapse(!0),this.moveEnd("character",r-n,s)}),toCharacterRange:Ot(function(e,t,n){t||(t=f(this.getDocument()));var r=t.parentNode,i=s.getNodeIndex(t),o=s.comparePoints(this.startContainer,this.endContainer,r,i)==-1,u=this.cloneRange(),a,l;return o?(u.setStartAndEnd(this.startContainer,this.startOffset,r,i),a=-u.text(n).length):(u.setStartAndEnd(r,i,this.startContainer,this.startOffset),a=u.text(n).length),l=a+this.text(n).length,{start:a,end:l}}),findText:Ot(function(t,n,r){r=D(r,L),r.wholeWordsOnly&&(r.wordOptions.includeTrailingSpace=!1);var i=m(r.direction),s=r.withinRange;s||(s=e.createRange(),s.selectNodeContents(this.getDocument()));var o=n,u=!1;typeof o=="string"?r.caseSensitive||(o=o.toLowerCase()):u=!0;var a=t.getRangeBoundaryPosition(this,!i),f=s.comparePoint(a.node,a.offset);f===-1?a=t.getRangeBoundaryPosition(s,!0):f===1&&(a=t.getRangeBoundaryPosition(s,!1));var l=a,c=!1,h;for(;;){h=At(l,o,u,s,r);if(h){if(h.valid)return this.setStartAndEnd(h.startPos.node,h.startPos.offset,h.endPos.node,h.endPos.offset),!0;l=i?h.startPos:h.endPos}else{if(!r.wrap||!!c)return!1;s=s.cloneRange(),l=t.getRangeBoundaryPosition(s,!i),s.setBoundary(a.node,a.offset,i),c=!0}}}),pasteHtml:function(e){this.deleteContents();if(e){var t=this.createContextualFragment(e),n=t.lastChild;this.insertNode(t),this.collapseAfter(n)}}}),u(e.selectionPrototype,{expand:Ot(function(e,t,n){this.changeEachRange(function(e){e.expand(t,n)})}),move:Ot(function(e,t,n,r){var i=0;if(this.focusNode){this.collapse(this.focusNode,this.focusOffset);var s=this.getRangeAt(0);r||(r={}),r.characterOptions=a(r.characterOptions,C),i=s.move(t,n,r),this.setSingleRange(s)}return i}),trimStart:Dt("trimStart"),trimEnd:Dt("trimEnd"),trim:Dt("trim"),selectCharacters:Ot(function(t,n,r,i,s,o){var u=e.createRange(n);u.selectCharacters(n,r,i,o),this.setSingleRange(u,s)}),saveCharacterRanges:Ot(function(e,t,n){var r=this.getAllRanges(),i=r.length,s=[],o=i==1&&this.isBackward();for(var u=0,a=r.length;u<a;++u)s[u]={characterRange:r[u].toCharacterRange(t,n),backward:o,characterOptions:n};return s}),restoreCharacterRanges:Ot(function(t,n,r){this.removeAllRanges();for(var i=0,s=r.length,o,u,a;i<s;++i)u=r[i],a=u.characterRange,o=e.createRange(n),o.selectCharacters(n,a.start,a.end,u.characterOptions),this.addRange(o,u.backward)}),text:Ot(function(e,t){var n=[];for(var r=0,i=this.rangeCount;r<i;++r)n[r]=this.getRangeAt(r).text(t);return n.join("")})}),e.innerText=function(t,n){var r=e.createRange(t);r.selectNodeContents(t);var i=r.text(n);return i},e.createWordIterator=function(e,t,n){var r=wt();n=D(n,M);var i=r.getPosition(e,t),s=Tt(i,n.characterOptions,n.wordOptions),o=m(n.direction);return{next:function(){return o?s.previousStartToken():s.nextEndToken()},dispose:function(){s.dispose(),this.next=function(){}}}},e.noMutation=function(e){var t=wt();e(t),Et()},e.noMutation.createEntryPointFunction= 17 Ot,e.textRange={isBlockNode:q,isCollapsedWhitespaceNode:K,createPosition:Ot(function(e,t,n){return e.getPosition(t,n)})}}),e},this),YUI.add("moodle-editor_atto-rangy",function(e,t){rangy.initialized||rangy.init()},"@VERSION@",{requires:[]});
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |