ice-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in wysihtml5-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,35 @@
1
+ ice-rails
2
+ ---
3
+
4
+ Copyright (c) DJ LoBraico
5
+
6
+ This program is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License, version 2, as
8
+ published by the Free Software Foundation.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program as the file license.txt. If not, see
17
+ <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>
18
+
19
+ ice
20
+ ---
21
+
22
+ Copyright (c) The New York Times, CMS Group, Matthew DeLambo
23
+
24
+ This program is free software; you can redistribute it and/or modify
25
+ it under the terms of the GNU General Public License, version 2, as
26
+ published by the Free Software Foundation.
27
+
28
+ This program is distributed in the hope that it will be useful,
29
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
30
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31
+ GNU General Public License for more details.
32
+
33
+ You should have received a copy of the GNU General Public License
34
+ along with this program as the file license.txt. If not, see
35
+ <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # ice for rails
2
+
3
+ The NYTimes Javascript track changes library packaged for use in the Rails 3 asset pipeline.
4
+
5
+ ## Installation
6
+
7
+ Add to your Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ice-rails'
11
+ ```
12
+
13
+ and run:
14
+
15
+ ```sh
16
+ bundle install
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Require it in your JS manifest's file:
22
+
23
+ ```js
24
+ //= require ice
25
+ ```
26
+
27
+ For more information, check out [ice on Github](https://github.com/NYTimes/ice).
28
+
29
+ ## License
30
+
31
+ ice and ice-rails are distributed under the GPL2 License.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/ice-LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ Copyright (c) The New York Times, CMS Group, Matthew DeLambo
2
+
3
+ This program is free software; you can redistribute it and/or modify
4
+ it under the terms of the GNU General Public License, version 2, as
5
+ published by the Free Software Foundation.
6
+
7
+ This program is distributed in the hope that it will be useful,
8
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
+ GNU General Public License for more details.
11
+
12
+ You should have received a copy of the GNU General Public License
13
+ along with this program as the file license.txt. If not, see
14
+ <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>
data/ice-NOTICE ADDED
@@ -0,0 +1,53 @@
1
+ ice includes and was inspired by the following software:
2
+ --------------------------------------------------------
3
+
4
+ Rangy
5
+ -----
6
+
7
+ The MIT License
8
+ Copyright (c) 2010 Tim Down
9
+
10
+ Permission is hereby granted, free of charge, to any person
11
+ obtaining a copy of this software and associated documentation
12
+ files (the "Software"), to deal in the Software without
13
+ restriction, including without limitation the rights to use,
14
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the
16
+ Software is furnished to do so, subject to the following
17
+ conditions:
18
+
19
+ The above copyright notice and this permission notice shall be
20
+ included in all copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
24
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
27
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29
+ OTHER DEALINGS IN THE SOFTWARE.
30
+
31
+
32
+ Viper
33
+ -----
34
+
35
+ Squiz Pty Ltd <products@squiz.net>
36
+ 2010 Squiz Pty Ltd (ACN 084 670 600)
37
+
38
+ Viper is a WYSIWYG that does not require the use of editable regions. Instead
39
+ it utilises the browser's range API to edit the content directly in the browser.
40
+
41
+ This program is free software; you can redistribute it and/or modify
42
+ it under the terms of the GNU General Public License, version 2, as
43
+ published by the Free Software Foundation.
44
+
45
+ This program is distributed in the hope that it will be useful,
46
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
47
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48
+ GNU General Public License for more details.
49
+
50
+ You should have received a copy of the GNU General Public License
51
+ along with this program as the file license.txt. If not, see
52
+ <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>
53
+
data/ice-rails.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/ice-rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["D. LoBraico"]
6
+ gem.email = ["dj@lobraico.com"]
7
+ gem.description = %q{The NYTimes's track changes library for the Rails 3 asset pipeline.}
8
+ gem.summary = %q{ice for rails}
9
+ gem.homepage = "https://github.com/pygatea/ice-rails"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "ice-rails"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Ice::Rails::VERSION
17
+
18
+ gem.add_dependency 'railties', '>= 3.1.0'
19
+ end
data/lib/ice-rails.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "ice-rails/version"
2
+ require "rails/engine"
3
+
4
+ module Ice
5
+ module Rails
6
+ class Engine < ::Rails::Engine; end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Ice
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ /**
2
+ Copyright (c) The New York Times, CMS Group, Matthew DeLambo
3
+
4
+ This program is free software; you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License, version 2, as
6
+ published by the Free Software Foundation.
7
+
8
+ This program is distributed in the hope that it will be useful,
9
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ GNU General Public License for more details.
12
+
13
+ You should have received a copy of the GNU General Public License
14
+ along with this program as the file license.txt. If not, see
15
+ <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>
16
+
17
+ **/
18
+ window.rangy=(function(){var k="object",h="function",A="undefined";var l=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer","START_TO_START","START_TO_END","END_TO_START","END_TO_END"];var d=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"];var s=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"];var p=["collapse","compareEndPoints","duplicate","getBookmark","moveToBookmark","moveToElementText","parentElement","pasteHTML","select","setEndPoint","getBoundingClientRect"];function j(D,C){var B=typeof D[C];return B==h||(!!(B==k&&D[C]))||B=="unknown"}function e(C,B){return !!(typeof C[B]==k&&C[B])}function q(C,B){return typeof C[B]!=A}function m(B){return function(E,D){var C=D.length;while(C--){if(!B(E,D[C])){return false}}return true}}var o=m(j);var r=m(e);var z=m(q);function v(B){return B&&o(B,p)&&z(B,s)}var n={version:"1.2",initialized:false,supported:true,util:{isHostMethod:j,isHostObject:e,isHostProperty:q,areHostMethods:o,areHostObjects:r,areHostProperties:z,isTextRange:v},features:{},modules:{},config:{alertOnWarn:false,preferTextRange:false}};function g(B){window.alert("Rangy not supported in your browser. Reason: "+B);n.initialized=true;n.supported=false}n.fail=g;function u(C){var B="Rangy warning: "+C;if(n.config.alertOnWarn){window.alert(B)}else{if(typeof window.console!=A&&typeof window.console.log!=A){window.console.log(B)}}}n.warn=u;if({}.hasOwnProperty){n.util.extend=function(D,C){for(var B in C){if(C.hasOwnProperty(B)){D[B]=C[B]}}}}else{g("hasOwnProperty not supported")}var w=[];var a=[];function t(){if(n.initialized){return}var D;var H=false,I=false;if(j(document,"createRange")){D=document.createRange();if(o(D,d)&&z(D,l)){H=true}D.detach()}var C=e(document,"body")?document.body:document.getElementsByTagName("body")[0];if(C&&j(C,"createTextRange")){D=C.createTextRange();if(v(D)){I=true}}if(!H&&!I){g("Neither Range nor TextRange are implemented")}n.initialized=true;n.features={implementsDomRange:H,implementsTextRange:I};var G=a.concat(w);for(var F=0,B=G.length;F<B;++F){try{G[F](n)}catch(E){if(e(window,"console")&&j(window.console,"log")){window.console.log("Init listener threw an exception. Continuing.",E)}}}}n.init=t;n.addInitListener=function(B){if(n.initialized){B(n)}else{w.push(B)}};var x=[];n.addCreateMissingNativeApiListener=function(B){x.push(B)};function f(D){D=D||window;t();for(var C=0,B=x.length;C<B;++C){x[C](D)}}n.createMissingNativeApi=f;function y(B){this.name=B;this.initialized=false;this.supported=false}y.prototype.fail=function(B){this.initialized=true;this.supported=false;throw new Error("Module '"+this.name+"' failed to load: "+B)};y.prototype.warn=function(B){n.warn("Module "+this.name+": "+B)};y.prototype.createError=function(B){return new Error("Error in Rangy "+this.name+" module: "+B)};n.createModule=function(B,D){var C=new y(B);n.modules[B]=C;a.push(function(E){D(E,C);C.initialized=true;C.supported=true})};n.requireModules=function(D){for(var F=0,B=D.length,E,C;F<B;++F){C=D[F];E=n.modules[C];if(!E||!(E instanceof y)){throw new Error("Module '"+C+"' not found")}if(!E.supported){throw new Error("Module '"+C+"' not supported")}}};var b=false;var i=function(B){if(!b){b=true;if(!n.initialized){t()}}};if(typeof window==A){g("No window found");return}if(typeof document==A){g("No document found");return}if(j(document,"addEventListener")){document.addEventListener("DOMContentLoaded",i,false)}if(j(window,"addEventListener")){window.addEventListener("load",i,false)}else{if(j(window,"attachEvent")){window.attachEvent("onload",i)}else{g("Window does not have required addEventListener or attachEvent method")}}return n})();rangy.createModule("DomUtil",function(o,e){var s="undefined";var b=o.util;if(!b.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])){e.fail("document missing a Node creation method")}if(!b.isHostMethod(document,"getElementsByTagName")){e.fail("document missing getElementsByTagName method")}var f=document.createElement("div");if(!b.areHostMethods(f,["insertBefore","appendChild","cloneNode"]||!b.areHostObjects(f,["previousSibling","nextSibling","childNodes","parentNode"]))){e.fail("Incomplete Element implementation")}var r=document.createTextNode("test");if(!b.areHostMethods(r,["splitText","deleteData","insertData","appendData","cloneNode"]||!b.areHostObjects(f,["previousSibling","nextSibling","childNodes","parentNode"])||!b.areHostProperties(r,["data"]))){e.fail("Incomplete Text Node implementation")}var x=function(C,E){var D=C.length;while(D--){if(C[D]===E){return true}}return false};function a(D){var C=0;while((D=D.previousSibling)){C++}return C}function h(C){var D;return k(C)?C.length:((D=C.childNodes)?D.length:0)}function w(D,C){var E=[],F;for(F=D;F;F=F.parentNode){E.push(F)}for(F=C;F;F=F.parentNode){if(x(E,F)){return F}}return null}function A(C,D,F){var E=F?D:D.parentNode;while(E){if(E===C){return true}else{E=E.parentNode}}return false}function y(D,C,G){var E,F=G?D:D.parentNode;while(F){E=F.parentNode;if(E===C){return F}F=E}return null}function k(D){var C=D.nodeType;return C==3||C==4||C==8}function u(F,D){var C=D.nextSibling,E=D.parentNode;if(C){E.insertBefore(F,C)}else{E.appendChild(F)}return F}function v(E,C){var D=E.cloneNode(false);D.deleteData(0,C);E.deleteData(C,E.length-C);u(D,E);return D}function p(C){if(C.nodeType==9){return C}else{if(typeof C.ownerDocument!=s){return C.ownerDocument}else{if(typeof C.document!=s){return C.document}else{if(C.parentNode){return p(C.parentNode)}else{throw new Error("getDocument: no document found for node")}}}}}function l(C){var D=p(C);if(typeof D.defaultView!=s){return D.defaultView}else{if(typeof D.parentWindow!=s){return D.parentWindow}else{throw new Error("Cannot get a window object for node")}}}function z(C){if(typeof C.contentDocument!=s){return C.contentDocument}else{if(typeof C.contentWindow!=s){return C.contentWindow.document}else{throw new Error("getIframeWindow: No Document object found for iframe element")}}}function g(C){if(typeof C.contentWindow!=s){return C.contentWindow}else{if(typeof C.contentDocument!=s){return C.contentDocument.defaultView}else{throw new Error("getIframeWindow: No Window object found for iframe element")}}}function B(C){return b.isHostObject(C,"body")?C.body:C.getElementsByTagName("body")[0]}function d(D){var C;while((C=D.parentNode)){D=C}return D}function q(F,H,E,G){var C,I,K,J,D;if(F==E){return H===G?0:(H<G)?-1:1}else{if((C=y(E,F,true))){return H<=a(C)?-1:1}else{if((C=y(F,E,true))){return a(C)<G?-1:1}else{I=w(F,E);K=(F===I)?I:y(F,I,true);J=(E===I)?I:y(E,I,true);if(K===J){throw new Error("comparePoints got to case 4 and childA and childB are the same!")}else{D=I.firstChild;while(D){if(D===K){return -1}else{if(D===J){return 1}}D=D.nextSibling}throw new Error("Should not be here!")}}}}}function n(C){if(!C){return"[No node]"}if(k(C)){return'"'+C.data+'"'}else{if(C.nodeType==1){var D=C.id?' id="'+C.id+'"':"";return"<"+C.nodeName+D+">["+C.childNodes.length+"]"}else{return C.nodeName}}}function m(C){this.root=C;this._next=C}m.prototype={_current:null,hasNext:function(){return !!this._next},next:function(){var E=this._current=this._next;var D,C;if(this._current){D=E.firstChild;if(D){this._next=D}else{C=null;while((E!==this.root)&&!(C=E.nextSibling)){E=E.parentNode}this._next=C}}return this._current},detach:function(){this._current=this._next=this.root=null}};function i(C){return new m(C)}function j(C,D){this.node=C;this.offset=D}j.prototype={equals:function(C){return this.node===C.node&this.offset==C.offset},inspect:function(){return"[DomPosition("+n(this.node)+":"+this.offset+")]"}};function t(C){this.code=this[C];this.codeName=C;this.message="DOMException: "+this.codeName}t.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};t.prototype.toString=function(){return this.message};o.dom={arrayContains:x,getNodeIndex:a,getNodeLength:h,getCommonAncestor:w,isAncestorOf:A,getClosestAncestorIn:y,isCharacterDataNode:k,insertAfter:u,splitDataNode:v,getDocument:p,getWindow:l,getIframeWindow:g,getIframeDocument:z,getBody:B,getRootContainer:d,comparePoints:q,inspectNode:n,createIterator:i,DomPosition:j};o.DOMException=t});rangy.createModule("DomRange",function(h,e){h.requireModules(["DomUtil"]);var a=h.dom;var D=a.DomPosition;var Q=h.DOMException;function w(ai,ah){return(ai.nodeType!=3)&&(a.isAncestorOf(ai,ah.startContainer,true)||a.isAncestorOf(ai,ah.endContainer,true))}function l(ah){return a.getDocument(ah.startContainer)}function t(ai,am,aj){var al=ai._listeners[am];if(al){for(var ak=0,ah=al.length;ak<ah;++ak){al[ak].call(ai,{target:ai,args:aj})}}}function z(ah){return new D(ah.parentNode,a.getNodeIndex(ah))}function T(ah){return new D(ah.parentNode,a.getNodeIndex(ah)+1)}function i(ai,ak,aj){var ah=ai.nodeType==11?ai.firstChild:ai;if(a.isCharacterDataNode(ak)){if(aj==ak.length){a.insertAfter(ai,ak)}else{ak.parentNode.insertBefore(ai,aj==0?ak:a.splitDataNode(ak,aj))}}else{if(aj>=ak.childNodes.length){ak.appendChild(ai)}else{ak.insertBefore(ai,ak.childNodes[aj])}}return ah}function G(aj){var ai;for(var ak,al=l(aj.range).createDocumentFragment(),ah;ak=aj.next();){ai=aj.isPartiallySelectedSubtree();ak=ak.cloneNode(!ai);if(ai){ah=aj.getSubtreeIterator();ak.appendChild(G(ah));ah.detach(true)}if(ak.nodeType==10){throw new Q("HIERARCHY_REQUEST_ERR")}al.appendChild(ak)}return al}function S(ai,al,ah){var aj,an;ah=ah||{stop:false};for(var ak,am;ak=ai.next();){if(ai.isPartiallySelectedSubtree()){if(al(ak)===false){ah.stop=true;return}else{am=ai.getSubtreeIterator();S(am,al,ah);am.detach(true);if(ah.stop){return}}}else{aj=a.createIterator(ak);while((an=aj.next())){if(al(an)===false){ah.stop=true;return}}}}}function m(ai){var ah;while(ai.next()){if(ai.isPartiallySelectedSubtree()){ah=ai.getSubtreeIterator();m(ah);ah.detach(true)}else{ai.remove()}}}function O(ai){for(var aj,ak=l(ai.range).createDocumentFragment(),ah;aj=ai.next();){if(ai.isPartiallySelectedSubtree()){aj=aj.cloneNode(false);ah=ai.getSubtreeIterator();aj.appendChild(O(ah));ah.detach(true)}else{ai.remove()}if(aj.nodeType==10){throw new Q("HIERARCHY_REQUEST_ERR")}ak.appendChild(aj)}return ak}function o(aj,ah,ak){var am=!!(ah&&ah.length),al;var an=!!ak;if(am){al=new RegExp("^("+ah.join("|")+")$")}var ai=[];S(new f(aj,false),function(ao){if((!am||al.test(ao.nodeType))&&(!an||ak(ao))){ai.push(ao)}});return ai}function y(ah){var ai=(typeof ah.getName=="undefined")?"Range":ah.getName();return"["+ai+"("+a.inspectNode(ah.startContainer)+":"+ah.startOffset+", "+a.inspectNode(ah.endContainer)+":"+ah.endOffset+")]"}function f(aj,ai){this.range=aj;this.clonePartiallySelectedTextNodes=ai;if(!aj.collapsed){this.sc=aj.startContainer;this.so=aj.startOffset;this.ec=aj.endContainer;this.eo=aj.endOffset;var ah=aj.commonAncestorContainer;if(this.sc===this.ec&&a.isCharacterDataNode(this.sc)){this.isSingleCharacterDataNode=true;this._first=this._last=this._next=this.sc}else{this._first=this._next=(this.sc===ah&&!a.isCharacterDataNode(this.sc))?this.sc.childNodes[this.so]:a.getClosestAncestorIn(this.sc,ah,true);this._last=(this.ec===ah&&!a.isCharacterDataNode(this.ec))?this.ec.childNodes[this.eo-1]:a.getClosestAncestorIn(this.ec,ah,true)}}}f.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:false,reset:function(){this._current=null;this._next=this._first},hasNext:function(){return !!this._next},next:function(){var ah=this._current=this._next;if(ah){this._next=(ah!==this._last)?ah.nextSibling:null;if(a.isCharacterDataNode(ah)&&this.clonePartiallySelectedTextNodes){if(ah===this.ec){(ah=ah.cloneNode(true)).deleteData(this.eo,ah.length-this.eo)}if(this._current===this.sc){(ah=ah.cloneNode(true)).deleteData(0,this.so)}}}return ah},remove:function(){var ai=this._current,aj,ah;if(a.isCharacterDataNode(ai)&&(ai===this.sc||ai===this.ec)){aj=(ai===this.sc)?this.so:0;ah=(ai===this.ec)?this.eo:ai.length;if(aj!=ah){ai.deleteData(aj,ah-aj)}}else{if(ai.parentNode){ai.parentNode.removeChild(ai)}else{}}},isPartiallySelectedSubtree:function(){var ah=this._current;return w(ah,this.range)},getSubtreeIterator:function(){var ai;if(this.isSingleCharacterDataNode){ai=this.range.cloneRange();ai.collapse()}else{ai=new af(l(this.range));var am=this._current;var ak=am,ah=0,al=am,aj=a.getNodeLength(am);if(a.isAncestorOf(am,this.sc,true)){ak=this.sc;ah=this.so}if(a.isAncestorOf(am,this.ec,true)){al=this.ec;aj=this.eo}C(ai,ak,ah,al,aj)}return new f(ai,this.clonePartiallySelectedTextNodes)},detach:function(ah){if(ah){this.range.detach()}this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};function N(ah){this.code=this[ah];this.codeName=ah;this.message="RangeException: "+this.codeName}N.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2};N.prototype.toString=function(){return this.message};function v(ai,ah,aj){this.nodes=o(ai,ah,aj);this._next=this.nodes[0];this._position=0}v.prototype={_current:null,hasNext:function(){return !!this._next},next:function(){this._current=this._next;this._next=this.nodes[++this._position];return this._current},detach:function(){this._current=this._next=this.nodes=null}};var ab=[1,3,4,5,7,8,10];var Z=[2,9,11];var A=[5,6,10,12];var L=[1,3,4,5,7,8,10,11];var E=[1,3,4,5,7,8];function V(ah){return function(aj,al){var ai,ak=al?aj:aj.parentNode;while(ak){ai=ak.nodeType;if(a.arrayContains(ah,ai)){return ak}ak=ak.parentNode}return null}}var s=a.getRootContainer;var H=V([9,11]);var J=V(A);var b=V([6,10,12]);function q(ai,ah){if(b(ai,ah)){throw new N("INVALID_NODE_TYPE_ERR")}}function B(ah){if(!ah.startContainer){throw new Q("INVALID_STATE_ERR")}}function R(ah,ai){if(!a.arrayContains(ai,ah.nodeType)){throw new N("INVALID_NODE_TYPE_ERR")}}function aa(ah,ai){if(ai<0||ai>(a.isCharacterDataNode(ah)?ah.length:ah.childNodes.length)){throw new Q("INDEX_SIZE_ERR")}}function d(ai,ah){if(H(ai,true)!==H(ah,true)){throw new Q("WRONG_DOCUMENT_ERR")}}function X(ah){if(J(ah,true)){throw new Q("NO_MODIFICATION_ALLOWED_ERR")}}function ad(ai,ah){if(!ai){throw new Q(ah)}}function n(ah){return !a.arrayContains(Z,ah.nodeType)&&!H(ah,true)}function ag(ah,ai){return ai<=(a.isCharacterDataNode(ah)?ah.length:ah.childNodes.length)}function g(ah){B(ah);if(n(ah.startContainer)||n(ah.endContainer)||!ag(ah.startContainer,ah.startOffset)||!ag(ah.endContainer,ah.endOffset)){throw new Error("Range error: Range is no longer valid after DOM mutation ("+ah.inspect()+")")}}var K=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"];var k=0,x=1,ac=2,W=3;var r=0,u=1,I=2,j=3;function Y(){}Y.prototype={attachListener:function(ah,ai){this._listeners[ah].push(ai)},compareBoundaryPoints:function(am,aj){g(this);d(this.startContainer,aj.startContainer);var ao,ai,an,ah;var al=(am==W||am==k)?"start":"end";var ak=(am==x||am==k)?"start":"end";ao=this[al+"Container"];ai=this[al+"Offset"];an=aj[ak+"Container"];ah=aj[ak+"Offset"];return a.comparePoints(ao,ai,an,ah)},insertNode:function(ai){g(this);R(ai,L);X(this.startContainer);if(a.isAncestorOf(ai,this.startContainer,true)){throw new Q("HIERARCHY_REQUEST_ERR")}var ah=i(ai,this.startContainer,this.startOffset);this.setStartBefore(ah)},cloneContents:function(){g(this);var aj,ai;if(this.collapsed){return l(this).createDocumentFragment()}else{if(this.startContainer===this.endContainer&&a.isCharacterDataNode(this.startContainer)){aj=this.startContainer.cloneNode(true);aj.data=aj.data.slice(this.startOffset,this.endOffset);ai=l(this).createDocumentFragment();ai.appendChild(aj);return ai}else{var ah=new f(this,true);aj=G(ah);ah.detach()}return aj}},canSurroundContents:function(){g(this);X(this.startContainer);X(this.endContainer);var ah=new f(this,true);var ai=(ah._first&&(w(ah._first,this))||(ah._last&&w(ah._last,this)));ah.detach();return !ai},surroundContents:function(ai){R(ai,E);if(!this.canSurroundContents()){throw new N("BAD_BOUNDARYPOINTS_ERR")}var ah=this.extractContents();if(ai.hasChildNodes()){while(ai.lastChild){ai.removeChild(ai.lastChild)}}i(ai,this.startContainer,this.startOffset);ai.appendChild(ah);this.selectNode(ai)},cloneRange:function(){g(this);var ah=new af(l(this));var ai=K.length,aj;while(ai--){aj=K[ai];ah[aj]=this[aj]}return ah},toString:function(){g(this);var ai=this.startContainer;if(ai===this.endContainer&&a.isCharacterDataNode(ai)){return(ai.nodeType==3||ai.nodeType==4)?ai.data.slice(this.startOffset,this.endOffset):""}else{var aj=[],ah=new f(this,true);S(ah,function(ak){if(ak.nodeType==3||ak.nodeType==4){aj.push(ak.data)}});ah.detach();return aj.join("")}},compareNode:function(aj){g(this);var ai=aj.parentNode;var al=a.getNodeIndex(aj);if(!ai){throw new Q("NOT_FOUND_ERR")}var ak=this.comparePoint(ai,al),ah=this.comparePoint(ai,al+1);if(ak<0){return(ah>0)?I:r}else{return(ah>0)?u:j}},comparePoint:function(ah,ai){g(this);ad(ah,"HIERARCHY_REQUEST_ERR");d(ah,this.startContainer);if(a.comparePoints(ah,ai,this.startContainer,this.startOffset)<0){return -1}else{if(a.comparePoints(ah,ai,this.endContainer,this.endOffset)>0){return 1}}return 0},createContextualFragment:function(ai){B(this);var aj=l(this);var ah=aj.createElement("div");ah.innerHTML=ai;var al=aj.createDocumentFragment(),ak;while((ak=ah.firstChild)){al.appendChild(ak)}return al},toHtml:function(){g(this);var ah=l(this).createElement("div");ah.appendChild(this.cloneContents());return ah.innerHTML},intersectsNode:function(ak,ah){g(this);ad(ak,"NOT_FOUND_ERR");if(a.getDocument(ak)!==l(this)){return false}var aj=ak.parentNode,am=a.getNodeIndex(ak);ad(aj,"NOT_FOUND_ERR");var al=a.comparePoints(aj,am,this.endContainer,this.endOffset),ai=a.comparePoints(aj,am+1,this.startContainer,this.startOffset);return ah?al<=0&&ai>=0:al<0&&ai>0},isPointInRange:function(ah,ai){g(this);ad(ah,"HIERARCHY_REQUEST_ERR");d(ah,this.startContainer);return(a.comparePoints(ah,ai,this.startContainer,this.startOffset)>=0)&&(a.comparePoints(ah,ai,this.endContainer,this.endOffset)<=0)},intersectsRange:function(ai,ah){g(this);if(l(ai)!=l(this)){throw new Q("WRONG_DOCUMENT_ERR")}var ak=a.comparePoints(this.startContainer,this.startOffset,ai.endContainer,ai.endOffset),aj=a.comparePoints(this.endContainer,this.endOffset,ai.startContainer,ai.startOffset);return ah?ak<=0&&aj>=0:ak<0&&aj>0},intersection:function(ah){if(this.intersectsRange(ah)){var ak=a.comparePoints(this.startContainer,this.startOffset,ah.startContainer,ah.startOffset),ai=a.comparePoints(this.endContainer,this.endOffset,ah.endContainer,ah.endOffset);var aj=this.cloneRange();if(ak==-1){aj.setStart(ah.startContainer,ah.startOffset)}if(ai==1){aj.setEnd(ah.endContainer,ah.endOffset)}return aj}return null},union:function(ah){if(this.intersectsRange(ah,true)){var ai=this.cloneRange();if(a.comparePoints(ah.startContainer,ah.startOffset,this.startContainer,this.startOffset)==-1){ai.setStart(ah.startContainer,ah.startOffset)}if(a.comparePoints(ah.endContainer,ah.endOffset,this.endContainer,this.endOffset)==1){ai.setEnd(ah.endContainer,ah.endOffset)}return ai}else{throw new N("Ranges do not intersect")}},containsNode:function(ai,ah){if(ah){return this.intersectsNode(ai,false)}else{return this.compareNode(ai)==j}},containsNodeContents:function(ah){return this.comparePoint(ah,0)>=0&&this.comparePoint(ah,a.getNodeLength(ah))<=0},containsRange:function(ah){return this.intersection(ah).equals(ah)},containsNodeText:function(ak){var al=this.cloneRange();al.selectNode(ak);var aj=al.getNodes([3]);if(aj.length>0){al.setStart(aj[0],0);var ah=aj.pop();al.setEnd(ah,ah.length);var ai=this.containsRange(al);al.detach();return ai}else{return this.containsNodeContents(ak)}},createNodeIterator:function(ah,ai){g(this);return new v(this,ah,ai)},getNodes:function(ah,ai){g(this);return o(this,ah,ai)},getDocument:function(){return l(this)},collapseBefore:function(ah){B(this);this.setEndBefore(ah);this.collapse(false)},collapseAfter:function(ah){B(this);this.setStartAfter(ah);this.collapse(true)},getName:function(){return"DomRange"},equals:function(ah){return af.rangesEqual(this,ah)},inspect:function(){return y(this)}};function P(ah){ah.START_TO_START=k;ah.START_TO_END=x;ah.END_TO_END=ac;ah.END_TO_START=W;ah.NODE_BEFORE=r;ah.NODE_AFTER=u;ah.NODE_BEFORE_AND_AFTER=I;ah.NODE_INSIDE=j}function F(ah){P(ah);P(ah.prototype)}function p(ah,ai){return function(){g(this);var ao=this.startContainer,an=this.startOffset,aj=this.commonAncestorContainer;var al=new f(this,true);var am,ap;if(ao!==aj){am=a.getClosestAncestorIn(ao,aj,true);ap=T(am);ao=ap.node;an=ap.offset}S(al,X);al.reset();var ak=ah(al);al.detach();ai(this,ao,an,ao,an);return ak}}function U(ak,an,ah){function am(ap,ao){return function(aq){B(this);R(aq,ab);R(s(aq),Z);var ar=(ap?z:T)(aq);(ao?aj:al)(this,ar.node,ar.offset)}}function aj(ap,ar,at){var aq=ap.endContainer,ao=ap.endOffset;if(ar!==ap.startContainer||at!==this.startOffset){if(s(ar)!=s(aq)||a.comparePoints(ar,at,aq,ao)==1){aq=ar;ao=at}an(ap,ar,at,aq,ao)}}function al(ao,ap,at){var ar=ao.startContainer,aq=ao.startOffset;if(ap!==ao.endContainer||at!==this.endOffset){if(s(ap)!=s(ar)||a.comparePoints(ap,at,ar,aq)==-1){ar=ap;aq=at}an(ao,ar,aq,ap,at)}}function ai(ao,ap,aq){if(ap!==ao.startContainer||aq!==this.startOffset||ap!==ao.endContainer||aq!==this.endOffset){an(ao,ap,aq,ap,aq)}}ak.prototype=new Y();h.util.extend(ak.prototype,{setStart:function(ao,ap){B(this);q(ao,true);aa(ao,ap);aj(this,ao,ap)},setEnd:function(ao,ap){B(this);q(ao,true);aa(ao,ap);al(this,ao,ap)},setStartBefore:am(true,true),setStartAfter:am(false,true),setEndBefore:am(true,false),setEndAfter:am(false,false),collapse:function(ao){g(this);if(ao){an(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset)}else{an(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)}},selectNodeContents:function(ao){B(this);q(ao,true);an(this,ao,0,ao,a.getNodeLength(ao))},selectNode:function(ap){B(this);q(ap,false);R(ap,ab);var aq=z(ap),ao=T(ap);an(this,aq.node,aq.offset,ao.node,ao.offset)},extractContents:p(O,an),deleteContents:p(m,an),canSurroundContents:function(){g(this);X(this.startContainer);X(this.endContainer);var ao=new f(this,true);var ap=(ao._first&&(w(ao._first,this))||(ao._last&&w(ao._last,this)));ao.detach();return !ap},detach:function(){ah(this)},splitBoundaries:function(){g(this);var at=this.startContainer,ar=this.startOffset,ap=this.endContainer,ao=this.endOffset;var aq=(at===ap);if(a.isCharacterDataNode(ap)&&ao>0&&ao<ap.length){a.splitDataNode(ap,ao)}if(a.isCharacterDataNode(at)&&ar>0&&ar<at.length){at=a.splitDataNode(at,ar);if(aq){ao-=ar;ap=at}else{if(ap==at.parentNode&&ao>=a.getNodeIndex(at)){ao++}}ar=0}an(this,at,ar,ap,ao)},normalizeBoundaries:function(){g(this);var aw=this.startContainer,aq=this.startOffset,av=this.endContainer,ao=this.endOffset;var ar=function(az){var ay=az.nextSibling;if(ay&&ay.nodeType==az.nodeType){av=az;ao=az.length;az.appendData(ay.data);ay.parentNode.removeChild(ay)}};var ax=function(aA){var az=aA.previousSibling;if(az&&az.nodeType==aA.nodeType){aw=aA;var ay=aA.length;aq=az.length;aA.insertData(0,az.data);az.parentNode.removeChild(az);if(aw==av){ao+=aq;av=aw}else{if(av==aA.parentNode){var aB=a.getNodeIndex(aA);if(ao==aB){av=aA;ao=ay}else{if(ao>aB){ao--}}}}}};var au=true;if(a.isCharacterDataNode(av)){if(av.length==ao){ar(av)}}else{if(ao>0){var at=av.childNodes[ao-1];if(at&&a.isCharacterDataNode(at)){ar(at)}}au=!this.collapsed}if(au){if(a.isCharacterDataNode(aw)){if(aq==0){ax(aw)}}else{if(aq<aw.childNodes.length){var ap=aw.childNodes[aq];if(ap&&a.isCharacterDataNode(ap)){ax(ap)}}}}else{aw=av;aq=ao}an(this,aw,aq,av,ao)},collapseToPoint:function(ao,ap){B(this);q(ao,true);aa(ao,ap);ai(this,ao,ap)}});F(ak)}function M(ah){ah.collapsed=(ah.startContainer===ah.endContainer&&ah.startOffset===ah.endOffset);ah.commonAncestorContainer=ah.collapsed?ah.startContainer:a.getCommonAncestor(ah.startContainer,ah.endContainer)}function C(aj,al,ai,am,ak){var ah=(aj.startContainer!==al||aj.startOffset!==ai);var an=(aj.endContainer!==am||aj.endOffset!==ak);aj.startContainer=al;aj.startOffset=ai;aj.endContainer=am;aj.endOffset=ak;M(aj);t(aj,"boundarychange",{startMoved:ah,endMoved:an})}function ae(ah){B(ah);ah.startContainer=ah.startOffset=ah.endContainer=ah.endOffset=null;ah.collapsed=ah.commonAncestorContainer=null;t(ah,"detach",null);ah._listeners=null}function af(ah){this.startContainer=ah;this.startOffset=0;this.endContainer=ah;this.endOffset=0;this._listeners={boundarychange:[],detach:[]};M(this)}U(af,C,ae);h.rangePrototype=Y.prototype;af.rangeProperties=K;af.RangeIterator=f;af.copyComparisonConstants=F;af.createPrototypeRange=U;af.inspect=y;af.getRangeDocument=l;af.rangesEqual=function(ai,ah){return ai.startContainer===ah.startContainer&&ai.startOffset===ah.startOffset&&ai.endContainer===ah.endContainer&&ai.endOffset===ah.endOffset};h.DomRange=af;h.RangeException=N});rangy.createModule("WrappedRange",function(j,e){j.requireModules(["DomUtil","DomRange"]);var a;var i=j.dom;var b=i.DomPosition;var k=j.DomRange;function f(r){var p=r.parentElement();var n=r.duplicate();n.collapse(true);var q=n.parentElement();n=r.duplicate();n.collapse(false);var o=n.parentElement();var m=(q==o)?q:i.getCommonAncestor(q,o);return m==p?m:i.getCommonAncestor(p,m)}function d(m){return m.compareEndPoints("StartToEnd",m)==0}function g(A,x,o,t){var B=A.duplicate();B.collapse(o);var z=B.parentElement();if(!i.isAncestorOf(x,z,true)){z=x}if(!z.canHaveHTML){return new b(z.parentNode,i.getNodeIndex(z))}var n=i.getDocument(z).createElement("span");var y,v=o?"StartToStart":"StartToEnd";var w,r,m,p;do{z.insertBefore(n,n.previousSibling);B.moveToElementText(n)}while((y=B.compareEndPoints(v,A))>0&&n.previousSibling);p=n.nextSibling;if(y==-1&&p&&i.isCharacterDataNode(p)){B.setEndPoint(o?"EndToStart":"EndToEnd",A);var s;if(/[\r\n]/.test(p.data)){var u=B.duplicate();var q=u.text.replace(/\r\n/g,"\r").length;s=u.moveStart("character",q);while((y=u.compareEndPoints("StartToEnd",u))==-1){s++;u.moveStart("character",1)}}else{s=B.text.length}m=new b(p,s)}else{w=(t||!o)&&n.previousSibling;r=(t||o)&&n.nextSibling;if(r&&i.isCharacterDataNode(r)){m=new b(r,0)}else{if(w&&i.isCharacterDataNode(w)){m=new b(w,w.length)}else{m=new b(z,i.getNodeIndex(n))}}}n.parentNode.removeChild(n);return m}function l(m,o){var p,s,q=m.offset;var t=i.getDocument(m.node);var n,u,v=t.body.createTextRange();var r=i.isCharacterDataNode(m.node);if(r){p=m.node;s=p.parentNode}else{u=m.node.childNodes;p=(q<u.length)?u[q]:null;s=m.node}n=t.createElement("span");n.innerHTML="&#feff;";if(p){s.insertBefore(n,p)}else{s.appendChild(n)}v.moveToElementText(n);v.collapse(!o);s.removeChild(n);if(r){v[o?"moveStart":"moveEnd"]("character",q)}return v}if(j.features.implementsDomRange&&(!j.features.implementsTextRange||!j.config.preferTextRange)){(function(){var o;var t=k.rangeProperties;var w;function m(x){var y=t.length,z;while(y--){z=t[y];x[z]=x.nativeRange[z]}}function p(z,B,y,C,A){var x=(z.startContainer!==B||z.startOffset!=y);var D=(z.endContainer!==C||z.endOffset!=A);if(x||D){z.setEnd(C,A);z.setStart(B,y)}}function u(x){x.nativeRange.detach();x.detached=true;var y=t.length,z;while(y--){z=t[y];x[z]=null}}var n;a=function(x){if(!x){throw new Error("Range must be specified")}this.nativeRange=x;m(this)};k.createPrototypeRange(a,p,u);o=a.prototype;o.selectNode=function(x){this.nativeRange.selectNode(x);m(this)};o.deleteContents=function(){this.nativeRange.deleteContents();m(this)};o.extractContents=function(){var x=this.nativeRange.extractContents();m(this);return x};o.cloneContents=function(){return this.nativeRange.cloneContents()};o.surroundContents=function(x){this.nativeRange.surroundContents(x);m(this)};o.collapse=function(x){this.nativeRange.collapse(x);m(this)};o.cloneRange=function(){return new a(this.nativeRange.cloneRange())};o.refresh=function(){m(this)};o.toString=function(){return this.nativeRange.toString()};var s=document.createTextNode("test");i.getBody(document).appendChild(s);var q=document.createRange();q.setStart(s,0);q.setEnd(s,0);try{q.setStart(s,1);w=true;o.setStart=function(x,y){this.nativeRange.setStart(x,y);m(this)};o.setEnd=function(x,y){this.nativeRange.setEnd(x,y);m(this)};n=function(x){return function(y){this.nativeRange[x](y);m(this)}}}catch(r){w=false;o.setStart=function(y,z){try{this.nativeRange.setStart(y,z)}catch(x){this.nativeRange.setEnd(y,z);this.nativeRange.setStart(y,z)}m(this)};o.setEnd=function(y,z){try{this.nativeRange.setEnd(y,z)}catch(x){this.nativeRange.setStart(y,z);this.nativeRange.setEnd(y,z)}m(this)};n=function(x,y){return function(A){try{this.nativeRange[x](A)}catch(z){this.nativeRange[y](A);this.nativeRange[x](A)}m(this)}}}o.setStartBefore=n("setStartBefore","setEndBefore");o.setStartAfter=n("setStartAfter","setEndAfter");o.setEndBefore=n("setEndBefore","setStartBefore");o.setEndAfter=n("setEndAfter","setStartAfter");q.selectNodeContents(s);if(q.startContainer==s&&q.endContainer==s&&q.startOffset==0&&q.endOffset==s.length){o.selectNodeContents=function(x){this.nativeRange.selectNodeContents(x);m(this)}}else{o.selectNodeContents=function(x){this.setStart(x,0);this.setEnd(x,k.getEndOffset(x))}}q.selectNodeContents(s);q.setEnd(s,3);var v=document.createRange();v.selectNodeContents(s);v.setEnd(s,4);v.setStart(s,2);if(q.compareBoundaryPoints(q.START_TO_END,v)==-1&q.compareBoundaryPoints(q.END_TO_START,v)==1){o.compareBoundaryPoints=function(y,x){x=x.nativeRange||x;if(y==x.START_TO_END){y=x.END_TO_START}else{if(y==x.END_TO_START){y=x.START_TO_END}}return this.nativeRange.compareBoundaryPoints(y,x)}}else{o.compareBoundaryPoints=function(y,x){return this.nativeRange.compareBoundaryPoints(y,x.nativeRange||x)}}i.getBody(document).removeChild(s);q.detach();v.detach()})();j.createNativeRange=function(m){m=m||document;return m.createRange()}}else{if(j.features.implementsTextRange){a=function(m){this.textRange=m;this.refresh()};a.prototype=new k(document);a.prototype.refresh=function(){var o,m;var n=f(this.textRange);if(d(this.textRange)){m=o=g(this.textRange,n,true,true)}else{o=g(this.textRange,n,true,false);m=g(this.textRange,n,false,false)}this.setStart(o.node,o.offset);this.setEnd(m.node,m.offset)};k.copyComparisonConstants(a);var h=(function(){return this})();if(typeof h.Range=="undefined"){h.Range=a}j.createNativeRange=function(m){m=m||document;return m.body.createTextRange()}}}if(j.features.implementsTextRange){a.rangeToTextRange=function(m){if(m.collapsed){var p=l(new b(m.startContainer,m.startOffset),true);return p}else{var q=l(new b(m.startContainer,m.startOffset),true);var o=l(new b(m.endContainer,m.endOffset),false);var n=i.getDocument(m.startContainer).body.createTextRange();n.setEndPoint("StartToStart",q);n.setEndPoint("EndToEnd",o);return n}}}a.prototype.getName=function(){return"WrappedRange"};j.WrappedRange=a;j.createRange=function(m){m=m||document;return new a(j.createNativeRange(m))};j.createRangyRange=function(m){m=m||document;return new k(m)};j.createIframeRange=function(m){return j.createRange(i.getIframeDocument(m))};j.createIframeRangyRange=function(m){return j.createRangyRange(i.getIframeDocument(m))};j.addCreateMissingNativeApiListener(function(n){var m=n.document;if(typeof m.createRange=="undefined"){m.createRange=function(){return j.createRange(this)}}m=n=null})});rangy.createModule("WrappedSelection",function(h,e){h.requireModules(["DomUtil","DomRange","WrappedRange"]);h.config.checkSelectionRanges=true;var E="boolean",U="_rangySelection",d=h.dom,m=h.util,R=h.DomRange,f=h.WrappedRange,O=h.DOMException,z=d.DomPosition,x,o,V="Control";function n(X){return(X||window).getSelection()}function r(X){return(X||window).document.selection}var T=h.util.isHostMethod(window,"getSelection"),N=h.util.isHostObject(document,"selection");var v=N&&(!T||h.config.preferTextRange);if(v){x=r;h.isSelectionValid=function(Y){var Z=(Y||window).document,X=Z.selection;return(X.type!="None"||d.getDocument(X.createRange().parentElement())==Z)}}else{if(T){x=n;h.isSelectionValid=function(){return true}}else{e.fail("Neither document.selection or window.getSelection() detected.")}}h.getNativeSelection=x;var M=x();var C=h.createNativeRange(document);var D=d.getBody(document);var K=m.areHostObjects(M,["anchorNode","focusNode"]&&m.areHostProperties(M,["anchorOffset","focusOffset"]));h.features.selectionHasAnchorAndFocus=K;var q=m.isHostMethod(M,"extend");h.features.selectionHasExtend=q;var W=(typeof M.rangeCount=="number");h.features.selectionHasRangeCount=W;var Q=false;var P=true;if(m.areHostMethods(M,["addRange","getRangeAt","removeAllRanges"])&&typeof M.rangeCount=="number"&&h.features.implementsDomRange){(function(){var Z=document.createElement("iframe");D.appendChild(Z);var ad=d.getIframeDocument(Z);ad.open();ad.write("<html><head></head><body>12</body></html>");ad.close();var ab=d.getIframeWindow(Z).getSelection();var ae=ad.documentElement;var aa=ae.lastChild,ac=aa.firstChild;var Y=ad.createRange();Y.setStart(ac,1);Y.collapse(true);ab.addRange(Y);P=(ab.rangeCount==1);ab.removeAllRanges();var X=Y.cloneRange();Y.setStart(ac,0);X.setEnd(ac,2);ab.addRange(Y);ab.addRange(X);Q=(ab.rangeCount==2);Y.detach();X.detach();D.removeChild(Z)})()}h.features.selectionSupportsMultipleRanges=Q;h.features.collapsedNonEditableSelectionsSupported=P;var g=false,k;if(D&&m.isHostMethod(D,"createControlRange")){k=D.createControlRange();if(m.areHostProperties(k,["item","add"])){g=true}}h.features.implementsControlRange=g;if(K){o=function(X){return X.anchorNode===X.focusNode&&X.anchorOffset===X.focusOffset}}else{o=function(X){return X.rangeCount?X.getRangeAt(X.rangeCount-1).collapsed:false}}function b(aa,Y,X){var Z=X?"end":"start",ab=X?"start":"end";aa.anchorNode=Y[Z+"Container"];aa.anchorOffset=Y[Z+"Offset"];aa.focusNode=Y[ab+"Container"];aa.focusOffset=Y[ab+"Offset"]}function w(Y){var X=Y.nativeSelection;Y.anchorNode=X.anchorNode;Y.anchorOffset=X.anchorOffset;Y.focusNode=X.focusNode;Y.focusOffset=X.focusOffset}function H(X){X.anchorNode=X.focusNode=null;X.anchorOffset=X.focusOffset=0;X.rangeCount=0;X.isCollapsed=true;X._ranges.length=0}function J(X){var Y;if(X instanceof R){Y=X._selectionNativeRange;if(!Y){Y=h.createNativeRange(d.getDocument(X.startContainer));Y.setEnd(X.endContainer,X.endOffset);Y.setStart(X.startContainer,X.startOffset);X._selectionNativeRange=Y;X.attachListener("detach",function(){this._selectionNativeRange=null})}}else{if(X instanceof f){Y=X.nativeRange}else{if(h.features.implementsDomRange&&(X instanceof d.getWindow(X.startContainer).Range)){Y=X}}}return Y}function l(Z){if(!Z.length||Z[0].nodeType!=1){return false}for(var Y=1,X=Z.length;Y<X;++Y){if(!d.isAncestorOf(Z[0],Z[Y])){return false}}return true}function L(Y){var X=Y.getNodes();if(!l(X)){throw new Error("getSingleElementFromRange: range "+Y.inspect()+" did not consist of a single element")}return X[0]}function G(X){return !!X&&typeof X.text!="undefined"}function I(Z,Y){var X=new f(Y);Z._ranges=[X];b(Z,X,false);Z.rangeCount=1;Z.isCollapsed=X.collapsed}function u(aa){aa._ranges.length=0;if(aa.docSelection.type=="None"){H(aa)}else{var Z=aa.docSelection.createRange();if(G(Z)){I(aa,Z)}else{aa.rangeCount=Z.length;var X,ab=d.getDocument(Z.item(0));for(var Y=0;Y<aa.rangeCount;++Y){X=h.createRange(ab);X.selectNode(Z.item(Y));aa._ranges.push(X)}aa.isCollapsed=aa.rangeCount==1&&aa._ranges[0].collapsed;b(aa,aa._ranges[aa.rangeCount-1],false)}}}function y(Y,ab){var Z=Y.docSelection.createRange();var X=L(ab);var af=d.getDocument(Z.item(0));var ac=d.getBody(af).createControlRange();for(var aa=0,ad=Z.length;aa<ad;++aa){ac.add(Z.item(aa))}try{ac.add(X)}catch(ae){throw new Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}ac.select();u(Y)}var p;if(m.isHostMethod(M,"getRangeAt")){p=function(Z,X){try{return Z.getRangeAt(X)}catch(Y){return null}}}else{if(K){p=function(Y){var Z=d.getDocument(Y.anchorNode);var X=h.createRange(Z);X.setStart(Y.anchorNode,Y.anchorOffset);X.setEnd(Y.focusNode,Y.focusOffset);if(X.collapsed!==this.isCollapsed){X.setStart(Y.focusNode,Y.focusOffset);X.setEnd(Y.anchorNode,Y.anchorOffset)}return X}}}function B(X,Z,Y){this.nativeSelection=X;this.docSelection=Z;this._ranges=[];this.win=Y;this.refresh()}h.getSelection=function(Z){Z=Z||window;var Y=Z[U];var X=x(Z),aa=N?r(Z):null;if(Y){Y.nativeSelection=X;Y.docSelection=aa;Y.refresh(Z)}else{Y=new B(X,aa,Z);Z[U]=Y}return Y};h.getIframeSelection=function(X){return h.getSelection(d.getIframeWindow(X))};var a=B.prototype;function j(ac,X){var ad=d.getDocument(X[0].startContainer);var aa=d.getBody(ad).createControlRange();for(var Z=0,ab;Z<rangeCount;++Z){ab=L(X[Z]);try{aa.add(ab)}catch(Y){throw new Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)")}}aa.select();u(ac)}if(!v&&K&&m.areHostMethods(M,["removeAllRanges","addRange"])){a.removeAllRanges=function(){this.nativeSelection.removeAllRanges();H(this)};var i=function(Z,X){var aa=R.getRangeDocument(X);var Y=h.createRange(aa);Y.collapseToPoint(X.endContainer,X.endOffset);Z.nativeSelection.addRange(J(Y));Z.nativeSelection.extend(X.startContainer,X.startOffset);Z.refresh()};if(W){a.addRange=function(Y,X){if(g&&N&&this.docSelection.type==V){y(this,Y)}else{if(X&&q){i(this,Y)}else{var Z;if(Q){Z=this.rangeCount}else{this.removeAllRanges();Z=0}this.nativeSelection.addRange(J(Y));this.rangeCount=this.nativeSelection.rangeCount;if(this.rangeCount==Z+1){if(h.config.checkSelectionRanges){var aa=p(this.nativeSelection,this.rangeCount-1);if(aa&&!R.rangesEqual(aa,Y)){Y=new f(aa)}}this._ranges[this.rangeCount-1]=Y;b(this,Y,s(this.nativeSelection));this.isCollapsed=o(this)}else{this.refresh()}}}}}else{a.addRange=function(Y,X){if(X&&q){i(this,Y)}else{this.nativeSelection.addRange(J(Y));this.refresh()}}}a.setRanges=function(Y){if(g&&Y.length>1){j(this,Y)}else{this.removeAllRanges();for(var Z=0,X=Y.length;Z<X;++Z){this.addRange(Y[Z])}}}}else{if(m.isHostMethod(M,"empty")&&m.isHostMethod(C,"select")&&g&&v){a.removeAllRanges=function(){try{this.docSelection.empty();if(this.docSelection.type!="None"){var aa;if(this.anchorNode){aa=d.getDocument(this.anchorNode)}else{if(this.docSelection.type==V){var Y=this.docSelection.createRange();if(Y.length){aa=d.getDocument(Y.item(0)).body.createTextRange()}}}if(aa){var Z=aa.body.createTextRange();Z.select();this.docSelection.empty()}}}catch(X){}H(this)};a.addRange=function(X){if(this.docSelection.type==V){y(this,X)}else{f.rangeToTextRange(X).select();this._ranges[0]=X;this.rangeCount=1;this.isCollapsed=this._ranges[0].collapsed;b(this,X,false)}};a.setRanges=function(X){this.removeAllRanges();var Y=X.length;if(Y>1){j(this,X)}else{if(Y){this.addRange(X[0])}}}}else{e.fail("No means of selecting a Range or TextRange was found");return false}}a.getRangeAt=function(X){if(X<0||X>=this.rangeCount){throw new O("INDEX_SIZE_ERR")}else{return this._ranges[X]}};var F;if(v){F=function(Y){var X;if(h.isSelectionValid(Y.win)){X=Y.docSelection.createRange()}else{X=d.getBody(Y.win.document).createTextRange();X.collapse(true)}if(Y.docSelection.type==V){u(Y)}else{if(G(X)){I(Y,X)}else{H(Y)}}}}else{if(m.isHostMethod(M,"getRangeAt")&&typeof M.rangeCount=="number"){F=function(Z){if(g&&N&&Z.docSelection.type==V){u(Z)}else{Z._ranges.length=Z.rangeCount=Z.nativeSelection.rangeCount;if(Z.rangeCount){for(var Y=0,X=Z.rangeCount;Y<X;++Y){Z._ranges[Y]=new h.WrappedRange(Z.nativeSelection.getRangeAt(Y))}b(Z,Z._ranges[Z.rangeCount-1],s(Z.nativeSelection));Z.isCollapsed=o(Z)}else{H(Z)}}}}else{if(K&&typeof M.isCollapsed==E&&typeof C.collapsed==E&&h.features.implementsDomRange){F=function(Z){var X,Y=Z.nativeSelection;if(Y.anchorNode){X=p(Y,0);Z._ranges=[X];Z.rangeCount=1;w(Z);Z.isCollapsed=o(Z)}else{H(Z)}}}else{e.fail("No means of obtaining a Range or TextRange from the user's selection was found");return false}}}a.refresh=function(Y){var X=Y?this._ranges.slice(0):null;F(this);if(Y){var Z=X.length;if(Z!=this._ranges.length){return false}while(Z--){if(!R.rangesEqual(X[Z],this._ranges[Z])){return false}}return true}};var A=function(ab,Z){var Y=ab.getAllRanges(),ac=false;ab.removeAllRanges();for(var aa=0,X=Y.length;aa<X;++aa){if(ac||Z!==Y[aa]){ab.addRange(Y[aa])}else{ac=true}}if(!ab.rangeCount){H(ab)}};if(g){a.removeRange=function(ab){if(this.docSelection.type==V){var Z=this.docSelection.createRange();var X=L(ab);var af=d.getDocument(Z.item(0));var ad=d.getBody(af).createControlRange();var Y,ae=false;for(var aa=0,ac=Z.length;aa<ac;++aa){Y=Z.item(aa);if(Y!==X||ae){ad.add(Z.item(aa))}else{ae=true}}ad.select();u(this)}else{A(this,ab)}}}else{a.removeRange=function(X){A(this,X)}}var s;if(!v&&K&&h.features.implementsDomRange){s=function(Y){var X=false;if(Y.anchorNode){X=(d.comparePoints(Y.anchorNode,Y.anchorOffset,Y.focusNode,Y.focusOffset)==1)}return X};a.isBackwards=function(){return s(this)}}else{s=a.isBackwards=function(){return false}}a.toString=function(){var Z=[];for(var Y=0,X=this.rangeCount;Y<X;++Y){Z[Y]=""+this._ranges[Y]}return Z.join("")};function S(Y,X){if(Y.anchorNode&&(d.getDocument(Y.anchorNode)!==d.getDocument(X))){throw new O("WRONG_DOCUMENT_ERR")}}a.collapse=function(Y,Z){S(this,Y);var X=h.createRange(d.getDocument(Y));X.collapseToPoint(Y,Z);this.removeAllRanges();this.addRange(X);this.isCollapsed=true};a.collapseToStart=function(){if(this.rangeCount){var X=this._ranges[0];this.collapse(X.startContainer,X.startOffset)}else{throw new O("INVALID_STATE_ERR")}};a.collapseToEnd=function(){if(this.rangeCount){var X=this._ranges[this.rangeCount-1];this.collapse(X.endContainer,X.endOffset)}else{throw new O("INVALID_STATE_ERR")}};a.selectAllChildren=function(Y){S(this,Y);var X=h.createRange(d.getDocument(Y));X.selectNodeContents(Y);this.removeAllRanges();this.addRange(X)};a.deleteFromDocument=function(){if(g&&N&&this.docSelection.type==V){var ab=this.docSelection.createRange();var aa;while(ab.length){aa=ab.item(0);ab.remove(aa);aa.parentNode.removeChild(aa)}this.refresh()}else{if(this.rangeCount){var Y=this.getAllRanges();this.removeAllRanges();for(var Z=0,X=Y.length;Z<X;++Z){Y[Z].deleteContents()}this.addRange(Y[X-1])}}};a.getAllRanges=function(){return this._ranges.slice(0)};a.setSingleRange=function(X){this.setRanges([X])};a.containsNode=function(aa,Y){for(var Z=0,X=this._ranges.length;Z<X;++Z){if(this._ranges[Z].containsNode(aa,Y)){return true}}return false};a.toHtml=function(){var aa="";if(this.rangeCount){var Y=R.getRangeDocument(this._ranges[0]).createElement("div");for(var Z=0,X=this._ranges.length;Z<X;++Z){Y.appendChild(this._ranges[Z].cloneContents())}aa=Y.innerHTML}return aa};function t(ad){var ac=[];var aa=new z(ad.anchorNode,ad.anchorOffset);var Y=new z(ad.focusNode,ad.focusOffset);var Z=(typeof ad.getName=="function")?ad.getName():"Selection";if(typeof ad.rangeCount!="undefined"){for(var ab=0,X=ad.rangeCount;ab<X;++ab){ac[ab]=R.inspect(ad.getRangeAt(ab))}}return"["+Z+"(Ranges: "+ac.join(", ")+")(anchor: "+aa.inspect()+", focus: "+Y.inspect()+"]"}a.getName=function(){return"WrappedSelection"};a.inspect=function(){return t(this)};a.detach=function(){this.win[U]=null;this.win=this.anchorNode=this.focusNode=null};B.inspect=t;h.Selection=B;h.selectionPrototype=a;h.addCreateMissingNativeApiListener(function(X){if(typeof X.getSelection=="undefined"){X.getSelection=function(){return h.getSelection(this)}}X=null})});rangy.createModule("CssClassApplier",function(h,f){h.requireModules(["WrappedSelection","WrappedRange"]);var b=h.dom;var A="span";function a(L){return L.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function E(M,L){return M.className&&new RegExp("(?:^|\\s)"+L+"(?:\\s|$)").test(M.className)}function s(M,L){if(M.className){if(!E(M,L)){M.className+=" "+L}}else{M.className=L}}var n=(function(){function L(M,O,N){return(O&&N)?" ":""}return function(N,M){if(N.className){N.className=N.className.replace(new RegExp("(?:^|\\s)"+M+"(?:\\s|$)"),L)}}})();function w(L){return L.split(/\s+/).sort().join(" ")}function t(L){return w(L.className)}function m(M,L){return t(M)==t(L)}function v(M){var L=M.parentNode;while(M.hasChildNodes()){L.insertBefore(M.firstChild,M)}L.removeChild(M)}function x(L,P){var M=L.cloneRange();M.selectNodeContents(P);var N=M.intersection(L);var O=N?N.toString():"";M.detach();return O!=""}function C(L){return L.getNodes([3],function(M){return x(L,M)})}function H(R,P){if(R.attributes.length!=P.attributes.length){return false}for(var Q=0,L=R.attributes.length,O,M,N;Q<L;++Q){O=R.attributes[Q];N=O.name;if(N!="class"){M=P.attributes.getNamedItem(N);if(O.specified!=M.specified){return false}if(O.specified&&O.nodeValue!==M.nodeValue){return false}}}return true}function I(P,O){for(var N=0,L=P.attributes.length,M;N<L;++N){M=P.attributes[N].name;if(!(O&&b.arrayContains(O,M))&&P.attributes[N].specified&&M!="class"){return true}}return false}function K(M,L){for(var N in L){if(L.hasOwnProperty(N)&&M[N]!==L[N]){return false}}return true}var o;if(typeof window.getComputedStyle!="undefined"){o=function(L,M){return b.getWindow(L).getComputedStyle(L,null)[M]}}else{if(typeof document.documentElement.currentStyle!="undefined"){o=function(L,M){return L.currentStyle[M]}}else{f.fail("No means of obtaining computed style properties found")}}var q;(function(){var L=document.createElement("div");if(typeof L.isContentEditable=="boolean"){q=function(M){return M&&M.nodeType==1&&M.isContentEditable}}else{q=function(M){if(!M||M.nodeType!=1||M.contentEditable=="false"){return false}return M.contentEditable=="true"||q(M.parentNode)}}})();function e(M){var L;return M&&M.nodeType==1&&(((L=M.parentNode)&&L.nodeType==9&&L.designMode=="on")||(q(M)&&!q(M.parentNode)))}function d(L){return(q(L)||(L.nodeType!=1&&q(L.parentNode)))&&!e(L)}var G=/^inline(-block|-table)?$/i;function g(L){return L&&L.nodeType==1&&!G.test(o(L,"display"))}var j=/[^\r\n\t\f \u200B]/;function D(L){if(L.data.length==0){return true}if(j.test(L.data)){return false}var M=o(L.parentNode,"whiteSpace");switch(M){case"pre":case"pre-wrap":case"-moz-pre-wrap":return false;case"pre-line":if(/[\r\n]/.test(L.data)){return false}}return g(L.previousSibling)||g(L.nextSibling)}function B(L,M){if(b.isCharacterDataNode(L)){if(M==0){return !!L.previousSibling}else{if(M==L.length){return !!L.nextSibling}else{return true}}}return M>0&&M<L.childNodes.length}function F(Q,N,P,R){var M;var L=(P==0);if(b.isAncestorOf(N,Q)){throw f.createError("descendant is ancestor of node")}if(b.isCharacterDataNode(N)){if(P==0){P=b.getNodeIndex(N);N=N.parentNode}else{if(P==N.length){P=b.getNodeIndex(N)+1;N=N.parentNode}else{throw f.createError("splitNodeAt should not be called with offset in the middle of a data node ("+P+" in "+N.data)}}}if(B(N,P)){if(!M){M=N.cloneNode(false);if(M.id){M.removeAttribute("id")}var S;while((S=N.childNodes[P])){M.appendChild(S)}b.insertAfter(M,N)}return(N==Q)?M:F(Q,M.parentNode,b.getNodeIndex(M),R)}else{if(Q!=N){M=N.parentNode;var O=b.getNodeIndex(N);if(!L){O++}return F(Q,M,O,R)}}return Q}function J(M,L){return M.tagName==L.tagName&&m(M,L)&&H(M,L)}function p(L){var M=L?"nextSibling":"previousSibling";return function(Q,N){var O=Q.parentNode;var P=Q[M];if(P){if(P&&P.nodeType==3){return P}}else{if(N){P=O[M];if(P&&P.nodeType==1&&J(O,P)){return P[L?"firstChild":"lastChild"]}}}return null}}var r=p(false),l=p(true);function u(L){this.isElementMerge=(L.nodeType==1);this.firstTextNode=this.isElementMerge?L.lastChild:L;this.textNodes=[this.firstTextNode]}u.prototype={doMerge:function(){var Q=[],P,N,O;for(var M=0,L=this.textNodes.length;M<L;++M){P=this.textNodes[M];N=P.parentNode;Q[M]=P.data;if(M){N.removeChild(P);if(!N.hasChildNodes()){N.parentNode.removeChild(N)}}}this.firstTextNode.data=O=Q.join("");return O},getLength:function(){var M=this.textNodes.length,L=0;while(M--){L+=this.textNodes[M].length}return L},toString:function(){var N=[];for(var M=0,L=this.textNodes.length;M<L;++M){N[M]="'"+this.textNodes[M].data+"'"}return"[Merge("+N.join(",")+")]"}};var y=["elementTagName","ignoreWhiteSpace","applyToEditableOnly"];var z={"class":"className"};function i(V,U,T){this.cssClass=V;var P,O,R,Q;var N=null;if(typeof U=="object"&&U!==null){T=U.tagNames;N=U.elementProperties;for(O=0;Q=y[O++];){if(U.hasOwnProperty(Q)){this[Q]=U[Q]}}P=U.normalize}else{P=U}this.normalize=(typeof P=="undefined")?true:P;this.attrExceptions=[];var M=document.createElement(this.elementTagName);this.elementProperties={};for(var L in N){if(N.hasOwnProperty(L)){if(z.hasOwnProperty(L)){L=z[L]}M[L]=N[L];this.elementProperties[L]=M[L];this.attrExceptions.push(L)}}this.elementSortedClassName=this.elementProperties.hasOwnProperty("className")?w(this.elementProperties.className+" "+V):V;this.applyToAnyTagName=false;var S=typeof T;if(S=="string"){if(T=="*"){this.applyToAnyTagName=true}else{this.tagNames=a(T.toLowerCase()).split(/\s*,\s*/)}}else{if(S=="object"&&typeof T.length=="number"){this.tagNames=[];for(O=0,R=T.length;O<R;++O){if(T[O]=="*"){this.applyToAnyTagName=true}else{this.tagNames.push(T[O].toLowerCase())}}}else{this.tagNames=[this.elementTagName]}}}i.prototype={elementTagName:A,elementProperties:{},ignoreWhiteSpace:true,applyToEditableOnly:false,hasClass:function(L){return L.nodeType==1&&b.arrayContains(this.tagNames,L.tagName.toLowerCase())&&E(L,this.cssClass)},getSelfOrAncestorWithClass:function(L){while(L){if(this.hasClass(L,this.cssClass)){return L}L=L.parentNode}return null},isModifiable:function(L){return !this.applyToEditableOnly||d(L)},isIgnorableWhiteSpaceNode:function(L){return this.ignoreWhiteSpace&&L&&L.nodeType==3&&D(L)},postApply:function(Y,U,Q){var L=Y[0],M=Y[Y.length-1];var O=[],Z;var R=L,N=M;var W=0,aa=M.length;var P,T;for(var S=0,V=Y.length;S<V;++S){P=Y[S];T=r(P,!Q);if(T){if(!Z){Z=new u(T);O.push(Z)}Z.textNodes.push(P);if(P===L){R=Z.firstTextNode;W=R.length}if(P===M){N=Z.firstTextNode;aa=Z.getLength()}}else{Z=null}}var X=l(M,!Q);if(X){if(!Z){Z=new u(M);O.push(Z)}Z.textNodes.push(X)}if(O.length){for(S=0,V=O.length;S<V;++S){O[S].doMerge()}U.setStart(R,W);U.setEnd(N,aa)}},createContainer:function(M){var L=M.createElement(this.elementTagName);h.util.extend(L,this.elementProperties);s(L,this.cssClass);return L},applyToTextNode:function(N){var M=N.parentNode;if(M.childNodes.length==1&&b.arrayContains(this.tagNames,M.tagName.toLowerCase())){s(M,this.cssClass)}else{var L=this.createContainer(b.getDocument(N));N.parentNode.insertBefore(L,N);L.appendChild(N)}},isRemovable:function(L){return L.tagName.toLowerCase()==this.elementTagName&&t(L)==this.elementSortedClassName&&K(L,this.elementProperties)&&!I(L,this.attrExceptions)&&this.isModifiable(L)},undoToTextNode:function(O,M,N){if(!M.containsNode(N)){var L=M.cloneRange();L.selectNode(N);if(L.isPointInRange(M.endContainer,M.endOffset)){F(N,M.endContainer,M.endOffset,[M]);M.setEndAfter(N)}if(L.isPointInRange(M.startContainer,M.startOffset)){N=F(N,M.startContainer,M.startOffset,[M])}}if(this.isRemovable(N)){v(N)}else{n(N,this.cssClass)}},applyToRange:function(M){M.splitBoundaries();var O=C(M);if(O.length){var P;for(var N=0,L=O.length;N<L;++N){P=O[N];if(!this.isIgnorableWhiteSpaceNode(P)&&!this.getSelfOrAncestorWithClass(P)&&this.isModifiable(P)){this.applyToTextNode(P)}}M.setStart(O[0],0);P=O[O.length-1];M.setEnd(P,P.length);if(this.normalize){this.postApply(O,M,false)}}},applyToSelection:function(P){P=P||window;var O=h.getSelection(P);var M,L=O.getAllRanges();O.removeAllRanges();var N=L.length;while(N--){M=L[N];this.applyToRange(M);O.addRange(M)}},undoToRange:function(N){N.splitBoundaries();var P=C(N);var R,Q;var M=P[P.length-1];if(P.length){for(var O=0,L=P.length;O<L;++O){R=P[O];Q=this.getSelfOrAncestorWithClass(R);if(Q&&this.isModifiable(R)){this.undoToTextNode(R,N,Q)}N.setStart(P[0],0);N.setEnd(M,M.length)}if(this.normalize){this.postApply(P,N,true)}}},undoToSelection:function(Q){Q=Q||window;var P=h.getSelection(Q);var M=P.getAllRanges(),N;P.removeAllRanges();for(var O=0,L=M.length;O<L;++O){N=M[O];this.undoToRange(N);P.addRange(N)}},getTextSelectedByRange:function(P,L){var M=L.cloneRange();M.selectNodeContents(P);var N=M.intersection(L);var O=N?N.toString():"";M.detach();return O},isAppliedToRange:function(L){if(L.collapsed){return !!this.getSelfOrAncestorWithClass(L.commonAncestorContainer)}else{var N=L.getNodes([3]);for(var M=0,O;O=N[M++];){if(!this.isIgnorableWhiteSpaceNode(O)&&x(L,O)&&this.isModifiable(O)&&!this.getSelfOrAncestorWithClass(O)){return false}}return true}},isAppliedToSelection:function(O){O=O||window;var N=h.getSelection(O);var L=N.getAllRanges();var M=L.length;while(M--){if(!this.isAppliedToRange(L[M])){return false}}return true},toggleRange:function(L){if(this.isAppliedToRange(L)){this.undoToRange(L)}else{this.applyToRange(L)}},toggleSelection:function(L){if(this.isAppliedToSelection(L)){this.undoToSelection(L)}else{this.applyToSelection(L)}},detach:function(){}};function k(M,N,L){return new i(M,N,L)}i.util={hasClass:E,addClass:s,removeClass:n,hasSameClasses:m,replaceWithOwnChildren:v,elementsHaveSameNonClassAttributes:H,elementHasNonClassAttributes:I,splitNodeAt:F,isEditableElement:q,isEditingHost:e,isEditable:d};h.CssClassApplier=i;h.createCssClassApplier=k});rangy.createModule("SaveRestore",function(i,f){i.requireModules(["DomUtil","DomRange","WrappedRange"]);var h=i.dom;var b="\ufeff";function m(o,n){return(n||document).getElementById(o)}function d(p,n){var q="selectionBoundary_"+(+new Date())+"_"+(""+Math.random()).slice(2);var o;var s=h.getDocument(p.startContainer);var r=p.cloneRange();r.collapse(n);o=s.createElement("span");o.id=q;o.style.lineHeight="0";o.style.display="none";o.className="rangySelectionBoundary";o.appendChild(s.createTextNode(b));r.insertNode(o);r.detach();return o}function l(r,p,q,n){var o=m(q,r);if(o){p[n?"setStartBefore":"setEndBefore"](o);o.parentNode.removeChild(o)}else{f.warn("Marker element has been removed. Cannot restore selection.")}}function e(o,n){return n.compareBoundaryPoints(o.START_TO_START,o)}function g(u){u=u||window;var w=u.document;if(!i.isSelectionValid(u)){f.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus.");return}var o=i.getSelection(u);var n=o.getAllRanges();var s=[],q,v,r;n.sort(e);for(var p=0,t=n.length;p<t;++p){r=n[p];if(r.collapsed){v=d(r,false);s.push({markerId:v.id,collapsed:true})}else{v=d(r,false);q=d(r,true);s[p]={startMarkerId:q.id,endMarkerId:v.id,collapsed:false,backwards:n.length==1&&o.isBackwards()}}}for(p=t-1;p>=0;--p){r=n[p];if(r.collapsed){r.collapseBefore(m(s[p].markerId,w))}else{r.setEndBefore(m(s[p].endMarkerId,w));r.setStartAfter(m(s[p].startMarkerId,w))}}o.setRanges(n);return{win:u,doc:w,rangeInfos:s,restored:false}}function a(x,p){if(!x.restored){var s=x.rangeInfos;var o=i.getSelection(x.win);var n=[];for(var u=s.length,q=u-1,w,r;q>=0;--q){w=s[q];r=i.createRange(x.doc);if(w.collapsed){var t=m(w.markerId,x.doc);if(t){t.style.display="inline";var v=t.previousSibling;if(v&&v.nodeType==3){t.parentNode.removeChild(t);r.collapseToPoint(v,v.length)}else{r.collapseBefore(t);t.parentNode.removeChild(t)}}else{f.warn("Marker element has been removed. Cannot restore selection.")}}else{l(x.doc,r,w.startMarkerId,true);l(x.doc,r,w.endMarkerId,false)}if(u==1){r.normalizeBoundaries()}n[q]=r}if(u==1&&p&&i.features.selectionHasExtend&&s[0].backwards){o.removeAllRanges();o.addRange(n[0],true)}else{o.setRanges(n)}x.restored=true}}function j(p,o){var n=m(o,p);if(n){n.parentNode.removeChild(n)}}function k(o){var r=o.rangeInfos;for(var q=0,n=r.length,p;q<n;++q){p=r[q];if(p.collapsed){j(o.doc,p.markerId)}else{j(o.doc,p.startMarkerId);j(o.doc,p.endMarkerId)}}}i.saveSelection=g;i.restoreSelection=a;i.removeMarkerElement=j;i.removeMarkers=k});rangy.createModule("Serializer",function(q,a){q.requireModules(["WrappedSelection","WrappedRange"]);var r="undefined";if(typeof encodeURIComponent==r||typeof decodeURIComponent==r){a.fail("Global object is missing encodeURIComponent and/or decodeURIComponent method")}var f=(function(){function y(C){var B=[];for(var A=0,z=C.length,D;A<z;++A){D=C.charCodeAt(A);if(D<128){B.push(D)}else{if(D<2048){B.push((D>>6)|192,(D&63)|128)}else{B.push((D>>12)|224,((D>>6)&63)|128,(D&63)|128)}}}return B}var w=null;function v(){var B=[];for(var A=0,z,C;A<256;++A){C=A;z=8;while(z--){if((C&1)==1){C=(C>>>1)^3988292384}else{C>>>=1}}B[A]=C>>>0}return B}function x(){if(!w){w=v()}return w}return function(E){var D=y(E),C=-1,A=x();for(var B=0,z=D.length,F;B<z;++B){F=(C^D[B])&255;C=(C>>>8)^A[F]}return(C^-1)>>>0}})();var s=q.dom;function e(v){return v.replace(/</g,"&lt;").replace(/>/g,"&gt;")}function p(y,x){x=x||[];var B=y.nodeType,w=y.childNodes,A=w.length;var D=[B,y.nodeName,A].join(":");var v="",z="";switch(B){case 3:v=e(y.nodeValue);break;case 8:v="<!--"+e(y.nodeValue)+"-->";break;default:v="<"+D+">";z="</>";break}if(v){x.push(v)}for(var C=0;C<A;++C){p(w[C],x)}if(z){x.push(z)}return x}function b(v){var w=p(v).join("");return f(w).toString(16)}function g(w,y,v){var x=[],z=w;v=v||s.getDocument(w).documentElement;while(z&&z!=v){x.push(s.getNodeIndex(z,true));z=z.parentNode}return x.join("/")+":"+y}function d(B,v,A){if(v){A=A||s.getDocument(v)}else{A=A||document;v=A.documentElement}var z=B.split(":");var y=v;var x=z[0]?z[0].split("/"):[],w=x.length,C;while(w--){C=parseInt(x[w],10);if(C<y.childNodes.length){y=y.childNodes[parseInt(x[w],10)]}else{throw a.createError("deserializePosition failed: node "+s.inspectNode(y)+" has no child with index "+C+", "+w)}}return new s.DomPosition(y,parseInt(z[1],10))}function i(w,y,v){v=v||q.DomRange.getRangeDocument(w).documentElement;if(!s.isAncestorOf(v,w.commonAncestorContainer,true)){throw new Error("serializeRange: range is not wholly contained within specified root node")}var x=g(w.startContainer,w.startOffset,v)+","+g(w.endContainer,w.endOffset,v);if(!y){x+="{"+b(v)+"}"}return x}function h(z,x,C){if(x){C=C||s.getDocument(x)}else{C=C||document;x=C.documentElement}var D=/^([^,]+),([^,\{]+)({([^}]+)})?$/.exec(z);var B=D[4],v=b(x);if(B&&B!==b(x)){throw new Error("deserializeRange: checksums of serialized range root node ("+B+") and target root node ("+v+") do not match")}var w=d(D[1],x,C),y=d(D[2],x,C);var A=q.createRange(C);A.setStart(w.node,w.offset);A.setEnd(y.node,y.offset);return A}function l(z,w,y){if(w){y=y||s.getDocument(w)}else{y=y||document;w=y.documentElement}var v=/^([^,]+),([^,]+)({([^}]+)})?$/.exec(z);var x=v[3];return !x||x===b(w)}function j(A,B,y){A=A||q.getSelection();var w=A.getAllRanges(),x=[];for(var z=0,v=w.length;z<v;++z){x[z]=i(w[z],B,y)}return x.join("|")}function u(C,y,B){if(y){B=B||s.getWindow(y)}else{B=B||window;y=B.document.documentElement}var x=C.split("|");var A=q.getSelection(B);var w=[];for(var z=0,v=x.length;z<v;++z){w[z]=h(x[z],y,B.document)}A.setRanges(w);return A}function k(B,x,A){var z;if(x){z=A?A.document:s.getDocument(x)}else{A=A||window;x=A.document.documentElement}var w=B.split("|");for(var y=0,v=w.length;y<v;++y){if(!l(w[y],x,z)){return false}}return true}var t="rangySerializedSelection";function o(x){var y=x.split(/[;,]/);for(var w=0,v=y.length,A,z;w<v;++w){A=y[w].split("=");if(A[0].replace(/^\s+/,"")==t){z=A[1];if(z){return decodeURIComponent(z.replace(/\s+$/,""))}}}return null}function m(w){w=w||window;var v=o(w.document.cookie);if(v){u(v,w.doc)}}function n(B,w){B=B||window;w=(typeof w=="object")?w:{};var v=w.expires?";expires="+w.expires.toUTCString():"";var A=w.path?";path="+w.path:"";var x=w.domain?";domain="+w.domain:"";var z=w.secure?";secure":"";var y=j(q.getSelection(B));B.document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(y)+v+A+x+z}q.serializePosition=g;q.deserializePosition=d;q.serializeRange=i;q.deserializeRange=h;q.canDeserializeRange=l;q.serializeSelection=j;q.deserializeSelection=u;q.canDeserializeSelection=k;q.restoreSelectionFromCookie=m;q.saveSelectionCookie=n;q.getElementChecksum=b});(function(){var a=this,d,b;d={changeIdAttribute:"data-cid",userIdAttribute:"data-userid",userNameAttribute:"data-username",timeAttribute:"data-time",attrValuePrefix:"",blockEl:"p",stylePrefix:"cts",currentUser:{id:null,name:null},changeTypes:{insertType:{tag:"insert",alias:"ins",action:"Inserted"},deleteType:{tag:"delete",alias:"del",action:"Deleted"}},handleEvents:false,contentEditable:true,isTracking:true,noTrack:".ice-no-track",avoid:".ice-avoid"};b=function(e){e||(e={});if(!e.element){throw Error("`options.element` must be defined for ice construction.")}ice.dom.extend(true,this,d,e);this.pluginsManager=new ice.IcePluginManager(this);if(e.plugins){this.pluginsManager.usePlugins("ice-init",e.plugins)}};b.prototype={_changes:{},_userStyles:{},_styles:{},_uniqueStyleIndex:0,_browserType:null,_batchChangeid:null,_uniqueIDIndex:1,_delBookmark:"tempdel",isPlaceHoldingDeletes:false,startTracking:function(){this.element.setAttribute("contentEditable",this.contentEditable);if(this.handleEvents){var e=this;ice.dom.bind(e.element,"keyup keydown keypress mousedown mouseup",function(f){return e.handleEvent(f)})}this.initializeEnvironment();this.initializeEditor();this.initializeRange();this.pluginsManager.fireEnabled(this.element);return this},initializeEnvironment:function(){this.env||(this.env={});this.env.element=this.element;this.env.document=this.element.ownerDocument;this.env.window=this.env.document.defaultView||this.env.document.parentWindow||window;this.env.frame=this.env.window.frameElement;this.env.selection=this.selection=new ice.Selection(this.env)},initializeRange:function(){var e=this.selection.createRange();e.setStart(ice.dom.find(this.element,this.blockEl)[0],0);e.collapse(true);this.selection.addRange(e);if(this.env.frame){this.env.frame.contentWindow.focus()}else{this.element.focus()}},initializeEditor:function(){var g=this,f=this.env.document.createElement("div");if(this.element.childNodes.length){ice.dom.each(ice.dom.contents(this.element),function(j,k){if(ice.dom.isBlockElement(k)){f.appendChild(k)}});if(f.innerHTML===""){f.appendChild(ice.dom.create("<"+this.blockEl+" ><br/></"+this.blockEl+">"))}}else{f.appendChild(ice.dom.create("<"+this.blockEl+" ><br/></"+this.blockEl+">"))}this.element.innerHTML=f.innerHTML;var h=new Array();for(var e in this.changeTypes){h.push(this._getIceNodeClass(e))}ice.dom.each(ice.dom.find(this.element,"."+h.join(", .")),function(l,k){var n=0;var p="";var j=k.className.split(" ");for(var l=0;l<j.length;l++){var o=new RegExp(g.stylePrefix+"-(\\d+)").exec(j[l]);if(o){n=o[1]}var q=new RegExp("("+h.join("|")+")").exec(j[l]);if(q){p=g._getChangeTypeFromAlias(q[1])}}var m=ice.dom.attr(k,g.userIdAttribute);g.setUserStyle(m,Number(n));var r=ice.dom.attr(k,g.changeIdAttribute);g._changes[r]={type:p,userid:m,username:ice.dom.attr(k,g.userNameAttribute),time:ice.dom.attr(k,g.timeAttribute)}})},enableChangeTracking:function(){this.isTracking=true;this.pluginsManager.fireEnabled(this.element)},disableChangeTracking:function(){this.isTracking=false;this.pluginsManager.fireDisabled(this.element)},setCurrentUser:function(e){this.currentUser=e},handleEvent:function(h){if(!this.isTracking){return}if(h.type=="mouseup"){var f=this;setTimeout(function(){f.mouseUp(h)},200)}else{if(h.type=="mousedown"){return this.mouseDown(h)}else{if(h.type=="keypress"){var g=this.keyPress(h);if(!g){h.preventDefault()}return g}else{if(h.type=="keydown"){var g=this.keyDown(h);if(!g){h.preventDefault()}return g}else{if(h.type=="keyup"){this.pluginsManager.fireCaretUpdated()}}}}}},createIceNode:function(e,f){var g=this.env.document.createElement(this.changeTypes[e].tag);ice.dom.addClass(g,this._getIceNodeClass(e));g.appendChild(f?f:this.env.document.createTextNode(""));this.addChange(this.changeTypes[e].alias,[g]);this.pluginsManager.fireNodeCreated(g,{action:this.changeTypes[e].action});return g},insert:function(f,e){if(e){this.selection.addRange(e)}else{e=this.getCurrentRange()}if(typeof f==="string"){f=document.createTextNode(f)}if(!e.collapsed){this.deleteContents();e=this.getCurrentRange();if(e.startContainer===e.endContainer&&this.element===e.startContainer){ice.dom.empty(this.element);var h=e.getLastSelectableChild(this.element);e.setStartAfter(h);e.collapse(true)}}this._moveRangeToValidTrackingPos(e);var g=this.startBatchChange();this._insertNode(f||document.createTextNode("\uFEFF"),e,!f);this.pluginsManager.fireNodeInserted(f,e);this.endBatchChange(g);return true},placeholdDeletes:function(){var e=this;if(this.isPlaceholdingDeletes){this.revertDeletePlaceholders()}this.isPlaceholdingDeletes=true;this._deletes=[];var f="."+this._getIceNodeClass("deleteType");ice.dom.each(ice.dom.find(this.element,f),function(g,h){e._deletes.push(ice.dom.cloneNode(h));ice.dom.replaceWith(h,"<"+e._delBookmark+' data-allocation="'+(e._deletes.length-1)+'"/>')});return true},revertDeletePlaceholders:function(){var e=this;if(!this.isPlaceholdingDeletes){return false}ice.dom.each(this._deletes,function(f,g){ice.dom.find(e.element,e._delBookmark+"[data-allocation="+f+"]").replaceWith(g)});this.isPlaceholdingDeletes=false;return true},deleteContents:function(g,f){var e=true;if(f){this.selection.addRange(f)}else{f=this.getCurrentRange()}var h=this.startBatchChange(this.changeTypes.deleteType.alias);if(f.collapsed===false){this._deleteFromSelection(f)}else{if(g){e=this._deleteFromRight(f)}else{e=this._deleteFromLeft(f)}}this.selection.addRange(f);this.endBatchChange(h);return e},getChanges:function(){return this._changes},getElementContent:function(){return this.element.innerHTML},getCleanContent:function(e,j){var i="";var f=this;ice.dom.each(this.changeTypes,function(l,k){if(l!="deleteType"){if(k>0){i+=","}i+="."+f._getIceNodeClass(l)}});if(e){if(typeof e==="string"){e=ice.dom.create("<div>"+e+"</div>")}else{e=ice.dom.cloneNode(e,false)[0]}}else{e=ice.dom.cloneNode(this.element,false)[0]}var g=ice.dom.find(e,i);ice.dom.each(g,function(l,k){ice.dom.replaceWith(this,ice.dom.contents(this))});var h=ice.dom.find(e,"."+this._getIceNodeClass("deleteType"));ice.dom.remove(h);e=j?j.call(this,e):e;return e.innerHTML},acceptAll:function(){this.element.innerHTML=this.getCleanContent()},rejectAll:function(){var f="."+this._getIceNodeClass("insertType");var e="."+this._getIceNodeClass("deleteType");ice.dom.remove(ice.dom.find(this.element,f));ice.dom.each(ice.dom.find(this.element,e),function(g,h){ice.dom.replaceWith(h,ice.dom.contents(h))})},acceptChange:function(e){this.acceptRejectChange(e,true)},rejectChange:function(e){this.acceptRejectChange(e,false)},acceptRejectChange:function(g,m){var o,l,h,n,f,e,k,i=ice.dom;if(!g){var j=this.getCurrentRange();if(!j.collapsed){return}else{g=j.startContainer}}o=n="."+this._getIceNodeClass("deleteType");l=f="."+this._getIceNodeClass("insertType");h=o+","+l;e=i.getNode(g,h);k=i.find(this.element,"["+this.changeIdAttribute+"="+i.attr(e,this.changeIdAttribute)+"]");if(!m){n=l;f=o}if(ice.dom.is(e,f)){i.each(k,function(p,q){i.replaceWith(q,ice.dom.contents(q))})}else{if(i.is(e,n)){i.remove(k)}}},isInsideChange:function(f){var e="."+this._getIceNodeClass("insertType")+", ."+this._getIceNodeClass("deleteType");if(!f){range=this.getCurrentRange();if(!range.collapsed){return false}else{f=range.startContainer}}return !!ice.dom.getNode(f,e)},addChangeType:function(g,f,h,i){var e={tag:f,alias:h};if(i){e.action=i}this.changeTypes[g]=e},getIceNode:function(g,f){var e="."+this._getIceNodeClass(f);return ice.dom.getNode(g,e)},_moveRangeToValidTrackingPos:function(f){var g=false;var h=this._getVoidElement(f.endContainer);while(h){try{f.moveEnd(ice.dom.CHARACTER_UNIT,1);f.moveEnd(ice.dom.CHARACTER_UNIT,-1)}catch(i){g=true}if(g||ice.dom.onBlockBoundary(f.endContainer,f.startContainer,this.blockEl)){f.setStartAfter(h);f.collapse(true);break}h=this._getVoidElement(f.endContainer);if(h){f.setEnd(f.endContainer,0);f.moveEnd(ice.dom.CHARACTER_UNIT,ice.dom.getNodeTextContent(f.endContainer).length);f.collapse()}else{f.setStart(f.endContainer,0);f.collapse(true)}}},_getNoTrackElement:function(g){var f=this._getNoTrackSelector();var e=ice.dom.is(g,f)?g:(ice.dom.parents(g,f)[0]||null);return e},_getNoTrackSelector:function(){return'.ins[userid="'+this.currentUser.id+'"],'+this.noTrack},_getVoidElement:function(f){var e=this._getVoidElSelector();return ice.dom.is(f,e)?f:(ice.dom.parents(f,e)[0]||null)},_getVoidElSelector:function(){return"."+this._getIceNodeClass("deleteType")+","+this.avoid},_currentUserIceNode:function(e){return ice.dom.attr(e,this.userIdAttribute)==this.currentUser.id},_getChangeTypeFromAlias:function(f){var g,e=null;for(g in this.changeTypes){if(this.changeTypes.hasOwnProperty(g)){if(this.changeTypes[g].alias==f){e=g}}}return e},_getIceNodeClass:function(e){return this.attrValuePrefix+this.changeTypes[e].alias},getUserStyle:function(e){var f=null;if(this._userStyles[e]){f=this._userStyles[e]}else{f=this.setUserStyle(e,this.getNewStyleId())}return f},setUserStyle:function(e,g){var f=this.stylePrefix+"-"+g;if(!this._styles[g]){this._styles[g]=true}return this._userStyles[e]=f},getNewStyleId:function(){var e=++this._uniqueStyleIndex;if(this._styles[e]){return this.getNewStyleId()}else{this._styles[e]=true;return e}},addChange:function(f,h){var g=this._batchChangeid||this.getNewChangeId();if(!this._changes[g]){this._changes[g]={type:this._getChangeTypeFromAlias(f),time:(new Date()).getTime(),userid:this.currentUser.id,username:this.currentUser.name}}var e=this;ice.dom.foreach(h,function(j){e.addNodeToChange(g,h[j])});return g},addNodeToChange:function(g,f){if(this._batchChangeid!==null){g=this._batchChangeid}var h=this.getChange(g);if(!f.getAttribute(this.changeIdAttribute)){f.setAttribute(this.changeIdAttribute,g)}if(!f.getAttribute(this.userIdAttribute)){f.setAttribute(this.userIdAttribute,h.userid)}if(!f.getAttribute(this.userNameAttribute)){f.setAttribute(this.userNameAttribute,h.username)}if(!f.getAttribute(this.timeAttribute)){f.setAttribute(this.timeAttribute,h.time)}if(!ice.dom.hasClass(f,this._getIceNodeClass(h.type))){ice.dom.addClass(f,this._getIceNodeClass(h.type))}var e=this.getUserStyle(h.userid);if(!ice.dom.hasClass(f,e)){ice.dom.addClass(f,e)}},getChange:function(e){var f=null;if(this._changes[e]){f=this._changes[e]}return f},getNewChangeId:function(){var e=++this._uniqueIDIndex;if(this._changes[e]){e=this.getNewChangeId()}return e},startBatchChange:function(){this._batchChangeid=this.getNewChangeId();return this._batchChangeid},endBatchChange:function(e){if(e!==this._batchChangeid){return}this._batchChangeid=null},getCurrentRange:function(){return this.selection.getRangeAt(0)},_insertNode:function(g,e,f){var h=this.getIceNode(e.startContainer,"insertType");var i=this._currentUserIceNode(h);if(f&&i){return}else{if(!i){g=this.createIceNode("insertType",g)}}e.insertNode(g);if(f){e.setStart(g,0);e.setEnd(g,1)}this.selection.addRange(e)},_deleteFromSelection:function(l){var n=new ice.Bookmark(this.env,l),e=ice.dom.getElementsBetween(n.start,n.end),q=ice.dom.parents(l.startContainer,this.blockEl)[0],o=ice.dom.parents(l.endContainer,this.blockEl)[0],r=new Array(),m=e.length;var m=e.length;for(var k=0;k<m;k++){var g=e[k];if(ice.dom.is(g,this.blockEl)){r.push(g)}if(g.nodeType===ice.dom.TEXT_NODE&&ice.dom.getNodeTextContent(g)===""){continue}if(g.hasChildNodes()){for(var p=0;p<g.childNodes.length;p++){var f=g.childNodes[p];if(this._getNoTrackElement(f)){ice.dom.remove(f)}}}if(this._getNoTrackElement(g)){ice.dom.remove(g)}if(!this._getVoidElement(g)){if(g.nodeType!==ice.dom.TEXT_NODE){ice.dom.remove(ice.dom.find(g,"br"));var h=ice.dom.cloneNode(g);ice.dom.remove(ice.dom.find(h,this._getVoidElSelector()));if(ice.dom.getNodeTextContent(h).length===0){continue}else{if(ice.dom.is(g,this.blockEl)){var t=this.createIceNode("deleteType");newEl=document.createElement(this.blockEl);t.innerHTML=g.innerHTML;g.innerHTML="";g.appendChild(t);continue}}}var s=this.createIceNode("deleteType");ice.dom.insertBefore(g,s);s.appendChild(g)}}if(q!==o){while(r.length){ice.dom.mergeContainers(r.shift(),q)}ice.dom.mergeContainers(o,q)}var j=n.start.previousSibling;if(!j){j=this.env.document.createTextNode("");ice.dom.insertBefore(n.start,j);this.selection.addRange(l);n.selectBookmark();l=this.getCurrentRange();l.setStart(j,0)}else{n.selectBookmark();l=this.getCurrentRange();l.moveStart(ice.dom.CHARACTER_UNIT,-1);l.moveStart(ice.dom.CHARACTER_UNIT,1)}l.collapse(true)},_deleteFromRight:function(k){var f=ice.dom.parents(k.startContainer,this.blockEl)[0]||ice.dom.is(k.startContainer,this.blockEl)&&k.startContainer||null;var h=f&&f.nextSibling||null;var j=(ice.dom.is(k.startContainer,this.blockEl)&&ice.dom.getNodeTextContent(k.startContainer)=="");k.moveEnd(ice.dom.CHARACTER_UNIT,1);k.moveEnd(ice.dom.CHARACTER_UNIT,-1);if(!h&&!ice.dom.isChildOf(k.endContainer,this.element)){k.moveEnd(ice.dom.CHARACTER_UNIT,-1);k.moveEnd(ice.dom.CHARACTER_UNIT,1);k.collapse();return true}if(ice.dom.onBlockBoundary(k.endContainer,k.startContainer,this.blockEl)||j){if(h!==ice.dom.parents(k.endContainer,this.blockEl)[0]){k.setEnd(h,0)}ice.dom.remove(ice.dom.find(k.startContainer,"br"));return ice.dom.mergeBlockWithSibling(k,ice.dom.parents(k.startContainer,this.blockEl)[0]||f,true)}if(this._getVoidElement(k.endContainer)){k.setEnd(k.endContainer,0);k.moveEnd(ice.dom.CHARACTER_UNIT,ice.dom.getNodeTextContent(k.endContainer).length||0);k.collapse();return this._deleteFromRight(k)}if(this._getNoTrackElement(k.endContainer.parentElement)){k.deleteContents();return false}k.collapse();var e=k.startContainer;if(k.startContainer.data&&k.endOffset===e.data.length){var n=k.cloneRange();n.moveEnd(ice.dom.CHARACTER_UNIT,1);var p=ice.dom.getBlockParent(n.endContainer,this.element);if(p){if(ice.dom.isChildOf(p,this.element)===false){return}var i=ice.dom.getBlockParent(n.startContainer,this.element);if(p!==i){ice.dom.mergeContainers(p,i);k.setStart(n.startContainer,n.startContainer.data.length);k.collapse(true);return}}var m=k.getNextContainer(e);if(ice.dom.isChildOf(m,this.element)===false){return false}var l=k.getFirstSelectableChild(m);k.setStart(l,0);this._addTextNodeTracking(l,k)}else{var g=this.getIceNode(k.startContainer,"insertType");if(g===null||!this._currentUserIceNode(g)){this._addTextNodeTracking(k.startContainer,k,true)}else{k.moveEnd(ice.dom.CHARACTER_UNIT,1);k.deleteContents();if(g!==null&&ice.dom.isBlank(ice.dom.getNodeTextContent(g))===true){var o=g.previousSibling;if(!o||o.nodeType!==ice.dom.TEXT_NODE){o=this.env.document.createTextNode("");ice.dom.insertBefore(g,o)}k.setStart(o,o.data.length);ice.dom.remove(g)}}}k.collapse(true);return true},_deleteFromLeft:function(o){var g=ice.dom.parents(o.startContainer,this.blockEl)[0]||ice.dom.is(o.startContainer,this.blockEl)&&o.startContainer||null,e=g&&g.previousSibling||null,m=(ice.dom.is(o.startContainer,this.blockEl)&&ice.dom.getNodeTextContent(o.startContainer)=="");o.moveStart(ice.dom.CHARACTER_UNIT,-1);var n=(o.startOffset===o.endOffset&&o.startContainer===o.endContainer),l=!ice.dom.isChildOf(o.startContainer,this.element);o.moveStart(ice.dom.CHARACTER_UNIT,1);if(n||!e&&l){o.moveStart(ice.dom.CHARACTER_UNIT,1);o.moveStart(ice.dom.CHARACTER_UNIT,-1);o.collapse(true);return true}if(ice.dom.onBlockBoundary(o.startContainer,o.endContainer,this.blockEl)||m){if(e!==ice.dom.parents(o.startContainer,this.blockEl)[0]){o.setStart(e,0)}ice.dom.remove(ice.dom.find(o.endContainer,"br"));return ice.dom.mergeBlockWithSibling(o,ice.dom.parents(o.endContainer,this.blockEl)[0]||g)}if(this._getVoidElement(o.startContainer)){o.setStart(o.startContainer,0);o.collapse(true);return this._deleteFromLeft(o)}if(this._getNoTrackElement(o.startContainer.parentElement)){o.deleteContents();return false}var f=o.startContainer;if(o.startOffset===0){var q=o.cloneRange();q.moveStart(ice.dom.CHARACTER_UNIT,-1);var k=ice.dom.getBlockParent(q.startContainer,this.element);if(k){if(ice.dom.isChildOf(k,this.element)===false){return false}var r=ice.dom.getBlockParent(q.endContainer,this.element);if(r!==k){ice.dom.mergeContainers(r,k);o.setStart(q.startContainer,q.startContainer.data.length);o.collapse(true);return}}var i=o.getPreviousContainer(f);if(!ice.dom.isChildOf(i,this.element)){return false}if(ice.dom.isStubElement(i)){o.moveStart(ice.dom.CHARACTER_UNIT,-1);ice.dom.addClass(i,this._getIceNodeClass("deleteType"));ice.dom.attr(i,"title","Content removed");o.collapse(true)}else{var s=o.getLastSelectableChild(i);o.setStart(s,s.data.length);this._addTextNodeTracking(s,o)}}else{var j=o.startContainer;var h=this.getIceNode(j,"insertType");if(h===null||!this._currentUserIceNode(h)){this._addTextNodeTracking(j,o)}else{o.moveStart(ice.dom.CHARACTER_UNIT,-1);o.moveEnd(ice.dom.CHARACTER_UNIT,-1);o.moveEnd(ice.dom.CHARACTER_UNIT,1);o.deleteContents();if(h!==null&&ice.dom.isBlank(ice.dom.getNodeTextContent(h))){var p=this.env.document.createTextNode("");ice.dom.insertBefore(h,p);o.setStart(p,0);o.collapse(true);ice.dom.replaceWith(h,ice.dom.contents(h))}}}return true},_addTextNodeTracking:function(g,j,n){if((!n&&j.startOffset===0)||this.getIceNode(g,"deleteType")!==null){return}var i="";var k="";var o="";if(!n){i=g.nodeValue.substring(0,(j.startOffset-1));k=g.nodeValue.substr((j.startOffset-1),1);o=g.nodeValue.substring(j.startOffset)}else{i=g.nodeValue.substring(0,j.endOffset);k=g.nodeValue.substr(j.endOffset,1);o=g.nodeValue.substring((j.endOffset+1))}if((j.startOffset===1&&!n)||(n&&j.startOffset===0)){var m=this.getIceNode(g.previousSibling,"deleteType");if(m!==null&&!this._currentUserIceNode(m)){m=null}if(m){if(!n){if(m.lastChild&&m.lastChild.nodeType===ice.dom.TEXT_NODE){m.lastChild.nodeValue+=k;j.setStart(m.lastChild,(m.lastChild.nodeValue.length-1))}else{var f=this.env.document.createTextNode(k);m.appendChild(f);j.setStart(f,0)}g.nodeValue=i+o;g.nodeValue=i+o;if(g.nodeValue.length===0){var p=false;var e=g.previousSibling;while(!p){m=this.getIceNode(e,"deleteType");if(!m){p=true}else{e=e.previousSibling}}if(e){e=j.getLastSelectableChild(e);j.setStart(e,e.nodeValue.length);j.collapse(true)}}else{j.collapse(true)}}else{if(m.lastChild&&m.lastChild.nodeType===ice.dom.TEXT_NODE){m.lastChild.nodeValue+=k}else{var f=this.env.document.createTextNode(k);m.appendChild(f)}g.nodeValue=i+o;if(g.nodeValue.length===0){var p=false;var h=g.nextSibling;while(!p){m=this.getIceNode(h,"deleteType");if(!m){p=true}else{h=h.nextSibling}}if(h){j.setStart(h,0);j.collapse(true)}}else{j.setStart(g,0);j.collapse(true)}}return}}if(j.startOffset===g.nodeValue.length){var m=this.getIceNode(g.nextSibling,"deleteType");if(m!==null&&!this._currentUserIceNode(m)){m=null}if(m){if(m.firstChild&&m.firstChild.nodeType===ice.dom.TEXT_NODE){m.firstChild.nodeValue=k+m.firstChild.nodeValue}else{var f=this.env.document.createTextNode(k);ice.dom.insertBefore(m.firstChild,f)}g.nodeValue=i;j.setStart(g,g.nodeValue.length);j.setEnd(g,g.nodeValue.length);return}}var m=this.createIceNode("deleteType");var l=null;if(n!==true){l=g.splitText(j.startOffset-1);l.nodeValue=l.nodeValue.substring(1);ice.dom.insertAfter(g,l);m.firstChild.nodeValue=k;ice.dom.insertAfter(g,m);j.setStart(g,g.nodeValue.length);j.setEnd(g,g.nodeValue.length)}else{l=g.splitText(j.endOffset);l.nodeValue=l.nodeValue.substring(1);ice.dom.insertAfter(g,l);m.firstChild.nodeValue=k;ice.dom.insertAfter(g,m);j.setStart(l,0);j.setEnd(l,0)}},_handleAncillaryKey:function(i){var h=i.keyCode;var f=true;var g=i.shiftKey;switch(h){case ice.dom.DOM_VK_DELETE:f=this.deleteContents();this.pluginsManager.fireKeyPressed(i);break;case 46:f=this.deleteContents(true);this.pluginsManager.fireKeyPressed(i);break;case ice.dom.DOM_VK_DOWN:case ice.dom.DOM_VK_UP:case ice.dom.DOM_VK_LEFT:case ice.dom.DOM_VK_RIGHT:this.pluginsManager.fireCaretPositioned();f=false;break;default:f=false;break}if(f===true){ice.dom.preventDefault(i);return false}return true},keyDown:function(g){if(!this.pluginsManager.fireKeyDown(g)){ice.dom.preventDefault(g);return false}var f=false;if(this._handleSpecialKey(g)===false){if(ice.dom.isBrowser("msie")!==true){this._preventKeyPress=true}return false}else{if((g.ctrlKey===true||g.metaKey===true)&&(ice.dom.isBrowser("msie")===true||ice.dom.isBrowser("chrome")===true)){if(!this.pluginsManager.fireKeyPressed(g)){return false}}}switch(g.keyCode){case 27:break;default:if(/Firefox/.test(navigator.userAgent)!==true){f=!(this._handleAncillaryKey(g))}break}if(f){ice.dom.preventDefault(g);return false}return true},keyPress:function(h){if(this._preventKeyPress===true){this._preventKeyPress=false;return}if(!this.pluginsManager.fireKeyPressed(h)){return false}var i=null;if(h.which==null){i=String.fromCharCode(h.keyCode)}else{if(h.which>0){i=String.fromCharCode(h.which)}}var f=this.getCurrentRange();var g=ice.dom.parents(f.startContainer,"br")[0]||null;if(g){f.moveToNextEl(g);g.parentNode.removeChild(g)}if(i!==null&&h.ctrlKey!==true&&h.metaKey!==true){switch(h.keyCode){case ice.dom.DOM_VK_DELETE:return this._handleAncillaryKey(h);case ice.dom.DOM_VK_ENTER:return this._handleEnter();default:this._moveRangeToValidTrackingPos(f,f.startContainer);return this.insert();break}}return this._handleAncillaryKey(h)},_handleEnter:function(){var e=this.getCurrentRange();if(!e.collapsed){this.deleteContents()}return true},_handleSpecialKey:function(k){var j=k.which;if(j===null){j=k.keyCode}var h=false;switch(j){case 65:if(k.ctrlKey===true||k.metaKey===true){h=true;var g=this.getCurrentRange();if(ice.dom.isBrowser("msie")===true){var l=this.env.document.createTextNode("");var f=this.env.document.createTextNode("");if(this.element.firstChild){ice.dom.insertBefore(this.element.firstChild,l)}else{this.element.appendChild(l)}this.element.appendChild(f);g.setStart(l,0);g.setEnd(f,0)}else{g.setStart(g.getFirstSelectableChild(this.element),0);var i=g.getLastSelectableChild(this.element);g.setEnd(i,i.length)}this.selection.addRange(g)}break;default:break}if(h===true){ice.dom.preventDefault(k);return false}return true},mouseUp:function(g,f){if(!this.pluginsManager.fireClicked(g)){return false}this.pluginsManager.fireSelectionChanged(this.getCurrentRange())},mouseDown:function(g,f){if(!this.pluginsManager.fireMouseDown(g)){return false}this.pluginsManager.fireCaretUpdated()}};a.ice=this.ice||{};a.ice.InlineChangeEditor=b}).call(this);(function(){var a=this,b={};b.DOM_VK_DELETE=8;b.DOM_VK_LEFT=37;b.DOM_VK_UP=38;b.DOM_VK_RIGHT=39;b.DOM_VK_DOWN=40;b.DOM_VK_ENTER=13;b.ELEMENT_NODE=1;b.ATTRIBUTE_NODE=2;b.TEXT_NODE=3;b.CDATA_SECTION_NODE=4;b.ENTITY_REFERENCE_NODE=5;b.ENTITY_NODE=6;b.PROCESSING_INSTRUCTION_NODE=7;b.COMMENT_NODE=8;b.DOCUMENT_NODE=9;b.DOCUMENT_TYPE_NODE=10;b.DOCUMENT_FRAGMENT_NODE=11;b.NOTATION_NODE=12;b.CHARACTER_UNIT="character";b.WORD_UNIT="word";b.getKeyChar=function(d){return String.fromCharCode(d.which)};b.getClass=function(f,e,d){if(!e){e=document.body}f="."+f.split(" ").join(".");if(d){f=d+f}return jQuery.makeArray(jQuery(e).find(f))};b.getId=function(e,d){if(!d){d=document}element=d.getElementById(e);return element};b.getTag=function(d,e){if(!e){e=document}return jQuery.makeArray(jQuery(e).find(d))};b.getElementWidth=function(d){return d.offsetWidth};b.getElementHeight=function(d){return d.offsetHeight};b.getElementDimensions=function(e){var d={width:b.getElementWidth(e),height:b.getElementHeight(e)};return d};b.trim=function(d){return jQuery.trim(d)};b.empty=function(d){if(d){return jQuery(d).empty()}};b.remove=function(d){if(d){return jQuery(d).remove()}};b.prepend=function(d,e){jQuery(d).prepend(e)};b.append=function(d,e){jQuery(d).append(e)};b.insertBefore=function(e,d){jQuery(e).before(d)};b.insertAfter=function(e,d){jQuery(e).after(d)};b.getHtml=function(d){return jQuery(d).html()};b.setHtml=function(d,e){if(d){jQuery(d).html(e)}};b.contents=function(d){return jQuery(d).contents()};b.extractContent=function(d){var f=document.createDocumentFragment(),e;while((e=d.firstChild)){f.appendChild(e)}return f},b.getNode=function(e,d){return b.is(e,d)?e:b.parents(e,d)[0]||null},b.getParents=function(k,g,j){var f=jQuery(k).parents(g);var h=f.length;var d=[];for(var e=0;e<h;e++){if(f[e]===j){break}d.push(f[e])}return d};b.hasBlockChildren=function(e){var f=e.childNodes.length;for(var d=0;d<f;d++){if(e.childNodes[d].nodeType===b.ELEMENT_NODE){if(b.isBlockElement(e.childNodes[d])===true){return true}}}return false};b.removeTag=function(e,d){jQuery(e).find(d).replaceWith(function(){return jQuery(this).contents()});return e};b.stripEnclosingTags=function(d,f){var e=jQuery(d);e.find("*").not(f).replaceWith(function(){return jQuery(this).contents()});return e[0]};b.getSiblings=function(g,f,h,e){if(h===true){if(f==="prev"){return jQuery(g).prevAll()}else{return jQuery(g).nextAll()}}else{var d=[];if(f==="prev"){while(g.previousSibling){g=g.previousSibling;if(g===e){break}d.push(g)}}else{while(g.nextSibling){g=g.nextSibling;if(g===e){break}d.push(g)}}return d}};b.getNodeTextContent=function(d){return jQuery(d).text()};b.setNodeTextContent=function(e,d){return jQuery(e).text(d)};b.getTagName=function(d){return d.tagName&&d.tagName.toLowerCase()||null};b.getIframeDocument=function(d){var e=null;if(d.contentDocument){e=d.contentDocument}else{if(d.contentWindow){e=d.contentWindow.document}else{if(d.document){e=d.document}}}return e};b.isBlockElement=function(d){switch(d.nodeName.toLowerCase()){case"p":case"div":case"pre":case"ul":case"ol":case"li":case"table":case"tbody":case"td":case"th":case"fieldset":case"form":case"blockquote":case"dl":case"dir":case"center":case"address":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":case"img":return true;break;default:return false;break}return false};b.isStubElement=function(d){if(d){switch(d.nodeName.toLowerCase()){case"img":case"br":case"hr":case"iframe":case"param":case"link":case"meta":case"input":case"frame":case"col":case"base":case"area":return true;break;default:return false;break}}return false};b.isChildOf=function(f,d){try{while(f&&f.parentNode){if(f.parentNode===d){return true}f=f.parentNode}}catch(g){}return false};b.isChildOfTagName=function(g,f){var d=null;try{while(g&&g.parentNode){if(g.parentNode&&g.parentNode.tagName&&g.parentNode.tagName.toLowerCase()===f){d=g.parentNode}g=g.parentNode}}catch(h){}return d};b.isChildOfClassName=function(g,f){var d=null;try{while(g&&g.parentNode){if(jQuery(g.parentNode).hasClass(f)){d=g.parentNode}g=g.parentNode}}catch(h){}return d};b.cloneNode=function(d,e){if(e===undefined){e=true}return jQuery(d).clone(e)};b.bind=function(d,e,f){return jQuery(d).bind(e,f)};b.attr=function(e,d,f){if(f){return jQuery(e).attr(d,f)}else{return jQuery(e).attr(d)}};b.replaceWith=function(e,d){return jQuery(e).replaceWith(d)};b.removeAttr=function(e,d){jQuery(e).removeAttr(d)};b.getElementsBetween=function(o,k){var d=[];if(o===k){return d}if(b.isChildOf(k,o)===true){var l=o.childNodes.length;for(var g=0;g<l;g++){if(o.childNodes[g]===k){break}else{if(b.isChildOf(k,o.childNodes[g])===true){return b.arrayMerge(d,b.getElementsBetween(o.childNodes[g],k))}else{d.push(o.childNodes[g])}}}return d}var f=o.nextSibling;while(f){if(b.isChildOf(k,f)===true){d=b.arrayMerge(d,b.getElementsBetween(f,k));return d}else{if(f===k){return d}else{d.push(f);f=f.nextSibling}}}var q=b.getParents(o);var m=b.getParents(k);var p=b.arrayDiff(q,m,true);var n=p.length;for(var e=0;e<(n-1);e++){d=b.arrayMerge(d,b.getSiblings(p[e],"next"))}var h=p[(p.length-1)];d=b.arrayMerge(d,b.getElementsBetween(h,k));return d};b.getCommonAncestor=function(e,d){var f=e;while(f){if(b.isChildOf(d,f)===true){return f}f=f.parentNode}return null};b.getNextNode=function(d){if(d.nextSibling){return d.nextSibling}else{if(d.parentNode){return b.getFirstChild(d.parentNode)}}return null};b.getPrevNode=function(d){if(d.previousSibling){return d.previousSibling}else{if(d.parentNode){return b.getLastChild(d.parentNode)}}return null};b.getFirstChild=function(d){if(d.firstChild){if(d.firstChild.nodeType===b.ELEMENT_NODE){return b.getFirstChild(d.firstChild)}else{return d.firstChild}}return d};b.getLastChild=function(d){if(d.lastChild){if(d.lastChild.nodeType===b.ELEMENT_NODE){return b.getLastChild(d.lastChild)}else{return d.lastChild}}return d};b.removeEmptyNodes=function(f,g){var d=jQuery(f).find(":empty");var e=d.length;while(e>0){e--;if(b.isStubElement(d[e])===false){if(!g||g.call(this,d[e])!==false){b.remove(d[e])}}}};b.create=function(d){return jQuery(d)[0]};b.find=function(d,e){return jQuery(d).find(e)};b.children=function(d,e){return jQuery(d).children(e)};b.parent=function(e,d){return jQuery(e).parent(d)[0]};b.parents=function(e,d){return jQuery(e).parents(d)};b.is=function(d,e){return jQuery(d).is(e)};b.extend=function(d,g,f,e){return jQuery.extend.apply(this,arguments)};b.walk=function(e,g,d){if(!e){return}if(!d){d=0}var f=g.call(this,e,d);if(f===false){return}if(e.childNodes&&e.childNodes.length>0){b.walk(e.firstChild,g,(d+1))}else{if(e.nextSibling){b.walk(e.nextSibling,g,d)}else{if(e.parentNode&&e.parentNode.nextSibling){b.walk(e.parentNode.nextSibling,g,(d-1))}}}};b.revWalk=function(d,f){if(!d){return}var e=f.call(this,d);if(e===false){return}if(d.childNodes&&d.childNodes.length>0){b.walk(d.lastChild,f)}else{if(d.previousSibling){b.walk(d.previousSibling,f)}else{if(d.parentNode&&d.parentNode.previousSibling){b.walk(d.parentNode.previousSibling,f)}}}};b.setStyle=function(d,f,e){if(d){jQuery(d).css(f,e)}};b.getStyle=function(d,e){return jQuery(d).css(e)};b.hasClass=function(d,e){return jQuery(d).hasClass(e)};b.addClass=function(d,e){jQuery(d).addClass(e)};b.removeClass=function(d,e){jQuery(d).removeClass(e)};b.preventDefault=function(d){d.preventDefault();b.stopPropagation(d)};b.stopPropagation=function(d){d.stopPropagation()};b.noInclusionInherits=function(f,e){if(e instanceof String||typeof e==="string"){e=window[e]}if(f instanceof String||typeof f==="string"){f=window[f]}var d=function(){};if(b.isset(e)===true){for(value in e.prototype){if(f.prototype[value]){d.prototype[value]=e.prototype[value];continue}f.prototype[value]=e.prototype[value]}}if(f.prototype){d.prototype.constructor=e;f.prototype["super"]=new d()}};b.each=function(d,e){jQuery.each(d,function(f,g){e.call(this,f,g)})};b.foreach=function(h,e){if(h instanceof Array||h instanceof NodeList||typeof h.length!="undefined"&&typeof h.item!="undefined"){var d=h.length;for(var g=0;g<d;g++){var f=e.call(this,g,h[g]);if(f===false){break}}}else{for(var j in h){if(h.hasOwnProperty(j)===true){var f=e.call(this,j);if(f===false){break}}}}};b.isBlank=function(d){if(!d||/^\s*$/.test(d)){return true}return false};b.isFn=function(d){if(typeof d==="function"){return true}return false};b.isObj=function(d){if(d!==null&&typeof d==="object"){return true}return false};b.isset=function(d){if(typeof d!=="undefined"&&d!==null){return true}return false};b.isArray=function(d){return jQuery.isArray(d)};b.isNumeric=function(e){var d=e.match(/^\d+$/);if(d!==null){return true}return false};b.getUniqueId=function(){var e=(new Date()).getTime();var d=Math.ceil(Math.random()*1000000);var f=e+""+d;return f.substr(5,18).replace(/,/,"")};b.inArray=function(g,e){var f=e.length;for(var d=0;d<f;d++){if(g===e[d]){return true}}return false};b.arrayDiff=function(h,g,f){var j=h.length;var e=[];for(var d=0;d<j;d++){if(b.inArray(h[d],g)===false){e.push(h[d])}}if(f!==true){j=g.length;for(var d=0;d<j;d++){if(b.inArray(g[d],h)===false){e.push(g[d])}}}return e};b.arrayMerge=function(f,e){var g=e.length;for(var d=0;d<g;d++){f.push(e[d])}return f};b.stripTags=function(f,i){if(typeof i==="string"){var h=jQuery("<div>"+f+"</div>");h.find("*").not(i).remove();return h.html()}else{var d;var e=new RegExp(/<\/?(\w+)((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);var g=f;while((d=e.exec(f))!=null){if(b.isset(i)===false||b.inArray(d[1],i)!==true){g=g.replace(d[0],"")}}return g}};b.browser=function(){var d={};d.version=jQuery.browser.version;if(jQuery.browser.mozilla===true){d.type="mozilla"}else{if(jQuery.browser.msie===true){d.type="msie"}else{if(jQuery.browser.opera===true){d.type="opera"}else{if(jQuery.browser.safari===true){d.type="safari"}}}}return d};b.getBrowserType=function(){if(this._browserType===null){var f=["msie","firefox","chrome","safari"];var e=f.length;for(var d=0;d<e;d++){var g=new RegExp(f[d],"i");if(g.test(navigator.userAgent)===true){this._browserType=f[d];return this._browserType}}this._browserType="other"}return this._browserType};b.isBrowser=function(d){return(b.browser().type===d)};b.getBlockParent=function(e,d){if(e){while(e.parentNode){e=e.parentNode;if(e===d){return null}if(b.isBlockElement(e)===true){return e}}}return null};b.onBlockBoundary=function(f,e,h){if(!f||!e){return false}var d=b.isChildOfTagName(f,h)||b.is(f,h)&&f||null;var g=b.isChildOfTagName(e,h)||b.is(e,h)&&e||null;return(d!==g)};b.mergeContainers=function(e,d){if(!e||!d){return false}if(e.nodeType===b.TEXT_NODE||b.isStubElement(e)){d.appendChild(e)}else{if(e.nodeType===b.ELEMENT_NODE){while(e.firstChild){d.appendChild(e.firstChild)}b.remove(e)}}return true};b.mergeBlockWithSibling=function(d,g,f){var e=f?g.nextSibling:g.previousSibling;if(f){b.mergeContainers(e,g)}else{b.mergeContainers(g,e)}d.collapse(true);return true};b.date=function(p,m,e){if(m===null&&e){m=b.tsIso8601ToTimestamp(e);if(!m){return}}var h=new Date(m);var o=p.split("");var g=o.length;var j="";for(var k=0;k<g;k++){var d="";var l=o[k];switch(l){case"D":case"l":var n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];d=n[h.getDay()];if(l==="D"){d=d.substring(0,3)}break;case"F":case"m":d=h.getMonth()+1;if(d<10){d="0"+d}break;case"M":months=["January","February","March","April","May","June","July","August","September","October","November","December"];d=months[h.getMonth()];if(l==="M"){d=d.substring(0,3)}break;case"d":d=h.getDate();break;case"S":d=b.getOrdinalSuffix(h.getDate());break;case"Y":d=h.getFullYear();break;case"y":d=h.getFullYear();d=d.toString().substring(2);break;case"H":d=h.getHours();break;case"h":d=h.getHours();if(d===0){d=12}else{if(d>12){d-=12}}break;case"i":d=b.addNumberPadding(h.getMinutes());break;case"a":d="am";if(h.getHours()>=12){d="pm"}break;default:d=l;break}j+=d}return j};b.getOrdinalSuffix=function(e){var f="";var d=(e%100);if(d>=4&&d<=20){f="th"}else{switch(e%10){case 1:f="st";break;case 2:f="nd";break;case 3:f="rd";break;default:f="th";break}}return f};b.addNumberPadding=function(d){if(d<10){d="0"+d}return d};b.tsIso8601ToTimestamp=function(e){var h=/(\d\d\d\d)(?:-?(\d\d)(?:-?(\d\d)(?:[T ](\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(?:Z|(?:([-+])(\d\d)(?::?(\d\d))?)?)?)?)?)?/;var j=e.match(new RegExp(h));if(j){var f=new Date();f.setDate(j[3]);f.setFullYear(j[1]);f.setMonth(j[2]-1);f.setHours(j[4]);f.setMinutes(j[5]);f.setSeconds(j[6]);var i=(j[9]*60);if(j[8]==="+"){i*=-1}i-=f.getTimezoneOffset();var g=(f.getTime()+(i*60*1000));return g}return null};a.dom=b}).call(this.ice);(function(){var a=this,b;b=function(j,g,p){this.env=j;this.element=j.element;this.selection=this.env.selection;if(!p){this.removeBookmarks(this.element)}var n=g||this.selection.getRangeAt(0);var g=n.cloneRange();var d=g.startContainer;var o=g.endContainer;var l=g.startOffset;var m=g.endOffset;g.collapse(false);var i=this.env.document.createElement("span");i.style.display="none";ice.dom.setHtml(i,"&nbsp;");ice.dom.addClass(i,"iceBookmark iceBookmark_end");i.setAttribute("iceBookmark","end");g.insertNode(i);if(!ice.dom.isChildOf(i,this.element)){this.element.appendChild(i)}g.setStart(d,l);g.collapse(true);var h=this.env.document.createElement("span");h.style.display="none";ice.dom.addClass(h,"iceBookmark iceBookmark_start");ice.dom.setHtml(h,"&nbsp;");h.setAttribute("iceBookmark","start");try{g.insertNode(h);if(h.previousSibling===i){var f=h;h=i;i=f}}catch(k){ice.dom.insertBefore(i,h)}if(ice.dom.isChildOf(h,this.element)===false){if(this.element.firstChild){ice.dom.insertBefore(this.element.firstChild,h)}else{this.element.appendChild(h)}}if(!i.previousSibling){var f=this.env.document.createTextNode("");ice.dom.insertBefore(i,f)}if(!h.nextSibling){var f=this.env.document.createTextNode("");ice.dom.insertAfter(h,f)}n.setStart(h.nextSibling,0);n.setEnd(i.previousSibling,(i.previousSibling.length||0));this.start=h;this.end=i};b.prototype={selectBookmark:function(){var f=this.selection.getRangeAt(0);var i=null;var h=null;var d=0;var g=null;if(this.start.nextSibling===this.end||ice.dom.getElementsBetween(this.start,this.end).length===0){if(this.end.nextSibling){i=ice.dom.getFirstChild(this.end.nextSibling)}else{if(this.start.previousSibling){i=ice.dom.getFirstChild(this.start.previousSibling);if(i.nodeType===ice.dom.TEXT_NODE){d=i.length}}else{this.end.parentNode.appendChild(this.env.document.createTextNode(""));i=ice.dom.getFirstChild(this.end.nextSibling)}}}else{if(this.start.nextSibling){i=ice.dom.getFirstChild(this.start.nextSibling)}else{if(!this.start.previousSibling){var j=this.env.document.createTextNode("");ice.dom.insertBefore(this.start,j)}i=ice.dom.getLastChild(this.start.previousSibling);d=i.length}if(this.end.previousSibling){h=ice.dom.getLastChild(this.end.previousSibling)}else{h=ice.dom.getFirstChild(this.end.nextSibling);g=0}}ice.dom.remove([this.start,this.end]);if(h===null){f.setEnd(i,d);f.collapse(false)}else{f.setStart(i,d);if(g===null){g=(h.length||0)}f.setEnd(h,g)}try{this.selection.addRange(f)}catch(k){}},getBookmark:function(e,d){var f=ice.dom.getClass("iceBookmark_"+d,e)[0];return f},removeBookmarks:function(d){ice.dom.remove(ice.dom.getClass("iceBookmark",d,"span"))}};a.Bookmark=b}).call(this.ice);(function(){var a=this,b;b=function(d){this._selection=null;this.env=d;this._initializeRangeLibrary();if(this.env.frame){this._selection=rangy.getIframeSelection(this.env.frame)}else{this._selection=rangy.getSelection()}};b.prototype={_getSelection:function(){if(this._selection){this._selection.refresh()}else{if(this.env.frame){this._selection=rangy.getIframeSelection(this.env.frame)}else{this._selection=rangy.getSelection()}}return this._selection},createRange:function(){return rangy.createRange(this.env.document)},getRangeAt:function(f){this._selection.refresh();try{return this._selection.getRangeAt(f)}catch(d){return this.createRange()}},addRange:function(d){this._selection||(this._selection=this._getSelection());this._selection.setSingleRange(d);this._selection.ranges=[d];return},_initializeRangeLibrary:function(){var d=this;rangy.init();rangy.config.checkSelectionRanges=false;rangy.rangePrototype.moveStart=function(f,e){if(e===0){throw Error("InvalidArgumentException: units cannot be 0")}switch(f){case ice.dom.CHARACTER_UNIT:if(e>0){this.moveCharRight(true,e)}else{this.moveCharLeft(true,e)}break;case ice.dom.WORD_UNIT:default:break}};rangy.rangePrototype.moveEnd=function(f,e){if(e===0){throw Error("InvalidArgumentException: units cannot be 0")}switch(f){case ice.dom.CHARACTER_UNIT:if(e>0){this.moveCharRight(false,e)}else{this.moveCharLeft(false,e)}break;case ice.dom.WORD_UNIT:default:break}};rangy.rangePrototype.setRange=function(g,e,f){if(g){this.setStart(e,f)}else{this.setEnd(e,f)}};rangy.rangePrototype.moveCharLeft=function(h,g){var f,i;if(h){f=this.startContainer;i=this.startOffset}else{f=this.endContainer;i=this.endOffset}i+=g;if(i<0){while(i<0){var e=[];if(!this.getPreviousContainer(f,e)){if(g===-1){return}i=0;break}f=this.getPreviousContainer(f,e);if(f.nodeType===ice.dom.ELEMENT_NODE){continue}i=f.data.length;i--}}this.setRange(h,f,i)};rangy.rangePrototype.moveCharRight=function(h,g){var f,j;if(h){f=this.startContainer;j=this.startOffset}else{f=this.endContainer;j=this.endOffset}if(f.nodeType===ice.dom.ELEMENT_NODE){f=f.childNodes[j];if(f.nodeType!==ice.dom.TEXT_NODE){f=this.getNextTextNode(f)}j=g}else{j+=g}var i=(j-f.data.length);if(i>0){var e=[];while(i>0){f=this.getNextContainer(f,e);if(f.nodeType===ice.dom.ELEMENT_NODE){continue}if(f.data.length>=i){break}else{if(f.data.length>0){i-=f.data.length}}}j=i}this.setRange(h,f,j)};rangy.rangePrototype.getNextContainer=function(f,e){if(!f){return null}while(f.nextSibling){f=f.nextSibling;if(f.nodeType!==ice.dom.TEXT_NODE){var h=this.getFirstSelectableChild(f);if(h!==null){return h}}else{if(this.isSelectable(f)===true){return f}}}while(f&&!f.nextSibling){f=f.parentNode}if(!f){return null}f=f.nextSibling;if(this.isSelectable(f)===true){return f}else{if(e&&ice.dom.isBlockElement(f)===true){e.push(f)}}var g=this.getFirstSelectableChild(f);if(g!==null){return g}return this.getNextContainer(f,e)};rangy.rangePrototype.getPreviousContainer=function(f,e){if(!f){return null}while(f.previousSibling){f=f.previousSibling;if(f.nodeType!==ice.dom.TEXT_NODE){if(ice.dom.isStubElement(f)===true){return f}else{var h=this.getLastSelectableChild(f);if(h!==null){return h}}}else{if(this.isSelectable(f)===true){return f}}}while(f&&!f.previousSibling){f=f.parentNode}if(!f){return null}f=f.previousSibling;if(this.isSelectable(f)===true){return f}else{if(e&&ice.dom.isBlockElement(f)===true){e.push(f)}}var g=this.getLastSelectableChild(f);if(g!==null){return g}return this.getPreviousContainer(f,e)};rangy.rangePrototype.getStartOffset=function(f){if(f===true){return this.startOffset}var g=0;var e=this.startContainer;var i=e.data.charCodeAt(0);while(i===10||i===32){g++;i=e.data.charCodeAt(g)}var h=(this.startOffset-g);return h};rangy.rangePrototype.getNextTextNode=function(e){if(e.nodeType===ice.dom.ELEMENT_NODE){if(e.childNodes.length!==0){return this.getFirstSelectableChild(e)}}e=this.getNextContainer(e);if(e.nodeType===ice.dom.TEXT_NODE){return e}return this.getNextTextNode(e)};rangy.rangePrototype.getFirstSelectableChild=function(f){if(f){if(f.nodeType!==ice.dom.TEXT_NODE){var g=f.firstChild;while(g){if(this.isSelectable(g)===true){return g}else{if(g.firstChild){var e=this.getFirstSelectableChild(g);if(e!==null){return e}else{g=g.nextSibling}}else{g=g.nextSibling}}}}else{return f}}return null};rangy.rangePrototype.getLastSelectableChild=function(f){if(f){if(f.nodeType!==ice.dom.TEXT_NODE){var g=f.lastChild;while(g){if(this.isSelectable(g)===true){return g}else{if(g.lastChild){var e=this.getLastSelectableChild(g);if(e!==null){return e}else{g=g.previousSibling}}else{g=g.previousSibling}}}}else{return f}}return null};rangy.rangePrototype.isSelectable=function(e){if(e&&e.nodeType===ice.dom.TEXT_NODE&&e.data.length!==0){return true}return false};rangy.rangePrototype.getHTMLContents=function(e){if(!e){e=this.cloneContents()}var f=d.env.document.createElement("div");f.appendChild(e.cloneNode(true));return f.innerHTML};rangy.rangePrototype.getHTMLContentsObj=function(){return this.cloneContents()}}};a.Selection=b}).call(this.ice);(function(){var a=this;var b=function(d){this._ice=d};b.prototype={start:function(){},clicked:function(d){return true},mouseDown:function(d){return true},keyDown:function(d){return true},keyPress:function(d){return true},selectionChanged:function(d){},setEnabled:function(d){},setDisabled:function(d){},caretUpdated:function(){},nodeInserted:function(e,d){},nodeCreated:function(e,d){},caretPositioned:function(){},remove:function(){this._ice.removeKeyPressListener(this)},setSettings:function(d){}};a.IcePlugin=b}).call(this.ice);(function(){var a=this;var b=function(d){this.plugins={},this.pluginConstructors={},this.keyPressListeners={},this.activePlugin=null,this.pluginSets={},this.activePluginSet=null,this._ice=d};b.prototype={getPluginNames:function(){var d=[];for(var e in this.plugins){d.push(e)}return d},addPluginObject:function(d,e){this.plugins[d]=e},addPlugin:function(d,e){if(typeof e!=="function"){throw Error("IcePluginException: plugin must be a constructor function")}if(ice.dom.isset(this.pluginConstructors[d])===false){this.pluginConstructors[d]=e}},loadPlugins:function(d,f){if(d.length===0){f.call(this)}else{var e=d.shift();if(typeof e==="object"){e=e.name}if(ice.dom.isset(ice._plugin[e])===true){this.addPlugin(e,ice._plugin[e]);this.loadPlugins(d,f)}else{throw new Error("plugin was not included in the page: "+e)}}},_enableSet:function(d){this.activePluginSet=d;var g=this.pluginSets[d].length;for(var f=0;f<g;f++){var h=this.pluginSets[d][f];var j="";if(typeof h==="object"){j=h.name}else{j=h}var e=this.pluginConstructors[j];if(e){var k=new e(this._ice);this.plugins[j]=k;if(ice.dom.isset(h.settings)===true){k.setSettings(h.settings)}k.start()}}},setActivePlugin:function(d){this.activePlugin=d},getActivePlugin:function(){return this.activePlugin},_getPluginName:function(e){var f=e.toString();var g="function ".length;var d=f.substr(g,(f.indexOf("(")-g));return d},removePlugin:function(d){if(this.plugins[d]){this.plugins[d].remove()}},getPlugin:function(d){return this.plugins[d]},usePlugins:function(f,d,h){var e=this;if(ice.dom.isset(d)===true){this.pluginSets[f]=d}else{this.pluginSets[f]=[]}var g=this.pluginSets[f].concat([]);this.loadPlugins(g,function(){e._enableSet(f);if(h){h.call(this)}})},disablePlugin:function(d){this.plugins[d].disable()},isPluginElement:function(e){for(var d in this.plugins){if(this.plugins[d].isPluginElement){if(this.plugins[d].isPluginElement(e)===true){return true}}}return false},fireKeyPressed:function(g){if(this._fireKeyPressFns(g,"all_keys")===false){return false}var d=[];if(g.ctrlKey===true||g.metaKey===true){d.push("ctrl")}if(g.shiftKey===true){d.push("shift")}if(g.altKey===true){d.push("alt")}switch(g.keyCode){case 13:d.push("enter");break;case ice.dom.DOM_VK_LEFT:d.push("left");break;case ice.dom.DOM_VK_RIGHT:d.push("right");break;case ice.dom.DOM_VK_UP:d.push("up");break;case ice.dom.DOM_VK_DOWN:d.push("down");break;case 9:d.push("tab");break;case ice.dom.DOM_VK_DELETE:d.push("delete");break;default:var f;if(g.keyCode){f=g.keyCode}else{if(g.which){f=g.which}}if(f){d.push(String.fromCharCode(f).toLowerCase())}break}var h=d.sort().join("+");return this._fireKeyPressFns(g,h)},_fireKeyPressFns:function(l,m){if(this.keyPressListeners[m]){var h=this.keyPressListeners[m].length;for(var f=0;f<h;f++){var k=this.keyPressListeners[m][f];var d=k.fn;var g=k.plugin;var j=k.data;if(d){if(ice.dom.isFn(d)===true){if(d.call(g,l,j)===true){ice.dom.preventDefault(l);return false}}else{if(g[d]&&g[d].call(g,l,j)===true){ice.dom.preventDefault(l);return false}}}}}return true},fireSelectionChanged:function(d){for(var e in this.plugins){this.plugins[e].selectionChanged(d)}},fireNodeInserted:function(f,d){for(var e in this.plugins){if(this.plugins[e].nodeInserted(f,d)===false){return false}}},fireNodeCreated:function(f,e){for(var d in this.plugins){if(this.plugins[d].nodeCreated(f,e)===false){return false}}},fireCaretPositioned:function(){for(var d in this.plugins){this.plugins[d].caretPositioned()}},fireClicked:function(f){var g=true;for(var d in this.plugins){if(this.plugins[d].clicked(f)===false){g=false}}return g},fireMouseDown:function(f){var g=true;for(var d in this.plugins){if(this.plugins[d].mouseDown(f)===false){g=false}}return g},fireKeyDown:function(f){var g=true;for(var d in this.plugins){if(this.plugins[d].keyDown(f)===false){g=false}}return g},fireKeyPress:function(f){var g=true;for(var d in this.plugins){if(this.plugins[d].keyPress(f)===false){g=false}}return g},fireEnabled:function(d){for(var e in this.plugins){this.plugins[e].setEnabled(d)}},fireDisabled:function(e){for(var d in this.plugins){this.plugins[d].setDisabled(e)}},fireCaretUpdated:function(){for(var d in this.plugins){if(this.plugins[d].caretUpdated){this.plugins[d].caretUpdated()}}}};a._plugin={};a.IcePluginManager=b}).call(this.ice);(function(){var a=this,b;b=function(d){this._ice=d};b.prototype={nodeCreated:function(e,d){e.setAttribute("title",(d.action||"Modified")+" by "+e.getAttribute(this._ice.userNameAttribute)+" - "+ice.dom.date("m/d/Y h:ia",parseInt(e.getAttribute(this._ice.timeAttribute))))}};ice.dom.noInclusionInherits(b,ice.IcePlugin);a._plugin.IceAddTitlePlugin=b}).call(this.ice);(function(){var a=this,b;b=function(e){this._ice=e;this._tmpNode=null;this._tmpNodeTagName="icepaste";this._pasteId="icepastediv";var d=this;this.pasteType="formattedClean";this.preserve="p";this.beforePasteClean=function(f){return f};this.afterPasteClean=function(f){return f};e.element.oncopy=function(){return d.handleCopy.apply(d)};e.element.oncut=function(){return d.handleCut.apply(d)}};b.prototype={setSettings:function(d){d=d||{};ice.dom.extend(this,d);this.preserve+=","+this._tmpNodeTagName;this.setupPreserved()},keyDown:function(d){if(d.metaKey!==true&&d.ctrlKey!==true){return}if(d.keyCode==86){this.handlePaste()}},handleCut:function(){if(!this._ice.isTracking){return}var e=this._ice.getCurrentRange();if(e.collapsed){return}var f=e.cloneContents();var d=this;setTimeout(function(){d.doCut(f)},1);return true},doCut:function(e){var d=this._ice.getCurrentRange(),g,f;this._tmpNode=this._ice.env.document.createElement("span");d.insertNode(this._tmpNode);d.setStartAfter(this._tmpNode);d.collapse(true);while((g=e.firstChild)){d.insertNode(g);d.setStartAfter(g);d.collapse(true);f=g}d.setStartBefore(this._tmpNode);d.collapse(true);d.setEndAfter(f);this._ice.env.selection.addRange(d);this._ice.deleteContents(null,null,"cutType");ice.dom.remove(this._tmpNode)},handleCopy:function(d){},handlePaste:function(g){var d=this._ice.getCurrentRange();if(!d.collapsed){if(this._ice.isTracking){this._ice.deleteContents();d=d.cloneRange()}else{d.deleteContents();d.collapse(true)}}if(this._ice.isTracking){this._ice._moveRangeToValidTrackingPos(d)}if(d.startContainer==this._ice.element){var f=ice.dom.find(this._ice.element,this._ice.blockEl)[0];if(!f){f=ice.dom.create("<"+this._ice.blockEl+" ><br/></"+this._ice.blockEl+">");this._ice.element.appendChild(f)}d.setStart(f,0);d.collapse(true);this._ice.env.selection.addRange(d)}this._tmpNode=this._ice.env.document.createElement(this._tmpNodeTagName);d.insertNode(this._tmpNode);switch(this.pasteType){case"formatted":this.setupPaste();break;case"formattedClean":this.setupPaste(true);break}return true},setupPaste:function(e){var f=this.createDiv(this._pasteId),d=this;f.focus();f.onpaste=function(){setTimeout(function(){d.handlePasteValue(e)},1)};return true},handlePasteValue:function(k){var l=ice.dom.getHtml(document.getElementById(this._pasteId));var i=ice.dom.children("<div>"+l+"</div>",this._ice.blockEl);if(i.length===1&&ice.dom.getNodeTextContent("<div>"+l+"</div>")===ice.dom.getNodeTextContent(i)){l=ice.dom.getHtml(l)}if(k){l=this._ice.getCleanContent(l);l=this.stripPaste(l)}l=this.afterPasteClean.call(this,l);l=ice.dom.trim(l);var m=this._ice.getCurrentRange();m.setStartAfter(this._tmpNode);m.collapse(true);var h=null;var n=m.createContextualFragment(l);var r=this._ice.startBatchChange();if(ice.dom.hasBlockChildren(n)){var j=ice.dom.isChildOfTagName(this._tmpNode,this._ice.blockEl);m.setEndAfter(j.lastChild);this._ice.selection.addRange(m);var g=m.extractContents();var o=this._ice.env.document.createElement(this._ice.blockEl);o.appendChild(g);ice.dom.insertAfter(j,o);m.setStart(o,0);m.collapse(true);this._ice.selection.addRange(m);var d=m.startContainer;var q=null,h=null,f=null;while(n.firstChild){if(n.firstChild.nodeType===3&&!jQuery.trim(n.firstChild.nodeValue)){n.removeChild(n.firstChild);continue}if(ice.dom.isBlockElement(n.firstChild)){if(n.firstChild.textContent!==""){q=null;var p=null;if(this._ice.isTracking){p=this._ice.createIceNode("insertType");this._ice.addChange("insertType",[p]);h=document.createElement(n.firstChild.tagName);p.innerHTML=n.firstChild.innerHTML;h.appendChild(p)}else{p=h=document.createElement(n.firstChild.tagName);h.innerHTML=n.firstChild.innerHTML}f=p;ice.dom.insertBefore(d,h)}n.removeChild(n.firstChild)}else{if(!q){h=document.createElement(this._ice.blockEl);ice.dom.insertBefore(d,h);if(this._ice.isTracking){q=this._ice.createIceNode("insertType");this._ice.addChange("insertType",[q]);h.appendChild(q)}else{q=h}}f=q;q.appendChild(n.removeChild(n.firstChild))}}if(!o.textContent){o.parentNode.removeChild(o)}}else{if(this._ice.isTracking){h=this._ice.createIceNode("insertType",n);this._ice.addChange("insertType",[h]);m.insertNode(h);f=h}else{var e;while((e=n.firstChild)){m.insertNode(e);m.setStartAfter(e);m.collapse(true);f=e}}}this._ice.endBatchChange(r);this._cleanup(f)},createDiv:function(f){var d=ice.dom.getId(f);if(d){ice.dom.empty(d);return d}var e=this._ice.env.document.createElement("div");e.id=f;e.setAttribute("contentEditable",true);ice.dom.setStyle(e,"width","1px");ice.dom.setStyle(e,"height","1px");ice.dom.setStyle(e,"overflow","hidden");ice.dom.setStyle(e,"position","fixed");ice.dom.setStyle(e,"top","10px");ice.dom.setStyle(e,"left","10px");document.body.appendChild(e);return e},handleCut:function(){this.cutElementId="icecut";this.cutElement=this.createDiv(this.cutElementId);var e=this._ice.getCurrentRange();if(e.collapsed){return}var g=e.getHTMLContents();if(this._ice.isTracking){this._ice.deleteContents()}else{e.deleteContents()}var f=e.cloneRange();f.collapse(true);this.cutElement.innerHTML=g;e.setStart(this.cutElement.firstChild,0);e.setEndAfter(this.cutElement.lastChild,this.cutElement.lastChild.length);var d=this;setTimeout(function(){e.setStart(f.startContainer,f.startOffset);e.collapse(true);d._ice.env.selection.addRange(e);ice.dom.remove(this.cutElement)},10)},stripPaste:function(d){d=this._cleanWordPaste(d);d=this.cleanPreserved(d);return d},setupPreserved:function(){var d=this;this._tags="";this._attributesMap=[];ice.dom.each(this.preserve.split(","),function(h,g){g.match(/(\w+)(\[(.+)\])?/);var f=RegExp.$1;var e=RegExp.$3;if(d._tags){d._tags+=","}d._tags+=f.toLowerCase();d._attributesMap[f]=e.split("|")})},cleanPreserved:function(e){var f=this;var d=this._ice.env.document.createElement("div");d.innerHTML=e;d=ice.dom.stripEnclosingTags(d,this._tags);ice.dom.each(ice.dom.find(d,this._tags),function(k,l){if(ice.dom.hasClass(l,"skip-clean")){return true}var g=l.tagName.toLowerCase();var j=f._attributesMap[g];if(j[0]&&j[0]==="*"){return true}if(l.hasAttributes()){var h=l.attributes;for(var k=h.length-1;k>=0;k--){if(!ice.dom.inArray(h[k].name,j)){l.removeAttribute(h[k].name)}}}});return d.innerHTML},_cleanWordPaste:function(d){d=d.replace(/<(meta|link)[^>]+>/g,"");d=d.replace(/<!--(.|\s)*?-->/g,"");d=d.replace(/<style>[\s\S]*?<\/style>/g,"");d=d.replace(/<\/?\w+:[^>]*>/gi,"");d=d.replace(/<\\?\?xml[^>]*>/gi,"");d=this._cleanPaste(d);d=d.replace(/<(\w[^>]*) (lang)=([^ |>]*)([^>]*)/gi,"<$1$4");return d},_getListType:function(e,g){var d=ice.dom.getHtml(e);var f=null;ice.dom.foreach(g,function(h){ice.dom.foreach(g[h],function(i){ice.dom.foreach(g[h][i],function(j){if((new RegExp(g[h][i][j])).test(d)===true){f={html:d.replace(new RegExp(g[h][i][j]),""),listType:h,listStyle:i};return false}});if(f!==null){return false}});if(f!==null){return false}});return f},_cleanPaste:function(d){d=d.replace(/<b(\s+|>)/g,"<strong$1");d=d.replace(/<\/b(\s+|>)/g,"</strong$1");d=d.replace(/<i(\s+|>)/g,"<em$1");d=d.replace(/<\/i(\s+|>)/g,"</em$1");return d},_cleanup:function(d){try{d=d&&d.lastChild||d||this._tmpNode;var f=this._ice.getCurrentRange();f.setStart(d,d.length);f.collapse(true);this._ice.selection.addRange(f);if(this._ice.env.frame){this._ice.env.frame.contentWindow.focus()}else{this._ice.element.focus()}this._tmpNode.parentNode.removeChild(this._tmpNode);this._tmpNode=null;var g=this._ice.env.document.getElementsByClassName(this._ice.changeTypes.insertType.alias);for(var h=0;h<g.length;h++){if(!g[h].textContent){if(g[h].parentNode){g[h].parentNode.removeChild(g[h])}}}}catch(j){window.console&&console.error(j)}}};ice.dom.noInclusionInherits(b,ice.IcePlugin);a._plugin.IceCopyPastePlugin=b}).call(this.ice);(function(){var a=this,d=this.ice;var b=function(e){this._ice=e};b.prototype={convert:function(f){var e=this;d.dom.each(f.getElementsByTagName(this._ice.blockEl),function(g,h){var j=[];try{e._ice.placeholdDeletes();e._convertBlock(h)}catch(k){console.error(k)}finally{e._ice.revertDeletePlaceholders()}})},_convertBlock:function(f){if(f.textContent.length<2){return}var u="'";var x='"';var g=String.fromCharCode(8216);var t=String.fromCharCode(8217);var i=String.fromCharCode(8220);var w=String.fromCharCode(8221);var r=function(e){return/\d/.test(e)};var v=function(e){return/\w/.test(e)};var y=function(e){return e===String.fromCharCode(160)||e===String.fromCharCode(32)};var p=function(e){return !y(e)};var m=function(e){return e===x||e===i||e===w};var k=function(e){return e===u||e===g||e===t};var n=this._ice.selection.createRange();var l=f.cloneNode(true);n.setStart(l,0);n.collapse(true);var z=[],h=null,q=null,o=null,j=0;while(true){try{n.moveEnd("character",1);z.push(n.cloneContents().textContent.charAt(j++))}catch(s){break}}for(j=0;j<=z.length;j++){h=q;q=o;o=z.length===j?null:z[j];switch(q){case g:case t:this.replaceCharAtPosition(u,j,f);case u:if((h===null||y(h))&&(r(o)&&r(z[j+1])&&y(z[j+2]))){this.replaceCharAtPosition(t,j,f)}else{if(h===null||(y(h)&&p(o))){this.replaceCharAtPosition(g,j,f)}else{if(o===null||(p(h)&&y(o))){this.replaceCharAtPosition(t,j,f)}else{if(v(h)&&v(o)){this.replaceCharAtPosition(t,j,f)}}}}break;case i:case w:this.replaceCharAtPosition(x,j,f);case x:if(h===null||(y(h)&&p(o))){this.replaceCharAtPosition(i,j,f)}else{if(o===null||(p(h)&&y(o))){this.replaceCharAtPosition(w,j,f)}else{if((h===null||y(h))&&(y(o)&&k(z[j+1]))){this.replaceCharAtPosition(i,j,f)}else{if((o===null||y(o))&&(y(h)&&k(z[j-3]))){this.replaceCharAtPosition(w,j,f)}}}}break}}},replaceCharAtPosition:function(j,i,g){var f=this._ice.selection.createRange();f.setStart(g,0);while(i-->1){f.moveStart("character",1)}try{f.moveStart("character",1);f.moveStart("character",-1)}catch(h){}f.collapse(true);f.moveEnd("character",1);f.extractContents();this._ice.insert(j,f)}};d.dom.noInclusionInherits(b,d.IcePlugin);a.ice._plugin.IceSmartQuotesPlugin=b}).call(this);(function(){var b=this;var a=function(d){this._ice=d};a.prototype={keyDown:function(d){if(ice.dom.isBrowser("mozilla")){if(d.keyCode===109){return this.convertEmdash(d)}}else{if(d.keyCode===189){return this.convertEmdash(d)}}return true},convertEmdash:function(i){var f=this._ice.getCurrentRange();if(f.collapsed){try{f.moveStart(ice.dom.CHARACTER_UNIT,-1);var h=ice.dom.getParents(f.startContainer,this._ice.blockEl)[0];var d=ice.dom.getParents(f.endContainer,this._ice.blockEl)[0];if(h===d&&!this._ice.getIceNode(f.startContainer,"deleteType")){c=f.toHtml();if(c==="-"){f.extractContents();f.collapse();var g=this._ice.env.document.createTextNode("\u2014");this._ice._insertNode(g,f);f=this._ice.getCurrentRange();f.moveStart(ice.dom.CHARACTER_UNIT,1);f.collapse(true);this._ice.env.selection.addRange(f);return false}}}catch(i){}f.collapse()}return true}};ice.dom.noInclusionInherits(a,ice.IcePlugin);b._plugin.IceEmdashPlugin=a}).call(this.ice);
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ice-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - D. LoBraico
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: railties
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.1.0
30
+ description: The NYTimes's track changes library for the Rails 3 asset pipeline.
31
+ email:
32
+ - dj@lobraico.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - Gemfile
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - ice-LICENSE
42
+ - ice-NOTICE
43
+ - ice-rails.gemspec
44
+ - lib/ice-rails.rb
45
+ - lib/ice-rails/version.rb
46
+ - vendor/assets/javascripts/ice.min.js
47
+ homepage: https://github.com/pygatea/ice-rails
48
+ licenses: []
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 1.8.21
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: ice for rails
71
+ test_files: []