diff --git a/js/p_index.js b/js/p_index.js index aaf6f45..b5d2cce 100644 --- a/js/p_index.js +++ b/js/p_index.js @@ -1 +1 @@ -(self.webpackChunkfabritor_web=self.webpackChunkfabritor_web||[]).push([[767],{1221:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return iw},pageConfig:function(){return im}});var r,i,o,a,l,s,c,u,h,f,d,p,v,g,b,y=n(7077),m=n(5629),w=n(1010),k=n(8188),Z=n(7582),x=n(7294),C=n(290),S=n(6220),A=n(4909),_=(0,x.createContext)(null),j="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),O="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),F=encodeURIComponent("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"),z="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),B="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),R="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),P="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),L='';encodeURIComponent('');var X=n(9790),M=n(5692),H=n(665),E=n(1181),I=n(9810),T=n(2253),W=n(4932),J=n(9210),V=n(2641);function U(e){var t=e.children,n=e.height,r=void 0===n?46:n,i=e.style,o=(0,J._)(e,["children","height","style"]);return(0,y.tZ)(V.Z,(0,W._)((0,T._)({justify:"center",align:"center"},o),{style:(0,T._)({height:r},i),children:t}))}var D=function(e){return(0,y.tZ)(U,(0,T._)({justify:"normal"},e))},N=n(384);function Y(e){var t=e.onClick,n=e.title,r=e.disabled,i=e.tooltipProps,o=e.children;return(0,y.tZ)(N.Z,(0,W._)((0,T._)({placement:"bottom",title:(0,y.tZ)("span",{style:{fontSize:12},children:n})},i),{children:(0,y.tZ)("span",{className:"fabritor-toolbar-item",style:{color:r?"#cccccc":"rgba(0, 0, 0, 0.88)"},onClick:function(){r||null==t||t()},children:o})}))}var q=n(8697);function G(){return(0,y.tZ)(q.Z,{type:"vertical",style:{height:32}})}function K(){var e=(0,x.useContext)(_),t=e.setActiveObject,n=e.editor,r=(0,k._)((0,x.useState)(!1),2),i=r[0],o=r[1],a=(0,k._)((0,x.useState)(!1),2),l=a[0],s=a[1],c=(0,k._)((0,x.useState)(!1),2),u=c[0],h=c[1];return(0,x.useEffect)(function(){n&&(s(n.fhistory.canUndo()),h(n.fhistory.canRedo()))}),(0,y.BX)(D,{gap:4,style:{borderRight:"1px solid #e8e8e8",paddingRight:12},children:[(0,y.tZ)(Y,{disabled:!l,title:"\u64A4\u9500",onClick:function(){n.fhistory.undo()},children:(0,y.tZ)(M.Z,{style:{fontSize:20}})}),(0,y.tZ)(Y,{disabled:!u,title:"\u91CD\u505A",onClick:function(){n.fhistory.redo()},children:(0,y.tZ)(H.Z,{style:{fontSize:20}})}),(0,y.tZ)(G,{}),(0,y.tZ)(Y,{onClick:function(){o(n.switchEnablePan())},title:i?"\u9009\u62E9\u5143\u7D20":"\u62D6\u62FD\u753B\u5E03",children:i?(0,y.tZ)(E.Z,{style:{fontSize:22,color:i?"#000":"#ccc"}}):(0,y.tZ)("img",{src:"data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(L)),style:{width:22,height:22}})}),(0,y.tZ)(Y,{onClick:function(){A.Z.confirm({title:"\u786E\u8BA4\u6E05\u7A7A\u753B\u5E03\uFF0C\u540C\u65F6\u6E05\u7A7A\u5386\u53F2\u64CD\u4F5C\u8BB0\u5F55\uFF1F",icon:(0,y.tZ)(X.Z,{}),onOk(){return(0,w._)(function(){return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return[4,n.clearCanvas()];case 1:return e.sent(),t(n.sketch),n.fireCustomModifiedEvent(),[2]}})})()},okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88"})},title:"\u6E05\u7A7A\u753B\u5E03",children:(0,y.tZ)(I.Z,{style:{fontSize:20}})})]})}var Q=n(7008),$=n(6372),ee=n(495),et=n(53),en=n(1861),er=n(1197),ei=n(6880),eo="fabritor_schema_version",ea="".concat("fabritor","_log\uFF1A"),el={borderColor:"#FF2222",borderScaleFactor:2,cornerStrokeColor:"#2222",cornerColor:"#FF2222",cornerSize:12,cornerStyle:"circle",transparentCorners:!1,padding:0,centeredScaling:!1,strokeUniform:!0,paintFirst:"stroke"},es={fill:"#000000",fontWeight:"normal",fontSize:50,lineHeight:1.3,textAlign:"center",fontFamily:"AlibabaPuHuiTi",width:500,splitByGrapheme:!0},ec=[{label:(0,y.tZ)("span",{style:{fontFamily:"SmileySans",fontSize:16},children:"\u5F97\u610F\u9ED1"}),value:"SmileySans"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u971E\u9E5C\u65B0\u6670\u9ED1",fontSize:16},children:"\u971E\u9E5C\u65B0\u6670\u9ED1"}),value:"\u971E\u9E5C\u65B0\u6670\u9ED1"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u971E\u9E5C\u6587\u6977",fontSize:16},children:"\u971E\u9E5C\u6587\u6977"}),value:"\u971E\u9E5C\u6587\u6977"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u5C0F\u8D56\u5B57\u4F53",fontSize:16},children:"\u5C0F\u8D56\u5B57\u4F53"}),value:"\u5C0F\u8D56\u5B57\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u60A0\u54C9\u5B57\u4F53",fontSize:16},children:"\u60A0\u54C9\u5B57\u4F53"}),value:"\u60A0\u54C9\u5B57\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"AlibabaPuHuiTi",fontSize:16},children:"\u963F\u91CC\u5DF4\u5DF4\u666E\u60E0\u4F53"}),value:"AlibabaPuHuiTi"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u971E\u9E5C\u5C1A\u667A\u9ED1",fontSize:16},children:"\u971E\u9E5C\u5C1A\u667A\u9ED1"}),value:"\u971E\u9E5C\u5C1A\u667A\u9ED1"},{label:(0,y.tZ)("span",{style:{fontFamily:"SourceHanSans",fontSize:16},children:"\u601D\u6E90\u9ED1\u4F53"}),value:"SourceHanSans"},{label:(0,y.tZ)("span",{style:{fontFamily:"SourceHanSerif",fontSize:16},children:"\u601D\u6E90\u5B8B\u4F53"}),value:"SourceHanSerif"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u65B9\u6B63\u6977\u4F53",fontSize:16},children:"\u65B9\u6B63\u6977\u4F53"}),value:"\u65B9\u6B63\u6977\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u5305\u56FE\u5C0F\u767D\u4F53",fontSize:16},children:"\u5305\u56FE\u5C0F\u767D\u4F53"}),value:"\u5305\u56FE\u5C0F\u767D\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u624B\u5199\u6742\u5B57\u4F53",fontSize:16},children:"\u624B\u5199\u6742\u5B57\u4F53"}),value:"\u624B\u5199\u6742\u5B57\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u80E1\u6653\u6CE2\u7537\u795E\u4F53",fontSize:16},children:"\u80E1\u6653\u6CE2\u7537\u795E\u4F53"}),value:"\u80E1\u6653\u6CE2\u7537\u795E\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u80E1\u6653\u6CE2\u9A9A\u5305\u4F53",fontSize:16},children:"\u80E1\u6653\u6CE2\u9A9A\u5305\u4F53"}),value:"\u80E1\u6653\u6CE2\u9A9A\u5305\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u7AD9\u9177\u5FEB\u4E50\u4F53",fontSize:16},children:"\u7AD9\u9177\u5FEB\u4E50\u4F53"}),value:"\u7AD9\u9177\u5FEB\u4E50\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u7AD9\u9177\u6587\u827A\u4F53",fontSize:16},children:"\u7AD9\u9177\u6587\u827A\u4F53"}),value:"\u7AD9\u9177\u6587\u827A\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u7AD9\u9177\u5C0F\u8587LOGO\u4F53",fontSize:16},children:"\u7AD9\u9177\u5C0F\u8587LOGO\u4F53"}),value:"\u7AD9\u9177\u5C0F\u8587LOGO\u4F53"}],eu="fabritor-sketch",eh=["id","fabritor_desc","selectable","hasControls","sub_type","imageSource","imageBorder","oldArrowInfo"],ef=(r=(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return e&&ec.find(function(t){return t.value===e})?[2,new er(e).load(null,1e5).catch(function(e){console.error(ea,e)})]:[2,Promise.resolve()]})}),function(e){return r.apply(this,arguments)}),ed=function(){return(0,ei.Z)()},ep=function(e,t,n){var r=document.createElement("a");r.href=e,r.download="".concat(n||ed(),".").concat(t),document.body.appendChild(r),r.click(),document.body.removeChild(r)},ev={45:JSON.stringify({x1:0,y1:1,x2:1,y2:0}),90:JSON.stringify({x1:0,y1:0,x2:1,y2:0}),135:JSON.stringify({x1:0,y1:0,x2:1,y2:1}),180:JSON.stringify({x1:0,y1:0,x2:0,y2:1}),225:JSON.stringify({x1:1,y1:0,x2:0,y2:1}),270:JSON.stringify({x1:1,y1:0,x2:0,y2:0}),315:JSON.stringify({x1:1,y1:1,x2:0,y2:0}),0:JSON.stringify({x1:0,y1:1,x2:0,y2:0})},eg=function(e){var t=Object.keys(ev),n=!0,r=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var l=o.value,s=(0,T._)({},e);if(s={x1:e.x1>1?1:0,y1:e.y1>1?1:0,x2:e.x2>1?1:0,y2:e.y2>1?1:0},JSON.stringify(s)===ev[l])return Number(l)}}catch(c){r=!0,i=c}finally{try{n||null==a.return||a.return()}finally{if(r)throw i}}return 90},eb=function(e){return!e||"string"==typeof e||e instanceof en.fabric.Pattern?{type:"solid",color:e||"#ffffff"}:{type:e.type,gradient:{colorStops:e.colorStops,angle:eg(e.coords)}}},ey=function(e){var t;switch(null==e?void 0:e.type){case"solid":t=e.color;break;case"linear":t={type:"linear",gradientUnits:"percentage",coords:JSON.parse(ev[e.gradient.angle%360]||ev[90]),colorStops:e.gradient.colorStops};break;case"radial":t={type:"radial",gradientUnits:"percentage",coords:{x1:.5,y1:.5,x2:.5,y2:.5,r1:0,r2:1},colorStops:e.gradient.colorStops}}return t},em=(i=(0,w._)(function(e,t){var n;return(0,Z.Jh)(this,function(r){return(n=0===t.indexOf("text")?"text":0===t.indexOf("image/")?"image":"")?[2,new Promise(function(t){var r=new FileReader;r.onload=function(e){var r;t({type:n,result:null===(r=e.target)||void 0===r?void 0:r.result})},r.onerror=function(e){console.log(e),t(null)},"text"===n?r.readAsText(e):"image"===n&&r.readAsDataURL(e)})]:[2,Promise.resolve(null)]})}),function(e,t){return i.apply(this,arguments)}),ew=(o=(0,w._)(function(){var e,t,n,r,i,o,a,l,s,c,u,h,f,d,p,v;return(0,Z.Jh)(this,function(g){switch(g.label){case 0:return g.trys.push([0,17,,18]),[4,navigator.clipboard.read()];case 1:e=g.sent(),t=!0,n=!1,r=void 0,g.label=2;case 2:g.trys.push([2,14,15,16]),i=e[Symbol.iterator](),g.label=3;case 3:if(t=(o=i.next()).done)return[3,13];a=o.value,l=!0,s=!1,c=void 0,g.label=4;case 4:g.trys.push([4,10,11,12]),u=a.types[Symbol.iterator](),g.label=5;case 5:if(l=(h=u.next()).done)return[3,9];return f=h.value,[4,a.getType(f)];case 6:return[4,em.apply(void 0,[g.sent(),f])];case 7:if(d=g.sent())return[2,d];g.label=8;case 8:return l=!0,[3,5];case 9:return[3,12];case 10:return p=g.sent(),s=!0,c=p,[3,12];case 11:try{l||null==u.return||u.return()}finally{if(s)throw c}return[7];case 12:return t=!0,[3,3];case 13:return[3,16];case 14:return p=g.sent(),n=!0,r=p,[3,16];case 15:try{t||null==i.return||i.return()}finally{if(n)throw r}return[7];case 16:return[2,null];case 17:return console.error((v=g.sent()).name,v.message),[2,null];case 18:return[2]}})}),function(){return o.apply(this,arguments)}),ek=(a=(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return[2,fetch(e).then(function(e){return e.blob()})]})}),function(e){return a.apply(this,arguments)}),eZ=(0,x.forwardRef)(function(e,t){var n=e.onChange,r=e.accept,i=(0,x.useRef)(null),o=(0,x.useRef)(null);return(0,x.useImperativeHandle)(t,function(){return{start:function(){var e,t;null===(t=o.current)||void 0===t||null===(e=t.click)||void 0===e||e.call(t)},reset:function(){var e,t;null===(t=i.current)||void 0===t||null===(e=t.reset)||void 0===e||e.call(t)}}}),(0,y.tZ)("form",{style:{display:"none"},ref:i,children:(0,y.tZ)("input",{type:"file",accept:r||"image/*",ref:o,onChange:function(e){var t,r;e.target.files[0]&&(n&&n(e.target.files[0]),null===(r=i.current)||void 0===r||null===(t=r.reset)||void 0===t||t.call(r))}})})}),ex=[{key:"jpg",label:"\u5BFC\u51FA\u4E3A JPG"},{key:"png",label:"\u5BFC\u51FA\u4E3A PNG"},{key:"svg",label:"\u5BFC\u51FA\u4E3A SVG"},{key:"json",label:"\u5BFC\u51FA\u4E3A \u6A21\u677F"},{type:"divider"},{key:"clipboard",label:"\u590D\u5236\u5230\u526A\u8D34\u677F"}];function eC(){var e,t=(0,x.useContext)(_),n=t.editor,r=t.setReady,i=t.setActiveObject,o=(0,x.useRef)(),a=(e=(0,w._)(function(){var e;return(0,Z.Jh)(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,ek(n.export2Img({format:"png"}))];case 1:return e=t.sent(),[4,navigator.clipboard.write([new ClipboardItem({"image/png":e})])];case 2:return t.sent(),Q.ZP.success("\u590D\u5236\u6210\u529F"),[3,4];case 3:return t.sent(),Q.ZP.error("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u9009\u62E9\u5BFC\u51FA\u5230\u672C\u5730"),[3,4];case 4:return[2]}})}),function(){return e.apply(this,arguments)});return(0,y.BX)(D,{justify:"flex-end",gap:16,style:{width:280,paddingRight:16},children:[(0,y.tZ)($.ZP,{onClick:function(){var e,t;null===(t=o.current)||void 0===t||null===(e=t.start)||void 0===e||e.call(t)},children:"\u52A0\u8F7D\u6A21\u677F"}),(0,y.tZ)(ee.Z,{menu:{items:ex,onClick:function(e){var t=e.key,r=n.sketch.fabritor_desc;switch(t){case"png":ep(n.export2Img({format:"png"}),"png",r);break;case"jpg":ep(n.export2Img({format:"jpg"}),"jpg",r);break;case"svg":ep(n.export2Svg(),"svg",r);break;case"json":var i=n.canvas2Json();ep("data:text/json;charset=utf-8,".concat(encodeURIComponent(JSON.stringify(i,null,2))),"json",r);break;case"clipboard":a()}}},arrow:{pointAtCenter:!0},placement:"bottom",children:(0,y.tZ)($.ZP,{type:"primary",icon:(0,y.tZ)(et.Z,{}),children:"\u5BFC\u51FA"})}),(0,y.tZ)(eZ,{accept:"application/json",ref:o,onChange:function(e){r(!1);var t,o=new FileReader;o.onload=(t=(0,w._)(function(e){var t,o;return(0,Z.Jh)(this,function(a){switch(a.label){case 0:if(!(o=null===(t=e.target)||void 0===t?void 0:t.result))return[3,2];return[4,n.loadFromJSON(o,!0)];case 1:a.sent(),n.fhistory.reset(),r(!0),i(null),n.fireCustomModifiedEvent(),a.label=2;case 2:return[2]}})}),function(e){return t.apply(this,arguments)}),o.readAsText(e)}})]})}function eS(){return(0,y.BX)(D,{gap:5,style:{width:406,paddingLeft:16},children:[(0,y.tZ)("img",{src:"https://foruda.gitee.com/images/1712407660517252867/e3ce5120_1411078.png",style:{width:28}}),(0,y.tZ)("span",{style:{fontWeight:"bold",fontSize:14},children:"\u5236\u4F5C\u56FE"})]})}var eA=n(9752),e_=eA.Z.Text;function ej(){var e=(0,k._)((0,x.useState)(""),2),t=e[0],n=e[1],r=(0,x.useContext)(_).editor;return(0,x.useEffect)(function(){r&&n(r.sketch.fabritor_desc)},[null==r?void 0:r.sketch]),(0,y.tZ)(e_,{editable:{onChange:function(e){var t=e||"\u6211\u7684\u753B\u677F by fabritor";n(t),r&&(r.sketch.set("fabritor_desc",t),r.fireCustomModifiedEvent())},autoSize:{minRows:1,maxRows:1}},ellipsis:{rows:1},style:{margin:0,width:200},children:t||""})}var eO=C.Z.Header,eF={padding:0,height:50,backgroundColor:"#fff",display:"flex",alignItems:"center",borderBottom:"1px solid #e8e8e8"};function ez(){return(0,y.BX)(eO,{style:eF,children:[(0,y.tZ)(eS,{}),(0,y.BX)(D,{justify:"space-between",style:{flex:1},children:[(0,y.tZ)(ej,{}),(0,y.tZ)(K,{})]}),(0,y.tZ)(eC,{})]})}var eB=n(9548),eR=n(4307),eP=n(6831),eL=n(7744),eX=n(7822),eM=n(5303),eH=n(8599),eE=n(8586),eI=n(8021),eT=n(3831);function eW(e){var t=e.children;return(0,y.tZ)(q.Z,{children:t})}var eJ=[{label:(0,y.tZ)("div",{style:{fontSize:30,fontFamily:"SmileySans",fontWeight:"bold"},children:"\u6DFB\u52A0\u6807\u9898"}),key:"title",config:{fontFamily:"SmileySans",fontWeight:"bold",fontSize:120,text:"\u6DFB\u52A0\u6807\u9898",top:100}},{label:(0,y.tZ)("div",{style:{fontSize:24,fontFamily:"AlibabaPuHuiTi"},children:"\u6DFB\u52A0\u526F\u6807\u9898"}),key:"sub-title",config:{fontFamily:"AlibabaPuHuiTi",fontWeight:"bold",fontSize:100,text:"\u6DFB\u52A0\u526F\u6807\u9898",top:400}},{label:(0,y.tZ)("div",{style:{fontSize:16,fontFamily:"SourceHanSerif"},children:"\u6DFB\u52A0\u4E00\u6BB5\u6B63\u6587"}),key:"content",config:{fontFamily:"SourceHanSerif",fontSize:80,text:"\u6DFB\u52A0\u4E00\u6BB5\u6B63\u6587"}},{label:(0,y.tZ)("div",{style:{fontSize:26,fontFamily:"\u971E\u9E5C\u6587\u6977",color:"#ffffff",WebkitTextStroke:"1px rgb(255, 87, 87)"},children:"\u6587\u5B57\u8FB9\u6846"}),key:"content",config:{fontFamily:"\u971E\u9E5C\u6587\u6977",fontSize:100,text:"\u6587\u5B57\u8FB9\u6846",fill:"#ffffff",stroke:"#ff5757",strokeWidth:12}}];function eV(e){var t=e.addTextBox,n=function(e){null==t||t(e.config)};return(0,y.BX)(V.Z,{vertical:!0,gap:8,style:{marginTop:16},children:[(0,y.tZ)(eW,{children:"\u9ED8\u8BA4\u6587\u5B57\u6837\u5F0F"}),eJ.map(function(e){return(0,y.tZ)(eT.Z,{hoverable:!0,onClick:function(){n(e)},bodyStyle:{padding:"12px 30px"},children:e.label},e.key)})]})}var eU=function(e){var t=e.textLines||[];if(!t||!t.length)return 0;for(var n=0,r=0;r100?100:t},eN=function(e,t){if(!e.isEditing){var n=eU(e),r=new en.fabric.Path("M 0 0 Q ".concat(n/2," ").concat(n/2*t/100," ").concat(n," 0"),{visible:!1,stroke:"#000000",fill:"#00000000"});e.set({path:r,width:n}),e.canvas.requestRenderAll()}},eY=function(e){e.set({path:null}),e.canvas.requestRenderAll()},eq=(l=(0,w._)(function(e){var t,n,r,i,o,a,l,s,c;return(0,Z.Jh)(this,function(u){switch(u.label){case 0:if(r=void 0===(n=(t=e||{}).text)?"":n,o=void 0===(i=t.fontFamily)?"Arial":i,a=t.canvas,l=(0,J._)(t,["text","fontFamily","canvas"]),s={hasPath:!1,offset:100},(c=new en.fabric.FText(r||"\u8FD9\u662F\u4E00\u6BB5\u6587\u672C",(0,W._)((0,T._)({},es,l),{fontFamily:o,pathAlign:"center",id:ed()}))).on("editing:entered",function(){c.path?(s.hasPath=!0,s.offset=eD(c),c.set("path",null),c.initDimensions(),a.requestRenderAll()):s.hasPath=!1}),c.on("editing:exited",function(){s.hasPath&&(eN(c,s.offset),a.requestRenderAll())}),null==e.left&&null==e.top?a.viewportCenterObject(c):null==e.left&&a.viewportCenterObjectH(c),a.add(c),a.setActiveObject(c),a.requestRenderAll(),!o)return[3,4];u.label=1;case 1:return u.trys.push([1,,3,4]),[4,ef(o)];case 2:return u.sent(),[3,4];case 3:return c.set("fontFamily",o),a.requestRenderAll(),[7];case 4:return[2,c]}})}),function(e){return l.apply(this,arguments)});function eG(){var e,t=(0,x.useContext)(_).editor,n=(e=(0,w._)(function(e){return(0,Z.Jh)(this,function(n){switch(n.label){case 0:return[4,eq((0,W._)((0,T._)({},e),{canvas:t.canvas}))];case 1:return n.sent(),[2]}})}),function(t){return e.apply(this,arguments)});return(0,y.BX)("div",{className:"fabritor-panel-wrapper",children:[(0,y.tZ)($.ZP,{type:"primary",block:!0,onClick:function(){n({})},size:"large",children:"\u6DFB\u52A0\u6587\u672C\u6846"}),(0,y.tZ)(eV,{addTextBox:n})]})}var eK=(s=(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return[2,new Promise(function(t,n){en.fabric.util.loadImage(e,function(e){return e?t(e):(Q.ZP.error("\u52A0\u8F7D\u56FE\u7247\u5931\u8D25"),n())},null,"anonymous")})]})}),function(e){return s.apply(this,arguments)}),eQ=(c=(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return"string"==typeof e?[2,new Promise(function(t,n){en.fabric.Image.fromURL(e,function(e){if(!e){Q.ZP.error("\u52A0\u8F7D\u56FE\u7247\u5931\u8D25"),n();return}t(e)},{crossOrigin:"anonymous"})})]:[2,Promise.resolve(new en.fabric.Image(e))]})}),function(e){return c.apply(this,arguments)}),e$=(u=(0,w._)(function(e){var t,n,r,i,o;return(0,Z.Jh)(this,function(a){switch(a.label){case 0:n=(t=e||{}).imageSource,r=t.canvas,i=(0,J._)(t,["imageSource","canvas"]),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,eQ(n)];case 2:return o=a.sent(),[3,4];case 3:return console.log(a.sent()),[3,4];case 4:if(!o)return[2];return o.set((0,W._)((0,T._)({},i),{paintFirst:"fill",id:ed()})),r.viewportCenterObject(o),r.add(o),r.setActiveObject(o),r.requestRenderAll(),[2,o]}})}),function(e){return u.apply(this,arguments)}),e0=(h=(0,w._)(function(e){var t,n,r,i,o;return(0,Z.Jh)(this,function(a){switch(a.label){case 0:n=(t=e||{}).imageSource,r=t.canvas,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,eQ(n)];case 2:return i=a.sent(),[3,4];case 3:return console.log(a.sent()),[3,4];case 4:if(!i)return[2];return o=new en.fabric.FImage({image:i,id:ed()}),r.viewportCenterObject(o),r.add(o),r.setActiveObject(o),r.requestRenderAll(),[2]}})}),function(e){return h.apply(this,arguments)}),e1=n(2313);function e2(e){var t=e.onChange,n=(0,J._)(e,["onChange"]),r=(0,x.useRef)();return(0,y.BX)("div",{style:{flex:1},children:[(0,y.tZ)($.ZP,(0,W._)((0,T._)({style:{width:"100%"},type:"primary",size:"large",onClick:function(){var e,t;null===(t=r.current)||void 0===t||null===(e=t.start)||void 0===e||e.call(t)}},n),{children:"\u6DFB\u52A0\u672C\u5730\u56FE\u7247"})),(0,y.tZ)(eZ,{accept:"image/*",ref:r,onChange:function(e){if("image/svg+xml"!==e.type){var n=new FileReader;n.onload=function(e){null==t||t(e.target.result)},n.readAsDataURL(e)}}})]})}var e3=n(3136),e4=n(2950);function e6(e){var t=e.onChange,n=(0,J._)(e,["onChange"]),r=(0,k._)((0,x.useState)(""),2),i=r[0],o=r[1];return(0,y.tZ)(e3.Z,{content:(0,y.BX)(e1.Z.Compact,{children:[(0,y.tZ)(e4.Z,{value:i,onChange:function(e){o(e.target.value)},style:{width:260}}),(0,y.tZ)($.ZP,{onClick:function(){i&&(null==t||t(i))},children:"\u786E\u8BA4"})]}),title:"\u8BF7\u8F93\u5165\u5730\u5740\uFF1A",trigger:"click",children:(0,y.tZ)($.ZP,(0,W._)((0,T._)({size:"large"},n),{children:"\u6DFB\u52A0\u8FDC\u7A0B\u56FE\u7247"}))})}var e8=n(5893),e5=n(1025),e7=n(4436),e9=n(6598);function te(e){var t=e.query,n=e.page,r=e.orientation;return(0,e9.Z)({method:"get",url:"https://api.pexels.com/v1/search",params:{query:(void 0===t?"nature":t)||"nature",per_page:10,page:void 0===n?1:n,size:"small",orientation:void 0===r?"landscape":r},headers:{Authorization:"4LInD4o8MBFIIPIK0AItnH3YnIo8IhGMvJhzMjYEFmquGwZplmG6LnY3"}}).then(function(e){return e.data.photos.map(function(e){return(0,T._)({url:e.src.tiny},e.src)})})}var tt=[{value:0,label:"Pexels",link:"https://www.pexels.com"},{value:1,label:"Unsplash",link:"https://unsplash.com/developers"},{value:2,label:"Pixabay",link:"https://pixabay.com/"}];function tn(e){var t,n,r,i=e.onChange;(0,J._)(e,["onChange"]);var o=(0,x.useContext)(_).editor,a=(0,k._)((0,x.useState)([]),2),l=a[0],s=a[1],c=(0,k._)((0,x.useState)(""),2),u=c[0],h=c[1],f=(0,k._)((0,x.useState)(1),2),d=f[0],p=f[1],v=(0,k._)((0,x.useState)(0),2),g=v[0],b=v[1],m=(0,e7.debounce)((t=(0,w._)(function(e){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:return h(t=e.target.value.trim()),[4,te({page:d,query:t})];case 1:return s(n.sent()),[2]}})}),function(e){return t.apply(this,arguments)}),300);(0,x.useEffect)(function(){o&&(o.sketch,function(){O.apply(this,arguments)}())},[o]);var C=(0,k._)((0,x.useState)(!0),2),A=C[0],j=C[1];function O(){return(O=(0,w._)(function(){return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return[4,(0,e9.Z)({method:"get",url:"https://api.pexels.com/v1/curated",params:{per_page:10,page:1},headers:{Authorization:"4LInD4o8MBFIIPIK0AItnH3YnIo8IhGMvJhzMjYEFmquGwZplmG6LnY3"}}).then(function(e){return e.data.photos.map(function(e){return(0,T._)({url:e.src.tiny},e.src)})})];case 1:return s(e.sent()),j(!1),[2]}})})).apply(this,arguments)}var F=(n=(0,w._)(function(e,t){var n,r,i,a,l;return(0,Z.Jh)(this,function(c){var h,f,d,v,g,y,m,w,k,Z;switch(c.label){case 0:if(!o)return[2];r=(n=o.sketch).width,i=n.height,j(!0),p(t),b(e),a=[],l={page:t,query:u},c.label=1;case 1:if(c.trys.push([1,8,,9]),0!==e)return[3,3];return[4,te((0,W._)((0,T._)({},l),{orientation:r===i?"square":r>i?"landscape":"portrait"}))];case 2:a=c.sent(),c.label=3;case 3:if(1!==e)return[3,5];return[4,(f=(h=(0,W._)((0,T._)({},l),{orientation:r===i?"squarish":r>i?"landscape":"portrait"})).query,d=h.page,v=h.orientation,(0,e9.Z)({method:"get",url:"https://api.unsplash.com/search/photos",params:{query:(void 0===f?"nature":f)||"nature",per_page:10,page:void 0===d?1:d,client_id:"Nxgsrk91xSPQyJi858udhIZo-ByNhNc-1EEpa9JLnWU",orientation:void 0===v?"landscape":v}}).then(function(e){return e.data.results.map(function(e){return(0,T._)({url:e.urls.small},e.urls)})}))];case 4:a=c.sent(),c.label=5;case 5:if(2!==e)return[3,7];return[4,(y=(g=(0,W._)((0,T._)({},l),{minHeight:i,minWidth:r,orientation:r===i?"all":r>i?"horizontal":"vertical"})).query,m=g.page,w=g.orientation,k=g.minWidth,Z=g.minHeight,(0,e9.Z)({method:"get",url:"https://pixabay.com/api",params:{q:(void 0===y?"nature":y)||"nature",per_page:10,page:void 0===m?1:m,orientation:void 0===w?"all":w,min_width:void 0===k?0:k,min_height:void 0===Z?0:Z,key:"4676309-98dc7486bd9c46eb8baf1ee96"}}).then(function(e){return e.data.hits.map(function(e){return{url:e.webformatURL}})}))];case 6:a=c.sent(),c.label=7;case 7:return[3,9];case 8:return console.log(c.sent()),[3,9];case 9:return s(a),j(!1),[2]}})}),function(e,t){return n.apply(this,arguments)}),z=(0,e7.debounce)(function(){F(g,d+1)},300),B=(0,k._)((0,x.useState)(!0),2),R=B[0],P=B[1],L=(0,e7.debounce)((r=(0,w._)(function(e){var t,n,r,a,l,s;return(0,Z.Jh)(this,function(c){switch(c.label){case 0:if(!o)return[2];if(P(!1),t=o.sketch.width,0!==g)return[3,2];return console.log(r="".concat(e.original,"?auto=compress&cs=tinysrgb&fit=crop&w=").concat(t)),[4,null===(n=i)||void 0===n?void 0:n(r)];case 1:case 3:return c.sent(),[3,6];case 2:if(1!==g)return[3,4];return console.log(l="".concat(e.raw,"&q=80&w=").concat(t)),[4,null===(a=i)||void 0===a?void 0:a(l)];case 4:return[4,null===(s=i)||void 0===s?void 0:s(e.url)];case 5:c.sent(),c.label=6;case 6:return P(!0),[2]}})}),function(e){return r.apply(this,arguments)}),300),X=(0,x.useMemo)(function(){return tt[g]},[g]);return l.length?(0,y.BX)(e8.Fragment,{children:[(0,y.tZ)(S.Z,{spinning:!R,fullscreen:!0}),(0,y.BX)(e1.Z,{direction:"vertical",style:{width:"100%"},children:[(0,y.tZ)(e4.Z,{placeholder:"\u641C\u7D22\u56FE\u7247",onInput:m,disabled:A}),(0,y.tZ)(e5.ZP.Group,{defaultValue:0,value:g,size:"small",onChange:function(e){A||F(e.target.value,1)},disabled:A,children:tt.map(function(e){return(0,y.tZ)(e5.ZP.Button,{value:e.value,children:e.label},e.value)})}),l.map(function(e){return(0,y.tZ)("div",{onClick:L.bind(null,e),style:{cursor:"pointer",minHeight:"50px"},children:(0,y.tZ)("img",{crossOrigin:"anonymous",width:"100%",loading:"lazy",src:e.url,alt:"img"})},e.url)}),(0,y.BX)(V.Z,{justify:"space-between",children:[(0,y.BX)($.ZP,{size:"small",type:"link",href:X.link,style:{fontSize:"10px"},children:["Photos provided by ",X.label]}),(0,y.tZ)($.ZP,{size:"small",loading:A,onClick:z,children:"\u4E0B\u4E00\u9875"})]})]})]}):null}function tr(e){var t=e.onChange,n=(0,J._)(e,["onChange"]);return(0,y.BX)(e1.Z,{direction:"vertical",size:"large",style:{width:"100%"},children:[(0,y.BX)(V.Z,{gap:10,justify:"space-between",children:[(0,y.tZ)(e2,(0,W._)((0,T._)({},n),{onChange:t})),(0,y.tZ)(e6,(0,W._)((0,T._)({},n),{onChange:t}))]}),(0,y.tZ)(tn,{onChange:t})]})}function ti(){var e,t=(0,x.useContext)(_).editor,n=(e=(0,w._)(function(e){return(0,Z.Jh)(this,function(n){switch(n.label){case 0:return[4,e0({imageSource:e,canvas:t.canvas})];case 1:return n.sent(),[2]}})}),function(t){return e.apply(this,arguments)});return(0,y.tZ)("div",{className:"fabritor-panel-wrapper",children:(0,y.tZ)(tr,{onChange:n})})}var to=n(6546),ta=[{key:"line",type:"f-line",svg:''},{key:"dash-line",type:"f-line",svg:'',options:{strokeDashArray:[8,8]}},{key:"arrow-line-1",type:"f-arrow",svg:'\n \n '},{key:"arrow-line-2",type:"f-tri-arrow",svg:''}],tl=function(e){return Math.PI*e/180},ts=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n=360/e,r=[],i=0;i',shape:en.fabric.Rect,options:{width:200,height:200,fill:"#555555"}},{key:"rect-r",elem:'',shape:en.fabric.Rect,options:{width:200,height:200,rx:20,ry:20,fill:"#555555"}},{key:"circle",elem:'',shape:en.fabric.Circle,options:{radius:100,fill:"#555555"}},{key:"ellipse",elem:'',shape:en.fabric.Ellipse,options:{rx:120,ry:200,fill:"#555555"}},{key:"triangle",elem:'',shape:en.fabric.Triangle,options:{width:200,height:180,fill:"#555555"}},{key:"right-angle",elem:'',shape:en.fabric.Polygon,options:{points:[{x:0,y:0},{x:0,y:200},{x:200,y:200}],fill:"#555555"}},{key:"diamond",elem:'',shape:en.fabric.Polygon,options:{points:[{x:0,y:100},{x:100,y:200},{x:200,y:100},{x:100,y:0}],fill:"#555555"}},{key:"parallelgram",elem:'',shape:en.fabric.Polygon,options:{points:[{x:50,y:0},{x:0,y:100},{x:200,y:100},{x:250,y:0}],fill:"#555555"}},{key:"pentagon",elem:'',shape:en.fabric.Polygon,options:{points:ts(5),fill:"#555555"}},{key:"hexagon",elem:'',shape:en.fabric.Polygon,options:{points:ts(6),fill:"#555555"}},{key:"star",elem:''},{key:"heart",elem:''}],tu=n.p+"assets/rect.df3b593f.png",th=n.p+"assets/circle.c2faca88.png",tf=n.p+"assets/ellipse.41feedb4.png",td=n.p+"assets/right-angle.93573792.png",tp=n.p+"assets/diamond.d2acbdbe.png",tv={hachureGap:16,fillWeight:4,strokeWidth:8,roughness:1.6,bowing:1},tg=[{key:"rough-line",elem:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATYAAAAMCAYAAADoKpHWAAAAAXNSR0IArs4c6QAAAjFJREFUaEPtm7Fu01AYhc+5TqiUIFVi6FCJ4jwDCyuPACKoS5Z2YYCNGTHBIyBZQBELggoJlRdgRuwsSHUFgg4MIJRCk/gepkooTS2HOr1x/GeMr3P+892bc23rNzHh82Xj5lUQa5OOHX0nISaxnDdmlsckdYBw+rP0lssdTB3xI5T+JN0M2ovAoDXJKx018DMEl2Vi90KyHUQ7hN8qaHK8yG+31uPhwD8EdCXPAIG2gGZAk22G1Q9lvS9gGEp8ki6B8DUJfUcMAnEJ7z+Q8XmQJbHVirDz7+ZyLNg+b3ZvU7gr4NI8FG01GAEjYATy72J0r9FoPlpNXnw/Gnc82Da6zwWs1/RqyFaQETACFSMgFAm2ze5rCNcr5s3KNQJGoKYELNhqOvFm2wgsMgELtkWeXfNmBGpKQOAWqQcXn2x/OvkZm92K1nR5mG0jUE0Cgl55F92PH7/8aMFWzTm0qo2AERgjUOlgE5ByFo2pYkqFaeys6woVFeOMm7sldFjDhu6FXmPCOzo+y0bZh+bSYHc1eXuQ0+5x4w7lLhcBIvqUbroueC+Xuv8IElF9uvIbMA8P3UHLMVRjZxHMizemyXaG0Zk2d2cZzkdg6Zp0PlaJgSmPDuVKeaOnjA1knjeESVdqJwbbfu/aiqKlVqF/E7P+Hw2n6oKPz630mSRTnVOoFhtkBAIQ2O/12r+jX6UFZsM32w0XlfN7JWwgp90QThv8eUHvnX8PDd6sPd35Oj71fwE3zdMN1O33QQAAAABJRU5ErkJggg==",options:(0,T._)({stroke:"#E36255"},tv)},{key:"rough-rect",elem:tu,options:(0,T._)({fill:"#F6C445",stroke:"#EC6A52"},tv)},{key:"rough-circle",elem:th,options:(0,T._)({fill:"#F6C445",stroke:"#EC6A52"},tv)},{key:"rough-ellipse",elem:tf,options:(0,T._)({fill:"#F6C445",stroke:"#EC6A52"},tv)},{key:"rough-right-angle",elem:td,options:(0,T._)({fill:"#F6C445",stroke:"#EC6A52"},tv)},{key:"rough-diamond",elem:tp,options:(0,T._)({fill:"#F6C445",stroke:"#EC6A52"},tv)}],tb=function(e){var t=e.points,n=e.canvas,r=(0,J._)(e,["points","canvas"]),i=new en.fabric.FLine(t||[0,0,300,0],(0,T._)({strokeWidth:4,stroke:"#000000",strokeLineJoin:"round",strokeLineCap:"round",borderColor:"#00000000",id:ed()},r));return n.viewportCenterObject(i),i.set({x1:i.left,y1:i.top,x2:i.left+300,y2:i.top}),n.add(i),n.setActiveObject(i),n.requestRenderAll(),i},ty=function(e){var t=e.points,n=e.canvas,r=(0,J._)(e,["points","canvas"]),i=new en.fabric.FArrow(t||[0,0,300,0],(0,T._)({strokeWidth:4,stroke:"#000000",fill:"#000000",strokeLineJoin:"round",strokeLineCap:"round",borderColor:"#00000000"},r));return n.viewportCenterObject(i),i.set({x1:i.left,y1:i.top,x2:i.left+300,y2:i.top}),n.add(i),n.setActiveObject(i),n.requestRenderAll(),i},tm=function(e){var t=e.points,n=e.canvas,r=(0,J._)(e,["points","canvas"]),i=new en.fabric.FTriArrow(t||[0,0,300,0],(0,T._)({strokeWidth:4,stroke:"#000000",fill:"#000000",strokeLineJoin:"round",strokeLineCap:"round",borderColor:"#00000000"},r));return n.viewportCenterObject(i),i.set({x1:i.left,y1:i.top,x2:i.left+300,y2:i.top}),n.add(i),n.setActiveObject(i),n.requestRenderAll(),i},tw=(f=(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return[2,new Promise(function(t){en.fabric.loadSVGFromString(e,function(e,n){t(en.fabric.util.groupSVGElements(e,n))})})]})}),function(e){return f.apply(this,arguments)});(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return[2,new Promise(function(t){en.fabric.loadSVGFromURL(e,function(e,n){t(en.fabric.util.groupSVGElements(e,n))})})]})});var tk=(d=(0,w._)(function(e){var t,n,r,i,o;return(0,Z.Jh)(this,function(a){switch(a.label){case 0:return n=(t=e||{}).svgString,r=t.canvas,i=(0,J._)(t,["svgString","canvas"]),[4,tw(n)];case 1:return(o=a.sent()).set((0,W._)((0,T._)({},i),{id:ed()})),r.viewportCenterObject(o),r.add(o),r.setActiveObject(o),r.requestRenderAll(),[2,o]}})}),function(e){return d.apply(this,arguments)});function tZ(){var e=(0,x.useContext)(_),t=e.editor,n=e.roughSvg,r=function(e){var n=e.type,r=e.options,i=void 0===r?{}:r,o=t.canvas;switch(n){case"f-line":tb((0,W._)((0,T._)({},i),{canvas:o}));break;case"f-arrow":ty((0,W._)((0,T._)({},i),{canvas:o}));break;case"f-tri-arrow":tm((0,W._)((0,T._)({},i),{canvas:o}))}},i=function(e){var n,r,i,o,a,l,s,c,u,h,f=e.key,d=e.elem,p=e.options,v=t.canvas;switch(f){case"rect":case"rect-r":r=(n=(0,W._)((0,T._)({},p),{canvas:v})||{}).canvas,i=(0,J._)(n,["canvas"]),o=new en.fabric.Rect((0,T._)({id:ed(),width:200,height:200},i)),r.viewportCenterObject(o),r.add(o),r.setActiveObject(o),r.requestRenderAll();break;case"star":case"heart":tk({svgString:d,canvas:v,sub_type:f,strokeWidth:20});break;default:a=e.shape,c=(s=(0,W._)((0,T._)({},p),{canvas:v})||{}).points,u=s.canvas,h=(0,J._)(s,["points","canvas"]),l=a===en.fabric.Polygon?new en.fabric.Polygon(c,(0,T._)({id:ed()},h)):new a((0,T._)({id:ed()},h)),u.viewportCenterObject(l),u.add(l),u.setActiveObject(l),u.requestRenderAll()}},o=function(e){var r,i=e.key,o=e.options,a=t.canvas;switch(i){case"rough-line":r=n.line(0,0,300,0,o);break;case"rough-rect":r=n.rectangle(0,0,400,400,o);break;case"rough-circle":r=n.circle(0,0,300,o);break;case"rough-ellipse":r=n.ellipse(0,0,300,150,o);break;case"rough-right-angle":r=n.polygon([[0,0],[0,300],[300,300]],o);break;case"rough-diamond":r=n.polygon([[0,150],[150,300],[300,150],[150,0]],o)}console.log(r),tk({svgString:''.concat(r.innerHTML,""),canvas:a,sub_type:"rough"})};return(0,y.BX)("div",{className:"fabritor-panel-wrapper",children:[(0,y.tZ)(eW,{children:"\u7EBF\u6761"}),(0,y.tZ)(V.Z,{gap:10,wrap:"wrap",justify:"space-around",children:ta.map(function(e){return(0,y.tZ)("div",{onClick:function(){r(e)},className:"fabritor-panel-shape-item",children:(0,y.tZ)("img",{src:"data:image/svg+xml,".concat(encodeURIComponent(e.svg)),alt:"",style:{width:48,height:48}})},e.key)})}),(0,y.tZ)(eW,{children:"\u5F62\u72B6"}),(0,y.tZ)(V.Z,{gap:10,wrap:"wrap",justify:"space-around",children:tc.map(function(e){return(0,y.tZ)("div",{onClick:function(){i(e)},className:"fabritor-panel-shape-item",children:(0,y.tZ)("img",{src:"data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(e.elem)),style:{width:64,height:64}})},e.key)})}),(0,y.tZ)(eW,{children:(0,y.BX)("div",{style:{position:"relative"},children:[(0,y.tZ)("span",{children:"\u624B\u7ED8\u98CE\u683C"}),(0,y.tZ)(to.Z,{color:"#f50",style:{position:"absolute",right:-48,top:-5,padding:"0 4px"},children:"beta"})]})}),(0,y.tZ)(V.Z,{gap:10,wrap:"wrap",justify:"space-around",children:tg.map(function(e){return(0,y.tZ)("div",{onClick:function(){o(e)},className:"fabritor-panel-shape-item",children:(0,y.tZ)(U,{style:{width:64,height:64},children:(0,y.tZ)("img",{src:e.elem,style:{width:64}})})},e.key)})})]})}var tx=[{key:"p-1",svg:'',title:"\u94C5\u7B14",options:{color:"#1296db",width:4,strokeLineCap:"round"}},{key:"p-2",svg:'',title:"\u9A6C\u514B\u7B14",options:{color:"#FF0000",width:36,strokeLineCap:"square"}}],tC=n(1524),tS=n(746),tA=n(4125);function t_(e){var t=e.value,n=e.onChange,r=e.trigger;return(0,y.tZ)(e3.Z,{content:(0,y.tZ)(tA.Z,{value:t,onChange:function(e){null==n||n(e)},format:"hex"}),children:(0,y.tZ)("div",{className:"fabritor-toolbar-item",style:{borderRadius:4,backgroundColor:"#ffffff"===new tS.Il(t).toHexString()?"rgba(103,103,103,0.24)":null},children:r||(0,y.tZ)("svg",{width:22,height:22,viewBox:"64 64 896 896",focusable:"false",fill:t,"aria-hidden":"true",children:(0,y.tZ)("path",{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"})})})})}var tj=n(4869);function tO(e){var t,n=e.defaultColor,r=void 0===n?"#ffffff":n,i=e.trigger,o=e.type,a=e.value,l=e.onChange,s=function(){switch(null==a?void 0:a.type){case"solid":return a.color;case"linear":case"radial":return"url(#colorsetter-icon-gradient) ".concat(a.color||"rgba(0, 0, 0, 0.88)");default:return"rgba(0, 0, 0, 0.88)"}};return(0,y.BX)(e8.Fragment,{children:[(0,y.tZ)(e3.Z,{content:(0,y.tZ)("div",{className:"fabritor-color-setter",children:(0,y.tZ)(tj.Z,{value:a,onChange:function(e){e&&(e.color||(e.color=r),null==l||l(e))},format:"hex",angleType:"rotate"})}),trigger:"click",children:(0,y.tZ)("div",{className:"fabritor-toolbar-item",style:{borderRadius:4,backgroundColor:(null==a?void 0:a.type)==="solid"&&"#ffffff"===new tS.Il(a.color).toHexString()?"rgba(103,103,103,0.24)":null},children:i||("fontColor"===o?(0,y.tZ)("svg",{viewBox:"64 64 896 896",focusable:"false",width:22,height:22,fill:s(),"aria-hidden":"true",children:(0,y.tZ)("path",{d:"M904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8zm-650.3-80h85c4.2 0 8-2.7 9.3-6.8l53.7-166h219.2l53.2 166c1.3 4 5 6.8 9.3 6.8h89.1c1.1 0 2.2-.2 3.2-.5a9.7 9.7 0 006-12.4L573.6 118.6a9.9 9.9 0 00-9.2-6.6H462.1c-4.2 0-7.9 2.6-9.2 6.6L244.5 723.1c-.4 1-.5 2.1-.5 3.2-.1 5.3 4.3 9.7 9.7 9.7zm255.9-516.1h4.1l83.8 263.8H424.9l84.7-263.8z"})}):(0,y.tZ)("svg",{width:22,height:22,viewBox:"64 64 896 896",focusable:"false",fill:s(),"aria-hidden":"true",children:(0,y.tZ)("path",{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"})}))})}),(0,y.tZ)("svg",{style:{width:0,height:0,position:"absolute"},"aria-hidden":"true",focusable:"false",children:(0,y.tZ)("linearGradient",{id:"colorsetter-icon-gradient",x2:"1",y2:"1",children:null==a?void 0:null===(t=a.gradient)||void 0===t?void 0:t.colorStops.map(function(e){return(0,y.tZ)("stop",{offset:"".concat(100*e.offset,"%"),"stop-color":e.color})})})})]})}var tF=n(991),tz=n(4163);function tB(e){var t=e.min,n=void 0===t?1:t,r=e.max,i=void 0===r?100:r,o=e.step,a=void 0===o?1:o,l=e.style,s=e.sliderProps,c=e.inputProps,u=e.onChange,h=e.onChangeComplete,f=e.value;return(0,y.BX)(V.Z,{gap:6,style:l,children:[(0,y.tZ)(tF.Z,(0,T._)({style:{flex:1},min:n,max:i,step:a,onChange:u,onAfterChange:h,value:f},s)),(0,y.tZ)(tz.Z,(0,T._)({min:n,max:i,step:a,onChange:u,value:f,style:{width:56},controls:!1},c))]})}var tR=tC.Z.Item;function tP(e){var t=e.value,n=e.onChange,r=e.shouldFireEvent,i=e.showPenTip,o=e.showFillConfig,a=(0,k._)(tC.Z.useForm(),1)[0],l=(0,x.useContext)(_).editor,s=function(){r&&l.fireCustomModifiedEvent()};return(0,x.useEffect)(function(){a.setFieldsValue(t)},[t]),(0,y.BX)(tC.Z,{form:a,onValuesChange:n,style:{marginBottom:0,marginTop:16},colon:!1,children:[i?(0,y.tZ)(tR,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u753B\u7B14"})}):null,(0,y.tZ)(tR,{label:o?"\u63CF\u8FB9":"\u989C\u8272",name:"color",children:(0,y.tZ)(t_,{onChange:s})}),(0,y.tZ)(tR,{label:"\u7EBF\u5BBD",name:"width",children:(0,y.tZ)(tB,{min:1,max:100,onChangeComplete:s})}),o?(0,y.tZ)(tR,{label:"\u586B\u5145",name:"fill",children:(0,y.tZ)(tO,{onChange:s})}):null,(0,y.tZ)(tR,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u9634\u5F71"})}),(0,y.tZ)(tR,{label:"\u989C\u8272",name:["shadow","color"],children:(0,y.tZ)(t_,{onChange:s})}),(0,y.tZ)(tR,{label:"\u5BBD\u5EA6",name:["shadow","width"],children:(0,y.tZ)(tB,{min:0,max:50,onChangeComplete:s})}),(0,y.tZ)(tR,{label:"\u504F\u79FB",name:["shadow","offset"],children:(0,y.tZ)(tB,{min:0,max:20,onChangeComplete:s})})]})}function tL(){var e=(0,k._)((0,x.useState)(0),2),t=e[0],n=e[1],r=(0,k._)((0,x.useState)(!0),2),i=r[0],o=r[1],a=(0,x.useContext)(_).editor,l=(0,k._)((0,x.useState)({}),2),s=l[0],c=l[1],u=function(e){if(e.color&&(a.canvas.freeDrawingBrush.color=e.color),e.width&&(a.canvas.freeDrawingBrush.width=e.width),e.strokeLineCap&&(a.canvas.freeDrawingBrush.strokeLineCap=e.strokeLineCap),e.shadow){var t=a.canvas.freeDrawingBrush.shadow,n=t?t.toObject():{},r={blur:e.shadow.width||n.blur,offsetX:e.shadow.offset||n.offsetX,offsetY:e.shadow.offset||n.offsetY,affectStroke:!0,color:e.shadow.color||n.color};a.canvas.freeDrawingBrush.shadow=new en.fabric.Shadow(r)}},h=function(){if(a){a.canvas.isDrawingMode=!0,a.canvas.freeDrawingCursor='url("data:image/svg+xml;charset=utf-8,'.concat(encodeURIComponent(''),'") 4 12, crosshair');var e=new en.fabric.PencilBrush(a.canvas);a.canvas.freeDrawingBrush=e;var t=tx[0].options,n=t.color,r=t.width;e.color=n,e.width=r,e.shadow=new en.fabric.Shadow({blur:0,offsetX:0,offsetY:0,affectStroke:!0,color:"#000000"}),c({color:n,width:r,shadow:{color:"#000000",width:0,offset:0}})}return function(){(null==a?void 0:a.canvas)&&(a.canvas.isDrawingMode=!1)}};return(0,x.useEffect)(function(){return h()},[]),(0,y.BX)("div",{className:"fabritor-panel-wrapper",children:[(0,y.tZ)(V.Z,{wrap:"wrap",justify:"space-around",children:tx.map(function(e,r){return(0,y.tZ)(N.Z,{trigger:"hover",title:e.title,children:(0,y.tZ)("div",{className:"fabritor-panel-shape-item",onClick:function(){u(e.options),n(r),c((0,T._)({},s,e.options))},style:{padding:"4px 8px",backgroundColor:t===r?"#eeeeee":"rgba(0,0,0,0)",borderRadius:8},children:(0,y.tZ)("img",{src:"data:image/svg+xml,".concat(encodeURIComponent(e.svg)),alt:"",style:{width:56,height:56}})},e.key)})})}),(0,y.tZ)(tP,{onChange:u,value:s,showPenTip:!0}),(0,y.tZ)(eW,{children:"\u64CD\u4F5C"}),(0,y.tZ)(V.Z,{wrap:"wrap",justify:"space-around",children:(0,y.tZ)($.ZP,{style:{width:64},onClick:function(){a.canvas.isDrawingMode=!a.canvas.isDrawingMode,o(!i)},type:i?"default":"primary",title:"\u505C\u6B62\u7ED8\u56FE",children:(0,y.tZ)("img",{src:"data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(L)),style:{width:22,height:22}})})})]})}var tX=n(8202),tM=n(8538),tH=n(4916),tE=n(3453),tI=en.fabric.controlsUtils,tT=function(){var e=en.fabric.Object.prototype.controls;if(en.fabric.Rect){var t=en.fabric.Rect.prototype.controls={};t.tr=e.tr,t.br=e.br,t.tl=e.tl,t.bl=e.bl,t.mt=e.mt,t.mb=e.mb,t.mtr=e.mtr,t.copy=e.copy,t.del=e.del,t.ml=new en.fabric.Control({x:-.5,y:0,actionHandler:tI.changeWidth,cursorStyleHandler:e.ml.cursorStyleHandler,actionName:"resizing",render:e.ml.render}),t.mr=new en.fabric.Control({x:.5,y:0,actionHandler:tI.changeWidth,cursorStyleHandler:e.mr.cursorStyleHandler,actionName:"resizing",render:e.mr.render}),t.mt=new en.fabric.Control({x:0,y:-.5,offsetY:-1,actionHandler:nu,cursorStyleHandler:e.mt.cursorStyleHandler,actionName:"resizing",render:e.mt.render}),t.mb=new en.fabric.Control({x:0,y:.5,offsetY:1,actionHandler:nu,cursorStyleHandler:e.mb.cursorStyleHandler,actionName:"resizing",render:e.mb.render})}},tW=function(e,t,n,r){return t.target.set({x2:n,y2:r}),!0},tJ=function(e,t,n,r){return t.target.set({x1:n,y1:r}),!0},tV=function(e,t){return function(n,r,i){if(null==i||!i.canvas)return new en.fabric.Point(0,0);var o=i.calcLinePoints(),a=new en.fabric.Point(o[e],o[t]);return en.fabric.util.transformPoint(a,en.fabric.util.multiplyTransformMatrices(i.canvas.viewportTransform,i.calcTransformMatrix()))}},tU=function(){var e=en.fabric.Object.prototype.controls;if(en.fabric.Line){var t=en.fabric.Line.prototype.controls={};t.copy=e.copy,t.del=e.del,t.l1=new en.fabric.Control({positionHandler:tV("x1","y1"),actionHandler:tJ,cursorStyleHandler:function(){return"crosshair"},actionName:"line-points-change",render:e.br.render}),t.l2=new en.fabric.Control({positionHandler:tV("x2","y2"),actionHandler:tW,cursorStyleHandler:function(){return"crosshair"},actionName:"line-points-change",render:e.br.render})}},tD=en.fabric.controlsUtils,tN=function(){var e=en.fabric.Object.prototype.controls;if(en.fabric.Rect){var t=en.fabric.FText.prototype.controls={};t.tr=e.tr,t.br=e.br,t.tl=e.tl,t.bl=e.bl,t.mtr=e.mtr,t.copy=e.copy,t.del=e.del,t.ml=new en.fabric.Control({x:-.5,y:0,offsetX:-1,actionHandler:tD.changeWidth,cursorStyleHandler:e.ml.cursorStyleHandler,actionName:"resizing",render:e.ml.render}),t.mr=new en.fabric.Control({x:.5,y:0,offsetX:1,actionHandler:tD.changeWidth,cursorStyleHandler:e.mr.cursorStyleHandler,actionName:"resizing",render:e.mr.render})}},tY=document.createElement("img");tY.src=j;var tq=document.createElement("img");tq.src=O;var tG=document.createElement("img");tG.src=z;var tK=document.createElement("img");tK.src=B;var tQ=document.createElement("img");tQ.src=R;var t$=document.createElement("img");t$.src=P;var t0=function(e,t,n,r,i,o){var a="TB"===o?20:6,l="TB"===o?6:20;e.save(),e.fillStyle="#ffffff",e.strokeStyle="#bbbbbb",e.lineWidth=2,e.shadowBlur=2,e.shadowColor="#dddddd",e.translate(t,n),e.rotate(en.fabric.util.degreesToRadians(i.angle)),e.beginPath(),e.roundRect(-a/2,-l/2,a,l,10),e.stroke(),e.fill(),e.restore()},t1=function(e,t,n,r,i){t0(e,t,n,r,i,"LR")},t2=function(e,t,n,r,i){t0(e,t,n,r,i,"TB")},t3=function(e,t,n,r,i){e.save(),e.fillStyle="#ffffff",e.strokeStyle="#bbbbbb",e.lineWidth=2,e.shadowBlur=2,e.shadowColor="#dddddd",e.beginPath(),e.arc(t,n,6,0,2*Math.PI,!1),e.stroke(),e.fill(),e.restore()};function t4(e){return function(t,n,r,i,o){t.save(),t.translate(n,r),t.rotate(en.fabric.util.degreesToRadians(o.angle)),t.drawImage(e,-14,-14,28,28),t.restore()}}var t6=(p=(0,w._)(function(e,t){var n,r;return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return[4,nr(r=(n=t.target).canvas,n)];case 1:return e.sent(),ni(r),[2,!0]}})}),function(e,t){return p.apply(this,arguments)}),t8=function(e,t){var n=t.target,r=n.canvas;return no(n,r),!0},t5=function(){var e={x:0,y:-.5,offsetY:-1,render:t2};Object.keys(e).forEach(function(t){en.fabric.Object.prototype.controls.mt[t]=e[t]});var t={x:0,y:.5,offsetY:1,render:t2};Object.keys(t).forEach(function(e){en.fabric.Object.prototype.controls.mb[e]=t[e]});var n={x:-.5,y:0,offsetX:-1,render:t1};Object.keys(n).forEach(function(e){en.fabric.Object.prototype.controls.ml[e]=n[e]});var r={x:.5,y:0,offsetX:1,render:t1};Object.keys(r).forEach(function(e){en.fabric.Object.prototype.controls.mr[e]=r[e]});var i={x:-.5,y:-.5,render:t3};Object.keys(i).forEach(function(e){en.fabric.Object.prototype.controls.tl[e]=i[e]});var o={x:.5,y:-.5,render:t3};Object.keys(o).forEach(function(e){en.fabric.Object.prototype.controls.tr[e]=o[e]});var a={x:-.5,y:.5,render:t3};Object.keys(a).forEach(function(e){en.fabric.Object.prototype.controls.bl[e]=a[e]});var l={x:.5,y:.5,render:t3};Object.keys(l).forEach(function(e){en.fabric.Object.prototype.controls.br[e]=l[e]})},t7=function(){var e={x:0,y:.5,offsetY:38,cursorStyleHandler:function(){return'url("data:image/svg+xml;charset=utf-8,'.concat(F,'") 12 12, crosshair')},render:t4(tY),withConnection:!1};Object.keys(e).forEach(function(t){en.fabric.Object.prototype.controls.mtr[t]=e[t]})},t9=function(){var e=new en.fabric.Control({x:0,y:-.5,offsetX:-24,offsetY:-26,cursorStyle:"pointer",mouseUpHandler:t6,render:t4(tG)});en.fabric.Object.prototype.controls.copy=e;var t=new en.fabric.Control({x:0,y:-.5,offsetX:24,offsetY:-26,cursorStyle:"pointer",mouseUpHandler:t8,render:t4(tQ)});en.fabric.Object.prototype.controls.del=t},ne=function(e,t){"mtr"===e&&(t.controls[e].render=t4(tq)),"copy"===e&&(t.controls[e].render=t4(tK)),"del"===e&&(t.controls[e].render=t4(t$)),t.canvas.requestRenderAll()},nt=function(e){var t,n,r;e&&((null===(t=e.controls)||void 0===t?void 0:t.mtr)&&(e.controls.mtr.render=t4(tY)),(null===(n=e.controls)||void 0===n?void 0:n.copy)&&(e.controls.copy.render=t4(tG)),(null===(r=e.controls)||void 0===r?void 0:r.del)&&(e.controls.del.render=t4(tQ)))},nn=en.fabric.controlsUtils,nr=(v=(0,w._)(function(e,t){return(0,Z.Jh)(this,function(n){return[2,new Promise(function(n){return(t||(t=e.getActiveObject()),t)?(navigator.clipboard.writeText(""),t.clone(function(e){return b=e,n(!0)},eh)):Promise.resolve(!1)})]})}),function(e,t){return v.apply(this,arguments)}),ni=(g=(0,w._)(function(e){var t,n,r;return(0,Z.Jh)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,ew()];case 1:if(n=(t=i.sent()||{}).type,r=t.result)return"text"===n?eq({text:r,canvas:e}):"image"===n&&e0({imageSource:r,canvas:e}),[2];return[3,3];case 2:return console.error("Failed to read clipboard contents: ",i.sent()),[3,3];case 3:return b.clone(function(t){e.discardActiveObject(),t.set({left:t.left+50,top:t.top+50,evented:!0}),("f-line"===t.type||"f-arrow"===t.type||"f-tri-arrow"===t.type)&&nh({target:t,transform:{original:{left:t.left-50,top:t.top-50}}}),"activeSelection"===t.type?(t.canvas=e,t.forEachObject(function(t){e.add(t)}),t.setCoords()):e.add(t),e.setActiveObject(t),e.requestRenderAll(),e.fire("fabritor:clone",{target:t})},eh),[2]}})}),function(e){return g.apply(this,arguments)}),no=function(e,t){if(e||(e=t.getActiveObject()),e)return"activeSelection"===e.type?(e.getObjects().forEach(function(e){t.remove(e)}),t.discardActiveObject()):t.remove(e),nt(e),t.requestRenderAll(),t.fire("fabritor:del",{target:null}),!0},na=function(e,t){t||(t=e.getActiveObject()),t&&"activeSelection"===t.type&&(t.toGroup(),e.requestRenderAll(),e.fire("fabritor:group"))},nl=function(e,t){t||(t=e.getActiveObject()),t&&"group"===t.type&&(t.getObjects().forEach(function(e){e.set({lockMovementX:!1,lockMovementY:!1,hasControls:!0,selectable:!0})}),t.toActiveSelection(),e.requestRenderAll(),e.fire("fabritor:ungroup"))},ns=function(e,t,n){if(n||(n=t.canvas.getActiveObject()),n&&"activeSelection"!==n.type){switch(e){case"layer-up":n.bringForward();break;case"layer-top":n.bringToFront();break;case"layer-down":n.sendBackwards();break;case"layer-bottom":n.sendToBack()}t.sketch.sendToBack(),t.canvas.requestRenderAll(),t.fireCustomModifiedEvent()}},nc=function(e,t,n,r,i){var o=e.target,a=o.controls[e.corner],l=o.canvas.getZoom(),s=o.padding/l,c=o.toLocalPoint(new en.fabric.Point(r,i),t,n);return c.x>=s&&(c.x-=s),c.x<=-s&&(c.x+=s),c.y>=s&&(c.y-=s),c.y<=s&&(c.y+=s),c.x-=a.offsetX,c.y-=a.offsetY,c},nu=nn.wrapWithFireEvent("resizing",nn.wrapWithFixedAnchor(function(e,t,n,r){var i=t.target,o=nc(t,t.originX,t.originY,n,r),a=i.strokeWidth/(i.strokeUniform?i.scaleX:1),l="center"===t.originX&&"center"===t.originY?2:1,s=i.height,c=Math.abs(o.y*l/i.scaleY)-a;return i.set("height",Math.max(c,0)),s!==c})),nh=function(e){var t=e.target,n=e.transform;if("line-points-change"!==e.action){var r=n.original,i=t.left-r.left,o=t.top-r.top;t.set({x1:t.x1+i,y1:t.y1+o,x2:t.x2+i,y2:t.y2+o})}},nf=function(e){var t=e.label,n=e.keyboard,r=e.cmdKey,i=navigator.userAgent.indexOf("Mac OS X")>-1;return(0,y.BX)(V.Z,{gap:68,justify:"space-between",children:[(0,y.tZ)("span",{children:t}),(0,y.tZ)("span",{children:"".concat(void 0!==r&&r?i?"\u2318":"Ctrl":""," ").concat(n)})]})},nd=(0,x.forwardRef)(function(e,t){var n,r=e.object,i=e.noCareOpen,o=(0,k._)((0,x.useState)(!1),2),a=o[0],l=o[1],s=(0,x.useContext)(_).editor,c=(n=(0,w._)(function(e){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:switch(t=e.key){case"copy":return[3,1];case"paste":return[3,3];case"copy&paste":return[3,4];case"del":return[3,7];case"group":return[3,8];case"ungroup":return[3,9];case"layer-up":case"layer-top":case"layer-down":case"layer-bottom":return[3,10]}return[3,11];case 1:case 4:return[4,nr(s.canvas,r)];case 2:case 6:return n.sent(),[3,12];case 3:return ni(s.canvas),[3,12];case 5:return n.sent(),[4,ni(s.canvas)];case 7:return no(r,s.canvas),[3,12];case 8:return na(s.canvas,r),[3,12];case 9:return nl(s.canvas,r),[3,12];case 10:ns(t,s,r),n.label=11;case 11:return[3,12];case 12:return l(!1),[2]}})}),function(e){return n.apply(this,arguments)});return(0,x.useImperativeHandle)(t,function(){return{show:function(){return l(!0)},hide:function(){return l(!1)}}}),(0,y.tZ)(ee.Z,{menu:{items:function(){if(!r||r.id===eu)return[{label:(0,y.tZ)(nf,{label:"\u7C98\u8D34",keyboard:"V",cmdKey:!0}),key:"paste"}];var e=[{label:(0,y.tZ)(nf,{label:"\u590D\u5236",keyboard:"C",cmdKey:!0}),key:"copy"},{label:(0,y.tZ)(nf,{label:"\u7C98\u8D34",keyboard:"V",cmdKey:!0}),key:"paste"},{label:"\u521B\u5EFA\u526F\u672C",key:"copy&paste"},{label:(0,y.tZ)(nf,{label:"\u5220\u9664",keyboard:"DEL"}),key:"del"}];return"activeSelection"===r.type&&(e.push({type:"divider"}),e.push({label:"\u5EFA\u7EC4",key:"group"})),"group"!==r.type||r.sub_type||(e.push({type:"divider"}),e.push({label:"\u53D6\u6D88\u5EFA\u7EC4",key:"ungroup"})),"activeSelection"!==r.type&&(e.push({type:"divider"}),e.push({label:"\u56FE\u5C42",key:"layer",children:[{label:"\u4E0A\u79FB",key:"layer-up"},{label:"\u7F6E\u9876",key:"layer-top"},{label:"\u4E0B\u79FB",key:"layer-down"},{label:"\u7F6E\u5E95",key:"layer-bottom"}]})),e}(),onClick:c},trigger:["contextMenu"],open:i?void 0:a,children:e.children})}),np=JSON.parse('{"version":"5.3.0","objects":[{"type":"rect","version":"5.3.0","originX":"left","originY":"top","left":0,"top":0,"width":1242,"height":1660,"fill":"#ffffff","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"id":"fabritor-sketch","fabritor_desc":"\u6211\u7684\u753B\u677F by fabritor","selectable":false,"hasControls":false},{"type":"f-image","version":"5.3.0","originX":"left","originY":"top","left":-14.18,"top":-50.11,"width":854,"height":1281,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":0,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1.49,"scaleY":1.49,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"id":"838bb981-f378-43d8-af4d-d2e283d6d767","selectable":true,"hasControls":true,"imageBorder":{},"objects":[{"type":"image","version":"5.3.0","originX":"center","originY":"center","left":0,"top":0,"width":853,"height":1280,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":0,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"clipPath":{"type":"rect","version":"5.3.0","originX":"center","originY":"center","left":0,"top":0,"width":853,"height":1280,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"selectable":true,"hasControls":true,"inverted":false,"absolutePositioned":false},"cropX":0,"cropY":0,"selectable":true,"hasControls":true,"src":"https://cdn.pixabay.com/photo/2024/01/04/15/42/sailing-8487722_1280.png","crossOrigin":"anonymous","filters":[]},{"type":"rect","version":"5.3.0","originX":"center","originY":"center","left":0,"top":0,"width":853,"height":1280,"fill":"#00000000","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"fill","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"selectable":true,"hasControls":true}]},{"type":"f-text","version":"5.3.0","originX":"left","originY":"top","left":371,"top":188.86,"width":500,"height":135.6,"fill":{"type":"linear","coords":{"x1":0,"y1":0,"x2":500,"y2":0},"colorStops":[{"color":"#e45f2b","offset":0},{"color":"#9dbdba","offset":0.47},{"color":"#7d8bae","offset":1}],"offsetX":0,"offsetY":0,"gradientUnits":"pixels","gradientTransform":null},"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"fontFamily":"SmileySans","fontWeight":"bold","fontSize":120,"text":"fabritor","underline":false,"overline":false,"linethrough":false,"textAlign":"center","fontStyle":"normal","lineHeight":1.3,"textBackgroundColor":"","charSpacing":59,"styles":[],"direction":"ltr","path":null,"pathStartOffset":0,"pathSide":"left","pathAlign":"center","minWidth":20,"splitByGrapheme":true,"id":"ad9d6314-5b03-4886-a101-eb0df5f64153","selectable":true,"hasControls":true},{"type":"f-text","version":"5.3.0","originX":"left","originY":"top","left":250.24,"top":424.33,"width":741.52,"height":207.92,"fill":"#45496a","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"fontFamily":"SourceHanSerif","fontWeight":"normal","fontSize":80,"text":"\u5FEB\u901F\u6784\u5EFA\u5C5E\u4E8E\u81EA\u5DF1\u7684\\n\u56FE\u7247\u7F16\u8F91\u5668","underline":false,"overline":false,"linethrough":false,"textAlign":"center","fontStyle":"normal","lineHeight":1.3,"textBackgroundColor":"","charSpacing":0,"styles":[],"direction":"ltr","path":null,"pathStartOffset":0,"pathSide":"left","pathAlign":"center","minWidth":20,"splitByGrapheme":true,"id":"1a6b8d18-1037-486f-be5f-693bd50f8d60","selectable":true,"hasControls":true}],"clipPath":{"type":"rect","version":"5.3.0","originX":"left","originY":"top","left":0,"top":0,"width":1242,"height":1660,"fill":"#ffffff","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"selectable":true,"hasControls":true},"background":"#ddd","fabritor_schema_version":3}');function nv(){var e,t=(0,x.useContext)(_),n=t.isReady,r=t.setReady,i=t.object,o=t.setActiveObject,a=t.editor,l=(0,k._)((0,x.useState)([]),2),s=l[0],c=l[1],u=function(e){var t=[],n=e.length;if(!n){c([]);return}for(var r=null==a?void 0:a.canvas.getActiveObject(),i=n-1;i>=0;i--){var o=e[i];o&&o.id!==eu&&(r===o?o.__cover=o.toDataURL():o.__cover||(o.__cover=o.toDataURL()),t.push({cover:o.__cover,group:"group"===o.type,object:o}))}c(t)},h=(e=(0,w._)(function(){return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return r(!1),[4,a.loadFromJSON(np,!0)];case 1:return e.sent(),a.fhistory.reset(),r(!0),o(null),a.fireCustomModifiedEvent(),[2]}})}),function(){return e.apply(this,arguments)}),f=function(e){a.canvas.discardActiveObject(),a.canvas.setActiveObject(e.object),a.canvas.requestRenderAll()};return(0,x.useEffect)(function(){var e,t=function(){u(e.getObjects())};return n&&(c([]),e=null==a?void 0:a.canvas,t(),e.on({"object:added":t,"object:removed":t,"object:modified":t,"object:skewing":t,"fabritor:object:modified":t})),function(){e&&e.off({"object:added":t,"object:removed":t,"object:modified":t,"object:skewing":t,"fabritor:object:modified":t})}},[n]),(0,y.tZ)("div",{className:"fabritor-panel-wrapper",children:s.length?(0,y.tZ)(tX.Z,{dataSource:s,renderItem:function(e){return(0,y.tZ)(nd,{object:e.object,noCareOpen:!0,children:(0,y.tZ)(tX.Z.Item,{className:"fabritor-list-item",style:{border:i===e.object?" 2px solid #ff2222":"2px solid transparent",padding:"10px 16px"},onClick:function(){f(e)},children:(0,y.BX)(V.Z,{justify:"space-between",align:"center",style:{width:"100%",height:40},children:[(0,y.tZ)("img",{src:e.cover,style:{maxWidth:200,maxHeight:34}}),e.group?(0,y.tZ)(tH.Z,{style:{fontSize:18,color:"rgba(17, 23, 29, 0.6)"}}):null]})})})}}):(0,y.tZ)(tM.Z,{image:null,description:(0,y.BX)("div",{children:[(0,y.tZ)(tE.Z,{twoToneColor:"#eb2f96",style:{fontSize:40}}),(0,y.tZ)("p",{style:{color:"#aaa",fontSize:16},children:"\u5F00\u59CB\u6325\u6D12\u4F60\u7684\u521B\u610F ~"}),(0,y.tZ)(q.Z,{}),(0,y.tZ)($.ZP,{onClick:h,children:"\u6216\u8005\u4ECE\u4E00\u4E2A\u7B80\u5355\u7684 DEMO \u5F00\u59CB"})]})})})}var ng=n(5517),nb=n(2973),ny=n(7664),nm=n(6411),nw=n(6156);function nk(e){var t=e.title,n=e.children,r=e.back;return(0,y.tZ)(eT.Z,{bordered:!1,style:{marginLeft:-24,boxShadow:"none"},bodyStyle:{padding:12},title:(0,y.BX)(V.Z,{justify:"space-between",children:[(0,y.tZ)(nw.Z,{onClick:function(){r&&r()}}),(0,y.tZ)("p",{children:t})]}),children:n})}var nZ=tC.Z.Item;function nx(e){var t=e.back,n=(0,k._)(tC.Z.useForm(),1)[0],r=(0,k._)(tC.Z.useForm(),1)[0],i=(0,k._)((0,x.useState)({value:"fabritor"}),2),o=i[0],a=i[1],l=(0,x.useRef)(null),s=(0,x.useContext)(_).editor,c=function(e){a((0,T._)({},o,e))};return(0,x.useEffect)(function(){n.setFieldsValue({value:"fabritor",size:160}),r.setFieldsValue({color:"#000000",bgColor:"#00000000",iconSize:40,errorLevel:"M"})},[]),(0,y.BX)(nk,{title:"\u4E8C\u7EF4\u7801",back:t,children:[(0,y.BX)(tC.Z,{form:n,onValuesChange:c,children:[(0,y.tZ)(nZ,{name:"value",label:"\u6587\u672C",children:(0,y.tZ)(e4.Z,{})}),(0,y.tZ)(nZ,{name:"size",label:"\u5927\u5C0F",children:(0,y.tZ)(tz.Z,{})})]}),(0,y.tZ)(ny.Z,{items:[{key:"1",label:"\u5176\u4ED6\u8BBE\u7F6E",children:(0,y.BX)(tC.Z,{form:r,onValuesChange:c,children:[(0,y.tZ)(nZ,{name:"color",label:"\u989C\u8272",children:(0,y.tZ)(t_,{})}),(0,y.tZ)(nZ,{name:"bgColor",label:"\u80CC\u666F\u8272",children:(0,y.tZ)(t_,{})}),(0,y.tZ)(nZ,{name:"errorLevel",label:"\u7EA0\u9519\u7B49\u7EA7",children:(0,y.tZ)(e5.ZP.Group,{options:["L","M","Q","H"]})}),(0,y.tZ)(nZ,{name:"icon",label:"\u5185\u7F6E\u56FE\u7247",children:(0,y.tZ)(e4.Z,{placeholder:"\u4EC5\u652F\u6301\u56FE\u7247\u94FE\u63A5"})}),(0,y.tZ)(nZ,{name:"iconSize",label:"\u5185\u7F6E\u56FE\u7247\u5927\u5C0F",children:(0,y.tZ)(tz.Z,{})})]})}]}),o.value?(0,y.BX)(V.Z,{vertical:!0,align:"center",gap:10,style:{marginTop:16},ref:l,children:[(0,y.tZ)(nm.Z,(0,W._)((0,T._)({type:"canvas"},o),{style:{maxWidth:200}})),(0,y.tZ)($.ZP,{type:"primary",onClick:function(){if(o.value&&l.current){var e=l.current.querySelector("canvas");if(e){var t=new Image;t.onload=function(){e$({imageSource:t,canvas:s.canvas})},t.src=e.toDataURL()}}},children:"\u6DFB\u52A0\u81F3\u753B\u5E03"})]}):null]})}var nC=n(6638),nS=n(4168);function nA(e){var t,n=e.back,r=(0,x.useContext)(_).editor,i=(t=(0,w._)(function(e){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:if(!((t=r.canvas.getActiveObject())&&"textbox"===t.type))return[3,1];return t.set("text","".concat(t.text).concat(e.native)),r.canvas.requestRenderAll(),[3,3];case 1:return[4,eq({text:e.native,fontSize:80,width:100,canvas:r.canvas})];case 2:n.sent(),n.label=3;case 3:return[2]}})}),function(e){return t.apply(this,arguments)});return(0,y.tZ)(nk,{title:"Emoji",back:n,children:(0,y.tZ)(nS.Z,{data:nC,perLine:8,set:"native",locale:"zh",onEmojiSelect:i})})}var n_=[{title:"\u4E8C\u7EF4\u7801",key:"qrcode",icon:(0,y.tZ)(ng.Z,{style:{fontSize:30}})},{title:"Emoji",key:"emoji",icon:(0,y.tZ)(nb.Z,{style:{fontSize:30}})},{title:"\u672A\u9053\u5E2E AI \u62A0\u56FE",key:"aiwave",icon:(0,y.tZ)("div",{style:{textAlign:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://cutout.aiwave.cc/images/logo.svg"})}),link:"https://cutout.aiwave.cc/"},{title:"bgsub AI \u62A0\u56FE",key:"bgsub",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"100px"},src:"https://bgsub.cn/logo.webp"})}),link:"https://bgsub.cn/"},{title:"ImageTools AI \u62A0\u56FE",key:"ImageTools",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAJzElEQVR4nO3af5Cd5VUH8M9zs1l21pDZu7C3mTTD0IhKw48GSjMtIlhFRaGltJRMp2obK2Uk1oA4o5hJ7r1maJpGpLUTO1hppzKY0hptAZFYkLT8cJqJmZjSNKJlmIhpfJPuXWImLpvNffzjvGkYJWHvJnvXGffMvLN3d9/7POec55zv+T7neZiRGZmRGZmRGZmRGZkmGWoMq60anrb5K9M2cykpp19WSZ+dtvmna2Ko1VvzsQhX4R4cLprV0W7qMG0RUKu35uLX8UH8ODaQ5nRbj+lLgeRcXIDv4kA8+eruqzENUqu3FmIJ+vALmItv4CVsf+WVtPvlTwx0RZeersxyTBpZLY/8pjD8JayRvFU2in9CHVefcUZ+Nz7ZDZW6mgK13OrFmzKfRxv7ZOdhfvn7AXwVZw2tHunvhk5dxoDUg0MpjF2JUezFIHbhHsk4fpBS7ooDupICtXrrSjRxJwbaZh2sOLpSpMFGkRIr0Sc7G0M4p1ZvfQXri2b10anSbcojoNZo9eALOAdnY+6B5tw2LsQmPIjlwkHvwm6xMAvK54u1eqtvqvSbkipQKnwb3ojP4jNJujbLt2EYj+IynIezxEK8jBewHYvxtiSvytLDuN3xlFlZNKt7T5euk3JASWJ6BXM7XKu3Lsav4AcC4Jbg4fLzoHDCp7EQO4QTnivfHyuH7cWZOF9Ey8UCH+7A+/CPWIcVAihvKcd+Uk5/JeWeRF+mv2hWiylxQK3euhHvlKyR3Y4aPoMPiBAeKBX+nsjvp/E1fEUwvofxgqSQHUKROJiTtmxOOd5A+ZyDG/BN/Dw+VP797SKy1iaGMx8WkXHRq+atYV7RrH7i9WzqFAR34x2yFeV3F4uV/wf8FraVYXtM4TWC5m7HOkmRc352f2Nw/DXGPoAXofp7L5t9RvtSPC8i4TyBFTvwQE7jf5hyz+U55tgkMKSC72MpRvDURAzqyAGZXYmvi5zcI0J0M+7DPhzK0rWpnW/Ps9I22YM/fDflx4vG4OjQ6pHeodUjJwe1dHSsaA5uf0OjtSNnB4VjVmBD0aw+W6u3bi3nvwbvLv/3FryzHGGz5JGJ2NRRFUiRMIeFdxfjjqJZfayc+E7sxI25khaUxt+LncWugUeKxuBojJEXp5SvSyl/NKX8vZTyv5fPt1LKN6WUr0tBjf1Ho9oumtUtIoLW49O1eutCsfL9gka/ddbR/GWBMX2lY9o5T8y2jkGw1mj1yS4TZWw5tohQfwKFALwP4EnsKJrVp084VtT5G8tfVxTN6h+f5N3zcalY7aaoCgtI15NvwXvxl9go2VU0qhPqsnTMA4pGdVSs9NuwTDjiauH5dWIVDmDPrHY6ofGlHD7B5/89b7O6WwDcX+Nn8YvxnTxXAONVAgOGJ2o8kydC8wTwnSuQ+V/Ln4P4GJ6QPP79Nad3R5elpwVlPhaB83BQYNEVeFZUjwnLZB2wF+8gPVqkgUsEw9skVv+bKIpG9aQrOhnZ3xxoC2dvwvtxM64jL038hUi97Z2MOSkHFM3qIdxFXlfLI7diS5b/SJSgb2dp6ySGbU/opf8a3yWqwuV4BJ8ifTRHmb2rExLEKewFimb1BawS+f5gkhYK9N63vzlw2lf/mBz45BAcEqlwpeAHe7GhaFRf7HS8U90MfU0wv3tEWO4wwZU8RSnwL/gc7hdUeULE53/KqTrgkGBrBwVjOyB4/lTLXlE1Foioe17JIjuVU3XAcrHit+DPcEQ4Y2ol9hGjeEjsC/oF/nQsp+SAlIw4vhrd6+cfp289ovTOE221juWUHJCz9SL078etmK2ksVMraY4oub8kmqnfwoNDjeGO7TnVltg5ggwd6+3VJIOTHKsD8MzzRdjvEATsTehzNFU6G+fUMWCZ2O2tF8RksdyFPmPK8/Bjju8Cv4uL9q+pvtY2+6QyaQfUGq1B/AZ+CstSbm8V+/B5b6i3pvaIK6d+LErJVtmHRPStqtVbV3Q61KQcMFRv9Yj8vzdnq/CenCq/LTq8F+Tg6lMitXprkWitPZuzmyQfzjk9pO1juLb8/4RlUg5Igbrfxvkp2Sx2h8sEB7gStVq9ddr7+kP1VkV0h27A3+BubEkpP6Xid0Tr7eJOxpxcCiTDeLNkj2BlS0RHd69oTPwcrj67MTKp4U88rSvELnCboMKHBRjWxE7wBkGKJiwdO6BWH+mTXYp/lj0hUPirIizvKxUawLkV+crXGa7/BJ9fY97WIlF1rhfN1XsF4ldEY3ZD+bm/Vh+ZcCXqqCM0VB+pJPka0Zm5Hh+pJDvb+Ydd3H48IBoWGwVXf348tZ8ebpx1zJAlwlnz8buOG/6iCOlR8mNFc3AELmhk+/PIIhHad4hU+9yxsTGa2V620TaK7fJmOf1d8QcDx1ruJ5SOSlZKmewwflLU4LXtbKXIx1HlIUgl5T1t6f2yTbi/J1cGa43WY0WjOvbKK2mbCGH41GvNc2Sstw1nrx6u7M8jPy2cdTuWF83qc7V6a4town4BlRTRUBVnDAswT8o9jp85nNimThxQrt5HBNhVRL/+IXHA0YORI2OVz8/ubV8mmhWLBD78qeQp2V4pbS0aJ1+ZoUarkrLFknNli0SkHBBg+4Q4cJkveMB9ohU3JvqQFwnnPFk2bE+rA96LS4THbxZhv0GQoDWJdo7zgTPxjACqjWLb/D48hu9Ihss7AS85vnucWxo1F3ME2l+Pv8fPiPOH8wTgXSXy/nn8muAfl+DfxInThZhTNKsfP60OeJUjgu+nPF40Bg/X6q23i3bUGL5YGvGMCPGFYoU2iDx+TlSO7fhPjAsw68GPiKhZUBp7GHcJtndQnDd+PLEu86v4UWyePTbr8bEzjvaknPtJ/UWzum+itkzR4ehwH+nYqdDd4sxgqdi8vEWUyiXCyCGRTi1RSreJHuOKLC9L0gOiDf7Bcvi7i2b1wOnSdcrvCNVWjVDJ3xCRcCfeNXts1tIjvUd/Xxi1VoTwemzVtkzFbSI9VonN1k+czhPhV8uU3w8oojW+XOBBgZHx3vEBQZpuLp/15Tv3qRgQabFXgNnyqTKeLt8SG1o9UkkprxWnOl9HTbZU0i8ccQ2uFSD2XNGs7pxqnbp6RygdndUWjYyKaKLsllws0PwmAaS9AukPdUOnrjqguOtMonu7SuT9pdiZUj4kAHCJqBRvzKnyQjd0mq6LkvOUu0ZR0/vwt4IT7K6M9ezYt/bMrugybZely2s1d+I7gsb24pmiWf1SN/Xo7k3RV0tKL8p5j+jnzRGk53Wp6+mWaXPAkaPtgz2Vyj1JvhwLM39uvAtnCv/XpFZv3Vqrt9ZN1/zTlwKlDKWBPzlo/3SrMSMzMiP/T+W/AW9jL67Slt52AAAAAElFTkSuQmCC"})}),link:"https://ai-image.tools/home"},{title:"PDF \u8F6C\u6362\u5668",key:"pdf2docx",icon:(0,y.tZ)("div",{style:{textAlign:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://www.pdf2docx.cn/assets/static/logo.02b6c8c9.svg"})}),link:"https://www.pdf2docx.cn/"},{title:"PDF \u7F16\u8F91\u5668",key:"onlinepdfedit",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://onlinepdfedit.com/images/logo.webp"})}),link:"https://onlinepdfedit.com/zh-cn/"},{title:"\u6587\u6863\u8F6C\u6362\u738B",key:"thunisoft",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAdCAYAAADPa766AAAABHNCSVQICAgIfAhkiAAAA0dJREFUSEvtVk1PE1EUvfdN48rENoE1sFMIWKLEpVNxb/0F0q3BpL9ABvwB1kjcUn+BuBem7CDVOEBYW9eQOC5c2XnX8950mn4xtbQxmvgW7cx7b+6ce+65Zx673reso/UTIcrSBIdW6lXNy4V31k+Kn7aXdoeF5gfPzz1m3hi2cdR1Ednc35r2Vp6d4pIKH7cXa3fXT11m2SHiWSJpiHDJzJvYfwYISUjCFWby+hKK1HL9zULwR4CksymN+uulub8AiIEppYFAUNRjVA3ilZBNPZluDMxK6Lug1tDY7d71To30rREdcKTKFoKjKyyI0StWBDjQKlNUEn1WLCWtW3VVXGWhHQjvqxFaHJyD/a2pMmJYwdkZ4rwBng4ECUZOwWjDPLOyflLtAtIGoZsGrQtAa/gPHYpcEkFncd68APNVjmimL1OHjpVu7oKh+2lA7HNCwc/M9UJQmQvz5S/ZLiAROzlsmUWwogmG+5KjowoyfIQH38JrXFz7ceZkQHYP4TKxxnwMOGnfvn3JBMDUtxeXbbzu0kgA6t/bBXgLer4g0IpoyYOFCgDWrB7wQi3K0uq/yB089M7dKMqIYo2ySMUmnAB5epYXpS81yzQfqcWBaA6/VStUUSFAuaZcsZApTJJC1m6nRoxZwS9mEiC3Dv0y7geLvYOqbkaYHrMxH4wmZcx/I0PNfJtJDeqJ/YSNXkYskypaM2VLgCwc+ajo8NHbNZaNFiPHWjlVR6KX7TnoBy+Z7Qy7tznFqxsXfS9LgMwf+rso18DSIBbm49a/1NBMBylFHr4HVpx9A+JlJdUP3nQtDUgaFzfrvuvolvgv++ghRZiZ8Qv4wkAcZp0gWJNt/56EkbGBDK9q+o4rAwEDDXTIJmt0hukKxQ3ScdtZm0c9YecBKw5MO7c+AXncV+xZRsuacVrjOUZHVwZiBUpURTlsKeAfhnZ0DmfjOW7E5TKAkvbtWscewTNxmcYCMm45Op//D6SXzX+XkVXvoghlvpukPmwsfC72vKnU03uXoU0cwAgBxwKSfMTO7hXQyeONiQD5cY1yjeVC+zhwFUgTAQJTC3CGHQsIYpizi3Ftc+Ibbfzu+WK0qFcAMn/ke6O+ZNh+nAbDX1JcOOibyiDiAAAAAElFTkSuQmCC"})}),link:"https://convert.thunisoft.com/"},{title:"WebP to PNG",key:"webptopng",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"100px"},src:"https://webptopng.top/src/toto.svg"})}),link:"https://webptopng.top/"},{title:"\u89C6\u9891\u8F6CGIF",key:"v2gif",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://www.v2gif.fun/logo.svg"})}),link:"https://www.v2gif.fun/"},{title:"\u52A8\u6F2B\u98CE\u56FE\u7247",key:"anime",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://photo-to-anime.com/_next/image?url=%2Fassets%2Fimages%2Fdemos%2Fmountain.png&w=1080&q=75"})}),link:"https://photo-to-anime.com/en"},{title:"\u7C98\u571F\u98CE\u56FE\u7247",key:"facetomanyplay",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://src.facetomanyplay.com/thumbs%2Fclay-after.png"})}),link:"https://facetomanyplay.com/"},{title:"PS \u7F51\u9875\u7248",key:"zaixianps",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://zaixianps.net/images/logo.svg"})}),link:"https://zaixianps.net/"},{title:"\u8C03\u8272\u677F\u6A21\u7248",key:"oohcolor",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("div",{style:{background:"linear-gradient(90deg, red, #0f0, #00f)",backgroundClip:"text",color:"transparent",textAlign:"center"},children:"OochColor"})}),link:"https://oohcolor.com/"},{title:"excalidraw\u6D41\u7A0B\u56FE",key:"excalidraw",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"100px"},src:"https://plus.excalidraw.com/images/logo.svg"})}),link:"https://excalidraw.com/"},{title:"\u56FE\u7247\u6587\u5B57\u63D0\u53D6OCR",key:"baimiaoapp",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://xlimage.uzero.cn/shinescan/res/shinescanicon.png"})}),link:"https://web.baimiaoapp.com/"}];function nj(){var e=(0,k._)((0,x.useState)(""),2),t=e[0],n=e[1],r=function(e){if(e.link){window.open(e.link);return}n(e.key)},i=function(){n("")};return(0,y.tZ)("div",{children:t?"qrcode"===t?(0,y.tZ)(nx,{back:i}):"emoji"===t?(0,y.tZ)(nA,{back:i}):null:(0,y.tZ)(V.Z,{wrap:"wrap",gap:12,justify:"space-around",style:{padding:"16px 16px 16px 0",marginLeft:-8},children:n_.map(function(e){return(0,y.tZ)(eT.Z,{hoverable:!0,style:{width:140,paddingTop:12},cover:e.icon,bodyStyle:{padding:12},onClick:function(){r(e)},children:(0,y.tZ)(eT.Z.Meta,{description:e.title,style:{textAlign:"center"}})},e.key)})})})}var nO=C.Z.Sider,nF={position:"relative",backgroundColor:"#fff",borderRight:"1px solid #e8e8e8"},nz={fontSize:18,marginRight:0},nB=[{label:"\u56FE\u5C42",value:"design",icon:(0,y.tZ)(eP.Z,{style:nz})},{label:"\u6587\u5B57",value:"text",icon:(0,y.tZ)(eL.Z,{style:nz})},{label:"\u56FE\u7247",value:"image",icon:(0,y.tZ)(eX.Z,{style:nz})},{label:"\u7D20\u6750",value:"shape",icon:(0,y.tZ)(eM.Z,{style:nz})},{label:"\u753B\u7B14",value:"paint",icon:(0,y.tZ)(eH.Z,{style:nz})},{label:"\u5E94\u7528",value:"app",icon:(0,y.tZ)(eE.Z,{style:nz})}];function nR(){var e=(0,x.useContext)(_).editor;return(0,y.BX)(nO,{style:nF,width:406,className:"fabritor-sider",children:[(0,y.tZ)(eB.Z,{tabPosition:"left",style:{flex:1,overflow:"auto"},size:"small",onChange:function(t){(null==e?void 0:e.canvas)&&("paint"===t?e.canvas.isDrawingMode=!0:e.canvas.isDrawingMode=!1)},items:nB.map(function(e){var t;return{label:(0,y.BX)(V.Z,{vertical:!0,justify:"center",children:[(0,y.tZ)("div",{children:e.icon}),(0,y.tZ)("div",{children:e.label})]}),key:e.value,children:"design"===(t=e.value)?(0,y.tZ)(nv,{}):"text"===t?(0,y.tZ)(eG,{}):"image"===t?(0,y.tZ)(ti,{}):"shape"===t?(0,y.tZ)(tZ,{}):"paint"===t?(0,y.tZ)(tL,{}):"app"===t?(0,y.tZ)(nj,{}):null}})}),(0,y.tZ)(eR.Z,{icon:(0,y.tZ)(eI.Z,{}),style:{left:10,bottom:14},href:"https://github.com/wuxianqiang/fabritor",target:"_blank"})]})}var nP=n(1912),nL=function(e){var t=e.prefixText,n=(0,J._)(e,["prefixText"]);return(0,y.tZ)(tz.Z,(0,T._)({prefix:(0,y.tZ)("span",{style:{color:"rgba(0, 0, 0, 0.5)",marginRight:4},children:void 0===t?"\u5BBD":t}),controls:!1,changeOnBlur:!0,min:50,max:8e3,style:{flex:1}},n))};function nX(e){var t=e.value,n=e.onChange,r=(0,k._)((0,x.useState)([]),2),i=r[0],o=r[1],a=function(e,t){var r=(0,nP._)(i);r[t]=e,null==n||n(r)};return(0,x.useEffect)(function(){o(t)},[t]),(0,y.BX)(V.Z,{gap:8,children:[(0,y.tZ)(nL,{value:null==i?void 0:i[0],onChange:function(e){a(e,0)}}),(0,y.tZ)(nL,{prefixText:"\u9AD8",value:null==i?void 0:i[1],onChange:function(e){a(e,1)}})]})}var nM=tC.Z.Item;function nH(){var e=(0,k._)(tC.Z.useForm(),1)[0],t=(0,x.useContext)(_).editor,n=function(e){var n=t.sketch,r=t.canvas,i=ey(e);"string"!=typeof i&&(i=new en.fabric.Gradient(i)),n.set("fill",i),r.requestRenderAll()};return(0,x.useEffect)(function(){if(t){var n=t.sketch;e.setFieldsValue({size:[n.width,n.height],fill:eb(n.fill)})}},[t]),(0,y.BX)(tC.Z,{layout:"vertical",colon:!1,form:e,onValuesChange:function(e){Object.keys(e).forEach(function(r){"size"===r?t.setSketchSize({width:e[r][0],height:e[r][1]}):"fill"===r&&n(e[r])}),t.fireCustomModifiedEvent()},children:[(0,y.tZ)(nM,{label:"\u753B\u5E03\u5C3A\u5BF8",name:"size",children:(0,y.tZ)(nX,{})}),(0,y.tZ)(nM,{label:"\u753B\u5E03\u80CC\u666F\u8272",name:"fill",children:(0,y.tZ)(tO,{type:"sketch"})}),(0,y.tZ)(nM,{label:"\u753B\u5E03\u56FE\u7247",name:"fill",children:(0,y.tZ)("img",{width:160,src:"https://picsum.photos/seed/picsum/200/300",alt:"img"})})]})}var nE=n(6118),nI=n(2638),nT=n(3676),nW=n(3022),nJ=n(5605),nV=[{icon:nI.Z,value:"bold"},{icon:nT.Z,value:"italic"},{icon:nW.Z,value:"underline"},{icon:nJ.Z,value:"linethrough"}];function nU(e){var t=e.value,n=e.onChange,r=function(e){n&&n((0,W._)((0,T._)({},t),{[e]:!t[e]}))};return(0,y.tZ)(e1.Z.Compact,{block:!0,children:nV.map(function(e){return(0,y.tZ)($.ZP,{style:{width:46},icon:(0,y.tZ)(e.icon,{style:{color:(null==t?void 0:t[e.value])?"#1677ff":""}}),onClick:function(){r(e.value)}},e.value)})})}var nD=n(8732),nN=n(6470),nY=n(4180),nq=[{label:(0,y.tZ)(nD.Z,{}),value:"left"},{label:(0,y.tZ)(nN.Z,{}),value:"center"},{label:(0,y.tZ)(nY.Z,{}),value:"right"}];function nG(e){var t=e.value,n=(0,J._)(e,["value"]);return(0,y.tZ)(e5.ZP.Group,(0,W._)((0,T._)({value:t},n),{options:nq,optionType:"button",buttonStyle:"solid"}))}nD.Z,nN.Z,nY.Z;var nK=n(772),nQ=n(2685);function n$(e){var t=e.dataSource,n=e.renderItemChildren,r=(0,J._)(e,["dataSource","renderItemChildren"]);return(0,y.tZ)(tX.Z,(0,T._)({dataSource:t,renderItem:function(e){return(0,y.tZ)(tX.Z.Item,{className:"fabritor-list-item",style:{border:"2px solid transparent",padding:"10px 16px"},onClick:function(){var t;null==e||null===(t=e.onClick)||void 0===t||t.call(e,e)},children:(0,y.tZ)(U,{style:{height:40},children:n(e)})})}},r))}var n0=n(455);function n1(e){var t=e.open,n=e.setOpen,r=e.title,i=e.children,o=(0,J._)(e,["open","setOpen","title","children"]);return(0,x.useEffect)(function(){t?(document.body.style.overflow="hidden",document.body.scrollTop=0):document.body.style.overflow="auto"},[t]),(0,y.tZ)(n0.Z,(0,W._)((0,T._)({title:null,placement:"right",open:t,mask:!1,maskClosable:!1,width:280,rootStyle:{top:50,outline:"none"},contentWrapperStyle:{boxShadow:"none"},bodyStyle:{padding:16},closeIcon:null},o),{children:(0,y.BX)("div",{children:[(0,y.tZ)($.ZP,{type:"link",href:"javascript:void(0);",size:"small",onClick:function(){n(!1)},icon:(0,y.tZ)(nw.Z,{}),style:{marginLeft:-10},children:void 0===r?"":r}),i]})}))}var n2=tC.Z.Item;function n3(e){var t=(0,k._)(tC.Z.useForm(),1)[0],n=e.value,r=e.onChange;return(0,x.useEffect)(function(){n&&t.setFieldsValue(n)},[n]),(0,y.BX)(tC.Z,{form:t,onValuesChange:function(e){r&&r((0,T._)({},n,e))},colon:!1,children:[(0,y.tZ)(n2,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u9634\u5F71"})}),(0,y.tZ)(n2,{label:"\u989C\u8272",name:"color",children:(0,y.tZ)(t_,{})}),(0,y.tZ)(n2,{label:"\u6A21\u7CCA",name:"blur",children:(0,y.tZ)(tF.Z,{min:0,max:20})}),(0,y.tZ)(n2,{label:"\u504F\u79FB",name:"offset",children:(0,y.tZ)(tF.Z,{min:-180,max:180})})]})}var n4=n(6599),n6=n(1957),n8=n(5379),n5=tC.Z.Item;function n7(e){var t=(0,k._)(tC.Z.useForm(),1)[0],n=e.value,r=e.onChange;return(0,x.useEffect)(function(){n&&t.setFieldsValue(n)},[n]),(0,y.BX)(tC.Z,{form:t,onValuesChange:function(e){r&&r((0,T._)({},n,e))},colon:!1,children:[(0,y.BX)(n4.Z,{gutter:16,children:[(0,y.tZ)(n6.Z,{children:(0,y.tZ)(n5,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u6CE2\u6D6A\u578B\u6587\u5B57"})})}),(0,y.tZ)(n6.Z,{children:(0,y.tZ)(n5,{name:"enable",valuePropName:"checked",children:(0,y.tZ)(n8.Z,{})})})]}),(0,y.tZ)(n5,{label:"\u504F\u79FB",name:"offset",children:(0,y.tZ)(tF.Z,{min:-100,max:100})})]})}var n9=tC.Z.Item;function re(e){var t=(0,k._)(tC.Z.useForm(),1)[0],n=e.value,r=e.onChange;return(0,x.useEffect)(function(){n&&t.setFieldsValue(n)},[n]),(0,y.BX)(tC.Z,{form:t,onValuesChange:function(e){r&&r((0,T._)({},n,e))},colon:!1,children:[(0,y.BX)(n4.Z,{gutter:16,children:[(0,y.tZ)(n6.Z,{children:(0,y.tZ)(n9,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u56FE\u7247\u586B\u5145"})})}),(0,y.tZ)(n6.Z,{children:(0,y.tZ)(n9,{name:"enable",valuePropName:"checked",children:(0,y.tZ)(n8.Z,{})})})]}),(0,y.tZ)(n9,{name:"url",children:(0,y.tZ)(tr,{size:"middle",type:"default"})})]})}var rt=tC.Z.Item;function rn(){var e,t,n=(0,k._)(tC.Z.useForm(),1)[0],r=(0,x.useContext)(_),i=r.object,o=r.editor,a=(e=(0,w._)(function(e){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:if(!i)return[2];if(!e.enable||!e.url)return i.fill instanceof en.fabric.Pattern&&i.set("fill","#000000"),[2,Promise.resolve()];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,eK(e.url)];case 2:return t=n.sent(),i.set("fill",new en.fabric.Pattern({source:t,repeat:"repeat"})),[3,4];case 3:return console.log(n.sent()),[3,4];case 4:return[2]}})}),function(t){return e.apply(this,arguments)}),l=function(e){var t=ey(e);"string"!=typeof t&&(t=new en.fabric.Gradient(t)),i.set("stroke",t)},s=(t=(0,w._)(function(e){var t,n,r,s,c,u,h,f,d;return(0,Z.Jh)(this,function(p){switch(p.label){case 0:if(!i||!o)return[2];t=Object.keys(e),n=!0,r=!1,s=void 0,p.label=1;case 1:p.trys.push([1,9,10,11]),c=t[Symbol.iterator](),p.label=2;case 2:if(n=(u=c.next()).done)return[3,8];if(f=e[h=u.value],"shadow"!==h)return[3,3];return i.shadow={color:f.color,blur:f.blur,offsetX:f.offset,offsetY:f.offset},[3,7];case 3:if("path"!==h)return[3,4];return f.enable?eN(i,f.offset):eY(i),[3,7];case 4:if("pattern"!==h)return[3,6];return[4,a(f)];case 5:return p.sent(),[3,7];case 6:"stroke"===h?l(f):i.set(h,f),p.label=7;case 7:return n=!0,[3,2];case 8:return[3,11];case 9:return d=p.sent(),r=!0,s=d,[3,11];case 10:try{n||null==c.return||c.return()}finally{if(r)throw s}return[7];case 11:return o.canvas.requestRenderAll(),o.fireCustomModifiedEvent(),[2]}})}),function(e){return t.apply(this,arguments)}),c=function(){var e,t,r,o,a=i.fill;n.setFieldsValue({stroke:eb(i.stroke),strokeWidth:i.strokeWidth||0,textBackgroundColor:i.textBackgroundColor,shadow:{color:(null===(e=i.shadow)||void 0===e?void 0:e.color)||i.stroke||"#000000",blur:(null===(t=i.shadow)||void 0===t?void 0:t.blur)||0,offset:(null===(r=i.shadow)||void 0===r?void 0:r.offsetX)||0},path:{enable:!!i.path,offset:eD(i)},pattern:{enable:a instanceof en.fabric.Pattern,url:null==a?void 0:null===(o=a.source)||void 0===o?void 0:o.src}})};return(0,x.useEffect)(function(){i&&"f-text"===i.type&&c()},[i]),(0,y.BX)(tC.Z,{form:n,onValuesChange:s,colon:!1,style:{marginTop:24},children:[(0,y.tZ)(rt,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u63CF\u8FB9"})}),(0,y.tZ)(rt,{label:"\u989C\u8272",name:"stroke",children:(0,y.tZ)(tO,{})}),(0,y.tZ)(rt,{label:"\u7C97\u7EC6",name:"strokeWidth",children:(0,y.tZ)(tB,{min:0,max:20})}),(0,y.tZ)(rt,{name:"shadow",style:{marginBottom:0},children:(0,y.tZ)(n3,{})}),(0,y.tZ)(rt,{name:"path",style:{marginBottom:0},children:(0,y.tZ)(n7,{})}),(0,y.tZ)(rt,{name:"pattern",children:(0,y.tZ)(re,{})})]})}var rr=tC.Z.Item;function ri(){var e,t=(0,x.useContext)(_),n=t.object,r=t.editor,i=(0,k._)(tC.Z.useForm(),1)[0],o=(0,k._)((0,x.useState)(!1),2),a=o[0],l=o[1],s=[{icon:(0,y.tZ)(nK.Z,{style:{fontSize:22}}),label:"\u7279\u6548",key:"fx",onClick:function(){l(!0)}}],c=function(e){n.set({fontWeight:(null==e?void 0:e.bold)?"bold":"normal",fontStyle:(null==e?void 0:e.italic)?"italic":"normal",underline:!!e.underline,linethrough:!!e.linethrough})},u=function(e){var t=ey(e);if("string"!=typeof t){t.gradientUnits="pixels";var r=t.coords;t.coords={x1:1===r.x1?n.width:0,y1:1===r.y1?n.height:0,x2:1===r.x2?n.width:0,y2:1===r.y2?n.height:0,r1:0,r2:n.width>n.height?n.width/2:n.height}}"string"!=typeof t&&(t=new en.fabric.Gradient(t)),n.set({fill:t})},h=(e=(0,w._)(function(e){var t,i,o,a,l,s,h,f,d;return(0,Z.Jh)(this,function(p){switch(p.label){case 0:if(!(null===(t=i=Object.keys(e))||void 0===t?void 0:t.length))return[2];o=!0,a=!1,l=void 0,p.label=1;case 1:p.trys.push([1,12,13,14]),s=i[Symbol.iterator](),p.label=2;case 2:if(o=(h=s.next()).done)return[3,11];if("fontStyles"!==(f=h.value))return[3,3];return c(e[f]),[3,9];case 3:if("fontFamily"!==f)return[3,8];p.label=4;case 4:return p.trys.push([4,,6,7]),[4,ef(e[f])];case 5:return p.sent(),[3,7];case 6:return n.set(f,e[f]),[7];case 7:return[3,9];case 8:"fill"===f?u(e[f]):n.getSelectedText()&&"fill"===f?n.setSelectionStyles({fill:e[f]}):(n.set("styles",{}),n.set(f,e[f])),p.label=9;case 9:"fontSize"!==f&&"lineHeight"!==f&&"charSpacing"!==f&&r.fireCustomModifiedEvent(),p.label=10;case 10:return o=!0,[3,2];case 11:return[3,14];case 12:return d=p.sent(),a=!0,l=d,[3,14];case 13:try{o||null==s.return||s.return()}finally{if(a)throw l}return[7];case 14:return r.canvas.requestRenderAll(),[2]}})}),function(t){return e.apply(this,arguments)});return(0,x.useEffect)(function(){i.setFieldsValue({fontFamily:n.fontFamily,fontSize:n.fontSize,fill:eb(n.fill),textAlign:n.textAlign,lineHeight:n.lineHeight,charSpacing:n.charSpacing,fontStyles:{bold:"bold"===n.fontWeight,italic:"italic"===n.fontStyle,underline:n.underline,linethrough:n.linethrough}})},[n]),(0,y.BX)(e8.Fragment,{children:[(0,y.BX)(tC.Z,{form:i,onValuesChange:h,colon:!1,children:[(0,y.tZ)(rr,{name:"fontFamily",label:"\u5B57\u4F53",children:(0,y.tZ)(nE.Z,{options:ec})}),(0,y.tZ)(rr,{name:"fontSize",label:"\u5B57\u53F7",children:(0,y.tZ)(tB,{max:400,onChangeComplete:function(){r.fireCustomModifiedEvent()}})}),(0,y.tZ)(rr,{name:"fill",label:"\u989C\u8272",children:(0,y.tZ)(tO,{type:"fontColor",defaultColor:"#000000"})}),(0,y.tZ)(rr,{name:"textAlign",label:"\u5BF9\u9F50",children:(0,y.tZ)(nG,{})}),(0,y.tZ)(rr,{name:"fontStyles",label:"\u6837\u5F0F",children:(0,y.tZ)(nU,{})}),(0,y.tZ)(rr,{name:"charSpacing",label:"\u5B57\u95F4\u8DDD",children:(0,y.tZ)(tB,{min:-200,max:800,onChangeComplete:function(){r.fireCustomModifiedEvent()}})}),(0,y.tZ)(rr,{name:"lineHeight",label:"\u884C\u95F4\u8DDD",children:(0,y.tZ)(tB,{min:.5,max:2.5,step:.01,onChangeComplete:function(){r.fireCustomModifiedEvent()}})})]}),(0,y.tZ)(n$,{dataSource:s,renderItemChildren:function(e){return(0,y.BX)(e8.Fragment,{children:[e.icon,(0,y.tZ)("span",{style:{fontSize:16,fontWeight:"bold",margin:"0 6px 0 10px"},children:e.label}),(0,y.tZ)(nQ.Z,{})]})}}),(0,y.tZ)(n1,{open:a,setOpen:l,title:"\u6587\u5B57\u7279\u6548",children:(0,y.tZ)(rn,{})})]})}var ro=n(3106);function ra(e){var t=e.onChange;return(0,y.tZ)(e3.Z,{content:(0,y.tZ)(tr,{size:"middle",type:"default",onChange:t}),placement:"top",trigger:"click",children:(0,y.tZ)($.ZP,{type:"primary",block:!0,icon:(0,y.tZ)(ro.Z,{}),children:"\u66FF\u6362\u56FE\u7247"})})}var rl=tC.Z.Item,rs=function(e){var t=e.stroke,n=e.strokeWidth,r=e.strokeDashArray;if(!t)return"none";if(null==r?void 0:r.length){var i=(0,k._)(r,2),o=i[0],a=i[1];return[o/=n/2>1?n/2:n,a/=n/4>1?n/4:n].join(",")}return"line"},rc=function(e){var t=e.type,n=e.strokeWidth;if(!t)return null;if("line"!==t){var r=t.split(",");return r[0]=r[0]*(n/2>1?n/2:n),r[1]=r[1]*(n/4>1?n/4:n),r}return null},ru=[{key:"none",svg:''},{key:"line",svg:''},{key:"12,2",svg:''},{key:"6,2",svg:''},{key:"2,2",svg:''}];function rh(e){var t=e.value,n=e.onChange,r=(0,x.useContext)(_).editor,i=(0,k._)(tC.Z.useForm(),1)[0],o=function(){r.fireCustomModifiedEvent()};return(0,x.useEffect)(function(){i.setFieldsValue(t)},[t]),(0,y.BX)(tC.Z,{form:i,onValuesChange:function(e){n&&n((0,T._)({},t,e))},colon:!1,children:[(0,y.tZ)(rl,{name:"type",label:"\u6837\u5F0F",labelCol:{span:24},children:(0,y.tZ)(e5.ZP.Group,{onChange:o,children:ru.map(function(e){return(0,y.tZ)(e5.ZP.Button,{value:e.key,children:(0,y.tZ)("span",{dangerouslySetInnerHTML:{__html:e.svg},style:{display:"inline-flex",alignItems:"center",marginTop:6}})},e.key)})})}),(0,y.tZ)(rl,{name:"stroke",label:"\u989C\u8272",children:(0,y.tZ)(t_,{onChange:o})}),(0,y.tZ)(rl,{name:"strokeWidth",label:"\u7C97\u7EC6",children:(0,y.tZ)(tB,{min:1,max:100,onChangeComplete:o})}),(0,y.tZ)(rl,{name:"borderRadius",label:"\u5706\u89D2",children:(0,y.tZ)(tB,{min:0,max:200,onChangeComplete:o})})]})}function rf(e){var t=e.value,n=e.onChange,r=(0,k._)((0,x.useState)(!1),2),i=r[0],o=r[1];return(0,y.BX)(e8.Fragment,{children:[(0,y.tZ)($.ZP,{block:!0,icon:(0,y.tZ)(eM.Z,{}),onClick:function(){o(!0)},children:"\u8FB9\u6846"}),(0,y.tZ)(n1,{open:i,setOpen:o,title:"\u8FB9\u6846",children:(0,y.tZ)("div",{style:{marginTop:24},children:(0,y.tZ)(rh,{value:t,onChange:n})})})]})}var rd=n(9356),rp=n.n(rd),rv=n(8053),rg=n(6584),rb=n(4769);function ry(e){var t=e.object,n=(0,x.useRef)(),r=(0,x.useRef)(null),i=(0,k._)((0,x.useState)(!1),2),o=i[0],a=i[1],l=(0,k._)((0,x.useState)({}),2),s=l[0],c=l[1],u=function(){if(r.current){var e=r.current.getCroppedCanvas().toDataURL();t.setSrc(e,function(){t.set("hasControls",!0),t.group&&t.group.addWithUpdate(),t.canvas.requestRenderAll(),t.setCoords()}),a(!1)}},h=function(e){r.current&&r.current.setAspectRatio(e)};return(0,x.useEffect)(function(){return function(){r.current&&(r.current.destroy(),r.current=null)}},[]),(0,y.BX)("div",{children:[(0,y.tZ)($.ZP,{block:!0,icon:(0,y.tZ)(rv.Z,{}),onClick:function(){a(!0);var e=t.getBoundingRect();c({src:t.getSrc(),width:e.width,height:e.height,left:e.left+406,top:e.top+50}),setTimeout(function(){r.current=new(rp())(n.current,{scalable:!1,autoCropArea:1,viewMode:3,toggleDragModeOnDblclick:!1}),t.set("hasControls",!1),t.canvas.requestRenderAll()},66)},children:"\u88C1\u526A"}),o?(0,y.BX)("div",{style:{position:"fixed",left:0,top:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,.65)",zIndex:1e3},className:"fabritor-crop-wrapper",children:[(0,y.tZ)("div",{style:{position:"absolute",zIndex:1001,left:s.left,top:s.top-38},children:(0,y.BX)(e1.Z.Compact,{block:!0,children:[(0,y.tZ)($.ZP,{onClick:function(){h(1)},children:"1:1"}),(0,y.tZ)($.ZP,{onClick:function(){h(4/3)},children:"4:3"}),(0,y.tZ)($.ZP,{onClick:function(){h(3/4)},children:"3:4"}),(0,y.tZ)($.ZP,{onClick:function(){h(16/9)},children:"16:9"}),(0,y.tZ)($.ZP,{onClick:function(){h(9/16)},children:"9:16"}),(0,y.tZ)($.ZP,{icon:(0,y.tZ)(rg.Z,{}),onClick:function(){a(!1),t.set("hasControls",!0),t.canvas.requestRenderAll()}}),(0,y.tZ)($.ZP,{icon:(0,y.tZ)(rb.Z,{}),onClick:u})]})}),(0,y.tZ)("div",{style:{width:s.width,height:s.height,position:"absolute",zIndex:1001,left:s.left,top:s.top},onDoubleClick:u,children:(0,y.tZ)("img",{ref:n,src:s.src,style:{display:"block",maxWidth:"100%"}})})]}):null]})}var rm=[{label:"\u65E0",value:"none",src:"https://cdn.pixabay.com/photo/2017/02/15/13/18/girl-2068638_1280.jpg"},{label:"\u590D\u53E4",value:"Sepia",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u590D\u53E4.png"},{label:"\u80F6\u7247",value:"Kodachrome",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u80F6\u7247.png"},{label:"\u8001\u7167\u7247",value:"Vintage",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u8001\u7167\u7247.png"},{label:"\u5B9D\u4E3D\u6765",value:"Polaroid",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u5B9D\u4E3D\u6765.png"},{label:"\u6A21\u7CCA",value:"Blur",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u6A21\u7CCA.png"},{label:"\u6D6E\u96D5",value:"Emboss",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u6D6E\u96D5.png"},{label:"\u50CF\u7D20",value:"Pixelate",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u50CF\u7D20.png"},{label:"\u9ED1\u767D",value:"Grayscale",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u9ED1\u767D.png"},{label:"\u8C03\u8272",value:"HueRotation",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u8C03\u8272.png"}];function rw(e){var t=e.value,n=e.onChange,r=function(e,r){null==n||n((0,W._)((0,T._)({},t),{[r]:e}))};return(0,y.tZ)("div",{className:"fabritor-radio-image-group",children:rm.map(function(e){return(0,y.BX)("div",{className:"fabritor-radio-image-group-item",onClick:function(){r(e.value,"type")},children:[(0,y.tZ)("div",{className:"fabritor-radio-image-group-img",style:{borderColor:(null==t?void 0:t.type)===e.value?"#ff2222":"#eeeeee"},children:(0,y.tZ)("img",{src:e.src})}),(0,y.tZ)("span",{children:e.label}),"Blur"===e.value&&(null==t?void 0:t.type)==="Blur"?(0,y.tZ)(tF.Z,{min:0,max:1,step:.01,value:(null==t?void 0:t.param)==void 0?.2:null==t?void 0:t.param,onChange:function(e){r(e,"param")}}):null,"Pixelate"===e.value&&(null==t?void 0:t.type)==="Pixelate"?(0,y.tZ)(tF.Z,{min:2,max:20,step:.01,value:(null==t?void 0:t.param)==void 0?4:null==t?void 0:t.param,onChange:function(e){r(e,"param")}}):null,"HueRotation"===e.value&&(null==t?void 0:t.type)==="HueRotation"?(0,y.tZ)(tF.Z,{min:-2,max:2,step:.002,value:(null==t?void 0:t.param)==void 0?0:null==t?void 0:t.param,onChange:function(e){r(e,"param")}}):null]})})})}var rk=tC.Z.Item,rZ=function(e){if(!e)return{type:"none"};var t=e.type;return"Blur"===t?{type:t,param:e.blur}:"Pixelate"===t?{type:t,param:e.blocksize}:"HueRotation"===t?{type:t,param:e.rotation}:{type:t}};function rx(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)(tC.Z.useForm(),1)[0],i=function(){var e=t.getFilter();console.log(e),r.setFieldsValue({filter:rZ(e)})};return(0,x.useEffect)(function(){t&&"f-image"===t.type&&i()},[t]),(0,y.tZ)(tC.Z,{form:r,onValuesChange:function(e){if(e.filter){var r,i=e.filter,o=i.type,a=i.param;r="Emboss"===o?new en.fabric.Image.filters.Convolute({matrix:[1,1,1,1,.7,-1,-1,-1,-1]}):"none"===o?null:new en.fabric.Image.filters[o],"Blur"===o&&(r.blur=void 0==a?.2:a),"Pixelate"===o&&(r.blocksize=void 0==a?4:a),"HueRotation"===o&&(r.rotation=void 0==a?0:a),t.applyFilter(r),t.canvas.requestRenderAll(),n.fireCustomModifiedEvent()}},children:(0,y.tZ)(rk,{name:"filter",children:(0,y.tZ)(rw,{})})})}var rC=tC.Z.Item;function rS(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)(tC.Z.useForm(),1)[0],i=(0,k._)((0,x.useState)(!1),2),o=i[0],a=i[1],l=[{icon:(0,y.tZ)(nK.Z,{style:{fontSize:22}}),label:"\u6EE4\u955C",key:"fx",onClick:function(){a(!0)}}],s=function(e){e&&t.setSrc(e,function(){n.canvas.requestRenderAll(),n.fireCustomModifiedEvent()})},c=function(e){var r=e||{},i=r.type,o=r.stroke,a=r.strokeWidth,l=r.borderRadius;"none"===i?t.setBorder({stroke:null,borderRadius:l}):t.setBorder({stroke:void 0===o?"#000000":o,strokeWidth:a,borderRadius:l,strokeDashArray:rc(e)}),n.canvas.requestRenderAll()};return(0,x.useEffect)(function(){if(t){var e=t.getBorder();r.setFieldsValue({border:(0,W._)((0,T._)({type:rs(e)},e),{stroke:e.stroke||"#000000"}),opacity:t.opacity})}},[t]),(0,y.BX)(e8.Fragment,{children:[(0,y.BX)(tC.Z,{form:r,onValuesChange:function(e){e.img&&s(e.img),e.flip&&(t.set(e.flip,!t[e.flip]),n.canvas.requestRenderAll(),n.fireCustomModifiedEvent()),e.border&&c(e.border)},colon:!1,children:[(0,y.tZ)(rC,{name:"img",children:(0,y.tZ)(ra,{})}),(0,y.BX)(n4.Z,{gutter:8,children:[(0,y.tZ)(n6.Z,{span:12,children:(0,y.tZ)(rC,{children:(0,y.tZ)(ry,{object:t})})}),(0,y.tZ)(n6.Z,{span:12,children:(0,y.tZ)(rC,{name:"border",children:(0,y.tZ)(rf,{})})})]})]}),(0,y.tZ)(n$,{dataSource:l,renderItemChildren:function(e){return(0,y.BX)(e8.Fragment,{children:[e.icon,(0,y.tZ)("span",{style:{fontSize:16,fontWeight:"bold",margin:"0 6px 0 10px"},children:e.label}),(0,y.tZ)(nQ.Z,{})]})}}),(0,y.tZ)(n1,{open:o,setOpen:a,title:"\u6EE4\u955C",children:(0,y.tZ)(rx,{})})]})}var rA=tC.Z.Item,r_=ru.slice(1);function rj(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)(tC.Z.useForm(),1)[0];return(0,x.useEffect)(function(){r.setFieldsValue({stroke:t.stroke||"#000000",type:rs(t),strokeWidth:t.strokeWidth,round:"round"===t.strokeLineCap})},[t]),(0,y.BX)(tC.Z,{form:r,onValuesChange:function(e){var r=Object.keys(e);if(null==r?void 0:r.length){var i=!0,o=!1,a=void 0;try{for(var l,s=r[Symbol.iterator]();!(i=(l=s.next()).done);i=!0){var c=l.value;switch(c){case"stroke":t.set("stroke",e[c]),n.fireCustomModifiedEvent();break;case"strokeWidth":t.setStrokeWidth(e[c]);break;case"round":t.set("strokeLineCap",e[c]?"round":"butt"),n.fireCustomModifiedEvent();break;case"type":t.set("strokeDashArray",rc({type:e[c],strokeWidth:t.strokeWidth})),n.fireCustomModifiedEvent()}}}catch(u){o=!0,a=u}finally{try{i||null==s.return||s.return()}finally{if(o)throw a}}t.setCoords(),n.canvas.requestRenderAll()}},colon:!1,children:[(0,y.tZ)(rA,{name:"stroke",label:"\u989C\u8272",children:(0,y.tZ)(t_,{})}),(0,y.tZ)(rA,{name:"type",label:"\u6837\u5F0F",labelCol:{span:24},children:(0,y.tZ)(e5.ZP.Group,{children:r_.map(function(e){return(0,y.tZ)(e5.ZP.Button,{value:e.key,children:(0,y.tZ)("span",{dangerouslySetInnerHTML:{__html:e.svg},style:{display:"inline-flex",alignItems:"center",marginTop:6}})},e.key)})})}),(0,y.tZ)(rA,{name:"strokeWidth",label:"\u7C97\u7EC6",children:(0,y.tZ)(tB,{min:1,max:50,onChangeComplete:function(){n.fireCustomModifiedEvent()}})}),(0,y.tZ)(rA,{name:"round",label:"\u5706\u89D2",valuePropName:"checked",children:(0,y.tZ)(n8.Z,{})})]})}var rO=tC.Z.Item;function rF(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)(tC.Z.useForm(),1)[0],i=function(e){var r=e||{},i=r.type,o=r.stroke,a=r.strokeWidth,l=r.borderRadius;"none"===i?t.set({stroke:null,strokeWidth:1}):t.set({stroke:void 0===o?"#000":o,strokeWidth:a,strokeDashArray:rc({type:i,strokeWidth:a})}),"rect"===t.type?t.set({rx:l,ry:l}):t.set("strokeLineJoin",l>0?"round":"miter"),t.setCoords(),n.canvas.requestRenderAll()};return(0,x.useEffect)(function(){t&&r.setFieldsValue({border:{type:rs(t),stroke:t.stroke||"#000000",strokeWidth:t.strokeWidth||1,borderRadius:t.rx||t.ry||("round"===t.strokeLineJoin?100:0)},fill:eb(t.fill)})},[t]),(0,y.BX)(tC.Z,{form:r,onValuesChange:function(e){if(e.fill){var r=ey(e.fill);"string"!=typeof r&&(r=new en.fabric.Gradient(r)),t.set("fill",r),n.canvas.requestRenderAll()}e.border&&i(e.border)},colon:!1,children:[(0,y.tZ)(rO,{name:"fill",label:"\u989C\u8272",children:(0,y.tZ)(tO,{defaultColor:"#000000"})}),(0,y.tZ)(rO,{name:"border",label:(0,y.tZ)("span",{style:{fontWeight:"bold",fontSize:15},children:"\u8FB9\u6846"}),labelCol:{span:24},children:(0,y.tZ)(rh,{})})]})}var rz=n(5285),rB=n(387),rR=n(5538),rP=n(7388),rL=n(144),rX=n(1548),rM=n(9956),rH=n(8979);function rE(e){var t=e.value,n=e.onChange,r=e.onChangeComplete;return(0,y.tZ)(e3.Z,{content:(0,y.tZ)(tB,{style:{width:200},min:0,max:1,step:.01,value:t,onChange:n,onChangeComplete:r}),placement:"bottom",trigger:"click",children:(0,y.tZ)("span",{children:(0,y.tZ)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",children:(0,y.BX)("g",{fill:"currentColor","fill-rule":"evenodd",children:[(0,y.tZ)("path",{d:"M3 2h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1z"}),(0,y.tZ)("path",{d:"M11 2h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1z",opacity:".45"}),(0,y.tZ)("path",{d:"M19 2h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1z",opacity:".15"}),(0,y.tZ)("path",{d:"M7 6h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1z",opacity:".7"}),(0,y.tZ)("path",{d:"M15 6h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1z",opacity:".3"})]})})})})}var rI=[{key:"flipX",label:"\u6C34\u5E73\u7FFB\u8F6C"},{key:"flipY",label:"\u5782\u76F4\u7FFB\u8F6C"}];function rT(e){var t=e.onChange;return(0,y.tZ)(ee.Z,{placement:"bottom",trigger:["click"],menu:{items:rI,onClick:function(e){var n=e.key;null==t||t(n)}},arrow:!0,children:(0,y.tZ)("span",{children:(0,y.BX)("svg",{width:"22",height:"22",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,y.tZ)("path",{d:"M30 10H40C41.8856 10 42.8284 10 43.4142 10.5858C44 11.1716 44 12.1144 44 14V34C44 35.8856 44 36.8284 43.4142 37.4142C42.8284 38 41.8856 38 40 38H30",stroke:"currentColor","stroke-width":"4","stroke-linecap":"square","stroke-linejoin":"miter"}),(0,y.tZ)("path",{d:"M18 10H8C6.11438 10 5.17157 10 4.58579 10.5858C4 11.1716 4 12.1144 4 14V34C4 35.8856 4 36.8284 4.58579 37.4142C5.17157 38 6.11438 38 8 38H18",stroke:"currentColor","stroke-width":"4","stroke-linecap":"square","stroke-linejoin":"miter"}),(0,y.tZ)("path",{d:"M24 6V42",stroke:"currentColor","stroke-width":"4","stroke-linecap":"square","stroke-linejoin":"miter"})]})})})}var rW=tC.Z.Item,rJ=function(e){var t=e.value,n=e.onChange,r=(0,J._)(e,["value","onChange"]),i=(0,k._)((0,x.useState)(t),2),o=i[0],a=i[1];return(0,x.useEffect)(function(){a(t)},[t]),(0,y.tZ)(tz.Z,(0,T._)({style:{width:"100%"},controls:!1,step:1,precision:2,changeOnBlur:!0,value:o,onChange:a,onPressEnter:function(){null==n||n(o)}},r))},rV=["textbox","f-text","rect"];function rU(){var e=(0,x.useContext)(_),t=e.editor,n=e.object,r=(0,k._)((0,x.useState)(!1),2),i=r[0],o=r[1],a=(0,x.useRef)(!1),l=(0,k._)(tC.Z.useForm(),1)[0],s=function(e,t){var r=t-n.strokeWidth;"width"===e?a.current?n.set({width:r,scaleX:1,scaleY:1}):n.scaleToWidth(r,!0):"height"===e&&(a.current?n.set({height:r,scaleX:1,scaleY:1}):n.scaleToHeight(r,!0))},c=function(){l.setFieldsValue({width:n.getScaledWidth(),height:n.getScaledHeight(),lockRatio:!0,left:n.left,top:n.top,angle:n.angle})},u=function(){c()};return(0,x.useEffect)(function(){(i&&n&&!n.group||"activeSelection"!==n.type)&&(a.current=rV.includes(n.type),c(),n.on("modified",u))},[n,i]),(0,y.BX)(e8.Fragment,{children:[(0,y.tZ)($.ZP,{block:!0,onClick:function(){o(!0)},children:"\u8C03\u6574\u4F4D\u7F6E"}),(0,y.tZ)(n1,{open:i,setOpen:o,title:"\u8C03\u6574\u4F4D\u7F6E",children:(0,y.tZ)("div",{style:{marginTop:24},children:(0,y.BX)(tC.Z,{form:l,layout:"vertical",colon:!1,onValuesChange:function(e){Object.keys(e).forEach(function(t){var r=e[t];"width"===t||"height"===t?(s(t,r),c()):n.set(t,r)}),t.canvas.requestRenderAll(),t.fireCustomModifiedEvent()},children:[(0,y.BX)(n4.Z,{gutter:8,children:[(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"\u5BBD(\u50CF\u7D20)",name:"width",children:(0,y.tZ)(rJ,{min:1})})}),(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"\u9AD8(\u50CF\u7D20)",name:"height",children:(0,y.tZ)(rJ,{min:1})})}),(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"\u9501\u5B9A\u6BD4\u4F8B",name:"lockRatio",valuePropName:"checked",children:(0,y.tZ)(n8.Z,{disabled:!0})})})]}),(0,y.BX)(n4.Z,{gutter:8,children:[(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"X(\u50CF\u7D20)",name:"left",children:(0,y.tZ)(rJ,{})})}),(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"Y(\u50CF\u7D20)",name:"top",children:(0,y.tZ)(rJ,{})})}),(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"\u65CB\u8F6C(\xb0)",name:"angle",children:(0,y.tZ)(rJ,{min:-360,max:360,precision:0})})})]})]})})})]})}var rD=[{label:"\u5C45\u4E2D",icon:rz.Z,key:"center"},{label:"\u5DE6\u5BF9\u9F50",icon:nD.Z,key:"left"},{label:"\u6C34\u5E73\u5C45\u4E2D",icon:nN.Z,key:"centerH"},{label:"\u53F3\u5BF9\u9F50",icon:nY.Z,key:"right"},{label:"\u9876\u90E8\u5BF9\u9F50",icon:rB.Z,key:"top"},{label:"\u5782\u76F4\u5C45\u4E2D",icon:rR.Z,key:"centerV"},{label:"\u5E95\u90E8\u5BF9\u9F50",icon:rP.Z,key:"bottom"}];function rN(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)((0,x.useState)(!1),2),i=r[0],o=r[1],a=(0,k._)((0,x.useState)(1),2),l=a[0],s=a[1],c=function(e){switch(e){case"center":n.canvas.viewportCenterObject(t),t.setCoords();break;case"left":t.set("left",0);break;case"centerH":n.canvas.viewportCenterObjectH(t),t.setCoords();break;case"right":t.set("left",n.sketch.width-t.width);break;case"top":t.set("top",0);break;case"centerV":n.canvas.viewportCenterObjectV(t),t.setCoords();break;case"bottom":t.set("top",n.sketch.height-t.height)}n.canvas.requestRenderAll(),n.fireCustomModifiedEvent()};return((0,x.useEffect)(function(){t&&(o(t.lockMovementX),s(t.opacity))},[t]),t&&t.id!==eu)?(0,y.BX)(e8.Fragment,{children:[(0,y.BX)(D,{height:30,gap:8,justify:"space-between",children:[(0,y.tZ)(Y,{tooltipProps:{placement:"top"},onClick:function(){t.set({lockMovementX:!i,lockMovementY:!i,hasControls:!!i}),n.canvas.requestRenderAll(),o(!i),n.fireCustomModifiedEvent()},title:i?"\u89E3\u9501":"\u9501\u5B9A",children:i?(0,y.tZ)(rL.Z,{style:{fontSize:20}}):(0,y.tZ)(rX.Z,{style:{fontSize:20}})}),(0,y.tZ)(Y,{tooltipProps:{placement:"top"},title:"\u900F\u660E\u5EA6",children:(0,y.tZ)(rE,{value:l,onChange:function(e){t.set("opacity",e),s(e),n.canvas.requestRenderAll()},onChangeComplete:function(){n.fireCustomModifiedEvent()}})}),(0,y.tZ)(Y,{tooltipProps:{placement:"top"},title:"\u521B\u5EFA\u526F\u672C",onClick:(0,w._)(function(){return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return[4,nr(n.canvas,t)];case 1:return e.sent(),[4,ni(n.canvas)];case 2:return e.sent(),[2]}})}),children:(0,y.tZ)(rM.Z,{style:{fontSize:20}})}),(0,y.tZ)(Y,{tooltipProps:{placement:"top"},title:"\u5220\u9664",onClick:function(){no(null,n.canvas)},children:(0,y.tZ)(rH.Z,{style:{fontSize:20}})}),"f-image"===t.type?(0,y.tZ)(Y,{tooltipProps:{placement:"top"},title:"\u7FFB\u8F6C",children:(0,y.tZ)(rT,{onChange:function(e){t.set(e,!t[e]),n.canvas.requestRenderAll(),n.fireCustomModifiedEvent()}})}):null]}),(0,y.tZ)(q.Z,{style:{margin:"16px 0"}}),(0,y.tZ)("span",{style:{fontWeight:"bold"},children:"\u753B\u5E03\u5BF9\u9F50"}),(0,y.tZ)(D,{height:30,gap:8,justify:"space-between",style:{marginTop:16},children:rD.map(function(e){return(0,y.tZ)(Y,{tooltipProps:{placement:"top"},title:e.label,onClick:function(){c(e.key)},children:(0,y.tZ)(e.icon,{style:{fontSize:20}})},e.key)})}),(0,y.tZ)(q.Z,{style:{margin:"16px 0"}}),(0,y.tZ)(rU,{})]}):null}function rY(){var e=(0,x.useContext)(_),t=e.object,n=e.editor;return t&&("group"===t.type||"activeSelection"===t.type)?(0,y.tZ)("div",{children:"group"===t.type?(0,y.tZ)($.ZP,{type:"primary",block:!0,onClick:function(){nl(n.canvas,t)},children:"\u53D6\u6D88\u5EFA\u7EC4"}):(0,y.tZ)($.ZP,{type:"primary",block:!0,onClick:function(){na(n.canvas,t)},children:"\u5EFA\u7EC4"})}):null}function rq(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)((0,x.useState)({}),2),i=r[0],o=r[1];return((0,x.useEffect)(function(){if(t){var e=t.shadow;o({color:t.stroke,width:t.strokeWidth,fill:eb(t.fill||"#ffffff"),shadow:{color:(null==e?void 0:e.color)||"#000000",width:(null==e?void 0:e.blur)||0,offset:(null==e?void 0:e.offsetX)||0}})}},[t]),t&&"path"===t.type)?(0,y.tZ)(tP,{showFillConfig:null==t?void 0:t.sub_type,shouldFireEvent:!0,value:i,onChange:function(e){if(e.color&&t.set("stroke",e.color),e.width&&t.set("strokeWidth",e.width),e.fill){var r=ey(e.fill);"string"!=typeof r&&(r=new en.fabric.Gradient(r)),t.set("fill",r)}if(e.shadow){var i=t.shadow,o=i?i.toObject():{},a={blur:e.shadow.width||o.blur,offsetX:e.shadow.offset||o.offsetX,offsetY:e.shadow.offset||o.offsetY,affectStroke:!0,color:e.shadow.color||o.color||"#000000"};t.set("shadow",new en.fabric.Shadow(a))}n.canvas.requestRenderAll()}}):null}var rG=tC.Z.Item;function rK(){var e=(0,k._)(tC.Z.useForm(),1)[0],t=(0,x.useContext)(_),n=t.editor,r=t.object;return(0,x.useEffect)(function(){if(null==r?void 0:r.sub_type){if("path"===r.type)e.setFieldsValue({stroke:r.stroke});else{var t=r.getObjects();e.setFieldsValue({stroke:t[1].stroke,fill:t[0].stroke})}}},[n]),(0,y.BX)(tC.Z,{colon:!1,form:e,onValuesChange:function(e){Object.keys(e).forEach(function(t){if("path"===r.type)r.set("stroke",e[t]);else{var n=r.getObjects();"stroke"===t?n[1].set("stroke",e[t]):"fill"===t&&n[0].set("stroke",e[t])}}),n.canvas.requestRenderAll(),n.fireCustomModifiedEvent()},children:[(0,y.tZ)(rG,{label:"\u63CF\u8FB9",name:"stroke",children:(0,y.tZ)(t_,{})}),(null==r?void 0:r.type)==="group"?(0,y.tZ)(rG,{label:"\u586B\u5145",name:"fill",children:(0,y.tZ)(t_,{})}):null]})}var rQ=C.Z.Sider,r$=eA.Z.Title,r0={position:"relative",backgroundColor:"#fff",borderLeft:"1px solid #e8e8e8",overflow:"auto",height:"100%"};function r1(){var e,t,n=(0,x.useContext)(_),r=n.object,i=n.isReady,o=(null==r?void 0:null===(t=r.get)||void 0===t?void 0:t.call(r,"type"))||"";console.log("objectType",o,r);var a=function(){if(!i)return null;if(!r||r.id===eu)return"\u753B\u5E03";switch(o){case"textbox":case"f-text":return"\u6587\u5B57";case"rect":case"circle":case"triangle":case"polygon":case"ellipse":return"\u5F62\u72B6";case"line":case"f-line":case"f-arrow":case"f-tri-arrow":return"\u7EBF\u6761";case"f-image":return"\u56FE\u7247";case"image":return"\u914D\u7F6E";case"path":if(null==r?void 0:r.sub_type){if((null==r?void 0:r.sub_type)==="rough")return"\u624B\u7ED8\u98CE\u683C";return"\u5F62\u72B6"}return"\u753B\u7B14";case"group":if((null==r?void 0:r.sub_type)==="rough")return"\u624B\u7ED8\u98CE\u683C";return"\u7EC4\u5408";case"activeSelection":return"\u7EC4\u5408";default:return"\u753B\u5E03"}};return(0,y.BX)(rQ,{style:r0,width:280,className:"fabritor-sider",children:[a()?(0,y.tZ)(D,{style:{borderBottom:"1px solid #e8e8e8",paddingLeft:16},children:(0,y.tZ)(r$,{level:5,children:a()})}):null,(0,y.BX)("div",{style:{padding:16},children:[(e=function(){if(!i)return null;if(!r||r.id===eu)return(0,y.tZ)(nH,{});switch(o){case"textbox":case"f-text":return(0,y.tZ)(ri,{});case"rect":case"circle":case"triangle":case"polygon":case"ellipse":return(0,y.tZ)(rF,{});case"f-line":case"f-arrow":case"f-tri-arrow":return(0,y.tZ)(rj,{});case"f-image":return(0,y.tZ)(rS,{});case"path":if((null==r?void 0:r.sub_type)==="rough")return(0,y.tZ)(rK,{});return(0,y.tZ)(rq,{});case"group":if((null==r?void 0:r.sub_type)==="rough")return(0,y.tZ)(rK,{});return(0,y.tZ)(rY,{});case"activeSelection":return(0,y.tZ)(rY,{});default:return null}}())?(0,y.BX)(e8.Fragment,{children:[e,(0,y.tZ)(q.Z,{})]}):null,(0,y.tZ)(rN,{})]})]})}var r2=n(5862),r3=n(2267),r4=n(5766),r6=function(){en.fabric.Image.prototype.needsItsOwnCache=function(){return!1},en.fabric.perfLimitSizeTotal=16777216,Object.keys(el).forEach(function(e){en.fabric.Object.prototype[e]=el[e]});var e={borderColor:"#cccddd",borderDashArray:[7,10],borderScaleFactor:3,padding:10};Object.keys(e).forEach(function(t){en.fabric.ActiveSelection.prototype[t]=e[t],en.fabric.Group.prototype[t]=e[t]}),en.fabric.Group.prototype.subTargetCheck=!0},r8=n(9975),r5=n(6259),r7=function(){function e(t){(0,r2._)(this,e),(0,r4._)(this,"historyUndo",void 0),(0,r4._)(this,"historyRedo",void 0),(0,r4._)(this,"saving",void 0),(0,r4._)(this,"doing",void 0),(0,r4._)(this,"currentState",void 0),(0,r4._)(this,"canvas",void 0),(0,r4._)(this,"editor",void 0),this.historyUndo=[],this.historyRedo=[],this.canvas=t.canvas,this.editor=t,this.saving=!1,this.doing=!1,this.currentState=this._getJSON(),this.init()}return(0,r3._)(e,[{key:"_checkHistoryUndoLength",value:function(){this.historyUndo.length>100&&this.historyUndo.shift()}},{key:"_checkHistoryRedoLength",value:function(){this.historyRedo.length>100&&this.historyRedo.shift()}},{key:"_historySaveAction",value:function(){if(!this.doing&&!this.saving){this.saving=!0;var e=this.currentState;this.historyUndo.push(e),this._checkHistoryUndoLength(),this.currentState=this._getJSON(),this.saving=!1}}},{key:"_getJSON",value:function(){return JSON.stringify(this.editor.canvas2Json())}},{key:"_historyEvents",value:function(){return{"object:added":this._historySaveAction.bind(this),"object:removed":this._historySaveAction.bind(this),"object:modified":this._historySaveAction.bind(this),"object:skewing":this._historySaveAction.bind(this),"fabritor:object:modified":this._historySaveAction.bind(this)}}},{key:"init",value:function(){this.canvas.on(this._historyEvents())}},{key:"dispose",value:function(){this.canvas.off(this._historyEvents())}},{key:"undo",value:function(){var e=this;return(0,w._)(function(){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:if(!(t=e.historyUndo.pop()))return[3,2];return e.doing=!0,e.historyRedo.push(e.currentState),e._checkHistoryRedoLength(),e.currentState=t,[4,e.editor.loadFromJSON(t)];case 1:n.sent(),e.doing=!1,e.canvas.fire("fabritor:history:undo"),n.label=2;case 2:return[2]}})})()}},{key:"redo",value:function(){var e=this;return(0,w._)(function(){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:if(!(t=e.historyRedo.pop()))return[3,2];return e.doing=!0,e.historyUndo.push(e.currentState),e._checkHistoryUndoLength(),e.currentState=t,[4,e.editor.loadFromJSON(t)];case 1:n.sent(),e.doing=!1,e.canvas.fire("fabritor:history:redo"),n.label=2;case 2:return[2]}})})()}},{key:"canUndo",value:function(){return this.historyUndo.length>0}},{key:"canRedo",value:function(){return this.historyRedo.length>0}},{key:"reset",value:function(){this.historyRedo=[],this.historyUndo=[],this.saving=!1,this.doing=!1,this.currentState=this._getJSON()}}]),e}(),r9=function(){function e(t){(0,r2._)(this,e),(0,r4._)(this,"canvas",void 0),(0,r4._)(this,"editor",void 0),(0,r4._)(this,"saving",void 0),(0,r4._)(this,"canSave",void 0),this.canvas=t.canvas,this.editor=t,this.saving=!1,this.canSave=!0,this.init()}return(0,r3._)(e,[{key:"init",value:function(){this.canvas.on(this.initAutoSaveEvents())}},{key:"dispose",value:function(){this.canvas.off(this.initAutoSaveEvents())}},{key:"setCanSave",value:function(e){this.canSave=e}},{key:"autoSaveAction",value:function(){if(!this.saving){this.saving=!0;try{this.canSave&&localStorage.setItem("fabritor_web_json",this._getJSON())}catch(e){console.log(e)}this.saving=!1}}},{key:"_getJSON",value:function(){return JSON.stringify(this.editor.canvas2Json())}},{key:"initAutoSaveEvents",value:function(){return{"object:added":this.autoSaveAction.bind(this),"object:removed":this.autoSaveAction.bind(this),"object:modified":this.autoSaveAction.bind(this),"object:skewing":this.autoSaveAction.bind(this),"fabritor:object:modified":this.autoSaveAction.bind(this)}}},{key:"loadFromLocal",value:function(){var e=this;return(0,w._)(function(){var t,n;return(0,Z.Jh)(this,function(r){switch(r.label){case 0:r.label=1;case 1:if(r.trys.push([1,4,,5]),!(t=localStorage.getItem("fabritor_web_json")))return[3,3];return n=JSON.parse(t),[4,e.editor.loadFromJSON(n)];case 2:r.sent(),r.label=3;case 3:return[3,5];case 4:return console.log(r.sent()),[3,5];case 5:return[2]}})})()}}]),e}(),ie=function(e){var t=e.items,n=e.canvas,r=(0,J._)(e,["items","canvas"]),i=new en.fabric.Group(t,(0,T._)({id:ed()},r));return n.add(i),i},it=en.fabric.util.object.clone,ir="fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign minWidth splitByGrapheme".split(" "),ii=function(){en.fabric.FText=en.fabric.util.createClass(en.fabric.Textbox,{type:"f-text",padding:0,paintFirst:"stroke",initDimensions:function(){if(!this.__skipDimension){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces();var e=this.calcTextHeight();this.path?this.height=this.path.height>e?this.path.height:e:this.height=e,this.saveState({propertySet:"_dimensionAffectingProps"})}},toObject:function(e){var t=ir.concat(e),n=this.callSuper("toObject",t);return n.styles=en.fabric.util.stylesToArray(this.styles,this.text),n.path&&(n.path=this.path.toObject()),n}}),en.fabric.FText.fromObject=function(e,t){var n=it(e),r=e.path;return delete n.path,en.fabric.Object._fromObject("FText",n,function(n){n.styles=en.fabric.util.stylesFromArray(e.styles,e.text),r?en.fabric.Object._fromObject("Path",r,function(e){n.set("path",e),t(n)},"path"):t(n)},"text")}},io=function(){var e;e=en.fabric.util.createClass(en.fabric.Group,{type:"f-image",initialize(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.image,r=e.imageBorder,i=void 0===r?{}:r,o=(0,J._)(e,["image","imageBorder"]);n.set({originX:"center",originY:"center"}),this.img=n,this.borderRect=this._createBorderRect(i),this.img.clipPath=this._createClipPath(),this.callSuper("initialize",[this.img,this.borderRect],(0,T._)({borderColor:"#FF2222",borderDashArray:null,borderScaleFactor:2,padding:0,subTargetCheck:!1,imageBorder:i},o),t)},_createBorderRect(e){var t=e.stroke,n=e.strokeWidth,r=e.borderRadius,i={width:this.img.getScaledWidth(),height:this.img.getScaledHeight(),rx:r||0,ry:r||0,originX:"center",originY:"center",fill:"#00000000",paintFirst:"fill"};return t&&(i.stroke=t),n&&(i.strokeWidth=n),new en.fabric.Rect(i)},_createClipPath(){var e=this.img.width,t=this.img.height;return console.log(e,t),new en.fabric.Rect({originX:"center",originY:"center",width:e,height:t,rx:this.borderRect.rx||0,ry:this.borderRect.ry||0})},setSrc(e,t){var n=this;this.img.setSrc(e,function(){var e=n.img.getScaledWidth(),r=n.img.getScaledHeight();n.img.setCoords(),n.borderRect.set({width:e,height:r,dirty:!0}),n.img.set({clipPath:n._createClipPath(),dirty:!0}),n.addWithUpdate(),t&&t()})},getSrc(){return this.img.getSrc()},setBorder(e){this.borderRect.set({stroke:e.stroke||null,strokeWidth:e.strokeWidth||1,rx:e.borderRadius||0,ry:e.borderRadius||0,strokeDashArray:e.strokeDashArray||null}),this.img.setCoords(),this.img.set({clipPath:this._createClipPath(),dirty:!0}),this.imageBorder=(0,T._)({},e),this.addWithUpdate()},getBorder(){return this.imageBorder},applyFilter(e){try{this.img.filters=e?[e]:[],this.img.applyFilters()}catch(t){console.log(t)}},applyFilterValue(e,t){var n=this.getFilter();n&&(n[e]=t,this.img.filters=[n],this.img.applyFilters())},getFilter(){return this.img.filters[0]}}),en.fabric.FImage=e,en.fabric.FImage.fromObject=function(e,t){var n=e.objects,r=(0,J._)(e,["objects"]),i=(0,T._)({},n[0]);en.fabric.Image.fromObject(i,function(e){t(new en.fabric.FImage((0,T._)({image:e},r),!0))})}},ia=en.fabric.util.object.extend,il=function(){en.fabric.FLine=en.fabric.util.createClass(en.fabric.Line,{type:"f-line",padding:6,borderColor:"#00000000",setStrokeWidth(e){this.set("strokeWidth",e)},setStrokeDashArray(e){this.set("strokeDashArray",e)},setStrokeLineCap(e){this.set("strokeLineCap",e?"round":"butt")},toObject(e){return ia(this.callSuper("toObject",e),{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2})}}),en.fabric.FLine.fromObject=function(e,t){var n=(0,T._)({},e);n.points=[e.x1,e.y1,e.x2,e.y2],en.fabric.Object._fromObject("FLine",n,function(e){delete e.points,t&&t(e)},"points")}},is=en.fabric.util.object.extend,ic=function(){en.fabric.FArrow=en.fabric.util.createClass(en.fabric.Line,{type:"f-arrow",borderColor:"#00000000",_render:function(e){this.callSuper("_render",e),e.save(),this.oldArrowInfo||(this.oldArrowInfo={left:-28,top:-15,bottom:15,strokeWidth:this.strokeWidth});var t=this.x2-this.x1,n=Math.atan2(this.y2-this.y1,t);e.translate((this.x2-this.x1)/2,(this.y2-this.y1)/2),e.rotate(n);var r=this.strokeWidth-this.oldArrowInfo.strokeWidth;e.lineJoin=this.strokeLineJoin,e.lineCap=this.strokeLineCap,e.strokeStyle=this.stroke,e.beginPath(),e.moveTo(0,0),e.lineTo(this.oldArrowInfo.left-r,this.oldArrowInfo.bottom+r),e.lineTo(this.oldArrowInfo.left-r,this.oldArrowInfo.top-r),e.closePath(),e.fillStyle=this.stroke,e.fill(),e.stroke(),e.restore()},setStrokeWidth(e){this.set("strokeWidth",e)},setStrokeDashArray(e){this.set("strokeDashArray",e)},setStrokeLineCap(e){this.set("strokeLineCap",e?"round":"butt"),this.set("strokeLineJoin",e?"round":"miter")},toObject(e){return is(this.callSuper("toObject",e),{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2})}}),en.fabric.FArrow.fromObject=function(e,t){t&&t(new en.fabric.FArrow([e.x1,e.y1,e.x2,e.y2],e))}},iu=function(){en.fabric.FTriArrow=en.fabric.util.createClass(en.fabric.Line,{type:"f-tri-arrow",borderColor:"#00000000",_render:function(e){this.callSuper("_render",e),e.save(),this.oldArrowInfo||(this.oldArrowInfo={left:-24,top:-16,bottom:16,strokeWidth:this.strokeWidth});var t=this.x2-this.x1,n=Math.atan2(this.y2-this.y1,t);e.translate((this.x2-this.x1)/2,(this.y2-this.y1)/2),e.rotate(n);var r=this.strokeWidth-this.oldArrowInfo.strokeWidth;e.lineJoin=this.strokeLineJoin,e.lineCap=this.strokeLineCap,e.strokeStyle=this.stroke,e.beginPath(),e.moveTo(this.oldArrowInfo.left-r,this.oldArrowInfo.bottom+r),e.lineTo(0,0),e.lineTo(this.oldArrowInfo.left-r,this.oldArrowInfo.top-r),e.fillStyle="#00000000",e.fill(),e.stroke(),e.restore()},setStrokeWidth(e){this.set("strokeWidth",e)},setStrokeDashArray(e){this.set("strokeDashArray",e)},setStrokeLineCap(e){this.set("strokeLineCap",e?"round":"butt"),this.set("strokeLineJoin",e?"round":"miter")},toObject(e){return is(this.callSuper("toObject",e),{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2})}}),en.fabric.FTriArrow.fromObject=function(e,t){t&&t(new en.fabric.FTriArrow([e.x1,e.y1,e.x2,e.y2],e))}},ih=function(){function e(t){(0,r2._)(this,e),(0,r4._)(this,"canvas",void 0),(0,r4._)(this,"_options",void 0),(0,r4._)(this,"_template",void 0),(0,r4._)(this,"sketch",void 0),(0,r4._)(this,"_resizeObserver",void 0),(0,r4._)(this,"_pan",void 0),(0,r4._)(this,"fhistory",void 0),(0,r4._)(this,"autoSave",void 0);var n=t.template,r=(0,J._)(t,["template"]);this._options=r,this._template=n,this._pan={enable:!1,isDragging:!1,lastPosX:0,lastPosY:0}}return(0,r3._)(e,[{key:"init",value:function(){var e=this;return(0,w._)(function(){return(0,Z.Jh)(this,function(t){switch(t.label){case 0:return e._initObject(),e._initCanvas(),e._initEvents(),e._initSketch(),e._initGuidelines(),e.autoSave=new r9(e),[4,e.autoSave.loadFromLocal()];case 1:var n,r,i;return t.sent(),e.fhistory=new r7(e),n=e.canvas,r=e.fhistory,(0,r5.Z)("ctrl+c,command+c",(i=(0,w._)(function(e){return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return[4,nr(n,null)];case 1:return e.sent(),[2]}})}),function(e){return i.apply(this,arguments)})),(0,r5.Z)("ctrl+v,command+v",function(e){ni(n)}),(0,r5.Z)("delete,del,backspace",function(e){e.preventDefault(),no(null,n)}),(0,r5.Z)("ctrl+z,command+z",function(e){e.preventDefault(),r.undo()}),(0,r5.Z)("ctrl+shift+z,command+shift+z",function(e){e.preventDefault(),r.redo()}),(0,r5.Z)("up, right, down, left",function(e,t){var r=n.getActiveObject();if(r&&("f-text"!==r.type||!r.isEditing)){switch(e.preventDefault(),t.key){case"up":r.set("top",r.top-1);break;case"right":r.set("left",r.left+1);break;case"down":r.set("top",r.top+1);break;case"left":r.set("left",r.left-1)}r.group&&r.addWithUpdate(),n.requestRenderAll()}}),e.autoSave.init(),[2]}})})()}},{key:"_initObject",value:function(){r6(),ii(),io(),il(),ic(),iu(),t5(),t7(),t9(),tT(),tU(),tN()}},{key:"_initCanvas",value:function(){var e=this._options,t=e.canvasEl,n=e.workspaceEl;this.canvas=new en.fabric.Canvas(t,{selection:!0,containerClass:"fabritor-canvas",enableRetinaScaling:!0,fireRightClick:!0,controlsAboveOverlay:!0,width:n.offsetWidth,height:n.offsetHeight,backgroundColor:"#ddd",preserveObjectStacking:!0,imageSmoothingEnabled:!1})}},{key:"_initGuidelines",value:function(){var e,t,n,r,i,o,a,l,s,c,u,h,f;e=this.canvas,t=function(e){r(e.x+.5,e.y1>e.y2?e.y2:e.y1,e.x+.5,e.y2>e.y1?e.y2:e.y1)},n=function(e){r(e.x1>e.x2?e.x2:e.x1,e.y+.5,e.x2>e.x1?e.x2:e.x1,e.y+.5)},r=function(e,t,n,r){a.save(),a.lineWidth=s,a.strokeStyle=c,a.beginPath(),a.moveTo(e*u+o[4],t*u+o[5]),a.lineTo(n*u+o[4],r*u+o[5]),a.stroke(),a.restore()},i=function(e,t){e=Math.round(e),t=Math.round(t);for(var n=e-l,r=e+l;n<=r;n++)if(n===t)return!0;return!1},a=e.getSelectionContext(),l=4,s=1,c="rgb(0,255,0)",u=1,h=[],f=[],e.on("mouse:down",function(){o=e.viewportTransform,u=e.getZoom()}),e.on("object:moving",function(t){var n=t.target,r=e.getObjects(),a=n.getCenterPoint(),l=a.x,s=a.y,c=n.getBoundingRect(),u=c.height/o[3],d=c.width/o[0],p=!1,v=!1;if(e._currentTransform){for(var g=r.length;g--;)if(r[g]!==n){var b=r[g].getCenterPoint(),y=b.x,m=b.y,w=r[g].getBoundingRect(),k=w.height/o[3],Z=w.width/o[0];i(y,l)&&(v=!0,h.push({x:y,y1:mm?s+u/2+5:s-u/2-5}),n.setPositionByOrigin(new fabric.Point(y,s),"center","center")),i(y-Z/2,l-d/2)&&(v=!0,h.push({x:y-Z/2,y1:mm?s+u/2+5:s-u/2-5}),n.setPositionByOrigin(new fabric.Point(y-Z/2+d/2,s),"center","center")),i(y+Z/2,l+d/2)&&(v=!0,h.push({x:y+Z/2,y1:mm?s+u/2+5:s-u/2-5}),n.setPositionByOrigin(new fabric.Point(y+Z/2-d/2,s),"center","center")),i(m,s)&&(p=!0,f.push({y:m,x1:yy?l+d/2+5:l-d/2-5}),n.setPositionByOrigin(new fabric.Point(l,m),"center","center")),i(m-k/2,s-u/2)&&(p=!0,f.push({y:m-k/2,x1:yy?l+d/2+5:l-d/2-5}),n.setPositionByOrigin(new fabric.Point(l,m-k/2+u/2),"center","center")),i(m+k/2,s+u/2)&&(p=!0,f.push({y:m+k/2,x1:yy?l+d/2+5:l-d/2-5}),n.setPositionByOrigin(new fabric.Point(l,m+k/2-u/2),"center","center"))}p||(f.length=0),v||(h.length=0)}}),e.on("before:render",function(){e.contextTop&&e.clearContext(e.contextTop)}),e.on("after:render",function(){for(var e=h.length;e--;)t(h[e]);for(var e=f.length;e--;)n(f[e]);h.length=f.length=0}),e.on("mouse:up",function(){h.length=f.length=0,e.renderAll()}),function(e){for(var t,n,r,i=function(){a(c+.5,0,c+.5,s)},o=function(){a(0,u+.5,l,u+.5)},a=function(e,t,n,i){v.save(),v.strokeStyle=d,v.lineWidth=p,v.beginPath(),v.moveTo(e*r[0],t*r[3]),v.lineTo(n*r[0],i*r[3]),v.stroke(),v.restore()},l=e.getWidth(),s=e.getHeight(),c=l/2,u=s/2,h={},f={},d="rgba(255,0,241,0.5)",p=1,v=e.getSelectionContext(),g=c-4,b=c+4;g<=b;g++)h[Math.round(g)]=!0;for(var g=u-4,b=u+4;g<=b;g++)f[Math.round(g)]=!0;e.on("mouse:down",function(){r=e.viewportTransform}),e.on("object:moving",function(r){var i=r.target,o=i.getCenterPoint();e._currentTransform&&(t=Math.round(o.x) in h,((n=Math.round(o.y) in f)||t)&&i.setPositionByOrigin(new fabric.Point(t?c:o.x,n?u:o.y),"center","center"))}),e.on("before:render",function(){e.contextTop&&e.clearContext(e.contextTop)}),e.on("after:render",function(){t&&i(),n&&o()}),e.on("mouse:up",function(){t=n=null,e.renderAll()})}(this.canvas)}},{key:"_initSketch",value:function(){var e=this._template||{},t=e.width,n=e.height,r=new en.fabric.Rect({fill:"#ffffff",left:0,top:0,width:void 0===t?1242:t,height:void 0===n?1660:n,selectable:!1,hasControls:!1,hoverCursor:"default",id:eu,fabritor_desc:"\u6211\u7684\u753B\u677F by fabritor"});this.canvas.add(r),this.canvas.requestRenderAll(),this.sketch=r,this._initResizeObserver(),this._adjustSketch2Canvas()}},{key:"setSketchSize",value:function(e){this.sketch.set(e),this._adjustSketch2Canvas()}},{key:"_initResizeObserver",value:function(){var e=this,t=this._options.workspaceEl;this._resizeObserver=new ResizeObserver((0,r8.Z)(function(){e.canvas.setWidth(t.offsetWidth),e.canvas.setHeight(t.offsetHeight),e._adjustSketch2Canvas()},50)),this._resizeObserver.observe(t)}},{key:"_adjustSketch2Canvas",value:function(){var e,t,n=this,r=(e={width:this.canvas.width,height:this.canvas.height},(t={width:this.sketch.width,height:this.sketch.height}).width=100),n.setControlVisible("mb",r>=100)),n.setControlVisible("ml",i>=40),n.setControlVisible("mr",i>=40),e.canvas.requestRenderAll()),("f-line"===n.type||"f-arrow"===n.type||"f-tri-arrow"===n.type)&&nh(t)}})}},{key:"_editTextInGroup",value:function(e,t){var n=this,r=e.getObjects();t.on("editing:exited",function(){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:null;this.canvas.fire("fabritor:object:modified",e)}},{key:"_scrollSketch",value:function(e){var t=e.e.deltaY,n=this.canvas.getZoom();(n*=Math.pow(.999,t))>20&&(n=20),n<.01&&(n=.01);var r=this.canvas.getCenter();this.canvas.zoomToPoint({x:r.left,y:r.top},n),e.e.preventDefault(),e.e.stopPropagation()}},{key:"destroy",value:function(){this.canvas&&(this.canvas.dispose(),this.canvas=null),this.fhistory&&this.fhistory.dispose(),this.autoSave&&this.autoSave.dispose();var e=this._options.workspaceEl;this._resizeObserver&&(this._resizeObserver.unobserve(e),this._resizeObserver=null)}},{key:"export2Img",value:function(e){var t=this.canvas.viewportTransform;this.canvas.setViewportTransform([1,0,0,1,0,0]);var n=this.sketch,r=n.left,i=n.top,o=n.width,a=n.height,l=this.canvas.toDataURL((0,T._)({left:r,top:i,width:o,height:a,format:"png"},e));return this.canvas.setViewportTransform(t),l}},{key:"export2Svg",value:function(){var e=this.sketch,t=e.left,n=e.top,r=e.width,i=e.height,o=this.canvas.toSVG({width:r,height:i,viewBox:{x:t,y:n,width:r,height:i}});return"data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(o))}},{key:"canvas2Json",value:function(){var e=this.canvas.toJSON(eh);return e[eo]=3,e}},{key:"loadFromJSON",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this;return(0,w._)(function(){var r,i,o,a,l,s,c,u,h,f;return(0,Z.Jh)(this,function(d){switch(d.label){case 0:if(!e)return[2,!1];if("string"==typeof e)try{e=JSON.parse(e)}catch(p){return console.log(p),t&&Q.ZP.error("\u52A0\u8F7D\u672C\u5730\u6A21\u677F\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),[2,!1]}if(3!==e[eo])return console.warn("\u6B64\u6A21\u677F\u5DF2\u7ECF\u65E0\u6CD5\u4E0E\u5F53\u524D\u7248\u672C\u517C\u5BB9\uFF0C\u8BF7\u66F4\u6362\u6A21\u677F"),[2,!1];return[3,8];case 1:d.trys.push([1,6,7,8]),l=r[Symbol.iterator](),d.label=2;case 2:if(i=(s=l.next()).done)return[3,5];if("f-text"!==(c=s.value).type)return[3,4];return[4,ef(c.fontFamily)];case 3:d.sent(),d.label=4;case 4:return i=!0,[3,2];case 5:return[3,8];case 6:return u=d.sent(),o=!0,a=u,[3,8];case 7:try{i||null==l.return||l.return()}finally{if(o)throw a}return[7];case 8:return h=n.canvas.getActiveObject(),n.autoSave.setCanSave(!1),[2,new Promise(function(t){n.canvas.loadFromJSON(e,function(){n.canvas.requestRenderAll(),n.autoSave.setCanSave(!0),n.canvas.fire("fabritor:load:json",{lastActiveObject:f}),t(!0)},function(e,t){t.id===eu&&(n.sketch=t,n.setSketchSize({width:t.width,height:t.height})),t.id===(null==h?void 0:h.id)&&(f=t)})})]}})})()}},{key:"clearCanvas",value:function(){var e=this;return(0,w._)(function(){var t,n,r,i,o;return(0,Z.Jh)(this,function(a){switch(a.label){case 0:return n=(t=e.sketch).width,r=t.height,i=t.fabritor_desc,o='{"fabritor_schema_version":3,"version":"5.3.0","objects":[{"type":"rect","version":"5.3.0","originX":"left","originY":"top","left":0,"top":0,"width":'.concat(n,',"height":').concat(r,',"fill":"#ffffff","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"id":"fabritor-sketch","fabritor_desc":"').concat(i,'","selectable":false,"hasControls":false}],"clipPath":{"type":"rect","version":"5.3.0","originX":"left","originY":"top","left":0,"top":0,"width":').concat(n,',"height":').concat(r,',"fill":"#ffffff","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"selectable":true,"hasControls":true},"background":"#ddd"}'),[4,e.loadFromJSON(o)];case 1:return a.sent(),e.fhistory.reset(),[2]}})})()}}]),e}(),id=function(){var e=(0,k._)((0,x.useState)({left:0,top:0}),2),t=e[0],n=e[1],r=(0,k._)((0,x.useState)(""),2),i=r[0],o=r[1],a=(0,k._)((0,x.useState)(!1),2),l=a[0],s=a[1],c=(0,x.useContext)(_).editor,u=function(e){var t=e.target,r=e.e;n({left:r.pageX+16,top:r.pageY}),o("".concat(Math.round(t.angle),"\xb0")),s(!0)},h=function(){s(!1)};return(0,x.useEffect)(function(){c&&(c.canvas.on("object:rotating",u),c.canvas.on("mouse:up",h))},[c]),(0,y.tZ)("div",{style:(0,T._)({fontSize:12,position:"fixed",zIndex:9999,width:"max-content",display:l?"block":"none"},t),children:(0,y.tZ)(to.Z,{color:"rgba(0, 0, 0, 0.85)",children:i})})},ip=n(6724),iv=C.Z.Content,ig={background:"#ddd",width:"100%",height:"100%",overflow:"hidden",flex:1},ib={display:"flex",flexDirection:"column",height:"100%"};function iy(){var e,t=(0,x.useRef)(null),n=(0,x.useRef)(null),r=(0,x.useRef)(null),i=(0,k._)((0,x.useState)(null),2),o=i[0],a=i[1],l=(0,k._)((0,x.useState)(),2),s=l[0],c=l[1],u=(0,k._)((0,x.useState)(null),2),h=u[0],f=u[1],d=(0,k._)((0,x.useState)(!1),2),p=d[0],v=d[1],g=(0,x.useRef)(null),b=function(e){var t,n,r=e.target;if(!o.getIfPanEnable()){if(!r){null===(t=g.current)||void 0===t||t.hide();return}3===e.button?(r.id!==eu&&o.canvas.setActiveObject(r),setTimeout(function(){var e;null===(e=g.current)||void 0===e||e.show()},50)):null===(n=g.current)||void 0===n||n.hide()}},m=function(e){var t=e.selected,n=e.sketch;t&&t.length?f(o.canvas.getActiveObject()):f(n)},A=function(){f(o.canvas.getActiveObject())},j=function(e){var t=e.lastActiveObject;t&&(o.canvas.setActiveObject(t),f(t))},O=function(){o.canvas.on("selection:created",m),o.canvas.on("selection:updated",m),o.canvas.on("selection:cleared",m),o.canvas.on("mouse:down",b),o.canvas.on("fabritor:group",A),o.canvas.on("fabritor:ungroup",A),o.canvas.on("fabritor:load:json",j)},F=(e=(0,w._)(function(){var e;return(0,Z.Jh)(this,function(r){switch(r.label){case 0:return[4,(e=new ih({canvasEl:t.current,workspaceEl:n.current,sketchEventHandler:{groupHandler:function(){f(e.canvas.getActiveObject())}}})).init()];case 1:return r.sent(),a(e),v(!0),f(e.sketch),[2]}})}),function(){return e.apply(this,arguments)}),z=function(){c(ip.Z.svg(r.current))};return(0,x.useEffect)(function(){o&&(O(),z())},[o]),(0,x.useEffect)(function(){return F(),function(){o&&o.destroy()}},[]),(0,y.tZ)(_.Provider,{value:{object:h,setActiveObject:f,isReady:p,setReady:v,editor:o,roughSvg:s},children:(0,y.BX)(C.Z,{style:{height:"100%"},className:"fabritor-layout",children:[(0,y.tZ)(S.Z,{spinning:!p,fullscreen:!0}),(0,y.tZ)(id,{}),(0,y.tZ)(ez,{}),(0,y.BX)(C.Z,{children:[(0,y.tZ)(nR,{}),(0,y.tZ)(iv,{style:ib,children:(0,y.tZ)(nd,{ref:g,object:h,children:(0,y.tZ)("div",{style:ig,ref:n,className:"fabritor-workspace",children:(0,y.tZ)("canvas",{ref:t})})})}),(0,y.tZ)(r1,{})]}),(0,y.tZ)("svg",{id:"fabritor-rough-svg",ref:r})]})})}var im=(0,m.Cv)(function(){return{title:"fabritor, A creative editor based on fabricjs."}});function iw(){return(0,y.tZ)(iy,{})}},4960:function(){},6759:function(){},6272:function(){}}]); \ No newline at end of file +(self.webpackChunkfabritor_web=self.webpackChunkfabritor_web||[]).push([[767],{1221:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return iw},pageConfig:function(){return im}});var r,i,o,a,l,s,c,u,h,f,d,p,v,g,b,y=n(7077),m=n(5629),w=n(1010),k=n(8188),Z=n(7582),x=n(7294),C=n(290),S=n(6220),A=n(4909),_=(0,x.createContext)(null),j="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),O="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),F=encodeURIComponent("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"),z="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),B="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),P="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),R="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent('')),L='';encodeURIComponent('');var X=n(9790),M=n(5692),H=n(665),E=n(1181),I=n(9810),T=n(2253),W=n(4932),J=n(9210),V=n(2641);function U(e){var t=e.children,n=e.height,r=void 0===n?46:n,i=e.style,o=(0,J._)(e,["children","height","style"]);return(0,y.tZ)(V.Z,(0,W._)((0,T._)({justify:"center",align:"center"},o),{style:(0,T._)({height:r},i),children:t}))}var N=function(e){return(0,y.tZ)(U,(0,T._)({justify:"normal"},e))},D=n(384);function Y(e){var t=e.onClick,n=e.title,r=e.disabled,i=e.tooltipProps,o=e.children;return(0,y.tZ)(D.Z,(0,W._)((0,T._)({placement:"bottom",title:(0,y.tZ)("span",{style:{fontSize:12},children:n})},i),{children:(0,y.tZ)("span",{className:"fabritor-toolbar-item",style:{color:r?"#cccccc":"rgba(0, 0, 0, 0.88)"},onClick:function(){r||null==t||t()},children:o})}))}var q=n(8697);function G(){return(0,y.tZ)(q.Z,{type:"vertical",style:{height:32}})}function K(){var e=(0,x.useContext)(_),t=e.setActiveObject,n=e.editor,r=(0,k._)((0,x.useState)(!1),2),i=r[0],o=r[1],a=(0,k._)((0,x.useState)(!1),2),l=a[0],s=a[1],c=(0,k._)((0,x.useState)(!1),2),u=c[0],h=c[1];return(0,x.useEffect)(function(){n&&(s(n.fhistory.canUndo()),h(n.fhistory.canRedo()))}),(0,y.BX)(N,{gap:4,style:{borderRight:"1px solid #e8e8e8",paddingRight:12},children:[(0,y.tZ)(Y,{disabled:!l,title:"\u64A4\u9500",onClick:function(){n.fhistory.undo()},children:(0,y.tZ)(M.Z,{style:{fontSize:20}})}),(0,y.tZ)(Y,{disabled:!u,title:"\u91CD\u505A",onClick:function(){n.fhistory.redo()},children:(0,y.tZ)(H.Z,{style:{fontSize:20}})}),(0,y.tZ)(G,{}),(0,y.tZ)(Y,{onClick:function(){o(n.switchEnablePan())},title:i?"\u9009\u62E9\u5143\u7D20":"\u62D6\u62FD\u753B\u5E03",children:i?(0,y.tZ)(E.Z,{style:{fontSize:22,color:i?"#000":"#ccc"}}):(0,y.tZ)("img",{src:"data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(L)),style:{width:22,height:22}})}),(0,y.tZ)(Y,{onClick:function(){A.Z.confirm({title:"\u786E\u8BA4\u6E05\u7A7A\u753B\u5E03\uFF0C\u540C\u65F6\u6E05\u7A7A\u5386\u53F2\u64CD\u4F5C\u8BB0\u5F55\uFF1F",icon:(0,y.tZ)(X.Z,{}),onOk(){return(0,w._)(function(){return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return[4,n.clearCanvas()];case 1:return e.sent(),t(n.sketch),n.fireCustomModifiedEvent(),[2]}})})()},okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88"})},title:"\u6E05\u7A7A\u753B\u5E03",children:(0,y.tZ)(I.Z,{style:{fontSize:20}})})]})}var Q=n(7008),$=n(6372),ee=n(495),et=n(53),en=n(1861),er=n(1197),ei=n(6880),eo="fabritor_schema_version",ea="".concat("fabritor","_log\uFF1A"),el={borderColor:"#FF2222",borderScaleFactor:2,cornerStrokeColor:"#2222",cornerColor:"#FF2222",cornerSize:12,cornerStyle:"circle",transparentCorners:!1,padding:0,centeredScaling:!1,strokeUniform:!0,paintFirst:"stroke"},es={fill:"#000000",fontWeight:"normal",fontSize:50,lineHeight:1.3,textAlign:"center",fontFamily:"AlibabaPuHuiTi",width:500,splitByGrapheme:!0},ec=[{label:(0,y.tZ)("span",{style:{fontFamily:"SmileySans",fontSize:16},children:"\u5F97\u610F\u9ED1"}),value:"SmileySans"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u971E\u9E5C\u65B0\u6670\u9ED1",fontSize:16},children:"\u971E\u9E5C\u65B0\u6670\u9ED1"}),value:"\u971E\u9E5C\u65B0\u6670\u9ED1"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u971E\u9E5C\u6587\u6977",fontSize:16},children:"\u971E\u9E5C\u6587\u6977"}),value:"\u971E\u9E5C\u6587\u6977"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u5C0F\u8D56\u5B57\u4F53",fontSize:16},children:"\u5C0F\u8D56\u5B57\u4F53"}),value:"\u5C0F\u8D56\u5B57\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u60A0\u54C9\u5B57\u4F53",fontSize:16},children:"\u60A0\u54C9\u5B57\u4F53"}),value:"\u60A0\u54C9\u5B57\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"AlibabaPuHuiTi",fontSize:16},children:"\u963F\u91CC\u5DF4\u5DF4\u666E\u60E0\u4F53"}),value:"AlibabaPuHuiTi"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u971E\u9E5C\u5C1A\u667A\u9ED1",fontSize:16},children:"\u971E\u9E5C\u5C1A\u667A\u9ED1"}),value:"\u971E\u9E5C\u5C1A\u667A\u9ED1"},{label:(0,y.tZ)("span",{style:{fontFamily:"SourceHanSans",fontSize:16},children:"\u601D\u6E90\u9ED1\u4F53"}),value:"SourceHanSans"},{label:(0,y.tZ)("span",{style:{fontFamily:"SourceHanSerif",fontSize:16},children:"\u601D\u6E90\u5B8B\u4F53"}),value:"SourceHanSerif"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u65B9\u6B63\u6977\u4F53",fontSize:16},children:"\u65B9\u6B63\u6977\u4F53"}),value:"\u65B9\u6B63\u6977\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u5305\u56FE\u5C0F\u767D\u4F53",fontSize:16},children:"\u5305\u56FE\u5C0F\u767D\u4F53"}),value:"\u5305\u56FE\u5C0F\u767D\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u624B\u5199\u6742\u5B57\u4F53",fontSize:16},children:"\u624B\u5199\u6742\u5B57\u4F53"}),value:"\u624B\u5199\u6742\u5B57\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u80E1\u6653\u6CE2\u7537\u795E\u4F53",fontSize:16},children:"\u80E1\u6653\u6CE2\u7537\u795E\u4F53"}),value:"\u80E1\u6653\u6CE2\u7537\u795E\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u80E1\u6653\u6CE2\u9A9A\u5305\u4F53",fontSize:16},children:"\u80E1\u6653\u6CE2\u9A9A\u5305\u4F53"}),value:"\u80E1\u6653\u6CE2\u9A9A\u5305\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u7AD9\u9177\u5FEB\u4E50\u4F53",fontSize:16},children:"\u7AD9\u9177\u5FEB\u4E50\u4F53"}),value:"\u7AD9\u9177\u5FEB\u4E50\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u7AD9\u9177\u6587\u827A\u4F53",fontSize:16},children:"\u7AD9\u9177\u6587\u827A\u4F53"}),value:"\u7AD9\u9177\u6587\u827A\u4F53"},{label:(0,y.tZ)("span",{style:{fontFamily:"\u7AD9\u9177\u5C0F\u8587LOGO\u4F53",fontSize:16},children:"\u7AD9\u9177\u5C0F\u8587LOGO\u4F53"}),value:"\u7AD9\u9177\u5C0F\u8587LOGO\u4F53"}],eu="fabritor-sketch",eh=["id","fabritor_desc","selectable","hasControls","sub_type","imageSource","imageBorder","oldArrowInfo"],ef=(r=(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return e&&ec.find(function(t){return t.value===e})?[2,new er(e).load(null,1e5).catch(function(e){console.error(ea,e)})]:[2,Promise.resolve()]})}),function(e){return r.apply(this,arguments)}),ed=function(){return(0,ei.Z)()},ep=function(e,t,n){var r=document.createElement("a");r.href=e,r.download="".concat(n||ed(),".").concat(t),document.body.appendChild(r),r.click(),document.body.removeChild(r)},ev={45:JSON.stringify({x1:0,y1:1,x2:1,y2:0}),90:JSON.stringify({x1:0,y1:0,x2:1,y2:0}),135:JSON.stringify({x1:0,y1:0,x2:1,y2:1}),180:JSON.stringify({x1:0,y1:0,x2:0,y2:1}),225:JSON.stringify({x1:1,y1:0,x2:0,y2:1}),270:JSON.stringify({x1:1,y1:0,x2:0,y2:0}),315:JSON.stringify({x1:1,y1:1,x2:0,y2:0}),0:JSON.stringify({x1:0,y1:1,x2:0,y2:0})},eg=function(e){var t=Object.keys(ev),n=!0,r=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var l=o.value,s=(0,T._)({},e);if(s={x1:e.x1>1?1:0,y1:e.y1>1?1:0,x2:e.x2>1?1:0,y2:e.y2>1?1:0},JSON.stringify(s)===ev[l])return Number(l)}}catch(c){r=!0,i=c}finally{try{n||null==a.return||a.return()}finally{if(r)throw i}}return 90},eb=function(e){return!e||"string"==typeof e||e instanceof en.fabric.Pattern?{type:"solid",color:e||"#ffffff"}:{type:e.type,gradient:{colorStops:e.colorStops,angle:eg(e.coords)}}},ey=function(e){var t;switch(null==e?void 0:e.type){case"solid":t=e.color;break;case"linear":t={type:"linear",gradientUnits:"percentage",coords:JSON.parse(ev[e.gradient.angle%360]||ev[90]),colorStops:e.gradient.colorStops};break;case"radial":t={type:"radial",gradientUnits:"percentage",coords:{x1:.5,y1:.5,x2:.5,y2:.5,r1:0,r2:1},colorStops:e.gradient.colorStops}}return t},em=(i=(0,w._)(function(e,t){var n;return(0,Z.Jh)(this,function(r){return(n=0===t.indexOf("text")?"text":0===t.indexOf("image/")?"image":"")?[2,new Promise(function(t){var r=new FileReader;r.onload=function(e){var r;t({type:n,result:null===(r=e.target)||void 0===r?void 0:r.result})},r.onerror=function(e){console.log(e),t(null)},"text"===n?r.readAsText(e):"image"===n&&r.readAsDataURL(e)})]:[2,Promise.resolve(null)]})}),function(e,t){return i.apply(this,arguments)}),ew=(o=(0,w._)(function(){var e,t,n,r,i,o,a,l,s,c,u,h,f,d,p,v;return(0,Z.Jh)(this,function(g){switch(g.label){case 0:return g.trys.push([0,17,,18]),[4,navigator.clipboard.read()];case 1:e=g.sent(),t=!0,n=!1,r=void 0,g.label=2;case 2:g.trys.push([2,14,15,16]),i=e[Symbol.iterator](),g.label=3;case 3:if(t=(o=i.next()).done)return[3,13];a=o.value,l=!0,s=!1,c=void 0,g.label=4;case 4:g.trys.push([4,10,11,12]),u=a.types[Symbol.iterator](),g.label=5;case 5:if(l=(h=u.next()).done)return[3,9];return f=h.value,[4,a.getType(f)];case 6:return[4,em.apply(void 0,[g.sent(),f])];case 7:if(d=g.sent())return[2,d];g.label=8;case 8:return l=!0,[3,5];case 9:return[3,12];case 10:return p=g.sent(),s=!0,c=p,[3,12];case 11:try{l||null==u.return||u.return()}finally{if(s)throw c}return[7];case 12:return t=!0,[3,3];case 13:return[3,16];case 14:return p=g.sent(),n=!0,r=p,[3,16];case 15:try{t||null==i.return||i.return()}finally{if(n)throw r}return[7];case 16:return[2,null];case 17:return console.error((v=g.sent()).name,v.message),[2,null];case 18:return[2]}})}),function(){return o.apply(this,arguments)}),ek=(a=(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return[2,fetch(e).then(function(e){return e.blob()})]})}),function(e){return a.apply(this,arguments)}),eZ=(0,x.forwardRef)(function(e,t){var n=e.onChange,r=e.accept,i=(0,x.useRef)(null),o=(0,x.useRef)(null);return(0,x.useImperativeHandle)(t,function(){return{start:function(){var e,t;null===(t=o.current)||void 0===t||null===(e=t.click)||void 0===e||e.call(t)},reset:function(){var e,t;null===(t=i.current)||void 0===t||null===(e=t.reset)||void 0===e||e.call(t)}}}),(0,y.tZ)("form",{style:{display:"none"},ref:i,children:(0,y.tZ)("input",{type:"file",accept:r||"image/*",ref:o,onChange:function(e){var t,r;e.target.files[0]&&(n&&n(e.target.files[0]),null===(r=i.current)||void 0===r||null===(t=r.reset)||void 0===t||t.call(r))}})})}),ex=[{key:"jpg",label:"\u5BFC\u51FA\u4E3A JPG"},{key:"png",label:"\u5BFC\u51FA\u4E3A PNG"},{key:"svg",label:"\u5BFC\u51FA\u4E3A SVG"},{key:"json",label:"\u5BFC\u51FA\u4E3A \u6A21\u677F"},{type:"divider"},{key:"clipboard",label:"\u590D\u5236\u5230\u526A\u8D34\u677F"}];function eC(){var e,t=(0,x.useContext)(_),n=t.editor,r=t.setReady,i=t.setActiveObject,o=(0,x.useRef)(),a=(e=(0,w._)(function(){var e;return(0,Z.Jh)(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,ek(n.export2Img({format:"png"}))];case 1:return e=t.sent(),[4,navigator.clipboard.write([new ClipboardItem({"image/png":e})])];case 2:return t.sent(),Q.ZP.success("\u590D\u5236\u6210\u529F"),[3,4];case 3:return t.sent(),Q.ZP.error("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u9009\u62E9\u5BFC\u51FA\u5230\u672C\u5730"),[3,4];case 4:return[2]}})}),function(){return e.apply(this,arguments)});return(0,y.BX)(N,{justify:"flex-end",gap:16,style:{width:280,paddingRight:16},children:[(0,y.tZ)($.ZP,{onClick:function(){var e,t;null===(t=o.current)||void 0===t||null===(e=t.start)||void 0===e||e.call(t)},children:"\u52A0\u8F7D\u6A21\u677F"}),(0,y.tZ)(ee.Z,{menu:{items:ex,onClick:function(e){var t=e.key,r=n.sketch.fabritor_desc;switch(t){case"png":ep(n.export2Img({format:"png"}),"png",r);break;case"jpg":ep(n.export2Img({format:"jpg"}),"jpg",r);break;case"svg":ep(n.export2Svg(),"svg",r);break;case"json":var i=n.canvas2Json();ep("data:text/json;charset=utf-8,".concat(encodeURIComponent(JSON.stringify(i,null,2))),"json",r);break;case"clipboard":a()}}},arrow:{pointAtCenter:!0},placement:"bottom",children:(0,y.tZ)($.ZP,{type:"primary",icon:(0,y.tZ)(et.Z,{}),children:"\u5BFC\u51FA"})}),(0,y.tZ)(eZ,{accept:"application/json",ref:o,onChange:function(e){r(!1);var t,o=new FileReader;o.onload=(t=(0,w._)(function(e){var t,o;return(0,Z.Jh)(this,function(a){switch(a.label){case 0:if(!(o=null===(t=e.target)||void 0===t?void 0:t.result))return[3,2];return[4,n.loadFromJSON(o,!0)];case 1:a.sent(),n.fhistory.reset(),r(!0),i(null),n.fireCustomModifiedEvent(),a.label=2;case 2:return[2]}})}),function(e){return t.apply(this,arguments)}),o.readAsText(e)}})]})}function eS(){return(0,y.BX)(N,{gap:5,style:{width:406,paddingLeft:16},children:[(0,y.tZ)("img",{src:"https://foruda.gitee.com/images/1712407660517252867/e3ce5120_1411078.png",style:{width:28}}),(0,y.tZ)("span",{style:{fontWeight:"bold",fontSize:14},children:"\u5236\u4F5C\u56FE"})]})}var eA=n(9752),e_=eA.Z.Text;function ej(){var e=(0,k._)((0,x.useState)(""),2),t=e[0],n=e[1],r=(0,x.useContext)(_).editor;return(0,x.useEffect)(function(){r&&n(r.sketch.fabritor_desc)},[null==r?void 0:r.sketch]),(0,y.tZ)(e_,{editable:{onChange:function(e){var t=e||"\u6211\u7684\u753B\u677F by fabritor";n(t),r&&(r.sketch.set("fabritor_desc",t),r.fireCustomModifiedEvent())},autoSize:{minRows:1,maxRows:1}},ellipsis:{rows:1},style:{margin:0,width:200},children:t||""})}var eO=C.Z.Header,eF={padding:0,height:50,backgroundColor:"#fff",display:"flex",alignItems:"center",borderBottom:"1px solid #e8e8e8"};function ez(){return(0,y.BX)(eO,{style:eF,children:[(0,y.tZ)(eS,{}),(0,y.BX)(N,{justify:"space-between",style:{flex:1},children:[(0,y.tZ)(ej,{}),(0,y.tZ)(K,{})]}),(0,y.tZ)(eC,{})]})}var eB=n(9548),eP=n(4307),eR=n(6831),eL=n(7744),eX=n(7822),eM=n(5303),eH=n(8599),eE=n(8586),eI=n(8021),eT=n(3831);function eW(e){var t=e.children;return(0,y.tZ)(q.Z,{children:t})}var eJ=[{label:(0,y.tZ)("div",{style:{fontSize:30,fontFamily:"SmileySans",fontWeight:"bold"},children:"\u6DFB\u52A0\u6807\u9898"}),key:"title",config:{fontFamily:"SmileySans",fontWeight:"bold",fontSize:120,text:"\u6DFB\u52A0\u6807\u9898",top:100}},{label:(0,y.tZ)("div",{style:{fontSize:24,fontFamily:"AlibabaPuHuiTi"},children:"\u6DFB\u52A0\u526F\u6807\u9898"}),key:"sub-title",config:{fontFamily:"AlibabaPuHuiTi",fontWeight:"bold",fontSize:100,text:"\u6DFB\u52A0\u526F\u6807\u9898",top:400}},{label:(0,y.tZ)("div",{style:{fontSize:16,fontFamily:"SourceHanSerif"},children:"\u6DFB\u52A0\u4E00\u6BB5\u6B63\u6587"}),key:"content",config:{fontFamily:"SourceHanSerif",fontSize:80,text:"\u6DFB\u52A0\u4E00\u6BB5\u6B63\u6587"}},{label:(0,y.tZ)("div",{style:{fontSize:26,fontFamily:"\u971E\u9E5C\u6587\u6977",color:"#ffffff",WebkitTextStroke:"1px rgb(255, 87, 87)"},children:"\u6587\u5B57\u8FB9\u6846"}),key:"content",config:{fontFamily:"\u971E\u9E5C\u6587\u6977",fontSize:100,text:"\u6587\u5B57\u8FB9\u6846",fill:"#ffffff",stroke:"#ff5757",strokeWidth:12}}];function eV(e){var t=e.addTextBox,n=function(e){null==t||t(e.config)};return(0,y.BX)(V.Z,{vertical:!0,gap:8,style:{marginTop:16},children:[(0,y.tZ)(eW,{children:"\u9ED8\u8BA4\u6587\u5B57\u6837\u5F0F"}),eJ.map(function(e){return(0,y.tZ)(eT.Z,{hoverable:!0,onClick:function(){n(e)},bodyStyle:{padding:"12px 30px"},children:e.label},e.key)})]})}var eU=function(e){var t=e.textLines||[];if(!t||!t.length)return 0;for(var n=0,r=0;r100?100:t},eD=function(e,t){if(!e.isEditing){var n=eU(e),r=new en.fabric.Path("M 0 0 Q ".concat(n/2," ").concat(n/2*t/100," ").concat(n," 0"),{visible:!1,stroke:"#000000",fill:"#00000000"});e.set({path:r,width:n}),e.canvas.requestRenderAll()}},eY=function(e){e.set({path:null}),e.canvas.requestRenderAll()},eq=(l=(0,w._)(function(e){var t,n,r,i,o,a,l,s,c;return(0,Z.Jh)(this,function(u){switch(u.label){case 0:if(r=void 0===(n=(t=e||{}).text)?"":n,o=void 0===(i=t.fontFamily)?"Arial":i,a=t.canvas,l=(0,J._)(t,["text","fontFamily","canvas"]),s={hasPath:!1,offset:100},(c=new en.fabric.FText(r||"\u8FD9\u662F\u4E00\u6BB5\u6587\u672C",(0,W._)((0,T._)({},es,l),{fontFamily:o,pathAlign:"center",id:ed()}))).on("editing:entered",function(){c.path?(s.hasPath=!0,s.offset=eN(c),c.set("path",null),c.initDimensions(),a.requestRenderAll()):s.hasPath=!1}),c.on("editing:exited",function(){s.hasPath&&(eD(c,s.offset),a.requestRenderAll())}),null==e.left&&null==e.top?a.viewportCenterObject(c):null==e.left&&a.viewportCenterObjectH(c),a.add(c),a.setActiveObject(c),a.requestRenderAll(),!o)return[3,4];u.label=1;case 1:return u.trys.push([1,,3,4]),[4,ef(o)];case 2:return u.sent(),[3,4];case 3:return c.set("fontFamily",o),a.requestRenderAll(),[7];case 4:return[2,c]}})}),function(e){return l.apply(this,arguments)});function eG(){var e,t=(0,x.useContext)(_).editor,n=(e=(0,w._)(function(e){return(0,Z.Jh)(this,function(n){switch(n.label){case 0:return[4,eq((0,W._)((0,T._)({},e),{canvas:t.canvas}))];case 1:return n.sent(),[2]}})}),function(t){return e.apply(this,arguments)});return(0,y.BX)("div",{className:"fabritor-panel-wrapper",children:[(0,y.tZ)($.ZP,{type:"primary",block:!0,onClick:function(){n({})},size:"large",children:"\u6DFB\u52A0\u6587\u672C\u6846"}),(0,y.tZ)(eV,{addTextBox:n})]})}var eK=(s=(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return[2,new Promise(function(t,n){en.fabric.util.loadImage(e,function(e){return e?t(e):(Q.ZP.error("\u52A0\u8F7D\u56FE\u7247\u5931\u8D25"),n())},null,"anonymous")})]})}),function(e){return s.apply(this,arguments)}),eQ=(c=(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return"string"==typeof e?[2,new Promise(function(t,n){en.fabric.Image.fromURL(e,function(e){if(!e){Q.ZP.error("\u52A0\u8F7D\u56FE\u7247\u5931\u8D25"),n();return}t(e)},{crossOrigin:"anonymous"})})]:[2,Promise.resolve(new en.fabric.Image(e))]})}),function(e){return c.apply(this,arguments)}),e$=(u=(0,w._)(function(e){var t,n,r,i,o;return(0,Z.Jh)(this,function(a){switch(a.label){case 0:n=(t=e||{}).imageSource,r=t.canvas,i=(0,J._)(t,["imageSource","canvas"]),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,eQ(n)];case 2:return o=a.sent(),[3,4];case 3:return console.log(a.sent()),[3,4];case 4:if(!o)return[2];return o.set((0,W._)((0,T._)({},i),{paintFirst:"fill",id:ed()})),r.viewportCenterObject(o),r.add(o),r.setActiveObject(o),r.requestRenderAll(),[2,o]}})}),function(e){return u.apply(this,arguments)}),e0=(h=(0,w._)(function(e){var t,n,r,i,o;return(0,Z.Jh)(this,function(a){switch(a.label){case 0:n=(t=e||{}).imageSource,r=t.canvas,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,eQ(n)];case 2:return i=a.sent(),[3,4];case 3:return console.log(a.sent()),[3,4];case 4:if(!i)return[2];return o=new en.fabric.FImage({image:i,id:ed()}),r.viewportCenterObject(o),r.add(o),r.setActiveObject(o),r.requestRenderAll(),[2]}})}),function(e){return h.apply(this,arguments)}),e1=n(2313);function e2(e){var t=e.onChange,n=(0,J._)(e,["onChange"]),r=(0,x.useRef)();return(0,y.BX)("div",{style:{flex:1},children:[(0,y.tZ)($.ZP,(0,W._)((0,T._)({style:{width:"100%"},type:"primary",size:"large",onClick:function(){var e,t;null===(t=r.current)||void 0===t||null===(e=t.start)||void 0===e||e.call(t)}},n),{children:"\u6DFB\u52A0\u672C\u5730\u56FE\u7247"})),(0,y.tZ)(eZ,{accept:"image/*",ref:r,onChange:function(e){if("image/svg+xml"!==e.type){var n=new FileReader;n.onload=function(e){null==t||t(e.target.result)},n.readAsDataURL(e)}}})]})}var e3=n(3136),e4=n(2950);function e6(e){var t=e.onChange,n=(0,J._)(e,["onChange"]),r=(0,k._)((0,x.useState)(""),2),i=r[0],o=r[1];return(0,y.tZ)(e3.Z,{content:(0,y.BX)(e1.Z.Compact,{children:[(0,y.tZ)(e4.Z,{value:i,onChange:function(e){o(e.target.value)},style:{width:260}}),(0,y.tZ)($.ZP,{onClick:function(){i&&(null==t||t(i))},children:"\u786E\u8BA4"})]}),title:"\u8BF7\u8F93\u5165\u5730\u5740\uFF1A",trigger:"click",children:(0,y.tZ)($.ZP,(0,W._)((0,T._)({size:"large"},n),{children:"\u6DFB\u52A0\u8FDC\u7A0B\u56FE\u7247"}))})}var e8=n(5893),e5=n(1025),e7=n(4436),e9=n(6598);function te(e){var t=e.query,n=e.page,r=e.orientation;return(0,e9.Z)({method:"get",url:"https://api.pexels.com/v1/search",params:{query:(void 0===t?"nature":t)||"nature",per_page:10,page:void 0===n?1:n,size:"small",orientation:void 0===r?"landscape":r},headers:{Authorization:"4LInD4o8MBFIIPIK0AItnH3YnIo8IhGMvJhzMjYEFmquGwZplmG6LnY3"}}).then(function(e){return e.data.photos.map(function(e){return(0,T._)({url:e.src.tiny},e.src)})})}var tt=[{value:0,label:"Pexels",link:"https://www.pexels.com"},{value:1,label:"Unsplash",link:"https://unsplash.com/developers"},{value:2,label:"Pixabay",link:"https://pixabay.com/"}];function tn(e){var t,n,r,i=e.onChange;(0,J._)(e,["onChange"]);var o=(0,x.useContext)(_).editor,a=(0,k._)((0,x.useState)([]),2),l=a[0],s=a[1],c=(0,k._)((0,x.useState)(""),2),u=c[0],h=c[1],f=(0,k._)((0,x.useState)(1),2),d=f[0],p=f[1],v=(0,k._)((0,x.useState)(0),2),g=v[0],b=v[1],m=(0,e7.debounce)((t=(0,w._)(function(e){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:return h(t=e.target.value.trim()),[4,te({page:d,query:t})];case 1:return s(n.sent()),[2]}})}),function(e){return t.apply(this,arguments)}),300);(0,x.useEffect)(function(){o&&(o.sketch,function(){O.apply(this,arguments)}())},[o]);var C=(0,k._)((0,x.useState)(!0),2),A=C[0],j=C[1];function O(){return(O=(0,w._)(function(){return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return[4,(0,e9.Z)({method:"get",url:"https://api.pexels.com/v1/curated",params:{per_page:10,page:1},headers:{Authorization:"4LInD4o8MBFIIPIK0AItnH3YnIo8IhGMvJhzMjYEFmquGwZplmG6LnY3"}}).then(function(e){return e.data.photos.map(function(e){return(0,T._)({url:e.src.tiny},e.src)})})];case 1:return s(e.sent()),j(!1),[2]}})})).apply(this,arguments)}var F=(n=(0,w._)(function(e,t){var n,r,i,a,l;return(0,Z.Jh)(this,function(c){var h,f,d,v,g,y,m,w,k,Z;switch(c.label){case 0:if(!o)return[2];r=(n=o.sketch).width,i=n.height,j(!0),p(t),b(e),a=[],l={page:t,query:u},c.label=1;case 1:if(c.trys.push([1,8,,9]),0!==e)return[3,3];return[4,te((0,W._)((0,T._)({},l),{orientation:r===i?"square":r>i?"landscape":"portrait"}))];case 2:a=c.sent(),c.label=3;case 3:if(1!==e)return[3,5];return[4,(f=(h=(0,W._)((0,T._)({},l),{orientation:r===i?"squarish":r>i?"landscape":"portrait"})).query,d=h.page,v=h.orientation,(0,e9.Z)({method:"get",url:"https://api.unsplash.com/search/photos",params:{query:(void 0===f?"nature":f)||"nature",per_page:10,page:void 0===d?1:d,client_id:"Nxgsrk91xSPQyJi858udhIZo-ByNhNc-1EEpa9JLnWU",orientation:void 0===v?"landscape":v}}).then(function(e){return e.data.results.map(function(e){return(0,T._)({url:e.urls.small},e.urls)})}))];case 4:a=c.sent(),c.label=5;case 5:if(2!==e)return[3,7];return[4,(y=(g=(0,W._)((0,T._)({},l),{minHeight:i,minWidth:r,orientation:r===i?"all":r>i?"horizontal":"vertical"})).query,m=g.page,w=g.orientation,k=g.minWidth,Z=g.minHeight,(0,e9.Z)({method:"get",url:"https://pixabay.com/api",params:{q:(void 0===y?"nature":y)||"nature",per_page:10,page:void 0===m?1:m,orientation:void 0===w?"all":w,min_width:void 0===k?0:k,min_height:void 0===Z?0:Z,key:"4676309-98dc7486bd9c46eb8baf1ee96"}}).then(function(e){return e.data.hits.map(function(e){return{url:e.webformatURL}})}))];case 6:a=c.sent(),c.label=7;case 7:return[3,9];case 8:return console.log(c.sent()),[3,9];case 9:return s(a),j(!1),[2]}})}),function(e,t){return n.apply(this,arguments)}),z=(0,e7.debounce)(function(){F(g,d+1)},300),B=(0,k._)((0,x.useState)(!0),2),P=B[0],R=B[1],L=(0,e7.debounce)((r=(0,w._)(function(e){var t,n,r,a,l,s;return(0,Z.Jh)(this,function(c){switch(c.label){case 0:if(!o)return[2];if(R(!1),t=o.sketch.width,0!==g)return[3,2];return console.log(r="".concat(e.original,"?auto=compress&cs=tinysrgb&fit=crop&w=").concat(t)),[4,null===(n=i)||void 0===n?void 0:n(r)];case 1:case 3:return c.sent(),[3,6];case 2:if(1!==g)return[3,4];return console.log(l="".concat(e.raw,"&q=80&w=").concat(t)),[4,null===(a=i)||void 0===a?void 0:a(l)];case 4:return[4,null===(s=i)||void 0===s?void 0:s(e.url)];case 5:c.sent(),c.label=6;case 6:return R(!0),[2]}})}),function(e){return r.apply(this,arguments)}),300),X=(0,x.useMemo)(function(){return tt[g]},[g]);return l.length?(0,y.BX)(e8.Fragment,{children:[(0,y.tZ)(S.Z,{spinning:!P,fullscreen:!0}),(0,y.BX)(e1.Z,{direction:"vertical",style:{width:"100%"},children:[(0,y.tZ)(e4.Z,{placeholder:"\u641C\u7D22\u56FE\u7247",onInput:m,disabled:A}),(0,y.tZ)(e5.ZP.Group,{defaultValue:0,value:g,size:"small",onChange:function(e){A||F(e.target.value,1)},disabled:A,children:tt.map(function(e){return(0,y.tZ)(e5.ZP.Button,{value:e.value,children:e.label},e.value)})}),l.map(function(e){return(0,y.tZ)("div",{onClick:L.bind(null,e),style:{cursor:"pointer",minHeight:"50px"},children:(0,y.tZ)("img",{crossOrigin:"anonymous",width:"100%",loading:"lazy",src:e.url,alt:"img"})},e.url)}),(0,y.BX)(V.Z,{justify:"space-between",children:[(0,y.BX)($.ZP,{size:"small",type:"link",href:X.link,style:{fontSize:"10px"},children:["Photos provided by ",X.label]}),(0,y.tZ)($.ZP,{size:"small",loading:A,onClick:z,children:"\u4E0B\u4E00\u9875"})]})]})]}):null}function tr(e){var t=e.onChange,n=(0,J._)(e,["onChange"]);return(0,y.BX)(e1.Z,{direction:"vertical",size:"large",style:{width:"100%"},children:[(0,y.BX)(V.Z,{gap:10,justify:"space-between",children:[(0,y.tZ)(e2,(0,W._)((0,T._)({},n),{onChange:t})),(0,y.tZ)(e6,(0,W._)((0,T._)({},n),{onChange:t}))]}),(0,y.tZ)(tn,{onChange:t})]})}function ti(){var e,t=(0,x.useContext)(_).editor,n=(e=(0,w._)(function(e){return(0,Z.Jh)(this,function(n){switch(n.label){case 0:return[4,e0({imageSource:e,canvas:t.canvas})];case 1:return n.sent(),[2]}})}),function(t){return e.apply(this,arguments)});return(0,y.tZ)("div",{className:"fabritor-panel-wrapper",children:(0,y.tZ)(tr,{onChange:n})})}var to=n(6546),ta=[{key:"line",type:"f-line",svg:''},{key:"dash-line",type:"f-line",svg:'',options:{strokeDashArray:[8,8]}},{key:"arrow-line-1",type:"f-arrow",svg:'\n \n '},{key:"arrow-line-2",type:"f-tri-arrow",svg:''}],tl=function(e){return Math.PI*e/180},ts=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n=360/e,r=[],i=0;i',shape:en.fabric.Rect,options:{width:200,height:200,fill:"#555555"}},{key:"rect-r",elem:'',shape:en.fabric.Rect,options:{width:200,height:200,rx:20,ry:20,fill:"#555555"}},{key:"circle",elem:'',shape:en.fabric.Circle,options:{radius:100,fill:"#555555"}},{key:"ellipse",elem:'',shape:en.fabric.Ellipse,options:{rx:120,ry:200,fill:"#555555"}},{key:"triangle",elem:'',shape:en.fabric.Triangle,options:{width:200,height:180,fill:"#555555"}},{key:"right-angle",elem:'',shape:en.fabric.Polygon,options:{points:[{x:0,y:0},{x:0,y:200},{x:200,y:200}],fill:"#555555"}},{key:"diamond",elem:'',shape:en.fabric.Polygon,options:{points:[{x:0,y:100},{x:100,y:200},{x:200,y:100},{x:100,y:0}],fill:"#555555"}},{key:"parallelgram",elem:'',shape:en.fabric.Polygon,options:{points:[{x:50,y:0},{x:0,y:100},{x:200,y:100},{x:250,y:0}],fill:"#555555"}},{key:"pentagon",elem:'',shape:en.fabric.Polygon,options:{points:ts(5),fill:"#555555"}},{key:"hexagon",elem:'',shape:en.fabric.Polygon,options:{points:ts(6),fill:"#555555"}},{key:"star",elem:''},{key:"heart",elem:''}],tu=n.p+"assets/rect.df3b593f.png",th=n.p+"assets/circle.c2faca88.png",tf=n.p+"assets/ellipse.41feedb4.png",td=n.p+"assets/right-angle.93573792.png",tp=n.p+"assets/diamond.d2acbdbe.png",tv={hachureGap:16,fillWeight:4,strokeWidth:8,roughness:1.6,bowing:1},tg=[{key:"rough-line",elem:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATYAAAAMCAYAAADoKpHWAAAAAXNSR0IArs4c6QAAAjFJREFUaEPtm7Fu01AYhc+5TqiUIFVi6FCJ4jwDCyuPACKoS5Z2YYCNGTHBIyBZQBELggoJlRdgRuwsSHUFgg4MIJRCk/gepkooTS2HOr1x/GeMr3P+892bc23rNzHh82Xj5lUQa5OOHX0nISaxnDdmlsckdYBw+rP0lssdTB3xI5T+JN0M2ovAoDXJKx018DMEl2Vi90KyHUQ7hN8qaHK8yG+31uPhwD8EdCXPAIG2gGZAk22G1Q9lvS9gGEp8ki6B8DUJfUcMAnEJ7z+Q8XmQJbHVirDz7+ZyLNg+b3ZvU7gr4NI8FG01GAEjYATy72J0r9FoPlpNXnw/Gnc82Da6zwWs1/RqyFaQETACFSMgFAm2ze5rCNcr5s3KNQJGoKYELNhqOvFm2wgsMgELtkWeXfNmBGpKQOAWqQcXn2x/OvkZm92K1nR5mG0jUE0Cgl55F92PH7/8aMFWzTm0qo2AERgjUOlgE5ByFo2pYkqFaeys6woVFeOMm7sldFjDhu6FXmPCOzo+y0bZh+bSYHc1eXuQ0+5x4w7lLhcBIvqUbroueC+Xuv8IElF9uvIbMA8P3UHLMVRjZxHMizemyXaG0Zk2d2cZzkdg6Zp0PlaJgSmPDuVKeaOnjA1knjeESVdqJwbbfu/aiqKlVqF/E7P+Hw2n6oKPz630mSRTnVOoFhtkBAIQ2O/12r+jX6UFZsM32w0XlfN7JWwgp90QThv8eUHvnX8PDd6sPd35Oj71fwE3zdMN1O33QQAAAABJRU5ErkJggg==",options:(0,T._)({stroke:"#E36255"},tv)},{key:"rough-rect",elem:tu,options:(0,T._)({fill:"#F6C445",stroke:"#EC6A52"},tv)},{key:"rough-circle",elem:th,options:(0,T._)({fill:"#F6C445",stroke:"#EC6A52"},tv)},{key:"rough-ellipse",elem:tf,options:(0,T._)({fill:"#F6C445",stroke:"#EC6A52"},tv)},{key:"rough-right-angle",elem:td,options:(0,T._)({fill:"#F6C445",stroke:"#EC6A52"},tv)},{key:"rough-diamond",elem:tp,options:(0,T._)({fill:"#F6C445",stroke:"#EC6A52"},tv)}],tb=function(e){var t=e.points,n=e.canvas,r=(0,J._)(e,["points","canvas"]),i=new en.fabric.FLine(t||[0,0,300,0],(0,T._)({strokeWidth:4,stroke:"#000000",strokeLineJoin:"round",strokeLineCap:"round",borderColor:"#00000000",id:ed()},r));return n.viewportCenterObject(i),i.set({x1:i.left,y1:i.top,x2:i.left+300,y2:i.top}),n.add(i),n.setActiveObject(i),n.requestRenderAll(),i},ty=function(e){var t=e.points,n=e.canvas,r=(0,J._)(e,["points","canvas"]),i=new en.fabric.FArrow(t||[0,0,300,0],(0,T._)({strokeWidth:4,stroke:"#000000",fill:"#000000",strokeLineJoin:"round",strokeLineCap:"round",borderColor:"#00000000"},r));return n.viewportCenterObject(i),i.set({x1:i.left,y1:i.top,x2:i.left+300,y2:i.top}),n.add(i),n.setActiveObject(i),n.requestRenderAll(),i},tm=function(e){var t=e.points,n=e.canvas,r=(0,J._)(e,["points","canvas"]),i=new en.fabric.FTriArrow(t||[0,0,300,0],(0,T._)({strokeWidth:4,stroke:"#000000",fill:"#000000",strokeLineJoin:"round",strokeLineCap:"round",borderColor:"#00000000"},r));return n.viewportCenterObject(i),i.set({x1:i.left,y1:i.top,x2:i.left+300,y2:i.top}),n.add(i),n.setActiveObject(i),n.requestRenderAll(),i},tw=(f=(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return[2,new Promise(function(t){en.fabric.loadSVGFromString(e,function(e,n){t(en.fabric.util.groupSVGElements(e,n))})})]})}),function(e){return f.apply(this,arguments)});(0,w._)(function(e){return(0,Z.Jh)(this,function(t){return[2,new Promise(function(t){en.fabric.loadSVGFromURL(e,function(e,n){t(en.fabric.util.groupSVGElements(e,n))})})]})});var tk=(d=(0,w._)(function(e){var t,n,r,i,o;return(0,Z.Jh)(this,function(a){switch(a.label){case 0:return n=(t=e||{}).svgString,r=t.canvas,i=(0,J._)(t,["svgString","canvas"]),[4,tw(n)];case 1:return(o=a.sent()).set((0,W._)((0,T._)({},i),{id:ed()})),r.viewportCenterObject(o),r.add(o),r.setActiveObject(o),r.requestRenderAll(),[2,o]}})}),function(e){return d.apply(this,arguments)});function tZ(){var e=(0,x.useContext)(_),t=e.editor,n=e.roughSvg,r=function(e){var n=e.type,r=e.options,i=void 0===r?{}:r,o=t.canvas;switch(n){case"f-line":tb((0,W._)((0,T._)({},i),{canvas:o}));break;case"f-arrow":ty((0,W._)((0,T._)({},i),{canvas:o}));break;case"f-tri-arrow":tm((0,W._)((0,T._)({},i),{canvas:o}))}},i=function(e){var n,r,i,o,a,l,s,c,u,h,f=e.key,d=e.elem,p=e.options,v=t.canvas;switch(f){case"rect":case"rect-r":r=(n=(0,W._)((0,T._)({},p),{canvas:v})||{}).canvas,i=(0,J._)(n,["canvas"]),o=new en.fabric.Rect((0,T._)({id:ed(),width:200,height:200},i)),r.viewportCenterObject(o),r.add(o),r.setActiveObject(o),r.requestRenderAll();break;case"star":case"heart":tk({svgString:d,canvas:v,sub_type:f,strokeWidth:20});break;default:a=e.shape,c=(s=(0,W._)((0,T._)({},p),{canvas:v})||{}).points,u=s.canvas,h=(0,J._)(s,["points","canvas"]),l=a===en.fabric.Polygon?new en.fabric.Polygon(c,(0,T._)({id:ed()},h)):new a((0,T._)({id:ed()},h)),u.viewportCenterObject(l),u.add(l),u.setActiveObject(l),u.requestRenderAll()}},o=function(e){var r,i=e.key,o=e.options,a=t.canvas;switch(i){case"rough-line":r=n.line(0,0,300,0,o);break;case"rough-rect":r=n.rectangle(0,0,400,400,o);break;case"rough-circle":r=n.circle(0,0,300,o);break;case"rough-ellipse":r=n.ellipse(0,0,300,150,o);break;case"rough-right-angle":r=n.polygon([[0,0],[0,300],[300,300]],o);break;case"rough-diamond":r=n.polygon([[0,150],[150,300],[300,150],[150,0]],o)}console.log(r),tk({svgString:''.concat(r.innerHTML,""),canvas:a,sub_type:"rough"})};return(0,y.BX)("div",{className:"fabritor-panel-wrapper",children:[(0,y.tZ)(eW,{children:"\u7EBF\u6761"}),(0,y.tZ)(V.Z,{gap:10,wrap:"wrap",justify:"space-around",children:ta.map(function(e){return(0,y.tZ)("div",{onClick:function(){r(e)},className:"fabritor-panel-shape-item",children:(0,y.tZ)("img",{src:"data:image/svg+xml,".concat(encodeURIComponent(e.svg)),alt:"",style:{width:48,height:48}})},e.key)})}),(0,y.tZ)(eW,{children:"\u5F62\u72B6"}),(0,y.tZ)(V.Z,{gap:10,wrap:"wrap",justify:"space-around",children:tc.map(function(e){return(0,y.tZ)("div",{onClick:function(){i(e)},className:"fabritor-panel-shape-item",children:(0,y.tZ)("img",{src:"data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(e.elem)),style:{width:64,height:64}})},e.key)})}),(0,y.tZ)(eW,{children:(0,y.BX)("div",{style:{position:"relative"},children:[(0,y.tZ)("span",{children:"\u624B\u7ED8\u98CE\u683C"}),(0,y.tZ)(to.Z,{color:"#f50",style:{position:"absolute",right:-48,top:-5,padding:"0 4px"},children:"beta"})]})}),(0,y.tZ)(V.Z,{gap:10,wrap:"wrap",justify:"space-around",children:tg.map(function(e){return(0,y.tZ)("div",{onClick:function(){o(e)},className:"fabritor-panel-shape-item",children:(0,y.tZ)(U,{style:{width:64,height:64},children:(0,y.tZ)("img",{src:e.elem,style:{width:64}})})},e.key)})})]})}var tx=[{key:"p-1",svg:'',title:"\u94C5\u7B14",options:{color:"#1296db",width:4,strokeLineCap:"round"}},{key:"p-2",svg:'',title:"\u9A6C\u514B\u7B14",options:{color:"#FF0000",width:36,strokeLineCap:"square"}}],tC=n(1524),tS=n(746),tA=n(4125);function t_(e){var t=e.value,n=e.onChange,r=e.trigger;return(0,y.tZ)(e3.Z,{content:(0,y.tZ)(tA.Z,{value:t,onChange:function(e){null==n||n(e)},format:"hex"}),children:(0,y.tZ)("div",{className:"fabritor-toolbar-item",style:{borderRadius:4,backgroundColor:"#ffffff"===new tS.Il(t).toHexString()?"rgba(103,103,103,0.24)":null},children:r||(0,y.tZ)("svg",{width:22,height:22,viewBox:"64 64 896 896",focusable:"false",fill:t,"aria-hidden":"true",children:(0,y.tZ)("path",{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"})})})})}var tj=n(4869);function tO(e){var t,n=e.defaultColor,r=void 0===n?"#ffffff":n,i=e.trigger,o=e.type,a=e.value,l=e.onChange,s=function(){switch(null==a?void 0:a.type){case"solid":return a.color;case"linear":case"radial":return"url(#colorsetter-icon-gradient) ".concat(a.color||"rgba(0, 0, 0, 0.88)");default:return"rgba(0, 0, 0, 0.88)"}};return(0,y.BX)(e8.Fragment,{children:[(0,y.tZ)(e3.Z,{content:(0,y.tZ)("div",{className:"fabritor-color-setter",children:(0,y.tZ)(tj.Z,{value:a,onChange:function(e){e&&(e.color||(e.color=r),null==l||l(e))},format:"hex",angleType:"rotate"})}),trigger:"click",children:(0,y.tZ)("div",{className:"fabritor-toolbar-item",style:{borderRadius:4,backgroundColor:(null==a?void 0:a.type)==="solid"&&"#ffffff"===new tS.Il(a.color).toHexString()?"rgba(103,103,103,0.24)":null},children:i||("fontColor"===o?(0,y.tZ)("svg",{viewBox:"64 64 896 896",focusable:"false",width:22,height:22,fill:s(),"aria-hidden":"true",children:(0,y.tZ)("path",{d:"M904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8zm-650.3-80h85c4.2 0 8-2.7 9.3-6.8l53.7-166h219.2l53.2 166c1.3 4 5 6.8 9.3 6.8h89.1c1.1 0 2.2-.2 3.2-.5a9.7 9.7 0 006-12.4L573.6 118.6a9.9 9.9 0 00-9.2-6.6H462.1c-4.2 0-7.9 2.6-9.2 6.6L244.5 723.1c-.4 1-.5 2.1-.5 3.2-.1 5.3 4.3 9.7 9.7 9.7zm255.9-516.1h4.1l83.8 263.8H424.9l84.7-263.8z"})}):(0,y.tZ)("svg",{width:22,height:22,viewBox:"64 64 896 896",focusable:"false",fill:s(),"aria-hidden":"true",children:(0,y.tZ)("path",{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"})}))})}),(0,y.tZ)("svg",{style:{width:0,height:0,position:"absolute"},"aria-hidden":"true",focusable:"false",children:(0,y.tZ)("linearGradient",{id:"colorsetter-icon-gradient",x2:"1",y2:"1",children:null==a?void 0:null===(t=a.gradient)||void 0===t?void 0:t.colorStops.map(function(e){return(0,y.tZ)("stop",{offset:"".concat(100*e.offset,"%"),"stop-color":e.color})})})})]})}var tF=n(991),tz=n(4163);function tB(e){var t=e.min,n=void 0===t?1:t,r=e.max,i=void 0===r?100:r,o=e.step,a=void 0===o?1:o,l=e.style,s=e.sliderProps,c=e.inputProps,u=e.onChange,h=e.onChangeComplete,f=e.value;return(0,y.BX)(V.Z,{gap:6,style:l,children:[(0,y.tZ)(tF.Z,(0,T._)({style:{flex:1},min:n,max:i,step:a,onChange:u,onAfterChange:h,value:f},s)),(0,y.tZ)(tz.Z,(0,T._)({min:n,max:i,step:a,onChange:u,value:f,style:{width:56},controls:!1},c))]})}var tP=tC.Z.Item;function tR(e){var t=e.value,n=e.onChange,r=e.shouldFireEvent,i=e.showPenTip,o=e.showFillConfig,a=(0,k._)(tC.Z.useForm(),1)[0],l=(0,x.useContext)(_).editor,s=function(){r&&l.fireCustomModifiedEvent()};return(0,x.useEffect)(function(){a.setFieldsValue(t)},[t]),(0,y.BX)(tC.Z,{form:a,onValuesChange:n,style:{marginBottom:0,marginTop:16},colon:!1,children:[i?(0,y.tZ)(tP,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u753B\u7B14"})}):null,(0,y.tZ)(tP,{label:o?"\u63CF\u8FB9":"\u989C\u8272",name:"color",children:(0,y.tZ)(t_,{onChange:s})}),(0,y.tZ)(tP,{label:"\u7EBF\u5BBD",name:"width",children:(0,y.tZ)(tB,{min:1,max:100,onChangeComplete:s})}),o?(0,y.tZ)(tP,{label:"\u586B\u5145",name:"fill",children:(0,y.tZ)(tO,{onChange:s})}):null,(0,y.tZ)(tP,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u9634\u5F71"})}),(0,y.tZ)(tP,{label:"\u989C\u8272",name:["shadow","color"],children:(0,y.tZ)(t_,{onChange:s})}),(0,y.tZ)(tP,{label:"\u5BBD\u5EA6",name:["shadow","width"],children:(0,y.tZ)(tB,{min:0,max:50,onChangeComplete:s})}),(0,y.tZ)(tP,{label:"\u504F\u79FB",name:["shadow","offset"],children:(0,y.tZ)(tB,{min:0,max:20,onChangeComplete:s})})]})}function tL(){var e=(0,k._)((0,x.useState)(0),2),t=e[0],n=e[1],r=(0,k._)((0,x.useState)(!0),2),i=r[0],o=r[1],a=(0,x.useContext)(_).editor,l=(0,k._)((0,x.useState)({}),2),s=l[0],c=l[1],u=function(e){if(e.color&&(a.canvas.freeDrawingBrush.color=e.color),e.width&&(a.canvas.freeDrawingBrush.width=e.width),e.strokeLineCap&&(a.canvas.freeDrawingBrush.strokeLineCap=e.strokeLineCap),e.shadow){var t=a.canvas.freeDrawingBrush.shadow,n=t?t.toObject():{},r={blur:e.shadow.width||n.blur,offsetX:e.shadow.offset||n.offsetX,offsetY:e.shadow.offset||n.offsetY,affectStroke:!0,color:e.shadow.color||n.color};a.canvas.freeDrawingBrush.shadow=new en.fabric.Shadow(r)}},h=function(){if(a){a.canvas.isDrawingMode=!0,a.canvas.freeDrawingCursor='url("data:image/svg+xml;charset=utf-8,'.concat(encodeURIComponent(''),'") 4 12, crosshair');var e=new en.fabric.PencilBrush(a.canvas);a.canvas.freeDrawingBrush=e;var t=tx[0].options,n=t.color,r=t.width;e.color=n,e.width=r,e.shadow=new en.fabric.Shadow({blur:0,offsetX:0,offsetY:0,affectStroke:!0,color:"#000000"}),c({color:n,width:r,shadow:{color:"#000000",width:0,offset:0}})}return function(){(null==a?void 0:a.canvas)&&(a.canvas.isDrawingMode=!1)}};return(0,x.useEffect)(function(){return h()},[]),(0,y.BX)("div",{className:"fabritor-panel-wrapper",children:[(0,y.tZ)(V.Z,{wrap:"wrap",justify:"space-around",children:tx.map(function(e,r){return(0,y.tZ)(D.Z,{trigger:"hover",title:e.title,children:(0,y.tZ)("div",{className:"fabritor-panel-shape-item",onClick:function(){u(e.options),n(r),c((0,T._)({},s,e.options))},style:{padding:"4px 8px",backgroundColor:t===r?"#eeeeee":"rgba(0,0,0,0)",borderRadius:8},children:(0,y.tZ)("img",{src:"data:image/svg+xml,".concat(encodeURIComponent(e.svg)),alt:"",style:{width:56,height:56}})},e.key)})})}),(0,y.tZ)(tR,{onChange:u,value:s,showPenTip:!0}),(0,y.tZ)(eW,{children:"\u64CD\u4F5C"}),(0,y.tZ)(V.Z,{wrap:"wrap",justify:"space-around",children:(0,y.tZ)($.ZP,{style:{width:64},onClick:function(){a.canvas.isDrawingMode=!a.canvas.isDrawingMode,o(!i)},type:i?"default":"primary",title:"\u505C\u6B62\u7ED8\u56FE",children:(0,y.tZ)("img",{src:"data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(L)),style:{width:22,height:22}})})})]})}var tX=n(8202),tM=n(8538),tH=n(4916),tE=n(3453),tI=en.fabric.controlsUtils,tT=function(){var e=en.fabric.Object.prototype.controls;if(en.fabric.Rect){var t=en.fabric.Rect.prototype.controls={};t.tr=e.tr,t.br=e.br,t.tl=e.tl,t.bl=e.bl,t.mt=e.mt,t.mb=e.mb,t.mtr=e.mtr,t.copy=e.copy,t.del=e.del,t.ml=new en.fabric.Control({x:-.5,y:0,actionHandler:tI.changeWidth,cursorStyleHandler:e.ml.cursorStyleHandler,actionName:"resizing",render:e.ml.render}),t.mr=new en.fabric.Control({x:.5,y:0,actionHandler:tI.changeWidth,cursorStyleHandler:e.mr.cursorStyleHandler,actionName:"resizing",render:e.mr.render}),t.mt=new en.fabric.Control({x:0,y:-.5,offsetY:-1,actionHandler:nu,cursorStyleHandler:e.mt.cursorStyleHandler,actionName:"resizing",render:e.mt.render}),t.mb=new en.fabric.Control({x:0,y:.5,offsetY:1,actionHandler:nu,cursorStyleHandler:e.mb.cursorStyleHandler,actionName:"resizing",render:e.mb.render})}},tW=function(e,t,n,r){return t.target.set({x2:n,y2:r}),!0},tJ=function(e,t,n,r){return t.target.set({x1:n,y1:r}),!0},tV=function(e,t){return function(n,r,i){if(null==i||!i.canvas)return new en.fabric.Point(0,0);var o=i.calcLinePoints(),a=new en.fabric.Point(o[e],o[t]);return en.fabric.util.transformPoint(a,en.fabric.util.multiplyTransformMatrices(i.canvas.viewportTransform,i.calcTransformMatrix()))}},tU=function(){var e=en.fabric.Object.prototype.controls;if(en.fabric.Line){var t=en.fabric.Line.prototype.controls={};t.copy=e.copy,t.del=e.del,t.l1=new en.fabric.Control({positionHandler:tV("x1","y1"),actionHandler:tJ,cursorStyleHandler:function(){return"crosshair"},actionName:"line-points-change",render:e.br.render}),t.l2=new en.fabric.Control({positionHandler:tV("x2","y2"),actionHandler:tW,cursorStyleHandler:function(){return"crosshair"},actionName:"line-points-change",render:e.br.render})}},tN=en.fabric.controlsUtils,tD=function(){var e=en.fabric.Object.prototype.controls;if(en.fabric.Rect){var t=en.fabric.FText.prototype.controls={};t.tr=e.tr,t.br=e.br,t.tl=e.tl,t.bl=e.bl,t.mtr=e.mtr,t.copy=e.copy,t.del=e.del,t.ml=new en.fabric.Control({x:-.5,y:0,offsetX:-1,actionHandler:tN.changeWidth,cursorStyleHandler:e.ml.cursorStyleHandler,actionName:"resizing",render:e.ml.render}),t.mr=new en.fabric.Control({x:.5,y:0,offsetX:1,actionHandler:tN.changeWidth,cursorStyleHandler:e.mr.cursorStyleHandler,actionName:"resizing",render:e.mr.render})}},tY=document.createElement("img");tY.src=j;var tq=document.createElement("img");tq.src=O;var tG=document.createElement("img");tG.src=z;var tK=document.createElement("img");tK.src=B;var tQ=document.createElement("img");tQ.src=P;var t$=document.createElement("img");t$.src=R;var t0=function(e,t,n,r,i,o){var a="TB"===o?20:6,l="TB"===o?6:20;e.save(),e.fillStyle="#ffffff",e.strokeStyle="#bbbbbb",e.lineWidth=2,e.shadowBlur=2,e.shadowColor="#dddddd",e.translate(t,n),e.rotate(en.fabric.util.degreesToRadians(i.angle)),e.beginPath(),e.roundRect(-a/2,-l/2,a,l,10),e.stroke(),e.fill(),e.restore()},t1=function(e,t,n,r,i){t0(e,t,n,r,i,"LR")},t2=function(e,t,n,r,i){t0(e,t,n,r,i,"TB")},t3=function(e,t,n,r,i){e.save(),e.fillStyle="#ffffff",e.strokeStyle="#bbbbbb",e.lineWidth=2,e.shadowBlur=2,e.shadowColor="#dddddd",e.beginPath(),e.arc(t,n,6,0,2*Math.PI,!1),e.stroke(),e.fill(),e.restore()};function t4(e){return function(t,n,r,i,o){t.save(),t.translate(n,r),t.rotate(en.fabric.util.degreesToRadians(o.angle)),t.drawImage(e,-14,-14,28,28),t.restore()}}var t6=(p=(0,w._)(function(e,t){var n,r;return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return[4,nr(r=(n=t.target).canvas,n)];case 1:return e.sent(),ni(r),[2,!0]}})}),function(e,t){return p.apply(this,arguments)}),t8=function(e,t){var n=t.target,r=n.canvas;return no(n,r),!0},t5=function(){var e={x:0,y:-.5,offsetY:-1,render:t2};Object.keys(e).forEach(function(t){en.fabric.Object.prototype.controls.mt[t]=e[t]});var t={x:0,y:.5,offsetY:1,render:t2};Object.keys(t).forEach(function(e){en.fabric.Object.prototype.controls.mb[e]=t[e]});var n={x:-.5,y:0,offsetX:-1,render:t1};Object.keys(n).forEach(function(e){en.fabric.Object.prototype.controls.ml[e]=n[e]});var r={x:.5,y:0,offsetX:1,render:t1};Object.keys(r).forEach(function(e){en.fabric.Object.prototype.controls.mr[e]=r[e]});var i={x:-.5,y:-.5,render:t3};Object.keys(i).forEach(function(e){en.fabric.Object.prototype.controls.tl[e]=i[e]});var o={x:.5,y:-.5,render:t3};Object.keys(o).forEach(function(e){en.fabric.Object.prototype.controls.tr[e]=o[e]});var a={x:-.5,y:.5,render:t3};Object.keys(a).forEach(function(e){en.fabric.Object.prototype.controls.bl[e]=a[e]});var l={x:.5,y:.5,render:t3};Object.keys(l).forEach(function(e){en.fabric.Object.prototype.controls.br[e]=l[e]})},t7=function(){var e={x:0,y:.5,offsetY:38,cursorStyleHandler:function(){return'url("data:image/svg+xml;charset=utf-8,'.concat(F,'") 12 12, crosshair')},render:t4(tY),withConnection:!1};Object.keys(e).forEach(function(t){en.fabric.Object.prototype.controls.mtr[t]=e[t]})},t9=function(){var e=new en.fabric.Control({x:0,y:-.5,offsetX:-24,offsetY:-26,cursorStyle:"pointer",mouseUpHandler:t6,render:t4(tG)});en.fabric.Object.prototype.controls.copy=e;var t=new en.fabric.Control({x:0,y:-.5,offsetX:24,offsetY:-26,cursorStyle:"pointer",mouseUpHandler:t8,render:t4(tQ)});en.fabric.Object.prototype.controls.del=t},ne=function(e,t){"mtr"===e&&(t.controls[e].render=t4(tq)),"copy"===e&&(t.controls[e].render=t4(tK)),"del"===e&&(t.controls[e].render=t4(t$)),t.canvas.requestRenderAll()},nt=function(e){var t,n,r;e&&((null===(t=e.controls)||void 0===t?void 0:t.mtr)&&(e.controls.mtr.render=t4(tY)),(null===(n=e.controls)||void 0===n?void 0:n.copy)&&(e.controls.copy.render=t4(tG)),(null===(r=e.controls)||void 0===r?void 0:r.del)&&(e.controls.del.render=t4(tQ)))},nn=en.fabric.controlsUtils,nr=(v=(0,w._)(function(e,t){return(0,Z.Jh)(this,function(n){return[2,new Promise(function(n){return(t||(t=e.getActiveObject()),t)?(navigator.clipboard.writeText(""),t.clone(function(e){return b=e,n(!0)},eh)):Promise.resolve(!1)})]})}),function(e,t){return v.apply(this,arguments)}),ni=(g=(0,w._)(function(e){var t,n,r;return(0,Z.Jh)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,ew()];case 1:if(n=(t=i.sent()||{}).type,r=t.result)return"text"===n?eq({text:r,canvas:e}):"image"===n&&e0({imageSource:r,canvas:e}),[2];return[3,3];case 2:return console.error("Failed to read clipboard contents: ",i.sent()),[3,3];case 3:return b.clone(function(t){e.discardActiveObject(),t.set({left:t.left+50,top:t.top+50,evented:!0}),("f-line"===t.type||"f-arrow"===t.type||"f-tri-arrow"===t.type)&&nh({target:t,transform:{original:{left:t.left-50,top:t.top-50}}}),"activeSelection"===t.type?(t.canvas=e,t.forEachObject(function(t){e.add(t)}),t.setCoords()):e.add(t),e.setActiveObject(t),e.requestRenderAll(),e.fire("fabritor:clone",{target:t})},eh),[2]}})}),function(e){return g.apply(this,arguments)}),no=function(e,t){if(e||(e=t.getActiveObject()),e)return"activeSelection"===e.type?(e.getObjects().forEach(function(e){t.remove(e)}),t.discardActiveObject()):t.remove(e),nt(e),t.requestRenderAll(),t.fire("fabritor:del",{target:null}),!0},na=function(e,t){t||(t=e.getActiveObject()),t&&"activeSelection"===t.type&&(t.toGroup(),e.requestRenderAll(),e.fire("fabritor:group"))},nl=function(e,t){t||(t=e.getActiveObject()),t&&"group"===t.type&&(t.getObjects().forEach(function(e){e.set({lockMovementX:!1,lockMovementY:!1,hasControls:!0,selectable:!0})}),t.toActiveSelection(),e.requestRenderAll(),e.fire("fabritor:ungroup"))},ns=function(e,t,n){if(n||(n=t.canvas.getActiveObject()),n&&"activeSelection"!==n.type){switch(e){case"layer-up":n.bringForward();break;case"layer-top":n.bringToFront();break;case"layer-down":n.sendBackwards();break;case"layer-bottom":n.sendToBack()}t.sketch.sendToBack(),t.canvas.requestRenderAll(),t.fireCustomModifiedEvent()}},nc=function(e,t,n,r,i){var o=e.target,a=o.controls[e.corner],l=o.canvas.getZoom(),s=o.padding/l,c=o.toLocalPoint(new en.fabric.Point(r,i),t,n);return c.x>=s&&(c.x-=s),c.x<=-s&&(c.x+=s),c.y>=s&&(c.y-=s),c.y<=s&&(c.y+=s),c.x-=a.offsetX,c.y-=a.offsetY,c},nu=nn.wrapWithFireEvent("resizing",nn.wrapWithFixedAnchor(function(e,t,n,r){var i=t.target,o=nc(t,t.originX,t.originY,n,r),a=i.strokeWidth/(i.strokeUniform?i.scaleX:1),l="center"===t.originX&&"center"===t.originY?2:1,s=i.height,c=Math.abs(o.y*l/i.scaleY)-a;return i.set("height",Math.max(c,0)),s!==c})),nh=function(e){var t=e.target,n=e.transform;if("line-points-change"!==e.action){var r=n.original,i=t.left-r.left,o=t.top-r.top;t.set({x1:t.x1+i,y1:t.y1+o,x2:t.x2+i,y2:t.y2+o})}},nf=function(e){var t=e.label,n=e.keyboard,r=e.cmdKey,i=navigator.userAgent.indexOf("Mac OS X")>-1;return(0,y.BX)(V.Z,{gap:68,justify:"space-between",children:[(0,y.tZ)("span",{children:t}),(0,y.tZ)("span",{children:"".concat(void 0!==r&&r?i?"\u2318":"Ctrl":""," ").concat(n)})]})},nd=(0,x.forwardRef)(function(e,t){var n,r=e.object,i=e.noCareOpen,o=(0,k._)((0,x.useState)(!1),2),a=o[0],l=o[1],s=(0,x.useContext)(_).editor,c=(n=(0,w._)(function(e){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:switch(t=e.key){case"copy":return[3,1];case"paste":return[3,3];case"copy&paste":return[3,4];case"del":return[3,7];case"group":return[3,8];case"ungroup":return[3,9];case"layer-up":case"layer-top":case"layer-down":case"layer-bottom":return[3,10]}return[3,11];case 1:case 4:return[4,nr(s.canvas,r)];case 2:case 6:return n.sent(),[3,12];case 3:return ni(s.canvas),[3,12];case 5:return n.sent(),[4,ni(s.canvas)];case 7:return no(r,s.canvas),[3,12];case 8:return na(s.canvas,r),[3,12];case 9:return nl(s.canvas,r),[3,12];case 10:ns(t,s,r),n.label=11;case 11:return[3,12];case 12:return l(!1),[2]}})}),function(e){return n.apply(this,arguments)});return(0,x.useImperativeHandle)(t,function(){return{show:function(){return l(!0)},hide:function(){return l(!1)}}}),(0,y.tZ)(ee.Z,{menu:{items:function(){if(!r||r.id===eu)return[{label:(0,y.tZ)(nf,{label:"\u7C98\u8D34",keyboard:"V",cmdKey:!0}),key:"paste"}];var e=[{label:(0,y.tZ)(nf,{label:"\u590D\u5236",keyboard:"C",cmdKey:!0}),key:"copy"},{label:(0,y.tZ)(nf,{label:"\u7C98\u8D34",keyboard:"V",cmdKey:!0}),key:"paste"},{label:"\u521B\u5EFA\u526F\u672C",key:"copy&paste"},{label:(0,y.tZ)(nf,{label:"\u5220\u9664",keyboard:"DEL"}),key:"del"}];return"activeSelection"===r.type&&(e.push({type:"divider"}),e.push({label:"\u5EFA\u7EC4",key:"group"})),"group"!==r.type||r.sub_type||(e.push({type:"divider"}),e.push({label:"\u53D6\u6D88\u5EFA\u7EC4",key:"ungroup"})),"activeSelection"!==r.type&&(e.push({type:"divider"}),e.push({label:"\u56FE\u5C42",key:"layer",children:[{label:"\u4E0A\u79FB",key:"layer-up"},{label:"\u7F6E\u9876",key:"layer-top"},{label:"\u4E0B\u79FB",key:"layer-down"},{label:"\u7F6E\u5E95",key:"layer-bottom"}]})),e}(),onClick:c},trigger:["contextMenu"],open:i?void 0:a,children:e.children})}),np=JSON.parse('{"version":"5.3.0","objects":[{"type":"rect","version":"5.3.0","originX":"left","originY":"top","left":0,"top":0,"width":1242,"height":1660,"fill":"#ffffff","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"id":"fabritor-sketch","fabritor_desc":"\u6211\u7684\u753B\u677F by fabritor","selectable":false,"hasControls":false},{"type":"f-image","version":"5.3.0","originX":"left","originY":"top","left":-14.18,"top":-50.11,"width":854,"height":1281,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":0,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1.49,"scaleY":1.49,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"id":"838bb981-f378-43d8-af4d-d2e283d6d767","selectable":true,"hasControls":true,"imageBorder":{},"objects":[{"type":"image","version":"5.3.0","originX":"center","originY":"center","left":0,"top":0,"width":853,"height":1280,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":0,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"clipPath":{"type":"rect","version":"5.3.0","originX":"center","originY":"center","left":0,"top":0,"width":853,"height":1280,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"selectable":true,"hasControls":true,"inverted":false,"absolutePositioned":false},"cropX":0,"cropY":0,"selectable":true,"hasControls":true,"src":"https://cdn.pixabay.com/photo/2024/01/04/15/42/sailing-8487722_1280.png","crossOrigin":"anonymous","filters":[]},{"type":"rect","version":"5.3.0","originX":"center","originY":"center","left":0,"top":0,"width":853,"height":1280,"fill":"#00000000","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"fill","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"selectable":true,"hasControls":true}]},{"type":"f-text","version":"5.3.0","originX":"left","originY":"top","left":371,"top":188.86,"width":500,"height":135.6,"fill":{"type":"linear","coords":{"x1":0,"y1":0,"x2":500,"y2":0},"colorStops":[{"color":"#e45f2b","offset":0},{"color":"#9dbdba","offset":0.47},{"color":"#7d8bae","offset":1}],"offsetX":0,"offsetY":0,"gradientUnits":"pixels","gradientTransform":null},"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"fontFamily":"SmileySans","fontWeight":"bold","fontSize":120,"text":"fabritor","underline":false,"overline":false,"linethrough":false,"textAlign":"center","fontStyle":"normal","lineHeight":1.3,"textBackgroundColor":"","charSpacing":59,"styles":[],"direction":"ltr","path":null,"pathStartOffset":0,"pathSide":"left","pathAlign":"center","minWidth":20,"splitByGrapheme":true,"id":"ad9d6314-5b03-4886-a101-eb0df5f64153","selectable":true,"hasControls":true},{"type":"f-text","version":"5.3.0","originX":"left","originY":"top","left":250.24,"top":424.33,"width":741.52,"height":207.92,"fill":"#45496a","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"fontFamily":"SourceHanSerif","fontWeight":"normal","fontSize":80,"text":"\u5FEB\u901F\u6784\u5EFA\u5C5E\u4E8E\u81EA\u5DF1\u7684\\n\u56FE\u7247\u7F16\u8F91\u5668","underline":false,"overline":false,"linethrough":false,"textAlign":"center","fontStyle":"normal","lineHeight":1.3,"textBackgroundColor":"","charSpacing":0,"styles":[],"direction":"ltr","path":null,"pathStartOffset":0,"pathSide":"left","pathAlign":"center","minWidth":20,"splitByGrapheme":true,"id":"1a6b8d18-1037-486f-be5f-693bd50f8d60","selectable":true,"hasControls":true}],"clipPath":{"type":"rect","version":"5.3.0","originX":"left","originY":"top","left":0,"top":0,"width":1242,"height":1660,"fill":"#ffffff","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"selectable":true,"hasControls":true},"background":"#ddd","fabritor_schema_version":3}');function nv(){var e,t=(0,x.useContext)(_),n=t.isReady,r=t.setReady,i=t.object,o=t.setActiveObject,a=t.editor,l=(0,k._)((0,x.useState)([]),2),s=l[0],c=l[1],u=function(e){var t=[],n=e.length;if(!n){c([]);return}for(var r=null==a?void 0:a.canvas.getActiveObject(),i=n-1;i>=0;i--){var o=e[i];o&&o.id!==eu&&(r===o?o.__cover=o.toDataURL():o.__cover||(o.__cover=o.toDataURL()),t.push({cover:o.__cover,group:"group"===o.type,object:o}))}c(t)},h=(e=(0,w._)(function(){return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return r(!1),[4,a.loadFromJSON(np,!0)];case 1:return e.sent(),a.fhistory.reset(),r(!0),o(null),a.fireCustomModifiedEvent(),[2]}})}),function(){return e.apply(this,arguments)}),f=function(e){a.canvas.discardActiveObject(),a.canvas.setActiveObject(e.object),a.canvas.requestRenderAll()};return(0,x.useEffect)(function(){var e,t=function(){u(e.getObjects())};return n&&(c([]),e=null==a?void 0:a.canvas,t(),e.on({"object:added":t,"object:removed":t,"object:modified":t,"object:skewing":t,"fabritor:object:modified":t})),function(){e&&e.off({"object:added":t,"object:removed":t,"object:modified":t,"object:skewing":t,"fabritor:object:modified":t})}},[n]),(0,y.tZ)("div",{className:"fabritor-panel-wrapper",children:s.length?(0,y.tZ)(tX.Z,{dataSource:s,renderItem:function(e){return(0,y.tZ)(nd,{object:e.object,noCareOpen:!0,children:(0,y.tZ)(tX.Z.Item,{className:"fabritor-list-item",style:{border:i===e.object?" 2px solid #ff2222":"2px solid transparent",padding:"10px 16px"},onClick:function(){f(e)},children:(0,y.BX)(V.Z,{justify:"space-between",align:"center",style:{width:"100%",height:40},children:[(0,y.tZ)("img",{src:e.cover,style:{maxWidth:200,maxHeight:34}}),e.group?(0,y.tZ)(tH.Z,{style:{fontSize:18,color:"rgba(17, 23, 29, 0.6)"}}):null]})})})}}):(0,y.tZ)(tM.Z,{image:null,description:(0,y.BX)("div",{children:[(0,y.tZ)(tE.Z,{twoToneColor:"#eb2f96",style:{fontSize:40}}),(0,y.tZ)("p",{style:{color:"#aaa",fontSize:16},children:"\u5F00\u59CB\u6325\u6D12\u4F60\u7684\u521B\u610F ~"}),(0,y.tZ)(q.Z,{}),(0,y.tZ)($.ZP,{onClick:h,children:"\u6216\u8005\u4ECE\u4E00\u4E2A\u7B80\u5355\u7684 DEMO \u5F00\u59CB"})]})})})}var ng=n(5517),nb=n(2973),ny=n(7664),nm=n(6411),nw=n(6156);function nk(e){var t=e.title,n=e.children,r=e.back;return(0,y.tZ)(eT.Z,{bordered:!1,style:{marginLeft:-24,boxShadow:"none"},bodyStyle:{padding:12},title:(0,y.BX)(V.Z,{justify:"space-between",children:[(0,y.tZ)(nw.Z,{onClick:function(){r&&r()}}),(0,y.tZ)("p",{children:t})]}),children:n})}var nZ=tC.Z.Item;function nx(e){var t=e.back,n=(0,k._)(tC.Z.useForm(),1)[0],r=(0,k._)(tC.Z.useForm(),1)[0],i=(0,k._)((0,x.useState)({value:"fabritor"}),2),o=i[0],a=i[1],l=(0,x.useRef)(null),s=(0,x.useContext)(_).editor,c=function(e){a((0,T._)({},o,e))};return(0,x.useEffect)(function(){n.setFieldsValue({value:"fabritor",size:160}),r.setFieldsValue({color:"#000000",bgColor:"#00000000",iconSize:40,errorLevel:"M"})},[]),(0,y.BX)(nk,{title:"\u4E8C\u7EF4\u7801",back:t,children:[(0,y.BX)(tC.Z,{form:n,onValuesChange:c,children:[(0,y.tZ)(nZ,{name:"value",label:"\u6587\u672C",children:(0,y.tZ)(e4.Z,{})}),(0,y.tZ)(nZ,{name:"size",label:"\u5927\u5C0F",children:(0,y.tZ)(tz.Z,{})})]}),(0,y.tZ)(ny.Z,{items:[{key:"1",label:"\u5176\u4ED6\u8BBE\u7F6E",children:(0,y.BX)(tC.Z,{form:r,onValuesChange:c,children:[(0,y.tZ)(nZ,{name:"color",label:"\u989C\u8272",children:(0,y.tZ)(t_,{})}),(0,y.tZ)(nZ,{name:"bgColor",label:"\u80CC\u666F\u8272",children:(0,y.tZ)(t_,{})}),(0,y.tZ)(nZ,{name:"errorLevel",label:"\u7EA0\u9519\u7B49\u7EA7",children:(0,y.tZ)(e5.ZP.Group,{options:["L","M","Q","H"]})}),(0,y.tZ)(nZ,{name:"icon",label:"\u5185\u7F6E\u56FE\u7247",children:(0,y.tZ)(e4.Z,{placeholder:"\u4EC5\u652F\u6301\u56FE\u7247\u94FE\u63A5"})}),(0,y.tZ)(nZ,{name:"iconSize",label:"\u5185\u7F6E\u56FE\u7247\u5927\u5C0F",children:(0,y.tZ)(tz.Z,{})})]})}]}),o.value?(0,y.BX)(V.Z,{vertical:!0,align:"center",gap:10,style:{marginTop:16},ref:l,children:[(0,y.tZ)(nm.Z,(0,W._)((0,T._)({type:"canvas"},o),{style:{maxWidth:200}})),(0,y.tZ)($.ZP,{type:"primary",onClick:function(){if(o.value&&l.current){var e=l.current.querySelector("canvas");if(e){var t=new Image;t.onload=function(){e$({imageSource:t,canvas:s.canvas})},t.src=e.toDataURL()}}},children:"\u6DFB\u52A0\u81F3\u753B\u5E03"})]}):null]})}var nC=n(6638),nS=n(4168);function nA(e){var t,n=e.back,r=(0,x.useContext)(_).editor,i=(t=(0,w._)(function(e){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:if(!((t=r.canvas.getActiveObject())&&"textbox"===t.type))return[3,1];return t.set("text","".concat(t.text).concat(e.native)),r.canvas.requestRenderAll(),[3,3];case 1:return[4,eq({text:e.native,fontSize:80,width:100,canvas:r.canvas})];case 2:n.sent(),n.label=3;case 3:return[2]}})}),function(e){return t.apply(this,arguments)});return(0,y.tZ)(nk,{title:"Emoji",back:n,children:(0,y.tZ)(nS.Z,{data:nC,perLine:8,set:"native",locale:"zh",onEmojiSelect:i})})}var n_=[{title:"\u4E8C\u7EF4\u7801",key:"qrcode",icon:(0,y.tZ)(ng.Z,{style:{fontSize:30}})},{title:"Emoji",key:"emoji",icon:(0,y.tZ)(nb.Z,{style:{fontSize:30}})},{title:"GPT-4o",key:"GPT-4o",icon:(0,y.tZ)("div",{style:{textAlign:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://foruda.gitee.com/images/1718331500132737240/898d9303_1411078.png"})}),link:"https://gpt4o.so/zh-CN"},{title:"\u672A\u9053\u5E2E AI \u62A0\u56FE",key:"aiwave",icon:(0,y.tZ)("div",{style:{textAlign:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://cutout.aiwave.cc/images/logo.svg"})}),link:"https://cutout.aiwave.cc/"},{title:"bgsub AI \u62A0\u56FE",key:"bgsub",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"100px"},src:"https://bgsub.cn/logo.webp"})}),link:"https://bgsub.cn/"},{title:"ImageToolsAI\u62A0\u56FE",key:"ImageTools",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAJzElEQVR4nO3af5Cd5VUH8M9zs1l21pDZu7C3mTTD0IhKw48GSjMtIlhFRaGltJRMp2obK2Uk1oA4o5hJ7r1maJpGpLUTO1hppzKY0hptAZFYkLT8cJqJmZjSNKJlmIhpfJPuXWImLpvNffzjvGkYJWHvJnvXGffMvLN3d9/7POec55zv+T7neZiRGZmRGZmRGZmRGZkmGWoMq60anrb5K9M2cykpp19WSZ+dtvmna2Ko1VvzsQhX4R4cLprV0W7qMG0RUKu35uLX8UH8ODaQ5nRbj+lLgeRcXIDv4kA8+eruqzENUqu3FmIJ+vALmItv4CVsf+WVtPvlTwx0RZeersxyTBpZLY/8pjD8JayRvFU2in9CHVefcUZ+Nz7ZDZW6mgK13OrFmzKfRxv7ZOdhfvn7AXwVZw2tHunvhk5dxoDUg0MpjF2JUezFIHbhHsk4fpBS7ooDupICtXrrSjRxJwbaZh2sOLpSpMFGkRIr0Sc7G0M4p1ZvfQXri2b10anSbcojoNZo9eALOAdnY+6B5tw2LsQmPIjlwkHvwm6xMAvK54u1eqtvqvSbkipQKnwb3ojP4jNJujbLt2EYj+IynIezxEK8jBewHYvxtiSvytLDuN3xlFlZNKt7T5euk3JASWJ6BXM7XKu3Lsav4AcC4Jbg4fLzoHDCp7EQO4QTnivfHyuH7cWZOF9Ey8UCH+7A+/CPWIcVAihvKcd+Uk5/JeWeRF+mv2hWiylxQK3euhHvlKyR3Y4aPoMPiBAeKBX+nsjvp/E1fEUwvofxgqSQHUKROJiTtmxOOd5A+ZyDG/BN/Dw+VP797SKy1iaGMx8WkXHRq+atYV7RrH7i9WzqFAR34x2yFeV3F4uV/wf8FraVYXtM4TWC5m7HOkmRc352f2Nw/DXGPoAXofp7L5t9RvtSPC8i4TyBFTvwQE7jf5hyz+U55tgkMKSC72MpRvDURAzqyAGZXYmvi5zcI0J0M+7DPhzK0rWpnW/Ps9I22YM/fDflx4vG4OjQ6pHeodUjJwe1dHSsaA5uf0OjtSNnB4VjVmBD0aw+W6u3bi3nvwbvLv/3FryzHGGz5JGJ2NRRFUiRMIeFdxfjjqJZfayc+E7sxI25khaUxt+LncWugUeKxuBojJEXp5SvSyl/NKX8vZTyv5fPt1LKN6WUr0tBjf1Ho9oumtUtIoLW49O1eutCsfL9gka/ddbR/GWBMX2lY9o5T8y2jkGw1mj1yS4TZWw5tohQfwKFALwP4EnsKJrVp084VtT5G8tfVxTN6h+f5N3zcalY7aaoCgtI15NvwXvxl9go2VU0qhPqsnTMA4pGdVSs9NuwTDjiauH5dWIVDmDPrHY6ofGlHD7B5/89b7O6WwDcX+Nn8YvxnTxXAONVAgOGJ2o8kydC8wTwnSuQ+V/Ln4P4GJ6QPP79Nad3R5elpwVlPhaB83BQYNEVeFZUjwnLZB2wF+8gPVqkgUsEw9skVv+bKIpG9aQrOhnZ3xxoC2dvwvtxM64jL038hUi97Z2MOSkHFM3qIdxFXlfLI7diS5b/SJSgb2dp6ySGbU/opf8a3yWqwuV4BJ8ifTRHmb2rExLEKewFimb1BawS+f5gkhYK9N63vzlw2lf/mBz45BAcEqlwpeAHe7GhaFRf7HS8U90MfU0wv3tEWO4wwZU8RSnwL/gc7hdUeULE53/KqTrgkGBrBwVjOyB4/lTLXlE1Foioe17JIjuVU3XAcrHit+DPcEQ4Y2ol9hGjeEjsC/oF/nQsp+SAlIw4vhrd6+cfp289ovTOE221juWUHJCz9SL078etmK2ksVMraY4oub8kmqnfwoNDjeGO7TnVltg5ggwd6+3VJIOTHKsD8MzzRdjvEATsTehzNFU6G+fUMWCZ2O2tF8RksdyFPmPK8/Bjju8Cv4uL9q+pvtY2+6QyaQfUGq1B/AZ+CstSbm8V+/B5b6i3pvaIK6d+LErJVtmHRPStqtVbV3Q61KQcMFRv9Yj8vzdnq/CenCq/LTq8F+Tg6lMitXprkWitPZuzmyQfzjk9pO1juLb8/4RlUg5Igbrfxvkp2Sx2h8sEB7gStVq9ddr7+kP1VkV0h27A3+BubEkpP6Xid0Tr7eJOxpxcCiTDeLNkj2BlS0RHd69oTPwcrj67MTKp4U88rSvELnCboMKHBRjWxE7wBkGKJiwdO6BWH+mTXYp/lj0hUPirIizvKxUawLkV+crXGa7/BJ9fY97WIlF1rhfN1XsF4ldEY3ZD+bm/Vh+ZcCXqqCM0VB+pJPka0Zm5Hh+pJDvb+Ydd3H48IBoWGwVXf348tZ8ebpx1zJAlwlnz8buOG/6iCOlR8mNFc3AELmhk+/PIIhHad4hU+9yxsTGa2V620TaK7fJmOf1d8QcDx1ruJ5SOSlZKmewwflLU4LXtbKXIx1HlIUgl5T1t6f2yTbi/J1cGa43WY0WjOvbKK2mbCGH41GvNc2Sstw1nrx6u7M8jPy2cdTuWF83qc7V6a4town4BlRTRUBVnDAswT8o9jp85nNimThxQrt5HBNhVRL/+IXHA0YORI2OVz8/ubV8mmhWLBD78qeQp2V4pbS0aJ1+ZoUarkrLFknNli0SkHBBg+4Q4cJkveMB9ohU3JvqQFwnnPFk2bE+rA96LS4THbxZhv0GQoDWJdo7zgTPxjACqjWLb/D48hu9Ihss7AS85vnucWxo1F3ME2l+Pv8fPiPOH8wTgXSXy/nn8muAfl+DfxInThZhTNKsfP60OeJUjgu+nPF40Bg/X6q23i3bUGL5YGvGMCPGFYoU2iDx+TlSO7fhPjAsw68GPiKhZUBp7GHcJtndQnDd+PLEu86v4UWyePTbr8bEzjvaknPtJ/UWzum+itkzR4ehwH+nYqdDd4sxgqdi8vEWUyiXCyCGRTi1RSreJHuOKLC9L0gOiDf7Bcvi7i2b1wOnSdcrvCNVWjVDJ3xCRcCfeNXts1tIjvUd/Xxi1VoTwemzVtkzFbSI9VonN1k+czhPhV8uU3w8oojW+XOBBgZHx3vEBQZpuLp/15Tv3qRgQabFXgNnyqTKeLt8SG1o9UkkprxWnOl9HTbZU0i8ccQ2uFSD2XNGs7pxqnbp6RygdndUWjYyKaKLsllws0PwmAaS9AukPdUOnrjqguOtMonu7SuT9pdiZUj4kAHCJqBRvzKnyQjd0mq6LkvOUu0ZR0/vwt4IT7K6M9ezYt/bMrugybZely2s1d+I7gsb24pmiWf1SN/Xo7k3RV0tKL8p5j+jnzRGk53Wp6+mWaXPAkaPtgz2Vyj1JvhwLM39uvAtnCv/XpFZv3Vqrt9ZN1/zTlwKlDKWBPzlo/3SrMSMzMiP/T+W/AW9jL67Slt52AAAAAElFTkSuQmCC"})}),link:"https://ai-image.tools/home"},{title:"PDF \u8F6C\u6362\u5668",key:"pdf2docx",icon:(0,y.tZ)("div",{style:{textAlign:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://www.pdf2docx.cn/assets/static/logo.02b6c8c9.svg"})}),link:"https://www.pdf2docx.cn/"},{title:"PDF \u7F16\u8F91\u5668",key:"onlinepdfedit",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://onlinepdfedit.com/images/logo.webp"})}),link:"https://onlinepdfedit.com/zh-cn/"},{title:"\u6587\u6863\u8F6C\u6362\u738B",key:"thunisoft",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAdCAYAAADPa766AAAABHNCSVQICAgIfAhkiAAAA0dJREFUSEvtVk1PE1EUvfdN48rENoE1sFMIWKLEpVNxb/0F0q3BpL9ABvwB1kjcUn+BuBem7CDVOEBYW9eQOC5c2XnX8950mn4xtbQxmvgW7cx7b+6ce+65Zx673reso/UTIcrSBIdW6lXNy4V31k+Kn7aXdoeF5gfPzz1m3hi2cdR1Ednc35r2Vp6d4pIKH7cXa3fXT11m2SHiWSJpiHDJzJvYfwYISUjCFWby+hKK1HL9zULwR4CksymN+uulub8AiIEppYFAUNRjVA3ilZBNPZluDMxK6Lug1tDY7d71To30rREdcKTKFoKjKyyI0StWBDjQKlNUEn1WLCWtW3VVXGWhHQjvqxFaHJyD/a2pMmJYwdkZ4rwBng4ECUZOwWjDPLOyflLtAtIGoZsGrQtAa/gPHYpcEkFncd68APNVjmimL1OHjpVu7oKh+2lA7HNCwc/M9UJQmQvz5S/ZLiAROzlsmUWwogmG+5KjowoyfIQH38JrXFz7ceZkQHYP4TKxxnwMOGnfvn3JBMDUtxeXbbzu0kgA6t/bBXgLer4g0IpoyYOFCgDWrB7wQi3K0uq/yB089M7dKMqIYo2ySMUmnAB5epYXpS81yzQfqcWBaA6/VStUUSFAuaZcsZApTJJC1m6nRoxZwS9mEiC3Dv0y7geLvYOqbkaYHrMxH4wmZcx/I0PNfJtJDeqJ/YSNXkYskypaM2VLgCwc+ajo8NHbNZaNFiPHWjlVR6KX7TnoBy+Z7Qy7tznFqxsXfS9LgMwf+rso18DSIBbm49a/1NBMBylFHr4HVpx9A+JlJdUP3nQtDUgaFzfrvuvolvgv++ghRZiZ8Qv4wkAcZp0gWJNt/56EkbGBDK9q+o4rAwEDDXTIJmt0hukKxQ3ScdtZm0c9YecBKw5MO7c+AXncV+xZRsuacVrjOUZHVwZiBUpURTlsKeAfhnZ0DmfjOW7E5TKAkvbtWscewTNxmcYCMm45Op//D6SXzX+XkVXvoghlvpukPmwsfC72vKnU03uXoU0cwAgBxwKSfMTO7hXQyeONiQD5cY1yjeVC+zhwFUgTAQJTC3CGHQsIYpizi3Ftc+Ibbfzu+WK0qFcAMn/ke6O+ZNh+nAbDX1JcOOibyiDiAAAAAElFTkSuQmCC"})}),link:"https://convert.thunisoft.com/"},{title:"WebP to PNG",key:"webptopng",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"100px"},src:"https://webptopng.top/src/toto.svg"})}),link:"https://webptopng.top/"},{title:"\u89C6\u9891\u8F6CGIF",key:"v2gif",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://www.v2gif.fun/logo.svg"})}),link:"https://www.v2gif.fun/"},{title:"\u52A8\u6F2B\u98CE\u56FE\u7247",key:"anime",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://photo-to-anime.com/_next/image?url=%2Fassets%2Fimages%2Fdemos%2Fmountain.png&w=1080&q=75"})}),link:"https://photo-to-anime.com/en"},{title:"\u7C98\u571F\u98CE\u56FE\u7247",key:"facetomanyplay",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://src.facetomanyplay.com/thumbs%2Fclay-after.png"})}),link:"https://facetomanyplay.com/"},{title:"PS \u7F51\u9875\u7248",key:"zaixianps",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://zaixianps.net/images/logo.svg"})}),link:"https://zaixianps.net/"},{title:"\u8C03\u8272\u677F\u6A21\u7248",key:"oohcolor",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("div",{style:{background:"linear-gradient(90deg, red, #0f0, #00f)",backgroundClip:"text",color:"transparent",textAlign:"center"},children:"OochColor"})}),link:"https://oohcolor.com/"},{title:"excalidraw\u6D41\u7A0B\u56FE",key:"excalidraw",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"100px"},src:"https://plus.excalidraw.com/images/logo.svg"})}),link:"https://excalidraw.com/"},{title:"\u56FE\u7247\u6587\u5B57\u63D0\u53D6OCR",key:"baimiaoapp",icon:(0,y.tZ)("div",{style:{textAlign:"center",height:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.tZ)("img",{style:{width:"50px"},src:"https://xlimage.uzero.cn/shinescan/res/shinescanicon.png"})}),link:"https://web.baimiaoapp.com/"}];function nj(){var e=(0,k._)((0,x.useState)(""),2),t=e[0],n=e[1],r=function(e){if(e.link){window.open(e.link);return}n(e.key)},i=function(){n("")};return(0,y.tZ)("div",{children:t?"qrcode"===t?(0,y.tZ)(nx,{back:i}):"emoji"===t?(0,y.tZ)(nA,{back:i}):null:(0,y.tZ)(V.Z,{wrap:"wrap",gap:12,justify:"space-around",style:{padding:"16px 16px 16px 0",marginLeft:-8},children:n_.map(function(e){return(0,y.tZ)(eT.Z,{hoverable:!0,style:{width:140,paddingTop:12},cover:e.icon,bodyStyle:{padding:12},onClick:function(){r(e)},children:(0,y.tZ)(eT.Z.Meta,{description:e.title,style:{textAlign:"center"}})},e.key)})})})}var nO=C.Z.Sider,nF={position:"relative",backgroundColor:"#fff",borderRight:"1px solid #e8e8e8"},nz={fontSize:18,marginRight:0},nB=[{label:"\u56FE\u5C42",value:"design",icon:(0,y.tZ)(eR.Z,{style:nz})},{label:"\u6587\u5B57",value:"text",icon:(0,y.tZ)(eL.Z,{style:nz})},{label:"\u56FE\u7247",value:"image",icon:(0,y.tZ)(eX.Z,{style:nz})},{label:"\u7D20\u6750",value:"shape",icon:(0,y.tZ)(eM.Z,{style:nz})},{label:"\u753B\u7B14",value:"paint",icon:(0,y.tZ)(eH.Z,{style:nz})},{label:"\u5E94\u7528",value:"app",icon:(0,y.tZ)(eE.Z,{style:nz})}];function nP(){var e=(0,x.useContext)(_).editor;return(0,y.BX)(nO,{style:nF,width:406,className:"fabritor-sider",children:[(0,y.tZ)(eB.Z,{tabPosition:"left",style:{flex:1,overflow:"auto"},size:"small",onChange:function(t){(null==e?void 0:e.canvas)&&("paint"===t?e.canvas.isDrawingMode=!0:e.canvas.isDrawingMode=!1)},items:nB.map(function(e){var t;return{label:(0,y.BX)(V.Z,{vertical:!0,justify:"center",children:[(0,y.tZ)("div",{children:e.icon}),(0,y.tZ)("div",{children:e.label})]}),key:e.value,children:"design"===(t=e.value)?(0,y.tZ)(nv,{}):"text"===t?(0,y.tZ)(eG,{}):"image"===t?(0,y.tZ)(ti,{}):"shape"===t?(0,y.tZ)(tZ,{}):"paint"===t?(0,y.tZ)(tL,{}):"app"===t?(0,y.tZ)(nj,{}):null}})}),(0,y.tZ)(eP.Z,{icon:(0,y.tZ)(eI.Z,{}),style:{left:10,bottom:14},href:"https://github.com/wuxianqiang/fabritor",target:"_blank"})]})}var nR=n(1912),nL=function(e){var t=e.prefixText,n=(0,J._)(e,["prefixText"]);return(0,y.tZ)(tz.Z,(0,T._)({prefix:(0,y.tZ)("span",{style:{color:"rgba(0, 0, 0, 0.5)",marginRight:4},children:void 0===t?"\u5BBD":t}),controls:!1,changeOnBlur:!0,min:50,max:8e3,style:{flex:1}},n))};function nX(e){var t=e.value,n=e.onChange,r=(0,k._)((0,x.useState)([]),2),i=r[0],o=r[1],a=function(e,t){var r=(0,nR._)(i);r[t]=e,null==n||n(r)};return(0,x.useEffect)(function(){o(t)},[t]),(0,y.BX)(V.Z,{gap:8,children:[(0,y.tZ)(nL,{value:null==i?void 0:i[0],onChange:function(e){a(e,0)}}),(0,y.tZ)(nL,{prefixText:"\u9AD8",value:null==i?void 0:i[1],onChange:function(e){a(e,1)}})]})}var nM=tC.Z.Item;function nH(){var e=(0,k._)(tC.Z.useForm(),1)[0],t=(0,x.useContext)(_).editor,n=function(e){var n=t.sketch,r=t.canvas,i=ey(e);"string"!=typeof i&&(i=new en.fabric.Gradient(i)),n.set("fill",i),r.requestRenderAll()};return(0,x.useEffect)(function(){if(t){var n=t.sketch;e.setFieldsValue({size:[n.width,n.height],fill:eb(n.fill)})}},[t]),(0,y.BX)(tC.Z,{layout:"vertical",colon:!1,form:e,onValuesChange:function(e){Object.keys(e).forEach(function(r){"size"===r?t.setSketchSize({width:e[r][0],height:e[r][1]}):"fill"===r&&n(e[r])}),t.fireCustomModifiedEvent()},children:[(0,y.tZ)(nM,{label:"\u753B\u5E03\u5C3A\u5BF8",name:"size",children:(0,y.tZ)(nX,{})}),(0,y.tZ)(nM,{label:"\u753B\u5E03\u80CC\u666F\u8272",name:"fill",children:(0,y.tZ)(tO,{type:"sketch"})}),(0,y.tZ)(nM,{label:"\u753B\u5E03\u56FE\u7247",name:"fill",children:(0,y.tZ)("img",{width:160,src:"https://picsum.photos/seed/picsum/200/300",alt:"img"})})]})}var nE=n(6118),nI=n(2638),nT=n(3676),nW=n(3022),nJ=n(5605),nV=[{icon:nI.Z,value:"bold"},{icon:nT.Z,value:"italic"},{icon:nW.Z,value:"underline"},{icon:nJ.Z,value:"linethrough"}];function nU(e){var t=e.value,n=e.onChange,r=function(e){n&&n((0,W._)((0,T._)({},t),{[e]:!t[e]}))};return(0,y.tZ)(e1.Z.Compact,{block:!0,children:nV.map(function(e){return(0,y.tZ)($.ZP,{style:{width:46},icon:(0,y.tZ)(e.icon,{style:{color:(null==t?void 0:t[e.value])?"#1677ff":""}}),onClick:function(){r(e.value)}},e.value)})})}var nN=n(8732),nD=n(6470),nY=n(4180),nq=[{label:(0,y.tZ)(nN.Z,{}),value:"left"},{label:(0,y.tZ)(nD.Z,{}),value:"center"},{label:(0,y.tZ)(nY.Z,{}),value:"right"}];function nG(e){var t=e.value,n=(0,J._)(e,["value"]);return(0,y.tZ)(e5.ZP.Group,(0,W._)((0,T._)({value:t},n),{options:nq,optionType:"button",buttonStyle:"solid"}))}nN.Z,nD.Z,nY.Z;var nK=n(772),nQ=n(2685);function n$(e){var t=e.dataSource,n=e.renderItemChildren,r=(0,J._)(e,["dataSource","renderItemChildren"]);return(0,y.tZ)(tX.Z,(0,T._)({dataSource:t,renderItem:function(e){return(0,y.tZ)(tX.Z.Item,{className:"fabritor-list-item",style:{border:"2px solid transparent",padding:"10px 16px"},onClick:function(){var t;null==e||null===(t=e.onClick)||void 0===t||t.call(e,e)},children:(0,y.tZ)(U,{style:{height:40},children:n(e)})})}},r))}var n0=n(455);function n1(e){var t=e.open,n=e.setOpen,r=e.title,i=e.children,o=(0,J._)(e,["open","setOpen","title","children"]);return(0,x.useEffect)(function(){t?(document.body.style.overflow="hidden",document.body.scrollTop=0):document.body.style.overflow="auto"},[t]),(0,y.tZ)(n0.Z,(0,W._)((0,T._)({title:null,placement:"right",open:t,mask:!1,maskClosable:!1,width:280,rootStyle:{top:50,outline:"none"},contentWrapperStyle:{boxShadow:"none"},bodyStyle:{padding:16},closeIcon:null},o),{children:(0,y.BX)("div",{children:[(0,y.tZ)($.ZP,{type:"link",href:"javascript:void(0);",size:"small",onClick:function(){n(!1)},icon:(0,y.tZ)(nw.Z,{}),style:{marginLeft:-10},children:void 0===r?"":r}),i]})}))}var n2=tC.Z.Item;function n3(e){var t=(0,k._)(tC.Z.useForm(),1)[0],n=e.value,r=e.onChange;return(0,x.useEffect)(function(){n&&t.setFieldsValue(n)},[n]),(0,y.BX)(tC.Z,{form:t,onValuesChange:function(e){r&&r((0,T._)({},n,e))},colon:!1,children:[(0,y.tZ)(n2,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u9634\u5F71"})}),(0,y.tZ)(n2,{label:"\u989C\u8272",name:"color",children:(0,y.tZ)(t_,{})}),(0,y.tZ)(n2,{label:"\u6A21\u7CCA",name:"blur",children:(0,y.tZ)(tF.Z,{min:0,max:20})}),(0,y.tZ)(n2,{label:"\u504F\u79FB",name:"offset",children:(0,y.tZ)(tF.Z,{min:-180,max:180})})]})}var n4=n(6599),n6=n(1957),n8=n(5379),n5=tC.Z.Item;function n7(e){var t=(0,k._)(tC.Z.useForm(),1)[0],n=e.value,r=e.onChange;return(0,x.useEffect)(function(){n&&t.setFieldsValue(n)},[n]),(0,y.BX)(tC.Z,{form:t,onValuesChange:function(e){r&&r((0,T._)({},n,e))},colon:!1,children:[(0,y.BX)(n4.Z,{gutter:16,children:[(0,y.tZ)(n6.Z,{children:(0,y.tZ)(n5,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u6CE2\u6D6A\u578B\u6587\u5B57"})})}),(0,y.tZ)(n6.Z,{children:(0,y.tZ)(n5,{name:"enable",valuePropName:"checked",children:(0,y.tZ)(n8.Z,{})})})]}),(0,y.tZ)(n5,{label:"\u504F\u79FB",name:"offset",children:(0,y.tZ)(tF.Z,{min:-100,max:100})})]})}var n9=tC.Z.Item;function re(e){var t=(0,k._)(tC.Z.useForm(),1)[0],n=e.value,r=e.onChange;return(0,x.useEffect)(function(){n&&t.setFieldsValue(n)},[n]),(0,y.BX)(tC.Z,{form:t,onValuesChange:function(e){r&&r((0,T._)({},n,e))},colon:!1,children:[(0,y.BX)(n4.Z,{gutter:16,children:[(0,y.tZ)(n6.Z,{children:(0,y.tZ)(n9,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u56FE\u7247\u586B\u5145"})})}),(0,y.tZ)(n6.Z,{children:(0,y.tZ)(n9,{name:"enable",valuePropName:"checked",children:(0,y.tZ)(n8.Z,{})})})]}),(0,y.tZ)(n9,{name:"url",children:(0,y.tZ)(tr,{size:"middle",type:"default"})})]})}var rt=tC.Z.Item;function rn(){var e,t,n=(0,k._)(tC.Z.useForm(),1)[0],r=(0,x.useContext)(_),i=r.object,o=r.editor,a=(e=(0,w._)(function(e){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:if(!i)return[2];if(!e.enable||!e.url)return i.fill instanceof en.fabric.Pattern&&i.set("fill","#000000"),[2,Promise.resolve()];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,eK(e.url)];case 2:return t=n.sent(),i.set("fill",new en.fabric.Pattern({source:t,repeat:"repeat"})),[3,4];case 3:return console.log(n.sent()),[3,4];case 4:return[2]}})}),function(t){return e.apply(this,arguments)}),l=function(e){var t=ey(e);"string"!=typeof t&&(t=new en.fabric.Gradient(t)),i.set("stroke",t)},s=(t=(0,w._)(function(e){var t,n,r,s,c,u,h,f,d;return(0,Z.Jh)(this,function(p){switch(p.label){case 0:if(!i||!o)return[2];t=Object.keys(e),n=!0,r=!1,s=void 0,p.label=1;case 1:p.trys.push([1,9,10,11]),c=t[Symbol.iterator](),p.label=2;case 2:if(n=(u=c.next()).done)return[3,8];if(f=e[h=u.value],"shadow"!==h)return[3,3];return i.shadow={color:f.color,blur:f.blur,offsetX:f.offset,offsetY:f.offset},[3,7];case 3:if("path"!==h)return[3,4];return f.enable?eD(i,f.offset):eY(i),[3,7];case 4:if("pattern"!==h)return[3,6];return[4,a(f)];case 5:return p.sent(),[3,7];case 6:"stroke"===h?l(f):i.set(h,f),p.label=7;case 7:return n=!0,[3,2];case 8:return[3,11];case 9:return d=p.sent(),r=!0,s=d,[3,11];case 10:try{n||null==c.return||c.return()}finally{if(r)throw s}return[7];case 11:return o.canvas.requestRenderAll(),o.fireCustomModifiedEvent(),[2]}})}),function(e){return t.apply(this,arguments)}),c=function(){var e,t,r,o,a=i.fill;n.setFieldsValue({stroke:eb(i.stroke),strokeWidth:i.strokeWidth||0,textBackgroundColor:i.textBackgroundColor,shadow:{color:(null===(e=i.shadow)||void 0===e?void 0:e.color)||i.stroke||"#000000",blur:(null===(t=i.shadow)||void 0===t?void 0:t.blur)||0,offset:(null===(r=i.shadow)||void 0===r?void 0:r.offsetX)||0},path:{enable:!!i.path,offset:eN(i)},pattern:{enable:a instanceof en.fabric.Pattern,url:null==a?void 0:null===(o=a.source)||void 0===o?void 0:o.src}})};return(0,x.useEffect)(function(){i&&"f-text"===i.type&&c()},[i]),(0,y.BX)(tC.Z,{form:n,onValuesChange:s,colon:!1,style:{marginTop:24},children:[(0,y.tZ)(rt,{label:(0,y.tZ)("span",{style:{fontSize:15,fontWeight:"bold"},children:"\u63CF\u8FB9"})}),(0,y.tZ)(rt,{label:"\u989C\u8272",name:"stroke",children:(0,y.tZ)(tO,{})}),(0,y.tZ)(rt,{label:"\u7C97\u7EC6",name:"strokeWidth",children:(0,y.tZ)(tB,{min:0,max:20})}),(0,y.tZ)(rt,{name:"shadow",style:{marginBottom:0},children:(0,y.tZ)(n3,{})}),(0,y.tZ)(rt,{name:"path",style:{marginBottom:0},children:(0,y.tZ)(n7,{})}),(0,y.tZ)(rt,{name:"pattern",children:(0,y.tZ)(re,{})})]})}var rr=tC.Z.Item;function ri(){var e,t=(0,x.useContext)(_),n=t.object,r=t.editor,i=(0,k._)(tC.Z.useForm(),1)[0],o=(0,k._)((0,x.useState)(!1),2),a=o[0],l=o[1],s=[{icon:(0,y.tZ)(nK.Z,{style:{fontSize:22}}),label:"\u7279\u6548",key:"fx",onClick:function(){l(!0)}}],c=function(e){n.set({fontWeight:(null==e?void 0:e.bold)?"bold":"normal",fontStyle:(null==e?void 0:e.italic)?"italic":"normal",underline:!!e.underline,linethrough:!!e.linethrough})},u=function(e){var t=ey(e);if("string"!=typeof t){t.gradientUnits="pixels";var r=t.coords;t.coords={x1:1===r.x1?n.width:0,y1:1===r.y1?n.height:0,x2:1===r.x2?n.width:0,y2:1===r.y2?n.height:0,r1:0,r2:n.width>n.height?n.width/2:n.height}}"string"!=typeof t&&(t=new en.fabric.Gradient(t)),n.set({fill:t})},h=(e=(0,w._)(function(e){var t,i,o,a,l,s,h,f,d;return(0,Z.Jh)(this,function(p){switch(p.label){case 0:if(!(null===(t=i=Object.keys(e))||void 0===t?void 0:t.length))return[2];o=!0,a=!1,l=void 0,p.label=1;case 1:p.trys.push([1,12,13,14]),s=i[Symbol.iterator](),p.label=2;case 2:if(o=(h=s.next()).done)return[3,11];if("fontStyles"!==(f=h.value))return[3,3];return c(e[f]),[3,9];case 3:if("fontFamily"!==f)return[3,8];p.label=4;case 4:return p.trys.push([4,,6,7]),[4,ef(e[f])];case 5:return p.sent(),[3,7];case 6:return n.set(f,e[f]),[7];case 7:return[3,9];case 8:"fill"===f?u(e[f]):n.getSelectedText()&&"fill"===f?n.setSelectionStyles({fill:e[f]}):(n.set("styles",{}),n.set(f,e[f])),p.label=9;case 9:"fontSize"!==f&&"lineHeight"!==f&&"charSpacing"!==f&&r.fireCustomModifiedEvent(),p.label=10;case 10:return o=!0,[3,2];case 11:return[3,14];case 12:return d=p.sent(),a=!0,l=d,[3,14];case 13:try{o||null==s.return||s.return()}finally{if(a)throw l}return[7];case 14:return r.canvas.requestRenderAll(),[2]}})}),function(t){return e.apply(this,arguments)});return(0,x.useEffect)(function(){i.setFieldsValue({fontFamily:n.fontFamily,fontSize:n.fontSize,fill:eb(n.fill),textAlign:n.textAlign,lineHeight:n.lineHeight,charSpacing:n.charSpacing,fontStyles:{bold:"bold"===n.fontWeight,italic:"italic"===n.fontStyle,underline:n.underline,linethrough:n.linethrough}})},[n]),(0,y.BX)(e8.Fragment,{children:[(0,y.BX)(tC.Z,{form:i,onValuesChange:h,colon:!1,children:[(0,y.tZ)(rr,{name:"fontFamily",label:"\u5B57\u4F53",children:(0,y.tZ)(nE.Z,{options:ec})}),(0,y.tZ)(rr,{name:"fontSize",label:"\u5B57\u53F7",children:(0,y.tZ)(tB,{max:400,onChangeComplete:function(){r.fireCustomModifiedEvent()}})}),(0,y.tZ)(rr,{name:"fill",label:"\u989C\u8272",children:(0,y.tZ)(tO,{type:"fontColor",defaultColor:"#000000"})}),(0,y.tZ)(rr,{name:"textAlign",label:"\u5BF9\u9F50",children:(0,y.tZ)(nG,{})}),(0,y.tZ)(rr,{name:"fontStyles",label:"\u6837\u5F0F",children:(0,y.tZ)(nU,{})}),(0,y.tZ)(rr,{name:"charSpacing",label:"\u5B57\u95F4\u8DDD",children:(0,y.tZ)(tB,{min:-200,max:800,onChangeComplete:function(){r.fireCustomModifiedEvent()}})}),(0,y.tZ)(rr,{name:"lineHeight",label:"\u884C\u95F4\u8DDD",children:(0,y.tZ)(tB,{min:.5,max:2.5,step:.01,onChangeComplete:function(){r.fireCustomModifiedEvent()}})})]}),(0,y.tZ)(n$,{dataSource:s,renderItemChildren:function(e){return(0,y.BX)(e8.Fragment,{children:[e.icon,(0,y.tZ)("span",{style:{fontSize:16,fontWeight:"bold",margin:"0 6px 0 10px"},children:e.label}),(0,y.tZ)(nQ.Z,{})]})}}),(0,y.tZ)(n1,{open:a,setOpen:l,title:"\u6587\u5B57\u7279\u6548",children:(0,y.tZ)(rn,{})})]})}var ro=n(3106);function ra(e){var t=e.onChange;return(0,y.tZ)(e3.Z,{content:(0,y.tZ)(tr,{size:"middle",type:"default",onChange:t}),placement:"top",trigger:"click",children:(0,y.tZ)($.ZP,{type:"primary",block:!0,icon:(0,y.tZ)(ro.Z,{}),children:"\u66FF\u6362\u56FE\u7247"})})}var rl=tC.Z.Item,rs=function(e){var t=e.stroke,n=e.strokeWidth,r=e.strokeDashArray;if(!t)return"none";if(null==r?void 0:r.length){var i=(0,k._)(r,2),o=i[0],a=i[1];return[o/=n/2>1?n/2:n,a/=n/4>1?n/4:n].join(",")}return"line"},rc=function(e){var t=e.type,n=e.strokeWidth;if(!t)return null;if("line"!==t){var r=t.split(",");return r[0]=r[0]*(n/2>1?n/2:n),r[1]=r[1]*(n/4>1?n/4:n),r}return null},ru=[{key:"none",svg:''},{key:"line",svg:''},{key:"12,2",svg:''},{key:"6,2",svg:''},{key:"2,2",svg:''}];function rh(e){var t=e.value,n=e.onChange,r=(0,x.useContext)(_).editor,i=(0,k._)(tC.Z.useForm(),1)[0],o=function(){r.fireCustomModifiedEvent()};return(0,x.useEffect)(function(){i.setFieldsValue(t)},[t]),(0,y.BX)(tC.Z,{form:i,onValuesChange:function(e){n&&n((0,T._)({},t,e))},colon:!1,children:[(0,y.tZ)(rl,{name:"type",label:"\u6837\u5F0F",labelCol:{span:24},children:(0,y.tZ)(e5.ZP.Group,{onChange:o,children:ru.map(function(e){return(0,y.tZ)(e5.ZP.Button,{value:e.key,children:(0,y.tZ)("span",{dangerouslySetInnerHTML:{__html:e.svg},style:{display:"inline-flex",alignItems:"center",marginTop:6}})},e.key)})})}),(0,y.tZ)(rl,{name:"stroke",label:"\u989C\u8272",children:(0,y.tZ)(t_,{onChange:o})}),(0,y.tZ)(rl,{name:"strokeWidth",label:"\u7C97\u7EC6",children:(0,y.tZ)(tB,{min:1,max:100,onChangeComplete:o})}),(0,y.tZ)(rl,{name:"borderRadius",label:"\u5706\u89D2",children:(0,y.tZ)(tB,{min:0,max:200,onChangeComplete:o})})]})}function rf(e){var t=e.value,n=e.onChange,r=(0,k._)((0,x.useState)(!1),2),i=r[0],o=r[1];return(0,y.BX)(e8.Fragment,{children:[(0,y.tZ)($.ZP,{block:!0,icon:(0,y.tZ)(eM.Z,{}),onClick:function(){o(!0)},children:"\u8FB9\u6846"}),(0,y.tZ)(n1,{open:i,setOpen:o,title:"\u8FB9\u6846",children:(0,y.tZ)("div",{style:{marginTop:24},children:(0,y.tZ)(rh,{value:t,onChange:n})})})]})}var rd=n(9356),rp=n.n(rd),rv=n(8053),rg=n(6584),rb=n(4769);function ry(e){var t=e.object,n=(0,x.useRef)(),r=(0,x.useRef)(null),i=(0,k._)((0,x.useState)(!1),2),o=i[0],a=i[1],l=(0,k._)((0,x.useState)({}),2),s=l[0],c=l[1],u=function(){if(r.current){var e=r.current.getCroppedCanvas().toDataURL();t.setSrc(e,function(){t.set("hasControls",!0),t.group&&t.group.addWithUpdate(),t.canvas.requestRenderAll(),t.setCoords()}),a(!1)}},h=function(e){r.current&&r.current.setAspectRatio(e)};return(0,x.useEffect)(function(){return function(){r.current&&(r.current.destroy(),r.current=null)}},[]),(0,y.BX)("div",{children:[(0,y.tZ)($.ZP,{block:!0,icon:(0,y.tZ)(rv.Z,{}),onClick:function(){a(!0);var e=t.getBoundingRect();c({src:t.getSrc(),width:e.width,height:e.height,left:e.left+406,top:e.top+50}),setTimeout(function(){r.current=new(rp())(n.current,{scalable:!1,autoCropArea:1,viewMode:3,toggleDragModeOnDblclick:!1}),t.set("hasControls",!1),t.canvas.requestRenderAll()},66)},children:"\u88C1\u526A"}),o?(0,y.BX)("div",{style:{position:"fixed",left:0,top:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,.65)",zIndex:1e3},className:"fabritor-crop-wrapper",children:[(0,y.tZ)("div",{style:{position:"absolute",zIndex:1001,left:s.left,top:s.top-38},children:(0,y.BX)(e1.Z.Compact,{block:!0,children:[(0,y.tZ)($.ZP,{onClick:function(){h(1)},children:"1:1"}),(0,y.tZ)($.ZP,{onClick:function(){h(4/3)},children:"4:3"}),(0,y.tZ)($.ZP,{onClick:function(){h(3/4)},children:"3:4"}),(0,y.tZ)($.ZP,{onClick:function(){h(16/9)},children:"16:9"}),(0,y.tZ)($.ZP,{onClick:function(){h(9/16)},children:"9:16"}),(0,y.tZ)($.ZP,{icon:(0,y.tZ)(rg.Z,{}),onClick:function(){a(!1),t.set("hasControls",!0),t.canvas.requestRenderAll()}}),(0,y.tZ)($.ZP,{icon:(0,y.tZ)(rb.Z,{}),onClick:u})]})}),(0,y.tZ)("div",{style:{width:s.width,height:s.height,position:"absolute",zIndex:1001,left:s.left,top:s.top},onDoubleClick:u,children:(0,y.tZ)("img",{ref:n,src:s.src,style:{display:"block",maxWidth:"100%"}})})]}):null]})}var rm=[{label:"\u65E0",value:"none",src:"https://cdn.pixabay.com/photo/2017/02/15/13/18/girl-2068638_1280.jpg"},{label:"\u590D\u53E4",value:"Sepia",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u590D\u53E4.png"},{label:"\u80F6\u7247",value:"Kodachrome",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u80F6\u7247.png"},{label:"\u8001\u7167\u7247",value:"Vintage",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u8001\u7167\u7247.png"},{label:"\u5B9D\u4E3D\u6765",value:"Polaroid",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u5B9D\u4E3D\u6765.png"},{label:"\u6A21\u7CCA",value:"Blur",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u6A21\u7CCA.png"},{label:"\u6D6E\u96D5",value:"Emboss",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u6D6E\u96D5.png"},{label:"\u50CF\u7D20",value:"Pixelate",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u50CF\u7D20.png"},{label:"\u9ED1\u767D",value:"Grayscale",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u9ED1\u767D.png"},{label:"\u8C03\u8272",value:"HueRotation",src:"https://raw.githubusercontent.com/sleepy-zone/fabritor-assets/main/images/\u8C03\u8272.png"}];function rw(e){var t=e.value,n=e.onChange,r=function(e,r){null==n||n((0,W._)((0,T._)({},t),{[r]:e}))};return(0,y.tZ)("div",{className:"fabritor-radio-image-group",children:rm.map(function(e){return(0,y.BX)("div",{className:"fabritor-radio-image-group-item",onClick:function(){r(e.value,"type")},children:[(0,y.tZ)("div",{className:"fabritor-radio-image-group-img",style:{borderColor:(null==t?void 0:t.type)===e.value?"#ff2222":"#eeeeee"},children:(0,y.tZ)("img",{src:e.src})}),(0,y.tZ)("span",{children:e.label}),"Blur"===e.value&&(null==t?void 0:t.type)==="Blur"?(0,y.tZ)(tF.Z,{min:0,max:1,step:.01,value:(null==t?void 0:t.param)==void 0?.2:null==t?void 0:t.param,onChange:function(e){r(e,"param")}}):null,"Pixelate"===e.value&&(null==t?void 0:t.type)==="Pixelate"?(0,y.tZ)(tF.Z,{min:2,max:20,step:.01,value:(null==t?void 0:t.param)==void 0?4:null==t?void 0:t.param,onChange:function(e){r(e,"param")}}):null,"HueRotation"===e.value&&(null==t?void 0:t.type)==="HueRotation"?(0,y.tZ)(tF.Z,{min:-2,max:2,step:.002,value:(null==t?void 0:t.param)==void 0?0:null==t?void 0:t.param,onChange:function(e){r(e,"param")}}):null]})})})}var rk=tC.Z.Item,rZ=function(e){if(!e)return{type:"none"};var t=e.type;return"Blur"===t?{type:t,param:e.blur}:"Pixelate"===t?{type:t,param:e.blocksize}:"HueRotation"===t?{type:t,param:e.rotation}:{type:t}};function rx(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)(tC.Z.useForm(),1)[0],i=function(){var e=t.getFilter();console.log(e),r.setFieldsValue({filter:rZ(e)})};return(0,x.useEffect)(function(){t&&"f-image"===t.type&&i()},[t]),(0,y.tZ)(tC.Z,{form:r,onValuesChange:function(e){if(e.filter){var r,i=e.filter,o=i.type,a=i.param;r="Emboss"===o?new en.fabric.Image.filters.Convolute({matrix:[1,1,1,1,.7,-1,-1,-1,-1]}):"none"===o?null:new en.fabric.Image.filters[o],"Blur"===o&&(r.blur=void 0==a?.2:a),"Pixelate"===o&&(r.blocksize=void 0==a?4:a),"HueRotation"===o&&(r.rotation=void 0==a?0:a),t.applyFilter(r),t.canvas.requestRenderAll(),n.fireCustomModifiedEvent()}},children:(0,y.tZ)(rk,{name:"filter",children:(0,y.tZ)(rw,{})})})}var rC=tC.Z.Item;function rS(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)(tC.Z.useForm(),1)[0],i=(0,k._)((0,x.useState)(!1),2),o=i[0],a=i[1],l=[{icon:(0,y.tZ)(nK.Z,{style:{fontSize:22}}),label:"\u6EE4\u955C",key:"fx",onClick:function(){a(!0)}}],s=function(e){e&&t.setSrc(e,function(){n.canvas.requestRenderAll(),n.fireCustomModifiedEvent()})},c=function(e){var r=e||{},i=r.type,o=r.stroke,a=r.strokeWidth,l=r.borderRadius;"none"===i?t.setBorder({stroke:null,borderRadius:l}):t.setBorder({stroke:void 0===o?"#000000":o,strokeWidth:a,borderRadius:l,strokeDashArray:rc(e)}),n.canvas.requestRenderAll()};return(0,x.useEffect)(function(){if(t){var e=t.getBorder();r.setFieldsValue({border:(0,W._)((0,T._)({type:rs(e)},e),{stroke:e.stroke||"#000000"}),opacity:t.opacity})}},[t]),(0,y.BX)(e8.Fragment,{children:[(0,y.BX)(tC.Z,{form:r,onValuesChange:function(e){e.img&&s(e.img),e.flip&&(t.set(e.flip,!t[e.flip]),n.canvas.requestRenderAll(),n.fireCustomModifiedEvent()),e.border&&c(e.border)},colon:!1,children:[(0,y.tZ)(rC,{name:"img",children:(0,y.tZ)(ra,{})}),(0,y.BX)(n4.Z,{gutter:8,children:[(0,y.tZ)(n6.Z,{span:12,children:(0,y.tZ)(rC,{children:(0,y.tZ)(ry,{object:t})})}),(0,y.tZ)(n6.Z,{span:12,children:(0,y.tZ)(rC,{name:"border",children:(0,y.tZ)(rf,{})})})]})]}),(0,y.tZ)(n$,{dataSource:l,renderItemChildren:function(e){return(0,y.BX)(e8.Fragment,{children:[e.icon,(0,y.tZ)("span",{style:{fontSize:16,fontWeight:"bold",margin:"0 6px 0 10px"},children:e.label}),(0,y.tZ)(nQ.Z,{})]})}}),(0,y.tZ)(n1,{open:o,setOpen:a,title:"\u6EE4\u955C",children:(0,y.tZ)(rx,{})})]})}var rA=tC.Z.Item,r_=ru.slice(1);function rj(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)(tC.Z.useForm(),1)[0];return(0,x.useEffect)(function(){r.setFieldsValue({stroke:t.stroke||"#000000",type:rs(t),strokeWidth:t.strokeWidth,round:"round"===t.strokeLineCap})},[t]),(0,y.BX)(tC.Z,{form:r,onValuesChange:function(e){var r=Object.keys(e);if(null==r?void 0:r.length){var i=!0,o=!1,a=void 0;try{for(var l,s=r[Symbol.iterator]();!(i=(l=s.next()).done);i=!0){var c=l.value;switch(c){case"stroke":t.set("stroke",e[c]),n.fireCustomModifiedEvent();break;case"strokeWidth":t.setStrokeWidth(e[c]);break;case"round":t.set("strokeLineCap",e[c]?"round":"butt"),n.fireCustomModifiedEvent();break;case"type":t.set("strokeDashArray",rc({type:e[c],strokeWidth:t.strokeWidth})),n.fireCustomModifiedEvent()}}}catch(u){o=!0,a=u}finally{try{i||null==s.return||s.return()}finally{if(o)throw a}}t.setCoords(),n.canvas.requestRenderAll()}},colon:!1,children:[(0,y.tZ)(rA,{name:"stroke",label:"\u989C\u8272",children:(0,y.tZ)(t_,{})}),(0,y.tZ)(rA,{name:"type",label:"\u6837\u5F0F",labelCol:{span:24},children:(0,y.tZ)(e5.ZP.Group,{children:r_.map(function(e){return(0,y.tZ)(e5.ZP.Button,{value:e.key,children:(0,y.tZ)("span",{dangerouslySetInnerHTML:{__html:e.svg},style:{display:"inline-flex",alignItems:"center",marginTop:6}})},e.key)})})}),(0,y.tZ)(rA,{name:"strokeWidth",label:"\u7C97\u7EC6",children:(0,y.tZ)(tB,{min:1,max:50,onChangeComplete:function(){n.fireCustomModifiedEvent()}})}),(0,y.tZ)(rA,{name:"round",label:"\u5706\u89D2",valuePropName:"checked",children:(0,y.tZ)(n8.Z,{})})]})}var rO=tC.Z.Item;function rF(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)(tC.Z.useForm(),1)[0],i=function(e){var r=e||{},i=r.type,o=r.stroke,a=r.strokeWidth,l=r.borderRadius;"none"===i?t.set({stroke:null,strokeWidth:1}):t.set({stroke:void 0===o?"#000":o,strokeWidth:a,strokeDashArray:rc({type:i,strokeWidth:a})}),"rect"===t.type?t.set({rx:l,ry:l}):t.set("strokeLineJoin",l>0?"round":"miter"),t.setCoords(),n.canvas.requestRenderAll()};return(0,x.useEffect)(function(){t&&r.setFieldsValue({border:{type:rs(t),stroke:t.stroke||"#000000",strokeWidth:t.strokeWidth||1,borderRadius:t.rx||t.ry||("round"===t.strokeLineJoin?100:0)},fill:eb(t.fill)})},[t]),(0,y.BX)(tC.Z,{form:r,onValuesChange:function(e){if(e.fill){var r=ey(e.fill);"string"!=typeof r&&(r=new en.fabric.Gradient(r)),t.set("fill",r),n.canvas.requestRenderAll()}e.border&&i(e.border)},colon:!1,children:[(0,y.tZ)(rO,{name:"fill",label:"\u989C\u8272",children:(0,y.tZ)(tO,{defaultColor:"#000000"})}),(0,y.tZ)(rO,{name:"border",label:(0,y.tZ)("span",{style:{fontWeight:"bold",fontSize:15},children:"\u8FB9\u6846"}),labelCol:{span:24},children:(0,y.tZ)(rh,{})})]})}var rz=n(5285),rB=n(387),rP=n(5538),rR=n(7388),rL=n(144),rX=n(1548),rM=n(9956),rH=n(8979);function rE(e){var t=e.value,n=e.onChange,r=e.onChangeComplete;return(0,y.tZ)(e3.Z,{content:(0,y.tZ)(tB,{style:{width:200},min:0,max:1,step:.01,value:t,onChange:n,onChangeComplete:r}),placement:"bottom",trigger:"click",children:(0,y.tZ)("span",{children:(0,y.tZ)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",children:(0,y.BX)("g",{fill:"currentColor","fill-rule":"evenodd",children:[(0,y.tZ)("path",{d:"M3 2h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1z"}),(0,y.tZ)("path",{d:"M11 2h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1z",opacity:".45"}),(0,y.tZ)("path",{d:"M19 2h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1z",opacity:".15"}),(0,y.tZ)("path",{d:"M7 6h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1z",opacity:".7"}),(0,y.tZ)("path",{d:"M15 6h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm0 8h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1z",opacity:".3"})]})})})})}var rI=[{key:"flipX",label:"\u6C34\u5E73\u7FFB\u8F6C"},{key:"flipY",label:"\u5782\u76F4\u7FFB\u8F6C"}];function rT(e){var t=e.onChange;return(0,y.tZ)(ee.Z,{placement:"bottom",trigger:["click"],menu:{items:rI,onClick:function(e){var n=e.key;null==t||t(n)}},arrow:!0,children:(0,y.tZ)("span",{children:(0,y.BX)("svg",{width:"22",height:"22",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,y.tZ)("path",{d:"M30 10H40C41.8856 10 42.8284 10 43.4142 10.5858C44 11.1716 44 12.1144 44 14V34C44 35.8856 44 36.8284 43.4142 37.4142C42.8284 38 41.8856 38 40 38H30",stroke:"currentColor","stroke-width":"4","stroke-linecap":"square","stroke-linejoin":"miter"}),(0,y.tZ)("path",{d:"M18 10H8C6.11438 10 5.17157 10 4.58579 10.5858C4 11.1716 4 12.1144 4 14V34C4 35.8856 4 36.8284 4.58579 37.4142C5.17157 38 6.11438 38 8 38H18",stroke:"currentColor","stroke-width":"4","stroke-linecap":"square","stroke-linejoin":"miter"}),(0,y.tZ)("path",{d:"M24 6V42",stroke:"currentColor","stroke-width":"4","stroke-linecap":"square","stroke-linejoin":"miter"})]})})})}var rW=tC.Z.Item,rJ=function(e){var t=e.value,n=e.onChange,r=(0,J._)(e,["value","onChange"]),i=(0,k._)((0,x.useState)(t),2),o=i[0],a=i[1];return(0,x.useEffect)(function(){a(t)},[t]),(0,y.tZ)(tz.Z,(0,T._)({style:{width:"100%"},controls:!1,step:1,precision:2,changeOnBlur:!0,value:o,onChange:a,onPressEnter:function(){null==n||n(o)}},r))},rV=["textbox","f-text","rect"];function rU(){var e=(0,x.useContext)(_),t=e.editor,n=e.object,r=(0,k._)((0,x.useState)(!1),2),i=r[0],o=r[1],a=(0,x.useRef)(!1),l=(0,k._)(tC.Z.useForm(),1)[0],s=function(e,t){var r=t-n.strokeWidth;"width"===e?a.current?n.set({width:r,scaleX:1,scaleY:1}):n.scaleToWidth(r,!0):"height"===e&&(a.current?n.set({height:r,scaleX:1,scaleY:1}):n.scaleToHeight(r,!0))},c=function(){l.setFieldsValue({width:n.getScaledWidth(),height:n.getScaledHeight(),lockRatio:!0,left:n.left,top:n.top,angle:n.angle})},u=function(){c()};return(0,x.useEffect)(function(){(i&&n&&!n.group||"activeSelection"!==n.type)&&(a.current=rV.includes(n.type),c(),n.on("modified",u))},[n,i]),(0,y.BX)(e8.Fragment,{children:[(0,y.tZ)($.ZP,{block:!0,onClick:function(){o(!0)},children:"\u8C03\u6574\u4F4D\u7F6E"}),(0,y.tZ)(n1,{open:i,setOpen:o,title:"\u8C03\u6574\u4F4D\u7F6E",children:(0,y.tZ)("div",{style:{marginTop:24},children:(0,y.BX)(tC.Z,{form:l,layout:"vertical",colon:!1,onValuesChange:function(e){Object.keys(e).forEach(function(t){var r=e[t];"width"===t||"height"===t?(s(t,r),c()):n.set(t,r)}),t.canvas.requestRenderAll(),t.fireCustomModifiedEvent()},children:[(0,y.BX)(n4.Z,{gutter:8,children:[(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"\u5BBD(\u50CF\u7D20)",name:"width",children:(0,y.tZ)(rJ,{min:1})})}),(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"\u9AD8(\u50CF\u7D20)",name:"height",children:(0,y.tZ)(rJ,{min:1})})}),(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"\u9501\u5B9A\u6BD4\u4F8B",name:"lockRatio",valuePropName:"checked",children:(0,y.tZ)(n8.Z,{disabled:!0})})})]}),(0,y.BX)(n4.Z,{gutter:8,children:[(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"X(\u50CF\u7D20)",name:"left",children:(0,y.tZ)(rJ,{})})}),(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"Y(\u50CF\u7D20)",name:"top",children:(0,y.tZ)(rJ,{})})}),(0,y.tZ)(n6.Z,{span:8,children:(0,y.tZ)(rW,{label:"\u65CB\u8F6C(\xb0)",name:"angle",children:(0,y.tZ)(rJ,{min:-360,max:360,precision:0})})})]})]})})})]})}var rN=[{label:"\u5C45\u4E2D",icon:rz.Z,key:"center"},{label:"\u5DE6\u5BF9\u9F50",icon:nN.Z,key:"left"},{label:"\u6C34\u5E73\u5C45\u4E2D",icon:nD.Z,key:"centerH"},{label:"\u53F3\u5BF9\u9F50",icon:nY.Z,key:"right"},{label:"\u9876\u90E8\u5BF9\u9F50",icon:rB.Z,key:"top"},{label:"\u5782\u76F4\u5C45\u4E2D",icon:rP.Z,key:"centerV"},{label:"\u5E95\u90E8\u5BF9\u9F50",icon:rR.Z,key:"bottom"}];function rD(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)((0,x.useState)(!1),2),i=r[0],o=r[1],a=(0,k._)((0,x.useState)(1),2),l=a[0],s=a[1],c=function(e){switch(e){case"center":n.canvas.viewportCenterObject(t),t.setCoords();break;case"left":t.set("left",0);break;case"centerH":n.canvas.viewportCenterObjectH(t),t.setCoords();break;case"right":t.set("left",n.sketch.width-t.width);break;case"top":t.set("top",0);break;case"centerV":n.canvas.viewportCenterObjectV(t),t.setCoords();break;case"bottom":t.set("top",n.sketch.height-t.height)}n.canvas.requestRenderAll(),n.fireCustomModifiedEvent()};return((0,x.useEffect)(function(){t&&(o(t.lockMovementX),s(t.opacity))},[t]),t&&t.id!==eu)?(0,y.BX)(e8.Fragment,{children:[(0,y.BX)(N,{height:30,gap:8,justify:"space-between",children:[(0,y.tZ)(Y,{tooltipProps:{placement:"top"},onClick:function(){t.set({lockMovementX:!i,lockMovementY:!i,hasControls:!!i}),n.canvas.requestRenderAll(),o(!i),n.fireCustomModifiedEvent()},title:i?"\u89E3\u9501":"\u9501\u5B9A",children:i?(0,y.tZ)(rL.Z,{style:{fontSize:20}}):(0,y.tZ)(rX.Z,{style:{fontSize:20}})}),(0,y.tZ)(Y,{tooltipProps:{placement:"top"},title:"\u900F\u660E\u5EA6",children:(0,y.tZ)(rE,{value:l,onChange:function(e){t.set("opacity",e),s(e),n.canvas.requestRenderAll()},onChangeComplete:function(){n.fireCustomModifiedEvent()}})}),(0,y.tZ)(Y,{tooltipProps:{placement:"top"},title:"\u521B\u5EFA\u526F\u672C",onClick:(0,w._)(function(){return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return[4,nr(n.canvas,t)];case 1:return e.sent(),[4,ni(n.canvas)];case 2:return e.sent(),[2]}})}),children:(0,y.tZ)(rM.Z,{style:{fontSize:20}})}),(0,y.tZ)(Y,{tooltipProps:{placement:"top"},title:"\u5220\u9664",onClick:function(){no(null,n.canvas)},children:(0,y.tZ)(rH.Z,{style:{fontSize:20}})}),"f-image"===t.type?(0,y.tZ)(Y,{tooltipProps:{placement:"top"},title:"\u7FFB\u8F6C",children:(0,y.tZ)(rT,{onChange:function(e){t.set(e,!t[e]),n.canvas.requestRenderAll(),n.fireCustomModifiedEvent()}})}):null]}),(0,y.tZ)(q.Z,{style:{margin:"16px 0"}}),(0,y.tZ)("span",{style:{fontWeight:"bold"},children:"\u753B\u5E03\u5BF9\u9F50"}),(0,y.tZ)(N,{height:30,gap:8,justify:"space-between",style:{marginTop:16},children:rN.map(function(e){return(0,y.tZ)(Y,{tooltipProps:{placement:"top"},title:e.label,onClick:function(){c(e.key)},children:(0,y.tZ)(e.icon,{style:{fontSize:20}})},e.key)})}),(0,y.tZ)(q.Z,{style:{margin:"16px 0"}}),(0,y.tZ)(rU,{})]}):null}function rY(){var e=(0,x.useContext)(_),t=e.object,n=e.editor;return t&&("group"===t.type||"activeSelection"===t.type)?(0,y.tZ)("div",{children:"group"===t.type?(0,y.tZ)($.ZP,{type:"primary",block:!0,onClick:function(){nl(n.canvas,t)},children:"\u53D6\u6D88\u5EFA\u7EC4"}):(0,y.tZ)($.ZP,{type:"primary",block:!0,onClick:function(){na(n.canvas,t)},children:"\u5EFA\u7EC4"})}):null}function rq(){var e=(0,x.useContext)(_),t=e.object,n=e.editor,r=(0,k._)((0,x.useState)({}),2),i=r[0],o=r[1];return((0,x.useEffect)(function(){if(t){var e=t.shadow;o({color:t.stroke,width:t.strokeWidth,fill:eb(t.fill||"#ffffff"),shadow:{color:(null==e?void 0:e.color)||"#000000",width:(null==e?void 0:e.blur)||0,offset:(null==e?void 0:e.offsetX)||0}})}},[t]),t&&"path"===t.type)?(0,y.tZ)(tR,{showFillConfig:null==t?void 0:t.sub_type,shouldFireEvent:!0,value:i,onChange:function(e){if(e.color&&t.set("stroke",e.color),e.width&&t.set("strokeWidth",e.width),e.fill){var r=ey(e.fill);"string"!=typeof r&&(r=new en.fabric.Gradient(r)),t.set("fill",r)}if(e.shadow){var i=t.shadow,o=i?i.toObject():{},a={blur:e.shadow.width||o.blur,offsetX:e.shadow.offset||o.offsetX,offsetY:e.shadow.offset||o.offsetY,affectStroke:!0,color:e.shadow.color||o.color||"#000000"};t.set("shadow",new en.fabric.Shadow(a))}n.canvas.requestRenderAll()}}):null}var rG=tC.Z.Item;function rK(){var e=(0,k._)(tC.Z.useForm(),1)[0],t=(0,x.useContext)(_),n=t.editor,r=t.object;return(0,x.useEffect)(function(){if(null==r?void 0:r.sub_type){if("path"===r.type)e.setFieldsValue({stroke:r.stroke});else{var t=r.getObjects();e.setFieldsValue({stroke:t[1].stroke,fill:t[0].stroke})}}},[n]),(0,y.BX)(tC.Z,{colon:!1,form:e,onValuesChange:function(e){Object.keys(e).forEach(function(t){if("path"===r.type)r.set("stroke",e[t]);else{var n=r.getObjects();"stroke"===t?n[1].set("stroke",e[t]):"fill"===t&&n[0].set("stroke",e[t])}}),n.canvas.requestRenderAll(),n.fireCustomModifiedEvent()},children:[(0,y.tZ)(rG,{label:"\u63CF\u8FB9",name:"stroke",children:(0,y.tZ)(t_,{})}),(null==r?void 0:r.type)==="group"?(0,y.tZ)(rG,{label:"\u586B\u5145",name:"fill",children:(0,y.tZ)(t_,{})}):null]})}var rQ=C.Z.Sider,r$=eA.Z.Title,r0={position:"relative",backgroundColor:"#fff",borderLeft:"1px solid #e8e8e8",overflow:"auto",height:"100%"};function r1(){var e,t,n=(0,x.useContext)(_),r=n.object,i=n.isReady,o=(null==r?void 0:null===(t=r.get)||void 0===t?void 0:t.call(r,"type"))||"";console.log("objectType",o,r);var a=function(){if(!i)return null;if(!r||r.id===eu)return"\u753B\u5E03";switch(o){case"textbox":case"f-text":return"\u6587\u5B57";case"rect":case"circle":case"triangle":case"polygon":case"ellipse":return"\u5F62\u72B6";case"line":case"f-line":case"f-arrow":case"f-tri-arrow":return"\u7EBF\u6761";case"f-image":return"\u56FE\u7247";case"image":return"\u914D\u7F6E";case"path":if(null==r?void 0:r.sub_type){if((null==r?void 0:r.sub_type)==="rough")return"\u624B\u7ED8\u98CE\u683C";return"\u5F62\u72B6"}return"\u753B\u7B14";case"group":if((null==r?void 0:r.sub_type)==="rough")return"\u624B\u7ED8\u98CE\u683C";return"\u7EC4\u5408";case"activeSelection":return"\u7EC4\u5408";default:return"\u753B\u5E03"}};return(0,y.BX)(rQ,{style:r0,width:280,className:"fabritor-sider",children:[a()?(0,y.tZ)(N,{style:{borderBottom:"1px solid #e8e8e8",paddingLeft:16},children:(0,y.tZ)(r$,{level:5,children:a()})}):null,(0,y.BX)("div",{style:{padding:16},children:[(e=function(){if(!i)return null;if(!r||r.id===eu)return(0,y.tZ)(nH,{});switch(o){case"textbox":case"f-text":return(0,y.tZ)(ri,{});case"rect":case"circle":case"triangle":case"polygon":case"ellipse":return(0,y.tZ)(rF,{});case"f-line":case"f-arrow":case"f-tri-arrow":return(0,y.tZ)(rj,{});case"f-image":return(0,y.tZ)(rS,{});case"path":if((null==r?void 0:r.sub_type)==="rough")return(0,y.tZ)(rK,{});return(0,y.tZ)(rq,{});case"group":if((null==r?void 0:r.sub_type)==="rough")return(0,y.tZ)(rK,{});return(0,y.tZ)(rY,{});case"activeSelection":return(0,y.tZ)(rY,{});default:return null}}())?(0,y.BX)(e8.Fragment,{children:[e,(0,y.tZ)(q.Z,{})]}):null,(0,y.tZ)(rD,{})]})]})}var r2=n(5862),r3=n(2267),r4=n(5766),r6=function(){en.fabric.Image.prototype.needsItsOwnCache=function(){return!1},en.fabric.perfLimitSizeTotal=16777216,Object.keys(el).forEach(function(e){en.fabric.Object.prototype[e]=el[e]});var e={borderColor:"#cccddd",borderDashArray:[7,10],borderScaleFactor:3,padding:10};Object.keys(e).forEach(function(t){en.fabric.ActiveSelection.prototype[t]=e[t],en.fabric.Group.prototype[t]=e[t]}),en.fabric.Group.prototype.subTargetCheck=!0},r8=n(9975),r5=n(6259),r7=function(){function e(t){(0,r2._)(this,e),(0,r4._)(this,"historyUndo",void 0),(0,r4._)(this,"historyRedo",void 0),(0,r4._)(this,"saving",void 0),(0,r4._)(this,"doing",void 0),(0,r4._)(this,"currentState",void 0),(0,r4._)(this,"canvas",void 0),(0,r4._)(this,"editor",void 0),this.historyUndo=[],this.historyRedo=[],this.canvas=t.canvas,this.editor=t,this.saving=!1,this.doing=!1,this.currentState=this._getJSON(),this.init()}return(0,r3._)(e,[{key:"_checkHistoryUndoLength",value:function(){this.historyUndo.length>100&&this.historyUndo.shift()}},{key:"_checkHistoryRedoLength",value:function(){this.historyRedo.length>100&&this.historyRedo.shift()}},{key:"_historySaveAction",value:function(){if(!this.doing&&!this.saving){this.saving=!0;var e=this.currentState;this.historyUndo.push(e),this._checkHistoryUndoLength(),this.currentState=this._getJSON(),this.saving=!1}}},{key:"_getJSON",value:function(){return JSON.stringify(this.editor.canvas2Json())}},{key:"_historyEvents",value:function(){return{"object:added":this._historySaveAction.bind(this),"object:removed":this._historySaveAction.bind(this),"object:modified":this._historySaveAction.bind(this),"object:skewing":this._historySaveAction.bind(this),"fabritor:object:modified":this._historySaveAction.bind(this)}}},{key:"init",value:function(){this.canvas.on(this._historyEvents())}},{key:"dispose",value:function(){this.canvas.off(this._historyEvents())}},{key:"undo",value:function(){var e=this;return(0,w._)(function(){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:if(!(t=e.historyUndo.pop()))return[3,2];return e.doing=!0,e.historyRedo.push(e.currentState),e._checkHistoryRedoLength(),e.currentState=t,[4,e.editor.loadFromJSON(t)];case 1:n.sent(),e.doing=!1,e.canvas.fire("fabritor:history:undo"),n.label=2;case 2:return[2]}})})()}},{key:"redo",value:function(){var e=this;return(0,w._)(function(){var t;return(0,Z.Jh)(this,function(n){switch(n.label){case 0:if(!(t=e.historyRedo.pop()))return[3,2];return e.doing=!0,e.historyUndo.push(e.currentState),e._checkHistoryUndoLength(),e.currentState=t,[4,e.editor.loadFromJSON(t)];case 1:n.sent(),e.doing=!1,e.canvas.fire("fabritor:history:redo"),n.label=2;case 2:return[2]}})})()}},{key:"canUndo",value:function(){return this.historyUndo.length>0}},{key:"canRedo",value:function(){return this.historyRedo.length>0}},{key:"reset",value:function(){this.historyRedo=[],this.historyUndo=[],this.saving=!1,this.doing=!1,this.currentState=this._getJSON()}}]),e}(),r9=function(){function e(t){(0,r2._)(this,e),(0,r4._)(this,"canvas",void 0),(0,r4._)(this,"editor",void 0),(0,r4._)(this,"saving",void 0),(0,r4._)(this,"canSave",void 0),this.canvas=t.canvas,this.editor=t,this.saving=!1,this.canSave=!0,this.init()}return(0,r3._)(e,[{key:"init",value:function(){this.canvas.on(this.initAutoSaveEvents())}},{key:"dispose",value:function(){this.canvas.off(this.initAutoSaveEvents())}},{key:"setCanSave",value:function(e){this.canSave=e}},{key:"autoSaveAction",value:function(){if(!this.saving){this.saving=!0;try{this.canSave&&localStorage.setItem("fabritor_web_json",this._getJSON())}catch(e){console.log(e)}this.saving=!1}}},{key:"_getJSON",value:function(){return JSON.stringify(this.editor.canvas2Json())}},{key:"initAutoSaveEvents",value:function(){return{"object:added":this.autoSaveAction.bind(this),"object:removed":this.autoSaveAction.bind(this),"object:modified":this.autoSaveAction.bind(this),"object:skewing":this.autoSaveAction.bind(this),"fabritor:object:modified":this.autoSaveAction.bind(this)}}},{key:"loadFromLocal",value:function(){var e=this;return(0,w._)(function(){var t,n;return(0,Z.Jh)(this,function(r){switch(r.label){case 0:r.label=1;case 1:if(r.trys.push([1,4,,5]),!(t=localStorage.getItem("fabritor_web_json")))return[3,3];return n=JSON.parse(t),[4,e.editor.loadFromJSON(n)];case 2:r.sent(),r.label=3;case 3:return[3,5];case 4:return console.log(r.sent()),[3,5];case 5:return[2]}})})()}}]),e}(),ie=function(e){var t=e.items,n=e.canvas,r=(0,J._)(e,["items","canvas"]),i=new en.fabric.Group(t,(0,T._)({id:ed()},r));return n.add(i),i},it=en.fabric.util.object.clone,ir="fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign minWidth splitByGrapheme".split(" "),ii=function(){en.fabric.FText=en.fabric.util.createClass(en.fabric.Textbox,{type:"f-text",padding:0,paintFirst:"stroke",initDimensions:function(){if(!this.__skipDimension){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces();var e=this.calcTextHeight();this.path?this.height=this.path.height>e?this.path.height:e:this.height=e,this.saveState({propertySet:"_dimensionAffectingProps"})}},toObject:function(e){var t=ir.concat(e),n=this.callSuper("toObject",t);return n.styles=en.fabric.util.stylesToArray(this.styles,this.text),n.path&&(n.path=this.path.toObject()),n}}),en.fabric.FText.fromObject=function(e,t){var n=it(e),r=e.path;return delete n.path,en.fabric.Object._fromObject("FText",n,function(n){n.styles=en.fabric.util.stylesFromArray(e.styles,e.text),r?en.fabric.Object._fromObject("Path",r,function(e){n.set("path",e),t(n)},"path"):t(n)},"text")}},io=function(){var e;e=en.fabric.util.createClass(en.fabric.Group,{type:"f-image",initialize(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.image,r=e.imageBorder,i=void 0===r?{}:r,o=(0,J._)(e,["image","imageBorder"]);n.set({originX:"center",originY:"center"}),this.img=n,this.borderRect=this._createBorderRect(i),this.img.clipPath=this._createClipPath(),this.callSuper("initialize",[this.img,this.borderRect],(0,T._)({borderColor:"#FF2222",borderDashArray:null,borderScaleFactor:2,padding:0,subTargetCheck:!1,imageBorder:i},o),t)},_createBorderRect(e){var t=e.stroke,n=e.strokeWidth,r=e.borderRadius,i={width:this.img.getScaledWidth(),height:this.img.getScaledHeight(),rx:r||0,ry:r||0,originX:"center",originY:"center",fill:"#00000000",paintFirst:"fill"};return t&&(i.stroke=t),n&&(i.strokeWidth=n),new en.fabric.Rect(i)},_createClipPath(){var e=this.img.width,t=this.img.height;return console.log(e,t),new en.fabric.Rect({originX:"center",originY:"center",width:e,height:t,rx:this.borderRect.rx||0,ry:this.borderRect.ry||0})},setSrc(e,t){var n=this;this.img.setSrc(e,function(){var e=n.img.getScaledWidth(),r=n.img.getScaledHeight();n.img.setCoords(),n.borderRect.set({width:e,height:r,dirty:!0}),n.img.set({clipPath:n._createClipPath(),dirty:!0}),n.addWithUpdate(),t&&t()})},getSrc(){return this.img.getSrc()},setBorder(e){this.borderRect.set({stroke:e.stroke||null,strokeWidth:e.strokeWidth||1,rx:e.borderRadius||0,ry:e.borderRadius||0,strokeDashArray:e.strokeDashArray||null}),this.img.setCoords(),this.img.set({clipPath:this._createClipPath(),dirty:!0}),this.imageBorder=(0,T._)({},e),this.addWithUpdate()},getBorder(){return this.imageBorder},applyFilter(e){try{this.img.filters=e?[e]:[],this.img.applyFilters()}catch(t){console.log(t)}},applyFilterValue(e,t){var n=this.getFilter();n&&(n[e]=t,this.img.filters=[n],this.img.applyFilters())},getFilter(){return this.img.filters[0]}}),en.fabric.FImage=e,en.fabric.FImage.fromObject=function(e,t){var n=e.objects,r=(0,J._)(e,["objects"]),i=(0,T._)({},n[0]);en.fabric.Image.fromObject(i,function(e){t(new en.fabric.FImage((0,T._)({image:e},r),!0))})}},ia=en.fabric.util.object.extend,il=function(){en.fabric.FLine=en.fabric.util.createClass(en.fabric.Line,{type:"f-line",padding:6,borderColor:"#00000000",setStrokeWidth(e){this.set("strokeWidth",e)},setStrokeDashArray(e){this.set("strokeDashArray",e)},setStrokeLineCap(e){this.set("strokeLineCap",e?"round":"butt")},toObject(e){return ia(this.callSuper("toObject",e),{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2})}}),en.fabric.FLine.fromObject=function(e,t){var n=(0,T._)({},e);n.points=[e.x1,e.y1,e.x2,e.y2],en.fabric.Object._fromObject("FLine",n,function(e){delete e.points,t&&t(e)},"points")}},is=en.fabric.util.object.extend,ic=function(){en.fabric.FArrow=en.fabric.util.createClass(en.fabric.Line,{type:"f-arrow",borderColor:"#00000000",_render:function(e){this.callSuper("_render",e),e.save(),this.oldArrowInfo||(this.oldArrowInfo={left:-28,top:-15,bottom:15,strokeWidth:this.strokeWidth});var t=this.x2-this.x1,n=Math.atan2(this.y2-this.y1,t);e.translate((this.x2-this.x1)/2,(this.y2-this.y1)/2),e.rotate(n);var r=this.strokeWidth-this.oldArrowInfo.strokeWidth;e.lineJoin=this.strokeLineJoin,e.lineCap=this.strokeLineCap,e.strokeStyle=this.stroke,e.beginPath(),e.moveTo(0,0),e.lineTo(this.oldArrowInfo.left-r,this.oldArrowInfo.bottom+r),e.lineTo(this.oldArrowInfo.left-r,this.oldArrowInfo.top-r),e.closePath(),e.fillStyle=this.stroke,e.fill(),e.stroke(),e.restore()},setStrokeWidth(e){this.set("strokeWidth",e)},setStrokeDashArray(e){this.set("strokeDashArray",e)},setStrokeLineCap(e){this.set("strokeLineCap",e?"round":"butt"),this.set("strokeLineJoin",e?"round":"miter")},toObject(e){return is(this.callSuper("toObject",e),{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2})}}),en.fabric.FArrow.fromObject=function(e,t){t&&t(new en.fabric.FArrow([e.x1,e.y1,e.x2,e.y2],e))}},iu=function(){en.fabric.FTriArrow=en.fabric.util.createClass(en.fabric.Line,{type:"f-tri-arrow",borderColor:"#00000000",_render:function(e){this.callSuper("_render",e),e.save(),this.oldArrowInfo||(this.oldArrowInfo={left:-24,top:-16,bottom:16,strokeWidth:this.strokeWidth});var t=this.x2-this.x1,n=Math.atan2(this.y2-this.y1,t);e.translate((this.x2-this.x1)/2,(this.y2-this.y1)/2),e.rotate(n);var r=this.strokeWidth-this.oldArrowInfo.strokeWidth;e.lineJoin=this.strokeLineJoin,e.lineCap=this.strokeLineCap,e.strokeStyle=this.stroke,e.beginPath(),e.moveTo(this.oldArrowInfo.left-r,this.oldArrowInfo.bottom+r),e.lineTo(0,0),e.lineTo(this.oldArrowInfo.left-r,this.oldArrowInfo.top-r),e.fillStyle="#00000000",e.fill(),e.stroke(),e.restore()},setStrokeWidth(e){this.set("strokeWidth",e)},setStrokeDashArray(e){this.set("strokeDashArray",e)},setStrokeLineCap(e){this.set("strokeLineCap",e?"round":"butt"),this.set("strokeLineJoin",e?"round":"miter")},toObject(e){return is(this.callSuper("toObject",e),{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2})}}),en.fabric.FTriArrow.fromObject=function(e,t){t&&t(new en.fabric.FTriArrow([e.x1,e.y1,e.x2,e.y2],e))}},ih=function(){function e(t){(0,r2._)(this,e),(0,r4._)(this,"canvas",void 0),(0,r4._)(this,"_options",void 0),(0,r4._)(this,"_template",void 0),(0,r4._)(this,"sketch",void 0),(0,r4._)(this,"_resizeObserver",void 0),(0,r4._)(this,"_pan",void 0),(0,r4._)(this,"fhistory",void 0),(0,r4._)(this,"autoSave",void 0);var n=t.template,r=(0,J._)(t,["template"]);this._options=r,this._template=n,this._pan={enable:!1,isDragging:!1,lastPosX:0,lastPosY:0}}return(0,r3._)(e,[{key:"init",value:function(){var e=this;return(0,w._)(function(){return(0,Z.Jh)(this,function(t){switch(t.label){case 0:return e._initObject(),e._initCanvas(),e._initEvents(),e._initSketch(),e._initGuidelines(),e.autoSave=new r9(e),[4,e.autoSave.loadFromLocal()];case 1:var n,r,i;return t.sent(),e.fhistory=new r7(e),n=e.canvas,r=e.fhistory,(0,r5.Z)("ctrl+c,command+c",(i=(0,w._)(function(e){return(0,Z.Jh)(this,function(e){switch(e.label){case 0:return[4,nr(n,null)];case 1:return e.sent(),[2]}})}),function(e){return i.apply(this,arguments)})),(0,r5.Z)("ctrl+v,command+v",function(e){ni(n)}),(0,r5.Z)("delete,del,backspace",function(e){e.preventDefault(),no(null,n)}),(0,r5.Z)("ctrl+z,command+z",function(e){e.preventDefault(),r.undo()}),(0,r5.Z)("ctrl+shift+z,command+shift+z",function(e){e.preventDefault(),r.redo()}),(0,r5.Z)("up, right, down, left",function(e,t){var r=n.getActiveObject();if(r&&("f-text"!==r.type||!r.isEditing)){switch(e.preventDefault(),t.key){case"up":r.set("top",r.top-1);break;case"right":r.set("left",r.left+1);break;case"down":r.set("top",r.top+1);break;case"left":r.set("left",r.left-1)}r.group&&r.addWithUpdate(),n.requestRenderAll()}}),e.autoSave.init(),[2]}})})()}},{key:"_initObject",value:function(){r6(),ii(),io(),il(),ic(),iu(),t5(),t7(),t9(),tT(),tU(),tD()}},{key:"_initCanvas",value:function(){var e=this._options,t=e.canvasEl,n=e.workspaceEl;this.canvas=new en.fabric.Canvas(t,{selection:!0,containerClass:"fabritor-canvas",enableRetinaScaling:!0,fireRightClick:!0,controlsAboveOverlay:!0,width:n.offsetWidth,height:n.offsetHeight,backgroundColor:"#ddd",preserveObjectStacking:!0,imageSmoothingEnabled:!1})}},{key:"_initGuidelines",value:function(){var e,t,n,r,i,o,a,l,s,c,u,h,f;e=this.canvas,t=function(e){r(e.x+.5,e.y1>e.y2?e.y2:e.y1,e.x+.5,e.y2>e.y1?e.y2:e.y1)},n=function(e){r(e.x1>e.x2?e.x2:e.x1,e.y+.5,e.x2>e.x1?e.x2:e.x1,e.y+.5)},r=function(e,t,n,r){a.save(),a.lineWidth=s,a.strokeStyle=c,a.beginPath(),a.moveTo(e*u+o[4],t*u+o[5]),a.lineTo(n*u+o[4],r*u+o[5]),a.stroke(),a.restore()},i=function(e,t){e=Math.round(e),t=Math.round(t);for(var n=e-l,r=e+l;n<=r;n++)if(n===t)return!0;return!1},a=e.getSelectionContext(),l=4,s=1,c="rgb(0,255,0)",u=1,h=[],f=[],e.on("mouse:down",function(){o=e.viewportTransform,u=e.getZoom()}),e.on("object:moving",function(t){var n=t.target,r=e.getObjects(),a=n.getCenterPoint(),l=a.x,s=a.y,c=n.getBoundingRect(),u=c.height/o[3],d=c.width/o[0],p=!1,v=!1;if(e._currentTransform){for(var g=r.length;g--;)if(r[g]!==n){var b=r[g].getCenterPoint(),y=b.x,m=b.y,w=r[g].getBoundingRect(),k=w.height/o[3],Z=w.width/o[0];i(y,l)&&(v=!0,h.push({x:y,y1:mm?s+u/2+5:s-u/2-5}),n.setPositionByOrigin(new fabric.Point(y,s),"center","center")),i(y-Z/2,l-d/2)&&(v=!0,h.push({x:y-Z/2,y1:mm?s+u/2+5:s-u/2-5}),n.setPositionByOrigin(new fabric.Point(y-Z/2+d/2,s),"center","center")),i(y+Z/2,l+d/2)&&(v=!0,h.push({x:y+Z/2,y1:mm?s+u/2+5:s-u/2-5}),n.setPositionByOrigin(new fabric.Point(y+Z/2-d/2,s),"center","center")),i(m,s)&&(p=!0,f.push({y:m,x1:yy?l+d/2+5:l-d/2-5}),n.setPositionByOrigin(new fabric.Point(l,m),"center","center")),i(m-k/2,s-u/2)&&(p=!0,f.push({y:m-k/2,x1:yy?l+d/2+5:l-d/2-5}),n.setPositionByOrigin(new fabric.Point(l,m-k/2+u/2),"center","center")),i(m+k/2,s+u/2)&&(p=!0,f.push({y:m+k/2,x1:yy?l+d/2+5:l-d/2-5}),n.setPositionByOrigin(new fabric.Point(l,m+k/2-u/2),"center","center"))}p||(f.length=0),v||(h.length=0)}}),e.on("before:render",function(){e.contextTop&&e.clearContext(e.contextTop)}),e.on("after:render",function(){for(var e=h.length;e--;)t(h[e]);for(var e=f.length;e--;)n(f[e]);h.length=f.length=0}),e.on("mouse:up",function(){h.length=f.length=0,e.renderAll()}),function(e){for(var t,n,r,i=function(){a(c+.5,0,c+.5,s)},o=function(){a(0,u+.5,l,u+.5)},a=function(e,t,n,i){v.save(),v.strokeStyle=d,v.lineWidth=p,v.beginPath(),v.moveTo(e*r[0],t*r[3]),v.lineTo(n*r[0],i*r[3]),v.stroke(),v.restore()},l=e.getWidth(),s=e.getHeight(),c=l/2,u=s/2,h={},f={},d="rgba(255,0,241,0.5)",p=1,v=e.getSelectionContext(),g=c-4,b=c+4;g<=b;g++)h[Math.round(g)]=!0;for(var g=u-4,b=u+4;g<=b;g++)f[Math.round(g)]=!0;e.on("mouse:down",function(){r=e.viewportTransform}),e.on("object:moving",function(r){var i=r.target,o=i.getCenterPoint();e._currentTransform&&(t=Math.round(o.x) in h,((n=Math.round(o.y) in f)||t)&&i.setPositionByOrigin(new fabric.Point(t?c:o.x,n?u:o.y),"center","center"))}),e.on("before:render",function(){e.contextTop&&e.clearContext(e.contextTop)}),e.on("after:render",function(){t&&i(),n&&o()}),e.on("mouse:up",function(){t=n=null,e.renderAll()})}(this.canvas)}},{key:"_initSketch",value:function(){var e=this._template||{},t=e.width,n=e.height,r=new en.fabric.Rect({fill:"#ffffff",left:0,top:0,width:void 0===t?1242:t,height:void 0===n?1660:n,selectable:!1,hasControls:!1,hoverCursor:"default",id:eu,fabritor_desc:"\u6211\u7684\u753B\u677F by fabritor"});this.canvas.add(r),this.canvas.requestRenderAll(),this.sketch=r,this._initResizeObserver(),this._adjustSketch2Canvas()}},{key:"setSketchSize",value:function(e){this.sketch.set(e),this._adjustSketch2Canvas()}},{key:"_initResizeObserver",value:function(){var e=this,t=this._options.workspaceEl;this._resizeObserver=new ResizeObserver((0,r8.Z)(function(){e.canvas.setWidth(t.offsetWidth),e.canvas.setHeight(t.offsetHeight),e._adjustSketch2Canvas()},50)),this._resizeObserver.observe(t)}},{key:"_adjustSketch2Canvas",value:function(){var e,t,n=this,r=(e={width:this.canvas.width,height:this.canvas.height},(t={width:this.sketch.width,height:this.sketch.height}).width=100),n.setControlVisible("mb",r>=100)),n.setControlVisible("ml",i>=40),n.setControlVisible("mr",i>=40),e.canvas.requestRenderAll()),("f-line"===n.type||"f-arrow"===n.type||"f-tri-arrow"===n.type)&&nh(t)}})}},{key:"_editTextInGroup",value:function(e,t){var n=this,r=e.getObjects();t.on("editing:exited",function(){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:null;this.canvas.fire("fabritor:object:modified",e)}},{key:"_scrollSketch",value:function(e){var t=e.e.deltaY,n=this.canvas.getZoom();(n*=Math.pow(.999,t))>20&&(n=20),n<.01&&(n=.01);var r=this.canvas.getCenter();this.canvas.zoomToPoint({x:r.left,y:r.top},n),e.e.preventDefault(),e.e.stopPropagation()}},{key:"destroy",value:function(){this.canvas&&(this.canvas.dispose(),this.canvas=null),this.fhistory&&this.fhistory.dispose(),this.autoSave&&this.autoSave.dispose();var e=this._options.workspaceEl;this._resizeObserver&&(this._resizeObserver.unobserve(e),this._resizeObserver=null)}},{key:"export2Img",value:function(e){var t=this.canvas.viewportTransform;this.canvas.setViewportTransform([1,0,0,1,0,0]);var n=this.sketch,r=n.left,i=n.top,o=n.width,a=n.height,l=this.canvas.toDataURL((0,T._)({left:r,top:i,width:o,height:a,format:"png"},e));return this.canvas.setViewportTransform(t),l}},{key:"export2Svg",value:function(){var e=this.sketch,t=e.left,n=e.top,r=e.width,i=e.height,o=this.canvas.toSVG({width:r,height:i,viewBox:{x:t,y:n,width:r,height:i}});return"data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(o))}},{key:"canvas2Json",value:function(){var e=this.canvas.toJSON(eh);return e[eo]=3,e}},{key:"loadFromJSON",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this;return(0,w._)(function(){var r,i,o,a,l,s,c,u,h,f;return(0,Z.Jh)(this,function(d){switch(d.label){case 0:if(!e)return[2,!1];if("string"==typeof e)try{e=JSON.parse(e)}catch(p){return console.log(p),t&&Q.ZP.error("\u52A0\u8F7D\u672C\u5730\u6A21\u677F\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),[2,!1]}if(3!==e[eo])return console.warn("\u6B64\u6A21\u677F\u5DF2\u7ECF\u65E0\u6CD5\u4E0E\u5F53\u524D\u7248\u672C\u517C\u5BB9\uFF0C\u8BF7\u66F4\u6362\u6A21\u677F"),[2,!1];return[3,8];case 1:d.trys.push([1,6,7,8]),l=r[Symbol.iterator](),d.label=2;case 2:if(i=(s=l.next()).done)return[3,5];if("f-text"!==(c=s.value).type)return[3,4];return[4,ef(c.fontFamily)];case 3:d.sent(),d.label=4;case 4:return i=!0,[3,2];case 5:return[3,8];case 6:return u=d.sent(),o=!0,a=u,[3,8];case 7:try{i||null==l.return||l.return()}finally{if(o)throw a}return[7];case 8:return h=n.canvas.getActiveObject(),n.autoSave.setCanSave(!1),[2,new Promise(function(t){n.canvas.loadFromJSON(e,function(){n.canvas.requestRenderAll(),n.autoSave.setCanSave(!0),n.canvas.fire("fabritor:load:json",{lastActiveObject:f}),t(!0)},function(e,t){t.id===eu&&(n.sketch=t,n.setSketchSize({width:t.width,height:t.height})),t.id===(null==h?void 0:h.id)&&(f=t)})})]}})})()}},{key:"clearCanvas",value:function(){var e=this;return(0,w._)(function(){var t,n,r,i,o;return(0,Z.Jh)(this,function(a){switch(a.label){case 0:return n=(t=e.sketch).width,r=t.height,i=t.fabritor_desc,o='{"fabritor_schema_version":3,"version":"5.3.0","objects":[{"type":"rect","version":"5.3.0","originX":"left","originY":"top","left":0,"top":0,"width":'.concat(n,',"height":').concat(r,',"fill":"#ffffff","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"id":"fabritor-sketch","fabritor_desc":"').concat(i,'","selectable":false,"hasControls":false}],"clipPath":{"type":"rect","version":"5.3.0","originX":"left","originY":"top","left":0,"top":0,"width":').concat(n,',"height":').concat(r,',"fill":"#ffffff","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":true,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"stroke","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"selectable":true,"hasControls":true},"background":"#ddd"}'),[4,e.loadFromJSON(o)];case 1:return a.sent(),e.fhistory.reset(),[2]}})})()}}]),e}(),id=function(){var e=(0,k._)((0,x.useState)({left:0,top:0}),2),t=e[0],n=e[1],r=(0,k._)((0,x.useState)(""),2),i=r[0],o=r[1],a=(0,k._)((0,x.useState)(!1),2),l=a[0],s=a[1],c=(0,x.useContext)(_).editor,u=function(e){var t=e.target,r=e.e;n({left:r.pageX+16,top:r.pageY}),o("".concat(Math.round(t.angle),"\xb0")),s(!0)},h=function(){s(!1)};return(0,x.useEffect)(function(){c&&(c.canvas.on("object:rotating",u),c.canvas.on("mouse:up",h))},[c]),(0,y.tZ)("div",{style:(0,T._)({fontSize:12,position:"fixed",zIndex:9999,width:"max-content",display:l?"block":"none"},t),children:(0,y.tZ)(to.Z,{color:"rgba(0, 0, 0, 0.85)",children:i})})},ip=n(6724),iv=C.Z.Content,ig={background:"#ddd",width:"100%",height:"100%",overflow:"hidden",flex:1},ib={display:"flex",flexDirection:"column",height:"100%"};function iy(){var e,t=(0,x.useRef)(null),n=(0,x.useRef)(null),r=(0,x.useRef)(null),i=(0,k._)((0,x.useState)(null),2),o=i[0],a=i[1],l=(0,k._)((0,x.useState)(),2),s=l[0],c=l[1],u=(0,k._)((0,x.useState)(null),2),h=u[0],f=u[1],d=(0,k._)((0,x.useState)(!1),2),p=d[0],v=d[1],g=(0,x.useRef)(null),b=function(e){var t,n,r=e.target;if(!o.getIfPanEnable()){if(!r){null===(t=g.current)||void 0===t||t.hide();return}3===e.button?(r.id!==eu&&o.canvas.setActiveObject(r),setTimeout(function(){var e;null===(e=g.current)||void 0===e||e.show()},50)):null===(n=g.current)||void 0===n||n.hide()}},m=function(e){var t=e.selected,n=e.sketch;t&&t.length?f(o.canvas.getActiveObject()):f(n)},A=function(){f(o.canvas.getActiveObject())},j=function(e){var t=e.lastActiveObject;t&&(o.canvas.setActiveObject(t),f(t))},O=function(){o.canvas.on("selection:created",m),o.canvas.on("selection:updated",m),o.canvas.on("selection:cleared",m),o.canvas.on("mouse:down",b),o.canvas.on("fabritor:group",A),o.canvas.on("fabritor:ungroup",A),o.canvas.on("fabritor:load:json",j)},F=(e=(0,w._)(function(){var e;return(0,Z.Jh)(this,function(r){switch(r.label){case 0:return[4,(e=new ih({canvasEl:t.current,workspaceEl:n.current,sketchEventHandler:{groupHandler:function(){f(e.canvas.getActiveObject())}}})).init()];case 1:return r.sent(),a(e),v(!0),f(e.sketch),[2]}})}),function(){return e.apply(this,arguments)}),z=function(){c(ip.Z.svg(r.current))};return(0,x.useEffect)(function(){o&&(O(),z())},[o]),(0,x.useEffect)(function(){return F(),function(){o&&o.destroy()}},[]),(0,y.tZ)(_.Provider,{value:{object:h,setActiveObject:f,isReady:p,setReady:v,editor:o,roughSvg:s},children:(0,y.BX)(C.Z,{style:{height:"100%"},className:"fabritor-layout",children:[(0,y.tZ)(S.Z,{spinning:!p,fullscreen:!0}),(0,y.tZ)(id,{}),(0,y.tZ)(ez,{}),(0,y.BX)(C.Z,{children:[(0,y.tZ)(nP,{}),(0,y.tZ)(iv,{style:ib,children:(0,y.tZ)(nd,{ref:g,object:h,children:(0,y.tZ)("div",{style:ig,ref:n,className:"fabritor-workspace",children:(0,y.tZ)("canvas",{ref:t})})})}),(0,y.tZ)(r1,{})]}),(0,y.tZ)("svg",{id:"fabritor-rough-svg",ref:r})]})})}var im=(0,m.Cv)(function(){return{title:"fabritor, A creative editor based on fabricjs."}});function iw(){return(0,y.tZ)(iy,{})}},4960:function(){},6759:function(){},6272:function(){}}]); \ No newline at end of file