|
|
(self.webpackChunk=self.webpackChunk||[]).push([[86820,39752],{66455:function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__,_typeof=__webpack_require__(31468).default;(function(){if("function"!=typeof window.GGBApplet){var isRenderGGBElementEnabled=!1,scriptLoadStarted=!1,html5AppletsToProcess=null,ggbHTML5LoadedCodebaseIsWebSimple=!1,ggbHTML5LoadedCodebaseVersion=null,ggbHTML5LoadedScript=null,GGBApplet=function(){"use strict";for(var e={},t="5.0",n={},i=null,o=!1,a=!1,r=null,l=!1,s=null,c=null,d=0;d<arguments.length;d++){var u=arguments[d];if(null!==u)switch(_typeof(u)){case"number":t=u.toFixed(1);break;case"string":u.match(new RegExp("^[0-9]\\.[0-9]+$"))?t=u:r=u;break;case"object":void 0!==u.is3D?i=u:n=u;break;case"boolean":o=u,a=!0}}null===i&&(i={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||a||(o=!0)),null!==r&&void 0===n.id&&(n.id=r);var p="",f=!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,F(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 i,o="auto",a=n.id,r=!1,s=0;s<arguments.length;s++){var c=arguments[s];"string"==typeof c?(c=c.toLowerCase()).match(/^(prefer)?(java|html5|compiled|auto|screenshot)$/)?o=c:a=arguments[s]:"boolean"==typeof c?r=c:c instanceof HTMLElement&&(i=c)}function d(){if(l){o=M(o);var s=i||document.getElementById(a);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"!==o||(delete n.width,delete n.height),h=o,"screenshot"===o)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,r,o)):j(s,n,r)}else console.log("possibly bug on ajax loading? ")}else setTimeout(d,200)}d()},e.getViews=function(){return i},e.isJavaInstalled=function(){return!1};var S=function(t){var o=function(){n.onError&&n.onError(),R("Error: Fetching material (id "+n.material_id+") failed.",n)},a=location.host.match(/(www|stage|beta|groot|alpha).geogebra.(org|net)/)?location.host:"www.geogebra.org",r="/materials/"+n.material_id+"?scope=basic";C("https://"+a+"/api/proxy.php?path="+encodeURIComponent(r),(function(a){var r=JSON.parse(a),l=r.elements?r.elements.filter((function(e){return"G"==e.type||"E"==e.type}))[0]:r;if(l&&l.url){n.fileName=l.url,B(l.settings||{}),i.is3D=!0;var s="https://www.geogebra.org/images/";e.setPreviewImage(v||l.previewUrl,s+"GeoGebra_loading.png",s+"applet_play.png"),t()}else o()}),o)};function B(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 C(e,t,n){var i=new XMLHttpRequest;i.open("GET",e),i.onload=function(){t(i.responseText)},i.onerror=n,i.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 i;"string"==typeof e&&(e=document.getElementById(e)),h=null;var o=null;for(i=0;i<e.childNodes.length;i++){var a=e.childNodes[i],r=a.className;"applet_screenshot"===r?t?(a.style.display="block",h="screenshot"):a.style.display="none":"applet_scaler prerender"!==r&&(e.removeChild(a),o=r&&-1!=r.indexOf("appletParameters")?a.id:null,i--)}var l=void 0!==n.id?n.id:o,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,i){x(m)<=4.2&&(i=!0);var o=!isRenderGGBElementEnabled&&!scriptLoadStarted;(!isRenderGGBElementEnabled&&!scriptLoadStarted||ggbHTML5LoadedCodebaseVersion!==m||ggbHTML5LoadedCodebaseIsWebSimple&&!w)&&(o=!0,isRenderGGBElementEnabled=!1,scriptLoadStarted=!1);var a=document.createElement("div");a.classList.add("appletParameters","notranslate");var r=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,r=605);else{var d=100;(T(n.showToolBar)||T(n.showMenuBar))&&(n.hasOwnProperty("customToolBar")&&(n.customToolbar=n.customToolBar),d=T(n.showMenuBar)?245:155),r<d&&(n.width=d,r=d)}for(var u in a.style.border="none",a.style.display="inline-block",n)n.hasOwnProperty(u)&&"appletOnLoad"!==u&&a.setAttribute("data-param-"+u,n[u]);y&&a.setAttribute("data-param-fontscssurl",y),e.resize=function(){GGBAppletUtils.responsiveResize(t,n)},window.addEventListener("resize",(function(t){e.resize()}));var f="function"==typeof n.appletOnLoad?n.appletOnLoad:function(){};if(i||void 0===n.width){var h=document.createElement("div");h.className="applet_scaler",h.style.position="relative",h.style.display="block",h.appendChild(a),t.appendChild(h),n.appletOnLoad=function(t){e.resize(),f(t)}}else{n.hasOwnProperty("showSplash")||a.setAttribute("data-param-showSplash","false");var v=t.querySelector(".applet_scaler.prerender"),b=null!==v;if(b)_=v.querySelector(".ggb_preview");else{var _=A(r,l,n.borderColor,!1);(v=document.createElement("div")).className="applet_scaler",v.style.position="relative",v.style.display="block",v.style.width=r+"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"),f(e)},b||v.appendChild(_)):a.appendChild(_),v.appendChild(a),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(o){scriptLoadStarted=!0;for(var B=0;B<a.childNodes.length;B++){"TABLE"===a.childNodes[B].tagName&&(a.removeChild(a.childNodes[B]),B--)}if(null!==ggbHTML5LoadedScript){var C=document.querySelector('script[src="'+ggbHTML5LoadedScript+'"]');null!=C&&C.parentNode.removeChild(C)}var j=document.createElement("script"),P=function(){S(a,n)};j.src=p+g,ggbHTML5LoadedCodebaseIsWebSimple=w,ggbHTML5LoadedCodebaseVersion=m,ggbHTML5LoadedScript=j.src,R("GeoGebra HTML5 codebase loaded: '"+p+"'.",n),c||s&&"5.0"!=s?p.requirejs?__webpack_require__.e(5783).then(function(){var e=[__webpack_require__(5783)];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(a,n);n.height=l,n.width=r},P=function(t,n,i){var o=A(n.width,n.height,n.borderColor,i),a=document.createElement("div");a.style.position="relative",a.style.display="block",a.style.width=n.width+"px",a.style.height=n.height+"px",a.className="applet_screenshot applet_scaler"+(i?" applet_screenshot_play":""),a.appendChild(o);var r=GGBAppletUtils.getScale(n,t,i);i?(t.appendChild(L()),window.GGBT_wsf_view||(t.style.position="relative")):window.GGBT_spinner&&window.GGBT_spinner.attachSpinner(a,"66%"),t.appendChild(a),1===r||isNaN(r)||(GGBAppletUtils.scaleElement(a,r),a.style.width=n.width+"px",a.style.height=n.height+"px",a.parentNode.style.width=n.width*r+"px",a.parentNode.style.height=n.height*r+"px"),e.resize=function(){N(t,o,a,i)},window.addEventListener("resize",(function(t){e.resize()})),e.resize()};function N(e,t,i,o){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 a=GGBAppletUtils.getScale(n,e,o);null!==i.parentNode&&(isNaN(a)||1===a?(GGBAppletUtils.scaleElement(i,1),i.parentNode.style.width=n.width+"px",i.parentNode.style.height=n.height+"px"):(GGBAppletUtils.scaleElement(i,a),i.parentNode.style.width=n.width*a+"px",i.parentNode.style.height=n.height*a+"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,i){P(e,t,!0);for(var o=function(){var n=[];for(r=0;r<e.childNodes.length;r++)n.push(e.childNodes[r]);if(window.GGBT_wsf_view){var o=window.GGBT_wsf_view.renderFullScreen(e,t.id),a=document.getElementById("fullscreencontainer"),l=jQuery(e).find(".fullscreencontent");l.length>0?(o.remove(),l.attr("id","fullscreencontent").show(),jQuery(a).append(l),window.dispatchEvent(new Event("resize"))):j(o,t,!1),window.GGBT_wsf_view.launchFullScreen(a)}else h=i,j(e,t,!1);if(!window.GGBT_wsf_view)for(r=0;r<n.length;r++)e.removeChild(n[r])},a=e.getElementsByClassName("ggb_preview_play"),r=0;r<a.length;r++)a[r].addEventListener("click",o,!1),a[r].addEventListener("ontouchstart",o,!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},A=function(e,t,n,i){var o=document.createElement("div");o.className="ggb_preview",o.style.position="absolute",o.style.zIndex="90",o.style.width=e-2+"px",o.style.height=t-2+"px",o.style.top="0px",o.style.left="0px",o.style.overflow="hidden",o.style.backgroundColor="white";var a="lightgrey";void 0!==n&&(a="none"===n?"transparent":n),o.style.border="1px solid "+a;var r,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)&&!i){(r=document.createElement("img")).style.position="absolute",r.style.zIndex="1001",r.style.opacity=1,c.style.opacity=.3,(l=360)>e/4*3&&(l=e/4*3),s=l/5.8,r.setAttribute("src",b),r.setAttribute("width",l),r.setAttribute("height",s);var d=(e-l)/2,u=(t-s)/2;r.style.left=d+"px",r.style.top=u+"px",o.appendChild(r)}return o.appendChild(c),o},M=function(e){return"html5"===(e=e.toLowerCase())||"screenshot"===e?e:"html5"},G=["web","webSimple","web3d","tablet","tablet3d","phone"],O=function(e,t){if(m=e,t)F(m,!0);else{var a,r,l=!o;if(l){var s=x(m);!isNaN(s)&&s<4.4&&(l=!1)}a="http"===window.location.protocol.substr(0,4)?window.location.protocol:"http:";var c=m.indexOf("//");for(var d in r=c>0?m:0===c?a+m:"https://www.geogebra.org/apps/5.2.814.0/",G)if(m.slice(-1*G[d].length)===G[d]||m.slice(-1*(G[d].length+1))===G[d]+"/")return void F(r,!1);GGBAppletUtils.isFlexibleWorksheetEditor()||!l||i.is3D||i.AV||i.SV||i.CV||i.EV2||i.CP||i.PC||i.DA||i.FI||i.PV||T(n.showToolBar)||T(n.showMenuBar)||T(n.showAlgebraInput)||T(n.enableRightClick)||n.appName&&"classic"!=n.appName?r+="web3d/":r+="webSimple/",F(r,!1)}},F=function(e,t){if(e.requirejs)p=e;else{"/"!==e.slice(-1)&&(e+="/"),p=e,null===t&&(t=-1===e.indexOf("http")),f=t,g="web.nocache.js",w=!1;var n=p.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 i=parseFloat(m);NaN!==i&&i<5&&e.indexOf("geogebra.org")>=0&&(console.log("The GeoGebra HTML5 codebase version "+i+" 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 D(){var e=t;null!==s?e=s:parseFloat(e)<5&&(e="5.0"),O(e,!1),null!==c&&F(c,f),l=!0}return void 0!==n.material_id?S(D):D(),e},GGBAppletUtils=function(){"use strict";function e(){return void 0!==window.GGBT_wsf_edit}function t(e,t){1!=t?(e.style.transformOrigin="0% 0% 0px",e.style.webkitTransformOrigin="0% 0% 0px",e.style.transform="scale("+t+","+t+")",e.style.webkitTransform="scale("+t+","+t+")",e.style.maxWidth="initial",null!==e.querySelector(".ggb_preview")&&(e.querySelector(".ggb_preview").style.maxWidth="initial"),void 0!==e.querySelectorAll(".ggb_preview img")[0]&&(e.querySelectorAll(".ggb_preview img")[0].style.maxWidth="initial"),void 0!==e.querySelectorAll(".ggb_preview img")[1]&&(e.querySelectorAll(".ggb_preview img")[1].style.maxWidth="initial")):(e.style.transform="none",e.style.webkitTransform="none")}function n(e,t,n,i,o){if(e.isScreenshoGenerator)return 1;var a,r=void 0!==i&&i,l=null!=e.noScaleMargin&&e.noScaleMargin,s=(a=e.autoHeight)&&"false"!==a,c=function(e,t,n,i,o,a){var r=null;if(null!=a&&""!=a)for(var l=e.parentNode;null!=l;){if((" "+l.className+" ").indexOf(" "+a+" ")>-1){r=l;break}l=l.parentNode}var s=0,c=0,d=0,u=0,p=0,f=0,h=0;if(r)s=r.offsetWidth,c=Math.max(i?r.offsetWidth:0,r.offsetHeight);else{if(window.innerWidth&&document.documentElement.clientWidth?(s=Math.min(window.innerWidth,document.documentElement.clientWidth),c=Math.min(window.innerHeight,document.documentElement.clientHeight),d=s):(s=window.innerWidth,c=window.innerHeight,d=window.innerWidth),e){var m=e.getBoundingClientRect();m.left>0&&m.left<=s&&(void 0===o||!o)&&("rtl"===document.dir?(p=s-m.width-m.left,f=d<=480?10:30):(f=m.left,p=d<=480?10:30),u=f+p)}e&&"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&(e.getBoundingClientRect(),"closePositionRight"===window.GGBT_wsf_view.getCloseBtnPosition()?(u=40,h=0):"closePositionTop"===window.GGBT_wsf_view.getCloseBtnPosition()&&(u=0,h=40))}return e&&((void 0===n||!n)&&t>0&&t+u<s?s=t:s-=u,"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,r&&window.GGBT_wsf_view||l,o),d=parseInt(c.width),u=e.width,p=e.height;if(void 0===u){var f=t.querySelector(".appletParameters");f&&(u=f.offsetWidth,p=f.offsetHeight)}var h=d/u,m=r?1:c.height/p;return void 0===n||n||(h=Math.min(1,h),m=Math.min(1,m)),Math.min(h,m)}function i(e,t,i){var o,a=1,r=!1;return e.hasOwnProperty("allowUpscale")&&(r=e.allowUpscale),e.hasOwnProperty("scale")&&(a=parseFloat(e.scale),(isNaN(a)||null===a||0===a)&&(a=1),a>1&&(r=!0)),t&&"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&(r=!0),e.hasOwnProperty("disableAutoScale")&&e.disableAutoScale?a:(o=n(e,t,r,i,e.scaleContainerClass),!r||e.hasOwnProperty("scale")&&1!==a?Math.min(a,o):o)}function o(e){var t=Math.min(window.innerWidth,document.documentElement.clientWidth),n=Math.min(window.innerHeight,document.documentElement.clientHeight),i=e.getBoundingClientRect(),o=(t-i.width)/2,a=(n-i.height)/2;a<0&&(a=0),e.style.position="relative","closePositionRight"===window.GGBT_wsf_view.getCloseBtnPosition()?(e.style.left=o<40?"40px":o+"px",e.style.top=a+"px"):"closePositionTop"===window.GGBT_wsf_view.getCloseBtnPosition()&&(e.style.top=a<40?"40px":a+"px",e.style.left=o+"px")}return{responsiveResize:function(n,a){var r=n.querySelector(".appletParameters");if(r){if("object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()){if(a.id!==r.getAttribute("data-param-id"))return;window.GGBT_wsf_view.setCloseBtnPosition(n)}if(r.parentElement&&/fullscreen/.test(r.parentElement.className))return;var l=i(a,n);e()&&r.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 d=void 0!==a.id?a.id:"ggbApplet",u=window[d];null!=u&&u.recalculateEnvironments||null===s||s.className.match(/fullscreen/)||(s.parentNode.style.transform="",isNaN(l)||1===l?(t(s,1),s.parentNode.style.width=a.width+"px",s.parentNode.style.height=a.height+"px"):(s.parentNode.style.width=a.width*l+"px",s.parentNode.style.height=a.height*l+"px",t(s,l))),"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&o(n),window.GGBT_wsf_view&&!window.GGBT_wsf_view.isFullscreen()&&window.GGBT_wsf_general.adjustContentToResize($(r).parents(".content-added-content"))}},isFlexibleWorksheetEditor:e,positionCenter:o,getScale:i,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,a,!1);var i=setInterval((function(){a()}),$)}function a(){if(!n){if(!t())return;n=!0,e(),o.removeEventListener&&o.removeEventListener(Z,a,!1),i&&clearInterval(i)}}}((function(){var t,n,i,o;t=e,n=u(),i=n.body,(o=n.createElement(_)).language=ab,o.crossOrigin=W,o.src=t,webModule.__errFn&&(o.onerror=function(){webModule.__errFn(L,new Error(bb+t))}),i.appendChild(o),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 i=e.lastIndexOf(tb,Math.min(n,t));return i>=O?e.substring(O,i+P):W}var t,n=null!=(t=__gwt_getMetaProperty(wb))?t:W;return n==W&&(n=function(){for(var t=o.getElementsByTagName(_),n=O;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,i=[],o=[];function a(e){var t=o[e](),n=i[e];if(t in n)return t;var a=[];for(var l in n)a[n[l]]=l;throw r&&r(e,a,t),null}if(__gwt_isKnownPropertyValue=function(e,t){return t in i[e]},webModule.__getPropMap=function(){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[t]=a(t));return e},webModule.__computePropValue=a,n.__gwt_activeModules[L].bindings=webModule.__getPropMap,p())return C(Bb);try{var l=(e=Cb).indexOf(Db);-1!=l&&(t=parseInt(e.substring(l+P),$),e=e.substring(O,l))}catch(e){}return webModule.__softPermutationId=t,C(e+Eb)}function F(){n.__gwt_stylesLoaded||(n.__gwt_stylesLoaded={})}s[L]={moduleName:L},webModule.__moduleStartupDone=function(e){var t=s[L].bindings;s[L].bindings=function(){for(var n=t?t():{},i=e[webModule.__softPermutationId],o=O;o<i.length;o++){var a=i[o];n[a[O]]=a[P]}return n}},webModule.__startLoadingFragment=function(e){return C(e)},webModule.__installRunAsyncCode=function(e){var t=u(),n=t.body,i=t.createElement(_);i.language=ab,i.text=e,n.appendChild(i),n.removeChild(i)},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")})()},55087:function(e,t,n){"use strict";function i(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 o(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=[],i=0;i<e.length;i++){var o=e[i],a=t?"".concat(t,"/").concat(o.name):"".concat(o.name);n.push({title:o.name,type:o.type,isLeaf:"tree"!==o.type,key:a})}return n}function a(e,t,n){for(var i=0;i<e.length;i++){var o=e[i];if(o.key===t){o.children=n;break}o.children&&a(o.children,t,n)}return e}function r(e,t,n){var i;return function(){var o=this,a=arguments,r=function(){i=null,n||e.apply(o,a)},l=n&&!i;clearTimeout(i),i=setTimeout(r,t),l&&e.apply(o,a)}}n.d(t,{Ax:function(){return a},Ds:function(){return r},KI:function(){return l},SI:function(){return o},f1:function(){return i}});var l=n(27065).Z.API_SERVER},74908:function(e,t,n){"use strict";n.d(t,{Z:function(){return y}});var i=n(7557),o=n.n(i),a=n(41498),r=n.n(a),l=n(79800),s=n.n(l),c=n(59301),d="imageDimensions___a7crR",u="img___Kroat",p="fullWidth___c492T",f=n(92310),h=n.n(f),m=n(71418),g=n(2859),w=n(51136),v=n(6457),b=n(37712),y=function(e){var t=e.data,n=e.className,i=e.fullWidth,a=e.style,l=void 0===a?{}:a,f=e.onClose,y=e.onOk,x=e.showFullTools,_=e.noAssociationId,k=(0,c.useRef)(null),S=(0,c.useRef)(null),B=(0,c.useState)(!1),C=s()(B,2),T=C[0],j=C[1],P=(0,c.useState)("正在加载中"),N=s()(P,2),E=N[0],L=N[1];(0,c.useEffect)((function(){null!=t&&t.visible?document.body.setAttribute("data-custom","y-hidden"):document.body.removeAttribute("data-custom"),null!=t&&t.src&&A()}),[null==t?void 0:t.visible]);var A=function(){var e=r()(o()().mark((function e(){var n;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return j(!0),L("正在加载中"),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(){G()},j(!1),L("");case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),M=function(){var e=r()(o()().mark((function e(n){var i;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return j(!0),L("正在保存中"),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==(i=e.sent)||!i.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==i?void 0:i.id,settings:JSON.stringify(n.state)}});case 8:0===e.sent.status&&y(),e.next=13;break;case 12:null!=i&&i.id&&y(i);case 13:j(!1),L("");case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),G=function(){S.current=new g.hP(k.current),S.current.addEventListener("render",M),S.current.addEventListener("beforeclose",f),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;(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.jsxs)("div",{className:h()(d,n,i?p:""),style:l,children:[(0,b.jsx)(m.Z,{spinning:T,tip:E,style:{position:"absolute"}}),(0,b.jsx)("img",{className:u,ref:k})]})})}},37507:function(e,t,n){"use strict";n.d(t,{h:function(){return w}});var i=n(82242),o=n.n(i),a=n(79800),r=n.n(a),l=n(59301),s=n(57809),c=n(78241),d=n(3113),u=n(89780),p=n.n(u),f=(n(81974),n(3693),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,i=e.mode,a=e.options,s=void 0===a?{}:a,c=(0,l.useRef)(),d=(0,l.useState)(),u=r()(d,2),h=u[0],m=u[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",i)}),[h,i]),(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=p().fromTextArea(c.current,o()({mode:i,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},s));m(e)}}),[c.current,h]),(0,f.jsx)("div",{className:"my-codemirror-container",children:(0,f.jsx)("textarea",{ref:c})})}t.Z=function(e){var t=e.callback,n=e.onCancel,i=(0,l.useState)("python"),a=r()(i,2),u=a[0],p=a[1];return(0,f.jsxs)(c.Z,o()(o()({},m),{},{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){t(e)},style:{width:500},children:[(0,f.jsx)(c.Z.Item,{label:"代码语言",name:"language",children:(0,f.jsx)(s.default,{getPopupContainer:function(e){return e.parentNode},onChange:function(e){p(g[e][1])},children:Object.keys(g).map((function(e){return(0,f.jsx)(h,{value:e,children:g[e][0]},e)}))})}),(0,f.jsx)(c.Z.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}],children:(0,f.jsx)(w,{mode:u})}),(0,f.jsxs)("div",{className:"flex-container flex-end",children:[(0,f.jsx)(d.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,f.jsx)(d.ZP,{type:"ghost",onClick:n,children:"取消"})]})]}))}},11094:function(e,t,n){"use strict";n.d(t,{Z:function(){return Te}});var i=n(91232),o=n.n(i),a=n(79800),r=n.n(a),l=n(85573),s=n.n(l),c=n(59301),d=n(89780),u=n.n(d),p=n(76374),f=(n(81974),n(6313),n(25717),n(99498),n(25419),n(67549),n(42783)),h=n(37712),m=function(e){var t=e.value,n=void 0===t?"":t,i=(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:i}})})},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,i=e.icon,o=e.actionName,a=e.className,r=void 0===a?"":a,l=e.children;return(0,h.jsxs)("a",{title:n,className:r,onClick:function(){t(o)},children:[(0,h.jsx)("i",{className:"".concat(i)}),l]})}var y=function(e){var t=e.watch,n=e.showNullButton,i=e.showNullProgramButton,o=e.onActionCallback,a=e.fullScreen,r=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:o})):(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:o,children:(0,h.jsx)("span",{className:"fill-tip",children:"点击插入\b填空项"})})}):null,i?(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:o,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:o,children:(0,h.jsx)("span",{className:"fill-tip",children:"+多行填空项"})})})]}):null,r&&(0,h.jsx)("li",{children:(0,h.jsx)(b,{icon:"md-iconfont icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(r),onActionCallback:o,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(a?"md-iconfont icon-shrink":"md-iconfont icon-enlarge"),title:a?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:o})})]})},x=n(27308),_=n(78241),k=n(8772),S=n(3113),B={labelCol:{span:4},wrapperCol:{span:20}},C=function(e){var t=e.callback,n=e.onCancel;return(0,h.jsxs)(_.Z,w()(w()({},B),{},{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(37507),j=n(8591),P=n(55087),N=_.Z.useForm,E={width:280,marginRight:10},L={labelCol:{span:5},wrapperCol:{span:19}},A=function(e){var t=e.callback,n=e.onCancel,i=N(),o=r()(i,1)[0],a=(0,c.useRef)();function l(e,t){-1!==e.status?o.setFieldsValue({src:"/api/attachments/".concat(e.id),type:t.type}):j.ZP.error(e.message)}return(0,h.jsxs)(_.Z,w()(w()({form:o},L),{},{className:"upload-image-panel",onFinish:function(e){t(e,a.current)},style:{width:470,overflow:"hidden"},children:[(0,h.jsx)(_.Z.Item,{label:"图片地址",required:!0,children:(0,h.jsxs)("div",{className:"flex-container",children:[(0,h.jsx)(_.Z.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入图片地址"}],children:(0,h.jsx)(k.Z,{style:E})}),(0,h.jsx)(M,{onFileChange:function(e){var t=e.target.files[0];a.current=t,G(t,l)}})]})}),(0,h.jsx)(_.Z.Item,{label:"图片描述",name:"alt",children:(0,h.jsx)(k.Z,{style:{width:264}})}),(0,h.jsxs)(_.Z.Item,{style:{textAlign:"right"},children:[(0,h.jsx)(S.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,h.jsx)(S.ZP,{type:"default",onClick:n,children:"取消"})]})]}))};function M(e){var t=e.onFileChange;return(0,h.jsxs)("label",{className:"upload-button",style:{cursor:"pointer"},children:["本地上传",(0,h.jsx)("input",{type:"file",onChange:t})]})}function G(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 i=new window.XMLHttpRequest;i.withCredentials=!0,i.addEventListener("load",(function(n){t(JSON.parse(n.target.responseText),e)}),!1),i.addEventListener("error",(function(e){console.error(e)}),!1),i.open("POST","".concat(P.KI,"/api/attachments.json")),i.send(n)}var O=n(95237),F=n(74908),R=function(e){var t=e.callback,n=e.onCancel,i=document.createElement("canvas"),o=i.getContext("2d");i.width=1e3,i.height=800,o.fillStyle="#ffffff",o.fillRect(0,0,i.width,i.height);var a=i.toDataURL("image/png");return(0,h.jsx)(O.Z,{style:{height:"100vh"},children:(0,h.jsx)(F.Z,{fullWidth:!0,noAssociationId:!0,showFullTools:!0,data:{src:a,visible:!0,title:String(Date.now())},onOk:function(e){t({src:e.url})},onClose:n})})},D=n(7557),I=n.n(D),Z=n(41498),H=n.n(Z),W=n(37205),z=n.n(W),V=n(12378);function q(){go.CommandHandler.call(this),this._arrowKeyBehavior="move",this._pasteOffset=new go.Point(10,10),this._lastPasteOffset=new go.Point(0,0)}go.Diagram.inherit(q,go.CommandHandler),q.prototype.canAlignSelection=function(){var e=this.diagram;return null!==e&&!e.isReadOnly&&!e.isModelReadOnly&&!(e.selection.count<2)},q.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")},q.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")},q.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")},q.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")},q.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")}},q.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")}},q.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 i=0;i<n.length-1;i++){var o=n[i],a=o.actualBounds.y+o.actualBounds.height+e;n[i+1].move(new go.Point(o.actualBounds.x,a))}t.commitTransaction("align Column")},q.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 i=0;i<n.length-1;i++){var o=n[i],a=o.actualBounds.x+o.actualBounds.width+e;n[i+1].move(new go.Point(a,o.actualBounds.y))}t.commitTransaction("align Row")},q.prototype.canRotate=function(e){var t=this.diagram;return null!==t&&!t.isReadOnly&&!t.isModelReadOnly&&!(t.selection.count<1)},q.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())},q.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){q._assignZOrder(e,t.get(e.layer)+1)})),e.commitTransaction("pullToFront")},q.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){q._assignZOrder(e,t.get(e.layer)-1-q._findGroupDepth(e))})),e.commitTransaction("pushToBack")},q._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){q._assignZOrder(e,t+1,n)}))},q._findGroupDepth=function(e){if(e instanceof go.Group){var t=0;return e.memberParts.each((function(e){t=Math.max(t,q._findGroupDepth(e))})),t+1}return 0},q.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)}},q.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},q.prototype._arrowKeyMove=function(){var e=this.diagram,t=e.lastInput,n=0,i=0;if(t.control||t.meta)n=1,i=1;else if(null!==e.grid){var o=e.grid.gridCellSize;i=o.width,n=o.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-i,e.actualBounds.y)):"Right"===t.key&&e.move(new go.Point(e.actualBounds.x+i,e.actualBounds.y))})),e.commitTransaction("arrowKeyMove")},q.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))},q.prototype._findNearestPartTowards=function(e){var t=this.diagram.selection.first();if(null===t)return null;for(var n=t.actualBounds.center,i=this._getAllParts(),o=1/0,a=t,r=0;r<i.length;r++){var l=i[r];if(l!==t&&l.canSelect()){var s=l.actualBounds.center,c=n.directionPoint(s),d=this._angleCloseness(c,e);if(d<=45){var u=n.distanceSquaredPoint(s);(u*=1+Math.sin(d*Math.PI/180))<o&&(o=u,a=l)}}}return a},q.prototype._angleCloseness=function(e,t){return Math.min(Math.abs(t-e),Math.min(Math.abs(t+360-e),Math.abs(t-360-e)))},q.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!==(o=this._sortTreeChildrenByY(t).first())&&e.select(o)}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!==(a=t.findTreeParentNode())&&e.select(a)}else if("Up"===n.key){if(null!==(a=t.findTreeParentNode()))if((l=(r=this._sortTreeChildrenByY(a)).indexOf(t))>0){for(var i=r.elt(l-1);null!==i&&i.isTreeExpanded&&!i.isTreeLeaf;){i=this._sortTreeChildrenByY(i).last()}null!==i&&e.select(i)}else e.select(a)}else if("Down"===n.key){var o;if(t.isTreeExpanded&&!t.isTreeLeaf)null!==(o=this._sortTreeChildrenByY(t).first())&&e.select(o);else for(;null!==t;){var a,r,l;if(null===(a=t.findTreeParentNode()))break;if((l=(r=this._sortTreeChildrenByY(a)).indexOf(t))<r.length-1){e.select(r.elt(l+1));break}t=a}}var s=e.selection.first();null!==s&&e.scrollToRect(s.actualBounds)}},q.prototype._sortTreeChildrenByY=function(e){var t=(new go.List).addAll(e.findTreeChildrenNodes());return t.sort((function(e,t){var n=e.location,i=t.location;return n.y<i.y?-1:n.y>i.y?1:n.x<i.x?-1:n.x>i.x?1:0})),t},q.prototype.copyToClipboard=function(e){go.CommandHandler.prototype.copyToClipboard.call(this,e),this._lastPasteOffset.set(this.pasteOffset)},q.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(q.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(q.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 U=q,K=(n(31270),n(85160)),Y=n(43418),J=n(43604),X=n(51136),$="myPaletteDiv___Xjz2I",Q="maxH60___Pd4Re";window.go=V;var ee=function(e){var t=e.onCancel,n=e.callback,i=(0,c.useRef)(),o=(0,c.useRef)(),a=(0,c.useRef)(),l=(0,c.useRef)(!1),s=(0,c.useRef)(!1),d=(0,c.useState)(0),u=r()(d,2),p=u[0],f=u[1],m=function(){var e=H()(I()().mark((function e(){var t,o;return I()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.current.makeImage(),e.next=3,(0,X.ZP)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:Date.now(),file:t.src}});case 3:o=e.sent,n({src:o.url});case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){f(p+1)}),[]),(0,h.jsx)("div",{ref:s,className:l.current?"".concat(Q," body-overflow-initial"):"body-overflow-initial",children:(0,h.jsx)(Y.Z,{width:1200,icon:null,footer:null,closable:!0,visible:!!p,destroyOnClose:!0,maskClosable:!1,getContainer:s.current,rootClassName:"zIndex-9999",title:(0,h.jsxs)(O.Z,{children:[(0,h.jsx)(J.Z,{flex:1,children:"插入流程图"}),(0,h.jsx)(J.Z,{onClick:function(){l.current=!l.current,f(p+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:$,ref:a})]}),(0,h.jsxs)("div",{style:{flex:1,position:"relative"},children:[(0,h.jsx)(K.FI,{initDiagram:function(){var e=V.GraphObject.make,t="#ff3333",n="#3358ff",r="#25ad23",l="#d533ff",s="#7d33ff",c="#ff6233",d="#ffffff",u="#000000",p="#fffcd5",f="#d5ebff",h="#f2dfe0",m="#a5d2fa",g="#cccccc",w="#b3e6b3",v="#fcbbbd";function b(t,n){var i=function(e,n){e.handled=!0,e.diagram.model.commit((function(i){var o=n.part.adornedPart,a=(new V.Point).setRectSpot(o.actualBounds,t);a.subtract(o.location),a.scale(2,2),a.x+=130*Math.sign(a.x),a.y+=130*Math.sign(a.y),a.add(o.location),a.snapToGridPoint(e.diagram.grid.gridOrigin,e.diagram.grid.gridCellSize);var r=i.copyNodeData(o.data);i.setGroupKeyForNodeData(r,i.getGroupKeyForNodeData(o.data)),i.addNodeData(r);var l={from:o.key,to:i.getKeyForNodeData(r)};i.addLinkData(l);var s=e.diagram.findNodeForData(r);s.location=a,e.diagram.select(s),setTimeout((function(){e.diagram.commandHandler.editTextBlock()}),20)}))};return e(V.Shape,{figure:n,alignment:t,alignmentFocus:t.opposite(),width:t.equals(V.Spot.Top)||t.equals(V.Spot.Bottom)?25:18,height:t.equals(V.Spot.Top)||t.equals(V.Spot.Bottom)?18:25,fill:"orange",stroke:d,strokeWidth:4,mouseEnter:function(e,t){return t.fill="dodgerblue"},mouseLeave:function(e,t){return t.fill="orange"},isActionable:!0,click:i,contextClick:i})}function y(t){return e(V.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,i){n.handled=!0,n.diagram.model.commit((function(n){n.set(i.part.adornedPart.data,e,t)}))}}function _(t,n){return n||(n="color"),e(V.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(V.Panel,"Horizontal",_(d,"fill"),_(p,"fill"),_(f,"fill"),_(h,"fill"))),e("ContextMenuButton",e(V.Panel,"Horizontal",_(g,"fill"),_(w,"fill"),_(m,"fill"),_(v,"fill")))]}function S(){return[e("ContextMenuButton",e(V.Panel,"Horizontal",_(u),_(r),_(n),_(t))),e("ContextMenuButton",e(V.Panel,"Horizontal",_(d),_(l),_(s),_(c)))]}function B(t,n){return n||(n="thickness"),e(V.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 C(t,n){return n||(n="dash"),e(V.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(V.Panel,"Horizontal",B(1),B(2),B(3),B(4))),e("ContextMenuButton",e(V.Panel,"Horizontal",C(null),C([2,4]),C([4,4])))]}function j(t,n){return n||(n="figure"),e(V.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(V.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(V.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 i=n.part.adornedPart;e.set(i.data,t?"toSpot":"fromSpot",V.Spot.stringify(V.Spot.AllSides)),(t?i.toNode:i.fromNode).invalidateConnectedLinks()}))};return e(V.Shape,{width:12,height:12,fill:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:n,contextClick:n})}function L(t,n){var i=0,o=V.Spot.RightSide;t.equals(V.Spot.Top)?(i=270,o=V.Spot.TopSide):t.equals(V.Spot.Left)?(i=180,o=V.Spot.LeftSide):t.equals(V.Spot.Bottom)&&(i=90,o=V.Spot.BottomSide),n||(i-=180);var a=function(e,t){e.handled=!0,e.diagram.model.commit((function(e){var i=t.part.adornedPart;e.set(i.data,n?"toSpot":"fromSpot",V.Spot.stringify(o)),(n?i.toNode:i.fromNode).invalidateConnectedLinks()}))};return e(V.Shape,{alignment:t,alignmentFocus:t.opposite(),geometryString:"M0 0 M12 12 M12 6 L1 6 L4 4 M1 6 L4 8",angle:i,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:a,contextClick:a})}return i.current=new V.Diagram(o.current,{padding:20,grid:e(V.Panel,"Grid",e(V.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(V.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(U),"clickCreatingTool.archetypeNodeData":{text:"未命名",fill:null,stroke:null,borderColor:"rgba(0,0,0,0)"},PartCreated:function(e){var t=e.subject;t.location=t.location.copy().snapToGridPoint(e.diagram.grid.gridOrigin,e.diagram.grid.gridCellSize),setTimeout((function(){e.diagram.commandHandler.editTextBlock()}),20)},"commandHandler.archetypeGroupData":{isGroup:!0,text:"NEW GROUP"},SelectionGrouped:function(e){e.subject;setTimeout((function(){e.diagram.commandHandler.editTextBlock()}))},LinkRelinked:function(e){e.parameter.part.invalidateConnectedLinks();var t=e.subject;e.diagram.toolManager.linkingTool.isForwards?t.toNode.invalidateConnectedLinks():t.fromNode.invalidateConnectedLinks()},"undoManager.isEnabled":!0}),i.current.nodeTemplate=e(V.Node,"Auto",{locationSpot:V.Spot.Center,locationObjectName:"SHAPE",desiredSize:new V.Size(120,60),minSize:new V.Size(40,40),resizable:!0,resizeCellSize:new V.Size(10,10),rotatable:!0},new V.Binding("location","loc",V.Point.parse).makeTwoWay(V.Point.stringify),new V.Binding("desiredSize","size",V.Size.parse).makeTwoWay(V.Size.stringify),e(V.Shape,{name:"SHAPE",fill:d,cursor:"pointer",portId:"",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:V.Spot.AllSides,toSpot:V.Spot.AllSides},new V.Binding("figure"),new V.Binding("fill"),new V.Binding("stroke","borderColor"),new V.Binding("strokeWidth","thickness"),new V.Binding("strokeDashArray","dash")),e(V.Shape,{width:100,height:20,strokeWidth:0,fill:"transparent"}),e(V.TextBlock,{margin:1,textAlign:"center",overflow:V.TextBlock.OverflowEllipsis,editable:!0},new V.Binding("text").makeTwoWay(),new V.Binding("stroke","color"))),i.current.nodeTemplate.toolTip=e("ToolTip",e(V.Panel,"Vertical",{maxSize:new V.Size(200,NaN)},e(V.TextBlock,{font:"bold 10pt sans-serif",textAlign:"center"},new V.Binding("text")),e(V.TextBlock,{font:"10pt sans-serif",textAlign:"center"},new V.Binding("text","details")))),i.current.nodeTemplate.selectionAdornmentTemplate=e(V.Adornment,"Spot",e(V.Placeholder,{padding:10}),b(V.Spot.Top,"TriangleUp"),b(V.Spot.Left,"TriangleLeft"),b(V.Spot.Right,"TriangleRight"),b(V.Spot.Bottom,"TriangleDown"),y({alignment:new V.Spot(.75,0)})),i.current.nodeTemplate.contextMenu=e("ContextMenu",e("ContextMenuButton",e(V.Panel,"Horizontal",j("Rectangle"),j("RoundedRectangle"),j("Ellipse"),j("Diamond"))),e("ContextMenuButton",e(V.Panel,"Horizontal",j("Parallelogram2"),j("ManualOperation"),j("Procedure"),j("Cylinder1"))),e("ContextMenuButton",e(V.Panel,"Horizontal",j("Terminator"),j("CreateRequest"),j("Document"),j("TriangleDown"))),k(),S(),T()),i.current.groupTemplate=e(V.Group,"Spot",{layerName:"Background",ungroupable:!0,locationSpot:V.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 V.Binding("location","loc",V.Point.parse).makeTwoWay(V.Point.stringify),e(V.Panel,"Auto",{name:"BODY"},e(V.Shape,{parameter1:10,fill:d,strokeWidth:2,cursor:"pointer",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:V.Spot.AllSides,toSpot:V.Spot.AllSides},new V.Binding("fill"),new V.Binding("stroke","color"),new V.Binding("strokeWidth","thickness"),new V.Binding("strokeDashArray","dash")),e(V.Placeholder,{background:"transparent",margin:20})),e(V.TextBlock,{alignment:V.Spot.Top,alignmentFocus:V.Spot.Bottom,font:"bold 12pt sans-serif",editable:!0},new V.Binding("text"),new V.Binding("stroke","color"))),i.current.groupTemplate.selectionAdornmentTemplate=e(V.Adornment,"Spot",e(V.Panel,"Auto",e(V.Shape,{fill:null,stroke:"dodgerblue",strokeWidth:3}),e(V.Placeholder,{margin:1.5})),y({alignment:V.Spot.TopRight,alignmentFocus:V.Spot.BottomRight})),i.current.groupTemplate.contextMenu=e("ContextMenu",k(),S(),T()),i.current.linkTemplate=e(V.Link,{layerName:"Foreground",routing:V.Link.AvoidsNodes,corner:10,fromShortLength:10,toShortLength:15,relinkableFrom:!0,relinkableTo:!0,reshapable:!0,resegmentable:!0},new V.Binding("fromSpot","fromSpot",V.Spot.parse),new V.Binding("toSpot","toSpot",V.Spot.parse),new V.Binding("fromShortLength","dir",(function(e){return e>=1?10:0})),new V.Binding("toShortLength","dir",(function(e){return e>=1?10:0})),new V.Binding("points").makeTwoWay(),e(V.Shape,{strokeWidth:2},new V.Binding("stroke","color"),new V.Binding("strokeWidth","thickness"),new V.Binding("strokeDashArray","dash")),e(V.Shape,{segmentIndex:0,segmentOffset:new V.Point(15,0),segmentOrientation:V.Link.OrientAlong,alignmentFocus:V.Spot.Right,figure:"circle",width:10,strokeWidth:0},new V.Binding("fill","color"),new V.Binding("visible","dir",(function(e){return 1===e}))),e(V.Shape,{segmentIndex:-1,segmentOffset:new V.Point(-10,6),segmentOrientation:V.Link.OrientPlus90,alignmentFocus:V.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new V.Binding("fill","color"),new V.Binding("visible","dir",(function(e){return e>=1})),new V.Binding("width","thickness",(function(e){return 7+3*e})),new V.Binding("height","thickness",(function(e){return 7+3*e})),new V.Binding("segmentOffset","thickness",(function(e){return new V.Point(-15,4+1.5*e)}))),e(V.Shape,{segmentIndex:0,segmentOffset:new V.Point(15,-6),segmentOrientation:V.Link.OrientMinus90,alignmentFocus:V.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new V.Binding("fill","color"),new V.Binding("visible","dir",(function(e){return 2===e})),new V.Binding("width","thickness",(function(e){return 7+3*e})),new V.Binding("height","thickness",(function(e){return 7+3*e})),new V.Binding("segmentOffset","thickness",(function(e){return new V.Point(-15,4+1.5*e)}))),e(V.TextBlock,{alignmentFocus:new V.Spot(0,1,-4,0),editable:!0},new V.Binding("text").makeTwoWay(),new V.Binding("stroke","color"))),i.current.linkTemplate.selectionAdornmentTemplate=e(V.Adornment,e(V.Shape,{isPanelMain:!0,stroke:"transparent",strokeWidth:6,pathPattern:P(2)},new V.Binding("pathPattern","thickness",P)),y({alignmentFocus:new V.Spot(0,0,-6,-4)})),i.current.linkTemplate.contextMenu=e("ContextMenu",S(),T(),e("ContextMenuButton",e(V.Panel,"Horizontal",N(0),N(1),N(2))),e("ContextMenuButton",e(V.Panel,"Horizontal",e(V.Panel,"Spot",E(!1),L(V.Spot.Top,!1),L(V.Spot.Left,!1),L(V.Spot.Right,!1),L(V.Spot.Bottom,!1)),e(V.Panel,"Spot",{margin:new V.Margin(0,0,0,2)},E(!0),L(V.Spot.Top,!0),L(V.Spot.Left,!0),L(V.Spot.Right,!0),L(V.Spot.Bottom,!0))))),new V.Palette(a.current,{maxSelectionCount:1,linkTemplate:e(V.Link,{locationSpot:V.Spot.Center,selectionAdornmentTemplate:e(V.Adornment,"Link",{locationSpot:V.Spot.Center},e(V.Shape,{isPanelMain:!0,fill:null,stroke:"deepskyblue",strokeWidth:0}),e(V.Shape,{toArrow:"Standard",stroke:null}))},{routing:V.Link.AvoidsNodes,curve:V.Link.JumpOver,corner:5,toShortLength:4},new V.Binding("points"),e(V.Shape,{isPanelMain:!0,strokeWidth:2}),e(V.Shape,{toArrow:"Standard",stroke:null})),model:new V.GraphLinksModel([{text:"未命名",size:"100 100",fill:null,stroke:"#000"}].concat(z()(V.Shape.getFigureGenerators().toArray().map((function(e){return{text:"未命名",size:"100 100",figure:e.key,fill:"white",stroke:"#666",borderColor:"#000"}})))))}).nodeTemplate=e(V.Node,"Auto",{locationSpot:V.Spot.Center},new V.Binding("location","location",V.Point.parse).makeTwoWay(V.Point.stringify),e(V.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 V.Binding("stroke").makeTwoWay(),new V.Binding("fill").makeTwoWay(),new V.Binding("figure")),e(V.TextBlock,{margin:new V.Margin(5,5,3,5),font:"10pt sans-serif",minSize:new V.Size(16,16),maxSize:new V.Size(10,NaN),textAlign:"center",editable:!0},new V.Binding("key").makeTwoWay())),setTimeout((function(){i.current.grid=e(V.Panel,"Grid",e(V.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(V.Shape,"LineV",{stroke:"lightgray",strokeWidth:.5})),i.current.grid.visible=!0,i.current.grid.gridCellStroke="darkgray",i.current.grid.gridCellStrokeWidth=1}),300),window.myDiagrams=i.current,i.current},divClassName:"diagram-component",style:{height:"80vh"}}),(0,h.jsx)("div",{ref:o})]})]}),(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:"保存到编辑器"})})]})})})},te=n(5112),ne=n(97913),ie=te.ZP.Group,oe={margin:"0 8px"},ae=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:oe,children:"单元格数:"}),(0,h.jsx)("span",{style:oe,children:"行数"}),(0,h.jsx)(_.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,h.jsx)(ne.Z,{})}),(0,h.jsx)("span",{style:oe,children:"列数"}),(0,h.jsx)(_.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,h.jsx)(ne.Z,{})})]}),(0,h.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,h.jsx)("span",{style:oe,children:"对齐方式:"}),(0,h.jsx)(_.Z.Item,{name:"align",children:(0,h.jsxs)(ie,{children:[(0,h.jsx)(te.ZP,{value:"default",children:(0,h.jsx)("i",{className:"fa fa-align-justify"})}),(0,h.jsx)(te.ZP,{value:"left",children:(0,h.jsx)("i",{className:"fa fa-align-left"})}),(0,h.jsx)(te.ZP,{value:"center",children:(0,h.jsx)("i",{className:"fa fa-align-center"})}),(0,h.jsx)(te.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:"取消"})]})]})},re=n(78673),le=n(66455),se=n.n(le),ce=(0,c.forwardRef)((function(e,t){var n=e.use3d,i=e.width,o=e.height,a=e.callback,l=(e.showSaveButton,(0,c.useRef)()),s=(0,c.useRef)(),d=(0,c.useState)(!1),u=r()(d,2),p=u[0],f=u[1],m=(0,c.useRef)({id:l,appName:"graphing",width:i||1e3,height:o||600,showToolBar:!0,showMenuBar:!0,allowStyleBar:!0,showAlgebraInput:!0,enableLabelDrags:!1,enableShiftDragZoom:!0,showToolBarHelp:!1,errorDialogsActive:!0,showTutorialLink:!0,showLogging:!0,useBrowserForJS:!1});(0,c.useEffect)((function(){s.current=new(se())(m.current,!0),window.onload=function(){s.current.inject("applet_container")}}),[]);var g=function(){var e=window.ggbApplet.getPNGBase64(1,!0,72);return a&&a(e),e};return(0,c.useEffect)((function(){m.current.appName=p?"3D":"graphing",s.current.inject("applet_container")}),[p]),(0,c.useEffect)((function(){f(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)(O.Z,{align:"middle",children:[(0,h.jsx)(J.Z,{flex:1,children:(0,h.jsx)(re.Z,{size:"default",checkedChildren:"关闭3D图像",unCheckedChildren:"开启3D图像",checked:p,onChange:function(e){return f(e)}})}),(0,h.jsx)(J.Z,{children:(0,h.jsx)(S.ZP,{size:"large",onClick:g,style:{zIndex:8,marginTop:10},type:"primary",children:"保存到编辑器"})})]})]})})),de=n(33773),ue=n(27065),pe="link",fe="upload-image",he="add-flowchart",me="draw-image",ge="code-block",we="add-table",ve="------------",be={default:ve,left:":".concat(ve),center:":".concat(ve,":"),right:"".concat(ve,":")},ye=n(56266);var xe="@▁▁@",_e=["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 ke(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var Se=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",Be=s()(s()({},Se+"-B","bold"),Se+"-I","italic"),Ce=s()(s()(s()(s()(s()(s()(s()(s()({},pe,"添加链接"),ge,"添加代码块"),fe,"添加图片"),me,"添加画图"),he,"插入流程图"),we,"添加表格"),"maths-latex","数学图像"),"inline-latex","LATEX公式"),Te=function(e){var t=e.defaultValue,n=void 0===t?"":t,i=e.onChange,a=e.width,l=void 0===a?"100%":a,d=e.height,g=void 0===d?400:d,w=e.miniToolbar,v=void 0!==w&&w,b=e.isFocus,_=void 0!==b&&b,k=e.watch,S=e.insertTemp,B=e.mode,P=void 0===B?"markdown":B,N=e.id,E=void 0===N?"markdown-editor-id":N,L=e.showResizeBar,M=void 0!==L&&L,O=e.noStorage,F=void 0!==O&&O,D=e.showNullButton,I=void 0!==D&&D,Z=e.showNullProgramButton,H=void 0!==Z&&Z,W=e.hidetoolBar,z=void 0!==W&&W,V=e.fullScreen,q=void 0!==V&&V,U=e.onBlur,K=e.onCMBeforeChange,J=e.onFullScreen,X=e.className,$=void 0===X?"":X,Q=e.disablePaste,te=void 0!==Q&&Q,ne=e.disabled,ie=void 0!==ne&&ne,oe=e.disabledFill,re=void 0!==oe&&oe,le=e.placeholder,se=void 0===le?"":le,ve=e.values,Se=void 0===ve?"":ve,Te=e.extraUse,je=(0,c.useState)(null),Pe=r()(je,2),Ne=Pe[0],Ee=Pe[1],Le=(0,c.useState)(n),Ae=r()(Le,2),Me=Ae[0],Ge=Ae[1],Oe=(0,c.useState)(k),Fe=r()(Oe,2),Re=Fe[0],De=Fe[1],Ie=(0,c.useState)(q),Ze=r()(Ie,2),He=Ze[0],We=Ze[1],ze=(0,c.useState)(""),Ve=r()(ze,2),qe=Ve[0],Ue=Ve[1],Ke=(0,c.useState)(0),Ye=r()(Ke,2),Je=Ye[0],Xe=Ye[1],$e=(0,c.useState)(g),Qe=r()($e,2),et=Qe[0],tt=Qe[1],nt=(0,c.useState)(!1),it=r()(nt,2),ot=(it[0],it[1]),at=(0,c.useState)(0),rt=r()(at,2),lt=rt[0],st=rt[1],ct=(0,c.useState)(0),dt=r()(ct,2),ut=dt[0],pt=dt[1],ft=(0,c.useRef)(),ht=(0,c.useRef)(),mt=(0,c.useRef)(),gt=(0,c.useRef)();(0,c.useEffect)((function(){var e=window.scrollY||window.pageYOffset;Ge(Se),null==Ne||Ne.setValue(Se),window.scrollTo(0,e)}),[Se]),(0,c.useEffect)((function(){null==J||J(He)}),[He]),(0,c.useEffect)((function(){if(ft.current){var e=function(e,n){if(!te){var i=n.clipboardData;if(i){var o=i.types.toString(),a=i.items;if("Files"===o||i.types.indexOf("Files")>-1){if(n.preventDefault(),"stex"==P)return;try{var r,l=a[1];"file"===(null===(r=a[0])||void 0===r?void 0:r.kind)&&(l=a[0]);var s=l.getAsFile(),c=s.name.split(".").pop();G(s,(function(e){var n,i,o;e.id?(null==s||null===(n=s.type)||void 0===n?void 0:n.indexOf("image"))>-1?t.replaceSelection(".concat(e.content_type,")")):(null==s||null===(i=s.type)||void 0===i?void 0:i.indexOf("video"))>-1?t.replaceSelection('<video width="100%" controls src="'.concat(ue.Z.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==s||null===(o=s.type)||void 0===o?void 0:o.indexOf("pdf"))>-1?t.replaceSelection('<a href="'.concat(ue.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(s.type,'&disposition=inline" target="_blank">').concat(s.name,"</a>")):_e.includes(c)?t.replaceSelection('<a href="'.concat(ue.Z.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(s.name,"</a>")):t.replaceSelection("[".concat(s.name,"](").concat(ue.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){j.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}n.preventDefault()},t=u().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",se):t.setOption("placeholder",null))})),t.on("keydown",(function(e,t){if(8===t.keyCode){var n=function(e,t){var n=e.getDoc(),i=n.getCursor(),o=n.getLine(i.line),a=o.charAt(i.ch-1),r=o.lastIndexOf("@▁@",i.ch),l=o.lastIndexOf("@▁▁@",i.ch),s=r>l?r:l,c=r>l?3:4;if(-1===xe.indexOf(a))return null;if(console.log("change1:",t,e,o,i,s,r,l,a),s>=0&&i.ch-s<5){var d=s+c;return n.replaceRange("",{line:i.line,ch:s},{line:i.line,ch:d}),{line:i.line,ch:d}}return null}(e);n&&t.preventDefault()}})),_&&t.focus(),t.on("paste",e),ie&&t.on("beforeChange",(function(e,t){"paste"!==t.origin&&"+input"!==t.origin||t.cancel()})),Ee(t),function(){t.off("paste",e)}}}),[]);var wt=(0,c.useCallback)((function(){ht.current}),[et,ht,He]);(0,c.useEffect)((function(){if(Ne){var e=function(){var e=new p.Z((function(e){var t,n=o()(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;(i.target.offsetHeight>0||i.target.offsetWidth>0)&&(wt(),Ne.setSize("100%","100%"),Ne.refresh())}}catch(e){n.e(e)}finally{n.f()}}));return e.observe(ft.current.parentElement),e}();return function(){var t,n;null!==(t=ft.current)&&void 0!==t&&t.parentElement&&e.unobserve(null===(n=ft.current)||void 0===n?void 0:n.parentElement)}}}),[Ne,wt]),(0,c.useEffect)((function(){if(Ne){for(var e=[],t=function(){var t=r()(i[n],2),o=t[0],a=t[1],l=s()({},o,(function(){vt(a)}));e.push(l),Ne.addKeyMap(l)},n=0,i=Object.entries(Be);n<i.length;n++)t();return function(){for(var t=0,n=e;t<n.length;t++){var i=n[t];Ne.removeKeyMap(i)}}}}),[Ne]),(0,c.useEffect)((function(){q!==He&&We(q)}),[q]),(0,ye.Z)((function(){if(!F&&Je>0){var e=(new Date).getTime(),t=window.sessionStorage.getItem(E);e>=Je+1e4&&(!t||t!==Me)&&(window.sessionStorage.setItem(E,Me),ot(!0))}}),1e4),(0,c.useEffect)((function(){De(k)}),[Ne,k]),(0,c.useEffect)((function(){Ne&&_&&Ne.focus()}),[Ne,_]),(0,c.useEffect)((function(){if(Re&&Ne){var e=function(e){var t=e.target;if(gt.current){var n=t.scrollTop/t.scrollHeight;gt.current.scrollTop=gt.current.scrollHeight*n}},t=Ne.getScrollerElement();return t.addEventListener("scroll",e),function(){t.removeEventListener("scroll",e)}}}),[Ne,Re]),(0,c.useEffect)((function(){if(Ne&&K){var e=function(e,t){K(e,t)};return Ne.on("beforeChange",e),function(){Ne.off("beforeChange",e)}}}),[Ne,K]),(0,c.useEffect)((function(){if(Ne&&U){var e=function(){U(Ne.getValue())};return Ne.on("blur",e),function(){Ne.off("blur",e)}}}),[Ne,U]),(0,c.useEffect)((function(){if(Ne){var e=function(e,t){var n=e.getValue();Ge(n),Xe((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),i&&(H?i(n,kt(n)):i(n))};return Ne.on("change",e),function(){Ne.off("change",e)}}}),[Ne,i]),(0,c.useEffect)((function(){if(Ne)if(null==n)Ne.setValue(""),Ge("");else{var e=window.scrollY||window.pageYOffset;n!==Ne.getValue()&&(Ne.setValue(n),Ge(n),Ne.setCursor(ie?1:Ne.lineCount(),0),window.scrollTo(0,e))}}),[Ne,n]);var vt=(0,c.useCallback)((function(e){var t=Ne.getCursor(),n=Ne.getSelection(),i=n.split("\n");switch(e){case"bold":return Ne.replaceSelection("**"+n+"**"),""===n&&Ne.setCursor(t.line,t.ch+2),Ne.focus();case"italic":return Ne.replaceSelection("*"+n+"*"),""===n&&Ne.setCursor(t.line,t.ch+1),Ne.focus();case"code":return Ne.replaceSelection("`"+n+"`"),""===n&&Ne.setCursor(t.line,t.ch+1),Ne.focus();case"inline-latex":return Ue("inline-latex"),Ne.focus();case"latex":return Ne.replaceSelection("```latex\n"+n+"\n```"),Ne.setCursor(t.line+1,n.length+1),Ne.focus();case"line-break":return Ne.replaceSelection("<br/>\n"),Ne.focus();case"list-ul":return""===n?Ne.replaceSelection("- "+n):Ne.replaceSelection(i.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Ne.focus();case"list-ol":return""===n?Ne.replaceSelection("1. "+n):Ne.replaceSelection(i.map((function(e,t){return""===e?"":"".concat(t+1,". ").concat(e)})).join("\n")),Ne.focus();case"add-null-ch":return""===n&&Ne.setCursor(t.line,t.ch),Ne.replaceSelection("▁"),Ne.focus();case"add-signal":return""===n&&Ne.setCursor(t.line,t.ch),Ne.replaceSelection("@▁@"),Ne.focus();case"add-multiple":return""===n&&Ne.setCursor(t.line,t.ch),Ne.replaceSelection(xe),Ne.focus();case"inster-template-1":return""===n&&Ne.setCursor(t.line,t.ch),Ne.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),Ne.focus();case"eraser":return Ne.setValue(""),Ne.focus();case"trigger-watch":return De(!Re),Ne.focus();case"trigger-full-screen":return We(!He),Ne.focus();case pe:return void Ue(pe);case ge:return void Ue(ge);case fe:return void Ue(fe);case me:return void Ue(me);case"maths-latex":return void Ue("maths-latex");case he:return void Ue(he);case we:return void Ue(we);default:throw new Error}}),[Ne,Re,He]),bt=(0,c.useCallback)((function(e,t){var n,i,o,a,r;switch(Ue(""),qe){case pe:var l=e.title,s=e.link;return Ne.replaceSelection("[".concat(l,"](").concat(s,")")),Ne.focus();case ge:var c=e.language,d=e.content;return Ne.replaceSelection(["```"+c,d,"```"].join("\n")),Ne.focus();case"maths-latex":for(var u=atob(e),p=new Uint8Array(u.length),f=0;f<u.length;f++)p[f]=u.charCodeAt(f);G(new Blob([p],{type:"image/png"}),(function(e){e.id?Ne.replaceSelection(".concat(e.content_type,")")):401===(null==e?void 0:e.status)&&(document.location.href="/user/login")}));break;case"inline-latex":Ne.replaceSelection("`$$"+e+"$$`");break;case fe:case me:case"add-flowchart":var h=e.src,m=e.alt,g=t,w=null==g||null===(n=g.name)||void 0===n||null===(n=n.split("."))||void 0===n||null===(i=n.pop)||void 0===i?void 0:i.call(n);return(null==g||null===(o=g.type)||void 0===o?void 0:o.indexOf("image"))>-1||null==g||!g.type?m?Ne.replaceSelection(".concat(h,' "').concat(m,'" )')):Ne.replaceSelection("")):(null==g||null===(a=g.type)||void 0===a?void 0:a.indexOf("video"))>-1?Ne.replaceSelection('<video width="100%" controls src="'.concat(ue.Z.API_SERVER).concat(h,'"></video>')):(null==g||null===(r=g.type)||void 0===r?void 0:r.indexOf("pdf"))>-1?Ne.replaceSelection('<a href="'.concat(ue.Z.API_SERVER).concat(h,"?type=").concat(g.type,'&disposition=inline" target="_blank">').concat(g.name,"</a>")):_e.includes(w)?Ne.replaceSelection('<a href="'.concat(ue.Z.API_SERVER).concat(h,'?type=office&disposition=inline" target="_blank">').concat(g.name,"</a>")):Ne.replaceSelection("[".concat(g.name,"](").concat(ue.Z.API_SERVER).concat(h,")")),Ne.focus();case we:for(var v=e.row,b=e.col,y=e.align,x="\n",_=0;_<v;_++){for(var k=[],S=[],B=0;B<b;B++)1===_&&S.push(be[y]),k.push(" ");1===_&&(x+="| ".concat(S.join(" | ")," |\n")),x+="| ".concat(k.join(1===b?"":" | ")," |\n")}return Ne.replaceSelection(x+"\n"),Ne.focus();default:throw new Error}}),[Ne,qe]),yt=(0,c.useMemo)((function(){switch(qe){case pe:return(0,h.jsx)(C,{callback:bt,onCancel:xt});case ge:return(0,h.jsx)(T.Z,{callback:bt,onCancel:xt});case fe:return(0,h.jsx)(A,{callback:bt,onCancel:xt});case he:return(0,h.jsx)(ee,{callback:bt,onCancel:xt});case we:return(0,h.jsx)(ae,{callback:bt,onCancel:xt});case"maths-latex":return(0,h.jsx)(ce,{showSaveButton:!0,callback:bt});case"inline-latex":return(0,h.jsx)(de.Z,{showSaveButton:!0,callback:bt});default:return null}}),[qe]);function xt(){Ue("")}(0,c.useEffect)((function(){if(mt.current){var e=function(e){o=!0,a=e.pageY},t=function(){o=!1},n=function(e){if(o){var t=e.pageY-a;t<0&&(t=0),t>300&&(t=300),tt(g+t+"px")}},i=mt.current,o=!1,a=0;return i.addEventListener("mousedown",e),document.addEventListener("mousemove",n),document.addEventListener("mouseup",t),function(){i.removeEventListener("mousedown",e),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",t)}}}),[Ne,mt]),(0,c.useEffect)((function(){tt(g)}),[g]);var _t={width:ke(l),height:ke(et)},kt=((0,c.useMemo)((function(){if(Je){var e=new Date(Je),t=e.getHours(),n=e.getMinutes(),i=e.getSeconds();return n=n<10?"0"+n:n,i=i<10?"0"+i:i,"".concat(t=t<10?"0"+t:t,":").concat(n,":").concat(i)}return 0}),[Je]),function(e){var t=[];if(H){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,n,i){t.push({multiLine:!("@▁@"===e)})}))}return t});(0,c.useEffect)((function(){if(Ce[qe]&&qe!==me&&qe!==he){var e=document.getElementsByClassName("ant-modal")[0],t=window.innerWidth/2-e.offsetWidth/2,n=window.innerHeight/2-e.offsetHeight/2;st(t),pt(n)}}),[qe]);var St=function(e,t,n,i){var o=document.body.clientHeight,a=document.body.clientWidth;return!(e<20&&n>e||e>a-20&&n<e||t<20&&i>t||t>o-20&&i<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:ht,children:(0,h.jsxs)("div",{className:"markdown-editor-container ".concat($," ").concat(Re?"on-preview":""," ").concat(v?"mini":""," ").concat(He?"full-screen":""),style:_t,children:[(0,h.jsx)(y,{insertTemp:S,watch:Re,fullScreen:He,showNullButton:I,showNullProgramButton:H,onActionCallback:vt,hidetoolBar:z,extraUse:Te}),(0,h.jsxs)("div",{className:"markdown-editor-body",children:[(0,h.jsx)("div",{className:"codemirror-container",children:(0,h.jsx)("textarea",{ref:ft,placeholder:se})}),Re?(0,h.jsxs)("div",{ref:gt,className:"preview-container",children:["stex"===P&&(0,h.jsx)(m,{value:Me}),"stex"!==P&&(0,h.jsx)(f.Z,{disabledFill:re,showProgramFill:H,value:Me})]}):null]})]})}),M?(0,h.jsx)("a",{ref:mt,className:"editor-resize"}):null,qe===me&&(0,h.jsx)(R,{callback:bt,onCancel:xt}),qe===he&&(0,h.jsx)(ee,{callback:bt,onCancel:xt}),(0,h.jsx)(x.Z,{children:Ce[qe]&&qe!==me&&qe!==he?(0,h.jsx)(Y.Z,{maskClosable:!1,centered:!0,style:{position:"absolute",left:lt,top:ut},title:(0,h.jsx)("div",{style:{cursor:"move"},onMouseDown:function(e){e.preventDefault();var t=e.clientX-lt,n=e.clientY-ut;document.body.onmousemove=function(e){var i=e.clientX-t,o=e.clientY-n,a=document.getElementsByClassName("ant-modal")[0],r=window.innerWidth-a.offsetWidth,l=window.innerHeight-a.offsetHeight;i=Math.max(0,Math.min(i,r)),o=Math.max(0,Math.min(o,l)),St(e.clientX,e.clientY,t,n)&&(st(i),pt(o))},document.body.onmouseup=function(){document.body.onmousemove=null}},children:Ce[qe]}),open:!0,onCancel:xt,footer:null,destroyOnClose:!0,width:qe===he?"1200px":null,height:qe===he?"80vh":null,className:"markdown-popup-form",children:yt}):null})]})}},27308:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var i=n(82100),o=n.n(i),a=n(29186),r=n.n(a),l=n(80619),s=n.n(l),c=n(47074),d=n.n(c),u=n(59301),p=n(4676),f=function(e){s()(n,e);var t=d()(n);function n(e){var i;o()(this,n),i=t.call(this,e);var a=window.document;return i.node=a.createElement("div"),a.body.appendChild(i.node),i}return r()(n,[{key:"render",value:function(){var e=this.props.children;return(0,p.createPortal)(e,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),n}(u.Component)},56266:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var i=n(59301);function o(e,t){var n=(0,i.useRef)();(0,i.useEffect)((function(){n.current=e})),(0,i.useEffect)((function(){if(null!==t){var e=setInterval((function(){n.current()}),t);return function(){return clearInterval(e)}}}),[t])}},66561:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return E}});var i=n(82242),o=n.n(i),a=n(7557),r=n.n(a),l=n(37205),s=n.n(l),c=n(41498),d=n.n(c),u=n(79800),p=n.n(u),f=n(59301),h=n(7880),m=n(78241),g=n(8591),w=n(66104),v=n(8772),b=n(21068),y=n(3113),x=n(11094),_=n(3479),k=n(27065),S="bg___VqFqM",B="formWrap___iwUem",C="fieldWrap___tSPUZ",T="mdWrap___C7Agk",j="backgroundFa___FaNz_",P="button___fqiOn",N=n(37712),E=(0,h.connect)((function(e){var t=e.shixunHomeworks,n=e.newCourse,i=e.loading;return{shixunHomeworks:t,newCourse:n,globalSetting:e.globalSetting,loading:i.effects}}))((function(e){var t,n=e.shixunHomeworks,i=(e.newCourse,e.globalSetting,e.loading,e.dispatch),a=(e.match,(0,h.useParams)()),l=m.Z.useForm(),c=p()(l,1)[0],u=(0,f.useState)({}),E=p()(u,2),L=E[0],A=E[1],M=(0,f.useState)(!1),G=p()(M,2),O=G[0],F=G[1],R=(0,f.useState)([]),D=p()(R,2),I=D[0],Z=D[1],H=(0,f.useState)([]),W=p()(H,2),z=W[0],V=W[1],q=n.commonHomeWorkEditDefaultData,U={name:"file",multiple:!0,action:k.Z.API_SERVER+"/api/attachments.json",defaultFileList:I,onChange:function(e){var t=e.file.status;"done"===t?g.ZP.success("".concat(e.file.name," 文件上传成功")):"error"===t&&g.ZP.error("".concat(e.file.name," 文件上传失败"))}};(0,f.useEffect)((function(){Y()}),[a.topicId]);var K=function(e){return null==e?void 0:e.map((function(e){return{uid:e.id,response:{id:e.id},name:e.title,status:"done",url:e.url}}))},Y=function(){var e=d()(r()().mark((function e(){var t;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:a.topicId}});case 2:(t=e.sent)&&(c.setFieldsValue({name:t.name}),c.setFieldsValue({description:t.description}),c.setFieldsValue({reference_answer:t.reference_answer}),Z(s()(K(t.attachments))),V(s()(K(t.reference_attachments))),F(!0));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),J=function(){var e=d()(r()().mark((function e(t){var n,i,l;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=o()({},L)).attachment_ids&&(n.attachment_ids=null==n||null===(i=n.attachment_ids.fileList)||void 0===i?void 0:i.map((function(e){var t;return null===(t=e.response)||void 0===t?void 0:t.id}))),n.reference_attachment_ids&&(n.reference_attachment_ids=null==n||null===(l=n.reference_attachment_ids.fileList)||void 0===l?void 0:l.map((function(e){var t;return null===(t=e.response)||void 0===t?void 0:t.id}))),e.next=5,(0,_.yT)(o()(o()({id:a.topicId},n),{},{base_on_project:null,type:1}));case 5:e.sent&&h.history.push("/users/".concat(a.username,"/topics/").concat(a.topicId,"/").concat(a.topictype,"/normal/detail"));case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return(0,N.jsxs)("section",{className:S,children:[(0,N.jsx)("section",{className:"animated fadeIn",children:(0,N.jsx)("aside",{className:"mt10",children:(0,N.jsxs)(w.Z,{separator:">",children:[(0,N.jsx)(w.Z.Item,{children:(0,N.jsx)(h.Link,{to:"/users/".concat(a.username,"/").concat("personal"===a.topictype?"topics":"topicbank","/").concat(a.topictype),children:"personal"===a.topictype?"我的课堂资源":"公共题库"})}),(0,N.jsx)(w.Z.Item,{children:(0,N.jsx)(h.Link,{to:"/users/".concat(a.username,"/topics/").concat(a.topicId,"/").concat(a.topictype,"/normal/detail"),children:"详情"})}),(0,N.jsx)(w.Z.Item,{children:"编辑"})]})})}),(0,N.jsx)("aside",{className:"font24 bold mt20 mb20",children:"编辑"}),(0,N.jsxs)(m.Z,{form:c,className:B,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){A(o()({},c.getFieldsValue()))},onFinish:J,children:[(0,N.jsx)("div",{className:C,children:(0,N.jsx)(m.Z.Item,{name:"name",label:"标题:",rules:[{required:!0,message:"请输入标题"}],children:(0,N.jsx)(v.Z,{maxLength:60,suffix:"".concat((null===(t=L.name)||void 0===t?void 0:t.length)||0,"/60"),placeholder:"例如:从Python程序设计-入门精通"})})}),(0,N.jsxs)("div",{className:T,children:[(0,N.jsx)(m.Z.Item,{name:"description",label:"简介:",rules:[{required:!0,message:"请输入作业的简介"},{max:5e3,message:"作业简介最大限制5000个字符"}],children:(0,N.jsx)(x.Z,{id:"topic-normal-description",watch:!0,defaultValue:q.description})}),(0,N.jsx)("div",{children:(0,N.jsx)(m.Z.Item,{name:"attachment_ids",children:O&&(0,N.jsxs)(b.Z,o()(o()({defaultFileList:I},U),{},{children:[(0,N.jsx)("span",{className:"c-blue",children:"上传附件"})," (单个文件150MB以内)"]}))})})]}),(0,N.jsxs)("div",{className:T,children:[(0,N.jsx)(m.Z.Item,{name:"reference_answer",label:"参考答案:",children:(0,N.jsx)(x.Z,{id:"topic-normal-reference_answer",defaultValue:q.reference_answer,watch:!0})}),(0,N.jsx)("div",{children:(0,N.jsx)(m.Z.Item,{name:"reference_attachment_ids",children:O&&(0,N.jsxs)(b.Z,o()(o()({},U),{},{defaultFileList:z,children:[(0,N.jsx)("span",{className:"c-blue",children:"上传附件"})," (单个文件150MB以内)"]}))})})]}),(0,N.jsx)("div",{className:j,children:(0,N.jsx)("div",{className:"pt40 mb30",children:(0,N.jsxs)(m.Z.Item,{children:[(0,N.jsx)(y.ZP,{size:"middle",type:"primary",className:"".concat(P," mr20"),htmlType:"submit",children:"提交"}),(0,N.jsx)(y.ZP,{size:"middle",type:"primary",ghost:!0,className:P,onClick:function(){return h.history.push("/users/".concat(a.username,"/topics/").concat(a.topicId,"/").concat(a.topictype,"/normal/detail"))},children:"取消"})]})})})]})]})}))}}]); |