(self.webpackChunk=self.webpackChunk||[]).push([[5249],{83156:function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__,_typeof=__webpack_require__(31468).default;(function(){if("function"!=typeof window.GGBApplet){var isRenderGGBElementEnabled=!1,scriptLoadStarted=!1,html5AppletsToProcess=null,ggbHTML5LoadedCodebaseIsWebSimple=!1,ggbHTML5LoadedCodebaseVersion=null,ggbHTML5LoadedScript=null,GGBApplet=function(){"use strict";for(var e={},t="5.0",n={},o=null,i=!1,r=!1,a=null,l=!1,s=null,c=null,d=0;d4?parseFloat(e):5};function k(){try{return window.self!==window.top}catch(e){return!0}}function S(){return(!n.hasOwnProperty("screenshotGenerator")||!n.screenshotGenerator)&&Math.max(screen.width,screen.height)<800}e.setHTML5Codebase=function(e,t){c=e,R(e,t)},e.setJavaCodebase=e.setJavaCodebaseVersion=e.isCompiledInstalled=e.setPreCompiledScriptPath=e.setPreCompiledResourcePath=function(){},e.setHTML5CodebaseVersion=function(e,t){var n=parseFloat(e);NaN!==n&&n<5?console.log("The GeoGebra HTML5 codebase version "+n+" is deprecated. Using version latest instead."):(s=e,O(e,t))},e.getHTML5CodebaseVersion=function(){return m},e.getParameters=function(){return n},e.setFontsCSSURL=function(e){y=e},e.setGiacJSURL=function(e){},e.setJNLPFile=function(e){e},e.setJNLPBaseDir=function(e){},e.inject=function(){function t(){return window.frameElement&&window.frameElement.getAttribute("data-singleton")}for(var o,i="auto",r=n.id,a=!1,s=0;s=5)return!0;var t=e.getAppletObject();return!(!t||"function"!=typeof t.recalculateEnvironments)&&(t.recalculateEnvironments(),!0)},e.startAnimation=function(){var t=e.getAppletObject();return!(!t||"function"!=typeof t.startAnimation)&&(t.startAnimation(),!0)},e.stopAnimation=function(){var t=e.getAppletObject();return!(!t||"function"!=typeof t.stopAnimation)&&(t.stopAnimation(),!0)},e.getAppletObject=function(){var e=void 0!==n.id?n.id:"ggbApplet";return window[e]},e.resize=function(){};var C=function(e){return e&&"false"!==e},P=function(t,n,o){x(m)<=4.2&&(o=!0);var i=!isRenderGGBElementEnabled&&!scriptLoadStarted;(!isRenderGGBElementEnabled&&!scriptLoadStarted||ggbHTML5LoadedCodebaseVersion!==m||ggbHTML5LoadedCodebaseIsWebSimple&&!w)&&(i=!0,isRenderGGBElementEnabled=!1,scriptLoadStarted=!1);var r=document.createElement("div");r.classList.add("appletParameters","notranslate");var a=n.width,l=n.height;if(n.disableAutoScale=void 0===n.disableAutoScale?GGBAppletUtils.isFlexibleWorksheetEditor():n.disableAutoScale,void 0!==n.width)if(x(m)<=4.4)C(n.showToolBar)&&(n.height-=7),C(n.showAlgebraInput)&&(n.height-=37),n.width<605&&C(n.showToolBar)&&(n.width=605,a=605);else{var d=100;(C(n.showToolBar)||C(n.showMenuBar))&&(n.hasOwnProperty("customToolBar")&&(n.customToolbar=n.customToolBar),d=C(n.showMenuBar)?245:155),a=5?(n.appletOnLoad=function(e){var n=t.querySelector(".ggb_preview");n&&n.parentNode.removeChild(n),window.GGBT_spinner&&window.GGBT_spinner.removeSpinner(v),window.GGBT_wsf_view&&$(window).trigger("resize"),p(e)},b||v.appendChild(k)):r.appendChild(k),v.appendChild(r),b||t.appendChild(v),setTimeout((function(){e.resize()}),1)}function S(e,t){t&&"function"==typeof t.appletOnLoad&&"function"==typeof renderGGBElement?renderGGBElement(e,t.appletOnLoad):renderGGBElement(e),F("GeoGebra HTML5 applet injected and rendered with previously loaded codebase.",t)}function _(e,t){"undefined"==typeof renderGGBElement?(null===html5AppletsToProcess&&(html5AppletsToProcess=[]),html5AppletsToProcess.push({article:e,params:t}),window.renderGGBElementReady=function(){isRenderGGBElementEnabled=!0,null!==html5AppletsToProcess&&html5AppletsToProcess.length&&(html5AppletsToProcess.forEach((function(e){S(e.article,e.params)})),html5AppletsToProcess=null)},x(m)<5&&(e.className+=" geogebraweb")):S(e,t)}if(i){scriptLoadStarted=!0;for(var B=0;B0?(i.remove(),l.attr("id","fullscreencontent").show(),jQuery(r).append(l),window.dispatchEvent(new Event("resize"))):P(i,t,!1),window.GGBT_wsf_view.launchFullScreen(r)}else h=o,P(e,t,!1);if(!window.GGBT_wsf_view)for(a=0;ae/4*3&&(l=e/4*3),s=l/5.8,a.setAttribute("src",b),a.setAttribute("width",l),a.setAttribute("height",s);var d=(e-l)/2,u=(t-s)/2;a.style.left=d+"px",a.style.top=u+"px",i.appendChild(a)}return i.appendChild(c),i},M=function(e){return"html5"===(e=e.toLowerCase())||"screenshot"===e?e:"html5"},G=["web","webSimple","web3d","tablet","tablet3d","phone"],O=function(e,t){if(m=e,t)R(m,!0);else{var r,a,l=!i;if(l){var s=x(m);!isNaN(s)&&s<4.4&&(l=!1)}r="http"===window.location.protocol.substr(0,4)?window.location.protocol:"http:";var c=m.indexOf("//");for(var d in a=c>0?m:0===c?r+m:"https://www.geogebra.org/apps/5.2.814.0/",G)if(m.slice(-1*G[d].length)===G[d]||m.slice(-1*(G[d].length+1))===G[d]+"/")return void R(a,!1);GGBAppletUtils.isFlexibleWorksheetEditor()||!l||o.is3D||o.AV||o.SV||o.CV||o.EV2||o.CP||o.PC||o.DA||o.FI||o.PV||C(n.showToolBar)||C(n.showMenuBar)||C(n.showAlgebraInput)||C(n.enableRightClick)||n.appName&&"classic"!=n.appName?a+="web3d/":a+="webSimple/",R(a,!1)}},R=function(e,t){if(e.requirejs)f=e;else{"/"!==e.slice(-1)&&(e+="/"),f=e,null===t&&(t=-1===e.indexOf("http")),p=t,g="web.nocache.js",w=!1;var n=f.split("/");n.length>1&&(t||"webSimple"!==n[n.length-2]?G.indexOf(n[n.length-2])>=0&&(g=n[n.length-2]+".nocache.js"):(g="webSimple.nocache.js",w=!0)),n=e.split("/"),"test"===(m=n[n.length-3]).substr(0,4)?m=m.substr(4,1)+"."+m.substr(5,1):"war"!==m.substr(0,3)&&"beta"!==m.substr(0,4)||(m="5.0");var o=parseFloat(m);NaN!==o&&o<5&&e.indexOf("geogebra.org")>=0&&(console.log("The GeoGebra HTML5 codebase version "+o+" is deprecated. Using version latest instead."),O("5.0",t))}},F=function(e,t){window.console&&window.console.log&&(!t||void 0===t.showLogging||t.showLogging&&"false"!==t.showLogging)&&console.log(e)};function D(){var e=t;null!==s?e=s:parseFloat(e)<5&&(e="5.0"),O(e,!1),null!==c&&R(c,p),l=!0}return void 0!==n.material_id?_(D):D(),e},GGBAppletUtils=function(){"use strict";function e(){return void 0!==window.GGBT_wsf_edit}function t(e,t){1!=t?(e.style.transformOrigin="0% 0% 0px",e.style.webkitTransformOrigin="0% 0% 0px",e.style.transform="scale("+t+","+t+")",e.style.webkitTransform="scale("+t+","+t+")",e.style.maxWidth="initial",null!==e.querySelector(".ggb_preview")&&(e.querySelector(".ggb_preview").style.maxWidth="initial"),void 0!==e.querySelectorAll(".ggb_preview img")[0]&&(e.querySelectorAll(".ggb_preview img")[0].style.maxWidth="initial"),void 0!==e.querySelectorAll(".ggb_preview img")[1]&&(e.querySelectorAll(".ggb_preview img")[1].style.maxWidth="initial")):(e.style.transform="none",e.style.webkitTransform="none")}function n(e,t,n,o,i){if(e.isScreenshoGenerator)return 1;var r,a=void 0!==o&&o,l=null!=e.noScaleMargin&&e.noScaleMargin,s=(r=e.autoHeight)&&"false"!==r,c=function(e,t,n,o,i,r){var a=null;if(null!=r&&""!=r)for(var l=e.parentNode;null!=l;){if((" "+l.className+" ").indexOf(" "+r+" ")>-1){a=l;break}l=l.parentNode}var s=0,c=0,d=0,u=0,f=0,p=0,h=0;if(a)s=a.offsetWidth,c=Math.max(o?a.offsetWidth:0,a.offsetHeight);else{if(window.innerWidth&&document.documentElement.clientWidth?(s=Math.min(window.innerWidth,document.documentElement.clientWidth),c=Math.min(window.innerHeight,document.documentElement.clientHeight),d=s):(s=window.innerWidth,c=window.innerHeight,d=window.innerWidth),e){var m=e.getBoundingClientRect();m.left>0&&m.left<=s&&(void 0===i||!i)&&("rtl"===document.dir?(f=s-m.width-m.left,p=d<=480?10:30):(p=m.left,f=d<=480?10:30),u=p+f)}e&&"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&(e.getBoundingClientRect(),"closePositionRight"===window.GGBT_wsf_view.getCloseBtnPosition()?(u=40,h=0):"closePositionTop"===window.GGBT_wsf_view.getCloseBtnPosition()&&(u=0,h=40))}return e&&((void 0===n||!n)&&t>0&&t+u1&&(a=!0)),t&&"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&(a=!0),e.hasOwnProperty("disableAutoScale")&&e.disableAutoScale?r:(i=n(e,t,a,o,e.scaleContainerClass),!a||e.hasOwnProperty("scale")&&1!==r?Math.min(r,i):i)}function i(e){var t=Math.min(window.innerWidth,document.documentElement.clientWidth),n=Math.min(window.innerHeight,document.documentElement.clientHeight),o=e.getBoundingClientRect(),i=(t-o.width)/2,r=(n-o.height)/2;r<0&&(r=0),e.style.position="relative","closePositionRight"===window.GGBT_wsf_view.getCloseBtnPosition()?(e.style.left=i<40?"40px":i+"px",e.style.top=r+"px"):"closePositionTop"===window.GGBT_wsf_view.getCloseBtnPosition()&&(e.style.top=r<40?"40px":r+"px",e.style.left=i+"px")}return{responsiveResize:function(n,r){var a=n.querySelector(".appletParameters");if(a){if("object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()){if(r.id!==a.getAttribute("data-param-id"))return;window.GGBT_wsf_view.setCloseBtnPosition(n)}if(a.parentElement&&/fullscreen/.test(a.parentElement.className))return;var l=o(r,n);e()&&a.setAttribute("data-param-scale",l);for(var s=null,c=0;c=O)continue;if(j==jb){if(k=i.getAttribute(kb),k){var l,m=k.indexOf(lb);m>=O?(j=k.substring(O,m),l=k.substring(m+P)):(j=k,l=W),c[j]=l}}else if(j==mb){if(k=i.getAttribute(kb),k)try{d=eval(k)}catch(e){alert(nb+k+ob)}}else if(j==pb&&(k=i.getAttribute(kb),k))try{e=eval(k)}catch(e){alert(nb+k+qb)}}}__gwt_getMetaProperty=function(e){var t=c[e];return null==t?null:t},r=d,webModule.__errFn=e}function B(){function e(e){var t=e.lastIndexOf(rb);-1==t&&(t=e.length);var n=e.indexOf(sb);-1==n&&(n=e.length);var o=e.lastIndexOf(tb,Math.min(n,t));return o>=O?e.substring(O,o+P):W}var t,n=null!=(t=__gwt_getMetaProperty(wb))?t:W;return n==W&&(n=function(){for(var t=o.getElementsByTagName(_),n=O;nO?e[e.length-P].href:W}()),n==W&&function(){var e=o.location;return e.href==e.protocol+zb+e.host+e.pathname+e.search+e.hash}()&&(n=e(o.location.href)),n=function(t){if(t.match(/^\w+:\/\//));else{var n=o.createElement(ub);n.src=t+vb,t=e(n.src)}return t}(n),n}function C(e){return e.match(/^\//)||e.match(/^[a-zA-Z]+:\/\//)?e:webModule.__moduleBase+e}function D(){var e,t=O,o=[],i=[];function a(e){var t=i[e](),n=o[e];if(t in n)return t;var a=[];for(var l in n)a[n[l]]=l;throw r&&r(e,a,t),null}if(__gwt_isKnownPropertyValue=function(e,t){return t in o[e]},webModule.__getPropMap=function(){var e={};for(var t in o)o.hasOwnProperty(t)&&(e[t]=a(t));return e},webModule.__computePropValue=a,n.__gwt_activeModules[L].bindings=webModule.__getPropMap,p())return C(Bb);try{var l=(e=Cb).indexOf(Db);-1!=l&&(t=parseInt(e.substring(l+P),$),e=e.substring(O,l))}catch(e){}return webModule.__softPermutationId=t,C(e+Eb)}function F(){n.__gwt_stylesLoaded||(n.__gwt_stylesLoaded={})}s[L]={moduleName:L},webModule.__moduleStartupDone=function(e){var t=s[L].bindings;s[L].bindings=function(){for(var n=t?t():{},o=e[webModule.__softPermutationId],i=O;i0){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"",n=[],o=0;o0){for(var o=a.elt(l-1);null!==o&&o.isTreeExpanded&&!o.isTreeLeaf;){o=this._sortTreeChildrenByY(o).last()}null!==o&&e.select(o)}else e.select(r)}else if("Down"===n.key){var i;if(t.isTreeExpanded&&!t.isTreeLeaf)null!==(i=this._sortTreeChildrenByY(t).first())&&e.select(i);else for(;null!==t;){var r,a,l;if(null===(r=t.findTreeParentNode()))break;if((l=(a=this._sortTreeChildrenByY(r)).indexOf(t))o.y?1:n.xo.x?1:0})),t},D.prototype.copyToClipboard=function(e){go.CommandHandler.prototype.copyToClipboard.call(this,e),this._lastPasteOffset.set(this.pasteOffset)},D.prototype.pasteFromClipboard=function(){var e=go.CommandHandler.prototype.pasteFromClipboard.call(this);return this.diagram.moveParts(e,this._lastPasteOffset),this._lastPasteOffset.add(this.pasteOffset),e},Object.defineProperty(D.prototype,"arrowKeyBehavior",{get:function(){return this._arrowKeyBehavior},set:function(e){if("move"!==e&&"select"!==e&&"scroll"!==e&&"tree"!==e&&"none"!==e)throw new Error('DrawCommandHandler.arrowKeyBehavior must be either "move", "select", "scroll", "tree", or "none", not: '+e);this._arrowKeyBehavior=e}}),Object.defineProperty(D.prototype,"pasteOffset",{get:function(){return this._pasteOffset},set:function(e){if(!(e instanceof go.Point))throw new Error("DrawCommandHandler.pasteOffset must be a Point, not: "+e);this._pasteOffset.set(e)}});var I=D,H=(n(15379),n(85160)),W=n(43418),Z=n(43604),z=n(79311),V="myPaletteDiv___Xjz2I",q="maxH60___Pd4Re";window.go=F;var U=function(e){var t=e.onCancel,n=e.callback,o=(0,c.useRef)(),i=(0,c.useRef)(),r=(0,c.useRef)(),l=(0,c.useRef)(!1),s=(0,c.useRef)(!1),d=(0,c.useState)(0),u=a()(d,2),f=u[0],p=u[1],m=function(){var e=G()(A()().mark((function e(){var t,i;return A()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.current.makeImage(),e.next=3,(0,z.ZP)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:Date.now(),file:t.src}});case 3:i=e.sent,n({src:i.url});case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){p(f+1)}),[]),(0,h.jsx)("div",{ref:s,className:l.current?"".concat(q," body-overflow-initial"):"body-overflow-initial",children:(0,h.jsx)(W.Z,{width:1200,icon:null,footer:null,closable:!0,visible:!!f,destroyOnClose:!0,maskClosable:!1,getContainer:s.current,rootClassName:"zIndex-9999",title:(0,h.jsxs)(E.Z,{children:[(0,h.jsx)(Z.Z,{flex:1,children:"插入流程图"}),(0,h.jsx)(Z.Z,{onClick:function(){l.current=!l.current,p(f+1)},children:(0,h.jsx)("span",{className:"current c-blue mr30",style:{fontWeight:400},children:"展开/收起"})})]}),onCancel:t,children:(0,h.jsxs)("div",{style:{width:"100%",height:"80vh",overflow:"hidden",position:"relative"},children:[(0,h.jsxs)("div",{style:{display:"flex",height:"100%"},children:[(0,h.jsxs)("div",{style:{width:"300px",height:"100%"},children:[(0,h.jsx)("div",{style:{background:"#fff",position:"relative",zIndex:12,fontSize:16,color:"#3061d0"},children:"图形库"}),(0,h.jsx)("div",{style:{height:"calc(100% - 50px)"},className:V,ref:r})]}),(0,h.jsxs)("div",{style:{flex:1,position:"relative"},children:[(0,h.jsx)(H.FI,{initDiagram:function(){var e=F.GraphObject.make,t="#ff3333",n="#3358ff",a="#25ad23",l="#d533ff",s="#7d33ff",c="#ff6233",d="#ffffff",u="#000000",f="#fffcd5",p="#d5ebff",h="#f2dfe0",m="#a5d2fa",g="#cccccc",w="#b3e6b3",v="#fcbbbd";function b(t,n){var o=function(e,n){e.handled=!0,e.diagram.model.commit((function(o){var i=n.part.adornedPart,r=(new F.Point).setRectSpot(i.actualBounds,t);r.subtract(i.location),r.scale(2,2),r.x+=130*Math.sign(r.x),r.y+=130*Math.sign(r.y),r.add(i.location),r.snapToGridPoint(e.diagram.grid.gridOrigin,e.diagram.grid.gridCellSize);var a=o.copyNodeData(i.data);o.setGroupKeyForNodeData(a,o.getGroupKeyForNodeData(i.data)),o.addNodeData(a);var l={from:i.key,to:o.getKeyForNodeData(a)};o.addLinkData(l);var s=e.diagram.findNodeForData(a);s.location=r,e.diagram.select(s),setTimeout((function(){e.diagram.commandHandler.editTextBlock()}),20)}))};return e(F.Shape,{figure:n,alignment:t,alignmentFocus:t.opposite(),width:t.equals(F.Spot.Top)||t.equals(F.Spot.Bottom)?25:18,height:t.equals(F.Spot.Top)||t.equals(F.Spot.Bottom)?18:25,fill:"orange",stroke:d,strokeWidth:4,mouseEnter:function(e,t){return t.fill="dodgerblue"},mouseLeave:function(e,t){return t.fill="orange"},isActionable:!0,click:o,contextClick:o})}function y(t){return e(F.Shape,{fill:"orange",stroke:"rgba(0, 0, 0, 0)",strokeWidth:15,background:"transparent",geometryString:"F1 M0 0 b 0 360 -4 0 4 z M10 0 b 0 360 -4 0 4 z M20 0 b 0 360 -4 0 4",isActionable:!0,cursor:"context-menu",mouseEnter:function(e,t){return t.fill="dodgerblue"},mouseLeave:function(e,t){return t.fill="orange"},click:function(e,t){e.diagram.commandHandler.showContextMenu(t.part.adornedPart)}},t||{})}function x(e,t){return function(n,o){n.handled=!0,n.diagram.model.commit((function(n){n.set(o.part.adornedPart.data,e,t)}))}}function k(t,n){return n||(n="color"),e(F.Shape,{width:16,height:16,stroke:"lightgray",fill:t,margin:1,background:"transparent",mouseEnter:function(e,t){return t.stroke="dodgerblue"},mouseLeave:function(e,t){return t.stroke="lightgray"},click:x(n,t),contextClick:x(n,t)})}function S(){return[e("ContextMenuButton",e(F.Panel,"Horizontal",k(d,"fill"),k(f,"fill"),k(p,"fill"),k(h,"fill"))),e("ContextMenuButton",e(F.Panel,"Horizontal",k(g,"fill"),k(w,"fill"),k(m,"fill"),k(v,"fill")))]}function _(){return[e("ContextMenuButton",e(F.Panel,"Horizontal",k(u),k(a),k(n),k(t))),e("ContextMenuButton",e(F.Panel,"Horizontal",k(d),k(l),k(s),k(c)))]}function B(t,n){return n||(n="thickness"),e(F.Shape,"LineH",{width:16,height:16,strokeWidth:t,margin:1,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:x(n,t),contextClick:x(n,t)})}function T(t,n){return n||(n="dash"),e(F.Shape,"LineH",{width:24,height:16,strokeWidth:2,strokeDashArray:t,margin:1,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:x(n,t),contextClick:x(n,t)})}function C(){return[e("ContextMenuButton",e(F.Panel,"Horizontal",B(1),B(2),B(3),B(4))),e("ContextMenuButton",e(F.Panel,"Horizontal",T(null),T([2,4]),T([4,4])))]}function P(t,n){return n||(n="figure"),e(F.Shape,{width:32,height:32,scale:.5,fill:"lightgray",figure:t,margin:1,background:"transparent",mouseEnter:function(e,t){return t.fill="dodgerblue"},mouseLeave:function(e,t){return t.fill="lightgray"},click:x(n,t),contextClick:x(n,t)})}function E(t){return e(F.Shape,{stroke:"dodgerblue",strokeWidth:2,strokeCap:"square",geometryString:"M0 0 M4 2 H3 M4 "+(t+4).toString()+" H3"})}function L(t){var n="M0 0 M8 16 M0 8 L16 8 M12 11 L16 8 L12 5";return 0===t?n="M0 0 M16 16 M0 8 L16 8":2===t&&(n="M0 0 M16 16 M0 8 L16 8 M12 11 L16 8 L12 5 M4 11 L0 8 L4 5"),e(F.Shape,{geometryString:n,margin:2,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:x("dir",t),contextClick:x("dir",t)})}function N(t){var n=function(e,n){e.handled=!0,e.diagram.model.commit((function(e){var o=n.part.adornedPart;e.set(o.data,t?"toSpot":"fromSpot",F.Spot.stringify(F.Spot.AllSides)),(t?o.toNode:o.fromNode).invalidateConnectedLinks()}))};return e(F.Shape,{width:12,height:12,fill:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:n,contextClick:n})}function j(t,n){var o=0,i=F.Spot.RightSide;t.equals(F.Spot.Top)?(o=270,i=F.Spot.TopSide):t.equals(F.Spot.Left)?(o=180,i=F.Spot.LeftSide):t.equals(F.Spot.Bottom)&&(o=90,i=F.Spot.BottomSide),n||(o-=180);var r=function(e,t){e.handled=!0,e.diagram.model.commit((function(e){var o=t.part.adornedPart;e.set(o.data,n?"toSpot":"fromSpot",F.Spot.stringify(i)),(n?o.toNode:o.fromNode).invalidateConnectedLinks()}))};return e(F.Shape,{alignment:t,alignmentFocus:t.opposite(),geometryString:"M0 0 M12 12 M12 6 L1 6 L4 4 M1 6 L4 8",angle:o,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:r,contextClick:r})}return o.current=new F.Diagram(i.current,{padding:20,grid:e(F.Panel,"Grid",e(F.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(F.Shape,"LineV",{stroke:"lightgray",strokeWidth:.5})),"draggingTool.isGridSnapEnabled":!0,handlesDragDropForTopLevelParts:!0,mouseDrop:function(e){e.diagram.commandHandler.addTopLevelParts(e.diagram.selection,!0)||e.diagram.currentTool.doCancel()},commandHandler:e(I),"clickCreatingTool.archetypeNodeData":{text:"未命名",fill:null,stroke:null,borderColor:"rgba(0,0,0,0)"},PartCreated:function(e){var t=e.subject;t.location=t.location.copy().snapToGridPoint(e.diagram.grid.gridOrigin,e.diagram.grid.gridCellSize),setTimeout((function(){e.diagram.commandHandler.editTextBlock()}),20)},"commandHandler.archetypeGroupData":{isGroup:!0,text:"NEW GROUP"},SelectionGrouped:function(e){e.subject;setTimeout((function(){e.diagram.commandHandler.editTextBlock()}))},LinkRelinked:function(e){e.parameter.part.invalidateConnectedLinks();var t=e.subject;e.diagram.toolManager.linkingTool.isForwards?t.toNode.invalidateConnectedLinks():t.fromNode.invalidateConnectedLinks()},"undoManager.isEnabled":!0}),o.current.nodeTemplate=e(F.Node,"Auto",{locationSpot:F.Spot.Center,locationObjectName:"SHAPE",desiredSize:new F.Size(120,60),minSize:new F.Size(40,40),resizable:!0,resizeCellSize:new F.Size(10,10),rotatable:!0},new F.Binding("location","loc",F.Point.parse).makeTwoWay(F.Point.stringify),new F.Binding("desiredSize","size",F.Size.parse).makeTwoWay(F.Size.stringify),e(F.Shape,{name:"SHAPE",fill:d,cursor:"pointer",portId:"",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:F.Spot.AllSides,toSpot:F.Spot.AllSides},new F.Binding("figure"),new F.Binding("fill"),new F.Binding("stroke","borderColor"),new F.Binding("strokeWidth","thickness"),new F.Binding("strokeDashArray","dash")),e(F.Shape,{width:100,height:20,strokeWidth:0,fill:"transparent"}),e(F.TextBlock,{margin:1,textAlign:"center",overflow:F.TextBlock.OverflowEllipsis,editable:!0},new F.Binding("text").makeTwoWay(),new F.Binding("stroke","color"))),o.current.nodeTemplate.toolTip=e("ToolTip",e(F.Panel,"Vertical",{maxSize:new F.Size(200,NaN)},e(F.TextBlock,{font:"bold 10pt sans-serif",textAlign:"center"},new F.Binding("text")),e(F.TextBlock,{font:"10pt sans-serif",textAlign:"center"},new F.Binding("text","details")))),o.current.nodeTemplate.selectionAdornmentTemplate=e(F.Adornment,"Spot",e(F.Placeholder,{padding:10}),b(F.Spot.Top,"TriangleUp"),b(F.Spot.Left,"TriangleLeft"),b(F.Spot.Right,"TriangleRight"),b(F.Spot.Bottom,"TriangleDown"),y({alignment:new F.Spot(.75,0)})),o.current.nodeTemplate.contextMenu=e("ContextMenu",e("ContextMenuButton",e(F.Panel,"Horizontal",P("Rectangle"),P("RoundedRectangle"),P("Ellipse"),P("Diamond"))),e("ContextMenuButton",e(F.Panel,"Horizontal",P("Parallelogram2"),P("ManualOperation"),P("Procedure"),P("Cylinder1"))),e("ContextMenuButton",e(F.Panel,"Horizontal",P("Terminator"),P("CreateRequest"),P("Document"),P("TriangleDown"))),S(),_(),C()),o.current.groupTemplate=e(F.Group,"Spot",{layerName:"Background",ungroupable:!0,locationSpot:F.Spot.Center,selectionObjectName:"BODY",computesBoundsAfterDrag:!0,handlesDragDropForMembers:!0,mouseDrop:function(e,t){t.addMembers(t.diagram.selection,!0)||t.diagram.currentTool.doCancel()},avoidable:!1},new F.Binding("location","loc",F.Point.parse).makeTwoWay(F.Point.stringify),e(F.Panel,"Auto",{name:"BODY"},e(F.Shape,{parameter1:10,fill:d,strokeWidth:2,cursor:"pointer",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:F.Spot.AllSides,toSpot:F.Spot.AllSides},new F.Binding("fill"),new F.Binding("stroke","color"),new F.Binding("strokeWidth","thickness"),new F.Binding("strokeDashArray","dash")),e(F.Placeholder,{background:"transparent",margin:20})),e(F.TextBlock,{alignment:F.Spot.Top,alignmentFocus:F.Spot.Bottom,font:"bold 12pt sans-serif",editable:!0},new F.Binding("text"),new F.Binding("stroke","color"))),o.current.groupTemplate.selectionAdornmentTemplate=e(F.Adornment,"Spot",e(F.Panel,"Auto",e(F.Shape,{fill:null,stroke:"dodgerblue",strokeWidth:3}),e(F.Placeholder,{margin:1.5})),y({alignment:F.Spot.TopRight,alignmentFocus:F.Spot.BottomRight})),o.current.groupTemplate.contextMenu=e("ContextMenu",S(),_(),C()),o.current.linkTemplate=e(F.Link,{layerName:"Foreground",routing:F.Link.AvoidsNodes,corner:10,fromShortLength:10,toShortLength:15,relinkableFrom:!0,relinkableTo:!0,reshapable:!0,resegmentable:!0},new F.Binding("fromSpot","fromSpot",F.Spot.parse),new F.Binding("toSpot","toSpot",F.Spot.parse),new F.Binding("fromShortLength","dir",(function(e){return e>=1?10:0})),new F.Binding("toShortLength","dir",(function(e){return e>=1?10:0})),new F.Binding("points").makeTwoWay(),e(F.Shape,{strokeWidth:2},new F.Binding("stroke","color"),new F.Binding("strokeWidth","thickness"),new F.Binding("strokeDashArray","dash")),e(F.Shape,{segmentIndex:0,segmentOffset:new F.Point(15,0),segmentOrientation:F.Link.OrientAlong,alignmentFocus:F.Spot.Right,figure:"circle",width:10,strokeWidth:0},new F.Binding("fill","color"),new F.Binding("visible","dir",(function(e){return 1===e}))),e(F.Shape,{segmentIndex:-1,segmentOffset:new F.Point(-10,6),segmentOrientation:F.Link.OrientPlus90,alignmentFocus:F.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new F.Binding("fill","color"),new F.Binding("visible","dir",(function(e){return e>=1})),new F.Binding("width","thickness",(function(e){return 7+3*e})),new F.Binding("height","thickness",(function(e){return 7+3*e})),new F.Binding("segmentOffset","thickness",(function(e){return new F.Point(-15,4+1.5*e)}))),e(F.Shape,{segmentIndex:0,segmentOffset:new F.Point(15,-6),segmentOrientation:F.Link.OrientMinus90,alignmentFocus:F.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new F.Binding("fill","color"),new F.Binding("visible","dir",(function(e){return 2===e})),new F.Binding("width","thickness",(function(e){return 7+3*e})),new F.Binding("height","thickness",(function(e){return 7+3*e})),new F.Binding("segmentOffset","thickness",(function(e){return new F.Point(-15,4+1.5*e)}))),e(F.TextBlock,{alignmentFocus:new F.Spot(0,1,-4,0),editable:!0},new F.Binding("text").makeTwoWay(),new F.Binding("stroke","color"))),o.current.linkTemplate.selectionAdornmentTemplate=e(F.Adornment,e(F.Shape,{isPanelMain:!0,stroke:"transparent",strokeWidth:6,pathPattern:E(2)},new F.Binding("pathPattern","thickness",E)),y({alignmentFocus:new F.Spot(0,0,-6,-4)})),o.current.linkTemplate.contextMenu=e("ContextMenu",_(),C(),e("ContextMenuButton",e(F.Panel,"Horizontal",L(0),L(1),L(2))),e("ContextMenuButton",e(F.Panel,"Horizontal",e(F.Panel,"Spot",N(!1),j(F.Spot.Top,!1),j(F.Spot.Left,!1),j(F.Spot.Right,!1),j(F.Spot.Bottom,!1)),e(F.Panel,"Spot",{margin:new F.Margin(0,0,0,2)},N(!0),j(F.Spot.Top,!0),j(F.Spot.Left,!0),j(F.Spot.Right,!0),j(F.Spot.Bottom,!0))))),new F.Palette(r.current,{maxSelectionCount:1,linkTemplate:e(F.Link,{locationSpot:F.Spot.Center,selectionAdornmentTemplate:e(F.Adornment,"Link",{locationSpot:F.Spot.Center},e(F.Shape,{isPanelMain:!0,fill:null,stroke:"deepskyblue",strokeWidth:0}),e(F.Shape,{toArrow:"Standard",stroke:null}))},{routing:F.Link.AvoidsNodes,curve:F.Link.JumpOver,corner:5,toShortLength:4},new F.Binding("points"),e(F.Shape,{isPanelMain:!0,strokeWidth:2}),e(F.Shape,{toArrow:"Standard",stroke:null})),model:new F.GraphLinksModel([{text:"未命名",size:"100 100",fill:null,stroke:"#000"}].concat(R()(F.Shape.getFigureGenerators().toArray().map((function(e){return{text:"未命名",size:"100 100",figure:e.key,fill:"white",stroke:"#666",borderColor:"#000"}})))))}).nodeTemplate=e(F.Node,"Auto",{locationSpot:F.Spot.Center},new F.Binding("location","location",F.Point.parse).makeTwoWay(F.Point.stringify),e(F.Shape,"Circle",{fill:"white",stroke:"gray",strokeWidth:2,width:20,height:20,portId:"",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromLinkableSelfNode:!0,toLinkableSelfNode:!0},new F.Binding("stroke").makeTwoWay(),new F.Binding("fill").makeTwoWay(),new F.Binding("figure")),e(F.TextBlock,{margin:new F.Margin(5,5,3,5),font:"10pt sans-serif",minSize:new F.Size(16,16),maxSize:new F.Size(10,NaN),textAlign:"center",editable:!0},new F.Binding("key").makeTwoWay())),setTimeout((function(){o.current.grid=e(F.Panel,"Grid",e(F.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(F.Shape,"LineV",{stroke:"lightgray",strokeWidth:.5})),o.current.grid.visible=!0,o.current.grid.gridCellStroke="darkgray",o.current.grid.gridCellStrokeWidth=1}),300),window.myDiagrams=o.current,o.current},divClassName:"diagram-component",style:{height:"80vh"}}),(0,h.jsx)("div",{ref:i})]})]}),(0,h.jsx)("div",{className:"tr",children:(0,h.jsx)(_.ZP,{size:"large",onClick:m,style:{position:"absolute",right:0,bottom:0,zIndex:8},type:"primary",children:"保存到编辑器"})})]})})})},K=n(5112),Y=n(94001),J=K.ZP.Group,X={margin:"0 8px"},$=function(e){var t=e.callback,n=e.onCancel;return(0,h.jsxs)(k.Z,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){t(e)},children:[(0,h.jsxs)("div",{className:"flex-container",style:{alignItems:"baseline"},children:[(0,h.jsx)("span",{style:X,children:"单元格数:"}),(0,h.jsx)("span",{style:X,children:"行数"}),(0,h.jsx)(k.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,h.jsx)(Y.Z,{})}),(0,h.jsx)("span",{style:X,children:"列数"}),(0,h.jsx)(k.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,h.jsx)(Y.Z,{})})]}),(0,h.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,h.jsx)("span",{style:X,children:"对齐方式:"}),(0,h.jsx)(k.Z.Item,{name:"align",children:(0,h.jsxs)(J,{children:[(0,h.jsx)(K.ZP,{value:"default",children:(0,h.jsx)("i",{className:"fa fa-align-justify"})}),(0,h.jsx)(K.ZP,{value:"left",children:(0,h.jsx)("i",{className:"fa fa-align-left"})}),(0,h.jsx)(K.ZP,{value:"center",children:(0,h.jsx)("i",{className:"fa fa-align-center"})}),(0,h.jsx)(K.ZP,{value:"right",children:(0,h.jsx)("i",{className:"fa fa-align-right"})})]})})]}),(0,h.jsxs)("div",{className:"flex-container flex-end",children:[(0,h.jsx)(_.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,h.jsx)(_.ZP,{type:"ghost",onClick:n,children:"取消"})]})]})},Q=n(78673),ee=n(83156),te=n.n(ee),ne=(0,c.forwardRef)((function(e,t){var n=e.use3d,o=e.width,i=e.height,r=e.callback,l=(e.showSaveButton,(0,c.useRef)()),s=(0,c.useRef)(),d=(0,c.useState)(!1),u=a()(d,2),f=u[0],p=u[1],m=(0,c.useRef)({id:l,appName:"graphing",width:o||1e3,height:i||600,showToolBar:!0,showMenuBar:!0,allowStyleBar:!0,showAlgebraInput:!0,enableLabelDrags:!1,enableShiftDragZoom:!0,showToolBarHelp:!1,errorDialogsActive:!0,showTutorialLink:!0,showLogging:!0,useBrowserForJS:!1});(0,c.useEffect)((function(){s.current=new(te())(m.current,!0),window.onload=function(){s.current.inject("applet_container")}}),[]);var g=function(){var e=window.ggbApplet.getPNGBase64(1,!0,72);return r&&r(e),e};return(0,c.useEffect)((function(){m.current.appName=f?"3D":"graphing",s.current.inject("applet_container")}),[f]),(0,c.useEffect)((function(){p(n)}),[n]),(0,c.useImperativeHandle)(t,(function(){return{getImgData:g}})),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{style:{width:"100%",height:"100%"},id:"applet_container",ref:l}),(0,h.jsxs)(E.Z,{align:"middle",children:[(0,h.jsx)(Z.Z,{flex:1,children:(0,h.jsx)(Q.Z,{size:"default",checkedChildren:"关闭3D图像",unCheckedChildren:"开启3D图像",checked:f,onChange:function(e){return p(e)}})}),(0,h.jsx)(Z.Z,{children:(0,h.jsx)(_.ZP,{size:"large",onClick:g,style:{zIndex:8,marginTop:10},type:"primary",children:"保存到编辑器"})})]})]})})),oe=n(97618),ie=n(15309),re=n(8591),ae="link",le="upload-image",se="add-flowchart",ce="draw-image",de="code-block",ue="add-table",fe="------------",pe={default:fe,left:":".concat(fe),center:":".concat(fe,":"),right:"".concat(fe,":")},he=n(70325);var me="@▁▁@",ge=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"];function we(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var ve=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",be=s()(s()({},ve+"-B","bold"),ve+"-I","italic"),ye=s()(s()(s()(s()(s()(s()(s()(s()({},ae,"添加链接"),de,"添加代码块"),le,"添加图片"),ce,"添加画图"),se,"插入流程图"),ue,"添加表格"),"maths-latex","数学图像"),"inline-latex","LATEX公式"),xe=function(e){var t=e.defaultValue,n=void 0===t?"":t,o=e.onChange,r=e.width,l=void 0===r?"100%":r,d=e.height,g=void 0===d?400:d,w=e.miniToolbar,v=void 0!==w&&w,b=e.isFocus,k=void 0!==b&&b,S=e.watch,_=e.insertTemp,B=e.mode,E=void 0===B?"markdown":B,L=e.id,j=void 0===L?"markdown-editor-id":L,A=e.showResizeBar,M=void 0!==A&&A,G=e.noStorage,O=void 0!==G&&G,R=e.showNullButton,F=void 0!==R&&R,D=e.showNullProgramButton,I=void 0!==D&&D,H=e.hidetoolBar,Z=void 0!==H&&H,z=e.fullScreen,V=void 0!==z&&z,q=e.onBlur,K=e.onCMBeforeChange,Y=e.onFullScreen,J=e.className,X=void 0===J?"":J,Q=e.disablePaste,ee=void 0!==Q&&Q,te=e.disabled,fe=void 0!==te&&te,ve=e.disabledFill,xe=void 0!==ve&&ve,ke=e.placeholder,Se=void 0===ke?"":ke,_e=e.values,Be=void 0===_e?"":_e,Te=e.extraUse,Ce=(0,c.useState)(null),Pe=a()(Ce,2),Ee=Pe[0],Le=Pe[1],Ne=(0,c.useState)(n),je=a()(Ne,2),Ae=je[0],Me=je[1],Ge=(0,c.useState)(S),Oe=a()(Ge,2),Re=Oe[0],Fe=Oe[1],De=(0,c.useState)(V),Ie=a()(De,2),He=Ie[0],We=Ie[1],Ze=(0,c.useState)(""),ze=a()(Ze,2),Ve=ze[0],qe=ze[1],Ue=(0,c.useState)(0),Ke=a()(Ue,2),Ye=Ke[0],Je=Ke[1],Xe=(0,c.useState)(g),$e=a()(Xe,2),Qe=$e[0],et=$e[1],tt=(0,c.useState)(!1),nt=a()(tt,2),ot=(nt[0],nt[1]),it=(0,c.useState)(0),rt=a()(it,2),at=rt[0],lt=rt[1],st=(0,c.useState)(0),ct=a()(st,2),dt=ct[0],ut=ct[1],ft=(0,c.useRef)(),pt=(0,c.useRef)(),ht=(0,c.useRef)(),mt=(0,c.useRef)();(0,c.useEffect)((function(){var e=window.scrollY||window.pageYOffset;Me(Be),null==Ee||Ee.setValue(Be),window.scrollTo(0,e)}),[Be]),(0,c.useEffect)((function(){null==Y||Y(He)}),[He]),(0,c.useEffect)((function(){if(ft.current){var e=function(e,n){if(!ee){var o=n.clipboardData;if(o){var i=o.types.toString(),r=o.items;if("Files"===i||o.types.indexOf("Files")>-1){if(n.preventDefault(),"stex"==E)return;try{var a,l=r[1];"file"===(null===(a=r[0])||void 0===a?void 0:a.kind)&&(l=r[0]);var s=l.getAsFile(),c=s.name.split(".").pop();(0,P.I)(s,(function(e){var n,o,i;e.id?(null==s||null===(n=s.type)||void 0===n?void 0:n.indexOf("image"))>-1?t.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):(null==s||null===(o=s.type)||void 0===o?void 0:o.indexOf("video"))>-1?t.replaceSelection('')):(null==s||null===(i=s.type)||void 0===i?void 0:i.indexOf("pdf"))>-1?t.replaceSelection('').concat(s.name,"")):ge.includes(c)?t.replaceSelection('').concat(s.name,"")):t.replaceSelection("[".concat(s.name,"](").concat(ie.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")")):401===(null==e?void 0:e.status)&&(document.location.href="/user/login")}))}catch(n){re.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}n.preventDefault()},t=u().fromTextArea(ft.current,{mode:E,lineNumbers:!v,lineWrapping:!0,value:n,autoCloseTags:!0,autoCloseBrackets:!0});return t.on("keyup",(function(e,n){8===n.keyCode&&(""==e.getValue()?t.setOption("placeholder",Se):t.setOption("placeholder",null))})),t.on("keydown",(function(e,t){if(8===t.keyCode){var n=function(e,t){var n=e.getDoc(),o=n.getCursor(),i=n.getLine(o.line),r=i.charAt(o.ch-1),a=i.lastIndexOf("@▁@",o.ch),l=i.lastIndexOf("@▁▁@",o.ch),s=a>l?a:l,c=a>l?3:4;if(-1===me.indexOf(r))return null;if(console.log("change1:",t,e,i,o,s,a,l,r),s>=0&&o.ch-s<5){var d=s+c;return n.replaceRange("",{line:o.line,ch:s},{line:o.line,ch:d}),{line:o.line,ch:d}}return null}(e);n&&t.preventDefault()}})),k&&t.focus(),t.on("paste",e),fe&&t.on("beforeChange",(function(e,t){"paste"!==t.origin&&"+input"!==t.origin||t.cancel()})),Le(t),function(){t.off("paste",e)}}}),[]);var gt=(0,c.useCallback)((function(){pt.current}),[Qe,pt,He]);(0,c.useEffect)((function(){if(Ee){var e=function(){var e=new f.Z((function(e){var t,n=i()(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;(o.target.offsetHeight>0||o.target.offsetWidth>0)&&(gt(),Ee.setSize("100%","100%"),Ee.refresh())}}catch(e){n.e(e)}finally{n.f()}}));return e.observe(ft.current.parentElement),e}();return function(){var t,n;null!==(t=ft.current)&&void 0!==t&&t.parentElement&&e.unobserve(null===(n=ft.current)||void 0===n?void 0:n.parentElement)}}}),[Ee,gt]),(0,c.useEffect)((function(){if(Ee){for(var e=[],t=function(){var t=a()(o[n],2),i=t[0],r=t[1],l=s()({},i,(function(){wt(r)}));e.push(l),Ee.addKeyMap(l)},n=0,o=Object.entries(be);n0){var e=(new Date).getTime(),t=window.sessionStorage.getItem(j);e>=Ye+1e4&&(!t||t!==Ae)&&(window.sessionStorage.setItem(j,Ae),ot(!0))}}),1e4),(0,c.useEffect)((function(){Fe(S)}),[Ee,S]),(0,c.useEffect)((function(){Ee&&k&&Ee.focus()}),[Ee,k]),(0,c.useEffect)((function(){if(Re&&Ee){var e=function(e){var t=e.target;if(mt.current){var n=t.scrollTop/t.scrollHeight;mt.current.scrollTop=mt.current.scrollHeight*n}},t=Ee.getScrollerElement();return t.addEventListener("scroll",e),function(){t.removeEventListener("scroll",e)}}}),[Ee,Re]),(0,c.useEffect)((function(){if(Ee&&K){var e=function(e,t){K(e,t)};return Ee.on("beforeChange",e),function(){Ee.off("beforeChange",e)}}}),[Ee,K]),(0,c.useEffect)((function(){if(Ee&&q){var e=function(){q(Ee.getValue())};return Ee.on("blur",e),function(){Ee.off("blur",e)}}}),[Ee,q]),(0,c.useEffect)((function(){if(Ee){var e=function(e,t){var n=e.getValue();Me(n),Je((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),o&&(I?o(n,kt(n)):o(n))};return Ee.on("change",e),function(){Ee.off("change",e)}}}),[Ee,o]),(0,c.useEffect)((function(){if(Ee)if(null==n)Ee.setValue(""),Me("");else{var e=window.scrollY||window.pageYOffset;n!==Ee.getValue()&&(Ee.setValue(n),Me(n),Ee.setCursor(fe?1:Ee.lineCount(),0),window.scrollTo(0,e))}}),[Ee,n]);var wt=(0,c.useCallback)((function(e){var t=Ee.getCursor(),n=Ee.getSelection(),o=n.split("\n");switch(e){case"bold":return Ee.replaceSelection("**"+n+"**"),""===n&&Ee.setCursor(t.line,t.ch+2),Ee.focus();case"italic":return Ee.replaceSelection("*"+n+"*"),""===n&&Ee.setCursor(t.line,t.ch+1),Ee.focus();case"code":return Ee.replaceSelection("`"+n+"`"),""===n&&Ee.setCursor(t.line,t.ch+1),Ee.focus();case"inline-latex":return qe("inline-latex"),Ee.focus();case"latex":return Ee.replaceSelection("```latex\n"+n+"\n```"),Ee.setCursor(t.line+1,n.length+1),Ee.focus();case"line-break":return Ee.replaceSelection("
\n"),Ee.focus();case"list-ul":return""===n?Ee.replaceSelection("- "+n):Ee.replaceSelection(o.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Ee.focus();case"list-ol":return""===n?Ee.replaceSelection("1. "+n):Ee.replaceSelection(o.map((function(e,t){return""===e?"":"".concat(t+1,". ").concat(e)})).join("\n")),Ee.focus();case"add-null-ch":return""===n&&Ee.setCursor(t.line,t.ch),Ee.replaceSelection("▁"),Ee.focus();case"add-signal":return""===n&&Ee.setCursor(t.line,t.ch),Ee.replaceSelection("@▁@"),Ee.focus();case"add-multiple":return""===n&&Ee.setCursor(t.line,t.ch),Ee.replaceSelection(me),Ee.focus();case"inster-template-1":return""===n&&Ee.setCursor(t.line,t.ch),Ee.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),Ee.focus();case"eraser":return Ee.setValue(""),Ee.focus();case"trigger-watch":return Fe(!Re),Ee.focus();case"trigger-full-screen":return We(!He),Ee.focus();case ae:return void qe(ae);case de:return void qe(de);case le:return void qe(le);case ce:return void qe(ce);case"maths-latex":return void qe("maths-latex");case se:return void qe(se);case ue:return void qe(ue);default:throw new Error}}),[Ee,Re,He]),vt=(0,c.useCallback)((function(e,t){var n,o,i,r,a;switch(qe(""),Ve){case ae:var l=e.title,s=e.link;return Ee.replaceSelection("[".concat(l,"](").concat(s,")")),Ee.focus();case de:var c=e.language,d=e.content;return Ee.replaceSelection(["```"+c,d,"```"].join("\n")),Ee.focus();case"maths-latex":for(var u=atob(e),f=new Uint8Array(u.length),p=0;p-1||null==w||!w.type?g?Ee.replaceSelection("![ ".concat(g," ]( ").concat(m,' "').concat(g,'" )')):Ee.replaceSelection("![,](".concat(m,")")):(null==w||null===(r=w.type)||void 0===r?void 0:r.indexOf("video"))>-1?Ee.replaceSelection('')):(null==w||null===(a=w.type)||void 0===a?void 0:a.indexOf("pdf"))>-1?Ee.replaceSelection('').concat(w.name,"")):ge.includes(v)?Ee.replaceSelection('').concat(w.name,"")):Ee.replaceSelection("[".concat(w.name,"](").concat(ie.Z.API_SERVER).concat(m,")")),Ee.focus();case ue:for(var b=e.row,y=e.col,x=e.align,k="\n",S=0;S300&&(t=300),et(g+t+"px")}},o=ht.current,i=!1,r=0;return o.addEventListener("mousedown",e),document.addEventListener("mousemove",n),document.addEventListener("mouseup",t),function(){o.removeEventListener("mousedown",e),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",t)}}}),[Ee,ht]),(0,c.useEffect)((function(){et(g)}),[g]);var xt={width:we(l),height:we(Qe)},kt=((0,c.useMemo)((function(){if(Ye){var e=new Date(Ye),t=e.getHours(),n=e.getMinutes(),o=e.getSeconds();return n=n<10?"0"+n:n,o=o<10?"0"+o:o,"".concat(t=t<10?"0"+t:t,":").concat(n,":").concat(o)}return 0}),[Ye]),function(e){var t=[];if(I){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,n,o){t.push({multiLine:!("@▁@"===e)})}))}return t});(0,c.useEffect)((function(){ye[Ve]&&Ve!==ce&&Ve!==se&&setTimeout((function(){var e=document.getElementsByClassName("markdown-popup-form")[0],t=window.innerWidth/2-e.offsetWidth/2,n=window.innerHeight/2-e.offsetHeight/2;lt(t),ut(n)}),0)}),[Ve]);var St=function(e,t,n,o){var i=document.body.clientHeight,r=document.body.clientWidth;return!(e<20&&n>e||e>r-20&&nt||t>i-20&&o