window.addEventListener("load",(function(){var e="255,255,0",t=[],a="",n=null,r=[],i=null,o="",l=[],d=[],s=!1,c=null,p=!1,u=!1,h=0,g=0,m=0,f=0,v=null,y=null,x=0,w="",b="",S="",L=null,q=1,A=!1,C=!0,E="",I=null,P=!1,k="",T={"zh-cn":{page:"页"},zn:{page:"Page"}};function M(e){let t=[];for(let a of e)a=a.charCodeAt(0),t.push(String.fromCharCode(a>>8)),t.push(String.fromCharCode(255&a));return"þÿ"+t.join("")}Element.prototype.hasClass=function(e){return this.classList.contains(e)};let V='',z='';document.querySelector(".icon-toggle"),document.querySelector(".viewerSider"),document.querySelector(".icon-zoomIn"),document.querySelector(".icon-zoomOut");var N=document.querySelector(".annotate-menu"),O=document.querySelector(".viewerSiderAnnotate"),R=document.querySelector(".icon-createImage");document.querySelector(".icon-info");let D=document.getElementById("viewerContainer");$("body").on("click","#viewThumbnail",(function(){$(".viewerSiderAnnotate").addClass("hidden"),$("#thumbnailView").removeClass("hidden"),$("#outlineView").addClass("hidden"),$("#showAnnotation").removeClass("toggled")})),$("body").on("click","#viewOutline",(function(){$(".viewerSiderAnnotate").addClass("hidden"),$("#thumbnailView").addClass("hidden"),$("#outlineView").removeClass("hidden"),$("#showAnnotation").removeClass("toggled")})),$("body").on("click","#showAnnotation",(function(){$(".viewerSiderAnnotate").removeClass("hidden"),$("#thumbnailView").addClass("hidden"),$("#outlineView").addClass("hidden"),$("#viewThumbnail").removeClass("toggled"),$("#viewOutline").removeClass("toggled"),$(this).addClass("toggled"),Z()})),N.onclick=i=>{var o=i.target.closest(".annoate-btn");if(o){var l=o.getAttribute("title");if("highlight"==l)if(e=o.getAttribute("data-color"),n){var d=n.getAttribute("data-id");document.querySelectorAll(`.mm-highlight[data-id="${d}"]`).forEach((t=>{t&&(t.style.backgroundColor=`rgb(${e})`)})),t.forEach((t=>{if(t.id==d){var a=JSON.parse(t.text),n=e.split(",");a.color={r:n[0],g:n[1],b:n[2]},t.text=JSON.stringify(a)}})),G()}else U();else if("comment"==l);else if("delete annotate"==l)n&&function(){if(n){var e=n.getAttribute("data-id");t.forEach(((a,n)=>{a.id==e&&t.splice(n,1)})),document.querySelectorAll(`.mm-highlight[data-id="${e}"]`).forEach((e=>{e&&e.parentElement&&e.parentElement.removeChild(e)})),G()}}();else if("copy text"==l){if(n){var s="";"highlight"==n.getAttribute("data-type")&&(s=n.getAttribute("data-text"))}else if(P||p)s=F.selectText;else s=B.current[0].text;window.parent.postMessage({type:"copyText",text:s,_viewMark:a},"*"),F={},B={},r.length&&(r.forEach((e=>{e.parentElement&&e.parentElement.removeChild(e)})),r=[])}N.style.display="none",n=null,!1,r=[]}},R.onclick=()=>{s=!s},document.onkeydown=function(t){var a=t.altKey,n=t.ctrlKey||t.metaKey;(!n&&!a||"y"!=t.key&&"Y"!=t.key||(e="247,255,0",U()),!n&&!a||"g"!=t.key&&"G"!=t.key||(e="125,240,102",U()),!n&&!a||"b"!=t.key&&"B"!=t.key||(e="143,222,249",U()),!a||"p"!=t.key&&"P"!=t.key||(e="247,153,209",U()),!n&&!a||"r"!=t.key&&"R"!=t.key||(e="253,73,73",U()),!n&&!a||"i"!=t.key&&"I"!=t.key||(s=!s),!n||"c"!=t.key&&"C"!=t.key)||(r=document.querySelector(".annoate-btn.copy"))&&r.click();var r,i=t.key.toLowerCase();!n&&!a||"delete"!=i&&"backspace"!=i||(r=document.querySelector(".annoate-btn.delete"))&&r.click()},O.onclick=e=>{var t=e.target.closest(".annotate-item");if(t){var a=t.getAttribute("data-id"),i=document.querySelector(".annotate-item.active");if(i){if(e.target.closest(".annotate-item-note"))return;i.classList.remove("active"),i.querySelector(".annotate-item-note").blur(),i.querySelector(".annotate-item-note").setAttribute("contenteditable",!1)}var o=document.querySelector(`.annotate-item[data-id="${a}"]`);o&&o.classList.add("active"),o.querySelector(".annotate-item-note").setAttribute("contenteditable",!0),N.style.display="none",n=null,!1,r=[],B={},oe(a)}},window.addEventListener("message",(function(e){switch(e.data.type){case"openPDF":e.data._viewMark&&(a=e.data._viewMark);try{w=e.data.pdfName,b=e.data.basename,t=e.data.annotations,e.data.openProtocol,o=e.data.id,A=e.data.isMobile,S=e.data.mdPath,E=e.data.imageFolder,k=e.data.language,e.data.top&&(x=e.data.top),e.data.bottom&&(x=e.data.bottom),Z(),C&&(A?(D.addEventListener("touchstart",J),D.addEventListener("touchmove",Y),D.addEventListener("touchend",j),D.addEventListener("mousedown",J),D.addEventListener("mousemove",Y),D.addEventListener("mouseup",j)):(D.addEventListener("mousedown",J),D.addEventListener("mousemove",Y),D.addEventListener("mouseup",j)),C=!1),setTimeout((function(){PDFViewerApplication&&(PDFViewerApplication.open(e.data.data).then((()=>{try{window.pdfViewer=PDFViewerApplication.pdfViewer,window.extractor=new Extractor(pdfViewer),pdfViewer._currentPage=1,PDFViewerApplication.pdfDocument.getData().then((e=>{A||(I=new pdfAnnotate.AnnotationFactory(e)),pdfViewer.currentScaleValue="page-width"})),e.data.id&&oe(e.data.id)}catch(e){}})).catch((function(e){})),PDFViewerApplication.eventBus.on("pagerendered",re))}),1e3)}catch(e){}break;case"closePDF":break;case"showAnnotate":oe(e.data.id);break;case"exportAnnotatePDF":var n=document.querySelector("#viewer .page").clientWidth,r=(new Date,null);setTimeout((()=>{t.forEach((e=>{var t=JSON.parse(e.text);if(I){1!=q&&I.deleteAnnotation(t.id);var a=t.relateRect,r={page:t.page,rect:t.rect,contents:M(t.contents||""),author:"",color:t.color,opacity:.8,id:t.id,quadPoints:[],fill:"",font:"Noto Sans CJK SC Medium"};if(a.forEach((e=>{var a=parseInt(e.x*n+""),i=parseInt(e.y*n+""),o=parseInt(e.width*n+""),l=parseInt(e.height*n+"");let d=pdfViewer._pages[t.page].viewport.convertToPdfPoint(a,i);var s=d[0],c=d[1];let p=pdfViewer._pages[t.page].viewport.convertToPdfPoint(a+o,i+l);var u=p[0],h=p[1],g=s,m=h,f=u,v=c;r.quadPoints.push(g,m,u,h,s,c,f,v)})),"highlight"==e.type){if(r.rect||(r.rect=r.quadPoints.slice(0,4)),r.rect.length<4)return;I.createHighlightAnnotation(r)}else r.fill=t.color,r.opacity=.3,r.quadPoints.length&&(r.rect=[r.quadPoints[2],r.quadPoints[3],r.quadPoints[4],r.quadPoints[5]],I.createSquareAnnotation(r))}}));new Date;r=I.write(),q++,setTimeout((function(){window.parent.postMessage({type:"exportAnnotatePDF",pdfData:r,_viewMark:a},"*")}),200)}),200);break;case"getAnnotations":I&&I.getAnnotations().then((e=>{window.parent.postMessage({type:"gteAnnotations",_viewMark:a},"*")}));break;case"saveImagePath":var i=e.data.id,l=e.data.imagePath;t.forEach((e=>{if(e.id==i){var t=JSON.parse(e.text);t.imageAbsolutePath=l,e.text=JSON.stringify(t)}})),G();break;case"useOldVersion":P=!0;break;case"useNewVersion":P=!1}}),!1);var H={yellow:"247,255,0",green:"125,240,102",blue:"143,222,249",pink:"247,153,209",red:"253,73,73"},_=!1;function J(e){var i=e.target;if(i.hasClass("comment-bar")||i.closest(".comment-bar")){if(i.hasClass("comment-bar"))var o=i.getAttribute("data-title");else o=i.closest(".comment-bar").getAttribute("data-title");var m=i.closest(".annotate");if(m){var f=parseInt(m.style.left),x=parseInt(m.style.top),w=parseInt(m.clientHeight),b=i.closest(".page"),S=document.createElement("div");S.classList.add("annotate-comment"),S.style.left=f+"px",S.style.top=x+w+10+"px",S.style.minWidth="100px",S.style.minHeight="80px",S.style.position="absolute",S.style.padding="10px",S.style.zIndex=200,S.style.backgroundColor="rgb(242 253 184)",S.style.color="#333",S.innerText=o||"",S.style.paddingTop="4px",b.appendChild(S);var L=document.createElement("span");L.innerText="X",L.style.float="right",L.style.position="absolute",L.style.color="red",L.style.right="10px",L.style.top="10px",L.style.fontSize="12px",L.style.cursor="pointer",S.appendChild(L),L.onclick=function(){L.onclick=null,b.removeChild(S),S.innerText="",S=null}}return}_=!0;let q=ee(e);q&&(extractor.getSortIndex(q),function(e,i){i.touches?(h=i.touches[0].pageX,g=i.touches[0].pageY):(h=i.pageX,g=i.pageY);if(i.target.closest(".page")){var o=i.target.closest(".page"),m=o.getAttribute("data-page-number");pdfViewer._currentPage=parseInt(m),y=o.querySelector(".textLayer")}F.current=e,F.id="",r.length&&(r.forEach((e=>{e.parentElement&&e.parentElement.removeChild(e)})),B={},r=[]);if(document.querySelectorAll(".annotate.active").forEach((e=>{e&&e.classList.remove("active")})),n=null,!1,p=!1,N.style.display="none",i.target.closest(".mm-highlight")){var f=(n=i.target.closest(".mm-highlight")).getAttribute("data-id");document.querySelectorAll(`.mm-highlight[data-id="${f}"]`).forEach((e=>{e&&e.classList.add("active")}));var x=document.querySelector(".annotate-item.active");x&&x.classList.remove("active");var w=document.querySelector(`.annotate-item[data-id="${f}"]`);w&&w.classList.add("active");var b=null;t.forEach((e=>{e.id==f&&(b=e)})),b&&window.parent.postMessage({type:"showMindmapAnnotate",id:f,data:b,annotateType:b.type,_viewMark:a},"*")}s||(l=[],d=[]);if(i.target.hasClass("annotate-head")||i.target.hasClass(".annotate-resize")||i.target.closest(".annotate-resize")){var S=i.target.closest(".annotate");if(i.target.hasClass("annotate-head"))var L="move";else L="resize";return void(c={ele:S,left:parseInt(S.style.left),top:parseInt(S.style.top),width:S.clientWidth,height:S.clientHeight,type:L})}let q=le();if(A)var C=h-q.left,E=g-q.top;else C=i.pageX-q.left,E=i.pageY-q.top;var I=C,$=E;d.push(C),d.push(E);let P=pdfViewer._pages[pdfViewer._currentPage-1].viewport.convertToPdfPoint(C,E);if(C=P[0],E=P[1],l.push(C),l.push(E),s){i.preventDefault(),u=!0,D.style.cursor="pointer",(v=document.createElement("div")).classList.add("annotate"),v.classList.add("mm-highlight"),v.setAttribute("data-type","rect"),v.setAttribute("style",`position:absolute;background:#f9e9cc;left:${I-2}px;top:${$-2}px`);var k=document.createElement("div");k.classList.add("annotate-head"),v.appendChild(k);var T=document.createElement("div");if(T.classList.add("annotate-resize"),v.appendChild(T),T.innerHTML=V,y.querySelector("annotateLayer-extend"))var M=y.querySelector("annotateLayer-extend");else{M=document.createElement("div");y.appendChild(M)}M.appendChild(v);for(var z=0;ze.anchor)),n={pageIndex:a.position.pageIndex,offset:a.anchorOffset};a=e.find((e=>e.head));let r={pageIndex:a.position.pageIndex,offset:a.headOffset};if("left"===t)r.offset--;else if("right"===t)r.offset++;else if("up"===t){if(r.offset=window.extractor.getPrevLineClosestOffset(r.pageIndex,r.offset),null===r.offset)return[]}else if("down"===t){if(r.offset=window.extractor.getNextLineClosestOffset(r.pageIndex,r.offset),null===r.offset)return[]}else if("object"==typeof t){r=t}return ae(n,r)}(B.current,e))}else{X(ae(F.current,e))}(function(e){r.length&&(r.forEach((e=>{e.parentElement&&e.parentElement.removeChild(e)})),r=[]);if(e&&e.current&&e.current.length&&e.current[0].position){e.current[0].position=function(e){let t=pdfViewer.getPageView(e.pageIndex).viewport;return function(e,t){if(e.rects)return{pageIndex:e.pageIndex,rects:e.rects.map((e=>{let[a,n]=t.convertToViewportPoint(e[0],e[1]),[r,i]=t.convertToViewportPoint(e[2],e[3]);return[Math.min(a,r),Math.min(i,n),Math.max(a,r),Math.max(i,n)]}))};if(e.paths)return{pageIndex:e.pageIndex,width:e.width*t.scale,paths:e.paths.map((e=>{let a=[];for(let n=0;n{e[1]&&(e[1]=e[1]-x),e[3]&&(e[3]=e[3]+0)}));var a=e.current[0].position.pageIndex+1,n=D.querySelector(`[data-page-number="${a}"]`).querySelector(".textLayer");if(!n)return;if(n.querySelector(".annotateLayer-extend"))var i=n.querySelector(".annotateLayer-extend");else(i=document.createElement("div")).classList.add("annotateLayer-extend"),n.appendChild(i);var o=e.current[0].text,l=ne();e.current[0].id=l,t&&t.length&&K(t,i,o,l)}})(B),W()}(te(t))}function W(){document.selection&&document.selection.empty&&(document.selection.empty(),1)||window.getSelection&&window.getSelection().removeAllRanges()}function K(e,t,a,n){e.forEach((e=>{var i=document.createElement("div");i.classList.add("mm-highlight"),i.classList.add("annotate"),i.style.left=e[0]+"px",i.style.top=e[1]+"px",i.style.width=e[2]-e[0]+"px",i.style.height=e[3]-e[1]+"px",i.style.backgroundColor="rgba(0,0,255,0.3)",i.setAttribute("data-text",a),i.setAttribute("data-type","highlight"),i.setAttribute("data-id",n),r.push(i),t.appendChild(i)}))}function j(e){var a=document.querySelector("#viewer .page").clientWidth;if(D.style.cursor="auto",c&&!s){var i=c.ele.getAttribute("data-id"),o="";return t.forEach((e=>{if(e.id==i){var t=JSON.parse(e.text);e.width=c.ele.clientWidth,e.height=c.ele.clientHeight;var n=parseInt(c.ele.style.left),r=parseInt(c.ele.style.top);o=t.path;var l=[{x:n/a,y:r/a,width:e.width/a,height:e.height/a}];t.relateRect=l,e.text=JSON.stringify(t)}})),de(o,{left:parseInt(c.ele.style.left),top:parseInt(c.ele.style.top),width:c.ele.clientWidth,height:c.ele.clientHeight},!1,y,c.ele,{id:i}),c=null,u=!1,void(_=!1)}if(u&&s){s=!1;var d={id:ne(),page:pdfViewer._currentPage-1,rect:l.slice(),contents:"",author:"",color:{r:249,g:233,b:204},opacity:1,path:"",relateRect:null,pdfName:w,pageWidth:a},p=parseInt(v.style.left),h=parseInt(v.style.top),g=m,x=f,L=+new Date;if(E)var q=E+"/"+L+".png";else if(w.startsWith("file:")){var A=S.lastIndexOf("/");q=S.substr(0,A+1)+L+".png"}else A=w.lastIndexOf("/"),q=w.substr(0,A+1)+b+"-"+L+".png";de(q,{left:p,top:h,width:g,height:x},!0,y,v,d)}u=!1,_=!1,P&&(Q(e),W()),function(e){if(e.touches)var t=e.touches[0].pageX,a=e.touches[0].pageY;else t=e.pageX,a=e.pageY;!n;setTimeout((()=>{Q(e,!0),W(),(r.length||n)&&(N.style=`left:${t-20}px;top:${a+20}px`,N.style.display="flex")}),20)}(e)}function Q(e,t){var a=window.getSelection();if(!a.isCollapsed){for(var n=a.getRangeAt(0),i=n.getClientRects(),o="",l=n.cloneContents(),d=0;d=r.bottom&&n.right>=r.right&&t.push(a)}var i=[];if(t.length){for(let a=0;a{0==i?(e=t.x,a=t.y,n=t.bottom,r=t.right):(t.xn&&(n=t.bottom),t.right>r&&(r=t.right))}));var d={x:e,y:a,top:e,left:a,bottom:n,right:r,width:r-e,height:n-a};o.push(d)}return o}(i);var s=le();l=[];i.forEach((e=>{var t=e.x-s.left,a=e.y-s.top;l.push([t,a,t+e.width,a+e.height])}));var c=F.current.pageIndex;F.rects=l,F.id=ne(),F.selectText=o;var u=c+1,h=D.querySelector(`[data-page-number="${u}"]`).querySelector(".textLayer");if(h){if(h.querySelector(".annotateLayer-extend"))var g=h.querySelector(".annotateLayer-extend");else(g=document.createElement("div")).classList.add("annotateLayer-extend"),h.appendChild(g);r.length&&(r.forEach((e=>{e.parentElement&&e.parentElement.removeChild(e)})),r=[]),K(l,g,o,F.id),t&&(p=!0)}}}function U(){var a=[];if(P||p)var n=F.rects,i=F.selectText,o=F.id,l=F.current.pageIndex;else n=B.current[0].position.rects,i=B.current[0].text,o=B.current[0].id,l=B.current[0].position.pageIndex;if(o){n.forEach((e=>{a.push({x:e[0],y:e[1],width:e[2]-e[0],height:e[3]-e[1]})}));var d=`rgb(${e})`;r.forEach((e=>{e.style.backgroundColor=d}));var s=e.split(","),c=document.querySelector("#viewer .page").clientWidth,u={selectText:i,id:o,relateRect:a=a.map((e=>({x:e.x/c,y:e.y/c,width:e.width/c,height:e.height/c}))),page:l,quadPoints:null,color:{r:s[0],g:s[1],b:s[2]},pdfName:w},h={selectText:i,id:o,type:"highlight",text:JSON.stringify(u),pdfName:w,page:l,createTime:+new Date};t.push(h),G(h),r=[],B={},F.id="",N.style.display="none",!1,p=!1}}function G(e){t.sort(((e,t)=>e.page-t.page)),Z(),window.parent.postMessage({type:"saveAnnotations",_viewMark:a,annotations:t,newAnnotate:e||null},"*")}function Z(){O.innerHTML="",t.forEach((e=>{var t=document.createElement("div");t.classList.add("annotate-item"),t.setAttribute("data-id",e.id);var a=document.createElement("div");a.classList.add("annotate-item-container"),t.appendChild(a);var n=document.createElement("div");if(n.classList.add("annotate-item-header"),"zh-cn"==k)var r=T[k].page;else r=T.zn.page;n.innerHTML=`${r} ${e.page+1}`;var i=document.createElement("div");if(i.classList.add("annotate-item-content"),"highlight"==e.type)i.innerHTML=`\n\t\t\t\t\t
\n\t\t\t\t\t\t${e.selectText||""}\n\t\t\t\t\t
\n\t\t\t `;else{var o=``;i.innerHTML=o}var l=JSON.parse(e.text),d=document.createElement("div");d.classList.add("annotate-item-note"),d.innerText=`${l.contents||""}`;var s=l.color,c=`${s.r},${s.g},${s.b}`,p="mm-highlight-black";for(var u in H)H[u]==c&&(p=`mm-highlight-${u}`);t.classList.add(p),a.appendChild(n),a.appendChild(i),a.appendChild(d),O.appendChild(t)}))}function ee(e){let t=function(e){let t=e.closest("#viewer > .page")||e.closest("#viewer > .spread > .page");if(!t)return null;let a=parseInt(t.dataset.pageNumber);return{node:t,number:a}}(e.target);if(!t)return null;let a=t.node.getBoundingClientRect();var n=e.touches?e.touches[0].clientX:e.clientX,r=e.touches?e.touches[0].clientY:e.clientY;let i=n+t.node.scrollLeft-a.left-9,o=r+t.node.scrollTop-a.top-10;return{pageIndex:t.number-1,rects:[[i,o,i,o]]}}function te(e){return function(e,t){return{pageIndex:e.pageIndex,rects:e.rects.map((e=>{let[a,n]=t.convertToPdfPoint(e[0],e[1]),[r,i]=t.convertToPdfPoint(e[2],e[3]);return[Math.min(a,r),Math.min(i,n),Math.max(a,r),Math.max(i,n)]}))}}(e,pdfViewer.getPageView(e.pageIndex).viewport)}$("body").on("blur",".annotate-item-note",(e=>{var a=e.target,n=a.innerText,r=a.closest(".annotate-item").getAttribute("data-id");r&&(t.forEach((e=>{if(e.id==r){var t=JSON.parse(e.text);t.contents=n,t.commentTime=+new Date,e.text=JSON.stringify(t)}})),function(e,t){var a=D.querySelector(`.annotate[data-id="${e}"]`);if(!a)return;var n=a.querySelector(".comment-bar");if(t){if(n)n.setAttribute("data-title",t);else(r=document.createElement("span")).classList.add("comment-bar"),r.style="position:abaolute;left:-8px;top:-6px;z-index:120;",r.innerHTML=z,r.setAttribute("data-title",t),a.appendChild(r)}else{var r;(r=a.querySelector(".comment-bar"))&&a.removeChild(r)}G()}(r,n))}));function ae(e,t){let a=[],n=Math.min(e.pageIndex,t.pageIndex),r=Math.max(e.pageIndex,t.pageIndex),i=e.pageIndex>t.pageIndex;for(let o=n;o<=r;o++){let n,r;o===e.pageIndex&&(n=void 0!==e.offset?e.offset:[e.rects[0][0],e.rects[0][1]]),o===t.pageIndex&&(r=void 0!==t.offset?t.offset:[t.rects[0][0],t.rects[0][1]]);let l=window.extractor.extractRange({pageIndex:o,anchor:n,head:r,reverse:i});if(!l)return[];if(o===e.pageIndex&&(l.anchor=!0),o===t.pageIndex&&(l.head=!0),!l.collapsed){let e=pdfViewer.getPageView(l.position.pageIndex).viewport.viewBox[3]-l.position.rects[0][3];e<0&&(e=0);let t=Math.min(l.anchorOffset,l.headOffset);l.sortIndex=[o.toString().slice(0,5).padStart(5,"0"),t.toString().slice(0,6).padStart(6,"0"),Math.floor(e).toString().slice(0,5).padStart(5,"0")].join("|")}a.push(l)}return a}function ne(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()}function re(e){var a=e.pageNumber;setTimeout((()=>{!function(e){i&&clearInterval(i);i=null,t&&t.length&&function(e,t){var a=document.querySelector("#viewer .page").clientWidth;document.querySelectorAll(`.page[data-page-number='${t}'] .mm-highlight`).forEach((e=>{e&&e.parentNode.removeChild(e)})),e.forEach((e=>{var n=JSON.parse(e.text),r=n.relateRect,i=`rgb(${n.color.r},${n.color.g},${n.color.b})`;if(n.contents)var o=n.contents;if(n.page+1==t)if(r.length>1)r.forEach(((r,l)=>{var d=document.createElement("div");d.classList.add("mm-highlight"),d.classList.add("annotate"),d.setAttribute("data-type",e.type),"highlight"==e.type&&d.setAttribute("data-text",n.selectText||""),d.style=`background:${i};width:${r.width*a}px;height:${r.height*a}px;position:absolute;cursor:pointer;left:${r.x*a}px;top:${r.y*a}px;`,d.setAttribute("data-id",e.id);var s=document.querySelector(`.page[data-page-number='${t}'] .textLayer`);if(s.querySelector(".annotateLayer-extend"))var c=s.querySelector(".annotateLayer-extend");else(c=document.createElement("div")).classList.add("annotateLayer-extend"),s.appendChild(c);if(c.appendChild(d),o&&0==l){var p=document.createElement("span");p.classList.add("comment-bar");d.style.background;p.style="position:abaolute;left:-8px;top:-6px;z-index:120;",p.innerHTML=z,p.setAttribute("data-title",o),d.appendChild(p)}}));else{var l=document.createElement("div");if(l.setAttribute("data-id",n.id),l.setAttribute("data-type",e.type),l.classList.add("mm-highlight"),l.classList.add("annotate"),"highlight"==e.type&&l.setAttribute("data-text",n.selectText||""),"rect"==e.type){l.setAttribute("data-path",n.path);var d=document.createElement("div");d.classList.add("annotate-head"),l.appendChild(d);var s=document.createElement("div");s.classList.add("annotate-resize"),l.appendChild(s),s.innerHTML=V}if(n.relateRect&&n.relateRect.length){l.style=`background:${i};width:${n.relateRect[0].width*a}px;height:${n.relateRect[0].height*a}px;position:absolute;cursor:pointer;left:${n.relateRect[0].x*a}px;top:${n.relateRect[0].y*a}px;`;var c=document.querySelector(`.page[data-page-number='${t}'] .textLayer`);if(c.querySelector(".annotateLayer-extend"))var p=c.querySelector(".annotateLayer-extend");else(p=document.createElement("div")).classList.add("annotateLayer-extend"),c.appendChild(p);p.appendChild(l)}if(o){var u=document.createElement("span");u.classList.add("comment-bar");l.style.background;u.style="position:abaolute;left:-8px;top:-6px;z-index:120;",u.innerHTML=z,u.setAttribute("data-title",o),l.appendChild(u)}}})),ie(t)}(t,e)}(a)}),10)}function ie(e){var a,n;if(o&&(a=o,t&&0!=t.length)){if(t.filter((e=>{var t=JSON.parse(e.text);return e.id==a&&(n=parseInt(t.page)+1,!0)})).length){var r=document.querySelector(`.textLayer .mm-highlight[data-id = '${a}']`);if(r){pdfViewer.currentPageNumber=n,pdfViewer._currentPage=pdfViewer.currentPageNumber;var i=parseInt(r.style.top);L&&clearTimeout(L),L=setTimeout((()=>{var e=document.querySelector("#viewerContainer");e.scrollTop=e.scrollTop+i-100,document.querySelectorAll(`.textLayer .mm-highlight[data-id = '${a}']`).forEach((e=>{e&&e.classList.add("active")}))}),0)}else pdfViewer.currentPageNumber=n,pdfViewer._currentPage=n,L&&clearTimeout(L),this.setTime=setTimeout((()=>{var e=document.querySelector(`.textLayer .mm-highlight[data-id = '${a}']`);if(e){var t=parseInt(e.style.top);setTimeout((()=>{var e=document.querySelector("#viewerContainer");e.scrollTop=e.scrollTop+t-100}),30),document.querySelectorAll(`.textLayer .mm-highlight[data-id = '${a}']`).forEach((e=>{e&&e.classList.add("active")}))}}),0)}n==e&&(o="")}}function oe(e,a){if(t.length){var n=null;if(t.forEach((t=>{t.id==e&&(n=t)})),n){document.querySelectorAll(".mm-highlight.active").forEach((e=>{e.classList.remove("active")}));var r=document.querySelector(`.mm-highlight[data-id = '${e}']`);if(r){var i=r.closest(".page").getAttribute("data-page-number");pdfViewer.currentPageNumber=parseInt(i);var l=parseInt(r.style.top);setTimeout((()=>{var e=document.querySelector("#viewerContainer");e.scrollTop=e.scrollTop+l-60,isShowAnnotate=!1}),100),document.querySelectorAll(`.mm-highlight[data-id = '${e}']`).forEach((e=>{e.classList.add("active")})),o=""}else{o=e;var d=JSON.parse(n.text);pdfViewer.currentPageNumber=parseInt(d.page)+1}}}}function le(){if(pdfViewer._currentPage>=0){var e=document.querySelector(`.page[data-page-number="${pdfViewer._currentPage}"]`);if(e){var t=e.querySelector("canvas").getBoundingClientRect();return{top:t.top,left:t.left}}return{top:0,left:0}}return{left:0,top:0}}function de(e,n,r,i,o,l){var d=document.querySelector("#viewer .page").clientWidth,s=document.createElement("canvas");s.width=n.width,s.height=n.height;var c=s.getContext("2d"),p=i.closest(".page").querySelector("canvas");let u=(window.devicePixelRatio||1)/(c.webkitBackingStorePixelRatio||c.mozBackingStorePixelRatio||c.msBackingStorePixelRatio||c.oBackingStorePixelRatio||c.backingStorePixelRatio||1);c.drawImage(p,n.left*u,n.top*u,n.width*u,n.height*u,0,0,n.width,n.height);var h=function(e){for(var t=window.atob(e),a=t.length,n=new Uint8Array(a),r=0;r{r&&(o=null)}),500)}}));