|
|
(self.webpackChunk=self.webpackChunk||[]).push([[8999,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,u=0;u<arguments.length;u++){var d=arguments[u];if(null!==d)switch(_typeof(d)){case"number":t=d.toFixed(1);break;case"string":d.match(new RegExp("^[0-9]\\.[0-9]+$"))?t=d:a=d;break;case"object":void 0!==d.is3D?o=d:n=d;break;case"boolean":i=d,r=!0}}null===o&&(o={is3D:!1,AV:!1,SV:!1,CV:!1,EV2:!1,CP:!1,PC:!1,DA:!1,FI:!1,PV:!1,macro:!1},void 0===n.material_id||r||(i=!0)),null!==a&&void 0===n.id&&(n.id=a);var f="",p=!1,h=null,m=null,g=null,w=!1,v=null,b=null,y=null;void 0!==n.height&&(n.height=Math.round(n.height)),void 0!==n.width&&(n.width=Math.round(n.width));var x=function(e){return parseFloat(e)>4?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,I(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<arguments.length;s++){var c=arguments[s];"string"==typeof c?(c=c.toLowerCase()).match(/^(prefer)?(java|html5|compiled|auto|screenshot)$/)?i=c:r=arguments[s]:"boolean"==typeof c?a=c:c instanceof HTMLElement&&(o=c)}function u(){if(l){i=A(i);var s=o||document.getElementById(r);if(s)if(e.removeExistingApplet(s,!1),void 0===n.width&&s.clientWidth&&(n.width=s.clientWidth),void 0===n.height&&s.clientHeight&&(n.height=s.clientHeight),n.width&&n.height||"html5"!==i||(delete n.width,delete n.height),h=i,"screenshot"===i)P(s,n);else{var c=!1;n.hasOwnProperty("playButton")&&n.playButton||n.hasOwnProperty("clickToLoad")&&n.clickToLoad?c=!0:n.hasOwnProperty("playButtonAutoDecide")&&n.playButtonAutoDecide&&(c=(!_()||t())&&k()),c?(h="screenshot",E(s,n,a,i)):j(s,n,a)}else console.log("possibly bug on ajax loading? ")}else setTimeout(u,200)}u()},e.getViews=function(){return o},e.isJavaInstalled=function(){return!1};var S=function(t){var i=function(){n.onError&&n.onError(),R("Error: Fetching material (id "+n.material_id+") failed.",n)},r=location.host.match(/(www|stage|beta|groot|alpha).geogebra.(org|net)/)?location.host:"www.geogebra.org",a="/materials/"+n.material_id+"?scope=basic";B("https://"+r+"/api/proxy.php?path="+encodeURIComponent(a),(function(r){var a=JSON.parse(r),l=a.elements?a.elements.filter((function(e){return"G"==e.type||"E"==e.type}))[0]:a;if(l&&l.url){n.fileName=l.url,C(l.settings||{}),o.is3D=!0;var s="https://www.geogebra.org/images/";e.setPreviewImage(v||l.previewUrl,s+"GeoGebra_loading.png",s+"applet_play.png"),t()}else i()}),i)};function C(e){["enableLabelDrags","enableShiftDragZoom","enableRightClick"].forEach((function(t){e[t]=!!e[t]})),["width","height","showToolBar","showMenuBar","showAlgebraInput","allowStyleBar","showResetIcon","enableLabelDrags","enableShiftDragZoom","enableRightClick","appName"].forEach((function(t){void 0===n[t]&&void 0!==e[t]&&(n[t]=e[t])})),void 0===n.showToolBarHelp&&(n.showToolBarHelp=n.showToolBar)}function B(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.onload=function(){t(o.responseText)},o.onerror=n,o.send()}e.isHTML5Installed=function(){return!0},e.getLoadedAppletType=function(){return h},e.setPreviewImage=function(e,t,n){v=e,b=t,n},e.removeExistingApplet=function(e,t){var o;"string"==typeof e&&(e=document.getElementById(e)),h=null;var i=null;for(o=0;o<e.childNodes.length;o++){var r=e.childNodes[o],a=r.className;"applet_screenshot"===a?t?(r.style.display="block",h="screenshot"):r.style.display="none":"applet_scaler prerender"!==a&&(e.removeChild(r),i=a&&-1!=a.indexOf("appletParameters")?r.id:null,o--)}var l=void 0!==n.id?n.id:i,s=window[l];s&&"function"==typeof s.getBase64&&(s.remove(),window[l]=null)},e.refreshHitPoints=function(){if(x(ggbHTML5LoadedCodebaseVersion)>=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 T=function(e){return e&&"false"!==e},j=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)T(n.showToolBar)&&(n.height-=7),T(n.showAlgebraInput)&&(n.height-=37),n.width<605&&T(n.showToolBar)&&(n.width=605,a=605);else{var u=100;(T(n.showToolBar)||T(n.showMenuBar))&&(n.hasOwnProperty("customToolBar")&&(n.customToolbar=n.customToolBar),u=T(n.showMenuBar)?245:155),a<u&&(n.width=u,a=u)}for(var d in r.style.border="none",r.style.display="inline-block",n)n.hasOwnProperty(d)&&"appletOnLoad"!==d&&r.setAttribute("data-param-"+d,n[d]);y&&r.setAttribute("data-param-fontscssurl",y),e.resize=function(){GGBAppletUtils.responsiveResize(t,n)},window.addEventListener("resize",(function(t){e.resize()}));var p="function"==typeof n.appletOnLoad?n.appletOnLoad:function(){};if(o||void 0===n.width){var h=document.createElement("div");h.className="applet_scaler",h.style.position="relative",h.style.display="block",h.appendChild(r),t.appendChild(h),n.appletOnLoad=function(t){e.resize(),p(t)}}else{n.hasOwnProperty("showSplash")||r.setAttribute("data-param-showSplash","false");var v=t.querySelector(".applet_scaler.prerender"),b=null!==v;if(b)_=v.querySelector(".ggb_preview");else{var _=M(a,l,n.borderColor,!1);(v=document.createElement("div")).className="applet_scaler",v.style.position="relative",v.style.display="block",v.style.width=a+"px",v.style.height=l+"px"}window.GGBT_spinner&&window.GGBT_spinner.attachSpinner(v,"66%"),x(m)>=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(_)):r.appendChild(_),v.appendChild(r),b||t.appendChild(v),setTimeout((function(){e.resize()}),1)}function k(e,t){t&&"function"==typeof t.appletOnLoad&&"function"==typeof renderGGBElement?renderGGBElement(e,t.appletOnLoad):renderGGBElement(e),R("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)},x(m)<5&&(e.className+=" geogebraweb")):k(e,t)}if(i){scriptLoadStarted=!0;for(var C=0;C<r.childNodes.length;C++){"TABLE"===r.childNodes[C].tagName&&(r.removeChild(r.childNodes[C]),C--)}if(null!==ggbHTML5LoadedScript){var B=document.querySelector('script[src="'+ggbHTML5LoadedScript+'"]');null!=B&&B.parentNode.removeChild(B)}var j=document.createElement("script"),P=function(){S(r,n)};j.src=f+g,ggbHTML5LoadedCodebaseIsWebSimple=w,ggbHTML5LoadedCodebaseVersion=m,ggbHTML5LoadedScript=j.src,R("GeoGebra HTML5 codebase loaded: '"+f+"'.",n),c||s&&"5.0"!=s?f.requirejs?__webpack_require__.e(58162).then(function(){var e=[__webpack_require__(58162)];P.apply(null,e)}.bind(this)).catch(__webpack_require__.oe):(j.onload=P,t.appendChild(j)):(w?webSimple.succeeded=webSimple.succeeded||webSimple():web3d.succeeded=web3d.succeeded||web3d(),P())}else S(r,n);n.height=l,n.width=a},P=function(t,n,o){var i=M(n.width,n.height,n.borderColor,o),r=document.createElement("div");r.style.position="relative",r.style.display="block",r.style.width=n.width+"px",r.style.height=n.height+"px",r.className="applet_screenshot applet_scaler"+(o?" applet_screenshot_play":""),r.appendChild(i);var a=GGBAppletUtils.getScale(n,t,o);o?(t.appendChild(L()),window.GGBT_wsf_view||(t.style.position="relative")):window.GGBT_spinner&&window.GGBT_spinner.attachSpinner(r,"66%"),t.appendChild(r),1===a||isNaN(a)||(GGBAppletUtils.scaleElement(r,a),r.style.width=n.width+"px",r.style.height=n.height+"px",r.parentNode.style.width=n.width*a+"px",r.parentNode.style.height=n.height*a+"px"),e.resize=function(){N(t,i,r,o)},window.addEventListener("resize",(function(t){e.resize()})),e.resize()};function N(e,t,o,i){if(e.contains(t)){if("object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()){if("fullscreencontent"!==e.id)return;window.GGBT_wsf_view.setCloseBtnPosition(e)}var r=GGBAppletUtils.getScale(n,e,i);null!==o.parentNode&&(isNaN(r)||1===r?(GGBAppletUtils.scaleElement(o,1),o.parentNode.style.width=n.width+"px",o.parentNode.style.height=n.height+"px"):(GGBAppletUtils.scaleElement(o,r),o.parentNode.style.width=n.width*r+"px",o.parentNode.style.height=n.height*r+"px")),"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&GGBAppletUtils.positionCenter(e),"object"===_typeof(window.GGBT_ws_header_footer)&&window.GGBT_ws_header_footer.setWsScrollerHeight()}}e.onExitFullscreen=function(e,t){t.appendChild(e)};var E=function(e,t,n,o){P(e,t,!0);for(var i=function(){var n=[];for(a=0;a<e.childNodes.length;a++)n.push(e.childNodes[a]);if(window.GGBT_wsf_view){var i=window.GGBT_wsf_view.renderFullScreen(e,t.id),r=document.getElementById("fullscreencontainer"),l=jQuery(e).find(".fullscreencontent");l.length>0?(i.remove(),l.attr("id","fullscreencontent").show(),jQuery(r).append(l),window.dispatchEvent(new Event("resize"))):j(i,t,!1),window.GGBT_wsf_view.launchFullScreen(r)}else h=o,j(e,t,!1);if(!window.GGBT_wsf_view)for(a=0;a<n.length;a++)e.removeChild(n[a])},r=e.getElementsByClassName("ggb_preview_play"),a=0;a<r.length;a++)r[a].addEventListener("click",i,!1),r[a].addEventListener("ontouchstart",i,!1);"function"==typeof window.ggbAppletPlayerOnload&&window.ggbAppletPlayerOnload(e),k()&&window.GGBT_wsf_view&&$(".wsf-element-fullscreen-button").remove()},L=function(){var e=document.createElement("div");if(e.className="ggb_preview_play icon-applet-play",!window.GGBT_wsf_view){var t='.icon-applet-play { width: 100%; height: 100%;box-sizing: border-box;position: absolute;z-index: 1001;cursor: pointer;border-width: 0px; background-color: transparent;background-repeat: no-repeat;left: 0;top: 0;background-position: center center; background-image: url("https://www.geogebra.org/images/worksheet/icon-start-applet.png");}.icon-applet-play:hover {background-image: url("https://www.geogebra.org/images/worksheet/icon-start-applet-hover.png");}',n=document.createElement("style");n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t)),document.getElementsByTagName("head")[0].appendChild(n)}return e},M=function(e,t,n,o){var i=document.createElement("div");i.className="ggb_preview",i.style.position="absolute",i.style.zIndex="90",i.style.width=e-2+"px",i.style.height=t-2+"px",i.style.top="0px",i.style.left="0px",i.style.overflow="hidden",i.style.backgroundColor="white";var r="lightgrey";void 0!==n&&(r="none"===n?"transparent":n),i.style.border="1px solid "+r;var a,l,s,c=document.createElement("img");if((c.style.position="relative",c.style.zIndex="1000",c.style.top="-1px",c.style.left="-1px",null!==v&&c.setAttribute("src",v),c.style.opacity=.7,null!==b)&&!o){(a=document.createElement("img")).style.position="absolute",a.style.zIndex="1001",a.style.opacity=1,c.style.opacity=.3,(l=360)>e/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",i.appendChild(a)}return i.appendChild(c),i},A=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)I(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 u in a=c>0?m:0===c?r+m:"https://www.geogebra.org/apps/5.2.814.0/",G)if(m.slice(-1*G[u].length)===G[u]||m.slice(-1*(G[u].length+1))===G[u]+"/")return void I(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||T(n.showToolBar)||T(n.showMenuBar)||T(n.showAlgebraInput)||T(n.enableRightClick)||n.appName&&"classic"!=n.appName?a+="web3d/":a+="webSimple/",I(a,!1)}},I=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))}},R=function(e,t){window.console&&window.console.log&&(!t||void 0===t.showLogging||t.showLogging&&"false"!==t.showLogging)&&console.log(e)};function Z(){var e=t;null!==s?e=s:parseFloat(e)<5&&(e="5.0"),O(e,!1),null!==c&&I(c,p),l=!0}return void 0!==n.material_id?S(Z):Z(),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,u=0,d=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),u=s):(s=window.innerWidth,c=window.innerHeight,u=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=u<=480?10:30):(p=m.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,h=0):"closePositionTop"===window.GGBT_wsf_view.getCloseBtnPosition()&&(d=0,h=40))}return e&&((void 0===n||!n)&&t>0&&t+d<s?s=t:s-=d,"object"!==_typeof(window.GGBT_wsf_view)||!window.GGBT_wsf_view.isFullscreen()||void 0!==n&&n||(c-=h)),{width:s,height:c}}(t,e.width,n,s,a&&window.GGBT_wsf_view||l,i),u=parseInt(c.width),d=e.width,f=e.height;if(void 0===d){var p=t.querySelector(".appletParameters");p&&(d=p.offsetWidth,f=p.offsetHeight)}var h=u/d,m=a?1:c.height/f;return void 0===n||n||(h=Math.min(1,h),m=Math.min(1,m)),Math.min(h,m)}function o(e,t,o){var i,r=1,a=!1;return e.hasOwnProperty("allowUpscale")&&(a=e.allowUpscale),e.hasOwnProperty("scale")&&(r=parseFloat(e.scale),(isNaN(r)||null===r||0===r)&&(r=1),r>1&&(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<n.childNodes.length;c++)if(void 0!==n.childNodes[c].className&&n.childNodes[c].className.match(/^applet_scaler/)){s=n.childNodes[c];break}if(null!==s&&null!==s.querySelector(".noscale"))return;var u=void 0!==r.id?r.id:"ggbApplet",d=window[u];null!=d&&d.recalculateEnvironments||null===s||s.className.match(/fullscreen/)||(s.parentNode.style.transform="",isNaN(l)||1===l?(t(s,1),s.parentNode.style.width=r.width+"px",s.parentNode.style.height=r.height+"px"):(s.parentNode.style.width=r.width*l+"px",s.parentNode.style.height=r.height*l+"px",t(s,l))),"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&i(n),window.GGBT_wsf_view&&!window.GGBT_wsf_view.isFullscreen()&&window.GGBT_wsf_general.adjustContentToResize($(a).parents(".content-added-content"))}},isFlexibleWorksheetEditor:e,positionCenter:i,getScale:o,scaleElement:t}}();__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=function(){return GGBApplet}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__),GGBAppletUtils.makeModule=function(name,permutation){function webModule(){var H="bootstrap",I="begin",J="gwt.codesvr."+name+"=",K="gwt.codesvr=",L=name,M="startup",N="DUMMY",O=0,P=1,Q="iframe",R="position:absolute; width:0; height:0; border:none; left: -1000px;",S=" top: -1000px;",T="Chrome",U="CSS1Compat",V="<!doctype html>",W="",X="<html><head></head><body></body></html>",Y="undefined",Z="readystatechange",$=10,_="script",ab="javascript",bb="Failed to load ",cb="moduleStartup",db="scriptTagAdded",eb="moduleRequested",fb="meta",gb="name",hb=name+"::",ib="::",jb="gwt:property",kb="content",lb="=",mb="gwt:onPropertyErrorFn",nb='Bad handler "',ob='" for "gwt:onPropertyErrorFn"',pb="gwt:onLoadErrorFn",qb='" for "gwt:onLoadErrorFn"',rb="#",sb="?",tb="/",ub="img",vb="clear.cache.gif",wb="baseUrl",xb=name+".nocache.js",yb="base",zb="//",Ab="selectingPermutation",Bb=name+".devmode.js",Cb=permutation,Db=":",Eb=".cache.js",Fb="loadExternalRefs",Gb="end",n=window,o=document;function p(){var e=n.location.search;return-1!=e.indexOf(J)||-1!=e.indexOf(K)}function q(e,t){}q(H,I),webModule.__sendStats=q,webModule.__moduleName=L,webModule.__errFn=null,webModule.__moduleBase=N,webModule.__softPermutationId=O,webModule.__computePropValue=null,webModule.__getPropMap=null,webModule.__installRunAsyncCode=function(){},webModule.__gwtStartLoadingFragment=function(){return null},webModule.__gwt_isKnownPropertyValue=function(){return!1},webModule.__gwt_getMetaProperty=function(){return null};var r=null,s=n.__gwt_activeModules=n.__gwt_activeModules||{},t;function u(){return v(),t}function v(){if(!t){var e=o.createElement(Q);if(e.id=L,e.style.cssText=R+S,e.tabIndex=-1,o.body.appendChild(e),t=e.contentWindow.document,-1==navigator.userAgent.indexOf(T)){t.open();var n=document.compatMode==U?V:W;t.write(n+X),t.close()}}}function w(e){q(cb,eb),function(e){function t(){return _typeof(o.readyState)==Y?_typeof(o.body)!=Y&&null!=o.body:/loaded|complete/.test(o.readyState)}var n=t();if(n)e();else{o.addEventListener&&o.addEventListener(Z,r,!1);var i=setInterval((function(){r()}),$)}function r(){if(!n){if(!t())return;n=!0,e(),o.removeEventListener&&o.removeEventListener(Z,r,!1),i&&clearInterval(i)}}}((function(){var t,n,o,i;t=e,n=u(),o=n.body,(i=n.createElement(_)).language=ab,i.crossOrigin=W,i.src=t,webModule.__errFn&&(i.onerror=function(){webModule.__errFn(L,new Error(bb+t))}),o.appendChild(i),q(cb,db)}))}function A(){for(var c={},d,e,f=o.getElementsByTagName(fb),g=O,h=f.length;g<h;++g){var i=f[g],j=i.getAttribute(gb),k;if(j){if(j=j.replace(hb,W),j.indexOf(ib)>=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;n<t.length;++n)if(-1!=t[n].src.indexOf(xb))return e(t[n].src);return W}()),n==W&&(n=function(){var e=o.getElementsByTagName(yb);return e.length>O?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;i<o.length;i++){var r=o[i];n[r[O]]=r[P]}return n}},webModule.__startLoadingFragment=function(e){return C(e)},webModule.__installRunAsyncCode=function(e){var t=u(),n=t.body,o=t.createElement(_);o.language=ab,o.text=e,n.appendChild(o),n.removeChild(o)},A(),webModule.__moduleBase="/js/mathematicalGraphics/"+name+"/",s[L].moduleBase=webModule.__moduleBase;var G=D();return F(),w(G),!0}return webModule},"function"!=typeof window.web3d&&(window.web3d=GGBAppletUtils.makeModule("web3d","A18F540516513B1292CA7CEF2F6AFC7E")),"function"!=typeof window.webSimple&&(window.webSimple=GGBAppletUtils.makeModule("webSimple","96B09BF1B436BF53F0DF54116700F16A")),window.GGBApplet=GGBApplet}else console.warn("deployggb.js was loaded twice")})()},18468:function(e,t,n){"use strict";function o(e){var t=!0;if(e.length>0){for(var n=0;n<e.length;n++)if(0==e[n].compile_success||!e[n].compile_success){t=!1;break}}else t=!1;return t}function i(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=[],o=0;o<e.length;o++){var i=e[o],r=t?"".concat(t,"/").concat(i.name):"".concat(i.name);n.push({title:i.name,type:i.type,isLeaf:"tree"!==i.type,key:r})}return n}function r(e,t,n){for(var o=0;o<e.length;o++){var i=e[o];if(i.key===t){i.children=n;break}i.children&&r(i.children,t,n)}return e}function a(e,t,n){var o;return function(){var i=this,r=arguments,a=function(){o=null,n||e.apply(i,r)},l=n&&!o;clearTimeout(o),o=setTimeout(a,t),l&&e.apply(i,r)}}n.d(t,{Ax:function(){return r},Ds:function(){return a},KI:function(){return l},SI:function(){return i},f1:function(){return o}});var l=n(15309).Z.API_SERVER},84093:function(e,t,n){"use strict";n.d(t,{Z:function(){return y}});var o=n(7557),i=n.n(o),r=n(41498),a=n.n(r),l=n(79800),s=n.n(l),c=n(59301),u="imageDimensions___a7crR",d="img___Kroat",f="fullWidth___c492T",p=n(92310),h=n.n(p),m=n(71418),g=n(2859),w=n(79311),v=n(27627),b=n(37712),y=function(e){var t=e.data,n=e.className,o=e.fullWidth,r=e.style,l=void 0===r?{}:r,p=e.onClose,y=e.onOk,x=e.showFullTools,_=e.noAssociationId,k=(0,c.useRef)(null),S=(0,c.useRef)(null),C=(0,c.useRef)(null),B=(0,c.useRef)(null),T=(0,c.useState)(!1),j=s()(T,2),P=j[0],N=j[1],E=(0,c.useState)("正在加载中"),L=s()(E,2),M=L[0],A=L[1];(0,c.useEffect)((function(){C.current||(C.current=document.createElement("style"),document.head.appendChild(C.current)),null!=t&&t.visible?(document.body.setAttribute("data-custom","y-hidden"),C.current.innerHTML=" html { overflow-y: hidden; }",null!=t&&t.src&&G()):(document.body.removeAttribute("data-custom"),C.current&&(document.head.removeChild(C.current),C.current=null))}),[null==t?void 0:t.visible]);var G=function(){var e=a()(i()().mark((function e(){var n;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return N(!0),A("正在加载中"),e.next=4,(0,v.ZJ)(null==t?void 0:t.src);case 4:n=e.sent,k.current.src="",k.current.src=n,k.current.onload=function(){I()},N(!1),A("");case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),O=function(){var e=a()(i()().mark((function e(n){var o;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return N(!0),A("正在保存中"),e.next=4,(0,w.ZP)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:t.title,file:n.dataUrl}});case 4:if(null==(o=e.sent)||!o.id||_){e.next=12;break}return e.next=8,(0,w.ZP)("/api/attachments/".concat(t.id,"/add_subitem.json"),{method:"post",body:{subitem_id:null==o?void 0:o.id,settings:JSON.stringify(n.state)}});case 8:0===e.sent.status&&y(),e.next=13;break;case 12:null!=o&&o.id&&y(o);case 13:N(!1),A("");case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),I=function(){S.current=new g.hP(k.current),S.current.targetRoot=B.current,S.current.addEventListener("render",O),S.current.addEventListener("beforeclose",p),x&&(S.current.availableMarkerTypes=S.current.ALL_MARKER_TYPES,S.current.uiStyleSettings.redoButtonVisible=!0,S.current.uiStyleSettings.notesButtonVisible=!0,S.current.uiStyleSettings.zoomButtonVisible=!0,S.current.uiStyleSettings.zoomOutButtonVisible=!0,S.current.uiStyleSettings.clearButtonVisible=!0),window.markerArea=S.current.uiStyleSettings,S.current.show(),null!=t&&t.snapshotData&&S.current.restoreState(t.snapshotData),setTimeout((function(){var e;window.scrollTo(0,0),(e=document.querySelector('a[href="https://markerjs.com/"]'))&&e.parentNode&&(e.parentNode.style.display="none"),[{name:'[data-action="select"]',title:"选择"},{name:'[data-action="delete"]',title:"删除元素"},{name:'[data-action="undo"]',title:"撤销"},{name:'[data-type-name="FrameMarker"]',title:"矩形"},{name:'[data-type-name="FreehandMarker"]',title:"画线"},{name:'[data-type-name="ArrowMarker"]',title:"箭头"},{name:'[data-type-name="TextMarker"]',title:"文本"},{name:'[data-type-name="EllipseMarker"]',title:"椭圆"},{name:'[data-type-name="HighlightMarker"]',title:"方块"},{name:'[data-type-name="CalloutMarker"]',title:"注释"},{name:'[data-action="render"]',title:"保存"},{name:'[data-action="close"]',title:"退出"}].forEach((function(e){var t=document.querySelector(e.name);t&&t.setAttribute("title",e.title)}))}),300)};return(0,b.jsx)(c.Fragment,{children:(null==t?void 0:t.visible)&&(0,b.jsx)(m.Z,{spinning:P,tip:M,style:{position:"absolute"},children:(0,b.jsx)("div",{ref:B,className:h()(u,n,o?f:""),style:l,children:(0,b.jsx)("img",{className:d,ref:k})})})})}},35028:function(e,t,n){"use strict";n.d(t,{h:function(){return w}});var o=n(82242),i=n.n(o),r=n(79800),a=n.n(r),l=n(59301),s=n(57809),c=n(78241),u=n(3113),d=n(89780),f=n.n(d),p=(n(48860),n(48838),n(37712)),h=s.default.Option,m={labelCol:{span:4},wrapperCol:{span:20}},g={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};function w(e){var t=e.value,n=e.onChange,o=e.mode,r=e.options,s=void 0===r?{}:r,c=(0,l.useRef)(),u=(0,l.useState)(),d=a()(u,2),h=d[0],m=d[1];return(0,l.useEffect)((function(){if(h){var e=function(e){var t=e.getValue();n&&n(t)};return h.on("change",e),function(){h.off("change",e)}}}),[h,n]),(0,l.useEffect)((function(){h&&h.setOption("mode",o)}),[h,o]),(0,l.useEffect)((function(){h&&(t===h.getValue()&&""!==t||setTimeout((function(){h.setValue(t||"")}),300))}),[h,t]),(0,l.useEffect)((function(){if(c.current&&!h){var e=f().fromTextArea(c.current,i()({mode:o,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},s));m(e)}}),[c.current,h]),(0,p.jsx)("div",{className:"my-codemirror-container",children:(0,p.jsx)("textarea",{ref:c})})}t.Z=function(e){var t=e.callback,n=e.onCancel,o=(0,l.useState)("python"),r=a()(o,2),d=r[0],f=r[1];return(0,p.jsxs)(c.Z,i()(i()({},m),{},{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){t(e)},style:{width:500},children:[(0,p.jsx)(c.Z.Item,{label:"代码语言",name:"language",children:(0,p.jsx)(s.default,{getPopupContainer:function(e){return e.parentNode},onChange:function(e){f(g[e][1])},children:Object.keys(g).map((function(e){return(0,p.jsx)(h,{value:e,children:g[e][0]},e)}))})}),(0,p.jsx)(c.Z.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}],children:(0,p.jsx)(w,{mode:d})}),(0,p.jsxs)("div",{className:"flex-container flex-end",children:[(0,p.jsx)(u.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,p.jsx)(u.ZP,{type:"ghost",onClick:n,children:"取消"})]})]}))}},7575:function(e,t,n){"use strict";n.d(t,{Z:function(){return xe}});var o=n(91232),i=n.n(o),r=n(79800),a=n.n(r),l=n(85573),s=n.n(l),c=n(59301),u=n(89780),d=n.n(u),f=n(76374),p=(n(48860),n(6313),n(25717),n(99498),n(25419),n(67549),n(82011)),h=n(37712),m=function(e){var t=e.value,n=void 0===t?"":t,o=(e.className,e.showTextOnly,e.showLines,e.style,(0,c.useMemo)((function(){return""}),[n]));return(0,h.jsx)(h.Fragment,{children:(0,h.jsx)("div",{dangerouslySetInnerHTML:{__html:o}})})},g=n(82242),w=n.n(g),v=[{title:"粗体",icon:"md-iconfont icon-bold",actionName:"bold"},{title:"斜体",icon:"md-iconfont icon-italic",actionName:"italic"},"|",{title:"无序列表",icon:"md-iconfont icon-unorder-list",actionName:"list-ul"},{title:"有序列表",icon:"md-iconfont icon-order-list",actionName:"list-ol"},"|",{title:"行内代码",icon:"md-iconfont icon-code",actionName:"code"},{title:"代码块(多语言风格)",icon:"md-iconfont icon-file-code",actionName:"code-block"},{title:"链接",icon:"md-iconfont icon-link",actionName:"link"},"|",{title:"行内公式",icon:"md-iconfont icon-sum",actionName:"inline-latex"},{title:"数学图像",icon:"iconfont icon-shuxuetuxiang2",actionName:"maths-latex"},{title:"多行公式",icon:"iconfont icon-jisuan1",actionName:"latex"},"|",{title:"添加图片",icon:"md-iconfont icon-picture",actionName:"upload-image"},{title:"插入画图",icon:"iconfont icon-sheji",actionName:"draw-image"},{title:"插入流程图",icon:"iconfont icon-liucheng",actionName:"add-flowchart"},{title:"表格",icon:"md-iconfont icon-table",actionName:"add-table"},"|",{title:"换行",icon:"md-iconfont icon-minus",actionName:"line-break"},{title:"清空",icon:"md-iconfont icon-eraser",actionName:"eraser"}];function b(e){var t=e.onActionCallback,n=e.title,o=e.icon,i=e.actionName,r=e.className,a=void 0===r?"":r,l=e.children;return(0,h.jsxs)("a",{title:n,className:a,onClick:function(){t(i)},children:[(0,h.jsx)("i",{className:"".concat(o)}),l]})}var y=function(e){var t=e.watch,n=e.showNullButton,o=e.showNullProgramButton,i=e.onActionCallback,r=e.fullScreen,a=e.insertTemp,l=e.hidetoolBar,s=e.extraUse,c=[].concat(v,[{title:"".concat(t?"关闭实时预览":"开启实时预览"),icon:"".concat(t?"md-iconfont icon-eye-slash":"md-iconfont icon-eye"),actionName:"trigger-watch"}]);return(0,h.jsxs)("ul",{className:"markdown-toolbar-container",children:[!l&&c.map((function(e,t){return(0,h.jsx)("li",{children:e.actionName?(0,h.jsx)(b,w()(w()({},e),{},{onActionCallback:i})):(0,h.jsx)("span",{className:"v-line"})},t)})),n?(0,h.jsx)("li",{children:(0,h.jsx)(b,{icon:"md-iconfont icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-null-ch",onActionCallback:i,children:(0,h.jsx)("span",{className:"fill-tip",children:"点击插入\b填空项"})})}):null,o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("li",{children:(0,h.jsx)(b,{icon:"md-iconfont icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-signal",onActionCallback:i,children:(0,h.jsx)("span",{className:"fill-tip",children:"+单行填空项"})})}),(0,h.jsx)("li",{children:(0,h.jsx)(b,{icon:"md-iconfont icon-uniE900 insert-blank",className:"btn-null",title:"增加填空",actionName:"add-multiple",onActionCallback:i,children:(0,h.jsx)("span",{className:"fill-tip",children:"+多行填空项"})})})]}):null,a&&(0,h.jsx)("li",{children:(0,h.jsx)(b,{icon:"md-iconfont icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(a),onActionCallback:i,children:(0,h.jsx)("span",{className:"fill-tip",children:"插入模板"})})}),s&&(0,h.jsx)("li",{children:s}),(0,h.jsx)("li",{className:"btn-full-screen",children:(0,h.jsx)(b,{icon:"".concat(r?"md-iconfont icon-shrink":"md-iconfont icon-enlarge"),title:r?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:i})})]})},x=n(56386),_=n(78241),k=n(92832),S=n(3113),C={labelCol:{span:4},wrapperCol:{span:20}},B=function(e){var t=e.callback,n=e.onCancel;return(0,h.jsxs)(_.Z,w()(w()({},C),{},{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(e){t(e)},style:{width:500},children:[(0,h.jsx)(_.Z.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}],children:(0,h.jsx)(k.Z,{})}),(0,h.jsx)(_.Z.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}],children:(0,h.jsx)(k.Z,{})}),(0,h.jsxs)("div",{className:"flex-container flex-end",children:[(0,h.jsx)(S.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,h.jsx)(S.ZP,{type:"ghost",onClick:n,children:"取消"})]})]}))},T=n(35028),j=n(8899),P=n(95237),N=n(84093),E=function(e){var t=e.callback,n=e.onCancel,o=document.createElement("canvas"),i=o.getContext("2d");o.width=1e3,o.height=800,i.fillStyle="#ffffff",i.fillRect(0,0,o.width,o.height);var r=o.toDataURL("image/png");return(0,h.jsx)(P.Z,{style:{height:"100vh"},children:(0,h.jsx)(N.Z,{fullWidth:!0,noAssociationId:!0,showFullTools:!0,data:{src:r,visible:!0,title:String(Date.now())},onOk:function(e){t({src:e.url})},onClose:n})})},L=n(7557),M=n.n(L),A=n(41498),G=n.n(A),O=n(37205),I=n.n(O),R=n(12378);function Z(){go.CommandHandler.call(this),this._arrowKeyBehavior="move",this._pasteOffset=new go.Point(10,10),this._lastPasteOffset=new go.Point(0,0)}go.Diagram.inherit(Z,go.CommandHandler),Z.prototype.canAlignSelection=function(){var e=this.diagram;return null!==e&&!e.isReadOnly&&!e.isModelReadOnly&&!(e.selection.count<2)},Z.prototype.alignLeft=function(){var e=this.diagram;e.startTransaction("aligning left");var t=1/0;e.selection.each((function(e){e instanceof go.Link||(t=Math.min(e.position.x,t))})),e.selection.each((function(e){e instanceof go.Link||e.move(new go.Point(t,e.position.y))})),e.commitTransaction("aligning left")},Z.prototype.alignRight=function(){var e=this.diagram;e.startTransaction("aligning right");var t=-1/0;e.selection.each((function(e){if(!(e instanceof go.Link)){var n=e.actualBounds.x+e.actualBounds.width;t=Math.max(n,t)}})),e.selection.each((function(e){e instanceof go.Link||e.move(new go.Point(t-e.actualBounds.width,e.position.y))})),e.commitTransaction("aligning right")},Z.prototype.alignTop=function(){var e=this.diagram;e.startTransaction("alignTop");var t=1/0;e.selection.each((function(e){e instanceof go.Link||(t=Math.min(e.position.y,t))})),e.selection.each((function(e){e instanceof go.Link||e.move(new go.Point(e.position.x,t))})),e.commitTransaction("alignTop")},Z.prototype.alignBottom=function(){var e=this.diagram;e.startTransaction("aligning bottom");var t=-1/0;e.selection.each((function(e){if(!(e instanceof go.Link)){var n=e.actualBounds.y+e.actualBounds.height;t=Math.max(n,t)}})),e.selection.each((function(e){e instanceof go.Link||e.move(new go.Point(e.actualBounds.x,t-e.actualBounds.height))})),e.commitTransaction("aligning bottom")},Z.prototype.alignCenterX=function(){var e=this.diagram,t=e.selection.first();if(t){e.startTransaction("aligning Center X");var n=t.actualBounds.x+t.actualBounds.width/2;e.selection.each((function(e){e instanceof go.Link||e.move(new go.Point(n-e.actualBounds.width/2,e.actualBounds.y))})),e.commitTransaction("aligning Center X")}},Z.prototype.alignCenterY=function(){var e=this.diagram,t=e.selection.first();if(t){e.startTransaction("aligning Center Y");var n=t.actualBounds.y+t.actualBounds.height/2;e.selection.each((function(e){e instanceof go.Link||e.move(new go.Point(e.actualBounds.x,n-e.actualBounds.height/2))})),e.commitTransaction("aligning Center Y")}},Z.prototype.alignColumn=function(e){var t=this.diagram;t.startTransaction("align Column"),void 0===e&&(e=0),e=parseFloat(e);var n=new Array;t.selection.each((function(e){e instanceof go.Link||n.push(e)}));for(var o=0;o<n.length-1;o++){var i=n[o],r=i.actualBounds.y+i.actualBounds.height+e;n[o+1].move(new go.Point(i.actualBounds.x,r))}t.commitTransaction("align Column")},Z.prototype.alignRow=function(e){void 0===e&&(e=0),e=parseFloat(e);var t=this.diagram;t.startTransaction("align Row");var n=new Array;t.selection.each((function(e){e instanceof go.Link||n.push(e)}));for(var o=0;o<n.length-1;o++){var i=n[o],r=i.actualBounds.x+i.actualBounds.width+e;n[o+1].move(new go.Point(r,i.actualBounds.y))}t.commitTransaction("align Row")},Z.prototype.canRotate=function(e){var t=this.diagram;return null!==t&&!t.isReadOnly&&!t.isModelReadOnly&&!(t.selection.count<1)},Z.prototype.rotate=function(e){var t;void 0===e&&(e=90),(t=this.diagram).startTransaction("rotate "+e.toString()),(t=this.diagram).selection.each((function(t){t instanceof go.Link||t instanceof go.Group||(t.angle+=e)})),t.commitTransaction("rotate "+e.toString())},Z.prototype.pullToFront=function(){var e=this.diagram;e.startTransaction("pullToFront");var t=new go.Map;e.selection.each((function(e){t.set(e.layer,0)})),t.iteratorKeys.each((function(e){var n=0;e.parts.each((function(e){if(!e.isSelected){var t=e.zOrder;isNaN(t)?e.zOrder=0:n=Math.max(n,t)}})),t.set(e,n)})),e.selection.each((function(e){Z._assignZOrder(e,t.get(e.layer)+1)})),e.commitTransaction("pullToFront")},Z.prototype.pushToBack=function(){var e=this.diagram;e.startTransaction("pushToBack");var t=new go.Map;e.selection.each((function(e){t.set(e.layer,0)})),t.iteratorKeys.each((function(e){var n=0;e.parts.each((function(e){if(!e.isSelected){var t=e.zOrder;isNaN(t)?e.zOrder=0:n=Math.min(n,t)}})),t.set(e,n)})),e.selection.each((function(e){Z._assignZOrder(e,t.get(e.layer)-1-Z._findGroupDepth(e))})),e.commitTransaction("pushToBack")},Z._assignZOrder=function(e,t,n){void 0===n&&(n=e),e.layer===n.layer&&(e.zOrder=t),e instanceof go.Group&&e.memberParts.each((function(e){Z._assignZOrder(e,t+1,n)}))},Z._findGroupDepth=function(e){if(e instanceof go.Group){var t=0;return e.memberParts.each((function(e){t=Math.max(t,Z._findGroupDepth(e))})),t+1}return 0},Z.prototype.doKeyDown=function(){var e=this.diagram;if(null!==e){var t=e.lastInput;if("Up"===t.key||"Down"===t.key||"Left"===t.key||"Right"===t.key){var n=this.arrowKeyBehavior;if("none"===n)return;if("select"===n)return void this._arrowKeySelect();if("move"===n)return void this._arrowKeyMove();if("tree"===n)return void this._arrowKeyTree()}go.CommandHandler.prototype.doKeyDown.call(this)}},Z.prototype._getAllParts=function(){var e=new Array;return this.diagram.nodes.each((function(t){e.push(t)})),this.diagram.parts.each((function(t){e.push(t)})),e},Z.prototype._arrowKeyMove=function(){var e=this.diagram,t=e.lastInput,n=0,o=0;if(t.control||t.meta)n=1,o=1;else if(null!==e.grid){var i=e.grid.gridCellSize;o=i.width,n=i.height}e.startTransaction("arrowKeyMove"),e.selection.each((function(e){"Up"===t.key?e.move(new go.Point(e.actualBounds.x,e.actualBounds.y-n)):"Down"===t.key?e.move(new go.Point(e.actualBounds.x,e.actualBounds.y+n)):"Left"===t.key?e.move(new go.Point(e.actualBounds.x-o,e.actualBounds.y)):"Right"===t.key&&e.move(new go.Point(e.actualBounds.x+o,e.actualBounds.y))})),e.commitTransaction("arrowKeyMove")},Z.prototype._arrowKeySelect=function(){var e=this.diagram,t=e.lastInput,n=null;"Up"===t.key?n=this._findNearestPartTowards(270):"Down"===t.key?n=this._findNearestPartTowards(90):"Left"===t.key?n=this._findNearestPartTowards(180):"Right"===t.key&&(n=this._findNearestPartTowards(0)),null!==n&&(t.shift?n.isSelected=!0:t.control||t.meta?n.isSelected=!n.isSelected:e.select(n))},Z.prototype._findNearestPartTowards=function(e){var t=this.diagram.selection.first();if(null===t)return null;for(var n=t.actualBounds.center,o=this._getAllParts(),i=1/0,r=t,a=0;a<o.length;a++){var l=o[a];if(l!==t&&l.canSelect()){var s=l.actualBounds.center,c=n.directionPoint(s),u=this._angleCloseness(c,e);if(u<=45){var d=n.distanceSquaredPoint(s);(d*=1+Math.sin(u*Math.PI/180))<i&&(i=d,r=l)}}}return r},Z.prototype._angleCloseness=function(e,t){return Math.min(Math.abs(t-e),Math.min(Math.abs(t+360-e),Math.abs(t-360-e)))},Z.prototype._arrowKeyTree=function(){var e=this.diagram,t=e.selection.first();if(t instanceof go.Node){var n=e.lastInput;if("Right"===n.key)if(t.isTreeLeaf);else if(t.isTreeExpanded){null!==(i=this._sortTreeChildrenByY(t).first())&&e.select(i)}else e.commandHandler.canExpandTree(t)&&e.commandHandler.expandTree(t);else if("Left"===n.key){if(!t.isTreeLeaf&&t.isTreeExpanded)e.commandHandler.canCollapseTree(t)&&e.commandHandler.collapseTree(t);else null!==(r=t.findTreeParentNode())&&e.select(r)}else if("Up"===n.key){if(null!==(r=t.findTreeParentNode()))if((l=(a=this._sortTreeChildrenByY(r)).indexOf(t))>0){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))<a.length-1){e.select(a.elt(l+1));break}t=r}}var s=e.selection.first();null!==s&&e.scrollToRect(s.actualBounds)}},Z.prototype._sortTreeChildrenByY=function(e){var t=(new go.List).addAll(e.findTreeChildrenNodes());return t.sort((function(e,t){var n=e.location,o=t.location;return n.y<o.y?-1:n.y>o.y?1:n.x<o.x?-1:n.x>o.x?1:0})),t},Z.prototype.copyToClipboard=function(e){go.CommandHandler.prototype.copyToClipboard.call(this,e),this._lastPasteOffset.set(this.pasteOffset)},Z.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(Z.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(Z.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 D=Z,F=(n(15379),n(85160)),H=n(43418),W=n(43604),z=n(79311),V="myPaletteDiv___Xjz2I",q="maxH60___Pd4Re";window.go=R;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),u=(0,c.useState)(0),d=a()(u,2),f=d[0],p=d[1],m=function(){var e=G()(M()().mark((function e(){var t,i;return M()().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)(H.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)(P.Z,{children:[(0,h.jsx)(W.Z,{flex:1,children:"插入流程图"}),(0,h.jsx)(W.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)(F.FI,{initDiagram:function(){var e=R.GraphObject.make,t="#ff3333",n="#3358ff",a="#25ad23",l="#d533ff",s="#7d33ff",c="#ff6233",u="#ffffff",d="#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 R.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(R.Shape,{figure:n,alignment:t,alignmentFocus:t.opposite(),width:t.equals(R.Spot.Top)||t.equals(R.Spot.Bottom)?25:18,height:t.equals(R.Spot.Top)||t.equals(R.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:o,contextClick:o})}function y(t){return e(R.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 _(t,n){return n||(n="color"),e(R.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 k(){return[e("ContextMenuButton",e(R.Panel,"Horizontal",_(u,"fill"),_(f,"fill"),_(p,"fill"),_(h,"fill"))),e("ContextMenuButton",e(R.Panel,"Horizontal",_(g,"fill"),_(w,"fill"),_(m,"fill"),_(v,"fill")))]}function S(){return[e("ContextMenuButton",e(R.Panel,"Horizontal",_(d),_(a),_(n),_(t))),e("ContextMenuButton",e(R.Panel,"Horizontal",_(u),_(l),_(s),_(c)))]}function C(t,n){return n||(n="thickness"),e(R.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 B(t,n){return n||(n="dash"),e(R.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 T(){return[e("ContextMenuButton",e(R.Panel,"Horizontal",C(1),C(2),C(3),C(4))),e("ContextMenuButton",e(R.Panel,"Horizontal",B(null),B([2,4]),B([4,4])))]}function j(t,n){return n||(n="figure"),e(R.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 P(t){return e(R.Shape,{stroke:"dodgerblue",strokeWidth:2,strokeCap:"square",geometryString:"M0 0 M4 2 H3 M4 "+(t+4).toString()+" H3"})}function N(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(R.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 E(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",R.Spot.stringify(R.Spot.AllSides)),(t?o.toNode:o.fromNode).invalidateConnectedLinks()}))};return e(R.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 o=0,i=R.Spot.RightSide;t.equals(R.Spot.Top)?(o=270,i=R.Spot.TopSide):t.equals(R.Spot.Left)?(o=180,i=R.Spot.LeftSide):t.equals(R.Spot.Bottom)&&(o=90,i=R.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",R.Spot.stringify(i)),(n?o.toNode:o.fromNode).invalidateConnectedLinks()}))};return e(R.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 R.Diagram(i.current,{padding:20,grid:e(R.Panel,"Grid",e(R.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(R.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(D),"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(R.Node,"Auto",{locationSpot:R.Spot.Center,locationObjectName:"SHAPE",desiredSize:new R.Size(120,60),minSize:new R.Size(40,40),resizable:!0,resizeCellSize:new R.Size(10,10),rotatable:!0},new R.Binding("location","loc",R.Point.parse).makeTwoWay(R.Point.stringify),new R.Binding("desiredSize","size",R.Size.parse).makeTwoWay(R.Size.stringify),e(R.Shape,{name:"SHAPE",fill:u,cursor:"pointer",portId:"",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:R.Spot.AllSides,toSpot:R.Spot.AllSides},new R.Binding("figure"),new R.Binding("fill"),new R.Binding("stroke","borderColor"),new R.Binding("strokeWidth","thickness"),new R.Binding("strokeDashArray","dash")),e(R.Shape,{width:100,height:20,strokeWidth:0,fill:"transparent"}),e(R.TextBlock,{margin:1,textAlign:"center",overflow:R.TextBlock.OverflowEllipsis,editable:!0},new R.Binding("text").makeTwoWay(),new R.Binding("stroke","color"))),o.current.nodeTemplate.toolTip=e("ToolTip",e(R.Panel,"Vertical",{maxSize:new R.Size(200,NaN)},e(R.TextBlock,{font:"bold 10pt sans-serif",textAlign:"center"},new R.Binding("text")),e(R.TextBlock,{font:"10pt sans-serif",textAlign:"center"},new R.Binding("text","details")))),o.current.nodeTemplate.selectionAdornmentTemplate=e(R.Adornment,"Spot",e(R.Placeholder,{padding:10}),b(R.Spot.Top,"TriangleUp"),b(R.Spot.Left,"TriangleLeft"),b(R.Spot.Right,"TriangleRight"),b(R.Spot.Bottom,"TriangleDown"),y({alignment:new R.Spot(.75,0)})),o.current.nodeTemplate.contextMenu=e("ContextMenu",e("ContextMenuButton",e(R.Panel,"Horizontal",j("Rectangle"),j("RoundedRectangle"),j("Ellipse"),j("Diamond"))),e("ContextMenuButton",e(R.Panel,"Horizontal",j("Parallelogram2"),j("ManualOperation"),j("Procedure"),j("Cylinder1"))),e("ContextMenuButton",e(R.Panel,"Horizontal",j("Terminator"),j("CreateRequest"),j("Document"),j("TriangleDown"))),k(),S(),T()),o.current.groupTemplate=e(R.Group,"Spot",{layerName:"Background",ungroupable:!0,locationSpot:R.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 R.Binding("location","loc",R.Point.parse).makeTwoWay(R.Point.stringify),e(R.Panel,"Auto",{name:"BODY"},e(R.Shape,{parameter1:10,fill:u,strokeWidth:2,cursor:"pointer",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:R.Spot.AllSides,toSpot:R.Spot.AllSides},new R.Binding("fill"),new R.Binding("stroke","color"),new R.Binding("strokeWidth","thickness"),new R.Binding("strokeDashArray","dash")),e(R.Placeholder,{background:"transparent",margin:20})),e(R.TextBlock,{alignment:R.Spot.Top,alignmentFocus:R.Spot.Bottom,font:"bold 12pt sans-serif",editable:!0},new R.Binding("text"),new R.Binding("stroke","color"))),o.current.groupTemplate.selectionAdornmentTemplate=e(R.Adornment,"Spot",e(R.Panel,"Auto",e(R.Shape,{fill:null,stroke:"dodgerblue",strokeWidth:3}),e(R.Placeholder,{margin:1.5})),y({alignment:R.Spot.TopRight,alignmentFocus:R.Spot.BottomRight})),o.current.groupTemplate.contextMenu=e("ContextMenu",k(),S(),T()),o.current.linkTemplate=e(R.Link,{layerName:"Foreground",routing:R.Link.AvoidsNodes,corner:10,fromShortLength:10,toShortLength:15,relinkableFrom:!0,relinkableTo:!0,reshapable:!0,resegmentable:!0},new R.Binding("fromSpot","fromSpot",R.Spot.parse),new R.Binding("toSpot","toSpot",R.Spot.parse),new R.Binding("fromShortLength","dir",(function(e){return e>=1?10:0})),new R.Binding("toShortLength","dir",(function(e){return e>=1?10:0})),new R.Binding("points").makeTwoWay(),e(R.Shape,{strokeWidth:2},new R.Binding("stroke","color"),new R.Binding("strokeWidth","thickness"),new R.Binding("strokeDashArray","dash")),e(R.Shape,{segmentIndex:0,segmentOffset:new R.Point(15,0),segmentOrientation:R.Link.OrientAlong,alignmentFocus:R.Spot.Right,figure:"circle",width:10,strokeWidth:0},new R.Binding("fill","color"),new R.Binding("visible","dir",(function(e){return 1===e}))),e(R.Shape,{segmentIndex:-1,segmentOffset:new R.Point(-10,6),segmentOrientation:R.Link.OrientPlus90,alignmentFocus:R.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new R.Binding("fill","color"),new R.Binding("visible","dir",(function(e){return e>=1})),new R.Binding("width","thickness",(function(e){return 7+3*e})),new R.Binding("height","thickness",(function(e){return 7+3*e})),new R.Binding("segmentOffset","thickness",(function(e){return new R.Point(-15,4+1.5*e)}))),e(R.Shape,{segmentIndex:0,segmentOffset:new R.Point(15,-6),segmentOrientation:R.Link.OrientMinus90,alignmentFocus:R.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new R.Binding("fill","color"),new R.Binding("visible","dir",(function(e){return 2===e})),new R.Binding("width","thickness",(function(e){return 7+3*e})),new R.Binding("height","thickness",(function(e){return 7+3*e})),new R.Binding("segmentOffset","thickness",(function(e){return new R.Point(-15,4+1.5*e)}))),e(R.TextBlock,{alignmentFocus:new R.Spot(0,1,-4,0),editable:!0},new R.Binding("text").makeTwoWay(),new R.Binding("stroke","color"))),o.current.linkTemplate.selectionAdornmentTemplate=e(R.Adornment,e(R.Shape,{isPanelMain:!0,stroke:"transparent",strokeWidth:6,pathPattern:P(2)},new R.Binding("pathPattern","thickness",P)),y({alignmentFocus:new R.Spot(0,0,-6,-4)})),o.current.linkTemplate.contextMenu=e("ContextMenu",S(),T(),e("ContextMenuButton",e(R.Panel,"Horizontal",N(0),N(1),N(2))),e("ContextMenuButton",e(R.Panel,"Horizontal",e(R.Panel,"Spot",E(!1),L(R.Spot.Top,!1),L(R.Spot.Left,!1),L(R.Spot.Right,!1),L(R.Spot.Bottom,!1)),e(R.Panel,"Spot",{margin:new R.Margin(0,0,0,2)},E(!0),L(R.Spot.Top,!0),L(R.Spot.Left,!0),L(R.Spot.Right,!0),L(R.Spot.Bottom,!0))))),new R.Palette(r.current,{maxSelectionCount:1,linkTemplate:e(R.Link,{locationSpot:R.Spot.Center,selectionAdornmentTemplate:e(R.Adornment,"Link",{locationSpot:R.Spot.Center},e(R.Shape,{isPanelMain:!0,fill:null,stroke:"deepskyblue",strokeWidth:0}),e(R.Shape,{toArrow:"Standard",stroke:null}))},{routing:R.Link.AvoidsNodes,curve:R.Link.JumpOver,corner:5,toShortLength:4},new R.Binding("points"),e(R.Shape,{isPanelMain:!0,strokeWidth:2}),e(R.Shape,{toArrow:"Standard",stroke:null})),model:new R.GraphLinksModel([{text:"未命名",size:"100 100",fill:null,stroke:"#000"}].concat(I()(R.Shape.getFigureGenerators().toArray().map((function(e){return{text:"未命名",size:"100 100",figure:e.key,fill:"white",stroke:"#666",borderColor:"#000"}})))))}).nodeTemplate=e(R.Node,"Auto",{locationSpot:R.Spot.Center},new R.Binding("location","location",R.Point.parse).makeTwoWay(R.Point.stringify),e(R.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 R.Binding("stroke").makeTwoWay(),new R.Binding("fill").makeTwoWay(),new R.Binding("figure")),e(R.TextBlock,{margin:new R.Margin(5,5,3,5),font:"10pt sans-serif",minSize:new R.Size(16,16),maxSize:new R.Size(10,NaN),textAlign:"center",editable:!0},new R.Binding("key").makeTwoWay())),setTimeout((function(){o.current.grid=e(R.Panel,"Grid",e(R.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(R.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)(S.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)(_.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)(_.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,h.jsx)(Y.Z,{})}),(0,h.jsx)("span",{style:X,children:"列数"}),(0,h.jsx)(_.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)(_.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)(S.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,h.jsx)(S.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)(),u=(0,c.useState)(!1),d=a()(u,2),f=d[0],p=d[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)(P.Z,{align:"middle",children:[(0,h.jsx)(W.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)(W.Z,{children:(0,h.jsx)(S.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",ue="code-block",de="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,"添加链接"),ue,"添加代码块"),le,"添加图片"),ce,"添加画图"),se,"插入流程图"),de,"添加表格"),"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,u=e.height,g=void 0===u?400:u,w=e.miniToolbar,v=void 0!==w&&w,b=e.isFocus,_=void 0!==b&&b,k=e.watch,S=e.insertTemp,C=e.mode,P=void 0===C?"markdown":C,N=e.id,L=void 0===N?"markdown-editor-id":N,M=e.showResizeBar,A=void 0!==M&&M,G=e.noStorage,O=void 0!==G&&G,I=e.showNullButton,R=void 0!==I&&I,Z=e.showNullProgramButton,D=void 0!==Z&&Z,F=e.hidetoolBar,W=void 0!==F&&F,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,_e=e.placeholder,ke=void 0===_e?"":_e,Se=e.values,Ce=void 0===Se?"":Se,Be=e.extraUse,Te=(0,c.useState)(null),je=a()(Te,2),Pe=je[0],Ne=je[1],Ee=(0,c.useState)(n),Le=a()(Ee,2),Me=Le[0],Ae=Le[1],Ge=(0,c.useState)(k),Oe=a()(Ge,2),Ie=Oe[0],Re=Oe[1],Ze=(0,c.useState)(V),De=a()(Ze,2),Fe=De[0],He=De[1],We=(0,c.useState)(""),ze=a()(We,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),ut=ct[0],dt=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;Ae(Ce),null==Pe||Pe.setValue(Ce),window.scrollTo(0,e)}),[Ce]),(0,c.useEffect)((function(){null==Y||Y(Fe)}),[Fe]),(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"==P)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,j.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(".concat(e.content_type,")")):(null==s||null===(o=s.type)||void 0===o?void 0:o.indexOf("video"))>-1?t.replaceSelection('<video width="100%" controls src="'.concat(ie.Z.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==s||null===(i=s.type)||void 0===i?void 0:i.indexOf("pdf"))>-1?t.replaceSelection('<a href="'.concat(ie.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(s.type,'&disposition=inline" target="_blank">').concat(s.name,"</a>")):ge.includes(c)?t.replaceSelection('<a href="'.concat(ie.Z.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(s.name,"</a>")):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=d().fromTextArea(ft.current,{mode:P,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",ke):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 u=s+c;return n.replaceRange("",{line:o.line,ch:s},{line:o.line,ch:u}),{line:o.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()})),Ne(t),function(){t.off("paste",e)}}}),[]);var gt=(0,c.useCallback)((function(){pt.current}),[Qe,pt,Fe]);(0,c.useEffect)((function(){if(Pe){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(),Pe.setSize("100%","100%"),Pe.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)}}}),[Pe,gt]),(0,c.useEffect)((function(){if(Pe){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),Pe.addKeyMap(l)},n=0,o=Object.entries(be);n<o.length;n++)t();return function(){for(var t=0,n=e;t<n.length;t++){var o=n[t];Pe.removeKeyMap(o)}}}}),[Pe]),(0,c.useEffect)((function(){V!==Fe&&He(V)}),[V]),(0,he.Z)((function(){if(!O&&Ye>0){var e=(new Date).getTime(),t=window.sessionStorage.getItem(L);e>=Ye+1e4&&(!t||t!==Me)&&(window.sessionStorage.setItem(L,Me),ot(!0))}}),1e4),(0,c.useEffect)((function(){Re(k)}),[Pe,k]),(0,c.useEffect)((function(){Pe&&_&&Pe.focus()}),[Pe,_]),(0,c.useEffect)((function(){if(Ie&&Pe){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=Pe.getScrollerElement();return t.addEventListener("scroll",e),function(){t.removeEventListener("scroll",e)}}}),[Pe,Ie]),(0,c.useEffect)((function(){if(Pe&&K){var e=function(e,t){K(e,t)};return Pe.on("beforeChange",e),function(){Pe.off("beforeChange",e)}}}),[Pe,K]),(0,c.useEffect)((function(){if(Pe&&q){var e=function(){q(Pe.getValue())};return Pe.on("blur",e),function(){Pe.off("blur",e)}}}),[Pe,q]),(0,c.useEffect)((function(){if(Pe){var e=function(e,t){var n=e.getValue();Ae(n),Je((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),o&&(D?o(n,_t(n)):o(n))};return Pe.on("change",e),function(){Pe.off("change",e)}}}),[Pe,o]),(0,c.useEffect)((function(){if(Pe)if(null==n)Pe.setValue(""),Ae("");else{var e=window.scrollY||window.pageYOffset;n!==Pe.getValue()&&(Pe.setValue(n),Ae(n),Pe.setCursor(fe?1:Pe.lineCount(),0),window.scrollTo(0,e))}}),[Pe,n]);var wt=(0,c.useCallback)((function(e){var t=Pe.getCursor(),n=Pe.getSelection(),o=n.split("\n");switch(e){case"bold":return Pe.replaceSelection("**"+n+"**"),""===n&&Pe.setCursor(t.line,t.ch+2),Pe.focus();case"italic":return Pe.replaceSelection("*"+n+"*"),""===n&&Pe.setCursor(t.line,t.ch+1),Pe.focus();case"code":return Pe.replaceSelection("`"+n+"`"),""===n&&Pe.setCursor(t.line,t.ch+1),Pe.focus();case"inline-latex":return qe("inline-latex"),Pe.focus();case"latex":return Pe.replaceSelection("```latex\n"+n+"\n```"),Pe.setCursor(t.line+1,n.length+1),Pe.focus();case"line-break":return Pe.replaceSelection("<br/>\n"),Pe.focus();case"list-ul":return""===n?Pe.replaceSelection("- "+n):Pe.replaceSelection(o.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Pe.focus();case"list-ol":return""===n?Pe.replaceSelection("1. "+n):Pe.replaceSelection(o.map((function(e,t){return""===e?"":"".concat(t+1,". ").concat(e)})).join("\n")),Pe.focus();case"add-null-ch":return""===n&&Pe.setCursor(t.line,t.ch),Pe.replaceSelection("▁"),Pe.focus();case"add-signal":return""===n&&Pe.setCursor(t.line,t.ch),Pe.replaceSelection("@▁@"),Pe.focus();case"add-multiple":return""===n&&Pe.setCursor(t.line,t.ch),Pe.replaceSelection(me),Pe.focus();case"inster-template-1":return""===n&&Pe.setCursor(t.line,t.ch),Pe.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),Pe.focus();case"eraser":return Pe.setValue(""),Pe.focus();case"trigger-watch":return Re(!Ie),Pe.focus();case"trigger-full-screen":return He(!Fe),Pe.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}}),[Pe,Ie,Fe]),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 Pe.replaceSelection("[".concat(l,"](").concat(s,")")),Pe.focus();case ue:var c=e.language,u=e.content;return Pe.replaceSelection(["```"+c,u,"```"].join("\n")),Pe.focus();case"maths-latex":for(var d=atob(e),f=new Uint8Array(d.length),p=0;p<d.length;p++)f[p]=d.charCodeAt(p);var h=new Blob([f],{type:"image/png"});(0,j.I)(h,(function(e){e.id?Pe.replaceSelection(".concat(e.content_type,")")):401===(null==e?void 0:e.status)&&(document.location.href="/user/login")}));break;case"inline-latex":Pe.replaceSelection("`$$"+e+"$$`");break;case le:case ce:case"add-flowchart":var m=e.src,g=e.alt,w=t,v=null==w||null===(n=w.name)||void 0===n||null===(n=n.split("."))||void 0===n||null===(o=n.pop)||void 0===o?void 0:o.call(n);return(null==w||null===(i=w.type)||void 0===i?void 0:i.indexOf("image"))>-1||null==w||!w.type?g?Pe.replaceSelection(".concat(m,' "').concat(g,'" )')):Pe.replaceSelection("")):(null==w||null===(r=w.type)||void 0===r?void 0:r.indexOf("video"))>-1?Pe.replaceSelection('<video width="100%" controls src="'.concat(ie.Z.API_SERVER).concat(m,'"></video>')):(null==w||null===(a=w.type)||void 0===a?void 0:a.indexOf("pdf"))>-1?Pe.replaceSelection('<a href="'.concat(ie.Z.API_SERVER).concat(m,"?type=").concat(w.type,'&disposition=inline" target="_blank">').concat(w.name,"</a>")):ge.includes(v)?Pe.replaceSelection('<a href="'.concat(ie.Z.API_SERVER).concat(m,'?type=office&disposition=inline" target="_blank">').concat(w.name,"</a>")):Pe.replaceSelection("[".concat(w.name,"](").concat(ie.Z.API_SERVER).concat(m,")")),Pe.focus();case de:for(var b=e.row,y=e.col,x=e.align,_="\n",k=0;k<b;k++){for(var S=[],C=[],B=0;B<y;B++)1===k&&C.push(pe[x]),S.push(" ");1===k&&(_+="| ".concat(C.join(" | ")," |\n")),_+="| ".concat(S.join(1===y?"":" | ")," |\n")}return Pe.replaceSelection(_+"\n"),Pe.focus();default:throw new Error}}),[Pe,Ve]),bt=(0,c.useMemo)((function(){switch(Ve){case ae:return(0,h.jsx)(B,{callback:vt,onCancel:yt});case ue:return(0,h.jsx)(T.Z,{callback:vt,onCancel:yt});case le:return(0,h.jsx)(j.Z,{callback:vt,onCancel:yt});case se:return(0,h.jsx)(U,{callback:vt,onCancel:yt});case de:return(0,h.jsx)($,{callback:vt,onCancel:yt});case"maths-latex":return(0,h.jsx)(ne,{showSaveButton:!0,callback:vt});case"inline-latex":return(0,h.jsx)(oe.Z,{showSaveButton:!0,callback:vt});default:return null}}),[Ve]);function yt(){qe("")}(0,c.useEffect)((function(){if(ht.current){var e=function(e){i=!0,r=e.pageY},t=function(){i=!1},n=function(e){if(i){var t=e.pageY-r;t<0&&(t=0),t>300&&(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)}}}),[Pe,ht]),(0,c.useEffect)((function(){et(g)}),[g]);var xt={width:we(l),height:we(Qe)},_t=((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(D){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),dt(n)}),0)}),[Ve]);var kt=function(e,t,n,o){var i=document.body.clientHeight,r=document.body.clientWidth;return!(e<20&&n>e||e>r-20&&n<e||t<20&&o>t||t>i-20&&o<t)||(document.body.onmousemove=null,document.body.onmouseup=null,!1)};return(0,h.jsxs)(c.Fragment,{children:[(0,h.jsx)("div",{className:"markdown-editor-wrapper",ref:pt,children:(0,h.jsxs)("div",{className:"markdown-editor-container ".concat(X," ").concat(Ie?"on-preview":""," ").concat(v?"mini":""," ").concat(Fe?"full-screen":""),style:xt,children:[(0,h.jsx)(y,{insertTemp:S,watch:Ie,fullScreen:Fe,showNullButton:R,showNullProgramButton:D,onActionCallback:wt,hidetoolBar:W,extraUse:Be}),(0,h.jsxs)("div",{className:"markdown-editor-body",children:[(0,h.jsx)("div",{className:"codemirror-container",children:(0,h.jsx)("textarea",{ref:ft,placeholder:ke})}),Ie?(0,h.jsxs)("div",{ref:mt,className:"preview-container",children:["stex"===P&&(0,h.jsx)(m,{value:Me}),"stex"!==P&&(0,h.jsx)(p.Z,{disabledFill:xe,showProgramFill:D,value:Me})]}):null]})]})}),A?(0,h.jsx)("a",{ref:ht,className:"editor-resize"}):null,Ve===ce&&(0,h.jsx)(E,{callback:vt,onCancel:yt}),Ve===se&&(0,h.jsx)(U,{callback:vt,onCancel:yt}),(0,h.jsx)(x.Z,{children:ye[Ve]&&Ve!==ce&&Ve!==se?(0,h.jsx)(H.Z,{maskClosable:!1,centered:!0,style:{position:"absolute",left:at,top:ut},title:(0,h.jsx)("div",{style:{cursor:"move"},onMouseDown:function(e){e.preventDefault();var t=e.clientX-at,n=e.clientY-ut;document.body.onmousemove=function(e){var o=e.clientX-t,i=e.clientY-n,r=document.getElementsByClassName("markdown-popup-form")[0],a=window.innerWidth-r.offsetWidth,l=window.innerHeight-r.offsetHeight;o=Math.max(0,Math.min(o,a)),i=Math.max(0,Math.min(i,l)),kt(e.clientX,e.clientY,t,n)&&(lt(o),dt(i))},document.body.onmouseup=function(){document.body.onmousemove=null}},children:ye[Ve]}),open:!0,onCancel:yt,footer:null,destroyOnClose:!0,width:Ve===se?"1200px":null,height:Ve===se?"80vh":null,className:"markdown-popup-form",children:bt}):null})]})}},8899:function(e,t,n){"use strict";n.d(t,{Z:function(){return w},I:function(){return b}});var o=n(82242),i=n.n(o),r=n(79800),a=n.n(r),l=n(78241),s=n(8591),c=n(92832),u=n(3113),d=n(18468),f=n(59301),p=n(37712),h=l.Z.useForm,m={width:280,marginRight:10},g={labelCol:{span:5},wrapperCol:{span:19}},w=function(e){var t=e.callback,n=e.onCancel,o=h(),r=a()(o,1)[0],d=(0,f.useRef)();function w(e,t){-1!==e.status?r.setFieldsValue({src:"/api/attachments/".concat(e.id),type:t.type}):s.ZP.error(e.message)}return(0,p.jsxs)(l.Z,i()(i()({form:r},g),{},{className:"upload-image-panel",onFinish:function(e){t(e,d.current)},style:{width:470,overflow:"hidden"},children:[(0,p.jsx)(l.Z.Item,{label:"图片地址",required:!0,children:(0,p.jsxs)("div",{className:"flex-container",children:[(0,p.jsx)(l.Z.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入图片地址"}],children:(0,p.jsx)(c.Z,{style:m})}),(0,p.jsx)(v,{onFileChange:function(e){var t=e.target.files[0];d.current=t,b(t,w)}})]})}),(0,p.jsx)(l.Z.Item,{label:"图片描述",name:"alt",children:(0,p.jsx)(c.Z,{style:{width:264}})}),(0,p.jsxs)(l.Z.Item,{style:{textAlign:"right"},children:[(0,p.jsx)(u.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,p.jsx)(u.ZP,{type:"default",onClick:n,children:"取消"})]})]}))};function v(e){var t=e.onFileChange;return(0,p.jsxs)("label",{className:"upload-button",style:{cursor:"pointer"},children:["本地上传",(0,p.jsx)("input",{type:"file",onChange:t})]})}function b(e,t){if(!e)throw new String("没有文件");var n=new FormData;n.append("editormd-image-file",e),n.append("file_param_name","editormd-image-file"),n.append("byxhr","true");var o=new window.XMLHttpRequest;o.withCredentials=!0,o.addEventListener("load",(function(n){t(JSON.parse(n.target.responseText),e)}),!1),o.addEventListener("error",(function(e){console.error(e)}),!1),o.open("POST","".concat(d.KI,"/api/attachments.json")),o.send(n)}},56386:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var o=n(82100),i=n.n(o),r=n(29186),a=n.n(r),l=n(80619),s=n.n(l),c=n(47074),u=n.n(c),d=n(59301),f=n(4676),p=function(e){s()(n,e);var t=u()(n);function n(e){var o;i()(this,n),o=t.call(this,e);var r=window.document;return o.node=r.createElement("div"),r.body.appendChild(o.node),o}return a()(n,[{key:"render",value:function(){var e=this.props.children;return(0,f.createPortal)(e,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),n}(d.Component)},70325:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var o=n(59301);function i(e,t){var n=(0,o.useRef)();(0,o.useEffect)((function(){n.current=e})),(0,o.useEffect)((function(){if(null!==t){var e=setInterval((function(){n.current()}),t);return function(){return clearInterval(e)}}}),[t])}},87467:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return I}});var o=n(7557),i=n.n(o),r=n(41498),a=n.n(r),l=n(79800),s=n.n(l),c=n(59301),u=n(20834),d=n(44e3),f=n(8591),p=n(43418),h=n(60324),m=n(15309),g={flex_box_center:"flex_box_center___GfbI9",flex_space_between:"flex_space_between___m14JJ",flex_box_vertical_center:"flex_box_vertical_center___IKGDg",flex_box_center_end:"flex_box_center_end___JZxvM",flex_box_column:"flex_box_column___WnVa8",SubMentItem:"SubMentItem___P0LXo",MenuItem:"MenuItem___p91mQ",wrp:"wrp___kMQ4i",classroomInfo:"classroomInfo___rb1qC",title:"title___AQndp",titleLeft:"titleLeft___K7c9u",titleRight:"titleRight___BUODH",classroomUser:"classroomUser___NkYxe",headPic:"headPic___RD_it",teacherInfo:"teacherInfo___Gyj_W",classroomDesc:"classroomDesc___ng_AB",classroomDescBg:"classroomDescBg___Dz_DM",joinCouses:"joinCouses___U2D0G",bg:"bg___IcypX",leftMenus:"leftMenus___fF5qD",titleSelected:"titleSelected___Rqtd8",menuText:"menuText___jhrfq",totalCount:"totalCount___fqkbl",actions:"actions___NAYZl",task_count:"task_count___a1sYB",container:"container___djeCS",leftMenuActions:"leftMenuActions___lRhBF"},w=n(79311),v=n(51876),b=n(680),y=n(51131),x=n(38296),_=n(92832),k=n(37712);var S=(0,v.connect)((function(e){return{user:e.user}}))((function(e){e.user;var t=e.CategoryId,n=e.IsShow,o=e.setIsShow,r=(e.dispatch,e.init),l=(0,c.useState)(),u=s()(l,2),d=u[0],h=u[1];return(0,k.jsx)(p.Z,{title:t?"新建三级类目":"新建二级类目",width:424,onCancel:function(){o(!1)},onOk:a()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d){e.next=3;break}return f.ZP.error("栏目名不能为空"),e.abrupt("return");case 3:return e.next=5,(0,w.ZP)("/api/programas.json",{method:"post",body:{name:d,parent_id:t}});case 5:0===e.sent.status&&(f.ZP.info("创建成功"),o(!1),h(""),r());case 7:case"end":return e.stop()}}),e)}))),open:n,children:(0,k.jsx)(_.Z,{value:d,onChange:function(e){return h(e.target.value)},placeholder:"请输入不超过10个汉字的名称",maxLength:10})})}));var C=(0,v.connect)((function(e){return{user:e.user}}))((function(e){e.user;var t=e.CategoryId,n=e.name,o=e.IsShow,r=e.setIsShow,l=(e.dispatch,e.init),u=(0,c.useState)(),d=s()(u,2),h=d[0],m=d[1];return(0,c.useEffect)((function(){m(n)}),[n]),(0,k.jsx)(p.Z,{title:"目录重命名",width:424,onCancel:function(){r(!1)},onOk:a()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h){e.next=3;break}return f.ZP.error("栏目名不能为空"),e.abrupt("return");case 3:return e.next=5,(0,w.ZP)("/api/programas/".concat(t,"/rename.json"),{method:"put",body:{name:h,id:t}});case 5:0===e.sent.status&&(f.ZP.info("修改成功"),r(!1),m(""),l());case 7:case"end":return e.stop()}}),e)}))),open:o,children:(0,k.jsx)(_.Z,{value:h,onChange:function(e){return m(e.target.value)},placeholder:"请输入不超过10个汉字的名称",maxLength:10})})})),B=n(3113),T=n(82011);var j=(0,v.connect)((function(e){return{user:e.user}}))((function(e){e.user;var t,n,o,i,r=e.ItemData,a=e.setIssee;return e.dispatch,e.init,(0,k.jsxs)("div",{children:[(0,k.jsx)("div",{style:{textAlign:"right"},children:(0,x.Ny)()&&(0,k.jsx)(B.ZP,{onClick:function(){return a(!1)},children:"编辑"})}),(0,k.jsx)(T.Z,{value:r.content}),(null==r||null===(t=r.attachment)||void 0===t?void 0:t.id)&&(0,k.jsx)("div",{children:(0,k.jsxs)("a",{href:null==r||null===(n=r.attachment)||void 0===n?void 0:n.url,target:"_self",download:null==r||null===(o=r.attachment)||void 0===o?void 0:o.title,children:[(0,k.jsx)("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),(0,k.jsx)("span",{style:{color:"#000000"},children:null==r||null===(i=r.attachment)||void 0===i?void 0:i.title})]})})]})})),P=n(82242),N=n.n(P),E=n(59028),L=n(7575),M=n(44822);var A=(0,v.connect)((function(e){return{user:e.user}}))((function(e){e.user;var t,n,o=e.ItemData,r=e.setIssee,l=e.CategoryId,u=(e.dispatch,e.init,(0,c.useState)([])),d=s()(u,2),p=d[0],h=d[1],g=(0,c.useState)(o.content),v=s()(g,2),b=v[0],y=v[1],x={name:"file",multiple:!0,action:m.Z.API_SERVER+"/api/attachments.json",defaultFileList:(n=[],null==o||null===(t=o.attachments)||void 0===t||t.map((function(e){var t={uid:null==e?void 0:e.id,name:e.title,response:{id:e.id}};n.push(t)})),n),onRemove:function(e){(0,M.y8)({id:e.uid})},onChange:function(e){console.log("info",e);var t=e.file.status;"removed"===t&&h(e.fileList),"done"===t?(h(e.fileList),f.ZP.success("".concat(e.file.name," 文件上传成功"))):"error"===t&&f.ZP.error("".concat(e.file.name," 文件上传失败"))},beforeUpload:function(e){var t=e.size/1024/1024<150;return t||f.ZP.info("文件大小必须小于150MB"),t}};function _(){return(_=a()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,w.ZP)("/api/programas/".concat(l,"/update_content.json"),{method:"put",body:{id:l,content:b,attachment_id:S(p)}});case 2:e.sent&&(f.ZP.info("提交成功"),r(!0));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(e){var t;return e&&e.map((function(e){t=e.response.id})),t}return(0,k.jsxs)("div",{children:[(0,k.jsx)(L.Z,{defaultValue:b,onChange:function(e){return y(e)}}),(0,k.jsxs)(E.Z,N()(N()({},x),{},{children:[(0,k.jsx)(B.ZP,{className:"uploadBtn",children:"上传附件"}),"(单个文件150M以内)"]})),(0,k.jsxs)("p",{style:{marginTop:"10px"},children:[(0,k.jsx)(B.ZP,{style:{width:"90px"},onClick:function(){return function(){return _.apply(this,arguments)}()},children:"提交"}),(0,k.jsx)(B.ZP,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return r(!0)},children:"取消"})]})]})})),G=u.Z.SubMenu,O=(d.Z.Content,d.Z.Sider);var I=(0,v.connect)((function(e){return{user:e.user,globalSetting:e.globalSetting}}))((function(e){e.user,e.dispatch;var t,n=e.globalSetting,o=(0,c.useState)(),r=s()(o,2),l=(r[0],r[1],(0,c.useState)(!1)),d=s()(l,2),v=d[0],_=d[1],B=(0,c.useState)(),T=s()(B,2),P=T[0],N=T[1],E=(0,c.useState)(),L=s()(E,2),M=L[0],I=L[1],R=(0,c.useState)(!1),Z=s()(R,2),D=Z[0],F=Z[1],H=(0,c.useState)(""),W=s()(H,2),z=W[0],V=W[1],q=(0,c.useState)(""),U=s()(q,2),K=U[0],Y=U[1],J=(0,c.useState)(!0),X=s()(J,2),$=X[0],Q=X[1];function ee(){return te.apply(this,arguments)}function te(){return(te=a()(i()().mark((function e(){var t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,w.ZP)("/api/programas.json",{method:"get"});case 2:(t=e.sent)&&N(null==t?void 0:t.programas);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}(0,c.useEffect)((function(){ee()}),[]),console.log("globalSetting",n);var ne=function(){var e=a()(i()().mark((function e(t,n,o){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t,e.next=1===e.t0?3:2===e.t0?6:3===e.t0?10:4===e.t0?15:17;break;case 3:return I(null==n?void 0:n.id),_(!0),e.abrupt("break",17);case 6:return I(null==n?void 0:n.id),F(!0),V(null==n?void 0:n.name),e.abrupt("break",17);case 10:return e.next=12,(0,w.ZP)("/api/programas/".concat(null==n?void 0:n.id,"/top.json"),{method:"post",body:{id:null==n?void 0:n.id}});case 12:return 0===e.sent.status&&ee(),e.abrupt("break",17);case 15:return oe((0,k.jsxs)("p",{children:["删除之后不能恢复,",(0,k.jsx)("br",{}),"是否确认删除?"]}),a()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,w.ZP)("/api/programas/".concat(null==n?void 0:n.id,".json"),{method:"delete",body:{id:null==n?void 0:n.id}});case 2:0===e.sent.status&&(f.ZP.info("删除成功"),ee());case 4:case"end":return e.stop()}}),e)})))),e.abrupt("break",17);case 17:case"end":return e.stop()}}),e)})));return function(t,n,o){return e.apply(this,arguments)}}(),oe=function(e,t){p.Z.confirm({centered:!0,title:"提示",icon:(0,k.jsx)(b.Z,{}),content:e,okText:"确认",onOk:function(){return t()},cancelText:"取消"})},ie=function(e,t){return(0,k.jsxs)("div",{className:g.leftMenuActions,children:[1===t&&(0,k.jsx)("p",{className:"current",onClick:function(){return ne(1,e,t)},children:"新建"}),(0,k.jsx)("p",{className:"current",onClick:function(){return ne(2,e,t)},children:"重命名"}),(0,k.jsx)("p",{className:"current",onClick:function(){return ne(3,e,t)},children:"置顶"}),(0,k.jsx)("p",{className:"current",onClick:function(){return ne(4,e,t)},children:"删除"})]})};function re(){return ae.apply(this,arguments)}function ae(){return(ae=a()(i()().mark((function e(){var t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,w.ZP)("/api/programas/".concat(M,"/content.json"),{method:"get",params:{id:M}});case 2:(t=e.sent)&&Y(t);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return(0,k.jsxs)("div",{style:{marginBottom:"40px"},children:[(0,k.jsx)("img",{style:{width:"100%"},src:m.Z.IMG_SERVER+"/".concat(null==n||null===(t=n.setting)||void 0===t?void 0:t.shixun_banner_url)}),(0,k.jsxs)("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"},children:[(0,k.jsx)(O,{width:244,className:g.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"},children:(0,k.jsxs)(u.Z,{mode:"inline",children:[null==P?void 0:P.map((function(e,t){var n;return(null==e?void 0:e.children.length)>0?(0,k.jsx)(G,{title:(0,k.jsxs)("span",{className:"font16",children:[(0,k.jsx)("span",{children:e.name}),!(0,x.Ny)()&&(0,k.jsx)("span",{}),(0,x.Ny)()&&(0,k.jsx)(h.Z,{placement:"right",content:function(){return ie(e,1)},trigger:"hover",children:(0,k.jsx)("span",{className:["iconfont icon-sandian",g.actions].join(" ")})})]}),children:null==e||null===(n=e.children)||void 0===n?void 0:n.map((function(e,t){return(0,k.jsxs)(u.Z.Item,{className:null==g?void 0:g.SubMentItem,onClick:function(){I(null==e?void 0:e.id),M=null==e?void 0:e.id,re()},children:[(0,k.jsx)("span",{style:{flex:"1"},children:null==e?void 0:e.name}),(0,x.Ny)()&&(0,k.jsx)(h.Z,{placement:"right",content:function(){return ie(e,2)},trigger:"hover",children:(0,k.jsx)("span",{className:["iconfont icon-sandian",g.actions].join(" ")})})]})}))}):(0,k.jsxs)(u.Z.Item,{className:null==g?void 0:g.SubMentItem,onClick:function(){I(null==e?void 0:e.id),M=null==e?void 0:e.id,re()},children:[(0,k.jsx)("span",{style:{flex:"1"},children:null==e?void 0:e.name}),(0,x.Ny)()&&(0,k.jsx)(h.Z,{placement:"right",content:function(){return ie(e,1)},trigger:"hover",children:(0,k.jsx)("span",{className:["iconfont icon-sandian",g.actions].join(" ")})})]})})),(0,k.jsx)(u.Z.Item,{onClick:function(){I(""),M="",_(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:(0,k.jsx)(y.Z,{style:{color:"#0152d9",fontSize:"16px"}}),children:"新增二级类目"})]})}),(0,k.jsxs)("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"},children:[$&&(0,k.jsx)(j,{ItemData:K,setIssee:Q}),!1===$&&(0,k.jsx)(A,{ItemData:K,setIssee:Q,CategoryId:M})]})]}),(0,k.jsx)(S,{CategoryId:M,IsShow:v,setIsShow:_,init:ee}),(0,k.jsx)(C,{CategoryId:M,name:z,IsShow:D,setIsShow:F,init:ee})]})}))}}]); |