");return[n,t.join("")]},resurrectText=(e,t)=>{for(var n=0;n",t[n]);return e},getStc=o=>{var a=500;if(o.split("").length<=a)return[o];{for(var[o,s]=encodePunc(o),i=s.split("<#*/>"),c=0;ca){let e=i[c].split(" "),t="",n=[];for(var p=0;p"),t=[],n=0,l="",r=(e=(e=resurrectText(e=(e=e.replaceAll(";<#*/>","<#*/>")).replaceAll("<#*/>;","<#*/>"),o)).replaceAll(" "," ")).split("");for(c=0;c{if(l.split("").length<=500)return[l];{let e=(l=l.replaceAll("...","etc")).split(".").filter(e=>""!==e.trim()),t=[],n="";for(var r=0;r{var t=await navigator.clipboard.readText();document.getElementById("input").focus(),document.getElementById("input").textContent=t};var diffArr=[];async function onRephrase(o){if(document.getElementById("input").textContent=document.getElementById("input").textContent.trim(),""===document.getElementById("choosen").value)alert("Please choose a rephrasing mode!");else{var a=document.getElementById("choosen").value;let d=document.getElementById("input").textContent;if(d.split(" ").length<6)alert("Minimum 6 words!");else{let p=(d.match(/[^.?!]+[.!?]+[\])'"`’”]*/g)||[]).filter(e=>""!==e.trim()),e=(0===p.length&&(p=[d]),diffArr=[],document.getElementById("diff").textContent="",document.getElementById("output").innerHTML="",document.getElementById("copyText").style.display="none",13*Math.ceil(d.split("").length/500)),n=document.getElementById("choosen").value,l=("rich"===n&&(e*=2),startTimer(e,null)),r=(showPb(e),!0);for(var m=0;me.text()).then(e=>JSON.parse(e)[1]).catch(e=>(console.log(e),"")):t)&&(e.input=t),await fetch("https://paraphrase.quilltools.com/v1",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.text()).then(e=>{e=JSON.parse(e);document.getElementById("copyText").style.display="flex";let t=e[0],n=e[0];t=(t=(t=t.replace(/.*<\/ins>/g,"")).replace(//g,""),n=(n=(n=n.replace(/.*<\/del>/g,"")).replace(//g,"");var l=document.createElement("div");l.innerHTML=e[0],l.style.display="none",document.getElementById("output").append(l);let r=l.querySelectorAll("del");for(let e=r.length-1;0<=e;e--)r[e].remove();r=l.querySelectorAll("ins"),l.innerHTML=l.innerHTML.split(" ").map(e=>e=e.includes("")?''+e.replace(//g,"").replace(/<\/ins>/g,"").replace(//g,"").replace(/<\/span>/g,"")+"":e).filter(e=>""!==e.trim()).join(" ");let o=0,a=p[m].split(" ");a.filter(e=>""!==e.trim()).length;for(let e=0;e""!==e.trim()).length),s=(document.getElementById("diff").textContent=e,[]);for(let e=6;e<=14;e++)s.push(5*e);document.getElementById("struct").textContent=s[Math.floor(Math.random()*s.length)];var e=l.innerHTML,i=(l.remove(),document.getElementById("input").innerHTML),c=d.indexOf(p[m].trim());"\n"===i[c-1]&&"\n"!==i[c-2]?document.getElementById("output").innerHTML+="
"+e:"\n"===i[c-1]&&"\n"===i[c-2]?document.getElementById("output").innerHTML+="
"+e:document.getElementById("output").innerHTML+=" "+e}).catch(e=>{console.log(e),alert("Unexpected error! Please retry the current operation by clicking again on the button."),r=!1,clearInterval(l)})}hidePb(),clearInterval(l)}}}