"use strict";const Selection=function(){function a(a){let b=document.createElement("textarea");b.style.position="fixed",b.style.top=0,b.style.left=0,b.style.width="2em",b.style.height="2em",b.style.padding=0,b.style.border="none",b.style.outline="none",b.style.boxShadow="none",b.style.background="transparent",b.value=a,document.body.appendChild(b),b.focus(),b.select();try{let a=document.execCommand("copy"),b=a?"successful":"unsuccessful";console.log("Copying text command was "+b)}catch(a){console.log("Oops, unable to copy")}document.body.removeChild(b)}function b(a,b="_blank",c=screen.width/2,d=screen.height/2){let e=screen.width/2-c/2,f=screen.height/2-d/2;return window.open(a,b,"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, noopener=yes, noreferrer=yes, width="+c+", height="+d+", top="+f+", left="+e)}function c(){let a=navigator.language||navigator.userLanguage||function(){const a=navigator.languages;if(0{S[c]&&(a.appendChild(s.apply(R[c])),b++)}),S.customActions.forEach(c=>{void 0!==c.icon&&(a.appendChild(s.apply(c)),b++)}),{icons:a,length:b}}function u(){const a=D.getRangeAt(0).getBoundingClientRect(),b=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;a.top>=M*J?(N=a.top+b-43*J,Q=!0):(N=a.top+b+(a.height+K)*J,Q=!1);const c=(M+L/1.5)*I.length;O=a.left+(a.width-c)/2,0>O?(P=-O,O=0,console.log("A",P)):O+c+2>window.screen.width?(P=window.screen.width-(O+c+2),O+=P,console.log("B",P)):P=0}function v(){u();let a=document.querySelector(".selection");a.style.top=`${N}px`,a.style.left=`${O}px`}function w(){I=t(),u();const a=document.createElement("div");a.className="selection",a.style="line-height:0;position:absolute;background-color:"+F+";border-radius:20px;top:"+N+"px;left:"+O+"px;transition:all .2s ease-in-out;box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);z-index:99999;opacity:"+H+";scale:"+J+";",a.animate([{transform:"translateY(100%) scale(0)"},{transform:"translateY(0) scale(100%)"}],{duration:200}),a.appendChild(I.icons);const b=document.createElement("div");console.log(P),b.style="position:absolute;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid "+F+";"+(Q?"bottom:-4px;":"top:-4px;transform:rotate(180deg);")+"left:"+(P?(0>P?-P+M*(I.length+3)/2:-P/2+M*I.length/2+K)+"px;":"50%;")+"width:0;height:0;scale:"+J+";",a.appendChild(b),document.body.appendChild(a),window.addEventListener("keydown",x)}function x(a){setTimeout(function b(){switch(a.keyCode){case 27:y();case 9:{const a=document.querySelector(".selection"),b=a.getElementsByTagName("button"),c=document.querySelector(":focus");Array.from(b).some(a=>c===a)||z()}}},10)}function y(){document.querySelector(".selection").remove(),window.removeEventListener("keydown",x)}function z(){const a=document.querySelector(".selection");a.getElementsByTagName("button")[0].focus()}function A(){function a(){return!!window.getSelection().toString()}function b(){return!!document.querySelector(".selection")}function c(){return D=window.getSelection(),E=D.toString(),E}window.addEventListener("mouseup",function(){setTimeout(function d(){if(S.disable)return void(b()&&y());if(b()){if(a())return c(),void v();y()}a()&&(c(),w())},10)},!1)}function B(a){return Object.keys(a).forEach(b=>{S.hasOwnProperty(b)?S[b]=void 0===a[b]?S[b]:a[b]:"backgroundColor"===b?F=a[b]||"#dc143c":"iconColor"===b?G=a[b]||"#ffffff":"scale"===b?J="undefined"!=typeof a[b]&&isFinite(a[b])?a[b]:1:"opacity"===b?H="undefined"!=typeof a[b]&&isFinite(a[b])?a[b]:1:console.log("Option not recognized: "+b)}),this}function C(){return r(),A(),this}let D="",E="",F="#dc143c",G="#ffffff",H=1,I={},J=1;let K=5,L=14,M=24+L,N=0,O=0,P=0,Q=!0;const R={twitter:{url:"https://twitter.com/intent/tweet?text=",title:"Twitter",onClick:f,icon:""},facebook:{url:"https://www.facebook.com/sharer/sharer.php?quote=",title:"Facebook",onClick:e,icon:""},search:{url:"https://www.google.co.in/search?q=",title:"Search",onClick:g,icon:""},copy:{title:"Copy",onClick:h,icon:""},speak:{title:"Speak",onClick:i,icon:""},translate:{url:"https://translate.google.com/#auto/",title:"Translate",onClick:j,icon:""},dictionary:{enurl:"https://dictionary.cambridge.org/dictionary/english/",esurl:"https://dle.rae.es/",frurl:"https://www.linguee.com/english-french/search?source=french&query=",zhurl:"https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=0&wdqb=",hiurl:"https://www.shabdkosh.com/search-dictionary?lc=hi&sl=en&tl=hi&e=",arurl:"http://www.baheth.info/all.jsp?term=",msurl:"https://glosbe.com/ms/ms/",ruurl:"https://en.openrussian.org/ru/",bnurl:"http://www.english-bangla.com/bntobn/index/",pturl:"https://pt.thefreedictionary.com/",title:"Dictionary",onClick:k,icon:""},image:{url:"https://www.google.com/search?tbm=isch&q=",title:"Image Search",onClick:m,icon:""},map:{url:"https://www.google.com/maps/search/?api=1&query=",title:"Search on map",onClick:n,icon:""},github:{url:"https://github.com/search?q=",title:"Search on GitHub",onClick:o,icon:""},email:{url:"mailto:?",title:"Send by e-mail",onClick:p,icon:""},print:{title:"Print",onClick:q,icon:""}},S=Object.fromEntries([...Object.keys(R).map(a=>[a,!0]),["disable",!1],["customActions",[]]]);return{config:B,init:C}}}();