react-screenshots 0.5.16 → 0.5.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/electron/assets/index.0d61ff16.js +222 -0
  2. package/electron/assets/index.78c5dcbf.css +1 -0
  3. package/electron/electron.html +14 -0
  4. package/lib/react-screenshots.cjs.js +14 -0
  5. package/lib/react-screenshots.es.js +3166 -0
  6. package/lib/style.css +1 -0
  7. package/lib/types/ScreenshotsBackground/getBoundsByPoints.d.ts +2 -0
  8. package/lib/types/ScreenshotsBackground/index.d.ts +4 -0
  9. package/lib/types/ScreenshotsButton/index.d.ts +12 -0
  10. package/lib/types/ScreenshotsCanvas/getBoundsByPoints.d.ts +2 -0
  11. package/lib/types/ScreenshotsCanvas/getPoints.d.ts +2 -0
  12. package/lib/types/ScreenshotsCanvas/index.d.ts +15 -0
  13. package/lib/types/ScreenshotsCanvas/isPointInDraw.d.ts +2 -0
  14. package/lib/types/ScreenshotsColor/index.d.ts +8 -0
  15. package/lib/types/ScreenshotsContext.d.ts +29 -0
  16. package/lib/types/ScreenshotsMagnifier/index.d.ts +8 -0
  17. package/lib/types/ScreenshotsOperations/index.d.ts +6 -0
  18. package/lib/types/ScreenshotsOption/index.d.ts +15 -0
  19. package/lib/types/ScreenshotsSize/index.d.ts +8 -0
  20. package/lib/types/ScreenshotsSizeColor/index.d.ts +10 -0
  21. package/lib/types/ScreenshotsTextarea/calculateNodeSize.d.ts +17 -0
  22. package/lib/types/ScreenshotsTextarea/index.d.ts +15 -0
  23. package/lib/types/composeImage.d.ts +10 -0
  24. package/lib/types/exports.d.ts +3 -0
  25. package/lib/types/hooks/useBounds.d.ts +7 -0
  26. package/lib/types/hooks/useCall.d.ts +2 -0
  27. package/lib/types/hooks/useCanvasContextRef.d.ts +2 -0
  28. package/lib/types/hooks/useCanvasMousedown.d.ts +1 -0
  29. package/lib/types/hooks/useCanvasMousemove.d.ts +1 -0
  30. package/lib/types/hooks/useCanvasMouseup.d.ts +1 -0
  31. package/lib/types/hooks/useCursor.d.ts +6 -0
  32. package/lib/types/hooks/useDispatcher.d.ts +2 -0
  33. package/lib/types/hooks/useDrawSelect.d.ts +2 -0
  34. package/lib/types/hooks/useEmiter.d.ts +8 -0
  35. package/lib/types/hooks/useHistory.d.ts +16 -0
  36. package/lib/types/hooks/useLang.d.ts +2 -0
  37. package/lib/types/hooks/useOperation.d.ts +6 -0
  38. package/lib/types/hooks/useReset.d.ts +2 -0
  39. package/lib/types/hooks/useStore.d.ts +2 -0
  40. package/lib/types/index.d.ts +13 -0
  41. package/lib/types/operations/Arrow/draw.d.ts +11 -0
  42. package/lib/types/operations/Arrow/index.d.ts +22 -0
  43. package/lib/types/operations/Brush/draw.d.ts +3 -0
  44. package/lib/types/operations/Brush/index.d.ts +14 -0
  45. package/lib/types/operations/Cancel/index.d.ts +2 -0
  46. package/lib/types/operations/Ellipse/draw.d.ts +11 -0
  47. package/lib/types/operations/Ellipse/index.d.ts +28 -0
  48. package/lib/types/operations/Mosaic/index.d.ts +11 -0
  49. package/lib/types/operations/Ok/index.d.ts +2 -0
  50. package/lib/types/operations/Rectangle/draw.d.ts +11 -0
  51. package/lib/types/operations/Rectangle/index.d.ts +28 -0
  52. package/lib/types/operations/Redo/index.d.ts +2 -0
  53. package/lib/types/operations/Save/index.d.ts +2 -0
  54. package/lib/types/operations/Text/index.d.ts +22 -0
  55. package/lib/types/operations/Undo/index.d.ts +2 -0
  56. package/lib/types/operations/index.d.ts +3 -0
  57. package/lib/types/operations/utils.d.ts +4 -0
  58. package/lib/types/types.d.ts +39 -0
  59. package/lib/types/useGetLoadedImage.d.ts +1 -0
  60. package/lib/types/zh_CN.d.ts +16 -0
  61. package/package.json +4 -4
@@ -0,0 +1 @@
1
+ @font-face{font-family:screenshots-icon;src:url(data:font/woff2;base64,d09GMgABAAAAAAZYAAsAAAAADKgAAAYKAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDfAqKL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BDAHIAZQBhAHQAZQBkACAAYgB5ACAAaQBjAG8AbgBmAG8AbgB0AHMAYwByAGUAZQBuAHMAaABvAHQAcwAtAGkAYwBvAG4AUgBlAGcAdQBsAGEAcgBzAGMAcgBlAGUAbgBzAGgAbwB0AHMALQBpAGMAbwBuAHMAYwByAGUAZQBuAHMAaABvAHQAcwAtAGkAYwBvAG4AVgBlAHIAcwBpAG8AbgAgADEALgAwAHMAYwByAGUAZQBuAHMAaABvAHQAcwAtAGkAYwBvAG4ARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwBAgEDAQQBBQEGAQcBCAEJAQoBCwEMAQ0ABWFycm93BHNhdmUGbW9zYWljBHJlZG8EdW5kbwdlbGxpcHNlCXJlY3RhbmdsZQR0ZXh0BmNhbmNlbAJvawVicnVzaAAA) format("truetype")}[class^=icon-],[class*=" icon-"]{font-family:screenshots-icon!important;font-style:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-ok:before{content:"\e001"}.icon-cancel:before{content:"\e002"}.icon-save:before{content:"\e003"}.icon-redo:before{content:"\e004"}.icon-undo:before{content:"\e005"}.icon-mosaic:before{content:"\e006"}.icon-text:before{content:"\e007"}.icon-brush:before{content:"\e008"}.icon-arrow:before{content:"\e009"}.icon-ellipse:before{content:"\e00a"}.icon-rectangle:before{content:"\e00b"}.screenshots{position:relative;transform:translateZ(0);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji}.screenshots,.screenshots *{box-sizing:border-box;user-select:none}.screenshots-magnifier{position:absolute;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji;left:0;top:0;width:100px;box-shadow:0 0 8px #000;z-index:9}.screenshots-magnifier,.screenshots-magnifier *{box-sizing:border-box;user-select:none}.screenshots-magnifier-body{position:relative;background-color:#fff}.screenshots-magnifier-body:before{content:"";background-color:#0a72a1;position:absolute;top:50%;left:0;width:100%;height:2px;z-index:1}.screenshots-magnifier-body:after{content:"";background-color:#0a72a1;position:absolute;top:0;left:50%;width:2px;height:100%;z-index:1}.screenshots-magnifier-body-canvas{display:block;width:100px;height:80px}.screenshots-magnifier-footer{height:40px;color:#fff;font-size:11px;background-color:#5f5e5e;padding:4px;white-space:nowrap;overflow:hidden;text-align:center}.screenshots-magnifier-footer-item{height:18px;line-height:18px}.screenshots-background{width:100%;height:100%;position:relative}.screenshots-background-image{width:100%;height:100%;display:block;border:none;outline:none;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;-webkit-font-smooting:antialiased}.screenshots-background-mask{width:100%;height:100%;position:absolute;top:0;right:0;bottom:0;left:0;background-color:#0000004d}.screenshots-canvas{position:absolute;left:0;top:0;will-change:width,height,transform}.screenshots-canvas-body,.screenshots-canvas-mask{width:100%;height:100%;position:absolute;top:0;right:0;bottom:0;left:0;overflow:hidden}.screenshots-canvas-image{display:block;border:none;outline:none;will-change:transform;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;-webkit-font-smooting:antialiased}.screenshots-canvas-panel{width:100%;height:100%;position:absolute;left:0;top:0;right:0;bottom:0;will-change:width,height}.screenshots-canvas-border-top{position:absolute;left:0;top:0;width:100%;height:2px;transform:translateY(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-border-right{position:absolute;left:100%;top:0;width:2px;height:100%;transform:translate(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-border-bottom{position:absolute;left:0;top:100%;width:100%;height:2px;transform:translateY(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-border-left{position:absolute;left:0;top:0;width:2px;height:100%;transform:translate(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-point-top{width:8px;height:8px;position:absolute;left:50%;top:0;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ns-resize}.screenshots-canvas-point-top-right{width:8px;height:8px;position:absolute;left:100%;top:0;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nesw-resize}.screenshots-canvas-point-right{width:8px;height:8px;position:absolute;left:100%;top:50%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ew-resize}.screenshots-canvas-point-right-bottom{width:8px;height:8px;position:absolute;left:100%;top:100%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nwse-resize}.screenshots-canvas-point-bottom{width:8px;height:8px;position:absolute;left:50%;top:100%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ns-resize}.screenshots-canvas-point-bottom-left{width:8px;height:8px;position:absolute;left:0;top:100%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nesw-resize}.screenshots-canvas-point-left{width:8px;height:8px;position:absolute;left:0;top:50%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ew-resize}.screenshots-canvas-point-left-top{width:8px;height:8px;position:absolute;left:0;top:0;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nwse-resize}.screenshots-option{position:absolute;left:0;top:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji}.screenshots-option,.screenshots-option *{box-sizing:border-box;user-select:none}.screenshots-option-container{height:34px;padding:3px;border-radius:2px;border:1px solid #ddd;background-color:#fff}.screenshots-option-arrow{position:absolute;border:6px solid transparent}.screenshots-option[data-placement=top]{transform:translate(-50%,-11px)}.screenshots-option[data-placement=top] .screenshots-option-arrow{transform:translate(-50%,-1px);border-top-color:#fff;top:100%;left:50%}.screenshots-option[data-placement=bottom]{transform:translate(-50%,11px)}.screenshots-option[data-placement=bottom] .screenshots-option-arrow{transform:translate(-50%,1px);border-bottom-color:#fff;bottom:100%;left:50%}.screenshots-button{width:26px;height:26px;line-height:26px;color:#333;font-size:18px;text-align:center;margin:0 3px;vertical-align:middle;cursor:pointer}.screenshots-button-checked,.screenshots-button:hover{background-color:#eee;outline:1px solid #777}.screenshots-button-disabled{color:#bbb;cursor:not-allowed}.screenshots-button-disabled:hover{background-color:#fff;outline:none}.screenshots-size{height:24px;display:flex;align-items:center}.screenshots-size-item{width:24px;height:24px;position:relative;margin:0 3px;cursor:pointer}.screenshots-size-pointer{background-color:#555;border-radius:50%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.screenshots-size-active>.screenshots-size-pointer{background-color:#39f}.screenshots-color{height:24px;display:flex;align-items:center}.screenshots-color-item{border:1px solid #777;width:24px;height:24px;cursor:pointer;position:relative;margin:0 3px}.screenshots-color-item:before{content:"";display:none;position:absolute;right:0;bottom:0;width:10px;height:10px;background-color:#333}.screenshots-color-item:after{content:"";display:none;width:8px;height:4px;position:absolute;right:5px;bottom:5px;border-bottom:2px solid #fff;border-left:2px solid #fff;transform:translate(5px,2px) rotate(-45deg) scale(.8)}.screenshots-color-active:before,.screenshots-color-active:after{display:block}.screenshots-sizecolor{height:24px;display:flex;align-items:center}.screenshots-textarea{box-sizing:border-box;position:absolute;left:0;top:0;margin:0;padding:0;background-color:transparent;border:2px solid #39f;resize:none;outline:none;white-space:nowrap;word-break:break-all;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji;text-align:left}.screenshots-operations{position:absolute;left:0;top:0;will-change:transform}.screenshots-operations-buttons{display:flex;align-items:center;padding:3px;border-radius:2px;border:1px solid #ddd;background-color:#fff;overflow:hidden}.screenshots-operations-divider{background-color:#ddd;width:1px;height:26px;margin:0 3px}html,body,#app{height:100%;margin:0;padding:0;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.body{height:100%}
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>react-screenshots</title>
7
+ <script type="module" crossorigin src="./assets/index.0d61ff16.js"></script>
8
+ <link rel="stylesheet" href="./assets/index.78c5dcbf.css">
9
+ </head>
10
+ <body>
11
+ <div id="app"></div>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,14 @@
1
+ "use strict";var i=require("react"),De=require("react-dom");function Fe(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var _=Fe(i),D=(e=>(e[e.Edit=0]="Edit",e[e.Source=1]="Source",e))(D||{});function fe({image:e,width:t,height:o,history:a,bounds:s}){return new Promise((r,n)=>{const c=document.createElement("canvas"),p=s.width*window.devicePixelRatio,d=s.height*window.devicePixelRatio;c.width=p,c.height=d;const l=c.getContext("2d");if(!l)return n(new Error("convert image to blob fail"));const u=e.naturalWidth/t,f=e.naturalHeight/o;l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="low",l.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),l.clearRect(0,0,s.width,s.height),l.drawImage(e,s.x*u,s.y*f,s.width*u,s.height*f,0,0,s.width,s.height),a.stack.slice(0,a.index+1).forEach(h=>{h.type===D.Source&&h.draw(l,h)}),c.toBlob(h=>{if(!h)return n(new Error("canvas toBlob fail"));r(h)},"image/png")})}const Me={magnifier_position_label:"\u5750\u6807",operation_ok_title:"\u786E\u5B9A",operation_cancel_title:"\u53D6\u6D88",operation_save_title:"\u4FDD\u5B58",operation_redo_title:"\u91CD\u505A",operation_undo_title:"\u64A4\u9500",operation_mosaic_title:"\u9A6C\u8D5B\u514B",operation_text_title:"\u6587\u672C",operation_brush_title:"\u753B\u7B14",operation_arrow_title:"\u7BAD\u5934",operation_ellipse_title:"\u692D\u5706",operation_rectangle_title:"\u77E9\u5F62"};var ye=_.default.createContext({store:{url:void 0,image:null,width:0,height:0,lang:Me,emiterRef:{current:{}},canvasContextRef:{current:null},history:{index:-1,stack:[]},bounds:null,cursor:"move",operation:void 0},dispatcher:{call:void 0,setHistory:void 0,setBounds:void 0,setCursor:void 0,setOperation:void 0}});function re(){const{dispatcher:e}=i.useContext(ye);return e}function P(){const{store:e}=i.useContext(ye);return e}function q(){const{bounds:e}=P(),{setBounds:t}=re(),o=i.useCallback(s=>{t==null||t(s)},[t]),a=i.useCallback(()=>{t==null||t(null)},[t]);return[e,{set:o,reset:a}]}function U(){const{lang:e}=P();return e}var W="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsMagnifier\\index.tsx";const O=100,V=80;var je=i.memo(function({x:t,y:o}){const{width:a,height:s,image:r}=P(),n=U(),[c,p]=i.useState(null),d=i.useRef(null),l=i.useRef(null),u=i.useRef(null),[f,h]=i.useState("000000");return i.useLayoutEffect(()=>{if(!d.current)return;const b=d.current.getBoundingClientRect();let y=t+20,C=o+20;y+b.width>a&&(y=t-b.width-20),C+b.height>s&&(C=o-b.height-20),y<0&&(y=0),C<0&&(C=0),p({x:y,y:C})},[a,s,t,o]),i.useEffect(()=>{if(!r||!l.current){u.current=null;return}if(u.current||(u.current=l.current.getContext("2d")),!u.current)return;const b=u.current;b.clearRect(0,0,O,V);const y=r.naturalWidth/a,C=r.naturalHeight/s;b.drawImage(r,t*y-O/2,o*C-V/2,O,V,0,0,O,V);const{data:x}=b.getImageData(Math.floor(O/2),Math.floor(V/2),1,1),S=Array.from(x.slice(0,3)).map(w=>w>=16?w.toString(16):`0${w.toString(16)}`).join("").toUpperCase();h(S)},[a,s,r,t,o]),_.default.createElement("div",{ref:d,className:"screenshots-magnifier",style:{transform:`translate(${c==null?void 0:c.x}px, ${c==null?void 0:c.y}px)`},__self:this,__source:{fileName:W,lineNumber:89,columnNumber:5}},_.default.createElement("div",{className:"screenshots-magnifier-body",__self:this,__source:{fileName:W,lineNumber:96,columnNumber:7}},_.default.createElement("canvas",{ref:l,className:"screenshots-magnifier-body-canvas",width:O,height:V,__self:this,__source:{fileName:W,lineNumber:97,columnNumber:9}})),_.default.createElement("div",{className:"screenshots-magnifier-footer",__self:this,__source:{fileName:W,lineNumber:104,columnNumber:7}},_.default.createElement("div",{className:"screenshots-magnifier-footer-item",__self:this,__source:{fileName:W,lineNumber:105,columnNumber:9}},n.magnifier_position_label,": (",t,",",o,")"),_.default.createElement("div",{className:"screenshots-magnifier-footer-item",__self:this,__source:{fileName:W,lineNumber:108,columnNumber:9}},"RGB: #",f)))});function Ue({x:e,y:t},{x:o,y:a},s,r){return e>o&&([e,o]=[o,e]),t>a&&([t,a]=[a,t]),e<0&&(e=0),o>s&&(o=s),t<0&&(t=0),a>r&&(a=r),{x:e,y:t,width:o-e,height:a-t}}var ae="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsBackground\\index.tsx",Ge=i.memo(function(){const{url:t,image:o,width:a,height:s}=P(),[r,n]=q(),c=i.useRef(null),p=i.useRef(null),d=i.useRef(!1),[l,u]=i.useState(null),f=i.useCallback((b,y)=>{if(!c.current)return;const{x:C,y:x}=c.current.getBoundingClientRect();n.set(Ue({x:b.x-C,y:b.y-x},{x:y.x-C,y:y.y-x},a,s))},[a,s,n]),h=i.useCallback(b=>{p.current||r||b.button!==0||(p.current={x:b.clientX,y:b.clientY},d.current=!1)},[r]);return i.useEffect(()=>{const b=C=>{if(c.current){const x=c.current.getBoundingClientRect();C.clientX<x.left||C.clientY<x.top||C.clientX>x.right||C.clientY>x.bottom?u(null):u({x:C.clientX-x.x,y:C.clientY-x.y})}!p.current||(f(p.current,{x:C.clientX,y:C.clientY}),d.current=!0)},y=C=>{!p.current||(d.current&&f(p.current,{x:C.clientX,y:C.clientY}),p.current=null,d.current=!1)};return window.addEventListener("mousemove",b),window.addEventListener("mouseup",y),()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",y)}},[f]),i.useLayoutEffect(()=>{(!o||r)&&u(null)},[o,r]),!t||!o?null:_.default.createElement("div",{ref:c,className:"screenshots-background",onMouseDown:h,__self:this,__source:{fileName:ae,lineNumber:120,columnNumber:5}},_.default.createElement("img",{className:"screenshots-background-image",src:t,__self:this,__source:{fileName:ae,lineNumber:121,columnNumber:7}}),_.default.createElement("div",{className:"screenshots-background-mask",__self:this,__source:{fileName:ae,lineNumber:122,columnNumber:7}}),l&&!r&&_.default.createElement(je,{x:l==null?void 0:l.x,y:l==null?void 0:l.y,__self:this,__source:{fileName:ae,lineNumber:123,columnNumber:31}}))});function A(){const{cursor:e}=P(),{setCursor:t}=re(),o=i.useCallback(s=>{t==null||t(s)},[t]),a=i.useCallback(()=>{t==null||t("move")},[t]);return[e,{set:o,reset:a}]}function J(){const{emiterRef:e}=P(),t=i.useCallback((r,n)=>{const c=e.current;Array.isArray(c[r])?c[r].push(n):c[r]=[n]},[e]),o=i.useCallback((r,n)=>{const c=e.current;if(Array.isArray(c[r])){const p=c[r].findIndex(d=>d===n);p!==-1&&c[r].splice(p,1)}},[e]),a=i.useCallback((r,...n)=>{const c=e.current;Array.isArray(c[r])&&c[r].forEach(p=>p(...n))},[e]),s=i.useCallback(()=>{e.current={}},[e]);return{on:t,off:o,emit:a,reset:s}}function X(){const{history:e}=P(),{setHistory:t}=re(),o=i.useCallback(l=>{const{index:u,stack:f}=e;f.forEach(h=>{h.type===D.Source&&(h.isSelected=!1)}),l.type===D.Source?l.isSelected=!0:l.type===D.Edit&&(l.source.isSelected=!0),f.splice(u+1),f.push(l),t==null||t({index:f.length-1,stack:f})},[e,t]),a=i.useCallback(()=>{const{stack:l}=e;l.pop(),t==null||t({index:l.length-1,stack:l})},[e,t]),s=i.useCallback(()=>{const{index:l,stack:u}=e,f=u[l];f&&(f.type===D.Source?f.isSelected=!1:f.type===D.Edit&&f.source.editHistory.pop()),t==null||t({index:l<=0?-1:l-1,stack:u})},[e,t]),r=i.useCallback(()=>{const{index:l,stack:u}=e,f=u[l+1];f&&(f.type===D.Source?f.isSelected=!1:f.type===D.Edit&&f.source.editHistory.push(f)),t==null||t({index:l>=u.length-1?u.length-1:l+1,stack:u})},[e,t]),n=i.useCallback(l=>{t==null||t({...l})},[t]),c=i.useCallback(l=>{e.stack.forEach(u=>{u.type===D.Source&&(u===l?u.isSelected=!0:u.isSelected=!1)}),t==null||t({...e})},[e,t]),p=i.useCallback(()=>{e.stack.forEach(l=>{l.type===D.Source&&(l.isSelected=!1)}),t==null||t({...e})},[e,t]),d=i.useCallback(()=>{t==null||t({index:-1,stack:[]})},[t]);return[{index:e.index,stack:e.stack,top:e.stack.slice(e.index,e.index+1)[0]},{push:o,pop:a,undo:s,redo:r,set:n,select:c,clearSelect:p,reset:d}]}function T(){const{operation:e}=P(),{setOperation:t}=re(),o=i.useCallback(s=>{t==null||t(s)},[t]),a=i.useCallback(()=>{t==null||t(void 0)},[t]);return[e,{set:o,reset:a}]}function Ae({x:e,y:t},{x:o,y:a},s,r,n,c){return e>o&&([e,o]=[o,e]),t>a&&([t,a]=[a,t]),e<0&&(e=0,c==="move"&&(o=s.width)),o>r&&(o=r,c==="move"&&(e=o-s.width)),t<0&&(t=0,c==="move"&&(a=s.height)),a>n&&(a=n,c==="move"&&(t=a-s.height)),{x:e,y:t,width:Math.max(o-e,1),height:Math.max(a-t,1)}}function Te(e,t,o,a){const s=e.clientX-o.x,r=e.clientY-o.y;let n=a.x,c=a.y,p=a.x+a.width,d=a.y+a.height;switch(t){case"top":c+=r;break;case"top-right":p+=s,c+=r;break;case"right":p+=s;break;case"right-bottom":p+=s,d+=r;break;case"bottom":d+=r;break;case"bottom-left":n+=s,d+=r;break;case"left":n+=s;break;case"left-top":n+=s,c+=r;break;case"move":n+=s,c+=r,p+=s,d+=r;break}return[{x:n,y:c},{x:p,y:d}]}function He(e,t,o,a){if(!t)return!1;const s=document.createElement("canvas");s.width=e.width,s.height=e.height;const r=s.getContext("2d");if(!r)return!1;const{left:n,top:c}=t.getBoundingClientRect(),p=a.clientX-n,d=a.clientY-c;return[...o.stack.slice(0,o.index+1)].reverse().find(u=>{var f;return u.type!==D.Source?!1:(r.clearRect(0,0,e.width,e.height),(f=u.isHit)==null?void 0:f.call(u,r,u,{x:p,y:d}))})}var I="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsCanvas\\index.tsx";const Ie=["top","right","bottom","left"],We=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];var Oe=i.memo(i.forwardRef(function(t,o){const{url:a,image:s,width:r,height:n}=P(),c=J(),[p]=X(),[d]=A(),[l,u]=q(),[f]=T(),h=i.useRef(),b=i.useRef(null),y=i.useRef(null),C=i.useRef(null),x=i.useRef(null),S=i.useCallback(()=>{if(!l||!x.current)return;const m=x.current;m.imageSmoothingEnabled=!0,m.imageSmoothingQuality="low",m.clearRect(0,0,l.width,l.height),p.stack.slice(0,p.index+1).forEach(v=>{v.type===D.Source&&v.draw(m,v)})},[l,x,p]),w=i.useCallback((m,v)=>{if(!(m.button!==0||!l))if(!f)h.current=v,b.current={x:m.clientX,y:m.clientY},y.current={x:l.x,y:l.y,width:l.width,height:l.height};else{const N=He(l,C.current,p,m.nativeEvent);N?c.emit("drawselect",N,m.nativeEvent):c.emit("mousedown",m.nativeEvent)}},[l,f,c,p]),g=i.useCallback(m=>{if(!h.current||!b.current||!y.current||!l)return;const v=Te(m,h.current,b.current,y.current);u.set(Ae(v[0],v[1],l,r,n,h.current))},[r,n,l,u]);return i.useLayoutEffect(()=>{if(!s||!l||!C.current){x.current=null;return}x.current||(x.current=C.current.getContext("2d")),S()},[s,l,S]),i.useEffect(()=>{const m=N=>{if(f)c.emit("mousemove",N);else{if(!h.current||!b.current||!y.current)return;g(N)}},v=N=>{if(f)c.emit("mouseup",N);else{if(!h.current||!b.current||!y.current)return;g(N),h.current=void 0,b.current=null,y.current=null}};return window.addEventListener("mousemove",m),window.addEventListener("mouseup",v),()=>{window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",v)}},[g,f,c]),i.useImperativeHandle(o,()=>x.current),_.default.createElement("div",{className:"screenshots-canvas",style:{width:(l==null?void 0:l.width)||0,height:(l==null?void 0:l.height)||0,transform:l?`translate(${l.x}px, ${l.y}px)`:"none"},__self:this,__source:{fileName:I,lineNumber:173,columnNumber:7}},_.default.createElement("div",{className:"screenshots-canvas-body",__self:this,__source:{fileName:I,lineNumber:181,columnNumber:9}},_.default.createElement("img",{className:"screenshots-canvas-image",src:a,style:{width:r,height:n,transform:l?`translate(${-l.x}px, ${-l.y}px)`:"none"},__self:this,__source:{fileName:I,lineNumber:183,columnNumber:11}}),_.default.createElement("canvas",{ref:C,className:"screenshots-canvas-panel",width:(l==null?void 0:l.width)||0,height:(l==null?void 0:l.height)||0,__self:this,__source:{fileName:I,lineNumber:192,columnNumber:11}})),_.default.createElement("div",{className:"screenshots-canvas-mask",style:{cursor:d},onMouseDown:m=>w(m,"move"),__self:this,__source:{fileName:I,lineNumber:199,columnNumber:9}}),Ie.map(m=>_.default.createElement("div",{key:m,className:`screenshots-canvas-border-${m}`,__self:this,__source:{fileName:I,lineNumber:207,columnNumber:18}})),l&&We.map(m=>_.default.createElement("div",{key:m,className:`screenshots-canvas-point-${m}`,onMouseDown:v=>w(v,m),__self:this,__source:{fileName:I,lineNumber:211,columnNumber:13}})))}));function Ne(){const e=re();return i.useCallback((o,...a)=>{var s;(s=e.call)==null||s.call(e,o,...a)},[e])}function H(){const{canvasContextRef:e}=P();return e}function Ce(){const e=J(),[,t]=q(),[,o]=A(),[,a]=X(),[,s]=T();return i.useCallback(()=>{e.reset(),a.reset(),t.reset(),o.reset(),s.reset()},[e,a,t,o,s])}var pe="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsOption\\index.tsx",Ve=i.memo(function({open:t,content:o,children:a}){var y,C;const s=i.useRef(null),r=i.useRef(null),n=i.useRef(null),c=i.useContext(Ye),[p,d]=i.useState("bottom"),[l,u]=i.useState(null),[f,h]=i.useState(0),b=()=>(r.current||(r.current=document.createElement("div")),r.current);return i.useEffect(()=>{const x=b();return t&&document.body.appendChild(x),()=>{x.remove()}},[t]),i.useEffect(()=>{if(!t||!c||!s.current||!n.current)return;const x=s.current.getBoundingClientRect(),S=n.current.getBoundingClientRect();let w=p,g=x.left+x.width/2,m=x.top+x.height,v=f;if(g+S.width/2>c.x+c.width){const N=g;g=c.x+c.width-S.width/2,v=N-g}if(g<c.x+S.width/2){const N=g;g=c.x+S.width/2,v=N-g}m>window.innerHeight-S.height&&(w==="bottom"&&(w="top"),m=x.top-S.height),m<0&&(w==="top"&&(w="bottom"),m=x.top+x.height),w!==p&&d(w),((l==null?void 0:l.x)!==g||l.y!==m)&&u({x:g,y:m}),v!==f&&h(v)}),_.default.createElement(_.default.Fragment,null,i.cloneElement(a,{ref:s}),t&&o&&De.createPortal(_.default.createElement("div",{ref:n,className:"screenshots-option",style:{visibility:l?"visible":"hidden",transform:`translate(${(y=l==null?void 0:l.x)!=null?y:0}px, ${(C=l==null?void 0:l.y)!=null?C:0}px)`},"data-placement":p,__self:this,__source:{fileName:pe,lineNumber:111,columnNumber:11}},_.default.createElement("div",{className:"screenshots-option-container",__self:this,__source:{fileName:pe,lineNumber:120,columnNumber:13}},o),_.default.createElement("div",{className:"screenshots-option-arrow",style:{marginLeft:f},__self:this,__source:{fileName:pe,lineNumber:121,columnNumber:13}})),b()))});var be="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsButton\\index.tsx",Y=i.memo(function({title:t,icon:o,checked:a,disabled:s,option:r,onClick:n}){const c=["screenshots-button"],p=i.useCallback(d=>{s||!n||n(d)},[s,n]);return a&&c.push("screenshots-button-checked"),s&&c.push("screenshots-button-disabled"),_.default.createElement(Ve,{open:a,content:r,__self:this,__source:{fileName:be,lineNumber:42,columnNumber:5}},_.default.createElement("div",{className:c.join(" "),title:t,onClick:p,__self:this,__source:{fileName:be,lineNumber:43,columnNumber:7}},_.default.createElement("span",{className:o,__self:this,__source:{fileName:be,lineNumber:44,columnNumber:9}})))}),qe="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Ok\\index.tsx";function Je(){const{image:e,width:t,height:o,history:a,bounds:s,lang:r}=P(),n=H(),[,c]=X(),p=Ne(),d=Ce(),l=i.useCallback(()=>{c.clearSelect(),setTimeout(()=>{!n.current||!e||!s||fe({image:e,width:t,height:o,history:a,bounds:s}).then(u=>{p("onOk",u,s),d()})})},[n,c,e,t,o,a,s,p,d]);return _.default.createElement(Y,{title:r.operation_ok_title,icon:"icon-ok",onClick:l,__self:this,__source:{fileName:qe,lineNumber:36,columnNumber:10}})}var Qe="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Cancel\\index.tsx";function Ke(){const e=Ne(),t=Ce(),o=U(),a=i.useCallback(()=>{e("onCancel"),t()},[e,t]);return _.default.createElement(Y,{title:o.operation_cancel_title,icon:"icon-cancel",onClick:a,__self:this,__source:{fileName:Qe,lineNumber:17,columnNumber:10}})}var Ze="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Save\\index.tsx";function et(){const{image:e,width:t,height:o,history:a,bounds:s,lang:r}=P(),n=H(),[,c]=X(),p=Ne(),d=Ce(),l=i.useCallback(()=>{c.clearSelect(),setTimeout(()=>{!n.current||!e||!s||fe({image:e,width:t,height:o,history:a,bounds:s}).then(u=>{p("onSave",u,s),d()})})},[n,c,e,t,o,a,s,p,d]);return _.default.createElement(Y,{title:r.operation_save_title,icon:"icon-save",onClick:l,__self:this,__source:{fileName:Ze,lineNumber:36,columnNumber:10}})}var tt="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Redo\\index.tsx";function nt(){const e=U(),[t,o]=X(),a=i.useCallback(()=>{o.redo()},[o]);return _.default.createElement(Y,{title:e.operation_redo_title,icon:"icon-redo",disabled:!t.stack.length||t.stack.length-1===t.index,onClick:a,__self:this,__source:{fileName:tt,lineNumber:15,columnNumber:5}})}var st="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Undo\\index.tsx";function rt(){const e=U(),[t,o]=X(),a=i.useCallback(()=>{o.undo()},[o]);return _.default.createElement(Y,{title:e.operation_undo_title,icon:"icon-undo",disabled:t.index===-1,onClick:a,__self:this,__source:{fileName:st,lineNumber:15,columnNumber:5}})}var ge="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsSize\\index.tsx",Be=i.memo(function({value:t,onChange:o}){const a=[3,6,9];return _.default.createElement("div",{className:"screenshots-size",__self:this,__source:{fileName:ge,lineNumber:12,columnNumber:5}},a.map(s=>{const r=["screenshots-size-item"];return s===t&&r.push("screenshots-size-active"),_.default.createElement("div",{key:s,className:r.join(" "),onClick:()=>o&&o(s),__self:this,__source:{fileName:ge,lineNumber:21,columnNumber:11}},_.default.createElement("div",{className:"screenshots-size-pointer",style:{width:s*1.8,height:s*1.8},__self:this,__source:{fileName:ge,lineNumber:22,columnNumber:13}}))}))});function Q(e){const t=J();i.useEffect(()=>(t.on("mousedown",e),()=>{t.off("mousedown",e)}),[e,t])}function K(e){const t=J();i.useEffect(()=>(t.on("mousemove",e),()=>{t.off("mousemove",e)}),[e,t])}function Z(e){const t=J();i.useEffect(()=>(t.on("mouseup",e),()=>{t.off("mouseup",e)}),[e,t])}var Se="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Mosaic\\index.tsx";function le(e,t,o){if(!o)return[0,0,0,0];const{data:a,width:s}=o,r=t*s*4+e*4;return Array.from(a.slice(r,r+4))}function ot(e,t){const{tiles:o,size:a}=t.data;o.forEach(s=>{const r=Math.round(s.color[0]),n=Math.round(s.color[1]),c=Math.round(s.color[2]),p=s.color[3]/255;e.fillStyle=`rgba(${r}, ${n}, ${c}, ${p})`,e.fillRect(s.x-a/2,s.y-a/2,a,a)})}function ct(){const e=U(),{image:t,width:o,height:a}=P(),[s,r]=T(),n=H(),[c,p]=X(),[d]=q(),[,l]=A(),[u,f]=i.useState(3),h=i.useRef(null),b=i.useRef(null),y=s==="Mosaic",C=i.useCallback(()=>{r.set("Mosaic"),l.set("crosshair")},[r,l]),x=i.useCallback(()=>{y||(C(),p.clearSelect())},[y,C,p]),S=i.useCallback(m=>{if(!y||b.current||!h.current||!n.current)return;const v=n.current.canvas.getBoundingClientRect(),N=m.clientX-v.x,k=m.clientY-v.y,z=u*2;b.current={name:"Mosaic",type:D.Source,data:{size:z,tiles:[{x:N,y:k,color:le(N,k,h.current)}]},editHistory:[],draw:ot}},[y,u,n]),w=i.useCallback(m=>{if(!y||!b.current||!n.current||!h.current)return;const v=n.current.canvas.getBoundingClientRect(),N=m.clientX-v.x,k=m.clientY-v.y,z=b.current.data.size,E=b.current.data.tiles;let R=E[E.length-1];if(!R)E.push({x:N,y:k,color:le(N,k,h.current)});else{const ie=R.x-N,M=R.y-k;let L=Math.sqrt(ie**2+M**2);const me=-M/L,de=-ie/L;for(;L>z;){const ee=Math.floor(R.x+z*de),te=Math.floor(R.y+z*me);R={x:ee,y:te,color:le(ee,te,h.current)},E.push(R),L-=z}L>z/2&&E.push({x:N,y:k,color:le(N,k,h.current)})}c.top!==b.current?p.push(b.current):p.set(c)},[y,n,c,p]),g=i.useCallback(()=>{!y||(b.current=null)},[y]);return Q(S),K(w),Z(g),i.useEffect(()=>{if(!d||!t||!y)return;const m=document.createElement("canvas"),v=m.getContext("2d");if(!v)return;m.width=d.width,m.height=d.height;const N=t.naturalWidth/o,k=t.naturalHeight/a;v.drawImage(t,d.x*N,d.y*k,d.width*N,d.height*k,0,0,d.width,d.height),h.current=v.getImageData(0,0,d.width,d.height)},[o,a,d,t,y]),_.default.createElement(Y,{title:e.operation_mosaic_title,icon:"icon-mosaic",checked:y,onClick:x,option:_.default.createElement(Be,{value:u,onChange:f,__self:this,__source:{fileName:Se,lineNumber:220,columnNumber:15}}),__self:this,__source:{fileName:Se,lineNumber:215,columnNumber:5}})}var ke="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsColor\\index.tsx",it=i.memo(function({value:t,onChange:o}){const a=["#ee5126","#fceb4d","#90e746","#51c0fa","#7a7a7a","#ffffff"];return _.default.createElement("div",{className:"screenshots-color",__self:this,__source:{fileName:ke,lineNumber:12,columnNumber:5}},a.map(s=>{const r=["screenshots-color-item"];return s===t&&r.push("screenshots-color-active"),_.default.createElement("div",{key:s,className:r.join(" "),style:{backgroundColor:s},onClick:()=>o&&o(s),__self:this,__source:{fileName:ke,lineNumber:19,columnNumber:11}})}))});var _e="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsSizeColor\\index.tsx",oe=i.memo(function({size:t,color:o,onSizeChange:a,onColorChange:s}){return _.default.createElement("div",{className:"screenshots-sizecolor",__self:this,__source:{fileName:_e,lineNumber:20,columnNumber:5}},_.default.createElement(Be,{value:t,onChange:a,__self:this,__source:{fileName:_e,lineNumber:21,columnNumber:7}}),_.default.createElement(it,{value:o,onChange:s,__self:this,__source:{fileName:_e,lineNumber:22,columnNumber:7}}))});const at=`
2
+ min-width: 0 !important;
3
+ width: 0 !important;
4
+ min-height: 0 !important;
5
+ height:0 !important;
6
+ visibility: hidden !important;
7
+ overflow: hidden !important;
8
+ position: absolute !important;
9
+ z-index: -1000 !important;
10
+ top:0 !important;
11
+ right:0 !important;
12
+ `,lt=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","text-indent","padding-left","padding-right","border-width","box-sizing","white-space","word-break"];let G;function ut(e){const t=window.getComputedStyle(e),o=t.getPropertyValue("box-sizing")||t.getPropertyValue("-moz-box-sizing")||t.getPropertyValue("-webkit-box-sizing"),a=parseFloat(t.getPropertyValue("padding-bottom"))+parseFloat(t.getPropertyValue("padding-top")),s=parseFloat(t.getPropertyValue("border-bottom-width"))+parseFloat(t.getPropertyValue("border-top-width"));return{sizingStyle:lt.map(n=>`${n}:${t.getPropertyValue(n)}`).join(";"),paddingSize:a,borderSize:s,boxSizing:o}}function ft(e,t,o,a){G||(G=document.createElement("textarea"),G.setAttribute("tab-index","-1"),document.body.appendChild(G));const{paddingSize:s,borderSize:r,boxSizing:n,sizingStyle:c}=ut(e);G.setAttribute("style",`${c};${at};max-width:${o}px;max-height:${a}px`),G.value=t||" ";let p=G.scrollWidth,d=G.scrollHeight;return n==="border-box"?(p+=r,d+=r):n==="content-box"&&(p-=s,d-=s),{width:Math.min(p,o),height:Math.min(d,a)}}var ht="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsTextarea\\index.tsx",mt=i.memo(function({x:t,y:o,maxWidth:a,maxHeight:s,size:r,color:n,value:c,onChange:p,onBlur:d}){const l=i.useRef(null),u=i.useRef(null),[f,h]=i.useState(0),[b,y]=i.useState(0),C=()=>(l.current||(l.current=document.createElement("div")),l.current);return i.useLayoutEffect(()=>(l.current&&(document.body.appendChild(l.current),requestAnimationFrame(()=>{var x;(x=u.current)==null||x.focus()})),()=>{var x;(x=l.current)==null||x.remove()}),[]),i.useLayoutEffect(()=>{if(!u.current)return;const{width:x,height:S}=ft(u.current,c,a,s);h(x),y(S)},[c,a,s]),De.createPortal(_.default.createElement("textarea",{ref:u,className:"screenshots-textarea",style:{color:n,width:f,height:b,maxWidth:a,maxHeight:s,fontSize:r,lineHeight:`${r}px`,transform:`translate(${t}px, ${o}px)`},value:c,onChange:x=>p&&p(x.target.value),onBlur:x=>d&&d(x),__self:this,__source:{fileName:ht,lineNumber:65,columnNumber:5}}),C())});function ce(e){const t=J();i.useEffect(()=>(t.on("drawselect",e),()=>{t.off("drawselect",e)}),[e,t])}var xe="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Text\\index.tsx";const ve={3:18,6:32,9:46};function dt(e,t){const{size:o,color:a,fontFamily:s,x:r,y:n,text:c}=t.data;e.fillStyle=a,e.textAlign="left",e.textBaseline="top",e.font=`${o}px ${s}`;const p=t.editHistory.reduce((d,{data:l})=>({x:d.x+l.x2-l.x1,y:d.y+l.y2-l.y1}),{x:0,y:0});c.split(`
13
+ `).forEach((d,l)=>{e.fillText(d,r+p.x,n+p.y+l*o)})}function pt(e,t,o){e.textAlign="left",e.textBaseline="top",e.font=`${t.data.size}px ${t.data.fontFamily}`;let a=0,s=0;t.data.text.split(`
14
+ `).forEach(u=>{const f=e.measureText(u);a<f.width&&(a=f.width),s+=t.data.size});const{x:r,y:n}=t.editHistory.reduce((u,{data:f})=>({x:u.x+f.x2-f.x1,y:u.y+f.y2-f.y1}),{x:0,y:0}),c=t.data.x+r,p=t.data.y+n,d=c+a,l=p+s;return o.x>=c&&o.x<=d&&o.y>=p&&o.y<=l}function bt(){const e=U(),[t,o]=X(),[a]=q(),[s,r]=T(),[,n]=A(),c=H(),[p,d]=i.useState(3),[l,u]=i.useState("#ee5126"),f=i.useRef(null),h=i.useRef(null),[b,y]=i.useState(null),[C,x]=i.useState(""),S=s==="Text",w=i.useCallback(()=>{r.set("Text"),n.set("default")},[r,n]),g=i.useCallback(()=>{S||(w(),o.clearSelect())},[S,w,o]),m=i.useCallback(M=>{f.current&&(f.current.data.size=ve[M]),d(M)},[]),v=i.useCallback(M=>{f.current&&(f.current.data.color=M),u(M)},[]),N=i.useCallback(M=>{x(M),S&&f.current&&(f.current.data.text=M)},[S]),k=i.useCallback(()=>{f.current&&f.current.data.text&&o.push(f.current),f.current=null,x(""),y(null)},[o]),z=i.useCallback((M,L)=>{M.name==="Text"&&(w(),h.current={type:D.Edit,data:{x1:L.clientX,y1:L.clientY,x2:L.clientX,y2:L.clientY},source:M},o.select(M))},[w,o]),E=i.useCallback(M=>{if(!S||!c.current||f.current||!a)return;const{left:L,top:me}=c.current.canvas.getBoundingClientRect(),de=window.getComputedStyle(c.current.canvas).fontFamily,ee=M.clientX-L,te=M.clientY-me;f.current={name:"Text",type:D.Source,data:{size:ve[p],color:l,fontFamily:de,x:ee,y:te,text:""},editHistory:[],draw:dt,isHit:pt},y({x:M.clientX,y:M.clientY,maxWidth:a.width-ee,maxHeight:a.height-te})},[S,p,l,a,c]),R=i.useCallback(M=>{!S||h.current&&(h.current.data.x2=M.clientX,h.current.data.y2=M.clientY,t.top!==h.current?(h.current.source.editHistory.push(h.current),o.push(h.current)):o.set(t))},[S,t,o]),ie=i.useCallback(()=>{!S||(h.current=null)},[S]);return ce(z),Q(E),K(R),Z(ie),_.default.createElement(_.default.Fragment,null,_.default.createElement(Y,{title:e.operation_text_title,icon:"icon-text",checked:S,onClick:g,option:_.default.createElement(oe,{size:p,color:l,onSizeChange:m,onColorChange:v,__self:this,__source:{fileName:xe,lineNumber:261,columnNumber:11}}),__self:this,__source:{fileName:xe,lineNumber:255,columnNumber:7}}),S&&b&&_.default.createElement(mt,{x:b.x,y:b.y,maxWidth:b.maxWidth,maxHeight:b.maxHeight,size:ve[p],color:l,value:C,onChange:N,onBlur:k,__self:this,__source:{fileName:xe,lineNumber:265,columnNumber:9}}))}const $e=4;function B(e,t,o){e.lineWidth=1,e.strokeStyle="#000000",e.fillStyle="#ffffff",e.beginPath(),e.arc(t,o,$e,0,2*Math.PI),e.fill(),e.stroke()}function he(e,t,o){t.draw(e,t);const{data:a}=e.getImageData(o.x,o.y,1,1);return a.some(s=>s!==0)}function $(e,t,o){if(!e)return!1;const{left:a,top:s}=e.getBoundingClientRect(),r=t.clientX-a,n=t.clientY-s;return(o.x-r)**2+(o.y-n)**2<$e**2}function gt(e,t){const{size:o,color:a,points:s}=t.data;e.lineCap="round",e.lineJoin="round",e.lineWidth=o,e.strokeStyle=a;const r=t.editHistory.reduce((n,{data:c})=>({x:n.x+c.x2-c.x1,y:n.y+c.y2-c.y1}),{x:0,y:0});e.beginPath(),s.forEach((n,c)=>{c===0?e.moveTo(n.x+r.x,n.y+r.y):e.lineTo(n.x+r.x,n.y+r.y)}),e.stroke(),t.isSelected&&(e.lineWidth=1,e.strokeStyle="#000000",e.beginPath(),s.forEach((n,c)=>{c===0?e.moveTo(n.x+r.x,n.y+r.y):e.lineTo(n.x+r.x,n.y+r.y)}),e.stroke())}var Re="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Brush\\index.tsx";function _t(){const e=U(),[,t]=A(),[o,a]=T(),s=H(),[r,n]=X(),[c,p]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),f=i.useRef(null),h=o==="Brush",b=i.useCallback(()=>{a.set("Brush"),t.set("default")},[a,t]),y=i.useCallback(()=>{h||(b(),n.clearSelect())},[h,b,n]),C=i.useCallback((g,m)=>{g.name==="Brush"&&(b(),f.current={type:D.Edit,data:{x1:m.clientX,y1:m.clientY,x2:m.clientX,y2:m.clientY},source:g},n.select(g))},[b,n]),x=i.useCallback(g=>{if(!h||u.current||!s.current)return;const{left:m,top:v}=s.current.canvas.getBoundingClientRect();u.current={name:"Brush",type:D.Source,data:{size:c,color:d,points:[{x:g.clientX-m,y:g.clientY-v}]},editHistory:[],draw:gt,isHit:he}},[h,s,c,d]),S=i.useCallback(g=>{if(!(!h||!s.current)){if(f.current)f.current.data.x2=g.clientX,f.current.data.y2=g.clientY,r.top!==f.current?(f.current.source.editHistory.push(f.current),n.push(f.current)):n.set(r);else if(u.current){const{left:m,top:v}=s.current.canvas.getBoundingClientRect();u.current.data.points.push({x:g.clientX-m,y:g.clientY-v}),r.top!==u.current?n.push(u.current):n.set(r)}}},[h,r,s,n]),w=i.useCallback(()=>{!h||(u.current&&n.clearSelect(),u.current=null,f.current=null)},[h,n]);return ce(C),Q(x),K(S),Z(w),_.default.createElement(Y,{title:e.operation_brush_title,icon:"icon-brush",checked:h,onClick:y,option:_.default.createElement(oe,{size:c,color:d,onSizeChange:p,onColorChange:l,__self:this,__source:{fileName:Re,lineNumber:166,columnNumber:15}}),__self:this,__source:{fileName:Re,lineNumber:161,columnNumber:5}})}function Pe(e){let{x1:t,y1:o,x2:a,y2:s}=e.data;return e.editHistory.forEach(({data:r})=>{const n=r.x2-r.x1,c=r.y2-r.y1;r.type===ue.Move?(t+=n,o+=c,a+=n,s+=c):r.type===ue.MoveStart?(t+=n,o+=c):r.type===ue.MoveEnd&&(a+=n,s+=c)}),{...e.data,x1:t,x2:a,y1:o,y2:s}}function xt(e,t){const{size:o,color:a,x1:s,x2:r,y1:n,y2:c}=Pe(t);e.lineCap="round",e.lineJoin="bevel",e.lineWidth=o,e.strokeStyle=a;const p=r-s,d=c-n,l=o*3,u=Math.atan2(d,p);e.beginPath(),e.moveTo(s,n),e.lineTo(r,c),e.lineTo(r-l*Math.cos(u-Math.PI/6),c-l*Math.sin(u-Math.PI/6)),e.moveTo(r,c),e.lineTo(r-l*Math.cos(u+Math.PI/6),c-l*Math.sin(u+Math.PI/6)),e.stroke(),t.isSelected&&(B(e,s,n),B(e,r,c))}var we="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Arrow\\index.tsx",ue=(e=>(e[e.Move=0]="Move",e[e.MoveStart=1]="MoveStart",e[e.MoveEnd=2]="MoveEnd",e))(ue||{});function vt(){const e=U(),[,t]=A(),[o,a]=T(),[s,r]=X(),n=H(),[c,p]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),f=i.useRef(null),h=o==="Arrow",b=i.useCallback(()=>{a.set("Arrow"),t.set("default")},[a,t]),y=i.useCallback(()=>{h||(b(),r.clearSelect())},[h,b,r]),C=i.useCallback((g,m)=>{if(g.name!=="Arrow"||!n.current)return;const v=g;b();const{x1:N,y1:k,x2:z,y2:E}=Pe(v);let R=0;$(n.current.canvas,m,{x:N,y:k})?R=1:$(n.current.canvas,m,{x:z,y:E})&&(R=2),f.current={type:D.Edit,data:{type:R,x1:m.clientX,y1:m.clientY,x2:m.clientX,y2:m.clientY},source:v},r.select(g)},[n,b,r]),x=i.useCallback(g=>{if(!h||u.current||!n.current)return;const{left:m,top:v}=n.current.canvas.getBoundingClientRect();u.current={name:"Arrow",type:D.Source,data:{size:c,color:d,x1:g.clientX-m,y1:g.clientY-v,x2:g.clientX-m,y2:g.clientY-v},editHistory:[],draw:xt,isHit:he}},[h,d,c,n]),S=i.useCallback(g=>{if(!(!h||!n.current)){if(f.current)f.current.data.x2=g.clientX,f.current.data.y2=g.clientY,s.top!==f.current?(f.current.source.editHistory.push(f.current),r.push(f.current)):r.set(s);else if(u.current){const{left:m,top:v}=n.current.canvas.getBoundingClientRect();u.current.data.x2=g.clientX-m,u.current.data.y2=g.clientY-v,s.top!==u.current?r.push(u.current):r.set(s)}}},[h,s,n,r]),w=i.useCallback(()=>{!h||(u.current&&r.clearSelect(),u.current=null,f.current=null)},[h,r]);return ce(C),Q(x),K(S),Z(w),_.default.createElement(Y,{title:e.operation_arrow_title,icon:"icon-arrow",checked:h,onClick:y,option:_.default.createElement(oe,{size:c,color:d,onSizeChange:p,onColorChange:l,__self:this,__source:{fileName:we,lineNumber:190,columnNumber:15}}),__self:this,__source:{fileName:we,lineNumber:185,columnNumber:5}})}function Le(e){let{x1:t,y1:o,x2:a,y2:s}=e.data;return e.editHistory.forEach(({data:r})=>{const n=r.x2-r.x1,c=r.y2-r.y1;r.type===F.Move?(t+=n,o+=c,a+=n,s+=c):r.type===F.ResizeTop?o+=c:r.type===F.ResizeRightTop?(a+=n,o+=c):r.type===F.ResizeRight?a+=n:r.type===F.ResizeRightBottom?(a+=n,s+=c):r.type===F.ResizeBottom?s+=c:r.type===F.ResizeLeftBottom?(t+=n,s+=c):r.type===F.ResizeLeft?t+=n:r.type===F.ResizeLeftTop&&(t+=n,o+=c)}),{...e.data,x1:t,x2:a,y1:o,y2:s}}function yt(e,t){const{size:o,color:a,x1:s,y1:r,x2:n,y2:c}=Le(t);e.lineCap="butt",e.lineJoin="miter",e.lineWidth=o,e.strokeStyle=a;const p=(s+n)/2,d=(r+c)/2,l=Math.abs(n-s)/2,u=Math.abs(c-r)/2,f=.5522848,h=l*f,b=u*f;e.beginPath(),e.moveTo(p-l,d),e.bezierCurveTo(p-l,d-b,p-h,d-u,p,d-u),e.bezierCurveTo(p+h,d-u,p+l,d-b,p+l,d),e.bezierCurveTo(p+l,d+b,p+h,d+u,p,d+u),e.bezierCurveTo(p-h,d+u,p-l,d+b,p-l,d),e.closePath(),e.stroke(),t.isSelected&&(e.lineWidth=1,e.strokeStyle="#000000",e.fillStyle="#ffffff",e.beginPath(),e.moveTo(s,r),e.lineTo(n,r),e.lineTo(n,c),e.lineTo(s,c),e.closePath(),e.stroke(),B(e,(s+n)/2,r),B(e,n,r),B(e,n,(r+c)/2),B(e,n,c),B(e,(s+n)/2,c),B(e,s,c),B(e,s,(r+c)/2),B(e,s,r))}var ze="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Ellipse\\index.tsx",F=(e=>(e[e.Move=0]="Move",e[e.ResizeTop=1]="ResizeTop",e[e.ResizeRightTop=2]="ResizeRightTop",e[e.ResizeRight=3]="ResizeRight",e[e.ResizeRightBottom=4]="ResizeRightBottom",e[e.ResizeBottom=5]="ResizeBottom",e[e.ResizeLeftBottom=6]="ResizeLeftBottom",e[e.ResizeLeft=7]="ResizeLeft",e[e.ResizeLeftTop=8]="ResizeLeftTop",e))(F||{});function Nt(){const e=U(),[t,o]=X(),[a,s]=T(),[,r]=A(),n=H(),[c,p]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),f=i.useRef(null),h=a==="Ellipse",b=i.useCallback(()=>{s.set("Ellipse"),r.set("crosshair")},[s,r]),y=i.useCallback(()=>{h||(b(),o.clearSelect())},[h,b,o]),C=i.useCallback((g,m)=>{if(g.name!=="Ellipse"||!n.current)return;const v=g;b();const{x1:N,y1:k,x2:z,y2:E}=Le(v);let R=0;$(n.current.canvas,m,{x:(N+z)/2,y:k})?R=1:$(n.current.canvas,m,{x:z,y:k})?R=2:$(n.current.canvas,m,{x:z,y:(k+E)/2})?R=3:$(n.current.canvas,m,{x:z,y:E})?R=4:$(n.current.canvas,m,{x:(N+z)/2,y:E})?R=5:$(n.current.canvas,m,{x:N,y:E})?R=6:$(n.current.canvas,m,{x:N,y:(k+E)/2})?R=7:$(n.current.canvas,m,{x:N,y:k})&&(R=8),f.current={type:D.Edit,data:{type:R,x1:m.clientX,y1:m.clientY,x2:m.clientX,y2:m.clientY},source:v},o.select(g)},[n,b,o]),x=i.useCallback(g=>{if(!h||!n.current||u.current)return;const{left:m,top:v}=n.current.canvas.getBoundingClientRect(),N=g.clientX-m,k=g.clientY-v;u.current={name:"Ellipse",type:D.Source,data:{size:c,color:d,x1:N,y1:k,x2:N,y2:k},editHistory:[],draw:yt,isHit:he}},[h,c,d,n]),S=i.useCallback(g=>{if(!(!h||!n.current)){if(f.current)f.current.data.x2=g.clientX,f.current.data.y2=g.clientY,t.top!==f.current?(f.current.source.editHistory.push(f.current),o.push(f.current)):o.set(t);else if(u.current){const{left:m,top:v}=n.current.canvas.getBoundingClientRect();u.current.data.x2=g.clientX-m,u.current.data.y2=g.clientY-v,t.top!==u.current?o.push(u.current):o.set(t)}}},[h,n,t,o]),w=i.useCallback(()=>{!h||(u.current&&o.clearSelect(),u.current=null,f.current=null)},[h,o]);return ce(C),Q(x),K(S),Z(w),_.default.createElement(Y,{title:e.operation_ellipse_title,icon:"icon-ellipse",checked:h,onClick:y,option:_.default.createElement(oe,{size:c,color:d,onSizeChange:p,onColorChange:l,__self:this,__source:{fileName:ze,lineNumber:242,columnNumber:15}}),__self:this,__source:{fileName:ze,lineNumber:237,columnNumber:5}})}function Xe(e){let{x1:t,y1:o,x2:a,y2:s}=e.data;return e.editHistory.forEach(({data:r})=>{const n=r.x2-r.x1,c=r.y2-r.y1;r.type===j.Move?(t+=n,o+=c,a+=n,s+=c):r.type===j.ResizeTop?o+=c:r.type===j.ResizeRightTop?(a+=n,o+=c):r.type===j.ResizeRight?a+=n:r.type===j.ResizeRightBottom?(a+=n,s+=c):r.type===j.ResizeBottom?s+=c:r.type===j.ResizeLeftBottom?(t+=n,s+=c):r.type===j.ResizeLeft?t+=n:r.type===j.ResizeLeftTop&&(t+=n,o+=c)}),{...e.data,x1:t,x2:a,y1:o,y2:s}}function Ct(e,t){const{size:o,color:a,x1:s,y1:r,x2:n,y2:c}=Xe(t);e.lineCap="butt",e.lineJoin="miter",e.lineWidth=o,e.strokeStyle=a,e.beginPath(),e.moveTo(s,r),e.lineTo(n,r),e.lineTo(n,c),e.lineTo(s,c),e.closePath(),e.stroke(),t.isSelected&&(e.lineWidth=1,e.strokeStyle="#000000",e.fillStyle="#ffffff",B(e,(s+n)/2,r),B(e,n,r),B(e,n,(r+c)/2),B(e,n,c),B(e,(s+n)/2,c),B(e,s,c),B(e,s,(r+c)/2),B(e,s,r))}var Ee="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Rectangle\\index.tsx",j=(e=>(e[e.Move=0]="Move",e[e.ResizeTop=1]="ResizeTop",e[e.ResizeRightTop=2]="ResizeRightTop",e[e.ResizeRight=3]="ResizeRight",e[e.ResizeRightBottom=4]="ResizeRightBottom",e[e.ResizeBottom=5]="ResizeBottom",e[e.ResizeLeftBottom=6]="ResizeLeftBottom",e[e.ResizeLeft=7]="ResizeLeft",e[e.ResizeLeftTop=8]="ResizeLeftTop",e))(j||{});function St(){const e=U(),[t,o]=X(),[a,s]=T(),[,r]=A(),n=H(),[c,p]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),f=i.useRef(null),h=a==="Rectangle",b=i.useCallback(()=>{s.set("Rectangle"),r.set("crosshair")},[s,r]),y=i.useCallback(()=>{h||(b(),o.clearSelect())},[h,b,o]),C=i.useCallback((g,m)=>{if(g.name!=="Rectangle"||!n.current)return;const v=g;b();const{x1:N,y1:k,x2:z,y2:E}=Xe(v);let R=0;$(n.current.canvas,m,{x:(N+z)/2,y:k})?R=1:$(n.current.canvas,m,{x:z,y:k})?R=2:$(n.current.canvas,m,{x:z,y:(k+E)/2})?R=3:$(n.current.canvas,m,{x:z,y:E})?R=4:$(n.current.canvas,m,{x:(N+z)/2,y:E})?R=5:$(n.current.canvas,m,{x:N,y:E})?R=6:$(n.current.canvas,m,{x:N,y:(k+E)/2})?R=7:$(n.current.canvas,m,{x:N,y:k})&&(R=8),f.current={type:D.Edit,data:{type:R,x1:m.clientX,y1:m.clientY,x2:m.clientX,y2:m.clientY},source:g},o.select(g)},[n,b,o]),x=i.useCallback(g=>{if(!h||!n.current||u.current)return;const{left:m,top:v}=n.current.canvas.getBoundingClientRect(),N=g.clientX-m,k=g.clientY-v;u.current={name:"Rectangle",type:D.Source,data:{size:c,color:d,x1:N,y1:k,x2:N,y2:k},editHistory:[],draw:Ct,isHit:he}},[h,c,d,n]),S=i.useCallback(g=>{if(!(!h||!n.current)){if(f.current)f.current.data.x2=g.clientX,f.current.data.y2=g.clientY,t.top!==f.current?(f.current.source.editHistory.push(f.current),o.push(f.current)):o.set(t);else if(u.current){const{left:m,top:v}=n.current.canvas.getBoundingClientRect(),N=u.current.data;N.x2=g.clientX-m,N.y2=g.clientY-v,t.top!==u.current?o.push(u.current):o.set(t)}}},[h,n,t,o]),w=i.useCallback(()=>{!h||(u.current&&o.clearSelect(),u.current=null,f.current=null)},[h,o]);return ce(C),Q(x),K(S),Z(w),_.default.createElement(Y,{title:e.operation_rectangle_title,icon:"icon-rectangle",checked:h,onClick:y,option:_.default.createElement(oe,{size:c,color:d,onSizeChange:p,onColorChange:l,__self:this,__source:{fileName:Ee,lineNumber:242,columnNumber:15}}),__self:this,__source:{fileName:Ee,lineNumber:237,columnNumber:5}})}var kt=[St,Nt,vt,_t,bt,ct,"|",rt,nt,"|",et,Ke,Je];var ne="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsOperations\\index.tsx";const Ye=_.default.createContext(null);var Rt=i.memo(function(){var u,f;const{width:t,height:o}=P(),[a]=q(),[s,r]=i.useState(null),[n,c]=i.useState(null),p=i.useRef(null),d=i.useCallback(h=>{h.stopPropagation()},[]),l=i.useCallback(h=>{h.preventDefault(),h.stopPropagation()},[]);return i.useEffect(()=>{if(!a||!p.current)return;const h=p.current.getBoundingClientRect();let b=a.x+a.width-h.width,y=a.y+a.height+10;b<0&&(b=0),b>t-h.width&&(b=t-h.width),y>o-h.height&&(y=o-h.height-10),(!n||Math.abs(n.x-b)>1||Math.abs(n.y-y)>1)&&c({x:b,y}),(!s||Math.abs(s.x-h.x)>1||Math.abs(s.y-h.y)>1||Math.abs(s.width-h.width)>1||Math.abs(s.height-h.height)>1)&&r({x:h.x,y:h.y,width:h.width,height:h.height})}),a?_.default.createElement(Ye.Provider,{value:s,__self:this,__source:{fileName:ne,lineNumber:79,columnNumber:5}},_.default.createElement("div",{ref:p,className:"screenshots-operations",style:{visibility:n?"visible":"hidden",transform:`translate(${(u=n==null?void 0:n.x)!=null?u:0}px, ${(f=n==null?void 0:n.y)!=null?f:0}px)`},onDoubleClick:d,onContextMenu:l,__self:this,__source:{fileName:ne,lineNumber:80,columnNumber:7}},_.default.createElement("div",{className:"screenshots-operations-buttons",__self:this,__source:{fileName:ne,lineNumber:90,columnNumber:9}},kt.map((h,b)=>h==="|"?_.default.createElement("div",{key:b,className:"screenshots-operations-divider",__self:this,__source:{fileName:ne,lineNumber:93,columnNumber:22}}):_.default.createElement(h,{key:b,__self:this,__source:{fileName:ne,lineNumber:95,columnNumber:22}}))))):null});function wt(e){const[t,o]=i.useState(null);return i.useEffect(()=>{if(o(null),e==null)return;const a=document.createElement("img"),s=()=>o(a),r=()=>o(null);return a.addEventListener("load",s),a.addEventListener("error",r),a.src=e,()=>{a.removeEventListener("load",s),a.removeEventListener("error",r)}},[e]),t}var se="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\index.tsx";function zt({url:e,width:t,height:o,lang:a,className:s,...r}){const n=wt(e),c=i.useRef(null),p=i.useRef({}),[d,l]=i.useState({index:-1,stack:[]}),[u,f]=i.useState(null),[h,b]=i.useState("move"),[y,C]=i.useState(void 0),x={url:e,width:t,height:o,image:n,lang:{...Me,...a},emiterRef:p,canvasContextRef:c,history:d,bounds:u,cursor:h,operation:y},S=i.useCallback((k,...z)=>{const E=r[k];typeof E=="function"&&E(...z)},[r]),w={call:S,setHistory:l,setBounds:f,setCursor:b,setOperation:C},g=["screenshots"];s&&g.push(s);const m=()=>{p.current={},l({index:-1,stack:[]}),f(null),b("move"),C(void 0)},v=i.useCallback(async k=>{if(!(k.button!==0||!n))if(u&&c.current)fe({image:n,width:t,height:o,history:d,bounds:u}).then(z=>{S("onOk",z,u),m()});else{const z={x:0,y:0,width:t,height:o};fe({image:n,width:t,height:o,history:d,bounds:z}).then(E=>{S("onOk",E,z),m()})}},[n,d,u,t,o,S]),N=i.useCallback(k=>{k.button===2&&(k.preventDefault(),S("onCancel"),m())},[S]);return i.useLayoutEffect(()=>{m()},[e]),_.default.createElement(ye.Provider,{value:{store:x,dispatcher:w},__self:this,__source:{fileName:se,lineNumber:142,columnNumber:5}},_.default.createElement("div",{className:g.join(" "),style:{width:t,height:o},onDoubleClick:v,onContextMenu:N,__self:this,__source:{fileName:se,lineNumber:143,columnNumber:7}},_.default.createElement(Ge,{__self:this,__source:{fileName:se,lineNumber:149,columnNumber:9}}),_.default.createElement(Oe,{ref:c,__self:this,__source:{fileName:se,lineNumber:150,columnNumber:9}}),_.default.createElement(Rt,{__self:this,__source:{fileName:se,lineNumber:151,columnNumber:9}})))}module.exports=zt;