@cinc101/electron-capture
Version:
Electron multi-screen screenshot plugin with annotation and multi-language support.
1 lines • 50.7 kB
JavaScript
(()=>{var t={641:t=>{t.exports='\x3c!-- capture.html --\x3e\r\n<!doctype html>\r\n<html lang="en">\r\n<head>\r\n <meta charset="UTF-8"/>\r\n <title>Capture Screen Area</title>\r\n <style>\r\n .panels {\r\n display: flex;\r\n column-gap: 16px;\r\n }\r\n .color-block {\r\n width: 16px;\r\n height: 16px;\r\n cursor: pointer;\r\n box-sizing: border-box;\r\n position: relative;\r\n }\r\n\r\n .color-block::after {\r\n content: \'\';\r\n display: none;\r\n position: absolute;\r\n width: 8px;\r\n height: 8px;\r\n background: #fff;\r\n top: 4px;\r\n left: 4px;\r\n }\r\n\r\n .color-block:hover::after {\r\n display: block;\r\n }\r\n\r\n .color-block.selected::after {\r\n display: block;\r\n }\r\n\r\n .line-dot {\r\n border-radius: 50%;\r\n background: gray;\r\n cursor: pointer;\r\n }\r\n\r\n .line-dot.selected, .line-dot:hover {\r\n background-color: #00b400;\r\n }\r\n\r\n #screenshot-editor-toolbar button {\r\n background: none;\r\n border: none;\r\n cursor: pointer;\r\n width: 20px;\r\n height: 20px;\r\n box-sizing: content-box;\r\n margin-right: 15px;\r\n }\r\n\r\n #screenshot-editor-toolbar button img {\r\n width: 20px;\r\n height: 20px;\r\n }\r\n\r\n #screenshot-editor-toolbar button[disabled] {\r\n cursor: not-allowed;\r\n }\r\n\r\n #screenshot-editor-toolbar button[disabled] img {\r\n filter: grayscale(100%) brightness(1.4);\r\n }\r\n </style>\r\n</head>\r\n<body>\r\n<div\r\n id="overlay"\r\n style="\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100vw;\r\n height: 100vh;\r\n box-sizing: border-box;\r\n background-color: transparent;\r\n "\r\n></div>\r\n<div id="draw-config-panel" style="\r\n position: absolute;\r\n display: none;\r\n background: #fff;\r\n border: 1px solid #ccc;\r\n border-radius: 4px;\r\n padding: 8px;\r\n z-index: 99999;\r\n font-size: 12px;\r\n box-shadow: 0 2px 10px rgba(0,0,0,0.15);\r\n">\r\n <div class="panels">\r\n <div id="lineWidthOptions" style="display: flex; gap: 10px; align-items: center;">\r\n <div class="line-dot" data-width="2" style="width: 7px; height: 7px;"></div>\r\n <div class="line-dot" data-width="4" style="width: 10px; height: 10px;"></div>\r\n <div class="line-dot" data-width="6" style="width: 13px; height: 13px;"></div>\r\n </div>\r\n <div id="colorOptions" style="display: flex; gap: 6px;">\r\n <div class="color-block" data-color="#ff4d4f" style="background: #ff4d4f;"></div>\r\n <div class="color-block" data-color="#fadb14" style="background: #fadb14;"></div>\r\n <div class="color-block" data-color="#1890ff" style="background: #1890ff;"></div>\r\n <div class="color-block" data-color="#52c41a" style="background: #52c41a;"></div>\r\n <div class="color-block" data-color="#000000" style="background: #000000;"></div>\r\n </div>\r\n </div>\r\n</div>\r\n<script>var CaptureApp;(()=>{"use strict";var t={819:t=>{t.exports=require("electron")}},e={};function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,o,a,c,l=[],r=!0,d=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;r=!1}else for(;!(r=(i=a.call(n)).done)&&(l.push(i.value),l.length!==e);r=!0);}catch(t){d=!0,o=t}finally{try{if(!r&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(d)throw o}}return l}}(t,e)||o(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,a=function(){};return{s:a,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,l=!0,r=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return l=t.done,t},e:function(t){r=!0,c=t},f:function(){try{l||null==n.return||n.return()}finally{if(r)throw c}}}}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var c,l,r,d,s,u,h=function n(i){var o=e[i];if(void 0!==o)return o.exports;var a=e[i]={exports:{}};return t[i](a,a.exports,n),a.exports}(819).ipcRenderer,p=function(t){return"screenshot-plugin/".concat(t)},m="zh",y={zh:{rect:"方框",ellipse:"椭圆",arrow:"箭头",pen:"画笔",mosaic:"马赛克",text:"文字",undo:"撤销",download:"下载",cancel:"退出",confirm:"完成",fontSizeSmall:"小",fontSizeMedium:"中",fontSizeLarge:"大"},en:{rect:"Rectangle",ellipse:"Ellipse",arrow:"Arrow",pen:"Pen",mosaic:"Mosaic",text:"Text",undo:"Undo",download:"Download",cancel:"Cancel",confirm:"Confirm",fontSizeSmall:"Small",fontSizeMedium:"Medium",fontSizeLarge:"Large"}},g=null,f=null,v=!1,w=!1,b=null,x=0,I=0,M=null,S=0,C=0,D=!1,z=[],T=!1,k=0,N=0,W=[],P={strokeColor:"#ff4d4f",lineWidth:2,fontSize:18},A=!1,Y=!1,L=null,Z=!1,E=0,H=0,R=null,j=null,B="#07c160";window.onload=function(){console.log("1111"),v=!0,dt(),st(),h.send(p("capture-window-ready"))};var J=ot("div","screenshot-editor-toolbar",{position:"absolute",zIndex:99999,background:"#fff",borderRadius:"6px",padding:"10px 0 10px 15px",boxShadow:"0 2px 10px rgba(0,0,0,0.2)",display:"none",color:"#333",fontFamily:"sans-serif",height:"20px",minWidth:"320px",whiteSpace:"nowrap",overflow:"visible"});document.body.appendChild(J);var _=ot("div","text-config-panel",{position:"absolute",zIndex:99999,background:"#fff",border:"1px solid #ccc",padding:"6px 10px",borderRadius:"4px",display:"none",fontSize:"14px"});document.body.appendChild(_),st();var G=document.getElementById("overlay"),X=null,O=ot("canvas",null,{position:"fixed",border:"none",zIndex:9999,pointerEvents:"none",display:"block"});O.width=150,O.height=190,document.body.appendChild(O);var Q=O.getContext("2d"),V=document.querySelectorAll("#colorOptions .color-block");V.forEach((function(t){t.addEventListener("click",(function(){V.forEach((function(t){return t.classList.remove("selected")})),t.classList.add("selected"),P.strokeColor=t.dataset.color}))}));var U=document.querySelectorAll("#lineWidthOptions .line-dot");function F(){var t=document.getElementById("draw-config-panel");t&&(t.style.display="none")}function q(){h.send(p("screenshot-window-unlock")),R&&(R.remove(),R=null,j=null),g&&(g.remove(),g=null,f=null),window._markupContainer&&(window._markupContainer.remove(),window._markupContainer=null),W=[],(z=[]).push(JSON.parse(JSON.stringify(W))),s&&(s.remove(),s=null),O&&(O.style.display="none"),J.style.display="none",window._captureMaskCanvas&&(window._captureMaskCanvas.remove(),window._captureMaskCanvas=null,window._captureMaskCtx=null),h.send(p("capture-cancel")),A=!1,Y=!1,Z=!1,L="",P={strokeColor:"red",lineWidth:2},c=0,l=0,r=0,d=0,window._captureTempData=null,document.body.style.backgroundImage="none"}function K(t){var e=window._captureMaskCanvas,n=window._captureMaskCtx;e&&n&&(e.width=window.innerWidth,e.height=window.innerHeight,n.clearRect(0,0,e.width,e.height),n.fillStyle="rgba(0, 0, 0, 0.2)",n.fillRect(0,0,e.width,e.height),n.globalCompositeOperation="destination-out",n.fillStyle="rgba(0, 0, 0, 1)",n.fillRect(t.x,t.y,t.width,t.height),n.globalCompositeOperation="source-over",n.strokeStyle=B||"#409EFF",n.lineWidth=2,n.strokeRect(t.x+1,t.y+1,t.width-2,t.height-2))}function $(){var t=window._markupContainer;if(t){t.innerHTML="";var e,o=i(W);try{var a=function(){var o=e.value,a=ot("div",null,{position:"absolute",left:"".concat(o.x,"px"),top:"".concat(o.y,"px"),cursor:"move",pointerEvents:"auto"});if(a.className="markup-item",a.setAttribute("draggable","false"),a.dataset.index=W.indexOf(o),a.addEventListener("mousedown",(function(t){t.stopPropagation();var e=a.getBoundingClientRect();(t.clientX<=e.left+6||t.clientX>=e.right-6||t.clientY<=e.top+6||t.clientY>=e.bottom-6)&&(M=a,S=t.clientX-a.offsetLeft,C=t.clientY-a.offsetTop,D=!0)})),"rect"===o.mode)a.style.left="".concat(o.x,"px"),a.style.top="".concat(o.y,"px"),a.style.width="".concat(o.w,"px"),a.style.height="".concat(o.h,"px"),a.style.border="".concat(o.width,"px solid ").concat(o.color),a.style.background="transparent",a.style.pointerEvents="none",a.style.boxSizing="border-box",a.style.cursor="default";else if("ellipse"===o.mode)a.style.width="".concat(o.w,"px"),a.style.height="".concat(o.h,"px"),a.style.border="".concat(o.width,"px solid ").concat(o.color),a.style.borderRadius="50%",a.style.background="transparent",a.style.pointerEvents="none",a.style.boxSizing="border-box",a.style.cursor="default";else if("text"===o.mode)a.textContent=o.text,a.style.font="".concat(o.fontWeight||"400"," ").concat(o.fontSize,"px sans-serif"),a.style.color=o.color,a.style.background="transparent",a.style.padding="2px 4px";else if("arrow"===o.mode){var c=document.createElement("canvas");c.width=window.innerWidth,c.height=window.innerHeight,c.style.cssText="\\n position: absolute;\\n left: 0;\\n top: 0;\\n pointer-events: none;\\n z-index: 9986;\\n ";var l=c.getContext("2d");l.strokeStyle=o.color,l.lineWidth=o.width,at(l,o.x1,o.y1,o.x2,o.y2,o.color,o.width),t.appendChild(c)}else if("pen"===o.mode){var r=document.createElement("canvas");r.width=window.innerWidth,r.height=window.innerHeight,r.style.cssText="\\n position: absolute;\\n left: 0;\\n top: 0;\\n pointer-events: none;\\n z-index: 9986;\\n ";var d=r.getContext("2d");if(d.strokeStyle=o.color,d.lineWidth=o.width,d.beginPath(),o.path&&o.path.length>0){d.moveTo(o.path[0].x,o.path[0].y);for(var s=1;s<o.path.length;s++)d.lineTo(o.path[s].x,o.path[s].y)}d.stroke(),t.appendChild(r)}else if("mosaic"===o.mode){var u=document.createElement("canvas");u.width=window.innerWidth,u.height=window.innerHeight,u.style.cssText="\\n position: absolute;\\n left: 0;\\n top: 0;\\n pointer-events: none;\\n z-index: 9986;\\n ";var h=u.getContext("2d"),p=window._captureHiddenCtx,m=4*o.width;if(o.path&&p){var y,g=i(o.path);try{for(g.s();!(y=g.n()).done;){var f=y.value,v=n(p.getImageData(f.x,f.y,1,1).data,3),w=v[0],b=v[1],x=v[2];h.fillStyle="rgb(".concat(w,", ").concat(b,", ").concat(x,")"),h.fillRect(f.x-m/2,f.y-m/2,m,m)}}catch(t){g.e(t)}finally{g.f()}}t.appendChild(u)}t.appendChild(a)};for(o.s();!(e=o.n()).done;)a()}catch(t){o.e(t)}finally{o.f()}}}function tt(){var t=document.getElementById("undoBtn");t&&(t.disabled=0===W.length)}function et(t,e){var n=J.getBoundingClientRect(),i=t.offsetHeight||50,o=n.bottom+6,a=n.top-i-6,c=o+i>window.innerHeight?a:o,l=e.offsetLeft,r=n.left+l;t.style.left="".concat(r,"px"),t.style.top="".concat(c,"px")}function nt(){var t,e=null===(t=s)||void 0===t?void 0:t.getBoundingClientRect();return e?{x:Math.round(e.left),y:Math.round(e.top),width:Math.round(e.width),height:Math.round(e.height)}:null}function it(t,e,n,i){var o=J.offsetWidth||200,a=J.offsetHeight||40,c=t+n/2,l=e+i+10;l+a>window.innerHeight&&(l=e-a-10);var r=window.innerWidth-o-10,d=!0;c-o/2<10?(c=10,d=!1):c+o/2>window.innerWidth-10&&(c=r,d=!1),J.style.left="".concat(c,"px"),J.style.top="".concat(l,"px"),J.style.transform=d?"translateX(-50%)":"none"}function ot(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return e&&(i.id=e),Object.assign(i.style,n),i}function at(t,e,n,i,o,a,c){var l=10+1.5*c,r=Math.atan2(o-n,i-e),d=Math.PI/9,s=i-.5*l*Math.cos(r),u=o-.5*l*Math.sin(r);t.beginPath(),t.moveTo(e,n),t.lineTo(s,u),t.strokeStyle=a,t.lineWidth=c,t.stroke(),t.beginPath(),t.moveTo(i,o),t.lineTo(i-l*Math.cos(r-d),o-l*Math.sin(r-d)),t.lineTo(i-l*Math.cos(r+d),o-l*Math.sin(r+d)),t.closePath(),t.fillStyle=a,t.fill()}function ct(t){var e=5*t,n=document.createElement("canvas");n.width=e,n.height=e;var i=n.getContext("2d");return i.clearRect(0,0,e,e),i.beginPath(),i.arc(e/2,e/2,e/2-2,0,2*Math.PI),i.strokeStyle="rgba(0, 0, 0, 0.7)",i.lineWidth=2,i.stroke(),n.toDataURL("image/png")}function lt(){var t=(window._captureTempData||{}).cropRegion,e=window._captureHiddenCanvas;if(!e||!t)return console.warn("缺少截图源或区域"),null;var o=document.createElement("canvas");o.width=t.width,o.height=t.height;var a=o.getContext("2d");return a.drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),window._markupContainer&&window._markupContainer.querySelectorAll(".markup-item").forEach((function(e){var o=parseInt(e.dataset.index,10),c=W[o];if(c){var l=c.x-t.x,r=c.y-t.y;if(a.save(),"rect"===c.mode)a.strokeStyle=c.color,a.lineWidth=c.width,a.strokeRect(l,r,c.w,c.h);else if("ellipse"===c.mode)a.strokeStyle=c.color,a.lineWidth=c.width,a.beginPath(),a.ellipse(l+c.w/2,r+c.h/2,c.w/2,c.h/2,0,0,2*Math.PI),a.stroke();else if("text"===c.mode)a.font="".concat(c.fontWeight||"400"," ").concat(c.fontSize,"px sans-serif"),a.fillStyle=c.color,a.fillText(c.text,l,r+c.fontSize);else if("arrow"===c.mode)a.strokeStyle=c.color,a.lineWidth=c.width,at(a,c.x1-t.x,c.y1-t.y,c.x2-t.x,c.y2-t.y,c.color,c.width);else if("pen"===c.mode){if(a.strokeStyle=c.color,a.lineWidth=c.width,a.beginPath(),c.path&&c.path.length>0){a.moveTo(c.path[0].x-t.x,c.path[0].y-t.y);for(var d=1;d<c.path.length;d++)a.lineTo(c.path[d].x-t.x,c.path[d].y-t.y)}a.stroke()}else if("mosaic"===c.mode){var s=window._captureHiddenCtx,u=4*c.width;if(c.path&&s){var h,p=i(c.path);try{for(p.s();!(h=p.n()).done;){var m=h.value,y=n(s.getImageData(m.x,m.y,1,1).data,3),g=y[0],f=y[1],v=y[2];a.fillStyle="rgb(".concat(g,", ").concat(f,", ").concat(v,")"),a.fillRect(m.x-t.x-u/2,m.y-t.y-u/2,u,u)}}catch(t){p.e(t)}finally{p.f()}}}a.restore()}})),o.toDataURL("image/png")}function rt(){window._captureMaskCanvas&&(window._captureMaskCanvas.remove(),window._captureMaskCanvas=null,window._captureMaskCtx=null),J.style.display="none";var t=(window._captureTempData||{}).cropRegion;if(window._captureHiddenCanvas&&t){var e=lt();e&&(q(),setTimeout((function(){h.send(p("capture-done"),e)}),0))}else console.warn("缺少截图源或区域")}function dt(){J.innerHTML=\'\\n <button data-action="rect" title="\'.concat(y[m].rect,\'"><img src="\').concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZD0iTTQxNiA0NDhIOTZhMzIuMDkgMzIuMDkgMCAwMS0zMi0zMlY5NmEzMi4wOSAzMi4wOSAwIDAxMzItMzJoMzIwYTMyLjA5IDMyLjA5IDAgMDEzMiAzMnYzMjBhMzIuMDkgMzIuMDkgMCAwMS0zMiAzMnoiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMzIiLz48L3N2Zz4=",\'" /></button>\\n <button data-action="ellipse" title="\').concat(y[m].ellipse,\'"><img src="\').concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZD0iTTQ0OCAyNTZjMC0xMDYtODYtMTkyLTE5Mi0xOTJTNjQgMTUwIDY0IDI1NnM4NiAxOTIgMTkyIDE5MiAxOTItODYgMTkyLTE5MnoiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMzIiLz48L3N2Zz4=",\'" /></button>\\n <button data-action="arrow" title="\').concat(y[m].arrow,\'"><img src="\').concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSI0OCIgZD0iTTExMiAyNDRsMTQ0LTE0NCAxNDQgMTQ0TTI1NiAxMjB2MjkyIi8+PC9zdmc+",\'" /></button>\\n <button data-action="pen" title="\').concat(y[m].pen,\'"><img src="\').concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIzMiIgZD0iTTM2NC4xMyAxMjUuMjVMODcgNDAzbC0yMyA0NSA0NC45OS0yMyAyNzcuNzYtMjc3LjEzLTIyLjYyLTIyLjYyek00MjAuNjkgNjguNjlsLTIyLjYyIDIyLjYyIDIyLjYyIDIyLjYzIDIyLjYyLTIyLjYzYTE2IDE2IDAgMDAwLTIyLjYyaDBhMTYgMTYgMCAwMC0yMi42MiAweiIvPjwvc3ZnPg==",\'" /></button>\\n <button data-action="mosaic" title="\').concat(y[m].mosaic,\'"><img src="\').concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PGNpcmNsZSBjeD0iMjU2IiBjeT0iMTg0IiByPSIxMjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjMyIi8+PGNpcmNsZSBjeD0iMzQ0IiBjeT0iMzI4IiByPSIxMjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjMyIi8+PGNpcmNsZSBjeD0iMTY4IiBjeT0iMzI4IiByPSIxMjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjMyIi8+PC9zdmc+",\'" /></button>\\n <button data-action="text" title="\').concat(y[m].text,\'"><img src="\').concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIzMiIgZD0iTTMyIDQxNS41bDEyMC0zMjAgMTIwIDMyME0yMzAgMzAzLjVINzRNMzI2IDIzOS41YzEyLjE5LTI4LjY5IDQxLTQ4IDc0LTQ4aDBjNDYgMCA4MCAzMiA4MCA4MHYxNDQiLz48cGF0aCBkPSJNMzIwIDM1OC41YzAgMzYgMjYuODYgNTggNjAgNTggNTQgMCAxMDAtMjcgMTAwLTEwNnYtMTVjLTIwIDAtNTggMS05MiA1LTMyLjc3IDMuODYtNjggMTktNjggNTh6IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjMyIi8+PC9zdmc+",\'" /></button>\\n <button data-action="undo" id="undoBtn" title="\').concat(y[m].undo,\'" disabled><img src="\').concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIzMiIgZD0iTTExMiAxNjBsLTY0IDY0IDY0IDY0Ii8+PHBhdGggZD0iTTY0IDIyNGgyOTRjNTguNzYgMCAxMDYgNDkuMzMgMTA2IDEwOHYyMCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIzMiIvPjwvc3ZnPg==",\'" /></button>\\n <button data-action="download" title="\').concat(y[m].download,\'"><img src="\').concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZD0iTTMzNiAxNzZoNDBhNDAgNDAgMCAwMTQwIDQwdjIwOGE0MCA0MCAwIDAxLTQwIDQwSDEzNmE0MCA0MCAwIDAxLTQwLTQwVjIxNmE0MCA0MCAwIDAxNDAtNDBoNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMzIiLz48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjMyIiBkPSJNMTc2IDI3Mmw4MCA4MCA4MC04ME0yNTYgNDh2Mjg4Ii8+PC9zdmc+",\'" /></button>\\n <button data-action="cancel" title="\').concat(y[m].cancel,\'" style="color: red;"><img src="\').concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+DQogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmY0ZDRmIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMzIiDQogICAgICAgICAgZD0iTTQxNiA0MTZMOTYgOTZNNDE2IDk2TDk2IDQxNiIvPg0KPC9zdmc+",\'" /></button>\\n <button data-action="confirm" title="\').concat(y[m].confirm,\'"><img src="\').concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj4NCiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImdyZWVuIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMzIiDQogICAgICAgICAgZD0iTTQzMiAxNDRMMTc2IDQzMmwtOTYtOTYiLz4NCjwvc3ZnPg0K",\'" /></button>\\n \')}function st(){var t=y[m];_.innerHTML=\'\\n <div style="display: flex; column-gap: 10px; align-items: center">\\n <label style="margin-right: 12px;">\\n <select id="textFontSize">\\n <option value="14">\'.concat(t.fontSizeSmall,\'</option>\\n <option value="18">\').concat(t.fontSizeMedium,\'</option>\\n <option value="24">\').concat(t.fontSizeLarge,\'</option>\\n </select>\\n </label>\\n <div id="colorOptions" style="display: flex; gap: 6px;">\\n <div class="color-block" data-color="#ff4d4f" style="background: #ff4d4f;"></div>\\n <div class="color-block" data-color="#fadb14" style="background: #fadb14;"></div>\\n <div class="color-block" data-color="#1890ff" style="background: #1890ff;"></div>\\n <div class="color-block" data-color="#52c41a" style="background: #52c41a;"></div>\\n <div class="color-block" data-color="#000000" style="background: #000000;"></div>\\n </div>\\n </div>\\n \'),document.getElementById("textFontSize").value=P.fontSize,document.getElementById("textFontSize").addEventListener("change",(function(t){P.fontSize=parseInt(t.target.value,10)}))}U.forEach((function(t){t.addEventListener("click",(function(){if(U.forEach((function(t){return t.classList.remove("selected")})),t.classList.add("selected"),P.lineWidth=parseInt(t.dataset.width,10),"mosaic"===L){var e=ct(P.lineWidth);document.body.style.cursor="url(".concat(e,") ").concat(2*P.lineWidth," ").concat(2*P.lineWidth,", auto"),s&&(s.style.cursor="url(".concat(e,") ").concat(2*P.lineWidth," ").concat(2*P.lineWidth,", auto"))}}))})),h.on(p("set-main-color"),(function(t,e){"string"==typeof e&&(B=e)})),h.on(p("set-lang"),(function(t,e){y[e]&&(m=e,dt(),st())})),h.on(p("set-window-index"),(function(t,e){X=e})),h.on(p("set-crop-limit"),(function(t,e){window._captureTempData=window._captureTempData||{},window._captureTempData.cropRegionLimit=e})),h.on(p("highlight-border"),(function(t,e){X===e?(G.style.border="2px solid ".concat(B),G.style.background="rgba(0, 0, 0, 0.2)"):(G.style.border="none",G.style.background="rgba(0, 0, 0, 0.4)")})),h.on(p("screenshot-lock-state"),(function(t,e){var n=e.locked,i=e.isSelf;w=n&&!i})),h.on(p("display-screenshot"),(function(t,e,n,i){R&&(R.remove(),R=null,j=null),g&&(g.remove(),g=null,f=null),window._markupContainer&&(window._markupContainer.remove(),window._markupContainer=null),u=i;var o=new Image;o.src=e,s&&(document.body.removeChild(s),s=null),J.style.display="none",F(),c=l=r=d=0,o.onload=function(){document.body.style.backgroundImage="url(".concat(e,")"),document.body.style.backgroundSize="cover",document.body.style.userSelect="none",document.body.style.backgroundColor="transparent";var t=document.createElement("canvas");t.width=o.width,t.height=o.height;var n=t.getContext("2d");n.imageSmoothingEnabled=!1,n.webkitImageSmoothingEnabled=!1,n.mozImageSmoothingEnabled=!1,n.msImageSmoothingEnabled=!1,n.drawImage(o,0,0),window._captureHiddenCanvas=t,window._captureHiddenCtx=n;var i=ot("canvas","maskCanvas",{position:"fixed",left:"0",top:"0",pointerEvents:"none",zIndex:9980,backgroundColor:"transparent"});document.body.appendChild(i),window._captureMaskCanvas=i,window._captureMaskCtx=i.getContext("2d")}})),document.addEventListener("mousedown",(function(t){var e,n,o;if(v&&0===t.button){var a,u=i(document.querySelectorAll(".markup-item"));try{for(u.s();!(a=u.n()).done;){var h=a.value,p=h.getBoundingClientRect();if(t.clientX>=p.left&&t.clientX<=p.right&&t.clientY>=p.top&&t.clientY<=p.bottom&&(Math.abs(t.clientX-p.left)<=6||Math.abs(t.clientX-p.right)<=6||Math.abs(t.clientY-p.top)<=6||Math.abs(t.clientY-p.bottom)<=6))return M=h,S=t.clientX-h.offsetLeft,C=t.clientY-h.offsetTop,D=!0,void t.preventDefault()}}catch(t){u.e(t)}finally{u.f()}if(t.target.classList.contains("markup-item"))return M=t.target,S=t.clientX-M.offsetLeft,C=t.clientY-M.offsetTop,D=!0,void t.preventDefault();var m=null===(e=s)||void 0===e||null===(n=e.getBoundingClientRect)||void 0===n?void 0:n.call(e),y=m&&t.clientX>=m.left&&t.clientX<=m.right&&t.clientY>=m.top&&t.clientY<=m.bottom;if(Y&&y&&!L&&0===W.length&&0===t.button)return T=!0,k=t.clientX-m.left,void(N=t.clientY-m.top);if(!t.target.closest("#screenshot-editor-toolbar")&&!t.target.closest("#text-config-panel")&&!(b&&b.contains(t.target)||D)){var g=null===(o=window._captureTempData)||void 0===o?void 0:o.cropRegion,f=t.clientX,x=t.clientY;if("text"===L&&Y&&0===t.button){if(!(f>=g.x&&f<=g.x+g.width&&x>=g.y&&x<=g.y+g.height))return;var I=P.fontSize,R=P.strokeColor,_=ot("input",null,{position:"fixed",left:"".concat(f,"px"),top:"".concat(x,"px"),zIndex:99999,border:"1px solid red",backgroundColor:"transparent",outline:"none",padding:"2px 4px",borderRadius:"4px",caretColor:R,fontWeight:"bold",font:"".concat(P.fontWeight||"400"," ").concat(I,"px sans-serif"),color:R});return _.type="text",document.body.appendChild(_),setTimeout((function(){_.focus()}),0),b=_,_.addEventListener("keydown",(function(t){if("Enter"===t.key){var e=_.value.trim();if(""!==e){var n={mode:"text",x:parseInt(_.style.left,10),y:parseInt(_.style.top,10),text:e,color:_.style.color,fontSize:I,fontWeight:P.fontWeight||"400"};W.push(n),tt(),z.push(JSON.parse(JSON.stringify(W))),j.font="".concat(n.fontWeight||"400"," ").concat(n.fontSize,"px sans-serif"),j.fillStyle=n.color,$()}_.remove(),b=null}})),void _.addEventListener("blur",(function(){if(!_.value.trim())return _.remove(),void(b=null);var t=_.value.trim(),e={mode:"text",x:parseInt(_.style.left,10),y:parseInt(_.style.top,10),text:t,color:_.style.color,fontSize:P.fontSize,fontWeight:P.fontWeight||"400"};W.push(e),tt(),z.push(JSON.parse(JSON.stringify(W))),j.font="".concat(e.fontWeight||"400"," ").concat(e.fontSize,"px sans-serif"),j.fillStyle=e.color,$(),_.remove(),b=null}))}if(["rect","ellipse","arrow","pen","mosaic"].includes(L)&&Y){var G,X=null===(G=window._captureTempData)||void 0===G?void 0:G.cropRegion;if(f>=X.x&&f<=X.x+X.width&&x>=X.y&&x<=X.y+X.height){Z=!0;var O=P.lineWidth/2;E=f+O,H=x+O,"pen"!==L&&"mosaic"!==L||(window._currentPenPath=[{x:f,y:x}])}}else if(!Y||0!==t.button){if(w&&0===t.button)return t.preventDefault(),void t.stopPropagation();if(L&&Y){var Q,V=null===(Q=window._captureTempData)||void 0===Q?void 0:Q.cropRegion;t.clientX>=V.x&&t.clientX<=V.x+V.width&&t.clientY>=V.y&&t.clientY<=V.y+V.height&&(Z=!0,E=t.clientX,H=t.clientY)}else{if(!window._captureMaskCanvas){var U=ot("canvas","maskCanvas",{position:"fixed",left:"0",top:"0",pointerEvents:"none",zIndex:9980,backgroundColor:"transparent"});document.body.appendChild(U),window._captureMaskCanvas=U,window._captureMaskCtx=U.getContext("2d")}var q;s&&(document.body.removeChild(s),s=null),0===t.button&&(J.style.display="none",F()),0===t.button&&(A=!0,c=t.clientX,l=t.clientY,r=t.clientX,d=t.clientY,q=l,s=ot("div","selectionBox",{position:"absolute",left:"".concat(c,"px"),top:"".concat(q,"px"),border:"2px solid ".concat(B),background:"rgba(255, 255, 255, 0)",zIndex:9982,boxSizing:"border-box",pointerEvents:"none",width:"1px",height:"1px"}),document.body.appendChild(s))}}}}})),window.addEventListener("mousemove",(function(t){var e;if(v){var o,a=!1,u=i(document.querySelectorAll(".markup-item"));try{for(u.s();!(o=u.n()).done;){var m=o.value.getBoundingClientRect();if(t.clientX>=m.left&&t.clientX<=m.right&&t.clientY>=m.top&&t.clientY<=m.bottom&&(Math.abs(t.clientX-m.left)<=6||Math.abs(t.clientX-m.right)<=6||Math.abs(t.clientY-m.top)<=6||Math.abs(t.clientY-m.bottom)<=6)){document.body.style.cursor="move",a=!0;break}}}catch(t){u.e(t)}finally{u.f()}if(a||"mosaic"===L||(document.body.style.cursor="default"),M){var y,w=null===(y=window._captureTempData)||void 0===y?void 0:y.cropRegion;if(!w)return;var b=t.clientX-S,D=t.clientY-C,z=M.offsetWidth,R=M.offsetHeight;return b=Math.max(w.x,Math.min(w.x+w.width-z,b)),D=Math.max(w.y,Math.min(w.y+w.height-R,D)),M.style.left="".concat(b,"px"),void(M.style.top="".concat(D,"px"))}if(Y&&s&&(t.target.classList.contains("markup-item")?s.style.cursor="default":!L&&0===W.length&&s.contains(t.target)?s.style.cursor="move":s.style.cursor="default"),T&&s){var j,J=(null===(j=window._captureTempData)||void 0===j?void 0:j.cropRegionLimit)||{x:0,y:0,width:window.innerWidth,height:window.innerHeight},_=s.offsetWidth,G=s.offsetHeight,X=t.clientX-k,V=t.clientY-N;X=Math.max(J.x,Math.min(J.x+J.width-_,X)),V=Math.max(J.y,Math.min(J.y+J.height-G,V)),s.style.left="".concat(X,"px"),s.style.top="".concat(V,"px"),s.style.opacity="0.8",s.style.boxShadow="0 0 0 1px rgba(0,0,0,0.15)",window._captureTempData.cropRegion={x:X,y:V,width:_,height:G},K(window._captureTempData.cropRegion),it(X,V,_,G)}var U={x:t.screenX,y:t.screenY};h.send(p("check-display"),U);var F=window._captureHiddenCanvas,q=window._captureHiddenCtx;if(x=t.clientX,I=t.clientY,F&&q){var $=50,tt=150;O.width=tt,O.height=190,O.style.width="".concat(O.width,"px"),O.style.height="".concat(O.height,"px");var et=Math.floor(t.clientX),ot=Math.floor(t.clientY),ct=q.getImageData(et-25,ot-25,$,$),lt=document.createElement("canvas");lt.width=$,lt.height=$,lt.getContext("2d").putImageData(ct,0,0),Q.clearRect(0,0,O.width,O.height),Q.imageSmoothingEnabled=!1,Q.drawImage(lt,0,0,$,$,0,0,tt,tt),Q.strokeStyle=B,Q.lineWidth=1,Q.strokeRect(0,0,tt,tt),Q.beginPath(),Q.moveTo(75,0),Q.lineTo(75,tt),Q.moveTo(0,75),Q.lineTo(tt,75),Q.strokeStyle=B,Q.stroke();var rt=window.innerWidth,dt=window.innerHeight,st=t.clientX+20,ut=t.clientY+20;st+O.width>rt&&(st=t.clientX-O.width-20),ut+O.height>dt&&(ut=t.clientY-O.height-20),O.style.left="".concat(st,"px"),O.style.top="".concat(ut,"px");var ht=function(t,e,i){var o=t.canvas;if(e<0||i<0||e>=o.width||i>=o.height)return{r:0,g:0,b:0,rgb:"rgb(0, 0, 0)",hex:"#000000"};var a=n(t.getImageData(e,i,1,1).data,3),c=a[0],l=a[1],r=a[2],d=function(t){return t>=253?255:t};c=d(c),l=d(l),r=d(r);var s=function(t){return t.toString(16).padStart(2,"0")},u="#".concat(s(c)).concat(s(l)).concat(s(r));return{r:c,g:l,b:r,rgb:"rgb(".concat(c,", ").concat(l,", ").concat(r,")"),hex:u}}(q,et,ot),pt=ht.r,mt=ht.g,yt=ht.b;Q.font="14px sans-serif";var gt="x: ".concat(et,", y: ").concat(ot),ft="rgb(".concat(pt,", ").concat(mt,", ").concat(yt,")"),vt=Q.measureText(gt).width,wt=Q.measureText(ft).width;Q.fillStyle="#000",Q.fillRect(0,152,vt+8,16),Q.fillStyle="#fff",Q.fillText(gt,4,164),Q.fillStyle="#000",Q.fillRect(0,170,wt+8,16),Q.fillStyle="#fff",Q.fillText(ft,4,182)}if(Z&&L&&f){var bt,xt=null===(bt=window._captureTempData)||void 0===bt?void 0:bt.cropRegion,It=Math.min(Math.max(x,xt.x),xt.x+xt.width),Mt=Math.min(Math.max(I,xt.y),xt.y+xt.height),St=Math.min(E,It),Ct=Math.min(H,Mt),Dt=Math.abs(It-E),zt=Math.abs(Mt-H);if(f.clearRect(0,0,g.width,g.height),f.strokeStyle=P.strokeColor,f.lineWidth=P.lineWidth,"rect"===L)f.strokeRect(St,Ct,Dt,zt);else if("ellipse"===L)f.beginPath(),f.ellipse(St+Dt/2,Ct+zt/2,Dt/2,zt/2,0,0,2*Math.PI),f.stroke();else if("arrow"===L)at(f,E,H,It,Mt,P.strokeColor,P.lineWidth);else if("pen"===L){var Tt,kt=null===(Tt=window._captureTempData)||void 0===Tt?void 0:Tt.cropRegion,Nt=Math.min(Math.max(x,kt.x),kt.x+kt.width),Wt=Math.min(Math.max(I,kt.y),kt.y+kt.height);window._currentPenPath.push({x:Nt,y:Wt}),f.clearRect(0,0,g.width,g.height),f.strokeStyle=P.strokeColor,f.lineWidth=P.lineWidth,f.beginPath();var Pt=window._currentPenPath;f.moveTo(Pt[0].x,Pt[0].y);for(var At=1;At<Pt.length;At++)f.lineTo(Pt[At].x,Pt[At].y);f.stroke()}else if("mosaic"===L){for(var Yt,Lt=null===(Yt=window._captureTempData)||void 0===Yt?void 0:Yt.cropRegion,Zt=Math.min(Math.max(x,Lt.x),Lt.x+Lt.width),Et=Math.min(Math.max(I,Lt.y),Lt.y+Lt.height),Ht=window._currentPenPath[window._currentPenPath.length-1],Rt=Zt-Ht.x,jt=Et-Ht.y,Bt=Math.sqrt(Rt*Rt+jt*jt),Jt=2*P.lineWidth,_t=Math.floor(Bt/Jt),Gt=1;Gt<=_t;Gt++){var Xt=Ht.x+Rt*Gt/_t,Ot=Ht.y+jt*Gt/_t;window._currentPenPath.push({x:Xt,y:Ot})}window._currentPenPath.push({x:Zt,y:Et}),f.clearRect(0,0,g.width,g.height);var Qt=4*P.lineWidth,Vt=window._captureHiddenCtx;if(!Vt)return;var Ut,Ft=i(window._currentPenPath);try{for(Ft.s();!(Ut=Ft.n()).done;){var qt=Ut.value,Kt=n(Vt.getImageData(qt.x,qt.y,1,1).data,3),$t=Kt[0],te=Kt[1],ee=Kt[2];f.fillStyle="rgb(".concat($t,", ").concat(te,", ").concat(ee,")"),f.fillRect(qt.x-Qt/2,qt.y-Qt/2,Qt,Qt)}}catch(t){Ft.e(t)}finally{Ft.f()}}}if(A&&1===t.buttons){var ne=(null===(e=window._captureTempData)||void 0===e?void 0:e.cropRegionLimit)||{x:0,y:0,width:window.innerWidth,height:window.innerHeight};r=Math.min(Math.max(t.clientX,ne.x),ne.x+ne.width),d=Math.min(Math.max(t.clientY,ne.y),ne.y+ne.height);var ie=Math.min(c,r),oe=Math.min(l,d),ae=Math.abs(r-c),ce=Math.abs(d-l);s.style.left="".concat(ie,"px"),s.style.top="".concat(oe,"px"),s.style.width="".concat(ae,"px"),s.style.height="".concat(ce,"px"),K(nt())}}})),window.addEventListener("mouseup",(function(t){if(v&&0===t.button){if(T=!1,M){var e=parseInt(M.dataset.index,10);isNaN(e)||(W[e].x=parseInt(M.style.left,10),W[e].y=parseInt(M.style.top,10)),M=null,D=!1,z.push(JSON.parse(JSON.stringify(W))),tt()}if(Z){var n;Z=!1;var i=null===(n=window._captureTempData)||void 0===n?void 0:n.cropRegion,o=P.lineWidth/2,a=Math.min(Math.max(t.clientX,i.x+1),i.x+i.width-1),m=Math.min(Math.max(t.clientY,i.y+1),i.y+i.height-1),y=Math.min(E,a)-o,w=Math.min(H,m)-o,b=Math.abs(a-E)+2*o,x=Math.abs(m-H)+2*o;return"pen"===L?(W.push({mode:"pen",path:window._currentPenPath||[],color:P.strokeColor,width:P.lineWidth}),window._currentPenPath=null):"arrow"===L?W.push({mode:"arrow",x1:E,y1:H,x2:a,y2:m,color:P.strokeColor,width:P.lineWidth}):"mosaic"===L?(W.push({mode:"mosaic",path:window._currentPenPath||[],width:P.lineWidth}),window._currentPenPath=null):W.push({mode:L,x:y,y:w,w:b,h:x,color:P.strokeColor,width:P.lineWidth}),tt(),$(),f&&f.clearRect(0,0,g.width,g.height),z.push(JSON.parse(JSON.stringify(W))),void tt()}if(A){A=!1,O.style.display="none";var I=nt();if(c===r&&l===d);else{window._captureTempData={cropRegion:I,thumbnailSize:u,currentWindowIndex:X};var S=Math.min(c,r),C=Math.min(l,d),k=Math.abs(r-c),N=Math.abs(d-l);if(!R){(R=ot("canvas",null,{position:"fixed",left:"0",top:"0",pointerEvents:"none",zIndex:9985})).id="markupCanvas",R.width=window.innerWidth,R.height=window.innerHeight,document.body.appendChild(R),j=R.getContext("2d");var B=document.createElement("div");B.id="markup-container",B.style.cssText="\\n position: fixed;\\n left: 0;\\n top: 0;\\n width: 100%;\\n height: 100%;\\n z-index: 9986;\\n pointer-events: none;\\n ",document.body.appendChild(B),window._markupContainer=B,g||((g=ot("canvas","previewCanvas",{position:"fixed",left:"0",top:"0",pointerEvents:"none",zIndex:9986})).width=window.innerWidth,g.height=window.innerHeight,document.body.appendChild(g),f=g.getContext("2d"))}J.style.display="block",it(S,C,k,N),Y=!0,s.style.opacity="",s.style.boxShadow="",h.send(p("screenshot-window-lock"),X)}}}})),document.addEventListener("contextmenu",(function(t){if(t.preventDefault(),Y){if(W.length>0)return;if(L)return;return Y=!1,s&&(s.remove(),s=null),window._captureMaskCanvas&&(window._captureMaskCanvas.remove(),window._captureMaskCanvas=null,window._captureMaskCtx=null),j&&j.clearRect(0,0,R.width,R.height),J.style.display="none",F(),O.style.display="block",void h.send(p("screenshot-window-unlock"))}q()})),document.addEventListener("keydown",(function(t){"Escape"===t.key&&q()})),J.addEventListener("click",(function(t){var e=t.target.closest("button[data-action]");if(e){var n=e.dataset.action;if("cancel"===n&&q(),"confirm"===n&&rt(),"text"===n){var i=document.getElementById("text-config-panel");if("text"===L)L=null,i.style.display="none",$();else{L="text",F(),et(i,e),i.style.display="block";var o=i.querySelectorAll(".color-block");o.forEach((function(t){t.addEventListener("click",(function(){o.forEach((function(t){return t.classList.remove("selected")})),t.classList.add("selected"),P.strokeColor=t.dataset.color}))})),s&&(s.style.cursor="default"),document.getElementById("textFontSize").value=P.fontSize,document.getElementById("textFontSize").addEventListener("change",(function(t){P.fontSize=parseInt(t.target.value,10)}))}}if(["rect","ellipse","arrow","pen","mosaic"].includes(n))if(document.getElementById("text-config-panel").style.display="none",L===n)L=null,F(),$();else if(L=n,function(t){var e=document.getElementById("draw-config-panel");et(e,t),e.style.display="block";var n=document.getElementById("colorOptions");n&&(n.style.display="mosaic"===L?"none":"flex"),document.querySelectorAll("#colorOptions .color-block").forEach((function(t){t.classList.toggle("selected",t.dataset.color.toLowerCase()===P.strokeColor.toLowerCase())})),document.querySelectorAll("#lineWidthOptions .line-dot").forEach((function(t){t.classList.toggle("selected",parseInt(t.dataset.width)===P.lineWidth)}))}(e),"mosaic"===L){var a=ct(P.lineWidth);document.body.style.cursor="url(".concat(a,") ").concat(2*P.lineWidth," ").concat(2*P.lineWidth,", auto"),s&&(s.style.cursor="url(".concat(a,") ").concat(2*P.lineWidth," ").concat(2*P.lineWidth,", auto"))}else document.body.style.cursor="default",s&&(s.style.cursor="default");if("undo"===n&&z.length>0){z.pop();var c=z[z.length-1]||[];W=JSON.parse(JSON.stringify(c)),$(),tt()}if("download"===n){var l=lt();l&&h.invoke(p("save-capture-image"),{base64Data:l,windowIndex:X}).then((function(t){t?q():console.log("用户取消保存,保持截图状态")}))}}})),document.addEventListener("dblclick",(function(t){var e;if(v&&Y){var n=null===(e=window._captureTempData)||void 0===e?void 0:e.cropRegion;if(n){var i=t.clientX,o=t.clientY;i>=n.x&&i<=n.x+n.width&&o>=n.y&&o<=n.y+n.height&&rt()}}})),CaptureApp={}})();<\/script></body>\r\n</html>\r\n'},781:(t,e,n)=>{function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(){"use strict";i=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",d=a.toStringTag||"@@toStringTag";function s(t,e,n,o){return Object.defineProperty(t,e,{value:n,enumerable:!o,configurable:!o,writable:!o})}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function u(e,n,o,i){var r=n&&n.prototype instanceof f?n:f,a=Object.create(r.prototype);return s(a,"_invoke",function(e,n,o){var i=1;return function(r,a){if(3===i)throw Error("Generator is already running");if(4===i){if("throw"===r)throw a;return{value:t,done:!0}}for(o.method=r,o.arg=a;;){var c=o.delegate;if(c){var l=M(c,o);if(l){if(l===p)continue;return l}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(1===i)throw i=4,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);i=3;var d=h(e,n,o);if("normal"===d.type){if(i=o.done?4:2,d.arg===p)continue;return{value:d.arg,done:o.done}}"throw"===d.type&&(i=4,o.method="throw",o.arg=d.arg)}}}(e,o,new C(i||[])),!0),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=u;var p={};function f(){}function g(){}function y(){}var m={};s(m,c,(function(){return this}));var v=Object.getPrototypeOf,w=v&&v(v(D([])));w&&w!==n&&r.call(w,c)&&(m=w);var b=y.prototype=f.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function n(i,a,c,l){var d=h(t[i],t,a);if("throw"!==d.type){var s=d.arg,u=s.value;return u&&"object"==o(u)&&r.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,c,l)}),(function(t){n("throw",t,c,l)})):e.resolve(u).then((function(t){s.value=t,c(s)}),(function(t){return n("throw",t,c,l)}))}l(d.arg)}var i;s(this,"_invoke",(function(t,o){function r(){return new e((function(e,i){n(t,o,e,i)}))}return i=i?i.then(r,r):r()}),!0)}function M(e,n){var o=n.method,i=e.i[o];if(i===t)return n.delegate=null,"throw"===o&&e.i.return&&(n.method="return",n.arg=t,M(e,n),"throw"===n.method)||"return"!==o&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+o+"' method")),p;var r=h(i,e.i,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,p;var a=r.arg;return a?a.done?(n[e.r]=a.value,n.next=e.n,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function S(t){this.tryEntries.push(t)}function k(e){var n=e[4]||{};n.type="normal",n.arg=t,e[4]=n}function C(t){this.tryEntries=[[-1]],t.forEach(S,this),this.reset(!0)}function D(e){if(null!=e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}throw new TypeError(o(e)+" is not iterable")}return g.prototype=y,s(b,"constructor",y),s(y,"constructor",g),g.displayName=s(y,d,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,d,"GeneratorFunction")),t.prototype=Object.create(b),t},e.awrap=function(t){return{__await:t}},x(I.prototype),s(I.prototype,l,(function(){return this})),e.AsyncIterator=I,e.async=function(t,n,o,i,r){void 0===r&&(r=Promise);var a=new I(u(t,n,o,i),r);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(b),s(b,d,"Generator"),s(b,c,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var o in e)n.unshift(o);return function t(){for(;n.length;)if((o=n.pop())in e)return t.value=o,t.done=!1,t;return t.done=!0,t}},e.values=D,C.prototype={constructor:C,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(t){a.type="throw",a.arg=e,n.next=t}for(var i=n.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],a=r[4],c=this.prev,l=r[1],d=r[2];if(-1===r[0])return o("end"),!1;if(!l&&!d)throw Error("try statement without catch or finally");if(null!=r[0]&&r[0]<=c){if(c<l)return this.method="next",this.arg=t,o(l),!0;if(c<d)return o(d),!1}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o[0]>-1&&o[0]<=this.prev&&this.prev<o[2]){var i=o;break}}i&&("break"===t||"continue"===t)&&i[0]<=e&&e<=i[2]&&(i=null);var r=i?i[4]:{};return r.type=t,r.arg=e,i?(this.method="next",this.next=i[2],p):this.complete(r)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[2]===t)return this.complete(n[4],n[3]),k(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]===t){var o=n[4];if("throw"===o.type){var i=o.arg;k(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,o){return this.delegate={i:D(e),r:n,n:o},"next"===this.method&&(this.arg=t),p}},e}function r(t,e,n,o,i,r,a){try{var c=t[r](a),l=c.value}catch(t){return void n(t)}c.done?e(l):Promise.resolve(l).then(o,i)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function c(t){r(a,o,i,c,l,"next",t)}function l(t){r(a,o,i,c,l,"throw",t)}c(void 0)}))}}n(928);var c=n(896),l=function(t){return"screenshot-plugin/".concat(t)},d=[];function s(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"zh",o=t.screen,i=t.BrowserWindow;return o.getAllDisplays().forEach((function(t){var o=t.bounds,r=o.width,a=o.height,c=o.x,l=o.y,s=new i({width:r,height:a,x:c,y:l,frame:!1,transparent:!0,fullscreen:!1,alwaysOnTop:!0,resizable:!1,movable:!1,skipTaskbar:!0,focusable:!0,webPreferences:{webSecurity:!1,nodeIntegration:!0,contextIsolation:!1}});s.setBounds({x:c,y:l,width:r,height:a}),s.setAlwaysOnTop(!0,"screen-saver"),s._captureLang=n,s.captureWindowIndex=t.id,s.setOpacity(0),s.loadURL(e),s.hide(),s.on("close",(function(t){t.preventDefault(),s.hide()})),d.push(s)})),d}var u=n(641),h=Buffer.from(u,"utf-8").toString("base64"),p="data:text/html;base64,".concat(h);function f(){return f=a(i().mark((function t(e){var n,o,r,u,h,f,g,y,m,v;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=e.electron,u=r.ipcMain,h=r.screen,f=r.desktopCapturer,g=r.BrowserWindow,y=r.dialog,m=!1,v=function(){var t,n;m||(s(e.electron,p,(null===(t=e.config)||void 0===t?void 0:t.lang)||"zh"),null===(n=e.logger)||void 0===n||n.call(e,"[plugin] window created"),m=!0)},e.ipc.registerCommand("screenshot.prepareWindows",v),e.exports={prepareCaptureWindow:v,onCaptureDone:void 0,onCaptureCancel:void 0},null===(n=e.logger)||void 0===n||n.call(e,"[screenshot-plugin] begin register ipc"),u.on(l("capture-window-ready"),(function(t){var n=g.fromWebContents(t.sender),o=d.findIndex((function(t){return t===n}));if(-1!==o){var i,r=h.getAllDisplays()[o];n.webContents.send(l("set-window-index"),r.id),n.webContents.send(l("set-main-color"),(null===(i=e.config)||void 0===i?void 0:i.color)||"#07c160")}})),u.on(l("screenshot-window-lock"),(function(t,e){d.forEach((function(t,n){var o=n===e;t.webContents.send(l("screenshot-lock-state"),{locked:!0,isSelf:o})}))})),u.on(l("screenshot-window-unlock"),(function(){d.forEach((function(t){t.webContents.send(l("screenshot-lock-state"),{locked:!1,isSelf:!1})}))})),u.on(l("request-capture"),function(){var t=a(i().mark((function t(e,n){var o,r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.getAllDisplays(),r={types:["screen"]},t.next=4,Promise.all(o.map(function(){var t=a(i().mark((function t(e){var n,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r.thumbnailSize=e.size,t.next=3,f.getSources(r);case 3:return n=t.sent,o=n.find((function(t){return t.name===e.id.toString()||t.display_id===e.id.toString()})),t.abrupt("return",o?o.thumbnail.toDataURL():null);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 4:t.sent.forEach((function(t,e){var n=d[e],i=o[e].scaleFactor;t&&n&&(n.webContents.removeAllListeners("did-finish-load"),n.webContents.once("did-finish-load",(function(){n.setOpacity(1),n.showInactive(),n.webContents.send(l("display-screenshot"),t,i,o[e].size),n.webContents.send(l("set-lang"),n._captureLang||"zh")})),n.loadURL(p))}));case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),u.on(l("capture-done"),(function(t,n){var o,i;d.forEach((function(t){t.setOpacity(0),t.hide()})),null===(o=e.exports)||void 0===o||null===(i=o.onCaptureDone)||void 0===i||i.call(o,n)})),u.on(l("capture-cancel"),(function(){d.forEach((function(t){t.setOpacity(0),t.hide()}))})),u.handle(l("save-capture-image"),function(){var t=a(i().mark((function t(e,n){var o,r,a,l,d,s,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n.base64Data,r=n.windowIndex,a=g.getAllWindows(),l=a.find((function(t){return t.captureWindowIndex===r})),t.next=5,y.showSaveDialog(l,{title:"保存截图",defaultPath:"screenshot-".concat(Date.now(),".png"),filters:[{name:"PNG 图片",extensions:["png"]}],modal:!0,alwaysOnTop:!0});case 5:if(!(d=t.sent).canceled){t.next=8;break}return t.abrupt("return",!1);case 8:if(!(s=d.filePath)){t.next=13;break}return u=o.replace(/^data:image\/\w+;base64,/,""),c.writeFileSync(s,u,"base64"),t.abrupt("return",!0);case 13:return t.abrupt("return",!1);case 14:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),u.on(l("check-display"),(function(t,e){var n=h.getAllDisplays(),o=null;n.forEach((function(t){var n=t.bounds,i=n.x,r=n.y,a=n.width,c=n.height;e.x>=i&&e.x<=i+a&&e.y>=r&&e.y<=r+c&&(o=t)})),d.forEach((function(t){var e,n,i,r=(null===(e=o)||void 0===e?void 0:e.id)===t.displayId;t.webContents.send(l("highlight-border"),null!==(n=null===(i=o)||void 0===i?void 0:i.id)&&void 0!==n?n:null),r&&o&&t.webContents.send(l("set-crop-limit"),o.bounds)}))})),u.handle(l("get-screenshot"),function(){var t=a(i().mark((function t(n,o){var r,a,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,f.getSources(o);case 3:return r=t.sent,a=r.find((function(t){return String(t.display_id)===String(o.currentWindowIndex)})),t.abrupt("return",a?a.thumbnail.toDataURL():null);case 8:return t.prev=8,t.t0=t.catch(0),null===(c=e.logger)||void 0===c||c.call(e,"[screenshot-plugin] screenshot fail:"+t.t0.message),t.abrupt("return",null);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,n){r