(self.webpackChunk=self.webpackChunk||[]).push([[80508,98772],{38229: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={},i=null,o=!1,r=!1,a=null,l=!1,s=null,c=null,u=0;u4?parseFloat(e):5};function _(){try{return window.self!==window.top}catch(e){return!0}}function k(){return(!n.hasOwnProperty("screenshotGenerator")||!n.screenshotGenerator)&&Math.max(screen.width,screen.height)<800}e.setHTML5Codebase=function(e,t){c=e,Z(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,D(e,t))},e.getHTML5CodebaseVersion=function(){return h},e.getParameters=function(){return n},e.setFontsCSSURL=function(e){x=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 i,o="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 B=function(e){return e&&"false"!==e},T=function(t,n,i){y(h)<=4.2&&(i=!0);var o=!isRenderGGBElementEnabled&&!scriptLoadStarted;(!isRenderGGBElementEnabled&&!scriptLoadStarted||ggbHTML5LoadedCodebaseVersion!==h||ggbHTML5LoadedCodebaseIsWebSimple&&!v)&&(o=!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(y(h)<=4.4)B(n.showToolBar)&&(n.height-=7),B(n.showAlgebraInput)&&(n.height-=37),n.width<605&&B(n.showToolBar)&&(n.width=605,a=605);else{var u=100;(B(n.showToolBar)||B(n.showMenuBar))&&(n.hasOwnProperty("customToolBar")&&(n.customToolbar=n.customToolBar),u=B(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(w),window.GGBT_wsf_view&&$(window).trigger("resize"),p(e)},b||w.appendChild(_)):r.appendChild(_),w.appendChild(r),b||t.appendChild(w),setTimeout((function(){e.resize()}),1)}function k(e,t){t&&"function"==typeof t.appletOnLoad&&"function"==typeof renderGGBElement?renderGGBElement(e,t.appletOnLoad):renderGGBElement(e),O("GeoGebra HTML5 applet injected and rendered with previously loaded codebase.",t)}function S(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){k(e.article,e.params)})),html5AppletsToProcess=null)},y(h)<5&&(e.className+=" geogebraweb")):k(e,t)}if(o){scriptLoadStarted=!0;for(var j=0;j0?(o.remove(),l.attr("id","fullscreencontent").show(),jQuery(r).append(l),window.dispatchEvent(new Event("resize"))):T(o,t,!1),window.GGBT_wsf_view.launchFullScreen(r)}else m=i,T(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 u=(e-l)/2,d=(t-s)/2;a.style.left=u+"px",a.style.top=d+"px",o.appendChild(a)}return o.appendChild(c),o},A=function(e){return"html5"===(e=e.toLowerCase())||"screenshot"===e?e:"html5"},G=["web","webSimple","web3d","tablet","tablet3d","phone"],D=function(e,t){if(h=e,t)Z(h,!0);else{var r,a,l=!o;if(l){var s=y(h);!isNaN(s)&&s<4.4&&(l=!1)}r="http"===window.location.protocol.substr(0,4)?window.location.protocol:"http:";var c=h.indexOf("//");for(var u in a=c>0?h:0===c?r+h:"https://www.geogebra.org/apps/5.2.814.0/",G)if(h.slice(-1*G[u].length)===G[u]||h.slice(-1*(G[u].length+1))===G[u]+"/")return void Z(a,!1);GGBAppletUtils.isFlexibleWorksheetEditor()||!l||i.is3D||i.AV||i.SV||i.CV||i.EV2||i.CP||i.PC||i.DA||i.FI||i.PV||B(n.showToolBar)||B(n.showMenuBar)||B(n.showAlgebraInput)||B(n.enableRightClick)||n.appName&&"classic"!=n.appName?a+="web3d/":a+="webSimple/",Z(a,!1)}},Z=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",v=!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",v=!0)),n=e.split("/"),"test"===(h=n[n.length-3]).substr(0,4)?h=h.substr(4,1)+"."+h.substr(5,1):"war"!==h.substr(0,3)&&"beta"!==h.substr(0,4)||(h="5.0");var i=parseFloat(h);NaN!==i&&i<5&&e.indexOf("geogebra.org")>=0&&(console.log("The GeoGebra HTML5 codebase version "+i+" is deprecated. Using version latest instead."),D("5.0",t))}},O=function(e,t){window.console&&window.console.log&&(!t||void 0===t.showLogging||t.showLogging&&"false"!==t.showLogging)&&console.log(e)};function R(){var e=t;null!==s?e=s:parseFloat(e)<5&&(e="5.0"),D(e,!1),null!==c&&Z(c,p),l=!0}return void 0!==n.material_id?S(R):R(),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,i,o){if(e.isScreenshoGenerator)return 1;var r,a=void 0!==i&&i,l=null!=e.noScaleMargin&&e.noScaleMargin,s=(r=e.autoHeight)&&"false"!==r,c=function(e,t,n,i,o,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,u=0,d=0,f=0,p=0,m=0;if(a)s=a.offsetWidth,c=Math.max(i?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),u=s):(s=window.innerWidth,c=window.innerHeight,u=window.innerWidth),e){var h=e.getBoundingClientRect();h.left>0&&h.left<=s&&(void 0===o||!o)&&("rtl"===document.dir?(f=s-h.width-h.left,p=u<=480?10:30):(p=h.left,f=u<=480?10:30),d=p+f)}e&&"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&(e.getBoundingClientRect(),"closePositionRight"===window.GGBT_wsf_view.getCloseBtnPosition()?(d=40,m=0):"closePositionTop"===window.GGBT_wsf_view.getCloseBtnPosition()&&(d=0,m=40))}return e&&((void 0===n||!n)&&t>0&&t+d1&&(a=!0)),t&&"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&(a=!0),e.hasOwnProperty("disableAutoScale")&&e.disableAutoScale?r:(o=n(e,t,a,i,e.scaleContainerClass),!a||e.hasOwnProperty("scale")&&1!==r?Math.min(r,o):o)}function o(e){var t=Math.min(window.innerWidth,document.documentElement.clientWidth),n=Math.min(window.innerHeight,document.documentElement.clientHeight),i=e.getBoundingClientRect(),o=(t-i.width)/2,r=(n-i.height)/2;r<0&&(r=0),e.style.position="relative","closePositionRight"===window.GGBT_wsf_view.getCloseBtnPosition()?(e.style.left=o<40?"40px":o+"px",e.style.top=r+"px"):"closePositionTop"===window.GGBT_wsf_view.getCloseBtnPosition()&&(e.style.top=r<40?"40px":r+"px",e.style.left=o+"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=i(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 i=e.lastIndexOf(tb,Math.min(n,t));return i>=O?e.substring(O,i+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,i=[],o=[];function a(e){var t=o[e](),n=i[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 i[e]},webModule.__getPropMap=function(){var e={};for(var t in i)i.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():{},i=e[webModule.__softPermutationId],o=O;o0){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"",n=[],i=0;i0){for(var i=a.elt(l-1);null!==i&&i.isTreeExpanded&&!i.isTreeLeaf;){i=this._sortTreeChildrenByY(i).last()}null!==i&&e.select(i)}else e.select(r)}else if("Down"===n.key){var o;if(t.isTreeExpanded&&!t.isTreeLeaf)null!==(o=this._sortTreeChildrenByY(t).first())&&e.select(o);else for(;null!==t;){var r,a,l;if(null===(r=t.findTreeParentNode()))break;if((l=(a=this._sortTreeChildrenByY(r)).indexOf(t))i.y?1:n.xi.x?1:0})),t},R.prototype.copyToClipboard=function(e){go.CommandHandler.prototype.copyToClipboard.call(this,e),this._lastPasteOffset.set(this.pasteOffset)},R.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(R.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(R.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 F=R,I=(n(57193),n(85160)),W=n(43418),H=n(43604),z=n(85750),V="myPaletteDiv___Xjz2I",q="maxH60___Pd4Re";window.go=O;var U=function(e){var t=e.onCancel,n=e.callback,i=(0,c.useRef)(),o=(0,c.useRef)(),r=(0,c.useRef)(),l=(0,c.useRef)(!1),s=(0,c.useRef)(!1),u=(0,c.useState)(0),d=a()(u,2),f=d[0],p=d[1],h=function(){var e=G()(M()().mark((function e(){var t,o;return M()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.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:o=e.sent,n({src:o.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,m.jsx)("div",{ref:s,className:l.current?"".concat(q," body-overflow-initial"):"body-overflow-initial",children:(0,m.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,m.jsxs)(N.Z,{children:[(0,m.jsx)(H.Z,{flex:1,children:"插入流程图"}),(0,m.jsx)(H.Z,{onClick:function(){l.current=!l.current,p(f+1)},children:(0,m.jsx)("span",{className:"current c-blue mr30",style:{fontWeight:400},children:"展开/收起"})})]}),onCancel:t,children:(0,m.jsxs)("div",{style:{width:"100%",height:"80vh",overflow:"hidden",position:"relative"},children:[(0,m.jsxs)("div",{style:{display:"flex",height:"100%"},children:[(0,m.jsxs)("div",{style:{width:"300px",height:"100%"},children:[(0,m.jsx)("div",{style:{background:"#fff",position:"relative",zIndex:12,fontSize:16,color:"#3061d0"},children:"图形库"}),(0,m.jsx)("div",{style:{height:"calc(100% - 50px)"},className:V,ref:r})]}),(0,m.jsxs)("div",{style:{flex:1,position:"relative"},children:[(0,m.jsx)(I.FI,{initDiagram:function(){var e=O.GraphObject.make,t="#ff3333",n="#3358ff",a="#25ad23",l="#d533ff",s="#7d33ff",c="#ff6233",u="#ffffff",d="#000000",f="#fffcd5",p="#d5ebff",m="#f2dfe0",h="#a5d2fa",g="#cccccc",v="#b3e6b3",w="#fcbbbd";function b(t,n){var i=function(e,n){e.handled=!0,e.diagram.model.commit((function(i){var o=n.part.adornedPart,r=(new O.Point).setRectSpot(o.actualBounds,t);r.subtract(o.location),r.scale(2,2),r.x+=130*Math.sign(r.x),r.y+=130*Math.sign(r.y),r.add(o.location),r.snapToGridPoint(e.diagram.grid.gridOrigin,e.diagram.grid.gridCellSize);var a=i.copyNodeData(o.data);i.setGroupKeyForNodeData(a,i.getGroupKeyForNodeData(o.data)),i.addNodeData(a);var l={from:o.key,to:i.getKeyForNodeData(a)};i.addLinkData(l);var s=e.diagram.findNodeForData(a);s.location=r,e.diagram.select(s),setTimeout((function(){e.diagram.commandHandler.editTextBlock()}),20)}))};return e(O.Shape,{figure:n,alignment:t,alignmentFocus:t.opposite(),width:t.equals(O.Spot.Top)||t.equals(O.Spot.Bottom)?25:18,height:t.equals(O.Spot.Top)||t.equals(O.Spot.Bottom)?18:25,fill:"orange",stroke:u,strokeWidth:4,mouseEnter:function(e,t){return t.fill="dodgerblue"},mouseLeave:function(e,t){return t.fill="orange"},isActionable:!0,click:i,contextClick:i})}function x(t){return e(O.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 y(e,t){return function(n,i){n.handled=!0,n.diagram.model.commit((function(n){n.set(i.part.adornedPart.data,e,t)}))}}function _(t,n){return n||(n="color"),e(O.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:y(n,t),contextClick:y(n,t)})}function k(){return[e("ContextMenuButton",e(O.Panel,"Horizontal",_(u,"fill"),_(f,"fill"),_(p,"fill"),_(m,"fill"))),e("ContextMenuButton",e(O.Panel,"Horizontal",_(g,"fill"),_(v,"fill"),_(h,"fill"),_(w,"fill")))]}function S(){return[e("ContextMenuButton",e(O.Panel,"Horizontal",_(d),_(a),_(n),_(t))),e("ContextMenuButton",e(O.Panel,"Horizontal",_(u),_(l),_(s),_(c)))]}function j(t,n){return n||(n="thickness"),e(O.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:y(n,t),contextClick:y(n,t)})}function C(t,n){return n||(n="dash"),e(O.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:y(n,t),contextClick:y(n,t)})}function B(){return[e("ContextMenuButton",e(O.Panel,"Horizontal",j(1),j(2),j(3),j(4))),e("ContextMenuButton",e(O.Panel,"Horizontal",C(null),C([2,4]),C([4,4])))]}function T(t,n){return n||(n="figure"),e(O.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:y(n,t),contextClick:y(n,t)})}function N(t){return e(O.Shape,{stroke:"dodgerblue",strokeWidth:2,strokeCap:"square",geometryString:"M0 0 M4 2 H3 M4 "+(t+4).toString()+" H3"})}function P(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(O.Shape,{geometryString:n,margin:2,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:y("dir",t),contextClick:y("dir",t)})}function E(t){var n=function(e,n){e.handled=!0,e.diagram.model.commit((function(e){var i=n.part.adornedPart;e.set(i.data,t?"toSpot":"fromSpot",O.Spot.stringify(O.Spot.AllSides)),(t?i.toNode:i.fromNode).invalidateConnectedLinks()}))};return e(O.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 L(t,n){var i=0,o=O.Spot.RightSide;t.equals(O.Spot.Top)?(i=270,o=O.Spot.TopSide):t.equals(O.Spot.Left)?(i=180,o=O.Spot.LeftSide):t.equals(O.Spot.Bottom)&&(i=90,o=O.Spot.BottomSide),n||(i-=180);var r=function(e,t){e.handled=!0,e.diagram.model.commit((function(e){var i=t.part.adornedPart;e.set(i.data,n?"toSpot":"fromSpot",O.Spot.stringify(o)),(n?i.toNode:i.fromNode).invalidateConnectedLinks()}))};return e(O.Shape,{alignment:t,alignmentFocus:t.opposite(),geometryString:"M0 0 M12 12 M12 6 L1 6 L4 4 M1 6 L4 8",angle:i,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:r,contextClick:r})}return i.current=new O.Diagram(o.current,{padding:20,grid:e(O.Panel,"Grid",e(O.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(O.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(F),"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}),i.current.nodeTemplate=e(O.Node,"Auto",{locationSpot:O.Spot.Center,locationObjectName:"SHAPE",desiredSize:new O.Size(120,60),minSize:new O.Size(40,40),resizable:!0,resizeCellSize:new O.Size(10,10),rotatable:!0},new O.Binding("location","loc",O.Point.parse).makeTwoWay(O.Point.stringify),new O.Binding("desiredSize","size",O.Size.parse).makeTwoWay(O.Size.stringify),e(O.Shape,{name:"SHAPE",fill:u,cursor:"pointer",portId:"",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:O.Spot.AllSides,toSpot:O.Spot.AllSides},new O.Binding("figure"),new O.Binding("fill"),new O.Binding("stroke","borderColor"),new O.Binding("strokeWidth","thickness"),new O.Binding("strokeDashArray","dash")),e(O.Shape,{width:100,height:20,strokeWidth:0,fill:"transparent"}),e(O.TextBlock,{margin:1,textAlign:"center",overflow:O.TextBlock.OverflowEllipsis,editable:!0},new O.Binding("text").makeTwoWay(),new O.Binding("stroke","color"))),i.current.nodeTemplate.toolTip=e("ToolTip",e(O.Panel,"Vertical",{maxSize:new O.Size(200,NaN)},e(O.TextBlock,{font:"bold 10pt sans-serif",textAlign:"center"},new O.Binding("text")),e(O.TextBlock,{font:"10pt sans-serif",textAlign:"center"},new O.Binding("text","details")))),i.current.nodeTemplate.selectionAdornmentTemplate=e(O.Adornment,"Spot",e(O.Placeholder,{padding:10}),b(O.Spot.Top,"TriangleUp"),b(O.Spot.Left,"TriangleLeft"),b(O.Spot.Right,"TriangleRight"),b(O.Spot.Bottom,"TriangleDown"),x({alignment:new O.Spot(.75,0)})),i.current.nodeTemplate.contextMenu=e("ContextMenu",e("ContextMenuButton",e(O.Panel,"Horizontal",T("Rectangle"),T("RoundedRectangle"),T("Ellipse"),T("Diamond"))),e("ContextMenuButton",e(O.Panel,"Horizontal",T("Parallelogram2"),T("ManualOperation"),T("Procedure"),T("Cylinder1"))),e("ContextMenuButton",e(O.Panel,"Horizontal",T("Terminator"),T("CreateRequest"),T("Document"),T("TriangleDown"))),k(),S(),B()),i.current.groupTemplate=e(O.Group,"Spot",{layerName:"Background",ungroupable:!0,locationSpot:O.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 O.Binding("location","loc",O.Point.parse).makeTwoWay(O.Point.stringify),e(O.Panel,"Auto",{name:"BODY"},e(O.Shape,{parameter1:10,fill:u,strokeWidth:2,cursor:"pointer",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:O.Spot.AllSides,toSpot:O.Spot.AllSides},new O.Binding("fill"),new O.Binding("stroke","color"),new O.Binding("strokeWidth","thickness"),new O.Binding("strokeDashArray","dash")),e(O.Placeholder,{background:"transparent",margin:20})),e(O.TextBlock,{alignment:O.Spot.Top,alignmentFocus:O.Spot.Bottom,font:"bold 12pt sans-serif",editable:!0},new O.Binding("text"),new O.Binding("stroke","color"))),i.current.groupTemplate.selectionAdornmentTemplate=e(O.Adornment,"Spot",e(O.Panel,"Auto",e(O.Shape,{fill:null,stroke:"dodgerblue",strokeWidth:3}),e(O.Placeholder,{margin:1.5})),x({alignment:O.Spot.TopRight,alignmentFocus:O.Spot.BottomRight})),i.current.groupTemplate.contextMenu=e("ContextMenu",k(),S(),B()),i.current.linkTemplate=e(O.Link,{layerName:"Foreground",routing:O.Link.AvoidsNodes,corner:10,fromShortLength:10,toShortLength:15,relinkableFrom:!0,relinkableTo:!0,reshapable:!0,resegmentable:!0},new O.Binding("fromSpot","fromSpot",O.Spot.parse),new O.Binding("toSpot","toSpot",O.Spot.parse),new O.Binding("fromShortLength","dir",(function(e){return e>=1?10:0})),new O.Binding("toShortLength","dir",(function(e){return e>=1?10:0})),new O.Binding("points").makeTwoWay(),e(O.Shape,{strokeWidth:2},new O.Binding("stroke","color"),new O.Binding("strokeWidth","thickness"),new O.Binding("strokeDashArray","dash")),e(O.Shape,{segmentIndex:0,segmentOffset:new O.Point(15,0),segmentOrientation:O.Link.OrientAlong,alignmentFocus:O.Spot.Right,figure:"circle",width:10,strokeWidth:0},new O.Binding("fill","color"),new O.Binding("visible","dir",(function(e){return 1===e}))),e(O.Shape,{segmentIndex:-1,segmentOffset:new O.Point(-10,6),segmentOrientation:O.Link.OrientPlus90,alignmentFocus:O.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new O.Binding("fill","color"),new O.Binding("visible","dir",(function(e){return e>=1})),new O.Binding("width","thickness",(function(e){return 7+3*e})),new O.Binding("height","thickness",(function(e){return 7+3*e})),new O.Binding("segmentOffset","thickness",(function(e){return new O.Point(-15,4+1.5*e)}))),e(O.Shape,{segmentIndex:0,segmentOffset:new O.Point(15,-6),segmentOrientation:O.Link.OrientMinus90,alignmentFocus:O.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new O.Binding("fill","color"),new O.Binding("visible","dir",(function(e){return 2===e})),new O.Binding("width","thickness",(function(e){return 7+3*e})),new O.Binding("height","thickness",(function(e){return 7+3*e})),new O.Binding("segmentOffset","thickness",(function(e){return new O.Point(-15,4+1.5*e)}))),e(O.TextBlock,{alignmentFocus:new O.Spot(0,1,-4,0),editable:!0},new O.Binding("text").makeTwoWay(),new O.Binding("stroke","color"))),i.current.linkTemplate.selectionAdornmentTemplate=e(O.Adornment,e(O.Shape,{isPanelMain:!0,stroke:"transparent",strokeWidth:6,pathPattern:N(2)},new O.Binding("pathPattern","thickness",N)),x({alignmentFocus:new O.Spot(0,0,-6,-4)})),i.current.linkTemplate.contextMenu=e("ContextMenu",S(),B(),e("ContextMenuButton",e(O.Panel,"Horizontal",P(0),P(1),P(2))),e("ContextMenuButton",e(O.Panel,"Horizontal",e(O.Panel,"Spot",E(!1),L(O.Spot.Top,!1),L(O.Spot.Left,!1),L(O.Spot.Right,!1),L(O.Spot.Bottom,!1)),e(O.Panel,"Spot",{margin:new O.Margin(0,0,0,2)},E(!0),L(O.Spot.Top,!0),L(O.Spot.Left,!0),L(O.Spot.Right,!0),L(O.Spot.Bottom,!0))))),new O.Palette(r.current,{maxSelectionCount:1,linkTemplate:e(O.Link,{locationSpot:O.Spot.Center,selectionAdornmentTemplate:e(O.Adornment,"Link",{locationSpot:O.Spot.Center},e(O.Shape,{isPanelMain:!0,fill:null,stroke:"deepskyblue",strokeWidth:0}),e(O.Shape,{toArrow:"Standard",stroke:null}))},{routing:O.Link.AvoidsNodes,curve:O.Link.JumpOver,corner:5,toShortLength:4},new O.Binding("points"),e(O.Shape,{isPanelMain:!0,strokeWidth:2}),e(O.Shape,{toArrow:"Standard",stroke:null})),model:new O.GraphLinksModel([{text:"未命名",size:"100 100",fill:null,stroke:"#000"}].concat(Z()(O.Shape.getFigureGenerators().toArray().map((function(e){return{text:"未命名",size:"100 100",figure:e.key,fill:"white",stroke:"#666",borderColor:"#000"}})))))}).nodeTemplate=e(O.Node,"Auto",{locationSpot:O.Spot.Center},new O.Binding("location","location",O.Point.parse).makeTwoWay(O.Point.stringify),e(O.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 O.Binding("stroke").makeTwoWay(),new O.Binding("fill").makeTwoWay(),new O.Binding("figure")),e(O.TextBlock,{margin:new O.Margin(5,5,3,5),font:"10pt sans-serif",minSize:new O.Size(16,16),maxSize:new O.Size(10,NaN),textAlign:"center",editable:!0},new O.Binding("key").makeTwoWay())),setTimeout((function(){i.current.grid=e(O.Panel,"Grid",e(O.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(O.Shape,"LineV",{stroke:"lightgray",strokeWidth:.5})),i.current.grid.visible=!0,i.current.grid.gridCellStroke="darkgray",i.current.grid.gridCellStrokeWidth=1}),300),window.myDiagrams=i.current,i.current},divClassName:"diagram-component",style:{height:"80vh"}}),(0,m.jsx)("div",{ref:o})]})]}),(0,m.jsx)("div",{className:"tr",children:(0,m.jsx)(S.ZP,{size:"large",onClick:h,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,m.jsxs)(_.Z,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){t(e)},children:[(0,m.jsxs)("div",{className:"flex-container",style:{alignItems:"baseline"},children:[(0,m.jsx)("span",{style:X,children:"单元格数:"}),(0,m.jsx)("span",{style:X,children:"行数"}),(0,m.jsx)(_.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,m.jsx)(Y.Z,{})}),(0,m.jsx)("span",{style:X,children:"列数"}),(0,m.jsx)(_.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,m.jsx)(Y.Z,{})})]}),(0,m.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,m.jsx)("span",{style:X,children:"对齐方式:"}),(0,m.jsx)(_.Z.Item,{name:"align",children:(0,m.jsxs)(J,{children:[(0,m.jsx)(K.ZP,{value:"default",children:(0,m.jsx)("i",{className:"fa fa-align-justify"})}),(0,m.jsx)(K.ZP,{value:"left",children:(0,m.jsx)("i",{className:"fa fa-align-left"})}),(0,m.jsx)(K.ZP,{value:"center",children:(0,m.jsx)("i",{className:"fa fa-align-center"})}),(0,m.jsx)(K.ZP,{value:"right",children:(0,m.jsx)("i",{className:"fa fa-align-right"})})]})})]}),(0,m.jsxs)("div",{className:"flex-container flex-end",children:[(0,m.jsx)(S.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,m.jsx)(S.ZP,{type:"ghost",onClick:n,children:"取消"})]})]})},Q=n(78673),ee=n(38229),te=n.n(ee),ne=(0,c.forwardRef)((function(e,t){var n=e.use3d,i=e.width,o=e.height,r=e.callback,l=(e.showSaveButton,(0,c.useRef)()),s=(0,c.useRef)(),u=(0,c.useState)(!1),d=a()(u,2),f=d[0],p=d[1],h=(0,c.useRef)({id:l,appName:"graphing",width:i||1e3,height:o||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())(h.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(){h.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,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{style:{width:"100%",height:"100%"},id:"applet_container",ref:l}),(0,m.jsxs)(N.Z,{align:"middle",children:[(0,m.jsx)(H.Z,{flex:1,children:(0,m.jsx)(Q.Z,{size:"default",checkedChildren:"关闭3D图像",unCheckedChildren:"开启3D图像",checked:f,onChange:function(e){return p(e)}})}),(0,m.jsx)(H.Z,{children:(0,m.jsx)(S.ZP,{size:"large",onClick:g,style:{zIndex:8,marginTop:10},type:"primary",children:"保存到编辑器"})})]})]})})),ie=n(97488),oe=n(20817),re=n(8591),ae="link",le="upload-image",se="add-flowchart",ce="draw-image",ue="code-block",de="add-table",fe="------------",pe={default:fe,left:":".concat(fe),center:":".concat(fe,":"),right:"".concat(fe,":")},me=n(12066);var he="@▁▁@",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 ve(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var we=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",be=s()(s()({},we+"-B","bold"),we+"-I","italic"),xe=s()(s()(s()(s()(s()(s()(s()(s()({},ae,"添加链接"),ue,"添加代码块"),le,"添加图片"),ce,"添加画图"),se,"插入流程图"),de,"添加表格"),"maths-latex","数学图像"),"inline-latex","LATEX公式"),ye=function(e){var t=e.defaultValue,n=void 0===t?"":t,i=e.onChange,r=e.width,l=void 0===r?"100%":r,u=e.height,g=void 0===u?400:u,v=e.miniToolbar,w=void 0!==v&&v,b=e.isFocus,_=void 0!==b&&b,k=e.watch,S=e.insertTemp,j=e.mode,N=void 0===j?"markdown":j,P=e.id,L=void 0===P?"markdown-editor-id":P,M=e.showResizeBar,A=void 0!==M&&M,G=e.noStorage,D=void 0!==G&&G,Z=e.showNullButton,O=void 0!==Z&&Z,R=e.showNullProgramButton,F=void 0!==R&&R,I=e.hidetoolBar,H=void 0!==I&&I,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,we=e.disabledFill,ye=void 0!==we&&we,_e=e.placeholder,ke=void 0===_e?"":_e,Se=e.values,je=void 0===Se?"":Se,Ce=e.extraUse,Be=(0,c.useState)(null),Te=a()(Be,2),Ne=Te[0],Pe=Te[1],Ee=(0,c.useState)(n),Le=a()(Ee,2),Me=Le[0],Ae=Le[1],Ge=(0,c.useState)(k),De=a()(Ge,2),Ze=De[0],Oe=De[1],Re=(0,c.useState)(V),Fe=a()(Re,2),Ie=Fe[0],We=Fe[1],He=(0,c.useState)(""),ze=a()(He,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),it=(nt[0],nt[1]),ot=(0,c.useState)(0),rt=a()(ot,2),at=rt[0],lt=rt[1],st=(0,c.useState)(0),ct=a()(st,2),ut=ct[0],dt=ct[1],ft=(0,c.useRef)(),pt=(0,c.useRef)(),mt=(0,c.useRef)(),ht=(0,c.useRef)();(0,c.useEffect)((function(){var e=window.scrollY||window.pageYOffset;Ae(je),null==Ne||Ne.setValue(je),window.scrollTo(0,e)}),[je]),(0,c.useEffect)((function(){null==Y||Y(Ie)}),[Ie]),(0,c.useEffect)((function(){if(ft.current){var e=function(e,n){if(!ee){var i=n.clipboardData;if(i){var o=i.types.toString(),r=i.items;if("Files"===o||i.types.indexOf("Files")>-1){if(n.preventDefault(),"stex"==N)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,T.I)(s,(function(e){var n,i,o;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===(i=s.type)||void 0===i?void 0:i.indexOf("video"))>-1?t.replaceSelection('')):(null==s||null===(o=s.type)||void 0===o?void 0:o.indexOf("pdf"))>-1?t.replaceSelection('').concat(s.name,"")):ge.includes(c)?t.replaceSelection('').concat(s.name,"")):t.replaceSelection("[".concat(s.name,"](").concat(oe.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=d().fromTextArea(ft.current,{mode:N,lineNumbers:!w,lineWrapping:!0,value:n,autoCloseTags:!0,autoCloseBrackets:!0});return t.on("keyup",(function(e,n){8===n.keyCode&&(""==e.getValue()?t.setOption("placeholder",ke):t.setOption("placeholder",null))})),t.on("keydown",(function(e,t){if(8===t.keyCode){var n=function(e,t){var n=e.getDoc(),i=n.getCursor(),o=n.getLine(i.line),r=o.charAt(i.ch-1),a=o.lastIndexOf("@▁@",i.ch),l=o.lastIndexOf("@▁▁@",i.ch),s=a>l?a:l,c=a>l?3:4;if(-1===he.indexOf(r))return null;if(console.log("change1:",t,e,o,i,s,a,l,r),s>=0&&i.ch-s<5){var u=s+c;return n.replaceRange("",{line:i.line,ch:s},{line:i.line,ch:u}),{line:i.line,ch:u}}return null}(e);n&&t.preventDefault()}})),_&&t.focus(),t.on("paste",e),fe&&t.on("beforeChange",(function(e,t){"paste"!==t.origin&&"+input"!==t.origin||t.cancel()})),Pe(t),function(){t.off("paste",e)}}}),[]);var gt=(0,c.useCallback)((function(){pt.current}),[Qe,pt,Ie]);(0,c.useEffect)((function(){if(Ne){var e=function(){var e=new f.Z((function(e){var t,n=o()(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;(i.target.offsetHeight>0||i.target.offsetWidth>0)&&(gt(),Ne.setSize("100%","100%"),Ne.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)}}}),[Ne,gt]),(0,c.useEffect)((function(){if(Ne){for(var e=[],t=function(){var t=a()(i[n],2),o=t[0],r=t[1],l=s()({},o,(function(){vt(r)}));e.push(l),Ne.addKeyMap(l)},n=0,i=Object.entries(be);n0){var e=(new Date).getTime(),t=window.sessionStorage.getItem(L);e>=Ye+1e4&&(!t||t!==Me)&&(window.sessionStorage.setItem(L,Me),it(!0))}}),1e4),(0,c.useEffect)((function(){Oe(k)}),[Ne,k]),(0,c.useEffect)((function(){Ne&&_&&Ne.focus()}),[Ne,_]),(0,c.useEffect)((function(){if(Ze&&Ne){var e=function(e){var t=e.target;if(ht.current){var n=t.scrollTop/t.scrollHeight;ht.current.scrollTop=ht.current.scrollHeight*n}},t=Ne.getScrollerElement();return t.addEventListener("scroll",e),function(){t.removeEventListener("scroll",e)}}}),[Ne,Ze]),(0,c.useEffect)((function(){if(Ne&&K){var e=function(e,t){K(e,t)};return Ne.on("beforeChange",e),function(){Ne.off("beforeChange",e)}}}),[Ne,K]),(0,c.useEffect)((function(){if(Ne&&q){var e=function(){q(Ne.getValue())};return Ne.on("blur",e),function(){Ne.off("blur",e)}}}),[Ne,q]),(0,c.useEffect)((function(){if(Ne){var e=function(e,t){var n=e.getValue();Ae(n),Je((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),i&&(F?i(n,_t(n)):i(n))};return Ne.on("change",e),function(){Ne.off("change",e)}}}),[Ne,i]),(0,c.useEffect)((function(){if(Ne)if(null==n)Ne.setValue(""),Ae("");else{var e=window.scrollY||window.pageYOffset;n!==Ne.getValue()&&(Ne.setValue(n),Ae(n),Ne.setCursor(fe?1:Ne.lineCount(),0),window.scrollTo(0,e))}}),[Ne,n]);var vt=(0,c.useCallback)((function(e){var t=Ne.getCursor(),n=Ne.getSelection(),i=n.split("\n");switch(e){case"bold":return Ne.replaceSelection("**"+n+"**"),""===n&&Ne.setCursor(t.line,t.ch+2),Ne.focus();case"italic":return Ne.replaceSelection("*"+n+"*"),""===n&&Ne.setCursor(t.line,t.ch+1),Ne.focus();case"code":return Ne.replaceSelection("`"+n+"`"),""===n&&Ne.setCursor(t.line,t.ch+1),Ne.focus();case"inline-latex":return qe("inline-latex"),Ne.focus();case"latex":return Ne.replaceSelection("```latex\n"+n+"\n```"),Ne.setCursor(t.line+1,n.length+1),Ne.focus();case"line-break":return Ne.replaceSelection("
\n"),Ne.focus();case"list-ul":return""===n?Ne.replaceSelection("- "+n):Ne.replaceSelection(i.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Ne.focus();case"list-ol":return""===n?Ne.replaceSelection("1. "+n):Ne.replaceSelection(i.map((function(e,t){return""===e?"":"".concat(t+1,". ").concat(e)})).join("\n")),Ne.focus();case"add-null-ch":return""===n&&Ne.setCursor(t.line,t.ch),Ne.replaceSelection("▁"),Ne.focus();case"add-signal":return""===n&&Ne.setCursor(t.line,t.ch),Ne.replaceSelection("@▁@"),Ne.focus();case"add-multiple":return""===n&&Ne.setCursor(t.line,t.ch),Ne.replaceSelection(he),Ne.focus();case"inster-template-1":return""===n&&Ne.setCursor(t.line,t.ch),Ne.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),Ne.focus();case"eraser":return Ne.setValue(""),Ne.focus();case"trigger-watch":return Oe(!Ze),Ne.focus();case"trigger-full-screen":return We(!Ie),Ne.focus();case ae:return void qe(ae);case ue:return void qe(ue);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 de:return void qe(de);default:throw new Error}}),[Ne,Ze,Ie]),wt=(0,c.useCallback)((function(e,t){var n,i,o,r,a;switch(qe(""),Ve){case ae:var l=e.title,s=e.link;return Ne.replaceSelection("[".concat(l,"](").concat(s,")")),Ne.focus();case ue:var c=e.language,u=e.content;return Ne.replaceSelection(["```"+c,u,"```"].join("\n")),Ne.focus();case"maths-latex":for(var d=atob(e),f=new Uint8Array(d.length),p=0;p-1||null==v||!v.type?g?Ne.replaceSelection("![ ".concat(g," ]( ").concat(h,' "').concat(g,'" )')):Ne.replaceSelection("![,](".concat(h,")")):(null==v||null===(r=v.type)||void 0===r?void 0:r.indexOf("video"))>-1?Ne.replaceSelection('')):(null==v||null===(a=v.type)||void 0===a?void 0:a.indexOf("pdf"))>-1?Ne.replaceSelection('').concat(v.name,"")):ge.includes(w)?Ne.replaceSelection('').concat(v.name,"")):Ne.replaceSelection("[".concat(v.name,"](").concat(oe.Z.API_SERVER).concat(h,")")),Ne.focus();case de:for(var b=e.row,x=e.col,y=e.align,_="\n",k=0;k300&&(t=300),et(g+t+"px")}},i=mt.current,o=!1,r=0;return i.addEventListener("mousedown",e),document.addEventListener("mousemove",n),document.addEventListener("mouseup",t),function(){i.removeEventListener("mousedown",e),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",t)}}}),[Ne,mt]),(0,c.useEffect)((function(){et(g)}),[g]);var yt={width:ve(l),height:ve(Qe)},_t=((0,c.useMemo)((function(){if(Ye){var e=new Date(Ye),t=e.getHours(),n=e.getMinutes(),i=e.getSeconds();return n=n<10?"0"+n:n,i=i<10?"0"+i:i,"".concat(t=t<10?"0"+t:t,":").concat(n,":").concat(i)}return 0}),[Ye]),function(e){var t=[];if(F){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,n,i){t.push({multiLine:!("@▁@"===e)})}))}return t});(0,c.useEffect)((function(){xe[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),dt(n)}),0)}),[Ve]);var kt=function(e,t,n,i){var o=document.body.clientHeight,r=document.body.clientWidth;return!(e<20&&n>e||e>r-20&&nt||t>o-20&&i10)}),[null==v?void 0:v.replies_count]);var ne=function(){var e=a()(o()().mark((function e(){var t,n,a;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return X(t=J+1),e.next=4,(0,w.z5)({id:y.memoId,page:t});case 4:null!=(n=e.sent)&&n.memo_replies&&(r({type:"forumsDetail/setForumsDetailData",payload:f()(f()({},i.forumsDetailData),{},{memo_replies:[].concat(M()(x),M()(n.memo_replies))})}),U(10===(null===(a=n.memo_replies)||void 0===a?void 0:a.length)));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ie=function(e){var t,i,o,r;return f()(f()({},e),{},{image_url:null===(t=n.userInfo)||void 0===t?void 0:t.image_url,children:[],user_id:null===(i=n.userInfo)||void 0===i?void 0:i.user_id,user_login:null===(o=n.userInfo)||void 0===o?void 0:o.login,username:null===(r=n.userInfo)||void 0===r?void 0:r.username,time:"".concat((0,F.li)(((new Date).getTime()-new Date(e.created_at).getTime())/1e3),"前")})},oe=function(){te(!0)};return(0,b.jsxs)("section",{className:O.wrap,children:[!(null==x||!x.length)&&(0,b.jsxs)("aside",{className:O.content,children:[(0,b.jsx)("div",{style:{padding:"10px 15px 5px 15px",justifyContent:"space-between",display:"flex"},children:(0,b.jsxs)("span",{children:["全部回复(",v.replies_count,")"]})}),(0,b.jsx)("aside",{className:O.replyList,children:null==x?void 0:x.map((function(e,t){var s;return(0,b.jsxs)(m.Z,{gutter:[12,12],children:[(0,b.jsx)(h.Z,{flex:"40px",children:(0,b.jsx)("a",{href:"/users/".concat(e.user_login),target:"_blank",children:(0,b.jsx)("img",{alt:"用户头像",width:"50",height:"50",src:"".concat(p.Z.IMG_SERVER,"/images/").concat(null==e?void 0:e.image_url)})})}),(0,b.jsx)(h.Z,{flex:"1",children:(0,b.jsxs)(m.Z,{align:"middle",children:[(0,b.jsxs)(h.Z,{span:24,children:[(0,b.jsx)("a",{href:"/users/".concat(e.user_login),target:"_blank",children:(0,b.jsx)("span",{className:"c-light-black",children:null==e?void 0:e.username})}),(0,b.jsx)("span",{className:"c-light-black ml10",children:e.time})]}),(0,b.jsx)(h.Z,{span:24,children:(0,b.jsx)("div",{onClick:l,children:(0,b.jsx)(S.Z,{value:e.content})})}),!(null==e||null===(s=e.children)||void 0===s||!s.length)&&(0,b.jsx)(R,{user:n,id:null==e?void 0:e.id,vlist:null==e?void 0:e.children,dispatch:r,params:y,memo_replies:x,forumsDetail:i}),(0,b.jsx)(h.Z,{span:24,className:"mt5 c-light-black",children:W===t?(0,b.jsxs)("aside",{children:[(0,b.jsx)(D.Z,{onChange:function(e){L(e)},height:150,isFocus:!0,placeholder:"我要回复..."}),(0,b.jsx)(m.Z,{children:(0,b.jsx)(h.Z,{span:24,className:"tr",children:(0,b.jsx)(g.ZP,{type:"primary",size:"middle",onClick:a()(o()().mark((function t(){var n;return o()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(""!==E){t.next=4;break}j.ZP.error("请输入内容"),t.next=9;break;case 4:return t.next=6,(0,w.ts)({parent_id:e.id,content:E});case 6:n=t.sent,L(null),n&&(H(-1),x.find((function(e){return e.id===n.parent_id})).children.push(ie(n)),r({type:"forumsDetail/setForumsDetailData",payload:f()(f()({},i.forumsDetailData),{},{memo:f()(f()({},v),{},{replies_count:v.replies_count+1}),memo_replies:M()(x)})}));case 9:case"end":return t.stop()}}),t)}))),children:"发送"})})})]}):(0,b.jsxs)("div",{className:"tr",children:[(0,b.jsx)("span",{className:"iconfont icon-huifu1 mr15 ml30 current",onClick:function(){return H(t)}}),(0,b.jsx)(P.Z,{title:e.user_praise?"取消点赞":"点赞",children:(0,b.jsxs)("span",{className:e.user_praise?"c-orange":"c-gery-888",children:[(0,b.jsx)("i",{className:"iconfont icon-dianzan mr3 current",onClick:a()(o()().mark((function t(){var n;return o()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,w.vL)({id:e.id,container_type:"Memo",type:e.user_praise?0:1});case 2:(null==(n=t.sent)?void 0:n.praise_count)>=0&&(x.find((function(t){return t.id===e.id})).user_praise=!e.user_praise,x.find((function(t){return t.id===e.id})).praise_count=null==n?void 0:n.praise_count,r({type:"forumsDetail/setForumsDetailData",payload:f()(f()({},i.forumsDetailData),{},{memo_replies:M()(x)})}));case 4:case"end":return t.stop()}}),t)})))}),e.praise_count>0?e.praise_count:""]})})]})})]})})]},t)}))})]}),q&&(0,b.jsx)("aside",{className:"bg-white pb20",style:{display:"flex",justifyContent:"center"},children:(0,b.jsxs)(m.Z,{justify:"space-between",children:[(0,b.jsx)(h.Z,{}),(0,b.jsx)(h.Z,{children:q&&(0,b.jsx)("a",{className:"c-black",onClick:ne,children:"查看更多评论"})})]})}),(0,b.jsxs)("aside",{className:O.reply,children:[(0,b.jsx)(D.Z,{onBlur:function(){return te(!1)},isFocus:ee,defaultValue:C,id:"writeForumsReviewId",onChange:function(e){B(e)},placeholder:"我要回复...",height:240}),(0,b.jsxs)(m.Z,{children:[(0,b.jsx)(h.Z,{flex:"1"}),(0,b.jsx)(h.Z,{children:(0,b.jsx)(g.ZP,{type:"primary",size:"middle",onClick:a()(o()().mark((function e(){var t;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!==C){e.next=4;break}j.ZP.error("请输入内容"),e.next=9;break;case 4:return e.next=6,(0,w.ts)({parent_id:v.id,content:C});case 6:t=e.sent,B(null),t&&r({type:"forumsDetail/setForumsDetailData",payload:f()(f()({},i.forumsDetailData),{},{memo:f()(f()({},v),{},{replies_count:v.replies_count+1}),memo_replies:[ie(t)].concat(M()(x))})});case 9:case"end":return e.stop()}}),e)}))),children:"发送"})})]})]})]})},H=(0,u.connect)((function(e){var t=e.user,n=e.forumsDetail,i=e.loading;return{user:t,forumsDetail:n,globalSetting:e.globalSetting,loading:i.models.forumsDetail}}),null,null,{forwardRef:!0})((0,c.forwardRef)(W)),z="wrap___Soi3l",V="header___vk3EC",q="title___WJAyR",U="menu___yMPKF",K="top___ZqzEM",Y="line___EQKlG",J="flexCenter___Rcnhr",X="like___uNtmq",$="canLike___Lu04z",Q="attachmentName___nwdzp",ee=n(3148),te=n(59015),ne=n(53200),ie=["user","forumsDetail","globalSetting","loading","dispatch"],oe={5:"技术分享",3:"操作指南",16:"通知公告"},re=(0,u.connect)((function(e){var t=e.user,n=e.forumsDetail,i=e.loading;return{user:t,forumsDetail:n,globalSetting:e.globalSetting,loading:i.effects}}))((function(e){var t,n,i,r,l,d=e.user,p=e.forumsDetail,g=(e.globalSetting,e.loading,e.dispatch),v=(s()(e,ie),p.forumsDetailData||{}),x=v.author_info,y=v.memo,_=v.attachments_list,L=(0,c.useRef)(),M=(0,c.useRef)(),A=function(){var e=a()(o()().mark((function e(){var t,n;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={id:y.id,sticky:y.sticky?0:1},e.next=3,(0,w.B0)(t);case 3:0===(null==(n=e.sent)?void 0:n.status)&&g({type:"forumsDetail/setForumsDetailData",payload:f()(f()({},p.forumsDetailData),{},{memo:f()(f()({},y),{},{sticky:!(null!=y&&y.sticky)})})});case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),G=function(){var e=a()(o()().mark((function e(){var t;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,w.sW)({id:null==y?void 0:y.id});case 2:0===(null==(t=e.sent)?void 0:t.status)&&(j.ZP.success("删除成功"),u.history.push("/forums")),-1===(null==t?void 0:t.status)&&u.history.push("/forums");case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),D=function(){var e=a()(o()().mark((function e(){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:C.Z.confirm({centered:!0,width:530,okText:"确定",cancelText:"取消",title:"奖励设置",content:(0,b.jsx)("div",{className:"font14 tc",children:(0,b.jsx)(B.Z,{defaultValue:L.current,onChange:function(e){return L.current=e.target.value}})}),onOk:function(){var e=a()(o()().mark((function e(){var t;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,w.eh)({id:null==y?void 0:y.id,container_type:"Memo",score:L.current?Number(L.current):0,user_id:null==x?void 0:x.user_id});case 2:if(t=e.sent,L.current=null,!((null==t?void 0:t.code)>0)){e.next=8;break}return g({type:"forumsDetail/setForumsDetailData",payload:f()(f()({},p.forumsDetailData),{},{memo:f()(f()({},y),{},{reward:null==t?void 0:t.code})})}),j.ZP.success("奖励成功"),e.abrupt("return");case 8:j.ZP.success("奖励失败,请联系系统管理员!");case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Z=function(){var e=a()(o()().mark((function e(){var t;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,w.vL)({id:y.id,container_type:"Memo",type:1});case 2:(null==(t=e.sent)?void 0:t.praise_count)>=0&&g({type:"forumsDetail/setForumsDetailData",payload:f()(f()({},p.forumsDetailData),{},{memo:f()(f()({},y),{},{user_praise:!(null!=y&&y.user_praise),memo_praise_count:null==t?void 0:t.praise_count})})});case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),O=(0,b.jsxs)(T.Z,{className:U,children:[(null===(t=d.userInfo)||void 0===t?void 0:t.admin)&&(null==y?void 0:y.sticky)&&(0,b.jsx)(T.Z.Item,{children:(0,b.jsx)("a",{onClick:function(){return A()},children:"取消置顶"})}),(null===(n=d.userInfo)||void 0===n?void 0:n.admin)&&!(null!=y&&y.sticky)&&(0,b.jsx)(T.Z.Item,{children:(0,b.jsx)("a",{onClick:function(){return A()},children:"置  顶"})}),(0,b.jsx)(T.Z.Item,{children:(0,b.jsx)(u.Link,{to:"/forums/".concat(null==y?void 0:y.id,"/edit"),children:"编  辑"})}),(0,b.jsx)(T.Z.Item,{children:(0,b.jsx)("a",{onClick:function(){C.Z.confirm({title:"提示",icon:(0,b.jsx)(ee.Z,{}),content:"帖子将被删除,无法恢复。是否确认删除?",okText:"确认",onOk:function(){G()},cancelText:"取消"})},children:"删  除"})})]}),R=function(e){var t=e.target,n=t.nodeName,i=t.src;"IMG"===n&&(ne.Z.publish("preview-image",i),console.log("src:",i))};return(0,c.useEffect)((function(){}),[]),(0,b.jsxs)("section",{className:z,children:[(0,b.jsxs)(N.Z,{separator:"/",className:"mb5",children:[(0,b.jsx)(N.Z.Item,{children:(0,b.jsx)(u.Link,{to:"/forums/categories/".concat(null==y?void 0:y.forum_id),children:oe[null==y?void 0:y.forum_id]})}),(0,b.jsx)(N.Z.Item,{children:"详情"})]}),(0,b.jsxs)("header",{className:"bg-white pt40 pb40 pl30 pr30 ".concat(V),children:[(0,b.jsxs)(m.Z,{align:"middle",children:[(0,b.jsxs)(h.Z,{flex:1,className:"font24 mb5",children:[(0,b.jsx)("span",{className:q,children:null==y?void 0:y.subject}),(null==y?void 0:y.sticky)&&(0,b.jsx)("span",{className:K,children:"置顶"}),!(null==y||!y.reward)&&(0,b.jsx)(P.Z,{placement:"bottom",title:"获得平台奖励金币:".concat(null==y?void 0:y.reward),children:(0,b.jsxs)("span",{className:"ml10 c-orange-ff7",children:[(0,b.jsx)("i",{className:"iconfont icon-gift font16 mr5"}),(0,b.jsx)("span",{className:"font14",children:null==y?void 0:y.reward})]})})]}),(0,b.jsx)(h.Z,{children:((null===(i=d.userInfo)||void 0===i?void 0:i.admin)||(null===(r=d.userInfo)||void 0===r?void 0:r.user_id)===(null==x?void 0:x.user_id))&&(0,b.jsx)(E.Z,{dropdownRender:function(){return O},children:(0,b.jsx)("i",{className:"fa fa-bars font-16 current c-grey-bcb"})})})]}),(0,b.jsxs)(m.Z,{align:"middle",className:"font14",children:[(0,b.jsx)(h.Z,{flex:1,className:"c-grey-999",children:(0,b.jsxs)("span",{children:[k()(null==y?void 0:y.time).fromNow()," 更新"]})}),(0,b.jsxs)(h.Z,{className:"c-grey-999",children:[(null===(l=d.userInfo)||void 0===l?void 0:l.admin)&&(0,b.jsx)(P.Z,{placement:"bottom",title:"帖子奖励",children:(0,b.jsx)("span",{className:"current pr10 ".concat(Y),onClick:D,children:(0,b.jsx)("i",{className:"iconfont icon-jiangli font18 mr5"})})}),(0,b.jsxs)("span",{className:"pr10 pl10 ".concat(null!=y&&y.replies_count?Y:""),children:[(0,b.jsx)("i",{className:"iconfont icon-liulanyan font18 mr5"}),null==y?void 0:y.viewed_count]}),!(null==y||!y.replies_count)&&(0,b.jsx)(P.Z,{placement:"bottom",title:"写评论",children:(0,b.jsxs)("span",{className:"current pl10",onClick:function(){M.current.onMdFouch&&M.current.onMdFouch()},children:[(0,b.jsx)("i",{className:"iconfont icon-huifu1 font18 mr5"}),null==y?void 0:y.replies_count]})})]})]})]}),(0,b.jsxs)("main",{className:"bg-white pt40 pb40 pl40 pr40",children:[(0,b.jsx)("div",{onClick:R,children:(0,b.jsx)(S.Z,{value:null==y?void 0:y.content})}),(0,b.jsx)("div",{className:"bg-white pl40 pr40 mt40",children:(0,b.jsx)("div",{className:"mt10 mb20 ".concat(J),children:(0,b.jsxs)("div",{className:"".concat(X," ").concat(null!=y&&y.user_praise?"":$),onClick:Z,children:[(0,b.jsx)("i",{className:"iconfont icon-dianzan font18"}),(0,b.jsx)("br",{}),(0,b.jsx)("span",{children:null==y?void 0:y.memo_praise_count})]})})}),!(null==_||!_.length)&&(0,b.jsx)("div",{className:"mt40",children:null==_?void 0:_.map((function(e){return(0,b.jsxs)("div",{className:"c-grey-888 ".concat(J),children:[(0,b.jsx)("i",{className:"iconfont icon-fujian mr10 font14 c-green-29b"}),(0,b.jsx)("a",{href:null==e?void 0:e.url,title:null==e?void 0:e.title,className:"".concat(Q," mr10"),children:null==e?void 0:e.title}),(0,b.jsx)("span",{className:"font12 c-grey-666 mt3",children:null==e?void 0:e.filesize})]})}))})]}),(0,b.jsx)(H,{ref:M,handleClick:R}),(0,b.jsx)(te.Z,{})]})})),ae="flex___fgmSn",le=["forumsDetail","globalSetting","loading","dispatch"],se=(0,u.connect)((function(e){var t=e.forumsDetail,n=e.loading;return{forumsDetail:t,globalSetting:e.globalSetting,loading:n.models.forumsDetail}}))((function(e){e.forumsDetail,e.globalSetting,e.loading;var t=e.dispatch,n=(s()(e,le),(0,u.useParams)());(0,c.useEffect)((function(){i()}),[n.memoId]);var i=function(){var e=a()(o()().mark((function e(){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t({type:"forumsDetail/getForumsDetailData",payload:{id:n.memoId}});case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,b.jsxs)("section",{className:"edu-container mb20 mt30 ".concat(ae),children:[(0,b.jsx)(re,{}),(0,b.jsx)(y,{})]})}))}}]);