varwysihtml5={version:"0.3.0",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,DELETE_KEY:46};window.rangy=function(){functiona(a,b){varc=typeofa[b];returnc==j||!(c!=i||!a[b])||"unknown"==c}functionb(a,b){return!(typeofa[b]!=i||!a[b])}functionc(a,b){returntypeofa[b]!=k}functiond(a){returnfunction(b,c){for(vard=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}functione(a){returna&&p(a,o)&&r(a,n)}functionf(a){window.alert("Rangy not supported in your browser. Reason: "+a),s.initialized=!0,s.supported=!1}functiong(){if(!s.initialized){varc,d=!1,g=!1;for(a(document,"createRange")&&(c=document.createRange(),p(c,m)&&r(c,l)&&(d=!0),c.detach()),(c=b(document,"body")?document.body:document.getElementsByTagName("body")[0])&&a(c,"createTextRange")&&(c=c.createTextRange(),e(c)&&(g=!0)),!d&&!g&&f("Neither Range nor TextRange are implemented"),s.initialized=!0,s.features={implementsDomRange:d,implementsTextRange:g},d=u.concat(t),g=0,c=d.length;c>g;++g)try{d[g](s)}catch(h){b(window,"console")&&a(window.console,"log")&&window.console.log("Init listener threw an exception. Continuing.",h)}}}functionh(a){this.name=a,this.supported=this.initialized=!1}vari="object",j="function",k="undefined",l="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer START_TO_START START_TO_END END_TO_START END_TO_END".split(" "),m="setStart setStartBefore setStartAfter setEnd setEndBefore setEndAfter collapse selectNode selectNodeContents compareBoundaryPoints deleteContents extractContents cloneContents insertNode surroundContents cloneRange toString detach".split(" "),n="boundingHeight boundingLeft boundingTop boundingWidth htmlText text".split(" "),o="collapse compareEndPoints duplicate getBookmark moveToBookmark moveToElementText parentElement pasteHTML select setEndPoint getBoundingClientRect".split(" "),p=d(a),q=d(b),r=d(c),s={version:"1.2.2",initialized:!1,supported:!0,util:{isHostMethod:a,isHostObject:b,isHostProperty:c,areHostMethods:p,areHostObjects:q,areHostProperties:r,isTextRange:e},features:{},modules:{},config:{alertOnWarn:!1,preferTextRange:!1}};s.fail=f,s.warn=function(a){a="Rangy warning: "+a,s.config.alertOnWarn?window.alert(a):typeofwindow.console!=k&&typeofwindow.console.log!=k&&window.console.log(a)},{}.hasOwnProperty?s.util.extend=function(a,b){for(varcinb)b.hasOwnProperty(c)&&(a[c]=b[c])}:f("hasOwnProperty not supported");vart=[],u=[];s.init=g,s.addInitListener=function(a){s.initialized?a(s):t.push(a)};varv=[];s.addCreateMissingNativeApiListener=function(a){v.push(a)},s.createMissingNativeApi=function(a){a=a||window,g();for(varb=0,c=v.length;c>b;++b)v[b](a)},h.prototype.fail=function(a){throwthis.initialized=!0,this.supported=!1,Error("Module '"+this.name+"' failed to load: "+a)},h.prototype.warn=function(a){s.warn("Module "+this.name+": "+a)},h.prototype.createError=function(a){returnError("Error in Rangy "+this.name+" module: "+a)},s.createModule=function(a,b){varc=newh(a);s.modules[a]=c,u.push(function(a){b(a,c),c.initialized=!0,c.supported=!0})},s.requireModules=function(a){for(varb,c,d=0,e=a.length;e>d;++d){if(c=a[d],b=s.modules[c],!(b&&binstanceofh))throwError("Module '"+c+"' not found");if(!b.supported)throwError("Module '"+c+"' not supported")}};varw=!1,q=function(){w||(w=!0,s.initialized||g())};if(typeofwindow==k)f("No window found");else{if(typeofdocument!=k)returna(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",q,!1),a(window,"addEventListener")?window.addEventListener("load",q,!1):a(window,"attachEvent")?window.attachEvent("onload",q):f("Window does not have required addEventListener or attachEvent method"),s;f("No document found")}}(),rangy.createModule("DomUtil",function(a,b){functionc(a){for(varb=0;a=a.previousSibling;)b++;returnb}functiond(a,b){varc,d=[];for(c=a;c;c=c.parentNode)d.push(c);for(c=b;c;c=c.parentNode)if(p(d,c))returnc;returnnull}functione(a,b,c){for(c
try{d.add(c)}catch(f){throwError("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)")}}d.select(),j(a)}functionn(a,b){if(a.anchorNode&&r.getDocument(a.anchorNode)!==r.getDocument(b))thrownewv("WRONG_DOCUMENT_ERR")}functiono(a){varb=[],c=neww(a.anchorNode,a.anchorOffset),d=neww(a.focusNode,a.focusOffset),e="function"==typeofa.getName?a.getName():"Selection";if("undefined"!=typeofa.rangeCount)for(varf=0,g=a.rangeCount;g>f;++f)b[f]=t.inspect(a.getRangeAt(f));return"["+e+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+d.inspect()+"]"}a.requireModules(["DomUtil","DomRange","WrappedRange"]),a.config.checkSelectionRanges=!0;varp,q,r=a.dom,s=a.util,t=a.DomRange,u=a.WrappedRange,v=a.DOMException,w=r.DomPosition,x=a.util.isHostMethod(window,"getSelection"),y=a.util.isHostObject(document,"selection"),z=y&&(!x||a.config.preferTextRange);z?(p=d,a.isSelectionValid=function(a){vara=(a||window).document,b=a.selection;return"None"!=b.type||r.getDocument(b.createRange().parentElement())==a}):x?(p=c,a.isSelectionValid=function(){return!0}):b.fail("Neither document.selection or window.getSelection() detected."),a.getNativeSelection=p;varx=p(),A=a.createNativeRange(document),B=r.getBody(document),C=s.areHostObjects(x,s.areHostProperties(x,["anchorOffset","focusOffset"]));a.features.selectionHasAnchorAndFocus=C;varD=s.isHostMethod(x,"extend");a.features.selectionHasExtend=D;varE="number"==typeofx.rangeCount;a.features.selectionHasRangeCount=E;varF=!1,G=!0;s.areHostMethods(x,["addRange","getRangeAt","removeAllRanges"])&&"number"==typeofx.rangeCount&&a.features.implementsDomRange&&function(){vara=document.createElement("iframe");B.appendChild(a);varb=r.getIframeDocument(a);b.open(),b.write("<html><head></head><body>12</body></html>"),b.close();varc=r.getIframeWindow(a).getSelection(),d=b.documentElement.lastChild.firstChild,b=b.createRange();b.setStart(d,1),b.collapse(!0),c.addRange(b),G=1==c.rangeCount,c.removeAllRanges();vare=b.cloneRange();b.setStart(d,0),e.setEnd(d,2),c.addRange(b),c.addRange(e),F=2==c.rangeCount,b.detach(),e.detach(),B.removeChild(a)}(),a.features.selectionSupportsMultipleRanges=F,a.features.collapsedNonEditableSelectionsSupported=G;varH,I=!1;B&&s.isHostMethod(B,"createControlRange")&&(H=B.createControlRange(),s.areHostProperties(H,["item","add"])&&(I=!0)),a.features.implementsControlRange=I,q=C?function(a){returna.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){returna.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};varJ;if(s.isHostMethod(x,"getRangeAt")?J=function(a,b){try{returna.getRangeAt(b)}catch(c){returnnull}}:C&&(J=function(b){varc=r.getDocument(b.anchorNode),c=a.createRange(c);returnc.setStart(b.anchorNode,b.anchorOffset),c.setEnd(b.focusNode,b.focusOffset),c.collapsed!==this.isCollapsed&&(c.setStart(b.focusNode,b.focusOffset),c.setEnd(b.anchorNode,b.anchorOffset)),c}),a.getSelection=function(a){vara=a||window,b=a._rangySelection,c=p(a),e=y?d(a):null;returnb?(b.nativeSelection=c,b.docSelection=e,b.refresh(a)):(b=newl(c,e,a),a._rangySelection=b),b},a.getIframeSelection=function(b){returna.getSelection(r.getIframeWindow(b))},H=l.prototype,!z&&C&&s.areHostMethods(x,["removeAllRanges","addRange"])){H.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),f(this)};varK=function(b,c){vard=t.getRangeDocument(c),d=a.createRange(d);d.collapseToPoint(c.endContainer,c.endOffset),b.nativeSelection.addRange(g(d)),b.nativeSelection.extend(c.startContainer,c.startOffset),b.refresh()};H.addRange=E?function(b,c){if(I&&y&&"Control"==this.docSelection.type)k(this,b);elseif(c&&D)K(this,b);else{vard;F?d=this.rangeCount:(this.removeAllRanges(),d=0),this.nativeSelection.addRange(g(b)),this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==d+1?(a.config.checkSelectionRanges&&(d=J(this.nativeSelection,this.rangeCount-1))&&!t.rangesEqual(d,b)&&(b=newu(d)),this._ranges[this.rangeCount-1]=b,e(this,b,N(this.nativeSelection)),this.isCollapsed=q(this)):this.refresh()}}: