(this["webpackJsonpreact-typescript"]=this["webpackJsonpreact-typescript"]||[]).push([[0],{58:function(t,e,n){},62:function(t,e,n){"use strict";n.r(e);var a=n(4),r=n(31),c=n(10),s=n(5),o=n(8),i=n(32),l=n(21);n(58);function u(t,e,n,a,r,c){var s,o,i,l;0!=a&&r!==t[n].text.length?(s=t[e].text.substring(0,a),o=t[n].text.substring(r,t[n].text.length),l={text:s,annotated:t[e].annotated},i={text:o,annotated:t[n].annotated},e==n?t[e].text=t[e].text.substring(a,r):(console.log(l,i),t[e].text=t[e].text.substring(a,t[e].text.length),t[n].text=t[n].text.substring(0,r)),t.splice(e,0,l),t.splice(n+2,0,i),e+=1,n+=2):0==a&&r!=t[n].text.length?(i={text:o=t[n].text.substring(r,t[n].text.length),annotated:t[n].annotated},t[n].text=t[n].text.substring(0,r),t.splice(n+1,0,i),n+=1):r==t[n].text.length&&0!=a&&(l={text:s=t[e].text.substring(0,a),annotated:t[e].annotated},t[e].text=t[e].text.substring(0,r),e+=1,n+=1),t[e].annotated=c,t[n-1].annotated=c;for(var u=t[e].text,d=e+1;d<n;d++)u=u.concat(t[d].text);return t.splice(e,n-e),t.splice(e,0,{text:u,annotated:c}),console.log("Accumulator value :",u),console.log("Data value :",t),t}var d=n(11),b={42:"#ebde34",0:"transparent",1:"#80B900",2:"#0080B9",3:"#FF0000"};var x=function(t){return Object(d.jsx)("span",{style:{backgroundColor:b[t.score],borderRadius:"0.3rem",padding:"0.2rem"},children:t.text})},j=n(76),p=n(74),f=n(75),g=(n(60),function(t){console.log(t);return t.match(/span\[(\d+)\]/)[1]-1});var O=Object(l.b)((function(t){var e=Object(a.useState)(t.args.data),n=Object(o.a)(e,2),r=n[0],b=n[1],O=Object(j.a)(),h=Object(o.a)(O,2),m=h[0],v=h[1],S=Object(a.useState)({x:0,y:0}),C=Object(o.a)(S,2),y=C[0],k=C[1],E=Object(a.useState)({startSpan:0,endSpan:0,start:0,end:0}),B=Object(o.a)(E,2),F=B[0],R=B[1],V=function(t){var e=function(){var e,n=document.getSelection();if(n&&""!==n.toString()){var a=n.getRangeAt(0),r=document.getElementById("root"),c=null;if(r&&(c=Object(i.fromRange)(a,r)),c)try{var s=function(t){var e=t.startOffset,n=t.endOffset,a=t.start;a=a.replace(/\(|\)/g,"");var r=t.end;return{startOffset:e,endOffset:n,startContainer:a,endContainer:r=r.replace(/\(|\)/g,"")}}(c),o=s.startOffset,l=s.endOffset,u=s.startContainer,d=s.endContainer;e={start:o,end:l,startSpan:g(u),endSpan:g(d)}}catch(t){console.error("User highlight failed.")}}return e}();e&&(k({x:t.pageX,y:t.pageY}),v(!0),R(e))};return Object(a.useEffect)((function(){l.a.setFrameHeight(1e3)})),Object(a.useEffect)((function(){return document.addEventListener("mouseup",V),function(){document.removeEventListener("mouseup",V)}}),[]),Object(d.jsxs)(d.Fragment,{children:[r&&Object(d.jsx)("p",{className:"Paragraph",children:r.map((function(t,e){return Object(d.jsx)(x,{text:t.text,score:t.annotated},e)}))}),Object(d.jsxs)(p.a,Object(c.a)(Object(c.a)({},m),{},{anchorPoint:y,onClose:function(){return v(!1)},children:[Object(d.jsx)(f.a,{onClick:function(t){b(Object(s.a)(u(r,F.startSpan,F.endSpan,F.start,F.end,0))),l.a.setComponentValue(r)},children:"lvl 0"}),Object(d.jsx)(f.a,{onClick:function(t){b(Object(s.a)(u(r,F.startSpan,F.endSpan,F.start,F.end,1))),l.a.setComponentValue(r)},children:"lvl 1"}),Object(d.jsx)(f.a,{onClick:function(t){b(Object(s.a)(u(r,F.startSpan,F.endSpan,F.start,F.end,2))),l.a.setComponentValue(r)},children:"lvl 2"}),Object(d.jsx)(f.a,{onClick:function(t){b(Object(s.a)(u(r,F.startSpan,F.endSpan,F.start,F.end,3))),l.a.setComponentValue(r)},children:"lvl 3"})]}))]})})),h=n(73),m=n(35),v=n(72),S=n(63),C=new h.a,y=document.getElementById("root");r.createRoot(y).render(Object(d.jsx)(a.StrictMode,{children:Object(d.jsx)(m.a,{value:C,children:Object(d.jsx)(v.a,{theme:S.a,children:Object(d.jsx)(O,{})})})}))}},[[62,1,2]]]);
//# sourceMappingURL=main.81712d14.chunk.js.map