text: "use strict";function isCollapsed(e,t,n,o){return e===n&&t===o}function getIEOffsets(e){var t=document.selection,n=t.createRange(),o=n.text.length,s=n.duplicate();s.moveToElementText(e);s.setEndPoint("EndToStart",n);var r=s.text.length,a=r+o;return{start:r,end:a}}function getModernOffsets(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount){return null}var n=t.anchorNode,o=t.anchorOffset,s=t.focusNode,r=t.focusOffset,a=t.getRangeAt(0);try{a.startContainer.nodeType;a.endContainer.nodeType}catch(e){return null}var f=isCollapsed(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),d=f?0:a.toString().length,c=a.cloneRange();c.selectNodeContents(e);c.setEnd(a.startContainer,a.startOffset);var i=isCollapsed(c.startContainer,c.startOffset,c.endContainer,c.endOffset),l=i?0:c.toString().length,g=l+d,u=document.createRange();u.setStart(n,o);u.setEnd(s,r);var O=u.collapsed;return{start:O?g:l,end:O?l:g}}function setIEOffsets(e,t){var n,o,s=document.selection.createRange().duplicate();if(void 0===t.end){n=t.start;o=n}else{if(t.start>t.end){n=t.end;o=t.start}else{n=t.start;o=t.end}}s.moveToElementText(e);s.moveStart("character",n);s.setEndPoint("EndToStart",s);s.moveEnd("character",o-n);s.select()}function setModernOffsets(e,t){if(window.getSelection){var n=window.getSelection(),o=e[getTextContentAccessor()].length,s=Math.min(t.start,o),r=void 0===t.end?s:Math.min(t.end,o);if(!n.extend&&s>r){var a=r;r=s;s=a}var f=getNodeForCharacterOffset(e,s),d=getNodeForCharacterOffset(e,r);if(f&&d){var c=document.createRange();c.setStart(f.node,f.offset);n.removeAllRanges();if(s>r){n.addRange(c);n.extend(d.node,d.offset)}else{c.setEnd(d.node,d.offset);n.addRange(c)}}}}var ExecutionEnvironment=require("fbjs/lib/ExecutionEnvironment"),getNodeForCharacterOffset=require("./getNodeForCharacterOffset"),getTextContentAccessor=require("./getTextContentAccessor"),useIEOffsets=ExecutionEnvironment.canUseDOM&&"selection"in document&&!("getSelection"in window),ReactDOMSelection={getOffsets:useIEOffsets?getIEOffsets:getModernOffsets,setOffsets:useIEOffsets?setIEOffsets:setModernOffsets};module.exports=ReactDOMSelection;